@kne/form-creator 0.1.22 → 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/dist/index.js +538 -681
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +133 -75
- package/dist/index.modern.js.map +1 -1
- package/dist/locale/en-US.js +13 -0
- package/dist/locale/en-US.js.map +1 -1
- package/dist/locale/en-US.modern.js +13 -0
- package/dist/locale/en-US.modern.js.map +1 -1
- package/dist/locale/zh-CN.js +13 -0
- package/dist/locale/zh-CN.js.map +1 -1
- package/dist/locale/zh-CN.modern.js +13 -0
- package/dist/locale/zh-CN.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -68,6 +68,14 @@ const locale$1 = {
|
|
|
68
68
|
blockKind_object: '分组信息',
|
|
69
69
|
blockKind_choice: '选项切换',
|
|
70
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: '将表单拆分成多个步骤,引导用户逐步填写',
|
|
71
79
|
choiceMode: '可选几个',
|
|
72
80
|
choiceModeSingle: '只能选一个',
|
|
73
81
|
choiceModeMultiple: '可以选多个',
|
|
@@ -150,6 +158,7 @@ const locale$1 = {
|
|
|
150
158
|
FieldTypeSwitch: '开关',
|
|
151
159
|
FieldTypeCheckbox: '复选框',
|
|
152
160
|
FieldTypeDatePicker: '日期',
|
|
161
|
+
extendedFieldPlaceholder: '请选择{label}',
|
|
153
162
|
fieldName: '保存用的名称',
|
|
154
163
|
fieldNamePlaceholder: '已自动生成,可修改',
|
|
155
164
|
fieldLabel: '显示名称',
|
|
@@ -244,12 +253,16 @@ const locale$1 = {
|
|
|
244
253
|
propDatePickerQuarter: '季度',
|
|
245
254
|
propDatePickerYear: '年份',
|
|
246
255
|
propDateFormat: '显示格式',
|
|
256
|
+
propDateFormatLocalized: 'YYYY年MM月DD日',
|
|
247
257
|
propShowTime: '同时选择时间',
|
|
248
258
|
propSwitchOnText: '打开时显示的文字',
|
|
249
259
|
propSwitchOffText: '关闭时显示的文字',
|
|
250
260
|
propSwitchOnTextHint: '例如:开',
|
|
251
261
|
propSwitchOffTextHint: '例如:关',
|
|
252
262
|
propOptionsInline: '选项横向排列',
|
|
263
|
+
rulePresetREQ: '必填',
|
|
264
|
+
rulePresetTEL: '手机号格式',
|
|
265
|
+
rulePresetEMAIL: '邮箱格式',
|
|
253
266
|
ruleLen: '长度限制',
|
|
254
267
|
ruleLenRange: '长度范围',
|
|
255
268
|
ruleLenMin: '最少字数',
|
|
@@ -267,7 +280,7 @@ const locale$1 = {
|
|
|
267
280
|
schemaContentUntilToday: '至今',
|
|
268
281
|
schemaContentPasswordMasked: '••••••'
|
|
269
282
|
};
|
|
270
|
-
var
|
|
283
|
+
var defaultLocale = locale$1;
|
|
271
284
|
|
|
272
285
|
const locale = {
|
|
273
286
|
addField: 'Add Field',
|
|
@@ -299,6 +312,14 @@ const locale = {
|
|
|
299
312
|
blockKind_object: 'Grouped Fields',
|
|
300
313
|
blockKind_choice: 'Options',
|
|
301
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',
|
|
302
323
|
choiceMode: 'How many can be selected',
|
|
303
324
|
choiceModeSingle: 'One only',
|
|
304
325
|
choiceModeMultiple: 'More than one',
|
|
@@ -381,6 +402,7 @@ const locale = {
|
|
|
381
402
|
FieldTypeSwitch: 'Switch',
|
|
382
403
|
FieldTypeCheckbox: 'Checkbox',
|
|
383
404
|
FieldTypeDatePicker: 'Date',
|
|
405
|
+
extendedFieldPlaceholder: 'Please select {label}',
|
|
384
406
|
fieldName: 'Save name',
|
|
385
407
|
fieldNamePlaceholder: 'Auto-generated, editable',
|
|
386
408
|
fieldLabel: 'Display Name',
|
|
@@ -475,12 +497,16 @@ const locale = {
|
|
|
475
497
|
propDatePickerQuarter: 'Quarter',
|
|
476
498
|
propDatePickerYear: 'Year',
|
|
477
499
|
propDateFormat: 'Display format',
|
|
500
|
+
propDateFormatLocalized: 'MMM D, YYYY',
|
|
478
501
|
propShowTime: 'Include time',
|
|
479
502
|
propSwitchOnText: 'Text when on',
|
|
480
503
|
propSwitchOffText: 'Text when off',
|
|
481
504
|
propSwitchOnTextHint: 'e.g. On',
|
|
482
505
|
propSwitchOffTextHint: 'e.g. Off',
|
|
483
506
|
propOptionsInline: 'Arrange options horizontally',
|
|
507
|
+
rulePresetREQ: 'Required',
|
|
508
|
+
rulePresetTEL: 'Phone number format',
|
|
509
|
+
rulePresetEMAIL: 'Email format',
|
|
484
510
|
ruleLen: 'Length Limit',
|
|
485
511
|
ruleLenRange: 'Length Range',
|
|
486
512
|
ruleLenMin: 'Min',
|
|
@@ -503,7 +529,7 @@ var enUS = locale;
|
|
|
503
529
|
const withLocale = createWithIntlProvider({
|
|
504
530
|
defaultLocale: 'zh-CN',
|
|
505
531
|
messages: {
|
|
506
|
-
'zh-CN':
|
|
532
|
+
'zh-CN': defaultLocale,
|
|
507
533
|
'en-US': enUS
|
|
508
534
|
},
|
|
509
535
|
namespace: 'form-creator'
|
|
@@ -643,17 +669,13 @@ const createBlock = (kind, overrides = {}) => {
|
|
|
643
669
|
blocks: undefined,
|
|
644
670
|
items: undefined,
|
|
645
671
|
name: '',
|
|
646
|
-
options: [createChoiceOption(
|
|
647
|
-
title: '选项1'
|
|
648
|
-
})]
|
|
672
|
+
options: [createChoiceOption()]
|
|
649
673
|
}, overrides, {
|
|
650
674
|
kind: 'choice'
|
|
651
675
|
});
|
|
652
676
|
next.mode = next.mode === 'multiple' ? 'multiple' : 'single';
|
|
653
677
|
if (!Array.isArray(next.options)) {
|
|
654
|
-
next.options = [createChoiceOption(
|
|
655
|
-
title: '选项1'
|
|
656
|
-
})];
|
|
678
|
+
next.options = [createChoiceOption()];
|
|
657
679
|
}
|
|
658
680
|
return next;
|
|
659
681
|
}
|
|
@@ -1178,63 +1200,65 @@ const hasRenderableContent = schema => {
|
|
|
1178
1200
|
|
|
1179
1201
|
const BLOCK_KINDS = {
|
|
1180
1202
|
formInfo: {
|
|
1181
|
-
|
|
1203
|
+
labelId: 'blockKind_formInfo',
|
|
1182
1204
|
color: 'blue',
|
|
1183
1205
|
hasFieldList: true,
|
|
1184
|
-
|
|
1206
|
+
descriptionId: 'blockKindDesc_formInfo'
|
|
1185
1207
|
},
|
|
1186
1208
|
list: {
|
|
1187
|
-
|
|
1209
|
+
labelId: 'blockKind_list',
|
|
1188
1210
|
color: 'cyan',
|
|
1189
1211
|
hasFieldList: true,
|
|
1190
1212
|
requiresName: true,
|
|
1191
|
-
|
|
1213
|
+
descriptionId: 'blockKindDesc_list'
|
|
1192
1214
|
},
|
|
1193
1215
|
tableList: {
|
|
1194
|
-
|
|
1216
|
+
labelId: 'blockKind_tableList',
|
|
1195
1217
|
color: 'geekblue',
|
|
1196
1218
|
hasFieldList: true,
|
|
1197
1219
|
requiresName: true,
|
|
1198
|
-
|
|
1220
|
+
descriptionId: 'blockKindDesc_tableList'
|
|
1199
1221
|
},
|
|
1200
1222
|
editableList: {
|
|
1201
|
-
|
|
1223
|
+
labelId: 'blockKind_editableList',
|
|
1202
1224
|
color: 'green',
|
|
1203
1225
|
hasFieldList: true,
|
|
1204
1226
|
requiresName: true,
|
|
1205
|
-
|
|
1227
|
+
descriptionId: 'blockKindDesc_editableList'
|
|
1206
1228
|
},
|
|
1207
1229
|
multiField: {
|
|
1208
|
-
|
|
1230
|
+
labelId: 'blockKind_multiField',
|
|
1209
1231
|
color: 'purple',
|
|
1210
1232
|
requiresName: true,
|
|
1211
|
-
|
|
1233
|
+
descriptionId: 'blockKindDesc_multiField'
|
|
1212
1234
|
},
|
|
1213
1235
|
object: {
|
|
1214
|
-
|
|
1236
|
+
labelId: 'blockKind_object',
|
|
1215
1237
|
color: 'orange',
|
|
1216
1238
|
hasFieldList: true,
|
|
1217
1239
|
requiresName: true,
|
|
1218
|
-
|
|
1240
|
+
descriptionId: 'blockKindDesc_object'
|
|
1219
1241
|
},
|
|
1220
1242
|
choice: {
|
|
1221
|
-
|
|
1243
|
+
labelId: 'blockKind_choice',
|
|
1222
1244
|
color: 'magenta',
|
|
1223
1245
|
hasChoiceOptions: true,
|
|
1224
|
-
|
|
1246
|
+
descriptionId: 'blockKindDesc_choice'
|
|
1225
1247
|
},
|
|
1226
1248
|
steps: {
|
|
1227
|
-
|
|
1249
|
+
labelId: 'blockKind_steps',
|
|
1228
1250
|
color: 'gold',
|
|
1229
1251
|
hasSteps: true,
|
|
1230
|
-
|
|
1252
|
+
descriptionId: 'blockKindDesc_steps'
|
|
1231
1253
|
}
|
|
1232
1254
|
};
|
|
1233
1255
|
|
|
1234
1256
|
/** editableList 添加按钮位置,与 @kne/form-info EditableList addPosition 一致 */
|
|
1235
1257
|
const ADD_POSITIONS = ['bottom', 'top', 'both'];
|
|
1236
|
-
const getBlockKindOptions =
|
|
1237
|
-
label:
|
|
1258
|
+
const getBlockKindOptions = formatMessage => Object.entries(BLOCK_KINDS).map(([value, config]) => ({
|
|
1259
|
+
label: typeof formatMessage === 'function' ? formatMessage({
|
|
1260
|
+
id: config.labelId
|
|
1261
|
+
}) : config.labelId,
|
|
1238
1262
|
value
|
|
1239
1263
|
}));
|
|
1240
1264
|
const getBlockDefinition = kind => BLOCK_KINDS[kind];
|
|
@@ -1417,10 +1441,13 @@ const {
|
|
|
1417
1441
|
const hasNestedOptions = options => Array.isArray(options) && options.some(item => Array.isArray(item == null ? void 0 : item.children) && item.children.length);
|
|
1418
1442
|
const createField = (Component, {
|
|
1419
1443
|
preferOptions: _preferOptions = false,
|
|
1420
|
-
flattenTree: _flattenTree = false
|
|
1421
|
-
placeholderPrefix: _placeholderPrefix = '请选择'
|
|
1444
|
+
flattenTree: _flattenTree = false
|
|
1422
1445
|
} = {}) => {
|
|
1423
|
-
const
|
|
1446
|
+
const FieldInner = props => {
|
|
1447
|
+
const {
|
|
1448
|
+
formatMessage,
|
|
1449
|
+
locale
|
|
1450
|
+
} = useIntl();
|
|
1424
1451
|
const {
|
|
1425
1452
|
options,
|
|
1426
1453
|
api,
|
|
@@ -1440,11 +1467,16 @@ const createField = (Component, {
|
|
|
1440
1467
|
}) : flattened;
|
|
1441
1468
|
const useOptionsDirectly = _preferOptions || hasNestedOptions(resolvedOptions);
|
|
1442
1469
|
const mergedApi = api || (!useOptionsDirectly && Array.isArray(resolvedOptions) && resolvedOptions.length ? createApiFromOptions(resolvedOptions) : undefined);
|
|
1443
|
-
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();
|
|
1444
1475
|
const render = useOnChange$1(Object.assign({}, {
|
|
1445
1476
|
isPopup: true,
|
|
1446
1477
|
placeholder: resolvedPlaceholder
|
|
1447
1478
|
}, rest, {
|
|
1479
|
+
locale,
|
|
1448
1480
|
valueKey,
|
|
1449
1481
|
labelKey
|
|
1450
1482
|
}, useOptionsDirectly && Array.isArray(resolvedOptions) ? {
|
|
@@ -1454,6 +1486,7 @@ const createField = (Component, {
|
|
|
1454
1486
|
} : {}));
|
|
1455
1487
|
return render(Component);
|
|
1456
1488
|
};
|
|
1489
|
+
const Field = withLocale$1(FieldInner);
|
|
1457
1490
|
Field.field = Component;
|
|
1458
1491
|
return Field;
|
|
1459
1492
|
};
|
|
@@ -1474,13 +1507,13 @@ const SelectAddressField = createField(SelectAddress);
|
|
|
1474
1507
|
|
|
1475
1508
|
const RULE_PRESET_ITEMS = [{
|
|
1476
1509
|
value: 'REQ',
|
|
1477
|
-
|
|
1510
|
+
labelId: 'rulePresetREQ'
|
|
1478
1511
|
}, {
|
|
1479
1512
|
value: 'TEL',
|
|
1480
|
-
|
|
1513
|
+
labelId: 'rulePresetTEL'
|
|
1481
1514
|
}, {
|
|
1482
1515
|
value: 'EMAIL',
|
|
1483
|
-
|
|
1516
|
+
labelId: 'rulePresetEMAIL'
|
|
1484
1517
|
}];
|
|
1485
1518
|
const DEFAULT_RULE_CONFIG = () => ({
|
|
1486
1519
|
presets: [],
|
|
@@ -2029,7 +2062,7 @@ const getFieldTypes = formatMessage => {
|
|
|
2029
2062
|
});
|
|
2030
2063
|
if (fallback.length) {
|
|
2031
2064
|
grouped.push({
|
|
2032
|
-
label: resolveRegistryLabel(formatMessage, 'FieldGroupExtended'
|
|
2065
|
+
label: resolveRegistryLabel(formatMessage, 'FieldGroupExtended'),
|
|
2033
2066
|
options: fallback
|
|
2034
2067
|
});
|
|
2035
2068
|
}
|
|
@@ -2274,10 +2307,14 @@ const applyFieldProps = (props, values, definition) => {
|
|
|
2274
2307
|
delete props.showTime;
|
|
2275
2308
|
}
|
|
2276
2309
|
if (values.range) {
|
|
2277
|
-
// RangePicker 用数组 placeholder
|
|
2310
|
+
// RangePicker 用数组 placeholder;单框用字符串;未填时交给 RangePicker 按 locale 显示默认提示
|
|
2278
2311
|
const raw = values.placeholder;
|
|
2279
|
-
const text =
|
|
2280
|
-
|
|
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
|
+
}
|
|
2281
2318
|
} else {
|
|
2282
2319
|
setOptionalString(props, 'placeholder', values.placeholder);
|
|
2283
2320
|
}
|
|
@@ -2591,7 +2628,9 @@ const BlockListPanel = ({
|
|
|
2591
2628
|
})
|
|
2592
2629
|
}), /*#__PURE__*/jsx("div", {
|
|
2593
2630
|
className: style['add-block-option-desc'],
|
|
2594
|
-
children: definition
|
|
2631
|
+
children: definition ? formatMessage({
|
|
2632
|
+
id: definition.descriptionId
|
|
2633
|
+
}) : null
|
|
2595
2634
|
})]
|
|
2596
2635
|
})]
|
|
2597
2636
|
}, opt.key);
|
|
@@ -2690,9 +2729,11 @@ const BlockListPanel = ({
|
|
|
2690
2729
|
children: formatMessage({
|
|
2691
2730
|
id: `blockKind_${opt.key}`
|
|
2692
2731
|
})
|
|
2693
|
-
}), definition
|
|
2732
|
+
}), definition ? /*#__PURE__*/jsx("span", {
|
|
2694
2733
|
className: style['add-field-dropdown-item-desc'],
|
|
2695
|
-
children:
|
|
2734
|
+
children: formatMessage({
|
|
2735
|
+
id: definition.descriptionId
|
|
2736
|
+
})
|
|
2696
2737
|
}) : null]
|
|
2697
2738
|
}, opt.key);
|
|
2698
2739
|
})]
|
|
@@ -3408,7 +3449,9 @@ const BlockConfigFields = ({
|
|
|
3408
3449
|
title: formatMessage({
|
|
3409
3450
|
id: `blockKind_${kind}`
|
|
3410
3451
|
}),
|
|
3411
|
-
subtitle: definition
|
|
3452
|
+
subtitle: definition ? formatMessage({
|
|
3453
|
+
id: definition.descriptionId
|
|
3454
|
+
}) : undefined,
|
|
3412
3455
|
column: 1,
|
|
3413
3456
|
list: list.filter(Boolean)
|
|
3414
3457
|
})
|
|
@@ -3595,7 +3638,9 @@ const RulePresetEditor = () => {
|
|
|
3595
3638
|
formatMessage
|
|
3596
3639
|
} = useIntl();
|
|
3597
3640
|
const options = [...RULE_PRESET_ITEMS.map(item => ({
|
|
3598
|
-
label: item.
|
|
3641
|
+
label: item.labelId ? formatMessage({
|
|
3642
|
+
id: item.labelId
|
|
3643
|
+
}) : item.label,
|
|
3599
3644
|
value: item.value
|
|
3600
3645
|
})), {
|
|
3601
3646
|
label: formatMessage({
|
|
@@ -4526,8 +4571,12 @@ const buildBuiltinList = (type, formatMessage) => {
|
|
|
4526
4571
|
label: 'YYYY/MM/DD',
|
|
4527
4572
|
value: 'YYYY/MM/DD'
|
|
4528
4573
|
}, {
|
|
4529
|
-
label:
|
|
4530
|
-
|
|
4574
|
+
label: formatMessage({
|
|
4575
|
+
id: 'propDateFormatLocalized'
|
|
4576
|
+
}),
|
|
4577
|
+
value: formatMessage({
|
|
4578
|
+
id: 'propDateFormatLocalized'
|
|
4579
|
+
})
|
|
4531
4580
|
}, {
|
|
4532
4581
|
label: 'YYYY-MM-DD HH:mm:ss',
|
|
4533
4582
|
value: 'YYYY-MM-DD HH:mm:ss'
|
|
@@ -5135,30 +5184,30 @@ const resolveSelectLimits = block => {
|
|
|
5135
5184
|
};
|
|
5136
5185
|
const buildMultipleHint = (formatMessage, minLength, maxLength) => {
|
|
5137
5186
|
if (minLength != null && maxLength != null) {
|
|
5138
|
-
return formatMessage
|
|
5187
|
+
return formatMessage({
|
|
5139
5188
|
id: 'choiceModeHintMultipleRange'
|
|
5140
5189
|
}, {
|
|
5141
5190
|
min: minLength,
|
|
5142
5191
|
max: maxLength
|
|
5143
|
-
})
|
|
5192
|
+
});
|
|
5144
5193
|
}
|
|
5145
5194
|
if (minLength != null) {
|
|
5146
|
-
return formatMessage
|
|
5195
|
+
return formatMessage({
|
|
5147
5196
|
id: 'choiceModeHintMultipleMin'
|
|
5148
5197
|
}, {
|
|
5149
5198
|
count: minLength
|
|
5150
|
-
})
|
|
5199
|
+
});
|
|
5151
5200
|
}
|
|
5152
5201
|
if (maxLength != null) {
|
|
5153
|
-
return formatMessage
|
|
5202
|
+
return formatMessage({
|
|
5154
5203
|
id: 'choiceModeHintMultipleMax'
|
|
5155
5204
|
}, {
|
|
5156
5205
|
count: maxLength
|
|
5157
|
-
})
|
|
5206
|
+
});
|
|
5158
5207
|
}
|
|
5159
|
-
return formatMessage
|
|
5208
|
+
return formatMessage({
|
|
5160
5209
|
id: 'choiceModeHintMultiple'
|
|
5161
|
-
})
|
|
5210
|
+
});
|
|
5162
5211
|
};
|
|
5163
5212
|
|
|
5164
5213
|
/**
|
|
@@ -5184,9 +5233,9 @@ const ChoiceBlock = ({
|
|
|
5184
5233
|
openApi
|
|
5185
5234
|
} = useFormContext() || {};
|
|
5186
5235
|
const titleText = (block == null ? void 0 : block.title) != null ? String(block.title).trim() : '';
|
|
5187
|
-
const title = titleText ||
|
|
5236
|
+
const title = titleText || formatMessage({
|
|
5188
5237
|
id: 'choiceAreaTitle'
|
|
5189
|
-
})
|
|
5238
|
+
});
|
|
5190
5239
|
const bordered = _isMobile ? false : (block == null ? void 0 : block.bordered) || undefined;
|
|
5191
5240
|
const {
|
|
5192
5241
|
minLength,
|
|
@@ -5218,11 +5267,11 @@ const ChoiceBlock = ({
|
|
|
5218
5267
|
return options.map((option, index) => {
|
|
5219
5268
|
const value = String(option.id);
|
|
5220
5269
|
return {
|
|
5221
|
-
label: option.title ||
|
|
5270
|
+
label: option.title || formatMessage({
|
|
5222
5271
|
id: 'choiceOptionFallback'
|
|
5223
5272
|
}, {
|
|
5224
5273
|
index: index + 1
|
|
5225
|
-
})
|
|
5274
|
+
}),
|
|
5226
5275
|
value,
|
|
5227
5276
|
disabled: atMax && !selectedIdsFromValue.includes(value)
|
|
5228
5277
|
};
|
|
@@ -5251,21 +5300,21 @@ const ChoiceBlock = ({
|
|
|
5251
5300
|
if (minLength != null && ids.length < minLength) {
|
|
5252
5301
|
return {
|
|
5253
5302
|
result: false,
|
|
5254
|
-
errMsg: formatMessage
|
|
5303
|
+
errMsg: formatMessage({
|
|
5255
5304
|
id: 'choiceMinSelectError'
|
|
5256
5305
|
}, {
|
|
5257
5306
|
count: minLength
|
|
5258
|
-
})
|
|
5307
|
+
})
|
|
5259
5308
|
};
|
|
5260
5309
|
}
|
|
5261
5310
|
if (maxLength != null && ids.length > maxLength) {
|
|
5262
5311
|
return {
|
|
5263
5312
|
result: false,
|
|
5264
|
-
errMsg: formatMessage
|
|
5313
|
+
errMsg: formatMessage({
|
|
5265
5314
|
id: 'choiceMaxSelectError'
|
|
5266
5315
|
}, {
|
|
5267
5316
|
count: maxLength
|
|
5268
|
-
})
|
|
5317
|
+
})
|
|
5269
5318
|
};
|
|
5270
5319
|
}
|
|
5271
5320
|
return {
|
|
@@ -5278,9 +5327,9 @@ const ChoiceBlock = ({
|
|
|
5278
5327
|
const selectorProps = _extends({
|
|
5279
5328
|
key: `choice-selector-${mode}`,
|
|
5280
5329
|
name: selectorName,
|
|
5281
|
-
label: titleText ||
|
|
5330
|
+
label: titleText || formatMessage({
|
|
5282
5331
|
id: 'choiceAreaTitle'
|
|
5283
|
-
})
|
|
5332
|
+
}),
|
|
5284
5333
|
labelHidden: true,
|
|
5285
5334
|
options: selectorOptions,
|
|
5286
5335
|
onChange: handleChange
|
|
@@ -5311,9 +5360,9 @@ const ChoiceBlock = ({
|
|
|
5311
5360
|
}, option.title) : null, ...nodes));
|
|
5312
5361
|
}
|
|
5313
5362
|
});
|
|
5314
|
-
const modeHint = mode === 'multiple' ? buildMultipleHint(formatMessage, minLength, maxLength) : formatMessage
|
|
5363
|
+
const modeHint = mode === 'multiple' ? buildMultipleHint(formatMessage, minLength, maxLength) : formatMessage({
|
|
5315
5364
|
id: 'choiceModeHintSingle'
|
|
5316
|
-
})
|
|
5365
|
+
});
|
|
5317
5366
|
if (!block) {
|
|
5318
5367
|
return null;
|
|
5319
5368
|
}
|
|
@@ -5329,9 +5378,9 @@ const ChoiceBlock = ({
|
|
|
5329
5378
|
className: style['choice-panels']
|
|
5330
5379
|
}, ...contentChildren) : /*#__PURE__*/createElement('div', {
|
|
5331
5380
|
className: style['choice-panels-empty']
|
|
5332
|
-
}, formatMessage
|
|
5381
|
+
}, formatMessage({
|
|
5333
5382
|
id: 'choiceSelectFirstHint'
|
|
5334
|
-
})
|
|
5383
|
+
})));
|
|
5335
5384
|
};
|
|
5336
5385
|
var ChoiceBlock$1 = ChoiceBlock;
|
|
5337
5386
|
|
|
@@ -5971,7 +6020,15 @@ const FormCreator = withLocale$1(({
|
|
|
5971
6020
|
stepId,
|
|
5972
6021
|
optionId
|
|
5973
6022
|
} = {}) => {
|
|
5974
|
-
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));
|
|
5975
6032
|
setBlockParentId(parentBlockId || null);
|
|
5976
6033
|
setBlockParentStepId(stepId || null);
|
|
5977
6034
|
setBlockParentOptionId(optionId || null);
|
|
@@ -6624,7 +6681,7 @@ const formatDateToToday = (value, itemSchema, ctx) => {
|
|
|
6624
6681
|
if (items[1] == null || items[1] === '' || items[1] === true) {
|
|
6625
6682
|
const until = (ctx.formatMessage == null ? void 0 : ctx.formatMessage({
|
|
6626
6683
|
id: 'schemaContentUntilToday'
|
|
6627
|
-
})) ||
|
|
6684
|
+
})) || defaultLocale.schemaContentUntilToday;
|
|
6628
6685
|
return [start, until].filter(Boolean).join(' ~ ');
|
|
6629
6686
|
}
|
|
6630
6687
|
const end = formatByValueSchema(items[1], itemSchema, ctx);
|
|
@@ -6679,11 +6736,11 @@ const formatBoolean = (value, field, ctx) => {
|
|
|
6679
6736
|
if (value) {
|
|
6680
6737
|
return props.checkedChildren || (ctx.formatMessage == null ? void 0 : ctx.formatMessage({
|
|
6681
6738
|
id: 'schemaContentYes'
|
|
6682
|
-
})) ||
|
|
6739
|
+
})) || defaultLocale.schemaContentYes;
|
|
6683
6740
|
}
|
|
6684
6741
|
return props.unCheckedChildren || (ctx.formatMessage == null ? void 0 : ctx.formatMessage({
|
|
6685
6742
|
id: 'schemaContentNo'
|
|
6686
|
-
})) ||
|
|
6743
|
+
})) || defaultLocale.schemaContentNo;
|
|
6687
6744
|
};
|
|
6688
6745
|
const stringifyFallback = value => {
|
|
6689
6746
|
if (value == null) {
|
|
@@ -7068,14 +7125,15 @@ const mergeChoiceIntoLayer = (layer, block, depth) => {
|
|
|
7068
7125
|
const selectorName = resolveChoiceSelectorName$1(block);
|
|
7069
7126
|
const options = block.options || [];
|
|
7070
7127
|
const optionIds = options.map(option => String(option.id));
|
|
7071
|
-
const branches = options.map(
|
|
7128
|
+
const branches = options.map(option => {
|
|
7072
7129
|
const branch = createObjectLayer();
|
|
7073
|
-
const optionTitle = option.title ||
|
|
7130
|
+
const optionTitle = option.title || undefined;
|
|
7074
7131
|
if (selectorInData && mode === 'single') {
|
|
7075
|
-
branch.properties[selectorName] = {
|
|
7076
|
-
const: String(option.id)
|
|
7132
|
+
branch.properties[selectorName] = _extends({
|
|
7133
|
+
const: String(option.id)
|
|
7134
|
+
}, optionTitle ? {
|
|
7077
7135
|
title: optionTitle
|
|
7078
|
-
};
|
|
7136
|
+
} : {});
|
|
7079
7137
|
branch.required.push(selectorName);
|
|
7080
7138
|
}
|
|
7081
7139
|
mergeFieldsIntoLayer(branch, option.list, {
|