@boteteam/utils 0.0.31 → 0.0.32

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 (107) hide show
  1. package/dist/cjs/file.js +4 -4
  2. package/dist/cjs/file.js.map +2 -2
  3. package/dist/cjs/formatModule/formatModuleData.d.ts +3 -1
  4. package/dist/cjs/formatModule/formatModuleData.js +102 -17
  5. package/dist/cjs/formatModule/formatModuleData.js.map +3 -3
  6. package/dist/cjs/formatModule/helpers/checkDataSourceOfFn.d.ts +2 -0
  7. package/dist/cjs/formatModule/helpers/checkDataSourceOfFn.js +33 -0
  8. package/dist/cjs/formatModule/helpers/checkDataSourceOfFn.js.map +7 -0
  9. package/dist/cjs/formatModule/helpers/cssToJson.d.ts +22 -0
  10. package/dist/cjs/formatModule/helpers/cssToJson.js +78 -0
  11. package/dist/cjs/formatModule/helpers/cssToJson.js.map +7 -0
  12. package/dist/cjs/formatModule/helpers/formatDataProps.d.ts +19 -0
  13. package/dist/cjs/formatModule/helpers/formatDataProps.js +65 -0
  14. package/dist/cjs/formatModule/helpers/formatDataProps.js.map +7 -0
  15. package/dist/cjs/formatModule/helpers/formatFormProps.js +7 -0
  16. package/dist/cjs/formatModule/helpers/formatFormProps.js.map +3 -3
  17. package/dist/cjs/formatModule/helpers/formatListProps.js +25 -9
  18. package/dist/cjs/formatModule/helpers/formatListProps.js.map +3 -3
  19. package/dist/cjs/formatModule/helpers/formatLoopProps.d.ts +1 -4
  20. package/dist/cjs/formatModule/helpers/formatLoopProps.js +20 -8
  21. package/dist/cjs/formatModule/helpers/formatLoopProps.js.map +3 -3
  22. package/dist/cjs/formatModule/helpers/formatStepsProps.js +49 -32
  23. package/dist/cjs/formatModule/helpers/formatStepsProps.js.map +3 -3
  24. package/dist/cjs/formatModule/helpers/formatStyleProps.d.ts +16 -3
  25. package/dist/cjs/formatModule/helpers/formatStyleProps.js +100 -37
  26. package/dist/cjs/formatModule/helpers/formatStyleProps.js.map +3 -3
  27. package/dist/cjs/formatModule/helpers/formatTableProps.d.ts +7 -1
  28. package/dist/cjs/formatModule/helpers/formatTableProps.js +46 -11
  29. package/dist/cjs/formatModule/helpers/formatTableProps.js.map +3 -3
  30. package/dist/cjs/formatModule/helpers/formatTabsProps.d.ts +15 -0
  31. package/dist/cjs/formatModule/helpers/formatTabsProps.js +49 -0
  32. package/dist/cjs/formatModule/helpers/formatTabsProps.js.map +7 -0
  33. package/dist/cjs/formatModule/helpers/formatVideoProps.d.ts +12 -0
  34. package/dist/cjs/formatModule/helpers/formatVideoProps.js +45 -0
  35. package/dist/cjs/formatModule/helpers/formatVideoProps.js.map +7 -0
  36. package/dist/cjs/formatModule/helpers/index.d.ts +6 -1
  37. package/dist/cjs/formatModule/helpers/index.js +15 -0
  38. package/dist/cjs/formatModule/helpers/index.js.map +3 -3
  39. package/dist/cjs/formatModule/helpers/stringScriptExecution.js +1 -1
  40. package/dist/cjs/formatModule/helpers/stringScriptExecution.js.map +1 -1
  41. package/dist/cjs/http.d.ts +17 -0
  42. package/dist/cjs/http.js +123 -1
  43. package/dist/cjs/http.js.map +2 -2
  44. package/dist/cjs/index.d.ts +5 -4
  45. package/dist/cjs/index.js +19 -0
  46. package/dist/cjs/index.js.map +2 -2
  47. package/dist/cjs/treeUtils.d.ts +31 -3
  48. package/dist/cjs/treeUtils.js +53 -10
  49. package/dist/cjs/treeUtils.js.map +3 -3
  50. package/dist/cjs/watermark.d.ts +80 -0
  51. package/dist/cjs/watermark.js +350 -0
  52. package/dist/cjs/watermark.js.map +7 -0
  53. package/dist/esm/file.js +5 -4
  54. package/dist/esm/file.js.map +1 -1
  55. package/dist/esm/formatModule/formatModuleData.d.ts +3 -1
  56. package/dist/esm/formatModule/formatModuleData.js +121 -40
  57. package/dist/esm/formatModule/formatModuleData.js.map +1 -1
  58. package/dist/esm/formatModule/helpers/checkDataSourceOfFn.d.ts +2 -0
  59. package/dist/esm/formatModule/helpers/checkDataSourceOfFn.js +9 -0
  60. package/dist/esm/formatModule/helpers/checkDataSourceOfFn.js.map +1 -0
  61. package/dist/esm/formatModule/helpers/cssToJson.d.ts +22 -0
  62. package/dist/esm/formatModule/helpers/cssToJson.js +103 -0
  63. package/dist/esm/formatModule/helpers/cssToJson.js.map +1 -0
  64. package/dist/esm/formatModule/helpers/formatDataProps.d.ts +19 -0
  65. package/dist/esm/formatModule/helpers/formatDataProps.js +26 -0
  66. package/dist/esm/formatModule/helpers/formatDataProps.js.map +1 -0
  67. package/dist/esm/formatModule/helpers/formatFormProps.js +6 -0
  68. package/dist/esm/formatModule/helpers/formatFormProps.js.map +1 -1
  69. package/dist/esm/formatModule/helpers/formatListProps.js +26 -9
  70. package/dist/esm/formatModule/helpers/formatListProps.js.map +1 -1
  71. package/dist/esm/formatModule/helpers/formatLoopProps.d.ts +1 -4
  72. package/dist/esm/formatModule/helpers/formatLoopProps.js +13 -12
  73. package/dist/esm/formatModule/helpers/formatLoopProps.js.map +1 -1
  74. package/dist/esm/formatModule/helpers/formatStepsProps.js +38 -31
  75. package/dist/esm/formatModule/helpers/formatStepsProps.js.map +1 -1
  76. package/dist/esm/formatModule/helpers/formatStyleProps.d.ts +16 -3
  77. package/dist/esm/formatModule/helpers/formatStyleProps.js +90 -43
  78. package/dist/esm/formatModule/helpers/formatStyleProps.js.map +1 -1
  79. package/dist/esm/formatModule/helpers/formatTableProps.d.ts +7 -1
  80. package/dist/esm/formatModule/helpers/formatTableProps.js +57 -8
  81. package/dist/esm/formatModule/helpers/formatTableProps.js.map +1 -1
  82. package/dist/esm/formatModule/helpers/formatTabsProps.d.ts +15 -0
  83. package/dist/esm/formatModule/helpers/formatTabsProps.js +46 -0
  84. package/dist/esm/formatModule/helpers/formatTabsProps.js.map +1 -0
  85. package/dist/esm/formatModule/helpers/formatVideoProps.d.ts +12 -0
  86. package/dist/esm/formatModule/helpers/formatVideoProps.js +31 -0
  87. package/dist/esm/formatModule/helpers/formatVideoProps.js.map +1 -0
  88. package/dist/esm/formatModule/helpers/index.d.ts +6 -1
  89. package/dist/esm/formatModule/helpers/index.js +6 -1
  90. package/dist/esm/formatModule/helpers/index.js.map +1 -1
  91. package/dist/esm/formatModule/helpers/stringScriptExecution.js +1 -1
  92. package/dist/esm/formatModule/helpers/stringScriptExecution.js.map +1 -1
  93. package/dist/esm/http.d.ts +17 -0
  94. package/dist/esm/http.js +208 -43
  95. package/dist/esm/http.js.map +1 -1
  96. package/dist/esm/index.d.ts +5 -4
  97. package/dist/esm/index.js +4 -3
  98. package/dist/esm/index.js.map +1 -1
  99. package/dist/esm/treeUtils.d.ts +31 -3
  100. package/dist/esm/treeUtils.js +118 -15
  101. package/dist/esm/treeUtils.js.map +1 -1
  102. package/dist/esm/watermark.d.ts +80 -0
  103. package/dist/esm/watermark.js +487 -0
  104. package/dist/esm/watermark.js.map +1 -0
  105. package/dist/umd/index.min.js +1 -1
  106. package/dist/umd/index.min.js.map +1 -1
  107. package/package.json +4 -4
@@ -0,0 +1,19 @@
1
+ export type formatDataPropsType = {
2
+ options?: {
3
+ dataSource?: {
4
+ [key: string]: any;
5
+ } | string;
6
+ id?: string;
7
+ };
8
+ staticCodeMap?: {
9
+ [key: string]: any;
10
+ };
11
+ parameters?: {
12
+ [key: string]: any;
13
+ };
14
+ };
15
+ export type formatDataPropsExportType = {
16
+ dataResult: any;
17
+ };
18
+ declare const formatDataProps: ({ parameters, options, }: formatDataPropsType) => formatDataPropsExportType;
19
+ export default formatDataProps;
@@ -0,0 +1,65 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/formatModule/helpers/formatDataProps.ts
30
+ var formatDataProps_exports = {};
31
+ __export(formatDataProps_exports, {
32
+ default: () => formatDataProps_default
33
+ });
34
+ module.exports = __toCommonJS(formatDataProps_exports);
35
+ var import_lodash = require("lodash");
36
+ var import_stringScriptExecution = require("./stringScriptExecution");
37
+ var import_treeUtils = require("../../treeUtils");
38
+ var import_checkDataSourceOfFn = __toESM(require("./checkDataSourceOfFn"));
39
+ var formatDataProps = ({
40
+ parameters,
41
+ options = {}
42
+ }) => {
43
+ const {
44
+ dataSource
45
+ } = options;
46
+ let dataResult = null;
47
+ if (typeof dataSource === "string" && dataSource) {
48
+ if ((0, import_checkDataSourceOfFn.default)(dataSource)) {
49
+ dataResult = (0, import_stringScriptExecution.stringScriptExecution)(dataSource, parameters);
50
+ } else {
51
+ const dataSourceArr = (0, import_treeUtils.getDataArr)(dataSource);
52
+ if (parameters) {
53
+ dataResult = (0, import_lodash.get)(
54
+ parameters,
55
+ dataSourceArr
56
+ );
57
+ }
58
+ }
59
+ }
60
+ return {
61
+ dataResult
62
+ };
63
+ };
64
+ var formatDataProps_default = formatDataProps;
65
+ //# sourceMappingURL=formatDataProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/formatModule/helpers/formatDataProps.ts"],
4
+ "sourcesContent": ["import { get } from 'lodash';\nimport { stringScriptExecution } from './stringScriptExecution';\nimport { getDataArr } from '../../treeUtils';\nimport checkDataSourceOfFn from './checkDataSourceOfFn';\n\nexport type formatDataPropsType = {\n options?: {\n dataSource?: {[key:string]: any} | string;\n id?: string;\n }\n staticCodeMap?: {[key:string]: any};\n parameters?: {[key:string]: any};\n}\n\nexport type formatDataPropsExportType = {\n dataResult: any\n}\n\nconst formatDataProps = ({\n parameters,\n options = {},\n}: formatDataPropsType): formatDataPropsExportType => {\n const {\n dataSource,\n } = options;\n let dataResult:any = null;\n if (typeof dataSource === 'string' && dataSource) {\n if (checkDataSourceOfFn(dataSource)) {\n dataResult = stringScriptExecution(dataSource, parameters);\n } else {\n const dataSourceArr = getDataArr(dataSource);\n if (parameters) {\n dataResult = get(\n parameters,\n dataSourceArr,\n );\n }\n }\n }\n return {\n dataResult,\n };\n};\n\nexport default formatDataProps;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAoB;AACpB,mCAAsC;AACtC,uBAA2B;AAC3B,iCAAgC;AAehC,IAAM,kBAAkB,CAAC;AAAA,EACvB;AAAA,EACA,UAAU,CAAC;AACb,MAAsD;AACpD,QAAM;AAAA,IACJ;AAAA,EACF,IAAI;AACJ,MAAI,aAAiB;AACrB,MAAI,OAAO,eAAe,YAAY,YAAY;AAChD,YAAI,2BAAAA,SAAoB,UAAU,GAAG;AACnC,uBAAa,oDAAsB,YAAY,UAAU;AAAA,IAC3D,OAAO;AACL,YAAM,oBAAgB,6BAAW,UAAU;AAC3C,UAAI,YAAY;AACd,yBAAa;AAAA,UACX;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,SAAO;AAAA,IACL;AAAA,EACF;AACF;AAEA,IAAO,0BAAQ;",
6
+ "names": ["checkDataSourceOfFn"]
7
+ }
@@ -40,6 +40,7 @@ var import_formatListProps = __toESM(require("./formatListProps"));
40
40
  var import_formRulsRegMap = __toESM(require("./formRulsRegMap"));
