yh-hiprint 2.3.1 → 2.3.3

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 (62) hide show
  1. package/HiprintDesigner.vue +5 -5
  2. package/column-field.js +1 -3
  3. package/designer.vue +4 -4
  4. package/font-size.js +2 -3
  5. package/index.js +1 -2
  6. package/libs/hiprint.bundle.js +331 -335
  7. package/libs/jquery.js +1 -2
  8. package/libs/jsbarcode/JsBarcode.js +251 -0
  9. package/libs/jsbarcode/barcodes/Barcode.js +17 -0
  10. package/libs/jsbarcode/barcodes/CODE128/CODE128.js +167 -0
  11. package/libs/jsbarcode/barcodes/CODE128/CODE128A.js +42 -0
  12. package/libs/jsbarcode/barcodes/CODE128/CODE128B.js +42 -0
  13. package/libs/jsbarcode/barcodes/CODE128/CODE128C.js +42 -0
  14. package/libs/jsbarcode/barcodes/CODE128/CODE128_AUTO.js +41 -0
  15. package/libs/jsbarcode/barcodes/CODE128/auto.js +73 -0
  16. package/libs/jsbarcode/barcodes/CODE128/constants.js +54 -0
  17. package/libs/jsbarcode/barcodes/CODE128/index.js +29 -0
  18. package/libs/jsbarcode/barcodes/CODE39/index.js +105 -0
  19. package/libs/jsbarcode/barcodes/EAN_UPC/EAN.js +92 -0
  20. package/libs/jsbarcode/barcodes/EAN_UPC/EAN13.js +119 -0
  21. package/libs/jsbarcode/barcodes/EAN_UPC/EAN2.js +58 -0
  22. package/libs/jsbarcode/barcodes/EAN_UPC/EAN5.js +65 -0
  23. package/libs/jsbarcode/barcodes/EAN_UPC/EAN8.js +81 -0
  24. package/libs/jsbarcode/barcodes/EAN_UPC/UPC.js +165 -0
  25. package/libs/jsbarcode/barcodes/EAN_UPC/UPCE.js +185 -0
  26. package/libs/jsbarcode/barcodes/EAN_UPC/constants.js +30 -0
  27. package/libs/jsbarcode/barcodes/EAN_UPC/encoder.js +27 -0
  28. package/libs/jsbarcode/barcodes/EAN_UPC/index.js +39 -0
  29. package/libs/jsbarcode/barcodes/GenericBarcode/index.js +55 -0
  30. package/libs/jsbarcode/barcodes/ITF/ITF.js +69 -0
  31. package/libs/jsbarcode/barcodes/ITF/ITF14.js +55 -0
  32. package/libs/jsbarcode/barcodes/ITF/constants.js +9 -0
  33. package/libs/jsbarcode/barcodes/ITF/index.js +19 -0
  34. package/libs/jsbarcode/barcodes/MSI/MSI.js +74 -0
  35. package/libs/jsbarcode/barcodes/MSI/MSI10.js +33 -0
  36. package/libs/jsbarcode/barcodes/MSI/MSI1010.js +35 -0
  37. package/libs/jsbarcode/barcodes/MSI/MSI11.js +33 -0
  38. package/libs/jsbarcode/barcodes/MSI/MSI1110.js +35 -0
  39. package/libs/jsbarcode/barcodes/MSI/checksums.js +29 -0
  40. package/libs/jsbarcode/barcodes/MSI/index.js +34 -0
  41. package/libs/jsbarcode/barcodes/codabar/index.js +92 -0
  42. package/libs/jsbarcode/barcodes/index.js +33 -0
  43. package/libs/jsbarcode/barcodes/index.tmp.js +33 -0
  44. package/libs/jsbarcode/barcodes/pharmacode/index.js +73 -0
  45. package/libs/jsbarcode/exceptions/ErrorHandler.js +54 -0
  46. package/libs/jsbarcode/exceptions/exceptions.js +67 -0
  47. package/libs/jsbarcode/help/fixOptions.js +17 -0
  48. package/libs/jsbarcode/help/getOptionsFromElement.js +41 -0
  49. package/libs/jsbarcode/help/getRenderProperties.js +108 -0
  50. package/libs/jsbarcode/help/linearizeEncodings.js +27 -0
  51. package/libs/jsbarcode/help/merge.js +11 -0
  52. package/libs/jsbarcode/help/optionsFromStrings.js +27 -0
  53. package/libs/jsbarcode/options/defaults.js +28 -0
  54. package/libs/jsbarcode/renderers/canvas.js +158 -0
  55. package/libs/jsbarcode/renderers/index.js +21 -0
  56. package/libs/jsbarcode/renderers/object.js +30 -0
  57. package/libs/jsbarcode/renderers/shared.js +101 -0
  58. package/libs/jsbarcode/renderers/svg.js +189 -0
  59. package/libs/plugins/jquery.hiwprint.js +9 -10
  60. package/libs/plugins/jquery.minicolors.js +65 -66
  61. package/package.json +1 -3
  62. package/z-index.js +2 -3
