@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.modern.js
CHANGED
|
@@ -14,10 +14,10 @@ import '@kne/super-select-plus/dist/index.css';
|
|
|
14
14
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
15
15
|
import FormInfo, { FormModal, Form, Steps, MultiField, TableList, List } from '@kne/form-info';
|
|
16
16
|
import { ButtonFooter } from '@kne/button-group';
|
|
17
|
-
import InfoPage
|
|
17
|
+
import InfoPage from '@kne/info-page';
|
|
18
18
|
import { createWithRemoteLoader } from '@kne/remote-loader';
|
|
19
19
|
|
|
20
|
-
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"};
|
|
20
|
+
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"};
|
|
21
21
|
|
|
22
22
|
function _extends() {
|
|
23
23
|
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
@@ -102,6 +102,7 @@ const locale$1 = {
|
|
|
102
102
|
blockNameRequired: '请填写保存用的名称',
|
|
103
103
|
blockGap: '间距',
|
|
104
104
|
blockBordered: '显示边框',
|
|
105
|
+
blockShowIndex: '展示题目序号',
|
|
105
106
|
blockImportant: '突出显示',
|
|
106
107
|
blockAddText: '添加按钮文案',
|
|
107
108
|
blockAddTextPlaceholder: '例如:添加一条工作经历',
|
|
@@ -123,6 +124,27 @@ const locale$1 = {
|
|
|
123
124
|
stepNext: '下一步',
|
|
124
125
|
stepComplete: '完成',
|
|
125
126
|
fieldType: '填写项类型',
|
|
127
|
+
FieldGroupBasic: '基础字段',
|
|
128
|
+
FieldGroupSelect: '选择字段',
|
|
129
|
+
FieldGroupAdvancedSelect: '高级选择',
|
|
130
|
+
FieldGroupBusinessSelect: '业务选择',
|
|
131
|
+
FieldGroupExtended: '扩展字段',
|
|
132
|
+
FieldTypeInput: '单行文本',
|
|
133
|
+
FieldTypeTextArea: '多行文本',
|
|
134
|
+
FieldTypeInputNumber: '数字',
|
|
135
|
+
FieldTypeSelect: '下拉选择',
|
|
136
|
+
FieldTypeRadioGroup: '单选组',
|
|
137
|
+
FieldTypeCheckboxGroup: '复选组',
|
|
138
|
+
FieldTypeSuperSelectList: '普通下拉',
|
|
139
|
+
FieldTypeSuperSelectTableList: '表格选择',
|
|
140
|
+
FieldTypeSuperSelectTree: '树形选择',
|
|
141
|
+
FieldTypeSuperSelectCascader: '级联选择',
|
|
142
|
+
FieldTypeSelectFunction: '职能选择',
|
|
143
|
+
FieldTypeSelectIndustry: '行业选择',
|
|
144
|
+
FieldTypeSelectAddress: '地址选择',
|
|
145
|
+
FieldTypeSwitch: '开关',
|
|
146
|
+
FieldTypeCheckbox: '复选框',
|
|
147
|
+
FieldTypeDatePicker: '日期',
|
|
126
148
|
fieldName: '保存用的名称',
|
|
127
149
|
fieldNamePlaceholder: '已自动生成,可修改',
|
|
128
150
|
fieldLabel: '显示名称',
|
|
@@ -169,8 +191,8 @@ const locale$1 = {
|
|
|
169
191
|
optionDescPlaceholder: '补充说明(可选)',
|
|
170
192
|
addOption: '添加一个选项',
|
|
171
193
|
builtinDataHint: '该类型自带数据,无需手动配置选项',
|
|
172
|
-
optionsEditorHint: '
|
|
173
|
-
optionsTreeEditorHint: '
|
|
194
|
+
optionsEditorHint: '显示文字默认同步到对应值,可自行修改;保存时会去掉首尾空格',
|
|
195
|
+
optionsTreeEditorHint: '显示文字默认同步到对应值,可自行修改;点「添加子级」挂下级,左侧竖线表示层级',
|
|
174
196
|
addChildOption: '添加子级',
|
|
175
197
|
fieldColumns: '表格有哪些列',
|
|
176
198
|
columnTitlePlaceholder: '列标题,例如:姓名',
|
|
@@ -222,6 +244,7 @@ const locale$1 = {
|
|
|
222
244
|
propSwitchOffText: '关闭时显示的文字',
|
|
223
245
|
propSwitchOnTextHint: '例如:开',
|
|
224
246
|
propSwitchOffTextHint: '例如:关',
|
|
247
|
+
propOptionsInline: '选项单行显示',
|
|
225
248
|
ruleLen: '长度限制',
|
|
226
249
|
ruleLenRange: '长度范围',
|
|
227
250
|
ruleLenMin: '最少字数',
|
|
@@ -305,6 +328,7 @@ const locale = {
|
|
|
305
328
|
blockNameRequired: 'Please enter a save name',
|
|
306
329
|
blockGap: 'Spacing',
|
|
307
330
|
blockBordered: 'Show Border',
|
|
331
|
+
blockShowIndex: 'Show question numbers',
|
|
308
332
|
blockImportant: 'Highlight',
|
|
309
333
|
blockAddText: 'Add Button Label',
|
|
310
334
|
blockAddTextPlaceholder: 'e.g. Add Work Experience',
|
|
@@ -326,6 +350,27 @@ const locale = {
|
|
|
326
350
|
stepNext: 'Next',
|
|
327
351
|
stepComplete: 'Done',
|
|
328
352
|
fieldType: 'Field Type',
|
|
353
|
+
FieldGroupBasic: 'Basic Fields',
|
|
354
|
+
FieldGroupSelect: 'Select Fields',
|
|
355
|
+
FieldGroupAdvancedSelect: 'Advanced Select',
|
|
356
|
+
FieldGroupBusinessSelect: 'Business Select',
|
|
357
|
+
FieldGroupExtended: 'Extended Fields',
|
|
358
|
+
FieldTypeInput: 'Single-line Text',
|
|
359
|
+
FieldTypeTextArea: 'Multi-line Text',
|
|
360
|
+
FieldTypeInputNumber: 'Number',
|
|
361
|
+
FieldTypeSelect: 'Dropdown',
|
|
362
|
+
FieldTypeRadioGroup: 'Radio Group',
|
|
363
|
+
FieldTypeCheckboxGroup: 'Checkbox Group',
|
|
364
|
+
FieldTypeSuperSelectList: 'Select List',
|
|
365
|
+
FieldTypeSuperSelectTableList: 'Table Select',
|
|
366
|
+
FieldTypeSuperSelectTree: 'Tree Select',
|
|
367
|
+
FieldTypeSuperSelectCascader: 'Cascader',
|
|
368
|
+
FieldTypeSelectFunction: 'Job Function',
|
|
369
|
+
FieldTypeSelectIndustry: 'Industry',
|
|
370
|
+
FieldTypeSelectAddress: 'Address',
|
|
371
|
+
FieldTypeSwitch: 'Switch',
|
|
372
|
+
FieldTypeCheckbox: 'Checkbox',
|
|
373
|
+
FieldTypeDatePicker: 'Date',
|
|
329
374
|
fieldName: 'Save name',
|
|
330
375
|
fieldNamePlaceholder: 'Auto-generated, editable',
|
|
331
376
|
fieldLabel: 'Display Name',
|
|
@@ -372,8 +417,8 @@ const locale = {
|
|
|
372
417
|
optionDescPlaceholder: 'Description (optional)',
|
|
373
418
|
addOption: 'Add Option',
|
|
374
419
|
builtinDataHint: 'This type comes with built-in data, no manual options needed',
|
|
375
|
-
optionsEditorHint: '
|
|
376
|
-
optionsTreeEditorHint: '
|
|
420
|
+
optionsEditorHint: 'Display text syncs to value by default; you can edit value anytime. Leading/trailing spaces are trimmed on save',
|
|
421
|
+
optionsTreeEditorHint: 'Display text syncs to value by default; use “Add Child” for nesting; the left line shows hierarchy',
|
|
377
422
|
addChildOption: 'Add Child',
|
|
378
423
|
fieldColumns: 'Table Columns',
|
|
379
424
|
columnTitlePlaceholder: 'Column title, e.g. Name',
|
|
@@ -425,6 +470,7 @@ const locale = {
|
|
|
425
470
|
propSwitchOffText: 'Text when off',
|
|
426
471
|
propSwitchOnTextHint: 'e.g. On',
|
|
427
472
|
propSwitchOffTextHint: 'e.g. Off',
|
|
473
|
+
propOptionsInline: 'Options in a single row',
|
|
428
474
|
ruleLen: 'Length Limit',
|
|
429
475
|
ruleLenRange: 'Length Range',
|
|
430
476
|
ruleLenMin: 'Min',
|
|
@@ -540,6 +586,7 @@ const createBlock = (kind, overrides = {}) => {
|
|
|
540
586
|
gap: 24,
|
|
541
587
|
bordered: false,
|
|
542
588
|
important: false,
|
|
589
|
+
showIndex: false,
|
|
543
590
|
name: needsName ? createDataKey(kind === 'object' ? 'obj' : 'block') : '',
|
|
544
591
|
label: '',
|
|
545
592
|
addText: '',
|
|
@@ -1177,6 +1224,7 @@ const blockToFormValues = block => {
|
|
|
1177
1224
|
gap: (_block$gap = block.gap) != null ? _block$gap : 24,
|
|
1178
1225
|
bordered: !!block.bordered,
|
|
1179
1226
|
important: !!block.important,
|
|
1227
|
+
showIndex: !!block.showIndex,
|
|
1180
1228
|
name: block.name || '',
|
|
1181
1229
|
label: block.label || '',
|
|
1182
1230
|
addText: block.addText || '',
|
|
@@ -1201,6 +1249,7 @@ const formValuesToBlock = (values, existingBlock = {}) => {
|
|
|
1201
1249
|
gap: (_values$gap = values.gap) != null ? _values$gap : 24,
|
|
1202
1250
|
bordered: !!values.bordered,
|
|
1203
1251
|
important: !!values.important,
|
|
1252
|
+
showIndex: !!values.showIndex,
|
|
1204
1253
|
name: values.name,
|
|
1205
1254
|
label: values.label,
|
|
1206
1255
|
addText: values.addText || undefined,
|
|
@@ -1475,18 +1524,29 @@ const defineField = (type, definition) => {
|
|
|
1475
1524
|
}, definition));
|
|
1476
1525
|
};
|
|
1477
1526
|
const FIELD_GROUPS = [{
|
|
1478
|
-
|
|
1527
|
+
labelId: 'FieldGroupBasic',
|
|
1479
1528
|
types: ['Input', 'TextArea', 'InputNumber', 'Switch', 'Checkbox', 'DatePicker']
|
|
1480
1529
|
}, {
|
|
1481
|
-
|
|
1530
|
+
labelId: 'FieldGroupSelect',
|
|
1482
1531
|
types: ['Select', 'RadioGroup', 'CheckboxGroup']
|
|
1483
1532
|
}, {
|
|
1484
|
-
|
|
1533
|
+
labelId: 'FieldGroupAdvancedSelect',
|
|
1485
1534
|
types: ['SuperSelectList', 'SuperSelectTableList', 'SuperSelectTree', 'SuperSelectCascader']
|
|
1486
1535
|
}, {
|
|
1487
|
-
|
|
1536
|
+
labelId: 'FieldGroupBusinessSelect',
|
|
1488
1537
|
types: ['SelectFunction', 'SelectIndustry', 'SelectAddress']
|
|
1489
1538
|
}];
|
|
1539
|
+
const resolveRegistryLabel = (formatMessage, labelId, fallbackLabel) => {
|
|
1540
|
+
if (typeof formatMessage === 'function' && labelId) {
|
|
1541
|
+
return formatMessage({
|
|
1542
|
+
id: labelId
|
|
1543
|
+
});
|
|
1544
|
+
}
|
|
1545
|
+
if (fallbackLabel != null && String(fallbackLabel).trim()) {
|
|
1546
|
+
return String(fallbackLabel).trim();
|
|
1547
|
+
}
|
|
1548
|
+
return labelId || '';
|
|
1549
|
+
};
|
|
1490
1550
|
const optionEnumValues = field => {
|
|
1491
1551
|
var _field$props;
|
|
1492
1552
|
const options = field == null || (_field$props = field.props) == null ? void 0 : _field$props.options;
|
|
@@ -1546,8 +1606,7 @@ const datePickerValueSchema = field => {
|
|
|
1546
1606
|
return item;
|
|
1547
1607
|
};
|
|
1548
1608
|
defineField('Input', {
|
|
1549
|
-
|
|
1550
|
-
group: '基础字段',
|
|
1609
|
+
labelId: 'FieldTypeInput',
|
|
1551
1610
|
component: Input,
|
|
1552
1611
|
defaultProps: {
|
|
1553
1612
|
allowClear: true
|
|
@@ -1558,8 +1617,7 @@ defineField('Input', {
|
|
|
1558
1617
|
}
|
|
1559
1618
|
});
|
|
1560
1619
|
defineField('TextArea', {
|
|
1561
|
-
|
|
1562
|
-
group: '基础字段',
|
|
1620
|
+
labelId: 'FieldTypeTextArea',
|
|
1563
1621
|
component: TextArea,
|
|
1564
1622
|
defaultProps: {
|
|
1565
1623
|
rows: 3
|
|
@@ -1573,8 +1631,7 @@ defineField('TextArea', {
|
|
|
1573
1631
|
}
|
|
1574
1632
|
});
|
|
1575
1633
|
defineField('InputNumber', {
|
|
1576
|
-
|
|
1577
|
-
group: '基础字段',
|
|
1634
|
+
labelId: 'FieldTypeInputNumber',
|
|
1578
1635
|
component: InputNumber,
|
|
1579
1636
|
defaultProps: {},
|
|
1580
1637
|
hasFieldProps: true,
|
|
@@ -1583,8 +1640,7 @@ defineField('InputNumber', {
|
|
|
1583
1640
|
}
|
|
1584
1641
|
});
|
|
1585
1642
|
defineField('Select', {
|
|
1586
|
-
|
|
1587
|
-
group: '选择字段',
|
|
1643
|
+
labelId: 'FieldTypeSelect',
|
|
1588
1644
|
component: Select,
|
|
1589
1645
|
defaultProps: {
|
|
1590
1646
|
options: [],
|
|
@@ -1595,23 +1651,25 @@ defineField('Select', {
|
|
|
1595
1651
|
valueSchema: stringWithEnumSchema
|
|
1596
1652
|
});
|
|
1597
1653
|
defineField('RadioGroup', {
|
|
1598
|
-
|
|
1599
|
-
group: '选择字段',
|
|
1654
|
+
labelId: 'FieldTypeRadioGroup',
|
|
1600
1655
|
component: RadioGroup,
|
|
1601
1656
|
defaultProps: {
|
|
1602
|
-
options: []
|
|
1657
|
+
options: [],
|
|
1658
|
+
inline: true
|
|
1603
1659
|
},
|
|
1604
1660
|
hasOptions: true,
|
|
1661
|
+
hasFieldProps: true,
|
|
1605
1662
|
valueSchema: stringWithEnumSchema
|
|
1606
1663
|
});
|
|
1607
1664
|
defineField('CheckboxGroup', {
|
|
1608
|
-
|
|
1609
|
-
group: '选择字段',
|
|
1665
|
+
labelId: 'FieldTypeCheckboxGroup',
|
|
1610
1666
|
component: CheckboxGroup,
|
|
1611
1667
|
defaultProps: {
|
|
1612
|
-
options: []
|
|
1668
|
+
options: [],
|
|
1669
|
+
inline: true
|
|
1613
1670
|
},
|
|
1614
1671
|
hasOptions: true,
|
|
1672
|
+
hasFieldProps: true,
|
|
1615
1673
|
valueSchema: field => {
|
|
1616
1674
|
const items = {
|
|
1617
1675
|
type: 'string'
|
|
@@ -1627,8 +1685,7 @@ defineField('CheckboxGroup', {
|
|
|
1627
1685
|
}
|
|
1628
1686
|
});
|
|
1629
1687
|
defineField('SuperSelectList', {
|
|
1630
|
-
|
|
1631
|
-
group: 'SuperSelect',
|
|
1688
|
+
labelId: 'FieldTypeSuperSelectList',
|
|
1632
1689
|
component: SuperSelectList,
|
|
1633
1690
|
defaultProps: {
|
|
1634
1691
|
options: [],
|
|
@@ -1643,8 +1700,7 @@ defineField('SuperSelectList', {
|
|
|
1643
1700
|
valueSchema: superSelectValueSchema
|
|
1644
1701
|
});
|
|
1645
1702
|
defineField('SuperSelectTableList', {
|
|
1646
|
-
|
|
1647
|
-
group: 'SuperSelect',
|
|
1703
|
+
labelId: 'FieldTypeSuperSelectTableList',
|
|
1648
1704
|
component: SuperSelectTableList,
|
|
1649
1705
|
defaultProps: {
|
|
1650
1706
|
options: [],
|
|
@@ -1661,8 +1717,7 @@ defineField('SuperSelectTableList', {
|
|
|
1661
1717
|
valueSchema: superSelectValueSchema
|
|
1662
1718
|
});
|
|
1663
1719
|
defineField('SuperSelectTree', {
|
|
1664
|
-
|
|
1665
|
-
group: 'SuperSelect',
|
|
1720
|
+
labelId: 'FieldTypeSuperSelectTree',
|
|
1666
1721
|
component: SuperSelectTree,
|
|
1667
1722
|
defaultProps: {
|
|
1668
1723
|
options: [],
|
|
@@ -1678,8 +1733,7 @@ defineField('SuperSelectTree', {
|
|
|
1678
1733
|
valueSchema: superSelectValueSchema
|
|
1679
1734
|
});
|
|
1680
1735
|
defineField('SuperSelectCascader', {
|
|
1681
|
-
|
|
1682
|
-
group: 'SuperSelect',
|
|
1736
|
+
labelId: 'FieldTypeSuperSelectCascader',
|
|
1683
1737
|
component: SuperSelectCascader,
|
|
1684
1738
|
defaultProps: {
|
|
1685
1739
|
options: [],
|
|
@@ -1697,8 +1751,7 @@ defineField('SuperSelectCascader', {
|
|
|
1697
1751
|
valueSchema: superSelectValueSchema
|
|
1698
1752
|
});
|
|
1699
1753
|
defineField('SelectFunction', {
|
|
1700
|
-
|
|
1701
|
-
group: 'SuperSelectPlus',
|
|
1754
|
+
labelId: 'FieldTypeSelectFunction',
|
|
1702
1755
|
component: SelectFunctionField,
|
|
1703
1756
|
defaultProps: {
|
|
1704
1757
|
isPopup: true,
|
|
@@ -1709,8 +1762,7 @@ defineField('SelectFunction', {
|
|
|
1709
1762
|
valueSchema: superSelectValueSchema
|
|
1710
1763
|
});
|
|
1711
1764
|
defineField('SelectIndustry', {
|
|
1712
|
-
|
|
1713
|
-
group: 'SuperSelectPlus',
|
|
1765
|
+
labelId: 'FieldTypeSelectIndustry',
|
|
1714
1766
|
component: SelectIndustryField,
|
|
1715
1767
|
defaultProps: {
|
|
1716
1768
|
isPopup: true,
|
|
@@ -1721,8 +1773,7 @@ defineField('SelectIndustry', {
|
|
|
1721
1773
|
valueSchema: superSelectValueSchema
|
|
1722
1774
|
});
|
|
1723
1775
|
defineField('SelectAddress', {
|
|
1724
|
-
|
|
1725
|
-
group: 'SuperSelectPlus',
|
|
1776
|
+
labelId: 'FieldTypeSelectAddress',
|
|
1726
1777
|
component: SelectAddressField,
|
|
1727
1778
|
defaultProps: {
|
|
1728
1779
|
isPopup: true,
|
|
@@ -1733,8 +1784,7 @@ defineField('SelectAddress', {
|
|
|
1733
1784
|
valueSchema: superSelectValueSchema
|
|
1734
1785
|
});
|
|
1735
1786
|
defineField('Switch', {
|
|
1736
|
-
|
|
1737
|
-
group: '基础字段',
|
|
1787
|
+
labelId: 'FieldTypeSwitch',
|
|
1738
1788
|
component: Switch,
|
|
1739
1789
|
defaultProps: {},
|
|
1740
1790
|
hasFieldProps: true,
|
|
@@ -1743,8 +1793,7 @@ defineField('Switch', {
|
|
|
1743
1793
|
}
|
|
1744
1794
|
});
|
|
1745
1795
|
defineField('Checkbox', {
|
|
1746
|
-
|
|
1747
|
-
group: '基础字段',
|
|
1796
|
+
labelId: 'FieldTypeCheckbox',
|
|
1748
1797
|
component: Checkbox,
|
|
1749
1798
|
defaultProps: {
|
|
1750
1799
|
children: ''
|
|
@@ -1754,8 +1803,7 @@ defineField('Checkbox', {
|
|
|
1754
1803
|
}
|
|
1755
1804
|
});
|
|
1756
1805
|
defineField('DatePicker', {
|
|
1757
|
-
|
|
1758
|
-
group: '基础字段',
|
|
1806
|
+
labelId: 'FieldTypeDatePicker',
|
|
1759
1807
|
component: DatePicker,
|
|
1760
1808
|
defaultProps: {
|
|
1761
1809
|
format: 'YYYY-MM-DD',
|
|
@@ -1779,8 +1827,9 @@ defineField('DatePicker', {
|
|
|
1779
1827
|
* - min / max?: number(type=number)
|
|
1780
1828
|
* - options?: { label, value }[](type=select)
|
|
1781
1829
|
*
|
|
1782
|
-
* preset
|
|
1783
|
-
* -
|
|
1830
|
+
* preset / registerField 的 fields 项还可传:
|
|
1831
|
+
* - label / labelId?: 展示名;有 labelId 时随 formatMessage 切换语言
|
|
1832
|
+
* - groupName / groupNameId?: 自定义类型下拉分组;有 groupNameId 时随语言切换;都不传则归入「扩展字段」
|
|
1784
1833
|
* - valueSchema?: object | (field) => object 提交值的 JSON Schema 片段;缺省回退 { type: 'string' }
|
|
1785
1834
|
* 可含 format(date/month/week/time/date-time/password/color/json)与 display(option/phone/file/typed-date-range/date-to-today/html/money),供 SchemaContent 预览
|
|
1786
1835
|
* - formatDisplayValue?: (value, field, ctx) => string 覆盖 valueSchema 默认预览
|
|
@@ -1789,9 +1838,13 @@ const registerField = (type, definition) => {
|
|
|
1789
1838
|
var _definition$hasFieldP;
|
|
1790
1839
|
const propsSchema = Array.isArray(definition == null ? void 0 : definition.propsSchema) ? definition.propsSchema : undefined;
|
|
1791
1840
|
const groupName = (definition == null ? void 0 : definition.groupName) != null && String(definition.groupName).trim() ? String(definition.groupName).trim() : undefined;
|
|
1841
|
+
const groupNameId = (definition == null ? void 0 : definition.groupNameId) != null && String(definition.groupNameId).trim() ? String(definition.groupNameId).trim() : undefined;
|
|
1842
|
+
const labelId = (definition == null ? void 0 : definition.labelId) != null && String(definition.labelId).trim() ? String(definition.labelId).trim() : undefined;
|
|
1792
1843
|
defineField(type, _extends({}, definition, {
|
|
1793
1844
|
propsSchema,
|
|
1794
1845
|
groupName,
|
|
1846
|
+
groupNameId,
|
|
1847
|
+
labelId,
|
|
1795
1848
|
hasFieldProps: (_definition$hasFieldP = definition.hasFieldProps) != null ? _definition$hasFieldP : !!(propsSchema && propsSchema.length)
|
|
1796
1849
|
}));
|
|
1797
1850
|
};
|
|
@@ -1849,6 +1902,15 @@ const applyFromPropsSchema = (props, values = {}, propsSchema = []) => {
|
|
|
1849
1902
|
};
|
|
1850
1903
|
const getFieldDefinition = type => registry.get(type);
|
|
1851
1904
|
|
|
1905
|
+
/** 解析字段类型展示名:内置走 labelId;扩展字段可用已翻译的 label */
|
|
1906
|
+
const resolveFieldTypeLabel = (typeOrDefinition, formatMessage) => {
|
|
1907
|
+
const definition = typeof typeOrDefinition === 'string' ? registry.get(typeOrDefinition) : typeOrDefinition;
|
|
1908
|
+
if (!definition) {
|
|
1909
|
+
return typeof typeOrDefinition === 'string' ? typeOrDefinition : '';
|
|
1910
|
+
}
|
|
1911
|
+
return resolveRegistryLabel(formatMessage, definition.labelId, definition.label) || definition.type || '';
|
|
1912
|
+
};
|
|
1913
|
+
|
|
1852
1914
|
/**
|
|
1853
1915
|
* 解析字段提交值的 JSON Schema 片段。
|
|
1854
1916
|
* 优先用 definition.valueSchema(对象或 (field)=>schema);缺省 { type: 'string' }。
|
|
@@ -1898,15 +1960,12 @@ const getFieldComponent = (type, field) => {
|
|
|
1898
1960
|
}
|
|
1899
1961
|
return definition.component;
|
|
1900
1962
|
};
|
|
1901
|
-
const getFieldTypes =
|
|
1963
|
+
const getFieldTypes = formatMessage => {
|
|
1902
1964
|
const grouped = FIELD_GROUPS.map(group => ({
|
|
1903
|
-
label: group.label,
|
|
1904
|
-
options: group.types.map(type => registry.get(type)).filter(Boolean).map(({
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
}) => ({
|
|
1908
|
-
label,
|
|
1909
|
-
value: type
|
|
1965
|
+
label: resolveRegistryLabel(formatMessage, group.labelId, group.label),
|
|
1966
|
+
options: group.types.map(type => registry.get(type)).filter(Boolean).map(item => ({
|
|
1967
|
+
label: resolveFieldTypeLabel(item, formatMessage),
|
|
1968
|
+
value: item.type
|
|
1910
1969
|
}))
|
|
1911
1970
|
}));
|
|
1912
1971
|
const builtinTypes = new Set(FIELD_GROUPS.flatMap(group => group.types));
|
|
@@ -1915,20 +1974,28 @@ const getFieldTypes = () => {
|
|
|
1915
1974
|
const fallback = [];
|
|
1916
1975
|
registered.forEach(item => {
|
|
1917
1976
|
const option = {
|
|
1918
|
-
label: item
|
|
1977
|
+
label: resolveFieldTypeLabel(item, formatMessage),
|
|
1919
1978
|
value: item.type
|
|
1920
1979
|
};
|
|
1980
|
+
const groupNameId = item.groupNameId != null && String(item.groupNameId).trim() ? String(item.groupNameId).trim() : '';
|
|
1921
1981
|
const groupName = item.groupName != null && String(item.groupName).trim() ? String(item.groupName).trim() : '';
|
|
1922
|
-
if (!groupName) {
|
|
1982
|
+
if (!groupNameId && !groupName) {
|
|
1923
1983
|
fallback.push(option);
|
|
1924
1984
|
return;
|
|
1925
1985
|
}
|
|
1926
|
-
|
|
1927
|
-
|
|
1986
|
+
const groupKey = groupNameId || groupName;
|
|
1987
|
+
if (!customGroups.has(groupKey)) {
|
|
1988
|
+
customGroups.set(groupKey, {
|
|
1989
|
+
label: resolveRegistryLabel(formatMessage, groupNameId || null, groupName),
|
|
1990
|
+
options: []
|
|
1991
|
+
});
|
|
1928
1992
|
}
|
|
1929
|
-
customGroups.get(
|
|
1993
|
+
customGroups.get(groupKey).options.push(option);
|
|
1930
1994
|
});
|
|
1931
|
-
customGroups.forEach((
|
|
1995
|
+
customGroups.forEach(({
|
|
1996
|
+
label,
|
|
1997
|
+
options
|
|
1998
|
+
}) => {
|
|
1932
1999
|
grouped.push({
|
|
1933
2000
|
label,
|
|
1934
2001
|
options
|
|
@@ -1936,7 +2003,7 @@ const getFieldTypes = () => {
|
|
|
1936
2003
|
});
|
|
1937
2004
|
if (fallback.length) {
|
|
1938
2005
|
grouped.push({
|
|
1939
|
-
label: '扩展字段',
|
|
2006
|
+
label: resolveRegistryLabel(formatMessage, 'FieldGroupExtended', '扩展字段'),
|
|
1940
2007
|
options: fallback
|
|
1941
2008
|
});
|
|
1942
2009
|
}
|
|
@@ -1952,17 +2019,22 @@ const normalizeOptions = (options, {
|
|
|
1952
2019
|
const columnNames = (_columns || []).map(item => item == null ? void 0 : item.name).filter(Boolean);
|
|
1953
2020
|
return options.map(item => {
|
|
1954
2021
|
var _item$label, _item$value, _item$description;
|
|
2022
|
+
const label = String((_item$label = item == null ? void 0 : item.label) != null ? _item$label : '').trim();
|
|
2023
|
+
let value = String((_item$value = item == null ? void 0 : item.value) != null ? _item$value : '').trim();
|
|
2024
|
+
if (!value && label) {
|
|
2025
|
+
value = label;
|
|
2026
|
+
}
|
|
1955
2027
|
const next = {
|
|
1956
|
-
label
|
|
1957
|
-
value
|
|
1958
|
-
description: (_item$description = item == null ? void 0 : item.description) != null ? _item$description : ''
|
|
2028
|
+
label,
|
|
2029
|
+
value,
|
|
2030
|
+
description: String((_item$description = item == null ? void 0 : item.description) != null ? _item$description : '').trim()
|
|
1959
2031
|
};
|
|
1960
2032
|
columnNames.forEach(name => {
|
|
1961
2033
|
var _item$name;
|
|
1962
2034
|
next[name] = (_item$name = item == null ? void 0 : item[name]) != null ? _item$name : '';
|
|
1963
2035
|
});
|
|
1964
2036
|
if (!String(next.label).trim() && columnNames[0] && String(next[columnNames[0]] || '').trim()) {
|
|
1965
|
-
next.label = String(next[columnNames[0]]);
|
|
2037
|
+
next.label = String(next[columnNames[0]]).trim();
|
|
1966
2038
|
}
|
|
1967
2039
|
if (!String(next.value).trim() && String(next.label).trim()) {
|
|
1968
2040
|
next.value = next.label;
|
|
@@ -2117,6 +2189,11 @@ const pickFieldProps = (field, definition) => {
|
|
|
2117
2189
|
checkedChildren: props.checkedChildren || '',
|
|
2118
2190
|
unCheckedChildren: props.unCheckedChildren || ''
|
|
2119
2191
|
};
|
|
2192
|
+
case 'RadioGroup':
|
|
2193
|
+
case 'CheckboxGroup':
|
|
2194
|
+
return {
|
|
2195
|
+
inline: props.inline !== false
|
|
2196
|
+
};
|
|
2120
2197
|
default:
|
|
2121
2198
|
if (definition != null && (_definition$propsSche = definition.propsSchema) != null && _definition$propsSche.length) {
|
|
2122
2199
|
return pickFromPropsSchema(props, definition.propsSchema, definition.defaultProps || {});
|
|
@@ -2184,6 +2261,11 @@ const applyFieldProps = (props, values, definition) => {
|
|
|
2184
2261
|
setOptionalString(props, 'checkedChildren', values.checkedChildren);
|
|
2185
2262
|
setOptionalString(props, 'unCheckedChildren', values.unCheckedChildren);
|
|
2186
2263
|
break;
|
|
2264
|
+
case 'RadioGroup':
|
|
2265
|
+
case 'CheckboxGroup':
|
|
2266
|
+
// 始终落盘布尔值,避免 Checkbox 未勾选时字段缺失被当成默认单行
|
|
2267
|
+
props.inline = values.inline !== false;
|
|
2268
|
+
break;
|
|
2187
2269
|
default:
|
|
2188
2270
|
if (definition != null && (_definition$propsSche2 = definition.propsSchema) != null && _definition$propsSche2.length) {
|
|
2189
2271
|
applyFromPropsSchema(props, values, definition.propsSchema);
|
|
@@ -2314,7 +2396,7 @@ const FieldRow = ({
|
|
|
2314
2396
|
}), /*#__PURE__*/jsx(Tag, {
|
|
2315
2397
|
bordered: false,
|
|
2316
2398
|
color: TYPE_TAG_COLORS[field.type] || 'default',
|
|
2317
|
-
children: (definition
|
|
2399
|
+
children: resolveFieldTypeLabel(definition || field.type, formatMessage)
|
|
2318
2400
|
}), field.hidden ? /*#__PURE__*/jsx(Tag, {
|
|
2319
2401
|
bordered: false,
|
|
2320
2402
|
children: formatMessage({
|
|
@@ -2914,7 +2996,7 @@ const BlockListPanel = ({
|
|
|
2914
2996
|
}) : block.kind === 'multiField' ? formatMessage({
|
|
2915
2997
|
id: 'multiFieldSummary'
|
|
2916
2998
|
}, {
|
|
2917
|
-
type: block.fieldType
|
|
2999
|
+
type: resolveFieldTypeLabel(block.fieldType, formatMessage)
|
|
2918
3000
|
}) : block.kind === 'choice' ? formatMessage({
|
|
2919
3001
|
id: 'choiceOptionCount'
|
|
2920
3002
|
}, {
|
|
@@ -2938,7 +3020,9 @@ const BlockListPanel = ({
|
|
|
2938
3020
|
children: [/*#__PURE__*/jsx(Tag, {
|
|
2939
3021
|
bordered: false,
|
|
2940
3022
|
color: (definition == null ? void 0 : definition.color) || 'default',
|
|
2941
|
-
children: (
|
|
3023
|
+
children: formatMessage({
|
|
3024
|
+
id: `blockKind_${block.kind}`
|
|
3025
|
+
})
|
|
2942
3026
|
}), /*#__PURE__*/jsx(Text$3, {
|
|
2943
3027
|
strong: true,
|
|
2944
3028
|
ellipsis: true,
|
|
@@ -3056,7 +3140,7 @@ const BlockConfigFields = ({
|
|
|
3056
3140
|
formatMessage
|
|
3057
3141
|
} = useIntl();
|
|
3058
3142
|
const definition = getBlockDefinition(kind);
|
|
3059
|
-
const fieldTypeOptions = useMemo(() => getFieldTypes(), []);
|
|
3143
|
+
const fieldTypeOptions = useMemo(() => getFieldTypes(formatMessage), [formatMessage]);
|
|
3060
3144
|
const list = [];
|
|
3061
3145
|
if (kind === 'formInfo' || kind === 'list' || kind === 'tableList' || kind === 'object') {
|
|
3062
3146
|
list.push(/*#__PURE__*/jsx(Input, {
|
|
@@ -3103,7 +3187,12 @@ const BlockConfigFields = ({
|
|
|
3103
3187
|
children: formatMessage({
|
|
3104
3188
|
id: 'blockBordered'
|
|
3105
3189
|
})
|
|
3106
|
-
}, "bordered"), kind === '
|
|
3190
|
+
}, "bordered"), kind === 'formInfo' ? /*#__PURE__*/jsx(Checkbox, {
|
|
3191
|
+
name: "showIndex",
|
|
3192
|
+
children: formatMessage({
|
|
3193
|
+
id: 'blockShowIndex'
|
|
3194
|
+
})
|
|
3195
|
+
}, "showIndex") : null, kind === 'list' ? /*#__PURE__*/jsx(Checkbox, {
|
|
3107
3196
|
name: "important",
|
|
3108
3197
|
children: formatMessage({
|
|
3109
3198
|
id: 'blockImportant'
|
|
@@ -3186,20 +3275,26 @@ const BlockConfigFields = ({
|
|
|
3186
3275
|
var _openApi$data2;
|
|
3187
3276
|
return (openApi == null || (_openApi$data2 = openApi.data) == null ? void 0 : _openApi$data2.mode) === 'multiple';
|
|
3188
3277
|
}
|
|
3189
|
-
}, "maxLength"), /*#__PURE__*/jsx(
|
|
3278
|
+
}, "maxLength"), /*#__PURE__*/jsx(Checkbox, {
|
|
3279
|
+
name: "selectorInData",
|
|
3280
|
+
children: formatMessage({
|
|
3281
|
+
id: 'choiceSelectorInData'
|
|
3282
|
+
})
|
|
3283
|
+
}, "selectorInData"), /*#__PURE__*/jsx(Input, {
|
|
3190
3284
|
name: "selectorName",
|
|
3191
3285
|
label: formatMessage({
|
|
3192
3286
|
id: 'choiceSelectorName'
|
|
3193
3287
|
}),
|
|
3194
3288
|
placeholder: formatMessage({
|
|
3195
3289
|
id: 'choiceSelectorNamePlaceholder'
|
|
3196
|
-
})
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3290
|
+
}),
|
|
3291
|
+
display: ({
|
|
3292
|
+
openApi
|
|
3293
|
+
}) => {
|
|
3294
|
+
var _openApi$data3;
|
|
3295
|
+
return (openApi == null || (_openApi$data3 = openApi.data) == null ? void 0 : _openApi$data3.selectorInData) !== false;
|
|
3296
|
+
}
|
|
3297
|
+
}, "selectorName"));
|
|
3203
3298
|
}
|
|
3204
3299
|
if (kind === 'multiField') {
|
|
3205
3300
|
list.push(/*#__PURE__*/jsx(Input, {
|
|
@@ -3269,7 +3364,9 @@ const BlockConfigFields = ({
|
|
|
3269
3364
|
return /*#__PURE__*/jsx("div", {
|
|
3270
3365
|
className: style['field-editor-form'],
|
|
3271
3366
|
children: /*#__PURE__*/jsx(FormInfo, {
|
|
3272
|
-
title: (
|
|
3367
|
+
title: formatMessage({
|
|
3368
|
+
id: `blockKind_${kind}`
|
|
3369
|
+
}),
|
|
3273
3370
|
subtitle: definition == null ? void 0 : definition.description,
|
|
3274
3371
|
column: 1,
|
|
3275
3372
|
list: list.filter(Boolean)
|
|
@@ -3520,6 +3617,32 @@ const EMPTY_OPTION = () => ({
|
|
|
3520
3617
|
label: '',
|
|
3521
3618
|
value: ''
|
|
3522
3619
|
});
|
|
3620
|
+
|
|
3621
|
+
/** value 为空或仍等于当前 label 时视为联动中,改 label 会同步 value */
|
|
3622
|
+
const isOptionValueLinked = (label, value) => {
|
|
3623
|
+
const labelText = label == null ? '' : String(label);
|
|
3624
|
+
const valueText = value == null ? '' : String(value);
|
|
3625
|
+
return valueText === '' || valueText === labelText;
|
|
3626
|
+
};
|
|
3627
|
+
const patchOptionLabelChange = (item, nextLabel) => {
|
|
3628
|
+
const patch = {
|
|
3629
|
+
label: nextLabel
|
|
3630
|
+
};
|
|
3631
|
+
if (isOptionValueLinked(item.label, item.value)) {
|
|
3632
|
+
patch.value = nextLabel;
|
|
3633
|
+
}
|
|
3634
|
+
return patch;
|
|
3635
|
+
};
|
|
3636
|
+
const trimOptionLabelValue = item => {
|
|
3637
|
+
var _item$label, _item$value;
|
|
3638
|
+
const label = String((_item$label = item == null ? void 0 : item.label) != null ? _item$label : '').trim();
|
|
3639
|
+
const rawValue = String((_item$value = item == null ? void 0 : item.value) != null ? _item$value : '').trim();
|
|
3640
|
+
const linked = isOptionValueLinked(item == null ? void 0 : item.label, item == null ? void 0 : item.value) || rawValue === '' || rawValue === label;
|
|
3641
|
+
return {
|
|
3642
|
+
label,
|
|
3643
|
+
value: linked ? label : rawValue
|
|
3644
|
+
};
|
|
3645
|
+
};
|
|
3523
3646
|
const createEmptyTableRow = columns => {
|
|
3524
3647
|
const row = {
|
|
3525
3648
|
label: '',
|
|
@@ -3563,9 +3686,8 @@ const FlatOptionRows = ({
|
|
|
3563
3686
|
placeholder: formatMessage({
|
|
3564
3687
|
id: 'optionLabelPlaceholder'
|
|
3565
3688
|
}),
|
|
3566
|
-
onChange: event => updateItem(index,
|
|
3567
|
-
|
|
3568
|
-
})
|
|
3689
|
+
onChange: event => updateItem(index, patchOptionLabelChange(item, event.target.value)),
|
|
3690
|
+
onBlur: () => updateItem(index, trimOptionLabelValue(item))
|
|
3569
3691
|
}), /*#__PURE__*/jsx(Input$1, {
|
|
3570
3692
|
value: item.value,
|
|
3571
3693
|
placeholder: formatMessage({
|
|
@@ -3573,7 +3695,13 @@ const FlatOptionRows = ({
|
|
|
3573
3695
|
}),
|
|
3574
3696
|
onChange: event => updateItem(index, {
|
|
3575
3697
|
value: event.target.value
|
|
3576
|
-
})
|
|
3698
|
+
}),
|
|
3699
|
+
onBlur: () => {
|
|
3700
|
+
var _item$value2;
|
|
3701
|
+
return updateItem(index, {
|
|
3702
|
+
value: String((_item$value2 = item.value) != null ? _item$value2 : '').trim()
|
|
3703
|
+
});
|
|
3704
|
+
}
|
|
3577
3705
|
}), allowDescription ? /*#__PURE__*/jsx(Input$1, {
|
|
3578
3706
|
value: item.description || '',
|
|
3579
3707
|
placeholder: formatMessage({
|
|
@@ -3581,7 +3709,13 @@ const FlatOptionRows = ({
|
|
|
3581
3709
|
}),
|
|
3582
3710
|
onChange: event => updateItem(index, {
|
|
3583
3711
|
description: event.target.value
|
|
3584
|
-
})
|
|
3712
|
+
}),
|
|
3713
|
+
onBlur: () => {
|
|
3714
|
+
var _item$description;
|
|
3715
|
+
return updateItem(index, {
|
|
3716
|
+
description: String((_item$description = item.description) != null ? _item$description : '').trim()
|
|
3717
|
+
});
|
|
3718
|
+
}
|
|
3585
3719
|
}) : null, /*#__PURE__*/jsx(Button, {
|
|
3586
3720
|
type: "text",
|
|
3587
3721
|
danger: true,
|
|
@@ -3654,9 +3788,8 @@ const TreeOptionNode = ({
|
|
|
3654
3788
|
placeholder: formatMessage({
|
|
3655
3789
|
id: 'optionLabelPlaceholder'
|
|
3656
3790
|
}),
|
|
3657
|
-
onChange: e => updateSelf(
|
|
3658
|
-
|
|
3659
|
-
})
|
|
3791
|
+
onChange: e => updateSelf(patchOptionLabelChange(item, e.target.value)),
|
|
3792
|
+
onBlur: () => updateSelf(trimOptionLabelValue(item))
|
|
3660
3793
|
}), /*#__PURE__*/jsx(Input$1, {
|
|
3661
3794
|
value: item.value,
|
|
3662
3795
|
placeholder: formatMessage({
|
|
@@ -3664,7 +3797,13 @@ const TreeOptionNode = ({
|
|
|
3664
3797
|
}),
|
|
3665
3798
|
onChange: e => updateSelf({
|
|
3666
3799
|
value: e.target.value
|
|
3667
|
-
})
|
|
3800
|
+
}),
|
|
3801
|
+
onBlur: () => {
|
|
3802
|
+
var _item$value3;
|
|
3803
|
+
return updateSelf({
|
|
3804
|
+
value: String((_item$value3 = item.value) != null ? _item$value3 : '').trim()
|
|
3805
|
+
});
|
|
3806
|
+
}
|
|
3668
3807
|
}), allowDescription ? /*#__PURE__*/jsx(Input$1, {
|
|
3669
3808
|
value: item.description || '',
|
|
3670
3809
|
placeholder: formatMessage({
|
|
@@ -3672,7 +3811,13 @@ const TreeOptionNode = ({
|
|
|
3672
3811
|
}),
|
|
3673
3812
|
onChange: e => updateSelf({
|
|
3674
3813
|
description: e.target.value
|
|
3675
|
-
})
|
|
3814
|
+
}),
|
|
3815
|
+
onBlur: () => {
|
|
3816
|
+
var _item$description2;
|
|
3817
|
+
return updateSelf({
|
|
3818
|
+
description: String((_item$description2 = item.description) != null ? _item$description2 : '').trim()
|
|
3819
|
+
});
|
|
3820
|
+
}
|
|
3676
3821
|
}) : null]
|
|
3677
3822
|
}), /*#__PURE__*/jsxs("div", {
|
|
3678
3823
|
className: style['tree-option-actions'],
|
|
@@ -4150,7 +4295,7 @@ const SuperSelectPropsEditor = ({
|
|
|
4150
4295
|
};
|
|
4151
4296
|
var SuperSelectPropsEditor$1 = SuperSelectPropsEditor;
|
|
4152
4297
|
|
|
4153
|
-
const BUILTIN_PROP_TYPES = ['Input', 'TextArea', 'InputNumber', 'Select', 'DatePicker', 'Switch'];
|
|
4298
|
+
const BUILTIN_PROP_TYPES = ['Input', 'TextArea', 'InputNumber', 'Select', 'DatePicker', 'Switch', 'RadioGroup', 'CheckboxGroup'];
|
|
4154
4299
|
const buildPropsSchemaList = (schema, formatMessage) => (schema || []).filter(item => item == null ? void 0 : item.name).map(item => {
|
|
4155
4300
|
if (item.type === 'boolean') {
|
|
4156
4301
|
return /*#__PURE__*/jsx(Checkbox, {
|
|
@@ -4381,6 +4526,14 @@ const buildBuiltinList = (type, formatMessage) => {
|
|
|
4381
4526
|
id: 'propSwitchOffTextHint'
|
|
4382
4527
|
})
|
|
4383
4528
|
}, "unCheckedChildren")];
|
|
4529
|
+
case 'RadioGroup':
|
|
4530
|
+
case 'CheckboxGroup':
|
|
4531
|
+
return [/*#__PURE__*/jsx(Checkbox, {
|
|
4532
|
+
name: "inline",
|
|
4533
|
+
children: formatMessage({
|
|
4534
|
+
id: 'propOptionsInline'
|
|
4535
|
+
})
|
|
4536
|
+
}, "inline")];
|
|
4384
4537
|
default:
|
|
4385
4538
|
return [];
|
|
4386
4539
|
}
|
|
@@ -4457,7 +4610,7 @@ const FieldConfigFields = ({
|
|
|
4457
4610
|
openApi
|
|
4458
4611
|
} = useFormContext();
|
|
4459
4612
|
const [fieldType, setFieldType] = useState(initialType);
|
|
4460
|
-
const fieldTypeOptions = useMemo(() => getFieldTypes(), []);
|
|
4613
|
+
const fieldTypeOptions = useMemo(() => getFieldTypes(formatMessage), [formatMessage]);
|
|
4461
4614
|
const definition = getFieldDefinition(fieldType);
|
|
4462
4615
|
useEffect(() => {
|
|
4463
4616
|
setFieldType(initialType);
|
|
@@ -4971,29 +5124,32 @@ const buildMultipleHint = (formatMessage, minLength, maxLength) => {
|
|
|
4971
5124
|
* 外层用 InfoPage.Part 的 title 展示标题。
|
|
4972
5125
|
*/
|
|
4973
5126
|
const ChoiceBlock = ({
|
|
4974
|
-
|
|
5127
|
+
schemaBlock,
|
|
5128
|
+
block: blockProp,
|
|
4975
5129
|
preview: _preview = false,
|
|
4976
5130
|
isMobile: _isMobile = false,
|
|
4977
5131
|
isPartRoot: _isPartRoot = false,
|
|
4978
5132
|
formatMessage,
|
|
4979
5133
|
renderOptionContent
|
|
4980
5134
|
}) => {
|
|
4981
|
-
|
|
4982
|
-
const
|
|
4983
|
-
const
|
|
5135
|
+
// schema 配置用 schemaBlock;兼容旧 prop 名 block(且忽略 withBlockLayout 写入的 boolean true)
|
|
5136
|
+
const block = schemaBlock && typeof schemaBlock === 'object' ? schemaBlock : blockProp && typeof blockProp === 'object' ? blockProp : null;
|
|
5137
|
+
const mode = (block == null ? void 0 : block.mode) === 'multiple' ? 'multiple' : 'single';
|
|
5138
|
+
const selectorName = block ? resolveSelectorName(block) : '';
|
|
5139
|
+
const options = useMemo(() => block && Array.isArray(block.options) ? block.options : [], [block]);
|
|
4984
5140
|
const {
|
|
4985
5141
|
formData,
|
|
4986
5142
|
openApi
|
|
4987
5143
|
} = useFormContext() || {};
|
|
4988
|
-
const titleText = block.title != null ? String(block.title).trim() : '';
|
|
5144
|
+
const titleText = (block == null ? void 0 : block.title) != null ? String(block.title).trim() : '';
|
|
4989
5145
|
const title = titleText || (formatMessage ? formatMessage({
|
|
4990
5146
|
id: 'choiceAreaTitle'
|
|
4991
5147
|
}) : '请选择');
|
|
4992
|
-
const bordered = _isMobile ? false : block.bordered || undefined;
|
|
5148
|
+
const bordered = _isMobile ? false : (block == null ? void 0 : block.bordered) || undefined;
|
|
4993
5149
|
const {
|
|
4994
5150
|
minLength,
|
|
4995
5151
|
maxLength
|
|
4996
|
-
} = mode === 'multiple' ? resolveSelectLimits(block) : {};
|
|
5152
|
+
} = mode === 'multiple' && block ? resolveSelectLimits(block) : {};
|
|
4997
5153
|
const firstOptionId = options[0] != null ? String(options[0].id) : undefined;
|
|
4998
5154
|
const rawValue = getByPath$1(formData || {}, selectorName);
|
|
4999
5155
|
// 仅随 selector 值变化;勿依赖整个 formData,否则清空未选支字段会触发 options 重算 → CheckboxGroup 死循环
|
|
@@ -5116,6 +5272,9 @@ const ChoiceBlock = ({
|
|
|
5116
5272
|
const modeHint = mode === 'multiple' ? buildMultipleHint(formatMessage, minLength, maxLength) : formatMessage ? formatMessage({
|
|
5117
5273
|
id: 'choiceModeHintSingle'
|
|
5118
5274
|
}) : '请选择其中一项';
|
|
5275
|
+
if (!block) {
|
|
5276
|
+
return null;
|
|
5277
|
+
}
|
|
5119
5278
|
return /*#__PURE__*/createElement(InfoPage.Part, {
|
|
5120
5279
|
title,
|
|
5121
5280
|
subtitle: modeHint,
|
|
@@ -5149,9 +5308,27 @@ const resolvePartRootClassName = (depth, ...extra) => {
|
|
|
5149
5308
|
const names = [depth === 0 ? InfoPage.partRootClassName : null, ...extra].filter(Boolean);
|
|
5150
5309
|
return names.length ? names.join(' ') : undefined;
|
|
5151
5310
|
};
|
|
5311
|
+
const buildFieldLabel = field => {
|
|
5312
|
+
const base = (field == null ? void 0 : field.label) != null && String(field.label).trim() ? String(field.label).trim() : (field == null ? void 0 : field.name) || '';
|
|
5313
|
+
return base || undefined;
|
|
5314
|
+
};
|
|
5315
|
+
const buildIndexedLabelRender = index => {
|
|
5316
|
+
return ({
|
|
5317
|
+
label
|
|
5318
|
+
}) => {
|
|
5319
|
+
const text = label != null ? String(label).replace(/\u200b/g, '') : '';
|
|
5320
|
+
return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement('span', {
|
|
5321
|
+
className: style['field-label-index']
|
|
5322
|
+
}, `${index + 1}.`), text ? /*#__PURE__*/createElement('span', {
|
|
5323
|
+
className: style['field-label-main']
|
|
5324
|
+
}, text) : null);
|
|
5325
|
+
};
|
|
5326
|
+
};
|
|
5152
5327
|
const renderFieldElements = (fields = [], preview = false, {
|
|
5153
|
-
namePrefix
|
|
5154
|
-
|
|
5328
|
+
namePrefix,
|
|
5329
|
+
locale,
|
|
5330
|
+
showIndex: _showIndex = false
|
|
5331
|
+
} = {}) => fields.filter(field => !field.hidden).map((field, index) => {
|
|
5155
5332
|
var _props$options;
|
|
5156
5333
|
const Component = getFieldComponent(field.type, field);
|
|
5157
5334
|
if (!Component) {
|
|
@@ -5166,23 +5343,48 @@ const renderFieldElements = (fields = [], preview = false, {
|
|
|
5166
5343
|
delete props.placeholder;
|
|
5167
5344
|
}
|
|
5168
5345
|
delete props.range;
|
|
5346
|
+
|
|
5347
|
+
// Radio/Checkbox 选项布局:inline=false 纵向;Radio 用 antd vertical,Checkbox 用样式兜底
|
|
5348
|
+
if (field.type === 'RadioGroup' || field.type === 'CheckboxGroup') {
|
|
5349
|
+
const optionsInline = props.inline !== false;
|
|
5350
|
+
delete props.inline;
|
|
5351
|
+
if (!optionsInline) {
|
|
5352
|
+
if (field.type === 'RadioGroup') {
|
|
5353
|
+
props.vertical = true;
|
|
5354
|
+
}
|
|
5355
|
+
props.className = [props.className, style['option-group-stack']].filter(Boolean).join(' ');
|
|
5356
|
+
}
|
|
5357
|
+
}
|
|
5169
5358
|
const description = field.description != null && String(field.description).trim() ? field.description : undefined;
|
|
5170
5359
|
const fieldName = namePrefix && field.name ? `${namePrefix}.${field.name}` : field.name;
|
|
5360
|
+
// 显式传 locale,避免 Global 仍为 zh-CN 时 react-form-antd withLocale 盖掉父级英文
|
|
5361
|
+
const localeProps = locale ? {
|
|
5362
|
+
locale
|
|
5363
|
+
} : {};
|
|
5364
|
+
const label = buildFieldLabel(field);
|
|
5171
5365
|
return /*#__PURE__*/createElement(Component, _extends({
|
|
5172
5366
|
key: field.id,
|
|
5173
5367
|
name: fieldName,
|
|
5174
|
-
label:
|
|
5368
|
+
label: _showIndex ? label || '\u200b' : label
|
|
5369
|
+
}, _showIndex ? {
|
|
5370
|
+
labelRender: buildIndexedLabelRender(index)
|
|
5371
|
+
} : null, {
|
|
5175
5372
|
rule: field.rule || undefined,
|
|
5176
5373
|
block: field.block || undefined
|
|
5177
|
-
}, props, {
|
|
5374
|
+
}, props, localeProps, {
|
|
5178
5375
|
labelTips: buildLabelTips(field.tips),
|
|
5179
5376
|
description
|
|
5180
5377
|
}));
|
|
5181
5378
|
}).filter(Boolean);
|
|
5182
5379
|
const withBlockLayout = (element, forceBlock) => {
|
|
5380
|
+
var _element$props;
|
|
5183
5381
|
if (!element || !forceBlock) {
|
|
5184
5382
|
return element;
|
|
5185
5383
|
}
|
|
5384
|
+
// FormInfo / List 等用 block 表示整行占位;勿覆盖 ChoiceBlock 的 schemaBlock
|
|
5385
|
+
if (element.type === ChoiceBlock$1 || (_element$props = element.props) != null && _element$props.schemaBlock) {
|
|
5386
|
+
return element;
|
|
5387
|
+
}
|
|
5186
5388
|
return /*#__PURE__*/createElement(element.type, _extends({}, element.props, {
|
|
5187
5389
|
key: element.key,
|
|
5188
5390
|
block: true
|
|
@@ -5209,7 +5411,8 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
|
|
|
5209
5411
|
isMobile = false,
|
|
5210
5412
|
formatMessage,
|
|
5211
5413
|
depth = 0,
|
|
5212
|
-
asListItem = false
|
|
5414
|
+
asListItem = false,
|
|
5415
|
+
locale
|
|
5213
5416
|
} = ctx;
|
|
5214
5417
|
if (!block || depth > MAX_BLOCK_DEPTH) {
|
|
5215
5418
|
return null;
|
|
@@ -5218,6 +5421,9 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
|
|
|
5218
5421
|
depth: depth + 1,
|
|
5219
5422
|
asListItem: false
|
|
5220
5423
|
});
|
|
5424
|
+
const fieldRenderOpts = {
|
|
5425
|
+
locale
|
|
5426
|
+
};
|
|
5221
5427
|
const bordered = isMobile ? false : block.bordered || undefined;
|
|
5222
5428
|
// 仅 FormInfo/object 吃列表项 Part 样式;List 等交给 form-info nestDepth
|
|
5223
5429
|
const listItemPartProps = asListItem && isFormInfoLikeBlock(block.kind) ? nestedListItemPartProps : null;
|
|
@@ -5233,7 +5439,10 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
|
|
|
5233
5439
|
switch (block.kind) {
|
|
5234
5440
|
case 'formInfo':
|
|
5235
5441
|
{
|
|
5236
|
-
const
|
|
5442
|
+
const showIndex = !!block.showIndex;
|
|
5443
|
+
const fields = renderFieldElements(block.list, preview, _extends({}, fieldRenderOpts, {
|
|
5444
|
+
showIndex
|
|
5445
|
+
}));
|
|
5237
5446
|
const nested = renderChildBlocks(block.blocks || [], nextCtx).map(node => withBlockLayout(node, true));
|
|
5238
5447
|
return withBlockLayout(/*#__PURE__*/createElement(FormInfo, _extends({
|
|
5239
5448
|
key: block.id,
|
|
@@ -5244,14 +5453,14 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
|
|
|
5244
5453
|
bordered,
|
|
5245
5454
|
list: [...fields, ...nested]
|
|
5246
5455
|
}, listItemPartProps || {}, {
|
|
5247
|
-
className: resolvePartRootClassName(depth)
|
|
5456
|
+
className: resolvePartRootClassName(depth, showIndex ? style['form-info-show-index'] : null)
|
|
5248
5457
|
})), asListItem);
|
|
5249
5458
|
}
|
|
5250
5459
|
case 'object':
|
|
5251
5460
|
{
|
|
5252
|
-
const fields = renderFieldElements(block.list, preview, {
|
|
5461
|
+
const fields = renderFieldElements(block.list, preview, _extends({}, fieldRenderOpts, {
|
|
5253
5462
|
namePrefix: block.name || ''
|
|
5254
|
-
});
|
|
5463
|
+
}));
|
|
5255
5464
|
const nested = renderChildBlocks(block.blocks || [], nextCtx).map(node => withBlockLayout(node, true));
|
|
5256
5465
|
return withBlockLayout(/*#__PURE__*/createElement(FormInfo, _extends({
|
|
5257
5466
|
key: block.id,
|
|
@@ -5267,7 +5476,7 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
|
|
|
5267
5476
|
}
|
|
5268
5477
|
case 'list':
|
|
5269
5478
|
{
|
|
5270
|
-
const fields = renderFieldElements(block.list, preview);
|
|
5479
|
+
const fields = renderFieldElements(block.list, preview, fieldRenderOpts);
|
|
5271
5480
|
const nested = renderItemBlocks(block.itemBlocks || []);
|
|
5272
5481
|
return withBlockLayout(/*#__PURE__*/createElement(List, _extends({
|
|
5273
5482
|
key: block.id,
|
|
@@ -5288,7 +5497,7 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
|
|
|
5288
5497
|
}
|
|
5289
5498
|
case 'tableList':
|
|
5290
5499
|
{
|
|
5291
|
-
const fields = renderFieldElements(block.list, preview);
|
|
5500
|
+
const fields = renderFieldElements(block.list, preview, fieldRenderOpts);
|
|
5292
5501
|
return withBlockLayout(/*#__PURE__*/createElement(TableList, _extends({
|
|
5293
5502
|
key: block.id,
|
|
5294
5503
|
name: block.name,
|
|
@@ -5331,7 +5540,7 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
|
|
|
5331
5540
|
prevIcon: /*#__PURE__*/createElement(ArrowLeftOutlined),
|
|
5332
5541
|
nextIcon: /*#__PURE__*/createElement(ArrowRightOutlined),
|
|
5333
5542
|
items: (block.items || []).map(step => {
|
|
5334
|
-
const fields = renderFieldElements(step.list, preview);
|
|
5543
|
+
const fields = renderFieldElements(step.list, preview, fieldRenderOpts);
|
|
5335
5544
|
const nested = renderChildBlocks(step.blocks || [], nextCtx);
|
|
5336
5545
|
const fieldNames = [...(step.list || []).filter(field => field && !field.hidden && field.name).map(field => field.name), ...collectBlockFieldNames(step.blocks || [])];
|
|
5337
5546
|
if (nested.length) {
|
|
@@ -5365,7 +5574,7 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
|
|
|
5365
5574
|
case 'choice':
|
|
5366
5575
|
return withBlockLayout(/*#__PURE__*/createElement(ChoiceBlock$1, {
|
|
5367
5576
|
key: block.id,
|
|
5368
|
-
block,
|
|
5577
|
+
schemaBlock: block,
|
|
5369
5578
|
preview,
|
|
5370
5579
|
isMobile,
|
|
5371
5580
|
isPartRoot: depth === 0,
|
|
@@ -5394,6 +5603,7 @@ const renderSchemaInner = (schema, {
|
|
|
5394
5603
|
bodyClassName,
|
|
5395
5604
|
isMobile: _isMobile = false,
|
|
5396
5605
|
formatMessage,
|
|
5606
|
+
locale,
|
|
5397
5607
|
children,
|
|
5398
5608
|
actionNode
|
|
5399
5609
|
} = {}) => {
|
|
@@ -5401,7 +5611,8 @@ const renderSchemaInner = (schema, {
|
|
|
5401
5611
|
const blocks = normalized.blocks || [];
|
|
5402
5612
|
const contentChildren = blocks.map(block => renderBlockElement(block, _preview, {
|
|
5403
5613
|
isMobile: _isMobile,
|
|
5404
|
-
formatMessage
|
|
5614
|
+
formatMessage,
|
|
5615
|
+
locale
|
|
5405
5616
|
})).filter(Boolean);
|
|
5406
5617
|
if (!contentChildren.length && !children && !actionNode) {
|
|
5407
5618
|
return null;
|
|
@@ -5421,6 +5632,7 @@ const renderSchemaContent = (schema, {
|
|
|
5421
5632
|
bodyClassName,
|
|
5422
5633
|
isMobile: _isMobile2 = false,
|
|
5423
5634
|
formatMessage,
|
|
5635
|
+
locale,
|
|
5424
5636
|
children,
|
|
5425
5637
|
actionNode
|
|
5426
5638
|
} = {}) => {
|
|
@@ -5428,7 +5640,8 @@ const renderSchemaContent = (schema, {
|
|
|
5428
5640
|
const blocks = normalized.blocks || [];
|
|
5429
5641
|
const contentChildren = blocks.map(block => renderBlockElement(block, _preview2, {
|
|
5430
5642
|
isMobile: _isMobile2,
|
|
5431
|
-
formatMessage
|
|
5643
|
+
formatMessage,
|
|
5644
|
+
locale
|
|
5432
5645
|
})).filter(Boolean);
|
|
5433
5646
|
if (!contentChildren.length && !children) {
|
|
5434
5647
|
return null;
|
|
@@ -5537,7 +5750,8 @@ const SchemaRendererInner = withLocale$1(props => {
|
|
|
5537
5750
|
buttonFooterProps
|
|
5538
5751
|
} = props;
|
|
5539
5752
|
const {
|
|
5540
|
-
formatMessage
|
|
5753
|
+
formatMessage,
|
|
5754
|
+
locale
|
|
5541
5755
|
} = useIntl();
|
|
5542
5756
|
const isMobile = useIsMobile();
|
|
5543
5757
|
const normalized = normalizeSchema(schema);
|
|
@@ -5570,6 +5784,7 @@ const SchemaRendererInner = withLocale$1(props => {
|
|
|
5570
5784
|
bodyClassName,
|
|
5571
5785
|
isMobile,
|
|
5572
5786
|
formatMessage,
|
|
5787
|
+
locale,
|
|
5573
5788
|
children,
|
|
5574
5789
|
actionNode
|
|
5575
5790
|
});
|
|
@@ -5600,7 +5815,8 @@ const SchemaRenderer = withLocale$1(props => {
|
|
|
5600
5815
|
buttonFooterProps
|
|
5601
5816
|
} = props;
|
|
5602
5817
|
const {
|
|
5603
|
-
formatMessage
|
|
5818
|
+
formatMessage,
|
|
5819
|
+
locale
|
|
5604
5820
|
} = useIntl();
|
|
5605
5821
|
const isMobile = useIsMobile();
|
|
5606
5822
|
const normalized = normalizeSchema(schema);
|
|
@@ -5634,6 +5850,7 @@ const SchemaRenderer = withLocale$1(props => {
|
|
|
5634
5850
|
bodyClassName,
|
|
5635
5851
|
isMobile,
|
|
5636
5852
|
formatMessage,
|
|
5853
|
+
locale,
|
|
5637
5854
|
children,
|
|
5638
5855
|
actionNode
|
|
5639
5856
|
});
|
|
@@ -5651,7 +5868,8 @@ const FormCreator = withLocale$1(({
|
|
|
5651
5868
|
extraToolbar
|
|
5652
5869
|
}) => {
|
|
5653
5870
|
const {
|
|
5654
|
-
formatMessage
|
|
5871
|
+
formatMessage,
|
|
5872
|
+
locale
|
|
5655
5873
|
} = useIntl();
|
|
5656
5874
|
const isMobile = useIsMobile();
|
|
5657
5875
|
const [innerSchema, setInnerSchema] = useState(() => normalizeSchema(defaultValue || defaultSchema()));
|
|
@@ -5969,7 +6187,8 @@ const FormCreator = withLocale$1(({
|
|
|
5969
6187
|
children: hasRenderableContent(schema) ? /*#__PURE__*/jsx(SchemaRenderer$1, {
|
|
5970
6188
|
schema: schema,
|
|
5971
6189
|
preview: true,
|
|
5972
|
-
formProps: formProps
|
|
6190
|
+
formProps: formProps,
|
|
6191
|
+
locale: locale
|
|
5973
6192
|
}) : /*#__PURE__*/jsx(Empty, {
|
|
5974
6193
|
image: Empty.PRESENTED_IMAGE_SIMPLE,
|
|
5975
6194
|
description: formatMessage({
|
|
@@ -6906,18 +7125,42 @@ const resolveChoiceSelectorName = block => {
|
|
|
6906
7125
|
const formatFieldValue = (field, value, formatMessage) => formatFieldDisplayValue(field, value, {
|
|
6907
7126
|
formatMessage
|
|
6908
7127
|
});
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
7128
|
+
|
|
7129
|
+
/**
|
|
7130
|
+
* 问卷题干往往很长:不用 InfoPage Content 的横向 label 列宽对齐(minWidth),
|
|
7131
|
+
* 改为 label 在上、值在下,避免窄栏(如弹窗双栏预览)被撑乱。
|
|
7132
|
+
*/
|
|
7133
|
+
const renderFieldsContent = (fields, data, formatMessage, column, {
|
|
7134
|
+
showIndex: _showIndex = false
|
|
7135
|
+
} = {}) => {
|
|
7136
|
+
const list = (fields || []).filter(field => field && !field.hidden && field.name).map((field, index) => {
|
|
7137
|
+
const baseLabel = field.label || field.name;
|
|
7138
|
+
const label = _showIndex ? `${index + 1}. ${baseLabel}` : baseLabel;
|
|
7139
|
+
return {
|
|
7140
|
+
label,
|
|
7141
|
+
content: formatFieldValue(field, getByPath(data, field.name), formatMessage),
|
|
7142
|
+
block: field.block === true
|
|
7143
|
+
};
|
|
7144
|
+
});
|
|
6915
7145
|
if (!list.length) {
|
|
6916
7146
|
return null;
|
|
6917
7147
|
}
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
7148
|
+
const cols = Math.max(1, Number(column) || 2);
|
|
7149
|
+
return /*#__PURE__*/jsx("div", {
|
|
7150
|
+
className: style['schema-content-fields'],
|
|
7151
|
+
style: {
|
|
7152
|
+
'--schema-content-cols': cols
|
|
7153
|
+
},
|
|
7154
|
+
children: list.map((item, index) => /*#__PURE__*/jsxs("div", {
|
|
7155
|
+
className: [style['schema-content-field'], item.block ? style['schema-content-field-block'] : null].filter(Boolean).join(' '),
|
|
7156
|
+
children: [item.label ? /*#__PURE__*/jsxs("div", {
|
|
7157
|
+
className: style['schema-content-field-label'],
|
|
7158
|
+
children: [item.label, "\uFF1A"]
|
|
7159
|
+
}) : null, /*#__PURE__*/jsx("div", {
|
|
7160
|
+
className: style['schema-content-field-value'],
|
|
7161
|
+
children: item.content
|
|
7162
|
+
})]
|
|
7163
|
+
}, index))
|
|
6921
7164
|
});
|
|
6922
7165
|
};
|
|
6923
7166
|
const renderBlockList = (blocks, data, ctx) => (blocks || []).map(block => renderBlock(block, data, ctx)).filter(Boolean);
|
|
@@ -6945,7 +7188,9 @@ const renderBlock = (block, data, ctx) => {
|
|
|
6945
7188
|
case 'formInfo':
|
|
6946
7189
|
{
|
|
6947
7190
|
return /*#__PURE__*/jsxs(InfoPage.Part, _extends({}, partProps, {
|
|
6948
|
-
children: [renderFieldsContent(block.list, data, formatMessage, block.column
|
|
7191
|
+
children: [renderFieldsContent(block.list, data, formatMessage, block.column, {
|
|
7192
|
+
showIndex: !!block.showIndex
|
|
7193
|
+
}), renderBlockList(block.blocks, data, nextCtx)]
|
|
6949
7194
|
}));
|
|
6950
7195
|
}
|
|
6951
7196
|
case 'object':
|
|
@@ -6987,13 +7232,21 @@ const renderBlock = (block, data, ctx) => {
|
|
|
6987
7232
|
};
|
|
6988
7233
|
const content = Array.isArray(values) ? values.map(item => formatFieldValue(itemField, item, formatMessage)).join('、') : formatFieldValue(itemField, values, formatMessage);
|
|
6989
7234
|
return /*#__PURE__*/jsx(InfoPage.Part, _extends({}, partProps, {
|
|
6990
|
-
children: /*#__PURE__*/jsx(
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
7235
|
+
children: /*#__PURE__*/jsx("div", {
|
|
7236
|
+
className: style['schema-content-fields'],
|
|
7237
|
+
style: {
|
|
7238
|
+
'--schema-content-cols': 1
|
|
7239
|
+
},
|
|
7240
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
7241
|
+
className: [style['schema-content-field'], style['schema-content-field-block']].join(' '),
|
|
7242
|
+
children: [block.label || block.name ? /*#__PURE__*/jsx("div", {
|
|
7243
|
+
className: style['schema-content-field-label'],
|
|
7244
|
+
children: (block.label || block.name) + ':'
|
|
7245
|
+
}) : null, /*#__PURE__*/jsx("div", {
|
|
7246
|
+
className: style['schema-content-field-value'],
|
|
7247
|
+
children: content
|
|
7248
|
+
})]
|
|
7249
|
+
})
|
|
6997
7250
|
})
|
|
6998
7251
|
}));
|
|
6999
7252
|
}
|
|
@@ -7084,5 +7337,5 @@ const SchemaContent = withLocale$1(({
|
|
|
7084
7337
|
});
|
|
7085
7338
|
var SchemaContent$1 = SchemaContent;
|
|
7086
7339
|
|
|
7087
|
-
export { FormCreator$1 as FormCreator, MAX_BLOCK_DEPTH, RULE_LEN_PRESET, RULE_PRESET_ITEMS, SchemaContent$1 as SchemaContent, SchemaContentInner, SchemaRenderer$1 as SchemaRenderer, SchemaRendererInner, applyFromPropsSchema, blockToFormValues, buildRuleString, collectBlockFieldNames, collectSchemaFields, createBlock, createChoiceOption, createField$1 as createField, createFieldId, createStep, FormCreator$1 as default, defaultFormActions, defaultSchema, fieldToFormValues, findBlock, findBlockInTree, formValuesToBlock, formValuesToField, formatByValueSchema, formatFieldDisplayValue, getBlockDefinition, getBlockKindOptions, getFieldComponent, getFieldDefinition, getFieldTypes, getRulePresetItems, hasRenderableContent, isFieldNameUnique, mapBlocks, moveBlockInTree, moveItem, normalizeBlock, normalizeFormActions, normalizeOptions, normalizeSchema, parseRuleString, pickFieldProps, pickFromPropsSchema, preset, removeBlockInTree, resolveFieldValueSchema, schemaToDataSchema, updateBlocks };
|
|
7340
|
+
export { FormCreator$1 as FormCreator, MAX_BLOCK_DEPTH, RULE_LEN_PRESET, RULE_PRESET_ITEMS, SchemaContent$1 as SchemaContent, SchemaContentInner, SchemaRenderer$1 as SchemaRenderer, SchemaRendererInner, applyFromPropsSchema, blockToFormValues, buildRuleString, collectBlockFieldNames, collectSchemaFields, createBlock, createChoiceOption, createField$1 as createField, createFieldId, createStep, FormCreator$1 as default, defaultFormActions, defaultSchema, fieldToFormValues, findBlock, findBlockInTree, formValuesToBlock, formValuesToField, formatByValueSchema, formatFieldDisplayValue, getBlockDefinition, getBlockKindOptions, getFieldComponent, getFieldDefinition, getFieldTypes, getRulePresetItems, hasRenderableContent, isFieldNameUnique, mapBlocks, moveBlockInTree, moveItem, normalizeBlock, normalizeFormActions, normalizeOptions, normalizeSchema, parseRuleString, pickFieldProps, pickFromPropsSchema, preset, registerField, removeBlockInTree, resolveFieldTypeLabel, resolveFieldValueSchema, schemaToDataSchema, updateBlocks };
|
|
7088
7341
|
//# sourceMappingURL=index.modern.js.map
|