@kne/form-creator 0.1.26 → 0.1.28
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 +343 -22
- package/dist/index.css +584 -79
- package/dist/index.css.map +1 -1
- package/dist/index.js +1910 -472
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +1924 -513
- package/dist/index.modern.js.map +1 -1
- package/dist/locale/en-US.js +65 -0
- package/dist/locale/en-US.js.map +1 -1
- package/dist/locale/en-US.modern.js +65 -0
- package/dist/locale/en-US.modern.js.map +1 -1
- package/dist/locale/zh-CN.js +65 -0
- package/dist/locale/zh-CN.js.map +1 -1
- package/dist/locale/zh-CN.modern.js +65 -0
- package/dist/locale/zh-CN.modern.js.map +1 -1
- package/package.json +9 -7
package/dist/index.js
CHANGED
|
@@ -11,19 +11,21 @@ var SelectList = require('@kne/super-select');
|
|
|
11
11
|
var superSelectPlus = require('@kne/super-select-plus');
|
|
12
12
|
require('@kne/super-select/dist/index.css');
|
|
13
13
|
require('@kne/super-select-plus/dist/index.css');
|
|
14
|
+
var ButtonGroup = require('@kne/button-group');
|
|
14
15
|
var jsxRuntime = require('react/jsx-runtime');
|
|
16
|
+
var reactSortablejs = require('react-sortablejs');
|
|
15
17
|
var FormInfo = require('@kne/form-info');
|
|
16
|
-
var buttonGroup = require('@kne/button-group');
|
|
17
18
|
var InfoPage = require('@kne/info-page');
|
|
18
19
|
var remoteLoader = require('@kne/remote-loader');
|
|
19
20
|
|
|
20
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
22
|
|
|
22
23
|
var SelectList__default = /*#__PURE__*/_interopDefaultLegacy(SelectList);
|
|
24
|
+
var ButtonGroup__default = /*#__PURE__*/_interopDefaultLegacy(ButtonGroup);
|
|
23
25
|
var FormInfo__default = /*#__PURE__*/_interopDefaultLegacy(FormInfo);
|
|
24
26
|
var InfoPage__default = /*#__PURE__*/_interopDefaultLegacy(InfoPage);
|
|
25
27
|
|
|
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-
|
|
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"};
|
|
27
29
|
|
|
28
30
|
const locale$1 = {
|
|
29
31
|
addField: '添加填写项',
|
|
@@ -31,6 +33,8 @@ const locale$1 = {
|
|
|
31
33
|
deleteField: '删除填写项',
|
|
32
34
|
moveUp: '上移',
|
|
33
35
|
moveDown: '下移',
|
|
36
|
+
dragSort: '拖动排序',
|
|
37
|
+
moreActions: '更多操作',
|
|
34
38
|
fieldListTitle: '填写项配置',
|
|
35
39
|
fieldListSubtitle: '通过列表管理填写项,右侧实时预览表单效果',
|
|
36
40
|
blockListTitle: '表单结构',
|
|
@@ -52,6 +56,7 @@ const locale$1 = {
|
|
|
52
56
|
blockKind_tableList: '表格列表',
|
|
53
57
|
blockKind_editableList: '行内编辑列表',
|
|
54
58
|
blockKind_multiField: '同类多值',
|
|
59
|
+
blockKind_matrixScale: '矩阵量表',
|
|
55
60
|
blockKind_object: '分组信息',
|
|
56
61
|
blockKind_choice: '选项切换',
|
|
57
62
|
blockKind_steps: '分步表单',
|
|
@@ -60,6 +65,7 @@ const locale$1 = {
|
|
|
60
65
|
blockKindDesc_tableList: '以表格形式展示的可增减列表',
|
|
61
66
|
blockKindDesc_editableList: '每条记录只读展示,点击编辑后单独填写并保存;数据量大时不卡顿',
|
|
62
67
|
blockKindDesc_multiField: '同一种填写项可以输入多个值,例如多个手机号',
|
|
68
|
+
blockKindDesc_matrixScale: '行为题目、列为选项或字段格子,每行共用同一填写项类型',
|
|
63
69
|
blockKindDesc_object: '把相关的填写项放在一起,例如「在校时间」下的开始与结束',
|
|
64
70
|
blockKindDesc_choice: '先选一类情况,再填写对应内容;可设为单选或多选',
|
|
65
71
|
blockKindDesc_steps: '将表单拆分成多个步骤,引导用户逐步填写',
|
|
@@ -109,9 +115,38 @@ const locale$1 = {
|
|
|
109
115
|
blockAddPosition_top: '标题右侧(插入到第一项)',
|
|
110
116
|
blockAddPosition_both: '两处都显示',
|
|
111
117
|
blockAutoStep: '填写完成后自动进入下一步',
|
|
118
|
+
stepsStyle: '步骤展示样式',
|
|
119
|
+
stepsStyle_default: '完整步骤条',
|
|
120
|
+
stepsStyle_focus: '聚焦当前步骤',
|
|
121
|
+
stepsFocusNext: '下一步:{title}',
|
|
122
|
+
stepsFocusLast: '最后一步',
|
|
123
|
+
stepsFocusPrev: '上一步',
|
|
124
|
+
stepsFocusNextBtn: '下一步',
|
|
125
|
+
stepsFocusSubmitHint: '已是最后一步,确认无误后提交',
|
|
112
126
|
multiFieldType: '填写项类型',
|
|
113
127
|
multiFieldSummary: '填写类型:{type}',
|
|
114
128
|
multiFieldEditorHint: '同类多值模块会根据你选择的填写项类型,自动生成可增减的多个输入框。',
|
|
129
|
+
matrixScaleRowTitle: '行标题列名',
|
|
130
|
+
matrixScaleRowTitlePlaceholder: '例如:活动',
|
|
131
|
+
matrixScaleLayout: '矩阵布局',
|
|
132
|
+
matrixScaleLayout_options: '选项矩阵',
|
|
133
|
+
matrixScaleLayout_columns: '单元格矩阵',
|
|
134
|
+
matrixScaleLayout_field: '每行一个字段',
|
|
135
|
+
matrixScaleRequired: '每行(每格)必填',
|
|
136
|
+
matrixScaleSummary: '{type} · {layout} · {rows} 行',
|
|
137
|
+
matrixScaleEditorHint_options: '配置行题目与量表选项;预览中每行是同一个选择字段。',
|
|
138
|
+
matrixScaleEditorHint_columns: '配置行题目与列字段;每个格子是同一个填写项类型(如数字、评分)。',
|
|
139
|
+
matrixScaleEditorHint_field: '只配置行题目;每行右侧放一个填写项(不传列)。',
|
|
140
|
+
matrixScaleRowsTitle: '行配置',
|
|
141
|
+
matrixScaleRowsHint: '左侧为行标题,右侧为保存用的名称',
|
|
142
|
+
matrixScaleRowLabelPlaceholder: '例如:工作/学习',
|
|
143
|
+
matrixScaleRowNamePlaceholder: '例如:work',
|
|
144
|
+
matrixScaleOptionsTitle: '量表选项(列)',
|
|
145
|
+
matrixScaleColumnsTitle: '列配置',
|
|
146
|
+
matrixScaleColumnsHint: '左侧为列标题,右侧为保存用的名称',
|
|
147
|
+
matrixScaleColumnLabelPlaceholder: '例如:周一',
|
|
148
|
+
matrixScaleColumnNamePlaceholder: '例如:mon',
|
|
149
|
+
matrixScaleAddRow: '添加一行',
|
|
115
150
|
stepListTitle: '步骤列表',
|
|
116
151
|
addStep: '添加步骤',
|
|
117
152
|
editStep: '编辑步骤',
|
|
@@ -135,6 +170,19 @@ const locale$1 = {
|
|
|
135
170
|
FieldTypeSelect: '下拉选择',
|
|
136
171
|
FieldTypeRadioGroup: '单选组',
|
|
137
172
|
FieldTypeCheckboxGroup: '复选组',
|
|
173
|
+
FieldTypeRadioGroupOther: '单选组(含其他)',
|
|
174
|
+
FieldTypeCheckboxGroupOther: '复选组(含其他)',
|
|
175
|
+
FieldTypeOtherOption: '其他',
|
|
176
|
+
propChoiceModern: '新版样式(序号色块)',
|
|
177
|
+
propChoiceBlock: '块级选项(纵向占满)',
|
|
178
|
+
propChoiceIndexType: '序号类型',
|
|
179
|
+
propChoiceIndexTypeLetter: '字母 A/B/C',
|
|
180
|
+
propChoiceIndexTypeNumber: '数字 1/2/3',
|
|
181
|
+
propChoiceIndexTypeCheck: '对勾(无序号)',
|
|
182
|
+
propChoiceOtherLabel: '「其他」选项文案',
|
|
183
|
+
propChoiceOtherLabelHint: '默认:其他',
|
|
184
|
+
propChoiceOtherPlaceholder: '「其他」输入框提示',
|
|
185
|
+
propChoiceOtherPlaceholderHint: '选中「其他」后补充说明',
|
|
138
186
|
FieldTypeSuperSelectList: '普通下拉',
|
|
139
187
|
FieldTypeSuperSelectTableList: '表格选择',
|
|
140
188
|
FieldTypeSuperSelectTree: '树形选择',
|
|
@@ -189,6 +237,25 @@ const locale$1 = {
|
|
|
189
237
|
formActionsGapHint: '默认 16',
|
|
190
238
|
formActionsLayoutSection: '布局',
|
|
191
239
|
fieldBasicSection: '基本设置',
|
|
240
|
+
fieldBasicSectionDesc: '填写项类型、提交用的名称和展示给填写人的文案',
|
|
241
|
+
fieldOptionsDesc: '填写人可选择的选项,以及提交时对应的值',
|
|
242
|
+
fieldPropsSectionDesc: '输入控件的提示语、交互方式与格式',
|
|
243
|
+
fieldDisplaySection: '显示与布局',
|
|
244
|
+
fieldDisplaySectionDesc: '该项在表单中的占位与可见性',
|
|
245
|
+
blockBasicSection: '基本信息',
|
|
246
|
+
blockBasicSectionDesc: '模块标题与提交时使用的数据名称',
|
|
247
|
+
blockLayoutSection: '展示与布局',
|
|
248
|
+
blockLayoutSectionDesc: '模块的列数、间距与外观',
|
|
249
|
+
blockListRuleSection: '增减规则',
|
|
250
|
+
blockListRuleSectionDesc: '添加按钮文案与条目数量限制',
|
|
251
|
+
choiceRuleSection: '选择规则',
|
|
252
|
+
choiceRuleSectionDesc: '单选或多选,以及可选数量',
|
|
253
|
+
choiceDataSection: '数据存储',
|
|
254
|
+
choiceDataSectionDesc: '是否把选中的选项写入提交数据',
|
|
255
|
+
matrixScaleRuleDesc: '控制每一行是否必须作答',
|
|
256
|
+
formActionsButtonsSection: '按钮',
|
|
257
|
+
formActionsButtonsSectionDesc: '选择表单底部显示哪些按钮,并设置按钮文案',
|
|
258
|
+
formActionsLayoutSectionDesc: '按钮的对齐方式与间距',
|
|
192
259
|
optionLabelColumn: '选项名称',
|
|
193
260
|
optionValueColumn: '选项值',
|
|
194
261
|
optionDescColumn: '选项描述',
|
|
@@ -328,6 +395,8 @@ const locale = {
|
|
|
328
395
|
deleteField: 'Delete',
|
|
329
396
|
moveUp: 'Move Up',
|
|
330
397
|
moveDown: 'Move Down',
|
|
398
|
+
dragSort: 'Drag to reorder',
|
|
399
|
+
moreActions: 'More actions',
|
|
331
400
|
fieldListTitle: 'Field Configuration',
|
|
332
401
|
fieldListSubtitle: 'Manage fields and preview the form on the right',
|
|
333
402
|
blockListTitle: 'Form Structure',
|
|
@@ -349,6 +418,7 @@ const locale = {
|
|
|
349
418
|
blockKind_tableList: 'Table List',
|
|
350
419
|
blockKind_editableList: 'Inline Edit List',
|
|
351
420
|
blockKind_multiField: 'Multi-Value',
|
|
421
|
+
blockKind_matrixScale: 'Matrix Scale',
|
|
352
422
|
blockKind_object: 'Grouped Fields',
|
|
353
423
|
blockKind_choice: 'Options',
|
|
354
424
|
blockKind_steps: 'Step-by-Step',
|
|
@@ -357,6 +427,7 @@ const locale = {
|
|
|
357
427
|
blockKindDesc_tableList: 'A repeatable list displayed as a table',
|
|
358
428
|
blockKindDesc_editableList: 'Records are shown read-only; click edit to fill in and save each one. Stays fast with lots of data',
|
|
359
429
|
blockKindDesc_multiField: 'Enter multiple values for the same field, e.g. several phone numbers',
|
|
430
|
+
blockKindDesc_matrixScale: 'Rows are questions; columns are options or cell fields; every row shares one field type',
|
|
360
431
|
blockKindDesc_object: 'Group related fields together, e.g. start and end under "School period"',
|
|
361
432
|
blockKindDesc_choice: 'Pick a case first, then fill in the matching content; single or multiple selection',
|
|
362
433
|
blockKindDesc_steps: 'Split the form into steps to guide users through it',
|
|
@@ -406,9 +477,38 @@ const locale = {
|
|
|
406
477
|
blockAddPosition_top: 'Title right (insert as first)',
|
|
407
478
|
blockAddPosition_both: 'Both',
|
|
408
479
|
blockAutoStep: 'Auto proceed to next step after completion',
|
|
480
|
+
stepsStyle: 'Steps display',
|
|
481
|
+
stepsStyle_default: 'Full steps bar',
|
|
482
|
+
stepsStyle_focus: 'Focus current step',
|
|
483
|
+
stepsFocusNext: 'Next: {title}',
|
|
484
|
+
stepsFocusLast: 'Final step',
|
|
485
|
+
stepsFocusPrev: 'Back',
|
|
486
|
+
stepsFocusNextBtn: 'Next',
|
|
487
|
+
stepsFocusSubmitHint: 'Final step — review and submit',
|
|
409
488
|
multiFieldType: 'Field Type',
|
|
410
489
|
multiFieldSummary: 'Field type: {type}',
|
|
411
490
|
multiFieldEditorHint: 'This section auto-generates repeatable inputs based on the field type you choose.',
|
|
491
|
+
matrixScaleRowTitle: 'Row header title',
|
|
492
|
+
matrixScaleRowTitlePlaceholder: 'e.g. Activity',
|
|
493
|
+
matrixScaleLayout: 'Matrix layout',
|
|
494
|
+
matrixScaleLayout_options: 'Option matrix',
|
|
495
|
+
matrixScaleLayout_columns: 'Cell matrix',
|
|
496
|
+
matrixScaleLayout_field: 'One field per row',
|
|
497
|
+
matrixScaleRequired: 'Required for each row/cell',
|
|
498
|
+
matrixScaleSummary: '{type} · {layout} · {rows} rows',
|
|
499
|
+
matrixScaleEditorHint_options: 'Configure row labels and scale options; each row uses the same choice field.',
|
|
500
|
+
matrixScaleEditorHint_columns: 'Configure rows and columns; each cell uses the same field type (e.g. number, rate).',
|
|
501
|
+
matrixScaleEditorHint_field: 'Configure row labels only; each row shows one field without columns.',
|
|
502
|
+
matrixScaleRowsTitle: 'Rows',
|
|
503
|
+
matrixScaleRowsHint: 'Left is the row label; right is the data key',
|
|
504
|
+
matrixScaleRowLabelPlaceholder: 'e.g. Work / Study',
|
|
505
|
+
matrixScaleRowNamePlaceholder: 'e.g. work',
|
|
506
|
+
matrixScaleOptionsTitle: 'Scale options (columns)',
|
|
507
|
+
matrixScaleColumnsTitle: 'Columns',
|
|
508
|
+
matrixScaleColumnsHint: 'Left is the column label; right is the data key',
|
|
509
|
+
matrixScaleColumnLabelPlaceholder: 'e.g. Monday',
|
|
510
|
+
matrixScaleColumnNamePlaceholder: 'e.g. mon',
|
|
511
|
+
matrixScaleAddRow: 'Add row',
|
|
412
512
|
stepListTitle: 'Steps',
|
|
413
513
|
addStep: 'Add Step',
|
|
414
514
|
editStep: 'Edit Step',
|
|
@@ -432,6 +532,19 @@ const locale = {
|
|
|
432
532
|
FieldTypeSelect: 'Dropdown',
|
|
433
533
|
FieldTypeRadioGroup: 'Radio Group',
|
|
434
534
|
FieldTypeCheckboxGroup: 'Checkbox Group',
|
|
535
|
+
FieldTypeRadioGroupOther: 'Radio Group (with Other)',
|
|
536
|
+
FieldTypeCheckboxGroupOther: 'Checkbox Group (with Other)',
|
|
537
|
+
FieldTypeOtherOption: 'Other',
|
|
538
|
+
propChoiceModern: 'Modern style (indexed chips)',
|
|
539
|
+
propChoiceBlock: 'Block options (full-width stack)',
|
|
540
|
+
propChoiceIndexType: 'Index type',
|
|
541
|
+
propChoiceIndexTypeLetter: 'Letters A/B/C',
|
|
542
|
+
propChoiceIndexTypeNumber: 'Numbers 1/2/3',
|
|
543
|
+
propChoiceIndexTypeCheck: 'Checkmark (no index)',
|
|
544
|
+
propChoiceOtherLabel: '"Other" option label',
|
|
545
|
+
propChoiceOtherLabelHint: 'Default: Other',
|
|
546
|
+
propChoiceOtherPlaceholder: '"Other" textarea placeholder',
|
|
547
|
+
propChoiceOtherPlaceholderHint: 'Extra note when Other is selected',
|
|
435
548
|
FieldTypeSuperSelectList: 'Select List',
|
|
436
549
|
FieldTypeSuperSelectTableList: 'Table Select',
|
|
437
550
|
FieldTypeSuperSelectTree: 'Tree Select',
|
|
@@ -486,6 +599,25 @@ const locale = {
|
|
|
486
599
|
formActionsGapHint: 'Default: 16',
|
|
487
600
|
formActionsLayoutSection: 'Layout',
|
|
488
601
|
fieldBasicSection: 'Basic Settings',
|
|
602
|
+
fieldBasicSectionDesc: 'Field type, submit key and the text shown to respondents',
|
|
603
|
+
fieldOptionsDesc: 'Options respondents can pick and the value submitted for each',
|
|
604
|
+
fieldPropsSectionDesc: 'Placeholder, interaction and format of the input',
|
|
605
|
+
fieldDisplaySection: 'Display & layout',
|
|
606
|
+
fieldDisplaySectionDesc: 'How much space this field takes and whether it is visible',
|
|
607
|
+
blockBasicSection: 'Basics',
|
|
608
|
+
blockBasicSectionDesc: 'Module title and the data key used on submit',
|
|
609
|
+
blockLayoutSection: 'Display & layout',
|
|
610
|
+
blockLayoutSectionDesc: 'Columns, spacing and appearance of the module',
|
|
611
|
+
blockListRuleSection: 'Item rules',
|
|
612
|
+
blockListRuleSectionDesc: 'Add button text and item count limits',
|
|
613
|
+
choiceRuleSection: 'Selection rules',
|
|
614
|
+
choiceRuleSectionDesc: 'Single or multiple choice, and how many can be selected',
|
|
615
|
+
choiceDataSection: 'Data',
|
|
616
|
+
choiceDataSectionDesc: 'Whether the selected options are included in submitted data',
|
|
617
|
+
matrixScaleRuleDesc: 'Whether every row must be answered',
|
|
618
|
+
formActionsButtonsSection: 'Buttons',
|
|
619
|
+
formActionsButtonsSectionDesc: 'Choose which buttons appear at the bottom of the form and set their text',
|
|
620
|
+
formActionsLayoutSectionDesc: 'Alignment and spacing of the buttons',
|
|
489
621
|
optionLabelColumn: 'Option Label',
|
|
490
622
|
optionValueColumn: 'Option Value',
|
|
491
623
|
optionDescColumn: 'Option Description',
|
|
@@ -832,7 +964,7 @@ const createChoiceOption = (overrides = {}) => ({
|
|
|
832
964
|
...overrides
|
|
833
965
|
});
|
|
834
966
|
const createBlock = (kind, overrides = {}) => {
|
|
835
|
-
const needsName = ['list', 'tableList', 'editableList', 'multiField', 'object'].includes(kind);
|
|
967
|
+
const needsName = ['list', 'tableList', 'editableList', 'multiField', 'matrixScale', 'object'].includes(kind);
|
|
836
968
|
const base = {
|
|
837
969
|
id: createFieldId(),
|
|
838
970
|
kind,
|
|
@@ -848,7 +980,12 @@ const createBlock = (kind, overrides = {}) => {
|
|
|
848
980
|
addText: '',
|
|
849
981
|
maxLength: undefined,
|
|
850
982
|
minLength: undefined,
|
|
851
|
-
fieldType: 'Input',
|
|
983
|
+
fieldType: kind === 'matrixScale' ? 'RadioGroup' : 'Input',
|
|
984
|
+
layout: 'options',
|
|
985
|
+
rowTitle: '',
|
|
986
|
+
rule: '',
|
|
987
|
+
rows: [],
|
|
988
|
+
columns: [],
|
|
852
989
|
autoStep: true,
|
|
853
990
|
mode: 'single',
|
|
854
991
|
selectorName: '',
|
|
@@ -879,6 +1016,32 @@ const createBlock = (kind, overrides = {}) => {
|
|
|
879
1016
|
blocks: undefined,
|
|
880
1017
|
options: undefined,
|
|
881
1018
|
items: undefined,
|
|
1019
|
+
rows: undefined,
|
|
1020
|
+
columns: undefined,
|
|
1021
|
+
layout: undefined,
|
|
1022
|
+
rowTitle: undefined,
|
|
1023
|
+
rule: undefined,
|
|
1024
|
+
...overrides
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
1027
|
+
if (kind === 'matrixScale') {
|
|
1028
|
+
return {
|
|
1029
|
+
...base,
|
|
1030
|
+
list: undefined,
|
|
1031
|
+
itemBlocks: undefined,
|
|
1032
|
+
blocks: undefined,
|
|
1033
|
+
items: undefined,
|
|
1034
|
+
fieldType: 'RadioGroup',
|
|
1035
|
+
layout: 'options',
|
|
1036
|
+
rows: [{
|
|
1037
|
+
label: '',
|
|
1038
|
+
name: createDataKey('row')
|
|
1039
|
+
}],
|
|
1040
|
+
options: [{
|
|
1041
|
+
label: '',
|
|
1042
|
+
value: ''
|
|
1043
|
+
}],
|
|
1044
|
+
columns: undefined,
|
|
882
1045
|
...overrides
|
|
883
1046
|
};
|
|
884
1047
|
}
|
|
@@ -1013,6 +1176,63 @@ const normalizeBlock = (block, depth = 0) => {
|
|
|
1013
1176
|
normalized.itemBlocks = undefined;
|
|
1014
1177
|
normalized.blocks = undefined;
|
|
1015
1178
|
normalized.options = undefined;
|
|
1179
|
+
normalized.rows = undefined;
|
|
1180
|
+
normalized.columns = undefined;
|
|
1181
|
+
normalized.layout = undefined;
|
|
1182
|
+
normalized.rowTitle = undefined;
|
|
1183
|
+
normalized.rule = undefined;
|
|
1184
|
+
return normalized;
|
|
1185
|
+
}
|
|
1186
|
+
if (kind === 'matrixScale') {
|
|
1187
|
+
const layout = block.layout === 'columns' || block.layout === 'field' ? block.layout : 'options';
|
|
1188
|
+
normalized.list = undefined;
|
|
1189
|
+
normalized.items = undefined;
|
|
1190
|
+
normalized.itemBlocks = undefined;
|
|
1191
|
+
normalized.blocks = undefined;
|
|
1192
|
+
normalized.layout = layout;
|
|
1193
|
+
normalized.fieldType = block.fieldType || 'RadioGroup';
|
|
1194
|
+
normalized.rowTitle = block.rowTitle != null ? block.rowTitle : '';
|
|
1195
|
+
normalized.rule = block.rule != null ? block.rule : '';
|
|
1196
|
+
// 保留编辑器侧的 _key:MatrixScaleEditor 用它做行 key;normalize 若剥掉会触发 ensureKeys→onChange 死循环(React #185)
|
|
1197
|
+
const keepKey = item => item?._key ? {
|
|
1198
|
+
_key: item._key
|
|
1199
|
+
} : {};
|
|
1200
|
+
normalized.rows = Array.isArray(block.rows) ? block.rows.map(row => ({
|
|
1201
|
+
...keepKey(row),
|
|
1202
|
+
label: row?.label ?? '',
|
|
1203
|
+
name: String(row?.name || '').trim() || createDataKey('row')
|
|
1204
|
+
})).filter(row => String(row.label || '').trim() || String(row.name || '').trim()) : [];
|
|
1205
|
+
if (!normalized.rows.length) {
|
|
1206
|
+
normalized.rows = [{
|
|
1207
|
+
label: '',
|
|
1208
|
+
name: createDataKey('row')
|
|
1209
|
+
}];
|
|
1210
|
+
}
|
|
1211
|
+
if (layout === 'options') {
|
|
1212
|
+
normalized.options = Array.isArray(block.options) ? block.options.map(option => ({
|
|
1213
|
+
...option,
|
|
1214
|
+
...keepKey(option),
|
|
1215
|
+
label: option?.label ?? '',
|
|
1216
|
+
value: option?.value ?? ''
|
|
1217
|
+
})) : [];
|
|
1218
|
+
normalized.columns = undefined;
|
|
1219
|
+
} else if (layout === 'columns') {
|
|
1220
|
+
normalized.columns = Array.isArray(block.columns) ? block.columns.map(column => ({
|
|
1221
|
+
...keepKey(column),
|
|
1222
|
+
label: column?.label ?? column?.title ?? '',
|
|
1223
|
+
name: String(column?.name || '').trim() || createDataKey('col')
|
|
1224
|
+
})).filter(column => String(column.label || '').trim() || String(column.name || '').trim()) : [];
|
|
1225
|
+
if (!normalized.columns.length) {
|
|
1226
|
+
normalized.columns = [{
|
|
1227
|
+
label: '',
|
|
1228
|
+
name: createDataKey('col')
|
|
1229
|
+
}];
|
|
1230
|
+
}
|
|
1231
|
+
normalized.options = undefined;
|
|
1232
|
+
} else {
|
|
1233
|
+
normalized.options = undefined;
|
|
1234
|
+
normalized.columns = undefined;
|
|
1235
|
+
}
|
|
1016
1236
|
return normalized;
|
|
1017
1237
|
}
|
|
1018
1238
|
if (kind === 'choice') {
|
|
@@ -1110,16 +1330,23 @@ const blockHasLockedField = block => {
|
|
|
1110
1330
|
};
|
|
1111
1331
|
|
|
1112
1332
|
// 锁定项(locked 字段 / 含锁定字段的模块)位置固定:自身不能移动,其他项也不能与其交换位置
|
|
1333
|
+
/** 从 index 移到 targetIndex 时,区间内(含两端)任一固定项都会被挪位,因此不允许 */
|
|
1334
|
+
const canMoveItemTo = (list, index, targetIndex, isFixed = isFieldLocked) => {
|
|
1335
|
+
if (index < 0 || targetIndex < 0 || targetIndex >= list.length || index === targetIndex) {
|
|
1336
|
+
return false;
|
|
1337
|
+
}
|
|
1338
|
+
const [start, end] = index < targetIndex ? [index, targetIndex] : [targetIndex, index];
|
|
1339
|
+
return !list.slice(start, end + 1).some(item => isFixed(item));
|
|
1340
|
+
};
|
|
1341
|
+
|
|
1342
|
+
/** direction:'up' | 'down' 移动一位;数字为目标下标(拖拽排序) */
|
|
1113
1343
|
const moveItem = (list, id, direction, isFixed = isFieldLocked) => {
|
|
1114
1344
|
const index = list.findIndex(item => item.id === id);
|
|
1115
1345
|
if (index < 0) {
|
|
1116
1346
|
return list;
|
|
1117
1347
|
}
|
|
1118
|
-
const targetIndex = direction === 'up' ? index - 1 : index + 1;
|
|
1119
|
-
if (
|
|
1120
|
-
return list;
|
|
1121
|
-
}
|
|
1122
|
-
if (isFixed(list[index]) || isFixed(list[targetIndex])) {
|
|
1348
|
+
const targetIndex = typeof direction === 'number' ? direction : direction === 'up' ? index - 1 : index + 1;
|
|
1349
|
+
if (!canMoveItemTo(list, index, targetIndex, isFixed)) {
|
|
1123
1350
|
return list;
|
|
1124
1351
|
}
|
|
1125
1352
|
const next = [...list];
|
|
@@ -1152,7 +1379,7 @@ const collectFieldsFromBlocks = (blocks = [], acc = []) => {
|
|
|
1152
1379
|
});
|
|
1153
1380
|
return;
|
|
1154
1381
|
}
|
|
1155
|
-
if (block.kind !== 'multiField' && Array.isArray(block.list)) {
|
|
1382
|
+
if (block.kind !== 'multiField' && block.kind !== 'matrixScale' && Array.isArray(block.list)) {
|
|
1156
1383
|
acc.push(...block.list);
|
|
1157
1384
|
}
|
|
1158
1385
|
if (Array.isArray(block.itemBlocks)) {
|
|
@@ -1197,7 +1424,7 @@ const collectSchemaFields = (schema, {
|
|
|
1197
1424
|
});
|
|
1198
1425
|
return fields;
|
|
1199
1426
|
}
|
|
1200
|
-
if (block.kind !== 'multiField') {
|
|
1427
|
+
if (block.kind !== 'multiField' && block.kind !== 'matrixScale') {
|
|
1201
1428
|
fields.push(...(block.list || []));
|
|
1202
1429
|
}
|
|
1203
1430
|
return fields;
|
|
@@ -1245,7 +1472,7 @@ const collectBlockFieldNames = (blocks = [], {
|
|
|
1245
1472
|
});
|
|
1246
1473
|
return;
|
|
1247
1474
|
}
|
|
1248
|
-
if (block.kind !== 'multiField') {
|
|
1475
|
+
if (block.kind !== 'multiField' && block.kind !== 'matrixScale') {
|
|
1249
1476
|
(block.list || []).forEach(field => {
|
|
1250
1477
|
if (field?.name) {
|
|
1251
1478
|
names.push(prefix ? `${prefix}.${field.name}` : field.name);
|
|
@@ -1455,7 +1682,7 @@ const blockHasContent = block => {
|
|
|
1455
1682
|
if (block.kind === 'steps') {
|
|
1456
1683
|
return (block.items || []).some(step => (step.list || []).length > 0 || (step.blocks || []).some(blockHasContent) || step.title);
|
|
1457
1684
|
}
|
|
1458
|
-
if (block.kind === 'multiField') {
|
|
1685
|
+
if (block.kind === 'multiField' || block.kind === 'matrixScale') {
|
|
1459
1686
|
return !!block.name;
|
|
1460
1687
|
}
|
|
1461
1688
|
if (block.kind === 'choice') {
|
|
@@ -1508,6 +1735,12 @@ const BLOCK_KINDS = {
|
|
|
1508
1735
|
requiresName: true,
|
|
1509
1736
|
descriptionId: 'blockKindDesc_multiField'
|
|
1510
1737
|
},
|
|
1738
|
+
matrixScale: {
|
|
1739
|
+
labelId: 'blockKind_matrixScale',
|
|
1740
|
+
color: 'volcano',
|
|
1741
|
+
requiresName: true,
|
|
1742
|
+
descriptionId: 'blockKindDesc_matrixScale'
|
|
1743
|
+
},
|
|
1511
1744
|
object: {
|
|
1512
1745
|
labelId: 'blockKind_object',
|
|
1513
1746
|
color: 'orange',
|
|
@@ -1531,6 +1764,12 @@ const BLOCK_KINDS = {
|
|
|
1531
1764
|
|
|
1532
1765
|
/** editableList 添加按钮位置,与 @kne/form-info EditableList addPosition 一致 */
|
|
1533
1766
|
const ADD_POSITIONS = ['bottom', 'top', 'both'];
|
|
1767
|
+
|
|
1768
|
+
/** matrixScale 布局:options 选项组矩阵 / columns 单元格矩阵 / field 每行一个字段 */
|
|
1769
|
+
const MATRIX_LAYOUTS = ['options', 'columns', 'field'];
|
|
1770
|
+
|
|
1771
|
+
/** steps 导航样式:default 为 antd 完整步骤条;focus 突出当前步骤标题,其余收成序号 */
|
|
1772
|
+
const STEPS_STYLES = ['default', 'focus'];
|
|
1534
1773
|
const getBlockKindOptions = formatMessage => Object.entries(BLOCK_KINDS).map(([value, config]) => ({
|
|
1535
1774
|
label: typeof formatMessage === 'function' ? formatMessage({
|
|
1536
1775
|
id: config.labelId
|
|
@@ -1553,8 +1792,12 @@ const blockToFormValues = block => ({
|
|
|
1553
1792
|
maxLength: block.maxLength ?? null,
|
|
1554
1793
|
minLength: block.minLength ?? null,
|
|
1555
1794
|
addPosition: ADD_POSITIONS.includes(block.addPosition) ? block.addPosition : 'bottom',
|
|
1556
|
-
fieldType: block.fieldType || 'Input',
|
|
1795
|
+
fieldType: block.fieldType || (block.kind === 'matrixScale' ? 'RadioGroup' : 'Input'),
|
|
1796
|
+
layout: MATRIX_LAYOUTS.includes(block.layout) ? block.layout : 'options',
|
|
1797
|
+
rowTitle: block.rowTitle || '',
|
|
1798
|
+
required: typeof block.rule === 'string' && block.rule.split(' ').includes('REQ'),
|
|
1557
1799
|
autoStep: block.autoStep !== false,
|
|
1800
|
+
stepsStyle: STEPS_STYLES.includes(block.stepsStyle) ? block.stepsStyle : 'default',
|
|
1558
1801
|
mode: block.mode === 'multiple' ? 'multiple' : 'single',
|
|
1559
1802
|
selectorName: block.selectorName || '',
|
|
1560
1803
|
selectorInData: block.selectorInData !== false
|
|
@@ -1578,12 +1821,45 @@ const formValuesToBlock = (values, existingBlock = {}) => {
|
|
|
1578
1821
|
maxLength: values.maxLength ?? undefined,
|
|
1579
1822
|
minLength: values.minLength ?? undefined,
|
|
1580
1823
|
addPosition: kind === 'editableList' && ADD_POSITIONS.includes(values.addPosition) && values.addPosition !== 'bottom' ? values.addPosition : undefined,
|
|
1581
|
-
fieldType: values.fieldType || 'Input',
|
|
1824
|
+
fieldType: values.fieldType || (kind === 'matrixScale' ? 'RadioGroup' : 'Input'),
|
|
1582
1825
|
autoStep: values.autoStep !== false,
|
|
1826
|
+
stepsStyle: kind === 'steps' && STEPS_STYLES.includes(values.stepsStyle) && values.stepsStyle !== 'default' ? values.stepsStyle : undefined,
|
|
1583
1827
|
mode,
|
|
1584
1828
|
selectorName: values.selectorName || '',
|
|
1585
1829
|
selectorInData: values.selectorInData !== false
|
|
1586
1830
|
};
|
|
1831
|
+
if (kind === 'matrixScale') {
|
|
1832
|
+
const layout = MATRIX_LAYOUTS.includes(values.layout) ? values.layout : 'options';
|
|
1833
|
+
next.layout = layout;
|
|
1834
|
+
next.rowTitle = values.rowTitle || undefined;
|
|
1835
|
+
next.rule = values.required ? 'REQ' : undefined;
|
|
1836
|
+
if (layout === 'options') {
|
|
1837
|
+
next.columns = undefined;
|
|
1838
|
+
if (!Array.isArray(next.options) || !next.options.length) {
|
|
1839
|
+
next.options = [{
|
|
1840
|
+
label: '',
|
|
1841
|
+
value: ''
|
|
1842
|
+
}];
|
|
1843
|
+
}
|
|
1844
|
+
} else if (layout === 'columns') {
|
|
1845
|
+
next.options = undefined;
|
|
1846
|
+
if (!Array.isArray(next.columns) || !next.columns.length) {
|
|
1847
|
+
next.columns = [{
|
|
1848
|
+
label: '',
|
|
1849
|
+
name: createDataKey('col')
|
|
1850
|
+
}];
|
|
1851
|
+
}
|
|
1852
|
+
} else {
|
|
1853
|
+
next.options = undefined;
|
|
1854
|
+
next.columns = undefined;
|
|
1855
|
+
}
|
|
1856
|
+
if (!Array.isArray(next.rows) || !next.rows.length) {
|
|
1857
|
+
next.rows = [{
|
|
1858
|
+
label: '',
|
|
1859
|
+
name: createDataKey('row')
|
|
1860
|
+
}];
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1587
1863
|
if (kind === 'choice' && mode !== 'multiple') {
|
|
1588
1864
|
next.minLength = undefined;
|
|
1589
1865
|
next.maxLength = undefined;
|
|
@@ -1853,14 +2129,25 @@ const NO_VALUE_OPERATORS = ['empty', 'notEmpty'];
|
|
|
1853
2129
|
const ALLOWED_REGEX_FLAGS = ['i', 'm', 's', 'u'];
|
|
1854
2130
|
|
|
1855
2131
|
// 列表类模块内的字段会重复出现,单个 name 定位不到具体条目,不参与条件
|
|
1856
|
-
const LIST_BLOCK_KINDS = ['list', 'tableList', 'editableList', 'multiField'];
|
|
2132
|
+
const LIST_BLOCK_KINDS = ['list', 'tableList', 'editableList', 'multiField', 'matrixScale'];
|
|
1857
2133
|
const getByPath$2 = (data, path) => {
|
|
1858
2134
|
if (data == null || path == null || path === '') {
|
|
1859
2135
|
return undefined;
|
|
1860
2136
|
}
|
|
1861
2137
|
return String(path).split('.').reduce((current, key) => current == null ? undefined : current[key], data);
|
|
1862
2138
|
};
|
|
1863
|
-
|
|
2139
|
+
|
|
2140
|
+
/** RadioGroupOther / CheckboxGroupOther 提交值为 { value, other? },比较前先取 value */
|
|
2141
|
+
const unwrapChoiceOtherValue = value => {
|
|
2142
|
+
if (value && typeof value === 'object' && !Array.isArray(value) && Object.prototype.hasOwnProperty.call(value, 'other') && Object.prototype.hasOwnProperty.call(value, 'value')) {
|
|
2143
|
+
return value.value;
|
|
2144
|
+
}
|
|
2145
|
+
return value;
|
|
2146
|
+
};
|
|
2147
|
+
const isEmptyValue$1 = value => {
|
|
2148
|
+
const next = unwrapChoiceOtherValue(value);
|
|
2149
|
+
return next === undefined || next === null || next === '' || Array.isArray(next) && next.length === 0;
|
|
2150
|
+
};
|
|
1864
2151
|
|
|
1865
2152
|
// SuperSelect 等字段的值是 { label, value } 对象,比较时统一取 value
|
|
1866
2153
|
const toComparable = item => {
|
|
@@ -1907,7 +2194,7 @@ const evaluateCondition = (condition, formData) => {
|
|
|
1907
2194
|
if (!condition?.field || !CONDITION_OPERATORS.includes(condition.operator)) {
|
|
1908
2195
|
return null;
|
|
1909
2196
|
}
|
|
1910
|
-
const actual = getByPath$2(formData, condition.field);
|
|
2197
|
+
const actual = unwrapChoiceOtherValue(getByPath$2(formData, condition.field));
|
|
1911
2198
|
const expected = condition.value;
|
|
1912
2199
|
switch (condition.operator) {
|
|
1913
2200
|
case 'empty':
|
|
@@ -2187,7 +2474,7 @@ const renameConditionReferences = (schema, oldPath, newPath) => {
|
|
|
2187
2474
|
*/
|
|
2188
2475
|
const getConditionValueKind = (field, definition) => {
|
|
2189
2476
|
const props = field?.props || {};
|
|
2190
|
-
if (field?.type === 'CheckboxGroup' || definition?.isSuperSelect || field?.type === 'Select' && (props.mode === 'multiple' || props.mode === 'tags')) {
|
|
2477
|
+
if (field?.type === 'CheckboxGroup' || field?.type === 'CheckboxGroupOther' || definition?.isSuperSelect || field?.type === 'Select' && (props.mode === 'multiple' || props.mode === 'tags')) {
|
|
2191
2478
|
return 'multiOptions';
|
|
2192
2479
|
}
|
|
2193
2480
|
if (definition?.hasOptions) {
|
|
@@ -2262,6 +2549,14 @@ const formatVisibleWhen = (visibleWhen, {
|
|
|
2262
2549
|
if (option) {
|
|
2263
2550
|
return resolveText(option.label);
|
|
2264
2551
|
}
|
|
2552
|
+
if (trigger?.type === 'RadioGroupOther' || trigger?.type === 'CheckboxGroupOther') {
|
|
2553
|
+
const otherValue = trigger?.props?.otherOption?.value != null && String(trigger.props.otherOption.value).trim() ? String(trigger.props.otherOption.value).trim() : 'other';
|
|
2554
|
+
if (sameValue(otherValue, value)) {
|
|
2555
|
+
return resolveText(trigger?.props?.otherOption?.label) || formatMessage({
|
|
2556
|
+
id: 'FieldTypeOtherOption'
|
|
2557
|
+
});
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2265
2560
|
if (typeof value === 'boolean') {
|
|
2266
2561
|
return formatMessage({
|
|
2267
2562
|
id: value ? 'conditionValueTrue' : 'conditionValueFalse'
|
|
@@ -2294,7 +2589,7 @@ const FIELD_GROUPS = [{
|
|
|
2294
2589
|
types: ['Input', 'TextArea', 'InputNumber', 'Switch', 'Checkbox', 'DatePicker']
|
|
2295
2590
|
}, {
|
|
2296
2591
|
labelId: 'FieldGroupSelect',
|
|
2297
|
-
types: ['Select', 'RadioGroup', 'CheckboxGroup']
|
|
2592
|
+
types: ['Select', 'RadioGroup', 'CheckboxGroup', 'RadioGroupOther', 'CheckboxGroupOther']
|
|
2298
2593
|
}, {
|
|
2299
2594
|
labelId: 'FieldGroupAdvancedSelect',
|
|
2300
2595
|
types: ['SuperSelectList', 'SuperSelectTableList', 'SuperSelectTree', 'SuperSelectCascader']
|
|
@@ -2451,6 +2746,95 @@ defineField('CheckboxGroup', {
|
|
|
2451
2746
|
};
|
|
2452
2747
|
}
|
|
2453
2748
|
});
|
|
2749
|
+
const resolveOtherOptionValue = field => {
|
|
2750
|
+
const raw = field?.props?.otherOption?.value;
|
|
2751
|
+
return raw != null && String(raw).trim() ? String(raw).trim() : 'other';
|
|
2752
|
+
};
|
|
2753
|
+
const choiceOtherEnums = field => {
|
|
2754
|
+
const enums = optionEnumValues(field) || [];
|
|
2755
|
+
const otherValue = resolveOtherOptionValue(field);
|
|
2756
|
+
return enums.includes(otherValue) ? enums : [...enums, otherValue];
|
|
2757
|
+
};
|
|
2758
|
+
const choiceOtherValueSchema = (field, multiple) => {
|
|
2759
|
+
const enums = choiceOtherEnums(field);
|
|
2760
|
+
const selected = multiple ? {
|
|
2761
|
+
type: 'array',
|
|
2762
|
+
items: {
|
|
2763
|
+
type: 'string',
|
|
2764
|
+
enum: enums
|
|
2765
|
+
}
|
|
2766
|
+
} : {
|
|
2767
|
+
type: 'string',
|
|
2768
|
+
enum: enums
|
|
2769
|
+
};
|
|
2770
|
+
return {
|
|
2771
|
+
type: 'object',
|
|
2772
|
+
properties: {
|
|
2773
|
+
value: selected,
|
|
2774
|
+
other: {
|
|
2775
|
+
type: 'string'
|
|
2776
|
+
}
|
|
2777
|
+
}
|
|
2778
|
+
};
|
|
2779
|
+
};
|
|
2780
|
+
const formatChoiceOtherDisplay = (value, field, {
|
|
2781
|
+
formatMessage
|
|
2782
|
+
} = {}) => {
|
|
2783
|
+
if (value == null || typeof value !== 'object') {
|
|
2784
|
+
return '';
|
|
2785
|
+
}
|
|
2786
|
+
const options = field?.props?.options;
|
|
2787
|
+
const otherValue = resolveOtherOptionValue(field);
|
|
2788
|
+
const otherFallback = resolveLocaleText(field?.props?.otherOption?.label) || formatMessage?.({
|
|
2789
|
+
id: 'FieldTypeOtherOption'
|
|
2790
|
+
}) || '其他';
|
|
2791
|
+
const mapOne = item => {
|
|
2792
|
+
if (item === otherValue) {
|
|
2793
|
+
return otherFallback;
|
|
2794
|
+
}
|
|
2795
|
+
if (!Array.isArray(options) || !options.length) {
|
|
2796
|
+
return item == null ? '' : String(item);
|
|
2797
|
+
}
|
|
2798
|
+
const match = options.find(opt => opt && opt.value === item);
|
|
2799
|
+
if (match?.label != null) {
|
|
2800
|
+
return resolveLocaleText(match.label) || String(match.label);
|
|
2801
|
+
}
|
|
2802
|
+
return item == null ? '' : String(item);
|
|
2803
|
+
};
|
|
2804
|
+
const selected = Array.isArray(value.value) ? value.value.map(mapOne).filter(Boolean).join('、') : mapOne(value.value);
|
|
2805
|
+
const otherText = value.other != null && String(value.other).trim() ? String(value.other).trim() : '';
|
|
2806
|
+
if (selected && otherText) {
|
|
2807
|
+
return `${selected}(${otherFallback}: ${otherText})`;
|
|
2808
|
+
}
|
|
2809
|
+
if (otherText) {
|
|
2810
|
+
return `${otherFallback}: ${otherText}`;
|
|
2811
|
+
}
|
|
2812
|
+
return selected;
|
|
2813
|
+
};
|
|
2814
|
+
defineField('RadioGroupOther', {
|
|
2815
|
+
labelId: 'FieldTypeRadioGroupOther',
|
|
2816
|
+
component: reactFormAntd.RadioGroupOther,
|
|
2817
|
+
defaultProps: {
|
|
2818
|
+
options: [],
|
|
2819
|
+
inline: true
|
|
2820
|
+
},
|
|
2821
|
+
hasOptions: true,
|
|
2822
|
+
hasFieldProps: true,
|
|
2823
|
+
valueSchema: field => choiceOtherValueSchema(field, false),
|
|
2824
|
+
formatDisplayValue: formatChoiceOtherDisplay
|
|
2825
|
+
});
|
|
2826
|
+
defineField('CheckboxGroupOther', {
|
|
2827
|
+
labelId: 'FieldTypeCheckboxGroupOther',
|
|
2828
|
+
component: reactFormAntd.CheckboxGroupOther,
|
|
2829
|
+
defaultProps: {
|
|
2830
|
+
options: [],
|
|
2831
|
+
inline: true
|
|
2832
|
+
},
|
|
2833
|
+
hasOptions: true,
|
|
2834
|
+
hasFieldProps: true,
|
|
2835
|
+
valueSchema: field => choiceOtherValueSchema(field, true),
|
|
2836
|
+
formatDisplayValue: formatChoiceOtherDisplay
|
|
2837
|
+
});
|
|
2454
2838
|
defineField('SuperSelectList', {
|
|
2455
2839
|
labelId: 'FieldTypeSuperSelectList',
|
|
2456
2840
|
component: SuperSelectList,
|
|
@@ -2959,8 +3343,15 @@ const pickFieldProps = (field, definition) => {
|
|
|
2959
3343
|
};
|
|
2960
3344
|
case 'RadioGroup':
|
|
2961
3345
|
case 'CheckboxGroup':
|
|
3346
|
+
case 'RadioGroupOther':
|
|
3347
|
+
case 'CheckboxGroupOther':
|
|
2962
3348
|
return {
|
|
2963
|
-
inline: props.inline !== false
|
|
3349
|
+
inline: props.inline !== false,
|
|
3350
|
+
modern: !!props.modern,
|
|
3351
|
+
block: !!props.block,
|
|
3352
|
+
indexType: props.indexType === 'number' || props.indexType === 'check' ? props.indexType : 'letter',
|
|
3353
|
+
otherLabel: props.otherOption?.label || '',
|
|
3354
|
+
otherPlaceholder: props.otherProps?.placeholder || ''
|
|
2964
3355
|
};
|
|
2965
3356
|
default:
|
|
2966
3357
|
if (definition?.propsSchema?.length) {
|
|
@@ -3034,8 +3425,52 @@ const applyFieldProps = (props, values, definition) => {
|
|
|
3034
3425
|
break;
|
|
3035
3426
|
case 'RadioGroup':
|
|
3036
3427
|
case 'CheckboxGroup':
|
|
3428
|
+
case 'RadioGroupOther':
|
|
3429
|
+
case 'CheckboxGroupOther':
|
|
3037
3430
|
// 始终落盘布尔值,避免 Checkbox 未勾选时字段缺失被当成默认横向
|
|
3038
3431
|
props.inline = values.inline !== false;
|
|
3432
|
+
props.modern = !!values.modern;
|
|
3433
|
+
props.block = !!values.block;
|
|
3434
|
+
if (values.modern && (values.indexType === 'number' || values.indexType === 'check')) {
|
|
3435
|
+
props.indexType = values.indexType;
|
|
3436
|
+
} else {
|
|
3437
|
+
delete props.indexType;
|
|
3438
|
+
}
|
|
3439
|
+
if (!props.modern) {
|
|
3440
|
+
delete props.indexType;
|
|
3441
|
+
}
|
|
3442
|
+
if (type === 'RadioGroupOther' || type === 'CheckboxGroupOther') {
|
|
3443
|
+
if (hasLocaleText(values.otherLabel)) {
|
|
3444
|
+
props.otherOption = {
|
|
3445
|
+
...(props.otherOption && typeof props.otherOption === 'object' ? props.otherOption : {}),
|
|
3446
|
+
label: trimLocaleText(values.otherLabel),
|
|
3447
|
+
value: props.otherOption?.value || 'other'
|
|
3448
|
+
};
|
|
3449
|
+
} else {
|
|
3450
|
+
delete props.otherOption;
|
|
3451
|
+
}
|
|
3452
|
+
if (hasLocaleText(values.otherPlaceholder)) {
|
|
3453
|
+
props.otherProps = {
|
|
3454
|
+
...(props.otherProps && typeof props.otherProps === 'object' ? props.otherProps : {}),
|
|
3455
|
+
placeholder: trimLocaleText(values.otherPlaceholder)
|
|
3456
|
+
};
|
|
3457
|
+
} else if (props.otherProps && typeof props.otherProps === 'object') {
|
|
3458
|
+
const nextOtherProps = {
|
|
3459
|
+
...props.otherProps
|
|
3460
|
+
};
|
|
3461
|
+
delete nextOtherProps.placeholder;
|
|
3462
|
+
if (Object.keys(nextOtherProps).length) {
|
|
3463
|
+
props.otherProps = nextOtherProps;
|
|
3464
|
+
} else {
|
|
3465
|
+
delete props.otherProps;
|
|
3466
|
+
}
|
|
3467
|
+
} else {
|
|
3468
|
+
delete props.otherProps;
|
|
3469
|
+
}
|
|
3470
|
+
} else {
|
|
3471
|
+
delete props.otherOption;
|
|
3472
|
+
delete props.otherProps;
|
|
3473
|
+
}
|
|
3039
3474
|
break;
|
|
3040
3475
|
default:
|
|
3041
3476
|
if (definition?.propsSchema?.length) {
|
|
@@ -3120,6 +3555,78 @@ const formValuesToField = (values, existingField = {}) => {
|
|
|
3120
3555
|
};
|
|
3121
3556
|
};
|
|
3122
3557
|
|
|
3558
|
+
const orderActions = (isMobile, actions) => {
|
|
3559
|
+
if (!isMobile) {
|
|
3560
|
+
return actions;
|
|
3561
|
+
}
|
|
3562
|
+
const primary = actions.filter(item => item && (item.key === 'edit' || item.key === 'setting'));
|
|
3563
|
+
return [...primary, ...actions.filter(item => !primary.includes(item))];
|
|
3564
|
+
};
|
|
3565
|
+
|
|
3566
|
+
/**
|
|
3567
|
+
* 行操作:桌面端为悬停显示的图标组;移动端全部收进 ButtonGroup 的「⋯」,点击弹出底部动作面板。
|
|
3568
|
+
* actions: [{ key, label, icon, danger, disabled, onClick }],falsy 项忽略
|
|
3569
|
+
*/
|
|
3570
|
+
const RowActions = ({
|
|
3571
|
+
isMobile,
|
|
3572
|
+
actions,
|
|
3573
|
+
moreTitle,
|
|
3574
|
+
prefix
|
|
3575
|
+
}) => {
|
|
3576
|
+
const items = (actions || []).filter(Boolean);
|
|
3577
|
+
if (isMobile) {
|
|
3578
|
+
if (!items.length) {
|
|
3579
|
+
return null;
|
|
3580
|
+
}
|
|
3581
|
+
// 动作面板经 portal 渲染,React 事件仍会冒泡到行上的「点击编辑」,需在外层拦截
|
|
3582
|
+
return /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
3583
|
+
className: style['more-btn'],
|
|
3584
|
+
title: moreTitle,
|
|
3585
|
+
onClick: e => e.stopPropagation(),
|
|
3586
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ButtonGroup__default["default"], {
|
|
3587
|
+
showLength: 0,
|
|
3588
|
+
moreType: "link",
|
|
3589
|
+
list: items.map(({
|
|
3590
|
+
key,
|
|
3591
|
+
label,
|
|
3592
|
+
icon,
|
|
3593
|
+
danger,
|
|
3594
|
+
disabled,
|
|
3595
|
+
onClick
|
|
3596
|
+
}) => ({
|
|
3597
|
+
key,
|
|
3598
|
+
children: label,
|
|
3599
|
+
icon,
|
|
3600
|
+
danger,
|
|
3601
|
+
disabled,
|
|
3602
|
+
onClick
|
|
3603
|
+
}))
|
|
3604
|
+
})
|
|
3605
|
+
});
|
|
3606
|
+
}
|
|
3607
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3608
|
+
className: style['action-group'],
|
|
3609
|
+
children: [prefix, items.map(({
|
|
3610
|
+
key,
|
|
3611
|
+
label,
|
|
3612
|
+
icon,
|
|
3613
|
+
danger,
|
|
3614
|
+
disabled,
|
|
3615
|
+
onClick
|
|
3616
|
+
}) => /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
3617
|
+
type: "text",
|
|
3618
|
+
size: "small",
|
|
3619
|
+
title: label,
|
|
3620
|
+
danger: danger,
|
|
3621
|
+
disabled: disabled,
|
|
3622
|
+
icon: icon,
|
|
3623
|
+
className: style['action-btn'],
|
|
3624
|
+
onClick: onClick
|
|
3625
|
+
}, key))]
|
|
3626
|
+
});
|
|
3627
|
+
};
|
|
3628
|
+
var RowActions$1 = RowActions;
|
|
3629
|
+
|
|
3123
3630
|
const {
|
|
3124
3631
|
useOnChange: useOnChange$1
|
|
3125
3632
|
} = reactFormAntd.hooks;
|
|
@@ -3229,6 +3736,8 @@ const TYPE_TAG_COLORS = {
|
|
|
3229
3736
|
Select: 'geekblue',
|
|
3230
3737
|
RadioGroup: 'purple',
|
|
3231
3738
|
CheckboxGroup: 'purple',
|
|
3739
|
+
RadioGroupOther: 'purple',
|
|
3740
|
+
CheckboxGroupOther: 'purple',
|
|
3232
3741
|
SuperSelectList: 'gold',
|
|
3233
3742
|
SuperSelectTableList: 'gold',
|
|
3234
3743
|
SuperSelectTree: 'gold',
|
|
@@ -3247,6 +3756,8 @@ const TYPE_TAG_ICONS = {
|
|
|
3247
3756
|
Select: icons.DownSquareOutlined,
|
|
3248
3757
|
RadioGroup: icons.CheckCircleOutlined,
|
|
3249
3758
|
CheckboxGroup: icons.CheckSquareOutlined,
|
|
3759
|
+
RadioGroupOther: icons.CheckCircleOutlined,
|
|
3760
|
+
CheckboxGroupOther: icons.CheckSquareOutlined,
|
|
3250
3761
|
SuperSelectList: icons.AppstoreOutlined,
|
|
3251
3762
|
SuperSelectTableList: icons.AppstoreOutlined,
|
|
3252
3763
|
SuperSelectTree: icons.AppstoreOutlined,
|
|
@@ -3268,7 +3779,11 @@ const FieldRow = ({
|
|
|
3268
3779
|
onMove,
|
|
3269
3780
|
prevLocked,
|
|
3270
3781
|
nextLocked,
|
|
3271
|
-
conditionContext
|
|
3782
|
+
conditionContext,
|
|
3783
|
+
dragHandleProps,
|
|
3784
|
+
isMobile,
|
|
3785
|
+
className,
|
|
3786
|
+
...rest
|
|
3272
3787
|
}) => {
|
|
3273
3788
|
const {
|
|
3274
3789
|
formatMessage,
|
|
@@ -3280,14 +3795,34 @@ const FieldRow = ({
|
|
|
3280
3795
|
const conditionInvalid = conditional && conditionContext && hasInvalidCondition(field, conditionContext.triggerNames);
|
|
3281
3796
|
const TypeIcon = getFieldTypeIcon(field.type);
|
|
3282
3797
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3798
|
+
...rest,
|
|
3799
|
+
className: `${style['field-row']} ${className || ''}`.trim(),
|
|
3800
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
3801
|
+
className: `${style['field-row-index']} ${dragHandleProps ? style['has-handle'] : ''}`.trim(),
|
|
3802
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
3803
|
+
className: style['field-row-index-num'],
|
|
3804
|
+
children: index + 1
|
|
3805
|
+
}), dragHandleProps ? /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
3806
|
+
className: style['drag-handle'],
|
|
3807
|
+
title: formatMessage({
|
|
3808
|
+
id: 'dragSort'
|
|
3809
|
+
}),
|
|
3810
|
+
...dragHandleProps,
|
|
3811
|
+
children: /*#__PURE__*/jsxRuntime.jsx(icons.HolderOutlined, {})
|
|
3812
|
+
}) : null]
|
|
3287
3813
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3288
3814
|
className: style['field-row-main'],
|
|
3815
|
+
...(isMobile && !field.locked ? {
|
|
3816
|
+
role: 'button',
|
|
3817
|
+
tabIndex: 0,
|
|
3818
|
+
onClick: () => onEdit(field),
|
|
3819
|
+
onKeyDown: e => {
|
|
3820
|
+
if (e.key === 'Enter') {
|
|
3821
|
+
onEdit(field);
|
|
3822
|
+
}
|
|
3823
|
+
}
|
|
3824
|
+
} : null),
|
|
3289
3825
|
children: [/*#__PURE__*/jsxRuntime.jsx(Text$5, {
|
|
3290
|
-
strong: true,
|
|
3291
3826
|
className: style['field-row-label'],
|
|
3292
3827
|
children: resolveLocaleText(field.label, locale, languages) || formatMessage({
|
|
3293
3828
|
id: 'untitledField'
|
|
@@ -3350,73 +3885,370 @@ const FieldRow = ({
|
|
|
3350
3885
|
})
|
|
3351
3886
|
}) : null]
|
|
3352
3887
|
})]
|
|
3353
|
-
}), field.locked ? null : /*#__PURE__*/jsxRuntime.
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3888
|
+
}), field.locked ? null : /*#__PURE__*/jsxRuntime.jsx(RowActions$1, {
|
|
3889
|
+
isMobile: isMobile,
|
|
3890
|
+
moreTitle: formatMessage({
|
|
3891
|
+
id: 'moreActions'
|
|
3892
|
+
}),
|
|
3893
|
+
actions: orderActions(isMobile, [{
|
|
3894
|
+
key: 'up',
|
|
3895
|
+
label: formatMessage({
|
|
3360
3896
|
id: 'moveUp'
|
|
3361
3897
|
}),
|
|
3362
3898
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowUpOutlined, {}),
|
|
3363
3899
|
disabled: index === 0 || prevLocked,
|
|
3364
3900
|
onClick: () => onMove(field.id, 'up')
|
|
3365
|
-
}
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
className: style['action-btn'],
|
|
3369
|
-
title: formatMessage({
|
|
3901
|
+
}, {
|
|
3902
|
+
key: 'down',
|
|
3903
|
+
label: formatMessage({
|
|
3370
3904
|
id: 'moveDown'
|
|
3371
3905
|
}),
|
|
3372
3906
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowDownOutlined, {}),
|
|
3373
3907
|
disabled: index === total - 1 || nextLocked,
|
|
3374
3908
|
onClick: () => onMove(field.id, 'down')
|
|
3375
|
-
}
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
className: style['action-btn'],
|
|
3379
|
-
title: formatMessage({
|
|
3909
|
+
}, {
|
|
3910
|
+
key: 'edit',
|
|
3911
|
+
label: formatMessage({
|
|
3380
3912
|
id: 'editField'
|
|
3381
3913
|
}),
|
|
3382
3914
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.EditOutlined, {}),
|
|
3383
3915
|
onClick: () => onEdit(field)
|
|
3384
|
-
}
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
danger: true,
|
|
3388
|
-
className: style['action-btn'],
|
|
3389
|
-
title: formatMessage({
|
|
3916
|
+
}, {
|
|
3917
|
+
key: 'delete',
|
|
3918
|
+
label: formatMessage({
|
|
3390
3919
|
id: 'deleteField'
|
|
3391
3920
|
}),
|
|
3392
3921
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.DeleteOutlined, {}),
|
|
3922
|
+
danger: true,
|
|
3393
3923
|
onClick: () => onDelete(field.id)
|
|
3394
|
-
})
|
|
3924
|
+
}])
|
|
3395
3925
|
})]
|
|
3396
3926
|
});
|
|
3397
3927
|
};
|
|
3398
3928
|
|
|
3399
3929
|
const {
|
|
3400
|
-
Text: Text$4
|
|
3930
|
+
Text: Text$4,
|
|
3931
|
+
Title
|
|
3401
3932
|
} = antd.Typography;
|
|
3402
|
-
const
|
|
3933
|
+
const createRowKey = () => createDataKey('mrow');
|
|
3934
|
+
const createColKey = () => createDataKey('mcol');
|
|
3935
|
+
const createOptKey = () => createDataKey('mopt');
|
|
3936
|
+
const createEmptyMatrixRow = () => ({
|
|
3937
|
+
_key: createRowKey(),
|
|
3938
|
+
label: '',
|
|
3939
|
+
name: createDataKey('row')
|
|
3940
|
+
});
|
|
3941
|
+
const createEmptyMatrixColumn = () => ({
|
|
3942
|
+
_key: createColKey(),
|
|
3943
|
+
label: '',
|
|
3944
|
+
name: createDataKey('col')
|
|
3945
|
+
});
|
|
3946
|
+
const createEmptyMatrixOption = () => ({
|
|
3947
|
+
_key: createOptKey(),
|
|
3948
|
+
label: '',
|
|
3949
|
+
value: ''
|
|
3950
|
+
});
|
|
3951
|
+
const ensureKeys = (list = [], createKey) => list.map(item => ({
|
|
3952
|
+
...item,
|
|
3953
|
+
_key: item._key || createKey()
|
|
3954
|
+
}));
|
|
3955
|
+
const hasMissingKey = (list = []) => list.some(item => !item?._key);
|
|
3956
|
+
|
|
3957
|
+
/** 勿在此用 FormInfo:模块列不在 Form 内,FormInfo→FieldList 会读不到 openApiRef */
|
|
3958
|
+
const EditorSection = ({
|
|
3959
|
+
title,
|
|
3960
|
+
tip,
|
|
3403
3961
|
children
|
|
3404
|
-
}) => /*#__PURE__*/jsxRuntime.
|
|
3405
|
-
className: style['
|
|
3406
|
-
children:
|
|
3962
|
+
}) => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3963
|
+
className: style['columns-editor'],
|
|
3964
|
+
children: [title ? /*#__PURE__*/jsxRuntime.jsx(Title, {
|
|
3965
|
+
level: 5,
|
|
3966
|
+
className: style['matrix-scale-editor-title'],
|
|
3967
|
+
children: title
|
|
3968
|
+
}) : null, children, tip ? /*#__PURE__*/jsxRuntime.jsx(antd.Space, {
|
|
3969
|
+
size: 4,
|
|
3970
|
+
className: style['options-tip'],
|
|
3971
|
+
children: tip
|
|
3972
|
+
}) : null]
|
|
3407
3973
|
});
|
|
3408
|
-
const
|
|
3974
|
+
const LabelNameRows = ({
|
|
3409
3975
|
title,
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3976
|
+
tip,
|
|
3977
|
+
list,
|
|
3978
|
+
onChange,
|
|
3979
|
+
createEmpty,
|
|
3980
|
+
createKey,
|
|
3981
|
+
labelPlaceholder,
|
|
3982
|
+
namePlaceholder,
|
|
3983
|
+
addText
|
|
3984
|
+
}) => {
|
|
3985
|
+
// 只展示已落盘数据;缺 key / 空列表由 effect 补齐,避免每次 render 新建临时项导致丢焦点
|
|
3986
|
+
react.useEffect(() => {
|
|
3987
|
+
if (!list.length) {
|
|
3988
|
+
onChange([createEmpty()]);
|
|
3989
|
+
return;
|
|
3990
|
+
}
|
|
3991
|
+
if (hasMissingKey(list)) {
|
|
3992
|
+
onChange(ensureKeys(list, createKey));
|
|
3993
|
+
}
|
|
3994
|
+
}, [list, onChange, createEmpty, createKey]);
|
|
3995
|
+
const rows = list.length ? list : [];
|
|
3996
|
+
const updateItem = (index, patch) => {
|
|
3997
|
+
onChange(rows.map((item, itemIndex) => itemIndex === index ? {
|
|
3998
|
+
...item,
|
|
3999
|
+
...patch
|
|
4000
|
+
} : item));
|
|
4001
|
+
};
|
|
4002
|
+
return /*#__PURE__*/jsxRuntime.jsxs(EditorSection, {
|
|
4003
|
+
title: title,
|
|
4004
|
+
tip: tip,
|
|
4005
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4006
|
+
className: style['options-list'],
|
|
4007
|
+
children: rows.map((item, index) => /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
|
|
4008
|
+
gap: 8,
|
|
4009
|
+
align: "start",
|
|
4010
|
+
className: style['options-row'],
|
|
4011
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Input, {
|
|
4012
|
+
value: item.label || '',
|
|
4013
|
+
placeholder: labelPlaceholder,
|
|
4014
|
+
onChange: e => updateItem(index, {
|
|
4015
|
+
label: e.target.value
|
|
4016
|
+
})
|
|
4017
|
+
}), /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
|
|
4018
|
+
value: item.name || '',
|
|
4019
|
+
placeholder: namePlaceholder,
|
|
4020
|
+
onChange: e => updateItem(index, {
|
|
4021
|
+
name: e.target.value
|
|
4022
|
+
})
|
|
4023
|
+
}), /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
4024
|
+
type: "text",
|
|
4025
|
+
danger: true,
|
|
4026
|
+
className: style['icon-square-btn-sm'],
|
|
4027
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(icons.DeleteOutlined, {}),
|
|
4028
|
+
disabled: rows.length <= 1,
|
|
4029
|
+
onClick: () => {
|
|
4030
|
+
const next = rows.filter((_, i) => i !== index);
|
|
4031
|
+
onChange(next.length ? next : [createEmpty()]);
|
|
4032
|
+
}
|
|
4033
|
+
})]
|
|
4034
|
+
}, item._key || `row-${index}`))
|
|
4035
|
+
}), /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
4036
|
+
type: "dashed",
|
|
4037
|
+
block: true,
|
|
4038
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(icons.PlusOutlined, {}),
|
|
4039
|
+
onClick: () => onChange([...rows, createEmpty()]),
|
|
4040
|
+
children: addText
|
|
4041
|
+
})]
|
|
4042
|
+
});
|
|
4043
|
+
};
|
|
4044
|
+
const MatrixOptionsEditor = ({
|
|
4045
|
+
value = [],
|
|
4046
|
+
onChange
|
|
4047
|
+
}) => {
|
|
4048
|
+
const {
|
|
4049
|
+
formatMessage
|
|
4050
|
+
} = reactIntl.useIntl();
|
|
4051
|
+
react.useEffect(() => {
|
|
4052
|
+
if (!value.length) {
|
|
4053
|
+
onChange([createEmptyMatrixOption()]);
|
|
4054
|
+
return;
|
|
4055
|
+
}
|
|
4056
|
+
if (hasMissingKey(value)) {
|
|
4057
|
+
onChange(ensureKeys(value, createOptKey));
|
|
4058
|
+
}
|
|
4059
|
+
}, [value, onChange]);
|
|
4060
|
+
const rows = value.length ? value : [];
|
|
4061
|
+
const updateItem = (index, patch) => {
|
|
4062
|
+
onChange(rows.map((item, itemIndex) => itemIndex === index ? {
|
|
4063
|
+
...item,
|
|
4064
|
+
...patch
|
|
4065
|
+
} : item));
|
|
4066
|
+
};
|
|
4067
|
+
return /*#__PURE__*/jsxRuntime.jsxs(EditorSection, {
|
|
4068
|
+
title: formatMessage({
|
|
4069
|
+
id: 'matrixScaleOptionsTitle'
|
|
4070
|
+
}),
|
|
4071
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4072
|
+
className: style['options-list'],
|
|
4073
|
+
children: rows.map((item, index) => /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
|
|
4074
|
+
gap: 8,
|
|
4075
|
+
align: "start",
|
|
4076
|
+
className: style['options-row'],
|
|
4077
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Input, {
|
|
4078
|
+
value: item.label || '',
|
|
4079
|
+
placeholder: formatMessage({
|
|
4080
|
+
id: 'optionLabelPlaceholder'
|
|
4081
|
+
}),
|
|
4082
|
+
onChange: e => {
|
|
4083
|
+
const label = e.target.value;
|
|
4084
|
+
const patch = {
|
|
4085
|
+
label
|
|
4086
|
+
};
|
|
4087
|
+
if (!item.value || item.value === item.label) {
|
|
4088
|
+
patch.value = label;
|
|
4089
|
+
}
|
|
4090
|
+
updateItem(index, patch);
|
|
4091
|
+
}
|
|
4092
|
+
}), /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
|
|
4093
|
+
value: item.value || '',
|
|
4094
|
+
placeholder: formatMessage({
|
|
4095
|
+
id: 'optionValuePlaceholder'
|
|
4096
|
+
}),
|
|
4097
|
+
onChange: e => updateItem(index, {
|
|
4098
|
+
value: e.target.value
|
|
4099
|
+
})
|
|
4100
|
+
}), /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
4101
|
+
type: "text",
|
|
4102
|
+
danger: true,
|
|
4103
|
+
className: style['icon-square-btn-sm'],
|
|
4104
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(icons.DeleteOutlined, {}),
|
|
4105
|
+
disabled: rows.length <= 1,
|
|
4106
|
+
onClick: () => {
|
|
4107
|
+
const next = rows.filter((_, i) => i !== index);
|
|
4108
|
+
onChange(next.length ? next : [createEmptyMatrixOption()]);
|
|
4109
|
+
}
|
|
4110
|
+
})]
|
|
4111
|
+
}, item._key || `opt-${index}`))
|
|
4112
|
+
}), /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
4113
|
+
type: "dashed",
|
|
4114
|
+
block: true,
|
|
4115
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(icons.PlusOutlined, {}),
|
|
4116
|
+
onClick: () => onChange([...rows, createEmptyMatrixOption()]),
|
|
4117
|
+
children: formatMessage({
|
|
4118
|
+
id: 'addOption'
|
|
4119
|
+
})
|
|
4120
|
+
})]
|
|
4121
|
+
});
|
|
4122
|
+
};
|
|
4123
|
+
const MatrixScaleEditor = ({
|
|
4124
|
+
block,
|
|
4125
|
+
onChange
|
|
4126
|
+
}) => {
|
|
4127
|
+
const {
|
|
4128
|
+
formatMessage
|
|
4129
|
+
} = reactIntl.useIntl();
|
|
4130
|
+
const layout = block.layout === 'columns' || block.layout === 'field' ? block.layout : 'options';
|
|
4131
|
+
const blockRef = react.useRef(block);
|
|
4132
|
+
blockRef.current = block;
|
|
4133
|
+
const onChangeRef = react.useRef(onChange);
|
|
4134
|
+
onChangeRef.current = onChange;
|
|
4135
|
+
|
|
4136
|
+
// 用 ref 保持回调稳定,避免输入时子组件 useEffect 反复触发
|
|
4137
|
+
const handleRowsChange = react.useCallback(rows => onChangeRef.current({
|
|
4138
|
+
...blockRef.current,
|
|
4139
|
+
rows
|
|
4140
|
+
}), []);
|
|
4141
|
+
const handleOptionsChange = react.useCallback(options => onChangeRef.current({
|
|
4142
|
+
...blockRef.current,
|
|
4143
|
+
options
|
|
4144
|
+
}), []);
|
|
4145
|
+
const handleColumnsChange = react.useCallback(columns => onChangeRef.current({
|
|
4146
|
+
...blockRef.current,
|
|
4147
|
+
columns
|
|
4148
|
+
}), []);
|
|
4149
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4150
|
+
className: style['block-body'],
|
|
4151
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Text$4, {
|
|
4152
|
+
type: "secondary",
|
|
4153
|
+
className: style['inline-empty'],
|
|
4154
|
+
children: formatMessage({
|
|
4155
|
+
id: `matrixScaleEditorHint_${layout}`
|
|
4156
|
+
})
|
|
4157
|
+
}), /*#__PURE__*/jsxRuntime.jsx(LabelNameRows, {
|
|
4158
|
+
title: formatMessage({
|
|
4159
|
+
id: 'matrixScaleRowsTitle'
|
|
4160
|
+
}),
|
|
4161
|
+
tip: formatMessage({
|
|
4162
|
+
id: 'matrixScaleRowsHint'
|
|
4163
|
+
}),
|
|
4164
|
+
list: block.rows || [],
|
|
4165
|
+
onChange: handleRowsChange,
|
|
4166
|
+
createEmpty: createEmptyMatrixRow,
|
|
4167
|
+
createKey: createRowKey,
|
|
4168
|
+
labelPlaceholder: formatMessage({
|
|
4169
|
+
id: 'matrixScaleRowLabelPlaceholder'
|
|
4170
|
+
}),
|
|
4171
|
+
namePlaceholder: formatMessage({
|
|
4172
|
+
id: 'matrixScaleRowNamePlaceholder'
|
|
4173
|
+
}),
|
|
4174
|
+
addText: formatMessage({
|
|
4175
|
+
id: 'matrixScaleAddRow'
|
|
4176
|
+
})
|
|
4177
|
+
}), layout === 'options' ? /*#__PURE__*/jsxRuntime.jsx(MatrixOptionsEditor, {
|
|
4178
|
+
value: block.options || [],
|
|
4179
|
+
onChange: handleOptionsChange
|
|
4180
|
+
}) : null, layout === 'columns' ? /*#__PURE__*/jsxRuntime.jsx(LabelNameRows, {
|
|
4181
|
+
title: formatMessage({
|
|
4182
|
+
id: 'matrixScaleColumnsTitle'
|
|
4183
|
+
}),
|
|
4184
|
+
tip: formatMessage({
|
|
4185
|
+
id: 'matrixScaleColumnsHint'
|
|
4186
|
+
}),
|
|
4187
|
+
list: block.columns || [],
|
|
4188
|
+
onChange: handleColumnsChange,
|
|
4189
|
+
createEmpty: createEmptyMatrixColumn,
|
|
4190
|
+
createKey: createColKey,
|
|
4191
|
+
labelPlaceholder: formatMessage({
|
|
4192
|
+
id: 'matrixScaleColumnLabelPlaceholder'
|
|
4193
|
+
}),
|
|
4194
|
+
namePlaceholder: formatMessage({
|
|
4195
|
+
id: 'matrixScaleColumnNamePlaceholder'
|
|
4196
|
+
}),
|
|
4197
|
+
addText: formatMessage({
|
|
4198
|
+
id: 'matrixScaleAddRow'
|
|
4199
|
+
})
|
|
4200
|
+
}) : null]
|
|
4201
|
+
});
|
|
4202
|
+
};
|
|
4203
|
+
var MatrixScaleEditor$1 = MatrixScaleEditor;
|
|
4204
|
+
|
|
4205
|
+
const noop = () => {};
|
|
4206
|
+
|
|
4207
|
+
/** 拖柄属性:按 scope 区分,嵌套列表的拖柄不会被外层列表识别 */
|
|
4208
|
+
const getSortHandleProps = scope => ({
|
|
4209
|
+
'data-sort-handle': scope
|
|
3419
4210
|
});
|
|
4211
|
+
|
|
4212
|
+
/**
|
|
4213
|
+
* 同一列表内拖拽排序:顺序以 schema 为准,setList 不接管;
|
|
4214
|
+
* onMove 拦截跨越固定项的位置,onEnd 通过 onMove(id, 目标下标) 写回。
|
|
4215
|
+
*/
|
|
4216
|
+
const SortableList = ({
|
|
4217
|
+
scope,
|
|
4218
|
+
list,
|
|
4219
|
+
isFixed,
|
|
4220
|
+
onMove,
|
|
4221
|
+
className,
|
|
4222
|
+
children
|
|
4223
|
+
}) => {
|
|
4224
|
+
const getIndex = el => list.findIndex(item => String(item.id) === el?.dataset?.id);
|
|
4225
|
+
return /*#__PURE__*/jsxRuntime.jsx(reactSortablejs.ReactSortable, {
|
|
4226
|
+
tag: "div",
|
|
4227
|
+
className: className,
|
|
4228
|
+
list: list,
|
|
4229
|
+
setList: noop,
|
|
4230
|
+
handle: `[data-sort-handle="${scope}"]`,
|
|
4231
|
+
animation: 180,
|
|
4232
|
+
easing: "cubic-bezier(0.2, 0, 0, 1)",
|
|
4233
|
+
forceFallback: true,
|
|
4234
|
+
fallbackOnBody: true,
|
|
4235
|
+
ghostClass: style['sortable-ghost'],
|
|
4236
|
+
chosenClass: style['sortable-chosen'],
|
|
4237
|
+
dragClass: style['sortable-drag'],
|
|
4238
|
+
onMove: evt => canMoveItemTo(list, getIndex(evt.dragged), getIndex(evt.related), isFixed),
|
|
4239
|
+
onEnd: evt => {
|
|
4240
|
+
if (evt.oldIndex !== evt.newIndex && list[evt.oldIndex]) {
|
|
4241
|
+
onMove(list[evt.oldIndex].id, evt.newIndex);
|
|
4242
|
+
}
|
|
4243
|
+
},
|
|
4244
|
+
children: children
|
|
4245
|
+
});
|
|
4246
|
+
};
|
|
4247
|
+
var SortableList$1 = SortableList;
|
|
4248
|
+
|
|
4249
|
+
const {
|
|
4250
|
+
Text: Text$3
|
|
4251
|
+
} = antd.Typography;
|
|
3420
4252
|
const ROOT_ADD_OPTIONS = [{
|
|
3421
4253
|
key: 'formInfo',
|
|
3422
4254
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.FormOutlined, {})
|
|
@@ -3438,6 +4270,9 @@ const ROOT_ADD_OPTIONS = [{
|
|
|
3438
4270
|
}, {
|
|
3439
4271
|
key: 'multiField',
|
|
3440
4272
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.AppstoreOutlined, {})
|
|
4273
|
+
}, {
|
|
4274
|
+
key: 'matrixScale',
|
|
4275
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(icons.BorderOuterOutlined, {})
|
|
3441
4276
|
}, {
|
|
3442
4277
|
key: 'steps',
|
|
3443
4278
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.OrderedListOutlined, {})
|
|
@@ -3449,6 +4284,9 @@ const BLOCK_KIND_ICONS = Object.fromEntries(ROOT_ADD_OPTIONS.map(({
|
|
|
3449
4284
|
|
|
3450
4285
|
/** 可挂子模块的容器;表格列表 / 同类多值本身不支持子模块 */
|
|
3451
4286
|
const NESTED_ADD_OPTIONS = ROOT_ADD_OPTIONS.filter(opt => opt.key !== 'steps');
|
|
4287
|
+
|
|
4288
|
+
/** 模块列表的拖柄 scope 须稳定:ReactSortable 只在挂载时读取 handle,scope 随列表内容变化会导致拖柄失效 */
|
|
4289
|
+
const getBlockScope = parentKey => `blocks:${parentKey}`;
|
|
3452
4290
|
const BlockListPanel = ({
|
|
3453
4291
|
blocks,
|
|
3454
4292
|
onAddBlock,
|
|
@@ -3468,17 +4306,33 @@ const BlockListPanel = ({
|
|
|
3468
4306
|
onDeleteChoiceOption,
|
|
3469
4307
|
onMoveChoiceOption,
|
|
3470
4308
|
onOpenFormActions,
|
|
4309
|
+
onPatchBlock,
|
|
3471
4310
|
extraToolbar
|
|
3472
4311
|
}) => {
|
|
3473
4312
|
const {
|
|
3474
4313
|
formatMessage,
|
|
3475
4314
|
locale
|
|
3476
4315
|
} = reactIntl.useIntl();
|
|
4316
|
+
const isMobile = responsiveUtils.useIsMobile();
|
|
3477
4317
|
const languages = useLocaleTextLanguages();
|
|
3478
4318
|
const text = value => resolveLocaleText(value, locale, languages);
|
|
3479
4319
|
const [addMenuOpen, setAddMenuOpen] = react.useState(false);
|
|
3480
4320
|
const [addFieldMenuId, setAddFieldMenuId] = react.useState(null);
|
|
3481
4321
|
const keepAddFieldMenuOpenRef = react.useRef(false);
|
|
4322
|
+
const [collapsedIds, setCollapsedIds] = react.useState(() => new Set());
|
|
4323
|
+
const toggleCollapsed = id => setCollapsedIds(prev => {
|
|
4324
|
+
const next = new Set(prev);
|
|
4325
|
+
next.has(id) ? next.delete(id) : next.add(id);
|
|
4326
|
+
return next;
|
|
4327
|
+
});
|
|
4328
|
+
const renderDragHandle = (scope, standalone) => /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
4329
|
+
className: standalone ? style['drag-handle'] : `${style['drag-handle']} ${style['drag-handle-action']}`,
|
|
4330
|
+
title: formatMessage({
|
|
4331
|
+
id: 'dragSort'
|
|
4332
|
+
}),
|
|
4333
|
+
...getSortHandleProps(scope),
|
|
4334
|
+
children: /*#__PURE__*/jsxRuntime.jsx(icons.HolderOutlined, {})
|
|
4335
|
+
});
|
|
3482
4336
|
const conditionContext = react.useMemo(() => {
|
|
3483
4337
|
const triggerFields = collectConditionFields({
|
|
3484
4338
|
blocks
|
|
@@ -3533,17 +4387,19 @@ const BlockListPanel = ({
|
|
|
3533
4387
|
}) => {
|
|
3534
4388
|
const canAddChild = typeof onAddChildBlock === 'function' && depth < MAX_BLOCK_DEPTH;
|
|
3535
4389
|
const menuOpen = addFieldMenuId === menuKey;
|
|
3536
|
-
const btnClass = `${style['add-inline-btn']} ${style['hover-reveal']} ${menuOpen ? style['hover-reveal-active'] : ''}`.trim();
|
|
4390
|
+
const btnClass = `${style['add-inline-btn']} ${style['hover-reveal']} ${menuOpen ? style['hover-reveal-active'] : ''} ${isMobile ? style['add-inline-btn-icon'] : ''}`.trim();
|
|
4391
|
+
const addFieldText = formatMessage({
|
|
4392
|
+
id: 'addField'
|
|
4393
|
+
});
|
|
3537
4394
|
if (!canAddChild) {
|
|
3538
4395
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
3539
4396
|
type: "text",
|
|
3540
4397
|
size: "small",
|
|
3541
4398
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.PlusOutlined, {}),
|
|
3542
4399
|
className: btnClass,
|
|
4400
|
+
title: addFieldText,
|
|
3543
4401
|
onClick: onAddFieldClick,
|
|
3544
|
-
children:
|
|
3545
|
-
id: 'addField'
|
|
3546
|
-
})
|
|
4402
|
+
children: isMobile ? null : addFieldText
|
|
3547
4403
|
});
|
|
3548
4404
|
}
|
|
3549
4405
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Dropdown, {
|
|
@@ -3637,10 +4493,9 @@ const BlockListPanel = ({
|
|
|
3637
4493
|
keepAddFieldMenuOpenRef.current = true;
|
|
3638
4494
|
}
|
|
3639
4495
|
},
|
|
4496
|
+
title: addFieldText,
|
|
3640
4497
|
onClick: () => setAddFieldMenuId(menuKey),
|
|
3641
|
-
children:
|
|
3642
|
-
id: 'addField'
|
|
3643
|
-
})
|
|
4498
|
+
children: isMobile ? null : addFieldText
|
|
3644
4499
|
})
|
|
3645
4500
|
});
|
|
3646
4501
|
};
|
|
@@ -3649,7 +4504,7 @@ const BlockListPanel = ({
|
|
|
3649
4504
|
optionId
|
|
3650
4505
|
} = {}) => {
|
|
3651
4506
|
if (!(fields || []).length) {
|
|
3652
|
-
return /*#__PURE__*/jsxRuntime.jsx(Text$
|
|
4507
|
+
return /*#__PURE__*/jsxRuntime.jsx(Text$3, {
|
|
3653
4508
|
type: "secondary",
|
|
3654
4509
|
className: style['inline-empty'],
|
|
3655
4510
|
children: formatMessage({
|
|
@@ -3657,9 +4512,20 @@ const BlockListPanel = ({
|
|
|
3657
4512
|
})
|
|
3658
4513
|
});
|
|
3659
4514
|
}
|
|
3660
|
-
|
|
4515
|
+
const scope = `fields:${blockId}:${stepId || ''}:${optionId || ''}`;
|
|
4516
|
+
const canDrag = fields.length > 1;
|
|
4517
|
+
return /*#__PURE__*/jsxRuntime.jsx(SortableList$1, {
|
|
3661
4518
|
className: style['field-list'],
|
|
4519
|
+
scope: scope,
|
|
4520
|
+
list: fields,
|
|
4521
|
+
isFixed: isFieldLocked,
|
|
4522
|
+
onMove: (fieldId, to) => onMoveField(blockId, fieldId, to, {
|
|
4523
|
+
stepId,
|
|
4524
|
+
optionId
|
|
4525
|
+
}),
|
|
3662
4526
|
children: fields.map((field, fieldIndex) => /*#__PURE__*/jsxRuntime.jsx(FieldRow, {
|
|
4527
|
+
isMobile: isMobile,
|
|
4528
|
+
dragHandleProps: canDrag && !isFieldLocked(field) ? getSortHandleProps(scope) : null,
|
|
3663
4529
|
field: field,
|
|
3664
4530
|
index: fieldIndex,
|
|
3665
4531
|
total: fields.length,
|
|
@@ -3681,26 +4547,30 @@ const BlockListPanel = ({
|
|
|
3681
4547
|
}, field.id))
|
|
3682
4548
|
});
|
|
3683
4549
|
};
|
|
3684
|
-
const renderNestedBlocks = (childBlocks, depth) => {
|
|
4550
|
+
const renderNestedBlocks = (childBlocks, depth, parentKey) => {
|
|
3685
4551
|
if (!(childBlocks || []).length) {
|
|
3686
4552
|
return null;
|
|
3687
4553
|
}
|
|
3688
4554
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3689
4555
|
className: style['item-blocks-section'],
|
|
3690
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
4556
|
+
children: /*#__PURE__*/jsxRuntime.jsx(SortableList$1, {
|
|
3691
4557
|
className: style['nested-block-list'],
|
|
3692
|
-
|
|
4558
|
+
scope: getBlockScope(parentKey),
|
|
4559
|
+
list: childBlocks,
|
|
4560
|
+
isFixed: blockHasLockedField,
|
|
4561
|
+
onMove: onMoveBlock,
|
|
4562
|
+
children: childBlocks.map((child, childIndex) => renderBlockSection(child, childIndex, childBlocks, depth + 1, parentKey))
|
|
3693
4563
|
})
|
|
3694
4564
|
});
|
|
3695
4565
|
};
|
|
3696
|
-
const renderItemBlocks = (parentBlock, depth) => renderNestedBlocks(parentBlock.itemBlocks, depth);
|
|
4566
|
+
const renderItemBlocks = (parentBlock, depth) => renderNestedBlocks(parentBlock.itemBlocks, depth, `item:${parentBlock.id}`);
|
|
3697
4567
|
const renderBlockChildren = (block, depth) => {
|
|
3698
4568
|
if (block.kind === 'steps') {
|
|
3699
4569
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3700
4570
|
className: style['block-body'],
|
|
3701
4571
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3702
4572
|
className: style['section-toolbar'],
|
|
3703
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Text$
|
|
4573
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Text$3, {
|
|
3704
4574
|
type: "secondary",
|
|
3705
4575
|
className: style['section-toolbar-label'],
|
|
3706
4576
|
children: formatMessage({
|
|
@@ -3716,72 +4586,86 @@ const BlockListPanel = ({
|
|
|
3716
4586
|
id: 'addStep'
|
|
3717
4587
|
})
|
|
3718
4588
|
})]
|
|
3719
|
-
}), (block.items || []).length ? /*#__PURE__*/jsxRuntime.jsx(
|
|
4589
|
+
}), (block.items || []).length ? /*#__PURE__*/jsxRuntime.jsx(SortableList$1, {
|
|
3720
4590
|
className: style['step-list'],
|
|
4591
|
+
scope: `steps:${block.id}`,
|
|
4592
|
+
list: block.items,
|
|
4593
|
+
isFixed: blockHasLockedField,
|
|
4594
|
+
onMove: (stepId, to) => onMoveStep(block.id, stepId, to),
|
|
3721
4595
|
children: (block.items || []).map((step, stepIndex) => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3722
4596
|
className: style['step-section'],
|
|
3723
4597
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3724
4598
|
className: style['step-section-header'],
|
|
3725
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs(
|
|
3726
|
-
size: 8,
|
|
3727
|
-
wrap: true,
|
|
4599
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3728
4600
|
className: style['step-section-title'],
|
|
3729
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
4601
|
+
children: [isMobile && block.items.length > 1 && !blockHasLockedField(step) ? renderDragHandle(`steps:${block.id}`, true) : null, /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
3730
4602
|
className: style['step-index'],
|
|
3731
4603
|
children: stepIndex + 1
|
|
3732
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
3733
|
-
|
|
3734
|
-
children:
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
4604
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4605
|
+
className: style['step-section-text'],
|
|
4606
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Text$3, {
|
|
4607
|
+
strong: true,
|
|
4608
|
+
children: text(step.title) || formatMessage({
|
|
4609
|
+
id: 'untitledStep'
|
|
4610
|
+
}, {
|
|
4611
|
+
index: stepIndex + 1
|
|
4612
|
+
})
|
|
4613
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Text$3, {
|
|
4614
|
+
type: "secondary",
|
|
4615
|
+
className: style['step-section-count'],
|
|
4616
|
+
children: (step.blocks || []).length ? formatMessage({
|
|
4617
|
+
id: 'fieldAndItemBlockCount'
|
|
4618
|
+
}, {
|
|
4619
|
+
fields: step.list?.length || 0,
|
|
4620
|
+
nests: step.blocks.length
|
|
4621
|
+
}) : formatMessage({
|
|
4622
|
+
id: 'fieldCount'
|
|
4623
|
+
}, {
|
|
4624
|
+
count: step.list?.length || 0
|
|
4625
|
+
})
|
|
4626
|
+
})]
|
|
3751
4627
|
})]
|
|
3752
4628
|
}), /*#__PURE__*/jsxRuntime.jsxs(antd.Space, {
|
|
3753
4629
|
size: 4,
|
|
3754
|
-
wrap: true,
|
|
3755
4630
|
className: style['step-section-actions'],
|
|
3756
|
-
children: [/*#__PURE__*/jsxRuntime.
|
|
3757
|
-
|
|
3758
|
-
|
|
4631
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(RowActions$1, {
|
|
4632
|
+
isMobile: isMobile,
|
|
4633
|
+
moreTitle: formatMessage({
|
|
4634
|
+
id: 'moreActions'
|
|
4635
|
+
}),
|
|
4636
|
+
prefix: !isMobile && block.items.length > 1 && !blockHasLockedField(step) ? renderDragHandle(`steps:${block.id}`) : null,
|
|
4637
|
+
actions: orderActions(isMobile, [{
|
|
4638
|
+
key: 'up',
|
|
4639
|
+
label: formatMessage({
|
|
3759
4640
|
id: 'moveUp'
|
|
3760
4641
|
}),
|
|
3761
4642
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowUpOutlined, {}),
|
|
3762
4643
|
disabled: stepIndex === 0 || blockHasLockedField(step) || blockHasLockedField(block.items[stepIndex - 1]),
|
|
3763
4644
|
onClick: () => onMoveStep(block.id, step.id, 'up')
|
|
3764
|
-
}
|
|
3765
|
-
|
|
4645
|
+
}, {
|
|
4646
|
+
key: 'down',
|
|
4647
|
+
label: formatMessage({
|
|
3766
4648
|
id: 'moveDown'
|
|
3767
4649
|
}),
|
|
3768
4650
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowDownOutlined, {}),
|
|
3769
4651
|
disabled: stepIndex === (block.items?.length || 0) - 1 || blockHasLockedField(step) || blockHasLockedField(block.items[stepIndex + 1]),
|
|
3770
4652
|
onClick: () => onMoveStep(block.id, step.id, 'down')
|
|
3771
|
-
}
|
|
3772
|
-
|
|
4653
|
+
}, {
|
|
4654
|
+
key: 'edit',
|
|
4655
|
+
label: formatMessage({
|
|
3773
4656
|
id: 'editStep'
|
|
3774
4657
|
}),
|
|
3775
4658
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.EditOutlined, {}),
|
|
3776
4659
|
onClick: () => onEditStep(block.id, step)
|
|
3777
|
-
}
|
|
3778
|
-
|
|
4660
|
+
}, blockHasLockedField(step) ? null : {
|
|
4661
|
+
key: 'delete',
|
|
4662
|
+
label: formatMessage({
|
|
3779
4663
|
id: 'deleteStep'
|
|
3780
4664
|
}),
|
|
3781
|
-
danger: true,
|
|
3782
4665
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.DeleteOutlined, {}),
|
|
4666
|
+
danger: true,
|
|
3783
4667
|
onClick: () => onDeleteStep(block.id, step.id)
|
|
3784
|
-
})
|
|
4668
|
+
}])
|
|
3785
4669
|
}), renderAddFieldButton({
|
|
3786
4670
|
menuKey: `${block.id}:${step.id}`,
|
|
3787
4671
|
depth,
|
|
@@ -3796,9 +4680,9 @@ const BlockListPanel = ({
|
|
|
3796
4680
|
})]
|
|
3797
4681
|
}), renderFieldList(step.list, block.id, {
|
|
3798
4682
|
stepId: step.id
|
|
3799
|
-
}), renderNestedBlocks(step.blocks, depth)]
|
|
4683
|
+
}), renderNestedBlocks(step.blocks, depth, `step:${step.id}`)]
|
|
3800
4684
|
}, step.id))
|
|
3801
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(Text$
|
|
4685
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(Text$3, {
|
|
3802
4686
|
type: "secondary",
|
|
3803
4687
|
className: style['inline-empty'],
|
|
3804
4688
|
children: formatMessage({
|
|
@@ -3810,7 +4694,7 @@ const BlockListPanel = ({
|
|
|
3810
4694
|
if (block.kind === 'multiField') {
|
|
3811
4695
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3812
4696
|
className: style['block-body'],
|
|
3813
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Text$
|
|
4697
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Text$3, {
|
|
3814
4698
|
type: "secondary",
|
|
3815
4699
|
children: formatMessage({
|
|
3816
4700
|
id: 'multiFieldEditorHint'
|
|
@@ -3818,12 +4702,18 @@ const BlockListPanel = ({
|
|
|
3818
4702
|
})
|
|
3819
4703
|
});
|
|
3820
4704
|
}
|
|
4705
|
+
if (block.kind === 'matrixScale') {
|
|
4706
|
+
return /*#__PURE__*/jsxRuntime.jsx(MatrixScaleEditor$1, {
|
|
4707
|
+
block: block,
|
|
4708
|
+
onChange: next => onPatchBlock?.(next)
|
|
4709
|
+
});
|
|
4710
|
+
}
|
|
3821
4711
|
if (block.kind === 'choice') {
|
|
3822
4712
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3823
4713
|
className: style['block-body'],
|
|
3824
4714
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3825
4715
|
className: style['section-toolbar'],
|
|
3826
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Text$
|
|
4716
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Text$3, {
|
|
3827
4717
|
type: "secondary",
|
|
3828
4718
|
className: style['section-toolbar-label'],
|
|
3829
4719
|
children: formatMessage({
|
|
@@ -3839,72 +4729,86 @@ const BlockListPanel = ({
|
|
|
3839
4729
|
id: 'addChoiceOption'
|
|
3840
4730
|
})
|
|
3841
4731
|
})]
|
|
3842
|
-
}), (block.options || []).length ? /*#__PURE__*/jsxRuntime.jsx(
|
|
4732
|
+
}), (block.options || []).length ? /*#__PURE__*/jsxRuntime.jsx(SortableList$1, {
|
|
3843
4733
|
className: style['step-list'],
|
|
4734
|
+
scope: `options:${block.id}`,
|
|
4735
|
+
list: block.options,
|
|
4736
|
+
isFixed: blockHasLockedField,
|
|
4737
|
+
onMove: (optionId, to) => onMoveChoiceOption(block.id, optionId, to),
|
|
3844
4738
|
children: (block.options || []).map((option, optionIndex) => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3845
4739
|
className: style['step-section'],
|
|
3846
4740
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3847
4741
|
className: style['step-section-header'],
|
|
3848
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs(
|
|
3849
|
-
size: 8,
|
|
3850
|
-
wrap: true,
|
|
4742
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3851
4743
|
className: style['step-section-title'],
|
|
3852
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
4744
|
+
children: [isMobile && block.options.length > 1 && !blockHasLockedField(option) ? renderDragHandle(`options:${block.id}`, true) : null, /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
3853
4745
|
className: style['step-index'],
|
|
3854
4746
|
children: optionIndex + 1
|
|
3855
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
3856
|
-
|
|
3857
|
-
children:
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
4747
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4748
|
+
className: style['step-section-text'],
|
|
4749
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Text$3, {
|
|
4750
|
+
strong: true,
|
|
4751
|
+
children: text(option.title) || formatMessage({
|
|
4752
|
+
id: 'choiceOptionFallback'
|
|
4753
|
+
}, {
|
|
4754
|
+
index: optionIndex + 1
|
|
4755
|
+
})
|
|
4756
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Text$3, {
|
|
4757
|
+
type: "secondary",
|
|
4758
|
+
className: style['step-section-count'],
|
|
4759
|
+
children: (option.blocks || []).length ? formatMessage({
|
|
4760
|
+
id: 'fieldAndItemBlockCount'
|
|
4761
|
+
}, {
|
|
4762
|
+
fields: option.list?.length || 0,
|
|
4763
|
+
nests: option.blocks.length
|
|
4764
|
+
}) : formatMessage({
|
|
4765
|
+
id: 'fieldCount'
|
|
4766
|
+
}, {
|
|
4767
|
+
count: option.list?.length || 0
|
|
4768
|
+
})
|
|
4769
|
+
})]
|
|
3874
4770
|
})]
|
|
3875
4771
|
}), /*#__PURE__*/jsxRuntime.jsxs(antd.Space, {
|
|
3876
4772
|
size: 4,
|
|
3877
|
-
wrap: true,
|
|
3878
4773
|
className: style['step-section-actions'],
|
|
3879
|
-
children: [/*#__PURE__*/jsxRuntime.
|
|
3880
|
-
|
|
3881
|
-
|
|
4774
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(RowActions$1, {
|
|
4775
|
+
isMobile: isMobile,
|
|
4776
|
+
moreTitle: formatMessage({
|
|
4777
|
+
id: 'moreActions'
|
|
4778
|
+
}),
|
|
4779
|
+
prefix: !isMobile && block.options.length > 1 && !blockHasLockedField(option) ? renderDragHandle(`options:${block.id}`) : null,
|
|
4780
|
+
actions: orderActions(isMobile, [{
|
|
4781
|
+
key: 'up',
|
|
4782
|
+
label: formatMessage({
|
|
3882
4783
|
id: 'moveUp'
|
|
3883
4784
|
}),
|
|
3884
4785
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowUpOutlined, {}),
|
|
3885
4786
|
disabled: optionIndex === 0 || blockHasLockedField(option) || blockHasLockedField(block.options[optionIndex - 1]),
|
|
3886
4787
|
onClick: () => onMoveChoiceOption(block.id, option.id, 'up')
|
|
3887
|
-
}
|
|
3888
|
-
|
|
4788
|
+
}, {
|
|
4789
|
+
key: 'down',
|
|
4790
|
+
label: formatMessage({
|
|
3889
4791
|
id: 'moveDown'
|
|
3890
4792
|
}),
|
|
3891
4793
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowDownOutlined, {}),
|
|
3892
4794
|
disabled: optionIndex === (block.options?.length || 0) - 1 || blockHasLockedField(option) || blockHasLockedField(block.options[optionIndex + 1]),
|
|
3893
4795
|
onClick: () => onMoveChoiceOption(block.id, option.id, 'down')
|
|
3894
|
-
}
|
|
3895
|
-
|
|
4796
|
+
}, {
|
|
4797
|
+
key: 'edit',
|
|
4798
|
+
label: formatMessage({
|
|
3896
4799
|
id: 'editChoiceOption'
|
|
3897
4800
|
}),
|
|
3898
4801
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.EditOutlined, {}),
|
|
3899
4802
|
onClick: () => onEditChoiceOption(block.id, option)
|
|
3900
|
-
}
|
|
3901
|
-
|
|
4803
|
+
}, blockHasLockedField(option) ? null : {
|
|
4804
|
+
key: 'delete',
|
|
4805
|
+
label: formatMessage({
|
|
3902
4806
|
id: 'deleteChoiceOption'
|
|
3903
4807
|
}),
|
|
3904
|
-
danger: true,
|
|
3905
4808
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.DeleteOutlined, {}),
|
|
4809
|
+
danger: true,
|
|
3906
4810
|
onClick: () => onDeleteChoiceOption(block.id, option.id)
|
|
3907
|
-
})
|
|
4811
|
+
}])
|
|
3908
4812
|
}), renderAddFieldButton({
|
|
3909
4813
|
menuKey: `${block.id}:opt:${option.id}`,
|
|
3910
4814
|
depth,
|
|
@@ -3919,9 +4823,9 @@ const BlockListPanel = ({
|
|
|
3919
4823
|
})]
|
|
3920
4824
|
}), renderFieldList(option.list, block.id, {
|
|
3921
4825
|
optionId: option.id
|
|
3922
|
-
}), renderNestedBlocks(option.blocks, depth)]
|
|
4826
|
+
}), renderNestedBlocks(option.blocks, depth, `option:${option.id}`)]
|
|
3923
4827
|
}, option.id))
|
|
3924
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(Text$
|
|
4828
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(Text$3, {
|
|
3925
4829
|
type: "secondary",
|
|
3926
4830
|
className: style['inline-empty'],
|
|
3927
4831
|
children: formatMessage({
|
|
@@ -3934,18 +4838,19 @@ const BlockListPanel = ({
|
|
|
3934
4838
|
const supportsBlocks = block.kind === 'formInfo' || block.kind === 'object';
|
|
3935
4839
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3936
4840
|
className: style['block-body'],
|
|
3937
|
-
children: [renderFieldList(block.list, block.id), supportsItemBlocks$1 ? renderItemBlocks(block, depth) : null, supportsBlocks ? renderNestedBlocks(block.blocks, depth) : null]
|
|
4841
|
+
children: [renderFieldList(block.list, block.id), supportsItemBlocks$1 ? renderItemBlocks(block, depth) : null, supportsBlocks ? renderNestedBlocks(block.blocks, depth, `block:${block.id}`) : null]
|
|
3938
4842
|
});
|
|
3939
4843
|
};
|
|
3940
|
-
const renderBlockSection = (block, blockIndex, siblings, depth = 0) => {
|
|
4844
|
+
const renderBlockSection = (block, blockIndex, siblings, depth = 0, parentKey = 'root') => {
|
|
3941
4845
|
const total = siblings.length;
|
|
3942
4846
|
const locked = blockHasLockedField(block);
|
|
3943
4847
|
const definition = getBlockDefinition(block.kind);
|
|
3944
|
-
const canAddField = block.kind !== 'steps' && block.kind !== 'multiField' && block.kind !== 'choice';
|
|
4848
|
+
const canAddField = block.kind !== 'steps' && block.kind !== 'multiField' && block.kind !== 'matrixScale' && block.kind !== 'choice';
|
|
3945
4849
|
const supportsItemBlocks$1 = supportsItemBlocks(block.kind);
|
|
3946
4850
|
const supportsBlocks = block.kind === 'formInfo' || block.kind === 'object';
|
|
3947
4851
|
const supportsChildModules = supportsItemBlocks$1 || supportsBlocks;
|
|
3948
4852
|
const nestCount = supportsItemBlocks$1 ? block.itemBlocks?.length || 0 : block.blocks?.length || 0;
|
|
4853
|
+
const matrixLayout = block.layout === 'columns' || block.layout === 'field' ? block.layout : 'options';
|
|
3949
4854
|
const summary = block.kind === 'steps' ? formatMessage({
|
|
3950
4855
|
id: 'stepCount'
|
|
3951
4856
|
}, {
|
|
@@ -3956,7 +4861,18 @@ const BlockListPanel = ({
|
|
|
3956
4861
|
type: /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
3957
4862
|
className: style['block-summary-type'],
|
|
3958
4863
|
children: [/*#__PURE__*/react.createElement(getFieldTypeIcon(block.fieldType || 'Input')), resolveFieldTypeLabel(block.fieldType, formatMessage)]
|
|
3959
|
-
})
|
|
4864
|
+
}, "type")
|
|
4865
|
+
}) : block.kind === 'matrixScale' ? formatMessage({
|
|
4866
|
+
id: 'matrixScaleSummary'
|
|
4867
|
+
}, {
|
|
4868
|
+
type: /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
4869
|
+
className: style['block-summary-type'],
|
|
4870
|
+
children: [/*#__PURE__*/react.createElement(getFieldTypeIcon(block.fieldType || 'RadioGroup')), resolveFieldTypeLabel(block.fieldType || 'RadioGroup', formatMessage)]
|
|
4871
|
+
}, "type"),
|
|
4872
|
+
layout: formatMessage({
|
|
4873
|
+
id: `matrixScaleLayout_${matrixLayout}`
|
|
4874
|
+
}),
|
|
4875
|
+
rows: block.rows?.length || 0
|
|
3960
4876
|
}) : block.kind === 'choice' ? formatMessage({
|
|
3961
4877
|
id: 'choiceOptionCount'
|
|
3962
4878
|
}, {
|
|
@@ -3971,73 +4887,92 @@ const BlockListPanel = ({
|
|
|
3971
4887
|
}, {
|
|
3972
4888
|
count: block.list?.length || 0
|
|
3973
4889
|
});
|
|
4890
|
+
const collapsed = collapsedIds.has(block.id);
|
|
4891
|
+
const canDragBlock = total > 1 && !locked;
|
|
4892
|
+
const blockTitle = text(block.title) || text(block.label) || block.name || formatMessage({
|
|
4893
|
+
id: 'untitledBlock'
|
|
4894
|
+
});
|
|
3974
4895
|
return /*#__PURE__*/jsxRuntime.jsxs("section", {
|
|
3975
|
-
className: `${style['block-section']} ${style[`block-kind-${block.kind}`] || ''} ${depth > 0 ? style['block-section-nested'] : ''}`.trim(),
|
|
4896
|
+
className: `${style['block-section']} ${style[`block-kind-${block.kind}`] || ''} ${depth > 0 ? style['block-section-nested'] : ''} ${collapsed ? style['is-collapsed'] : ''}`.trim(),
|
|
3976
4897
|
children: [/*#__PURE__*/jsxRuntime.jsxs("header", {
|
|
3977
4898
|
className: style['block-section-header'],
|
|
3978
4899
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3979
|
-
className: style['block-header-
|
|
3980
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(
|
|
4900
|
+
className: style['block-header-meta'],
|
|
4901
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("button", {
|
|
4902
|
+
type: "button",
|
|
4903
|
+
className: `${style['block-collapse-btn']} ${collapsed ? '' : style['is-expanded']}`.trim(),
|
|
4904
|
+
title: formatMessage({
|
|
4905
|
+
id: collapsed ? 'expandBlock' : 'collapseBlock'
|
|
4906
|
+
}),
|
|
4907
|
+
"aria-expanded": !collapsed,
|
|
4908
|
+
onClick: () => toggleCollapsed(block.id),
|
|
4909
|
+
children: /*#__PURE__*/jsxRuntime.jsx(icons.RightOutlined, {})
|
|
4910
|
+
}), isMobile && canDragBlock ? renderDragHandle(getBlockScope(parentKey), true) : null, /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
|
|
3981
4911
|
bordered: false,
|
|
3982
4912
|
color: definition?.color || 'default',
|
|
3983
4913
|
icon: BLOCK_KIND_ICONS[block.kind],
|
|
3984
4914
|
children: formatMessage({
|
|
3985
4915
|
id: `blockKind_${block.kind}`
|
|
3986
4916
|
})
|
|
3987
|
-
}), /*#__PURE__*/jsxRuntime.jsx(Text$4, {
|
|
3988
|
-
strong: true,
|
|
3989
|
-
ellipsis: true,
|
|
3990
|
-
className: style['block-title'],
|
|
3991
|
-
children: text(block.title) || text(block.label) || block.name || formatMessage({
|
|
3992
|
-
id: 'untitledBlock'
|
|
3993
|
-
})
|
|
3994
4917
|
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
3995
4918
|
className: style['block-summary'],
|
|
3996
4919
|
children: summary
|
|
3997
|
-
})
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
title: formatMessage({
|
|
4005
|
-
id: 'moveUp'
|
|
4920
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(antd.Space, {
|
|
4921
|
+
size: 4,
|
|
4922
|
+
className: style['block-header-actions'],
|
|
4923
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(RowActions$1, {
|
|
4924
|
+
isMobile: isMobile,
|
|
4925
|
+
moreTitle: formatMessage({
|
|
4926
|
+
id: 'moreActions'
|
|
4006
4927
|
}),
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4928
|
+
prefix: !isMobile && canDragBlock ? renderDragHandle(getBlockScope(parentKey)) : null,
|
|
4929
|
+
actions: orderActions(isMobile, [{
|
|
4930
|
+
key: 'up',
|
|
4931
|
+
label: formatMessage({
|
|
4932
|
+
id: 'moveUp'
|
|
4933
|
+
}),
|
|
4934
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowUpOutlined, {}),
|
|
4935
|
+
disabled: blockIndex === 0 || locked || blockHasLockedField(siblings[blockIndex - 1]),
|
|
4936
|
+
onClick: () => onMoveBlock(block.id, 'up')
|
|
4937
|
+
}, {
|
|
4938
|
+
key: 'down',
|
|
4939
|
+
label: formatMessage({
|
|
4940
|
+
id: 'moveDown'
|
|
4941
|
+
}),
|
|
4942
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowDownOutlined, {}),
|
|
4943
|
+
disabled: blockIndex === total - 1 || locked || blockHasLockedField(siblings[blockIndex + 1]),
|
|
4944
|
+
onClick: () => onMoveBlock(block.id, 'down')
|
|
4945
|
+
}, {
|
|
4946
|
+
key: 'setting',
|
|
4947
|
+
label: formatMessage({
|
|
4948
|
+
id: 'editBlock'
|
|
4949
|
+
}),
|
|
4950
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(icons.SettingOutlined, {}),
|
|
4951
|
+
onClick: () => onEditBlock(block)
|
|
4952
|
+
}, locked ? null : {
|
|
4953
|
+
key: 'delete',
|
|
4954
|
+
label: formatMessage({
|
|
4955
|
+
id: 'deleteBlock'
|
|
4956
|
+
}),
|
|
4957
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(icons.DeleteOutlined, {}),
|
|
4958
|
+
danger: true,
|
|
4959
|
+
onClick: () => onDeleteBlock(block.id)
|
|
4960
|
+
}])
|
|
4961
|
+
}), canAddField ? renderAddFieldButton({
|
|
4962
|
+
menuKey: block.id,
|
|
4963
|
+
depth,
|
|
4964
|
+
onAddFieldClick: () => onAddField(block.id),
|
|
4965
|
+
onAddChildBlock: supportsChildModules ? kind => onAddBlock(kind, {
|
|
4966
|
+
parentBlockId: block.id
|
|
4967
|
+
}) : undefined
|
|
4968
|
+
}) : null]
|
|
4969
|
+
})]
|
|
4970
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4971
|
+
className: style['block-title'],
|
|
4972
|
+
title: blockTitle,
|
|
4973
|
+
children: blockTitle
|
|
4039
4974
|
})]
|
|
4040
|
-
}), renderBlockChildren(block, depth)]
|
|
4975
|
+
}), collapsed ? null : renderBlockChildren(block, depth)]
|
|
4041
4976
|
}, block.id);
|
|
4042
4977
|
};
|
|
4043
4978
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -4086,88 +5021,165 @@ const BlockListPanel = ({
|
|
|
4086
5021
|
description: formatMessage({
|
|
4087
5022
|
id: 'emptyBlockList'
|
|
4088
5023
|
})
|
|
4089
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(
|
|
5024
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(SortableList$1, {
|
|
4090
5025
|
className: style['block-list'],
|
|
5026
|
+
scope: getBlockScope('root'),
|
|
5027
|
+
list: blocks,
|
|
5028
|
+
isFixed: blockHasLockedField,
|
|
5029
|
+
onMove: onMoveBlock,
|
|
4091
5030
|
children: blocks.map((block, blockIndex) => renderBlockSection(block, blockIndex, blocks, 0))
|
|
4092
5031
|
})]
|
|
4093
5032
|
});
|
|
4094
5033
|
};
|
|
4095
5034
|
var BlockListPanel$1 = BlockListPanel;
|
|
4096
5035
|
|
|
5036
|
+
const TOGGLE_TYPES = [reactFormAntd.Checkbox, reactFormAntd.Switch];
|
|
5037
|
+
|
|
5038
|
+
/**
|
|
5039
|
+
* 输入类在前、开关类在后。开关包进独立网格:输入项为奇数或带 display 条件时,
|
|
5040
|
+
* 开关仍从新的一行开始,不会补进输入框旁的空位。
|
|
5041
|
+
*/
|
|
5042
|
+
const arrangeEditorItems = (list, column = 1) => {
|
|
5043
|
+
const items = (list || []).filter(Boolean);
|
|
5044
|
+
const isToggle = item => TOGGLE_TYPES.includes(item.type);
|
|
5045
|
+
const inputs = items.filter(item => !isToggle(item));
|
|
5046
|
+
const toggles = items.filter(isToggle);
|
|
5047
|
+
if (!inputs.length || !toggles.length) {
|
|
5048
|
+
return [...inputs, ...toggles];
|
|
5049
|
+
}
|
|
5050
|
+
return [...inputs, /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
|
|
5051
|
+
block: true,
|
|
5052
|
+
className: style['editor-toggles'],
|
|
5053
|
+
column: column,
|
|
5054
|
+
gap: 12,
|
|
5055
|
+
list: toggles
|
|
5056
|
+
}, "editor-toggles")];
|
|
5057
|
+
};
|
|
5058
|
+
const getEditorColumn = isMobile => isMobile ? 1 : 2;
|
|
5059
|
+
const getPropertyModalProps = (isMobile, width) => ({
|
|
5060
|
+
className: style['property-modal'],
|
|
5061
|
+
width: isMobile ? 'calc(100vw - 32px)' : width
|
|
5062
|
+
});
|
|
5063
|
+
|
|
5064
|
+
const SECTION_ORDER = ['basic', 'listRule', 'choiceRule', 'choiceData', 'rule', 'layout'];
|
|
5065
|
+
const SECTION_TEXT = {
|
|
5066
|
+
basic: ['blockBasicSection', 'blockBasicSectionDesc'],
|
|
5067
|
+
listRule: ['blockListRuleSection', 'blockListRuleSectionDesc'],
|
|
5068
|
+
choiceRule: ['choiceRuleSection', 'choiceRuleSectionDesc'],
|
|
5069
|
+
choiceData: ['choiceDataSection', 'choiceDataSectionDesc'],
|
|
5070
|
+
rule: ['fieldRule', 'matrixScaleRuleDesc'],
|
|
5071
|
+
layout: ['blockLayoutSection', 'blockLayoutSectionDesc']
|
|
5072
|
+
};
|
|
4097
5073
|
const BlockConfigFields = ({
|
|
4098
5074
|
kind
|
|
4099
5075
|
}) => {
|
|
4100
5076
|
const {
|
|
4101
5077
|
formatMessage
|
|
4102
5078
|
} = reactIntl.useIntl();
|
|
5079
|
+
const column = getEditorColumn(responsiveUtils.useIsMobile());
|
|
4103
5080
|
const definition = getBlockDefinition(kind);
|
|
4104
5081
|
const fieldTypeOptions = react.useMemo(() => getFieldTypes(formatMessage), [formatMessage]);
|
|
4105
|
-
const
|
|
5082
|
+
const sections = {
|
|
5083
|
+
basic: [],
|
|
5084
|
+
listRule: [],
|
|
5085
|
+
choiceRule: [],
|
|
5086
|
+
choiceData: [],
|
|
5087
|
+
rule: [],
|
|
5088
|
+
layout: []
|
|
5089
|
+
};
|
|
5090
|
+
const add = function (section) {
|
|
5091
|
+
return sections[section].push(...[].slice.call(arguments, 1).filter(Boolean));
|
|
5092
|
+
};
|
|
4106
5093
|
const isListKind = kind === 'list' || kind === 'tableList' || kind === 'editableList';
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
}
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
5094
|
+
const titleInput = placeholderId => /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
5095
|
+
name: "title",
|
|
5096
|
+
label: formatMessage({
|
|
5097
|
+
id: 'blockTitle'
|
|
5098
|
+
}),
|
|
5099
|
+
placeholder: formatMessage({
|
|
5100
|
+
id: placeholderId || 'blockTitlePlaceholder'
|
|
5101
|
+
})
|
|
5102
|
+
}, "title");
|
|
5103
|
+
const subtitleInput = /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
5104
|
+
name: "subtitle",
|
|
5105
|
+
label: formatMessage({
|
|
5106
|
+
id: 'blockSubtitle'
|
|
5107
|
+
}),
|
|
5108
|
+
placeholder: formatMessage({
|
|
5109
|
+
id: 'blockSubtitlePlaceholder'
|
|
5110
|
+
})
|
|
5111
|
+
}, "subtitle");
|
|
5112
|
+
const nameInput = /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
|
|
5113
|
+
name: "name",
|
|
5114
|
+
label: formatMessage({
|
|
5115
|
+
id: 'blockName'
|
|
5116
|
+
}),
|
|
5117
|
+
rule: "REQ",
|
|
5118
|
+
placeholder: formatMessage({
|
|
5119
|
+
id: 'fieldNamePlaceholder'
|
|
5120
|
+
})
|
|
5121
|
+
}, "name");
|
|
5122
|
+
const columnInput = /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.InputNumber, {
|
|
5123
|
+
name: "column",
|
|
5124
|
+
label: formatMessage({
|
|
5125
|
+
id: 'formColumnPlaceholder'
|
|
5126
|
+
}),
|
|
5127
|
+
min: 1,
|
|
5128
|
+
max: 4
|
|
5129
|
+
}, "column");
|
|
5130
|
+
const borderedCheckbox = /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
5131
|
+
name: "bordered",
|
|
5132
|
+
children: formatMessage({
|
|
5133
|
+
id: 'blockBordered'
|
|
5134
|
+
})
|
|
5135
|
+
}, "bordered");
|
|
5136
|
+
const fieldTypeSelect = /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Select, {
|
|
5137
|
+
name: "fieldType",
|
|
5138
|
+
label: formatMessage({
|
|
5139
|
+
id: 'multiFieldType'
|
|
5140
|
+
}),
|
|
5141
|
+
rule: "REQ",
|
|
5142
|
+
options: fieldTypeOptions
|
|
5143
|
+
}, "fieldType");
|
|
5144
|
+
const addTextInput = /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
5145
|
+
name: "addText",
|
|
5146
|
+
label: formatMessage({
|
|
5147
|
+
id: 'blockAddText'
|
|
5148
|
+
}),
|
|
5149
|
+
placeholder: formatMessage({
|
|
5150
|
+
id: 'blockAddTextPlaceholder'
|
|
5151
|
+
})
|
|
5152
|
+
}, "addText");
|
|
5153
|
+
if (kind === 'formInfo') {
|
|
5154
|
+
add('basic', titleInput(), subtitleInput);
|
|
5155
|
+
add('layout', columnInput, /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.InputNumber, {
|
|
4141
5156
|
name: "gap",
|
|
4142
5157
|
label: formatMessage({
|
|
4143
5158
|
id: 'blockGap'
|
|
4144
5159
|
}),
|
|
4145
5160
|
min: 0,
|
|
4146
5161
|
max: 48
|
|
4147
|
-
}, "gap")
|
|
4148
|
-
name: "bordered",
|
|
4149
|
-
children: formatMessage({
|
|
4150
|
-
id: 'blockBordered'
|
|
4151
|
-
})
|
|
4152
|
-
}, "bordered"), kind === 'formInfo' ? /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
5162
|
+
}, "gap"), borderedCheckbox, /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
4153
5163
|
name: "showIndex",
|
|
4154
5164
|
children: formatMessage({
|
|
4155
5165
|
id: 'blockShowIndex'
|
|
4156
5166
|
})
|
|
4157
|
-
}, "showIndex")
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
name: "addText",
|
|
5167
|
+
}, "showIndex"));
|
|
5168
|
+
}
|
|
5169
|
+
if (kind === 'object') {
|
|
5170
|
+
add('basic', titleInput(), nameInput);
|
|
5171
|
+
add('layout', columnInput, /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.InputNumber, {
|
|
5172
|
+
name: "gap",
|
|
4164
5173
|
label: formatMessage({
|
|
4165
|
-
id: '
|
|
5174
|
+
id: 'blockGap'
|
|
4166
5175
|
}),
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
5176
|
+
min: 0,
|
|
5177
|
+
max: 48
|
|
5178
|
+
}, "gap"), borderedCheckbox);
|
|
5179
|
+
}
|
|
5180
|
+
if (isListKind) {
|
|
5181
|
+
add('basic', titleInput(), nameInput);
|
|
5182
|
+
add('listRule', addTextInput, kind === 'editableList' ? /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Select, {
|
|
4171
5183
|
name: "addPosition",
|
|
4172
5184
|
label: formatMessage({
|
|
4173
5185
|
id: 'blockAddPosition'
|
|
@@ -4178,30 +5190,29 @@ const BlockConfigFields = ({
|
|
|
4178
5190
|
}),
|
|
4179
5191
|
value
|
|
4180
5192
|
}))
|
|
4181
|
-
}, "addPosition") : null,
|
|
4182
|
-
name: "maxLength",
|
|
4183
|
-
label: formatMessage({
|
|
4184
|
-
id: 'blockMaxLength'
|
|
4185
|
-
}),
|
|
4186
|
-
min: 1
|
|
4187
|
-
}, "maxLength") : null, isListKind ? /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.InputNumber, {
|
|
5193
|
+
}, "addPosition") : null, /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.InputNumber, {
|
|
4188
5194
|
name: "minLength",
|
|
4189
5195
|
label: formatMessage({
|
|
4190
5196
|
id: 'blockMinLength'
|
|
4191
5197
|
}),
|
|
4192
5198
|
min: 0
|
|
4193
|
-
}, "minLength")
|
|
4194
|
-
|
|
4195
|
-
if (kind === 'choice') {
|
|
4196
|
-
list.push(/*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
4197
|
-
name: "title",
|
|
5199
|
+
}, "minLength"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.InputNumber, {
|
|
5200
|
+
name: "maxLength",
|
|
4198
5201
|
label: formatMessage({
|
|
4199
|
-
id: '
|
|
5202
|
+
id: 'blockMaxLength'
|
|
4200
5203
|
}),
|
|
4201
|
-
|
|
4202
|
-
|
|
5204
|
+
min: 1
|
|
5205
|
+
}, "maxLength"));
|
|
5206
|
+
add('layout', columnInput, borderedCheckbox, kind === 'list' ? /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
5207
|
+
name: "important",
|
|
5208
|
+
children: formatMessage({
|
|
5209
|
+
id: 'blockImportant'
|
|
4203
5210
|
})
|
|
4204
|
-
}, "
|
|
5211
|
+
}, "important") : null);
|
|
5212
|
+
}
|
|
5213
|
+
if (kind === 'choice') {
|
|
5214
|
+
add('basic', titleInput('choiceTitlePlaceholder'));
|
|
5215
|
+
add('choiceRule', /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Select, {
|
|
4205
5216
|
name: "mode",
|
|
4206
5217
|
label: formatMessage({
|
|
4207
5218
|
id: 'choiceMode'
|
|
@@ -4242,12 +5253,8 @@ const BlockConfigFields = ({
|
|
|
4242
5253
|
display: ({
|
|
4243
5254
|
openApi
|
|
4244
5255
|
}) => openApi?.data?.mode === 'multiple'
|
|
4245
|
-
}, "maxLength")
|
|
4246
|
-
|
|
4247
|
-
children: formatMessage({
|
|
4248
|
-
id: 'choiceSelectorInData'
|
|
4249
|
-
})
|
|
4250
|
-
}, "selectorInData"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
|
|
5256
|
+
}, "maxLength"));
|
|
5257
|
+
add('choiceData', /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
|
|
4251
5258
|
name: "selectorName",
|
|
4252
5259
|
label: formatMessage({
|
|
4253
5260
|
id: 'choiceSelectorName'
|
|
@@ -4258,85 +5265,102 @@ const BlockConfigFields = ({
|
|
|
4258
5265
|
display: ({
|
|
4259
5266
|
openApi
|
|
4260
5267
|
}) => openApi?.data?.selectorInData !== false
|
|
4261
|
-
}, "selectorName")
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
name: "name",
|
|
4266
|
-
label: formatMessage({
|
|
4267
|
-
id: 'blockName'
|
|
4268
|
-
}),
|
|
4269
|
-
rule: "REQ",
|
|
4270
|
-
placeholder: formatMessage({
|
|
4271
|
-
id: 'fieldNamePlaceholder'
|
|
4272
|
-
})
|
|
4273
|
-
}, "name"), /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
4274
|
-
name: "label",
|
|
4275
|
-
label: formatMessage({
|
|
4276
|
-
id: 'fieldLabel'
|
|
4277
|
-
}),
|
|
4278
|
-
rule: "REQ",
|
|
4279
|
-
placeholder: formatMessage({
|
|
4280
|
-
id: 'fieldLabelPlaceholder'
|
|
4281
|
-
})
|
|
4282
|
-
}, "label"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Select, {
|
|
4283
|
-
name: "fieldType",
|
|
4284
|
-
label: formatMessage({
|
|
4285
|
-
id: 'multiFieldType'
|
|
4286
|
-
}),
|
|
4287
|
-
rule: "REQ",
|
|
4288
|
-
options: fieldTypeOptions
|
|
4289
|
-
}, "fieldType"), /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
4290
|
-
name: "addText",
|
|
4291
|
-
label: formatMessage({
|
|
4292
|
-
id: 'blockAddText'
|
|
4293
|
-
}),
|
|
4294
|
-
placeholder: formatMessage({
|
|
4295
|
-
id: 'blockAddTextPlaceholder'
|
|
5268
|
+
}, "selectorName"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
5269
|
+
name: "selectorInData",
|
|
5270
|
+
children: formatMessage({
|
|
5271
|
+
id: 'choiceSelectorInData'
|
|
4296
5272
|
})
|
|
4297
|
-
}, "
|
|
5273
|
+
}, "selectorInData"));
|
|
4298
5274
|
}
|
|
4299
|
-
if (kind === '
|
|
4300
|
-
|
|
4301
|
-
name: "
|
|
5275
|
+
if (kind === 'multiField') {
|
|
5276
|
+
add('basic', nameInput, /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
5277
|
+
name: "label",
|
|
4302
5278
|
label: formatMessage({
|
|
4303
|
-
id: '
|
|
5279
|
+
id: 'fieldLabel'
|
|
4304
5280
|
}),
|
|
5281
|
+
rule: "REQ",
|
|
4305
5282
|
placeholder: formatMessage({
|
|
4306
|
-
id: '
|
|
5283
|
+
id: 'fieldLabelPlaceholder'
|
|
4307
5284
|
})
|
|
4308
|
-
}, "
|
|
4309
|
-
|
|
5285
|
+
}, "label"), fieldTypeSelect, addTextInput);
|
|
5286
|
+
}
|
|
5287
|
+
if (kind === 'matrixScale') {
|
|
5288
|
+
add('basic', titleInput(), nameInput, /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
5289
|
+
name: "rowTitle",
|
|
4310
5290
|
label: formatMessage({
|
|
4311
|
-
id: '
|
|
5291
|
+
id: 'matrixScaleRowTitle'
|
|
4312
5292
|
}),
|
|
4313
5293
|
placeholder: formatMessage({
|
|
4314
|
-
id: '
|
|
5294
|
+
id: 'matrixScaleRowTitlePlaceholder'
|
|
4315
5295
|
})
|
|
4316
|
-
}, "
|
|
4317
|
-
|
|
5296
|
+
}, "rowTitle"), fieldTypeSelect);
|
|
5297
|
+
add('rule', /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
5298
|
+
name: "required",
|
|
4318
5299
|
children: formatMessage({
|
|
4319
|
-
id: '
|
|
5300
|
+
id: 'matrixScaleRequired'
|
|
4320
5301
|
})
|
|
4321
|
-
}, "
|
|
5302
|
+
}, "required"));
|
|
5303
|
+
add('layout', /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Select, {
|
|
5304
|
+
name: "layout",
|
|
5305
|
+
label: formatMessage({
|
|
5306
|
+
id: 'matrixScaleLayout'
|
|
5307
|
+
}),
|
|
5308
|
+
rule: "REQ",
|
|
5309
|
+
options: MATRIX_LAYOUTS.map(value => ({
|
|
5310
|
+
label: formatMessage({
|
|
5311
|
+
id: `matrixScaleLayout_${value}`
|
|
5312
|
+
}),
|
|
5313
|
+
value
|
|
5314
|
+
}))
|
|
5315
|
+
}, "layout"), borderedCheckbox);
|
|
5316
|
+
}
|
|
5317
|
+
if (kind === 'steps') {
|
|
5318
|
+
add('basic', titleInput(), subtitleInput);
|
|
5319
|
+
add('layout', /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Select, {
|
|
5320
|
+
name: "stepsStyle",
|
|
5321
|
+
label: formatMessage({
|
|
5322
|
+
id: 'stepsStyle'
|
|
5323
|
+
}),
|
|
5324
|
+
options: STEPS_STYLES.map(value => ({
|
|
5325
|
+
label: formatMessage({
|
|
5326
|
+
id: `stepsStyle_${value}`
|
|
5327
|
+
}),
|
|
5328
|
+
value
|
|
5329
|
+
}))
|
|
5330
|
+
}, "stepsStyle"), borderedCheckbox, /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
4322
5331
|
name: "autoStep",
|
|
4323
5332
|
children: formatMessage({
|
|
4324
5333
|
id: 'blockAutoStep'
|
|
4325
5334
|
})
|
|
4326
5335
|
}, "autoStep"));
|
|
4327
5336
|
}
|
|
4328
|
-
return /*#__PURE__*/jsxRuntime.
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
5337
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
5338
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5339
|
+
className: style['editor-intro'],
|
|
5340
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
|
|
5341
|
+
bordered: false,
|
|
5342
|
+
color: definition?.color || 'default',
|
|
5343
|
+
children: formatMessage({
|
|
5344
|
+
id: `blockKind_${kind}`
|
|
5345
|
+
})
|
|
5346
|
+
}), definition ? /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
5347
|
+
children: formatMessage({
|
|
5348
|
+
id: definition.descriptionId
|
|
5349
|
+
})
|
|
5350
|
+
}) : null]
|
|
5351
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5352
|
+
className: style['field-editor-form'],
|
|
5353
|
+
children: SECTION_ORDER.filter(key => sections[key].length).map(key => /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
|
|
5354
|
+
title: formatMessage({
|
|
5355
|
+
id: SECTION_TEXT[key][0]
|
|
5356
|
+
}),
|
|
5357
|
+
subtitle: formatMessage({
|
|
5358
|
+
id: SECTION_TEXT[key][1]
|
|
5359
|
+
}),
|
|
5360
|
+
column: column,
|
|
5361
|
+
list: arrangeEditorItems(sections[key], column)
|
|
5362
|
+
}, key))
|
|
5363
|
+
})]
|
|
4340
5364
|
});
|
|
4341
5365
|
};
|
|
4342
5366
|
const BlockEditorModal = ({
|
|
@@ -4374,7 +5398,7 @@ const BlockEditorModal = ({
|
|
|
4374
5398
|
}),
|
|
4375
5399
|
open: open,
|
|
4376
5400
|
onCancel: onCancel,
|
|
4377
|
-
|
|
5401
|
+
...getPropertyModalProps(isMobile, 720),
|
|
4378
5402
|
...(renderModal ? {
|
|
4379
5403
|
renderModal
|
|
4380
5404
|
} : {}),
|
|
@@ -4415,7 +5439,7 @@ const StepEditorModal = ({
|
|
|
4415
5439
|
}),
|
|
4416
5440
|
open: open,
|
|
4417
5441
|
onCancel: onCancel,
|
|
4418
|
-
|
|
5442
|
+
...getPropertyModalProps(isMobile, 560),
|
|
4419
5443
|
...(renderModal ? {
|
|
4420
5444
|
renderModal
|
|
4421
5445
|
} : {}),
|
|
@@ -4431,25 +5455,28 @@ const StepEditorModal = ({
|
|
|
4431
5455
|
cancelText: formatMessage({
|
|
4432
5456
|
id: 'cancel'
|
|
4433
5457
|
}),
|
|
4434
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
5458
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5459
|
+
className: `${style['field-editor-form']} ${style['is-plain']}`,
|
|
5460
|
+
children: /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
|
|
5461
|
+
column: getEditorColumn(isMobile),
|
|
5462
|
+
list: [/*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
5463
|
+
name: "title",
|
|
5464
|
+
label: formatMessage({
|
|
5465
|
+
id: 'stepTitle'
|
|
5466
|
+
}),
|
|
5467
|
+
rule: "REQ",
|
|
5468
|
+
placeholder: formatMessage({
|
|
5469
|
+
id: 'stepTitlePlaceholder'
|
|
5470
|
+
})
|
|
5471
|
+
}, "title"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.InputNumber, {
|
|
5472
|
+
name: "column",
|
|
5473
|
+
label: formatMessage({
|
|
5474
|
+
id: 'formColumnPlaceholder'
|
|
5475
|
+
}),
|
|
5476
|
+
min: 1,
|
|
5477
|
+
max: 4
|
|
5478
|
+
}, "column")]
|
|
5479
|
+
})
|
|
4453
5480
|
})
|
|
4454
5481
|
}, open ? step?.id ? `edit-${step.id}` : `add-step-${formData.title || 'new'}` : 'closed');
|
|
4455
5482
|
};
|
|
@@ -4475,7 +5502,7 @@ const ChoiceOptionEditorModal = ({
|
|
|
4475
5502
|
}),
|
|
4476
5503
|
open: open,
|
|
4477
5504
|
onCancel: onCancel,
|
|
4478
|
-
|
|
5505
|
+
...getPropertyModalProps(isMobile, 560),
|
|
4479
5506
|
...(renderModal ? {
|
|
4480
5507
|
renderModal
|
|
4481
5508
|
} : {}),
|
|
@@ -4491,26 +5518,26 @@ const ChoiceOptionEditorModal = ({
|
|
|
4491
5518
|
cancelText: formatMessage({
|
|
4492
5519
|
id: 'cancel'
|
|
4493
5520
|
}),
|
|
4494
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
5521
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5522
|
+
className: `${style['field-editor-form']} ${style['is-plain']}`,
|
|
5523
|
+
children: /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
|
|
5524
|
+
column: 1,
|
|
5525
|
+
list: [/*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
5526
|
+
name: "title",
|
|
5527
|
+
label: formatMessage({
|
|
5528
|
+
id: 'choiceOptionTitle'
|
|
5529
|
+
}),
|
|
5530
|
+
rule: "REQ",
|
|
5531
|
+
placeholder: formatMessage({
|
|
5532
|
+
id: 'choiceOptionTitlePlaceholder'
|
|
5533
|
+
})
|
|
5534
|
+
}, "title")]
|
|
5535
|
+
})
|
|
4506
5536
|
})
|
|
4507
5537
|
}, open ? option?.id ? `edit-option-${option.id}` : `add-option-${formData.title || 'new'}` : 'closed');
|
|
4508
5538
|
};
|
|
4509
5539
|
var ChoiceOptionEditorModal$1 = ChoiceOptionEditorModal;
|
|
4510
5540
|
|
|
4511
|
-
const {
|
|
4512
|
-
Text: Text$3
|
|
4513
|
-
} = antd.Typography;
|
|
4514
5541
|
const {
|
|
4515
5542
|
useOnChange
|
|
4516
5543
|
} = reactFormAntd.hooks;
|
|
@@ -4519,7 +5546,9 @@ const RulePresetsGroup = props => {
|
|
|
4519
5546
|
return render(antd.Checkbox.Group);
|
|
4520
5547
|
};
|
|
4521
5548
|
RulePresetsGroup.field = antd.Checkbox.Group;
|
|
4522
|
-
const RulePresetEditor = (
|
|
5549
|
+
const RulePresetEditor = ({
|
|
5550
|
+
column = 1
|
|
5551
|
+
}) => {
|
|
4523
5552
|
const {
|
|
4524
5553
|
formatMessage
|
|
4525
5554
|
} = reactIntl.useIntl();
|
|
@@ -4556,20 +5585,15 @@ const RulePresetEditor = () => {
|
|
|
4556
5585
|
display: ({
|
|
4557
5586
|
openApi
|
|
4558
5587
|
}) => (openApi?.data?.rulePresets || []).includes(RULE_LEN_PRESET)
|
|
4559
|
-
}, "lenMax")
|
|
4560
|
-
block: true,
|
|
4561
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Text$3, {
|
|
4562
|
-
type: "secondary",
|
|
4563
|
-
children: formatMessage({
|
|
4564
|
-
id: 'ruleEditorHint'
|
|
4565
|
-
})
|
|
4566
|
-
})
|
|
4567
|
-
}, "rule-hint")];
|
|
5588
|
+
}, "lenMax")];
|
|
4568
5589
|
return /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
|
|
4569
5590
|
title: formatMessage({
|
|
4570
5591
|
id: 'fieldRule'
|
|
4571
5592
|
}),
|
|
4572
|
-
|
|
5593
|
+
subtitle: formatMessage({
|
|
5594
|
+
id: 'ruleEditorHint'
|
|
5595
|
+
}),
|
|
5596
|
+
column: column,
|
|
4573
5597
|
list: list
|
|
4574
5598
|
});
|
|
4575
5599
|
};
|
|
@@ -5171,6 +6195,9 @@ const OptionsEditor = ({
|
|
|
5171
6195
|
title: formatMessage({
|
|
5172
6196
|
id: 'fieldOptions'
|
|
5173
6197
|
}),
|
|
6198
|
+
subtitle: formatMessage({
|
|
6199
|
+
id: 'fieldOptionsDesc'
|
|
6200
|
+
}),
|
|
5174
6201
|
column: 1,
|
|
5175
6202
|
list: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5176
6203
|
block: true,
|
|
@@ -5196,7 +6223,8 @@ const OptionsEditor = ({
|
|
|
5196
6223
|
var OptionsEditor$1 = OptionsEditor;
|
|
5197
6224
|
|
|
5198
6225
|
const SuperSelectPropsEditor = ({
|
|
5199
|
-
definition
|
|
6226
|
+
definition,
|
|
6227
|
+
column = 1
|
|
5200
6228
|
}) => {
|
|
5201
6229
|
const {
|
|
5202
6230
|
formatMessage
|
|
@@ -5285,13 +6313,17 @@ const SuperSelectPropsEditor = ({
|
|
|
5285
6313
|
title: formatMessage({
|
|
5286
6314
|
id: 'superSelectPropsSection'
|
|
5287
6315
|
}),
|
|
5288
|
-
|
|
5289
|
-
|
|
6316
|
+
subtitle: formatMessage({
|
|
6317
|
+
id: 'fieldPropsSectionDesc'
|
|
6318
|
+
}),
|
|
6319
|
+
column: column,
|
|
6320
|
+
list: arrangeEditorItems(list, column)
|
|
5290
6321
|
});
|
|
5291
6322
|
};
|
|
5292
6323
|
var SuperSelectPropsEditor$1 = SuperSelectPropsEditor;
|
|
5293
6324
|
|
|
5294
|
-
const BUILTIN_PROP_TYPES = ['Input', 'TextArea', 'InputNumber', 'Select', 'DatePicker', 'Switch', 'RadioGroup', 'CheckboxGroup'];
|
|
6325
|
+
const BUILTIN_PROP_TYPES = ['Input', 'TextArea', 'InputNumber', 'Select', 'DatePicker', 'Switch', 'RadioGroup', 'CheckboxGroup', 'RadioGroupOther', 'CheckboxGroupOther'];
|
|
6326
|
+
const CHOICE_OTHER_TYPES = ['RadioGroupOther', 'CheckboxGroupOther'];
|
|
5295
6327
|
const buildPropsSchemaList = (schema, formatMessage) => (schema || []).filter(item => item?.name).map(item => {
|
|
5296
6328
|
if (item.type === 'boolean') {
|
|
5297
6329
|
return /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
@@ -5525,19 +6557,78 @@ const buildBuiltinList = (type, formatMessage) => {
|
|
|
5525
6557
|
}, "unCheckedChildren")];
|
|
5526
6558
|
case 'RadioGroup':
|
|
5527
6559
|
case 'CheckboxGroup':
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
6560
|
+
case 'RadioGroupOther':
|
|
6561
|
+
case 'CheckboxGroupOther':
|
|
6562
|
+
{
|
|
6563
|
+
const list = [/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
6564
|
+
name: "inline",
|
|
6565
|
+
children: formatMessage({
|
|
6566
|
+
id: 'propOptionsInline'
|
|
6567
|
+
})
|
|
6568
|
+
}, "inline"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
6569
|
+
name: "modern",
|
|
6570
|
+
children: formatMessage({
|
|
6571
|
+
id: 'propChoiceModern'
|
|
6572
|
+
})
|
|
6573
|
+
}, "modern"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
6574
|
+
name: "block",
|
|
6575
|
+
children: formatMessage({
|
|
6576
|
+
id: 'propChoiceBlock'
|
|
6577
|
+
})
|
|
6578
|
+
}, "block"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Select, {
|
|
6579
|
+
name: "indexType",
|
|
6580
|
+
label: formatMessage({
|
|
6581
|
+
id: 'propChoiceIndexType'
|
|
6582
|
+
}),
|
|
6583
|
+
options: [{
|
|
6584
|
+
label: formatMessage({
|
|
6585
|
+
id: 'propChoiceIndexTypeLetter'
|
|
6586
|
+
}),
|
|
6587
|
+
value: 'letter'
|
|
6588
|
+
}, {
|
|
6589
|
+
label: formatMessage({
|
|
6590
|
+
id: 'propChoiceIndexTypeNumber'
|
|
6591
|
+
}),
|
|
6592
|
+
value: 'number'
|
|
6593
|
+
}, {
|
|
6594
|
+
label: formatMessage({
|
|
6595
|
+
id: 'propChoiceIndexTypeCheck'
|
|
6596
|
+
}),
|
|
6597
|
+
value: 'check'
|
|
6598
|
+
}],
|
|
6599
|
+
display: ({
|
|
6600
|
+
openApi
|
|
6601
|
+
}) => !!openApi?.data?.modern
|
|
6602
|
+
}, "indexType")];
|
|
6603
|
+
if (CHOICE_OTHER_TYPES.includes(type)) {
|
|
6604
|
+
list.push(/*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
6605
|
+
name: "otherLabel",
|
|
6606
|
+
label: formatMessage({
|
|
6607
|
+
id: 'propChoiceOtherLabel'
|
|
6608
|
+
}),
|
|
6609
|
+
placeholder: formatMessage({
|
|
6610
|
+
id: 'propChoiceOtherLabelHint'
|
|
6611
|
+
})
|
|
6612
|
+
}, "otherLabel"), /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
6613
|
+
name: "otherPlaceholder",
|
|
6614
|
+
label: formatMessage({
|
|
6615
|
+
id: 'propChoiceOtherPlaceholder'
|
|
6616
|
+
}),
|
|
6617
|
+
placeholder: formatMessage({
|
|
6618
|
+
id: 'propChoiceOtherPlaceholderHint'
|
|
6619
|
+
})
|
|
6620
|
+
}, "otherPlaceholder"));
|
|
6621
|
+
}
|
|
6622
|
+
return list;
|
|
6623
|
+
}
|
|
5534
6624
|
default:
|
|
5535
6625
|
return [];
|
|
5536
6626
|
}
|
|
5537
6627
|
};
|
|
5538
6628
|
const FieldPropsEditor = ({
|
|
5539
6629
|
type,
|
|
5540
|
-
definition: definitionProp
|
|
6630
|
+
definition: definitionProp,
|
|
6631
|
+
column = 1
|
|
5541
6632
|
}) => {
|
|
5542
6633
|
const {
|
|
5543
6634
|
formatMessage
|
|
@@ -5559,8 +6650,11 @@ const FieldPropsEditor = ({
|
|
|
5559
6650
|
title: formatMessage({
|
|
5560
6651
|
id: 'fieldPropsSection'
|
|
5561
6652
|
}),
|
|
5562
|
-
|
|
5563
|
-
|
|
6653
|
+
subtitle: formatMessage({
|
|
6654
|
+
id: 'fieldPropsSectionDesc'
|
|
6655
|
+
}),
|
|
6656
|
+
column: column,
|
|
6657
|
+
list: arrangeEditorItems(list, column)
|
|
5564
6658
|
});
|
|
5565
6659
|
};
|
|
5566
6660
|
const hasFieldPropsEditor = (type, definition) => {
|
|
@@ -5721,6 +6815,17 @@ const ConditionValueInput = ({
|
|
|
5721
6815
|
value: item.value,
|
|
5722
6816
|
label: resolveLocaleText(item.label, locale) || String(item.value)
|
|
5723
6817
|
}));
|
|
6818
|
+
if (trigger?.type === 'RadioGroupOther' || trigger?.type === 'CheckboxGroupOther') {
|
|
6819
|
+
const otherValue = trigger?.props?.otherOption?.value != null && String(trigger.props.otherOption.value).trim() ? String(trigger.props.otherOption.value).trim() : 'other';
|
|
6820
|
+
if (!options.some(item => String(item.value) === otherValue)) {
|
|
6821
|
+
options.push({
|
|
6822
|
+
value: otherValue,
|
|
6823
|
+
label: resolveLocaleText(trigger?.props?.otherOption?.label, locale) || formatMessage({
|
|
6824
|
+
id: 'FieldTypeOtherOption'
|
|
6825
|
+
})
|
|
6826
|
+
});
|
|
6827
|
+
}
|
|
6828
|
+
}
|
|
5724
6829
|
const value = multiple ? Array.isArray(condition.value) ? condition.value : condition.value != null ? [condition.value] : [] : Array.isArray(condition.value) ? condition.value[0] : condition.value;
|
|
5725
6830
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
5726
6831
|
className: style['visible-when-value']
|
|
@@ -5991,6 +7096,7 @@ const FieldConfigFields = ({
|
|
|
5991
7096
|
const {
|
|
5992
7097
|
openApi
|
|
5993
7098
|
} = reactFormAntd.useFormContext();
|
|
7099
|
+
const column = getEditorColumn(responsiveUtils.useIsMobile());
|
|
5994
7100
|
const [fieldType, setFieldType] = react.useState(initialType);
|
|
5995
7101
|
const fieldTypeOptions = react.useMemo(() => getFieldTypes(formatMessage), [formatMessage]);
|
|
5996
7102
|
const definition = getFieldDefinition(fieldType);
|
|
@@ -6022,7 +7128,7 @@ const FieldConfigFields = ({
|
|
|
6022
7128
|
});
|
|
6023
7129
|
});
|
|
6024
7130
|
};
|
|
6025
|
-
const
|
|
7131
|
+
const basicList = [/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Select, {
|
|
6026
7132
|
name: "type",
|
|
6027
7133
|
label: formatMessage({
|
|
6028
7134
|
id: 'fieldType'
|
|
@@ -6061,6 +7167,7 @@ const FieldConfigFields = ({
|
|
|
6061
7167
|
})
|
|
6062
7168
|
}, "tips"), /*#__PURE__*/jsxRuntime.jsx(LocaleTextArea, {
|
|
6063
7169
|
name: "description",
|
|
7170
|
+
block: true,
|
|
6064
7171
|
label: formatMessage({
|
|
6065
7172
|
id: 'fieldDescription'
|
|
6066
7173
|
}),
|
|
@@ -6069,7 +7176,7 @@ const FieldConfigFields = ({
|
|
|
6069
7176
|
}),
|
|
6070
7177
|
rows: 2
|
|
6071
7178
|
}, "description")];
|
|
6072
|
-
|
|
7179
|
+
const displayList = [/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
6073
7180
|
name: "block",
|
|
6074
7181
|
children: formatMessage({
|
|
6075
7182
|
id: 'fieldBlock'
|
|
@@ -6079,21 +7186,26 @@ const FieldConfigFields = ({
|
|
|
6079
7186
|
children: formatMessage({
|
|
6080
7187
|
id: 'fieldHidden'
|
|
6081
7188
|
})
|
|
6082
|
-
}, "hidden")
|
|
7189
|
+
}, "hidden")];
|
|
6083
7190
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6084
7191
|
className: style['field-editor-form'],
|
|
6085
7192
|
children: [/*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
|
|
6086
7193
|
title: formatMessage({
|
|
6087
7194
|
id: 'fieldBasicSection'
|
|
6088
7195
|
}),
|
|
6089
|
-
|
|
6090
|
-
|
|
7196
|
+
subtitle: formatMessage({
|
|
7197
|
+
id: 'fieldBasicSectionDesc'
|
|
7198
|
+
}),
|
|
7199
|
+
column: column,
|
|
7200
|
+
list: basicList
|
|
6091
7201
|
}), definition?.isSuperSelect ? /*#__PURE__*/jsxRuntime.jsx(SuperSelectPropsEditor$1, {
|
|
6092
|
-
definition: definition
|
|
7202
|
+
definition: definition,
|
|
7203
|
+
column: column
|
|
6093
7204
|
}) : hasFieldPropsEditor(fieldType, definition) ? /*#__PURE__*/jsxRuntime.jsx(FieldPropsEditor$1, {
|
|
6094
7205
|
type: fieldType,
|
|
6095
|
-
definition: definition
|
|
6096
|
-
|
|
7206
|
+
definition: definition,
|
|
7207
|
+
column: column
|
|
7208
|
+
}) : null, definition?.hasBuiltinData ? /*#__PURE__*/jsxRuntime.jsx(Text, {
|
|
6097
7209
|
type: "secondary",
|
|
6098
7210
|
children: formatMessage({
|
|
6099
7211
|
id: 'builtinDataHint'
|
|
@@ -6106,7 +7218,18 @@ const FieldConfigFields = ({
|
|
|
6106
7218
|
hasColumns: definition.hasColumns,
|
|
6107
7219
|
columns: columns,
|
|
6108
7220
|
onColumnsChange: onColumnsChange
|
|
6109
|
-
}) : null,
|
|
7221
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx(RulePresetEditor$1, {
|
|
7222
|
+
column: column
|
|
7223
|
+
}), /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
|
|
7224
|
+
title: formatMessage({
|
|
7225
|
+
id: 'fieldDisplaySection'
|
|
7226
|
+
}),
|
|
7227
|
+
subtitle: formatMessage({
|
|
7228
|
+
id: 'fieldDisplaySectionDesc'
|
|
7229
|
+
}),
|
|
7230
|
+
column: column,
|
|
7231
|
+
list: displayList
|
|
7232
|
+
}), conditionProps ? /*#__PURE__*/jsxRuntime.jsx(VisibleWhenEditor$1, {
|
|
6110
7233
|
...conditionProps,
|
|
6111
7234
|
value: visibleWhen,
|
|
6112
7235
|
onChange: onVisibleWhenChange
|
|
@@ -6218,7 +7341,7 @@ const FieldEditorModal = ({
|
|
|
6218
7341
|
}),
|
|
6219
7342
|
open: open,
|
|
6220
7343
|
onCancel: onCancel,
|
|
6221
|
-
|
|
7344
|
+
...getPropertyModalProps(isMobile, 760),
|
|
6222
7345
|
...(renderModal ? {
|
|
6223
7346
|
renderModal
|
|
6224
7347
|
} : {}),
|
|
@@ -6260,6 +7383,7 @@ const FormActionsEditor = ({
|
|
|
6260
7383
|
formatMessage
|
|
6261
7384
|
} = reactIntl.useIntl();
|
|
6262
7385
|
const isMobile = responsiveUtils.useIsMobile();
|
|
7386
|
+
const column = getEditorColumn(isMobile);
|
|
6263
7387
|
const formData = react.useMemo(() => normalizeFormActions(value), [value, open]);
|
|
6264
7388
|
const alignOptions = react.useMemo(() => [{
|
|
6265
7389
|
label: formatMessage({
|
|
@@ -6292,7 +7416,7 @@ const FormActionsEditor = ({
|
|
|
6292
7416
|
}),
|
|
6293
7417
|
open: open,
|
|
6294
7418
|
onCancel: onCancel,
|
|
6295
|
-
|
|
7419
|
+
...getPropertyModalProps(isMobile, 560),
|
|
6296
7420
|
...(renderModal ? {
|
|
6297
7421
|
renderModal
|
|
6298
7422
|
} : {}),
|
|
@@ -6309,9 +7433,15 @@ const FormActionsEditor = ({
|
|
|
6309
7433
|
id: 'cancel'
|
|
6310
7434
|
}),
|
|
6311
7435
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6312
|
-
className: style['form-actions-editor']
|
|
7436
|
+
className: `${style['field-editor-form']} ${style['form-actions-editor']}`,
|
|
6313
7437
|
children: [/*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
|
|
6314
|
-
|
|
7438
|
+
title: formatMessage({
|
|
7439
|
+
id: 'formActionsButtonsSection'
|
|
7440
|
+
}),
|
|
7441
|
+
subtitle: formatMessage({
|
|
7442
|
+
id: 'formActionsButtonsSectionDesc'
|
|
7443
|
+
}),
|
|
7444
|
+
column: column,
|
|
6315
7445
|
list: [/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Switch, {
|
|
6316
7446
|
name: "showSubmit",
|
|
6317
7447
|
label: formatMessage({
|
|
@@ -6329,10 +7459,7 @@ const FormActionsEditor = ({
|
|
|
6329
7459
|
display: ({
|
|
6330
7460
|
openApi
|
|
6331
7461
|
}) => Boolean(openApi?.data?.showSubmit)
|
|
6332
|
-
}, "submitText")
|
|
6333
|
-
}), /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
|
|
6334
|
-
column: 2,
|
|
6335
|
-
list: [/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Switch, {
|
|
7462
|
+
}, "submitText"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Switch, {
|
|
6336
7463
|
name: "showReset",
|
|
6337
7464
|
label: formatMessage({
|
|
6338
7465
|
id: 'formActionsShowReset'
|
|
@@ -6349,10 +7476,7 @@ const FormActionsEditor = ({
|
|
|
6349
7476
|
display: ({
|
|
6350
7477
|
openApi
|
|
6351
7478
|
}) => Boolean(openApi?.data?.showReset)
|
|
6352
|
-
}, "resetText")
|
|
6353
|
-
}), /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
|
|
6354
|
-
column: 2,
|
|
6355
|
-
list: [/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Switch, {
|
|
7479
|
+
}, "resetText"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Switch, {
|
|
6356
7480
|
name: "showCancel",
|
|
6357
7481
|
label: formatMessage({
|
|
6358
7482
|
id: 'formActionsShowCancel'
|
|
@@ -6370,39 +7494,37 @@ const FormActionsEditor = ({
|
|
|
6370
7494
|
openApi
|
|
6371
7495
|
}) => Boolean(openApi?.data?.showCancel)
|
|
6372
7496
|
}, "cancelText")]
|
|
6373
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
}, "gap")]
|
|
6405
|
-
})]
|
|
7497
|
+
}), /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
|
|
7498
|
+
title: formatMessage({
|
|
7499
|
+
id: 'formActionsLayoutSection'
|
|
7500
|
+
}),
|
|
7501
|
+
subtitle: formatMessage({
|
|
7502
|
+
id: 'formActionsLayoutSectionDesc'
|
|
7503
|
+
}),
|
|
7504
|
+
column: 1,
|
|
7505
|
+
list: [/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.RadioGroup, {
|
|
7506
|
+
name: "align",
|
|
7507
|
+
label: formatMessage({
|
|
7508
|
+
id: 'formActionsAlign'
|
|
7509
|
+
}),
|
|
7510
|
+
optionType: "button",
|
|
7511
|
+
buttonStyle: "solid",
|
|
7512
|
+
options: alignOptions,
|
|
7513
|
+
className: style['form-actions-align-group']
|
|
7514
|
+
}, "align"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Slider, {
|
|
7515
|
+
name: "gap",
|
|
7516
|
+
label: formatMessage({
|
|
7517
|
+
id: 'formActionsGap'
|
|
7518
|
+
}),
|
|
7519
|
+
min: 0,
|
|
7520
|
+
max: 64,
|
|
7521
|
+
step: 1,
|
|
7522
|
+
marks: gapMarks,
|
|
7523
|
+
tooltip: {
|
|
7524
|
+
formatter: v => `${v ?? 0}px`
|
|
7525
|
+
},
|
|
7526
|
+
className: style['form-actions-gap-slider']
|
|
7527
|
+
}, "gap")]
|
|
6406
7528
|
})]
|
|
6407
7529
|
})
|
|
6408
7530
|
}, open ? 'form-actions-open' : 'form-actions-closed');
|
|
@@ -6693,6 +7815,219 @@ const ChoiceBlock = ({
|
|
|
6693
7815
|
};
|
|
6694
7816
|
var ChoiceBlock$1 = ChoiceBlock;
|
|
6695
7817
|
|
|
7818
|
+
function _finallyRethrows(body, finalizer) {
|
|
7819
|
+
try {
|
|
7820
|
+
var result = body();
|
|
7821
|
+
} catch (e) {
|
|
7822
|
+
return finalizer(true, e);
|
|
7823
|
+
}
|
|
7824
|
+
if (result && result.then) {
|
|
7825
|
+
return result.then(finalizer.bind(null, false), finalizer.bind(null, true));
|
|
7826
|
+
}
|
|
7827
|
+
return finalizer(false, result);
|
|
7828
|
+
}
|
|
7829
|
+
const cx = function () {
|
|
7830
|
+
return [].slice.call(arguments).filter(Boolean).join(' ');
|
|
7831
|
+
};
|
|
7832
|
+
const getStepFieldNames = item => (Array.isArray(item?.fieldNames) && item.fieldNames.length ? item.fieldNames : (item?.list || []).map(field => field?.props?.name)).filter(Boolean);
|
|
7833
|
+
const FocusStepsHeader = ({
|
|
7834
|
+
items,
|
|
7835
|
+
current,
|
|
7836
|
+
stepTitle,
|
|
7837
|
+
formatMessage,
|
|
7838
|
+
onJump
|
|
7839
|
+
}) => {
|
|
7840
|
+
const total = items.length;
|
|
7841
|
+
const isLast = current >= total - 1;
|
|
7842
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
7843
|
+
className: style['steps-focus-header'],
|
|
7844
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
7845
|
+
className: style['steps-focus-meta'],
|
|
7846
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
7847
|
+
className: style['steps-focus-count'],
|
|
7848
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
7849
|
+
className: style['steps-focus-count-current'],
|
|
7850
|
+
children: String(current + 1).padStart(2, '0')
|
|
7851
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
7852
|
+
className: style['steps-focus-count-total'],
|
|
7853
|
+
children: ["/ ", String(total).padStart(2, '0')]
|
|
7854
|
+
})]
|
|
7855
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
7856
|
+
className: style['steps-focus-next'],
|
|
7857
|
+
title: isLast ? undefined : stepTitle(current + 1),
|
|
7858
|
+
children: isLast ? formatMessage({
|
|
7859
|
+
id: 'stepsFocusLast'
|
|
7860
|
+
}) : formatMessage({
|
|
7861
|
+
id: 'stepsFocusNext'
|
|
7862
|
+
}, {
|
|
7863
|
+
title: stepTitle(current + 1)
|
|
7864
|
+
})
|
|
7865
|
+
})]
|
|
7866
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
7867
|
+
className: style['steps-focus-title'],
|
|
7868
|
+
children: stepTitle(current)
|
|
7869
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
7870
|
+
className: style['steps-focus-track'],
|
|
7871
|
+
role: "progressbar",
|
|
7872
|
+
"aria-valuemin": 1,
|
|
7873
|
+
"aria-valuemax": total,
|
|
7874
|
+
"aria-valuenow": current + 1,
|
|
7875
|
+
children: items.map((item, index) => /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
7876
|
+
type: "button",
|
|
7877
|
+
className: cx(style['steps-focus-segment'], index < current && style['is-done'], index === current && style['is-current']),
|
|
7878
|
+
title: stepTitle(index),
|
|
7879
|
+
"aria-label": stepTitle(index),
|
|
7880
|
+
disabled: index >= current,
|
|
7881
|
+
onClick: () => onJump(index)
|
|
7882
|
+
}, item.key || index))
|
|
7883
|
+
})]
|
|
7884
|
+
});
|
|
7885
|
+
};
|
|
7886
|
+
const FocusStepsActions = ({
|
|
7887
|
+
items,
|
|
7888
|
+
current,
|
|
7889
|
+
formatMessage,
|
|
7890
|
+
onChange
|
|
7891
|
+
}) => {
|
|
7892
|
+
const {
|
|
7893
|
+
openApi
|
|
7894
|
+
} = reactFormAntd.useFormContext() || {};
|
|
7895
|
+
const [loading, setLoading] = react.useState(false);
|
|
7896
|
+
const isFirst = current <= 0;
|
|
7897
|
+
const isLast = current >= items.length - 1;
|
|
7898
|
+
const handleNext = function () {
|
|
7899
|
+
try {
|
|
7900
|
+
if (loading || isLast) {
|
|
7901
|
+
return Promise.resolve();
|
|
7902
|
+
}
|
|
7903
|
+
setLoading(true);
|
|
7904
|
+
const _temp = _finallyRethrows(function () {
|
|
7905
|
+
return Promise.resolve(FormInfo.validateFieldsByName(openApi, getStepFieldNames(items[current]))).then(function (_validateFieldsByName) {
|
|
7906
|
+
if (_validateFieldsByName) {
|
|
7907
|
+
onChange(current + 1);
|
|
7908
|
+
}
|
|
7909
|
+
});
|
|
7910
|
+
}, function (_wasThrown, _result) {
|
|
7911
|
+
setLoading(false);
|
|
7912
|
+
if (_wasThrown) throw _result;
|
|
7913
|
+
return _result;
|
|
7914
|
+
});
|
|
7915
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
|
7916
|
+
} catch (e) {
|
|
7917
|
+
return Promise.reject(e);
|
|
7918
|
+
}
|
|
7919
|
+
};
|
|
7920
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
7921
|
+
className: style['steps-focus-actions'],
|
|
7922
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
7923
|
+
className: style['steps-focus-actions-side'],
|
|
7924
|
+
children: !isFirst ? /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
7925
|
+
className: style['steps-focus-prev'],
|
|
7926
|
+
variant: "text",
|
|
7927
|
+
color: "default",
|
|
7928
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowLeftOutlined, {}),
|
|
7929
|
+
onClick: () => onChange(current - 1),
|
|
7930
|
+
children: formatMessage({
|
|
7931
|
+
id: 'stepsFocusPrev'
|
|
7932
|
+
})
|
|
7933
|
+
}) : null
|
|
7934
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
7935
|
+
className: cx(style['steps-focus-actions-side'], style['is-end']),
|
|
7936
|
+
children: isLast ? /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
7937
|
+
className: style['steps-focus-done-hint'],
|
|
7938
|
+
children: formatMessage({
|
|
7939
|
+
id: 'stepsFocusSubmitHint'
|
|
7940
|
+
})
|
|
7941
|
+
}) : /*#__PURE__*/jsxRuntime.jsxs(antd.Button, {
|
|
7942
|
+
className: style['steps-focus-next-btn'],
|
|
7943
|
+
variant: "filled",
|
|
7944
|
+
color: "primary",
|
|
7945
|
+
loading: loading,
|
|
7946
|
+
onClick: handleNext,
|
|
7947
|
+
children: [formatMessage({
|
|
7948
|
+
id: 'stepsFocusNextBtn'
|
|
7949
|
+
}), /*#__PURE__*/jsxRuntime.jsx(icons.ArrowRightOutlined, {
|
|
7950
|
+
className: style['steps-focus-next-btn-icon']
|
|
7951
|
+
})]
|
|
7952
|
+
})
|
|
7953
|
+
})]
|
|
7954
|
+
});
|
|
7955
|
+
};
|
|
7956
|
+
|
|
7957
|
+
/**
|
|
7958
|
+
* stepsStyle: 'focus':受控 current,用自绘头部(序号 / 标题 / 分段进度)替换 antd 步骤条,
|
|
7959
|
+
* 并用自绘底部操作区替换 form-info 的链接式上一步 / 下一步;提交失败跳错步、重置仍由 form-info Steps 负责。
|
|
7960
|
+
*/
|
|
7961
|
+
const FocusSteps = ({
|
|
7962
|
+
items = [],
|
|
7963
|
+
formatMessage,
|
|
7964
|
+
stepsClassName,
|
|
7965
|
+
...props
|
|
7966
|
+
}) => {
|
|
7967
|
+
const [current, setCurrent] = react.useState(0);
|
|
7968
|
+
const headerRef = react.useRef(null);
|
|
7969
|
+
const mountedRef = react.useRef(false);
|
|
7970
|
+
const safeCurrent = Math.min(current, Math.max(items.length - 1, 0));
|
|
7971
|
+
const stepTitle = index => items[index]?.title || formatMessage({
|
|
7972
|
+
id: 'untitledStep'
|
|
7973
|
+
}, {
|
|
7974
|
+
index: index + 1
|
|
7975
|
+
});
|
|
7976
|
+
react.useEffect(() => {
|
|
7977
|
+
if (!mountedRef.current) {
|
|
7978
|
+
mountedRef.current = true;
|
|
7979
|
+
return;
|
|
7980
|
+
}
|
|
7981
|
+
const node = headerRef.current;
|
|
7982
|
+
if (node && node.getBoundingClientRect().top < 0) {
|
|
7983
|
+
node.scrollIntoView({
|
|
7984
|
+
behavior: 'smooth',
|
|
7985
|
+
block: 'start'
|
|
7986
|
+
});
|
|
7987
|
+
}
|
|
7988
|
+
}, [safeCurrent]);
|
|
7989
|
+
const focusItems = items.map((item, index) => {
|
|
7990
|
+
if (index !== safeCurrent) {
|
|
7991
|
+
return item;
|
|
7992
|
+
}
|
|
7993
|
+
return {
|
|
7994
|
+
...item,
|
|
7995
|
+
title: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
7996
|
+
ref: headerRef,
|
|
7997
|
+
children: /*#__PURE__*/jsxRuntime.jsx(FocusStepsHeader, {
|
|
7998
|
+
items: items,
|
|
7999
|
+
current: safeCurrent,
|
|
8000
|
+
stepTitle: stepTitle,
|
|
8001
|
+
formatMessage: formatMessage,
|
|
8002
|
+
onJump: setCurrent
|
|
8003
|
+
})
|
|
8004
|
+
}),
|
|
8005
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
8006
|
+
children: [item.children != null ? item.children : /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
|
|
8007
|
+
column: item.column,
|
|
8008
|
+
gap: item.gap,
|
|
8009
|
+
list: item.list || []
|
|
8010
|
+
}), /*#__PURE__*/jsxRuntime.jsx(FocusStepsActions, {
|
|
8011
|
+
items: items,
|
|
8012
|
+
current: safeCurrent,
|
|
8013
|
+
formatMessage: formatMessage,
|
|
8014
|
+
onChange: setCurrent
|
|
8015
|
+
})]
|
|
8016
|
+
})
|
|
8017
|
+
};
|
|
8018
|
+
});
|
|
8019
|
+
return /*#__PURE__*/jsxRuntime.jsx(FormInfo.Steps, {
|
|
8020
|
+
...props,
|
|
8021
|
+
showActions: false,
|
|
8022
|
+
orientation: "horizontal",
|
|
8023
|
+
stepsClassName: cx(stepsClassName, style['steps-focus']),
|
|
8024
|
+
items: focusItems,
|
|
8025
|
+
current: safeCurrent,
|
|
8026
|
+
onChange: setCurrent
|
|
8027
|
+
});
|
|
8028
|
+
};
|
|
8029
|
+
var FocusSteps$1 = FocusSteps;
|
|
8030
|
+
|
|
6696
8031
|
/**
|
|
6697
8032
|
* 按 visibleWhen 过滤字段的 FormInfo:
|
|
6698
8033
|
* entries 为 [{ element, path, visibleWhen }],不满足条件的字段从 list 中移除(卸载即不参与校验),
|
|
@@ -6840,12 +8175,13 @@ const renderFieldEntries = (fields = [], preview = false, {
|
|
|
6840
8175
|
}
|
|
6841
8176
|
delete props.range;
|
|
6842
8177
|
|
|
6843
|
-
//
|
|
6844
|
-
|
|
8178
|
+
// 选择组:form-creator 的 inline 仅编辑器用;渲染时删掉。block/modern 交给 react-form-antd;
|
|
8179
|
+
// 未开 block 且 inline=false 时沿用旧纵向兜底
|
|
8180
|
+
if (field.type === 'RadioGroup' || field.type === 'CheckboxGroup' || field.type === 'RadioGroupOther' || field.type === 'CheckboxGroupOther') {
|
|
6845
8181
|
const optionsInline = props.inline !== false;
|
|
6846
8182
|
delete props.inline;
|
|
6847
|
-
if (!optionsInline) {
|
|
6848
|
-
if (field.type === 'RadioGroup') {
|
|
8183
|
+
if (!props.block && !optionsInline) {
|
|
8184
|
+
if (field.type === 'RadioGroup' || field.type === 'RadioGroupOther') {
|
|
6849
8185
|
props.vertical = true;
|
|
6850
8186
|
}
|
|
6851
8187
|
props.className = [props.className, style['option-group-stack']].filter(Boolean).join(' ');
|
|
@@ -7078,14 +8414,47 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
|
|
|
7078
8414
|
} : {})
|
|
7079
8415
|
}), asListItem);
|
|
7080
8416
|
}
|
|
8417
|
+
case 'matrixScale':
|
|
8418
|
+
{
|
|
8419
|
+
const FieldComponent = getFieldComponent(block.fieldType || 'RadioGroup');
|
|
8420
|
+
if (!FieldComponent) {
|
|
8421
|
+
return null;
|
|
8422
|
+
}
|
|
8423
|
+
const layout = block.layout === 'columns' || block.layout === 'field' ? block.layout : 'options';
|
|
8424
|
+
return withBlockLayout(/*#__PURE__*/react.createElement(FormInfo.MatrixScale, {
|
|
8425
|
+
key: block.id,
|
|
8426
|
+
name: block.name,
|
|
8427
|
+
title: block.title || undefined,
|
|
8428
|
+
rowTitle: block.rowTitle || undefined,
|
|
8429
|
+
bordered,
|
|
8430
|
+
field: FieldComponent,
|
|
8431
|
+
rule: block.rule || undefined,
|
|
8432
|
+
rows: block.rows || [],
|
|
8433
|
+
...(layout === 'options' ? {
|
|
8434
|
+
options: block.options || []
|
|
8435
|
+
} : null),
|
|
8436
|
+
...(layout === 'columns' ? {
|
|
8437
|
+
columns: block.columns || []
|
|
8438
|
+
} : null),
|
|
8439
|
+
...(listItemPartProps || {}),
|
|
8440
|
+
className: resolvePartRootClassName(depth),
|
|
8441
|
+
...(locale ? {
|
|
8442
|
+
locale
|
|
8443
|
+
} : {})
|
|
8444
|
+
}), asListItem);
|
|
8445
|
+
}
|
|
7081
8446
|
case 'steps':
|
|
7082
8447
|
{
|
|
7083
|
-
|
|
8448
|
+
const isFocusSteps = block.stepsStyle === 'focus';
|
|
8449
|
+
return withBlockLayout(/*#__PURE__*/react.createElement(isFocusSteps ? FocusSteps$1 : FormInfo.Steps, {
|
|
7084
8450
|
key: block.id,
|
|
7085
8451
|
title: block.title || undefined,
|
|
7086
8452
|
subtitle: block.subtitle || undefined,
|
|
7087
8453
|
bordered,
|
|
7088
8454
|
className: resolvePartRootClassName(depth),
|
|
8455
|
+
...(isFocusSteps ? {
|
|
8456
|
+
formatMessage
|
|
8457
|
+
} : null),
|
|
7089
8458
|
prevIcon: /*#__PURE__*/react.createElement(icons.ArrowLeftOutlined),
|
|
7090
8459
|
nextIcon: /*#__PURE__*/react.createElement(icons.ArrowRightOutlined),
|
|
7091
8460
|
items: (block.items || []).map(step => {
|
|
@@ -7292,7 +8661,7 @@ const resolveActionNode = ({
|
|
|
7292
8661
|
return actionsEl;
|
|
7293
8662
|
}
|
|
7294
8663
|
const footerProps = buttonFooterProps || {};
|
|
7295
|
-
return /*#__PURE__*/react.createElement(
|
|
8664
|
+
return /*#__PURE__*/react.createElement(ButtonGroup.ButtonFooter, footerProps, actionsEl);
|
|
7296
8665
|
};
|
|
7297
8666
|
const SchemaRendererInner = withLocale$1(props => {
|
|
7298
8667
|
const {
|
|
@@ -7549,6 +8918,12 @@ const FormCreator = withLocale$1(({
|
|
|
7549
8918
|
const handleMoveBlock = (blockId, direction) => {
|
|
7550
8919
|
updateSchema(updateBlocks(schema, blocks => moveBlockInTree(blocks, blockId, direction)));
|
|
7551
8920
|
};
|
|
8921
|
+
const handlePatchBlock = block => {
|
|
8922
|
+
if (!block?.id) {
|
|
8923
|
+
return;
|
|
8924
|
+
}
|
|
8925
|
+
updateSchema(mapBlocks(schema, block.id, () => block));
|
|
8926
|
+
};
|
|
7552
8927
|
const handleAddStep = blockId => {
|
|
7553
8928
|
setStepContext({
|
|
7554
8929
|
blockId,
|
|
@@ -7802,6 +9177,7 @@ const FormCreator = withLocale$1(({
|
|
|
7802
9177
|
onEditBlock: handleEditBlock,
|
|
7803
9178
|
onDeleteBlock: handleDeleteBlock,
|
|
7804
9179
|
onMoveBlock: handleMoveBlock,
|
|
9180
|
+
onPatchBlock: handlePatchBlock,
|
|
7805
9181
|
onAddField: handleAddField,
|
|
7806
9182
|
onEditField: handleEditField,
|
|
7807
9183
|
onDeleteField: handleDeleteField,
|
|
@@ -8660,6 +10036,68 @@ const walkBlock = (block, layer, depth = 0, ctx = {}) => {
|
|
|
8660
10036
|
layer.properties[name] = arraySchema;
|
|
8661
10037
|
return;
|
|
8662
10038
|
}
|
|
10039
|
+
case 'matrixScale':
|
|
10040
|
+
{
|
|
10041
|
+
const name = block.name != null && String(block.name).trim() ? String(block.name).trim() : '';
|
|
10042
|
+
if (!name) {
|
|
10043
|
+
return;
|
|
10044
|
+
}
|
|
10045
|
+
const layout = block.layout === 'columns' || block.layout === 'field' ? block.layout : 'options';
|
|
10046
|
+
const fieldType = block.fieldType || 'RadioGroup';
|
|
10047
|
+
const required = typeof block.rule === 'string' && block.rule.split(' ').includes('REQ');
|
|
10048
|
+
const properties = {};
|
|
10049
|
+
const requiredKeys = [];
|
|
10050
|
+
(block.rows || []).forEach(row => {
|
|
10051
|
+
const rowName = row?.name != null && String(row.name).trim() ? String(row.name).trim() : '';
|
|
10052
|
+
if (!rowName) {
|
|
10053
|
+
return;
|
|
10054
|
+
}
|
|
10055
|
+
if (layout === 'columns') {
|
|
10056
|
+
const columnProperties = {};
|
|
10057
|
+
(block.columns || []).forEach(column => {
|
|
10058
|
+
const columnName = column?.name != null && String(column.name).trim() ? String(column.name).trim() : '';
|
|
10059
|
+
if (!columnName) {
|
|
10060
|
+
return;
|
|
10061
|
+
}
|
|
10062
|
+
columnProperties[columnName] = resolveFieldValueSchema({
|
|
10063
|
+
type: fieldType,
|
|
10064
|
+
label: column.label,
|
|
10065
|
+
rule: block.rule,
|
|
10066
|
+
props: {}
|
|
10067
|
+
});
|
|
10068
|
+
});
|
|
10069
|
+
properties[rowName] = {
|
|
10070
|
+
type: 'object',
|
|
10071
|
+
title: row.label || undefined,
|
|
10072
|
+
properties: columnProperties
|
|
10073
|
+
};
|
|
10074
|
+
} else {
|
|
10075
|
+
properties[rowName] = resolveFieldValueSchema({
|
|
10076
|
+
type: fieldType,
|
|
10077
|
+
label: row.label,
|
|
10078
|
+
rule: block.rule,
|
|
10079
|
+
props: layout === 'options' ? {
|
|
10080
|
+
options: block.options || []
|
|
10081
|
+
} : {}
|
|
10082
|
+
});
|
|
10083
|
+
}
|
|
10084
|
+
if (required) {
|
|
10085
|
+
requiredKeys.push(rowName);
|
|
10086
|
+
}
|
|
10087
|
+
});
|
|
10088
|
+
const objectSchema = {
|
|
10089
|
+
type: 'object',
|
|
10090
|
+
properties
|
|
10091
|
+
};
|
|
10092
|
+
if (block.title) {
|
|
10093
|
+
objectSchema.title = block.title;
|
|
10094
|
+
}
|
|
10095
|
+
if (requiredKeys.length) {
|
|
10096
|
+
objectSchema.required = requiredKeys;
|
|
10097
|
+
}
|
|
10098
|
+
layer.properties[name] = objectSchema;
|
|
10099
|
+
return;
|
|
10100
|
+
}
|
|
8663
10101
|
case 'steps':
|
|
8664
10102
|
{
|
|
8665
10103
|
(block.items || []).forEach(step => {
|