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.
- package/HiprintDesigner.vue +5 -5
- package/column-field.js +1 -3
- package/designer.vue +4 -4
- package/font-size.js +2 -3
- package/index.js +1 -2
- package/libs/hiprint.bundle.js +331 -335
- package/libs/jquery.js +1 -2
- package/libs/jsbarcode/JsBarcode.js +251 -0
- package/libs/jsbarcode/barcodes/Barcode.js +17 -0
- package/libs/jsbarcode/barcodes/CODE128/CODE128.js +167 -0
- package/libs/jsbarcode/barcodes/CODE128/CODE128A.js +42 -0
- package/libs/jsbarcode/barcodes/CODE128/CODE128B.js +42 -0
- package/libs/jsbarcode/barcodes/CODE128/CODE128C.js +42 -0
- package/libs/jsbarcode/barcodes/CODE128/CODE128_AUTO.js +41 -0
- package/libs/jsbarcode/barcodes/CODE128/auto.js +73 -0
- package/libs/jsbarcode/barcodes/CODE128/constants.js +54 -0
- package/libs/jsbarcode/barcodes/CODE128/index.js +29 -0
- package/libs/jsbarcode/barcodes/CODE39/index.js +105 -0
- package/libs/jsbarcode/barcodes/EAN_UPC/EAN.js +92 -0
- package/libs/jsbarcode/barcodes/EAN_UPC/EAN13.js +119 -0
- package/libs/jsbarcode/barcodes/EAN_UPC/EAN2.js +58 -0
- package/libs/jsbarcode/barcodes/EAN_UPC/EAN5.js +65 -0
- package/libs/jsbarcode/barcodes/EAN_UPC/EAN8.js +81 -0
- package/libs/jsbarcode/barcodes/EAN_UPC/UPC.js +165 -0
- package/libs/jsbarcode/barcodes/EAN_UPC/UPCE.js +185 -0
- package/libs/jsbarcode/barcodes/EAN_UPC/constants.js +30 -0
- package/libs/jsbarcode/barcodes/EAN_UPC/encoder.js +27 -0
- package/libs/jsbarcode/barcodes/EAN_UPC/index.js +39 -0
- package/libs/jsbarcode/barcodes/GenericBarcode/index.js +55 -0
- package/libs/jsbarcode/barcodes/ITF/ITF.js +69 -0
- package/libs/jsbarcode/barcodes/ITF/ITF14.js +55 -0
- package/libs/jsbarcode/barcodes/ITF/constants.js +9 -0
- package/libs/jsbarcode/barcodes/ITF/index.js +19 -0
- package/libs/jsbarcode/barcodes/MSI/MSI.js +74 -0
- package/libs/jsbarcode/barcodes/MSI/MSI10.js +33 -0
- package/libs/jsbarcode/barcodes/MSI/MSI1010.js +35 -0
- package/libs/jsbarcode/barcodes/MSI/MSI11.js +33 -0
- package/libs/jsbarcode/barcodes/MSI/MSI1110.js +35 -0
- package/libs/jsbarcode/barcodes/MSI/checksums.js +29 -0
- package/libs/jsbarcode/barcodes/MSI/index.js +34 -0
- package/libs/jsbarcode/barcodes/codabar/index.js +92 -0
- package/libs/jsbarcode/barcodes/index.js +33 -0
- package/libs/jsbarcode/barcodes/index.tmp.js +33 -0
- package/libs/jsbarcode/barcodes/pharmacode/index.js +73 -0
- package/libs/jsbarcode/exceptions/ErrorHandler.js +54 -0
- package/libs/jsbarcode/exceptions/exceptions.js +67 -0
- package/libs/jsbarcode/help/fixOptions.js +17 -0
- package/libs/jsbarcode/help/getOptionsFromElement.js +41 -0
- package/libs/jsbarcode/help/getRenderProperties.js +108 -0
- package/libs/jsbarcode/help/linearizeEncodings.js +27 -0
- package/libs/jsbarcode/help/merge.js +11 -0
- package/libs/jsbarcode/help/optionsFromStrings.js +27 -0
- package/libs/jsbarcode/options/defaults.js +28 -0
- package/libs/jsbarcode/renderers/canvas.js +158 -0
- package/libs/jsbarcode/renderers/index.js +21 -0
- package/libs/jsbarcode/renderers/object.js +30 -0
- package/libs/jsbarcode/renderers/shared.js +101 -0
- package/libs/jsbarcode/renderers/svg.js +189 -0
- package/libs/plugins/jquery.hiwprint.js +9 -10
- package/libs/plugins/jquery.minicolors.js +65 -66
- package/package.json +1 -3
- package/z-index.js +2 -3
|
@@ -0,0 +1,189 @@
|
|
|
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 _merge = require("../help/merge.js");
|
|
10
|
+
|
|
11
|
+
var _merge2 = _interopRequireDefault(_merge);
|
|
12
|
+
|
|
13
|
+
var _shared = require("./shared.js");
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
|
|
17
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
18
|
+
|
|
19
|
+
var svgns = "http://www.w3.org/2000/svg";
|
|
20
|
+
|
|
21
|
+
var SVGRenderer = function () {
|
|
22
|
+
function SVGRenderer(svg, encodings, options) {
|
|
23
|
+
_classCallCheck(this, SVGRenderer);
|
|
24
|
+
|
|
25
|
+
this.svg = svg;
|
|
26
|
+
this.encodings = encodings;
|
|
27
|
+
this.options = options;
|
|
28
|
+
this.document = options.xmlDocument || document;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
_createClass(SVGRenderer, [{
|
|
32
|
+
key: "render",
|
|
33
|
+
value: function render() {
|
|
34
|
+
var currentX = this.options.marginLeft;
|
|
35
|
+
|
|
36
|
+
this.prepareSVG();
|
|
37
|
+
for (var i = 0; i < this.encodings.length; i++) {
|
|
38
|
+
var encoding = this.encodings[i];
|
|
39
|
+
var encodingOptions = (0, _merge2.default)(this.options, encoding.options);
|
|
40
|
+
|
|
41
|
+
var group = this.createGroup(currentX, encodingOptions.marginTop, this.svg);
|
|
42
|
+
|
|
43
|
+
this.setGroupOptions(group, encodingOptions);
|
|
44
|
+
|
|
45
|
+
this.drawSvgBarcode(group, encodingOptions, encoding);
|
|
46
|
+
this.drawSVGText(group, encodingOptions, encoding);
|
|
47
|
+
|
|
48
|
+
currentX += encoding.width;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
key: "prepareSVG",
|
|
53
|
+
value: function prepareSVG() {
|
|
54
|
+
// Clear the SVG
|
|
55
|
+
while (this.svg.firstChild) {
|
|
56
|
+
this.svg.removeChild(this.svg.firstChild);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
(0, _shared.calculateEncodingAttributes)(this.encodings, this.options);
|
|
60
|
+
var totalWidth = (0, _shared.getTotalWidthOfEncodings)(this.encodings);
|
|
61
|
+
var maxHeight = (0, _shared.getMaximumHeightOfEncodings)(this.encodings);
|
|
62
|
+
|
|
63
|
+
var width = totalWidth + this.options.marginLeft + this.options.marginRight;
|
|
64
|
+
this.setSvgAttributes(width, maxHeight);
|
|
65
|
+
|
|
66
|
+
if (this.options.background) {
|
|
67
|
+
this.drawRect(0, 0, width, maxHeight, this.svg).setAttribute("style", "fill:" + this.options.background + ";");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
key: "drawSvgBarcode",
|
|
72
|
+
value: function drawSvgBarcode(parent, options, encoding) {
|
|
73
|
+
var binary = encoding.data;
|
|
74
|
+
|
|
75
|
+
// Creates the barcode out of the encoded binary
|
|
76
|
+
var yFrom;
|
|
77
|
+
if (options.textPosition == "top") {
|
|
78
|
+
yFrom = options.fontSize + options.textMargin;
|
|
79
|
+
} else {
|
|
80
|
+
yFrom = 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
var barWidth = 0;
|
|
84
|
+
var x = 0;
|
|
85
|
+
for (var b = 0; b < binary.length; b++) {
|
|
86
|
+
x = b * options.width + encoding.barcodePadding;
|
|
87
|
+
|
|
88
|
+
if (binary[b] === "1") {
|
|
89
|
+
barWidth++;
|
|
90
|
+
} else if (barWidth > 0) {
|
|
91
|
+
this.drawRect(x - options.width * barWidth, yFrom, options.width * barWidth, options.height, parent);
|
|
92
|
+
barWidth = 0;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Last draw is needed since the barcode ends with 1
|
|
97
|
+
if (barWidth > 0) {
|
|
98
|
+
this.drawRect(x - options.width * (barWidth - 1), yFrom, options.width * barWidth, options.height, parent);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
key: "drawSVGText",
|
|
103
|
+
value: function drawSVGText(parent, options, encoding) {
|
|
104
|
+
var textElem = this.document.createElementNS(svgns, 'text');
|
|
105
|
+
|
|
106
|
+
// Draw the text if displayValue is set
|
|
107
|
+
if (options.displayValue) {
|
|
108
|
+
var x, y;
|
|
109
|
+
|
|
110
|
+
textElem.setAttribute("style", "font:" + options.fontOptions + " " + options.fontSize + "px " + options.font);
|
|
111
|
+
|
|
112
|
+
if (options.textPosition == "top") {
|
|
113
|
+
y = options.fontSize - options.textMargin;
|
|
114
|
+
} else {
|
|
115
|
+
y = options.height + options.textMargin + options.fontSize;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Draw the text in the correct X depending on the textAlign option
|
|
119
|
+
if (options.textAlign == "left" || encoding.barcodePadding > 0) {
|
|
120
|
+
x = 0;
|
|
121
|
+
textElem.setAttribute("text-anchor", "start");
|
|
122
|
+
} else if (options.textAlign == "right") {
|
|
123
|
+
x = encoding.width - 1;
|
|
124
|
+
textElem.setAttribute("text-anchor", "end");
|
|
125
|
+
}
|
|
126
|
+
// In all other cases, center the text
|
|
127
|
+
else {
|
|
128
|
+
x = encoding.width / 2;
|
|
129
|
+
textElem.setAttribute("text-anchor", "middle");
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
textElem.setAttribute("x", x);
|
|
133
|
+
textElem.setAttribute("y", y);
|
|
134
|
+
|
|
135
|
+
textElem.appendChild(this.document.createTextNode(encoding.text));
|
|
136
|
+
|
|
137
|
+
parent.appendChild(textElem);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}, {
|
|
141
|
+
key: "setSvgAttributes",
|
|
142
|
+
value: function setSvgAttributes(width, height) {
|
|
143
|
+
var svg = this.svg;
|
|
144
|
+
svg.setAttribute("width", width + "px");
|
|
145
|
+
svg.setAttribute("height", height + "px");
|
|
146
|
+
svg.setAttribute("x", "0px");
|
|
147
|
+
svg.setAttribute("y", "0px");
|
|
148
|
+
svg.setAttribute("viewBox", "0 0 " + width + " " + height);
|
|
149
|
+
|
|
150
|
+
svg.setAttribute("xmlns", svgns);
|
|
151
|
+
svg.setAttribute("version", "1.1");
|
|
152
|
+
|
|
153
|
+
svg.setAttribute("style", "transform: translate(0,0)");
|
|
154
|
+
}
|
|
155
|
+
}, {
|
|
156
|
+
key: "createGroup",
|
|
157
|
+
value: function createGroup(x, y, parent) {
|
|
158
|
+
var group = this.document.createElementNS(svgns, 'g');
|
|
159
|
+
group.setAttribute("transform", "translate(" + x + ", " + y + ")");
|
|
160
|
+
|
|
161
|
+
parent.appendChild(group);
|
|
162
|
+
|
|
163
|
+
return group;
|
|
164
|
+
}
|
|
165
|
+
}, {
|
|
166
|
+
key: "setGroupOptions",
|
|
167
|
+
value: function setGroupOptions(group, options) {
|
|
168
|
+
group.setAttribute("style", "fill:" + options.lineColor + ";");
|
|
169
|
+
}
|
|
170
|
+
}, {
|
|
171
|
+
key: "drawRect",
|
|
172
|
+
value: function drawRect(x, y, width, height, parent) {
|
|
173
|
+
var rect = this.document.createElementNS(svgns, 'rect');
|
|
174
|
+
|
|
175
|
+
rect.setAttribute("x", x);
|
|
176
|
+
rect.setAttribute("y", y);
|
|
177
|
+
rect.setAttribute("width", width);
|
|
178
|
+
rect.setAttribute("height", height);
|
|
179
|
+
|
|
180
|
+
parent.appendChild(rect);
|
|
181
|
+
|
|
182
|
+
return rect;
|
|
183
|
+
}
|
|
184
|
+
}]);
|
|
185
|
+
|
|
186
|
+
return SVGRenderer;
|
|
187
|
+
}();
|
|
188
|
+
|
|
189
|
+
exports.default = SVGRenderer;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
$.fn.hiwprint = function (options) {
|
|
1
|
+
hiprintJQuery.fn.hiwprint = function (options) {
|
|
3
2
|
var usedFrame = document.getElementById("hiwprint_iframe");
|
|
4
3
|
if (usedFrame) usedFrame.parentNode.removeChild(usedFrame);
|
|
5
|
-
var opt =
|
|
4
|
+
var opt = hiprintJQuery.extend({}, hiprintJQuery.fn.hiwprint.defaults, options);
|
|
6
5
|
var $element = this;
|
|
7
|
-
var $iframe =
|
|
6
|
+
var $iframe = hiprintJQuery(
|
|
8
7
|
'<iframe id="hiwprint_iframe" style="visibility: hidden; height: 0; width: 0; position: absolute;"></iframe>'
|
|
9
8
|
);
|
|
10
9
|
var css = "";
|
|
@@ -12,12 +11,12 @@ $.fn.hiwprint = function (options) {
|
|
|
12
11
|
if (opt.styleHandler) {
|
|
13
12
|
css += opt.styleHandler();
|
|
14
13
|
}
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
if (
|
|
18
|
-
css += '<link rel="stylesheet" type="text/css" media="print" href="' +
|
|
14
|
+
if (hiprintJQuery("link[media=print]").length > 0) {
|
|
15
|
+
hiprintJQuery("link[media=print]").each(function () {
|
|
16
|
+
if (hiprintJQuery(this).attr("href").indexOf("print-lock.css") >= 0) {
|
|
17
|
+
css += '<link rel="stylesheet" type="text/css" media="print" href="' + hiprintJQuery(this).attr("href") + '">';
|
|
19
18
|
// ↑若加上media="print",仅对浏览器打印时有效 所以查看iframe页面时样式无效
|
|
20
|
-
css += '<link rel="stylesheet" type="text/css" href="' +
|
|
19
|
+
css += '<link rel="stylesheet" type="text/css" href="' + hiprintJQuery(this).attr("href") + '">';
|
|
21
20
|
}
|
|
22
21
|
});
|
|
23
22
|
}
|
|
@@ -46,7 +45,7 @@ $.fn.hiwprint = function (options) {
|
|
|
46
45
|
$iframe.appendTo("body");
|
|
47
46
|
};
|
|
48
47
|
|
|
49
|
-
|
|
48
|
+
hiprintJQuery.fn.hiwprint.defaults = {
|
|
50
49
|
importCss: true,
|
|
51
50
|
printContainer: true,
|
|
52
51
|
callback: null,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import $ from "../jquery";
|
|
2
1
|
//
|
|
3
2
|
// jQuery MiniColors: A tiny color picker built on jQuery
|
|
4
3
|
//
|
|
@@ -8,7 +7,7 @@ import $ from "../jquery";
|
|
|
8
7
|
//
|
|
9
8
|
|
|
10
9
|
// Defaults
|
|
11
|
-
|
|
10
|
+
hiprintJQuery.minicolors = {
|
|
12
11
|
defaults: {
|
|
13
12
|
animationSpeed: 50,
|
|
14
13
|
animationEasing: 'swing',
|
|
@@ -32,94 +31,94 @@ $.minicolors = {
|
|
|
32
31
|
};
|
|
33
32
|
|
|
34
33
|
// Public methods
|
|
35
|
-
|
|
34
|
+
hiprintJQuery.extend(hiprintJQuery.fn, {
|
|
36
35
|
minicolors: function (method, data) {
|
|
37
36
|
|
|
38
37
|
switch (method) {
|
|
39
38
|
// Destroy the control
|
|
40
39
|
case 'destroy':
|
|
41
|
-
|
|
42
|
-
destroy(
|
|
40
|
+
hiprintJQuery(this).each(function () {
|
|
41
|
+
destroy(hiprintJQuery(this));
|
|
43
42
|
});
|
|
44
|
-
return
|
|
43
|
+
return hiprintJQuery(this);
|
|
45
44
|
|
|
46
45
|
// Hide the color picker
|
|
47
46
|
case 'hide':
|
|
48
47
|
hide();
|
|
49
|
-
return
|
|
48
|
+
return hiprintJQuery(this);
|
|
50
49
|
|
|
51
50
|
// Get/set opacity
|
|
52
51
|
case 'opacity':
|
|
53
52
|
// Getter
|
|
54
53
|
if (data === undefined) {
|
|
55
54
|
// Getter
|
|
56
|
-
return
|
|
55
|
+
return hiprintJQuery(this).attr('data-opacity');
|
|
57
56
|
} else {
|
|
58
57
|
// Setter
|
|
59
|
-
|
|
60
|
-
updateFromInput(
|
|
58
|
+
hiprintJQuery(this).each(function () {
|
|
59
|
+
updateFromInput(hiprintJQuery(this).attr('data-opacity', data));
|
|
61
60
|
});
|
|
62
61
|
}
|
|
63
|
-
return
|
|
62
|
+
return hiprintJQuery(this);
|
|
64
63
|
|
|
65
64
|
// Get an RGB(A) object based on the current color/opacity
|
|
66
65
|
case 'rgbObject':
|
|
67
|
-
return rgbObject(
|
|
66
|
+
return rgbObject(hiprintJQuery(this), method === 'rgbaObject');
|
|
68
67
|
|
|
69
68
|
// Get an RGB(A) string based on the current color/opacity
|
|
70
69
|
case 'rgbString':
|
|
71
70
|
case 'rgbaString':
|
|
72
|
-
return rgbString(
|
|
71
|
+
return rgbString(hiprintJQuery(this), method === 'rgbaString');
|
|
73
72
|
|
|
74
73
|
// Get/set settings on the fly
|
|
75
74
|
case 'settings':
|
|
76
75
|
if (data === undefined) {
|
|
77
|
-
return
|
|
76
|
+
return hiprintJQuery(this).data('minicolors-settings');
|
|
78
77
|
} else {
|
|
79
78
|
// Setter
|
|
80
|
-
|
|
81
|
-
var settings =
|
|
82
|
-
destroy(
|
|
83
|
-
|
|
79
|
+
hiprintJQuery(this).each(function () {
|
|
80
|
+
var settings = hiprintJQuery(this).data('minicolors-settings') || {};
|
|
81
|
+
destroy(hiprintJQuery(this));
|
|
82
|
+
hiprintJQuery(this).minicolors(hiprintJQuery.extend(true, settings, data));
|
|
84
83
|
});
|
|
85
84
|
}
|
|
86
|
-
return
|
|
85
|
+
return hiprintJQuery(this);
|
|
87
86
|
|
|
88
87
|
// Show the color picker
|
|
89
88
|
case 'show':
|
|
90
|
-
show(
|
|
91
|
-
return
|
|
89
|
+
show(hiprintJQuery(this).eq(0));
|
|
90
|
+
return hiprintJQuery(this);
|
|
92
91
|
|
|
93
92
|
// Get/set the hex color value
|
|
94
93
|
case 'value':
|
|
95
94
|
if (data === undefined) {
|
|
96
95
|
// Getter
|
|
97
|
-
return
|
|
96
|
+
return hiprintJQuery(this).val();
|
|
98
97
|
} else {
|
|
99
98
|
// Setter
|
|
100
|
-
|
|
99
|
+
hiprintJQuery(this).each(function () {
|
|
101
100
|
if (typeof (data) === 'object' && data !== null) {
|
|
102
101
|
if (data.opacity !== undefined) {
|
|
103
|
-
|
|
102
|
+
hiprintJQuery(this).attr('data-opacity', keepWithin(data.opacity, 0, 1));
|
|
104
103
|
}
|
|
105
104
|
if (data.color) {
|
|
106
|
-
|
|
105
|
+
hiprintJQuery(this).val(data.color);
|
|
107
106
|
}
|
|
108
107
|
} else {
|
|
109
|
-
|
|
108
|
+
hiprintJQuery(this).val(data);
|
|
110
109
|
}
|
|
111
|
-
updateFromInput(
|
|
110
|
+
updateFromInput(hiprintJQuery(this));
|
|
112
111
|
});
|
|
113
112
|
}
|
|
114
|
-
return
|
|
113
|
+
return hiprintJQuery(this);
|
|
115
114
|
|
|
116
115
|
// Initializes the control
|
|
117
116
|
default:
|
|
118
117
|
if (method !== 'create') data = method;
|
|
119
|
-
|
|
120
|
-
init(
|
|
118
|
+
hiprintJQuery(this).each(function () {
|
|
119
|
+
init(hiprintJQuery(this), data);
|
|
121
120
|
});
|
|
122
|
-
return
|
|
121
|
+
return hiprintJQuery(this);
|
|
123
122
|
|
|
124
123
|
}
|
|
125
124
|
|
|
@@ -128,8 +127,8 @@ $.extend($.fn, {
|
|
|
128
127
|
|
|
129
128
|
// Initialize input elements
|
|
130
129
|
function init (input, settings) {
|
|
131
|
-
var minicolors =
|
|
132
|
-
var defaults =
|
|
130
|
+
var minicolors = hiprintJQuery('<div class="minicolors" />');
|
|
131
|
+
var defaults = hiprintJQuery.minicolors.defaults;
|
|
133
132
|
var name;
|
|
134
133
|
var size;
|
|
135
134
|
var swatches;
|
|
@@ -142,7 +141,7 @@ function init (input, settings) {
|
|
|
142
141
|
if (input.data('minicolors-initialized')) return;
|
|
143
142
|
|
|
144
143
|
// Handle settings
|
|
145
|
-
settings =
|
|
144
|
+
settings = hiprintJQuery.extend(true, {}, defaults, settings);
|
|
146
145
|
|
|
147
146
|
// The wrapper
|
|
148
147
|
minicolors
|
|
@@ -151,7 +150,7 @@ function init (input, settings) {
|
|
|
151
150
|
|
|
152
151
|
// Custom positioning
|
|
153
152
|
if (settings.position !== undefined) {
|
|
154
|
-
|
|
153
|
+
hiprintJQuery.each(settings.position.split(' '), function () {
|
|
155
154
|
minicolors.addClass('minicolors-position-' + this);
|
|
156
155
|
});
|
|
157
156
|
}
|
|
@@ -201,7 +200,7 @@ function init (input, settings) {
|
|
|
201
200
|
// Swatches
|
|
202
201
|
if (settings.swatches && settings.swatches.length !== 0) {
|
|
203
202
|
panel.addClass('minicolors-with-swatches');
|
|
204
|
-
swatches =
|
|
203
|
+
swatches = hiprintJQuery('<ul class="minicolors-swatches"></ul>')
|
|
205
204
|
.appendTo(panel);
|
|
206
205
|
for (i = 0; i < settings.swatches.length; ++i) {
|
|
207
206
|
// allow for custom objects as swatches
|
|
@@ -214,7 +213,7 @@ function init (input, settings) {
|
|
|
214
213
|
}
|
|
215
214
|
swatchString = swatch;
|
|
216
215
|
swatch = isRgb(swatch) ? parseRgb(swatch, true) : hex2rgb(parseHex(swatch, true));
|
|
217
|
-
|
|
216
|
+
hiprintJQuery('<li class="minicolors-swatch minicolors-sprite"><span class="minicolors-swatch-color"></span></li>')
|
|
218
217
|
.attr("title", name)
|
|
219
218
|
.appendTo(swatches)
|
|
220
219
|
.data('swatch-color', swatchString)
|
|
@@ -281,8 +280,8 @@ function show (input) {
|
|
|
281
280
|
|
|
282
281
|
// Hides all dropdown panels
|
|
283
282
|
function hide () {
|
|
284
|
-
|
|
285
|
-
var minicolors =
|
|
283
|
+
hiprintJQuery('.minicolors-focus').each(function () {
|
|
284
|
+
var minicolors = hiprintJQuery(this);
|
|
286
285
|
var input = minicolors.find('.minicolors-input');
|
|
287
286
|
var panel = minicolors.find('.minicolors-panel');
|
|
288
287
|
var settings = input.data('minicolors-settings');
|
|
@@ -593,12 +592,12 @@ function updateFromInput (input, preserveInputValue) {
|
|
|
593
592
|
hsb = hex2hsb(hex);
|
|
594
593
|
|
|
595
594
|
// Get array of lowercase keywords
|
|
596
|
-
keywords = !settings.keywords ? [] :
|
|
595
|
+
keywords = !settings.keywords ? [] : hiprintJQuery.map(settings.keywords.split(','), function (a) {
|
|
597
596
|
return a.toLowerCase().trim();
|
|
598
597
|
});
|
|
599
598
|
|
|
600
599
|
// Set color string
|
|
601
|
-
if (input.val() !== '' &&
|
|
600
|
+
if (input.val() !== '' && hiprintJQuery.inArray(input.val().toLowerCase(), keywords) > -1) {
|
|
602
601
|
value = convertCase(input.val());
|
|
603
602
|
} else {
|
|
604
603
|
value = isRgb(input.val()) ? parseRgb(input.val()) : hex;
|
|
@@ -767,26 +766,26 @@ function doChange (input, value, opacity) {
|
|
|
767
766
|
// Generates an RGB(A) object based on the input's value
|
|
768
767
|
function rgbObject (input) {
|
|
769
768
|
var rgb,
|
|
770
|
-
opacity =
|
|
771
|
-
if (isRgb(
|
|
772
|
-
rgb = parseRgb(
|
|
769
|
+
opacity = hiprintJQuery(input).attr('data-opacity');
|
|
770
|
+
if (isRgb(hiprintJQuery(input).val())) {
|
|
771
|
+
rgb = parseRgb(hiprintJQuery(input).val(), true);
|
|
773
772
|
} else {
|
|
774
|
-
var hex = parseHex(
|
|
773
|
+
var hex = parseHex(hiprintJQuery(input).val(), true);
|
|
775
774
|
rgb = hex2rgb(hex);
|
|
776
775
|
}
|
|
777
776
|
if (!rgb) return null;
|
|
778
|
-
if (opacity !== undefined)
|
|
777
|
+
if (opacity !== undefined) hiprintJQuery.extend(rgb, { a: parseFloat(opacity) });
|
|
779
778
|
return rgb;
|
|
780
779
|
}
|
|
781
780
|
|
|
782
781
|
// Generates an RGB(A) string based on the input's value
|
|
783
782
|
function rgbString (input, alpha) {
|
|
784
783
|
var rgb,
|
|
785
|
-
opacity =
|
|
786
|
-
if (isRgb(
|
|
787
|
-
rgb = parseRgb(
|
|
784
|
+
opacity = hiprintJQuery(input).attr('data-opacity');
|
|
785
|
+
if (isRgb(hiprintJQuery(input).val())) {
|
|
786
|
+
rgb = parseRgb(hiprintJQuery(input).val(), true);
|
|
788
787
|
} else {
|
|
789
|
-
var hex = parseHex(
|
|
788
|
+
var hex = parseHex(hiprintJQuery(input).val(), true);
|
|
790
789
|
rgb = hex2rgb(hex);
|
|
791
790
|
}
|
|
792
791
|
if (!rgb) return null;
|
|
@@ -926,7 +925,7 @@ function rgb2hex (rgb) {
|
|
|
926
925
|
rgb.g.toString(16),
|
|
927
926
|
rgb.b.toString(16)
|
|
928
927
|
];
|
|
929
|
-
|
|
928
|
+
hiprintJQuery.each(hex, function (nr, val) {
|
|
930
929
|
if (val.length === 1) hex[nr] = '0' + val;
|
|
931
930
|
});
|
|
932
931
|
return '#' + hex.join('');
|
|
@@ -983,51 +982,51 @@ function hex2rgb (hex) {
|
|
|
983
982
|
}
|
|
984
983
|
|
|
985
984
|
// Handle events
|
|
986
|
-
|
|
985
|
+
hiprintJQuery([document])
|
|
987
986
|
// Hide on clicks outside of the control
|
|
988
987
|
.on('mousedown.minicolors touchstart.minicolors', function (event) {
|
|
989
|
-
if (
|
|
988
|
+
if (!hiprintJQuery(event.target).parents().add(event.target).hasClass('minicolors')) {
|
|
990
989
|
hide();
|
|
991
990
|
}
|
|
992
991
|
})
|
|
993
992
|
// Start moving
|
|
994
993
|
.on('mousedown.minicolors touchstart.minicolors', '.minicolors-grid, .minicolors-slider, .minicolors-opacity-slider', function (event) {
|
|
995
|
-
var target =
|
|
994
|
+
var target = hiprintJQuery(this);
|
|
996
995
|
event.preventDefault();
|
|
997
|
-
|
|
996
|
+
hiprintJQuery(event.delegateTarget).data('minicolors-target', target);
|
|
998
997
|
move(target, event, true);
|
|
999
998
|
})
|
|
1000
999
|
// Move pickers
|
|
1001
1000
|
.on('mousemove.minicolors touchmove.minicolors', function (event) {
|
|
1002
|
-
var target =
|
|
1001
|
+
var target = hiprintJQuery(event.delegateTarget).data('minicolors-target');
|
|
1003
1002
|
if (target) move(target, event);
|
|
1004
1003
|
})
|
|
1005
1004
|
// Stop moving
|
|
1006
1005
|
.on('mouseup.minicolors touchend.minicolors', function () {
|
|
1007
|
-
|
|
1006
|
+
hiprintJQuery(this).removeData('minicolors-target');
|
|
1008
1007
|
})
|
|
1009
1008
|
// Selected a swatch
|
|
1010
1009
|
.on('click.minicolors', '.minicolors-swatches li', function (event) {
|
|
1011
1010
|
event.preventDefault();
|
|
1012
|
-
var target =
|
|
1011
|
+
var target = hiprintJQuery(this), input = target.parents('.minicolors').find('.minicolors-input'), color = target.data('swatch-color');
|
|
1013
1012
|
updateInput(input, color, getAlpha(color));
|
|
1014
1013
|
updateFromInput(input);
|
|
1015
1014
|
})
|
|
1016
1015
|
// Show panel when swatch is clicked
|
|
1017
1016
|
.on('mousedown.minicolors touchstart.minicolors', '.minicolors-input-swatch', function (event) {
|
|
1018
|
-
var input =
|
|
1017
|
+
var input = hiprintJQuery(this).parent().find('.minicolors-input');
|
|
1019
1018
|
event.preventDefault();
|
|
1020
1019
|
show(input);
|
|
1021
1020
|
})
|
|
1022
1021
|
// Show on focus
|
|
1023
1022
|
.on('focus.minicolors', '.minicolors-input', function () {
|
|
1024
|
-
var input =
|
|
1023
|
+
var input = hiprintJQuery(this);
|
|
1025
1024
|
if (!input.data('minicolors-initialized')) return;
|
|
1026
1025
|
show(input);
|
|
1027
1026
|
})
|
|
1028
1027
|
// Update value on blur
|
|
1029
1028
|
.on('blur.minicolors', '.minicolors-input', function () {
|
|
1030
|
-
var input =
|
|
1029
|
+
var input = hiprintJQuery(this);
|
|
1031
1030
|
var settings = input.data('minicolors-settings');
|
|
1032
1031
|
var keywords;
|
|
1033
1032
|
var hex;
|
|
@@ -1038,12 +1037,12 @@ $([document])
|
|
|
1038
1037
|
if (!input.data('minicolors-initialized')) return;
|
|
1039
1038
|
|
|
1040
1039
|
// Get array of lowercase keywords
|
|
1041
|
-
keywords = !settings.keywords ? [] :
|
|
1040
|
+
keywords = !settings.keywords ? [] : hiprintJQuery.map(settings.keywords.split(','), function (a) {
|
|
1042
1041
|
return a.toLowerCase().trim();
|
|
1043
1042
|
});
|
|
1044
1043
|
|
|
1045
1044
|
// Set color string
|
|
1046
|
-
if (input.val() !== '' &&
|
|
1045
|
+
if (input.val() !== '' && hiprintJQuery.inArray(input.val().toLowerCase(), keywords) > -1) {
|
|
1047
1046
|
value = input.val();
|
|
1048
1047
|
} else {
|
|
1049
1048
|
// Get RGBA values for easy conversion
|
|
@@ -1086,7 +1085,7 @@ $([document])
|
|
|
1086
1085
|
})
|
|
1087
1086
|
// Handle keypresses
|
|
1088
1087
|
.on('keydown.minicolors', '.minicolors-input', function (event) {
|
|
1089
|
-
var input =
|
|
1088
|
+
var input = hiprintJQuery(this);
|
|
1090
1089
|
if (!input.data('minicolors-initialized')) return;
|
|
1091
1090
|
switch (event.which) {
|
|
1092
1091
|
case 9: // tab
|
|
@@ -1101,13 +1100,13 @@ $([document])
|
|
|
1101
1100
|
})
|
|
1102
1101
|
// Update on keyup
|
|
1103
1102
|
.on('keyup.minicolors', '.minicolors-input', function () {
|
|
1104
|
-
var input =
|
|
1103
|
+
var input = hiprintJQuery(this);
|
|
1105
1104
|
if (!input.data('minicolors-initialized')) return;
|
|
1106
1105
|
updateFromInput(input, true);
|
|
1107
1106
|
})
|
|
1108
1107
|
// Update on paste
|
|
1109
1108
|
.on('paste.minicolors', '.minicolors-input', function () {
|
|
1110
|
-
var input =
|
|
1109
|
+
var input = hiprintJQuery(this);
|
|
1111
1110
|
if (!input.data('minicolors-initialized')) return;
|
|
1112
1111
|
setTimeout(function () {
|
|
1113
1112
|
updateFromInput(input, true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yh-hiprint",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.3",
|
|
4
4
|
"description": "Hiprint for Vue3 by NoahLiu in ForceCon in Hunan Changesha",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
"pub:npm": "npm publish --registry https://registry.npmjs.org/ --no-git-checks"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@claviska/jquery-minicolors": "2.3.6",
|
|
13
|
-
"jsbarcode": "3.11.5",
|
|
14
12
|
"jspdf": "2.5.1",
|
|
15
13
|
"html2canvas": "1.4.1",
|
|
16
14
|
"nzh": "1.0.9",
|
package/z-index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import $ from "jquery";
|
|
2
1
|
|
|
3
2
|
export default (function () {
|
|
4
|
-
function t() {
|
|
3
|
+
function t () {
|
|
5
4
|
this.name = "zIndex";
|
|
6
5
|
}
|
|
7
6
|
|
|
@@ -14,7 +13,7 @@ export default (function () {
|
|
|
14
13
|
}),
|
|
15
14
|
(t.prototype.createTarget = function () {
|
|
16
15
|
return (
|
|
17
|
-
(this.target =
|
|
16
|
+
(this.target = hiprintJQuery(
|
|
18
17
|
'<div class="hiprint-option-item">\n <div class="hiprint-option-item-label">\n 元素层级2\n </div>\n <div class="hiprint-option-item-field">\n <input type="number" class="auto-submit"/>\n </div>\n </div>'
|
|
19
18
|
)),
|
|
20
19
|
this.target
|