🔷 儲存格表達式實現原理

<aside> ⚠️ 暫不實現 groupParam 功能

</aside>

#cmdName:cmdParam#<groupName:groupParam>[arrayName:arrayParam]{propName:propParam}text

實現原理為透過 group 將 cell 分組,並將 array 參數展開與 prop 參數合併,最後依據 prop 替換數值並刪除 group 標記。

設有以下資料:

{
  users: [
    {
      name: '鱈魚',
      id: 'cod',
      messages: [
        {
          text: '安安',
          time: '2022/04/01 10:00',
        },
        {
          text: '訊息2',
          time: '2022/08/01 11:10',
        },
      ]
    },
    {
      name: '狗',
      id: 'dog',
      messages: [
        {
          text: '汪',
          time: '2022/02/01 00:10',
        },
        {
          text: '汪汪汪汪汪',
          time: '2022/04/01 06:11',
        },
      ]
    },
  ],
  total: 2
}

模板為:

A B C
1 使用者留言
2 <user>[users]{name} [users]{id}
3 <msg>[users.*.messages]{time} </msg>[users.*.messages]{text}
4 </user>
5 總人數 {total}
6

取得所有 Group

從最大群組開始處理。

最大群組為 group,其中包含:A2、A3、A4、B2、B3、B4 儲存格。