gm-printer-label 3.3.6-beta.0 → 3.3.6-beta.1

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.
Files changed (73) hide show
  1. package/.eslintrc.js +12 -0
  2. package/.github/workflows/release.yml +46 -0
  3. package/.prettierrc.js +5 -0
  4. package/.stylelintrc +3 -0
  5. package/babel.config.js +7 -0
  6. package/i18n.config.js +9 -0
  7. package/locales/en.json +42 -0
  8. package/locales/index.js +32 -0
  9. package/locales/th.json +42 -0
  10. package/locales/zh-HK.json +43 -0
  11. package/locales/zh.json +1 -0
  12. package/package.json +15 -11
  13. package/postcss.config.js +9 -0
  14. package/src/common/config.js +77 -0
  15. package/src/common/editor_compoents/component.js +481 -0
  16. package/src/common/editor_compoents/config_text.js +47 -0
  17. package/src/common/editor_compoents/context_menu.js +129 -0
  18. package/src/common/editor_compoents/edit.js +106 -0
  19. package/src/common/editor_compoents/edit_add_filed.js +54 -0
  20. package/src/common/editor_compoents/edit_modify_filed.js +199 -0
  21. package/src/common/editor_compoents/edit_select.js +212 -0
  22. package/src/common/editor_compoents/edit_title.js +110 -0
  23. package/src/common/editor_compoents/index.js +10 -0
  24. package/src/common/editor_compoents/store.js +381 -0
  25. package/src/common/editor_compoents/style.less +425 -0
  26. package/src/common/editor_compoents/with_shadow_dom_hoc.js +30 -0
  27. package/src/common/editor_compoents/with_store_hoc.js +92 -0
  28. package/src/components/css/animation.less +95 -0
  29. package/src/components/css/button.less +49 -0
  30. package/src/components/css/distance.less +324 -0
  31. package/src/components/css/text.less +74 -0
  32. package/src/components/css/variables.less +12 -0
  33. package/src/components/dialog/index.js +72 -0
  34. package/src/components/dialog/style.less +64 -0
  35. package/src/components/dropdown/drop_down.js +67 -0
  36. package/src/components/dropdown/drop_down_item.js +37 -0
  37. package/src/components/dropdown/drop_down_items.js +22 -0
  38. package/src/components/dropdown/index.js +9 -0
  39. package/src/components/dropdown/style.less +51 -0
  40. package/src/components/flex/index.js +103 -0
  41. package/src/components/flex/style.less +101 -0
  42. package/src/components/index.js +15 -0
  43. package/src/components/index.less +10 -0
  44. package/src/components/input_number/index.js +158 -0
  45. package/src/components/input_number/style.less +10 -0
  46. package/src/components/select/index.js +7 -0
  47. package/src/components/select/option.js +32 -0
  48. package/src/components/select/select.js +122 -0
  49. package/src/components/select/style.less +79 -0
  50. package/src/components/tip/index.js +48 -0
  51. package/src/components/tip/style.less +22 -0
  52. package/src/editor_label/edit_store.js +3 -0
  53. package/src/editor_label/editor.js +5 -0
  54. package/src/editor_label/editor_with_shadow_dom.js +4 -0
  55. package/src/editor_label/index.js +1 -0
  56. package/src/editor_presorting/edit_store.js +3 -0
  57. package/src/editor_presorting/editor_with_shadow_dom.js +6 -0
  58. package/src/editor_presorting/index.js +1 -0
  59. package/src/index.js +7 -0
  60. package/src/printer/barcode.js +38 -0
  61. package/src/printer/batch_printer.js +43 -0
  62. package/src/printer/block.js +544 -0
  63. package/src/printer/components/table_type.js +46 -0
  64. package/src/printer/index.js +111 -0
  65. package/src/printer/normalize.css +341 -0
  66. package/src/printer/page.js +26 -0
  67. package/src/printer/printer.js +71 -0
  68. package/src/printer/qrcode.js +17 -0
  69. package/src/printer/style.less +28 -0
  70. package/src/util.js +87 -0
  71. package/webpack.config.js +53 -0
  72. package/lib/main.js +0 -27
  73. package/lib/package.json +0 -96
