@kne/form-creator 0.1.29 → 0.1.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -25,7 +25,7 @@ var ButtonGroup__default = /*#__PURE__*/_interopDefaultLegacy(ButtonGroup);
25
25
  var FormInfo__default = /*#__PURE__*/_interopDefaultLegacy(FormInfo);
26
26
  var InfoPage__default = /*#__PURE__*/_interopDefaultLegacy(InfoPage);
27
27
 
28
- var style = {"kne-responsive-boundary":"kne-form-creator_gh14z","kne-responsive-scroll":"kne-form-creator_Kfn6L","option-group-stack":"kne-form-creator_TgBT-","form-info-show-index":"kne-form-creator_rqCos","field-label-index":"kne-form-creator_MLY0O","field-label-main":"kne-form-creator_UOUb4","form-creator":"kne-form-creator_Xrjrk","editor-pane":"kne-form-creator_Skfuv","preview-pane":"kne-form-creator_v4Lsp","editor-header":"kne-form-creator_WaSS-","block-list-panel":"kne-form-creator_lx8An","form-actions-setting-btn":"kne-form-creator_NekU2","panel-toolbar":"kne-form-creator_t0WxZ","panel-toolbar-extra":"kne-form-creator_O22ZM","schema-content":"kne-form-creator_9bWOD","schema-content-fields":"kne-form-creator_EmRDV","schema-content-field":"kne-form-creator_0Lanz","schema-content-field-block":"kne-form-creator_TQd-w","schema-content-field-label":"kne-form-creator_czEK3","schema-content-field-value":"kne-form-creator_YFKTK","schema-content-file-list":"kne-form-creator_UGdXA","schema-content-file":"kne-form-creator_75EtE","schema-content-file-image":"kne-form-creator_P-be6","schema-content-file-name":"kne-form-creator_NXpTS","add-block-btn":"kne-form-creator_16Zre","add-inline-btn":"kne-form-creator_iCYdB","ant-btn-disabled":"kne-form-creator_LdGtv","block-list":"kne-form-creator_wK5eK","block-section":"kne-form-creator_15IiK","block-kind-formInfo":"kne-form-creator_D0hoK","block-kind-list":"kne-form-creator_JdPhy","block-kind-tableList":"kne-form-creator_gzd64","block-kind-editableList":"kne-form-creator_JzwrQ","block-kind-multiField":"kne-form-creator_t0iOJ","block-kind-matrixScale":"kne-form-creator_CFlQv","matrix-scale-editor-title":"kne-form-creator_Zo1Rz","block-kind-steps":"kne-form-creator_QNF9W","step-section":"kne-form-creator_22ajp","block-section-header":"kne-form-creator_wS4rL","block-header-meta":"kne-form-creator_PQiYV","block-title":"kne-form-creator_wSVJf","block-collapse-btn":"kne-form-creator_Ufp-W","is-expanded":"kne-form-creator_OjfBl","drag-handle":"kne-form-creator_7GuXk","more-btn":"kne-form-creator_paWIZ","drag-handle-action":"kne-form-creator_lhTrX","sortable-ghost":"kne-form-creator_7ZIH8","sortable-drag":"kne-form-creator_dxhFH","action-group":"kne-form-creator_773yo","hover-reveal":"kne-form-creator_S234h","block-summary":"kne-form-creator_GzeW8","block-summary-type":"kne-form-creator_0iyhP","block-header-actions":"kne-form-creator_Ue-nT","block-body":"kne-form-creator_je1H0","item-blocks-section":"kne-form-creator_wq4bT","nested-block-list":"kne-form-creator_4NWH4","block-section-nested":"kne-form-creator_mUKom","add-field-dropdown":"kne-form-creator_9JS0d","add-field-dropdown-item":"kne-form-creator_Ql1z3","add-field-dropdown-item-icon":"kne-form-creator_ZHB5O","add-field-dropdown-item-desc":"kne-form-creator_dcsOS","add-field-dropdown-divider":"kne-form-creator_CUK0H","add-field-dropdown-label":"kne-form-creator_bPJ-2","section-toolbar":"kne-form-creator_LUO8S","section-toolbar-label":"kne-form-creator_7KQ79","field-list":"kne-form-creator_-B7WZ","step-list":"kne-form-creator_kc1pH","step-section-header":"kne-form-creator_wkhEX","step-section-title":"kne-form-creator_NBinE","step-index":"kne-form-creator_CCKZZ","step-section-text":"kne-form-creator_hRFew","step-section-count":"kne-form-creator_G6Quc","step-section-actions":"kne-form-creator_es-FC","field-row":"kne-form-creator_XMkdt","field-row-index":"kne-form-creator_a-cDo","has-handle":"kne-form-creator_vbTgK","field-row-index-num":"kne-form-creator_e4yEp","field-row-main":"kne-form-creator_ftlwp","field-row-label":"kne-form-creator_XAxbE","inline-empty":"kne-form-creator_yP-RF","hover-reveal-active":"kne-form-creator_AE-6r","action-btn":"kne-form-creator_mLgqh","add-block-dropdown":"kne-form-creator_vmS-e","add-block-option":"kne-form-creator_gjg2Y","add-block-option-icon":"kne-form-creator_qh1hh","add-block-option-text":"kne-form-creator_G8iJO","add-block-option-title":"kne-form-creator_ETSvm","add-block-option-desc":"kne-form-creator_O0C3l","field-empty":"kne-form-creator_Nmpfl","field-label-tips-icon":"kne-form-creator_0VVaO","preview-header":"kne-form-creator_c4BT0","preview-title":"kne-form-creator_fPkK4","preview-body":"kne-form-creator_6JntQ","schema-form":"kne-form-creator_MxCWP","schema-body":"kne-form-creator_q9ydz","schema-actions":"kne-form-creator_Y4eEH","schema-actions-inner":"kne-form-creator_FT9Zf","choice-block":"kne-form-creator_RllJe","choice-selector":"kne-form-creator_5A1eM","choice-panels":"kne-form-creator_IO0MY","choice-panels-empty":"kne-form-creator_T0nND","choice-option-panel":"kne-form-creator_FQixN","choice-option-panel-title":"kne-form-creator_ofRo2","choice-option-summary":"kne-form-creator_pksH8","property-modal":"kne-form-creator_wRSZC","editor-intro":"kne-form-creator_uOGOq","field-editor-form":"kne-form-creator_PGPHL","editor-toggles":"kne-form-creator_Dfyhx","options-editor":"kne-form-creator_AK4yO","columns-editor":"kne-form-creator_DQW1N","table-rows-editor":"kne-form-creator_-meJG","is-plain":"kne-form-creator_IiViE","form-actions-editor":"kne-form-creator_fchMy","form-actions-switch-field":"kne-form-creator_6JE9x","form-actions-align-group":"kne-form-creator_51ZsV","form-actions-gap-slider":"kne-form-creator_Gq0bk","editor-section":"kne-form-creator_jJy85","section-divider":"kne-form-creator_zA7L-","rule-editor":"kne-form-creator_bAlGU","super-select-props":"kne-form-creator_Iawhh","field-props-editor":"kne-form-creator_Gabf2","prop-row":"kne-form-creator_7K54P","prop-label":"kne-form-creator_HAAyH","options-item":"kne-form-creator_dnOd2","table-row-card":"kne-form-creator_cwCYp","tree-options-editor":"kne-form-creator_s3nHO","tree-options-list":"kne-form-creator_Djs-E","tree-option-node":"kne-form-creator_XAcut","tree-option-row":"kne-form-creator_4K4Rj","tree-option-fields":"kne-form-creator_-4cjc","tree-option-actions":"kne-form-creator_IjCNI","tree-option-children":"kne-form-creator_pVPGJ","tree-add-sibling":"kne-form-creator_bl46P","rule-checkbox-group":"kne-form-creator_tDgVP","rule-len-row":"kne-form-creator_ATsae","rule-len-input":"kne-form-creator_jY4Ld","rule-len-sep":"kne-form-creator_jBDC8","options-list":"kne-form-creator_GUBNS","options-row":"kne-form-creator_uohD0","options-header":"kne-form-creator_As4L6","options-locale-text":"kne-form-creator_7-99l","options-header-label":"kne-form-creator_UhnVH","options-header-value":"kne-form-creator_2c35V","options-header-description":"kne-form-creator_ibWvX","icon-square-btn-sm":"kne-form-creator_GAh-t","options-header-action":"kne-form-creator_nTN1E","visible-when-editor":"kne-form-creator_ttGnB","visible-when-hint":"kne-form-creator_hPtdv","visible-when-list":"kne-form-creator_aoAt6","visible-when-row":"kne-form-creator_phRgr","visible-when-row-main":"kne-form-creator_l-J7d","visible-when-field":"kne-form-creator_YRh5W","visible-when-operator":"kne-form-creator_DIqFq","visible-when-value":"kne-form-creator_CHcia","visible-when-regex":"kne-form-creator_lKpVo","visible-when-flags":"kne-form-creator_Ps-cu","visible-when-regex-tester":"kne-form-creator_Wf4eG","options-tip":"kne-form-creator_vrTmK","icon-square-btn":"kne-form-creator_DZjCf","locale-text":"kne-form-creator_hMXkE","is-compact":"kne-form-creator_jBFpL","locale-text-item":"kne-form-creator_NqCQD","locale-text-prefix":"kne-form-creator_BQl2X","locale-text-tag":"kne-form-creator_65OWA","is-mobile":"kne-form-creator_LtgJz","add-inline-btn-icon":"kne-form-creator_jbBze","steps-focus":"kne-form-creator_BzrAJ","steps-focus-header":"kne-form-creator_fF02T","steps-focus-meta":"kne-form-creator_4Q3Nt","steps-focus-count":"kne-form-creator_-vGec","steps-focus-count-current":"kne-form-creator_vXk2o","steps-focus-count-total":"kne-form-creator_bpGjx","steps-focus-next":"kne-form-creator_a2ZfJ","steps-focus-title":"kne-form-creator_Q5bvO","steps-focus-track":"kne-form-creator_Cdvj5","steps-focus-segment":"kne-form-creator_4z3t0","is-done":"kne-form-creator_nBNzi","is-current":"kne-form-creator_a8lqo","steps-focus-actions":"kne-form-creator_NgZBR","steps-focus-actions-side":"kne-form-creator_ynPls","is-end":"kne-form-creator_syD91","steps-focus-prev":"kne-form-creator_5NtBV","steps-focus-next-btn":"kne-form-creator_1mMAJ","steps-focus-next-btn-icon":"kne-form-creator_OQvek","steps-focus-done-hint":"kne-form-creator_b0T7j"};
28
+ var style = {"kne-responsive-boundary":"kne-form-creator_gh14z","kne-responsive-scroll":"kne-form-creator_Kfn6L","option-group-stack":"kne-form-creator_TgBT-","form-info-show-index":"kne-form-creator_rqCos","field-label-index":"kne-form-creator_MLY0O","field-label-main":"kne-form-creator_UOUb4","form-creator":"kne-form-creator_Xrjrk","editor-pane":"kne-form-creator_Skfuv","preview-pane":"kne-form-creator_v4Lsp","editor-header":"kne-form-creator_WaSS-","block-list-panel":"kne-form-creator_lx8An","form-actions-setting-btn":"kne-form-creator_NekU2","panel-toolbar":"kne-form-creator_t0WxZ","panel-toolbar-extra":"kne-form-creator_O22ZM","schema-content":"kne-form-creator_9bWOD","schema-content-fields":"kne-form-creator_EmRDV","schema-content-list-items":"kne-form-creator_Xpl6K","_":"kne-form-creator_jWWXR","schema-content-list-item":"kne-form-creator_dBG5B","schema-content-field":"kne-form-creator_0Lanz","schema-content-field-block":"kne-form-creator_TQd-w","schema-content-field-label":"kne-form-creator_czEK3","schema-content-field-value":"kne-form-creator_YFKTK","schema-content-file-list":"kne-form-creator_UGdXA","schema-content-file":"kne-form-creator_75EtE","schema-content-file-image":"kne-form-creator_P-be6","schema-content-file-name":"kne-form-creator_NXpTS","schema-content-matrix":"kne-form-creator_Wj4Oi","schema-content-matrix-inner":"kne-form-creator_g0-ex","schema-content-matrix-header":"kne-form-creator_6Ew-1","schema-content-matrix-row-title":"kne-form-creator_QQ9-w","schema-content-matrix-option-title":"kne-form-creator_OuEl1","is-choice":"kne-form-creator_xnHgj","schema-content-matrix-row":"kne-form-creator_fFwMK","schema-content-matrix-row-label":"kne-form-creator_W09sG","schema-content-matrix-cell":"kne-form-creator_T3bcF","is-cells":"kne-form-creator_buqr3","is-selected":"kne-form-creator_NadyF","is-mobile":"kne-form-creator_LtgJz","schema-content-matrix-mobile-row":"kne-form-creator_MCWtM","schema-content-matrix-mobile-label":"kne-form-creator_CSjHH","schema-content-matrix-mobile-value":"kne-form-creator_qtvEn","schema-content-matrix-mobile-cell":"kne-form-creator_G-a37","schema-content-matrix-mobile-cell-label":"kne-form-creator_Mjuwi","schema-content-steps":"kne-form-creator_WUBdi","schema-content-step":"kne-form-creator_WJ8b8","schema-content-step-body":"kne-form-creator_JH8KR","schema-content-step-subtitle":"kne-form-creator_jfPgO","add-block-btn":"kne-form-creator_16Zre","add-inline-btn":"kne-form-creator_iCYdB","ant-btn-disabled":"kne-form-creator_LdGtv","block-list":"kne-form-creator_wK5eK","block-section":"kne-form-creator_15IiK","block-kind-formInfo":"kne-form-creator_D0hoK","block-kind-list":"kne-form-creator_JdPhy","block-kind-tableList":"kne-form-creator_gzd64","block-kind-editableList":"kne-form-creator_JzwrQ","block-kind-multiField":"kne-form-creator_t0iOJ","block-kind-matrixScale":"kne-form-creator_CFlQv","matrix-scale-editor-title":"kne-form-creator_Zo1Rz","block-kind-steps":"kne-form-creator_QNF9W","step-section":"kne-form-creator_22ajp","block-section-header":"kne-form-creator_wS4rL","block-header-meta":"kne-form-creator_PQiYV","block-title":"kne-form-creator_wSVJf","block-collapse-btn":"kne-form-creator_Ufp-W","is-expanded":"kne-form-creator_OjfBl","drag-handle":"kne-form-creator_7GuXk","more-btn":"kne-form-creator_paWIZ","drag-handle-action":"kne-form-creator_lhTrX","sortable-ghost":"kne-form-creator_7ZIH8","sortable-drag":"kne-form-creator_dxhFH","action-group":"kne-form-creator_773yo","hover-reveal":"kne-form-creator_S234h","block-summary":"kne-form-creator_GzeW8","block-summary-type":"kne-form-creator_0iyhP","block-header-actions":"kne-form-creator_Ue-nT","block-body":"kne-form-creator_je1H0","item-blocks-section":"kne-form-creator_wq4bT","nested-block-list":"kne-form-creator_4NWH4","block-section-nested":"kne-form-creator_mUKom","add-field-dropdown":"kne-form-creator_9JS0d","add-field-dropdown-item":"kne-form-creator_Ql1z3","add-field-dropdown-item-icon":"kne-form-creator_ZHB5O","add-field-dropdown-item-desc":"kne-form-creator_dcsOS","add-field-dropdown-divider":"kne-form-creator_CUK0H","add-field-dropdown-label":"kne-form-creator_bPJ-2","section-toolbar":"kne-form-creator_LUO8S","section-toolbar-label":"kne-form-creator_7KQ79","field-list":"kne-form-creator_-B7WZ","step-list":"kne-form-creator_kc1pH","step-section-header":"kne-form-creator_wkhEX","step-section-title":"kne-form-creator_NBinE","step-index":"kne-form-creator_CCKZZ","step-section-text":"kne-form-creator_hRFew","step-section-count":"kne-form-creator_G6Quc","step-section-actions":"kne-form-creator_es-FC","field-row":"kne-form-creator_XMkdt","field-row-index":"kne-form-creator_a-cDo","has-handle":"kne-form-creator_vbTgK","field-row-index-num":"kne-form-creator_e4yEp","field-row-main":"kne-form-creator_ftlwp","field-row-label":"kne-form-creator_XAxbE","inline-empty":"kne-form-creator_yP-RF","hover-reveal-active":"kne-form-creator_AE-6r","action-btn":"kne-form-creator_mLgqh","add-block-dropdown":"kne-form-creator_vmS-e","add-block-option":"kne-form-creator_gjg2Y","add-block-option-icon":"kne-form-creator_qh1hh","add-block-option-text":"kne-form-creator_G8iJO","add-block-option-title":"kne-form-creator_ETSvm","add-block-option-desc":"kne-form-creator_O0C3l","field-empty":"kne-form-creator_Nmpfl","field-label-tips-icon":"kne-form-creator_0VVaO","preview-header":"kne-form-creator_c4BT0","preview-title":"kne-form-creator_fPkK4","preview-body":"kne-form-creator_6JntQ","schema-form":"kne-form-creator_MxCWP","schema-body":"kne-form-creator_q9ydz","schema-actions":"kne-form-creator_Y4eEH","schema-actions-inner":"kne-form-creator_FT9Zf","choice-block":"kne-form-creator_RllJe","choice-selector":"kne-form-creator_5A1eM","choice-panels":"kne-form-creator_IO0MY","choice-panels-empty":"kne-form-creator_T0nND","choice-option-panel":"kne-form-creator_FQixN","choice-option-panel-title":"kne-form-creator_ofRo2","choice-option-summary":"kne-form-creator_pksH8","property-modal":"kne-form-creator_wRSZC","editor-intro":"kne-form-creator_uOGOq","field-editor-form":"kne-form-creator_PGPHL","editor-toggles":"kne-form-creator_Dfyhx","options-editor":"kne-form-creator_AK4yO","columns-editor":"kne-form-creator_DQW1N","table-rows-editor":"kne-form-creator_-meJG","is-plain":"kne-form-creator_IiViE","form-actions-editor":"kne-form-creator_fchMy","form-actions-switch-field":"kne-form-creator_6JE9x","form-actions-align-group":"kne-form-creator_51ZsV","form-actions-gap-slider":"kne-form-creator_Gq0bk","editor-section":"kne-form-creator_jJy85","section-divider":"kne-form-creator_zA7L-","rule-editor":"kne-form-creator_bAlGU","super-select-props":"kne-form-creator_Iawhh","field-props-editor":"kne-form-creator_Gabf2","prop-row":"kne-form-creator_7K54P","prop-label":"kne-form-creator_HAAyH","options-item":"kne-form-creator_dnOd2","table-row-card":"kne-form-creator_cwCYp","tree-options-editor":"kne-form-creator_s3nHO","tree-options-list":"kne-form-creator_Djs-E","tree-option-node":"kne-form-creator_XAcut","tree-option-row":"kne-form-creator_4K4Rj","tree-option-fields":"kne-form-creator_-4cjc","tree-option-actions":"kne-form-creator_IjCNI","tree-option-children":"kne-form-creator_pVPGJ","tree-add-sibling":"kne-form-creator_bl46P","rule-checkbox-group":"kne-form-creator_tDgVP","rule-len-row":"kne-form-creator_ATsae","rule-len-input":"kne-form-creator_jY4Ld","rule-len-sep":"kne-form-creator_jBDC8","options-list":"kne-form-creator_GUBNS","options-row":"kne-form-creator_uohD0","options-header":"kne-form-creator_As4L6","options-locale-text":"kne-form-creator_7-99l","options-header-label":"kne-form-creator_UhnVH","options-header-value":"kne-form-creator_2c35V","options-header-description":"kne-form-creator_ibWvX","icon-square-btn-sm":"kne-form-creator_GAh-t","options-header-action":"kne-form-creator_nTN1E","visible-when-editor":"kne-form-creator_ttGnB","visible-when-hint":"kne-form-creator_hPtdv","visible-when-list":"kne-form-creator_aoAt6","visible-when-row":"kne-form-creator_phRgr","visible-when-row-main":"kne-form-creator_l-J7d","visible-when-field":"kne-form-creator_YRh5W","visible-when-operator":"kne-form-creator_DIqFq","visible-when-value":"kne-form-creator_CHcia","visible-when-regex":"kne-form-creator_lKpVo","visible-when-flags":"kne-form-creator_Ps-cu","visible-when-regex-tester":"kne-form-creator_Wf4eG","options-tip":"kne-form-creator_vrTmK","icon-square-btn":"kne-form-creator_DZjCf","locale-text":"kne-form-creator_hMXkE","is-compact":"kne-form-creator_jBFpL","locale-text-item":"kne-form-creator_NqCQD","locale-text-prefix":"kne-form-creator_BQl2X","locale-text-tag":"kne-form-creator_65OWA","add-inline-btn-icon":"kne-form-creator_jbBze","steps-focus":"kne-form-creator_BzrAJ","steps-focus-header":"kne-form-creator_fF02T","steps-focus-meta":"kne-form-creator_4Q3Nt","steps-focus-count":"kne-form-creator_-vGec","steps-focus-count-current":"kne-form-creator_vXk2o","steps-focus-count-total":"kne-form-creator_bpGjx","steps-focus-next":"kne-form-creator_a2ZfJ","steps-focus-title":"kne-form-creator_Q5bvO","steps-focus-track":"kne-form-creator_Cdvj5","steps-focus-segment":"kne-form-creator_4z3t0","is-done":"kne-form-creator_nBNzi","is-current":"kne-form-creator_a8lqo","steps-focus-actions":"kne-form-creator_NgZBR","steps-focus-actions-side":"kne-form-creator_ynPls","is-end":"kne-form-creator_syD91","steps-focus-prev":"kne-form-creator_5NtBV","steps-focus-next-btn":"kne-form-creator_1mMAJ","steps-focus-next-btn-icon":"kne-form-creator_OQvek","steps-focus-done-hint":"kne-form-creator_b0T7j"};
29
29
 
