@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,119 +1,177 @@
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 _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
10
-
11
- var _constants = require('./constants');
12
-
13
- var _EAN2 = require('./EAN');
14
-
15
- var _EAN3 = _interopRequireDefault(_EAN2);
16
-
17
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
-
19
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
20
-
21
- 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; }
1
+ import _constants from './constants.js';
2
+ import EAN_FUNC from './EAN.js';
3
+
4
+ var _createClass = (function () {
5
+ function defineProperties(target, props) {
6
+ for (var i = 0; i < props.length; i++) {
7
+ var descriptor = props[i];
8
+ descriptor.enumerable = descriptor.enumerable || false;
9
+ descriptor.configurable = true;
10
+ if ('value' in descriptor) descriptor.writable = true;
11
+ Object.defineProperty(target, descriptor.key, descriptor);
12
+ }
13
+ }
14
+ return function (Constructor, protoProps, staticProps) {
15
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
16
+ if (staticProps) defineProperties(Constructor, staticProps);
17
+ return Constructor;
18
+ };
19
+ })();
20
+
21
+ var _get = function get(object, property, receiver) {
22
+ if (object === null) object = Function.prototype;
23
+ var desc = Object.getOwnPropertyDescriptor(object, property);
24
+ if (desc === undefined) {
25
+ var parent = Object.getPrototypeOf(object);
26
+ if (parent === null) {
27
+ return undefined;
28
+ } else {
29
+ return get(parent, property, receiver);
30
+ }
31
+ } else if ('value' in desc) {
32
+ return desc.value;
33
+ } else {
34
+ var getter = desc.get;
35
+ if (getter === undefined) {
36
+ return undefined;
37
+ }
38
+ return getter.call(receiver);
39
+ }
40
+ };
22
41
 
23
- 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:
42
+ function _classCallCheck(instance, Constructor) {
43
+ if (!(instance instanceof Constructor)) {
44
+ throw new TypeError('Cannot call a class as a function');
45
+ }
46
+ }
47
+
48
+ function _possibleConstructorReturn(self, call) {
49
+ if (!self) {
50
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
51
+ }
52
+ return call && (typeof call === 'object' || typeof call === 'function') ? call : self;
53
+ }
54
+
55
+ function _inherits(subClass, superClass) {
56
+ if (typeof superClass !== 'function' && superClass !== null) {
57
+ throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass);
58
+ }
59
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
60
+ constructor: { value: subClass, enumerable: false, writable: true, configurable: true }
61
+ });
62
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : (subClass.__proto__ = superClass);
63
+ } // Encoding documentation:
24
64
  // https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Binary_encoding_of_data_digits_into_EAN-13_barcode
25
65
 
26
66
  // Calculate the checksum digit
27
67
  // https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit
28
68
  var checksum = function checksum(number) {
29
- var res = number.substr(0, 12).split('').map(function (n) {
30
- return +n;
31
- }).reduce(function (sum, a, idx) {
32
- return idx % 2 ? sum + a * 3 : sum + a;
33
- }, 0);
34
-
35
- return (10 - res % 10) % 10;
69
+ var res = number
70
+ .substr(0, 12)
71
+ .split('')
72
+ .map(function (n) {
73
+ return +n;
74
+ })
75
+ .reduce(function (sum, a, idx) {
76
+ return idx % 2 ? sum + a * 3 : sum + a;
77
+ }, 0);
78
+
79
+ return (10 - (res % 10)) % 10;
36
80
  };
37
81
 
