@kne/form-creator 0.1.21 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -5
- package/dist/index.css +4 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +622 -697
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +218 -93
- package/dist/index.modern.js.map +1 -1
- package/dist/locale/en-US.js +18 -0
- package/dist/locale/en-US.js.map +1 -1
- package/dist/locale/en-US.modern.js +18 -0
- package/dist/locale/en-US.modern.js.map +1 -1
- package/dist/locale/zh-CN.js +18 -0
- package/dist/locale/zh-CN.js.map +1 -1
- package/dist/locale/zh-CN.modern.js +18 -0
- package/dist/locale/zh-CN.modern.js.map +1 -1
- package/package.json +3 -3
package/dist/index.modern.js
CHANGED
|
@@ -5,19 +5,19 @@ import { useState, useRef, useMemo, useEffect, useCallback, createElement, Fragm
|
|
|
5
5
|
import { Space, Tag, Button, Typography, Flex, Dropdown, Empty, message, Checkbox as Checkbox$1, Input as Input$1, InputNumber as InputNumber$1, Card, Tooltip } from 'antd';
|
|
6
6
|
import { createWithIntlProvider, useIntl } from '@kne/react-intl';
|
|
7
7
|
import { useIsMobile, RESPONSIVE_BOUNDARY_CLASS } from '@kne/responsive-utils';
|
|
8
|
-
import { ArrowUpOutlined, ArrowDownOutlined, EditOutlined, DeleteOutlined, PlusOutlined, SettingOutlined, FormOutlined, UnorderedListOutlined, TableOutlined, ClusterOutlined, PartitionOutlined, AppstoreOutlined, OrderedListOutlined, SelectOutlined, ApartmentOutlined, ArrowLeftOutlined, ArrowRightOutlined, QuestionCircleOutlined } from '@ant-design/icons';
|
|
8
|
+
import { ArrowUpOutlined, ArrowDownOutlined, EditOutlined, DeleteOutlined, PlusOutlined, SettingOutlined, FormOutlined, UnorderedListOutlined, TableOutlined, ProfileOutlined, ClusterOutlined, PartitionOutlined, AppstoreOutlined, OrderedListOutlined, SelectOutlined, ApartmentOutlined, ArrowLeftOutlined, ArrowRightOutlined, QuestionCircleOutlined } from '@ant-design/icons';
|
|
9
9
|
import { hooks, Input, TextArea, InputNumber, Select, RadioGroup, CheckboxGroup, Switch, Checkbox, DatePicker, useFormContext, Slider, SubmitButton, ResetButton, CancelButton, RULES, preset as preset$1 } from '@kne/react-form-antd';
|
|
10
10
|
import SelectList, { SelectTableList, SelectTree, SelectCascader } from '@kne/super-select';
|
|
11
11
|
import { SelectFunction, SelectIndustry, SelectAddress } from '@kne/super-select-plus';
|
|
12
12
|
import '@kne/super-select/dist/index.css';
|
|
13
13
|
import '@kne/super-select-plus/dist/index.css';
|
|
14
14
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
15
|
-
import FormInfo, { FormModal, Form, Steps, MultiField, TableList, List } from '@kne/form-info';
|
|
15
|
+
import FormInfo, { FormModal, Form, Steps, MultiField, EditableList, TableList, List } from '@kne/form-info';
|
|
16
16
|
import { ButtonFooter } from '@kne/button-group';
|
|
17
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","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"};
|
|
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-editableList":"kne-form-creator_JzwrQ","block-kind-multiField":"kne-form-creator_t0iOJ","block-kind-steps":"kne-form-creator_QNF9W","step-section":"kne-form-creator_22ajp","block-section-header":"kne-form-creator_wS4rL","block-header-left":"kne-form-creator_t4awC","block-title":"kne-form-creator_wSVJf","block-summary":"kne-form-creator_GzeW8","block-header-actions":"kne-form-creator_Ue-nT","block-body":"kne-form-creator_je1H0","item-blocks-section":"kne-form-creator_wq4bT","nested-block-list":"kne-form-creator_4NWH4","block-section-nested":"kne-form-creator_mUKom","add-field-dropdown":"kne-form-creator_9JS0d","add-field-dropdown-item":"kne-form-creator_Ql1z3","add-field-dropdown-item-icon":"kne-form-creator_ZHB5O","add-field-dropdown-item-desc":"kne-form-creator_dcsOS","add-field-dropdown-divider":"kne-form-creator_CUK0H","add-field-dropdown-label":"kne-form-creator_bPJ-2","section-toolbar":"kne-form-creator_LUO8S","section-toolbar-label":"kne-form-creator_7KQ79","field-list":"kne-form-creator_-B7WZ","step-list":"kne-form-creator_kc1pH","step-section-header":"kne-form-creator_wkhEX","step-section-title":"kne-form-creator_NBinE","step-section-actions":"kne-form-creator_es-FC","step-index":"kne-form-creator_CCKZZ","field-row":"kne-form-creator_XMkdt","field-row-index":"kne-form-creator_a-cDo","field-row-main":"kne-form-creator_ftlwp","inline-empty":"kne-form-creator_yP-RF","action-group":"kne-form-creator_773yo","hover-reveal":"kne-form-creator_S234h","hover-reveal-active":"kne-form-creator_AE-6r","action-btn":"kne-form-creator_mLgqh","add-block-dropdown":"kne-form-creator_vmS-e","add-block-option":"kne-form-creator_gjg2Y","add-block-option-icon":"kne-form-creator_qh1hh","add-block-option-text":"kne-form-creator_G8iJO","add-block-option-title":"kne-form-creator_ETSvm","add-block-option-desc":"kne-form-creator_O0C3l","field-empty":"kne-form-creator_Nmpfl","field-label-tips-icon":"kne-form-creator_0VVaO","preview-header":"kne-form-creator_c4BT0","preview-title":"kne-form-creator_fPkK4","preview-body":"kne-form-creator_6JntQ","schema-form":"kne-form-creator_MxCWP","schema-body":"kne-form-creator_q9ydz","schema-actions":"kne-form-creator_Y4eEH","schema-actions-inner":"kne-form-creator_FT9Zf","choice-block":"kne-form-creator_RllJe","choice-selector":"kne-form-creator_5A1eM","choice-panels":"kne-form-creator_IO0MY","choice-panels-empty":"kne-form-creator_T0nND","choice-option-panel":"kne-form-creator_FQixN","choice-option-panel-title":"kne-form-creator_ofRo2","choice-option-summary":"kne-form-creator_pksH8","field-editor-form":"kne-form-creator_PGPHL","form-actions-editor":"kne-form-creator_fchMy","form-actions-switch-field":"kne-form-creator_6JE9x","form-actions-layout-panel":"kne-form-creator_rtm9D","form-actions-align-group":"kne-form-creator_51ZsV","form-actions-layout-title":"kne-form-creator_hFeiC","form-actions-gap-slider":"kne-form-creator_Gq0bk","editor-section":"kne-form-creator_jJy85","section-divider":"kne-form-creator_zA7L-","rule-editor":"kne-form-creator_bAlGU","options-editor":"kne-form-creator_AK4yO","super-select-props":"kne-form-creator_Iawhh","field-props-editor":"kne-form-creator_Gabf2","columns-editor":"kne-form-creator_DQW1N","prop-row":"kne-form-creator_7K54P","prop-label":"kne-form-creator_HAAyH","options-item":"kne-form-creator_dnOd2","table-row-card":"kne-form-creator_cwCYp","tree-options-editor":"kne-form-creator_s3nHO","tree-options-list":"kne-form-creator_Djs-E","tree-option-node":"kne-form-creator_XAcut","tree-option-row":"kne-form-creator_4K4Rj","tree-option-fields":"kne-form-creator_-4cjc","tree-option-actions":"kne-form-creator_IjCNI","tree-option-children":"kne-form-creator_pVPGJ","tree-add-sibling":"kne-form-creator_bl46P","rule-checkbox-group":"kne-form-creator_tDgVP","rule-len-row":"kne-form-creator_ATsae","rule-len-input":"kne-form-creator_jY4Ld","rule-len-sep":"kne-form-creator_jBDC8","options-list":"kne-form-creator_GUBNS","options-row":"kne-form-creator_uohD0","options-tip":"kne-form-creator_vrTmK","icon-square-btn":"kne-form-creator_DZjCf","icon-square-btn-sm":"kne-form-creator_GAh-t","is-mobile":"kne-form-creator_LtgJz"};
|
|
21
21
|
|
|
22
22
|
function _extends() {
|
|
23
23
|
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
@@ -63,10 +63,19 @@ const locale$1 = {
|
|
|
63
63
|
blockKind_formInfo: '基础表单',
|
|
64
64
|
blockKind_list: '可增减列表',
|
|
65
65
|
blockKind_tableList: '表格列表',
|
|
66
|
+
blockKind_editableList: '行内编辑列表',
|
|
66
67
|
blockKind_multiField: '同类多值',
|
|
67
68
|
blockKind_object: '分组信息',
|
|
68
69
|
blockKind_choice: '选项切换',
|
|
69
70
|
blockKind_steps: '分步表单',
|
|
71
|
+
blockKindDesc_formInfo: '最常用的表单模块,可设置标题、列数和间距',
|
|
72
|
+
blockKindDesc_list: '用户可以动态添加或删除多条记录,例如工作经历',
|
|
73
|
+
blockKindDesc_tableList: '以表格形式展示的可增减列表',
|
|
74
|
+
blockKindDesc_editableList: '每条记录只读展示,点击编辑后单独填写并保存;数据量大时不卡顿',
|
|
75
|
+
blockKindDesc_multiField: '同一种填写项可以输入多个值,例如多个手机号',
|
|
76
|
+
blockKindDesc_object: '把相关的填写项放在一起,例如「在校时间」下的开始与结束',
|
|
77
|
+
blockKindDesc_choice: '先选一类情况,再填写对应内容;可设为单选或多选',
|
|
78
|
+
blockKindDesc_steps: '将表单拆分成多个步骤,引导用户逐步填写',
|
|
70
79
|
choiceMode: '可选几个',
|
|
71
80
|
choiceModeSingle: '只能选一个',
|
|
72
81
|
choiceModeMultiple: '可以选多个',
|
|
@@ -108,6 +117,10 @@ const locale$1 = {
|
|
|
108
117
|
blockAddTextPlaceholder: '例如:添加一条工作经历',
|
|
109
118
|
blockMaxLength: '最多条数',
|
|
110
119
|
blockMinLength: '最少条数',
|
|
120
|
+
blockAddPosition: '添加按钮位置',
|
|
121
|
+
blockAddPosition_bottom: '列表底部(追加到末尾)',
|
|
122
|
+
blockAddPosition_top: '标题右侧(插入到第一项)',
|
|
123
|
+
blockAddPosition_both: '两处都显示',
|
|
111
124
|
blockAutoStep: '填写完成后自动进入下一步',
|
|
112
125
|
multiFieldType: '填写项类型',
|
|
113
126
|
multiFieldSummary: '填写类型:{type}',
|
|
@@ -145,6 +158,7 @@ const locale$1 = {
|
|
|
145
158
|
FieldTypeSwitch: '开关',
|
|
146
159
|
FieldTypeCheckbox: '复选框',
|
|
147
160
|
FieldTypeDatePicker: '日期',
|
|
161
|
+
extendedFieldPlaceholder: '请选择{label}',
|
|
148
162
|
fieldName: '保存用的名称',
|
|
149
163
|
fieldNamePlaceholder: '已自动生成,可修改',
|
|
150
164
|
fieldLabel: '显示名称',
|
|
@@ -239,12 +253,16 @@ const locale$1 = {
|
|
|
239
253
|
propDatePickerQuarter: '季度',
|
|
240
254
|
propDatePickerYear: '年份',
|
|
241
255
|
propDateFormat: '显示格式',
|
|
256
|
+
propDateFormatLocalized: 'YYYY年MM月DD日',
|
|
242
257
|
propShowTime: '同时选择时间',
|
|
243
258
|
propSwitchOnText: '打开时显示的文字',
|
|
244
259
|
propSwitchOffText: '关闭时显示的文字',
|
|
245
260
|
propSwitchOnTextHint: '例如:开',
|
|
246
261
|
propSwitchOffTextHint: '例如:关',
|
|
247
262
|
propOptionsInline: '选项横向排列',
|
|
263
|
+
rulePresetREQ: '必填',
|
|
264
|
+
rulePresetTEL: '手机号格式',
|
|
265
|
+
rulePresetEMAIL: '邮箱格式',
|
|
248
266
|
ruleLen: '长度限制',
|
|
249
267
|
ruleLenRange: '长度范围',
|
|
250
268
|
ruleLenMin: '最少字数',
|
|
@@ -262,7 +280,7 @@ const locale$1 = {
|
|
|
262
280
|
schemaContentUntilToday: '至今',
|
|
263
281
|
schemaContentPasswordMasked: '••••••'
|
|
264
282
|
};
|
|
265
|
-
var
|
|
283
|
+
var defaultLocale = locale$1;
|
|
266
284
|
|
|
267
285
|
const locale = {
|
|
268
286
|
addField: 'Add Field',
|
|
@@ -289,10 +307,19 @@ const locale = {
|
|
|
289
307
|
blockKind_formInfo: 'Basic Form',
|
|
290
308
|
blockKind_list: 'Repeatable List',
|
|
291
309
|
blockKind_tableList: 'Table List',
|
|
310
|
+
blockKind_editableList: 'Inline Edit List',
|
|
292
311
|
blockKind_multiField: 'Multi-Value',
|
|
293
312
|
blockKind_object: 'Grouped Fields',
|
|
294
313
|
blockKind_choice: 'Options',
|
|
295
314
|
blockKind_steps: 'Step-by-Step',
|
|
315
|
+
blockKindDesc_formInfo: 'The most common section; set its title, columns and spacing',
|
|
316
|
+
blockKindDesc_list: 'Users can add or remove multiple records, e.g. work experience',
|
|
317
|
+
blockKindDesc_tableList: 'A repeatable list displayed as a table',
|
|
318
|
+
blockKindDesc_editableList: 'Records are shown read-only; click edit to fill in and save each one. Stays fast with lots of data',
|
|
319
|
+
blockKindDesc_multiField: 'Enter multiple values for the same field, e.g. several phone numbers',
|
|
320
|
+
blockKindDesc_object: 'Group related fields together, e.g. start and end under "School period"',
|
|
321
|
+
blockKindDesc_choice: 'Pick a case first, then fill in the matching content; single or multiple selection',
|
|
322
|
+
blockKindDesc_steps: 'Split the form into steps to guide users through it',
|
|
296
323
|
choiceMode: 'How many can be selected',
|
|
297
324
|
choiceModeSingle: 'One only',
|
|
298
325
|
choiceModeMultiple: 'More than one',
|
|
@@ -334,6 +361,10 @@ const locale = {
|
|
|
334
361
|
blockAddTextPlaceholder: 'e.g. Add Work Experience',
|
|
335
362
|
blockMaxLength: 'Max Entries',
|
|
336
363
|
blockMinLength: 'Min Entries',
|
|
364
|
+
blockAddPosition: 'Add Button Position',
|
|
365
|
+
blockAddPosition_bottom: 'Bottom (append to end)',
|
|
366
|
+
blockAddPosition_top: 'Title right (insert as first)',
|
|
367
|
+
blockAddPosition_both: 'Both',
|
|
337
368
|
blockAutoStep: 'Auto proceed to next step after completion',
|
|
338
369
|
multiFieldType: 'Field Type',
|
|
339
370
|
multiFieldSummary: 'Field type: {type}',
|
|
@@ -371,6 +402,7 @@ const locale = {
|
|
|
371
402
|
FieldTypeSwitch: 'Switch',
|
|
372
403
|
FieldTypeCheckbox: 'Checkbox',
|
|
373
404
|
FieldTypeDatePicker: 'Date',
|
|
405
|
+
extendedFieldPlaceholder: 'Please select {label}',
|
|
374
406
|
fieldName: 'Save name',
|
|
375
407
|
fieldNamePlaceholder: 'Auto-generated, editable',
|
|
376
408
|
fieldLabel: 'Display Name',
|
|
@@ -465,12 +497,16 @@ const locale = {
|
|
|
465
497
|
propDatePickerQuarter: 'Quarter',
|
|
466
498
|
propDatePickerYear: 'Year',
|
|
467
499
|
propDateFormat: 'Display format',
|
|
500
|
+
propDateFormatLocalized: 'MMM D, YYYY',
|
|
468
501
|
propShowTime: 'Include time',
|
|
469
502
|
propSwitchOnText: 'Text when on',
|
|
470
503
|
propSwitchOffText: 'Text when off',
|
|
471
504
|
propSwitchOnTextHint: 'e.g. On',
|
|
472
505
|
propSwitchOffTextHint: 'e.g. Off',
|
|
473
506
|
propOptionsInline: 'Arrange options horizontally',
|
|
507
|
+
rulePresetREQ: 'Required',
|
|
508
|
+
rulePresetTEL: 'Phone number format',
|
|
509
|
+
rulePresetEMAIL: 'Email format',
|
|
474
510
|
ruleLen: 'Length Limit',
|
|
475
511
|
ruleLenRange: 'Length Range',
|
|
476
512
|
ruleLenMin: 'Min',
|
|
@@ -493,7 +529,7 @@ var enUS = locale;
|
|
|
493
529
|
const withLocale = createWithIntlProvider({
|
|
494
530
|
defaultLocale: 'zh-CN',
|
|
495
531
|
messages: {
|
|
496
|
-
'zh-CN':
|
|
532
|
+
'zh-CN': defaultLocale,
|
|
497
533
|
'en-US': enUS
|
|
498
534
|
},
|
|
499
535
|
namespace: 'form-creator'
|
|
@@ -506,6 +542,10 @@ const createFieldId = () => `field_${Date.now()}_${Math.random().toString(36).sl
|
|
|
506
542
|
const createDataKey = (prefix = 'field') => `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`;
|
|
507
543
|
const isAutoDataKey = (value, prefix = 'field') => new RegExp(`^${prefix}_[a-z0-9]+_[a-z0-9]+$`, 'i').test(String(value || '').trim());
|
|
508
544
|
const MAX_BLOCK_DEPTH = 14;
|
|
545
|
+
|
|
546
|
+
/** 列表项内可挂子模块(itemBlocks)的模块类型 */
|
|
547
|
+
const ITEM_BLOCK_KINDS = ['list', 'editableList'];
|
|
548
|
+
const supportsItemBlocks = kind => ITEM_BLOCK_KINDS.includes(kind);
|
|
509
549
|
const createEmptyColumn = () => ({
|
|
510
550
|
title: '',
|
|
511
551
|
name: createDataKey('col'),
|
|
@@ -576,7 +616,7 @@ const createChoiceOption = (overrides = {}) => _extends({
|
|
|
576
616
|
blocks: []
|
|
577
617
|
}, overrides);
|
|
578
618
|
const createBlock = (kind, overrides = {}) => {
|
|
579
|
-
const needsName = ['list', 'tableList', 'multiField', 'object'].includes(kind);
|
|
619
|
+
const needsName = ['list', 'tableList', 'editableList', 'multiField', 'object'].includes(kind);
|
|
580
620
|
const base = {
|
|
581
621
|
id: createFieldId(),
|
|
582
622
|
kind,
|
|
@@ -629,17 +669,13 @@ const createBlock = (kind, overrides = {}) => {
|
|
|
629
669
|
blocks: undefined,
|
|
630
670
|
items: undefined,
|
|
631
671
|
name: '',
|
|
632
|
-
options: [createChoiceOption(
|
|
633
|
-
title: '选项1'
|
|
634
|
-
})]
|
|
672
|
+
options: [createChoiceOption()]
|
|
635
673
|
}, overrides, {
|
|
636
674
|
kind: 'choice'
|
|
637
675
|
});
|
|
638
676
|
next.mode = next.mode === 'multiple' ? 'multiple' : 'single';
|
|
639
677
|
if (!Array.isArray(next.options)) {
|
|
640
|
-
next.options = [createChoiceOption(
|
|
641
|
-
title: '选项1'
|
|
642
|
-
})];
|
|
678
|
+
next.options = [createChoiceOption()];
|
|
643
679
|
}
|
|
644
680
|
return next;
|
|
645
681
|
}
|
|
@@ -650,7 +686,7 @@ const createBlock = (kind, overrides = {}) => {
|
|
|
650
686
|
itemBlocks: undefined
|
|
651
687
|
}, overrides);
|
|
652
688
|
}
|
|
653
|
-
if (kind
|
|
689
|
+
if (supportsItemBlocks(kind)) {
|
|
654
690
|
return _extends({}, base, {
|
|
655
691
|
blocks: undefined
|
|
656
692
|
}, overrides);
|
|
@@ -769,7 +805,7 @@ const normalizeBlock = (block, depth = 0) => {
|
|
|
769
805
|
normalized.list = Array.isArray(block.list) ? block.list.map(normalizeField) : [];
|
|
770
806
|
normalized.items = undefined;
|
|
771
807
|
normalized.options = undefined;
|
|
772
|
-
if (kind
|
|
808
|
+
if (supportsItemBlocks(kind)) {
|
|
773
809
|
normalized.itemBlocks = Array.isArray(block.itemBlocks) ? block.itemBlocks.map(child => normalizeBlock(child, depth + 1)) : [];
|
|
774
810
|
normalized.blocks = undefined;
|
|
775
811
|
} else if (kind === 'tableList') {
|
|
@@ -947,7 +983,7 @@ const collectBlockFieldNames = (blocks = [], {
|
|
|
947
983
|
}
|
|
948
984
|
});
|
|
949
985
|
}
|
|
950
|
-
if (block.kind
|
|
986
|
+
if (supportsItemBlocks(block.kind)) {
|
|
951
987
|
// 列表项内字段相对 GroupList,此处只收集定义名供 choice 清理参考
|
|
952
988
|
walk(block.itemBlocks || [], prefix);
|
|
953
989
|
}
|
|
@@ -1164,53 +1200,65 @@ const hasRenderableContent = schema => {
|
|
|
1164
1200
|
|
|
1165
1201
|
const BLOCK_KINDS = {
|
|
1166
1202
|
formInfo: {
|
|
1167
|
-
|
|
1203
|
+
labelId: 'blockKind_formInfo',
|
|
1168
1204
|
color: 'blue',
|
|
1169
1205
|
hasFieldList: true,
|
|
1170
|
-
|
|
1206
|
+
descriptionId: 'blockKindDesc_formInfo'
|
|
1171
1207
|
},
|
|
1172
1208
|
list: {
|
|
1173
|
-
|
|
1209
|
+
labelId: 'blockKind_list',
|
|
1174
1210
|
color: 'cyan',
|
|
1175
1211
|
hasFieldList: true,
|
|
1176
1212
|
requiresName: true,
|
|
1177
|
-
|
|
1213
|
+
descriptionId: 'blockKindDesc_list'
|
|
1178
1214
|
},
|
|
1179
1215
|
tableList: {
|
|
1180
|
-
|
|
1216
|
+
labelId: 'blockKind_tableList',
|
|
1181
1217
|
color: 'geekblue',
|
|
1182
1218
|
hasFieldList: true,
|
|
1183
1219
|
requiresName: true,
|
|
1184
|
-
|
|
1220
|
+
descriptionId: 'blockKindDesc_tableList'
|
|
1221
|
+
},
|
|
1222
|
+
editableList: {
|
|
1223
|
+
labelId: 'blockKind_editableList',
|
|
1224
|
+
color: 'green',
|
|
1225
|
+
hasFieldList: true,
|
|
1226
|
+
requiresName: true,
|
|
1227
|
+
descriptionId: 'blockKindDesc_editableList'
|
|
1185
1228
|
},
|
|
1186
1229
|
multiField: {
|
|
1187
|
-
|
|
1230
|
+
labelId: 'blockKind_multiField',
|
|
1188
1231
|
color: 'purple',
|
|
1189
1232
|
requiresName: true,
|
|
1190
|
-
|
|
1233
|
+
descriptionId: 'blockKindDesc_multiField'
|
|
1191
1234
|
},
|
|
1192
1235
|
object: {
|
|
1193
|
-
|
|
1236
|
+
labelId: 'blockKind_object',
|
|
1194
1237
|
color: 'orange',
|
|
1195
1238
|
hasFieldList: true,
|
|
1196
1239
|
requiresName: true,
|
|
1197
|
-
|
|
1240
|
+
descriptionId: 'blockKindDesc_object'
|
|
1198
1241
|
},
|
|
1199
1242
|
choice: {
|
|
1200
|
-
|
|
1243
|
+
labelId: 'blockKind_choice',
|
|
1201
1244
|
color: 'magenta',
|
|
1202
1245
|
hasChoiceOptions: true,
|
|
1203
|
-
|
|
1246
|
+
descriptionId: 'blockKindDesc_choice'
|
|
1204
1247
|
},
|
|
1205
1248
|
steps: {
|
|
1206
|
-
|
|
1249
|
+
labelId: 'blockKind_steps',
|
|
1207
1250
|
color: 'gold',
|
|
1208
1251
|
hasSteps: true,
|
|
1209
|
-
|
|
1252
|
+
descriptionId: 'blockKindDesc_steps'
|
|
1210
1253
|
}
|
|
1211
1254
|
};
|
|
1212
|
-
|
|
1213
|
-
|
|
1255
|
+
|
|
1256
|
+
/** editableList 添加按钮位置,与 @kne/form-info EditableList addPosition 一致 */
|
|
1257
|
+
const ADD_POSITIONS = ['bottom', 'top', 'both'];
|
|
1258
|
+
const getBlockKindOptions = formatMessage => Object.entries(BLOCK_KINDS).map(([value, config]) => ({
|
|
1259
|
+
label: typeof formatMessage === 'function' ? formatMessage({
|
|
1260
|
+
id: config.labelId
|
|
1261
|
+
}) : config.labelId,
|
|
1214
1262
|
value
|
|
1215
1263
|
}));
|
|
1216
1264
|
const getBlockDefinition = kind => BLOCK_KINDS[kind];
|
|
@@ -1230,6 +1278,7 @@ const blockToFormValues = block => {
|
|
|
1230
1278
|
addText: block.addText || '',
|
|
1231
1279
|
maxLength: (_block$maxLength = block.maxLength) != null ? _block$maxLength : null,
|
|
1232
1280
|
minLength: (_block$minLength = block.minLength) != null ? _block$minLength : null,
|
|
1281
|
+
addPosition: ADD_POSITIONS.includes(block.addPosition) ? block.addPosition : 'bottom',
|
|
1233
1282
|
fieldType: block.fieldType || 'Input',
|
|
1234
1283
|
autoStep: block.autoStep !== false,
|
|
1235
1284
|
mode: block.mode === 'multiple' ? 'multiple' : 'single',
|
|
@@ -1255,6 +1304,7 @@ const formValuesToBlock = (values, existingBlock = {}) => {
|
|
|
1255
1304
|
addText: values.addText || undefined,
|
|
1256
1305
|
maxLength: (_values$maxLength = values.maxLength) != null ? _values$maxLength : undefined,
|
|
1257
1306
|
minLength: (_values$minLength = values.minLength) != null ? _values$minLength : undefined,
|
|
1307
|
+
addPosition: kind === 'editableList' && ADD_POSITIONS.includes(values.addPosition) && values.addPosition !== 'bottom' ? values.addPosition : undefined,
|
|
1258
1308
|
fieldType: values.fieldType || 'Input',
|
|
1259
1309
|
autoStep: values.autoStep !== false,
|
|
1260
1310
|
mode,
|
|
@@ -1391,10 +1441,13 @@ const {
|
|
|
1391
1441
|
const hasNestedOptions = options => Array.isArray(options) && options.some(item => Array.isArray(item == null ? void 0 : item.children) && item.children.length);
|
|
1392
1442
|
const createField = (Component, {
|
|
1393
1443
|
preferOptions: _preferOptions = false,
|
|
1394
|
-
flattenTree: _flattenTree = false
|
|
1395
|
-
placeholderPrefix: _placeholderPrefix = '请选择'
|
|
1444
|
+
flattenTree: _flattenTree = false
|
|
1396
1445
|
} = {}) => {
|
|
1397
|
-
const
|
|
1446
|
+
const FieldInner = props => {
|
|
1447
|
+
const {
|
|
1448
|
+
formatMessage,
|
|
1449
|
+
locale
|
|
1450
|
+
} = useIntl();
|
|
1398
1451
|
const {
|
|
1399
1452
|
options,
|
|
1400
1453
|
api,
|
|
@@ -1414,11 +1467,16 @@ const createField = (Component, {
|
|
|
1414
1467
|
}) : flattened;
|
|
1415
1468
|
const useOptionsDirectly = _preferOptions || hasNestedOptions(resolvedOptions);
|
|
1416
1469
|
const mergedApi = api || (!useOptionsDirectly && Array.isArray(resolvedOptions) && resolvedOptions.length ? createApiFromOptions(resolvedOptions) : undefined);
|
|
1417
|
-
const resolvedPlaceholder = placeholder != null && String(placeholder).trim() ? placeholder :
|
|
1470
|
+
const resolvedPlaceholder = placeholder != null && String(placeholder).trim() ? placeholder : formatMessage({
|
|
1471
|
+
id: 'extendedFieldPlaceholder'
|
|
1472
|
+
}, {
|
|
1473
|
+
label: props.label || ''
|
|
1474
|
+
}).trim();
|
|
1418
1475
|
const render = useOnChange$1(Object.assign({}, {
|
|
1419
1476
|
isPopup: true,
|
|
1420
1477
|
placeholder: resolvedPlaceholder
|
|
1421
1478
|
}, rest, {
|
|
1479
|
+
locale,
|
|
1422
1480
|
valueKey,
|
|
1423
1481
|
labelKey
|
|
1424
1482
|
}, useOptionsDirectly && Array.isArray(resolvedOptions) ? {
|
|
@@ -1428,6 +1486,7 @@ const createField = (Component, {
|
|
|
1428
1486
|
} : {}));
|
|
1429
1487
|
return render(Component);
|
|
1430
1488
|
};
|
|
1489
|
+
const Field = withLocale$1(FieldInner);
|
|
1431
1490
|
Field.field = Component;
|
|
1432
1491
|
return Field;
|
|
1433
1492
|
};
|
|
@@ -1448,13 +1507,13 @@ const SelectAddressField = createField(SelectAddress);
|
|
|
1448
1507
|
|
|
1449
1508
|
const RULE_PRESET_ITEMS = [{
|
|
1450
1509
|
value: 'REQ',
|
|
1451
|
-
|
|
1510
|
+
labelId: 'rulePresetREQ'
|
|
1452
1511
|
}, {
|
|
1453
1512
|
value: 'TEL',
|
|
1454
|
-
|
|
1513
|
+
labelId: 'rulePresetTEL'
|
|
1455
1514
|
}, {
|
|
1456
1515
|
value: 'EMAIL',
|
|
1457
|
-
|
|
1516
|
+
labelId: 'rulePresetEMAIL'
|
|
1458
1517
|
}];
|
|
1459
1518
|
const DEFAULT_RULE_CONFIG = () => ({
|
|
1460
1519
|
presets: [],
|
|
@@ -2003,7 +2062,7 @@ const getFieldTypes = formatMessage => {
|
|
|
2003
2062
|
});
|
|
2004
2063
|
if (fallback.length) {
|
|
2005
2064
|
grouped.push({
|
|
2006
|
-
label: resolveRegistryLabel(formatMessage, 'FieldGroupExtended'
|
|
2065
|
+
label: resolveRegistryLabel(formatMessage, 'FieldGroupExtended'),
|
|
2007
2066
|
options: fallback
|
|
2008
2067
|
});
|
|
2009
2068
|
}
|
|
@@ -2248,10 +2307,14 @@ const applyFieldProps = (props, values, definition) => {
|
|
|
2248
2307
|
delete props.showTime;
|
|
2249
2308
|
}
|
|
2250
2309
|
if (values.range) {
|
|
2251
|
-
// RangePicker 用数组 placeholder
|
|
2310
|
+
// RangePicker 用数组 placeholder;单框用字符串;未填时交给 RangePicker 按 locale 显示默认提示
|
|
2252
2311
|
const raw = values.placeholder;
|
|
2253
|
-
const text =
|
|
2254
|
-
|
|
2312
|
+
const text = Array.isArray(raw) ? raw[0] : raw;
|
|
2313
|
+
if (text != null && String(text).trim()) {
|
|
2314
|
+
props.placeholder = [text, text];
|
|
2315
|
+
} else {
|
|
2316
|
+
delete props.placeholder;
|
|
2317
|
+
}
|
|
2255
2318
|
} else {
|
|
2256
2319
|
setOptionalString(props, 'placeholder', values.placeholder);
|
|
2257
2320
|
}
|
|
@@ -2490,6 +2553,9 @@ const ROOT_ADD_OPTIONS = [{
|
|
|
2490
2553
|
}, {
|
|
2491
2554
|
key: 'tableList',
|
|
2492
2555
|
icon: /*#__PURE__*/jsx(TableOutlined, {})
|
|
2556
|
+
}, {
|
|
2557
|
+
key: 'editableList',
|
|
2558
|
+
icon: /*#__PURE__*/jsx(ProfileOutlined, {})
|
|
2493
2559
|
}, {
|
|
2494
2560
|
key: 'object',
|
|
2495
2561
|
icon: /*#__PURE__*/jsx(ClusterOutlined, {})
|
|
@@ -2562,7 +2628,9 @@ const BlockListPanel = ({
|
|
|
2562
2628
|
})
|
|
2563
2629
|
}), /*#__PURE__*/jsx("div", {
|
|
2564
2630
|
className: style['add-block-option-desc'],
|
|
2565
|
-
children: definition
|
|
2631
|
+
children: definition ? formatMessage({
|
|
2632
|
+
id: definition.descriptionId
|
|
2633
|
+
}) : null
|
|
2566
2634
|
})]
|
|
2567
2635
|
})]
|
|
2568
2636
|
}, opt.key);
|
|
@@ -2661,9 +2729,11 @@ const BlockListPanel = ({
|
|
|
2661
2729
|
children: formatMessage({
|
|
2662
2730
|
id: `blockKind_${opt.key}`
|
|
2663
2731
|
})
|
|
2664
|
-
}), definition
|
|
2732
|
+
}), definition ? /*#__PURE__*/jsx("span", {
|
|
2665
2733
|
className: style['add-field-dropdown-item-desc'],
|
|
2666
|
-
children:
|
|
2734
|
+
children: formatMessage({
|
|
2735
|
+
id: definition.descriptionId
|
|
2736
|
+
})
|
|
2667
2737
|
}) : null]
|
|
2668
2738
|
}, opt.key);
|
|
2669
2739
|
})]
|
|
@@ -2974,21 +3044,21 @@ const BlockListPanel = ({
|
|
|
2974
3044
|
})]
|
|
2975
3045
|
});
|
|
2976
3046
|
}
|
|
2977
|
-
const supportsItemBlocks = block.kind
|
|
3047
|
+
const supportsItemBlocks$1 = supportsItemBlocks(block.kind);
|
|
2978
3048
|
const supportsBlocks = block.kind === 'formInfo' || block.kind === 'object';
|
|
2979
3049
|
return /*#__PURE__*/jsxs("div", {
|
|
2980
3050
|
className: style['block-body'],
|
|
2981
|
-
children: [renderFieldList(block.list, block.id), supportsItemBlocks ? renderItemBlocks(block, depth) : null, supportsBlocks ? renderNestedBlocks(block.blocks, depth) : null]
|
|
3051
|
+
children: [renderFieldList(block.list, block.id), supportsItemBlocks$1 ? renderItemBlocks(block, depth) : null, supportsBlocks ? renderNestedBlocks(block.blocks, depth) : null]
|
|
2982
3052
|
});
|
|
2983
3053
|
};
|
|
2984
3054
|
const renderBlockSection = (block, blockIndex, total, depth = 0) => {
|
|
2985
3055
|
var _block$itemBlocks, _block$blocks, _block$items2, _block$options2, _block$list, _block$list2;
|
|
2986
3056
|
const definition = getBlockDefinition(block.kind);
|
|
2987
3057
|
const canAddField = block.kind !== 'steps' && block.kind !== 'multiField' && block.kind !== 'choice';
|
|
2988
|
-
const supportsItemBlocks = block.kind
|
|
3058
|
+
const supportsItemBlocks$1 = supportsItemBlocks(block.kind);
|
|
2989
3059
|
const supportsBlocks = block.kind === 'formInfo' || block.kind === 'object';
|
|
2990
|
-
const supportsChildModules = supportsItemBlocks || supportsBlocks;
|
|
2991
|
-
const nestCount = supportsItemBlocks ? ((_block$itemBlocks = block.itemBlocks) == null ? void 0 : _block$itemBlocks.length) || 0 : ((_block$blocks = block.blocks) == null ? void 0 : _block$blocks.length) || 0;
|
|
3060
|
+
const supportsChildModules = supportsItemBlocks$1 || supportsBlocks;
|
|
3061
|
+
const nestCount = supportsItemBlocks$1 ? ((_block$itemBlocks = block.itemBlocks) == null ? void 0 : _block$itemBlocks.length) || 0 : ((_block$blocks = block.blocks) == null ? void 0 : _block$blocks.length) || 0;
|
|
2992
3062
|
const summary = block.kind === 'steps' ? formatMessage({
|
|
2993
3063
|
id: 'stepCount'
|
|
2994
3064
|
}, {
|
|
@@ -3142,7 +3212,8 @@ const BlockConfigFields = ({
|
|
|
3142
3212
|
const definition = getBlockDefinition(kind);
|
|
3143
3213
|
const fieldTypeOptions = useMemo(() => getFieldTypes(formatMessage), [formatMessage]);
|
|
3144
3214
|
const list = [];
|
|
3145
|
-
|
|
3215
|
+
const isListKind = kind === 'list' || kind === 'tableList' || kind === 'editableList';
|
|
3216
|
+
if (kind === 'formInfo' || kind === 'list' || kind === 'tableList' || kind === 'editableList' || kind === 'object') {
|
|
3146
3217
|
list.push(/*#__PURE__*/jsx(Input, {
|
|
3147
3218
|
name: "title",
|
|
3148
3219
|
label: formatMessage({
|
|
@@ -3197,7 +3268,7 @@ const BlockConfigFields = ({
|
|
|
3197
3268
|
children: formatMessage({
|
|
3198
3269
|
id: 'blockImportant'
|
|
3199
3270
|
})
|
|
3200
|
-
}, "important") : null,
|
|
3271
|
+
}, "important") : null, isListKind ? /*#__PURE__*/jsx(Input, {
|
|
3201
3272
|
name: "addText",
|
|
3202
3273
|
label: formatMessage({
|
|
3203
3274
|
id: 'blockAddText'
|
|
@@ -3205,13 +3276,24 @@ const BlockConfigFields = ({
|
|
|
3205
3276
|
placeholder: formatMessage({
|
|
3206
3277
|
id: 'blockAddTextPlaceholder'
|
|
3207
3278
|
})
|
|
3208
|
-
}, "addText") : null, kind === '
|
|
3279
|
+
}, "addText") : null, kind === 'editableList' ? /*#__PURE__*/jsx(Select, {
|
|
3280
|
+
name: "addPosition",
|
|
3281
|
+
label: formatMessage({
|
|
3282
|
+
id: 'blockAddPosition'
|
|
3283
|
+
}),
|
|
3284
|
+
options: ADD_POSITIONS.map(value => ({
|
|
3285
|
+
label: formatMessage({
|
|
3286
|
+
id: `blockAddPosition_${value}`
|
|
3287
|
+
}),
|
|
3288
|
+
value
|
|
3289
|
+
}))
|
|
3290
|
+
}, "addPosition") : null, isListKind ? /*#__PURE__*/jsx(InputNumber, {
|
|
3209
3291
|
name: "maxLength",
|
|
3210
3292
|
label: formatMessage({
|
|
3211
3293
|
id: 'blockMaxLength'
|
|
3212
3294
|
}),
|
|
3213
3295
|
min: 1
|
|
3214
|
-
}, "maxLength") : null,
|
|
3296
|
+
}, "maxLength") : null, isListKind ? /*#__PURE__*/jsx(InputNumber, {
|
|
3215
3297
|
name: "minLength",
|
|
3216
3298
|
label: formatMessage({
|
|
3217
3299
|
id: 'blockMinLength'
|
|
@@ -3367,7 +3449,9 @@ const BlockConfigFields = ({
|
|
|
3367
3449
|
title: formatMessage({
|
|
3368
3450
|
id: `blockKind_${kind}`
|
|
3369
3451
|
}),
|
|
3370
|
-
subtitle: definition
|
|
3452
|
+
subtitle: definition ? formatMessage({
|
|
3453
|
+
id: definition.descriptionId
|
|
3454
|
+
}) : undefined,
|
|
3371
3455
|
column: 1,
|
|
3372
3456
|
list: list.filter(Boolean)
|
|
3373
3457
|
})
|
|
@@ -3387,7 +3471,8 @@ const BlockEditorModal = ({
|
|
|
3387
3471
|
const isEdit = !!(block != null && block.id);
|
|
3388
3472
|
const formData = useMemo(() => blockToFormValues(block || createBlock('formInfo')), [block, open]);
|
|
3389
3473
|
const handleSubmit = async values => {
|
|
3390
|
-
|
|
3474
|
+
var _getBlockDefinition;
|
|
3475
|
+
if ((_getBlockDefinition = getBlockDefinition(block == null ? void 0 : block.kind)) != null && _getBlockDefinition.requiresName && !values.name) {
|
|
3391
3476
|
message.error(formatMessage({
|
|
3392
3477
|
id: 'blockNameRequired'
|
|
3393
3478
|
}));
|
|
@@ -3553,7 +3638,9 @@ const RulePresetEditor = () => {
|
|
|
3553
3638
|
formatMessage
|
|
3554
3639
|
} = useIntl();
|
|
3555
3640
|
const options = [...RULE_PRESET_ITEMS.map(item => ({
|
|
3556
|
-
label: item.
|
|
3641
|
+
label: item.labelId ? formatMessage({
|
|
3642
|
+
id: item.labelId
|
|
3643
|
+
}) : item.label,
|
|
3557
3644
|
value: item.value
|
|
3558
3645
|
})), {
|
|
3559
3646
|
label: formatMessage({
|
|
@@ -4484,8 +4571,12 @@ const buildBuiltinList = (type, formatMessage) => {
|
|
|
4484
4571
|
label: 'YYYY/MM/DD',
|
|
4485
4572
|
value: 'YYYY/MM/DD'
|
|
4486
4573
|
}, {
|
|
4487
|
-
label:
|
|
4488
|
-
|
|
4574
|
+
label: formatMessage({
|
|
4575
|
+
id: 'propDateFormatLocalized'
|
|
4576
|
+
}),
|
|
4577
|
+
value: formatMessage({
|
|
4578
|
+
id: 'propDateFormatLocalized'
|
|
4579
|
+
})
|
|
4489
4580
|
}, {
|
|
4490
4581
|
label: 'YYYY-MM-DD HH:mm:ss',
|
|
4491
4582
|
value: 'YYYY-MM-DD HH:mm:ss'
|
|
@@ -5093,30 +5184,30 @@ const resolveSelectLimits = block => {
|
|
|
5093
5184
|
};
|
|
5094
5185
|
const buildMultipleHint = (formatMessage, minLength, maxLength) => {
|
|
5095
5186
|
if (minLength != null && maxLength != null) {
|
|
5096
|
-
return formatMessage
|
|
5187
|
+
return formatMessage({
|
|
5097
5188
|
id: 'choiceModeHintMultipleRange'
|
|
5098
5189
|
}, {
|
|
5099
5190
|
min: minLength,
|
|
5100
5191
|
max: maxLength
|
|
5101
|
-
})
|
|
5192
|
+
});
|
|
5102
5193
|
}
|
|
5103
5194
|
if (minLength != null) {
|
|
5104
|
-
return formatMessage
|
|
5195
|
+
return formatMessage({
|
|
5105
5196
|
id: 'choiceModeHintMultipleMin'
|
|
5106
5197
|
}, {
|
|
5107
5198
|
count: minLength
|
|
5108
|
-
})
|
|
5199
|
+
});
|
|
5109
5200
|
}
|
|
5110
5201
|
if (maxLength != null) {
|
|
5111
|
-
return formatMessage
|
|
5202
|
+
return formatMessage({
|
|
5112
5203
|
id: 'choiceModeHintMultipleMax'
|
|
5113
5204
|
}, {
|
|
5114
5205
|
count: maxLength
|
|
5115
|
-
})
|
|
5206
|
+
});
|
|
5116
5207
|
}
|
|
5117
|
-
return formatMessage
|
|
5208
|
+
return formatMessage({
|
|
5118
5209
|
id: 'choiceModeHintMultiple'
|
|
5119
|
-
})
|
|
5210
|
+
});
|
|
5120
5211
|
};
|
|
5121
5212
|
|
|
5122
5213
|
/**
|
|
@@ -5142,9 +5233,9 @@ const ChoiceBlock = ({
|
|
|
5142
5233
|
openApi
|
|
5143
5234
|
} = useFormContext() || {};
|
|
5144
5235
|
const titleText = (block == null ? void 0 : block.title) != null ? String(block.title).trim() : '';
|
|
5145
|
-
const title = titleText ||
|
|
5236
|
+
const title = titleText || formatMessage({
|
|
5146
5237
|
id: 'choiceAreaTitle'
|
|
5147
|
-
})
|
|
5238
|
+
});
|
|
5148
5239
|
const bordered = _isMobile ? false : (block == null ? void 0 : block.bordered) || undefined;
|
|
5149
5240
|
const {
|
|
5150
5241
|
minLength,
|
|
@@ -5176,11 +5267,11 @@ const ChoiceBlock = ({
|
|
|
5176
5267
|
return options.map((option, index) => {
|
|
5177
5268
|
const value = String(option.id);
|
|
5178
5269
|
return {
|
|
5179
|
-
label: option.title ||
|
|
5270
|
+
label: option.title || formatMessage({
|
|
5180
5271
|
id: 'choiceOptionFallback'
|
|
5181
5272
|
}, {
|
|
5182
5273
|
index: index + 1
|
|
5183
|
-
})
|
|
5274
|
+
}),
|
|
5184
5275
|
value,
|
|
5185
5276
|
disabled: atMax && !selectedIdsFromValue.includes(value)
|
|
5186
5277
|
};
|
|
@@ -5209,21 +5300,21 @@ const ChoiceBlock = ({
|
|
|
5209
5300
|
if (minLength != null && ids.length < minLength) {
|
|
5210
5301
|
return {
|
|
5211
5302
|
result: false,
|
|
5212
|
-
errMsg: formatMessage
|
|
5303
|
+
errMsg: formatMessage({
|
|
5213
5304
|
id: 'choiceMinSelectError'
|
|
5214
5305
|
}, {
|
|
5215
5306
|
count: minLength
|
|
5216
|
-
})
|
|
5307
|
+
})
|
|
5217
5308
|
};
|
|
5218
5309
|
}
|
|
5219
5310
|
if (maxLength != null && ids.length > maxLength) {
|
|
5220
5311
|
return {
|
|
5221
5312
|
result: false,
|
|
5222
|
-
errMsg: formatMessage
|
|
5313
|
+
errMsg: formatMessage({
|
|
5223
5314
|
id: 'choiceMaxSelectError'
|
|
5224
5315
|
}, {
|
|
5225
5316
|
count: maxLength
|
|
5226
|
-
})
|
|
5317
|
+
})
|
|
5227
5318
|
};
|
|
5228
5319
|
}
|
|
5229
5320
|
return {
|
|
@@ -5236,9 +5327,9 @@ const ChoiceBlock = ({
|
|
|
5236
5327
|
const selectorProps = _extends({
|
|
5237
5328
|
key: `choice-selector-${mode}`,
|
|
5238
5329
|
name: selectorName,
|
|
5239
|
-
label: titleText ||
|
|
5330
|
+
label: titleText || formatMessage({
|
|
5240
5331
|
id: 'choiceAreaTitle'
|
|
5241
|
-
})
|
|
5332
|
+
}),
|
|
5242
5333
|
labelHidden: true,
|
|
5243
5334
|
options: selectorOptions,
|
|
5244
5335
|
onChange: handleChange
|
|
@@ -5269,9 +5360,9 @@ const ChoiceBlock = ({
|
|
|
5269
5360
|
}, option.title) : null, ...nodes));
|
|
5270
5361
|
}
|
|
5271
5362
|
});
|
|
5272
|
-
const modeHint = mode === 'multiple' ? buildMultipleHint(formatMessage, minLength, maxLength) : formatMessage
|
|
5363
|
+
const modeHint = mode === 'multiple' ? buildMultipleHint(formatMessage, minLength, maxLength) : formatMessage({
|
|
5273
5364
|
id: 'choiceModeHintSingle'
|
|
5274
|
-
})
|
|
5365
|
+
});
|
|
5275
5366
|
if (!block) {
|
|
5276
5367
|
return null;
|
|
5277
5368
|
}
|
|
@@ -5287,9 +5378,9 @@ const ChoiceBlock = ({
|
|
|
5287
5378
|
className: style['choice-panels']
|
|
5288
5379
|
}, ...contentChildren) : /*#__PURE__*/createElement('div', {
|
|
5289
5380
|
className: style['choice-panels-empty']
|
|
5290
|
-
}, formatMessage
|
|
5381
|
+
}, formatMessage({
|
|
5291
5382
|
id: 'choiceSelectFirstHint'
|
|
5292
|
-
})
|
|
5383
|
+
})));
|
|
5293
5384
|
};
|
|
5294
5385
|
var ChoiceBlock$1 = ChoiceBlock;
|
|
5295
5386
|
|
|
@@ -5513,6 +5604,29 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
|
|
|
5513
5604
|
className: resolvePartRootClassName(depth)
|
|
5514
5605
|
})), asListItem);
|
|
5515
5606
|
}
|
|
5607
|
+
case 'editableList':
|
|
5608
|
+
{
|
|
5609
|
+
const fields = renderFieldElements(block.list, preview, fieldRenderOpts);
|
|
5610
|
+
const nested = renderItemBlocks(block.itemBlocks || []);
|
|
5611
|
+
return withBlockLayout(/*#__PURE__*/createElement(EditableList, _extends({
|
|
5612
|
+
key: block.id,
|
|
5613
|
+
name: block.name,
|
|
5614
|
+
title: block.title || undefined,
|
|
5615
|
+
bordered,
|
|
5616
|
+
className: resolvePartRootClassName(depth),
|
|
5617
|
+
column: block.column,
|
|
5618
|
+
maxLength: block.maxLength,
|
|
5619
|
+
minLength: block.minLength
|
|
5620
|
+
}, block.addPosition ? {
|
|
5621
|
+
addPosition: block.addPosition
|
|
5622
|
+
} : {}, block.addText ? {
|
|
5623
|
+
addText: block.addText
|
|
5624
|
+
} : {}, typeof block.itemTitle === 'function' || block.itemTitle ? {
|
|
5625
|
+
itemTitle: block.itemTitle
|
|
5626
|
+
} : {}, {
|
|
5627
|
+
list: [...fields, ...nested]
|
|
5628
|
+
})), asListItem);
|
|
5629
|
+
}
|
|
5516
5630
|
case 'multiField':
|
|
5517
5631
|
{
|
|
5518
5632
|
const FieldComponent = getFieldComponent(block.fieldType);
|
|
@@ -5906,7 +6020,15 @@ const FormCreator = withLocale$1(({
|
|
|
5906
6020
|
stepId,
|
|
5907
6021
|
optionId
|
|
5908
6022
|
} = {}) => {
|
|
5909
|
-
setEditingBlock(createBlock(kind
|
|
6023
|
+
setEditingBlock(createBlock(kind, kind === 'choice' ? {
|
|
6024
|
+
options: [createChoiceOption({
|
|
6025
|
+
title: formatMessage({
|
|
6026
|
+
id: 'choiceOptionFallback'
|
|
6027
|
+
}, {
|
|
6028
|
+
index: 1
|
|
6029
|
+
})
|
|
6030
|
+
})]
|
|
6031
|
+
} : undefined));
|
|
5910
6032
|
setBlockParentId(parentBlockId || null);
|
|
5911
6033
|
setBlockParentStepId(stepId || null);
|
|
5912
6034
|
setBlockParentOptionId(optionId || null);
|
|
@@ -5937,7 +6059,7 @@ const FormCreator = withLocale$1(({
|
|
|
5937
6059
|
})));
|
|
5938
6060
|
} else if (blockParentId) {
|
|
5939
6061
|
updateSchema(mapBlocks(schema, blockParentId, parent => {
|
|
5940
|
-
if (parent.kind
|
|
6062
|
+
if (supportsItemBlocks(parent.kind)) {
|
|
5941
6063
|
return _extends({}, parent, {
|
|
5942
6064
|
itemBlocks: [...(parent.itemBlocks || []), block]
|
|
5943
6065
|
});
|
|
@@ -6559,7 +6681,7 @@ const formatDateToToday = (value, itemSchema, ctx) => {
|
|
|
6559
6681
|
if (items[1] == null || items[1] === '' || items[1] === true) {
|
|
6560
6682
|
const until = (ctx.formatMessage == null ? void 0 : ctx.formatMessage({
|
|
6561
6683
|
id: 'schemaContentUntilToday'
|
|
6562
|
-
})) ||
|
|
6684
|
+
})) || defaultLocale.schemaContentUntilToday;
|
|
6563
6685
|
return [start, until].filter(Boolean).join(' ~ ');
|
|
6564
6686
|
}
|
|
6565
6687
|
const end = formatByValueSchema(items[1], itemSchema, ctx);
|
|
@@ -6614,11 +6736,11 @@ const formatBoolean = (value, field, ctx) => {
|
|
|
6614
6736
|
if (value) {
|
|
6615
6737
|
return props.checkedChildren || (ctx.formatMessage == null ? void 0 : ctx.formatMessage({
|
|
6616
6738
|
id: 'schemaContentYes'
|
|
6617
|
-
})) ||
|
|
6739
|
+
})) || defaultLocale.schemaContentYes;
|
|
6618
6740
|
}
|
|
6619
6741
|
return props.unCheckedChildren || (ctx.formatMessage == null ? void 0 : ctx.formatMessage({
|
|
6620
6742
|
id: 'schemaContentNo'
|
|
6621
|
-
})) ||
|
|
6743
|
+
})) || defaultLocale.schemaContentNo;
|
|
6622
6744
|
};
|
|
6623
6745
|
const stringifyFallback = value => {
|
|
6624
6746
|
if (value == null) {
|
|
@@ -6923,6 +7045,7 @@ const walkBlock = (block, layer, depth = 0) => {
|
|
|
6923
7045
|
}
|
|
6924
7046
|
case 'list':
|
|
6925
7047
|
case 'tableList':
|
|
7048
|
+
case 'editableList':
|
|
6926
7049
|
{
|
|
6927
7050
|
const name = block.name != null && String(block.name).trim() ? String(block.name).trim() : '';
|
|
6928
7051
|
if (!name) {
|
|
@@ -6930,7 +7053,7 @@ const walkBlock = (block, layer, depth = 0) => {
|
|
|
6930
7053
|
}
|
|
6931
7054
|
const itemLayer = createObjectLayer();
|
|
6932
7055
|
mergeFieldsIntoLayer(itemLayer, block.list);
|
|
6933
|
-
if (block.kind
|
|
7056
|
+
if (supportsItemBlocks(block.kind)) {
|
|
6934
7057
|
walkBlocks(block.itemBlocks, itemLayer, depth + 1);
|
|
6935
7058
|
}
|
|
6936
7059
|
const items = finalizeObjectSchema(itemLayer);
|
|
@@ -7002,14 +7125,15 @@ const mergeChoiceIntoLayer = (layer, block, depth) => {
|
|
|
7002
7125
|
const selectorName = resolveChoiceSelectorName$1(block);
|
|
7003
7126
|
const options = block.options || [];
|
|
7004
7127
|
const optionIds = options.map(option => String(option.id));
|
|
7005
|
-
const branches = options.map(
|
|
7128
|
+
const branches = options.map(option => {
|
|
7006
7129
|
const branch = createObjectLayer();
|
|
7007
|
-
const optionTitle = option.title ||
|
|
7130
|
+
const optionTitle = option.title || undefined;
|
|
7008
7131
|
if (selectorInData && mode === 'single') {
|
|
7009
|
-
branch.properties[selectorName] = {
|
|
7010
|
-
const: String(option.id)
|
|
7132
|
+
branch.properties[selectorName] = _extends({
|
|
7133
|
+
const: String(option.id)
|
|
7134
|
+
}, optionTitle ? {
|
|
7011
7135
|
title: optionTitle
|
|
7012
|
-
};
|
|
7136
|
+
} : {});
|
|
7013
7137
|
branch.required.push(selectorName);
|
|
7014
7138
|
}
|
|
7015
7139
|
mergeFieldsIntoLayer(branch, option.list, {
|
|
@@ -7203,6 +7327,7 @@ const renderBlock = (block, data, ctx) => {
|
|
|
7203
7327
|
}
|
|
7204
7328
|
case 'list':
|
|
7205
7329
|
case 'tableList':
|
|
7330
|
+
case 'editableList':
|
|
7206
7331
|
{
|
|
7207
7332
|
const name = block.name != null && String(block.name).trim() ? String(block.name).trim() : '';
|
|
7208
7333
|
const items = name ? getByPath(data, name) : null;
|
|
@@ -7215,7 +7340,7 @@ const renderBlock = (block, data, ctx) => {
|
|
|
7215
7340
|
index: index + 1
|
|
7216
7341
|
}),
|
|
7217
7342
|
bordered: false,
|
|
7218
|
-
children: [renderFieldsContent(block.list, item || {}, formatMessage, 2), block.kind
|
|
7343
|
+
children: [renderFieldsContent(block.list, item || {}, formatMessage, 2), supportsItemBlocks(block.kind) ? renderBlockList(block.itemBlocks, item || {}, nextCtx) : null]
|
|
7219
7344
|
}, `${block.id}-${index}`)) : formatMessage({
|
|
7220
7345
|
id: 'schemaContentEmptyValue'
|
|
7221
7346
|
})
|