@kne/form-creator 0.1.22 → 0.1.24

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 CHANGED
@@ -23,7 +23,7 @@ var SelectList__default = /*#__PURE__*/_interopDefaultLegacy(SelectList);
23
23
  var FormInfo__default = /*#__PURE__*/_interopDefaultLegacy(FormInfo);
24
24
  var InfoPage__default = /*#__PURE__*/_interopDefaultLegacy(InfoPage);
25
25
 
26
- var style = {"kne-responsive-boundary":"kne-form-creator_gh14z","kne-responsive-scroll":"kne-form-creator_Kfn6L","option-group-stack":"kne-form-creator_TgBT-","form-info-show-index":"kne-form-creator_rqCos","field-label-index":"kne-form-creator_MLY0O","field-label-main":"kne-form-creator_UOUb4","form-creator":"kne-form-creator_Xrjrk","editor-pane":"kne-form-creator_Skfuv","preview-pane":"kne-form-creator_v4Lsp","editor-header":"kne-form-creator_WaSS-","block-list-panel":"kne-form-creator_lx8An","form-actions-setting-btn":"kne-form-creator_NekU2","panel-toolbar":"kne-form-creator_t0WxZ","panel-toolbar-extra":"kne-form-creator_O22ZM","schema-content":"kne-form-creator_9bWOD","schema-content-fields":"kne-form-creator_EmRDV","schema-content-field":"kne-form-creator_0Lanz","schema-content-field-block":"kne-form-creator_TQd-w","schema-content-field-label":"kne-form-creator_czEK3","schema-content-field-value":"kne-form-creator_YFKTK","schema-content-file-list":"kne-form-creator_UGdXA","schema-content-file":"kne-form-creator_75EtE","schema-content-file-image":"kne-form-creator_P-be6","schema-content-file-name":"kne-form-creator_NXpTS","add-block-btn":"kne-form-creator_16Zre","add-inline-btn":"kne-form-creator_iCYdB","ant-btn-disabled":"kne-form-creator_LdGtv","block-list":"kne-form-creator_wK5eK","block-section":"kne-form-creator_15IiK","block-kind-formInfo":"kne-form-creator_D0hoK","block-kind-list":"kne-form-creator_JdPhy","block-kind-tableList":"kne-form-creator_gzd64","block-kind-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"};
26
+ var style = {"kne-responsive-boundary":"kne-form-creator_gh14z","kne-responsive-scroll":"kne-form-creator_Kfn6L","option-group-stack":"kne-form-creator_TgBT-","form-info-show-index":"kne-form-creator_rqCos","field-label-index":"kne-form-creator_MLY0O","field-label-main":"kne-form-creator_UOUb4","form-creator":"kne-form-creator_Xrjrk","editor-pane":"kne-form-creator_Skfuv","preview-pane":"kne-form-creator_v4Lsp","editor-header":"kne-form-creator_WaSS-","block-list-panel":"kne-form-creator_lx8An","form-actions-setting-btn":"kne-form-creator_NekU2","panel-toolbar":"kne-form-creator_t0WxZ","panel-toolbar-extra":"kne-form-creator_O22ZM","schema-content":"kne-form-creator_9bWOD","schema-content-fields":"kne-form-creator_EmRDV","schema-content-field":"kne-form-creator_0Lanz","schema-content-field-block":"kne-form-creator_TQd-w","schema-content-field-label":"kne-form-creator_czEK3","schema-content-field-value":"kne-form-creator_YFKTK","schema-content-file-list":"kne-form-creator_UGdXA","schema-content-file":"kne-form-creator_75EtE","schema-content-file-image":"kne-form-creator_P-be6","schema-content-file-name":"kne-form-creator_NXpTS","add-block-btn":"kne-form-creator_16Zre","add-inline-btn":"kne-form-creator_iCYdB","ant-btn-disabled":"kne-form-creator_LdGtv","block-list":"kne-form-creator_wK5eK","block-section":"kne-form-creator_15IiK","block-kind-formInfo":"kne-form-creator_D0hoK","block-kind-list":"kne-form-creator_JdPhy","block-kind-tableList":"kne-form-creator_gzd64","block-kind-editableList":"kne-form-creator_JzwrQ","block-kind-multiField":"kne-form-creator_t0iOJ","block-kind-steps":"kne-form-creator_QNF9W","step-section":"kne-form-creator_22ajp","block-section-header":"kne-form-creator_wS4rL","block-header-left":"kne-form-creator_t4awC","block-title":"kne-form-creator_wSVJf","block-summary":"kne-form-creator_GzeW8","block-header-actions":"kne-form-creator_Ue-nT","block-body":"kne-form-creator_je1H0","item-blocks-section":"kne-form-creator_wq4bT","nested-block-list":"kne-form-creator_4NWH4","block-section-nested":"kne-form-creator_mUKom","add-field-dropdown":"kne-form-creator_9JS0d","add-field-dropdown-item":"kne-form-creator_Ql1z3","add-field-dropdown-item-icon":"kne-form-creator_ZHB5O","add-field-dropdown-item-desc":"kne-form-creator_dcsOS","add-field-dropdown-divider":"kne-form-creator_CUK0H","add-field-dropdown-label":"kne-form-creator_bPJ-2","section-toolbar":"kne-form-creator_LUO8S","section-toolbar-label":"kne-form-creator_7KQ79","field-list":"kne-form-creator_-B7WZ","step-list":"kne-form-creator_kc1pH","step-section-header":"kne-form-creator_wkhEX","step-section-title":"kne-form-creator_NBinE","step-section-actions":"kne-form-creator_es-FC","step-index":"kne-form-creator_CCKZZ","field-row":"kne-form-creator_XMkdt","field-row-index":"kne-form-creator_a-cDo","field-row-main":"kne-form-creator_ftlwp","inline-empty":"kne-form-creator_yP-RF","action-group":"kne-form-creator_773yo","hover-reveal":"kne-form-creator_S234h","hover-reveal-active":"kne-form-creator_AE-6r","action-btn":"kne-form-creator_mLgqh","add-block-dropdown":"kne-form-creator_vmS-e","add-block-option":"kne-form-creator_gjg2Y","add-block-option-icon":"kne-form-creator_qh1hh","add-block-option-text":"kne-form-creator_G8iJO","add-block-option-title":"kne-form-creator_ETSvm","add-block-option-desc":"kne-form-creator_O0C3l","field-empty":"kne-form-creator_Nmpfl","field-label-tips-icon":"kne-form-creator_0VVaO","preview-header":"kne-form-creator_c4BT0","preview-title":"kne-form-creator_fPkK4","preview-body":"kne-form-creator_6JntQ","schema-form":"kne-form-creator_MxCWP","schema-body":"kne-form-creator_q9ydz","schema-actions":"kne-form-creator_Y4eEH","schema-actions-inner":"kne-form-creator_FT9Zf","choice-block":"kne-form-creator_RllJe","choice-selector":"kne-form-creator_5A1eM","choice-panels":"kne-form-creator_IO0MY","choice-panels-empty":"kne-form-creator_T0nND","choice-option-panel":"kne-form-creator_FQixN","choice-option-panel-title":"kne-form-creator_ofRo2","choice-option-summary":"kne-form-creator_pksH8","field-editor-form":"kne-form-creator_PGPHL","form-actions-editor":"kne-form-creator_fchMy","form-actions-switch-field":"kne-form-creator_6JE9x","form-actions-layout-panel":"kne-form-creator_rtm9D","form-actions-align-group":"kne-form-creator_51ZsV","form-actions-layout-title":"kne-form-creator_hFeiC","form-actions-gap-slider":"kne-form-creator_Gq0bk","editor-section":"kne-form-creator_jJy85","section-divider":"kne-form-creator_zA7L-","rule-editor":"kne-form-creator_bAlGU","options-editor":"kne-form-creator_AK4yO","super-select-props":"kne-form-creator_Iawhh","field-props-editor":"kne-form-creator_Gabf2","columns-editor":"kne-form-creator_DQW1N","prop-row":"kne-form-creator_7K54P","prop-label":"kne-form-creator_HAAyH","options-item":"kne-form-creator_dnOd2","table-row-card":"kne-form-creator_cwCYp","tree-options-editor":"kne-form-creator_s3nHO","tree-options-list":"kne-form-creator_Djs-E","tree-option-node":"kne-form-creator_XAcut","tree-option-row":"kne-form-creator_4K4Rj","tree-option-fields":"kne-form-creator_-4cjc","tree-option-actions":"kne-form-creator_IjCNI","tree-option-children":"kne-form-creator_pVPGJ","tree-add-sibling":"kne-form-creator_bl46P","rule-checkbox-group":"kne-form-creator_tDgVP","rule-len-row":"kne-form-creator_ATsae","rule-len-input":"kne-form-creator_jY4Ld","rule-len-sep":"kne-form-creator_jBDC8","options-list":"kne-form-creator_GUBNS","options-row":"kne-form-creator_uohD0","options-tip":"kne-form-creator_vrTmK","icon-square-btn":"kne-form-creator_DZjCf","icon-square-btn-sm":"kne-form-creator_GAh-t","locale-text":"kne-form-creator_hMXkE","is-compact":"kne-form-creator_jBFpL","locale-text-item":"kne-form-creator_NqCQD","locale-text-prefix":"kne-form-creator_BQl2X","options-locale-text":"kne-form-creator_7-99l","locale-text-tag":"kne-form-creator_65OWA","is-mobile":"kne-form-creator_LtgJz"};
27
27
 
