gm-printer 10.14.4-alpha.0 → 10.14.4-beta.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-printer",
3
- "version": "10.14.4-alpha.0",
3
+ "version": "10.14.4-beta.2",
4
4
  "description": "diy printer",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -12,10 +12,15 @@ class EditorCutomizedConfig extends React.Component {
12
12
  editStore.handleChangeTableData(value)
13
13
  }
14
14
 
15
+ handleMultiDigitDecimal = value => {
16
+ const { editStore } = this.props
17
+ editStore.setMultiDigitDecimal(value)
18
+ }
19
+
15
20
  render() {
16
21
  const {
17
22
  editStore,
18
- editStore: { isAutoFilling }
23
+ editStore: { isAutoFilling, isMultiDigitDecimal }
19
24
  } = this.props
20
25
  // 是table
21
26
  if (editStore.computedRegionIsTable) {
@@ -28,6 +33,13 @@ class EditorCutomizedConfig extends React.Component {
28
33
  <Flex className='gm-padding-top-5 gm-text-red' column>
29
34
  {i18next.t('注意:填充仅支持单栏数据使用')}
30
35
  </Flex>
36
+ <Flex alignCenter className='gm-padding-top-5'>
37
+ <div>{i18next.t('是否开启多位小数')}:</div>
38
+ <Switch
39
+ checked={isMultiDigitDecimal}
40
+ onChange={this.handleMultiDigitDecimal}
41
+ />
42
+ </Flex>
31
43
  </>
32
44
  )
33
45
  } else {
@@ -49,6 +49,10 @@ class EditorStore {
49
49
  @observable
50
50
  isAutoFilling = false
51
51
 
52
+ /** 是否开启多位小数,默认不开启,取两位 */
53
+ @observable
54
+ isMultiDigitDecimal = false
55
+
52
56
  defaultTableDataKey = 'orders'
53
57
 
54
58
  // 默认table的dataKey
@@ -61,6 +65,16 @@ class EditorStore {
61
65
  this.isAutoFilling = bol
62
66
  }
63
67
 
68
+ @action
69
+ setMultiDigitDecimal(bool) {
70
+ this.isMultiDigitDecimal = bool
71
+ set(this.config, {
72
+ specialControlConfig: {
73
+ multiDigitDecimal: bool
74
+ }
75
+ })
76
+ }
77
+
64
78
  @observable
65
79
  overallOrderShow = false
66
80
 
@@ -156,19 +170,14 @@ class EditorStore {
156
170
 
157
171
  set(this.config, {
158
172
  autoFillConfig: {
159
- region: this.selectedRegion || autoFillConfig?.region,
173
+ region: this.selectedRegion,
160
174
  dataKey,
161
175
  checked: isAutoFilling
162
176
  }
163
177
  })
164
-
165
- const hasHadEmptyData = _.some(table, data => data?._isEmptyData)
166
-
167
- // 开关打开,且之前数组不包含空数据,再进行填充
168
- if (isAutoFilling && !hasHadEmptyData) {
178
+ if (isAutoFilling) {
169
179
  table.push(...this.getFilledTableData(table))
170
- }
171
- if (!isAutoFilling) {
180
+ } else {
172
181
  this.clearExtraTableData(dataKey)
173
182
  return
174
183
  }
@@ -191,6 +200,7 @@ class EditorStore {
191
200
  this.insertPanel = 'header'
192
201
  this.mockData = data
193
202
  this.isAutoFilling = false
203
+ this.isMultiDigitDecimal = false
194
204
  }
195
205
 
196
206
  @action
@@ -866,17 +876,14 @@ class EditorStore {
866
876
  // 获得表格自定义行高
867
877
  @computed
868
878
  get computedTableCustomerRowHeight() {
869
- const _defaultRegion = this.config?.autoFillConfig?.region
870
- let resHeight = 23
871
- if (this.selectedRegion || _defaultRegion) {
872
- const _selectedRegion = this.selectedRegion || _defaultRegion
873
- const arr = _selectedRegion.split('.')
879
+ if (this.selectedRegion) {
880
+ const arr = this.selectedRegion.split('.')
874
881
  if (arr.includes('table')) {
875
882
  const height = this.config.contents[arr[2]].customerRowHeight
876
- resHeight = height === undefined ? 23 : height
883
+ return height === undefined ? 23 : height
877
884
  }
878
885
  }
879
- return resHeight
886
+ return 23
880
887
  }
881
888
 
882
889
  @action.bound
@@ -26,7 +26,7 @@ class ContextMenu extends React.Component {
26
26
  const {
27
27
  editStore,
28
28
  editStore: {
29
- config: { autoFillConfig }
29
+ config: { autoFillConfig, specialControlConfig }
30
30
  }
31
31
  } = this.props
32
32
 
@@ -36,6 +36,11 @@ class ContextMenu extends React.Component {
36
36
  autoFillConfig?.dataKey
37
37
  )
38
38
  }
39
+ /** 初始化特殊控制的配置 */
40
+ if (specialControlConfig?.multiDigitDecimal) {
41
+ // 多位小数
42
+ editStore.setMultiDigitDecimal(specialControlConfig?.multiDigitDecimal)
43
+ }
39
44
  }
40
45
 
41
46
  /**
@@ -183,11 +183,7 @@ class Printer extends React.Component {
183
183
  content?.dataKey === autoFillConfig?.dataKey
184
184
 
185
185
  const end = isAutofillConfig
186
- ? panel.end +
187
- Math.floor(
188
- remainPageHeight /
189
- printerStore.computedTableCustomerRowHeight
190
- )
186
+ ? panel.end + Math.floor(remainPageHeight / TR_BASE_HEIGHT)
191
187
  : panel.end
192
188
  switch (panel.type) {
193
189
  case 'table':
@@ -48,6 +48,15 @@ class PrinterStore {
48
48
  @observable
49
49
  isAutoFilling = false
50
50
 
51
+ /** 是否开启多位小数,默认不开启,取两位 */
52
+ @observable
53
+ isMultiDigitDecimal = false
54
+
55
+ @action
56
+ setMultiDigitDecimal(bool) {
57
+ this.isMultiDigitDecimal = bool
58
+ }
59
+
51
60
  @action
52
61
  init(config, data) {
53
62
  this.ready = false