gm-printer-label 3.1.0-beta.6 → 3.1.0-beta.7

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-label",
3
- "version": "3.1.0-beta.6",
3
+ "version": "3.1.0-beta.7",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -10,12 +10,12 @@ import _ from 'lodash'
10
10
 
11
11
  @observer
12
12
  class Block extends React.Component {
13
- constructor (props) {
13
+ constructor(props) {
14
14
  super(props)
15
15
  this.state = {
16
16
  clientX: null,
17
17
  clientY: null,
18
- isEdit: false
18
+ isEdit: false,
19
19
  }
20
20
  }
21
21
 
@@ -24,14 +24,14 @@ class Block extends React.Component {
24
24
 
25
25
  this.setState({
26
26
  clientX,
27
- clientY
27
+ clientY,
28
28
  })
29
29
 
30
30
  window.document.dispatchEvent(
31
31
  new window.CustomEvent('gm-printer-label-select', {
32
32
  detail: {
33
- selected: index
34
- }
33
+ selected: index,
34
+ },
35
35
  })
36
36
  )
37
37
  }
@@ -44,7 +44,7 @@ class Block extends React.Component {
44
44
  const style = getStyleWithDiff(config.style, diffX, diffY)
45
45
 
46
46
  dispatchMsg('gm-printer-label-block-style-set', {
47
- style
47
+ style,
48
48
  })
49
49
  }
50
50
 
@@ -52,18 +52,18 @@ class Block extends React.Component {
52
52
  const { index } = this.props
53
53
 
54
54
  dispatchMsg('gm-printer-label-select', {
55
- selected: index
55
+ selected: index,
56
56
  })
57
57
  }
58
58
 
59
59
  handleDoubleClick = () => {
60
60
  const {
61
- config: { type }
61
+ config: { type },
62
62
  } = this.props
63
63
  if (!type || type === 'text') {
64
64
  this.setState(
65
65
  {
66
- isEdit: true
66
+ isEdit: true,
67
67
  },
68
68
  () => {
69
69
  this.refEdit.focus()
@@ -74,17 +74,17 @@ class Block extends React.Component {
74
74
 
75
75
  handleEditBlur = () => {
76
76
  this.setState({
77
- isEdit: false
77
+ isEdit: false,
78
78
  })
79
79
  }
80
80
 
81
81
  handleText = (e) => {
82
82
  dispatchMsg('gm-printer-label-block-text-set', {
83
- text: e.target.value
83
+ text: e.target.value,
84
84
  })
85
85
  }
86
86
 
87
- render () {
87
+ render() {
88
88
  const {
89
89
  index,
90
90
  selected,
@@ -102,7 +102,7 @@ class Block extends React.Component {
102
102
  fieldType,
103
103
  fieldKey,
104
104
  production_barcode,
105
- merchandise_trace_qrcode
105
+ merchandise_trace_qrcode,
106
106
  },
107
107
  data,
108
108
  className,
@@ -125,9 +125,9 @@ class Block extends React.Component {
125
125
  } else {
126
126
  /** html */
127
127
  const value = text.split(':')?.[1]
128
- const isHtml = value.indexOf('_html') !== -1
128
+ const isHtml = value && value.indexOf('_html') !== -1
129
129
  content = isHtml ? (
130
- <div dangerouslySetInnerHTML={{ __html: template(value, data) }}/>
130
+ <div dangerouslySetInnerHTML={{ __html: template(value, data) }} />
131
131
  ) : (
132
132
  template(text, data)
133
133
  )
@@ -318,7 +318,7 @@ class Block extends React.Component {
318
318
  )
319
319
  } else if (type === 'diyqrcode') {
320
320
  content = isStation ? (
321
- <QrCode value={template(text, data)} size={parseInt(style.height)}/>
321
+ <QrCode value={template(text, data)} size={parseInt(style.height)} />
322
322
  ) : (
323
323
  <div
324
324
  data-diyqrcode={template(text, data)}
@@ -351,7 +351,7 @@ class Block extends React.Component {
351
351
  `gm-printer-label-block-type-${type}`,
352
352
  className,
353
353
  {
354
- active
354
+ active,
355
355
  }
356
356
  )}
357
357
  draggable
@@ -381,7 +381,7 @@ Block.propTypes = {
381
381
  config: PropTypes.object.isRequired,
382
382
  data: PropTypes.object.isRequired,
383
383
  selected: PropTypes.number,
384
- isStation: PropTypes.bool
384
+ isStation: PropTypes.bool,
385
385
  }
386
386
 
387
387
  export default Block