@10yun/cv-mobile-ui 0.4.11 → 0.5.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.
- package/package.json +1 -1
- package/plugins/MessageBox.js +2 -2
- package/plugins/MessageTip.js +4 -4
- package/plugins/request.js +54 -39
- package/plugins/storage.js +1 -4
- package/plugins/utils.js +13 -0
- package/ui-cv/cv-draw-barcode/barcode.js +225 -202
- package/ui-cv/cv-draw-barcode/barcodes/Barcode.js +14 -17
- package/ui-cv/cv-draw-barcode/barcodes/CODE128/CODE128.js +202 -164
- package/ui-cv/cv-draw-barcode/barcodes/CODE128/CODE128A.js +58 -35
- package/ui-cv/cv-draw-barcode/barcodes/CODE128/CODE128B.js +58 -36
- package/ui-cv/cv-draw-barcode/barcodes/CODE128/CODE128C.js +58 -34
- package/ui-cv/cv-draw-barcode/barcodes/CODE128/CODE128_AUTO.js +50 -41
- package/ui-cv/cv-draw-barcode/barcodes/CODE128/auto.js +43 -57
- package/ui-cv/cv-draw-barcode/barcodes/CODE128/constants.js +71 -30
- package/ui-cv/cv-draw-barcode/barcodes/CODE128/index.js +11 -29
- package/ui-cv/cv-draw-barcode/barcodes/CODE39/index.js +150 -77
- package/ui-cv/cv-draw-barcode/barcodes/EAN_UPC/EAN.js +122 -90
- package/ui-cv/cv-draw-barcode/barcodes/EAN_UPC/EAN13.js +169 -111
- package/ui-cv/cv-draw-barcode/barcodes/EAN_UPC/EAN2.js +77 -56
- package/ui-cv/cv-draw-barcode/barcodes/EAN_UPC/EAN5.js +84 -60
- package/ui-cv/cv-draw-barcode/barcodes/EAN_UPC/EAN8.js +133 -74
- package/ui-cv/cv-draw-barcode/barcodes/EAN_UPC/UPC.js +174 -156
- package/ui-cv/cv-draw-barcode/barcodes/EAN_UPC/UPCE.js +220 -174
- package/ui-cv/cv-draw-barcode/barcodes/EAN_UPC/constants.js +80 -21
- package/ui-cv/cv-draw-barcode/barcodes/EAN_UPC/encoder.js +18 -24
- package/ui-cv/cv-draw-barcode/barcodes/EAN_UPC/index.js +15 -39
- package/ui-cv/cv-draw-barcode/barcodes/GenericBarcode/index.js +80 -55
- package/ui-cv/cv-draw-barcode/barcodes/ITF/ITF.js +99 -69
- package/ui-cv/cv-draw-barcode/barcodes/ITF/ITF14.js +73 -45
- package/ui-cv/cv-draw-barcode/barcodes/ITF/constants.js +8 -8
- package/ui-cv/cv-draw-barcode/barcodes/ITF/index.js +6 -18
- package/ui-cv/cv-draw-barcode/barcodes/MSI/MSI.js +86 -66
- package/ui-cv/cv-draw-barcode/barcodes/MSI/MSI10.js +40 -33
- package/ui-cv/cv-draw-barcode/barcodes/MSI/MSI1010.js +41 -35
- package/ui-cv/cv-draw-barcode/barcodes/MSI/MSI11.js +42 -33
- package/ui-cv/cv-draw-barcode/barcodes/MSI/MSI1110.js +37 -35
- package/ui-cv/cv-draw-barcode/barcodes/MSI/checksums.js +22 -25
- package/ui-cv/cv-draw-barcode/barcodes/MSI/index.js +13 -34
- package/ui-cv/cv-draw-barcode/barcodes/codabar/index.js +120 -90
- package/ui-cv/cv-draw-barcode/barcodes/common.js +0 -0
- package/ui-cv/cv-draw-barcode/barcodes/index.js +32 -33
- package/ui-cv/cv-draw-barcode/barcodes/index.tmp.js +32 -33
- package/ui-cv/cv-draw-barcode/barcodes/pharmacode/index.js +93 -71
- package/ui-cv/cv-draw-barcode/cv-draw-barcode.vue +4 -4
- package/ui-cv/cv-icons/icons/default-icons.js +132 -0
- package/ui-cv/cv-icons/icons/icons-action.js +72 -0
- package/ui-cv/cv-icons/icons/icons-arrow.js +46 -0
- package/ui-cv/cv-icons/icons/icons-base.js +89 -0
- package/ui-cv/cv-icons/icons/icons-mall.js +34 -0
- package/ui-cv/cv-icons/icons/icons-media.js +44 -0
- package/ui-cv/cv-icons/icons/icons-order.js +33 -0
- package/ui-cv/cv-icons/icons/icons-people.js +46 -0
- package/ui-cv/cv-icons/icons/icons-status.js +32 -0
- package/ui-cv/cv-icons/icons/icons-wallet.js +15 -0
- package/ui-cv/cv-icons/icons.js +14 -13
- package/ui-cv/cv-lists-base/cv-lists-base.vue +0 -2
- package/ui-cv/cv-tab-lists/cv-tab-lists.vue +0 -2
- package/ui-uni/u-charts/u-charts.js +1093 -744
- package/ui-uni/uni-list/uni-refresh.wxs +1 -1
- package/ui-uni/uni-swipe-action-item/index.wxs +6 -6
|
@@ -1,185 +1,231 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import _constants from './constants.js';
|
|
2
|
+
import { BarcodeFunc } from '../Barcode.js';
|
|
3
|
+
import { encoderFunc } from './encoder.js';
|
|
4
|
+
import _UPC from './UPC.js';
|
|
5
|
+
|
|
6
|
+
var _createClass = (function () {
|
|
7
|
+
function defineProperties(target, props) {
|
|
8
|
+
for (var i = 0; i < props.length; i++) {
|
|
9
|
+
var descriptor = props[i];
|
|
10
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
11
|
+
descriptor.configurable = true;
|
|
12
|
+
if ('value' in descriptor) descriptor.writable = true;
|
|
13
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return function (Constructor, protoProps, staticProps) {
|
|
17
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
18
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
19
|
+
return Constructor;
|
|
20
|
+
};
|
|
21
|
+
})();
|
|
22
|
+
|
|
23
|
+
function _classCallCheck(instance, Constructor) {
|
|
24
|
+
if (!(instance instanceof Constructor)) {
|
|
25
|
+
throw new TypeError('Cannot call a class as a function');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
22
28
|
|
|
23
|
-
function _possibleConstructorReturn(self, call) {
|
|
29
|
+
function _possibleConstructorReturn(self, call) {
|
|
30
|
+
if (!self) {
|
|
31
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
32
|
+
}
|
|
33
|
+
return call && (typeof call === 'object' || typeof call === 'function') ? call : self;
|
|
34
|
+
}
|
|
24
35
|
|
|
25
|
-
function _inherits(subClass, superClass) {
|
|
36
|
+
function _inherits(subClass, superClass) {
|
|
37
|
+
if (typeof superClass !== 'function' && superClass !== null) {
|
|
38
|
+
throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass);
|
|
39
|
+
}
|
|
40
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
41
|
+
constructor: { value: subClass, enumerable: false, writable: true, configurable: true }
|
|
42
|
+
});
|
|
43
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : (subClass.__proto__ = superClass);
|
|
44
|
+
} // Encoding documentation:
|
|
26
45
|
// https://en.wikipedia.org/wiki/Universal_Product_Code#Encoding
|
|
27
46
|
//
|
|
28
47
|
// UPC-E documentation:
|
|
29
48
|
// https://en.wikipedia.org/wiki/Universal_Product_Code#UPC-E
|
|
30
49
|
|
|
31
|
-
var EXPANSIONS = [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
50
|
+
var EXPANSIONS = [
|
|
51
|
+
'XX00000XXX',
|
|
52
|
+
'XX10000XXX',
|
|
53
|
+
'XX20000XXX',
|
|
54
|
+
'XXX00000XX',
|
|
55
|
+
'XXXX00000X',
|
|
56
|
+
'XXXXX00005',
|
|
57
|
+
'XXXXX00006',
|
|
58
|
+
'XXXXX00007',
|
|
59
|
+
'XXXXX00008',
|
|
60
|
+
'XXXXX00009'
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
var PARITIES = [
|
|
64
|
+
['EEEOOO', 'OOOEEE'],
|
|
65
|
+
['EEOEOO', 'OOEOEE'],
|
|
66
|
+
['EEOOEO', 'OOEEOE'],
|
|
67
|
+
['EEOOOE', 'OOEEEO'],
|
|
68
|
+
['EOEEOO', 'OEOOEE'],
|
|
69
|
+
['EOOEEO', 'OEEOOE'],
|
|
70
|
+
['EOOOEE', 'OEEEOO'],
|
|
71
|
+
['EOEOEO', 'OEOEOE'],
|
|
72
|
+
['EOEOOE', 'OEOEEO'],
|
|
73
|
+
['EOOEOE', 'OEEOEO']
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
var UPCE = (function (_Barcode) {
|
|
77
|
+
_inherits(UPCE, _Barcode);
|
|
78
|
+
|
|
79
|
+
function UPCE(data, options) {
|
|
80
|
+
_classCallCheck(this, UPCE);
|
|
81
|
+
|
|
82
|
+
var _this = _possibleConstructorReturn(this, (UPCE.__proto__ || Object.getPrototypeOf(UPCE)).call(this, data, options));
|
|
83
|
+
// Code may be 6 or 8 digits;
|
|
84
|
+
// A 7 digit code is ambiguous as to whether the extra digit
|
|
85
|
+
// is a UPC-A check or number system digit.
|
|
86
|
+
|
|
87
|
+
_this.isValid = false;
|
|
88
|
+
if (data.search(/^[0-9]{6}$/) !== -1) {
|
|
89
|
+
_this.middleDigits = data;
|
|
90
|
+
_this.upcA = expandToUPCA(data, '0');
|
|
91
|
+
_this.text = options.text || '' + _this.upcA[0] + data + _this.upcA[_this.upcA.length - 1];
|
|
92
|
+
_this.isValid = true;
|
|
93
|
+
} else if (data.search(/^[01][0-9]{7}$/) !== -1) {
|
|
94
|
+
_this.middleDigits = data.substring(1, data.length - 1);
|
|
95
|
+
_this.upcA = expandToUPCA(_this.middleDigits, data[0]);
|
|
96
|
+
|
|
97
|
+
if (_this.upcA[_this.upcA.length - 1] === data[data.length - 1]) {
|
|
98
|
+
_this.isValid = true;
|
|
99
|
+
} else {
|
|
100
|
+
// checksum mismatch
|
|
101
|
+
return _possibleConstructorReturn(_this);
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
return _possibleConstructorReturn(_this);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
_this.displayValue = options.displayValue;
|
|
108
|
+
|
|
109
|
+
// Make sure the font is not bigger than the space between the guard bars
|
|
110
|
+
if (options.fontSize > options.width * 10) {
|
|
111
|
+
_this.fontSize = options.width * 10;
|
|
112
|
+
} else {
|
|
113
|
+
_this.fontSize = options.fontSize;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Make the guard bars go down half the way of the text
|
|
117
|
+
_this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin;
|
|
118
|
+
return _this;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
_createClass(UPCE, [
|
|
122
|
+
{
|
|
123
|
+
key: 'valid',
|
|
124
|
+
value: function valid() {
|
|
125
|
+
return this.isValid;
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
key: 'encode',
|
|
130
|
+
value: function encode() {
|
|
131
|
+
if (this.options.flat) {
|
|
132
|
+
return this.flatEncoding();
|
|
133
|
+
} else {
|
|
134
|
+
return this.guardedEncoding();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
key: 'flatEncoding',
|
|
140
|
+
value: function flatEncoding() {
|
|
141
|
+
var result = '';
|
|
142
|
+
|
|
143
|
+
result += '101';
|
|
144
|
+
result += this.encodeMiddleDigits();
|
|
145
|
+
result += '010101';
|
|
146
|
+
|
|
147
|
+
return {
|
|
148
|
+
data: result,
|
|
149
|
+
text: this.text
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
key: 'guardedEncoding',
|
|
155
|
+
value: function guardedEncoding() {
|
|
156
|
+
var result = [];
|
|
157
|
+
|
|
158
|
+
// Add the UPC-A number system digit beneath the quiet zone
|
|
159
|
+
if (this.displayValue) {
|
|
160
|
+
result.push({
|
|
161
|
+
data: '00000000',
|
|
162
|
+
text: this.text[0],
|
|
163
|
+
options: { textAlign: 'left', fontSize: this.fontSize }
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Add the guard bars
|
|
168
|
+
result.push({
|
|
169
|
+
data: '101',
|
|
170
|
+
options: { height: this.guardHeight }
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
// Add the 6 UPC-E digits
|
|
174
|
+
result.push({
|
|
175
|
+
data: this.encodeMiddleDigits(),
|
|
176
|
+
text: this.text.substring(1, 7),
|
|
177
|
+
options: { fontSize: this.fontSize }
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
// Add the end bits
|
|
181
|
+
result.push({
|
|
182
|
+
data: '010101',
|
|
183
|
+
options: { height: this.guardHeight }
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
// Add the UPC-A check digit beneath the quiet zone
|
|
187
|
+
if (this.displayValue) {
|
|
188
|
+
result.push({
|
|
189
|
+
data: '00000000',
|
|
190
|
+
text: this.text[7],
|
|
191
|
+
options: { textAlign: 'right', fontSize: this.fontSize }
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return result;
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
key: 'encodeMiddleDigits',
|
|
200
|
+
value: function encodeMiddleDigits() {
|
|
201
|
+
var numberSystem = this.upcA[0];
|
|
202
|
+
var checkDigit = this.upcA[this.upcA.length - 1];
|
|
203
|
+
var parity = PARITIES[parseInt(checkDigit)][parseInt(numberSystem)];
|
|
204
|
+
return (0, encoderFunc)(this.middleDigits, parity);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
]);
|
|
208
|
+
|
|
209
|
+
return UPCE;
|
|
210
|
+
})(BarcodeFunc);
|
|
165
211
|
|
|
166
212
|
function expandToUPCA(middleDigits, numberSystem) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
213
|
+
var lastUpcE = parseInt(middleDigits[middleDigits.length - 1]);
|
|
214
|
+
var expansion = EXPANSIONS[lastUpcE];
|
|
215
|
+
|
|
216
|
+
var result = '';
|
|
217
|
+
var digitIndex = 0;
|
|
218
|
+
for (var i = 0; i < expansion.length; i++) {
|
|
219
|
+
var c = expansion[i];
|
|
220
|
+
if (c === 'X') {
|
|
221
|
+
result += middleDigits[digitIndex++];
|
|
222
|
+
} else {
|
|
223
|
+
result += c;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
result = '' + numberSystem + result;
|
|
228
|
+
return '' + result + (0, _UPC.checksum)(result);
|
|
183
229
|
}
|
|
184
230
|
|
|
185
|
-
|
|
231
|
+
export default UPCE;
|
|
@@ -1,30 +1,89 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
1
|
// Standard start end and middle bits
|
|
7
|
-
var SIDE_BIN =
|
|
8
|
-
var MIDDLE_BIN =
|
|
2
|
+
var SIDE_BIN = '101';
|
|
3
|
+
var MIDDLE_BIN = '01010';
|
|
9
4
|
|
|
10
|
-
var BINARIES =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
var BINARIES = {
|
|
6
|
+
L: [
|
|
7
|
+
// The L (left) type of encoding
|
|
8
|
+
'0001101',
|
|
9
|
+
'0011001',
|
|
10
|
+
'0010011',
|
|
11
|
+
'0111101',
|
|
12
|
+
'0100011',
|
|
13
|
+
'0110001',
|
|
14
|
+
'0101111',
|
|
15
|
+
'0111011',
|
|
16
|
+
'0110111',
|
|
17
|
+
'0001011'
|
|
18
|
+
],
|
|
19
|
+
G: [
|
|
20
|
+
// The G type of encoding
|
|
21
|
+
'0100111',
|
|
22
|
+
'0110011',
|
|
23
|
+
'0011011',
|
|
24
|
+
'0100001',
|
|
25
|
+
'0011101',
|
|
26
|
+
'0111001',
|
|
27
|
+
'0000101',
|
|
28
|
+
'0010001',
|
|
29
|
+
'0001001',
|
|
30
|
+
'0010111'
|
|
31
|
+
],
|
|
32
|
+
R: [
|
|
33
|
+
// The R (right) type of encoding
|
|
34
|
+
'1110010',
|
|
35
|
+
'1100110',
|
|
36
|
+
'1101100',
|
|
37
|
+
'1000010',
|
|
38
|
+
'1011100',
|
|
39
|
+
'1001110',
|
|
40
|
+
'1010000',
|
|
41
|
+
'1000100',
|
|
42
|
+
'1001000',
|
|
43
|
+
'1110100'
|
|
44
|
+
],
|
|
45
|
+
O: [
|
|
46
|
+
// The O (odd) encoding for UPC-E
|
|
47
|
+
'0001101',
|
|
48
|
+
'0011001',
|
|
49
|
+
'0010011',
|
|
50
|
+
'0111101',
|
|
51
|
+
'0100011',
|
|
52
|
+
'0110001',
|
|
53
|
+
'0101111',
|
|
54
|
+
'0111011',
|
|
55
|
+
'0110111',
|
|
56
|
+
'0001011'
|
|
57
|
+
],
|
|
58
|
+
E: [
|
|
59
|
+
// The E (even) encoding for UPC-E
|
|
60
|
+
'0100111',
|
|
61
|
+
'0110011',
|
|
62
|
+
'0011011',
|
|
63
|
+
'0100001',
|
|
64
|
+
'0011101',
|
|
65
|
+
'0111001',
|
|
66
|
+
'0000101',
|
|
67
|
+
'0010001',
|
|
68
|
+
'0001001',
|
|
69
|
+
'0010111'
|
|
70
|
+
]
|
|
21
71
|
};
|
|
22
72
|
|
|
23
73
|
// Define the EAN-2 structure
|
|
24
|
-
var EAN2_STRUCTURE =
|
|
74
|
+
var EAN2_STRUCTURE = ['LL', 'LG', 'GL', 'GG'];
|
|
25
75
|
|
|
26
76
|
// Define the EAN-5 structure
|
|
27
|
-
var EAN5_STRUCTURE =
|
|
77
|
+
var EAN5_STRUCTURE = ['GGLLL', 'GLGLL', 'GLLGL', 'GLLLG', 'LGGLL', 'LLGGL', 'LLLGG', 'LGLGL', 'LGLLG', 'LLGLG'];
|
|
28
78
|
|
|
29
79
|
// Define the EAN-13 structure
|
|
30
|
-
var EAN13_STRUCTURE =
|
|
80
|
+
var EAN13_STRUCTURE = ['LLLLLL', 'LLGLGG', 'LLGGLG', 'LLGGGL', 'LGLLGG', 'LGGLLG', 'LGGGLL', 'LGLGLG', 'LGLGGL', 'LGGLGL'];
|
|
81
|
+
|
|
82
|
+
export default {
|
|
83
|
+
SIDE_BIN: SIDE_BIN,
|
|
84
|
+
MIDDLE_BIN: MIDDLE_BIN,
|
|
85
|
+
BINARIES: BINARIES,
|
|
86
|
+
EAN2_STRUCTURE: EAN2_STRUCTURE,
|
|
87
|
+
EAN5_STRUCTURE: EAN5_STRUCTURE,
|
|
88
|
+
EAN13_STRUCTURE: EAN13_STRUCTURE
|
|
89
|
+
};
|
|
@@ -1,27 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _constants = require('./constants');
|
|
1
|
+
import _constants from './constants';
|
|
8
2
|
|
|
9
3
|
// Encode data string
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
encoded = encoded.map(function (val, idx) {
|
|
20
|
-
return idx < last ? val + separator : val;
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return encoded.join('');
|
|
25
|
-
};
|
|
4
|
+
export function encoderFunc(data, structure, separator) {
|
|
5
|
+
var encoded = data
|
|
6
|
+
.split('')
|
|
7
|
+
.map(function (val, idx) {
|
|
8
|
+
return _constants.BINARIES[structure[idx]];
|
|
9
|
+
})
|
|
10
|
+
.map(function (val, idx) {
|
|
11
|
+
return val ? val[data[idx]] : '';
|
|
12
|
+
});
|
|
26
13
|
|
|
27
|
-
|
|
14
|
+
if (separator) {
|
|
15
|
+
var last = data.length - 1;
|
|
16
|
+
encoded = encoded.map(function (val, idx) {
|
|
17
|
+
return idx < last ? val + separator : val;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return encoded.join('');
|
|
21
|
+
}
|
|
@@ -1,39 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var _EAN5 = require('./EAN5.js');
|
|
17
|
-
|
|
18
|
-
var _EAN6 = _interopRequireDefault(_EAN5);
|
|
19
|
-
|
|
20
|
-
var _EAN7 = require('./EAN2.js');
|
|
21
|
-
|
|
22
|
-
var _EAN8 = _interopRequireDefault(_EAN7);
|
|
23
|
-
|
|
24
|
-
var _UPC = require('./UPC.js');
|
|
25
|
-
|
|
26
|
-
var _UPC2 = _interopRequireDefault(_UPC);
|
|
27
|
-
|
|
28
|
-
var _UPCE = require('./UPCE.js');
|
|
29
|
-
|
|
30
|
-
var _UPCE2 = _interopRequireDefault(_UPCE);
|
|
31
|
-
|
|
32
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
|
-
|
|
34
|
-
exports.EAN13 = _EAN2.default;
|
|
35
|
-
exports.EAN8 = _EAN4.default;
|
|
36
|
-
exports.EAN5 = _EAN6.default;
|
|
37
|
-
exports.EAN2 = _EAN8.default;
|
|
38
|
-
exports.UPC = _UPC2.default;
|
|
39
|
-
exports.UPCE = _UPCE2.default;
|
|
1
|
+
import EAN13 from './EAN13.js';
|
|
2
|
+
import EAN8 from './EAN8.js';
|
|
3
|
+
import EAN5 from './EAN5.js';
|
|
4
|
+
import EAN2 from './EAN2.js';
|
|
5
|
+
import UPC from './UPC.js';
|
|
6
|
+
import UPCE from './UPCE.js';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
EAN13: EAN13,
|
|
10
|
+
EAN8: EAN8,
|
|
11
|
+
EAN5: EAN5,
|
|
12
|
+
EAN2: EAN2,
|
|
13
|
+
UPC: UPC,
|
|
14
|
+
UPCE: UPCE
|
|
15
|
+
};
|