yh-hiprint 2.3.5 → 2.4.0

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 (55) hide show
  1. package/HiprintDesigner.vue +494 -86
  2. package/hooks/useHiprint.js +48 -27
  3. package/libs/jquery.js +1 -0
  4. package/libs/jsbarcode/JsBarcode.js +225 -251
  5. package/libs/jsbarcode/barcodes/Barcode.js +9 -17
  6. package/libs/jsbarcode/barcodes/CODE128/CODE128.js +93 -133
  7. package/libs/jsbarcode/barcodes/CODE128/CODE128A.js +10 -38
  8. package/libs/jsbarcode/barcodes/CODE128/CODE128B.js +10 -38
  9. package/libs/jsbarcode/barcodes/CODE128/CODE128C.js +10 -38
  10. package/libs/jsbarcode/barcodes/CODE128/CODE128_AUTO.js +10 -36
  11. package/libs/jsbarcode/barcodes/CODE128/auto.js +32 -37
  12. package/libs/jsbarcode/barcodes/CODE128/constants.js +47 -30
  13. package/libs/jsbarcode/barcodes/CODE128/index.js +5 -28
  14. package/libs/jsbarcode/barcodes/CODE39/index.js +61 -61
  15. package/libs/jsbarcode/barcodes/EAN_UPC/EAN.js +58 -78
  16. package/libs/jsbarcode/barcodes/EAN_UPC/EAN13.js +66 -95
  17. package/libs/jsbarcode/barcodes/EAN_UPC/EAN2.js +22 -50
  18. package/libs/jsbarcode/barcodes/EAN_UPC/EAN5.js +29 -54
  19. package/libs/jsbarcode/barcodes/EAN_UPC/EAN8.js +42 -66
  20. package/libs/jsbarcode/barcodes/EAN_UPC/UPC.js +92 -125
  21. package/libs/jsbarcode/barcodes/EAN_UPC/UPCE.js +134 -142
  22. package/libs/jsbarcode/barcodes/EAN_UPC/constants.js +32 -21
  23. package/libs/jsbarcode/barcodes/EAN_UPC/encoder.js +11 -18
  24. package/libs/jsbarcode/barcodes/EAN_UPC/index.js +8 -39
  25. package/libs/jsbarcode/barcodes/GenericBarcode/index.js +16 -49
  26. package/libs/jsbarcode/barcodes/ITF/ITF.js +31 -63
  27. package/libs/jsbarcode/barcodes/ITF/ITF14.js +18 -40
  28. package/libs/jsbarcode/barcodes/ITF/constants.js +6 -8
  29. package/libs/jsbarcode/barcodes/ITF/index.js +3 -18
  30. package/libs/jsbarcode/barcodes/MSI/MSI.js +31 -57
  31. package/libs/jsbarcode/barcodes/MSI/MSI10.js +7 -30
  32. package/libs/jsbarcode/barcodes/MSI/MSI1010.js +10 -33
  33. package/libs/jsbarcode/barcodes/MSI/MSI11.js +7 -30
  34. package/libs/jsbarcode/barcodes/MSI/MSI1110.js +10 -33
  35. package/libs/jsbarcode/barcodes/MSI/checksums.js +11 -17
  36. package/libs/jsbarcode/barcodes/MSI/index.js +6 -33
  37. package/libs/jsbarcode/barcodes/codabar/index.js +49 -78
  38. package/libs/jsbarcode/barcodes/index.js +20 -33
  39. package/libs/jsbarcode/barcodes/pharmacode/index.js +32 -62
  40. package/libs/jsbarcode/exceptions/ErrorHandler.js +28 -43
  41. package/libs/jsbarcode/exceptions/exceptions.js +21 -59
  42. package/libs/jsbarcode/help/fixOptions.js +3 -9
  43. package/libs/jsbarcode/help/getOptionsFromElement.js +10 -23
  44. package/libs/jsbarcode/help/getRenderProperties.js +63 -69
  45. package/libs/jsbarcode/help/linearizeEncodings.js +8 -13
  46. package/libs/jsbarcode/help/merge.js +1 -11
  47. package/libs/jsbarcode/help/optionsFromStrings.js +19 -15
  48. package/libs/jsbarcode/options/defaults.js +2 -7
  49. package/libs/jsbarcode/renderers/canvas.js +106 -127
  50. package/libs/jsbarcode/renderers/index.js +4 -20
  51. package/libs/jsbarcode/renderers/object.js +7 -23
  52. package/libs/jsbarcode/renderers/shared.js +32 -39
  53. package/libs/jsbarcode/renderers/svg.js +136 -154
  54. package/package.json +1 -1
  55. package/libs/jsbarcode/barcodes/index.tmp.js +0 -33