38
- var EAN13 = function (_EAN) {
39
- _inherits(EAN13, _EAN);
40
-
41
- function EAN13(data, options) {
42
- _classCallCheck(this, EAN13);
43
-
44
- // Add checksum if it does not exist
45
- if (data.search(/^[0-9]{12}$/) !== -1) {
46
- data += checksum(data);
47
- }
48
-
49
- // Adds a last character to the end of the barcode
50
- var _this = _possibleConstructorReturn(this, (EAN13.__proto__ || Object.getPrototypeOf(EAN13)).call(this, data, options));
51
-
52
- _this.lastChar = options.lastChar;
53
- return _this;
54
- }
55
-
56
- _createClass(EAN13, [{
57
- key: 'valid',
58
- value: function valid() {
59
- return this.data.search(/^[0-9]{13}$/) !== -1 && +this.data[12] === checksum(this.data);
60
- }
61
- }, {
62
- key: 'leftText',
63
- value: function leftText() {
64
- return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'leftText', this).call(this, 1, 6);
65
- }
66
- }, {
67
- key: 'leftEncode',
68
- value: function leftEncode() {
69
- var data = this.data.substr(1, 6);
70
- var structure = _constants.EAN13_STRUCTURE[this.data[0]];
71
- return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'leftEncode', this).call(this, data, structure);
72
- }
73
- }, {
74
- key: 'rightText',
75
- value: function rightText() {
76
- return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'rightText', this).call(this, 7, 6);
77
- }
78
- }, {
79
- key: 'rightEncode',
80
- value: function rightEncode() {
81
- var data = this.data.substr(7, 6);
82
- return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'rightEncode', this).call(this, data, 'RRRRRR');
83
- }
84
-
85
- // The "standard" way of printing EAN13 barcodes with guard bars
86
-
87
- }, {
88
- key: 'encodeGuarded',
89
- value: function encodeGuarded() {
90
- var data = _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'encodeGuarded', this).call(this);
91
-
92
- // Extend data with left digit & last character
93
- if (this.options.displayValue) {
94
- data.unshift({
95
- data: '000000000000',
96
- text: this.text.substr(0, 1),
97
- options: { textAlign: 'left', fontSize: this.fontSize }
98
- });
99
-
100
- if (this.options.lastChar) {
101
- data.push({
102
- data: '00'
103
- });
104
- data.push({
105
- data: '00000',
106
- text: this.options.lastChar,
107
- options: { fontSize: this.fontSize }
108
- });
109
- }
110
- }
111
-
112
- return data;
113
- }
114
- }]);
115
-
116
- return EAN13;
117
- }(_EAN3.default);
118
-
119
- exports.default = EAN13;
82
+ var EAN13 = (function (_EAN) {
83
+ _inherits(EAN13, _EAN);
84
+
85
+ function EAN13(data, options) {
86
+ _classCallCheck(this, EAN13);
87
+
88
+ // Add checksum if it does not exist
89
+ if (data.search(/^[0-9]{12}$/) !== -1) {
90
+ data += checksum(data);
91
+ }
92
+
93
+ // Adds a last character to the end of the barcode
94
+ var _this = _possibleConstructorReturn(this, (EAN13.__proto__ || Object.getPrototypeOf(EAN13)).call(this, data, options));
95
+
96
+ _this.lastChar = options.lastChar;
97
+ return _this;
98
+ }
99
+
100
+ _createClass(EAN13, [
101
+ {
102
+ key: 'valid',
103
+ value: function valid() {
104
+ return this.data.search(/^[0-9]{13}$/) !== -1 && +this.data[12] === checksum(this.data);
105
+ }
106
+ },
107
+ {
108
+ key: 'leftText',
109
+ value: function leftText() {
110
+ return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'leftText', this).call(this, 1, 6);
111
+ }
112
+ },
113
+ {
114
+ key: 'leftEncode',
115
+ value: function leftEncode() {
116
+ var data = this.data.substr(1, 6);
117
+ var structure = _constants.EAN13_STRUCTURE[this.data[0]];
118
+ return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'leftEncode', this).call(
119
+ this,
120
+ data,
121
+ structure
122
+ );
123
+ }
124
+ },
125
+ {
126
+ key: 'rightText',
127
+ value: function rightText() {
128
+ return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'rightText', this).call(this, 7, 6);
129
+ }
130
+ },
131
+ {
132
+ key: 'rightEncode',
133
+ value: function rightEncode() {
134
+ var data = this.data.substr(7, 6);
135
+ return _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'rightEncode', this).call(
136
+ this,
137
+ data,
138
+ 'RRRRRR'
139
+ );
140
+ }
141
+
142
+ // The "standard" way of printing EAN13 barcodes with guard bars
143
+ },
144
+ {
145
+ key: 'encodeGuarded',
146
+ value: function encodeGuarded() {
147
+ var data = _get(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'encodeGuarded', this).call(this);
148
+
149
+ // Extend data with left digit & last character
150
+ if (this.options.displayValue) {
151
+ data.unshift({
152
+ data: '000000000000',
153
+ text: this.text.substr(0, 1),
154
+ options: { textAlign: 'left', fontSize: this.fontSize }
155
+ });
156
+
157
+ if (this.options.lastChar) {
158
+ data.push({
159
+ data: '00'
160
+ });
161
+ data.push({
162
+ data: '00000',
163
+ text: this.options.lastChar,
164
+ options: { fontSize: this.fontSize }
165
+ });
166
+ }
167
+ }
168
+
169
+ return data;
170
+ }
171
+ }
172
+ ]);
173
+
174
+ return EAN13;
175
+ })(EAN_FUNC);
176
+
177
+ export default EAN13;
@@ -1,58 +1,79 @@
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 _constants = require('./constants');
10
-
11
- var _encoder = require('./encoder');
12
-
13
- var _encoder2 = _interopRequireDefault(_encoder);
14
-
15
- var _Barcode2 = require('../Barcode');
16
-
17
- var _Barcode3 = _interopRequireDefault(_Barcode2);
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"); } }
22
-
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; }
24
-
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:
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
+ }
27
+
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
+ }
34
+
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/EAN_2#Encoding
27
45
 
