szld-libs 0.2.57 → 0.2.59

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.
Files changed (41) hide show
  1. package/dist/szld-components.es.js +10970 -10824
  2. package/dist/szld-components.umd.js +48 -48
  3. package/es/components/DynamicForm/index.js +10 -2
  4. package/es/components/DynamicForm/myCascader/index.d.ts +4 -1
  5. package/es/components/DynamicForm/myCascader/index.js +7 -3
  6. package/es/components/DynamicForm/myCheckbox/index.d.ts +3 -0
  7. package/es/components/DynamicForm/myCheckbox/index.js +7 -3
  8. package/es/components/DynamicForm/myRadio/index.d.ts +3 -0
  9. package/es/components/DynamicForm/myRadio/index.js +7 -3
  10. package/es/components/DynamicForm/mySelect/index.d.ts +4 -1
  11. package/es/components/DynamicForm/mySelect/index.js +7 -3
  12. package/es/components/DynamicForm/myUpload/index.d.ts +1 -0
  13. package/es/components/DynamicForm/myUpload/index.js +3 -2
  14. package/es/components/DynamicForm/useDynamicForm.d.ts +5 -1
  15. package/es/components/DynamicForm/useDynamicForm.js +19 -2
  16. package/es/hooks/useDetailRender.d.ts +19 -0
  17. package/es/hooks/useDetailRender.js +125 -0
  18. package/es/main.d.ts +2 -1
  19. package/es/main.js +2 -0
  20. package/es/utils/method.d.ts +24 -1
  21. package/es/utils/method.js +20 -9
  22. package/lib/components/DynamicForm/index.js +10 -2
  23. package/lib/components/DynamicForm/myCascader/index.d.ts +4 -1
  24. package/lib/components/DynamicForm/myCascader/index.js +7 -3
  25. package/lib/components/DynamicForm/myCheckbox/index.d.ts +3 -0
  26. package/lib/components/DynamicForm/myCheckbox/index.js +7 -3
  27. package/lib/components/DynamicForm/myRadio/index.d.ts +3 -0
  28. package/lib/components/DynamicForm/myRadio/index.js +7 -3
  29. package/lib/components/DynamicForm/mySelect/index.d.ts +4 -1
  30. package/lib/components/DynamicForm/mySelect/index.js +7 -3
  31. package/lib/components/DynamicForm/myUpload/index.d.ts +1 -0
  32. package/lib/components/DynamicForm/myUpload/index.js +3 -2
  33. package/lib/components/DynamicForm/useDynamicForm.d.ts +5 -1
  34. package/lib/components/DynamicForm/useDynamicForm.js +19 -2
  35. package/lib/hooks/useDetailRender.d.ts +19 -0
  36. package/lib/hooks/useDetailRender.js +124 -0
  37. package/lib/main.d.ts +2 -1
  38. package/lib/main.js +2 -0
  39. package/lib/utils/method.d.ts +24 -1
  40. package/lib/utils/method.js +20 -9
  41. package/package.json +1 -1