@@ -6,12 +6,12 @@ import "../libs/hiprint.config.js";
6
6
  // 样式
7
7
  import "../libs/css/hiprint.css";
8
8
  import "../libs/css/print-lock.css";
9
- import { ref, computed, watch } from "vue";
9
+ import { ref, computed, watch, reactive, nextTick } from "vue";
10
10
 
11
11
  export const hiprint = h;
12
12
  export const defaultElementTypeProvider = p;
13
13
 
14
- export function print(provider = defaultElementTypeProvider, template, ...args) {
14
+ export function print (provider = defaultElementTypeProvider, template, ...args) {
15
15
  hiprint.init({
16
16
  providers: [new provider()],
17
17
  });
@@ -22,7 +22,7 @@ export function print(provider = defaultElementTypeProvider, template, ...args)
22
22
  return hiprintTemplate;
23
23
  }
24
24
 
25
- export function print2(provider = defaultElementTypeProvider, template, ...args) {
25
+ export function print2 (provider = defaultElementTypeProvider, template, ...args) {
26
26
  hiprint.init({
27
27
  providers: [new provider()],
28
28
  });
@@ -33,11 +33,28 @@ export function print2(provider = defaultElementTypeProvider, template, ...args)
33
33
  return hiprintTemplate;
34
34
  }
35
35
 
36
- export function usePaper() {
36
+ export function usePaper () {
37
37
  const paperType = ref("A4");
38
+ const paperTypeName = computed(() => {
39
+ const paperTypeObj = paperTypesObj.find((item) => item.value === paperType.value);
40
+ if (paperTypeObj) {
41
+ return paperTypeObj.label;
42
+ } else {
43
+ return "自定义";
44
+ }
45
+ });
38
46
  const paperWidth = ref(210);
39
47
  const paperHeight = ref(296.6);
40
48
 
49
+ const paperTypesObj = reactive([
50
+ { label: "A3", value: "A3" },
51
+ { label: "A4", value: "A4" },
52
+ { label: "A5", value: "A5" },
53
+ { label: "B3", value: "B3" },
54
+ { label: "B4", value: "B4" },
55
+ { label: "B5", value: "B5" },
56
+ ]);
57
+
41
58
  const paperTypes = {
42
59
  A3: {
43
60
  width: 420,
@@ -65,7 +82,7 @@ export function usePaper() {
65
82
  },
66
83
  };
67
84
 
68
- function setPaper(type, callback) {
85
+ function setPaper (type, callback) {
69
86
  if (type !== "other") {
70
87
  let { width, height } = paperTypes[type];
71
88
  paperWidth.value = width;
@@ -74,33 +91,37 @@ export function usePaper() {
74
91
  callback();
75
92
  }
76
93
 
77
- watch([paperWidth, paperHeight], (width, height) => {
78
- if (width === 420 && height === 297) {
79
- paperType.value = "A3";
80
- } else if (width === 210 && height === 297) {
81
- paperType.value = "A4";
82
- } else if (width === 210 && height === 148) {
83
- paperType.value = "A5";
84
- } else if (width === 500 && height === 353) {
85
- paperType.value = "B3";
86
- } else if (width === 250 && height === 353) {
87
- paperType.value = "B4";
88
- } else if (width === 250 && height === 176) {
89
- paperType.value = "B5";
90
- } else {
91
- paperType.value = "other";
92
- }
94
+ watch([paperWidth, paperHeight], ([width, height], [oldW, oldH]) => {
95
+ nextTick(() => {
96
+ if (width === 420 && height === 297) {
97
+ paperType.value = "A3";
98
+ } else if (width === 210 && height === 297) {
99
+ paperType.value = "A4";
100
+ } else if (width === 210 && height === 148) {
101
+ paperType.value = "A5";
102
+ } else if (width === 500 && height === 353) {
103
+ paperType.value = "B3";
104
+ } else if (width === 250 && height === 353) {
105
+ paperType.value = "B4";
106
+ } else if (width === 250 && height === 176) {
107
+ paperType.value = "B5";
108
+ } else {
109
+ paperType.value = "other";
110
+ }
111
+ });
93
112
  });
94
113
 
95
114
  return {
96
115
  paperType,
97
116
  paperWidth,
98
117
  paperHeight,
118
+ paperTypesObj,
119
+ paperTypeName,
99
120
  setPaper,
100
121
  };
101
122
  }
102
123
 
103
- export function useScale(callback) {
124
+ export function useScale (callback) {
104
125
  const scaleValue = ref(1);
105
126
  const scalePercentage = computed(() => {
106
127
  return `${(scaleValue.value * 100).toFixed(0)}%`;
@@ -111,11 +132,11 @@ export function useScale(callback) {
111
132
  const canZoomOut = computed(() => {
112
133
  return scaleValue.value < 4;
113
134
  });
114
- function zoomIn() {
135
+ function zoomIn () {
115
136
  scaleValue.value = scaleValue.value - 0.1;
116
137
  callback();
117
138
  }
118
- function zoomOut() {
139
+ function zoomOut () {
119
140
  scaleValue.value = scaleValue.value + 0.1;
120
141
  callback();
121
142
  }
@@ -129,9 +150,9 @@ export function useScale(callback) {
129
150
  };
130
151
  }
131
152
 
132
- export function useDataSource(axios) {
153
+ export function useDataSource (axios) {
133
154
  const detailData = ref();
134
- function getDetail(id) {
155
+ function getDetail (id) {
135
156
  return axios
136
157
  .request({
137
158
  url: `/printTemplate/get/${id}`,
@@ -171,7 +192,7 @@ export function useDataSource(axios) {
171
192
  });
172
193
  const dataSourceForm = ref([]);
173
194
  const codeMapDataSource = ref({});
174
- function getDataSourceList() {
195
+ function getDataSourceList () {
175
196
  return axios
176
197
  .request({
177
198
  url: "/printTemplate/getDsList",
package/libs/jquery.js CHANGED
@@ -10616,5 +10616,6 @@ jQuery.trim = function (text) {
10616
10616
  (text + "").replace(rtrim, "$1");
10617
10617
  };
10618
10618
 
10619
+ export default jQuery;
10619
10620
 
10620
10621
  window.hiprintJQuery = jQuery;
@@ -1,251 +1,225 @@
1
- var hiprintJQuery = require("../jquery.js");
2
- var _barcodes = require('./barcodes/');
3
-
4
- var _barcodes2 = _interopRequireDefault(_barcodes);
5
-
6
- var _merge = require('./help/merge.js');
7
-
8
- var _merge2 = _interopRequireDefault(_merge);
9
-
10
- var _linearizeEncodings = require('./help/linearizeEncodings.js');
11
-
12
- var _linearizeEncodings2 = _interopRequireDefault(_linearizeEncodings);
13
-
14
- var _fixOptions = require('./help/fixOptions.js');
15
-
16
- var _fixOptions2 = _interopRequireDefault(_fixOptions);
17
-
18
- var _getRenderProperties = require('./help/getRenderProperties.js');
19
-
20
- var _getRenderProperties2 = _interopRequireDefault(_getRenderProperties);
21
-
22
- var _optionsFromStrings = require('./help/optionsFromStrings.js');
23
-
24
- var _optionsFromStrings2 = _interopRequireDefault(_optionsFromStrings);
25
-
26
- var _ErrorHandler = require('./exceptions/ErrorHandler.js');
27
-
28
- var _ErrorHandler2 = _interopRequireDefault(_ErrorHandler);
29
-
30
- var _exceptions = require('./exceptions/exceptions.js');
31
-
32
- var _defaults = require('./options/defaults.js');
33
-
34
- var _defaults2 = _interopRequireDefault(_defaults);
35
-
36
- function _interopRequireDefault (obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
-
38
- // The protype of the object returned from the JsBarcode() call
39
-
40
-
41
- // Help functions
42
- var API = function API () {};
43
-
44
- // The first call of the library API
45
- // Will return an object with all barcodes calls and the data that is used
46
- // by the renderers
47
-
48
-
49
- // Default values
50
-
51
-
52
- // Exceptions
53
- // Import all the barcodes
54
- var JsBarcode = function JsBarcode (element, text, options) {
55
- var api = new API();
56
-
57
- if (typeof element === "undefined") {
58
- throw Error("No element to render on was provided.");
59
- }
60
-
61
- // Variables that will be pased through the API calls
62
- api._renderProperties = (0, _getRenderProperties2.default)(element);
63
- api._encodings = [];
64
- api._options = _defaults2.default;
65
- api._errorHandler = new _ErrorHandler2.default(api);
66
-
67
- // If text is set, use the simple syntax (render the barcode directly)
68
- if (typeof text !== "undefined") {
69
- options = options || {};
70
-
71
- if (!options.format) {
72
- options.format = autoSelectBarcode();
73
- }
74
-
75
- api.options(options)[options.format](text, options).render();
76
- }
77
-
78
- return api;
79
- };
80
-
81
- // To make tests work TODO: remove
82
- JsBarcode.getModule = function (name) {
83
- return _barcodes2.default[name];
84
- };
85
-
86
- // Register all barcodes
87
- for (var name in _barcodes2.default) {
88
- if (_barcodes2.default.hasOwnProperty(name)) {
89
- // Security check if the propery is a prototype property
90
- registerBarcode(_barcodes2.default, name);
91
- }
92
- }
93
- function registerBarcode (barcodes, name) {
94
- API.prototype[name] = API.prototype[name.toUpperCase()] = API.prototype[name.toLowerCase()] = function (text, options) {
95
- var api = this;
96
- return api._errorHandler.wrapBarcodeCall(function () {
97
- // Ensure text is options.text
98
- options.text = typeof options.text === 'undefined' ? undefined : '' + options.text;
99
-
100
- var newOptions = (0, _merge2.default)(api._options, options);
101
- newOptions = (0, _optionsFromStrings2.default)(newOptions);
102
- var Encoder = barcodes[name];
103
- var encoded = encode(text, Encoder, newOptions);
104
- api._encodings.push(encoded);
105
-
106
- return api;
107
- });
108
- };
109
- }
110
-
111
- // encode() handles the Encoder call and builds the binary string to be rendered
112
- function encode (text, Encoder, options) {
113
- // Ensure that text is a string
114
- text = "" + text;
115
-
116
- var encoder = new Encoder(text, options);
117
-
118
- // If the input is not valid for the encoder, throw error.
119
- // If the valid callback option is set, call it instead of throwing error
120
- if (!encoder.valid()) {
121
- throw new _exceptions.InvalidInputException(encoder.constructor.name, text);
122
- }
123
-
124
- // Make a request for the binary data (and other infromation) that should be rendered
125
- var encoded = encoder.encode();
126
-
127
- // Encodings can be nestled like [[1-1, 1-2], 2, [3-1, 3-2]
128
- // Convert to [1-1, 1-2, 2, 3-1, 3-2]
129
- encoded = (0, _linearizeEncodings2.default)(encoded);
130
-
131
- // Merge
132
- for (var i = 0; i < encoded.length; i++) {
133
- encoded[i].options = (0, _merge2.default)(options, encoded[i].options);
134
- }
135
-
136
- return encoded;
137
- }
138
-
139
- function autoSelectBarcode () {
140
- // If CODE128 exists. Use it
141
- if (_barcodes2.default["CODE128"]) {
142
- return "CODE128";
143
- }
144
-
145
- // Else, take the first (probably only) barcode
146
- return Object.keys(_barcodes2.default)[0];
147
- }
148
-
149
- // Sets global encoder options
150
- // Added to the api by the JsBarcode function
151
- API.prototype.options = function (options) {
152
- this._options = (0, _merge2.default)(this._options, options);
153
- return this;
154
- };
155
-
156
- // Will create a blank space (usually in between barcodes)
157
- API.prototype.blank = function (size) {
158
- var zeroes = new Array(size + 1).join("0");
159
- this._encodings.push({ data: zeroes });
160
- return this;
161
- };
162
-
163
- // Initialize JsBarcode on all HTML elements defined.
164
- API.prototype.init = function () {
165
- // Should do nothing if no elements where found
166
- if (!this._renderProperties) {
167
- return;
168
- }
169
-
170
- // Make sure renderProperies is an array
171
- if (!Array.isArray(this._renderProperties)) {
172
- this._renderProperties = [this._renderProperties];
173
- }
174
-
175
- var renderProperty;
176
- for (var i in this._renderProperties) {
177
- renderProperty = this._renderProperties[i];
178
- var options = (0, _merge2.default)(this._options, renderProperty.options);
179
-
180
- if (options.format == "auto") {
181
- options.format = autoSelectBarcode();
182
- }
183
-
184
- this._errorHandler.wrapBarcodeCall(function () {
185
- var text = options.value;
186
- var Encoder = _barcodes2.default[options.format.toUpperCase()];
187
- var encoded = encode(text, Encoder, options);
188
-
189
- render(renderProperty, encoded, options);
190
- });
191
- }
192
- };
193
-
194
- // The render API call. Calls the real render function.
195
- API.prototype.render = function () {
196
- if (!this._renderProperties) {
197
- throw new _exceptions.NoElementException();
198
- }
199
-
200
- if (Array.isArray(this._renderProperties)) {
201
- for (var i = 0; i < this._renderProperties.length; i++) {
202
- render(this._renderProperties[i], this._encodings, this._options);
203
- }
204
- } else {
205
- render(this._renderProperties, this._encodings, this._options);
206
- }
207
-
208
- return this;
209
- };
210
-
211
- API.prototype._defaults = _defaults2.default;
212
-
213
- // Prepares the encodings and calls the renderer
214
- function render (renderProperties, encodings, options) {
215
- encodings = (0, _linearizeEncodings2.default)(encodings);
216
-
217
- for (var i = 0; i < encodings.length; i++) {
218
- encodings[i].options = (0, _merge2.default)(options, encodings[i].options);
219
- (0, _fixOptions2.default)(encodings[i].options);
220
- }
221
-
222
- (0, _fixOptions2.default)(options);
223
-
224
- var Renderer = renderProperties.renderer;
225
- var renderer = new Renderer(renderProperties.element, encodings, options);
226
- renderer.render();
227
-
228
- if (renderProperties.afterRender) {
229
- renderProperties.afterRender();
230
- }
231
- }
232
-
233
- // Export to browser
234
- if (typeof window !== "undefined") {
235
- window.JsBarcode = JsBarcode;
236
- }
237
-
238
- // Export to jQuery
239
- /*global jQuery */
240
- if (typeof hiprintJQuery !== 'undefined') {
241
- hiprintJQuery.fn.JsBarcode = function (content, options) {
242
- var elementArray = [];
243
- hiprintJQuery(this).each(function () {
244
- elementArray.push(this);
245
- });
246
- return JsBarcode(elementArray, content, options);
247
- };
248
- }
249
-
250
- // Export to commonJS
251
- module.exports = JsBarcode;
1
+ // Import all the barcodes
2
+ import barcodes from './barcodes/';
3
+
4
+ // Help functions
5
+ import merge from './help/merge.js';
6
+ import linearizeEncodings from './help/linearizeEncodings.js';
7
+ import fixOptions from './help/fixOptions.js';
8
+ import getRenderProperties from './help/getRenderProperties.js';
9
+ import optionsFromStrings from './help/optionsFromStrings.js';
10
+
11
+ // Exceptions
12
+ import ErrorHandler from './exceptions/ErrorHandler.js';
13
+ import { InvalidInputException, NoElementException } from './exceptions/exceptions.js';
14
+
15
+ // Default values
16
+ import defaults from './options/defaults.js';
17
+
18
+ // The protype of the object returned from the JsBarcode() call
19
+ let API = function () {};
20
+
21
+ // The first call of the library API
22
+ // Will return an object with all barcodes calls and the data that is used
23
+ // by the renderers
24
+ let JsBarcode = function (element, text, options) {
25
+ var api = new API();
26
+
27
+ if (typeof element === "undefined") {
28
+ throw Error("No element to render on was provided.");
29
+ }
30
+
31
+ // Variables that will be pased through the API calls
32
+ api._renderProperties = getRenderProperties(element);
33
+ api._encodings = [];
34
+ api._options = defaults;
35
+ api._errorHandler = new ErrorHandler(api);
36
+
37
+ // If text is set, use the simple syntax (render the barcode directly)
38
+ if (typeof text !== "undefined") {
39
+ options = options || {};
40
+
41
+ if (!options.format) {
42
+ options.format = autoSelectBarcode();
43
+ }
44
+
45
+ api.options(options)[options.format](text, options).render();
46
+ }
47
+
48
+ return api;
49
+ };
50
+
51
+ // To make tests work TODO: remove
52
+ JsBarcode.getModule = function (name) {
53
+ return barcodes[name];
54
+ };
55
+
56
+ // Register all barcodes
57
+ for (var name in barcodes) {
58
+ if (barcodes.hasOwnProperty(name)) { // Security check if the propery is a prototype property
59
+ registerBarcode(barcodes, name);
60
+ }
61
+ }
62
+ function registerBarcode (barcodes, name) {
63
+ API.prototype[name] =
64
+ API.prototype[name.toUpperCase()] =
65
+ API.prototype[name.toLowerCase()] =
66
+ function (text, options) {
67
+ var api = this;
68
+ return api._errorHandler.wrapBarcodeCall(function () {
69
+ // Ensure text is options.text
70
+ options.text = typeof options.text === 'undefined' ? undefined : '' + options.text;
71
+
72
+ var newOptions = merge(api._options, options);
73
+ newOptions = optionsFromStrings(newOptions);
74
+ var Encoder = barcodes[name];
75
+ var encoded = encode(text, Encoder, newOptions);
76
+ api._encodings.push(encoded);
77
+
78
+ return api;
79
+ });
80
+ };
81
+ }
82
+
83
+ // encode() handles the Encoder call and builds the binary string to be rendered
84
+ function encode (text, Encoder, options) {
85
+ // Ensure that text is a string
86
+ text = "" + text;
87
+
88
+ var encoder = new Encoder(text, options);
89
+
90
+ // If the input is not valid for the encoder, throw error.
91
+ // If the valid callback option is set, call it instead of throwing error
92
+ if (!encoder.valid()) {
93
+ throw new InvalidInputException(encoder.constructor.name, text);
94
+ }
95
+
96
+ // Make a request for the binary data (and other infromation) that should be rendered
97
+ var encoded = encoder.encode();
98
+
99
+ // Encodings can be nestled like [[1-1, 1-2], 2, [3-1, 3-2]
100
+ // Convert to [1-1, 1-2, 2, 3-1, 3-2]
101
+ encoded = linearizeEncodings(encoded);
102
+
103
+ // Merge
104
+ for (let i = 0; i < encoded.length; i++) {
105
+ encoded[i].options = merge(options, encoded[i].options);
106
+ }
107
+
108
+ return encoded;
109
+ }
110
+
111
+ function autoSelectBarcode () {
112
+ // If CODE128 exists. Use it
113
+ if (barcodes["CODE128"]) {
114
+ return "CODE128";
115
+ }
116
+
117
+ // Else, take the first (probably only) barcode
118
+ return Object.keys(barcodes)[0];
119
+ }
120
+
121
+ // Sets global encoder options
122
+ // Added to the api by the JsBarcode function
123
+ API.prototype.options = function (options) {
124
+ this._options = merge(this._options, options);
125
+ return this;
126
+ };
127
+
128
+ // Will create a blank space (usually in between barcodes)
129
+ API.prototype.blank = function (size) {
130
+ const zeroes = new Array(size + 1).join("0");
131
+ this._encodings.push({ data: zeroes });
132
+ return this;
133
+ };
134
+
135
+ // Initialize JsBarcode on all HTML elements defined.
136
+ API.prototype.init = function () {
137
+ // Should do nothing if no elements where found
138
+ if (!this._renderProperties) {
139
+ return;
140
+ }
141
+
142
+ // Make sure renderProperies is an array
143
+ if (!Array.isArray(this._renderProperties)) {
144
+ this._renderProperties = [this._renderProperties];
145
+ }
146
+
147
+ var renderProperty;
148
+ for (let i in this._renderProperties) {
149
+ renderProperty = this._renderProperties[i];
150
+ var options = merge(this._options, renderProperty.options);
151
+
152
+ if (options.format == "auto") {
153
+ options.format = autoSelectBarcode();
154
+ }
155
+
156
+ this._errorHandler.wrapBarcodeCall(function () {
157
+ var text = options.value;
158
+ var Encoder = barcodes[options.format.toUpperCase()];
159
+ var encoded = encode(text, Encoder, options);
160
+
161
+ render(renderProperty, encoded, options);
162
+ });
163
+ }
164
+ };
165
+
166
+
167
+ // The render API call. Calls the real render function.
168
+ API.prototype.render = function () {
169
+ if (!this._renderProperties) {
170
+ throw new NoElementException();
171
+ }
172
+
173
+ if (Array.isArray(this._renderProperties)) {
174
+ for (var i = 0; i < this._renderProperties.length; i++) {
175
+ render(this._renderProperties[i], this._encodings, this._options);
176
+ }
177
+ }
178
+ else {
179
+ render(this._renderProperties, this._encodings, this._options);
180
+ }
181
+
182
+ return this;
183
+ };
184
+
185
+ API.prototype._defaults = defaults;
186
+
187
+ // Prepares the encodings and calls the renderer
188
+ function render (renderProperties, encodings, options) {
189
+ encodings = linearizeEncodings(encodings);
190
+
191
+ for (let i = 0; i < encodings.length; i++) {
192
+ encodings[i].options = merge(options, encodings[i].options);
193
+ fixOptions(encodings[i].options);
194
+ }
195
+
196
+ fixOptions(options);
197
+
198
+ var Renderer = renderProperties.renderer;
199
+ var renderer = new Renderer(renderProperties.element, encodings, options);
200
+ renderer.render();
201
+
202
+ if (renderProperties.afterRender) {
203
+ renderProperties.afterRender();
204
+ }
205
+ }
206
+
207
+ // Export to browser
208
+ if (typeof window !== "undefined") {
209
+ window.JsBarcode = JsBarcode;
210
+ }
211
+
212
+ // Export to jQuery
213
+ /*global jQuery */
214
+ if (typeof hiprintJQuery !== 'undefined') {
215
+ hiprintJQuery.fn.JsBarcode = function (content, options) {
216
+ var elementArray = [];
217
+ hiprintJQuery(this).each(function () {
218
+ elementArray.push(this);
219
+ });
220
+ return JsBarcode(elementArray, content, options);
221
+ };
222
+ }
223
+
224
+ // Export to commonJS
225
+ export default JsBarcode;