@kne/form-creator 0.1.21 → 0.1.23
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 +88 -5
- package/dist/index.css +4 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +622 -697
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +218 -93
- package/dist/index.modern.js.map +1 -1
- package/dist/locale/en-US.js +18 -0
- package/dist/locale/en-US.js.map +1 -1
- package/dist/locale/en-US.modern.js +18 -0
- package/dist/locale/en-US.modern.js.map +1 -1
- package/dist/locale/zh-CN.js +18 -0
- package/dist/locale/zh-CN.js.map +1 -1
- package/dist/locale/zh-CN.modern.js +18 -0
- package/dist/locale/zh-CN.modern.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var SelectList__default = /*#__PURE__*/_interopDefaultLegacy(SelectList);
|
|
|
23
23
|
var FormInfo__default = /*#__PURE__*/_interopDefaultLegacy(FormInfo);
|
|
24
24
|
var InfoPage__default = /*#__PURE__*/_interopDefaultLegacy(InfoPage);
|
|
25
25
|
|
|
26
|
-
var style = {"kne-responsive-boundary":"kne-form-creator_gh14z","kne-responsive-scroll":"kne-form-creator_Kfn6L","option-group-stack":"kne-form-creator_TgBT-","form-info-show-index":"kne-form-creator_rqCos","field-label-index":"kne-form-creator_MLY0O","field-label-main":"kne-form-creator_UOUb4","form-creator":"kne-form-creator_Xrjrk","editor-pane":"kne-form-creator_Skfuv","preview-pane":"kne-form-creator_v4Lsp","editor-header":"kne-form-creator_WaSS-","block-list-panel":"kne-form-creator_lx8An","form-actions-setting-btn":"kne-form-creator_NekU2","panel-toolbar":"kne-form-creator_t0WxZ","panel-toolbar-extra":"kne-form-creator_O22ZM","schema-content":"kne-form-creator_9bWOD","schema-content-fields":"kne-form-creator_EmRDV","schema-content-field":"kne-form-creator_0Lanz","schema-content-field-block":"kne-form-creator_TQd-w","schema-content-field-label":"kne-form-creator_czEK3","schema-content-field-value":"kne-form-creator_YFKTK","schema-content-file-list":"kne-form-creator_UGdXA","schema-content-file":"kne-form-creator_75EtE","schema-content-file-image":"kne-form-creator_P-be6","schema-content-file-name":"kne-form-creator_NXpTS","add-block-btn":"kne-form-creator_16Zre","add-inline-btn":"kne-form-creator_iCYdB","ant-btn-disabled":"kne-form-creator_LdGtv","block-list":"kne-form-creator_wK5eK","block-section":"kne-form-creator_15IiK","block-kind-formInfo":"kne-form-creator_D0hoK","block-kind-list":"kne-form-creator_JdPhy","block-kind-tableList":"kne-form-creator_gzd64","block-kind-multiField":"kne-form-creator_t0iOJ","block-kind-steps":"kne-form-creator_QNF9W","step-section":"kne-form-creator_22ajp","block-section-header":"kne-form-creator_wS4rL","block-header-left":"kne-form-creator_t4awC","block-title":"kne-form-creator_wSVJf","block-summary":"kne-form-creator_GzeW8","block-header-actions":"kne-form-creator_Ue-nT","block-body":"kne-form-creator_je1H0","item-blocks-section":"kne-form-creator_wq4bT","nested-block-list":"kne-form-creator_4NWH4","block-section-nested":"kne-form-creator_mUKom","add-field-dropdown":"kne-form-creator_9JS0d","add-field-dropdown-item":"kne-form-creator_Ql1z3","add-field-dropdown-item-icon":"kne-form-creator_ZHB5O","add-field-dropdown-item-desc":"kne-form-creator_dcsOS","add-field-dropdown-divider":"kne-form-creator_CUK0H","add-field-dropdown-label":"kne-form-creator_bPJ-2","section-toolbar":"kne-form-creator_LUO8S","section-toolbar-label":"kne-form-creator_7KQ79","field-list":"kne-form-creator_-B7WZ","step-list":"kne-form-creator_kc1pH","step-section-header":"kne-form-creator_wkhEX","step-section-title":"kne-form-creator_NBinE","step-section-actions":"kne-form-creator_es-FC","step-index":"kne-form-creator_CCKZZ","field-row":"kne-form-creator_XMkdt","field-row-index":"kne-form-creator_a-cDo","field-row-main":"kne-form-creator_ftlwp","inline-empty":"kne-form-creator_yP-RF","action-group":"kne-form-creator_773yo","hover-reveal":"kne-form-creator_S234h","hover-reveal-active":"kne-form-creator_AE-6r","action-btn":"kne-form-creator_mLgqh","add-block-dropdown":"kne-form-creator_vmS-e","add-block-option":"kne-form-creator_gjg2Y","add-block-option-icon":"kne-form-creator_qh1hh","add-block-option-text":"kne-form-creator_G8iJO","add-block-option-title":"kne-form-creator_ETSvm","add-block-option-desc":"kne-form-creator_O0C3l","field-empty":"kne-form-creator_Nmpfl","field-label-tips-icon":"kne-form-creator_0VVaO","preview-header":"kne-form-creator_c4BT0","preview-title":"kne-form-creator_fPkK4","preview-body":"kne-form-creator_6JntQ","schema-form":"kne-form-creator_MxCWP","schema-body":"kne-form-creator_q9ydz","schema-actions":"kne-form-creator_Y4eEH","schema-actions-inner":"kne-form-creator_FT9Zf","choice-block":"kne-form-creator_RllJe","choice-selector":"kne-form-creator_5A1eM","choice-panels":"kne-form-creator_IO0MY","choice-panels-empty":"kne-form-creator_T0nND","choice-option-panel":"kne-form-creator_FQixN","choice-option-panel-title":"kne-form-creator_ofRo2","choice-option-summary":"kne-form-creator_pksH8","field-editor-form":"kne-form-creator_PGPHL","form-actions-editor":"kne-form-creator_fchMy","form-actions-switch-field":"kne-form-creator_6JE9x","form-actions-layout-panel":"kne-form-creator_rtm9D","form-actions-align-group":"kne-form-creator_51ZsV","form-actions-layout-title":"kne-form-creator_hFeiC","form-actions-gap-slider":"kne-form-creator_Gq0bk","editor-section":"kne-form-creator_jJy85","section-divider":"kne-form-creator_zA7L-","rule-editor":"kne-form-creator_bAlGU","options-editor":"kne-form-creator_AK4yO","super-select-props":"kne-form-creator_Iawhh","field-props-editor":"kne-form-creator_Gabf2","columns-editor":"kne-form-creator_DQW1N","prop-row":"kne-form-creator_7K54P","prop-label":"kne-form-creator_HAAyH","options-item":"kne-form-creator_dnOd2","table-row-card":"kne-form-creator_cwCYp","tree-options-editor":"kne-form-creator_s3nHO","tree-options-list":"kne-form-creator_Djs-E","tree-option-node":"kne-form-creator_XAcut","tree-option-row":"kne-form-creator_4K4Rj","tree-option-fields":"kne-form-creator_-4cjc","tree-option-actions":"kne-form-creator_IjCNI","tree-option-children":"kne-form-creator_pVPGJ","tree-add-sibling":"kne-form-creator_bl46P","rule-checkbox-group":"kne-form-creator_tDgVP","rule-len-row":"kne-form-creator_ATsae","rule-len-input":"kne-form-creator_jY4Ld","rule-len-sep":"kne-form-creator_jBDC8","options-list":"kne-form-creator_GUBNS","options-row":"kne-form-creator_uohD0","options-tip":"kne-form-creator_vrTmK","icon-square-btn":"kne-form-creator_DZjCf","icon-square-btn-sm":"kne-form-creator_GAh-t","is-mobile":"kne-form-creator_LtgJz"};
|
|
26
|
+
var style = {"kne-responsive-boundary":"kne-form-creator_gh14z","kne-responsive-scroll":"kne-form-creator_Kfn6L","option-group-stack":"kne-form-creator_TgBT-","form-info-show-index":"kne-form-creator_rqCos","field-label-index":"kne-form-creator_MLY0O","field-label-main":"kne-form-creator_UOUb4","form-creator":"kne-form-creator_Xrjrk","editor-pane":"kne-form-creator_Skfuv","preview-pane":"kne-form-creator_v4Lsp","editor-header":"kne-form-creator_WaSS-","block-list-panel":"kne-form-creator_lx8An","form-actions-setting-btn":"kne-form-creator_NekU2","panel-toolbar":"kne-form-creator_t0WxZ","panel-toolbar-extra":"kne-form-creator_O22ZM","schema-content":"kne-form-creator_9bWOD","schema-content-fields":"kne-form-creator_EmRDV","schema-content-field":"kne-form-creator_0Lanz","schema-content-field-block":"kne-form-creator_TQd-w","schema-content-field-label":"kne-form-creator_czEK3","schema-content-field-value":"kne-form-creator_YFKTK","schema-content-file-list":"kne-form-creator_UGdXA","schema-content-file":"kne-form-creator_75EtE","schema-content-file-image":"kne-form-creator_P-be6","schema-content-file-name":"kne-form-creator_NXpTS","add-block-btn":"kne-form-creator_16Zre","add-inline-btn":"kne-form-creator_iCYdB","ant-btn-disabled":"kne-form-creator_LdGtv","block-list":"kne-form-creator_wK5eK","block-section":"kne-form-creator_15IiK","block-kind-formInfo":"kne-form-creator_D0hoK","block-kind-list":"kne-form-creator_JdPhy","block-kind-tableList":"kne-form-creator_gzd64","block-kind-editableList":"kne-form-creator_JzwrQ","block-kind-multiField":"kne-form-creator_t0iOJ","block-kind-steps":"kne-form-creator_QNF9W","step-section":"kne-form-creator_22ajp","block-section-header":"kne-form-creator_wS4rL","block-header-left":"kne-form-creator_t4awC","block-title":"kne-form-creator_wSVJf","block-summary":"kne-form-creator_GzeW8","block-header-actions":"kne-form-creator_Ue-nT","block-body":"kne-form-creator_je1H0","item-blocks-section":"kne-form-creator_wq4bT","nested-block-list":"kne-form-creator_4NWH4","block-section-nested":"kne-form-creator_mUKom","add-field-dropdown":"kne-form-creator_9JS0d","add-field-dropdown-item":"kne-form-creator_Ql1z3","add-field-dropdown-item-icon":"kne-form-creator_ZHB5O","add-field-dropdown-item-desc":"kne-form-creator_dcsOS","add-field-dropdown-divider":"kne-form-creator_CUK0H","add-field-dropdown-label":"kne-form-creator_bPJ-2","section-toolbar":"kne-form-creator_LUO8S","section-toolbar-label":"kne-form-creator_7KQ79","field-list":"kne-form-creator_-B7WZ","step-list":"kne-form-creator_kc1pH","step-section-header":"kne-form-creator_wkhEX","step-section-title":"kne-form-creator_NBinE","step-section-actions":"kne-form-creator_es-FC","step-index":"kne-form-creator_CCKZZ","field-row":"kne-form-creator_XMkdt","field-row-index":"kne-form-creator_a-cDo","field-row-main":"kne-form-creator_ftlwp","inline-empty":"kne-form-creator_yP-RF","action-group":"kne-form-creator_773yo","hover-reveal":"kne-form-creator_S234h","hover-reveal-active":"kne-form-creator_AE-6r","action-btn":"kne-form-creator_mLgqh","add-block-dropdown":"kne-form-creator_vmS-e","add-block-option":"kne-form-creator_gjg2Y","add-block-option-icon":"kne-form-creator_qh1hh","add-block-option-text":"kne-form-creator_G8iJO","add-block-option-title":"kne-form-creator_ETSvm","add-block-option-desc":"kne-form-creator_O0C3l","field-empty":"kne-form-creator_Nmpfl","field-label-tips-icon":"kne-form-creator_0VVaO","preview-header":"kne-form-creator_c4BT0","preview-title":"kne-form-creator_fPkK4","preview-body":"kne-form-creator_6JntQ","schema-form":"kne-form-creator_MxCWP","schema-body":"kne-form-creator_q9ydz","schema-actions":"kne-form-creator_Y4eEH","schema-actions-inner":"kne-form-creator_FT9Zf","choice-block":"kne-form-creator_RllJe","choice-selector":"kne-form-creator_5A1eM","choice-panels":"kne-form-creator_IO0MY","choice-panels-empty":"kne-form-creator_T0nND","choice-option-panel":"kne-form-creator_FQixN","choice-option-panel-title":"kne-form-creator_ofRo2","choice-option-summary":"kne-form-creator_pksH8","field-editor-form":"kne-form-creator_PGPHL","form-actions-editor":"kne-form-creator_fchMy","form-actions-switch-field":"kne-form-creator_6JE9x","form-actions-layout-panel":"kne-form-creator_rtm9D","form-actions-align-group":"kne-form-creator_51ZsV","form-actions-layout-title":"kne-form-creator_hFeiC","form-actions-gap-slider":"kne-form-creator_Gq0bk","editor-section":"kne-form-creator_jJy85","section-divider":"kne-form-creator_zA7L-","rule-editor":"kne-form-creator_bAlGU","options-editor":"kne-form-creator_AK4yO","super-select-props":"kne-form-creator_Iawhh","field-props-editor":"kne-form-creator_Gabf2","columns-editor":"kne-form-creator_DQW1N","prop-row":"kne-form-creator_7K54P","prop-label":"kne-form-creator_HAAyH","options-item":"kne-form-creator_dnOd2","table-row-card":"kne-form-creator_cwCYp","tree-options-editor":"kne-form-creator_s3nHO","tree-options-list":"kne-form-creator_Djs-E","tree-option-node":"kne-form-creator_XAcut","tree-option-row":"kne-form-creator_4K4Rj","tree-option-fields":"kne-form-creator_-4cjc","tree-option-actions":"kne-form-creator_IjCNI","tree-option-children":"kne-form-creator_pVPGJ","tree-add-sibling":"kne-form-creator_bl46P","rule-checkbox-group":"kne-form-creator_tDgVP","rule-len-row":"kne-form-creator_ATsae","rule-len-input":"kne-form-creator_jY4Ld","rule-len-sep":"kne-form-creator_jBDC8","options-list":"kne-form-creator_GUBNS","options-row":"kne-form-creator_uohD0","options-tip":"kne-form-creator_vrTmK","icon-square-btn":"kne-form-creator_DZjCf","icon-square-btn-sm":"kne-form-creator_GAh-t","is-mobile":"kne-form-creator_LtgJz"};
|
|
27
27
|
|
|
28
28
|
const locale$1 = {
|
|
29
29
|
addField: '添加填写项',
|
|
@@ -50,10 +50,19 @@ const locale$1 = {
|
|
|
50
50
|
blockKind_formInfo: '基础表单',
|
|
51
51
|
blockKind_list: '可增减列表',
|
|
52
52
|
blockKind_tableList: '表格列表',
|
|
53
|
+
blockKind_editableList: '行内编辑列表',
|
|
53
54
|
blockKind_multiField: '同类多值',
|
|
54
55
|
blockKind_object: '分组信息',
|
|
55
56
|
blockKind_choice: '选项切换',
|
|
56
57
|
blockKind_steps: '分步表单',
|
|
58
|
+
blockKindDesc_formInfo: '最常用的表单模块,可设置标题、列数和间距',
|
|
59
|
+
blockKindDesc_list: '用户可以动态添加或删除多条记录,例如工作经历',
|
|
60
|
+
blockKindDesc_tableList: '以表格形式展示的可增减列表',
|
|
61
|
+
blockKindDesc_editableList: '每条记录只读展示,点击编辑后单独填写并保存;数据量大时不卡顿',
|
|
62
|
+
blockKindDesc_multiField: '同一种填写项可以输入多个值,例如多个手机号',
|
|
63
|
+
blockKindDesc_object: '把相关的填写项放在一起,例如「在校时间」下的开始与结束',
|
|
64
|
+
blockKindDesc_choice: '先选一类情况,再填写对应内容;可设为单选或多选',
|
|
65
|
+
blockKindDesc_steps: '将表单拆分成多个步骤,引导用户逐步填写',
|
|
57
66
|
choiceMode: '可选几个',
|
|
58
67
|
choiceModeSingle: '只能选一个',
|
|
59
68
|
choiceModeMultiple: '可以选多个',
|
|
@@ -95,6 +104,10 @@ const locale$1 = {
|
|
|
95
104
|
blockAddTextPlaceholder: '例如:添加一条工作经历',
|
|
96
105
|
blockMaxLength: '最多条数',
|
|
97
106
|
blockMinLength: '最少条数',
|
|
107
|
+
blockAddPosition: '添加按钮位置',
|
|
108
|
+
blockAddPosition_bottom: '列表底部(追加到末尾)',
|
|
109
|
+
blockAddPosition_top: '标题右侧(插入到第一项)',
|
|
110
|
+
blockAddPosition_both: '两处都显示',
|
|
98
111
|
blockAutoStep: '填写完成后自动进入下一步',
|
|
99
112
|
multiFieldType: '填写项类型',
|
|
100
113
|
multiFieldSummary: '填写类型:{type}',
|
|
@@ -132,6 +145,7 @@ const locale$1 = {
|
|
|
132
145
|
FieldTypeSwitch: '开关',
|
|
133
146
|
FieldTypeCheckbox: '复选框',
|
|
134
147
|
FieldTypeDatePicker: '日期',
|
|
148
|
+
extendedFieldPlaceholder: '请选择{label}',
|
|
135
149
|
fieldName: '保存用的名称',
|
|
136
150
|
fieldNamePlaceholder: '已自动生成,可修改',
|
|
137
151
|
fieldLabel: '显示名称',
|
|
@@ -226,12 +240,16 @@ const locale$1 = {
|
|
|
226
240
|
propDatePickerQuarter: '季度',
|
|
227
241
|
propDatePickerYear: '年份',
|
|
228
242
|
propDateFormat: '显示格式',
|
|
243
|
+
propDateFormatLocalized: 'YYYY年MM月DD日',
|
|
229
244
|
propShowTime: '同时选择时间',
|
|
230
245
|
propSwitchOnText: '打开时显示的文字',
|
|
231
246
|
propSwitchOffText: '关闭时显示的文字',
|
|
232
247
|
propSwitchOnTextHint: '例如:开',
|
|
233
248
|
propSwitchOffTextHint: '例如:关',
|
|
234
249
|
propOptionsInline: '选项横向排列',
|
|
250
|
+
rulePresetREQ: '必填',
|
|
251
|
+
rulePresetTEL: '手机号格式',
|
|
252
|
+
rulePresetEMAIL: '邮箱格式',
|
|
235
253
|
ruleLen: '长度限制',
|
|
236
254
|
ruleLenRange: '长度范围',
|
|
237
255
|
ruleLenMin: '最少字数',
|
|
@@ -249,7 +267,7 @@ const locale$1 = {
|
|
|
249
267
|
schemaContentUntilToday: '至今',
|
|
250
268
|
schemaContentPasswordMasked: '••••••'
|
|
251
269
|
};
|
|
252
|
-
var
|
|
270
|
+
var defaultLocale = locale$1;
|
|
253
271
|
|
|
254
272
|
const locale = {
|
|
255
273
|
addField: 'Add Field',
|
|
@@ -276,10 +294,19 @@ const locale = {
|
|
|
276
294
|
blockKind_formInfo: 'Basic Form',
|
|
277
295
|
blockKind_list: 'Repeatable List',
|
|
278
296
|
blockKind_tableList: 'Table List',
|
|
297
|
+
blockKind_editableList: 'Inline Edit List',
|
|
279
298
|
blockKind_multiField: 'Multi-Value',
|
|
280
299
|
blockKind_object: 'Grouped Fields',
|
|
281
300
|
blockKind_choice: 'Options',
|
|
282
301
|
blockKind_steps: 'Step-by-Step',
|
|
302
|
+
blockKindDesc_formInfo: 'The most common section; set its title, columns and spacing',
|
|
303
|
+
blockKindDesc_list: 'Users can add or remove multiple records, e.g. work experience',
|
|
304
|
+
blockKindDesc_tableList: 'A repeatable list displayed as a table',
|
|
305
|
+
blockKindDesc_editableList: 'Records are shown read-only; click edit to fill in and save each one. Stays fast with lots of data',
|
|
306
|
+
blockKindDesc_multiField: 'Enter multiple values for the same field, e.g. several phone numbers',
|
|
307
|
+
blockKindDesc_object: 'Group related fields together, e.g. start and end under "School period"',
|
|
308
|
+
blockKindDesc_choice: 'Pick a case first, then fill in the matching content; single or multiple selection',
|
|
309
|
+
blockKindDesc_steps: 'Split the form into steps to guide users through it',
|
|
283
310
|
choiceMode: 'How many can be selected',
|
|
284
311
|
choiceModeSingle: 'One only',
|
|
285
312
|
choiceModeMultiple: 'More than one',
|
|
@@ -321,6 +348,10 @@ const locale = {
|
|
|
321
348
|
blockAddTextPlaceholder: 'e.g. Add Work Experience',
|
|
322
349
|
blockMaxLength: 'Max Entries',
|
|
323
350
|
blockMinLength: 'Min Entries',
|
|
351
|
+
blockAddPosition: 'Add Button Position',
|
|
352
|
+
blockAddPosition_bottom: 'Bottom (append to end)',
|
|
353
|
+
blockAddPosition_top: 'Title right (insert as first)',
|
|
354
|
+
blockAddPosition_both: 'Both',
|
|
324
355
|
blockAutoStep: 'Auto proceed to next step after completion',
|
|
325
356
|
multiFieldType: 'Field Type',
|
|
326
357
|
multiFieldSummary: 'Field type: {type}',
|
|
@@ -358,6 +389,7 @@ const locale = {
|
|
|
358
389
|
FieldTypeSwitch: 'Switch',
|
|
359
390
|
FieldTypeCheckbox: 'Checkbox',
|
|
360
391
|
FieldTypeDatePicker: 'Date',
|
|
392
|
+
extendedFieldPlaceholder: 'Please select {label}',
|
|
361
393
|
fieldName: 'Save name',
|
|
362
394
|
fieldNamePlaceholder: 'Auto-generated, editable',
|
|
363
395
|
fieldLabel: 'Display Name',
|
|
@@ -452,12 +484,16 @@ const locale = {
|
|
|
452
484
|
propDatePickerQuarter: 'Quarter',
|
|
453
485
|
propDatePickerYear: 'Year',
|
|
454
486
|
propDateFormat: 'Display format',
|
|
487
|
+
propDateFormatLocalized: 'MMM D, YYYY',
|
|
455
488
|
propShowTime: 'Include time',
|
|
456
489
|
propSwitchOnText: 'Text when on',
|
|
457
490
|
propSwitchOffText: 'Text when off',
|
|
458
491
|
propSwitchOnTextHint: 'e.g. On',
|
|
459
492
|
propSwitchOffTextHint: 'e.g. Off',
|
|
460
493
|
propOptionsInline: 'Arrange options horizontally',
|
|
494
|
+
rulePresetREQ: 'Required',
|
|
495
|
+
rulePresetTEL: 'Phone number format',
|
|
496
|
+
rulePresetEMAIL: 'Email format',
|
|
461
497
|
ruleLen: 'Length Limit',
|
|
462
498
|
ruleLenRange: 'Length Range',
|
|
463
499
|
ruleLenMin: 'Min',
|
|
@@ -480,7 +516,7 @@ var enUS = locale;
|
|
|
480
516
|
const withLocale = reactIntl.createWithIntlProvider({
|
|
481
517
|
defaultLocale: 'zh-CN',
|
|
482
518
|
messages: {
|
|
483
|
-
'zh-CN':
|
|
519
|
+
'zh-CN': defaultLocale,
|
|
484
520
|
'en-US': enUS
|
|
485
521
|
},
|
|
486
522
|
namespace: 'form-creator'
|
|
@@ -490,19 +526,13 @@ var withLocale$1 = withLocale;
|
|
|
490
526
|
const createFieldId = () => `field_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
491
527
|
|
|
492
528
|
/** 生成可编辑的默认数据标识,如 field_xxxx / col_xxxx */
|
|
493
|
-
const createDataKey =
|
|
494
|
-
|
|
495
|
-
prefix = 'field';
|
|
496
|
-
}
|
|
497
|
-
return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`;
|
|
498
|
-
};
|
|
499
|
-
const isAutoDataKey = function (value, prefix) {
|
|
500
|
-
if (prefix === void 0) {
|
|
501
|
-
prefix = 'field';
|
|
502
|
-
}
|
|
503
|
-
return new RegExp(`^${prefix}_[a-z0-9]+_[a-z0-9]+$`, 'i').test(String(value || '').trim());
|
|
504
|
-
};
|
|
529
|
+
const createDataKey = (prefix = 'field') => `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`;
|
|
530
|
+
const isAutoDataKey = (value, prefix = 'field') => new RegExp(`^${prefix}_[a-z0-9]+_[a-z0-9]+$`, 'i').test(String(value || '').trim());
|
|
505
531
|
const MAX_BLOCK_DEPTH = 14;
|
|
532
|
+
|
|
533
|
+
/** 列表项内可挂子模块(itemBlocks)的模块类型 */
|
|
534
|
+
const ITEM_BLOCK_KINDS = ['list', 'editableList'];
|
|
535
|
+
const supportsItemBlocks = kind => ITEM_BLOCK_KINDS.includes(kind);
|
|
506
536
|
const createEmptyColumn = () => ({
|
|
507
537
|
title: '',
|
|
508
538
|
name: createDataKey('col'),
|
|
@@ -529,10 +559,7 @@ const defaultFormActions = () => ({
|
|
|
529
559
|
gap: 16
|
|
530
560
|
});
|
|
531
561
|
const FORM_ACTIONS_ALIGN = ['center', 'start', 'end'];
|
|
532
|
-
const normalizeFormActions =
|
|
533
|
-
if (actions === void 0) {
|
|
534
|
-
actions = {};
|
|
535
|
-
}
|
|
562
|
+
const normalizeFormActions = (actions = {}) => {
|
|
536
563
|
const base = defaultFormActions();
|
|
537
564
|
if (!actions || typeof actions !== 'object') {
|
|
538
565
|
return base;
|
|
@@ -566,41 +593,28 @@ const normalizeFormActions = function (actions) {
|
|
|
566
593
|
} : {})
|
|
567
594
|
};
|
|
568
595
|
};
|
|
569
|
-
const createField$1 =
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
return {
|
|
592
|
-
id: createFieldId(),
|
|
593
|
-
title: '',
|
|
594
|
-
list: [],
|
|
595
|
-
blocks: [],
|
|
596
|
-
...overrides
|
|
597
|
-
};
|
|
598
|
-
};
|
|
599
|
-
const createBlock = function (kind, overrides) {
|
|
600
|
-
if (overrides === void 0) {
|
|
601
|
-
overrides = {};
|
|
602
|
-
}
|
|
603
|
-
const needsName = ['list', 'tableList', 'multiField', 'object'].includes(kind);
|
|
596
|
+
const createField$1 = (overrides = {}) => ({
|
|
597
|
+
id: createFieldId(),
|
|
598
|
+
type: 'Input',
|
|
599
|
+
name: createDataKey('field'),
|
|
600
|
+
label: '',
|
|
601
|
+
tips: '',
|
|
602
|
+
description: '',
|
|
603
|
+
rule: '',
|
|
604
|
+
block: false,
|
|
605
|
+
hidden: false,
|
|
606
|
+
props: {},
|
|
607
|
+
...overrides
|
|
608
|
+
});
|
|
609
|
+
const createChoiceOption = (overrides = {}) => ({
|
|
610
|
+
id: createFieldId(),
|
|
611
|
+
title: '',
|
|
612
|
+
list: [],
|
|
613
|
+
blocks: [],
|
|
614
|
+
...overrides
|
|
615
|
+
});
|
|
616
|
+
const createBlock = (kind, overrides = {}) => {
|
|
617
|
+
const needsName = ['list', 'tableList', 'editableList', 'multiField', 'object'].includes(kind);
|
|
604
618
|
const base = {
|
|
605
619
|
id: createFieldId(),
|
|
606
620
|
kind,
|
|
@@ -658,17 +672,13 @@ const createBlock = function (kind, overrides) {
|
|
|
658
672
|
blocks: undefined,
|
|
659
673
|
items: undefined,
|
|
660
674
|
name: '',
|
|
661
|
-
options: [createChoiceOption(
|
|
662
|
-
title: '选项1'
|
|
663
|
-
})],
|
|
675
|
+
options: [createChoiceOption()],
|
|
664
676
|
...overrides,
|
|
665
677
|
kind: 'choice'
|
|
666
678
|
};
|
|
667
679
|
next.mode = next.mode === 'multiple' ? 'multiple' : 'single';
|
|
668
680
|
if (!Array.isArray(next.options)) {
|
|
669
|
-
next.options = [createChoiceOption(
|
|
670
|
-
title: '选项1'
|
|
671
|
-
})];
|
|
681
|
+
next.options = [createChoiceOption()];
|
|
672
682
|
}
|
|
673
683
|
return next;
|
|
674
684
|
}
|
|
@@ -681,7 +691,7 @@ const createBlock = function (kind, overrides) {
|
|
|
681
691
|
...overrides
|
|
682
692
|
};
|
|
683
693
|
}
|
|
684
|
-
if (kind
|
|
694
|
+
if (supportsItemBlocks(kind)) {
|
|
685
695
|
return {
|
|
686
696
|
...base,
|
|
687
697
|
blocks: undefined,
|
|
@@ -704,23 +714,15 @@ const createBlock = function (kind, overrides) {
|
|
|
704
714
|
...overrides
|
|
705
715
|
};
|
|
706
716
|
};
|
|
707
|
-
const createStep =
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
blocks: [],
|
|
717
|
-
...overrides
|
|
718
|
-
};
|
|
719
|
-
};
|
|
720
|
-
const normalizeSelectCount = function (value, minAllowed) {
|
|
721
|
-
if (minAllowed === void 0) {
|
|
722
|
-
minAllowed = 0;
|
|
723
|
-
}
|
|
717
|
+
const createStep = (overrides = {}) => ({
|
|
718
|
+
id: createFieldId(),
|
|
719
|
+
title: '',
|
|
720
|
+
column: 2,
|
|
721
|
+
list: [],
|
|
722
|
+
blocks: [],
|
|
723
|
+
...overrides
|
|
724
|
+
});
|
|
725
|
+
const normalizeSelectCount = (value, minAllowed = 0) => {
|
|
724
726
|
if (value == null || value === '') {
|
|
725
727
|
return undefined;
|
|
726
728
|
}
|
|
@@ -741,17 +743,12 @@ const normalizeField = field => ({
|
|
|
741
743
|
...(field.props || {})
|
|
742
744
|
}
|
|
743
745
|
});
|
|
744
|
-
const normalizeStep =
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
...step,
|
|
751
|
-
list: Array.isArray(step.list) ? step.list.map(normalizeField) : [],
|
|
752
|
-
blocks: Array.isArray(step.blocks) ? step.blocks.map(child => normalizeBlock(child, depth + 1)) : []
|
|
753
|
-
};
|
|
754
|
-
};
|
|
746
|
+
const normalizeStep = (step, depth = 0) => ({
|
|
747
|
+
...createStep(),
|
|
748
|
+
...step,
|
|
749
|
+
list: Array.isArray(step.list) ? step.list.map(normalizeField) : [],
|
|
750
|
+
blocks: Array.isArray(step.blocks) ? step.blocks.map(child => normalizeBlock(child, depth + 1)) : []
|
|
751
|
+
});
|
|
755
752
|
const normalizeChoiceOption = (option, depth) => {
|
|
756
753
|
let list = Array.isArray(option.list) ? option.list.map(normalizeField) : [];
|
|
757
754
|
let blocks = Array.isArray(option.blocks) ? option.blocks.map(block => normalizeBlock(block, depth + 1)) : [];
|
|
@@ -768,10 +765,7 @@ const normalizeChoiceOption = (option, depth) => {
|
|
|
768
765
|
blocks
|
|
769
766
|
};
|
|
770
767
|
};
|
|
771
|
-
const normalizeBlock =
|
|
772
|
-
if (depth === void 0) {
|
|
773
|
-
depth = 0;
|
|
774
|
-
}
|
|
768
|
+
const normalizeBlock = (block, depth = 0) => {
|
|
775
769
|
const kind = block.kind || 'formInfo';
|
|
776
770
|
if (depth > MAX_BLOCK_DEPTH) {
|
|
777
771
|
return {
|
|
@@ -837,7 +831,7 @@ const normalizeBlock = function (block, depth) {
|
|
|
837
831
|
normalized.list = Array.isArray(block.list) ? block.list.map(normalizeField) : [];
|
|
838
832
|
normalized.items = undefined;
|
|
839
833
|
normalized.options = undefined;
|
|
840
|
-
if (kind
|
|
834
|
+
if (supportsItemBlocks(kind)) {
|
|
841
835
|
normalized.itemBlocks = Array.isArray(block.itemBlocks) ? block.itemBlocks.map(child => normalizeBlock(child, depth + 1)) : [];
|
|
842
836
|
normalized.blocks = undefined;
|
|
843
837
|
} else if (kind === 'tableList') {
|
|
@@ -850,10 +844,7 @@ const normalizeBlock = function (block, depth) {
|
|
|
850
844
|
}
|
|
851
845
|
return normalized;
|
|
852
846
|
};
|
|
853
|
-
const normalizeSchema =
|
|
854
|
-
if (schema === void 0) {
|
|
855
|
-
schema = {};
|
|
856
|
-
}
|
|
847
|
+
const normalizeSchema = (schema = {}) => {
|
|
857
848
|
const base = defaultSchema();
|
|
858
849
|
if (Array.isArray(schema.blocks)) {
|
|
859
850
|
return {
|
|
@@ -905,13 +896,7 @@ const isFieldNameUnique = (fields, name, excludeId) => {
|
|
|
905
896
|
}
|
|
906
897
|
return !fields.some(item => item.name === name && item.id !== excludeId);
|
|
907
898
|
};
|
|
908
|
-
const collectFieldsFromBlocks =
|
|
909
|
-
if (blocks === void 0) {
|
|
910
|
-
blocks = [];
|
|
911
|
-
}
|
|
912
|
-
if (acc === void 0) {
|
|
913
|
-
acc = [];
|
|
914
|
-
}
|
|
899
|
+
const collectFieldsFromBlocks = (blocks = [], acc = []) => {
|
|
915
900
|
blocks.forEach(block => {
|
|
916
901
|
if (!block) {
|
|
917
902
|
return;
|
|
@@ -942,12 +927,11 @@ const collectFieldsFromBlocks = function (blocks, acc) {
|
|
|
942
927
|
});
|
|
943
928
|
return acc;
|
|
944
929
|
};
|
|
945
|
-
const collectSchemaFields =
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
} = _temp === void 0 ? {} : _temp;
|
|
930
|
+
const collectSchemaFields = (schema, {
|
|
931
|
+
blockId,
|
|
932
|
+
stepId,
|
|
933
|
+
optionId
|
|
934
|
+
} = {}) => {
|
|
951
935
|
const blocks = schema.blocks || [];
|
|
952
936
|
if (!blockId) {
|
|
953
937
|
return collectFieldsFromBlocks(blocks);
|
|
@@ -983,13 +967,9 @@ const collectSchemaFields = function (schema, _temp) {
|
|
|
983
967
|
};
|
|
984
968
|
|
|
985
969
|
/** 收集 blocks 树中所有字段 name(含 object 前缀后的完整名需在渲染层处理) */
|
|
986
|
-
const collectBlockFieldNames =
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
}
|
|
990
|
-
let {
|
|
991
|
-
objectNamePrefix = ''
|
|
992
|
-
} = _temp2 === void 0 ? {} : _temp2;
|
|
970
|
+
const collectBlockFieldNames = (blocks = [], {
|
|
971
|
+
objectNamePrefix = ''
|
|
972
|
+
} = {}) => {
|
|
993
973
|
const names = [];
|
|
994
974
|
const walk = (list, prefix) => {
|
|
995
975
|
(list || []).forEach(block => {
|
|
@@ -1035,7 +1015,7 @@ const collectBlockFieldNames = function (blocks, _temp2) {
|
|
|
1035
1015
|
}
|
|
1036
1016
|
});
|
|
1037
1017
|
}
|
|
1038
|
-
if (block.kind
|
|
1018
|
+
if (supportsItemBlocks(block.kind)) {
|
|
1039
1019
|
// 列表项内字段相对 GroupList,此处只收集定义名供 choice 清理参考
|
|
1040
1020
|
walk(block.itemBlocks || [], prefix);
|
|
1041
1021
|
}
|
|
@@ -1053,10 +1033,7 @@ const updateBlocks = (schema, updater) => ({
|
|
|
1053
1033
|
});
|
|
1054
1034
|
|
|
1055
1035
|
/** 在 blocks / itemBlocks / choice.options.blocks / steps.items.blocks 树中查找模块 */
|
|
1056
|
-
const findBlockInTree =
|
|
1057
|
-
if (blocks === void 0) {
|
|
1058
|
-
blocks = [];
|
|
1059
|
-
}
|
|
1036
|
+
const findBlockInTree = (blocks = [], blockId) => {
|
|
1060
1037
|
for (const block of blocks) {
|
|
1061
1038
|
if (!block) {
|
|
1062
1039
|
continue;
|
|
@@ -1262,58 +1239,67 @@ const hasRenderableContent = schema => {
|
|
|
1262
1239
|
|
|
1263
1240
|
const BLOCK_KINDS = {
|
|
1264
1241
|
formInfo: {
|
|
1265
|
-
|
|
1242
|
+
labelId: 'blockKind_formInfo',
|
|
1266
1243
|
color: 'blue',
|
|
1267
1244
|
hasFieldList: true,
|
|
1268
|
-
|
|
1245
|
+
descriptionId: 'blockKindDesc_formInfo'
|
|
1269
1246
|
},
|
|
1270
1247
|
list: {
|
|
1271
|
-
|
|
1248
|
+
labelId: 'blockKind_list',
|
|
1272
1249
|
color: 'cyan',
|
|
1273
1250
|
hasFieldList: true,
|
|
1274
1251
|
requiresName: true,
|
|
1275
|
-
|
|
1252
|
+
descriptionId: 'blockKindDesc_list'
|
|
1276
1253
|
},
|
|
1277
1254
|
tableList: {
|
|
1278
|
-
|
|
1255
|
+
labelId: 'blockKind_tableList',
|
|
1279
1256
|
color: 'geekblue',
|
|
1280
1257
|
hasFieldList: true,
|
|
1281
1258
|
requiresName: true,
|
|
1282
|
-
|
|
1259
|
+
descriptionId: 'blockKindDesc_tableList'
|
|
1260
|
+
},
|
|
1261
|
+
editableList: {
|
|
1262
|
+
labelId: 'blockKind_editableList',
|
|
1263
|
+
color: 'green',
|
|
1264
|
+
hasFieldList: true,
|
|
1265
|
+
requiresName: true,
|
|
1266
|
+
descriptionId: 'blockKindDesc_editableList'
|
|
1283
1267
|
},
|
|
1284
1268
|
multiField: {
|
|
1285
|
-
|
|
1269
|
+
labelId: 'blockKind_multiField',
|
|
1286
1270
|
color: 'purple',
|
|
1287
1271
|
requiresName: true,
|
|
1288
|
-
|
|
1272
|
+
descriptionId: 'blockKindDesc_multiField'
|
|
1289
1273
|
},
|
|
1290
1274
|
object: {
|
|
1291
|
-
|
|
1275
|
+
labelId: 'blockKind_object',
|
|
1292
1276
|
color: 'orange',
|
|
1293
1277
|
hasFieldList: true,
|
|
1294
1278
|
requiresName: true,
|
|
1295
|
-
|
|
1279
|
+
descriptionId: 'blockKindDesc_object'
|
|
1296
1280
|
},
|
|
1297
1281
|
choice: {
|
|
1298
|
-
|
|
1282
|
+
labelId: 'blockKind_choice',
|
|
1299
1283
|
color: 'magenta',
|
|
1300
1284
|
hasChoiceOptions: true,
|
|
1301
|
-
|
|
1285
|
+
descriptionId: 'blockKindDesc_choice'
|
|
1302
1286
|
},
|
|
1303
1287
|
steps: {
|
|
1304
|
-
|
|
1288
|
+
labelId: 'blockKind_steps',
|
|
1305
1289
|
color: 'gold',
|
|
1306
1290
|
hasSteps: true,
|
|
1307
|
-
|
|
1291
|
+
descriptionId: 'blockKindDesc_steps'
|
|
1308
1292
|
}
|
|
1309
1293
|
};
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
})
|
|
1294
|
+
|
|
1295
|
+
/** editableList 添加按钮位置,与 @kne/form-info EditableList addPosition 一致 */
|
|
1296
|
+
const ADD_POSITIONS = ['bottom', 'top', 'both'];
|
|
1297
|
+
const getBlockKindOptions = formatMessage => Object.entries(BLOCK_KINDS).map(([value, config]) => ({
|
|
1298
|
+
label: typeof formatMessage === 'function' ? formatMessage({
|
|
1299
|
+
id: config.labelId
|
|
1300
|
+
}) : config.labelId,
|
|
1301
|
+
value
|
|
1302
|
+
}));
|
|
1317
1303
|
const getBlockDefinition = kind => BLOCK_KINDS[kind];
|
|
1318
1304
|
const blockToFormValues = block => ({
|
|
1319
1305
|
kind: block.kind,
|
|
@@ -1329,16 +1315,14 @@ const blockToFormValues = block => ({
|
|
|
1329
1315
|
addText: block.addText || '',
|
|
1330
1316
|
maxLength: block.maxLength ?? null,
|
|
1331
1317
|
minLength: block.minLength ?? null,
|
|
1318
|
+
addPosition: ADD_POSITIONS.includes(block.addPosition) ? block.addPosition : 'bottom',
|
|
1332
1319
|
fieldType: block.fieldType || 'Input',
|
|
1333
1320
|
autoStep: block.autoStep !== false,
|
|
1334
1321
|
mode: block.mode === 'multiple' ? 'multiple' : 'single',
|
|
1335
1322
|
selectorName: block.selectorName || '',
|
|
1336
1323
|
selectorInData: block.selectorInData !== false
|
|
1337
1324
|
});
|
|
1338
|
-
const formValuesToBlock =
|
|
1339
|
-
if (existingBlock === void 0) {
|
|
1340
|
-
existingBlock = {};
|
|
1341
|
-
}
|
|
1325
|
+
const formValuesToBlock = (values, existingBlock = {}) => {
|
|
1342
1326
|
const kind = values.kind || existingBlock.kind;
|
|
1343
1327
|
const mode = values.mode === 'multiple' ? 'multiple' : 'single';
|
|
1344
1328
|
const next = {
|
|
@@ -1356,6 +1340,7 @@ const formValuesToBlock = function (values, existingBlock) {
|
|
|
1356
1340
|
addText: values.addText || undefined,
|
|
1357
1341
|
maxLength: values.maxLength ?? undefined,
|
|
1358
1342
|
minLength: values.minLength ?? undefined,
|
|
1343
|
+
addPosition: kind === 'editableList' && ADD_POSITIONS.includes(values.addPosition) && values.addPosition !== 'bottom' ? values.addPosition : undefined,
|
|
1359
1344
|
fieldType: values.fieldType || 'Input',
|
|
1360
1345
|
autoStep: values.autoStep !== false,
|
|
1361
1346
|
mode,
|
|
@@ -1372,28 +1357,18 @@ const stepToFormValues = step => ({
|
|
|
1372
1357
|
title: step.title || '',
|
|
1373
1358
|
column: step.column ?? 2
|
|
1374
1359
|
});
|
|
1375
|
-
const formValuesToStep =
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
...existingStep,
|
|
1381
|
-
title: values.title,
|
|
1382
|
-
column: values.column ?? 2
|
|
1383
|
-
};
|
|
1384
|
-
};
|
|
1360
|
+
const formValuesToStep = (values, existingStep = {}) => ({
|
|
1361
|
+
...existingStep,
|
|
1362
|
+
title: values.title,
|
|
1363
|
+
column: values.column ?? 2
|
|
1364
|
+
});
|
|
1385
1365
|
const choiceOptionToFormValues = option => ({
|
|
1386
1366
|
title: option.title || ''
|
|
1387
1367
|
});
|
|
1388
|
-
const formValuesToChoiceOption =
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
return {
|
|
1393
|
-
...existingOption,
|
|
1394
|
-
title: values.title
|
|
1395
|
-
};
|
|
1396
|
-
};
|
|
1368
|
+
const formValuesToChoiceOption = (values, existingOption = {}) => ({
|
|
1369
|
+
...existingOption,
|
|
1370
|
+
title: values.title
|
|
1371
|
+
});
|
|
1397
1372
|
|
|
1398
1373
|
const mapOptionItem = item => {
|
|
1399
1374
|
if (!item || typeof item !== 'object') {
|
|
@@ -1499,13 +1474,15 @@ const {
|
|
|
1499
1474
|
useOnChange: useOnChange$1
|
|
1500
1475
|
} = reactFormAntd.hooks;
|
|
1501
1476
|
const hasNestedOptions = options => Array.isArray(options) && options.some(item => Array.isArray(item?.children) && item.children.length);
|
|
1502
|
-
const createField =
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1477
|
+
const createField = (Component, {
|
|
1478
|
+
preferOptions = false,
|
|
1479
|
+
flattenTree = false
|
|
1480
|
+
} = {}) => {
|
|
1481
|
+
const FieldInner = props => {
|
|
1482
|
+
const {
|
|
1483
|
+
formatMessage,
|
|
1484
|
+
locale
|
|
1485
|
+
} = reactIntl.useIntl();
|
|
1509
1486
|
const {
|
|
1510
1487
|
options,
|
|
1511
1488
|
api,
|
|
@@ -1525,11 +1502,16 @@ const createField = function (Component, _temp) {
|
|
|
1525
1502
|
}) : flattened;
|
|
1526
1503
|
const useOptionsDirectly = preferOptions || hasNestedOptions(resolvedOptions);
|
|
1527
1504
|
const mergedApi = api || (!useOptionsDirectly && Array.isArray(resolvedOptions) && resolvedOptions.length ? createApiFromOptions(resolvedOptions) : undefined);
|
|
1528
|
-
const resolvedPlaceholder = placeholder != null && String(placeholder).trim() ? placeholder :
|
|
1505
|
+
const resolvedPlaceholder = placeholder != null && String(placeholder).trim() ? placeholder : formatMessage({
|
|
1506
|
+
id: 'extendedFieldPlaceholder'
|
|
1507
|
+
}, {
|
|
1508
|
+
label: props.label || ''
|
|
1509
|
+
}).trim();
|
|
1529
1510
|
const render = useOnChange$1(Object.assign({}, {
|
|
1530
1511
|
isPopup: true,
|
|
1531
1512
|
placeholder: resolvedPlaceholder
|
|
1532
1513
|
}, rest, {
|
|
1514
|
+
locale,
|
|
1533
1515
|
valueKey,
|
|
1534
1516
|
labelKey
|
|
1535
1517
|
}, useOptionsDirectly && Array.isArray(resolvedOptions) ? {
|
|
@@ -1539,6 +1521,7 @@ const createField = function (Component, _temp) {
|
|
|
1539
1521
|
} : {}));
|
|
1540
1522
|
return render(Component);
|
|
1541
1523
|
};
|
|
1524
|
+
const Field = withLocale$1(FieldInner);
|
|
1542
1525
|
Field.field = Component;
|
|
1543
1526
|
return Field;
|
|
1544
1527
|
};
|
|
@@ -1559,13 +1542,13 @@ const SelectAddressField = createField(superSelectPlus.SelectAddress);
|
|
|
1559
1542
|
|
|
1560
1543
|
const RULE_PRESET_ITEMS = [{
|
|
1561
1544
|
value: 'REQ',
|
|
1562
|
-
|
|
1545
|
+
labelId: 'rulePresetREQ'
|
|
1563
1546
|
}, {
|
|
1564
1547
|
value: 'TEL',
|
|
1565
|
-
|
|
1548
|
+
labelId: 'rulePresetTEL'
|
|
1566
1549
|
}, {
|
|
1567
1550
|
value: 'EMAIL',
|
|
1568
|
-
|
|
1551
|
+
labelId: 'rulePresetEMAIL'
|
|
1569
1552
|
}];
|
|
1570
1553
|
const DEFAULT_RULE_CONFIG = () => ({
|
|
1571
1554
|
presets: [],
|
|
@@ -1611,12 +1594,11 @@ const parseRuleString = rule => {
|
|
|
1611
1594
|
});
|
|
1612
1595
|
return config;
|
|
1613
1596
|
};
|
|
1614
|
-
const buildRuleString =
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
} = _temp === void 0 ? {} : _temp;
|
|
1597
|
+
const buildRuleString = ({
|
|
1598
|
+
presets = [],
|
|
1599
|
+
lenMin,
|
|
1600
|
+
lenMax
|
|
1601
|
+
} = {}) => {
|
|
1620
1602
|
const parts = [];
|
|
1621
1603
|
RULE_PRESET_ITEMS.forEach(item => {
|
|
1622
1604
|
if (presets.includes(item.value)) {
|
|
@@ -1962,16 +1944,7 @@ const registerField = (type, definition) => {
|
|
|
1962
1944
|
hasFieldProps: definition.hasFieldProps ?? !!(propsSchema && propsSchema.length)
|
|
1963
1945
|
});
|
|
1964
1946
|
};
|
|
1965
|
-
const pickFromPropsSchema =
|
|
1966
|
-
if (props === void 0) {
|
|
1967
|
-
props = {};
|
|
1968
|
-
}
|
|
1969
|
-
if (propsSchema === void 0) {
|
|
1970
|
-
propsSchema = [];
|
|
1971
|
-
}
|
|
1972
|
-
if (defaultProps === void 0) {
|
|
1973
|
-
defaultProps = {};
|
|
1974
|
-
}
|
|
1947
|
+
const pickFromPropsSchema = (props = {}, propsSchema = [], defaultProps = {}) => {
|
|
1975
1948
|
const next = {};
|
|
1976
1949
|
propsSchema.forEach(item => {
|
|
1977
1950
|
if (!item?.name) {
|
|
@@ -1995,13 +1968,7 @@ const pickFromPropsSchema = function (props, propsSchema, defaultProps) {
|
|
|
1995
1968
|
});
|
|
1996
1969
|
return next;
|
|
1997
1970
|
};
|
|
1998
|
-
const applyFromPropsSchema =
|
|
1999
|
-
if (values === void 0) {
|
|
2000
|
-
values = {};
|
|
2001
|
-
}
|
|
2002
|
-
if (propsSchema === void 0) {
|
|
2003
|
-
propsSchema = [];
|
|
2004
|
-
}
|
|
1971
|
+
const applyFromPropsSchema = (props, values = {}, propsSchema = []) => {
|
|
2005
1972
|
propsSchema.forEach(item => {
|
|
2006
1973
|
if (!item?.name) {
|
|
2007
1974
|
return;
|
|
@@ -2125,11 +2092,10 @@ const getFieldTypes = formatMessage => {
|
|
|
2125
2092
|
}
|
|
2126
2093
|
customGroups.get(groupKey).options.push(option);
|
|
2127
2094
|
});
|
|
2128
|
-
customGroups.forEach(
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
} = _ref;
|
|
2095
|
+
customGroups.forEach(({
|
|
2096
|
+
label,
|
|
2097
|
+
options
|
|
2098
|
+
}) => {
|
|
2133
2099
|
grouped.push({
|
|
2134
2100
|
label,
|
|
2135
2101
|
options
|
|
@@ -2137,17 +2103,16 @@ const getFieldTypes = formatMessage => {
|
|
|
2137
2103
|
});
|
|
2138
2104
|
if (fallback.length) {
|
|
2139
2105
|
grouped.push({
|
|
2140
|
-
label: resolveRegistryLabel(formatMessage, 'FieldGroupExtended'
|
|
2106
|
+
label: resolveRegistryLabel(formatMessage, 'FieldGroupExtended'),
|
|
2141
2107
|
options: fallback
|
|
2142
2108
|
});
|
|
2143
2109
|
}
|
|
2144
2110
|
return grouped;
|
|
2145
2111
|
};
|
|
2146
|
-
const normalizeOptions =
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
} = _temp === void 0 ? {} : _temp;
|
|
2112
|
+
const normalizeOptions = (options, {
|
|
2113
|
+
allowChildren = false,
|
|
2114
|
+
columns = []
|
|
2115
|
+
} = {}) => {
|
|
2151
2116
|
if (!Array.isArray(options)) {
|
|
2152
2117
|
return [];
|
|
2153
2118
|
}
|
|
@@ -2377,10 +2342,14 @@ const applyFieldProps = (props, values, definition) => {
|
|
|
2377
2342
|
delete props.showTime;
|
|
2378
2343
|
}
|
|
2379
2344
|
if (values.range) {
|
|
2380
|
-
// RangePicker 用数组 placeholder
|
|
2345
|
+
// RangePicker 用数组 placeholder;单框用字符串;未填时交给 RangePicker 按 locale 显示默认提示
|
|
2381
2346
|
const raw = values.placeholder;
|
|
2382
|
-
const text =
|
|
2383
|
-
|
|
2347
|
+
const text = Array.isArray(raw) ? raw[0] : raw;
|
|
2348
|
+
if (text != null && String(text).trim()) {
|
|
2349
|
+
props.placeholder = [text, text];
|
|
2350
|
+
} else {
|
|
2351
|
+
delete props.placeholder;
|
|
2352
|
+
}
|
|
2384
2353
|
} else {
|
|
2385
2354
|
setOptionalString(props, 'placeholder', values.placeholder);
|
|
2386
2355
|
}
|
|
@@ -2432,10 +2401,7 @@ const fieldToFormValues = field => {
|
|
|
2432
2401
|
fieldProps: definition?.hasFieldProps ? pickFieldProps(field, definition) : undefined
|
|
2433
2402
|
};
|
|
2434
2403
|
};
|
|
2435
|
-
const formValuesToField =
|
|
2436
|
-
if (existingField === void 0) {
|
|
2437
|
-
existingField = {};
|
|
2438
|
-
}
|
|
2404
|
+
const formValuesToField = (values, existingField = {}) => {
|
|
2439
2405
|
const definition = getFieldDefinition(values.type) || getFieldDefinition('Input');
|
|
2440
2406
|
// 不沿用旧类型残留 props,避免切换填写项类型后参数串味
|
|
2441
2407
|
const props = {
|
|
@@ -2592,30 +2558,24 @@ var FieldRow$1 = FieldRow;
|
|
|
2592
2558
|
const {
|
|
2593
2559
|
Text: Text$3
|
|
2594
2560
|
} = antd.Typography;
|
|
2595
|
-
const ActionGroup =
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
title: title,
|
|
2614
|
-
danger: danger,
|
|
2615
|
-
className: style['action-btn'],
|
|
2616
|
-
...props
|
|
2617
|
-
});
|
|
2618
|
-
};
|
|
2561
|
+
const ActionGroup = ({
|
|
2562
|
+
children
|
|
2563
|
+
}) => /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2564
|
+
className: style['action-group'],
|
|
2565
|
+
children: children
|
|
2566
|
+
});
|
|
2567
|
+
const IconBtn = ({
|
|
2568
|
+
title,
|
|
2569
|
+
danger,
|
|
2570
|
+
...props
|
|
2571
|
+
}) => /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
2572
|
+
type: "text",
|
|
2573
|
+
size: "small",
|
|
2574
|
+
title: title,
|
|
2575
|
+
danger: danger,
|
|
2576
|
+
className: style['action-btn'],
|
|
2577
|
+
...props
|
|
2578
|
+
});
|
|
2619
2579
|
const ROOT_ADD_OPTIONS = [{
|
|
2620
2580
|
key: 'formInfo',
|
|
2621
2581
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.FormOutlined, {})
|
|
@@ -2625,6 +2585,9 @@ const ROOT_ADD_OPTIONS = [{
|
|
|
2625
2585
|
}, {
|
|
2626
2586
|
key: 'tableList',
|
|
2627
2587
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.TableOutlined, {})
|
|
2588
|
+
}, {
|
|
2589
|
+
key: 'editableList',
|
|
2590
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(icons.ProfileOutlined, {})
|
|
2628
2591
|
}, {
|
|
2629
2592
|
key: 'object',
|
|
2630
2593
|
icon: /*#__PURE__*/jsxRuntime.jsx(icons.ClusterOutlined, {})
|
|
@@ -2641,79 +2604,76 @@ const ROOT_ADD_OPTIONS = [{
|
|
|
2641
2604
|
|
|
2642
2605
|
/** 可挂子模块的容器;表格列表 / 同类多值本身不支持子模块 */
|
|
2643
2606
|
const NESTED_ADD_OPTIONS = ROOT_ADD_OPTIONS.filter(opt => opt.key !== 'steps');
|
|
2644
|
-
const BlockListPanel =
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
} = _ref3;
|
|
2607
|
+
const BlockListPanel = ({
|
|
2608
|
+
blocks,
|
|
2609
|
+
onAddBlock,
|
|
2610
|
+
onEditBlock,
|
|
2611
|
+
onDeleteBlock,
|
|
2612
|
+
onMoveBlock,
|
|
2613
|
+
onAddField,
|
|
2614
|
+
onEditField,
|
|
2615
|
+
onDeleteField,
|
|
2616
|
+
onMoveField,
|
|
2617
|
+
onAddStep,
|
|
2618
|
+
onEditStep,
|
|
2619
|
+
onDeleteStep,
|
|
2620
|
+
onMoveStep,
|
|
2621
|
+
onAddChoiceOption,
|
|
2622
|
+
onEditChoiceOption,
|
|
2623
|
+
onDeleteChoiceOption,
|
|
2624
|
+
onMoveChoiceOption,
|
|
2625
|
+
onOpenFormActions,
|
|
2626
|
+
extraToolbar
|
|
2627
|
+
}) => {
|
|
2666
2628
|
const {
|
|
2667
2629
|
formatMessage
|
|
2668
2630
|
} = reactIntl.useIntl();
|
|
2669
2631
|
const [addMenuOpen, setAddMenuOpen] = react.useState(false);
|
|
2670
2632
|
const [addFieldMenuId, setAddFieldMenuId] = react.useState(null);
|
|
2671
2633
|
const keepAddFieldMenuOpenRef = react.useRef(false);
|
|
2672
|
-
const renderAddBlockMenu =
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2634
|
+
const renderAddBlockMenu = (options, {
|
|
2635
|
+
onSelect,
|
|
2636
|
+
className
|
|
2637
|
+
} = {}) => /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2638
|
+
className: className || style['add-block-dropdown'],
|
|
2639
|
+
children: options.map(opt => {
|
|
2640
|
+
const definition = getBlockDefinition(opt.key);
|
|
2641
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2642
|
+
role: "button",
|
|
2643
|
+
tabIndex: 0,
|
|
2644
|
+
className: style['add-block-option'],
|
|
2645
|
+
onClick: () => onSelect(opt.key),
|
|
2646
|
+
onKeyDown: e => {
|
|
2647
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
2648
|
+
onSelect(opt.key);
|
|
2649
|
+
}
|
|
2650
|
+
},
|
|
2651
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2652
|
+
className: style['add-block-option-icon'],
|
|
2653
|
+
children: opt.icon
|
|
2654
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2655
|
+
className: style['add-block-option-text'],
|
|
2691
2656
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2692
|
-
className: style['add-block-option-
|
|
2693
|
-
children:
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2702
|
-
className: style['add-block-option-desc'],
|
|
2703
|
-
children: definition?.description
|
|
2704
|
-
})]
|
|
2657
|
+
className: style['add-block-option-title'],
|
|
2658
|
+
children: formatMessage({
|
|
2659
|
+
id: `blockKind_${opt.key}`
|
|
2660
|
+
})
|
|
2661
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2662
|
+
className: style['add-block-option-desc'],
|
|
2663
|
+
children: definition ? formatMessage({
|
|
2664
|
+
id: definition.descriptionId
|
|
2665
|
+
}) : null
|
|
2705
2666
|
})]
|
|
2706
|
-
}
|
|
2707
|
-
})
|
|
2708
|
-
})
|
|
2709
|
-
};
|
|
2710
|
-
const renderAddFieldButton =
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
} = _ref4;
|
|
2667
|
+
})]
|
|
2668
|
+
}, opt.key);
|
|
2669
|
+
})
|
|
2670
|
+
});
|
|
2671
|
+
const renderAddFieldButton = ({
|
|
2672
|
+
menuKey,
|
|
2673
|
+
depth,
|
|
2674
|
+
onAddFieldClick,
|
|
2675
|
+
onAddChildBlock
|
|
2676
|
+
}) => {
|
|
2717
2677
|
const canAddChild = typeof onAddChildBlock === 'function' && depth < MAX_BLOCK_DEPTH;
|
|
2718
2678
|
const menuOpen = addFieldMenuId === menuKey;
|
|
2719
2679
|
const btnClass = `${style['add-inline-btn']} ${style['hover-reveal']} ${menuOpen ? style['hover-reveal-active'] : ''}`.trim();
|
|
@@ -2801,9 +2761,11 @@ const BlockListPanel = _ref3 => {
|
|
|
2801
2761
|
children: formatMessage({
|
|
2802
2762
|
id: `blockKind_${opt.key}`
|
|
2803
2763
|
})
|
|
2804
|
-
}), definition
|
|
2764
|
+
}), definition ? /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2805
2765
|
className: style['add-field-dropdown-item-desc'],
|
|
2806
|
-
children:
|
|
2766
|
+
children: formatMessage({
|
|
2767
|
+
id: definition.descriptionId
|
|
2768
|
+
})
|
|
2807
2769
|
}) : null]
|
|
2808
2770
|
}, opt.key);
|
|
2809
2771
|
})]
|
|
@@ -2825,11 +2787,10 @@ const BlockListPanel = _ref3 => {
|
|
|
2825
2787
|
})
|
|
2826
2788
|
});
|
|
2827
2789
|
};
|
|
2828
|
-
const renderFieldList =
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
} = _temp2 === void 0 ? {} : _temp2;
|
|
2790
|
+
const renderFieldList = (fields, blockId, {
|
|
2791
|
+
stepId,
|
|
2792
|
+
optionId
|
|
2793
|
+
} = {}) => {
|
|
2833
2794
|
if (!(fields || []).length) {
|
|
2834
2795
|
return /*#__PURE__*/jsxRuntime.jsx(Text$3, {
|
|
2835
2796
|
type: "secondary",
|
|
@@ -3109,23 +3070,20 @@ const BlockListPanel = _ref3 => {
|
|
|
3109
3070
|
})]
|
|
3110
3071
|
});
|
|
3111
3072
|
}
|
|
3112
|
-
const supportsItemBlocks = block.kind
|
|
3073
|
+
const supportsItemBlocks$1 = supportsItemBlocks(block.kind);
|
|
3113
3074
|
const supportsBlocks = block.kind === 'formInfo' || block.kind === 'object';
|
|
3114
3075
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3115
3076
|
className: style['block-body'],
|
|
3116
|
-
children: [renderFieldList(block.list, block.id), supportsItemBlocks ? renderItemBlocks(block, depth) : null, supportsBlocks ? renderNestedBlocks(block.blocks, depth) : null]
|
|
3077
|
+
children: [renderFieldList(block.list, block.id), supportsItemBlocks$1 ? renderItemBlocks(block, depth) : null, supportsBlocks ? renderNestedBlocks(block.blocks, depth) : null]
|
|
3117
3078
|
});
|
|
3118
3079
|
};
|
|
3119
|
-
const renderBlockSection =
|
|
3120
|
-
if (depth === void 0) {
|
|
3121
|
-
depth = 0;
|
|
3122
|
-
}
|
|
3080
|
+
const renderBlockSection = (block, blockIndex, total, depth = 0) => {
|
|
3123
3081
|
const definition = getBlockDefinition(block.kind);
|
|
3124
3082
|
const canAddField = block.kind !== 'steps' && block.kind !== 'multiField' && block.kind !== 'choice';
|
|
3125
|
-
const supportsItemBlocks = block.kind
|
|
3083
|
+
const supportsItemBlocks$1 = supportsItemBlocks(block.kind);
|
|
3126
3084
|
const supportsBlocks = block.kind === 'formInfo' || block.kind === 'object';
|
|
3127
|
-
const supportsChildModules = supportsItemBlocks || supportsBlocks;
|
|
3128
|
-
const nestCount = supportsItemBlocks ? block.itemBlocks?.length || 0 : block.blocks?.length || 0;
|
|
3085
|
+
const supportsChildModules = supportsItemBlocks$1 || supportsBlocks;
|
|
3086
|
+
const nestCount = supportsItemBlocks$1 ? block.itemBlocks?.length || 0 : block.blocks?.length || 0;
|
|
3129
3087
|
const summary = block.kind === 'steps' ? formatMessage({
|
|
3130
3088
|
id: 'stepCount'
|
|
3131
3089
|
}, {
|
|
@@ -3270,17 +3228,17 @@ const BlockListPanel = _ref3 => {
|
|
|
3270
3228
|
};
|
|
3271
3229
|
var BlockListPanel$1 = BlockListPanel;
|
|
3272
3230
|
|
|
3273
|
-
const BlockConfigFields =
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
} = _ref;
|
|
3231
|
+
const BlockConfigFields = ({
|
|
3232
|
+
kind
|
|
3233
|
+
}) => {
|
|
3277
3234
|
const {
|
|
3278
3235
|
formatMessage
|
|
3279
3236
|
} = reactIntl.useIntl();
|
|
3280
3237
|
const definition = getBlockDefinition(kind);
|
|
3281
3238
|
const fieldTypeOptions = react.useMemo(() => getFieldTypes(formatMessage), [formatMessage]);
|
|
3282
3239
|
const list = [];
|
|
3283
|
-
|
|
3240
|
+
const isListKind = kind === 'list' || kind === 'tableList' || kind === 'editableList';
|
|
3241
|
+
if (kind === 'formInfo' || kind === 'list' || kind === 'tableList' || kind === 'editableList' || kind === 'object') {
|
|
3284
3242
|
list.push(/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
|
|
3285
3243
|
name: "title",
|
|
3286
3244
|
label: formatMessage({
|
|
@@ -3335,7 +3293,7 @@ const BlockConfigFields = _ref => {
|
|
|
3335
3293
|
children: formatMessage({
|
|
3336
3294
|
id: 'blockImportant'
|
|
3337
3295
|
})
|
|
3338
|
-
}, "important") : null,
|
|
3296
|
+
}, "important") : null, isListKind ? /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
|
|
3339
3297
|
name: "addText",
|
|
3340
3298
|
label: formatMessage({
|
|
3341
3299
|
id: 'blockAddText'
|
|
@@ -3343,13 +3301,24 @@ const BlockConfigFields = _ref => {
|
|
|
3343
3301
|
placeholder: formatMessage({
|
|
3344
3302
|
id: 'blockAddTextPlaceholder'
|
|
3345
3303
|
})
|
|
3346
|
-
}, "addText") : null, kind === '
|
|
3304
|
+
}, "addText") : null, kind === 'editableList' ? /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Select, {
|
|
3305
|
+
name: "addPosition",
|
|
3306
|
+
label: formatMessage({
|
|
3307
|
+
id: 'blockAddPosition'
|
|
3308
|
+
}),
|
|
3309
|
+
options: ADD_POSITIONS.map(value => ({
|
|
3310
|
+
label: formatMessage({
|
|
3311
|
+
id: `blockAddPosition_${value}`
|
|
3312
|
+
}),
|
|
3313
|
+
value
|
|
3314
|
+
}))
|
|
3315
|
+
}, "addPosition") : null, isListKind ? /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.InputNumber, {
|
|
3347
3316
|
name: "maxLength",
|
|
3348
3317
|
label: formatMessage({
|
|
3349
3318
|
id: 'blockMaxLength'
|
|
3350
3319
|
}),
|
|
3351
3320
|
min: 1
|
|
3352
|
-
}, "maxLength") : null,
|
|
3321
|
+
}, "maxLength") : null, isListKind ? /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.InputNumber, {
|
|
3353
3322
|
name: "minLength",
|
|
3354
3323
|
label: formatMessage({
|
|
3355
3324
|
id: 'blockMinLength'
|
|
@@ -3392,12 +3361,9 @@ const BlockConfigFields = _ref => {
|
|
|
3392
3361
|
placeholder: formatMessage({
|
|
3393
3362
|
id: 'propOptionalNumber'
|
|
3394
3363
|
}),
|
|
3395
|
-
display:
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
} = _ref2;
|
|
3399
|
-
return openApi?.data?.mode === 'multiple';
|
|
3400
|
-
}
|
|
3364
|
+
display: ({
|
|
3365
|
+
openApi
|
|
3366
|
+
}) => openApi?.data?.mode === 'multiple'
|
|
3401
3367
|
}, "minLength"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.InputNumber, {
|
|
3402
3368
|
name: "maxLength",
|
|
3403
3369
|
label: formatMessage({
|
|
@@ -3407,12 +3373,9 @@ const BlockConfigFields = _ref => {
|
|
|
3407
3373
|
placeholder: formatMessage({
|
|
3408
3374
|
id: 'propOptionalNumber'
|
|
3409
3375
|
}),
|
|
3410
|
-
display:
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
} = _ref3;
|
|
3414
|
-
return openApi?.data?.mode === 'multiple';
|
|
3415
|
-
}
|
|
3376
|
+
display: ({
|
|
3377
|
+
openApi
|
|
3378
|
+
}) => openApi?.data?.mode === 'multiple'
|
|
3416
3379
|
}, "maxLength"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
3417
3380
|
name: "selectorInData",
|
|
3418
3381
|
children: formatMessage({
|
|
@@ -3426,12 +3389,9 @@ const BlockConfigFields = _ref => {
|
|
|
3426
3389
|
placeholder: formatMessage({
|
|
3427
3390
|
id: 'choiceSelectorNamePlaceholder'
|
|
3428
3391
|
}),
|
|
3429
|
-
display:
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
} = _ref4;
|
|
3433
|
-
return openApi?.data?.selectorInData !== false;
|
|
3434
|
-
}
|
|
3392
|
+
display: ({
|
|
3393
|
+
openApi
|
|
3394
|
+
}) => openApi?.data?.selectorInData !== false
|
|
3435
3395
|
}, "selectorName"));
|
|
3436
3396
|
}
|
|
3437
3397
|
if (kind === 'multiField') {
|
|
@@ -3505,20 +3465,21 @@ const BlockConfigFields = _ref => {
|
|
|
3505
3465
|
title: formatMessage({
|
|
3506
3466
|
id: `blockKind_${kind}`
|
|
3507
3467
|
}),
|
|
3508
|
-
subtitle: definition
|
|
3468
|
+
subtitle: definition ? formatMessage({
|
|
3469
|
+
id: definition.descriptionId
|
|
3470
|
+
}) : undefined,
|
|
3509
3471
|
column: 1,
|
|
3510
3472
|
list: list.filter(Boolean)
|
|
3511
3473
|
})
|
|
3512
3474
|
});
|
|
3513
3475
|
};
|
|
3514
|
-
const BlockEditorModal =
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
} = _ref5;
|
|
3476
|
+
const BlockEditorModal = ({
|
|
3477
|
+
open,
|
|
3478
|
+
block,
|
|
3479
|
+
onCancel,
|
|
3480
|
+
onSave,
|
|
3481
|
+
renderModal
|
|
3482
|
+
}) => {
|
|
3522
3483
|
const {
|
|
3523
3484
|
formatMessage
|
|
3524
3485
|
} = reactIntl.useIntl();
|
|
@@ -3527,7 +3488,7 @@ const BlockEditorModal = _ref5 => {
|
|
|
3527
3488
|
const formData = react.useMemo(() => blockToFormValues(block || createBlock('formInfo')), [block, open]);
|
|
3528
3489
|
const handleSubmit = function (values) {
|
|
3529
3490
|
try {
|
|
3530
|
-
if ((block?.kind
|
|
3491
|
+
if (getBlockDefinition(block?.kind)?.requiresName && !values.name) {
|
|
3531
3492
|
antd.message.error(formatMessage({
|
|
3532
3493
|
id: 'blockNameRequired'
|
|
3533
3494
|
}));
|
|
@@ -3568,14 +3529,13 @@ const BlockEditorModal = _ref5 => {
|
|
|
3568
3529
|
};
|
|
3569
3530
|
var BlockEditorModal$1 = BlockEditorModal;
|
|
3570
3531
|
|
|
3571
|
-
const StepEditorModal =
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
} = _ref;
|
|
3532
|
+
const StepEditorModal = ({
|
|
3533
|
+
open,
|
|
3534
|
+
step,
|
|
3535
|
+
onCancel,
|
|
3536
|
+
onSave,
|
|
3537
|
+
renderModal
|
|
3538
|
+
}) => {
|
|
3579
3539
|
const {
|
|
3580
3540
|
formatMessage
|
|
3581
3541
|
} = reactIntl.useIntl();
|
|
@@ -3629,14 +3589,13 @@ const StepEditorModal = _ref => {
|
|
|
3629
3589
|
};
|
|
3630
3590
|
var StepEditorModal$1 = StepEditorModal;
|
|
3631
3591
|
|
|
3632
|
-
const ChoiceOptionEditorModal =
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
} = _ref;
|
|
3592
|
+
const ChoiceOptionEditorModal = ({
|
|
3593
|
+
open,
|
|
3594
|
+
option,
|
|
3595
|
+
onCancel,
|
|
3596
|
+
onSave,
|
|
3597
|
+
renderModal
|
|
3598
|
+
}) => {
|
|
3640
3599
|
const {
|
|
3641
3600
|
formatMessage
|
|
3642
3601
|
} = reactIntl.useIntl();
|
|
@@ -3699,7 +3658,9 @@ const RulePresetEditor = () => {
|
|
|
3699
3658
|
formatMessage
|
|
3700
3659
|
} = reactIntl.useIntl();
|
|
3701
3660
|
const options = [...RULE_PRESET_ITEMS.map(item => ({
|
|
3702
|
-
label: item.
|
|
3661
|
+
label: item.labelId ? formatMessage({
|
|
3662
|
+
id: item.labelId
|
|
3663
|
+
}) : item.label,
|
|
3703
3664
|
value: item.value
|
|
3704
3665
|
})), {
|
|
3705
3666
|
label: formatMessage({
|
|
@@ -4617,8 +4578,12 @@ const buildBuiltinList = (type, formatMessage) => {
|
|
|
4617
4578
|
label: 'YYYY/MM/DD',
|
|
4618
4579
|
value: 'YYYY/MM/DD'
|
|
4619
4580
|
}, {
|
|
4620
|
-
label:
|
|
4621
|
-
|
|
4581
|
+
label: formatMessage({
|
|
4582
|
+
id: 'propDateFormatLocalized'
|
|
4583
|
+
}),
|
|
4584
|
+
value: formatMessage({
|
|
4585
|
+
id: 'propDateFormatLocalized'
|
|
4586
|
+
})
|
|
4622
4587
|
}, {
|
|
4623
4588
|
label: 'YYYY-MM-DD HH:mm:ss',
|
|
4624
4589
|
value: 'YYYY-MM-DD HH:mm:ss'
|
|
@@ -4719,21 +4684,17 @@ const getDefaultSelectProps = () => ({
|
|
|
4719
4684
|
searchPlaceholder: '',
|
|
4720
4685
|
columns: [createEmptyColumn()]
|
|
4721
4686
|
});
|
|
4722
|
-
const omitColumns =
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
onOptionsChange,
|
|
4734
|
-
columns,
|
|
4735
|
-
onColumnsChange
|
|
4736
|
-
} = _ref;
|
|
4687
|
+
const omitColumns = ({
|
|
4688
|
+
columns,
|
|
4689
|
+
...rest
|
|
4690
|
+
} = {}) => rest;
|
|
4691
|
+
const FieldConfigFields = ({
|
|
4692
|
+
initialType,
|
|
4693
|
+
options,
|
|
4694
|
+
onOptionsChange,
|
|
4695
|
+
columns,
|
|
4696
|
+
onColumnsChange
|
|
4697
|
+
}) => {
|
|
4737
4698
|
const {
|
|
4738
4699
|
formatMessage
|
|
4739
4700
|
} = reactIntl.useIntl();
|
|
@@ -4757,13 +4718,10 @@ const FieldConfigFields = _ref => {
|
|
|
4757
4718
|
props: nextDefinition.defaultProps || {}
|
|
4758
4719
|
}, nextDefinition);
|
|
4759
4720
|
}
|
|
4760
|
-
const entries = Object.entries(nextValues).map(
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
value
|
|
4765
|
-
};
|
|
4766
|
-
});
|
|
4721
|
+
const entries = Object.entries(nextValues).map(([name, value]) => ({
|
|
4722
|
+
name,
|
|
4723
|
+
value
|
|
4724
|
+
}));
|
|
4767
4725
|
if (!entries.length || !openApi?.setFields) {
|
|
4768
4726
|
return;
|
|
4769
4727
|
}
|
|
@@ -4861,15 +4819,14 @@ const FieldConfigFields = _ref => {
|
|
|
4861
4819
|
}) : null]
|
|
4862
4820
|
});
|
|
4863
4821
|
};
|
|
4864
|
-
const FieldEditorModal =
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
} = _ref3;
|
|
4822
|
+
const FieldEditorModal = ({
|
|
4823
|
+
open,
|
|
4824
|
+
field,
|
|
4825
|
+
fieldList,
|
|
4826
|
+
onCancel,
|
|
4827
|
+
onSave,
|
|
4828
|
+
renderModal
|
|
4829
|
+
}) => {
|
|
4873
4830
|
const {
|
|
4874
4831
|
formatMessage
|
|
4875
4832
|
} = reactIntl.useIntl();
|
|
@@ -4982,14 +4939,13 @@ const FieldEditorModal = _ref3 => {
|
|
|
4982
4939
|
};
|
|
4983
4940
|
var FieldEditorModal$1 = FieldEditorModal;
|
|
4984
4941
|
|
|
4985
|
-
const FormActionsEditor =
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
} = _ref;
|
|
4942
|
+
const FormActionsEditor = ({
|
|
4943
|
+
open,
|
|
4944
|
+
value,
|
|
4945
|
+
onCancel,
|
|
4946
|
+
onSave,
|
|
4947
|
+
renderModal
|
|
4948
|
+
}) => {
|
|
4993
4949
|
const {
|
|
4994
4950
|
formatMessage
|
|
4995
4951
|
} = reactIntl.useIntl();
|
|
@@ -5060,12 +5016,9 @@ const FormActionsEditor = _ref => {
|
|
|
5060
5016
|
placeholder: formatMessage({
|
|
5061
5017
|
id: 'formActionsSubmitTextHint'
|
|
5062
5018
|
}),
|
|
5063
|
-
display:
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
} = _ref2;
|
|
5067
|
-
return Boolean(openApi?.data?.showSubmit);
|
|
5068
|
-
}
|
|
5019
|
+
display: ({
|
|
5020
|
+
openApi
|
|
5021
|
+
}) => Boolean(openApi?.data?.showSubmit)
|
|
5069
5022
|
}, "submitText")]
|
|
5070
5023
|
}), /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
|
|
5071
5024
|
column: 2,
|
|
@@ -5083,12 +5036,9 @@ const FormActionsEditor = _ref => {
|
|
|
5083
5036
|
placeholder: formatMessage({
|
|
5084
5037
|
id: 'formActionsResetTextHint'
|
|
5085
5038
|
}),
|
|
5086
|
-
display:
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
} = _ref3;
|
|
5090
|
-
return Boolean(openApi?.data?.showReset);
|
|
5091
|
-
}
|
|
5039
|
+
display: ({
|
|
5040
|
+
openApi
|
|
5041
|
+
}) => Boolean(openApi?.data?.showReset)
|
|
5092
5042
|
}, "resetText")]
|
|
5093
5043
|
}), /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
|
|
5094
5044
|
column: 2,
|
|
@@ -5106,12 +5056,9 @@ const FormActionsEditor = _ref => {
|
|
|
5106
5056
|
placeholder: formatMessage({
|
|
5107
5057
|
id: 'formActionsCancelTextHint'
|
|
5108
5058
|
}),
|
|
5109
|
-
display:
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
} = _ref4;
|
|
5113
|
-
return Boolean(openApi?.data?.showCancel);
|
|
5114
|
-
}
|
|
5059
|
+
display: ({
|
|
5060
|
+
openApi
|
|
5061
|
+
}) => Boolean(openApi?.data?.showCancel)
|
|
5115
5062
|
}, "cancelText")]
|
|
5116
5063
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5117
5064
|
className: style['form-actions-layout-panel'],
|
|
@@ -5233,30 +5180,30 @@ const resolveSelectLimits = block => {
|
|
|
5233
5180
|
};
|
|
5234
5181
|
const buildMultipleHint = (formatMessage, minLength, maxLength) => {
|
|
5235
5182
|
if (minLength != null && maxLength != null) {
|
|
5236
|
-
return formatMessage
|
|
5183
|
+
return formatMessage({
|
|
5237
5184
|
id: 'choiceModeHintMultipleRange'
|
|
5238
5185
|
}, {
|
|
5239
5186
|
min: minLength,
|
|
5240
5187
|
max: maxLength
|
|
5241
|
-
})
|
|
5188
|
+
});
|
|
5242
5189
|
}
|
|
5243
5190
|
if (minLength != null) {
|
|
5244
|
-
return formatMessage
|
|
5191
|
+
return formatMessage({
|
|
5245
5192
|
id: 'choiceModeHintMultipleMin'
|
|
5246
5193
|
}, {
|
|
5247
5194
|
count: minLength
|
|
5248
|
-
})
|
|
5195
|
+
});
|
|
5249
5196
|
}
|
|
5250
5197
|
if (maxLength != null) {
|
|
5251
|
-
return formatMessage
|
|
5198
|
+
return formatMessage({
|
|
5252
5199
|
id: 'choiceModeHintMultipleMax'
|
|
5253
5200
|
}, {
|
|
5254
5201
|
count: maxLength
|
|
5255
|
-
})
|
|
5202
|
+
});
|
|
5256
5203
|
}
|
|
5257
|
-
return formatMessage
|
|
5204
|
+
return formatMessage({
|
|
5258
5205
|
id: 'choiceModeHintMultiple'
|
|
5259
|
-
})
|
|
5206
|
+
});
|
|
5260
5207
|
};
|
|
5261
5208
|
|
|
5262
5209
|
/**
|
|
@@ -5282,9 +5229,9 @@ const ChoiceBlock = ({
|
|
|
5282
5229
|
openApi
|
|
5283
5230
|
} = reactFormAntd.useFormContext() || {};
|
|
5284
5231
|
const titleText = block?.title != null ? String(block.title).trim() : '';
|
|
5285
|
-
const title = titleText ||
|
|
5232
|
+
const title = titleText || formatMessage({
|
|
5286
5233
|
id: 'choiceAreaTitle'
|
|
5287
|
-
})
|
|
5234
|
+
});
|
|
5288
5235
|
const bordered = isMobile ? false : block?.bordered || undefined;
|
|
5289
5236
|
const {
|
|
5290
5237
|
minLength,
|
|
@@ -5316,11 +5263,11 @@ const ChoiceBlock = ({
|
|
|
5316
5263
|
return options.map((option, index) => {
|
|
5317
5264
|
const value = String(option.id);
|
|
5318
5265
|
return {
|
|
5319
|
-
label: option.title ||
|
|
5266
|
+
label: option.title || formatMessage({
|
|
5320
5267
|
id: 'choiceOptionFallback'
|
|
5321
5268
|
}, {
|
|
5322
5269
|
index: index + 1
|
|
5323
|
-
})
|
|
5270
|
+
}),
|
|
5324
5271
|
value,
|
|
5325
5272
|
disabled: atMax && !selectedIdsFromValue.includes(value)
|
|
5326
5273
|
};
|
|
@@ -5349,21 +5296,21 @@ const ChoiceBlock = ({
|
|
|
5349
5296
|
if (minLength != null && ids.length < minLength) {
|
|
5350
5297
|
return {
|
|
5351
5298
|
result: false,
|
|
5352
|
-
errMsg: formatMessage
|
|
5299
|
+
errMsg: formatMessage({
|
|
5353
5300
|
id: 'choiceMinSelectError'
|
|
5354
5301
|
}, {
|
|
5355
5302
|
count: minLength
|
|
5356
|
-
})
|
|
5303
|
+
})
|
|
5357
5304
|
};
|
|
5358
5305
|
}
|
|
5359
5306
|
if (maxLength != null && ids.length > maxLength) {
|
|
5360
5307
|
return {
|
|
5361
5308
|
result: false,
|
|
5362
|
-
errMsg: formatMessage
|
|
5309
|
+
errMsg: formatMessage({
|
|
5363
5310
|
id: 'choiceMaxSelectError'
|
|
5364
5311
|
}, {
|
|
5365
5312
|
count: maxLength
|
|
5366
|
-
})
|
|
5313
|
+
})
|
|
5367
5314
|
};
|
|
5368
5315
|
}
|
|
5369
5316
|
return {
|
|
@@ -5376,9 +5323,9 @@ const ChoiceBlock = ({
|
|
|
5376
5323
|
const selectorProps = {
|
|
5377
5324
|
key: `choice-selector-${mode}`,
|
|
5378
5325
|
name: selectorName,
|
|
5379
|
-
label: titleText ||
|
|
5326
|
+
label: titleText || formatMessage({
|
|
5380
5327
|
id: 'choiceAreaTitle'
|
|
5381
|
-
})
|
|
5328
|
+
}),
|
|
5382
5329
|
labelHidden: true,
|
|
5383
5330
|
options: selectorOptions,
|
|
5384
5331
|
onChange: handleChange,
|
|
@@ -5412,9 +5359,9 @@ const ChoiceBlock = ({
|
|
|
5412
5359
|
}, option.title) : null, ...nodes));
|
|
5413
5360
|
}
|
|
5414
5361
|
});
|
|
5415
|
-
const modeHint = mode === 'multiple' ? buildMultipleHint(formatMessage, minLength, maxLength) : formatMessage
|
|
5362
|
+
const modeHint = mode === 'multiple' ? buildMultipleHint(formatMessage, minLength, maxLength) : formatMessage({
|
|
5416
5363
|
id: 'choiceModeHintSingle'
|
|
5417
|
-
})
|
|
5364
|
+
});
|
|
5418
5365
|
if (!block) {
|
|
5419
5366
|
return null;
|
|
5420
5367
|
}
|
|
@@ -5430,9 +5377,9 @@ const ChoiceBlock = ({
|
|
|
5430
5377
|
className: style['choice-panels']
|
|
5431
5378
|
}, ...contentChildren) : /*#__PURE__*/react.createElement('div', {
|
|
5432
5379
|
className: style['choice-panels-empty']
|
|
5433
|
-
}, formatMessage
|
|
5380
|
+
}, formatMessage({
|
|
5434
5381
|
id: 'choiceSelectFirstHint'
|
|
5435
|
-
})
|
|
5382
|
+
})));
|
|
5436
5383
|
};
|
|
5437
5384
|
var ChoiceBlock$1 = ChoiceBlock;
|
|
5438
5385
|
|
|
@@ -5456,10 +5403,9 @@ const buildFieldLabel = field => {
|
|
|
5456
5403
|
return base || undefined;
|
|
5457
5404
|
};
|
|
5458
5405
|
const buildIndexedLabelRender = index => {
|
|
5459
|
-
return
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
} = _ref;
|
|
5406
|
+
return ({
|
|
5407
|
+
label
|
|
5408
|
+
}) => {
|
|
5463
5409
|
const text = label != null ? String(label).replace(/\u200b/g, '') : '';
|
|
5464
5410
|
return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement('span', {
|
|
5465
5411
|
className: style['field-label-index']
|
|
@@ -5468,67 +5414,61 @@ const buildIndexedLabelRender = index => {
|
|
|
5468
5414
|
}, text) : null);
|
|
5469
5415
|
};
|
|
5470
5416
|
};
|
|
5471
|
-
const renderFieldElements =
|
|
5472
|
-
|
|
5473
|
-
|
|
5417
|
+
const renderFieldElements = (fields = [], preview = false, {
|
|
5418
|
+
namePrefix,
|
|
5419
|
+
locale,
|
|
5420
|
+
showIndex = false
|
|
5421
|
+
} = {}) => fields.filter(field => !field.hidden).map((field, index) => {
|
|
5422
|
+
const Component = getFieldComponent(field.type, field);
|
|
5423
|
+
if (!Component) {
|
|
5424
|
+
return null;
|
|
5474
5425
|
}
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
}
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
...(definition?.defaultProps || {}),
|
|
5488
|
-
...(field.props || {})
|
|
5489
|
-
};
|
|
5490
|
-
if (definition?.optionsAllowDescription && props.options?.length && !props.api && !definition.optionsAllowChildren) {
|
|
5491
|
-
props.api = createApiFromOptions(props.options);
|
|
5492
|
-
}
|
|
5493
|
-
if (!Array.isArray(props.placeholder) && props.placeholder != null && !String(props.placeholder).trim()) {
|
|
5494
|
-
delete props.placeholder;
|
|
5495
|
-
}
|
|
5496
|
-
delete props.range;
|
|
5426
|
+
const definition = getFieldDefinition(field.type);
|
|
5427
|
+
const props = {
|
|
5428
|
+
...(definition?.defaultProps || {}),
|
|
5429
|
+
...(field.props || {})
|
|
5430
|
+
};
|
|
5431
|
+
if (definition?.optionsAllowDescription && props.options?.length && !props.api && !definition.optionsAllowChildren) {
|
|
5432
|
+
props.api = createApiFromOptions(props.options);
|
|
5433
|
+
}
|
|
5434
|
+
if (!Array.isArray(props.placeholder) && props.placeholder != null && !String(props.placeholder).trim()) {
|
|
5435
|
+
delete props.placeholder;
|
|
5436
|
+
}
|
|
5437
|
+
delete props.range;
|
|
5497
5438
|
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
}
|
|
5506
|
-
props.className = [props.className, style['option-group-stack']].filter(Boolean).join(' ');
|
|
5439
|
+
// Radio/Checkbox 选项布局:inline=false 纵向;Radio 用 antd vertical,Checkbox 用样式兜底
|
|
5440
|
+
if (field.type === 'RadioGroup' || field.type === 'CheckboxGroup') {
|
|
5441
|
+
const optionsInline = props.inline !== false;
|
|
5442
|
+
delete props.inline;
|
|
5443
|
+
if (!optionsInline) {
|
|
5444
|
+
if (field.type === 'RadioGroup') {
|
|
5445
|
+
props.vertical = true;
|
|
5507
5446
|
}
|
|
5447
|
+
props.className = [props.className, style['option-group-stack']].filter(Boolean).join(' ');
|
|
5508
5448
|
}
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
})
|
|
5531
|
-
};
|
|
5449
|
+
}
|
|
5450
|
+
const description = field.description != null && String(field.description).trim() ? field.description : undefined;
|
|
5451
|
+
const fieldName = namePrefix && field.name ? `${namePrefix}.${field.name}` : field.name;
|
|
5452
|
+
// 显式传 locale,避免 Global 仍为 zh-CN 时 react-form-antd withLocale 盖掉父级英文
|
|
5453
|
+
const localeProps = locale ? {
|
|
5454
|
+
locale
|
|
5455
|
+
} : {};
|
|
5456
|
+
const label = buildFieldLabel(field);
|
|
5457
|
+
return /*#__PURE__*/react.createElement(Component, {
|
|
5458
|
+
key: field.id,
|
|
5459
|
+
name: fieldName,
|
|
5460
|
+
label: showIndex ? label || '\u200b' : label,
|
|
5461
|
+
...(showIndex ? {
|
|
5462
|
+
labelRender: buildIndexedLabelRender(index)
|
|
5463
|
+
} : null),
|
|
5464
|
+
rule: field.rule || undefined,
|
|
5465
|
+
block: field.block || undefined,
|
|
5466
|
+
...props,
|
|
5467
|
+
...localeProps,
|
|
5468
|
+
labelTips: buildLabelTips(field.tips),
|
|
5469
|
+
description
|
|
5470
|
+
});
|
|
5471
|
+
}).filter(Boolean);
|
|
5532
5472
|
const withBlockLayout = (element, forceBlock) => {
|
|
5533
5473
|
if (!element || !forceBlock) {
|
|
5534
5474
|
return element;
|
|
@@ -5559,13 +5499,7 @@ const nestedListItemPartProps = {
|
|
|
5559
5499
|
}
|
|
5560
5500
|
};
|
|
5561
5501
|
const isFormInfoLikeBlock = kind => kind === 'formInfo' || kind === 'object';
|
|
5562
|
-
const renderBlockElement =
|
|
5563
|
-
if (preview === void 0) {
|
|
5564
|
-
preview = false;
|
|
5565
|
-
}
|
|
5566
|
-
if (ctx === void 0) {
|
|
5567
|
-
ctx = {};
|
|
5568
|
-
}
|
|
5502
|
+
const renderBlockElement = (block, preview = false, ctx = {}) => {
|
|
5569
5503
|
const {
|
|
5570
5504
|
isMobile = false,
|
|
5571
5505
|
formatMessage,
|
|
@@ -5587,29 +5521,16 @@ const renderBlockElement = function (block, preview, ctx) {
|
|
|
5587
5521
|
const bordered = isMobile ? false : block.bordered || undefined;
|
|
5588
5522
|
// 仅 FormInfo/object 吃列表项 Part 样式;List 等交给 form-info nestDepth
|
|
5589
5523
|
const listItemPartProps = asListItem && isFormInfoLikeBlock(block.kind) ? nestedListItemPartProps : null;
|
|
5590
|
-
const renderChildBlocks =
|
|
5591
|
-
if (blocks === void 0) {
|
|
5592
|
-
blocks = [];
|
|
5593
|
-
}
|
|
5594
|
-
if (childCtx === void 0) {
|
|
5595
|
-
childCtx = nextCtx;
|
|
5596
|
-
}
|
|
5597
|
-
return (blocks || []).map(child => renderBlockElement(child, preview, childCtx)).filter(Boolean);
|
|
5598
|
-
};
|
|
5524
|
+
const renderChildBlocks = (blocks = [], childCtx = nextCtx) => (blocks || []).map(child => renderBlockElement(child, preview, childCtx)).filter(Boolean);
|
|
5599
5525
|
|
|
5600
5526
|
/** list.itemBlocks:object/formInfo 走 asListItem;嵌套 list 等保持 nestDepth 链路 */
|
|
5601
|
-
const renderItemBlocks =
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
asListItem: isFormInfoLikeBlock(child.kind)
|
|
5609
|
-
};
|
|
5610
|
-
return withBlockLayout(renderBlockElement(child, preview, childCtx), true);
|
|
5611
|
-
}).filter(Boolean);
|
|
5612
|
-
};
|
|
5527
|
+
const renderItemBlocks = (blocks = []) => (blocks || []).map(child => {
|
|
5528
|
+
const childCtx = {
|
|
5529
|
+
...nextCtx,
|
|
5530
|
+
asListItem: isFormInfoLikeBlock(child.kind)
|
|
5531
|
+
};
|
|
5532
|
+
return withBlockLayout(renderBlockElement(child, preview, childCtx), true);
|
|
5533
|
+
}).filter(Boolean);
|
|
5613
5534
|
switch (block.kind) {
|
|
5614
5535
|
case 'formInfo':
|
|
5615
5536
|
{
|
|
@@ -5690,6 +5611,31 @@ const renderBlockElement = function (block, preview, ctx) {
|
|
|
5690
5611
|
className: resolvePartRootClassName(depth)
|
|
5691
5612
|
}), asListItem);
|
|
5692
5613
|
}
|
|
5614
|
+
case 'editableList':
|
|
5615
|
+
{
|
|
5616
|
+
const fields = renderFieldElements(block.list, preview, fieldRenderOpts);
|
|
5617
|
+
const nested = renderItemBlocks(block.itemBlocks || []);
|
|
5618
|
+
return withBlockLayout(/*#__PURE__*/react.createElement(FormInfo.EditableList, {
|
|
5619
|
+
key: block.id,
|
|
5620
|
+
name: block.name,
|
|
5621
|
+
title: block.title || undefined,
|
|
5622
|
+
bordered,
|
|
5623
|
+
className: resolvePartRootClassName(depth),
|
|
5624
|
+
column: block.column,
|
|
5625
|
+
maxLength: block.maxLength,
|
|
5626
|
+
minLength: block.minLength,
|
|
5627
|
+
...(block.addPosition ? {
|
|
5628
|
+
addPosition: block.addPosition
|
|
5629
|
+
} : {}),
|
|
5630
|
+
...(block.addText ? {
|
|
5631
|
+
addText: block.addText
|
|
5632
|
+
} : {}),
|
|
5633
|
+
...(typeof block.itemTitle === 'function' || block.itemTitle ? {
|
|
5634
|
+
itemTitle: block.itemTitle
|
|
5635
|
+
} : {}),
|
|
5636
|
+
list: [...fields, ...nested]
|
|
5637
|
+
}), asListItem);
|
|
5638
|
+
}
|
|
5693
5639
|
case 'multiField':
|
|
5694
5640
|
{
|
|
5695
5641
|
const FieldComponent = getFieldComponent(block.fieldType);
|
|
@@ -5764,7 +5710,7 @@ const renderBlockElement = function (block, preview, ctx) {
|
|
|
5764
5710
|
key: `${option.id}-fields`,
|
|
5765
5711
|
column: block.column || 2,
|
|
5766
5712
|
gap: block.gap,
|
|
5767
|
-
list: renderFieldElements(option.list)
|
|
5713
|
+
list: renderFieldElements(option.list, preview)
|
|
5768
5714
|
}));
|
|
5769
5715
|
}
|
|
5770
5716
|
nodes.push(...renderChildBlocks(option.blocks || [], nextCtx));
|
|
@@ -5775,17 +5721,16 @@ const renderBlockElement = function (block, preview, ctx) {
|
|
|
5775
5721
|
return null;
|
|
5776
5722
|
}
|
|
5777
5723
|
};
|
|
5778
|
-
const renderSchemaInner =
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
} = _temp2 === void 0 ? {} : _temp2;
|
|
5724
|
+
const renderSchemaInner = (schema, {
|
|
5725
|
+
preview = false,
|
|
5726
|
+
className,
|
|
5727
|
+
bodyClassName,
|
|
5728
|
+
isMobile = false,
|
|
5729
|
+
formatMessage,
|
|
5730
|
+
locale,
|
|
5731
|
+
children,
|
|
5732
|
+
actionNode
|
|
5733
|
+
} = {}) => {
|
|
5789
5734
|
const normalized = normalizeSchema(schema);
|
|
5790
5735
|
const blocks = normalized.blocks || [];
|
|
5791
5736
|
const contentChildren = blocks.map(block => renderBlockElement(block, preview, {
|
|
@@ -5804,18 +5749,17 @@ const renderSchemaInner = function (schema, _temp2) {
|
|
|
5804
5749
|
className
|
|
5805
5750
|
}, content) : content;
|
|
5806
5751
|
};
|
|
5807
|
-
const renderSchemaContent =
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
} = _temp3 === void 0 ? {} : _temp3;
|
|
5752
|
+
const renderSchemaContent = (schema, {
|
|
5753
|
+
preview = false,
|
|
5754
|
+
formProps = {},
|
|
5755
|
+
className,
|
|
5756
|
+
bodyClassName,
|
|
5757
|
+
isMobile = false,
|
|
5758
|
+
formatMessage,
|
|
5759
|
+
locale,
|
|
5760
|
+
children,
|
|
5761
|
+
actionNode
|
|
5762
|
+
} = {}) => {
|
|
5819
5763
|
const normalized = normalizeSchema(schema);
|
|
5820
5764
|
const blocks = normalized.blocks || [];
|
|
5821
5765
|
const contentChildren = blocks.map(block => renderBlockElement(block, preview, {
|
|
@@ -5839,27 +5783,26 @@ var renderSchemaContent$1 = renderSchemaContent;
|
|
|
5839
5783
|
const joinClass = function () {
|
|
5840
5784
|
return [].slice.call(arguments).filter(Boolean).join(' ');
|
|
5841
5785
|
};
|
|
5842
|
-
const resolveActionNode =
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
} = _ref;
|
|
5786
|
+
const resolveActionNode = ({
|
|
5787
|
+
schema,
|
|
5788
|
+
formatMessage,
|
|
5789
|
+
actions,
|
|
5790
|
+
showActions = true,
|
|
5791
|
+
submitText,
|
|
5792
|
+
resetText,
|
|
5793
|
+
cancelText,
|
|
5794
|
+
submitButtonProps,
|
|
5795
|
+
resetButtonProps,
|
|
5796
|
+
cancelButtonProps,
|
|
5797
|
+
showSubmit,
|
|
5798
|
+
showReset,
|
|
5799
|
+
showCancel,
|
|
5800
|
+
actionsAlign,
|
|
5801
|
+
actionsGap,
|
|
5802
|
+
footerClassName,
|
|
5803
|
+
buttonFooter = false,
|
|
5804
|
+
buttonFooterProps
|
|
5805
|
+
}) => {
|
|
5863
5806
|
if (showActions === false || actions === false || actions === null) {
|
|
5864
5807
|
return null;
|
|
5865
5808
|
}
|
|
@@ -6051,17 +5994,16 @@ const SchemaRenderer = withLocale$1(props => {
|
|
|
6051
5994
|
});
|
|
6052
5995
|
var SchemaRenderer$1 = SchemaRenderer;
|
|
6053
5996
|
|
|
6054
|
-
const FormCreator = withLocale$1(
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
} = _ref;
|
|
5997
|
+
const FormCreator = withLocale$1(({
|
|
5998
|
+
value,
|
|
5999
|
+
defaultValue,
|
|
6000
|
+
onChange,
|
|
6001
|
+
showPreview = true,
|
|
6002
|
+
className,
|
|
6003
|
+
formProps,
|
|
6004
|
+
renderModal,
|
|
6005
|
+
extraToolbar
|
|
6006
|
+
}) => {
|
|
6065
6007
|
const {
|
|
6066
6008
|
formatMessage,
|
|
6067
6009
|
locale
|
|
@@ -6096,13 +6038,20 @@ const FormCreator = withLocale$1(_ref => {
|
|
|
6096
6038
|
setBlockParentStepId(null);
|
|
6097
6039
|
setBlockParentOptionId(null);
|
|
6098
6040
|
};
|
|
6099
|
-
const handleAddBlock =
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6041
|
+
const handleAddBlock = (kind, {
|
|
6042
|
+
parentBlockId,
|
|
6043
|
+
stepId,
|
|
6044
|
+
optionId
|
|
6045
|
+
} = {}) => {
|
|
6046
|
+
setEditingBlock(createBlock(kind, kind === 'choice' ? {
|
|
6047
|
+
options: [createChoiceOption({
|
|
6048
|
+
title: formatMessage({
|
|
6049
|
+
id: 'choiceOptionFallback'
|
|
6050
|
+
}, {
|
|
6051
|
+
index: 1
|
|
6052
|
+
})
|
|
6053
|
+
})]
|
|
6054
|
+
} : undefined));
|
|
6106
6055
|
setBlockParentId(parentBlockId || null);
|
|
6107
6056
|
setBlockParentStepId(stepId || null);
|
|
6108
6057
|
setBlockParentOptionId(optionId || null);
|
|
@@ -6137,7 +6086,7 @@ const FormCreator = withLocale$1(_ref => {
|
|
|
6137
6086
|
})));
|
|
6138
6087
|
} else if (blockParentId) {
|
|
6139
6088
|
updateSchema(mapBlocks(schema, blockParentId, parent => {
|
|
6140
|
-
if (parent.kind
|
|
6089
|
+
if (supportsItemBlocks(parent.kind)) {
|
|
6141
6090
|
return {
|
|
6142
6091
|
...parent,
|
|
6143
6092
|
itemBlocks: [...(parent.itemBlocks || []), block]
|
|
@@ -6534,12 +6483,11 @@ const isImageFile = (item, field) => {
|
|
|
6534
6483
|
};
|
|
6535
6484
|
const FileFieldPreview = remoteLoader.createWithRemoteLoader({
|
|
6536
6485
|
modules: ['components-core:File@FileLink', 'components-core:Image']
|
|
6537
|
-
})(
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
} = _ref;
|
|
6486
|
+
})(({
|
|
6487
|
+
remoteModules,
|
|
6488
|
+
value,
|
|
6489
|
+
field
|
|
6490
|
+
}) => {
|
|
6543
6491
|
const [FileLink, Image] = remoteModules;
|
|
6544
6492
|
const files = toFileList(value).map(pickFilePreviewProps).filter(Boolean);
|
|
6545
6493
|
if (!files.length) {
|
|
@@ -6691,13 +6639,7 @@ const formatTemporal = (value, formatKey, patternOverride) => {
|
|
|
6691
6639
|
return applyPattern(date, pattern);
|
|
6692
6640
|
};
|
|
6693
6641
|
const isTemporalKey = key => !!(key && (TEMPORAL_PATTERN[key] || key === 'week' || key === 'quarter'));
|
|
6694
|
-
const pickObjectLabel =
|
|
6695
|
-
if (labelKey === void 0) {
|
|
6696
|
-
labelKey = 'label';
|
|
6697
|
-
}
|
|
6698
|
-
if (valueKey === void 0) {
|
|
6699
|
-
valueKey = 'value';
|
|
6700
|
-
}
|
|
6642
|
+
const pickObjectLabel = (item, labelKey = 'label', valueKey = 'value') => {
|
|
6701
6643
|
if (item == null) {
|
|
6702
6644
|
return '';
|
|
6703
6645
|
}
|
|
@@ -6714,13 +6656,7 @@ const pickObjectLabel = function (item, labelKey, valueKey) {
|
|
|
6714
6656
|
}
|
|
6715
6657
|
return '';
|
|
6716
6658
|
};
|
|
6717
|
-
const mapOptionLabel =
|
|
6718
|
-
if (labelKey === void 0) {
|
|
6719
|
-
labelKey = 'label';
|
|
6720
|
-
}
|
|
6721
|
-
if (valueKey === void 0) {
|
|
6722
|
-
valueKey = 'value';
|
|
6723
|
-
}
|
|
6659
|
+
const mapOptionLabel = (value, options, labelKey = 'label', valueKey = 'value') => {
|
|
6724
6660
|
if (value && typeof value === 'object') {
|
|
6725
6661
|
return pickObjectLabel(value, labelKey, valueKey);
|
|
6726
6662
|
}
|
|
@@ -6795,7 +6731,7 @@ const formatDateToToday = (value, itemSchema, ctx) => {
|
|
|
6795
6731
|
if (items[1] == null || items[1] === '' || items[1] === true) {
|
|
6796
6732
|
const until = ctx.formatMessage?.({
|
|
6797
6733
|
id: 'schemaContentUntilToday'
|
|
6798
|
-
}) ||
|
|
6734
|
+
}) || defaultLocale.schemaContentUntilToday;
|
|
6799
6735
|
return [start, until].filter(Boolean).join(' ~ ');
|
|
6800
6736
|
}
|
|
6801
6737
|
const end = formatByValueSchema(items[1], itemSchema, ctx);
|
|
@@ -6850,11 +6786,11 @@ const formatBoolean = (value, field, ctx) => {
|
|
|
6850
6786
|
if (value) {
|
|
6851
6787
|
return props.checkedChildren || ctx.formatMessage?.({
|
|
6852
6788
|
id: 'schemaContentYes'
|
|
6853
|
-
}) ||
|
|
6789
|
+
}) || defaultLocale.schemaContentYes;
|
|
6854
6790
|
}
|
|
6855
6791
|
return props.unCheckedChildren || ctx.formatMessage?.({
|
|
6856
6792
|
id: 'schemaContentNo'
|
|
6857
|
-
}) ||
|
|
6793
|
+
}) || defaultLocale.schemaContentNo;
|
|
6858
6794
|
};
|
|
6859
6795
|
const stringifyFallback = value => {
|
|
6860
6796
|
if (value == null) {
|
|
@@ -6889,10 +6825,7 @@ const stringifyFallback = value => {
|
|
|
6889
6825
|
return '';
|
|
6890
6826
|
}
|
|
6891
6827
|
};
|
|
6892
|
-
const formatByValueSchema =
|
|
6893
|
-
if (ctx === void 0) {
|
|
6894
|
-
ctx = {};
|
|
6895
|
-
}
|
|
6828
|
+
const formatByValueSchema = (value, schema, ctx = {}) => {
|
|
6896
6829
|
if (isEmptyValue(value)) {
|
|
6897
6830
|
return '';
|
|
6898
6831
|
}
|
|
@@ -6984,10 +6917,9 @@ const formatByValueSchema = function (value, schema, ctx) {
|
|
|
6984
6917
|
}
|
|
6985
6918
|
return String(value);
|
|
6986
6919
|
};
|
|
6987
|
-
const formatFieldDisplayValue =
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
} = _temp === void 0 ? {} : _temp;
|
|
6920
|
+
const formatFieldDisplayValue = (field, value, {
|
|
6921
|
+
formatMessage
|
|
6922
|
+
} = {}) => {
|
|
6991
6923
|
const emptyText = formatMessage?.({
|
|
6992
6924
|
id: 'schemaContentEmptyValue'
|
|
6993
6925
|
}) || '-';
|
|
@@ -7015,16 +6947,14 @@ const formatFieldDisplayValue = function (field, value, _temp) {
|
|
|
7015
6947
|
* 统一注册扩展规则与填写项:运行时校验 + 编辑器规则面板 + 字段类型 registry。
|
|
7016
6948
|
* 应用入口调用一次即可,FormCreator / SchemaRenderer 共用。
|
|
7017
6949
|
*/
|
|
7018
|
-
const preset =
|
|
7019
|
-
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
} = _temp === void 0 ? {} : _temp;
|
|
6950
|
+
const preset = ({
|
|
6951
|
+
rules = {},
|
|
6952
|
+
fields = {}
|
|
6953
|
+
} = {}) => {
|
|
7023
6954
|
const runtimeRules = {
|
|
7024
6955
|
...reactFormAntd.RULES
|
|
7025
6956
|
};
|
|
7026
|
-
Object.entries(rules).forEach(
|
|
7027
|
-
let [value, def] = _ref;
|
|
6957
|
+
Object.entries(rules).forEach(([value, def]) => {
|
|
7028
6958
|
if (def == null) {
|
|
7029
6959
|
return;
|
|
7030
6960
|
}
|
|
@@ -7056,8 +6986,7 @@ const preset = function (_temp) {
|
|
|
7056
6986
|
reactFormAntd.preset({
|
|
7057
6987
|
rules: runtimeRules
|
|
7058
6988
|
});
|
|
7059
|
-
Object.entries(fields).forEach(
|
|
7060
|
-
let [type, definition] = _ref2;
|
|
6989
|
+
Object.entries(fields).forEach(([type, definition]) => {
|
|
7061
6990
|
registerField(type, definition);
|
|
7062
6991
|
});
|
|
7063
6992
|
};
|
|
@@ -7077,10 +7006,9 @@ const resolveChoiceSelectorName$1 = block => {
|
|
|
7077
7006
|
}
|
|
7078
7007
|
return `__choice_${block.id}`;
|
|
7079
7008
|
};
|
|
7080
|
-
const mergeFieldIntoLayer =
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
} = _temp === void 0 ? {} : _temp;
|
|
7009
|
+
const mergeFieldIntoLayer = (layer, field, {
|
|
7010
|
+
allowRequired = true
|
|
7011
|
+
} = {}) => {
|
|
7084
7012
|
if (!field?.name) {
|
|
7085
7013
|
return;
|
|
7086
7014
|
}
|
|
@@ -7107,11 +7035,10 @@ const toFiniteInt = (value, minAllowed) => {
|
|
|
7107
7035
|
const int = Math.floor(num);
|
|
7108
7036
|
return int < minAllowed ? minAllowed : int;
|
|
7109
7037
|
};
|
|
7110
|
-
const finalizeObjectSchema =
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
} = _temp2 === void 0 ? {} : _temp2;
|
|
7038
|
+
const finalizeObjectSchema = (layer, {
|
|
7039
|
+
title,
|
|
7040
|
+
description
|
|
7041
|
+
} = {}) => {
|
|
7115
7042
|
const schema = {
|
|
7116
7043
|
type: 'object',
|
|
7117
7044
|
properties: {
|
|
@@ -7134,20 +7061,20 @@ const finalizeObjectSchema = function (layer, _temp2) {
|
|
|
7134
7061
|
}
|
|
7135
7062
|
return schema;
|
|
7136
7063
|
};
|
|
7137
|
-
const walkBlocks =
|
|
7064
|
+
const walkBlocks = (blocks, layer, depth = 0) => {
|
|
7138
7065
|
(blocks || []).forEach(block => {
|
|
7139
7066
|
if (!block) {
|
|
7140
7067
|
return;
|
|
7141
7068
|
}
|
|
7142
|
-
walkBlock(block, layer);
|
|
7069
|
+
walkBlock(block, layer, depth);
|
|
7143
7070
|
});
|
|
7144
7071
|
};
|
|
7145
|
-
const walkBlock =
|
|
7072
|
+
const walkBlock = (block, layer, depth = 0) => {
|
|
7146
7073
|
switch (block.kind) {
|
|
7147
7074
|
case 'formInfo':
|
|
7148
7075
|
{
|
|
7149
7076
|
mergeFieldsIntoLayer(layer, block.list);
|
|
7150
|
-
walkBlocks(block.blocks, layer);
|
|
7077
|
+
walkBlocks(block.blocks, layer, depth + 1);
|
|
7151
7078
|
return;
|
|
7152
7079
|
}
|
|
7153
7080
|
case 'object':
|
|
@@ -7155,12 +7082,12 @@ const walkBlock = function (block, layer, depth) {
|
|
|
7155
7082
|
const name = block.name != null && String(block.name).trim() ? String(block.name).trim() : '';
|
|
7156
7083
|
if (!name) {
|
|
7157
7084
|
mergeFieldsIntoLayer(layer, block.list);
|
|
7158
|
-
walkBlocks(block.blocks, layer);
|
|
7085
|
+
walkBlocks(block.blocks, layer, depth + 1);
|
|
7159
7086
|
return;
|
|
7160
7087
|
}
|
|
7161
7088
|
const nested = createObjectLayer();
|
|
7162
7089
|
mergeFieldsIntoLayer(nested, block.list);
|
|
7163
|
-
walkBlocks(block.blocks, nested);
|
|
7090
|
+
walkBlocks(block.blocks, nested, depth + 1);
|
|
7164
7091
|
layer.properties[name] = finalizeObjectSchema(nested, {
|
|
7165
7092
|
title: block.title || undefined,
|
|
7166
7093
|
description: block.subtitle || undefined
|
|
@@ -7169,6 +7096,7 @@ const walkBlock = function (block, layer, depth) {
|
|
|
7169
7096
|
}
|
|
7170
7097
|
case 'list':
|
|
7171
7098
|
case 'tableList':
|
|
7099
|
+
case 'editableList':
|
|
7172
7100
|
{
|
|
7173
7101
|
const name = block.name != null && String(block.name).trim() ? String(block.name).trim() : '';
|
|
7174
7102
|
if (!name) {
|
|
@@ -7176,8 +7104,8 @@ const walkBlock = function (block, layer, depth) {
|
|
|
7176
7104
|
}
|
|
7177
7105
|
const itemLayer = createObjectLayer();
|
|
7178
7106
|
mergeFieldsIntoLayer(itemLayer, block.list);
|
|
7179
|
-
if (block.kind
|
|
7180
|
-
walkBlocks(block.itemBlocks, itemLayer);
|
|
7107
|
+
if (supportsItemBlocks(block.kind)) {
|
|
7108
|
+
walkBlocks(block.itemBlocks, itemLayer, depth + 1);
|
|
7181
7109
|
}
|
|
7182
7110
|
const items = finalizeObjectSchema(itemLayer);
|
|
7183
7111
|
const arraySchema = {
|
|
@@ -7223,13 +7151,13 @@ const walkBlock = function (block, layer, depth) {
|
|
|
7223
7151
|
{
|
|
7224
7152
|
(block.items || []).forEach(step => {
|
|
7225
7153
|
mergeFieldsIntoLayer(layer, step?.list);
|
|
7226
|
-
walkBlocks(step?.blocks, layer);
|
|
7154
|
+
walkBlocks(step?.blocks, layer, depth + 1);
|
|
7227
7155
|
});
|
|
7228
7156
|
return;
|
|
7229
7157
|
}
|
|
7230
7158
|
case 'choice':
|
|
7231
7159
|
{
|
|
7232
|
-
mergeChoiceIntoLayer(layer, block);
|
|
7160
|
+
mergeChoiceIntoLayer(layer, block, depth);
|
|
7233
7161
|
return;
|
|
7234
7162
|
}
|
|
7235
7163
|
default:
|
|
@@ -7248,20 +7176,22 @@ const mergeChoiceIntoLayer = (layer, block, depth) => {
|
|
|
7248
7176
|
const selectorName = resolveChoiceSelectorName$1(block);
|
|
7249
7177
|
const options = block.options || [];
|
|
7250
7178
|
const optionIds = options.map(option => String(option.id));
|
|
7251
|
-
const branches = options.map(
|
|
7179
|
+
const branches = options.map(option => {
|
|
7252
7180
|
const branch = createObjectLayer();
|
|
7253
|
-
const optionTitle = option.title ||
|
|
7181
|
+
const optionTitle = option.title || undefined;
|
|
7254
7182
|
if (selectorInData && mode === 'single') {
|
|
7255
7183
|
branch.properties[selectorName] = {
|
|
7256
7184
|
const: String(option.id),
|
|
7257
|
-
|
|
7185
|
+
...(optionTitle ? {
|
|
7186
|
+
title: optionTitle
|
|
7187
|
+
} : {})
|
|
7258
7188
|
};
|
|
7259
7189
|
branch.required.push(selectorName);
|
|
7260
7190
|
}
|
|
7261
7191
|
mergeFieldsIntoLayer(branch, option.list, {
|
|
7262
7192
|
allowRequired: true
|
|
7263
7193
|
});
|
|
7264
|
-
walkBlocks(option.blocks, branch);
|
|
7194
|
+
walkBlocks(option.blocks, branch, depth + 1);
|
|
7265
7195
|
return finalizeObjectSchema(branch, {
|
|
7266
7196
|
title: optionTitle
|
|
7267
7197
|
});
|
|
@@ -7339,13 +7269,10 @@ const mergeChoiceIntoLayer = (layer, block, depth) => {
|
|
|
7339
7269
|
* - hidden 字段仍进入 data schema(可提交)
|
|
7340
7270
|
* - choice:single → oneOf,multiple → anyOf
|
|
7341
7271
|
*/
|
|
7342
|
-
const schemaToDataSchema =
|
|
7343
|
-
if (options === void 0) {
|
|
7344
|
-
options = {};
|
|
7345
|
-
}
|
|
7272
|
+
const schemaToDataSchema = (schema, options = {}) => {
|
|
7346
7273
|
const normalized = normalizeSchema(schema || {});
|
|
7347
7274
|
const layer = createObjectLayer();
|
|
7348
|
-
walkBlocks(normalized.blocks, layer);
|
|
7275
|
+
walkBlocks(normalized.blocks, layer, 0);
|
|
7349
7276
|
const root = finalizeObjectSchema(layer, {
|
|
7350
7277
|
title: normalized.title || undefined,
|
|
7351
7278
|
description: options.description
|
|
@@ -7379,10 +7306,9 @@ const formatFieldValue = (field, value, formatMessage) => formatFieldDisplayValu
|
|
|
7379
7306
|
* 问卷题干往往很长:不用 InfoPage Content 的横向 label 列宽对齐(minWidth),
|
|
7380
7307
|
* 改为 label 在上、值在下,避免窄栏(如弹窗双栏预览)被撑乱。
|
|
7381
7308
|
*/
|
|
7382
|
-
const renderFieldsContent =
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
} = _temp === void 0 ? {} : _temp;
|
|
7309
|
+
const renderFieldsContent = (fields, data, formatMessage, column, {
|
|
7310
|
+
showIndex = false
|
|
7311
|
+
} = {}) => {
|
|
7386
7312
|
const list = (fields || []).filter(field => field && !field.hidden && field.name).map((field, index) => {
|
|
7387
7313
|
const baseLabel = field.label || field.name;
|
|
7388
7314
|
const label = showIndex ? `${index + 1}. ${baseLabel}` : baseLabel;
|
|
@@ -7456,6 +7382,7 @@ const renderBlock = (block, data, ctx) => {
|
|
|
7456
7382
|
}
|
|
7457
7383
|
case 'list':
|
|
7458
7384
|
case 'tableList':
|
|
7385
|
+
case 'editableList':
|
|
7459
7386
|
{
|
|
7460
7387
|
const name = block.name != null && String(block.name).trim() ? String(block.name).trim() : '';
|
|
7461
7388
|
const items = name ? getByPath(data, name) : null;
|
|
@@ -7469,7 +7396,7 @@ const renderBlock = (block, data, ctx) => {
|
|
|
7469
7396
|
index: index + 1
|
|
7470
7397
|
}),
|
|
7471
7398
|
bordered: false,
|
|
7472
|
-
children: [renderFieldsContent(block.list, item || {}, formatMessage, 2), block.kind
|
|
7399
|
+
children: [renderFieldsContent(block.list, item || {}, formatMessage, 2), supportsItemBlocks(block.kind) ? renderBlockList(block.itemBlocks, item || {}, nextCtx) : null]
|
|
7473
7400
|
}, `${block.id}-${index}`)) : formatMessage({
|
|
7474
7401
|
id: 'schemaContentEmptyValue'
|
|
7475
7402
|
})
|
|
@@ -7535,12 +7462,11 @@ const renderBlock = (block, data, ctx) => {
|
|
|
7535
7462
|
return null;
|
|
7536
7463
|
}
|
|
7537
7464
|
};
|
|
7538
|
-
const SchemaContentInnerView =
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
|
|
7542
|
-
|
|
7543
|
-
} = _ref;
|
|
7465
|
+
const SchemaContentInnerView = ({
|
|
7466
|
+
schema,
|
|
7467
|
+
data,
|
|
7468
|
+
className
|
|
7469
|
+
}) => {
|
|
7544
7470
|
const {
|
|
7545
7471
|
formatMessage
|
|
7546
7472
|
} = reactIntl.useIntl();
|
|
@@ -7565,13 +7491,12 @@ const SchemaContentInnerView = _ref => {
|
|
|
7565
7491
|
});
|
|
7566
7492
|
};
|
|
7567
7493
|
const SchemaContentInner = withLocale$1(SchemaContentInnerView);
|
|
7568
|
-
const SchemaContent = withLocale$1(
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
} = _ref2;
|
|
7494
|
+
const SchemaContent = withLocale$1(({
|
|
7495
|
+
schema,
|
|
7496
|
+
data,
|
|
7497
|
+
className,
|
|
7498
|
+
empty
|
|
7499
|
+
}) => {
|
|
7575
7500
|
const {
|
|
7576
7501
|
formatMessage
|
|
7577
7502
|
} = reactIntl.useIntl();
|