cui-print 1.0.28
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/README.md +29 -0
- package/dist/font/iconfont.css +151 -0
- package/dist/font/iconfont.js +1 -0
- package/dist/font/iconfont.json +247 -0
- package/dist/font/iconfont.ttf +0 -0
- package/dist/font/iconfont.woff +0 -0
- package/dist/font/iconfont.woff2 +0 -0
- package/dist/index.css +1 -0
- package/dist/index.es.js +51053 -0
- package/dist/index.umd.js +1030 -0
- package/dist/print-designer-api/create-style/create-base-component-style.js +116 -0
- package/dist/print-designer-api/create-style/create-complex-table-style.js +472 -0
- package/dist/print-designer-api/create-style/create-form-component-style.js +78 -0
- package/dist/print-designer-api/create-style/create-form-item-style.js +144 -0
- package/dist/print-designer-api/create-style/create-grid-style.js +49 -0
- package/dist/print-designer-api/create-style/create-table-layout-style.js +128 -0
- package/dist/print-designer-api/create-style/create-table-style.js +93 -0
- package/dist/print-designer-api/print-designer-helper.js +912 -0
- package/dist/print-designer-api/print-designer-style-helper.js +96 -0
- package/dist/print-designer-api/print-designer-utils.js +27 -0
- package/dist/print-designer-api/print-global-style/base.less +20 -0
- package/dist/print-designer-api/print-global-style/common.less +3 -0
- package/dist/print-designer-api/print-global-style/custom.less +4 -0
- package/dist/print-designer-api/print-global-style/index.css +812 -0
- package/dist/print-designer-api/print-global-style/index.js +813 -0
- package/dist/print-designer-api/print-global-style/index.less +9 -0
- package/dist/print-designer-api/print-global-style/print-base-component.less +123 -0
- package/dist/print-designer-api/print-global-style/print-container.less +57 -0
- package/dist/print-designer-api/print-global-style/print-continue/index.less +14 -0
- package/dist/print-designer-api/print-global-style/print-continue/print-complex-table/auto-continue-not-span.less +61 -0
- package/dist/print-designer-api/print-global-style/print-continue/print-complex-table/auto-continue-preview.less +12 -0
- package/dist/print-designer-api/print-global-style/print-continue/print-complex-table/auto-continue-span.less +88 -0
- package/dist/print-designer-api/print-global-style/print-continue/print-complex-table/fixed-continue.less +37 -0
- package/dist/print-designer-api/print-global-style/print-continue/print-complex-table/index.less +96 -0
- package/dist/print-designer-api/print-global-style/print-continue/print-complex-table/pagination-preview.less +12 -0
- package/dist/print-designer-api/print-global-style/print-continue/print-complex-table/pagination.less +61 -0
- package/dist/print-designer-api/print-global-style/print-form-component.less +161 -0
- package/dist/print-designer-api/print-global-style/print-form-item.less +162 -0
- package/dist/print-designer-api/print-global-style/printing.less +16 -0
- package/dist/print-designer-api/print-soket.js +31 -0
- package/dist/print-designer-api/use-create-html/create-html-utils.js +43 -0
- package/dist/print-designer-api/use-create-html/index.js +287 -0
- package/dist/print-designer-api/use-create-html/use-base-component-helper.js +129 -0
- package/dist/print-designer-api/use-create-html/use-complex-table-helper/complex-table-tools.js +129 -0
- package/dist/print-designer-api/use-create-html/use-complex-table-helper/create-table-header.js +111 -0
- package/dist/print-designer-api/use-create-html/use-complex-table-helper/index.js +87 -0
- package/dist/print-designer-api/use-create-html/use-complex-table-helper/use-auto-height-preview.js +84 -0
- package/dist/print-designer-api/use-create-html/use-complex-table-helper/use-auto-height.js +379 -0
- package/dist/print-designer-api/use-create-html/use-complex-table-helper/use-default.js +75 -0
- package/dist/print-designer-api/use-create-html/use-complex-table-helper/use-fixed-height.js +220 -0
- package/dist/print-designer-api/use-create-html/use-complex-table-helper/use-pagination-preview.js +84 -0
- package/dist/print-designer-api/use-create-html/use-complex-table-helper/use-pagination.js +272 -0
- package/dist/print-designer-api/use-create-html/use-form-component-helper.js +164 -0
- package/dist/print-designer-api/use-create-html/use-format/index.js +102 -0
- package/dist/print-designer-api/use-create-html/use-format/use-complex-table-auto.js +337 -0
- package/dist/print-designer-api/use-create-html/use-format/use-complex-table-fiexd.js +233 -0
- package/dist/print-designer-api/use-create-html/use-format/use-complex-table-pagination.js +286 -0
- package/dist/print-designer-api/use-create-html/use-grid-helper.js +35 -0
- package/dist/print-designer-api/use-create-html/use-table-layout-helper.js +213 -0
- package/dist/print-designer-api/use-create-print-js/index.js +147 -0
- package/dist/print-designer-api/use-create-print-js/use-base-component-helper.js +54 -0
- package/dist/print-designer-api/use-create-print-js/use-form-component-helper.js +4 -0
- package/dist/print-designer-api/use-create-print-js/use-table-layout-helper.js +5 -0
- package/dist/print-designer-images/demo.jpg +0 -0
- package/dist/print-designer-images/demo02.jpg +0 -0
- package/dist/style/default-style.css +137 -0
- package/dist/style/main.less +66 -0
- package/dist/test/base/designer-config.js +594 -0
- package/dist/test/base/index.js +3 -0
- package/dist/test/base/print-data.js +40 -0
- package/dist/test/complex-table/designer-config.js +1668 -0
- package/dist/test/complex-table/index.js +3 -0
- package/dist/test/complex-table/print-data.js +294 -0
- package/dist/test/form/designer-config.js +2057 -0
- package/dist/test/form/index.js +3 -0
- package/dist/test/form/print-data.js +38 -0
- package/dist/test/index.js +4 -0
- package/dist/wui-print-designer-plugins/JsBarcode.all.min.js +2 -0
- package/dist/wui-print-designer-plugins/qrcode.min.js +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { camelToKebab } from "../print-designer-utils";
|
|
2
|
+
const createFormItemStyle = ({ styleConfig } = {}) => {
|
|
3
|
+
if (!styleConfig) {
|
|
4
|
+
styleConfig = {};
|
|
5
|
+
}
|
|
6
|
+
let styleText = "";
|
|
7
|
+
let styleObj = {};
|
|
8
|
+
Object.keys(styleConfig).forEach((key, index) => {
|
|
9
|
+
if (key.indexOf("formItem_") < 0) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
let newKey = key.replace("formItem_", "");
|
|
13
|
+
if (!!styleConfig[key] || styleConfig[key] === 0) {
|
|
14
|
+
styleObj[newKey] = styleConfig[key];
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
Object.keys(styleObj).forEach((key, index) => {
|
|
18
|
+
styleText += `${camelToKebab(key)}:${styleObj[key]};`;
|
|
19
|
+
});
|
|
20
|
+
return styleText;
|
|
21
|
+
};
|
|
22
|
+
const createFormItemLabelStyleInDesigner = ({ styleConfig, formConfigProps, formItemProps } = {}) => {
|
|
23
|
+
if (!styleConfig) {
|
|
24
|
+
styleConfig = {};
|
|
25
|
+
}
|
|
26
|
+
if (!formConfigProps) {
|
|
27
|
+
formConfigProps = {};
|
|
28
|
+
}
|
|
29
|
+
if (!formItemProps) {
|
|
30
|
+
formItemProps = {};
|
|
31
|
+
}
|
|
32
|
+
let styleText = "";
|
|
33
|
+
let styleObj = {};
|
|
34
|
+
Object.keys(styleConfig).forEach((key, index) => {
|
|
35
|
+
if (key.indexOf("formItemLabel_") < 0) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
let newKey = key.replace("formItemLabel_", "");
|
|
39
|
+
if (!!styleConfig[key] || styleConfig[key] === 0) {
|
|
40
|
+
styleObj[newKey] = styleConfig[key];
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
Object.keys(styleObj).forEach((key, index) => {
|
|
44
|
+
styleText += `${camelToKebab(key)}:${styleObj[key]};`;
|
|
45
|
+
});
|
|
46
|
+
return styleText;
|
|
47
|
+
};
|
|
48
|
+
const createFormItemLabelStyle = ({ styleConfig, formConfigProps, formItemProps } = {}) => {
|
|
49
|
+
if (!styleConfig) {
|
|
50
|
+
styleConfig = {};
|
|
51
|
+
}
|
|
52
|
+
if (!formConfigProps) {
|
|
53
|
+
formConfigProps = {};
|
|
54
|
+
}
|
|
55
|
+
if (!formItemProps) {
|
|
56
|
+
formItemProps = {};
|
|
57
|
+
}
|
|
58
|
+
let styleText = "";
|
|
59
|
+
let styleObj = {};
|
|
60
|
+
if (!!formItemProps.labelWidth && formItemProps.labelPosition != "top") {
|
|
61
|
+
styleObj.width = `${formItemProps.labelWidth}`;
|
|
62
|
+
} else if (!!formConfigProps.labelWidth && formConfigProps.labelPosition != "top" && formItemProps.labelPosition != "top") {
|
|
63
|
+
styleObj.width = `${formConfigProps.labelWidth}`;
|
|
64
|
+
}
|
|
65
|
+
Object.keys(styleObj).forEach((key, index) => {
|
|
66
|
+
styleText += `${camelToKebab(key)}:${styleObj[key]};`;
|
|
67
|
+
});
|
|
68
|
+
return styleText;
|
|
69
|
+
};
|
|
70
|
+
const createFormItemLabelContentStyle = ({ styleConfig, formConfigProps, formItemProps } = {}) => {
|
|
71
|
+
if (!styleConfig) {
|
|
72
|
+
styleConfig = {};
|
|
73
|
+
}
|
|
74
|
+
if (!formConfigProps) {
|
|
75
|
+
formConfigProps = {};
|
|
76
|
+
}
|
|
77
|
+
if (!formItemProps) {
|
|
78
|
+
formItemProps = {};
|
|
79
|
+
}
|
|
80
|
+
let styleText = "";
|
|
81
|
+
let styleObj = {};
|
|
82
|
+
Object.keys(styleConfig).forEach((key, index) => {
|
|
83
|
+
if (key.indexOf("formItemLabel_") < 0) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
let newKey = key.replace("formItemLabel_", "");
|
|
87
|
+
if (!!styleConfig[key] || styleConfig[key] === 0) {
|
|
88
|
+
styleObj[newKey] = styleConfig[key];
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
Object.keys(styleObj).forEach((key, index) => {
|
|
92
|
+
styleText += `${camelToKebab(key)}:${styleObj[key]};`;
|
|
93
|
+
});
|
|
94
|
+
return styleText;
|
|
95
|
+
};
|
|
96
|
+
const createFormItemMainStyleInDesigner = ({ styleConfig } = {}) => {
|
|
97
|
+
if (!styleConfig) {
|
|
98
|
+
styleConfig = {};
|
|
99
|
+
}
|
|
100
|
+
let styleText = "";
|
|
101
|
+
let styleObj = {};
|
|
102
|
+
Object.keys(styleConfig).forEach((key, index) => {
|
|
103
|
+
if (key.indexOf("formItemMain_") < 0) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
let newKey = key.replace("formItemMain_", "");
|
|
107
|
+
if (!!styleConfig[key] || styleConfig[key] === 0) {
|
|
108
|
+
styleObj[newKey] = styleConfig[key];
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
styleObj.width = "100%";
|
|
112
|
+
Object.keys(styleObj).forEach((key, index) => {
|
|
113
|
+
styleText += `${camelToKebab(key)}:${styleObj[key]};`;
|
|
114
|
+
});
|
|
115
|
+
return styleText;
|
|
116
|
+
};
|
|
117
|
+
const createFormItemMainStyle = ({ styleConfig } = {}) => {
|
|
118
|
+
if (!styleConfig) {
|
|
119
|
+
styleConfig = {};
|
|
120
|
+
}
|
|
121
|
+
let styleText = "";
|
|
122
|
+
let styleObj = {};
|
|
123
|
+
Object.keys(styleConfig).forEach((key, index) => {
|
|
124
|
+
if (key.indexOf("formItemMain_") < 0) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
let newKey = key.replace("formItemMain_", "");
|
|
128
|
+
if (!!styleConfig[key] || styleConfig[key] === 0) {
|
|
129
|
+
styleObj[newKey] = styleConfig[key];
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
Object.keys(styleObj).forEach((key, index) => {
|
|
133
|
+
styleText += `${camelToKebab(key)}:${styleObj[key]};`;
|
|
134
|
+
});
|
|
135
|
+
return styleText;
|
|
136
|
+
};
|
|
137
|
+
export default {
|
|
138
|
+
createFormItemStyle,
|
|
139
|
+
createFormItemLabelStyleInDesigner,
|
|
140
|
+
createFormItemLabelStyle,
|
|
141
|
+
createFormItemLabelContentStyle,
|
|
142
|
+
createFormItemMainStyleInDesigner,
|
|
143
|
+
createFormItemMainStyle
|
|
144
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { camelToKebab } from "../print-designer-utils";
|
|
2
|
+
const createGridStyle = ({ styleConfig } = {}) => {
|
|
3
|
+
if (!styleConfig) {
|
|
4
|
+
styleConfig = {};
|
|
5
|
+
}
|
|
6
|
+
let styleText = "";
|
|
7
|
+
Object.keys(styleConfig).forEach((key, index) => {
|
|
8
|
+
if (key.indexOf("_") >= 0) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
if (!!styleConfig[key] || styleConfig[key] === 0) {
|
|
12
|
+
styleText += `${camelToKebab(key)}:${styleConfig[key]};`;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
return styleText;
|
|
16
|
+
};
|
|
17
|
+
const createGridItemStyle = ({ styleConfig, props } = {}) => {
|
|
18
|
+
if (!styleConfig) {
|
|
19
|
+
styleConfig = {};
|
|
20
|
+
}
|
|
21
|
+
let styleText = "";
|
|
22
|
+
Object.keys(styleConfig).forEach((key, index) => {
|
|
23
|
+
if (key.indexOf("_") >= 0) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
if (!!styleConfig[key] || styleConfig[key] === 0) {
|
|
27
|
+
styleText += `${camelToKebab(key)}:${styleConfig[key]};`;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
if (!!props) {
|
|
31
|
+
styleText += createGridItemStyleByProps({ props });
|
|
32
|
+
}
|
|
33
|
+
return styleText;
|
|
34
|
+
};
|
|
35
|
+
const createGridItemStyleByProps = ({ props } = {}) => {
|
|
36
|
+
let styleText = "";
|
|
37
|
+
if (!props) {
|
|
38
|
+
return styleText;
|
|
39
|
+
}
|
|
40
|
+
let span = !!props.span ? Number(props.span) : 0;
|
|
41
|
+
let flexWidth = ((span / 24) * 100).toFixed(7);
|
|
42
|
+
styleText += `flex:0 0 ${flexWidth}%`;
|
|
43
|
+
return styleText;
|
|
44
|
+
};
|
|
45
|
+
export default {
|
|
46
|
+
createGridStyle,
|
|
47
|
+
createGridItemStyle,
|
|
48
|
+
createGridItemStyleByProps
|
|
49
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { camelToKebab } from "../print-designer-utils";
|
|
2
|
+
const createTableLayoutStyle = ({ styleConfig } = {}) => {
|
|
3
|
+
if (!styleConfig) {
|
|
4
|
+
styleConfig = {};
|
|
5
|
+
}
|
|
6
|
+
let styleText = "";
|
|
7
|
+
Object.keys(styleConfig).forEach((key, index) => {
|
|
8
|
+
if (key.indexOf("_") >= 0) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
if (!!styleConfig[key] || styleConfig[key] === 0) {
|
|
12
|
+
styleText += `${camelToKebab(key)}:${styleConfig[key]};`;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
return styleText;
|
|
16
|
+
};
|
|
17
|
+
const createTableLayoutTdStyle = ({ tableLayoutStyleConfig, tdStyleConfig } = {}) => {
|
|
18
|
+
if (!tableLayoutStyleConfig) {
|
|
19
|
+
tableLayoutStyleConfig = {};
|
|
20
|
+
}
|
|
21
|
+
if (!tdStyleConfig) {
|
|
22
|
+
tdStyleConfig = {};
|
|
23
|
+
}
|
|
24
|
+
let styleText = "";
|
|
25
|
+
let styleObj = {};
|
|
26
|
+
Object.keys(tableLayoutStyleConfig).forEach((key, index) => {
|
|
27
|
+
if (key.indexOf("cell_") < 0 || key.indexOf("cell_container_") >= 0) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
let newKey = key.replace("cell_", "");
|
|
31
|
+
if (!!tableLayoutStyleConfig[key] || tableLayoutStyleConfig[key] === 0) {
|
|
32
|
+
styleObj[newKey] = tableLayoutStyleConfig[key];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
if (!!tdStyleConfig) {
|
|
36
|
+
Object.keys(tdStyleConfig).forEach((key, index) => {
|
|
37
|
+
if (key.indexOf("container_") >= 0) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (!!tdStyleConfig[key] || tdStyleConfig[key] === 0) {
|
|
41
|
+
styleObj[key] = tdStyleConfig[key];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
Object.keys(styleObj).forEach((key, index) => {
|
|
46
|
+
styleText += `${camelToKebab(key)}:${styleObj[key]};`;
|
|
47
|
+
});
|
|
48
|
+
return styleText;
|
|
49
|
+
};
|
|
50
|
+
const createTableLayoutTdContainerStyle = ({ tableLayoutStyleConfig, tdStyleConfig } = {}) => {
|
|
51
|
+
if (!tableLayoutStyleConfig) {
|
|
52
|
+
tableLayoutStyleConfig = {};
|
|
53
|
+
}
|
|
54
|
+
if (!tdStyleConfig) {
|
|
55
|
+
tdStyleConfig = {};
|
|
56
|
+
}
|
|
57
|
+
let styleText = "";
|
|
58
|
+
let styleObj = {};
|
|
59
|
+
Object.keys(tableLayoutStyleConfig).forEach((key, index) => {
|
|
60
|
+
if (key.indexOf("cell_container_") < 0) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
let newKey = key.replace("cell_container_", "");
|
|
64
|
+
if (!!tableLayoutStyleConfig[key] || tableLayoutStyleConfig[key] === 0) {
|
|
65
|
+
styleObj[newKey] = tableLayoutStyleConfig[key];
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
Object.keys(tdStyleConfig).forEach((key, index) => {
|
|
69
|
+
if (key.indexOf("custom_") >= 0 || key.indexOf("container_") < 0) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
let newKey = key.replace("container_", "");
|
|
73
|
+
if (!!tdStyleConfig[key] || tdStyleConfig[key] === 0) {
|
|
74
|
+
styleObj[newKey] = tdStyleConfig[key];
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
// flex布局生效时,水平居中和垂直居中将失效
|
|
78
|
+
if (!!tdStyleConfig.container_custom_isFLex) {
|
|
79
|
+
styleObj.display = "flex";
|
|
80
|
+
} else {
|
|
81
|
+
if (!!tdStyleConfig.container_custom_centerHorizontally || !!tdStyleConfig.container_custom_centerVertical) {
|
|
82
|
+
styleObj.display = "flex";
|
|
83
|
+
}
|
|
84
|
+
if (!!tdStyleConfig.container_custom_centerHorizontally) {
|
|
85
|
+
styleObj.justifyContent = "center";
|
|
86
|
+
}
|
|
87
|
+
if (!!tdStyleConfig.container_custom_centerVertical) {
|
|
88
|
+
styleObj.alignItems = "center";
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
Object.keys(styleObj).forEach((key, index) => {
|
|
92
|
+
styleText += `${camelToKebab(key)}:${styleObj[key]};`;
|
|
93
|
+
});
|
|
94
|
+
return styleText;
|
|
95
|
+
};
|
|
96
|
+
const createTableLayoutTdSlashStyle = ({ width = 0, height = 0, direction } = {}) => {
|
|
97
|
+
if (!width || !height) {
|
|
98
|
+
return "";
|
|
99
|
+
}
|
|
100
|
+
if (!direction) {
|
|
101
|
+
direction = "top-left";
|
|
102
|
+
}
|
|
103
|
+
let styleText = "";
|
|
104
|
+
let styleObj = {};
|
|
105
|
+
let slashWidth = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2));
|
|
106
|
+
let slashDeg = (Math.atan(height / width) * 180) / Math.PI;
|
|
107
|
+
styleObj.width = `${slashWidth}px`;
|
|
108
|
+
styleObj.transformOrigin = `top left`;
|
|
109
|
+
if (direction == "top-left") {
|
|
110
|
+
styleObj.transform = `rotate(${slashDeg}deg)`;
|
|
111
|
+
} else {
|
|
112
|
+
styleObj.transform = `rotate(-${slashDeg}deg)`;
|
|
113
|
+
}
|
|
114
|
+
Object.keys(styleObj).forEach((key, index) => {
|
|
115
|
+
styleText += `${camelToKebab(key)}:${styleObj[key]};`;
|
|
116
|
+
});
|
|
117
|
+
return styleText;
|
|
118
|
+
};
|
|
119
|
+
const getTableLayoutStyleRulesId = ({ rowIndex, colIndex } = {}) => {
|
|
120
|
+
return `${rowIndex}-${colIndex}`;
|
|
121
|
+
};
|
|
122
|
+
export default {
|
|
123
|
+
createTableLayoutStyle,
|
|
124
|
+
createTableLayoutTdStyle,
|
|
125
|
+
createTableLayoutTdContainerStyle,
|
|
126
|
+
createTableLayoutTdSlashStyle,
|
|
127
|
+
getTableLayoutStyleRulesId
|
|
128
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { camelToKebab } from "../print-designer-utils";
|
|
2
|
+
const createTableStyle = ({ styleConfig } = {}) => {
|
|
3
|
+
if (!styleConfig) {
|
|
4
|
+
styleConfig = {};
|
|
5
|
+
}
|
|
6
|
+
let styleText = "";
|
|
7
|
+
Object.keys(styleConfig).forEach((key, index) => {
|
|
8
|
+
if (key.indexOf("_") >= 0) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
if (!!styleConfig[key] || styleConfig[key] === 0) {
|
|
12
|
+
styleText += `${camelToKebab(key)}:${styleConfig[key]};`;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
return styleText;
|
|
16
|
+
};
|
|
17
|
+
const createTableHeaderStyle = ({ tableStyleConfig, columnStyleConfig } = {}) => {
|
|
18
|
+
if (!tableStyleConfig) {
|
|
19
|
+
tableStyleConfig = {};
|
|
20
|
+
}
|
|
21
|
+
if (!columnStyleConfig) {
|
|
22
|
+
columnStyleConfig = {};
|
|
23
|
+
}
|
|
24
|
+
let styleText = "";
|
|
25
|
+
let styleObj = {};
|
|
26
|
+
styleObj.width = columnStyleConfig.width;
|
|
27
|
+
Object.keys(tableStyleConfig).forEach((key, index) => {
|
|
28
|
+
if (key.indexOf("header_") < 0) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
let newKey = key.replace("header_", "");
|
|
32
|
+
if (!!tableStyleConfig[key] || tableStyleConfig[key] === 0) {
|
|
33
|
+
styleObj[newKey] = tableStyleConfig[key];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.keys(columnStyleConfig).forEach((key, index) => {
|
|
37
|
+
if (key.indexOf("header_") < 0) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
let newKey = key.replace("header_", "");
|
|
41
|
+
if (!!columnStyleConfig[newKey] || columnStyleConfig[newKey] === 0) {
|
|
42
|
+
styleObj[newKey] = columnStyleConfig[newKey];
|
|
43
|
+
}
|
|
44
|
+
if (!!columnStyleConfig[key] || columnStyleConfig[key] === 0) {
|
|
45
|
+
styleObj[newKey] = columnStyleConfig[key];
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.keys(styleObj).forEach((key, index) => {
|
|
49
|
+
styleText += `${camelToKebab(key)}:${styleObj[key]};`;
|
|
50
|
+
});
|
|
51
|
+
return styleText;
|
|
52
|
+
};
|
|
53
|
+
const createTableCellStyle = ({ tableStyleConfig, columnStyleConfig } = {}) => {
|
|
54
|
+
if (!tableStyleConfig) {
|
|
55
|
+
tableStyleConfig = {};
|
|
56
|
+
}
|
|
57
|
+
if (!columnStyleConfig) {
|
|
58
|
+
columnStyleConfig = {};
|
|
59
|
+
}
|
|
60
|
+
let styleText = "";
|
|
61
|
+
let styleObj = {};
|
|
62
|
+
styleObj.width = columnStyleConfig.width;
|
|
63
|
+
Object.keys(tableStyleConfig).forEach((key, index) => {
|
|
64
|
+
if (key.indexOf("cell_") < 0) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
let newKey = key.replace("cell_", "");
|
|
68
|
+
if (!!tableStyleConfig[key] || tableStyleConfig[key] === 0) {
|
|
69
|
+
styleObj[newKey] = tableStyleConfig[key];
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
Object.keys(columnStyleConfig).forEach((key, index) => {
|
|
73
|
+
if (key.indexOf("cell_") < 0) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
let newKey = key.replace("cell_", "");
|
|
77
|
+
if (!!columnStyleConfig[newKey] || columnStyleConfig[newKey] === 0) {
|
|
78
|
+
styleObj[newKey] = columnStyleConfig[newKey];
|
|
79
|
+
}
|
|
80
|
+
if (!!columnStyleConfig[key] || columnStyleConfig[key] === 0) {
|
|
81
|
+
styleObj[newKey] = columnStyleConfig[key];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
Object.keys(styleObj).forEach((key, index) => {
|
|
85
|
+
styleText += `${camelToKebab(key)}:${styleObj[key]};`;
|
|
86
|
+
});
|
|
87
|
+
return styleText;
|
|
88
|
+
};
|
|
89
|
+
export default {
|
|
90
|
+
createTableStyle,
|
|
91
|
+
createTableHeaderStyle,
|
|
92
|
+
createTableCellStyle
|
|
93
|
+
};
|