@boteteam/utils 0.0.27 → 0.0.29

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 (151) hide show
  1. package/README.md +23 -23
  2. package/dist/cjs/CookieUtils.js.map +1 -1
  3. package/dist/cjs/asyncStorage.js.map +1 -1
  4. package/dist/cjs/environment.js.map +1 -1
  5. package/dist/cjs/file.js.map +1 -1
  6. package/dist/cjs/fileToBase64.js.map +1 -1
  7. package/dist/cjs/formatModule/formatModuleData.js +99 -9
  8. package/dist/cjs/formatModule/formatModuleData.js.map +2 -2
  9. package/dist/cjs/formatModule/helpers/formRulsRegMap.js.map +1 -1
  10. package/dist/cjs/formatModule/helpers/formatCarouselProps.js.map +1 -1
  11. package/dist/cjs/formatModule/helpers/formatChartsProps.js.map +1 -1
  12. package/dist/cjs/formatModule/helpers/formatControlBtn.d.ts +8 -0
  13. package/dist/cjs/formatModule/helpers/formatControlBtn.js +67 -0
  14. package/dist/cjs/formatModule/helpers/formatControlBtn.js.map +7 -0
  15. package/dist/cjs/formatModule/helpers/formatDescriptionsProps.js.map +1 -1
  16. package/dist/cjs/formatModule/helpers/formatEchartCommonProps.js.map +1 -1
  17. package/dist/cjs/formatModule/helpers/formatEchartLineProps.js.map +1 -1
  18. package/dist/cjs/formatModule/helpers/formatEchartPieProps.js.map +1 -1
  19. package/dist/cjs/formatModule/helpers/formatFormProps.d.ts +4 -1
  20. package/dist/cjs/formatModule/helpers/formatFormProps.js +51 -28
  21. package/dist/cjs/formatModule/helpers/formatFormProps.js.map +2 -2
  22. package/dist/cjs/formatModule/helpers/formatHighCodeProps.js.map +1 -1
  23. package/dist/cjs/formatModule/helpers/formatIconProps.d.ts +16 -0
  24. package/dist/cjs/formatModule/helpers/formatIconProps.js +49 -0
  25. package/dist/cjs/formatModule/helpers/formatIconProps.js.map +7 -0
  26. package/dist/cjs/formatModule/helpers/formatImageProps.js.map +1 -1
  27. package/dist/cjs/formatModule/helpers/formatListProps.js +69 -44
  28. package/dist/cjs/formatModule/helpers/formatListProps.js.map +3 -3
  29. package/dist/cjs/formatModule/helpers/formatLoopProps.d.ts +26 -2
  30. package/dist/cjs/formatModule/helpers/formatLoopProps.js +17 -10
  31. package/dist/cjs/formatModule/helpers/formatLoopProps.js.map +3 -3
  32. package/dist/cjs/formatModule/helpers/formatPanelProps.d.ts +8 -0
  33. package/dist/cjs/formatModule/helpers/formatPanelProps.js +67 -0
  34. package/dist/cjs/formatModule/helpers/formatPanelProps.js.map +7 -0
  35. package/dist/cjs/formatModule/helpers/formatStepsProps.js.map +1 -1
  36. package/dist/cjs/formatModule/helpers/formatStyleProps.js.map +1 -1
  37. package/dist/cjs/formatModule/helpers/formatTableProps.d.ts +5 -0
  38. package/dist/cjs/formatModule/helpers/formatTableProps.js +20 -0
  39. package/dist/cjs/formatModule/helpers/formatTableProps.js.map +3 -3
  40. package/dist/cjs/formatModule/helpers/index.d.ts +4 -1
  41. package/dist/cjs/formatModule/helpers/index.js +9 -0
  42. package/dist/cjs/formatModule/helpers/index.js.map +3 -3
  43. package/dist/cjs/formatModule/helpers/patternTransitionRegExp.js.map +1 -1
  44. package/dist/cjs/formatModule/helpers/staticCodeAssemble.js.map +1 -1
  45. package/dist/cjs/formatModule/helpers/stringPramarsValTransition.js.map +1 -1
  46. package/dist/cjs/formatModule/helpers/stringScriptExecution.js.map +1 -1
  47. package/dist/cjs/formatModule/helpers/urlPrefix.js.map +1 -1
  48. package/dist/cjs/getValueByPath.d.ts +10 -0
  49. package/dist/cjs/getValueByPath.js +69 -0
  50. package/dist/cjs/getValueByPath.js.map +7 -0
  51. package/dist/cjs/http.d.ts +8 -0
  52. package/dist/cjs/http.js +37 -1
  53. package/dist/cjs/http.js.map +2 -2
  54. package/dist/cjs/index.d.ts +5 -2
  55. package/dist/cjs/index.js +17 -0
  56. package/dist/cjs/index.js.map +3 -3
  57. package/dist/cjs/loopPageServiceApiMap.d.ts +17 -0
  58. package/dist/cjs/loopPageServiceApiMap.js +54 -0
  59. package/dist/cjs/loopPageServiceApiMap.js.map +7 -0
  60. package/dist/cjs/loopPageStaticCodeMap.js.map +1 -1
  61. package/dist/cjs/markdownEscape.js.map +1 -1
  62. package/dist/cjs/pathArgsUtils.js.map +1 -1
  63. package/dist/cjs/scriptExecution.js.map +1 -1
  64. package/dist/cjs/securityUtils.js +1 -1
  65. package/dist/cjs/securityUtils.js.map +2 -2
  66. package/dist/cjs/stringUtils.js.map +1 -1
  67. package/dist/cjs/timeFormat.d.ts +44 -0
  68. package/dist/cjs/timeFormat.js +127 -0
  69. package/dist/cjs/timeFormat.js.map +7 -0
  70. package/dist/cjs/treeUtils.js.map +1 -1
  71. package/dist/cjs/watchMatchMedia.js.map +1 -1
  72. package/dist/esm/CookieUtils.js.map +1 -1
  73. package/dist/esm/asyncStorage.js +4 -4
  74. package/dist/esm/asyncStorage.js.map +1 -1
  75. package/dist/esm/environment.js +3 -3
  76. package/dist/esm/environment.js.map +1 -1
  77. package/dist/esm/file.js +32 -32
  78. package/dist/esm/file.js.map +1 -1
  79. package/dist/esm/fileToBase64.js +4 -4
  80. package/dist/esm/fileToBase64.js.map +1 -1
  81. package/dist/esm/formatModule/formatModuleData.js +118 -26
  82. package/dist/esm/formatModule/formatModuleData.js.map +1 -1
  83. package/dist/esm/formatModule/helpers/formRulsRegMap.js.map +1 -1
  84. package/dist/esm/formatModule/helpers/formatCarouselProps.js.map +1 -1
  85. package/dist/esm/formatModule/helpers/formatChartsProps.js.map +1 -1
  86. package/dist/esm/formatModule/helpers/formatControlBtn.d.ts +8 -0
  87. package/dist/esm/formatModule/helpers/formatControlBtn.js +41 -0
  88. package/dist/esm/formatModule/helpers/formatControlBtn.js.map +1 -0
  89. package/dist/esm/formatModule/helpers/formatDescriptionsProps.js.map +1 -1
  90. package/dist/esm/formatModule/helpers/formatEchartCommonProps.js.map +1 -1
  91. package/dist/esm/formatModule/helpers/formatEchartLineProps.js.map +1 -1
  92. package/dist/esm/formatModule/helpers/formatEchartPieProps.js.map +1 -1
  93. package/dist/esm/formatModule/helpers/formatFormProps.d.ts +4 -1
  94. package/dist/esm/formatModule/helpers/formatFormProps.js +93 -31
  95. package/dist/esm/formatModule/helpers/formatFormProps.js.map +1 -1
  96. package/dist/esm/formatModule/helpers/formatHighCodeProps.js.map +1 -1
  97. package/dist/esm/formatModule/helpers/formatIconProps.d.ts +16 -0
  98. package/dist/esm/formatModule/helpers/formatIconProps.js +25 -0
  99. package/dist/esm/formatModule/helpers/formatIconProps.js.map +1 -0
  100. package/dist/esm/formatModule/helpers/formatImageProps.js.map +1 -1
  101. package/dist/esm/formatModule/helpers/formatListProps.js +69 -44
  102. package/dist/esm/formatModule/helpers/formatListProps.js.map +1 -1
  103. package/dist/esm/formatModule/helpers/formatLoopProps.d.ts +26 -2
  104. package/dist/esm/formatModule/helpers/formatLoopProps.js +35 -7
  105. package/dist/esm/formatModule/helpers/formatLoopProps.js.map +1 -1
  106. package/dist/esm/formatModule/helpers/formatPanelProps.d.ts +8 -0
  107. package/dist/esm/formatModule/helpers/formatPanelProps.js +41 -0
  108. package/dist/esm/formatModule/helpers/formatPanelProps.js.map +1 -0
  109. package/dist/esm/formatModule/helpers/formatStepsProps.js.map +1 -1
  110. package/dist/esm/formatModule/helpers/formatStyleProps.js.map +1 -1
  111. package/dist/esm/formatModule/helpers/formatTableProps.d.ts +5 -0
  112. package/dist/esm/formatModule/helpers/formatTableProps.js +12 -0
  113. package/dist/esm/formatModule/helpers/formatTableProps.js.map +1 -1
  114. package/dist/esm/formatModule/helpers/index.d.ts +4 -1
  115. package/dist/esm/formatModule/helpers/index.js +4 -1
  116. package/dist/esm/formatModule/helpers/index.js.map +1 -1
  117. package/dist/esm/formatModule/helpers/patternTransitionRegExp.js.map +1 -1
  118. package/dist/esm/formatModule/helpers/staticCodeAssemble.js +4 -4
  119. package/dist/esm/formatModule/helpers/staticCodeAssemble.js.map +1 -1
  120. package/dist/esm/formatModule/helpers/stringPramarsValTransition.js.map +1 -1
  121. package/dist/esm/formatModule/helpers/stringScriptExecution.js.map +1 -1
  122. package/dist/esm/formatModule/helpers/urlPrefix.js.map +1 -1
  123. package/dist/esm/getValueByPath.d.ts +10 -0
  124. package/dist/esm/getValueByPath.js +87 -0
  125. package/dist/esm/getValueByPath.js.map +1 -0
  126. package/dist/esm/http.d.ts +8 -0
  127. package/dist/esm/http.js +97 -58
  128. package/dist/esm/http.js.map +1 -1
  129. package/dist/esm/index.d.ts +5 -2
  130. package/dist/esm/index.js +5 -2
  131. package/dist/esm/index.js.map +1 -1
  132. package/dist/esm/loopPageServiceApiMap.d.ts +17 -0
  133. package/dist/esm/loopPageServiceApiMap.js +40 -0
  134. package/dist/esm/loopPageServiceApiMap.js.map +1 -0
  135. package/dist/esm/loopPageStaticCodeMap.js.map +1 -1
  136. package/dist/esm/markdownEscape.js.map +1 -1
  137. package/dist/esm/pathArgsUtils.js +8 -8
  138. package/dist/esm/pathArgsUtils.js.map +1 -1
  139. package/dist/esm/scriptExecution.js.map +1 -1
  140. package/dist/esm/securityUtils.js +20 -20
  141. package/dist/esm/securityUtils.js.map +1 -1
  142. package/dist/esm/stringUtils.js.map +1 -1
  143. package/dist/esm/timeFormat.d.ts +44 -0
  144. package/dist/esm/timeFormat.js +121 -0
  145. package/dist/esm/timeFormat.js.map +1 -0
  146. package/dist/esm/treeUtils.js +8 -8
  147. package/dist/esm/treeUtils.js.map +1 -1
  148. package/dist/esm/watchMatchMedia.js.map +1 -1
  149. package/dist/umd/index.min.js +1 -1
  150. package/dist/umd/index.min.js.map +1 -1
  151. package/package.json +4 -3
