@kne/form-creator 0.1.14 → 0.1.15

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
@@ -15,6 +15,7 @@ var jsxRuntime = require('react/jsx-runtime');
15
15
  var FormInfo = require('@kne/form-info');
16
16
  var buttonGroup = require('@kne/button-group');
17
17
  var InfoPage = require('@kne/info-page');
18
+ var remoteLoader = require('@kne/remote-loader');
18
19
 
19
20
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
20
21
 
@@ -22,7 +23,7 @@ var SelectList__default = /*#__PURE__*/_interopDefaultLegacy(SelectList);
22
23
  var FormInfo__default = /*#__PURE__*/_interopDefaultLegacy(FormInfo);
23
24
  var InfoPage__default = /*#__PURE__*/_interopDefaultLegacy(InfoPage);
24
25
 
25
- var style = {"kne-responsive-boundary":"kne-form-creator_gh14z","kne-responsive-scroll":"kne-form-creator_Kfn6L","form-creator":"kne-form-creator_Xrjrk","editor-pane":"kne-form-creator_Skfuv","preview-pane":"kne-form-creator_v4Lsp","editor-header":"kne-form-creator_WaSS-","block-list-panel":"kne-form-creator_lx8An","form-actions-setting-btn":"kne-form-creator_NekU2","panel-toolbar":"kne-form-creator_t0WxZ","panel-toolbar-extra":"kne-form-creator_O22ZM","schema-content":"kne-form-creator_9bWOD","add-block-btn":"kne-form-creator_16Zre","add-inline-btn":"kne-form-creator_iCYdB","ant-btn-disabled":"kne-form-creator_LdGtv","block-list":"kne-form-creator_wK5eK","block-section":"kne-form-creator_15IiK","block-kind-formInfo":"kne-form-creator_D0hoK","block-kind-list":"kne-form-creator_JdPhy","block-kind-tableList":"kne-form-creator_gzd64","block-kind-multiField":"kne-form-creator_t0iOJ","block-kind-steps":"kne-form-creator_QNF9W","step-section":"kne-form-creator_22ajp","block-section-header":"kne-form-creator_wS4rL","block-header-left":"kne-form-creator_t4awC","block-title":"kne-form-creator_wSVJf","block-summary":"kne-form-creator_GzeW8","block-header-actions":"kne-form-creator_Ue-nT","block-body":"kne-form-creator_je1H0","item-blocks-section":"kne-form-creator_wq4bT","nested-block-list":"kne-form-creator_4NWH4","block-section-nested":"kne-form-creator_mUKom","add-field-dropdown":"kne-form-creator_9JS0d","add-field-dropdown-item":"kne-form-creator_Ql1z3","add-field-dropdown-item-icon":"kne-form-creator_ZHB5O","add-field-dropdown-item-desc":"kne-form-creator_dcsOS","add-field-dropdown-divider":"kne-form-creator_CUK0H","add-field-dropdown-label":"kne-form-creator_bPJ-2","section-toolbar":"kne-form-creator_LUO8S","section-toolbar-label":"kne-form-creator_7KQ79","field-list":"kne-form-creator_-B7WZ","step-list":"kne-form-creator_kc1pH","step-section-header":"kne-form-creator_wkhEX","step-section-title":"kne-form-creator_NBinE","step-section-actions":"kne-form-creator_es-FC","step-index":"kne-form-creator_CCKZZ","field-row":"kne-form-creator_XMkdt","field-row-index":"kne-form-creator_a-cDo","field-row-main":"kne-form-creator_ftlwp","inline-empty":"kne-form-creator_yP-RF","action-group":"kne-form-creator_773yo","hover-reveal":"kne-form-creator_S234h","hover-reveal-active":"kne-form-creator_AE-6r","action-btn":"kne-form-creator_mLgqh","add-block-dropdown":"kne-form-creator_vmS-e","add-block-option":"kne-form-creator_gjg2Y","add-block-option-icon":"kne-form-creator_qh1hh","add-block-option-text":"kne-form-creator_G8iJO","add-block-option-title":"kne-form-creator_ETSvm","add-block-option-desc":"kne-form-creator_O0C3l","field-empty":"kne-form-creator_Nmpfl","field-label-tips-icon":"kne-form-creator_0VVaO","preview-header":"kne-form-creator_c4BT0","preview-title":"kne-form-creator_fPkK4","preview-body":"kne-form-creator_6JntQ","schema-form":"kne-form-creator_MxCWP","schema-body":"kne-form-creator_q9ydz","schema-actions":"kne-form-creator_Y4eEH","schema-actions-inner":"kne-form-creator_FT9Zf","choice-block":"kne-form-creator_RllJe","choice-selector":"kne-form-creator_5A1eM","choice-panels":"kne-form-creator_IO0MY","choice-panels-empty":"kne-form-creator_T0nND","choice-option-panel":"kne-form-creator_FQixN","choice-option-panel-title":"kne-form-creator_ofRo2","choice-option-summary":"kne-form-creator_pksH8","field-editor-form":"kne-form-creator_PGPHL","form-actions-editor":"kne-form-creator_fchMy","form-actions-switch-field":"kne-form-creator_6JE9x","form-actions-layout-panel":"kne-form-creator_rtm9D","form-actions-align-group":"kne-form-creator_51ZsV","form-actions-layout-title":"kne-form-creator_hFeiC","form-actions-gap-slider":"kne-form-creator_Gq0bk","editor-section":"kne-form-creator_jJy85","section-divider":"kne-form-creator_zA7L-","rule-editor":"kne-form-creator_bAlGU","options-editor":"kne-form-creator_AK4yO","super-select-props":"kne-form-creator_Iawhh","field-props-editor":"kne-form-creator_Gabf2","columns-editor":"kne-form-creator_DQW1N","prop-row":"kne-form-creator_7K54P","prop-label":"kne-form-creator_HAAyH","options-item":"kne-form-creator_dnOd2","table-row-card":"kne-form-creator_cwCYp","tree-options-editor":"kne-form-creator_s3nHO","tree-options-list":"kne-form-creator_Djs-E","tree-option-node":"kne-form-creator_XAcut","tree-option-row":"kne-form-creator_4K4Rj","tree-option-fields":"kne-form-creator_-4cjc","tree-option-actions":"kne-form-creator_IjCNI","tree-option-children":"kne-form-creator_pVPGJ","tree-add-sibling":"kne-form-creator_bl46P","rule-checkbox-group":"kne-form-creator_tDgVP","rule-len-row":"kne-form-creator_ATsae","rule-len-input":"kne-form-creator_jY4Ld","rule-len-sep":"kne-form-creator_jBDC8","options-list":"kne-form-creator_GUBNS","options-row":"kne-form-creator_uohD0","options-tip":"kne-form-creator_vrTmK","icon-square-btn":"kne-form-creator_DZjCf","icon-square-btn-sm":"kne-form-creator_GAh-t","is-mobile":"kne-form-creator_LtgJz"};
26
+ var style = {"kne-responsive-boundary":"kne-form-creator_gh14z","kne-responsive-scroll":"kne-form-creator_Kfn6L","form-creator":"kne-form-creator_Xrjrk","editor-pane":"kne-form-creator_Skfuv","preview-pane":"kne-form-creator_v4Lsp","editor-header":"kne-form-creator_WaSS-","block-list-panel":"kne-form-creator_lx8An","form-actions-setting-btn":"kne-form-creator_NekU2","panel-toolbar":"kne-form-creator_t0WxZ","panel-toolbar-extra":"kne-form-creator_O22ZM","schema-content":"kne-form-creator_9bWOD","schema-content-file-list":"kne-form-creator_UGdXA","schema-content-file":"kne-form-creator_75EtE","schema-content-file-image":"kne-form-creator_P-be6","schema-content-file-name":"kne-form-creator_NXpTS","add-block-btn":"kne-form-creator_16Zre","add-inline-btn":"kne-form-creator_iCYdB","ant-btn-disabled":"kne-form-creator_LdGtv","block-list":"kne-form-creator_wK5eK","block-section":"kne-form-creator_15IiK","block-kind-formInfo":"kne-form-creator_D0hoK","block-kind-list":"kne-form-creator_JdPhy","block-kind-tableList":"kne-form-creator_gzd64","block-kind-multiField":"kne-form-creator_t0iOJ","block-kind-steps":"kne-form-creator_QNF9W","step-section":"kne-form-creator_22ajp","block-section-header":"kne-form-creator_wS4rL","block-header-left":"kne-form-creator_t4awC","block-title":"kne-form-creator_wSVJf","block-summary":"kne-form-creator_GzeW8","block-header-actions":"kne-form-creator_Ue-nT","block-body":"kne-form-creator_je1H0","item-blocks-section":"kne-form-creator_wq4bT","nested-block-list":"kne-form-creator_4NWH4","block-section-nested":"kne-form-creator_mUKom","add-field-dropdown":"kne-form-creator_9JS0d","add-field-dropdown-item":"kne-form-creator_Ql1z3","add-field-dropdown-item-icon":"kne-form-creator_ZHB5O","add-field-dropdown-item-desc":"kne-form-creator_dcsOS","add-field-dropdown-divider":"kne-form-creator_CUK0H","add-field-dropdown-label":"kne-form-creator_bPJ-2","section-toolbar":"kne-form-creator_LUO8S","section-toolbar-label":"kne-form-creator_7KQ79","field-list":"kne-form-creator_-B7WZ","step-list":"kne-form-creator_kc1pH","step-section-header":"kne-form-creator_wkhEX","step-section-title":"kne-form-creator_NBinE","step-section-actions":"kne-form-creator_es-FC","step-index":"kne-form-creator_CCKZZ","field-row":"kne-form-creator_XMkdt","field-row-index":"kne-form-creator_a-cDo","field-row-main":"kne-form-creator_ftlwp","inline-empty":"kne-form-creator_yP-RF","action-group":"kne-form-creator_773yo","hover-reveal":"kne-form-creator_S234h","hover-reveal-active":"kne-form-creator_AE-6r","action-btn":"kne-form-creator_mLgqh","add-block-dropdown":"kne-form-creator_vmS-e","add-block-option":"kne-form-creator_gjg2Y","add-block-option-icon":"kne-form-creator_qh1hh","add-block-option-text":"kne-form-creator_G8iJO","add-block-option-title":"kne-form-creator_ETSvm","add-block-option-desc":"kne-form-creator_O0C3l","field-empty":"kne-form-creator_Nmpfl","field-label-tips-icon":"kne-form-creator_0VVaO","preview-header":"kne-form-creator_c4BT0","preview-title":"kne-form-creator_fPkK4","preview-body":"kne-form-creator_6JntQ","schema-form":"kne-form-creator_MxCWP","schema-body":"kne-form-creator_q9ydz","schema-actions":"kne-form-creator_Y4eEH","schema-actions-inner":"kne-form-creator_FT9Zf","choice-block":"kne-form-creator_RllJe","choice-selector":"kne-form-creator_5A1eM","choice-panels":"kne-form-creator_IO0MY","choice-panels-empty":"kne-form-creator_T0nND","choice-option-panel":"kne-form-creator_FQixN","choice-option-panel-title":"kne-form-creator_ofRo2","choice-option-summary":"kne-form-creator_pksH8","field-editor-form":"kne-form-creator_PGPHL","form-actions-editor":"kne-form-creator_fchMy","form-actions-switch-field":"kne-form-creator_6JE9x","form-actions-layout-panel":"kne-form-creator_rtm9D","form-actions-align-group":"kne-form-creator_51ZsV","form-actions-layout-title":"kne-form-creator_hFeiC","form-actions-gap-slider":"kne-form-creator_Gq0bk","editor-section":"kne-form-creator_jJy85","section-divider":"kne-form-creator_zA7L-","rule-editor":"kne-form-creator_bAlGU","options-editor":"kne-form-creator_AK4yO","super-select-props":"kne-form-creator_Iawhh","field-props-editor":"kne-form-creator_Gabf2","columns-editor":"kne-form-creator_DQW1N","prop-row":"kne-form-creator_7K54P","prop-label":"kne-form-creator_HAAyH","options-item":"kne-form-creator_dnOd2","table-row-card":"kne-form-creator_cwCYp","tree-options-editor":"kne-form-creator_s3nHO","tree-options-list":"kne-form-creator_Djs-E","tree-option-node":"kne-form-creator_XAcut","tree-option-row":"kne-form-creator_4K4Rj","tree-option-fields":"kne-form-creator_-4cjc","tree-option-actions":"kne-form-creator_IjCNI","tree-option-children":"kne-form-creator_pVPGJ","tree-add-sibling":"kne-form-creator_bl46P","rule-checkbox-group":"kne-form-creator_tDgVP","rule-len-row":"kne-form-creator_ATsae","rule-len-input":"kne-form-creator_jY4Ld","rule-len-sep":"kne-form-creator_jBDC8","options-list":"kne-form-creator_GUBNS","options-row":"kne-form-creator_uohD0","options-tip":"kne-form-creator_vrTmK","icon-square-btn":"kne-form-creator_DZjCf","icon-square-btn-sm":"kne-form-creator_GAh-t","is-mobile":"kne-form-creator_LtgJz"};
26
27
 