28
28
  const locale$1 = {
29
29
  addField: '添加填写项',
@@ -55,6 +55,14 @@ const locale$1 = {
55
55
  blockKind_object: '分组信息',
56
56
  blockKind_choice: '选项切换',
57
57
  blockKind_steps: '分步表单',
58
+ blockKindDesc_formInfo: '最常用的表单模块,可设置标题、列数和间距',
59
+ blockKindDesc_list: '用户可以动态添加或删除多条记录,例如工作经历',
60
+ blockKindDesc_tableList: '以表格形式展示的可增减列表',
61
+ blockKindDesc_editableList: '每条记录只读展示,点击编辑后单独填写并保存;数据量大时不卡顿',
62
+ blockKindDesc_multiField: '同一种填写项可以输入多个值,例如多个手机号',
63
+ blockKindDesc_object: '把相关的填写项放在一起,例如「在校时间」下的开始与结束',
64
+ blockKindDesc_choice: '先选一类情况,再填写对应内容;可设为单选或多选',
65
+ blockKindDesc_steps: '将表单拆分成多个步骤,引导用户逐步填写',
58
66
  choiceMode: '可选几个',
59
67
  choiceModeSingle: '只能选一个',
60
68
  choiceModeMultiple: '可以选多个',
@@ -137,6 +145,7 @@ const locale$1 = {
137
145
  FieldTypeSwitch: '开关',
138
146
  FieldTypeCheckbox: '复选框',
139
147
  FieldTypeDatePicker: '日期',
148
+ extendedFieldPlaceholder: '请选择{label}',
140
149
  fieldName: '保存用的名称',
141
150
  fieldNamePlaceholder: '已自动生成,可修改',
142
151
  fieldLabel: '显示名称',
@@ -231,12 +240,16 @@ const locale$1 = {
231
240
  propDatePickerQuarter: '季度',
232
241
  propDatePickerYear: '年份',
233
242
  propDateFormat: '显示格式',
243
+ propDateFormatLocalized: 'YYYY年MM月DD日',
234
244
  propShowTime: '同时选择时间',
235
245
  propSwitchOnText: '打开时显示的文字',
236
246
  propSwitchOffText: '关闭时显示的文字',
237
247
  propSwitchOnTextHint: '例如:开',
238
248
  propSwitchOffTextHint: '例如:关',
239
249
  propOptionsInline: '选项横向排列',
250
+ rulePresetREQ: '必填',
251
+ rulePresetTEL: '手机号格式',
252
+ rulePresetEMAIL: '邮箱格式',
240
253
  ruleLen: '长度限制',
241
254
  ruleLenRange: '长度范围',
242
255
  ruleLenMin: '最少字数',
@@ -252,9 +265,15 @@ const locale$1 = {
252
265
  schemaContentNo: '否',
253
266
  schemaContentItemIndex: '第 {index} 项',
254
267
  schemaContentUntilToday: '至今',
255
- schemaContentPasswordMasked: '••••••'
256
- };
257
- var zhCN = locale$1;
268
+ schemaContentPasswordMasked: '••••••',
269
+ ruleErrorTEL: '请输入有效的手机号',
270
+ ruleErrorEMAIL: '请输入有效的邮箱',
271
+ ruleErrorLenEqual: '%s长度必须等于{end}',
272
+ ruleErrorLenMin: '%s长度必须大于{start}',
273
+ ruleErrorLenMax: '%s长度必须小于{end}',
274
+ localeTextFallback: '留空时使用{language}'
275
+ };
276
+ var defaultLocale = locale$1;
258
277
 
259
278
  const locale = {
260
279
  addField: 'Add Field',
@@ -286,6 +305,14 @@ const locale = {
286
305
  blockKind_object: 'Grouped Fields',
287
306
  blockKind_choice: 'Options',
288
307
  blockKind_steps: 'Step-by-Step',
308
+ blockKindDesc_formInfo: 'The most common section; set its title, columns and spacing',
309
+ blockKindDesc_list: 'Users can add or remove multiple records, e.g. work experience',
310
+ blockKindDesc_tableList: 'A repeatable list displayed as a table',
311
+ blockKindDesc_editableList: 'Records are shown read-only; click edit to fill in and save each one. Stays fast with lots of data',
312
+ blockKindDesc_multiField: 'Enter multiple values for the same field, e.g. several phone numbers',
313
+ blockKindDesc_object: 'Group related fields together, e.g. start and end under "School period"',
314
+ blockKindDesc_choice: 'Pick a case first, then fill in the matching content; single or multiple selection',
315
+ blockKindDesc_steps: 'Split the form into steps to guide users through it',
289
316
  choiceMode: 'How many can be selected',
290
317
  choiceModeSingle: 'One only',
291
318
  choiceModeMultiple: 'More than one',
@@ -368,6 +395,7 @@ const locale = {
368
395
  FieldTypeSwitch: 'Switch',
369
396
  FieldTypeCheckbox: 'Checkbox',
370
397
  FieldTypeDatePicker: 'Date',
398
+ extendedFieldPlaceholder: 'Please select {label}',
371
399
  fieldName: 'Save name',
372
400
  fieldNamePlaceholder: 'Auto-generated, editable',
373
401
  fieldLabel: 'Display Name',
@@ -462,12 +490,16 @@ const locale = {
462
490
  propDatePickerQuarter: 'Quarter',
463
491
  propDatePickerYear: 'Year',
464
492
  propDateFormat: 'Display format',
493
+ propDateFormatLocalized: 'MMM D, YYYY',
465
494
  propShowTime: 'Include time',
466
495
  propSwitchOnText: 'Text when on',
467
496
  propSwitchOffText: 'Text when off',
468
497
  propSwitchOnTextHint: 'e.g. On',
469
498
  propSwitchOffTextHint: 'e.g. Off',
470
499
  propOptionsInline: 'Arrange options horizontally',
500
+ rulePresetREQ: 'Required',
501
+ rulePresetTEL: 'Phone number format',
502
+ rulePresetEMAIL: 'Email format',
471
503
  ruleLen: 'Length Limit',
472
504
  ruleLenRange: 'Length Range',
473
505
  ruleLenMin: 'Min',
@@ -483,35 +515,140 @@ const locale = {
483
515
  schemaContentNo: 'No',
484
516
  schemaContentItemIndex: 'Item {index}',
485
517
  schemaContentUntilToday: 'Present',
486
- schemaContentPasswordMasked: '••••••'
518
+ schemaContentPasswordMasked: '••••••',
519
+ ruleErrorTEL: 'Please enter a valid mobile number',
520
+ ruleErrorEMAIL: 'Please enter a valid email address',
521
+ ruleErrorLenEqual: '%s must be exactly {end} characters',
522
+ ruleErrorLenMin: '%s must be at least {start} characters',
523
+ ruleErrorLenMax: '%s must be at most {end} characters',
524
+ localeTextFallback: 'Falls back to {language} when empty'
487
525
  };
488
526
  var enUS = locale;
489
527
 
490
528
  const withLocale = reactIntl.createWithIntlProvider({
491
529
  defaultLocale: 'zh-CN',
492
530
  messages: {
493
- 'zh-CN': zhCN,
531
+ 'zh-CN': defaultLocale,
494
532
  'en-US': enUS
495
533
  },
496
534
  namespace: 'form-creator'
497
535
  });
498
536
  var withLocale$1 = withLocale;
499
537
 
500
- const createFieldId = () => `field_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
538
+ /** 未传 languages 时,多语言文案按此顺序回退 */
539
+ const DEFAULT_FALLBACK_LANGUAGES = ['zh-CN', 'en-US'];
540
+ const LOCALE_KEY = /^[a-z]{2,3}(-[A-Za-z]{2,4})?$/;
541
+ const isPlainObject = value => {
542
+ if (!value || typeof value !== 'object' || Array.isArray(value)) {
543
+ return false;
544
+ }
545
+ const proto = Object.getPrototypeOf(value);
546
+ return proto === Object.prototype || proto === null;
547
+ };
501
548
 
502
- /** 生成可编辑的默认数据标识,如 field_xxxx / col_xxxx */
503
- const createDataKey = function (prefix) {
504
- if (prefix === void 0) {
505
- prefix = 'field';
549
+ /** 多语言文案:键全为语言代码、值全为字符串,如 { 'zh-CN': '姓名', 'en-US': 'Name' } */
550
+ const isLocaleText = value => {
551
+ if (!isPlainObject(value)) {
552
+ return false;
553
+ }
554
+ const keys = Object.keys(value);
555
+ return keys.length > 0 && keys.every(key => LOCALE_KEY.test(key) && (value[key] == null || typeof value[key] === 'string'));
556
+ };
557
+ const hasText = value => typeof value === 'string' && value.trim() !== '';
558
+
559
+ /** 规范调用方传入的语言列表 [{ value, label }],丢弃无 value 的项 */
560
+ const normalizeLanguages = languages => (Array.isArray(languages) ? languages : []).filter(item => item && typeof item.value === 'string' && item.value).map(item => ({
561
+ value: item.value,
562
+ label: item.label || item.value
563
+ }));
564
+ const getFallbackLanguages = languages => {
565
+ const list = normalizeLanguages(languages);
566
+ return list.length ? list.map(item => item.value) : DEFAULT_FALLBACK_LANGUAGES;
567
+ };
568
+
569
+ /** 普通字符串原样返回;多语言按 locale → languages 顺序(未传为 zh-CN → en-US)取第一个有内容的 */
570
+ const resolveLocaleText = (value, locale, languages) => {
571
+ if (!isLocaleText(value)) {
572
+ return value;
573
+ }
574
+ const language = [locale, ...getFallbackLanguages(languages)].find(key => key && hasText(value[key]));
575
+ return language ? value[language] : '';
576
+ };
577
+
578
+ /** 深度解析 schema(或任意片段)中的多语言文案,返回新对象 */
579
+ const localizeSchema = (value, locale, languages) => {
580
+ if (Array.isArray(value)) {
581
+ return value.map(item => localizeSchema(item, locale, languages));
582
+ }
583
+ if (isLocaleText(value)) {
584
+ return resolveLocaleText(value, locale, languages);
585
+ }
586
+ if (!isPlainObject(value)) {
587
+ return value;
588
+ }
589
+ return Object.keys(value).reduce((result, key) => {
590
+ result[key] = localizeSchema(value[key], locale, languages);
591
+ return result;
592
+ }, {});
593
+ };
594
+
595
+ /** 取某个语言的原始输入值;普通字符串视为基础语言 */
596
+ const getLocaleTextValue = (value, language, baseLanguage) => {
597
+ if (isLocaleText(value)) {
598
+ return value[language] || '';
599
+ }
600
+ if (value == null || typeof value === 'object') {
601
+ return '';
602
+ }
603
+ return language === baseLanguage ? String(value) : '';
604
+ };
605
+
606
+ /** 只有基础语言时存为字符串,保持与单语言 schema 兼容 */
607
+ const toLocaleText = (map = {}, baseLanguage) => {
608
+ const entries = Object.keys(map).filter(key => hasText(map[key])).map(key => [key, map[key]]);
609
+ if (!entries.length) {
610
+ return '';
611
+ }
612
+ if (entries.length === 1 && entries[0][0] === baseLanguage) {
613
+ return entries[0][1];
614
+ }
615
+ return Object.fromEntries(entries);
616
+ };
617
+ const setLocaleTextValue = (value, language, text, baseLanguage) => {
618
+ const map = isLocaleText(value) ? {
619
+ ...value
620
+ } : {
621
+ [baseLanguage]: getLocaleTextValue(value, baseLanguage, baseLanguage)
622
+ };
623
+ map[language] = text;
624
+ return toLocaleText(map, baseLanguage);
625
+ };
626
+
627
+ /** 判断文案(字符串或多语言)是否有内容 */
628
+ const hasLocaleText = value => isLocaleText(value) ? Object.values(value).some(hasText) : value != null && String(value).trim() !== '';
629
+
630
+ /** 去除首尾空白;多语言文案逐项处理 */
631
+ const trimLocaleText = (value, baseLanguage) => {
632
+ if (isLocaleText(value)) {
633
+ return toLocaleText(Object.fromEntries(Object.keys(value).map(key => [key, (value[key] || '').trim()])), baseLanguage);
506
634
  }
507
- return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`;
635
+ return String(value ?? '').trim();
508
636
  };
509
- const isAutoDataKey = function (value, prefix) {
510
- if (prefix === void 0) {
511
- prefix = 'field';
637
+
638
+ /** 由文案派生数据值时用基础语言,保证各语言下值一致;基础语言为空时取第一个有内容的语言 */
639
+ const localeTextToValue = (value, baseLanguage) => {
640
+ if (!isLocaleText(value)) {
641
+ return String(value ?? '').trim();
512
642
  }
513
- return new RegExp(`^${prefix}_[a-z0-9]+_[a-z0-9]+$`, 'i').test(String(value || '').trim());
643
+ const text = resolveLocaleText(value, baseLanguage) || Object.values(value).find(hasText) || '';
644
+ return String(text).trim();
514
645
  };
646
+
647
+ const createFieldId = () => `field_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
648
+
649
+ /** 生成可编辑的默认数据标识,如 field_xxxx / col_xxxx */
650
+ const createDataKey = (prefix = 'field') => `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`;
651
+ const isAutoDataKey = (value, prefix = 'field') => new RegExp(`^${prefix}_[a-z0-9]+_[a-z0-9]+$`, 'i').test(String(value || '').trim());
515
652
  const MAX_BLOCK_DEPTH = 14;
516
653
 
517
654
  /** 列表项内可挂子模块(itemBlocks)的模块类型 */
@@ -543,10 +680,10 @@ const defaultFormActions = () => ({
543
680
  gap: 16
544
681
  });
545
682
  const FORM_ACTIONS_ALIGN = ['center', 'start', 'end'];
546
- const normalizeFormActions = function (actions) {
547
- if (actions === void 0) {
548
- actions = {};
549
- }
683
+ const normalizeActionText = value => value == null ? '' : isLocaleText(value) ? {
684
+ ...value
685
+ } : String(value);
686
+ const normalizeFormActions = (actions = {}) => {
550
687
  const base = defaultFormActions();
551
688
  if (!actions || typeof actions !== 'object') {
552
689
  return base;
@@ -558,9 +695,9 @@ const normalizeFormActions = function (actions) {
558
695
  showSubmit: actions.showSubmit !== false,
559
696
  showReset: actions.showReset !== false,
560
697
  showCancel: !!actions.showCancel,
561
- submitText: actions.submitText != null ? String(actions.submitText) : '',
562
- resetText: actions.resetText != null ? String(actions.resetText) : '',
563
- cancelText: actions.cancelText != null ? String(actions.cancelText) : '',
698
+ submitText: normalizeActionText(actions.submitText),
699
+ resetText: normalizeActionText(actions.resetText),
700
+ cancelText: normalizeActionText(actions.cancelText),
564
701
  align,
565
702
  gap,
566
703
  ...(actions.submitButtonProps && typeof actions.submitButtonProps === 'object' ? {
@@ -580,40 +717,27 @@ const normalizeFormActions = function (actions) {
580
717
  } : {})
581
718
  };
582
719
  };
583
- const createField$1 = function (overrides) {
584
- if (overrides === void 0) {
585
- overrides = {};
586
- }
587
- return {
588
- id: createFieldId(),
589
- type: 'Input',
590
- name: createDataKey('field'),
591
- label: '',
592
- tips: '',
593
- description: '',
594
- rule: '',
595
- block: false,
596
- hidden: false,
597
- props: {},
598
- ...overrides
599
- };
600
- };
601
- const createChoiceOption = function (overrides) {
602
- if (overrides === void 0) {
603
- overrides = {};
604
- }
605
- return {
606
- id: createFieldId(),
607
- title: '',
608
- list: [],
609
- blocks: [],
610
- ...overrides
611
- };
612
- };
613
- const createBlock = function (kind, overrides) {
614
- if (overrides === void 0) {
615
- overrides = {};
616
- }
720
+ const createField$1 = (overrides = {}) => ({
721
+ id: createFieldId(),
722
+ type: 'Input',
723
+ name: createDataKey('field'),
724
+ label: '',
725
+ tips: '',
726
+ description: '',
727
+ rule: '',
728
+ block: false,
729
+ hidden: false,
730
+ props: {},
731
+ ...overrides
732
+ });
733
+ const createChoiceOption = (overrides = {}) => ({
734
+ id: createFieldId(),
735
+ title: '',
736
+ list: [],
737
+ blocks: [],
738
+ ...overrides
739
+ });
740
+ const createBlock = (kind, overrides = {}) => {
617
741
  const needsName = ['list', 'tableList', 'editableList', 'multiField', 'object'].includes(kind);
618
742
  const base = {
619
743
  id: createFieldId(),
@@ -672,17 +796,13 @@ const createBlock = function (kind, overrides) {
672
796
  blocks: undefined,
673
797
  items: undefined,
674
798
  name: '',
675
- options: [createChoiceOption({
676
- title: '选项1'
677
- })],
799
+ options: [createChoiceOption()],
678
800
  ...overrides,
679
801
  kind: 'choice'
680
802
  };
681
803
  next.mode = next.mode === 'multiple' ? 'multiple' : 'single';
682
804
  if (!Array.isArray(next.options)) {
683
- next.options = [createChoiceOption({
684
- title: '选项1'
685
- })];
805
+ next.options = [createChoiceOption()];
686
806
  }
687
807
  return next;
688
808
  }
@@ -718,23 +838,15 @@ const createBlock = function (kind, overrides) {
718
838
  ...overrides
719
839
  };
720
840
  };
721
- const createStep = function (overrides) {
722
- if (overrides === void 0) {
723
- overrides = {};
724
- }
725
- return {
726
- id: createFieldId(),
727
- title: '',
728
- column: 2,
729
- list: [],
730
- blocks: [],
731
- ...overrides
732
- };
733
- };
734
- const normalizeSelectCount = function (value, minAllowed) {
735
- if (minAllowed === void 0) {
736
- minAllowed = 0;
737
- }
841
+ const createStep = (overrides = {}) => ({
842
+ id: createFieldId(),
843
+ title: '',
844
+ column: 2,
845
+ list: [],
846
+ blocks: [],
847
+ ...overrides
848
+ });
849
+ const normalizeSelectCount = (value, minAllowed = 0) => {
738
850
  if (value == null || value === '') {
739
851
  return undefined;
740
852
  }
@@ -755,17 +867,12 @@ const normalizeField = field => ({
755
867
  ...(field.props || {})
756
868
  }
757
869
  });
758
- const normalizeStep = function (step, depth) {
759
- if (depth === void 0) {
760
- depth = 0;
761
- }
762
- return {
763
- ...createStep(),
764
- ...step,
765
- list: Array.isArray(step.list) ? step.list.map(normalizeField) : [],
766
- blocks: Array.isArray(step.blocks) ? step.blocks.map(child => normalizeBlock(child, depth + 1)) : []
767
- };
768
- };
870
+ const normalizeStep = (step, depth = 0) => ({
871
+ ...createStep(),
872
+ ...step,
873
+ list: Array.isArray(step.list) ? step.list.map(normalizeField) : [],
874
+ blocks: Array.isArray(step.blocks) ? step.blocks.map(child => normalizeBlock(child, depth + 1)) : []
875
+ });
769
876
  const normalizeChoiceOption = (option, depth) => {
770
877
  let list = Array.isArray(option.list) ? option.list.map(normalizeField) : [];
771
878
  let blocks = Array.isArray(option.blocks) ? option.blocks.map(block => normalizeBlock(block, depth + 1)) : [];
@@ -782,10 +889,7 @@ const normalizeChoiceOption = (option, depth) => {
782
889
  blocks
783
890
  };
784
891
  };
785
- const normalizeBlock = function (block, depth) {
786
- if (depth === void 0) {
787
- depth = 0;
788
- }
892
+ const normalizeBlock = (block, depth = 0) => {
789
893
  const kind = block.kind || 'formInfo';
790
894
  if (depth > MAX_BLOCK_DEPTH) {
791
895
  return {
@@ -864,10 +968,7 @@ const normalizeBlock = function (block, depth) {
864
968
  }
865
969
  return normalized;
866
970
  };
867
- const normalizeSchema = function (schema) {
868
- if (schema === void 0) {
869
- schema = {};
870
- }
971
+ const normalizeSchema = (schema = {}) => {
871
972
  const base = defaultSchema();
872
973
  if (Array.isArray(schema.blocks)) {
873
974
  return {
@@ -919,13 +1020,7 @@ const isFieldNameUnique = (fields, name, excludeId) => {
919
1020
  }
920
1021
  return !fields.some(item => item.name === name && item.id !== excludeId);
921
1022
  };
922
- const collectFieldsFromBlocks = function (blocks, acc) {
923
- if (blocks === void 0) {
924
- blocks = [];
925
- }
926
- if (acc === void 0) {
927
- acc = [];
928
- }
1023
+ const collectFieldsFromBlocks = (blocks = [], acc = []) => {
929
1024
  blocks.forEach(block => {
930
1025
  if (!block) {
931
1026
  return;
@@ -956,12 +1051,11 @@ const collectFieldsFromBlocks = function (blocks, acc) {
956
1051
  });
957
1052
  return acc;
958
1053
  };
959
- const collectSchemaFields = function (schema, _temp) {
960
- let {
961
- blockId,
962
- stepId,
963
- optionId
964
- } = _temp === void 0 ? {} : _temp;
1054
+ const collectSchemaFields = (schema, {
1055
+ blockId,
1056
+ stepId,
1057
+ optionId
1058
+ } = {}) => {
965
1059
  const blocks = schema.blocks || [];
966
1060
  if (!blockId) {
967
1061
  return collectFieldsFromBlocks(blocks);
@@ -997,13 +1091,9 @@ const collectSchemaFields = function (schema, _temp) {
997
1091
  };
998
1092
 
999
1093
  /** 收集 blocks 树中所有字段 name(含 object 前缀后的完整名需在渲染层处理) */
1000
- const collectBlockFieldNames = function (blocks, _temp2) {
1001
- if (blocks === void 0) {
1002
- blocks = [];
1003
- }
1004
- let {
1005
- objectNamePrefix = ''
1006
- } = _temp2 === void 0 ? {} : _temp2;
1094
+ const collectBlockFieldNames = (blocks = [], {
1095
+ objectNamePrefix = ''
1096
+ } = {}) => {
1007
1097
  const names = [];
1008
1098
  const walk = (list, prefix) => {
1009
1099
  (list || []).forEach(block => {
@@ -1067,10 +1157,7 @@ const updateBlocks = (schema, updater) => ({
1067
1157
  });
1068
1158
 
1069
1159
  /** 在 blocks / itemBlocks / choice.options.blocks / steps.items.blocks 树中查找模块 */
1070
- const findBlockInTree = function (blocks, blockId) {
1071
- if (blocks === void 0) {
1072
- blocks = [];
1073
- }
1160
+ const findBlockInTree = (blocks = [], blockId) => {
1074
1161
  for (const block of blocks) {
1075
1162
  if (!block) {
1076
1163
  continue;
@@ -1276,68 +1363,67 @@ const hasRenderableContent = schema => {
1276
1363
 
1277
1364
  const BLOCK_KINDS = {
1278
1365
  formInfo: {
1279
- label: '基础表单',
1366
+ labelId: 'blockKind_formInfo',
1280
1367
  color: 'blue',
1281
1368
  hasFieldList: true,
1282
- description: '最常用的表单模块,可设置标题、列数和间距'
1369
+ descriptionId: 'blockKindDesc_formInfo'
1283
1370
  },
1284
1371
  list: {
1285
- label: '可增减列表',
1372
+ labelId: 'blockKind_list',
1286
1373
  color: 'cyan',
1287
1374
  hasFieldList: true,
1288
1375
  requiresName: true,
1289
- description: '用户可以动态添加或删除多条记录,例如工作经历'
1376
+ descriptionId: 'blockKindDesc_list'
1290
1377
  },
1291
1378
  tableList: {
1292
- label: '表格列表',
1379
+ labelId: 'blockKind_tableList',
1293
1380
  color: 'geekblue',
1294
1381
  hasFieldList: true,
1295
1382
  requiresName: true,
1296
- description: '以表格形式展示的可增减列表'
1383
+ descriptionId: 'blockKindDesc_tableList'
1297
1384
  },
1298
1385
  editableList: {
1299
- label: '行内编辑列表',
1386
+ labelId: 'blockKind_editableList',
1300
1387
  color: 'green',
1301
1388
  hasFieldList: true,
1302
1389
  requiresName: true,
1303
- description: '每条记录只读展示,点击编辑后单独填写并保存;数据量大时不卡顿'
1390
+ descriptionId: 'blockKindDesc_editableList'
1304
1391
  },
1305
1392
  multiField: {
1306
- label: '同类多值',
1393
+ labelId: 'blockKind_multiField',
1307
1394
  color: 'purple',
1308
1395
  requiresName: true,
1309
- description: '同一种填写项可以输入多个值,例如多个手机号'
1396
+ descriptionId: 'blockKindDesc_multiField'
1310
1397
  },
1311
1398
  object: {
1312
- label: '分组信息',
1399
+ labelId: 'blockKind_object',
1313
1400
  color: 'orange',
1314
1401
  hasFieldList: true,
1315
1402
  requiresName: true,
1316
- description: '把相关的填写项放在一起,例如「在校时间」下的开始与结束'
1403
+ descriptionId: 'blockKindDesc_object'
1317
1404
  },
1318
1405
  choice: {
1319
- label: '选项切换',
1406
+ labelId: 'blockKind_choice',
1320
1407
  color: 'magenta',
1321
1408
  hasChoiceOptions: true,
1322
- description: '先选一类情况,再填写对应内容;可设为单选或多选'
1409
+ descriptionId: 'blockKindDesc_choice'
1323
1410
  },
1324
1411
  steps: {
1325
- label: '分步表单',
1412
+ labelId: 'blockKind_steps',
1326
1413
  color: 'gold',
1327
1414
  hasSteps: true,
1328
- description: '将表单拆分成多个步骤,引导用户逐步填写'
1415
+ descriptionId: 'blockKindDesc_steps'
1329
1416
  }
1330
1417
  };
1331
1418
 
1332
1419
  /** editableList 添加按钮位置,与 @kne/form-info EditableList addPosition 一致 */
1333
1420
  const ADD_POSITIONS = ['bottom', 'top', 'both'];
1334
- const getBlockKindOptions = () => Object.entries(BLOCK_KINDS).map(_ref => {
1335
- let [value, config] = _ref;
1336
- return {
1337
- label: config.label,
1338
- value
1339
- };
1340
- });
1421
+ const getBlockKindOptions = formatMessage => Object.entries(BLOCK_KINDS).map(([value, config]) => ({
1422
+ label: typeof formatMessage === 'function' ? formatMessage({
1423
+ id: config.labelId
1424
+ }) : config.labelId,
1425
+ value
1426
+ }));
1341
1427
  const getBlockDefinition = kind => BLOCK_KINDS[kind];
1342
1428
  const blockToFormValues = block => ({
1343
1429
  kind: block.kind,
@@ -1360,10 +1446,7 @@ const blockToFormValues = block => ({
1360
1446
  selectorName: block.selectorName || '',
1361
1447
  selectorInData: block.selectorInData !== false
1362
1448
  });
1363
- const formValuesToBlock = function (values, existingBlock) {
1364
- if (existingBlock === void 0) {
1365
- existingBlock = {};
1366
- }
1449
+ const formValuesToBlock = (values, existingBlock = {}) => {
1367
1450
  const kind = values.kind || existingBlock.kind;
1368
1451
  const mode = values.mode === 'multiple' ? 'multiple' : 'single';
1369
1452
  const next = {
@@ -1398,28 +1481,18 @@ const stepToFormValues = step => ({
1398
1481
  title: step.title || '',
1399
1482
  column: step.column ?? 2
1400
1483
  });
1401
- const formValuesToStep = function (values, existingStep) {
1402
- if (existingStep === void 0) {
1403
- existingStep = {};
1404
- }
1405
- return {
1406
- ...existingStep,
1407
- title: values.title,
1408
- column: values.column ?? 2
1409
- };
1410
- };
1484
+ const formValuesToStep = (values, existingStep = {}) => ({
1485
+ ...existingStep,
1486
+ title: values.title,
1487
+ column: values.column ?? 2
1488
+ });
1411
1489
  const choiceOptionToFormValues = option => ({
1412
1490
  title: option.title || ''
1413
1491
  });
1414
- const formValuesToChoiceOption = function (values, existingOption) {
1415
- if (existingOption === void 0) {
1416
- existingOption = {};
1417
- }
1418
- return {
1419
- ...existingOption,
1420
- title: values.title
1421
- };
1422
- };
1492
+ const formValuesToChoiceOption = (values, existingOption = {}) => ({
1493
+ ...existingOption,
1494
+ title: values.title
1495
+ });
1423
1496
 
1424
1497
  const mapOptionItem = item => {
1425
1498
  if (!item || typeof item !== 'object') {
@@ -1522,16 +1595,18 @@ const createApiFromOptions = (options = []) => ({
1522
1595
  });
1523
1596
 
1524
1597
  const {
1525
- useOnChange: useOnChange$1
1598
+ useOnChange: useOnChange$2
1526
1599
  } = reactFormAntd.hooks;
1527
1600
  const hasNestedOptions = options => Array.isArray(options) && options.some(item => Array.isArray(item?.children) && item.children.length);
1528
- const createField = function (Component, _temp) {
1529
- let {
1530
- preferOptions = false,
1531
- flattenTree = false,
1532
- placeholderPrefix = '请选择'
1533
- } = _temp === void 0 ? {} : _temp;
1534
- const Field = props => {
1601
+ const createField = (Component, {
1602
+ preferOptions = false,
1603
+ flattenTree = false
1604
+ } = {}) => {
1605
+ const FieldInner = props => {
1606
+ const {
1607
+ formatMessage,
1608
+ locale
1609
+ } = reactIntl.useIntl();
1535
1610
  const {
1536
1611
  options,
1537
1612
  api,
@@ -1551,11 +1626,16 @@ const createField = function (Component, _temp) {
1551
1626
  }) : flattened;
1552
1627
  const useOptionsDirectly = preferOptions || hasNestedOptions(resolvedOptions);
1553
1628
  const mergedApi = api || (!useOptionsDirectly && Array.isArray(resolvedOptions) && resolvedOptions.length ? createApiFromOptions(resolvedOptions) : undefined);
1554
- const resolvedPlaceholder = placeholder != null && String(placeholder).trim() ? placeholder : `${placeholderPrefix}${props.label || ''}`;
1555
- const render = useOnChange$1(Object.assign({}, {
1629
+ const resolvedPlaceholder = placeholder != null && String(placeholder).trim() ? placeholder : formatMessage({
1630
+ id: 'extendedFieldPlaceholder'
1631
+ }, {
1632
+ label: props.label || ''
1633
+ }).trim();
1634
+ const render = useOnChange$2(Object.assign({}, {
1556
1635
  isPopup: true,
1557
1636
  placeholder: resolvedPlaceholder
1558
1637
  }, rest, {
1638
+ locale,
1559
1639
  valueKey,
1560
1640
  labelKey
1561
1641
  }, useOptionsDirectly && Array.isArray(resolvedOptions) ? {
@@ -1565,6 +1645,7 @@ const createField = function (Component, _temp) {
1565
1645
  } : {}));
1566
1646
  return render(Component);
1567
1647
  };
1648
+ const Field = withLocale$1(FieldInner);
1568
1649
  Field.field = Component;
1569
1650
  return Field;
1570
1651
  };
@@ -1585,13 +1666,13 @@ const SelectAddressField = createField(superSelectPlus.SelectAddress);
1585
1666
 
1586
1667
  const RULE_PRESET_ITEMS = [{
1587
1668
  value: 'REQ',
1588
- label: '必填'
1669
+ labelId: 'rulePresetREQ'
1589
1670
  }, {
1590
1671
  value: 'TEL',
1591
- label: '手机号格式'
1672
+ labelId: 'rulePresetTEL'
1592
1673
  }, {
1593
1674
  value: 'EMAIL',
1594
- label: '邮箱格式'
1675
+ labelId: 'rulePresetEMAIL'
1595
1676
  }];
1596
1677
  const DEFAULT_RULE_CONFIG = () => ({
1597
1678
  presets: [],
@@ -1637,12 +1718,11 @@ const parseRuleString = rule => {
1637
1718
  });
1638
1719
  return config;
1639
1720
  };
1640
- const buildRuleString = function (_temp) {
1641
- let {
1642
- presets = [],
1643
- lenMin,
1644
- lenMax
1645
- } = _temp === void 0 ? {} : _temp;
1721
+ const buildRuleString = ({
1722
+ presets = [],
1723
+ lenMin,
1724
+ lenMax
1725
+ } = {}) => {
1646
1726
  const parts = [];
1647
1727
  RULE_PRESET_ITEMS.forEach(item => {
1648
1728
  if (presets.includes(item.value)) {
@@ -1988,16 +2068,7 @@ const registerField = (type, definition) => {
1988
2068
  hasFieldProps: definition.hasFieldProps ?? !!(propsSchema && propsSchema.length)
1989
2069
  });
1990
2070
  };
1991
- const pickFromPropsSchema = function (props, propsSchema, defaultProps) {
1992
- if (props === void 0) {
1993
- props = {};
1994
- }
1995
- if (propsSchema === void 0) {
1996
- propsSchema = [];
1997
- }
1998
- if (defaultProps === void 0) {
1999
- defaultProps = {};
2000
- }
2071
+ const pickFromPropsSchema = (props = {}, propsSchema = [], defaultProps = {}) => {
2001
2072
  const next = {};
2002
2073
  propsSchema.forEach(item => {
2003
2074
  if (!item?.name) {
@@ -2021,13 +2092,7 @@ const pickFromPropsSchema = function (props, propsSchema, defaultProps) {
2021
2092
  });
2022
2093
  return next;
2023
2094
  };
2024
- const applyFromPropsSchema = function (props, values, propsSchema) {
2025
- if (values === void 0) {
2026
- values = {};
2027
- }
2028
- if (propsSchema === void 0) {
2029
- propsSchema = [];
2030
- }
2095
+ const applyFromPropsSchema = (props, values = {}, propsSchema = []) => {
2031
2096
  propsSchema.forEach(item => {
2032
2097
  if (!item?.name) {
2033
2098
  return;
@@ -2099,8 +2164,10 @@ const resolveFieldValueSchema = field => {
2099
2164
  ...schema
2100
2165
  };
2101
2166
  }
2102
- const title = field.label != null && String(field.label).trim() ? String(field.label).trim() : undefined;
2103
- const description = field.description != null && String(field.description).trim() ? String(field.description).trim() : undefined;
2167
+ const label = resolveLocaleText(field.label);
2168
+ const fieldDescription = resolveLocaleText(field.description);
2169
+ const title = label != null && String(label).trim() ? String(label).trim() : undefined;
2170
+ const description = fieldDescription != null && String(fieldDescription).trim() ? String(fieldDescription).trim() : undefined;
2104
2171
  if (title && schema.title == null) {
2105
2172
  schema.title = title;
2106
2173
  }
@@ -2151,11 +2218,10 @@ const getFieldTypes = formatMessage => {
2151
2218
  }
2152
2219
  customGroups.get(groupKey).options.push(option);
2153
2220
  });
2154
- customGroups.forEach(_ref => {
2155
- let {
2156
- label,
2157
- options
2158
- } = _ref;
2221
+ customGroups.forEach(({
2222
+ label,
2223
+ options
2224
+ }) => {
2159
2225
  grouped.push({
2160
2226
  label,
2161
2227
  options
@@ -2163,40 +2229,39 @@ const getFieldTypes = formatMessage => {
2163
2229
  });
2164
2230
  if (fallback.length) {
2165
2231
  grouped.push({
2166
- label: resolveRegistryLabel(formatMessage, 'FieldGroupExtended', '扩展字段'),
2232
+ label: resolveRegistryLabel(formatMessage, 'FieldGroupExtended'),
2167
2233
  options: fallback
2168
2234
  });
2169
2235
  }
2170
2236
  return grouped;
2171
2237
  };
2172
- const normalizeOptions = function (options, _temp) {
2173
- let {
2174
- allowChildren = false,
2175
- columns = []
2176
- } = _temp === void 0 ? {} : _temp;
2238
+ const normalizeOptions = (options, {
2239
+ allowChildren = false,
2240
+ columns = []
2241
+ } = {}) => {
2177
2242
  if (!Array.isArray(options)) {
2178
2243
  return [];
2179
2244
  }
2180
2245
  const columnNames = (columns || []).map(item => item?.name).filter(Boolean);
2181
2246
  return options.map(item => {
2182
- const label = String(item?.label ?? '').trim();
2247
+ const label = trimLocaleText(item?.label);
2183
2248
  let value = String(item?.value ?? '').trim();
2184
2249
  if (!value && label) {
2185
- value = label;
2250
+ value = localeTextToValue(label);
2186
2251
  }
2187
2252
  const next = {
2188
2253
  label,
2189
2254
  value,
2190
- description: String(item?.description ?? '').trim()
2255
+ description: trimLocaleText(item?.description)
2191
2256
  };
2192
2257
  columnNames.forEach(name => {
2193
2258
  next[name] = item?.[name] ?? '';
2194
2259
  });
2195
- if (!String(next.label).trim() && columnNames[0] && String(next[columnNames[0]] || '').trim()) {
2260
+ if (!hasLocaleText(next.label) && columnNames[0] && String(next[columnNames[0]] || '').trim()) {
2196
2261
  next.label = String(next[columnNames[0]]).trim();
2197
2262
  }
2198
- if (!String(next.value).trim() && String(next.label).trim()) {
2199
- next.value = next.label;
2263
+ if (!String(next.value).trim() && hasLocaleText(next.label)) {
2264
+ next.value = localeTextToValue(next.label);
2200
2265
  }
2201
2266
  if (allowChildren && Array.isArray(item?.children) && item.children.length) {
2202
2267
  next.children = normalizeOptions(item.children, {
@@ -2403,10 +2468,14 @@ const applyFieldProps = (props, values, definition) => {
2403
2468
  delete props.showTime;
2404
2469
  }
2405
2470
  if (values.range) {
2406
- // RangePicker 用数组 placeholder;单框用字符串
2471
+ // RangePicker 用数组 placeholder;单框用字符串;未填时交给 RangePicker 按 locale 显示默认提示
2407
2472
  const raw = values.placeholder;
2408
- const text = (Array.isArray(raw) ? raw[0] : raw) || '请选择日期';
2409
- props.placeholder = [text, text];
2473
+ const text = Array.isArray(raw) ? raw[0] : raw;
2474
+ if (text != null && String(text).trim()) {
2475
+ props.placeholder = [text, text];
2476
+ } else {
2477
+ delete props.placeholder;
2478
+ }
2410
2479
  } else {
2411
2480
  setOptionalString(props, 'placeholder', values.placeholder);
2412
2481
  }
@@ -2458,10 +2527,7 @@ const fieldToFormValues = field => {
2458
2527
  fieldProps: definition?.hasFieldProps ? pickFieldProps(field, definition) : undefined
2459
2528
  };
2460
2529
  };
2461
- const formValuesToField = function (values, existingField) {
2462
- if (existingField === void 0) {
2463
- existingField = {};
2464
- }
2530
+ const formValuesToField = (values, existingField = {}) => {
2465
2531
  const definition = getFieldDefinition(values.type) || getFieldDefinition('Input');
2466
2532
  // 不沿用旧类型残留 props,避免切换填写项类型后参数串味
2467
2533
  const props = {
@@ -2502,6 +2568,105 @@ const formValuesToField = function (values, existingField) {
2502
2568
  };
2503
2569
  };
2504
2570
 
2571
+ const {
2572
+ useOnChange: useOnChange$1
2573
+ } = reactFormAntd.hooks;
2574
+ const LocaleTextContext = /*#__PURE__*/react.createContext([]);
2575
+
2576
+ /** 向编辑器内的文案输入下发语言列表 [{ value, label }] */
2577
+ const LocaleTextProvider = ({
2578
+ languages,
2579
+ children
2580
+ }) => /*#__PURE__*/jsxRuntime.jsx(LocaleTextContext.Provider, {
2581
+ value: normalizeLanguages(languages),
2582
+ children: children
2583
+ });
2584
+
2585
+ /** 当前语言列表:组件 languages 优先,否则取 LocaleTextProvider */
2586
+ const useLocaleTextLanguages = languages => {
2587
+ const contextLanguages = react.useContext(LocaleTextContext);
2588
+ return languages ? normalizeLanguages(languages) : contextLanguages;
2589
+ };
2590
+
2591
+ /** 文案输入:未配置多语言时为单个输入框;配置后每种语言一个输入框,只填基础语言(首项)时存为字符串 */
2592
+ const LocaleTextControl = ({
2593
+ value,
2594
+ onChange,
2595
+ onBlur,
2596
+ placeholder,
2597
+ multiline = false,
2598
+ compact = false,
2599
+ rows = 2,
2600
+ disabled,
2601
+ className,
2602
+ languages: languagesProp
2603
+ }) => {
2604
+ const {
2605
+ formatMessage,
2606
+ locale
2607
+ } = reactIntl.useIntl();
2608
+ const languages = useLocaleTextLanguages(languagesProp);
2609
+ const Control = multiline ? antd.Input.TextArea : antd.Input;
2610
+ const controlProps = {
2611
+ disabled,
2612
+ onBlur,
2613
+ ...(multiline ? {
2614
+ rows
2615
+ } : {})
2616
+ };
2617
+ if (languages.length < 2) {
2618
+ const baseLanguage = languages[0]?.value;
2619
+ const editLanguage = isLocaleText(value) ? baseLanguage || Object.keys(value).find(key => value[key] === resolveLocaleText(value, locale)) || Object.keys(value)[0] : null;
2620
+ return /*#__PURE__*/jsxRuntime.jsx(Control, {
2621
+ ...controlProps,
2622
+ className: className,
2623
+ value: editLanguage ? value[editLanguage] || '' : value ?? '',
2624
+ placeholder: placeholder,
2625
+ onChange: e => onChange?.(editLanguage ? setLocaleTextValue(value, editLanguage, e.target.value, editLanguage) : e.target.value)
2626
+ });
2627
+ }
2628
+ const baseLanguage = languages[0];
2629
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
2630
+ className: [style['locale-text'], compact ? style['is-compact'] : null, className].filter(Boolean).join(' '),
2631
+ children: languages.map(language => /*#__PURE__*/jsxRuntime.jsxs("div", {
2632
+ className: style['locale-text-item'],
2633
+ children: [compact ? null : /*#__PURE__*/jsxRuntime.jsx("span", {
2634
+ className: style['locale-text-tag'],
2635
+ children: language.label
2636
+ }), /*#__PURE__*/jsxRuntime.jsx(Control, {
2637
+ ...controlProps,
2638
+ value: getLocaleTextValue(value, language.value, baseLanguage.value),
2639
+ placeholder: language.value === baseLanguage.value ? placeholder : formatMessage({
2640
+ id: 'localeTextFallback'
2641
+ }, {
2642
+ language: baseLanguage.label
2643
+ }),
2644
+ ...(compact && !multiline ? {
2645
+ prefix: /*#__PURE__*/jsxRuntime.jsx("span", {
2646
+ className: style['locale-text-prefix'],
2647
+ children: language.label
2648
+ })
2649
+ } : {}),
2650
+ onChange: e => onChange?.(setLocaleTextValue(value, language.value, e.target.value, baseLanguage.value))
2651
+ })]
2652
+ }, language.value))
2653
+ });
2654
+ };
2655
+ const LocaleInput = props => {
2656
+ const render = useOnChange$1(props);
2657
+ return render(LocaleTextControl);
2658
+ };
2659
+ LocaleInput.field = LocaleTextControl;
2660
+ const LocaleTextAreaControl = props => /*#__PURE__*/jsxRuntime.jsx(LocaleTextControl, {
2661
+ ...props,
2662
+ multiline: true
2663
+ });
2664
+ const LocaleTextArea = props => {
2665
+ const render = useOnChange$1(props);
2666
+ return render(LocaleTextAreaControl);
2667
+ };
2668
+ LocaleTextArea.field = LocaleTextAreaControl;
2669
+
2505
2670
  const {
2506
2671
  Text: Text$4
2507
2672
  } = antd.Typography;
@@ -2532,8 +2697,10 @@ const FieldRow = ({
2532
2697
  onMove
2533
2698
  }) => {
2534
2699
  const {
2535
- formatMessage
2700
+ formatMessage,
2701
+ locale
2536
2702
  } = reactIntl.useIntl();
2703
+ const languages = useLocaleTextLanguages();
2537
2704
  const definition = getFieldDefinition(field.type);
2538
2705
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
2539
2706
  className: style['field-row'],
@@ -2548,7 +2715,7 @@ const FieldRow = ({
2548
2715
  children: [/*#__PURE__*/jsxRuntime.jsx(Text$4, {
2549
2716
  strong: true,
2550
2717
  ellipsis: true,
2551
- children: field.label || formatMessage({
2718
+ children: resolveLocaleText(field.label, locale, languages) || formatMessage({
2552
2719
  id: 'untitledField'
2553
2720
  })
2554
2721
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
@@ -2618,30 +2785,24 @@ var FieldRow$1 = FieldRow;
2618
2785
  const {
2619
2786
  Text: Text$3
2620
2787
  } = antd.Typography;
2621
- const ActionGroup = _ref => {
2622
- let {
2623
- children
2624
- } = _ref;
2625
- return /*#__PURE__*/jsxRuntime.jsx("div", {
2626
- className: style['action-group'],
2627
- children: children
2628
- });
2629
- };
2630
- const IconBtn = _ref2 => {
2631
- let {
2632
- title,
2633
- danger,
2634
- ...props
2635
- } = _ref2;
2636
- return /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
2637
- type: "text",
2638
- size: "small",
2639
- title: title,
2640
- danger: danger,
2641
- className: style['action-btn'],
2642
- ...props
2643
- });
2644
- };
2788
+ const ActionGroup = ({
2789
+ children
2790
+ }) => /*#__PURE__*/jsxRuntime.jsx("div", {
2791
+ className: style['action-group'],
2792
+ children: children
2793
+ });
2794
+ const IconBtn = ({
2795
+ title,
2796
+ danger,
2797
+ ...props
2798
+ }) => /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
2799
+ type: "text",
2800
+ size: "small",
2801
+ title: title,
2802
+ danger: danger,
2803
+ className: style['action-btn'],
2804
+ ...props
2805
+ });
2645
2806
  const ROOT_ADD_OPTIONS = [{
2646
2807
  key: 'formInfo',
2647
2808
  icon: /*#__PURE__*/jsxRuntime.jsx(icons.FormOutlined, {})
@@ -2670,79 +2831,79 @@ const ROOT_ADD_OPTIONS = [{
2670
2831
 
2671
2832
  /** 可挂子模块的容器;表格列表 / 同类多值本身不支持子模块 */
2672
2833
  const NESTED_ADD_OPTIONS = ROOT_ADD_OPTIONS.filter(opt => opt.key !== 'steps');
2673
- const BlockListPanel = _ref3 => {
2674
- let {
2675
- blocks,
2676
- onAddBlock,
2677
- onEditBlock,
2678
- onDeleteBlock,
2679
- onMoveBlock,
2680
- onAddField,
2681
- onEditField,
2682
- onDeleteField,
2683
- onMoveField,
2684
- onAddStep,
2685
- onEditStep,
2686
- onDeleteStep,
2687
- onMoveStep,
2688
- onAddChoiceOption,
2689
- onEditChoiceOption,
2690
- onDeleteChoiceOption,
2691
- onMoveChoiceOption,
2692
- onOpenFormActions,
2693
- extraToolbar
2694
- } = _ref3;
2834
+ const BlockListPanel = ({
2835
+ blocks,
2836
+ onAddBlock,
2837
+ onEditBlock,
2838
+ onDeleteBlock,
2839
+ onMoveBlock,
2840
+ onAddField,
2841
+ onEditField,
2842
+ onDeleteField,
2843
+ onMoveField,
2844
+ onAddStep,
2845
+ onEditStep,
2846
+ onDeleteStep,
2847
+ onMoveStep,
2848
+ onAddChoiceOption,
2849
+ onEditChoiceOption,
2850
+ onDeleteChoiceOption,
2851
+ onMoveChoiceOption,
2852
+ onOpenFormActions,
2853
+ extraToolbar
2854
+ }) => {
2695
2855
  const {
2696
- formatMessage
2856
+ formatMessage,
2857
+ locale
2697
2858
  } = reactIntl.useIntl();
2859
+ const languages = useLocaleTextLanguages();
2860
+ const text = value => resolveLocaleText(value, locale, languages);
2698
2861
  const [addMenuOpen, setAddMenuOpen] = react.useState(false);
2699
2862
  const [addFieldMenuId, setAddFieldMenuId] = react.useState(null);
2700
2863
  const keepAddFieldMenuOpenRef = react.useRef(false);
2701
- const renderAddBlockMenu = function (options, _temp) {
2702
- let {
2703
- onSelect,
2704
- className
2705
- } = _temp === void 0 ? {} : _temp;
2706
- return /*#__PURE__*/jsxRuntime.jsx("div", {
2707
- className: className || style['add-block-dropdown'],
2708
- children: options.map(opt => {
2709
- const definition = getBlockDefinition(opt.key);
2710
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
2711
- role: "button",
2712
- tabIndex: 0,
2713
- className: style['add-block-option'],
2714
- onClick: () => onSelect(opt.key),
2715
- onKeyDown: e => {
2716
- if (e.key === 'Enter' || e.key === ' ') {
2717
- onSelect(opt.key);
2718
- }
2719
- },
2864
+ const renderAddBlockMenu = (options, {
2865
+ onSelect,
2866
+ className
2867
+ } = {}) => /*#__PURE__*/jsxRuntime.jsx("div", {
2868
+ className: className || style['add-block-dropdown'],
2869
+ children: options.map(opt => {
2870
+ const definition = getBlockDefinition(opt.key);
2871
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
2872
+ role: "button",
2873
+ tabIndex: 0,
2874
+ className: style['add-block-option'],
2875
+ onClick: () => onSelect(opt.key),
2876
+ onKeyDown: e => {
2877
+ if (e.key === 'Enter' || e.key === ' ') {
2878
+ onSelect(opt.key);
2879
+ }
2880
+ },
2881
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
2882
+ className: style['add-block-option-icon'],
2883
+ children: opt.icon
2884
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
2885
+ className: style['add-block-option-text'],
2720
2886
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
2721
- className: style['add-block-option-icon'],
2722
- children: opt.icon
2723
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
2724
- className: style['add-block-option-text'],
2725
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
2726
- className: style['add-block-option-title'],
2727
- children: formatMessage({
2728
- id: `blockKind_${opt.key}`
2729
- })
2730
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
2731
- className: style['add-block-option-desc'],
2732
- children: definition?.description
2733
- })]
2887
+ className: style['add-block-option-title'],
2888
+ children: formatMessage({
2889
+ id: `blockKind_${opt.key}`
2890
+ })
2891
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
2892
+ className: style['add-block-option-desc'],
2893
+ children: definition ? formatMessage({
2894
+ id: definition.descriptionId
2895
+ }) : null
2734
2896
  })]
2735
- }, opt.key);
2736
- })
2737
- });
2738
- };
2739
- const renderAddFieldButton = _ref4 => {
2740
- let {
2741
- menuKey,
2742
- depth,
2743
- onAddFieldClick,
2744
- onAddChildBlock
2745
- } = _ref4;
2897
+ })]
2898
+ }, opt.key);
2899
+ })
2900
+ });
2901
+ const renderAddFieldButton = ({
2902
+ menuKey,
2903
+ depth,
2904
+ onAddFieldClick,
2905
+ onAddChildBlock
2906
+ }) => {
2746
2907
  const canAddChild = typeof onAddChildBlock === 'function' && depth < MAX_BLOCK_DEPTH;
2747
2908
  const menuOpen = addFieldMenuId === menuKey;
2748
2909
  const btnClass = `${style['add-inline-btn']} ${style['hover-reveal']} ${menuOpen ? style['hover-reveal-active'] : ''}`.trim();
@@ -2830,9 +2991,11 @@ const BlockListPanel = _ref3 => {
2830
2991
  children: formatMessage({
2831
2992
  id: `blockKind_${opt.key}`
2832
2993
  })
2833
- }), definition?.description ? /*#__PURE__*/jsxRuntime.jsx("span", {
2994
+ }), definition ? /*#__PURE__*/jsxRuntime.jsx("span", {
2834
2995
  className: style['add-field-dropdown-item-desc'],
2835
- children: definition.description
2996
+ children: formatMessage({
2997
+ id: definition.descriptionId
2998
+ })
2836
2999
  }) : null]
2837
3000
  }, opt.key);
2838
3001
  })]
@@ -2854,11 +3017,10 @@ const BlockListPanel = _ref3 => {
2854
3017
  })
2855
3018
  });
2856
3019
  };
2857
- const renderFieldList = function (fields, blockId, _temp2) {
2858
- let {
2859
- stepId,
2860
- optionId
2861
- } = _temp2 === void 0 ? {} : _temp2;
3020
+ const renderFieldList = (fields, blockId, {
3021
+ stepId,
3022
+ optionId
3023
+ } = {}) => {
2862
3024
  if (!(fields || []).length) {
2863
3025
  return /*#__PURE__*/jsxRuntime.jsx(Text$3, {
2864
3026
  type: "secondary",
@@ -2939,7 +3101,7 @@ const BlockListPanel = _ref3 => {
2939
3101
  children: stepIndex + 1
2940
3102
  }), /*#__PURE__*/jsxRuntime.jsx(Text$3, {
2941
3103
  strong: true,
2942
- children: step.title || formatMessage({
3104
+ children: text(step.title) || formatMessage({
2943
3105
  id: 'untitledStep'
2944
3106
  }, {
2945
3107
  index: stepIndex + 1
@@ -3062,7 +3224,7 @@ const BlockListPanel = _ref3 => {
3062
3224
  children: optionIndex + 1
3063
3225
  }), /*#__PURE__*/jsxRuntime.jsx(Text$3, {
3064
3226
  strong: true,
3065
- children: option.title || formatMessage({
3227
+ children: text(option.title) || formatMessage({
3066
3228
  id: 'choiceOptionFallback'
3067
3229
  }, {
3068
3230
  index: optionIndex + 1
@@ -3145,10 +3307,7 @@ const BlockListPanel = _ref3 => {
3145
3307
  children: [renderFieldList(block.list, block.id), supportsItemBlocks$1 ? renderItemBlocks(block, depth) : null, supportsBlocks ? renderNestedBlocks(block.blocks, depth) : null]
3146
3308
  });
3147
3309
  };
3148
- const renderBlockSection = function (block, blockIndex, total, depth) {
3149
- if (depth === void 0) {
3150
- depth = 0;
3151
- }
3310
+ const renderBlockSection = (block, blockIndex, total, depth = 0) => {
3152
3311
  const definition = getBlockDefinition(block.kind);
3153
3312
  const canAddField = block.kind !== 'steps' && block.kind !== 'multiField' && block.kind !== 'choice';
3154
3313
  const supportsItemBlocks$1 = supportsItemBlocks(block.kind);
@@ -3193,7 +3352,7 @@ const BlockListPanel = _ref3 => {
3193
3352
  strong: true,
3194
3353
  ellipsis: true,
3195
3354
  className: style['block-title'],
3196
- children: block.title || block.label || block.name || formatMessage({
3355
+ children: text(block.title) || text(block.label) || block.name || formatMessage({
3197
3356
  id: 'untitledBlock'
3198
3357
  })
3199
3358
  }), /*#__PURE__*/jsxRuntime.jsx("span", {
@@ -3299,10 +3458,9 @@ const BlockListPanel = _ref3 => {
3299
3458
  };
3300
3459
  var BlockListPanel$1 = BlockListPanel;
3301
3460
 
3302
- const BlockConfigFields = _ref => {
3303
- let {
3304
- kind
3305
- } = _ref;
3461
+ const BlockConfigFields = ({
3462
+ kind
3463
+ }) => {
3306
3464
  const {
3307
3465
  formatMessage
3308
3466
  } = reactIntl.useIntl();
@@ -3311,7 +3469,7 @@ const BlockConfigFields = _ref => {
3311
3469
  const list = [];
3312
3470
  const isListKind = kind === 'list' || kind === 'tableList' || kind === 'editableList';
3313
3471
  if (kind === 'formInfo' || kind === 'list' || kind === 'tableList' || kind === 'editableList' || kind === 'object') {
3314
- list.push(/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
3472
+ list.push(/*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
3315
3473
  name: "title",
3316
3474
  label: formatMessage({
3317
3475
  id: 'blockTitle'
@@ -3319,7 +3477,7 @@ const BlockConfigFields = _ref => {
3319
3477
  placeholder: formatMessage({
3320
3478
  id: 'blockTitlePlaceholder'
3321
3479
  })
3322
- }, "title"), kind === 'formInfo' ? /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
3480
+ }, "title"), kind === 'formInfo' ? /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
3323
3481
  name: "subtitle",
3324
3482
  label: formatMessage({
3325
3483
  id: 'blockSubtitle'
@@ -3365,7 +3523,7 @@ const BlockConfigFields = _ref => {
3365
3523
  children: formatMessage({
3366
3524
  id: 'blockImportant'
3367
3525
  })
3368
- }, "important") : null, isListKind ? /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
3526
+ }, "important") : null, isListKind ? /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
3369
3527
  name: "addText",
3370
3528
  label: formatMessage({
3371
3529
  id: 'blockAddText'
@@ -3399,7 +3557,7 @@ const BlockConfigFields = _ref => {
3399
3557
  }, "minLength") : null);
3400
3558
  }
3401
3559
  if (kind === 'choice') {
3402
- list.push(/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
3560
+ list.push(/*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
3403
3561
  name: "title",
3404
3562
  label: formatMessage({
3405
3563
  id: 'blockTitle'
@@ -3433,12 +3591,9 @@ const BlockConfigFields = _ref => {
3433
3591
  placeholder: formatMessage({
3434
3592
  id: 'propOptionalNumber'
3435
3593
  }),
3436
- display: _ref2 => {
3437
- let {
3438
- openApi
3439
- } = _ref2;
3440
- return openApi?.data?.mode === 'multiple';
3441
- }
3594
+ display: ({
3595
+ openApi
3596
+ }) => openApi?.data?.mode === 'multiple'
3442
3597
  }, "minLength"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.InputNumber, {
3443
3598
  name: "maxLength",
3444
3599
  label: formatMessage({
@@ -3448,12 +3603,9 @@ const BlockConfigFields = _ref => {
3448
3603
  placeholder: formatMessage({
3449
3604
  id: 'propOptionalNumber'
3450
3605
  }),
3451
- display: _ref3 => {
3452
- let {
3453
- openApi
3454
- } = _ref3;
3455
- return openApi?.data?.mode === 'multiple';
3456
- }
3606
+ display: ({
3607
+ openApi
3608
+ }) => openApi?.data?.mode === 'multiple'
3457
3609
  }, "maxLength"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
3458
3610
  name: "selectorInData",
3459
3611
  children: formatMessage({
@@ -3467,12 +3619,9 @@ const BlockConfigFields = _ref => {
3467
3619
  placeholder: formatMessage({
3468
3620
  id: 'choiceSelectorNamePlaceholder'
3469
3621
  }),
3470
- display: _ref4 => {
3471
- let {
3472
- openApi
3473
- } = _ref4;
3474
- return openApi?.data?.selectorInData !== false;
3475
- }
3622
+ display: ({
3623
+ openApi
3624
+ }) => openApi?.data?.selectorInData !== false
3476
3625
  }, "selectorName"));
3477
3626
  }
3478
3627
  if (kind === 'multiField') {
@@ -3485,7 +3634,7 @@ const BlockConfigFields = _ref => {
3485
3634
  placeholder: formatMessage({
3486
3635
  id: 'fieldNamePlaceholder'
3487
3636
  })
3488
- }, "name"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
3637
+ }, "name"), /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
3489
3638
  name: "label",
3490
3639
  label: formatMessage({
3491
3640
  id: 'fieldLabel'
@@ -3501,7 +3650,7 @@ const BlockConfigFields = _ref => {
3501
3650
  }),
3502
3651
  rule: "REQ",
3503
3652
  options: fieldTypeOptions
3504
- }, "fieldType"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
3653
+ }, "fieldType"), /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
3505
3654
  name: "addText",
3506
3655
  label: formatMessage({
3507
3656
  id: 'blockAddText'
@@ -3512,7 +3661,7 @@ const BlockConfigFields = _ref => {
3512
3661
  }, "addText"));
3513
3662
  }
3514
3663
  if (kind === 'steps') {
3515
- list.push(/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
3664
+ list.push(/*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
3516
3665
  name: "title",
3517
3666
  label: formatMessage({
3518
3667
  id: 'blockTitle'
@@ -3520,7 +3669,7 @@ const BlockConfigFields = _ref => {
3520
3669
  placeholder: formatMessage({
3521
3670
  id: 'blockTitlePlaceholder'
3522
3671
  })
3523
- }, "title"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
3672
+ }, "title"), /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
3524
3673
  name: "subtitle",
3525
3674
  label: formatMessage({
3526
3675
  id: 'blockSubtitle'
@@ -3546,20 +3695,21 @@ const BlockConfigFields = _ref => {
3546
3695
  title: formatMessage({
3547
3696
  id: `blockKind_${kind}`
3548
3697
  }),
3549
- subtitle: definition?.description,
3698
+ subtitle: definition ? formatMessage({
3699
+ id: definition.descriptionId
3700
+ }) : undefined,
3550
3701
  column: 1,
3551
3702
  list: list.filter(Boolean)
3552
3703
  })
3553
3704
  });
3554
3705
  };
3555
- const BlockEditorModal = _ref5 => {
3556
- let {
3557
- open,
3558
- block,
3559
- onCancel,
3560
- onSave,
3561
- renderModal
3562
- } = _ref5;
3706
+ const BlockEditorModal = ({
3707
+ open,
3708
+ block,
3709
+ onCancel,
3710
+ onSave,
3711
+ renderModal
3712
+ }) => {
3563
3713
  const {
3564
3714
  formatMessage
3565
3715
  } = reactIntl.useIntl();
@@ -3609,14 +3759,13 @@ const BlockEditorModal = _ref5 => {
3609
3759
  };
3610
3760
  var BlockEditorModal$1 = BlockEditorModal;
3611
3761
 
3612
- const StepEditorModal = _ref => {
3613
- let {
3614
- open,
3615
- step,
3616
- onCancel,
3617
- onSave,
3618
- renderModal
3619
- } = _ref;
3762
+ const StepEditorModal = ({
3763
+ open,
3764
+ step,
3765
+ onCancel,
3766
+ onSave,
3767
+ renderModal
3768
+ }) => {
3620
3769
  const {
3621
3770
  formatMessage
3622
3771
  } = reactIntl.useIntl();
@@ -3648,7 +3797,7 @@ const StepEditorModal = _ref => {
3648
3797
  }),
3649
3798
  children: /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
3650
3799
  column: 1,
3651
- list: [/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
3800
+ list: [/*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
3652
3801
  name: "title",
3653
3802
  label: formatMessage({
3654
3803
  id: 'stepTitle'
@@ -3670,14 +3819,13 @@ const StepEditorModal = _ref => {
3670
3819
  };
3671
3820
  var StepEditorModal$1 = StepEditorModal;
3672
3821
 
3673
- const ChoiceOptionEditorModal = _ref => {
3674
- let {
3675
- open,
3676
- option,
3677
- onCancel,
3678
- onSave,
3679
- renderModal
3680
- } = _ref;
3822
+ const ChoiceOptionEditorModal = ({
3823
+ open,
3824
+ option,
3825
+ onCancel,
3826
+ onSave,
3827
+ renderModal
3828
+ }) => {
3681
3829
  const {
3682
3830
  formatMessage
3683
3831
  } = reactIntl.useIntl();
@@ -3709,7 +3857,7 @@ const ChoiceOptionEditorModal = _ref => {
3709
3857
  }),
3710
3858
  children: /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
3711
3859
  column: 1,
3712
- list: [/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
3860
+ list: [/*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
3713
3861
  name: "title",
3714
3862
  label: formatMessage({
3715
3863
  id: 'choiceOptionTitle'
@@ -3740,7 +3888,9 @@ const RulePresetEditor = () => {
3740
3888
  formatMessage
3741
3889
  } = reactIntl.useIntl();
3742
3890
  const options = [...RULE_PRESET_ITEMS.map(item => ({
3743
- label: item.label,
3891
+ label: item.labelId ? formatMessage({
3892
+ id: item.labelId
3893
+ }) : item.label,
3744
3894
  value: item.value
3745
3895
  })), {
3746
3896
  label: formatMessage({
@@ -3800,27 +3950,28 @@ const EMPTY_OPTION = () => ({
3800
3950
  });
3801
3951
 
3802
3952
  /** value 为空或仍等于当前 label 时视为联动中,改 label 会同步 value */
3803
- const isOptionValueLinked = (label, value) => {
3804
- const labelText = label == null ? '' : String(label);
3953
+ const isOptionValueLinked = (label, value, baseLanguage) => {
3954
+ const labelText = localeTextToValue(label, baseLanguage);
3805
3955
  const valueText = value == null ? '' : String(value);
3806
3956
  return valueText === '' || valueText === labelText;
3807
3957
  };
3808
- const patchOptionLabelChange = (item, nextLabel) => {
3958
+ const patchOptionLabelChange = (item, nextLabel, baseLanguage) => {
3809
3959
  const patch = {
3810
3960
  label: nextLabel
3811
3961
  };
3812
- if (isOptionValueLinked(item.label, item.value)) {
3813
- patch.value = nextLabel;
3962
+ if (isOptionValueLinked(item.label, item.value, baseLanguage)) {
3963
+ patch.value = localeTextToValue(nextLabel, baseLanguage);
3814
3964
  }
3815
3965
  return patch;
3816
3966
  };
3817
- const trimOptionLabelValue = item => {
3818
- const label = String(item?.label ?? '').trim();
3967
+ const trimOptionLabelValue = (item, baseLanguage) => {
3968
+ const label = trimLocaleText(item?.label, baseLanguage);
3969
+ const labelValue = localeTextToValue(label, baseLanguage);
3819
3970
  const rawValue = String(item?.value ?? '').trim();
3820
- const linked = isOptionValueLinked(item?.label, item?.value) || rawValue === '' || rawValue === label;
3971
+ const linked = isOptionValueLinked(item?.label, item?.value, baseLanguage) || rawValue === '' || rawValue === labelValue;
3821
3972
  return {
3822
3973
  label,
3823
- value: linked ? label : rawValue
3974
+ value: linked ? labelValue : rawValue
3824
3975
  };
3825
3976
  };
3826
3977
  const createEmptyTableRow = columns => {
@@ -3851,6 +4002,7 @@ const FlatOptionRows = ({
3851
4002
  const {
3852
4003
  formatMessage
3853
4004
  } = reactIntl.useIntl();
4005
+ const baseLanguage = useLocaleTextLanguages()[0]?.value;
3854
4006
  const rows = list.length ? ensureOptionKeys(list) : [EMPTY_OPTION()];
3855
4007
  const commit = next => onChange(next);
3856
4008
  const updateItem = (index, patch) => {
@@ -3865,13 +4017,15 @@ const FlatOptionRows = ({
3865
4017
  gap: 8,
3866
4018
  align: "start",
3867
4019
  className: style['options-row'],
3868
- children: [/*#__PURE__*/jsxRuntime.jsx(antd.Input, {
4020
+ children: [/*#__PURE__*/jsxRuntime.jsx(LocaleTextControl, {
4021
+ compact: true,
4022
+ className: style['options-locale-text'],
3869
4023
  value: item.label,
3870
4024
  placeholder: formatMessage({
3871
4025
  id: 'optionLabelPlaceholder'
3872
4026
  }),
3873
- onChange: event => updateItem(index, patchOptionLabelChange(item, event.target.value)),
3874
- onBlur: () => updateItem(index, trimOptionLabelValue(item))
4027
+ onChange: nextLabel => updateItem(index, patchOptionLabelChange(item, nextLabel, baseLanguage)),
4028
+ onBlur: () => updateItem(index, trimOptionLabelValue(item, baseLanguage))
3875
4029
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
3876
4030
  value: item.value,
3877
4031
  placeholder: formatMessage({
@@ -3883,16 +4037,18 @@ const FlatOptionRows = ({
3883
4037
  onBlur: () => updateItem(index, {
3884
4038
  value: String(item.value ?? '').trim()
3885
4039
  })
3886
- }), allowDescription ? /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
4040
+ }), allowDescription ? /*#__PURE__*/jsxRuntime.jsx(LocaleTextControl, {
4041
+ compact: true,
4042
+ className: style['options-locale-text'],
3887
4043
  value: item.description || '',
3888
4044
  placeholder: formatMessage({
3889
4045
  id: 'optionDescPlaceholder'
3890
4046
  }),
3891
- onChange: event => updateItem(index, {
3892
- description: event.target.value
4047
+ onChange: description => updateItem(index, {
4048
+ description
3893
4049
  }),
3894
4050
  onBlur: () => updateItem(index, {
3895
- description: String(item.description ?? '').trim()
4051
+ description: trimLocaleText(item.description, baseLanguage)
3896
4052
  })
3897
4053
  }) : null, /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
3898
4054
  type: "text",
@@ -3930,6 +4086,7 @@ const TreeOptionNode = ({
3930
4086
  const {
3931
4087
  formatMessage
3932
4088
  } = reactIntl.useIntl();
4089
+ const baseLanguage = useLocaleTextLanguages()[0]?.value;
3933
4090
  const children = Array.isArray(item.children) ? item.children : [];
3934
4091
  const canAddChild = depth < maxDepth;
3935
4092
  const updateSelf = patch => {
@@ -3964,13 +4121,14 @@ const TreeOptionNode = ({
3964
4121
  className: style['tree-option-row'],
3965
4122
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
3966
4123
  className: style['tree-option-fields'],
3967
- children: [/*#__PURE__*/jsxRuntime.jsx(antd.Input, {
4124
+ children: [/*#__PURE__*/jsxRuntime.jsx(LocaleTextControl, {
4125
+ compact: true,
3968
4126
  value: item.label,
3969
4127
  placeholder: formatMessage({
3970
4128
  id: 'optionLabelPlaceholder'
3971
4129
  }),
3972
- onChange: e => updateSelf(patchOptionLabelChange(item, e.target.value)),
3973
- onBlur: () => updateSelf(trimOptionLabelValue(item))
4130
+ onChange: nextLabel => updateSelf(patchOptionLabelChange(item, nextLabel, baseLanguage)),
4131
+ onBlur: () => updateSelf(trimOptionLabelValue(item, baseLanguage))
3974
4132
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
3975
4133
  value: item.value,
3976
4134
  placeholder: formatMessage({
@@ -3982,16 +4140,17 @@ const TreeOptionNode = ({
3982
4140
  onBlur: () => updateSelf({
3983
4141
  value: String(item.value ?? '').trim()
3984
4142
  })
3985
- }), allowDescription ? /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
4143
+ }), allowDescription ? /*#__PURE__*/jsxRuntime.jsx(LocaleTextControl, {
4144
+ compact: true,
3986
4145
  value: item.description || '',
3987
4146
  placeholder: formatMessage({
3988
4147
  id: 'optionDescPlaceholder'
3989
4148
  }),
3990
- onChange: e => updateSelf({
3991
- description: e.target.value
4149
+ onChange: description => updateSelf({
4150
+ description
3992
4151
  }),
3993
4152
  onBlur: () => updateSelf({
3994
- description: String(item.description ?? '').trim()
4153
+ description: trimLocaleText(item.description, baseLanguage)
3995
4154
  })
3996
4155
  }) : null]
3997
4156
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
@@ -4099,13 +4258,14 @@ const ColumnsEditor = ({
4099
4258
  gap: 8,
4100
4259
  align: "start",
4101
4260
  className: style['options-row'],
4102
- children: [/*#__PURE__*/jsxRuntime.jsx(antd.Input, {
4261
+ children: [/*#__PURE__*/jsxRuntime.jsx(LocaleTextControl, {
4262
+ compact: true,
4263
+ className: style['options-locale-text'],
4103
4264
  value: item.title || '',
4104
4265
  placeholder: formatMessage({
4105
4266
  id: 'columnTitlePlaceholder'
4106
4267
  }),
4107
- onChange: e => {
4108
- const title = e.target.value;
4268
+ onChange: title => {
4109
4269
  const patch = {
4110
4270
  title
4111
4271
  };
@@ -4175,8 +4335,10 @@ const TableRowsEditor = ({
4175
4335
  onChange
4176
4336
  }) => {
4177
4337
  const {
4178
- formatMessage
4338
+ formatMessage,
4339
+ locale
4179
4340
  } = reactIntl.useIntl();
4341
+ const languages = useLocaleTextLanguages();
4180
4342
  const usableColumns = columns.filter(column => column?.name && String(column.name).trim());
4181
4343
  const list = value.length ? value : [createEmptyTableRow(usableColumns)];
4182
4344
  const updateItem = (index, patch) => {
@@ -4251,13 +4413,15 @@ const TableRowsEditor = ({
4251
4413
  onChange: e => updateItem(index, {
4252
4414
  value: e.target.value
4253
4415
  })
4254
- }), /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
4416
+ }), /*#__PURE__*/jsxRuntime.jsx(LocaleTextControl, {
4417
+ compact: true,
4418
+ className: style['options-locale-text'],
4255
4419
  value: item.label || '',
4256
4420
  placeholder: formatMessage({
4257
4421
  id: 'tableRowLabelPlaceholder'
4258
4422
  }),
4259
- onChange: e => updateItem(index, {
4260
- label: e.target.value
4423
+ onChange: label => updateItem(index, {
4424
+ label
4261
4425
  })
4262
4426
  })]
4263
4427
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Flex, {
@@ -4269,7 +4433,7 @@ const TableRowsEditor = ({
4269
4433
  flex: 1
4270
4434
  },
4271
4435
  value: item[column.name] || '',
4272
- placeholder: column.title || column.name,
4436
+ placeholder: resolveLocaleText(column.title, locale, languages) || column.name,
4273
4437
  onChange: e => updateItem(index, {
4274
4438
  [column.name]: e.target.value
4275
4439
  })
@@ -4440,7 +4604,7 @@ const SuperSelectPropsEditor = ({
4440
4604
  display: ({
4441
4605
  openApi
4442
4606
  }) => !openApi?.data?.single
4443
- }, "maxLength"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
4607
+ }, "maxLength"), /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
4444
4608
  name: "placeholder",
4445
4609
  label: formatMessage({
4446
4610
  id: 'fieldPlaceholder'
@@ -4448,7 +4612,7 @@ const SuperSelectPropsEditor = ({
4448
4612
  placeholder: formatMessage({
4449
4613
  id: 'superSelectPlaceholderHint'
4450
4614
  })
4451
- }, "placeholder"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
4615
+ }, "placeholder"), /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
4452
4616
  name: "searchPlaceholder",
4453
4617
  label: formatMessage({
4454
4618
  id: 'superSelectSearchPlaceholder'
@@ -4504,7 +4668,7 @@ const buildPropsSchemaList = (schema, formatMessage) => (schema || []).filter(it
4504
4668
  }, item.name);
4505
4669
  });
4506
4670
  const buildBuiltinList = (type, formatMessage) => {
4507
- const placeholder = /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
4671
+ const placeholder = /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
4508
4672
  name: "placeholder",
4509
4673
  label: formatMessage({
4510
4674
  id: 'fieldPlaceholder'
@@ -4658,8 +4822,12 @@ const buildBuiltinList = (type, formatMessage) => {
4658
4822
  label: 'YYYY/MM/DD',
4659
4823
  value: 'YYYY/MM/DD'
4660
4824
  }, {
4661
- label: 'YYYY年MM月DD日',
4662
- value: 'YYYY年MM月DD日'
4825
+ label: formatMessage({
4826
+ id: 'propDateFormatLocalized'
4827
+ }),
4828
+ value: formatMessage({
4829
+ id: 'propDateFormatLocalized'
4830
+ })
4663
4831
  }, {
4664
4832
  label: 'YYYY-MM-DD HH:mm:ss',
4665
4833
  value: 'YYYY-MM-DD HH:mm:ss'
@@ -4680,7 +4848,7 @@ const buildBuiltinList = (type, formatMessage) => {
4680
4848
  })
4681
4849
  }, "showTime")];
4682
4850
  case 'Switch':
4683
- return [/*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
4851
+ return [/*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
4684
4852
  name: "checkedChildren",
4685
4853
  label: formatMessage({
4686
4854
  id: 'propSwitchOnText'
@@ -4688,7 +4856,7 @@ const buildBuiltinList = (type, formatMessage) => {
4688
4856
  placeholder: formatMessage({
4689
4857
  id: 'propSwitchOnTextHint'
4690
4858
  })
4691
- }, "checkedChildren"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
4859
+ }, "checkedChildren"), /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
4692
4860
  name: "unCheckedChildren",
4693
4861
  label: formatMessage({
4694
4862
  id: 'propSwitchOffText'
@@ -4760,21 +4928,17 @@ const getDefaultSelectProps = () => ({
4760
4928
  searchPlaceholder: '',
4761
4929
  columns: [createEmptyColumn()]
4762
4930
  });
4763
- const omitColumns = function (_temp) {
4764
- let {
4765
- columns,
4766
- ...rest
4767
- } = _temp === void 0 ? {} : _temp;
4768
- return rest;
4769
- };
4770
- const FieldConfigFields = _ref => {
4771
- let {
4772
- initialType,
4773
- options,
4774
- onOptionsChange,
4775
- columns,
4776
- onColumnsChange
4777
- } = _ref;
4931
+ const omitColumns = ({
4932
+ columns,
4933
+ ...rest
4934
+ } = {}) => rest;
4935
+ const FieldConfigFields = ({
4936
+ initialType,
4937
+ options,
4938
+ onOptionsChange,
4939
+ columns,
4940
+ onColumnsChange
4941
+ }) => {
4778
4942
  const {
4779
4943
  formatMessage
4780
4944
  } = reactIntl.useIntl();
@@ -4798,13 +4962,10 @@ const FieldConfigFields = _ref => {
4798
4962
  props: nextDefinition.defaultProps || {}
4799
4963
  }, nextDefinition);
4800
4964
  }
4801
- const entries = Object.entries(nextValues).map(_ref2 => {
4802
- let [name, value] = _ref2;
4803
- return {
4804
- name,
4805
- value
4806
- };
4807
- });
4965
+ const entries = Object.entries(nextValues).map(([name, value]) => ({
4966
+ name,
4967
+ value
4968
+ }));
4808
4969
  if (!entries.length || !openApi?.setFields) {
4809
4970
  return;
4810
4971
  }
@@ -4835,7 +4996,7 @@ const FieldConfigFields = _ref => {
4835
4996
  placeholder: formatMessage({
4836
4997
  id: 'fieldNamePlaceholder'
4837
4998
  })
4838
- }, "name"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
4999
+ }, "name"), /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
4839
5000
  name: "label",
4840
5001
  label: formatMessage({
4841
5002
  id: 'fieldLabel'
@@ -4844,7 +5005,7 @@ const FieldConfigFields = _ref => {
4844
5005
  placeholder: formatMessage({
4845
5006
  id: 'fieldLabelPlaceholder'
4846
5007
  })
4847
- }, "label"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
5008
+ }, "label"), /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
4848
5009
  name: "tips",
4849
5010
  label: formatMessage({
4850
5011
  id: 'fieldTips'
@@ -4852,7 +5013,7 @@ const FieldConfigFields = _ref => {
4852
5013
  placeholder: formatMessage({
4853
5014
  id: 'fieldTipsPlaceholder'
4854
5015
  })
4855
- }, "tips"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.TextArea, {
5016
+ }, "tips"), /*#__PURE__*/jsxRuntime.jsx(LocaleTextArea, {
4856
5017
  name: "description",
4857
5018
  label: formatMessage({
4858
5019
  id: 'fieldDescription'
@@ -4902,15 +5063,14 @@ const FieldConfigFields = _ref => {
4902
5063
  }) : null]
4903
5064
  });
4904
5065
  };
4905
- const FieldEditorModal = _ref3 => {
4906
- let {
4907
- open,
4908
- field,
4909
- fieldList,
4910
- onCancel,
4911
- onSave,
4912
- renderModal
4913
- } = _ref3;
5066
+ const FieldEditorModal = ({
5067
+ open,
5068
+ field,
5069
+ fieldList,
5070
+ onCancel,
5071
+ onSave,
5072
+ renderModal
5073
+ }) => {
4914
5074
  const {
4915
5075
  formatMessage
4916
5076
  } = reactIntl.useIntl();
@@ -5023,14 +5183,13 @@ const FieldEditorModal = _ref3 => {
5023
5183
  };
5024
5184
  var FieldEditorModal$1 = FieldEditorModal;
5025
5185
 
5026
- const FormActionsEditor = _ref => {
5027
- let {
5028
- open,
5029
- value,
5030
- onCancel,
5031
- onSave,
5032
- renderModal
5033
- } = _ref;
5186
+ const FormActionsEditor = ({
5187
+ open,
5188
+ value,
5189
+ onCancel,
5190
+ onSave,
5191
+ renderModal
5192
+ }) => {
5034
5193
  const {
5035
5194
  formatMessage
5036
5195
  } = reactIntl.useIntl();
@@ -5093,7 +5252,7 @@ const FormActionsEditor = _ref => {
5093
5252
  id: 'formActionsShowSubmit'
5094
5253
  }),
5095
5254
  className: style['form-actions-switch-field']
5096
- }, "showSubmit"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
5255
+ }, "showSubmit"), /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
5097
5256
  name: "submitText",
5098
5257
  label: formatMessage({
5099
5258
  id: 'formActionsSubmitText'
@@ -5101,12 +5260,9 @@ const FormActionsEditor = _ref => {
5101
5260
  placeholder: formatMessage({
5102
5261
  id: 'formActionsSubmitTextHint'
5103
5262
  }),
5104
- display: _ref2 => {
5105
- let {
5106
- openApi
5107
- } = _ref2;
5108
- return Boolean(openApi?.data?.showSubmit);
5109
- }
5263
+ display: ({
5264
+ openApi
5265
+ }) => Boolean(openApi?.data?.showSubmit)
5110
5266
  }, "submitText")]
5111
5267
  }), /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
5112
5268
  column: 2,
@@ -5116,7 +5272,7 @@ const FormActionsEditor = _ref => {
5116
5272
  id: 'formActionsShowReset'
5117
5273
  }),
5118
5274
  className: style['form-actions-switch-field']
5119
- }, "showReset"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
5275
+ }, "showReset"), /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
5120
5276
  name: "resetText",
5121
5277
  label: formatMessage({
5122
5278
  id: 'formActionsResetText'
@@ -5124,12 +5280,9 @@ const FormActionsEditor = _ref => {
5124
5280
  placeholder: formatMessage({
5125
5281
  id: 'formActionsResetTextHint'
5126
5282
  }),
5127
- display: _ref3 => {
5128
- let {
5129
- openApi
5130
- } = _ref3;
5131
- return Boolean(openApi?.data?.showReset);
5132
- }
5283
+ display: ({
5284
+ openApi
5285
+ }) => Boolean(openApi?.data?.showReset)
5133
5286
  }, "resetText")]
5134
5287
  }), /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
5135
5288
  column: 2,
@@ -5139,7 +5292,7 @@ const FormActionsEditor = _ref => {
5139
5292
  id: 'formActionsShowCancel'
5140
5293
  }),
5141
5294
  className: style['form-actions-switch-field']
5142
- }, "showCancel"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
5295
+ }, "showCancel"), /*#__PURE__*/jsxRuntime.jsx(LocaleInput, {
5143
5296
  name: "cancelText",
5144
5297
  label: formatMessage({
5145
5298
  id: 'formActionsCancelText'
@@ -5147,12 +5300,9 @@ const FormActionsEditor = _ref => {
5147
5300
  placeholder: formatMessage({
5148
5301
  id: 'formActionsCancelTextHint'
5149
5302
  }),
5150
- display: _ref4 => {
5151
- let {
5152
- openApi
5153
- } = _ref4;
5154
- return Boolean(openApi?.data?.showCancel);
5155
- }
5303
+ display: ({
5304
+ openApi
5305
+ }) => Boolean(openApi?.data?.showCancel)
5156
5306
  }, "cancelText")]
5157
5307
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
5158
5308
  className: style['form-actions-layout-panel'],
@@ -5274,30 +5424,30 @@ const resolveSelectLimits = block => {
5274
5424
  };
5275
5425
  const buildMultipleHint = (formatMessage, minLength, maxLength) => {
5276
5426
  if (minLength != null && maxLength != null) {
5277
- return formatMessage ? formatMessage({
5427
+ return formatMessage({
5278
5428
  id: 'choiceModeHintMultipleRange'
5279
5429
  }, {
5280
5430
  min: minLength,
5281
5431
  max: maxLength
5282
- }) : `请选择 ${minLength}–${maxLength} 项`;
5432
+ });
5283
5433
  }
5284
5434
  if (minLength != null) {
5285
- return formatMessage ? formatMessage({
5435
+ return formatMessage({
5286
5436
  id: 'choiceModeHintMultipleMin'
5287
5437
  }, {
5288
5438
  count: minLength
5289
- }) : `请至少选择 ${minLength} 项`;
5439
+ });
5290
5440
  }
5291
5441
  if (maxLength != null) {
5292
- return formatMessage ? formatMessage({
5442
+ return formatMessage({
5293
5443
  id: 'choiceModeHintMultipleMax'
5294
5444
  }, {
5295
5445
  count: maxLength
5296
- }) : `最多选择 ${maxLength} 项`;
5446
+ });
5297
5447
  }
5298
- return formatMessage ? formatMessage({
5448
+ return formatMessage({
5299
5449
  id: 'choiceModeHintMultiple'
5300
- }) : '可以选择多项';
5450
+ });
5301
5451
  };
5302
5452
 
5303
5453
  /**
@@ -5323,9 +5473,9 @@ const ChoiceBlock = ({
5323
5473
  openApi
5324
5474
  } = reactFormAntd.useFormContext() || {};
5325
5475
  const titleText = block?.title != null ? String(block.title).trim() : '';
5326
- const title = titleText || (formatMessage ? formatMessage({
5476
+ const title = titleText || formatMessage({
5327
5477
  id: 'choiceAreaTitle'
5328
- }) : '请选择');
5478
+ });
5329
5479
  const bordered = isMobile ? false : block?.bordered || undefined;
5330
5480
  const {
5331
5481
  minLength,
@@ -5357,11 +5507,11 @@ const ChoiceBlock = ({
5357
5507
  return options.map((option, index) => {
5358
5508
  const value = String(option.id);
5359
5509
  return {
5360
- label: option.title || (formatMessage ? formatMessage({
5510
+ label: option.title || formatMessage({
5361
5511
  id: 'choiceOptionFallback'
5362
5512
  }, {
5363
5513
  index: index + 1
5364
- }) : `选项${index + 1}`),
5514
+ }),
5365
5515
  value,
5366
5516
  disabled: atMax && !selectedIdsFromValue.includes(value)
5367
5517
  };
@@ -5390,21 +5540,21 @@ const ChoiceBlock = ({
5390
5540
  if (minLength != null && ids.length < minLength) {
5391
5541
  return {
5392
5542
  result: false,
5393
- errMsg: formatMessage ? formatMessage({
5543
+ errMsg: formatMessage({
5394
5544
  id: 'choiceMinSelectError'
5395
5545
  }, {
5396
5546
  count: minLength
5397
- }) : `请至少选择 ${minLength} 项`
5547
+ })
5398
5548
  };
5399
5549
  }
5400
5550
  if (maxLength != null && ids.length > maxLength) {
5401
5551
  return {
5402
5552
  result: false,
5403
- errMsg: formatMessage ? formatMessage({
5553
+ errMsg: formatMessage({
5404
5554
  id: 'choiceMaxSelectError'
5405
5555
  }, {
5406
5556
  count: maxLength
5407
- }) : `最多只能选择 ${maxLength} 项`
5557
+ })
5408
5558
  };
5409
5559
  }
5410
5560
  return {
@@ -5417,9 +5567,9 @@ const ChoiceBlock = ({
5417
5567
  const selectorProps = {
5418
5568
  key: `choice-selector-${mode}`,
5419
5569
  name: selectorName,
5420
- label: titleText || (formatMessage ? formatMessage({
5570
+ label: titleText || formatMessage({
5421
5571
  id: 'choiceAreaTitle'
5422
- }) : '请选择'),
5572
+ }),
5423
5573
  labelHidden: true,
5424
5574
  options: selectorOptions,
5425
5575
  onChange: handleChange,
@@ -5453,9 +5603,9 @@ const ChoiceBlock = ({
5453
5603
  }, option.title) : null, ...nodes));
5454
5604
  }
5455
5605
  });
5456
- const modeHint = mode === 'multiple' ? buildMultipleHint(formatMessage, minLength, maxLength) : formatMessage ? formatMessage({
5606
+ const modeHint = mode === 'multiple' ? buildMultipleHint(formatMessage, minLength, maxLength) : formatMessage({
5457
5607
  id: 'choiceModeHintSingle'
5458
- }) : '请选择其中一项';
5608
+ });
5459
5609
  if (!block) {
5460
5610
  return null;
5461
5611
  }
@@ -5471,12 +5621,62 @@ const ChoiceBlock = ({
5471
5621
  className: style['choice-panels']
5472
5622
  }, ...contentChildren) : /*#__PURE__*/react.createElement('div', {
5473
5623
  className: style['choice-panels-empty']
5474
- }, formatMessage ? formatMessage({
5624
+ }, formatMessage({
5475
5625
  id: 'choiceSelectFirstHint'
5476
- }) : '请先在上方选择'));
5626
+ })));
5477
5627
  };
5478
5628
  var ChoiceBlock$1 = ChoiceBlock;
5479
5629
 
5630
+ // @kne/react-form 内置规则的错误提示写死中文;在 preset 覆盖前记下原函数,只替换未被业务覆盖的规则
5631
+ const BUILTIN_RULES = {
5632
+ TEL: reactFormAntd.RULES.TEL,
5633
+ EMAIL: reactFormAntd.RULES.EMAIL,
5634
+ LEN: reactFormAntd.RULES.LEN
5635
+ };
5636
+ const isBuiltin = name => reactFormAntd.RULES[name] === BUILTIN_RULES[name];
5637
+ const lenMessageId = (value, start, end) => {
5638
+ if (end === start) {
5639
+ return 'ruleErrorLenEqual';
5640
+ }
5641
+ return String(value ?? '').length < start ? 'ruleErrorLenMin' : 'ruleErrorLenMax';
5642
+ };
5643
+
5644
+ /** 按当前语言生成表单级 rules,传给 Form 覆盖全局同名规则 */
5645
+ const createLocalizedRules = formatMessage => {
5646
+ if (typeof formatMessage !== 'function') {
5647
+ return {};
5648
+ }
5649
+ const rules = {};
5650
+ ['TEL', 'EMAIL'].forEach(name => {
5651
+ if (isBuiltin(name)) {
5652
+ rules[name] = function () {
5653
+ const res = BUILTIN_RULES[name](...[].slice.call(arguments));
5654
+ return res.result ? res : {
5655
+ ...res,
5656
+ errMsg: formatMessage({
5657
+ id: `ruleError${name}`
5658
+ })
5659
+ };
5660
+ };
5661
+ }
5662
+ });
5663
+ if (isBuiltin('LEN')) {
5664
+ rules.LEN = (value, start, end) => {
5665
+ const res = BUILTIN_RULES.LEN(value, start, end);
5666
+ return res.result ? res : {
5667
+ ...res,
5668
+ errMsg: formatMessage({
5669
+ id: lenMessageId(value, start, end)
5670
+ }, {
5671
+ start,
5672
+ end
5673
+ })
5674
+ };
5675
+ };
5676
+ }
5677
+ return rules;
5678
+ };
5679
+
5480
5680
  const buildLabelTips = tips => {
5481
5681
  if (tips == null || !String(tips).trim()) {
5482
5682
  return undefined;
@@ -5497,10 +5697,9 @@ const buildFieldLabel = field => {
5497
5697
  return base || undefined;
5498
5698
  };
5499
5699
  const buildIndexedLabelRender = index => {
5500
- return _ref => {
5501
- let {
5502
- label
5503
- } = _ref;
5700
+ return ({
5701
+ label
5702
+ }) => {
5504
5703
  const text = label != null ? String(label).replace(/\u200b/g, '') : '';
5505
5704
  return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement('span', {
5506
5705
  className: style['field-label-index']
@@ -5509,67 +5708,61 @@ const buildIndexedLabelRender = index => {
5509
5708
  }, text) : null);
5510
5709
  };
5511
5710
  };
5512
- const renderFieldElements = function (fields, preview, _temp) {
5513
- if (fields === void 0) {
5514
- fields = [];
5711
+ const renderFieldElements = (fields = [], preview = false, {
5712
+ namePrefix,
5713
+ locale,
5714
+ showIndex = false
5715
+ } = {}) => fields.filter(field => !field.hidden).map((field, index) => {
5716
+ const Component = getFieldComponent(field.type, field);
5717
+ if (!Component) {
5718
+ return null;
5515
5719
  }
5516
- let {
5517
- namePrefix,
5518
- locale,
5519
- showIndex = false
5520
- } = _temp === void 0 ? {} : _temp;
5521
- return fields.filter(field => !field.hidden).map((field, index) => {
5522
- const Component = getFieldComponent(field.type, field);
5523
- if (!Component) {
5524
- return null;
5525
- }
5526
- const definition = getFieldDefinition(field.type);
5527
- const props = {
5528
- ...(definition?.defaultProps || {}),
5529
- ...(field.props || {})
5530
- };
5531
- if (definition?.optionsAllowDescription && props.options?.length && !props.api && !definition.optionsAllowChildren) {
5532
- props.api = createApiFromOptions(props.options);
5533
- }
5534
- if (!Array.isArray(props.placeholder) && props.placeholder != null && !String(props.placeholder).trim()) {
5535
- delete props.placeholder;
5536
- }
5537
- delete props.range;
5720
+ const definition = getFieldDefinition(field.type);
5721
+ const props = {
5722
+ ...(definition?.defaultProps || {}),
5723
+ ...(field.props || {})
5724
+ };
5725
+ if (definition?.optionsAllowDescription && props.options?.length && !props.api && !definition.optionsAllowChildren) {
5726
+ props.api = createApiFromOptions(props.options);
5727
+ }
5728
+ if (!Array.isArray(props.placeholder) && props.placeholder != null && !String(props.placeholder).trim()) {
5729
+ delete props.placeholder;
5730
+ }
5731
+ delete props.range;
5538
5732
 
5539
- // Radio/Checkbox 选项布局:inline=false 纵向;Radio 用 antd vertical,Checkbox 用样式兜底
5540
- if (field.type === 'RadioGroup' || field.type === 'CheckboxGroup') {
5541
- const optionsInline = props.inline !== false;
5542
- delete props.inline;
5543
- if (!optionsInline) {
5544
- if (field.type === 'RadioGroup') {
5545
- props.vertical = true;
5546
- }
5547
- props.className = [props.className, style['option-group-stack']].filter(Boolean).join(' ');
5733
+ // Radio/Checkbox 选项布局:inline=false 纵向;Radio 用 antd vertical,Checkbox 用样式兜底
5734
+ if (field.type === 'RadioGroup' || field.type === 'CheckboxGroup') {
5735
+ const optionsInline = props.inline !== false;
5736
+ delete props.inline;
5737
+ if (!optionsInline) {
5738
+ if (field.type === 'RadioGroup') {
5739
+ props.vertical = true;
5548
5740
  }
5741
+ props.className = [props.className, style['option-group-stack']].filter(Boolean).join(' ');
5549
5742
  }
5550
- const description = field.description != null && String(field.description).trim() ? field.description : undefined;
5551
- const fieldName = namePrefix && field.name ? `${namePrefix}.${field.name}` : field.name;
5552
- // 显式传 locale,避免 Global 仍为 zh-CN 时 react-form-antd withLocale 盖掉父级英文
5553
- const localeProps = locale ? {
5554
- locale
5555
- } : {};
5556
- const label = buildFieldLabel(field);
5557
- return /*#__PURE__*/react.createElement(Component, {
5558
- key: field.id,
5559
- name: fieldName,
5560
- label: showIndex ? label || '\u200b' : label,
5561
- ...(showIndex ? {
5562
- labelRender: buildIndexedLabelRender(index)
5563
- } : null),
5564
- rule: field.rule || undefined,
5565
- block: field.block || undefined,
5566
- ...props,
5567
- ...localeProps,
5568
- labelTips: buildLabelTips(field.tips),
5569
- description
5570
- });
5571
- }).filter(Boolean);
5572
- };
5743
+ }
5744
+ const description = field.description != null && String(field.description).trim() ? field.description : undefined;
5745
+ const fieldName = namePrefix && field.name ? `${namePrefix}.${field.name}` : field.name;
5746
+ // 显式传 locale,避免 Global 仍为 zh-CN 时 react-form-antd withLocale 盖掉父级英文
5747
+ const localeProps = locale ? {
5748
+ locale
5749
+ } : {};
5750
+ const label = buildFieldLabel(field);
5751
+ return /*#__PURE__*/react.createElement(Component, {
5752
+ key: field.id,
5753
+ name: fieldName,
5754
+ label: showIndex ? label || '\u200b' : label,
5755
+ ...(showIndex ? {
5756
+ labelRender: buildIndexedLabelRender(index)
5757
+ } : null),
5758
+ rule: field.rule || undefined,
5759
+ block: field.block || undefined,
5760
+ ...props,
5761
+ ...localeProps,
5762
+ labelTips: buildLabelTips(field.tips),
5763
+ description
5764
+ });
5765
+ }).filter(Boolean);
5573
5766
  const withBlockLayout = (element, forceBlock) => {
5574
5767
  if (!element || !forceBlock) {
5575
5768
  return element;
@@ -5600,13 +5793,7 @@ const nestedListItemPartProps = {
5600
5793
  }
5601
5794
  };
5602
5795
  const isFormInfoLikeBlock = kind => kind === 'formInfo' || kind === 'object';
5603
- const renderBlockElement = function (block, preview, ctx) {
5604
- if (preview === void 0) {
5605
- preview = false;
5606
- }
5607
- if (ctx === void 0) {
5608
- ctx = {};
5609
- }
5796
+ const renderBlockElement = (block, preview = false, ctx = {}) => {
5610
5797
  const {
5611
5798
  isMobile = false,
5612
5799
  formatMessage,
@@ -5628,29 +5815,16 @@ const renderBlockElement = function (block, preview, ctx) {
5628
5815
  const bordered = isMobile ? false : block.bordered || undefined;
5629
5816
  // 仅 FormInfo/object 吃列表项 Part 样式;List 等交给 form-info nestDepth
5630
5817
  const listItemPartProps = asListItem && isFormInfoLikeBlock(block.kind) ? nestedListItemPartProps : null;
5631
- const renderChildBlocks = function (blocks, childCtx) {
5632
- if (blocks === void 0) {
5633
- blocks = [];
5634
- }
5635
- if (childCtx === void 0) {
5636
- childCtx = nextCtx;
5637
- }
5638
- return (blocks || []).map(child => renderBlockElement(child, preview, childCtx)).filter(Boolean);
5639
- };
5818
+ const renderChildBlocks = (blocks = [], childCtx = nextCtx) => (blocks || []).map(child => renderBlockElement(child, preview, childCtx)).filter(Boolean);
5640
5819
 
5641
5820
  /** list.itemBlocks:object/formInfo 走 asListItem;嵌套 list 等保持 nestDepth 链路 */
5642
- const renderItemBlocks = function (blocks) {
5643
- if (blocks === void 0) {
5644
- blocks = [];
5645
- }
5646
- return (blocks || []).map(child => {
5647
- const childCtx = {
5648
- ...nextCtx,
5649
- asListItem: isFormInfoLikeBlock(child.kind)
5650
- };
5651
- return withBlockLayout(renderBlockElement(child, preview, childCtx), true);
5652
- }).filter(Boolean);
5653
- };
5821
+ const renderItemBlocks = (blocks = []) => (blocks || []).map(child => {
5822
+ const childCtx = {
5823
+ ...nextCtx,
5824
+ asListItem: isFormInfoLikeBlock(child.kind)
5825
+ };
5826
+ return withBlockLayout(renderBlockElement(child, preview, childCtx), true);
5827
+ }).filter(Boolean);
5654
5828
  switch (block.kind) {
5655
5829
  case 'formInfo':
5656
5830
  {
@@ -5830,7 +6004,7 @@ const renderBlockElement = function (block, preview, ctx) {
5830
6004
  key: `${option.id}-fields`,
5831
6005
  column: block.column || 2,
5832
6006
  gap: block.gap,
5833
- list: renderFieldElements(option.list)
6007
+ list: renderFieldElements(option.list, preview)
5834
6008
  }));
5835
6009
  }
5836
6010
  nodes.push(...renderChildBlocks(option.blocks || [], nextCtx));
@@ -5841,17 +6015,16 @@ const renderBlockElement = function (block, preview, ctx) {
5841
6015
  return null;
5842
6016
  }
5843
6017
  };
5844
- const renderSchemaInner = function (schema, _temp2) {
5845
- let {
5846
- preview = false,
5847
- className,
5848
- bodyClassName,
5849
- isMobile = false,
5850
- formatMessage,
5851
- locale,
5852
- children,
5853
- actionNode
5854
- } = _temp2 === void 0 ? {} : _temp2;
6018
+ const renderSchemaInner = (schema, {
6019
+ preview = false,
6020
+ className,
6021
+ bodyClassName,
6022
+ isMobile = false,
6023
+ formatMessage,
6024
+ locale,
6025
+ children,
6026
+ actionNode
6027
+ } = {}) => {
5855
6028
  const normalized = normalizeSchema(schema);
5856
6029
  const blocks = normalized.blocks || [];
5857
6030
  const contentChildren = blocks.map(block => renderBlockElement(block, preview, {
@@ -5870,18 +6043,17 @@ const renderSchemaInner = function (schema, _temp2) {
5870
6043
  className
5871
6044
  }, content) : content;
5872
6045
  };
5873
- const renderSchemaContent = function (schema, _temp3) {
5874
- let {
5875
- preview = false,
5876
- formProps = {},
5877
- className,
5878
- bodyClassName,
5879
- isMobile = false,
5880
- formatMessage,
5881
- locale,
5882
- children,
5883
- actionNode
5884
- } = _temp3 === void 0 ? {} : _temp3;
6046
+ const renderSchemaContent = (schema, {
6047
+ preview = false,
6048
+ formProps = {},
6049
+ className,
6050
+ bodyClassName,
6051
+ isMobile = false,
6052
+ formatMessage,
6053
+ locale,
6054
+ children,
6055
+ actionNode
6056
+ } = {}) => {
5885
6057
  const normalized = normalizeSchema(schema);
5886
6058
  const blocks = normalized.blocks || [];
5887
6059
  const contentChildren = blocks.map(block => renderBlockElement(block, preview, {
@@ -5895,6 +6067,10 @@ const renderSchemaContent = function (schema, _temp3) {
5895
6067
  const formClassName = [style['schema-form'], formProps.className, className].filter(Boolean).join(' ');
5896
6068
  return /*#__PURE__*/react.createElement(FormInfo.Form, {
5897
6069
  ...formProps,
6070
+ rules: {
6071
+ ...createLocalizedRules(formatMessage),
6072
+ ...formProps.rules
6073
+ },
5898
6074
  className: formClassName
5899
6075
  }, /*#__PURE__*/react.createElement('div', {
5900
6076
  className: [style['schema-body'], bodyClassName].filter(Boolean).join(' ')
@@ -5905,27 +6081,26 @@ var renderSchemaContent$1 = renderSchemaContent;
5905
6081
  const joinClass = function () {
5906
6082
  return [].slice.call(arguments).filter(Boolean).join(' ');
5907
6083
  };
5908
- const resolveActionNode = _ref => {
5909
- let {
5910
- schema,
5911
- formatMessage,
5912
- actions,
5913
- showActions = true,
5914
- submitText,
5915
- resetText,
5916
- cancelText,
5917
- submitButtonProps,
5918
- resetButtonProps,
5919
- cancelButtonProps,
5920
- showSubmit,
5921
- showReset,
5922
- showCancel,
5923
- actionsAlign,
5924
- actionsGap,
5925
- footerClassName,
5926
- buttonFooter = false,
5927
- buttonFooterProps
5928
- } = _ref;
6084
+ const resolveActionNode = ({
6085
+ schema,
6086
+ formatMessage,
6087
+ actions,
6088
+ showActions = true,
6089
+ submitText,
6090
+ resetText,
6091
+ cancelText,
6092
+ submitButtonProps,
6093
+ resetButtonProps,
6094
+ cancelButtonProps,
6095
+ showSubmit,
6096
+ showReset,
6097
+ showCancel,
6098
+ actionsAlign,
6099
+ actionsGap,
6100
+ footerClassName,
6101
+ buttonFooter = false,
6102
+ buttonFooterProps
6103
+ }) => {
5929
6104
  if (showActions === false || actions === false || actions === null) {
5930
6105
  return null;
5931
6106
  }
@@ -6007,14 +6182,15 @@ const SchemaRendererInner = withLocale$1(props => {
6007
6182
  bodyClassName,
6008
6183
  footerClassName,
6009
6184
  buttonFooter = false,
6010
- buttonFooterProps
6185
+ buttonFooterProps,
6186
+ languages
6011
6187
  } = props;
6012
6188
  const {
6013
6189
  formatMessage,
6014
6190
  locale
6015
6191
  } = reactIntl.useIntl();
6016
6192
  const isMobile = responsiveUtils.useIsMobile();
6017
- const normalized = normalizeSchema(schema);
6193
+ const normalized = normalizeSchema(localizeSchema(schema, locale, languages));
6018
6194
  if (!hasRenderableContent(normalized)) {
6019
6195
  return null;
6020
6196
  }
@@ -6072,14 +6248,15 @@ const SchemaRenderer = withLocale$1(props => {
6072
6248
  bodyClassName,
6073
6249
  footerClassName,
6074
6250
  buttonFooter = false,
6075
- buttonFooterProps
6251
+ buttonFooterProps,
6252
+ languages
6076
6253
  } = props;
6077
6254
  const {
6078
6255
  formatMessage,
6079
6256
  locale
6080
6257
  } = reactIntl.useIntl();
6081
6258
  const isMobile = responsiveUtils.useIsMobile();
6082
- const normalized = normalizeSchema(schema);
6259
+ const normalized = normalizeSchema(localizeSchema(schema, locale, languages));
6083
6260
  if (!hasRenderableContent(normalized)) {
6084
6261
  return null;
6085
6262
  }
@@ -6117,17 +6294,17 @@ const SchemaRenderer = withLocale$1(props => {
6117
6294
  });
6118
6295
  var SchemaRenderer$1 = SchemaRenderer;
6119
6296
 
6120
- const FormCreator = withLocale$1(_ref => {
6121
- let {
6122
- value,
6123
- defaultValue,
6124
- onChange,
6125
- showPreview = true,
6126
- className,
6127
- formProps,
6128
- renderModal,
6129
- extraToolbar
6130
- } = _ref;
6297
+ const FormCreator = withLocale$1(({
6298
+ value,
6299
+ defaultValue,
6300
+ onChange,
6301
+ showPreview = true,
6302
+ className,
6303
+ formProps,
6304
+ renderModal,
6305
+ extraToolbar,
6306
+ languages
6307
+ }) => {
6131
6308
  const {
6132
6309
  formatMessage,
6133
6310
  locale
@@ -6162,13 +6339,20 @@ const FormCreator = withLocale$1(_ref => {
6162
6339
  setBlockParentStepId(null);
6163
6340
  setBlockParentOptionId(null);
6164
6341
  };
6165
- const handleAddBlock = function (kind, _temp) {
6166
- let {
6167
- parentBlockId,
6168
- stepId,
6169
- optionId
6170
- } = _temp === void 0 ? {} : _temp;
6171
- setEditingBlock(createBlock(kind));
6342
+ const handleAddBlock = (kind, {
6343
+ parentBlockId,
6344
+ stepId,
6345
+ optionId
6346
+ } = {}) => {
6347
+ setEditingBlock(createBlock(kind, kind === 'choice' ? {
6348
+ options: [createChoiceOption({
6349
+ title: formatMessage({
6350
+ id: 'choiceOptionFallback'
6351
+ }, {
6352
+ index: 1
6353
+ })
6354
+ })]
6355
+ } : undefined));
6172
6356
  setBlockParentId(parentBlockId || null);
6173
6357
  setBlockParentStepId(stepId || null);
6174
6358
  setBlockParentOptionId(optionId || null);
@@ -6447,95 +6631,99 @@ const FormCreator = withLocale$1(_ref => {
6447
6631
  const toolbarExtra = typeof extraToolbar === 'function' ? extraToolbar({
6448
6632
  schema
6449
6633
  }) : extraToolbar;
6450
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
6451
- className: [style['form-creator'], responsiveUtils.RESPONSIVE_BOUNDARY_CLASS, isMobile ? style['is-mobile'] : '', className].filter(Boolean).join(' '),
6452
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
6453
- className: style['editor-pane'],
6454
- children: /*#__PURE__*/jsxRuntime.jsx(BlockListPanel$1, {
6455
- blocks: schema.blocks,
6456
- onAddBlock: handleAddBlock,
6457
- onEditBlock: handleEditBlock,
6458
- onDeleteBlock: handleDeleteBlock,
6459
- onMoveBlock: handleMoveBlock,
6460
- onAddField: handleAddField,
6461
- onEditField: handleEditField,
6462
- onDeleteField: handleDeleteField,
6463
- onMoveField: handleMoveField,
6464
- onAddStep: handleAddStep,
6465
- onEditStep: handleEditStep,
6466
- onDeleteStep: handleDeleteStep,
6467
- onMoveStep: handleMoveStep,
6468
- onAddChoiceOption: handleAddChoiceOption,
6469
- onEditChoiceOption: handleEditChoiceOption,
6470
- onDeleteChoiceOption: handleDeleteChoiceOption,
6471
- onMoveChoiceOption: handleMoveChoiceOption,
6472
- onOpenFormActions: () => setFormActionsOpen(true),
6473
- extraToolbar: toolbarExtra
6474
- })
6475
- }), showPreview ? /*#__PURE__*/jsxRuntime.jsx("div", {
6476
- className: style['preview-pane'],
6477
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
6478
- className: style['preview-body'],
6479
- children: hasRenderableContent(schema) ? /*#__PURE__*/jsxRuntime.jsx(SchemaRenderer$1, {
6480
- schema: schema,
6481
- preview: true,
6482
- formProps: formProps,
6483
- locale: locale
6484
- }) : /*#__PURE__*/jsxRuntime.jsx(antd.Empty, {
6485
- image: antd.Empty.PRESENTED_IMAGE_SIMPLE,
6486
- description: formatMessage({
6487
- id: 'emptyBlockList'
6634
+ return /*#__PURE__*/jsxRuntime.jsx(LocaleTextProvider, {
6635
+ languages: languages,
6636
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
6637
+ className: [style['form-creator'], responsiveUtils.RESPONSIVE_BOUNDARY_CLASS, isMobile ? style['is-mobile'] : '', className].filter(Boolean).join(' '),
6638
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
6639
+ className: style['editor-pane'],
6640
+ children: /*#__PURE__*/jsxRuntime.jsx(BlockListPanel$1, {
6641
+ blocks: schema.blocks,
6642
+ onAddBlock: handleAddBlock,
6643
+ onEditBlock: handleEditBlock,
6644
+ onDeleteBlock: handleDeleteBlock,
6645
+ onMoveBlock: handleMoveBlock,
6646
+ onAddField: handleAddField,
6647
+ onEditField: handleEditField,
6648
+ onDeleteField: handleDeleteField,
6649
+ onMoveField: handleMoveField,
6650
+ onAddStep: handleAddStep,
6651
+ onEditStep: handleEditStep,
6652
+ onDeleteStep: handleDeleteStep,
6653
+ onMoveStep: handleMoveStep,
6654
+ onAddChoiceOption: handleAddChoiceOption,
6655
+ onEditChoiceOption: handleEditChoiceOption,
6656
+ onDeleteChoiceOption: handleDeleteChoiceOption,
6657
+ onMoveChoiceOption: handleMoveChoiceOption,
6658
+ onOpenFormActions: () => setFormActionsOpen(true),
6659
+ extraToolbar: toolbarExtra
6660
+ })
6661
+ }), showPreview ? /*#__PURE__*/jsxRuntime.jsx("div", {
6662
+ className: style['preview-pane'],
6663
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
6664
+ className: style['preview-body'],
6665
+ children: hasRenderableContent(schema) ? /*#__PURE__*/jsxRuntime.jsx(SchemaRenderer$1, {
6666
+ schema: schema,
6667
+ preview: true,
6668
+ formProps: formProps,
6669
+ locale: locale,
6670
+ languages: languages
6671
+ }) : /*#__PURE__*/jsxRuntime.jsx(antd.Empty, {
6672
+ image: antd.Empty.PRESENTED_IMAGE_SIMPLE,
6673
+ description: formatMessage({
6674
+ id: 'emptyBlockList'
6675
+ })
6488
6676
  })
6489
6677
  })
6490
- })
6491
- }) : null, /*#__PURE__*/jsxRuntime.jsx(BlockEditorModal$1, {
6492
- open: blockEditorOpen,
6493
- block: editingBlock,
6494
- renderModal: renderModal,
6495
- onCancel: clearBlockEditor,
6496
- onSave: handleSaveBlock
6497
- }), /*#__PURE__*/jsxRuntime.jsx(StepEditorModal$1, {
6498
- open: stepEditorOpen,
6499
- step: stepContext?.step,
6500
- renderModal: renderModal,
6501
- onCancel: () => {
6502
- setStepEditorOpen(false);
6503
- setStepContext(null);
6504
- },
6505
- onSave: handleSaveStep
6506
- }), /*#__PURE__*/jsxRuntime.jsx(ChoiceOptionEditorModal$1, {
6507
- open: choiceOptionEditorOpen,
6508
- option: choiceOptionContext?.option,
6509
- renderModal: renderModal,
6510
- onCancel: () => {
6511
- setChoiceOptionEditorOpen(false);
6512
- setChoiceOptionContext(null);
6513
- },
6514
- onSave: handleSaveChoiceOption
6515
- }), /*#__PURE__*/jsxRuntime.jsx(FieldEditorModal$1, {
6516
- open: fieldEditorOpen,
6517
- field: editingField,
6518
- fieldList: currentFieldScope,
6519
- renderModal: renderModal,
6520
- onCancel: () => {
6521
- setFieldEditorOpen(false);
6522
- setFieldContext(null);
6523
- setEditingField(null);
6524
- },
6525
- onSave: handleSaveField
6526
- }), /*#__PURE__*/jsxRuntime.jsx(FormActionsEditor$1, {
6527
- open: formActionsOpen,
6528
- value: schema.actions,
6529
- renderModal: renderModal,
6530
- onCancel: () => setFormActionsOpen(false),
6531
- onSave: actions => {
6532
- updateSchema({
6533
- ...schema,
6534
- actions
6535
- });
6536
- setFormActionsOpen(false);
6537
- }
6538
- })]
6678
+ }) : null, /*#__PURE__*/jsxRuntime.jsx(BlockEditorModal$1, {
6679
+ open: blockEditorOpen,
6680
+ block: editingBlock,
6681
+ renderModal: renderModal,
6682
+ onCancel: clearBlockEditor,
6683
+ onSave: handleSaveBlock
6684
+ }), /*#__PURE__*/jsxRuntime.jsx(StepEditorModal$1, {
6685
+ open: stepEditorOpen,
6686
+ step: stepContext?.step,
6687
+ renderModal: renderModal,
6688
+ onCancel: () => {
6689
+ setStepEditorOpen(false);
6690
+ setStepContext(null);
6691
+ },
6692
+ onSave: handleSaveStep
6693
+ }), /*#__PURE__*/jsxRuntime.jsx(ChoiceOptionEditorModal$1, {
6694
+ open: choiceOptionEditorOpen,
6695
+ option: choiceOptionContext?.option,
6696
+ renderModal: renderModal,
6697
+ onCancel: () => {
6698
+ setChoiceOptionEditorOpen(false);
6699
+ setChoiceOptionContext(null);
6700
+ },
6701
+ onSave: handleSaveChoiceOption
6702
+ }), /*#__PURE__*/jsxRuntime.jsx(FieldEditorModal$1, {
6703
+ open: fieldEditorOpen,
6704
+ field: editingField,
6705
+ fieldList: currentFieldScope,
6706
+ renderModal: renderModal,
6707
+ onCancel: () => {
6708
+ setFieldEditorOpen(false);
6709
+ setFieldContext(null);
6710
+ setEditingField(null);
6711
+ },
6712
+ onSave: handleSaveField
6713
+ }), /*#__PURE__*/jsxRuntime.jsx(FormActionsEditor$1, {
6714
+ open: formActionsOpen,
6715
+ value: schema.actions,
6716
+ renderModal: renderModal,
6717
+ onCancel: () => setFormActionsOpen(false),
6718
+ onSave: actions => {
6719
+ updateSchema({
6720
+ ...schema,
6721
+ actions
6722
+ });
6723
+ setFormActionsOpen(false);
6724
+ }
6725
+ })]
6726
+ })
6539
6727
  });
6540
6728
  });
6541
6729
  var FormCreator$1 = FormCreator;
@@ -6600,12 +6788,11 @@ const isImageFile = (item, field) => {
6600
6788
  };
6601
6789
  const FileFieldPreview = remoteLoader.createWithRemoteLoader({
6602
6790
  modules: ['components-core:File@FileLink', 'components-core:Image']
6603
- })(_ref => {
6604
- let {
6605
- remoteModules,
6606
- value,
6607
- field
6608
- } = _ref;
6791
+ })(({
6792
+ remoteModules,
6793
+ value,
6794
+ field
6795
+ }) => {
6609
6796
  const [FileLink, Image] = remoteModules;
6610
6797
  const files = toFileList(value).map(pickFilePreviewProps).filter(Boolean);
6611
6798
  if (!files.length) {
@@ -6757,13 +6944,7 @@ const formatTemporal = (value, formatKey, patternOverride) => {
6757
6944
  return applyPattern(date, pattern);
6758
6945
  };
6759
6946
  const isTemporalKey = key => !!(key && (TEMPORAL_PATTERN[key] || key === 'week' || key === 'quarter'));
6760
- const pickObjectLabel = function (item, labelKey, valueKey) {
6761
- if (labelKey === void 0) {
6762
- labelKey = 'label';
6763
- }
6764
- if (valueKey === void 0) {
6765
- valueKey = 'value';
6766
- }
6947
+ const pickObjectLabel = (item, labelKey = 'label', valueKey = 'value') => {
6767
6948
  if (item == null) {
6768
6949
  return '';
6769
6950
  }
@@ -6780,13 +6961,7 @@ const pickObjectLabel = function (item, labelKey, valueKey) {
6780
6961
  }
6781
6962
  return '';
6782
6963
  };
6783
- const mapOptionLabel = function (value, options, labelKey, valueKey) {
6784
- if (labelKey === void 0) {
6785
- labelKey = 'label';
6786
- }
6787
- if (valueKey === void 0) {
6788
- valueKey = 'value';
6789
- }
6964
+ const mapOptionLabel = (value, options, labelKey = 'label', valueKey = 'value') => {
6790
6965
  if (value && typeof value === 'object') {
6791
6966
  return pickObjectLabel(value, labelKey, valueKey);
6792
6967
  }
@@ -6861,7 +7036,7 @@ const formatDateToToday = (value, itemSchema, ctx) => {
6861
7036
  if (items[1] == null || items[1] === '' || items[1] === true) {
6862
7037
  const until = ctx.formatMessage?.({
6863
7038
  id: 'schemaContentUntilToday'
6864
- }) || '至今';
7039
+ }) || defaultLocale.schemaContentUntilToday;
6865
7040
  return [start, until].filter(Boolean).join(' ~ ');
6866
7041
  }
6867
7042
  const end = formatByValueSchema(items[1], itemSchema, ctx);
@@ -6916,11 +7091,11 @@ const formatBoolean = (value, field, ctx) => {
6916
7091
  if (value) {
6917
7092
  return props.checkedChildren || ctx.formatMessage?.({
6918
7093
  id: 'schemaContentYes'
6919
- }) || '是';
7094
+ }) || defaultLocale.schemaContentYes;
6920
7095
  }
6921
7096
  return props.unCheckedChildren || ctx.formatMessage?.({
6922
7097
  id: 'schemaContentNo'
6923
- }) || '否';
7098
+ }) || defaultLocale.schemaContentNo;
6924
7099
  };
6925
7100
  const stringifyFallback = value => {
6926
7101
  if (value == null) {
@@ -6955,10 +7130,7 @@ const stringifyFallback = value => {
6955
7130
  return '';
6956
7131
  }
6957
7132
  };
6958
- const formatByValueSchema = function (value, schema, ctx) {
6959
- if (ctx === void 0) {
6960
- ctx = {};
6961
- }
7133
+ const formatByValueSchema = (value, schema, ctx = {}) => {
6962
7134
  if (isEmptyValue(value)) {
6963
7135
  return '';
6964
7136
  }
@@ -7050,10 +7222,12 @@ const formatByValueSchema = function (value, schema, ctx) {
7050
7222
  }
7051
7223
  return String(value);
7052
7224
  };
7053
- const formatFieldDisplayValue = function (field, value, _temp) {
7054
- let {
7055
- formatMessage
7056
- } = _temp === void 0 ? {} : _temp;
7225
+ const formatFieldDisplayValue = (rawField, value, {
7226
+ formatMessage,
7227
+ locale,
7228
+ languages
7229
+ } = {}) => {
7230
+ const field = localizeSchema(rawField, locale, languages);
7057
7231
  const emptyText = formatMessage?.({
7058
7232
  id: 'schemaContentEmptyValue'
7059
7233
  }) || '-';
@@ -7081,16 +7255,14 @@ const formatFieldDisplayValue = function (field, value, _temp) {
7081
7255
  * 统一注册扩展规则与填写项:运行时校验 + 编辑器规则面板 + 字段类型 registry。
7082
7256
  * 应用入口调用一次即可,FormCreator / SchemaRenderer 共用。
7083
7257
  */
7084
- const preset = function (_temp) {
7085
- let {
7086
- rules = {},
7087
- fields = {}
7088
- } = _temp === void 0 ? {} : _temp;
7258
+ const preset = ({
7259
+ rules = {},
7260
+ fields = {}
7261
+ } = {}) => {
7089
7262
  const runtimeRules = {
7090
7263
  ...reactFormAntd.RULES
7091
7264
  };
7092
- Object.entries(rules).forEach(_ref => {
7093
- let [value, def] = _ref;
7265
+ Object.entries(rules).forEach(([value, def]) => {
7094
7266
  if (def == null) {
7095
7267
  return;
7096
7268
  }
@@ -7122,8 +7294,7 @@ const preset = function (_temp) {
7122
7294
  reactFormAntd.preset({
7123
7295
  rules: runtimeRules
7124
7296
  });
7125
- Object.entries(fields).forEach(_ref2 => {
7126
- let [type, definition] = _ref2;
7297
+ Object.entries(fields).forEach(([type, definition]) => {
7127
7298
  registerField(type, definition);
7128
7299
  });
7129
7300
  };
@@ -7143,10 +7314,9 @@ const resolveChoiceSelectorName$1 = block => {
7143
7314
  }
7144
7315
  return `__choice_${block.id}`;
7145
7316
  };
7146
- const mergeFieldIntoLayer = function (layer, field, _temp) {
7147
- let {
7148
- allowRequired = true
7149
- } = _temp === void 0 ? {} : _temp;
7317
+ const mergeFieldIntoLayer = (layer, field, {
7318
+ allowRequired = true
7319
+ } = {}) => {
7150
7320
  if (!field?.name) {
7151
7321
  return;
7152
7322
  }
@@ -7173,11 +7343,10 @@ const toFiniteInt = (value, minAllowed) => {
7173
7343
  const int = Math.floor(num);
7174
7344
  return int < minAllowed ? minAllowed : int;
7175
7345
  };
7176
- const finalizeObjectSchema = function (layer, _temp2) {
7177
- let {
7178
- title,
7179
- description
7180
- } = _temp2 === void 0 ? {} : _temp2;
7346
+ const finalizeObjectSchema = (layer, {
7347
+ title,
7348
+ description
7349
+ } = {}) => {
7181
7350
  const schema = {
7182
7351
  type: 'object',
7183
7352
  properties: {
@@ -7200,20 +7369,20 @@ const finalizeObjectSchema = function (layer, _temp2) {
7200
7369
  }
7201
7370
  return schema;
7202
7371
  };
7203
- const walkBlocks = function (blocks, layer, depth) {
7372
+ const walkBlocks = (blocks, layer, depth = 0) => {
7204
7373
  (blocks || []).forEach(block => {
7205
7374
  if (!block) {
7206
7375
  return;
7207
7376
  }
7208
- walkBlock(block, layer);
7377
+ walkBlock(block, layer, depth);
7209
7378
  });
7210
7379
  };
7211
- const walkBlock = function (block, layer, depth) {
7380
+ const walkBlock = (block, layer, depth = 0) => {
7212
7381
  switch (block.kind) {
7213
7382
  case 'formInfo':
7214
7383
  {
7215
7384
  mergeFieldsIntoLayer(layer, block.list);
7216
- walkBlocks(block.blocks, layer);
7385
+ walkBlocks(block.blocks, layer, depth + 1);
7217
7386
  return;
7218
7387
  }
7219
7388
  case 'object':
@@ -7221,12 +7390,12 @@ const walkBlock = function (block, layer, depth) {
7221
7390
  const name = block.name != null && String(block.name).trim() ? String(block.name).trim() : '';
7222
7391
  if (!name) {
7223
7392
  mergeFieldsIntoLayer(layer, block.list);
7224
- walkBlocks(block.blocks, layer);
7393
+ walkBlocks(block.blocks, layer, depth + 1);
7225
7394
  return;
7226
7395
  }
7227
7396
  const nested = createObjectLayer();
7228
7397
  mergeFieldsIntoLayer(nested, block.list);
7229
- walkBlocks(block.blocks, nested);
7398
+ walkBlocks(block.blocks, nested, depth + 1);
7230
7399
  layer.properties[name] = finalizeObjectSchema(nested, {
7231
7400
  title: block.title || undefined,
7232
7401
  description: block.subtitle || undefined
@@ -7244,7 +7413,7 @@ const walkBlock = function (block, layer, depth) {
7244
7413
  const itemLayer = createObjectLayer();
7245
7414
  mergeFieldsIntoLayer(itemLayer, block.list);
7246
7415
  if (supportsItemBlocks(block.kind)) {
7247
- walkBlocks(block.itemBlocks, itemLayer);
7416
+ walkBlocks(block.itemBlocks, itemLayer, depth + 1);
7248
7417
  }
7249
7418
  const items = finalizeObjectSchema(itemLayer);
7250
7419
  const arraySchema = {
@@ -7290,13 +7459,13 @@ const walkBlock = function (block, layer, depth) {
7290
7459
  {
7291
7460
  (block.items || []).forEach(step => {
7292
7461
  mergeFieldsIntoLayer(layer, step?.list);
7293
- walkBlocks(step?.blocks, layer);
7462
+ walkBlocks(step?.blocks, layer, depth + 1);
7294
7463
  });
7295
7464
  return;
7296
7465
  }
7297
7466
  case 'choice':
7298
7467
  {
7299
- mergeChoiceIntoLayer(layer, block);
7468
+ mergeChoiceIntoLayer(layer, block, depth);
7300
7469
  return;
7301
7470
  }
7302
7471
  default:
@@ -7315,20 +7484,22 @@ const mergeChoiceIntoLayer = (layer, block, depth) => {
7315
7484
  const selectorName = resolveChoiceSelectorName$1(block);
7316
7485
  const options = block.options || [];
7317
7486
  const optionIds = options.map(option => String(option.id));
7318
- const branches = options.map((option, index) => {
7487
+ const branches = options.map(option => {
7319
7488
  const branch = createObjectLayer();
7320
- const optionTitle = option.title || `选项${index + 1}`;
7489
+ const optionTitle = option.title || undefined;
7321
7490
  if (selectorInData && mode === 'single') {
7322
7491
  branch.properties[selectorName] = {
7323
7492
  const: String(option.id),
7324
- title: optionTitle
7493
+ ...(optionTitle ? {
7494
+ title: optionTitle
7495
+ } : {})
7325
7496
  };
7326
7497
  branch.required.push(selectorName);
7327
7498
  }
7328
7499
  mergeFieldsIntoLayer(branch, option.list, {
7329
7500
  allowRequired: true
7330
7501
  });
7331
- walkBlocks(option.blocks, branch);
7502
+ walkBlocks(option.blocks, branch, depth + 1);
7332
7503
  return finalizeObjectSchema(branch, {
7333
7504
  title: optionTitle
7334
7505
  });
@@ -7405,14 +7576,12 @@ const mergeChoiceIntoLayer = (layer, block, depth) => {
7405
7576
  * - 扩展字段:registerField / preset 的 valueSchema;缺省 { type: 'string' }
7406
7577
  * - hidden 字段仍进入 data schema(可提交)
7407
7578
  * - choice:single → oneOf,multiple → anyOf
7579
+ * - options.locale / options.languages:多语言文案取该语言,取不到按 languages 顺序回退(未传为 zh-CN → en-US)
7408
7580
  */
7409
- const schemaToDataSchema = function (schema, options) {
7410
- if (options === void 0) {
7411
- options = {};
7412
- }
7413
- const normalized = normalizeSchema(schema || {});
7581
+ const schemaToDataSchema = (schema, options = {}) => {
7582
+ const normalized = normalizeSchema(localizeSchema(schema || {}, options.locale, options.languages));
7414
7583
  const layer = createObjectLayer();
7415
- walkBlocks(normalized.blocks, layer);
7584
+ walkBlocks(normalized.blocks, layer, 0);
7416
7585
  const root = finalizeObjectSchema(layer, {
7417
7586
  title: normalized.title || undefined,
7418
7587
  description: options.description
@@ -7446,10 +7615,9 @@ const formatFieldValue = (field, value, formatMessage) => formatFieldDisplayValu
7446
7615
  * 问卷题干往往很长:不用 InfoPage Content 的横向 label 列宽对齐(minWidth),
7447
7616
  * 改为 label 在上、值在下,避免窄栏(如弹窗双栏预览)被撑乱。
7448
7617
  */
7449
- const renderFieldsContent = function (fields, data, formatMessage, column, _temp) {
7450
- let {
7451
- showIndex = false
7452
- } = _temp === void 0 ? {} : _temp;
7618
+ const renderFieldsContent = (fields, data, formatMessage, column, {
7619
+ showIndex = false
7620
+ } = {}) => {
7453
7621
  const list = (fields || []).filter(field => field && !field.hidden && field.name).map((field, index) => {
7454
7622
  const baseLabel = field.label || field.name;
7455
7623
  const label = showIndex ? `${index + 1}. ${baseLabel}` : baseLabel;
@@ -7603,17 +7771,18 @@ const renderBlock = (block, data, ctx) => {
7603
7771
  return null;
7604
7772
  }
7605
7773
  };
7606
- const SchemaContentInnerView = _ref => {
7607
- let {
7608
- schema,
7609
- data,
7610
- className
7611
- } = _ref;
7774
+ const SchemaContentInnerView = ({
7775
+ schema,
7776
+ data,
7777
+ className,
7778
+ languages
7779
+ }) => {
7612
7780
  const {
7613
- formatMessage
7781
+ formatMessage,
7782
+ locale
7614
7783
  } = reactIntl.useIntl();
7615
7784
  const isMobile = responsiveUtils.useIsMobile();
7616
- const normalized = normalizeSchema(schema);
7785
+ const normalized = normalizeSchema(localizeSchema(schema, locale, languages));
7617
7786
  const children = renderBlockList(normalized.blocks, data || {}, {
7618
7787
  formatMessage,
7619
7788
  isMobile,
@@ -7633,17 +7802,18 @@ const SchemaContentInnerView = _ref => {
7633
7802
  });
7634
7803
  };
7635
7804
  const SchemaContentInner = withLocale$1(SchemaContentInnerView);
7636
- const SchemaContent = withLocale$1(_ref2 => {
7637
- let {
7638
- schema,
7639
- data,
7640
- className,
7641
- empty
7642
- } = _ref2;
7805
+ const SchemaContent = withLocale$1(({
7806
+ schema,
7807
+ data,
7808
+ className,
7809
+ empty,
7810
+ languages
7811
+ }) => {
7643
7812
  const {
7644
- formatMessage
7813
+ formatMessage,
7814
+ locale
7645
7815
  } = reactIntl.useIntl();
7646
- const normalized = normalizeSchema(schema);
7816
+ const normalized = normalizeSchema(localizeSchema(schema, locale, languages));
7647
7817
  const emptyNode = empty !== undefined ? empty : /*#__PURE__*/jsxRuntime.jsx(antd.Empty, {
7648
7818
  image: antd.Empty.PRESENTED_IMAGE_SIMPLE,
7649
7819
  description: formatMessage({
@@ -7664,6 +7834,10 @@ const SchemaContent = withLocale$1(_ref2 => {
7664
7834
  var SchemaContent$1 = SchemaContent;
7665
7835
 
7666
7836
  exports.FormCreator = FormCreator$1;
7837
+ exports.LocaleInput = LocaleInput;
7838
+ exports.LocaleTextArea = LocaleTextArea;
7839
+ exports.LocaleTextControl = LocaleTextControl;
7840
+ exports.LocaleTextProvider = LocaleTextProvider;
7667
7841
  exports.MAX_BLOCK_DEPTH = MAX_BLOCK_DEPTH;
7668
7842
  exports.RULE_LEN_PRESET = RULE_LEN_PRESET;
7669
7843
  exports.RULE_PRESET_ITEMS = RULE_PRESET_ITEMS;
@@ -7697,8 +7871,11 @@ exports.getFieldComponent = getFieldComponent;
7697
7871
  exports.getFieldDefinition = getFieldDefinition;
7698
7872
  exports.getFieldTypes = getFieldTypes;
7699
7873
  exports.getRulePresetItems = getRulePresetItems;
7874
+ exports.hasLocaleText = hasLocaleText;
7700
7875
  exports.hasRenderableContent = hasRenderableContent;
7701
7876
  exports.isFieldNameUnique = isFieldNameUnique;
7877
+ exports.isLocaleText = isLocaleText;
7878
+ exports.localizeSchema = localizeSchema;
7702
7879
  exports.mapBlocks = mapBlocks;
7703
7880
  exports.moveBlockInTree = moveBlockInTree;
7704
7881
  exports.moveItem = moveItem;
@@ -7714,6 +7891,7 @@ exports.registerField = registerField;
7714
7891
  exports.removeBlockInTree = removeBlockInTree;
7715
7892
  exports.resolveFieldTypeLabel = resolveFieldTypeLabel;
7716
7893
  exports.resolveFieldValueSchema = resolveFieldValueSchema;
7894
+ exports.resolveLocaleText = resolveLocaleText;
7717
7895
  exports.schemaToDataSchema = schemaToDataSchema;
7718
7896
  exports.updateBlocks = updateBlocks;
7719
7897
  //# sourceMappingURL=index.js.map