28
- var EAN2 = function (_Barcode) {
29
- _inherits(EAN2, _Barcode);
30
-
31
- function EAN2(data, options) {
32
- _classCallCheck(this, EAN2);
33
-
34
- return _possibleConstructorReturn(this, (EAN2.__proto__ || Object.getPrototypeOf(EAN2)).call(this, data, options));
35
- }
36
-
37
- _createClass(EAN2, [{
38
- key: 'valid',
39
- value: function valid() {
40
- return this.data.search(/^[0-9]{2}$/) !== -1;
41
- }
42
- }, {
43
- key: 'encode',
44
- value: function encode() {
45
- // Choose the structure based on the number mod 4
46
- var structure = _constants.EAN2_STRUCTURE[parseInt(this.data) % 4];
47
- return {
48
- // Start bits + Encode the two digits with 01 in between
49
- data: '1011' + (0, _encoder2.default)(this.data, structure, '01'),
50
- text: this.text
51
- };
52
- }
53
- }]);
54
-
55
- return EAN2;
56
- }(_Barcode3.default);
57
-
58
- exports.default = EAN2;
46
+ var EAN2 = (function (_Barcode) {
47
+ _inherits(EAN2, _Barcode);
48
+
49
+ function EAN2(data, options) {
50
+ _classCallCheck(this, EAN2);
51
+
52
+ return _possibleConstructorReturn(this, (EAN2.__proto__ || Object.getPrototypeOf(EAN2)).call(this, data, options));
53
+ }
54
+
55
+ _createClass(EAN2, [
56
+ {
57
+ key: 'valid',
58
+ value: function valid() {
59
+ return this.data.search(/^[0-9]{2}$/) !== -1;
60
+ }
61
+ },
62
+ {
63
+ key: 'encode',
64
+ value: function encode() {
65
+ // Choose the structure based on the number mod 4
66
+ var structure = _constants.EAN2_STRUCTURE[parseInt(this.data) % 4];
67
+ return {
68
+ // Start bits + Encode the two digits with 01 in between
69
+ data: '1011' + (0, encoderFunc)(this.data, structure, '01'),
70
+ text: this.text
71
+ };
72
+ }
73
+ }
74
+ ]);
75
+
76
+ return EAN2;
77
+ })(BarcodeFunc);
78
+
79
+ export default EAN2;
@@ -1,65 +1,89 @@
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 _constants = require('./constants');
10
-
11
- var _encoder = require('./encoder');
12
-
13
- var _encoder2 = _interopRequireDefault(_encoder);
14
-
15
- var _Barcode2 = require('../Barcode');
16
-
17
- var _Barcode3 = _interopRequireDefault(_Barcode2);
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"); } }
22
-
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; }
24
-
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:
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
+ }
27
+
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
+ }
34
+
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/EAN_5#Encoding
27
45
 
28
46
  var checksum = function checksum(data) {
29
- var result = data.split('').map(function (n) {
30
- return +n;
31
- }).reduce(function (sum, a, idx) {
32
- return idx % 2 ? sum + a * 9 : sum + a * 3;
33
- }, 0);
34
- return result % 10;
47
+ var result = data
48
+ .split('')
49
+ .map(function (n) {
50
+ return +n;
51
+ })
52
+ .reduce(function (sum, a, idx) {
53
+ return idx % 2 ? sum + a * 9 : sum + a * 3;
54
+ }, 0);
55
+ return result % 10;
35
56
  };
36
57
 
37
- var EAN5 = function (_Barcode) {
38
- _inherits(EAN5, _Barcode);
39
-
40
- function EAN5(data, options) {
41
- _classCallCheck(this, EAN5);
42
-
43
- return _possibleConstructorReturn(this, (EAN5.__proto__ || Object.getPrototypeOf(EAN5)).call(this, data, options));
44
- }
45
-
46
- _createClass(EAN5, [{
47
- key: 'valid',
48
- value: function valid() {
49
- return this.data.search(/^[0-9]{5}$/) !== -1;
50
- }
51
- }, {
52
- key: 'encode',
53
- value: function encode() {
54
- var structure = _constants.EAN5_STRUCTURE[checksum(this.data)];
55
- return {
56
- data: '1011' + (0, _encoder2.default)(this.data, structure, '01'),
57
- text: this.text
58
- };
59
- }
60
- }]);
61
-
62
- return EAN5;
63
- }(_Barcode3.default);
64
-
65
- exports.default = EAN5;
58
+ var EAN5 = (function (_Barcode) {
59
+ _inherits(EAN5, _Barcode);
60
+
61
+ function EAN5(data, options) {
62
+ _classCallCheck(this, EAN5);
63
+
64
+ return _possibleConstructorReturn(this, (EAN5.__proto__ || Object.getPrototypeOf(EAN5)).call(this, data, options));
65
+ }
66
+
67
+ _createClass(EAN5, [
68
+ {
69
+ key: 'valid',
70
+ value: function valid() {
71
+ return this.data.search(/^[0-9]{5}$/) !== -1;
72
+ }
73
+ },
74
+ {
75
+ key: 'encode',
76
+ value: function encode() {
77
+ var structure = _constants.EAN5_STRUCTURE[checksum(this.data)];
78
+ return {
79
+ data: '1011' + (0, encoderFunc)(this.data, structure, '01'),
80
+ text: this.text
81
+ };
82
+ }
83
+ }
84
+ ]);
85
+
86
+ return EAN5;
87
+ })(BarcodeFunc);
88
+
89
+ export default EAN5;