@kne/form-creator 0.1.25 → 0.1.27
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/README.md +94 -6
- package/dist/index.css +69 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +938 -30
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +946 -41
- package/dist/index.modern.js.map +1 -1
- package/dist/locale/en-US.js +39 -0
- package/dist/locale/en-US.js.map +1 -1
- package/dist/locale/en-US.modern.js +39 -0
- package/dist/locale/en-US.modern.js.map +1 -1
- package/dist/locale/zh-CN.js +39 -0
- package/dist/locale/zh-CN.js.map +1 -1
- package/dist/locale/zh-CN.modern.js +39 -0
- package/dist/locale/zh-CN.modern.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var SelectList__default = /*#__PURE__*/_interopDefaultLegacy(SelectList);
|
|
|
23
23
|
var FormInfo__default = /*#__PURE__*/_interopDefaultLegacy(FormInfo);
|
|
24
24
|
var InfoPage__default = /*#__PURE__*/_interopDefaultLegacy(InfoPage);
|
|
25
25
|
|
|
26
|
-
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-steps":"kne-form-creator_QNF9W","step-section":"kne-form-creator_22ajp","block-section-header":"kne-form-creator_wS4rL","block-header-left":"kne-form-creator_t4awC","block-title":"kne-form-creator_wSVJf","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-section-actions":"kne-form-creator_es-FC","step-index":"kne-form-creator_CCKZZ","field-row":"kne-form-creator_XMkdt","field-row-index":"kne-form-creator_a-cDo","field-row-main":"kne-form-creator_ftlwp","field-row-label":"kne-form-creator_XAxbE","inline-empty":"kne-form-creator_yP-RF","action-group":"kne-form-creator_773yo","hover-reveal":"kne-form-creator_S234h","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","field-editor-form":"kne-form-creator_PGPHL","form-actions-editor":"kne-form-creator_fchMy","form-actions-switch-field":"kne-form-creator_6JE9x","form-actions-layout-panel":"kne-form-creator_rtm9D","form-actions-align-group":"kne-form-creator_51ZsV","form-actions-layout-title":"kne-form-creator_hFeiC","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","options-editor":"kne-form-creator_AK4yO","super-select-props":"kne-form-creator_Iawhh","field-props-editor":"kne-form-creator_Gabf2","columns-editor":"kne-form-creator_DQW1N","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","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","
|
|
26
|
+
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-left":"kne-form-creator_t4awC","block-title":"kne-form-creator_wSVJf","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-section-actions":"kne-form-creator_es-FC","step-index":"kne-form-creator_CCKZZ","field-row":"kne-form-creator_XMkdt","field-row-index":"kne-form-creator_a-cDo","field-row-main":"kne-form-creator_ftlwp","field-row-label":"kne-form-creator_XAxbE","inline-empty":"kne-form-creator_yP-RF","action-group":"kne-form-creator_773yo","hover-reveal":"kne-form-creator_S234h","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","field-editor-form":"kne-form-creator_PGPHL","form-actions-editor":"kne-form-creator_fchMy","form-actions-switch-field":"kne-form-creator_6JE9x","form-actions-layout-panel":"kne-form-creator_rtm9D","form-actions-align-group":"kne-form-creator_51ZsV","form-actions-layout-title":"kne-form-creator_hFeiC","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","options-editor":"kne-form-creator_AK4yO","super-select-props":"kne-form-creator_Iawhh","field-props-editor":"kne-form-creator_Gabf2","columns-editor":"kne-form-creator_DQW1N","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"};
|
|
27
27
|
|
|
28
28
|
const locale$1 = {
|
|
29
29
|
addField: '添加填写项',
|
|
@@ -52,6 +52,7 @@ const locale$1 = {
|
|
|
52
52
|
blockKind_tableList: '表格列表',
|
|
53
53
|
blockKind_editableList: '行内编辑列表',
|
|
54
54
|
blockKind_multiField: '同类多值',
|
|
55
|
+
blockKind_matrixScale: '矩阵量表',
|
|
55
56
|
blockKind_object: '分组信息',
|
|
56
57
|
blockKind_choice: '选项切换',
|
|
57
58
|
blockKind_steps: '分步表单',
|
|
@@ -60,6 +61,7 @@ const locale$1 = {
|
|
|
60
61
|
blockKindDesc_tableList: '以表格形式展示的可增减列表',
|
|
61
62
|
blockKindDesc_editableList: '每条记录只读展示,点击编辑后单独填写并保存;数据量大时不卡顿',
|
|
62
63
|
blockKindDesc_multiField: '同一种填写项可以输入多个值,例如多个手机号',
|
|
64
|
+
blockKindDesc_matrixScale: '行为题目、列为选项或字段格子,每行共用同一填写项类型',
|
|
63
65
|
blockKindDesc_object: '把相关的填写项放在一起,例如「在校时间」下的开始与结束',
|
|
64
66
|
blockKindDesc_choice: '先选一类情况,再填写对应内容;可设为单选或多选',
|
|
65
67
|
blockKindDesc_steps: '将表单拆分成多个步骤,引导用户逐步填写',
|
|
@@ -112,6 +114,27 @@ const locale$1 = {
|
|
|
112
114
|
multiFieldType: '填写项类型',
|
|
113
115
|
multiFieldSummary: '填写类型:{type}',
|
|
114
116
|
multiFieldEditorHint: '同类多值模块会根据你选择的填写项类型,自动生成可增减的多个输入框。',
|
|
117
|
+
matrixScaleRowTitle: '行标题列名',
|
|
118
|
+
matrixScaleRowTitlePlaceholder: '例如:活动',
|
|
119
|
+
matrixScaleLayout: '矩阵布局',
|
|
120
|
+
matrixScaleLayout_options: '选项矩阵',
|
|
121
|
+
matrixScaleLayout_columns: '单元格矩阵',
|
|
122
|
+
matrixScaleLayout_field: '每行一个字段',
|
|
123
|
+
matrixScaleRequired: '每行(每格)必填',
|
|
124
|
+
matrixScaleSummary: '{type} · {layout} · {rows} 行',
|
|
125
|
+
matrixScaleEditorHint_options: '配置行题目与量表选项;预览中每行是同一个选择字段。',
|
|
126
|
+
matrixScaleEditorHint_columns: '配置行题目与列字段;每个格子是同一个填写项类型(如数字、评分)。',
|
|
127
|
+
matrixScaleEditorHint_field: '只配置行题目;每行右侧放一个填写项(不传列)。',
|
|
128
|
+
matrixScaleRowsTitle: '行配置',
|
|
129
|
+
matrixScaleRowsHint: '左侧为行标题,右侧为保存用的名称',
|
|
130
|
+
matrixScaleRowLabelPlaceholder: '例如:工作/学习',
|
|
131
|
+
matrixScaleRowNamePlaceholder: '例如:work',
|
|
132
|
+
matrixScaleOptionsTitle: '量表选项(列)',
|
|
133
|
+
matrixScaleColumnsTitle: '列配置',
|
|
134
|
+
matrixScaleColumnsHint: '左侧为列标题,右侧为保存用的名称',
|
|
135
|
+
matrixScaleColumnLabelPlaceholder: '例如:周一',
|
|
136
|
+
matrixScaleColumnNamePlaceholder: '例如:mon',
|
|
137
|
+
matrixScaleAddRow: '添加一行',
|
|
115
138
|
stepListTitle: '步骤列表',
|
|
116
139
|
addStep: '添加步骤',
|
|
117
140
|
editStep: '编辑步骤',
|
|
@@ -135,6 +158,19 @@ const locale$1 = {
|
|
|
135
158
|
FieldTypeSelect: '下拉选择',
|
|
136
159
|
FieldTypeRadioGroup: '单选组',
|
|
137
160
|
FieldTypeCheckboxGroup: '复选组',
|
|
161
|
+
FieldTypeRadioGroupOther: '单选组(含其他)',
|
|
162
|
+
FieldTypeCheckboxGroupOther: '复选组(含其他)',
|
|
163
|
+
FieldTypeOtherOption: '其他',
|
|
164
|
+
propChoiceModern: '新版样式(序号色块)',
|
|
165
|
+
propChoiceBlock: '块级选项(纵向占满)',
|
|
166
|
+
propChoiceIndexType: '序号类型',
|
|
167
|
+
propChoiceIndexTypeLetter: '字母 A/B/C',
|
|
168
|
+
propChoiceIndexTypeNumber: '数字 1/2/3',
|
|
169
|
+
propChoiceIndexTypeCheck: '对勾(无序号)',
|
|
170
|
+
propChoiceOtherLabel: '「其他」选项文案',
|
|
171
|
+
propChoiceOtherLabelHint: '默认:其他',
|
|
172
|
+
propChoiceOtherPlaceholder: '「其他」输入框提示',
|
|
173
|
+
propChoiceOtherPlaceholderHint: '选中「其他」后补充说明',
|
|
138
174
|
FieldTypeSuperSelectList: '普通下拉',
|
|
139
175
|
FieldTypeSuperSelectTableList: '表格选择',
|
|
140
176
|
FieldTypeSuperSelectTree: '树形选择',
|
|
@@ -189,6 +225,9 @@ const locale$1 = {
|
|
|
189
225
|
formActionsGapHint: '默认 16',
|
|
190
226
|
formActionsLayoutSection: '布局',
|
|
191
227
|
fieldBasicSection: '基本设置',
|
|
228
|
+
optionLabelColumn: '选项名称',
|
|
229
|
+
optionValueColumn: '选项值',
|
|
230
|
+
optionDescColumn: '选项描述',
|
|
192
231
|
optionLabelPlaceholder: '显示文字',
|
|
193
232
|
optionValuePlaceholder: '对应值',
|
|
194
233
|
optionDescPlaceholder: '补充说明(可选)',
|
|
@@ -346,6 +385,7 @@ const locale = {
|
|
|
346
385
|
blockKind_tableList: 'Table List',
|
|
347
386
|
blockKind_editableList: 'Inline Edit List',
|
|
348
387
|
blockKind_multiField: 'Multi-Value',
|
|
388
|
+
blockKind_matrixScale: 'Matrix Scale',
|
|
349
389
|
blockKind_object: 'Grouped Fields',
|
|
350
390
|
blockKind_choice: 'Options',
|
|
351
391
|
blockKind_steps: 'Step-by-Step',
|
|
@@ -354,6 +394,7 @@ const locale = {
|
|
|
354
394
|
blockKindDesc_tableList: 'A repeatable list displayed as a table',
|
|
355
395
|
blockKindDesc_editableList: 'Records are shown read-only; click edit to fill in and save each one. Stays fast with lots of data',
|
|
356
396
|
blockKindDesc_multiField: 'Enter multiple values for the same field, e.g. several phone numbers',
|
|
397
|
+
blockKindDesc_matrixScale: 'Rows are questions; columns are options or cell fields; every row shares one field type',
|
|
357
398
|
blockKindDesc_object: 'Group related fields together, e.g. start and end under "School period"',
|
|
358
399
|
blockKindDesc_choice: 'Pick a case first, then fill in the matching content; single or multiple selection',
|
|
359
400
|
blockKindDesc_steps: 'Split the form into steps to guide users through it',
|
|
@@ -406,6 +447,27 @@ const locale = {
|
|
|
406
447
|
multiFieldType: 'Field Type',
|
|
407
448
|
multiFieldSummary: 'Field type: {type}',
|
|
408
449
|
multiFieldEditorHint: 'This section auto-generates repeatable inputs based on the field type you choose.',
|
|
450
|
+
matrixScaleRowTitle: 'Row header title',
|
|
451
|
+
matrixScaleRowTitlePlaceholder: 'e.g. Activity',
|
|
452
|
+
matrixScaleLayout: 'Matrix layout',
|
|
453
|
+
matrixScaleLayout_options: 'Option matrix',
|
|
454
|
+
matrixScaleLayout_columns: 'Cell matrix',
|
|
455
|
+
matrixScaleLayout_field: 'One field per row',
|
|
456
|
+
matrixScaleRequired: 'Required for each row/cell',
|
|
457
|
+
matrixScaleSummary: '{type} · {layout} · {rows} rows',
|
|
458
|
+
matrixScaleEditorHint_options: 'Configure row labels and scale options; each row uses the same choice field.',
|
|
459
|
+
matrixScaleEditorHint_columns: 'Configure rows and columns; each cell uses the same field type (e.g. number, rate).',
|
|
460
|
+
matrixScaleEditorHint_field: 'Configure row labels only; each row shows one field without columns.',
|
|
461
|
+
matrixScaleRowsTitle: 'Rows',
|
|
462
|
+
matrixScaleRowsHint: 'Left is the row label; right is the data key',
|
|
463
|
+
matrixScaleRowLabelPlaceholder: 'e.g. Work / Study',
|
|
464
|
+
matrixScaleRowNamePlaceholder: 'e.g. work',
|
|
465
|
+
matrixScaleOptionsTitle: 'Scale options (columns)',
|
|
466
|
+
matrixScaleColumnsTitle: 'Columns',
|
|
467
|
+
matrixScaleColumnsHint: 'Left is the column label; right is the data key',
|
|
468
|
+
matrixScaleColumnLabelPlaceholder: 'e.g. Monday',
|
|
469
|
+
matrixScaleColumnNamePlaceholder: 'e.g. mon',
|
|
470
|
+
matrixScaleAddRow: 'Add row',
|
|
409
471
|
stepListTitle: 'Steps',
|
|
410
472
|
addStep: 'Add Step',
|
|
411
473
|
editStep: 'Edit Step',
|
|
@@ -429,6 +491,19 @@ const locale = {
|
|
|
429
491
|
FieldTypeSelect: 'Dropdown',
|
|
430
492
|
FieldTypeRadioGroup: 'Radio Group',
|
|
431
493
|
FieldTypeCheckboxGroup: 'Checkbox Group',
|
|
494
|
+
FieldTypeRadioGroupOther: 'Radio Group (with Other)',
|
|
495
|
+
FieldTypeCheckboxGroupOther: 'Checkbox Group (with Other)',
|
|
496
|
+
FieldTypeOtherOption: 'Other',
|
|
497
|
+
propChoiceModern: 'Modern style (indexed chips)',
|
|
498
|
+
propChoiceBlock: 'Block options (full-width stack)',
|
|
499
|
+
propChoiceIndexType: 'Index type',
|
|
500
|
+
propChoiceIndexTypeLetter: 'Letters A/B/C',
|
|
501
|
+
propChoiceIndexTypeNumber: 'Numbers 1/2/3',
|
|
502
|
+
propChoiceIndexTypeCheck: 'Checkmark (no index)',
|
|
503
|
+
propChoiceOtherLabel: '"Other" option label',
|
|
504
|
+
propChoiceOtherLabelHint: 'Default: Other',
|
|
505
|
+
propChoiceOtherPlaceholder: '"Other" textarea placeholder',
|
|
506
|
+
propChoiceOtherPlaceholderHint: 'Extra note when Other is selected',
|
|
432
507
|
FieldTypeSuperSelectList: 'Select List',
|
|
433
508
|
FieldTypeSuperSelectTableList: 'Table Select',
|
|
434
509
|
FieldTypeSuperSelectTree: 'Tree Select',
|
|
@@ -483,6 +558,9 @@ const locale = {
|
|
|
483
558
|
formActionsGapHint: 'Default: 16',
|
|
484
559
|
formActionsLayoutSection: 'Layout',
|
|
485
560
|
fieldBasicSection: 'Basic Settings',
|
|
561
|
+
optionLabelColumn: 'Option Label',
|
|
562
|
+
optionValueColumn: 'Option Value',
|
|
563
|
+
optionDescColumn: 'Option Description',
|
|
486
564
|
optionLabelPlaceholder: 'Display text',
|
|
487
565
|
optionValuePlaceholder: 'Value',
|
|
488
566
|
optionDescPlaceholder: 'Description (optional)',
|
|
@@ -826,7 +904,7 @@ const createChoiceOption = (overrides = {}) => ({
|
|
|
826
904
|
...overrides
|
|
827
905
|
});
|
|
828
906
|
const createBlock = (kind, overrides = {}) => {
|
|
829
|
-
const needsName = ['list', 'tableList', 'editableList', 'multiField', 'object'].includes(kind);
|
|
907
|
+
const needsName = ['list', 'tableList', 'editableList', 'multiField', 'matrixScale', 'object'].includes(kind);
|
|
830
908
|
const base = {
|
|
831
909
|
id: createFieldId(),
|
|
832
910
|
kind,
|
|
@@ -842,7 +920,12 @@ const createBlock = (kind, overrides = {}) => {
|
|
|
842
920
|
addText: '',
|
|
843
921
|
maxLength: undefined,
|
|
844
922
|
minLength: undefined,
|
|
845
|
-
fieldType: 'Input',
|
|
923
|
+
fieldType: kind === 'matrixScale' ? 'RadioGroup' : 'Input',
|
|
924
|
+
layout: 'options',
|
|
925
|
+
rowTitle: '',
|
|
926
|
+
rule: '',
|
|
927
|
+
rows: [],
|
|
928
|
+
columns: [],
|
|
846
929
|
autoStep: true,
|
|
847
930
|
mode: 'single',
|
|
848
931
|
selectorName: '',
|
|
@@ -873,6 +956,32 @@ const createBlock = (kind, overrides = {}) => {
|
|
|
873
956
|
blocks: undefined,
|
|
874
957
|
options: undefined,
|
|
875
958
|
items: undefined,
|
|
959
|
+
rows: undefined,
|
|
960
|
+
columns: undefined,
|
|
961
|
+
layout: undefined,
|
|
962
|
+
rowTitle: undefined,
|
|
963
|
+
rule: undefined,
|
|
964
|
+
...overrides
|
|
965
|
+
};
|
|
966
|
+
}
|
|
967
|
+
if (kind === 'matrixScale') {
|
|
968
|
+
return {
|
|
969
|
+
...base,
|
|
970
|
+
list: undefined,
|
|
971
|
+
itemBlocks: undefined,
|
|
972
|
+
blocks: undefined,
|
|
973
|
+
items: undefined,
|
|
974
|
+
fieldType: 'RadioGroup',
|
|
975
|
+
layout: 'options',
|
|
976
|
+
rows: [{
|
|
977
|
+
label: '',
|
|
978
|
+
name: createDataKey('row')
|
|
979
|
+
}],
|
|
980
|
+
options: [{
|
|
981
|
+
label: '',
|
|
982
|
+
value: ''
|
|
983
|
+
}],
|
|
984
|
+
columns: undefined,
|
|
876
985
|
...overrides
|
|
877
986
|
};
|
|
878
987
|
}
|
|
@@ -1007,6 +1116,52 @@ const normalizeBlock = (block, depth = 0) => {
|
|
|
1007
1116
|
normalized.itemBlocks = undefined;
|
|
1008
1117
|
normalized.blocks = undefined;
|
|
1009
1118
|
normalized.options = undefined;
|
|
1119
|
+
normalized.rows = undefined;
|
|
1120
|
+
normalized.columns = undefined;
|
|
1121
|
+
normalized.layout = undefined;
|
|
1122
|
+
normalized.rowTitle = undefined;
|
|
1123
|
+
normalized.rule = undefined;
|
|
1124
|
+
return normalized;
|
|
1125
|
+
}
|
|
1126
|
+
if (kind === 'matrixScale') {
|
|
1127
|
+
const layout = block.layout === 'columns' || block.layout === 'field' ? block.layout : 'options';
|
|
1128
|
+
normalized.list = undefined;
|
|
1129
|
+
normalized.items = undefined;
|
|
1130
|
+
normalized.itemBlocks = undefined;
|
|
1131
|
+
normalized.blocks = undefined;
|
|
1132
|
+
normalized.layout = layout;
|
|
1133
|
+
normalized.fieldType = block.fieldType || 'RadioGroup';
|
|
1134
|
+
normalized.rowTitle = block.rowTitle != null ? block.rowTitle : '';
|
|
1135
|
+
normalized.rule = block.rule != null ? block.rule : '';
|
|
1136
|
+
normalized.rows = Array.isArray(block.rows) ? block.rows.map(row => ({
|
|
1137
|
+
label: row?.label ?? '',
|
|
1138
|
+
name: String(row?.name || '').trim() || createDataKey('row')
|
|
1139
|
+
})).filter(row => String(row.label || '').trim() || String(row.name || '').trim()) : [];
|
|
1140
|
+
if (!normalized.rows.length) {
|
|
1141
|
+
normalized.rows = [{
|
|
1142
|
+
label: '',
|
|
1143
|
+
name: createDataKey('row')
|
|
1144
|
+
}];
|
|
1145
|
+
}
|
|
1146
|
+
if (layout === 'options') {
|
|
1147
|
+
normalized.options = Array.isArray(block.options) ? block.options : [];
|
|
1148
|
+
normalized.columns = undefined;
|
|
1149
|
+
} else if (layout === 'columns') {
|
|
1150
|
+
normalized.columns = Array.isArray(block.columns) ? block.columns.map(column => ({
|
|
1151
|
+
label: column?.label ?? column?.title ?? '',
|
|
1152
|
+
name: String(column?.name || '').trim() || createDataKey('col')
|
|
1153
|
+
})).filter(column => String(column.label || '').trim() || String(column.name || '').trim()) : [];
|
|
1154
|
+
if (!normalized.columns.length) {
|
|
1155
|
+
normalized.columns = [{
|
|
1156
|
+
label: '',
|
|
1157
|
+
name: createDataKey('col')
|
|
1158
|
+
}];
|
|
1159
|
+
}
|
|
1160
|
+
normalized.options = undefined;
|
|
1161
|
+
} else {
|
|
1162
|
+
normalized.options = undefined;
|
|
1163
|
+
normalized.columns = undefined;
|
|
1164
|
+
}
|
|
1010
1165
|
return normalized;
|
|
1011
1166
|
}
|
|
1012
1167
|
if (kind === 'choice') {
|
|
@@ -1146,7 +1301,7 @@ const collectFieldsFromBlocks = (blocks = [], acc = []) => {
|
|
|
1146
1301
|
});
|
|
1147
1302
|
return;
|
|
1148
1303
|
}
|
|
1149
|
-
if (block.kind !== 'multiField' && Array.isArray(block.list)) {
|
|
1304
|
+
if (block.kind !== 'multiField' && block.kind !== 'matrixScale' && Array.isArray(block.list)) {
|
|
1150
1305
|
acc.push(...block.list);
|
|
1151
1306
|
}
|
|
1152
1307
|
if (Array.isArray(block.itemBlocks)) {
|
|
@@ -1191,7 +1346,7 @@ const collectSchemaFields = (schema, {
|
|
|
1191
1346
|
});
|
|
1192
1347
|
return fields;
|
|
1193
1348
|
}
|
|
1194
|
-
if (block.kind !== 'multiField') {
|
|
1349
|
+
if (block.kind !== 'multiField' && block.kind !== 'matrixScale') {
|
|
1195
1350
|
fields.push(...(block.list || []));
|
|
1196
1351
|
}
|
|
1197
1352
|
return fields;
|
|
@@ -1239,7 +1394,7 @@ const collectBlockFieldNames = (blocks = [], {
|
|
|
1239
1394
|
});
|
|
1240
1395
|
return;
|
|
1241
1396
|
}
|
|
1242
|
-
if (block.kind !== 'multiField') {
|
|
1397
|
+
if (block.kind !== 'multiField' && block.kind !== 'matrixScale') {
|
|
1243
1398
|
(block.list || []).forEach(field => {
|
|
1244
1399
|
if (field?.name) {
|
|
1245
1400
|
names.push(prefix ? `${prefix}.${field.name}` : field.name);
|
|
@@ -1449,7 +1604,7 @@ const blockHasContent = block => {
|
|
|
1449
1604
|
if (block.kind === 'steps') {
|
|
1450
1605
|
return (block.items || []).some(step => (step.list || []).length > 0 || (step.blocks || []).some(blockHasContent) || step.title);
|
|
1451
1606
|
}
|
|
1452
|
-
if (block.kind === 'multiField') {
|
|
1607
|
+
if (block.kind === 'multiField' || block.kind === 'matrixScale') {
|
|
1453
1608
|
return !!block.name;
|
|
1454
1609
|
}
|
|
1455
1610
|
if (block.kind === 'choice') {
|
|
@@ -1502,6 +1657,12 @@ const BLOCK_KINDS = {
|
|
|
1502
1657
|
requiresName: true,
|
|
1503
1658
|
descriptionId: 'blockKindDesc_multiField'
|
|
1504
1659
|
},
|
|
1660
|
+
matrixScale: {
|
|
1661
|
+
labelId: 'blockKind_matrixScale',
|
|
1662
|
+
color: 'volcano',
|
|
1663
|
+
requiresName: true,
|
|
1664
|
+
descriptionId: 'blockKindDesc_matrixScale'
|
|
1665
|
+
},
|
|
1505
1666
|
object: {
|
|
1506
1667
|
labelId: 'blockKind_object',
|
|
1507
1668
|
color: 'orange',
|
|
@@ -1525,6 +1686,9 @@ const BLOCK_KINDS = {
|
|
|
1525
1686
|
|
|
1526
1687
|
/** editableList 添加按钮位置,与 @kne/form-info EditableList addPosition 一致 */
|
|
1527
1688
|
const ADD_POSITIONS = ['bottom', 'top', 'both'];
|
|
1689
|
+
|
|
1690
|
+
/** matrixScale 布局:options 选项组矩阵 / columns 单元格矩阵 / field 每行一个字段 */
|
|
1691
|
+
const MATRIX_LAYOUTS = ['options', 'columns', 'field'];
|
|
1528
1692
|
const getBlockKindOptions = formatMessage => Object.entries(BLOCK_KINDS).map(([value, config]) => ({
|
|
1529
1693
|
label: typeof formatMessage === 'function' ? formatMessage({
|
|
1530
1694
|
id: config.labelId
|
|
@@ -1547,7 +1711,10 @@ const blockToFormValues = block => ({
|
|
|
1547
1711
|
maxLength: block.maxLength ?? null,
|
|
1548
1712
|
minLength: block.minLength ?? null,
|
|
1549
1713
|
addPosition: ADD_POSITIONS.includes(block.addPosition) ? block.addPosition : 'bottom',
|
|
1550
|
-
fieldType: block.fieldType || 'Input',
|
|
1714
|
+
fieldType: block.fieldType || (block.kind === 'matrixScale' ? 'RadioGroup' : 'Input'),
|
|
1715
|
+
layout: MATRIX_LAYOUTS.includes(block.layout) ? block.layout : 'options',
|
|
1716
|
+
rowTitle: block.rowTitle || '',
|
|
1717
|
+
required: typeof block.rule === 'string' && block.rule.split(' ').includes('REQ'),
|
|
1551
1718
|
autoStep: block.autoStep !== false,
|
|
1552
1719
|
mode: block.mode === 'multiple' ? 'multiple' : 'single',
|
|
1553
1720
|
selectorName: block.selectorName || '',
|
|
@@ -1572,12 +1739,44 @@ const formValuesToBlock = (values, existingBlock = {}) => {
|
|
|
1572
1739
|
maxLength: values.maxLength ?? undefined,
|
|
1573
1740
|
minLength: values.minLength ?? undefined,
|
|
1574
1741
|
addPosition: kind === 'editableList' && ADD_POSITIONS.includes(values.addPosition) && values.addPosition !== 'bottom' ? values.addPosition : undefined,
|
|
1575
|
-
fieldType: values.fieldType || 'Input',
|
|
1742
|
+
fieldType: values.fieldType || (kind === 'matrixScale' ? 'RadioGroup' : 'Input'),
|
|
1576
1743
|
autoStep: values.autoStep !== false,
|
|
1577
1744
|
mode,
|
|
1578
1745
|
selectorName: values.selectorName || '',
|
|
1579
1746
|
selectorInData: values.selectorInData !== false
|
|
1580
1747
|
};
|
|
1748
|
+
if (kind === 'matrixScale') {
|
|
1749
|
+
const layout = MATRIX_LAYOUTS.includes(values.layout) ? values.layout : 'options';
|
|
1750
|
+
next.layout = layout;
|
|
1751
|
+
next.rowTitle = values.rowTitle || undefined;
|
|
1752
|
+
next.rule = values.required ? 'REQ' : undefined;
|
|
1753
|
+
if (layout === 'options') {
|
|
1754
|
+
next.columns = undefined;
|
|
1755
|
+
if (!Array.isArray(next.options) || !next.options.length) {
|
|
1756
|
+
next.options = [{
|
|
1757
|
+
label: '',
|
|
1758
|
+
value: ''
|
|
1759
|
+
}];
|
|
1760
|
+
}
|
|
1761
|
+
} else if (layout === 'columns') {
|
|
1762
|
+
next.options = undefined;
|
|
1763
|
+
if (!Array.isArray(next.columns) || !next.columns.length) {
|
|
1764
|
+
next.columns = [{
|
|
1765
|
+
label: '',
|
|
1766
|
+
name: createDataKey('col')
|
|
1767
|
+
}];
|
|
1768
|
+
}
|
|
1769
|
+
} else {
|
|
1770
|
+
next.options = undefined;
|
|
1771
|
+
next.columns = undefined;
|
|
1772
|
+
}
|
|
1773
|
+
if (!Array.isArray(next.rows) || !next.rows.length) {
|
|
1774
|
+
next.rows = [{
|
|
1775
|
+
label: '',
|
|
1776
|
+
name: createDataKey('row')
|
|
1777
|
+
}];
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1581
1780
|
if (kind === 'choice' && mode !== 'multiple') {
|
|
1582
1781
|
next.minLength = undefined;
|
|
1583
1782
|
next.maxLength = undefined;
|
|
@@ -1847,14 +2046,25 @@ const NO_VALUE_OPERATORS = ['empty', 'notEmpty'];
|
|
|
1847
2046
|
const ALLOWED_REGEX_FLAGS = ['i', 'm', 's', 'u'];
|
|
1848
2047
|
|
|
1849
2048
|
// 列表类模块内的字段会重复出现,单个 name 定位不到具体条目,不参与条件
|
|
1850
|
-
const LIST_BLOCK_KINDS = ['list', 'tableList', 'editableList', 'multiField'];
|
|
2049
|
+
const LIST_BLOCK_KINDS = ['list', 'tableList', 'editableList', 'multiField', 'matrixScale'];
|
|
1851
2050
|
const getByPath$2 = (data, path) => {
|
|
1852
2051
|
if (data == null || path == null || path === '') {
|
|
1853
2052
|
return undefined;
|
|
1854
2053
|
}
|
|
1855
2054
|
return String(path).split('.').reduce((current, key) => current == null ? undefined : current[key], data);
|
|
1856
2055
|
};
|
|
1857
|
-
|
|
2056
|
+
|
|
2057
|
+
/** RadioGroupOther / CheckboxGroupOther 提交值为 { value, other? },比较前先取 value */
|
|
2058
|
+
const unwrapChoiceOtherValue = value => {
|
|
2059
|
+
if (value && typeof value === 'object' && !Array.isArray(value) && Object.prototype.hasOwnProperty.call(value, 'other') && Object.prototype.hasOwnProperty.call(value, 'value')) {
|
|
2060
|
+
return value.value;
|
|
2061
|
+
}
|
|
2062
|
+
return value;
|
|
2063
|
+
};
|
|
2064
|
+
const isEmptyValue$1 = value => {
|
|
2065
|
+
const next = unwrapChoiceOtherValue(value);
|
|
2066
|
+
return next === undefined || next === null || next === '' || Array.isArray(next) && next.length === 0;
|
|
2067
|
+
};
|
|
1858
2068
|
|
|
1859
2069
|
// SuperSelect 等字段的值是 { label, value } 对象,比较时统一取 value
|
|
1860
2070
|
const toComparable = item => {
|
|
@@ -1901,7 +2111,7 @@ const evaluateCondition = (condition, formData) => {
|
|
|
1901
2111
|
if (!condition?.field || !CONDITION_OPERATORS.includes(condition.operator)) {
|
|
1902
2112
|
return null;
|
|
1903
2113
|
}
|
|
1904
|
-
const actual = getByPath$2(formData, condition.field);
|
|
2114
|
+
const actual = unwrapChoiceOtherValue(getByPath$2(formData, condition.field));
|
|
1905
2115
|
const expected = condition.value;
|
|
1906
2116
|
switch (condition.operator) {
|
|
1907
2117
|
case 'empty':
|
|
@@ -2181,7 +2391,7 @@ const renameConditionReferences = (schema, oldPath, newPath) => {
|
|
|
2181
2391
|
*/
|
|
2182
2392
|
const getConditionValueKind = (field, definition) => {
|
|
2183
2393
|
const props = field?.props || {};
|
|
2184
|
-
if (field?.type === 'CheckboxGroup' || definition?.isSuperSelect || field?.type === 'Select' && (props.mode === 'multiple' || props.mode === 'tags')) {
|
|
2394
|
+
if (field?.type === 'CheckboxGroup' || field?.type === 'CheckboxGroupOther' || definition?.isSuperSelect || field?.type === 'Select' && (props.mode === 'multiple' || props.mode === 'tags')) {
|
|
2185
2395
|
return 'multiOptions';
|
|
2186
2396
|
}
|
|
2187
2397
|
if (definition?.hasOptions) {
|
|
@@ -2256,6 +2466,14 @@ const formatVisibleWhen = (visibleWhen, {
|
|
|
2256
2466
|
if (option) {
|
|
2257
2467
|
return resolveText(option.label);
|
|
2258
2468
|
}
|
|
2469
|
+
if (trigger?.type === 'RadioGroupOther' || trigger?.type === 'CheckboxGroupOther') {
|
|
2470
|
+
const otherValue = trigger?.props?.otherOption?.value != null && String(trigger.props.otherOption.value).trim() ? String(trigger.props.otherOption.value).trim() : 'other';
|
|
2471
|
+
if (sameValue(otherValue, value)) {
|
|
2472
|
+
return resolveText(trigger?.props?.otherOption?.label) || formatMessage({
|
|
2473
|
+
id: 'FieldTypeOtherOption'
|
|
2474
|
+
});
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2259
2477
|
if (typeof value === 'boolean') {
|
|
2260
2478
|
return formatMessage({
|
|
2261
2479
|
id: value ? 'conditionValueTrue' : 'conditionValueFalse'
|
|
@@ -2288,7 +2506,7 @@ const FIELD_GROUPS = [{
|
|
|
2288
2506
|
types: ['Input', 'TextArea', 'InputNumber', 'Switch', 'Checkbox', 'DatePicker']
|
|
2289
2507
|
}, {
|
|
2290
2508
|
labelId: 'FieldGroupSelect',
|
|
2291
|
-
types: ['Select', 'RadioGroup', 'CheckboxGroup']
|
|
2509
|
+
types: ['Select', 'RadioGroup', 'CheckboxGroup', 'RadioGroupOther', 'CheckboxGroupOther']
|
|
2292
2510
|
}, {
|
|
2293
2511
|
labelId: 'FieldGroupAdvancedSelect',
|
|
2294
2512
|
types: ['SuperSelectList', 'SuperSelectTableList', 'SuperSelectTree', 'SuperSelectCascader']
|
|
@@ -2445,6 +2663,95 @@ defineField('CheckboxGroup', {
|
|
|
2445
2663
|
};
|
|
2446
2664
|
}
|
|
2447
2665
|
});
|
|
2666
|
+
const resolveOtherOptionValue = field => {
|
|
2667
|
+
const raw = field?.props?.otherOption?.value;
|
|
2668
|
+
return raw != null && String(raw).trim() ? String(raw).trim() : 'other';
|
|
2669
|
+
};
|
|
2670
|
+
const choiceOtherEnums = field => {
|
|
2671
|
+
const enums = optionEnumValues(field) || [];
|
|
2672
|
+
const otherValue = resolveOtherOptionValue(field);
|
|
2673
|
+
return enums.includes(otherValue) ? enums : [...enums, otherValue];
|
|
2674
|
+
};
|
|
2675
|
+
const choiceOtherValueSchema = (field, multiple) => {
|
|
2676
|
+
const enums = choiceOtherEnums(field);
|
|
2677
|
+
const selected = multiple ? {
|
|
2678
|
+
type: 'array',
|
|
2679
|
+
items: {
|
|
2680
|
+
type: 'string',
|
|
2681
|
+
enum: enums
|
|
2682
|
+
}
|
|
2683
|
+
} : {
|
|
2684
|
+
type: 'string',
|
|
2685
|
+
enum: enums
|
|
2686
|
+
};
|
|
2687
|
+
return {
|
|
2688
|
+
type: 'object',
|
|
2689
|
+
properties: {
|
|
2690
|
+
value: selected,
|
|
2691
|
+
other: {
|
|
2692
|
+
type: 'string'
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2695
|
+
};
|
|
2696
|
+
};
|
|
2697
|
+
const formatChoiceOtherDisplay = (value, field, {
|
|
2698
|
+
formatMessage
|
|
2699
|
+
} = {}) => {
|
|
2700
|
+
if (value == null || typeof value !== 'object') {
|
|
2701
|
+
return '';
|
|
2702
|
+
}
|
|
2703
|
+
const options = field?.props?.options;
|
|
2704
|
+
const otherValue = resolveOtherOptionValue(field);
|
|
2705
|
+
const otherFallback = resolveLocaleText(field?.props?.otherOption?.label) || formatMessage?.({
|
|
2706
|
+
id: 'FieldTypeOtherOption'
|
|
2707
|
+
}) || '其他';
|
|
2708
|
+
const mapOne = item => {
|
|
2709
|
+
if (item === otherValue) {
|
|
2710
|
+
return otherFallback;
|
|
2711
|
+
}
|
|
2712
|
+
if (!Array.isArray(options) || !options.length) {
|
|
2713
|
+
return item == null ? '' : String(item);
|
|
2714
|
+
}
|
|
2715
|
+
const match = options.find(opt => opt && opt.value === item);
|
|
2716
|
+
if (match?.label != null) {
|
|
2717
|
+
return resolveLocaleText(match.label) || String(match.label);
|
|
2718
|
+
}
|
|
2719
|
+
return item == null ? '' : String(item);
|
|
2720
|
+
};
|
|
2721
|
+
const selected = Array.isArray(value.value) ? value.value.map(mapOne).filter(Boolean).join('、') : mapOne(value.value);
|
|
2722
|
+
const otherText = value.other != null && String(value.other).trim() ? String(value.other).trim() : '';
|
|
2723
|
+
if (selected && otherText) {
|
|
2724
|
+
return `${selected}(${otherFallback}: ${otherText})`;
|
|
2725
|
+
}
|
|
2726
|
+
if (otherText) {
|
|
2727
|
+
return `${otherFallback}: ${otherText}`;
|
|
2728
|
+
}
|
|
2729
|
+
return selected;
|
|
2730
|
+
};
|
|
2731
|
+
defineField('RadioGroupOther', {
|
|
2732
|
+
labelId: 'FieldTypeRadioGroupOther',
|
|
2733
|
+
component: reactFormAntd.RadioGroupOther,
|
|
2734
|
+
defaultProps: {
|
|
2735
|
+
options: [],
|
|
2736
|
+
inline: true
|
|
2737
|
+
},
|
|
2738
|
+
hasOptions: true,
|
|
2739
|
+
hasFieldProps: true,
|
|
2740
|
+
valueSchema: field => choiceOtherValueSchema(field, false),
|
|
2741
|
+
formatDisplayValue: formatChoiceOtherDisplay
|
|
2742
|
+
});
|
|
2743
|
+
defineField('CheckboxGroupOther', {
|
|
2744
|
+
labelId: 'FieldTypeCheckboxGroupOther',
|
|
2745
|
+
component: reactFormAntd.CheckboxGroupOther,
|
|
2746
|
+
defaultProps: {
|
|
2747
|
+
options: [],
|
|
2748
|
+
inline: true
|
|
2749
|
+
},
|
|
2750
|
+
hasOptions: true,
|
|
2751
|
+
hasFieldProps: true,
|
|
2752
|
+
valueSchema: field => choiceOtherValueSchema(field, true),
|
|
2753
|
+
formatDisplayValue: formatChoiceOtherDisplay
|
|
2754
|
+
});
|
|
2448
2755
|
defineField('SuperSelectList', {
|
|
2449
2756
|
labelId: 'FieldTypeSuperSelectList',
|
|
2450
2757
|
component: SuperSelectList,
|
|
@@ -2953,8 +3260,15 @@ const pickFieldProps = (field, definition) => {
|
|
|
2953
3260
|
};
|
|
2954
3261
|
case 'RadioGroup':
|
|
2955
3262
|
case 'CheckboxGroup':
|
|
3263
|
+
case 'RadioGroupOther':
|
|
3264
|
+
case 'CheckboxGroupOther':
|
|
2956
3265
|
return {
|
|
2957
|
-
inline: props.inline !== false
|
|
3266
|
+
inline: props.inline !== false,
|
|
3267
|
+
modern: !!props.modern,
|
|
3268
|
+
block: !!props.block,
|
|
3269
|
+
indexType: props.indexType === 'number' || props.indexType === 'check' ? props.indexType : 'letter',
|
|
3270
|
+
otherLabel: props.otherOption?.label || '',
|
|
3271
|
+
otherPlaceholder: props.otherProps?.placeholder || ''
|
|
2958
3272
|
};
|
|
2959
3273
|
default:
|
|
2960
3274
|
if (definition?.propsSchema?.length) {
|
|
@@ -3028,8 +3342,52 @@ const applyFieldProps = (props, values, definition) => {
|
|
|
3028
3342
|
break;
|
|
3029
3343
|
case 'RadioGroup':
|
|
3030
3344
|
case 'CheckboxGroup':
|
|
3345
|
+
case 'RadioGroupOther':
|
|
3346
|
+
case 'CheckboxGroupOther':
|
|
3031
3347
|
// 始终落盘布尔值,避免 Checkbox 未勾选时字段缺失被当成默认横向
|
|
3032
3348
|
props.inline = values.inline !== false;
|
|
3349
|
+
props.modern = !!values.modern;
|
|
3350
|
+
props.block = !!values.block;
|
|
3351
|
+
if (values.modern && (values.indexType === 'number' || values.indexType === 'check')) {
|
|
3352
|
+
props.indexType = values.indexType;
|
|
3353
|
+
} else {
|
|
3354
|
+
delete props.indexType;
|
|
3355
|
+
}
|
|
3356
|
+
if (!props.modern) {
|
|
3357
|
+
delete props.indexType;
|
|
3358
|
+
}
|
|
3359
|
+
if (type === 'RadioGroupOther' || type === 'CheckboxGroupOther') {
|
|
3360
|
+
if (hasLocaleText(values.otherLabel)) {
|
|
3361
|
+
props.otherOption = {
|
|
3362
|
+
...(props.otherOption && typeof props.otherOption === 'object' ? props.otherOption : {}),
|
|
3363
|
+
label: trimLocaleText(values.otherLabel),
|
|
3364
|
+
value: props.otherOption?.value || 'other'
|
|
3365
|
+
};
|
|
3366
|
+
} else {
|
|
3367
|
+
delete props.otherOption;
|
|
3368
|
+
}
|
|
3369
|
+
if (hasLocaleText(values.otherPlaceholder)) {
|
|
3370
|
+
props.otherProps = {
|
|
3371
|
+
...(props.otherProps && typeof props.otherProps === 'object' ? props.otherProps : {}),
|
|
3372
|
+
placeholder: trimLocaleText(values.otherPlaceholder)
|
|
3373
|
+
};
|
|
3374
|
+
} else if (props.otherProps && typeof props.otherProps === 'object') {
|
|
3375
|
+
const nextOtherProps = {
|
|
3376
|
+
...props.otherProps
|
|
3377
|
+
};
|
|
3378
|
+
delete nextOtherProps.placeholder;
|
|
3379
|
+
if (Object.keys(nextOtherProps).length) {
|
|
3380
|
+
props.otherProps = nextOtherProps;
|
|
3381
|
+
} else {
|
|
3382
|
+
delete props.otherProps;
|
|
3383
|
+
}
|
|
3384
|
+
} else {
|
|
3385
|
+
delete props.otherProps;
|
|
3386
|
+
}
|
|
3387
|
+
} else {
|
|
3388
|
+
delete props.otherOption;
|
|
3389
|
+
delete props.otherProps;
|
|
3390
|
+
}
|
|
3033
3391
|
break;
|
|
3034
3392
|
default:
|
|
3035
3393
|
if (definition?.propsSchema?.length) {
|
|
@@ -3214,7 +3572,7 @@ const LocaleTextArea = props => {
|
|
|
3214
3572
|
LocaleTextArea.field = LocaleTextAreaControl;
|
|
3215
3573
|
|
|
3216
3574
|
const {
|
|
3217
|
-
Text: Text$
|
|
3575
|
+
Text: Text$6
|
|
3218
3576
|
} = antd.Typography;
|
|
3219
3577
|
const TYPE_TAG_COLORS = {
|
|
3220
3578
|
Input: 'blue',
|
|
@@ -3223,6 +3581,8 @@ const TYPE_TAG_COLORS = {
|
|
|
3223
3581
|
Select: 'geekblue',
|
|
3224
3582
|
RadioGroup: 'purple',
|
|
3225
3583
|
CheckboxGroup: 'purple',
|
|
3584
|
+
RadioGroupOther: 'purple',
|
|
3585
|
+
CheckboxGroupOther: 'purple',
|
|
3226
3586
|
SuperSelectList: 'gold',
|
|
3227
3587
|
SuperSelectTableList: 'gold',
|
|
3228
3588
|
SuperSelectTree: 'gold',
|
|
@@ -3241,6 +3601,8 @@ const TYPE_TAG_ICONS = {
|
|
|
3241
3601
|
Select: icons.DownSquareOutlined,
|
|
3242
3602
|
RadioGroup: icons.CheckCircleOutlined,
|
|
3243
3603
|
CheckboxGroup: icons.CheckSquareOutlined,
|
|
3604
|
+
RadioGroupOther: icons.CheckCircleOutlined,
|
|
3605
|
+
CheckboxGroupOther: icons.CheckSquareOutlined,
|
|
3244
3606
|
SuperSelectList: icons.AppstoreOutlined,
|
|
3245
3607
|
SuperSelectTableList: icons.AppstoreOutlined,
|
|
3246
3608
|
SuperSelectTree: icons.AppstoreOutlined,
|
|
@@ -3280,7 +3642,7 @@ const FieldRow = ({
|
|
|
3280
3642
|
children: index + 1
|
|
3281
3643
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3282
3644
|
className: style['field-row-main'],
|
|
3283
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Text$
|
|
3645
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Text$6, {
|
|
3284
3646
|
strong: true,
|
|
3285
3647
|
className: style['field-row-label'],
|
|
3286
3648
|
children: resolveLocaleText(field.label, locale, languages) || formatMessage({
|
|
@@ -3390,6 +3752,282 @@ const FieldRow = ({
|
|
|
3390
3752
|
});
|
|
3391
3753
|
};
|
|
3392
3754
|
|
|
3755
|
+
const {
|
|
3756
|
+
Text: Text$5,
|
|
3757
|
+
Title
|
|
3758
|
+
} = antd.Typography;
|
|
3759
|
+
const createRowKey = () => createDataKey('mrow');
|
|
3760
|
+
const createColKey = () => createDataKey('mcol');
|
|
3761
|
+
const createOptKey = () => createDataKey('mopt');
|
|
3762
|
+
const createEmptyMatrixRow = () => ({
|
|
3763
|
+
_key: createRowKey(),
|
|
3764
|
+
label: '',
|
|
3765
|
+
name: createDataKey('row')
|
|
3766
|
+
});
|
|
3767
|
+
const createEmptyMatrixColumn = () => ({
|
|
3768
|
+
_key: createColKey(),
|
|
3769
|
+
label: '',
|
|
3770
|
+
name: createDataKey('col')
|
|
3771
|
+
});
|
|
3772
|
+
const createEmptyMatrixOption = () => ({
|
|
3773
|
+
_key: createOptKey(),
|
|
3774
|
+
label: '',
|
|
3775
|
+
value: ''
|
|
3776
|
+
});
|
|
3777
|
+
const ensureKeys = (list = [], createKey) => list.map(item => ({
|
|
3778
|
+
...item,
|
|
3779
|
+
_key: item._key || createKey()
|
|
3780
|
+
}));
|
|
3781
|
+
const hasMissingKey = (list = []) => list.some(item => !item?._key);
|
|
3782
|
+
|
|
3783
|
+
/** 勿在此用 FormInfo:模块列不在 Form 内,FormInfo→FieldList 会读不到 openApiRef */
|
|
3784
|
+
const EditorSection = ({
|
|
3785
|
+
title,
|
|
3786
|
+
tip,
|
|
3787
|
+
children
|
|
3788
|
+
}) => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3789
|
+
className: style['columns-editor'],
|
|
3790
|
+
children: [title ? /*#__PURE__*/jsxRuntime.jsx(Title, {
|
|
3791
|
+
level: 5,
|
|
3792
|
+
className: style['matrix-scale-editor-title'],
|
|
3793
|
+
children: title
|
|
3794
|
+
}) : null, children, tip ? /*#__PURE__*/jsxRuntime.jsx(antd.Space, {
|
|
3795
|
+
size: 4,
|
|
3796
|
+
className: style['options-tip'],
|
|
3797
|
+
children: tip
|
|
3798
|
+
}) : null]
|
|
3799
|
+
});
|
|
3800
|
+
const LabelNameRows = ({
|
|
3801
|
+
title,
|
|
3802
|
+
tip,
|
|
3803
|
+
list,
|
|
3804
|
+
onChange,
|
|
3805
|
+
createEmpty,
|
|
3806
|
+
createKey,
|
|
3807
|
+
labelPlaceholder,
|
|
3808
|
+
namePlaceholder,
|
|
3809
|
+
addText
|
|
3810
|
+
}) => {
|
|
3811
|
+
// 只展示已落盘数据;缺 key / 空列表由 effect 补齐,避免每次 render 新建临时项导致丢焦点
|
|
3812
|
+
react.useEffect(() => {
|
|
3813
|
+
if (!list.length) {
|
|
3814
|
+
onChange([createEmpty()]);
|
|
3815
|
+
return;
|
|
3816
|
+
}
|
|
3817
|
+
if (hasMissingKey(list)) {
|
|
3818
|
+
onChange(ensureKeys(list, createKey));
|
|
3819
|
+
}
|
|
3820
|
+
}, [list, onChange, createEmpty, createKey]);
|
|
3821
|
+
const rows = list.length ? list : [];
|
|
3822
|
+
const updateItem = (index, patch) => {
|
|
3823
|
+
onChange(rows.map((item, itemIndex) => itemIndex === index ? {
|
|
3824
|
+
...item,
|
|
3825
|
+
...patch
|
|
3826
|
+
} : item));
|
|
3827
|
+
};
|
|
3828
|
+
return /*#__PURE__*/jsxRuntime.jsxs(EditorSection, {
|
|
3829
|
+
title: title,
|
|
3830
|
+
tip: tip,
|
|
3831
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3832
|
+
className: style['options-list'],
|
|
3833
|
+
children: rows.map((item, index) => /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
|
|
3834
|
+
gap: 8,
|
|
3835
|
+
align: "start",
|
|
3836
|
+
className: style['options-row'],
|
|
3837
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Input, {
|
|
3838
|
+
value: item.label || '',
|
|
3839
|
+
placeholder: labelPlaceholder,
|
|
3840
|
+
onChange: e => updateItem(index, {
|
|
3841
|
+
label: e.target.value
|
|
3842
|
+
})
|
|
3843
|
+
}), /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
|
|
3844
|
+
value: item.name || '',
|
|
3845
|
+
placeholder: namePlaceholder,
|
|
3846
|
+
onChange: e => updateItem(index, {
|
|
3847
|
+
name: e.target.value
|
|
3848
|
+
})
|
|
3849
|
+
}), /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
3850
|
+
type: "text",
|
|
3851
|
+
danger: true,
|
|
3852
|
+
className: style['icon-square-btn-sm'],
|
|
3853
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(icons.DeleteOutlined, {}),
|
|
3854
|
+
disabled: rows.length <= 1,
|
|
3855
|
+
onClick: () => {
|
|
3856
|
+
const next = rows.filter((_, i) => i !== index);
|
|
3857
|
+
onChange(next.length ? next : [createEmpty()]);
|
|
3858
|
+
}
|
|
3859
|
+
})]
|
|
3860
|
+
}, item._key || `row-${index}`))
|
|
3861
|
+
}), /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
3862
|
+
type: "dashed",
|
|
3863
|
+
block: true,
|
|
3864
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(icons.PlusOutlined, {}),
|
|
3865
|
+
onClick: () => onChange([...rows, createEmpty()]),
|
|
3866
|
+
children: addText
|
|
3867
|
+
})]
|
|
3868
|
+
});
|
|
3869
|
+
};
|
|
3870
|
+
const MatrixOptionsEditor = ({
|
|
3871
|
+
value = [],
|
|
3872
|
+
onChange
|
|
3873
|
+
}) => {
|
|
3874
|
+
const {
|
|
3875
|
+
formatMessage
|
|
3876
|
+
} = reactIntl.useIntl();
|
|
3877
|
+
react.useEffect(() => {
|
|
3878
|
+
if (!value.length) {
|
|
3879
|
+
onChange([createEmptyMatrixOption()]);
|
|
3880
|
+
return;
|
|
3881
|
+
}
|
|
3882
|
+
if (hasMissingKey(value)) {
|
|
3883
|
+
onChange(ensureKeys(value, createOptKey));
|
|
3884
|
+
}
|
|
3885
|
+
}, [value, onChange]);
|
|
3886
|
+
const rows = value.length ? value : [];
|
|
3887
|
+
const updateItem = (index, patch) => {
|
|
3888
|
+
onChange(rows.map((item, itemIndex) => itemIndex === index ? {
|
|
3889
|
+
...item,
|
|
3890
|
+
...patch
|
|
3891
|
+
} : item));
|
|
3892
|
+
};
|
|
3893
|
+
return /*#__PURE__*/jsxRuntime.jsxs(EditorSection, {
|
|
3894
|
+
title: formatMessage({
|
|
3895
|
+
id: 'matrixScaleOptionsTitle'
|
|
3896
|
+
}),
|
|
3897
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3898
|
+
className: style['options-list'],
|
|
3899
|
+
children: rows.map((item, index) => /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
|
|
3900
|
+
gap: 8,
|
|
3901
|
+
align: "start",
|
|
3902
|
+
className: style['options-row'],
|
|
3903
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Input, {
|
|
3904
|
+
value: item.label || '',
|
|
3905
|
+
placeholder: formatMessage({
|
|
3906
|
+
id: 'optionLabelPlaceholder'
|
|
3907
|
+
}),
|
|
3908
|
+
onChange: e => {
|
|
3909
|
+
const label = e.target.value;
|
|
3910
|
+
const patch = {
|
|
3911
|
+
label
|
|
3912
|
+
};
|
|
3913
|
+
if (!item.value || item.value === item.label) {
|
|
3914
|
+
patch.value = label;
|
|
3915
|
+
}
|
|
3916
|
+
updateItem(index, patch);
|
|
3917
|
+
}
|
|
3918
|
+
}), /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
|
|
3919
|
+
value: item.value || '',
|
|
3920
|
+
placeholder: formatMessage({
|
|
3921
|
+
id: 'optionValuePlaceholder'
|
|
3922
|
+
}),
|
|
3923
|
+
onChange: e => updateItem(index, {
|
|
3924
|
+
value: e.target.value
|
|
3925
|
+
})
|
|
3926
|
+
}), /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
3927
|
+
type: "text",
|
|
3928
|
+
danger: true,
|
|
3929
|
+
className: style['icon-square-btn-sm'],
|
|
3930
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(icons.DeleteOutlined, {}),
|
|
3931
|
+
disabled: rows.length <= 1,
|
|
3932
|
+
onClick: () => {
|
|
3933
|
+
const next = rows.filter((_, i) => i !== index);
|
|
3934
|
+
onChange(next.length ? next : [createEmptyMatrixOption()]);
|
|
3935
|
+
}
|
|
3936
|
+
})]
|
|
3937
|
+
}, item._key || `opt-${index}`))
|
|
3938
|
+
}), /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
3939
|
+
type: "dashed",
|
|
3940
|
+
block: true,
|
|
3941
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(icons.PlusOutlined, {}),
|
|
3942
|
+
onClick: () => onChange([...rows, createEmptyMatrixOption()]),
|
|
3943
|
+
children: formatMessage({
|
|
3944
|
+
id: 'addOption'
|
|
3945
|
+
})
|
|
3946
|
+
})]
|
|
3947
|
+
});
|
|
3948
|
+
};
|
|
3949
|
+
const MatrixScaleEditor = ({
|
|
3950
|
+
block,
|
|
3951
|
+
onChange
|
|
3952
|
+
}) => {
|
|
3953
|
+
const {
|
|
3954
|
+
formatMessage
|
|
3955
|
+
} = reactIntl.useIntl();
|
|
3956
|
+
const layout = block.layout === 'columns' || block.layout === 'field' ? block.layout : 'options';
|
|
3957
|
+
const blockRef = react.useRef(block);
|
|
3958
|
+
blockRef.current = block;
|
|
3959
|
+
const onChangeRef = react.useRef(onChange);
|
|
3960
|
+
onChangeRef.current = onChange;
|
|
3961
|
+
|
|
3962
|
+
// 用 ref 保持回调稳定,避免输入时子组件 useEffect 反复触发
|
|
3963
|
+
const handleRowsChange = react.useCallback(rows => onChangeRef.current({
|
|
3964
|
+
...blockRef.current,
|
|
3965
|
+
rows
|
|
3966
|
+
}), []);
|
|
3967
|
+
const handleOptionsChange = react.useCallback(options => onChangeRef.current({
|
|
3968
|
+
...blockRef.current,
|
|
3969
|
+
options
|
|
3970
|
+
}), []);
|
|
3971
|
+
const handleColumnsChange = react.useCallback(columns => onChangeRef.current({
|
|
3972
|
+
...blockRef.current,
|
|
3973
|
+
columns
|
|
3974
|
+
}), []);
|
|
3975
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3976
|
+
className: style['block-body'],
|
|
3977
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Text$5, {
|
|
3978
|
+
type: "secondary",
|
|
3979
|
+
className: style['inline-empty'],
|
|
3980
|
+
children: formatMessage({
|
|
3981
|
+
id: `matrixScaleEditorHint_${layout}`
|
|
3982
|
+
})
|
|
3983
|
+
}), /*#__PURE__*/jsxRuntime.jsx(LabelNameRows, {
|
|
3984
|
+
title: formatMessage({
|
|
3985
|
+
id: 'matrixScaleRowsTitle'
|
|
3986
|
+
}),
|
|
3987
|
+
tip: formatMessage({
|
|
3988
|
+
id: 'matrixScaleRowsHint'
|
|
3989
|
+
}),
|
|
3990
|
+
list: block.rows || [],
|
|
3991
|
+
onChange: handleRowsChange,
|
|
3992
|
+
createEmpty: createEmptyMatrixRow,
|
|
3993
|
+
createKey: createRowKey,
|
|
3994
|
+
labelPlaceholder: formatMessage({
|
|
3995
|
+
id: 'matrixScaleRowLabelPlaceholder'
|
|
3996
|
+
}),
|
|
3997
|
+
namePlaceholder: formatMessage({
|
|
3998
|
+
id: 'matrixScaleRowNamePlaceholder'
|
|
3999
|
+
}),
|
|
4000
|
+
addText: formatMessage({
|
|
4001
|
+
id: 'matrixScaleAddRow'
|
|
4002
|
+
})
|
|
4003
|
+
}), layout === 'options' ? /*#__PURE__*/jsxRuntime.jsx(MatrixOptionsEditor, {
|
|
4004
|
+
value: block.options || [],
|
|
4005
|
+
onChange: handleOptionsChange
|
|
4006
|
+
}) : null, layout === 'columns' ? /*#__PURE__*/jsxRuntime.jsx(LabelNameRows, {
|
|
4007
|
+
title: formatMessage({
|
|
4008
|
+
id: 'matrixScaleColumnsTitle'
|
|
4009
|
+
}),
|
|
4010
|
+
tip: formatMessage({
|
|
4011
|
+
id: 'matrixScaleColumnsHint'
|
|
4012
|
+
}),
|
|
4013
|
+
list: block.columns || [],
|
|
4014
|
+
onChange: handleColumnsChange,
|
|
4015
|
+
createEmpty: createEmptyMatrixColumn,
|
|
4016
|
+
createKey: createColKey,
|
|
4017
|
+
labelPlaceholder: formatMessage({
|
|
4018
|
+
id: 'matrixScaleColumnLabelPlaceholder'
|
|
4019
|
+
}),
|
|
4020
|
+
namePlaceholder: formatMessage({
|
|
4021
|
+
id: 'matrixScaleColumnNamePlaceholder'
|
|
4022
|
+
}),
|
|
4023
|
+
addText: formatMessage({
|
|
4024
|
+
id: 'matrixScaleAddRow'
|
|
4025
|
+
})
|
|
4026
|
+
}) : null]
|
|
4027
|
+
});
|
|
4028
|
+
};
|
|
4029
|
+
var MatrixScaleEditor$1 = MatrixScaleEditor;
|
|
4030
|
+
|
|
3393
4031
|
const {
|
|
3394
4032
|
Text: Text$4
|
|
3395
4033
|
} = antd.Typography;
|
|
@@ -3432,6 +4070,9 @@ const ROOT_ADD_OPTIONS = [{
|
|
|
3432
4070
|
}, {
|
|
3433
4071
|
key: 'multiField',
|
|
3434
4072
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.AppstoreOutlined, {})
|
|
4073
|
+
}, {
|
|
4074
|
+
key: 'matrixScale',
|
|
4075
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(icons.BorderOuterOutlined, {})
|
|
3435
4076
|
}, {
|
|
3436
4077
|
key: 'steps',
|
|
3437
4078
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.OrderedListOutlined, {})
|
|
@@ -3462,6 +4103,7 @@ const BlockListPanel = ({
|
|
|
3462
4103
|
onDeleteChoiceOption,
|
|
3463
4104
|
onMoveChoiceOption,
|
|
3464
4105
|
onOpenFormActions,
|
|
4106
|
+
onPatchBlock,
|
|
3465
4107
|
extraToolbar
|
|
3466
4108
|
}) => {
|
|
3467
4109
|
const {
|
|
@@ -3812,6 +4454,12 @@ const BlockListPanel = ({
|
|
|
3812
4454
|
})
|
|
3813
4455
|
});
|
|
3814
4456
|
}
|
|
4457
|
+
if (block.kind === 'matrixScale') {
|
|
4458
|
+
return /*#__PURE__*/jsxRuntime.jsx(MatrixScaleEditor$1, {
|
|
4459
|
+
block: block,
|
|
4460
|
+
onChange: next => onPatchBlock?.(next)
|
|
4461
|
+
});
|
|
4462
|
+
}
|
|
3815
4463
|
if (block.kind === 'choice') {
|
|
3816
4464
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3817
4465
|
className: style['block-body'],
|
|
@@ -3935,11 +4583,12 @@ const BlockListPanel = ({
|
|
|
3935
4583
|
const total = siblings.length;
|
|
3936
4584
|
const locked = blockHasLockedField(block);
|
|
3937
4585
|
const definition = getBlockDefinition(block.kind);
|
|
3938
|
-
const canAddField = block.kind !== 'steps' && block.kind !== 'multiField' && block.kind !== 'choice';
|
|
4586
|
+
const canAddField = block.kind !== 'steps' && block.kind !== 'multiField' && block.kind !== 'matrixScale' && block.kind !== 'choice';
|
|
3939
4587
|
const supportsItemBlocks$1 = supportsItemBlocks(block.kind);
|
|
3940
4588
|
const supportsBlocks = block.kind === 'formInfo' || block.kind === 'object';
|
|
3941
4589
|
const supportsChildModules = supportsItemBlocks$1 || supportsBlocks;
|
|
3942
4590
|
const nestCount = supportsItemBlocks$1 ? block.itemBlocks?.length || 0 : block.blocks?.length || 0;
|
|
4591
|
+
const matrixLayout = block.layout === 'columns' || block.layout === 'field' ? block.layout : 'options';
|
|
3943
4592
|
const summary = block.kind === 'steps' ? formatMessage({
|
|
3944
4593
|
id: 'stepCount'
|
|
3945
4594
|
}, {
|
|
@@ -3951,6 +4600,17 @@ const BlockListPanel = ({
|
|
|
3951
4600
|
className: style['block-summary-type'],
|
|
3952
4601
|
children: [/*#__PURE__*/react.createElement(getFieldTypeIcon(block.fieldType || 'Input')), resolveFieldTypeLabel(block.fieldType, formatMessage)]
|
|
3953
4602
|
})
|
|
4603
|
+
}) : block.kind === 'matrixScale' ? formatMessage({
|
|
4604
|
+
id: 'matrixScaleSummary'
|
|
4605
|
+
}, {
|
|
4606
|
+
type: /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
4607
|
+
className: style['block-summary-type'],
|
|
4608
|
+
children: [/*#__PURE__*/react.createElement(getFieldTypeIcon(block.fieldType || 'RadioGroup')), resolveFieldTypeLabel(block.fieldType || 'RadioGroup', formatMessage)]
|
|
4609
|
+
}),
|
|
4610
|
+
layout: formatMessage({
|
|
4611
|
+
id: `matrixScaleLayout_${matrixLayout}`
|
|
4612
|
+
}),
|
|
4613
|
+
rows: block.rows?.length || 0
|
|
3954
4614
|
}) : block.kind === 'choice' ? formatMessage({
|
|
3955
4615
|
id: 'choiceOptionCount'
|
|
3956
4616
|
}, {
|
|
@@ -4290,6 +4950,63 @@ const BlockConfigFields = ({
|
|
|
4290
4950
|
})
|
|
4291
4951
|
}, "addText"));
|
|
4292
4952
|
}
|
|
4953
|
+
if (kind === 'matrixScale') {
|
|
4954
|
+
list.push(/*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
4955
|
+
name: "title",
|
|
4956
|
+
label: formatMessage({
|
|
4957
|
+
id: 'blockTitle'
|
|
4958
|
+
}),
|
|
4959
|
+
placeholder: formatMessage({
|
|
4960
|
+
id: 'blockTitlePlaceholder'
|
|
4961
|
+
})
|
|
4962
|
+
}, "title"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
|
|
4963
|
+
name: "name",
|
|
4964
|
+
label: formatMessage({
|
|
4965
|
+
id: 'blockName'
|
|
4966
|
+
}),
|
|
4967
|
+
rule: "REQ",
|
|
4968
|
+
placeholder: formatMessage({
|
|
4969
|
+
id: 'fieldNamePlaceholder'
|
|
4970
|
+
})
|
|
4971
|
+
}, "name"), /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
4972
|
+
name: "rowTitle",
|
|
4973
|
+
label: formatMessage({
|
|
4974
|
+
id: 'matrixScaleRowTitle'
|
|
4975
|
+
}),
|
|
4976
|
+
placeholder: formatMessage({
|
|
4977
|
+
id: 'matrixScaleRowTitlePlaceholder'
|
|
4978
|
+
})
|
|
4979
|
+
}, "rowTitle"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Select, {
|
|
4980
|
+
name: "layout",
|
|
4981
|
+
label: formatMessage({
|
|
4982
|
+
id: 'matrixScaleLayout'
|
|
4983
|
+
}),
|
|
4984
|
+
rule: "REQ",
|
|
4985
|
+
options: MATRIX_LAYOUTS.map(value => ({
|
|
4986
|
+
label: formatMessage({
|
|
4987
|
+
id: `matrixScaleLayout_${value}`
|
|
4988
|
+
}),
|
|
4989
|
+
value
|
|
4990
|
+
}))
|
|
4991
|
+
}, "layout"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Select, {
|
|
4992
|
+
name: "fieldType",
|
|
4993
|
+
label: formatMessage({
|
|
4994
|
+
id: 'multiFieldType'
|
|
4995
|
+
}),
|
|
4996
|
+
rule: "REQ",
|
|
4997
|
+
options: fieldTypeOptions
|
|
4998
|
+
}, "fieldType"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
4999
|
+
name: "bordered",
|
|
5000
|
+
children: formatMessage({
|
|
5001
|
+
id: 'blockBordered'
|
|
5002
|
+
})
|
|
5003
|
+
}, "bordered"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
5004
|
+
name: "required",
|
|
5005
|
+
children: formatMessage({
|
|
5006
|
+
id: 'matrixScaleRequired'
|
|
5007
|
+
})
|
|
5008
|
+
}, "required"));
|
|
5009
|
+
}
|
|
4293
5010
|
if (kind === 'steps') {
|
|
4294
5011
|
list.push(/*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
4295
5012
|
name: "title",
|
|
@@ -4643,7 +5360,28 @@ const FlatOptionRows = ({
|
|
|
4643
5360
|
};
|
|
4644
5361
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4645
5362
|
className: style['options-list'],
|
|
4646
|
-
children: [
|
|
5363
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5364
|
+
className: style['options-header'],
|
|
5365
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
5366
|
+
className: style['options-header-label'],
|
|
5367
|
+
children: formatMessage({
|
|
5368
|
+
id: 'optionLabelColumn'
|
|
5369
|
+
})
|
|
5370
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
5371
|
+
className: style['options-header-value'],
|
|
5372
|
+
children: formatMessage({
|
|
5373
|
+
id: 'optionValueColumn'
|
|
5374
|
+
})
|
|
5375
|
+
}), allowDescription ? /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
5376
|
+
className: style['options-header-description'],
|
|
5377
|
+
children: formatMessage({
|
|
5378
|
+
id: 'optionDescColumn'
|
|
5379
|
+
})
|
|
5380
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
5381
|
+
className: style['options-header-action'],
|
|
5382
|
+
"aria-hidden": "true"
|
|
5383
|
+
})]
|
|
5384
|
+
}), rows.map((item, index) => /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
|
|
4647
5385
|
gap: 8,
|
|
4648
5386
|
align: "start",
|
|
4649
5387
|
className: style['options-row'],
|
|
@@ -5035,6 +5773,7 @@ const TableRowsEditor = ({
|
|
|
5035
5773
|
},
|
|
5036
5774
|
children: [/*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
|
|
5037
5775
|
gap: 8,
|
|
5776
|
+
className: style['options-row'],
|
|
5038
5777
|
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Input, {
|
|
5039
5778
|
value: item.value || '',
|
|
5040
5779
|
placeholder: formatMessage({
|
|
@@ -5263,7 +6002,8 @@ const SuperSelectPropsEditor = ({
|
|
|
5263
6002
|
};
|
|
5264
6003
|
var SuperSelectPropsEditor$1 = SuperSelectPropsEditor;
|
|
5265
6004
|
|
|
5266
|
-
const BUILTIN_PROP_TYPES = ['Input', 'TextArea', 'InputNumber', 'Select', 'DatePicker', 'Switch', 'RadioGroup', 'CheckboxGroup'];
|
|
6005
|
+
const BUILTIN_PROP_TYPES = ['Input', 'TextArea', 'InputNumber', 'Select', 'DatePicker', 'Switch', 'RadioGroup', 'CheckboxGroup', 'RadioGroupOther', 'CheckboxGroupOther'];
|
|
6006
|
+
const CHOICE_OTHER_TYPES = ['RadioGroupOther', 'CheckboxGroupOther'];
|
|
5267
6007
|
const buildPropsSchemaList = (schema, formatMessage) => (schema || []).filter(item => item?.name).map(item => {
|
|
5268
6008
|
if (item.type === 'boolean') {
|
|
5269
6009
|
return /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
@@ -5497,12 +6237,70 @@ const buildBuiltinList = (type, formatMessage) => {
|
|
|
5497
6237
|
}, "unCheckedChildren")];
|
|
5498
6238
|
case 'RadioGroup':
|
|
5499
6239
|
case 'CheckboxGroup':
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
6240
|
+
case 'RadioGroupOther':
|
|
6241
|
+
case 'CheckboxGroupOther':
|
|
6242
|
+
{
|
|
6243
|
+
const list = [/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
6244
|
+
name: "inline",
|
|
6245
|
+
children: formatMessage({
|
|
6246
|
+
id: 'propOptionsInline'
|
|
6247
|
+
})
|
|
6248
|
+
}, "inline"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
6249
|
+
name: "modern",
|
|
6250
|
+
children: formatMessage({
|
|
6251
|
+
id: 'propChoiceModern'
|
|
6252
|
+
})
|
|
6253
|
+
}, "modern"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
6254
|
+
name: "block",
|
|
6255
|
+
children: formatMessage({
|
|
6256
|
+
id: 'propChoiceBlock'
|
|
6257
|
+
})
|
|
6258
|
+
}, "block"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Select, {
|
|
6259
|
+
name: "indexType",
|
|
6260
|
+
label: formatMessage({
|
|
6261
|
+
id: 'propChoiceIndexType'
|
|
6262
|
+
}),
|
|
6263
|
+
options: [{
|
|
6264
|
+
label: formatMessage({
|
|
6265
|
+
id: 'propChoiceIndexTypeLetter'
|
|
6266
|
+
}),
|
|
6267
|
+
value: 'letter'
|
|
6268
|
+
}, {
|
|
6269
|
+
label: formatMessage({
|
|
6270
|
+
id: 'propChoiceIndexTypeNumber'
|
|
6271
|
+
}),
|
|
6272
|
+
value: 'number'
|
|
6273
|
+
}, {
|
|
6274
|
+
label: formatMessage({
|
|
6275
|
+
id: 'propChoiceIndexTypeCheck'
|
|
6276
|
+
}),
|
|
6277
|
+
value: 'check'
|
|
6278
|
+
}],
|
|
6279
|
+
display: ({
|
|
6280
|
+
openApi
|
|
6281
|
+
}) => !!openApi?.data?.modern
|
|
6282
|
+
}, "indexType")];
|
|
6283
|
+
if (CHOICE_OTHER_TYPES.includes(type)) {
|
|
6284
|
+
list.push(/*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
6285
|
+
name: "otherLabel",
|
|
6286
|
+
label: formatMessage({
|
|
6287
|
+
id: 'propChoiceOtherLabel'
|
|
6288
|
+
}),
|
|
6289
|
+
placeholder: formatMessage({
|
|
6290
|
+
id: 'propChoiceOtherLabelHint'
|
|
6291
|
+
})
|
|
6292
|
+
}, "otherLabel"), /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
6293
|
+
name: "otherPlaceholder",
|
|
6294
|
+
label: formatMessage({
|
|
6295
|
+
id: 'propChoiceOtherPlaceholder'
|
|
6296
|
+
}),
|
|
6297
|
+
placeholder: formatMessage({
|
|
6298
|
+
id: 'propChoiceOtherPlaceholderHint'
|
|
6299
|
+
})
|
|
6300
|
+
}, "otherPlaceholder"));
|
|
6301
|
+
}
|
|
6302
|
+
return list;
|
|
6303
|
+
}
|
|
5506
6304
|
default:
|
|
5507
6305
|
return [];
|
|
5508
6306
|
}
|
|
@@ -5693,6 +6491,17 @@ const ConditionValueInput = ({
|
|
|
5693
6491
|
value: item.value,
|
|
5694
6492
|
label: resolveLocaleText(item.label, locale) || String(item.value)
|
|
5695
6493
|
}));
|
|
6494
|
+
if (trigger?.type === 'RadioGroupOther' || trigger?.type === 'CheckboxGroupOther') {
|
|
6495
|
+
const otherValue = trigger?.props?.otherOption?.value != null && String(trigger.props.otherOption.value).trim() ? String(trigger.props.otherOption.value).trim() : 'other';
|
|
6496
|
+
if (!options.some(item => String(item.value) === otherValue)) {
|
|
6497
|
+
options.push({
|
|
6498
|
+
value: otherValue,
|
|
6499
|
+
label: resolveLocaleText(trigger?.props?.otherOption?.label, locale) || formatMessage({
|
|
6500
|
+
id: 'FieldTypeOtherOption'
|
|
6501
|
+
})
|
|
6502
|
+
});
|
|
6503
|
+
}
|
|
6504
|
+
}
|
|
5696
6505
|
const value = multiple ? Array.isArray(condition.value) ? condition.value : condition.value != null ? [condition.value] : [] : Array.isArray(condition.value) ? condition.value[0] : condition.value;
|
|
5697
6506
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
5698
6507
|
className: style['visible-when-value']
|
|
@@ -6812,12 +7621,13 @@ const renderFieldEntries = (fields = [], preview = false, {
|
|
|
6812
7621
|
}
|
|
6813
7622
|
delete props.range;
|
|
6814
7623
|
|
|
6815
|
-
//
|
|
6816
|
-
|
|
7624
|
+
// 选择组:form-creator 的 inline 仅编辑器用;渲染时删掉。block/modern 交给 react-form-antd;
|
|
7625
|
+
// 未开 block 且 inline=false 时沿用旧纵向兜底
|
|
7626
|
+
if (field.type === 'RadioGroup' || field.type === 'CheckboxGroup' || field.type === 'RadioGroupOther' || field.type === 'CheckboxGroupOther') {
|
|
6817
7627
|
const optionsInline = props.inline !== false;
|
|
6818
7628
|
delete props.inline;
|
|
6819
|
-
if (!optionsInline) {
|
|
6820
|
-
if (field.type === 'RadioGroup') {
|
|
7629
|
+
if (!props.block && !optionsInline) {
|
|
7630
|
+
if (field.type === 'RadioGroup' || field.type === 'RadioGroupOther') {
|
|
6821
7631
|
props.vertical = true;
|
|
6822
7632
|
}
|
|
6823
7633
|
props.className = [props.className, style['option-group-stack']].filter(Boolean).join(' ');
|
|
@@ -7050,6 +7860,35 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
|
|
|
7050
7860
|
} : {})
|
|
7051
7861
|
}), asListItem);
|
|
7052
7862
|
}
|
|
7863
|
+
case 'matrixScale':
|
|
7864
|
+
{
|
|
7865
|
+
const FieldComponent = getFieldComponent(block.fieldType || 'RadioGroup');
|
|
7866
|
+
if (!FieldComponent) {
|
|
7867
|
+
return null;
|
|
7868
|
+
}
|
|
7869
|
+
const layout = block.layout === 'columns' || block.layout === 'field' ? block.layout : 'options';
|
|
7870
|
+
return withBlockLayout(/*#__PURE__*/react.createElement(FormInfo.MatrixScale, {
|
|
7871
|
+
key: block.id,
|
|
7872
|
+
name: block.name,
|
|
7873
|
+
title: block.title || undefined,
|
|
7874
|
+
rowTitle: block.rowTitle || undefined,
|
|
7875
|
+
bordered,
|
|
7876
|
+
field: FieldComponent,
|
|
7877
|
+
rule: block.rule || undefined,
|
|
7878
|
+
rows: block.rows || [],
|
|
7879
|
+
...(layout === 'options' ? {
|
|
7880
|
+
options: block.options || []
|
|
7881
|
+
} : null),
|
|
7882
|
+
...(layout === 'columns' ? {
|
|
7883
|
+
columns: block.columns || []
|
|
7884
|
+
} : null),
|
|
7885
|
+
...(listItemPartProps || {}),
|
|
7886
|
+
className: resolvePartRootClassName(depth),
|
|
7887
|
+
...(locale ? {
|
|
7888
|
+
locale
|
|
7889
|
+
} : {})
|
|
7890
|
+
}), asListItem);
|
|
7891
|
+
}
|
|
7053
7892
|
case 'steps':
|
|
7054
7893
|
{
|
|
7055
7894
|
return withBlockLayout(/*#__PURE__*/react.createElement(FormInfo.Steps, {
|
|
@@ -7521,6 +8360,12 @@ const FormCreator = withLocale$1(({
|
|
|
7521
8360
|
const handleMoveBlock = (blockId, direction) => {
|
|
7522
8361
|
updateSchema(updateBlocks(schema, blocks => moveBlockInTree(blocks, blockId, direction)));
|
|
7523
8362
|
};
|
|
8363
|
+
const handlePatchBlock = block => {
|
|
8364
|
+
if (!block?.id) {
|
|
8365
|
+
return;
|
|
8366
|
+
}
|
|
8367
|
+
updateSchema(mapBlocks(schema, block.id, () => block));
|
|
8368
|
+
};
|
|
7524
8369
|
const handleAddStep = blockId => {
|
|
7525
8370
|
setStepContext({
|
|
7526
8371
|
blockId,
|
|
@@ -7774,6 +8619,7 @@ const FormCreator = withLocale$1(({
|
|
|
7774
8619
|
onEditBlock: handleEditBlock,
|
|
7775
8620
|
onDeleteBlock: handleDeleteBlock,
|
|
7776
8621
|
onMoveBlock: handleMoveBlock,
|
|
8622
|
+
onPatchBlock: handlePatchBlock,
|
|
7777
8623
|
onAddField: handleAddField,
|
|
7778
8624
|
onEditField: handleEditField,
|
|
7779
8625
|
onDeleteField: handleDeleteField,
|
|
@@ -8632,6 +9478,68 @@ const walkBlock = (block, layer, depth = 0, ctx = {}) => {
|
|
|
8632
9478
|
layer.properties[name] = arraySchema;
|
|
8633
9479
|
return;
|
|
8634
9480
|
}
|
|
9481
|
+
case 'matrixScale':
|
|
9482
|
+
{
|
|
9483
|
+
const name = block.name != null && String(block.name).trim() ? String(block.name).trim() : '';
|
|
9484
|
+
if (!name) {
|
|
9485
|
+
return;
|
|
9486
|
+
}
|
|
9487
|
+
const layout = block.layout === 'columns' || block.layout === 'field' ? block.layout : 'options';
|
|
9488
|
+
const fieldType = block.fieldType || 'RadioGroup';
|
|
9489
|
+
const required = typeof block.rule === 'string' && block.rule.split(' ').includes('REQ');
|
|
9490
|
+
const properties = {};
|
|
9491
|
+
const requiredKeys = [];
|
|
9492
|
+
(block.rows || []).forEach(row => {
|
|
9493
|
+
const rowName = row?.name != null && String(row.name).trim() ? String(row.name).trim() : '';
|
|
9494
|
+
if (!rowName) {
|
|
9495
|
+
return;
|
|
9496
|
+
}
|
|
9497
|
+
if (layout === 'columns') {
|
|
9498
|
+
const columnProperties = {};
|
|
9499
|
+
(block.columns || []).forEach(column => {
|
|
9500
|
+
const columnName = column?.name != null && String(column.name).trim() ? String(column.name).trim() : '';
|
|
9501
|
+
if (!columnName) {
|
|
9502
|
+
return;
|
|
9503
|
+
}
|
|
9504
|
+
columnProperties[columnName] = resolveFieldValueSchema({
|
|
9505
|
+
type: fieldType,
|
|
9506
|
+
label: column.label,
|
|
9507
|
+
rule: block.rule,
|
|
9508
|
+
props: {}
|
|
9509
|
+
});
|
|
9510
|
+
});
|
|
9511
|
+
properties[rowName] = {
|
|
9512
|
+
type: 'object',
|
|
9513
|
+
title: row.label || undefined,
|
|
9514
|
+
properties: columnProperties
|
|
9515
|
+
};
|
|
9516
|
+
} else {
|
|
9517
|
+
properties[rowName] = resolveFieldValueSchema({
|
|
9518
|
+
type: fieldType,
|
|
9519
|
+
label: row.label,
|
|
9520
|
+
rule: block.rule,
|
|
9521
|
+
props: layout === 'options' ? {
|
|
9522
|
+
options: block.options || []
|
|
9523
|
+
} : {}
|
|
9524
|
+
});
|
|
9525
|
+
}
|
|
9526
|
+
if (required) {
|
|
9527
|
+
requiredKeys.push(rowName);
|
|
9528
|
+
}
|
|
9529
|
+
});
|
|
9530
|
+
const objectSchema = {
|
|
9531
|
+
type: 'object',
|
|
9532
|
+
properties
|
|
9533
|
+
};
|
|
9534
|
+
if (block.title) {
|
|
9535
|
+
objectSchema.title = block.title;
|
|
9536
|
+
}
|
|
9537
|
+
if (requiredKeys.length) {
|
|
9538
|
+
objectSchema.required = requiredKeys;
|
|
9539
|
+
}
|
|
9540
|
+
layer.properties[name] = objectSchema;
|
|
9541
|
+
return;
|
|
9542
|
+
}
|
|
8635
9543
|
case 'steps':
|
|
8636
9544
|
{
|
|
8637
9545
|
(block.items || []).forEach(step => {
|