@kne/form-creator 0.1.27 → 0.1.29
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 +249 -16
- package/dist/index.css +574 -79
- package/dist/index.css.map +1 -1
- package/dist/index.js +1119 -493
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +1134 -534
- package/dist/index.modern.js.map +1 -1
- package/dist/locale/en-US.js +29 -0
- package/dist/locale/en-US.js.map +1 -1
- package/dist/locale/en-US.modern.js +29 -0
- package/dist/locale/en-US.modern.js.map +1 -1
- package/dist/locale/zh-CN.js +29 -0
- package/dist/locale/zh-CN.js.map +1 -1
- package/dist/locale/zh-CN.modern.js +29 -0
- package/dist/locale/zh-CN.modern.js.map +1 -1
- package/package.json +6 -4
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-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-
|
|
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: '表单结构',
|
|
@@ -111,6 +115,14 @@ const locale$1 = {
|
|
|
111
115
|
blockAddPosition_top: '标题右侧(插入到第一项)',
|
|
112
116
|
blockAddPosition_both: '两处都显示',
|
|
113
117
|
blockAutoStep: '填写完成后自动进入下一步',
|
|
118
|
+
stepsStyle: '步骤展示样式',
|
|
119
|
+
stepsStyle_default: '完整步骤条',
|
|
120
|
+
stepsStyle_focus: '聚焦当前步骤',
|
|
121
|
+
stepsFocusNext: '下一步:{title}',
|
|
122
|
+
stepsFocusLast: '最后一步',
|
|
123
|
+
stepsFocusPrev: '上一步',
|
|
124
|
+
stepsFocusNextBtn: '下一步',
|
|
125
|
+
stepsFocusSubmitHint: '已是最后一步,确认无误后提交',
|
|
114
126
|
multiFieldType: '填写项类型',
|
|
115
127
|
multiFieldSummary: '填写类型:{type}',
|
|
116
128
|
multiFieldEditorHint: '同类多值模块会根据你选择的填写项类型,自动生成可增减的多个输入框。',
|
|
@@ -225,6 +237,25 @@ const locale$1 = {
|
|
|
225
237
|
formActionsGapHint: '默认 16',
|
|
226
238
|
formActionsLayoutSection: '布局',
|
|
227
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: '按钮的对齐方式与间距',
|
|
228
259
|
optionLabelColumn: '选项名称',
|
|
229
260
|
optionValueColumn: '选项值',
|
|
230
261
|
optionDescColumn: '选项描述',
|
|
@@ -364,6 +395,8 @@ const locale = {
|
|
|
364
395
|
deleteField: 'Delete',
|
|
365
396
|
moveUp: 'Move Up',
|
|
366
397
|
moveDown: 'Move Down',
|
|
398
|
+
dragSort: 'Drag to reorder',
|
|
399
|
+
moreActions: 'More actions',
|
|
367
400
|
fieldListTitle: 'Field Configuration',
|
|
368
401
|
fieldListSubtitle: 'Manage fields and preview the form on the right',
|
|
369
402
|
blockListTitle: 'Form Structure',
|
|
@@ -444,6 +477,14 @@ const locale = {
|
|
|
444
477
|
blockAddPosition_top: 'Title right (insert as first)',
|
|
445
478
|
blockAddPosition_both: 'Both',
|
|
446
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',
|
|
447
488
|
multiFieldType: 'Field Type',
|
|
448
489
|
multiFieldSummary: 'Field type: {type}',
|
|
449
490
|
multiFieldEditorHint: 'This section auto-generates repeatable inputs based on the field type you choose.',
|
|
@@ -558,6 +599,25 @@ const locale = {
|
|
|
558
599
|
formActionsGapHint: 'Default: 16',
|
|
559
600
|
formActionsLayoutSection: 'Layout',
|
|
560
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',
|
|
561
621
|
optionLabelColumn: 'Option Label',
|
|
562
622
|
optionValueColumn: 'Option Value',
|
|
563
623
|
optionDescColumn: 'Option Description',
|
|
@@ -1133,7 +1193,12 @@ const normalizeBlock = (block, depth = 0) => {
|
|
|
1133
1193
|
normalized.fieldType = block.fieldType || 'RadioGroup';
|
|
1134
1194
|
normalized.rowTitle = block.rowTitle != null ? block.rowTitle : '';
|
|
1135
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
|
+
} : {};
|
|
1136
1200
|
normalized.rows = Array.isArray(block.rows) ? block.rows.map(row => ({
|
|
1201
|
+
...keepKey(row),
|
|
1137
1202
|
label: row?.label ?? '',
|
|
1138
1203
|
name: String(row?.name || '').trim() || createDataKey('row')
|
|
1139
1204
|
})).filter(row => String(row.label || '').trim() || String(row.name || '').trim()) : [];
|
|
@@ -1144,10 +1209,16 @@ const normalizeBlock = (block, depth = 0) => {
|
|
|
1144
1209
|
}];
|
|
1145
1210
|
}
|
|
1146
1211
|
if (layout === 'options') {
|
|
1147
|
-
normalized.options = Array.isArray(block.options) ? block.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
|
+
})) : [];
|
|
1148
1218
|
normalized.columns = undefined;
|
|
1149
1219
|
} else if (layout === 'columns') {
|
|
1150
1220
|
normalized.columns = Array.isArray(block.columns) ? block.columns.map(column => ({
|
|
1221
|
+
...keepKey(column),
|
|
1151
1222
|
label: column?.label ?? column?.title ?? '',
|
|
1152
1223
|
name: String(column?.name || '').trim() || createDataKey('col')
|
|
1153
1224
|
})).filter(column => String(column.label || '').trim() || String(column.name || '').trim()) : [];
|
|
@@ -1259,16 +1330,23 @@ const blockHasLockedField = block => {
|
|
|
1259
1330
|
};
|
|
1260
1331
|
|
|
1261
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' 移动一位;数字为目标下标(拖拽排序) */
|
|
1262
1343
|
const moveItem = (list, id, direction, isFixed = isFieldLocked) => {
|
|
1263
1344
|
const index = list.findIndex(item => item.id === id);
|
|
1264
1345
|
if (index < 0) {
|
|
1265
1346
|
return list;
|
|
1266
1347
|
}
|
|
1267
|
-
const targetIndex = direction === 'up' ? index - 1 : index + 1;
|
|
1268
|
-
if (
|
|
1269
|
-
return list;
|
|
1270
|
-
}
|
|
1271
|
-
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)) {
|
|
1272
1350
|
return list;
|
|
1273
1351
|
}
|
|
1274
1352
|
const next = [...list];
|
|
@@ -1689,6 +1767,9 @@ const ADD_POSITIONS = ['bottom', 'top', 'both'];
|
|
|
1689
1767
|
|
|
1690
1768
|
/** matrixScale 布局:options 选项组矩阵 / columns 单元格矩阵 / field 每行一个字段 */
|
|
1691
1769
|
const MATRIX_LAYOUTS = ['options', 'columns', 'field'];
|
|
1770
|
+
|
|
1771
|
+
/** steps 导航样式:default 为 antd 完整步骤条;focus 突出当前步骤标题,其余收成序号 */
|
|
1772
|
+
const STEPS_STYLES = ['default', 'focus'];
|
|
1692
1773
|
const getBlockKindOptions = formatMessage => Object.entries(BLOCK_KINDS).map(([value, config]) => ({
|
|
1693
1774
|
label: typeof formatMessage === 'function' ? formatMessage({
|
|
1694
1775
|
id: config.labelId
|
|
@@ -1716,6 +1797,7 @@ const blockToFormValues = block => ({
|
|
|
1716
1797
|
rowTitle: block.rowTitle || '',
|
|
1717
1798
|
required: typeof block.rule === 'string' && block.rule.split(' ').includes('REQ'),
|
|
1718
1799
|
autoStep: block.autoStep !== false,
|
|
1800
|
+
stepsStyle: STEPS_STYLES.includes(block.stepsStyle) ? block.stepsStyle : 'default',
|
|
1719
1801
|
mode: block.mode === 'multiple' ? 'multiple' : 'single',
|
|
1720
1802
|
selectorName: block.selectorName || '',
|
|
1721
1803
|
selectorInData: block.selectorInData !== false
|
|
@@ -1741,6 +1823,7 @@ const formValuesToBlock = (values, existingBlock = {}) => {
|
|
|
1741
1823
|
addPosition: kind === 'editableList' && ADD_POSITIONS.includes(values.addPosition) && values.addPosition !== 'bottom' ? values.addPosition : undefined,
|
|
1742
1824
|
fieldType: values.fieldType || (kind === 'matrixScale' ? 'RadioGroup' : 'Input'),
|
|
1743
1825
|
autoStep: values.autoStep !== false,
|
|
1826
|
+
stepsStyle: kind === 'steps' && STEPS_STYLES.includes(values.stepsStyle) && values.stepsStyle !== 'default' ? values.stepsStyle : undefined,
|
|
1744
1827
|
mode,
|
|
1745
1828
|
selectorName: values.selectorName || '',
|
|
1746
1829
|
selectorInData: values.selectorInData !== false
|
|
@@ -3472,6 +3555,78 @@ const formValuesToField = (values, existingField = {}) => {
|
|
|
3472
3555
|
};
|
|
3473
3556
|
};
|
|
3474
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
|
+
|
|
3475
3630
|
const {
|
|
3476
3631
|
useOnChange: useOnChange$1
|
|
3477
3632
|
} = reactFormAntd.hooks;
|
|
@@ -3572,7 +3727,7 @@ const LocaleTextArea = props => {
|
|
|
3572
3727
|
LocaleTextArea.field = LocaleTextAreaControl;
|
|
3573
3728
|
|
|
3574
3729
|
const {
|
|
3575
|
-
Text: Text$
|
|
3730
|
+
Text: Text$5
|
|
3576
3731
|
} = antd.Typography;
|
|
3577
3732
|
const TYPE_TAG_COLORS = {
|
|
3578
3733
|
Input: 'blue',
|
|
@@ -3624,7 +3779,11 @@ const FieldRow = ({
|
|
|
3624
3779
|
onMove,
|
|
3625
3780
|
prevLocked,
|
|
3626
3781
|
nextLocked,
|
|
3627
|
-
conditionContext
|
|
3782
|
+
conditionContext,
|
|
3783
|
+
dragHandleProps,
|
|
3784
|
+
isMobile,
|
|
3785
|
+
className,
|
|
3786
|
+
...rest
|
|
3628
3787
|
}) => {
|
|
3629
3788
|
const {
|
|
3630
3789
|
formatMessage,
|
|
@@ -3636,14 +3795,34 @@ const FieldRow = ({
|
|
|
3636
3795
|
const conditionInvalid = conditional && conditionContext && hasInvalidCondition(field, conditionContext.triggerNames);
|
|
3637
3796
|
const TypeIcon = getFieldTypeIcon(field.type);
|
|
3638
3797
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
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]
|
|
3643
3813
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3644
3814
|
className: style['field-row-main'],
|
|
3645
|
-
|
|
3646
|
-
|
|
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),
|
|
3825
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Text$5, {
|
|
3647
3826
|
className: style['field-row-label'],
|
|
3648
3827
|
children: resolveLocaleText(field.label, locale, languages) || formatMessage({
|
|
3649
3828
|
id: 'untitledField'
|
|
@@ -3706,54 +3885,49 @@ const FieldRow = ({
|
|
|
3706
3885
|
})
|
|
3707
3886
|
}) : null]
|
|
3708
3887
|
})]
|
|
3709
|
-
}), field.locked ? null : /*#__PURE__*/jsxRuntime.
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
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({
|
|
3716
3896
|
id: 'moveUp'
|
|
3717
3897
|
}),
|
|
3718
3898
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowUpOutlined, {}),
|
|
3719
3899
|
disabled: index === 0 || prevLocked,
|
|
3720
3900
|
onClick: () => onMove(field.id, 'up')
|
|
3721
|
-
}
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
className: style['action-btn'],
|
|
3725
|
-
title: formatMessage({
|
|
3901
|
+
}, {
|
|
3902
|
+
key: 'down',
|
|
3903
|
+
label: formatMessage({
|
|
3726
3904
|
id: 'moveDown'
|
|
3727
3905
|
}),
|
|
3728
3906
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowDownOutlined, {}),
|
|
3729
3907
|
disabled: index === total - 1 || nextLocked,
|
|
3730
3908
|
onClick: () => onMove(field.id, 'down')
|
|
3731
|
-
}
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
className: style['action-btn'],
|
|
3735
|
-
title: formatMessage({
|
|
3909
|
+
}, {
|
|
3910
|
+
key: 'edit',
|
|
3911
|
+
label: formatMessage({
|
|
3736
3912
|
id: 'editField'
|
|
3737
3913
|
}),
|
|
3738
3914
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.EditOutlined, {}),
|
|
3739
3915
|
onClick: () => onEdit(field)
|
|
3740
|
-
}
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
danger: true,
|
|
3744
|
-
className: style['action-btn'],
|
|
3745
|
-
title: formatMessage({
|
|
3916
|
+
}, {
|
|
3917
|
+
key: 'delete',
|
|
3918
|
+
label: formatMessage({
|
|
3746
3919
|
id: 'deleteField'
|
|
3747
3920
|
}),
|
|
3748
3921
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.DeleteOutlined, {}),
|
|
3922
|
+
danger: true,
|
|
3749
3923
|
onClick: () => onDelete(field.id)
|
|
3750
|
-
})
|
|
3924
|
+
}])
|
|
3751
3925
|
})]
|
|
3752
3926
|
});
|
|
3753
3927
|
};
|
|
3754
3928
|
|
|
3755
3929
|
const {
|
|
3756
|
-
Text: Text$
|
|
3930
|
+
Text: Text$4,
|
|
3757
3931
|
Title
|
|
3758
3932
|
} = antd.Typography;
|
|
3759
3933
|
const createRowKey = () => createDataKey('mrow');
|
|
@@ -3974,7 +4148,7 @@ const MatrixScaleEditor = ({
|
|
|
3974
4148
|
}), []);
|
|
3975
4149
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3976
4150
|
className: style['block-body'],
|
|
3977
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Text$
|
|
4151
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Text$4, {
|
|
3978
4152
|
type: "secondary",
|
|
3979
4153
|
className: style['inline-empty'],
|
|
3980
4154
|
children: formatMessage({
|
|
@@ -4028,27 +4202,53 @@ const MatrixScaleEditor = ({
|
|
|
4028
4202
|
};
|
|
4029
4203
|
var MatrixScaleEditor$1 = MatrixScaleEditor;
|
|
4030
4204
|
|
|
4205
|
+
const noop = () => {};
|
|
4206
|
+
|
|
4207
|
+
/** 拖柄属性:按 scope 区分,嵌套列表的拖柄不会被外层列表识别 */
|
|
4208
|
+
const getSortHandleProps = scope => ({
|
|
4209
|
+
'data-sort-handle': scope
|
|
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
|
+
|
|
4031
4249
|
const {
|
|
4032
|
-
Text: Text$
|
|
4250
|
+
Text: Text$3
|
|
4033
4251
|
} = antd.Typography;
|
|
4034
|
-
const ActionGroup = ({
|
|
4035
|
-
children
|
|
4036
|
-
}) => /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4037
|
-
className: style['action-group'],
|
|
4038
|
-
children: children
|
|
4039
|
-
});
|
|
4040
|
-
const IconBtn = ({
|
|
4041
|
-
title,
|
|
4042
|
-
danger,
|
|
4043
|
-
...props
|
|
4044
|
-
}) => /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
4045
|
-
type: "text",
|
|
4046
|
-
size: "small",
|
|
4047
|
-
title: title,
|
|
4048
|
-
danger: danger,
|
|
4049
|
-
className: style['action-btn'],
|
|
4050
|
-
...props
|
|
4051
|
-
});
|
|
4052
4252
|
const ROOT_ADD_OPTIONS = [{
|
|
4053
4253
|
key: 'formInfo',
|
|
4054
4254
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.FormOutlined, {})
|
|
@@ -4084,6 +4284,9 @@ const BLOCK_KIND_ICONS = Object.fromEntries(ROOT_ADD_OPTIONS.map(({
|
|
|
4084
4284
|
|
|
4085
4285
|
/** 可挂子模块的容器;表格列表 / 同类多值本身不支持子模块 */
|
|
4086
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}`;
|
|
4087
4290
|
const BlockListPanel = ({
|
|
4088
4291
|
blocks,
|
|
4089
4292
|
onAddBlock,
|
|
@@ -4110,11 +4313,26 @@ const BlockListPanel = ({
|
|
|
4110
4313
|
formatMessage,
|
|
4111
4314
|
locale
|
|
4112
4315
|
} = reactIntl.useIntl();
|
|
4316
|
+
const isMobile = responsiveUtils.useIsMobile();
|
|
4113
4317
|
const languages = useLocaleTextLanguages();
|
|
4114
4318
|
const text = value => resolveLocaleText(value, locale, languages);
|
|
4115
4319
|
const [addMenuOpen, setAddMenuOpen] = react.useState(false);
|
|
4116
4320
|
const [addFieldMenuId, setAddFieldMenuId] = react.useState(null);
|
|
4117
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
|
+
});
|
|
4118
4336
|
const conditionContext = react.useMemo(() => {
|
|
4119
4337
|
const triggerFields = collectConditionFields({
|
|
4120
4338
|
blocks
|
|
@@ -4169,17 +4387,19 @@ const BlockListPanel = ({
|
|
|
4169
4387
|
}) => {
|
|
4170
4388
|
const canAddChild = typeof onAddChildBlock === 'function' && depth < MAX_BLOCK_DEPTH;
|
|
4171
4389
|
const menuOpen = addFieldMenuId === menuKey;
|
|
4172
|
-
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
|
+
});
|
|
4173
4394
|
if (!canAddChild) {
|
|
4174
4395
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
4175
4396
|
type: "text",
|
|
4176
4397
|
size: "small",
|
|
4177
4398
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.PlusOutlined, {}),
|
|
4178
4399
|
className: btnClass,
|
|
4400
|
+
title: addFieldText,
|
|
4179
4401
|
onClick: onAddFieldClick,
|
|
4180
|
-
children:
|
|
4181
|
-
id: 'addField'
|
|
4182
|
-
})
|
|
4402
|
+
children: isMobile ? null : addFieldText
|
|
4183
4403
|
});
|
|
4184
4404
|
}
|
|
4185
4405
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Dropdown, {
|
|
@@ -4273,10 +4493,9 @@ const BlockListPanel = ({
|
|
|
4273
4493
|
keepAddFieldMenuOpenRef.current = true;
|
|
4274
4494
|
}
|
|
4275
4495
|
},
|
|
4496
|
+
title: addFieldText,
|
|
4276
4497
|
onClick: () => setAddFieldMenuId(menuKey),
|
|
4277
|
-
children:
|
|
4278
|
-
id: 'addField'
|
|
4279
|
-
})
|
|
4498
|
+
children: isMobile ? null : addFieldText
|
|
4280
4499
|
})
|
|
4281
4500
|
});
|
|
4282
4501
|
};
|
|
@@ -4285,7 +4504,7 @@ const BlockListPanel = ({
|
|
|
4285
4504
|
optionId
|
|
4286
4505
|
} = {}) => {
|
|
4287
4506
|
if (!(fields || []).length) {
|
|
4288
|
-
return /*#__PURE__*/jsxRuntime.jsx(Text$
|
|
4507
|
+
return /*#__PURE__*/jsxRuntime.jsx(Text$3, {
|
|
4289
4508
|
type: "secondary",
|
|
4290
4509
|
className: style['inline-empty'],
|
|
4291
4510
|
children: formatMessage({
|
|
@@ -4293,9 +4512,20 @@ const BlockListPanel = ({
|
|
|
4293
4512
|
})
|
|
4294
4513
|
});
|
|
4295
4514
|
}
|
|
4296
|
-
|
|
4515
|
+
const scope = `fields:${blockId}:${stepId || ''}:${optionId || ''}`;
|
|
4516
|
+
const canDrag = fields.length > 1;
|
|
4517
|
+
return /*#__PURE__*/jsxRuntime.jsx(SortableList$1, {
|
|
4297
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
|
+
}),
|
|
4298
4526
|
children: fields.map((field, fieldIndex) => /*#__PURE__*/jsxRuntime.jsx(FieldRow, {
|
|
4527
|
+
isMobile: isMobile,
|
|
4528
|
+
dragHandleProps: canDrag && !isFieldLocked(field) ? getSortHandleProps(scope) : null,
|
|
4299
4529
|
field: field,
|
|
4300
4530
|
index: fieldIndex,
|
|
4301
4531
|
total: fields.length,
|
|
@@ -4317,26 +4547,30 @@ const BlockListPanel = ({
|
|
|
4317
4547
|
}, field.id))
|
|
4318
4548
|
});
|
|
4319
4549
|
};
|
|
4320
|
-
const renderNestedBlocks = (childBlocks, depth) => {
|
|
4550
|
+
const renderNestedBlocks = (childBlocks, depth, parentKey) => {
|
|
4321
4551
|
if (!(childBlocks || []).length) {
|
|
4322
4552
|
return null;
|
|
4323
4553
|
}
|
|
4324
4554
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4325
4555
|
className: style['item-blocks-section'],
|
|
4326
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
4556
|
+
children: /*#__PURE__*/jsxRuntime.jsx(SortableList$1, {
|
|
4327
4557
|
className: style['nested-block-list'],
|
|
4328
|
-
|
|
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))
|
|
4329
4563
|
})
|
|
4330
4564
|
});
|
|
4331
4565
|
};
|
|
4332
|
-
const renderItemBlocks = (parentBlock, depth) => renderNestedBlocks(parentBlock.itemBlocks, depth);
|
|
4566
|
+
const renderItemBlocks = (parentBlock, depth) => renderNestedBlocks(parentBlock.itemBlocks, depth, `item:${parentBlock.id}`);
|
|
4333
4567
|
const renderBlockChildren = (block, depth) => {
|
|
4334
4568
|
if (block.kind === 'steps') {
|
|
4335
4569
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4336
4570
|
className: style['block-body'],
|
|
4337
4571
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4338
4572
|
className: style['section-toolbar'],
|
|
4339
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Text$
|
|
4573
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Text$3, {
|
|
4340
4574
|
type: "secondary",
|
|
4341
4575
|
className: style['section-toolbar-label'],
|
|
4342
4576
|
children: formatMessage({
|
|
@@ -4352,72 +4586,86 @@ const BlockListPanel = ({
|
|
|
4352
4586
|
id: 'addStep'
|
|
4353
4587
|
})
|
|
4354
4588
|
})]
|
|
4355
|
-
}), (block.items || []).length ? /*#__PURE__*/jsxRuntime.jsx(
|
|
4589
|
+
}), (block.items || []).length ? /*#__PURE__*/jsxRuntime.jsx(SortableList$1, {
|
|
4356
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),
|
|
4357
4595
|
children: (block.items || []).map((step, stepIndex) => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4358
4596
|
className: style['step-section'],
|
|
4359
4597
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4360
4598
|
className: style['step-section-header'],
|
|
4361
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs(
|
|
4362
|
-
size: 8,
|
|
4363
|
-
wrap: true,
|
|
4599
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4364
4600
|
className: style['step-section-title'],
|
|
4365
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
4601
|
+
children: [isMobile && block.items.length > 1 && !blockHasLockedField(step) ? renderDragHandle(`steps:${block.id}`, true) : null, /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
4366
4602
|
className: style['step-index'],
|
|
4367
4603
|
children: stepIndex + 1
|
|
4368
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
4369
|
-
|
|
4370
|
-
children:
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
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
|
+
})]
|
|
4387
4627
|
})]
|
|
4388
4628
|
}), /*#__PURE__*/jsxRuntime.jsxs(antd.Space, {
|
|
4389
4629
|
size: 4,
|
|
4390
|
-
wrap: true,
|
|
4391
4630
|
className: style['step-section-actions'],
|
|
4392
|
-
children: [/*#__PURE__*/jsxRuntime.
|
|
4393
|
-
|
|
4394
|
-
|
|
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({
|
|
4395
4640
|
id: 'moveUp'
|
|
4396
4641
|
}),
|
|
4397
4642
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowUpOutlined, {}),
|
|
4398
4643
|
disabled: stepIndex === 0 || blockHasLockedField(step) || blockHasLockedField(block.items[stepIndex - 1]),
|
|
4399
4644
|
onClick: () => onMoveStep(block.id, step.id, 'up')
|
|
4400
|
-
}
|
|
4401
|
-
|
|
4645
|
+
}, {
|
|
4646
|
+
key: 'down',
|
|
4647
|
+
label: formatMessage({
|
|
4402
4648
|
id: 'moveDown'
|
|
4403
4649
|
}),
|
|
4404
4650
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowDownOutlined, {}),
|
|
4405
4651
|
disabled: stepIndex === (block.items?.length || 0) - 1 || blockHasLockedField(step) || blockHasLockedField(block.items[stepIndex + 1]),
|
|
4406
4652
|
onClick: () => onMoveStep(block.id, step.id, 'down')
|
|
4407
|
-
}
|
|
4408
|
-
|
|
4653
|
+
}, {
|
|
4654
|
+
key: 'edit',
|
|
4655
|
+
label: formatMessage({
|
|
4409
4656
|
id: 'editStep'
|
|
4410
4657
|
}),
|
|
4411
4658
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.EditOutlined, {}),
|
|
4412
4659
|
onClick: () => onEditStep(block.id, step)
|
|
4413
|
-
}
|
|
4414
|
-
|
|
4660
|
+
}, blockHasLockedField(step) ? null : {
|
|
4661
|
+
key: 'delete',
|
|
4662
|
+
label: formatMessage({
|
|
4415
4663
|
id: 'deleteStep'
|
|
4416
4664
|
}),
|
|
4417
|
-
danger: true,
|
|
4418
4665
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.DeleteOutlined, {}),
|
|
4666
|
+
danger: true,
|
|
4419
4667
|
onClick: () => onDeleteStep(block.id, step.id)
|
|
4420
|
-
})
|
|
4668
|
+
}])
|
|
4421
4669
|
}), renderAddFieldButton({
|
|
4422
4670
|
menuKey: `${block.id}:${step.id}`,
|
|
4423
4671
|
depth,
|
|
@@ -4432,9 +4680,9 @@ const BlockListPanel = ({
|
|
|
4432
4680
|
})]
|
|
4433
4681
|
}), renderFieldList(step.list, block.id, {
|
|
4434
4682
|
stepId: step.id
|
|
4435
|
-
}), renderNestedBlocks(step.blocks, depth)]
|
|
4683
|
+
}), renderNestedBlocks(step.blocks, depth, `step:${step.id}`)]
|
|
4436
4684
|
}, step.id))
|
|
4437
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(Text$
|
|
4685
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(Text$3, {
|
|
4438
4686
|
type: "secondary",
|
|
4439
4687
|
className: style['inline-empty'],
|
|
4440
4688
|
children: formatMessage({
|
|
@@ -4446,7 +4694,7 @@ const BlockListPanel = ({
|
|
|
4446
4694
|
if (block.kind === 'multiField') {
|
|
4447
4695
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4448
4696
|
className: style['block-body'],
|
|
4449
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Text$
|
|
4697
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Text$3, {
|
|
4450
4698
|
type: "secondary",
|
|
4451
4699
|
children: formatMessage({
|
|
4452
4700
|
id: 'multiFieldEditorHint'
|
|
@@ -4465,7 +4713,7 @@ const BlockListPanel = ({
|
|
|
4465
4713
|
className: style['block-body'],
|
|
4466
4714
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4467
4715
|
className: style['section-toolbar'],
|
|
4468
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Text$
|
|
4716
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Text$3, {
|
|
4469
4717
|
type: "secondary",
|
|
4470
4718
|
className: style['section-toolbar-label'],
|
|
4471
4719
|
children: formatMessage({
|
|
@@ -4481,72 +4729,86 @@ const BlockListPanel = ({
|
|
|
4481
4729
|
id: 'addChoiceOption'
|
|
4482
4730
|
})
|
|
4483
4731
|
})]
|
|
4484
|
-
}), (block.options || []).length ? /*#__PURE__*/jsxRuntime.jsx(
|
|
4732
|
+
}), (block.options || []).length ? /*#__PURE__*/jsxRuntime.jsx(SortableList$1, {
|
|
4485
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),
|
|
4486
4738
|
children: (block.options || []).map((option, optionIndex) => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4487
4739
|
className: style['step-section'],
|
|
4488
4740
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4489
4741
|
className: style['step-section-header'],
|
|
4490
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs(
|
|
4491
|
-
size: 8,
|
|
4492
|
-
wrap: true,
|
|
4742
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4493
4743
|
className: style['step-section-title'],
|
|
4494
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
4744
|
+
children: [isMobile && block.options.length > 1 && !blockHasLockedField(option) ? renderDragHandle(`options:${block.id}`, true) : null, /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
4495
4745
|
className: style['step-index'],
|
|
4496
4746
|
children: optionIndex + 1
|
|
4497
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
4498
|
-
|
|
4499
|
-
children:
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
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
|
+
})]
|
|
4516
4770
|
})]
|
|
4517
4771
|
}), /*#__PURE__*/jsxRuntime.jsxs(antd.Space, {
|
|
4518
4772
|
size: 4,
|
|
4519
|
-
wrap: true,
|
|
4520
4773
|
className: style['step-section-actions'],
|
|
4521
|
-
children: [/*#__PURE__*/jsxRuntime.
|
|
4522
|
-
|
|
4523
|
-
|
|
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({
|
|
4524
4783
|
id: 'moveUp'
|
|
4525
4784
|
}),
|
|
4526
4785
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowUpOutlined, {}),
|
|
4527
4786
|
disabled: optionIndex === 0 || blockHasLockedField(option) || blockHasLockedField(block.options[optionIndex - 1]),
|
|
4528
4787
|
onClick: () => onMoveChoiceOption(block.id, option.id, 'up')
|
|
4529
|
-
}
|
|
4530
|
-
|
|
4788
|
+
}, {
|
|
4789
|
+
key: 'down',
|
|
4790
|
+
label: formatMessage({
|
|
4531
4791
|
id: 'moveDown'
|
|
4532
4792
|
}),
|
|
4533
4793
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowDownOutlined, {}),
|
|
4534
4794
|
disabled: optionIndex === (block.options?.length || 0) - 1 || blockHasLockedField(option) || blockHasLockedField(block.options[optionIndex + 1]),
|
|
4535
4795
|
onClick: () => onMoveChoiceOption(block.id, option.id, 'down')
|
|
4536
|
-
}
|
|
4537
|
-
|
|
4796
|
+
}, {
|
|
4797
|
+
key: 'edit',
|
|
4798
|
+
label: formatMessage({
|
|
4538
4799
|
id: 'editChoiceOption'
|
|
4539
4800
|
}),
|
|
4540
4801
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.EditOutlined, {}),
|
|
4541
4802
|
onClick: () => onEditChoiceOption(block.id, option)
|
|
4542
|
-
}
|
|
4543
|
-
|
|
4803
|
+
}, blockHasLockedField(option) ? null : {
|
|
4804
|
+
key: 'delete',
|
|
4805
|
+
label: formatMessage({
|
|
4544
4806
|
id: 'deleteChoiceOption'
|
|
4545
4807
|
}),
|
|
4546
|
-
danger: true,
|
|
4547
4808
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.DeleteOutlined, {}),
|
|
4809
|
+
danger: true,
|
|
4548
4810
|
onClick: () => onDeleteChoiceOption(block.id, option.id)
|
|
4549
|
-
})
|
|
4811
|
+
}])
|
|
4550
4812
|
}), renderAddFieldButton({
|
|
4551
4813
|
menuKey: `${block.id}:opt:${option.id}`,
|
|
4552
4814
|
depth,
|
|
@@ -4561,9 +4823,9 @@ const BlockListPanel = ({
|
|
|
4561
4823
|
})]
|
|
4562
4824
|
}), renderFieldList(option.list, block.id, {
|
|
4563
4825
|
optionId: option.id
|
|
4564
|
-
}), renderNestedBlocks(option.blocks, depth)]
|
|
4826
|
+
}), renderNestedBlocks(option.blocks, depth, `option:${option.id}`)]
|
|
4565
4827
|
}, option.id))
|
|
4566
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(Text$
|
|
4828
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(Text$3, {
|
|
4567
4829
|
type: "secondary",
|
|
4568
4830
|
className: style['inline-empty'],
|
|
4569
4831
|
children: formatMessage({
|
|
@@ -4576,10 +4838,10 @@ const BlockListPanel = ({
|
|
|
4576
4838
|
const supportsBlocks = block.kind === 'formInfo' || block.kind === 'object';
|
|
4577
4839
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4578
4840
|
className: style['block-body'],
|
|
4579
|
-
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]
|
|
4580
4842
|
});
|
|
4581
4843
|
};
|
|
4582
|
-
const renderBlockSection = (block, blockIndex, siblings, depth = 0) => {
|
|
4844
|
+
const renderBlockSection = (block, blockIndex, siblings, depth = 0, parentKey = 'root') => {
|
|
4583
4845
|
const total = siblings.length;
|
|
4584
4846
|
const locked = blockHasLockedField(block);
|
|
4585
4847
|
const definition = getBlockDefinition(block.kind);
|
|
@@ -4599,14 +4861,14 @@ const BlockListPanel = ({
|
|
|
4599
4861
|
type: /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
4600
4862
|
className: style['block-summary-type'],
|
|
4601
4863
|
children: [/*#__PURE__*/react.createElement(getFieldTypeIcon(block.fieldType || 'Input')), resolveFieldTypeLabel(block.fieldType, formatMessage)]
|
|
4602
|
-
})
|
|
4864
|
+
}, "type")
|
|
4603
4865
|
}) : block.kind === 'matrixScale' ? formatMessage({
|
|
4604
4866
|
id: 'matrixScaleSummary'
|
|
4605
4867
|
}, {
|
|
4606
4868
|
type: /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
4607
4869
|
className: style['block-summary-type'],
|
|
4608
4870
|
children: [/*#__PURE__*/react.createElement(getFieldTypeIcon(block.fieldType || 'RadioGroup')), resolveFieldTypeLabel(block.fieldType || 'RadioGroup', formatMessage)]
|
|
4609
|
-
}),
|
|
4871
|
+
}, "type"),
|
|
4610
4872
|
layout: formatMessage({
|
|
4611
4873
|
id: `matrixScaleLayout_${matrixLayout}`
|
|
4612
4874
|
}),
|
|
@@ -4625,73 +4887,92 @@ const BlockListPanel = ({
|
|
|
4625
4887
|
}, {
|
|
4626
4888
|
count: block.list?.length || 0
|
|
4627
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
|
+
});
|
|
4628
4895
|
return /*#__PURE__*/jsxRuntime.jsxs("section", {
|
|
4629
|
-
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(),
|
|
4630
4897
|
children: [/*#__PURE__*/jsxRuntime.jsxs("header", {
|
|
4631
4898
|
className: style['block-section-header'],
|
|
4632
4899
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4633
|
-
className: style['block-header-
|
|
4634
|
-
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, {
|
|
4635
4911
|
bordered: false,
|
|
4636
4912
|
color: definition?.color || 'default',
|
|
4637
4913
|
icon: BLOCK_KIND_ICONS[block.kind],
|
|
4638
4914
|
children: formatMessage({
|
|
4639
4915
|
id: `blockKind_${block.kind}`
|
|
4640
4916
|
})
|
|
4641
|
-
}), /*#__PURE__*/jsxRuntime.jsx(Text$4, {
|
|
4642
|
-
strong: true,
|
|
4643
|
-
ellipsis: true,
|
|
4644
|
-
className: style['block-title'],
|
|
4645
|
-
children: text(block.title) || text(block.label) || block.name || formatMessage({
|
|
4646
|
-
id: 'untitledBlock'
|
|
4647
|
-
})
|
|
4648
4917
|
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
4649
4918
|
className: style['block-summary'],
|
|
4650
4919
|
children: summary
|
|
4651
|
-
})
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
title: formatMessage({
|
|
4659
|
-
id: 'moveUp'
|
|
4660
|
-
}),
|
|
4661
|
-
icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowUpOutlined, {}),
|
|
4662
|
-
disabled: blockIndex === 0 || locked || blockHasLockedField(siblings[blockIndex - 1]),
|
|
4663
|
-
onClick: () => onMoveBlock(block.id, 'up')
|
|
4664
|
-
}), /*#__PURE__*/jsxRuntime.jsx(IconBtn, {
|
|
4665
|
-
title: formatMessage({
|
|
4666
|
-
id: 'moveDown'
|
|
4667
|
-
}),
|
|
4668
|
-
icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowDownOutlined, {}),
|
|
4669
|
-
disabled: blockIndex === total - 1 || locked || blockHasLockedField(siblings[blockIndex + 1]),
|
|
4670
|
-
onClick: () => onMoveBlock(block.id, 'down')
|
|
4671
|
-
}), /*#__PURE__*/jsxRuntime.jsx(IconBtn, {
|
|
4672
|
-
title: formatMessage({
|
|
4673
|
-
id: 'editBlock'
|
|
4674
|
-
}),
|
|
4675
|
-
icon: /*#__PURE__*/jsxRuntime.jsx(icons.SettingOutlined, {}),
|
|
4676
|
-
onClick: () => onEditBlock(block)
|
|
4677
|
-
}), locked ? null : /*#__PURE__*/jsxRuntime.jsx(IconBtn, {
|
|
4678
|
-
title: formatMessage({
|
|
4679
|
-
id: 'deleteBlock'
|
|
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'
|
|
4680
4927
|
}),
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
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
|
|
4693
4974
|
})]
|
|
4694
|
-
}), renderBlockChildren(block, depth)]
|
|
4975
|
+
}), collapsed ? null : renderBlockChildren(block, depth)]
|
|
4695
4976
|
}, block.id);
|
|
4696
4977
|
};
|
|
4697
4978
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -4740,88 +5021,165 @@ const BlockListPanel = ({
|
|
|
4740
5021
|
description: formatMessage({
|
|
4741
5022
|
id: 'emptyBlockList'
|
|
4742
5023
|
})
|
|
4743
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(
|
|
5024
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(SortableList$1, {
|
|
4744
5025
|
className: style['block-list'],
|
|
5026
|
+
scope: getBlockScope('root'),
|
|
5027
|
+
list: blocks,
|
|
5028
|
+
isFixed: blockHasLockedField,
|
|
5029
|
+
onMove: onMoveBlock,
|
|
4745
5030
|
children: blocks.map((block, blockIndex) => renderBlockSection(block, blockIndex, blocks, 0))
|
|
4746
5031
|
})]
|
|
4747
5032
|
});
|
|
4748
5033
|
};
|
|
4749
5034
|
var BlockListPanel$1 = BlockListPanel;
|
|
4750
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
|
+
};
|
|
4751
5073
|
const BlockConfigFields = ({
|
|
4752
5074
|
kind
|
|
4753
5075
|
}) => {
|
|
4754
5076
|
const {
|
|
4755
5077
|
formatMessage
|
|
4756
5078
|
} = reactIntl.useIntl();
|
|
5079
|
+
const column = getEditorColumn(responsiveUtils.useIsMobile());
|
|
4757
5080
|
const definition = getBlockDefinition(kind);
|
|
4758
5081
|
const fieldTypeOptions = react.useMemo(() => getFieldTypes(formatMessage), [formatMessage]);
|
|
4759
|
-
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
|
+
};
|
|
4760
5093
|
const isListKind = kind === 'list' || kind === 'tableList' || kind === 'editableList';
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
}
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
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, {
|
|
4795
5156
|
name: "gap",
|
|
4796
5157
|
label: formatMessage({
|
|
4797
5158
|
id: 'blockGap'
|
|
4798
5159
|
}),
|
|
4799
5160
|
min: 0,
|
|
4800
5161
|
max: 48
|
|
4801
|
-
}, "gap")
|
|
4802
|
-
name: "bordered",
|
|
4803
|
-
children: formatMessage({
|
|
4804
|
-
id: 'blockBordered'
|
|
4805
|
-
})
|
|
4806
|
-
}, "bordered"), kind === 'formInfo' ? /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
5162
|
+
}, "gap"), borderedCheckbox, /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
4807
5163
|
name: "showIndex",
|
|
4808
5164
|
children: formatMessage({
|
|
4809
5165
|
id: 'blockShowIndex'
|
|
4810
5166
|
})
|
|
4811
|
-
}, "showIndex")
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
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",
|
|
4818
5173
|
label: formatMessage({
|
|
4819
|
-
id: '
|
|
5174
|
+
id: 'blockGap'
|
|
4820
5175
|
}),
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
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, {
|
|
4825
5183
|
name: "addPosition",
|
|
4826
5184
|
label: formatMessage({
|
|
4827
5185
|
id: 'blockAddPosition'
|
|
@@ -4832,30 +5190,29 @@ const BlockConfigFields = ({
|
|
|
4832
5190
|
}),
|
|
4833
5191
|
value
|
|
4834
5192
|
}))
|
|
4835
|
-
}, "addPosition") : null,
|
|
4836
|
-
name: "maxLength",
|
|
4837
|
-
label: formatMessage({
|
|
4838
|
-
id: 'blockMaxLength'
|
|
4839
|
-
}),
|
|
4840
|
-
min: 1
|
|
4841
|
-
}, "maxLength") : null, isListKind ? /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.InputNumber, {
|
|
5193
|
+
}, "addPosition") : null, /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.InputNumber, {
|
|
4842
5194
|
name: "minLength",
|
|
4843
5195
|
label: formatMessage({
|
|
4844
5196
|
id: 'blockMinLength'
|
|
4845
5197
|
}),
|
|
4846
5198
|
min: 0
|
|
4847
|
-
}, "minLength")
|
|
4848
|
-
|
|
4849
|
-
if (kind === 'choice') {
|
|
4850
|
-
list.push(/*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
4851
|
-
name: "title",
|
|
5199
|
+
}, "minLength"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.InputNumber, {
|
|
5200
|
+
name: "maxLength",
|
|
4852
5201
|
label: formatMessage({
|
|
4853
|
-
id: '
|
|
5202
|
+
id: 'blockMaxLength'
|
|
4854
5203
|
}),
|
|
4855
|
-
|
|
4856
|
-
|
|
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'
|
|
4857
5210
|
})
|
|
4858
|
-
}, "
|
|
5211
|
+
}, "important") : null);
|
|
5212
|
+
}
|
|
5213
|
+
if (kind === 'choice') {
|
|
5214
|
+
add('basic', titleInput('choiceTitlePlaceholder'));
|
|
5215
|
+
add('choiceRule', /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Select, {
|
|
4859
5216
|
name: "mode",
|
|
4860
5217
|
label: formatMessage({
|
|
4861
5218
|
id: 'choiceMode'
|
|
@@ -4896,12 +5253,8 @@ const BlockConfigFields = ({
|
|
|
4896
5253
|
display: ({
|
|
4897
5254
|
openApi
|
|
4898
5255
|
}) => openApi?.data?.mode === 'multiple'
|
|
4899
|
-
}, "maxLength")
|
|
4900
|
-
|
|
4901
|
-
children: formatMessage({
|
|
4902
|
-
id: 'choiceSelectorInData'
|
|
4903
|
-
})
|
|
4904
|
-
}, "selectorInData"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
|
|
5256
|
+
}, "maxLength"));
|
|
5257
|
+
add('choiceData', /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
|
|
4905
5258
|
name: "selectorName",
|
|
4906
5259
|
label: formatMessage({
|
|
4907
5260
|
id: 'choiceSelectorName'
|
|
@@ -4912,19 +5265,15 @@ const BlockConfigFields = ({
|
|
|
4912
5265
|
display: ({
|
|
4913
5266
|
openApi
|
|
4914
5267
|
}) => openApi?.data?.selectorInData !== false
|
|
4915
|
-
}, "selectorName")
|
|
5268
|
+
}, "selectorName"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
5269
|
+
name: "selectorInData",
|
|
5270
|
+
children: formatMessage({
|
|
5271
|
+
id: 'choiceSelectorInData'
|
|
5272
|
+
})
|
|
5273
|
+
}, "selectorInData"));
|
|
4916
5274
|
}
|
|
4917
5275
|
if (kind === 'multiField') {
|
|
4918
|
-
|
|
4919
|
-
name: "name",
|
|
4920
|
-
label: formatMessage({
|
|
4921
|
-
id: 'blockName'
|
|
4922
|
-
}),
|
|
4923
|
-
rule: "REQ",
|
|
4924
|
-
placeholder: formatMessage({
|
|
4925
|
-
id: 'fieldNamePlaceholder'
|
|
4926
|
-
})
|
|
4927
|
-
}, "name"), /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
5276
|
+
add('basic', nameInput, /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
4928
5277
|
name: "label",
|
|
4929
5278
|
label: formatMessage({
|
|
4930
5279
|
id: 'fieldLabel'
|
|
@@ -4933,42 +5282,10 @@ const BlockConfigFields = ({
|
|
|
4933
5282
|
placeholder: formatMessage({
|
|
4934
5283
|
id: 'fieldLabelPlaceholder'
|
|
4935
5284
|
})
|
|
4936
|
-
}, "label"),
|
|
4937
|
-
name: "fieldType",
|
|
4938
|
-
label: formatMessage({
|
|
4939
|
-
id: 'multiFieldType'
|
|
4940
|
-
}),
|
|
4941
|
-
rule: "REQ",
|
|
4942
|
-
options: fieldTypeOptions
|
|
4943
|
-
}, "fieldType"), /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
4944
|
-
name: "addText",
|
|
4945
|
-
label: formatMessage({
|
|
4946
|
-
id: 'blockAddText'
|
|
4947
|
-
}),
|
|
4948
|
-
placeholder: formatMessage({
|
|
4949
|
-
id: 'blockAddTextPlaceholder'
|
|
4950
|
-
})
|
|
4951
|
-
}, "addText"));
|
|
5285
|
+
}, "label"), fieldTypeSelect, addTextInput);
|
|
4952
5286
|
}
|
|
4953
5287
|
if (kind === 'matrixScale') {
|
|
4954
|
-
|
|
4955
|
-
name: "title",
|
|
4956
|
-
label: formatMessage({
|
|
4957
|
-
id: 'blockTitle'
|
|
4958
|
-
}),
|
|
4959
|
-
placeholder: formatMessage({
|
|
4960
|
-
id: 'blockTitlePlaceholder'
|
|
4961
|
-
})
|
|
4962
|
-
}, "title"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
|
|
4963
|
-
name: "name",
|
|
4964
|
-
label: formatMessage({
|
|
4965
|
-
id: 'blockName'
|
|
4966
|
-
}),
|
|
4967
|
-
rule: "REQ",
|
|
4968
|
-
placeholder: formatMessage({
|
|
4969
|
-
id: 'fieldNamePlaceholder'
|
|
4970
|
-
})
|
|
4971
|
-
}, "name"), /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
5288
|
+
add('basic', titleInput(), nameInput, /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
4972
5289
|
name: "rowTitle",
|
|
4973
5290
|
label: formatMessage({
|
|
4974
5291
|
id: 'matrixScaleRowTitle'
|
|
@@ -4976,7 +5293,14 @@ const BlockConfigFields = ({
|
|
|
4976
5293
|
placeholder: formatMessage({
|
|
4977
5294
|
id: 'matrixScaleRowTitlePlaceholder'
|
|
4978
5295
|
})
|
|
4979
|
-
}, "rowTitle"),
|
|
5296
|
+
}, "rowTitle"), fieldTypeSelect);
|
|
5297
|
+
add('rule', /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
5298
|
+
name: "required",
|
|
5299
|
+
children: formatMessage({
|
|
5300
|
+
id: 'matrixScaleRequired'
|
|
5301
|
+
})
|
|
5302
|
+
}, "required"));
|
|
5303
|
+
add('layout', /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Select, {
|
|
4980
5304
|
name: "layout",
|
|
4981
5305
|
label: formatMessage({
|
|
4982
5306
|
id: 'matrixScaleLayout'
|
|
@@ -4988,66 +5312,55 @@ const BlockConfigFields = ({
|
|
|
4988
5312
|
}),
|
|
4989
5313
|
value
|
|
4990
5314
|
}))
|
|
4991
|
-
}, "layout"),
|
|
4992
|
-
name: "fieldType",
|
|
4993
|
-
label: formatMessage({
|
|
4994
|
-
id: 'multiFieldType'
|
|
4995
|
-
}),
|
|
4996
|
-
rule: "REQ",
|
|
4997
|
-
options: fieldTypeOptions
|
|
4998
|
-
}, "fieldType"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
4999
|
-
name: "bordered",
|
|
5000
|
-
children: formatMessage({
|
|
5001
|
-
id: 'blockBordered'
|
|
5002
|
-
})
|
|
5003
|
-
}, "bordered"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
5004
|
-
name: "required",
|
|
5005
|
-
children: formatMessage({
|
|
5006
|
-
id: 'matrixScaleRequired'
|
|
5007
|
-
})
|
|
5008
|
-
}, "required"));
|
|
5315
|
+
}, "layout"), borderedCheckbox);
|
|
5009
5316
|
}
|
|
5010
5317
|
if (kind === 'steps') {
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
id: 'blockTitle'
|
|
5015
|
-
}),
|
|
5016
|
-
placeholder: formatMessage({
|
|
5017
|
-
id: 'blockTitlePlaceholder'
|
|
5018
|
-
})
|
|
5019
|
-
}, "title"), /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
|
|
5020
|
-
name: "subtitle",
|
|
5318
|
+
add('basic', titleInput(), subtitleInput);
|
|
5319
|
+
add('layout', /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Select, {
|
|
5320
|
+
name: "stepsStyle",
|
|
5021
5321
|
label: formatMessage({
|
|
5022
|
-
id: '
|
|
5322
|
+
id: 'stepsStyle'
|
|
5023
5323
|
}),
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
})
|
|
5032
|
-
}, "bordered"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
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, {
|
|
5033
5331
|
name: "autoStep",
|
|
5034
5332
|
children: formatMessage({
|
|
5035
5333
|
id: 'blockAutoStep'
|
|
5036
5334
|
})
|
|
5037
5335
|
}, "autoStep"));
|
|
5038
5336
|
}
|
|
5039
|
-
return /*#__PURE__*/jsxRuntime.
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
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
|
+
})]
|
|
5051
5364
|
});
|
|
5052
5365
|
};
|
|
5053
5366
|
const BlockEditorModal = ({
|
|
@@ -5085,7 +5398,7 @@ const BlockEditorModal = ({
|
|
|
5085
5398
|
}),
|
|
5086
5399
|
open: open,
|
|
5087
5400
|
onCancel: onCancel,
|
|
5088
|
-
|
|
5401
|
+
...getPropertyModalProps(isMobile, 720),
|
|
5089
5402
|
...(renderModal ? {
|
|
5090
5403
|
renderModal
|
|
5091
5404
|
} : {}),
|
|
@@ -5126,7 +5439,7 @@ const StepEditorModal = ({
|
|
|
5126
5439
|
}),
|
|
5127
5440
|
open: open,
|
|
5128
5441
|
onCancel: onCancel,
|
|
5129
|
-
|
|
5442
|
+
...getPropertyModalProps(isMobile, 560),
|
|
5130
5443
|
...(renderModal ? {
|
|
5131
5444
|
renderModal
|
|
5132
5445
|
} : {}),
|
|
@@ -5142,25 +5455,28 @@ const StepEditorModal = ({
|
|
|
5142
5455
|
cancelText: formatMessage({
|
|
5143
5456
|
id: 'cancel'
|
|
5144
5457
|
}),
|
|
5145
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
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
|
+
})
|
|
5164
5480
|
})
|
|
5165
5481
|
}, open ? step?.id ? `edit-${step.id}` : `add-step-${formData.title || 'new'}` : 'closed');
|
|
5166
5482
|
};
|
|
@@ -5186,7 +5502,7 @@ const ChoiceOptionEditorModal = ({
|
|
|
5186
5502
|
}),
|
|
5187
5503
|
open: open,
|
|
5188
5504
|
onCancel: onCancel,
|
|
5189
|
-
|
|
5505
|
+
...getPropertyModalProps(isMobile, 560),
|
|
5190
5506
|
...(renderModal ? {
|
|
5191
5507
|
renderModal
|
|
5192
5508
|
} : {}),
|
|
@@ -5202,26 +5518,26 @@ const ChoiceOptionEditorModal = ({
|
|
|
5202
5518
|
cancelText: formatMessage({
|
|
5203
5519
|
id: 'cancel'
|
|
5204
5520
|
}),
|
|
5205
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
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
|
+
})
|
|
5217
5536
|
})
|
|
5218
5537
|
}, open ? option?.id ? `edit-option-${option.id}` : `add-option-${formData.title || 'new'}` : 'closed');
|
|
5219
5538
|
};
|
|
5220
5539
|
var ChoiceOptionEditorModal$1 = ChoiceOptionEditorModal;
|
|
5221
5540
|
|
|
5222
|
-
const {
|
|
5223
|
-
Text: Text$3
|
|
5224
|
-
} = antd.Typography;
|
|
5225
5541
|
const {
|
|
5226
5542
|
useOnChange
|
|
5227
5543
|
} = reactFormAntd.hooks;
|
|
@@ -5230,7 +5546,9 @@ const RulePresetsGroup = props => {
|
|
|
5230
5546
|
return render(antd.Checkbox.Group);
|
|
5231
5547
|
};
|
|
5232
5548
|
RulePresetsGroup.field = antd.Checkbox.Group;
|
|
5233
|
-
const RulePresetEditor = (
|
|
5549
|
+
const RulePresetEditor = ({
|
|
5550
|
+
column = 1
|
|
5551
|
+
}) => {
|
|
5234
5552
|
const {
|
|
5235
5553
|
formatMessage
|
|
5236
5554
|
} = reactIntl.useIntl();
|
|
@@ -5267,20 +5585,15 @@ const RulePresetEditor = () => {
|
|
|
5267
5585
|
display: ({
|
|
5268
5586
|
openApi
|
|
5269
5587
|
}) => (openApi?.data?.rulePresets || []).includes(RULE_LEN_PRESET)
|
|
5270
|
-
}, "lenMax")
|
|
5271
|
-
block: true,
|
|
5272
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Text$3, {
|
|
5273
|
-
type: "secondary",
|
|
5274
|
-
children: formatMessage({
|
|
5275
|
-
id: 'ruleEditorHint'
|
|
5276
|
-
})
|
|
5277
|
-
})
|
|
5278
|
-
}, "rule-hint")];
|
|
5588
|
+
}, "lenMax")];
|
|
5279
5589
|
return /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
|
|
5280
5590
|
title: formatMessage({
|
|
5281
5591
|
id: 'fieldRule'
|
|
5282
5592
|
}),
|
|
5283
|
-
|
|
5593
|
+
subtitle: formatMessage({
|
|
5594
|
+
id: 'ruleEditorHint'
|
|
5595
|
+
}),
|
|
5596
|
+
column: column,
|
|
5284
5597
|
list: list
|
|
5285
5598
|
});
|
|
5286
5599
|
};
|
|
@@ -5882,6 +6195,9 @@ const OptionsEditor = ({
|
|
|
5882
6195
|
title: formatMessage({
|
|
5883
6196
|
id: 'fieldOptions'
|
|
5884
6197
|
}),
|
|
6198
|
+
subtitle: formatMessage({
|
|
6199
|
+
id: 'fieldOptionsDesc'
|
|
6200
|
+
}),
|
|
5885
6201
|
column: 1,
|
|
5886
6202
|
list: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5887
6203
|
block: true,
|
|
@@ -5907,7 +6223,8 @@ const OptionsEditor = ({
|
|
|
5907
6223
|
var OptionsEditor$1 = OptionsEditor;
|
|
5908
6224
|
|
|
5909
6225
|
const SuperSelectPropsEditor = ({
|
|
5910
|
-
definition
|
|
6226
|
+
definition,
|
|
6227
|
+
column = 1
|
|
5911
6228
|
}) => {
|
|
5912
6229
|
const {
|
|
5913
6230
|
formatMessage
|
|
@@ -5996,8 +6313,11 @@ const SuperSelectPropsEditor = ({
|
|
|
5996
6313
|
title: formatMessage({
|
|
5997
6314
|
id: 'superSelectPropsSection'
|
|
5998
6315
|
}),
|
|
5999
|
-
|
|
6000
|
-
|
|
6316
|
+
subtitle: formatMessage({
|
|
6317
|
+
id: 'fieldPropsSectionDesc'
|
|
6318
|
+
}),
|
|
6319
|
+
column: column,
|
|
6320
|
+
list: arrangeEditorItems(list, column)
|
|
6001
6321
|
});
|
|
6002
6322
|
};
|
|
6003
6323
|
var SuperSelectPropsEditor$1 = SuperSelectPropsEditor;
|
|
@@ -6307,7 +6627,8 @@ const buildBuiltinList = (type, formatMessage) => {
|
|
|
6307
6627
|
};
|
|
6308
6628
|
const FieldPropsEditor = ({
|
|
6309
6629
|
type,
|
|
6310
|
-
definition: definitionProp
|
|
6630
|
+
definition: definitionProp,
|
|
6631
|
+
column = 1
|
|
6311
6632
|
}) => {
|
|
6312
6633
|
const {
|
|
6313
6634
|
formatMessage
|
|
@@ -6329,8 +6650,11 @@ const FieldPropsEditor = ({
|
|
|
6329
6650
|
title: formatMessage({
|
|
6330
6651
|
id: 'fieldPropsSection'
|
|
6331
6652
|
}),
|
|
6332
|
-
|
|
6333
|
-
|
|
6653
|
+
subtitle: formatMessage({
|
|
6654
|
+
id: 'fieldPropsSectionDesc'
|
|
6655
|
+
}),
|
|
6656
|
+
column: column,
|
|
6657
|
+
list: arrangeEditorItems(list, column)
|
|
6334
6658
|
});
|
|
6335
6659
|
};
|
|
6336
6660
|
const hasFieldPropsEditor = (type, definition) => {
|
|
@@ -6772,6 +7096,7 @@ const FieldConfigFields = ({
|
|
|
6772
7096
|
const {
|
|
6773
7097
|
openApi
|
|
6774
7098
|
} = reactFormAntd.useFormContext();
|
|
7099
|
+
const column = getEditorColumn(responsiveUtils.useIsMobile());
|
|
6775
7100
|
const [fieldType, setFieldType] = react.useState(initialType);
|
|
6776
7101
|
const fieldTypeOptions = react.useMemo(() => getFieldTypes(formatMessage), [formatMessage]);
|
|
6777
7102
|
const definition = getFieldDefinition(fieldType);
|
|
@@ -6803,7 +7128,7 @@ const FieldConfigFields = ({
|
|
|
6803
7128
|
});
|
|
6804
7129
|
});
|
|
6805
7130
|
};
|
|
6806
|
-
const
|
|
7131
|
+
const basicList = [/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Select, {
|
|
6807
7132
|
name: "type",
|
|
6808
7133
|
label: formatMessage({
|
|
6809
7134
|
id: 'fieldType'
|
|
@@ -6842,6 +7167,7 @@ const FieldConfigFields = ({
|
|
|
6842
7167
|
})
|
|
6843
7168
|
}, "tips"), /*#__PURE__*/jsxRuntime.jsx(LocaleTextArea, {
|
|
6844
7169
|
name: "description",
|
|
7170
|
+
block: true,
|
|
6845
7171
|
label: formatMessage({
|
|
6846
7172
|
id: 'fieldDescription'
|
|
6847
7173
|
}),
|
|
@@ -6850,7 +7176,7 @@ const FieldConfigFields = ({
|
|
|
6850
7176
|
}),
|
|
6851
7177
|
rows: 2
|
|
6852
7178
|
}, "description")];
|
|
6853
|
-
|
|
7179
|
+
const displayList = [/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
6854
7180
|
name: "block",
|
|
6855
7181
|
children: formatMessage({
|
|
6856
7182
|
id: 'fieldBlock'
|
|
@@ -6860,21 +7186,26 @@ const FieldConfigFields = ({
|
|
|
6860
7186
|
children: formatMessage({
|
|
6861
7187
|
id: 'fieldHidden'
|
|
6862
7188
|
})
|
|
6863
|
-
}, "hidden")
|
|
7189
|
+
}, "hidden")];
|
|
6864
7190
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6865
7191
|
className: style['field-editor-form'],
|
|
6866
7192
|
children: [/*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
|
|
6867
7193
|
title: formatMessage({
|
|
6868
7194
|
id: 'fieldBasicSection'
|
|
6869
7195
|
}),
|
|
6870
|
-
|
|
6871
|
-
|
|
7196
|
+
subtitle: formatMessage({
|
|
7197
|
+
id: 'fieldBasicSectionDesc'
|
|
7198
|
+
}),
|
|
7199
|
+
column: column,
|
|
7200
|
+
list: basicList
|
|
6872
7201
|
}), definition?.isSuperSelect ? /*#__PURE__*/jsxRuntime.jsx(SuperSelectPropsEditor$1, {
|
|
6873
|
-
definition: definition
|
|
7202
|
+
definition: definition,
|
|
7203
|
+
column: column
|
|
6874
7204
|
}) : hasFieldPropsEditor(fieldType, definition) ? /*#__PURE__*/jsxRuntime.jsx(FieldPropsEditor$1, {
|
|
6875
7205
|
type: fieldType,
|
|
6876
|
-
definition: definition
|
|
6877
|
-
|
|
7206
|
+
definition: definition,
|
|
7207
|
+
column: column
|
|
7208
|
+
}) : null, definition?.hasBuiltinData ? /*#__PURE__*/jsxRuntime.jsx(Text, {
|
|
6878
7209
|
type: "secondary",
|
|
6879
7210
|
children: formatMessage({
|
|
6880
7211
|
id: 'builtinDataHint'
|
|
@@ -6887,7 +7218,18 @@ const FieldConfigFields = ({
|
|
|
6887
7218
|
hasColumns: definition.hasColumns,
|
|
6888
7219
|
columns: columns,
|
|
6889
7220
|
onColumnsChange: onColumnsChange
|
|
6890
|
-
}) : 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, {
|
|
6891
7233
|
...conditionProps,
|
|
6892
7234
|
value: visibleWhen,
|
|
6893
7235
|
onChange: onVisibleWhenChange
|
|
@@ -6999,7 +7341,7 @@ const FieldEditorModal = ({
|
|
|
6999
7341
|
}),
|
|
7000
7342
|
open: open,
|
|
7001
7343
|
onCancel: onCancel,
|
|
7002
|
-
|
|
7344
|
+
...getPropertyModalProps(isMobile, 760),
|
|
7003
7345
|
...(renderModal ? {
|
|
7004
7346
|
renderModal
|
|
7005
7347
|
} : {}),
|
|
@@ -7041,6 +7383,7 @@ const FormActionsEditor = ({
|
|
|
7041
7383
|
formatMessage
|
|
7042
7384
|
} = reactIntl.useIntl();
|
|
7043
7385
|
const isMobile = responsiveUtils.useIsMobile();
|
|
7386
|
+
const column = getEditorColumn(isMobile);
|
|
7044
7387
|
const formData = react.useMemo(() => normalizeFormActions(value), [value, open]);
|
|
7045
7388
|
const alignOptions = react.useMemo(() => [{
|
|
7046
7389
|
label: formatMessage({
|
|
@@ -7073,7 +7416,7 @@ const FormActionsEditor = ({
|
|
|
7073
7416
|
}),
|
|
7074
7417
|
open: open,
|
|
7075
7418
|
onCancel: onCancel,
|
|
7076
|
-
|
|
7419
|
+
...getPropertyModalProps(isMobile, 560),
|
|
7077
7420
|
...(renderModal ? {
|
|
7078
7421
|
renderModal
|
|
7079
7422
|
} : {}),
|
|
@@ -7090,9 +7433,15 @@ const FormActionsEditor = ({
|
|
|
7090
7433
|
id: 'cancel'
|
|
7091
7434
|
}),
|
|
7092
7435
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
7093
|
-
className: style['form-actions-editor']
|
|
7436
|
+
className: `${style['field-editor-form']} ${style['form-actions-editor']}`,
|
|
7094
7437
|
children: [/*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
|
|
7095
|
-
|
|
7438
|
+
title: formatMessage({
|
|
7439
|
+
id: 'formActionsButtonsSection'
|
|
7440
|
+
}),
|
|
7441
|
+
subtitle: formatMessage({
|
|
7442
|
+
id: 'formActionsButtonsSectionDesc'
|
|
7443
|
+
}),
|
|
7444
|
+
column: column,
|
|
7096
7445
|
list: [/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Switch, {
|
|
7097
7446
|
name: "showSubmit",
|
|
7098
7447
|
label: formatMessage({
|
|
@@ -7110,10 +7459,7 @@ const FormActionsEditor = ({
|
|
|
7110
7459
|
display: ({
|
|
7111
7460
|
openApi
|
|
7112
7461
|
}) => Boolean(openApi?.data?.showSubmit)
|
|
7113
|
-
}, "submitText")
|
|
7114
|
-
}), /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
|
|
7115
|
-
column: 2,
|
|
7116
|
-
list: [/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Switch, {
|
|
7462
|
+
}, "submitText"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Switch, {
|
|
7117
7463
|
name: "showReset",
|
|
7118
7464
|
label: formatMessage({
|
|
7119
7465
|
id: 'formActionsShowReset'
|
|
@@ -7130,10 +7476,7 @@ const FormActionsEditor = ({
|
|
|
7130
7476
|
display: ({
|
|
7131
7477
|
openApi
|
|
7132
7478
|
}) => Boolean(openApi?.data?.showReset)
|
|
7133
|
-
}, "resetText")
|
|
7134
|
-
}), /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
|
|
7135
|
-
column: 2,
|
|
7136
|
-
list: [/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Switch, {
|
|
7479
|
+
}, "resetText"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Switch, {
|
|
7137
7480
|
name: "showCancel",
|
|
7138
7481
|
label: formatMessage({
|
|
7139
7482
|
id: 'formActionsShowCancel'
|
|
@@ -7151,39 +7494,37 @@ const FormActionsEditor = ({
|
|
|
7151
7494
|
openApi
|
|
7152
7495
|
}) => Boolean(openApi?.data?.showCancel)
|
|
7153
7496
|
}, "cancelText")]
|
|
7154
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
}, "gap")]
|
|
7186
|
-
})]
|
|
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")]
|
|
7187
7528
|
})]
|
|
7188
7529
|
})
|
|
7189
7530
|
}, open ? 'form-actions-open' : 'form-actions-closed');
|
|
@@ -7474,6 +7815,278 @@ const ChoiceBlock = ({
|
|
|
7474
7815
|
};
|
|
7475
7816
|
var ChoiceBlock$1 = ChoiceBlock;
|
|
7476
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
|
+
let _exit;
|
|
7901
|
+
if (loading || isLast) {
|
|
7902
|
+
return Promise.resolve();
|
|
7903
|
+
}
|
|
7904
|
+
setLoading(true);
|
|
7905
|
+
return Promise.resolve(_finallyRethrows(function () {
|
|
7906
|
+
let _exit2;
|
|
7907
|
+
const names = getStepFieldNames(items[current]);
|
|
7908
|
+
// validateFieldsByName 失败时会滚到首个错字段(同提交 ScrollToError);旧版 form-info 无此行为时下方兜底
|
|
7909
|
+
return Promise.resolve(FormInfo.validateFieldsByName(openApi, names)).then(function (_validateFieldsByName) {
|
|
7910
|
+
if (_validateFieldsByName) {
|
|
7911
|
+
onChange(current + 1);
|
|
7912
|
+
_exit = 1;
|
|
7913
|
+
return;
|
|
7914
|
+
}
|
|
7915
|
+
const firstInvalid = names.find(name => {
|
|
7916
|
+
const field = openApi?.getField?.({
|
|
7917
|
+
name
|
|
7918
|
+
});
|
|
7919
|
+
return field && field.isPass === false;
|
|
7920
|
+
});
|
|
7921
|
+
const el = firstInvalid ? openApi?.getField?.({
|
|
7922
|
+
name: firstInvalid
|
|
7923
|
+
})?.fieldRef?.current : null;
|
|
7924
|
+
if (el && typeof el.scrollIntoView === 'function') {
|
|
7925
|
+
requestAnimationFrame(() => {
|
|
7926
|
+
el.scrollIntoView();
|
|
7927
|
+
});
|
|
7928
|
+
}
|
|
7929
|
+
});
|
|
7930
|
+
}, function (_wasThrown, _result) {
|
|
7931
|
+
setLoading(false);
|
|
7932
|
+
if (_wasThrown) throw _result;
|
|
7933
|
+
return _result;
|
|
7934
|
+
}));
|
|
7935
|
+
} catch (e) {
|
|
7936
|
+
return Promise.reject(e);
|
|
7937
|
+
}
|
|
7938
|
+
};
|
|
7939
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
7940
|
+
className: style['steps-focus-actions'],
|
|
7941
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
7942
|
+
className: style['steps-focus-actions-side'],
|
|
7943
|
+
children: !isFirst ? /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
7944
|
+
className: style['steps-focus-prev'],
|
|
7945
|
+
variant: "text",
|
|
7946
|
+
color: "default",
|
|
7947
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowLeftOutlined, {}),
|
|
7948
|
+
onClick: () => onChange(current - 1),
|
|
7949
|
+
children: formatMessage({
|
|
7950
|
+
id: 'stepsFocusPrev'
|
|
7951
|
+
})
|
|
7952
|
+
}) : null
|
|
7953
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
7954
|
+
className: cx(style['steps-focus-actions-side'], style['is-end']),
|
|
7955
|
+
children: isLast ? /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
7956
|
+
className: style['steps-focus-done-hint'],
|
|
7957
|
+
children: formatMessage({
|
|
7958
|
+
id: 'stepsFocusSubmitHint'
|
|
7959
|
+
})
|
|
7960
|
+
}) : /*#__PURE__*/jsxRuntime.jsxs(antd.Button, {
|
|
7961
|
+
className: style['steps-focus-next-btn'],
|
|
7962
|
+
variant: "filled",
|
|
7963
|
+
color: "primary",
|
|
7964
|
+
loading: loading,
|
|
7965
|
+
onClick: handleNext,
|
|
7966
|
+
children: [formatMessage({
|
|
7967
|
+
id: 'stepsFocusNextBtn'
|
|
7968
|
+
}), /*#__PURE__*/jsxRuntime.jsx(icons.ArrowRightOutlined, {
|
|
7969
|
+
className: style['steps-focus-next-btn-icon']
|
|
7970
|
+
})]
|
|
7971
|
+
})
|
|
7972
|
+
})]
|
|
7973
|
+
});
|
|
7974
|
+
};
|
|
7975
|
+
|
|
7976
|
+
/**
|
|
7977
|
+
* stepsStyle: 'focus':受控 current,用自绘头部(序号 / 标题 / 分段进度)替换 antd 步骤条,
|
|
7978
|
+
* 并用自绘底部操作区替换 form-info 的链接式上一步 / 下一步;提交失败跳错步、重置仍由 form-info Steps 负责。
|
|
7979
|
+
*/
|
|
7980
|
+
const FocusSteps = ({
|
|
7981
|
+
items = [],
|
|
7982
|
+
formatMessage,
|
|
7983
|
+
stepsClassName,
|
|
7984
|
+
...props
|
|
7985
|
+
}) => {
|
|
7986
|
+
const {
|
|
7987
|
+
openApi
|
|
7988
|
+
} = reactFormAntd.useFormContext() || {};
|
|
7989
|
+
const [current, setCurrent] = react.useState(0);
|
|
7990
|
+
const headerRef = react.useRef(null);
|
|
7991
|
+
const mountedRef = react.useRef(false);
|
|
7992
|
+
const safeCurrent = Math.min(current, Math.max(items.length - 1, 0));
|
|
7993
|
+
const currentRef = react.useRef(safeCurrent);
|
|
7994
|
+
currentRef.current = safeCurrent;
|
|
7995
|
+
const itemsRef = react.useRef(items);
|
|
7996
|
+
itemsRef.current = items;
|
|
7997
|
+
const stepTitle = index => items[index]?.title || formatMessage({
|
|
7998
|
+
id: 'untitledStep'
|
|
7999
|
+
}, {
|
|
8000
|
+
index: index + 1
|
|
8001
|
+
});
|
|
8002
|
+
react.useEffect(() => {
|
|
8003
|
+
if (!mountedRef.current) {
|
|
8004
|
+
mountedRef.current = true;
|
|
8005
|
+
return;
|
|
8006
|
+
}
|
|
8007
|
+
const node = headerRef.current;
|
|
8008
|
+
if (node && node.getBoundingClientRect().top < 0) {
|
|
8009
|
+
node.scrollIntoView({
|
|
8010
|
+
behavior: 'smooth',
|
|
8011
|
+
block: 'start'
|
|
8012
|
+
});
|
|
8013
|
+
}
|
|
8014
|
+
}, [safeCurrent]);
|
|
8015
|
+
|
|
8016
|
+
// 提交失败时:若当前步字段有错则强制留在当前步,避免误跳到后续错步
|
|
8017
|
+
react.useEffect(() => {
|
|
8018
|
+
const emitter = openApi?.emitter;
|
|
8019
|
+
if (!emitter?.addListener) {
|
|
8020
|
+
return undefined;
|
|
8021
|
+
}
|
|
8022
|
+
const stayIfCurrentHasError = errors => {
|
|
8023
|
+
const step = itemsRef.current[currentRef.current];
|
|
8024
|
+
const names = new Set(getStepFieldNames(step));
|
|
8025
|
+
if (!names.size) {
|
|
8026
|
+
return;
|
|
8027
|
+
}
|
|
8028
|
+
const currentHasError = (errors || []).some(item => names.has(item?.name) || names.has(item?.groupName));
|
|
8029
|
+
if (currentHasError) {
|
|
8030
|
+
setCurrent(currentRef.current);
|
|
8031
|
+
}
|
|
8032
|
+
};
|
|
8033
|
+
const errorSub = emitter.addListener('form:submit:error', stayIfCurrentHasError);
|
|
8034
|
+
const completeSub = emitter.addListener('form:submit:complete', ({
|
|
8035
|
+
isPass,
|
|
8036
|
+
errors
|
|
8037
|
+
} = {}) => {
|
|
8038
|
+
if (!isPass) {
|
|
8039
|
+
stayIfCurrentHasError(errors);
|
|
8040
|
+
}
|
|
8041
|
+
});
|
|
8042
|
+
return () => {
|
|
8043
|
+
errorSub?.remove?.();
|
|
8044
|
+
completeSub?.remove?.();
|
|
8045
|
+
};
|
|
8046
|
+
}, [openApi]);
|
|
8047
|
+
const focusItems = items.map((item, index) => {
|
|
8048
|
+
if (index !== safeCurrent) {
|
|
8049
|
+
return item;
|
|
8050
|
+
}
|
|
8051
|
+
return {
|
|
8052
|
+
...item,
|
|
8053
|
+
title: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
8054
|
+
ref: headerRef,
|
|
8055
|
+
children: /*#__PURE__*/jsxRuntime.jsx(FocusStepsHeader, {
|
|
8056
|
+
items: items,
|
|
8057
|
+
current: safeCurrent,
|
|
8058
|
+
stepTitle: stepTitle,
|
|
8059
|
+
formatMessage: formatMessage,
|
|
8060
|
+
onJump: setCurrent
|
|
8061
|
+
})
|
|
8062
|
+
}),
|
|
8063
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
8064
|
+
children: [item.children != null ? item.children : /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
|
|
8065
|
+
column: item.column,
|
|
8066
|
+
gap: item.gap,
|
|
8067
|
+
list: item.list || [],
|
|
8068
|
+
className: item.className
|
|
8069
|
+
}), /*#__PURE__*/jsxRuntime.jsx(FocusStepsActions, {
|
|
8070
|
+
items: items,
|
|
8071
|
+
current: safeCurrent,
|
|
8072
|
+
formatMessage: formatMessage,
|
|
8073
|
+
onChange: setCurrent
|
|
8074
|
+
})]
|
|
8075
|
+
})
|
|
8076
|
+
};
|
|
8077
|
+
});
|
|
8078
|
+
return /*#__PURE__*/jsxRuntime.jsx(FormInfo.Steps, {
|
|
8079
|
+
...props,
|
|
8080
|
+
showActions: false,
|
|
8081
|
+
orientation: "horizontal",
|
|
8082
|
+
stepsClassName: cx(stepsClassName, style['steps-focus']),
|
|
8083
|
+
items: focusItems,
|
|
8084
|
+
current: safeCurrent,
|
|
8085
|
+
onChange: setCurrent
|
|
8086
|
+
});
|
|
8087
|
+
};
|
|
8088
|
+
var FocusSteps$1 = FocusSteps;
|
|
8089
|
+
|
|
7477
8090
|
/**
|
|
7478
8091
|
* 按 visibleWhen 过滤字段的 FormInfo:
|
|
7479
8092
|
* entries 为 [{ element, path, visibleWhen }],不满足条件的字段从 list 中移除(卸载即不参与校验),
|
|
@@ -7891,19 +8504,30 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
|
|
|
7891
8504
|
}
|
|
7892
8505
|
case 'steps':
|
|
7893
8506
|
{
|
|
7894
|
-
|
|
8507
|
+
const isFocusSteps = block.stepsStyle === 'focus';
|
|
8508
|
+
// 与 formInfo 一致:block.showIndex(或 step 上覆盖)时给题干加序号
|
|
8509
|
+
const blockShowIndex = !!block.showIndex;
|
|
8510
|
+
return withBlockLayout(/*#__PURE__*/react.createElement(isFocusSteps ? FocusSteps$1 : FormInfo.Steps, {
|
|
7895
8511
|
key: block.id,
|
|
7896
8512
|
title: block.title || undefined,
|
|
7897
8513
|
subtitle: block.subtitle || undefined,
|
|
7898
8514
|
bordered,
|
|
7899
8515
|
className: resolvePartRootClassName(depth),
|
|
8516
|
+
...(isFocusSteps ? {
|
|
8517
|
+
formatMessage
|
|
8518
|
+
} : null),
|
|
7900
8519
|
prevIcon: /*#__PURE__*/react.createElement(icons.ArrowLeftOutlined),
|
|
7901
8520
|
nextIcon: /*#__PURE__*/react.createElement(icons.ArrowRightOutlined),
|
|
7902
8521
|
items: (block.items || []).map(step => {
|
|
7903
|
-
const
|
|
8522
|
+
const showIndex = step.showIndex != null ? !!step.showIndex : blockShowIndex;
|
|
8523
|
+
const entries = renderFieldEntries(step.list, preview, {
|
|
8524
|
+
...fieldRenderOpts,
|
|
8525
|
+
showIndex
|
|
8526
|
+
});
|
|
7904
8527
|
const nested = renderChildBlocks(step.blocks || [], nextCtx);
|
|
7905
8528
|
const fieldNames = [...(step.list || []).filter(field => field && !field.hidden && field.name).map(field => field.name), ...collectBlockFieldNames(step.blocks || [])];
|
|
7906
8529
|
const hasConditional = entries.some(entry => entry.visibleWhen);
|
|
8530
|
+
const indexClassName = showIndex ? style['form-info-show-index'] : null;
|
|
7907
8531
|
if (nested.length || hasConditional) {
|
|
7908
8532
|
return {
|
|
7909
8533
|
key: step.id,
|
|
@@ -7916,7 +8540,8 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
|
|
|
7916
8540
|
}, entries.length ? createFieldsFormInfo({
|
|
7917
8541
|
key: `${step.id}-fields`,
|
|
7918
8542
|
column: step.column,
|
|
7919
|
-
gap: block.gap
|
|
8543
|
+
gap: block.gap,
|
|
8544
|
+
className: indexClassName
|
|
7920
8545
|
}, entries, [], knownNames) : null, ...nested)
|
|
7921
8546
|
};
|
|
7922
8547
|
}
|
|
@@ -7926,6 +8551,7 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
|
|
|
7926
8551
|
column: step.column,
|
|
7927
8552
|
gap: block.gap,
|
|
7928
8553
|
list: entries.map(entry => entry.element),
|
|
8554
|
+
className: indexClassName,
|
|
7929
8555
|
fieldNames
|
|
7930
8556
|
};
|
|
7931
8557
|
})
|
|
@@ -8103,7 +8729,7 @@ const resolveActionNode = ({
|
|
|
8103
8729
|
return actionsEl;
|
|
8104
8730
|
}
|
|
8105
8731
|
const footerProps = buttonFooterProps || {};
|
|
8106
|
-
return /*#__PURE__*/react.createElement(
|
|
8732
|
+
return /*#__PURE__*/react.createElement(ButtonGroup.ButtonFooter, footerProps, actionsEl);
|
|
8107
8733
|
};
|
|
8108
8734
|
const SchemaRendererInner = withLocale$1(props => {
|
|
8109
8735
|
const {
|