gm-printer 10.41.6-beta.1 → 10.41.6-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/build/demo.js +2 -2
- package/locales/en.json +3 -0
- package/locales/th.json +3 -0
- package/locales/zh-HK.json +3 -0
- package/package.json +1 -1
- package/src/common/component.js +2 -2
- package/src/printer/block.js +10 -3
package/locales/en.json
CHANGED
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
"粗细": "",
|
|
17
17
|
"高": "",
|
|
18
18
|
"图片大小不能超过500Kb": "",
|
|
19
|
+
"图片大小不能超过2M": "Image size cannot exceed 2M",
|
|
20
|
+
"仅支持jpg、jpeg、png格式的图片": "Only JPG, JPEG, and PNG images are supported",
|
|
21
|
+
"支持插入2M以内的jpg、jpeg、png格式图片": "Support inserting JPG, JPEG, or PNG images within 2M",
|
|
19
22
|
"配送单特殊控制": "",
|
|
20
23
|
"添加字段": "",
|
|
21
24
|
"编辑字段": "",
|
package/locales/th.json
CHANGED
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
"粗细": "",
|
|
17
17
|
"高": "",
|
|
18
18
|
"图片大小不能超过500Kb": "",
|
|
19
|
+
"图片大小不能超过2M": "ขนาดรูปภาพต้องไม่เกิน 2M",
|
|
20
|
+
"仅支持jpg、jpeg、png格式的图片": "รองรับเฉพาะรูปภาพรูปแบบ jpg, jpeg, png",
|
|
21
|
+
"支持插入2M以内的jpg、jpeg、png格式图片": "รองรับการแทรกรูปภาพ jpg, jpeg, png ขนาดไม่เกิน 2M",
|
|
19
22
|
"配送单特殊控制": "",
|
|
20
23
|
"添加字段": "",
|
|
21
24
|
"编辑字段": "",
|
package/locales/zh-HK.json
CHANGED
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
"粗细": "粗細",
|
|
17
17
|
"高": "高",
|
|
18
18
|
"图片大小不能超过500Kb": "圖片大小不能超過500Kb",
|
|
19
|
+
"图片大小不能超过2M": "圖片大小不能超過2M",
|
|
20
|
+
"仅支持jpg、jpeg、png格式的图片": "僅支持jpg、jpeg、png格式的圖片",
|
|
21
|
+
"支持插入2M以内的jpg、jpeg、png格式图片": "支持插入2M以內的jpg、jpeg、png格式圖片",
|
|
19
22
|
"添加字段": "添加字段",
|
|
20
23
|
"编辑字段": "編輯字段",
|
|
21
24
|
"配送单特殊控制": "配送单特殊控制",
|
package/package.json
CHANGED
package/src/common/component.js
CHANGED
|
@@ -403,9 +403,9 @@ class Size extends React.Component {
|
|
|
403
403
|
const num = parseFloat(value)
|
|
404
404
|
if (!_.isNaN(num) && num > 0) {
|
|
405
405
|
if (type === 'width') {
|
|
406
|
-
next.height = num / ratio + 'px'
|
|
406
|
+
next.height = Math.round(num / ratio) + 'px'
|
|
407
407
|
} else {
|
|
408
|
-
next.width = num * ratio + 'px'
|
|
408
|
+
next.width = Math.round(num * ratio) + 'px'
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
411
|
}
|
package/src/printer/block.js
CHANGED
|
@@ -8,7 +8,12 @@ import BarCode from './barcode'
|
|
|
8
8
|
import QrCode from './qrcode'
|
|
9
9
|
import Tag from './tag'
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
// editStore 用函数形式注入:打印态(do_print 的 iframe)没有 editStore Provider,
|
|
12
|
+
// 字符串形式的 inject 会直接抛错,这里降级为 null 关闭编辑能力
|
|
13
|
+
@inject(({ printerStore, editStore }) => ({
|
|
14
|
+
printerStore,
|
|
15
|
+
editStore: editStore || null
|
|
16
|
+
}))
|
|
12
17
|
@observer
|
|
13
18
|
class Block extends React.Component {
|
|
14
19
|
constructor(props) {
|
|
@@ -127,7 +132,9 @@ class Block extends React.Component {
|
|
|
127
132
|
|
|
128
133
|
const initW = parseFloat(style.width) || 0
|
|
129
134
|
const initH = parseFloat(style.height) || 0
|
|
130
|
-
// 旧模板无 ratio
|
|
135
|
+
// 旧模板无 ratio 时按当前显示宽高锁定;宽或高缺失(存量块无 width)时退回 1,
|
|
136
|
+
// 避免比例算出 0 导致高度 Infinity
|
|
137
|
+
const fallbackRatio = initW > 0 && initH > 0 ? initW / initH : 1
|
|
131
138
|
this.resizeState = {
|
|
132
139
|
direction,
|
|
133
140
|
startX: e.clientX,
|
|
@@ -137,7 +144,7 @@ class Block extends React.Component {
|
|
|
137
144
|
initL: parseFloat(style.left) || 0,
|
|
138
145
|
initT: parseFloat(style.top) || 0,
|
|
139
146
|
// ratio = 原始宽/高
|
|
140
|
-
ratio: ratio ||
|
|
147
|
+
ratio: ratio || fallbackRatio,
|
|
141
148
|
baseStyle: style
|
|
142
149
|
}
|
|
143
150
|
|