@boteteam/utils 0.0.30 → 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
@@ -6,6 +6,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
6
6
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
7
  import { get } from 'lodash';
8
8
  import { stringScriptExecution } from "./stringScriptExecution";
9
+ import checkDataSourceOfFn from "./checkDataSourceOfFn";
9
10
  import { getDataArr, replaceLoopBodyParamsValue, getParamsContentByParamKeys } from "../../treeUtils";
10
11
  import { getFileUrlById } from "../../file";
11
12
  import formatControlBtn from "./formatControlBtn";
@@ -49,7 +50,7 @@ var formatListProps = function formatListProps(_ref) {
49
50
  }
50
51
  if (attrItem !== null && attrItem !== void 0 && attrItem.defaultValue) {
51
52
  // 如果提供了 attrReplaceFn,优先使用它(用于支持 staticCode 翻译)
52
- var attrValue = attrReplaceFn ? attrReplaceFn(attrItem, item) : replaceValueFn((attrItem === null || attrItem === void 0 ? void 0 : attrItem.defaultValue) || '', item);
53
+ var attrValue = attrReplaceFn ? attrReplaceFn(attrItem, item) : replaceValueFn((attrItem === null || attrItem === void 0 ? void 0 : attrItem.defaultValue) || '', idx, item);
53
54
  attrObj.attrName = attrItem === null || attrItem === void 0 ? void 0 : attrItem.attrName;
54
55
  attrObj.attrCode = attrItem === null || attrItem === void 0 ? void 0 : attrItem.attrCode;
55
56
  attrObj.attrValue = attrValue;
@@ -64,10 +65,11 @@ var formatListProps = function formatListProps(_ref) {
64
65
  // 构建单个数据项对象的通用函数
65
66
  var buildDataObj = function buildDataObj(item, idx, replaceValueFn, attrReplaceFn) {
66
67
  var dataObj = {
67
- label: replaceValueFn((opt === null || opt === void 0 ? void 0 : opt.itemLabel) || '', item),
68
- content: replaceValueFn((opt === null || opt === void 0 ? void 0 : opt.itemContent) || '', item),
69
- describe: replaceValueFn((opt === null || opt === void 0 ? void 0 : opt.itemDescribe) || '', item),
70
- originItem: item
68
+ label: replaceValueFn((opt === null || opt === void 0 ? void 0 : opt.itemLabel) || '', idx, item),
69
+ content: replaceValueFn((opt === null || opt === void 0 ? void 0 : opt.itemContent) || '', idx, item),
70
+ describe: replaceValueFn((opt === null || opt === void 0 ? void 0 : opt.itemDescribe) || '', idx, item),
71
+ originItem: item,
72
+ rowIndex: idx
71
73
  };
72
74
 
73
75
  // 设置 rowKey
@@ -84,9 +86,19 @@ var formatListProps = function formatListProps(_ref) {
84
86
  };
85
87
  if (parameters && Object.keys(parameters).length > 0) {
86
88
  var _rowKeyArr$slice;
87
- var sourceArr = getDataArr(opt === null || opt === void 0 ? void 0 : opt.dataSource) || [];
89
+ var items = [];
90
+ var sourceArr = [];
91
+ if (checkDataSourceOfFn(opt === null || opt === void 0 ? void 0 : opt.dataSource)) {
92
+ sourceArr = [];
93
+ } else {
94
+ sourceArr = getDataArr(opt === null || opt === void 0 ? void 0 : opt.dataSource) || [];
95
+ }
88
96
  var rowKeyArr = getDataArr(opt === null || opt === void 0 ? void 0 : opt.rowKey) || [];
89
- var items = getParamsContentByParamKeys(opt === null || opt === void 0 ? void 0 : opt.dataSource, parameters) || [];
97
+ if (checkDataSourceOfFn(opt === null || opt === void 0 ? void 0 : opt.dataSource)) {
98
+ items = stringScriptExecution(opt === null || opt === void 0 ? void 0 : opt.dataSource, parameters) || [];
99
+ } else {
100
+ items = getParamsContentByParamKeys(opt === null || opt === void 0 ? void 0 : opt.dataSource, parameters) || [];
101
+ }
90
102
  propsRes.rowKey = (_rowKeyArr$slice = rowKeyArr.slice(-1)) === null || _rowKeyArr$slice === void 0 ? void 0 : _rowKeyArr$slice[0];
91
103
  var stringAttrValueTransition = function stringAttrValueTransition(attr, pararms) {
92
104
  var nowContent = '';
@@ -102,14 +114,19 @@ var formatListProps = function formatListProps(_ref) {
102
114
  var _staticCodeMap$attr$s3;
103
115
  return staticCodeMap === null || staticCodeMap === void 0 || (_staticCodeMap$attr$s3 = staticCodeMap[attr === null || attr === void 0 ? void 0 : attr.staticCode]) === null || _staticCodeMap$attr$s3 === void 0 ? void 0 : _staticCodeMap$attr$s3[filedVal];
104
116
  }
105
- return filedVal || '';
117
+ // 修复:当值为 0 时,应该正常返回 '0',而不是空字符串
118
+ if (filedVal === null || filedVal === undefined) {
119
+ return '';
120
+ }
121
+ return String(filedVal);
106
122
  });
107
123
  }
108
124
  return nowContent;
109
125
  };
110
- var replaceParamsValue = function replaceParamsValue(contentStr, item) {
126
+ var replaceParamsValue = function replaceParamsValue(contentStr, index, item) {
111
127
  return replaceLoopBodyParamsValue(contentStr, {
112
128
  parameters: parameters,
129
+ loopIndex: index,
113
130
  loopParams: item,
114
131
  loopData: items,
115
132
  loopSourceArr: sourceArr
@@ -1 +1 @@
1
- {"version":3,"names":["get","stringScriptExecution","getDataArr","replaceLoopBodyParamsValue","getParamsContentByParamKeys","getFileUrlById","formatControlBtn","formatListProps","_ref","_opt$icon","urlPrefix","parameters","staticCodeMap","opt","options","propsRes","_objectSpread","Array","isArray","icon","length","_opt$icon2","fileId","prefix","processAttrs","item","idx","replaceValueFn","attrReplaceFn","attrList","attrs","forEach","attrItem","attrsDisplay","display","scriptParameters","Object","assign","row","index","codeExtendVal","attrObj","style","defaultValue","attrValue","attrName","attrCode","push","buildDataObj","dataObj","label","itemLabel","content","itemContent","describe","itemDescribe","originItem","rowKey","keys","_rowKeyArr$slice","sourceArr","dataSource","rowKeyArr","items","slice","stringAttrValueTransition","attr","pararms","nowContent","replace","match","_staticCodeMap$attr$s","_staticCodeMap$attr$s2","paramsPath","filter","itemKey","includes","filedVal","staticCode","_staticCodeMap$attr$s3","replaceParamsValue","contentStr","loopParams","loopData","loopSourceArr","controlBtns","map","btn","btnProps"],"sources":["../../../../src/formatModule/helpers/formatListProps.ts"],"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"],"mappings":";;;;;;AAAA,SAASA,GAAG,QAAQ,QAAQ;AAC5B,SAASC,qBAAqB;AAC9B,SAASC,UAAU,EAAEC,0BAA0B,EAAEC,2BAA2B;AAC5E,SAASC,cAAc;AACvB,OAAOC,gBAAgB;AAWvB,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAKiC;EAAA,IAAAC,SAAA;EA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I,EAAEC,GAAG,EAAEsD,kBAAkB,EAAEf,yBAAyB,CAAC;QACtF,IAAIhD,KAAK,CAACC,OAAO,CAACH,QAAQ,CAAC8C,UAAU,CAAC,EAAE;UACtC9C,QAAQ,CAAC8C,UAAU,CAACd,IAAI,CAACE,OAAO,CAAC;QACnC,CAAC,MAAM;UACLlC,QAAQ,CAAC8C,UAAU,GAAG,CAACZ,OAAO,CAAC;QACjC;MACF,CAAC,CAAC;IACJ;IACA,IAAIhC,KAAK,CAACC,OAAO,CAACL,GAAG,aAAHA,GAAG,uBAAHA,GAAG,CAAEwE,WAAW,CAAC,IAAI,CAAAxE,GAAG,aAAHA,GAAG,uBAAHA,GAAG,CAAEwE,WAAW,CAACjE,MAAM,IAAG,CAAC,EAAE;MAClEL,QAAQ,CAACsE,WAAW,GAAGxE,GAAG,aAAHA,GAAG,uBAAHA,GAAG,CAAEwE,WAAW,CAACC,GAAG,CAAC,UAAAC,GAAG;QAAA,OAAIjF,gBAAgB,CAAC;UAClEkF,QAAQ,EAAED,GAAG;UACb5E,UAAU,EAAVA;QACF,CAAC,CAAC;MAAA,EAAC;IACL;EACF;EACA,OAAOI,QAAQ;AACjB,CAAC;AAGD,eAAeR,eAAe"}
1
+ {"version":3,"names":["get","stringScriptExecution","checkDataSourceOfFn","getDataArr","replaceLoopBodyParamsValue","getParamsContentByParamKeys","getFileUrlById","formatControlBtn","formatListProps","_ref","_opt$icon","urlPrefix","parameters","staticCodeMap","opt","options","propsRes","_objectSpread","Array","isArray","icon","length","_opt$icon2","fileId","prefix","processAttrs","item","idx","replaceValueFn","attrReplaceFn","attrList","attrs","forEach","attrItem","attrsDisplay","display","scriptParameters","Object","assign","row","index","codeExtendVal","attrObj","style","defaultValue","attrValue","attrName","attrCode","push","buildDataObj","dataObj","label","itemLabel","content","itemContent","describe","itemDescribe","originItem","rowIndex","rowKey","keys","_rowKeyArr$slice","items","sourceArr","dataSource","rowKeyArr","slice","stringAttrValueTransition","attr","pararms","nowContent","replace","match","_staticCodeMap$attr$s","_staticCodeMap$attr$s2","paramsPath","filter","itemKey","includes","filedVal","staticCode","_staticCodeMap$attr$s3","undefined","String","replaceParamsValue","contentStr","loopIndex","loopParams","loopData","loopSourceArr","controlBtns","map","btn","btnProps"],"sources":["../../../../src/formatModule/helpers/formatListProps.ts"],"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 => formatControlBtn({\n btnProps: btn,\n parameters,\n }));\n }\n }\n return propsRes;\n};\n\n\nexport default formatListProps;\n"],"mappings":";;;;;;AAAA,SAASA,GAAG,QAAQ,QAAQ;AAC5B,SAASC,qBAAqB;AAC9B,OAAOC,mBAAmB;AAC1B,SAASC,UAAU,EAAEC,0BAA0B,EAAEC,2BAA2B;AAC5E,SAASC,cAAc;AACvB,OAAOC,gBAAgB;AAWvB,IAAMC,eAA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G,uBAAHA,GAAG,CAAE4E,WAAW,CAACC,GAAG,CAAC,UAAAC,GAAG;QAAA,OAAIrF,gBAAgB,CAAC;UAClEsF,QAAQ,EAAED,GAAG;UACbhF,UAAU,EAAVA;QACF,CAAC,CAAC;MAAA,EAAC;IACL;EACF;EACA,OAAOI,QAAQ;AACjB,CAAC;AAGD,eAAeR,eAAe"}
@@ -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,5 +1,7 @@
1
1
  import { get } from 'lodash';
2
+ import { stringScriptExecution } from "./stringScriptExecution";
2
3
  import { getDataArr } from "../../treeUtils";
4
+ import checkDataSourceOfFn from "./checkDataSourceOfFn";
3
5
 
4
6
  /**
5
7
  * dataSource 有两种类型:
@@ -22,25 +24,24 @@ import { getDataArr } from "../../treeUtils";
22
24
 
23
25
  var formatLoopProps = function formatLoopProps(_ref) {
24
26
  var parameters = _ref.parameters,
25
- serviceApiMap = _ref.serviceApiMap,
26
27
  _ref$options = _ref.options,
27
28
  options = _ref$options === void 0 ? {} : _ref$options;
28
- var dataSource = options.dataSource,
29
- id = options.id;
29
+ var dataSource = options.dataSource;
30
30
  var dataList = [];
31
- if (dataSource) {
32
- if (typeof dataSource === 'string') {
31
+ if (typeof dataSource === 'string' && dataSource) {
32
+ if (checkDataSourceOfFn(dataSource)) {
33
+ var dataSourceList = stringScriptExecution(dataSource, parameters);
34
+ if (Array.isArray(dataSourceList)) {
35
+ dataList = dataSourceList;
36
+ }
37
+ } else {
33
38
  var dataSourceArr = getDataArr(dataSource);
34
39
  if (parameters) {
35
- var dataSourceList = get(parameters, dataSourceArr);
36
- if (Array.isArray(dataSourceList)) {
37
- dataList = dataSourceList;
40
+ var _dataSourceList = get(parameters, dataSourceArr);
41
+ if (Array.isArray(_dataSourceList)) {
42
+ dataList = _dataSourceList;
38
43
  }
39
44
  }
40
- } else if ((dataSource === null || dataSource === void 0 ? void 0 : dataSource.dataSourceType) === 'serviceApi' && id) {
41
- var _ref2 = (serviceApiMap === null || serviceApiMap === void 0 ? void 0 : serviceApiMap[id]) || {},
42
- _dataSource = _ref2.dataSource; // 源数据
43
- dataList = _dataSource;
44
45
  }
45
46
  }
46
47
  return {
@@ -1 +1 @@
1
- {"version":3,"names":["get","getDataArr","formatLoopProps","_ref","parameters","serviceApiMap","_ref$options","options","dataSource","id","dataList","dataSourceArr","dataSourceList","Array","isArray","dataSourceType","_ref2"],"sources":["../../../../src/formatModule/helpers/formatLoopProps.ts"],"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"],"mappings":"AAAA,SAASA,GAAG,QAAQ,QAAQ;AAC5B,SAASC,UAAU;;AAEnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeA,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAIiC;EAAA,IAHpDC,UAAU,GAAAD,IAAA,CAAVC,UAAU;IACVC,aAAa,GAAAF,IAAA,CAAbE,aAAa;IAAAC,YAAA,GAAAH,IAAA,CACbI,OAAO;IAAPA,OAAO,GAAAD,YAAA,cAAG,CAAC,CAAC,GAAAA,YAAA;EAEZ,IACEE,UAAU,GAERD,OAAO,CAFTC,UAAU;IACVC,EAAE,GACAF,OAAO,CADTE,EAAE;EAEJ,IAAIC,QAA8B,GAAG,EAAE;EACvC,IAAIF,UAAU,EAAE;IACd,IAAI,OAAOA,UAAU,KAAK,QAAQ,EAAE;MAClC,IAAMG,aAAa,GAAGV,UAAU,CAACO,UAAU,CAAC;MAC5C,IAAIJ,UAAU,EAAE;QACd,IAAMQ,cAAc,GAAGZ,GAAG,CACxBI,UAAU,EACVO,aACF,CAAC;QACD,IAAIE,KAAK,CAACC,OAAO,CAACF,cAAc,CAAC,EAAE;UACjCF,QAAQ,GAAGE,cAAc;QAC3B;MACF;IACF,CAAC,MAAM,IAAI,CAAAJ,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEO,cAAc,MAAK,YAAY,IAAIN,EAAE,EAAE;MAC5D,IAAAO,KAAA,GAAuB,CAAAX,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAGI,EAAE,CAAC,KAAI,CAAC,CAAC;QAAxCD,WAAU,GAAAQ,KAAA,CAAVR,UAAU,CAA+B;MACjDE,QAAQ,GAAGF,WAAU;IACvB;EACF;EACA,OAAO;IACLA,UAAU,EAAEE;EACd,CAAC;AACH,CAAC;AAED,eAAeR,eAAe"}
1
+ {"version":3,"names":["get","stringScriptExecution","getDataArr","checkDataSourceOfFn","formatLoopProps","_ref","parameters","_ref$options","options","dataSource","dataList","dataSourceList","Array","isArray","dataSourceArr"],"sources":["../../../../src/formatModule/helpers/formatLoopProps.ts"],"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"],"mappings":"AAAA,SAASA,GAAG,QAAQ,QAAQ;AAC5B,SAASC,qBAAqB;AAC9B,SAASC,UAAU;AACnB,OAAOC,mBAAmB;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAGiC;EAAA,IAFpDC,UAAU,GAAAD,IAAA,CAAVC,UAAU;IAAAC,YAAA,GAAAF,IAAA,CACVG,OAAO;IAAPA,OAAO,GAAAD,YAAA,cAAG,CAAC,CAAC,GAAAA,YAAA;EAEZ,IACEE,UAAU,GACRD,OAAO,CADTC,UAAU;EAEZ,IAAIC,QAA8B,GAAG,EAAE;EACvC,IAAI,OAAOD,UAAU,KAAK,QAAQ,IAAIA,UAAU,EAAE;IAChD,IAAIN,mBAAmB,CAACM,UAAU,CAAC,EAAE;MACnC,IAAME,cAAc,GAAGV,qBAAqB,CAACQ,UAAU,EAAEH,UAAU,CAAC;MACpE,IAAIM,KAAK,CAACC,OAAO,CAACF,cAAc,CAAC,EAAE;QACjCD,QAAQ,GAAGC,cAAc;MAC3B;IACF,CAAC,MAAM;MACL,IAAMG,aAAa,GAAGZ,UAAU,CAACO,UAAU,CAAC;MAC5C,IAAIH,UAAU,EAAE;QACd,IAAMK,eAAc,GAAGX,GAAG,CACxBM,UAAU,EACVQ,aACF,CAAC;QACD,IAAIF,KAAK,CAACC,OAAO,CAACF,eAAc,CAAC,EAAE;UACjCD,QAAQ,GAAGC,eAAc;QAC3B;MACF;IACF;EACF;EACA,OAAO;IACLF,UAAU,EAAEC;EACd,CAAC;AACH,CAAC;AAED,eAAeN,eAAe"}
@@ -1,5 +1,7 @@
1
1
  import { getDataArr, replaceLoopBodyParamsValue } from "../../treeUtils";
2
2
  import { get } from 'lodash';
3
+ import checkDataSourceOfFn from "./checkDataSourceOfFn";
4
+ import { stringScriptExecution } from "./stringScriptExecution";
3
5
  var formatStepsProps = function formatStepsProps(_ref) {
4
6
  var parameters = _ref.parameters,
5
7
  _ref$options = _ref.options,
@@ -14,37 +16,42 @@ var formatStepsProps = function formatStepsProps(_ref) {
14
16
  size: 'small'
15
17
  };
16
18
  if (dataSource) {
17
- var dataSourceArr = getDataArr(dataSource);
18
- if (parameters) {
19
- var dataSourceList = get(parameters, dataSourceArr);
20
- var replaceParamsValue = function replaceParamsValue(contentStr, item) {
21
- return replaceLoopBodyParamsValue(contentStr, {
22
- parameters: parameters,
23
- loopParams: item,
24
- loopData: dataSourceList,
25
- loopSourceArr: dataSourceArr
26
- });
27
- };
28
- if (Array.isArray(dataSourceList)) {
29
- res.items = dataSourceList.map(function (item) {
30
- // 获取状态值
31
- var recordStatus = status && replaceParamsValue(status, item) ? replaceParamsValue(status, item) : '';
32
- // 根据状态映射,转换状态值为步骤状态
33
- if (statusMap && Object.keys(statusMap).length > 0) {
34
- Object.keys(statusMap).forEach(function (key) {
35
- var statusValue = "".concat(statusMap === null || statusMap === void 0 ? void 0 : statusMap[key]) || '';
36
- if (recordStatus && statusValue && "".concat(recordStatus) === statusValue) {
37
- recordStatus = key;
38
- }
39
- });
40
- }
41
- return {
42
- title: title ? replaceParamsValue(title, item) : '',
43
- description: description ? replaceParamsValue(description, item) : '',
44
- status: recordStatus || 'default'
45
- };
46
- });
47
- }
19
+ var dataSourceList = [];
20
+ var dataSourceArr = [];
21
+ if (checkDataSourceOfFn(dataSource)) {
22
+ dataSourceList = stringScriptExecution(dataSource) || [];
23
+ } else {
24
+ dataSourceArr = getDataArr(dataSource);
25
+ dataSourceList = get(parameters, dataSourceArr);
26
+ }
27
+ var replaceParamsValue = function replaceParamsValue(contentStr, index, item) {
28
+ return replaceLoopBodyParamsValue(contentStr, {
29
+ parameters: parameters,
30
+ loopIndex: index,
31
+ loopParams: item,
32
+ loopData: dataSourceList,
33
+ loopSourceArr: dataSourceArr
34
+ });
35
+ };
36
+ if (Array.isArray(dataSourceList)) {
37
+ res.items = dataSourceList.map(function (item, idx) {
38
+ // 获取状态值
39
+ var recordStatus = status && replaceParamsValue(status, idx, item) ? replaceParamsValue(status, idx, item) : '';
40
+ // 根据状态映射,转换状态值为步骤状态
41
+ if (statusMap && Object.keys(statusMap).length > 0) {
42
+ Object.keys(statusMap).forEach(function (key) {
43
+ var statusValue = "".concat(statusMap === null || statusMap === void 0 ? void 0 : statusMap[key]) || '';
44
+ if (recordStatus && statusValue && "".concat(recordStatus) === statusValue) {
45
+ recordStatus = key;
46
+ }
47
+ });
48
+ }
49
+ return {
50
+ title: title ? replaceParamsValue(title, idx, item) : '',
51
+ description: description ? replaceParamsValue(description, idx, item) : '',
52
+ status: recordStatus || 'default'
53
+ };
54
+ });
48
55
  }
49
56
  if (direction === 'horizontal') {
50
57
  res.labelPlacement = 'vertical';
@@ -1 +1 @@
1
- {"version":3,"names":["getDataArr","replaceLoopBodyParamsValue","get","formatStepsProps","_ref","parameters","_ref$options","options","dataSource","title","description","status","direction","statusMap","res","size","dataSourceArr","dataSourceList","replaceParamsValue","contentStr","item","loopParams","loopData","loopSourceArr","Array","isArray","items","map","recordStatus","Object","keys","length","forEach","key","statusValue","concat","labelPlacement"],"sources":["../../../../src/formatModule/helpers/formatStepsProps.ts"],"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"],"mappings":"AAAA,SAASA,UAAU,EAAEC,0BAA0B;AAC/C,SAASC,GAAG,QAAQ,QAAQ;AAoB5B,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAG0B;EAAA,IAF9CC,UAAU,GAAAD,IAAA,CAAVC,UAAU;IAAAC,YAAA,GAAAF,IAAA,CACVG,OAAO;IAAPA,OAAO,GAAAD,YAAA,cAAG,CAAC,CAAC,GAAAA,YAAA;EAEZ,IACEE,UAAU,GAMRD,OAAO,CANTC,UAAU;IACVC,KAAK,GAKHF,OAAO,CALTE,KAAK;IACLC,WAAW,GAITH,OAAO,CAJTG,WAAW;IACXC,MAAM,GAGJJ,OAAO,CAHTI,MAAM;IACNC,SAAS,GAEPL,OAAO,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ACA,OAAQ;YACNxB,KAAK,EAAEA,KAAK,GAAGS,kBAAkB,CAACT,KAAK,EAAEW,IAAI,CAAC,GAAG,EAAE;YACnDV,WAAW,EAAEA,WAAW,GAAGQ,kBAAkB,CAACR,WAAW,EAAEU,IAAI,CAAC,GAAG,EAAE;YACrET,MAAM,EAAEiB,YAAY,IAAI;UAC1B,CAAC;QACH,CAAC,CAAC;MACJ;IACF;IACA,IAAIhB,SAAS,KAAK,YAAY,EAAE;MAC9BE,GAAG,CAACsB,cAAc,GAAG,UAAU;IACjC,CAAC,MAAM,IAAItB,GAAG,aAAHA,GAAG,eAAHA,GAAG,CAAEsB,cAAc,EAAE;MAC9B,OAAOtB,GAAG,CAACsB,cAAc;IAC3B;EACF;EACA,OAAOtB,GAAG;AACZ,CAAC;AAED,eAAeX,gBAAgB"}
1
+ {"version":3,"names":["getDataArr","replaceLoopBodyParamsValue","get","checkDataSourceOfFn","stringScriptExecution","formatStepsProps","_ref","parameters","_ref$options","options","dataSource","title","description","status","direction","statusMap","res","size","dataSourceList","dataSourceArr","replaceParamsValue","contentStr","index","item","loopIndex","loopParams","loopData","loopSourceArr","Array","isArray","items","map","idx","recordStatus","Object","keys","length","forEach","key","statusValue","concat","labelPlacement"],"sources":["../../../../src/formatModule/helpers/formatStepsProps.ts"],"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"],"mappings":"AAAA,SAASA,UAAU,EAAEC,0BAA0B;AAC/C,SAASC,GAAG,QAAQ,QAAQ;AAC5B,OAAOC,mBAAmB;AAC1B,SAASC,qBAAqB;AAoB9B,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAG0B;EAAA,IAF9CC,UAAU,GAAAD,IAAA,CAAVC,UAAU;IAAAC,YAAA,GAAAF,IAAA,CACVG,OAAO;IAAPA,OAAO,GAAAD,YAAA,cAAG,CAAC,CAAC,GAAAA,YAAA;EAEZ,IACEE,UAAU,GAMRD,OAAO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I,CAACpB,SAAS,CAAC,CAACqB,MAAM,GAAG,CAAC,EAAE;UAClDF,MAAM,CAACC,IAAI,CAACpB,SAAS,CAAC,CAACsB,OAAO,CAAC,UAAAC,GAAG,EAAI;YACpC,IAAMC,WAAW,GAAG,GAAAC,MAAA,CAAGzB,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAGuB,GAAG,CAA2B,KAAM,EAAE;YACzE,IAAIL,YAAY,IAAIM,WAAW,IAAI,GAAAC,MAAA,CAAGP,YAAY,MAAOM,WAAW,EAAE;cACpEN,YAAY,GAAGK,GAAG;YACpB;UACF,CAAC,CAAC;QACJ;QACA,OAAQ;UACN3B,KAAK,EAAEA,KAAK,GAAGS,kBAAkB,CAACT,KAAK,EAAEqB,GAAG,EAAET,IAAI,CAAC,GAAG,EAAE;UACxDX,WAAW,EAAEA,WAAW,GAAGQ,kBAAkB,CAACR,WAAW,EAAEoB,GAAG,EAAET,IAAI,CAAC,GAAG,EAAE;UAC1EV,MAAM,EAAEoB,YAAY,IAAI;QAC1B,CAAC;MACH,CAAC,CAAC;IACJ;IACA,IAAInB,SAAS,KAAK,YAAY,EAAE;MAC9BE,GAAG,CAACyB,cAAc,GAAG,UAAU;IACjC,CAAC,MAAM,IAAIzB,GAAG,aAAHA,GAAG,eAAHA,GAAG,CAAEyB,cAAc,EAAE;MAC9B,OAAOzB,GAAG,CAACyB,cAAc;IAC3B;EACF;EACA,OAAOzB,GAAG;AACZ,CAAC;AAED,eAAeX,gBAAgB"}
@@ -1,8 +1,21 @@
1
- declare const formatStyleProps: (props: {
1
+ export declare const getStylePainter: (style: {
2
2
  [key: string]: any;
3
- }, parentModuleProps?: {
3
+ }, children?: {
4
4
  [key: string]: any;
5
- } | null | undefined) => {
5
+ }[] | undefined) => {
6
6
  [key: string]: any;
7
7
  };
8
+ declare const formatStyleProps: ({ moduleData, parentModuleData, parameters, }: {
9
+ moduleData: {
10
+ [key: string]: any;
11
+ };
12
+ parentModuleData?: {
13
+ [key: string]: any;
14
+ } | null | undefined;
15
+ parameters?: {
16
+ [key: string]: any;
17
+ } | undefined;
18
+ }) => {
19
+ [x: string]: any;
20
+ };
8
21
  export default formatStyleProps;
@@ -5,14 +5,11 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
7
  import { cloneDeep } from 'lodash';
8
- var formatStyleProps = function formatStyleProps(props, parentModuleProps) {
9
- var _Object$keys, _parentModuleProps$co, _compProps$style6, _compProps$style7;
10
- var cloneProps = props ? cloneDeep(props) : {};
11
- var _cloneProps$compProps = cloneProps.compProps,
12
- compProps = _cloneProps$compProps === void 0 ? {} : _cloneProps$compProps;
13
- var _ref = compProps || {},
14
- _ref$style = _ref.style,
15
- style = _ref$style === void 0 ? {} : _ref$style;
8
+ import { stringScriptExecution } from "./stringScriptExecution";
9
+ import cssToJson from "./cssToJson";
10
+ export var getStylePainter = function getStylePainter(style, children) {
11
+ var _Object$keys;
12
+ var styleObj = {};
16
13
  var alignKey1 = ['column', 'column-reverse'].includes(style === null || style === void 0 ? void 0 : style['flex-direction']) ? 'alignItems' : 'justifyContent';
17
14
  var alignKey2 = !(style !== null && style !== void 0 && style['flex-direction']) || ['row', 'row-reverse'].includes(style === null || style === void 0 ? void 0 : style['flex-direction']) ? 'alignItems' : 'justifyContent';
18
15
  var alignStyleMap = {
@@ -26,51 +23,101 @@ var formatStyleProps = function formatStyleProps(props, parentModuleProps) {
26
23
  bottomCenter: _defineProperty(_defineProperty({}, alignKey1, 'center'), alignKey2, 'flex-end'),
27
24
  rightBottom: _defineProperty(_defineProperty({}, alignKey1, 'flex-end'), alignKey2, 'flex-end')
28
25
  };
29
- var styleObj = {};
30
- if (compProps.style && ((_Object$keys = Object.keys(compProps.style)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.length) > 0) {
31
- Object.keys(compProps.style).forEach(function (styleKey) {
32
- var _compProps$style;
33
- if ((_compProps$style = compProps.style) !== null && _compProps$style !== void 0 && _compProps$style[styleKey]) {
26
+ if (style && ((_Object$keys = Object.keys(style)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.length) > 0) {
27
+ Object.keys(style).forEach(function (styleKey) {
28
+ if (['borderWidth', 'borderColor', 'borderStyle', 'alignMode', 'gridColumns', 'inlineStyle'].includes(styleKey)) return;
29
+ if (style !== null && style !== void 0 && style[styleKey]) {
34
30
  if (['padding', 'margin'].includes(styleKey)) {
35
- var _compProps$style2, _compProps$style3, _compProps$style4;
36
- styleObj[styleKey] = Array.isArray((_compProps$style2 = compProps.style) === null || _compProps$style2 === void 0 ? void 0 : _compProps$style2[styleKey]) ? (_compProps$style3 = compProps.style) === null || _compProps$style3 === void 0 ? void 0 : _compProps$style3[styleKey].join(' ') : (_compProps$style4 = compProps.style) === null || _compProps$style4 === void 0 ? void 0 : _compProps$style4[styleKey];
37
- } else if (!['gridColumns', 'alignMode'].includes(styleKey)) {
38
- var _compProps$style5;
39
- styleObj[styleKey] = (_compProps$style5 = compProps.style) === null || _compProps$style5 === void 0 ? void 0 : _compProps$style5[styleKey];
31
+ styleObj[styleKey] = Array.isArray(style === null || style === void 0 ? void 0 : style[styleKey]) ? style === null || style === void 0 ? void 0 : style[styleKey].join(' ') : style === null || style === void 0 ? void 0 : style[styleKey];
32
+ } else if (styleKey === 'borderRadius') {
33
+ if (Array.isArray(style === null || style === void 0 ? void 0 : style[styleKey])) {
34
+ styleObj[styleKey] = style === null || style === void 0 ? void 0 : style[styleKey].join(' ');
35
+ } else {
36
+ styleObj[styleKey] = style === null || style === void 0 ? void 0 : style[styleKey];
37
+ }
38
+ } else {
39
+ styleObj[styleKey] = style === null || style === void 0 ? void 0 : style[styleKey];
40
40
  }
41
41
  }
42
42
  });
43
+ if (style !== null && style !== void 0 && style.alignMode && alignStyleMap !== null && alignStyleMap !== void 0 && alignStyleMap[style === null || style === void 0 ? void 0 : style.alignMode]) {
44
+ styleObj = _objectSpread(_objectSpread({}, styleObj), alignStyleMap === null || alignStyleMap === void 0 ? void 0 : alignStyleMap[style === null || style === void 0 ? void 0 : style.alignMode]);
45
+ }
46
+ if (style !== null && style !== void 0 && style.borderWidth && style !== null && style !== void 0 && style.borderColor) {
47
+ if (Array.isArray(style === null || style === void 0 ? void 0 : style.borderWidth)) {
48
+ style === null || style === void 0 || style.borderWidth.forEach(function (width, index) {
49
+ var borderSide = ['Top', 'Right', 'Bottom', 'Left'][index];
50
+ if (width) {
51
+ styleObj["border".concat(borderSide, "Width")] = "".concat(width);
52
+ styleObj["border".concat(borderSide, "Color")] = style === null || style === void 0 ? void 0 : style.borderColor;
53
+ styleObj["border".concat(borderSide, "Style")] = (style === null || style === void 0 ? void 0 : style.borderStyle) || 'solid';
54
+ }
55
+ });
56
+ } else {
57
+ styleObj.border = "".concat(style === null || style === void 0 ? void 0 : style.borderWidth, " ").concat((style === null || style === void 0 ? void 0 : style.borderStyle) || 'solid', " ").concat(style === null || style === void 0 ? void 0 : style.borderColor);
58
+ }
59
+ }
60
+ if ((style === null || style === void 0 ? void 0 : style.display) === 'grid') {
61
+ var _gridColumns = [];
62
+ if (Array.isArray(children)) {
63
+ children.forEach(function (col) {
64
+ var _col$compProps;
65
+ if (col !== null && col !== void 0 && (_col$compProps = col.compProps) !== null && _col$compProps !== void 0 && (_col$compProps = _col$compProps.style) !== null && _col$compProps !== void 0 && _col$compProps.width) {
66
+ _gridColumns.push(col.compProps.style.width);
67
+ } else {
68
+ _gridColumns.push('1fr');
69
+ }
70
+ });
71
+ }
72
+ if ((style === null || style === void 0 ? void 0 : style.gridColumns) > 1) {
73
+ styleObj['grid-template-columns'] = "repeat(".concat(style.gridColumns, ", minmax(0, ").concat(Math.ceil(100 / (style === null || style === void 0 ? void 0 : style.gridColumns)), "%))");
74
+ } else if ((_gridColumns === null || _gridColumns === void 0 ? void 0 : _gridColumns.length) > 0) {
75
+ styleObj['grid-template-columns'] = "".concat(_gridColumns.join(' '));
76
+ } else if (style.gridColumns > 1) {
77
+ styleObj['grid-template-columns'] = "repeat(".concat(style.gridColumns, ", 1fr)");
78
+ }
79
+ } else if (styleObj['grid-template-columns']) {
80
+ delete styleObj['grid-template-columns'];
81
+ }
82
+ }
83
+ if (style !== null && style !== void 0 && style.inlineStyle) {
84
+ var inlineStyleObj = cssToJson(style === null || style === void 0 ? void 0 : style.inlineStyle);
85
+ styleObj = _objectSpread(_objectSpread({}, styleObj), inlineStyleObj);
43
86
  }
44
- if ((parentModuleProps === null || parentModuleProps === void 0 || (_parentModuleProps$co = parentModuleProps.compProps) === null || _parentModuleProps$co === void 0 || (_parentModuleProps$co = _parentModuleProps$co.style) === null || _parentModuleProps$co === void 0 ? void 0 : _parentModuleProps$co.display) === 'flex' && !((_compProps$style6 = compProps.style) !== null && _compProps$style6 !== void 0 && _compProps$style6.width)) {
45
- styleObj.flex = '1';
87
+ return styleObj;
88
+ };
89
+ var formatStyleProps = function formatStyleProps(_ref) {
90
+ var _parentModuleData$com, _compProps$style;
91
+ var moduleData = _ref.moduleData,
92
+ parentModuleData = _ref.parentModuleData,
93
+ parameters = _ref.parameters;
94
+ var cloneProps = moduleData ? cloneDeep(moduleData) : {};
95
+ var _cloneProps$compProps = cloneProps.compProps,
96
+ compProps = _cloneProps$compProps === void 0 ? {} : _cloneProps$compProps,
97
+ compType = cloneProps.compType;
98
+ var _ref2 = compProps || {},
99
+ _ref2$style = _ref2.style,
100
+ style = _ref2$style === void 0 ? {} : _ref2$style,
101
+ styleScript = _ref2.styleScript;
102
+ var scriptStyleObj = {};
103
+ var styleObj = getStylePainter(style, moduleData === null || moduleData === void 0 ? void 0 : moduleData.children);
104
+ if ((parentModuleData === null || parentModuleData === void 0 || (_parentModuleData$com = parentModuleData.compProps) === null || _parentModuleData$com === void 0 || (_parentModuleData$com = _parentModuleData$com.style) === null || _parentModuleData$com === void 0 ? void 0 : _parentModuleData$com.display) === 'flex' && !['icon'].includes(compType) && !((_compProps$style = compProps.style) !== null && _compProps$style !== void 0 && _compProps$style.width)) {
105
+ var _compProps$style2, _compProps$style3;
106
+ // 内敛元素不需要设置flex
107
+ if (!((_compProps$style2 = compProps.style) !== null && _compProps$style2 !== void 0 && _compProps$style2.display) || ['block', 'flex', 'grid'].includes((_compProps$style3 = compProps.style) === null || _compProps$style3 === void 0 ? void 0 : _compProps$style3.display)) {
108
+ styleObj.flex = '1';
109
+ }
46
110
  } else if (styleObj !== null && styleObj !== void 0 && styleObj.flex) {
47
111
  delete styleObj.flex;
48
112
  }
49
- if ((compProps === null || compProps === void 0 || (_compProps$style7 = compProps.style) === null || _compProps$style7 === void 0 ? void 0 : _compProps$style7.display) === 'grid') {
50
- var _compProps$style8;
51
- var _gridColumns = [];
52
- if (Array.isArray(props === null || props === void 0 ? void 0 : props.children)) {
53
- props === null || props === void 0 || props.children.forEach(function (col) {
54
- var _col$compProps;
55
- if (col !== null && col !== void 0 && (_col$compProps = col.compProps) !== null && _col$compProps !== void 0 && (_col$compProps = _col$compProps.style) !== null && _col$compProps !== void 0 && _col$compProps.width) {
56
- _gridColumns.push(col.compProps.style.width);
57
- } else {
58
- _gridColumns.push('1fr');
59
- }
60
- });
61
- }
62
- if ((compProps === null || compProps === void 0 || (_compProps$style8 = compProps.style) === null || _compProps$style8 === void 0 ? void 0 : _compProps$style8.gridColumns) > 1) {
63
- var _compProps$style9;
64
- styleObj['grid-template-columns'] = "repeat(".concat(compProps.style.gridColumns, ", minmax(0, ").concat(Math.ceil(100 / (compProps === null || compProps === void 0 || (_compProps$style9 = compProps.style) === null || _compProps$style9 === void 0 ? void 0 : _compProps$style9.gridColumns)), "%))");
65
- } else if ((_gridColumns === null || _gridColumns === void 0 ? void 0 : _gridColumns.length) > 0) {
66
- styleObj['grid-template-columns'] = "".concat(_gridColumns.join(' '));
67
- } else if (compProps.style.gridColumns > 1) {
68
- styleObj['grid-template-columns'] = "repeat(".concat(compProps.style.gridColumns, ", 1fr)");
113
+ if (styleScript) {
114
+ var _Object$keys2;
115
+ var scriptStyleResult = stringScriptExecution(styleScript, parameters);
116
+ if (scriptStyleResult && _typeof(scriptStyleResult) === 'object' && ((_Object$keys2 = Object.keys(scriptStyleResult)) === null || _Object$keys2 === void 0 ? void 0 : _Object$keys2.length) > 0) {
117
+ scriptStyleObj = scriptStyleResult;
69
118
  }
70
- } else if (styleObj['grid-template-columns']) {
71
- delete styleObj['grid-template-columns'];
72
119
  }
73
- return _objectSpread(_objectSpread({}, styleObj), alignStyleMap[style === null || style === void 0 ? void 0 : style.alignMode] || {});
120
+ return _objectSpread(_objectSpread({}, styleObj), scriptStyleObj);
74
121
  };
75
122
  export default formatStyleProps;
76
123
  //# sourceMappingURL=formatStyleProps.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["cloneDeep","formatStyleProps","props","parentModuleProps","_Object$keys","_parentModuleProps$co","_compProps$style6","_compProps$style7","cloneProps","_cloneProps$compProps","compProps","_ref","_ref$style","style","alignKey1","includes","alignKey2","alignStyleMap","leftTop","_defineProperty","topCenter","rightTop","leftCenter","center","rightCenter","leftBottom","bottomCenter","rightBottom","styleObj","Object","keys","length","forEach","styleKey","_compProps$style","_compProps$style2","_compProps$style3","_compProps$style4","Array","isArray","join","_compProps$style5","display","width","flex","_compProps$style8","_gridColumns","children","col","_col$compProps","push","gridColumns","_compProps$style9","concat","Math","ceil","_objectSpread","alignMode"],"sources":["../../../../src/formatModule/helpers/formatStyleProps.ts"],"sourcesContent":["import { cloneDeep } from 'lodash';\n\nconst formatStyleProps = (props: {[key:string]: any}, parentModuleProps?: {[key:string]: any}|null):{[key:string]: any} => {\n const cloneProps: {[key:string]: any} = props ? cloneDeep(props) : {};\n const { compProps = {} } = cloneProps;\n const { style = {} } = compProps || {};\n\n const alignKey1 = ['column', 'column-reverse'].includes(style?.['flex-direction']) ? 'alignItems' : 'justifyContent';\n const alignKey2 = !style?.['flex-direction'] || ['row', 'row-reverse'].includes(style?.['flex-direction']) ? 'alignItems' : 'justifyContent';\n const alignStyleMap:{[key:string]: {[key:string]: string}} = {\n leftTop: {\n [alignKey1]: 'flex-start',\n [alignKey2]: 'flex-start',\n },\n topCenter: {\n [alignKey1]: 'center',\n [alignKey2]: 'flex-start',\n },\n rightTop: {\n [alignKey1]: 'flex-end',\n [alignKey2]: 'flex-start',\n },\n leftCenter: {\n [alignKey1]: 'flex-start',\n [alignKey2]: 'center',\n },\n center: {\n [alignKey1]: 'center',\n [alignKey2]: 'center',\n },\n rightCenter: {\n [alignKey1]: 'flex-end',\n [alignKey2]: 'center',\n },\n leftBottom: {\n [alignKey1]: 'flex-start',\n [alignKey2]: 'flex-end',\n },\n bottomCenter: {\n [alignKey1]: 'center',\n [alignKey2]: 'flex-end',\n },\n rightBottom: {\n [alignKey1]: 'flex-end',\n [alignKey2]: 'flex-end',\n },\n };\n\n const styleObj:{[key:string]: any} = {};\n if (compProps.style && Object.keys(compProps.style)?.length > 0) {\n Object.keys(compProps.style).forEach(styleKey => {\n if (compProps.style?.[styleKey]) {\n if (['padding', 'margin'].includes(styleKey)) {\n styleObj[styleKey] = Array.isArray(compProps.style?.[styleKey]) ?\n compProps.style?.[styleKey].join(' ') : compProps.style?.[styleKey];\n } else if (!['gridColumns', 'alignMode'].includes(styleKey)) {\n styleObj[styleKey] = compProps.style?.[styleKey];\n }\n }\n });\n }\n\n if (parentModuleProps?.compProps?.style?.display === 'flex' && !compProps.style?.width) {\n styleObj.flex = '1';\n } else if (styleObj?.flex) {\n delete styleObj.flex;\n }\n\n if (compProps?.style?.display === 'grid') {\n const _gridColumns:string[] = [];\n if (Array.isArray(props?.children)) {\n props?.children.forEach((col:any) => {\n if (col?.compProps?.style?.width) {\n _gridColumns.push(col.compProps.style.width);\n } else {\n _gridColumns.push('1fr');\n }\n });\n }\n if (compProps?.style?.gridColumns > 1) {\n styleObj['grid-template-columns'] = `repeat(${compProps.style.gridColumns}, minmax(0, ${Math.ceil(100 / compProps?.style?.gridColumns)}%))`;\n } else if (_gridColumns?.length > 0) {\n styleObj['grid-template-columns'] = `${_gridColumns.join(' ')}`;\n } else if (compProps.style.gridColumns > 1) {\n styleObj['grid-template-columns'] = `repeat(${compProps.style.gridColumns}, 1fr)`;\n }\n } else if (styleObj['grid-template-columns']) {\n delete styleObj['grid-template-columns'];\n }\n \n return {\n ...styleObj,\n ...(alignStyleMap[style?.alignMode] || {}),\n };\n};\n\nexport default formatStyleProps;\n"],"mappings":";;;;;;AAAA,SAASA,SAAS,QAAQ,QAAQ;AAElC,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,KAA0B,EAAEC,iBAA4C,EAAyB;EAAA,IAAAC,YAAA,EAAAC,qBAAA,EAAAC,iBAAA,EAAAC,iBAAA;EACzH,IAAMC,UAA+B,GAAGN,KAAK,GAAGF,SAAS,CAACE,KAAK,CAAC,GAAG,CAAC,CAAC;EACrE,IAAAO,qBAAA,GAA2BD,UAAU,CAA7BE,SAAS;IAATA,SAAS,GAAAD,qBAAA,cAAG,CAAC,CAAC,GAAAA,qBAAA;EACtB,IAAAE,IAAA,GAAuBD,SAAS,IAAI,CAAC,CAAC;IAAAE,UAAA,GAAAD,IAAA,CAA9BE,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAG,CAAC,CAAC,GAAAA,UAAA;EAElB,IAAME,SAAS,GAAG,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAACC,QAAQ,CAACF,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAG,gBAAgB,CAAC,CAAC,GAAG,YAAY,GAAG,gBAAgB;EACpH,IAAMG,SAAS,GAAG,EAACH,KAAK,aAALA,KAAK,eAALA,KAAK,CAAG,gBAAgB,CAAC,KAAI,CAAC,KAAK,EAAE,aAAa,CAAC,CAACE,QAAQ,CAACF,KAAK,aAALA,KA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A,CAAeC,IAAI,CAACC,IAAI,CAAC,GAAG,IAAG7C,SAAS,aAATA,SAAS,gBAAA0C,iBAAA,GAAT1C,SAAS,CAAEG,KAAK,cAAAuC,iBAAA,uBAAhBA,iBAAA,CAAkBD,WAAW,EAAC,QAAK;IAC7I,CAAC,MAAM,IAAI,CAAAL,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEf,MAAM,IAAG,CAAC,EAAE;MACnCH,QAAQ,CAAC,uBAAuB,CAAC,MAAAyB,MAAA,CAAMP,YAAY,CAACN,IAAI,CAAC,GAAG,CAAC,CAAE;IACjE,CAAC,MAAM,IAAI9B,SAAS,CAACG,KAAK,CAACsC,WAAW,GAAG,CAAC,EAAE;MAC1CvB,QAAQ,CAAC,uBAAuB,CAAC,aAAAyB,MAAA,CAAa3C,SAAS,CAACG,KAAK,CAACsC,WAAW,WAAQ;IACnF;EACF,CAAC,MAAM,IAAIvB,QAAQ,CAAC,uBAAuB,CAAC,EAAE;IAC5C,OAAOA,QAAQ,CAAC,uBAAuB,CAAC;EAC1C;EAEA,OAAA4B,aAAA,CAAAA,aAAA,KACK5B,QAAQ,GACPX,aAAa,CAACJ,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAE4C,SAAS,CAAC,IAAI,CAAC,CAAC;AAE7C,CAAC;AAED,eAAexD,gBAAgB"}
1
+ {"version":3,"names":["cloneDeep","stringScriptExecution","cssToJson","getStylePainter","style","children","_Object$keys","styleObj","alignKey1","includes","alignKey2","alignStyleMap","leftTop","_defineProperty","topCenter","rightTop","leftCenter","center","rightCenter","leftBottom","bottomCenter","rightBottom","Object","keys","length","forEach","styleKey","Array","isArray","join","alignMode","_objectSpread","borderWidth","borderColor","width","index","borderSide","concat","borderStyle","border","display","_gridColumns","col","_col$compProps","compProps","push","gridColumns","Math","ceil","inlineStyle","inlineStyleObj","formatStyleProps","_ref","_parentModuleData$com","_compProps$style","moduleData","parentModuleData","parameters","cloneProps","_cloneProps$compProps","compType","_ref2","_ref2$style","styleScript","scriptStyleObj","_compProps$style2","_compProps$style3","flex","_Object$keys2","scriptStyleResult","_typeof"],"sources":["../../../../src/formatModule/helpers/formatStyleProps.ts"],"sourcesContent":["import { cloneDeep } from 'lodash';\nimport { stringScriptExecution } from './stringScriptExecution';\nimport cssToJson from './cssToJson';\n\nexport const getStylePainter = (style: {[key:string]: any}, children?: {[key:string]: any}[]) => {\n let styleObj:{[key:string]: any} = {};\n const alignKey1 = ['column', 'column-reverse'].includes(style?.['flex-direction']) ? 'alignItems' : 'justifyContent';\n const alignKey2 = !style?.['flex-direction'] || ['row', 'row-reverse'].includes(style?.['flex-direction']) ? 'alignItems' : 'justifyContent';\n const alignStyleMap:{[key:string]: {[key:string]: string}} = {\n leftTop: {\n [alignKey1]: 'flex-start',\n [alignKey2]: 'flex-start',\n },\n topCenter: {\n [alignKey1]: 'center',\n [alignKey2]: 'flex-start',\n },\n rightTop: {\n [alignKey1]: 'flex-end',\n [alignKey2]: 'flex-start',\n },\n leftCenter: {\n [alignKey1]: 'flex-start',\n [alignKey2]: 'center',\n },\n center: {\n [alignKey1]: 'center',\n [alignKey2]: 'center',\n },\n rightCenter: {\n [alignKey1]: 'flex-end',\n [alignKey2]: 'center',\n },\n leftBottom: {\n [alignKey1]: 'flex-start',\n [alignKey2]: 'flex-end',\n },\n bottomCenter: {\n [alignKey1]: 'center',\n [alignKey2]: 'flex-end',\n },\n rightBottom: {\n [alignKey1]: 'flex-end',\n [alignKey2]: 'flex-end',\n },\n };\n if (style && Object.keys(style)?.length > 0) {\n Object.keys(style).forEach(styleKey => {\n if (['borderWidth', 'borderColor', 'borderStyle', 'alignMode', 'gridColumns', 'inlineStyle'].includes(styleKey)) return;\n if (style?.[styleKey]) {\n if (['padding', 'margin'].includes(styleKey)) {\n styleObj[styleKey] = Array.isArray(style?.[styleKey]) ?\n style?.[styleKey].join(' ') : style?.[styleKey];\n } else if (styleKey === 'borderRadius') {\n if (Array.isArray(style?.[styleKey])) {\n styleObj[styleKey] = style?.[styleKey].join(' ');\n } else {\n styleObj[styleKey] = style?.[styleKey];\n }\n } else {\n styleObj[styleKey] = style?.[styleKey];\n }\n }\n });\n if (style?.alignMode && alignStyleMap?.[style?.alignMode]) {\n styleObj = { ...styleObj, ...alignStyleMap?.[style?.alignMode] };\n }\n if (style?.borderWidth && style?.borderColor) {\n if (Array.isArray(style?.borderWidth)) {\n style?.borderWidth.forEach((width:string, index:number) => {\n const borderSide = ['Top', 'Right', 'Bottom', 'Left'][index];\n if (width) {\n styleObj[`border${borderSide}Width`] = `${width}`;\n styleObj[`border${borderSide}Color`] = style?.borderColor;\n styleObj[`border${borderSide}Style`] = style?.borderStyle || 'solid';\n }\n });\n } else {\n styleObj.border = `${style?.borderWidth} ${style?.borderStyle || 'solid'} ${style?.borderColor}`;\n }\n }\n if (style?.display === 'grid') {\n const _gridColumns:string[] = [];\n if (Array.isArray(children)) {\n children.forEach((col:any) => {\n if (col?.compProps?.style?.width) {\n _gridColumns.push(col.compProps.style.width);\n } else {\n _gridColumns.push('1fr');\n }\n });\n }\n if (style?.gridColumns > 1) {\n styleObj['grid-template-columns'] = `repeat(${style.gridColumns}, minmax(0, ${Math.ceil(100 / style?.gridColumns)}%))`;\n } else if (_gridColumns?.length > 0) {\n styleObj['grid-template-columns'] = `${_gridColumns.join(' ')}`;\n } else if (style.gridColumns > 1) {\n styleObj['grid-template-columns'] = `repeat(${style.gridColumns}, 1fr)`;\n }\n } else if (styleObj['grid-template-columns']) {\n delete styleObj['grid-template-columns'];\n }\n }\n if (style?.inlineStyle) {\n const inlineStyleObj = cssToJson(style?.inlineStyle);\n styleObj = { ...styleObj, ...inlineStyleObj };\n }\n return styleObj;\n};\n\nconst formatStyleProps = ({\n moduleData,\n parentModuleData,\n parameters,\n}: {\n moduleData: {[key:string]: any};\n parentModuleData?: {[key:string]: any}|null;\n parameters?: {[key:string]: any};\n}) => {\n const cloneProps: {[key:string]: any} = moduleData ? cloneDeep(moduleData) : {};\n const { compProps = {}, compType } = cloneProps;\n const { style = {}, styleScript } = compProps || {};\n let scriptStyleObj:{[key:string]: any} = {};\n \n const styleObj = getStylePainter(style, moduleData?.children);\n \n if (\n parentModuleData?.compProps?.style?.display === 'flex' &&\n !['icon'].includes(compType) &&\n !compProps.style?.width\n ) {\n // 内敛元素不需要设置flex\n if (!compProps.style?.display || ['block', 'flex', 'grid'].includes(compProps.style?.display)) {\n styleObj.flex = '1';\n }\n } else if (styleObj?.flex) {\n delete styleObj.flex;\n }\n\n if (styleScript) {\n const scriptStyleResult = stringScriptExecution(styleScript, parameters);\n if (scriptStyleResult && typeof scriptStyleResult === 'object' && Object.keys(scriptStyleResult)?.length > 0) {\n scriptStyleObj = scriptStyleResult;\n }\n }\n\n return {\n ...styleObj,\n ...scriptStyleObj,\n };\n};\n\nexport default formatStyleProps;\n"],"mappings":";;;;;;AAAA,SAASA,SAAS,QAAQ,QAAQ;AAClC,SAASC,qBAAqB;AAC9B,OAAOC,SAAS;AAEhB,OAAO,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,KAA0B,EAAEC,QAAgC,EAAK;EAAA,IAAAC,YAAA;EAC/F,IAAIC,QAA4B,GAAG,CAAC,CAAC;EACrC,IAAMC,SAAS,GAAG,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAACC,QAAQ,CAACL,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAG,gBAAgB,CAAC,CAAC,GAAG,YAAY,GAAG,gBAAgB;EACpH,IAAMM,SAAS,GAAG,EAACN,KAAK,aAALA,KAAK,eAALA,KAAK,CAAG,gBAAgB,CAAC,KAAI,CAAC,KAAK,EAAE,aAAa,CAAC,CAACK,QAAQ,CAACL,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAG,gBAAgB,CAAC,CAAC,GAAG,YAAY,GAAG,gBAAgB;EAC5I,IAAMO,aAAoD,GAAG;IAC3DC,OAAO,EAAAC,eAAA,CAAAA,eAAA,KACJL,SAAS,EAAG,YAAY,GACxBE,SAAS,EAAG,YAA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