@@ -8,6 +8,7 @@ import { get } from 'lodash';
8
8
  import { stringScriptExecution } from "./stringScriptExecution";
9
9
  import { getDataArr, replaceLoopBodyParamsValue, getParamsContentByParamKeys } from "../../treeUtils";
10
10
  import { getFileUrlById } from "../../file";
11
+ import formatControlBtn from "./formatControlBtn";
11
12
  var formatListProps = function formatListProps(_ref) {
12
13
  var _opt$icon;
13
14
  var urlPrefix = _ref.urlPrefix,
@@ -23,7 +24,65 @@ var formatListProps = function formatListProps(_ref) {
23
24
  } else {
24
25
  propsRes.icon = '';
25
26
  }
26
- if (parameters && Object.keys(parameters).length > 0 && opt !== null && opt !== void 0 && opt.dataSource) {
27
+ // 处理 attrs 属性的通用函数
28
+ var processAttrs = function processAttrs(item, idx, replaceValueFn, attrReplaceFn) {
29
+ var attrList = [];
30
+ if (Array.isArray(opt === null || opt === void 0 ? void 0 : opt.attrs) && (opt === null || opt === void 0 ? void 0 : opt.attrs.length) > 0) {
31
+ opt.attrs.forEach(function (attrItem) {
32
+ var attrsDisplay = true;
33
+ if (typeof (attrItem === null || attrItem === void 0 ? void 0 : attrItem.display) === 'boolean' || typeof (attrItem === null || attrItem === void 0 ? void 0 : attrItem.display) === 'string') {
34
+ if (typeof (attrItem === null || attrItem === void 0 ? void 0 : attrItem.display) === 'boolean') {
35
+ attrsDisplay = attrItem === null || attrItem === void 0 ? void 0 : attrItem.display;
36
+ } else if (typeof (attrItem === null || attrItem === void 0 ? void 0 : attrItem.display) === 'string' && attrItem !== null && attrItem !== void 0 && attrItem.display) {
37
+ var scriptParameters = Object.assign(parameters || {}, {
38
+ row: item,
39
+ index: idx
40
+ });
41
+ var codeExtendVal = stringScriptExecution(attrItem === null || attrItem === void 0 ? void 0 : attrItem.display, scriptParameters);
42
+ attrsDisplay = codeExtendVal;
43
+ }
44
+ }
45
+ if (attrsDisplay) {
46
+ var attrObj = {};
47
+ if (attrItem !== null && attrItem !== void 0 && attrItem.style) {
48
+ attrObj.style = attrItem === null || attrItem === void 0 ? void 0 : attrItem.style;
49
+ }
50
+ if (attrItem !== null && attrItem !== void 0 && attrItem.defaultValue) {
51
+ // 如果提供了 attrReplaceFn,优先使用它(用于支持 staticCode 翻译)
52
+ var attrValue = attrReplaceFn ? attrReplaceFn(attrItem, item) : replaceValueFn((attrItem === null || attrItem === void 0 ? void 0 : attrItem.defaultValue) || '', item);
53
+ attrObj.attrName = attrItem === null || attrItem === void 0 ? void 0 : attrItem.attrName;
54
+ attrObj.attrCode = attrItem === null || attrItem === void 0 ? void 0 : attrItem.attrCode;
55
+ attrObj.attrValue = attrValue;
56
+ }
57
+ attrList.push(attrObj);
58
+ }
59
+ });
60
+ }
61
+ return attrList;
62
+ };
63
+
64
+ // 构建单个数据项对象的通用函数
65
+ var buildDataObj = function buildDataObj(item, idx, replaceValueFn, attrReplaceFn) {
66
+ 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
71
+ };
72
+
73
+ // 设置 rowKey
74
+ if (propsRes !== null && propsRes !== void 0 && propsRes.rowKey) {
75
+ dataObj[propsRes.rowKey] = item === null || item === void 0 ? void 0 : item[propsRes.rowKey];
76
+ }
77
+
78
+ // 处理 attrs 属性
79
+ var attrList = processAttrs(item, idx, replaceValueFn, attrReplaceFn);
80
+ if (attrList.length > 0) {
81
+ dataObj.attrList = attrList;
82
+ }
83
+ return dataObj;
84
+ };
85
+ if (parameters && Object.keys(parameters).length > 0) {
27
86
  var _rowKeyArr$slice;
28
87
  var sourceArr = getDataArr(opt === null || opt === void 0 ? void 0 : opt.dataSource) || [];
29
88
  var rowKeyArr = getDataArr(opt === null || opt === void 0 ? void 0 : opt.rowKey) || [];
@@ -58,49 +117,7 @@ var formatListProps = function formatListProps(_ref) {
58
117
  };
59
118
  if (Array.isArray(items)) {
60
119
  items.forEach(function (item, idx) {
61
- var attrList = [];
62
- if (Array.isArray(opt === null || opt === void 0 ? void 0 : opt.attrs) && (opt === null || opt === void 0 ? void 0 : opt.attrs.length) > 0) {
63
- opt === null || opt === void 0 || opt.attrs.forEach(function (attrItem) {
64
- var attrsDisplay = true;
65
- if (typeof (attrItem === null || attrItem === void 0 ? void 0 : attrItem.display) === 'boolean' || typeof (attrItem === null || attrItem === void 0 ? void 0 : attrItem.display) === 'string') {
66
- if (typeof (attrItem === null || attrItem === void 0 ? void 0 : attrItem.display) === 'boolean') {
67
- attrsDisplay = attrItem === null || attrItem === void 0 ? void 0 : attrItem.display;
68
- } else if (typeof (attrItem === null || attrItem === void 0 ? void 0 : attrItem.display) === 'string' && attrItem !== null && attrItem !== void 0 && attrItem.display) {
69
- var scriptParameters = Object.assign(parameters || {}, {
70
- row: item,
71
- index: idx
72
- });
73
- var codeExtendVal = stringScriptExecution(attrItem === null || attrItem === void 0 ? void 0 : attrItem.display, scriptParameters);
74
- attrsDisplay = codeExtendVal;
75
- }
76
- }
77
- if (attrsDisplay) {
78
- var attrObj = {};
79
- if (attrItem !== null && attrItem !== void 0 && attrItem.style) {
80
- attrObj.style = attrItem === null || attrItem === void 0 ? void 0 : attrItem.style;
81
- }
82
- if (attrItem !== null && attrItem !== void 0 && attrItem.defaultValue) {
83
- var attrValue = stringAttrValueTransition(attrItem, item);
84
- attrObj.attrName = attrItem === null || attrItem === void 0 ? void 0 : attrItem.attrName;
85
- attrObj.attrCode = attrItem === null || attrItem === void 0 ? void 0 : attrItem.attrCode;
86
- attrObj.attrValue = attrValue;
87
- }
88
- attrList.push(attrObj);
89
- }
90
- });
91
- }
92
- var dataObj = {
93
- label: replaceParamsValue(opt === null || opt === void 0 ? void 0 : opt.itemLabel, item),
94
- content: replaceParamsValue(opt === null || opt === void 0 ? void 0 : opt.itemContent, item),
95
- describe: replaceParamsValue(opt === null || opt === void 0 ? void 0 : opt.itemDescribe, item),
96
- originItem: item
97
- };
98
- if (propsRes !== null && propsRes !== void 0 && propsRes.rowKey) {
99
- dataObj[propsRes === null || propsRes === void 0 ? void 0 : propsRes.rowKey] = item === null || item === void 0 ? void 0 : item[propsRes === null || propsRes === void 0 ? void 0 : propsRes.rowKey];
100
- }
101
- if (attrList.length > 0) {
102
- dataObj.attrList = attrList;
103
- }
120
+ var dataObj = buildDataObj(item, idx, replaceParamsValue, stringAttrValueTransition);
104
121
  if (Array.isArray(propsRes.dataSource)) {
105
122
  propsRes.dataSource.push(dataObj);
106
123
  } else {
@@ -108,6 +125,14 @@ var formatListProps = function formatListProps(_ref) {
108
125
  }
109
126
  });
110
127
  }
128
+ if (Array.isArray(opt === null || opt === void 0 ? void 0 : opt.controlBtns) && (opt === null || opt === void 0 ? void 0 : opt.controlBtns.length) > 0) {
129
+ propsRes.controlBtns = opt === null || opt === void 0 ? void 0 : opt.controlBtns.map(function (btn) {
130
+ return formatControlBtn({
131
+ btnProps: btn,
132
+ parameters: parameters
133
+ });
134
+ });
135
+ }
111
136
  }
112
137
  return propsRes;
113
138
  };
@@ -1 +1 @@
1
- {"version":3,"names":["get","stringScriptExecution","getDataArr","replaceLoopBodyParamsValue","getParamsContentByParamKeys","getFileUrlById","formatListProps","_ref","_opt$icon","urlPrefix","parameters","staticCodeMap","opt","options","propsRes","_objectSpread","Array","isArray","icon","length","_opt$icon2","fileId","prefix","Object","keys","dataSource","_rowKeyArr$slice","sourceArr","rowKeyArr","rowKey","items","slice","stringAttrValueTransition","attr","pararms","nowContent","defaultValue","replace","match","_staticCodeMap$attr$s","_staticCodeMap$attr$s2","paramsPath","filter","itemKey","includes","filedVal","staticCode","_staticCodeMap$attr$s3","replaceParamsValue","contentStr","item","loopParams","loopData","loopSourceArr","forEach","idx","attrList","attrs","attrItem","attrsDisplay","display","scriptParameters","assign","row","index","codeExtendVal","attrObj","style","attrValue","attrName","attrCode","push","dataObj","label","itemLabel","content","itemContent","describe","itemDescribe","originItem"],"sources":["../../../../src/formatModule/helpers/formatListProps.ts"],"sourcesContent":["import { get } from 'lodash';\r\nimport { stringScriptExecution } from './stringScriptExecution';\r\nimport { getDataArr, replaceLoopBodyParamsValue, getParamsContentByParamKeys } from '../../treeUtils';\r\nimport { getFileUrlById } from '../../file';\r\n\r\nexport type formatListPropsType = {\r\n urlPrefix: string;\r\n options: {[key:string]: any};\r\n staticCodeMap: {[key:string]: any};\r\n parameters: {[key:string]: any};\r\n}\r\n\r\nexport type formatListPropsExportType = {[key: string]: any}\r\n\r\nconst formatListProps = ({\r\n urlPrefix,\r\n parameters,\r\n staticCodeMap,\r\n options: opt,\r\n}: formatListPropsType): formatListPropsExportType => {\r\n const propsRes: { [key: string]: any } = { ...opt };\r\n if (Array.isArray(opt?.icon) && opt?.icon?.length > 0) {\r\n propsRes.icon = getFileUrlById(opt?.icon?.[0]?.fileId, { prefix: urlPrefix });\r\n } else {\r\n propsRes.icon = '';\r\n }\r\n if (\r\n parameters &&\r\n Object.keys(parameters).length > 0 &&\r\n opt?.dataSource\r\n ) {\r\n const sourceArr = getDataArr(opt?.dataSource) || [];\r\n const rowKeyArr = getDataArr(opt?.rowKey) || [];\r\n const items = getParamsContentByParamKeys(opt?.dataSource, parameters) || [];\r\n propsRes.rowKey = rowKeyArr.slice(-1)?.[0];\r\n const stringAttrValueTransition = (attr:{[key:string]: any}, pararms: {[key:string]: any}) => {\r\n let nowContent:string = '';\r\n if (typeof attr?.defaultValue === 'string' && attr?.defaultValue && pararms) {\r\n nowContent = attr?.defaultValue.replace(/\\$\\{(.+?)\\}/g, (match) => {\r\n const paramsPath = getDataArr(match).filter((itemKey) => !sourceArr.includes(itemKey)).slice(1);\r\n const filedVal = get(pararms, paramsPath);\r\n // 如果存在静态数组,则翻译静态数据\r\n if (\r\n attr?.staticCode &&\r\n staticCodeMap?.[attr?.staticCode]?.[filedVal] &&\r\n typeof staticCodeMap?.[attr?.staticCode]?.[filedVal] === 'string'\r\n ) {\r\n return staticCodeMap?.[attr?.staticCode]?.[filedVal];\r\n }\r\n return filedVal || '';\r\n });\r\n }\r\n return nowContent;\r\n };\r\n const replaceParamsValue = (\r\n contentStr: string,\r\n item: { [key: string]: any },\r\n ) => {\r\n return replaceLoopBodyParamsValue(\r\n contentStr, {\r\n parameters,\r\n loopParams: item,\r\n loopData: items,\r\n loopSourceArr: sourceArr,\r\n });\r\n };\r\n if (Array.isArray(items)) {\r\n items.forEach((item, idx) => {\r\n const attrList: { [key: string]: any }[] = [];\r\n if (Array.isArray(opt?.attrs) && opt?.attrs.length > 0) {\r\n opt?.attrs.forEach((attrItem) => {\r\n let attrsDisplay: boolean = true;\r\n if (typeof attrItem?.display === 'boolean' || typeof attrItem?.display === 'string') {\r\n if (typeof attrItem?.display === 'boolean') {\r\n attrsDisplay = attrItem?.display;\r\n } else if (typeof attrItem?.display === 'string' && attrItem?.display) {\r\n const scriptParameters = Object.assign((parameters || {}), { row: item, index: idx });\r\n const codeExtendVal = stringScriptExecution(\r\n attrItem?.display,\r\n scriptParameters,\r\n );\r\n attrsDisplay = codeExtendVal;\r\n }\r\n }\r\n if (attrsDisplay) {\r\n const attrObj: { [key: string]: any } = {};\r\n if (attrItem?.style) {\r\n attrObj.style = attrItem?.style;\r\n }\r\n if (attrItem?.defaultValue) {\r\n const attrValue = stringAttrValueTransition(attrItem, item);\r\n attrObj.attrName = attrItem?.attrName;\r\n attrObj.attrCode = attrItem?.attrCode;\r\n attrObj.attrValue = attrValue;\r\n }\r\n attrList.push(attrObj);\r\n }\r\n });\r\n }\r\n const dataObj: { [key: string]: any } = {\r\n label: replaceParamsValue(opt?.itemLabel, item),\r\n content: replaceParamsValue(opt?.itemContent, item),\r\n describe: replaceParamsValue(opt?.itemDescribe, item),\r\n originItem: item,\r\n };\r\n if (propsRes?.rowKey) {\r\n dataObj[propsRes?.rowKey] = item?.[propsRes?.rowKey];\r\n }\r\n if (attrList.length > 0) {\r\n dataObj.attrList = attrList;\r\n }\r\n if (Array.isArray(propsRes.dataSource)) {\r\n propsRes.dataSource.push(dataObj);\r\n } else {\r\n propsRes.dataSource = [dataObj];\r\n }\r\n });\r\n }\r\n }\r\n return propsRes;\r\n};\r\n\r\n\r\nexport default formatListProps;\r\n"],"mappings":";;;;;;AAAA,SAASA,GAAG,QAAQ,QAAQ;AAC5B,SAASC,qBAAqB;AAC9B,SAASC,UAAU,EAAEC,0BAA0B,EAAEC,2BAA2B;AAC5E,SAASC,cAAc;AAWvB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AAGA,SAAS;cAC/B;cACAZ,QAAQ,CAACe,IAAI,CAACL,OAAO,CAAC;YACxB;UACF,CAAC,CAAC;QACJ;QACA,IAAMM,OAA+B,GAAG;UACtCC,KAAK,EAAEzB,kBAAkB,CAACpC,GAAG,aAAHA,GAAG,uBAAHA,GAAG,CAAE8D,SAAS,EAAExB,IAAI,CAAC;UAC/CyB,OAAO,EAAE3B,kBAAkB,CAACpC,GAAG,aAAHA,GAAG,uBAAHA,GAAG,CAAEgE,WAAW,EAAE1B,IAAI,CAAC;UACnD2B,QAAQ,EAAE7B,kBAAkB,CAACpC,GAAG,aAAHA,GAAG,uBAAHA,GAAG,CAAEkE,YAAY,EAAE5B,IAAI,CAAC;UACrD6B,UAAU,EAAE7B;QACd,CAAC;QACD,IAAIpC,QAAQ,aAARA,QAAQ,eAARA,QAAQ,CAAEe,MAAM,EAAE;UACpB2C,OAAO,CAAC1D,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEe,MAAM,CAAC,GAAGqB,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAGpC,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEe,MAAM,CAAC;QACtD;QACA,IAAI2B,QAAQ,CAACrC,MAAM,GAAG,CAAC,EAAE;UACvBqD,OAAO,CAAChB,QAAQ,GAAGA,QAAQ;QAC7B;QACA,IAAIxC,KAAK,CAACC,OAAO,CAACH,QAAQ,CAACW,UAAU,CAAC,EAAE;UACtCX,QAAQ,CAACW,UAAU,CAAC8C,IAAI,CAACC,OAAO,CAAC;QACnC,CAAC,MAAM;UACL1D,QAAQ,CAACW,UAAU,GAAG,CAAC+C,OAAO,CAAC;QACjC;MACF,CAAC,CAAC;IACJ;EACF;EACA,OAAO1D,QAAQ;AACjB,CAAC;AAGD,eAAeR,eAAe"}
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,CAA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IAAMuB,OAAO,GAAGD,YAAY,CAACvB,IAAI,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,10 +1,34 @@
1
+ /**
2
+ * dataSource 有两种类型:
3
+ * "compProps": {
4
+ "dataSource": "${root.pageParams.userList}",
5
+ "rowKey": "${row.ID}"
6
+ },
7
+
8
+ "compProps": {
9
+ "dataSource": {
10
+ "dataSourceType": "serviceApi",
11
+ "serviceApi": {
12
+ "apiId": "1228988054172995584",
13
+ "dataPath": "res.data"
14
+ }
15
+ },
16
+ "rowKey": "${row.ID}"
17
+ },
18
+ */
1
19
  export type formatLoopPropsType = {
2
20
  options?: {
3
- dataSource?: string;
21
+ dataSource?: {
22
+ [key: string]: any;
23
+ } | string;
24
+ id?: string;
4
25
  };
5
26
  staticCodeMap?: {
6
27
  [key: string]: any;
7
28
  };
29
+ serviceApiMap?: {
30
+ [key: string]: any;
31
+ };
8
32
  parameters?: {
9
33
  [key: string]: any;
10
34
  };
@@ -14,5 +38,5 @@ export type formatLoopPropsExportType = {
14
38
  [key: string]: any;
15
39
  }[];
16
40
  };
17
- declare const formatLoopProps: ({ parameters, options, }: formatLoopPropsType) => formatLoopPropsExportType;
41
+ declare const formatLoopProps: ({ parameters, serviceApiMap, options, }: formatLoopPropsType) => formatLoopPropsExportType;
18
42
  export default formatLoopProps;
@@ -1,18 +1,46 @@
1
- import { getDataArr } from "../../treeUtils";
2
1
  import { get } from 'lodash';
2
+ import { getDataArr } from "../../treeUtils";
3
+
4
+ /**
5
+ * dataSource 有两种类型:
6
+ * "compProps": {
7
+ "dataSource": "${root.pageParams.userList}",
8
+ "rowKey": "${row.ID}"
9
+ },
10
+
11
+ "compProps": {
12
+ "dataSource": {
13
+ "dataSourceType": "serviceApi",
14
+ "serviceApi": {
15
+ "apiId": "1228988054172995584",
16
+ "dataPath": "res.data"
17
+ }
18
+ },
19
+ "rowKey": "${row.ID}"
20
+ },
21
+ */
22
+
3
23
  var formatLoopProps = function formatLoopProps(_ref) {
4
24
  var parameters = _ref.parameters,
25
+ serviceApiMap = _ref.serviceApiMap,
5
26
  _ref$options = _ref.options,
6
27
  options = _ref$options === void 0 ? {} : _ref$options;
7
- var dataSource = options.dataSource;
28
+ var dataSource = options.dataSource,
29
+ id = options.id;
8
30
  var dataList = [];
9
31
  if (dataSource) {
10
- var dataSourceArr = getDataArr(dataSource);
11
- if (parameters) {
12
- var dataSourceList = get(parameters, dataSourceArr);
13
- if (Array.isArray(dataSourceList)) {
14
- dataList = dataSourceList;
32
+ if (typeof dataSource === 'string') {
33
+ var dataSourceArr = getDataArr(dataSource);
34
+ if (parameters) {
35
+ var dataSourceList = get(parameters, dataSourceArr);
36
+ if (Array.isArray(dataSourceList)) {
37
+ dataList = dataSourceList;
38
+ }
15
39
  }
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;
16
44
  }
17
45
  }
18
46
  return {
@@ -1 +1 @@
1
- {"version":3,"names":["getDataArr","get","formatLoopProps","_ref","parameters","_ref$options","options","dataSource","dataList","dataSourceArr","dataSourceList","Array","isArray"],"sources":["../../../../src/formatModule/helpers/formatLoopProps.ts"],"sourcesContent":["import { getDataArr } from '../../treeUtils';\r\nimport { get } from 'lodash';\r\n\r\nexport type formatLoopPropsType = {\r\n options?: {\r\n dataSource?: string;\r\n }\r\n staticCodeMap?: {[key:string]: any};\r\n parameters?: {[key:string]: any};\r\n}\r\n\r\nexport type formatLoopPropsExportType = {\r\n dataSource: {[key: string]: any}[]\r\n}\r\n\r\nconst formatLoopProps = ({\r\n parameters,\r\n options = {},\r\n}: formatLoopPropsType): formatLoopPropsExportType => {\r\n const {\r\n dataSource,\r\n } = options;\r\n let dataList:{[key:string]: any}[] = [];\r\n if (dataSource) {\r\n const dataSourceArr = getDataArr(dataSource);\r\n if (parameters) {\r\n const dataSourceList = get(\r\n parameters,\r\n dataSourceArr,\r\n );\r\n if (Array.isArray(dataSourceList)) {\r\n dataList = dataSourceList;\r\n }\r\n }\r\n }\r\n return {\r\n dataSource: dataList,\r\n };\r\n};\r\n\r\nexport default formatLoopProps;\r\n"],"mappings":"AAAA,SAASA,UAAU;AACnB,SAASC,GAAG,QAAQ,QAAQ;AAc5B,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,IAAID,UAAU,EAAE;IACd,IAAME,aAAa,GAAGT,UAAU,CAACO,UAAU,CAAC;IAC5C,IAAIH,UAAU,EAAE;MACd,IAAMM,cAAc,GAAGT,GAAG,CACxBG,UAAU,EACVK,aACF,CAAC;MACD,IAAIE,KAAK,CAACC,OAAO,CAACF,cAAc,CAAC,EAAE;QACjCF,QAAQ,GAAGE,cAAc;MAC3B;IACF;EACF;EACA,OAAO;IACLH,UAAU,EAAEC;EACd,CAAC;AACH,CAAC;AAED,eAAeN,eAAe"}
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"}
@@ -0,0 +1,8 @@
1
+ export type formatPanelPropsType = {
2
+ compProps?: any;
3
+ parameters?: {
4
+ [key: string]: any;
5
+ };
6
+ };
7
+ declare const formatPanelProps: ({ parameters, compProps, }: formatPanelPropsType) => any;
8
+ export default formatPanelProps;
@@ -0,0 +1,41 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
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
+ import formatIconProps from "./formatIconProps";
8
+ import formatImageProps from "./formatImageProps";
9
+ var formatPanelProps = function formatPanelProps(_ref) {
10
+ var _res$titleIcon, _res$titleIcon3;
11
+ var parameters = _ref.parameters,
12
+ _ref$compProps = _ref.compProps,
13
+ compProps = _ref$compProps === void 0 ? {} : _ref$compProps;
14
+ var res = _objectSpread({}, compProps);
15
+ if ((res === null || res === void 0 || (_res$titleIcon = res.titleIcon) === null || _res$titleIcon === void 0 ? void 0 : _res$titleIcon.type) === 'icon') {
16
+ var _res$titleIcon2;
17
+ var iconProps = formatIconProps({
18
+ icon: res === null || res === void 0 || (_res$titleIcon2 = res.titleIcon) === null || _res$titleIcon2 === void 0 ? void 0 : _res$titleIcon2.icon,
19
+ parameters: parameters
20
+ });
21
+ res.titleIcon = iconProps !== null && iconProps !== void 0 && iconProps.icon ? {
22
+ type: 'icon',
23
+ icon: iconProps
24
+ } : null;
25
+ } else if ((res === null || res === void 0 || (_res$titleIcon3 = res.titleIcon) === null || _res$titleIcon3 === void 0 ? void 0 : _res$titleIcon3.type) === 'image') {
26
+ var _res$titleIcon4;
27
+ var imageProps = formatImageProps({
28
+ options: {
29
+ dataSource: res === null || res === void 0 || (_res$titleIcon4 = res.titleIcon) === null || _res$titleIcon4 === void 0 ? void 0 : _res$titleIcon4.image
30
+ },
31
+ parameters: parameters
32
+ });
33
+ res.titleIcon = imageProps !== null && imageProps !== void 0 && imageProps.src ? {
34
+ type: 'image',
35
+ image: imageProps
36
+ } : null;
37
+ }
38
+ return res;
39
+ };
40
+ export default formatPanelProps;
41
+ //# sourceMappingURL=formatPanelProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["formatIconProps","formatImageProps","formatPanelProps","_ref","_res$titleIcon","_res$titleIcon3","parameters","_ref$compProps","compProps","res","_objectSpread","titleIcon","type","_res$titleIcon2","iconProps","icon","_res$titleIcon4","imageProps","options","dataSource","image","src"],"sources":["../../../../src/formatModule/helpers/formatPanelProps.ts"],"sourcesContent":["import formatIconProps from './formatIconProps';\nimport formatImageProps from './formatImageProps';\n\nexport type formatPanelPropsType = {\n compProps?: any;\n parameters?: {[key:string]: any};\n}\n\nconst formatPanelProps = ({\n parameters,\n compProps = {},\n}: formatPanelPropsType) => {\n const res = { ...compProps };\n if (res?.titleIcon?.type === 'icon') {\n const iconProps = formatIconProps({\n icon: res?.titleIcon?.icon,\n parameters,\n });\n res.titleIcon = iconProps?.icon ? {\n type: 'icon',\n icon: iconProps,\n } : null;\n } else if (res?.titleIcon?.type === 'image') {\n const imageProps = formatImageProps({\n options: {\n dataSource: res?.titleIcon?.image,\n },\n parameters,\n });\n res.titleIcon = imageProps?.src ? {\n type: 'image',\n image: imageProps,\n } : null;\n }\n return res;\n};\n\nexport default formatPanelProps;\n"],"mappings":";;;;;;AAAA,OAAOA,eAAe;AACtB,OAAOC,gBAAgB;AAOvB,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAGM;EAAA,IAAAC,cAAA,EAAAC,eAAA;EAAA,IAF1BC,UAAU,GAAAH,IAAA,CAAVG,UAAU;IAAAC,cAAA,GAAAJ,IAAA,CACVK,SAAS;IAATA,SAAS,GAAAD,cAAA,cAAG,CAAC,CAAC,GAAAA,cAAA;EAEd,IAAME,GAAG,GAAAC,aAAA,KAAQF,SAAS,CAAE;EAC5B,IAAI,CAAAC,GAAG,aAAHA,GAAG,gBAAAL,cAAA,GAAHK,GAAG,CAAEE,SAAS,cAAAP,cAAA,uBAAdA,cAAA,CAAgBQ,IAAI,MAAK,MAAM,EAAE;IAAA,IAAAC,eAAA;IACnC,IAAMC,SAAS,GAAGd,eAAe,CAAC;MAChCe,IAAI,EAAEN,GAAG,aAAHA,GAAG,gBAAAI,eAAA,GAAHJ,GAAG,CAAEE,SAAS,cAAAE,eAAA,uBAAdA,eAAA,CAAgBE,IAAI;MAC1BT,UAAU,EAAVA;IACF,CAAC,CAAC;IACFG,GAAG,CAACE,SAAS,GAAGG,SAAS,aAATA,SAAS,eAATA,SAAS,CAAEC,IAAI,GAAG;MAChCH,IAAI,EAAE,MAAM;MACZG,IAAI,EAAED;IACR,CAAC,GAAG,IAAI;EACV,CAAC,MAAM,IAAI,CAAAL,GAAG,aAAHA,GAAG,gBAAAJ,eAAA,GAAHI,GAAG,CAAEE,SAAS,cAAAN,eAAA,uBAAdA,eAAA,CAAgBO,IAAI,MAAK,OAAO,EAAE;IAAA,IAAAI,eAAA;IAC3C,IAAMC,UAAU,GAAGhB,gBAAgB,CAAC;MAClCiB,OAAO,EAAE;QACPC,UAAU,EAAEV,GAAG,aAAHA,GAAG,gBAAAO,eAAA,GAAHP,GAAG,CAAEE,SAAS,cAAAK,eAAA,uBAAdA,eAAA,CAAgBI;MAC9B,CAAC;MACDd,UAAU,EAAVA;IACF,CAAC,CAAC;IACFG,GAAG,CAACE,SAAS,GAAGM,UAAU,aAAVA,UAAU,eAAVA,UAAU,CAAEI,GAAG,GAAG;MAChCT,IAAI,EAAE,OAAO;MACbQ,KAAK,EAAEH;IACT,CAAC,GAAG,IAAI;EACV;EACA,OAAOR,GAAG;AACZ,CAAC;AAED,eAAeP,gBAAgB"}
@@ -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';\r\nimport { get } from 'lodash';\r\n\r\nexport type formatImagePropsType = {\r\n options?: {\r\n dataSource?: string,\r\n title?: string,\r\n description?: string,\r\n status?: string,\r\n size?: string,\r\n direction?: string,\r\n statusMap?: {\r\n wait?: string,\r\n process?: string,\r\n finish?: string,\r\n error?: string,\r\n }\r\n }\r\n parameters?: {[key:string]: any};\r\n}\r\n\r\nconst formatStepsProps = ({\r\n parameters,\r\n options = {},\r\n}: formatImagePropsType):{[key:string]: any} => {\r\n const {\r\n dataSource,\r\n title,\r\n description,\r\n status,\r\n direction,\r\n statusMap,\r\n } = options;\r\n const res:{[key:string]: any} = {\r\n size: 'small',\r\n };\r\n\r\n if (dataSource) {\r\n const dataSourceArr = getDataArr(dataSource);\r\n if (parameters) {\r\n const dataSourceList = get(\r\n parameters,\r\n dataSourceArr,\r\n );\r\n\r\n const replaceParamsValue = (\r\n contentStr: string,\r\n item: { [key: string]: any },\r\n ) => {\r\n return replaceLoopBodyParamsValue(\r\n contentStr, {\r\n parameters,\r\n loopParams: item,\r\n loopData: dataSourceList,\r\n loopSourceArr: dataSourceArr,\r\n });\r\n };\r\n if (Array.isArray(dataSourceList)) {\r\n res.items = dataSourceList.map(item => {\r\n // 获取状态值\r\n let recordStatus = status && replaceParamsValue(status, item) ? replaceParamsValue(status, item) : '';\r\n // 根据状态映射,转换状态值为步骤状态\r\n if (statusMap && Object.keys(statusMap).length > 0) {\r\n Object.keys(statusMap).forEach(key => {\r\n const statusValue = `${statusMap?.[key as keyof typeof statusMap]}` || '';\r\n if (recordStatus && statusValue && `${recordStatus}` === statusValue) {\r\n recordStatus = key;\r\n }\r\n });\r\n }\r\n return ({\r\n title: title ? replaceParamsValue(title, item) : '',\r\n description: description ? replaceParamsValue(description, item) : '',\r\n status: recordStatus || 'default',\r\n });\r\n });\r\n }\r\n }\r\n if (direction === 'horizontal') {\r\n res.labelPlacement = 'vertical';\r\n } else if (res?.labelPlacement) {\r\n delete res.labelPlacement;\r\n }\r\n }\r\n return res;\r\n};\r\n\r\nexport default formatStepsProps;\r\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,0BAA0B;AAC/C,SAASC,GAAG,QAAQ,QAAQ;AAoB5B,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA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AClDF,MAAM,CAACC,IAAI,CAACjB,SAAS,CAAC,CAACmB,OAAO,CAAC,UAAAC,GAAG,EAAI;cACpC,IAAMC,WAAW,GAAG,GAAAC,MAAA,CAAGtB,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAGoB,GAAG,CAA2B,KAAM,EAAE;cACzE,IAAIL,YAAY,IAAIM,WAAW,IAAI,GAAAC,MAAA,CAAGP,YAAY,MAAOM,WAAW,EAAE;gBACpEN,YAAY,GAAGK,GAAG;cACpB;YACF,CAAC,CAAC;UACJ;UACA,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","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,cA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AGtB,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAGoB,GAAG,CAA2B,KAAM,EAAE;cACzE,IAAIL,YAAY,IAAIM,WAAW,IAAI,GAAAC,MAAA,CAAGP,YAAY,MAAOM,WAAW,EAAE;gBACpEN,YAAY,GAAGK,GAAG;cACpB;YACF,CAAC,CAAC;UACJ;UACA,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 +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';\r\n\r\nconst formatStyleProps = (props: {[key:string]: any}, parentModuleProps?: {[key:string]: any}|null):{[key:string]: any} => {\r\n const cloneProps: {[key:string]: any} = props ? cloneDeep(props) : {};\r\n const { compProps = {} } = cloneProps;\r\n const { style = {} } = compProps || {};\r\n\r\n const alignKey1 = ['column', 'column-reverse'].includes(style?.['flex-direction']) ? 'alignItems' : 'justifyContent';\r\n const alignKey2 = !style?.['flex-direction'] || ['row', 'row-reverse'].includes(style?.['flex-direction']) ? 'alignItems' : 'justifyContent';\r\n const alignStyleMap:{[key:string]: {[key:string]: string}} = {\r\n leftTop: {\r\n [alignKey1]: 'flex-start',\r\n [alignKey2]: 'flex-start',\r\n },\r\n topCenter: {\r\n [alignKey1]: 'center',\r\n [alignKey2]: 'flex-start',\r\n },\r\n rightTop: {\r\n [alignKey1]: 'flex-end',\r\n [alignKey2]: 'flex-start',\r\n },\r\n leftCenter: {\r\n [alignKey1]: 'flex-start',\r\n [alignKey2]: 'center',\r\n },\r\n center: {\r\n [alignKey1]: 'center',\r\n [alignKey2]: 'center',\r\n },\r\n rightCenter: {\r\n [alignKey1]: 'flex-end',\r\n [alignKey2]: 'center',\r\n },\r\n leftBottom: {\r\n [alignKey1]: 'flex-start',\r\n [alignKey2]: 'flex-end',\r\n },\r\n bottomCenter: {\r\n [alignKey1]: 'center',\r\n [alignKey2]: 'flex-end',\r\n },\r\n rightBottom: {\r\n [alignKey1]: 'flex-end',\r\n [alignKey2]: 'flex-end',\r\n },\r\n };\r\n\r\n const styleObj:{[key:string]: any} = {};\r\n if (compProps.style && Object.keys(compProps.style)?.length > 0) {\r\n Object.keys(compProps.style).forEach(styleKey => {\r\n if (compProps.style?.[styleKey]) {\r\n if (['padding', 'margin'].includes(styleKey)) {\r\n styleObj[styleKey] = Array.isArray(compProps.style?.[styleKey]) ?\r\n compProps.style?.[styleKey].join(' ') : compProps.style?.[styleKey];\r\n } else if (!['gridColumns', 'alignMode'].includes(styleKey)) {\r\n styleObj[styleKey] = compProps.style?.[styleKey];\r\n }\r\n }\r\n });\r\n }\r\n\r\n if (parentModuleProps?.compProps?.style?.display === 'flex' && !compProps.style?.width) {\r\n styleObj.flex = '1';\r\n } else if (styleObj?.flex) {\r\n delete styleObj.flex;\r\n }\r\n\r\n if (compProps?.style?.display === 'grid') {\r\n const _gridColumns:string[] = [];\r\n if (Array.isArray(props?.children)) {\r\n props?.children.forEach((col:any) => {\r\n if (col?.compProps?.style?.width) {\r\n _gridColumns.push(col.compProps.style.width);\r\n } else {\r\n _gridColumns.push('1fr');\r\n }\r\n });\r\n }\r\n if (compProps?.style?.gridColumns > 1) {\r\n styleObj['grid-template-columns'] = `repeat(${compProps.style.gridColumns}, minmax(0, ${Math.ceil(100 / compProps?.style?.gridColumns)}%))`;\r\n } else if (_gridColumns?.length > 0) {\r\n styleObj['grid-template-columns'] = `${_gridColumns.join(' ')}`;\r\n } else if (compProps.style.gridColumns > 1) {\r\n styleObj['grid-template-columns'] = `repeat(${compProps.style.gridColumns}, 1fr)`;\r\n }\r\n } else if (styleObj['grid-template-columns']) {\r\n delete styleObj['grid-template-columns'];\r\n }\r\n \r\n return {\r\n ...styleObj,\r\n ...(alignStyleMap[style?.alignMode] || {}),\r\n };\r\n};\r\n\r\nexport default formatStyleProps;\r\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;I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","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,CA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,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,3 +1,4 @@
1
+ import { contralBtnProps } from '@boteteam/types';
1
2
  export type formatTablePropsType = {
2
3
  options?: {
3
4
  attrs?: {
@@ -11,6 +12,7 @@ export type formatTablePropsType = {
11
12
  columnMinWidth?: string;
12
13
  columnMaxWidth?: string;
13
14
  tableBodyHeight?: string;
15
+ controlBtns?: contralBtnProps[];
14
16
  };
15
17
  staticCodeMap?: {
16
18
  [key: string]: any;
@@ -30,6 +32,9 @@ export type formatTablePropsExportType = {
30
32
  y?: string;
31
33
  x?: string;
32
34
  };
35
+ controlBtns?: {
36
+ [key: string]: any;
37
+ }[];
33
38
  };
34
39
  declare const formatTableProps: ({ staticCodeMap, parameters, options, }: formatTablePropsType) => formatTablePropsExportType;
35
40
  export default formatTableProps;
@@ -8,6 +8,7 @@ import { getDataArr } from "../../treeUtils";
8
8
  import { stringScriptExecution } from "./stringScriptExecution";
9
9
  // import stringPramarsValTransition from './stringPramarsValTransition';
10
10
  import { get } from 'lodash';
11
+ import formatControlBtn from "./formatControlBtn";
11
12
  var formatTableProps = function formatTableProps(_ref) {
12
13
  var staticCodeMap = _ref.staticCodeMap,
13
14
  parameters = _ref.parameters,
@@ -15,6 +16,7 @@ var formatTableProps = function formatTableProps(_ref) {
15
16
  options = _ref$options === void 0 ? {} : _ref$options;
16
17
  var attrs = options.attrs,
17
18
  dataSource = options.dataSource,
19
+ controlBtns = options.controlBtns,
18
20
  columns = options.columns,
19
21
  columnWidth = options.columnWidth,
20
22
  columnMinWidth = options.columnMinWidth,
@@ -22,6 +24,7 @@ var formatTableProps = function formatTableProps(_ref) {
22
24
  tableBodyHeight = options.tableBodyHeight;
23
25
  var _columns = [];
24
26
  var dataList = [];
27
+ var controlBtnsList = [];
25
28
  var scroll = {};
26
29
  if (typeof columns === 'string' && columns) {
27
30
  var columnsArr = getDataArr(columns);
@@ -121,9 +124,18 @@ var formatTableProps = function formatTableProps(_ref) {
121
124
  y: tableBodyHeight
122
125
  };
123
126
  }
127
+ if (Array.isArray(controlBtns) && controlBtns.length > 0) {
128
+ controlBtnsList = controlBtns.map(function (btn) {
129
+ return formatControlBtn({
130
+ btnProps: btn,
131
+ parameters: parameters
132
+ });
133
+ });
134
+ }
124
135
  return {
125
136
  columns: _columns,
126
137
  dataSource: dataList,
138
+ controlBtns: controlBtnsList,
127
139
  scroll: scroll
128
140
  };
129
141
  };
@@ -1 +1 @@
1
- {"version":3,"names":["getDataArr","stringScriptExecution","get","formatTableProps","_ref","staticCodeMap","parameters","_ref$options","options","attrs","dataSource","columns","columnWidth","columnMinWidth","columnMaxWidth","tableBodyHeight","_columns","dataList","scroll","columnsArr","columnsList","Array","isArray","forEach","colItem","colObj","key","dataIndex","title","colWidth","width","colMinWidth","minWidth","colMaxWidth","maxWidth","style","_objectSpread","push","length","attrItem","attrsDisplay","display","codeExtendVal","attrCode","attrName","attrWidth","attrMinWidth","attrMaxWidth","dataIndexArr","defaultValue","_dataIndexArr$slice","slice","staticCode","render","val","_staticCodeMap$attrIt","dataSourceArr","dataSourceList","y"],"sources":["../../../../src/formatModule/helpers/formatTableProps.ts"],"sourcesContent":["import { getDataArr } from '../../treeUtils';\r\nimport { stringScriptExecution } from './stringScriptExecution';\r\n// import stringPramarsValTransition from './stringPramarsValTransition';\r\nimport { get } from 'lodash';\r\n\r\nexport type formatTablePropsType = {\r\n options?: {\r\n attrs?: {[key:string]: any}[];\r\n columns?: {[key: string]: any}[];\r\n dataSource?: string;\r\n columnWidth?: string;\r\n columnMinWidth?: string;\r\n columnMaxWidth?: string;\r\n tableBodyHeight?: string;\r\n }\r\n staticCodeMap?: {[key:string]: any};\r\n parameters?: {[key:string]: any};\r\n}\r\n\r\nexport type formatTablePropsExportType = {\r\n columns: {[key: string]: any}[]\r\n dataSource: {[key: string]: any}[]\r\n scroll?: { y?: string, x?: string };\r\n}\r\n\r\nconst formatTableProps = ({\r\n staticCodeMap,\r\n parameters,\r\n options = {},\r\n}: formatTablePropsType): formatTablePropsExportType => {\r\n const {\r\n attrs,\r\n dataSource,\r\n columns,\r\n columnWidth,\r\n columnMinWidth,\r\n columnMaxWidth,\r\n tableBodyHeight,\r\n } = options;\r\n const _columns: {[key: string]: any}[] = [];\r\n let dataList: {[key: string]: any}[] = [];\r\n let scroll: { y?: string, x?: string } = {};\r\n\r\n if (typeof columns === 'string' && columns) {\r\n const columnsArr = getDataArr(columns);\r\n const columnsList = get(\r\n parameters,\r\n columnsArr,\r\n );\r\n if (Array.isArray(columnsList)) {\r\n columnsList.forEach((colItem) => {\r\n const colObj: { [key: string]: any } = {\r\n key: colItem?.dataIndex,\r\n title: colItem?.title,\r\n dataIndex: colItem?.dataIndex,\r\n };\r\n const colWidth = colItem?.width || columnWidth;\r\n const colMinWidth = colItem?.minWidth || columnMinWidth;\r\n const colMaxWidth = colItem?.maxWidth || columnMaxWidth;\r\n if (colWidth) {\r\n colObj.style = {\r\n ...(colObj.style || {}),\r\n width: colWidth,\r\n };\r\n }\r\n if (colMinWidth) {\r\n colObj.style = {\r\n ...(colObj.style || {}),\r\n minWidth: colMinWidth,\r\n };\r\n }\r\n if (colMaxWidth) {\r\n colObj.style = {\r\n ...(colObj.style || {}),\r\n maxWidth: colMaxWidth,\r\n };\r\n }\r\n _columns.push(colObj);\r\n });\r\n }\r\n } else if (Array.isArray(attrs) && attrs.length > 0) {\r\n attrs.forEach((attrItem) => {\r\n let attrsDisplay: boolean = true;\r\n if (typeof attrItem?.display === 'boolean' || typeof attrItem?.display === 'string') {\r\n if (typeof attrItem?.display === 'boolean') {\r\n attrsDisplay = attrItem?.display;\r\n } else if (typeof attrItem?.display === 'string' && attrItem?.display) {\r\n // const scriptCodeStr = stringPramarsValTransition(attrItem?.display, parameters || {});\r\n const codeExtendVal = stringScriptExecution(\r\n attrItem?.display,\r\n parameters || {},\r\n );\r\n attrsDisplay = codeExtendVal;\r\n }\r\n }\r\n\r\n if (attrsDisplay) {\r\n const colObj: { [key: string]: any } = {\r\n key: attrItem?.attrCode,\r\n title: attrItem?.attrName,\r\n };\r\n const colWidth = attrItem?.attrWidth || columnWidth;\r\n const colMinWidth = attrItem?.attrMinWidth || columnMinWidth;\r\n const colMaxWidth = attrItem?.attrMaxWidth || columnMaxWidth;\r\n if (typeof attrItem?.attrWidth === 'string') {\r\n colObj.width = attrItem?.attrWidth;\r\n }\r\n if (colWidth) {\r\n colObj.style = {\r\n ...(colObj.style || {}),\r\n width: colWidth,\r\n };\r\n }\r\n if (colMinWidth) {\r\n colObj.style = {\r\n ...(colObj.style || {}),\r\n minWidth: colMinWidth,\r\n };\r\n }\r\n if (colMaxWidth) {\r\n colObj.style = {\r\n ...(colObj.style || {}),\r\n maxWidth: colMaxWidth,\r\n };\r\n }\r\n const dataIndexArr = getDataArr(attrItem?.defaultValue);\r\n if (Array.isArray(dataIndexArr) && dataIndexArr.length > 0) {\r\n colObj.dataIndex = dataIndexArr.slice(-1)?.[0];\r\n }\r\n if (\r\n attrItem?.staticCode &&\r\n staticCodeMap?.[attrItem?.staticCode]\r\n ) {\r\n colObj.render = (val: string) => {\r\n return staticCodeMap?.[attrItem?.staticCode]?.[val] || val;\r\n };\r\n }\r\n _columns.push(colObj);\r\n }\r\n });\r\n }\r\n if (dataSource) {\r\n const dataSourceArr = getDataArr(dataSource);\r\n if (parameters) {\r\n const dataSourceList = get(\r\n parameters,\r\n dataSourceArr,\r\n );\r\n if (Array.isArray(dataSourceList)) {\r\n dataList = dataSourceList;\r\n }\r\n }\r\n }\r\n if (typeof tableBodyHeight === 'string' && tableBodyHeight) {\r\n scroll = {\r\n y: tableBodyHeight,\r\n };\r\n }\r\n return {\r\n columns: _columns,\r\n dataSource: dataList,\r\n scroll,\r\n };\r\n};\r\n\r\nexport default formatTableProps;\r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AAIf,UAAU,EAAE;IACd,IAAM8C,aAAa,GAAGxD,UAAU,CAACU,UAAU,CAAC;IAC5C,IAAIJ,UAAU,EAAE;MACd,IAAMmD,cAAc,GAAGvD,GAAG,CACxBI,UAAU,EACVkD,aACF,CAAC;MACD,IAAInC,KAAK,CAACC,OAAO,CAACmC,cAAc,CAAC,EAAE;QACjCxC,QAAQ,GAAGwC,cAAc;MAC3B;IACF;EACF;EACA,IAAI,OAAO1C,eAAe,KAAK,QAAQ,IAAIA,eAAe,EAAE;IAC1DG,MAAM,GAAG;MACPwC,CAAC,EAAE3C;IACL,CAAC;EACH;EACA,OAAO;IACLJ,OAAO,EAAEK,QAAQ;IACjBN,UAAU,EAAEO,QAAQ;IACpBC,MAAM,EAANA;EACF,CAAC;AACH,CAAC;AAED,eAAef,gBAAgB"}
1
+ {"version":3,"names":["getDataArr","stringScriptExecution","get","formatControlBtn","formatTableProps","_ref","staticCodeMap","parameters","_ref$options","options","attrs","dataSource","controlBtns","columns","columnWidth","columnMinWidth","columnMaxWidth","tableBodyHeight","_columns","dataList","controlBtnsList","scroll","columnsArr","columnsList","Array","isArray","forEach","colItem","colObj","key","dataIndex","title","colWidth","width","colMinWidth","minWidth","colMaxWidth","maxWidth","style","_objectSpread","push","length","attrItem","attrsDisplay","display","codeExtendVal","attrCode","attrName","attrWidth","attrMinWidth","attrMaxWidth","dataIndexArr","defaultValue","_dataIndexArr$slice","slice","staticCode","render","val","_staticCodeMap$attrIt","dataSourceArr","dataSourceList","y","map","btn","btnProps"],"sources":["../../../../src/formatModule/helpers/formatTableProps.ts"],"sourcesContent":["import { getDataArr } from '../../treeUtils';\nimport { stringScriptExecution } from './stringScriptExecution';\n// import stringPramarsValTransition from './stringPramarsValTransition';\nimport { get } from 'lodash';\nimport { contralBtnProps } from '@boteteam/types';\nimport formatControlBtn from './formatControlBtn';\n\nexport type formatTablePropsType = {\n options?: {\n attrs?: {[key:string]: any}[];\n columns?: {[key: string]: any}[];\n dataSource?: string;\n columnWidth?: string;\n columnMinWidth?: string;\n columnMaxWidth?: string;\n tableBodyHeight?: string;\n controlBtns?: contralBtnProps[];\n }\n staticCodeMap?: {[key:string]: any};\n parameters?: {[key:string]: any};\n}\n\nexport type formatTablePropsExportType = {\n columns: {[key: string]: any}[]\n dataSource: {[key: string]: any}[]\n scroll?: { y?: string, x?: string };\n controlBtns?: {[key: string]: any}[];\n}\n\nconst formatTableProps = ({\n staticCodeMap,\n parameters,\n options = {},\n}: formatTablePropsType): formatTablePropsExportType => {\n const {\n attrs,\n dataSource,\n controlBtns,\n columns,\n columnWidth,\n columnMinWidth,\n columnMaxWidth,\n tableBodyHeight,\n } = options;\n const _columns: {[key: string]: any}[] = [];\n let dataList: {[key: string]: any}[] = [];\n let controlBtnsList: {[key: string]: any}[] = [];\n let scroll: { y?: string, x?: string } = {};\n\n if (typeof columns === 'string' && columns) {\n const columnsArr = getDataArr(columns);\n const columnsList = get(\n parameters,\n columnsArr,\n );\n if (Array.isArray(columnsList)) {\n columnsList.forEach((colItem) => {\n const colObj: { [key: string]: any } = {\n key: colItem?.dataIndex,\n title: colItem?.title,\n dataIndex: colItem?.dataIndex,\n };\n const colWidth = colItem?.width || columnWidth;\n const colMinWidth = colItem?.minWidth || columnMinWidth;\n const colMaxWidth = colItem?.maxWidth || columnMaxWidth;\n if (colWidth) {\n colObj.style = {\n ...(colObj.style || {}),\n width: colWidth,\n };\n }\n if (colMinWidth) {\n colObj.style = {\n ...(colObj.style || {}),\n minWidth: colMinWidth,\n };\n }\n if (colMaxWidth) {\n colObj.style = {\n ...(colObj.style || {}),\n maxWidth: colMaxWidth,\n };\n }\n _columns.push(colObj);\n });\n }\n } else if (Array.isArray(attrs) && attrs.length > 0) {\n 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 scriptCodeStr = stringPramarsValTransition(attrItem?.display, parameters || {});\n const codeExtendVal = stringScriptExecution(\n attrItem?.display,\n parameters || {},\n );\n attrsDisplay = codeExtendVal;\n }\n }\n\n if (attrsDisplay) {\n const colObj: { [key: string]: any } = {\n key: attrItem?.attrCode,\n title: attrItem?.attrName,\n };\n const colWidth = attrItem?.attrWidth || columnWidth;\n const colMinWidth = attrItem?.attrMinWidth || columnMinWidth;\n const colMaxWidth = attrItem?.attrMaxWidth || columnMaxWidth;\n if (typeof attrItem?.attrWidth === 'string') {\n colObj.width = attrItem?.attrWidth;\n }\n if (colWidth) {\n colObj.style = {\n ...(colObj.style || {}),\n width: colWidth,\n };\n }\n if (colMinWidth) {\n colObj.style = {\n ...(colObj.style || {}),\n minWidth: colMinWidth,\n };\n }\n if (colMaxWidth) {\n colObj.style = {\n ...(colObj.style || {}),\n maxWidth: colMaxWidth,\n };\n }\n const dataIndexArr = getDataArr(attrItem?.defaultValue);\n if (Array.isArray(dataIndexArr) && dataIndexArr.length > 0) {\n colObj.dataIndex = dataIndexArr.slice(-1)?.[0];\n }\n if (\n attrItem?.staticCode &&\n staticCodeMap?.[attrItem?.staticCode]\n ) {\n colObj.render = (val: string) => {\n return staticCodeMap?.[attrItem?.staticCode]?.[val] || val;\n };\n }\n _columns.push(colObj);\n }\n });\n }\n if (dataSource) {\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 if (typeof tableBodyHeight === 'string' && tableBodyHeight) {\n scroll = {\n y: tableBodyHeight,\n };\n }\n if (Array.isArray(controlBtns) && controlBtns.length > 0) {\n controlBtnsList = controlBtns.map(btn => formatControlBtn({\n btnProps: btn,\n parameters,\n }));\n }\n return {\n columns: _columns,\n dataSource: dataList,\n controlBtns: controlBtnsList,\n scroll,\n };\n};\n\nexport default formatTableProps;\n"],"mappings":";;;;;;AAA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AAQ,CAACsB,IAAI,CAACZ,MAAM,CAAC;MACvB;IACF,CAAC,CAAC;EACJ;EACA,IAAIjB,UAAU,EAAE;IACd,IAAMgD,aAAa,GAAG3D,UAAU,CAACW,UAAU,CAAC;IAC5C,IAAIJ,UAAU,EAAE;MACd,IAAMqD,cAAc,GAAG1D,GAAG,CACxBK,UAAU,EACVoD,aACF,CAAC;MACD,IAAInC,KAAK,CAACC,OAAO,CAACmC,cAAc,CAAC,EAAE;QACjCzC,QAAQ,GAAGyC,cAAc;MAC3B;IACF;EACF;EACA,IAAI,OAAO3C,eAAe,KAAK,QAAQ,IAAIA,eAAe,EAAE;IAC1DI,MAAM,GAAG;MACPwC,CAAC,EAAE5C;IACL,CAAC;EACH;EACA,IAAIO,KAAK,CAACC,OAAO,CAACb,WAAW,CAAC,IAAIA,WAAW,CAAC6B,MAAM,GAAG,CAAC,EAAE;IACxDrB,eAAe,GAAGR,WAAW,CAACkD,GAAG,CAAC,UAAAC,GAAG;MAAA,OAAI5D,gBAAgB,CAAC;QACxD6D,QAAQ,EAAED,GAAG;QACbxD,UAAU,EAAVA;MACF,CAAC,CAAC;IAAA,EAAC;EACL;EACA,OAAO;IACLM,OAAO,EAAEK,QAAQ;IACjBP,UAAU,EAAEQ,QAAQ;IACpBP,WAAW,EAAEQ,eAAe;IAC5BC,MAAM,EAANA;EACF,CAAC;AACH,CAAC;AAED,eAAejB,gBAAgB"}
@@ -1,6 +1,7 @@
1
1
  import stringPramarsValTransition from './stringPramarsValTransition';
2
2
  import patternTransitionRegExp from './patternTransitionRegExp';
3
3
  import staticCodeAssemble from './staticCodeAssemble';
4
+ import formatPanelProps from './formatPanelProps';
4
5
  import formatTableProps from './formatTableProps';
5
6
  import formatListProps from './formatListProps';
6
7
  import formatImageProps from './formatImageProps';
@@ -14,7 +15,9 @@ import formatChartsProps from './formatChartsProps';
14
15
  import formatLoopProps from './formatLoopProps';
15
16
  import formatStyleProps from './formatStyleProps';
16
17
  import formatStepsProps from './formatStepsProps';
18
+ import formatIconProps from './formatIconProps';
19
+ import formatControlBtn from './formatControlBtn';
17
20
  import formRulsRegMap from './formRulsRegMap';
18
21
  import urlPrefix from './urlPrefix';
19
22
  import { stringScriptExecution, createCompartmentExecution } from './stringScriptExecution';
20
- export { urlPrefix, formRulsRegMap, formatListProps, formatTableProps, formatCarouselProps, formatImageProps, formatDescriptionsProps, formatFormProps, formatHighCodeProps, formatEchartLineProps, formatEchartPieProps, formatChartsProps, formatLoopProps, formatStyleProps, formatStepsProps, staticCodeAssemble, patternTransitionRegExp, stringPramarsValTransition, stringScriptExecution, createCompartmentExecution, };
23
+ export { urlPrefix, formRulsRegMap, formatPanelProps, formatListProps, formatTableProps, formatCarouselProps, formatImageProps, formatDescriptionsProps, formatFormProps, formatHighCodeProps, formatEchartLineProps, formatEchartPieProps, formatChartsProps, formatLoopProps, formatStyleProps, formatStepsProps, formatIconProps, formatControlBtn, staticCodeAssemble, patternTransitionRegExp, stringPramarsValTransition, stringScriptExecution, createCompartmentExecution, };