szld-libs 0.4.53 → 0.4.56
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 +3795 -3790
- package/dist/szld-components.umd.js +86 -86
- package/es/components/DynamicForm/useDynamicForm.js +13 -13
- package/es/hooks/useUniversalTable.d.ts +3 -1
- package/es/hooks/useUniversalTable.js +6 -2
- package/es/index.js +3 -3
- package/es/mock/index.d.ts +3 -0
- package/es/mock/index.js +117 -8
- package/es/utils/method.js +3 -2
- package/lib/components/DynamicForm/useDynamicForm.js +13 -13
- package/lib/hooks/useUniversalTable.d.ts +3 -1
- package/lib/hooks/useUniversalTable.js +6 -2
- package/lib/index.js +3 -3
- package/lib/mock/index.d.ts +3 -0
- package/lib/mock/index.js +116 -7
- package/lib/utils/method.js +3 -2
- package/package.json +1 -1
|
@@ -302,7 +302,7 @@ function useDynamicForm(props) {
|
|
|
302
302
|
formListField,
|
|
303
303
|
isShowLabel = true
|
|
304
304
|
}) => {
|
|
305
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
305
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
306
306
|
const hidden = (_a = itemWithJson.json) == null ? void 0 : _a.hidden;
|
|
307
307
|
if (((_b = itemWithJson.json) == null ? void 0 : _b.hide) === true) {
|
|
308
308
|
return /* @__PURE__ */ jsx(Fragment$1, {});
|
|
@@ -336,17 +336,17 @@ function useDynamicForm(props) {
|
|
|
336
336
|
{
|
|
337
337
|
label: (_d = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _d["combination-name"],
|
|
338
338
|
required: ((_e = itemWithJson.json) == null ? void 0 : _e.must) && !hidden,
|
|
339
|
-
extra: /* @__PURE__ */ jsx(
|
|
339
|
+
extra: ((_g = (_f = itemWithJson.json) == null ? void 0 : _f.extraDescObj) == null ? void 0 : _g.info) ? /* @__PURE__ */ jsx(
|
|
340
340
|
"span",
|
|
341
341
|
{
|
|
342
342
|
style: {
|
|
343
|
-
marginTop: ((
|
|
343
|
+
marginTop: ((_i = (_h = itemWithJson.json) == null ? void 0 : _h.extraDescObj) == null ? void 0 : _i.info) ? 10 : 0,
|
|
344
344
|
display: "inline-block",
|
|
345
|
-
color: (
|
|
345
|
+
color: (_k = (_j = itemWithJson.json) == null ? void 0 : _j.extraDescObj) == null ? void 0 : _k.color
|
|
346
346
|
},
|
|
347
|
-
children: (
|
|
347
|
+
children: (_m = (_l = itemWithJson.json) == null ? void 0 : _l.extraDescObj) == null ? void 0 : _m.info
|
|
348
348
|
}
|
|
349
|
-
),
|
|
349
|
+
) : null,
|
|
350
350
|
children: /* @__PURE__ */ jsx(Space.Compact, { children: combinations.map((item, index) => {
|
|
351
351
|
var _a2, _b2, _c2, _d2, _e2;
|
|
352
352
|
let initValue = handleSetFormItemInitialValue(item);
|
|
@@ -412,28 +412,28 @@ function useDynamicForm(props) {
|
|
|
412
412
|
label: isShowLabel && handleDealInstruction(itemWithJson, instructionShowMode) || null,
|
|
413
413
|
initialValue,
|
|
414
414
|
hidden,
|
|
415
|
-
extra: ((
|
|
415
|
+
extra: ((_o = (_n = itemWithJson.json) == null ? void 0 : _n.extraDescObj) == null ? void 0 : _o.info) ? /* @__PURE__ */ jsx(
|
|
416
416
|
"span",
|
|
417
417
|
{
|
|
418
418
|
style: {
|
|
419
|
-
marginTop: ((
|
|
419
|
+
marginTop: ((_q = (_p = itemWithJson.json) == null ? void 0 : _p.extraDescObj) == null ? void 0 : _q.info) ? 10 : 0,
|
|
420
420
|
display: "inline-block",
|
|
421
|
-
color: (
|
|
421
|
+
color: (_s = (_r = itemWithJson.json) == null ? void 0 : _r.extraDescObj) == null ? void 0 : _s.color
|
|
422
422
|
},
|
|
423
|
-
children: (
|
|
423
|
+
children: (_u = (_t = itemWithJson.json) == null ? void 0 : _t.extraDescObj) == null ? void 0 : _u.info
|
|
424
424
|
}
|
|
425
425
|
) : null,
|
|
426
426
|
rules: [
|
|
427
|
-
...((
|
|
427
|
+
...((_v = itemWithJson.json) == null ? void 0 : _v.must) && !hidden ? [
|
|
428
428
|
{
|
|
429
429
|
required: true,
|
|
430
430
|
message: `${placeholder}${itemWithJson.attrname}`
|
|
431
431
|
}
|
|
432
432
|
] : [],
|
|
433
|
-
...((
|
|
433
|
+
...((_w = itemWithJson.json) == null ? void 0 : _w.regexp) ? [
|
|
434
434
|
{
|
|
435
435
|
pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
|
|
436
|
-
message: ((
|
|
436
|
+
message: ((_x = itemWithJson.json) == null ? void 0 : _x["regexp-message"]) || `${itemWithJson.attrname}${langId === "10001" ? "格式不正确" : "Format is incorrect"}`
|
|
437
437
|
}
|
|
438
438
|
] : []
|
|
439
439
|
],
|
|
@@ -3,7 +3,9 @@ import { ReactNode } from 'react';
|
|
|
3
3
|
declare function useUniversalTable(): {
|
|
4
4
|
handleUniversalHeaderToColumns: ({ universalHeader, extraBtn, operationColumnConfig, attributeSetId, getTitle, downloadText, isDefaultWidth, otherLangPageId, objDefaultLangPageId, }: {
|
|
5
5
|
universalHeader: any[];
|
|
6
|
-
extraBtn?:
|
|
6
|
+
extraBtn?: {
|
|
7
|
+
[key: string]: (record: any, content: string, item: any) => ReactNode;
|
|
8
|
+
} | ((record: any, content: string, item: any) => ReactNode) | undefined;
|
|
7
9
|
operationColumnConfig?: any;
|
|
8
10
|
attributeSetId?: string | undefined;
|
|
9
11
|
getTitle?: ((pageID: string, dataID: string) => string) | undefined;
|
|
@@ -275,6 +275,7 @@ function useUniversalTable() {
|
|
|
275
275
|
const showBtn = item == null ? void 0 : item["show-btn"];
|
|
276
276
|
if (mulAttrConfig && mulAttrConfig.list && Array.isArray(mulAttrConfig.list)) {
|
|
277
277
|
column.render = (_, record) => {
|
|
278
|
+
var _a;
|
|
278
279
|
const { list: list2, delimiter = "," } = mulAttrConfig;
|
|
279
280
|
const values = list2.map((attrId) => {
|
|
280
281
|
if (!attrId)
|
|
@@ -285,17 +286,20 @@ function useUniversalTable() {
|
|
|
285
286
|
if (showBtn && extraBtn) {
|
|
286
287
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
287
288
|
content ?? "-",
|
|
288
|
-
extraBtn
|
|
289
|
+
typeof extraBtn === "function" ? extraBtn(record, content, item) : null,
|
|
290
|
+
typeof extraBtn === "object" ? (_a = extraBtn == null ? void 0 : extraBtn[item == null ? void 0 : item["header-attribute-id"]]) == null ? void 0 : _a.call(extraBtn, record, content, item) : null
|
|
289
291
|
] });
|
|
290
292
|
}
|
|
291
293
|
return content || "-";
|
|
292
294
|
};
|
|
293
295
|
} else if (showBtn && extraBtn) {
|
|
294
296
|
column.render = (_, record) => {
|
|
297
|
+
var _a;
|
|
295
298
|
const content = record[column.dataIndex] || "";
|
|
296
299
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
297
300
|
content || "-",
|
|
298
|
-
extraBtn(record, content, item)
|
|
301
|
+
typeof extraBtn === "function" ? extraBtn(record, content, item) : null,
|
|
302
|
+
typeof extraBtn === "object" ? (_a = extraBtn == null ? void 0 : extraBtn[item == null ? void 0 : item["header-attribute-id"]]) == null ? void 0 : _a.call(extraBtn, record, content, item) : null
|
|
299
303
|
] });
|
|
300
304
|
};
|
|
301
305
|
}
|
package/es/index.js
CHANGED
|
@@ -16,17 +16,17 @@ const Demo = () => {
|
|
|
16
16
|
const [form] = Form.useForm();
|
|
17
17
|
const [list, setList] = useState([]);
|
|
18
18
|
const [langId, setLangId] = useState("10002");
|
|
19
|
-
const onValuesChange = async (
|
|
19
|
+
const onValuesChange = async (values2, allValues) => {
|
|
20
20
|
};
|
|
21
21
|
useEffect(() => {
|
|
22
22
|
setList(handleAttrList(attrList));
|
|
23
23
|
}, []);
|
|
24
|
-
const onFinish = async (
|
|
24
|
+
const onFinish = async (values2) => {
|
|
25
25
|
handleSubmitForm(
|
|
26
26
|
{
|
|
27
27
|
attr_list: list
|
|
28
28
|
},
|
|
29
|
-
|
|
29
|
+
values2
|
|
30
30
|
);
|
|
31
31
|
};
|
|
32
32
|
return /* @__PURE__ */ jsxs("div", { style: { height: "100vh", display: "flex", flexDirection: "column", gap: 20 }, children: [
|
package/es/mock/index.d.ts
CHANGED
package/es/mock/index.js
CHANGED
|
@@ -1,24 +1,133 @@
|
|
|
1
1
|
const baseAttrList = [];
|
|
2
2
|
const attrList = [
|
|
3
3
|
{
|
|
4
|
-
xh:
|
|
5
|
-
asid: "
|
|
4
|
+
xh: 2,
|
|
5
|
+
asid: "3D047E82C28B4D918ED5E02A52206F2A",
|
|
6
6
|
astype: 0,
|
|
7
|
-
tname: "
|
|
8
|
-
attrid: "
|
|
9
|
-
attrname: "
|
|
7
|
+
tname: "zysqwzh_table",
|
|
8
|
+
attrid: "5C4E5041F12447B99A563E569F40DB40",
|
|
9
|
+
attrname: "账号",
|
|
10
10
|
attrtype: 0,
|
|
11
|
-
info: '{"input":"
|
|
11
|
+
info: '{\r\n "input": "text",\r\n "dataType": "string",\r\n "length": 100,\r\n "regexp": "/^[a-zA-Z!@#$%^&*,.\\_]+$/",\r\n "regexp-message": "仅可输入英文+特殊符号(!@#$%^&*,._)",\r\n "data-uniqueness": true,\r\n "must": true\r\n}',
|
|
12
12
|
info_base64: 0,
|
|
13
|
-
createtime: "2026-
|
|
13
|
+
createtime: "2026-04-27 18:10:57",
|
|
14
14
|
attrvalue: "",
|
|
15
15
|
serialnum: 1,
|
|
16
16
|
children: []
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
xh: 3,
|
|
20
|
+
asid: "3D047E82C28B4D918ED5E02A52206F2A",
|
|
21
|
+
astype: 0,
|
|
22
|
+
tname: "zysqwzh_table",
|
|
23
|
+
attrid: "533C58403EF14EB99C05A97AD308E005",
|
|
24
|
+
attrname: "密码",
|
|
25
|
+
attrtype: 0,
|
|
26
|
+
info: '{\r\n "input": "password",\r\n "dataType": "string",\r\n "length": 100,\r\n "regexp": "/^(?=.*\\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*,.\\_])[\\da-zA-Z!@#$%^&*,.\\_]{8,16}$/",\r\n "regexp-message": "请输入8-16位密码,必须包含数字、大写字母、小写字母和特殊符号(!@#$%^&*,._)",\r\n "must": true,\r\n "data-save-type": "encode|SM3|local|szldgg"\r\n}',
|
|
27
|
+
info_base64: 0,
|
|
28
|
+
createtime: "2026-04-27 18:11:30",
|
|
29
|
+
attrvalue: "",
|
|
30
|
+
serialnum: 2,
|
|
31
|
+
children: []
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
xh: 4,
|
|
35
|
+
asid: "3D047E82C28B4D918ED5E02A52206F2A",
|
|
36
|
+
astype: 0,
|
|
37
|
+
tname: "zysqwzh_table",
|
|
38
|
+
attrid: "7B008404ADCD4BEF864C363C273906B7",
|
|
39
|
+
attrname: "单位名称",
|
|
40
|
+
attrtype: 0,
|
|
41
|
+
info: '{"input":"text","message":"请输入单位名称","dataType":"string","length":100,"must":true}',
|
|
42
|
+
info_base64: 0,
|
|
43
|
+
createtime: "2026-04-27 18:12:40",
|
|
44
|
+
attrvalue: "",
|
|
45
|
+
serialnum: 3,
|
|
46
|
+
children: []
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
xh: 5,
|
|
50
|
+
asid: "3D047E82C28B4D918ED5E02A52206F2A",
|
|
51
|
+
astype: 0,
|
|
52
|
+
tname: "zysqwzh_table",
|
|
53
|
+
attrid: "C47E1F05EEBC45819F29A97ADCF67434",
|
|
54
|
+
attrname: "联系人",
|
|
55
|
+
attrtype: 0,
|
|
56
|
+
info: '{"input":"text","message":"请输入联系人","dataType":"string","length":10,"must":true}',
|
|
57
|
+
info_base64: 0,
|
|
58
|
+
createtime: "2026-04-27 18:13:02",
|
|
59
|
+
attrvalue: "",
|
|
60
|
+
serialnum: 4,
|
|
61
|
+
children: []
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
xh: 6,
|
|
65
|
+
asid: "3D047E82C28B4D918ED5E02A52206F2A",
|
|
66
|
+
astype: 0,
|
|
67
|
+
tname: "zysqwzh_table",
|
|
68
|
+
attrid: "FB3B3F384A7F48AE8DAEF48BB71E8A2A",
|
|
69
|
+
attrname: "联系电话",
|
|
70
|
+
attrtype: 0,
|
|
71
|
+
info: '{"input":"text","message":"请输入联系电话","dataType":"string","length":20,"must":true}',
|
|
72
|
+
info_base64: 0,
|
|
73
|
+
createtime: "2026-04-27 18:13:36",
|
|
74
|
+
attrvalue: "",
|
|
75
|
+
serialnum: 5,
|
|
76
|
+
children: []
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
xh: 7,
|
|
80
|
+
asid: "3D047E82C28B4D918ED5E02A52206F2A",
|
|
81
|
+
astype: 0,
|
|
82
|
+
tname: "zysqwzh_table",
|
|
83
|
+
attrid: "31476E09F6604BF88394462BDF2E4A79",
|
|
84
|
+
attrname: "备注",
|
|
85
|
+
attrtype: 0,
|
|
86
|
+
info: '{"input":"text","dataType":"string","length":1000,"must":true}',
|
|
87
|
+
info_base64: 0,
|
|
88
|
+
createtime: "2026-04-27 18:14:16",
|
|
89
|
+
attrvalue: "",
|
|
90
|
+
serialnum: 6,
|
|
91
|
+
children: []
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
xh: 9,
|
|
95
|
+
asid: "3D047E82C28B4D918ED5E02A52206F2A",
|
|
96
|
+
astype: 0,
|
|
97
|
+
tname: "zysqwzh_table",
|
|
98
|
+
attrid: "CDCD18D269D0414AA211635C694C674C",
|
|
99
|
+
attrname: "账号类型",
|
|
100
|
+
attrtype: 0,
|
|
101
|
+
info: '{"input":"select","dataType":"string","length":100,"inputType":"local","data":["普通","销售A","销售B"],"must":true,"default": "普通"}',
|
|
102
|
+
info_base64: 0,
|
|
103
|
+
createtime: "2026-04-29 18:24:25",
|
|
104
|
+
attrvalue: "",
|
|
105
|
+
serialnum: 8,
|
|
106
|
+
children: []
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
xh: 10,
|
|
110
|
+
asid: "3D047E82C28B4D918ED5E02A52206F2A",
|
|
111
|
+
astype: 0,
|
|
112
|
+
tname: "zysqwzh_table",
|
|
113
|
+
attrid: "8194CF02CAF54D34BEA0557AB1F2CFFA",
|
|
114
|
+
attrname: "分润比例",
|
|
115
|
+
attrtype: 0,
|
|
116
|
+
info: '{"input":"select","dataType":"string","length":100,"inputType":"local","data":["0","0.2","0.3"],"must":true,"default": "0"}',
|
|
117
|
+
info_base64: 0,
|
|
118
|
+
createtime: "2026-04-29 18:40:00",
|
|
119
|
+
attrvalue: "",
|
|
120
|
+
serialnum: 9,
|
|
121
|
+
children: []
|
|
17
122
|
}
|
|
18
123
|
];
|
|
124
|
+
const values = {
|
|
125
|
+
"3996884FD35D47ACAAC955E10F0766A6": ["2026-06-25", "2026-07-31"]
|
|
126
|
+
};
|
|
19
127
|
const langConfig = [];
|
|
20
128
|
export {
|
|
21
129
|
attrList,
|
|
22
130
|
baseAttrList,
|
|
23
|
-
langConfig
|
|
131
|
+
langConfig,
|
|
132
|
+
values
|
|
24
133
|
};
|
package/es/utils/method.js
CHANGED
|
@@ -5,7 +5,8 @@ function getJson(jsonStr) {
|
|
|
5
5
|
try {
|
|
6
6
|
return JSON.parse(jsonStr);
|
|
7
7
|
} catch (error) {
|
|
8
|
-
|
|
8
|
+
const fixedData = jsonStr.replace(/\\_/g, "_");
|
|
9
|
+
return fixedData ? JSON.parse(fixedData) : {};
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
12
|
function base64ToString(base64Str) {
|
|
@@ -225,7 +226,7 @@ const processItem = (item, extraAttrs, notDisplay) => {
|
|
|
225
226
|
if (!item.json && item.info) {
|
|
226
227
|
try {
|
|
227
228
|
const infoStr = item.info_base64 === 1 ? base64ToString(item.info) : item.info;
|
|
228
|
-
const json = getJson(infoStr);
|
|
229
|
+
const json = typeof infoStr === "string" ? getJson(infoStr) : infoStr;
|
|
229
230
|
const _extraAttrs = _.cloneDeep(extraAttrs) || {};
|
|
230
231
|
const { langConfig = [], attrLangConfig = [] } = _extraAttrs || {};
|
|
231
232
|
_extraAttrs == null ? true : delete _extraAttrs.langConfig;
|
|
@@ -303,7 +303,7 @@ function useDynamicForm(props) {
|
|
|
303
303
|
formListField,
|
|
304
304
|
isShowLabel = true
|
|
305
305
|
}) => {
|
|
306
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
306
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
307
307
|
const hidden = (_a = itemWithJson.json) == null ? void 0 : _a.hidden;
|
|
308
308
|
if (((_b = itemWithJson.json) == null ? void 0 : _b.hide) === true) {
|
|
309
309
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
@@ -337,17 +337,17 @@ function useDynamicForm(props) {
|
|
|
337
337
|
{
|
|
338
338
|
label: (_d = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _d["combination-name"],
|
|
339
339
|
required: ((_e = itemWithJson.json) == null ? void 0 : _e.must) && !hidden,
|
|
340
|
-
extra: /* @__PURE__ */ jsxRuntime.jsx(
|
|
340
|
+
extra: ((_g = (_f = itemWithJson.json) == null ? void 0 : _f.extraDescObj) == null ? void 0 : _g.info) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
341
341
|
"span",
|
|
342
342
|
{
|
|
343
343
|
style: {
|
|
344
|
-
marginTop: ((
|
|
344
|
+
marginTop: ((_i = (_h = itemWithJson.json) == null ? void 0 : _h.extraDescObj) == null ? void 0 : _i.info) ? 10 : 0,
|
|
345
345
|
display: "inline-block",
|
|
346
|
-
color: (
|
|
346
|
+
color: (_k = (_j = itemWithJson.json) == null ? void 0 : _j.extraDescObj) == null ? void 0 : _k.color
|
|
347
347
|
},
|
|
348
|
-
children: (
|
|
348
|
+
children: (_m = (_l = itemWithJson.json) == null ? void 0 : _l.extraDescObj) == null ? void 0 : _m.info
|
|
349
349
|
}
|
|
350
|
-
),
|
|
350
|
+
) : null,
|
|
351
351
|
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Space.Compact, { children: combinations.map((item, index) => {
|
|
352
352
|
var _a2, _b2, _c2, _d2, _e2;
|
|
353
353
|
let initValue = func.handleSetFormItemInitialValue(item);
|
|
@@ -413,28 +413,28 @@ function useDynamicForm(props) {
|
|
|
413
413
|
label: isShowLabel && handleDealInstruction(itemWithJson, instructionShowMode) || null,
|
|
414
414
|
initialValue,
|
|
415
415
|
hidden,
|
|
416
|
-
extra: ((
|
|
416
|
+
extra: ((_o = (_n = itemWithJson.json) == null ? void 0 : _n.extraDescObj) == null ? void 0 : _o.info) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
417
417
|
"span",
|
|
418
418
|
{
|
|
419
419
|
style: {
|
|
420
|
-
marginTop: ((
|
|
420
|
+
marginTop: ((_q = (_p = itemWithJson.json) == null ? void 0 : _p.extraDescObj) == null ? void 0 : _q.info) ? 10 : 0,
|
|
421
421
|
display: "inline-block",
|
|
422
|
-
color: (
|
|
422
|
+
color: (_s = (_r = itemWithJson.json) == null ? void 0 : _r.extraDescObj) == null ? void 0 : _s.color
|
|
423
423
|
},
|
|
424
|
-
children: (
|
|
424
|
+
children: (_u = (_t = itemWithJson.json) == null ? void 0 : _t.extraDescObj) == null ? void 0 : _u.info
|
|
425
425
|
}
|
|
426
426
|
) : null,
|
|
427
427
|
rules: [
|
|
428
|
-
...((
|
|
428
|
+
...((_v = itemWithJson.json) == null ? void 0 : _v.must) && !hidden ? [
|
|
429
429
|
{
|
|
430
430
|
required: true,
|
|
431
431
|
message: `${placeholder}${itemWithJson.attrname}`
|
|
432
432
|
}
|
|
433
433
|
] : [],
|
|
434
|
-
...((
|
|
434
|
+
...((_w = itemWithJson.json) == null ? void 0 : _w.regexp) ? [
|
|
435
435
|
{
|
|
436
436
|
pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
|
|
437
|
-
message: ((
|
|
437
|
+
message: ((_x = itemWithJson.json) == null ? void 0 : _x["regexp-message"]) || `${itemWithJson.attrname}${langId === "10001" ? "格式不正确" : "Format is incorrect"}`
|
|
438
438
|
}
|
|
439
439
|
] : []
|
|
440
440
|
],
|
|
@@ -3,7 +3,9 @@ import { ReactNode } from 'react';
|
|
|
3
3
|
declare function useUniversalTable(): {
|
|
4
4
|
handleUniversalHeaderToColumns: ({ universalHeader, extraBtn, operationColumnConfig, attributeSetId, getTitle, downloadText, isDefaultWidth, otherLangPageId, objDefaultLangPageId, }: {
|
|
5
5
|
universalHeader: any[];
|
|
6
|
-
extraBtn?:
|
|
6
|
+
extraBtn?: {
|
|
7
|
+
[key: string]: (record: any, content: string, item: any) => ReactNode;
|
|
8
|
+
} | ((record: any, content: string, item: any) => ReactNode) | undefined;
|
|
7
9
|
operationColumnConfig?: any;
|
|
8
10
|
attributeSetId?: string | undefined;
|
|
9
11
|
getTitle?: ((pageID: string, dataID: string) => string) | undefined;
|
|
@@ -276,6 +276,7 @@ function useUniversalTable() {
|
|
|
276
276
|
const showBtn = item == null ? void 0 : item["show-btn"];
|
|
277
277
|
if (mulAttrConfig && mulAttrConfig.list && Array.isArray(mulAttrConfig.list)) {
|
|
278
278
|
column.render = (_, record) => {
|
|
279
|
+
var _a;
|
|
279
280
|
const { list: list2, delimiter = "," } = mulAttrConfig;
|
|
280
281
|
const values = list2.map((attrId) => {
|
|
281
282
|
if (!attrId)
|
|
@@ -286,17 +287,20 @@ function useUniversalTable() {
|
|
|
286
287
|
if (showBtn && extraBtn) {
|
|
287
288
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
288
289
|
content ?? "-",
|
|
289
|
-
extraBtn
|
|
290
|
+
typeof extraBtn === "function" ? extraBtn(record, content, item) : null,
|
|
291
|
+
typeof extraBtn === "object" ? (_a = extraBtn == null ? void 0 : extraBtn[item == null ? void 0 : item["header-attribute-id"]]) == null ? void 0 : _a.call(extraBtn, record, content, item) : null
|
|
290
292
|
] });
|
|
291
293
|
}
|
|
292
294
|
return content || "-";
|
|
293
295
|
};
|
|
294
296
|
} else if (showBtn && extraBtn) {
|
|
295
297
|
column.render = (_, record) => {
|
|
298
|
+
var _a;
|
|
296
299
|
const content = record[column.dataIndex] || "";
|
|
297
300
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
298
301
|
content || "-",
|
|
299
|
-
extraBtn(record, content, item)
|
|
302
|
+
typeof extraBtn === "function" ? extraBtn(record, content, item) : null,
|
|
303
|
+
typeof extraBtn === "object" ? (_a = extraBtn == null ? void 0 : extraBtn[item == null ? void 0 : item["header-attribute-id"]]) == null ? void 0 : _a.call(extraBtn, record, content, item) : null
|
|
300
304
|
] });
|
|
301
305
|
};
|
|
302
306
|
}
|
package/lib/index.js
CHANGED
|
@@ -17,17 +17,17 @@ const Demo = () => {
|
|
|
17
17
|
const [form] = antd.Form.useForm();
|
|
18
18
|
const [list, setList] = react.useState([]);
|
|
19
19
|
const [langId, setLangId] = react.useState("10002");
|
|
20
|
-
const onValuesChange = async (
|
|
20
|
+
const onValuesChange = async (values2, allValues) => {
|
|
21
21
|
};
|
|
22
22
|
react.useEffect(() => {
|
|
23
23
|
setList(method.handleAttrList(mock.attrList));
|
|
24
24
|
}, []);
|
|
25
|
-
const onFinish = async (
|
|
25
|
+
const onFinish = async (values2) => {
|
|
26
26
|
method.handleSubmitForm(
|
|
27
27
|
{
|
|
28
28
|
attr_list: list
|
|
29
29
|
},
|
|
30
|
-
|
|
30
|
+
values2
|
|
31
31
|
);
|
|
32
32
|
};
|
|
33
33
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { height: "100vh", display: "flex", flexDirection: "column", gap: 20 }, children: [
|
package/lib/mock/index.d.ts
CHANGED
package/lib/mock/index.js
CHANGED
|
@@ -3,22 +3,131 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const baseAttrList = [];
|
|
4
4
|
const attrList = [
|
|
5
5
|
{
|
|
6
|
-
xh:
|
|
7
|
-
asid: "
|
|
6
|
+
xh: 2,
|
|
7
|
+
asid: "3D047E82C28B4D918ED5E02A52206F2A",
|
|
8
8
|
astype: 0,
|
|
9
|
-
tname: "
|
|
10
|
-
attrid: "
|
|
11
|
-
attrname: "
|
|
9
|
+
tname: "zysqwzh_table",
|
|
10
|
+
attrid: "5C4E5041F12447B99A563E569F40DB40",
|
|
11
|
+
attrname: "账号",
|
|
12
12
|
attrtype: 0,
|
|
13
|
-
info: '{"input":"
|
|
13
|
+
info: '{\r\n "input": "text",\r\n "dataType": "string",\r\n "length": 100,\r\n "regexp": "/^[a-zA-Z!@#$%^&*,.\\_]+$/",\r\n "regexp-message": "仅可输入英文+特殊符号(!@#$%^&*,._)",\r\n "data-uniqueness": true,\r\n "must": true\r\n}',
|
|
14
14
|
info_base64: 0,
|
|
15
|
-
createtime: "2026-
|
|
15
|
+
createtime: "2026-04-27 18:10:57",
|
|
16
16
|
attrvalue: "",
|
|
17
17
|
serialnum: 1,
|
|
18
18
|
children: []
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
xh: 3,
|
|
22
|
+
asid: "3D047E82C28B4D918ED5E02A52206F2A",
|
|
23
|
+
astype: 0,
|
|
24
|
+
tname: "zysqwzh_table",
|
|
25
|
+
attrid: "533C58403EF14EB99C05A97AD308E005",
|
|
26
|
+
attrname: "密码",
|
|
27
|
+
attrtype: 0,
|
|
28
|
+
info: '{\r\n "input": "password",\r\n "dataType": "string",\r\n "length": 100,\r\n "regexp": "/^(?=.*\\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*,.\\_])[\\da-zA-Z!@#$%^&*,.\\_]{8,16}$/",\r\n "regexp-message": "请输入8-16位密码,必须包含数字、大写字母、小写字母和特殊符号(!@#$%^&*,._)",\r\n "must": true,\r\n "data-save-type": "encode|SM3|local|szldgg"\r\n}',
|
|
29
|
+
info_base64: 0,
|
|
30
|
+
createtime: "2026-04-27 18:11:30",
|
|
31
|
+
attrvalue: "",
|
|
32
|
+
serialnum: 2,
|
|
33
|
+
children: []
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
xh: 4,
|
|
37
|
+
asid: "3D047E82C28B4D918ED5E02A52206F2A",
|
|
38
|
+
astype: 0,
|
|
39
|
+
tname: "zysqwzh_table",
|
|
40
|
+
attrid: "7B008404ADCD4BEF864C363C273906B7",
|
|
41
|
+
attrname: "单位名称",
|
|
42
|
+
attrtype: 0,
|
|
43
|
+
info: '{"input":"text","message":"请输入单位名称","dataType":"string","length":100,"must":true}',
|
|
44
|
+
info_base64: 0,
|
|
45
|
+
createtime: "2026-04-27 18:12:40",
|
|
46
|
+
attrvalue: "",
|
|
47
|
+
serialnum: 3,
|
|
48
|
+
children: []
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
xh: 5,
|
|
52
|
+
asid: "3D047E82C28B4D918ED5E02A52206F2A",
|
|
53
|
+
astype: 0,
|
|
54
|
+
tname: "zysqwzh_table",
|
|
55
|
+
attrid: "C47E1F05EEBC45819F29A97ADCF67434",
|
|
56
|
+
attrname: "联系人",
|
|
57
|
+
attrtype: 0,
|
|
58
|
+
info: '{"input":"text","message":"请输入联系人","dataType":"string","length":10,"must":true}',
|
|
59
|
+
info_base64: 0,
|
|
60
|
+
createtime: "2026-04-27 18:13:02",
|
|
61
|
+
attrvalue: "",
|
|
62
|
+
serialnum: 4,
|
|
63
|
+
children: []
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
xh: 6,
|
|
67
|
+
asid: "3D047E82C28B4D918ED5E02A52206F2A",
|
|
68
|
+
astype: 0,
|
|
69
|
+
tname: "zysqwzh_table",
|
|
70
|
+
attrid: "FB3B3F384A7F48AE8DAEF48BB71E8A2A",
|
|
71
|
+
attrname: "联系电话",
|
|
72
|
+
attrtype: 0,
|
|
73
|
+
info: '{"input":"text","message":"请输入联系电话","dataType":"string","length":20,"must":true}',
|
|
74
|
+
info_base64: 0,
|
|
75
|
+
createtime: "2026-04-27 18:13:36",
|
|
76
|
+
attrvalue: "",
|
|
77
|
+
serialnum: 5,
|
|
78
|
+
children: []
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
xh: 7,
|
|
82
|
+
asid: "3D047E82C28B4D918ED5E02A52206F2A",
|
|
83
|
+
astype: 0,
|
|
84
|
+
tname: "zysqwzh_table",
|
|
85
|
+
attrid: "31476E09F6604BF88394462BDF2E4A79",
|
|
86
|
+
attrname: "备注",
|
|
87
|
+
attrtype: 0,
|
|
88
|
+
info: '{"input":"text","dataType":"string","length":1000,"must":true}',
|
|
89
|
+
info_base64: 0,
|
|
90
|
+
createtime: "2026-04-27 18:14:16",
|
|
91
|
+
attrvalue: "",
|
|
92
|
+
serialnum: 6,
|
|
93
|
+
children: []
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
xh: 9,
|
|
97
|
+
asid: "3D047E82C28B4D918ED5E02A52206F2A",
|
|
98
|
+
astype: 0,
|
|
99
|
+
tname: "zysqwzh_table",
|
|
100
|
+
attrid: "CDCD18D269D0414AA211635C694C674C",
|
|
101
|
+
attrname: "账号类型",
|
|
102
|
+
attrtype: 0,
|
|
103
|
+
info: '{"input":"select","dataType":"string","length":100,"inputType":"local","data":["普通","销售A","销售B"],"must":true,"default": "普通"}',
|
|
104
|
+
info_base64: 0,
|
|
105
|
+
createtime: "2026-04-29 18:24:25",
|
|
106
|
+
attrvalue: "",
|
|
107
|
+
serialnum: 8,
|
|
108
|
+
children: []
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
xh: 10,
|
|
112
|
+
asid: "3D047E82C28B4D918ED5E02A52206F2A",
|
|
113
|
+
astype: 0,
|
|
114
|
+
tname: "zysqwzh_table",
|
|
115
|
+
attrid: "8194CF02CAF54D34BEA0557AB1F2CFFA",
|
|
116
|
+
attrname: "分润比例",
|
|
117
|
+
attrtype: 0,
|
|
118
|
+
info: '{"input":"select","dataType":"string","length":100,"inputType":"local","data":["0","0.2","0.3"],"must":true,"default": "0"}',
|
|
119
|
+
info_base64: 0,
|
|
120
|
+
createtime: "2026-04-29 18:40:00",
|
|
121
|
+
attrvalue: "",
|
|
122
|
+
serialnum: 9,
|
|
123
|
+
children: []
|
|
19
124
|
}
|
|
20
125
|
];
|
|
126
|
+
const values = {
|
|
127
|
+
"3996884FD35D47ACAAC955E10F0766A6": ["2026-06-25", "2026-07-31"]
|
|
128
|
+
};
|
|
21
129
|
const langConfig = [];
|
|
22
130
|
exports.attrList = attrList;
|
|
23
131
|
exports.baseAttrList = baseAttrList;
|
|
24
132
|
exports.langConfig = langConfig;
|
|
133
|
+
exports.values = values;
|
package/lib/utils/method.js
CHANGED
|
@@ -7,7 +7,8 @@ function getJson(jsonStr) {
|
|
|
7
7
|
try {
|
|
8
8
|
return JSON.parse(jsonStr);
|
|
9
9
|
} catch (error) {
|
|
10
|
-
|
|
10
|
+
const fixedData = jsonStr.replace(/\\_/g, "_");
|
|
11
|
+
return fixedData ? JSON.parse(fixedData) : {};
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
function base64ToString(base64Str) {
|
|
@@ -227,7 +228,7 @@ const processItem = (item, extraAttrs, notDisplay) => {
|
|
|
227
228
|
if (!item.json && item.info) {
|
|
228
229
|
try {
|
|
229
230
|
const infoStr = item.info_base64 === 1 ? base64ToString(item.info) : item.info;
|
|
230
|
-
const json = getJson(infoStr);
|
|
231
|
+
const json = typeof infoStr === "string" ? getJson(infoStr) : infoStr;
|
|
231
232
|
const _extraAttrs = _.cloneDeep(extraAttrs) || {};
|
|
232
233
|
const { langConfig = [], attrLangConfig = [] } = _extraAttrs || {};
|
|
233
234
|
_extraAttrs == null ? true : delete _extraAttrs.langConfig;
|