gm-printer-label 3.3.5 → 3.3.6-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/lib/main.js +27 -0
- package/lib/package.json +96 -0
- package/package.json +10 -14
- package/.eslintcache +0 -1
- package/.eslintrc.js +0 -12
- package/.github/workflows/release.yml +0 -46
- package/.prettierrc.js +0 -5
- package/.stylelintrc +0 -3
- package/babel.config.js +0 -7
- package/i18n.config.js +0 -9
- package/locales/en.json +0 -42
- package/locales/index.js +0 -32
- package/locales/th.json +0 -42
- package/locales/zh-HK.json +0 -43
- package/locales/zh.json +0 -1
- package/postcss.config.js +0 -9
- package/src/common/config.js +0 -77
- package/src/common/editor_compoents/component.js +0 -481
- package/src/common/editor_compoents/config_text.js +0 -47
- package/src/common/editor_compoents/context_menu.js +0 -129
- package/src/common/editor_compoents/edit.js +0 -106
- package/src/common/editor_compoents/edit_add_filed.js +0 -54
- package/src/common/editor_compoents/edit_modify_filed.js +0 -199
- package/src/common/editor_compoents/edit_select.js +0 -212
- package/src/common/editor_compoents/edit_title.js +0 -110
- package/src/common/editor_compoents/index.js +0 -10
- package/src/common/editor_compoents/store.js +0 -381
- package/src/common/editor_compoents/style.less +0 -425
- package/src/common/editor_compoents/with_shadow_dom_hoc.js +0 -30
- package/src/common/editor_compoents/with_store_hoc.js +0 -92
- package/src/components/css/animation.less +0 -95
- package/src/components/css/button.less +0 -49
- package/src/components/css/distance.less +0 -324
- package/src/components/css/text.less +0 -74
- package/src/components/css/variables.less +0 -12
- package/src/components/dialog/index.js +0 -72
- package/src/components/dialog/style.less +0 -64
- package/src/components/dropdown/drop_down.js +0 -67
- package/src/components/dropdown/drop_down_item.js +0 -37
- package/src/components/dropdown/drop_down_items.js +0 -22
- package/src/components/dropdown/index.js +0 -9
- package/src/components/dropdown/style.less +0 -51
- package/src/components/flex/index.js +0 -103
- package/src/components/flex/style.less +0 -101
- package/src/components/index.js +0 -15
- package/src/components/index.less +0 -10
- package/src/components/input_number/index.js +0 -158
- package/src/components/input_number/style.less +0 -10
- package/src/components/select/index.js +0 -7
- package/src/components/select/option.js +0 -32
- package/src/components/select/select.js +0 -122
- package/src/components/select/style.less +0 -79
- package/src/components/tip/index.js +0 -48
- package/src/components/tip/style.less +0 -22
- package/src/editor_label/edit_store.js +0 -3
- package/src/editor_label/editor.js +0 -5
- package/src/editor_label/editor_with_shadow_dom.js +0 -4
- package/src/editor_label/index.js +0 -1
- package/src/editor_presorting/edit_store.js +0 -3
- package/src/editor_presorting/editor_with_shadow_dom.js +0 -6
- package/src/editor_presorting/index.js +0 -1
- package/src/index.js +0 -7
- package/src/printer/barcode.js +0 -38
- package/src/printer/batch_printer.js +0 -43
- package/src/printer/block.js +0 -544
- package/src/printer/components/table_type.js +0 -46
- package/src/printer/index.js +0 -111
- package/src/printer/normalize.css +0 -341
- package/src/printer/page.js +0 -26
- package/src/printer/printer.js +0 -71
- package/src/printer/qrcode.js +0 -17
- package/src/printer/style.less +0 -28
- package/src/util.js +0 -87
- package/webpack.config.js +0 -53
|
@@ -1,425 +0,0 @@
|
|
|
1
|
-
// 层级
|
|
2
|
-
@title: 20;
|
|
3
|
-
@header: 20;
|
|
4
|
-
@mask: 1040;
|
|
5
|
-
@modal: 1050;
|
|
6
|
-
@contextMenu: 80;
|
|
7
|
-
|
|
8
|
-
@import "../../components/index.less";
|
|
9
|
-
|
|
10
|
-
* {
|
|
11
|
-
box-sizing: border-box;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
:focus {
|
|
15
|
-
outline: none;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.gm-printer-label-edit {
|
|
19
|
-
// 因为 shadow dom 没有 html body,估把些css迁移过来
|
|
20
|
-
line-height: 1.5;
|
|
21
|
-
-webkit-text-size-adjust: 100%;
|
|
22
|
-
font-size: 12px;
|
|
23
|
-
background: whitesmoke;
|
|
24
|
-
color: #333;
|
|
25
|
-
font-family: "Segoe UI", "Lucida Grande", Helvetica, Arial, "Microsoft YaHei", FreeSans, Arimo, "Droid Sans", "wenquanyi micro hei", "Hiragino Sans GB", "Hiragino Sans GB W3", FontAwesome, sans-serif;
|
|
26
|
-
-webkit-font-smoothing: antialiased;
|
|
27
|
-
margin: 0;
|
|
28
|
-
|
|
29
|
-
min-height: 100vh;
|
|
30
|
-
|
|
31
|
-
.gm-printer-label-edit-title {
|
|
32
|
-
font-size: 14px;
|
|
33
|
-
|
|
34
|
-
&::before {
|
|
35
|
-
content: ' ';
|
|
36
|
-
height: 13px;
|
|
37
|
-
width: 3px;
|
|
38
|
-
margin: 3px 5px 3px 0;
|
|
39
|
-
background: #56a3f2;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.gm-printer-label-edit-title-fixed {
|
|
44
|
-
position: fixed;
|
|
45
|
-
top: 0;
|
|
46
|
-
width: 100%;
|
|
47
|
-
padding: 10px 20px;
|
|
48
|
-
z-index: @title;
|
|
49
|
-
background-color: #fff;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.gm-printer-label-edit-header {
|
|
53
|
-
&::-webkit-scrollbar { display: none; }
|
|
54
|
-
|
|
55
|
-
position: fixed;
|
|
56
|
-
top: 0;
|
|
57
|
-
right: 0;
|
|
58
|
-
bottom: 0;
|
|
59
|
-
width: 330px;
|
|
60
|
-
padding: 10px 20px;
|
|
61
|
-
z-index: @header;
|
|
62
|
-
overflow-y: auto;
|
|
63
|
-
background: white;
|
|
64
|
-
box-shadow: -2px 0 3px 0 hsla(0, 0%, 39%, 0.1);
|
|
65
|
-
|
|
66
|
-
span.gm-printer-label-edit-btn {
|
|
67
|
-
cursor: pointer;
|
|
68
|
-
padding: 0 5px;
|
|
69
|
-
border: 1px solid transparent;
|
|
70
|
-
|
|
71
|
-
&:hover {
|
|
72
|
-
border: 1px solid rgba(51, 51, 51, 0.1);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
&.active {
|
|
76
|
-
border: 1px solid rgba(51, 51, 51, 0.1);
|
|
77
|
-
background: rgba(51, 51, 51, 0.1);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
select {
|
|
82
|
-
outline: none;
|
|
83
|
-
border: none;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
input {
|
|
87
|
-
outline: none;
|
|
88
|
-
border-top: none;
|
|
89
|
-
border-left: none;
|
|
90
|
-
border-right: none;
|
|
91
|
-
border-bottom: 1px solid black;
|
|
92
|
-
background: transparent;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.gm-printer-label-edit-input-custom {
|
|
96
|
-
width: 190px;
|
|
97
|
-
height: 28px;
|
|
98
|
-
padding: 5px 10px;
|
|
99
|
-
font-size: 12px;
|
|
100
|
-
line-height: 1.5;
|
|
101
|
-
border: 1px solid #eee;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.gm-printer-label-edit-plus-btn {
|
|
105
|
-
color: #fff;
|
|
106
|
-
background-color: #56a3f2;
|
|
107
|
-
border-color: #3e96f0;
|
|
108
|
-
border-radius: 4px;
|
|
109
|
-
width: 14px;
|
|
110
|
-
height: 14px;
|
|
111
|
-
line-height: 14px;
|
|
112
|
-
font-size: 12px;
|
|
113
|
-
display: inline-block;
|
|
114
|
-
text-align: center;
|
|
115
|
-
cursor: pointer;
|
|
116
|
-
white-space: nowrap;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.gm-printer-label-edit-content {
|
|
121
|
-
position: relative;
|
|
122
|
-
padding: 100px 300px 0 20px;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.gm-pinter-label-eidt-wrap {
|
|
126
|
-
display: flex;
|
|
127
|
-
// justify-content: center;
|
|
128
|
-
position: relative;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.gm-printer-label-contextmenu {
|
|
132
|
-
z-index: @contextMenu;
|
|
133
|
-
padding: 5px 0;
|
|
134
|
-
width: auto;
|
|
135
|
-
min-width: 100px;
|
|
136
|
-
background: white;
|
|
137
|
-
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
|
|
138
|
-
> div {
|
|
139
|
-
padding: 5px;
|
|
140
|
-
cursor: pointer;
|
|
141
|
-
|
|
142
|
-
&.active {
|
|
143
|
-
color: #56a3f2;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
&:hover {
|
|
147
|
-
color: white;
|
|
148
|
-
background: rgb(82, 146, 247);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.gm-printer-label-edit-tip {
|
|
154
|
-
padding: 10px;
|
|
155
|
-
text-align: center;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// 覆盖 printer
|
|
159
|
-
.gm-printer-label {
|
|
160
|
-
margin: 0px auto;
|
|
161
|
-
|
|
162
|
-
.gm-printer-label-page {
|
|
163
|
-
overflow: visible;
|
|
164
|
-
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
|
|
165
|
-
background-image: linear-gradient(whitesmoke 1px, transparent 0), linear-gradient(90deg, whitesmoke 1px, transparent 0);
|
|
166
|
-
background-size: 5px 5px, 5px 5px;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
.gm-printer-label-block {
|
|
170
|
-
cursor: move;
|
|
171
|
-
|
|
172
|
-
&:hover,
|
|
173
|
-
&.active {
|
|
174
|
-
outline: 1px solid rgb(82, 146, 247);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
&.gm-printer-label-block-type-qrcode {
|
|
178
|
-
div[data-qrcode] {
|
|
179
|
-
outline: 1px solid red;
|
|
180
|
-
|
|
181
|
-
&::before {
|
|
182
|
-
content: attr(data-placeholder);
|
|
183
|
-
position: absolute;
|
|
184
|
-
font-style: italic;
|
|
185
|
-
left: calc(50% - 1.5em);
|
|
186
|
-
top: calc(50% - 0.5em);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
&.gm-printer-label-block-type-order_qrcode {
|
|
192
|
-
div[data-orderQrcode] {
|
|
193
|
-
outline: 1px solid red;
|
|
194
|
-
|
|
195
|
-
&::before {
|
|
196
|
-
content: attr(data-placeholder);
|
|
197
|
-
position: absolute;
|
|
198
|
-
font-style: italic;
|
|
199
|
-
left: calc(50% - 1.5em);
|
|
200
|
-
top: calc(50% - 0.5em);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
&.gm-printer-label-block-type-diyqrcode {
|
|
208
|
-
div[data-diyqrcode] {
|
|
209
|
-
outline: 1px solid red;
|
|
210
|
-
|
|
211
|
-
&::before {
|
|
212
|
-
content: attr(data-placeholder);
|
|
213
|
-
position: absolute;
|
|
214
|
-
font-style: italic;
|
|
215
|
-
left: calc(50% - 1.5em);
|
|
216
|
-
top: calc(50% - 0.5em);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
&.gm-printer-label-block-type-delivery_qrcode {
|
|
222
|
-
div[data-deliveryqrcode] {
|
|
223
|
-
outline: 1px solid red;
|
|
224
|
-
|
|
225
|
-
&::before {
|
|
226
|
-
content: attr(data-placeholder);
|
|
227
|
-
position: absolute;
|
|
228
|
-
font-style: italic;
|
|
229
|
-
left: calc(50% - 1.5em);
|
|
230
|
-
top: calc(50% - 0.5em);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
&.gm-printer-label-block-type-package_id_qrcode {
|
|
236
|
-
div[data-packageQrcode] {
|
|
237
|
-
outline: 1px solid red;
|
|
238
|
-
|
|
239
|
-
&::before {
|
|
240
|
-
content: attr(data-placeholder);
|
|
241
|
-
position: absolute;
|
|
242
|
-
font-style: italic;
|
|
243
|
-
left: calc(50% - 1.5em);
|
|
244
|
-
top: calc(50% - 0.5em);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
&.gm-printer-label-block-type-package_order_qrcode {
|
|
249
|
-
div[data-packageorderqrcode] {
|
|
250
|
-
outline: 1px solid red;
|
|
251
|
-
|
|
252
|
-
&::before {
|
|
253
|
-
content: attr(data-placeholder);
|
|
254
|
-
position: absolute;
|
|
255
|
-
font-style: italic;
|
|
256
|
-
left: calc(50% - 1.5em);
|
|
257
|
-
top: calc(50% - 0.5em);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
&.gm-printer-label-block-type-verification_qrcode {
|
|
263
|
-
div[data-verificationqrcode] {
|
|
264
|
-
outline: 1px solid red;
|
|
265
|
-
|
|
266
|
-
&::before {
|
|
267
|
-
content: attr(data-placeholder);
|
|
268
|
-
position: absolute;
|
|
269
|
-
font-style: italic;
|
|
270
|
-
left: calc(50% - 1.5em);
|
|
271
|
-
top: calc(50% - 0.5em);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
div[data-packagecode] {
|
|
277
|
-
outline: 1px solid red;
|
|
278
|
-
|
|
279
|
-
&::before {
|
|
280
|
-
content: '条形码';
|
|
281
|
-
position: absolute;
|
|
282
|
-
font-style: italic;
|
|
283
|
-
left: calc(50% - 1.5em);
|
|
284
|
-
top: calc(50% - 0.5em);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
div[data-instockcode] {
|
|
289
|
-
outline: 1px solid red;
|
|
290
|
-
|
|
291
|
-
&::before {
|
|
292
|
-
content: '入库条码';
|
|
293
|
-
position: absolute;
|
|
294
|
-
font-style: italic;
|
|
295
|
-
left: calc(50% - 1.5em);
|
|
296
|
-
top: calc(50% - 0.5em);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
div[data-productionbarcode] {
|
|
301
|
-
outline: 1px solid red;
|
|
302
|
-
|
|
303
|
-
&::before {
|
|
304
|
-
content: attr(data-title);
|
|
305
|
-
position: absolute;
|
|
306
|
-
font-style: italic;
|
|
307
|
-
left: 0;
|
|
308
|
-
right: 0;
|
|
309
|
-
top: calc(50% - 0.5em);
|
|
310
|
-
bottom: 0;
|
|
311
|
-
text-align: center;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
div[data-newproductionbarcode] {
|
|
316
|
-
outline: 1px solid red;
|
|
317
|
-
|
|
318
|
-
&::before {
|
|
319
|
-
content: '商品条码';
|
|
320
|
-
position: absolute;
|
|
321
|
-
font-style: italic;
|
|
322
|
-
left: 0;
|
|
323
|
-
right: 0;
|
|
324
|
-
top: calc(50% - 0.5em);
|
|
325
|
-
bottom: 0;
|
|
326
|
-
text-align: center;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
div[data-traceqrcode] {
|
|
331
|
-
outline: 1px solid red;
|
|
332
|
-
|
|
333
|
-
&::before {
|
|
334
|
-
content: '商品溯源二维码';
|
|
335
|
-
position: absolute;
|
|
336
|
-
font-style: italic;
|
|
337
|
-
left: 0;
|
|
338
|
-
right: 0;
|
|
339
|
-
top: calc(50% - 0.5em);
|
|
340
|
-
bottom: 0;
|
|
341
|
-
text-align: center;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
div[data-diycode] {
|
|
346
|
-
outline: 1px solid red;
|
|
347
|
-
|
|
348
|
-
&::before {
|
|
349
|
-
content: '自定义编码条形码';
|
|
350
|
-
position: absolute;
|
|
351
|
-
font-style: italic;
|
|
352
|
-
left: calc(30% - 1.5em);
|
|
353
|
-
top: calc(50% - 0.5em);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
.gm-printer-label-block-text-edit {
|
|
358
|
-
display: inline-block;
|
|
359
|
-
position: absolute;
|
|
360
|
-
z-index: 99;
|
|
361
|
-
background: white;
|
|
362
|
-
top: calc(100% + 5px);
|
|
363
|
-
left: 0;
|
|
364
|
-
min-width: 100%;
|
|
365
|
-
font-size: initial;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
.gm-printer-resize-active {
|
|
369
|
-
cursor: col-resize !important;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
@media print {
|
|
375
|
-
* {
|
|
376
|
-
outline: none !important;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
html,
|
|
380
|
-
body {
|
|
381
|
-
background: white;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
.gm-printer-label-edit {
|
|
385
|
-
min-height: auto;
|
|
386
|
-
|
|
387
|
-
.gm-printer-label-edit-header {
|
|
388
|
-
display: none;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
.gm-printer-label-edit-content {
|
|
392
|
-
padding: 0;
|
|
393
|
-
|
|
394
|
-
.gm-printer-label-edit-help {
|
|
395
|
-
display: none;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
.gm-printer-label-edit-config-text {
|
|
399
|
-
display: none;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
.gm-pinter-label-eidt-wrap {
|
|
403
|
-
padding: 0;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
.gm-printer-label-contextmenu {
|
|
407
|
-
display: none;
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
.gm-printer-label-edit-title-fixed {
|
|
412
|
-
display: none;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
// 覆盖 printer
|
|
416
|
-
.gm-printer-label {
|
|
417
|
-
margin: 0;
|
|
418
|
-
|
|
419
|
-
.gm-printer-label-page {
|
|
420
|
-
overflow: hidden;
|
|
421
|
-
box-shadow: none;
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import ReactDOM from 'react-dom'
|
|
3
|
-
import { insertCSS } from '../../util'
|
|
4
|
-
import { getCSS as getPrinterCSS } from '../../printer'
|
|
5
|
-
import { getCSS as getEditorCSS } from './index'
|
|
6
|
-
|
|
7
|
-
const withShadowDom = WrapCom => {
|
|
8
|
-
return class extends React.Component {
|
|
9
|
-
ref = React.createRef()
|
|
10
|
-
|
|
11
|
-
componentDidMount () {
|
|
12
|
-
const shadowRoot = this.ref.current.attachShadow({ mode: 'open' })
|
|
13
|
-
// 在window下挂 shadow root
|
|
14
|
-
window.shadowRoot = shadowRoot
|
|
15
|
-
ReactDOM.render(<WrapCom {...this.props}/>, shadowRoot)
|
|
16
|
-
insertCSS(getPrinterCSS() + getEditorCSS(), shadowRoot)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
componentWillUnmount () {
|
|
20
|
-
// 移除示例,不然很多意想不到的事情发生
|
|
21
|
-
ReactDOM.unmountComponentAtNode(window.shadowRoot)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
render () {
|
|
25
|
-
return <div id='shadowroot' ref={this.ref}/>
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export default withShadowDom
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Provider } from 'mobx-react'
|
|
3
|
-
import { getStyleWithDiff } from '../../util'
|
|
4
|
-
|
|
5
|
-
const withStore = store => WrapComponent =>
|
|
6
|
-
class extends React.Component {
|
|
7
|
-
constructor (props) {
|
|
8
|
-
super(props)
|
|
9
|
-
|
|
10
|
-
this.editStore = store
|
|
11
|
-
this.editStore.init(props.config, props.initDefaultTemp)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
componentDidMount () {
|
|
15
|
-
window.document.addEventListener('gm-printer-label-select',
|
|
16
|
-
this.handlePrinterSelect)
|
|
17
|
-
window.document.addEventListener('gm-printer-label-block-style-set',
|
|
18
|
-
this.handlePrinterBlockStyleSet)
|
|
19
|
-
window.document.addEventListener('gm-printer-label-block-text-set',
|
|
20
|
-
this.handlePrinterBlockTextSet)
|
|
21
|
-
window.document.addEventListener('keydown', this.handleKeyDown)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
componentWillUnmount () {
|
|
25
|
-
window.document.removeEventListener('gm-printer-label-select',
|
|
26
|
-
this.handlePrinterSelect)
|
|
27
|
-
window.document.removeEventListener('gm-printer-label-block-style-set',
|
|
28
|
-
this.handlePrinterBlockStyleSet)
|
|
29
|
-
window.document.removeEventListener('gm-printer-label-block-text-set',
|
|
30
|
-
this.handlePrinterBlockTextSet)
|
|
31
|
-
window.document.removeEventListener('keydown', this.handleKeyDown)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
handlePrinterSelect = (e) => {
|
|
35
|
-
const { selected } = e.detail
|
|
36
|
-
this.editStore.setSelected(selected)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
handlePrinterBlockStyleSet = (e) => {
|
|
40
|
-
const { style } = e.detail
|
|
41
|
-
this.editStore.setConfigBlockBy('style', style)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
handlePrinterBlockTextSet = (e) => {
|
|
45
|
-
const { text } = e.detail
|
|
46
|
-
this.editStore.setConfigBlockBy('text', text)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
handleKeyDown = (e) => {
|
|
50
|
-
if (e.target !== window.document.body) {
|
|
51
|
-
return
|
|
52
|
-
}
|
|
53
|
-
const { editStore } = this
|
|
54
|
-
if (e.code.startsWith('Arrow') && editStore.selected !== null) {
|
|
55
|
-
e.preventDefault()
|
|
56
|
-
|
|
57
|
-
let diffX = 0
|
|
58
|
-
let diffY = 0
|
|
59
|
-
|
|
60
|
-
if (e.code === 'ArrowLeft') {
|
|
61
|
-
diffX -= 1
|
|
62
|
-
} else if (e.code === 'ArrowUp') {
|
|
63
|
-
diffY -= 1
|
|
64
|
-
} else if (e.code === 'ArrowRight') {
|
|
65
|
-
diffX += 1
|
|
66
|
-
} else if (e.code === 'ArrowDown') {
|
|
67
|
-
diffY += 1
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const newStyle = getStyleWithDiff(
|
|
71
|
-
editStore.config.blocks[editStore.selected].style, diffX, diffY)
|
|
72
|
-
|
|
73
|
-
editStore.setConfigBlockBy('style', newStyle)
|
|
74
|
-
} else if (e.code === 'Escape' && editStore.selected !== null) {
|
|
75
|
-
e.preventDefault()
|
|
76
|
-
editStore.setSelected(null)
|
|
77
|
-
} else if (e.code === 'Backspace' && editStore.selected !== null) {
|
|
78
|
-
e.preventDefault()
|
|
79
|
-
editStore.removeConfig()
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
render () {
|
|
84
|
-
return (
|
|
85
|
-
<Provider editStore={this.editStore}>
|
|
86
|
-
<WrapComponent {...this.props}/>
|
|
87
|
-
</Provider>
|
|
88
|
-
)
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export default withStore
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
.gm-animated {
|
|
2
|
-
animation-duration: 1s;
|
|
3
|
-
animation-fill-mode: both;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
// alpha left right top bottom
|
|
7
|
-
.gm-animated-fade-in-right {
|
|
8
|
-
animation-name: fade-in-right;
|
|
9
|
-
animation-duration: 0.3s;
|
|
10
|
-
animation-timing-function: ease-out;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.gm-animated-fade-in-right-100 {
|
|
14
|
-
animation-name: fade-in-right-100;
|
|
15
|
-
animation-duration: 0.3s;
|
|
16
|
-
animation-timing-function: ease-out;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.gm-animated-fade-in-left {
|
|
20
|
-
animation-name: fade-in-left;
|
|
21
|
-
animation-duration: 0.3s;
|
|
22
|
-
animation-timing-function: ease-out;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.gm-animated-fade-in-top {
|
|
26
|
-
animation-name: fade-in-top;
|
|
27
|
-
animation-duration: 0.3s;
|
|
28
|
-
animation-timing-function: ease-out;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.gm-animated-fade-in-bottom {
|
|
32
|
-
animation-name: fade-in-bottom;
|
|
33
|
-
animation-duration: 0.3s;
|
|
34
|
-
animation-timing-function: ease-out;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@-webkit-keyframes fade-in-right {
|
|
38
|
-
from {
|
|
39
|
-
opacity: 0;
|
|
40
|
-
transform: translate3d(20px, 0, 0);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
to {
|
|
44
|
-
opacity: 1;
|
|
45
|
-
transform: none;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@-webkit-keyframes fade-in-right-100 {
|
|
50
|
-
from {
|
|
51
|
-
opacity: 0;
|
|
52
|
-
transform: translate3d(100%, 0, 0);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
to {
|
|
56
|
-
opacity: 1;
|
|
57
|
-
transform: none;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
@-webkit-keyframes fade-in-left {
|
|
62
|
-
from {
|
|
63
|
-
opacity: 0;
|
|
64
|
-
transform: translate3d(-20px, 0, 0);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
to {
|
|
68
|
-
opacity: 1;
|
|
69
|
-
transform: none;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
@-webkit-keyframes fade-in-top {
|
|
74
|
-
from {
|
|
75
|
-
opacity: 0;
|
|
76
|
-
transform: translate3d(0, -20px, 0);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
to {
|
|
80
|
-
opacity: 1;
|
|
81
|
-
transform: none;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
@-webkit-keyframes fade-in-bottom {
|
|
86
|
-
from {
|
|
87
|
-
opacity: 0;
|
|
88
|
-
transform: translate3d(0, 20px, 0);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
to {
|
|
92
|
-
opacity: 1;
|
|
93
|
-
transform: none;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
.btn {
|
|
2
|
-
display: inline-block;
|
|
3
|
-
margin-bottom: 0;
|
|
4
|
-
font-weight: normal;
|
|
5
|
-
text-align: center;
|
|
6
|
-
vertical-align: middle;
|
|
7
|
-
touch-action: manipulation;
|
|
8
|
-
cursor: pointer;
|
|
9
|
-
background-image: none;
|
|
10
|
-
border: 1px solid transparent;
|
|
11
|
-
white-space: nowrap;
|
|
12
|
-
padding: 5px 10px;
|
|
13
|
-
font-size: 12px;
|
|
14
|
-
line-height: 1.5;
|
|
15
|
-
border-radius: 0;
|
|
16
|
-
-webkit-user-select: none;
|
|
17
|
-
user-select: none;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.btn-sm {
|
|
21
|
-
padding: 5px 10px;
|
|
22
|
-
font-size: 11px;
|
|
23
|
-
line-height: 1.5;
|
|
24
|
-
border-radius: 0;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.btn-default {
|
|
28
|
-
color: #333;
|
|
29
|
-
background-color: #fff;
|
|
30
|
-
border-color: #eee;
|
|
31
|
-
|
|
32
|
-
&:hover {
|
|
33
|
-
color: #333;
|
|
34
|
-
background-color: #e6e6e6;
|
|
35
|
-
border-color: #cfcfcf;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.btn-primary {
|
|
40
|
-
color: #fff;
|
|
41
|
-
background-color: #56a3f2;
|
|
42
|
-
border-color: #3e96f0;
|
|
43
|
-
|
|
44
|
-
&:hover {
|
|
45
|
-
color: #fff;
|
|
46
|
-
background-color: #2789ee;
|
|
47
|
-
border-color: #1177e0;
|
|
48
|
-
}
|
|
49
|
-
}
|