szld-libs 0.4.39 → 0.4.41
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 +3546 -3534
- package/dist/szld-components.umd.js +29 -29
- package/es/components/DynamicForm/func.js +4 -1
- package/es/components/DynamicFormMobile/func.js +4 -1
- package/es/components/DynamicFormMobile/myCalendar/index.js +4 -2
- package/es/components/DynamicFormMobile/useDynamicForm.js +2 -2
- package/es/index.js +19 -8
- package/es/mock/index.js +225 -366
- package/es/utils/method.js +7 -4
- package/es/utils/szxkFunc.d.ts +1 -0
- package/es/utils/szxkFunc.js +10 -1
- package/lib/components/DynamicForm/func.js +4 -1
- package/lib/components/DynamicFormMobile/func.js +4 -1
- package/lib/components/DynamicFormMobile/myCalendar/index.js +4 -2
- package/lib/components/DynamicFormMobile/useDynamicForm.js +2 -2
- package/lib/index.js +17 -6
- package/lib/mock/index.js +225 -366
- package/lib/utils/method.js +7 -4
- package/lib/utils/szxkFunc.d.ts +1 -0
- package/lib/utils/szxkFunc.js +9 -0
- package/package.json +1 -1
- package/es/services/index.d.ts +0 -6
- package/es/services/index.js +0 -83
- package/es/services/request.d.ts +0 -6
- package/es/services/request.js +0 -140
- package/es/services/status.d.ts +0 -1
- package/es/services/status.js +0 -44
- package/es/services/vite.svg +0 -1
- package/lib/services/index.d.ts +0 -6
- package/lib/services/index.js +0 -83
- package/lib/services/request.d.ts +0 -6
- package/lib/services/request.js +0 -140
- package/lib/services/status.d.ts +0 -1
- package/lib/services/status.js +0 -44
- package/lib/services/vite.svg +0 -1
package/es/utils/method.js
CHANGED
|
@@ -160,18 +160,21 @@ const handleSubmitForm = (originalData, allValues) => {
|
|
|
160
160
|
}
|
|
161
161
|
if (isAutoFill) {
|
|
162
162
|
(_a = updatedData == null ? void 0 : updatedData.attr_list) == null ? void 0 : _a.forEach((v) => {
|
|
163
|
-
var _a2, _b, _c, _d, _e, _f;
|
|
163
|
+
var _a2, _b, _c, _d, _e, _f, _g;
|
|
164
164
|
const attrvalue = (v == null ? void 0 : v.attrvalue) || "";
|
|
165
165
|
if (((_a2 = v == null ? void 0 : v.json) == null ? void 0 : _a2["auto-generate"]) && ((_b = v == null ? void 0 : v.json) == null ? void 0 : _b["auto-generate-type"]) && !attrvalue) {
|
|
166
166
|
if (((_c = v == null ? void 0 : v.json) == null ? void 0 : _c["auto-generate-type"]) === "currenttime") {
|
|
167
167
|
v.attrvalue = dayjs().format("YYYY-MM-DD HH:mm:ss");
|
|
168
168
|
}
|
|
169
|
-
if (((_d = v == null ? void 0 : v.json) == null ? void 0 : _d["auto-generate-type"]) === "
|
|
169
|
+
if (((_d = v == null ? void 0 : v.json) == null ? void 0 : _d["auto-generate-type"]) === "currenttimestamp") {
|
|
170
|
+
v.attrvalue = dayjs().unix().toString();
|
|
171
|
+
}
|
|
172
|
+
if (((_e = v == null ? void 0 : v.json) == null ? void 0 : _e["auto-generate-type"]) === "guid" && !attrvalue) {
|
|
170
173
|
v.attrvalue = onlyNumber || guid || "";
|
|
171
174
|
}
|
|
172
175
|
}
|
|
173
|
-
if (((
|
|
174
|
-
v.attrvalue = (
|
|
176
|
+
if (((_f = v == null ? void 0 : v.json) == null ? void 0 : _f["default"]) && !attrvalue) {
|
|
177
|
+
v.attrvalue = (_g = v == null ? void 0 : v.json) == null ? void 0 : _g["default"];
|
|
175
178
|
}
|
|
176
179
|
});
|
|
177
180
|
}
|
package/es/utils/szxkFunc.d.ts
CHANGED
|
@@ -69,3 +69,4 @@ export declare const handleSetTableRowColor: (record: any, index: number | undef
|
|
|
69
69
|
export declare const handleFormatMobileDate: (values: Record<string, any>, format?: string) => Record<string, any>;
|
|
70
70
|
export declare const handleNonUniversalHeader: (nonUniversalHeader: Record<string, string>, data: Record<string, any>) => Record<string, any>;
|
|
71
71
|
export declare const handleGetControlPanelConfig: (sourceNumber: string | number, commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>) => Promise<any>;
|
|
72
|
+
export declare const isJson: (str: string) => boolean;
|
package/es/utils/szxkFunc.js
CHANGED
|
@@ -98,6 +98,14 @@ const handleGetControlPanelConfig = async (sourceNumber, commonRequest) => {
|
|
|
98
98
|
} catch (error) {
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
|
+
const isJson = (str) => {
|
|
102
|
+
try {
|
|
103
|
+
JSON.parse(str);
|
|
104
|
+
return true;
|
|
105
|
+
} catch (e) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
101
109
|
export {
|
|
102
110
|
handleCallSupportCode,
|
|
103
111
|
handleFormatMobileDate,
|
|
@@ -107,5 +115,6 @@ export {
|
|
|
107
115
|
handleGetList,
|
|
108
116
|
handleNonUniversalHeader,
|
|
109
117
|
handleObjDetailToSignleAttrList,
|
|
110
|
-
handleSetTableRowColor
|
|
118
|
+
handleSetTableRowColor,
|
|
119
|
+
isJson
|
|
111
120
|
};
|
|
@@ -36,7 +36,7 @@ const handleGetPlaceholder = (itemWithJson, langId) => {
|
|
|
36
36
|
return defaultMessage;
|
|
37
37
|
};
|
|
38
38
|
const handleSetFormItemInitialValue = (itemWithJson) => {
|
|
39
|
-
var _a, _b, _c, _d, _e, _f;
|
|
39
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
40
40
|
const inputType = (_a = itemWithJson.json) == null ? void 0 : _a.input;
|
|
41
41
|
let initialValue = itemWithJson.attrvalue || ((_b = itemWithJson.json) == null ? void 0 : _b.default);
|
|
42
42
|
if (inputType === "label" && initialValue) {
|
|
@@ -83,6 +83,9 @@ const handleSetFormItemInitialValue = (itemWithJson) => {
|
|
|
83
83
|
if (inputType === "time-picker" && !initialValue && ((_e = itemWithJson.json) == null ? void 0 : _e["auto-generate"]) && ((_f = itemWithJson.json) == null ? void 0 : _f["auto-generate-type"]) === "currenttime") {
|
|
84
84
|
initialValue = dayjs().format("YYYY-MM-DD HH:mm:ss:ss");
|
|
85
85
|
}
|
|
86
|
+
if (inputType === "time-picker" && !initialValue && ((_g = itemWithJson.json) == null ? void 0 : _g["auto-generate"]) && ((_h = itemWithJson.json) == null ? void 0 : _h["auto-generate-type"]) === "currenttimestamp") {
|
|
87
|
+
initialValue = dayjs().unix().toString();
|
|
88
|
+
}
|
|
86
89
|
if (itemWithJson.attrtype === 1) {
|
|
87
90
|
initialValue = handleGetSingleAttrListObj(itemWithJson.children || []);
|
|
88
91
|
}
|
|
@@ -36,7 +36,7 @@ const handleGetPlaceholder = (itemWithJson, langId) => {
|
|
|
36
36
|
return defaultMessage;
|
|
37
37
|
};
|
|
38
38
|
const handleSetFormItemInitialValue = (itemWithJson) => {
|
|
39
|
-
var _a, _b, _c, _d, _e, _f;
|
|
39
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
40
40
|
const inputType = (_a = itemWithJson.json) == null ? void 0 : _a.input;
|
|
41
41
|
let initialValue = itemWithJson.attrvalue || ((_b = itemWithJson.json) == null ? void 0 : _b.default) || "";
|
|
42
42
|
if (inputType === "label" && initialValue) {
|
|
@@ -82,6 +82,9 @@ const handleSetFormItemInitialValue = (itemWithJson) => {
|
|
|
82
82
|
if (inputType === "time-picker" && !initialValue && ((_e = itemWithJson.json) == null ? void 0 : _e["auto-generate"]) && ((_f = itemWithJson.json) == null ? void 0 : _f["auto-generate-type"]) === "currenttime") {
|
|
83
83
|
initialValue = dayjs().format("YYYY-MM-DD HH:mm:ss:ss");
|
|
84
84
|
}
|
|
85
|
+
if (inputType === "time-picker" && !initialValue && ((_g = itemWithJson.json) == null ? void 0 : _g["auto-generate"]) && ((_h = itemWithJson.json) == null ? void 0 : _h["auto-generate-type"]) === "currenttimestamp") {
|
|
86
|
+
initialValue = dayjs().unix().toString();
|
|
87
|
+
}
|
|
85
88
|
if (itemWithJson.attrtype === 1) {
|
|
86
89
|
initialValue = handleGetSingleAttrListObj(itemWithJson.children || []);
|
|
87
90
|
}
|
|
@@ -53,10 +53,12 @@ const StringCompatibleCalendar = (props) => {
|
|
|
53
53
|
onChange(str);
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
+
const placeholder = langId === "10001" ? "请选择日期" : "Please select a date";
|
|
56
57
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(reactVant.Calendar, { type, value: internalValue, onConfirm: handleChange, children: (val, actions) => {
|
|
57
58
|
const valType = typeof val;
|
|
59
|
+
const delimiter = type === "multiple" ? "," : "~";
|
|
58
60
|
if (valType === "string") {
|
|
59
|
-
val = val.split(
|
|
61
|
+
val = val.split(delimiter);
|
|
60
62
|
if (val.length === 1) {
|
|
61
63
|
val = [val[0], val[1]];
|
|
62
64
|
}
|
|
@@ -67,7 +69,7 @@ const StringCompatibleCalendar = (props) => {
|
|
|
67
69
|
style: { padding: 0 },
|
|
68
70
|
value: val ? val.map(
|
|
69
71
|
(el) => dayjs(el).format("YYYY-MM-DD")
|
|
70
|
-
).join(
|
|
72
|
+
).join(delimiter) : placeholder,
|
|
71
73
|
onClick: (e) => {
|
|
72
74
|
actions.open();
|
|
73
75
|
}
|
|
@@ -304,7 +304,7 @@ function useDynamicForm(props) {
|
|
|
304
304
|
flex: width,
|
|
305
305
|
pointerEvents: readonly ? "none" : "auto",
|
|
306
306
|
opacity: readonly ? 0.5 : 1,
|
|
307
|
-
display: hidden ? "none" : "
|
|
307
|
+
display: hidden ? "none" : "flex"
|
|
308
308
|
},
|
|
309
309
|
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"] }),
|
|
310
310
|
required: index === 0 ? ((_d2 = item.json) == null ? void 0 : _d2.must) && !hidden : false,
|
|
@@ -352,7 +352,7 @@ function useDynamicForm(props) {
|
|
|
352
352
|
style: {
|
|
353
353
|
pointerEvents: readonly ? "none" : "auto",
|
|
354
354
|
opacity: readonly ? 0.5 : 1,
|
|
355
|
-
display: hidden ? "none" : "
|
|
355
|
+
display: hidden ? "none" : "flex"
|
|
356
356
|
},
|
|
357
357
|
rules: [
|
|
358
358
|
...((_e = itemWithJson.json) == null ? void 0 : _e.must) && !hidden ? [
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
-
const services = require("./services");
|
|
4
3
|
const method = require("./utils/method");
|
|
5
4
|
const main = require("./main");
|
|
6
5
|
const reactRouterDom = require("react-router-dom");
|
|
@@ -27,10 +26,16 @@ const Demo = () => {
|
|
|
27
26
|
}, 2e3);
|
|
28
27
|
}, []);
|
|
29
28
|
const onFinish = async (values) => {
|
|
29
|
+
method.handleSubmitForm(
|
|
30
|
+
{
|
|
31
|
+
attr_list: mock.attrList
|
|
32
|
+
},
|
|
33
|
+
values
|
|
34
|
+
);
|
|
30
35
|
};
|
|
31
36
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { height: "100vh", display: "flex", flexDirection: "column", gap: 20 }, children: [
|
|
32
37
|
/* @__PURE__ */ jsxRuntime.jsx(main.BackHeader, { title: "页头组件", isBack: true }),
|
|
33
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "20px" }, children: /* @__PURE__ */ jsxRuntime.jsxs(reactVant.Form, { form, onValuesChange, onFinish, children: [
|
|
38
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "20px" }, children: /* @__PURE__ */ jsxRuntime.jsxs(reactVant.Form, { form, onValuesChange, layout: "vertical", onFinish, children: [
|
|
34
39
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
35
40
|
main.DynamicFormMobile,
|
|
36
41
|
{
|
|
@@ -40,15 +45,21 @@ const Demo = () => {
|
|
|
40
45
|
relatedid: "guid",
|
|
41
46
|
colNum: 1,
|
|
42
47
|
defaultWidth: 358,
|
|
43
|
-
commonRequestWidthParams:
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
commonRequestWidthParams: () => {
|
|
49
|
+
return new Promise((resolve, reject) => {
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
uploadAction: () => "",
|
|
53
|
+
commonRequest: () => {
|
|
54
|
+
return new Promise((resolve, reject) => {
|
|
55
|
+
});
|
|
56
|
+
},
|
|
46
57
|
instructionShowMode: "icon",
|
|
47
58
|
ref: formRef,
|
|
48
59
|
langId
|
|
49
60
|
}
|
|
50
61
|
),
|
|
51
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactVant.Form.Item, { name: "submit", style: { marginLeft: "auto" }
|
|
62
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactVant.Form.Item, { name: "submit", style: { marginLeft: "auto" } })
|
|
52
63
|
] }) }),
|
|
53
64
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
54
65
|
"2. 测试循环滚动组件",
|