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

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.0",
4
4
  "description": "diy printer",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -12,10 +12,17 @@ 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
+
20
+
21
+
15
22
  render() {
16
23
  const {
17
24
  editStore,
18
- editStore: { isAutoFilling }
25
+ editStore: { isAutoFilling,isMultiDigitDecimal }
19
26
  } = this.props
20
27
  // 是table
21
28
  if (editStore.computedRegionIsTable) {
@@ -28,6 +35,10 @@ class EditorCutomizedConfig extends React.Component {
28
35
  <Flex className='gm-padding-top-5 gm-text-red' column>
29
36
  {i18next.t('注意:填充仅支持单栏数据使用')}
30
37
  </Flex>
38
+ <Flex alignCenter className='gm-padding-top-5'>
39
+ <div>{i18next.t('是否开启多位小数')}:</div>
40
+ <Switch checked={isMultiDigitDecimal} onChange={this.handleMultiDigitDecimal} />
41
+ </Flex>
31
42
  </>
32
43
  )
33
44
  } 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,11 @@ class EditorStore {
61
65
  this.isAutoFilling = bol
62
66
  }
63
67
 
68
+ @action
69
+ setMultiDigitDecimal(bool) {
70
+ this.isMultiDigitDecimal = bool
71
+ }
72
+
64
73
  @observable
65
74
  overallOrderShow = false
66
75
 
@@ -156,19 +165,14 @@ class EditorStore {
156
165
 
157
166
  set(this.config, {
158
167
  autoFillConfig: {
159
- region: this.selectedRegion || autoFillConfig?.region,
168
+ region: this.selectedRegion,
160
169
  dataKey,
161
170
  checked: isAutoFilling
162
171
  }
163
172
  })
164
-
165
- const hasHadEmptyData = _.some(table, data => data?._isEmptyData)
166
-
167
- // 开关打开,且之前数组不包含空数据,再进行填充
168
- if (isAutoFilling && !hasHadEmptyData) {
173
+ if (isAutoFilling) {
169
174
  table.push(...this.getFilledTableData(table))
170
- }
171
- if (!isAutoFilling) {
175
+ } else {
172
176
  this.clearExtraTableData(dataKey)
173
177
  return
174
178
  }
@@ -866,17 +870,14 @@ class EditorStore {
866
870
  // 获得表格自定义行高
867
871
  @computed
868
872
  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('.')
873
+ if (this.selectedRegion) {
874
+ const arr = this.selectedRegion.split('.')
874
875
  if (arr.includes('table')) {
875
876
  const height = this.config.contents[arr[2]].customerRowHeight
876
- resHeight = height === undefined ? 23 : height
877
+ return height === undefined ? 23 : height
877
878
  }
878
879
  }
879
- return resHeight
880
+ return 23
880
881
  }
881
882
 
882
883
  @action.bound
@@ -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':