@@ -18,7 +18,11 @@ const DynamicForm = forwardRef((props, ref) => {
18
18
  commonRequest,
19
19
  formItemStyle = [],
20
20
  radioAlign = "horizontal",
21
- interfaceTypeChildren = "YLLRDetailAttrlist"
21
+ interfaceTypeChildren = "YLLRDetailAttrlist",
22
+ interfaceTypeDict = "YLZDDictList",
23
+ relatedidKey = "relatedid",
24
+ actionUrlKey = "action-url",
25
+ actionUrlExtraParams = {}
22
26
  } = props;
23
27
  const delFileListRef = useRef([]);
24
28
  const updateDelFileList = (file) => {
@@ -31,7 +35,11 @@ const DynamicForm = forwardRef((props, ref) => {
31
35
  setFormConfig,
32
36
  updateDelFileList,
33
37
  formConfig,
34
- interfaceTypeChildren
38
+ interfaceTypeChildren,
39
+ interfaceTypeDict,
40
+ relatedidKey,
41
+ actionUrlKey,
42
+ actionUrlExtraParams
35
43
  });
36
44
  useImperativeHandle(ref, () => ({
37
45
  getDelFileList: () => {
@@ -8,6 +8,9 @@ interface MyCascaderProps {
8
8
  style?: React.CSSProperties;
9
9
  commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
10
10
  commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
11
+ interfaceTypeDict: string;
12
+ actionUrlKey: string;
13
+ actionUrlExtraParams: object;
11
14
  }
12
- declare const MyCascader: ({ item, readonly, value, onChange, style, commonRequestWidthParams, commonRequest, }: MyCascaderProps) => import("react/jsx-runtime").JSX.Element;
15
+ declare const MyCascader: ({ item, readonly, value, onChange, style, commonRequestWidthParams, commonRequest, interfaceTypeDict, actionUrlKey, actionUrlExtraParams, }: MyCascaderProps) => import("react/jsx-runtime").JSX.Element;
13
16
  export default MyCascader;
@@ -8,7 +8,10 @@ const MyCascader = ({
8
8
  onChange,
9
9
  style,
10
10
  commonRequestWidthParams,
11
- commonRequest
11
+ commonRequest,
12
+ interfaceTypeDict,
13
+ actionUrlKey,
14
+ actionUrlExtraParams
12
15
  }) => {
13
16
  const [options, setOptions] = useState([]);
14
17
  const [loading, setLoading] = useState(false);
@@ -33,7 +36,7 @@ const MyCascader = ({
33
36
  if (item.classify) {
34
37
  setLoading(true);
35
38
  try {
36
- const response = await commonRequest("YLZDDictList", {
39
+ const response = await commonRequest(interfaceTypeDict, {
37
40
  asctypeid: item.classify
38
41
  });
39
42
  if (((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.list) && Array.isArray(response.data.list)) {
@@ -83,7 +86,8 @@ const MyCascader = ({
83
86
  return;
84
87
  }
85
88
  const params = {
86
- "action-url": item == null ? void 0 : item["action-url"]
89
+ [actionUrlKey]: item == null ? void 0 : item["action-url"],
90
+ ...actionUrlExtraParams
87
91
  };
88
92
  if (targetOption) {
89
93
  searchFields.forEach((field) => {
@@ -10,6 +10,9 @@ export interface IMYRadio {
10
10
  handleUrlOptions: (val: any, delimiter: string, list: any[]) => string;
11
11
  commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
12
12
  commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
13
+ interfaceTypeDict: string;
14
+ actionUrlKey: string;
15
+ actionUrlExtraParams: object;
13
16
  }
14
17
  declare const MyCheckbox: (props: IMYRadio) => import("react/jsx-runtime").JSX.Element;
15
18
  export default MyCheckbox;
@@ -11,7 +11,10 @@ const MyCheckbox = (props) => {
11
11
  commonRequestWidthParams,
12
12
  commonRequest,
13
13
  handleUrlOptions,
14
- value
14
+ value,
15
+ interfaceTypeDict,
16
+ actionUrlKey,
17
+ actionUrlExtraParams
15
18
  } = props;
16
19
  const { message } = App.useApp();
17
20
  const [list, setList] = useState([]);
@@ -31,7 +34,7 @@ const MyCheckbox = (props) => {
31
34
  if (!id) {
32
35
  return;
33
36
  }
34
- const res = await commonRequest("YLZDDictList", { asctypeid: id });
37
+ const res = await commonRequest(interfaceTypeDict, { asctypeid: id });
35
38
  if ((res == null ? void 0 : res.ReturnValue) === 1) {
36
39
  const arr = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
37
40
  setList(
@@ -58,7 +61,8 @@ const MyCheckbox = (props) => {
58
61
  InterfaceType: ""
59
62
  },
60
63
  {
61
- "action-url": item == null ? void 0 : item["action-url"]
64
+ [actionUrlKey]: item == null ? void 0 : item["action-url"],
65
+ ...actionUrlExtraParams
62
66
  }
63
67
  );
64
68
  if (response == null ? void 0 : response.data) {
@@ -11,6 +11,9 @@ export interface IMYRadio {
11
11
  handleUrlOptions: (val: any, delimiter: string, list: any[]) => string;
12
12
  commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
13
13
  commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
14
+ interfaceTypeDict: string;
15
+ actionUrlKey: string;
16
+ actionUrlExtraParams: object;
14
17
  }
15
18
  declare const MyRadio: (props: IMYRadio) => import("react/jsx-runtime").JSX.Element;
16
19
  export default MyRadio;
@@ -11,7 +11,10 @@ const MyRadio = (props) => {
11
11
  commonRequestWidthParams,
12
12
  commonRequest,
13
13
  handleUrlOptions,
14
- value
14
+ value,
15
+ interfaceTypeDict,
16
+ actionUrlKey,
17
+ actionUrlExtraParams
15
18
  } = props;
16
19
  const { message } = App.useApp();
17
20
  const [list, setList] = useState([]);
@@ -30,7 +33,7 @@ const MyRadio = (props) => {
30
33
  if (!id) {
31
34
  return;
32
35
  }
33
- const res = await commonRequest("YLZDDictList", { asctypeid: id });
36
+ const res = await commonRequest(interfaceTypeDict, { asctypeid: id });
34
37
  if ((res == null ? void 0 : res.ReturnValue) === 1) {
35
38
  const arr = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
36
39
  setList(
@@ -59,7 +62,8 @@ const MyRadio = (props) => {
59
62
  InterfaceType: ""
60
63
  },
61
64
  {
62
- "action-url": item == null ? void 0 : item["action-url"]
65
+ [actionUrlKey]: item == null ? void 0 : item["action-url"],
66
+ ...actionUrlExtraParams
63
67
  }
64
68
  );
65
69
  if (response == null ? void 0 : response.data) {
@@ -1,6 +1,6 @@
1
1
  import { Ijson } from '../index.d';
2
2
  import { AxiosResponse } from 'axios';
3
- declare const MySelect: ({ item, readonly, style, handleUrlOptions, commonRequestWidthParams, commonRequest, value, onChange, }: {
3
+ declare const MySelect: ({ item, readonly, style, handleUrlOptions, commonRequestWidthParams, commonRequest, value, onChange, interfaceTypeDict, actionUrlKey, actionUrlExtraParams, }: {
4
4
  item: Ijson;
5
5
  readonly?: boolean | undefined;
6
6
  style?: any;
@@ -9,5 +9,8 @@ declare const MySelect: ({ item, readonly, style, handleUrlOptions, commonReques
9
9
  commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
10
10
  value: string | number | (string | number)[];
11
11
  onChange: (val: string | number | (string | number)[]) => void;
12
+ interfaceTypeDict: string;
13
+ actionUrlKey: string;
14
+ actionUrlExtraParams: object;
12
15
  }) => import("react/jsx-runtime").JSX.Element;
13
16
  export default MySelect;
@@ -9,7 +9,10 @@ const MySelect = ({
9
9
  commonRequestWidthParams,
10
10
  commonRequest,
11
11
  value,
12
- onChange
12
+ onChange,
13
+ interfaceTypeDict,
14
+ actionUrlKey,
15
+ actionUrlExtraParams
13
16
  }) => {
14
17
  const { message } = App.useApp();
15
18
  const [options, setOptions] = useState([]);
@@ -34,7 +37,7 @@ const MySelect = ({
34
37
  if (item.classify) {
35
38
  setLoading(true);
36
39
  try {
37
- const response = await commonRequest("YLZDDictList", {
40
+ const response = await commonRequest(interfaceTypeDict, {
38
41
  asctypeid: item.classify
39
42
  });
40
43
  if (((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.list) && Array.isArray(response.data.list)) {
@@ -65,7 +68,8 @@ const MySelect = ({
65
68
  InterfaceType: ""
66
69
  },
67
70
  {
68
- "action-url": item == null ? void 0 : item["action-url"]
71
+ [actionUrlKey]: item == null ? void 0 : item["action-url"],
72
+ ...actionUrlExtraParams
69
73
  }
70
74
  );
71
75
  if (response == null ? void 0 : response.data) {
@@ -10,6 +10,7 @@ interface IMYUpload {
10
10
  list?: UploadFile[];
11
11
  uploadText?: string;
12
12
  uploadType?: string;
13
+ relatedidKey: string;
13
14
  }
14
15
  declare const MyUpload: (props: IMYUpload) => import("react/jsx-runtime").JSX.Element;
15
16
  export default MyUpload;
@@ -22,7 +22,8 @@ const MyUpload = (props) => {
22
22
  uploadText = "上传文件",
23
23
  onRemove,
24
24
  list = [],
25
- uploadType
25
+ uploadType,
26
+ relatedidKey
26
27
  } = props;
27
28
  const { message } = App.useApp();
28
29
  const accept = (item == null ? void 0 : item["upload-accept"]) || "*";
@@ -74,7 +75,7 @@ const MyUpload = (props) => {
74
75
  accept,
75
76
  fileList,
76
77
  onPreview: handlePreview,
77
- data: { relatedid },
78
+ data: { [relatedidKey]: relatedid },
78
79
  maxCount,
79
80
  onChange: handleChange,
80
81
  onRemove,
@@ -7,8 +7,12 @@ interface IDynamicFormProps {
7
7
  uploadAction: (PageName?: string | undefined) => string;
8
8
  formConfig?: IformConfigItem[];
9
9
  setFormConfig?: (config: IformConfigItem[]) => void;
10
- interfaceTypeChildren?: string;
11
10
  updateDelFileList: (file: UploadFile) => void;
11
+ interfaceTypeChildren?: string;
12
+ interfaceTypeDict: string;
13
+ relatedidKey: string;
14
+ actionUrlKey: string;
15
+ actionUrlExtraParams: object;
12
16
  }
13
17
  declare function useDynamicForm(props: IDynamicFormProps): {
14
18
  handleRenderItem: ({ item, readonly, colNum, instructionShowMode, relatedid, form, defaultWidth, formItemStyle, radioAlign, }: {
@@ -21,8 +21,12 @@ function useDynamicForm(props) {
21
21
  commonRequest,
22
22
  formConfig,
23
23
  setFormConfig,
24
+ updateDelFileList,
24
25
  interfaceTypeChildren,
25
- updateDelFileList
26
+ interfaceTypeDict,
27
+ relatedidKey,
28
+ actionUrlKey,
29
+ actionUrlExtraParams
26
30
  } = props;
27
31
  const formConfigRef = useRef([]);
28
32
  const { message } = App.useApp();
@@ -377,6 +381,9 @@ function useDynamicForm(props) {
377
381
  commonRequestWidthParams,
378
382
  commonRequest,
379
383
  value: formatValue,
384
+ interfaceTypeDict,
385
+ actionUrlKey,
386
+ actionUrlExtraParams,
380
387
  onChange: (val) => {
381
388
  form.setFieldValue(item.attrid, val);
382
389
  }
@@ -439,6 +446,9 @@ function useDynamicForm(props) {
439
446
  options: params,
440
447
  handleUrlOptions,
441
448
  value: formatValue,
449
+ interfaceTypeDict,
450
+ actionUrlKey,
451
+ actionUrlExtraParams,
442
452
  onChange: (e) => {
443
453
  form.setFieldValue(item.attrid, e.target.value);
444
454
  }
@@ -456,6 +466,9 @@ function useDynamicForm(props) {
456
466
  options: params,
457
467
  value: formatValue,
458
468
  handleUrlOptions,
469
+ interfaceTypeDict,
470
+ actionUrlKey,
471
+ actionUrlExtraParams,
459
472
  onChange: (val) => {
460
473
  form.setFieldValue(item.attrid, val.join(","));
461
474
  }
@@ -474,6 +487,7 @@ function useDynamicForm(props) {
474
487
  list: formatValue,
475
488
  readonly,
476
489
  relatedid,
490
+ relatedidKey,
477
491
  onRemove: (file) => handleOnRemove(file)
478
492
  }
479
493
  );
@@ -485,7 +499,10 @@ function useDynamicForm(props) {
485
499
  commonRequest,
486
500
  item: item.json,
487
501
  value: item.attrvalue,
488
- style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style }
502
+ style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style },
503
+ interfaceTypeDict,
504
+ actionUrlKey,
505
+ actionUrlExtraParams
489
506
  }
490
507
  );
491
508
  case "radio-card":
@@ -0,0 +1,19 @@
1
+ /**
2
+ * 宠物详情渲染 Hook
3
+ * @param dogInfo 宠物详情数据
4
+ * @param config 配置信息(用于文件预览地址)
5
+ * @returns 渲染函数
6
+ */
7
+ interface IDetailRenderProps {
8
+ detailInfo: any;
9
+ mainApplicationDomain: string;
10
+ labelSpan?: number;
11
+ valueSpan?: number;
12
+ imgWidth?: number;
13
+ imgHeight?: number;
14
+ useGrid?: boolean;
15
+ }
16
+ export default function useDetailRenderer({ detailInfo, labelSpan, valueSpan, imgWidth, imgHeight, useGrid, mainApplicationDomain, }: IDetailRenderProps): {
17
+ renderDetail: () => import("react/jsx-runtime").JSX.Element | null;
18
+ };
19
+ export {};
@@ -0,0 +1,125 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Row, Space, Image, Col } from "antd";
3
+ import { Fragment } from "react";
4
+ function useDetailRenderer({
5
+ detailInfo,
6
+ labelSpan = 3,
7
+ valueSpan = 9,
8
+ imgWidth = 93,
9
+ imgHeight = 93,
10
+ useGrid = true,
11
+ mainApplicationDomain = ""
12
+ }) {
13
+ const handlePreviewFile = (filePath) => {
14
+ var _a;
15
+ (_a = window.parent) == null ? void 0 : _a.postMessage({ type: "previewDoc", docurl: filePath }, mainApplicationDomain);
16
+ };
17
+ const renderImageAttr = (item) => {
18
+ if (typeof (item == null ? void 0 : item.attrvalue) !== "string")
19
+ return;
20
+ const attrvalues = JSON.parse((item == null ? void 0 : item.attrvalue) || "[]");
21
+ const renderItem = /* @__PURE__ */ jsx(Space, { children: attrvalues.map((el, index) => /* @__PURE__ */ jsx(
22
+ "div",
23
+ {
24
+ style: {
25
+ border: "1px solid rgba(0, 0, 0, 0.15)",
26
+ borderRadius: 4
27
+ },
28
+ children: /* @__PURE__ */ jsx(
29
+ Image,
30
+ {
31
+ style: { objectFit: "cover", padding: 5 },
32
+ width: imgWidth,
33
+ height: imgHeight,
34
+ src: el == null ? void 0 : el.FilePath,
35
+ alt: (item == null ? void 0 : item.attrname) || "-"
36
+ },
37
+ index
38
+ )
39
+ },
40
+ index
41
+ )) });
42
+ if (!useGrid) {
43
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Col, { span: labelSpan, children: [
44
+ item == null ? void 0 : item.attrname,
45
+ ":",
46
+ renderItem
47
+ ] }) }, item.attrid);
48
+ }
49
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
50
+ /* @__PURE__ */ jsx(Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
51
+ /* @__PURE__ */ jsx(Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: renderItem })
52
+ ] }, item.attrid);
53
+ };
54
+ const renderFileAttr = (item) => {
55
+ if (typeof (item == null ? void 0 : item.attrvalue) !== "string")
56
+ return;
57
+ const attrvalues = JSON.parse((item == null ? void 0 : item.attrvalue) || "[]");
58
+ const renderItem = /* @__PURE__ */ jsx(Space, { children: attrvalues.map((el, index) => /* @__PURE__ */ jsx("a", { onClick: () => handlePreviewFile(el == null ? void 0 : el.FilePath), children: (el == null ? void 0 : el.FileName) || "-" }, index)) });
59
+ if (!useGrid) {
60
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Col, { span: labelSpan, style: { wordWrap: "break-word" }, children: [
61
+ item == null ? void 0 : item.attrname,
62
+ ":",
63
+ renderItem
64
+ ] }) }, item.attrid);
65
+ }
66
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
67
+ /* @__PURE__ */ jsx(Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
68
+ /* @__PURE__ */ jsx(Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: renderItem })
69
+ ] }, item.attrid);
70
+ };
71
+ const renderTextAttr = (item) => {
72
+ if (!useGrid) {
73
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Col, { span: labelSpan, style: { wordWrap: "break-word" }, children: [
74
+ item == null ? void 0 : item.attrname,
75
+ ":",
76
+ (item == null ? void 0 : item.attrvalue) || "-"
77
+ ] }) }, item.attrid);
78
+ }
79
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
80
+ /* @__PURE__ */ jsx(Col, { span: labelSpan, children: item == null ? void 0 : item.attrname }),
81
+ /* @__PURE__ */ jsx(Col, { span: valueSpan, style: { wordWrap: "break-word" }, children: (item == null ? void 0 : item.attrvalue) || "-" })
82
+ ] }, item.attrid);
83
+ };
84
+ const renderDetail = () => {
85
+ if (!detailInfo)
86
+ return null;
87
+ const renderAttrItems = (items) => {
88
+ var _a;
89
+ return (_a = items == null ? void 0 : items.filter((item) => (item == null ? void 0 : item.attrtype) === 0)) == null ? void 0 : _a.map((item) => {
90
+ const info = (item == null ? void 0 : item.json) || (item == null ? void 0 : item.info) && JSON.parse(item.info);
91
+ let content;
92
+ if ((info == null ? void 0 : info.input) === "image") {
93
+ content = renderImageAttr(item);
94
+ } else if (["file", "audio", "video"].includes(info == null ? void 0 : info.input)) {
95
+ content = renderFileAttr(item);
96
+ } else {
97
+ content = renderTextAttr(item);
98
+ }
99
+ if ((item == null ? void 0 : item.children) && item.children.length > 0) {
100
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
101
+ content,
102
+ /* @__PURE__ */ jsx(
103
+ "div",
104
+ {
105
+ style: {
106
+ marginLeft: "16px",
107
+ marginTop: "8px",
108
+ borderLeft: "2px dashed #e8e8e8",
109
+ paddingLeft: "16px"
110
+ },
111
+ children: renderAttrItems(item.children)
112
+ }
113
+ )
114
+ ] }, item.attrid);
115
+ }
116
+ return content;
117
+ });
118
+ };
119
+ return /* @__PURE__ */ jsx(Row, { gutter: [15, 15], children: renderAttrItems(detailInfo == null ? void 0 : detailInfo.attr_list) });
120
+ };
121
+ return { renderDetail };
122
+ }
123
+ export {
124
+ useDetailRenderer as default
125
+ };
package/es/main.d.ts CHANGED
@@ -24,4 +24,5 @@ import useChangePwd from './hooks/useChangePwd';
24
24
  import useConfig from './hooks/useConfig';
25
25
  import useRemember from './hooks/useRemember';
26
26
  import useRowSelection from './hooks/useRowSelection';
27
- export { AES, AuthButton, BackHeader, compressionImage, CoralButton, CreateForm, EditTable, HmacSHA512, HmacSM3, LoopSlide, SearchTable, showWorkFlow, UploadFile, DynamicForm, useCaptcha, useChangePwd, useConfig, useRemember, useRowSelection, WorkFlowNode, CustomPagination, utils, download, fileType, FormRules, verfyCode, method, };
27
+ import useDetailRender from './hooks/useDetailRender';
28
+ export { AES, AuthButton, BackHeader, compressionImage, CoralButton, CreateForm, EditTable, HmacSHA512, HmacSM3, LoopSlide, SearchTable, showWorkFlow, UploadFile, DynamicForm, useCaptcha, useChangePwd, useConfig, useRemember, useRowSelection, WorkFlowNode, CustomPagination, useDetailRender, utils, download, fileType, FormRules, verfyCode, method, };
package/es/main.js CHANGED
@@ -24,6 +24,7 @@ import { default as default18 } from "./hooks/useChangePwd";
24
24
  import { default as default19 } from "./hooks/useConfig";
25
25
  import { default as default20 } from "./hooks/useRemember";
26
26
  import { default as default21 } from "./hooks/useRowSelection";
27
+ import { default as default22 } from "./hooks/useDetailRender";
27
28
  export {
28
29
  default14 as AES,
29
30
  default7 as AuthButton,
@@ -48,6 +49,7 @@ export {
48
49
  default17 as useCaptcha,
49
50
  default18 as useChangePwd,
50
51
  default19 as useConfig,
52
+ default22 as useDetailRender,
51
53
  default20 as useRemember,
52
54
  default21 as useRowSelection,
53
55
  index as utils,
@@ -1,12 +1,18 @@
1
1
  export declare function getJson(jsonStr: string): any;
2
2
  export declare function base64ToString(base64Str: string): string;
3
3
  export declare function isBase64(str: string): boolean;
4
+ /**
5
+ * 处理表单提交数据,将表单值合并到原始数据attrvalue中
6
+ * @param originalData 原始数据
7
+ * @param allValues 表单提交值
8
+ * @returns
9
+ */
4
10
  export declare const handleSubmitForm: (originalData: any, allValues: any) => {
5
11
  updatedData: any;
6
12
  uploadedFiles: any[];
7
13
  };
8
14
  export declare const handleAttrList: (attrList: any[]) => any[];
9
- export declare const handleFormConfig: ({ number, key, sourceNumber, guidInterfaceName, SelPCParamInterfaceName, servicerAttrListInterfaceName, accepterAttrListInterfaceName, defaultAttrListInterfaceName, commonRequest, }: {
15
+ export declare const handleFormConfig: ({ number, key, sourceNumber, guidInterfaceName, SelPCParamInterfaceName, servicerAttrListInterfaceName, accepterAttrListInterfaceName, defaultAttrListInterfaceName, commonRequest, guidParams, pcParam, attrReqKey, attrListExtraParams, }: {
10
16
  number: string | number;
11
17
  key: string;
12
18
  guidInterfaceName: string;
@@ -16,10 +22,27 @@ export declare const handleFormConfig: ({ number, key, sourceNumber, guidInterfa
16
22
  defaultAttrListInterfaceName?: string | undefined;
17
23
  sourceNumber?: string | number | undefined;
18
24
  commonRequest: any;
25
+ guidParams?: {
26
+ [key: string]: any;
27
+ } | undefined;
28
+ pcParam?: {
29
+ [key: string]: any;
30
+ } | undefined;
31
+ attrListExtraParams?: {
32
+ [key: string]: any;
33
+ } | undefined;
34
+ attrReqKey?: string | undefined;
19
35
  }) => Promise<{
20
36
  baseData: any;
21
37
  newGUID: string;
22
38
  attrListConfigs: any[];
23
39
  selPCParam: any;
24
40
  }>;
41
+ /**
42
+ * 保存或者删除文件
43
+ * @param params 操作文件接口参数
44
+ * @param data 操作文件接口数据
45
+ * @param commonRequestWidthParams 操作文件接口请求函数
46
+ * @returns
47
+ */
25
48
  export declare const handleOperationFile: (params: any, data: any, commonRequestWidthParams: any) => Promise<any>;
@@ -136,22 +136,32 @@ const handleFormConfig = async ({
136
136
  servicerAttrListInterfaceName,
137
137
  accepterAttrListInterfaceName,
138
138
  defaultAttrListInterfaceName,
139
- commonRequest
139
+ commonRequest,
140
+ guidParams,
141
+ pcParam,
142
+ attrReqKey = "asid",
143
+ attrListExtraParams = {}
140
144
  }) => {
141
145
  return new Promise(async (resolve, reject) => {
142
146
  var _a, _b, _c, _d;
143
147
  let newGUID = "", attrListConfigs = [], baseData = {}, selPCParam = {};
144
- const guidRes = await commonRequest(guidInterfaceName || "FWDXGLCreateGUID", {
145
- "source-number": sourceNumber
146
- });
148
+ const guidRes = await commonRequest(
149
+ guidInterfaceName || "FWDXGLCreateGUID",
150
+ guidParams || {
151
+ "source-number": sourceNumber
152
+ }
153
+ );
147
154
  if ((guidRes == null ? void 0 : guidRes.ReturnValue) === 1 && ((_a = guidRes == null ? void 0 : guidRes.data) == null ? void 0 : _a.GUID)) {
148
155
  newGUID = guidRes.data.GUID;
149
156
  } else {
150
157
  reject("获取GUID失败");
151
158
  }
152
- const res = await commonRequest(SelPCParamInterfaceName || "FWDXGLSelPCParam", {
153
- "source-number": sourceNumber
154
- });
159
+ const res = await commonRequest(
160
+ SelPCParamInterfaceName || "FWDXGLSelPCParam",
161
+ pcParam || {
162
+ "source-number": sourceNumber
163
+ }
164
+ );
155
165
  if ((res == null ? void 0 : res.ReturnValue) === 1) {
156
166
  const asid = (_b = res.data[number]) == null ? void 0 : _b[key];
157
167
  const propertiesType = (_c = res.data[number]) == null ? void 0 : _c["properties-type"];
@@ -161,8 +171,9 @@ const handleFormConfig = async ({
161
171
  };
162
172
  selPCParam = res.data;
163
173
  const res2 = await commonRequest(propertiesTypeMap[propertiesType] || defaultAttrListInterfaceName, {
164
- asid,
165
- "source-number": sourceNumber
174
+ [attrReqKey]: asid,
175
+ "source-number": sourceNumber,
176
+ ...attrListExtraParams
166
177
  });
167
178
  if ((res2 == null ? void 0 : res2.ReturnValue) === 1 && res2.data) {
168
179
  const attrList = ((_d = res2.data) == null ? void 0 : _d["attr_list"]) || [];
@@ -19,7 +19,11 @@ const DynamicForm = react.forwardRef((props, ref) => {
19
19
  commonRequest,
20
20
  formItemStyle = [],
21
21
  radioAlign = "horizontal",
22
- interfaceTypeChildren = "YLLRDetailAttrlist"
22
+ interfaceTypeChildren = "YLLRDetailAttrlist",
23
+ interfaceTypeDict = "YLZDDictList",
24
+ relatedidKey = "relatedid",
25
+ actionUrlKey = "action-url",
26
+ actionUrlExtraParams = {}
23
27
  } = props;
24
28
  const delFileListRef = react.useRef([]);
25
29
  const updateDelFileList = (file) => {
@@ -32,7 +36,11 @@ const DynamicForm = react.forwardRef((props, ref) => {
32
36
  setFormConfig,
33
37
  updateDelFileList,
34
38
  formConfig,
35
- interfaceTypeChildren
39
+ interfaceTypeChildren,
40
+ interfaceTypeDict,
41
+ relatedidKey,
42
+ actionUrlKey,
43
+ actionUrlExtraParams
36
44
  });
37
45
  react.useImperativeHandle(ref, () => ({
38
46
  getDelFileList: () => {
@@ -8,6 +8,9 @@ interface MyCascaderProps {
8
8
  style?: React.CSSProperties;
9
9
  commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
10
10
  commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
11
+ interfaceTypeDict: string;
12
+ actionUrlKey: string;
13
+ actionUrlExtraParams: object;
11
14
  }
12
- declare const MyCascader: ({ item, readonly, value, onChange, style, commonRequestWidthParams, commonRequest, }: MyCascaderProps) => import("react/jsx-runtime").JSX.Element;
15
+ declare const MyCascader: ({ item, readonly, value, onChange, style, commonRequestWidthParams, commonRequest, interfaceTypeDict, actionUrlKey, actionUrlExtraParams, }: MyCascaderProps) => import("react/jsx-runtime").JSX.Element;
13
16
  export default MyCascader;
@@ -9,7 +9,10 @@ const MyCascader = ({
9
9
  onChange,
10
10
  style,
11
11
  commonRequestWidthParams,
12
- commonRequest
12
+ commonRequest,
13
+ interfaceTypeDict,
14
+ actionUrlKey,
15
+ actionUrlExtraParams
13
16
  }) => {
14
17
  const [options, setOptions] = react.useState([]);
15
18
  const [loading, setLoading] = react.useState(false);
@@ -34,7 +37,7 @@ const MyCascader = ({
34
37
  if (item.classify) {
35
38
  setLoading(true);
36
39
  try {
37
- const response = await commonRequest("YLZDDictList", {
40
+ const response = await commonRequest(interfaceTypeDict, {
38
41
  asctypeid: item.classify
39
42
  });
40
43
  if (((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.list) && Array.isArray(response.data.list)) {
@@ -84,7 +87,8 @@ const MyCascader = ({
84
87
  return;
85
88
  }
86
89
  const params = {
87
- "action-url": item == null ? void 0 : item["action-url"]
90
+ [actionUrlKey]: item == null ? void 0 : item["action-url"],
91
+ ...actionUrlExtraParams
88
92
  };
89
93
  if (targetOption) {
90
94
  searchFields.forEach((field) => {
@@ -10,6 +10,9 @@ export interface IMYRadio {
10
10
  handleUrlOptions: (val: any, delimiter: string, list: any[]) => string;
11
11
  commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
12
12
  commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
13
+ interfaceTypeDict: string;
14
+ actionUrlKey: string;
15
+ actionUrlExtraParams: object;
13
16
  }
14
17
  declare const MyCheckbox: (props: IMYRadio) => import("react/jsx-runtime").JSX.Element;
15
18
  export default MyCheckbox;