@kne/form-creator 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +128 -99
- package/dist/index.js +170 -141
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +95 -31
- package/dist/index.modern.js.map +1 -1
- package/package.json +6 -2
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require('@kne/form-info/dist/index.css');
|
|
2
|
+
require('@kne/info-page/dist/index.css');
|
|
1
3
|
var react = require('react');
|
|
2
4
|
var antd = require('antd');
|
|
3
5
|
var reactIntl = require('@kne/react-intl');
|
|
@@ -10,14 +12,14 @@ require('@kne/super-select/dist/index.css');
|
|
|
10
12
|
require('@kne/super-select-plus/dist/index.css');
|
|
11
13
|
var jsxRuntime = require('react/jsx-runtime');
|
|
12
14
|
var FormInfo = require('@kne/form-info');
|
|
13
|
-
require('@kne/form-info/dist/index.css');
|
|
14
|
-
require('@kne/info-page/dist/index.css');
|
|
15
15
|
|
|
16
16
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
17
|
|
|
18
18
|
var SelectList__default = /*#__PURE__*/_interopDefaultLegacy(SelectList);
|
|
19
19
|
var FormInfo__default = /*#__PURE__*/_interopDefaultLegacy(FormInfo);
|
|
20
20
|
|
|
21
|
+
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","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","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-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","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","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"};
|
|
22
|
+
|
|
21
23
|
const locale$1 = {
|
|
22
24
|
addField: '添加填写项',
|
|
23
25
|
editField: '编辑填写项',
|
|
@@ -181,6 +183,7 @@ const locale$1 = {
|
|
|
181
183
|
formSubtitlePlaceholder: '表单副标题(可选)',
|
|
182
184
|
formColumnPlaceholder: '每行显示列数'
|
|
183
185
|
};
|
|
186
|
+
var zhCN = locale$1;
|
|
184
187
|
|
|
185
188
|
const locale = {
|
|
186
189
|
addField: 'Add Field',
|
|
@@ -345,15 +348,17 @@ const locale = {
|
|
|
345
348
|
formSubtitlePlaceholder: 'Form subtitle (optional)',
|
|
346
349
|
formColumnPlaceholder: 'Columns per row'
|
|
347
350
|
};
|
|
351
|
+
var enUS = locale;
|
|
348
352
|
|
|
349
353
|
const withLocale = reactIntl.createWithIntlProvider({
|
|
350
354
|
defaultLocale: 'zh-CN',
|
|
351
355
|
messages: {
|
|
352
|
-
'zh-CN':
|
|
353
|
-
'en-US':
|
|
356
|
+
'zh-CN': zhCN,
|
|
357
|
+
'en-US': enUS
|
|
354
358
|
},
|
|
355
359
|
namespace: 'form-creator'
|
|
356
360
|
});
|
|
361
|
+
var withLocale$1 = withLocale;
|
|
357
362
|
|
|
358
363
|
const createFieldId = () => `field_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
359
364
|
|
|
@@ -754,16 +759,11 @@ const mapOptionItem = item => {
|
|
|
754
759
|
}
|
|
755
760
|
return next;
|
|
756
761
|
};
|
|
757
|
-
const createApiFromOptions =
|
|
758
|
-
|
|
759
|
-
options
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
loader: () => ({
|
|
763
|
-
pageData: options.map(mapOptionItem)
|
|
764
|
-
})
|
|
765
|
-
};
|
|
766
|
-
};
|
|
762
|
+
const createApiFromOptions = (options = []) => ({
|
|
763
|
+
loader: () => ({
|
|
764
|
+
pageData: options.map(mapOptionItem)
|
|
765
|
+
})
|
|
766
|
+
});
|
|
767
767
|
|
|
768
768
|
const {
|
|
769
769
|
useOnChange: useOnChange$1
|
|
@@ -1555,8 +1555,6 @@ const formValuesToField = function (values, existingField) {
|
|
|
1555
1555
|
};
|
|
1556
1556
|
};
|
|
1557
1557
|
|
|
1558
|
-
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","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","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-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","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","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"};
|
|
1559
|
-
|
|
1560
1558
|
const {
|
|
1561
1559
|
Text: Text$4
|
|
1562
1560
|
} = antd.Typography;
|
|
@@ -1578,15 +1576,14 @@ const TYPE_TAG_COLORS = {
|
|
|
1578
1576
|
Checkbox: 'green',
|
|
1579
1577
|
DatePicker: 'lime'
|
|
1580
1578
|
};
|
|
1581
|
-
const FieldRow =
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
} = _ref;
|
|
1579
|
+
const FieldRow = ({
|
|
1580
|
+
field,
|
|
1581
|
+
index,
|
|
1582
|
+
total,
|
|
1583
|
+
onEdit,
|
|
1584
|
+
onDelete,
|
|
1585
|
+
onMove
|
|
1586
|
+
}) => {
|
|
1590
1587
|
const {
|
|
1591
1588
|
formatMessage
|
|
1592
1589
|
} = reactIntl.useIntl();
|
|
@@ -1669,6 +1666,7 @@ const FieldRow = _ref => {
|
|
|
1669
1666
|
})]
|
|
1670
1667
|
});
|
|
1671
1668
|
};
|
|
1669
|
+
var FieldRow$1 = FieldRow;
|
|
1672
1670
|
|
|
1673
1671
|
const {
|
|
1674
1672
|
Text: Text$3
|
|
@@ -1746,7 +1744,7 @@ const BlockListPanel = _ref3 => {
|
|
|
1746
1744
|
}
|
|
1747
1745
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1748
1746
|
className: style['field-list'],
|
|
1749
|
-
children: fields.map((field, fieldIndex) => /*#__PURE__*/jsxRuntime.jsx(FieldRow, {
|
|
1747
|
+
children: fields.map((field, fieldIndex) => /*#__PURE__*/jsxRuntime.jsx(FieldRow$1, {
|
|
1750
1748
|
field: field,
|
|
1751
1749
|
index: fieldIndex,
|
|
1752
1750
|
total: fields.length,
|
|
@@ -2033,6 +2031,7 @@ const BlockListPanel = _ref3 => {
|
|
|
2033
2031
|
})]
|
|
2034
2032
|
});
|
|
2035
2033
|
};
|
|
2034
|
+
var BlockListPanel$1 = BlockListPanel;
|
|
2036
2035
|
|
|
2037
2036
|
const BlockConfigFields = _ref => {
|
|
2038
2037
|
let {
|
|
@@ -2246,6 +2245,7 @@ const BlockEditorModal = _ref2 => {
|
|
|
2246
2245
|
})
|
|
2247
2246
|
}, open ? block?.id ? `edit-${block.id}` : `add-${block?.kind || 'formInfo'}-${formData.name || 'new'}` : 'closed');
|
|
2248
2247
|
};
|
|
2248
|
+
var BlockEditorModal$1 = BlockEditorModal;
|
|
2249
2249
|
|
|
2250
2250
|
const StepEditorModal = _ref => {
|
|
2251
2251
|
let {
|
|
@@ -2306,6 +2306,7 @@ const StepEditorModal = _ref => {
|
|
|
2306
2306
|
})
|
|
2307
2307
|
}, open ? step?.id ? `edit-${step.id}` : `add-step-${formData.title || 'new'}` : 'closed');
|
|
2308
2308
|
};
|
|
2309
|
+
var StepEditorModal$1 = StepEditorModal;
|
|
2309
2310
|
|
|
2310
2311
|
const {
|
|
2311
2312
|
Text: Text$2
|
|
@@ -2341,24 +2342,18 @@ const RulePresetEditor = () => {
|
|
|
2341
2342
|
id: 'ruleLenMin'
|
|
2342
2343
|
}),
|
|
2343
2344
|
min: 0,
|
|
2344
|
-
display:
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
} = _ref;
|
|
2348
|
-
return (openApi?.data?.rulePresets || []).includes(RULE_LEN_PRESET);
|
|
2349
|
-
}
|
|
2345
|
+
display: ({
|
|
2346
|
+
openApi
|
|
2347
|
+
}) => (openApi?.data?.rulePresets || []).includes(RULE_LEN_PRESET)
|
|
2350
2348
|
}, "lenMin"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.InputNumber, {
|
|
2351
2349
|
name: "lenMax",
|
|
2352
2350
|
label: formatMessage({
|
|
2353
2351
|
id: 'ruleLenMax'
|
|
2354
2352
|
}),
|
|
2355
2353
|
min: 0,
|
|
2356
|
-
display:
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
} = _ref2;
|
|
2360
|
-
return (openApi?.data?.rulePresets || []).includes(RULE_LEN_PRESET);
|
|
2361
|
-
}
|
|
2354
|
+
display: ({
|
|
2355
|
+
openApi
|
|
2356
|
+
}) => (openApi?.data?.rulePresets || []).includes(RULE_LEN_PRESET)
|
|
2362
2357
|
}, "lenMax"), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2363
2358
|
block: true,
|
|
2364
2359
|
children: /*#__PURE__*/jsxRuntime.jsx(Text$2, {
|
|
@@ -2376,6 +2371,7 @@ const RulePresetEditor = () => {
|
|
|
2376
2371
|
list: list
|
|
2377
2372
|
});
|
|
2378
2373
|
};
|
|
2374
|
+
var RulePresetEditor$1 = RulePresetEditor;
|
|
2379
2375
|
|
|
2380
2376
|
const {
|
|
2381
2377
|
Text: Text$1
|
|
@@ -2398,30 +2394,19 @@ const createEmptyTableRow = columns => {
|
|
|
2398
2394
|
});
|
|
2399
2395
|
return row;
|
|
2400
2396
|
};
|
|
2401
|
-
const ensureOptionKeys =
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
_key: item._key || createOptionKey(),
|
|
2408
|
-
children: Array.isArray(item.children) ? ensureOptionKeys(item.children) : undefined
|
|
2409
|
-
}));
|
|
2410
|
-
};
|
|
2411
|
-
const hasMissingOptionKey = function (list) {
|
|
2412
|
-
if (list === void 0) {
|
|
2413
|
-
list = [];
|
|
2414
|
-
}
|
|
2415
|
-
return list.some(item => !item?._key || Array.isArray(item.children) && hasMissingOptionKey(item.children));
|
|
2416
|
-
};
|
|
2397
|
+
const ensureOptionKeys = (list = []) => list.map(item => ({
|
|
2398
|
+
...item,
|
|
2399
|
+
_key: item._key || createOptionKey(),
|
|
2400
|
+
children: Array.isArray(item.children) ? ensureOptionKeys(item.children) : undefined
|
|
2401
|
+
}));
|
|
2402
|
+
const hasMissingOptionKey = (list = []) => list.some(item => !item?._key || Array.isArray(item.children) && hasMissingOptionKey(item.children));
|
|
2417
2403
|
|
|
2418
2404
|
/** 扁平选项(非树) */
|
|
2419
|
-
const FlatOptionRows =
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
} = _ref;
|
|
2405
|
+
const FlatOptionRows = ({
|
|
2406
|
+
list,
|
|
2407
|
+
onChange,
|
|
2408
|
+
allowDescription
|
|
2409
|
+
}) => {
|
|
2425
2410
|
const {
|
|
2426
2411
|
formatMessage
|
|
2427
2412
|
} = reactIntl.useIntl();
|
|
@@ -2487,16 +2472,15 @@ const FlatOptionRows = _ref => {
|
|
|
2487
2472
|
};
|
|
2488
2473
|
|
|
2489
2474
|
/** 树形 / 级联选项 */
|
|
2490
|
-
const TreeOptionNode =
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
} = _ref2;
|
|
2475
|
+
const TreeOptionNode = ({
|
|
2476
|
+
item,
|
|
2477
|
+
index,
|
|
2478
|
+
siblings,
|
|
2479
|
+
onChangeSiblings,
|
|
2480
|
+
allowDescription,
|
|
2481
|
+
depth,
|
|
2482
|
+
maxDepth = 4
|
|
2483
|
+
}) => {
|
|
2500
2484
|
const {
|
|
2501
2485
|
formatMessage
|
|
2502
2486
|
} = reactIntl.useIntl();
|
|
@@ -2593,12 +2577,11 @@ const TreeOptionNode = _ref2 => {
|
|
|
2593
2577
|
}) : null]
|
|
2594
2578
|
});
|
|
2595
2579
|
};
|
|
2596
|
-
const TreeOptionsEditor =
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
} = _ref3;
|
|
2580
|
+
const TreeOptionsEditor = ({
|
|
2581
|
+
value = [],
|
|
2582
|
+
onChange,
|
|
2583
|
+
allowDescription
|
|
2584
|
+
}) => {
|
|
2602
2585
|
const {
|
|
2603
2586
|
formatMessage
|
|
2604
2587
|
} = reactIntl.useIntl();
|
|
@@ -2637,11 +2620,10 @@ const TreeOptionsEditor = _ref3 => {
|
|
|
2637
2620
|
})]
|
|
2638
2621
|
});
|
|
2639
2622
|
};
|
|
2640
|
-
const ColumnsEditor =
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
} = _ref4;
|
|
2623
|
+
const ColumnsEditor = ({
|
|
2624
|
+
value = [],
|
|
2625
|
+
onChange
|
|
2626
|
+
}) => {
|
|
2645
2627
|
const {
|
|
2646
2628
|
formatMessage
|
|
2647
2629
|
} = reactIntl.useIntl();
|
|
@@ -2736,12 +2718,11 @@ const ColumnsEditor = _ref4 => {
|
|
|
2736
2718
|
}, "columns-editor")]
|
|
2737
2719
|
});
|
|
2738
2720
|
};
|
|
2739
|
-
const TableRowsEditor =
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
} = _ref5;
|
|
2721
|
+
const TableRowsEditor = ({
|
|
2722
|
+
columns = [],
|
|
2723
|
+
value = [],
|
|
2724
|
+
onChange
|
|
2725
|
+
}) => {
|
|
2745
2726
|
const {
|
|
2746
2727
|
formatMessage
|
|
2747
2728
|
} = reactIntl.useIntl();
|
|
@@ -2866,16 +2847,15 @@ const TableRowsEditor = _ref5 => {
|
|
|
2866
2847
|
}, "table-rows-editor")]
|
|
2867
2848
|
});
|
|
2868
2849
|
};
|
|
2869
|
-
const OptionsEditor =
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
} = _ref6;
|
|
2850
|
+
const OptionsEditor = ({
|
|
2851
|
+
value = [],
|
|
2852
|
+
onChange,
|
|
2853
|
+
allowDescription = false,
|
|
2854
|
+
allowChildren = false,
|
|
2855
|
+
hasColumns = false,
|
|
2856
|
+
columns = [],
|
|
2857
|
+
onColumnsChange
|
|
2858
|
+
}) => {
|
|
2879
2859
|
const {
|
|
2880
2860
|
formatMessage
|
|
2881
2861
|
} = reactIntl.useIntl();
|
|
@@ -2940,11 +2920,11 @@ const OptionsEditor = _ref6 => {
|
|
|
2940
2920
|
}, "options-editor")]
|
|
2941
2921
|
});
|
|
2942
2922
|
};
|
|
2923
|
+
var OptionsEditor$1 = OptionsEditor;
|
|
2943
2924
|
|
|
2944
|
-
const SuperSelectPropsEditor =
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
} = _ref;
|
|
2925
|
+
const SuperSelectPropsEditor = ({
|
|
2926
|
+
definition
|
|
2927
|
+
}) => {
|
|
2948
2928
|
const {
|
|
2949
2929
|
formatMessage
|
|
2950
2930
|
} = reactIntl.useIntl();
|
|
@@ -2982,12 +2962,9 @@ const SuperSelectPropsEditor = _ref => {
|
|
|
2982
2962
|
})
|
|
2983
2963
|
}, "allowClear"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
2984
2964
|
name: "allowSelectedAll",
|
|
2985
|
-
display:
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
} = _ref2;
|
|
2989
|
-
return !openApi?.data?.single;
|
|
2990
|
-
},
|
|
2965
|
+
display: ({
|
|
2966
|
+
openApi
|
|
2967
|
+
}) => !openApi?.data?.single,
|
|
2991
2968
|
children: formatMessage({
|
|
2992
2969
|
id: 'superSelectAllowSelectedAll'
|
|
2993
2970
|
})
|
|
@@ -3009,12 +2986,9 @@ const SuperSelectPropsEditor = _ref => {
|
|
|
3009
2986
|
placeholder: formatMessage({
|
|
3010
2987
|
id: 'superSelectMaxLengthPlaceholder'
|
|
3011
2988
|
}),
|
|
3012
|
-
display:
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
} = _ref3;
|
|
3016
|
-
return !openApi?.data?.single;
|
|
3017
|
-
}
|
|
2989
|
+
display: ({
|
|
2990
|
+
openApi
|
|
2991
|
+
}) => !openApi?.data?.single
|
|
3018
2992
|
}, "maxLength"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
|
|
3019
2993
|
name: "placeholder",
|
|
3020
2994
|
label: formatMessage({
|
|
@@ -3042,6 +3016,7 @@ const SuperSelectPropsEditor = _ref => {
|
|
|
3042
3016
|
list: list
|
|
3043
3017
|
});
|
|
3044
3018
|
};
|
|
3019
|
+
var SuperSelectPropsEditor$1 = SuperSelectPropsEditor;
|
|
3045
3020
|
|
|
3046
3021
|
const BUILTIN_PROP_TYPES = ['Input', 'TextArea', 'InputNumber', 'Select', 'DatePicker', 'Switch'];
|
|
3047
3022
|
const buildPropsSchemaList = (schema, formatMessage) => (schema || []).filter(item => item?.name).map(item => {
|
|
@@ -3246,12 +3221,9 @@ const buildBuiltinList = (type, formatMessage) => {
|
|
|
3246
3221
|
}]
|
|
3247
3222
|
}, "format"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
3248
3223
|
name: "showTime",
|
|
3249
|
-
display:
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
} = _ref;
|
|
3253
|
-
return (openApi?.data?.picker || 'date') === 'date';
|
|
3254
|
-
},
|
|
3224
|
+
display: ({
|
|
3225
|
+
openApi
|
|
3226
|
+
}) => (openApi?.data?.picker || 'date') === 'date',
|
|
3255
3227
|
children: formatMessage({
|
|
3256
3228
|
id: 'propShowTime'
|
|
3257
3229
|
})
|
|
@@ -3278,11 +3250,10 @@ const buildBuiltinList = (type, formatMessage) => {
|
|
|
3278
3250
|
return [];
|
|
3279
3251
|
}
|
|
3280
3252
|
};
|
|
3281
|
-
const FieldPropsEditor =
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
} = _ref2;
|
|
3253
|
+
const FieldPropsEditor = ({
|
|
3254
|
+
type,
|
|
3255
|
+
definition: definitionProp
|
|
3256
|
+
}) => {
|
|
3286
3257
|
const {
|
|
3287
3258
|
formatMessage
|
|
3288
3259
|
} = reactIntl.useIntl();
|
|
@@ -3314,6 +3285,7 @@ const hasFieldPropsEditor = (type, definition) => {
|
|
|
3314
3285
|
}
|
|
3315
3286
|
return BUILTIN_PROP_TYPES.includes(type);
|
|
3316
3287
|
};
|
|
3288
|
+
var FieldPropsEditor$1 = FieldPropsEditor;
|
|
3317
3289
|
|
|
3318
3290
|
const {
|
|
3319
3291
|
Text
|
|
@@ -3450,17 +3422,17 @@ const FieldConfigFields = _ref => {
|
|
|
3450
3422
|
}),
|
|
3451
3423
|
column: 1,
|
|
3452
3424
|
list: list
|
|
3453
|
-
}), definition?.isSuperSelect ? /*#__PURE__*/jsxRuntime.jsx(SuperSelectPropsEditor, {
|
|
3425
|
+
}), definition?.isSuperSelect ? /*#__PURE__*/jsxRuntime.jsx(SuperSelectPropsEditor$1, {
|
|
3454
3426
|
definition: definition
|
|
3455
|
-
}) : hasFieldPropsEditor(fieldType, definition) ? /*#__PURE__*/jsxRuntime.jsx(FieldPropsEditor, {
|
|
3427
|
+
}) : hasFieldPropsEditor(fieldType, definition) ? /*#__PURE__*/jsxRuntime.jsx(FieldPropsEditor$1, {
|
|
3456
3428
|
type: fieldType,
|
|
3457
3429
|
definition: definition
|
|
3458
|
-
}) : null, /*#__PURE__*/jsxRuntime.jsx(RulePresetEditor, {}), definition?.hasBuiltinData ? /*#__PURE__*/jsxRuntime.jsx(Text, {
|
|
3430
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx(RulePresetEditor$1, {}), definition?.hasBuiltinData ? /*#__PURE__*/jsxRuntime.jsx(Text, {
|
|
3459
3431
|
type: "secondary",
|
|
3460
3432
|
children: formatMessage({
|
|
3461
3433
|
id: 'builtinDataHint'
|
|
3462
3434
|
})
|
|
3463
|
-
}) : definition?.hasOptions ? /*#__PURE__*/jsxRuntime.jsx(OptionsEditor, {
|
|
3435
|
+
}) : definition?.hasOptions ? /*#__PURE__*/jsxRuntime.jsx(OptionsEditor$1, {
|
|
3464
3436
|
value: options,
|
|
3465
3437
|
onChange: onOptionsChange,
|
|
3466
3438
|
allowDescription: definition.optionsAllowDescription,
|
|
@@ -3590,6 +3562,7 @@ const FieldEditorModal = _ref3 => {
|
|
|
3590
3562
|
})
|
|
3591
3563
|
}, modalKey);
|
|
3592
3564
|
};
|
|
3565
|
+
var FieldEditorModal$1 = FieldEditorModal;
|
|
3593
3566
|
|
|
3594
3567
|
const FormActionsEditor = _ref => {
|
|
3595
3568
|
let {
|
|
@@ -3759,6 +3732,7 @@ const FormActionsEditor = _ref => {
|
|
|
3759
3732
|
})
|
|
3760
3733
|
}, open ? 'form-actions-open' : 'form-actions-closed');
|
|
3761
3734
|
};
|
|
3735
|
+
var FormActionsEditor$1 = FormActionsEditor;
|
|
3762
3736
|
|
|
3763
3737
|
const buildLabelTips = tips => {
|
|
3764
3738
|
if (tips == null || !String(tips).trim()) {
|
|
@@ -3945,6 +3919,7 @@ const renderSchemaContent = function (schema, _temp3) {
|
|
|
3945
3919
|
className: style['schema-body']
|
|
3946
3920
|
}, ...contentChildren, children), actionNode || null);
|
|
3947
3921
|
};
|
|
3922
|
+
var renderSchemaContent$1 = renderSchemaContent;
|
|
3948
3923
|
|
|
3949
3924
|
const resolveActionNode = _ref => {
|
|
3950
3925
|
let {
|
|
@@ -4016,7 +3991,7 @@ const resolveActionNode = _ref => {
|
|
|
4016
3991
|
...resolvedSubmitButtonProps
|
|
4017
3992
|
}, resolvedSubmitText) : null, resolvedShowReset ? /*#__PURE__*/react.createElement(reactFormAntd.ResetButton, resolvedResetButtonProps, resolvedResetText) : null, resolvedShowCancel ? /*#__PURE__*/react.createElement(reactFormAntd.CancelButton, resolvedCancelButtonProps, resolvedCancelText) : null));
|
|
4018
3993
|
};
|
|
4019
|
-
const SchemaRendererInner = withLocale(props => {
|
|
3994
|
+
const SchemaRendererInner = withLocale$1(props => {
|
|
4020
3995
|
const {
|
|
4021
3996
|
schema,
|
|
4022
3997
|
preview = false,
|
|
@@ -4070,7 +4045,7 @@ const SchemaRendererInner = withLocale(props => {
|
|
|
4070
4045
|
actionNode
|
|
4071
4046
|
});
|
|
4072
4047
|
});
|
|
4073
|
-
const SchemaRenderer = withLocale(props => {
|
|
4048
|
+
const SchemaRenderer = withLocale$1(props => {
|
|
4074
4049
|
const {
|
|
4075
4050
|
schema,
|
|
4076
4051
|
formProps = {},
|
|
@@ -4116,7 +4091,7 @@ const SchemaRenderer = withLocale(props => {
|
|
|
4116
4091
|
actionsAlign,
|
|
4117
4092
|
actionsGap
|
|
4118
4093
|
});
|
|
4119
|
-
return renderSchemaContent(normalized, {
|
|
4094
|
+
return renderSchemaContent$1(normalized, {
|
|
4120
4095
|
preview,
|
|
4121
4096
|
formProps,
|
|
4122
4097
|
className,
|
|
@@ -4126,8 +4101,9 @@ const SchemaRenderer = withLocale(props => {
|
|
|
4126
4101
|
actionNode
|
|
4127
4102
|
});
|
|
4128
4103
|
});
|
|
4104
|
+
var SchemaRenderer$1 = SchemaRenderer;
|
|
4129
4105
|
|
|
4130
|
-
const FormCreator = withLocale(_ref => {
|
|
4106
|
+
const FormCreator = withLocale$1(_ref => {
|
|
4131
4107
|
let {
|
|
4132
4108
|
value,
|
|
4133
4109
|
defaultValue,
|
|
@@ -4316,7 +4292,7 @@ const FormCreator = withLocale(_ref => {
|
|
|
4316
4292
|
className: [style['form-creator'], responsiveUtils.RESPONSIVE_BOUNDARY_CLASS, isMobile ? style['is-mobile'] : '', className].filter(Boolean).join(' '),
|
|
4317
4293
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4318
4294
|
className: style['editor-pane'],
|
|
4319
|
-
children: /*#__PURE__*/jsxRuntime.jsx(BlockListPanel, {
|
|
4295
|
+
children: /*#__PURE__*/jsxRuntime.jsx(BlockListPanel$1, {
|
|
4320
4296
|
blocks: schema.blocks,
|
|
4321
4297
|
onAddBlock: handleAddBlock,
|
|
4322
4298
|
onEditBlock: handleEditBlock,
|
|
@@ -4336,7 +4312,7 @@ const FormCreator = withLocale(_ref => {
|
|
|
4336
4312
|
className: style['preview-pane'],
|
|
4337
4313
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4338
4314
|
className: style['preview-body'],
|
|
4339
|
-
children: hasRenderableContent(schema) ? /*#__PURE__*/jsxRuntime.jsx(SchemaRenderer, {
|
|
4315
|
+
children: hasRenderableContent(schema) ? /*#__PURE__*/jsxRuntime.jsx(SchemaRenderer$1, {
|
|
4340
4316
|
schema: schema,
|
|
4341
4317
|
preview: true,
|
|
4342
4318
|
formProps: formProps
|
|
@@ -4347,7 +4323,7 @@ const FormCreator = withLocale(_ref => {
|
|
|
4347
4323
|
})
|
|
4348
4324
|
})
|
|
4349
4325
|
})
|
|
4350
|
-
}) : null, /*#__PURE__*/jsxRuntime.jsx(BlockEditorModal, {
|
|
4326
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx(BlockEditorModal$1, {
|
|
4351
4327
|
open: blockEditorOpen,
|
|
4352
4328
|
block: editingBlock,
|
|
4353
4329
|
renderModal: renderModal,
|
|
@@ -4356,7 +4332,7 @@ const FormCreator = withLocale(_ref => {
|
|
|
4356
4332
|
setEditingBlock(null);
|
|
4357
4333
|
},
|
|
4358
4334
|
onSave: handleSaveBlock
|
|
4359
|
-
}), /*#__PURE__*/jsxRuntime.jsx(StepEditorModal, {
|
|
4335
|
+
}), /*#__PURE__*/jsxRuntime.jsx(StepEditorModal$1, {
|
|
4360
4336
|
open: stepEditorOpen,
|
|
4361
4337
|
step: stepContext?.step,
|
|
4362
4338
|
renderModal: renderModal,
|
|
@@ -4365,7 +4341,7 @@ const FormCreator = withLocale(_ref => {
|
|
|
4365
4341
|
setStepContext(null);
|
|
4366
4342
|
},
|
|
4367
4343
|
onSave: handleSaveStep
|
|
4368
|
-
}), /*#__PURE__*/jsxRuntime.jsx(FieldEditorModal, {
|
|
4344
|
+
}), /*#__PURE__*/jsxRuntime.jsx(FieldEditorModal$1, {
|
|
4369
4345
|
open: fieldEditorOpen,
|
|
4370
4346
|
field: editingField,
|
|
4371
4347
|
fieldList: currentFieldScope,
|
|
@@ -4376,7 +4352,7 @@ const FormCreator = withLocale(_ref => {
|
|
|
4376
4352
|
setEditingField(null);
|
|
4377
4353
|
},
|
|
4378
4354
|
onSave: handleSaveField
|
|
4379
|
-
}), /*#__PURE__*/jsxRuntime.jsx(FormActionsEditor, {
|
|
4355
|
+
}), /*#__PURE__*/jsxRuntime.jsx(FormActionsEditor$1, {
|
|
4380
4356
|
open: formActionsOpen,
|
|
4381
4357
|
value: schema.actions,
|
|
4382
4358
|
renderModal: renderModal,
|
|
@@ -4391,11 +4367,63 @@ const FormCreator = withLocale(_ref => {
|
|
|
4391
4367
|
})]
|
|
4392
4368
|
});
|
|
4393
4369
|
});
|
|
4370
|
+
var FormCreator$1 = FormCreator;
|
|
4371
|
+
|
|
4372
|
+
/**
|
|
4373
|
+
* 统一注册扩展规则与填写项:运行时校验 + 编辑器规则面板 + 字段类型 registry。
|
|
4374
|
+
* 应用入口调用一次即可,FormCreator / SchemaRenderer 共用。
|
|
4375
|
+
*/
|
|
4376
|
+
const preset = function (_temp) {
|
|
4377
|
+
let {
|
|
4378
|
+
rules = {},
|
|
4379
|
+
fields = {}
|
|
4380
|
+
} = _temp === void 0 ? {} : _temp;
|
|
4381
|
+
const runtimeRules = {
|
|
4382
|
+
...reactFormAntd.RULES
|
|
4383
|
+
};
|
|
4384
|
+
Object.entries(rules).forEach(_ref => {
|
|
4385
|
+
let [value, def] = _ref;
|
|
4386
|
+
if (def == null) {
|
|
4387
|
+
return;
|
|
4388
|
+
}
|
|
4389
|
+
if (typeof def === 'function') {
|
|
4390
|
+
registerRulePreset({
|
|
4391
|
+
value,
|
|
4392
|
+
label: value
|
|
4393
|
+
});
|
|
4394
|
+
runtimeRules[value] = def;
|
|
4395
|
+
return;
|
|
4396
|
+
}
|
|
4397
|
+
const {
|
|
4398
|
+
label,
|
|
4399
|
+
validator,
|
|
4400
|
+
...ruleBody
|
|
4401
|
+
} = def;
|
|
4402
|
+
if (label) {
|
|
4403
|
+
registerRulePreset({
|
|
4404
|
+
value,
|
|
4405
|
+
label
|
|
4406
|
+
});
|
|
4407
|
+
}
|
|
4408
|
+
if (typeof validator === 'function') {
|
|
4409
|
+
runtimeRules[value] = validator;
|
|
4410
|
+
} else if (Object.keys(ruleBody).length) {
|
|
4411
|
+
runtimeRules[value] = ruleBody;
|
|
4412
|
+
}
|
|
4413
|
+
});
|
|
4414
|
+
reactFormAntd.preset({
|
|
4415
|
+
rules: runtimeRules
|
|
4416
|
+
});
|
|
4417
|
+
Object.entries(fields).forEach(_ref2 => {
|
|
4418
|
+
let [type, definition] = _ref2;
|
|
4419
|
+
registerField(type, definition);
|
|
4420
|
+
});
|
|
4421
|
+
};
|
|
4394
4422
|
|
|
4395
|
-
exports.FormCreator = FormCreator;
|
|
4423
|
+
exports.FormCreator = FormCreator$1;
|
|
4396
4424
|
exports.RULE_LEN_PRESET = RULE_LEN_PRESET;
|
|
4397
4425
|
exports.RULE_PRESET_ITEMS = RULE_PRESET_ITEMS;
|
|
4398
|
-
exports.SchemaRenderer = SchemaRenderer;
|
|
4426
|
+
exports.SchemaRenderer = SchemaRenderer$1;
|
|
4399
4427
|
exports.SchemaRendererInner = SchemaRendererInner;
|
|
4400
4428
|
exports.applyFromPropsSchema = applyFromPropsSchema;
|
|
4401
4429
|
exports.blockToFormValues = blockToFormValues;
|
|
@@ -4405,7 +4433,7 @@ exports.createBlock = createBlock;
|
|
|
4405
4433
|
exports.createField = createField$1;
|
|
4406
4434
|
exports.createFieldId = createFieldId;
|
|
4407
4435
|
exports.createStep = createStep;
|
|
4408
|
-
exports["default"] = FormCreator;
|
|
4436
|
+
exports["default"] = FormCreator$1;
|
|
4409
4437
|
exports.defaultFormActions = defaultFormActions;
|
|
4410
4438
|
exports.defaultSchema = defaultSchema;
|
|
4411
4439
|
exports.fieldToFormValues = fieldToFormValues;
|
|
@@ -4429,6 +4457,7 @@ exports.normalizeSchema = normalizeSchema;
|
|
|
4429
4457
|
exports.parseRuleString = parseRuleString;
|
|
4430
4458
|
exports.pickFieldProps = pickFieldProps;
|
|
4431
4459
|
exports.pickFromPropsSchema = pickFromPropsSchema;
|
|
4460
|
+
exports.preset = preset;
|
|
4432
4461
|
exports.registerField = registerField;
|
|
4433
4462
|
exports.registerRulePreset = registerRulePreset;
|
|
4434
4463
|
exports.updateBlocks = updateBlocks;
|