27
28
  const locale$1 = {
28
29
  addField: '添加填写项',
@@ -221,7 +222,9 @@ const locale$1 = {
221
222
  schemaContentEmptyValue: '-',
222
223
  schemaContentYes: '是',
223
224
  schemaContentNo: '否',
224
- schemaContentItemIndex: '第 {index} 项'
225
+ schemaContentItemIndex: '第 {index} 项',
226
+ schemaContentUntilToday: '至今',
227
+ schemaContentPasswordMasked: '••••••'
225
228
  };
226
229
  var zhCN = locale$1;
227
230
 
@@ -422,7 +425,9 @@ const locale = {
422
425
  schemaContentEmptyValue: '-',
423
426
  schemaContentYes: 'Yes',
424
427
  schemaContentNo: 'No',
425
- schemaContentItemIndex: 'Item {index}'
428
+ schemaContentItemIndex: 'Item {index}',
429
+ schemaContentUntilToday: 'Present',
430
+ schemaContentPasswordMasked: '••••••'
426
431
  };
427
432
  var enUS = locale;
428
433
 
@@ -1357,6 +1362,84 @@ const mapOptionItem = item => {
1357
1362
  }
1358
1363
  return next;
1359
1364
  };
1365
+
1366
+ /**
1367
+ * 搭建器选项是 { label, value, children };SelectCascader 默认 valueKey='id'、示例用 id/name。
1368
+ * 补齐两边的 key,避免 mapping 全部落到 undefined 导致下拉空白。
1369
+ */
1370
+ const alignOptionKeys = (options = [], {
1371
+ valueKey = 'value',
1372
+ labelKey = 'label'
1373
+ } = {}) => {
1374
+ if (!Array.isArray(options)) {
1375
+ return options;
1376
+ }
1377
+ return options.map(item => {
1378
+ if (!item || typeof item !== 'object') {
1379
+ return item;
1380
+ }
1381
+ const rawValue = item[valueKey] ?? item.value ?? item.id ?? item.code;
1382
+ const rawLabel = item[labelKey] ?? item.label ?? item.name;
1383
+ const next = {
1384
+ ...item
1385
+ };
1386
+ if (rawValue != null && next[valueKey] == null) {
1387
+ next[valueKey] = rawValue;
1388
+ }
1389
+ if (rawLabel != null && (next[labelKey] == null || next[labelKey] === '')) {
1390
+ next[labelKey] = rawLabel;
1391
+ }
1392
+ if (next.id == null && rawValue != null) {
1393
+ next.id = rawValue;
1394
+ }
1395
+ if ((next.name == null || next.name === '') && rawLabel != null) {
1396
+ next.name = rawLabel;
1397
+ }
1398
+ if (Array.isArray(next.children) && next.children.length) {
1399
+ next.children = alignOptionKeys(next.children, {
1400
+ valueKey,
1401
+ labelKey
1402
+ });
1403
+ }
1404
+ return next;
1405
+ });
1406
+ };
1407
+
1408
+ /**
1409
+ * SelectTree 按扁平 parentId 组树,会覆盖节点上已有的 children。
1410
+ * 搭建器存的是嵌套 children,交给 SelectTree 前先拍平。
1411
+ */
1412
+ const flattenTreeOptions = (options = [], {
1413
+ valueKey = 'value',
1414
+ parentKey = 'parentId',
1415
+ childrenKey = 'children',
1416
+ parentId
1417
+ } = {}) => {
1418
+ const result = [];
1419
+ (Array.isArray(options) ? options : []).forEach(item => {
1420
+ if (!item || typeof item !== 'object') {
1421
+ return;
1422
+ }
1423
+ const nested = item[childrenKey];
1424
+ const node = {
1425
+ ...item
1426
+ };
1427
+ delete node[childrenKey];
1428
+ if (parentId !== undefined) {
1429
+ node[parentKey] = parentId;
1430
+ }
1431
+ result.push(node);
1432
+ if (Array.isArray(nested) && nested.length) {
1433
+ result.push(...flattenTreeOptions(nested, {
1434
+ valueKey,
1435
+ parentKey,
1436
+ childrenKey,
1437
+ parentId: node[valueKey]
1438
+ }));
1439
+ }
1440
+ });
1441
+ return result;
1442
+ };
1360
1443
  const createApiFromOptions = (options = []) => ({
1361
1444
  loader: () => ({
1362
1445
  pageData: options.map(mapOptionItem)
@@ -1370,6 +1453,7 @@ const hasNestedOptions = options => Array.isArray(options) && options.some(item
1370
1453
  const createField = function (Component, _temp) {
1371
1454
  let {
1372
1455
  preferOptions = false,
1456
+ flattenTree = false,
1373
1457
  placeholderPrefix = '请选择'
1374
1458
  } = _temp === void 0 ? {} : _temp;
1375
1459
  const Field = props => {
@@ -1379,14 +1463,28 @@ const createField = function (Component, _temp) {
1379
1463
  placeholder,
1380
1464
  ...rest
1381
1465
  } = props;
1382
- const useOptionsDirectly = preferOptions || hasNestedOptions(options);
1383
- const mergedApi = api || (!useOptionsDirectly && Array.isArray(options) && options.length ? createApiFromOptions(options) : undefined);
1466
+ const valueKey = rest.valueKey || 'value';
1467
+ const labelKey = rest.labelKey || 'label';
1468
+ const parentKey = rest.parentKey || 'parentId';
1469
+ const flattened = flattenTree && Array.isArray(options) ? flattenTreeOptions(options, {
1470
+ valueKey,
1471
+ parentKey
1472
+ }) : options;
1473
+ const resolvedOptions = Array.isArray(flattened) ? alignOptionKeys(flattened, {
1474
+ valueKey,
1475
+ labelKey
1476
+ }) : flattened;
1477
+ const useOptionsDirectly = preferOptions || hasNestedOptions(resolvedOptions);
1478
+ const mergedApi = api || (!useOptionsDirectly && Array.isArray(resolvedOptions) && resolvedOptions.length ? createApiFromOptions(resolvedOptions) : undefined);
1384
1479
  const resolvedPlaceholder = placeholder != null && String(placeholder).trim() ? placeholder : `${placeholderPrefix}${props.label || ''}`;
1385
1480
  const render = useOnChange$1(Object.assign({}, {
1386
1481
  isPopup: true,
1387
1482
  placeholder: resolvedPlaceholder
1388
- }, rest, useOptionsDirectly && Array.isArray(options) ? {
1389
- options
1483
+ }, rest, {
1484
+ valueKey,
1485
+ labelKey
1486
+ }, useOptionsDirectly && Array.isArray(resolvedOptions) ? {
1487
+ options: resolvedOptions
1390
1488
  } : {}, mergedApi ? {
1391
1489
  api: mergedApi
1392
1490
  } : {}));
@@ -1400,7 +1498,8 @@ const SuperSelectTableList = createField(SelectList.SelectTableList, {
1400
1498
  preferOptions: true
1401
1499
  });
1402
1500
  const SuperSelectTree = createField(SelectList.SelectTree, {
1403
- preferOptions: true
1501
+ preferOptions: true,
1502
+ flattenTree: true
1404
1503
  });
1405
1504
  const SuperSelectCascader = createField(SelectList.SelectCascader, {
1406
1505
  preferOptions: true
@@ -1519,19 +1618,47 @@ const stringWithEnumSchema = field => {
1519
1618
  }
1520
1619
  return schema;
1521
1620
  };
1621
+ const optionValueSchema = {
1622
+ type: 'object',
1623
+ display: 'option'
1624
+ };
1522
1625
  const superSelectValueSchema = field => {
1523
1626
  if (field?.props?.single) {
1524
1627
  return {
1525
- type: 'object'
1628
+ ...optionValueSchema
1526
1629
  };
1527
1630
  }
1528
1631
  return {
1529
1632
  type: 'array',
1530
1633
  items: {
1531
- type: 'object'
1634
+ ...optionValueSchema
1532
1635
  }
1533
1636
  };
1534
1637
  };
1638
+ const PICKER_TO_FORMAT = {
1639
+ date: 'date',
1640
+ week: 'week',
1641
+ month: 'month',
1642
+ quarter: 'quarter',
1643
+ year: 'year'
1644
+ };
1645
+ const datePickerValueSchema = field => {
1646
+ const picker = field?.props?.picker || 'date';
1647
+ const format = field?.props?.showTime ? 'date-time' : PICKER_TO_FORMAT[picker] || 'date';
1648
+ const item = {
1649
+ type: 'string',
1650
+ format
1651
+ };
1652
+ if (field?.props?.range) {
1653
+ return {
1654
+ type: 'array',
1655
+ items: item,
1656
+ minItems: 2,
1657
+ maxItems: 2
1658
+ };
1659
+ }
1660
+ return item;
1661
+ };
1535
1662
  defineField('Input', {
1536
1663
  label: '单行文本',
1537
1664
  group: '基础字段',
@@ -1753,16 +1880,7 @@ defineField('DatePicker', {
1753
1880
  },
1754
1881
  hasFieldProps: true,
1755
1882
  resolveComponent: props => props?.range ? reactFormAntd.DatePicker.RangePicker || reactFormAntd.DatePicker : reactFormAntd.DatePicker,
1756
- valueSchema: field => field?.props?.range ? {
1757
- type: 'array',
1758
- items: {
1759
- type: 'string'
1760
- },
1761
- minItems: 2,
1762
- maxItems: 2
1763
- } : {
1764
- type: 'string'
1765
- }
1883
+ valueSchema: datePickerValueSchema
1766
1884
  });
1767
1885
 
1768
1886
  /**
@@ -1778,6 +1896,8 @@ defineField('DatePicker', {
1778
1896
  * preset({ type, definition }) 的 fields 项还可传:
1779
1897
  * - groupName?: string 自定义类型下拉分组名;不传则归入「扩展字段」
1780
1898
  * - valueSchema?: object | (field) => object 提交值的 JSON Schema 片段;缺省回退 { type: 'string' }
1899
+ * 可含 format(date/month/week/time/date-time/password/color/json)与 display(option/phone/file/typed-date-range/date-to-today/html/money),供 SchemaContent 预览
1900
+ * - formatDisplayValue?: (value, field, ctx) => string 覆盖 valueSchema 默认预览
1781
1901
  */
1782
1902
  const registerField = (type, definition) => {
1783
1903
  const propsSchema = Array.isArray(definition?.propsSchema) ? definition.propsSchema : undefined;
@@ -5195,6 +5315,7 @@ const renderFieldElements = function (fields, preview, _temp) {
5195
5315
  }
5196
5316
  const definition = getFieldDefinition(field.type);
5197
5317
  const props = {
5318
+ ...(definition?.defaultProps || {}),
5198
5319
  ...(field.props || {})
5199
5320
  };
5200
5321
  if (definition?.optionsAllowDescription && props.options?.length && !props.api && !definition.optionsAllowChildren) {
@@ -6134,6 +6255,543 @@ const FormCreator = withLocale$1(_ref => {
6134
6255
  });
6135
6256
  var FormCreator$1 = FormCreator;
6136
6257
 
6258
+ const IMAGE_EXT = /\.(png|jpe?g|gif|webp|bmp|svg|avif)(?:[?#].*)?$/i;
6259
+ const toFileList = value => {
6260
+ if (value == null || value === '') {
6261
+ return [];
6262
+ }
6263
+ return Array.isArray(value) ? value : [value];
6264
+ };
6265
+ const isHttpLike = value => typeof value === 'string' && /^(https?:|blob:|data:)/i.test(value);
6266
+ const pickFilePreviewProps = file => {
6267
+ if (file == null || file === '') {
6268
+ return null;
6269
+ }
6270
+ if (typeof file === 'string') {
6271
+ const filename = file.split('/').pop() || file;
6272
+ if (isHttpLike(file)) {
6273
+ return {
6274
+ src: file,
6275
+ filename,
6276
+ originName: filename
6277
+ };
6278
+ }
6279
+ return {
6280
+ filename,
6281
+ originName: filename
6282
+ };
6283
+ }
6284
+ if (typeof file !== 'object') {
6285
+ return null;
6286
+ }
6287
+ const filename = file.filename || file.name || file.originName || file.originFileObj?.name;
6288
+ const src = file.src || file.url || file.path || file.thumbUrl;
6289
+ const id = file.id || file.uuid || file.fileId;
6290
+ if (!src && !id && !filename) {
6291
+ return null;
6292
+ }
6293
+ return {
6294
+ ...(src ? {
6295
+ src
6296
+ } : {}),
6297
+ ...(id ? {
6298
+ id
6299
+ } : {}),
6300
+ filename,
6301
+ originName: file.originName || filename,
6302
+ mimetype: file.mimetype || file.type || file.originFileObj?.type
6303
+ };
6304
+ };
6305
+ const isImageFile = (item, field) => {
6306
+ const type = field?.type;
6307
+ if (type === 'Avatar' || type === 'Signature') {
6308
+ return true;
6309
+ }
6310
+ const mime = item?.mimetype;
6311
+ if (typeof mime === 'string' && mime.startsWith('image/')) {
6312
+ return true;
6313
+ }
6314
+ return IMAGE_EXT.test(String(item?.filename || item?.originName || item?.src || ''));
6315
+ };
6316
+ const FileFieldPreview = remoteLoader.createWithRemoteLoader({
6317
+ modules: ['components-core:File@FileLink', 'components-core:Image']
6318
+ })(_ref => {
6319
+ let {
6320
+ remoteModules,
6321
+ value,
6322
+ field
6323
+ } = _ref;
6324
+ const [FileLink, Image] = remoteModules;
6325
+ const files = toFileList(value).map(pickFilePreviewProps).filter(Boolean);
6326
+ if (!files.length) {
6327
+ return null;
6328
+ }
6329
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Flex, {
6330
+ vertical: true,
6331
+ gap: 8,
6332
+ className: style['schema-content-file-list'],
6333
+ children: files.map((item, index) => {
6334
+ const key = item.id || item.src || item.filename || String(index);
6335
+ const filename = item.filename || item.originName || '';
6336
+ const canPreview = !!(item.id || item.src);
6337
+ const asImage = isImageFile(item, field);
6338
+ if (!canPreview) {
6339
+ return /*#__PURE__*/jsxRuntime.jsx("span", {
6340
+ className: style['schema-content-file-name'],
6341
+ children: filename
6342
+ }, key);
6343
+ }
6344
+ const linkProps = {
6345
+ id: item.id,
6346
+ src: item.src,
6347
+ url: item.src,
6348
+ filename,
6349
+ originName: item.originName || filename
6350
+ };
6351
+ if (asImage) {
6352
+ const preview = field?.type === 'Avatar' ? /*#__PURE__*/jsxRuntime.jsx(Image.Avatar, {
6353
+ id: item.id,
6354
+ src: item.src,
6355
+ size: 64,
6356
+ shape: "square",
6357
+ alt: filename
6358
+ }) : /*#__PURE__*/jsxRuntime.jsx(Image, {
6359
+ id: item.id,
6360
+ src: item.src,
6361
+ alt: filename,
6362
+ className: style['schema-content-file-image']
6363
+ });
6364
+ return /*#__PURE__*/jsxRuntime.jsx(FileLink, {
6365
+ className: style['schema-content-file'],
6366
+ icon: null,
6367
+ ...linkProps,
6368
+ children: preview
6369
+ }, key);
6370
+ }
6371
+ return /*#__PURE__*/jsxRuntime.jsx(FileLink, {
6372
+ className: style['schema-content-file'],
6373
+ ...linkProps,
6374
+ children: filename
6375
+ }, key);
6376
+ })
6377
+ });
6378
+ });
6379
+ var FileFieldPreview$1 = FileFieldPreview;
6380
+
6381
+ const TEMPORAL_PATTERN = {
6382
+ date: 'YYYY-MM-DD',
6383
+ month: 'YYYY-MM',
6384
+ time: 'HH:mm:ss',
6385
+ 'date-time': 'YYYY-MM-DD HH:mm:ss',
6386
+ year: 'YYYY'
6387
+ };
6388
+ const TYPE_TO_TEMPORAL = {
6389
+ date: 'date',
6390
+ month: 'month',
6391
+ week: 'week',
6392
+ time: 'time',
6393
+ year: 'year',
6394
+ quarter: 'quarter',
6395
+ datetime: 'date-time',
6396
+ 'date-time': 'date-time'
6397
+ };
6398
+ const pad = n => String(n).padStart(2, '0');
6399
+ const isEmptyValue = value => {
6400
+ if (value == null || value === '') {
6401
+ return true;
6402
+ }
6403
+ if (Array.isArray(value) && value.length === 0) {
6404
+ return true;
6405
+ }
6406
+ return false;
6407
+ };
6408
+ const toDate = value => {
6409
+ if (value == null || value === '') {
6410
+ return null;
6411
+ }
6412
+ if (value instanceof Date) {
6413
+ return Number.isNaN(value.getTime()) ? null : value;
6414
+ }
6415
+ if (typeof value.toDate === 'function') {
6416
+ const next = value.toDate();
6417
+ return next instanceof Date && !Number.isNaN(next.getTime()) ? next : null;
6418
+ }
6419
+ if (typeof value.format === 'function' && typeof value.valueOf === 'function') {
6420
+ const next = new Date(value.valueOf());
6421
+ return Number.isNaN(next.getTime()) ? null : next;
6422
+ }
6423
+ if (typeof value === 'string' || typeof value === 'number') {
6424
+ const next = new Date(value);
6425
+ return Number.isNaN(next.getTime()) ? null : next;
6426
+ }
6427
+ return null;
6428
+ };
6429
+ const isoWeek = date => {
6430
+ const tmp = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
6431
+ const day = tmp.getUTCDay() || 7;
6432
+ tmp.setUTCDate(tmp.getUTCDate() + 4 - day);
6433
+ const yearStart = new Date(Date.UTC(tmp.getUTCFullYear(), 0, 1));
6434
+ const week = Math.ceil(((tmp - yearStart) / 86400000 + 1) / 7);
6435
+ return {
6436
+ year: tmp.getUTCFullYear(),
6437
+ week
6438
+ };
6439
+ };
6440
+ const applyPattern = (date, pattern) => {
6441
+ const year = date.getFullYear();
6442
+ const month = date.getMonth() + 1;
6443
+ const quarter = Math.ceil(month / 3);
6444
+ return pattern.replace(/YYYY/g, String(year)).replace(/MM/g, pad(month)).replace(/DD/g, pad(date.getDate())).replace(/HH/g, pad(date.getHours())).replace(/mm/g, pad(date.getMinutes())).replace(/ss/g, pad(date.getSeconds())).replace(/Q/g, String(quarter));
6445
+ };
6446
+ const formatTemporal = (value, formatKey, patternOverride) => {
6447
+ if (Array.isArray(value)) {
6448
+ return value.map(item => formatTemporal(item, formatKey, patternOverride)).filter(item => item !== '').join(' ~ ');
6449
+ }
6450
+ const date = toDate(value);
6451
+ if (!date) {
6452
+ return value == null || value === '' ? '' : String(value);
6453
+ }
6454
+ if (formatKey === 'week') {
6455
+ const {
6456
+ year,
6457
+ week
6458
+ } = isoWeek(date);
6459
+ return `${year}-W${pad(week)}`;
6460
+ }
6461
+ if (formatKey === 'quarter') {
6462
+ return `${date.getFullYear()}-Q${Math.ceil((date.getMonth() + 1) / 3)}`;
6463
+ }
6464
+ const pattern = patternOverride || TEMPORAL_PATTERN[formatKey] || TEMPORAL_PATTERN.date;
6465
+ if (value && typeof value.format === 'function' && patternOverride) {
6466
+ try {
6467
+ return value.format(patternOverride);
6468
+ } catch {
6469
+ // fall through to Date formatting
6470
+ }
6471
+ }
6472
+ return applyPattern(date, pattern);
6473
+ };
6474
+ const isTemporalKey = key => !!(key && (TEMPORAL_PATTERN[key] || key === 'week' || key === 'quarter'));
6475
+ const pickObjectLabel = function (item, labelKey, valueKey) {
6476
+ if (labelKey === void 0) {
6477
+ labelKey = 'label';
6478
+ }
6479
+ if (valueKey === void 0) {
6480
+ valueKey = 'value';
6481
+ }
6482
+ if (item == null) {
6483
+ return '';
6484
+ }
6485
+ if (typeof item !== 'object') {
6486
+ return item;
6487
+ }
6488
+ const label = item[labelKey] ?? item.label ?? item.name;
6489
+ if (label != null && typeof label !== 'object' && label !== '') {
6490
+ return label;
6491
+ }
6492
+ const raw = item[valueKey] ?? item.value ?? item.id ?? item.code;
6493
+ if (raw != null && typeof raw !== 'object') {
6494
+ return raw;
6495
+ }
6496
+ return '';
6497
+ };
6498
+ const mapOptionLabel = function (value, options, labelKey, valueKey) {
6499
+ if (labelKey === void 0) {
6500
+ labelKey = 'label';
6501
+ }
6502
+ if (valueKey === void 0) {
6503
+ valueKey = 'value';
6504
+ }
6505
+ if (value && typeof value === 'object') {
6506
+ return pickObjectLabel(value, labelKey, valueKey);
6507
+ }
6508
+ if (!Array.isArray(options) || !options.length) {
6509
+ return value == null ? '' : value;
6510
+ }
6511
+ const match = options.find(item => item && (item[valueKey] === value || item.value === value));
6512
+ return match?.[labelKey] ?? match?.label ?? value;
6513
+ };
6514
+ const formatOption = (value, field) => {
6515
+ const props = field?.props || {};
6516
+ const labelKey = props.labelKey || 'label';
6517
+ const valueKey = props.valueKey || 'value';
6518
+ const pick = item => {
6519
+ if (item && typeof item === 'object') {
6520
+ return pickObjectLabel(item, labelKey, valueKey);
6521
+ }
6522
+ return mapOptionLabel(item, props.options, labelKey, valueKey);
6523
+ };
6524
+ if (Array.isArray(value)) {
6525
+ return value.map(pick).filter(item => item != null && item !== '').join('、');
6526
+ }
6527
+ const label = pick(value);
6528
+ return label == null ? '' : label;
6529
+ };
6530
+ const formatPhone = value => {
6531
+ if (value == null || value === '') {
6532
+ return '';
6533
+ }
6534
+ if (typeof value === 'string' || typeof value === 'number') {
6535
+ const trimmed = String(value).trim().replace(/\s+/g, ' ');
6536
+ return trimmed;
6537
+ }
6538
+ if (typeof value !== 'object') {
6539
+ return String(value);
6540
+ }
6541
+ const number = String(value.value ?? value.phone ?? value.number ?? '').replace(/\s+/g, '');
6542
+ const rawCode = value.code ?? value.countryCallingCode;
6543
+ const code = rawCode == null || rawCode === '' ? '' : String(rawCode).replace(/^\+/, '');
6544
+ if (!number) {
6545
+ return '';
6546
+ }
6547
+ if (!code) {
6548
+ return number;
6549
+ }
6550
+ return `+${code} ${number}`;
6551
+ };
6552
+ const formatFile = value => {
6553
+ if (Array.isArray(value)) {
6554
+ return value.map(item => formatFile(item)).filter(Boolean).join('、');
6555
+ }
6556
+ if (typeof value === 'string') {
6557
+ return value;
6558
+ }
6559
+ if (!value || typeof value !== 'object') {
6560
+ return value == null ? '' : String(value);
6561
+ }
6562
+ return value.filename || value.name || value.originName || value.originFileObj?.name || value.id || '';
6563
+ };
6564
+ const formatTypedDateRange = (value, ctx) => {
6565
+ if (!value || typeof value !== 'object') {
6566
+ return value == null ? '' : String(value);
6567
+ }
6568
+ const formatKey = TYPE_TO_TEMPORAL[value.type] || 'date';
6569
+ const range = formatTemporal(value.value, formatKey, ctx.field?.props?.format);
6570
+ const typeLabel = value.type ? String(value.type) : '';
6571
+ return [typeLabel, range].filter(Boolean).join(' ');
6572
+ };
6573
+ const formatDateToToday = (value, itemSchema, ctx) => {
6574
+ const items = Array.isArray(value) ? value : [value];
6575
+ const start = formatByValueSchema(items[0], itemSchema, ctx);
6576
+ if (items[1] == null || items[1] === '' || items[1] === true) {
6577
+ const until = ctx.formatMessage?.({
6578
+ id: 'schemaContentUntilToday'
6579
+ }) || '至今';
6580
+ return [start, until].filter(Boolean).join(' ~ ');
6581
+ }
6582
+ const end = formatByValueSchema(items[1], itemSchema, ctx);
6583
+ return [start, end].filter(Boolean).join(' ~ ');
6584
+ };
6585
+ const formatJson = value => {
6586
+ if (typeof value === 'string') {
6587
+ try {
6588
+ return JSON.stringify(JSON.parse(value), null, 2);
6589
+ } catch {
6590
+ return value;
6591
+ }
6592
+ }
6593
+ if (value && typeof value === 'object') {
6594
+ return JSON.stringify(value, null, 2);
6595
+ }
6596
+ return value == null ? '' : String(value);
6597
+ };
6598
+ const formatHtml = value => String(value ?? '').replace(/<[^>]+>/g, ' ').replace(/\s+/g, ' ').trim();
6599
+ const formatMoney = value => {
6600
+ const num = Number(value);
6601
+ if (Number.isNaN(num)) {
6602
+ return value == null ? '' : String(value);
6603
+ }
6604
+ return num.toLocaleString();
6605
+ };
6606
+ const formatColor = value => {
6607
+ if (value == null) {
6608
+ return '';
6609
+ }
6610
+ if (typeof value === 'string' || typeof value === 'number') {
6611
+ return String(value);
6612
+ }
6613
+ if (typeof value === 'object') {
6614
+ if (typeof value.toHexString === 'function') {
6615
+ return value.toHexString();
6616
+ }
6617
+ return value.hex || value.metaColor || pickObjectLabel(value) || '';
6618
+ }
6619
+ return String(value);
6620
+ };
6621
+ const formatPassword = (value, ctx) => {
6622
+ if (isEmptyValue(value)) {
6623
+ return '';
6624
+ }
6625
+ return ctx.formatMessage?.({
6626
+ id: 'schemaContentPasswordMasked'
6627
+ }) || '••••••';
6628
+ };
6629
+ const formatBoolean = (value, field, ctx) => {
6630
+ const props = field?.props || {};
6631
+ if (value) {
6632
+ return props.checkedChildren || ctx.formatMessage?.({
6633
+ id: 'schemaContentYes'
6634
+ }) || '是';
6635
+ }
6636
+ return props.unCheckedChildren || ctx.formatMessage?.({
6637
+ id: 'schemaContentNo'
6638
+ }) || '否';
6639
+ };
6640
+ const stringifyFallback = value => {
6641
+ if (value == null) {
6642
+ return '';
6643
+ }
6644
+ if (typeof value !== 'object') {
6645
+ return String(value);
6646
+ }
6647
+ if (toDate(value)) {
6648
+ return formatTemporal(value, 'date-time');
6649
+ }
6650
+ if (Array.isArray(value)) {
6651
+ return value.map(item => item && typeof item === 'object' ? stringifyFallback(item) : String(item ?? '')).filter(Boolean).join('、');
6652
+ }
6653
+ if (value.label != null || value.name != null) {
6654
+ return pickObjectLabel(value);
6655
+ }
6656
+ if (value.filename || value.mimetype || value.storageType) {
6657
+ return formatFile(value);
6658
+ }
6659
+ if (value.code != null && value.value != null && value.label == null) {
6660
+ return formatPhone(value);
6661
+ }
6662
+ if (value.type != null && Array.isArray(value.value)) {
6663
+ return formatTypedDateRange(value, {
6664
+ field: {}
6665
+ });
6666
+ }
6667
+ try {
6668
+ return JSON.stringify(value);
6669
+ } catch {
6670
+ return '';
6671
+ }
6672
+ };
6673
+ const formatByValueSchema = function (value, schema, ctx) {
6674
+ if (ctx === void 0) {
6675
+ ctx = {};
6676
+ }
6677
+ if (isEmptyValue(value)) {
6678
+ return '';
6679
+ }
6680
+ const resolved = schema && typeof schema === 'object' ? schema : {};
6681
+ const type = resolved.type;
6682
+ const format = resolved.format;
6683
+ const display = resolved.display;
6684
+ const field = ctx.field;
6685
+ const patternOverride = field?.props?.format;
6686
+ if (display === 'option') {
6687
+ return formatOption(value, field);
6688
+ }
6689
+ if (display === 'phone') {
6690
+ return formatPhone(value);
6691
+ }
6692
+ if (display === 'file') {
6693
+ return /*#__PURE__*/react.createElement(FileFieldPreview$1, {
6694
+ value,
6695
+ field
6696
+ });
6697
+ }
6698
+ if (display === 'typed-date-range') {
6699
+ return formatTypedDateRange(value, ctx);
6700
+ }
6701
+ if (display === 'date-to-today') {
6702
+ return formatDateToToday(value, resolved.items || {
6703
+ type: 'string',
6704
+ format: 'date'
6705
+ }, ctx);
6706
+ }
6707
+ if (display === 'html' || format === 'html') {
6708
+ return formatHtml(value);
6709
+ }
6710
+ if (display === 'money') {
6711
+ return formatMoney(value);
6712
+ }
6713
+ if (format === 'password') {
6714
+ return formatPassword(value, ctx);
6715
+ }
6716
+ if (format === 'json') {
6717
+ return formatJson(value);
6718
+ }
6719
+ if (format === 'color') {
6720
+ return formatColor(value);
6721
+ }
6722
+ if (type === 'boolean') {
6723
+ return formatBoolean(value, field, ctx);
6724
+ }
6725
+ if (isTemporalKey(format)) {
6726
+ return formatTemporal(value, format, patternOverride);
6727
+ }
6728
+ if (type === 'array') {
6729
+ const items = Array.isArray(value) ? value : [value];
6730
+ const itemSchema = resolved.items || {};
6731
+ if (itemSchema.display === 'file') {
6732
+ return /*#__PURE__*/react.createElement(FileFieldPreview$1, {
6733
+ value: items,
6734
+ field
6735
+ });
6736
+ }
6737
+ const joiner = isTemporalKey(itemSchema.format) || itemSchema.display === 'date-to-today' ? ' ~ ' : '、';
6738
+ return items.map(item => formatByValueSchema(item, itemSchema, ctx)).filter(item => item != null && item !== '').join(joiner);
6739
+ }
6740
+ if (Array.isArray(value)) {
6741
+ const itemSchema = resolved.items || {
6742
+ ...resolved,
6743
+ type: undefined
6744
+ };
6745
+ if (itemSchema.display === 'file' || resolved.display === 'file') {
6746
+ return /*#__PURE__*/react.createElement(FileFieldPreview$1, {
6747
+ value,
6748
+ field
6749
+ });
6750
+ }
6751
+ const joiner = isTemporalKey(itemSchema.format) ? ' ~ ' : '、';
6752
+ return value.map(item => formatByValueSchema(item, itemSchema, ctx)).filter(item => item != null && item !== '').join(joiner);
6753
+ }
6754
+ if (Array.isArray(resolved.enum) || Array.isArray(field?.props?.options) && field.props.options.length) {
6755
+ const mapped = formatOption(value, field);
6756
+ if (mapped != null && mapped !== '') {
6757
+ return mapped;
6758
+ }
6759
+ }
6760
+ if (type === 'object') {
6761
+ return stringifyFallback(value);
6762
+ }
6763
+ if (typeof value === 'object') {
6764
+ return stringifyFallback(value);
6765
+ }
6766
+ return String(value);
6767
+ };
6768
+ const formatFieldDisplayValue = function (field, value, _temp) {
6769
+ let {
6770
+ formatMessage
6771
+ } = _temp === void 0 ? {} : _temp;
6772
+ const emptyText = formatMessage?.({
6773
+ id: 'schemaContentEmptyValue'
6774
+ }) || '-';
6775
+ if (isEmptyValue(value)) {
6776
+ return emptyText;
6777
+ }
6778
+ const definition = getFieldDefinition(field?.type);
6779
+ if (typeof definition?.formatDisplayValue === 'function') {
6780
+ const custom = definition.formatDisplayValue(value, field, {
6781
+ formatMessage
6782
+ });
6783
+ if (custom != null && custom !== '') {
6784
+ return custom;
6785
+ }
6786
+ }
6787
+ const schema = resolveFieldValueSchema(field);
6788
+ const text = formatByValueSchema(value, schema, {
6789
+ field,
6790
+ formatMessage
6791
+ });
6792
+ return text == null || text === '' ? emptyText : text;
6793
+ };
6794
+
6137
6795
  /**
6138
6796
  * 统一注册扩展规则与填写项:运行时校验 + 编辑器规则面板 + 字段类型 registry。
6139
6797
  * 应用入口调用一次即可,FormCreator / SchemaRenderer 共用。
@@ -6485,15 +7143,6 @@ const getByPath = (data, path) => {
6485
7143
  }
6486
7144
  return String(path).split('.').reduce((acc, key) => acc == null ? acc : acc[key], data);
6487
7145
  };
6488
- const isEmptyValue = value => {
6489
- if (value == null || value === '') {
6490
- return true;
6491
- }
6492
- if (Array.isArray(value) && value.length === 0) {
6493
- return true;
6494
- }
6495
- return false;
6496
- };
6497
7146
  const resolveChoiceSelectorName = block => {
6498
7147
  if (block.selectorName != null && String(block.selectorName).trim()) {
6499
7148
  return String(block.selectorName).trim();
@@ -6503,86 +7152,9 @@ const resolveChoiceSelectorName = block => {
6503
7152
  }
6504
7153
  return `__choice_${block.id}`;
6505
7154
  };
6506
- const formatDateValue = (value, format) => {
6507
- const pattern = format || 'YYYY-MM-DD';
6508
- if (Array.isArray(value)) {
6509
- return value.map(item => formatDateValue(item, format)).filter(item => item !== '').join(' ~ ');
6510
- }
6511
- if (value && typeof value.format === 'function') {
6512
- return value.format(pattern);
6513
- }
6514
- return value == null ? '' : String(value);
6515
- };
6516
- const mapOptionLabel = (value, options) => {
6517
- if (!Array.isArray(options) || !options.length) {
6518
- return value;
6519
- }
6520
- const match = options.find(item => item && item.value === value);
6521
- return match?.label ?? value;
6522
- };
6523
- const formatFieldValue = (field, value, formatMessage) => {
6524
- if (isEmptyValue(value)) {
6525
- return formatMessage({
6526
- id: 'schemaContentEmptyValue'
6527
- });
6528
- }
6529
- const definition = getFieldDefinition(field.type);
6530
- const props = field.props || {};
6531
- const valueSchema = resolveFieldValueSchema(field);
6532
- const schemaType = valueSchema?.type;
6533
- if (schemaType === 'boolean' || field.type === 'Switch' || field.type === 'Checkbox') {
6534
- if (value) {
6535
- return props.checkedChildren || formatMessage({
6536
- id: 'schemaContentYes'
6537
- });
6538
- }
6539
- return props.unCheckedChildren || formatMessage({
6540
- id: 'schemaContentNo'
6541
- });
6542
- }
6543
- if (field.type === 'DatePicker') {
6544
- const formatted = formatDateValue(value, props.format);
6545
- return formatted || formatMessage({
6546
- id: 'schemaContentEmptyValue'
6547
- });
6548
- }
6549
- if (Array.isArray(props.options) && props.options.length) {
6550
- if (Array.isArray(value)) {
6551
- const labels = value.map(item => mapOptionLabel(item, props.options)).filter(item => item != null && item !== '');
6552
- return labels.length ? labels.join('、') : formatMessage({
6553
- id: 'schemaContentEmptyValue'
6554
- });
6555
- }
6556
- return mapOptionLabel(value, props.options);
6557
- }
6558
- if (definition?.isSuperSelect) {
6559
- const labelKey = props.labelKey || 'label';
6560
- const pickLabel = item => {
6561
- if (item && typeof item === 'object') {
6562
- return item[labelKey] ?? item.label ?? item.value;
6563
- }
6564
- return item;
6565
- };
6566
- if (Array.isArray(value)) {
6567
- const labels = value.map(pickLabel).filter(item => item != null && item !== '');
6568
- return labels.length ? labels.join('、') : formatMessage({
6569
- id: 'schemaContentEmptyValue'
6570
- });
6571
- }
6572
- if (value && typeof value === 'object') {
6573
- return pickLabel(value) ?? formatMessage({
6574
- id: 'schemaContentEmptyValue'
6575
- });
6576
- }
6577
- }
6578
- if (Array.isArray(value)) {
6579
- return value.map(item => item && typeof item === 'object' ? JSON.stringify(item) : String(item)).join('、');
6580
- }
6581
- if (typeof value === 'object') {
6582
- return JSON.stringify(value);
6583
- }
6584
- return String(value);
6585
- };
7155
+ const formatFieldValue = (field, value, formatMessage) => formatFieldDisplayValue(field, value, {
7156
+ formatMessage
7157
+ });
6586
7158
  const renderFieldsContent = (fields, data, formatMessage, column) => {
6587
7159
  const list = (fields || []).filter(field => field && !field.hidden && field.name).map(field => ({
6588
7160
  label: field.label || field.name,
@@ -6794,6 +7366,8 @@ exports.findBlock = findBlock;
6794
7366
  exports.findBlockInTree = findBlockInTree;
6795
7367
  exports.formValuesToBlock = formValuesToBlock;
6796
7368
  exports.formValuesToField = formValuesToField;
7369
+ exports.formatByValueSchema = formatByValueSchema;
7370
+ exports.formatFieldDisplayValue = formatFieldDisplayValue;
6797
7371
  exports.getBlockDefinition = getBlockDefinition;
6798
7372
  exports.getBlockKindOptions = getBlockKindOptions;
6799
7373
  exports.getFieldComponent = getFieldComponent;