@zscreate/form-component 1.1.306 → 1.1.307-upload.10
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/dist/form-component.css +35 -9
- package/dist/form-component.umd.js +3529 -138
- package/package.json +2 -1
|
@@ -16994,6 +16994,242 @@ for (var i = 0; i < DOMIterables.length; i++) {
|
|
|
16994
16994
|
}
|
|
16995
16995
|
|
|
16996
16996
|
|
|
16997
|
+
/***/ }),
|
|
16998
|
+
|
|
16999
|
+
/***/ 4498:
|
|
17000
|
+
/***/ ((module) => {
|
|
17001
|
+
|
|
17002
|
+
"use strict";
|
|
17003
|
+
|
|
17004
|
+
|
|
17005
|
+
/******************************************************************************
|
|
17006
|
+
* Created 2008-08-19.
|
|
17007
|
+
*
|
|
17008
|
+
* Dijkstra path-finding functions. Adapted from the Dijkstar Python project.
|
|
17009
|
+
*
|
|
17010
|
+
* Copyright (C) 2008
|
|
17011
|
+
* Wyatt Baldwin <self@wyattbaldwin.com>
|
|
17012
|
+
* All rights reserved
|
|
17013
|
+
*
|
|
17014
|
+
* Licensed under the MIT license.
|
|
17015
|
+
*
|
|
17016
|
+
* http://www.opensource.org/licenses/mit-license.php
|
|
17017
|
+
*
|
|
17018
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17019
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17020
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17021
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17022
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
17023
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
17024
|
+
* THE SOFTWARE.
|
|
17025
|
+
*****************************************************************************/
|
|
17026
|
+
var dijkstra = {
|
|
17027
|
+
single_source_shortest_paths: function(graph, s, d) {
|
|
17028
|
+
// Predecessor map for each node that has been encountered.
|
|
17029
|
+
// node ID => predecessor node ID
|
|
17030
|
+
var predecessors = {};
|
|
17031
|
+
|
|
17032
|
+
// Costs of shortest paths from s to all nodes encountered.
|
|
17033
|
+
// node ID => cost
|
|
17034
|
+
var costs = {};
|
|
17035
|
+
costs[s] = 0;
|
|
17036
|
+
|
|
17037
|
+
// Costs of shortest paths from s to all nodes encountered; differs from
|
|
17038
|
+
// `costs` in that it provides easy access to the node that currently has
|
|
17039
|
+
// the known shortest path from s.
|
|
17040
|
+
// XXX: Do we actually need both `costs` and `open`?
|
|
17041
|
+
var open = dijkstra.PriorityQueue.make();
|
|
17042
|
+
open.push(s, 0);
|
|
17043
|
+
|
|
17044
|
+
var closest,
|
|
17045
|
+
u, v,
|
|
17046
|
+
cost_of_s_to_u,
|
|
17047
|
+
adjacent_nodes,
|
|
17048
|
+
cost_of_e,
|
|
17049
|
+
cost_of_s_to_u_plus_cost_of_e,
|
|
17050
|
+
cost_of_s_to_v,
|
|
17051
|
+
first_visit;
|
|
17052
|
+
while (!open.empty()) {
|
|
17053
|
+
// In the nodes remaining in graph that have a known cost from s,
|
|
17054
|
+
// find the node, u, that currently has the shortest path from s.
|
|
17055
|
+
closest = open.pop();
|
|
17056
|
+
u = closest.value;
|
|
17057
|
+
cost_of_s_to_u = closest.cost;
|
|
17058
|
+
|
|
17059
|
+
// Get nodes adjacent to u...
|
|
17060
|
+
adjacent_nodes = graph[u] || {};
|
|
17061
|
+
|
|
17062
|
+
// ...and explore the edges that connect u to those nodes, updating
|
|
17063
|
+
// the cost of the shortest paths to any or all of those nodes as
|
|
17064
|
+
// necessary. v is the node across the current edge from u.
|
|
17065
|
+
for (v in adjacent_nodes) {
|
|
17066
|
+
if (adjacent_nodes.hasOwnProperty(v)) {
|
|
17067
|
+
// Get the cost of the edge running from u to v.
|
|
17068
|
+
cost_of_e = adjacent_nodes[v];
|
|
17069
|
+
|
|
17070
|
+
// Cost of s to u plus the cost of u to v across e--this is *a*
|
|
17071
|
+
// cost from s to v that may or may not be less than the current
|
|
17072
|
+
// known cost to v.
|
|
17073
|
+
cost_of_s_to_u_plus_cost_of_e = cost_of_s_to_u + cost_of_e;
|
|
17074
|
+
|
|
17075
|
+
// If we haven't visited v yet OR if the current known cost from s to
|
|
17076
|
+
// v is greater than the new cost we just found (cost of s to u plus
|
|
17077
|
+
// cost of u to v across e), update v's cost in the cost list and
|
|
17078
|
+
// update v's predecessor in the predecessor list (it's now u).
|
|
17079
|
+
cost_of_s_to_v = costs[v];
|
|
17080
|
+
first_visit = (typeof costs[v] === 'undefined');
|
|
17081
|
+
if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) {
|
|
17082
|
+
costs[v] = cost_of_s_to_u_plus_cost_of_e;
|
|
17083
|
+
open.push(v, cost_of_s_to_u_plus_cost_of_e);
|
|
17084
|
+
predecessors[v] = u;
|
|
17085
|
+
}
|
|
17086
|
+
}
|
|
17087
|
+
}
|
|
17088
|
+
}
|
|
17089
|
+
|
|
17090
|
+
if (typeof d !== 'undefined' && typeof costs[d] === 'undefined') {
|
|
17091
|
+
var msg = ['Could not find a path from ', s, ' to ', d, '.'].join('');
|
|
17092
|
+
throw new Error(msg);
|
|
17093
|
+
}
|
|
17094
|
+
|
|
17095
|
+
return predecessors;
|
|
17096
|
+
},
|
|
17097
|
+
|
|
17098
|
+
extract_shortest_path_from_predecessor_list: function(predecessors, d) {
|
|
17099
|
+
var nodes = [];
|
|
17100
|
+
var u = d;
|
|
17101
|
+
var predecessor;
|
|
17102
|
+
while (u) {
|
|
17103
|
+
nodes.push(u);
|
|
17104
|
+
predecessor = predecessors[u];
|
|
17105
|
+
u = predecessors[u];
|
|
17106
|
+
}
|
|
17107
|
+
nodes.reverse();
|
|
17108
|
+
return nodes;
|
|
17109
|
+
},
|
|
17110
|
+
|
|
17111
|
+
find_path: function(graph, s, d) {
|
|
17112
|
+
var predecessors = dijkstra.single_source_shortest_paths(graph, s, d);
|
|
17113
|
+
return dijkstra.extract_shortest_path_from_predecessor_list(
|
|
17114
|
+
predecessors, d);
|
|
17115
|
+
},
|
|
17116
|
+
|
|
17117
|
+
/**
|
|
17118
|
+
* A very naive priority queue implementation.
|
|
17119
|
+
*/
|
|
17120
|
+
PriorityQueue: {
|
|
17121
|
+
make: function (opts) {
|
|
17122
|
+
var T = dijkstra.PriorityQueue,
|
|
17123
|
+
t = {},
|
|
17124
|
+
key;
|
|
17125
|
+
opts = opts || {};
|
|
17126
|
+
for (key in T) {
|
|
17127
|
+
if (T.hasOwnProperty(key)) {
|
|
17128
|
+
t[key] = T[key];
|
|
17129
|
+
}
|
|
17130
|
+
}
|
|
17131
|
+
t.queue = [];
|
|
17132
|
+
t.sorter = opts.sorter || T.default_sorter;
|
|
17133
|
+
return t;
|
|
17134
|
+
},
|
|
17135
|
+
|
|
17136
|
+
default_sorter: function (a, b) {
|
|
17137
|
+
return a.cost - b.cost;
|
|
17138
|
+
},
|
|
17139
|
+
|
|
17140
|
+
/**
|
|
17141
|
+
* Add a new item to the queue and ensure the highest priority element
|
|
17142
|
+
* is at the front of the queue.
|
|
17143
|
+
*/
|
|
17144
|
+
push: function (value, cost) {
|
|
17145
|
+
var item = {value: value, cost: cost};
|
|
17146
|
+
this.queue.push(item);
|
|
17147
|
+
this.queue.sort(this.sorter);
|
|
17148
|
+
},
|
|
17149
|
+
|
|
17150
|
+
/**
|
|
17151
|
+
* Return the highest priority element in the queue.
|
|
17152
|
+
*/
|
|
17153
|
+
pop: function () {
|
|
17154
|
+
return this.queue.shift();
|
|
17155
|
+
},
|
|
17156
|
+
|
|
17157
|
+
empty: function () {
|
|
17158
|
+
return this.queue.length === 0;
|
|
17159
|
+
}
|
|
17160
|
+
}
|
|
17161
|
+
};
|
|
17162
|
+
|
|
17163
|
+
|
|
17164
|
+
// node.js module exports
|
|
17165
|
+
if (true) {
|
|
17166
|
+
module.exports = dijkstra;
|
|
17167
|
+
}
|
|
17168
|
+
|
|
17169
|
+
|
|
17170
|
+
/***/ }),
|
|
17171
|
+
|
|
17172
|
+
/***/ 2868:
|
|
17173
|
+
/***/ ((module) => {
|
|
17174
|
+
|
|
17175
|
+
"use strict";
|
|
17176
|
+
|
|
17177
|
+
|
|
17178
|
+
module.exports = function encodeUtf8 (input) {
|
|
17179
|
+
var result = []
|
|
17180
|
+
var size = input.length
|
|
17181
|
+
|
|
17182
|
+
for (var index = 0; index < size; index++) {
|
|
17183
|
+
var point = input.charCodeAt(index)
|
|
17184
|
+
|
|
17185
|
+
if (point >= 0xD800 && point <= 0xDBFF && size > index + 1) {
|
|
17186
|
+
var second = input.charCodeAt(index + 1)
|
|
17187
|
+
|
|
17188
|
+
if (second >= 0xDC00 && second <= 0xDFFF) {
|
|
17189
|
+
// https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
|
|
17190
|
+
point = (point - 0xD800) * 0x400 + second - 0xDC00 + 0x10000
|
|
17191
|
+
index += 1
|
|
17192
|
+
}
|
|
17193
|
+
}
|
|
17194
|
+
|
|
17195
|
+
// US-ASCII
|
|
17196
|
+
if (point < 0x80) {
|
|
17197
|
+
result.push(point)
|
|
17198
|
+
continue
|
|
17199
|
+
}
|
|
17200
|
+
|
|
17201
|
+
// 2-byte UTF-8
|
|
17202
|
+
if (point < 0x800) {
|
|
17203
|
+
result.push((point >> 6) | 192)
|
|
17204
|
+
result.push((point & 63) | 128)
|
|
17205
|
+
continue
|
|
17206
|
+
}
|
|
17207
|
+
|
|
17208
|
+
// 3-byte UTF-8
|
|
17209
|
+
if (point < 0xD800 || (point >= 0xE000 && point < 0x10000)) {
|
|
17210
|
+
result.push((point >> 12) | 224)
|
|
17211
|
+
result.push(((point >> 6) & 63) | 128)
|
|
17212
|
+
result.push((point & 63) | 128)
|
|
17213
|
+
continue
|
|
17214
|
+
}
|
|
17215
|
+
|
|
17216
|
+
// 4-byte UTF-8
|
|
17217
|
+
if (point >= 0x10000 && point <= 0x10FFFF) {
|
|
17218
|
+
result.push((point >> 18) | 240)
|
|
17219
|
+
result.push(((point >> 12) & 63) | 128)
|
|
17220
|
+
result.push(((point >> 6) & 63) | 128)
|
|
17221
|
+
result.push((point & 63) | 128)
|
|
17222
|
+
continue
|
|
17223
|
+
}
|
|
17224
|
+
|
|
17225
|
+
// Invalid character
|
|
17226
|
+
result.push(0xEF, 0xBF, 0xBD)
|
|
17227
|
+
}
|
|
17228
|
+
|
|
17229
|
+
return new Uint8Array(result).buffer
|
|
17230
|
+
}
|
|
17231
|
+
|
|
17232
|
+
|
|
16997
17233
|
/***/ }),
|
|
16998
17234
|
|
|
16999
17235
|
/***/ 2310:
|
|
@@ -24550,6 +24786,2807 @@ module.exports = function createNamespaceEmitter () {
|
|
|
24550
24786
|
}));
|
|
24551
24787
|
|
|
24552
24788
|
|
|
24789
|
+
/***/ }),
|
|
24790
|
+
|
|
24791
|
+
/***/ 2109:
|
|
24792
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
24793
|
+
|
|
24794
|
+
|
|
24795
|
+
const canPromise = __webpack_require__(975)
|
|
24796
|
+
|
|
24797
|
+
const QRCode = __webpack_require__(4191)
|
|
24798
|
+
const CanvasRenderer = __webpack_require__(4581)
|
|
24799
|
+
const SvgRenderer = __webpack_require__(1802)
|
|
24800
|
+
|
|
24801
|
+
function renderCanvas (renderFunc, canvas, text, opts, cb) {
|
|
24802
|
+
const args = [].slice.call(arguments, 1)
|
|
24803
|
+
const argsNum = args.length
|
|
24804
|
+
const isLastArgCb = typeof args[argsNum - 1] === 'function'
|
|
24805
|
+
|
|
24806
|
+
if (!isLastArgCb && !canPromise()) {
|
|
24807
|
+
throw new Error('Callback required as last argument')
|
|
24808
|
+
}
|
|
24809
|
+
|
|
24810
|
+
if (isLastArgCb) {
|
|
24811
|
+
if (argsNum < 2) {
|
|
24812
|
+
throw new Error('Too few arguments provided')
|
|
24813
|
+
}
|
|
24814
|
+
|
|
24815
|
+
if (argsNum === 2) {
|
|
24816
|
+
cb = text
|
|
24817
|
+
text = canvas
|
|
24818
|
+
canvas = opts = undefined
|
|
24819
|
+
} else if (argsNum === 3) {
|
|
24820
|
+
if (canvas.getContext && typeof cb === 'undefined') {
|
|
24821
|
+
cb = opts
|
|
24822
|
+
opts = undefined
|
|
24823
|
+
} else {
|
|
24824
|
+
cb = opts
|
|
24825
|
+
opts = text
|
|
24826
|
+
text = canvas
|
|
24827
|
+
canvas = undefined
|
|
24828
|
+
}
|
|
24829
|
+
}
|
|
24830
|
+
} else {
|
|
24831
|
+
if (argsNum < 1) {
|
|
24832
|
+
throw new Error('Too few arguments provided')
|
|
24833
|
+
}
|
|
24834
|
+
|
|
24835
|
+
if (argsNum === 1) {
|
|
24836
|
+
text = canvas
|
|
24837
|
+
canvas = opts = undefined
|
|
24838
|
+
} else if (argsNum === 2 && !canvas.getContext) {
|
|
24839
|
+
opts = text
|
|
24840
|
+
text = canvas
|
|
24841
|
+
canvas = undefined
|
|
24842
|
+
}
|
|
24843
|
+
|
|
24844
|
+
return new Promise(function (resolve, reject) {
|
|
24845
|
+
try {
|
|
24846
|
+
const data = QRCode.create(text, opts)
|
|
24847
|
+
resolve(renderFunc(data, canvas, opts))
|
|
24848
|
+
} catch (e) {
|
|
24849
|
+
reject(e)
|
|
24850
|
+
}
|
|
24851
|
+
})
|
|
24852
|
+
}
|
|
24853
|
+
|
|
24854
|
+
try {
|
|
24855
|
+
const data = QRCode.create(text, opts)
|
|
24856
|
+
cb(null, renderFunc(data, canvas, opts))
|
|
24857
|
+
} catch (e) {
|
|
24858
|
+
cb(e)
|
|
24859
|
+
}
|
|
24860
|
+
}
|
|
24861
|
+
|
|
24862
|
+
exports.create = QRCode.create
|
|
24863
|
+
exports.toCanvas = renderCanvas.bind(null, CanvasRenderer.render)
|
|
24864
|
+
exports.toDataURL = renderCanvas.bind(null, CanvasRenderer.renderToDataURL)
|
|
24865
|
+
|
|
24866
|
+
// only svg for now.
|
|
24867
|
+
exports.toString = renderCanvas.bind(null, function (data, _, opts) {
|
|
24868
|
+
return SvgRenderer.render(data, opts)
|
|
24869
|
+
})
|
|
24870
|
+
|
|
24871
|
+
|
|
24872
|
+
/***/ }),
|
|
24873
|
+
|
|
24874
|
+
/***/ 975:
|
|
24875
|
+
/***/ ((module) => {
|
|
24876
|
+
|
|
24877
|
+
// can-promise has a crash in some versions of react native that dont have
|
|
24878
|
+
// standard global objects
|
|
24879
|
+
// https://github.com/soldair/node-qrcode/issues/157
|
|
24880
|
+
|
|
24881
|
+
module.exports = function () {
|
|
24882
|
+
return typeof Promise === 'function' && Promise.prototype && Promise.prototype.then
|
|
24883
|
+
}
|
|
24884
|
+
|
|
24885
|
+
|
|
24886
|
+
/***/ }),
|
|
24887
|
+
|
|
24888
|
+
/***/ 2795:
|
|
24889
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
24890
|
+
|
|
24891
|
+
/**
|
|
24892
|
+
* Alignment pattern are fixed reference pattern in defined positions
|
|
24893
|
+
* in a matrix symbology, which enables the decode software to re-synchronise
|
|
24894
|
+
* the coordinate mapping of the image modules in the event of moderate amounts
|
|
24895
|
+
* of distortion of the image.
|
|
24896
|
+
*
|
|
24897
|
+
* Alignment patterns are present only in QR Code symbols of version 2 or larger
|
|
24898
|
+
* and their number depends on the symbol version.
|
|
24899
|
+
*/
|
|
24900
|
+
|
|
24901
|
+
const getSymbolSize = (__webpack_require__(1916).getSymbolSize)
|
|
24902
|
+
|
|
24903
|
+
/**
|
|
24904
|
+
* Calculate the row/column coordinates of the center module of each alignment pattern
|
|
24905
|
+
* for the specified QR Code version.
|
|
24906
|
+
*
|
|
24907
|
+
* The alignment patterns are positioned symmetrically on either side of the diagonal
|
|
24908
|
+
* running from the top left corner of the symbol to the bottom right corner.
|
|
24909
|
+
*
|
|
24910
|
+
* Since positions are simmetrical only half of the coordinates are returned.
|
|
24911
|
+
* Each item of the array will represent in turn the x and y coordinate.
|
|
24912
|
+
* @see {@link getPositions}
|
|
24913
|
+
*
|
|
24914
|
+
* @param {Number} version QR Code version
|
|
24915
|
+
* @return {Array} Array of coordinate
|
|
24916
|
+
*/
|
|
24917
|
+
exports.getRowColCoords = function getRowColCoords (version) {
|
|
24918
|
+
if (version === 1) return []
|
|
24919
|
+
|
|
24920
|
+
const posCount = Math.floor(version / 7) + 2
|
|
24921
|
+
const size = getSymbolSize(version)
|
|
24922
|
+
const intervals = size === 145 ? 26 : Math.ceil((size - 13) / (2 * posCount - 2)) * 2
|
|
24923
|
+
const positions = [size - 7] // Last coord is always (size - 7)
|
|
24924
|
+
|
|
24925
|
+
for (let i = 1; i < posCount - 1; i++) {
|
|
24926
|
+
positions[i] = positions[i - 1] - intervals
|
|
24927
|
+
}
|
|
24928
|
+
|
|
24929
|
+
positions.push(6) // First coord is always 6
|
|
24930
|
+
|
|
24931
|
+
return positions.reverse()
|
|
24932
|
+
}
|
|
24933
|
+
|
|
24934
|
+
/**
|
|
24935
|
+
* Returns an array containing the positions of each alignment pattern.
|
|
24936
|
+
* Each array's element represent the center point of the pattern as (x, y) coordinates
|
|
24937
|
+
*
|
|
24938
|
+
* Coordinates are calculated expanding the row/column coordinates returned by {@link getRowColCoords}
|
|
24939
|
+
* and filtering out the items that overlaps with finder pattern
|
|
24940
|
+
*
|
|
24941
|
+
* @example
|
|
24942
|
+
* For a Version 7 symbol {@link getRowColCoords} returns values 6, 22 and 38.
|
|
24943
|
+
* The alignment patterns, therefore, are to be centered on (row, column)
|
|
24944
|
+
* positions (6,22), (22,6), (22,22), (22,38), (38,22), (38,38).
|
|
24945
|
+
* Note that the coordinates (6,6), (6,38), (38,6) are occupied by finder patterns
|
|
24946
|
+
* and are not therefore used for alignment patterns.
|
|
24947
|
+
*
|
|
24948
|
+
* let pos = getPositions(7)
|
|
24949
|
+
* // [[6,22], [22,6], [22,22], [22,38], [38,22], [38,38]]
|
|
24950
|
+
*
|
|
24951
|
+
* @param {Number} version QR Code version
|
|
24952
|
+
* @return {Array} Array of coordinates
|
|
24953
|
+
*/
|
|
24954
|
+
exports.getPositions = function getPositions (version) {
|
|
24955
|
+
const coords = []
|
|
24956
|
+
const pos = exports.getRowColCoords(version)
|
|
24957
|
+
const posLength = pos.length
|
|
24958
|
+
|
|
24959
|
+
for (let i = 0; i < posLength; i++) {
|
|
24960
|
+
for (let j = 0; j < posLength; j++) {
|
|
24961
|
+
// Skip if position is occupied by finder patterns
|
|
24962
|
+
if ((i === 0 && j === 0) || // top-left
|
|
24963
|
+
(i === 0 && j === posLength - 1) || // bottom-left
|
|
24964
|
+
(i === posLength - 1 && j === 0)) { // top-right
|
|
24965
|
+
continue
|
|
24966
|
+
}
|
|
24967
|
+
|
|
24968
|
+
coords.push([pos[i], pos[j]])
|
|
24969
|
+
}
|
|
24970
|
+
}
|
|
24971
|
+
|
|
24972
|
+
return coords
|
|
24973
|
+
}
|
|
24974
|
+
|
|
24975
|
+
|
|
24976
|
+
/***/ }),
|
|
24977
|
+
|
|
24978
|
+
/***/ 1975:
|
|
24979
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
24980
|
+
|
|
24981
|
+
const Mode = __webpack_require__(9282)
|
|
24982
|
+
|
|
24983
|
+
/**
|
|
24984
|
+
* Array of characters available in alphanumeric mode
|
|
24985
|
+
*
|
|
24986
|
+
* As per QR Code specification, to each character
|
|
24987
|
+
* is assigned a value from 0 to 44 which in this case coincides
|
|
24988
|
+
* with the array index
|
|
24989
|
+
*
|
|
24990
|
+
* @type {Array}
|
|
24991
|
+
*/
|
|
24992
|
+
const ALPHA_NUM_CHARS = [
|
|
24993
|
+
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
|
24994
|
+
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
|
|
24995
|
+
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
|
24996
|
+
' ', '$', '%', '*', '+', '-', '.', '/', ':'
|
|
24997
|
+
]
|
|
24998
|
+
|
|
24999
|
+
function AlphanumericData (data) {
|
|
25000
|
+
this.mode = Mode.ALPHANUMERIC
|
|
25001
|
+
this.data = data
|
|
25002
|
+
}
|
|
25003
|
+
|
|
25004
|
+
AlphanumericData.getBitsLength = function getBitsLength (length) {
|
|
25005
|
+
return 11 * Math.floor(length / 2) + 6 * (length % 2)
|
|
25006
|
+
}
|
|
25007
|
+
|
|
25008
|
+
AlphanumericData.prototype.getLength = function getLength () {
|
|
25009
|
+
return this.data.length
|
|
25010
|
+
}
|
|
25011
|
+
|
|
25012
|
+
AlphanumericData.prototype.getBitsLength = function getBitsLength () {
|
|
25013
|
+
return AlphanumericData.getBitsLength(this.data.length)
|
|
25014
|
+
}
|
|
25015
|
+
|
|
25016
|
+
AlphanumericData.prototype.write = function write (bitBuffer) {
|
|
25017
|
+
let i
|
|
25018
|
+
|
|
25019
|
+
// Input data characters are divided into groups of two characters
|
|
25020
|
+
// and encoded as 11-bit binary codes.
|
|
25021
|
+
for (i = 0; i + 2 <= this.data.length; i += 2) {
|
|
25022
|
+
// The character value of the first character is multiplied by 45
|
|
25023
|
+
let value = ALPHA_NUM_CHARS.indexOf(this.data[i]) * 45
|
|
25024
|
+
|
|
25025
|
+
// The character value of the second digit is added to the product
|
|
25026
|
+
value += ALPHA_NUM_CHARS.indexOf(this.data[i + 1])
|
|
25027
|
+
|
|
25028
|
+
// The sum is then stored as 11-bit binary number
|
|
25029
|
+
bitBuffer.put(value, 11)
|
|
25030
|
+
}
|
|
25031
|
+
|
|
25032
|
+
// If the number of input data characters is not a multiple of two,
|
|
25033
|
+
// the character value of the final character is encoded as a 6-bit binary number.
|
|
25034
|
+
if (this.data.length % 2) {
|
|
25035
|
+
bitBuffer.put(ALPHA_NUM_CHARS.indexOf(this.data[i]), 6)
|
|
25036
|
+
}
|
|
25037
|
+
}
|
|
25038
|
+
|
|
25039
|
+
module.exports = AlphanumericData
|
|
25040
|
+
|
|
25041
|
+
|
|
25042
|
+
/***/ }),
|
|
25043
|
+
|
|
25044
|
+
/***/ 4445:
|
|
25045
|
+
/***/ ((module) => {
|
|
25046
|
+
|
|
25047
|
+
function BitBuffer () {
|
|
25048
|
+
this.buffer = []
|
|
25049
|
+
this.length = 0
|
|
25050
|
+
}
|
|
25051
|
+
|
|
25052
|
+
BitBuffer.prototype = {
|
|
25053
|
+
|
|
25054
|
+
get: function (index) {
|
|
25055
|
+
const bufIndex = Math.floor(index / 8)
|
|
25056
|
+
return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1) === 1
|
|
25057
|
+
},
|
|
25058
|
+
|
|
25059
|
+
put: function (num, length) {
|
|
25060
|
+
for (let i = 0; i < length; i++) {
|
|
25061
|
+
this.putBit(((num >>> (length - i - 1)) & 1) === 1)
|
|
25062
|
+
}
|
|
25063
|
+
},
|
|
25064
|
+
|
|
25065
|
+
getLengthInBits: function () {
|
|
25066
|
+
return this.length
|
|
25067
|
+
},
|
|
25068
|
+
|
|
25069
|
+
putBit: function (bit) {
|
|
25070
|
+
const bufIndex = Math.floor(this.length / 8)
|
|
25071
|
+
if (this.buffer.length <= bufIndex) {
|
|
25072
|
+
this.buffer.push(0)
|
|
25073
|
+
}
|
|
25074
|
+
|
|
25075
|
+
if (bit) {
|
|
25076
|
+
this.buffer[bufIndex] |= (0x80 >>> (this.length % 8))
|
|
25077
|
+
}
|
|
25078
|
+
|
|
25079
|
+
this.length++
|
|
25080
|
+
}
|
|
25081
|
+
}
|
|
25082
|
+
|
|
25083
|
+
module.exports = BitBuffer
|
|
25084
|
+
|
|
25085
|
+
|
|
25086
|
+
/***/ }),
|
|
25087
|
+
|
|
25088
|
+
/***/ 562:
|
|
25089
|
+
/***/ ((module) => {
|
|
25090
|
+
|
|
25091
|
+
/**
|
|
25092
|
+
* Helper class to handle QR Code symbol modules
|
|
25093
|
+
*
|
|
25094
|
+
* @param {Number} size Symbol size
|
|
25095
|
+
*/
|
|
25096
|
+
function BitMatrix (size) {
|
|
25097
|
+
if (!size || size < 1) {
|
|
25098
|
+
throw new Error('BitMatrix size must be defined and greater than 0')
|
|
25099
|
+
}
|
|
25100
|
+
|
|
25101
|
+
this.size = size
|
|
25102
|
+
this.data = new Uint8Array(size * size)
|
|
25103
|
+
this.reservedBit = new Uint8Array(size * size)
|
|
25104
|
+
}
|
|
25105
|
+
|
|
25106
|
+
/**
|
|
25107
|
+
* Set bit value at specified location
|
|
25108
|
+
* If reserved flag is set, this bit will be ignored during masking process
|
|
25109
|
+
*
|
|
25110
|
+
* @param {Number} row
|
|
25111
|
+
* @param {Number} col
|
|
25112
|
+
* @param {Boolean} value
|
|
25113
|
+
* @param {Boolean} reserved
|
|
25114
|
+
*/
|
|
25115
|
+
BitMatrix.prototype.set = function (row, col, value, reserved) {
|
|
25116
|
+
const index = row * this.size + col
|
|
25117
|
+
this.data[index] = value
|
|
25118
|
+
if (reserved) this.reservedBit[index] = true
|
|
25119
|
+
}
|
|
25120
|
+
|
|
25121
|
+
/**
|
|
25122
|
+
* Returns bit value at specified location
|
|
25123
|
+
*
|
|
25124
|
+
* @param {Number} row
|
|
25125
|
+
* @param {Number} col
|
|
25126
|
+
* @return {Boolean}
|
|
25127
|
+
*/
|
|
25128
|
+
BitMatrix.prototype.get = function (row, col) {
|
|
25129
|
+
return this.data[row * this.size + col]
|
|
25130
|
+
}
|
|
25131
|
+
|
|
25132
|
+
/**
|
|
25133
|
+
* Applies xor operator at specified location
|
|
25134
|
+
* (used during masking process)
|
|
25135
|
+
*
|
|
25136
|
+
* @param {Number} row
|
|
25137
|
+
* @param {Number} col
|
|
25138
|
+
* @param {Boolean} value
|
|
25139
|
+
*/
|
|
25140
|
+
BitMatrix.prototype.xor = function (row, col, value) {
|
|
25141
|
+
this.data[row * this.size + col] ^= value
|
|
25142
|
+
}
|
|
25143
|
+
|
|
25144
|
+
/**
|
|
25145
|
+
* Check if bit at specified location is reserved
|
|
25146
|
+
*
|
|
25147
|
+
* @param {Number} row
|
|
25148
|
+
* @param {Number} col
|
|
25149
|
+
* @return {Boolean}
|
|
25150
|
+
*/
|
|
25151
|
+
BitMatrix.prototype.isReserved = function (row, col) {
|
|
25152
|
+
return this.reservedBit[row * this.size + col]
|
|
25153
|
+
}
|
|
25154
|
+
|
|
25155
|
+
module.exports = BitMatrix
|
|
25156
|
+
|
|
25157
|
+
|
|
25158
|
+
/***/ }),
|
|
25159
|
+
|
|
25160
|
+
/***/ 3892:
|
|
25161
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
25162
|
+
|
|
25163
|
+
const encodeUtf8 = __webpack_require__(2868)
|
|
25164
|
+
const Mode = __webpack_require__(9282)
|
|
25165
|
+
|
|
25166
|
+
function ByteData (data) {
|
|
25167
|
+
this.mode = Mode.BYTE
|
|
25168
|
+
if (typeof (data) === 'string') {
|
|
25169
|
+
data = encodeUtf8(data)
|
|
25170
|
+
}
|
|
25171
|
+
this.data = new Uint8Array(data)
|
|
25172
|
+
}
|
|
25173
|
+
|
|
25174
|
+
ByteData.getBitsLength = function getBitsLength (length) {
|
|
25175
|
+
return length * 8
|
|
25176
|
+
}
|
|
25177
|
+
|
|
25178
|
+
ByteData.prototype.getLength = function getLength () {
|
|
25179
|
+
return this.data.length
|
|
25180
|
+
}
|
|
25181
|
+
|
|
25182
|
+
ByteData.prototype.getBitsLength = function getBitsLength () {
|
|
25183
|
+
return ByteData.getBitsLength(this.data.length)
|
|
25184
|
+
}
|
|
25185
|
+
|
|
25186
|
+
ByteData.prototype.write = function (bitBuffer) {
|
|
25187
|
+
for (let i = 0, l = this.data.length; i < l; i++) {
|
|
25188
|
+
bitBuffer.put(this.data[i], 8)
|
|
25189
|
+
}
|
|
25190
|
+
}
|
|
25191
|
+
|
|
25192
|
+
module.exports = ByteData
|
|
25193
|
+
|
|
25194
|
+
|
|
25195
|
+
/***/ }),
|
|
25196
|
+
|
|
25197
|
+
/***/ 8444:
|
|
25198
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
25199
|
+
|
|
25200
|
+
const ECLevel = __webpack_require__(9175)
|
|
25201
|
+
|
|
25202
|
+
const EC_BLOCKS_TABLE = [
|
|
25203
|
+
// L M Q H
|
|
25204
|
+
1, 1, 1, 1,
|
|
25205
|
+
1, 1, 1, 1,
|
|
25206
|
+
1, 1, 2, 2,
|
|
25207
|
+
1, 2, 2, 4,
|
|
25208
|
+
1, 2, 4, 4,
|
|
25209
|
+
2, 4, 4, 4,
|
|
25210
|
+
2, 4, 6, 5,
|
|
25211
|
+
2, 4, 6, 6,
|
|
25212
|
+
2, 5, 8, 8,
|
|
25213
|
+
4, 5, 8, 8,
|
|
25214
|
+
4, 5, 8, 11,
|
|
25215
|
+
4, 8, 10, 11,
|
|
25216
|
+
4, 9, 12, 16,
|
|
25217
|
+
4, 9, 16, 16,
|
|
25218
|
+
6, 10, 12, 18,
|
|
25219
|
+
6, 10, 17, 16,
|
|
25220
|
+
6, 11, 16, 19,
|
|
25221
|
+
6, 13, 18, 21,
|
|
25222
|
+
7, 14, 21, 25,
|
|
25223
|
+
8, 16, 20, 25,
|
|
25224
|
+
8, 17, 23, 25,
|
|
25225
|
+
9, 17, 23, 34,
|
|
25226
|
+
9, 18, 25, 30,
|
|
25227
|
+
10, 20, 27, 32,
|
|
25228
|
+
12, 21, 29, 35,
|
|
25229
|
+
12, 23, 34, 37,
|
|
25230
|
+
12, 25, 34, 40,
|
|
25231
|
+
13, 26, 35, 42,
|
|
25232
|
+
14, 28, 38, 45,
|
|
25233
|
+
15, 29, 40, 48,
|
|
25234
|
+
16, 31, 43, 51,
|
|
25235
|
+
17, 33, 45, 54,
|
|
25236
|
+
18, 35, 48, 57,
|
|
25237
|
+
19, 37, 51, 60,
|
|
25238
|
+
19, 38, 53, 63,
|
|
25239
|
+
20, 40, 56, 66,
|
|
25240
|
+
21, 43, 59, 70,
|
|
25241
|
+
22, 45, 62, 74,
|
|
25242
|
+
24, 47, 65, 77,
|
|
25243
|
+
25, 49, 68, 81
|
|
25244
|
+
]
|
|
25245
|
+
|
|
25246
|
+
const EC_CODEWORDS_TABLE = [
|
|
25247
|
+
// L M Q H
|
|
25248
|
+
7, 10, 13, 17,
|
|
25249
|
+
10, 16, 22, 28,
|
|
25250
|
+
15, 26, 36, 44,
|
|
25251
|
+
20, 36, 52, 64,
|
|
25252
|
+
26, 48, 72, 88,
|
|
25253
|
+
36, 64, 96, 112,
|
|
25254
|
+
40, 72, 108, 130,
|
|
25255
|
+
48, 88, 132, 156,
|
|
25256
|
+
60, 110, 160, 192,
|
|
25257
|
+
72, 130, 192, 224,
|
|
25258
|
+
80, 150, 224, 264,
|
|
25259
|
+
96, 176, 260, 308,
|
|
25260
|
+
104, 198, 288, 352,
|
|
25261
|
+
120, 216, 320, 384,
|
|
25262
|
+
132, 240, 360, 432,
|
|
25263
|
+
144, 280, 408, 480,
|
|
25264
|
+
168, 308, 448, 532,
|
|
25265
|
+
180, 338, 504, 588,
|
|
25266
|
+
196, 364, 546, 650,
|
|
25267
|
+
224, 416, 600, 700,
|
|
25268
|
+
224, 442, 644, 750,
|
|
25269
|
+
252, 476, 690, 816,
|
|
25270
|
+
270, 504, 750, 900,
|
|
25271
|
+
300, 560, 810, 960,
|
|
25272
|
+
312, 588, 870, 1050,
|
|
25273
|
+
336, 644, 952, 1110,
|
|
25274
|
+
360, 700, 1020, 1200,
|
|
25275
|
+
390, 728, 1050, 1260,
|
|
25276
|
+
420, 784, 1140, 1350,
|
|
25277
|
+
450, 812, 1200, 1440,
|
|
25278
|
+
480, 868, 1290, 1530,
|
|
25279
|
+
510, 924, 1350, 1620,
|
|
25280
|
+
540, 980, 1440, 1710,
|
|
25281
|
+
570, 1036, 1530, 1800,
|
|
25282
|
+
570, 1064, 1590, 1890,
|
|
25283
|
+
600, 1120, 1680, 1980,
|
|
25284
|
+
630, 1204, 1770, 2100,
|
|
25285
|
+
660, 1260, 1860, 2220,
|
|
25286
|
+
720, 1316, 1950, 2310,
|
|
25287
|
+
750, 1372, 2040, 2430
|
|
25288
|
+
]
|
|
25289
|
+
|
|
25290
|
+
/**
|
|
25291
|
+
* Returns the number of error correction block that the QR Code should contain
|
|
25292
|
+
* for the specified version and error correction level.
|
|
25293
|
+
*
|
|
25294
|
+
* @param {Number} version QR Code version
|
|
25295
|
+
* @param {Number} errorCorrectionLevel Error correction level
|
|
25296
|
+
* @return {Number} Number of error correction blocks
|
|
25297
|
+
*/
|
|
25298
|
+
exports.getBlocksCount = function getBlocksCount (version, errorCorrectionLevel) {
|
|
25299
|
+
switch (errorCorrectionLevel) {
|
|
25300
|
+
case ECLevel.L:
|
|
25301
|
+
return EC_BLOCKS_TABLE[(version - 1) * 4 + 0]
|
|
25302
|
+
case ECLevel.M:
|
|
25303
|
+
return EC_BLOCKS_TABLE[(version - 1) * 4 + 1]
|
|
25304
|
+
case ECLevel.Q:
|
|
25305
|
+
return EC_BLOCKS_TABLE[(version - 1) * 4 + 2]
|
|
25306
|
+
case ECLevel.H:
|
|
25307
|
+
return EC_BLOCKS_TABLE[(version - 1) * 4 + 3]
|
|
25308
|
+
default:
|
|
25309
|
+
return undefined
|
|
25310
|
+
}
|
|
25311
|
+
}
|
|
25312
|
+
|
|
25313
|
+
/**
|
|
25314
|
+
* Returns the number of error correction codewords to use for the specified
|
|
25315
|
+
* version and error correction level.
|
|
25316
|
+
*
|
|
25317
|
+
* @param {Number} version QR Code version
|
|
25318
|
+
* @param {Number} errorCorrectionLevel Error correction level
|
|
25319
|
+
* @return {Number} Number of error correction codewords
|
|
25320
|
+
*/
|
|
25321
|
+
exports.getTotalCodewordsCount = function getTotalCodewordsCount (version, errorCorrectionLevel) {
|
|
25322
|
+
switch (errorCorrectionLevel) {
|
|
25323
|
+
case ECLevel.L:
|
|
25324
|
+
return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0]
|
|
25325
|
+
case ECLevel.M:
|
|
25326
|
+
return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1]
|
|
25327
|
+
case ECLevel.Q:
|
|
25328
|
+
return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2]
|
|
25329
|
+
case ECLevel.H:
|
|
25330
|
+
return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3]
|
|
25331
|
+
default:
|
|
25332
|
+
return undefined
|
|
25333
|
+
}
|
|
25334
|
+
}
|
|
25335
|
+
|
|
25336
|
+
|
|
25337
|
+
/***/ }),
|
|
25338
|
+
|
|
25339
|
+
/***/ 9175:
|
|
25340
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
25341
|
+
|
|
25342
|
+
exports.L = { bit: 1 }
|
|
25343
|
+
exports.M = { bit: 0 }
|
|
25344
|
+
exports.Q = { bit: 3 }
|
|
25345
|
+
exports.H = { bit: 2 }
|
|
25346
|
+
|
|
25347
|
+
function fromString (string) {
|
|
25348
|
+
if (typeof string !== 'string') {
|
|
25349
|
+
throw new Error('Param is not a string')
|
|
25350
|
+
}
|
|
25351
|
+
|
|
25352
|
+
const lcStr = string.toLowerCase()
|
|
25353
|
+
|
|
25354
|
+
switch (lcStr) {
|
|
25355
|
+
case 'l':
|
|
25356
|
+
case 'low':
|
|
25357
|
+
return exports.L
|
|
25358
|
+
|
|
25359
|
+
case 'm':
|
|
25360
|
+
case 'medium':
|
|
25361
|
+
return exports.M
|
|
25362
|
+
|
|
25363
|
+
case 'q':
|
|
25364
|
+
case 'quartile':
|
|
25365
|
+
return exports.Q
|
|
25366
|
+
|
|
25367
|
+
case 'h':
|
|
25368
|
+
case 'high':
|
|
25369
|
+
return exports.H
|
|
25370
|
+
|
|
25371
|
+
default:
|
|
25372
|
+
throw new Error('Unknown EC Level: ' + string)
|
|
25373
|
+
}
|
|
25374
|
+
}
|
|
25375
|
+
|
|
25376
|
+
exports.isValid = function isValid (level) {
|
|
25377
|
+
return level && typeof level.bit !== 'undefined' &&
|
|
25378
|
+
level.bit >= 0 && level.bit < 4
|
|
25379
|
+
}
|
|
25380
|
+
|
|
25381
|
+
exports.from = function from (value, defaultValue) {
|
|
25382
|
+
if (exports.isValid(value)) {
|
|
25383
|
+
return value
|
|
25384
|
+
}
|
|
25385
|
+
|
|
25386
|
+
try {
|
|
25387
|
+
return fromString(value)
|
|
25388
|
+
} catch (e) {
|
|
25389
|
+
return defaultValue
|
|
25390
|
+
}
|
|
25391
|
+
}
|
|
25392
|
+
|
|
25393
|
+
|
|
25394
|
+
/***/ }),
|
|
25395
|
+
|
|
25396
|
+
/***/ 2902:
|
|
25397
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
25398
|
+
|
|
25399
|
+
const getSymbolSize = (__webpack_require__(1916).getSymbolSize)
|
|
25400
|
+
const FINDER_PATTERN_SIZE = 7
|
|
25401
|
+
|
|
25402
|
+
/**
|
|
25403
|
+
* Returns an array containing the positions of each finder pattern.
|
|
25404
|
+
* Each array's element represent the top-left point of the pattern as (x, y) coordinates
|
|
25405
|
+
*
|
|
25406
|
+
* @param {Number} version QR Code version
|
|
25407
|
+
* @return {Array} Array of coordinates
|
|
25408
|
+
*/
|
|
25409
|
+
exports.getPositions = function getPositions (version) {
|
|
25410
|
+
const size = getSymbolSize(version)
|
|
25411
|
+
|
|
25412
|
+
return [
|
|
25413
|
+
// top-left
|
|
25414
|
+
[0, 0],
|
|
25415
|
+
// top-right
|
|
25416
|
+
[size - FINDER_PATTERN_SIZE, 0],
|
|
25417
|
+
// bottom-left
|
|
25418
|
+
[0, size - FINDER_PATTERN_SIZE]
|
|
25419
|
+
]
|
|
25420
|
+
}
|
|
25421
|
+
|
|
25422
|
+
|
|
25423
|
+
/***/ }),
|
|
25424
|
+
|
|
25425
|
+
/***/ 6895:
|
|
25426
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
25427
|
+
|
|
25428
|
+
const Utils = __webpack_require__(1916)
|
|
25429
|
+
|
|
25430
|
+
const G15 = (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0)
|
|
25431
|
+
const G15_MASK = (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1)
|
|
25432
|
+
const G15_BCH = Utils.getBCHDigit(G15)
|
|
25433
|
+
|
|
25434
|
+
/**
|
|
25435
|
+
* Returns format information with relative error correction bits
|
|
25436
|
+
*
|
|
25437
|
+
* The format information is a 15-bit sequence containing 5 data bits,
|
|
25438
|
+
* with 10 error correction bits calculated using the (15, 5) BCH code.
|
|
25439
|
+
*
|
|
25440
|
+
* @param {Number} errorCorrectionLevel Error correction level
|
|
25441
|
+
* @param {Number} mask Mask pattern
|
|
25442
|
+
* @return {Number} Encoded format information bits
|
|
25443
|
+
*/
|
|
25444
|
+
exports.getEncodedBits = function getEncodedBits (errorCorrectionLevel, mask) {
|
|
25445
|
+
const data = ((errorCorrectionLevel.bit << 3) | mask)
|
|
25446
|
+
let d = data << 10
|
|
25447
|
+
|
|
25448
|
+
while (Utils.getBCHDigit(d) - G15_BCH >= 0) {
|
|
25449
|
+
d ^= (G15 << (Utils.getBCHDigit(d) - G15_BCH))
|
|
25450
|
+
}
|
|
25451
|
+
|
|
25452
|
+
// xor final data with mask pattern in order to ensure that
|
|
25453
|
+
// no combination of Error Correction Level and data mask pattern
|
|
25454
|
+
// will result in an all-zero data string
|
|
25455
|
+
return ((data << 10) | d) ^ G15_MASK
|
|
25456
|
+
}
|
|
25457
|
+
|
|
25458
|
+
|
|
25459
|
+
/***/ }),
|
|
25460
|
+
|
|
25461
|
+
/***/ 6721:
|
|
25462
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
25463
|
+
|
|
25464
|
+
const EXP_TABLE = new Uint8Array(512)
|
|
25465
|
+
const LOG_TABLE = new Uint8Array(256)
|
|
25466
|
+
/**
|
|
25467
|
+
* Precompute the log and anti-log tables for faster computation later
|
|
25468
|
+
*
|
|
25469
|
+
* For each possible value in the galois field 2^8, we will pre-compute
|
|
25470
|
+
* the logarithm and anti-logarithm (exponential) of this value
|
|
25471
|
+
*
|
|
25472
|
+
* ref {@link https://en.wikiversity.org/wiki/Reed%E2%80%93Solomon_codes_for_coders#Introduction_to_mathematical_fields}
|
|
25473
|
+
*/
|
|
25474
|
+
;(function initTables () {
|
|
25475
|
+
let x = 1
|
|
25476
|
+
for (let i = 0; i < 255; i++) {
|
|
25477
|
+
EXP_TABLE[i] = x
|
|
25478
|
+
LOG_TABLE[x] = i
|
|
25479
|
+
|
|
25480
|
+
x <<= 1 // multiply by 2
|
|
25481
|
+
|
|
25482
|
+
// The QR code specification says to use byte-wise modulo 100011101 arithmetic.
|
|
25483
|
+
// This means that when a number is 256 or larger, it should be XORed with 0x11D.
|
|
25484
|
+
if (x & 0x100) { // similar to x >= 256, but a lot faster (because 0x100 == 256)
|
|
25485
|
+
x ^= 0x11D
|
|
25486
|
+
}
|
|
25487
|
+
}
|
|
25488
|
+
|
|
25489
|
+
// Optimization: double the size of the anti-log table so that we don't need to mod 255 to
|
|
25490
|
+
// stay inside the bounds (because we will mainly use this table for the multiplication of
|
|
25491
|
+
// two GF numbers, no more).
|
|
25492
|
+
// @see {@link mul}
|
|
25493
|
+
for (let i = 255; i < 512; i++) {
|
|
25494
|
+
EXP_TABLE[i] = EXP_TABLE[i - 255]
|
|
25495
|
+
}
|
|
25496
|
+
}())
|
|
25497
|
+
|
|
25498
|
+
/**
|
|
25499
|
+
* Returns log value of n inside Galois Field
|
|
25500
|
+
*
|
|
25501
|
+
* @param {Number} n
|
|
25502
|
+
* @return {Number}
|
|
25503
|
+
*/
|
|
25504
|
+
exports.log = function log (n) {
|
|
25505
|
+
if (n < 1) throw new Error('log(' + n + ')')
|
|
25506
|
+
return LOG_TABLE[n]
|
|
25507
|
+
}
|
|
25508
|
+
|
|
25509
|
+
/**
|
|
25510
|
+
* Returns anti-log value of n inside Galois Field
|
|
25511
|
+
*
|
|
25512
|
+
* @param {Number} n
|
|
25513
|
+
* @return {Number}
|
|
25514
|
+
*/
|
|
25515
|
+
exports.exp = function exp (n) {
|
|
25516
|
+
return EXP_TABLE[n]
|
|
25517
|
+
}
|
|
25518
|
+
|
|
25519
|
+
/**
|
|
25520
|
+
* Multiplies two number inside Galois Field
|
|
25521
|
+
*
|
|
25522
|
+
* @param {Number} x
|
|
25523
|
+
* @param {Number} y
|
|
25524
|
+
* @return {Number}
|
|
25525
|
+
*/
|
|
25526
|
+
exports.mul = function mul (x, y) {
|
|
25527
|
+
if (x === 0 || y === 0) return 0
|
|
25528
|
+
|
|
25529
|
+
// should be EXP_TABLE[(LOG_TABLE[x] + LOG_TABLE[y]) % 255] if EXP_TABLE wasn't oversized
|
|
25530
|
+
// @see {@link initTables}
|
|
25531
|
+
return EXP_TABLE[LOG_TABLE[x] + LOG_TABLE[y]]
|
|
25532
|
+
}
|
|
25533
|
+
|
|
25534
|
+
|
|
25535
|
+
/***/ }),
|
|
25536
|
+
|
|
25537
|
+
/***/ 559:
|
|
25538
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
25539
|
+
|
|
25540
|
+
const Mode = __webpack_require__(9282)
|
|
25541
|
+
const Utils = __webpack_require__(1916)
|
|
25542
|
+
|
|
25543
|
+
function KanjiData (data) {
|
|
25544
|
+
this.mode = Mode.KANJI
|
|
25545
|
+
this.data = data
|
|
25546
|
+
}
|
|
25547
|
+
|
|
25548
|
+
KanjiData.getBitsLength = function getBitsLength (length) {
|
|
25549
|
+
return length * 13
|
|
25550
|
+
}
|
|
25551
|
+
|
|
25552
|
+
KanjiData.prototype.getLength = function getLength () {
|
|
25553
|
+
return this.data.length
|
|
25554
|
+
}
|
|
25555
|
+
|
|
25556
|
+
KanjiData.prototype.getBitsLength = function getBitsLength () {
|
|
25557
|
+
return KanjiData.getBitsLength(this.data.length)
|
|
25558
|
+
}
|
|
25559
|
+
|
|
25560
|
+
KanjiData.prototype.write = function (bitBuffer) {
|
|
25561
|
+
let i
|
|
25562
|
+
|
|
25563
|
+
// In the Shift JIS system, Kanji characters are represented by a two byte combination.
|
|
25564
|
+
// These byte values are shifted from the JIS X 0208 values.
|
|
25565
|
+
// JIS X 0208 gives details of the shift coded representation.
|
|
25566
|
+
for (i = 0; i < this.data.length; i++) {
|
|
25567
|
+
let value = Utils.toSJIS(this.data[i])
|
|
25568
|
+
|
|
25569
|
+
// For characters with Shift JIS values from 0x8140 to 0x9FFC:
|
|
25570
|
+
if (value >= 0x8140 && value <= 0x9FFC) {
|
|
25571
|
+
// Subtract 0x8140 from Shift JIS value
|
|
25572
|
+
value -= 0x8140
|
|
25573
|
+
|
|
25574
|
+
// For characters with Shift JIS values from 0xE040 to 0xEBBF
|
|
25575
|
+
} else if (value >= 0xE040 && value <= 0xEBBF) {
|
|
25576
|
+
// Subtract 0xC140 from Shift JIS value
|
|
25577
|
+
value -= 0xC140
|
|
25578
|
+
} else {
|
|
25579
|
+
throw new Error(
|
|
25580
|
+
'Invalid SJIS character: ' + this.data[i] + '\n' +
|
|
25581
|
+
'Make sure your charset is UTF-8')
|
|
25582
|
+
}
|
|
25583
|
+
|
|
25584
|
+
// Multiply most significant byte of result by 0xC0
|
|
25585
|
+
// and add least significant byte to product
|
|
25586
|
+
value = (((value >>> 8) & 0xff) * 0xC0) + (value & 0xff)
|
|
25587
|
+
|
|
25588
|
+
// Convert result to a 13-bit binary string
|
|
25589
|
+
bitBuffer.put(value, 13)
|
|
25590
|
+
}
|
|
25591
|
+
}
|
|
25592
|
+
|
|
25593
|
+
module.exports = KanjiData
|
|
25594
|
+
|
|
25595
|
+
|
|
25596
|
+
/***/ }),
|
|
25597
|
+
|
|
25598
|
+
/***/ 3458:
|
|
25599
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
25600
|
+
|
|
25601
|
+
/**
|
|
25602
|
+
* Data mask pattern reference
|
|
25603
|
+
* @type {Object}
|
|
25604
|
+
*/
|
|
25605
|
+
exports.Patterns = {
|
|
25606
|
+
PATTERN000: 0,
|
|
25607
|
+
PATTERN001: 1,
|
|
25608
|
+
PATTERN010: 2,
|
|
25609
|
+
PATTERN011: 3,
|
|
25610
|
+
PATTERN100: 4,
|
|
25611
|
+
PATTERN101: 5,
|
|
25612
|
+
PATTERN110: 6,
|
|
25613
|
+
PATTERN111: 7
|
|
25614
|
+
}
|
|
25615
|
+
|
|
25616
|
+
/**
|
|
25617
|
+
* Weighted penalty scores for the undesirable features
|
|
25618
|
+
* @type {Object}
|
|
25619
|
+
*/
|
|
25620
|
+
const PenaltyScores = {
|
|
25621
|
+
N1: 3,
|
|
25622
|
+
N2: 3,
|
|
25623
|
+
N3: 40,
|
|
25624
|
+
N4: 10
|
|
25625
|
+
}
|
|
25626
|
+
|
|
25627
|
+
/**
|
|
25628
|
+
* Check if mask pattern value is valid
|
|
25629
|
+
*
|
|
25630
|
+
* @param {Number} mask Mask pattern
|
|
25631
|
+
* @return {Boolean} true if valid, false otherwise
|
|
25632
|
+
*/
|
|
25633
|
+
exports.isValid = function isValid (mask) {
|
|
25634
|
+
return mask != null && mask !== '' && !isNaN(mask) && mask >= 0 && mask <= 7
|
|
25635
|
+
}
|
|
25636
|
+
|
|
25637
|
+
/**
|
|
25638
|
+
* Returns mask pattern from a value.
|
|
25639
|
+
* If value is not valid, returns undefined
|
|
25640
|
+
*
|
|
25641
|
+
* @param {Number|String} value Mask pattern value
|
|
25642
|
+
* @return {Number} Valid mask pattern or undefined
|
|
25643
|
+
*/
|
|
25644
|
+
exports.from = function from (value) {
|
|
25645
|
+
return exports.isValid(value) ? parseInt(value, 10) : undefined
|
|
25646
|
+
}
|
|
25647
|
+
|
|
25648
|
+
/**
|
|
25649
|
+
* Find adjacent modules in row/column with the same color
|
|
25650
|
+
* and assign a penalty value.
|
|
25651
|
+
*
|
|
25652
|
+
* Points: N1 + i
|
|
25653
|
+
* i is the amount by which the number of adjacent modules of the same color exceeds 5
|
|
25654
|
+
*/
|
|
25655
|
+
exports.getPenaltyN1 = function getPenaltyN1 (data) {
|
|
25656
|
+
const size = data.size
|
|
25657
|
+
let points = 0
|
|
25658
|
+
let sameCountCol = 0
|
|
25659
|
+
let sameCountRow = 0
|
|
25660
|
+
let lastCol = null
|
|
25661
|
+
let lastRow = null
|
|
25662
|
+
|
|
25663
|
+
for (let row = 0; row < size; row++) {
|
|
25664
|
+
sameCountCol = sameCountRow = 0
|
|
25665
|
+
lastCol = lastRow = null
|
|
25666
|
+
|
|
25667
|
+
for (let col = 0; col < size; col++) {
|
|
25668
|
+
let module = data.get(row, col)
|
|
25669
|
+
if (module === lastCol) {
|
|
25670
|
+
sameCountCol++
|
|
25671
|
+
} else {
|
|
25672
|
+
if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5)
|
|
25673
|
+
lastCol = module
|
|
25674
|
+
sameCountCol = 1
|
|
25675
|
+
}
|
|
25676
|
+
|
|
25677
|
+
module = data.get(col, row)
|
|
25678
|
+
if (module === lastRow) {
|
|
25679
|
+
sameCountRow++
|
|
25680
|
+
} else {
|
|
25681
|
+
if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5)
|
|
25682
|
+
lastRow = module
|
|
25683
|
+
sameCountRow = 1
|
|
25684
|
+
}
|
|
25685
|
+
}
|
|
25686
|
+
|
|
25687
|
+
if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5)
|
|
25688
|
+
if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5)
|
|
25689
|
+
}
|
|
25690
|
+
|
|
25691
|
+
return points
|
|
25692
|
+
}
|
|
25693
|
+
|
|
25694
|
+
/**
|
|
25695
|
+
* Find 2x2 blocks with the same color and assign a penalty value
|
|
25696
|
+
*
|
|
25697
|
+
* Points: N2 * (m - 1) * (n - 1)
|
|
25698
|
+
*/
|
|
25699
|
+
exports.getPenaltyN2 = function getPenaltyN2 (data) {
|
|
25700
|
+
const size = data.size
|
|
25701
|
+
let points = 0
|
|
25702
|
+
|
|
25703
|
+
for (let row = 0; row < size - 1; row++) {
|
|
25704
|
+
for (let col = 0; col < size - 1; col++) {
|
|
25705
|
+
const last = data.get(row, col) +
|
|
25706
|
+
data.get(row, col + 1) +
|
|
25707
|
+
data.get(row + 1, col) +
|
|
25708
|
+
data.get(row + 1, col + 1)
|
|
25709
|
+
|
|
25710
|
+
if (last === 4 || last === 0) points++
|
|
25711
|
+
}
|
|
25712
|
+
}
|
|
25713
|
+
|
|
25714
|
+
return points * PenaltyScores.N2
|
|
25715
|
+
}
|
|
25716
|
+
|
|
25717
|
+
/**
|
|
25718
|
+
* Find 1:1:3:1:1 ratio (dark:light:dark:light:dark) pattern in row/column,
|
|
25719
|
+
* preceded or followed by light area 4 modules wide
|
|
25720
|
+
*
|
|
25721
|
+
* Points: N3 * number of pattern found
|
|
25722
|
+
*/
|
|
25723
|
+
exports.getPenaltyN3 = function getPenaltyN3 (data) {
|
|
25724
|
+
const size = data.size
|
|
25725
|
+
let points = 0
|
|
25726
|
+
let bitsCol = 0
|
|
25727
|
+
let bitsRow = 0
|
|
25728
|
+
|
|
25729
|
+
for (let row = 0; row < size; row++) {
|
|
25730
|
+
bitsCol = bitsRow = 0
|
|
25731
|
+
for (let col = 0; col < size; col++) {
|
|
25732
|
+
bitsCol = ((bitsCol << 1) & 0x7FF) | data.get(row, col)
|
|
25733
|
+
if (col >= 10 && (bitsCol === 0x5D0 || bitsCol === 0x05D)) points++
|
|
25734
|
+
|
|
25735
|
+
bitsRow = ((bitsRow << 1) & 0x7FF) | data.get(col, row)
|
|
25736
|
+
if (col >= 10 && (bitsRow === 0x5D0 || bitsRow === 0x05D)) points++
|
|
25737
|
+
}
|
|
25738
|
+
}
|
|
25739
|
+
|
|
25740
|
+
return points * PenaltyScores.N3
|
|
25741
|
+
}
|
|
25742
|
+
|
|
25743
|
+
/**
|
|
25744
|
+
* Calculate proportion of dark modules in entire symbol
|
|
25745
|
+
*
|
|
25746
|
+
* Points: N4 * k
|
|
25747
|
+
*
|
|
25748
|
+
* k is the rating of the deviation of the proportion of dark modules
|
|
25749
|
+
* in the symbol from 50% in steps of 5%
|
|
25750
|
+
*/
|
|
25751
|
+
exports.getPenaltyN4 = function getPenaltyN4 (data) {
|
|
25752
|
+
let darkCount = 0
|
|
25753
|
+
const modulesCount = data.data.length
|
|
25754
|
+
|
|
25755
|
+
for (let i = 0; i < modulesCount; i++) darkCount += data.data[i]
|
|
25756
|
+
|
|
25757
|
+
const k = Math.abs(Math.ceil((darkCount * 100 / modulesCount) / 5) - 10)
|
|
25758
|
+
|
|
25759
|
+
return k * PenaltyScores.N4
|
|
25760
|
+
}
|
|
25761
|
+
|
|
25762
|
+
/**
|
|
25763
|
+
* Return mask value at given position
|
|
25764
|
+
*
|
|
25765
|
+
* @param {Number} maskPattern Pattern reference value
|
|
25766
|
+
* @param {Number} i Row
|
|
25767
|
+
* @param {Number} j Column
|
|
25768
|
+
* @return {Boolean} Mask value
|
|
25769
|
+
*/
|
|
25770
|
+
function getMaskAt (maskPattern, i, j) {
|
|
25771
|
+
switch (maskPattern) {
|
|
25772
|
+
case exports.Patterns.PATTERN000: return (i + j) % 2 === 0
|
|
25773
|
+
case exports.Patterns.PATTERN001: return i % 2 === 0
|
|
25774
|
+
case exports.Patterns.PATTERN010: return j % 3 === 0
|
|
25775
|
+
case exports.Patterns.PATTERN011: return (i + j) % 3 === 0
|
|
25776
|
+
case exports.Patterns.PATTERN100: return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0
|
|
25777
|
+
case exports.Patterns.PATTERN101: return (i * j) % 2 + (i * j) % 3 === 0
|
|
25778
|
+
case exports.Patterns.PATTERN110: return ((i * j) % 2 + (i * j) % 3) % 2 === 0
|
|
25779
|
+
case exports.Patterns.PATTERN111: return ((i * j) % 3 + (i + j) % 2) % 2 === 0
|
|
25780
|
+
|
|
25781
|
+
default: throw new Error('bad maskPattern:' + maskPattern)
|
|
25782
|
+
}
|
|
25783
|
+
}
|
|
25784
|
+
|
|
25785
|
+
/**
|
|
25786
|
+
* Apply a mask pattern to a BitMatrix
|
|
25787
|
+
*
|
|
25788
|
+
* @param {Number} pattern Pattern reference number
|
|
25789
|
+
* @param {BitMatrix} data BitMatrix data
|
|
25790
|
+
*/
|
|
25791
|
+
exports.applyMask = function applyMask (pattern, data) {
|
|
25792
|
+
const size = data.size
|
|
25793
|
+
|
|
25794
|
+
for (let col = 0; col < size; col++) {
|
|
25795
|
+
for (let row = 0; row < size; row++) {
|
|
25796
|
+
if (data.isReserved(row, col)) continue
|
|
25797
|
+
data.xor(row, col, getMaskAt(pattern, row, col))
|
|
25798
|
+
}
|
|
25799
|
+
}
|
|
25800
|
+
}
|
|
25801
|
+
|
|
25802
|
+
/**
|
|
25803
|
+
* Returns the best mask pattern for data
|
|
25804
|
+
*
|
|
25805
|
+
* @param {BitMatrix} data
|
|
25806
|
+
* @return {Number} Mask pattern reference number
|
|
25807
|
+
*/
|
|
25808
|
+
exports.getBestMask = function getBestMask (data, setupFormatFunc) {
|
|
25809
|
+
const numPatterns = Object.keys(exports.Patterns).length
|
|
25810
|
+
let bestPattern = 0
|
|
25811
|
+
let lowerPenalty = Infinity
|
|
25812
|
+
|
|
25813
|
+
for (let p = 0; p < numPatterns; p++) {
|
|
25814
|
+
setupFormatFunc(p)
|
|
25815
|
+
exports.applyMask(p, data)
|
|
25816
|
+
|
|
25817
|
+
// Calculate penalty
|
|
25818
|
+
const penalty =
|
|
25819
|
+
exports.getPenaltyN1(data) +
|
|
25820
|
+
exports.getPenaltyN2(data) +
|
|
25821
|
+
exports.getPenaltyN3(data) +
|
|
25822
|
+
exports.getPenaltyN4(data)
|
|
25823
|
+
|
|
25824
|
+
// Undo previously applied mask
|
|
25825
|
+
exports.applyMask(p, data)
|
|
25826
|
+
|
|
25827
|
+
if (penalty < lowerPenalty) {
|
|
25828
|
+
lowerPenalty = penalty
|
|
25829
|
+
bestPattern = p
|
|
25830
|
+
}
|
|
25831
|
+
}
|
|
25832
|
+
|
|
25833
|
+
return bestPattern
|
|
25834
|
+
}
|
|
25835
|
+
|
|
25836
|
+
|
|
25837
|
+
/***/ }),
|
|
25838
|
+
|
|
25839
|
+
/***/ 9282:
|
|
25840
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
25841
|
+
|
|
25842
|
+
const VersionCheck = __webpack_require__(6344)
|
|
25843
|
+
const Regex = __webpack_require__(8094)
|
|
25844
|
+
|
|
25845
|
+
/**
|
|
25846
|
+
* Numeric mode encodes data from the decimal digit set (0 - 9)
|
|
25847
|
+
* (byte values 30HEX to 39HEX).
|
|
25848
|
+
* Normally, 3 data characters are represented by 10 bits.
|
|
25849
|
+
*
|
|
25850
|
+
* @type {Object}
|
|
25851
|
+
*/
|
|
25852
|
+
exports.NUMERIC = {
|
|
25853
|
+
id: 'Numeric',
|
|
25854
|
+
bit: 1 << 0,
|
|
25855
|
+
ccBits: [10, 12, 14]
|
|
25856
|
+
}
|
|
25857
|
+
|
|
25858
|
+
/**
|
|
25859
|
+
* Alphanumeric mode encodes data from a set of 45 characters,
|
|
25860
|
+
* i.e. 10 numeric digits (0 - 9),
|
|
25861
|
+
* 26 alphabetic characters (A - Z),
|
|
25862
|
+
* and 9 symbols (SP, $, %, *, +, -, ., /, :).
|
|
25863
|
+
* Normally, two input characters are represented by 11 bits.
|
|
25864
|
+
*
|
|
25865
|
+
* @type {Object}
|
|
25866
|
+
*/
|
|
25867
|
+
exports.ALPHANUMERIC = {
|
|
25868
|
+
id: 'Alphanumeric',
|
|
25869
|
+
bit: 1 << 1,
|
|
25870
|
+
ccBits: [9, 11, 13]
|
|
25871
|
+
}
|
|
25872
|
+
|
|
25873
|
+
/**
|
|
25874
|
+
* In byte mode, data is encoded at 8 bits per character.
|
|
25875
|
+
*
|
|
25876
|
+
* @type {Object}
|
|
25877
|
+
*/
|
|
25878
|
+
exports.BYTE = {
|
|
25879
|
+
id: 'Byte',
|
|
25880
|
+
bit: 1 << 2,
|
|
25881
|
+
ccBits: [8, 16, 16]
|
|
25882
|
+
}
|
|
25883
|
+
|
|
25884
|
+
/**
|
|
25885
|
+
* The Kanji mode efficiently encodes Kanji characters in accordance with
|
|
25886
|
+
* the Shift JIS system based on JIS X 0208.
|
|
25887
|
+
* The Shift JIS values are shifted from the JIS X 0208 values.
|
|
25888
|
+
* JIS X 0208 gives details of the shift coded representation.
|
|
25889
|
+
* Each two-byte character value is compacted to a 13-bit binary codeword.
|
|
25890
|
+
*
|
|
25891
|
+
* @type {Object}
|
|
25892
|
+
*/
|
|
25893
|
+
exports.KANJI = {
|
|
25894
|
+
id: 'Kanji',
|
|
25895
|
+
bit: 1 << 3,
|
|
25896
|
+
ccBits: [8, 10, 12]
|
|
25897
|
+
}
|
|
25898
|
+
|
|
25899
|
+
/**
|
|
25900
|
+
* Mixed mode will contain a sequences of data in a combination of any of
|
|
25901
|
+
* the modes described above
|
|
25902
|
+
*
|
|
25903
|
+
* @type {Object}
|
|
25904
|
+
*/
|
|
25905
|
+
exports.MIXED = {
|
|
25906
|
+
bit: -1
|
|
25907
|
+
}
|
|
25908
|
+
|
|
25909
|
+
/**
|
|
25910
|
+
* Returns the number of bits needed to store the data length
|
|
25911
|
+
* according to QR Code specifications.
|
|
25912
|
+
*
|
|
25913
|
+
* @param {Mode} mode Data mode
|
|
25914
|
+
* @param {Number} version QR Code version
|
|
25915
|
+
* @return {Number} Number of bits
|
|
25916
|
+
*/
|
|
25917
|
+
exports.getCharCountIndicator = function getCharCountIndicator (mode, version) {
|
|
25918
|
+
if (!mode.ccBits) throw new Error('Invalid mode: ' + mode)
|
|
25919
|
+
|
|
25920
|
+
if (!VersionCheck.isValid(version)) {
|
|
25921
|
+
throw new Error('Invalid version: ' + version)
|
|
25922
|
+
}
|
|
25923
|
+
|
|
25924
|
+
if (version >= 1 && version < 10) return mode.ccBits[0]
|
|
25925
|
+
else if (version < 27) return mode.ccBits[1]
|
|
25926
|
+
return mode.ccBits[2]
|
|
25927
|
+
}
|
|
25928
|
+
|
|
25929
|
+
/**
|
|
25930
|
+
* Returns the most efficient mode to store the specified data
|
|
25931
|
+
*
|
|
25932
|
+
* @param {String} dataStr Input data string
|
|
25933
|
+
* @return {Mode} Best mode
|
|
25934
|
+
*/
|
|
25935
|
+
exports.getBestModeForData = function getBestModeForData (dataStr) {
|
|
25936
|
+
if (Regex.testNumeric(dataStr)) return exports.NUMERIC
|
|
25937
|
+
else if (Regex.testAlphanumeric(dataStr)) return exports.ALPHANUMERIC
|
|
25938
|
+
else if (Regex.testKanji(dataStr)) return exports.KANJI
|
|
25939
|
+
else return exports.BYTE
|
|
25940
|
+
}
|
|
25941
|
+
|
|
25942
|
+
/**
|
|
25943
|
+
* Return mode name as string
|
|
25944
|
+
*
|
|
25945
|
+
* @param {Mode} mode Mode object
|
|
25946
|
+
* @returns {String} Mode name
|
|
25947
|
+
*/
|
|
25948
|
+
exports.toString = function toString (mode) {
|
|
25949
|
+
if (mode && mode.id) return mode.id
|
|
25950
|
+
throw new Error('Invalid mode')
|
|
25951
|
+
}
|
|
25952
|
+
|
|
25953
|
+
/**
|
|
25954
|
+
* Check if input param is a valid mode object
|
|
25955
|
+
*
|
|
25956
|
+
* @param {Mode} mode Mode object
|
|
25957
|
+
* @returns {Boolean} True if valid mode, false otherwise
|
|
25958
|
+
*/
|
|
25959
|
+
exports.isValid = function isValid (mode) {
|
|
25960
|
+
return mode && mode.bit && mode.ccBits
|
|
25961
|
+
}
|
|
25962
|
+
|
|
25963
|
+
/**
|
|
25964
|
+
* Get mode object from its name
|
|
25965
|
+
*
|
|
25966
|
+
* @param {String} string Mode name
|
|
25967
|
+
* @returns {Mode} Mode object
|
|
25968
|
+
*/
|
|
25969
|
+
function fromString (string) {
|
|
25970
|
+
if (typeof string !== 'string') {
|
|
25971
|
+
throw new Error('Param is not a string')
|
|
25972
|
+
}
|
|
25973
|
+
|
|
25974
|
+
const lcStr = string.toLowerCase()
|
|
25975
|
+
|
|
25976
|
+
switch (lcStr) {
|
|
25977
|
+
case 'numeric':
|
|
25978
|
+
return exports.NUMERIC
|
|
25979
|
+
case 'alphanumeric':
|
|
25980
|
+
return exports.ALPHANUMERIC
|
|
25981
|
+
case 'kanji':
|
|
25982
|
+
return exports.KANJI
|
|
25983
|
+
case 'byte':
|
|
25984
|
+
return exports.BYTE
|
|
25985
|
+
default:
|
|
25986
|
+
throw new Error('Unknown mode: ' + string)
|
|
25987
|
+
}
|
|
25988
|
+
}
|
|
25989
|
+
|
|
25990
|
+
/**
|
|
25991
|
+
* Returns mode from a value.
|
|
25992
|
+
* If value is not a valid mode, returns defaultValue
|
|
25993
|
+
*
|
|
25994
|
+
* @param {Mode|String} value Encoding mode
|
|
25995
|
+
* @param {Mode} defaultValue Fallback value
|
|
25996
|
+
* @return {Mode} Encoding mode
|
|
25997
|
+
*/
|
|
25998
|
+
exports.from = function from (value, defaultValue) {
|
|
25999
|
+
if (exports.isValid(value)) {
|
|
26000
|
+
return value
|
|
26001
|
+
}
|
|
26002
|
+
|
|
26003
|
+
try {
|
|
26004
|
+
return fromString(value)
|
|
26005
|
+
} catch (e) {
|
|
26006
|
+
return defaultValue
|
|
26007
|
+
}
|
|
26008
|
+
}
|
|
26009
|
+
|
|
26010
|
+
|
|
26011
|
+
/***/ }),
|
|
26012
|
+
|
|
26013
|
+
/***/ 9791:
|
|
26014
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
26015
|
+
|
|
26016
|
+
const Mode = __webpack_require__(9282)
|
|
26017
|
+
|
|
26018
|
+
function NumericData (data) {
|
|
26019
|
+
this.mode = Mode.NUMERIC
|
|
26020
|
+
this.data = data.toString()
|
|
26021
|
+
}
|
|
26022
|
+
|
|
26023
|
+
NumericData.getBitsLength = function getBitsLength (length) {
|
|
26024
|
+
return 10 * Math.floor(length / 3) + ((length % 3) ? ((length % 3) * 3 + 1) : 0)
|
|
26025
|
+
}
|
|
26026
|
+
|
|
26027
|
+
NumericData.prototype.getLength = function getLength () {
|
|
26028
|
+
return this.data.length
|
|
26029
|
+
}
|
|
26030
|
+
|
|
26031
|
+
NumericData.prototype.getBitsLength = function getBitsLength () {
|
|
26032
|
+
return NumericData.getBitsLength(this.data.length)
|
|
26033
|
+
}
|
|
26034
|
+
|
|
26035
|
+
NumericData.prototype.write = function write (bitBuffer) {
|
|
26036
|
+
let i, group, value
|
|
26037
|
+
|
|
26038
|
+
// The input data string is divided into groups of three digits,
|
|
26039
|
+
// and each group is converted to its 10-bit binary equivalent.
|
|
26040
|
+
for (i = 0; i + 3 <= this.data.length; i += 3) {
|
|
26041
|
+
group = this.data.substr(i, 3)
|
|
26042
|
+
value = parseInt(group, 10)
|
|
26043
|
+
|
|
26044
|
+
bitBuffer.put(value, 10)
|
|
26045
|
+
}
|
|
26046
|
+
|
|
26047
|
+
// If the number of input digits is not an exact multiple of three,
|
|
26048
|
+
// the final one or two digits are converted to 4 or 7 bits respectively.
|
|
26049
|
+
const remainingNum = this.data.length - i
|
|
26050
|
+
if (remainingNum > 0) {
|
|
26051
|
+
group = this.data.substr(i)
|
|
26052
|
+
value = parseInt(group, 10)
|
|
26053
|
+
|
|
26054
|
+
bitBuffer.put(value, remainingNum * 3 + 1)
|
|
26055
|
+
}
|
|
26056
|
+
}
|
|
26057
|
+
|
|
26058
|
+
module.exports = NumericData
|
|
26059
|
+
|
|
26060
|
+
|
|
26061
|
+
/***/ }),
|
|
26062
|
+
|
|
26063
|
+
/***/ 6067:
|
|
26064
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
26065
|
+
|
|
26066
|
+
const GF = __webpack_require__(6721)
|
|
26067
|
+
|
|
26068
|
+
/**
|
|
26069
|
+
* Multiplies two polynomials inside Galois Field
|
|
26070
|
+
*
|
|
26071
|
+
* @param {Uint8Array} p1 Polynomial
|
|
26072
|
+
* @param {Uint8Array} p2 Polynomial
|
|
26073
|
+
* @return {Uint8Array} Product of p1 and p2
|
|
26074
|
+
*/
|
|
26075
|
+
exports.mul = function mul (p1, p2) {
|
|
26076
|
+
const coeff = new Uint8Array(p1.length + p2.length - 1)
|
|
26077
|
+
|
|
26078
|
+
for (let i = 0; i < p1.length; i++) {
|
|
26079
|
+
for (let j = 0; j < p2.length; j++) {
|
|
26080
|
+
coeff[i + j] ^= GF.mul(p1[i], p2[j])
|
|
26081
|
+
}
|
|
26082
|
+
}
|
|
26083
|
+
|
|
26084
|
+
return coeff
|
|
26085
|
+
}
|
|
26086
|
+
|
|
26087
|
+
/**
|
|
26088
|
+
* Calculate the remainder of polynomials division
|
|
26089
|
+
*
|
|
26090
|
+
* @param {Uint8Array} divident Polynomial
|
|
26091
|
+
* @param {Uint8Array} divisor Polynomial
|
|
26092
|
+
* @return {Uint8Array} Remainder
|
|
26093
|
+
*/
|
|
26094
|
+
exports.mod = function mod (divident, divisor) {
|
|
26095
|
+
let result = new Uint8Array(divident)
|
|
26096
|
+
|
|
26097
|
+
while ((result.length - divisor.length) >= 0) {
|
|
26098
|
+
const coeff = result[0]
|
|
26099
|
+
|
|
26100
|
+
for (let i = 0; i < divisor.length; i++) {
|
|
26101
|
+
result[i] ^= GF.mul(divisor[i], coeff)
|
|
26102
|
+
}
|
|
26103
|
+
|
|
26104
|
+
// remove all zeros from buffer head
|
|
26105
|
+
let offset = 0
|
|
26106
|
+
while (offset < result.length && result[offset] === 0) offset++
|
|
26107
|
+
result = result.slice(offset)
|
|
26108
|
+
}
|
|
26109
|
+
|
|
26110
|
+
return result
|
|
26111
|
+
}
|
|
26112
|
+
|
|
26113
|
+
/**
|
|
26114
|
+
* Generate an irreducible generator polynomial of specified degree
|
|
26115
|
+
* (used by Reed-Solomon encoder)
|
|
26116
|
+
*
|
|
26117
|
+
* @param {Number} degree Degree of the generator polynomial
|
|
26118
|
+
* @return {Uint8Array} Buffer containing polynomial coefficients
|
|
26119
|
+
*/
|
|
26120
|
+
exports.generateECPolynomial = function generateECPolynomial (degree) {
|
|
26121
|
+
let poly = new Uint8Array([1])
|
|
26122
|
+
for (let i = 0; i < degree; i++) {
|
|
26123
|
+
poly = exports.mul(poly, new Uint8Array([1, GF.exp(i)]))
|
|
26124
|
+
}
|
|
26125
|
+
|
|
26126
|
+
return poly
|
|
26127
|
+
}
|
|
26128
|
+
|
|
26129
|
+
|
|
26130
|
+
/***/ }),
|
|
26131
|
+
|
|
26132
|
+
/***/ 4191:
|
|
26133
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
26134
|
+
|
|
26135
|
+
const Utils = __webpack_require__(1916)
|
|
26136
|
+
const ECLevel = __webpack_require__(9175)
|
|
26137
|
+
const BitBuffer = __webpack_require__(4445)
|
|
26138
|
+
const BitMatrix = __webpack_require__(562)
|
|
26139
|
+
const AlignmentPattern = __webpack_require__(2795)
|
|
26140
|
+
const FinderPattern = __webpack_require__(2902)
|
|
26141
|
+
const MaskPattern = __webpack_require__(3458)
|
|
26142
|
+
const ECCode = __webpack_require__(8444)
|
|
26143
|
+
const ReedSolomonEncoder = __webpack_require__(2194)
|
|
26144
|
+
const Version = __webpack_require__(3505)
|
|
26145
|
+
const FormatInfo = __webpack_require__(6895)
|
|
26146
|
+
const Mode = __webpack_require__(9282)
|
|
26147
|
+
const Segments = __webpack_require__(9039)
|
|
26148
|
+
|
|
26149
|
+
/**
|
|
26150
|
+
* QRCode for JavaScript
|
|
26151
|
+
*
|
|
26152
|
+
* modified by Ryan Day for nodejs support
|
|
26153
|
+
* Copyright (c) 2011 Ryan Day
|
|
26154
|
+
*
|
|
26155
|
+
* Licensed under the MIT license:
|
|
26156
|
+
* http://www.opensource.org/licenses/mit-license.php
|
|
26157
|
+
*
|
|
26158
|
+
//---------------------------------------------------------------------
|
|
26159
|
+
// QRCode for JavaScript
|
|
26160
|
+
//
|
|
26161
|
+
// Copyright (c) 2009 Kazuhiko Arase
|
|
26162
|
+
//
|
|
26163
|
+
// URL: http://www.d-project.com/
|
|
26164
|
+
//
|
|
26165
|
+
// Licensed under the MIT license:
|
|
26166
|
+
// http://www.opensource.org/licenses/mit-license.php
|
|
26167
|
+
//
|
|
26168
|
+
// The word "QR Code" is registered trademark of
|
|
26169
|
+
// DENSO WAVE INCORPORATED
|
|
26170
|
+
// http://www.denso-wave.com/qrcode/faqpatent-e.html
|
|
26171
|
+
//
|
|
26172
|
+
//---------------------------------------------------------------------
|
|
26173
|
+
*/
|
|
26174
|
+
|
|
26175
|
+
/**
|
|
26176
|
+
* Add finder patterns bits to matrix
|
|
26177
|
+
*
|
|
26178
|
+
* @param {BitMatrix} matrix Modules matrix
|
|
26179
|
+
* @param {Number} version QR Code version
|
|
26180
|
+
*/
|
|
26181
|
+
function setupFinderPattern (matrix, version) {
|
|
26182
|
+
const size = matrix.size
|
|
26183
|
+
const pos = FinderPattern.getPositions(version)
|
|
26184
|
+
|
|
26185
|
+
for (let i = 0; i < pos.length; i++) {
|
|
26186
|
+
const row = pos[i][0]
|
|
26187
|
+
const col = pos[i][1]
|
|
26188
|
+
|
|
26189
|
+
for (let r = -1; r <= 7; r++) {
|
|
26190
|
+
if (row + r <= -1 || size <= row + r) continue
|
|
26191
|
+
|
|
26192
|
+
for (let c = -1; c <= 7; c++) {
|
|
26193
|
+
if (col + c <= -1 || size <= col + c) continue
|
|
26194
|
+
|
|
26195
|
+
if ((r >= 0 && r <= 6 && (c === 0 || c === 6)) ||
|
|
26196
|
+
(c >= 0 && c <= 6 && (r === 0 || r === 6)) ||
|
|
26197
|
+
(r >= 2 && r <= 4 && c >= 2 && c <= 4)) {
|
|
26198
|
+
matrix.set(row + r, col + c, true, true)
|
|
26199
|
+
} else {
|
|
26200
|
+
matrix.set(row + r, col + c, false, true)
|
|
26201
|
+
}
|
|
26202
|
+
}
|
|
26203
|
+
}
|
|
26204
|
+
}
|
|
26205
|
+
}
|
|
26206
|
+
|
|
26207
|
+
/**
|
|
26208
|
+
* Add timing pattern bits to matrix
|
|
26209
|
+
*
|
|
26210
|
+
* Note: this function must be called before {@link setupAlignmentPattern}
|
|
26211
|
+
*
|
|
26212
|
+
* @param {BitMatrix} matrix Modules matrix
|
|
26213
|
+
*/
|
|
26214
|
+
function setupTimingPattern (matrix) {
|
|
26215
|
+
const size = matrix.size
|
|
26216
|
+
|
|
26217
|
+
for (let r = 8; r < size - 8; r++) {
|
|
26218
|
+
const value = r % 2 === 0
|
|
26219
|
+
matrix.set(r, 6, value, true)
|
|
26220
|
+
matrix.set(6, r, value, true)
|
|
26221
|
+
}
|
|
26222
|
+
}
|
|
26223
|
+
|
|
26224
|
+
/**
|
|
26225
|
+
* Add alignment patterns bits to matrix
|
|
26226
|
+
*
|
|
26227
|
+
* Note: this function must be called after {@link setupTimingPattern}
|
|
26228
|
+
*
|
|
26229
|
+
* @param {BitMatrix} matrix Modules matrix
|
|
26230
|
+
* @param {Number} version QR Code version
|
|
26231
|
+
*/
|
|
26232
|
+
function setupAlignmentPattern (matrix, version) {
|
|
26233
|
+
const pos = AlignmentPattern.getPositions(version)
|
|
26234
|
+
|
|
26235
|
+
for (let i = 0; i < pos.length; i++) {
|
|
26236
|
+
const row = pos[i][0]
|
|
26237
|
+
const col = pos[i][1]
|
|
26238
|
+
|
|
26239
|
+
for (let r = -2; r <= 2; r++) {
|
|
26240
|
+
for (let c = -2; c <= 2; c++) {
|
|
26241
|
+
if (r === -2 || r === 2 || c === -2 || c === 2 ||
|
|
26242
|
+
(r === 0 && c === 0)) {
|
|
26243
|
+
matrix.set(row + r, col + c, true, true)
|
|
26244
|
+
} else {
|
|
26245
|
+
matrix.set(row + r, col + c, false, true)
|
|
26246
|
+
}
|
|
26247
|
+
}
|
|
26248
|
+
}
|
|
26249
|
+
}
|
|
26250
|
+
}
|
|
26251
|
+
|
|
26252
|
+
/**
|
|
26253
|
+
* Add version info bits to matrix
|
|
26254
|
+
*
|
|
26255
|
+
* @param {BitMatrix} matrix Modules matrix
|
|
26256
|
+
* @param {Number} version QR Code version
|
|
26257
|
+
*/
|
|
26258
|
+
function setupVersionInfo (matrix, version) {
|
|
26259
|
+
const size = matrix.size
|
|
26260
|
+
const bits = Version.getEncodedBits(version)
|
|
26261
|
+
let row, col, mod
|
|
26262
|
+
|
|
26263
|
+
for (let i = 0; i < 18; i++) {
|
|
26264
|
+
row = Math.floor(i / 3)
|
|
26265
|
+
col = i % 3 + size - 8 - 3
|
|
26266
|
+
mod = ((bits >> i) & 1) === 1
|
|
26267
|
+
|
|
26268
|
+
matrix.set(row, col, mod, true)
|
|
26269
|
+
matrix.set(col, row, mod, true)
|
|
26270
|
+
}
|
|
26271
|
+
}
|
|
26272
|
+
|
|
26273
|
+
/**
|
|
26274
|
+
* Add format info bits to matrix
|
|
26275
|
+
*
|
|
26276
|
+
* @param {BitMatrix} matrix Modules matrix
|
|
26277
|
+
* @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
|
|
26278
|
+
* @param {Number} maskPattern Mask pattern reference value
|
|
26279
|
+
*/
|
|
26280
|
+
function setupFormatInfo (matrix, errorCorrectionLevel, maskPattern) {
|
|
26281
|
+
const size = matrix.size
|
|
26282
|
+
const bits = FormatInfo.getEncodedBits(errorCorrectionLevel, maskPattern)
|
|
26283
|
+
let i, mod
|
|
26284
|
+
|
|
26285
|
+
for (i = 0; i < 15; i++) {
|
|
26286
|
+
mod = ((bits >> i) & 1) === 1
|
|
26287
|
+
|
|
26288
|
+
// vertical
|
|
26289
|
+
if (i < 6) {
|
|
26290
|
+
matrix.set(i, 8, mod, true)
|
|
26291
|
+
} else if (i < 8) {
|
|
26292
|
+
matrix.set(i + 1, 8, mod, true)
|
|
26293
|
+
} else {
|
|
26294
|
+
matrix.set(size - 15 + i, 8, mod, true)
|
|
26295
|
+
}
|
|
26296
|
+
|
|
26297
|
+
// horizontal
|
|
26298
|
+
if (i < 8) {
|
|
26299
|
+
matrix.set(8, size - i - 1, mod, true)
|
|
26300
|
+
} else if (i < 9) {
|
|
26301
|
+
matrix.set(8, 15 - i - 1 + 1, mod, true)
|
|
26302
|
+
} else {
|
|
26303
|
+
matrix.set(8, 15 - i - 1, mod, true)
|
|
26304
|
+
}
|
|
26305
|
+
}
|
|
26306
|
+
|
|
26307
|
+
// fixed module
|
|
26308
|
+
matrix.set(size - 8, 8, 1, true)
|
|
26309
|
+
}
|
|
26310
|
+
|
|
26311
|
+
/**
|
|
26312
|
+
* Add encoded data bits to matrix
|
|
26313
|
+
*
|
|
26314
|
+
* @param {BitMatrix} matrix Modules matrix
|
|
26315
|
+
* @param {Uint8Array} data Data codewords
|
|
26316
|
+
*/
|
|
26317
|
+
function setupData (matrix, data) {
|
|
26318
|
+
const size = matrix.size
|
|
26319
|
+
let inc = -1
|
|
26320
|
+
let row = size - 1
|
|
26321
|
+
let bitIndex = 7
|
|
26322
|
+
let byteIndex = 0
|
|
26323
|
+
|
|
26324
|
+
for (let col = size - 1; col > 0; col -= 2) {
|
|
26325
|
+
if (col === 6) col--
|
|
26326
|
+
|
|
26327
|
+
while (true) {
|
|
26328
|
+
for (let c = 0; c < 2; c++) {
|
|
26329
|
+
if (!matrix.isReserved(row, col - c)) {
|
|
26330
|
+
let dark = false
|
|
26331
|
+
|
|
26332
|
+
if (byteIndex < data.length) {
|
|
26333
|
+
dark = (((data[byteIndex] >>> bitIndex) & 1) === 1)
|
|
26334
|
+
}
|
|
26335
|
+
|
|
26336
|
+
matrix.set(row, col - c, dark)
|
|
26337
|
+
bitIndex--
|
|
26338
|
+
|
|
26339
|
+
if (bitIndex === -1) {
|
|
26340
|
+
byteIndex++
|
|
26341
|
+
bitIndex = 7
|
|
26342
|
+
}
|
|
26343
|
+
}
|
|
26344
|
+
}
|
|
26345
|
+
|
|
26346
|
+
row += inc
|
|
26347
|
+
|
|
26348
|
+
if (row < 0 || size <= row) {
|
|
26349
|
+
row -= inc
|
|
26350
|
+
inc = -inc
|
|
26351
|
+
break
|
|
26352
|
+
}
|
|
26353
|
+
}
|
|
26354
|
+
}
|
|
26355
|
+
}
|
|
26356
|
+
|
|
26357
|
+
/**
|
|
26358
|
+
* Create encoded codewords from data input
|
|
26359
|
+
*
|
|
26360
|
+
* @param {Number} version QR Code version
|
|
26361
|
+
* @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
|
|
26362
|
+
* @param {ByteData} data Data input
|
|
26363
|
+
* @return {Uint8Array} Buffer containing encoded codewords
|
|
26364
|
+
*/
|
|
26365
|
+
function createData (version, errorCorrectionLevel, segments) {
|
|
26366
|
+
// Prepare data buffer
|
|
26367
|
+
const buffer = new BitBuffer()
|
|
26368
|
+
|
|
26369
|
+
segments.forEach(function (data) {
|
|
26370
|
+
// prefix data with mode indicator (4 bits)
|
|
26371
|
+
buffer.put(data.mode.bit, 4)
|
|
26372
|
+
|
|
26373
|
+
// Prefix data with character count indicator.
|
|
26374
|
+
// The character count indicator is a string of bits that represents the
|
|
26375
|
+
// number of characters that are being encoded.
|
|
26376
|
+
// The character count indicator must be placed after the mode indicator
|
|
26377
|
+
// and must be a certain number of bits long, depending on the QR version
|
|
26378
|
+
// and data mode
|
|
26379
|
+
// @see {@link Mode.getCharCountIndicator}.
|
|
26380
|
+
buffer.put(data.getLength(), Mode.getCharCountIndicator(data.mode, version))
|
|
26381
|
+
|
|
26382
|
+
// add binary data sequence to buffer
|
|
26383
|
+
data.write(buffer)
|
|
26384
|
+
})
|
|
26385
|
+
|
|
26386
|
+
// Calculate required number of bits
|
|
26387
|
+
const totalCodewords = Utils.getSymbolTotalCodewords(version)
|
|
26388
|
+
const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)
|
|
26389
|
+
const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8
|
|
26390
|
+
|
|
26391
|
+
// Add a terminator.
|
|
26392
|
+
// If the bit string is shorter than the total number of required bits,
|
|
26393
|
+
// a terminator of up to four 0s must be added to the right side of the string.
|
|
26394
|
+
// If the bit string is more than four bits shorter than the required number of bits,
|
|
26395
|
+
// add four 0s to the end.
|
|
26396
|
+
if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) {
|
|
26397
|
+
buffer.put(0, 4)
|
|
26398
|
+
}
|
|
26399
|
+
|
|
26400
|
+
// If the bit string is fewer than four bits shorter, add only the number of 0s that
|
|
26401
|
+
// are needed to reach the required number of bits.
|
|
26402
|
+
|
|
26403
|
+
// After adding the terminator, if the number of bits in the string is not a multiple of 8,
|
|
26404
|
+
// pad the string on the right with 0s to make the string's length a multiple of 8.
|
|
26405
|
+
while (buffer.getLengthInBits() % 8 !== 0) {
|
|
26406
|
+
buffer.putBit(0)
|
|
26407
|
+
}
|
|
26408
|
+
|
|
26409
|
+
// Add pad bytes if the string is still shorter than the total number of required bits.
|
|
26410
|
+
// Extend the buffer to fill the data capacity of the symbol corresponding to
|
|
26411
|
+
// the Version and Error Correction Level by adding the Pad Codewords 11101100 (0xEC)
|
|
26412
|
+
// and 00010001 (0x11) alternately.
|
|
26413
|
+
const remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8
|
|
26414
|
+
for (let i = 0; i < remainingByte; i++) {
|
|
26415
|
+
buffer.put(i % 2 ? 0x11 : 0xEC, 8)
|
|
26416
|
+
}
|
|
26417
|
+
|
|
26418
|
+
return createCodewords(buffer, version, errorCorrectionLevel)
|
|
26419
|
+
}
|
|
26420
|
+
|
|
26421
|
+
/**
|
|
26422
|
+
* Encode input data with Reed-Solomon and return codewords with
|
|
26423
|
+
* relative error correction bits
|
|
26424
|
+
*
|
|
26425
|
+
* @param {BitBuffer} bitBuffer Data to encode
|
|
26426
|
+
* @param {Number} version QR Code version
|
|
26427
|
+
* @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
|
|
26428
|
+
* @return {Uint8Array} Buffer containing encoded codewords
|
|
26429
|
+
*/
|
|
26430
|
+
function createCodewords (bitBuffer, version, errorCorrectionLevel) {
|
|
26431
|
+
// Total codewords for this QR code version (Data + Error correction)
|
|
26432
|
+
const totalCodewords = Utils.getSymbolTotalCodewords(version)
|
|
26433
|
+
|
|
26434
|
+
// Total number of error correction codewords
|
|
26435
|
+
const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)
|
|
26436
|
+
|
|
26437
|
+
// Total number of data codewords
|
|
26438
|
+
const dataTotalCodewords = totalCodewords - ecTotalCodewords
|
|
26439
|
+
|
|
26440
|
+
// Total number of blocks
|
|
26441
|
+
const ecTotalBlocks = ECCode.getBlocksCount(version, errorCorrectionLevel)
|
|
26442
|
+
|
|
26443
|
+
// Calculate how many blocks each group should contain
|
|
26444
|
+
const blocksInGroup2 = totalCodewords % ecTotalBlocks
|
|
26445
|
+
const blocksInGroup1 = ecTotalBlocks - blocksInGroup2
|
|
26446
|
+
|
|
26447
|
+
const totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks)
|
|
26448
|
+
|
|
26449
|
+
const dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks)
|
|
26450
|
+
const dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1
|
|
26451
|
+
|
|
26452
|
+
// Number of EC codewords is the same for both groups
|
|
26453
|
+
const ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1
|
|
26454
|
+
|
|
26455
|
+
// Initialize a Reed-Solomon encoder with a generator polynomial of degree ecCount
|
|
26456
|
+
const rs = new ReedSolomonEncoder(ecCount)
|
|
26457
|
+
|
|
26458
|
+
let offset = 0
|
|
26459
|
+
const dcData = new Array(ecTotalBlocks)
|
|
26460
|
+
const ecData = new Array(ecTotalBlocks)
|
|
26461
|
+
let maxDataSize = 0
|
|
26462
|
+
const buffer = new Uint8Array(bitBuffer.buffer)
|
|
26463
|
+
|
|
26464
|
+
// Divide the buffer into the required number of blocks
|
|
26465
|
+
for (let b = 0; b < ecTotalBlocks; b++) {
|
|
26466
|
+
const dataSize = b < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2
|
|
26467
|
+
|
|
26468
|
+
// extract a block of data from buffer
|
|
26469
|
+
dcData[b] = buffer.slice(offset, offset + dataSize)
|
|
26470
|
+
|
|
26471
|
+
// Calculate EC codewords for this data block
|
|
26472
|
+
ecData[b] = rs.encode(dcData[b])
|
|
26473
|
+
|
|
26474
|
+
offset += dataSize
|
|
26475
|
+
maxDataSize = Math.max(maxDataSize, dataSize)
|
|
26476
|
+
}
|
|
26477
|
+
|
|
26478
|
+
// Create final data
|
|
26479
|
+
// Interleave the data and error correction codewords from each block
|
|
26480
|
+
const data = new Uint8Array(totalCodewords)
|
|
26481
|
+
let index = 0
|
|
26482
|
+
let i, r
|
|
26483
|
+
|
|
26484
|
+
// Add data codewords
|
|
26485
|
+
for (i = 0; i < maxDataSize; i++) {
|
|
26486
|
+
for (r = 0; r < ecTotalBlocks; r++) {
|
|
26487
|
+
if (i < dcData[r].length) {
|
|
26488
|
+
data[index++] = dcData[r][i]
|
|
26489
|
+
}
|
|
26490
|
+
}
|
|
26491
|
+
}
|
|
26492
|
+
|
|
26493
|
+
// Apped EC codewords
|
|
26494
|
+
for (i = 0; i < ecCount; i++) {
|
|
26495
|
+
for (r = 0; r < ecTotalBlocks; r++) {
|
|
26496
|
+
data[index++] = ecData[r][i]
|
|
26497
|
+
}
|
|
26498
|
+
}
|
|
26499
|
+
|
|
26500
|
+
return data
|
|
26501
|
+
}
|
|
26502
|
+
|
|
26503
|
+
/**
|
|
26504
|
+
* Build QR Code symbol
|
|
26505
|
+
*
|
|
26506
|
+
* @param {String} data Input string
|
|
26507
|
+
* @param {Number} version QR Code version
|
|
26508
|
+
* @param {ErrorCorretionLevel} errorCorrectionLevel Error level
|
|
26509
|
+
* @param {MaskPattern} maskPattern Mask pattern
|
|
26510
|
+
* @return {Object} Object containing symbol data
|
|
26511
|
+
*/
|
|
26512
|
+
function createSymbol (data, version, errorCorrectionLevel, maskPattern) {
|
|
26513
|
+
let segments
|
|
26514
|
+
|
|
26515
|
+
if (Array.isArray(data)) {
|
|
26516
|
+
segments = Segments.fromArray(data)
|
|
26517
|
+
} else if (typeof data === 'string') {
|
|
26518
|
+
let estimatedVersion = version
|
|
26519
|
+
|
|
26520
|
+
if (!estimatedVersion) {
|
|
26521
|
+
const rawSegments = Segments.rawSplit(data)
|
|
26522
|
+
|
|
26523
|
+
// Estimate best version that can contain raw splitted segments
|
|
26524
|
+
estimatedVersion = Version.getBestVersionForData(rawSegments, errorCorrectionLevel)
|
|
26525
|
+
}
|
|
26526
|
+
|
|
26527
|
+
// Build optimized segments
|
|
26528
|
+
// If estimated version is undefined, try with the highest version
|
|
26529
|
+
segments = Segments.fromString(data, estimatedVersion || 40)
|
|
26530
|
+
} else {
|
|
26531
|
+
throw new Error('Invalid data')
|
|
26532
|
+
}
|
|
26533
|
+
|
|
26534
|
+
// Get the min version that can contain data
|
|
26535
|
+
const bestVersion = Version.getBestVersionForData(segments, errorCorrectionLevel)
|
|
26536
|
+
|
|
26537
|
+
// If no version is found, data cannot be stored
|
|
26538
|
+
if (!bestVersion) {
|
|
26539
|
+
throw new Error('The amount of data is too big to be stored in a QR Code')
|
|
26540
|
+
}
|
|
26541
|
+
|
|
26542
|
+
// If not specified, use min version as default
|
|
26543
|
+
if (!version) {
|
|
26544
|
+
version = bestVersion
|
|
26545
|
+
|
|
26546
|
+
// Check if the specified version can contain the data
|
|
26547
|
+
} else if (version < bestVersion) {
|
|
26548
|
+
throw new Error('\n' +
|
|
26549
|
+
'The chosen QR Code version cannot contain this amount of data.\n' +
|
|
26550
|
+
'Minimum version required to store current data is: ' + bestVersion + '.\n'
|
|
26551
|
+
)
|
|
26552
|
+
}
|
|
26553
|
+
|
|
26554
|
+
const dataBits = createData(version, errorCorrectionLevel, segments)
|
|
26555
|
+
|
|
26556
|
+
// Allocate matrix buffer
|
|
26557
|
+
const moduleCount = Utils.getSymbolSize(version)
|
|
26558
|
+
const modules = new BitMatrix(moduleCount)
|
|
26559
|
+
|
|
26560
|
+
// Add function modules
|
|
26561
|
+
setupFinderPattern(modules, version)
|
|
26562
|
+
setupTimingPattern(modules)
|
|
26563
|
+
setupAlignmentPattern(modules, version)
|
|
26564
|
+
|
|
26565
|
+
// Add temporary dummy bits for format info just to set them as reserved.
|
|
26566
|
+
// This is needed to prevent these bits from being masked by {@link MaskPattern.applyMask}
|
|
26567
|
+
// since the masking operation must be performed only on the encoding region.
|
|
26568
|
+
// These blocks will be replaced with correct values later in code.
|
|
26569
|
+
setupFormatInfo(modules, errorCorrectionLevel, 0)
|
|
26570
|
+
|
|
26571
|
+
if (version >= 7) {
|
|
26572
|
+
setupVersionInfo(modules, version)
|
|
26573
|
+
}
|
|
26574
|
+
|
|
26575
|
+
// Add data codewords
|
|
26576
|
+
setupData(modules, dataBits)
|
|
26577
|
+
|
|
26578
|
+
if (isNaN(maskPattern)) {
|
|
26579
|
+
// Find best mask pattern
|
|
26580
|
+
maskPattern = MaskPattern.getBestMask(modules,
|
|
26581
|
+
setupFormatInfo.bind(null, modules, errorCorrectionLevel))
|
|
26582
|
+
}
|
|
26583
|
+
|
|
26584
|
+
// Apply mask pattern
|
|
26585
|
+
MaskPattern.applyMask(maskPattern, modules)
|
|
26586
|
+
|
|
26587
|
+
// Replace format info bits with correct values
|
|
26588
|
+
setupFormatInfo(modules, errorCorrectionLevel, maskPattern)
|
|
26589
|
+
|
|
26590
|
+
return {
|
|
26591
|
+
modules: modules,
|
|
26592
|
+
version: version,
|
|
26593
|
+
errorCorrectionLevel: errorCorrectionLevel,
|
|
26594
|
+
maskPattern: maskPattern,
|
|
26595
|
+
segments: segments
|
|
26596
|
+
}
|
|
26597
|
+
}
|
|
26598
|
+
|
|
26599
|
+
/**
|
|
26600
|
+
* QR Code
|
|
26601
|
+
*
|
|
26602
|
+
* @param {String | Array} data Input data
|
|
26603
|
+
* @param {Object} options Optional configurations
|
|
26604
|
+
* @param {Number} options.version QR Code version
|
|
26605
|
+
* @param {String} options.errorCorrectionLevel Error correction level
|
|
26606
|
+
* @param {Function} options.toSJISFunc Helper func to convert utf8 to sjis
|
|
26607
|
+
*/
|
|
26608
|
+
exports.create = function create (data, options) {
|
|
26609
|
+
if (typeof data === 'undefined' || data === '') {
|
|
26610
|
+
throw new Error('No input text')
|
|
26611
|
+
}
|
|
26612
|
+
|
|
26613
|
+
let errorCorrectionLevel = ECLevel.M
|
|
26614
|
+
let version
|
|
26615
|
+
let mask
|
|
26616
|
+
|
|
26617
|
+
if (typeof options !== 'undefined') {
|
|
26618
|
+
// Use higher error correction level as default
|
|
26619
|
+
errorCorrectionLevel = ECLevel.from(options.errorCorrectionLevel, ECLevel.M)
|
|
26620
|
+
version = Version.from(options.version)
|
|
26621
|
+
mask = MaskPattern.from(options.maskPattern)
|
|
26622
|
+
|
|
26623
|
+
if (options.toSJISFunc) {
|
|
26624
|
+
Utils.setToSJISFunction(options.toSJISFunc)
|
|
26625
|
+
}
|
|
26626
|
+
}
|
|
26627
|
+
|
|
26628
|
+
return createSymbol(data, version, errorCorrectionLevel, mask)
|
|
26629
|
+
}
|
|
26630
|
+
|
|
26631
|
+
|
|
26632
|
+
/***/ }),
|
|
26633
|
+
|
|
26634
|
+
/***/ 2194:
|
|
26635
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
26636
|
+
|
|
26637
|
+
const Polynomial = __webpack_require__(6067)
|
|
26638
|
+
|
|
26639
|
+
function ReedSolomonEncoder (degree) {
|
|
26640
|
+
this.genPoly = undefined
|
|
26641
|
+
this.degree = degree
|
|
26642
|
+
|
|
26643
|
+
if (this.degree) this.initialize(this.degree)
|
|
26644
|
+
}
|
|
26645
|
+
|
|
26646
|
+
/**
|
|
26647
|
+
* Initialize the encoder.
|
|
26648
|
+
* The input param should correspond to the number of error correction codewords.
|
|
26649
|
+
*
|
|
26650
|
+
* @param {Number} degree
|
|
26651
|
+
*/
|
|
26652
|
+
ReedSolomonEncoder.prototype.initialize = function initialize (degree) {
|
|
26653
|
+
// create an irreducible generator polynomial
|
|
26654
|
+
this.degree = degree
|
|
26655
|
+
this.genPoly = Polynomial.generateECPolynomial(this.degree)
|
|
26656
|
+
}
|
|
26657
|
+
|
|
26658
|
+
/**
|
|
26659
|
+
* Encodes a chunk of data
|
|
26660
|
+
*
|
|
26661
|
+
* @param {Uint8Array} data Buffer containing input data
|
|
26662
|
+
* @return {Uint8Array} Buffer containing encoded data
|
|
26663
|
+
*/
|
|
26664
|
+
ReedSolomonEncoder.prototype.encode = function encode (data) {
|
|
26665
|
+
if (!this.genPoly) {
|
|
26666
|
+
throw new Error('Encoder not initialized')
|
|
26667
|
+
}
|
|
26668
|
+
|
|
26669
|
+
// Calculate EC for this data block
|
|
26670
|
+
// extends data size to data+genPoly size
|
|
26671
|
+
const paddedData = new Uint8Array(data.length + this.degree)
|
|
26672
|
+
paddedData.set(data)
|
|
26673
|
+
|
|
26674
|
+
// The error correction codewords are the remainder after dividing the data codewords
|
|
26675
|
+
// by a generator polynomial
|
|
26676
|
+
const remainder = Polynomial.mod(paddedData, this.genPoly)
|
|
26677
|
+
|
|
26678
|
+
// return EC data blocks (last n byte, where n is the degree of genPoly)
|
|
26679
|
+
// If coefficients number in remainder are less than genPoly degree,
|
|
26680
|
+
// pad with 0s to the left to reach the needed number of coefficients
|
|
26681
|
+
const start = this.degree - remainder.length
|
|
26682
|
+
if (start > 0) {
|
|
26683
|
+
const buff = new Uint8Array(this.degree)
|
|
26684
|
+
buff.set(remainder, start)
|
|
26685
|
+
|
|
26686
|
+
return buff
|
|
26687
|
+
}
|
|
26688
|
+
|
|
26689
|
+
return remainder
|
|
26690
|
+
}
|
|
26691
|
+
|
|
26692
|
+
module.exports = ReedSolomonEncoder
|
|
26693
|
+
|
|
26694
|
+
|
|
26695
|
+
/***/ }),
|
|
26696
|
+
|
|
26697
|
+
/***/ 8094:
|
|
26698
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
26699
|
+
|
|
26700
|
+
const numeric = '[0-9]+'
|
|
26701
|
+
const alphanumeric = '[A-Z $%*+\\-./:]+'
|
|
26702
|
+
let kanji = '(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|' +
|
|
26703
|
+
'[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|' +
|
|
26704
|
+
'[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|' +
|
|
26705
|
+
'[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+'
|
|
26706
|
+
kanji = kanji.replace(/u/g, '\\u')
|
|
26707
|
+
|
|
26708
|
+
const byte = '(?:(?![A-Z0-9 $%*+\\-./:]|' + kanji + ')(?:.|[\r\n]))+'
|
|
26709
|
+
|
|
26710
|
+
exports.KANJI = new RegExp(kanji, 'g')
|
|
26711
|
+
exports.BYTE_KANJI = new RegExp('[^A-Z0-9 $%*+\\-./:]+', 'g')
|
|
26712
|
+
exports.BYTE = new RegExp(byte, 'g')
|
|
26713
|
+
exports.NUMERIC = new RegExp(numeric, 'g')
|
|
26714
|
+
exports.ALPHANUMERIC = new RegExp(alphanumeric, 'g')
|
|
26715
|
+
|
|
26716
|
+
const TEST_KANJI = new RegExp('^' + kanji + '$')
|
|
26717
|
+
const TEST_NUMERIC = new RegExp('^' + numeric + '$')
|
|
26718
|
+
const TEST_ALPHANUMERIC = new RegExp('^[A-Z0-9 $%*+\\-./:]+$')
|
|
26719
|
+
|
|
26720
|
+
exports.testKanji = function testKanji (str) {
|
|
26721
|
+
return TEST_KANJI.test(str)
|
|
26722
|
+
}
|
|
26723
|
+
|
|
26724
|
+
exports.testNumeric = function testNumeric (str) {
|
|
26725
|
+
return TEST_NUMERIC.test(str)
|
|
26726
|
+
}
|
|
26727
|
+
|
|
26728
|
+
exports.testAlphanumeric = function testAlphanumeric (str) {
|
|
26729
|
+
return TEST_ALPHANUMERIC.test(str)
|
|
26730
|
+
}
|
|
26731
|
+
|
|
26732
|
+
|
|
26733
|
+
/***/ }),
|
|
26734
|
+
|
|
26735
|
+
/***/ 9039:
|
|
26736
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
26737
|
+
|
|
26738
|
+
const Mode = __webpack_require__(9282)
|
|
26739
|
+
const NumericData = __webpack_require__(9791)
|
|
26740
|
+
const AlphanumericData = __webpack_require__(1975)
|
|
26741
|
+
const ByteData = __webpack_require__(3892)
|
|
26742
|
+
const KanjiData = __webpack_require__(559)
|
|
26743
|
+
const Regex = __webpack_require__(8094)
|
|
26744
|
+
const Utils = __webpack_require__(1916)
|
|
26745
|
+
const dijkstra = __webpack_require__(4498)
|
|
26746
|
+
|
|
26747
|
+
/**
|
|
26748
|
+
* Returns UTF8 byte length
|
|
26749
|
+
*
|
|
26750
|
+
* @param {String} str Input string
|
|
26751
|
+
* @return {Number} Number of byte
|
|
26752
|
+
*/
|
|
26753
|
+
function getStringByteLength (str) {
|
|
26754
|
+
return unescape(encodeURIComponent(str)).length
|
|
26755
|
+
}
|
|
26756
|
+
|
|
26757
|
+
/**
|
|
26758
|
+
* Get a list of segments of the specified mode
|
|
26759
|
+
* from a string
|
|
26760
|
+
*
|
|
26761
|
+
* @param {Mode} mode Segment mode
|
|
26762
|
+
* @param {String} str String to process
|
|
26763
|
+
* @return {Array} Array of object with segments data
|
|
26764
|
+
*/
|
|
26765
|
+
function getSegments (regex, mode, str) {
|
|
26766
|
+
const segments = []
|
|
26767
|
+
let result
|
|
26768
|
+
|
|
26769
|
+
while ((result = regex.exec(str)) !== null) {
|
|
26770
|
+
segments.push({
|
|
26771
|
+
data: result[0],
|
|
26772
|
+
index: result.index,
|
|
26773
|
+
mode: mode,
|
|
26774
|
+
length: result[0].length
|
|
26775
|
+
})
|
|
26776
|
+
}
|
|
26777
|
+
|
|
26778
|
+
return segments
|
|
26779
|
+
}
|
|
26780
|
+
|
|
26781
|
+
/**
|
|
26782
|
+
* Extracts a series of segments with the appropriate
|
|
26783
|
+
* modes from a string
|
|
26784
|
+
*
|
|
26785
|
+
* @param {String} dataStr Input string
|
|
26786
|
+
* @return {Array} Array of object with segments data
|
|
26787
|
+
*/
|
|
26788
|
+
function getSegmentsFromString (dataStr) {
|
|
26789
|
+
const numSegs = getSegments(Regex.NUMERIC, Mode.NUMERIC, dataStr)
|
|
26790
|
+
const alphaNumSegs = getSegments(Regex.ALPHANUMERIC, Mode.ALPHANUMERIC, dataStr)
|
|
26791
|
+
let byteSegs
|
|
26792
|
+
let kanjiSegs
|
|
26793
|
+
|
|
26794
|
+
if (Utils.isKanjiModeEnabled()) {
|
|
26795
|
+
byteSegs = getSegments(Regex.BYTE, Mode.BYTE, dataStr)
|
|
26796
|
+
kanjiSegs = getSegments(Regex.KANJI, Mode.KANJI, dataStr)
|
|
26797
|
+
} else {
|
|
26798
|
+
byteSegs = getSegments(Regex.BYTE_KANJI, Mode.BYTE, dataStr)
|
|
26799
|
+
kanjiSegs = []
|
|
26800
|
+
}
|
|
26801
|
+
|
|
26802
|
+
const segs = numSegs.concat(alphaNumSegs, byteSegs, kanjiSegs)
|
|
26803
|
+
|
|
26804
|
+
return segs
|
|
26805
|
+
.sort(function (s1, s2) {
|
|
26806
|
+
return s1.index - s2.index
|
|
26807
|
+
})
|
|
26808
|
+
.map(function (obj) {
|
|
26809
|
+
return {
|
|
26810
|
+
data: obj.data,
|
|
26811
|
+
mode: obj.mode,
|
|
26812
|
+
length: obj.length
|
|
26813
|
+
}
|
|
26814
|
+
})
|
|
26815
|
+
}
|
|
26816
|
+
|
|
26817
|
+
/**
|
|
26818
|
+
* Returns how many bits are needed to encode a string of
|
|
26819
|
+
* specified length with the specified mode
|
|
26820
|
+
*
|
|
26821
|
+
* @param {Number} length String length
|
|
26822
|
+
* @param {Mode} mode Segment mode
|
|
26823
|
+
* @return {Number} Bit length
|
|
26824
|
+
*/
|
|
26825
|
+
function getSegmentBitsLength (length, mode) {
|
|
26826
|
+
switch (mode) {
|
|
26827
|
+
case Mode.NUMERIC:
|
|
26828
|
+
return NumericData.getBitsLength(length)
|
|
26829
|
+
case Mode.ALPHANUMERIC:
|
|
26830
|
+
return AlphanumericData.getBitsLength(length)
|
|
26831
|
+
case Mode.KANJI:
|
|
26832
|
+
return KanjiData.getBitsLength(length)
|
|
26833
|
+
case Mode.BYTE:
|
|
26834
|
+
return ByteData.getBitsLength(length)
|
|
26835
|
+
}
|
|
26836
|
+
}
|
|
26837
|
+
|
|
26838
|
+
/**
|
|
26839
|
+
* Merges adjacent segments which have the same mode
|
|
26840
|
+
*
|
|
26841
|
+
* @param {Array} segs Array of object with segments data
|
|
26842
|
+
* @return {Array} Array of object with segments data
|
|
26843
|
+
*/
|
|
26844
|
+
function mergeSegments (segs) {
|
|
26845
|
+
return segs.reduce(function (acc, curr) {
|
|
26846
|
+
const prevSeg = acc.length - 1 >= 0 ? acc[acc.length - 1] : null
|
|
26847
|
+
if (prevSeg && prevSeg.mode === curr.mode) {
|
|
26848
|
+
acc[acc.length - 1].data += curr.data
|
|
26849
|
+
return acc
|
|
26850
|
+
}
|
|
26851
|
+
|
|
26852
|
+
acc.push(curr)
|
|
26853
|
+
return acc
|
|
26854
|
+
}, [])
|
|
26855
|
+
}
|
|
26856
|
+
|
|
26857
|
+
/**
|
|
26858
|
+
* Generates a list of all possible nodes combination which
|
|
26859
|
+
* will be used to build a segments graph.
|
|
26860
|
+
*
|
|
26861
|
+
* Nodes are divided by groups. Each group will contain a list of all the modes
|
|
26862
|
+
* in which is possible to encode the given text.
|
|
26863
|
+
*
|
|
26864
|
+
* For example the text '12345' can be encoded as Numeric, Alphanumeric or Byte.
|
|
26865
|
+
* The group for '12345' will contain then 3 objects, one for each
|
|
26866
|
+
* possible encoding mode.
|
|
26867
|
+
*
|
|
26868
|
+
* Each node represents a possible segment.
|
|
26869
|
+
*
|
|
26870
|
+
* @param {Array} segs Array of object with segments data
|
|
26871
|
+
* @return {Array} Array of object with segments data
|
|
26872
|
+
*/
|
|
26873
|
+
function buildNodes (segs) {
|
|
26874
|
+
const nodes = []
|
|
26875
|
+
for (let i = 0; i < segs.length; i++) {
|
|
26876
|
+
const seg = segs[i]
|
|
26877
|
+
|
|
26878
|
+
switch (seg.mode) {
|
|
26879
|
+
case Mode.NUMERIC:
|
|
26880
|
+
nodes.push([seg,
|
|
26881
|
+
{ data: seg.data, mode: Mode.ALPHANUMERIC, length: seg.length },
|
|
26882
|
+
{ data: seg.data, mode: Mode.BYTE, length: seg.length }
|
|
26883
|
+
])
|
|
26884
|
+
break
|
|
26885
|
+
case Mode.ALPHANUMERIC:
|
|
26886
|
+
nodes.push([seg,
|
|
26887
|
+
{ data: seg.data, mode: Mode.BYTE, length: seg.length }
|
|
26888
|
+
])
|
|
26889
|
+
break
|
|
26890
|
+
case Mode.KANJI:
|
|
26891
|
+
nodes.push([seg,
|
|
26892
|
+
{ data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }
|
|
26893
|
+
])
|
|
26894
|
+
break
|
|
26895
|
+
case Mode.BYTE:
|
|
26896
|
+
nodes.push([
|
|
26897
|
+
{ data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }
|
|
26898
|
+
])
|
|
26899
|
+
}
|
|
26900
|
+
}
|
|
26901
|
+
|
|
26902
|
+
return nodes
|
|
26903
|
+
}
|
|
26904
|
+
|
|
26905
|
+
/**
|
|
26906
|
+
* Builds a graph from a list of nodes.
|
|
26907
|
+
* All segments in each node group will be connected with all the segments of
|
|
26908
|
+
* the next group and so on.
|
|
26909
|
+
*
|
|
26910
|
+
* At each connection will be assigned a weight depending on the
|
|
26911
|
+
* segment's byte length.
|
|
26912
|
+
*
|
|
26913
|
+
* @param {Array} nodes Array of object with segments data
|
|
26914
|
+
* @param {Number} version QR Code version
|
|
26915
|
+
* @return {Object} Graph of all possible segments
|
|
26916
|
+
*/
|
|
26917
|
+
function buildGraph (nodes, version) {
|
|
26918
|
+
const table = {}
|
|
26919
|
+
const graph = { start: {} }
|
|
26920
|
+
let prevNodeIds = ['start']
|
|
26921
|
+
|
|
26922
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
26923
|
+
const nodeGroup = nodes[i]
|
|
26924
|
+
const currentNodeIds = []
|
|
26925
|
+
|
|
26926
|
+
for (let j = 0; j < nodeGroup.length; j++) {
|
|
26927
|
+
const node = nodeGroup[j]
|
|
26928
|
+
const key = '' + i + j
|
|
26929
|
+
|
|
26930
|
+
currentNodeIds.push(key)
|
|
26931
|
+
table[key] = { node: node, lastCount: 0 }
|
|
26932
|
+
graph[key] = {}
|
|
26933
|
+
|
|
26934
|
+
for (let n = 0; n < prevNodeIds.length; n++) {
|
|
26935
|
+
const prevNodeId = prevNodeIds[n]
|
|
26936
|
+
|
|
26937
|
+
if (table[prevNodeId] && table[prevNodeId].node.mode === node.mode) {
|
|
26938
|
+
graph[prevNodeId][key] =
|
|
26939
|
+
getSegmentBitsLength(table[prevNodeId].lastCount + node.length, node.mode) -
|
|
26940
|
+
getSegmentBitsLength(table[prevNodeId].lastCount, node.mode)
|
|
26941
|
+
|
|
26942
|
+
table[prevNodeId].lastCount += node.length
|
|
26943
|
+
} else {
|
|
26944
|
+
if (table[prevNodeId]) table[prevNodeId].lastCount = node.length
|
|
26945
|
+
|
|
26946
|
+
graph[prevNodeId][key] = getSegmentBitsLength(node.length, node.mode) +
|
|
26947
|
+
4 + Mode.getCharCountIndicator(node.mode, version) // switch cost
|
|
26948
|
+
}
|
|
26949
|
+
}
|
|
26950
|
+
}
|
|
26951
|
+
|
|
26952
|
+
prevNodeIds = currentNodeIds
|
|
26953
|
+
}
|
|
26954
|
+
|
|
26955
|
+
for (let n = 0; n < prevNodeIds.length; n++) {
|
|
26956
|
+
graph[prevNodeIds[n]].end = 0
|
|
26957
|
+
}
|
|
26958
|
+
|
|
26959
|
+
return { map: graph, table: table }
|
|
26960
|
+
}
|
|
26961
|
+
|
|
26962
|
+
/**
|
|
26963
|
+
* Builds a segment from a specified data and mode.
|
|
26964
|
+
* If a mode is not specified, the more suitable will be used.
|
|
26965
|
+
*
|
|
26966
|
+
* @param {String} data Input data
|
|
26967
|
+
* @param {Mode | String} modesHint Data mode
|
|
26968
|
+
* @return {Segment} Segment
|
|
26969
|
+
*/
|
|
26970
|
+
function buildSingleSegment (data, modesHint) {
|
|
26971
|
+
let mode
|
|
26972
|
+
const bestMode = Mode.getBestModeForData(data)
|
|
26973
|
+
|
|
26974
|
+
mode = Mode.from(modesHint, bestMode)
|
|
26975
|
+
|
|
26976
|
+
// Make sure data can be encoded
|
|
26977
|
+
if (mode !== Mode.BYTE && mode.bit < bestMode.bit) {
|
|
26978
|
+
throw new Error('"' + data + '"' +
|
|
26979
|
+
' cannot be encoded with mode ' + Mode.toString(mode) +
|
|
26980
|
+
'.\n Suggested mode is: ' + Mode.toString(bestMode))
|
|
26981
|
+
}
|
|
26982
|
+
|
|
26983
|
+
// Use Mode.BYTE if Kanji support is disabled
|
|
26984
|
+
if (mode === Mode.KANJI && !Utils.isKanjiModeEnabled()) {
|
|
26985
|
+
mode = Mode.BYTE
|
|
26986
|
+
}
|
|
26987
|
+
|
|
26988
|
+
switch (mode) {
|
|
26989
|
+
case Mode.NUMERIC:
|
|
26990
|
+
return new NumericData(data)
|
|
26991
|
+
|
|
26992
|
+
case Mode.ALPHANUMERIC:
|
|
26993
|
+
return new AlphanumericData(data)
|
|
26994
|
+
|
|
26995
|
+
case Mode.KANJI:
|
|
26996
|
+
return new KanjiData(data)
|
|
26997
|
+
|
|
26998
|
+
case Mode.BYTE:
|
|
26999
|
+
return new ByteData(data)
|
|
27000
|
+
}
|
|
27001
|
+
}
|
|
27002
|
+
|
|
27003
|
+
/**
|
|
27004
|
+
* Builds a list of segments from an array.
|
|
27005
|
+
* Array can contain Strings or Objects with segment's info.
|
|
27006
|
+
*
|
|
27007
|
+
* For each item which is a string, will be generated a segment with the given
|
|
27008
|
+
* string and the more appropriate encoding mode.
|
|
27009
|
+
*
|
|
27010
|
+
* For each item which is an object, will be generated a segment with the given
|
|
27011
|
+
* data and mode.
|
|
27012
|
+
* Objects must contain at least the property "data".
|
|
27013
|
+
* If property "mode" is not present, the more suitable mode will be used.
|
|
27014
|
+
*
|
|
27015
|
+
* @param {Array} array Array of objects with segments data
|
|
27016
|
+
* @return {Array} Array of Segments
|
|
27017
|
+
*/
|
|
27018
|
+
exports.fromArray = function fromArray (array) {
|
|
27019
|
+
return array.reduce(function (acc, seg) {
|
|
27020
|
+
if (typeof seg === 'string') {
|
|
27021
|
+
acc.push(buildSingleSegment(seg, null))
|
|
27022
|
+
} else if (seg.data) {
|
|
27023
|
+
acc.push(buildSingleSegment(seg.data, seg.mode))
|
|
27024
|
+
}
|
|
27025
|
+
|
|
27026
|
+
return acc
|
|
27027
|
+
}, [])
|
|
27028
|
+
}
|
|
27029
|
+
|
|
27030
|
+
/**
|
|
27031
|
+
* Builds an optimized sequence of segments from a string,
|
|
27032
|
+
* which will produce the shortest possible bitstream.
|
|
27033
|
+
*
|
|
27034
|
+
* @param {String} data Input string
|
|
27035
|
+
* @param {Number} version QR Code version
|
|
27036
|
+
* @return {Array} Array of segments
|
|
27037
|
+
*/
|
|
27038
|
+
exports.fromString = function fromString (data, version) {
|
|
27039
|
+
const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled())
|
|
27040
|
+
|
|
27041
|
+
const nodes = buildNodes(segs)
|
|
27042
|
+
const graph = buildGraph(nodes, version)
|
|
27043
|
+
const path = dijkstra.find_path(graph.map, 'start', 'end')
|
|
27044
|
+
|
|
27045
|
+
const optimizedSegs = []
|
|
27046
|
+
for (let i = 1; i < path.length - 1; i++) {
|
|
27047
|
+
optimizedSegs.push(graph.table[path[i]].node)
|
|
27048
|
+
}
|
|
27049
|
+
|
|
27050
|
+
return exports.fromArray(mergeSegments(optimizedSegs))
|
|
27051
|
+
}
|
|
27052
|
+
|
|
27053
|
+
/**
|
|
27054
|
+
* Splits a string in various segments with the modes which
|
|
27055
|
+
* best represent their content.
|
|
27056
|
+
* The produced segments are far from being optimized.
|
|
27057
|
+
* The output of this function is only used to estimate a QR Code version
|
|
27058
|
+
* which may contain the data.
|
|
27059
|
+
*
|
|
27060
|
+
* @param {string} data Input string
|
|
27061
|
+
* @return {Array} Array of segments
|
|
27062
|
+
*/
|
|
27063
|
+
exports.rawSplit = function rawSplit (data) {
|
|
27064
|
+
return exports.fromArray(
|
|
27065
|
+
getSegmentsFromString(data, Utils.isKanjiModeEnabled())
|
|
27066
|
+
)
|
|
27067
|
+
}
|
|
27068
|
+
|
|
27069
|
+
|
|
27070
|
+
/***/ }),
|
|
27071
|
+
|
|
27072
|
+
/***/ 1916:
|
|
27073
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
27074
|
+
|
|
27075
|
+
let toSJISFunction
|
|
27076
|
+
const CODEWORDS_COUNT = [
|
|
27077
|
+
0, // Not used
|
|
27078
|
+
26, 44, 70, 100, 134, 172, 196, 242, 292, 346,
|
|
27079
|
+
404, 466, 532, 581, 655, 733, 815, 901, 991, 1085,
|
|
27080
|
+
1156, 1258, 1364, 1474, 1588, 1706, 1828, 1921, 2051, 2185,
|
|
27081
|
+
2323, 2465, 2611, 2761, 2876, 3034, 3196, 3362, 3532, 3706
|
|
27082
|
+
]
|
|
27083
|
+
|
|
27084
|
+
/**
|
|
27085
|
+
* Returns the QR Code size for the specified version
|
|
27086
|
+
*
|
|
27087
|
+
* @param {Number} version QR Code version
|
|
27088
|
+
* @return {Number} size of QR code
|
|
27089
|
+
*/
|
|
27090
|
+
exports.getSymbolSize = function getSymbolSize (version) {
|
|
27091
|
+
if (!version) throw new Error('"version" cannot be null or undefined')
|
|
27092
|
+
if (version < 1 || version > 40) throw new Error('"version" should be in range from 1 to 40')
|
|
27093
|
+
return version * 4 + 17
|
|
27094
|
+
}
|
|
27095
|
+
|
|
27096
|
+
/**
|
|
27097
|
+
* Returns the total number of codewords used to store data and EC information.
|
|
27098
|
+
*
|
|
27099
|
+
* @param {Number} version QR Code version
|
|
27100
|
+
* @return {Number} Data length in bits
|
|
27101
|
+
*/
|
|
27102
|
+
exports.getSymbolTotalCodewords = function getSymbolTotalCodewords (version) {
|
|
27103
|
+
return CODEWORDS_COUNT[version]
|
|
27104
|
+
}
|
|
27105
|
+
|
|
27106
|
+
/**
|
|
27107
|
+
* Encode data with Bose-Chaudhuri-Hocquenghem
|
|
27108
|
+
*
|
|
27109
|
+
* @param {Number} data Value to encode
|
|
27110
|
+
* @return {Number} Encoded value
|
|
27111
|
+
*/
|
|
27112
|
+
exports.getBCHDigit = function (data) {
|
|
27113
|
+
let digit = 0
|
|
27114
|
+
|
|
27115
|
+
while (data !== 0) {
|
|
27116
|
+
digit++
|
|
27117
|
+
data >>>= 1
|
|
27118
|
+
}
|
|
27119
|
+
|
|
27120
|
+
return digit
|
|
27121
|
+
}
|
|
27122
|
+
|
|
27123
|
+
exports.setToSJISFunction = function setToSJISFunction (f) {
|
|
27124
|
+
if (typeof f !== 'function') {
|
|
27125
|
+
throw new Error('"toSJISFunc" is not a valid function.')
|
|
27126
|
+
}
|
|
27127
|
+
|
|
27128
|
+
toSJISFunction = f
|
|
27129
|
+
}
|
|
27130
|
+
|
|
27131
|
+
exports.isKanjiModeEnabled = function () {
|
|
27132
|
+
return typeof toSJISFunction !== 'undefined'
|
|
27133
|
+
}
|
|
27134
|
+
|
|
27135
|
+
exports.toSJIS = function toSJIS (kanji) {
|
|
27136
|
+
return toSJISFunction(kanji)
|
|
27137
|
+
}
|
|
27138
|
+
|
|
27139
|
+
|
|
27140
|
+
/***/ }),
|
|
27141
|
+
|
|
27142
|
+
/***/ 6344:
|
|
27143
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
27144
|
+
|
|
27145
|
+
/**
|
|
27146
|
+
* Check if QR Code version is valid
|
|
27147
|
+
*
|
|
27148
|
+
* @param {Number} version QR Code version
|
|
27149
|
+
* @return {Boolean} true if valid version, false otherwise
|
|
27150
|
+
*/
|
|
27151
|
+
exports.isValid = function isValid (version) {
|
|
27152
|
+
return !isNaN(version) && version >= 1 && version <= 40
|
|
27153
|
+
}
|
|
27154
|
+
|
|
27155
|
+
|
|
27156
|
+
/***/ }),
|
|
27157
|
+
|
|
27158
|
+
/***/ 3505:
|
|
27159
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
27160
|
+
|
|
27161
|
+
const Utils = __webpack_require__(1916)
|
|
27162
|
+
const ECCode = __webpack_require__(8444)
|
|
27163
|
+
const ECLevel = __webpack_require__(9175)
|
|
27164
|
+
const Mode = __webpack_require__(9282)
|
|
27165
|
+
const VersionCheck = __webpack_require__(6344)
|
|
27166
|
+
|
|
27167
|
+
// Generator polynomial used to encode version information
|
|
27168
|
+
const G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0)
|
|
27169
|
+
const G18_BCH = Utils.getBCHDigit(G18)
|
|
27170
|
+
|
|
27171
|
+
function getBestVersionForDataLength (mode, length, errorCorrectionLevel) {
|
|
27172
|
+
for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {
|
|
27173
|
+
if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, mode)) {
|
|
27174
|
+
return currentVersion
|
|
27175
|
+
}
|
|
27176
|
+
}
|
|
27177
|
+
|
|
27178
|
+
return undefined
|
|
27179
|
+
}
|
|
27180
|
+
|
|
27181
|
+
function getReservedBitsCount (mode, version) {
|
|
27182
|
+
// Character count indicator + mode indicator bits
|
|
27183
|
+
return Mode.getCharCountIndicator(mode, version) + 4
|
|
27184
|
+
}
|
|
27185
|
+
|
|
27186
|
+
function getTotalBitsFromDataArray (segments, version) {
|
|
27187
|
+
let totalBits = 0
|
|
27188
|
+
|
|
27189
|
+
segments.forEach(function (data) {
|
|
27190
|
+
const reservedBits = getReservedBitsCount(data.mode, version)
|
|
27191
|
+
totalBits += reservedBits + data.getBitsLength()
|
|
27192
|
+
})
|
|
27193
|
+
|
|
27194
|
+
return totalBits
|
|
27195
|
+
}
|
|
27196
|
+
|
|
27197
|
+
function getBestVersionForMixedData (segments, errorCorrectionLevel) {
|
|
27198
|
+
for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {
|
|
27199
|
+
const length = getTotalBitsFromDataArray(segments, currentVersion)
|
|
27200
|
+
if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, Mode.MIXED)) {
|
|
27201
|
+
return currentVersion
|
|
27202
|
+
}
|
|
27203
|
+
}
|
|
27204
|
+
|
|
27205
|
+
return undefined
|
|
27206
|
+
}
|
|
27207
|
+
|
|
27208
|
+
/**
|
|
27209
|
+
* Returns version number from a value.
|
|
27210
|
+
* If value is not a valid version, returns defaultValue
|
|
27211
|
+
*
|
|
27212
|
+
* @param {Number|String} value QR Code version
|
|
27213
|
+
* @param {Number} defaultValue Fallback value
|
|
27214
|
+
* @return {Number} QR Code version number
|
|
27215
|
+
*/
|
|
27216
|
+
exports.from = function from (value, defaultValue) {
|
|
27217
|
+
if (VersionCheck.isValid(value)) {
|
|
27218
|
+
return parseInt(value, 10)
|
|
27219
|
+
}
|
|
27220
|
+
|
|
27221
|
+
return defaultValue
|
|
27222
|
+
}
|
|
27223
|
+
|
|
27224
|
+
/**
|
|
27225
|
+
* Returns how much data can be stored with the specified QR code version
|
|
27226
|
+
* and error correction level
|
|
27227
|
+
*
|
|
27228
|
+
* @param {Number} version QR Code version (1-40)
|
|
27229
|
+
* @param {Number} errorCorrectionLevel Error correction level
|
|
27230
|
+
* @param {Mode} mode Data mode
|
|
27231
|
+
* @return {Number} Quantity of storable data
|
|
27232
|
+
*/
|
|
27233
|
+
exports.getCapacity = function getCapacity (version, errorCorrectionLevel, mode) {
|
|
27234
|
+
if (!VersionCheck.isValid(version)) {
|
|
27235
|
+
throw new Error('Invalid QR Code version')
|
|
27236
|
+
}
|
|
27237
|
+
|
|
27238
|
+
// Use Byte mode as default
|
|
27239
|
+
if (typeof mode === 'undefined') mode = Mode.BYTE
|
|
27240
|
+
|
|
27241
|
+
// Total codewords for this QR code version (Data + Error correction)
|
|
27242
|
+
const totalCodewords = Utils.getSymbolTotalCodewords(version)
|
|
27243
|
+
|
|
27244
|
+
// Total number of error correction codewords
|
|
27245
|
+
const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)
|
|
27246
|
+
|
|
27247
|
+
// Total number of data codewords
|
|
27248
|
+
const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8
|
|
27249
|
+
|
|
27250
|
+
if (mode === Mode.MIXED) return dataTotalCodewordsBits
|
|
27251
|
+
|
|
27252
|
+
const usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode, version)
|
|
27253
|
+
|
|
27254
|
+
// Return max number of storable codewords
|
|
27255
|
+
switch (mode) {
|
|
27256
|
+
case Mode.NUMERIC:
|
|
27257
|
+
return Math.floor((usableBits / 10) * 3)
|
|
27258
|
+
|
|
27259
|
+
case Mode.ALPHANUMERIC:
|
|
27260
|
+
return Math.floor((usableBits / 11) * 2)
|
|
27261
|
+
|
|
27262
|
+
case Mode.KANJI:
|
|
27263
|
+
return Math.floor(usableBits / 13)
|
|
27264
|
+
|
|
27265
|
+
case Mode.BYTE:
|
|
27266
|
+
default:
|
|
27267
|
+
return Math.floor(usableBits / 8)
|
|
27268
|
+
}
|
|
27269
|
+
}
|
|
27270
|
+
|
|
27271
|
+
/**
|
|
27272
|
+
* Returns the minimum version needed to contain the amount of data
|
|
27273
|
+
*
|
|
27274
|
+
* @param {Segment} data Segment of data
|
|
27275
|
+
* @param {Number} [errorCorrectionLevel=H] Error correction level
|
|
27276
|
+
* @param {Mode} mode Data mode
|
|
27277
|
+
* @return {Number} QR Code version
|
|
27278
|
+
*/
|
|
27279
|
+
exports.getBestVersionForData = function getBestVersionForData (data, errorCorrectionLevel) {
|
|
27280
|
+
let seg
|
|
27281
|
+
|
|
27282
|
+
const ecl = ECLevel.from(errorCorrectionLevel, ECLevel.M)
|
|
27283
|
+
|
|
27284
|
+
if (Array.isArray(data)) {
|
|
27285
|
+
if (data.length > 1) {
|
|
27286
|
+
return getBestVersionForMixedData(data, ecl)
|
|
27287
|
+
}
|
|
27288
|
+
|
|
27289
|
+
if (data.length === 0) {
|
|
27290
|
+
return 1
|
|
27291
|
+
}
|
|
27292
|
+
|
|
27293
|
+
seg = data[0]
|
|
27294
|
+
} else {
|
|
27295
|
+
seg = data
|
|
27296
|
+
}
|
|
27297
|
+
|
|
27298
|
+
return getBestVersionForDataLength(seg.mode, seg.getLength(), ecl)
|
|
27299
|
+
}
|
|
27300
|
+
|
|
27301
|
+
/**
|
|
27302
|
+
* Returns version information with relative error correction bits
|
|
27303
|
+
*
|
|
27304
|
+
* The version information is included in QR Code symbols of version 7 or larger.
|
|
27305
|
+
* It consists of an 18-bit sequence containing 6 data bits,
|
|
27306
|
+
* with 12 error correction bits calculated using the (18, 6) Golay code.
|
|
27307
|
+
*
|
|
27308
|
+
* @param {Number} version QR Code version
|
|
27309
|
+
* @return {Number} Encoded version info bits
|
|
27310
|
+
*/
|
|
27311
|
+
exports.getEncodedBits = function getEncodedBits (version) {
|
|
27312
|
+
if (!VersionCheck.isValid(version) || version < 7) {
|
|
27313
|
+
throw new Error('Invalid QR Code version')
|
|
27314
|
+
}
|
|
27315
|
+
|
|
27316
|
+
let d = version << 12
|
|
27317
|
+
|
|
27318
|
+
while (Utils.getBCHDigit(d) - G18_BCH >= 0) {
|
|
27319
|
+
d ^= (G18 << (Utils.getBCHDigit(d) - G18_BCH))
|
|
27320
|
+
}
|
|
27321
|
+
|
|
27322
|
+
return (version << 12) | d
|
|
27323
|
+
}
|
|
27324
|
+
|
|
27325
|
+
|
|
27326
|
+
/***/ }),
|
|
27327
|
+
|
|
27328
|
+
/***/ 4581:
|
|
27329
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
27330
|
+
|
|
27331
|
+
const Utils = __webpack_require__(5584)
|
|
27332
|
+
|
|
27333
|
+
function clearCanvas (ctx, canvas, size) {
|
|
27334
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height)
|
|
27335
|
+
|
|
27336
|
+
if (!canvas.style) canvas.style = {}
|
|
27337
|
+
canvas.height = size
|
|
27338
|
+
canvas.width = size
|
|
27339
|
+
canvas.style.height = size + 'px'
|
|
27340
|
+
canvas.style.width = size + 'px'
|
|
27341
|
+
}
|
|
27342
|
+
|
|
27343
|
+
function getCanvasElement () {
|
|
27344
|
+
try {
|
|
27345
|
+
return document.createElement('canvas')
|
|
27346
|
+
} catch (e) {
|
|
27347
|
+
throw new Error('You need to specify a canvas element')
|
|
27348
|
+
}
|
|
27349
|
+
}
|
|
27350
|
+
|
|
27351
|
+
exports.render = function render (qrData, canvas, options) {
|
|
27352
|
+
let opts = options
|
|
27353
|
+
let canvasEl = canvas
|
|
27354
|
+
|
|
27355
|
+
if (typeof opts === 'undefined' && (!canvas || !canvas.getContext)) {
|
|
27356
|
+
opts = canvas
|
|
27357
|
+
canvas = undefined
|
|
27358
|
+
}
|
|
27359
|
+
|
|
27360
|
+
if (!canvas) {
|
|
27361
|
+
canvasEl = getCanvasElement()
|
|
27362
|
+
}
|
|
27363
|
+
|
|
27364
|
+
opts = Utils.getOptions(opts)
|
|
27365
|
+
const size = Utils.getImageWidth(qrData.modules.size, opts)
|
|
27366
|
+
|
|
27367
|
+
const ctx = canvasEl.getContext('2d')
|
|
27368
|
+
const image = ctx.createImageData(size, size)
|
|
27369
|
+
Utils.qrToImageData(image.data, qrData, opts)
|
|
27370
|
+
|
|
27371
|
+
clearCanvas(ctx, canvasEl, size)
|
|
27372
|
+
ctx.putImageData(image, 0, 0)
|
|
27373
|
+
|
|
27374
|
+
return canvasEl
|
|
27375
|
+
}
|
|
27376
|
+
|
|
27377
|
+
exports.renderToDataURL = function renderToDataURL (qrData, canvas, options) {
|
|
27378
|
+
let opts = options
|
|
27379
|
+
|
|
27380
|
+
if (typeof opts === 'undefined' && (!canvas || !canvas.getContext)) {
|
|
27381
|
+
opts = canvas
|
|
27382
|
+
canvas = undefined
|
|
27383
|
+
}
|
|
27384
|
+
|
|
27385
|
+
if (!opts) opts = {}
|
|
27386
|
+
|
|
27387
|
+
const canvasEl = exports.render(qrData, canvas, opts)
|
|
27388
|
+
|
|
27389
|
+
const type = opts.type || 'image/png'
|
|
27390
|
+
const rendererOpts = opts.rendererOpts || {}
|
|
27391
|
+
|
|
27392
|
+
return canvasEl.toDataURL(type, rendererOpts.quality)
|
|
27393
|
+
}
|
|
27394
|
+
|
|
27395
|
+
|
|
27396
|
+
/***/ }),
|
|
27397
|
+
|
|
27398
|
+
/***/ 1802:
|
|
27399
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
27400
|
+
|
|
27401
|
+
const Utils = __webpack_require__(5584)
|
|
27402
|
+
|
|
27403
|
+
function getColorAttrib (color, attrib) {
|
|
27404
|
+
const alpha = color.a / 255
|
|
27405
|
+
const str = attrib + '="' + color.hex + '"'
|
|
27406
|
+
|
|
27407
|
+
return alpha < 1
|
|
27408
|
+
? str + ' ' + attrib + '-opacity="' + alpha.toFixed(2).slice(1) + '"'
|
|
27409
|
+
: str
|
|
27410
|
+
}
|
|
27411
|
+
|
|
27412
|
+
function svgCmd (cmd, x, y) {
|
|
27413
|
+
let str = cmd + x
|
|
27414
|
+
if (typeof y !== 'undefined') str += ' ' + y
|
|
27415
|
+
|
|
27416
|
+
return str
|
|
27417
|
+
}
|
|
27418
|
+
|
|
27419
|
+
function qrToPath (data, size, margin) {
|
|
27420
|
+
let path = ''
|
|
27421
|
+
let moveBy = 0
|
|
27422
|
+
let newRow = false
|
|
27423
|
+
let lineLength = 0
|
|
27424
|
+
|
|
27425
|
+
for (let i = 0; i < data.length; i++) {
|
|
27426
|
+
const col = Math.floor(i % size)
|
|
27427
|
+
const row = Math.floor(i / size)
|
|
27428
|
+
|
|
27429
|
+
if (!col && !newRow) newRow = true
|
|
27430
|
+
|
|
27431
|
+
if (data[i]) {
|
|
27432
|
+
lineLength++
|
|
27433
|
+
|
|
27434
|
+
if (!(i > 0 && col > 0 && data[i - 1])) {
|
|
27435
|
+
path += newRow
|
|
27436
|
+
? svgCmd('M', col + margin, 0.5 + row + margin)
|
|
27437
|
+
: svgCmd('m', moveBy, 0)
|
|
27438
|
+
|
|
27439
|
+
moveBy = 0
|
|
27440
|
+
newRow = false
|
|
27441
|
+
}
|
|
27442
|
+
|
|
27443
|
+
if (!(col + 1 < size && data[i + 1])) {
|
|
27444
|
+
path += svgCmd('h', lineLength)
|
|
27445
|
+
lineLength = 0
|
|
27446
|
+
}
|
|
27447
|
+
} else {
|
|
27448
|
+
moveBy++
|
|
27449
|
+
}
|
|
27450
|
+
}
|
|
27451
|
+
|
|
27452
|
+
return path
|
|
27453
|
+
}
|
|
27454
|
+
|
|
27455
|
+
exports.render = function render (qrData, options, cb) {
|
|
27456
|
+
const opts = Utils.getOptions(options)
|
|
27457
|
+
const size = qrData.modules.size
|
|
27458
|
+
const data = qrData.modules.data
|
|
27459
|
+
const qrcodesize = size + opts.margin * 2
|
|
27460
|
+
|
|
27461
|
+
const bg = !opts.color.light.a
|
|
27462
|
+
? ''
|
|
27463
|
+
: '<path ' + getColorAttrib(opts.color.light, 'fill') +
|
|
27464
|
+
' d="M0 0h' + qrcodesize + 'v' + qrcodesize + 'H0z"/>'
|
|
27465
|
+
|
|
27466
|
+
const path =
|
|
27467
|
+
'<path ' + getColorAttrib(opts.color.dark, 'stroke') +
|
|
27468
|
+
' d="' + qrToPath(data, size, opts.margin) + '"/>'
|
|
27469
|
+
|
|
27470
|
+
const viewBox = 'viewBox="' + '0 0 ' + qrcodesize + ' ' + qrcodesize + '"'
|
|
27471
|
+
|
|
27472
|
+
const width = !opts.width ? '' : 'width="' + opts.width + '" height="' + opts.width + '" '
|
|
27473
|
+
|
|
27474
|
+
const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path + '</svg>\n'
|
|
27475
|
+
|
|
27476
|
+
if (typeof cb === 'function') {
|
|
27477
|
+
cb(null, svgTag)
|
|
27478
|
+
}
|
|
27479
|
+
|
|
27480
|
+
return svgTag
|
|
27481
|
+
}
|
|
27482
|
+
|
|
27483
|
+
|
|
27484
|
+
/***/ }),
|
|
27485
|
+
|
|
27486
|
+
/***/ 5584:
|
|
27487
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
27488
|
+
|
|
27489
|
+
function hex2rgba (hex) {
|
|
27490
|
+
if (typeof hex === 'number') {
|
|
27491
|
+
hex = hex.toString()
|
|
27492
|
+
}
|
|
27493
|
+
|
|
27494
|
+
if (typeof hex !== 'string') {
|
|
27495
|
+
throw new Error('Color should be defined as hex string')
|
|
27496
|
+
}
|
|
27497
|
+
|
|
27498
|
+
let hexCode = hex.slice().replace('#', '').split('')
|
|
27499
|
+
if (hexCode.length < 3 || hexCode.length === 5 || hexCode.length > 8) {
|
|
27500
|
+
throw new Error('Invalid hex color: ' + hex)
|
|
27501
|
+
}
|
|
27502
|
+
|
|
27503
|
+
// Convert from short to long form (fff -> ffffff)
|
|
27504
|
+
if (hexCode.length === 3 || hexCode.length === 4) {
|
|
27505
|
+
hexCode = Array.prototype.concat.apply([], hexCode.map(function (c) {
|
|
27506
|
+
return [c, c]
|
|
27507
|
+
}))
|
|
27508
|
+
}
|
|
27509
|
+
|
|
27510
|
+
// Add default alpha value
|
|
27511
|
+
if (hexCode.length === 6) hexCode.push('F', 'F')
|
|
27512
|
+
|
|
27513
|
+
const hexValue = parseInt(hexCode.join(''), 16)
|
|
27514
|
+
|
|
27515
|
+
return {
|
|
27516
|
+
r: (hexValue >> 24) & 255,
|
|
27517
|
+
g: (hexValue >> 16) & 255,
|
|
27518
|
+
b: (hexValue >> 8) & 255,
|
|
27519
|
+
a: hexValue & 255,
|
|
27520
|
+
hex: '#' + hexCode.slice(0, 6).join('')
|
|
27521
|
+
}
|
|
27522
|
+
}
|
|
27523
|
+
|
|
27524
|
+
exports.getOptions = function getOptions (options) {
|
|
27525
|
+
if (!options) options = {}
|
|
27526
|
+
if (!options.color) options.color = {}
|
|
27527
|
+
|
|
27528
|
+
const margin = typeof options.margin === 'undefined' ||
|
|
27529
|
+
options.margin === null ||
|
|
27530
|
+
options.margin < 0
|
|
27531
|
+
? 4
|
|
27532
|
+
: options.margin
|
|
27533
|
+
|
|
27534
|
+
const width = options.width && options.width >= 21 ? options.width : undefined
|
|
27535
|
+
const scale = options.scale || 4
|
|
27536
|
+
|
|
27537
|
+
return {
|
|
27538
|
+
width: width,
|
|
27539
|
+
scale: width ? 4 : scale,
|
|
27540
|
+
margin: margin,
|
|
27541
|
+
color: {
|
|
27542
|
+
dark: hex2rgba(options.color.dark || '#000000ff'),
|
|
27543
|
+
light: hex2rgba(options.color.light || '#ffffffff')
|
|
27544
|
+
},
|
|
27545
|
+
type: options.type,
|
|
27546
|
+
rendererOpts: options.rendererOpts || {}
|
|
27547
|
+
}
|
|
27548
|
+
}
|
|
27549
|
+
|
|
27550
|
+
exports.getScale = function getScale (qrSize, opts) {
|
|
27551
|
+
return opts.width && opts.width >= qrSize + opts.margin * 2
|
|
27552
|
+
? opts.width / (qrSize + opts.margin * 2)
|
|
27553
|
+
: opts.scale
|
|
27554
|
+
}
|
|
27555
|
+
|
|
27556
|
+
exports.getImageWidth = function getImageWidth (qrSize, opts) {
|
|
27557
|
+
const scale = exports.getScale(qrSize, opts)
|
|
27558
|
+
return Math.floor((qrSize + opts.margin * 2) * scale)
|
|
27559
|
+
}
|
|
27560
|
+
|
|
27561
|
+
exports.qrToImageData = function qrToImageData (imgData, qr, opts) {
|
|
27562
|
+
const size = qr.modules.size
|
|
27563
|
+
const data = qr.modules.data
|
|
27564
|
+
const scale = exports.getScale(size, opts)
|
|
27565
|
+
const symbolSize = Math.floor((size + opts.margin * 2) * scale)
|
|
27566
|
+
const scaledMargin = opts.margin * scale
|
|
27567
|
+
const palette = [opts.color.light, opts.color.dark]
|
|
27568
|
+
|
|
27569
|
+
for (let i = 0; i < symbolSize; i++) {
|
|
27570
|
+
for (let j = 0; j < symbolSize; j++) {
|
|
27571
|
+
let posDst = (i * symbolSize + j) * 4
|
|
27572
|
+
let pxColor = opts.color.light
|
|
27573
|
+
|
|
27574
|
+
if (i >= scaledMargin && j >= scaledMargin &&
|
|
27575
|
+
i < symbolSize - scaledMargin && j < symbolSize - scaledMargin) {
|
|
27576
|
+
const iSrc = Math.floor((i - scaledMargin) / scale)
|
|
27577
|
+
const jSrc = Math.floor((j - scaledMargin) / scale)
|
|
27578
|
+
pxColor = palette[data[iSrc * size + jSrc] ? 1 : 0]
|
|
27579
|
+
}
|
|
27580
|
+
|
|
27581
|
+
imgData[posDst++] = pxColor.r
|
|
27582
|
+
imgData[posDst++] = pxColor.g
|
|
27583
|
+
imgData[posDst++] = pxColor.b
|
|
27584
|
+
imgData[posDst] = pxColor.a
|
|
27585
|
+
}
|
|
27586
|
+
}
|
|
27587
|
+
}
|
|
27588
|
+
|
|
27589
|
+
|
|
24553
27590
|
/***/ }),
|
|
24554
27591
|
|
|
24555
27592
|
/***/ 8220:
|
|
@@ -28826,7 +31863,7 @@ let getFileExt = filename => {
|
|
|
28826
31863
|
/* harmony import */ var _util_mathUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9548);
|
|
28827
31864
|
/* harmony import */ var _util_util__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(4063);
|
|
28828
31865
|
/* harmony import */ var _layoutItem__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3051);
|
|
28829
|
-
/* harmony import */ var _components_index__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(
|
|
31866
|
+
/* harmony import */ var _components_index__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5893);
|
|
28830
31867
|
/* harmony import */ var pubsub_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(1528);
|
|
28831
31868
|
/* harmony import */ var pubsub_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(pubsub_js__WEBPACK_IMPORTED_MODULE_7__);
|
|
28832
31869
|
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(9274);
|
|
@@ -31329,7 +34366,7 @@ module.exports = {
|
|
|
31329
34366
|
|
|
31330
34367
|
/***/ }),
|
|
31331
34368
|
|
|
31332
|
-
/***/
|
|
34369
|
+
/***/ 5893:
|
|
31333
34370
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
31334
34371
|
|
|
31335
34372
|
"use strict";
|
|
@@ -47108,15 +50145,13 @@ var userSelectorByRole_widgetDesign_component = (0,componentNormalizer/* default
|
|
|
47108
50145
|
widgetSetup: userSelectorByRole_widgetSetup,
|
|
47109
50146
|
widgetDesign: userSelectorByRole_widgetDesign
|
|
47110
50147
|
});
|
|
47111
|
-
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/ImgUpload/component.vue?vue&type=template&id=
|
|
47112
|
-
var
|
|
47113
|
-
_vm.fileList.length < parseInt(_vm.widget.options.length) && (!_vm.widget.options.disabled || _vm.isdisabled)
|
|
47114
|
-
)?_c('div',[_c('a-icon',{attrs:{"type":"plus"}}),_c('div',{staticClass:"ant-upload-text"},[_vm._v(_vm._s(_vm.widget.options.placeholder))])],1):_vm._e()]),_c('a-modal',{attrs:{"title":"预览","zIndex":100000,"visible":_vm.previewVisible,"footer":null},on:{"cancel":_vm.handleCancel}},[_c('div',{},[_c('img',{staticStyle:{"width":"100%"},attrs:{"alt":"example","src":_vm.previewImage}})])]),(_vm.widget.options.labelWidth !== 0)?_c('div',{class:[
|
|
50148
|
+
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/ImgUpload/component.vue?vue&type=template&id=09b06e35&scoped=true
|
|
50149
|
+
var componentvue_type_template_id_09b06e35_scoped_true_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.widget)?_c('div',{staticClass:"custom_form_item",style:({ height: _vm.currHeight })},[_c('a-form-model-item',{ref:_vm.widget.model,attrs:{"colon":false,"label-col":_vm.labelCol,"wrapperCol":_vm.wrapperCol,"prop":_vm.tableKey ? (_vm.tableKey + "." + _vm.tableIndex + "." + (_vm.widget.model)) : _vm.widget.model,"rules":_vm.tableKey ? _vm.rules[_vm.tableKey][_vm.widget.model] : _vm.rules[_vm.widget.model]}},[(_vm.widget.options.uploadStyle === '1' && _vm.fileList.length < parseInt(_vm.widget.options.length) && (!_vm.widget.options.disabled || _vm.isdisabled))?[_c('drag-upload',{style:(("margin-bottom: " + (_vm.fileList.length ? '10px': 0))),attrs:{"type":"image","model":_vm.widget.model,"QrData":_vm.widget,"placeholder":_vm.widget.options.placeholder,"uploadRef":function () { return _vm.$refs.uploadRef; },"disabled":false,"QrUpload":_vm.widget.options.enableQrUpload},on:{"add":_vm.uploadAdd}})]:_vm._e(),_c('a-upload',{ref:"uploadRef",style:(_vm.size),attrs:{"action":_vm.actionUrl,"list-type":"picture-card","file-list":_vm.fileList,"headers":_vm.headers,"disabled":_vm.isdisabled ? _vm.show : _vm.widget.options.disabled,"beforeUpload":_vm.beforeUpload},on:{"preview":_vm.handlePreview,"change":_vm.handleChange}},[(_vm.widget.options.uploadStyle !== '1' && _vm.fileList.length < parseInt(_vm.widget.options.length) && (!_vm.widget.options.disabled || _vm.isdisabled))?_c('div',[_c('a-icon',{attrs:{"type":"plus"}}),_c('div',{staticClass:"ant-upload-text"},[_vm._v(_vm._s(_vm.widget.options.placeholder))])],1):_vm._e()]),_c('a-modal',{attrs:{"title":"预览","zIndex":100000,"visible":_vm.previewVisible,"footer":null},on:{"cancel":_vm.handleCancel}},[_c('div',{},[_c('img',{staticStyle:{"width":"100%"},attrs:{"alt":"example","src":_vm.previewImage}})])]),(_vm.widget.options.labelWidth !== 0)?_c('div',{class:[
|
|
47115
50150
|
_vm.config.align,
|
|
47116
50151
|
_vm.config.validate === true && _vm.widget.options.required === true
|
|
47117
50152
|
? 'is_required'
|
|
47118
|
-
: 'no_required' ],style:({ color: this.config.color }),attrs:{"slot":"label"},slot:"label"},[_vm._v(" "+_vm._s(_vm.widget.name)+" ")]):_vm._e()],
|
|
47119
|
-
var
|
|
50153
|
+
: 'no_required' ],style:({ color: this.config.color }),attrs:{"slot":"label"},slot:"label"},[_vm._v(" "+_vm._s(_vm.widget.name)+" ")]):_vm._e()],2)],1):_vm._e()}
|
|
50154
|
+
var componentvue_type_template_id_09b06e35_scoped_true_staticRenderFns = []
|
|
47120
50155
|
|
|
47121
50156
|
|
|
47122
50157
|
// EXTERNAL MODULE: ./node_modules/_core-js@3.36.1@core-js/modules/es.string.replace-all.js
|
|
@@ -47125,6 +50160,247 @@ var es_string_replace_all = __webpack_require__(9881);
|
|
|
47125
50160
|
var downloadPage = __webpack_require__(3380);
|
|
47126
50161
|
// EXTERNAL MODULE: ./src/utils/encryption/aesEncrypt.js
|
|
47127
50162
|
var aesEncrypt = __webpack_require__(6151);
|
|
50163
|
+
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/common/dragUpload.vue?vue&type=template&id=296607cf&scoped=true
|
|
50164
|
+
var dragUploadvue_type_template_id_296607cf_scoped_true_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticStyle:{"display":"flex","gap":"5px","flex-wrap":"wrap"},style:(("pointer-events: " + (_vm.disabled ? 'none' : 'auto')))},[_c('div',{staticClass:"paste_box",style:((";background: " + (_vm.isDragging ? '#f0f8ff' : 'initial') + "; ")),on:{"click":function($event){_vm.pasteMode = !_vm.pasteMode},"dragover":function($event){$event.preventDefault();$event.stopPropagation();return _vm.handleDragOver.apply(null, arguments)},"drop":function($event){$event.preventDefault();return _vm.handleDrop.apply(null, arguments)},"dragleave":function($event){$event.preventDefault();return _vm.handleDragLeave.apply(null, arguments)}}},[(_vm.pasteMode)?[_c('div',{staticStyle:{"text-align":"center"}},[_vm._v("Ctrl+v 粘贴"+_vm._s(_vm.strType))])]:[_c('a-button',{staticStyle:{"padding-left":"0","padding-right":"5px","z-index":"1"},attrs:{"type":"link"},on:{"click":function($event){$event.stopPropagation();return _vm.handlePlusClick.apply(null, arguments)}}},[_vm._v("选择")]),_c('span',[_vm._v(_vm._s(_vm.placeholder))]),_c('input',{staticClass:"drop-file-input",attrs:{"type":"text"}})]],2),(_vm.QrUpload)?_c('div',{staticClass:"erweima_pop",staticStyle:{"flex":"1"}},[_c('a-popover',{attrs:{"trigger":"click","placement":"bottom","getPopupContainer":function (triggerNode) {
|
|
50165
|
+
return triggerNode.parentNode.parentNode || _vm.document.body;
|
|
50166
|
+
}},on:{"visibleChange":_vm.visibleChange}},[_c('template',{slot:"content"},[_c('div',{staticStyle:{"width":"150px"}},[_c('img',{staticStyle:{"margin":"5px 0 10px 0"},attrs:{"src":_vm.imgUrl,"width":"150px","height":"150px"}}),_c('div',{staticStyle:{"text-align":"center"}},[_vm._v("扫描二维码,在手机上选择"+_vm._s(_vm.strType)+"上传")])])]),_c('div',{staticStyle:{"width":"40px","height":"40px","border":"1px dashed #d9d9d9","display":"flex","align-items":"center","justify-content":"center","text-align":"center","border-radius":"5px"},on:{"click":function($event){return _vm.showQr()}}},[_c('form-iconfont',{staticClass:"m_erweima",attrs:{"type":"icon-m_erweima"}})],1)],2)],1):_vm._e()])}
|
|
50167
|
+
var dragUploadvue_type_template_id_296607cf_scoped_true_staticRenderFns = []
|
|
50168
|
+
|
|
50169
|
+
|
|
50170
|
+
;// CONCATENATED MODULE: ./node_modules/_thread-loader@3.0.4@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.3.0@babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/common/dragUpload.vue?vue&type=script&lang=js
|
|
50171
|
+
//
|
|
50172
|
+
//
|
|
50173
|
+
//
|
|
50174
|
+
//
|
|
50175
|
+
//
|
|
50176
|
+
//
|
|
50177
|
+
//
|
|
50178
|
+
//
|
|
50179
|
+
//
|
|
50180
|
+
//
|
|
50181
|
+
//
|
|
50182
|
+
//
|
|
50183
|
+
//
|
|
50184
|
+
//
|
|
50185
|
+
//
|
|
50186
|
+
//
|
|
50187
|
+
//
|
|
50188
|
+
//
|
|
50189
|
+
//
|
|
50190
|
+
//
|
|
50191
|
+
//
|
|
50192
|
+
//
|
|
50193
|
+
//
|
|
50194
|
+
//
|
|
50195
|
+
//
|
|
50196
|
+
//
|
|
50197
|
+
//
|
|
50198
|
+
//
|
|
50199
|
+
//
|
|
50200
|
+
//
|
|
50201
|
+
//
|
|
50202
|
+
//
|
|
50203
|
+
//
|
|
50204
|
+
//
|
|
50205
|
+
//
|
|
50206
|
+
//
|
|
50207
|
+
|
|
50208
|
+
|
|
50209
|
+
|
|
50210
|
+
|
|
50211
|
+
/* harmony default export */ const dragUploadvue_type_script_lang_js = ({
|
|
50212
|
+
name: "dragUpload",
|
|
50213
|
+
props: {
|
|
50214
|
+
uploadRef: {
|
|
50215
|
+
type: Function,
|
|
50216
|
+
default: () => {}
|
|
50217
|
+
},
|
|
50218
|
+
disabled: {
|
|
50219
|
+
type: Boolean,
|
|
50220
|
+
default: () => {
|
|
50221
|
+
return false;
|
|
50222
|
+
}
|
|
50223
|
+
},
|
|
50224
|
+
QrUpload: {
|
|
50225
|
+
type: Boolean
|
|
50226
|
+
},
|
|
50227
|
+
placeholder: {
|
|
50228
|
+
type: String,
|
|
50229
|
+
default: '拖拽或者单击后粘贴图片'
|
|
50230
|
+
},
|
|
50231
|
+
model: {
|
|
50232
|
+
type: String,
|
|
50233
|
+
default: ''
|
|
50234
|
+
},
|
|
50235
|
+
type: {
|
|
50236
|
+
type: String,
|
|
50237
|
+
default: 'image'
|
|
50238
|
+
},
|
|
50239
|
+
QrData: {
|
|
50240
|
+
type: Object,
|
|
50241
|
+
default: {}
|
|
50242
|
+
}
|
|
50243
|
+
},
|
|
50244
|
+
data() {
|
|
50245
|
+
return {
|
|
50246
|
+
pasteMode: false,
|
|
50247
|
+
isDragging: false,
|
|
50248
|
+
visibleQR: false,
|
|
50249
|
+
imgUrl: '',
|
|
50250
|
+
timer: null,
|
|
50251
|
+
refreshQr: null
|
|
50252
|
+
};
|
|
50253
|
+
},
|
|
50254
|
+
watch: {
|
|
50255
|
+
pasteMode(val) {
|
|
50256
|
+
if (val) {
|
|
50257
|
+
Bus/* default */.A.$emit('paste-mode', this.model);
|
|
50258
|
+
document.addEventListener('paste', this.handlePasteListener);
|
|
50259
|
+
} else {
|
|
50260
|
+
document.removeEventListener('paste', this.handlePasteListener);
|
|
50261
|
+
}
|
|
50262
|
+
}
|
|
50263
|
+
},
|
|
50264
|
+
mounted() {
|
|
50265
|
+
Bus/* default */.A.$on('paste-mode', val => {
|
|
50266
|
+
if (val === this.model) return;
|
|
50267
|
+
this.pasteMode = false;
|
|
50268
|
+
});
|
|
50269
|
+
},
|
|
50270
|
+
beforeDestroy() {
|
|
50271
|
+
document.removeEventListener('paste', this.handlePasteListener);
|
|
50272
|
+
},
|
|
50273
|
+
computed: {
|
|
50274
|
+
strType() {
|
|
50275
|
+
const type = {
|
|
50276
|
+
image: '图片',
|
|
50277
|
+
file: '文件'
|
|
50278
|
+
};
|
|
50279
|
+
return type[this.type];
|
|
50280
|
+
}
|
|
50281
|
+
},
|
|
50282
|
+
destroyed() {
|
|
50283
|
+
clearInterval(this.timer);
|
|
50284
|
+
},
|
|
50285
|
+
methods: {
|
|
50286
|
+
visibleChange(v) {
|
|
50287
|
+
console.log(v);
|
|
50288
|
+
this.visibleQR = v;
|
|
50289
|
+
if (!v) {
|
|
50290
|
+
clearInterval(this.timer);
|
|
50291
|
+
clearInterval(this.refreshQr);
|
|
50292
|
+
}
|
|
50293
|
+
},
|
|
50294
|
+
showQr(e) {
|
|
50295
|
+
let uploadId = (0,util.generateRandomString)(6);
|
|
50296
|
+
const setData = () => {
|
|
50297
|
+
this.imgUrl = '';
|
|
50298
|
+
let url = window._CONFIG.QrUpload;
|
|
50299
|
+
if (url && !url.startsWith('http')) {
|
|
50300
|
+
url = location.origin + url;
|
|
50301
|
+
}
|
|
50302
|
+
// js随机字符
|
|
50303
|
+
QRCode.toDataURL((url || `http://10.30.15.41:4000/componentWeb/qrCode`) + `?uploadId=${uploadId}`, {
|
|
50304
|
+
margin: 0
|
|
50305
|
+
}).then(res => {
|
|
50306
|
+
this.imgUrl = res;
|
|
50307
|
+
});
|
|
50308
|
+
(0,manage/* postAction */.vd)('/formApi/saveUploadData', {
|
|
50309
|
+
uploadId,
|
|
50310
|
+
QrData: this.QrData,
|
|
50311
|
+
imgUrl: window._CONFIG.imgDomainURL || window._CONFIG.imgUrl,
|
|
50312
|
+
token: this.getToken()
|
|
50313
|
+
});
|
|
50314
|
+
};
|
|
50315
|
+
setData();
|
|
50316
|
+
this.refreshQr = setInterval(() => {
|
|
50317
|
+
if (this.visibleQR) {
|
|
50318
|
+
setData();
|
|
50319
|
+
}
|
|
50320
|
+
}, 30 * 1000);
|
|
50321
|
+
clearInterval(this.timer);
|
|
50322
|
+
this.timer = setInterval(() => {
|
|
50323
|
+
(0,manage/* getAction */.Th)('/formApi/getUploadFilePath', {
|
|
50324
|
+
uploadId
|
|
50325
|
+
}).then(res => {
|
|
50326
|
+
this.$emit('add', res.result);
|
|
50327
|
+
});
|
|
50328
|
+
}, 1000);
|
|
50329
|
+
},
|
|
50330
|
+
handlePlusClick(e) {
|
|
50331
|
+
this.uploadRef().$refs.uploadRef.$el.click();
|
|
50332
|
+
e.stopPropagation();
|
|
50333
|
+
},
|
|
50334
|
+
handleDragOver(e) {
|
|
50335
|
+
this.isDragging = true;
|
|
50336
|
+
},
|
|
50337
|
+
handleDragLeave(e) {
|
|
50338
|
+
this.isDragging = false;
|
|
50339
|
+
},
|
|
50340
|
+
handleDrop(e) {
|
|
50341
|
+
if (e.dataTransfer.files && e.dataTransfer.files.length) {
|
|
50342
|
+
this.$nextTick(() => {
|
|
50343
|
+
this.uploadRef().$refs.uploadRef.$refs.uploaderRef.onChange({
|
|
50344
|
+
target: {
|
|
50345
|
+
files: e.dataTransfer.files
|
|
50346
|
+
}
|
|
50347
|
+
});
|
|
50348
|
+
});
|
|
50349
|
+
}
|
|
50350
|
+
this.isDragging = false;
|
|
50351
|
+
},
|
|
50352
|
+
handlePasteListener(e) {
|
|
50353
|
+
console.log(e);
|
|
50354
|
+
// 获取粘贴对象
|
|
50355
|
+
let clipboardData = e.clipboardData;
|
|
50356
|
+
if (clipboardData && clipboardData.items && clipboardData.items.length) {
|
|
50357
|
+
// 获取剪切板中的图片对象
|
|
50358
|
+
let items = clipboardData.items;
|
|
50359
|
+
if (items.length > 0) {
|
|
50360
|
+
// 判断当前对象是否是图片对象
|
|
50361
|
+
if (items[0].type.indexOf("image") !== -1) {
|
|
50362
|
+
this.$nextTick(() => {
|
|
50363
|
+
this.uploadRef().$refs.uploadRef.$refs.uploaderRef.onChange({
|
|
50364
|
+
target: {
|
|
50365
|
+
files: clipboardData.files
|
|
50366
|
+
}
|
|
50367
|
+
});
|
|
50368
|
+
});
|
|
50369
|
+
// this.uploadRef.onStart(blob)
|
|
50370
|
+
}
|
|
50371
|
+
}
|
|
50372
|
+
}
|
|
50373
|
+
}
|
|
50374
|
+
}
|
|
50375
|
+
});
|
|
50376
|
+
;// CONCATENATED MODULE: ./src/form/modules/common/dragUpload.vue?vue&type=script&lang=js
|
|
50377
|
+
/* harmony default export */ const common_dragUploadvue_type_script_lang_js = (dragUploadvue_type_script_lang_js);
|
|
50378
|
+
;// CONCATENATED MODULE: ./node_modules/_mini-css-extract-plugin@2.8.1@mini-css-extract-plugin/dist/loader.js??clonedRuleSet-32.use[0]!./node_modules/_css-loader@6.10.0@css-loader/dist/cjs.js??clonedRuleSet-32.use[1]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/stylePostLoader.js!./node_modules/_postcss-loader@6.2.1@postcss-loader/dist/cjs.js??clonedRuleSet-32.use[2]!./node_modules/_less-loader@5.0.0@less-loader/dist/cjs.js??clonedRuleSet-32.use[3]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/common/dragUpload.vue?vue&type=style&index=0&id=296607cf&prod&scoped=true&lang=less
|
|
50379
|
+
// extracted by mini-css-extract-plugin
|
|
50380
|
+
|
|
50381
|
+
;// CONCATENATED MODULE: ./src/form/modules/common/dragUpload.vue?vue&type=style&index=0&id=296607cf&prod&scoped=true&lang=less
|
|
50382
|
+
|
|
50383
|
+
;// CONCATENATED MODULE: ./src/form/modules/common/dragUpload.vue
|
|
50384
|
+
|
|
50385
|
+
|
|
50386
|
+
|
|
50387
|
+
;
|
|
50388
|
+
|
|
50389
|
+
|
|
50390
|
+
/* normalize component */
|
|
50391
|
+
|
|
50392
|
+
var dragUpload_component = (0,componentNormalizer/* default */.A)(
|
|
50393
|
+
common_dragUploadvue_type_script_lang_js,
|
|
50394
|
+
dragUploadvue_type_template_id_296607cf_scoped_true_render,
|
|
50395
|
+
dragUploadvue_type_template_id_296607cf_scoped_true_staticRenderFns,
|
|
50396
|
+
false,
|
|
50397
|
+
null,
|
|
50398
|
+
"296607cf",
|
|
50399
|
+
null
|
|
50400
|
+
|
|
50401
|
+
)
|
|
50402
|
+
|
|
50403
|
+
/* harmony default export */ const dragUpload = (dragUpload_component.exports);
|
|
47128
50404
|
;// CONCATENATED MODULE: ./node_modules/_thread-loader@3.0.4@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.3.0@babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/ImgUpload/component.vue?vue&type=script&lang=js
|
|
47129
50405
|
|
|
47130
50406
|
|
|
@@ -47198,6 +50474,8 @@ var aesEncrypt = __webpack_require__(6151);
|
|
|
47198
50474
|
//
|
|
47199
50475
|
//
|
|
47200
50476
|
//
|
|
50477
|
+
//
|
|
50478
|
+
|
|
47201
50479
|
|
|
47202
50480
|
|
|
47203
50481
|
|
|
@@ -47238,7 +50516,9 @@ function getBase64(file) {
|
|
|
47238
50516
|
imgUrl: window._CONFIG.imgDomainURL || window._CONFIG.imgUrl
|
|
47239
50517
|
};
|
|
47240
50518
|
},
|
|
47241
|
-
components: {
|
|
50519
|
+
components: {
|
|
50520
|
+
DragUpload: dragUpload
|
|
50521
|
+
},
|
|
47242
50522
|
async created() {
|
|
47243
50523
|
const {
|
|
47244
50524
|
downloadVerifyToken,
|
|
@@ -47254,6 +50534,12 @@ function getBase64(file) {
|
|
|
47254
50534
|
this.showImage();
|
|
47255
50535
|
},
|
|
47256
50536
|
computed: {
|
|
50537
|
+
currHeight() {
|
|
50538
|
+
if (this.widget.options.uploadStyle === '1' && (!this.widget.options.disabled || this.isdisabled)) {
|
|
50539
|
+
return (this.fileList.length ? this.widget.options.height + 60 : 60) + 'px';
|
|
50540
|
+
}
|
|
50541
|
+
return this.widget.options.height + 'px';
|
|
50542
|
+
},
|
|
47257
50543
|
size() {
|
|
47258
50544
|
const {
|
|
47259
50545
|
width,
|
|
@@ -47277,6 +50563,13 @@ function getBase64(file) {
|
|
|
47277
50563
|
}
|
|
47278
50564
|
},
|
|
47279
50565
|
methods: {
|
|
50566
|
+
uploadAdd(e) {
|
|
50567
|
+
if (e) {
|
|
50568
|
+
const flag = this.handleUploadApi(e, e.fileInfo);
|
|
50569
|
+
if (false === flag) return;
|
|
50570
|
+
this.showImage();
|
|
50571
|
+
}
|
|
50572
|
+
},
|
|
47280
50573
|
//回显
|
|
47281
50574
|
showImage() {
|
|
47282
50575
|
this.fileList = this.dataModel.map(item => {
|
|
@@ -47330,6 +50623,40 @@ function getBase64(file) {
|
|
|
47330
50623
|
// }
|
|
47331
50624
|
this.previewVisible = true;
|
|
47332
50625
|
},
|
|
50626
|
+
handleUploadApi(response, file = {}) {
|
|
50627
|
+
const {
|
|
50628
|
+
result = {},
|
|
50629
|
+
success,
|
|
50630
|
+
message
|
|
50631
|
+
} = response;
|
|
50632
|
+
if (!success) {
|
|
50633
|
+
this.fileList = this.fileList.filter(item => item.uid !== file.uid);
|
|
50634
|
+
return this.$message.warning(message || '文件上传失败');
|
|
50635
|
+
}
|
|
50636
|
+
const random_uid = Math.random();
|
|
50637
|
+
if (this.widget.options.uploadEncrypt) {
|
|
50638
|
+
const fileId = result.fileId;
|
|
50639
|
+
this.dataModel.push({
|
|
50640
|
+
key: file.uid || random_uid,
|
|
50641
|
+
uid: file.uid || random_uid,
|
|
50642
|
+
fileId,
|
|
50643
|
+
url: message,
|
|
50644
|
+
status: 'done',
|
|
50645
|
+
name: result.fileName || file.name
|
|
50646
|
+
});
|
|
50647
|
+
if (this.widget.options.uploadEncrypt) {
|
|
50648
|
+
this.updateStringModel('formFileIds', fileId, 'add');
|
|
50649
|
+
}
|
|
50650
|
+
} else {
|
|
50651
|
+
this.dataModel.push({
|
|
50652
|
+
key: file.uid || random_uid,
|
|
50653
|
+
uid: file.uid || random_uid,
|
|
50654
|
+
url: response.message,
|
|
50655
|
+
status: "done",
|
|
50656
|
+
name: file.name
|
|
50657
|
+
});
|
|
50658
|
+
}
|
|
50659
|
+
},
|
|
47333
50660
|
handleChange({
|
|
47334
50661
|
file,
|
|
47335
50662
|
fileList
|
|
@@ -47345,37 +50672,8 @@ function getBase64(file) {
|
|
|
47345
50672
|
}
|
|
47346
50673
|
if (file.status == "done") {
|
|
47347
50674
|
let response = file.response;
|
|
47348
|
-
const
|
|
47349
|
-
|
|
47350
|
-
success,
|
|
47351
|
-
message
|
|
47352
|
-
} = response;
|
|
47353
|
-
if (!success) {
|
|
47354
|
-
this.fileList = this.fileList.filter(item => item.uid !== file.uid);
|
|
47355
|
-
return this.$message.warning(message || '文件上传失败');
|
|
47356
|
-
}
|
|
47357
|
-
if (this.widget.options.uploadEncrypt) {
|
|
47358
|
-
const fileId = result.fileId;
|
|
47359
|
-
this.dataModel.push({
|
|
47360
|
-
key: file.uid,
|
|
47361
|
-
uid: file.uid,
|
|
47362
|
-
fileId,
|
|
47363
|
-
url: message,
|
|
47364
|
-
status: 'done',
|
|
47365
|
-
name: result.fileName || file.name
|
|
47366
|
-
});
|
|
47367
|
-
if (this.widget.options.uploadEncrypt) {
|
|
47368
|
-
this.updateStringModel('formFileIds', fileId, 'add');
|
|
47369
|
-
}
|
|
47370
|
-
} else {
|
|
47371
|
-
this.dataModel.push({
|
|
47372
|
-
key: file.uid,
|
|
47373
|
-
uid: file.uid,
|
|
47374
|
-
url: response.message,
|
|
47375
|
-
status: "done",
|
|
47376
|
-
name: file.name
|
|
47377
|
-
});
|
|
47378
|
-
}
|
|
50675
|
+
const flag = this.handleUploadApi(response, file);
|
|
50676
|
+
if (false === flag) return false;
|
|
47379
50677
|
this.updateValidateNotify();
|
|
47380
50678
|
} else if (file.status == "removed") {
|
|
47381
50679
|
let removeFileId = '';
|
|
@@ -47403,10 +50701,10 @@ function getBase64(file) {
|
|
|
47403
50701
|
});
|
|
47404
50702
|
;// CONCATENATED MODULE: ./src/form/modules/components/ImgUpload/component.vue?vue&type=script&lang=js
|
|
47405
50703
|
/* harmony default export */ const components_ImgUpload_componentvue_type_script_lang_js = (ImgUpload_componentvue_type_script_lang_js);
|
|
47406
|
-
;// CONCATENATED MODULE: ./node_modules/_mini-css-extract-plugin@2.8.1@mini-css-extract-plugin/dist/loader.js??clonedRuleSet-32.use[0]!./node_modules/_css-loader@6.10.0@css-loader/dist/cjs.js??clonedRuleSet-32.use[1]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/stylePostLoader.js!./node_modules/_postcss-loader@6.2.1@postcss-loader/dist/cjs.js??clonedRuleSet-32.use[2]!./node_modules/_less-loader@5.0.0@less-loader/dist/cjs.js??clonedRuleSet-32.use[3]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/ImgUpload/component.vue?vue&type=style&index=0&id=
|
|
50704
|
+
;// CONCATENATED MODULE: ./node_modules/_mini-css-extract-plugin@2.8.1@mini-css-extract-plugin/dist/loader.js??clonedRuleSet-32.use[0]!./node_modules/_css-loader@6.10.0@css-loader/dist/cjs.js??clonedRuleSet-32.use[1]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/stylePostLoader.js!./node_modules/_postcss-loader@6.2.1@postcss-loader/dist/cjs.js??clonedRuleSet-32.use[2]!./node_modules/_less-loader@5.0.0@less-loader/dist/cjs.js??clonedRuleSet-32.use[3]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/ImgUpload/component.vue?vue&type=style&index=0&id=09b06e35&prod&lang=less&scoped=true
|
|
47407
50705
|
// extracted by mini-css-extract-plugin
|
|
47408
50706
|
|
|
47409
|
-
;// CONCATENATED MODULE: ./src/form/modules/components/ImgUpload/component.vue?vue&type=style&index=0&id=
|
|
50707
|
+
;// CONCATENATED MODULE: ./src/form/modules/components/ImgUpload/component.vue?vue&type=style&index=0&id=09b06e35&prod&lang=less&scoped=true
|
|
47410
50708
|
|
|
47411
50709
|
;// CONCATENATED MODULE: ./src/form/modules/components/ImgUpload/component.vue
|
|
47412
50710
|
|
|
@@ -47419,19 +50717,19 @@ function getBase64(file) {
|
|
|
47419
50717
|
|
|
47420
50718
|
var ImgUpload_component_component = (0,componentNormalizer/* default */.A)(
|
|
47421
50719
|
components_ImgUpload_componentvue_type_script_lang_js,
|
|
47422
|
-
|
|
47423
|
-
|
|
50720
|
+
componentvue_type_template_id_09b06e35_scoped_true_render,
|
|
50721
|
+
componentvue_type_template_id_09b06e35_scoped_true_staticRenderFns,
|
|
47424
50722
|
false,
|
|
47425
50723
|
null,
|
|
47426
|
-
"
|
|
50724
|
+
"09b06e35",
|
|
47427
50725
|
null
|
|
47428
50726
|
|
|
47429
50727
|
)
|
|
47430
50728
|
|
|
47431
50729
|
/* harmony default export */ const ImgUpload_component = (ImgUpload_component_component.exports);
|
|
47432
|
-
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/ImgUpload/widgetSetup.vue?vue&type=template&id=
|
|
47433
|
-
var
|
|
47434
|
-
var
|
|
50730
|
+
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/ImgUpload/widgetSetup.vue?vue&type=template&id=4fd96d86&scoped=true
|
|
50731
|
+
var widgetSetupvue_type_template_id_4fd96d86_scoped_true_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"control"},[_c('div',{staticClass:"form_wrap"},[_c('div',{staticClass:"form"},[_c('a-form-model',[_c('a-form-model-item',{ref:"title",attrs:{"label":"默认值","prop":"title"}},[_c('common-config-sql',{attrs:{"widget":_vm.widget}})],1),(_vm.widget.options.uploadStyle === '1')?_c('a-form-model-item',{attrs:{"label":"扫码上传"}},[_c('a-switch',{model:{value:(_vm.widget.options.enableQrUpload),callback:function ($$v) {_vm.$set(_vm.widget.options, "enableQrUpload", $$v)},expression:"widget.options.enableQrUpload"}})],1):_vm._e(),_c('a-form-model-item',{attrs:{"label":"加密上传"}},[_c('a-switch',{model:{value:(_vm.widget.options.uploadEncrypt),callback:function ($$v) {_vm.$set(_vm.widget.options, "uploadEncrypt", $$v)},expression:"widget.options.uploadEncrypt"}})],1),(_vm.widget.options.uploadEncrypt)?_c('a-form-model-item',{attrs:{"label":"Token解密下载"}},[_c('a-switch',{model:{value:(_vm.widget.options.downloadVerifyToken),callback:function ($$v) {_vm.$set(_vm.widget.options, "downloadVerifyToken", $$v)},expression:"widget.options.downloadVerifyToken"}})],1):_vm._e(),(_vm.widget.options.uploadStyle === '1')?_c('a-form-model-item',{attrs:{"label":"提示语"}},[_c('a-input',{model:{value:(_vm.widget.options.placeholder_1),callback:function ($$v) {_vm.$set(_vm.widget.options, "placeholder_1", $$v)},expression:"widget.options.placeholder_1"}})],1):_vm._e(),_c('a-form-model-item',{attrs:{"label":"允许文件上传类型"}},[_c('a-tooltip',{attrs:{"placement":"top"}},[_c('template',{slot:"title"},[_c('span',[_vm._v("请输入允许上传的文件后缀,多个以逗号隔开")])]),_c('a-input',{model:{value:(_vm.widget.ext),callback:function ($$v) {_vm.$set(_vm.widget, "ext", $$v)},expression:"widget.ext"}})],2)],1),_c('a-form-model-item',{attrs:{"label":"最大上传数"}},[_c('a-input-number',{attrs:{"max":5,"min":1},model:{value:(_vm.widget.options.length),callback:function ($$v) {_vm.$set(_vm.widget.options, "length", $$v)},expression:"widget.options.length"}})],1),_c('a-form-model-item',{attrs:{"label":"最大上传图片大小kb"}},[_c('a-input',{model:{value:(_vm.widget.options.fileSize),callback:function ($$v) {_vm.$set(_vm.widget.options, "fileSize", $$v)},expression:"widget.options.fileSize"}})],1),_c('a-form-model-item',{attrs:{"label":"图片上传地址"}},[_c('a-input',{model:{value:(_vm.widget.options.action),callback:function ($$v) {_vm.$set(_vm.widget.options, "action", $$v)},expression:"widget.options.action"}})],1),_c('a-form-model-item',{attrs:{"label":"图片宽度"}},[_c('a-input',{model:{value:(_vm.widget.options.size.width),callback:function ($$v) {_vm.$set(_vm.widget.options.size, "width", $$v)},expression:"widget.options.size.width"}})],1),_c('a-form-model-item',{attrs:{"label":"图片高度"}},[_c('a-input',{model:{value:(_vm.widget.options.size.height),callback:function ($$v) {_vm.$set(_vm.widget.options.size, "height", $$v)},expression:"widget.options.size.height"}})],1)],1)],1)])])}
|
|
50732
|
+
var widgetSetupvue_type_template_id_4fd96d86_scoped_true_staticRenderFns = []
|
|
47435
50733
|
|
|
47436
50734
|
|
|
47437
50735
|
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/common/commonConfigSql.vue?vue&type=template&id=2df1220e&scoped=true
|
|
@@ -47584,6 +50882,14 @@ var commonConfigSql_component = (0,componentNormalizer/* default */.A)(
|
|
|
47584
50882
|
//
|
|
47585
50883
|
//
|
|
47586
50884
|
//
|
|
50885
|
+
//
|
|
50886
|
+
//
|
|
50887
|
+
//
|
|
50888
|
+
//
|
|
50889
|
+
//
|
|
50890
|
+
//
|
|
50891
|
+
//
|
|
50892
|
+
//
|
|
47587
50893
|
|
|
47588
50894
|
|
|
47589
50895
|
/* harmony default export */ const ImgUpload_widgetSetupvue_type_script_lang_js = ({
|
|
@@ -47630,26 +50936,26 @@ var commonConfigSql_component = (0,componentNormalizer/* default */.A)(
|
|
|
47630
50936
|
;
|
|
47631
50937
|
var ImgUpload_widgetSetup_component = (0,componentNormalizer/* default */.A)(
|
|
47632
50938
|
components_ImgUpload_widgetSetupvue_type_script_lang_js,
|
|
47633
|
-
|
|
47634
|
-
|
|
50939
|
+
widgetSetupvue_type_template_id_4fd96d86_scoped_true_render,
|
|
50940
|
+
widgetSetupvue_type_template_id_4fd96d86_scoped_true_staticRenderFns,
|
|
47635
50941
|
false,
|
|
47636
50942
|
null,
|
|
47637
|
-
"
|
|
50943
|
+
"4fd96d86",
|
|
47638
50944
|
null
|
|
47639
50945
|
|
|
47640
50946
|
)
|
|
47641
50947
|
|
|
47642
50948
|
/* harmony default export */ const ImgUpload_widgetSetup = (ImgUpload_widgetSetup_component.exports);
|
|
47643
|
-
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/ImgUpload/widgetDesign.vue?vue&type=template&id=
|
|
47644
|
-
var
|
|
50949
|
+
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/ImgUpload/widgetDesign.vue?vue&type=template&id=3991732b&scoped=true
|
|
50950
|
+
var widgetDesignvue_type_template_id_3991732b_scoped_true_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.widget)?_c('div',{staticClass:"custom_form_item",style:({ height: _vm.widget.options.height + 'px' })},[_c('a-form-model-item',{attrs:{"colon":false,"label-col":_vm.labelCol,"wrapperCol":_vm.wrapperCol}},[(_vm.widget.options.labelWidth !== 0)?_c('div',{class:[
|
|
47645
50951
|
_vm.config.align,
|
|
47646
50952
|
_vm.config.validate === true && _vm.widget.options.required === true
|
|
47647
50953
|
? 'is_required'
|
|
47648
|
-
: 'no_required' ],style:({ color: this.config.color }),attrs:{"slot":"label"},slot:"label"},[_vm._v(" "+_vm._s(_vm.widget.name)+" ")]):_vm._e(),_c('a-upload',{style:({
|
|
50954
|
+
: 'no_required' ],style:({ color: this.config.color }),attrs:{"slot":"label"},slot:"label"},[_vm._v(" "+_vm._s(_vm.widget.name)+" ")]):_vm._e(),(_vm.widget.options.uploadStyle === '1')?[_c('drag-upload',{attrs:{"placeholder":_vm.widget.options.placeholder,"disabled":true,"QrUpload":_vm.widget.options.enableQrUpload}})]:_c('a-upload',{style:({
|
|
47649
50955
|
width: _vm.widget.options.size.width + 'px',
|
|
47650
50956
|
height: _vm.widget.options.size.height + 'px',
|
|
47651
|
-
}),attrs:{"list-type":"picture-card","file-list":_vm.fileList,"disabled":true,"headers":_vm.headers}},[(_vm.fileList.length < 8)?_c('div',[_c('a-icon',{attrs:{"type":"plus"}}),_c('div',{staticClass:"ant-upload-text"},[_vm._v(_vm._s(_vm.widget.options.placeholder))])],1):_vm._e()])],
|
|
47652
|
-
var
|
|
50957
|
+
}),attrs:{"list-type":"picture-card","file-list":_vm.fileList,"disabled":true,"headers":_vm.headers}},[(_vm.fileList.length < 8)?_c('div',[_c('a-icon',{attrs:{"type":"plus"}}),_c('div',{staticClass:"ant-upload-text"},[_vm._v(_vm._s(_vm.widget.options.placeholder))])],1):_vm._e()])],2)],1):_vm._e()}
|
|
50958
|
+
var widgetDesignvue_type_template_id_3991732b_scoped_true_staticRenderFns = []
|
|
47653
50959
|
|
|
47654
50960
|
|
|
47655
50961
|
;// CONCATENATED MODULE: ./node_modules/_thread-loader@3.0.4@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.3.0@babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/ImgUpload/widgetDesign.vue?vue&type=script&lang=js
|
|
@@ -47692,6 +50998,11 @@ var widgetDesignvue_type_template_id_29e288ab_scoped_true_staticRenderFns = []
|
|
|
47692
50998
|
//
|
|
47693
50999
|
//
|
|
47694
51000
|
//
|
|
51001
|
+
//
|
|
51002
|
+
//
|
|
51003
|
+
//
|
|
51004
|
+
//
|
|
51005
|
+
|
|
47695
51006
|
|
|
47696
51007
|
|
|
47697
51008
|
/* harmony default export */ const ImgUpload_widgetDesignvue_type_script_lang_js = ({
|
|
@@ -47716,7 +51027,9 @@ var widgetDesignvue_type_template_id_29e288ab_scoped_true_staticRenderFns = []
|
|
|
47716
51027
|
}
|
|
47717
51028
|
};
|
|
47718
51029
|
},
|
|
47719
|
-
components: {
|
|
51030
|
+
components: {
|
|
51031
|
+
DragUpload: dragUpload
|
|
51032
|
+
},
|
|
47720
51033
|
inject: ["config"],
|
|
47721
51034
|
watch: {
|
|
47722
51035
|
value(oldval, newval) {
|
|
@@ -47731,10 +51044,10 @@ var widgetDesignvue_type_template_id_29e288ab_scoped_true_staticRenderFns = []
|
|
|
47731
51044
|
});
|
|
47732
51045
|
;// CONCATENATED MODULE: ./src/form/modules/components/ImgUpload/widgetDesign.vue?vue&type=script&lang=js
|
|
47733
51046
|
/* harmony default export */ const components_ImgUpload_widgetDesignvue_type_script_lang_js = (ImgUpload_widgetDesignvue_type_script_lang_js);
|
|
47734
|
-
;// CONCATENATED MODULE: ./node_modules/_mini-css-extract-plugin@2.8.1@mini-css-extract-plugin/dist/loader.js??clonedRuleSet-32.use[0]!./node_modules/_css-loader@6.10.0@css-loader/dist/cjs.js??clonedRuleSet-32.use[1]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/stylePostLoader.js!./node_modules/_postcss-loader@6.2.1@postcss-loader/dist/cjs.js??clonedRuleSet-32.use[2]!./node_modules/_less-loader@5.0.0@less-loader/dist/cjs.js??clonedRuleSet-32.use[3]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/ImgUpload/widgetDesign.vue?vue&type=style&index=0&id=
|
|
51047
|
+
;// CONCATENATED MODULE: ./node_modules/_mini-css-extract-plugin@2.8.1@mini-css-extract-plugin/dist/loader.js??clonedRuleSet-32.use[0]!./node_modules/_css-loader@6.10.0@css-loader/dist/cjs.js??clonedRuleSet-32.use[1]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/stylePostLoader.js!./node_modules/_postcss-loader@6.2.1@postcss-loader/dist/cjs.js??clonedRuleSet-32.use[2]!./node_modules/_less-loader@5.0.0@less-loader/dist/cjs.js??clonedRuleSet-32.use[3]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/ImgUpload/widgetDesign.vue?vue&type=style&index=0&id=3991732b&prod&lang=less&scoped=true
|
|
47735
51048
|
// extracted by mini-css-extract-plugin
|
|
47736
51049
|
|
|
47737
|
-
;// CONCATENATED MODULE: ./src/form/modules/components/ImgUpload/widgetDesign.vue?vue&type=style&index=0&id=
|
|
51050
|
+
;// CONCATENATED MODULE: ./src/form/modules/components/ImgUpload/widgetDesign.vue?vue&type=style&index=0&id=3991732b&prod&lang=less&scoped=true
|
|
47738
51051
|
|
|
47739
51052
|
;// CONCATENATED MODULE: ./src/form/modules/components/ImgUpload/widgetDesign.vue
|
|
47740
51053
|
|
|
@@ -47747,11 +51060,11 @@ var widgetDesignvue_type_template_id_29e288ab_scoped_true_staticRenderFns = []
|
|
|
47747
51060
|
|
|
47748
51061
|
var ImgUpload_widgetDesign_component = (0,componentNormalizer/* default */.A)(
|
|
47749
51062
|
components_ImgUpload_widgetDesignvue_type_script_lang_js,
|
|
47750
|
-
|
|
47751
|
-
|
|
51063
|
+
widgetDesignvue_type_template_id_3991732b_scoped_true_render,
|
|
51064
|
+
widgetDesignvue_type_template_id_3991732b_scoped_true_staticRenderFns,
|
|
47752
51065
|
false,
|
|
47753
51066
|
null,
|
|
47754
|
-
"
|
|
51067
|
+
"3991732b",
|
|
47755
51068
|
null
|
|
47756
51069
|
|
|
47757
51070
|
)
|
|
@@ -47766,15 +51079,15 @@ var ImgUpload_widgetDesign_component = (0,componentNormalizer/* default */.A)(
|
|
|
47766
51079
|
widgetSetup: ImgUpload_widgetSetup,
|
|
47767
51080
|
widgetDesign: ImgUpload_widgetDesign
|
|
47768
51081
|
});
|
|
47769
|
-
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/FileUpload/component.vue?vue&type=template&id=
|
|
47770
|
-
var
|
|
51082
|
+
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/FileUpload/component.vue?vue&type=template&id=5863dfe4&scoped=true
|
|
51083
|
+
var componentvue_type_template_id_5863dfe4_scoped_true_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.widget)?_c('div',{staticClass:"custom_form_item",style:({ height: _vm.widget.options.height + 'px' })},[_c('a-form-model-item',{ref:_vm.widget.model,attrs:{"colon":false,"label-col":_vm.labelCol,"wrapperCol":_vm.wrapperCol,"prop":_vm.tableKey ? (_vm.tableKey + "." + _vm.tableIndex + "." + (_vm.widget.model)) : _vm.widget.model,"rules":_vm.tableKey ? _vm.rules[_vm.tableKey][_vm.widget.model] : _vm.rules[_vm.widget.model]}},[(_vm.fileList.length < parseInt(_vm.widget.options.length) && (!_vm.widget.options.disabled || _vm.isdisabled))?[_c('drag-upload',{style:(("margin: 10px 0; margin-bottom: " + (this.fileList.length ? 0: '10px'))),attrs:{"type":"file","model":_vm.widget.model,"QrData":_vm.widget,"uploadRef":function () { return _vm.$refs.uploadRef; },"placeholder":_vm.widget.options.placeholder,"QrUpload":_vm.widget.options.enableQrUpload},on:{"add":_vm.uploadAdd}})]:_vm._e(),_c('a-upload',{ref:"uploadRef",attrs:{"action":_vm.actionUrl,"file-list":_vm.fileList,"headers":_vm.headers,"disabled":_vm.isdisabled ? _vm.show : _vm.widget.options.disabled,"beforeUpload":_vm.beforeUpload},on:{"change":_vm.handleChange,"preview":_vm.handlePreview}}),_c('FilePreview',{attrs:{"visible":_vm.previewVisible,"preview-type":_vm.previewType,"src":_vm.previewType === 'picture' ? _vm.previewImage : _vm.previewPdfSrc},on:{"update:visible":function($event){_vm.previewVisible=$event}}}),(_vm.widget.options.labelWidth !== 0)?_c('div',{class:[
|
|
47771
51084
|
_vm.config.align,
|
|
47772
51085
|
_vm.config.validate === true && _vm.widget.options.required === true
|
|
47773
51086
|
? 'is_required'
|
|
47774
51087
|
: 'no_required' ],style:({
|
|
47775
51088
|
color:_vm.config.color,
|
|
47776
|
-
}),attrs:{"slot":"label"},slot:"label"},[_vm._v(_vm._s(_vm.widget.name))]):_vm._e()],
|
|
47777
|
-
var
|
|
51089
|
+
}),attrs:{"slot":"label"},slot:"label"},[_vm._v(_vm._s(_vm.widget.name))]):_vm._e()],2),_c('a-modal',{attrs:{"title":"下载认证","width":"600px","footer":null},model:{value:(_vm.downloadVisible),callback:function ($$v) {_vm.downloadVisible=$$v},expression:"downloadVisible"}},[_c('a-spin',{attrs:{"tip":"页面加载中","spinning":_vm.downloadPageLoading}},[(_vm.downloadVisible)?_c('iframe',{staticStyle:{"width":"100%","height":"400px","border":"none","outline":"none"},attrs:{"src":_vm.downloadPageUrl},on:{"load":function($event){_vm.downloadPageLoading = false}}}):_vm._e()])],1),_c('a-modal',{attrs:{"destroyOnClose":"","title":"文件上传","width":"900px","footer":null},on:{"cancel":function($event){_vm.bigUploadOpen = false; _vm.uppy.cancelAll()}},model:{value:(_vm.bigUploadOpen),callback:function ($$v) {_vm.bigUploadOpen=$$v},expression:"bigUploadOpen"}},[_c('div',{staticStyle:{"display":"flex","justify-content":"center"}},[_c('Dashboard',{attrs:{"uppy":_vm.uppy,"props":_vm.dashboardprops}})],1)])],1):_vm._e()}
|
|
51090
|
+
var componentvue_type_template_id_5863dfe4_scoped_true_staticRenderFns = []
|
|
47778
51091
|
|
|
47779
51092
|
|
|
47780
51093
|
;// CONCATENATED MODULE: ./node_modules/_preact@10.20.1@preact/dist/preact.module.js
|
|
@@ -62463,6 +65776,11 @@ var locale_default = /*#__PURE__*/__webpack_require__.n(locale_locale);
|
|
|
62463
65776
|
//
|
|
62464
65777
|
//
|
|
62465
65778
|
//
|
|
65779
|
+
//
|
|
65780
|
+
//
|
|
65781
|
+
//
|
|
65782
|
+
//
|
|
65783
|
+
//
|
|
62466
65784
|
//
|
|
62467
65785
|
|
|
62468
65786
|
|
|
@@ -62478,6 +65796,7 @@ var locale_default = /*#__PURE__*/__webpack_require__.n(locale_locale);
|
|
|
62478
65796
|
|
|
62479
65797
|
|
|
62480
65798
|
|
|
65799
|
+
|
|
62481
65800
|
function componentvue_type_script_lang_js_getBase64(file) {
|
|
62482
65801
|
return new Promise((resolve, reject) => {
|
|
62483
65802
|
const reader = new FileReader();
|
|
@@ -62519,6 +65838,7 @@ function componentvue_type_script_lang_js_getBase64(file) {
|
|
|
62519
65838
|
};
|
|
62520
65839
|
},
|
|
62521
65840
|
components: {
|
|
65841
|
+
DragUpload: dragUpload,
|
|
62522
65842
|
FilePreview: FilePreview/* default */.A,
|
|
62523
65843
|
Dashboard: dashboard
|
|
62524
65844
|
},
|
|
@@ -62544,6 +65864,13 @@ function componentvue_type_script_lang_js_getBase64(file) {
|
|
|
62544
65864
|
}
|
|
62545
65865
|
},
|
|
62546
65866
|
methods: {
|
|
65867
|
+
uploadAdd(e) {
|
|
65868
|
+
if (e) {
|
|
65869
|
+
const flag = this.handleUploadApi(e, e.fileInfo);
|
|
65870
|
+
if (false === flag) return;
|
|
65871
|
+
this.showImage();
|
|
65872
|
+
}
|
|
65873
|
+
},
|
|
62547
65874
|
//回显
|
|
62548
65875
|
showImage() {
|
|
62549
65876
|
this.fileList = this.dataModel.map(item => {
|
|
@@ -62717,6 +66044,40 @@ function componentvue_type_script_lang_js_getBase64(file) {
|
|
|
62717
66044
|
name && (a.download = name);
|
|
62718
66045
|
a.click();
|
|
62719
66046
|
},
|
|
66047
|
+
handleUploadApi(response, file = {}) {
|
|
66048
|
+
const {
|
|
66049
|
+
result = {},
|
|
66050
|
+
success,
|
|
66051
|
+
message
|
|
66052
|
+
} = response;
|
|
66053
|
+
if (!success) {
|
|
66054
|
+
this.fileList = this.fileList.filter(item => item.uid !== file.uid);
|
|
66055
|
+
return this.$message.warning(message || '文件上传失败');
|
|
66056
|
+
}
|
|
66057
|
+
const random_uid = Math.random();
|
|
66058
|
+
if (this.widget.options.uploadEncrypt) {
|
|
66059
|
+
const fileId = result.fileId;
|
|
66060
|
+
this.dataModel.push({
|
|
66061
|
+
key: file.uid || random_uid,
|
|
66062
|
+
uid: file.uid || random_uid,
|
|
66063
|
+
fileId,
|
|
66064
|
+
url: message,
|
|
66065
|
+
status: 'done',
|
|
66066
|
+
name: result.fileName || file.name
|
|
66067
|
+
});
|
|
66068
|
+
if (this.widget.options.uploadEncrypt) {
|
|
66069
|
+
this.updateStringModel('formFileIds', fileId, 'add');
|
|
66070
|
+
}
|
|
66071
|
+
} else {
|
|
66072
|
+
this.dataModel.push({
|
|
66073
|
+
key: file.uid || random_uid,
|
|
66074
|
+
uid: file.uid || random_uid,
|
|
66075
|
+
url: response.message,
|
|
66076
|
+
status: "done",
|
|
66077
|
+
name: file.name
|
|
66078
|
+
});
|
|
66079
|
+
}
|
|
66080
|
+
},
|
|
62720
66081
|
handleChange({
|
|
62721
66082
|
file,
|
|
62722
66083
|
fileList
|
|
@@ -62732,37 +66093,8 @@ function componentvue_type_script_lang_js_getBase64(file) {
|
|
|
62732
66093
|
}
|
|
62733
66094
|
if (file.status == "done") {
|
|
62734
66095
|
let response = file.response;
|
|
62735
|
-
const
|
|
62736
|
-
|
|
62737
|
-
success,
|
|
62738
|
-
message
|
|
62739
|
-
} = response;
|
|
62740
|
-
if (!success) {
|
|
62741
|
-
this.fileList = this.fileList.filter(item => item.uid !== file.uid);
|
|
62742
|
-
return this.$message.error(message || '文件上传失败');
|
|
62743
|
-
}
|
|
62744
|
-
if (this.widget.options.uploadEncrypt) {
|
|
62745
|
-
const fileId = result.fileId;
|
|
62746
|
-
this.dataModel.push({
|
|
62747
|
-
key: file.uid,
|
|
62748
|
-
uid: file.uid,
|
|
62749
|
-
fileId,
|
|
62750
|
-
url: message,
|
|
62751
|
-
status: 'done',
|
|
62752
|
-
name: result.fileName || file.name
|
|
62753
|
-
});
|
|
62754
|
-
if (this.widget.options.uploadEncrypt) {
|
|
62755
|
-
this.updateStringModel('formFileIds', fileId, 'add');
|
|
62756
|
-
}
|
|
62757
|
-
} else {
|
|
62758
|
-
this.dataModel.push({
|
|
62759
|
-
key: file.uid,
|
|
62760
|
-
uid: file.uid,
|
|
62761
|
-
url: response.message,
|
|
62762
|
-
status: "done",
|
|
62763
|
-
name: file.name
|
|
62764
|
-
});
|
|
62765
|
-
}
|
|
66096
|
+
const flag = this.handleUploadApi(response, file);
|
|
66097
|
+
if (false === flag) return false;
|
|
62766
66098
|
this.updateValidateNotify();
|
|
62767
66099
|
} else if (file.status == "removed") {
|
|
62768
66100
|
let removeFileId = '';
|
|
@@ -62790,10 +66122,10 @@ function componentvue_type_script_lang_js_getBase64(file) {
|
|
|
62790
66122
|
});
|
|
62791
66123
|
;// CONCATENATED MODULE: ./src/form/modules/components/FileUpload/component.vue?vue&type=script&lang=js
|
|
62792
66124
|
/* harmony default export */ const components_FileUpload_componentvue_type_script_lang_js = (FileUpload_componentvue_type_script_lang_js);
|
|
62793
|
-
;// CONCATENATED MODULE: ./node_modules/_mini-css-extract-plugin@2.8.1@mini-css-extract-plugin/dist/loader.js??clonedRuleSet-32.use[0]!./node_modules/_css-loader@6.10.0@css-loader/dist/cjs.js??clonedRuleSet-32.use[1]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/stylePostLoader.js!./node_modules/_postcss-loader@6.2.1@postcss-loader/dist/cjs.js??clonedRuleSet-32.use[2]!./node_modules/_less-loader@5.0.0@less-loader/dist/cjs.js??clonedRuleSet-32.use[3]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/FileUpload/component.vue?vue&type=style&index=0&id=
|
|
66125
|
+
;// CONCATENATED MODULE: ./node_modules/_mini-css-extract-plugin@2.8.1@mini-css-extract-plugin/dist/loader.js??clonedRuleSet-32.use[0]!./node_modules/_css-loader@6.10.0@css-loader/dist/cjs.js??clonedRuleSet-32.use[1]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/stylePostLoader.js!./node_modules/_postcss-loader@6.2.1@postcss-loader/dist/cjs.js??clonedRuleSet-32.use[2]!./node_modules/_less-loader@5.0.0@less-loader/dist/cjs.js??clonedRuleSet-32.use[3]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/FileUpload/component.vue?vue&type=style&index=0&id=5863dfe4&prod&lang=less&scoped=true
|
|
62794
66126
|
// extracted by mini-css-extract-plugin
|
|
62795
66127
|
|
|
62796
|
-
;// CONCATENATED MODULE: ./src/form/modules/components/FileUpload/component.vue?vue&type=style&index=0&id=
|
|
66128
|
+
;// CONCATENATED MODULE: ./src/form/modules/components/FileUpload/component.vue?vue&type=style&index=0&id=5863dfe4&prod&lang=less&scoped=true
|
|
62797
66129
|
|
|
62798
66130
|
;// CONCATENATED MODULE: ./src/form/modules/components/FileUpload/component.vue
|
|
62799
66131
|
|
|
@@ -62806,19 +66138,19 @@ function componentvue_type_script_lang_js_getBase64(file) {
|
|
|
62806
66138
|
|
|
62807
66139
|
var FileUpload_component_component = (0,componentNormalizer/* default */.A)(
|
|
62808
66140
|
components_FileUpload_componentvue_type_script_lang_js,
|
|
62809
|
-
|
|
62810
|
-
|
|
66141
|
+
componentvue_type_template_id_5863dfe4_scoped_true_render,
|
|
66142
|
+
componentvue_type_template_id_5863dfe4_scoped_true_staticRenderFns,
|
|
62811
66143
|
false,
|
|
62812
66144
|
null,
|
|
62813
|
-
"
|
|
66145
|
+
"5863dfe4",
|
|
62814
66146
|
null
|
|
62815
66147
|
|
|
62816
66148
|
)
|
|
62817
66149
|
|
|
62818
66150
|
/* harmony default export */ const FileUpload_component = (FileUpload_component_component.exports);
|
|
62819
|
-
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/FileUpload/widgetSetup.vue?vue&type=template&id=
|
|
62820
|
-
var
|
|
62821
|
-
var
|
|
66151
|
+
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/FileUpload/widgetSetup.vue?vue&type=template&id=02ce2087&scoped=true
|
|
66152
|
+
var widgetSetupvue_type_template_id_02ce2087_scoped_true_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"control"},[_c('div',{staticClass:"form_wrap"},[_c('div',{staticClass:"form"},[_c('a-form-model',[_c('a-form-model-item',{attrs:{"label":"扫码上传"}},[_c('a-switch',{model:{value:(_vm.widget.options.enableQrUpload),callback:function ($$v) {_vm.$set(_vm.widget.options, "enableQrUpload", $$v)},expression:"widget.options.enableQrUpload"}})],1),_c('a-form-model-item',{attrs:{"label":"加密上传"}},[_c('a-switch',{model:{value:(_vm.widget.options.uploadEncrypt),callback:function ($$v) {_vm.$set(_vm.widget.options, "uploadEncrypt", $$v)},expression:"widget.options.uploadEncrypt"}})],1),(_vm.widget.options.uploadEncrypt)?_c('a-form-model-item',{attrs:{"label":"Token解密下载"}},[_c('a-switch',{model:{value:(_vm.widget.options.downloadVerifyToken),callback:function ($$v) {_vm.$set(_vm.widget.options, "downloadVerifyToken", $$v)},expression:"widget.options.downloadVerifyToken"}})],1):_vm._e(),_c('a-form-model-item',{attrs:{"label":"大文件上传"}},[_c('a-switch',{model:{value:(_vm.widget.options.enableBigUpload),callback:function ($$v) {_vm.$set(_vm.widget.options, "enableBigUpload", $$v)},expression:"widget.options.enableBigUpload"}})],1),(_vm.widget.options.enableBigUpload)?_c('a-form-model-item',{attrs:{"label":"大文件上传地址"}},[_c('a-input',{attrs:{"type":"url"},model:{value:(_vm.widget.options.bigUploadUrl),callback:function ($$v) {_vm.$set(_vm.widget.options, "bigUploadUrl", $$v)},expression:"widget.options.bigUploadUrl"}})],1):_vm._e(),_c('a-form-model-item',{attrs:{"label":"允许文件上传类型"}},[_c('a-tooltip',{attrs:{"placement":"top"}},[_c('template',{slot:"title"},[_c('span',[_vm._v("请输入允许上传的文件后缀,多个以逗号隔开")])]),_c('a-input',{model:{value:(_vm.widget.ext),callback:function ($$v) {_vm.$set(_vm.widget, "ext", $$v)},expression:"widget.ext"}})],2)],1),_c('a-form-model-item',{attrs:{"label":"最大上传数"}},[_c('a-input',{model:{value:(_vm.widget.options.length),callback:function ($$v) {_vm.$set(_vm.widget.options, "length", $$v)},expression:"widget.options.length"}})],1),_c('a-form-model-item',{attrs:{"label":"文件上传最大大小kb"}},[_c('a-input',{model:{value:(_vm.widget.options.fileSize),callback:function ($$v) {_vm.$set(_vm.widget.options, "fileSize", $$v)},expression:"widget.options.fileSize"}})],1),_c('a-form-model-item',{attrs:{"label":"文件上传地址"}},[_c('a-input',{model:{value:(_vm.widget.options.action),callback:function ($$v) {_vm.$set(_vm.widget.options, "action", $$v)},expression:"widget.options.action"}})],1)],1)],1)])])}
|
|
66153
|
+
var widgetSetupvue_type_template_id_02ce2087_scoped_true_staticRenderFns = []
|
|
62822
66154
|
|
|
62823
66155
|
|
|
62824
66156
|
;// CONCATENATED MODULE: ./node_modules/_thread-loader@3.0.4@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.3.0@babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/FileUpload/widgetSetup.vue?vue&type=script&lang=js
|
|
@@ -62867,6 +66199,10 @@ var widgetSetupvue_type_template_id_6479436c_scoped_true_staticRenderFns = []
|
|
|
62867
66199
|
//
|
|
62868
66200
|
//
|
|
62869
66201
|
//
|
|
66202
|
+
//
|
|
66203
|
+
//
|
|
66204
|
+
//
|
|
66205
|
+
//
|
|
62870
66206
|
|
|
62871
66207
|
/* harmony default export */ const FileUpload_widgetSetupvue_type_script_lang_js = ({
|
|
62872
66208
|
name: "widgetSetup",
|
|
@@ -62910,25 +66246,25 @@ var widgetSetupvue_type_template_id_6479436c_scoped_true_staticRenderFns = []
|
|
|
62910
66246
|
;
|
|
62911
66247
|
var FileUpload_widgetSetup_component = (0,componentNormalizer/* default */.A)(
|
|
62912
66248
|
components_FileUpload_widgetSetupvue_type_script_lang_js,
|
|
62913
|
-
|
|
62914
|
-
|
|
66249
|
+
widgetSetupvue_type_template_id_02ce2087_scoped_true_render,
|
|
66250
|
+
widgetSetupvue_type_template_id_02ce2087_scoped_true_staticRenderFns,
|
|
62915
66251
|
false,
|
|
62916
66252
|
null,
|
|
62917
|
-
"
|
|
66253
|
+
"02ce2087",
|
|
62918
66254
|
null
|
|
62919
66255
|
|
|
62920
66256
|
)
|
|
62921
66257
|
|
|
62922
66258
|
/* harmony default export */ const FileUpload_widgetSetup = (FileUpload_widgetSetup_component.exports);
|
|
62923
|
-
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/FileUpload/widgetDesign.vue?vue&type=template&id=
|
|
62924
|
-
var
|
|
62925
|
-
|
|
62926
|
-
|
|
62927
|
-
|
|
62928
|
-
|
|
62929
|
-
|
|
62930
|
-
|
|
62931
|
-
var
|
|
66259
|
+
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/FileUpload/widgetDesign.vue?vue&type=template&id=4cdf0f72&scoped=true
|
|
66260
|
+
var widgetDesignvue_type_template_id_4cdf0f72_scoped_true_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.widget)?_c('div',{staticClass:"custom_form_item",style:({ height: _vm.widget.options.height + 'px' })},[_c('a-form-model-item',{attrs:{"colon":false,"label-col":_vm.labelCol,"wrapperCol":_vm.wrapperCol}},[(_vm.widget.options.labelWidth !== 0)?_c('div',{class:[
|
|
66261
|
+
_vm.config.align,
|
|
66262
|
+
_vm.config.validate === true && _vm.widget.options.required === true
|
|
66263
|
+
? 'is_required'
|
|
66264
|
+
: 'no_required' ],style:({
|
|
66265
|
+
color: _vm.config.color,
|
|
66266
|
+
}),attrs:{"slot":"label"},slot:"label"},[_vm._v(" "+_vm._s(_vm.widget.name)+" ")]):_vm._e(),_c('drag-upload',{staticStyle:{"margin":"10px 0"},attrs:{"placeholder":_vm.widget.options.placeholder,"disabled":true,"QrUpload":_vm.widget.options.enableQrUpload}})],1)],1):_vm._e()}
|
|
66267
|
+
var widgetDesignvue_type_template_id_4cdf0f72_scoped_true_staticRenderFns = []
|
|
62932
66268
|
|
|
62933
66269
|
|
|
62934
66270
|
;// CONCATENATED MODULE: ./node_modules/_thread-loader@3.0.4@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.3.0@babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/FileUpload/widgetDesign.vue?vue&type=script&lang=js
|
|
@@ -62965,6 +66301,9 @@ var widgetDesignvue_type_template_id_68214d77_scoped_true_staticRenderFns = []
|
|
|
62965
66301
|
//
|
|
62966
66302
|
//
|
|
62967
66303
|
//
|
|
66304
|
+
//
|
|
66305
|
+
//
|
|
66306
|
+
|
|
62968
66307
|
|
|
62969
66308
|
|
|
62970
66309
|
/* harmony default export */ const FileUpload_widgetDesignvue_type_script_lang_js = ({
|
|
@@ -62986,7 +66325,9 @@ var widgetDesignvue_type_template_id_68214d77_scoped_true_staticRenderFns = []
|
|
|
62986
66325
|
fileList: []
|
|
62987
66326
|
};
|
|
62988
66327
|
},
|
|
62989
|
-
components: {
|
|
66328
|
+
components: {
|
|
66329
|
+
DragUpload: dragUpload
|
|
66330
|
+
},
|
|
62990
66331
|
inject: ["config"],
|
|
62991
66332
|
watch: {
|
|
62992
66333
|
value(oldval, newval) {
|
|
@@ -63001,10 +66342,10 @@ var widgetDesignvue_type_template_id_68214d77_scoped_true_staticRenderFns = []
|
|
|
63001
66342
|
});
|
|
63002
66343
|
;// CONCATENATED MODULE: ./src/form/modules/components/FileUpload/widgetDesign.vue?vue&type=script&lang=js
|
|
63003
66344
|
/* harmony default export */ const components_FileUpload_widgetDesignvue_type_script_lang_js = (FileUpload_widgetDesignvue_type_script_lang_js);
|
|
63004
|
-
;// CONCATENATED MODULE: ./node_modules/_mini-css-extract-plugin@2.8.1@mini-css-extract-plugin/dist/loader.js??clonedRuleSet-32.use[0]!./node_modules/_css-loader@6.10.0@css-loader/dist/cjs.js??clonedRuleSet-32.use[1]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/stylePostLoader.js!./node_modules/_postcss-loader@6.2.1@postcss-loader/dist/cjs.js??clonedRuleSet-32.use[2]!./node_modules/_less-loader@5.0.0@less-loader/dist/cjs.js??clonedRuleSet-32.use[3]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/FileUpload/widgetDesign.vue?vue&type=style&index=0&id=
|
|
66345
|
+
;// CONCATENATED MODULE: ./node_modules/_mini-css-extract-plugin@2.8.1@mini-css-extract-plugin/dist/loader.js??clonedRuleSet-32.use[0]!./node_modules/_css-loader@6.10.0@css-loader/dist/cjs.js??clonedRuleSet-32.use[1]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/loaders/stylePostLoader.js!./node_modules/_postcss-loader@6.2.1@postcss-loader/dist/cjs.js??clonedRuleSet-32.use[2]!./node_modules/_less-loader@5.0.0@less-loader/dist/cjs.js??clonedRuleSet-32.use[3]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/components/FileUpload/widgetDesign.vue?vue&type=style&index=0&id=4cdf0f72&prod&lang=less&scoped=true
|
|
63005
66346
|
// extracted by mini-css-extract-plugin
|
|
63006
66347
|
|
|
63007
|
-
;// CONCATENATED MODULE: ./src/form/modules/components/FileUpload/widgetDesign.vue?vue&type=style&index=0&id=
|
|
66348
|
+
;// CONCATENATED MODULE: ./src/form/modules/components/FileUpload/widgetDesign.vue?vue&type=style&index=0&id=4cdf0f72&prod&lang=less&scoped=true
|
|
63008
66349
|
|
|
63009
66350
|
;// CONCATENATED MODULE: ./src/form/modules/components/FileUpload/widgetDesign.vue
|
|
63010
66351
|
|
|
@@ -63017,11 +66358,11 @@ var widgetDesignvue_type_template_id_68214d77_scoped_true_staticRenderFns = []
|
|
|
63017
66358
|
|
|
63018
66359
|
var FileUpload_widgetDesign_component = (0,componentNormalizer/* default */.A)(
|
|
63019
66360
|
components_FileUpload_widgetDesignvue_type_script_lang_js,
|
|
63020
|
-
|
|
63021
|
-
|
|
66361
|
+
widgetDesignvue_type_template_id_4cdf0f72_scoped_true_render,
|
|
66362
|
+
widgetDesignvue_type_template_id_4cdf0f72_scoped_true_staticRenderFns,
|
|
63022
66363
|
false,
|
|
63023
66364
|
null,
|
|
63024
|
-
"
|
|
66365
|
+
"4cdf0f72",
|
|
63025
66366
|
null
|
|
63026
66367
|
|
|
63027
66368
|
)
|
|
@@ -78086,6 +81427,7 @@ function encry_http_v1(config) {
|
|
|
78086
81427
|
__webpack_require__.r(__webpack_exports__);
|
|
78087
81428
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
78088
81429
|
/* harmony export */ filterObj: () => (/* binding */ filterObj),
|
|
81430
|
+
/* harmony export */ generateRandomString: () => (/* binding */ generateRandomString),
|
|
78089
81431
|
/* harmony export */ getImageSize: () => (/* binding */ getImageSize),
|
|
78090
81432
|
/* harmony export */ getQueryParam: () => (/* binding */ getQueryParam),
|
|
78091
81433
|
/* harmony export */ hexToRgb: () => (/* binding */ hexToRgb),
|
|
@@ -78112,7 +81454,15 @@ function filterObj(obj) {
|
|
|
78112
81454
|
}
|
|
78113
81455
|
return obj;
|
|
78114
81456
|
}
|
|
78115
|
-
|
|
81457
|
+
function generateRandomString(length) {
|
|
81458
|
+
let result = '';
|
|
81459
|
+
let characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
81460
|
+
let charactersLength = characters.length;
|
|
81461
|
+
for (let i = 0; i < length; i++) {
|
|
81462
|
+
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
81463
|
+
}
|
|
81464
|
+
return result;
|
|
81465
|
+
}
|
|
78116
81466
|
/**
|
|
78117
81467
|
* 判断值是否为空
|
|
78118
81468
|
* @author 徐睿
|
|
@@ -93673,8 +97023,8 @@ var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._sel
|
|
|
93673
97023
|
var staticRenderFns = []
|
|
93674
97024
|
|
|
93675
97025
|
|
|
93676
|
-
// EXTERNAL MODULE: ./src/form/modules/components/index.js +
|
|
93677
|
-
var components = __webpack_require__(
|
|
97026
|
+
// EXTERNAL MODULE: ./src/form/modules/components/index.js + 910 modules
|
|
97027
|
+
var components = __webpack_require__(5893);
|
|
93678
97028
|
;// CONCATENATED MODULE: ./node_modules/_thread-loader@3.0.4@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.3.0@babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/_vue-loader@15.11.1@vue-loader/lib/index.js??vue-loader-options!./src/form/modules/common/Modals/CorrectionItem.vue?vue&type=script&lang=js
|
|
93679
97029
|
//
|
|
93680
97030
|
//
|
|
@@ -95030,8 +98380,8 @@ var component = (0,componentNormalizer/* default */.A)(
|
|
|
95030
98380
|
)
|
|
95031
98381
|
|
|
95032
98382
|
/* harmony default export */ const CorrectionModal = (component.exports);
|
|
95033
|
-
// EXTERNAL MODULE: ./src/form/modules/components/index.js +
|
|
95034
|
-
var components = __webpack_require__(
|
|
98383
|
+
// EXTERNAL MODULE: ./src/form/modules/components/index.js + 910 modules
|
|
98384
|
+
var components = __webpack_require__(5893);
|
|
95035
98385
|
// EXTERNAL MODULE: ./node_modules/_pubsub-js@1.9.4@pubsub-js/src/pubsub.js
|
|
95036
98386
|
var pubsub = __webpack_require__(1528);
|
|
95037
98387
|
var pubsub_default = /*#__PURE__*/__webpack_require__.n(pubsub);
|
|
@@ -96169,8 +99519,8 @@ var vuedraggable_umd = __webpack_require__(9715);
|
|
|
96169
99519
|
var vuedraggable_umd_default = /*#__PURE__*/__webpack_require__.n(vuedraggable_umd);
|
|
96170
99520
|
// EXTERNAL MODULE: ./src/api/manage.js
|
|
96171
99521
|
var manage = __webpack_require__(8501);
|
|
96172
|
-
// EXTERNAL MODULE: ./src/form/modules/components/index.js +
|
|
96173
|
-
var components = __webpack_require__(
|
|
99522
|
+
// EXTERNAL MODULE: ./src/form/modules/components/index.js + 910 modules
|
|
99523
|
+
var components = __webpack_require__(5893);
|
|
96174
99524
|
// EXTERNAL MODULE: ./src/form/util/Bus.js
|
|
96175
99525
|
var Bus = __webpack_require__(1509);
|
|
96176
99526
|
// EXTERNAL MODULE: ./src/form/modules/config/hnkj.js
|
|
@@ -108016,7 +111366,7 @@ function keys(object) {
|
|
|
108016
111366
|
/***/ ((module) => {
|
|
108017
111367
|
|
|
108018
111368
|
"use strict";
|
|
108019
|
-
module.exports = {"rE":"1.1.
|
|
111369
|
+
module.exports = /*#__PURE__*/JSON.parse('{"rE":"1.1.307-upload.10"}');
|
|
108020
111370
|
|
|
108021
111371
|
/***/ })
|
|
108022
111372
|
|
|
@@ -108174,6 +111524,8 @@ var aesEncrypt = __webpack_require__(6151);
|
|
|
108174
111524
|
encry_http_v1: encry_http/* encry_http_v1 */.B,
|
|
108175
111525
|
encryption_v1: aesEncrypt/* encryption_v1 */.i_
|
|
108176
111526
|
});
|
|
111527
|
+
// EXTERNAL MODULE: ./node_modules/_qrcode@1.5.3@qrcode/lib/browser.js
|
|
111528
|
+
var browser = __webpack_require__(2109);
|
|
108177
111529
|
// EXTERNAL MODULE: ./node_modules/_babel-helper-vue-jsx-merge-props@2.0.3@babel-helper-vue-jsx-merge-props/index.js
|
|
108178
111530
|
var _babel_helper_vue_jsx_merge_props_2_0_3_babel_helper_vue_jsx_merge_props = __webpack_require__(6051);
|
|
108179
111531
|
var _babel_helper_vue_jsx_merge_props_2_0_3_babel_helper_vue_jsx_merge_props_default = /*#__PURE__*/__webpack_require__.n(_babel_helper_vue_jsx_merge_props_2_0_3_babel_helper_vue_jsx_merge_props);
|
|
@@ -110431,7 +113783,7 @@ const advanceComponents = [{
|
|
|
110431
113783
|
// },
|
|
110432
113784
|
{
|
|
110433
113785
|
type: 'imgupload',
|
|
110434
|
-
name: '图片上传',
|
|
113786
|
+
name: '图片上传(旧)',
|
|
110435
113787
|
icon: 'icon-tupian',
|
|
110436
113788
|
key: 'uploadFile',
|
|
110437
113789
|
ext: '.jpg,.jpeg,.png,.gif,.zip',
|
|
@@ -110463,6 +113815,42 @@ const advanceComponents = [{
|
|
|
110463
113815
|
defaulcanView: true,
|
|
110464
113816
|
canView: true
|
|
110465
113817
|
}
|
|
113818
|
+
}, {
|
|
113819
|
+
type: 'imgupload',
|
|
113820
|
+
name: '图片上传',
|
|
113821
|
+
icon: 'icon-tupian',
|
|
113822
|
+
key: 'uploadFile',
|
|
113823
|
+
ext: '.jpg,.jpeg,.png,.gif,.zip',
|
|
113824
|
+
options: {
|
|
113825
|
+
defaultValue: [],
|
|
113826
|
+
size: {
|
|
113827
|
+
width: 100,
|
|
113828
|
+
height: 100
|
|
113829
|
+
},
|
|
113830
|
+
relateOptions: [],
|
|
113831
|
+
uploadStyle: '1',
|
|
113832
|
+
// 新版图片上传 UI
|
|
113833
|
+
placeholder: '拖拽或者单击后粘贴图片',
|
|
113834
|
+
fileSize: 300,
|
|
113835
|
+
//文件大小 size kb
|
|
113836
|
+
width: '',
|
|
113837
|
+
tokenFunc: 'funcGetToken',
|
|
113838
|
+
token: '',
|
|
113839
|
+
height: 60,
|
|
113840
|
+
defauldisabled: false,
|
|
113841
|
+
disabled: false,
|
|
113842
|
+
length: 1,
|
|
113843
|
+
multiple: false,
|
|
113844
|
+
isQiniu: false,
|
|
113845
|
+
isDelete: true,
|
|
113846
|
+
min: 0,
|
|
113847
|
+
isEdit: false,
|
|
113848
|
+
action: '/sys/common/upload',
|
|
113849
|
+
canEdit: true,
|
|
113850
|
+
canCorrect: true,
|
|
113851
|
+
defaulcanView: true,
|
|
113852
|
+
canView: true
|
|
113853
|
+
}
|
|
110466
113854
|
}, {
|
|
110467
113855
|
type: 'fileupload',
|
|
110468
113856
|
name: '文件上传',
|
|
@@ -110480,7 +113868,7 @@ const advanceComponents = [{
|
|
|
110480
113868
|
bigUploadUrl: '/goFast/big/upload/',
|
|
110481
113869
|
defauldisabled: false,
|
|
110482
113870
|
disabled: false,
|
|
110483
|
-
placeholder: '
|
|
113871
|
+
placeholder: '拖拽或者单击后粘贴文件',
|
|
110484
113872
|
length: 8,
|
|
110485
113873
|
multiple: false,
|
|
110486
113874
|
isQiniu: false,
|
|
@@ -111307,8 +114695,8 @@ var es_array_push = __webpack_require__(5337);
|
|
|
111307
114695
|
var es_array_sort = __webpack_require__(5833);
|
|
111308
114696
|
// EXTERNAL MODULE: ./src/form/util/util.js
|
|
111309
114697
|
var util = __webpack_require__(4063);
|
|
111310
|
-
// EXTERNAL MODULE: ./src/form/modules/components/index.js +
|
|
111311
|
-
var components = __webpack_require__(
|
|
114698
|
+
// EXTERNAL MODULE: ./src/form/modules/components/index.js + 910 modules
|
|
114699
|
+
var components = __webpack_require__(5893);
|
|
111312
114700
|
// EXTERNAL MODULE: ./src/api/manage.js
|
|
111313
114701
|
var manage = __webpack_require__(8501);
|
|
111314
114702
|
// EXTERNAL MODULE: ./src/form/modules/widgetFormItem.vue + 6 modules
|
|
@@ -116733,7 +120121,7 @@ class InterceptorManager {
|
|
|
116733
120121
|
|
|
116734
120122
|
|
|
116735
120123
|
|
|
116736
|
-
/* harmony default export */ const
|
|
120124
|
+
/* harmony default export */ const platform_browser = ({
|
|
116737
120125
|
isBrowser: true,
|
|
116738
120126
|
classes: {
|
|
116739
120127
|
URLSearchParams: classes_URLSearchParams,
|
|
@@ -116794,7 +120182,7 @@ const hasStandardBrowserWebWorkerEnv = (() => {
|
|
|
116794
120182
|
|
|
116795
120183
|
/* harmony default export */ const platform = ({
|
|
116796
120184
|
...common_utils_namespaceObject,
|
|
116797
|
-
...
|
|
120185
|
+
...platform_browser
|
|
116798
120186
|
});
|
|
116799
120187
|
|
|
116800
120188
|
;// CONCATENATED MODULE: ./node_modules/_axios@1.6.8@axios/lib/helpers/toURLEncodedForm.js
|
|
@@ -121800,6 +125188,8 @@ var warpFormulaEdit_component = (0,componentNormalizer/* default */.A)(
|
|
|
121800
125188
|
;// CONCATENATED MODULE: ./src/main.js
|
|
121801
125189
|
|
|
121802
125190
|
|
|
125191
|
+
|
|
125192
|
+
console.log(window.QRCode = browser);
|
|
121803
125193
|
const version = (__webpack_require__(8330)/* .version */ .rE);
|
|
121804
125194
|
|
|
121805
125195
|
window.formVersion = version;
|
|
@@ -121823,7 +125213,8 @@ const main_components = [layoutForPaper["default"], Container, layoutItem["defau
|
|
|
121823
125213
|
const main_install = function (Vue, opts = {}, router = undefined) {
|
|
121824
125214
|
window.addEventListener("load", () => {
|
|
121825
125215
|
const IconFont = icon.createFromIconfontCN({
|
|
121826
|
-
|
|
125216
|
+
// iconfont 项目名称: oshall
|
|
125217
|
+
scriptUrl: '//at.alicdn.com/t/c/font_4407909_1em2rh2i65p.js' // 在 iconfont.cn 上生成
|
|
121827
125218
|
});
|
|
121828
125219
|
Vue.component('form-iconfont', IconFont);
|
|
121829
125220
|
});
|