gm-printer-label 3.1.0-beta.2 → 3.1.0-beta.3
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 +1 -1
- package/src/printer/block.js +17 -17
package/package.json
CHANGED
package/src/printer/block.js
CHANGED
|
@@ -9,12 +9,12 @@ import QrCode from './qrcode'
|
|
|
9
9
|
|
|
10
10
|
@observer
|
|
11
11
|
class Block extends React.Component {
|
|
12
|
-
constructor
|
|
12
|
+
constructor(props) {
|
|
13
13
|
super(props)
|
|
14
14
|
this.state = {
|
|
15
15
|
clientX: null,
|
|
16
16
|
clientY: null,
|
|
17
|
-
isEdit: false
|
|
17
|
+
isEdit: false,
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -23,14 +23,14 @@ class Block extends React.Component {
|
|
|
23
23
|
|
|
24
24
|
this.setState({
|
|
25
25
|
clientX,
|
|
26
|
-
clientY
|
|
26
|
+
clientY,
|
|
27
27
|
})
|
|
28
28
|
|
|
29
29
|
window.document.dispatchEvent(
|
|
30
30
|
new window.CustomEvent('gm-printer-label-select', {
|
|
31
31
|
detail: {
|
|
32
|
-
selected: index
|
|
33
|
-
}
|
|
32
|
+
selected: index,
|
|
33
|
+
},
|
|
34
34
|
})
|
|
35
35
|
)
|
|
36
36
|
}
|
|
@@ -43,7 +43,7 @@ class Block extends React.Component {
|
|
|
43
43
|
const style = getStyleWithDiff(config.style, diffX, diffY)
|
|
44
44
|
|
|
45
45
|
dispatchMsg('gm-printer-label-block-style-set', {
|
|
46
|
-
style
|
|
46
|
+
style,
|
|
47
47
|
})
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -51,18 +51,18 @@ class Block extends React.Component {
|
|
|
51
51
|
const { index } = this.props
|
|
52
52
|
|
|
53
53
|
dispatchMsg('gm-printer-label-select', {
|
|
54
|
-
selected: index
|
|
54
|
+
selected: index,
|
|
55
55
|
})
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
handleDoubleClick = () => {
|
|
59
59
|
const {
|
|
60
|
-
config: { type }
|
|
60
|
+
config: { type },
|
|
61
61
|
} = this.props
|
|
62
62
|
if (!type || type === 'text') {
|
|
63
63
|
this.setState(
|
|
64
64
|
{
|
|
65
|
-
isEdit: true
|
|
65
|
+
isEdit: true,
|
|
66
66
|
},
|
|
67
67
|
() => {
|
|
68
68
|
this.refEdit.focus()
|
|
@@ -73,17 +73,17 @@ class Block extends React.Component {
|
|
|
73
73
|
|
|
74
74
|
handleEditBlur = () => {
|
|
75
75
|
this.setState({
|
|
76
|
-
isEdit: false
|
|
76
|
+
isEdit: false,
|
|
77
77
|
})
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
handleText = (e) => {
|
|
81
81
|
dispatchMsg('gm-printer-label-block-text-set', {
|
|
82
|
-
text: e.target.value
|
|
82
|
+
text: e.target.value,
|
|
83
83
|
})
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
render
|
|
86
|
+
render() {
|
|
87
87
|
const {
|
|
88
88
|
index,
|
|
89
89
|
selected,
|
|
@@ -101,7 +101,7 @@ class Block extends React.Component {
|
|
|
101
101
|
fieldType,
|
|
102
102
|
fieldKey,
|
|
103
103
|
production_barcode,
|
|
104
|
-
merchandise_trace_qrcode
|
|
104
|
+
merchandise_trace_qrcode,
|
|
105
105
|
},
|
|
106
106
|
data,
|
|
107
107
|
className,
|
|
@@ -309,7 +309,7 @@ class Block extends React.Component {
|
|
|
309
309
|
)
|
|
310
310
|
} else if (type === 'diyqrcode') {
|
|
311
311
|
content = isStation ? (
|
|
312
|
-
<QrCode value={template(text, data)} size={parseInt(style.height)}/>
|
|
312
|
+
<QrCode value={template(text, data)} size={parseInt(style.height)} />
|
|
313
313
|
) : (
|
|
314
314
|
<div
|
|
315
315
|
data-diyqrcode={template(text, data)}
|
|
@@ -345,7 +345,7 @@ class Block extends React.Component {
|
|
|
345
345
|
`gm-printer-label-block-type-${type}`,
|
|
346
346
|
className,
|
|
347
347
|
{
|
|
348
|
-
active
|
|
348
|
+
active,
|
|
349
349
|
}
|
|
350
350
|
)}
|
|
351
351
|
draggable
|
|
@@ -356,7 +356,7 @@ class Block extends React.Component {
|
|
|
356
356
|
data-name={index}
|
|
357
357
|
>
|
|
358
358
|
{content.indexOf('div') != '-1' ? (
|
|
359
|
-
<div dangerouslySetInnerHTML={{ __html: content
|
|
359
|
+
<div dangerouslySetInnerHTML={{ __html: content?.split(':')?.(1) }} />
|
|
360
360
|
) : (
|
|
361
361
|
content
|
|
362
362
|
)}
|
|
@@ -379,7 +379,7 @@ Block.propTypes = {
|
|
|
379
379
|
config: PropTypes.object.isRequired,
|
|
380
380
|
data: PropTypes.object.isRequired,
|
|
381
381
|
selected: PropTypes.number,
|
|
382
|
-
isStation: PropTypes.bool
|
|
382
|
+
isStation: PropTypes.bool,
|
|
383
383
|
}
|
|
384
384
|
|
|
385
385
|
export default Block
|