@kne/form-creator 0.1.17 → 0.1.19
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 +245 -75
- package/dist/index.css +79 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +376 -132
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +388 -135
- package/dist/index.modern.js.map +1 -1
- package/dist/locale/en-US.js +25 -2
- package/dist/locale/en-US.js.map +1 -1
- package/dist/locale/en-US.modern.js +25 -2
- package/dist/locale/en-US.modern.js.map +1 -1
- package/dist/locale/zh-CN.js +25 -2
- package/dist/locale/zh-CN.js.map +1 -1
- package/dist/locale/zh-CN.modern.js +25 -2
- 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","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-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-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: '添加填写项',
|
|
@@ -89,6 +89,7 @@ const locale$1 = {
|
|
|
89
89
|
blockNameRequired: '请填写保存用的名称',
|
|
90
90
|
blockGap: '间距',
|
|
91
91
|
blockBordered: '显示边框',
|
|
92
|
+
blockShowIndex: '展示题目序号',
|
|
92
93
|
blockImportant: '突出显示',
|
|
93
94
|
blockAddText: '添加按钮文案',
|
|
94
95
|
blockAddTextPlaceholder: '例如:添加一条工作经历',
|
|
@@ -110,6 +111,27 @@ const locale$1 = {
|
|
|
110
111
|
stepNext: '下一步',
|
|
111
112
|
stepComplete: '完成',
|
|
112
113
|
fieldType: '填写项类型',
|
|
114
|
+
FieldGroupBasic: '基础字段',
|
|
115
|
+
FieldGroupSelect: '选择字段',
|
|
116
|
+
FieldGroupAdvancedSelect: '高级选择',
|
|
117
|
+
FieldGroupBusinessSelect: '业务选择',
|
|
118
|
+
FieldGroupExtended: '扩展字段',
|
|
119
|
+
FieldTypeInput: '单行文本',
|
|
120
|
+
FieldTypeTextArea: '多行文本',
|
|
121
|
+
FieldTypeInputNumber: '数字',
|
|
122
|
+
FieldTypeSelect: '下拉选择',
|
|
123
|
+
FieldTypeRadioGroup: '单选组',
|
|
124
|
+
FieldTypeCheckboxGroup: '复选组',
|
|
125
|
+
FieldTypeSuperSelectList: '普通下拉',
|
|
126
|
+
FieldTypeSuperSelectTableList: '表格选择',
|
|
127
|
+
FieldTypeSuperSelectTree: '树形选择',
|
|
128
|
+
FieldTypeSuperSelectCascader: '级联选择',
|
|
129
|
+
FieldTypeSelectFunction: '职能选择',
|
|
130
|
+
FieldTypeSelectIndustry: '行业选择',
|
|
131
|
+
FieldTypeSelectAddress: '地址选择',
|
|
132
|
+
FieldTypeSwitch: '开关',
|
|
133
|
+
FieldTypeCheckbox: '复选框',
|
|
134
|
+
FieldTypeDatePicker: '日期',
|
|
113
135
|
fieldName: '保存用的名称',
|
|
114
136
|
fieldNamePlaceholder: '已自动生成,可修改',
|
|
115
137
|
fieldLabel: '显示名称',
|
|
@@ -156,8 +178,8 @@ const locale$1 = {
|
|
|
156
178
|
optionDescPlaceholder: '补充说明(可选)',
|
|
157
179
|
addOption: '添加一个选项',
|
|
158
180
|
builtinDataHint: '该类型自带数据,无需手动配置选项',
|
|
159
|
-
optionsEditorHint: '
|
|
160
|
-
optionsTreeEditorHint: '
|
|
181
|
+
optionsEditorHint: '显示文字默认同步到对应值,可自行修改;保存时会去掉首尾空格',
|
|
182
|
+
optionsTreeEditorHint: '显示文字默认同步到对应值,可自行修改;点「添加子级」挂下级,左侧竖线表示层级',
|
|
161
183
|
addChildOption: '添加子级',
|
|
162
184
|
fieldColumns: '表格有哪些列',
|
|
163
185
|
columnTitlePlaceholder: '列标题,例如:姓名',
|
|
@@ -209,6 +231,7 @@ const locale$1 = {
|
|
|
209
231
|
propSwitchOffText: '关闭时显示的文字',
|
|
210
232
|
propSwitchOnTextHint: '例如:开',
|
|
211
233
|
propSwitchOffTextHint: '例如:关',
|
|
234
|
+
propOptionsInline: '选项单行显示',
|
|
212
235
|
ruleLen: '长度限制',
|
|
213
236
|
ruleLenRange: '长度范围',
|
|
214
237
|
ruleLenMin: '最少字数',
|
|
@@ -292,6 +315,7 @@ const locale = {
|
|
|
292
315
|
blockNameRequired: 'Please enter a save name',
|
|
293
316
|
blockGap: 'Spacing',
|
|
294
317
|
blockBordered: 'Show Border',
|
|
318
|
+
blockShowIndex: 'Show question numbers',
|
|
295
319
|
blockImportant: 'Highlight',
|
|
296
320
|
blockAddText: 'Add Button Label',
|
|
297
321
|
blockAddTextPlaceholder: 'e.g. Add Work Experience',
|
|
@@ -313,6 +337,27 @@ const locale = {
|
|
|
313
337
|
stepNext: 'Next',
|
|
314
338
|
stepComplete: 'Done',
|
|
315
339
|
fieldType: 'Field Type',
|
|
340
|
+
FieldGroupBasic: 'Basic Fields',
|
|
341
|
+
FieldGroupSelect: 'Select Fields',
|
|
342
|
+
FieldGroupAdvancedSelect: 'Advanced Select',
|
|
343
|
+
FieldGroupBusinessSelect: 'Business Select',
|
|
344
|
+
FieldGroupExtended: 'Extended Fields',
|
|
345
|
+
FieldTypeInput: 'Single-line Text',
|
|
346
|
+
FieldTypeTextArea: 'Multi-line Text',
|
|
347
|
+
FieldTypeInputNumber: 'Number',
|
|
348
|
+
FieldTypeSelect: 'Dropdown',
|
|
349
|
+
FieldTypeRadioGroup: 'Radio Group',
|
|
350
|
+
FieldTypeCheckboxGroup: 'Checkbox Group',
|
|
351
|
+
FieldTypeSuperSelectList: 'Select List',
|
|
352
|
+
FieldTypeSuperSelectTableList: 'Table Select',
|
|
353
|
+
FieldTypeSuperSelectTree: 'Tree Select',
|
|
354
|
+
FieldTypeSuperSelectCascader: 'Cascader',
|
|
355
|
+
FieldTypeSelectFunction: 'Job Function',
|
|
356
|
+
FieldTypeSelectIndustry: 'Industry',
|
|
357
|
+
FieldTypeSelectAddress: 'Address',
|
|
358
|
+
FieldTypeSwitch: 'Switch',
|
|
359
|
+
FieldTypeCheckbox: 'Checkbox',
|
|
360
|
+
FieldTypeDatePicker: 'Date',
|
|
316
361
|
fieldName: 'Save name',
|
|
317
362
|
fieldNamePlaceholder: 'Auto-generated, editable',
|
|
318
363
|
fieldLabel: 'Display Name',
|
|
@@ -359,8 +404,8 @@ const locale = {
|
|
|
359
404
|
optionDescPlaceholder: 'Description (optional)',
|
|
360
405
|
addOption: 'Add Option',
|
|
361
406
|
builtinDataHint: 'This type comes with built-in data, no manual options needed',
|
|
362
|
-
optionsEditorHint: '
|
|
363
|
-
optionsTreeEditorHint: '
|
|
407
|
+
optionsEditorHint: 'Display text syncs to value by default; you can edit value anytime. Leading/trailing spaces are trimmed on save',
|
|
408
|
+
optionsTreeEditorHint: 'Display text syncs to value by default; use “Add Child” for nesting; the left line shows hierarchy',
|
|
364
409
|
addChildOption: 'Add Child',
|
|
365
410
|
fieldColumns: 'Table Columns',
|
|
366
411
|
columnTitlePlaceholder: 'Column title, e.g. Name',
|
|
@@ -412,6 +457,7 @@ const locale = {
|
|
|
412
457
|
propSwitchOffText: 'Text when off',
|
|
413
458
|
propSwitchOnTextHint: 'e.g. On',
|
|
414
459
|
propSwitchOffTextHint: 'e.g. Off',
|
|
460
|
+
propOptionsInline: 'Options in a single row',
|
|
415
461
|
ruleLen: 'Length Limit',
|
|
416
462
|
ruleLenRange: 'Length Range',
|
|
417
463
|
ruleLenMin: 'Min',
|
|
@@ -564,6 +610,7 @@ const createBlock = function (kind, overrides) {
|
|
|
564
610
|
gap: 24,
|
|
565
611
|
bordered: false,
|
|
566
612
|
important: false,
|
|
613
|
+
showIndex: false,
|
|
567
614
|
name: needsName ? createDataKey(kind === 'object' ? 'obj' : 'block') : '',
|
|
568
615
|
label: '',
|
|
569
616
|
addText: '',
|
|
@@ -1276,6 +1323,7 @@ const blockToFormValues = block => ({
|
|
|
1276
1323
|
gap: block.gap ?? 24,
|
|
1277
1324
|
bordered: !!block.bordered,
|
|
1278
1325
|
important: !!block.important,
|
|
1326
|
+
showIndex: !!block.showIndex,
|
|
1279
1327
|
name: block.name || '',
|
|
1280
1328
|
label: block.label || '',
|
|
1281
1329
|
addText: block.addText || '',
|
|
@@ -1302,6 +1350,7 @@ const formValuesToBlock = function (values, existingBlock) {
|
|
|
1302
1350
|
gap: values.gap ?? 24,
|
|
1303
1351
|
bordered: !!values.bordered,
|
|
1304
1352
|
important: !!values.important,
|
|
1353
|
+
showIndex: !!values.showIndex,
|
|
1305
1354
|
name: values.name,
|
|
1306
1355
|
label: values.label,
|
|
1307
1356
|
addText: values.addText || undefined,
|
|
@@ -1588,18 +1637,29 @@ const defineField = (type, definition) => {
|
|
|
1588
1637
|
});
|
|
1589
1638
|
};
|
|
1590
1639
|
const FIELD_GROUPS = [{
|
|
1591
|
-
|
|
1640
|
+
labelId: 'FieldGroupBasic',
|
|
1592
1641
|
types: ['Input', 'TextArea', 'InputNumber', 'Switch', 'Checkbox', 'DatePicker']
|
|
1593
1642
|
}, {
|
|
1594
|
-
|
|
1643
|
+
labelId: 'FieldGroupSelect',
|
|
1595
1644
|
types: ['Select', 'RadioGroup', 'CheckboxGroup']
|
|
1596
1645
|
}, {
|
|
1597
|
-
|
|
1646
|
+
labelId: 'FieldGroupAdvancedSelect',
|
|
1598
1647
|
types: ['SuperSelectList', 'SuperSelectTableList', 'SuperSelectTree', 'SuperSelectCascader']
|
|
1599
1648
|
}, {
|
|
1600
|
-
|
|
1649
|
+
labelId: 'FieldGroupBusinessSelect',
|
|
1601
1650
|
types: ['SelectFunction', 'SelectIndustry', 'SelectAddress']
|
|
1602
1651
|
}];
|
|
1652
|
+
const resolveRegistryLabel = (formatMessage, labelId, fallbackLabel) => {
|
|
1653
|
+
if (typeof formatMessage === 'function' && labelId) {
|
|
1654
|
+
return formatMessage({
|
|
1655
|
+
id: labelId
|
|
1656
|
+
});
|
|
1657
|
+
}
|
|
1658
|
+
if (fallbackLabel != null && String(fallbackLabel).trim()) {
|
|
1659
|
+
return String(fallbackLabel).trim();
|
|
1660
|
+
}
|
|
1661
|
+
return labelId || '';
|
|
1662
|
+
};
|
|
1603
1663
|
const optionEnumValues = field => {
|
|
1604
1664
|
const options = field?.props?.options;
|
|
1605
1665
|
if (!Array.isArray(options) || !options.length) {
|
|
@@ -1660,8 +1720,7 @@ const datePickerValueSchema = field => {
|
|
|
1660
1720
|
return item;
|
|
1661
1721
|
};
|
|
1662
1722
|
defineField('Input', {
|
|
1663
|
-
|
|
1664
|
-
group: '基础字段',
|
|
1723
|
+
labelId: 'FieldTypeInput',
|
|
1665
1724
|
component: reactFormAntd.Input,
|
|
1666
1725
|
defaultProps: {
|
|
1667
1726
|
allowClear: true
|
|
@@ -1672,8 +1731,7 @@ defineField('Input', {
|
|
|
1672
1731
|
}
|
|
1673
1732
|
});
|
|
1674
1733
|
defineField('TextArea', {
|
|
1675
|
-
|
|
1676
|
-
group: '基础字段',
|
|
1734
|
+
labelId: 'FieldTypeTextArea',
|
|
1677
1735
|
component: reactFormAntd.TextArea,
|
|
1678
1736
|
defaultProps: {
|
|
1679
1737
|
rows: 3
|
|
@@ -1687,8 +1745,7 @@ defineField('TextArea', {
|
|
|
1687
1745
|
}
|
|
1688
1746
|
});
|
|
1689
1747
|
defineField('InputNumber', {
|
|
1690
|
-
|
|
1691
|
-
group: '基础字段',
|
|
1748
|
+
labelId: 'FieldTypeInputNumber',
|
|
1692
1749
|
component: reactFormAntd.InputNumber,
|
|
1693
1750
|
defaultProps: {},
|
|
1694
1751
|
hasFieldProps: true,
|
|
@@ -1697,8 +1754,7 @@ defineField('InputNumber', {
|
|
|
1697
1754
|
}
|
|
1698
1755
|
});
|
|
1699
1756
|
defineField('Select', {
|
|
1700
|
-
|
|
1701
|
-
group: '选择字段',
|
|
1757
|
+
labelId: 'FieldTypeSelect',
|
|
1702
1758
|
component: reactFormAntd.Select,
|
|
1703
1759
|
defaultProps: {
|
|
1704
1760
|
options: [],
|
|
@@ -1709,23 +1765,25 @@ defineField('Select', {
|
|
|
1709
1765
|
valueSchema: stringWithEnumSchema
|
|
1710
1766
|
});
|
|
1711
1767
|
defineField('RadioGroup', {
|
|
1712
|
-
|
|
1713
|
-
group: '选择字段',
|
|
1768
|
+
labelId: 'FieldTypeRadioGroup',
|
|
1714
1769
|
component: reactFormAntd.RadioGroup,
|
|
1715
1770
|
defaultProps: {
|
|
1716
|
-
options: []
|
|
1771
|
+
options: [],
|
|
1772
|
+
inline: true
|
|
1717
1773
|
},
|
|
1718
1774
|
hasOptions: true,
|
|
1775
|
+
hasFieldProps: true,
|
|
1719
1776
|
valueSchema: stringWithEnumSchema
|
|
1720
1777
|
});
|
|
1721
1778
|
defineField('CheckboxGroup', {
|
|
1722
|
-
|
|
1723
|
-
group: '选择字段',
|
|
1779
|
+
labelId: 'FieldTypeCheckboxGroup',
|
|
1724
1780
|
component: reactFormAntd.CheckboxGroup,
|
|
1725
1781
|
defaultProps: {
|
|
1726
|
-
options: []
|
|
1782
|
+
options: [],
|
|
1783
|
+
inline: true
|
|
1727
1784
|
},
|
|
1728
1785
|
hasOptions: true,
|
|
1786
|
+
hasFieldProps: true,
|
|
1729
1787
|
valueSchema: field => {
|
|
1730
1788
|
const items = {
|
|
1731
1789
|
type: 'string'
|
|
@@ -1741,8 +1799,7 @@ defineField('CheckboxGroup', {
|
|
|
1741
1799
|
}
|
|
1742
1800
|
});
|
|
1743
1801
|
defineField('SuperSelectList', {
|
|
1744
|
-
|
|
1745
|
-
group: 'SuperSelect',
|
|
1802
|
+
labelId: 'FieldTypeSuperSelectList',
|
|
1746
1803
|
component: SuperSelectList,
|
|
1747
1804
|
defaultProps: {
|
|
1748
1805
|
options: [],
|
|
@@ -1757,8 +1814,7 @@ defineField('SuperSelectList', {
|
|
|
1757
1814
|
valueSchema: superSelectValueSchema
|
|
1758
1815
|
});
|
|
1759
1816
|
defineField('SuperSelectTableList', {
|
|
1760
|
-
|
|
1761
|
-
group: 'SuperSelect',
|
|
1817
|
+
labelId: 'FieldTypeSuperSelectTableList',
|
|
1762
1818
|
component: SuperSelectTableList,
|
|
1763
1819
|
defaultProps: {
|
|
1764
1820
|
options: [],
|
|
@@ -1775,8 +1831,7 @@ defineField('SuperSelectTableList', {
|
|
|
1775
1831
|
valueSchema: superSelectValueSchema
|
|
1776
1832
|
});
|
|
1777
1833
|
defineField('SuperSelectTree', {
|
|
1778
|
-
|
|
1779
|
-
group: 'SuperSelect',
|
|
1834
|
+
labelId: 'FieldTypeSuperSelectTree',
|
|
1780
1835
|
component: SuperSelectTree,
|
|
1781
1836
|
defaultProps: {
|
|
1782
1837
|
options: [],
|
|
@@ -1792,8 +1847,7 @@ defineField('SuperSelectTree', {
|
|
|
1792
1847
|
valueSchema: superSelectValueSchema
|
|
1793
1848
|
});
|
|
1794
1849
|
defineField('SuperSelectCascader', {
|
|
1795
|
-
|
|
1796
|
-
group: 'SuperSelect',
|
|
1850
|
+
labelId: 'FieldTypeSuperSelectCascader',
|
|
1797
1851
|
component: SuperSelectCascader,
|
|
1798
1852
|
defaultProps: {
|
|
1799
1853
|
options: [],
|
|
@@ -1811,8 +1865,7 @@ defineField('SuperSelectCascader', {
|
|
|
1811
1865
|
valueSchema: superSelectValueSchema
|
|
1812
1866
|
});
|
|
1813
1867
|
defineField('SelectFunction', {
|
|
1814
|
-
|
|
1815
|
-
group: 'SuperSelectPlus',
|
|
1868
|
+
labelId: 'FieldTypeSelectFunction',
|
|
1816
1869
|
component: SelectFunctionField,
|
|
1817
1870
|
defaultProps: {
|
|
1818
1871
|
isPopup: true,
|
|
@@ -1823,8 +1876,7 @@ defineField('SelectFunction', {
|
|
|
1823
1876
|
valueSchema: superSelectValueSchema
|
|
1824
1877
|
});
|
|
1825
1878
|
defineField('SelectIndustry', {
|
|
1826
|
-
|
|
1827
|
-
group: 'SuperSelectPlus',
|
|
1879
|
+
labelId: 'FieldTypeSelectIndustry',
|
|
1828
1880
|
component: SelectIndustryField,
|
|
1829
1881
|
defaultProps: {
|
|
1830
1882
|
isPopup: true,
|
|
@@ -1835,8 +1887,7 @@ defineField('SelectIndustry', {
|
|
|
1835
1887
|
valueSchema: superSelectValueSchema
|
|
1836
1888
|
});
|
|
1837
1889
|
defineField('SelectAddress', {
|
|
1838
|
-
|
|
1839
|
-
group: 'SuperSelectPlus',
|
|
1890
|
+
labelId: 'FieldTypeSelectAddress',
|
|
1840
1891
|
component: SelectAddressField,
|
|
1841
1892
|
defaultProps: {
|
|
1842
1893
|
isPopup: true,
|
|
@@ -1847,8 +1898,7 @@ defineField('SelectAddress', {
|
|
|
1847
1898
|
valueSchema: superSelectValueSchema
|
|
1848
1899
|
});
|
|
1849
1900
|
defineField('Switch', {
|
|
1850
|
-
|
|
1851
|
-
group: '基础字段',
|
|
1901
|
+
labelId: 'FieldTypeSwitch',
|
|
1852
1902
|
component: reactFormAntd.Switch,
|
|
1853
1903
|
defaultProps: {},
|
|
1854
1904
|
hasFieldProps: true,
|
|
@@ -1857,8 +1907,7 @@ defineField('Switch', {
|
|
|
1857
1907
|
}
|
|
1858
1908
|
});
|
|
1859
1909
|
defineField('Checkbox', {
|
|
1860
|
-
|
|
1861
|
-
group: '基础字段',
|
|
1910
|
+
labelId: 'FieldTypeCheckbox',
|
|
1862
1911
|
component: reactFormAntd.Checkbox,
|
|
1863
1912
|
defaultProps: {
|
|
1864
1913
|
children: ''
|
|
@@ -1868,8 +1917,7 @@ defineField('Checkbox', {
|
|
|
1868
1917
|
}
|
|
1869
1918
|
});
|
|
1870
1919
|
defineField('DatePicker', {
|
|
1871
|
-
|
|
1872
|
-
group: '基础字段',
|
|
1920
|
+
labelId: 'FieldTypeDatePicker',
|
|
1873
1921
|
component: reactFormAntd.DatePicker,
|
|
1874
1922
|
defaultProps: {
|
|
1875
1923
|
format: 'YYYY-MM-DD',
|
|
@@ -1893,8 +1941,9 @@ defineField('DatePicker', {
|
|
|
1893
1941
|
* - min / max?: number(type=number)
|
|
1894
1942
|
* - options?: { label, value }[](type=select)
|
|
1895
1943
|
*
|
|
1896
|
-
* preset
|
|
1897
|
-
* -
|
|
1944
|
+
* preset / registerField 的 fields 项还可传:
|
|
1945
|
+
* - label / labelId?: 展示名;有 labelId 时随 formatMessage 切换语言
|
|
1946
|
+
* - groupName / groupNameId?: 自定义类型下拉分组;有 groupNameId 时随语言切换;都不传则归入「扩展字段」
|
|
1898
1947
|
* - valueSchema?: object | (field) => object 提交值的 JSON Schema 片段;缺省回退 { type: 'string' }
|
|
1899
1948
|
* 可含 format(date/month/week/time/date-time/password/color/json)与 display(option/phone/file/typed-date-range/date-to-today/html/money),供 SchemaContent 预览
|
|
1900
1949
|
* - formatDisplayValue?: (value, field, ctx) => string 覆盖 valueSchema 默认预览
|
|
@@ -1902,10 +1951,14 @@ defineField('DatePicker', {
|
|
|
1902
1951
|
const registerField = (type, definition) => {
|
|
1903
1952
|
const propsSchema = Array.isArray(definition?.propsSchema) ? definition.propsSchema : undefined;
|
|
1904
1953
|
const groupName = definition?.groupName != null && String(definition.groupName).trim() ? String(definition.groupName).trim() : undefined;
|
|
1954
|
+
const groupNameId = definition?.groupNameId != null && String(definition.groupNameId).trim() ? String(definition.groupNameId).trim() : undefined;
|
|
1955
|
+
const labelId = definition?.labelId != null && String(definition.labelId).trim() ? String(definition.labelId).trim() : undefined;
|
|
1905
1956
|
defineField(type, {
|
|
1906
1957
|
...definition,
|
|
1907
1958
|
propsSchema,
|
|
1908
1959
|
groupName,
|
|
1960
|
+
groupNameId,
|
|
1961
|
+
labelId,
|
|
1909
1962
|
hasFieldProps: definition.hasFieldProps ?? !!(propsSchema && propsSchema.length)
|
|
1910
1963
|
});
|
|
1911
1964
|
};
|
|
@@ -1978,6 +2031,15 @@ const applyFromPropsSchema = function (props, values, propsSchema) {
|
|
|
1978
2031
|
};
|
|
1979
2032
|
const getFieldDefinition = type => registry.get(type);
|
|
1980
2033
|
|
|
2034
|
+
/** 解析字段类型展示名:内置走 labelId;扩展字段可用已翻译的 label */
|
|
2035
|
+
const resolveFieldTypeLabel = (typeOrDefinition, formatMessage) => {
|
|
2036
|
+
const definition = typeof typeOrDefinition === 'string' ? registry.get(typeOrDefinition) : typeOrDefinition;
|
|
2037
|
+
if (!definition) {
|
|
2038
|
+
return typeof typeOrDefinition === 'string' ? typeOrDefinition : '';
|
|
2039
|
+
}
|
|
2040
|
+
return resolveRegistryLabel(formatMessage, definition.labelId, definition.label) || definition.type || '';
|
|
2041
|
+
};
|
|
2042
|
+
|
|
1981
2043
|
/**
|
|
1982
2044
|
* 解析字段提交值的 JSON Schema 片段。
|
|
1983
2045
|
* 优先用 definition.valueSchema(对象或 (field)=>schema);缺省 { type: 'string' }。
|
|
@@ -2031,19 +2093,13 @@ const getFieldComponent = (type, field) => {
|
|
|
2031
2093
|
}
|
|
2032
2094
|
return definition.component;
|
|
2033
2095
|
};
|
|
2034
|
-
const getFieldTypes =
|
|
2096
|
+
const getFieldTypes = formatMessage => {
|
|
2035
2097
|
const grouped = FIELD_GROUPS.map(group => ({
|
|
2036
|
-
label: group.label,
|
|
2037
|
-
options: group.types.map(type => registry.get(type)).filter(Boolean).map(
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
} = _ref;
|
|
2042
|
-
return {
|
|
2043
|
-
label,
|
|
2044
|
-
value: type
|
|
2045
|
-
};
|
|
2046
|
-
})
|
|
2098
|
+
label: resolveRegistryLabel(formatMessage, group.labelId, group.label),
|
|
2099
|
+
options: group.types.map(type => registry.get(type)).filter(Boolean).map(item => ({
|
|
2100
|
+
label: resolveFieldTypeLabel(item, formatMessage),
|
|
2101
|
+
value: item.type
|
|
2102
|
+
}))
|
|
2047
2103
|
}));
|
|
2048
2104
|
const builtinTypes = new Set(FIELD_GROUPS.flatMap(group => group.types));
|
|
2049
2105
|
const registered = Array.from(registry.values()).filter(item => !builtinTypes.has(item.type));
|
|
@@ -2051,20 +2107,29 @@ const getFieldTypes = () => {
|
|
|
2051
2107
|
const fallback = [];
|
|
2052
2108
|
registered.forEach(item => {
|
|
2053
2109
|
const option = {
|
|
2054
|
-
label: item
|
|
2110
|
+
label: resolveFieldTypeLabel(item, formatMessage),
|
|
2055
2111
|
value: item.type
|
|
2056
2112
|
};
|
|
2113
|
+
const groupNameId = item.groupNameId != null && String(item.groupNameId).trim() ? String(item.groupNameId).trim() : '';
|
|
2057
2114
|
const groupName = item.groupName != null && String(item.groupName).trim() ? String(item.groupName).trim() : '';
|
|
2058
|
-
if (!groupName) {
|
|
2115
|
+
if (!groupNameId && !groupName) {
|
|
2059
2116
|
fallback.push(option);
|
|
2060
2117
|
return;
|
|
2061
2118
|
}
|
|
2062
|
-
|
|
2063
|
-
|
|
2119
|
+
const groupKey = groupNameId || groupName;
|
|
2120
|
+
if (!customGroups.has(groupKey)) {
|
|
2121
|
+
customGroups.set(groupKey, {
|
|
2122
|
+
label: resolveRegistryLabel(formatMessage, groupNameId || null, groupName),
|
|
2123
|
+
options: []
|
|
2124
|
+
});
|
|
2064
2125
|
}
|
|
2065
|
-
customGroups.get(
|
|
2126
|
+
customGroups.get(groupKey).options.push(option);
|
|
2066
2127
|
});
|
|
2067
|
-
customGroups.forEach(
|
|
2128
|
+
customGroups.forEach(_ref => {
|
|
2129
|
+
let {
|
|
2130
|
+
label,
|
|
2131
|
+
options
|
|
2132
|
+
} = _ref;
|
|
2068
2133
|
grouped.push({
|
|
2069
2134
|
label,
|
|
2070
2135
|
options
|
|
@@ -2072,7 +2137,7 @@ const getFieldTypes = () => {
|
|
|
2072
2137
|
});
|
|
2073
2138
|
if (fallback.length) {
|
|
2074
2139
|
grouped.push({
|
|
2075
|
-
label: '扩展字段',
|
|
2140
|
+
label: resolveRegistryLabel(formatMessage, 'FieldGroupExtended', '扩展字段'),
|
|
2076
2141
|
options: fallback
|
|
2077
2142
|
});
|
|
2078
2143
|
}
|
|
@@ -2088,16 +2153,21 @@ const normalizeOptions = function (options, _temp) {
|
|
|
2088
2153
|
}
|
|
2089
2154
|
const columnNames = (columns || []).map(item => item?.name).filter(Boolean);
|
|
2090
2155
|
return options.map(item => {
|
|
2156
|
+
const label = String(item?.label ?? '').trim();
|
|
2157
|
+
let value = String(item?.value ?? '').trim();
|
|
2158
|
+
if (!value && label) {
|
|
2159
|
+
value = label;
|
|
2160
|
+
}
|
|
2091
2161
|
const next = {
|
|
2092
|
-
label
|
|
2093
|
-
value
|
|
2094
|
-
description: item?.description ?? ''
|
|
2162
|
+
label,
|
|
2163
|
+
value,
|
|
2164
|
+
description: String(item?.description ?? '').trim()
|
|
2095
2165
|
};
|
|
2096
2166
|
columnNames.forEach(name => {
|
|
2097
2167
|
next[name] = item?.[name] ?? '';
|
|
2098
2168
|
});
|
|
2099
2169
|
if (!String(next.label).trim() && columnNames[0] && String(next[columnNames[0]] || '').trim()) {
|
|
2100
|
-
next.label = String(next[columnNames[0]]);
|
|
2170
|
+
next.label = String(next[columnNames[0]]).trim();
|
|
2101
2171
|
}
|
|
2102
2172
|
if (!String(next.value).trim() && String(next.label).trim()) {
|
|
2103
2173
|
next.value = next.label;
|
|
@@ -2249,6 +2319,11 @@ const pickFieldProps = (field, definition) => {
|
|
|
2249
2319
|
checkedChildren: props.checkedChildren || '',
|
|
2250
2320
|
unCheckedChildren: props.unCheckedChildren || ''
|
|
2251
2321
|
};
|
|
2322
|
+
case 'RadioGroup':
|
|
2323
|
+
case 'CheckboxGroup':
|
|
2324
|
+
return {
|
|
2325
|
+
inline: props.inline !== false
|
|
2326
|
+
};
|
|
2252
2327
|
default:
|
|
2253
2328
|
if (definition?.propsSchema?.length) {
|
|
2254
2329
|
return pickFromPropsSchema(props, definition.propsSchema, definition.defaultProps || {});
|
|
@@ -2315,6 +2390,11 @@ const applyFieldProps = (props, values, definition) => {
|
|
|
2315
2390
|
setOptionalString(props, 'checkedChildren', values.checkedChildren);
|
|
2316
2391
|
setOptionalString(props, 'unCheckedChildren', values.unCheckedChildren);
|
|
2317
2392
|
break;
|
|
2393
|
+
case 'RadioGroup':
|
|
2394
|
+
case 'CheckboxGroup':
|
|
2395
|
+
// 始终落盘布尔值,避免 Checkbox 未勾选时字段缺失被当成默认单行
|
|
2396
|
+
props.inline = values.inline !== false;
|
|
2397
|
+
break;
|
|
2318
2398
|
default:
|
|
2319
2399
|
if (definition?.propsSchema?.length) {
|
|
2320
2400
|
applyFromPropsSchema(props, values, definition.propsSchema);
|
|
@@ -2448,7 +2528,7 @@ const FieldRow = ({
|
|
|
2448
2528
|
}), /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
|
|
2449
2529
|
bordered: false,
|
|
2450
2530
|
color: TYPE_TAG_COLORS[field.type] || 'default',
|
|
2451
|
-
children: definition
|
|
2531
|
+
children: resolveFieldTypeLabel(definition || field.type, formatMessage)
|
|
2452
2532
|
}), field.hidden ? /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
|
|
2453
2533
|
bordered: false,
|
|
2454
2534
|
children: formatMessage({
|
|
@@ -3053,7 +3133,7 @@ const BlockListPanel = _ref3 => {
|
|
|
3053
3133
|
}) : block.kind === 'multiField' ? formatMessage({
|
|
3054
3134
|
id: 'multiFieldSummary'
|
|
3055
3135
|
}, {
|
|
3056
|
-
type: block.fieldType
|
|
3136
|
+
type: resolveFieldTypeLabel(block.fieldType, formatMessage)
|
|
3057
3137
|
}) : block.kind === 'choice' ? formatMessage({
|
|
3058
3138
|
id: 'choiceOptionCount'
|
|
3059
3139
|
}, {
|
|
@@ -3077,7 +3157,9 @@ const BlockListPanel = _ref3 => {
|
|
|
3077
3157
|
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
|
|
3078
3158
|
bordered: false,
|
|
3079
3159
|
color: definition?.color || 'default',
|
|
3080
|
-
children:
|
|
3160
|
+
children: formatMessage({
|
|
3161
|
+
id: `blockKind_${block.kind}`
|
|
3162
|
+
})
|
|
3081
3163
|
}), /*#__PURE__*/jsxRuntime.jsx(Text$3, {
|
|
3082
3164
|
strong: true,
|
|
3083
3165
|
ellipsis: true,
|
|
@@ -3196,7 +3278,7 @@ const BlockConfigFields = _ref => {
|
|
|
3196
3278
|
formatMessage
|
|
3197
3279
|
} = reactIntl.useIntl();
|
|
3198
3280
|
const definition = getBlockDefinition(kind);
|
|
3199
|
-
const fieldTypeOptions = react.useMemo(() => getFieldTypes(), []);
|
|
3281
|
+
const fieldTypeOptions = react.useMemo(() => getFieldTypes(formatMessage), [formatMessage]);
|
|
3200
3282
|
const list = [];
|
|
3201
3283
|
if (kind === 'formInfo' || kind === 'list' || kind === 'tableList' || kind === 'object') {
|
|
3202
3284
|
list.push(/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
|
|
@@ -3243,7 +3325,12 @@ const BlockConfigFields = _ref => {
|
|
|
3243
3325
|
children: formatMessage({
|
|
3244
3326
|
id: 'blockBordered'
|
|
3245
3327
|
})
|
|
3246
|
-
}, "bordered"), kind === '
|
|
3328
|
+
}, "bordered"), kind === 'formInfo' ? /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
3329
|
+
name: "showIndex",
|
|
3330
|
+
children: formatMessage({
|
|
3331
|
+
id: 'blockShowIndex'
|
|
3332
|
+
})
|
|
3333
|
+
}, "showIndex") : null, kind === 'list' ? /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
3247
3334
|
name: "important",
|
|
3248
3335
|
children: formatMessage({
|
|
3249
3336
|
id: 'blockImportant'
|
|
@@ -3326,20 +3413,26 @@ const BlockConfigFields = _ref => {
|
|
|
3326
3413
|
} = _ref3;
|
|
3327
3414
|
return openApi?.data?.mode === 'multiple';
|
|
3328
3415
|
}
|
|
3329
|
-
}, "maxLength"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.
|
|
3416
|
+
}, "maxLength"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
3417
|
+
name: "selectorInData",
|
|
3418
|
+
children: formatMessage({
|
|
3419
|
+
id: 'choiceSelectorInData'
|
|
3420
|
+
})
|
|
3421
|
+
}, "selectorInData"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
|
|
3330
3422
|
name: "selectorName",
|
|
3331
3423
|
label: formatMessage({
|
|
3332
3424
|
id: 'choiceSelectorName'
|
|
3333
3425
|
}),
|
|
3334
3426
|
placeholder: formatMessage({
|
|
3335
3427
|
id: 'choiceSelectorNamePlaceholder'
|
|
3336
|
-
})
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3428
|
+
}),
|
|
3429
|
+
display: _ref4 => {
|
|
3430
|
+
let {
|
|
3431
|
+
openApi
|
|
3432
|
+
} = _ref4;
|
|
3433
|
+
return openApi?.data?.selectorInData !== false;
|
|
3434
|
+
}
|
|
3435
|
+
}, "selectorName"));
|
|
3343
3436
|
}
|
|
3344
3437
|
if (kind === 'multiField') {
|
|
3345
3438
|
list.push(/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
|
|
@@ -3409,21 +3502,23 @@ const BlockConfigFields = _ref => {
|
|
|
3409
3502
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3410
3503
|
className: style['field-editor-form'],
|
|
3411
3504
|
children: /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
|
|
3412
|
-
title:
|
|
3505
|
+
title: formatMessage({
|
|
3506
|
+
id: `blockKind_${kind}`
|
|
3507
|
+
}),
|
|
3413
3508
|
subtitle: definition?.description,
|
|
3414
3509
|
column: 1,
|
|
3415
3510
|
list: list.filter(Boolean)
|
|
3416
3511
|
})
|
|
3417
3512
|
});
|
|
3418
3513
|
};
|
|
3419
|
-
const BlockEditorModal =
|
|
3514
|
+
const BlockEditorModal = _ref5 => {
|
|
3420
3515
|
let {
|
|
3421
3516
|
open,
|
|
3422
3517
|
block,
|
|
3423
3518
|
onCancel,
|
|
3424
3519
|
onSave,
|
|
3425
3520
|
renderModal
|
|
3426
|
-
} =
|
|
3521
|
+
} = _ref5;
|
|
3427
3522
|
const {
|
|
3428
3523
|
formatMessage
|
|
3429
3524
|
} = reactIntl.useIntl();
|
|
@@ -3662,6 +3757,31 @@ const EMPTY_OPTION = () => ({
|
|
|
3662
3757
|
label: '',
|
|
3663
3758
|
value: ''
|
|
3664
3759
|
});
|
|
3760
|
+
|
|
3761
|
+
/** value 为空或仍等于当前 label 时视为联动中,改 label 会同步 value */
|
|
3762
|
+
const isOptionValueLinked = (label, value) => {
|
|
3763
|
+
const labelText = label == null ? '' : String(label);
|
|
3764
|
+
const valueText = value == null ? '' : String(value);
|
|
3765
|
+
return valueText === '' || valueText === labelText;
|
|
3766
|
+
};
|
|
3767
|
+
const patchOptionLabelChange = (item, nextLabel) => {
|
|
3768
|
+
const patch = {
|
|
3769
|
+
label: nextLabel
|
|
3770
|
+
};
|
|
3771
|
+
if (isOptionValueLinked(item.label, item.value)) {
|
|
3772
|
+
patch.value = nextLabel;
|
|
3773
|
+
}
|
|
3774
|
+
return patch;
|
|
3775
|
+
};
|
|
3776
|
+
const trimOptionLabelValue = item => {
|
|
3777
|
+
const label = String(item?.label ?? '').trim();
|
|
3778
|
+
const rawValue = String(item?.value ?? '').trim();
|
|
3779
|
+
const linked = isOptionValueLinked(item?.label, item?.value) || rawValue === '' || rawValue === label;
|
|
3780
|
+
return {
|
|
3781
|
+
label,
|
|
3782
|
+
value: linked ? label : rawValue
|
|
3783
|
+
};
|
|
3784
|
+
};
|
|
3665
3785
|
const createEmptyTableRow = columns => {
|
|
3666
3786
|
const row = {
|
|
3667
3787
|
label: '',
|
|
@@ -3709,9 +3829,8 @@ const FlatOptionRows = ({
|
|
|
3709
3829
|
placeholder: formatMessage({
|
|
3710
3830
|
id: 'optionLabelPlaceholder'
|
|
3711
3831
|
}),
|
|
3712
|
-
onChange: event => updateItem(index,
|
|
3713
|
-
|
|
3714
|
-
})
|
|
3832
|
+
onChange: event => updateItem(index, patchOptionLabelChange(item, event.target.value)),
|
|
3833
|
+
onBlur: () => updateItem(index, trimOptionLabelValue(item))
|
|
3715
3834
|
}), /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
|
|
3716
3835
|
value: item.value,
|
|
3717
3836
|
placeholder: formatMessage({
|
|
@@ -3719,6 +3838,9 @@ const FlatOptionRows = ({
|
|
|
3719
3838
|
}),
|
|
3720
3839
|
onChange: event => updateItem(index, {
|
|
3721
3840
|
value: event.target.value
|
|
3841
|
+
}),
|
|
3842
|
+
onBlur: () => updateItem(index, {
|
|
3843
|
+
value: String(item.value ?? '').trim()
|
|
3722
3844
|
})
|
|
3723
3845
|
}), allowDescription ? /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
|
|
3724
3846
|
value: item.description || '',
|
|
@@ -3727,6 +3849,9 @@ const FlatOptionRows = ({
|
|
|
3727
3849
|
}),
|
|
3728
3850
|
onChange: event => updateItem(index, {
|
|
3729
3851
|
description: event.target.value
|
|
3852
|
+
}),
|
|
3853
|
+
onBlur: () => updateItem(index, {
|
|
3854
|
+
description: String(item.description ?? '').trim()
|
|
3730
3855
|
})
|
|
3731
3856
|
}) : null, /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
3732
3857
|
type: "text",
|
|
@@ -3803,9 +3928,8 @@ const TreeOptionNode = ({
|
|
|
3803
3928
|
placeholder: formatMessage({
|
|
3804
3929
|
id: 'optionLabelPlaceholder'
|
|
3805
3930
|
}),
|
|
3806
|
-
onChange: e => updateSelf(
|
|
3807
|
-
|
|
3808
|
-
})
|
|
3931
|
+
onChange: e => updateSelf(patchOptionLabelChange(item, e.target.value)),
|
|
3932
|
+
onBlur: () => updateSelf(trimOptionLabelValue(item))
|
|
3809
3933
|
}), /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
|
|
3810
3934
|
value: item.value,
|
|
3811
3935
|
placeholder: formatMessage({
|
|
@@ -3813,6 +3937,9 @@ const TreeOptionNode = ({
|
|
|
3813
3937
|
}),
|
|
3814
3938
|
onChange: e => updateSelf({
|
|
3815
3939
|
value: e.target.value
|
|
3940
|
+
}),
|
|
3941
|
+
onBlur: () => updateSelf({
|
|
3942
|
+
value: String(item.value ?? '').trim()
|
|
3816
3943
|
})
|
|
3817
3944
|
}), allowDescription ? /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
|
|
3818
3945
|
value: item.description || '',
|
|
@@ -3821,6 +3948,9 @@ const TreeOptionNode = ({
|
|
|
3821
3948
|
}),
|
|
3822
3949
|
onChange: e => updateSelf({
|
|
3823
3950
|
description: e.target.value
|
|
3951
|
+
}),
|
|
3952
|
+
onBlur: () => updateSelf({
|
|
3953
|
+
description: String(item.description ?? '').trim()
|
|
3824
3954
|
})
|
|
3825
3955
|
}) : null]
|
|
3826
3956
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -4298,7 +4428,7 @@ const SuperSelectPropsEditor = ({
|
|
|
4298
4428
|
};
|
|
4299
4429
|
var SuperSelectPropsEditor$1 = SuperSelectPropsEditor;
|
|
4300
4430
|
|
|
4301
|
-
const BUILTIN_PROP_TYPES = ['Input', 'TextArea', 'InputNumber', 'Select', 'DatePicker', 'Switch'];
|
|
4431
|
+
const BUILTIN_PROP_TYPES = ['Input', 'TextArea', 'InputNumber', 'Select', 'DatePicker', 'Switch', 'RadioGroup', 'CheckboxGroup'];
|
|
4302
4432
|
const buildPropsSchemaList = (schema, formatMessage) => (schema || []).filter(item => item?.name).map(item => {
|
|
4303
4433
|
if (item.type === 'boolean') {
|
|
4304
4434
|
return /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
@@ -4526,6 +4656,14 @@ const buildBuiltinList = (type, formatMessage) => {
|
|
|
4526
4656
|
id: 'propSwitchOffTextHint'
|
|
4527
4657
|
})
|
|
4528
4658
|
}, "unCheckedChildren")];
|
|
4659
|
+
case 'RadioGroup':
|
|
4660
|
+
case 'CheckboxGroup':
|
|
4661
|
+
return [/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
4662
|
+
name: "inline",
|
|
4663
|
+
children: formatMessage({
|
|
4664
|
+
id: 'propOptionsInline'
|
|
4665
|
+
})
|
|
4666
|
+
}, "inline")];
|
|
4529
4667
|
default:
|
|
4530
4668
|
return [];
|
|
4531
4669
|
}
|
|
@@ -4603,7 +4741,7 @@ const FieldConfigFields = _ref => {
|
|
|
4603
4741
|
openApi
|
|
4604
4742
|
} = reactFormAntd.useFormContext();
|
|
4605
4743
|
const [fieldType, setFieldType] = react.useState(initialType);
|
|
4606
|
-
const fieldTypeOptions = react.useMemo(() => getFieldTypes(), []);
|
|
4744
|
+
const fieldTypeOptions = react.useMemo(() => getFieldTypes(formatMessage), [formatMessage]);
|
|
4607
4745
|
const definition = getFieldDefinition(fieldType);
|
|
4608
4746
|
react.useEffect(() => {
|
|
4609
4747
|
setFieldType(initialType);
|
|
@@ -5126,29 +5264,32 @@ const buildMultipleHint = (formatMessage, minLength, maxLength) => {
|
|
|
5126
5264
|
* 外层用 InfoPage.Part 的 title 展示标题。
|
|
5127
5265
|
*/
|
|
5128
5266
|
const ChoiceBlock = ({
|
|
5129
|
-
|
|
5267
|
+
schemaBlock,
|
|
5268
|
+
block: blockProp,
|
|
5130
5269
|
preview = false,
|
|
5131
5270
|
isMobile = false,
|
|
5132
5271
|
isPartRoot = false,
|
|
5133
5272
|
formatMessage,
|
|
5134
5273
|
renderOptionContent
|
|
5135
5274
|
}) => {
|
|
5136
|
-
|
|
5137
|
-
const
|
|
5138
|
-
const
|
|
5275
|
+
// schema 配置用 schemaBlock;兼容旧 prop 名 block(且忽略 withBlockLayout 写入的 boolean true)
|
|
5276
|
+
const block = schemaBlock && typeof schemaBlock === 'object' ? schemaBlock : blockProp && typeof blockProp === 'object' ? blockProp : null;
|
|
5277
|
+
const mode = block?.mode === 'multiple' ? 'multiple' : 'single';
|
|
5278
|
+
const selectorName = block ? resolveSelectorName(block) : '';
|
|
5279
|
+
const options = react.useMemo(() => block && Array.isArray(block.options) ? block.options : [], [block]);
|
|
5139
5280
|
const {
|
|
5140
5281
|
formData,
|
|
5141
5282
|
openApi
|
|
5142
5283
|
} = reactFormAntd.useFormContext() || {};
|
|
5143
|
-
const titleText = block
|
|
5284
|
+
const titleText = block?.title != null ? String(block.title).trim() : '';
|
|
5144
5285
|
const title = titleText || (formatMessage ? formatMessage({
|
|
5145
5286
|
id: 'choiceAreaTitle'
|
|
5146
5287
|
}) : '请选择');
|
|
5147
|
-
const bordered = isMobile ? false : block
|
|
5288
|
+
const bordered = isMobile ? false : block?.bordered || undefined;
|
|
5148
5289
|
const {
|
|
5149
5290
|
minLength,
|
|
5150
5291
|
maxLength
|
|
5151
|
-
} = mode === 'multiple' ? resolveSelectLimits(block) : {};
|
|
5292
|
+
} = mode === 'multiple' && block ? resolveSelectLimits(block) : {};
|
|
5152
5293
|
const firstOptionId = options[0] != null ? String(options[0].id) : undefined;
|
|
5153
5294
|
const rawValue = getByPath$1(formData || {}, selectorName);
|
|
5154
5295
|
// 仅随 selector 值变化;勿依赖整个 formData,否则清空未选支字段会触发 options 重算 → CheckboxGroup 死循环
|
|
@@ -5274,6 +5415,9 @@ const ChoiceBlock = ({
|
|
|
5274
5415
|
const modeHint = mode === 'multiple' ? buildMultipleHint(formatMessage, minLength, maxLength) : formatMessage ? formatMessage({
|
|
5275
5416
|
id: 'choiceModeHintSingle'
|
|
5276
5417
|
}) : '请选择其中一项';
|
|
5418
|
+
if (!block) {
|
|
5419
|
+
return null;
|
|
5420
|
+
}
|
|
5277
5421
|
return /*#__PURE__*/react.createElement(InfoPage__default["default"].Part, {
|
|
5278
5422
|
title,
|
|
5279
5423
|
subtitle: modeHint,
|
|
@@ -5307,14 +5451,33 @@ const resolvePartRootClassName = function (depth) {
|
|
|
5307
5451
|
const names = [depth === 0 ? InfoPage__default["default"].partRootClassName : null, ...[].slice.call(arguments, 1)].filter(Boolean);
|
|
5308
5452
|
return names.length ? names.join(' ') : undefined;
|
|
5309
5453
|
};
|
|
5454
|
+
const buildFieldLabel = field => {
|
|
5455
|
+
const base = field?.label != null && String(field.label).trim() ? String(field.label).trim() : field?.name || '';
|
|
5456
|
+
return base || undefined;
|
|
5457
|
+
};
|
|
5458
|
+
const buildIndexedLabelRender = index => {
|
|
5459
|
+
return _ref => {
|
|
5460
|
+
let {
|
|
5461
|
+
label
|
|
5462
|
+
} = _ref;
|
|
5463
|
+
const text = label != null ? String(label).replace(/\u200b/g, '') : '';
|
|
5464
|
+
return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement('span', {
|
|
5465
|
+
className: style['field-label-index']
|
|
5466
|
+
}, `${index + 1}.`), text ? /*#__PURE__*/react.createElement('span', {
|
|
5467
|
+
className: style['field-label-main']
|
|
5468
|
+
}, text) : null);
|
|
5469
|
+
};
|
|
5470
|
+
};
|
|
5310
5471
|
const renderFieldElements = function (fields, preview, _temp) {
|
|
5311
5472
|
if (fields === void 0) {
|
|
5312
5473
|
fields = [];
|
|
5313
5474
|
}
|
|
5314
5475
|
let {
|
|
5315
|
-
namePrefix
|
|
5476
|
+
namePrefix,
|
|
5477
|
+
locale,
|
|
5478
|
+
showIndex = false
|
|
5316
5479
|
} = _temp === void 0 ? {} : _temp;
|
|
5317
|
-
return fields.filter(field => !field.hidden).map(field => {
|
|
5480
|
+
return fields.filter(field => !field.hidden).map((field, index) => {
|
|
5318
5481
|
const Component = getFieldComponent(field.type, field);
|
|
5319
5482
|
if (!Component) {
|
|
5320
5483
|
return null;
|
|
@@ -5331,15 +5494,36 @@ const renderFieldElements = function (fields, preview, _temp) {
|
|
|
5331
5494
|
delete props.placeholder;
|
|
5332
5495
|
}
|
|
5333
5496
|
delete props.range;
|
|
5497
|
+
|
|
5498
|
+
// Radio/Checkbox 选项布局:inline=false 纵向;Radio 用 antd vertical,Checkbox 用样式兜底
|
|
5499
|
+
if (field.type === 'RadioGroup' || field.type === 'CheckboxGroup') {
|
|
5500
|
+
const optionsInline = props.inline !== false;
|
|
5501
|
+
delete props.inline;
|
|
5502
|
+
if (!optionsInline) {
|
|
5503
|
+
if (field.type === 'RadioGroup') {
|
|
5504
|
+
props.vertical = true;
|
|
5505
|
+
}
|
|
5506
|
+
props.className = [props.className, style['option-group-stack']].filter(Boolean).join(' ');
|
|
5507
|
+
}
|
|
5508
|
+
}
|
|
5334
5509
|
const description = field.description != null && String(field.description).trim() ? field.description : undefined;
|
|
5335
5510
|
const fieldName = namePrefix && field.name ? `${namePrefix}.${field.name}` : field.name;
|
|
5511
|
+
// 显式传 locale,避免 Global 仍为 zh-CN 时 react-form-antd withLocale 盖掉父级英文
|
|
5512
|
+
const localeProps = locale ? {
|
|
5513
|
+
locale
|
|
5514
|
+
} : {};
|
|
5515
|
+
const label = buildFieldLabel(field);
|
|
5336
5516
|
return /*#__PURE__*/react.createElement(Component, {
|
|
5337
5517
|
key: field.id,
|
|
5338
5518
|
name: fieldName,
|
|
5339
|
-
label:
|
|
5519
|
+
label: showIndex ? label || '\u200b' : label,
|
|
5520
|
+
...(showIndex ? {
|
|
5521
|
+
labelRender: buildIndexedLabelRender(index)
|
|
5522
|
+
} : null),
|
|
5340
5523
|
rule: field.rule || undefined,
|
|
5341
5524
|
block: field.block || undefined,
|
|
5342
5525
|
...props,
|
|
5526
|
+
...localeProps,
|
|
5343
5527
|
labelTips: buildLabelTips(field.tips),
|
|
5344
5528
|
description
|
|
5345
5529
|
});
|
|
@@ -5349,6 +5533,10 @@ const withBlockLayout = (element, forceBlock) => {
|
|
|
5349
5533
|
if (!element || !forceBlock) {
|
|
5350
5534
|
return element;
|
|
5351
5535
|
}
|
|
5536
|
+
// FormInfo / List 等用 block 表示整行占位;勿覆盖 ChoiceBlock 的 schemaBlock
|
|
5537
|
+
if (element.type === ChoiceBlock$1 || element.props?.schemaBlock) {
|
|
5538
|
+
return element;
|
|
5539
|
+
}
|
|
5352
5540
|
return /*#__PURE__*/react.createElement(element.type, {
|
|
5353
5541
|
...element.props,
|
|
5354
5542
|
key: element.key,
|
|
@@ -5382,7 +5570,8 @@ const renderBlockElement = function (block, preview, ctx) {
|
|
|
5382
5570
|
isMobile = false,
|
|
5383
5571
|
formatMessage,
|
|
5384
5572
|
depth = 0,
|
|
5385
|
-
asListItem = false
|
|
5573
|
+
asListItem = false,
|
|
5574
|
+
locale
|
|
5386
5575
|
} = ctx;
|
|
5387
5576
|
if (!block || depth > MAX_BLOCK_DEPTH) {
|
|
5388
5577
|
return null;
|
|
@@ -5392,6 +5581,9 @@ const renderBlockElement = function (block, preview, ctx) {
|
|
|
5392
5581
|
depth: depth + 1,
|
|
5393
5582
|
asListItem: false
|
|
5394
5583
|
};
|
|
5584
|
+
const fieldRenderOpts = {
|
|
5585
|
+
locale
|
|
5586
|
+
};
|
|
5395
5587
|
const bordered = isMobile ? false : block.bordered || undefined;
|
|
5396
5588
|
// 仅 FormInfo/object 吃列表项 Part 样式;List 等交给 form-info nestDepth
|
|
5397
5589
|
const listItemPartProps = asListItem && isFormInfoLikeBlock(block.kind) ? nestedListItemPartProps : null;
|
|
@@ -5421,7 +5613,11 @@ const renderBlockElement = function (block, preview, ctx) {
|
|
|
5421
5613
|
switch (block.kind) {
|
|
5422
5614
|
case 'formInfo':
|
|
5423
5615
|
{
|
|
5424
|
-
const
|
|
5616
|
+
const showIndex = !!block.showIndex;
|
|
5617
|
+
const fields = renderFieldElements(block.list, preview, {
|
|
5618
|
+
...fieldRenderOpts,
|
|
5619
|
+
showIndex
|
|
5620
|
+
});
|
|
5425
5621
|
const nested = renderChildBlocks(block.blocks || [], nextCtx).map(node => withBlockLayout(node, true));
|
|
5426
5622
|
return withBlockLayout(/*#__PURE__*/react.createElement(FormInfo__default["default"], {
|
|
5427
5623
|
key: block.id,
|
|
@@ -5432,12 +5628,13 @@ const renderBlockElement = function (block, preview, ctx) {
|
|
|
5432
5628
|
bordered,
|
|
5433
5629
|
list: [...fields, ...nested],
|
|
5434
5630
|
...(listItemPartProps || {}),
|
|
5435
|
-
className: resolvePartRootClassName(depth)
|
|
5631
|
+
className: resolvePartRootClassName(depth, showIndex ? style['form-info-show-index'] : null)
|
|
5436
5632
|
}), asListItem);
|
|
5437
5633
|
}
|
|
5438
5634
|
case 'object':
|
|
5439
5635
|
{
|
|
5440
5636
|
const fields = renderFieldElements(block.list, preview, {
|
|
5637
|
+
...fieldRenderOpts,
|
|
5441
5638
|
namePrefix: block.name || ''
|
|
5442
5639
|
});
|
|
5443
5640
|
const nested = renderChildBlocks(block.blocks || [], nextCtx).map(node => withBlockLayout(node, true));
|
|
@@ -5455,7 +5652,7 @@ const renderBlockElement = function (block, preview, ctx) {
|
|
|
5455
5652
|
}
|
|
5456
5653
|
case 'list':
|
|
5457
5654
|
{
|
|
5458
|
-
const fields = renderFieldElements(block.list);
|
|
5655
|
+
const fields = renderFieldElements(block.list, preview, fieldRenderOpts);
|
|
5459
5656
|
const nested = renderItemBlocks(block.itemBlocks || []);
|
|
5460
5657
|
return withBlockLayout(/*#__PURE__*/react.createElement(FormInfo.List, {
|
|
5461
5658
|
key: block.id,
|
|
@@ -5477,7 +5674,7 @@ const renderBlockElement = function (block, preview, ctx) {
|
|
|
5477
5674
|
}
|
|
5478
5675
|
case 'tableList':
|
|
5479
5676
|
{
|
|
5480
|
-
const fields = renderFieldElements(block.list);
|
|
5677
|
+
const fields = renderFieldElements(block.list, preview, fieldRenderOpts);
|
|
5481
5678
|
return withBlockLayout(/*#__PURE__*/react.createElement(FormInfo.TableList, {
|
|
5482
5679
|
key: block.id,
|
|
5483
5680
|
name: block.name,
|
|
@@ -5521,7 +5718,7 @@ const renderBlockElement = function (block, preview, ctx) {
|
|
|
5521
5718
|
prevIcon: /*#__PURE__*/react.createElement(icons.ArrowLeftOutlined),
|
|
5522
5719
|
nextIcon: /*#__PURE__*/react.createElement(icons.ArrowRightOutlined),
|
|
5523
5720
|
items: (block.items || []).map(step => {
|
|
5524
|
-
const fields = renderFieldElements(step.list);
|
|
5721
|
+
const fields = renderFieldElements(step.list, preview, fieldRenderOpts);
|
|
5525
5722
|
const nested = renderChildBlocks(step.blocks || [], nextCtx);
|
|
5526
5723
|
const fieldNames = [...(step.list || []).filter(field => field && !field.hidden && field.name).map(field => field.name), ...collectBlockFieldNames(step.blocks || [])];
|
|
5527
5724
|
if (nested.length) {
|
|
@@ -5555,7 +5752,7 @@ const renderBlockElement = function (block, preview, ctx) {
|
|
|
5555
5752
|
case 'choice':
|
|
5556
5753
|
return withBlockLayout(/*#__PURE__*/react.createElement(ChoiceBlock$1, {
|
|
5557
5754
|
key: block.id,
|
|
5558
|
-
block,
|
|
5755
|
+
schemaBlock: block,
|
|
5559
5756
|
preview,
|
|
5560
5757
|
isMobile,
|
|
5561
5758
|
isPartRoot: depth === 0,
|
|
@@ -5585,6 +5782,7 @@ const renderSchemaInner = function (schema, _temp2) {
|
|
|
5585
5782
|
bodyClassName,
|
|
5586
5783
|
isMobile = false,
|
|
5587
5784
|
formatMessage,
|
|
5785
|
+
locale,
|
|
5588
5786
|
children,
|
|
5589
5787
|
actionNode
|
|
5590
5788
|
} = _temp2 === void 0 ? {} : _temp2;
|
|
@@ -5592,7 +5790,8 @@ const renderSchemaInner = function (schema, _temp2) {
|
|
|
5592
5790
|
const blocks = normalized.blocks || [];
|
|
5593
5791
|
const contentChildren = blocks.map(block => renderBlockElement(block, preview, {
|
|
5594
5792
|
isMobile,
|
|
5595
|
-
formatMessage
|
|
5793
|
+
formatMessage,
|
|
5794
|
+
locale
|
|
5596
5795
|
})).filter(Boolean);
|
|
5597
5796
|
if (!contentChildren.length && !children && !actionNode) {
|
|
5598
5797
|
return null;
|
|
@@ -5613,6 +5812,7 @@ const renderSchemaContent = function (schema, _temp3) {
|
|
|
5613
5812
|
bodyClassName,
|
|
5614
5813
|
isMobile = false,
|
|
5615
5814
|
formatMessage,
|
|
5815
|
+
locale,
|
|
5616
5816
|
children,
|
|
5617
5817
|
actionNode
|
|
5618
5818
|
} = _temp3 === void 0 ? {} : _temp3;
|
|
@@ -5620,7 +5820,8 @@ const renderSchemaContent = function (schema, _temp3) {
|
|
|
5620
5820
|
const blocks = normalized.blocks || [];
|
|
5621
5821
|
const contentChildren = blocks.map(block => renderBlockElement(block, preview, {
|
|
5622
5822
|
isMobile,
|
|
5623
|
-
formatMessage
|
|
5823
|
+
formatMessage,
|
|
5824
|
+
locale
|
|
5624
5825
|
})).filter(Boolean);
|
|
5625
5826
|
if (!contentChildren.length && !children) {
|
|
5626
5827
|
return null;
|
|
@@ -5743,7 +5944,8 @@ const SchemaRendererInner = withLocale$1(props => {
|
|
|
5743
5944
|
buttonFooterProps
|
|
5744
5945
|
} = props;
|
|
5745
5946
|
const {
|
|
5746
|
-
formatMessage
|
|
5947
|
+
formatMessage,
|
|
5948
|
+
locale
|
|
5747
5949
|
} = reactIntl.useIntl();
|
|
5748
5950
|
const isMobile = responsiveUtils.useIsMobile();
|
|
5749
5951
|
const normalized = normalizeSchema(schema);
|
|
@@ -5776,6 +5978,7 @@ const SchemaRendererInner = withLocale$1(props => {
|
|
|
5776
5978
|
bodyClassName,
|
|
5777
5979
|
isMobile,
|
|
5778
5980
|
formatMessage,
|
|
5981
|
+
locale,
|
|
5779
5982
|
children,
|
|
5780
5983
|
actionNode
|
|
5781
5984
|
});
|
|
@@ -5806,7 +6009,8 @@ const SchemaRenderer = withLocale$1(props => {
|
|
|
5806
6009
|
buttonFooterProps
|
|
5807
6010
|
} = props;
|
|
5808
6011
|
const {
|
|
5809
|
-
formatMessage
|
|
6012
|
+
formatMessage,
|
|
6013
|
+
locale
|
|
5810
6014
|
} = reactIntl.useIntl();
|
|
5811
6015
|
const isMobile = responsiveUtils.useIsMobile();
|
|
5812
6016
|
const normalized = normalizeSchema(schema);
|
|
@@ -5840,6 +6044,7 @@ const SchemaRenderer = withLocale$1(props => {
|
|
|
5840
6044
|
bodyClassName,
|
|
5841
6045
|
isMobile,
|
|
5842
6046
|
formatMessage,
|
|
6047
|
+
locale,
|
|
5843
6048
|
children,
|
|
5844
6049
|
actionNode
|
|
5845
6050
|
});
|
|
@@ -5858,7 +6063,8 @@ const FormCreator = withLocale$1(_ref => {
|
|
|
5858
6063
|
extraToolbar
|
|
5859
6064
|
} = _ref;
|
|
5860
6065
|
const {
|
|
5861
|
-
formatMessage
|
|
6066
|
+
formatMessage,
|
|
6067
|
+
locale
|
|
5862
6068
|
} = reactIntl.useIntl();
|
|
5863
6069
|
const isMobile = responsiveUtils.useIsMobile();
|
|
5864
6070
|
const [innerSchema, setInnerSchema] = react.useState(() => normalizeSchema(defaultValue || defaultSchema()));
|
|
@@ -6207,7 +6413,8 @@ const FormCreator = withLocale$1(_ref => {
|
|
|
6207
6413
|
children: hasRenderableContent(schema) ? /*#__PURE__*/jsxRuntime.jsx(SchemaRenderer$1, {
|
|
6208
6414
|
schema: schema,
|
|
6209
6415
|
preview: true,
|
|
6210
|
-
formProps: formProps
|
|
6416
|
+
formProps: formProps,
|
|
6417
|
+
locale: locale
|
|
6211
6418
|
}) : /*#__PURE__*/jsxRuntime.jsx(antd.Empty, {
|
|
6212
6419
|
image: antd.Empty.PRESENTED_IMAGE_SIMPLE,
|
|
6213
6420
|
description: formatMessage({
|
|
@@ -7167,18 +7374,43 @@ const resolveChoiceSelectorName = block => {
|
|
|
7167
7374
|
const formatFieldValue = (field, value, formatMessage) => formatFieldDisplayValue(field, value, {
|
|
7168
7375
|
formatMessage
|
|
7169
7376
|
});
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7377
|
+
|
|
7378
|
+
/**
|
|
7379
|
+
* 问卷题干往往很长:不用 InfoPage Content 的横向 label 列宽对齐(minWidth),
|
|
7380
|
+
* 改为 label 在上、值在下,避免窄栏(如弹窗双栏预览)被撑乱。
|
|
7381
|
+
*/
|
|
7382
|
+
const renderFieldsContent = function (fields, data, formatMessage, column, _temp) {
|
|
7383
|
+
let {
|
|
7384
|
+
showIndex = false
|
|
7385
|
+
} = _temp === void 0 ? {} : _temp;
|
|
7386
|
+
const list = (fields || []).filter(field => field && !field.hidden && field.name).map((field, index) => {
|
|
7387
|
+
const baseLabel = field.label || field.name;
|
|
7388
|
+
const label = showIndex ? `${index + 1}. ${baseLabel}` : baseLabel;
|
|
7389
|
+
return {
|
|
7390
|
+
label,
|
|
7391
|
+
content: formatFieldValue(field, getByPath(data, field.name), formatMessage),
|
|
7392
|
+
block: field.block === true
|
|
7393
|
+
};
|
|
7394
|
+
});
|
|
7176
7395
|
if (!list.length) {
|
|
7177
7396
|
return null;
|
|
7178
7397
|
}
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7398
|
+
const cols = Math.max(1, Number(column) || 2);
|
|
7399
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
7400
|
+
className: style['schema-content-fields'],
|
|
7401
|
+
style: {
|
|
7402
|
+
'--schema-content-cols': cols
|
|
7403
|
+
},
|
|
7404
|
+
children: list.map((item, index) => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
7405
|
+
className: [style['schema-content-field'], item.block ? style['schema-content-field-block'] : null].filter(Boolean).join(' '),
|
|
7406
|
+
children: [item.label ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
7407
|
+
className: style['schema-content-field-label'],
|
|
7408
|
+
children: [item.label, "\uFF1A"]
|
|
7409
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
7410
|
+
className: style['schema-content-field-value'],
|
|
7411
|
+
children: item.content
|
|
7412
|
+
})]
|
|
7413
|
+
}, index))
|
|
7182
7414
|
});
|
|
7183
7415
|
};
|
|
7184
7416
|
const renderBlockList = (blocks, data, ctx) => (blocks || []).map(block => renderBlock(block, data, ctx)).filter(Boolean);
|
|
@@ -7208,7 +7440,9 @@ const renderBlock = (block, data, ctx) => {
|
|
|
7208
7440
|
{
|
|
7209
7441
|
return /*#__PURE__*/jsxRuntime.jsxs(InfoPage__default["default"].Part, {
|
|
7210
7442
|
...partProps,
|
|
7211
|
-
children: [renderFieldsContent(block.list, data, formatMessage, block.column
|
|
7443
|
+
children: [renderFieldsContent(block.list, data, formatMessage, block.column, {
|
|
7444
|
+
showIndex: !!block.showIndex
|
|
7445
|
+
}), renderBlockList(block.blocks, data, nextCtx)]
|
|
7212
7446
|
});
|
|
7213
7447
|
}
|
|
7214
7448
|
case 'object':
|
|
@@ -7253,13 +7487,21 @@ const renderBlock = (block, data, ctx) => {
|
|
|
7253
7487
|
const content = Array.isArray(values) ? values.map(item => formatFieldValue(itemField, item, formatMessage)).join('、') : formatFieldValue(itemField, values, formatMessage);
|
|
7254
7488
|
return /*#__PURE__*/jsxRuntime.jsx(InfoPage__default["default"].Part, {
|
|
7255
7489
|
...partProps,
|
|
7256
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7490
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
7491
|
+
className: style['schema-content-fields'],
|
|
7492
|
+
style: {
|
|
7493
|
+
'--schema-content-cols': 1
|
|
7494
|
+
},
|
|
7495
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
7496
|
+
className: [style['schema-content-field'], style['schema-content-field-block']].join(' '),
|
|
7497
|
+
children: [block.label || block.name ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
7498
|
+
className: style['schema-content-field-label'],
|
|
7499
|
+
children: (block.label || block.name) + ':'
|
|
7500
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
7501
|
+
className: style['schema-content-field-value'],
|
|
7502
|
+
children: content
|
|
7503
|
+
})]
|
|
7504
|
+
})
|
|
7263
7505
|
})
|
|
7264
7506
|
});
|
|
7265
7507
|
}
|
|
@@ -7400,7 +7642,9 @@ exports.parseRuleString = parseRuleString;
|
|
|
7400
7642
|
exports.pickFieldProps = pickFieldProps;
|
|
7401
7643
|
exports.pickFromPropsSchema = pickFromPropsSchema;
|
|
7402
7644
|
exports.preset = preset;
|
|
7645
|
+
exports.registerField = registerField;
|
|
7403
7646
|
exports.removeBlockInTree = removeBlockInTree;
|
|
7647
|
+
exports.resolveFieldTypeLabel = resolveFieldTypeLabel;
|
|
7404
7648
|
exports.resolveFieldValueSchema = resolveFieldValueSchema;
|
|
7405
7649
|
exports.schemaToDataSchema = schemaToDataSchema;
|
|
7406
7650
|
exports.updateBlocks = updateBlocks;
|