@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
@@ -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;
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,20 +16,29 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
18
  };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // src/formatModule/helpers/formatStyleProps.ts
20
30
  var formatStyleProps_exports = {};
21
31
  __export(formatStyleProps_exports, {
22
- default: () => formatStyleProps_default
32
+ default: () => formatStyleProps_default,
33
+ getStylePainter: () => getStylePainter
23
34
  });
24
35
  module.exports = __toCommonJS(formatStyleProps_exports);
25
36
  var import_lodash = require("lodash");
26
- var formatStyleProps = (props, parentModuleProps) => {
27
- var _a, _b, _c, _d, _e, _f, _g;
28
- const cloneProps = props ? (0, import_lodash.cloneDeep)(props) : {};
29
- const { compProps = {} } = cloneProps;
30
- const { style = {} } = compProps || {};
37
+ var import_stringScriptExecution = require("./stringScriptExecution");
38
+ var import_cssToJson = __toESM(require("./cssToJson"));
39
+ var getStylePainter = (style, children) => {
40
+ var _a;
41
+ let styleObj = {};
31
42
  const alignKey1 = ["column", "column-reverse"].includes(style == null ? void 0 : style["flex-direction"]) ? "alignItems" : "justifyContent";
32
43
  const alignKey2 = !(style == null ? void 0 : style["flex-direction"]) || ["row", "row-reverse"].includes(style == null ? void 0 : style["flex-direction"]) ? "alignItems" : "justifyContent";
33
44
  const alignStyleMap = {
@@ -68,50 +79,102 @@ var formatStyleProps = (props, parentModuleProps) => {
68
79
  [alignKey2]: "flex-end"
69
80
  }
70
81
  };
71
- const styleObj = {};
72
- if (compProps.style && ((_a = Object.keys(compProps.style)) == null ? void 0 : _a.length) > 0) {
73
- Object.keys(compProps.style).forEach((styleKey) => {
74
- var _a2, _b2, _c2, _d2, _e2;
75
- if ((_a2 = compProps.style) == null ? void 0 : _a2[styleKey]) {
82
+ if (style && ((_a = Object.keys(style)) == null ? void 0 : _a.length) > 0) {
83
+ Object.keys(style).forEach((styleKey) => {
84
+ if (["borderWidth", "borderColor", "borderStyle", "alignMode", "gridColumns", "inlineStyle"].includes(styleKey))
85
+ return;
86
+ if (style == null ? void 0 : style[styleKey]) {
76
87
  if (["padding", "margin"].includes(styleKey)) {
77
- styleObj[styleKey] = Array.isArray((_b2 = compProps.style) == null ? void 0 : _b2[styleKey]) ? (_c2 = compProps.style) == null ? void 0 : _c2[styleKey].join(" ") : (_d2 = compProps.style) == null ? void 0 : _d2[styleKey];
78
- } else if (!["gridColumns", "alignMode"].includes(styleKey)) {
79
- styleObj[styleKey] = (_e2 = compProps.style) == null ? void 0 : _e2[styleKey];
88
+ styleObj[styleKey] = Array.isArray(style == null ? void 0 : style[styleKey]) ? style == null ? void 0 : style[styleKey].join(" ") : style == null ? void 0 : style[styleKey];
89
+ } else if (styleKey === "borderRadius") {
90
+ if (Array.isArray(style == null ? void 0 : style[styleKey])) {
91
+ styleObj[styleKey] = style == null ? void 0 : style[styleKey].join(" ");
92
+ } else {
93
+ styleObj[styleKey] = style == null ? void 0 : style[styleKey];
94
+ }
95
+ } else {
96
+ styleObj[styleKey] = style == null ? void 0 : style[styleKey];
80
97
  }
81
98
  }
82
99
  });
100
+ if ((style == null ? void 0 : style.alignMode) && (alignStyleMap == null ? void 0 : alignStyleMap[style == null ? void 0 : style.alignMode])) {
101
+ styleObj = { ...styleObj, ...alignStyleMap == null ? void 0 : alignStyleMap[style == null ? void 0 : style.alignMode] };
102
+ }
103
+ if ((style == null ? void 0 : style.borderWidth) && (style == null ? void 0 : style.borderColor)) {
104
+ if (Array.isArray(style == null ? void 0 : style.borderWidth)) {
105
+ style == null ? void 0 : style.borderWidth.forEach((width, index) => {
106
+ const borderSide = ["Top", "Right", "Bottom", "Left"][index];
107
+ if (width) {
108
+ styleObj[`border${borderSide}Width`] = `${width}`;
109
+ styleObj[`border${borderSide}Color`] = style == null ? void 0 : style.borderColor;
110
+ styleObj[`border${borderSide}Style`] = (style == null ? void 0 : style.borderStyle) || "solid";
111
+ }
112
+ });
113
+ } else {
114
+ styleObj.border = `${style == null ? void 0 : style.borderWidth} ${(style == null ? void 0 : style.borderStyle) || "solid"} ${style == null ? void 0 : style.borderColor}`;
115
+ }
116
+ }
117
+ if ((style == null ? void 0 : style.display) === "grid") {
118
+ const _gridColumns = [];
119
+ if (Array.isArray(children)) {
120
+ children.forEach((col) => {
121
+ var _a2, _b;
122
+ if ((_b = (_a2 = col == null ? void 0 : col.compProps) == null ? void 0 : _a2.style) == null ? void 0 : _b.width) {
123
+ _gridColumns.push(col.compProps.style.width);
124
+ } else {
125
+ _gridColumns.push("1fr");
126
+ }
127
+ });
128
+ }
129
+ if ((style == null ? void 0 : style.gridColumns) > 1) {
130
+ styleObj["grid-template-columns"] = `repeat(${style.gridColumns}, minmax(0, ${Math.ceil(100 / (style == null ? void 0 : style.gridColumns))}%))`;
131
+ } else if ((_gridColumns == null ? void 0 : _gridColumns.length) > 0) {
132
+ styleObj["grid-template-columns"] = `${_gridColumns.join(" ")}`;
133
+ } else if (style.gridColumns > 1) {
134
+ styleObj["grid-template-columns"] = `repeat(${style.gridColumns}, 1fr)`;
135
+ }
136
+ } else if (styleObj["grid-template-columns"]) {
137
+ delete styleObj["grid-template-columns"];
138
+ }
83
139
  }
84
- if (((_c = (_b = parentModuleProps == null ? void 0 : parentModuleProps.compProps) == null ? void 0 : _b.style) == null ? void 0 : _c.display) === "flex" && !((_d = compProps.style) == null ? void 0 : _d.width)) {
85
- styleObj.flex = "1";
140
+ if (style == null ? void 0 : style.inlineStyle) {
141
+ const inlineStyleObj = (0, import_cssToJson.default)(style == null ? void 0 : style.inlineStyle);
142
+ styleObj = { ...styleObj, ...inlineStyleObj };
143
+ }
144
+ return styleObj;
145
+ };
146
+ var formatStyleProps = ({
147
+ moduleData,
148
+ parentModuleData,
149
+ parameters
150
+ }) => {
151
+ var _a, _b, _c, _d, _e, _f;
152
+ const cloneProps = moduleData ? (0, import_lodash.cloneDeep)(moduleData) : {};
153
+ const { compProps = {}, compType } = cloneProps;
154
+ const { style = {}, styleScript } = compProps || {};
155
+ let scriptStyleObj = {};
156
+ const styleObj = getStylePainter(style, moduleData == null ? void 0 : moduleData.children);
157
+ if (((_b = (_a = parentModuleData == null ? void 0 : parentModuleData.compProps) == null ? void 0 : _a.style) == null ? void 0 : _b.display) === "flex" && !["icon"].includes(compType) && !((_c = compProps.style) == null ? void 0 : _c.width)) {
158
+ if (!((_d = compProps.style) == null ? void 0 : _d.display) || ["block", "flex", "grid"].includes((_e = compProps.style) == null ? void 0 : _e.display)) {
159
+ styleObj.flex = "1";
160
+ }
86
161
  } else if (styleObj == null ? void 0 : styleObj.flex) {
87
162
  delete styleObj.flex;
88
163
  }
89
- if (((_e = compProps == null ? void 0 : compProps.style) == null ? void 0 : _e.display) === "grid") {
90
- const _gridColumns = [];
91
- if (Array.isArray(props == null ? void 0 : props.children)) {
92
- props == null ? void 0 : props.children.forEach((col) => {
93
- var _a2, _b2;
94
- if ((_b2 = (_a2 = col == null ? void 0 : col.compProps) == null ? void 0 : _a2.style) == null ? void 0 : _b2.width) {
95
- _gridColumns.push(col.compProps.style.width);
96
- } else {
97
- _gridColumns.push("1fr");
98
- }
99
- });
100
- }
101
- if (((_f = compProps == null ? void 0 : compProps.style) == null ? void 0 : _f.gridColumns) > 1) {
102
- styleObj["grid-template-columns"] = `repeat(${compProps.style.gridColumns}, minmax(0, ${Math.ceil(100 / ((_g = compProps == null ? void 0 : compProps.style) == null ? void 0 : _g.gridColumns))}%))`;
103
- } else if ((_gridColumns == null ? void 0 : _gridColumns.length) > 0) {
104
- styleObj["grid-template-columns"] = `${_gridColumns.join(" ")}`;
105
- } else if (compProps.style.gridColumns > 1) {
106
- styleObj["grid-template-columns"] = `repeat(${compProps.style.gridColumns}, 1fr)`;
164
+ if (styleScript) {
165
+ const scriptStyleResult = (0, import_stringScriptExecution.stringScriptExecution)(styleScript, parameters);
166
+ if (scriptStyleResult && typeof scriptStyleResult === "object" && ((_f = Object.keys(scriptStyleResult)) == null ? void 0 : _f.length) > 0) {
167
+ scriptStyleObj = scriptStyleResult;
107
168
  }
108
- } else if (styleObj["grid-template-columns"]) {
109
- delete styleObj["grid-template-columns"];
110
169
  }
111
170
  return {
112
171
  ...styleObj,
113
- ...alignStyleMap[style == null ? void 0 : style.alignMode] || {}
172
+ ...scriptStyleObj
114
173
  };
115
174
  };
116
175
  var formatStyleProps_default = formatStyleProps;
176
+ // Annotate the CommonJS export names for ESM import in node:
177
+ 0 && (module.exports = {
178
+ getStylePainter
179
+ });
117
180
  //# sourceMappingURL=formatStyleProps.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/formatModule/helpers/formatStyleProps.ts"],
4
- "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]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7C,OAAO;AACL,uBAAa,KAAK,KAAK;AAAA,QACzB;AAAA,MACF;AAAA,IACF;AACA,UAAI,4CAAW,UAAX,mBAAkB,eAAc,GAAG;AACrC,eAAS,uBAAuB,IAAI,UAAU,UAAU,MAAM,0BAA0B,KAAK,KAAK,QAAM,4CAAW,UAAX,mBAAkB,YAAW;AAAA,IACvI,YAAW,6CAAc,UAAS,GAAG;AACnC,eAAS,uBAAuB,IAAI,GAAG,aAAa,KAAK,GAAG;AAAA,IAC9D,WAAW,UAAU,MAAM,cAAc,GAAG;AAC1C,eAAS,uBAAuB,IAAI,UAAU,UAAU,MAAM;AAAA,IAChE;AAAA,EACF,WAAW,SAAS,uBAAuB,GAAG;AAC5C,WAAO,SAAS,uBAAuB;AAAA,EACzC;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAI,cAAc,+BAAO,SAAS,KAAK,CAAC;AAAA,EAC1C;AACF;AAEA,IAAO,2BAAQ;",
6
- "names": ["_a", "_b", "_c", "_d", "_e"]
4
+ "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"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA0B;AAC1B,mCAAsC;AACtC,uBAAsB;AAEf,IAAM,kBAAkB,CAAC,OAA4B,aAAqC;AAJjG;AAKE,MAAI,WAA+B,CA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,IAClB;AAAA,EACF,WAAW,qCAAU,MAAM;AACzB,WAAO,SAAS;AAAA,EAClB;AAEA,MAAI,aAAa;AACf,UAAM,wBAAoB,oDAAsB,aAAa,UAAU;AACvE,QAAI,qBAAqB,OAAO,sBAAsB,cAAY,YAAO,KAAK,iBAAiB,MAA7B,mBAAgC,UAAS,GAAG;AAC5G,uBAAiB;AAAA,IACnB;AAAA,EACF;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;AAEA,IAAO,2BAAQ;",
6
+ "names": ["_a", "cssToJson"]
7
7
  }
@@ -1,6 +1,7 @@
1
1
  import { contralBtnProps } from '@boteteam/types';
2
2
  export type formatTablePropsType = {
3
3
  options?: {
4
+ columnsSource?: 'staticColumns' | 'paramsColumns';
4
5
  attrs?: {
5
6
  [key: string]: any;
6
7
  }[];
@@ -13,10 +14,14 @@ export type formatTablePropsType = {
13
14
  columnMaxWidth?: string;
14
15
  tableBodyHeight?: string;
15
16
  controlBtns?: contralBtnProps[];
17
+ hasEdit?: boolean;
16
18
  };
17
19
  staticCodeMap?: {
18
20
  [key: string]: any;
19
21
  };
22
+ staticOptionsMap?: {
23
+ [key: string]: any;
24
+ };
20
25
  parameters?: {
21
26
  [key: string]: any;
22
27
  };
@@ -35,6 +40,7 @@ export type formatTablePropsExportType = {
35
40
  controlBtns?: {
36
41
  [key: string]: any;
37
42
  }[];
43
+ hasEdit?: boolean;
38
44
  };
39
- declare const formatTableProps: ({ staticCodeMap, parameters, options, }: formatTablePropsType) => formatTablePropsExportType;
45
+ declare const formatTableProps: ({ staticCodeMap, staticOptionsMap, parameters, options, }: formatTablePropsType) => formatTablePropsExportType;
40
46
  export default formatTableProps;
@@ -36,8 +36,10 @@ var import_treeUtils = require("../../treeUtils");
36
36
  var import_stringScriptExecution = require("./stringScriptExecution");
37
37
  var import_lodash = require("lodash");
38
38
  var import_formatControlBtn = __toESM(require("./formatControlBtn"));
39
+ var import_checkDataSourceOfFn = __toESM(require("./checkDataSourceOfFn"));
39
40
  var formatTableProps = ({
40
41
  staticCodeMap,
42
+ staticOptionsMap = {},
41
43
  parameters,
42
44
  options = {}
43
45
  }) => {
@@ -49,13 +51,23 @@ var formatTableProps = ({
49
51
  columnWidth,
50
52
  columnMinWidth,
51
53
  columnMaxWidth,
52
- tableBodyHeight
54
+ tableBodyHeight,
55
+ columnsSource,
56
+ hasEdit
53
57
  } = options;
54
58
  const _columns = [];
55
59
  let dataList = [];
56
60
  let controlBtnsList = [];
57
61
  let scroll = {};
58
- if (typeof columns === "string" && columns) {
62
+ let _columnsSource = columnsSource;
63
+ if (!columnsSource) {
64
+ if (typeof columns === "string" && columns) {
65
+ _columnsSource = "paramsColumns";
66
+ } else {
67
+ _columnsSource = "staticColumns";
68
+ }
69
+ }
70
+ if (_columnsSource === "paramsColumns" && typeof columns === "string" && columns) {
59
71
  const columnsArr = (0, import_treeUtils.getDataArr)(columns);
60
72
  const columnsList = (0, import_lodash.get)(
61
73
  parameters,
@@ -92,7 +104,7 @@ var formatTableProps = ({
92
104
  _columns.push(colObj);
93
105
  });
94
106
  }
95
- } else if (Array.isArray(attrs) && attrs.length > 0) {
107
+ } else if (_columnsSource === "staticColumns" && Array.isArray(attrs) && attrs.length > 0) {
96
108
  attrs.forEach((attrItem) => {
97
109
  var _a;
98
110
  let attrsDisplay = true;
@@ -146,19 +158,41 @@ var formatTableProps = ({
146
158
  return ((_a2 = staticCodeMap == null ? void 0 : staticCodeMap[attrItem == null ? void 0 : attrItem.staticCode]) == null ? void 0 : _a2[val]) || val;
147
159
  };
148
160
  }
161
+ if (hasEdit && (attrItem == null ? void 0 : attrItem.canEdit)) {
162
+ const rules = [];
163
+ colObj.type = (attrItem == null ? void 0 : attrItem.componentType) || "input";
164
+ colObj.canEdit = true;
165
+ colObj.componentProps = { ...(attrItem == null ? void 0 : attrItem.componentProps) || {} };
166
+ if (attrItem == null ? void 0 : attrItem.required) {
167
+ rules.push({ required: true, message: `${attrItem == null ? void 0 : attrItem.attrName}不能为空` });
168
+ }
169
+ if (Array.isArray(attrItem == null ? void 0 : attrItem.rules) && (attrItem == null ? void 0 : attrItem.rules.length) > 0) {
170
+ rules.concat(...attrItem == null ? void 0 : attrItem.rules);
171
+ }
172
+ if (attrItem == null ? void 0 : attrItem.staticCode) {
173
+ colObj.componentProps.options = (staticOptionsMap == null ? void 0 : staticOptionsMap[attrItem == null ? void 0 : attrItem.staticCode]) || [];
174
+ }
175
+ colObj.formProps = {
176
+ rules
177
+ };
178
+ }
149
179
  _columns.push(colObj);
150
180
  }
151
181
  });
152
182
  }
153
183
  if (dataSource) {
154
- const dataSourceArr = (0, import_treeUtils.getDataArr)(dataSource);
155
- if (parameters) {
156
- const dataSourceList = (0, import_lodash.get)(
157
- parameters,
158
- dataSourceArr
159
- );
160
- if (Array.isArray(dataSourceList)) {
161
- dataList = dataSourceList;
184
+ if ((0, import_checkDataSourceOfFn.default)(dataSource)) {
185
+ dataList = (0, import_stringScriptExecution.stringScriptExecution)(dataSource) || [];
186
+ } else {
187
+ const dataSourceArr = (0, import_treeUtils.getDataArr)(dataSource);
188
+ if (parameters) {
189
+ const dataSourceList = (0, import_lodash.get)(
190
+ parameters,
191
+ dataSourceArr
192
+ );
193
+ if (Array.isArray(dataSourceList)) {
194
+ dataList = dataSourceList;
195
+ }
162
196
  }
163
197
  }
164
198
  }
@@ -177,6 +211,7 @@ var formatTableProps = ({
177
211
  columns: _columns,
178
212
  dataSource: dataList,
179
213
  controlBtns: controlBtnsList,
214
+ hasEdit,
180
215
  scroll
181
216
  };
182
217
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/formatModule/helpers/formatTableProps.ts"],
4
- "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"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA2B;AAC3B,mCAAsC;AAEtC,oBAAoB;AAEpB,8BAA6B;AAwB7B,IAAM,mBAAmB,CAAC;AAAA,EACxB;AAAA,EACA;AAAA,EACA,UAAU,CAAC;AACb,MAAwD;AACtD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,WAAmC,CAAC;AAC1C,MAAI,WAAmC,CAAC;AACxC,MAAI,kBAA0C,CAAC;AAC/C,MAAI,SAAqC,CAAC;AAE1C,MAAI,OAAO,YAAY,YAAY,SAAS;AAC1C,UAAM,iBAAa,6BAAW,OAAO;AACrC,UAAM,kBAAc;AAAA,MAClB;AAAA,MACA;AAAA,IACF;AACA,QAAI,MAAM,QAAQ,WAAW,GAAG;AAC9B,kBAAY,QAAQ,CAAC,YAAY;AAC/B,cAAM,SAAiC;AAAA,UACrC,KAAK,mCAAS;AAAA,UACd,OAAO,mCAAS;AAAA,UAChB,WAAW,mCAAS;AAAA,QACtB;AACA,cAAM,YAAW,mCAAS,UAAS;AACnC,cAAM,eAAc,mCAAS,aAAY;AACzC,cAAM,eAAc,mCAAS,aAAY;AACzC,YAAI,UAAU;AACZ,iBAAO,QAAQ;AAAA,YACb,GAAI,OAAO,SAAS,CAAC;AAAA,YACrB,OAAO;AAAA,UACT;AAAA,QACF;AACA,YAAI,aAAa;AACf,iBAAO,QAAQ;AAAA,YACb,GAAI,OAAO,SAAS,CAAC;AAAA,YACrB,UAAU;AAAA,UACZ;AAAA,QACF;AACA,YAAI,aAAa;AACf,iBAAO,QAAQ;AAAA,YACb,GAAI,OAAO,SAAS,CAAC;AAAA,YACrB,UAAU;AAAA,UACZ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BAAyB;AAAA,QAC9C;AACA,aACE,qCAAU,gBACJ,+CAAgB,qCAAU,cAChC;AACA,iBAAO,SAAS,CAAC,QAAgB;AA3I3C,gBAAAA;AA4IY,qBAAOA,MAAA,+CAAgB,qCAAU,gBAA1B,gBAAAA,IAAwC,SAAQ;AAAA,UACzD;AAAA,QACF;AACA,iBAAS,KAAK,MAAM;AAAA,MACtB;AAAA,IACF,CAAC;AAAA,EACH;AACA,MAAI,YAAY;AACd,UAAM,oBAAgB,6BAAW,UAAU;AAC3C,QAAI,YAAY;AACd,YAAM,qBAAiB;AAAA,QACrB;AAAA,QACA;AAAA,MACF;AACA,UAAI,MAAM,QAAQ,cAAc,GAAG;AACjC,mBAAW;AAAA,MACb;AAAA,IACF;AAAA,EACF;AACA,MAAI,OAAO,oBAAoB,YAAY,iBAAiB;AAC1D,aAAS;AAAA,MACP,GAAG;AAAA,IACL;AAAA,EACF;AACA,MAAI,MAAM,QAAQ,WAAW,KAAK,YAAY,SAAS,GAAG;AACxD,sBAAkB,YAAY,IAAI,aAAO,wBAAAC,SAAiB;AAAA,MACxD,UAAU;AAAA,MACV;AAAA,IACF,CAAC,CAAC;AAAA,EACJ;AACA,SAAO;AAAA,IACL,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,aAAa;AAAA,IACb;AAAA,EACF;AACF;AAEA,IAAO,2BAAQ;",
6
- "names": ["_a", "formatControlBtn"]
4
+ "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';\nimport checkDataSourceOfFn from './checkDataSourceOfFn';\n\nexport type formatTablePropsType = {\n options?: {\n columnsSource?: 'staticColumns' | 'paramsColumns';\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 hasEdit?: boolean;\n }\n staticCodeMap?: {[key:string]: any};\n staticOptionsMap?: {[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 hasEdit?: boolean;\n}\n\nconst formatTableProps = ({\n staticCodeMap,\n staticOptionsMap = {},\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 columnsSource,\n hasEdit,\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 let _columnsSource = columnsSource;\n\n // 如果未配置表头数据源,则根据列数据源配置判断\n if (!columnsSource) {\n if (typeof columns === 'string' && columns) {\n _columnsSource = 'paramsColumns';\n } else {\n _columnsSource = 'staticColumns';\n }\n }\n if (_columnsSource === 'paramsColumns' && 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 (_columnsSource === 'staticColumns' && 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 // eslint-disable-next-line no-template-curly-in-string\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 // 如果是可编辑模式下,添加编辑相关属性\n if (hasEdit && attrItem?.canEdit) {\n const rules = [];\n colObj.type = attrItem?.componentType || 'input';\n colObj.canEdit = true;\n colObj.componentProps = { ...(attrItem?.componentProps || {}) };\n if (attrItem?.required) {\n rules.push({ required: true, message: `${attrItem?.attrName}不能为空` });\n }\n if (Array.isArray(attrItem?.rules) && attrItem?.rules.length > 0) {\n rules.concat(...attrItem?.rules);\n }\n if (attrItem?.staticCode) {\n colObj.componentProps.options = staticOptionsMap?.[attrItem?.staticCode] || [];\n }\n colObj.formProps = {\n rules,\n };\n }\n _columns.push(colObj);\n }\n });\n }\n if (dataSource) {\n if (checkDataSourceOfFn(dataSource)) {\n dataList = stringScriptExecution(dataSource) || [];\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 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\n return {\n columns: _columns,\n dataSource: dataList,\n controlBtns: controlBtnsList,\n hasEdit,\n scroll,\n };\n};\n\nexport default formatTableProps;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA2B;AAC3B,mCAAsC;AAEtC,oBAAoB;AAEpB,8BAA6B;AAC7B,iCAAgC;AA4BhC,IAAM,mBAAmB,CAAC;AAAA,EACxB;AAAA,EACA,mBAAmB,CAAC;AAAA,EACpB;AAAA,EACA,UAAU,CAAC;AACb,MAAwD;AACtD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,WAAmC,CAAC;AAC1C,MAAI,WAAmC,CAAC;AACxC,MAAI,kBAA0C,CAAC;AAC/C,MAAI,SAAqC,CAAC;AAC1C,MAAI,iBAAiB;AAGrB,MAA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
+ key: string;
3
+ compProps: {
4
+ [key: string]: any;
5
+ };
6
+ parameters?: {
7
+ [key: string]: any;
8
+ };
9
+ };
10
+ declare const formatTabsProps: ({ key, compProps, parameters, }: formatTabsPropsType) => {
11
+ items: {
12
+ [key: string]: any;
13
+ }[];
14
+ };
15
+ export default formatTabsProps;
@@ -0,0 +1,49 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/formatModule/helpers/formatTabsProps.ts
20
+ var formatTabsProps_exports = {};
21
+ __export(formatTabsProps_exports, {
22
+ default: () => formatTabsProps_default
23
+ });
24
+ module.exports = __toCommonJS(formatTabsProps_exports);
25
+ var formatTabsProps = ({
26
+ key,
27
+ compProps,
28
+ parameters
29
+ }) => {
30
+ const { tabsItems, renderChildren, ...otherCompProps } = compProps;
31
+ let items = [];
32
+ if (tabsItems) {
33
+ if (tabsItems.type === "static" && Array.isArray(tabsItems.items) && tabsItems.items.length > 0) {
34
+ items = tabsItems.items.map((item, index) => {
35
+ const itemKey = `${key}-tab${index + 1}`;
36
+ return {
37
+ key: itemKey,
38
+ label: item.label
39
+ };
40
+ });
41
+ }
42
+ }
43
+ return {
44
+ ...otherCompProps,
45
+ items
46
+ };
47
+ };
48
+ var formatTabsProps_default = formatTabsProps;
49
+ //# sourceMappingURL=formatTabsProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/formatModule/helpers/formatTabsProps.ts"],
4
+ "sourcesContent": ["\nexport type formatTabsPropsType = {\n key: string;\n compProps: {[key:string]: any};\n parameters?: {[key:string]: any};\n}\n\nconst formatTabsProps = ({\n key,\n compProps,\n parameters,\n}: formatTabsPropsType) => {\n const { tabsItems, renderChildren, ...otherCompProps } = compProps;\n let items:{[key:string]: any}[] = [];\n if (tabsItems) {\n if (\n tabsItems.type === 'static' &&\n Array.isArray(tabsItems.items) && tabsItems.items.length > 0\n ) {\n items = tabsItems.items.map((item:{[key:string]: any}, index:number) => {\n const itemKey = `${key}-tab${index + 1}`;\n return {\n key: itemKey,\n label: item.label,\n };\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 return {\n ...otherCompProps,\n items,\n };\n};\n\nexport default formatTabsProps;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,IAAM,kBAAkB,CAAC;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AACF,MAA2B;AACzB,QAAM,EAAE,WAAW,gBAAgB,GAAG,eAAe,IAAI;AACzD,MAAI,QAA8B,CAAC;AACnC,MAAI,WAAW;AACb,QACE,UAAU,SAAS,YACnB,MAAM,QAAQ,UAAU,KAAK,KAAK,UAAU,MAAM,SAAS,GAC3D;AACA,cAAQ,UAAU,MAAM,IAAI,CAAC,MAA0B,UAAiB;AACtE,cAAM,UAAU,GAAG,UAAU,QAAQ;AACrC,eAAO;AAAA,UACL,KAAK;AAAA,UACL,OAAO,KAAK;AAAA,QACd;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAaA,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,EACF;AACF;AAEA,IAAO,0BAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,12 @@
1
+ export type formatImagePropsType = {
2
+ options?: {
3
+ [key: string]: any;
4
+ };
5
+ parameters?: {
6
+ [key: string]: any;
7
+ };
8
+ };
9
+ declare const formatVideoProps: ({ parameters, options, }: formatImagePropsType) => {
10
+ [key: string]: any;
11
+ };
12
+ export default formatVideoProps;
@@ -0,0 +1,45 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/formatModule/helpers/formatVideoProps.ts
20
+ var formatVideoProps_exports = {};
21
+ __export(formatVideoProps_exports, {
22
+ default: () => formatVideoProps_default
23
+ });
24
+ module.exports = __toCommonJS(formatVideoProps_exports);
25
+ var import_treeUtils = require("../../treeUtils");
26
+ var import_file = require("../../file");
27
+ var formatVideoProps = ({
28
+ parameters,
29
+ options = {}
30
+ }) => {
31
+ var _a, _b, _c, _d;
32
+ const { dataSource, ...otherOptions } = options;
33
+ const res = { ...otherOptions };
34
+ if ((dataSource == null ? void 0 : dataSource.dataType) === "staticData" && Array.isArray(dataSource == null ? void 0 : dataSource.fileList) && (dataSource == null ? void 0 : dataSource.fileList.length) > 0) {
35
+ res.src = (0, import_file.getFileUrlById)((_b = (_a = dataSource == null ? void 0 : dataSource.fileList) == null ? void 0 : _a[0]) == null ? void 0 : _b.fileId);
36
+ res.alt = (_d = (_c = dataSource == null ? void 0 : dataSource.fileList) == null ? void 0 : _c[0]) == null ? void 0 : _d.fileName;
37
+ }
38
+ if ((dataSource == null ? void 0 : dataSource.dataType) === "context" && (dataSource == null ? void 0 : dataSource.fileUrl)) {
39
+ res.src = (0, import_treeUtils.getParamsContentByParamKeys)(dataSource == null ? void 0 : dataSource.fileUrl, parameters) || "";
40
+ res.alt = (0, import_treeUtils.getParamsContentByParamKeys)(dataSource == null ? void 0 : dataSource.fileDesc, parameters) || "";
41
+ }
42
+ return res;
43
+ };
44
+ var formatVideoProps_default = formatVideoProps;
45
+ //# sourceMappingURL=formatVideoProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/formatModule/helpers/formatVideoProps.ts"],
4
+ "sourcesContent": ["import { getParamsContentByParamKeys } from '../../treeUtils';\nimport { getFileUrlById } from '../../file';\n\nexport type formatImagePropsType = {\n options?: {[key:string]: any}\n parameters?: {[key:string]: any};\n}\n\nconst formatVideoProps = ({\n parameters,\n options = {},\n}: formatImagePropsType):{[key:string]: any} => {\n const { dataSource, ...otherOptions } = options;\n const res:{[key:string]: any} = { ...otherOptions };if (\n dataSource?.dataType === 'staticData' &&\n Array.isArray(dataSource?.fileList) &&\n dataSource?.fileList.length > 0\n ) {\n res.src = getFileUrlById(dataSource?.fileList?.[0]?.fileId);\n res.alt = dataSource?.fileList?.[0]?.fileName;\n }\n if (\n dataSource?.dataType === 'context' &&\n dataSource?.fileUrl\n ) {\n res.src = getParamsContentByParamKeys(dataSource?.fileUrl, parameters) || '';\n res.alt = getParamsContentByParamKeys(dataSource?.fileDesc, parameters) || '';\n }\n return res;\n};\n\nexport default formatVideoProps;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA4C;AAC5C,kBAA+B;AAO/B,IAAM,mBAAmB,CAAC;AAAA,EACxB;AAAA,EACA,UAAU,CAAC;AACb,MAAgD;AAXhD;AAYE,QAAM,EAAE,YAAY,GAAG,aAAa,IAAI;AACxC,QAAM,MAA0B,EAAE,GAAG,aAAa;AAAE,OAClD,yCAAY,cAAa,gBACrB,MAAM,QAAQ,yCAAY,QAAQ,MAClC,yCAAY,SAAS,UAAS,GAClC;AACA,QAAI,UAAM,6BAAe,oDAAY,aAAZ,mBAAuB,OAAvB,mBAA2B,MAAM;AAC1D,QAAI,OAAM,oDAAY,aAAZ,mBAAuB,OAAvB,mBAA2B;AAAA,EACvC;AACA,OACE,yCAAY,cAAa,cACzB,yCAAY,UACZ;AACA,QAAI,UAAM,8CAA4B,yCAAY,SAAS,UAAU,KAAK;AAC1E,QAAI,UAAM,8CAA4B,yCAAY,UAAU,UAAU,KAAK;AAAA,EAC7E;AACA,SAAO;AACT;AAEA,IAAO,2BAAQ;",
6
+ "names": []
7
+ }
@@ -16,8 +16,13 @@ import formatLoopProps from './formatLoopProps';
16
16
  import formatStyleProps from './formatStyleProps';
17
17
  import formatStepsProps from './formatStepsProps';
18
18
  import formatIconProps from './formatIconProps';
19
+ import formatVideoProps from './formatVideoProps';
19
20
  import formatControlBtn from './formatControlBtn';
21
+ import formatTabsProps from './formatTabsProps';
20
22
  import formRulsRegMap from './formRulsRegMap';
23
+ import formatDataProps from './formatDataProps';
24
+ import checkDataSourceOfFn from './checkDataSourceOfFn';
21
25
  import urlPrefix from './urlPrefix';
22
26
  import { stringScriptExecution, createCompartmentExecution } from './stringScriptExecution';
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, };
27
+ import cssToJson from './cssToJson';
28
+ export { urlPrefix, formRulsRegMap, formatTabsProps, formatPanelProps, formatListProps, formatTableProps, formatCarouselProps, formatImageProps, formatDescriptionsProps, formatFormProps, formatHighCodeProps, formatEchartLineProps, formatEchartPieProps, formatChartsProps, formatLoopProps, formatStyleProps, formatStepsProps, formatIconProps, formatVideoProps, formatControlBtn, formatDataProps, staticCodeAssemble, patternTransitionRegExp, stringPramarsValTransition, stringScriptExecution, createCompartmentExecution, cssToJson, checkDataSourceOfFn, };