@@ -0,0 +1,324 @@
1
+ // gap
2
+ .gm-gap-5 {
3
+ display: inline-block !important;
4
+ height: 5px !important;
5
+ width: 5px !important;
6
+ }
7
+
8
+ .gm-gap-10 {
9
+ display: inline-block !important;
10
+ height: 10px !important;
11
+ width: 10px !important;
12
+ }
13
+
14
+ .gm-gap-15 {
15
+ display: inline-block !important;
16
+ height: 15px !important;
17
+ width: 15px !important;
18
+ }
19
+
20
+ .gm-gap-20 {
21
+ display: inline-block !important;
22
+ height: 20px !important;
23
+ width: 20px !important;
24
+ }
25
+
26
+ .gm-padding-0 {
27
+ padding: 0 !important;
28
+ }
29
+
30
+ .gm-padding-5 {
31
+ padding: 5px !important;
32
+ }
33
+
34
+ .gm-padding-10 {
35
+ padding: 10px !important;
36
+ }
37
+
38
+ .gm-padding-15 {
39
+ padding: 15px !important;
40
+ }
41
+
42
+ .gm-padding-20 {
43
+ padding: 20px !important;
44
+ }
45
+
46
+ .gm-padding-top-0 {
47
+ padding-top: 0 !important;
48
+ }
49
+
50
+ .gm-padding-top-5 {
51
+ padding-top: 5px !important;
52
+ }
53
+
54
+ .gm-padding-top-10 {
55
+ padding-top: 10px !important;
56
+ }
57
+
58
+ .gm-padding-top-15 {
59
+ padding-top: 15px !important;
60
+ }
61
+
62
+ .gm-padding-top-20 {
63
+ padding-top: 20px !important;
64
+ }
65
+
66
+ .gm-padding-bottom-0 {
67
+ padding-bottom: 0 !important;
68
+ }
69
+
70
+ .gm-padding-bottom-5 {
71
+ padding-bottom: 5px !important;
72
+ }
73
+
74
+ .gm-padding-bottom-10 {
75
+ padding-bottom: 10px !important;
76
+ }
77
+
78
+ .gm-padding-bottom-15 {
79
+ padding-bottom: 15px !important;
80
+ }
81
+
82
+ .gm-padding-bottom-20 {
83
+ padding-bottom: 20px !important;
84
+ }
85
+
86
+ .gm-padding-left-0 {
87
+ padding-left: 0 !important;
88
+ }
89
+
90
+ .gm-padding-left-5 {
91
+ padding-left: 5px !important;
92
+ }
93
+
94
+ .gm-padding-left-10 {
95
+ padding-left: 10px !important;
96
+ }
97
+
98
+ .gm-padding-left-15 {
99
+ padding-left: 15px !important;
100
+ }
101
+
102
+ .gm-padding-left-20 {
103
+ padding-left: 20px !important;
104
+ }
105
+
106
+ .gm-padding-right-0 {
107
+ padding-right: 0 !important;
108
+ }
109
+
110
+ .gm-padding-right-5 {
111
+ padding-right: 5px !important;
112
+ }
113
+
114
+ .gm-padding-right-10 {
115
+ padding-right: 10px !important;
116
+ }
117
+
118
+ .gm-padding-right-15 {
119
+ padding-right: 15px !important;
120
+ }
121
+
122
+ .gm-padding-right-20 {
123
+ padding-right: 20px !important;
124
+ }
125
+
126
+ .gm-padding-lr-0 {
127
+ padding-left: 0 !important;
128
+ padding-right: 0 !important;
129
+ }
130
+
131
+ .gm-padding-lr-5 {
132
+ padding-left: 5px !important;
133
+ padding-right: 5px !important;
134
+ }
135
+
136
+ .gm-padding-lr-10 {
137
+ padding-left: 10px !important;
138
+ padding-right: 10px !important;
139
+ }
140
+
141
+ .gm-padding-lr-15 {
142
+ padding-left: 15px !important;
143
+ padding-right: 15px !important;
144
+ }
145
+
146
+ .gm-padding-lr-20 {
147
+ padding-left: 20px !important;
148
+ padding-right: 20px !important;
149
+ }
150
+
151
+ .gm-padding-tb-0 {
152
+ padding-top: 0 !important;
153
+ padding-bottom: 0 !important;
154
+ }
155
+
156
+ .gm-padding-tb-5 {
157
+ padding-top: 5px !important;
158
+ padding-bottom: 5px !important;
159
+ }
160
+
161
+ .gm-padding-tb-10 {
162
+ padding-top: 10px !important;
163
+ padding-bottom: 10px !important;
164
+ }
165
+
166
+ .gm-padding-tb-15 {
167
+ padding-top: 15px !important;
168
+ padding-bottom: 15px !important;
169
+ }
170
+
171
+ .gm-padding-tb-20 {
172
+ padding-top: 20px !important;
173
+ padding-bottom: 20px !important;
174
+ }
175
+
176
+ .gm-margin-0 {
177
+ margin: 0 !important;
178
+ }
179
+
180
+ .gm-margin-5 {
181
+ margin: 5px !important;
182
+ }
183
+
184
+ .gm-margin-10 {
185
+ margin: 10px !important;
186
+ }
187
+
188
+ .gm-margin-15 {
189
+ margin: 15px !important;
190
+ }
191
+
192
+ .gm-margin-20 {
193
+ margin: 20px !important;
194
+ }
195
+
196
+ .gm-margin-top-0 {
197
+ margin-top: 0 !important;
198
+ }
199
+
200
+ .gm-margin-top-5 {
201
+ margin-top: 5px !important;
202
+ }
203
+
204
+ .gm-margin-top-10 {
205
+ margin-top: 10px !important;
206
+ }
207
+
208
+ .gm-margin-top-15 {
209
+ margin-top: 15px !important;
210
+ }
211
+
212
+ .gm-margin-top-20 {
213
+ margin-top: 20px !important;
214
+ }
215
+
216
+ .gm-margin-bottom-0 {
217
+ margin-bottom: 0 !important;
218
+ }
219
+
220
+ .gm-margin-bottom-5 {
221
+ margin-bottom: 5px !important;
222
+ }
223
+
224
+ .gm-margin-bottom-10 {
225
+ margin-bottom: 10px !important;
226
+ }
227
+
228
+ .gm-margin-bottom-15 {
229
+ margin-bottom: 15px !important;
230
+ }
231
+
232
+ .gm-margin-bottom-20 {
233
+ margin-bottom: 20px !important;
234
+ }
235
+
236
+ .gm-margin-left-0 {
237
+ margin-left: 0 !important;
238
+ }
239
+
240
+ .gm-margin-left-5 {
241
+ margin-left: 5px !important;
242
+ }
243
+
244
+ .gm-margin-left-10 {
245
+ margin-left: 10px !important;
246
+ }
247
+
248
+ .gm-margin-left-15 {
249
+ margin-left: 15px !important;
250
+ }
251
+
252
+ .gm-margin-left-20 {
253
+ margin-left: 20px !important;
254
+ }
255
+
256
+ .gm-margin-right-0 {
257
+ margin-right: 0 !important;
258
+ }
259
+
260
+ .gm-margin-right-5 {
261
+ margin-right: 5px !important;
262
+ }
263
+
264
+ .gm-margin-right-10 {
265
+ margin-right: 10px !important;
266
+ }
267
+
268
+ .gm-margin-right-15 {
269
+ margin-right: 15px !important;
270
+ }
271
+
272
+ .gm-margin-right-20 {
273
+ margin-right: 20px !important;
274
+ }
275
+
276
+ .gm-margin-tb-0 {
277
+ margin-top: 0 !important;
278
+ margin-bottom: 0 !important;
279
+ }
280
+
281
+ .gm-margin-tb-5 {
282
+ margin-top: 5px !important;
283
+ margin-bottom: 5px !important;
284
+ }
285
+
286
+ .gm-margin-tb-10 {
287
+ margin-top: 10px !important;
288
+ margin-bottom: 10px !important;
289
+ }
290
+
291
+ .gm-margin-tb-15 {
292
+ margin-top: 15px !important;
293
+ margin-bottom: 15px !important;
294
+ }
295
+
296
+ .gm-margin-tb-20 {
297
+ margin-top: 20px !important;
298
+ margin-bottom: 20px !important;
299
+ }
300
+
301
+ .gm-margin-lr-0 {
302
+ margin-left: 0 !important;
303
+ margin-right: 0 !important;
304
+ }
305
+
306
+ .gm-margin-lr-5 {
307
+ margin-left: 5px !important;
308
+ margin-right: 5px !important;
309
+ }
310
+
311
+ .gm-margin-lr-10 {
312
+ margin-left: 10px !important;
313
+ margin-right: 10px !important;
314
+ }
315
+
316
+ .gm-margin-lr-15 {
317
+ margin-left: 15px !important;
318
+ margin-right: 15px !important;
319
+ }
320
+
321
+ .gm-margin-lr-20 {
322
+ margin-left: 20px !important;
323
+ margin-right: 20px !important;
324
+ }
@@ -0,0 +1,74 @@
1
+ .gm-text {
2
+ color: #fff;
3
+ }
4
+
5
+ .gm-text-red {
6
+ color: red !important;
7
+ }
8
+
9
+ .gm-text-desc {
10
+ color: @gm-color-second !important;
11
+ }
12
+
13
+ .gm-text-black {
14
+ color: black !important;
15
+ }
16
+
17
+ .gm-text-white {
18
+ color: white !important;
19
+ }
20
+
21
+ .gm-text-helper {
22
+ color: @gm-color-second !important;
23
+ font-size: 12px !important;
24
+ }
25
+
26
+ .gm-text-ellipsis {
27
+ overflow: hidden !important;
28
+ text-overflow: ellipsis !important;
29
+ white-space: nowrap;
30
+ }
31
+
32
+ .gm-text-no-ellipsis {
33
+ white-space: normal;
34
+ }
35
+
36
+ .gm-font-20 {
37
+ font-size: 20px !important;
38
+ }
39
+
40
+ .gm-font-18 {
41
+ font-size: 18px !important;
42
+ }
43
+
44
+ .gm-font-16 {
45
+ font-size: 16px !important;
46
+ }
47
+
48
+ .gm-font-14 {
49
+ font-size: 14px !important;
50
+ }
51
+
52
+ .gm-font-12 {
53
+ font-size: 12px !important;
54
+ }
55
+
56
+ .gm-line-height-1 {
57
+ line-height: 1;
58
+ }
59
+
60
+ .gm-placeholder-text {
61
+ &::placeholder {
62
+ color: @gm-color-first;
63
+ }
64
+ }
65
+
66
+ .gm-decoration-none {
67
+ &:hover {
68
+ text-decoration: none;
69
+ }
70
+
71
+ &:focus {
72
+ text-decoration: none;
73
+ }
74
+ }
@@ -0,0 +1,12 @@
1
+ // 私有
2
+ @gm-back-body-bg: #f5f5f5;
3
+
4
+ @gm-border-color: #eee;
5
+
6
+ // 规范颜色变量
7
+ @gm-color-first: #fff; //左侧导航、panel标题、页面正文文字
8
+ @gm-color-second: #848586; // lighten(#333, 40%);
9
+ @gm-color-third: #acadae; // lighten(#333, 60%);
10
+
11
+ @gm-color-white-first: #fff;
12
+ @gm-color-white-second: darken(@gm-color-white-first, 40%);
@@ -0,0 +1,72 @@
1
+ import React from 'react'
2
+ import ReactDOM from 'react-dom'
3
+ import i18next from '../../../locales'
4
+ import PropTypes from 'prop-types'
5
+
6
+ class Dialog extends React.Component {
7
+ handleCancel = () => {
8
+ this.props.onCancel()
9
+ Dialog.hide()
10
+ }
11
+
12
+ handleOK = () => {
13
+ this.props.onOK().then(() => {
14
+ Dialog.hide()
15
+ }, (err) => {
16
+ console.error(err)
17
+ })
18
+ }
19
+
20
+ render () {
21
+ const { children, title } = this.props
22
+
23
+ return (
24
+ <div>
25
+ <div className='gm-modal-mask'/>
26
+ <div className='gm-modal gm-animated gm-animated-fade-in-bottom gm-dialog gm-dialog-confirm'>
27
+ <div className='gm-modal-dialog'>
28
+ <button onClick={() => { Dialog.hide() }} type='button' className='close gm-modal-close'>
29
+ <span>×</span>
30
+ </button>
31
+ <div className='gm-modal-title-wrap'>
32
+ <div className='gm-modal-title'>
33
+ {title}
34
+ </div>
35
+ </div>
36
+ <div className='gm-modal-content'>
37
+ {children}
38
+ <div className='gm-gap-10'/>
39
+ <div className='text-right'>
40
+ <button onClick={this.handleCancel} className='btn btn-default'>{i18next.t('取消')}</button>
41
+ <div className='gm-gap-10'/>
42
+ <button onClick={this.handleOK} className='btn btn-primary'>{i18next.t('确定')}</button>
43
+ </div>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ )
49
+ }
50
+ }
51
+
52
+ Dialog.render = ({ title, children, onOK, onCancel }) => {
53
+ ReactDOM.render(<Dialog title={title} onOK={onOK} onCancel={onCancel}>{children}</Dialog>, window.shadowRoot.getElementById('gm-printer-label-modal'))
54
+ }
55
+
56
+ Dialog.hide = () => {
57
+ ReactDOM.unmountComponentAtNode(window.shadowRoot.getElementById('gm-printer-label-modal'))
58
+ }
59
+
60
+ Dialog.propTypes = {
61
+ children: PropTypes.element,
62
+ title: PropTypes.string,
63
+ onCancel: PropTypes.func,
64
+ onOK: PropTypes.func
65
+ }
66
+
67
+ Dialog.defaultProps = {
68
+ onCancel: () => {},
69
+ onOK: () => {}
70
+ }
71
+
72
+ export default Dialog
@@ -0,0 +1,64 @@
1
+ .gm-modal-mask {
2
+ position: fixed;
3
+ top: 0;
4
+ right: 0;
5
+ bottom: 0;
6
+ left: 0;
7
+ z-index: @mask;
8
+ background-color: rgba(0, 0, 0, 0.7);
9
+ }
10
+
11
+ .gm-modal {
12
+ overflow-x: hidden;
13
+ overflow-y: auto;
14
+ position: fixed;
15
+ top: 0;
16
+ right: 0;
17
+ bottom: 0;
18
+ left: 0;
19
+ z-index: @modal;
20
+ outline: 0;
21
+
22
+ .gm-modal-dialog {
23
+ position: relative;
24
+ background-color: #fff;
25
+ width: 300px;
26
+ margin: 200px auto 20px;
27
+
28
+ .gm-modal-title-wrap {
29
+ font-size: 16px;
30
+ padding: 10px 20px;
31
+ border-bottom: 1px solid #eee;
32
+ overflow: hidden;
33
+ white-space: nowrap;
34
+ text-overflow: ellipsis;
35
+
36
+ .gm-modal-title {
37
+ border-left: 3px solid #56a3f2;
38
+ height: 18px;
39
+ line-height: 18px;
40
+ padding-left: 5px;
41
+ }
42
+ }
43
+
44
+ .gm-modal-content {
45
+ padding: 10px;
46
+ }
47
+
48
+ .gm-modal-close {
49
+ font-size: 16px;
50
+ padding: 10px;
51
+ position: absolute;
52
+ top: 3px;
53
+ right: 5px;
54
+ cursor: pointer;
55
+ background: transparent;
56
+ border: 0;
57
+ -webkit-appearance: none;
58
+ }
59
+ }
60
+ }
61
+
62
+ .text-right {
63
+ text-align: right;
64
+ }
@@ -0,0 +1,67 @@
1
+ import React from 'react'
2
+ import PropTypes from 'prop-types'
3
+ import classNames from 'classnames'
4
+ import { findDOMNode } from 'react-dom'
5
+ import { contains } from 'gm-util'
6
+
7
+ class DropDown extends React.Component {
8
+ constructor (props) {
9
+ super(props)
10
+ this.state = {
11
+ show: false
12
+ }
13
+ }
14
+
15
+ componentDidMount () {
16
+ window.shadowRoot.addEventListener('click', this.handleBodyClick)
17
+ }
18
+
19
+ componentWillUnmount () {
20
+ window.shadowRoot.removeEventListener('click', this.handleBodyClick)
21
+ }
22
+
23
+ handleBodyClick = (e) => {
24
+ const target = e.target
25
+ const selectDOM = findDOMNode(this)
26
+ if (this.state.show && !contains(selectDOM, target)) {
27
+ this.setState({ show: false })
28
+ }
29
+ }
30
+
31
+ render () {
32
+ const {
33
+ children,
34
+ popup,
35
+ ...rest
36
+ } = this.props
37
+
38
+ const { show } = this.state
39
+ return (
40
+ <div
41
+ {...rest}
42
+ style={{ width: '30px' }}
43
+ className={classNames('gm-select', { 'gm-select-open': show })}
44
+ >
45
+ {children}
46
+ <button
47
+ type='button'
48
+ onClick={() => { this.setState({ show: !show }) }}
49
+ className={classNames('btn btn-default dropdown-toggle')}
50
+ >
51
+ <span className='caret'/>
52
+ </button>
53
+ <div key='list' className='gm-select-list gm-animated gm-animated-fade-in-right'>
54
+ {popup}
55
+ </div>
56
+ </div>
57
+ )
58
+ }
59
+ }
60
+
61
+ DropDown.propTypes = {
62
+ popup: PropTypes.element.isRequired,
63
+ children: PropTypes.any,
64
+ style: PropTypes.object
65
+ }
66
+
67
+ export default DropDown
@@ -0,0 +1,37 @@
1
+ import React from 'react'
2
+ import PropTypes from 'prop-types'
3
+ import classNames from 'classnames'
4
+
5
+ class DropDownItem extends React.Component {
6
+ handleClick = () => {
7
+ if (this.props.disabled) {
8
+ return
9
+ }
10
+ this.props.onClick()
11
+ }
12
+
13
+ render () {
14
+ const { children, active, className, disabled, ...rest } = this.props
15
+
16
+ return (
17
+ <li {...rest}
18
+ className={classNames(active, {
19
+ 'disabled': disabled
20
+ }, className)}
21
+ onClick={this.handleClick}>
22
+ <a>{children}</a>
23
+ </li>
24
+ )
25
+ }
26
+ }
27
+
28
+ DropDownItem.propTypes = {
29
+ active: PropTypes.bool,
30
+ disabled: PropTypes.bool,
31
+ onClick: PropTypes.func,
32
+ children: PropTypes.any,
33
+ className: PropTypes.string,
34
+ style: PropTypes.object
35
+ }
36
+
37
+ export default DropDownItem
@@ -0,0 +1,22 @@
1
+ import React from 'react'
2
+ import PropTypes from 'prop-types'
3
+ import classNames from 'classnames'
4
+
5
+ class DropDownItems extends React.Component {
6
+ render () {
7
+ const { children, ...rest } = this.props
8
+ return (
9
+ <ul
10
+ {...rest}
11
+ className={classNames('dropdown-menu')}
12
+ >{children}</ul>
13
+ )
14
+ }
15
+ }
16
+
17
+ DropDownItems.propTypes = {
18
+ children: PropTypes.any,
19
+ style: PropTypes.object
20
+ }
21
+
22
+ export default DropDownItems
@@ -0,0 +1,9 @@
1
+ import DropDownItems from './drop_down_items'
2
+ import DropDownItem from './drop_down_item'
3
+ import DropDown from './drop_down'
4
+
5
+ export {
6
+ DropDown,
7
+ DropDownItem,
8
+ DropDownItems
9
+ }