@kne/form-creator 0.1.15 → 0.1.16
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 +143 -95
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1367,10 +1367,14 @@ const mapOptionItem = item => {
|
|
|
1367
1367
|
* 搭建器选项是 { label, value, children };SelectCascader 默认 valueKey='id'、示例用 id/name。
|
|
1368
1368
|
* 补齐两边的 key,避免 mapping 全部落到 undefined 导致下拉空白。
|
|
1369
1369
|
*/
|
|
1370
|
-
const alignOptionKeys = (options
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
}
|
|
1370
|
+
const alignOptionKeys = function (options, _temp) {
|
|
1371
|
+
if (options === void 0) {
|
|
1372
|
+
options = [];
|
|
1373
|
+
}
|
|
1374
|
+
let {
|
|
1375
|
+
valueKey = 'value',
|
|
1376
|
+
labelKey = 'label'
|
|
1377
|
+
} = _temp === void 0 ? {} : _temp;
|
|
1374
1378
|
if (!Array.isArray(options)) {
|
|
1375
1379
|
return options;
|
|
1376
1380
|
}
|
|
@@ -1409,12 +1413,16 @@ const alignOptionKeys = (options = [], {
|
|
|
1409
1413
|
* SelectTree 按扁平 parentId 组树,会覆盖节点上已有的 children。
|
|
1410
1414
|
* 搭建器存的是嵌套 children,交给 SelectTree 前先拍平。
|
|
1411
1415
|
*/
|
|
1412
|
-
const flattenTreeOptions = (options
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1416
|
+
const flattenTreeOptions = function (options, _temp2) {
|
|
1417
|
+
if (options === void 0) {
|
|
1418
|
+
options = [];
|
|
1419
|
+
}
|
|
1420
|
+
let {
|
|
1421
|
+
valueKey = 'value',
|
|
1422
|
+
parentKey = 'parentId',
|
|
1423
|
+
childrenKey = 'children',
|
|
1424
|
+
parentId
|
|
1425
|
+
} = _temp2 === void 0 ? {} : _temp2;
|
|
1418
1426
|
const result = [];
|
|
1419
1427
|
(Array.isArray(options) ? options : []).forEach(item => {
|
|
1420
1428
|
if (!item || typeof item !== 'object') {
|
|
@@ -1440,11 +1448,16 @@ const flattenTreeOptions = (options = [], {
|
|
|
1440
1448
|
});
|
|
1441
1449
|
return result;
|
|
1442
1450
|
};
|
|
1443
|
-
const createApiFromOptions = (options
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
}
|
|
1447
|
-
|
|
1451
|
+
const createApiFromOptions = function (options) {
|
|
1452
|
+
if (options === void 0) {
|
|
1453
|
+
options = [];
|
|
1454
|
+
}
|
|
1455
|
+
return {
|
|
1456
|
+
loader: () => ({
|
|
1457
|
+
pageData: options.map(mapOptionItem)
|
|
1458
|
+
})
|
|
1459
|
+
};
|
|
1460
|
+
};
|
|
1448
1461
|
|
|
1449
1462
|
const {
|
|
1450
1463
|
useOnChange: useOnChange$1
|
|
@@ -2417,14 +2430,15 @@ const TYPE_TAG_COLORS = {
|
|
|
2417
2430
|
Checkbox: 'green',
|
|
2418
2431
|
DatePicker: 'lime'
|
|
2419
2432
|
};
|
|
2420
|
-
const FieldRow =
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2433
|
+
const FieldRow = _ref => {
|
|
2434
|
+
let {
|
|
2435
|
+
field,
|
|
2436
|
+
index,
|
|
2437
|
+
total,
|
|
2438
|
+
onEdit,
|
|
2439
|
+
onDelete,
|
|
2440
|
+
onMove
|
|
2441
|
+
} = _ref;
|
|
2428
2442
|
const {
|
|
2429
2443
|
formatMessage
|
|
2430
2444
|
} = reactIntl.useIntl();
|
|
@@ -3622,18 +3636,24 @@ const RulePresetEditor = () => {
|
|
|
3622
3636
|
id: 'ruleLenMin'
|
|
3623
3637
|
}),
|
|
3624
3638
|
min: 0,
|
|
3625
|
-
display:
|
|
3626
|
-
|
|
3627
|
-
|
|
3639
|
+
display: _ref => {
|
|
3640
|
+
let {
|
|
3641
|
+
openApi
|
|
3642
|
+
} = _ref;
|
|
3643
|
+
return (openApi?.data?.rulePresets || []).includes(RULE_LEN_PRESET);
|
|
3644
|
+
}
|
|
3628
3645
|
}, "lenMin"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.InputNumber, {
|
|
3629
3646
|
name: "lenMax",
|
|
3630
3647
|
label: formatMessage({
|
|
3631
3648
|
id: 'ruleLenMax'
|
|
3632
3649
|
}),
|
|
3633
3650
|
min: 0,
|
|
3634
|
-
display:
|
|
3635
|
-
|
|
3636
|
-
|
|
3651
|
+
display: _ref2 => {
|
|
3652
|
+
let {
|
|
3653
|
+
openApi
|
|
3654
|
+
} = _ref2;
|
|
3655
|
+
return (openApi?.data?.rulePresets || []).includes(RULE_LEN_PRESET);
|
|
3656
|
+
}
|
|
3637
3657
|
}, "lenMax"), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3638
3658
|
block: true,
|
|
3639
3659
|
children: /*#__PURE__*/jsxRuntime.jsx(Text$2, {
|
|
@@ -3674,19 +3694,30 @@ const createEmptyTableRow = columns => {
|
|
|
3674
3694
|
});
|
|
3675
3695
|
return row;
|
|
3676
3696
|
};
|
|
3677
|
-
const ensureOptionKeys = (list
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3697
|
+
const ensureOptionKeys = function (list) {
|
|
3698
|
+
if (list === void 0) {
|
|
3699
|
+
list = [];
|
|
3700
|
+
}
|
|
3701
|
+
return list.map(item => ({
|
|
3702
|
+
...item,
|
|
3703
|
+
_key: item._key || createOptionKey(),
|
|
3704
|
+
children: Array.isArray(item.children) ? ensureOptionKeys(item.children) : undefined
|
|
3705
|
+
}));
|
|
3706
|
+
};
|
|
3707
|
+
const hasMissingOptionKey = function (list) {
|
|
3708
|
+
if (list === void 0) {
|
|
3709
|
+
list = [];
|
|
3710
|
+
}
|
|
3711
|
+
return list.some(item => !item?._key || Array.isArray(item.children) && hasMissingOptionKey(item.children));
|
|
3712
|
+
};
|
|
3683
3713
|
|
|
3684
3714
|
/** 扁平选项(非树) */
|
|
3685
|
-
const FlatOptionRows =
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3715
|
+
const FlatOptionRows = _ref => {
|
|
3716
|
+
let {
|
|
3717
|
+
list,
|
|
3718
|
+
onChange,
|
|
3719
|
+
allowDescription
|
|
3720
|
+
} = _ref;
|
|
3690
3721
|
const {
|
|
3691
3722
|
formatMessage
|
|
3692
3723
|
} = reactIntl.useIntl();
|
|
@@ -3752,15 +3783,16 @@ const FlatOptionRows = ({
|
|
|
3752
3783
|
};
|
|
3753
3784
|
|
|
3754
3785
|
/** 树形 / 级联选项 */
|
|
3755
|
-
const TreeOptionNode =
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3786
|
+
const TreeOptionNode = _ref2 => {
|
|
3787
|
+
let {
|
|
3788
|
+
item,
|
|
3789
|
+
index,
|
|
3790
|
+
siblings,
|
|
3791
|
+
onChangeSiblings,
|
|
3792
|
+
allowDescription,
|
|
3793
|
+
depth,
|
|
3794
|
+
maxDepth = 4
|
|
3795
|
+
} = _ref2;
|
|
3764
3796
|
const {
|
|
3765
3797
|
formatMessage
|
|
3766
3798
|
} = reactIntl.useIntl();
|
|
@@ -3857,11 +3889,12 @@ const TreeOptionNode = ({
|
|
|
3857
3889
|
}) : null]
|
|
3858
3890
|
});
|
|
3859
3891
|
};
|
|
3860
|
-
const TreeOptionsEditor =
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3892
|
+
const TreeOptionsEditor = _ref3 => {
|
|
3893
|
+
let {
|
|
3894
|
+
value = [],
|
|
3895
|
+
onChange,
|
|
3896
|
+
allowDescription
|
|
3897
|
+
} = _ref3;
|
|
3865
3898
|
const {
|
|
3866
3899
|
formatMessage
|
|
3867
3900
|
} = reactIntl.useIntl();
|
|
@@ -3900,10 +3933,11 @@ const TreeOptionsEditor = ({
|
|
|
3900
3933
|
})]
|
|
3901
3934
|
});
|
|
3902
3935
|
};
|
|
3903
|
-
const ColumnsEditor =
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3936
|
+
const ColumnsEditor = _ref4 => {
|
|
3937
|
+
let {
|
|
3938
|
+
value = [],
|
|
3939
|
+
onChange
|
|
3940
|
+
} = _ref4;
|
|
3907
3941
|
const {
|
|
3908
3942
|
formatMessage
|
|
3909
3943
|
} = reactIntl.useIntl();
|
|
@@ -3998,11 +4032,12 @@ const ColumnsEditor = ({
|
|
|
3998
4032
|
}, "columns-editor")]
|
|
3999
4033
|
});
|
|
4000
4034
|
};
|
|
4001
|
-
const TableRowsEditor =
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4035
|
+
const TableRowsEditor = _ref5 => {
|
|
4036
|
+
let {
|
|
4037
|
+
columns = [],
|
|
4038
|
+
value = [],
|
|
4039
|
+
onChange
|
|
4040
|
+
} = _ref5;
|
|
4006
4041
|
const {
|
|
4007
4042
|
formatMessage
|
|
4008
4043
|
} = reactIntl.useIntl();
|
|
@@ -4127,15 +4162,16 @@ const TableRowsEditor = ({
|
|
|
4127
4162
|
}, "table-rows-editor")]
|
|
4128
4163
|
});
|
|
4129
4164
|
};
|
|
4130
|
-
const OptionsEditor =
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4165
|
+
const OptionsEditor = _ref6 => {
|
|
4166
|
+
let {
|
|
4167
|
+
value = [],
|
|
4168
|
+
onChange,
|
|
4169
|
+
allowDescription = false,
|
|
4170
|
+
allowChildren = false,
|
|
4171
|
+
hasColumns = false,
|
|
4172
|
+
columns = [],
|
|
4173
|
+
onColumnsChange
|
|
4174
|
+
} = _ref6;
|
|
4139
4175
|
const {
|
|
4140
4176
|
formatMessage
|
|
4141
4177
|
} = reactIntl.useIntl();
|
|
@@ -4202,9 +4238,10 @@ const OptionsEditor = ({
|
|
|
4202
4238
|
};
|
|
4203
4239
|
var OptionsEditor$1 = OptionsEditor;
|
|
4204
4240
|
|
|
4205
|
-
const SuperSelectPropsEditor =
|
|
4206
|
-
|
|
4207
|
-
|
|
4241
|
+
const SuperSelectPropsEditor = _ref => {
|
|
4242
|
+
let {
|
|
4243
|
+
definition
|
|
4244
|
+
} = _ref;
|
|
4208
4245
|
const {
|
|
4209
4246
|
formatMessage
|
|
4210
4247
|
} = reactIntl.useIntl();
|
|
@@ -4242,9 +4279,12 @@ const SuperSelectPropsEditor = ({
|
|
|
4242
4279
|
})
|
|
4243
4280
|
}, "allowClear"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
4244
4281
|
name: "allowSelectedAll",
|
|
4245
|
-
display:
|
|
4246
|
-
|
|
4247
|
-
|
|
4282
|
+
display: _ref2 => {
|
|
4283
|
+
let {
|
|
4284
|
+
openApi
|
|
4285
|
+
} = _ref2;
|
|
4286
|
+
return !openApi?.data?.single;
|
|
4287
|
+
},
|
|
4248
4288
|
children: formatMessage({
|
|
4249
4289
|
id: 'superSelectAllowSelectedAll'
|
|
4250
4290
|
})
|
|
@@ -4266,9 +4306,12 @@ const SuperSelectPropsEditor = ({
|
|
|
4266
4306
|
placeholder: formatMessage({
|
|
4267
4307
|
id: 'superSelectMaxLengthPlaceholder'
|
|
4268
4308
|
}),
|
|
4269
|
-
display:
|
|
4270
|
-
|
|
4271
|
-
|
|
4309
|
+
display: _ref3 => {
|
|
4310
|
+
let {
|
|
4311
|
+
openApi
|
|
4312
|
+
} = _ref3;
|
|
4313
|
+
return !openApi?.data?.single;
|
|
4314
|
+
}
|
|
4272
4315
|
}, "maxLength"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Input, {
|
|
4273
4316
|
name: "placeholder",
|
|
4274
4317
|
label: formatMessage({
|
|
@@ -4501,9 +4544,12 @@ const buildBuiltinList = (type, formatMessage) => {
|
|
|
4501
4544
|
}]
|
|
4502
4545
|
}, "format"), /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.Checkbox, {
|
|
4503
4546
|
name: "showTime",
|
|
4504
|
-
display:
|
|
4505
|
-
|
|
4506
|
-
|
|
4547
|
+
display: _ref => {
|
|
4548
|
+
let {
|
|
4549
|
+
openApi
|
|
4550
|
+
} = _ref;
|
|
4551
|
+
return (openApi?.data?.picker || 'date') === 'date';
|
|
4552
|
+
},
|
|
4507
4553
|
children: formatMessage({
|
|
4508
4554
|
id: 'propShowTime'
|
|
4509
4555
|
})
|
|
@@ -4530,10 +4576,11 @@ const buildBuiltinList = (type, formatMessage) => {
|
|
|
4530
4576
|
return [];
|
|
4531
4577
|
}
|
|
4532
4578
|
};
|
|
4533
|
-
const FieldPropsEditor =
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4579
|
+
const FieldPropsEditor = _ref2 => {
|
|
4580
|
+
let {
|
|
4581
|
+
type,
|
|
4582
|
+
definition: definitionProp
|
|
4583
|
+
} = _ref2;
|
|
4537
4584
|
const {
|
|
4538
4585
|
formatMessage
|
|
4539
4586
|
} = reactIntl.useIntl();
|
|
@@ -5125,13 +5172,14 @@ const buildMultipleHint = (formatMessage, minLength, maxLength) => {
|
|
|
5125
5172
|
* choice:同一条选项 UI;mode=single 只挂载一支;mode=multiple 平铺所有选中支。
|
|
5126
5173
|
* 外层用 InfoPage.Part 的 title 展示标题。
|
|
5127
5174
|
*/
|
|
5128
|
-
const ChoiceBlock =
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5175
|
+
const ChoiceBlock = _ref => {
|
|
5176
|
+
let {
|
|
5177
|
+
block,
|
|
5178
|
+
preview = false,
|
|
5179
|
+
isMobile = false,
|
|
5180
|
+
formatMessage,
|
|
5181
|
+
renderOptionContent
|
|
5182
|
+
} = _ref;
|
|
5135
5183
|
const mode = block.mode === 'multiple' ? 'multiple' : 'single';
|
|
5136
5184
|
const selectorName = resolveSelectorName(block);
|
|
5137
5185
|
const options = react.useMemo(() => block.options || [], [block.options]);
|