gm-printer 10.30.2-beta.9 → 10.31.1
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/build/demo.js +9 -9
- package/package.json +1 -1
- package/src/printer/table_special_tr.js +20 -7
package/package.json
CHANGED
|
@@ -32,6 +32,13 @@ const SpecialTr = ({ data, config }) => {
|
|
|
32
32
|
compiled = () => template_text
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
const defaultFields = [
|
|
36
|
+
{
|
|
37
|
+
valueField: '下单金额'
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
const newFields = fields || defaultFields
|
|
41
|
+
|
|
35
42
|
switch (type) {
|
|
36
43
|
case 'flex':
|
|
37
44
|
// eslint-disable-next-line no-case-declarations
|
|
@@ -95,6 +102,13 @@ const SpecialTr = ({ data, config }) => {
|
|
|
95
102
|
throw Error('_special缺少text,请检查data_to_key处理table数据代码!')
|
|
96
103
|
|
|
97
104
|
if (isUpperLowerCaseSeparate) {
|
|
105
|
+
const UpperCaseBefore =
|
|
106
|
+
data[newFields[0].valueField]
|
|
107
|
+
?.upperLowerCaseSeparateAndUpperCaseBefore
|
|
108
|
+
|
|
109
|
+
const htmlStr = isUpperCaseBefore
|
|
110
|
+
? UpperCaseBefore
|
|
111
|
+
: data[newFields[0].valueField]?.upperLowerCaseSeparate
|
|
98
112
|
return (
|
|
99
113
|
<tr>
|
|
100
114
|
<td
|
|
@@ -102,11 +116,10 @@ const SpecialTr = ({ data, config }) => {
|
|
|
102
116
|
style={Object.assign({ fontWeight: 'bold' }, style)}
|
|
103
117
|
>
|
|
104
118
|
<Flex
|
|
105
|
-
className='gm-flex-justify-between'
|
|
119
|
+
className='gm-flex-page gm-flex-justify-between-page'
|
|
120
|
+
style={{ 'justify-content': 'space-between' }}
|
|
106
121
|
dangerouslySetInnerHTML={{
|
|
107
|
-
__html:
|
|
108
|
-
data[fields[0].valueField]?.upperLowerCaseSeparate ||
|
|
109
|
-
data.text
|
|
122
|
+
__html: htmlStr || data.text
|
|
110
123
|
}}
|
|
111
124
|
/>
|
|
112
125
|
</td>
|
|
@@ -117,12 +130,12 @@ const SpecialTr = ({ data, config }) => {
|
|
|
117
130
|
// eslint-disable-next-line no-case-declarations
|
|
118
131
|
const getHtml = () => {
|
|
119
132
|
if (isUpperCaseBefore) {
|
|
120
|
-
return data[
|
|
133
|
+
return data[newFields[0].valueField]?.upperCaseBefore
|
|
121
134
|
}
|
|
122
135
|
if (needUpperCase) {
|
|
123
|
-
return data[
|
|
136
|
+
return data[newFields[0].valueField]?.upperCaseText
|
|
124
137
|
}
|
|
125
|
-
return data[
|
|
138
|
+
return data[newFields[0]?.valueField]?.text || data.text
|
|
126
139
|
}
|
|
127
140
|
|
|
128
141
|
return (
|