30
30
  const locale$1 = {
31
31
  addField: '添加填写项',
@@ -5328,6 +5328,11 @@ const BlockConfigFields = ({
5328
5328
  value
5329
5329
  }))
5330
5330
  }, "stepsStyle"), borderedCheckbox, /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
5331
+ name: "showIndex",
5332
+ children: formatMessage({
5333
+ id: 'blockShowIndex'
5334
+ })
5335
+ }, "showIndex"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
5331
5336
  name: "autoStep",
5332
5337
  children: formatMessage({
5333
5338
  id: 'blockAutoStep'
@@ -8181,6 +8186,160 @@ const createLocalizedRules = formatMessage => {
8181
8186
  return rules;
8182
8187
  };
8183
8188
 
8189
+ /**
8190
+ * showIndex 连续编号(同一作用域内含子模块字段,不从 1 重起)。
8191
+ *
8192
+ * 作用域根:
8193
+ * - formInfo.showIndex === true
8194
+ * - steps 上 showIndex(或 step.showIndex 覆盖)时,**每一步**各自从 1 起
8195
+ *
8196
+ * 规则:
8197
+ * - 作用域内 DFS:自身 list 字段 → 子 blocks / itemBlocks,连续 1,2,3…
8198
+ * - 嵌套 formInfo / object / choice 继续父级计数,不重起
8199
+ * - choice:各 option 从同一起点编号;计数按「字段数最多的 option」推进,避免切换选项影响后续序号
8200
+ * - list / tableList / editableList:只给「单条模板」编号(每行数字相同),与填写态 List 复用同一套字段节点一致
8201
+ * - matrixScale / multiField / 嵌套 steps:不占题干序号
8202
+ */
8203
+
8204
+ const isIndexableField = field => !!(field && !field.hidden && field.name && field.id);
8205
+ const createIndexCounter = (start = 0) => ({
8206
+ value: start,
8207
+ take() {
8208
+ this.value += 1;
8209
+ return this.value;
8210
+ },
8211
+ peek() {
8212
+ return this.value;
8213
+ }
8214
+ });
8215
+ const assignFields = (fields, counter, map) => {
8216
+ (fields || []).forEach(field => {
8217
+ if (!isIndexableField(field)) {
8218
+ return;
8219
+ }
8220
+ map.set(field.id, counter.take());
8221
+ });
8222
+ };
8223
+ const assignBlock = (block, counter, map) => {
8224
+ if (!block || !block.kind) {
8225
+ return;
8226
+ }
8227
+ switch (block.kind) {
8228
+ case 'formInfo':
8229
+ case 'object':
8230
+ {
8231
+ assignFields(block.list, counter, map);
8232
+ (block.blocks || []).forEach(child => assignBlock(child, counter, map));
8233
+ break;
8234
+ }
8235
+ case 'choice':
8236
+ {
8237
+ const start = counter.peek();
8238
+ let maxEnd = start;
8239
+ (block.options || []).forEach(option => {
8240
+ const optionCounter = createIndexCounter(start);
8241
+ assignFields(option.list, optionCounter, map);
8242
+ (option.blocks || []).forEach(child => assignBlock(child, optionCounter, map));
8243
+ maxEnd = Math.max(maxEnd, optionCounter.peek());
8244
+ });
8245
+ counter.value = maxEnd;
8246
+ break;
8247
+ }
8248
+ case 'list':
8249
+ case 'tableList':
8250
+ case 'editableList':
8251
+ {
8252
+ assignFields(block.list, counter, map);
8253
+ (block.itemBlocks || []).forEach(child => assignBlock(child, counter, map));
8254
+ break;
8255
+ }
8256
+ }
8257
+ };
8258
+
8259
+ /**
8260
+ * 为作用域根(formInfo / object / step 的 { list, blocks })生成 fieldId → 1-based 序号。
8261
+ * @param {object} root
8262
+ * @param {{ enabled?: boolean }} [options]
8263
+ * @returns {Map<string, number>}
8264
+ */
8265
+ const buildFieldIndexMap = (root, {
8266
+ enabled = false
8267
+ } = {}) => {
8268
+ const map = new Map();
8269
+ if (!enabled || !root) {
8270
+ return map;
8271
+ }
8272
+ const counter = createIndexCounter(0);
8273
+ if (root.kind === 'formInfo' || root.kind === 'object') {
8274
+ assignBlock(root, counter, map);
8275
+ return map;
8276
+ }
8277
+ // step 或其它 { list, blocks } 容器
8278
+ assignFields(root.list, counter, map);
8279
+ (root.blocks || []).forEach(child => assignBlock(child, counter, map));
8280
+ return map;
8281
+ };
8282
+
8283
+ /**
8284
+ * 进入子块时的序号上下文:父级已启用则继续同一 map;
8285
+ * 否则仅 formInfo/object 在 showIndex 时新建作用域(steps 按 step 单独建,见 resolveStepIndexContext)。
8286
+ */
8287
+ const resolveIndexContext = (block, parentCtx = {}) => {
8288
+ if (parentCtx.indexMap) {
8289
+ return {
8290
+ indexMap: parentCtx.indexMap,
8291
+ indexEnabled: true
8292
+ };
8293
+ }
8294
+ if (!block || !block.showIndex) {
8295
+ return {
8296
+ indexMap: null,
8297
+ indexEnabled: false
8298
+ };
8299
+ }
8300
+ if (block.kind !== 'formInfo' && block.kind !== 'object') {
8301
+ return {
8302
+ indexMap: null,
8303
+ indexEnabled: false
8304
+ };
8305
+ }
8306
+ return {
8307
+ indexMap: buildFieldIndexMap(block, {
8308
+ enabled: true
8309
+ }),
8310
+ indexEnabled: true
8311
+ };
8312
+ };
8313
+ const resolveStepIndexContext = (step, blockShowIndex) => {
8314
+ const enabled = step && step.showIndex != null ? !!step.showIndex : !!blockShowIndex;
8315
+ if (!enabled) {
8316
+ return {
8317
+ indexMap: null,
8318
+ indexEnabled: false
8319
+ };
8320
+ }
8321
+ const indexMap = buildFieldIndexMap(step, {
8322
+ enabled: true
8323
+ });
8324
+ return {
8325
+ indexMap,
8326
+ indexEnabled: true
8327
+ };
8328
+ };
8329
+ const fieldDisplayIndex = (indexMap, field) => {
8330
+ if (!indexMap || !field || !field.id) {
8331
+ return null;
8332
+ }
8333
+ const value = indexMap.get(field.id);
8334
+ return value == null ? null : value;
8335
+ };
8336
+ const blockHasIndexedFields = (block, indexMap) => {
8337
+ if (!indexMap || !block) {
8338
+ return false;
8339
+ }
8340
+ return (block.list || []).some(field => field && indexMap.has(field.id));
8341
+ };
8342
+
8184
8343
  const buildLabelTips = tips => {
8185
8344
  if (tips == null || !String(tips).trim()) {
8186
8345
  return undefined;
@@ -8200,14 +8359,16 @@ const buildFieldLabel = field => {
8200
8359
  const base = field?.label != null && String(field.label).trim() ? String(field.label).trim() : field?.name || '';
8201
8360
  return base || undefined;
8202
8361
  };
8203
- const buildIndexedLabelRender = index => {
8362
+
8363
+ /** displayIndex 为 1-based 连续序号 */
8364
+ const buildIndexedLabelRender = displayIndex => {
8204
8365
  return ({
8205
8366
  label
8206
8367
  }) => {
8207
8368
  const text = label != null ? String(label).replace(/\u200b/g, '') : '';
8208
8369
  return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement('span', {
8209
8370
  className: style['field-label-index']
8210
- }, `${index + 1}.`), text ? /*#__PURE__*/react.createElement('span', {
8371
+ }, `${displayIndex}.`), text ? /*#__PURE__*/react.createElement('span', {
8211
8372
  className: style['field-label-main']
8212
8373
  }, text) : null);
8213
8374
  };
@@ -8215,8 +8376,8 @@ const buildIndexedLabelRender = index => {
8215
8376
  const renderFieldEntries = (fields = [], preview = false, {
8216
8377
  namePrefix,
8217
8378
  locale,
8218
- showIndex = false
8219
- } = {}) => (fields || []).filter(field => !field.hidden).map((field, index) => {
8379
+ indexMap = null
8380
+ } = {}) => (fields || []).filter(field => !field.hidden).map(field => {
8220
8381
  const Component = getFieldComponent(field.type, field);
8221
8382
  if (!Component) {
8222
8383
  return null;
@@ -8253,12 +8414,13 @@ const renderFieldEntries = (fields = [], preview = false, {
8253
8414
  locale
8254
8415
  } : {};
8255
8416
  const label = buildFieldLabel(field);
8417
+ const displayIndex = fieldDisplayIndex(indexMap, field);
8256
8418
  const element = /*#__PURE__*/react.createElement(Component, {
8257
8419
  key: field.id,
8258
8420
  name: fieldName,
8259
- label: showIndex ? label || '\u200b' : label,
8260
- ...(showIndex ? {
8261
- labelRender: buildIndexedLabelRender(index)
8421
+ label: displayIndex != null ? label || '\u200b' : label,
8422
+ ...(displayIndex != null ? {
8423
+ labelRender: buildIndexedLabelRender(displayIndex)
8262
8424
  } : null),
8263
8425
  rule: field.rule || undefined,
8264
8426
  block: field.block || undefined,
@@ -8332,17 +8494,22 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
8332
8494
  if (!block || depth > MAX_BLOCK_DEPTH) {
8333
8495
  return null;
8334
8496
  }
8497
+ const indexCtx = resolveIndexContext(block, ctx);
8335
8498
  const nextCtx = {
8336
8499
  ...ctx,
8337
8500
  depth: depth + 1,
8338
- asListItem: false
8501
+ asListItem: false,
8502
+ indexMap: indexCtx.indexMap,
8503
+ indexEnabled: indexCtx.indexEnabled
8339
8504
  };
8340
8505
  const fieldRenderOpts = {
8341
- locale
8506
+ locale,
8507
+ indexMap: indexCtx.indexMap
8342
8508
  };
8343
8509
  const bordered = isMobile ? false : block.bordered || undefined;
8344
8510
  // 仅 FormInfo/object 吃列表项 Part 样式;List 等交给 form-info nestDepth
8345
8511
  const listItemPartProps = asListItem && isFormInfoLikeBlock(block.kind) ? nestedListItemPartProps : null;
8512
+ const indexClassName = blockHasIndexedFields(block, indexCtx.indexMap) ? style['form-info-show-index'] : null;
8346
8513
  const renderChildBlocks = (blocks = [], childCtx = nextCtx) => (blocks || []).map(child => renderBlockElement(child, preview, childCtx)).filter(Boolean);
8347
8514
 
8348
8515
  /** list.itemBlocks:object/formInfo 走 asListItem;嵌套 list 等保持 nestDepth 链路 */
@@ -8356,11 +8523,7 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
8356
8523
  switch (block.kind) {
8357
8524
  case 'formInfo':
8358
8525
  {
8359
- const showIndex = !!block.showIndex;
8360
- const entries = renderFieldEntries(block.list, preview, {
8361
- ...fieldRenderOpts,
8362
- showIndex
8363
- });
8526
+ const entries = renderFieldEntries(block.list, preview, fieldRenderOpts);
8364
8527
  const nested = renderChildBlocks(block.blocks || [], nextCtx).map(node => withBlockLayout(node, true));
8365
8528
  return withBlockLayout(createFieldsFormInfo({
8366
8529
  key: block.id,
@@ -8370,7 +8533,7 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
8370
8533
  gap: block.gap,
8371
8534
  bordered,
8372
8535
  ...(listItemPartProps || {}),
8373
- className: resolvePartRootClassName(depth, showIndex ? style['form-info-show-index'] : null)
8536
+ className: resolvePartRootClassName(depth, indexClassName)
8374
8537
  }, entries, nested, knownNames), asListItem);
8375
8538
  }
8376
8539
  case 'object':
@@ -8388,7 +8551,7 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
8388
8551
  gap: block.gap,
8389
8552
  bordered,
8390
8553
  ...(listItemPartProps || {}),
8391
- className: resolvePartRootClassName(depth)
8554
+ className: resolvePartRootClassName(depth, indexClassName)
8392
8555
  }, entries, nested, knownNames), asListItem);
8393
8556
  }
8394
8557
  case 'list':
@@ -8401,7 +8564,7 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
8401
8564
  title: block.title || undefined,
8402
8565
  important: block.important || undefined,
8403
8566
  bordered,
8404
- className: resolvePartRootClassName(depth),
8567
+ className: resolvePartRootClassName(depth, indexClassName),
8405
8568
  maxLength: block.maxLength,
8406
8569
  minLength: block.minLength,
8407
8570
  ...(block.addText ? {
@@ -8428,7 +8591,7 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
8428
8591
  } : {}),
8429
8592
  list: fields,
8430
8593
  ...(listItemPartProps || {}),
8431
- className: resolvePartRootClassName(depth)
8594
+ className: resolvePartRootClassName(depth, indexClassName)
8432
8595
  }), asListItem);
8433
8596
  }
8434
8597
  case 'editableList':
@@ -8440,7 +8603,7 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
8440
8603
  name: block.name,
8441
8604
  title: block.title || undefined,
8442
8605
  bordered,
8443
- className: resolvePartRootClassName(depth),
8606
+ className: resolvePartRootClassName(depth, indexClassName),
8444
8607
  column: block.column,
8445
8608
  maxLength: block.maxLength,
8446
8609
  minLength: block.minLength,
@@ -8505,7 +8668,7 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
8505
8668
  case 'steps':
8506
8669
  {
8507
8670
  const isFocusSteps = block.stepsStyle === 'focus';
8508
- // 与 formInfo 一致:block.showIndex(或 step 上覆盖)时给题干加序号
8671
+ // 每步独立作用域;步内嵌套子模块连续编号
8509
8672
  const blockShowIndex = !!block.showIndex;
8510
8673
  return withBlockLayout(/*#__PURE__*/react.createElement(isFocusSteps ? FocusSteps$1 : FormInfo.Steps, {
8511
8674
  key: block.id,
@@ -8519,15 +8682,20 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
8519
8682
  prevIcon: /*#__PURE__*/react.createElement(icons.ArrowLeftOutlined),
8520
8683
  nextIcon: /*#__PURE__*/react.createElement(icons.ArrowRightOutlined),
8521
8684
  items: (block.items || []).map(step => {
8522
- const showIndex = step.showIndex != null ? !!step.showIndex : blockShowIndex;
8685
+ const stepIndexCtx = resolveStepIndexContext(step, blockShowIndex);
8686
+ const stepCtx = {
8687
+ ...nextCtx,
8688
+ indexMap: stepIndexCtx.indexMap,
8689
+ indexEnabled: stepIndexCtx.indexEnabled
8690
+ };
8523
8691
  const entries = renderFieldEntries(step.list, preview, {
8524
- ...fieldRenderOpts,
8525
- showIndex
8692
+ locale,
8693
+ indexMap: stepIndexCtx.indexMap
8526
8694
  });
8527
- const nested = renderChildBlocks(step.blocks || [], nextCtx);
8695
+ const nested = renderChildBlocks(step.blocks || [], stepCtx);
8528
8696
  const fieldNames = [...(step.list || []).filter(field => field && !field.hidden && field.name).map(field => field.name), ...collectBlockFieldNames(step.blocks || [])];
8529
8697
  const hasConditional = entries.some(entry => entry.visibleWhen);
8530
- const indexClassName = showIndex ? style['form-info-show-index'] : null;
8698
+ const stepIndexClassName = stepIndexCtx.indexEnabled ? style['form-info-show-index'] : null;
8531
8699
  if (nested.length || hasConditional) {
8532
8700
  return {
8533
8701
  key: step.id,
@@ -8541,7 +8709,7 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
8541
8709
  key: `${step.id}-fields`,
8542
8710
  column: step.column,
8543
8711
  gap: block.gap,
8544
- className: indexClassName
8712
+ className: stepIndexClassName
8545
8713
  }, entries, [], knownNames) : null, ...nested)
8546
8714
  };
8547
8715
  }
@@ -8551,7 +8719,7 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
8551
8719
  column: step.column,
8552
8720
  gap: block.gap,
8553
8721
  list: entries.map(entry => entry.element),
8554
- className: indexClassName,
8722
+ className: stepIndexClassName,
8555
8723
  fieldNames
8556
8724
  };
8557
8725
  })
@@ -8568,11 +8736,16 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
8568
8736
  renderOptionContent: option => {
8569
8737
  const nodes = [];
8570
8738
  if ((option.list || []).length) {
8739
+ const optionIndexClassName = (option.list || []).some(field => fieldDisplayIndex(indexCtx.indexMap, field) != null) ? style['form-info-show-index'] : null;
8571
8740
  nodes.push(createFieldsFormInfo({
8572
8741
  key: `${option.id}-fields`,
8573
8742
  column: block.column || 2,
8574
- gap: block.gap
8575
- }, renderFieldEntries(option.list, preview), [], knownNames));
8743
+ gap: block.gap,
8744
+ className: optionIndexClassName
8745
+ }, renderFieldEntries(option.list, preview, {
8746
+ locale,
8747
+ indexMap: indexCtx.indexMap
8748
+ }), [], knownNames));
8576
8749
  }
8577
8750
  nodes.push(...renderChildBlocks(option.blocks || [], nextCtx));
8578
8751
  return nodes.filter(Boolean);
@@ -10306,6 +10479,214 @@ const schemaToDataSchema = (schema, options = {}) => {
10306
10479
  return root;
10307
10480
  };
10308
10481
 
10482
+ const isMatrixChoiceSelected = (cellValue, optionValue) => {
10483
+ if (Array.isArray(cellValue)) {
10484
+ return cellValue.some(item => item === optionValue || item && typeof item === 'object' && (item.value === optionValue || item.id === optionValue));
10485
+ }
10486
+ if (cellValue && typeof cellValue === 'object') {
10487
+ return cellValue.value === optionValue || cellValue.id === optionValue;
10488
+ }
10489
+ return cellValue === optionValue;
10490
+ };
10491
+
10492
+ /** 只读矩阵:对齐填写态 MatrixScale 的表头 + 行列网格,而不是摊成普通字段列表 */
10493
+ const renderMatrixScaleContent = (block, matrixData, formatMessage, isMobile) => {
10494
+ const layout = block.layout === 'columns' || block.layout === 'field' ? block.layout : 'options';
10495
+ const fieldType = block.fieldType || 'RadioGroup';
10496
+ const rows = (block.rows || []).filter(row => row && row.name != null && String(row.name).trim());
10497
+ if (!rows.length) {
10498
+ return null;
10499
+ }
10500
+ const emptyText = formatMessage({
10501
+ id: 'schemaContentEmptyValue'
10502
+ });
10503
+ const rowTitle = block.rowTitle || '';
10504
+ if (layout === 'options') {
10505
+ const options = (block.options || []).filter(option => option && (option.value != null || option.label != null));
10506
+ const optionCount = Math.max(options.length, 1);
10507
+ const formatRowValue = rowValue => formatFieldValue({
10508
+ type: fieldType,
10509
+ props: {
10510
+ options: block.options || []
10511
+ }
10512
+ }, rowValue, formatMessage) || emptyText;
10513
+ if (isMobile || !options.length) {
10514
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
10515
+ className: [style['schema-content-matrix'], style['is-mobile']].join(' '),
10516
+ children: rows.map(row => {
10517
+ const rowName = String(row.name).trim();
10518
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
10519
+ className: style['schema-content-matrix-mobile-row'],
10520
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
10521
+ className: style['schema-content-matrix-mobile-label'],
10522
+ children: row.label || rowName
10523
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
10524
+ className: style['schema-content-matrix-mobile-value'],
10525
+ children: formatRowValue(matrixData?.[rowName])
10526
+ })]
10527
+ }, rowName);
10528
+ })
10529
+ });
10530
+ }
10531
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
10532
+ className: [style['schema-content-matrix'], style['is-choice']].join(' '),
10533
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
10534
+ className: style['schema-content-matrix-inner'],
10535
+ style: {
10536
+ '--matrix-scale-option-count': optionCount
10537
+ },
10538
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
10539
+ className: style['schema-content-matrix-header'],
10540
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
10541
+ className: style['schema-content-matrix-row-title'],
10542
+ children: rowTitle
10543
+ }), options.map(option => /*#__PURE__*/jsxRuntime.jsx("div", {
10544
+ className: style['schema-content-matrix-option-title'],
10545
+ children: option.label ?? String(option.value)
10546
+ }, String(option.value)))]
10547
+ }), rows.map(row => {
10548
+ const rowName = String(row.name).trim();
10549
+ const rowValue = matrixData?.[rowName];
10550
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
10551
+ className: style['schema-content-matrix-row'],
10552
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
10553
+ className: style['schema-content-matrix-row-label'],
10554
+ children: row.label || rowName
10555
+ }), options.map(option => {
10556
+ const selected = isMatrixChoiceSelected(rowValue, option.value);
10557
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
10558
+ className: [style['schema-content-matrix-cell'], selected ? style['is-selected'] : null].filter(Boolean).join(' '),
10559
+ children: selected ? /*#__PURE__*/jsxRuntime.jsx(icons.CheckOutlined, {}) : null
10560
+ }, String(option.value));
10561
+ })]
10562
+ }, rowName);
10563
+ })]
10564
+ })
10565
+ });
10566
+ }
10567
+ if (layout === 'columns') {
10568
+ const columns = (block.columns || []).filter(column => column && column.name != null && String(column.name).trim());
10569
+ const optionCount = Math.max(columns.length, 1);
10570
+ const formatCell = value => formatFieldValue({
10571
+ type: fieldType,
10572
+ props: {}
10573
+ }, value, formatMessage) || emptyText;
10574
+ if (isMobile || !columns.length) {
10575
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
10576
+ className: [style['schema-content-matrix'], style['is-mobile']].join(' '),
10577
+ children: rows.map(row => {
10578
+ const rowName = String(row.name).trim();
10579
+ const rowData = matrixData?.[rowName] || {};
10580
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
10581
+ className: style['schema-content-matrix-mobile-row'],
10582
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
10583
+ className: style['schema-content-matrix-mobile-label'],
10584
+ children: row.label || rowName
10585
+ }), columns.length ? columns.map(column => {
10586
+ const columnName = String(column.name).trim();
10587
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
10588
+ className: style['schema-content-matrix-mobile-cell'],
10589
+ children: [/*#__PURE__*/jsxRuntime.jsxs("span", {
10590
+ className: style['schema-content-matrix-mobile-cell-label'],
10591
+ children: [column.label || columnName, "\uFF1A"]
10592
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
10593
+ children: formatCell(rowData?.[columnName])
10594
+ })]
10595
+ }, columnName);
10596
+ }) : null]
10597
+ }, rowName);
10598
+ })
10599
+ });
10600
+ }
10601
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
10602
+ className: style['schema-content-matrix'],
10603
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
10604
+ className: style['schema-content-matrix-inner'],
10605
+ style: {
10606
+ '--matrix-scale-option-count': optionCount
10607
+ },
10608
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
10609
+ className: style['schema-content-matrix-header'],
10610
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
10611
+ className: style['schema-content-matrix-row-title'],
10612
+ children: rowTitle
10613
+ }), columns.map(column => /*#__PURE__*/jsxRuntime.jsx("div", {
10614
+ className: style['schema-content-matrix-option-title'],
10615
+ children: column.label || String(column.name)
10616
+ }, String(column.name)))]
10617
+ }), rows.map(row => {
10618
+ const rowName = String(row.name).trim();
10619
+ const rowData = matrixData?.[rowName] || {};
10620
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
10621
+ className: [style['schema-content-matrix-row'], style['is-cells']].join(' '),
10622
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
10623
+ className: style['schema-content-matrix-row-label'],
10624
+ children: row.label || rowName
10625
+ }), columns.map(column => {
10626
+ const columnName = String(column.name).trim();
10627
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
10628
+ className: style['schema-content-matrix-cell'],
10629
+ children: formatCell(rowData?.[columnName])
10630
+ }, columnName);
10631
+ })]
10632
+ }, rowName);
10633
+ })]
10634
+ })
10635
+ });
10636
+ }
10637
+
10638
+ // field:每行一个值,仍保留行标题列的矩阵观感
10639
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
10640
+ className: [style['schema-content-matrix'], isMobile ? style['is-mobile'] : null].filter(Boolean).join(' '),
10641
+ children: isMobile ? rows.map(row => {
10642
+ const rowName = String(row.name).trim();
10643
+ const text = formatFieldValue({
10644
+ type: fieldType,
10645
+ props: {}
10646
+ }, matrixData?.[rowName], formatMessage) || emptyText;
10647
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
10648
+ className: style['schema-content-matrix-mobile-row'],
10649
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
10650
+ className: style['schema-content-matrix-mobile-label'],
10651
+ children: row.label || rowName
10652
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
10653
+ className: style['schema-content-matrix-mobile-value'],
10654
+ children: text
10655
+ })]
10656
+ }, rowName);
10657
+ }) : /*#__PURE__*/jsxRuntime.jsxs("div", {
10658
+ className: style['schema-content-matrix-inner'],
10659
+ style: {
10660
+ '--matrix-scale-option-count': 1
10661
+ },
10662
+ children: [rowTitle ? /*#__PURE__*/jsxRuntime.jsxs("div", {
10663
+ className: style['schema-content-matrix-header'],
10664
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
10665
+ className: style['schema-content-matrix-row-title'],
10666
+ children: rowTitle
10667
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
10668
+ className: style['schema-content-matrix-option-title']
10669
+ })]
10670
+ }) : null, rows.map(row => {
10671
+ const rowName = String(row.name).trim();
10672
+ const text = formatFieldValue({
10673
+ type: fieldType,
10674
+ props: {}
10675
+ }, matrixData?.[rowName], formatMessage) || emptyText;
10676
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
10677
+ className: [style['schema-content-matrix-row'], style['is-cells']].join(' '),
10678
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
10679
+ className: style['schema-content-matrix-row-label'],
10680
+ children: row.label || rowName
10681
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
10682
+ className: style['schema-content-matrix-cell'],
10683
+ children: text
10684
+ })]
10685
+ }, rowName);
10686
+ })]
10687
+ })
10688
+ });
10689
+ };
10309
10690
  const getByPath = (data, path) => {
10310
10691
  if (data == null || path == null || path === '') {
10311
10692
  return data;
@@ -10330,12 +10711,13 @@ const formatFieldValue = (field, value, formatMessage) => formatFieldDisplayValu
10330
10711
  * 改为 label 在上、值在下,避免窄栏(如弹窗双栏预览)被撑乱。
10331
10712
  */
10332
10713
  const renderFieldsContent = (fields, data, formatMessage, column, {
10333
- showIndex = false,
10714
+ indexMap = null,
10334
10715
  isFieldVisible
10335
10716
  } = {}) => {
10336
- const list = (fields || []).filter(field => field && !field.hidden && field.name && (!isFieldVisible || isFieldVisible(field))).map((field, index) => {
10717
+ const list = (fields || []).filter(field => field && !field.hidden && field.name && (!isFieldVisible || isFieldVisible(field))).map(field => {
10337
10718
  const baseLabel = field.label || field.name;
10338
- const label = showIndex ? `${index + 1}. ${baseLabel}` : baseLabel;
10719
+ const displayIndex = fieldDisplayIndex(indexMap, field);
10720
+ const label = displayIndex != null ? `${displayIndex}. ${baseLabel}` : baseLabel;
10339
10721
  return {
10340
10722
  label,
10341
10723
  content: formatFieldValue(field, getByPath(data, field.name), formatMessage),
@@ -10364,6 +10746,42 @@ const renderFieldsContent = (fields, data, formatMessage, column, {
10364
10746
  });
10365
10747
  };
10366
10748
  const renderBlockList = (blocks, data, ctx) => (blocks || []).map(block => renderBlock(block, data, ctx)).filter(Boolean);
10749
+
10750
+ /** 列表项标题:优先 itemTitle,其次首个带标题的 itemBlock(与填写态 List 常见结构对齐),避免只显示「第 N 项」 */
10751
+ const resolveListItemTitle = (block, item, index, formatMessage) => {
10752
+ if (typeof block.itemTitle === 'function') {
10753
+ try {
10754
+ const title = block.itemTitle({
10755
+ index,
10756
+ data: item
10757
+ });
10758
+ if (title != null && title !== '') {
10759
+ return {
10760
+ title,
10761
+ titleFromItemBlockId: null
10762
+ };
10763
+ }
10764
+ } catch (e) {
10765
+ // ignore bad itemTitle
10766
+ }
10767
+ }
10768
+ // 只有列表自身没有字段、首个子块即项头时才借用其标题;否则会把「时间窗口」等子块标题误当成项标题
10769
+ const head = (block.list || []).length ? null : (block.itemBlocks || [])[0];
10770
+ if (head && (head.title || head.label)) {
10771
+ return {
10772
+ title: head.title || head.label,
10773
+ titleFromItemBlockId: head.id
10774
+ };
10775
+ }
10776
+ return {
10777
+ title: formatMessage({
10778
+ id: 'schemaContentItemIndex'
10779
+ }, {
10780
+ index: index + 1
10781
+ }),
10782
+ titleFromItemBlockId: null
10783
+ };
10784
+ };
10367
10785
  const renderBlock = (block, data, ctx) => {
10368
10786
  const {
10369
10787
  formatMessage,
@@ -10374,9 +10792,12 @@ const renderBlock = (block, data, ctx) => {
10374
10792
  if (!block || depth > MAX_BLOCK_DEPTH) {
10375
10793
  return null;
10376
10794
  }
10795
+ const indexCtx = resolveIndexContext(block, ctx);
10377
10796
  const nextCtx = {
10378
10797
  ...ctx,
10379
- depth: depth + 1
10798
+ depth: depth + 1,
10799
+ indexMap: indexCtx.indexMap,
10800
+ indexEnabled: indexCtx.indexEnabled
10380
10801
  };
10381
10802
  const bordered = isMobile ? false : block.bordered || undefined;
10382
10803
  const partProps = {
@@ -10386,15 +10807,16 @@ const renderBlock = (block, data, ctx) => {
10386
10807
  bordered,
10387
10808
  className: depth === 0 ? InfoPage__default["default"].partRootClassName : undefined
10388
10809
  };
10810
+ const fieldIndexOpts = {
10811
+ indexMap: indexCtx.indexMap,
10812
+ isFieldVisible
10813
+ };
10389
10814
  switch (block.kind) {
10390
10815
  case 'formInfo':
10391
10816
  {
10392
10817
  return /*#__PURE__*/jsxRuntime.jsxs(InfoPage__default["default"].Part, {
10393
10818
  ...partProps,
10394
- children: [renderFieldsContent(block.list, data, formatMessage, block.column, {
10395
- showIndex: !!block.showIndex,
10396
- isFieldVisible
10397
- }), renderBlockList(block.blocks, data, nextCtx)]
10819
+ children: [renderFieldsContent(block.list, data, formatMessage, block.column, fieldIndexOpts), renderBlockList(block.blocks, data, nextCtx)]
10398
10820
  });
10399
10821
  }
10400
10822
  case 'object':
@@ -10403,9 +10825,7 @@ const renderBlock = (block, data, ctx) => {
10403
10825
  const nestedData = name ? getByPath(data, name) || {} : data;
10404
10826
  return /*#__PURE__*/jsxRuntime.jsxs(InfoPage__default["default"].Part, {
10405
10827
  ...partProps,
10406
- children: [renderFieldsContent(block.list, nestedData, formatMessage, block.column, {
10407
- isFieldVisible
10408
- }), renderBlockList(block.blocks, nestedData, nextCtx)]
10828
+ children: [renderFieldsContent(block.list, nestedData, formatMessage, block.column, fieldIndexOpts), renderBlockList(block.blocks, nestedData, nextCtx)]
10409
10829
  });
10410
10830
  }
10411
10831
  case 'list':
@@ -10417,15 +10837,28 @@ const renderBlock = (block, data, ctx) => {
10417
10837
  const rows = Array.isArray(items) ? items : [];
10418
10838
  return /*#__PURE__*/jsxRuntime.jsx(InfoPage__default["default"].Part, {
10419
10839
  ...partProps,
10420
- children: rows.length ? rows.map((item, index) => /*#__PURE__*/jsxRuntime.jsxs(InfoPage__default["default"].Part, {
10421
- title: formatMessage({
10422
- id: 'schemaContentItemIndex'
10423
- }, {
10424
- index: index + 1
10425
- }),
10426
- bordered: false,
10427
- children: [renderFieldsContent(block.list, item || {}, formatMessage, 2), supportsItemBlocks(block.kind) ? renderBlockList(block.itemBlocks, item || {}, nextCtx) : null]
10428
- }, `${block.id}-${index}`)) : formatMessage({
10840
+ children: rows.length ? /*#__PURE__*/jsxRuntime.jsx("div", {
10841
+ className: style['schema-content-list-items'],
10842
+ children: rows.map((item, index) => {
10843
+ const {
10844
+ title: itemTitle,
10845
+ titleFromItemBlockId
10846
+ } = resolveListItemTitle(block, item || {}, index, formatMessage);
10847
+ // 标题已提到列表项头部,原 itemBlock 只剩字段:去掉边框,避免留下无标题空框
10848
+ const itemBlocks = supportsItemBlocks(block.kind) && titleFromItemBlockId ? (block.itemBlocks || []).map(child => child && child.id === titleFromItemBlockId ? {
10849
+ ...child,
10850
+ title: undefined,
10851
+ label: undefined,
10852
+ bordered: false
10853
+ } : child) : block.itemBlocks;
10854
+ return /*#__PURE__*/jsxRuntime.jsxs(InfoPage__default["default"].Part, {
10855
+ className: style['schema-content-list-item'],
10856
+ title: itemTitle,
10857
+ bordered: false,
10858
+ children: [renderFieldsContent(block.list, item || {}, formatMessage, 2, fieldIndexOpts), supportsItemBlocks(block.kind) ? renderBlockList(itemBlocks, item || {}, nextCtx) : null]
10859
+ }, `${block.id}-${index}`);
10860
+ })
10861
+ }) : formatMessage({
10429
10862
  id: 'schemaContentEmptyValue'
10430
10863
  })
10431
10864
  });
@@ -10460,16 +10893,90 @@ const renderBlock = (block, data, ctx) => {
10460
10893
  })
10461
10894
  });
10462
10895
  }
10896
+ case 'matrixScale':
10897
+ {
10898
+ const name = block.name != null && String(block.name).trim() ? String(block.name).trim() : '';
10899
+ if (!name) {
10900
+ return null;
10901
+ }
10902
+ const matrixData = getByPath(data, name) || {};
10903
+ const content = renderMatrixScaleContent(block, matrixData, formatMessage, isMobile);
10904
+ const title = block.title || block.label || undefined;
10905
+ // 矩阵表头已展示 rowTitle,Part 副标题不再重复挂它
10906
+ const subtitle = block.subtitle || undefined;
10907
+ if (!content && !title && !subtitle) {
10908
+ return null;
10909
+ }
10910
+ return /*#__PURE__*/jsxRuntime.jsx(InfoPage__default["default"].Part, {
10911
+ ...partProps,
10912
+ title: title,
10913
+ subtitle: subtitle,
10914
+ children: content
10915
+ });
10916
+ }
10463
10917
  case 'steps':
10464
10918
  {
10465
- return /*#__PURE__*/jsxRuntime.jsx(react.Fragment, {
10466
- children: (block.items || []).map(step => /*#__PURE__*/jsxRuntime.jsxs(InfoPage__default["default"].Part, {
10467
- title: step.title || undefined,
10468
- bordered: bordered,
10469
- children: [renderFieldsContent(step.list, data, formatMessage, step.column || 2, {
10470
- isFieldVisible
10471
- }), renderBlockList(step.blocks, data, nextCtx)]
10472
- }, step.id))
10919
+ const items = block.items || [];
10920
+ const total = items.length;
10921
+ const isFocus = block.stepsStyle === 'focus';
10922
+ const blockShowIndex = !!block.showIndex;
10923
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
10924
+ className: style['schema-content-steps'],
10925
+ children: items.map((step, index) => {
10926
+ const stepTitle = step.title || formatMessage({
10927
+ id: 'untitledStep'
10928
+ }, {
10929
+ index: index + 1
10930
+ });
10931
+ const stepIndexCtx = resolveStepIndexContext(step, blockShowIndex);
10932
+ const stepCtx = {
10933
+ ...nextCtx,
10934
+ indexMap: stepIndexCtx.indexMap,
10935
+ indexEnabled: stepIndexCtx.indexEnabled
10936
+ };
10937
+ const body = /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
10938
+ children: [renderFieldsContent(step.list, data, formatMessage, step.column || 1, {
10939
+ indexMap: stepIndexCtx.indexMap,
10940
+ isFieldVisible
10941
+ }), renderBlockList(step.blocks, data, stepCtx)]
10942
+ });
10943
+ if (isFocus) {
10944
+ return /*#__PURE__*/jsxRuntime.jsxs("section", {
10945
+ className: style['schema-content-step'],
10946
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
10947
+ className: style['steps-focus-header'],
10948
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
10949
+ className: style['steps-focus-meta'],
10950
+ children: /*#__PURE__*/jsxRuntime.jsxs("span", {
10951
+ className: style['steps-focus-count'],
10952
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
10953
+ className: style['steps-focus-count-current'],
10954
+ children: String(index + 1).padStart(2, '0')
10955
+ }), /*#__PURE__*/jsxRuntime.jsxs("span", {
10956
+ className: style['steps-focus-count-total'],
10957
+ children: ["/ ", String(total).padStart(2, '0')]
10958
+ })]
10959
+ })
10960
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
10961
+ className: style['steps-focus-title'],
10962
+ children: stepTitle
10963
+ }), step.subtitle ? /*#__PURE__*/jsxRuntime.jsx("div", {
10964
+ className: style['schema-content-step-subtitle'],
10965
+ children: step.subtitle
10966
+ }) : null]
10967
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
10968
+ className: style['schema-content-step-body'],
10969
+ children: body
10970
+ })]
10971
+ }, step.id || index);
10972
+ }
10973
+ return /*#__PURE__*/jsxRuntime.jsx(InfoPage__default["default"].Part, {
10974
+ title: stepTitle,
10975
+ subtitle: step.subtitle || undefined,
10976
+ bordered: bordered,
10977
+ children: body
10978
+ }, step.id || index);
10979
+ })
10473
10980
  }, block.id);
10474
10981
  }
10475
10982
  case 'choice':
@@ -10484,9 +10991,7 @@ const renderBlock = (block, data, ctx) => {
10484
10991
  children: visibleOptions.map(option => /*#__PURE__*/jsxRuntime.jsxs(InfoPage__default["default"].Part, {
10485
10992
  title: option.title || undefined,
10486
10993
  bordered: false,
10487
- children: [renderFieldsContent(option.list, data, formatMessage, block.column, {
10488
- isFieldVisible
10489
- }), renderBlockList(option.blocks, data, nextCtx)]
10994
+ children: [renderFieldsContent(option.list, data, formatMessage, block.column, fieldIndexOpts), renderBlockList(option.blocks, data, nextCtx)]
10490
10995
  }, option.id))
10491
10996
  });
10492
10997
  }