@windwalker-io/unicorn-next 0.1.19 → 0.1.21
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/chunks/_arrayPush.js +325 -108
- package/dist/chunks/_arrayPush.js.map +1 -1
- package/dist/chunks/_baseRest.js +155 -60
- package/dist/chunks/_baseRest.js.map +1 -1
- package/dist/chunks/_baseUnary.js +463 -0
- package/dist/chunks/_baseUnary.js.map +1 -0
- package/dist/chunks/_getPrototype.js +292 -100
- package/dist/chunks/_getPrototype.js.map +1 -1
- package/dist/chunks/alert-adapter.js +29 -0
- package/dist/chunks/alert-adapter.js.map +1 -0
- package/dist/chunks/alert.js +21 -0
- package/dist/chunks/alert.js.map +1 -0
- package/dist/chunks/arr.js +24 -0
- package/dist/chunks/arr.js.map +1 -0
- package/dist/chunks/button-radio.js +127 -145
- package/dist/chunks/button-radio.js.map +1 -1
- package/dist/chunks/checkboxes-multi-select.js +44 -43
- package/dist/chunks/checkboxes-multi-select.js.map +1 -1
- package/dist/chunks/chunk.js +24 -0
- package/dist/chunks/cloneDeep.js +679 -212
- package/dist/chunks/cloneDeep.js.map +1 -1
- package/dist/chunks/cropper.min.js +6 -5
- package/dist/chunks/cropper.min.js.map +1 -1
- package/dist/chunks/crypto.js +26 -0
- package/dist/chunks/crypto.js.map +1 -0
- package/dist/chunks/data.js +49 -0
- package/dist/chunks/data.js.map +1 -0
- package/dist/chunks/dom.js +128 -0
- package/dist/chunks/dom.js.map +1 -0
- package/dist/chunks/events.js +270 -0
- package/dist/chunks/events.js.map +1 -0
- package/dist/chunks/field-cascade-select.js +207 -250
- package/dist/chunks/field-cascade-select.js.map +1 -1
- package/dist/chunks/field-file-drag.js +175 -209
- package/dist/chunks/field-file-drag.js.map +1 -1
- package/dist/chunks/field-flatpickr.js +94 -898
- package/dist/chunks/field-flatpickr.js.map +1 -1
- package/dist/chunks/field-modal-select.js +728 -467
- package/dist/chunks/field-modal-select.js.map +1 -1
- package/dist/chunks/field-modal-tree.js +771 -766
- package/dist/chunks/field-modal-tree.js.map +1 -1
- package/dist/chunks/field-multi-uploader.js +249 -256
- package/dist/chunks/field-multi-uploader.js.map +1 -1
- package/dist/chunks/field-repeatable.js +111 -127
- package/dist/chunks/field-repeatable.js.map +1 -1
- package/dist/chunks/field-single-image-drag.js +286 -338
- package/dist/chunks/field-single-image-drag.js.map +1 -1
- package/dist/chunks/form.js +146 -159
- package/dist/chunks/form.js.map +1 -1
- package/dist/chunks/grid.js +349 -418
- package/dist/chunks/grid.js.map +1 -1
- package/dist/chunks/helper.js +39 -0
- package/dist/chunks/helper.js.map +1 -0
- package/dist/chunks/http-client.js +221 -211
- package/dist/chunks/http-client.js.map +1 -1
- package/dist/chunks/iframe-modal.js +95 -115
- package/dist/chunks/iframe-modal.js.map +1 -1
- package/dist/chunks/keep-tab.js +92 -101
- package/dist/chunks/keep-tab.js.map +1 -1
- package/dist/chunks/lang.js +250 -0
- package/dist/chunks/lang.js.map +1 -0
- package/dist/chunks/legacy.js +197 -201
- package/dist/chunks/legacy.js.map +1 -1
- package/dist/chunks/list-dependent.js +195 -228
- package/dist/chunks/list-dependent.js.map +1 -1
- package/dist/chunks/loader.js +106 -0
- package/dist/chunks/loader.js.map +1 -0
- package/dist/chunks/monthSelect.js +251 -0
- package/dist/chunks/monthSelect.js.map +1 -0
- package/dist/chunks/router.js +111 -0
- package/dist/chunks/router.js.map +1 -0
- package/dist/chunks/s3-multipart-uploader.js +183 -210
- package/dist/chunks/s3-multipart-uploader.js.map +1 -1
- package/dist/chunks/s3-uploader.js +106 -128
- package/dist/chunks/s3-uploader.js.map +1 -1
- package/dist/chunks/show-on.js +358 -205
- package/dist/chunks/show-on.js.map +1 -1
- package/dist/chunks/timing.js +10 -0
- package/dist/chunks/timing.js.map +1 -0
- package/dist/chunks/tinymce.js +153 -203
- package/dist/chunks/tinymce.js.map +1 -1
- package/dist/chunks/ui-bootstrap5.js +58 -72
- package/dist/chunks/ui-bootstrap5.js.map +1 -1
- package/dist/chunks/ui.js +320 -0
- package/dist/chunks/ui.js.map +1 -0
- package/dist/chunks/unicorn.js.map +1 -1
- package/dist/chunks/useQueue.js +111 -0
- package/dist/chunks/useQueue.js.map +1 -0
- package/dist/chunks/useStack.js +76 -0
- package/dist/chunks/useStack.js.map +1 -0
- package/dist/chunks/validation.js +761 -853
- package/dist/chunks/validation.js.map +1 -1
- package/dist/editor.css +1 -1
- package/dist/index.d.ts +10 -8
- package/dist/multi-level-menu.css +1 -1
- package/dist/switcher.css +1 -1
- package/dist/unicorn.js +805 -130
- package/dist/unicorn.js.map +1 -1
- package/package.json +3 -3
- package/src/composable/useBsModalAlert.ts +29 -0
- package/src/composable/useHttp.ts +13 -1
- package/src/module/s3-uploader.ts +1 -1
- package/vite.config.ts +5 -1
- package/dist/chunks/_commonjsHelpers.js +0 -7
- package/dist/chunks/index.js +0 -314
- package/dist/chunks/isArguments.js +0 -146
- package/dist/chunks/unicorn.js +0 -2621
|
@@ -1,516 +1,777 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { t as data } from "./data.js";
|
|
2
|
+
import { d as selectOne, o as html } from "./dom.js";
|
|
3
|
+
import { a as highlight, m as slideUp } from "./ui.js";
|
|
4
|
+
import { r as simpleAlert } from "./alert.js";
|
|
5
|
+
import { a as eq, d as isObjectLike, f as baseGetTag, l as isObject, p as Symbol, r as isArrayLike, u as isArray } from "./_baseUnary.js";
|
|
6
|
+
import { n as apply, r as arrayMap, t as baseRest } from "./_baseRest.js";
|
|
7
|
+
import { l as isIndex, n as keys, s as copyObject, t as getPrototype, u as arrayEach } from "./_getPrototype.js";
|
|
8
|
+
import { t as __ } from "./lang.js";
|
|
9
|
+
//#region ../../../../node_modules/lodash-es/isSymbol.js
|
|
10
|
+
/** `Object#toString` result references. */
|
|
5
11
|
var symbolTag = "[object Symbol]";
|
|
12
|
+
/**
|
|
13
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
14
|
+
*
|
|
15
|
+
* @static
|
|
16
|
+
* @memberOf _
|
|
17
|
+
* @since 4.0.0
|
|
18
|
+
* @category Lang
|
|
19
|
+
* @param {*} value The value to check.
|
|
20
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
21
|
+
* @example
|
|
22
|
+
*
|
|
23
|
+
* _.isSymbol(Symbol.iterator);
|
|
24
|
+
* // => true
|
|
25
|
+
*
|
|
26
|
+
* _.isSymbol('abc');
|
|
27
|
+
* // => false
|
|
28
|
+
*/
|
|
6
29
|
function isSymbol(value) {
|
|
7
|
-
|
|
30
|
+
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
8
31
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region ../../../../node_modules/lodash-es/_baseToString.js
|
|
34
|
+
/** Used as references for various `Number` constants. */
|
|
35
|
+
var INFINITY = Infinity;
|
|
36
|
+
/** Used to convert symbols to primitives and strings. */
|
|
37
|
+
var symbolProto = Symbol ? Symbol.prototype : void 0, symbolToString = symbolProto ? symbolProto.toString : void 0;
|
|
38
|
+
/**
|
|
39
|
+
* The base implementation of `_.toString` which doesn't convert nullish
|
|
40
|
+
* values to empty strings.
|
|
41
|
+
*
|
|
42
|
+
* @private
|
|
43
|
+
* @param {*} value The value to process.
|
|
44
|
+
* @returns {string} Returns the string.
|
|
45
|
+
*/
|
|
17
46
|
function baseToString(value) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
if (isSymbol(value)) {
|
|
25
|
-
return symbolToString ? symbolToString.call(value) : "";
|
|
26
|
-
}
|
|
27
|
-
var result = value + "";
|
|
28
|
-
return result == "0" && 1 / value == -Infinity ? "-0" : result;
|
|
29
|
-
}
|
|
30
|
-
function copyObject(source, props, object, customizer) {
|
|
31
|
-
var isNew = !object;
|
|
32
|
-
object || (object = {});
|
|
33
|
-
var index = -1, length = props.length;
|
|
34
|
-
while (++index < length) {
|
|
35
|
-
var key = props[index];
|
|
36
|
-
var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
|
|
37
|
-
if (newValue === void 0) {
|
|
38
|
-
newValue = source[key];
|
|
39
|
-
}
|
|
40
|
-
if (isNew) {
|
|
41
|
-
baseAssignValue(object, key, newValue);
|
|
42
|
-
} else {
|
|
43
|
-
assignValue(object, key, newValue);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return object;
|
|
47
|
+
if (typeof value == "string") return value;
|
|
48
|
+
if (isArray(value)) return arrayMap(value, baseToString) + "";
|
|
49
|
+
if (isSymbol(value)) return symbolToString ? symbolToString.call(value) : "";
|
|
50
|
+
var result = value + "";
|
|
51
|
+
return result == "0" && 1 / value == -INFINITY ? "-0" : result;
|
|
47
52
|
}
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region ../../../../node_modules/lodash-es/_isIterateeCall.js
|
|
55
|
+
/**
|
|
56
|
+
* Checks if the given arguments are from an iteratee call.
|
|
57
|
+
*
|
|
58
|
+
* @private
|
|
59
|
+
* @param {*} value The potential iteratee value argument.
|
|
60
|
+
* @param {*} index The potential iteratee index or key argument.
|
|
61
|
+
* @param {*} object The potential iteratee object argument.
|
|
62
|
+
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
|
|
63
|
+
* else `false`.
|
|
64
|
+
*/
|
|
48
65
|
function isIterateeCall(value, index, object) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
|
|
54
|
-
return eq(object[index], value);
|
|
55
|
-
}
|
|
56
|
-
return false;
|
|
66
|
+
if (!isObject(object)) return false;
|
|
67
|
+
var type = typeof index;
|
|
68
|
+
if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) return eq(object[index], value);
|
|
69
|
+
return false;
|
|
57
70
|
}
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region ../../../../node_modules/lodash-es/_createAssigner.js
|
|
73
|
+
/**
|
|
74
|
+
* Creates a function like `_.assign`.
|
|
75
|
+
*
|
|
76
|
+
* @private
|
|
77
|
+
* @param {Function} assigner The function to assign values.
|
|
78
|
+
* @returns {Function} Returns the new assigner function.
|
|
79
|
+
*/
|
|
58
80
|
function createAssigner(assigner) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return object;
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
function nativeKeysIn(object) {
|
|
77
|
-
var result = [];
|
|
78
|
-
if (object != null) {
|
|
79
|
-
for (var key in Object(object)) {
|
|
80
|
-
result.push(key);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return result;
|
|
84
|
-
}
|
|
85
|
-
var objectProto$3 = /* @__PURE__ */ (() => Object.prototype)();
|
|
86
|
-
var hasOwnProperty$3 = /* @__PURE__ */ (() => objectProto$3.hasOwnProperty)();
|
|
87
|
-
function baseKeysIn(object) {
|
|
88
|
-
if (!isObject(object)) {
|
|
89
|
-
return nativeKeysIn(object);
|
|
90
|
-
}
|
|
91
|
-
var isProto = isPrototype(object), result = [];
|
|
92
|
-
for (var key in object) {
|
|
93
|
-
if (!(key == "constructor" && (isProto || !hasOwnProperty$3.call(object, key)))) {
|
|
94
|
-
result.push(key);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return result;
|
|
98
|
-
}
|
|
99
|
-
function keysIn(object) {
|
|
100
|
-
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
|
81
|
+
return baseRest(function(object, sources) {
|
|
82
|
+
var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
|
|
83
|
+
customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
|
|
84
|
+
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
|
85
|
+
customizer = length < 3 ? void 0 : customizer;
|
|
86
|
+
length = 1;
|
|
87
|
+
}
|
|
88
|
+
object = Object(object);
|
|
89
|
+
while (++index < length) {
|
|
90
|
+
var source = sources[index];
|
|
91
|
+
if (source) assigner(object, source, index, customizer);
|
|
92
|
+
}
|
|
93
|
+
return object;
|
|
94
|
+
});
|
|
101
95
|
}
|
|
102
|
-
|
|
103
|
-
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region ../../../../node_modules/lodash-es/assignWith.js
|
|
98
|
+
/**
|
|
99
|
+
* This method is like `_.assign` except that it accepts `customizer`
|
|
100
|
+
* which is invoked to produce the assigned values. If `customizer` returns
|
|
101
|
+
* `undefined`, assignment is handled by the method instead. The `customizer`
|
|
102
|
+
* is invoked with five arguments: (objValue, srcValue, key, object, source).
|
|
103
|
+
*
|
|
104
|
+
* **Note:** This method mutates `object`.
|
|
105
|
+
*
|
|
106
|
+
* @static
|
|
107
|
+
* @memberOf _
|
|
108
|
+
* @since 4.0.0
|
|
109
|
+
* @category Object
|
|
110
|
+
* @param {Object} object The destination object.
|
|
111
|
+
* @param {...Object} sources The source objects.
|
|
112
|
+
* @param {Function} [customizer] The function to customize assigned values.
|
|
113
|
+
* @returns {Object} Returns `object`.
|
|
114
|
+
* @see _.assignInWith
|
|
115
|
+
* @example
|
|
116
|
+
*
|
|
117
|
+
* function customizer(objValue, srcValue) {
|
|
118
|
+
* return _.isUndefined(objValue) ? srcValue : objValue;
|
|
119
|
+
* }
|
|
120
|
+
*
|
|
121
|
+
* var defaults = _.partialRight(_.assignWith, customizer);
|
|
122
|
+
*
|
|
123
|
+
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
|
124
|
+
* // => { 'a': 1, 'b': 2 }
|
|
125
|
+
*/
|
|
126
|
+
var assignWith = /* @__PURE__ */ createAssigner(function(object, source, srcIndex, customizer) {
|
|
127
|
+
copyObject(source, keys(source), object, customizer);
|
|
104
128
|
});
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region ../../../../node_modules/lodash-es/toString.js
|
|
131
|
+
/**
|
|
132
|
+
* Converts `value` to a string. An empty string is returned for `null`
|
|
133
|
+
* and `undefined` values. The sign of `-0` is preserved.
|
|
134
|
+
*
|
|
135
|
+
* @static
|
|
136
|
+
* @memberOf _
|
|
137
|
+
* @since 4.0.0
|
|
138
|
+
* @category Lang
|
|
139
|
+
* @param {*} value The value to convert.
|
|
140
|
+
* @returns {string} Returns the converted string.
|
|
141
|
+
* @example
|
|
142
|
+
*
|
|
143
|
+
* _.toString(null);
|
|
144
|
+
* // => ''
|
|
145
|
+
*
|
|
146
|
+
* _.toString(-0);
|
|
147
|
+
* // => '-0'
|
|
148
|
+
*
|
|
149
|
+
* _.toString([1, 2, 3]);
|
|
150
|
+
* // => '1,2,3'
|
|
151
|
+
*/
|
|
105
152
|
function toString(value) {
|
|
106
|
-
|
|
153
|
+
return value == null ? "" : baseToString(value);
|
|
107
154
|
}
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region ../../../../node_modules/lodash-es/isPlainObject.js
|
|
157
|
+
/** `Object#toString` result references. */
|
|
108
158
|
var objectTag = "[object Object]";
|
|
109
|
-
|
|
110
|
-
var
|
|
111
|
-
|
|
159
|
+
/** Used for built-in method references. */
|
|
160
|
+
var funcProto = Function.prototype, objectProto$1 = Object.prototype;
|
|
161
|
+
/** Used to resolve the decompiled source of functions. */
|
|
162
|
+
var funcToString = funcProto.toString;
|
|
163
|
+
/** Used to check objects for own properties. */
|
|
164
|
+
var hasOwnProperty$2 = objectProto$1.hasOwnProperty;
|
|
165
|
+
/** Used to infer the `Object` constructor. */
|
|
112
166
|
var objectCtorString = /* @__PURE__ */ funcToString.call(Object);
|
|
167
|
+
/**
|
|
168
|
+
* Checks if `value` is a plain object, that is, an object created by the
|
|
169
|
+
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
|
170
|
+
*
|
|
171
|
+
* @static
|
|
172
|
+
* @memberOf _
|
|
173
|
+
* @since 0.8.0
|
|
174
|
+
* @category Lang
|
|
175
|
+
* @param {*} value The value to check.
|
|
176
|
+
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
|
177
|
+
* @example
|
|
178
|
+
*
|
|
179
|
+
* function Foo() {
|
|
180
|
+
* this.a = 1;
|
|
181
|
+
* }
|
|
182
|
+
*
|
|
183
|
+
* _.isPlainObject(new Foo);
|
|
184
|
+
* // => false
|
|
185
|
+
*
|
|
186
|
+
* _.isPlainObject([1, 2, 3]);
|
|
187
|
+
* // => false
|
|
188
|
+
*
|
|
189
|
+
* _.isPlainObject({ 'x': 0, 'y': 0 });
|
|
190
|
+
* // => true
|
|
191
|
+
*
|
|
192
|
+
* _.isPlainObject(Object.create(null));
|
|
193
|
+
* // => true
|
|
194
|
+
*/
|
|
113
195
|
function isPlainObject(value) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
return true;
|
|
120
|
-
}
|
|
121
|
-
var Ctor = hasOwnProperty$2.call(proto, "constructor") && proto.constructor;
|
|
122
|
-
return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
|
|
196
|
+
if (!isObjectLike(value) || baseGetTag(value) != objectTag) return false;
|
|
197
|
+
var proto = getPrototype(value);
|
|
198
|
+
if (proto === null) return true;
|
|
199
|
+
var Ctor = hasOwnProperty$2.call(proto, "constructor") && proto.constructor;
|
|
200
|
+
return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
|
|
123
201
|
}
|
|
202
|
+
//#endregion
|
|
203
|
+
//#region ../../../../node_modules/lodash-es/isError.js
|
|
204
|
+
/** `Object#toString` result references. */
|
|
124
205
|
var domExcTag = "[object DOMException]", errorTag = "[object Error]";
|
|
206
|
+
/**
|
|
207
|
+
* Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
|
|
208
|
+
* `SyntaxError`, `TypeError`, or `URIError` object.
|
|
209
|
+
*
|
|
210
|
+
* @static
|
|
211
|
+
* @memberOf _
|
|
212
|
+
* @since 3.0.0
|
|
213
|
+
* @category Lang
|
|
214
|
+
* @param {*} value The value to check.
|
|
215
|
+
* @returns {boolean} Returns `true` if `value` is an error object, else `false`.
|
|
216
|
+
* @example
|
|
217
|
+
*
|
|
218
|
+
* _.isError(new Error);
|
|
219
|
+
* // => true
|
|
220
|
+
*
|
|
221
|
+
* _.isError(Error);
|
|
222
|
+
* // => false
|
|
223
|
+
*/
|
|
125
224
|
function isError(value) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
var tag = baseGetTag(value);
|
|
130
|
-
return tag == errorTag || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
|
|
225
|
+
if (!isObjectLike(value)) return false;
|
|
226
|
+
var tag = baseGetTag(value);
|
|
227
|
+
return tag == errorTag || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
|
|
131
228
|
}
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region ../../../../node_modules/lodash-es/attempt.js
|
|
231
|
+
/**
|
|
232
|
+
* Attempts to invoke `func`, returning either the result or the caught error
|
|
233
|
+
* object. Any additional arguments are provided to `func` when it's invoked.
|
|
234
|
+
*
|
|
235
|
+
* @static
|
|
236
|
+
* @memberOf _
|
|
237
|
+
* @since 3.0.0
|
|
238
|
+
* @category Util
|
|
239
|
+
* @param {Function} func The function to attempt.
|
|
240
|
+
* @param {...*} [args] The arguments to invoke `func` with.
|
|
241
|
+
* @returns {*} Returns the `func` result or error object.
|
|
242
|
+
* @example
|
|
243
|
+
*
|
|
244
|
+
* // Avoid throwing errors for invalid selectors.
|
|
245
|
+
* var elements = _.attempt(function(selector) {
|
|
246
|
+
* return document.querySelectorAll(selector);
|
|
247
|
+
* }, '>_>');
|
|
248
|
+
*
|
|
249
|
+
* if (_.isError(elements)) {
|
|
250
|
+
* elements = [];
|
|
251
|
+
* }
|
|
252
|
+
*/
|
|
132
253
|
var attempt = /* @__PURE__ */ baseRest(function(func, args) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
254
|
+
try {
|
|
255
|
+
return apply(func, void 0, args);
|
|
256
|
+
} catch (e) {
|
|
257
|
+
return isError(e) ? e : new Error(e);
|
|
258
|
+
}
|
|
138
259
|
});
|
|
260
|
+
//#endregion
|
|
261
|
+
//#region ../../../../node_modules/lodash-es/_basePropertyOf.js
|
|
262
|
+
/**
|
|
263
|
+
* The base implementation of `_.propertyOf` without support for deep paths.
|
|
264
|
+
*
|
|
265
|
+
* @private
|
|
266
|
+
* @param {Object} object The object to query.
|
|
267
|
+
* @returns {Function} Returns the new accessor function.
|
|
268
|
+
*/
|
|
139
269
|
function basePropertyOf(object) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
270
|
+
return function(key) {
|
|
271
|
+
return object == null ? void 0 : object[key];
|
|
272
|
+
};
|
|
143
273
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
274
|
+
//#endregion
|
|
275
|
+
//#region ../../../../node_modules/lodash-es/_escapeHtmlChar.js
|
|
276
|
+
/**
|
|
277
|
+
* Used by `_.escape` to convert characters to HTML entities.
|
|
278
|
+
*
|
|
279
|
+
* @private
|
|
280
|
+
* @param {string} chr The matched character to escape.
|
|
281
|
+
* @returns {string} Returns the escaped character.
|
|
282
|
+
*/
|
|
283
|
+
var escapeHtmlChar = /* @__PURE__ */ basePropertyOf({
|
|
284
|
+
"&": "&",
|
|
285
|
+
"<": "<",
|
|
286
|
+
">": ">",
|
|
287
|
+
"\"": """,
|
|
288
|
+
"'": "'"
|
|
289
|
+
});
|
|
290
|
+
//#endregion
|
|
291
|
+
//#region ../../../../node_modules/lodash-es/escape.js
|
|
292
|
+
/** Used to match HTML entities and HTML characters. */
|
|
293
|
+
var reUnescapedHtml = /[&<>"']/g, reHasUnescapedHtml = /* @__PURE__ */ RegExp(reUnescapedHtml.source);
|
|
294
|
+
/**
|
|
295
|
+
* Converts the characters "&", "<", ">", '"', and "'" in `string` to their
|
|
296
|
+
* corresponding HTML entities.
|
|
297
|
+
*
|
|
298
|
+
* **Note:** No other characters are escaped. To escape additional
|
|
299
|
+
* characters use a third-party library like [_he_](https://mths.be/he).
|
|
300
|
+
*
|
|
301
|
+
* Though the ">" character is escaped for symmetry, characters like
|
|
302
|
+
* ">" and "/" don't need escaping in HTML and have no special meaning
|
|
303
|
+
* unless they're part of a tag or unquoted attribute value. See
|
|
304
|
+
* [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
|
|
305
|
+
* (under "semi-related fun fact") for more details.
|
|
306
|
+
*
|
|
307
|
+
* When working with HTML you should always
|
|
308
|
+
* [quote attribute values](http://wonko.com/post/html-escaping) to reduce
|
|
309
|
+
* XSS vectors.
|
|
310
|
+
*
|
|
311
|
+
* @static
|
|
312
|
+
* @since 0.1.0
|
|
313
|
+
* @memberOf _
|
|
314
|
+
* @category String
|
|
315
|
+
* @param {string} [string=''] The string to escape.
|
|
316
|
+
* @returns {string} Returns the escaped string.
|
|
317
|
+
* @example
|
|
318
|
+
*
|
|
319
|
+
* _.escape('fred, barney, & pebbles');
|
|
320
|
+
* // => 'fred, barney, & pebbles'
|
|
321
|
+
*/
|
|
153
322
|
function escape(string) {
|
|
154
|
-
|
|
155
|
-
|
|
323
|
+
string = toString(string);
|
|
324
|
+
return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string;
|
|
156
325
|
}
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region ../../../../node_modules/lodash-es/_baseValues.js
|
|
328
|
+
/**
|
|
329
|
+
* The base implementation of `_.values` and `_.valuesIn` which creates an
|
|
330
|
+
* array of `object` property values corresponding to the property names
|
|
331
|
+
* of `props`.
|
|
332
|
+
*
|
|
333
|
+
* @private
|
|
334
|
+
* @param {Object} object The object to query.
|
|
335
|
+
* @param {Array} props The property names to get values for.
|
|
336
|
+
* @returns {Object} Returns the array of property values.
|
|
337
|
+
*/
|
|
157
338
|
function baseValues(object, props) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
339
|
+
return arrayMap(props, function(key) {
|
|
340
|
+
return object[key];
|
|
341
|
+
});
|
|
161
342
|
}
|
|
162
|
-
|
|
163
|
-
|
|
343
|
+
//#endregion
|
|
344
|
+
//#region ../../../../node_modules/lodash-es/_customDefaultsAssignIn.js
|
|
345
|
+
/** Used for built-in method references. */
|
|
346
|
+
var objectProto = Object.prototype;
|
|
347
|
+
/** Used to check objects for own properties. */
|
|
348
|
+
var hasOwnProperty$1 = objectProto.hasOwnProperty;
|
|
349
|
+
/**
|
|
350
|
+
* Used by `_.defaults` to customize its `_.assignIn` use to assign properties
|
|
351
|
+
* of source objects to the destination object for all destination properties
|
|
352
|
+
* that resolve to `undefined`.
|
|
353
|
+
*
|
|
354
|
+
* @private
|
|
355
|
+
* @param {*} objValue The destination value.
|
|
356
|
+
* @param {*} srcValue The source value.
|
|
357
|
+
* @param {string} key The key of the property to assign.
|
|
358
|
+
* @param {Object} object The parent object of `objValue`.
|
|
359
|
+
* @returns {*} Returns the value to assign.
|
|
360
|
+
*/
|
|
164
361
|
function customDefaultsAssignIn(objValue, srcValue, key, object) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
return objValue;
|
|
362
|
+
if (objValue === void 0 || eq(objValue, objectProto[key]) && !hasOwnProperty$1.call(object, key)) return srcValue;
|
|
363
|
+
return objValue;
|
|
169
364
|
}
|
|
365
|
+
//#endregion
|
|
366
|
+
//#region ../../../../node_modules/lodash-es/_escapeStringChar.js
|
|
367
|
+
/** Used to escape characters for inclusion in compiled string literals. */
|
|
170
368
|
var stringEscapes = {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
369
|
+
"\\": "\\",
|
|
370
|
+
"'": "'",
|
|
371
|
+
"\n": "n",
|
|
372
|
+
"\r": "r",
|
|
373
|
+
"\u2028": "u2028",
|
|
374
|
+
"\u2029": "u2029"
|
|
177
375
|
};
|
|
376
|
+
/**
|
|
377
|
+
* Used by `_.template` to escape characters for inclusion in compiled string literals.
|
|
378
|
+
*
|
|
379
|
+
* @private
|
|
380
|
+
* @param {string} chr The matched character to escape.
|
|
381
|
+
* @returns {string} Returns the escaped character.
|
|
382
|
+
*/
|
|
178
383
|
function escapeStringChar(chr) {
|
|
179
|
-
|
|
384
|
+
return "\\" + stringEscapes[chr];
|
|
180
385
|
}
|
|
386
|
+
//#endregion
|
|
387
|
+
//#region ../../../../node_modules/lodash-es/_reInterpolate.js
|
|
388
|
+
/** Used to match template delimiters. */
|
|
181
389
|
var reInterpolate = /<%=([\s\S]+?)%>/g;
|
|
182
|
-
|
|
183
|
-
|
|
390
|
+
//#endregion
|
|
391
|
+
//#region ../../../../node_modules/lodash-es/templateSettings.js
|
|
392
|
+
/**
|
|
393
|
+
* By default, the template delimiters used by lodash are like those in
|
|
394
|
+
* embedded Ruby (ERB) as well as ES2015 template strings. Change the
|
|
395
|
+
* following template settings to use alternative delimiters.
|
|
396
|
+
*
|
|
397
|
+
* **Security:** See
|
|
398
|
+
* [threat model](https://github.com/lodash/lodash/blob/main/threat-model.md)
|
|
399
|
+
* — `_.template` is insecure and will be removed in v5.
|
|
400
|
+
*
|
|
401
|
+
* @static
|
|
402
|
+
* @memberOf _
|
|
403
|
+
* @type {Object}
|
|
404
|
+
*/
|
|
184
405
|
var templateSettings = {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
*/
|
|
191
|
-
"escape": reEscape,
|
|
192
|
-
/**
|
|
193
|
-
* Used to detect code to be evaluated.
|
|
194
|
-
*
|
|
195
|
-
* @memberOf _.templateSettings
|
|
196
|
-
* @type {RegExp}
|
|
197
|
-
*/
|
|
198
|
-
"evaluate": reEvaluate,
|
|
199
|
-
/**
|
|
200
|
-
* Used to detect `data` property values to inject.
|
|
201
|
-
*
|
|
202
|
-
* @memberOf _.templateSettings
|
|
203
|
-
* @type {RegExp}
|
|
204
|
-
*/
|
|
205
|
-
"interpolate": reInterpolate,
|
|
206
|
-
/**
|
|
207
|
-
* Used to reference the data object in the template text.
|
|
208
|
-
*
|
|
209
|
-
* @memberOf _.templateSettings
|
|
210
|
-
* @type {string}
|
|
211
|
-
*/
|
|
212
|
-
"variable": "",
|
|
213
|
-
/**
|
|
214
|
-
* Used to import variables into the compiled template.
|
|
215
|
-
*
|
|
216
|
-
* @memberOf _.templateSettings
|
|
217
|
-
* @type {Object}
|
|
218
|
-
*/
|
|
219
|
-
"imports": {
|
|
220
|
-
/**
|
|
221
|
-
* A reference to the `lodash` function.
|
|
222
|
-
*
|
|
223
|
-
* @memberOf _.templateSettings.imports
|
|
224
|
-
* @type {Function}
|
|
225
|
-
*/
|
|
226
|
-
"_": { "escape": escape }
|
|
227
|
-
}
|
|
406
|
+
"escape": /<%-([\s\S]+?)%>/g,
|
|
407
|
+
"evaluate": /<%([\s\S]+?)%>/g,
|
|
408
|
+
"interpolate": reInterpolate,
|
|
409
|
+
"variable": "",
|
|
410
|
+
"imports": { "_": { "escape": escape } }
|
|
228
411
|
};
|
|
229
|
-
|
|
412
|
+
//#endregion
|
|
413
|
+
//#region ../../../../node_modules/lodash-es/template.js
|
|
414
|
+
/** Error message constants. */
|
|
415
|
+
var INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`", INVALID_TEMPL_IMPORTS_ERROR_TEXT = "Invalid `imports` option passed into `_.template`";
|
|
416
|
+
/** Used to match empty string literals in compiled template source. */
|
|
230
417
|
var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
|
|
418
|
+
/**
|
|
419
|
+
* Used to validate the `validate` option in `_.template` variable.
|
|
420
|
+
*
|
|
421
|
+
* Forbids characters which could potentially change the meaning of the function argument definition:
|
|
422
|
+
* - "()," (modification of function parameters)
|
|
423
|
+
* - "=" (default value)
|
|
424
|
+
* - "[]{}" (destructuring of function parameters)
|
|
425
|
+
* - "/" (beginning of a comment)
|
|
426
|
+
* - whitespace
|
|
427
|
+
*/
|
|
231
428
|
var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
|
|
429
|
+
/**
|
|
430
|
+
* Used to match
|
|
431
|
+
* [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
|
|
432
|
+
*/
|
|
232
433
|
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
|
|
434
|
+
/** Used to ensure capturing order of template delimiters. */
|
|
233
435
|
var reNoMatch = /($^)/;
|
|
436
|
+
/** Used to match unescaped characters in compiled string literals. */
|
|
234
437
|
var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
|
|
235
|
-
|
|
236
|
-
var hasOwnProperty =
|
|
438
|
+
/** Used to check objects for own properties. */
|
|
439
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
440
|
+
/**
|
|
441
|
+
* Creates a compiled template function that can interpolate data properties
|
|
442
|
+
* in "interpolate" delimiters, HTML-escape interpolated data properties in
|
|
443
|
+
* "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
|
|
444
|
+
* properties may be accessed as free variables in the template. If a setting
|
|
445
|
+
* object is given, it takes precedence over `_.templateSettings` values.
|
|
446
|
+
*
|
|
447
|
+
* **Security:** `_.template` is insecure and should not be used. It will be
|
|
448
|
+
* removed in Lodash v5. Avoid untrusted input. See
|
|
449
|
+
* [threat model](https://github.com/lodash/lodash/blob/main/threat-model.md).
|
|
450
|
+
*
|
|
451
|
+
* **Note:** In the development build `_.template` utilizes
|
|
452
|
+
* [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
|
|
453
|
+
* for easier debugging.
|
|
454
|
+
*
|
|
455
|
+
* For more information on precompiling templates see
|
|
456
|
+
* [lodash's custom builds documentation](https://lodash.com/custom-builds).
|
|
457
|
+
*
|
|
458
|
+
* For more information on Chrome extension sandboxes see
|
|
459
|
+
* [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
|
|
460
|
+
*
|
|
461
|
+
* @static
|
|
462
|
+
* @since 0.1.0
|
|
463
|
+
* @memberOf _
|
|
464
|
+
* @category String
|
|
465
|
+
* @param {string} [string=''] The template string.
|
|
466
|
+
* @param {Object} [options={}] The options object.
|
|
467
|
+
* @param {RegExp} [options.escape=_.templateSettings.escape]
|
|
468
|
+
* The HTML "escape" delimiter.
|
|
469
|
+
* @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
|
|
470
|
+
* The "evaluate" delimiter.
|
|
471
|
+
* @param {Object} [options.imports=_.templateSettings.imports]
|
|
472
|
+
* An object to import into the template as free variables.
|
|
473
|
+
* @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
|
|
474
|
+
* The "interpolate" delimiter.
|
|
475
|
+
* @param {string} [options.sourceURL='templateSources[n]']
|
|
476
|
+
* The sourceURL of the compiled template.
|
|
477
|
+
* @param {string} [options.variable='obj']
|
|
478
|
+
* The data object variable name.
|
|
479
|
+
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
480
|
+
* @returns {Function} Returns the compiled template function.
|
|
481
|
+
* @example
|
|
482
|
+
*
|
|
483
|
+
* // Use the "interpolate" delimiter to create a compiled template.
|
|
484
|
+
* var compiled = _.template('hello <%= user %>!');
|
|
485
|
+
* compiled({ 'user': 'fred' });
|
|
486
|
+
* // => 'hello fred!'
|
|
487
|
+
*
|
|
488
|
+
* // Use the HTML "escape" delimiter to escape data property values.
|
|
489
|
+
* var compiled = _.template('<b><%- value %></b>');
|
|
490
|
+
* compiled({ 'value': '<script>' });
|
|
491
|
+
* // => '<b><script></b>'
|
|
492
|
+
*
|
|
493
|
+
* // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
|
|
494
|
+
* var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
|
|
495
|
+
* compiled({ 'users': ['fred', 'barney'] });
|
|
496
|
+
* // => '<li>fred</li><li>barney</li>'
|
|
497
|
+
*
|
|
498
|
+
* // Use the internal `print` function in "evaluate" delimiters.
|
|
499
|
+
* var compiled = _.template('<% print("hello " + user); %>!');
|
|
500
|
+
* compiled({ 'user': 'barney' });
|
|
501
|
+
* // => 'hello barney!'
|
|
502
|
+
*
|
|
503
|
+
* // Use the ES template literal delimiter as an "interpolate" delimiter.
|
|
504
|
+
* // Disable support by replacing the "interpolate" delimiter.
|
|
505
|
+
* var compiled = _.template('hello ${ user }!');
|
|
506
|
+
* compiled({ 'user': 'pebbles' });
|
|
507
|
+
* // => 'hello pebbles!'
|
|
508
|
+
*
|
|
509
|
+
* // Use backslashes to treat delimiters as plain text.
|
|
510
|
+
* var compiled = _.template('<%= "\\<%- value %\\>" %>');
|
|
511
|
+
* compiled({ 'value': 'ignored' });
|
|
512
|
+
* // => '<%- value %>'
|
|
513
|
+
*
|
|
514
|
+
* // Use the `imports` option to import `jQuery` as `jq`.
|
|
515
|
+
* var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
|
|
516
|
+
* var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
|
|
517
|
+
* compiled({ 'users': ['fred', 'barney'] });
|
|
518
|
+
* // => '<li>fred</li><li>barney</li>'
|
|
519
|
+
*
|
|
520
|
+
* // Use the `sourceURL` option to specify a custom sourceURL for the template.
|
|
521
|
+
* var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
|
|
522
|
+
* compiled(data);
|
|
523
|
+
* // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
|
|
524
|
+
*
|
|
525
|
+
* // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
|
|
526
|
+
* var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
|
|
527
|
+
* compiled.source;
|
|
528
|
+
* // => function(data) {
|
|
529
|
+
* // var __t, __p = '';
|
|
530
|
+
* // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
|
|
531
|
+
* // return __p;
|
|
532
|
+
* // }
|
|
533
|
+
*
|
|
534
|
+
* // Use custom template delimiters.
|
|
535
|
+
* _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
|
|
536
|
+
* var compiled = _.template('hello {{ user }}!');
|
|
537
|
+
* compiled({ 'user': 'mustache' });
|
|
538
|
+
* // => 'hello mustache!'
|
|
539
|
+
*
|
|
540
|
+
* // Use the `source` property to inline compiled templates for meaningful
|
|
541
|
+
* // line numbers in error messages and stack traces.
|
|
542
|
+
* fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
|
|
543
|
+
* var JST = {\
|
|
544
|
+
* "main": ' + _.template(mainText).source + '\
|
|
545
|
+
* };\
|
|
546
|
+
* ');
|
|
547
|
+
*/
|
|
237
548
|
function template(string, options, guard) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
});
|
|
277
|
-
result.source = source;
|
|
278
|
-
if (isError(result)) {
|
|
279
|
-
throw result;
|
|
280
|
-
}
|
|
281
|
-
return result;
|
|
549
|
+
var settings = templateSettings.imports._.templateSettings || templateSettings;
|
|
550
|
+
if (guard && isIterateeCall(string, options, guard)) options = void 0;
|
|
551
|
+
string = toString(string);
|
|
552
|
+
options = assignWith({}, options, settings, customDefaultsAssignIn);
|
|
553
|
+
var imports = assignWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
|
|
554
|
+
arrayEach(importsKeys, function(key) {
|
|
555
|
+
if (reForbiddenIdentifierChars.test(key)) throw new Error(INVALID_TEMPL_IMPORTS_ERROR_TEXT);
|
|
556
|
+
});
|
|
557
|
+
var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
|
|
558
|
+
var reDelimiters = RegExp((options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g");
|
|
559
|
+
var sourceURL = hasOwnProperty.call(options, "sourceURL") ? "//# sourceURL=" + (options.sourceURL + "").replace(/\s/g, " ") + "\n" : "";
|
|
560
|
+
string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
|
|
561
|
+
interpolateValue || (interpolateValue = esTemplateValue);
|
|
562
|
+
source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
|
|
563
|
+
if (escapeValue) {
|
|
564
|
+
isEscaping = true;
|
|
565
|
+
source += "' +\n__e(" + escapeValue + ") +\n'";
|
|
566
|
+
}
|
|
567
|
+
if (evaluateValue) {
|
|
568
|
+
isEvaluating = true;
|
|
569
|
+
source += "';\n" + evaluateValue + ";\n__p += '";
|
|
570
|
+
}
|
|
571
|
+
if (interpolateValue) source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
|
|
572
|
+
index = offset + match.length;
|
|
573
|
+
return match;
|
|
574
|
+
});
|
|
575
|
+
source += "';\n";
|
|
576
|
+
var variable = hasOwnProperty.call(options, "variable") && options.variable;
|
|
577
|
+
if (!variable) source = "with (obj) {\n" + source + "\n}\n";
|
|
578
|
+
else if (reForbiddenIdentifierChars.test(variable)) throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
|
|
579
|
+
source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
|
|
580
|
+
source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}";
|
|
581
|
+
var result = attempt(function() {
|
|
582
|
+
return Function(importsKeys, sourceURL + "return " + source).apply(void 0, importsValues);
|
|
583
|
+
});
|
|
584
|
+
result.source = source;
|
|
585
|
+
if (isError(result)) throw result;
|
|
586
|
+
return result;
|
|
282
587
|
}
|
|
588
|
+
//#endregion
|
|
589
|
+
//#region src/module/field-modal-select.ts
|
|
283
590
|
function createCallback(type, selector, modalSelector) {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
const store = element.querySelector("[data-role=value]");
|
|
323
|
-
if (image && item.image) {
|
|
324
|
-
image.style.backgroundImage = `url(${item.image});`;
|
|
325
|
-
}
|
|
326
|
-
title.value = item.title || "";
|
|
327
|
-
store.value = item.value || "";
|
|
328
|
-
store.dispatchEvent(new CustomEvent("change"));
|
|
329
|
-
selectOne(modalSelector)?.close();
|
|
330
|
-
highlight(title);
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
class ModalListSelectElement extends HTMLElement {
|
|
335
|
-
static is = "uni-modal-list";
|
|
336
|
-
itemTemplate;
|
|
337
|
-
options;
|
|
338
|
-
isMultiCheck = false;
|
|
339
|
-
get listContainer() {
|
|
340
|
-
return this.querySelector("[data-role=list-container]");
|
|
341
|
-
}
|
|
342
|
-
get selectButton() {
|
|
343
|
-
return this.querySelector("[data-role=select]");
|
|
344
|
-
}
|
|
345
|
-
get modal() {
|
|
346
|
-
return document.querySelector(this.options.modalSelector);
|
|
347
|
-
}
|
|
348
|
-
get items() {
|
|
349
|
-
return Array.from(this.listContainer.querySelectorAll("[data-value]"));
|
|
350
|
-
}
|
|
351
|
-
get count() {
|
|
352
|
-
return this.items.length;
|
|
353
|
-
}
|
|
354
|
-
connectedCallback() {
|
|
355
|
-
this.options = JSON.parse(this.getAttribute("options") || "{}");
|
|
356
|
-
this.itemTemplate = template(document.querySelector(this.options.itemTemplate).innerHTML);
|
|
357
|
-
const emptyInput = this.querySelector("[data-role=empty]");
|
|
358
|
-
if (emptyInput) {
|
|
359
|
-
emptyInput.name = emptyInput.dataset.name || "";
|
|
360
|
-
}
|
|
361
|
-
if (this.options.sortable) {
|
|
362
|
-
import("sortablejs").then(({ default: Sortable }) => {
|
|
363
|
-
new Sortable(this.listContainer, { handle: ".h-drag-handle", animation: 150 });
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
this.selectButton.addEventListener("click", (e) => {
|
|
367
|
-
try {
|
|
368
|
-
this.open(e);
|
|
369
|
-
} catch (e2) {
|
|
370
|
-
simpleAlert(e2.message);
|
|
371
|
-
}
|
|
372
|
-
});
|
|
373
|
-
this.querySelector("[data-role=clear]")?.addEventListener("click", () => {
|
|
374
|
-
this.removeAll();
|
|
375
|
-
});
|
|
376
|
-
this.selectButton.style.pointerEvents = "";
|
|
377
|
-
this.render();
|
|
378
|
-
this.enableMultiCheck(this.options.multiCheck || false);
|
|
379
|
-
}
|
|
380
|
-
render() {
|
|
381
|
-
const items = data("unicorn.modal-field")[this.options.dataKey] || [];
|
|
382
|
-
items.forEach((item) => {
|
|
383
|
-
this.appendItem(item);
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
appendItem(item, highlights = false) {
|
|
387
|
-
const max = this.options.max;
|
|
388
|
-
if (max && this.count >= max) {
|
|
389
|
-
throw new Error(__("unicorn.field.modal.max.selected", max));
|
|
390
|
-
}
|
|
391
|
-
const itemHtml = html(this.itemTemplate({ item }));
|
|
392
|
-
itemHtml.dataset.value = String(item.value);
|
|
393
|
-
itemHtml.querySelector("[data-role=remove]")?.addEventListener("click", () => {
|
|
394
|
-
this.removeItem(item);
|
|
395
|
-
});
|
|
396
|
-
this.listContainer.appendChild(itemHtml);
|
|
397
|
-
this.toggleRequired();
|
|
398
|
-
if (highlights) {
|
|
399
|
-
highlight(itemHtml);
|
|
400
|
-
}
|
|
401
|
-
if (this.isMultiCheck) {
|
|
402
|
-
this.updateSelected();
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
appendIfNotExists(item, highlights = false) {
|
|
406
|
-
if (!this.isExists(item)) {
|
|
407
|
-
this.appendItem(item, highlights);
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
isExists(item) {
|
|
411
|
-
if (typeof item === "object") {
|
|
412
|
-
item = item.value;
|
|
413
|
-
}
|
|
414
|
-
return this.listContainer.querySelector(`[data-value="${item}"]`) !== null;
|
|
415
|
-
}
|
|
416
|
-
getItemElement(item) {
|
|
417
|
-
if (typeof item === "object") {
|
|
418
|
-
item = item.value;
|
|
419
|
-
}
|
|
420
|
-
return this.listContainer.querySelector(`[data-value="${item}"]`);
|
|
421
|
-
}
|
|
422
|
-
getValues() {
|
|
423
|
-
return this.items.map((item) => item.dataset.value);
|
|
424
|
-
}
|
|
425
|
-
async removeItem(item) {
|
|
426
|
-
if (typeof item === "object") {
|
|
427
|
-
item = item.value;
|
|
428
|
-
}
|
|
429
|
-
const element = this.listContainer.querySelector(`[data-value="${item}"]`);
|
|
430
|
-
if (element) {
|
|
431
|
-
return slideUp(element).then(() => {
|
|
432
|
-
element.remove();
|
|
433
|
-
this.toggleRequired();
|
|
434
|
-
if (this.isMultiCheck) {
|
|
435
|
-
this.updateSelected();
|
|
436
|
-
}
|
|
437
|
-
});
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
async removeAll() {
|
|
441
|
-
const promises = [];
|
|
442
|
-
for (const item of this.items) {
|
|
443
|
-
promises.push(slideUp(item).then(() => item.remove()));
|
|
444
|
-
}
|
|
445
|
-
await Promise.all(promises);
|
|
446
|
-
this.toggleRequired();
|
|
447
|
-
if (this.isMultiCheck) {
|
|
448
|
-
this.updateSelected();
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
toggleRequired() {
|
|
452
|
-
const placeholder = this.querySelector("[data-role=validation-placeholder]");
|
|
453
|
-
if (placeholder) {
|
|
454
|
-
placeholder.disabled = this.listContainer.children.length !== 0;
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
open(event) {
|
|
458
|
-
event.preventDefault();
|
|
459
|
-
event.stopPropagation();
|
|
460
|
-
const max = this.options.max;
|
|
461
|
-
const target = event.target;
|
|
462
|
-
if (!max) {
|
|
463
|
-
this.modal?.open(target.href, { size: "modal-xl" });
|
|
464
|
-
return;
|
|
465
|
-
}
|
|
466
|
-
if (this.count >= max) {
|
|
467
|
-
throw new Error(__("unicorn.field.modal.max.selected", max));
|
|
468
|
-
}
|
|
469
|
-
this.modal?.open(target.href, { size: "modal-xl" });
|
|
470
|
-
}
|
|
471
|
-
enableMultiCheck(enable = true) {
|
|
472
|
-
this.isMultiCheck = enable;
|
|
473
|
-
if (enable) {
|
|
474
|
-
this.updateSelected();
|
|
475
|
-
} else {
|
|
476
|
-
this.clearSelected();
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
updateSelected() {
|
|
480
|
-
const url = new URL(this.selectButton.href);
|
|
481
|
-
url.searchParams.set("selected", this.items.map((i) => i.dataset.value).join(","));
|
|
482
|
-
this.selectButton.href = url.toString();
|
|
483
|
-
}
|
|
484
|
-
clearSelected() {
|
|
485
|
-
const url = new URL(this.selectButton.href);
|
|
486
|
-
url.searchParams.delete("selected");
|
|
487
|
-
this.selectButton.href = url.toString();
|
|
488
|
-
}
|
|
591
|
+
switch (type) {
|
|
592
|
+
case "list": return (item) => {
|
|
593
|
+
const modalList = document.querySelector(selector);
|
|
594
|
+
const checked = item.checked;
|
|
595
|
+
if (checked === void 0) if (!modalList.querySelector(`[data-value="${item.value}"]`)) {
|
|
596
|
+
modalList.appendItem(item, true);
|
|
597
|
+
selectOne(modalSelector)?.close();
|
|
598
|
+
} else simpleAlert(__("unicorn.field.modal.already.selected"));
|
|
599
|
+
else if (checked) try {
|
|
600
|
+
modalList.appendIfNotExists(item, true);
|
|
601
|
+
} catch (e) {
|
|
602
|
+
window.postMessage({
|
|
603
|
+
task: "remove-row",
|
|
604
|
+
value: item,
|
|
605
|
+
id: item.instanceId
|
|
606
|
+
});
|
|
607
|
+
simpleAlert(e.message);
|
|
608
|
+
} finally {
|
|
609
|
+
modalList.updateSelected();
|
|
610
|
+
}
|
|
611
|
+
else if (!checked) modalList.removeItem(item).then(() => {
|
|
612
|
+
console.log(modalList.items);
|
|
613
|
+
modalList.updateSelected();
|
|
614
|
+
});
|
|
615
|
+
};
|
|
616
|
+
default: return (item) => {
|
|
617
|
+
const element = document.querySelector(selector);
|
|
618
|
+
const image = element.querySelector("[data-role=image]");
|
|
619
|
+
const title = element.querySelector("[data-role=title]");
|
|
620
|
+
const store = element.querySelector("[data-role=value]");
|
|
621
|
+
if (image && item.image) image.style.backgroundImage = `url(${item.image});`;
|
|
622
|
+
title.value = item.title || "";
|
|
623
|
+
store.value = item.value || "";
|
|
624
|
+
store.dispatchEvent(new CustomEvent("change"));
|
|
625
|
+
selectOne(modalSelector)?.close();
|
|
626
|
+
highlight(title);
|
|
627
|
+
};
|
|
628
|
+
}
|
|
489
629
|
}
|
|
630
|
+
var ModalListSelectElement = class extends HTMLElement {
|
|
631
|
+
static is = "uni-modal-list";
|
|
632
|
+
itemTemplate;
|
|
633
|
+
options;
|
|
634
|
+
isMultiCheck = false;
|
|
635
|
+
get listContainer() {
|
|
636
|
+
return this.querySelector("[data-role=list-container]");
|
|
637
|
+
}
|
|
638
|
+
get selectButton() {
|
|
639
|
+
return this.querySelector("[data-role=select]");
|
|
640
|
+
}
|
|
641
|
+
get modal() {
|
|
642
|
+
return document.querySelector(this.options.modalSelector);
|
|
643
|
+
}
|
|
644
|
+
get items() {
|
|
645
|
+
return Array.from(this.listContainer.querySelectorAll("[data-value]"));
|
|
646
|
+
}
|
|
647
|
+
get count() {
|
|
648
|
+
return this.items.length;
|
|
649
|
+
}
|
|
650
|
+
connectedCallback() {
|
|
651
|
+
this.options = JSON.parse(this.getAttribute("options") || "{}");
|
|
652
|
+
this.itemTemplate = template(document.querySelector(this.options.itemTemplate).innerHTML);
|
|
653
|
+
const emptyInput = this.querySelector("[data-role=empty]");
|
|
654
|
+
if (emptyInput) emptyInput.name = emptyInput.dataset.name || "";
|
|
655
|
+
if (this.options.sortable) import("sortablejs").then(({ default: Sortable }) => {
|
|
656
|
+
new Sortable(this.listContainer, {
|
|
657
|
+
handle: ".h-drag-handle",
|
|
658
|
+
animation: 150
|
|
659
|
+
});
|
|
660
|
+
});
|
|
661
|
+
this.selectButton.addEventListener("click", (e) => {
|
|
662
|
+
try {
|
|
663
|
+
this.open(e);
|
|
664
|
+
} catch (e) {
|
|
665
|
+
simpleAlert(e.message);
|
|
666
|
+
}
|
|
667
|
+
});
|
|
668
|
+
this.querySelector("[data-role=clear]")?.addEventListener("click", () => {
|
|
669
|
+
this.removeAll();
|
|
670
|
+
});
|
|
671
|
+
this.selectButton.style.pointerEvents = "";
|
|
672
|
+
this.render();
|
|
673
|
+
this.enableMultiCheck(this.options.multiCheck || false);
|
|
674
|
+
}
|
|
675
|
+
render() {
|
|
676
|
+
(data("unicorn.modal-field")[this.options.dataKey] || []).forEach((item) => {
|
|
677
|
+
this.appendItem(item);
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
appendItem(item, highlights = false) {
|
|
681
|
+
const max = this.options.max;
|
|
682
|
+
if (max && this.count >= max) throw new Error(__("unicorn.field.modal.max.selected", max));
|
|
683
|
+
const itemHtml = html(this.itemTemplate({ item }));
|
|
684
|
+
itemHtml.dataset.value = String(item.value);
|
|
685
|
+
itemHtml.querySelector("[data-role=remove]")?.addEventListener("click", () => {
|
|
686
|
+
this.removeItem(item);
|
|
687
|
+
});
|
|
688
|
+
this.listContainer.appendChild(itemHtml);
|
|
689
|
+
this.toggleRequired();
|
|
690
|
+
if (highlights) highlight(itemHtml);
|
|
691
|
+
if (this.isMultiCheck) this.updateSelected();
|
|
692
|
+
}
|
|
693
|
+
appendIfNotExists(item, highlights = false) {
|
|
694
|
+
if (!this.isExists(item)) this.appendItem(item, highlights);
|
|
695
|
+
}
|
|
696
|
+
isExists(item) {
|
|
697
|
+
if (typeof item === "object") item = item.value;
|
|
698
|
+
return this.listContainer.querySelector(`[data-value="${item}"]`) !== null;
|
|
699
|
+
}
|
|
700
|
+
getItemElement(item) {
|
|
701
|
+
if (typeof item === "object") item = item.value;
|
|
702
|
+
return this.listContainer.querySelector(`[data-value="${item}"]`);
|
|
703
|
+
}
|
|
704
|
+
getValues() {
|
|
705
|
+
return this.items.map((item) => item.dataset.value);
|
|
706
|
+
}
|
|
707
|
+
async removeItem(item) {
|
|
708
|
+
if (typeof item === "object") item = item.value;
|
|
709
|
+
const element = this.listContainer.querySelector(`[data-value="${item}"]`);
|
|
710
|
+
if (element) return slideUp(element).then(() => {
|
|
711
|
+
element.remove();
|
|
712
|
+
this.toggleRequired();
|
|
713
|
+
if (this.isMultiCheck) this.updateSelected();
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
async removeAll() {
|
|
717
|
+
const promises = [];
|
|
718
|
+
for (const item of this.items) promises.push(slideUp(item).then(() => item.remove()));
|
|
719
|
+
await Promise.all(promises);
|
|
720
|
+
this.toggleRequired();
|
|
721
|
+
if (this.isMultiCheck) this.updateSelected();
|
|
722
|
+
}
|
|
723
|
+
toggleRequired() {
|
|
724
|
+
const placeholder = this.querySelector("[data-role=validation-placeholder]");
|
|
725
|
+
if (placeholder) placeholder.disabled = this.listContainer.children.length !== 0;
|
|
726
|
+
}
|
|
727
|
+
open(event) {
|
|
728
|
+
event.preventDefault();
|
|
729
|
+
event.stopPropagation();
|
|
730
|
+
const max = this.options.max;
|
|
731
|
+
const target = event.target;
|
|
732
|
+
if (!max) {
|
|
733
|
+
this.modal?.open(target.href, { size: "modal-xl" });
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
if (this.count >= max) throw new Error(__("unicorn.field.modal.max.selected", max));
|
|
737
|
+
this.modal?.open(target.href, { size: "modal-xl" });
|
|
738
|
+
}
|
|
739
|
+
enableMultiCheck(enable = true) {
|
|
740
|
+
this.isMultiCheck = enable;
|
|
741
|
+
if (enable) this.updateSelected();
|
|
742
|
+
else this.clearSelected();
|
|
743
|
+
}
|
|
744
|
+
updateSelected() {
|
|
745
|
+
const url = new URL(this.selectButton.href);
|
|
746
|
+
url.searchParams.set("selected", this.items.map((i) => i.dataset.value).join(","));
|
|
747
|
+
this.selectButton.href = url.toString();
|
|
748
|
+
}
|
|
749
|
+
clearSelected() {
|
|
750
|
+
const url = new URL(this.selectButton.href);
|
|
751
|
+
url.searchParams.delete("selected");
|
|
752
|
+
this.selectButton.href = url.toString();
|
|
753
|
+
}
|
|
754
|
+
};
|
|
490
755
|
async function init() {
|
|
491
|
-
|
|
756
|
+
customElements.define(ModalListSelectElement.is, ModalListSelectElement);
|
|
492
757
|
}
|
|
493
758
|
function listenMessages(options) {
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
});
|
|
508
|
-
window[options.instanceId] = callback;
|
|
759
|
+
const callback = createCallback(options.type, options.selector, options.modalSelector);
|
|
760
|
+
window.addEventListener("message", (e) => {
|
|
761
|
+
if (e.origin === options.origin) {
|
|
762
|
+
if (Array.isArray(e.data) && e.data[0] === options.instanceId) callback(e.data[1]);
|
|
763
|
+
if (typeof e.data === "object" && e.data !== null && e.data.id === options.instanceId && e.data.task === "select-row") {
|
|
764
|
+
const item = e.data.value;
|
|
765
|
+
item.checked = e.data.checked;
|
|
766
|
+
item.instanceId = e.data.id;
|
|
767
|
+
callback(e.data.value);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
});
|
|
771
|
+
window[options.instanceId] = callback;
|
|
509
772
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
};
|
|
516
|
-
//# sourceMappingURL=field-modal-select.js.map
|
|
773
|
+
var ready = /* @__PURE__ */ init();
|
|
774
|
+
//#endregion
|
|
775
|
+
export { createCallback, listenMessages, ready };
|
|
776
|
+
|
|
777
|
+
//# sourceMappingURL=field-modal-select.js.map
|