@@ -0,0 +1,74 @@
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 _Barcode2 = require("../Barcode.js");
10
+
11
+ var _Barcode3 = _interopRequireDefault(_Barcode2);
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
15
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
+
17
+ 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; }
18
+
19
+ 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
20
+ // https://en.wikipedia.org/wiki/MSI_Barcode#Character_set_and_binary_lookup
21
+
22
+ var MSI = function (_Barcode) {
23
+ _inherits(MSI, _Barcode);
24
+
25
+ function MSI(data, options) {
26
+ _classCallCheck(this, MSI);
27
+
28
+ return _possibleConstructorReturn(this, (MSI.__proto__ || Object.getPrototypeOf(MSI)).call(this, data, options));
29
+ }
30
+
31
+ _createClass(MSI, [{
32
+ key: "encode",
33
+ value: function encode() {
34
+ // Start bits
35
+ var ret = "110";
36
+
37
+ for (var i = 0; i < this.data.length; i++) {
38
+ // Convert the character to binary (always 4 binary digits)
39
+ var digit = parseInt(this.data[i]);
40
+ var bin = digit.toString(2);
41
+ bin = addZeroes(bin, 4 - bin.length);
42
+
43
+ // Add 100 for every zero and 110 for every 1
44
+ for (var b = 0; b < bin.length; b++) {
45
+ ret += bin[b] == "0" ? "100" : "110";
46
+ }
47
+ }
48
+
49
+ // End bits
50
+ ret += "1001";
51
+
52
+ return {
53
+ data: ret,
54
+ text: this.text
55
+ };
56
+ }
57
+ }, {
58
+ key: "valid",
59
+ value: function valid() {
60
+ return this.data.search(/^[0-9]+$/) !== -1;
61
+ }
62
+ }]);
63
+
64
+ return MSI;
65
+ }(_Barcode3.default);
66
+
67
+ function addZeroes(number, n) {
68
+ for (var i = 0; i < n; i++) {
69
+ number = "0" + number;
70
+ }
71
+ return number;
72
+ }
73
+
74
+ exports.default = MSI;
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _MSI2 = require('./MSI.js');
8
+
9
+ var _MSI3 = _interopRequireDefault(_MSI2);
10
+
11
+ var _checksums = require('./checksums.js');
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
15
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
+
17
+ 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; }
18
+
19
+ 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; }
20
+
21
+ var MSI10 = function (_MSI) {
22
+ _inherits(MSI10, _MSI);
23
+
24
+ function MSI10(data, options) {
25
+ _classCallCheck(this, MSI10);
26
+
27
+ return _possibleConstructorReturn(this, (MSI10.__proto__ || Object.getPrototypeOf(MSI10)).call(this, data + (0, _checksums.mod10)(data), options));
28
+ }
29
+
30
+ return MSI10;
31
+ }(_MSI3.default);
32
+
33
+ exports.default = MSI10;
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _MSI2 = require('./MSI.js');
8
+
9
+ var _MSI3 = _interopRequireDefault(_MSI2);
10
+
11
+ var _checksums = require('./checksums.js');
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
15
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
+
17
+ 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; }
18
+
19
+ 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; }
20
+
21
+ var MSI1010 = function (_MSI) {
22
+ _inherits(MSI1010, _MSI);
23
+
24
+ function MSI1010(data, options) {
25
+ _classCallCheck(this, MSI1010);
26
+
27
+ data += (0, _checksums.mod10)(data);
28
+ data += (0, _checksums.mod10)(data);
29
+ return _possibleConstructorReturn(this, (MSI1010.__proto__ || Object.getPrototypeOf(MSI1010)).call(this, data, options));
30
+ }
31
+
32
+ return MSI1010;
33
+ }(_MSI3.default);
34
+
35
+ exports.default = MSI1010;
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _MSI2 = require('./MSI.js');
8
+
9
+ var _MSI3 = _interopRequireDefault(_MSI2);
10
+
11
+ var _checksums = require('./checksums.js');
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
15
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
+
17
+ 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; }
18
+
19
+ 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; }
20
+
21
+ var MSI11 = function (_MSI) {
22
+ _inherits(MSI11, _MSI);
23
+
24
+ function MSI11(data, options) {
25
+ _classCallCheck(this, MSI11);
26
+
27
+ return _possibleConstructorReturn(this, (MSI11.__proto__ || Object.getPrototypeOf(MSI11)).call(this, data + (0, _checksums.mod11)(data), options));
28
+ }
29
+
30
+ return MSI11;
31
+ }(_MSI3.default);
32
+
33
+ exports.default = MSI11;
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _MSI2 = require('./MSI.js');
8
+
9
+ var _MSI3 = _interopRequireDefault(_MSI2);
10
+
11
+ var _checksums = require('./checksums.js');
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
15
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
+
17
+ 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; }
18
+
19
+ 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; }
20
+
21
+ var MSI1110 = function (_MSI) {
22
+ _inherits(MSI1110, _MSI);
23
+
24
+ function MSI1110(data, options) {
25
+ _classCallCheck(this, MSI1110);
26
+
27
+ data += (0, _checksums.mod11)(data);
28
+ data += (0, _checksums.mod10)(data);
29
+ return _possibleConstructorReturn(this, (MSI1110.__proto__ || Object.getPrototypeOf(MSI1110)).call(this, data, options));
30
+ }
31
+
32
+ return MSI1110;
33
+ }(_MSI3.default);
34
+
35
+ exports.default = MSI1110;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.mod10 = mod10;
7
+ exports.mod11 = mod11;
8
+ function mod10(number) {
9
+ var sum = 0;
10
+ for (var i = 0; i < number.length; i++) {
11
+ var n = parseInt(number[i]);
12
+ if ((i + number.length) % 2 === 0) {
13
+ sum += n;
14
+ } else {
15
+ sum += n * 2 % 10 + Math.floor(n * 2 / 10);
16
+ }
17
+ }
18
+ return (10 - sum % 10) % 10;
19
+ }
20
+
21
+ function mod11(number) {
22
+ var sum = 0;
23
+ var weights = [2, 3, 4, 5, 6, 7];
24
+ for (var i = 0; i < number.length; i++) {
25
+ var n = parseInt(number[number.length - 1 - i]);
26
+ sum += weights[i % weights.length] * n;
27
+ }
28
+ return (11 - sum % 11) % 11;
29
+ }
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MSI1110 = exports.MSI1010 = exports.MSI11 = exports.MSI10 = exports.MSI = undefined;
7
+
8
+ var _MSI = require('./MSI.js');
9
+
10
+ var _MSI2 = _interopRequireDefault(_MSI);
11
+
12
+ var _MSI3 = require('./MSI10.js');
13
+
14
+ var _MSI4 = _interopRequireDefault(_MSI3);
15
+
16
+ var _MSI5 = require('./MSI11.js');
17
+
18
+ var _MSI6 = _interopRequireDefault(_MSI5);
19
+
20
+ var _MSI7 = require('./MSI1010.js');
21
+
22
+ var _MSI8 = _interopRequireDefault(_MSI7);
23
+
24
+ var _MSI9 = require('./MSI1110.js');
25
+
26
+ var _MSI10 = _interopRequireDefault(_MSI9);
27
+
28
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
+
30
+ exports.MSI = _MSI2.default;
31
+ exports.MSI10 = _MSI4.default;
32
+ exports.MSI11 = _MSI6.default;
33
+ exports.MSI1010 = _MSI8.default;
34
+ exports.MSI1110 = _MSI10.default;
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.codabar = undefined;
7
+
8
+ 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; }; }();
9
+
10
+ var _Barcode2 = require("../Barcode.js");
11
+
12
+ var _Barcode3 = _interopRequireDefault(_Barcode2);
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
+
18
+ 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; }
19
+
20
+ 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 specification:
21
+ // http://www.barcodeisland.com/codabar.phtml
22
+
23
+ var codabar = function (_Barcode) {
24
+ _inherits(codabar, _Barcode);
25
+
26
+ function codabar(data, options) {
27
+ _classCallCheck(this, codabar);
28
+
29
+ if (data.search(/^[0-9\-\$\:\.\+\/]+$/) === 0) {
30
+ data = "A" + data + "A";
31
+ }
32
+
33
+ var _this = _possibleConstructorReturn(this, (codabar.__proto__ || Object.getPrototypeOf(codabar)).call(this, data.toUpperCase(), options));
34
+
35
+ _this.text = _this.options.text || _this.text.replace(/[A-D]/g, '');
36
+ return _this;
37
+ }
38
+
39
+ _createClass(codabar, [{
40
+ key: "valid",
41
+ value: function valid() {
42
+ return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/) !== -1;
43
+ }
44
+ }, {
45
+ key: "encode",
46
+ value: function encode() {
47
+ var result = [];
48
+ var encodings = this.getEncodings();
49
+ for (var i = 0; i < this.data.length; i++) {
50
+ result.push(encodings[this.data.charAt(i)]);
51
+ // for all characters except the last, append a narrow-space ("0")
52
+ if (i !== this.data.length - 1) {
53
+ result.push("0");
54
+ }
55
+ }
56
+ return {
57
+ text: this.text,
58
+ data: result.join('')
59
+ };
60
+ }
61
+ }, {
62
+ key: "getEncodings",
63
+ value: function getEncodings() {
64
+ return {
65
+ "0": "101010011",
66
+ "1": "101011001",
67
+ "2": "101001011",
68
+ "3": "110010101",
69
+ "4": "101101001",
70
+ "5": "110101001",
71
+ "6": "100101011",
72
+ "7": "100101101",
73
+ "8": "100110101",
74
+ "9": "110100101",
75
+ "-": "101001101",
76
+ "$": "101100101",
77
+ ":": "1101011011",
78
+ "/": "1101101011",
79
+ ".": "1101101101",
80
+ "+": "1011011011",
81
+ "A": "1011001001",
82
+ "B": "1001001011",
83
+ "C": "1010010011",
84
+ "D": "1010011001"
85
+ };
86
+ }
87
+ }]);
88
+
89
+ return codabar;
90
+ }(_Barcode3.default);
91
+
92
+ exports.codabar = codabar;
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _CODE = require('./CODE39/');
8
+
9
+ var _CODE2 = require('./CODE128/');
10
+
11
+ var _EAN_UPC = require('./EAN_UPC/');
12
+
13
+ var _ITF = require('./ITF/');
14
+
15
+ var _MSI = require('./MSI/');
16
+
17
+ var _pharmacode = require('./pharmacode/');
18
+
19
+ var _codabar = require('./codabar');
20
+
21
+ var _GenericBarcode = require('./GenericBarcode/');
22
+
23
+ exports.default = {
24
+ CODE39: _CODE.CODE39,
25
+ CODE128: _CODE2.CODE128, CODE128A: _CODE2.CODE128A, CODE128B: _CODE2.CODE128B, CODE128C: _CODE2.CODE128C,
26
+ EAN13: _EAN_UPC.EAN13, EAN8: _EAN_UPC.EAN8, EAN5: _EAN_UPC.EAN5, EAN2: _EAN_UPC.EAN2, UPC: _EAN_UPC.UPC, UPCE: _EAN_UPC.UPCE,
27
+ ITF14: _ITF.ITF14,
28
+ ITF: _ITF.ITF,
29
+ MSI: _MSI.MSI, MSI10: _MSI.MSI10, MSI11: _MSI.MSI11, MSI1010: _MSI.MSI1010, MSI1110: _MSI.MSI1110,
30
+ pharmacode: _pharmacode.pharmacode,
31
+ codabar: _codabar.codabar,
32
+ GenericBarcode: _GenericBarcode.GenericBarcode
33
+ };
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _CODE = require('./CODE39/');
8
+
9
+ var _CODE2 = require('./CODE128/');
10
+
11
+ var _EAN_UPC = require('./EAN_UPC/');
12
+
13
+ var _ITF = require('./ITF/');
14
+
15
+ var _MSI = require('./MSI/');
16
+
17
+ var _pharmacode = require('./pharmacode/');
18
+
19
+ var _codabar = require('./codabar');
20
+
21
+ var _GenericBarcode = require('./GenericBarcode/');
22
+
23
+ exports.default = {
24
+ CODE39: _CODE.CODE39,
25
+ CODE128: _CODE2.CODE128, CODE128A: _CODE2.CODE128A, CODE128B: _CODE2.CODE128B, CODE128C: _CODE2.CODE128C,
26
+ EAN13: _EAN_UPC.EAN13, EAN8: _EAN_UPC.EAN8, EAN5: _EAN_UPC.EAN5, EAN2: _EAN_UPC.EAN2, UPC: _EAN_UPC.UPC, UPCE: _EAN_UPC.UPCE,
27
+ ITF14: _ITF.ITF14,
28
+ ITF: _ITF.ITF,
29
+ MSI: _MSI.MSI, MSI10: _MSI.MSI10, MSI11: _MSI.MSI11, MSI1010: _MSI.MSI1010, MSI1110: _MSI.MSI1110,
30
+ pharmacode: _pharmacode.pharmacode,
31
+ codabar: _codabar.codabar,
32
+ GenericBarcode: _GenericBarcode.GenericBarcode
33
+ };
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.pharmacode = undefined;
7
+
8
+ 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; }; }();
9
+
10
+ var _Barcode2 = require("../Barcode.js");
11
+
12
+ var _Barcode3 = _interopRequireDefault(_Barcode2);
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
+
18
+ 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; }
19
+
20
+ 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
21
+ // http://www.gomaro.ch/ftproot/Laetus_PHARMA-CODE.pdf
22
+
23
+ var pharmacode = function (_Barcode) {
24
+ _inherits(pharmacode, _Barcode);
25
+
26
+ function pharmacode(data, options) {
27
+ _classCallCheck(this, pharmacode);
28
+
29
+ var _this = _possibleConstructorReturn(this, (pharmacode.__proto__ || Object.getPrototypeOf(pharmacode)).call(this, data, options));
30
+
31
+ _this.number = parseInt(data, 10);
32
+ return _this;
33
+ }
34
+
35
+ _createClass(pharmacode, [{
36
+ key: "encode",
37
+ value: function encode() {
38
+ var z = this.number;
39
+ var result = "";
40
+
41
+ // http://i.imgur.com/RMm4UDJ.png
42
+ // (source: http://www.gomaro.ch/ftproot/Laetus_PHARMA-CODE.pdf, page: 34)
43
+ while (!isNaN(z) && z != 0) {
44
+ if (z % 2 === 0) {
45
+ // Even
46
+ result = "11100" + result;
47
+ z = (z - 2) / 2;
48
+ } else {
49
+ // Odd
50
+ result = "100" + result;
51
+ z = (z - 1) / 2;
52
+ }
53
+ }
54
+
55
+ // Remove the two last zeroes
56
+ result = result.slice(0, -2);
57
+
58
+ return {
59
+ data: result,
60
+ text: this.text
61
+ };
62
+ }
63
+ }, {
64
+ key: "valid",
65
+ value: function valid() {
66
+ return this.number >= 3 && this.number <= 131070;
67
+ }
68
+ }]);
69
+
70
+ return pharmacode;
71
+ }(_Barcode3.default);
72
+
73
+ exports.pharmacode = pharmacode;
@@ -0,0 +1,54 @@
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
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10
+
11
+ /*eslint no-console: 0 */
12
+
13
+ var ErrorHandler = function () {
14
+ function ErrorHandler(api) {
15
+ _classCallCheck(this, ErrorHandler);
16
+
17
+ this.api = api;
18
+ }
19
+
20
+ _createClass(ErrorHandler, [{
21
+ key: "handleCatch",
22
+ value: function handleCatch(e) {
23
+ // If babel supported extending of Error in a correct way instanceof would be used here
24
+ if (e.name === "InvalidInputException") {
25
+ if (this.api._options.valid !== this.api._defaults.valid) {
26
+ this.api._options.valid(false);
27
+ } else {
28
+ throw e.message;
29
+ }
30
+ } else {
31
+ throw e;
32
+ }
33
+
34
+ this.api.render = function () {};
35
+ }
36
+ }, {
37
+ key: "wrapBarcodeCall",
38
+ value: function wrapBarcodeCall(func) {
39
+ try {
40
+ var result = func.apply(undefined, arguments);
41
+ this.api._options.valid(true);
42
+ return result;
43
+ } catch (e) {
44
+ this.handleCatch(e);
45
+
46
+ return this.api;
47
+ }
48
+ }
49
+ }]);
50
+
51
+ return ErrorHandler;
52
+ }();
53
+
54
+ exports.default = ErrorHandler;
@@ -0,0 +1,67 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
+
9
+ 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; }
10
+
11
+ 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; }
12
+
13
+ var InvalidInputException = function (_Error) {
14
+ _inherits(InvalidInputException, _Error);
15
+
16
+ function InvalidInputException(symbology, input) {
17
+ _classCallCheck(this, InvalidInputException);
18
+
19
+ var _this = _possibleConstructorReturn(this, (InvalidInputException.__proto__ || Object.getPrototypeOf(InvalidInputException)).call(this));
20
+
21
+ _this.name = "InvalidInputException";
22
+
23
+ _this.symbology = symbology;
24
+ _this.input = input;
25
+
26
+ _this.message = '"' + _this.input + '" is not a valid input for ' + _this.symbology;
27
+ return _this;
28
+ }
29
+
30
+ return InvalidInputException;
31
+ }(Error);
32
+
33
+ var InvalidElementException = function (_Error2) {
34
+ _inherits(InvalidElementException, _Error2);
35
+
36
+ function InvalidElementException() {
37
+ _classCallCheck(this, InvalidElementException);
38
+
39
+ var _this2 = _possibleConstructorReturn(this, (InvalidElementException.__proto__ || Object.getPrototypeOf(InvalidElementException)).call(this));
40
+
41
+ _this2.name = "InvalidElementException";
42
+ _this2.message = "Not supported type to render on";
43
+ return _this2;
44
+ }
45
+
46
+ return InvalidElementException;
47
+ }(Error);
48
+
49
+ var NoElementException = function (_Error3) {
50
+ _inherits(NoElementException, _Error3);
51
+
52
+ function NoElementException() {
53
+ _classCallCheck(this, NoElementException);
54
+
55
+ var _this3 = _possibleConstructorReturn(this, (NoElementException.__proto__ || Object.getPrototypeOf(NoElementException)).call(this));
56
+
57
+ _this3.name = "NoElementException";
58
+ _this3.message = "No element to render on.";
59
+ return _this3;
60
+ }
61
+
62
+ return NoElementException;
63
+ }(Error);
64
+
65
+ exports.InvalidInputException = InvalidInputException;
66
+ exports.InvalidElementException = InvalidElementException;
67
+ exports.NoElementException = NoElementException;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = fixOptions;
7
+
8
+
9
+ function fixOptions(options) {
10
+ // Fix the margins
11
+ options.marginTop = options.marginTop || options.margin;
12
+ options.marginBottom = options.marginBottom || options.margin;
13
+ options.marginRight = options.marginRight || options.margin;
14
+ options.marginLeft = options.marginLeft || options.margin;
15
+
16
+ return options;
17
+ }