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
|
@@ -29,7 +29,7 @@ export declare const getTitle: (langConfig: any[], dataID?: string) => any;
|
|
|
29
29
|
* @param param0
|
|
30
30
|
* @returns
|
|
31
31
|
*/
|
|
32
|
-
export declare const handleSelectOptions: ({ commonRequestWidthParams, commonRequest, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, item,
|
|
32
|
+
export declare const handleSelectOptions: ({ commonRequestWidthParams, commonRequest, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, item, }: {
|
|
33
33
|
commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
34
34
|
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
35
35
|
interfaceTypeDict?: string | undefined;
|
|
@@ -37,7 +37,6 @@ export declare const handleSelectOptions: ({ commonRequestWidthParams, commonReq
|
|
|
37
37
|
actionUrlKey?: string | undefined;
|
|
38
38
|
actionUrlExtraParams?: object | undefined;
|
|
39
39
|
item: Ijson;
|
|
40
|
-
langConfig?: any[] | undefined;
|
|
41
40
|
}) => Promise<any[]>;
|
|
42
41
|
/**
|
|
43
42
|
* 单层详情数据对应到单个属性集
|
|
@@ -124,8 +124,7 @@ const handleSelectOptions = async ({
|
|
|
124
124
|
interfaceTypeSysDict = "YLZDSysConfigList",
|
|
125
125
|
actionUrlKey = "action-url",
|
|
126
126
|
actionUrlExtraParams = {},
|
|
127
|
-
item
|
|
128
|
-
langConfig
|
|
127
|
+
item
|
|
129
128
|
}) => {
|
|
130
129
|
var _a;
|
|
131
130
|
let options = [];
|
|
@@ -195,7 +194,7 @@ const handleSelectOptions = async ({
|
|
|
195
194
|
};
|
|
196
195
|
if (item.inputType === "local") {
|
|
197
196
|
options = ((_a = item.data) == null ? void 0 : _a.map((val) => ({
|
|
198
|
-
label:
|
|
197
|
+
label: val,
|
|
199
198
|
value: val
|
|
200
199
|
}))) || [];
|
|
201
200
|
if (item.options && Array.isArray(item.options)) {
|
|
@@ -29,8 +29,7 @@ const DynamicForm = forwardRef((props, ref) => {
|
|
|
29
29
|
formListItemWidth,
|
|
30
30
|
formListItemName,
|
|
31
31
|
isEdit = false,
|
|
32
|
-
langId = "10001"
|
|
33
|
-
langConfig = []
|
|
32
|
+
langId = "10001"
|
|
34
33
|
} = props;
|
|
35
34
|
const delFileListRef = useRef([]);
|
|
36
35
|
const updateDelFileList = (file) => {
|
|
@@ -51,8 +50,7 @@ const DynamicForm = forwardRef((props, ref) => {
|
|
|
51
50
|
CustomModalComponent,
|
|
52
51
|
isEdit,
|
|
53
52
|
formShowType,
|
|
54
|
-
langId
|
|
55
|
-
langConfig
|
|
53
|
+
langId
|
|
56
54
|
});
|
|
57
55
|
useImperativeHandle(ref, () => ({
|
|
58
56
|
getDelFileList: () => {
|
|
@@ -14,7 +14,6 @@ export interface IMYRadio {
|
|
|
14
14
|
interfaceTypeSysDict: string;
|
|
15
15
|
actionUrlKey: string;
|
|
16
16
|
actionUrlExtraParams: object;
|
|
17
|
-
langConfig?: any[];
|
|
18
17
|
}
|
|
19
18
|
declare const MyCheckbox: (props: IMYRadio) => import("react/jsx-runtime").JSX.Element;
|
|
20
19
|
export default MyCheckbox;
|
|
@@ -16,14 +16,13 @@ const MyCheckbox = (props) => {
|
|
|
16
16
|
interfaceTypeDict,
|
|
17
17
|
interfaceTypeSysDict,
|
|
18
18
|
actionUrlKey,
|
|
19
|
-
actionUrlExtraParams
|
|
20
|
-
langConfig
|
|
19
|
+
actionUrlExtraParams
|
|
21
20
|
} = props;
|
|
22
21
|
const [list, setList] = useState([]);
|
|
23
22
|
const [val, setVal] = useState(value || []);
|
|
24
23
|
useEffect(() => {
|
|
25
24
|
handleLoadOptions();
|
|
26
|
-
}, [item.inputType, item.classify, item.data, item.options
|
|
25
|
+
}, [item.inputType, item.classify, item.data, item.options]);
|
|
27
26
|
const handleLoadOptions = async () => {
|
|
28
27
|
const list2 = await handleSelectOptions({
|
|
29
28
|
commonRequestWidthParams,
|
|
@@ -32,8 +31,7 @@ const MyCheckbox = (props) => {
|
|
|
32
31
|
interfaceTypeSysDict,
|
|
33
32
|
actionUrlKey,
|
|
34
33
|
actionUrlExtraParams,
|
|
35
|
-
item
|
|
36
|
-
langConfig: langConfig || []
|
|
34
|
+
item
|
|
37
35
|
});
|
|
38
36
|
setList(list2);
|
|
39
37
|
};
|
|
@@ -15,13 +15,12 @@ const MyRadio = (props) => {
|
|
|
15
15
|
interfaceTypeDict,
|
|
16
16
|
interfaceTypeSysDict,
|
|
17
17
|
actionUrlKey,
|
|
18
|
-
actionUrlExtraParams
|
|
19
|
-
langConfig
|
|
18
|
+
actionUrlExtraParams
|
|
20
19
|
} = props;
|
|
21
20
|
const [list, setList] = useState([]);
|
|
22
21
|
useEffect(() => {
|
|
23
22
|
handleLoadOptions();
|
|
24
|
-
}, [item.inputType, item.classify, item.data, item.options
|
|
23
|
+
}, [item.inputType, item.classify, item.data, item.options]);
|
|
25
24
|
const handleLoadOptions = async () => {
|
|
26
25
|
const list2 = await handleSelectOptions({
|
|
27
26
|
commonRequestWidthParams,
|
|
@@ -30,8 +29,7 @@ const MyRadio = (props) => {
|
|
|
30
29
|
interfaceTypeSysDict,
|
|
31
30
|
actionUrlKey,
|
|
32
31
|
actionUrlExtraParams,
|
|
33
|
-
item
|
|
34
|
-
langConfig
|
|
32
|
+
item
|
|
35
33
|
});
|
|
36
34
|
setList(list2);
|
|
37
35
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ijson } from '../index.d';
|
|
2
2
|
import { AxiosResponse } from 'axios';
|
|
3
|
-
declare const MySelect: ({ item, readonly, style, commonRequestWidthParams, commonRequest, value, onChange, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, langId,
|
|
3
|
+
declare const MySelect: ({ item, readonly, style, commonRequestWidthParams, commonRequest, value, onChange, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, langId, }: {
|
|
4
4
|
item: Ijson;
|
|
5
5
|
readonly?: boolean | undefined;
|
|
6
6
|
style?: any;
|
|
@@ -13,6 +13,5 @@ declare const MySelect: ({ item, readonly, style, commonRequestWidthParams, comm
|
|
|
13
13
|
actionUrlKey: string;
|
|
14
14
|
actionUrlExtraParams: object;
|
|
15
15
|
langId?: string | undefined;
|
|
16
|
-
langConfig?: any[] | undefined;
|
|
17
16
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
18
17
|
export default MySelect;
|
|
@@ -14,14 +14,13 @@ const MySelect = ({
|
|
|
14
14
|
interfaceTypeSysDict,
|
|
15
15
|
actionUrlKey,
|
|
16
16
|
actionUrlExtraParams,
|
|
17
|
-
langId
|
|
18
|
-
langConfig
|
|
17
|
+
langId
|
|
19
18
|
}) => {
|
|
20
19
|
const [options, setOptions] = useState([]);
|
|
21
20
|
const [loading, setLoading] = useState(false);
|
|
22
21
|
useEffect(() => {
|
|
23
22
|
handleLoadOptions();
|
|
24
|
-
}, [item.inputType, item.classify, item.data, item.options
|
|
23
|
+
}, [item.inputType, item.classify, item.data, item.options]);
|
|
25
24
|
const handleLoadOptions = async () => {
|
|
26
25
|
setLoading(true);
|
|
27
26
|
const list = await handleSelectOptions({
|
|
@@ -31,8 +30,7 @@ const MySelect = ({
|
|
|
31
30
|
interfaceTypeSysDict,
|
|
32
31
|
actionUrlKey,
|
|
33
32
|
actionUrlExtraParams,
|
|
34
|
-
item
|
|
35
|
-
langConfig: langConfig || []
|
|
33
|
+
item
|
|
36
34
|
});
|
|
37
35
|
setOptions(list);
|
|
38
36
|
setLoading(false);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
2
2
|
import { MinusSquareOutlined, PlusSquareOutlined, CloseOutlined, InfoCircleOutlined } from "@ant-design/icons";
|
|
3
|
-
import { handleSetFormItemInitialValue,
|
|
3
|
+
import { handleSetFormItemInitialValue, handleGetPlaceholder, disabledDate } from "./func";
|
|
4
4
|
import { handleUrlOptions, getJson, base64ToString } from "../../utils/method";
|
|
5
5
|
import SelectModelBackfillFormItem from "./selectModelBackfillFormItem";
|
|
6
6
|
import { useRef, useEffect, useCallback, Fragment } from "react";
|
|
@@ -30,8 +30,7 @@ function useDynamicForm(props) {
|
|
|
30
30
|
CustomModalComponent,
|
|
31
31
|
isEdit,
|
|
32
32
|
formShowType = "form",
|
|
33
|
-
langId
|
|
34
|
-
langConfig = []
|
|
33
|
+
langId
|
|
35
34
|
} = props;
|
|
36
35
|
const formConfigRef = useRef([]);
|
|
37
36
|
const { message } = App.useApp();
|
|
@@ -139,7 +138,7 @@ function useDynamicForm(props) {
|
|
|
139
138
|
var _a, _b, _c, _d, _e;
|
|
140
139
|
return /* @__PURE__ */ jsxs(Flex, { gap: 10, vertical: instructionShowMode === "flex", align: "center", children: [
|
|
141
140
|
/* @__PURE__ */ jsx("span", { children: itemWithJson.attrname }),
|
|
142
|
-
((_a = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _a.instruction) && instructionShowMode === "icon" && /* @__PURE__ */ jsx(Tooltip, { title:
|
|
141
|
+
((_a = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _a.instruction) && instructionShowMode === "icon" && /* @__PURE__ */ jsx(Tooltip, { title: (_b = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _b.instruction, children: /* @__PURE__ */ jsx(
|
|
143
142
|
InfoCircleOutlined,
|
|
144
143
|
{
|
|
145
144
|
style: {
|
|
@@ -148,7 +147,7 @@ function useDynamicForm(props) {
|
|
|
148
147
|
cursor: "pointer"
|
|
149
148
|
}
|
|
150
149
|
}
|
|
151
|
-
) }) || /* @__PURE__ */ jsx("span", { style: { color: ((_d = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _d["instruction-color"]) ?? "red" }, children:
|
|
150
|
+
) }) || /* @__PURE__ */ jsx("span", { style: { color: ((_d = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _d["instruction-color"]) ?? "red" }, children: (_e = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _e.instruction })
|
|
152
151
|
] });
|
|
153
152
|
};
|
|
154
153
|
const renderNestedFormList = useCallback(
|
|
@@ -295,14 +294,14 @@ function useDynamicForm(props) {
|
|
|
295
294
|
}
|
|
296
295
|
if (itemWithJson.attrtype === 0) {
|
|
297
296
|
const initialValue = handleSetFormItemInitialValue(itemWithJson);
|
|
298
|
-
const message2 =
|
|
297
|
+
const message2 = (_b = itemWithJson.json) == null ? void 0 : _b["default-prompt"];
|
|
299
298
|
const placeholder = handleGetPlaceholder(itemWithJson, langId);
|
|
300
299
|
const { combinations = [] } = itemWithJson.json || {};
|
|
301
300
|
if (combinations == null ? void 0 : combinations.length) {
|
|
302
301
|
return /* @__PURE__ */ jsx(Col, { span: 24 / colNum, children: /* @__PURE__ */ jsx(
|
|
303
302
|
Form.Item,
|
|
304
303
|
{
|
|
305
|
-
label:
|
|
304
|
+
label: (_c = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _c["combination-name"],
|
|
306
305
|
required: (_d = itemWithJson.json) == null ? void 0 : _d.must,
|
|
307
306
|
children: /* @__PURE__ */ jsx(Space.Compact, { children: combinations.map((item, index) => {
|
|
308
307
|
var _a2, _b2, _c2, _d2;
|
|
@@ -337,7 +336,7 @@ function useDynamicForm(props) {
|
|
|
337
336
|
...((_c2 = itemWithJson.json) == null ? void 0 : _c2.regexp) ? [
|
|
338
337
|
{
|
|
339
338
|
pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
|
|
340
|
-
message:
|
|
339
|
+
message: ((_d2 = itemWithJson.json) == null ? void 0 : _d2["regexp-message"]) || `${itemWithJson.attrname}${langId === "10001" ? "格式不正确" : "Format is incorrect"}`
|
|
341
340
|
}
|
|
342
341
|
] : []
|
|
343
342
|
],
|
|
@@ -377,7 +376,7 @@ function useDynamicForm(props) {
|
|
|
377
376
|
...((_f = itemWithJson.json) == null ? void 0 : _f.regexp) ? [
|
|
378
377
|
{
|
|
379
378
|
pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
|
|
380
|
-
message:
|
|
379
|
+
message: ((_g = itemWithJson.json) == null ? void 0 : _g["regexp-message"]) || `${itemWithJson.attrname}${langId === "10001" ? "格式不正确" : "Format is incorrect"}`
|
|
381
380
|
}
|
|
382
381
|
] : []
|
|
383
382
|
],
|
|
@@ -397,7 +396,7 @@ function useDynamicForm(props) {
|
|
|
397
396
|
}
|
|
398
397
|
return null;
|
|
399
398
|
},
|
|
400
|
-
[handleDealInstruction, handleSetFormItemInitialValue, handleSetFormItemProps, renderNestedFormList
|
|
399
|
+
[handleDealInstruction, handleSetFormItemInitialValue, handleSetFormItemProps, renderNestedFormList]
|
|
401
400
|
);
|
|
402
401
|
const handleOnRemove = async (file) => {
|
|
403
402
|
var _a;
|
|
@@ -437,7 +436,7 @@ function useDynamicForm(props) {
|
|
|
437
436
|
const format = ((_a = item.json) == null ? void 0 : _a.format) || "";
|
|
438
437
|
const attrid = item.attrid;
|
|
439
438
|
const formatValue = handleSetFormItemInitialValue(item);
|
|
440
|
-
const message2 =
|
|
439
|
+
const message2 = ((_b = item.json) == null ? void 0 : _b["default-prompt"]) || "";
|
|
441
440
|
const disableDateGoover = ((_c = item.json) == null ? void 0 : _c["disable-date-goover"]) || false;
|
|
442
441
|
const placeholder = handleGetPlaceholder(item, langId);
|
|
443
442
|
const params = item.json.length && {
|
|
@@ -520,7 +519,6 @@ function useDynamicForm(props) {
|
|
|
520
519
|
actionUrlKey,
|
|
521
520
|
actionUrlExtraParams,
|
|
522
521
|
langId,
|
|
523
|
-
langConfig,
|
|
524
522
|
onChange: (val) => {
|
|
525
523
|
form.setFieldValue(item.attrid, val);
|
|
526
524
|
}
|
|
@@ -626,7 +624,6 @@ function useDynamicForm(props) {
|
|
|
626
624
|
interfaceTypeSysDict,
|
|
627
625
|
actionUrlKey,
|
|
628
626
|
actionUrlExtraParams,
|
|
629
|
-
langConfig,
|
|
630
627
|
onChange: (e) => {
|
|
631
628
|
form.setFieldValue(item.attrid, e.target.value);
|
|
632
629
|
}
|
package/es/index.js
CHANGED
|
@@ -15,18 +15,18 @@ dayjs.locale("zh-cn");
|
|
|
15
15
|
const Demo = () => {
|
|
16
16
|
const formRef = useRef(null);
|
|
17
17
|
const [form] = Form.useForm();
|
|
18
|
-
const [list, setList] = useState(
|
|
19
|
-
const [
|
|
18
|
+
const [list, setList] = useState([]);
|
|
19
|
+
const [langId, setLangId] = useState("");
|
|
20
20
|
const onValuesChange = async (values, allValues) => {
|
|
21
21
|
};
|
|
22
22
|
useEffect(() => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
23
|
+
setList(handleAttrList(attrList, { langConfig }));
|
|
24
|
+
}, []);
|
|
25
|
+
const onFinish = async (values) => {
|
|
26
|
+
};
|
|
27
27
|
return /* @__PURE__ */ jsxs("div", { style: { height: "100vh", display: "flex", flexDirection: "column", gap: 20 }, children: [
|
|
28
28
|
/* @__PURE__ */ jsx(BackHeader, { title: "页头组件", isBack: true }),
|
|
29
|
-
/* @__PURE__ */ jsx("div", { style: {}, children: /* @__PURE__ */ jsxs(Form, { form, onValuesChange, children: [
|
|
29
|
+
/* @__PURE__ */ jsx("div", { style: {}, children: /* @__PURE__ */ jsxs(Form, { form, onValuesChange, onFinish, children: [
|
|
30
30
|
/* @__PURE__ */ jsx(
|
|
31
31
|
DynamicForm,
|
|
32
32
|
{
|
|
@@ -41,8 +41,7 @@ const Demo = () => {
|
|
|
41
41
|
commonRequest,
|
|
42
42
|
instructionShowMode: "icon",
|
|
43
43
|
ref: formRef,
|
|
44
|
-
langId
|
|
45
|
-
langConfig: langList
|
|
44
|
+
langId
|
|
46
45
|
}
|
|
47
46
|
),
|
|
48
47
|
/* @__PURE__ */ jsx(Form.Item, { name: "submit", style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx(Button, { type: "primary", htmlType: "submit", children: "提交" }) })
|
package/es/utils/method.js
CHANGED
|
@@ -188,18 +188,45 @@ const processChildren = (items, extraAttrs) => {
|
|
|
188
188
|
processedItem.children = [processChildren(children)];
|
|
189
189
|
}
|
|
190
190
|
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)) {
|
|
191
|
-
const list = (_c = processedItem == null ? void 0 : processedItem.children) == null ? void 0 : _c.map(
|
|
191
|
+
const list = (_c = processedItem == null ? void 0 : processedItem.children) == null ? void 0 : _c.map(
|
|
192
|
+
(child) => child == null ? void 0 : child.map((v) => processItem(v, extraAttrs))
|
|
193
|
+
);
|
|
192
194
|
processedItem.children = list;
|
|
193
195
|
}
|
|
194
196
|
return processedItem;
|
|
195
197
|
});
|
|
196
198
|
};
|
|
197
199
|
const processItem = (item, extraAttrs) => {
|
|
200
|
+
var _a, _b;
|
|
198
201
|
if (!item.json && item.info) {
|
|
199
202
|
try {
|
|
200
203
|
const infoStr = item.info_base64 === 1 ? base64ToString(item.info) : item.info;
|
|
201
204
|
const json = getJson(infoStr);
|
|
202
|
-
|
|
205
|
+
const _extraAttrs = _.cloneDeep(extraAttrs) || {};
|
|
206
|
+
const { langConfig } = _extraAttrs || {};
|
|
207
|
+
_extraAttrs == null ? true : delete _extraAttrs.langConfig;
|
|
208
|
+
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") {
|
|
209
|
+
json.options = (_b = json.data) == null ? void 0 : _b.map((v) => {
|
|
210
|
+
return {
|
|
211
|
+
label: getTitle(langConfig, v),
|
|
212
|
+
value: v
|
|
213
|
+
};
|
|
214
|
+
});
|
|
215
|
+
json == null ? true : delete json.data;
|
|
216
|
+
}
|
|
217
|
+
if ((langConfig == null ? void 0 : langConfig.length) && (json == null ? void 0 : json["combination-name"])) {
|
|
218
|
+
json["combination-name"] = getTitle(langConfig, json["combination-name"]);
|
|
219
|
+
}
|
|
220
|
+
if ((langConfig == null ? void 0 : langConfig.length) && (json == null ? void 0 : json["default-prompt"])) {
|
|
221
|
+
json["default-prompt"] = getTitle(langConfig, json["default-prompt"]);
|
|
222
|
+
}
|
|
223
|
+
if ((langConfig == null ? void 0 : langConfig.length) && (json == null ? void 0 : json.instruction)) {
|
|
224
|
+
json.instruction = getTitle(langConfig, json.instruction);
|
|
225
|
+
}
|
|
226
|
+
if ((langConfig == null ? void 0 : langConfig.length) && (json == null ? void 0 : json["regexp-message"])) {
|
|
227
|
+
json["regexp-message"] = getTitle(langConfig, json["regexp-message"]);
|
|
228
|
+
}
|
|
229
|
+
return { ...item, json, ..._extraAttrs, info: JSON.stringify(json) };
|
|
203
230
|
} catch (error) {
|
|
204
231
|
return { ...item, json: {}, ...extraAttrs };
|
|
205
232
|
}
|
|
@@ -29,7 +29,7 @@ export declare const getTitle: (langConfig: any[], dataID?: string) => any;
|
|
|
29
29
|
* @param param0
|
|
30
30
|
* @returns
|
|
31
31
|
*/
|
|
32
|
-
export declare const handleSelectOptions: ({ commonRequestWidthParams, commonRequest, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, item,
|
|
32
|
+
export declare const handleSelectOptions: ({ commonRequestWidthParams, commonRequest, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, item, }: {
|
|
33
33
|
commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
34
34
|
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
35
35
|
interfaceTypeDict?: string | undefined;
|
|
@@ -37,7 +37,6 @@ export declare const handleSelectOptions: ({ commonRequestWidthParams, commonReq
|
|
|
37
37
|
actionUrlKey?: string | undefined;
|
|
38
38
|
actionUrlExtraParams?: object | undefined;
|
|
39
39
|
item: Ijson;
|
|
40
|
-
langConfig?: any[] | undefined;
|
|
41
40
|
}) => Promise<any[]>;
|
|
42
41
|
/**
|
|
43
42
|
* 单层详情数据对应到单个属性集
|
|
@@ -126,8 +126,7 @@ const handleSelectOptions = async ({
|
|
|
126
126
|
interfaceTypeSysDict = "YLZDSysConfigList",
|
|
127
127
|
actionUrlKey = "action-url",
|
|
128
128
|
actionUrlExtraParams = {},
|
|
129
|
-
item
|
|
130
|
-
langConfig
|
|
129
|
+
item
|
|
131
130
|
}) => {
|
|
132
131
|
var _a;
|
|
133
132
|
let options = [];
|
|
@@ -197,7 +196,7 @@ const handleSelectOptions = async ({
|
|
|
197
196
|
};
|
|
198
197
|
if (item.inputType === "local") {
|
|
199
198
|
options = ((_a = item.data) == null ? void 0 : _a.map((val) => ({
|
|
200
|
-
label:
|
|
199
|
+
label: val,
|
|
201
200
|
value: val
|
|
202
201
|
}))) || [];
|
|
203
202
|
if (item.options && Array.isArray(item.options)) {
|
|
@@ -30,8 +30,7 @@ const DynamicForm = react.forwardRef((props, ref) => {
|
|
|
30
30
|
formListItemWidth,
|
|
31
31
|
formListItemName,
|
|
32
32
|
isEdit = false,
|
|
33
|
-
langId = "10001"
|
|
34
|
-
langConfig = []
|
|
33
|
+
langId = "10001"
|
|
35
34
|
} = props;
|
|
36
35
|
const delFileListRef = react.useRef([]);
|
|
37
36
|
const updateDelFileList = (file) => {
|
|
@@ -52,8 +51,7 @@ const DynamicForm = react.forwardRef((props, ref) => {
|
|
|
52
51
|
CustomModalComponent,
|
|
53
52
|
isEdit,
|
|
54
53
|
formShowType,
|
|
55
|
-
langId
|
|
56
|
-
langConfig
|
|
54
|
+
langId
|
|
57
55
|
});
|
|
58
56
|
react.useImperativeHandle(ref, () => ({
|
|
59
57
|
getDelFileList: () => {
|
|
@@ -14,7 +14,6 @@ export interface IMYRadio {
|
|
|
14
14
|
interfaceTypeSysDict: string;
|
|
15
15
|
actionUrlKey: string;
|
|
16
16
|
actionUrlExtraParams: object;
|
|
17
|
-
langConfig?: any[];
|
|
18
17
|
}
|
|
19
18
|
declare const MyCheckbox: (props: IMYRadio) => import("react/jsx-runtime").JSX.Element;
|
|
20
19
|
export default MyCheckbox;
|
|
@@ -17,14 +17,13 @@ const MyCheckbox = (props) => {
|
|
|
17
17
|
interfaceTypeDict,
|
|
18
18
|
interfaceTypeSysDict,
|
|
19
19
|
actionUrlKey,
|
|
20
|
-
actionUrlExtraParams
|
|
21
|
-
langConfig
|
|
20
|
+
actionUrlExtraParams
|
|
22
21
|
} = props;
|
|
23
22
|
const [list, setList] = react.useState([]);
|
|
24
23
|
const [val, setVal] = react.useState(value || []);
|
|
25
24
|
react.useEffect(() => {
|
|
26
25
|
handleLoadOptions();
|
|
27
|
-
}, [item.inputType, item.classify, item.data, item.options
|
|
26
|
+
}, [item.inputType, item.classify, item.data, item.options]);
|
|
28
27
|
const handleLoadOptions = async () => {
|
|
29
28
|
const list2 = await func.handleSelectOptions({
|
|
30
29
|
commonRequestWidthParams,
|
|
@@ -33,8 +32,7 @@ const MyCheckbox = (props) => {
|
|
|
33
32
|
interfaceTypeSysDict,
|
|
34
33
|
actionUrlKey,
|
|
35
34
|
actionUrlExtraParams,
|
|
36
|
-
item
|
|
37
|
-
langConfig: langConfig || []
|
|
35
|
+
item
|
|
38
36
|
});
|
|
39
37
|
setList(list2);
|
|
40
38
|
};
|
|
@@ -16,13 +16,12 @@ const MyRadio = (props) => {
|
|
|
16
16
|
interfaceTypeDict,
|
|
17
17
|
interfaceTypeSysDict,
|
|
18
18
|
actionUrlKey,
|
|
19
|
-
actionUrlExtraParams
|
|
20
|
-
langConfig
|
|
19
|
+
actionUrlExtraParams
|
|
21
20
|
} = props;
|
|
22
21
|
const [list, setList] = react.useState([]);
|
|
23
22
|
react.useEffect(() => {
|
|
24
23
|
handleLoadOptions();
|
|
25
|
-
}, [item.inputType, item.classify, item.data, item.options
|
|
24
|
+
}, [item.inputType, item.classify, item.data, item.options]);
|
|
26
25
|
const handleLoadOptions = async () => {
|
|
27
26
|
const list2 = await func.handleSelectOptions({
|
|
28
27
|
commonRequestWidthParams,
|
|
@@ -31,8 +30,7 @@ const MyRadio = (props) => {
|
|
|
31
30
|
interfaceTypeSysDict,
|
|
32
31
|
actionUrlKey,
|
|
33
32
|
actionUrlExtraParams,
|
|
34
|
-
item
|
|
35
|
-
langConfig
|
|
33
|
+
item
|
|
36
34
|
});
|
|
37
35
|
setList(list2);
|
|
38
36
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ijson } from '../index.d';
|
|
2
2
|
import { AxiosResponse } from 'axios';
|
|
3
|
-
declare const MySelect: ({ item, readonly, style, commonRequestWidthParams, commonRequest, value, onChange, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, langId,
|
|
3
|
+
declare const MySelect: ({ item, readonly, style, commonRequestWidthParams, commonRequest, value, onChange, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, langId, }: {
|
|
4
4
|
item: Ijson;
|
|
5
5
|
readonly?: boolean | undefined;
|
|
6
6
|
style?: any;
|
|
@@ -13,6 +13,5 @@ declare const MySelect: ({ item, readonly, style, commonRequestWidthParams, comm
|
|
|
13
13
|
actionUrlKey: string;
|
|
14
14
|
actionUrlExtraParams: object;
|
|
15
15
|
langId?: string | undefined;
|
|
16
|
-
langConfig?: any[] | undefined;
|
|
17
16
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
18
17
|
export default MySelect;
|
|
@@ -15,14 +15,13 @@ const MySelect = ({
|
|
|
15
15
|
interfaceTypeSysDict,
|
|
16
16
|
actionUrlKey,
|
|
17
17
|
actionUrlExtraParams,
|
|
18
|
-
langId
|
|
19
|
-
langConfig
|
|
18
|
+
langId
|
|
20
19
|
}) => {
|
|
21
20
|
const [options, setOptions] = react.useState([]);
|
|
22
21
|
const [loading, setLoading] = react.useState(false);
|
|
23
22
|
react.useEffect(() => {
|
|
24
23
|
handleLoadOptions();
|
|
25
|
-
}, [item.inputType, item.classify, item.data, item.options
|
|
24
|
+
}, [item.inputType, item.classify, item.data, item.options]);
|
|
26
25
|
const handleLoadOptions = async () => {
|
|
27
26
|
setLoading(true);
|
|
28
27
|
const list = await func.handleSelectOptions({
|
|
@@ -32,8 +31,7 @@ const MySelect = ({
|
|
|
32
31
|
interfaceTypeSysDict,
|
|
33
32
|
actionUrlKey,
|
|
34
33
|
actionUrlExtraParams,
|
|
35
|
-
item
|
|
36
|
-
langConfig: langConfig || []
|
|
34
|
+
item
|
|
37
35
|
});
|
|
38
36
|
setOptions(list);
|
|
39
37
|
setLoading(false);
|
|
@@ -31,8 +31,7 @@ function useDynamicForm(props) {
|
|
|
31
31
|
CustomModalComponent,
|
|
32
32
|
isEdit,
|
|
33
33
|
formShowType = "form",
|
|
34
|
-
langId
|
|
35
|
-
langConfig = []
|
|
34
|
+
langId
|
|
36
35
|
} = props;
|
|
37
36
|
const formConfigRef = react.useRef([]);
|
|
38
37
|
const { message } = antd.App.useApp();
|
|
@@ -140,7 +139,7 @@ function useDynamicForm(props) {
|
|
|
140
139
|
var _a, _b, _c, _d, _e;
|
|
141
140
|
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 10, vertical: instructionShowMode === "flex", align: "center", children: [
|
|
142
141
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: itemWithJson.attrname }),
|
|
143
|
-
((_a = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _a.instruction) && instructionShowMode === "icon" && /* @__PURE__ */ jsxRuntime.jsx(antd.Tooltip, { title:
|
|
142
|
+
((_a = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _a.instruction) && instructionShowMode === "icon" && /* @__PURE__ */ jsxRuntime.jsx(antd.Tooltip, { title: (_b = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _b.instruction, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
144
143
|
icons.InfoCircleOutlined,
|
|
145
144
|
{
|
|
146
145
|
style: {
|
|
@@ -149,7 +148,7 @@ function useDynamicForm(props) {
|
|
|
149
148
|
cursor: "pointer"
|
|
150
149
|
}
|
|
151
150
|
}
|
|
152
|
-
) }) || /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: ((_d = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _d["instruction-color"]) ?? "red" }, children:
|
|
151
|
+
) }) || /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: ((_d = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _d["instruction-color"]) ?? "red" }, children: (_e = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _e.instruction })
|
|
153
152
|
] });
|
|
154
153
|
};
|
|
155
154
|
const renderNestedFormList = react.useCallback(
|
|
@@ -296,14 +295,14 @@ function useDynamicForm(props) {
|
|
|
296
295
|
}
|
|
297
296
|
if (itemWithJson.attrtype === 0) {
|
|
298
297
|
const initialValue = func.handleSetFormItemInitialValue(itemWithJson);
|
|
299
|
-
const message2 =
|
|
298
|
+
const message2 = (_b = itemWithJson.json) == null ? void 0 : _b["default-prompt"];
|
|
300
299
|
const placeholder = func.handleGetPlaceholder(itemWithJson, langId);
|
|
301
300
|
const { combinations = [] } = itemWithJson.json || {};
|
|
302
301
|
if (combinations == null ? void 0 : combinations.length) {
|
|
303
302
|
return /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 24 / colNum, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
304
303
|
antd.Form.Item,
|
|
305
304
|
{
|
|
306
|
-
label:
|
|
305
|
+
label: (_c = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _c["combination-name"],
|
|
307
306
|
required: (_d = itemWithJson.json) == null ? void 0 : _d.must,
|
|
308
307
|
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Space.Compact, { children: combinations.map((item, index) => {
|
|
309
308
|
var _a2, _b2, _c2, _d2;
|
|
@@ -338,7 +337,7 @@ function useDynamicForm(props) {
|
|
|
338
337
|
...((_c2 = itemWithJson.json) == null ? void 0 : _c2.regexp) ? [
|
|
339
338
|
{
|
|
340
339
|
pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
|
|
341
|
-
message:
|
|
340
|
+
message: ((_d2 = itemWithJson.json) == null ? void 0 : _d2["regexp-message"]) || `${itemWithJson.attrname}${langId === "10001" ? "格式不正确" : "Format is incorrect"}`
|
|
342
341
|
}
|
|
343
342
|
] : []
|
|
344
343
|
],
|
|
@@ -378,7 +377,7 @@ function useDynamicForm(props) {
|
|
|
378
377
|
...((_f = itemWithJson.json) == null ? void 0 : _f.regexp) ? [
|
|
379
378
|
{
|
|
380
379
|
pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
|
|
381
|
-
message:
|
|
380
|
+
message: ((_g = itemWithJson.json) == null ? void 0 : _g["regexp-message"]) || `${itemWithJson.attrname}${langId === "10001" ? "格式不正确" : "Format is incorrect"}`
|
|
382
381
|
}
|
|
383
382
|
] : []
|
|
384
383
|
],
|
|
@@ -398,7 +397,7 @@ function useDynamicForm(props) {
|
|
|
398
397
|
}
|
|
399
398
|
return null;
|
|
400
399
|
},
|
|
401
|
-
[handleDealInstruction, func.handleSetFormItemInitialValue, handleSetFormItemProps, renderNestedFormList
|
|
400
|
+
[handleDealInstruction, func.handleSetFormItemInitialValue, handleSetFormItemProps, renderNestedFormList]
|
|
402
401
|
);
|
|
403
402
|
const handleOnRemove = async (file) => {
|
|
404
403
|
var _a;
|
|
@@ -438,7 +437,7 @@ function useDynamicForm(props) {
|
|
|
438
437
|
const format = ((_a = item.json) == null ? void 0 : _a.format) || "";
|
|
439
438
|
const attrid = item.attrid;
|
|
440
439
|
const formatValue = func.handleSetFormItemInitialValue(item);
|
|
441
|
-
const message2 =
|
|
440
|
+
const message2 = ((_b = item.json) == null ? void 0 : _b["default-prompt"]) || "";
|
|
442
441
|
const disableDateGoover = ((_c = item.json) == null ? void 0 : _c["disable-date-goover"]) || false;
|
|
443
442
|
const placeholder = func.handleGetPlaceholder(item, langId);
|
|
444
443
|
const params = item.json.length && {
|
|
@@ -521,7 +520,6 @@ function useDynamicForm(props) {
|
|
|
521
520
|
actionUrlKey,
|
|
522
521
|
actionUrlExtraParams,
|
|
523
522
|
langId,
|
|
524
|
-
langConfig,
|
|
525
523
|
onChange: (val) => {
|
|
526
524
|
form.setFieldValue(item.attrid, val);
|
|
527
525
|
}
|
|
@@ -627,7 +625,6 @@ function useDynamicForm(props) {
|
|
|
627
625
|
interfaceTypeSysDict,
|
|
628
626
|
actionUrlKey,
|
|
629
627
|
actionUrlExtraParams,
|
|
630
|
-
langConfig,
|
|
631
628
|
onChange: (e) => {
|
|
632
629
|
form.setFieldValue(item.attrid, e.target.value);
|
|
633
630
|
}
|