szld-libs 0.3.50 → 0.3.53
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 +9722 -9731
- package/dist/szld-components.umd.js +55 -55
- package/es/components/DynamicForm/func.d.ts +1 -2
- package/es/components/DynamicForm/func.js +2 -3
- package/es/components/DynamicForm/index.js +2 -4
- package/es/components/DynamicForm/myCheckbox/index.d.ts +0 -1
- package/es/components/DynamicForm/myCheckbox/index.js +3 -5
- package/es/components/DynamicForm/myRadio/index.d.ts +0 -1
- package/es/components/DynamicForm/myRadio/index.js +3 -5
- package/es/components/DynamicForm/mySelect/index.d.ts +1 -2
- package/es/components/DynamicForm/mySelect/index.js +3 -5
- package/es/components/DynamicForm/useDynamicForm.d.ts +0 -1
- package/es/components/DynamicForm/useDynamicForm.js +10 -13
- package/es/index.js +8 -9
- package/es/utils/method.js +29 -2
- package/lib/components/DynamicForm/func.d.ts +1 -2
- package/lib/components/DynamicForm/func.js +2 -3
- package/lib/components/DynamicForm/index.js +2 -4
- package/lib/components/DynamicForm/myCheckbox/index.d.ts +0 -1
- package/lib/components/DynamicForm/myCheckbox/index.js +3 -5
- package/lib/components/DynamicForm/myRadio/index.d.ts +0 -1
- package/lib/components/DynamicForm/myRadio/index.js +3 -5
- package/lib/components/DynamicForm/mySelect/index.d.ts +1 -2
- package/lib/components/DynamicForm/mySelect/index.js +3 -5
- package/lib/components/DynamicForm/useDynamicForm.d.ts +0 -1
- package/lib/components/DynamicForm/useDynamicForm.js +9 -12
- package/lib/index.js +8 -9
- package/lib/utils/method.js +29 -2
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -16,18 +16,18 @@ dayjs.locale("zh-cn");
|
|
|
16
16
|
const Demo = () => {
|
|
17
17
|
const formRef = react.useRef(null);
|
|
18
18
|
const [form] = antd.Form.useForm();
|
|
19
|
-
const [list, setList] = react.useState(
|
|
20
|
-
const [
|
|
19
|
+
const [list, setList] = react.useState([]);
|
|
20
|
+
const [langId, setLangId] = react.useState("");
|
|
21
21
|
const onValuesChange = async (values, allValues) => {
|
|
22
22
|
};
|
|
23
23
|
react.useEffect(() => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
24
|
+
setList(method.handleAttrList(mock.attrList, { langConfig: mock.langConfig }));
|
|
25
|
+
}, []);
|
|
26
|
+
const onFinish = async (values) => {
|
|
27
|
+
};
|
|
28
28
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { height: "100vh", display: "flex", flexDirection: "column", gap: 20 }, children: [
|
|
29
29
|
/* @__PURE__ */ jsxRuntime.jsx(main.BackHeader, { title: "页头组件", isBack: true }),
|
|
30
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: {}, children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Form, { form, onValuesChange, children: [
|
|
30
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: {}, children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Form, { form, onValuesChange, onFinish, children: [
|
|
31
31
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
32
32
|
main.DynamicForm,
|
|
33
33
|
{
|
|
@@ -42,8 +42,7 @@ const Demo = () => {
|
|
|
42
42
|
commonRequest: services.commonRequest,
|
|
43
43
|
instructionShowMode: "icon",
|
|
44
44
|
ref: formRef,
|
|
45
|
-
langId
|
|
46
|
-
langConfig: langList
|
|
45
|
+
langId
|
|
47
46
|
}
|
|
48
47
|
),
|
|
49
48
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { name: "submit", style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "primary", htmlType: "submit", children: "提交" }) })
|
package/lib/utils/method.js
CHANGED
|
@@ -190,18 +190,45 @@ const processChildren = (items, extraAttrs) => {
|
|
|
190
190
|
processedItem.children = [processChildren(children)];
|
|
191
191
|
}
|
|
192
192
|
if ((processedItem == null ? void 0 : processedItem.children) && Array.isArray((_a = processedItem == null ? void 0 : processedItem.children) == null ? void 0 : _a[0]) && ((_b = processedItem == null ? void 0 : processedItem.children) == null ? void 0 : _b.length)) {
|
|
193
|
-
const list = (_c = processedItem == null ? void 0 : processedItem.children) == null ? void 0 : _c.map(
|
|
193
|
+
const list = (_c = processedItem == null ? void 0 : processedItem.children) == null ? void 0 : _c.map(
|
|
194
|
+
(child) => child == null ? void 0 : child.map((v) => processItem(v, extraAttrs))
|
|
195
|
+
);
|
|
194
196
|
processedItem.children = list;
|
|
195
197
|
}
|
|
196
198
|
return processedItem;
|
|
197
199
|
});
|
|
198
200
|
};
|
|
199
201
|
const processItem = (item, extraAttrs) => {
|
|
202
|
+
var _a, _b;
|
|
200
203
|
if (!item.json && item.info) {
|
|
201
204
|
try {
|
|
202
205
|
const infoStr = item.info_base64 === 1 ? base64ToString(item.info) : item.info;
|
|
203
206
|
const json = getJson(infoStr);
|
|
204
|
-
|
|
207
|
+
const _extraAttrs = _.cloneDeep(extraAttrs) || {};
|
|
208
|
+
const { langConfig } = _extraAttrs || {};
|
|
209
|
+
_extraAttrs == null ? true : delete _extraAttrs.langConfig;
|
|
210
|
+
if ((langConfig == null ? void 0 : langConfig.length) && ((_a = json == null ? void 0 : json.data) == null ? void 0 : _a.length) && (json == null ? void 0 : json.inputType) === "local") {
|
|
211
|
+
json.options = (_b = json.data) == null ? void 0 : _b.map((v) => {
|
|
212
|
+
return {
|
|
213
|
+
label: getTitle(langConfig, v),
|
|
214
|
+
value: v
|
|
215
|
+
};
|
|
216
|
+
});
|
|
217
|
+
json == null ? true : delete json.data;
|
|
218
|
+
}
|
|
219
|
+
if ((langConfig == null ? void 0 : langConfig.length) && (json == null ? void 0 : json["combination-name"])) {
|
|
220
|
+
json["combination-name"] = getTitle(langConfig, json["combination-name"]);
|
|
221
|
+
}
|
|
222
|
+
if ((langConfig == null ? void 0 : langConfig.length) && (json == null ? void 0 : json["default-prompt"])) {
|
|
223
|
+
json["default-prompt"] = getTitle(langConfig, json["default-prompt"]);
|
|
224
|
+
}
|
|
225
|
+
if ((langConfig == null ? void 0 : langConfig.length) && (json == null ? void 0 : json.instruction)) {
|
|
226
|
+
json.instruction = getTitle(langConfig, json.instruction);
|
|
227
|
+
}
|
|
228
|
+
if ((langConfig == null ? void 0 : langConfig.length) && (json == null ? void 0 : json["regexp-message"])) {
|
|
229
|
+
json["regexp-message"] = getTitle(langConfig, json["regexp-message"]);
|
|
230
|
+
}
|
|
231
|
+
return { ...item, json, ..._extraAttrs, info: JSON.stringify(json) };
|
|
205
232
|
} catch (error) {
|
|
206
233
|
return { ...item, json: {}, ...extraAttrs };
|
|
207
234
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "szld-libs",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.53",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"react-router-dom": "^6.6.1",
|
|
24
24
|
"react-vant": "^3.3.5",
|
|
25
25
|
"react-window": "^1.8.9",
|
|
26
|
-
"szld-libs": "^0.3.
|
|
26
|
+
"szld-libs": "^0.3.50"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/crypto-js": "^4.2.1",
|