41
41
  var import_urlPrefix = __toESM(require("./urlPrefix"));
42
42
  var import_patternTransitionRegExp = __toESM(require("./patternTransitionRegExp"));
43
+ var import_stringPramarsValTransition = __toESM(require("./stringPramarsValTransition"));
43
44
  var formatOptionsRecursively = (data, labelApiPath, valApiPath) => {
44
45
  return data.map((item) => {
45
46
  const option = {
@@ -90,6 +91,12 @@ var formatFormProps = ({
90
91
  originModule: attrItem
91
92
  // 以下是组件配置属性,用于属性编辑
92
93
  };
94
+ if ((otherAttrFormProps == null ? void 0 : otherAttrFormProps.helper) && typeof (otherAttrFormProps == null ? void 0 : otherAttrFormProps.helper) === "string") {
95
+ formItem.formProps = {
96
+ ...formItem.formProps,
97
+ helper: (0, import_stringPramarsValTransition.default)(otherAttrFormProps == null ? void 0 : otherAttrFormProps.helper, parameters)
98
+ };
99
+ }
93
100
  if ((extend == null ? void 0 : extend.type) === "text" && (extend == null ? void 0 : extend.text) && typeof (extend == null ? void 0 : extend.text) === "string") {
94
101
  formItem.formProps = {
95
102
  ...formItem.formProps,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/formatModule/helpers/formatFormProps.ts"],
4
- "sourcesContent": ["import { get } from 'lodash';\nimport { stringScriptExecution } from './stringScriptExecution';\nimport { getDataArr, getParamsContentByParamKeys, replaceParamsValue } from '../../treeUtils';\nimport formatTableProps from './formatTableProps';\nimport formatListProps from './formatListProps';\nimport formRulsRegMap from './formRulsRegMap';\nimport urlPrefix from './urlPrefix';\nimport patternTransitionRegExp from './patternTransitionRegExp';\n\nexport type formatFormPropsType = {\n options?: {\n column?: number;\n children?: {[key:string]: any}[]\n }\n parameters: {[key:string]: any};\n staticCodeMap: {[key:string]: any};\n staticOptionsMap: {[key:string]: any};\n serviceApiMap?: {[key:string]: any}; // serviceApi数据MAP,key为 attrId\n}\n\nconst formatOptionsRecursively = (data: any[], labelApiPath: string[], valApiPath: string[]): any[] => {\n return data.map((item) => {\n const option: any = {\n label: get(item, labelApiPath),\n value: get(item, valApiPath),\n };\n \n // 如果存在children属性,递归处理\n if (item.children && Array.isArray(item.children)) {\n option.children = formatOptionsRecursively(item.children, labelApiPath, valApiPath);\n }\n \n return option;\n });\n};\n\nconst formatFormProps = ({\n parameters,\n staticCodeMap,\n staticOptionsMap,\n serviceApiMap = {},\n options = {},\n}: formatFormPropsType):{[key:string]: any} => {\n const { children, column } = options;\n const res:{[key:string]: any} = {};\n const formItems: { [key: string]: any }[] = [];\n const initValues: { [key: string]: any } = {};\n if (Array.isArray(children) && children.length > 0) {\n children.forEach((attrItem) => {\n const {\n compProps: attrCompProps,\n formProps: attrFormProps,\n } = attrItem || {};\n const {\n required,\n extend,\n display: attrFormPropsDisplay,\n ...otherAttrFormProps\n } = attrFormProps || {};\n const {\n dataOptions,\n ...otherAttrCompProps\n } = attrCompProps || {};\n const formItem:{[key:string]: any} = {\n key: attrItem?.id,\n label: attrFormProps?.label,\n name: attrFormProps?.name,\n type: attrItem?.compType,\n props: otherAttrCompProps || {},\n formProps: otherAttrFormProps || {},\n originModule: attrItem, // 以下是组件配置属性,用于属性编辑\n };\n if (extend?.type === 'text' && extend?.text && typeof extend?.text === 'string') {\n formItem.formProps = {\n ...formItem.formProps,\n extend: {\n ...extend,\n text: replaceParamsValue(extend?.text, parameters),\n },\n };\n } else if (extend?.type === 'controlBtns' && Array.isArray(extend?.controlBtns) && extend?.controlBtns?.length > 0) {\n formItem.formProps = {\n ...formItem.formProps,\n extend: {\n ...extend,\n controlBtns: extend?.controlBtns,\n },\n };\n } else {\n delete formItem.formProps.extend;\n }\n if (attrItem?.compType === 'table') {\n const tableProps = formatTableProps({\n options: attrItem?.compProps,\n staticCodeMap,\n parameters,\n });\n const rowKeys = getDataArr(attrItem?.compProps?.rowKey);\n formItem.props = {\n ...formItem.props,\n ...tableProps,\n rowKey: rowKeys?.length > 0 ? rowKeys?.[rowKeys?.length - 1] : 'key',\n hasSelectAll: (attrItem?.compProps?.rowSelection && attrItem?.compProps?.hasSelectAll) ? attrItem?.compProps?.hasSelectAll : null,\n rowSelection: attrItem?.compProps?.rowSelection || { type: 'radio' },\n };\n }\n if (['list', 'card'].includes(attrItem?.compType)) {\n const resProps = formatListProps({\n options: attrItem?.compProps,\n staticCodeMap,\n parameters,\n urlPrefix,\n });\n formItem.props = {\n ...resProps,\n rowSelection: attrItem?.compProps?.rowSelection || { type: 'radio' },\n };\n }\n if (attrItem?.compType === 'upload') {\n if (\n attrItem?.compProps?.data &&\n Object.keys(attrItem?.compProps?.data)?.length > 0\n ) {\n const uploadDataParams:{[key:string]: any} = {};\n Object.keys(attrItem?.compProps?.data).forEach(paramsName => {\n if (/\\$\\{(.+?)\\}/g.test(attrItem?.compProps?.data?.[paramsName])) {\n // const valParamArr = getDataArr(attrItem?.compProps?.data?.[paramsName]);\n uploadDataParams[paramsName] = getParamsContentByParamKeys(attrItem?.compProps?.data?.[paramsName], parameters);\n } else {\n uploadDataParams[paramsName] = attrItem?.compProps?.data?.[paramsName];\n }\n });\n formItem.props = {\n ...formItem.props,\n data: uploadDataParams,\n };\n }\n if (\n attrItem?.compProps?.action?.url &&\n typeof attrItem?.compProps?.action?.url === 'string'\n ) {\n formItem.props = {\n ...formItem.props,\n action: attrItem?.compProps?.action?.url,\n };\n }\n }\n let otherRules = Array.isArray(otherAttrFormProps?.rules) ? otherAttrFormProps?.rules?.filter((item: any) => !item?.required) : [];\n if (attrItem?.formProps?.defaultValue) {\n let attrDefVal:any = '';\n if (attrItem?.compType === 'upload') {\n formItem.formProps = {\n ...formItem.formProps,\n valuePropName: 'fileList',\n };\n attrDefVal = getParamsContentByParamKeys(attrItem?.formProps?.defaultValue, parameters) || [];\n } else {\n delete formItem.formProps.valuePropName;\n attrDefVal = replaceParamsValue(attrItem?.formProps?.defaultValue, parameters) || '';\n }\n initValues[otherAttrFormProps?.name] = attrDefVal;\n }\n otherRules = otherRules.map((item: {[key:string]: any}) => ({\n pattern: item?.type === 'custom' ? patternTransitionRegExp(item?.pattern) : (\n formRulsRegMap?.[item?.type] || ''\n ),\n message: item?.message,\n }));\n if (typeof attrFormPropsDisplay === 'boolean' || typeof attrFormPropsDisplay === 'string') {\n let formItemDisplay:boolean = true;\n if (typeof attrFormPropsDisplay === 'boolean') {\n formItemDisplay = attrFormPropsDisplay;\n } else if (typeof attrFormPropsDisplay === 'string' && attrFormPropsDisplay) {\n // const scriptCodeStr = stringPramarsValTransition(attrFormPropsDisplay, parameters);\n const codeExtendVal = stringScriptExecution(\n attrFormPropsDisplay,\n parameters,\n );\n formItemDisplay = codeExtendVal;\n }\n formItem.display = formItemDisplay;\n }\n if (typeof required === 'boolean' || typeof required === 'string') {\n let formItemRequired:boolean = false;\n if (typeof required === 'boolean') {\n formItemRequired = required;\n } else if (typeof required === 'string' && required) {\n // const scriptCodeStr = stringPramarsValTransition(required, parameters);\n const codeExtendVal = stringScriptExecution(required, parameters);\n formItemRequired = typeof codeExtendVal === 'boolean' ? codeExtendVal : false;\n }\n formItem.formProps = {\n ...formItem.formProps,\n rules: formItemRequired ? [{ required: formItemRequired }, ...otherRules] : otherRules,\n };\n } else {\n formItem.formProps = {\n ...formItem.formProps,\n rules: otherRules,\n };\n }\n if (dataOptions) {\n const attrItemDataOptions = dataOptions || {};\n if (attrItemDataOptions?.staticCode) {\n if (\n attrItem?.defaultValue &&\n staticCodeMap?.[attrItemDataOptions?.staticCode] &&\n staticCodeMap?.[attrItemDataOptions?.staticCode]?.[attrItem?.defaultValue]\n ) {\n initValues[attrItem?.attrCode] = staticCodeMap?.[attrItemDataOptions?.staticCode]?.[attrItem?.defaultValue];\n }\n const formatToTreeData = (optionsItems: {[key:string]: any}[]):{[key:string]: any}[] => {\n if (Array.isArray(optionsItems)) {\n return optionsItems.map(optItem => ({\n title: optItem?.label,\n value: optItem?.value,\n children: formatToTreeData(optItem?.children),\n }));\n }\n return [];\n };\n if (attrItem?.compType === 'treeSelect') {\n formItem.props = {\n ...formItem.props,\n treeData: formatToTreeData(staticOptionsMap?.[attrItemDataOptions?.staticCode]),\n };\n } else {\n formItem.props = {\n ...formItem.props,\n options: Array.isArray(staticOptionsMap?.[attrItemDataOptions?.staticCode]) ?\n staticOptionsMap?.[attrItemDataOptions?.staticCode] : [],\n };\n }\n } else if (attrItemDataOptions?.contextOptions && parameters) {\n /**\n * 处理下拉框数据源逻辑\n * 1、 数据源为页面参数\n * optLabelStr : ${pageParams.userList.item.name}\n * optValueStr: ${pageParams.userList.item.id}\n * parameters 中有个数据叫 userList,数据结构为:\n * userList: [{\n * name: '张三',\n * id: '123',\n * }]\n * 2、 数据源为页面数据源\n * optLabelStr: ${dataSource.access.listItem.ACCESS_NAME}\n * optValueStr:${dataSource.access.listItem.ID}\n * parameters 中有个数据叫 access,数据结构为:\n * dataSource:{\n * access: [{\n * ACCESS_NAME: '张三',\n * ID: '123',\n * }],\n * }\n * 首先要判断optLabelStr和optValueStr 字符串前面的配置是否一致,如果不一致则给[] ,\n * 比如 ${pageParams.userList.item.name} 和 ${pageParams.userLis.name} 就不一致\n 现在需要根据这个配置,把optLabelStr和optValueStr的值替换为实际的值 提供给下拉框的 options 属性, 如果是treeSelect, 则需要递归\n */\n\n const optLabelStr = attrItemDataOptions?.contextOptions?.label;\n const optValueStr = attrItemDataOptions?.contextOptions?.value;\n\n if (!optLabelStr || !optValueStr) {\n formItem.props = {\n ...formItem.props,\n options: [],\n };\n } else {\n // 解析路径,使用 getDataArr 来统一处理路径解析\n const labelPathArr = getDataArr(optLabelStr);\n const valuePathArr = getDataArr(optValueStr);\n\n // 检查路径长度,至少需要3段:数据源路径 + item/listItem + 字段名\n if (labelPathArr.length < 2 || valuePathArr.length < 2) {\n formItem.props = {\n ...formItem.props,\n options: [],\n };\n } else {\n // 提取数据源路径(去掉最后两个字段:item/listItem 和字段名)\n // 对于页面参数:${pageParams.userList.item.name} -> ['userList', 'item', 'name'] -> 数据源路径: ['userList']\n // 对于数据源:${dataSource.access.listItem.ACCESS_NAME} -> ['dataSource', 'access', 'listItem', 'ACCESS_NAME'] -> 数据源路径: ['dataSource', 'access']\n const labelDataSourcePath = labelPathArr.slice(0, -2);\n const valueDataSourcePath = valuePathArr.slice(0, -2);\n\n // 检查数据源路径是否一致\n const isPathConsistent = labelDataSourcePath.length === valueDataSourcePath.length &&\n labelDataSourcePath.every((item, index) => item === valueDataSourcePath[index]);\n\n if (!isPathConsistent) {\n // 路径不一致,返回空数组\n formItem.props = {\n ...formItem.props,\n options: [],\n };\n } else {\n // 路径一致,从 parameters 中获取数据\n const dataSourceData = get(parameters, labelDataSourcePath);\n\n // 检查数据是否为数组\n if (!Array.isArray(dataSourceData)) {\n formItem.props = {\n ...formItem.props,\n options: [],\n };\n } else {\n // 提取字段路径(最后两个字段:item/listItem 和字段名)\n // 对于页面参数:['userList', 'item', 'name'] -> 字段路径: ['name']\n // 对于数据源:['dataSource', 'access', 'listItem', 'ACCESS_NAME'] -> 字段路径: ['ACCESS_NAME']\n const labelFieldPath = labelPathArr.slice(-1);\n const valueFieldPath = valuePathArr.slice(-1);\n\n // 递归格式化树形数据\n const formatToTreeData = (optionsItems: {[key:string]: any}[]):{[key:string]: any}[] => {\n if (Array.isArray(optionsItems)) {\n return optionsItems.map(optItem => ({\n title: get(optItem, labelFieldPath),\n value: get(optItem, valueFieldPath),\n children: formatToTreeData(optItem?.children || []),\n }));\n }\n return [];\n };\n\n if (attrItem?.compType === 'treeSelect') {\n formItem.props = {\n ...formItem.props,\n treeData: formatToTreeData(dataSourceData),\n };\n } else {\n formItem.props = {\n ...formItem.props,\n options: formatOptionsRecursively(dataSourceData, labelFieldPath, valueFieldPath),\n };\n }\n }\n }\n }\n }\n }\n }\n formItems.push(formItem);\n });\n }\n if (typeof column === 'number' && column > 1) {\n res.formMode = 'grid';\n res.span = 24 / column;\n } else {\n res.formMode = 'default';\n delete res.span;\n }\n res.formItems = formItems;\n res.initialValues = initValues;\n return res;\n};\n\nexport default formatFormProps;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAoB;AACpB,mCAAsC;AACtC,uBAA4E;AAC5E,8BAA6B;AAC7B,6BAA4B;AAC5B,4BAA2B;AAC3B,uBAAsB;AACtB,qCAAoC;AAapC,IAAM,2BAA2B,CAAC,MAAa,cAAwB,eAAgC;AACrG,SAAO,KAAK,IAAI,CAAC,SAAS;AACxB,UAAM,SAAc;AAAA,MAClB,WAAO,mBAAI,MAAM,YAAY;AAAA,MAC7B,WAAO,mBAAI,MAAM,UAAU;AAAA,IAC7B;AAGA,QAAI,KAAK,YAAY,MAAM,QAAQ,KAAK,QAAQ,GAAG;AACjD,aAAO,WAAW,yBAAyB,KAAK,UAAU,cAAc,UAAU;AAAA,IACpF;AAEA,WAAO;AAAA,EACT,CAAC;AACH;AAEA,IAAM,kBAAkB,CAAC;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB,CAAC;AAAA,EACjB,UAAU,CAAC;AACb,MAA+C;AAC7C,QAAM,EAAE,UAAU,OAAO,IAAI;AAC7B,QAAM,MAA0B,CAAC;AACjC,QAAM,YAAsC,CAAC;AAC7C,QAAM,aAAqC,CAAC;AAC5C,MAAI,MAAM,QAAQ,QAAQ,KAAK,SAAS,SAAS,GAAG;AAClD,aAAS,QAAQ,CAAC,aAAa;AAhDnC;AAiDM,YAAM;AAAA,QACJ,WAAW;AAAA,QACX,WAAW;AAAA,MACb,IAAI,YAAY,CAAC;AACjB,YAAM;AAAA,QACJ;AAAA,QACA;AAAA,QACA,SAAS;AAAA,QACT,GAAG;AAAA,MACL,IAAI,iBAAiB,CAAC;AACtB,YAAM;AAAA,QACJ;AAAA,QACA,GAAG;AAAA,MACL,IAAI,iBAAiB,CAAC;AACtB,YAAM,W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D,EAAE;AAAA,oBACJ;AACA,2BAAO,CAAC;AAAA,kBACV;AAEA,uBAAI,qCAAU,cAAa,cAAc;AACvC,6BAAS,QAAQ;AAAA,sBACf,GAAG,SAAS;AAAA,sBACZ,UAAU,iBAAiB,cAAc;AAAA,oBAC3C;AAAA,kBACF,OAAO;AACL,6BAAS,QAAQ;AAAA,sBACf,GAAG,SAAS;AAAA,sBACZ,SAAS,yBAAyB,gBAAgB,gBAAgB,cAAc;AAAA,oBAClF;AAAA,kBACF;AAAA,gBACF;AAAA,cACF;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AACA,gBAAU,KAAK,QAAQ;AAAA,IACzB,CAAC;AAAA,EACH;AACA,MAAI,OAAO,WAAW,YAAY,SAAS,GAAG;AAC5C,QAAI,WAAW;AACf,QAAI,OAAO,KAAK;AAAA,EAClB,OAAO;AACL,QAAI,WAAW;AACf,WAAO,IAAI;AAAA,EACb;AACA,MAAI,YAAY;AAChB,MAAI,gBAAgB;AACpB,SAAO;AACT;AAEA,IAAO,0BAAQ;",
6
- "names": ["formatTableProps", "formatListProps", "urlPrefix", "_a", "_b", "_c", "_d", "_e", "_f", "patternTransitionRegExp", "formRulsRegMap"]
4
+ "sourcesContent": ["import { get } from 'lodash';\nimport { stringScriptExecution } from './stringScriptExecution';\nimport { getDataArr, getParamsContentByParamKeys, replaceParamsValue } from '../../treeUtils';\nimport formatTableProps from './formatTableProps';\nimport formatListProps from './formatListProps';\nimport formRulsRegMap from './formRulsRegMap';\nimport urlPrefix from './urlPrefix';\nimport patternTransitionRegExp from './patternTransitionRegExp';\nimport stringPramarsValTransition from './stringPramarsValTransition';\n\nexport type formatFormPropsType = {\n options?: {\n column?: number;\n children?: {[key:string]: any}[]\n }\n parameters: {[key:string]: any};\n staticCodeMap: {[key:string]: any};\n staticOptionsMap: {[key:string]: any};\n serviceApiMap?: {[key:string]: any}; // serviceApi数据MAP,key为 attrId\n}\n\nconst formatOptionsRecursively = (data: any[], labelApiPath: string[], valApiPath: string[]): any[] => {\n return data.map((item) => {\n const option: any = {\n label: get(item, labelApiPath),\n value: get(item, valApiPath),\n };\n \n // 如果存在children属性,递归处理\n if (item.children && Array.isArray(item.children)) {\n option.children = formatOptionsRecursively(item.children, labelApiPath, valApiPath);\n }\n \n return option;\n });\n};\n\nconst formatFormProps = ({\n parameters,\n staticCodeMap,\n staticOptionsMap,\n serviceApiMap = {},\n options = {},\n}: formatFormPropsType):{[key:string]: any} => {\n const { children, column } = options;\n const res:{[key:string]: any} = {};\n const formItems: { [key: string]: any }[] = [];\n const initValues: { [key: string]: any } = {};\n if (Array.isArray(children) && children.length > 0) {\n children.forEach((attrItem) => {\n const {\n compProps: attrCompProps,\n formProps: attrFormProps,\n } = attrItem || {};\n const {\n required,\n extend,\n display: attrFormPropsDisplay,\n ...otherAttrFormProps\n } = attrFormProps || {};\n const {\n dataOptions,\n ...otherAttrCompProps\n } = attrCompProps || {};\n const formItem:{[key:string]: any} = {\n key: attrItem?.id,\n label: attrFormProps?.label,\n name: attrFormProps?.name,\n type: attrItem?.compType,\n props: otherAttrCompProps || {},\n formProps: otherAttrFormProps || {},\n originModule: attrItem, // 以下是组件配置属性,用于属性编辑\n };\n if (otherAttrFormProps?.helper && typeof otherAttrFormProps?.helper === 'string') {\n formItem.formProps = {\n ...formItem.formProps,\n helper: stringPramarsValTransition(otherAttrFormProps?.helper, parameters),\n };\n }\n if (extend?.type === 'text' && extend?.text && typeof extend?.text === 'string') {\n formItem.formProps = {\n ...formItem.formProps,\n extend: {\n ...extend,\n text: replaceParamsValue(extend?.text, parameters),\n },\n };\n } else if (extend?.type === 'controlBtns' && Array.isArray(extend?.controlBtns) && extend?.controlBtns?.length > 0) {\n formItem.formProps = {\n ...formItem.formProps,\n extend: {\n ...extend,\n controlBtns: extend?.controlBtns,\n },\n };\n } else {\n delete formItem.formProps.extend;\n }\n if (attrItem?.compType === 'table') {\n const tableProps = formatTableProps({\n options: attrItem?.compProps,\n staticCodeMap,\n parameters,\n });\n const rowKeys = getDataArr(attrItem?.compProps?.rowKey);\n formItem.props = {\n ...formItem.props,\n ...tableProps,\n rowKey: rowKeys?.length > 0 ? rowKeys?.[rowKeys?.length - 1] : 'key',\n hasSelectAll: (attrItem?.compProps?.rowSelection && attrItem?.compProps?.hasSelectAll) ? attrItem?.compProps?.hasSelectAll : null,\n rowSelection: attrItem?.compProps?.rowSelection || { type: 'radio' },\n };\n }\n if (['list', 'card'].includes(attrItem?.compType)) {\n const resProps = formatListProps({\n options: attrItem?.compProps,\n staticCodeMap,\n parameters,\n urlPrefix,\n });\n formItem.props = {\n ...resProps,\n rowSelection: attrItem?.compProps?.rowSelection || { type: 'radio' },\n };\n }\n if (attrItem?.compType === 'upload') {\n if (\n attrItem?.compProps?.data &&\n Object.keys(attrItem?.compProps?.data)?.length > 0\n ) {\n const uploadDataParams:{[key:string]: any} = {};\n Object.keys(attrItem?.compProps?.data).forEach(paramsName => {\n if (/\\$\\{(.+?)\\}/g.test(attrItem?.compProps?.data?.[paramsName])) {\n // const valParamArr = getDataArr(attrItem?.compProps?.data?.[paramsName]);\n uploadDataParams[paramsName] = getParamsContentByParamKeys(attrItem?.compProps?.data?.[paramsName], parameters);\n } else {\n uploadDataParams[paramsName] = attrItem?.compProps?.data?.[paramsName];\n }\n });\n formItem.props = {\n ...formItem.props,\n data: uploadDataParams,\n };\n }\n if (\n attrItem?.compProps?.action?.url &&\n typeof attrItem?.compProps?.action?.url === 'string'\n ) {\n formItem.props = {\n ...formItem.props,\n action: attrItem?.compProps?.action?.url,\n };\n }\n }\n let otherRules = Array.isArray(otherAttrFormProps?.rules) ? otherAttrFormProps?.rules?.filter((item: any) => !item?.required) : [];\n if (attrItem?.formProps?.defaultValue) {\n let attrDefVal:any = '';\n if (attrItem?.compType === 'upload') {\n formItem.formProps = {\n ...formItem.formProps,\n valuePropName: 'fileList',\n };\n attrDefVal = getParamsContentByParamKeys(attrItem?.formProps?.defaultValue, parameters) || [];\n } else {\n delete formItem.formProps.valuePropName;\n attrDefVal = replaceParamsValue(attrItem?.formProps?.defaultValue, parameters) || '';\n }\n initValues[otherAttrFormProps?.name] = attrDefVal;\n }\n otherRules = otherRules.map((item: {[key:string]: any}) => ({\n pattern: item?.type === 'custom' ? patternTransitionRegExp(item?.pattern) : (\n formRulsRegMap?.[item?.type] || ''\n ),\n message: item?.message,\n }));\n if (typeof attrFormPropsDisplay === 'boolean' || typeof attrFormPropsDisplay === 'string') {\n let formItemDisplay:boolean = true;\n if (typeof attrFormPropsDisplay === 'boolean') {\n formItemDisplay = attrFormPropsDisplay;\n } else if (typeof attrFormPropsDisplay === 'string' && attrFormPropsDisplay) {\n // const scriptCodeStr = stringPramarsValTransition(attrFormPropsDisplay, parameters);\n const codeExtendVal = stringScriptExecution(\n attrFormPropsDisplay,\n parameters,\n );\n formItemDisplay = codeExtendVal;\n }\n formItem.display = formItemDisplay;\n }\n if (typeof required === 'boolean' || typeof required === 'string') {\n let formItemRequired:boolean = false;\n if (typeof required === 'boolean') {\n formItemRequired = required;\n } else if (typeof required === 'string' && required) {\n // const scriptCodeStr = stringPramarsValTransition(required, parameters);\n const codeExtendVal = stringScriptExecution(required, parameters);\n formItemRequired = typeof codeExtendVal === 'boolean' ? codeExtendVal : false;\n }\n formItem.formProps = {\n ...formItem.formProps,\n rules: formItemRequired ? [{ required: formItemRequired }, ...otherRules] : otherRules,\n };\n } else {\n formItem.formProps = {\n ...formItem.formProps,\n rules: otherRules,\n };\n }\n if (dataOptions) {\n const attrItemDataOptions = dataOptions || {};\n if (attrItemDataOptions?.staticCode) {\n if (\n attrItem?.defaultValue &&\n staticCodeMap?.[attrItemDataOptions?.staticCode] &&\n staticCodeMap?.[attrItemDataOptions?.staticCode]?.[attrItem?.defaultValue]\n ) {\n initValues[attrItem?.attrCode] = staticCodeMap?.[attrItemDataOptions?.staticCode]?.[attrItem?.defaultValue];\n }\n const formatToTreeData = (optionsItems: {[key:string]: any}[]):{[key:string]: any}[] => {\n if (Array.isArray(optionsItems)) {\n return optionsItems.map(optItem => ({\n title: optItem?.label,\n value: optItem?.value,\n children: formatToTreeData(optItem?.children),\n }));\n }\n return [];\n };\n if (attrItem?.compType === 'treeSelect') {\n formItem.props = {\n ...formItem.props,\n treeData: formatToTreeData(staticOptionsMap?.[attrItemDataOptions?.staticCode]),\n };\n } else {\n formItem.props = {\n ...formItem.props,\n options: Array.isArray(staticOptionsMap?.[attrItemDataOptions?.staticCode]) ?\n staticOptionsMap?.[attrItemDataOptions?.staticCode] : [],\n };\n }\n } else if (attrItemDataOptions?.contextOptions && parameters) {\n /**\n * 处理下拉框数据源逻辑\n * 1、 数据源为页面参数\n * optLabelStr : ${pageParams.userList.item.name}\n * optValueStr: ${pageParams.userList.item.id}\n * parameters 中有个数据叫 userList,数据结构为:\n * userList: [{\n * name: '张三',\n * id: '123',\n * }]\n * 2、 数据源为页面数据源\n * optLabelStr: ${dataSource.access.listItem.ACCESS_NAME}\n * optValueStr:${dataSource.access.listItem.ID}\n * parameters 中有个数据叫 access,数据结构为:\n * dataSource:{\n * access: [{\n * ACCESS_NAME: '张三',\n * ID: '123',\n * }],\n * }\n * 首先要判断optLabelStr和optValueStr 字符串前面的配置是否一致,如果不一致则给[] ,\n * 比如 ${pageParams.userList.item.name} 和 ${pageParams.userLis.name} 就不一致\n 现在需要根据这个配置,把optLabelStr和optValueStr的值替换为实际的值 提供给下拉框的 options 属性, 如果是treeSelect, 则需要递归\n */\n\n const optLabelStr = attrItemDataOptions?.contextOptions?.label;\n const optValueStr = attrItemDataOptions?.contextOptions?.value;\n\n if (!optLabelStr || !optValueStr) {\n formItem.props = {\n ...formItem.props,\n options: [],\n };\n } else {\n // 解析路径,使用 getDataArr 来统一处理路径解析\n const labelPathArr = getDataArr(optLabelStr);\n const valuePathArr = getDataArr(optValueStr);\n\n // 检查路径长度,至少需要3段:数据源路径 + item/listItem + 字段名\n if (labelPathArr.length < 2 || valuePathArr.length < 2) {\n formItem.props = {\n ...formItem.props,\n options: [],\n };\n } else {\n // 提取数据源路径(去掉最后两个字段:item/listItem 和字段名)\n // 对于页面参数:${pageParams.userList.item.name} -> ['userList', 'item', 'name'] -> 数据源路径: ['userList']\n // 对于数据源:${dataSource.access.listItem.ACCESS_NAME} -> ['dataSource', 'access', 'listItem', 'ACCESS_NAME'] -> 数据源路径: ['dataSource', 'access']\n const labelDataSourcePath = labelPathArr.slice(0, -2);\n const valueDataSourcePath = valuePathArr.slice(0, -2);\n\n // 检查数据源路径是否一致\n const isPathConsistent = labelDataSourcePath.length === valueDataSourcePath.length &&\n labelDataSourcePath.every((item, index) => item === valueDataSourcePath[index]);\n\n if (!isPathConsistent) {\n // 路径不一致,返回空数组\n formItem.props = {\n ...formItem.props,\n options: [],\n };\n } else {\n // 路径一致,从 parameters 中获取数据\n const dataSourceData = get(parameters, labelDataSourcePath);\n\n // 检查数据是否为数组\n if (!Array.isArray(dataSourceData)) {\n formItem.props = {\n ...formItem.props,\n options: [],\n };\n } else {\n // 提取字段路径(最后两个字段:item/listItem 和字段名)\n // 对于页面参数:['userList', 'item', 'name'] -> 字段路径: ['name']\n // 对于数据源:['dataSource', 'access', 'listItem', 'ACCESS_NAME'] -> 字段路径: ['ACCESS_NAME']\n const labelFieldPath = labelPathArr.slice(-1);\n const valueFieldPath = valuePathArr.slice(-1);\n\n // 递归格式化树形数据\n const formatToTreeData = (optionsItems: {[key:string]: any}[]):{[key:string]: any}[] => {\n if (Array.isArray(optionsItems)) {\n return optionsItems.map(optItem => ({\n title: get(optItem, labelFieldPath),\n value: get(optItem, valueFieldPath),\n children: formatToTreeData(optItem?.children || []),\n }));\n }\n return [];\n };\n\n if (attrItem?.compType === 'treeSelect') {\n formItem.props = {\n ...formItem.props,\n treeData: formatToTreeData(dataSourceData),\n };\n } else {\n formItem.props = {\n ...formItem.props,\n options: formatOptionsRecursively(dataSourceData, labelFieldPath, valueFieldPath),\n };\n }\n }\n }\n }\n }\n }\n }\n formItems.push(formItem);\n });\n }\n if (typeof column === 'number' && column > 1) {\n res.formMode = 'grid';\n res.span = 24 / column;\n } else {\n res.formMode = 'default';\n delete res.span;\n }\n res.formItems = formItems;\n res.initialValues = initValues;\n return res;\n};\n\nexport default formatFormProps;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAoB;AACpB,mCAAsC;AACtC,uBAA4E;AAC5E,8BAA6B;AAC7B,6BAA4B;AAC5B,4BAA2B;AAC3B,uBAAsB;AACtB,qCAAoC;AACpC,wCAAuC;AAavC,IAAM,2BAA2B,CAAC,MAAa,cAAwB,eAAgC;AACrG,SAAO,KAAK,IAAI,CAAC,SAAS;AACxB,UAAM,SAAc;AAAA,MAClB,WAAO,mBAAI,MAAM,YAAY;AAAA,MAC7B,WAAO,mBAAI,MAAM,UAAU;AAAA,IAC7B;AAGA,QAAI,KAAK,YAAY,MAAM,QAAQ,KAAK,QAAQ,GAAG;AACjD,aAAO,WAAW,yBAAyB,KAAK,UAAU,cAAc,UAAU;AAAA,IACpF;AAEA,WAAO;AAAA,EACT,CAAC;AACH;AAEA,IAAM,kBAAkB,CAAC;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB,CAAC;AAAA,EACjB,UAAU,CAAC;AACb,MAA+C;AAC7C,QAAM,EAAE,UAAU,OAAO,IAAI;AAC7B,QAAM,MAA0B,CAAC;AACjC,QAAM,YAAsC,CAAC;AAC7C,QAAM,aAAqC,CAAC;AAC5C,MAAI,MAAM,QAAQ,QAAQ,KAAK,SAAS,SAAS,GAAG;AAClD,aAAS,QAAQ,CAAC,aAAa;AAjDnC;AAkDM,YAAM;AAAA,QACJ,WAAW;AAAA,QACX,WAAW;AAAA,MACb,IAAI,YAAY,CAAC;AACjB,YAAM;AAAA,QACJ;AAAA,QACA;AAAA,QACA,SAAS;AAAA,QACT,GAAG;AAAA,MACL,IAAI,iBAAiB,CAAC;AACtB,YAAM;AAAA,QACJ;AAAA,QACA,GAAG;AAA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A8D;AACtF,wBAAI,MAAM,QAAQ,YAAY,GAAG;AAC/B,6BAAO,aAAa,IAAI,cAAY;AAAA,wBAClC,WAAO,mBAAI,SAAS,cAAc;AAAA,wBAClC,WAAO,mBAAI,SAAS,cAAc;AAAA,wBAClC,UAAU,kBAAiB,mCAAS,aAAY,CAAC,CAAC;AAAA,sBACpD,EAAE;AAAA,oBACJ;AACA,2BAAO,CAAC;AAAA,kBACV;AAEA,uBAAI,qCAAU,cAAa,cAAc;AACvC,6BAAS,QAAQ;AAAA,sBACf,GAAG,SAAS;AAAA,sBACZ,UAAU,iBAAiB,cAAc;AAAA,oBAC3C;AAAA,kBACF,OAAO;AACL,6BAAS,QAAQ;AAAA,sBACf,GAAG,SAAS;AAAA,sBACZ,SAAS,yBAAyB,gBAAgB,gBAAgB,cAAc;AAAA,oBAClF;AAAA,kBACF;AAAA,gBACF;AAAA,cACF;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AACA,gBAAU,KAAK,QAAQ;AAAA,IACzB,CAAC;AAAA,EACH;AACA,MAAI,OAAO,WAAW,YAAY,SAAS,GAAG;AAC5C,QAAI,WAAW;AACf,QAAI,OAAO,KAAK;AAAA,EAClB,OAAO;AACL,QAAI,WAAW;AACf,WAAO,IAAI;AAAA,EACb;AACA,MAAI,YAAY;AAChB,MAAI,gBAAgB;AACpB,SAAO;AACT;AAEA,IAAO,0BAAQ;",
6
+ "names": ["stringPramarsValTransition", "formatTableProps", "formatListProps", "urlPrefix", "_a", "_b", "_c", "_d", "_e", "_f", "patternTransitionRegExp", "formRulsRegMap"]
7
7
  }
@@ -34,6 +34,7 @@ __export(formatListProps_exports, {
34
34
  module.exports = __toCommonJS(formatListProps_exports);
35
35
  var import_lodash = require("lodash");
36
36
  var import_stringScriptExecution = require("./stringScriptExecution");
37
+ var import_checkDataSourceOfFn = __toESM(require("./checkDataSourceOfFn"));
37
38
  var import_treeUtils = require("../../treeUtils");
38
39
  var import_file = require("../../file");
39
40
  var import_formatControlBtn = __toESM(require("./formatControlBtn"));
@@ -73,7 +74,7 @@ var formatListProps = ({
73
74
  attrObj.style = attrItem == null ? void 0 : attrItem.style;
74
75
  }
75
76
  if (attrItem == null ? void 0 : attrItem.defaultValue) {
76
- const attrValue = attrReplaceFn ? attrReplaceFn(attrItem, item) : replaceValueFn((attrItem == null ? void 0 : attrItem.defaultValue) || "", item);
77
+ const attrValue = attrReplaceFn ? attrReplaceFn(attrItem, item) : replaceValueFn((attrItem == null ? void 0 : attrItem.defaultValue) || "", idx, item);
77
78
  attrObj.attrName = attrItem == null ? void 0 : attrItem.attrName;
78
79
  attrObj.attrCode = attrItem == null ? void 0 : attrItem.attrCode;
79
80
  attrObj.attrValue = attrValue;
@@ -86,10 +87,11 @@ var formatListProps = ({
86
87
  };
87
88
  const buildDataObj = (item, idx, replaceValueFn, attrReplaceFn) => {
88
89
  const dataObj = {
89
- label: replaceValueFn((opt == null ? void 0 : opt.itemLabel) || "", item),
90
- content: replaceValueFn((opt == null ? void 0 : opt.itemContent) || "", item),
91
- describe: replaceValueFn((opt == null ? void 0 : opt.itemDescribe) || "", item),
92
- originItem: item
90
+ label: replaceValueFn((opt == null ? void 0 : opt.itemLabel) || "", idx, item),
91
+ content: replaceValueFn((opt == null ? void 0 : opt.itemContent) || "", idx, item),
92
+ describe: replaceValueFn((opt == null ? void 0 : opt.itemDescribe) || "", idx, item),
93
+ originItem: item,
94
+ rowIndex: idx
93
95
  };
94
96
  if (propsRes == null ? void 0 : propsRes.rowKey) {
95
97
  dataObj[propsRes.rowKey] = item == null ? void 0 : item[propsRes.rowKey];
@@ -101,9 +103,19 @@ var formatListProps = ({
101
103
  return dataObj;
102
104
  };
103
105
  if (parameters && Object.keys(parameters).length > 0) {
104
- const sourceArr = (0, import_treeUtils.getDataArr)(opt == null ? void 0 : opt.dataSource) || [];
106
+ let items = [];
107
+ let sourceArr = [];
108
+ if ((0, import_checkDataSourceOfFn.default)(opt == null ? void 0 : opt.dataSource)) {
109
+ sourceArr = [];
110
+ } else {
111
+ sourceArr = (0, import_treeUtils.getDataArr)(opt == null ? void 0 : opt.dataSource) || [];
112
+ }
105
113
  const rowKeyArr = (0, import_treeUtils.getDataArr)(opt == null ? void 0 : opt.rowKey) || [];
106
- const items = (0, import_treeUtils.getParamsContentByParamKeys)(opt == null ? void 0 : opt.dataSource, parameters) || [];
114
+ if ((0, import_checkDataSourceOfFn.default)(opt == null ? void 0 : opt.dataSource)) {
115
+ items = (0, import_stringScriptExecution.stringScriptExecution)(opt == null ? void 0 : opt.dataSource, parameters) || [];
116
+ } else {
117
+ items = (0, import_treeUtils.getParamsContentByParamKeys)(opt == null ? void 0 : opt.dataSource, parameters) || [];
118
+ }
107
119
  propsRes.rowKey = (_d = rowKeyArr.slice(-1)) == null ? void 0 : _d[0];
108
120
  const stringAttrValueTransition = (attr, pararms) => {
109
121
  let nowContent = "";
@@ -115,16 +127,20 @@ var formatListProps = ({
115
127
  if ((attr == null ? void 0 : attr.staticCode) && ((_a2 = staticCodeMap == null ? void 0 : staticCodeMap[attr == null ? void 0 : attr.staticCode]) == null ? void 0 : _a2[filedVal]) && typeof ((_b2 = staticCodeMap == null ? void 0 : staticCodeMap[attr == null ? void 0 : attr.staticCode]) == null ? void 0 : _b2[filedVal]) === "string") {
116
128
  return (_c2 = staticCodeMap == null ? void 0 : staticCodeMap[attr == null ? void 0 : attr.staticCode]) == null ? void 0 : _c2[filedVal];
117
129
  }
118
- return filedVal || "";
130
+ if (filedVal === null || filedVal === void 0) {
131
+ return "";
132
+ }
133
+ return String(filedVal);
119
134
  });
120
135
  }
121
136
  return nowContent;
122
137
  };
123
- const replaceParamsValue = (contentStr, item) => {
138
+ const replaceParamsValue = (contentStr, index, item) => {
124
139
  return (0, import_treeUtils.replaceLoopBodyParamsValue)(
125
140
  contentStr,
126
141
  {
127
142
  parameters,
143
+ loopIndex: index,
128
144
  loopParams: item,
129
145
  loopData: items,
130
146
  loopSourceArr: sourceArr
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/formatModule/helpers/formatListProps.ts"],
4
- "sourcesContent": ["import { get } from 'lodash';\nimport { stringScriptExecution } from './stringScriptExecution';\nimport { getDataArr, replaceLoopBodyParamsValue, getParamsContentByParamKeys } from '../../treeUtils';\nimport { getFileUrlById } from '../../file';\nimport formatControlBtn from './formatControlBtn';\n\nexport type formatListPropsType = {\n urlPrefix: string;\n options: {[key:string]: any};\n staticCodeMap: {[key:string]: any};\n parameters: {[key:string]: any};\n}\n\nexport type formatListPropsExportType = {[key: string]: any}\n\nconst formatListProps = ({\n urlPrefix,\n parameters,\n staticCodeMap,\n options: opt,\n}: formatListPropsType): formatListPropsExportType => {\n const propsRes: { [key: string]: any } = { ...opt };\n if (Array.isArray(opt?.icon) && opt?.icon?.length > 0) {\n propsRes.icon = getFileUrlById(opt?.icon?.[0]?.fileId, { prefix: urlPrefix });\n } else {\n propsRes.icon = '';\n }\n // 处理 attrs 属性的通用函数\n const processAttrs = (\n item: { [key: string]: any },\n idx: number,\n replaceValueFn: (contentStr: string, item: { [key: string]: any }) => string,\n attrReplaceFn?: (attrItem: { [key: string]: any }, item: { [key: string]: any }) => string,\n ): { [key: string]: any }[] => {\n const attrList: { [key: string]: any }[] = [];\n if (Array.isArray(opt?.attrs) && opt?.attrs.length > 0) {\n opt.attrs.forEach((attrItem) => {\n let attrsDisplay: boolean = true;\n if (typeof attrItem?.display === 'boolean' || typeof attrItem?.display === 'string') {\n if (typeof attrItem?.display === 'boolean') {\n attrsDisplay = attrItem?.display;\n } else if (typeof attrItem?.display === 'string' && attrItem?.display) {\n const scriptParameters = Object.assign((parameters || {}), { row: item, index: idx });\n const codeExtendVal = stringScriptExecution(\n attrItem?.display,\n scriptParameters,\n );\n attrsDisplay = codeExtendVal;\n }\n }\n if (attrsDisplay) {\n const attrObj: { [key: string]: any } = {};\n if (attrItem?.style) {\n attrObj.style = attrItem?.style;\n }\n if (attrItem?.defaultValue) {\n // 如果提供了 attrReplaceFn,优先使用它(用于支持 staticCode 翻译)\n const attrValue = attrReplaceFn\n ? attrReplaceFn(attrItem, item)\n : replaceValueFn(attrItem?.defaultValue || '', item);\n attrObj.attrName = attrItem?.attrName;\n attrObj.attrCode = attrItem?.attrCode;\n attrObj.attrValue = attrValue;\n }\n attrList.push(attrObj);\n }\n });\n }\n return attrList;\n };\n\n // 构建单个数据项对象的通用函数\n const buildDataObj = (\n item: { [key: string]: any },\n idx: number,\n replaceValueFn: (contentStr: string, item: { [key: string]: any }) => string,\n attrReplaceFn?: (attrItem: { [key: string]: any }, item: { [key: string]: any }) => string,\n ): { [key: string]: any } => {\n const dataObj: { [key: string]: any } = {\n label: replaceValueFn(opt?.itemLabel || '', item),\n content: replaceValueFn(opt?.itemContent || '', item),\n describe: replaceValueFn(opt?.itemDescribe || '', item),\n originItem: item,\n };\n \n // 设置 rowKey\n if (propsRes?.rowKey) {\n dataObj[propsRes.rowKey] = item?.[propsRes.rowKey];\n }\n \n // 处理 attrs 属性\n const attrList = processAttrs(item, idx, replaceValueFn, attrReplaceFn);\n if (attrList.length > 0) {\n dataObj.attrList = attrList;\n }\n \n return dataObj;\n };\n\n if (parameters && Object.keys(parameters).length > 0) {\n const sourceArr = getDataArr(opt?.dataSource) || [];\n const rowKeyArr = getDataArr(opt?.rowKey) || [];\n\n const items = getParamsContentByParamKeys(opt?.dataSource, parameters) || [];\n propsRes.rowKey = rowKeyArr.slice(-1)?.[0];\n const stringAttrValueTransition = (attr:{[key:string]: any}, pararms: {[key:string]: any}) => {\n let nowContent:string = '';\n if (typeof attr?.defaultValue === 'string' && attr?.defaultValue && pararms) {\n nowContent = attr?.defaultValue.replace(/\\$\\{(.+?)\\}/g, (match) => {\n const paramsPath = getDataArr(match).filter((itemKey) => !sourceArr.includes(itemKey)).slice(1);\n const filedVal = get(pararms, paramsPath);\n // 如果存在静态数组,则翻译静态数据\n if (\n attr?.staticCode &&\n staticCodeMap?.[attr?.staticCode]?.[filedVal] &&\n typeof staticCodeMap?.[attr?.staticCode]?.[filedVal] === 'string'\n ) {\n return staticCodeMap?.[attr?.staticCode]?.[filedVal];\n }\n return filedVal || '';\n });\n }\n return nowContent;\n };\n const replaceParamsValue = (\n contentStr: string,\n item: { [key: string]: any },\n ) => {\n return replaceLoopBodyParamsValue(\n contentStr, {\n parameters,\n loopParams: item,\n loopData: items,\n loopSourceArr: sourceArr,\n });\n };\n\n if (Array.isArray(items)) {\n items.forEach((item, idx) => {\n const dataObj = buildDataObj(item, idx, replaceParamsValue, stringAttrValueTransition);\n if (Array.isArray(propsRes.dataSource)) {\n propsRes.dataSource.push(dataObj);\n } else {\n propsRes.dataSource = [dataObj];\n }\n });\n }\n if (Array.isArray(opt?.controlBtns) && opt?.controlBtns.length > 0) {\n propsRes.controlBtns = opt?.controlBtns.map(btn => formatControlBtn({\n btnProps: btn,\n parameters,\n }));\n }\n }\n return propsRes;\n};\n\n\nexport default formatListProps;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAoB;AACpB,mCAAsC;AACtC,uBAAoF;AACpF,kBAA+B;AAC/B,8BAA6B;AAW7B,IAAM,kBAAkB,CAAC;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AACX,MAAsD;AApBtD;AAqBE,QAAM,WAAmC,EAAE,GAAG,IAAI;AAClD,MAAI,MAAM,QAAQ,2BAAK,IAAI,OAAK,gCAAK,SAAL,mBAAW,UAAS,GAAG;AACrD,aAAS,WAAO,6BAAe,sCAAK,SAAL,mBAAY,OAAZ,mBAAgB,QAAQ,EAAE,QAAQ,UAAU,CAAC;AAAA,EAC9E,OAAO;AACL,aAAS,OAAO;AAAA,EAClB;AAEA,QAAM,eAAe,CACnB,MACA,KACA,gBACA,kBAC6B;AAC7B,UAAM,WAAqC,CAAC;AAC5C,QAAI,MAAM,QAAQ,2BAAK,KAAK,MAAK,2BAAK,MAAM,UAAS,GAAG;AACt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AM,KAAK,oBAAoB,yBAAyB;AACrF,YAAI,MAAM,QAAQ,SAAS,UAAU,GAAG;AACtC,mBAAS,WAAW,KAAK,OAAO;AAAA,QAClC,OAAO;AACL,mBAAS,aAAa,CAAC,OAAO;AAAA,QAChC;AAAA,MACF,CAAC;AAAA,IACH;AACA,QAAI,MAAM,QAAQ,2BAAK,WAAW,MAAK,2BAAK,YAAY,UAAS,GAAG;AAClE,eAAS,cAAc,2BAAK,YAAY,IAAI,aAAO,wBAAAC,SAAiB;AAAA,QAClE,UAAU;AAAA,QACV;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO;AACT;AAGA,IAAO,0BAAQ;",
6
- "names": ["_a", "_b", "_c", "formatControlBtn"]
4
+ "sourcesContent": ["import { get } from 'lodash';\nimport { stringScriptExecution } from './stringScriptExecution';\nimport checkDataSourceOfFn from './checkDataSourceOfFn';\nimport { getDataArr, replaceLoopBodyParamsValue, getParamsContentByParamKeys } from '../../treeUtils';\nimport { getFileUrlById } from '../../file';\nimport formatControlBtn from './formatControlBtn';\n\nexport type formatListPropsType = {\n urlPrefix: string;\n options: {[key:string]: any};\n staticCodeMap: {[key:string]: any};\n parameters: {[key:string]: any};\n}\n\nexport type formatListPropsExportType = {[key: string]: any}\n\nconst formatListProps = ({\n urlPrefix,\n parameters,\n staticCodeMap,\n options: opt,\n}: formatListPropsType): formatListPropsExportType => {\n const propsRes: { [key: string]: any } = { ...opt };\n if (Array.isArray(opt?.icon) && opt?.icon?.length > 0) {\n propsRes.icon = getFileUrlById(opt?.icon?.[0]?.fileId, { prefix: urlPrefix });\n } else {\n propsRes.icon = '';\n }\n // 处理 attrs 属性的通用函数\n const processAttrs = (\n item: { [key: string]: any },\n idx: number,\n replaceValueFn: (contentStr: string, index: number, item: { [key: string]: any }) => string,\n attrReplaceFn?: (attrItem: { [key: string]: any }, item: { [key: string]: any }) => string,\n ): { [key: string]: any }[] => {\n const attrList: { [key: string]: any }[] = [];\n if (Array.isArray(opt?.attrs) && opt?.attrs.length > 0) {\n opt.attrs.forEach((attrItem) => {\n let attrsDisplay: boolean = true;\n if (typeof attrItem?.display === 'boolean' || typeof attrItem?.display === 'string') {\n if (typeof attrItem?.display === 'boolean') {\n attrsDisplay = attrItem?.display;\n } else if (typeof attrItem?.display === 'string' && attrItem?.display) {\n const scriptParameters = Object.assign((parameters || {}), { row: item, index: idx });\n const codeExtendVal = stringScriptExecution(\n attrItem?.display,\n scriptParameters,\n );\n attrsDisplay = codeExtendVal;\n }\n }\n if (attrsDisplay) {\n const attrObj: { [key: string]: any } = {};\n if (attrItem?.style) {\n attrObj.style = attrItem?.style;\n }\n if (attrItem?.defaultValue) {\n // 如果提供了 attrReplaceFn,优先使用它(用于支持 staticCode 翻译)\n const attrValue = attrReplaceFn\n ? attrReplaceFn(attrItem, item)\n : replaceValueFn(attrItem?.defaultValue || '', idx, item);\n attrObj.attrName = attrItem?.attrName;\n attrObj.attrCode = attrItem?.attrCode;\n attrObj.attrValue = attrValue;\n }\n attrList.push(attrObj);\n }\n });\n }\n return attrList;\n };\n\n // 构建单个数据项对象的通用函数\n const buildDataObj = (\n item: { [key: string]: any },\n idx: number,\n replaceValueFn: (contentStr: string, index: number, item: { [key: string]: any }) => string,\n attrReplaceFn?: (attrItem: { [key: string]: any }, item: { [key: string]: any }) => string,\n ): { [key: string]: any } => {\n const dataObj: { [key: string]: any } = {\n label: replaceValueFn(opt?.itemLabel || '', idx, item),\n content: replaceValueFn(opt?.itemContent || '', idx, item),\n describe: replaceValueFn(opt?.itemDescribe || '', idx, item),\n originItem: item,\n rowIndex: idx,\n };\n \n // 设置 rowKey\n if (propsRes?.rowKey) {\n dataObj[propsRes.rowKey] = item?.[propsRes.rowKey];\n }\n \n // 处理 attrs 属性\n const attrList = processAttrs(item, idx, replaceValueFn, attrReplaceFn);\n if (attrList.length > 0) {\n dataObj.attrList = attrList;\n }\n \n return dataObj;\n };\n\n if (parameters && Object.keys(parameters).length > 0) {\n let items:any[] = [];\n let sourceArr:string[] = [];\n if (checkDataSourceOfFn(opt?.dataSource)) {\n sourceArr = [];\n } else {\n sourceArr = getDataArr(opt?.dataSource) || [];\n }\n const rowKeyArr = getDataArr(opt?.rowKey) || [];\n\n if (checkDataSourceOfFn(opt?.dataSource)) {\n items = stringScriptExecution(opt?.dataSource, parameters) || [];\n } else {\n items = getParamsContentByParamKeys(opt?.dataSource, parameters) || [];\n }\n\n propsRes.rowKey = rowKeyArr.slice(-1)?.[0];\n const stringAttrValueTransition = (attr:{[key:string]: any}, pararms: {[key:string]: any}) => {\n let nowContent:string = '';\n if (typeof attr?.defaultValue === 'string' && attr?.defaultValue && pararms) {\n nowContent = attr?.defaultValue.replace(/\\$\\{(.+?)\\}/g, (match) => {\n const paramsPath = getDataArr(match).filter((itemKey) => !sourceArr.includes(itemKey)).slice(1);\n const filedVal = get(pararms, paramsPath);\n // 如果存在静态数组,则翻译静态数据\n if (\n attr?.staticCode &&\n staticCodeMap?.[attr?.staticCode]?.[filedVal] &&\n typeof staticCodeMap?.[attr?.staticCode]?.[filedVal] === 'string'\n ) {\n return staticCodeMap?.[attr?.staticCode]?.[filedVal];\n }\n // 修复:当值为 0 时,应该正常返回 '0',而不是空字符串\n if (filedVal === null || filedVal === undefined) {\n return '';\n }\n return String(filedVal);\n });\n }\n return nowContent;\n };\n const replaceParamsValue = (\n contentStr: string,\n index: number,\n item: { [key: string]: any },\n ) => {\n return replaceLoopBodyParamsValue(\n contentStr, {\n parameters,\n loopIndex: index,\n loopParams: item,\n loopData: items,\n loopSourceArr: sourceArr,\n });\n };\n\n if (Array.isArray(items)) {\n items.forEach((item, idx) => {\n const dataObj = buildDataObj(item, idx, replaceParamsValue, stringAttrValueTransition);\n if (Array.isArray(propsRes.dataSource)) {\n propsRes.dataSource.push(dataObj);\n } else {\n propsRes.dataSource = [dataObj];\n }\n });\n }\n if (Array.isArray(opt?.controlBtns) && opt?.controlBtns.length > 0) {\n propsRes.controlBtns = opt?.controlBtns.map(btn => formatControlBt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K,OAAO;AAAA,QAClC,OAAO;AACL,mBAAS,aAAa,CAAC,OAAO;AAAA,QAChC;AAAA,MACF,CAAC;AAAA,IACH;AACA,QAAI,MAAM,QAAQ,2BAAK,WAAW,MAAK,2BAAK,YAAY,UAAS,GAAG;AAClE,eAAS,cAAc,2BAAK,YAAY,IAAI,aAAO,wBAAAC,SAAiB;AAAA,QAClE,UAAU;AAAA,QACV;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO;AACT;AAGA,IAAO,0BAAQ;",
6
+ "names": ["checkDataSourceOfFn", "_a", "_b", "_c", "formatControlBtn"]
7
7
  }
@@ -26,9 +26,6 @@ export type formatLoopPropsType = {
26
26
  staticCodeMap?: {
27
27
  [key: string]: any;
28
28
  };
29
- serviceApiMap?: {
30
- [key: string]: any;
31
- };
32
29
  parameters?: {
33
30
  [key: string]: any;
34
31
  };
@@ -38,5 +35,5 @@ export type formatLoopPropsExportType = {
38
35
  [key: string]: any;
39
36
  }[];
40
37
  };
41
- declare const formatLoopProps: ({ parameters, serviceApiMap, options, }: formatLoopPropsType) => formatLoopPropsExportType;
38
+ declare const formatLoopProps: ({ parameters, options, }: formatLoopPropsType) => formatLoopPropsExportType;
42
39
  export default formatLoopProps;
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
18
  };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // src/formatModule/helpers/formatLoopProps.ts
@@ -23,19 +33,24 @@ __export(formatLoopProps_exports, {
23
33
  });
24
34
  module.exports = __toCommonJS(formatLoopProps_exports);
25
35
  var import_lodash = require("lodash");
36
+ var import_stringScriptExecution = require("./stringScriptExecution");
26
37
  var import_treeUtils = require("../../treeUtils");
38
+ var import_checkDataSourceOfFn = __toESM(require("./checkDataSourceOfFn"));
27
39
  var formatLoopProps = ({
28
40
  parameters,
29
- serviceApiMap,
30
41
  options = {}
31
42
  }) => {
32
43
  const {
33
- dataSource,
34
- id
44
+ dataSource
35
45
  } = options;
36
46
  let dataList = [];
37
- if (dataSource) {
38
- if (typeof dataSource === "string") {
47
+ if (typeof dataSource === "string" && dataSource) {
48
+ if ((0, import_checkDataSourceOfFn.default)(dataSource)) {
49
+ const dataSourceList = (0, import_stringScriptExecution.stringScriptExecution)(dataSource, parameters);
50
+ if (Array.isArray(dataSourceList)) {
51
+ dataList = dataSourceList;
52
+ }
53
+ } else {
39
54
  const dataSourceArr = (0, import_treeUtils.getDataArr)(dataSource);
40
55
  if (parameters) {
41
56
  const dataSourceList = (0, import_lodash.get)(
@@ -46,9 +61,6 @@ var formatLoopProps = ({
46
61
  dataList = dataSourceList;
47
62
  }
48
63
  }
49
- } else if ((dataSource == null ? void 0 : dataSource.dataSourceType) === "serviceApi" && id) {
50
- const { dataSource: dataSource2 } = (serviceApiMap == null ? void 0 : serviceApiMap[id]) || {};
51
- dataList = dataSource2;
52
64
  }
53
65
  }
54
66
  return {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/formatModule/helpers/formatLoopProps.ts"],
4
- "sourcesContent": ["import { get } from 'lodash';\nimport { getDataArr } from '../../treeUtils';\n\n/**\n * dataSource 有两种类型:\n * \"compProps\": {\n \"dataSource\": \"${root.pageParams.userList}\",\n \"rowKey\": \"${row.ID}\"\n },\n\n \"compProps\": {\n \"dataSource\": {\n \"dataSourceType\": \"serviceApi\",\n \"serviceApi\": {\n \"apiId\": \"1228988054172995584\",\n \"dataPath\": \"res.data\"\n }\n },\n \"rowKey\": \"${row.ID}\"\n },\n */\nexport type formatLoopPropsType = {\n options?: {\n dataSource?: {[key:string]: any} | string;\n id?: string;\n }\n staticCodeMap?: {[key:string]: any};\n serviceApiMap?: {[key:string]: any};\n parameters?: {[key:string]: any};\n}\n\nexport type formatLoopPropsExportType = {\n dataSource: {[key: string]: any}[]\n}\n\nconst formatLoopProps = ({\n parameters,\n serviceApiMap,\n options = {},\n}: formatLoopPropsType): formatLoopPropsExportType => {\n const {\n dataSource,\n id,\n } = options;\n let dataList:{[key:string]: any}[] = [];\n if (dataSource) {\n if (typeof dataSource === 'string') {\n const dataSourceArr = getDataArr(dataSource);\n if (parameters) {\n const dataSourceList = get(\n parameters,\n dataSourceArr,\n );\n if (Array.isArray(dataSourceList)) {\n dataList = dataSourceList;\n }\n }\n } else if (dataSource?.dataSourceType === 'serviceApi' && id) {\n const { dataSource } = serviceApiMap?.[id] || {};// 源数据\n dataList = dataSource;\n }\n }\n return {\n dataSource: dataList,\n };\n};\n\nexport default formatLoopProps;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAoB;AACpB,uBAA2B;AAkC3B,IAAM,kBAAkB,CAAC;AAAA,EACvB;AAAA,EACA;AAAA,EACA,UAAU,CAAC;AACb,MAAsD;AACpD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,EACF,IAAI;AACJ,MAAI,WAAiC,CAAC;AACtC,MAAI,YAAY;AACd,QAAI,OAAO,eAAe,UAAU;AAClC,YAAM,oBAAgB,6BAAW,UAAU;AAC3C,UAAI,YAAY;AACd,cAAM,qBAAiB;AAAA,UACrB;AAAA,UACA;AAAA,QACF;AACA,YAAI,MAAM,QAAQ,cAAc,GAAG;AACjC,qBAAW;AAAA,QACb;AAAA,MACF;AAAA,IACF,YAAW,yCAAY,oBAAmB,gBAAgB,IAAI;AAC5D,YAAM,EAAE,YAAAA,YAAW,KAAI,+CAAgB,QAAO,CAAC;AAC/C,iBAAWA;AAAA,IACb;AAAA,EACF;AACA,SAAO;AAAA,IACL,YAAY;AAAA,EACd;AACF;AAEA,IAAO,0BAAQ;",
6
- "names": ["dataSource"]
4
+ "sourcesContent": ["import { get } from 'lodash';\nimport { stringScriptExecution } from './stringScriptExecution';\nimport { getDataArr } from '../../treeUtils';\nimport checkDataSourceOfFn from './checkDataSourceOfFn';\n\n/**\n * dataSource 有两种类型:\n * \"compProps\": {\n \"dataSource\": \"${root.pageParams.userList}\",\n \"rowKey\": \"${row.ID}\"\n },\n\n \"compProps\": {\n \"dataSource\": {\n \"dataSourceType\": \"serviceApi\",\n \"serviceApi\": {\n \"apiId\": \"1228988054172995584\",\n \"dataPath\": \"res.data\"\n }\n },\n \"rowKey\": \"${row.ID}\"\n },\n */\nexport type formatLoopPropsType = {\n options?: {\n dataSource?: {[key:string]: any} | string;\n id?: string;\n }\n staticCodeMap?: {[key:string]: any};\n parameters?: {[key:string]: any};\n}\n\nexport type formatLoopPropsExportType = {\n dataSource: {[key: string]: any}[]\n}\n\nconst formatLoopProps = ({\n parameters,\n options = {},\n}: formatLoopPropsType): formatLoopPropsExportType => {\n const {\n dataSource,\n } = options;\n let dataList:{[key:string]: any}[] = [];\n if (typeof dataSource === 'string' && dataSource) {\n if (checkDataSourceOfFn(dataSource)) {\n const dataSourceList = stringScriptExecution(dataSource, parameters);\n if (Array.isArray(dataSourceList)) {\n dataList = dataSourceList;\n }\n } else {\n const dataSourceArr = getDataArr(dataSource);\n if (parameters) {\n const dataSourceList = get(\n parameters,\n dataSourceArr,\n );\n if (Array.isArray(dataSourceList)) {\n dataList = dataSourceList;\n }\n }\n }\n }\n return {\n dataSource: dataList,\n };\n};\n\nexport default formatLoopProps;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAoB;AACpB,mCAAsC;AACtC,uBAA2B;AAC3B,iCAAgC;AAiChC,IAAM,kBAAkB,CAAC;AAAA,EACvB;AAAA,EACA,UAAU,CAAC;AACb,MAAsD;AACpD,QAAM;AAAA,IACJ;AAAA,EACF,IAAI;AACJ,MAAI,WAAiC,CAAC;AACtC,MAAI,OAAO,eAAe,YAAY,YAAY;AAChD,YAAI,2BAAAA,SAAoB,UAAU,GAAG;AACnC,YAAM,qBAAiB,oDAAsB,YAAY,UAAU;AACnE,UAAI,MAAM,QAAQ,cAAc,GAAG;AACjC,mBAAW;AAAA,MACb;AAAA,IACF,OAAO;AACL,YAAM,oBAAgB,6BAAW,UAAU;AAC3C,UAAI,YAAY;AACd,cAAM,qBAAiB;AAAA,UACrB;AAAA,UACA;AAAA,QACF;AACA,YAAI,MAAM,QAAQ,cAAc,GAAG;AACjC,qBAAW;AAAA,QACb;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,SAAO;AAAA,IACL,YAAY;AAAA,EACd;AACF;AAEA,IAAO,0BAAQ;",
6
+ "names": ["checkDataSourceOfFn"]
7
7
  }
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
18
  };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // src/formatModule/helpers/formatStepsProps.ts
@@ -24,6 +34,8 @@ __export(formatStepsProps_exports, {
24
34
  module.exports = __toCommonJS(formatStepsProps_exports);
25
35
  var import_treeUtils = require("../../treeUtils");
26
36
  var import_lodash = require("lodash");
37
+ var import_checkDataSourceOfFn = __toESM(require("./checkDataSourceOfFn"));
38
+ var import_stringScriptExecution = require("./stringScriptExecution");
27
39
  var formatStepsProps = ({
28
40
  parameters,
29
41
  options = {}
@@ -40,41 +52,46 @@ var formatStepsProps = ({
40
52
  size: "small"
41
53
  };
42
54
  if (dataSource) {
43
- const dataSourceArr = (0, import_treeUtils.getDataArr)(dataSource);
44
- if (parameters) {
45
- const dataSourceList = (0, import_lodash.get)(
55
+ let dataSourceList = [];
56
+ let dataSourceArr = [];
57
+ if ((0, import_checkDataSourceOfFn.default)(dataSource)) {
58
+ dataSourceList = (0, import_stringScriptExecution.stringScriptExecution)(dataSource) || [];
59
+ } else {
60
+ dataSourceArr = (0, import_treeUtils.getDataArr)(dataSource);
61
+ dataSourceList = (0, import_lodash.get)(
46
62
  parameters,
47
63
  dataSourceArr
48
64
  );
49
- const replaceParamsValue = (contentStr, item) => {
50
- return (0, import_treeUtils.replaceLoopBodyParamsValue)(
51
- contentStr,
52
- {
53
- parameters,
54
- loopParams: item,
55
- loopData: dataSourceList,
56
- loopSourceArr: dataSourceArr
57
- }
58
- );
59
- };
60
- if (Array.isArray(dataSourceList)) {
61
- res.items = dataSourceList.map((item) => {
62
- let recordStatus = status && replaceParamsValue(status, item) ? replaceParamsValue(status, item) : "";
63
- if (statusMap && Object.keys(statusMap).length > 0) {
64
- Object.keys(statusMap).forEach((key) => {
65
- const statusValue = `${statusMap == null ? void 0 : statusMap[key]}` || "";
66
- if (recordStatus && statusValue && `${recordStatus}` === statusValue) {
67
- recordStatus = key;
68
- }
69
- });
70
- }
71
- return {
72
- title: title ? replaceParamsValue(title, item) : "",
73
- description: description ? replaceParamsValue(description, item) : "",
74
- status: recordStatus || "default"
75
- };
76
- });
77
- }
65
+ }
66
+ const replaceParamsValue = (contentStr, index, item) => {
67
+ return (0, import_treeUtils.replaceLoopBodyParamsValue)(
68
+ contentStr,
69
+ {
70
+ parameters,
71
+ loopIndex: index,
72
+ loopParams: item,
73
+ loopData: dataSourceList,
74
+ loopSourceArr: dataSourceArr
75
+ }
76
+ );
77
+ };
78
+ if (Array.isArray(dataSourceList)) {
79
+ res.items = dataSourceList.map((item, idx) => {
80
+ let recordStatus = status && replaceParamsValue(status, idx, item) ? replaceParamsValue(status, idx, item) : "";
81
+ if (statusMap && Object.keys(statusMap).length > 0) {
82
+ Object.keys(statusMap).forEach((key) => {
83
+ const statusValue = `${statusMap == null ? void 0 : statusMap[key]}` || "";
84
+ if (recordStatus && statusValue && `${recordStatus}` === statusValue) {
85
+ recordStatus = key;
86
+ }
87
+ });
88
+ }
89
+ return {
90
+ title: title ? replaceParamsValue(title, idx, item) : "",
91
+ description: description ? replaceParamsValue(description, idx, item) : "",
92
+ status: recordStatus || "default"
93
+ };
94
+ });
78
95
  }
79
96
  if (direction === "horizontal") {
80
97
  res.labelPlacement = "vertical";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/formatModule/helpers/formatStepsProps.ts"],
4
- "sourcesContent": ["import { getDataArr, replaceLoopBodyParamsValue } from '../../treeUtils';\nimport { get } from 'lodash';\n\nexport type formatImagePropsType = {\n options?: {\n dataSource?: string,\n title?: string,\n description?: string,\n status?: string,\n size?: string,\n direction?: string,\n statusMap?: {\n wait?: string,\n process?: string,\n finish?: string,\n error?: string,\n }\n }\n parameters?: {[key:string]: any};\n}\n\nconst formatStepsProps = ({\n parameters,\n options = {},\n}: formatImagePropsType):{[key:string]: any} => {\n const {\n dataSource,\n title,\n description,\n status,\n direction,\n statusMap,\n } = options;\n const res:{[key:string]: any} = {\n size: 'small',\n };\n\n if (dataSource) {\n const dataSourceArr = getDataArr(dataSource);\n if (parameters) {\n const dataSourceList = get(\n parameters,\n dataSourceArr,\n );\n\n const replaceParamsValue = (\n contentStr: string,\n item: { [key: string]: any },\n ) => {\n return replaceLoopBodyParamsValue(\n contentStr, {\n parameters,\n loopParams: item,\n loopData: dataSourceList,\n loopSourceArr: dataSourceArr,\n });\n };\n if (Array.isArray(dataSourceList)) {\n res.items = dataSourceList.map(item => {\n // 获取状态值\n let recordStatus = status && replaceParamsValue(status, item) ? replaceParamsValue(status, item) : '';\n // 根据状态映射,转换状态值为步骤状态\n if (statusMap && Object.keys(statusMap).length > 0) {\n Object.keys(statusMap).forEach(key => {\n const statusValue = `${statusMap?.[key as keyof typeof statusMap]}` || '';\n if (recordStatus && statusValue && `${recordStatus}` === statusValue) {\n recordStatus = key;\n }\n });\n }\n return ({\n title: title ? replaceParamsValue(title, item) : '',\n description: description ? replaceParamsValue(description, item) : '',\n status: recordStatus || 'default',\n });\n });\n }\n }\n if (direction === 'horizontal') {\n res.labelPlacement = 'vertical';\n } else if (res?.labelPlacement) {\n delete res.labelPlacement;\n }\n }\n return res;\n};\n\nexport default formatStepsProps;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAuD;AACvD,oBAAoB;AAoBpB,IAAM,mBAAmB,CAAC;AAAA,EACxB;AAAA,EACA,UAAU,CAAC;AACb,MAAgD;AAC9C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,MAA0B;AAAA,IAC9B,MAAM;AAAA,EACR;AAEA,MAAI,YAAY;AACd,UAAM,oBAAgB,6BAAW,UAAU;AAC3C,QAAI,YAAY;AACd,YAAM,qBAAiB;AAAA,QACrB;AAAA,QACA;AAAA,MACF;AAEA,YAAM,qBAAqB,CACzB,YACA,SACG;AACH,mBAAO;AAAA,UACL;AAAA,UAAY;AAAA,YACV;AAAA,YACA,YAAY;AAAA,YACZ,UAAU;AAAA,YACV,eAAe;AAAA,UACjB;AAAA,QAAC;AAAA,MACL;AACA,UAAI,MAAM,QAAQ,cAAc,GAAG;AACjC,YAAI,QAAQ,eAAe,IAAI,UAAQ;AAErC,cAAI,eAAe,UAAU,mBAAmB,QAAQ,IAAI,IAAI,mBAAmB,QAAQ,IAAI,IAAI;AAEnG,cAAI,aAAa,OAAO,KAAK,SAAS,EAAE,SAAS,GAAG;AAClD,mBAAO,KAAK,SAAS,EAAE,QAAQ,SAAO;AACpC,oBAAM,cAAc,GAAG,uCAAY,UAAoC;AACvE,kBAAI,gBAAgB,eAAe,GAAG,mBAAmB,aAAa;AACpE,+BAAe;AAAA,cACjB;AAAA,YACF,CAAC;AAAA,UACH;AACA,iBAAQ;AAAA,YACN,OAAO,QAAQ,mBAAmB,OAAO,IAAI,IAAI;AAAA,YACjD,aAAa,cAAc,mBAAmB,aAAa,IAAI,IAAI;AAAA,YACnE,QAAQ,gBAAgB;AAAA,UAC1B;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AACA,QAAI,cAAc,cAAc;AAC9B,UAAI,iBAAiB;AAAA,IACvB,WAAW,2BAAK,gBAAgB;AAC9B,aAAO,IAAI;AAAA,IACb;AAAA,EACF;AACA,SAAO;AACT;AAEA,IAAO,2BAAQ;",
6
- "names": []
4
+ "sourcesContent": ["import { getDataArr, replaceLoopBodyParamsValue } from '../../treeUtils';\nimport { get } from 'lodash';\nimport checkDataSourceOfFn from './checkDataSourceOfFn';\nimport { stringScriptExecution } from './stringScriptExecution';\n\nexport type formatImagePropsType = {\n options?: {\n dataSource?: string,\n title?: string,\n description?: string,\n status?: string,\n size?: string,\n direction?: string,\n statusMap?: {\n wait?: string,\n process?: string,\n finish?: string,\n error?: string,\n }\n }\n parameters?: {[key:string]: any};\n}\n\nconst formatStepsProps = ({\n parameters,\n options = {},\n}: formatImagePropsType):{[key:string]: any} => {\n const {\n dataSource,\n title,\n description,\n status,\n direction,\n statusMap,\n } = options;\n const res:{[key:string]: any} = {\n size: 'small',\n };\n\n if (dataSource) {\n let dataSourceList: any[] = [];\n let dataSourceArr: string[] = [];\n if (checkDataSourceOfFn(dataSource)) {\n dataSourceList = stringScriptExecution(dataSource) || [];\n } else {\n dataSourceArr = getDataArr(dataSource);\n dataSourceList = get(\n parameters,\n dataSourceArr,\n );\n }\n const replaceParamsValue = (\n contentStr: string,\n index: number,\n item: { [key: string]: any },\n ) => {\n return replaceLoopBodyParamsValue(\n contentStr, {\n parameters,\n loopIndex: index,\n loopParams: item,\n loopData: dataSourceList,\n loopSourceArr: dataSourceArr,\n });\n };\n if (Array.isArray(dataSourceList)) {\n res.items = dataSourceList.map((item, idx) => {\n // 获取状态值\n let recordStatus = status && replaceParamsValue(status, idx, item) ? replaceParamsValue(status, idx, item) : '';\n // 根据状态映射,转换状态值为步骤状态\n if (statusMap && Object.keys(statusMap).length > 0) {\n Object.keys(statusMap).forEach(key => {\n const statusValue = `${statusMap?.[key as keyof typeof statusMap]}` || '';\n if (recordStatus && statusValue && `${recordStatus}` === statusValue) {\n recordStatus = key;\n }\n });\n }\n return ({\n title: title ? replaceParamsValue(title, idx, item) : '',\n description: description ? replaceParamsValue(description, idx, item) : '',\n status: recordStatus || 'default',\n });\n });\n }\n if (direction === 'horizontal') {\n res.labelPlacement = 'vertical';\n } else if (res?.labelPlacement) {\n delete res.labelPlacement;\n }\n }\n return res;\n};\n\nexport default formatStepsProps;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AA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