@boteteam/utils 0.0.31 → 0.0.33
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.
- package/dist/cjs/file.js +4 -4
- package/dist/cjs/file.js.map +2 -2
- package/dist/cjs/formatModule/formatModuleData.d.ts +3 -1
- package/dist/cjs/formatModule/formatModuleData.js +102 -17
- package/dist/cjs/formatModule/formatModuleData.js.map +3 -3
- package/dist/cjs/formatModule/helpers/checkDataSourceOfFn.d.ts +2 -0
- package/dist/cjs/formatModule/helpers/checkDataSourceOfFn.js +33 -0
- package/dist/cjs/formatModule/helpers/checkDataSourceOfFn.js.map +7 -0
- package/dist/cjs/formatModule/helpers/cssToJson.d.ts +22 -0
- package/dist/cjs/formatModule/helpers/cssToJson.js +78 -0
- package/dist/cjs/formatModule/helpers/cssToJson.js.map +7 -0
- package/dist/cjs/formatModule/helpers/formatDataProps.d.ts +19 -0
- package/dist/cjs/formatModule/helpers/formatDataProps.js +65 -0
- package/dist/cjs/formatModule/helpers/formatDataProps.js.map +7 -0
- package/dist/cjs/formatModule/helpers/formatFormProps.js +7 -0
- package/dist/cjs/formatModule/helpers/formatFormProps.js.map +3 -3
- package/dist/cjs/formatModule/helpers/formatListProps.js +25 -9
- package/dist/cjs/formatModule/helpers/formatListProps.js.map +3 -3
- package/dist/cjs/formatModule/helpers/formatLoopProps.d.ts +1 -4
- package/dist/cjs/formatModule/helpers/formatLoopProps.js +20 -8
- package/dist/cjs/formatModule/helpers/formatLoopProps.js.map +3 -3
- package/dist/cjs/formatModule/helpers/formatStepsProps.js +49 -32
- package/dist/cjs/formatModule/helpers/formatStepsProps.js.map +3 -3
- package/dist/cjs/formatModule/helpers/formatStyleProps.d.ts +16 -3
- package/dist/cjs/formatModule/helpers/formatStyleProps.js +100 -37
- package/dist/cjs/formatModule/helpers/formatStyleProps.js.map +3 -3
- package/dist/cjs/formatModule/helpers/formatTableProps.d.ts +7 -1
- package/dist/cjs/formatModule/helpers/formatTableProps.js +46 -11
- package/dist/cjs/formatModule/helpers/formatTableProps.js.map +3 -3
- package/dist/cjs/formatModule/helpers/formatTabsProps.d.ts +15 -0
- package/dist/cjs/formatModule/helpers/formatTabsProps.js +49 -0
- package/dist/cjs/formatModule/helpers/formatTabsProps.js.map +7 -0
- package/dist/cjs/formatModule/helpers/formatVideoProps.d.ts +12 -0
- package/dist/cjs/formatModule/helpers/formatVideoProps.js +45 -0
- package/dist/cjs/formatModule/helpers/formatVideoProps.js.map +7 -0
- package/dist/cjs/formatModule/helpers/index.d.ts +6 -1
- package/dist/cjs/formatModule/helpers/index.js +15 -0
- package/dist/cjs/formatModule/helpers/index.js.map +3 -3
- package/dist/cjs/formatModule/helpers/stringScriptExecution.js +1 -1
- package/dist/cjs/formatModule/helpers/stringScriptExecution.js.map +1 -1
- package/dist/cjs/http.d.ts +17 -0
- package/dist/cjs/http.js +123 -1
- package/dist/cjs/http.js.map +2 -2
- package/dist/cjs/index.d.ts +5 -4
- package/dist/cjs/index.js +19 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/treeUtils.d.ts +31 -3
- package/dist/cjs/treeUtils.js +53 -10
- package/dist/cjs/treeUtils.js.map +3 -3
- package/dist/cjs/watermark.d.ts +80 -0
- package/dist/cjs/watermark.js +350 -0
- package/dist/cjs/watermark.js.map +7 -0
- package/dist/esm/file.js +5 -4
- package/dist/esm/file.js.map +1 -1
- package/dist/esm/formatModule/formatModuleData.d.ts +3 -1
- package/dist/esm/formatModule/formatModuleData.js +121 -40
- package/dist/esm/formatModule/formatModuleData.js.map +1 -1
- package/dist/esm/formatModule/helpers/checkDataSourceOfFn.d.ts +2 -0
- package/dist/esm/formatModule/helpers/checkDataSourceOfFn.js +9 -0
- package/dist/esm/formatModule/helpers/checkDataSourceOfFn.js.map +1 -0
- package/dist/esm/formatModule/helpers/cssToJson.d.ts +22 -0
- package/dist/esm/formatModule/helpers/cssToJson.js +103 -0
- package/dist/esm/formatModule/helpers/cssToJson.js.map +1 -0
- package/dist/esm/formatModule/helpers/formatDataProps.d.ts +19 -0
- package/dist/esm/formatModule/helpers/formatDataProps.js +26 -0
- package/dist/esm/formatModule/helpers/formatDataProps.js.map +1 -0
- package/dist/esm/formatModule/helpers/formatFormProps.js +6 -0
- package/dist/esm/formatModule/helpers/formatFormProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatListProps.js +26 -9
- package/dist/esm/formatModule/helpers/formatListProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatLoopProps.d.ts +1 -4
- package/dist/esm/formatModule/helpers/formatLoopProps.js +13 -12
- package/dist/esm/formatModule/helpers/formatLoopProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatStepsProps.js +38 -31
- package/dist/esm/formatModule/helpers/formatStepsProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatStyleProps.d.ts +16 -3
- package/dist/esm/formatModule/helpers/formatStyleProps.js +90 -43
- package/dist/esm/formatModule/helpers/formatStyleProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatTableProps.d.ts +7 -1
- package/dist/esm/formatModule/helpers/formatTableProps.js +57 -8
- package/dist/esm/formatModule/helpers/formatTableProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatTabsProps.d.ts +15 -0
- package/dist/esm/formatModule/helpers/formatTabsProps.js +46 -0
- package/dist/esm/formatModule/helpers/formatTabsProps.js.map +1 -0
- package/dist/esm/formatModule/helpers/formatVideoProps.d.ts +12 -0
- package/dist/esm/formatModule/helpers/formatVideoProps.js +31 -0
- package/dist/esm/formatModule/helpers/formatVideoProps.js.map +1 -0
- package/dist/esm/formatModule/helpers/index.d.ts +6 -1
- package/dist/esm/formatModule/helpers/index.js +6 -1
- package/dist/esm/formatModule/helpers/index.js.map +1 -1
- package/dist/esm/formatModule/helpers/stringScriptExecution.js +1 -1
- package/dist/esm/formatModule/helpers/stringScriptExecution.js.map +1 -1
- package/dist/esm/http.d.ts +17 -0
- package/dist/esm/http.js +208 -43
- package/dist/esm/http.js.map +1 -1
- package/dist/esm/index.d.ts +5 -4
- package/dist/esm/index.js +4 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/treeUtils.d.ts +31 -3
- package/dist/esm/treeUtils.js +118 -15
- package/dist/esm/treeUtils.js.map +1 -1
- package/dist/esm/watermark.d.ts +80 -0
- package/dist/esm/watermark.js +487 -0
- package/dist/esm/watermark.js.map +1 -0
- package/dist/umd/index.min.js +1 -1
- package/dist/umd/index.min.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,8 +1,21 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
export declare const getStylePainter: (style: {
|
|
2
2
|
[key: string]: any;
|
|
3
|
-
},
|
|
3
|
+
}, children?: {
|
|
4
4
|
[key: string]: any;
|
|
5
|
-
} |
|
|
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
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (
|
|
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(
|
|
78
|
-
} else if (
|
|
79
|
-
|
|
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 (
|
|
85
|
-
|
|
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 (
|
|
90
|
-
const
|
|
91
|
-
if (
|
|
92
|
-
|
|
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
|
-
...
|
|
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\
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["_a", "
|
|
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,CAAC;AACpC,QAAM,YAAY,CAAC,UAAU,gBAAgB,EAAE,SAAS,+BAAQ,iBAAiB,IAAI,eAAe;AACpG,QAAM,YAAY,EAAC,+BAAQ,sBAAqB,CAAC,OAAO,aAAa,EAAE,SAAS,+BAAQ,iBAAiB,IAAI,eAAe;AAC5H,QAAM,gBAAuD;AAAA,IAC3D,SAAS;AAAA,MACP,CAAC,SAAS,GAAG;AAAA,MACb,CAAC,SAAS,GAAG;AAAA,IACf;AAAA,IACA,WAAW;AAAA,MACT,CAAC,SAAS,GAAG;AAAA,MACb,CAAC,SAAS,GAAG;AAAA,IACf;AAAA,IACA,UAAU;AAAA,MACR,CAAC,SAAS,GAAG;AAAA,MACb,CAAC,SAAS,GAAG;AAAA,IACf;AAAA,IACA,YAAY;AAAA,MACV,CAAC,SAAS,GAAG;AAAA,MACb,CAAC,SAAS,GAAG;AAAA,IACf;AAAA,IACA,QAAQ;AAAA,MACN,CAAC,SAAS,GAAG;AAAA,MACb,CAAC,SAAS,GAAG;AAAA,IACf;AAAA,IACA,aAAa;AAAA,MACX,CAAC,SAA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B;AAAA,EACA;AAAA,EACA;AACF,MAIM;AAtHN;AAuHE,QAAM,aAAkC,iBAAa,yBAAU,UAAU,IAAI,CAAC;AAC9E,QAAM,EAAE,YAAY,CAAC,GAAG,SAAS,IAAI;AACrC,QAAM,EAAE,QAAQ,CAAC,GAAG,YAAY,IAAI,aAAa,CAAC;AAClD,MAAI,iBAAqC,CAAC;AAE1C,QAAM,WAAW,gBAAgB,OAAO,yCAAY,QAAQ;AAE5D,QACE,gEAAkB,cAAlB,mBAA6B,UAA7B,mBAAoC,aAAY,UAChD,CAAC,CAAC,MAAM,EAAE,SAAS,QAAQ,KAC3B,GAAC,eAAU,UAAV,mBAAiB,QAClB;AAEA,QAAI,GAAC,eAAU,UAAV,mBAAiB,YAAW,CAAC,SAAS,QAAQ,MAAM,EAAE,UAAS,eAAU,UAAV,mBAAiB,OAAO,GAAG;AAC7F,eAAS,OAAO;AAAA,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
|
-
|
|
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
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
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
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA2B;AAC3B,mCAAsC;AAEtC,oBAAoB;AAEpB,8BAA6B;
|
|
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,oB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AS;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;AAEA,SAAO;AAAA,IACL,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,aAAa;AAAA,IACb;AAAA,IACA;AAAA,EACF;AACF;AAEA,IAAO,2BAAQ;",
|
|
6
|
+
"names": ["_a", "checkDataSourceOfFn", "formatControlBtn"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type formatTabsPropsType = {
|
|
2
|
+
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
|
-
|
|
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, };
|