szld-libs 0.3.23 → 0.3.26
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 +14042 -14328
- package/dist/szld-components.umd.js +54 -54
- package/es/components/DynamicForm/func.d.ts +1 -11
- package/es/components/DynamicForm/func.js +0 -90
- package/es/components/DynamicForm/index.d.ts +1 -0
- package/es/components/DynamicForm/mySelect/index.js +2 -1
- package/es/components/DynamicForm/useDynamicForm.js +7 -5
- package/es/components/DynamicFormMobile/func.d.ts +1 -11
- package/es/components/DynamicFormMobile/func.js +0 -90
- package/es/components/DynamicFormMobile/index.d.ts +1 -0
- package/es/components/DynamicFormMobile/mySelect/index.js +1 -1
- package/es/hooks/useDetailRender.js +1 -1
- package/es/hooks/useUniversalTable.d.ts +1 -1
- package/es/index.css +1 -1
- package/es/mock/index.js +3 -2
- package/es/utils/method.js +9 -4
- package/lib/components/DynamicForm/func.d.ts +1 -11
- package/lib/components/DynamicForm/func.js +0 -90
- package/lib/components/DynamicForm/index.d.ts +1 -0
- package/lib/components/DynamicForm/mySelect/index.js +2 -1
- package/lib/components/DynamicForm/useDynamicForm.js +7 -5
- package/lib/components/DynamicFormMobile/func.d.ts +1 -11
- package/lib/components/DynamicFormMobile/func.js +0 -90
- package/lib/components/DynamicFormMobile/index.d.ts +1 -0
- package/lib/components/DynamicFormMobile/mySelect/index.js +2 -2
- package/lib/hooks/useDetailRender.js +1 -1
- package/lib/hooks/useUniversalTable.d.ts +1 -1
- package/lib/index.css +1 -1
- package/lib/mock/index.js +3 -2
- package/lib/utils/method.js +9 -4
- package/package.json +2 -2
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const dayjs = require("dayjs");
|
|
4
|
-
const antd = require("antd");
|
|
5
4
|
const handleGetPlaceholder = (itemWithJson, langId) => {
|
|
6
5
|
const { input = "" } = (itemWithJson == null ? void 0 : itemWithJson.json) || {};
|
|
7
6
|
let placeholderCn = "请输入", placeholderEn = "Please input";
|
|
@@ -95,94 +94,6 @@ const handleUrlOptions = (val, delimiter, list) => {
|
|
|
95
94
|
});
|
|
96
95
|
return arr.join(delimiter || "-");
|
|
97
96
|
};
|
|
98
|
-
const handleSelectOptions = async ({
|
|
99
|
-
commonRequestWidthParams,
|
|
100
|
-
commonRequest,
|
|
101
|
-
interfaceTypeDict = "YLZDDictList",
|
|
102
|
-
interfaceTypeSysDict = "YLZDSysConfigList",
|
|
103
|
-
actionUrlKey = "action-url",
|
|
104
|
-
actionUrlExtraParams = {},
|
|
105
|
-
item
|
|
106
|
-
}) => {
|
|
107
|
-
var _a;
|
|
108
|
-
let options = [];
|
|
109
|
-
const getDict = async (interfaceType) => {
|
|
110
|
-
var _a2;
|
|
111
|
-
let list = [];
|
|
112
|
-
if (item.classify) {
|
|
113
|
-
try {
|
|
114
|
-
const response = await commonRequest(interfaceType, {
|
|
115
|
-
asctypeid: item.classify
|
|
116
|
-
});
|
|
117
|
-
if (((_a2 = response == null ? void 0 : response.data) == null ? void 0 : _a2.list) && Array.isArray(response.data.list)) {
|
|
118
|
-
list = response.data.list.map((dictItem) => ({
|
|
119
|
-
label: `${dictItem.dicid || ""}-${dictItem.info || ""}`,
|
|
120
|
-
value: `${dictItem.dicid || ""}-${dictItem.info || ""}`
|
|
121
|
-
}));
|
|
122
|
-
}
|
|
123
|
-
} catch (error) {
|
|
124
|
-
antd.message.error("加载选项失败");
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return list;
|
|
128
|
-
};
|
|
129
|
-
const getUrlOptions = async () => {
|
|
130
|
-
var _a2, _b;
|
|
131
|
-
try {
|
|
132
|
-
const keyFieldList = ((_a2 = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a2.list) || [];
|
|
133
|
-
const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "";
|
|
134
|
-
if (!keyFieldList.length) {
|
|
135
|
-
antd.message.error("请配置key-field");
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
const response = await commonRequestWidthParams(
|
|
139
|
-
{
|
|
140
|
-
PageName: "dns_relay",
|
|
141
|
-
Controlname: "CallActionUrl",
|
|
142
|
-
InterfaceType: ""
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
[actionUrlKey]: item == null ? void 0 : item["action-url"],
|
|
146
|
-
...actionUrlExtraParams
|
|
147
|
-
}
|
|
148
|
-
);
|
|
149
|
-
if (response == null ? void 0 : response.data) {
|
|
150
|
-
const data = response == null ? void 0 : response.data;
|
|
151
|
-
const list = (data == null ? void 0 : data.list) || [];
|
|
152
|
-
let urlData = [];
|
|
153
|
-
if (Array.isArray(data)) {
|
|
154
|
-
urlData = data;
|
|
155
|
-
}
|
|
156
|
-
if (Array.isArray(list)) {
|
|
157
|
-
urlData = list;
|
|
158
|
-
}
|
|
159
|
-
options = urlData.map((val) => ({
|
|
160
|
-
label: handleUrlOptions(val, delimiter, keyFieldList),
|
|
161
|
-
value: handleUrlOptions(val, delimiter, keyFieldList)
|
|
162
|
-
}));
|
|
163
|
-
}
|
|
164
|
-
} catch (error) {
|
|
165
|
-
antd.message.error("加载选项失败");
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
if (item.inputType === "local") {
|
|
169
|
-
options = ((_a = item.data) == null ? void 0 : _a.map((val) => ({
|
|
170
|
-
label: val,
|
|
171
|
-
value: val
|
|
172
|
-
}))) || [];
|
|
173
|
-
if (item.options && Array.isArray(item.options)) {
|
|
174
|
-
options = item.options;
|
|
175
|
-
}
|
|
176
|
-
} else if (item.inputType === "dictionary") {
|
|
177
|
-
options = await getDict(interfaceTypeDict);
|
|
178
|
-
} else if (item.inputType === "system-dictionary") {
|
|
179
|
-
options = await getDict(interfaceTypeSysDict);
|
|
180
|
-
}
|
|
181
|
-
if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
|
|
182
|
-
await getUrlOptions();
|
|
183
|
-
}
|
|
184
|
-
return options;
|
|
185
|
-
};
|
|
186
97
|
const handleGetSingleAttrListObj = (children) => {
|
|
187
98
|
if (!(children == null ? void 0 : children.length)) {
|
|
188
99
|
return [];
|
|
@@ -206,6 +117,5 @@ const handleGetSingleAttrListObj = (children) => {
|
|
|
206
117
|
exports.disabledDate = disabledDate;
|
|
207
118
|
exports.handleGetPlaceholder = handleGetPlaceholder;
|
|
208
119
|
exports.handleGetSingleAttrListObj = handleGetSingleAttrListObj;
|
|
209
|
-
exports.handleSelectOptions = handleSelectOptions;
|
|
210
120
|
exports.handleSetFormItemInitialValue = handleSetFormItemInitialValue;
|
|
211
121
|
exports.handleUrlOptions = handleUrlOptions;
|
|
@@ -18,6 +18,7 @@ export interface IformConfigItem {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export interface Ijson {
|
|
21
|
+
'field-names'?: string; // 级联选择的自定义字段名
|
|
21
22
|
'search-field'?: any; // 是否搜索字段
|
|
22
23
|
'action-url-extra-params'?: { [key: string]: any }; // 弹窗选择对应多个表单字段时,额外的参数
|
|
23
24
|
'disable-date-goover'?: boolean; // 禁用日期选择器超出当前日期
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
3
|
const reactVant = require("react-vant");
|
|
4
|
-
const
|
|
4
|
+
const method = require("../../../utils/method");
|
|
5
5
|
const react = require("react");
|
|
6
6
|
const antd = require("antd");
|
|
7
7
|
const checkboxGroup = "index-module_checkbox-group_4684b";
|
|
@@ -46,7 +46,7 @@ const MySelect = ({
|
|
|
46
46
|
handleLoadOptions();
|
|
47
47
|
}, [item.inputType, item.classify, item.data, item.options]);
|
|
48
48
|
const handleLoadOptions = async () => {
|
|
49
|
-
const list = await
|
|
49
|
+
const list = await method.handleSelectOptions({
|
|
50
50
|
commonRequestWidthParams,
|
|
51
51
|
commonRequest,
|
|
52
52
|
interfaceTypeDict,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
-
const method = require("szld-libs/lib/utils/method");
|
|
4
3
|
const antd = require("antd");
|
|
5
4
|
const szxkFunc = require("../utils/szxkFunc");
|
|
5
|
+
const method = require("../utils/method");
|
|
6
6
|
const ahooks = require("ahooks");
|
|
7
7
|
const react = require("react");
|
|
8
8
|
function useDetailRender({
|
|
@@ -23,7 +23,7 @@ declare function useUniversalTable(): {
|
|
|
23
23
|
searchText?: string | undefined;
|
|
24
24
|
resetText?: string | undefined;
|
|
25
25
|
}) => Promise<{
|
|
26
|
-
formItems:
|
|
26
|
+
formItems: CreateFormProps;
|
|
27
27
|
selList: any[];
|
|
28
28
|
}>;
|
|
29
29
|
handleUniversalDelete: ({ commonRequest, refresh, interfaceType, record, configData, }: {
|
package/lib/index.css
CHANGED
package/lib/mock/index.js
CHANGED
|
@@ -55,7 +55,7 @@ const attrList = [
|
|
|
55
55
|
attrid: "7BB9BE8A96824CCF89B721C8F1AF9F38",
|
|
56
56
|
attrname: "Feeding Time",
|
|
57
57
|
attrtype: 0,
|
|
58
|
-
info: '{"input":"second-picker"
|
|
58
|
+
info: '{\r\n "input": "second-picker",\r\n "dataType": "string",\r\n "length": 200,\r\n "input-width": 240,\r\n "format": "HH:mm"\r\n}',
|
|
59
59
|
info_base64: 0,
|
|
60
60
|
createtime: "2026-02-11 15:12:26",
|
|
61
61
|
attrvalue: "",
|
|
@@ -65,7 +65,8 @@ const attrList = [
|
|
|
65
65
|
input: "second-picker",
|
|
66
66
|
dataType: "string",
|
|
67
67
|
length: 200,
|
|
68
|
-
"input-width": 240
|
|
68
|
+
"input-width": 240,
|
|
69
|
+
format: "HH:mm"
|
|
69
70
|
}
|
|
70
71
|
},
|
|
71
72
|
{
|
package/lib/utils/method.js
CHANGED
|
@@ -479,6 +479,7 @@ const handleSelectOptions = async ({
|
|
|
479
479
|
try {
|
|
480
480
|
const keyFieldList = ((_a2 = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a2.list) || [];
|
|
481
481
|
const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "";
|
|
482
|
+
const fileNames = item == null ? void 0 : item["field-names"];
|
|
482
483
|
if (!keyFieldList.length) {
|
|
483
484
|
antd.message.error("请配置key-field");
|
|
484
485
|
return;
|
|
@@ -504,10 +505,14 @@ const handleSelectOptions = async ({
|
|
|
504
505
|
if (Array.isArray(list)) {
|
|
505
506
|
urlData = list;
|
|
506
507
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
508
|
+
if (fileNames) {
|
|
509
|
+
options = urlData;
|
|
510
|
+
} else {
|
|
511
|
+
options = urlData.map((val) => ({
|
|
512
|
+
label: handleUrlOptions(val, delimiter, keyFieldList),
|
|
513
|
+
value: handleUrlOptions(val, delimiter, keyFieldList)
|
|
514
|
+
}));
|
|
515
|
+
}
|
|
511
516
|
}
|
|
512
517
|
} catch (error) {
|
|
513
518
|
antd.message.error("加载选项失败");
|
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.26",
|
|
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.
|
|
26
|
+
"szld-libs": "^0.3.24"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/crypto-js": "^4.2.1",
|