szld-libs 0.4.10 → 0.4.12
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/szld-components.es.js +2168 -2170
- package/dist/szld-components.umd.js +37 -37
- package/es/components/DynamicFormMobile/useDynamicForm.js +24 -15
- package/es/index.js +9 -0
- package/es/mock/index.js +1 -1
- package/lib/components/DynamicFormMobile/useDynamicForm.js +24 -15
- package/lib/index.js +9 -0
- package/lib/mock/index.js +1 -1
- package/package.json +1 -1
|
@@ -108,12 +108,6 @@ function useDynamicForm(props) {
|
|
|
108
108
|
value: value ? dayjs(value) : null
|
|
109
109
|
});
|
|
110
110
|
break;
|
|
111
|
-
case "second-picker":
|
|
112
|
-
baseProps.getValueFromEvent = (date) => date == null ? void 0 : date.format(format || "HH:mm:ss");
|
|
113
|
-
baseProps.getValueProps = (value) => ({
|
|
114
|
-
value: value ? dayjs(value, format || "HH:mm:ss") : null
|
|
115
|
-
});
|
|
116
|
-
break;
|
|
117
111
|
}
|
|
118
112
|
return baseProps;
|
|
119
113
|
},
|
|
@@ -257,10 +251,11 @@ function useDynamicForm(props) {
|
|
|
257
251
|
formListField,
|
|
258
252
|
isShowLabel = true
|
|
259
253
|
}) => {
|
|
260
|
-
var _a, _b, _c, _d, _e;
|
|
254
|
+
var _a, _b, _c, _d, _e, _f;
|
|
261
255
|
if (((_a = itemWithJson.json) == null ? void 0 : _a.hide) === true || (hideAttrList == null ? void 0 : hideAttrList.includes(itemWithJson.attrid))) {
|
|
262
256
|
return /* @__PURE__ */ jsx(Fragment$1, {});
|
|
263
257
|
}
|
|
258
|
+
readonly = ((_b = itemWithJson.json) == null ? void 0 : _b.readonly) || readonly || false;
|
|
264
259
|
if (itemWithJson.attrtype === 1) {
|
|
265
260
|
return renderNestedFormList({
|
|
266
261
|
itemWithJson,
|
|
@@ -281,12 +276,12 @@ function useDynamicForm(props) {
|
|
|
281
276
|
}
|
|
282
277
|
if (itemWithJson.attrtype === 0) {
|
|
283
278
|
const initialValue = handleSetFormItemInitialValue(itemWithJson);
|
|
284
|
-
const message2 = (
|
|
279
|
+
const message2 = (_c = itemWithJson.json) == null ? void 0 : _c["default-prompt"];
|
|
285
280
|
const placeholder = handleGetPlaceholder(itemWithJson, langId);
|
|
286
281
|
const { combinations = [] } = itemWithJson.json || {};
|
|
287
282
|
if (combinations == null ? void 0 : combinations.length) {
|
|
288
283
|
return /* @__PURE__ */ jsx(Flex, { children: combinations.map((item, index) => {
|
|
289
|
-
var _a2, _b2, _c2, _d2, _e2,
|
|
284
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g;
|
|
290
285
|
let initValue = handleSetFormItemInitialValue(item);
|
|
291
286
|
let width = defaultWidth;
|
|
292
287
|
const mode = item.json.input || "text";
|
|
@@ -301,7 +296,11 @@ function useDynamicForm(props) {
|
|
|
301
296
|
return /* @__PURE__ */ jsx(
|
|
302
297
|
Form.Item,
|
|
303
298
|
{
|
|
304
|
-
style: {
|
|
299
|
+
style: {
|
|
300
|
+
flex: width,
|
|
301
|
+
pointerEvents: readonly ? "none" : "auto",
|
|
302
|
+
opacity: readonly ? 0.5 : 1
|
|
303
|
+
},
|
|
305
304
|
label: index === 0 ? (_b2 = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _b2["combination-name"] : /* @__PURE__ */ jsx("div", { style: { visibility: "hidden" }, children: (_c2 = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _c2["combination-name"] }),
|
|
306
305
|
required: index === 0 ? (_d2 = item.json) == null ? void 0 : _d2.must : false,
|
|
307
306
|
name: formListField ? Array.isArray(formListField.name) ? [...formListField.name, item.attrid] : [formListField.name, item.attrid] : item.attrid,
|
|
@@ -313,7 +312,7 @@ function useDynamicForm(props) {
|
|
|
313
312
|
message: message2 || `${placeholder}${item.attrname}`
|
|
314
313
|
}
|
|
315
314
|
] : [],
|
|
316
|
-
...((
|
|
315
|
+
...((_f2 = itemWithJson.json) == null ? void 0 : _f2.regexp) ? [
|
|
317
316
|
{
|
|
318
317
|
pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
|
|
319
318
|
message: ((_g = itemWithJson.json) == null ? void 0 : _g["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
|
|
@@ -344,22 +343,21 @@ function useDynamicForm(props) {
|
|
|
344
343
|
name: formItemName,
|
|
345
344
|
label: isShowLabel && handleDealInstruction(itemWithJson, instructionShowMode) || null,
|
|
346
345
|
initialValue,
|
|
347
|
-
disabled: readonly,
|
|
348
346
|
style: {
|
|
349
347
|
pointerEvents: readonly ? "none" : "auto",
|
|
350
348
|
opacity: readonly ? 0.5 : 1
|
|
351
349
|
},
|
|
352
350
|
rules: [
|
|
353
|
-
...((
|
|
351
|
+
...((_d = itemWithJson.json) == null ? void 0 : _d.must) ? [
|
|
354
352
|
{
|
|
355
353
|
required: true,
|
|
356
354
|
message: `${placeholder}${itemWithJson.attrname}`
|
|
357
355
|
}
|
|
358
356
|
] : [],
|
|
359
|
-
...((
|
|
357
|
+
...((_e = itemWithJson.json) == null ? void 0 : _e.regexp) ? [
|
|
360
358
|
{
|
|
361
359
|
pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
|
|
362
|
-
message: ((
|
|
360
|
+
message: ((_f = itemWithJson.json) == null ? void 0 : _f["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
|
|
363
361
|
}
|
|
364
362
|
] : []
|
|
365
363
|
],
|
|
@@ -604,6 +602,13 @@ function useDynamicForm(props) {
|
|
|
604
602
|
}
|
|
605
603
|
case "range-picker":
|
|
606
604
|
return /* @__PURE__ */ jsx(Calendar, { type: "range", readOnly: readonly, children: (val, actions) => {
|
|
605
|
+
const valType = typeof val;
|
|
606
|
+
if (valType === "string") {
|
|
607
|
+
val = val.split("~");
|
|
608
|
+
if (val.length === 1) {
|
|
609
|
+
val = [val[0], val[1]];
|
|
610
|
+
}
|
|
611
|
+
}
|
|
607
612
|
return /* @__PURE__ */ jsx(
|
|
608
613
|
Cell,
|
|
609
614
|
{
|
|
@@ -619,6 +624,10 @@ function useDynamicForm(props) {
|
|
|
619
624
|
} });
|
|
620
625
|
case "multiple-date-picker":
|
|
621
626
|
return /* @__PURE__ */ jsx(Calendar, { type: "multiple", children: (val, actions) => {
|
|
627
|
+
const valType = typeof val;
|
|
628
|
+
if (valType === "string") {
|
|
629
|
+
val = val.split(",");
|
|
630
|
+
}
|
|
622
631
|
return /* @__PURE__ */ jsx(
|
|
623
632
|
Cell,
|
|
624
633
|
{
|
package/es/index.js
CHANGED
|
@@ -23,6 +23,15 @@ const Demo = () => {
|
|
|
23
23
|
};
|
|
24
24
|
useEffect(() => {
|
|
25
25
|
setList(handleAttrList(attrList));
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
form.setFieldsValue({
|
|
28
|
+
customFormList: [
|
|
29
|
+
{
|
|
30
|
+
"30BDE6E7977E40069B55DDE61C8795AE": "2026-05-29"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
});
|
|
34
|
+
}, 2e3);
|
|
26
35
|
}, []);
|
|
27
36
|
const onFinish = async (values) => {
|
|
28
37
|
};
|
package/es/mock/index.js
CHANGED
|
@@ -8,7 +8,7 @@ const attrList = [
|
|
|
8
8
|
attrid: "30BDE6E7977E40069B55DDE61C8795AE",
|
|
9
9
|
attrname: "Dates",
|
|
10
10
|
attrtype: 0,
|
|
11
|
-
info: '{"input":"
|
|
11
|
+
info: '{"readonly":false,"input":"multiple-date-picker","range-picker-save":"single","dataType":"string","length":1000,"input-width":240,"must":true}',
|
|
12
12
|
info_base64: 0,
|
|
13
13
|
createtime: "2026-02-11 15:12:26",
|
|
14
14
|
attrvalue: "",
|
|
@@ -109,12 +109,6 @@ function useDynamicForm(props) {
|
|
|
109
109
|
value: value ? dayjs(value) : null
|
|
110
110
|
});
|
|
111
111
|
break;
|
|
112
|
-
case "second-picker":
|
|
113
|
-
baseProps.getValueFromEvent = (date) => date == null ? void 0 : date.format(format || "HH:mm:ss");
|
|
114
|
-
baseProps.getValueProps = (value) => ({
|
|
115
|
-
value: value ? dayjs(value, format || "HH:mm:ss") : null
|
|
116
|
-
});
|
|
117
|
-
break;
|
|
118
112
|
}
|
|
119
113
|
return baseProps;
|
|
120
114
|
},
|
|
@@ -258,10 +252,11 @@ function useDynamicForm(props) {
|
|
|
258
252
|
formListField,
|
|
259
253
|
isShowLabel = true
|
|
260
254
|
}) => {
|
|
261
|
-
var _a, _b, _c, _d, _e;
|
|
255
|
+
var _a, _b, _c, _d, _e, _f;
|
|
262
256
|
if (((_a = itemWithJson.json) == null ? void 0 : _a.hide) === true || (hideAttrList == null ? void 0 : hideAttrList.includes(itemWithJson.attrid))) {
|
|
263
257
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
264
258
|
}
|
|
259
|
+
readonly = ((_b = itemWithJson.json) == null ? void 0 : _b.readonly) || readonly || false;
|
|
265
260
|
if (itemWithJson.attrtype === 1) {
|
|
266
261
|
return renderNestedFormList({
|
|
267
262
|
itemWithJson,
|
|
@@ -282,12 +277,12 @@ function useDynamicForm(props) {
|
|
|
282
277
|
}
|
|
283
278
|
if (itemWithJson.attrtype === 0) {
|
|
284
279
|
const initialValue = func.handleSetFormItemInitialValue(itemWithJson);
|
|
285
|
-
const message2 = (
|
|
280
|
+
const message2 = (_c = itemWithJson.json) == null ? void 0 : _c["default-prompt"];
|
|
286
281
|
const placeholder = func.handleGetPlaceholder(itemWithJson, langId);
|
|
287
282
|
const { combinations = [] } = itemWithJson.json || {};
|
|
288
283
|
if (combinations == null ? void 0 : combinations.length) {
|
|
289
284
|
return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { children: combinations.map((item, index) => {
|
|
290
|
-
var _a2, _b2, _c2, _d2, _e2,
|
|
285
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g;
|
|
291
286
|
let initValue = func.handleSetFormItemInitialValue(item);
|
|
292
287
|
let width = defaultWidth;
|
|
293
288
|
const mode = item.json.input || "text";
|
|
@@ -302,7 +297,11 @@ function useDynamicForm(props) {
|
|
|
302
297
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
303
298
|
reactVant.Form.Item,
|
|
304
299
|
{
|
|
305
|
-
style: {
|
|
300
|
+
style: {
|
|
301
|
+
flex: width,
|
|
302
|
+
pointerEvents: readonly ? "none" : "auto",
|
|
303
|
+
opacity: readonly ? 0.5 : 1
|
|
304
|
+
},
|
|
306
305
|
label: index === 0 ? (_b2 = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _b2["combination-name"] : /* @__PURE__ */ jsxRuntime.jsx("div", { style: { visibility: "hidden" }, children: (_c2 = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _c2["combination-name"] }),
|
|
307
306
|
required: index === 0 ? (_d2 = item.json) == null ? void 0 : _d2.must : false,
|
|
308
307
|
name: formListField ? Array.isArray(formListField.name) ? [...formListField.name, item.attrid] : [formListField.name, item.attrid] : item.attrid,
|
|
@@ -314,7 +313,7 @@ function useDynamicForm(props) {
|
|
|
314
313
|
message: message2 || `${placeholder}${item.attrname}`
|
|
315
314
|
}
|
|
316
315
|
] : [],
|
|
317
|
-
...((
|
|
316
|
+
...((_f2 = itemWithJson.json) == null ? void 0 : _f2.regexp) ? [
|
|
318
317
|
{
|
|
319
318
|
pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
|
|
320
319
|
message: ((_g = itemWithJson.json) == null ? void 0 : _g["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
|
|
@@ -345,22 +344,21 @@ function useDynamicForm(props) {
|
|
|
345
344
|
name: formItemName,
|
|
346
345
|
label: isShowLabel && handleDealInstruction(itemWithJson, instructionShowMode) || null,
|
|
347
346
|
initialValue,
|
|
348
|
-
disabled: readonly,
|
|
349
347
|
style: {
|
|
350
348
|
pointerEvents: readonly ? "none" : "auto",
|
|
351
349
|
opacity: readonly ? 0.5 : 1
|
|
352
350
|
},
|
|
353
351
|
rules: [
|
|
354
|
-
...((
|
|
352
|
+
...((_d = itemWithJson.json) == null ? void 0 : _d.must) ? [
|
|
355
353
|
{
|
|
356
354
|
required: true,
|
|
357
355
|
message: `${placeholder}${itemWithJson.attrname}`
|
|
358
356
|
}
|
|
359
357
|
] : [],
|
|
360
|
-
...((
|
|
358
|
+
...((_e = itemWithJson.json) == null ? void 0 : _e.regexp) ? [
|
|
361
359
|
{
|
|
362
360
|
pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
|
|
363
|
-
message: ((
|
|
361
|
+
message: ((_f = itemWithJson.json) == null ? void 0 : _f["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
|
|
364
362
|
}
|
|
365
363
|
] : []
|
|
366
364
|
],
|
|
@@ -605,6 +603,13 @@ function useDynamicForm(props) {
|
|
|
605
603
|
}
|
|
606
604
|
case "range-picker":
|
|
607
605
|
return /* @__PURE__ */ jsxRuntime.jsx(reactVant.Calendar, { type: "range", readOnly: readonly, children: (val, actions) => {
|
|
606
|
+
const valType = typeof val;
|
|
607
|
+
if (valType === "string") {
|
|
608
|
+
val = val.split("~");
|
|
609
|
+
if (val.length === 1) {
|
|
610
|
+
val = [val[0], val[1]];
|
|
611
|
+
}
|
|
612
|
+
}
|
|
608
613
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
609
614
|
reactVant.Cell,
|
|
610
615
|
{
|
|
@@ -620,6 +625,10 @@ function useDynamicForm(props) {
|
|
|
620
625
|
} });
|
|
621
626
|
case "multiple-date-picker":
|
|
622
627
|
return /* @__PURE__ */ jsxRuntime.jsx(reactVant.Calendar, { type: "multiple", children: (val, actions) => {
|
|
628
|
+
const valType = typeof val;
|
|
629
|
+
if (valType === "string") {
|
|
630
|
+
val = val.split(",");
|
|
631
|
+
}
|
|
623
632
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
624
633
|
reactVant.Cell,
|
|
625
634
|
{
|
package/lib/index.js
CHANGED
|
@@ -24,6 +24,15 @@ const Demo = () => {
|
|
|
24
24
|
};
|
|
25
25
|
react.useEffect(() => {
|
|
26
26
|
setList(method.handleAttrList(mock.attrList));
|
|
27
|
+
setTimeout(() => {
|
|
28
|
+
form.setFieldsValue({
|
|
29
|
+
customFormList: [
|
|
30
|
+
{
|
|
31
|
+
"30BDE6E7977E40069B55DDE61C8795AE": "2026-05-29"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
}, 2e3);
|
|
27
36
|
}, []);
|
|
28
37
|
const onFinish = async (values) => {
|
|
29
38
|
};
|
package/lib/mock/index.js
CHANGED
|
@@ -10,7 +10,7 @@ const attrList = [
|
|
|
10
10
|
attrid: "30BDE6E7977E40069B55DDE61C8795AE",
|
|
11
11
|
attrname: "Dates",
|
|
12
12
|
attrtype: 0,
|
|
13
|
-
info: '{"input":"
|
|
13
|
+
info: '{"readonly":false,"input":"multiple-date-picker","range-picker-save":"single","dataType":"string","length":1000,"input-width":240,"must":true}',
|
|
14
14
|
info_base64: 0,
|
|
15
15
|
createtime: "2026-02-11 15:12:26",
|
|
16
16
|
attrvalue: "",
|