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