build-dxf 0.0.19-14 → 0.0.19-15
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/package.json +1 -1
- package/src/index.css +65 -11
- package/src/index2.js +13 -2520
- package/src/index3.js +732 -485
- package/src/pages/Editor.vue.d.ts +3 -1
- package/src/selectLocalFile.js +2573 -91
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/CommandFlowComponent.d.ts +8 -1
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/Default.d.ts +7 -1
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/DrawLine.d.ts +2 -1
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/DrawWindow.d.ts +2 -1
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/PointDrag.d.ts +2 -1
- package/src/utils/DxfSystem/plugin/Editor/components/Editor.d.ts +5 -0
- package/src/components/Editor.vue.d.ts +0 -26
- package/src/pages/Editor02.vue.d.ts +0 -4
package/src/index2.js
CHANGED
|
@@ -3,8 +3,8 @@ import * as THREE from "three";
|
|
|
3
3
|
import { Group } from "three";
|
|
4
4
|
import "clipper-lib";
|
|
5
5
|
import "dxf-writer";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { E as ElButton, R as Renderer, L as Lines, D as DomEventRegister, a as DomContainer, b as ElCheckbox, S as SelectLocalFile } from "./selectLocalFile.js";
|
|
7
|
+
import { defineComponent, createElementBlock, openBlock, createElementVNode, toDisplayString, createVNode, unref, withCtx, createTextVNode, createApp, ref, watch, onMounted, onUnmounted, createCommentVNode, createStaticVNode } from "vue";
|
|
8
8
|
function drawLinePathToPng(points, width, height, color = "#fff", lineWidth = 2) {
|
|
9
9
|
const can = document.createElement("canvas"), ctx = can.getContext("2d");
|
|
10
10
|
can.width = width;
|
|
@@ -22,2513 +22,6 @@ function drawLinePathToPng(points, width, height, color = "#fff", lineWidth = 2)
|
|
|
22
22
|
ctx?.restore();
|
|
23
23
|
return can.toDataURL("image/png", 1);
|
|
24
24
|
}
|
|
25
|
-
function identity(value) {
|
|
26
|
-
return value;
|
|
27
|
-
}
|
|
28
|
-
var WeakMap = getNative(root, "WeakMap");
|
|
29
|
-
function apply(func, thisArg, args) {
|
|
30
|
-
switch (args.length) {
|
|
31
|
-
case 0:
|
|
32
|
-
return func.call(thisArg);
|
|
33
|
-
case 1:
|
|
34
|
-
return func.call(thisArg, args[0]);
|
|
35
|
-
case 2:
|
|
36
|
-
return func.call(thisArg, args[0], args[1]);
|
|
37
|
-
case 3:
|
|
38
|
-
return func.call(thisArg, args[0], args[1], args[2]);
|
|
39
|
-
}
|
|
40
|
-
return func.apply(thisArg, args);
|
|
41
|
-
}
|
|
42
|
-
var HOT_COUNT = 800, HOT_SPAN = 16;
|
|
43
|
-
var nativeNow = Date.now;
|
|
44
|
-
function shortOut(func) {
|
|
45
|
-
var count = 0, lastCalled = 0;
|
|
46
|
-
return function() {
|
|
47
|
-
var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
|
|
48
|
-
lastCalled = stamp;
|
|
49
|
-
if (remaining > 0) {
|
|
50
|
-
if (++count >= HOT_COUNT) {
|
|
51
|
-
return arguments[0];
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
count = 0;
|
|
55
|
-
}
|
|
56
|
-
return func.apply(void 0, arguments);
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
function constant(value) {
|
|
60
|
-
return function() {
|
|
61
|
-
return value;
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
var defineProperty = (function() {
|
|
65
|
-
try {
|
|
66
|
-
var func = getNative(Object, "defineProperty");
|
|
67
|
-
func({}, "", {});
|
|
68
|
-
return func;
|
|
69
|
-
} catch (e) {
|
|
70
|
-
}
|
|
71
|
-
})();
|
|
72
|
-
var baseSetToString = !defineProperty ? identity : function(func, string) {
|
|
73
|
-
return defineProperty(func, "toString", {
|
|
74
|
-
"configurable": true,
|
|
75
|
-
"enumerable": false,
|
|
76
|
-
"value": constant(string),
|
|
77
|
-
"writable": true
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
var setToString = shortOut(baseSetToString);
|
|
81
|
-
var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
|
82
|
-
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
83
|
-
function isIndex(value, length) {
|
|
84
|
-
var type = typeof value;
|
|
85
|
-
length = length == null ? MAX_SAFE_INTEGER$1 : length;
|
|
86
|
-
return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
|
|
87
|
-
}
|
|
88
|
-
function baseAssignValue(object, key, value) {
|
|
89
|
-
if (key == "__proto__" && defineProperty) {
|
|
90
|
-
defineProperty(object, key, {
|
|
91
|
-
"configurable": true,
|
|
92
|
-
"enumerable": true,
|
|
93
|
-
"value": value,
|
|
94
|
-
"writable": true
|
|
95
|
-
});
|
|
96
|
-
} else {
|
|
97
|
-
object[key] = value;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
var objectProto$7 = Object.prototype;
|
|
101
|
-
var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
|
|
102
|
-
function assignValue(object, key, value) {
|
|
103
|
-
var objValue = object[key];
|
|
104
|
-
if (!(hasOwnProperty$5.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
|
|
105
|
-
baseAssignValue(object, key, value);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
var nativeMax = Math.max;
|
|
109
|
-
function overRest(func, start, transform) {
|
|
110
|
-
start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
|
|
111
|
-
return function() {
|
|
112
|
-
var args = arguments, index2 = -1, length = nativeMax(args.length - start, 0), array = Array(length);
|
|
113
|
-
while (++index2 < length) {
|
|
114
|
-
array[index2] = args[start + index2];
|
|
115
|
-
}
|
|
116
|
-
index2 = -1;
|
|
117
|
-
var otherArgs = Array(start + 1);
|
|
118
|
-
while (++index2 < start) {
|
|
119
|
-
otherArgs[index2] = args[index2];
|
|
120
|
-
}
|
|
121
|
-
otherArgs[start] = transform(array);
|
|
122
|
-
return apply(func, this, otherArgs);
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
126
|
-
function isLength(value) {
|
|
127
|
-
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
128
|
-
}
|
|
129
|
-
function isArrayLike(value) {
|
|
130
|
-
return value != null && isLength(value.length) && !isFunction(value);
|
|
131
|
-
}
|
|
132
|
-
var objectProto$6 = Object.prototype;
|
|
133
|
-
function isPrototype(value) {
|
|
134
|
-
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$6;
|
|
135
|
-
return value === proto;
|
|
136
|
-
}
|
|
137
|
-
function baseTimes(n, iteratee) {
|
|
138
|
-
var index2 = -1, result = Array(n);
|
|
139
|
-
while (++index2 < n) {
|
|
140
|
-
result[index2] = iteratee(index2);
|
|
141
|
-
}
|
|
142
|
-
return result;
|
|
143
|
-
}
|
|
144
|
-
var argsTag$2 = "[object Arguments]";
|
|
145
|
-
function baseIsArguments(value) {
|
|
146
|
-
return isObjectLike(value) && baseGetTag(value) == argsTag$2;
|
|
147
|
-
}
|
|
148
|
-
var objectProto$5 = Object.prototype;
|
|
149
|
-
var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
|
|
150
|
-
var propertyIsEnumerable$1 = objectProto$5.propertyIsEnumerable;
|
|
151
|
-
var isArguments = baseIsArguments(/* @__PURE__ */ (function() {
|
|
152
|
-
return arguments;
|
|
153
|
-
})()) ? baseIsArguments : function(value) {
|
|
154
|
-
return isObjectLike(value) && hasOwnProperty$4.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
|
|
155
|
-
};
|
|
156
|
-
function stubFalse() {
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
159
|
-
var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
160
|
-
var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
|
|
161
|
-
var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
|
|
162
|
-
var Buffer = moduleExports$1 ? root.Buffer : void 0;
|
|
163
|
-
var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
|
|
164
|
-
var isBuffer = nativeIsBuffer || stubFalse;
|
|
165
|
-
var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag = "[object Function]", mapTag$2 = "[object Map]", numberTag$1 = "[object Number]", objectTag$2 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$2 = "[object Set]", stringTag$1 = "[object String]", weakMapTag$1 = "[object WeakMap]";
|
|
166
|
-
var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
|
|
167
|
-
var typedArrayTags = {};
|
|
168
|
-
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
|
|
169
|
-
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
|
|
170
|
-
function baseIsTypedArray(value) {
|
|
171
|
-
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
|
172
|
-
}
|
|
173
|
-
function baseUnary(func) {
|
|
174
|
-
return function(value) {
|
|
175
|
-
return func(value);
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
179
|
-
var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
|
|
180
|
-
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
181
|
-
var freeProcess = moduleExports && freeGlobal.process;
|
|
182
|
-
var nodeUtil = (function() {
|
|
183
|
-
try {
|
|
184
|
-
var types = freeModule && freeModule.require && freeModule.require("util").types;
|
|
185
|
-
if (types) {
|
|
186
|
-
return types;
|
|
187
|
-
}
|
|
188
|
-
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
189
|
-
} catch (e) {
|
|
190
|
-
}
|
|
191
|
-
})();
|
|
192
|
-
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
193
|
-
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
194
|
-
var objectProto$4 = Object.prototype;
|
|
195
|
-
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
196
|
-
function arrayLikeKeys(value, inherited) {
|
|
197
|
-
var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
|
|
198
|
-
for (var key in value) {
|
|
199
|
-
if (hasOwnProperty$3.call(value, key) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
200
|
-
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
201
|
-
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
202
|
-
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
|
|
203
|
-
isIndex(key, length)))) {
|
|
204
|
-
result.push(key);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
return result;
|
|
208
|
-
}
|
|
209
|
-
function overArg(func, transform) {
|
|
210
|
-
return function(arg) {
|
|
211
|
-
return func(transform(arg));
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
var nativeKeys = overArg(Object.keys, Object);
|
|
215
|
-
var objectProto$3 = Object.prototype;
|
|
216
|
-
var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
|
|
217
|
-
function baseKeys(object) {
|
|
218
|
-
if (!isPrototype(object)) {
|
|
219
|
-
return nativeKeys(object);
|
|
220
|
-
}
|
|
221
|
-
var result = [];
|
|
222
|
-
for (var key in Object(object)) {
|
|
223
|
-
if (hasOwnProperty$2.call(object, key) && key != "constructor") {
|
|
224
|
-
result.push(key);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
return result;
|
|
228
|
-
}
|
|
229
|
-
function keys(object) {
|
|
230
|
-
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
231
|
-
}
|
|
232
|
-
function arrayPush(array, values) {
|
|
233
|
-
var index2 = -1, length = values.length, offset = array.length;
|
|
234
|
-
while (++index2 < length) {
|
|
235
|
-
array[offset + index2] = values[index2];
|
|
236
|
-
}
|
|
237
|
-
return array;
|
|
238
|
-
}
|
|
239
|
-
var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : void 0;
|
|
240
|
-
function isFlattenable(value) {
|
|
241
|
-
return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
242
|
-
}
|
|
243
|
-
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
244
|
-
var index2 = -1, length = array.length;
|
|
245
|
-
predicate || (predicate = isFlattenable);
|
|
246
|
-
result || (result = []);
|
|
247
|
-
while (++index2 < length) {
|
|
248
|
-
var value = array[index2];
|
|
249
|
-
if (predicate(value)) {
|
|
250
|
-
{
|
|
251
|
-
arrayPush(result, value);
|
|
252
|
-
}
|
|
253
|
-
} else {
|
|
254
|
-
result[result.length] = value;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
return result;
|
|
258
|
-
}
|
|
259
|
-
function flatten(array) {
|
|
260
|
-
var length = array == null ? 0 : array.length;
|
|
261
|
-
return length ? baseFlatten(array) : [];
|
|
262
|
-
}
|
|
263
|
-
function flatRest(func) {
|
|
264
|
-
return setToString(overRest(func, void 0, flatten), func + "");
|
|
265
|
-
}
|
|
266
|
-
function stackClear() {
|
|
267
|
-
this.__data__ = new ListCache();
|
|
268
|
-
this.size = 0;
|
|
269
|
-
}
|
|
270
|
-
function stackDelete(key) {
|
|
271
|
-
var data = this.__data__, result = data["delete"](key);
|
|
272
|
-
this.size = data.size;
|
|
273
|
-
return result;
|
|
274
|
-
}
|
|
275
|
-
function stackGet(key) {
|
|
276
|
-
return this.__data__.get(key);
|
|
277
|
-
}
|
|
278
|
-
function stackHas(key) {
|
|
279
|
-
return this.__data__.has(key);
|
|
280
|
-
}
|
|
281
|
-
var LARGE_ARRAY_SIZE = 200;
|
|
282
|
-
function stackSet(key, value) {
|
|
283
|
-
var data = this.__data__;
|
|
284
|
-
if (data instanceof ListCache) {
|
|
285
|
-
var pairs = data.__data__;
|
|
286
|
-
if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
287
|
-
pairs.push([key, value]);
|
|
288
|
-
this.size = ++data.size;
|
|
289
|
-
return this;
|
|
290
|
-
}
|
|
291
|
-
data = this.__data__ = new MapCache(pairs);
|
|
292
|
-
}
|
|
293
|
-
data.set(key, value);
|
|
294
|
-
this.size = data.size;
|
|
295
|
-
return this;
|
|
296
|
-
}
|
|
297
|
-
function Stack(entries) {
|
|
298
|
-
var data = this.__data__ = new ListCache(entries);
|
|
299
|
-
this.size = data.size;
|
|
300
|
-
}
|
|
301
|
-
Stack.prototype.clear = stackClear;
|
|
302
|
-
Stack.prototype["delete"] = stackDelete;
|
|
303
|
-
Stack.prototype.get = stackGet;
|
|
304
|
-
Stack.prototype.has = stackHas;
|
|
305
|
-
Stack.prototype.set = stackSet;
|
|
306
|
-
function arrayFilter(array, predicate) {
|
|
307
|
-
var index2 = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
|
|
308
|
-
while (++index2 < length) {
|
|
309
|
-
var value = array[index2];
|
|
310
|
-
if (predicate(value, index2, array)) {
|
|
311
|
-
result[resIndex++] = value;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
return result;
|
|
315
|
-
}
|
|
316
|
-
function stubArray() {
|
|
317
|
-
return [];
|
|
318
|
-
}
|
|
319
|
-
var objectProto$2 = Object.prototype;
|
|
320
|
-
var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
|
|
321
|
-
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
322
|
-
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
|
323
|
-
if (object == null) {
|
|
324
|
-
return [];
|
|
325
|
-
}
|
|
326
|
-
object = Object(object);
|
|
327
|
-
return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
|
328
|
-
return propertyIsEnumerable.call(object, symbol);
|
|
329
|
-
});
|
|
330
|
-
};
|
|
331
|
-
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
332
|
-
var result = keysFunc(object);
|
|
333
|
-
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
334
|
-
}
|
|
335
|
-
function getAllKeys(object) {
|
|
336
|
-
return baseGetAllKeys(object, keys, getSymbols);
|
|
337
|
-
}
|
|
338
|
-
var DataView = getNative(root, "DataView");
|
|
339
|
-
var Promise$1 = getNative(root, "Promise");
|
|
340
|
-
var Set$1 = getNative(root, "Set");
|
|
341
|
-
var mapTag$1 = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag$1 = "[object Set]", weakMapTag = "[object WeakMap]";
|
|
342
|
-
var dataViewTag$1 = "[object DataView]";
|
|
343
|
-
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap);
|
|
344
|
-
var getTag = baseGetTag;
|
|
345
|
-
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$1 || Map$1 && getTag(new Map$1()) != mapTag$1 || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag$1 || WeakMap && getTag(new WeakMap()) != weakMapTag) {
|
|
346
|
-
getTag = function(value) {
|
|
347
|
-
var result = baseGetTag(value), Ctor = result == objectTag$1 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
|
|
348
|
-
if (ctorString) {
|
|
349
|
-
switch (ctorString) {
|
|
350
|
-
case dataViewCtorString:
|
|
351
|
-
return dataViewTag$1;
|
|
352
|
-
case mapCtorString:
|
|
353
|
-
return mapTag$1;
|
|
354
|
-
case promiseCtorString:
|
|
355
|
-
return promiseTag;
|
|
356
|
-
case setCtorString:
|
|
357
|
-
return setTag$1;
|
|
358
|
-
case weakMapCtorString:
|
|
359
|
-
return weakMapTag;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
return result;
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
var Uint8Array = root.Uint8Array;
|
|
366
|
-
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
367
|
-
function setCacheAdd(value) {
|
|
368
|
-
this.__data__.set(value, HASH_UNDEFINED);
|
|
369
|
-
return this;
|
|
370
|
-
}
|
|
371
|
-
function setCacheHas(value) {
|
|
372
|
-
return this.__data__.has(value);
|
|
373
|
-
}
|
|
374
|
-
function SetCache(values) {
|
|
375
|
-
var index2 = -1, length = values == null ? 0 : values.length;
|
|
376
|
-
this.__data__ = new MapCache();
|
|
377
|
-
while (++index2 < length) {
|
|
378
|
-
this.add(values[index2]);
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
|
382
|
-
SetCache.prototype.has = setCacheHas;
|
|
383
|
-
function arraySome(array, predicate) {
|
|
384
|
-
var index2 = -1, length = array == null ? 0 : array.length;
|
|
385
|
-
while (++index2 < length) {
|
|
386
|
-
if (predicate(array[index2], index2, array)) {
|
|
387
|
-
return true;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
return false;
|
|
391
|
-
}
|
|
392
|
-
function cacheHas(cache, key) {
|
|
393
|
-
return cache.has(key);
|
|
394
|
-
}
|
|
395
|
-
var COMPARE_PARTIAL_FLAG$3 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
|
|
396
|
-
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
397
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, arrLength = array.length, othLength = other.length;
|
|
398
|
-
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
|
399
|
-
return false;
|
|
400
|
-
}
|
|
401
|
-
var arrStacked = stack.get(array);
|
|
402
|
-
var othStacked = stack.get(other);
|
|
403
|
-
if (arrStacked && othStacked) {
|
|
404
|
-
return arrStacked == other && othStacked == array;
|
|
405
|
-
}
|
|
406
|
-
var index2 = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$1 ? new SetCache() : void 0;
|
|
407
|
-
stack.set(array, other);
|
|
408
|
-
stack.set(other, array);
|
|
409
|
-
while (++index2 < arrLength) {
|
|
410
|
-
var arrValue = array[index2], othValue = other[index2];
|
|
411
|
-
if (customizer) {
|
|
412
|
-
var compared = isPartial ? customizer(othValue, arrValue, index2, other, array, stack) : customizer(arrValue, othValue, index2, array, other, stack);
|
|
413
|
-
}
|
|
414
|
-
if (compared !== void 0) {
|
|
415
|
-
if (compared) {
|
|
416
|
-
continue;
|
|
417
|
-
}
|
|
418
|
-
result = false;
|
|
419
|
-
break;
|
|
420
|
-
}
|
|
421
|
-
if (seen) {
|
|
422
|
-
if (!arraySome(other, function(othValue2, othIndex) {
|
|
423
|
-
if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
|
|
424
|
-
return seen.push(othIndex);
|
|
425
|
-
}
|
|
426
|
-
})) {
|
|
427
|
-
result = false;
|
|
428
|
-
break;
|
|
429
|
-
}
|
|
430
|
-
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
|
431
|
-
result = false;
|
|
432
|
-
break;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
stack["delete"](array);
|
|
436
|
-
stack["delete"](other);
|
|
437
|
-
return result;
|
|
438
|
-
}
|
|
439
|
-
function mapToArray(map) {
|
|
440
|
-
var index2 = -1, result = Array(map.size);
|
|
441
|
-
map.forEach(function(value, key) {
|
|
442
|
-
result[++index2] = [key, value];
|
|
443
|
-
});
|
|
444
|
-
return result;
|
|
445
|
-
}
|
|
446
|
-
function setToArray(set) {
|
|
447
|
-
var index2 = -1, result = Array(set.size);
|
|
448
|
-
set.forEach(function(value) {
|
|
449
|
-
result[++index2] = value;
|
|
450
|
-
});
|
|
451
|
-
return result;
|
|
452
|
-
}
|
|
453
|
-
var COMPARE_PARTIAL_FLAG$2 = 1, COMPARE_UNORDERED_FLAG = 2;
|
|
454
|
-
var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag = "[object Map]", numberTag = "[object Number]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]";
|
|
455
|
-
var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
|
|
456
|
-
var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
|
|
457
|
-
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
458
|
-
switch (tag) {
|
|
459
|
-
case dataViewTag:
|
|
460
|
-
if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
|
|
461
|
-
return false;
|
|
462
|
-
}
|
|
463
|
-
object = object.buffer;
|
|
464
|
-
other = other.buffer;
|
|
465
|
-
case arrayBufferTag:
|
|
466
|
-
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
|
467
|
-
return false;
|
|
468
|
-
}
|
|
469
|
-
return true;
|
|
470
|
-
case boolTag:
|
|
471
|
-
case dateTag:
|
|
472
|
-
case numberTag:
|
|
473
|
-
return eq(+object, +other);
|
|
474
|
-
case errorTag:
|
|
475
|
-
return object.name == other.name && object.message == other.message;
|
|
476
|
-
case regexpTag:
|
|
477
|
-
case stringTag:
|
|
478
|
-
return object == other + "";
|
|
479
|
-
case mapTag:
|
|
480
|
-
var convert = mapToArray;
|
|
481
|
-
case setTag:
|
|
482
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
|
|
483
|
-
convert || (convert = setToArray);
|
|
484
|
-
if (object.size != other.size && !isPartial) {
|
|
485
|
-
return false;
|
|
486
|
-
}
|
|
487
|
-
var stacked = stack.get(object);
|
|
488
|
-
if (stacked) {
|
|
489
|
-
return stacked == other;
|
|
490
|
-
}
|
|
491
|
-
bitmask |= COMPARE_UNORDERED_FLAG;
|
|
492
|
-
stack.set(object, other);
|
|
493
|
-
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
|
494
|
-
stack["delete"](object);
|
|
495
|
-
return result;
|
|
496
|
-
case symbolTag:
|
|
497
|
-
if (symbolValueOf) {
|
|
498
|
-
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
return false;
|
|
502
|
-
}
|
|
503
|
-
var COMPARE_PARTIAL_FLAG$1 = 1;
|
|
504
|
-
var objectProto$1 = Object.prototype;
|
|
505
|
-
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
506
|
-
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
507
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
|
|
508
|
-
if (objLength != othLength && !isPartial) {
|
|
509
|
-
return false;
|
|
510
|
-
}
|
|
511
|
-
var index2 = objLength;
|
|
512
|
-
while (index2--) {
|
|
513
|
-
var key = objProps[index2];
|
|
514
|
-
if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
|
|
515
|
-
return false;
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
var objStacked = stack.get(object);
|
|
519
|
-
var othStacked = stack.get(other);
|
|
520
|
-
if (objStacked && othStacked) {
|
|
521
|
-
return objStacked == other && othStacked == object;
|
|
522
|
-
}
|
|
523
|
-
var result = true;
|
|
524
|
-
stack.set(object, other);
|
|
525
|
-
stack.set(other, object);
|
|
526
|
-
var skipCtor = isPartial;
|
|
527
|
-
while (++index2 < objLength) {
|
|
528
|
-
key = objProps[index2];
|
|
529
|
-
var objValue = object[key], othValue = other[key];
|
|
530
|
-
if (customizer) {
|
|
531
|
-
var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
|
|
532
|
-
}
|
|
533
|
-
if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
|
|
534
|
-
result = false;
|
|
535
|
-
break;
|
|
536
|
-
}
|
|
537
|
-
skipCtor || (skipCtor = key == "constructor");
|
|
538
|
-
}
|
|
539
|
-
if (result && !skipCtor) {
|
|
540
|
-
var objCtor = object.constructor, othCtor = other.constructor;
|
|
541
|
-
if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
|
|
542
|
-
result = false;
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
stack["delete"](object);
|
|
546
|
-
stack["delete"](other);
|
|
547
|
-
return result;
|
|
548
|
-
}
|
|
549
|
-
var COMPARE_PARTIAL_FLAG = 1;
|
|
550
|
-
var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
|
|
551
|
-
var objectProto = Object.prototype;
|
|
552
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
553
|
-
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
554
|
-
var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
|
|
555
|
-
objTag = objTag == argsTag ? objectTag : objTag;
|
|
556
|
-
othTag = othTag == argsTag ? objectTag : othTag;
|
|
557
|
-
var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
|
|
558
|
-
if (isSameTag && isBuffer(object)) {
|
|
559
|
-
if (!isBuffer(other)) {
|
|
560
|
-
return false;
|
|
561
|
-
}
|
|
562
|
-
objIsArr = true;
|
|
563
|
-
objIsObj = false;
|
|
564
|
-
}
|
|
565
|
-
if (isSameTag && !objIsObj) {
|
|
566
|
-
stack || (stack = new Stack());
|
|
567
|
-
return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
568
|
-
}
|
|
569
|
-
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
570
|
-
var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
|
|
571
|
-
if (objIsWrapped || othIsWrapped) {
|
|
572
|
-
var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
|
|
573
|
-
stack || (stack = new Stack());
|
|
574
|
-
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
if (!isSameTag) {
|
|
578
|
-
return false;
|
|
579
|
-
}
|
|
580
|
-
stack || (stack = new Stack());
|
|
581
|
-
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
|
582
|
-
}
|
|
583
|
-
function baseIsEqual(value, other, bitmask, customizer, stack) {
|
|
584
|
-
if (value === other) {
|
|
585
|
-
return true;
|
|
586
|
-
}
|
|
587
|
-
if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
|
|
588
|
-
return value !== value && other !== other;
|
|
589
|
-
}
|
|
590
|
-
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
|
591
|
-
}
|
|
592
|
-
function baseHasIn(object, key) {
|
|
593
|
-
return object != null && key in Object(object);
|
|
594
|
-
}
|
|
595
|
-
function hasPath(object, path, hasFunc) {
|
|
596
|
-
path = castPath(path, object);
|
|
597
|
-
var index2 = -1, length = path.length, result = false;
|
|
598
|
-
while (++index2 < length) {
|
|
599
|
-
var key = toKey(path[index2]);
|
|
600
|
-
if (!(result = object != null && hasFunc(object, key))) {
|
|
601
|
-
break;
|
|
602
|
-
}
|
|
603
|
-
object = object[key];
|
|
604
|
-
}
|
|
605
|
-
if (result || ++index2 != length) {
|
|
606
|
-
return result;
|
|
607
|
-
}
|
|
608
|
-
length = object == null ? 0 : object.length;
|
|
609
|
-
return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
|
|
610
|
-
}
|
|
611
|
-
function hasIn(object, path) {
|
|
612
|
-
return object != null && hasPath(object, path, baseHasIn);
|
|
613
|
-
}
|
|
614
|
-
function isEqual(value, other) {
|
|
615
|
-
return baseIsEqual(value, other);
|
|
616
|
-
}
|
|
617
|
-
function baseSet(object, path, value, customizer) {
|
|
618
|
-
if (!isObject(object)) {
|
|
619
|
-
return object;
|
|
620
|
-
}
|
|
621
|
-
path = castPath(path, object);
|
|
622
|
-
var index2 = -1, length = path.length, lastIndex = length - 1, nested = object;
|
|
623
|
-
while (nested != null && ++index2 < length) {
|
|
624
|
-
var key = toKey(path[index2]), newValue = value;
|
|
625
|
-
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
626
|
-
return object;
|
|
627
|
-
}
|
|
628
|
-
if (index2 != lastIndex) {
|
|
629
|
-
var objValue = nested[key];
|
|
630
|
-
newValue = void 0;
|
|
631
|
-
if (newValue === void 0) {
|
|
632
|
-
newValue = isObject(objValue) ? objValue : isIndex(path[index2 + 1]) ? [] : {};
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
assignValue(nested, key, newValue);
|
|
636
|
-
nested = nested[key];
|
|
637
|
-
}
|
|
638
|
-
return object;
|
|
639
|
-
}
|
|
640
|
-
function basePickBy(object, paths, predicate) {
|
|
641
|
-
var index2 = -1, length = paths.length, result = {};
|
|
642
|
-
while (++index2 < length) {
|
|
643
|
-
var path = paths[index2], value = baseGet(object, path);
|
|
644
|
-
if (predicate(value, path)) {
|
|
645
|
-
baseSet(result, castPath(path, object), value);
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
return result;
|
|
649
|
-
}
|
|
650
|
-
function basePick(object, paths) {
|
|
651
|
-
return basePickBy(object, paths, function(value, path) {
|
|
652
|
-
return hasIn(object, path);
|
|
653
|
-
});
|
|
654
|
-
}
|
|
655
|
-
var pick = flatRest(function(object, paths) {
|
|
656
|
-
return object == null ? {} : basePick(object, paths);
|
|
657
|
-
});
|
|
658
|
-
const UPDATE_MODEL_EVENT = "update:modelValue";
|
|
659
|
-
const CHANGE_EVENT = "change";
|
|
660
|
-
function debugWarn(scope, message) {
|
|
661
|
-
}
|
|
662
|
-
const ariaProps = buildProps({
|
|
663
|
-
ariaLabel: String,
|
|
664
|
-
ariaOrientation: {
|
|
665
|
-
type: String,
|
|
666
|
-
values: ["horizontal", "vertical", "undefined"]
|
|
667
|
-
},
|
|
668
|
-
ariaControls: String
|
|
669
|
-
});
|
|
670
|
-
const useAriaProps = (arias) => {
|
|
671
|
-
return pick(ariaProps, arias);
|
|
672
|
-
};
|
|
673
|
-
const defaultIdInjection = {
|
|
674
|
-
prefix: Math.floor(Math.random() * 1e4),
|
|
675
|
-
current: 0
|
|
676
|
-
};
|
|
677
|
-
const ID_INJECTION_KEY = Symbol("elIdInjection");
|
|
678
|
-
const useIdInjection = () => {
|
|
679
|
-
return getCurrentInstance() ? inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
|
|
680
|
-
};
|
|
681
|
-
const useId = (deterministicId) => {
|
|
682
|
-
const idInjection = useIdInjection();
|
|
683
|
-
const namespace = useGetDerivedNamespace();
|
|
684
|
-
const idRef = computedEager(() => unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
|
|
685
|
-
return idRef;
|
|
686
|
-
};
|
|
687
|
-
const formContextKey = Symbol("formContextKey");
|
|
688
|
-
const formItemContextKey = Symbol("formItemContextKey");
|
|
689
|
-
const useFormItem = () => {
|
|
690
|
-
const form = inject(formContextKey, void 0);
|
|
691
|
-
const formItem = inject(formItemContextKey, void 0);
|
|
692
|
-
return {
|
|
693
|
-
form,
|
|
694
|
-
formItem
|
|
695
|
-
};
|
|
696
|
-
};
|
|
697
|
-
const useFormItemInputId = (props, {
|
|
698
|
-
formItemContext,
|
|
699
|
-
disableIdGeneration,
|
|
700
|
-
disableIdManagement
|
|
701
|
-
}) => {
|
|
702
|
-
if (!disableIdGeneration) {
|
|
703
|
-
disableIdGeneration = ref(false);
|
|
704
|
-
}
|
|
705
|
-
if (!disableIdManagement) {
|
|
706
|
-
disableIdManagement = ref(false);
|
|
707
|
-
}
|
|
708
|
-
const instance = getCurrentInstance();
|
|
709
|
-
const inLabel = () => {
|
|
710
|
-
let parent = instance == null ? void 0 : instance.parent;
|
|
711
|
-
while (parent) {
|
|
712
|
-
if (parent.type.name === "ElFormItem") {
|
|
713
|
-
return false;
|
|
714
|
-
}
|
|
715
|
-
if (parent.type.name === "ElLabelWrap") {
|
|
716
|
-
return true;
|
|
717
|
-
}
|
|
718
|
-
parent = parent.parent;
|
|
719
|
-
}
|
|
720
|
-
return false;
|
|
721
|
-
};
|
|
722
|
-
const inputId = ref();
|
|
723
|
-
let idUnwatch = void 0;
|
|
724
|
-
const isLabeledByFormItem = computed(() => {
|
|
725
|
-
var _a;
|
|
726
|
-
return !!(!(props.label || props.ariaLabel) && formItemContext && formItemContext.inputIds && ((_a = formItemContext.inputIds) == null ? void 0 : _a.length) <= 1);
|
|
727
|
-
});
|
|
728
|
-
onMounted(() => {
|
|
729
|
-
idUnwatch = watch([toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
|
|
730
|
-
const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
|
|
731
|
-
if (newId !== inputId.value) {
|
|
732
|
-
if ((formItemContext == null ? void 0 : formItemContext.removeInputId) && !inLabel()) {
|
|
733
|
-
inputId.value && formItemContext.removeInputId(inputId.value);
|
|
734
|
-
if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
|
|
735
|
-
formItemContext.addInputId(newId);
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
inputId.value = newId;
|
|
739
|
-
}
|
|
740
|
-
}, { immediate: true });
|
|
741
|
-
});
|
|
742
|
-
onUnmounted(() => {
|
|
743
|
-
idUnwatch && idUnwatch();
|
|
744
|
-
if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
|
|
745
|
-
inputId.value && formItemContext.removeInputId(inputId.value);
|
|
746
|
-
}
|
|
747
|
-
});
|
|
748
|
-
return {
|
|
749
|
-
isLabeledByFormItem,
|
|
750
|
-
inputId
|
|
751
|
-
};
|
|
752
|
-
};
|
|
753
|
-
const useProp = (name) => {
|
|
754
|
-
const vm = getCurrentInstance();
|
|
755
|
-
return computed(() => {
|
|
756
|
-
var _a, _b;
|
|
757
|
-
return (_b = (_a = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a.$props) == null ? void 0 : _b[name];
|
|
758
|
-
});
|
|
759
|
-
};
|
|
760
|
-
const useFormSize = (fallback, ignore = {}) => {
|
|
761
|
-
const emptyRef = ref(void 0);
|
|
762
|
-
const size = ignore.prop ? emptyRef : useProp("size");
|
|
763
|
-
const globalConfig = ignore.global ? emptyRef : useGlobalSize();
|
|
764
|
-
const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
|
|
765
|
-
const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
|
|
766
|
-
return computed(() => size.value || unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig.value || "");
|
|
767
|
-
};
|
|
768
|
-
const useFormDisabled = (fallback) => {
|
|
769
|
-
const disabled = useProp("disabled");
|
|
770
|
-
const form = inject(formContextKey, void 0);
|
|
771
|
-
return computed(() => disabled.value || unref(fallback) || (form == null ? void 0 : form.disabled) || false);
|
|
772
|
-
};
|
|
773
|
-
const buttonGroupContextKey = Symbol("buttonGroupContextKey");
|
|
774
|
-
const useDeprecated = ({ from, replacement, scope, version, ref: ref2, type = "API" }, condition) => {
|
|
775
|
-
watch(() => unref(condition), (val) => {
|
|
776
|
-
}, {
|
|
777
|
-
immediate: true
|
|
778
|
-
});
|
|
779
|
-
};
|
|
780
|
-
const useButton = (props, emit) => {
|
|
781
|
-
useDeprecated({
|
|
782
|
-
from: "type.text",
|
|
783
|
-
replacement: "link",
|
|
784
|
-
version: "3.0.0",
|
|
785
|
-
scope: "props",
|
|
786
|
-
ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
|
|
787
|
-
}, computed(() => props.type === "text"));
|
|
788
|
-
const buttonGroupContext = inject(buttonGroupContextKey, void 0);
|
|
789
|
-
const globalConfig = useGlobalConfig("button");
|
|
790
|
-
const { form } = useFormItem();
|
|
791
|
-
const _size = useFormSize(computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
|
|
792
|
-
const _disabled = useFormDisabled();
|
|
793
|
-
const _ref = ref();
|
|
794
|
-
const slots = useSlots();
|
|
795
|
-
const _type = computed(() => {
|
|
796
|
-
var _a;
|
|
797
|
-
return props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || ((_a = globalConfig.value) == null ? void 0 : _a.type) || "";
|
|
798
|
-
});
|
|
799
|
-
const autoInsertSpace = computed(() => {
|
|
800
|
-
var _a, _b, _c;
|
|
801
|
-
return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.autoInsertSpace) != null ? _c : false;
|
|
802
|
-
});
|
|
803
|
-
const _plain = computed(() => {
|
|
804
|
-
var _a, _b, _c;
|
|
805
|
-
return (_c = (_b = props.plain) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.plain) != null ? _c : false;
|
|
806
|
-
});
|
|
807
|
-
const _round = computed(() => {
|
|
808
|
-
var _a, _b, _c;
|
|
809
|
-
return (_c = (_b = props.round) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.round) != null ? _c : false;
|
|
810
|
-
});
|
|
811
|
-
const _props = computed(() => {
|
|
812
|
-
if (props.tag === "button") {
|
|
813
|
-
return {
|
|
814
|
-
ariaDisabled: _disabled.value || props.loading,
|
|
815
|
-
disabled: _disabled.value || props.loading,
|
|
816
|
-
autofocus: props.autofocus,
|
|
817
|
-
type: props.nativeType
|
|
818
|
-
};
|
|
819
|
-
}
|
|
820
|
-
return {};
|
|
821
|
-
});
|
|
822
|
-
const shouldAddSpace = computed(() => {
|
|
823
|
-
var _a;
|
|
824
|
-
const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots);
|
|
825
|
-
if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
|
|
826
|
-
const slot = defaultSlot[0];
|
|
827
|
-
if ((slot == null ? void 0 : slot.type) === Text) {
|
|
828
|
-
const text = slot.children;
|
|
829
|
-
return new RegExp("^\\p{Unified_Ideograph}{2}$", "u").test(text.trim());
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
return false;
|
|
833
|
-
});
|
|
834
|
-
const handleClick = (evt) => {
|
|
835
|
-
if (_disabled.value || props.loading) {
|
|
836
|
-
evt.stopPropagation();
|
|
837
|
-
return;
|
|
838
|
-
}
|
|
839
|
-
if (props.nativeType === "reset") {
|
|
840
|
-
form == null ? void 0 : form.resetFields();
|
|
841
|
-
}
|
|
842
|
-
emit("click", evt);
|
|
843
|
-
};
|
|
844
|
-
return {
|
|
845
|
-
_disabled,
|
|
846
|
-
_size,
|
|
847
|
-
_type,
|
|
848
|
-
_ref,
|
|
849
|
-
_props,
|
|
850
|
-
_plain,
|
|
851
|
-
_round,
|
|
852
|
-
shouldAddSpace,
|
|
853
|
-
handleClick
|
|
854
|
-
};
|
|
855
|
-
};
|
|
856
|
-
const buttonTypes = [
|
|
857
|
-
"default",
|
|
858
|
-
"primary",
|
|
859
|
-
"success",
|
|
860
|
-
"warning",
|
|
861
|
-
"info",
|
|
862
|
-
"danger",
|
|
863
|
-
"text",
|
|
864
|
-
""
|
|
865
|
-
];
|
|
866
|
-
const buttonNativeTypes = ["button", "submit", "reset"];
|
|
867
|
-
const buttonProps = buildProps({
|
|
868
|
-
size: useSizeProp,
|
|
869
|
-
disabled: Boolean,
|
|
870
|
-
type: {
|
|
871
|
-
type: String,
|
|
872
|
-
values: buttonTypes,
|
|
873
|
-
default: ""
|
|
874
|
-
},
|
|
875
|
-
icon: {
|
|
876
|
-
type: iconPropType
|
|
877
|
-
},
|
|
878
|
-
nativeType: {
|
|
879
|
-
type: String,
|
|
880
|
-
values: buttonNativeTypes,
|
|
881
|
-
default: "button"
|
|
882
|
-
},
|
|
883
|
-
loading: Boolean,
|
|
884
|
-
loadingIcon: {
|
|
885
|
-
type: iconPropType,
|
|
886
|
-
default: () => loading_default
|
|
887
|
-
},
|
|
888
|
-
plain: {
|
|
889
|
-
type: Boolean,
|
|
890
|
-
default: void 0
|
|
891
|
-
},
|
|
892
|
-
text: Boolean,
|
|
893
|
-
link: Boolean,
|
|
894
|
-
bg: Boolean,
|
|
895
|
-
autofocus: Boolean,
|
|
896
|
-
round: {
|
|
897
|
-
type: Boolean,
|
|
898
|
-
default: void 0
|
|
899
|
-
},
|
|
900
|
-
circle: Boolean,
|
|
901
|
-
color: String,
|
|
902
|
-
dark: Boolean,
|
|
903
|
-
autoInsertSpace: {
|
|
904
|
-
type: Boolean,
|
|
905
|
-
default: void 0
|
|
906
|
-
},
|
|
907
|
-
tag: {
|
|
908
|
-
type: definePropType([String, Object]),
|
|
909
|
-
default: "button"
|
|
910
|
-
}
|
|
911
|
-
});
|
|
912
|
-
const buttonEmits = {
|
|
913
|
-
click: (evt) => evt instanceof MouseEvent
|
|
914
|
-
};
|
|
915
|
-
function bound01(n, max) {
|
|
916
|
-
if (isOnePointZero(n)) {
|
|
917
|
-
n = "100%";
|
|
918
|
-
}
|
|
919
|
-
var isPercent = isPercentage(n);
|
|
920
|
-
n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
|
|
921
|
-
if (isPercent) {
|
|
922
|
-
n = parseInt(String(n * max), 10) / 100;
|
|
923
|
-
}
|
|
924
|
-
if (Math.abs(n - max) < 1e-6) {
|
|
925
|
-
return 1;
|
|
926
|
-
}
|
|
927
|
-
if (max === 360) {
|
|
928
|
-
n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
|
|
929
|
-
} else {
|
|
930
|
-
n = n % max / parseFloat(String(max));
|
|
931
|
-
}
|
|
932
|
-
return n;
|
|
933
|
-
}
|
|
934
|
-
function clamp01(val) {
|
|
935
|
-
return Math.min(1, Math.max(0, val));
|
|
936
|
-
}
|
|
937
|
-
function isOnePointZero(n) {
|
|
938
|
-
return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
|
|
939
|
-
}
|
|
940
|
-
function isPercentage(n) {
|
|
941
|
-
return typeof n === "string" && n.indexOf("%") !== -1;
|
|
942
|
-
}
|
|
943
|
-
function boundAlpha(a) {
|
|
944
|
-
a = parseFloat(a);
|
|
945
|
-
if (isNaN(a) || a < 0 || a > 1) {
|
|
946
|
-
a = 1;
|
|
947
|
-
}
|
|
948
|
-
return a;
|
|
949
|
-
}
|
|
950
|
-
function convertToPercentage(n) {
|
|
951
|
-
if (n <= 1) {
|
|
952
|
-
return "".concat(Number(n) * 100, "%");
|
|
953
|
-
}
|
|
954
|
-
return n;
|
|
955
|
-
}
|
|
956
|
-
function pad2(c) {
|
|
957
|
-
return c.length === 1 ? "0" + c : String(c);
|
|
958
|
-
}
|
|
959
|
-
function rgbToRgb(r, g, b) {
|
|
960
|
-
return {
|
|
961
|
-
r: bound01(r, 255) * 255,
|
|
962
|
-
g: bound01(g, 255) * 255,
|
|
963
|
-
b: bound01(b, 255) * 255
|
|
964
|
-
};
|
|
965
|
-
}
|
|
966
|
-
function rgbToHsl(r, g, b) {
|
|
967
|
-
r = bound01(r, 255);
|
|
968
|
-
g = bound01(g, 255);
|
|
969
|
-
b = bound01(b, 255);
|
|
970
|
-
var max = Math.max(r, g, b);
|
|
971
|
-
var min = Math.min(r, g, b);
|
|
972
|
-
var h = 0;
|
|
973
|
-
var s = 0;
|
|
974
|
-
var l = (max + min) / 2;
|
|
975
|
-
if (max === min) {
|
|
976
|
-
s = 0;
|
|
977
|
-
h = 0;
|
|
978
|
-
} else {
|
|
979
|
-
var d = max - min;
|
|
980
|
-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
981
|
-
switch (max) {
|
|
982
|
-
case r:
|
|
983
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
984
|
-
break;
|
|
985
|
-
case g:
|
|
986
|
-
h = (b - r) / d + 2;
|
|
987
|
-
break;
|
|
988
|
-
case b:
|
|
989
|
-
h = (r - g) / d + 4;
|
|
990
|
-
break;
|
|
991
|
-
}
|
|
992
|
-
h /= 6;
|
|
993
|
-
}
|
|
994
|
-
return { h, s, l };
|
|
995
|
-
}
|
|
996
|
-
function hue2rgb(p, q, t) {
|
|
997
|
-
if (t < 0) {
|
|
998
|
-
t += 1;
|
|
999
|
-
}
|
|
1000
|
-
if (t > 1) {
|
|
1001
|
-
t -= 1;
|
|
1002
|
-
}
|
|
1003
|
-
if (t < 1 / 6) {
|
|
1004
|
-
return p + (q - p) * (6 * t);
|
|
1005
|
-
}
|
|
1006
|
-
if (t < 1 / 2) {
|
|
1007
|
-
return q;
|
|
1008
|
-
}
|
|
1009
|
-
if (t < 2 / 3) {
|
|
1010
|
-
return p + (q - p) * (2 / 3 - t) * 6;
|
|
1011
|
-
}
|
|
1012
|
-
return p;
|
|
1013
|
-
}
|
|
1014
|
-
function hslToRgb(h, s, l) {
|
|
1015
|
-
var r;
|
|
1016
|
-
var g;
|
|
1017
|
-
var b;
|
|
1018
|
-
h = bound01(h, 360);
|
|
1019
|
-
s = bound01(s, 100);
|
|
1020
|
-
l = bound01(l, 100);
|
|
1021
|
-
if (s === 0) {
|
|
1022
|
-
g = l;
|
|
1023
|
-
b = l;
|
|
1024
|
-
r = l;
|
|
1025
|
-
} else {
|
|
1026
|
-
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
1027
|
-
var p = 2 * l - q;
|
|
1028
|
-
r = hue2rgb(p, q, h + 1 / 3);
|
|
1029
|
-
g = hue2rgb(p, q, h);
|
|
1030
|
-
b = hue2rgb(p, q, h - 1 / 3);
|
|
1031
|
-
}
|
|
1032
|
-
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
1033
|
-
}
|
|
1034
|
-
function rgbToHsv(r, g, b) {
|
|
1035
|
-
r = bound01(r, 255);
|
|
1036
|
-
g = bound01(g, 255);
|
|
1037
|
-
b = bound01(b, 255);
|
|
1038
|
-
var max = Math.max(r, g, b);
|
|
1039
|
-
var min = Math.min(r, g, b);
|
|
1040
|
-
var h = 0;
|
|
1041
|
-
var v = max;
|
|
1042
|
-
var d = max - min;
|
|
1043
|
-
var s = max === 0 ? 0 : d / max;
|
|
1044
|
-
if (max === min) {
|
|
1045
|
-
h = 0;
|
|
1046
|
-
} else {
|
|
1047
|
-
switch (max) {
|
|
1048
|
-
case r:
|
|
1049
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
1050
|
-
break;
|
|
1051
|
-
case g:
|
|
1052
|
-
h = (b - r) / d + 2;
|
|
1053
|
-
break;
|
|
1054
|
-
case b:
|
|
1055
|
-
h = (r - g) / d + 4;
|
|
1056
|
-
break;
|
|
1057
|
-
}
|
|
1058
|
-
h /= 6;
|
|
1059
|
-
}
|
|
1060
|
-
return { h, s, v };
|
|
1061
|
-
}
|
|
1062
|
-
function hsvToRgb(h, s, v) {
|
|
1063
|
-
h = bound01(h, 360) * 6;
|
|
1064
|
-
s = bound01(s, 100);
|
|
1065
|
-
v = bound01(v, 100);
|
|
1066
|
-
var i = Math.floor(h);
|
|
1067
|
-
var f = h - i;
|
|
1068
|
-
var p = v * (1 - s);
|
|
1069
|
-
var q = v * (1 - f * s);
|
|
1070
|
-
var t = v * (1 - (1 - f) * s);
|
|
1071
|
-
var mod = i % 6;
|
|
1072
|
-
var r = [v, q, p, p, t, v][mod];
|
|
1073
|
-
var g = [t, v, v, q, p, p][mod];
|
|
1074
|
-
var b = [p, p, t, v, v, q][mod];
|
|
1075
|
-
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
1076
|
-
}
|
|
1077
|
-
function rgbToHex(r, g, b, allow3Char) {
|
|
1078
|
-
var hex = [
|
|
1079
|
-
pad2(Math.round(r).toString(16)),
|
|
1080
|
-
pad2(Math.round(g).toString(16)),
|
|
1081
|
-
pad2(Math.round(b).toString(16))
|
|
1082
|
-
];
|
|
1083
|
-
if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
|
|
1084
|
-
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
1085
|
-
}
|
|
1086
|
-
return hex.join("");
|
|
1087
|
-
}
|
|
1088
|
-
function rgbaToHex(r, g, b, a, allow4Char) {
|
|
1089
|
-
var hex = [
|
|
1090
|
-
pad2(Math.round(r).toString(16)),
|
|
1091
|
-
pad2(Math.round(g).toString(16)),
|
|
1092
|
-
pad2(Math.round(b).toString(16)),
|
|
1093
|
-
pad2(convertDecimalToHex(a))
|
|
1094
|
-
];
|
|
1095
|
-
if (allow4Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1)) && hex[3].startsWith(hex[3].charAt(1))) {
|
|
1096
|
-
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
|
|
1097
|
-
}
|
|
1098
|
-
return hex.join("");
|
|
1099
|
-
}
|
|
1100
|
-
function convertDecimalToHex(d) {
|
|
1101
|
-
return Math.round(parseFloat(d) * 255).toString(16);
|
|
1102
|
-
}
|
|
1103
|
-
function convertHexToDecimal(h) {
|
|
1104
|
-
return parseIntFromHex(h) / 255;
|
|
1105
|
-
}
|
|
1106
|
-
function parseIntFromHex(val) {
|
|
1107
|
-
return parseInt(val, 16);
|
|
1108
|
-
}
|
|
1109
|
-
function numberInputToObject(color) {
|
|
1110
|
-
return {
|
|
1111
|
-
r: color >> 16,
|
|
1112
|
-
g: (color & 65280) >> 8,
|
|
1113
|
-
b: color & 255
|
|
1114
|
-
};
|
|
1115
|
-
}
|
|
1116
|
-
var names = {
|
|
1117
|
-
aliceblue: "#f0f8ff",
|
|
1118
|
-
antiquewhite: "#faebd7",
|
|
1119
|
-
aqua: "#00ffff",
|
|
1120
|
-
aquamarine: "#7fffd4",
|
|
1121
|
-
azure: "#f0ffff",
|
|
1122
|
-
beige: "#f5f5dc",
|
|
1123
|
-
bisque: "#ffe4c4",
|
|
1124
|
-
black: "#000000",
|
|
1125
|
-
blanchedalmond: "#ffebcd",
|
|
1126
|
-
blue: "#0000ff",
|
|
1127
|
-
blueviolet: "#8a2be2",
|
|
1128
|
-
brown: "#a52a2a",
|
|
1129
|
-
burlywood: "#deb887",
|
|
1130
|
-
cadetblue: "#5f9ea0",
|
|
1131
|
-
chartreuse: "#7fff00",
|
|
1132
|
-
chocolate: "#d2691e",
|
|
1133
|
-
coral: "#ff7f50",
|
|
1134
|
-
cornflowerblue: "#6495ed",
|
|
1135
|
-
cornsilk: "#fff8dc",
|
|
1136
|
-
crimson: "#dc143c",
|
|
1137
|
-
cyan: "#00ffff",
|
|
1138
|
-
darkblue: "#00008b",
|
|
1139
|
-
darkcyan: "#008b8b",
|
|
1140
|
-
darkgoldenrod: "#b8860b",
|
|
1141
|
-
darkgray: "#a9a9a9",
|
|
1142
|
-
darkgreen: "#006400",
|
|
1143
|
-
darkgrey: "#a9a9a9",
|
|
1144
|
-
darkkhaki: "#bdb76b",
|
|
1145
|
-
darkmagenta: "#8b008b",
|
|
1146
|
-
darkolivegreen: "#556b2f",
|
|
1147
|
-
darkorange: "#ff8c00",
|
|
1148
|
-
darkorchid: "#9932cc",
|
|
1149
|
-
darkred: "#8b0000",
|
|
1150
|
-
darksalmon: "#e9967a",
|
|
1151
|
-
darkseagreen: "#8fbc8f",
|
|
1152
|
-
darkslateblue: "#483d8b",
|
|
1153
|
-
darkslategray: "#2f4f4f",
|
|
1154
|
-
darkslategrey: "#2f4f4f",
|
|
1155
|
-
darkturquoise: "#00ced1",
|
|
1156
|
-
darkviolet: "#9400d3",
|
|
1157
|
-
deeppink: "#ff1493",
|
|
1158
|
-
deepskyblue: "#00bfff",
|
|
1159
|
-
dimgray: "#696969",
|
|
1160
|
-
dimgrey: "#696969",
|
|
1161
|
-
dodgerblue: "#1e90ff",
|
|
1162
|
-
firebrick: "#b22222",
|
|
1163
|
-
floralwhite: "#fffaf0",
|
|
1164
|
-
forestgreen: "#228b22",
|
|
1165
|
-
fuchsia: "#ff00ff",
|
|
1166
|
-
gainsboro: "#dcdcdc",
|
|
1167
|
-
ghostwhite: "#f8f8ff",
|
|
1168
|
-
goldenrod: "#daa520",
|
|
1169
|
-
gold: "#ffd700",
|
|
1170
|
-
gray: "#808080",
|
|
1171
|
-
green: "#008000",
|
|
1172
|
-
greenyellow: "#adff2f",
|
|
1173
|
-
grey: "#808080",
|
|
1174
|
-
honeydew: "#f0fff0",
|
|
1175
|
-
hotpink: "#ff69b4",
|
|
1176
|
-
indianred: "#cd5c5c",
|
|
1177
|
-
indigo: "#4b0082",
|
|
1178
|
-
ivory: "#fffff0",
|
|
1179
|
-
khaki: "#f0e68c",
|
|
1180
|
-
lavenderblush: "#fff0f5",
|
|
1181
|
-
lavender: "#e6e6fa",
|
|
1182
|
-
lawngreen: "#7cfc00",
|
|
1183
|
-
lemonchiffon: "#fffacd",
|
|
1184
|
-
lightblue: "#add8e6",
|
|
1185
|
-
lightcoral: "#f08080",
|
|
1186
|
-
lightcyan: "#e0ffff",
|
|
1187
|
-
lightgoldenrodyellow: "#fafad2",
|
|
1188
|
-
lightgray: "#d3d3d3",
|
|
1189
|
-
lightgreen: "#90ee90",
|
|
1190
|
-
lightgrey: "#d3d3d3",
|
|
1191
|
-
lightpink: "#ffb6c1",
|
|
1192
|
-
lightsalmon: "#ffa07a",
|
|
1193
|
-
lightseagreen: "#20b2aa",
|
|
1194
|
-
lightskyblue: "#87cefa",
|
|
1195
|
-
lightslategray: "#778899",
|
|
1196
|
-
lightslategrey: "#778899",
|
|
1197
|
-
lightsteelblue: "#b0c4de",
|
|
1198
|
-
lightyellow: "#ffffe0",
|
|
1199
|
-
lime: "#00ff00",
|
|
1200
|
-
limegreen: "#32cd32",
|
|
1201
|
-
linen: "#faf0e6",
|
|
1202
|
-
magenta: "#ff00ff",
|
|
1203
|
-
maroon: "#800000",
|
|
1204
|
-
mediumaquamarine: "#66cdaa",
|
|
1205
|
-
mediumblue: "#0000cd",
|
|
1206
|
-
mediumorchid: "#ba55d3",
|
|
1207
|
-
mediumpurple: "#9370db",
|
|
1208
|
-
mediumseagreen: "#3cb371",
|
|
1209
|
-
mediumslateblue: "#7b68ee",
|
|
1210
|
-
mediumspringgreen: "#00fa9a",
|
|
1211
|
-
mediumturquoise: "#48d1cc",
|
|
1212
|
-
mediumvioletred: "#c71585",
|
|
1213
|
-
midnightblue: "#191970",
|
|
1214
|
-
mintcream: "#f5fffa",
|
|
1215
|
-
mistyrose: "#ffe4e1",
|
|
1216
|
-
moccasin: "#ffe4b5",
|
|
1217
|
-
navajowhite: "#ffdead",
|
|
1218
|
-
navy: "#000080",
|
|
1219
|
-
oldlace: "#fdf5e6",
|
|
1220
|
-
olive: "#808000",
|
|
1221
|
-
olivedrab: "#6b8e23",
|
|
1222
|
-
orange: "#ffa500",
|
|
1223
|
-
orangered: "#ff4500",
|
|
1224
|
-
orchid: "#da70d6",
|
|
1225
|
-
palegoldenrod: "#eee8aa",
|
|
1226
|
-
palegreen: "#98fb98",
|
|
1227
|
-
paleturquoise: "#afeeee",
|
|
1228
|
-
palevioletred: "#db7093",
|
|
1229
|
-
papayawhip: "#ffefd5",
|
|
1230
|
-
peachpuff: "#ffdab9",
|
|
1231
|
-
peru: "#cd853f",
|
|
1232
|
-
pink: "#ffc0cb",
|
|
1233
|
-
plum: "#dda0dd",
|
|
1234
|
-
powderblue: "#b0e0e6",
|
|
1235
|
-
purple: "#800080",
|
|
1236
|
-
rebeccapurple: "#663399",
|
|
1237
|
-
red: "#ff0000",
|
|
1238
|
-
rosybrown: "#bc8f8f",
|
|
1239
|
-
royalblue: "#4169e1",
|
|
1240
|
-
saddlebrown: "#8b4513",
|
|
1241
|
-
salmon: "#fa8072",
|
|
1242
|
-
sandybrown: "#f4a460",
|
|
1243
|
-
seagreen: "#2e8b57",
|
|
1244
|
-
seashell: "#fff5ee",
|
|
1245
|
-
sienna: "#a0522d",
|
|
1246
|
-
silver: "#c0c0c0",
|
|
1247
|
-
skyblue: "#87ceeb",
|
|
1248
|
-
slateblue: "#6a5acd",
|
|
1249
|
-
slategray: "#708090",
|
|
1250
|
-
slategrey: "#708090",
|
|
1251
|
-
snow: "#fffafa",
|
|
1252
|
-
springgreen: "#00ff7f",
|
|
1253
|
-
steelblue: "#4682b4",
|
|
1254
|
-
tan: "#d2b48c",
|
|
1255
|
-
teal: "#008080",
|
|
1256
|
-
thistle: "#d8bfd8",
|
|
1257
|
-
tomato: "#ff6347",
|
|
1258
|
-
turquoise: "#40e0d0",
|
|
1259
|
-
violet: "#ee82ee",
|
|
1260
|
-
wheat: "#f5deb3",
|
|
1261
|
-
white: "#ffffff",
|
|
1262
|
-
whitesmoke: "#f5f5f5",
|
|
1263
|
-
yellow: "#ffff00",
|
|
1264
|
-
yellowgreen: "#9acd32"
|
|
1265
|
-
};
|
|
1266
|
-
function inputToRGB(color) {
|
|
1267
|
-
var rgb = { r: 0, g: 0, b: 0 };
|
|
1268
|
-
var a = 1;
|
|
1269
|
-
var s = null;
|
|
1270
|
-
var v = null;
|
|
1271
|
-
var l = null;
|
|
1272
|
-
var ok = false;
|
|
1273
|
-
var format = false;
|
|
1274
|
-
if (typeof color === "string") {
|
|
1275
|
-
color = stringInputToObject(color);
|
|
1276
|
-
}
|
|
1277
|
-
if (typeof color === "object") {
|
|
1278
|
-
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
1279
|
-
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
1280
|
-
ok = true;
|
|
1281
|
-
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
|
1282
|
-
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
1283
|
-
s = convertToPercentage(color.s);
|
|
1284
|
-
v = convertToPercentage(color.v);
|
|
1285
|
-
rgb = hsvToRgb(color.h, s, v);
|
|
1286
|
-
ok = true;
|
|
1287
|
-
format = "hsv";
|
|
1288
|
-
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
1289
|
-
s = convertToPercentage(color.s);
|
|
1290
|
-
l = convertToPercentage(color.l);
|
|
1291
|
-
rgb = hslToRgb(color.h, s, l);
|
|
1292
|
-
ok = true;
|
|
1293
|
-
format = "hsl";
|
|
1294
|
-
}
|
|
1295
|
-
if (Object.prototype.hasOwnProperty.call(color, "a")) {
|
|
1296
|
-
a = color.a;
|
|
1297
|
-
}
|
|
1298
|
-
}
|
|
1299
|
-
a = boundAlpha(a);
|
|
1300
|
-
return {
|
|
1301
|
-
ok,
|
|
1302
|
-
format: color.format || format,
|
|
1303
|
-
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
1304
|
-
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
1305
|
-
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
1306
|
-
a
|
|
1307
|
-
};
|
|
1308
|
-
}
|
|
1309
|
-
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
|
1310
|
-
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
|
|
1311
|
-
var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
|
|
1312
|
-
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
|
|
1313
|
-
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
|
|
1314
|
-
var matchers = {
|
|
1315
|
-
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
1316
|
-
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
|
1317
|
-
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
|
|
1318
|
-
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
|
|
1319
|
-
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
|
|
1320
|
-
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
|
|
1321
|
-
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
|
|
1322
|
-
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
1323
|
-
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
1324
|
-
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
1325
|
-
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
1326
|
-
};
|
|
1327
|
-
function stringInputToObject(color) {
|
|
1328
|
-
color = color.trim().toLowerCase();
|
|
1329
|
-
if (color.length === 0) {
|
|
1330
|
-
return false;
|
|
1331
|
-
}
|
|
1332
|
-
var named = false;
|
|
1333
|
-
if (names[color]) {
|
|
1334
|
-
color = names[color];
|
|
1335
|
-
named = true;
|
|
1336
|
-
} else if (color === "transparent") {
|
|
1337
|
-
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
|
|
1338
|
-
}
|
|
1339
|
-
var match = matchers.rgb.exec(color);
|
|
1340
|
-
if (match) {
|
|
1341
|
-
return { r: match[1], g: match[2], b: match[3] };
|
|
1342
|
-
}
|
|
1343
|
-
match = matchers.rgba.exec(color);
|
|
1344
|
-
if (match) {
|
|
1345
|
-
return { r: match[1], g: match[2], b: match[3], a: match[4] };
|
|
1346
|
-
}
|
|
1347
|
-
match = matchers.hsl.exec(color);
|
|
1348
|
-
if (match) {
|
|
1349
|
-
return { h: match[1], s: match[2], l: match[3] };
|
|
1350
|
-
}
|
|
1351
|
-
match = matchers.hsla.exec(color);
|
|
1352
|
-
if (match) {
|
|
1353
|
-
return { h: match[1], s: match[2], l: match[3], a: match[4] };
|
|
1354
|
-
}
|
|
1355
|
-
match = matchers.hsv.exec(color);
|
|
1356
|
-
if (match) {
|
|
1357
|
-
return { h: match[1], s: match[2], v: match[3] };
|
|
1358
|
-
}
|
|
1359
|
-
match = matchers.hsva.exec(color);
|
|
1360
|
-
if (match) {
|
|
1361
|
-
return { h: match[1], s: match[2], v: match[3], a: match[4] };
|
|
1362
|
-
}
|
|
1363
|
-
match = matchers.hex8.exec(color);
|
|
1364
|
-
if (match) {
|
|
1365
|
-
return {
|
|
1366
|
-
r: parseIntFromHex(match[1]),
|
|
1367
|
-
g: parseIntFromHex(match[2]),
|
|
1368
|
-
b: parseIntFromHex(match[3]),
|
|
1369
|
-
a: convertHexToDecimal(match[4]),
|
|
1370
|
-
format: named ? "name" : "hex8"
|
|
1371
|
-
};
|
|
1372
|
-
}
|
|
1373
|
-
match = matchers.hex6.exec(color);
|
|
1374
|
-
if (match) {
|
|
1375
|
-
return {
|
|
1376
|
-
r: parseIntFromHex(match[1]),
|
|
1377
|
-
g: parseIntFromHex(match[2]),
|
|
1378
|
-
b: parseIntFromHex(match[3]),
|
|
1379
|
-
format: named ? "name" : "hex"
|
|
1380
|
-
};
|
|
1381
|
-
}
|
|
1382
|
-
match = matchers.hex4.exec(color);
|
|
1383
|
-
if (match) {
|
|
1384
|
-
return {
|
|
1385
|
-
r: parseIntFromHex(match[1] + match[1]),
|
|
1386
|
-
g: parseIntFromHex(match[2] + match[2]),
|
|
1387
|
-
b: parseIntFromHex(match[3] + match[3]),
|
|
1388
|
-
a: convertHexToDecimal(match[4] + match[4]),
|
|
1389
|
-
format: named ? "name" : "hex8"
|
|
1390
|
-
};
|
|
1391
|
-
}
|
|
1392
|
-
match = matchers.hex3.exec(color);
|
|
1393
|
-
if (match) {
|
|
1394
|
-
return {
|
|
1395
|
-
r: parseIntFromHex(match[1] + match[1]),
|
|
1396
|
-
g: parseIntFromHex(match[2] + match[2]),
|
|
1397
|
-
b: parseIntFromHex(match[3] + match[3]),
|
|
1398
|
-
format: named ? "name" : "hex"
|
|
1399
|
-
};
|
|
1400
|
-
}
|
|
1401
|
-
return false;
|
|
1402
|
-
}
|
|
1403
|
-
function isValidCSSUnit(color) {
|
|
1404
|
-
return Boolean(matchers.CSS_UNIT.exec(String(color)));
|
|
1405
|
-
}
|
|
1406
|
-
var TinyColor = (
|
|
1407
|
-
/** @class */
|
|
1408
|
-
(function() {
|
|
1409
|
-
function TinyColor2(color, opts) {
|
|
1410
|
-
if (color === void 0) {
|
|
1411
|
-
color = "";
|
|
1412
|
-
}
|
|
1413
|
-
if (opts === void 0) {
|
|
1414
|
-
opts = {};
|
|
1415
|
-
}
|
|
1416
|
-
var _a;
|
|
1417
|
-
if (color instanceof TinyColor2) {
|
|
1418
|
-
return color;
|
|
1419
|
-
}
|
|
1420
|
-
if (typeof color === "number") {
|
|
1421
|
-
color = numberInputToObject(color);
|
|
1422
|
-
}
|
|
1423
|
-
this.originalInput = color;
|
|
1424
|
-
var rgb = inputToRGB(color);
|
|
1425
|
-
this.originalInput = color;
|
|
1426
|
-
this.r = rgb.r;
|
|
1427
|
-
this.g = rgb.g;
|
|
1428
|
-
this.b = rgb.b;
|
|
1429
|
-
this.a = rgb.a;
|
|
1430
|
-
this.roundA = Math.round(100 * this.a) / 100;
|
|
1431
|
-
this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format;
|
|
1432
|
-
this.gradientType = opts.gradientType;
|
|
1433
|
-
if (this.r < 1) {
|
|
1434
|
-
this.r = Math.round(this.r);
|
|
1435
|
-
}
|
|
1436
|
-
if (this.g < 1) {
|
|
1437
|
-
this.g = Math.round(this.g);
|
|
1438
|
-
}
|
|
1439
|
-
if (this.b < 1) {
|
|
1440
|
-
this.b = Math.round(this.b);
|
|
1441
|
-
}
|
|
1442
|
-
this.isValid = rgb.ok;
|
|
1443
|
-
}
|
|
1444
|
-
TinyColor2.prototype.isDark = function() {
|
|
1445
|
-
return this.getBrightness() < 128;
|
|
1446
|
-
};
|
|
1447
|
-
TinyColor2.prototype.isLight = function() {
|
|
1448
|
-
return !this.isDark();
|
|
1449
|
-
};
|
|
1450
|
-
TinyColor2.prototype.getBrightness = function() {
|
|
1451
|
-
var rgb = this.toRgb();
|
|
1452
|
-
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
|
|
1453
|
-
};
|
|
1454
|
-
TinyColor2.prototype.getLuminance = function() {
|
|
1455
|
-
var rgb = this.toRgb();
|
|
1456
|
-
var R;
|
|
1457
|
-
var G;
|
|
1458
|
-
var B;
|
|
1459
|
-
var RsRGB = rgb.r / 255;
|
|
1460
|
-
var GsRGB = rgb.g / 255;
|
|
1461
|
-
var BsRGB = rgb.b / 255;
|
|
1462
|
-
if (RsRGB <= 0.03928) {
|
|
1463
|
-
R = RsRGB / 12.92;
|
|
1464
|
-
} else {
|
|
1465
|
-
R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
|
1466
|
-
}
|
|
1467
|
-
if (GsRGB <= 0.03928) {
|
|
1468
|
-
G = GsRGB / 12.92;
|
|
1469
|
-
} else {
|
|
1470
|
-
G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
1471
|
-
}
|
|
1472
|
-
if (BsRGB <= 0.03928) {
|
|
1473
|
-
B = BsRGB / 12.92;
|
|
1474
|
-
} else {
|
|
1475
|
-
B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
1476
|
-
}
|
|
1477
|
-
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
1478
|
-
};
|
|
1479
|
-
TinyColor2.prototype.getAlpha = function() {
|
|
1480
|
-
return this.a;
|
|
1481
|
-
};
|
|
1482
|
-
TinyColor2.prototype.setAlpha = function(alpha) {
|
|
1483
|
-
this.a = boundAlpha(alpha);
|
|
1484
|
-
this.roundA = Math.round(100 * this.a) / 100;
|
|
1485
|
-
return this;
|
|
1486
|
-
};
|
|
1487
|
-
TinyColor2.prototype.isMonochrome = function() {
|
|
1488
|
-
var s = this.toHsl().s;
|
|
1489
|
-
return s === 0;
|
|
1490
|
-
};
|
|
1491
|
-
TinyColor2.prototype.toHsv = function() {
|
|
1492
|
-
var hsv = rgbToHsv(this.r, this.g, this.b);
|
|
1493
|
-
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
|
|
1494
|
-
};
|
|
1495
|
-
TinyColor2.prototype.toHsvString = function() {
|
|
1496
|
-
var hsv = rgbToHsv(this.r, this.g, this.b);
|
|
1497
|
-
var h = Math.round(hsv.h * 360);
|
|
1498
|
-
var s = Math.round(hsv.s * 100);
|
|
1499
|
-
var v = Math.round(hsv.v * 100);
|
|
1500
|
-
return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
|
|
1501
|
-
};
|
|
1502
|
-
TinyColor2.prototype.toHsl = function() {
|
|
1503
|
-
var hsl = rgbToHsl(this.r, this.g, this.b);
|
|
1504
|
-
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
|
|
1505
|
-
};
|
|
1506
|
-
TinyColor2.prototype.toHslString = function() {
|
|
1507
|
-
var hsl = rgbToHsl(this.r, this.g, this.b);
|
|
1508
|
-
var h = Math.round(hsl.h * 360);
|
|
1509
|
-
var s = Math.round(hsl.s * 100);
|
|
1510
|
-
var l = Math.round(hsl.l * 100);
|
|
1511
|
-
return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
|
|
1512
|
-
};
|
|
1513
|
-
TinyColor2.prototype.toHex = function(allow3Char) {
|
|
1514
|
-
if (allow3Char === void 0) {
|
|
1515
|
-
allow3Char = false;
|
|
1516
|
-
}
|
|
1517
|
-
return rgbToHex(this.r, this.g, this.b, allow3Char);
|
|
1518
|
-
};
|
|
1519
|
-
TinyColor2.prototype.toHexString = function(allow3Char) {
|
|
1520
|
-
if (allow3Char === void 0) {
|
|
1521
|
-
allow3Char = false;
|
|
1522
|
-
}
|
|
1523
|
-
return "#" + this.toHex(allow3Char);
|
|
1524
|
-
};
|
|
1525
|
-
TinyColor2.prototype.toHex8 = function(allow4Char) {
|
|
1526
|
-
if (allow4Char === void 0) {
|
|
1527
|
-
allow4Char = false;
|
|
1528
|
-
}
|
|
1529
|
-
return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
|
|
1530
|
-
};
|
|
1531
|
-
TinyColor2.prototype.toHex8String = function(allow4Char) {
|
|
1532
|
-
if (allow4Char === void 0) {
|
|
1533
|
-
allow4Char = false;
|
|
1534
|
-
}
|
|
1535
|
-
return "#" + this.toHex8(allow4Char);
|
|
1536
|
-
};
|
|
1537
|
-
TinyColor2.prototype.toHexShortString = function(allowShortChar) {
|
|
1538
|
-
if (allowShortChar === void 0) {
|
|
1539
|
-
allowShortChar = false;
|
|
1540
|
-
}
|
|
1541
|
-
return this.a === 1 ? this.toHexString(allowShortChar) : this.toHex8String(allowShortChar);
|
|
1542
|
-
};
|
|
1543
|
-
TinyColor2.prototype.toRgb = function() {
|
|
1544
|
-
return {
|
|
1545
|
-
r: Math.round(this.r),
|
|
1546
|
-
g: Math.round(this.g),
|
|
1547
|
-
b: Math.round(this.b),
|
|
1548
|
-
a: this.a
|
|
1549
|
-
};
|
|
1550
|
-
};
|
|
1551
|
-
TinyColor2.prototype.toRgbString = function() {
|
|
1552
|
-
var r = Math.round(this.r);
|
|
1553
|
-
var g = Math.round(this.g);
|
|
1554
|
-
var b = Math.round(this.b);
|
|
1555
|
-
return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
|
|
1556
|
-
};
|
|
1557
|
-
TinyColor2.prototype.toPercentageRgb = function() {
|
|
1558
|
-
var fmt = function(x) {
|
|
1559
|
-
return "".concat(Math.round(bound01(x, 255) * 100), "%");
|
|
1560
|
-
};
|
|
1561
|
-
return {
|
|
1562
|
-
r: fmt(this.r),
|
|
1563
|
-
g: fmt(this.g),
|
|
1564
|
-
b: fmt(this.b),
|
|
1565
|
-
a: this.a
|
|
1566
|
-
};
|
|
1567
|
-
};
|
|
1568
|
-
TinyColor2.prototype.toPercentageRgbString = function() {
|
|
1569
|
-
var rnd = function(x) {
|
|
1570
|
-
return Math.round(bound01(x, 255) * 100);
|
|
1571
|
-
};
|
|
1572
|
-
return this.a === 1 ? "rgb(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%)") : "rgba(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%, ").concat(this.roundA, ")");
|
|
1573
|
-
};
|
|
1574
|
-
TinyColor2.prototype.toName = function() {
|
|
1575
|
-
if (this.a === 0) {
|
|
1576
|
-
return "transparent";
|
|
1577
|
-
}
|
|
1578
|
-
if (this.a < 1) {
|
|
1579
|
-
return false;
|
|
1580
|
-
}
|
|
1581
|
-
var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
|
|
1582
|
-
for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) {
|
|
1583
|
-
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
1584
|
-
if (hex === value) {
|
|
1585
|
-
return key;
|
|
1586
|
-
}
|
|
1587
|
-
}
|
|
1588
|
-
return false;
|
|
1589
|
-
};
|
|
1590
|
-
TinyColor2.prototype.toString = function(format) {
|
|
1591
|
-
var formatSet = Boolean(format);
|
|
1592
|
-
format = format !== null && format !== void 0 ? format : this.format;
|
|
1593
|
-
var formattedString = false;
|
|
1594
|
-
var hasAlpha = this.a < 1 && this.a >= 0;
|
|
1595
|
-
var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
|
|
1596
|
-
if (needsAlphaFormat) {
|
|
1597
|
-
if (format === "name" && this.a === 0) {
|
|
1598
|
-
return this.toName();
|
|
1599
|
-
}
|
|
1600
|
-
return this.toRgbString();
|
|
1601
|
-
}
|
|
1602
|
-
if (format === "rgb") {
|
|
1603
|
-
formattedString = this.toRgbString();
|
|
1604
|
-
}
|
|
1605
|
-
if (format === "prgb") {
|
|
1606
|
-
formattedString = this.toPercentageRgbString();
|
|
1607
|
-
}
|
|
1608
|
-
if (format === "hex" || format === "hex6") {
|
|
1609
|
-
formattedString = this.toHexString();
|
|
1610
|
-
}
|
|
1611
|
-
if (format === "hex3") {
|
|
1612
|
-
formattedString = this.toHexString(true);
|
|
1613
|
-
}
|
|
1614
|
-
if (format === "hex4") {
|
|
1615
|
-
formattedString = this.toHex8String(true);
|
|
1616
|
-
}
|
|
1617
|
-
if (format === "hex8") {
|
|
1618
|
-
formattedString = this.toHex8String();
|
|
1619
|
-
}
|
|
1620
|
-
if (format === "name") {
|
|
1621
|
-
formattedString = this.toName();
|
|
1622
|
-
}
|
|
1623
|
-
if (format === "hsl") {
|
|
1624
|
-
formattedString = this.toHslString();
|
|
1625
|
-
}
|
|
1626
|
-
if (format === "hsv") {
|
|
1627
|
-
formattedString = this.toHsvString();
|
|
1628
|
-
}
|
|
1629
|
-
return formattedString || this.toHexString();
|
|
1630
|
-
};
|
|
1631
|
-
TinyColor2.prototype.toNumber = function() {
|
|
1632
|
-
return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
|
|
1633
|
-
};
|
|
1634
|
-
TinyColor2.prototype.clone = function() {
|
|
1635
|
-
return new TinyColor2(this.toString());
|
|
1636
|
-
};
|
|
1637
|
-
TinyColor2.prototype.lighten = function(amount) {
|
|
1638
|
-
if (amount === void 0) {
|
|
1639
|
-
amount = 10;
|
|
1640
|
-
}
|
|
1641
|
-
var hsl = this.toHsl();
|
|
1642
|
-
hsl.l += amount / 100;
|
|
1643
|
-
hsl.l = clamp01(hsl.l);
|
|
1644
|
-
return new TinyColor2(hsl);
|
|
1645
|
-
};
|
|
1646
|
-
TinyColor2.prototype.brighten = function(amount) {
|
|
1647
|
-
if (amount === void 0) {
|
|
1648
|
-
amount = 10;
|
|
1649
|
-
}
|
|
1650
|
-
var rgb = this.toRgb();
|
|
1651
|
-
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
|
|
1652
|
-
rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
|
|
1653
|
-
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
|
|
1654
|
-
return new TinyColor2(rgb);
|
|
1655
|
-
};
|
|
1656
|
-
TinyColor2.prototype.darken = function(amount) {
|
|
1657
|
-
if (amount === void 0) {
|
|
1658
|
-
amount = 10;
|
|
1659
|
-
}
|
|
1660
|
-
var hsl = this.toHsl();
|
|
1661
|
-
hsl.l -= amount / 100;
|
|
1662
|
-
hsl.l = clamp01(hsl.l);
|
|
1663
|
-
return new TinyColor2(hsl);
|
|
1664
|
-
};
|
|
1665
|
-
TinyColor2.prototype.tint = function(amount) {
|
|
1666
|
-
if (amount === void 0) {
|
|
1667
|
-
amount = 10;
|
|
1668
|
-
}
|
|
1669
|
-
return this.mix("white", amount);
|
|
1670
|
-
};
|
|
1671
|
-
TinyColor2.prototype.shade = function(amount) {
|
|
1672
|
-
if (amount === void 0) {
|
|
1673
|
-
amount = 10;
|
|
1674
|
-
}
|
|
1675
|
-
return this.mix("black", amount);
|
|
1676
|
-
};
|
|
1677
|
-
TinyColor2.prototype.desaturate = function(amount) {
|
|
1678
|
-
if (amount === void 0) {
|
|
1679
|
-
amount = 10;
|
|
1680
|
-
}
|
|
1681
|
-
var hsl = this.toHsl();
|
|
1682
|
-
hsl.s -= amount / 100;
|
|
1683
|
-
hsl.s = clamp01(hsl.s);
|
|
1684
|
-
return new TinyColor2(hsl);
|
|
1685
|
-
};
|
|
1686
|
-
TinyColor2.prototype.saturate = function(amount) {
|
|
1687
|
-
if (amount === void 0) {
|
|
1688
|
-
amount = 10;
|
|
1689
|
-
}
|
|
1690
|
-
var hsl = this.toHsl();
|
|
1691
|
-
hsl.s += amount / 100;
|
|
1692
|
-
hsl.s = clamp01(hsl.s);
|
|
1693
|
-
return new TinyColor2(hsl);
|
|
1694
|
-
};
|
|
1695
|
-
TinyColor2.prototype.greyscale = function() {
|
|
1696
|
-
return this.desaturate(100);
|
|
1697
|
-
};
|
|
1698
|
-
TinyColor2.prototype.spin = function(amount) {
|
|
1699
|
-
var hsl = this.toHsl();
|
|
1700
|
-
var hue = (hsl.h + amount) % 360;
|
|
1701
|
-
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
1702
|
-
return new TinyColor2(hsl);
|
|
1703
|
-
};
|
|
1704
|
-
TinyColor2.prototype.mix = function(color, amount) {
|
|
1705
|
-
if (amount === void 0) {
|
|
1706
|
-
amount = 50;
|
|
1707
|
-
}
|
|
1708
|
-
var rgb1 = this.toRgb();
|
|
1709
|
-
var rgb2 = new TinyColor2(color).toRgb();
|
|
1710
|
-
var p = amount / 100;
|
|
1711
|
-
var rgba = {
|
|
1712
|
-
r: (rgb2.r - rgb1.r) * p + rgb1.r,
|
|
1713
|
-
g: (rgb2.g - rgb1.g) * p + rgb1.g,
|
|
1714
|
-
b: (rgb2.b - rgb1.b) * p + rgb1.b,
|
|
1715
|
-
a: (rgb2.a - rgb1.a) * p + rgb1.a
|
|
1716
|
-
};
|
|
1717
|
-
return new TinyColor2(rgba);
|
|
1718
|
-
};
|
|
1719
|
-
TinyColor2.prototype.analogous = function(results, slices) {
|
|
1720
|
-
if (results === void 0) {
|
|
1721
|
-
results = 6;
|
|
1722
|
-
}
|
|
1723
|
-
if (slices === void 0) {
|
|
1724
|
-
slices = 30;
|
|
1725
|
-
}
|
|
1726
|
-
var hsl = this.toHsl();
|
|
1727
|
-
var part = 360 / slices;
|
|
1728
|
-
var ret = [this];
|
|
1729
|
-
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
|
|
1730
|
-
hsl.h = (hsl.h + part) % 360;
|
|
1731
|
-
ret.push(new TinyColor2(hsl));
|
|
1732
|
-
}
|
|
1733
|
-
return ret;
|
|
1734
|
-
};
|
|
1735
|
-
TinyColor2.prototype.complement = function() {
|
|
1736
|
-
var hsl = this.toHsl();
|
|
1737
|
-
hsl.h = (hsl.h + 180) % 360;
|
|
1738
|
-
return new TinyColor2(hsl);
|
|
1739
|
-
};
|
|
1740
|
-
TinyColor2.prototype.monochromatic = function(results) {
|
|
1741
|
-
if (results === void 0) {
|
|
1742
|
-
results = 6;
|
|
1743
|
-
}
|
|
1744
|
-
var hsv = this.toHsv();
|
|
1745
|
-
var h = hsv.h;
|
|
1746
|
-
var s = hsv.s;
|
|
1747
|
-
var v = hsv.v;
|
|
1748
|
-
var res = [];
|
|
1749
|
-
var modification = 1 / results;
|
|
1750
|
-
while (results--) {
|
|
1751
|
-
res.push(new TinyColor2({ h, s, v }));
|
|
1752
|
-
v = (v + modification) % 1;
|
|
1753
|
-
}
|
|
1754
|
-
return res;
|
|
1755
|
-
};
|
|
1756
|
-
TinyColor2.prototype.splitcomplement = function() {
|
|
1757
|
-
var hsl = this.toHsl();
|
|
1758
|
-
var h = hsl.h;
|
|
1759
|
-
return [
|
|
1760
|
-
this,
|
|
1761
|
-
new TinyColor2({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
|
|
1762
|
-
new TinyColor2({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })
|
|
1763
|
-
];
|
|
1764
|
-
};
|
|
1765
|
-
TinyColor2.prototype.onBackground = function(background) {
|
|
1766
|
-
var fg = this.toRgb();
|
|
1767
|
-
var bg = new TinyColor2(background).toRgb();
|
|
1768
|
-
var alpha = fg.a + bg.a * (1 - fg.a);
|
|
1769
|
-
return new TinyColor2({
|
|
1770
|
-
r: (fg.r * fg.a + bg.r * bg.a * (1 - fg.a)) / alpha,
|
|
1771
|
-
g: (fg.g * fg.a + bg.g * bg.a * (1 - fg.a)) / alpha,
|
|
1772
|
-
b: (fg.b * fg.a + bg.b * bg.a * (1 - fg.a)) / alpha,
|
|
1773
|
-
a: alpha
|
|
1774
|
-
});
|
|
1775
|
-
};
|
|
1776
|
-
TinyColor2.prototype.triad = function() {
|
|
1777
|
-
return this.polyad(3);
|
|
1778
|
-
};
|
|
1779
|
-
TinyColor2.prototype.tetrad = function() {
|
|
1780
|
-
return this.polyad(4);
|
|
1781
|
-
};
|
|
1782
|
-
TinyColor2.prototype.polyad = function(n) {
|
|
1783
|
-
var hsl = this.toHsl();
|
|
1784
|
-
var h = hsl.h;
|
|
1785
|
-
var result = [this];
|
|
1786
|
-
var increment = 360 / n;
|
|
1787
|
-
for (var i = 1; i < n; i++) {
|
|
1788
|
-
result.push(new TinyColor2({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
|
|
1789
|
-
}
|
|
1790
|
-
return result;
|
|
1791
|
-
};
|
|
1792
|
-
TinyColor2.prototype.equals = function(color) {
|
|
1793
|
-
return this.toRgbString() === new TinyColor2(color).toRgbString();
|
|
1794
|
-
};
|
|
1795
|
-
return TinyColor2;
|
|
1796
|
-
})()
|
|
1797
|
-
);
|
|
1798
|
-
function darken(color, amount = 20) {
|
|
1799
|
-
return color.mix("#141414", amount).toString();
|
|
1800
|
-
}
|
|
1801
|
-
function useButtonCustomStyle(props) {
|
|
1802
|
-
const _disabled = useFormDisabled();
|
|
1803
|
-
const ns = useNamespace("button");
|
|
1804
|
-
return computed(() => {
|
|
1805
|
-
let styles = {};
|
|
1806
|
-
let buttonColor = props.color;
|
|
1807
|
-
if (buttonColor) {
|
|
1808
|
-
const match = buttonColor.match(/var\((.*?)\)/);
|
|
1809
|
-
if (match) {
|
|
1810
|
-
buttonColor = window.getComputedStyle(window.document.documentElement).getPropertyValue(match[1]);
|
|
1811
|
-
}
|
|
1812
|
-
const color = new TinyColor(buttonColor);
|
|
1813
|
-
const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
|
|
1814
|
-
if (props.plain) {
|
|
1815
|
-
styles = ns.cssVarBlock({
|
|
1816
|
-
"bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
|
|
1817
|
-
"text-color": buttonColor,
|
|
1818
|
-
"border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
|
|
1819
|
-
"hover-text-color": `var(${ns.cssVarName("color-white")})`,
|
|
1820
|
-
"hover-bg-color": buttonColor,
|
|
1821
|
-
"hover-border-color": buttonColor,
|
|
1822
|
-
"active-bg-color": activeBgColor,
|
|
1823
|
-
"active-text-color": `var(${ns.cssVarName("color-white")})`,
|
|
1824
|
-
"active-border-color": activeBgColor
|
|
1825
|
-
});
|
|
1826
|
-
if (_disabled.value) {
|
|
1827
|
-
styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString();
|
|
1828
|
-
styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString();
|
|
1829
|
-
styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString();
|
|
1830
|
-
}
|
|
1831
|
-
} else {
|
|
1832
|
-
const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
|
|
1833
|
-
const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
|
|
1834
|
-
styles = ns.cssVarBlock({
|
|
1835
|
-
"bg-color": buttonColor,
|
|
1836
|
-
"text-color": textColor,
|
|
1837
|
-
"border-color": buttonColor,
|
|
1838
|
-
"hover-bg-color": hoverBgColor,
|
|
1839
|
-
"hover-text-color": textColor,
|
|
1840
|
-
"hover-border-color": hoverBgColor,
|
|
1841
|
-
"active-bg-color": activeBgColor,
|
|
1842
|
-
"active-border-color": activeBgColor
|
|
1843
|
-
});
|
|
1844
|
-
if (_disabled.value) {
|
|
1845
|
-
const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
|
|
1846
|
-
styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
|
|
1847
|
-
styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
|
|
1848
|
-
styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
|
|
1849
|
-
}
|
|
1850
|
-
}
|
|
1851
|
-
}
|
|
1852
|
-
return styles;
|
|
1853
|
-
});
|
|
1854
|
-
}
|
|
1855
|
-
const __default__$4 = defineComponent({
|
|
1856
|
-
name: "ElButton"
|
|
1857
|
-
});
|
|
1858
|
-
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
1859
|
-
...__default__$4,
|
|
1860
|
-
props: buttonProps,
|
|
1861
|
-
emits: buttonEmits,
|
|
1862
|
-
setup(__props, { expose, emit }) {
|
|
1863
|
-
const props = __props;
|
|
1864
|
-
const buttonStyle = useButtonCustomStyle(props);
|
|
1865
|
-
const ns = useNamespace("button");
|
|
1866
|
-
const {
|
|
1867
|
-
_ref,
|
|
1868
|
-
_size,
|
|
1869
|
-
_type,
|
|
1870
|
-
_disabled,
|
|
1871
|
-
_props,
|
|
1872
|
-
_plain,
|
|
1873
|
-
_round,
|
|
1874
|
-
shouldAddSpace,
|
|
1875
|
-
handleClick
|
|
1876
|
-
} = useButton(props, emit);
|
|
1877
|
-
const buttonKls = computed(() => [
|
|
1878
|
-
ns.b(),
|
|
1879
|
-
ns.m(_type.value),
|
|
1880
|
-
ns.m(_size.value),
|
|
1881
|
-
ns.is("disabled", _disabled.value),
|
|
1882
|
-
ns.is("loading", props.loading),
|
|
1883
|
-
ns.is("plain", _plain.value),
|
|
1884
|
-
ns.is("round", _round.value),
|
|
1885
|
-
ns.is("circle", props.circle),
|
|
1886
|
-
ns.is("text", props.text),
|
|
1887
|
-
ns.is("link", props.link),
|
|
1888
|
-
ns.is("has-bg", props.bg)
|
|
1889
|
-
]);
|
|
1890
|
-
expose({
|
|
1891
|
-
ref: _ref,
|
|
1892
|
-
size: _size,
|
|
1893
|
-
type: _type,
|
|
1894
|
-
disabled: _disabled,
|
|
1895
|
-
shouldAddSpace
|
|
1896
|
-
});
|
|
1897
|
-
return (_ctx, _cache) => {
|
|
1898
|
-
return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), mergeProps({
|
|
1899
|
-
ref_key: "_ref",
|
|
1900
|
-
ref: _ref
|
|
1901
|
-
}, unref(_props), {
|
|
1902
|
-
class: unref(buttonKls),
|
|
1903
|
-
style: unref(buttonStyle),
|
|
1904
|
-
onClick: unref(handleClick)
|
|
1905
|
-
}), {
|
|
1906
|
-
default: withCtx(() => [
|
|
1907
|
-
_ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
1908
|
-
_ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
|
|
1909
|
-
key: 1,
|
|
1910
|
-
class: normalizeClass(unref(ns).is("loading"))
|
|
1911
|
-
}, {
|
|
1912
|
-
default: withCtx(() => [
|
|
1913
|
-
(openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
|
|
1914
|
-
]),
|
|
1915
|
-
_: 1
|
|
1916
|
-
}, 8, ["class"]))
|
|
1917
|
-
], 64)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
|
|
1918
|
-
default: withCtx(() => [
|
|
1919
|
-
_ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
|
|
1920
|
-
]),
|
|
1921
|
-
_: 3
|
|
1922
|
-
})) : createCommentVNode("v-if", true),
|
|
1923
|
-
_ctx.$slots.default ? (openBlock(), createElementBlock("span", {
|
|
1924
|
-
key: 2,
|
|
1925
|
-
class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
|
|
1926
|
-
}, [
|
|
1927
|
-
renderSlot(_ctx.$slots, "default")
|
|
1928
|
-
], 2)) : createCommentVNode("v-if", true)
|
|
1929
|
-
]),
|
|
1930
|
-
_: 3
|
|
1931
|
-
}, 16, ["class", "style", "onClick"]);
|
|
1932
|
-
};
|
|
1933
|
-
}
|
|
1934
|
-
});
|
|
1935
|
-
var Button = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__file", "button.vue"]]);
|
|
1936
|
-
const buttonGroupProps = {
|
|
1937
|
-
size: buttonProps.size,
|
|
1938
|
-
type: buttonProps.type
|
|
1939
|
-
};
|
|
1940
|
-
const __default__$3 = defineComponent({
|
|
1941
|
-
name: "ElButtonGroup"
|
|
1942
|
-
});
|
|
1943
|
-
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
1944
|
-
...__default__$3,
|
|
1945
|
-
props: buttonGroupProps,
|
|
1946
|
-
setup(__props) {
|
|
1947
|
-
const props = __props;
|
|
1948
|
-
provide(buttonGroupContextKey, reactive({
|
|
1949
|
-
size: toRef(props, "size"),
|
|
1950
|
-
type: toRef(props, "type")
|
|
1951
|
-
}));
|
|
1952
|
-
const ns = useNamespace("button");
|
|
1953
|
-
return (_ctx, _cache) => {
|
|
1954
|
-
return openBlock(), createElementBlock("div", {
|
|
1955
|
-
class: normalizeClass(unref(ns).b("group"))
|
|
1956
|
-
}, [
|
|
1957
|
-
renderSlot(_ctx.$slots, "default")
|
|
1958
|
-
], 2);
|
|
1959
|
-
};
|
|
1960
|
-
}
|
|
1961
|
-
});
|
|
1962
|
-
var ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "button-group.vue"]]);
|
|
1963
|
-
const ElButton = withInstall(Button, {
|
|
1964
|
-
ButtonGroup
|
|
1965
|
-
});
|
|
1966
|
-
withNoopInstall(ButtonGroup);
|
|
1967
|
-
const checkboxProps = {
|
|
1968
|
-
modelValue: {
|
|
1969
|
-
type: [Number, String, Boolean],
|
|
1970
|
-
default: void 0
|
|
1971
|
-
},
|
|
1972
|
-
label: {
|
|
1973
|
-
type: [String, Boolean, Number, Object],
|
|
1974
|
-
default: void 0
|
|
1975
|
-
},
|
|
1976
|
-
value: {
|
|
1977
|
-
type: [String, Boolean, Number, Object],
|
|
1978
|
-
default: void 0
|
|
1979
|
-
},
|
|
1980
|
-
indeterminate: Boolean,
|
|
1981
|
-
disabled: Boolean,
|
|
1982
|
-
checked: Boolean,
|
|
1983
|
-
name: {
|
|
1984
|
-
type: String,
|
|
1985
|
-
default: void 0
|
|
1986
|
-
},
|
|
1987
|
-
trueValue: {
|
|
1988
|
-
type: [String, Number],
|
|
1989
|
-
default: void 0
|
|
1990
|
-
},
|
|
1991
|
-
falseValue: {
|
|
1992
|
-
type: [String, Number],
|
|
1993
|
-
default: void 0
|
|
1994
|
-
},
|
|
1995
|
-
trueLabel: {
|
|
1996
|
-
type: [String, Number],
|
|
1997
|
-
default: void 0
|
|
1998
|
-
},
|
|
1999
|
-
falseLabel: {
|
|
2000
|
-
type: [String, Number],
|
|
2001
|
-
default: void 0
|
|
2002
|
-
},
|
|
2003
|
-
id: {
|
|
2004
|
-
type: String,
|
|
2005
|
-
default: void 0
|
|
2006
|
-
},
|
|
2007
|
-
border: Boolean,
|
|
2008
|
-
size: useSizeProp,
|
|
2009
|
-
tabindex: [String, Number],
|
|
2010
|
-
validateEvent: {
|
|
2011
|
-
type: Boolean,
|
|
2012
|
-
default: true
|
|
2013
|
-
},
|
|
2014
|
-
...useAriaProps(["ariaControls"])
|
|
2015
|
-
};
|
|
2016
|
-
const checkboxEmits = {
|
|
2017
|
-
[UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
|
|
2018
|
-
change: (val) => isString(val) || isNumber(val) || isBoolean(val)
|
|
2019
|
-
};
|
|
2020
|
-
const checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
|
|
2021
|
-
const useCheckboxDisabled = ({
|
|
2022
|
-
model,
|
|
2023
|
-
isChecked
|
|
2024
|
-
}) => {
|
|
2025
|
-
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
2026
|
-
const isLimitDisabled = computed(() => {
|
|
2027
|
-
var _a, _b;
|
|
2028
|
-
const max = (_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value;
|
|
2029
|
-
const min = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value;
|
|
2030
|
-
return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value;
|
|
2031
|
-
});
|
|
2032
|
-
const isDisabled = useFormDisabled(computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.disabled.value) || isLimitDisabled.value));
|
|
2033
|
-
return {
|
|
2034
|
-
isDisabled,
|
|
2035
|
-
isLimitDisabled
|
|
2036
|
-
};
|
|
2037
|
-
};
|
|
2038
|
-
const useCheckboxEvent = (props, {
|
|
2039
|
-
model,
|
|
2040
|
-
isLimitExceeded,
|
|
2041
|
-
hasOwnLabel,
|
|
2042
|
-
isDisabled,
|
|
2043
|
-
isLabeledByFormItem
|
|
2044
|
-
}) => {
|
|
2045
|
-
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
2046
|
-
const { formItem } = useFormItem();
|
|
2047
|
-
const { emit } = getCurrentInstance();
|
|
2048
|
-
function getLabeledValue(value) {
|
|
2049
|
-
var _a, _b, _c, _d;
|
|
2050
|
-
return [true, props.trueValue, props.trueLabel].includes(value) ? (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true : (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false;
|
|
2051
|
-
}
|
|
2052
|
-
function emitChangeEvent(checked, e) {
|
|
2053
|
-
emit(CHANGE_EVENT, getLabeledValue(checked), e);
|
|
2054
|
-
}
|
|
2055
|
-
function handleChange(e) {
|
|
2056
|
-
if (isLimitExceeded.value)
|
|
2057
|
-
return;
|
|
2058
|
-
const target = e.target;
|
|
2059
|
-
emit(CHANGE_EVENT, getLabeledValue(target.checked), e);
|
|
2060
|
-
}
|
|
2061
|
-
async function onClickRoot(e) {
|
|
2062
|
-
if (isLimitExceeded.value)
|
|
2063
|
-
return;
|
|
2064
|
-
if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
|
|
2065
|
-
const eventTargets = e.composedPath();
|
|
2066
|
-
const hasLabel = eventTargets.some((item) => item.tagName === "LABEL");
|
|
2067
|
-
if (!hasLabel) {
|
|
2068
|
-
model.value = getLabeledValue([false, props.falseValue, props.falseLabel].includes(model.value));
|
|
2069
|
-
await nextTick();
|
|
2070
|
-
emitChangeEvent(model.value, e);
|
|
2071
|
-
}
|
|
2072
|
-
}
|
|
2073
|
-
}
|
|
2074
|
-
const validateEvent = computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.validateEvent) || props.validateEvent);
|
|
2075
|
-
watch(() => props.modelValue, () => {
|
|
2076
|
-
if (validateEvent.value) {
|
|
2077
|
-
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
|
|
2078
|
-
}
|
|
2079
|
-
});
|
|
2080
|
-
return {
|
|
2081
|
-
handleChange,
|
|
2082
|
-
onClickRoot
|
|
2083
|
-
};
|
|
2084
|
-
};
|
|
2085
|
-
const useCheckboxModel = (props) => {
|
|
2086
|
-
const selfModel = ref(false);
|
|
2087
|
-
const { emit } = getCurrentInstance();
|
|
2088
|
-
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
2089
|
-
const isGroup = computed(() => isUndefined(checkboxGroup) === false);
|
|
2090
|
-
const isLimitExceeded = ref(false);
|
|
2091
|
-
const model = computed({
|
|
2092
|
-
get() {
|
|
2093
|
-
var _a, _b;
|
|
2094
|
-
return isGroup.value ? (_a = checkboxGroup == null ? void 0 : checkboxGroup.modelValue) == null ? void 0 : _a.value : (_b = props.modelValue) != null ? _b : selfModel.value;
|
|
2095
|
-
},
|
|
2096
|
-
set(val) {
|
|
2097
|
-
var _a, _b;
|
|
2098
|
-
if (isGroup.value && isArray$1(val)) {
|
|
2099
|
-
isLimitExceeded.value = ((_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value) !== void 0 && val.length > (checkboxGroup == null ? void 0 : checkboxGroup.max.value) && val.length > model.value.length;
|
|
2100
|
-
isLimitExceeded.value === false && ((_b = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _b.call(checkboxGroup, val));
|
|
2101
|
-
} else {
|
|
2102
|
-
emit(UPDATE_MODEL_EVENT, val);
|
|
2103
|
-
selfModel.value = val;
|
|
2104
|
-
}
|
|
2105
|
-
}
|
|
2106
|
-
});
|
|
2107
|
-
return {
|
|
2108
|
-
model,
|
|
2109
|
-
isGroup,
|
|
2110
|
-
isLimitExceeded
|
|
2111
|
-
};
|
|
2112
|
-
};
|
|
2113
|
-
const useCheckboxStatus = (props, slots, { model }) => {
|
|
2114
|
-
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
2115
|
-
const isFocused = ref(false);
|
|
2116
|
-
const actualValue = computed(() => {
|
|
2117
|
-
if (!isPropAbsent(props.value)) {
|
|
2118
|
-
return props.value;
|
|
2119
|
-
}
|
|
2120
|
-
return props.label;
|
|
2121
|
-
});
|
|
2122
|
-
const isChecked = computed(() => {
|
|
2123
|
-
const value = model.value;
|
|
2124
|
-
if (isBoolean(value)) {
|
|
2125
|
-
return value;
|
|
2126
|
-
} else if (isArray$1(value)) {
|
|
2127
|
-
if (isObject$1(actualValue.value)) {
|
|
2128
|
-
return value.map(toRaw).some((o) => isEqual(o, actualValue.value));
|
|
2129
|
-
} else {
|
|
2130
|
-
return value.map(toRaw).includes(actualValue.value);
|
|
2131
|
-
}
|
|
2132
|
-
} else if (value !== null && value !== void 0) {
|
|
2133
|
-
return value === props.trueValue || value === props.trueLabel;
|
|
2134
|
-
} else {
|
|
2135
|
-
return !!value;
|
|
2136
|
-
}
|
|
2137
|
-
});
|
|
2138
|
-
const checkboxButtonSize = useFormSize(computed(() => {
|
|
2139
|
-
var _a;
|
|
2140
|
-
return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
|
|
2141
|
-
}), {
|
|
2142
|
-
prop: true
|
|
2143
|
-
});
|
|
2144
|
-
const checkboxSize = useFormSize(computed(() => {
|
|
2145
|
-
var _a;
|
|
2146
|
-
return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
|
|
2147
|
-
}));
|
|
2148
|
-
const hasOwnLabel = computed(() => {
|
|
2149
|
-
return !!slots.default || !isPropAbsent(actualValue.value);
|
|
2150
|
-
});
|
|
2151
|
-
return {
|
|
2152
|
-
checkboxButtonSize,
|
|
2153
|
-
isChecked,
|
|
2154
|
-
isFocused,
|
|
2155
|
-
checkboxSize,
|
|
2156
|
-
hasOwnLabel,
|
|
2157
|
-
actualValue
|
|
2158
|
-
};
|
|
2159
|
-
};
|
|
2160
|
-
const useCheckbox = (props, slots) => {
|
|
2161
|
-
const { formItem: elFormItem } = useFormItem();
|
|
2162
|
-
const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
|
|
2163
|
-
const {
|
|
2164
|
-
isFocused,
|
|
2165
|
-
isChecked,
|
|
2166
|
-
checkboxButtonSize,
|
|
2167
|
-
checkboxSize,
|
|
2168
|
-
hasOwnLabel,
|
|
2169
|
-
actualValue
|
|
2170
|
-
} = useCheckboxStatus(props, slots, { model });
|
|
2171
|
-
const { isDisabled } = useCheckboxDisabled({ model, isChecked });
|
|
2172
|
-
const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
|
|
2173
|
-
formItemContext: elFormItem,
|
|
2174
|
-
disableIdGeneration: hasOwnLabel,
|
|
2175
|
-
disableIdManagement: isGroup
|
|
2176
|
-
});
|
|
2177
|
-
const { handleChange, onClickRoot } = useCheckboxEvent(props, {
|
|
2178
|
-
model,
|
|
2179
|
-
isLimitExceeded,
|
|
2180
|
-
hasOwnLabel,
|
|
2181
|
-
isDisabled,
|
|
2182
|
-
isLabeledByFormItem
|
|
2183
|
-
});
|
|
2184
|
-
const setStoreValue = () => {
|
|
2185
|
-
function addToStore() {
|
|
2186
|
-
var _a, _b;
|
|
2187
|
-
if (isArray$1(model.value) && !model.value.includes(actualValue.value)) {
|
|
2188
|
-
model.value.push(actualValue.value);
|
|
2189
|
-
} else {
|
|
2190
|
-
model.value = (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true;
|
|
2191
|
-
}
|
|
2192
|
-
}
|
|
2193
|
-
props.checked && addToStore();
|
|
2194
|
-
};
|
|
2195
|
-
setStoreValue();
|
|
2196
|
-
useDeprecated({
|
|
2197
|
-
from: "label act as value",
|
|
2198
|
-
replacement: "value",
|
|
2199
|
-
version: "3.0.0",
|
|
2200
|
-
scope: "el-checkbox",
|
|
2201
|
-
ref: "https://element-plus.org/en-US/component/checkbox.html"
|
|
2202
|
-
}, computed(() => isGroup.value && isPropAbsent(props.value)));
|
|
2203
|
-
useDeprecated({
|
|
2204
|
-
from: "true-label",
|
|
2205
|
-
replacement: "true-value",
|
|
2206
|
-
version: "3.0.0",
|
|
2207
|
-
scope: "el-checkbox",
|
|
2208
|
-
ref: "https://element-plus.org/en-US/component/checkbox.html"
|
|
2209
|
-
}, computed(() => !!props.trueLabel));
|
|
2210
|
-
useDeprecated({
|
|
2211
|
-
from: "false-label",
|
|
2212
|
-
replacement: "false-value",
|
|
2213
|
-
version: "3.0.0",
|
|
2214
|
-
scope: "el-checkbox",
|
|
2215
|
-
ref: "https://element-plus.org/en-US/component/checkbox.html"
|
|
2216
|
-
}, computed(() => !!props.falseLabel));
|
|
2217
|
-
return {
|
|
2218
|
-
inputId,
|
|
2219
|
-
isLabeledByFormItem,
|
|
2220
|
-
isChecked,
|
|
2221
|
-
isDisabled,
|
|
2222
|
-
isFocused,
|
|
2223
|
-
checkboxButtonSize,
|
|
2224
|
-
checkboxSize,
|
|
2225
|
-
hasOwnLabel,
|
|
2226
|
-
model,
|
|
2227
|
-
actualValue,
|
|
2228
|
-
handleChange,
|
|
2229
|
-
onClickRoot
|
|
2230
|
-
};
|
|
2231
|
-
};
|
|
2232
|
-
const __default__$2 = defineComponent({
|
|
2233
|
-
name: "ElCheckbox"
|
|
2234
|
-
});
|
|
2235
|
-
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
2236
|
-
...__default__$2,
|
|
2237
|
-
props: checkboxProps,
|
|
2238
|
-
emits: checkboxEmits,
|
|
2239
|
-
setup(__props) {
|
|
2240
|
-
const props = __props;
|
|
2241
|
-
const slots = useSlots();
|
|
2242
|
-
const {
|
|
2243
|
-
inputId,
|
|
2244
|
-
isLabeledByFormItem,
|
|
2245
|
-
isChecked,
|
|
2246
|
-
isDisabled,
|
|
2247
|
-
isFocused,
|
|
2248
|
-
checkboxSize,
|
|
2249
|
-
hasOwnLabel,
|
|
2250
|
-
model,
|
|
2251
|
-
actualValue,
|
|
2252
|
-
handleChange,
|
|
2253
|
-
onClickRoot
|
|
2254
|
-
} = useCheckbox(props, slots);
|
|
2255
|
-
const ns = useNamespace("checkbox");
|
|
2256
|
-
const compKls = computed(() => {
|
|
2257
|
-
return [
|
|
2258
|
-
ns.b(),
|
|
2259
|
-
ns.m(checkboxSize.value),
|
|
2260
|
-
ns.is("disabled", isDisabled.value),
|
|
2261
|
-
ns.is("bordered", props.border),
|
|
2262
|
-
ns.is("checked", isChecked.value)
|
|
2263
|
-
];
|
|
2264
|
-
});
|
|
2265
|
-
const spanKls = computed(() => {
|
|
2266
|
-
return [
|
|
2267
|
-
ns.e("input"),
|
|
2268
|
-
ns.is("disabled", isDisabled.value),
|
|
2269
|
-
ns.is("checked", isChecked.value),
|
|
2270
|
-
ns.is("indeterminate", props.indeterminate),
|
|
2271
|
-
ns.is("focus", isFocused.value)
|
|
2272
|
-
];
|
|
2273
|
-
});
|
|
2274
|
-
return (_ctx, _cache) => {
|
|
2275
|
-
return openBlock(), createBlock(resolveDynamicComponent(!unref(hasOwnLabel) && unref(isLabeledByFormItem) ? "span" : "label"), {
|
|
2276
|
-
class: normalizeClass(unref(compKls)),
|
|
2277
|
-
"aria-controls": _ctx.indeterminate ? _ctx.ariaControls : null,
|
|
2278
|
-
onClick: unref(onClickRoot)
|
|
2279
|
-
}, {
|
|
2280
|
-
default: withCtx(() => {
|
|
2281
|
-
var _a, _b, _c, _d;
|
|
2282
|
-
return [
|
|
2283
|
-
createElementVNode("span", {
|
|
2284
|
-
class: normalizeClass(unref(spanKls))
|
|
2285
|
-
}, [
|
|
2286
|
-
_ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
|
|
2287
|
-
key: 0,
|
|
2288
|
-
id: unref(inputId),
|
|
2289
|
-
"onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
|
|
2290
|
-
class: normalizeClass(unref(ns).e("original")),
|
|
2291
|
-
type: "checkbox",
|
|
2292
|
-
indeterminate: _ctx.indeterminate,
|
|
2293
|
-
name: _ctx.name,
|
|
2294
|
-
tabindex: _ctx.tabindex,
|
|
2295
|
-
disabled: unref(isDisabled),
|
|
2296
|
-
"true-value": (_b = (_a = _ctx.trueValue) != null ? _a : _ctx.trueLabel) != null ? _b : true,
|
|
2297
|
-
"false-value": (_d = (_c = _ctx.falseValue) != null ? _c : _ctx.falseLabel) != null ? _d : false,
|
|
2298
|
-
onChange: unref(handleChange),
|
|
2299
|
-
onFocus: ($event) => isFocused.value = true,
|
|
2300
|
-
onBlur: ($event) => isFocused.value = false,
|
|
2301
|
-
onClick: withModifiers(() => {
|
|
2302
|
-
}, ["stop"])
|
|
2303
|
-
}, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
|
|
2304
|
-
[vModelCheckbox, unref(model)]
|
|
2305
|
-
]) : withDirectives((openBlock(), createElementBlock("input", {
|
|
2306
|
-
key: 1,
|
|
2307
|
-
id: unref(inputId),
|
|
2308
|
-
"onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
|
|
2309
|
-
class: normalizeClass(unref(ns).e("original")),
|
|
2310
|
-
type: "checkbox",
|
|
2311
|
-
indeterminate: _ctx.indeterminate,
|
|
2312
|
-
disabled: unref(isDisabled),
|
|
2313
|
-
value: unref(actualValue),
|
|
2314
|
-
name: _ctx.name,
|
|
2315
|
-
tabindex: _ctx.tabindex,
|
|
2316
|
-
onChange: unref(handleChange),
|
|
2317
|
-
onFocus: ($event) => isFocused.value = true,
|
|
2318
|
-
onBlur: ($event) => isFocused.value = false,
|
|
2319
|
-
onClick: withModifiers(() => {
|
|
2320
|
-
}, ["stop"])
|
|
2321
|
-
}, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "disabled", "value", "name", "tabindex", "onChange", "onFocus", "onBlur", "onClick"])), [
|
|
2322
|
-
[vModelCheckbox, unref(model)]
|
|
2323
|
-
]),
|
|
2324
|
-
createElementVNode("span", {
|
|
2325
|
-
class: normalizeClass(unref(ns).e("inner"))
|
|
2326
|
-
}, null, 2)
|
|
2327
|
-
], 2),
|
|
2328
|
-
unref(hasOwnLabel) ? (openBlock(), createElementBlock("span", {
|
|
2329
|
-
key: 0,
|
|
2330
|
-
class: normalizeClass(unref(ns).e("label"))
|
|
2331
|
-
}, [
|
|
2332
|
-
renderSlot(_ctx.$slots, "default"),
|
|
2333
|
-
!_ctx.$slots.default ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2334
|
-
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
2335
|
-
], 64)) : createCommentVNode("v-if", true)
|
|
2336
|
-
], 2)) : createCommentVNode("v-if", true)
|
|
2337
|
-
];
|
|
2338
|
-
}),
|
|
2339
|
-
_: 3
|
|
2340
|
-
}, 8, ["class", "aria-controls", "onClick"]);
|
|
2341
|
-
};
|
|
2342
|
-
}
|
|
2343
|
-
});
|
|
2344
|
-
var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "checkbox.vue"]]);
|
|
2345
|
-
const __default__$1 = defineComponent({
|
|
2346
|
-
name: "ElCheckboxButton"
|
|
2347
|
-
});
|
|
2348
|
-
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
2349
|
-
...__default__$1,
|
|
2350
|
-
props: checkboxProps,
|
|
2351
|
-
emits: checkboxEmits,
|
|
2352
|
-
setup(__props) {
|
|
2353
|
-
const props = __props;
|
|
2354
|
-
const slots = useSlots();
|
|
2355
|
-
const {
|
|
2356
|
-
isFocused,
|
|
2357
|
-
isChecked,
|
|
2358
|
-
isDisabled,
|
|
2359
|
-
checkboxButtonSize,
|
|
2360
|
-
model,
|
|
2361
|
-
actualValue,
|
|
2362
|
-
handleChange
|
|
2363
|
-
} = useCheckbox(props, slots);
|
|
2364
|
-
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
2365
|
-
const ns = useNamespace("checkbox");
|
|
2366
|
-
const activeStyle = computed(() => {
|
|
2367
|
-
var _a, _b, _c, _d;
|
|
2368
|
-
const fillValue = (_b = (_a = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a.value) != null ? _b : "";
|
|
2369
|
-
return {
|
|
2370
|
-
backgroundColor: fillValue,
|
|
2371
|
-
borderColor: fillValue,
|
|
2372
|
-
color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
|
|
2373
|
-
boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
|
|
2374
|
-
};
|
|
2375
|
-
});
|
|
2376
|
-
const labelKls = computed(() => {
|
|
2377
|
-
return [
|
|
2378
|
-
ns.b("button"),
|
|
2379
|
-
ns.bm("button", checkboxButtonSize.value),
|
|
2380
|
-
ns.is("disabled", isDisabled.value),
|
|
2381
|
-
ns.is("checked", isChecked.value),
|
|
2382
|
-
ns.is("focus", isFocused.value)
|
|
2383
|
-
];
|
|
2384
|
-
});
|
|
2385
|
-
return (_ctx, _cache) => {
|
|
2386
|
-
var _a, _b, _c, _d;
|
|
2387
|
-
return openBlock(), createElementBlock("label", {
|
|
2388
|
-
class: normalizeClass(unref(labelKls))
|
|
2389
|
-
}, [
|
|
2390
|
-
_ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
|
|
2391
|
-
key: 0,
|
|
2392
|
-
"onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
|
|
2393
|
-
class: normalizeClass(unref(ns).be("button", "original")),
|
|
2394
|
-
type: "checkbox",
|
|
2395
|
-
name: _ctx.name,
|
|
2396
|
-
tabindex: _ctx.tabindex,
|
|
2397
|
-
disabled: unref(isDisabled),
|
|
2398
|
-
"true-value": (_b = (_a = _ctx.trueValue) != null ? _a : _ctx.trueLabel) != null ? _b : true,
|
|
2399
|
-
"false-value": (_d = (_c = _ctx.falseValue) != null ? _c : _ctx.falseLabel) != null ? _d : false,
|
|
2400
|
-
onChange: unref(handleChange),
|
|
2401
|
-
onFocus: ($event) => isFocused.value = true,
|
|
2402
|
-
onBlur: ($event) => isFocused.value = false,
|
|
2403
|
-
onClick: withModifiers(() => {
|
|
2404
|
-
}, ["stop"])
|
|
2405
|
-
}, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
|
|
2406
|
-
[vModelCheckbox, unref(model)]
|
|
2407
|
-
]) : withDirectives((openBlock(), createElementBlock("input", {
|
|
2408
|
-
key: 1,
|
|
2409
|
-
"onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
|
|
2410
|
-
class: normalizeClass(unref(ns).be("button", "original")),
|
|
2411
|
-
type: "checkbox",
|
|
2412
|
-
name: _ctx.name,
|
|
2413
|
-
tabindex: _ctx.tabindex,
|
|
2414
|
-
disabled: unref(isDisabled),
|
|
2415
|
-
value: unref(actualValue),
|
|
2416
|
-
onChange: unref(handleChange),
|
|
2417
|
-
onFocus: ($event) => isFocused.value = true,
|
|
2418
|
-
onBlur: ($event) => isFocused.value = false,
|
|
2419
|
-
onClick: withModifiers(() => {
|
|
2420
|
-
}, ["stop"])
|
|
2421
|
-
}, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "value", "onChange", "onFocus", "onBlur", "onClick"])), [
|
|
2422
|
-
[vModelCheckbox, unref(model)]
|
|
2423
|
-
]),
|
|
2424
|
-
_ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
|
|
2425
|
-
key: 2,
|
|
2426
|
-
class: normalizeClass(unref(ns).be("button", "inner")),
|
|
2427
|
-
style: normalizeStyle(unref(isChecked) ? unref(activeStyle) : void 0)
|
|
2428
|
-
}, [
|
|
2429
|
-
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
2430
|
-
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
2431
|
-
])
|
|
2432
|
-
], 6)) : createCommentVNode("v-if", true)
|
|
2433
|
-
], 2);
|
|
2434
|
-
};
|
|
2435
|
-
}
|
|
2436
|
-
});
|
|
2437
|
-
var CheckboxButton = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "checkbox-button.vue"]]);
|
|
2438
|
-
const checkboxGroupProps = buildProps({
|
|
2439
|
-
modelValue: {
|
|
2440
|
-
type: definePropType(Array),
|
|
2441
|
-
default: () => []
|
|
2442
|
-
},
|
|
2443
|
-
disabled: Boolean,
|
|
2444
|
-
min: Number,
|
|
2445
|
-
max: Number,
|
|
2446
|
-
size: useSizeProp,
|
|
2447
|
-
fill: String,
|
|
2448
|
-
textColor: String,
|
|
2449
|
-
tag: {
|
|
2450
|
-
type: String,
|
|
2451
|
-
default: "div"
|
|
2452
|
-
},
|
|
2453
|
-
validateEvent: {
|
|
2454
|
-
type: Boolean,
|
|
2455
|
-
default: true
|
|
2456
|
-
},
|
|
2457
|
-
...useAriaProps(["ariaLabel"])
|
|
2458
|
-
});
|
|
2459
|
-
const checkboxGroupEmits = {
|
|
2460
|
-
[UPDATE_MODEL_EVENT]: (val) => isArray$1(val),
|
|
2461
|
-
change: (val) => isArray$1(val)
|
|
2462
|
-
};
|
|
2463
|
-
const __default__ = defineComponent({
|
|
2464
|
-
name: "ElCheckboxGroup"
|
|
2465
|
-
});
|
|
2466
|
-
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
2467
|
-
...__default__,
|
|
2468
|
-
props: checkboxGroupProps,
|
|
2469
|
-
emits: checkboxGroupEmits,
|
|
2470
|
-
setup(__props, { emit }) {
|
|
2471
|
-
const props = __props;
|
|
2472
|
-
const ns = useNamespace("checkbox");
|
|
2473
|
-
const { formItem } = useFormItem();
|
|
2474
|
-
const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
|
|
2475
|
-
formItemContext: formItem
|
|
2476
|
-
});
|
|
2477
|
-
const changeEvent = async (value) => {
|
|
2478
|
-
emit(UPDATE_MODEL_EVENT, value);
|
|
2479
|
-
await nextTick();
|
|
2480
|
-
emit(CHANGE_EVENT, value);
|
|
2481
|
-
};
|
|
2482
|
-
const modelValue = computed({
|
|
2483
|
-
get() {
|
|
2484
|
-
return props.modelValue;
|
|
2485
|
-
},
|
|
2486
|
-
set(val) {
|
|
2487
|
-
changeEvent(val);
|
|
2488
|
-
}
|
|
2489
|
-
});
|
|
2490
|
-
provide(checkboxGroupContextKey, {
|
|
2491
|
-
...pick(toRefs(props), [
|
|
2492
|
-
"size",
|
|
2493
|
-
"min",
|
|
2494
|
-
"max",
|
|
2495
|
-
"disabled",
|
|
2496
|
-
"validateEvent",
|
|
2497
|
-
"fill",
|
|
2498
|
-
"textColor"
|
|
2499
|
-
]),
|
|
2500
|
-
modelValue,
|
|
2501
|
-
changeEvent
|
|
2502
|
-
});
|
|
2503
|
-
watch(() => props.modelValue, (newVal, oldValue) => {
|
|
2504
|
-
if (props.validateEvent && !isEqual(newVal, oldValue)) {
|
|
2505
|
-
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
|
|
2506
|
-
}
|
|
2507
|
-
});
|
|
2508
|
-
return (_ctx, _cache) => {
|
|
2509
|
-
var _a;
|
|
2510
|
-
return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
|
|
2511
|
-
id: unref(groupId),
|
|
2512
|
-
class: normalizeClass(unref(ns).b("group")),
|
|
2513
|
-
role: "group",
|
|
2514
|
-
"aria-label": !unref(isLabeledByFormItem) ? _ctx.ariaLabel || "checkbox-group" : void 0,
|
|
2515
|
-
"aria-labelledby": unref(isLabeledByFormItem) ? (_a = unref(formItem)) == null ? void 0 : _a.labelId : void 0
|
|
2516
|
-
}, {
|
|
2517
|
-
default: withCtx(() => [
|
|
2518
|
-
renderSlot(_ctx.$slots, "default")
|
|
2519
|
-
]),
|
|
2520
|
-
_: 3
|
|
2521
|
-
}, 8, ["id", "class", "aria-label", "aria-labelledby"]);
|
|
2522
|
-
};
|
|
2523
|
-
}
|
|
2524
|
-
});
|
|
2525
|
-
var CheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "checkbox-group.vue"]]);
|
|
2526
|
-
const ElCheckbox = withInstall(Checkbox, {
|
|
2527
|
-
CheckboxButton,
|
|
2528
|
-
CheckboxGroup
|
|
2529
|
-
});
|
|
2530
|
-
withNoopInstall(CheckboxButton);
|
|
2531
|
-
withNoopInstall(CheckboxGroup);
|
|
2532
25
|
const _hoisted_1$1 = { class: "bg-white rounded-lg p-[10px] w-[200px] text-[14px]" };
|
|
2533
26
|
const _hoisted_2$1 = { class: "flex" };
|
|
2534
27
|
const _hoisted_3$1 = { class: "flee-1 text-[14px] leading-[1.4em]" };
|
|
@@ -2947,7 +440,7 @@ class EventInput extends Component {
|
|
|
2947
440
|
_computedkeyCombination() {
|
|
2948
441
|
this.currentKeyCombinationMap.clear();
|
|
2949
442
|
this.keyCombinationMap.forEach(
|
|
2950
|
-
({ keys
|
|
443
|
+
({ keys, count }, name) => this.isOnlyKeyDowns(keys) && this.currentKeyCombinationMap.set(name, count)
|
|
2951
444
|
);
|
|
2952
445
|
}
|
|
2953
446
|
/**
|
|
@@ -2956,8 +449,8 @@ class EventInput extends Component {
|
|
|
2956
449
|
* @param keys
|
|
2957
450
|
* @param count
|
|
2958
451
|
*/
|
|
2959
|
-
addKeyCombination(name,
|
|
2960
|
-
this.keyCombinationMap.set(name, { keys
|
|
452
|
+
addKeyCombination(name, keys, count = 1) {
|
|
453
|
+
this.keyCombinationMap.set(name, { keys, count });
|
|
2961
454
|
}
|
|
2962
455
|
/**
|
|
2963
456
|
* 移除组合按键
|
|
@@ -2979,26 +472,26 @@ class EventInput extends Component {
|
|
|
2979
472
|
* @param keys
|
|
2980
473
|
* @returns
|
|
2981
474
|
*/
|
|
2982
|
-
isKeyDowns(
|
|
2983
|
-
return
|
|
475
|
+
isKeyDowns(keys) {
|
|
476
|
+
return keys.every((v) => this.isKeyDown(v));
|
|
2984
477
|
}
|
|
2985
478
|
/**
|
|
2986
479
|
* 是否按下按键组中部分
|
|
2987
480
|
* @param keys
|
|
2988
481
|
* @returns
|
|
2989
482
|
*/
|
|
2990
|
-
isSomeKeyDowns(
|
|
2991
|
-
return
|
|
483
|
+
isSomeKeyDowns(keys) {
|
|
484
|
+
return keys.some((v) => this.isKeyDown(v));
|
|
2992
485
|
}
|
|
2993
486
|
/**
|
|
2994
487
|
* 是否按下按键组中所有,并且只按下按键组中的按键
|
|
2995
488
|
* @param keys
|
|
2996
489
|
* @returns
|
|
2997
490
|
*/
|
|
2998
|
-
isOnlyKeyDowns(
|
|
2999
|
-
if (
|
|
3000
|
-
const keyList =
|
|
3001
|
-
return keyList.length ===
|
|
491
|
+
isOnlyKeyDowns(keys) {
|
|
492
|
+
if (keys.length !== this.codeCount) return false;
|
|
493
|
+
const keyList = keys.filter((v) => this.isKeyDown(v));
|
|
494
|
+
return keyList.length === keys.length;
|
|
3002
495
|
}
|
|
3003
496
|
/**
|
|
3004
497
|
*
|