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,116 @@
|
|
|
1
|
+
import { camelToKebab } from "../print-designer-utils";
|
|
2
|
+
const createTextStyle = ({ 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 createDynamicTextStyle = ({ styleConfig } = {}) => {
|
|
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
|
+
return styleText;
|
|
31
|
+
};
|
|
32
|
+
const createDynamicTextLabelStyle = ({ styleConfig } = {}) => {
|
|
33
|
+
if (!styleConfig) {
|
|
34
|
+
styleConfig = {};
|
|
35
|
+
}
|
|
36
|
+
let styleText = "";
|
|
37
|
+
Object.keys(styleConfig).forEach((key, index) => {
|
|
38
|
+
if (key.indexOf("label_") < 0) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
let newKey = key.replace("label_", "");
|
|
42
|
+
if (!!styleConfig[key] || styleConfig[key] === 0) {
|
|
43
|
+
styleText += `${camelToKebab(newKey)}:${styleConfig[key]};`;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return styleText;
|
|
47
|
+
};
|
|
48
|
+
const createDynamicTextContentStyle = ({ styleConfig } = {}) => {
|
|
49
|
+
if (!styleConfig) {
|
|
50
|
+
styleConfig = {};
|
|
51
|
+
}
|
|
52
|
+
let styleText = "";
|
|
53
|
+
Object.keys(styleConfig).forEach((key, index) => {
|
|
54
|
+
if (key.indexOf("text_") < 0) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
let newKey = key.replace("text_", "");
|
|
58
|
+
if (!!styleConfig[key] || styleConfig[key] === 0) {
|
|
59
|
+
styleText += `${camelToKebab(newKey)}:${styleConfig[key]};`;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
return styleText;
|
|
63
|
+
};
|
|
64
|
+
const createBarcodeContainerStyle = ({ styleConfig } = {}) => {
|
|
65
|
+
if (!styleConfig) {
|
|
66
|
+
styleConfig = {};
|
|
67
|
+
}
|
|
68
|
+
let styleText = "";
|
|
69
|
+
Object.keys(styleConfig).forEach((key, index) => {
|
|
70
|
+
if (key.indexOf("barcode_") < 0) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
let newKey = key.replace("barcode_", "");
|
|
74
|
+
if (!!styleConfig[key] || styleConfig[key] === 0) {
|
|
75
|
+
styleText += `${camelToKebab(newKey)}:${styleConfig[key]};`;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
styleText += `overflow:hidden;`;
|
|
79
|
+
return styleText;
|
|
80
|
+
};
|
|
81
|
+
const createQrcodeContainerStyle = ({ styleConfig } = {}) => {
|
|
82
|
+
if (!styleConfig) {
|
|
83
|
+
styleConfig = {};
|
|
84
|
+
}
|
|
85
|
+
let styleText = "";
|
|
86
|
+
Object.keys(styleConfig).forEach((key, index) => {
|
|
87
|
+
if (!!styleConfig[key] || styleConfig[key] === 0) {
|
|
88
|
+
styleText += `${camelToKebab(key)}:${styleConfig[key]};`;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
return styleText;
|
|
92
|
+
};
|
|
93
|
+
const createImageContainerStyle = ({ styleConfig } = {}) => {
|
|
94
|
+
if (!styleConfig) {
|
|
95
|
+
styleConfig = {};
|
|
96
|
+
}
|
|
97
|
+
let styleText = "";
|
|
98
|
+
Object.keys(styleConfig).forEach((key, index) => {
|
|
99
|
+
if (key.indexOf("_") >= 0) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
if (!!styleConfig[key] || styleConfig[key] === 0) {
|
|
103
|
+
styleText += `${camelToKebab(key)}:${styleConfig[key]};`;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
return styleText;
|
|
107
|
+
};
|
|
108
|
+
export default {
|
|
109
|
+
createTextStyle,
|
|
110
|
+
createDynamicTextStyle,
|
|
111
|
+
createDynamicTextLabelStyle,
|
|
112
|
+
createDynamicTextContentStyle,
|
|
113
|
+
createBarcodeContainerStyle,
|
|
114
|
+
createQrcodeContainerStyle,
|
|
115
|
+
createImageContainerStyle
|
|
116
|
+
};
|
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
import { camelToKebab, deepCopy } from "../print-designer-utils";
|
|
2
|
+
const createComplexTableStyle = ({ propsConfig, styleConfig } = {}) => {
|
|
3
|
+
if (!propsConfig) {
|
|
4
|
+
propsConfig = {};
|
|
5
|
+
}
|
|
6
|
+
if (!styleConfig) {
|
|
7
|
+
styleConfig = {};
|
|
8
|
+
}
|
|
9
|
+
let styleText = "";
|
|
10
|
+
let styleObj = {};
|
|
11
|
+
Object.keys(styleConfig).forEach((key, index) => {
|
|
12
|
+
if (key.indexOf("common_") >= 0) {
|
|
13
|
+
let newKey = key.replace("common_", "");
|
|
14
|
+
if (!!styleConfig[key] || styleConfig[key] === 0) {
|
|
15
|
+
styleObj[newKey] = styleConfig[key];
|
|
16
|
+
}
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (key.indexOf("_") >= 0) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (!!styleConfig[key] || styleConfig[key] === 0) {
|
|
23
|
+
styleObj[key] = styleConfig[key];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
Object.keys(styleObj).forEach((key, index) => {
|
|
27
|
+
if (!!propsConfig.canContinue && _ContinueInvalidConfigList.indexOf(key) >= 0) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (!!propsConfig.isPaginationMode && _ContinueInvalidConfigList.indexOf(key) >= 0) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
styleText += `${camelToKebab(key)}:${styleObj[key]};`;
|
|
34
|
+
});
|
|
35
|
+
return styleText;
|
|
36
|
+
};
|
|
37
|
+
const createComplexTableHeaderTdStyle = ({
|
|
38
|
+
complexTablePropsConfig,
|
|
39
|
+
complexTableStyleConfig,
|
|
40
|
+
tdPropsConfig,
|
|
41
|
+
tdStyleConfig
|
|
42
|
+
} = {}) => {
|
|
43
|
+
if (!complexTablePropsConfig) {
|
|
44
|
+
complexTablePropsConfig = {};
|
|
45
|
+
}
|
|
46
|
+
if (!complexTableStyleConfig) {
|
|
47
|
+
complexTableStyleConfig = {};
|
|
48
|
+
}
|
|
49
|
+
if (!tdPropsConfig) {
|
|
50
|
+
tdPropsConfig = {};
|
|
51
|
+
}
|
|
52
|
+
if (!tdStyleConfig) {
|
|
53
|
+
tdStyleConfig = {};
|
|
54
|
+
}
|
|
55
|
+
let styleText = "";
|
|
56
|
+
let styleObj = {};
|
|
57
|
+
Object.keys(complexTableStyleConfig).forEach((key, index) => {
|
|
58
|
+
if (key.indexOf("common_") >= 0) {
|
|
59
|
+
let newKey = key.replace("common_", "");
|
|
60
|
+
if (!!complexTableStyleConfig[key] || complexTableStyleConfig[key] === 0) {
|
|
61
|
+
styleObj[newKey] = complexTableStyleConfig[key];
|
|
62
|
+
}
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (key.indexOf("headerCell_") < 0 || key.indexOf("headerCell_container_") >= 0) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
let newKey = key.replace("headerCell_", "");
|
|
69
|
+
if (!!complexTableStyleConfig[key] || complexTableStyleConfig[key] === 0) {
|
|
70
|
+
styleObj[newKey] = complexTableStyleConfig[key];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
Object.keys(tdStyleConfig).forEach((key, index) => {
|
|
74
|
+
if (key.indexOf("_") >= 0) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (!!tdStyleConfig[key] || tdStyleConfig[key] === 0) {
|
|
78
|
+
styleObj[key] = tdStyleConfig[key];
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
Object.keys(styleObj).forEach((key, index) => {
|
|
82
|
+
if (!!complexTablePropsConfig.canContinue && _ContinueInvalidConfigList.indexOf(key) >= 0) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (!!complexTablePropsConfig.isPaginationMode && _ContinueInvalidConfigList.indexOf(key) >= 0) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
styleText += `${camelToKebab(key)}:${styleObj[key]};`;
|
|
89
|
+
});
|
|
90
|
+
return styleText;
|
|
91
|
+
};
|
|
92
|
+
const createComplexTableHeaderTdContainerStyle = ({
|
|
93
|
+
complexTablePropsConfig,
|
|
94
|
+
complexTableStyleConfig,
|
|
95
|
+
tdPropsConfig,
|
|
96
|
+
tdStyleConfig
|
|
97
|
+
} = {}) => {
|
|
98
|
+
if (!complexTablePropsConfig) {
|
|
99
|
+
complexTablePropsConfig = {};
|
|
100
|
+
}
|
|
101
|
+
if (!complexTableStyleConfig) {
|
|
102
|
+
complexTableStyleConfig = {};
|
|
103
|
+
}
|
|
104
|
+
if (!tdPropsConfig) {
|
|
105
|
+
tdPropsConfig = {};
|
|
106
|
+
}
|
|
107
|
+
if (!tdStyleConfig) {
|
|
108
|
+
tdStyleConfig = {};
|
|
109
|
+
}
|
|
110
|
+
let styleText = "";
|
|
111
|
+
let styleObj = {
|
|
112
|
+
width: "100%",
|
|
113
|
+
height: "100%"
|
|
114
|
+
};
|
|
115
|
+
Object.keys(complexTableStyleConfig).forEach((key, index) => {
|
|
116
|
+
if (key.indexOf("common_") >= 0) {
|
|
117
|
+
let newKey = key.replace("common_", "");
|
|
118
|
+
if (!!complexTableStyleConfig[key] || complexTableStyleConfig[key] === 0) {
|
|
119
|
+
styleObj[newKey] = complexTableStyleConfig[key];
|
|
120
|
+
}
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (key.indexOf("headerCell_container_") < 0) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
let newKey = key.replace("headerCell_container_", "");
|
|
127
|
+
if (!!complexTableStyleConfig[key] || complexTableStyleConfig[key] === 0) {
|
|
128
|
+
styleObj[newKey] = complexTableStyleConfig[key];
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
Object.keys(tdStyleConfig).forEach((key, index) => {
|
|
132
|
+
if (key.indexOf("container_") < 0) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
let newKey = key.replace("container_", "");
|
|
136
|
+
if (!!tdStyleConfig[key] || tdStyleConfig[key] === 0) {
|
|
137
|
+
styleObj[newKey] = tdStyleConfig[key];
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
if (!!tdPropsConfig.centerHorizontally || !!tdPropsConfig.centerVertical) {
|
|
141
|
+
styleObj.display = "flex";
|
|
142
|
+
}
|
|
143
|
+
if (!!tdPropsConfig.centerHorizontally) {
|
|
144
|
+
styleObj.justifyContent = "center";
|
|
145
|
+
}
|
|
146
|
+
if (!!tdPropsConfig.centerVertical) {
|
|
147
|
+
styleObj.alignItems = "center";
|
|
148
|
+
}
|
|
149
|
+
Object.keys(styleObj).forEach((key, index) => {
|
|
150
|
+
styleText += `${camelToKebab(key)}:${styleObj[key]};`;
|
|
151
|
+
});
|
|
152
|
+
return styleText;
|
|
153
|
+
};
|
|
154
|
+
const createComplexTableHeaderTdSlashStyle = ({ width = 0, height = 0, direction } = {}) => {
|
|
155
|
+
if (!width || !height) {
|
|
156
|
+
return "";
|
|
157
|
+
}
|
|
158
|
+
if (!direction) {
|
|
159
|
+
direction = "top-left";
|
|
160
|
+
}
|
|
161
|
+
let styleText = "";
|
|
162
|
+
let styleObj = {};
|
|
163
|
+
let slashWidth = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2));
|
|
164
|
+
let slashDeg = (Math.atan(height / width) * 180) / Math.PI;
|
|
165
|
+
styleObj.width = `${slashWidth}px`;
|
|
166
|
+
styleObj.transformOrigin = `top left`;
|
|
167
|
+
if (direction == "top-left") {
|
|
168
|
+
styleObj.transform = `rotate(${slashDeg}deg)`;
|
|
169
|
+
} else {
|
|
170
|
+
styleObj.transform = `rotate(-${slashDeg}deg)`;
|
|
171
|
+
}
|
|
172
|
+
Object.keys(styleObj).forEach((key, index) => {
|
|
173
|
+
styleText += `${camelToKebab(key)}:${styleObj[key]};`;
|
|
174
|
+
});
|
|
175
|
+
return styleText;
|
|
176
|
+
};
|
|
177
|
+
const createComplexTableContentTdStyle = ({
|
|
178
|
+
complexTablePropsConfig,
|
|
179
|
+
complexTableStyleConfig,
|
|
180
|
+
complexTableHeaderRules,
|
|
181
|
+
rowIndex,
|
|
182
|
+
colIndex
|
|
183
|
+
} = {}) => {
|
|
184
|
+
if (!complexTablePropsConfig) {
|
|
185
|
+
complexTablePropsConfig = {};
|
|
186
|
+
}
|
|
187
|
+
if (!complexTableStyleConfig) {
|
|
188
|
+
complexTableStyleConfig = {};
|
|
189
|
+
}
|
|
190
|
+
if (!complexTableHeaderRules) {
|
|
191
|
+
complexTableHeaderRules = {};
|
|
192
|
+
}
|
|
193
|
+
let styleText = "";
|
|
194
|
+
let styleObj = {};
|
|
195
|
+
Object.keys(complexTableStyleConfig).forEach((key, index) => {
|
|
196
|
+
if (key.indexOf("common_") >= 0) {
|
|
197
|
+
let newKey = key.replace("common_", "");
|
|
198
|
+
if (!!complexTableStyleConfig[key] || complexTableStyleConfig[key] === 0) {
|
|
199
|
+
styleObj[newKey] = complexTableStyleConfig[key];
|
|
200
|
+
}
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (key.indexOf("contentCell_") < 0 || key.indexOf("contentCell_container_") >= 0) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
let newKey = key.replace("contentCell_", "");
|
|
207
|
+
if (!!complexTableStyleConfig[key] || complexTableStyleConfig[key] === 0) {
|
|
208
|
+
styleObj[newKey] = complexTableStyleConfig[key];
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
if (!!complexTablePropsConfig.canContinue) {
|
|
212
|
+
// 续打模式
|
|
213
|
+
_formatContentTdStyleOnContinue({ complexTablePropsConfig, complexTableStyleConfig, styleObj });
|
|
214
|
+
} else if (!!complexTablePropsConfig.isPaginationMode) {
|
|
215
|
+
// 启用分页
|
|
216
|
+
_formatContentTdStyleOnPaginationMode({ complexTablePropsConfig, complexTableStyleConfig, styleObj });
|
|
217
|
+
}
|
|
218
|
+
if (rowIndex === 0) {
|
|
219
|
+
let { props: headerProps, style: headerStyle } = _getHeaderRuleOnColumn();
|
|
220
|
+
if (!!headerStyle && headerStyle.width) {
|
|
221
|
+
styleObj.width = headerStyle.width;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
Object.keys(styleObj).forEach((key, index) => {
|
|
225
|
+
if (!!complexTablePropsConfig.canContinue && _ContinueInvalidConfigList.indexOf(key) >= 0) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
if (!!complexTablePropsConfig.isPaginationMode && _ContinueInvalidConfigList.indexOf(key) >= 0) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
styleText += `${camelToKebab(key)}:${styleObj[key]};`;
|
|
232
|
+
});
|
|
233
|
+
function _getHeaderRuleOnColumn() {
|
|
234
|
+
let headerStyleKey = "";
|
|
235
|
+
let nowRowIndex = -1;
|
|
236
|
+
Object.keys(complexTableHeaderRules).forEach((key, index) => {
|
|
237
|
+
let headerRuleIdDetails = getComplexTableHeaderRuleIdDetails(key);
|
|
238
|
+
if (!headerRuleIdDetails) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
if (nowRowIndex < headerRuleIdDetails.rowIndex && headerRuleIdDetails.colIndex === colIndex) {
|
|
242
|
+
headerStyleKey = key;
|
|
243
|
+
nowRowIndex = headerRuleIdDetails.rowIndex;
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
if (!headerStyleKey) {
|
|
247
|
+
return {};
|
|
248
|
+
}
|
|
249
|
+
return complexTableHeaderRules[headerStyleKey];
|
|
250
|
+
}
|
|
251
|
+
return styleText;
|
|
252
|
+
};
|
|
253
|
+
const createComplexTableContentTdContainerStyle = ({ complexTablePropsConfig, complexTableStyleConfig } = {}) => {
|
|
254
|
+
if (!complexTablePropsConfig) {
|
|
255
|
+
complexTablePropsConfig = {};
|
|
256
|
+
}
|
|
257
|
+
if (!complexTableStyleConfig) {
|
|
258
|
+
complexTableStyleConfig = {};
|
|
259
|
+
}
|
|
260
|
+
let styleText = "";
|
|
261
|
+
let styleObj = {
|
|
262
|
+
width: "100%",
|
|
263
|
+
height: "100%"
|
|
264
|
+
};
|
|
265
|
+
Object.keys(complexTableStyleConfig).forEach((key, index) => {
|
|
266
|
+
if (key.indexOf("common_") >= 0) {
|
|
267
|
+
let newKey = key.replace("common_", "");
|
|
268
|
+
if (!!complexTableStyleConfig[key] || complexTableStyleConfig[key] === 0) {
|
|
269
|
+
styleObj[newKey] = complexTableStyleConfig[key];
|
|
270
|
+
}
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
if (key.indexOf("contentCell_container_") < 0) {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
let newKey = key.replace("contentCell_container_", "");
|
|
277
|
+
if (!!complexTableStyleConfig[key] || complexTableStyleConfig[key] === 0) {
|
|
278
|
+
styleObj[newKey] = complexTableStyleConfig[key];
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
if (!!complexTablePropsConfig.canContinue) {
|
|
282
|
+
// 续打模式
|
|
283
|
+
_formatContentTdContainerStyleOnContinue({ complexTablePropsConfig, complexTableStyleConfig, styleObj });
|
|
284
|
+
} else if (!!complexTablePropsConfig.isPaginationMode) {
|
|
285
|
+
// 启用分页
|
|
286
|
+
_formatContentTdContainerStyleOnPaginationMode({ complexTablePropsConfig, complexTableStyleConfig, styleObj });
|
|
287
|
+
}
|
|
288
|
+
Object.keys(styleObj).forEach((key, index) => {
|
|
289
|
+
styleText += `${camelToKebab(key)}:${styleObj[key]};`;
|
|
290
|
+
});
|
|
291
|
+
return styleText;
|
|
292
|
+
};
|
|
293
|
+
const getComplexTableHeaderRulesId = ({ rowIndex, colIndex } = {}) => {
|
|
294
|
+
return `${rowIndex}-${colIndex}`;
|
|
295
|
+
};
|
|
296
|
+
const getComplexTableHeaderRuleIdDetails = (headerCellId) => {
|
|
297
|
+
if (!headerCellId) {
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
let headerCellIdDetailsArray = headerCellId.split("-");
|
|
301
|
+
let headerCellIdDetails = {
|
|
302
|
+
rowIndex: Number(headerCellIdDetailsArray[0]),
|
|
303
|
+
colIndex: Number(headerCellIdDetailsArray[1])
|
|
304
|
+
};
|
|
305
|
+
return headerCellIdDetails;
|
|
306
|
+
};
|
|
307
|
+
function _formatContentTdStyleOnContinue({ complexTablePropsConfig, complexTableStyleConfig, styleObj }) {
|
|
308
|
+
if (!complexTablePropsConfig.canContinue) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
if (complexTablePropsConfig.continuePrintMode == "fixedHeight") {
|
|
312
|
+
styleObj.height = `${complexTablePropsConfig.contentRowHeight}px`;
|
|
313
|
+
!!styleObj.paddingTop && delete styleObj.paddingTop;
|
|
314
|
+
!!styleObj.paddingBottom && delete styleObj.paddingBottom;
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
if (complexTablePropsConfig.continuePrintMode == "autoHeight") {
|
|
318
|
+
styleObj.height = `${complexTablePropsConfig.contentRowHeight}px`;
|
|
319
|
+
!!styleObj.paddingTop && delete styleObj.paddingTop;
|
|
320
|
+
!!styleObj.paddingBottom && delete styleObj.paddingBottom;
|
|
321
|
+
!!styleObj.paddingLeft && delete styleObj.paddingLeft;
|
|
322
|
+
!!styleObj.paddingRight && delete styleObj.paddingRight;
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
if (complexTablePropsConfig.continuePrintMode == "_autoHeight_previewElements") {
|
|
326
|
+
styleObj.height = `${complexTablePropsConfig.contentRowHeight}px`;
|
|
327
|
+
!!styleObj.paddingTop && delete styleObj.paddingTop;
|
|
328
|
+
!!styleObj.paddingBottom && delete styleObj.paddingBottom;
|
|
329
|
+
!!styleObj.paddingLeft && delete styleObj.paddingLeft;
|
|
330
|
+
!!styleObj.paddingRight && delete styleObj.paddingRight;
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
function _formatContentTdContainerStyleOnContinue({ complexTablePropsConfig, complexTableStyleConfig, styleObj }) {
|
|
335
|
+
if (!complexTablePropsConfig.canContinue) {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
if (complexTablePropsConfig.continuePrintMode == "fixedHeight") {
|
|
339
|
+
styleObj.height = `${complexTablePropsConfig.contentRowHeight}px`;
|
|
340
|
+
styleObj.lineHeight = `${complexTablePropsConfig.contentRowHeight}px`;
|
|
341
|
+
!!styleObj.minHeight && delete styleObj.minHeight;
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
if (complexTablePropsConfig.continuePrintMode == "autoHeight") {
|
|
345
|
+
styleObj.minHeight = `${complexTablePropsConfig.contentRowHeight}px`;
|
|
346
|
+
styleObj.lineHeight = `${complexTablePropsConfig.contentRowHeight}px`;
|
|
347
|
+
if (!!complexTableStyleConfig.contentCell_paddingLeft) {
|
|
348
|
+
styleObj.paddingLeft = `${complexTableStyleConfig.contentCell_paddingLeft}`;
|
|
349
|
+
}
|
|
350
|
+
if (!!complexTableStyleConfig.contentCell_paddingRight) {
|
|
351
|
+
styleObj.paddingRight = `${complexTableStyleConfig.contentCell_paddingRight}`;
|
|
352
|
+
}
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
if (complexTablePropsConfig.continuePrintMode == "_autoHeight_previewElements") {
|
|
356
|
+
styleObj.width = "auto";
|
|
357
|
+
styleObj.height = "auto";
|
|
358
|
+
styleObj.minHeight = `${complexTablePropsConfig.contentRowHeight}px`;
|
|
359
|
+
styleObj.lineHeight = `${complexTablePropsConfig.contentRowHeight}px`;
|
|
360
|
+
if (!!complexTableStyleConfig.contentCell_paddingLeft) {
|
|
361
|
+
styleObj.paddingLeft = `${complexTableStyleConfig.contentCell_paddingLeft}`;
|
|
362
|
+
}
|
|
363
|
+
if (!!complexTableStyleConfig.contentCell_paddingRight) {
|
|
364
|
+
styleObj.paddingRight = `${complexTableStyleConfig.contentCell_paddingRight}`;
|
|
365
|
+
}
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
function _formatContentTdStyleOnPaginationMode({ complexTablePropsConfig, complexTableStyleConfig, styleObj }) {
|
|
370
|
+
if (!complexTablePropsConfig.isPaginationMode) {
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
if (!!complexTablePropsConfig._paginationModePreview) {
|
|
374
|
+
styleObj.height = `${complexTablePropsConfig.contentRowHeight}px`;
|
|
375
|
+
!!styleObj.paddingTop && delete styleObj.paddingTop;
|
|
376
|
+
!!styleObj.paddingBottom && delete styleObj.paddingBottom;
|
|
377
|
+
!!styleObj.paddingLeft && delete styleObj.paddingLeft;
|
|
378
|
+
!!styleObj.paddingRight && delete styleObj.paddingRight;
|
|
379
|
+
} else {
|
|
380
|
+
styleObj.height = `${complexTablePropsConfig.contentRowHeight}px`;
|
|
381
|
+
!!styleObj.paddingTop && delete styleObj.paddingTop;
|
|
382
|
+
!!styleObj.paddingBottom && delete styleObj.paddingBottom;
|
|
383
|
+
!!styleObj.paddingLeft && delete styleObj.paddingLeft;
|
|
384
|
+
!!styleObj.paddingRight && delete styleObj.paddingRight;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
function _formatContentTdContainerStyleOnPaginationMode({ complexTablePropsConfig, complexTableStyleConfig, styleObj }) {
|
|
388
|
+
if (!complexTablePropsConfig.isPaginationMode) {
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
if (!!complexTablePropsConfig._paginationModePreview) {
|
|
392
|
+
styleObj.width = "auto";
|
|
393
|
+
styleObj.height = "auto";
|
|
394
|
+
styleObj.minHeight = `${complexTablePropsConfig.contentRowHeight}px`;
|
|
395
|
+
styleObj.lineHeight = `${complexTablePropsConfig.contentRowHeight}px`;
|
|
396
|
+
if (!!complexTableStyleConfig.contentCell_paddingLeft) {
|
|
397
|
+
styleObj.paddingLeft = `${complexTableStyleConfig.contentCell_paddingLeft}`;
|
|
398
|
+
}
|
|
399
|
+
if (!!complexTableStyleConfig.contentCell_paddingRight) {
|
|
400
|
+
styleObj.paddingRight = `${complexTableStyleConfig.contentCell_paddingRight}`;
|
|
401
|
+
}
|
|
402
|
+
} else {
|
|
403
|
+
styleObj.minHeight = `${complexTablePropsConfig.contentRowHeight}px`;
|
|
404
|
+
styleObj.lineHeight = `${complexTablePropsConfig.contentRowHeight}px`;
|
|
405
|
+
if (!!complexTableStyleConfig.contentCell_paddingLeft) {
|
|
406
|
+
styleObj.paddingLeft = `${complexTableStyleConfig.contentCell_paddingLeft}`;
|
|
407
|
+
}
|
|
408
|
+
if (!!complexTableStyleConfig.contentCell_paddingRight) {
|
|
409
|
+
styleObj.paddingRight = `${complexTableStyleConfig.contentCell_paddingRight}`;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
const _ContinueInvalidConfigList = [
|
|
414
|
+
"borderStyle",
|
|
415
|
+
"borderWidth",
|
|
416
|
+
"borderColor",
|
|
417
|
+
"borderTopStyle",
|
|
418
|
+
"borderTopWidth",
|
|
419
|
+
"borderTopColor",
|
|
420
|
+
"borderBottomStyle",
|
|
421
|
+
"borderBottomWidth",
|
|
422
|
+
"borderBottomColor",
|
|
423
|
+
"borderLeftStyle",
|
|
424
|
+
"borderLeftWidth",
|
|
425
|
+
"borderLeftColor",
|
|
426
|
+
"borderRightStyle",
|
|
427
|
+
"borderRightWidth",
|
|
428
|
+
"borderRightColor",
|
|
429
|
+
"headerCell_borderStyle",
|
|
430
|
+
"headerCell_borderWidth",
|
|
431
|
+
"headerCell_borderColor",
|
|
432
|
+
"headerCell_borderTopStyle",
|
|
433
|
+
"headerCell_borderTopWidth",
|
|
434
|
+
"headerCell_borderTopColor",
|
|
435
|
+
"headerCell_borderBottomStyle",
|
|
436
|
+
"headerCell_borderBottomWidth",
|
|
437
|
+
"headerCell_borderBottomColor",
|
|
438
|
+
"headerCell_borderLeftStyle",
|
|
439
|
+
"headerCell_borderLeftWidth",
|
|
440
|
+
"headerCell_borderLeftColor",
|
|
441
|
+
"headerCell_borderRightStyle",
|
|
442
|
+
"headerCell_borderRightWidth",
|
|
443
|
+
"headerCell_borderRightColor",
|
|
444
|
+
"headerCell_container_minHeight",
|
|
445
|
+
"contentCell_borderStyle",
|
|
446
|
+
"contentCell_borderWidth",
|
|
447
|
+
"contentCell_borderColor",
|
|
448
|
+
"contentCell_borderTopStyle",
|
|
449
|
+
"contentCell_borderTopWidth",
|
|
450
|
+
"contentCell_borderTopColor",
|
|
451
|
+
"contentCell_borderBottomStyle",
|
|
452
|
+
"contentCell_borderBottomWidth",
|
|
453
|
+
"contentCell_borderBottomColor",
|
|
454
|
+
"contentCell_borderLeftStyle",
|
|
455
|
+
"contentCell_borderLeftWidth",
|
|
456
|
+
"contentCell_borderLeftColor",
|
|
457
|
+
"contentCell_borderRightStyle",
|
|
458
|
+
"contentCell_borderRightWidth",
|
|
459
|
+
"contentCell_borderRightColor",
|
|
460
|
+
"contentCell_container_minHeight",
|
|
461
|
+
"contentCell_container_lineHeight"
|
|
462
|
+
];
|
|
463
|
+
export default {
|
|
464
|
+
createComplexTableStyle,
|
|
465
|
+
createComplexTableHeaderTdStyle,
|
|
466
|
+
createComplexTableHeaderTdContainerStyle,
|
|
467
|
+
createComplexTableHeaderTdSlashStyle,
|
|
468
|
+
createComplexTableContentTdStyle,
|
|
469
|
+
createComplexTableContentTdContainerStyle,
|
|
470
|
+
getComplexTableHeaderRulesId,
|
|
471
|
+
getComplexTableHeaderRuleIdDetails
|
|
472
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { camelToKebab, deepCopy } from "../print-designer-utils";
|
|
2
|
+
const createInputStyle = ({ 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 createTextareaStyle = ({ styleConfig, formConfig, formComponentProps } = {}) => {
|
|
18
|
+
if (!styleConfig) {
|
|
19
|
+
styleConfig = {};
|
|
20
|
+
}
|
|
21
|
+
if (!formConfig) {
|
|
22
|
+
formConfig = {};
|
|
23
|
+
}
|
|
24
|
+
if (!formComponentProps) {
|
|
25
|
+
formComponentProps = {};
|
|
26
|
+
}
|
|
27
|
+
let styleObj = {};
|
|
28
|
+
let styleText = "";
|
|
29
|
+
Object.keys(styleConfig).forEach((key, index) => {
|
|
30
|
+
if (key.indexOf("_") >= 0) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
if (!!styleConfig[key] || styleConfig[key] === 0) {
|
|
34
|
+
styleObj[key] = styleConfig[key];
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
let size = formConfig.props.size;
|
|
38
|
+
if (!!formComponentProps.size) {
|
|
39
|
+
size = formComponentProps.size;
|
|
40
|
+
}
|
|
41
|
+
if (!formComponentProps.autosize && typeof formComponentProps.rows == "number") {
|
|
42
|
+
let rowHeightDetails = TextareaRowHeightBySize.get(size);
|
|
43
|
+
if (!!rowHeightDetails) {
|
|
44
|
+
let textareaHeight = rowHeightDetails.value * formComponentProps.rows;
|
|
45
|
+
styleObj.height = `${textareaHeight}px`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
Object.keys(styleObj).forEach((key, index) => {
|
|
49
|
+
styleText += `${camelToKebab(key)}:${styleObj[key]};`;
|
|
50
|
+
});
|
|
51
|
+
return styleText;
|
|
52
|
+
};
|
|
53
|
+
const TextareaRowHeightBySize = new Map([
|
|
54
|
+
["large", { label: "大", value: 22 }],
|
|
55
|
+
["default", { label: "默认", value: 22 }],
|
|
56
|
+
["small", { label: "小", value: 19 }]
|
|
57
|
+
]);
|
|
58
|
+
const createDatetimeStyle = ({ styleConfig } = {}) => {
|
|
59
|
+
if (!styleConfig) {
|
|
60
|
+
styleConfig = {};
|
|
61
|
+
}
|
|
62
|
+
let styleText = "";
|
|
63
|
+
Object.keys(styleConfig).forEach((key, index) => {
|
|
64
|
+
if (key.indexOf("_") >= 0) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
if (!!styleConfig[key] || styleConfig[key] === 0) {
|
|
68
|
+
styleText += `${camelToKebab(key)}:${styleConfig[key]};`;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return styleText;
|
|
72
|
+
};
|
|
73
|
+
export default {
|
|
74
|
+
createInputStyle,
|
|
75
|
+
createTextareaStyle,
|
|
76
|
+
TextareaRowHeightBySize,
|
|
77
|
+
createDatetimeStyle
|
|
78
|
+
};
|