@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,81 +1,140 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import EAN_FUNC from './EAN.js';
|
|
2
|
+
|
|
3
|
+
var _createClass = (function () {
|
|
4
|
+
function defineProperties(target, props) {
|
|
5
|
+
for (var i = 0; i < props.length; i++) {
|
|
6
|
+
var descriptor = props[i];
|
|
7
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
8
|
+
descriptor.configurable = true;
|
|
9
|
+
if ('value' in descriptor) descriptor.writable = true;
|
|
10
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return function (Constructor, protoProps, staticProps) {
|
|
14
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
15
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
16
|
+
return Constructor;
|
|
17
|
+
};
|
|
18
|
+
})();
|
|
19
|
+
|
|
20
|
+
var _get = function get(object, property, receiver) {
|
|
21
|
+
if (object === null) object = Function.prototype;
|
|
22
|
+
var desc = Object.getOwnPropertyDescriptor(object, property);
|
|
23
|
+
if (desc === undefined) {
|
|
24
|
+
var parent = Object.getPrototypeOf(object);
|
|
25
|
+
if (parent === null) {
|
|
26
|
+
return undefined;
|
|
27
|
+
} else {
|
|
28
|
+
return get(parent, property, receiver);
|
|
29
|
+
}
|
|
30
|
+
} else if ('value' in desc) {
|
|
31
|
+
return desc.value;
|
|
32
|
+
} else {
|
|
33
|
+
var getter = desc.get;
|
|
34
|
+
if (getter === undefined) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
return getter.call(receiver);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
20
40
|
|
|
21
|
-
function
|
|
41
|
+
function _classCallCheck(instance, Constructor) {
|
|
42
|
+
if (!(instance instanceof Constructor)) {
|
|
43
|
+
throw new TypeError('Cannot call a class as a function');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function _possibleConstructorReturn(self, call) {
|
|
48
|
+
if (!self) {
|
|
49
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
50
|
+
}
|
|
51
|
+
return call && (typeof call === 'object' || typeof call === 'function') ? call : self;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function _inherits(subClass, superClass) {
|
|
55
|
+
if (typeof superClass !== 'function' && superClass !== null) {
|
|
56
|
+
throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass);
|
|
57
|
+
}
|
|
58
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
59
|
+
constructor: { value: subClass, enumerable: false, writable: true, configurable: true }
|
|
60
|
+
});
|
|
61
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : (subClass.__proto__ = superClass);
|
|
62
|
+
} // Encoding documentation:
|
|
22
63
|
// http://www.barcodeisland.com/ean8.phtml
|
|
23
64
|
|
|
24
65
|
// Calculate the checksum digit
|
|
25
66
|
var checksum = function checksum(number) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
67
|
+
var res = number
|
|
68
|
+
.substr(0, 7)
|
|
69
|
+
.split('')
|
|
70
|
+
.map(function (n) {
|
|
71
|
+
return +n;
|
|
72
|
+
})
|
|
73
|
+
.reduce(function (sum, a, idx) {
|
|
74
|
+
return idx % 2 ? sum + a : sum + a * 3;
|
|
75
|
+
}, 0);
|
|
76
|
+
|
|
77
|
+
return (10 - (res % 10)) % 10;
|
|
33
78
|
};
|
|
34
79
|
|
|
35
|
-
var EAN8 = function (_EAN) {
|
|
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
|
-
|
|
80
|
+
var EAN8 = (function (_EAN) {
|
|
81
|
+
_inherits(EAN8, _EAN);
|
|
82
|
+
|
|
83
|
+
function EAN8(data, options) {
|
|
84
|
+
_classCallCheck(this, EAN8);
|
|
85
|
+
|
|
86
|
+
// Add checksum if it does not exist
|
|
87
|
+
if (data.search(/^[0-9]{7}$/) !== -1) {
|
|
88
|
+
data += checksum(data);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return _possibleConstructorReturn(this, (EAN8.__proto__ || Object.getPrototypeOf(EAN8)).call(this, data, options));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
_createClass(EAN8, [
|
|
95
|
+
{
|
|
96
|
+
key: 'valid',
|
|
97
|
+
value: function valid() {
|
|
98
|
+
return this.data.search(/^[0-9]{8}$/) !== -1 && +this.data[7] === checksum(this.data);
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
key: 'leftText',
|
|
103
|
+
value: function leftText() {
|
|
104
|
+
return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), 'leftText', this).call(this, 0, 4);
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
key: 'leftEncode',
|
|
109
|
+
value: function leftEncode() {
|
|
110
|
+
var data = this.data.substr(0, 4);
|
|
111
|
+
return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), 'leftEncode', this).call(
|
|
112
|
+
this,
|
|
113
|
+
data,
|
|
114
|
+
'LLLL'
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
key: 'rightText',
|
|
120
|
+
value: function rightText() {
|
|
121
|
+
return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), 'rightText', this).call(this, 4, 4);
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
key: 'rightEncode',
|
|
126
|
+
value: function rightEncode() {
|
|
127
|
+
var data = this.data.substr(4, 4);
|
|
128
|
+
return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), 'rightEncode', this).call(
|
|
129
|
+
this,
|
|
130
|
+
data,
|
|
131
|
+
'RRRR'
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
]);
|
|
136
|
+
|
|
137
|
+
return EAN8;
|
|
138
|
+
})(EAN_FUNC);
|
|
139
|
+
|
|
140
|
+
export default EAN8;
|
|
@@ -1,165 +1,183 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
+
|
|
5
|
+
var _createClass = (function () {
|
|
6
|
+
function defineProperties(target, props) {
|
|
7
|
+
for (var i = 0; i < props.length; i++) {
|
|
8
|
+
var descriptor = props[i];
|
|
9
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
10
|
+
descriptor.configurable = true;
|
|
11
|
+
if ('value' in descriptor) descriptor.writable = true;
|
|
12
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return function (Constructor, protoProps, staticProps) {
|
|
16
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
17
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
18
|
+
return Constructor;
|
|
19
|
+
};
|
|
20
|
+
})();
|
|
21
|
+
|
|
22
|
+
function _classCallCheck(instance, Constructor) {
|
|
23
|
+
if (!(instance instanceof Constructor)) {
|
|
24
|
+
throw new TypeError('Cannot call a class as a function');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
22
27
|
|
|
23
|
-
function _possibleConstructorReturn(self, call) {
|
|
28
|
+
function _possibleConstructorReturn(self, call) {
|
|
29
|
+
if (!self) {
|
|
30
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
31
|
+
}
|
|
32
|
+
return call && (typeof call === 'object' || typeof call === 'function') ? call : self;
|
|
33
|
+
}
|
|
24
34
|
|
|
25
|
-
function _inherits(subClass, superClass) {
|
|
35
|
+
function _inherits(subClass, superClass) {
|
|
36
|
+
if (typeof superClass !== 'function' && superClass !== null) {
|
|
37
|
+
throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass);
|
|
38
|
+
}
|
|
39
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
40
|
+
constructor: { value: subClass, enumerable: false, writable: true, configurable: true }
|
|
41
|
+
});
|
|
42
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : (subClass.__proto__ = superClass);
|
|
43
|
+
} // Encoding documentation:
|
|
26
44
|
// https://en.wikipedia.org/wiki/Universal_Product_Code#Encoding
|
|
27
45
|
|
|
28
|
-
var UPC = function (_Barcode) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
}
|
|
46
|
+
var UPC = (function (_Barcode) {
|
|
47
|
+
_inherits(UPC, _Barcode);
|
|
48
|
+
|
|
49
|
+
function UPC(data, options) {
|
|
50
|
+
_classCallCheck(this, UPC);
|
|
51
|
+
|
|
52
|
+
// Add checksum if it does not exist
|
|
53
|
+
if (data.search(/^[0-9]{11}$/) !== -1) {
|
|
54
|
+
data += checksum(data);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
var _this = _possibleConstructorReturn(this, (UPC.__proto__ || Object.getPrototypeOf(UPC)).call(this, data, options));
|
|
58
|
+
|
|
59
|
+
_this.displayValue = options.displayValue;
|
|
60
|
+
|
|
61
|
+
// Make sure the font is not bigger than the space between the guard bars
|
|
62
|
+
if (options.fontSize > options.width * 10) {
|
|
63
|
+
_this.fontSize = options.width * 10;
|
|
64
|
+
} else {
|
|
65
|
+
_this.fontSize = options.fontSize;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Make the guard bars go down half the way of the text
|
|
69
|
+
_this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin;
|
|
70
|
+
return _this;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
_createClass(UPC, [
|
|
74
|
+
{
|
|
75
|
+
key: 'valid',
|
|
76
|
+
value: function valid() {
|
|
77
|
+
return this.data.search(/^[0-9]{12}$/) !== -1 && this.data[11] == checksum(this.data);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
key: 'encode',
|
|
82
|
+
value: function encode() {
|
|
83
|
+
if (this.options.flat) {
|
|
84
|
+
return this.flatEncoding();
|
|
85
|
+
} else {
|
|
86
|
+
return this.guardedEncoding();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
key: 'flatEncoding',
|
|
92
|
+
value: function flatEncoding() {
|
|
93
|
+
var result = '';
|
|
94
|
+
|
|
95
|
+
result += '101';
|
|
96
|
+
result += (0, encoderFunc)(this.data.substr(0, 6), 'LLLLLL');
|
|
97
|
+
result += '01010';
|
|
98
|
+
result += (0, encoderFunc)(this.data.substr(6, 6), 'RRRRRR');
|
|
99
|
+
result += '101';
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
data: result,
|
|
103
|
+
text: this.text
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
key: 'guardedEncoding',
|
|
109
|
+
value: function guardedEncoding() {
|
|
110
|
+
var result = [];
|
|
111
|
+
|
|
112
|
+
// Add the first digit
|
|
113
|
+
if (this.displayValue) {
|
|
114
|
+
result.push({
|
|
115
|
+
data: '00000000',
|
|
116
|
+
text: this.text.substr(0, 1),
|
|
117
|
+
options: { textAlign: 'left', fontSize: this.fontSize }
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Add the guard bars
|
|
122
|
+
result.push({
|
|
123
|
+
data: '101' + (0, encoderFunc)(this.data[0], 'L'),
|
|
124
|
+
options: { height: this.guardHeight }
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
// Add the left side
|
|
128
|
+
result.push({
|
|
129
|
+
data: (0, encoderFunc)(this.data.substr(1, 5), 'LLLLL'),
|
|
130
|
+
text: this.text.substr(1, 5),
|
|
131
|
+
options: { fontSize: this.fontSize }
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// Add the middle bits
|
|
135
|
+
result.push({
|
|
136
|
+
data: '01010',
|
|
137
|
+
options: { height: this.guardHeight }
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
// Add the right side
|
|
141
|
+
result.push({
|
|
142
|
+
data: (0, encoderFunc)(this.data.substr(6, 5), 'RRRRR'),
|
|
143
|
+
text: this.text.substr(6, 5),
|
|
144
|
+
options: { fontSize: this.fontSize }
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// Add the end bits
|
|
148
|
+
result.push({
|
|
149
|
+
data: (0, encoderFunc)(this.data[11], 'R') + '101',
|
|
150
|
+
options: { height: this.guardHeight }
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
// Add the last digit
|
|
154
|
+
if (this.displayValue) {
|
|
155
|
+
result.push({
|
|
156
|
+
data: '00000000',
|
|
157
|
+
text: this.text.substr(11, 1),
|
|
158
|
+
options: { textAlign: 'right', fontSize: this.fontSize }
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return result;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
]);
|
|
166
|
+
return UPC;
|
|
167
|
+
})(BarcodeFunc);
|
|
146
168
|
|
|
147
169
|
// Calulate the checksum digit
|
|
148
170
|
// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
result += parseInt(number[i]) * 3;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return (10 - result % 10) % 10;
|
|
171
|
+
export function checksum(number) {
|
|
172
|
+
var result = 0;
|
|
173
|
+
var i;
|
|
174
|
+
for (i = 1; i < 11; i += 2) {
|
|
175
|
+
result += parseInt(number[i]);
|
|
176
|
+
}
|
|
177
|
+
for (i = 0; i < 11; i += 2) {
|
|
178
|
+
result += parseInt(number[i]) * 3;
|
|
179
|
+
}
|
|
180
|
+
return (10 - (result % 10)) % 10;
|
|
163
181
|
}
|
|
164
182
|
|
|
165
|
-
|
|
183
|
+
export default UPC;
|