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/selectLocalFile.js
CHANGED
|
@@ -5,7 +5,7 @@ import { CSS2DObject, CSS2DRenderer } from "three/addons/renderers/CSS2DRenderer
|
|
|
5
5
|
import { OrbitControls } from "three/addons/controls/OrbitControls.js";
|
|
6
6
|
import * as TWEEN from "@tweenjs/tween.js";
|
|
7
7
|
import { C as Component, P as Point, V as Variable } from "./build.js";
|
|
8
|
-
import { getCurrentInstance, inject, ref, computed, unref, shallowRef, watchEffect, readonly, getCurrentScope, onScopeDispose, onMounted, nextTick, isRef, warn, provide, defineComponent, createElementBlock, openBlock, mergeProps, renderSlot, createElementVNode } from "vue";
|
|
8
|
+
import { getCurrentInstance, inject, ref, computed, unref, shallowRef, watchEffect, readonly, getCurrentScope, onScopeDispose, onMounted, nextTick, isRef, warn, provide, defineComponent, createElementBlock, openBlock, mergeProps, renderSlot, createElementVNode, watch, toRef, onUnmounted, useSlots, Text, createBlock, resolveDynamicComponent, withCtx, createCommentVNode, Fragment, normalizeClass, reactive, toRaw, withDirectives, withModifiers, vModelCheckbox, createTextVNode, toDisplayString, normalizeStyle, toRefs } from "vue";
|
|
9
9
|
THREE.Object3D.DEFAULT_UP = new THREE.Vector3(0, 0, 1);
|
|
10
10
|
class Renderer extends Component {
|
|
11
11
|
static name = "Renderer";
|
|
@@ -282,8 +282,8 @@ const useNamespace = (block, namespaceOverrides) => {
|
|
|
282
282
|
!!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
|
|
283
283
|
const NOOP = () => {
|
|
284
284
|
};
|
|
285
|
-
const hasOwnProperty$
|
|
286
|
-
const hasOwn = (val, key) => hasOwnProperty$
|
|
285
|
+
const hasOwnProperty$a = Object.prototype.hasOwnProperty;
|
|
286
|
+
const hasOwn = (val, key) => hasOwnProperty$a.call(val, key);
|
|
287
287
|
const isArray$1 = Array.isArray;
|
|
288
288
|
const isFunction$1 = (val) => typeof val === "function";
|
|
289
289
|
const isString$1 = (val) => typeof val === "string";
|
|
@@ -292,12 +292,12 @@ var freeGlobal = typeof global == "object" && global && global.Object === Object
|
|
|
292
292
|
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
293
293
|
var root = freeGlobal || freeSelf || Function("return this")();
|
|
294
294
|
var Symbol$1 = root.Symbol;
|
|
295
|
-
var objectProto$
|
|
296
|
-
var hasOwnProperty$
|
|
297
|
-
var nativeObjectToString$1 = objectProto$
|
|
295
|
+
var objectProto$c = Object.prototype;
|
|
296
|
+
var hasOwnProperty$9 = objectProto$c.hasOwnProperty;
|
|
297
|
+
var nativeObjectToString$1 = objectProto$c.toString;
|
|
298
298
|
var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0;
|
|
299
299
|
function getRawTag(value) {
|
|
300
|
-
var isOwn = hasOwnProperty$
|
|
300
|
+
var isOwn = hasOwnProperty$9.call(value, symToStringTag$1), tag = value[symToStringTag$1];
|
|
301
301
|
try {
|
|
302
302
|
value[symToStringTag$1] = void 0;
|
|
303
303
|
var unmasked = true;
|
|
@@ -313,8 +313,8 @@ function getRawTag(value) {
|
|
|
313
313
|
}
|
|
314
314
|
return result;
|
|
315
315
|
}
|
|
316
|
-
var objectProto$
|
|
317
|
-
var nativeObjectToString = objectProto$
|
|
316
|
+
var objectProto$b = Object.prototype;
|
|
317
|
+
var nativeObjectToString = objectProto$b.toString;
|
|
318
318
|
function objectToString(value) {
|
|
319
319
|
return nativeObjectToString.call(value);
|
|
320
320
|
}
|
|
@@ -329,9 +329,9 @@ function baseGetTag(value) {
|
|
|
329
329
|
function isObjectLike(value) {
|
|
330
330
|
return value != null && typeof value == "object";
|
|
331
331
|
}
|
|
332
|
-
var symbolTag = "[object Symbol]";
|
|
332
|
+
var symbolTag$1 = "[object Symbol]";
|
|
333
333
|
function isSymbol(value) {
|
|
334
|
-
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
334
|
+
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$1;
|
|
335
335
|
}
|
|
336
336
|
function arrayMap(array, iteratee) {
|
|
337
337
|
var index = -1, length = array == null ? 0 : array.length, result = Array(length);
|
|
@@ -341,7 +341,7 @@ function arrayMap(array, iteratee) {
|
|
|
341
341
|
return result;
|
|
342
342
|
}
|
|
343
343
|
var isArray = Array.isArray;
|
|
344
|
-
var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolToString = symbolProto ? symbolProto.toString : void 0;
|
|
344
|
+
var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : void 0, symbolToString = symbolProto$1 ? symbolProto$1.toString : void 0;
|
|
345
345
|
function baseToString(value) {
|
|
346
346
|
if (typeof value == "string") {
|
|
347
347
|
return value;
|
|
@@ -359,13 +359,16 @@ function isObject(value) {
|
|
|
359
359
|
var type = typeof value;
|
|
360
360
|
return value != null && (type == "object" || type == "function");
|
|
361
361
|
}
|
|
362
|
-
|
|
362
|
+
function identity$1(value) {
|
|
363
|
+
return value;
|
|
364
|
+
}
|
|
365
|
+
var asyncTag = "[object AsyncFunction]", funcTag$1 = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
|
|
363
366
|
function isFunction(value) {
|
|
364
367
|
if (!isObject(value)) {
|
|
365
368
|
return false;
|
|
366
369
|
}
|
|
367
370
|
var tag = baseGetTag(value);
|
|
368
|
-
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
371
|
+
return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
369
372
|
}
|
|
370
373
|
var coreJsData = root["__core-js_shared__"];
|
|
371
374
|
var maskSrcKey = (function() {
|
|
@@ -392,11 +395,11 @@ function toSource(func) {
|
|
|
392
395
|
}
|
|
393
396
|
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
394
397
|
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
395
|
-
var funcProto = Function.prototype, objectProto$
|
|
398
|
+
var funcProto = Function.prototype, objectProto$a = Object.prototype;
|
|
396
399
|
var funcToString = funcProto.toString;
|
|
397
|
-
var hasOwnProperty$
|
|
400
|
+
var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
|
|
398
401
|
var reIsNative = RegExp(
|
|
399
|
-
"^" + funcToString.call(hasOwnProperty$
|
|
402
|
+
"^" + funcToString.call(hasOwnProperty$8).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
400
403
|
);
|
|
401
404
|
function baseIsNative(value) {
|
|
402
405
|
if (!isObject(value) || isMasked(value)) {
|
|
@@ -412,9 +415,213 @@ function getNative(object, key) {
|
|
|
412
415
|
var value = getValue(object, key);
|
|
413
416
|
return baseIsNative(value) ? value : void 0;
|
|
414
417
|
}
|
|
418
|
+
var WeakMap = getNative(root, "WeakMap");
|
|
419
|
+
function apply(func, thisArg, args) {
|
|
420
|
+
switch (args.length) {
|
|
421
|
+
case 0:
|
|
422
|
+
return func.call(thisArg);
|
|
423
|
+
case 1:
|
|
424
|
+
return func.call(thisArg, args[0]);
|
|
425
|
+
case 2:
|
|
426
|
+
return func.call(thisArg, args[0], args[1]);
|
|
427
|
+
case 3:
|
|
428
|
+
return func.call(thisArg, args[0], args[1], args[2]);
|
|
429
|
+
}
|
|
430
|
+
return func.apply(thisArg, args);
|
|
431
|
+
}
|
|
432
|
+
var HOT_COUNT = 800, HOT_SPAN = 16;
|
|
433
|
+
var nativeNow = Date.now;
|
|
434
|
+
function shortOut(func) {
|
|
435
|
+
var count = 0, lastCalled = 0;
|
|
436
|
+
return function() {
|
|
437
|
+
var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
|
|
438
|
+
lastCalled = stamp;
|
|
439
|
+
if (remaining > 0) {
|
|
440
|
+
if (++count >= HOT_COUNT) {
|
|
441
|
+
return arguments[0];
|
|
442
|
+
}
|
|
443
|
+
} else {
|
|
444
|
+
count = 0;
|
|
445
|
+
}
|
|
446
|
+
return func.apply(void 0, arguments);
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
function constant(value) {
|
|
450
|
+
return function() {
|
|
451
|
+
return value;
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
var defineProperty = (function() {
|
|
455
|
+
try {
|
|
456
|
+
var func = getNative(Object, "defineProperty");
|
|
457
|
+
func({}, "", {});
|
|
458
|
+
return func;
|
|
459
|
+
} catch (e) {
|
|
460
|
+
}
|
|
461
|
+
})();
|
|
462
|
+
var baseSetToString = !defineProperty ? identity$1 : function(func, string) {
|
|
463
|
+
return defineProperty(func, "toString", {
|
|
464
|
+
"configurable": true,
|
|
465
|
+
"enumerable": false,
|
|
466
|
+
"value": constant(string),
|
|
467
|
+
"writable": true
|
|
468
|
+
});
|
|
469
|
+
};
|
|
470
|
+
var setToString = shortOut(baseSetToString);
|
|
471
|
+
var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
|
472
|
+
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
473
|
+
function isIndex(value, length) {
|
|
474
|
+
var type = typeof value;
|
|
475
|
+
length = length == null ? MAX_SAFE_INTEGER$1 : length;
|
|
476
|
+
return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
|
|
477
|
+
}
|
|
478
|
+
function baseAssignValue(object, key, value) {
|
|
479
|
+
if (key == "__proto__" && defineProperty) {
|
|
480
|
+
defineProperty(object, key, {
|
|
481
|
+
"configurable": true,
|
|
482
|
+
"enumerable": true,
|
|
483
|
+
"value": value,
|
|
484
|
+
"writable": true
|
|
485
|
+
});
|
|
486
|
+
} else {
|
|
487
|
+
object[key] = value;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
415
490
|
function eq(value, other) {
|
|
416
491
|
return value === other || value !== value && other !== other;
|
|
417
492
|
}
|
|
493
|
+
var objectProto$9 = Object.prototype;
|
|
494
|
+
var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
|
|
495
|
+
function assignValue(object, key, value) {
|
|
496
|
+
var objValue = object[key];
|
|
497
|
+
if (!(hasOwnProperty$7.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
|
|
498
|
+
baseAssignValue(object, key, value);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
var nativeMax = Math.max;
|
|
502
|
+
function overRest(func, start, transform) {
|
|
503
|
+
start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
|
|
504
|
+
return function() {
|
|
505
|
+
var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length);
|
|
506
|
+
while (++index < length) {
|
|
507
|
+
array[index] = args[start + index];
|
|
508
|
+
}
|
|
509
|
+
index = -1;
|
|
510
|
+
var otherArgs = Array(start + 1);
|
|
511
|
+
while (++index < start) {
|
|
512
|
+
otherArgs[index] = args[index];
|
|
513
|
+
}
|
|
514
|
+
otherArgs[start] = transform(array);
|
|
515
|
+
return apply(func, this, otherArgs);
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
519
|
+
function isLength(value) {
|
|
520
|
+
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
521
|
+
}
|
|
522
|
+
function isArrayLike(value) {
|
|
523
|
+
return value != null && isLength(value.length) && !isFunction(value);
|
|
524
|
+
}
|
|
525
|
+
var objectProto$8 = Object.prototype;
|
|
526
|
+
function isPrototype(value) {
|
|
527
|
+
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$8;
|
|
528
|
+
return value === proto;
|
|
529
|
+
}
|
|
530
|
+
function baseTimes(n, iteratee) {
|
|
531
|
+
var index = -1, result = Array(n);
|
|
532
|
+
while (++index < n) {
|
|
533
|
+
result[index] = iteratee(index);
|
|
534
|
+
}
|
|
535
|
+
return result;
|
|
536
|
+
}
|
|
537
|
+
var argsTag$2 = "[object Arguments]";
|
|
538
|
+
function baseIsArguments(value) {
|
|
539
|
+
return isObjectLike(value) && baseGetTag(value) == argsTag$2;
|
|
540
|
+
}
|
|
541
|
+
var objectProto$7 = Object.prototype;
|
|
542
|
+
var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
|
|
543
|
+
var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
|
|
544
|
+
var isArguments = baseIsArguments(/* @__PURE__ */ (function() {
|
|
545
|
+
return arguments;
|
|
546
|
+
})()) ? baseIsArguments : function(value) {
|
|
547
|
+
return isObjectLike(value) && hasOwnProperty$6.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
|
|
548
|
+
};
|
|
549
|
+
function stubFalse() {
|
|
550
|
+
return false;
|
|
551
|
+
}
|
|
552
|
+
var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
553
|
+
var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
|
|
554
|
+
var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
|
|
555
|
+
var Buffer = moduleExports$1 ? root.Buffer : void 0;
|
|
556
|
+
var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
|
|
557
|
+
var isBuffer = nativeIsBuffer || stubFalse;
|
|
558
|
+
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]";
|
|
559
|
+
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]";
|
|
560
|
+
var typedArrayTags = {};
|
|
561
|
+
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
|
|
562
|
+
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;
|
|
563
|
+
function baseIsTypedArray(value) {
|
|
564
|
+
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
|
565
|
+
}
|
|
566
|
+
function baseUnary(func) {
|
|
567
|
+
return function(value) {
|
|
568
|
+
return func(value);
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
572
|
+
var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
|
|
573
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
574
|
+
var freeProcess = moduleExports && freeGlobal.process;
|
|
575
|
+
var nodeUtil = (function() {
|
|
576
|
+
try {
|
|
577
|
+
var types = freeModule && freeModule.require && freeModule.require("util").types;
|
|
578
|
+
if (types) {
|
|
579
|
+
return types;
|
|
580
|
+
}
|
|
581
|
+
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
582
|
+
} catch (e) {
|
|
583
|
+
}
|
|
584
|
+
})();
|
|
585
|
+
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
586
|
+
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
587
|
+
var objectProto$6 = Object.prototype;
|
|
588
|
+
var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
|
|
589
|
+
function arrayLikeKeys(value, inherited) {
|
|
590
|
+
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;
|
|
591
|
+
for (var key in value) {
|
|
592
|
+
if (hasOwnProperty$5.call(value, key) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
593
|
+
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
594
|
+
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
595
|
+
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
|
|
596
|
+
isIndex(key, length)))) {
|
|
597
|
+
result.push(key);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
return result;
|
|
601
|
+
}
|
|
602
|
+
function overArg(func, transform) {
|
|
603
|
+
return function(arg) {
|
|
604
|
+
return func(transform(arg));
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
var nativeKeys = overArg(Object.keys, Object);
|
|
608
|
+
var objectProto$5 = Object.prototype;
|
|
609
|
+
var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
|
|
610
|
+
function baseKeys(object) {
|
|
611
|
+
if (!isPrototype(object)) {
|
|
612
|
+
return nativeKeys(object);
|
|
613
|
+
}
|
|
614
|
+
var result = [];
|
|
615
|
+
for (var key in Object(object)) {
|
|
616
|
+
if (hasOwnProperty$4.call(object, key) && key != "constructor") {
|
|
617
|
+
result.push(key);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
return result;
|
|
621
|
+
}
|
|
622
|
+
function keys(object) {
|
|
623
|
+
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
624
|
+
}
|
|
418
625
|
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
|
|
419
626
|
function isKey(value, object) {
|
|
420
627
|
if (isArray(value)) {
|
|
@@ -436,28 +643,28 @@ function hashDelete(key) {
|
|
|
436
643
|
this.size -= result ? 1 : 0;
|
|
437
644
|
return result;
|
|
438
645
|
}
|
|
439
|
-
var HASH_UNDEFINED$
|
|
440
|
-
var objectProto$
|
|
441
|
-
var hasOwnProperty$
|
|
646
|
+
var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
|
|
647
|
+
var objectProto$4 = Object.prototype;
|
|
648
|
+
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
442
649
|
function hashGet(key) {
|
|
443
650
|
var data = this.__data__;
|
|
444
651
|
if (nativeCreate) {
|
|
445
652
|
var result = data[key];
|
|
446
|
-
return result === HASH_UNDEFINED$
|
|
653
|
+
return result === HASH_UNDEFINED$2 ? void 0 : result;
|
|
447
654
|
}
|
|
448
|
-
return hasOwnProperty$
|
|
655
|
+
return hasOwnProperty$3.call(data, key) ? data[key] : void 0;
|
|
449
656
|
}
|
|
450
|
-
var objectProto = Object.prototype;
|
|
451
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
657
|
+
var objectProto$3 = Object.prototype;
|
|
658
|
+
var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
|
|
452
659
|
function hashHas(key) {
|
|
453
660
|
var data = this.__data__;
|
|
454
|
-
return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
|
|
661
|
+
return nativeCreate ? data[key] !== void 0 : hasOwnProperty$2.call(data, key);
|
|
455
662
|
}
|
|
456
|
-
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
663
|
+
var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
|
|
457
664
|
function hashSet(key, value) {
|
|
458
665
|
var data = this.__data__;
|
|
459
666
|
this.size += this.has(key) ? 0 : 1;
|
|
460
|
-
data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
|
|
667
|
+
data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED$1 : value;
|
|
461
668
|
return this;
|
|
462
669
|
}
|
|
463
670
|
function Hash(entries) {
|
|
@@ -648,6 +855,388 @@ function get(object, path, defaultValue) {
|
|
|
648
855
|
var result = object == null ? void 0 : baseGet(object, path);
|
|
649
856
|
return result === void 0 ? defaultValue : result;
|
|
650
857
|
}
|
|
858
|
+
function arrayPush(array, values) {
|
|
859
|
+
var index = -1, length = values.length, offset = array.length;
|
|
860
|
+
while (++index < length) {
|
|
861
|
+
array[offset + index] = values[index];
|
|
862
|
+
}
|
|
863
|
+
return array;
|
|
864
|
+
}
|
|
865
|
+
var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : void 0;
|
|
866
|
+
function isFlattenable(value) {
|
|
867
|
+
return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
868
|
+
}
|
|
869
|
+
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
870
|
+
var index = -1, length = array.length;
|
|
871
|
+
predicate || (predicate = isFlattenable);
|
|
872
|
+
result || (result = []);
|
|
873
|
+
while (++index < length) {
|
|
874
|
+
var value = array[index];
|
|
875
|
+
if (predicate(value)) {
|
|
876
|
+
{
|
|
877
|
+
arrayPush(result, value);
|
|
878
|
+
}
|
|
879
|
+
} else {
|
|
880
|
+
result[result.length] = value;
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
return result;
|
|
884
|
+
}
|
|
885
|
+
function flatten(array) {
|
|
886
|
+
var length = array == null ? 0 : array.length;
|
|
887
|
+
return length ? baseFlatten(array) : [];
|
|
888
|
+
}
|
|
889
|
+
function flatRest(func) {
|
|
890
|
+
return setToString(overRest(func, void 0, flatten), func + "");
|
|
891
|
+
}
|
|
892
|
+
function stackClear() {
|
|
893
|
+
this.__data__ = new ListCache();
|
|
894
|
+
this.size = 0;
|
|
895
|
+
}
|
|
896
|
+
function stackDelete(key) {
|
|
897
|
+
var data = this.__data__, result = data["delete"](key);
|
|
898
|
+
this.size = data.size;
|
|
899
|
+
return result;
|
|
900
|
+
}
|
|
901
|
+
function stackGet(key) {
|
|
902
|
+
return this.__data__.get(key);
|
|
903
|
+
}
|
|
904
|
+
function stackHas(key) {
|
|
905
|
+
return this.__data__.has(key);
|
|
906
|
+
}
|
|
907
|
+
var LARGE_ARRAY_SIZE = 200;
|
|
908
|
+
function stackSet(key, value) {
|
|
909
|
+
var data = this.__data__;
|
|
910
|
+
if (data instanceof ListCache) {
|
|
911
|
+
var pairs = data.__data__;
|
|
912
|
+
if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
913
|
+
pairs.push([key, value]);
|
|
914
|
+
this.size = ++data.size;
|
|
915
|
+
return this;
|
|
916
|
+
}
|
|
917
|
+
data = this.__data__ = new MapCache(pairs);
|
|
918
|
+
}
|
|
919
|
+
data.set(key, value);
|
|
920
|
+
this.size = data.size;
|
|
921
|
+
return this;
|
|
922
|
+
}
|
|
923
|
+
function Stack(entries) {
|
|
924
|
+
var data = this.__data__ = new ListCache(entries);
|
|
925
|
+
this.size = data.size;
|
|
926
|
+
}
|
|
927
|
+
Stack.prototype.clear = stackClear;
|
|
928
|
+
Stack.prototype["delete"] = stackDelete;
|
|
929
|
+
Stack.prototype.get = stackGet;
|
|
930
|
+
Stack.prototype.has = stackHas;
|
|
931
|
+
Stack.prototype.set = stackSet;
|
|
932
|
+
function arrayFilter(array, predicate) {
|
|
933
|
+
var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
|
|
934
|
+
while (++index < length) {
|
|
935
|
+
var value = array[index];
|
|
936
|
+
if (predicate(value, index, array)) {
|
|
937
|
+
result[resIndex++] = value;
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
return result;
|
|
941
|
+
}
|
|
942
|
+
function stubArray() {
|
|
943
|
+
return [];
|
|
944
|
+
}
|
|
945
|
+
var objectProto$2 = Object.prototype;
|
|
946
|
+
var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
|
|
947
|
+
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
948
|
+
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
|
949
|
+
if (object == null) {
|
|
950
|
+
return [];
|
|
951
|
+
}
|
|
952
|
+
object = Object(object);
|
|
953
|
+
return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
|
954
|
+
return propertyIsEnumerable.call(object, symbol);
|
|
955
|
+
});
|
|
956
|
+
};
|
|
957
|
+
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
958
|
+
var result = keysFunc(object);
|
|
959
|
+
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
960
|
+
}
|
|
961
|
+
function getAllKeys(object) {
|
|
962
|
+
return baseGetAllKeys(object, keys, getSymbols);
|
|
963
|
+
}
|
|
964
|
+
var DataView = getNative(root, "DataView");
|
|
965
|
+
var Promise$1 = getNative(root, "Promise");
|
|
966
|
+
var Set$1 = getNative(root, "Set");
|
|
967
|
+
var mapTag$1 = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag$1 = "[object Set]", weakMapTag = "[object WeakMap]";
|
|
968
|
+
var dataViewTag$1 = "[object DataView]";
|
|
969
|
+
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap);
|
|
970
|
+
var getTag = baseGetTag;
|
|
971
|
+
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$1 || Map && getTag(new Map()) != mapTag$1 || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag$1 || WeakMap && getTag(new WeakMap()) != weakMapTag) {
|
|
972
|
+
getTag = function(value) {
|
|
973
|
+
var result = baseGetTag(value), Ctor = result == objectTag$1 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
|
|
974
|
+
if (ctorString) {
|
|
975
|
+
switch (ctorString) {
|
|
976
|
+
case dataViewCtorString:
|
|
977
|
+
return dataViewTag$1;
|
|
978
|
+
case mapCtorString:
|
|
979
|
+
return mapTag$1;
|
|
980
|
+
case promiseCtorString:
|
|
981
|
+
return promiseTag;
|
|
982
|
+
case setCtorString:
|
|
983
|
+
return setTag$1;
|
|
984
|
+
case weakMapCtorString:
|
|
985
|
+
return weakMapTag;
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
return result;
|
|
989
|
+
};
|
|
990
|
+
}
|
|
991
|
+
var Uint8Array = root.Uint8Array;
|
|
992
|
+
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
993
|
+
function setCacheAdd(value) {
|
|
994
|
+
this.__data__.set(value, HASH_UNDEFINED);
|
|
995
|
+
return this;
|
|
996
|
+
}
|
|
997
|
+
function setCacheHas(value) {
|
|
998
|
+
return this.__data__.has(value);
|
|
999
|
+
}
|
|
1000
|
+
function SetCache(values) {
|
|
1001
|
+
var index = -1, length = values == null ? 0 : values.length;
|
|
1002
|
+
this.__data__ = new MapCache();
|
|
1003
|
+
while (++index < length) {
|
|
1004
|
+
this.add(values[index]);
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
|
1008
|
+
SetCache.prototype.has = setCacheHas;
|
|
1009
|
+
function arraySome(array, predicate) {
|
|
1010
|
+
var index = -1, length = array == null ? 0 : array.length;
|
|
1011
|
+
while (++index < length) {
|
|
1012
|
+
if (predicate(array[index], index, array)) {
|
|
1013
|
+
return true;
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
return false;
|
|
1017
|
+
}
|
|
1018
|
+
function cacheHas(cache, key) {
|
|
1019
|
+
return cache.has(key);
|
|
1020
|
+
}
|
|
1021
|
+
var COMPARE_PARTIAL_FLAG$3 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
|
|
1022
|
+
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
1023
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, arrLength = array.length, othLength = other.length;
|
|
1024
|
+
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
|
1025
|
+
return false;
|
|
1026
|
+
}
|
|
1027
|
+
var arrStacked = stack.get(array);
|
|
1028
|
+
var othStacked = stack.get(other);
|
|
1029
|
+
if (arrStacked && othStacked) {
|
|
1030
|
+
return arrStacked == other && othStacked == array;
|
|
1031
|
+
}
|
|
1032
|
+
var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$1 ? new SetCache() : void 0;
|
|
1033
|
+
stack.set(array, other);
|
|
1034
|
+
stack.set(other, array);
|
|
1035
|
+
while (++index < arrLength) {
|
|
1036
|
+
var arrValue = array[index], othValue = other[index];
|
|
1037
|
+
if (customizer) {
|
|
1038
|
+
var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
|
|
1039
|
+
}
|
|
1040
|
+
if (compared !== void 0) {
|
|
1041
|
+
if (compared) {
|
|
1042
|
+
continue;
|
|
1043
|
+
}
|
|
1044
|
+
result = false;
|
|
1045
|
+
break;
|
|
1046
|
+
}
|
|
1047
|
+
if (seen) {
|
|
1048
|
+
if (!arraySome(other, function(othValue2, othIndex) {
|
|
1049
|
+
if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
|
|
1050
|
+
return seen.push(othIndex);
|
|
1051
|
+
}
|
|
1052
|
+
})) {
|
|
1053
|
+
result = false;
|
|
1054
|
+
break;
|
|
1055
|
+
}
|
|
1056
|
+
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
|
1057
|
+
result = false;
|
|
1058
|
+
break;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
stack["delete"](array);
|
|
1062
|
+
stack["delete"](other);
|
|
1063
|
+
return result;
|
|
1064
|
+
}
|
|
1065
|
+
function mapToArray(map) {
|
|
1066
|
+
var index = -1, result = Array(map.size);
|
|
1067
|
+
map.forEach(function(value, key) {
|
|
1068
|
+
result[++index] = [key, value];
|
|
1069
|
+
});
|
|
1070
|
+
return result;
|
|
1071
|
+
}
|
|
1072
|
+
function setToArray(set) {
|
|
1073
|
+
var index = -1, result = Array(set.size);
|
|
1074
|
+
set.forEach(function(value) {
|
|
1075
|
+
result[++index] = value;
|
|
1076
|
+
});
|
|
1077
|
+
return result;
|
|
1078
|
+
}
|
|
1079
|
+
var COMPARE_PARTIAL_FLAG$2 = 1, COMPARE_UNORDERED_FLAG = 2;
|
|
1080
|
+
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]";
|
|
1081
|
+
var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
|
|
1082
|
+
var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
|
|
1083
|
+
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
1084
|
+
switch (tag) {
|
|
1085
|
+
case dataViewTag:
|
|
1086
|
+
if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
|
|
1087
|
+
return false;
|
|
1088
|
+
}
|
|
1089
|
+
object = object.buffer;
|
|
1090
|
+
other = other.buffer;
|
|
1091
|
+
case arrayBufferTag:
|
|
1092
|
+
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
|
1093
|
+
return false;
|
|
1094
|
+
}
|
|
1095
|
+
return true;
|
|
1096
|
+
case boolTag:
|
|
1097
|
+
case dateTag:
|
|
1098
|
+
case numberTag:
|
|
1099
|
+
return eq(+object, +other);
|
|
1100
|
+
case errorTag:
|
|
1101
|
+
return object.name == other.name && object.message == other.message;
|
|
1102
|
+
case regexpTag:
|
|
1103
|
+
case stringTag:
|
|
1104
|
+
return object == other + "";
|
|
1105
|
+
case mapTag:
|
|
1106
|
+
var convert = mapToArray;
|
|
1107
|
+
case setTag:
|
|
1108
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
|
|
1109
|
+
convert || (convert = setToArray);
|
|
1110
|
+
if (object.size != other.size && !isPartial) {
|
|
1111
|
+
return false;
|
|
1112
|
+
}
|
|
1113
|
+
var stacked = stack.get(object);
|
|
1114
|
+
if (stacked) {
|
|
1115
|
+
return stacked == other;
|
|
1116
|
+
}
|
|
1117
|
+
bitmask |= COMPARE_UNORDERED_FLAG;
|
|
1118
|
+
stack.set(object, other);
|
|
1119
|
+
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
|
1120
|
+
stack["delete"](object);
|
|
1121
|
+
return result;
|
|
1122
|
+
case symbolTag:
|
|
1123
|
+
if (symbolValueOf) {
|
|
1124
|
+
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
return false;
|
|
1128
|
+
}
|
|
1129
|
+
var COMPARE_PARTIAL_FLAG$1 = 1;
|
|
1130
|
+
var objectProto$1 = Object.prototype;
|
|
1131
|
+
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
1132
|
+
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
1133
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
|
|
1134
|
+
if (objLength != othLength && !isPartial) {
|
|
1135
|
+
return false;
|
|
1136
|
+
}
|
|
1137
|
+
var index = objLength;
|
|
1138
|
+
while (index--) {
|
|
1139
|
+
var key = objProps[index];
|
|
1140
|
+
if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
|
|
1141
|
+
return false;
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
var objStacked = stack.get(object);
|
|
1145
|
+
var othStacked = stack.get(other);
|
|
1146
|
+
if (objStacked && othStacked) {
|
|
1147
|
+
return objStacked == other && othStacked == object;
|
|
1148
|
+
}
|
|
1149
|
+
var result = true;
|
|
1150
|
+
stack.set(object, other);
|
|
1151
|
+
stack.set(other, object);
|
|
1152
|
+
var skipCtor = isPartial;
|
|
1153
|
+
while (++index < objLength) {
|
|
1154
|
+
key = objProps[index];
|
|
1155
|
+
var objValue = object[key], othValue = other[key];
|
|
1156
|
+
if (customizer) {
|
|
1157
|
+
var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
|
|
1158
|
+
}
|
|
1159
|
+
if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
|
|
1160
|
+
result = false;
|
|
1161
|
+
break;
|
|
1162
|
+
}
|
|
1163
|
+
skipCtor || (skipCtor = key == "constructor");
|
|
1164
|
+
}
|
|
1165
|
+
if (result && !skipCtor) {
|
|
1166
|
+
var objCtor = object.constructor, othCtor = other.constructor;
|
|
1167
|
+
if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
|
|
1168
|
+
result = false;
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
stack["delete"](object);
|
|
1172
|
+
stack["delete"](other);
|
|
1173
|
+
return result;
|
|
1174
|
+
}
|
|
1175
|
+
var COMPARE_PARTIAL_FLAG = 1;
|
|
1176
|
+
var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
|
|
1177
|
+
var objectProto = Object.prototype;
|
|
1178
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
1179
|
+
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
1180
|
+
var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
|
|
1181
|
+
objTag = objTag == argsTag ? objectTag : objTag;
|
|
1182
|
+
othTag = othTag == argsTag ? objectTag : othTag;
|
|
1183
|
+
var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
|
|
1184
|
+
if (isSameTag && isBuffer(object)) {
|
|
1185
|
+
if (!isBuffer(other)) {
|
|
1186
|
+
return false;
|
|
1187
|
+
}
|
|
1188
|
+
objIsArr = true;
|
|
1189
|
+
objIsObj = false;
|
|
1190
|
+
}
|
|
1191
|
+
if (isSameTag && !objIsObj) {
|
|
1192
|
+
stack || (stack = new Stack());
|
|
1193
|
+
return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
1194
|
+
}
|
|
1195
|
+
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
1196
|
+
var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
|
|
1197
|
+
if (objIsWrapped || othIsWrapped) {
|
|
1198
|
+
var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
|
|
1199
|
+
stack || (stack = new Stack());
|
|
1200
|
+
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
if (!isSameTag) {
|
|
1204
|
+
return false;
|
|
1205
|
+
}
|
|
1206
|
+
stack || (stack = new Stack());
|
|
1207
|
+
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
|
1208
|
+
}
|
|
1209
|
+
function baseIsEqual(value, other, bitmask, customizer, stack) {
|
|
1210
|
+
if (value === other) {
|
|
1211
|
+
return true;
|
|
1212
|
+
}
|
|
1213
|
+
if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
|
|
1214
|
+
return value !== value && other !== other;
|
|
1215
|
+
}
|
|
1216
|
+
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
|
1217
|
+
}
|
|
1218
|
+
function baseHasIn(object, key) {
|
|
1219
|
+
return object != null && key in Object(object);
|
|
1220
|
+
}
|
|
1221
|
+
function hasPath(object, path, hasFunc) {
|
|
1222
|
+
path = castPath(path, object);
|
|
1223
|
+
var index = -1, length = path.length, result = false;
|
|
1224
|
+
while (++index < length) {
|
|
1225
|
+
var key = toKey(path[index]);
|
|
1226
|
+
if (!(result = object != null && hasFunc(object, key))) {
|
|
1227
|
+
break;
|
|
1228
|
+
}
|
|
1229
|
+
object = object[key];
|
|
1230
|
+
}
|
|
1231
|
+
if (result || ++index != length) {
|
|
1232
|
+
return result;
|
|
1233
|
+
}
|
|
1234
|
+
length = object == null ? 0 : object.length;
|
|
1235
|
+
return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
|
|
1236
|
+
}
|
|
1237
|
+
function hasIn(object, path) {
|
|
1238
|
+
return object != null && hasPath(object, path, baseHasIn);
|
|
1239
|
+
}
|
|
651
1240
|
function fromPairs(pairs) {
|
|
652
1241
|
var index = -1, length = pairs == null ? 0 : pairs.length, result = {};
|
|
653
1242
|
while (++index < length) {
|
|
@@ -656,9 +1245,53 @@ function fromPairs(pairs) {
|
|
|
656
1245
|
}
|
|
657
1246
|
return result;
|
|
658
1247
|
}
|
|
1248
|
+
function isEqual(value, other) {
|
|
1249
|
+
return baseIsEqual(value, other);
|
|
1250
|
+
}
|
|
659
1251
|
function isNil(value) {
|
|
660
1252
|
return value == null;
|
|
661
1253
|
}
|
|
1254
|
+
function baseSet(object, path, value, customizer) {
|
|
1255
|
+
if (!isObject(object)) {
|
|
1256
|
+
return object;
|
|
1257
|
+
}
|
|
1258
|
+
path = castPath(path, object);
|
|
1259
|
+
var index = -1, length = path.length, lastIndex = length - 1, nested = object;
|
|
1260
|
+
while (nested != null && ++index < length) {
|
|
1261
|
+
var key = toKey(path[index]), newValue = value;
|
|
1262
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
1263
|
+
return object;
|
|
1264
|
+
}
|
|
1265
|
+
if (index != lastIndex) {
|
|
1266
|
+
var objValue = nested[key];
|
|
1267
|
+
newValue = void 0;
|
|
1268
|
+
if (newValue === void 0) {
|
|
1269
|
+
newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
assignValue(nested, key, newValue);
|
|
1273
|
+
nested = nested[key];
|
|
1274
|
+
}
|
|
1275
|
+
return object;
|
|
1276
|
+
}
|
|
1277
|
+
function basePickBy(object, paths, predicate) {
|
|
1278
|
+
var index = -1, length = paths.length, result = {};
|
|
1279
|
+
while (++index < length) {
|
|
1280
|
+
var path = paths[index], value = baseGet(object, path);
|
|
1281
|
+
if (predicate(value, path)) {
|
|
1282
|
+
baseSet(result, castPath(path, object), value);
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
return result;
|
|
1286
|
+
}
|
|
1287
|
+
function basePick(object, paths) {
|
|
1288
|
+
return basePickBy(object, paths, function(value, path) {
|
|
1289
|
+
return hasIn(object, path);
|
|
1290
|
+
});
|
|
1291
|
+
}
|
|
1292
|
+
var pick = flatRest(function(object, paths) {
|
|
1293
|
+
return object == null ? {} : basePick(object, paths);
|
|
1294
|
+
});
|
|
662
1295
|
const isUndefined = (val) => val === void 0;
|
|
663
1296
|
const isBoolean = (val) => typeof val === "boolean";
|
|
664
1297
|
const isNumber = (val) => typeof val === "number";
|
|
@@ -1128,13 +1761,15 @@ const provideGlobalConfig = (config, app, global2 = false) => {
|
|
|
1128
1761
|
return context;
|
|
1129
1762
|
};
|
|
1130
1763
|
const mergeConfig = (a, b) => {
|
|
1131
|
-
const
|
|
1764
|
+
const keys2 = [.../* @__PURE__ */ new Set([...keysOf(a), ...keysOf(b)])];
|
|
1132
1765
|
const obj = {};
|
|
1133
|
-
for (const key of
|
|
1766
|
+
for (const key of keys2) {
|
|
1134
1767
|
obj[key] = b[key] !== void 0 ? b[key] : a[key];
|
|
1135
1768
|
}
|
|
1136
1769
|
return obj;
|
|
1137
1770
|
};
|
|
1771
|
+
const UPDATE_MODEL_EVENT = "update:modelValue";
|
|
1772
|
+
const CHANGE_EVENT = "change";
|
|
1138
1773
|
var _export_sfc = (sfc, props) => {
|
|
1139
1774
|
const target = sfc.__vccOpts || sfc;
|
|
1140
1775
|
for (const [key, val] of props) {
|
|
@@ -1151,6 +1786,8 @@ function addUnit(value, defaultUnit = "px") {
|
|
|
1151
1786
|
return value;
|
|
1152
1787
|
}
|
|
1153
1788
|
}
|
|
1789
|
+
function debugWarn(scope, message) {
|
|
1790
|
+
}
|
|
1154
1791
|
const withInstall = (main, extra) => {
|
|
1155
1792
|
main.install = (app) => {
|
|
1156
1793
|
for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
|
|
@@ -1183,12 +1820,12 @@ const iconProps = buildProps({
|
|
|
1183
1820
|
type: String
|
|
1184
1821
|
}
|
|
1185
1822
|
});
|
|
1186
|
-
const __default__ = defineComponent({
|
|
1823
|
+
const __default__$5 = defineComponent({
|
|
1187
1824
|
name: "ElIcon",
|
|
1188
1825
|
inheritAttrs: false
|
|
1189
1826
|
});
|
|
1190
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1191
|
-
...__default__,
|
|
1827
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
1828
|
+
...__default__$5,
|
|
1192
1829
|
props: iconProps,
|
|
1193
1830
|
setup(__props) {
|
|
1194
1831
|
const props = __props;
|
|
@@ -1212,7 +1849,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1212
1849
|
};
|
|
1213
1850
|
}
|
|
1214
1851
|
});
|
|
1215
|
-
var Icon = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "icon.vue"]]);
|
|
1852
|
+
var Icon = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "icon.vue"]]);
|
|
1216
1853
|
const ElIcon = withInstall(Icon);
|
|
1217
1854
|
/*! Element Plus Icons Vue v2.3.2 */
|
|
1218
1855
|
var _sfc_main50 = /* @__PURE__ */ defineComponent({
|
|
@@ -1320,6 +1957,1876 @@ const TypeComponentsMap = {
|
|
|
1320
1957
|
error: circle_close_filled_default,
|
|
1321
1958
|
info: info_filled_default
|
|
1322
1959
|
};
|
|
1960
|
+
const ariaProps = buildProps({
|
|
1961
|
+
ariaLabel: String,
|
|
1962
|
+
ariaOrientation: {
|
|
1963
|
+
type: String,
|
|
1964
|
+
values: ["horizontal", "vertical", "undefined"]
|
|
1965
|
+
},
|
|
1966
|
+
ariaControls: String
|
|
1967
|
+
});
|
|
1968
|
+
const useAriaProps = (arias) => {
|
|
1969
|
+
return pick(ariaProps, arias);
|
|
1970
|
+
};
|
|
1971
|
+
const defaultIdInjection = {
|
|
1972
|
+
prefix: Math.floor(Math.random() * 1e4),
|
|
1973
|
+
current: 0
|
|
1974
|
+
};
|
|
1975
|
+
const ID_INJECTION_KEY = Symbol("elIdInjection");
|
|
1976
|
+
const useIdInjection = () => {
|
|
1977
|
+
return getCurrentInstance() ? inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
|
|
1978
|
+
};
|
|
1979
|
+
const useId = (deterministicId) => {
|
|
1980
|
+
const idInjection = useIdInjection();
|
|
1981
|
+
const namespace = useGetDerivedNamespace();
|
|
1982
|
+
const idRef = computedEager(() => unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
|
|
1983
|
+
return idRef;
|
|
1984
|
+
};
|
|
1985
|
+
const formContextKey = Symbol("formContextKey");
|
|
1986
|
+
const formItemContextKey = Symbol("formItemContextKey");
|
|
1987
|
+
const useFormItem = () => {
|
|
1988
|
+
const form = inject(formContextKey, void 0);
|
|
1989
|
+
const formItem = inject(formItemContextKey, void 0);
|
|
1990
|
+
return {
|
|
1991
|
+
form,
|
|
1992
|
+
formItem
|
|
1993
|
+
};
|
|
1994
|
+
};
|
|
1995
|
+
const useFormItemInputId = (props, {
|
|
1996
|
+
formItemContext,
|
|
1997
|
+
disableIdGeneration,
|
|
1998
|
+
disableIdManagement
|
|
1999
|
+
}) => {
|
|
2000
|
+
if (!disableIdGeneration) {
|
|
2001
|
+
disableIdGeneration = ref(false);
|
|
2002
|
+
}
|
|
2003
|
+
if (!disableIdManagement) {
|
|
2004
|
+
disableIdManagement = ref(false);
|
|
2005
|
+
}
|
|
2006
|
+
const instance = getCurrentInstance();
|
|
2007
|
+
const inLabel = () => {
|
|
2008
|
+
let parent = instance == null ? void 0 : instance.parent;
|
|
2009
|
+
while (parent) {
|
|
2010
|
+
if (parent.type.name === "ElFormItem") {
|
|
2011
|
+
return false;
|
|
2012
|
+
}
|
|
2013
|
+
if (parent.type.name === "ElLabelWrap") {
|
|
2014
|
+
return true;
|
|
2015
|
+
}
|
|
2016
|
+
parent = parent.parent;
|
|
2017
|
+
}
|
|
2018
|
+
return false;
|
|
2019
|
+
};
|
|
2020
|
+
const inputId = ref();
|
|
2021
|
+
let idUnwatch = void 0;
|
|
2022
|
+
const isLabeledByFormItem = computed(() => {
|
|
2023
|
+
var _a2;
|
|
2024
|
+
return !!(!(props.label || props.ariaLabel) && formItemContext && formItemContext.inputIds && ((_a2 = formItemContext.inputIds) == null ? void 0 : _a2.length) <= 1);
|
|
2025
|
+
});
|
|
2026
|
+
onMounted(() => {
|
|
2027
|
+
idUnwatch = watch([toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
|
|
2028
|
+
const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
|
|
2029
|
+
if (newId !== inputId.value) {
|
|
2030
|
+
if ((formItemContext == null ? void 0 : formItemContext.removeInputId) && !inLabel()) {
|
|
2031
|
+
inputId.value && formItemContext.removeInputId(inputId.value);
|
|
2032
|
+
if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
|
|
2033
|
+
formItemContext.addInputId(newId);
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
inputId.value = newId;
|
|
2037
|
+
}
|
|
2038
|
+
}, { immediate: true });
|
|
2039
|
+
});
|
|
2040
|
+
onUnmounted(() => {
|
|
2041
|
+
idUnwatch && idUnwatch();
|
|
2042
|
+
if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
|
|
2043
|
+
inputId.value && formItemContext.removeInputId(inputId.value);
|
|
2044
|
+
}
|
|
2045
|
+
});
|
|
2046
|
+
return {
|
|
2047
|
+
isLabeledByFormItem,
|
|
2048
|
+
inputId
|
|
2049
|
+
};
|
|
2050
|
+
};
|
|
2051
|
+
const useProp = (name) => {
|
|
2052
|
+
const vm = getCurrentInstance();
|
|
2053
|
+
return computed(() => {
|
|
2054
|
+
var _a2, _b;
|
|
2055
|
+
return (_b = (_a2 = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a2.$props) == null ? void 0 : _b[name];
|
|
2056
|
+
});
|
|
2057
|
+
};
|
|
2058
|
+
const useFormSize = (fallback, ignore = {}) => {
|
|
2059
|
+
const emptyRef = ref(void 0);
|
|
2060
|
+
const size = ignore.prop ? emptyRef : useProp("size");
|
|
2061
|
+
const globalConfig2 = ignore.global ? emptyRef : useGlobalSize();
|
|
2062
|
+
const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
|
|
2063
|
+
const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
|
|
2064
|
+
return computed(() => size.value || unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig2.value || "");
|
|
2065
|
+
};
|
|
2066
|
+
const useFormDisabled = (fallback) => {
|
|
2067
|
+
const disabled = useProp("disabled");
|
|
2068
|
+
const form = inject(formContextKey, void 0);
|
|
2069
|
+
return computed(() => disabled.value || unref(fallback) || (form == null ? void 0 : form.disabled) || false);
|
|
2070
|
+
};
|
|
2071
|
+
const buttonGroupContextKey = Symbol("buttonGroupContextKey");
|
|
2072
|
+
const useDeprecated = ({ from, replacement, scope, version, ref: ref2, type = "API" }, condition) => {
|
|
2073
|
+
watch(() => unref(condition), (val) => {
|
|
2074
|
+
}, {
|
|
2075
|
+
immediate: true
|
|
2076
|
+
});
|
|
2077
|
+
};
|
|
2078
|
+
const useButton = (props, emit) => {
|
|
2079
|
+
useDeprecated({
|
|
2080
|
+
from: "type.text",
|
|
2081
|
+
replacement: "link",
|
|
2082
|
+
version: "3.0.0",
|
|
2083
|
+
scope: "props",
|
|
2084
|
+
ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
|
|
2085
|
+
}, computed(() => props.type === "text"));
|
|
2086
|
+
const buttonGroupContext = inject(buttonGroupContextKey, void 0);
|
|
2087
|
+
const globalConfig2 = useGlobalConfig("button");
|
|
2088
|
+
const { form } = useFormItem();
|
|
2089
|
+
const _size = useFormSize(computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
|
|
2090
|
+
const _disabled = useFormDisabled();
|
|
2091
|
+
const _ref = ref();
|
|
2092
|
+
const slots = useSlots();
|
|
2093
|
+
const _type = computed(() => {
|
|
2094
|
+
var _a2;
|
|
2095
|
+
return props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || ((_a2 = globalConfig2.value) == null ? void 0 : _a2.type) || "";
|
|
2096
|
+
});
|
|
2097
|
+
const autoInsertSpace = computed(() => {
|
|
2098
|
+
var _a2, _b, _c;
|
|
2099
|
+
return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a2 = globalConfig2.value) == null ? void 0 : _a2.autoInsertSpace) != null ? _c : false;
|
|
2100
|
+
});
|
|
2101
|
+
const _plain = computed(() => {
|
|
2102
|
+
var _a2, _b, _c;
|
|
2103
|
+
return (_c = (_b = props.plain) != null ? _b : (_a2 = globalConfig2.value) == null ? void 0 : _a2.plain) != null ? _c : false;
|
|
2104
|
+
});
|
|
2105
|
+
const _round = computed(() => {
|
|
2106
|
+
var _a2, _b, _c;
|
|
2107
|
+
return (_c = (_b = props.round) != null ? _b : (_a2 = globalConfig2.value) == null ? void 0 : _a2.round) != null ? _c : false;
|
|
2108
|
+
});
|
|
2109
|
+
const _props = computed(() => {
|
|
2110
|
+
if (props.tag === "button") {
|
|
2111
|
+
return {
|
|
2112
|
+
ariaDisabled: _disabled.value || props.loading,
|
|
2113
|
+
disabled: _disabled.value || props.loading,
|
|
2114
|
+
autofocus: props.autofocus,
|
|
2115
|
+
type: props.nativeType
|
|
2116
|
+
};
|
|
2117
|
+
}
|
|
2118
|
+
return {};
|
|
2119
|
+
});
|
|
2120
|
+
const shouldAddSpace = computed(() => {
|
|
2121
|
+
var _a2;
|
|
2122
|
+
const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
|
|
2123
|
+
if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
|
|
2124
|
+
const slot = defaultSlot[0];
|
|
2125
|
+
if ((slot == null ? void 0 : slot.type) === Text) {
|
|
2126
|
+
const text = slot.children;
|
|
2127
|
+
return new RegExp("^\\p{Unified_Ideograph}{2}$", "u").test(text.trim());
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
return false;
|
|
2131
|
+
});
|
|
2132
|
+
const handleClick = (evt) => {
|
|
2133
|
+
if (_disabled.value || props.loading) {
|
|
2134
|
+
evt.stopPropagation();
|
|
2135
|
+
return;
|
|
2136
|
+
}
|
|
2137
|
+
if (props.nativeType === "reset") {
|
|
2138
|
+
form == null ? void 0 : form.resetFields();
|
|
2139
|
+
}
|
|
2140
|
+
emit("click", evt);
|
|
2141
|
+
};
|
|
2142
|
+
return {
|
|
2143
|
+
_disabled,
|
|
2144
|
+
_size,
|
|
2145
|
+
_type,
|
|
2146
|
+
_ref,
|
|
2147
|
+
_props,
|
|
2148
|
+
_plain,
|
|
2149
|
+
_round,
|
|
2150
|
+
shouldAddSpace,
|
|
2151
|
+
handleClick
|
|
2152
|
+
};
|
|
2153
|
+
};
|
|
2154
|
+
const buttonTypes = [
|
|
2155
|
+
"default",
|
|
2156
|
+
"primary",
|
|
2157
|
+
"success",
|
|
2158
|
+
"warning",
|
|
2159
|
+
"info",
|
|
2160
|
+
"danger",
|
|
2161
|
+
"text",
|
|
2162
|
+
""
|
|
2163
|
+
];
|
|
2164
|
+
const buttonNativeTypes = ["button", "submit", "reset"];
|
|
2165
|
+
const buttonProps = buildProps({
|
|
2166
|
+
size: useSizeProp,
|
|
2167
|
+
disabled: Boolean,
|
|
2168
|
+
type: {
|
|
2169
|
+
type: String,
|
|
2170
|
+
values: buttonTypes,
|
|
2171
|
+
default: ""
|
|
2172
|
+
},
|
|
2173
|
+
icon: {
|
|
2174
|
+
type: iconPropType
|
|
2175
|
+
},
|
|
2176
|
+
nativeType: {
|
|
2177
|
+
type: String,
|
|
2178
|
+
values: buttonNativeTypes,
|
|
2179
|
+
default: "button"
|
|
2180
|
+
},
|
|
2181
|
+
loading: Boolean,
|
|
2182
|
+
loadingIcon: {
|
|
2183
|
+
type: iconPropType,
|
|
2184
|
+
default: () => loading_default
|
|
2185
|
+
},
|
|
2186
|
+
plain: {
|
|
2187
|
+
type: Boolean,
|
|
2188
|
+
default: void 0
|
|
2189
|
+
},
|
|
2190
|
+
text: Boolean,
|
|
2191
|
+
link: Boolean,
|
|
2192
|
+
bg: Boolean,
|
|
2193
|
+
autofocus: Boolean,
|
|
2194
|
+
round: {
|
|
2195
|
+
type: Boolean,
|
|
2196
|
+
default: void 0
|
|
2197
|
+
},
|
|
2198
|
+
circle: Boolean,
|
|
2199
|
+
color: String,
|
|
2200
|
+
dark: Boolean,
|
|
2201
|
+
autoInsertSpace: {
|
|
2202
|
+
type: Boolean,
|
|
2203
|
+
default: void 0
|
|
2204
|
+
},
|
|
2205
|
+
tag: {
|
|
2206
|
+
type: definePropType([String, Object]),
|
|
2207
|
+
default: "button"
|
|
2208
|
+
}
|
|
2209
|
+
});
|
|
2210
|
+
const buttonEmits = {
|
|
2211
|
+
click: (evt) => evt instanceof MouseEvent
|
|
2212
|
+
};
|
|
2213
|
+
function bound01(n, max) {
|
|
2214
|
+
if (isOnePointZero(n)) {
|
|
2215
|
+
n = "100%";
|
|
2216
|
+
}
|
|
2217
|
+
var isPercent = isPercentage(n);
|
|
2218
|
+
n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
|
|
2219
|
+
if (isPercent) {
|
|
2220
|
+
n = parseInt(String(n * max), 10) / 100;
|
|
2221
|
+
}
|
|
2222
|
+
if (Math.abs(n - max) < 1e-6) {
|
|
2223
|
+
return 1;
|
|
2224
|
+
}
|
|
2225
|
+
if (max === 360) {
|
|
2226
|
+
n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
|
|
2227
|
+
} else {
|
|
2228
|
+
n = n % max / parseFloat(String(max));
|
|
2229
|
+
}
|
|
2230
|
+
return n;
|
|
2231
|
+
}
|
|
2232
|
+
function clamp01(val) {
|
|
2233
|
+
return Math.min(1, Math.max(0, val));
|
|
2234
|
+
}
|
|
2235
|
+
function isOnePointZero(n) {
|
|
2236
|
+
return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
|
|
2237
|
+
}
|
|
2238
|
+
function isPercentage(n) {
|
|
2239
|
+
return typeof n === "string" && n.indexOf("%") !== -1;
|
|
2240
|
+
}
|
|
2241
|
+
function boundAlpha(a) {
|
|
2242
|
+
a = parseFloat(a);
|
|
2243
|
+
if (isNaN(a) || a < 0 || a > 1) {
|
|
2244
|
+
a = 1;
|
|
2245
|
+
}
|
|
2246
|
+
return a;
|
|
2247
|
+
}
|
|
2248
|
+
function convertToPercentage(n) {
|
|
2249
|
+
if (n <= 1) {
|
|
2250
|
+
return "".concat(Number(n) * 100, "%");
|
|
2251
|
+
}
|
|
2252
|
+
return n;
|
|
2253
|
+
}
|
|
2254
|
+
function pad2(c) {
|
|
2255
|
+
return c.length === 1 ? "0" + c : String(c);
|
|
2256
|
+
}
|
|
2257
|
+
function rgbToRgb(r, g, b) {
|
|
2258
|
+
return {
|
|
2259
|
+
r: bound01(r, 255) * 255,
|
|
2260
|
+
g: bound01(g, 255) * 255,
|
|
2261
|
+
b: bound01(b, 255) * 255
|
|
2262
|
+
};
|
|
2263
|
+
}
|
|
2264
|
+
function rgbToHsl(r, g, b) {
|
|
2265
|
+
r = bound01(r, 255);
|
|
2266
|
+
g = bound01(g, 255);
|
|
2267
|
+
b = bound01(b, 255);
|
|
2268
|
+
var max = Math.max(r, g, b);
|
|
2269
|
+
var min = Math.min(r, g, b);
|
|
2270
|
+
var h = 0;
|
|
2271
|
+
var s = 0;
|
|
2272
|
+
var l = (max + min) / 2;
|
|
2273
|
+
if (max === min) {
|
|
2274
|
+
s = 0;
|
|
2275
|
+
h = 0;
|
|
2276
|
+
} else {
|
|
2277
|
+
var d = max - min;
|
|
2278
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
2279
|
+
switch (max) {
|
|
2280
|
+
case r:
|
|
2281
|
+
h = (g - b) / d + (g < b ? 6 : 0);
|
|
2282
|
+
break;
|
|
2283
|
+
case g:
|
|
2284
|
+
h = (b - r) / d + 2;
|
|
2285
|
+
break;
|
|
2286
|
+
case b:
|
|
2287
|
+
h = (r - g) / d + 4;
|
|
2288
|
+
break;
|
|
2289
|
+
}
|
|
2290
|
+
h /= 6;
|
|
2291
|
+
}
|
|
2292
|
+
return { h, s, l };
|
|
2293
|
+
}
|
|
2294
|
+
function hue2rgb(p, q, t) {
|
|
2295
|
+
if (t < 0) {
|
|
2296
|
+
t += 1;
|
|
2297
|
+
}
|
|
2298
|
+
if (t > 1) {
|
|
2299
|
+
t -= 1;
|
|
2300
|
+
}
|
|
2301
|
+
if (t < 1 / 6) {
|
|
2302
|
+
return p + (q - p) * (6 * t);
|
|
2303
|
+
}
|
|
2304
|
+
if (t < 1 / 2) {
|
|
2305
|
+
return q;
|
|
2306
|
+
}
|
|
2307
|
+
if (t < 2 / 3) {
|
|
2308
|
+
return p + (q - p) * (2 / 3 - t) * 6;
|
|
2309
|
+
}
|
|
2310
|
+
return p;
|
|
2311
|
+
}
|
|
2312
|
+
function hslToRgb(h, s, l) {
|
|
2313
|
+
var r;
|
|
2314
|
+
var g;
|
|
2315
|
+
var b;
|
|
2316
|
+
h = bound01(h, 360);
|
|
2317
|
+
s = bound01(s, 100);
|
|
2318
|
+
l = bound01(l, 100);
|
|
2319
|
+
if (s === 0) {
|
|
2320
|
+
g = l;
|
|
2321
|
+
b = l;
|
|
2322
|
+
r = l;
|
|
2323
|
+
} else {
|
|
2324
|
+
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
2325
|
+
var p = 2 * l - q;
|
|
2326
|
+
r = hue2rgb(p, q, h + 1 / 3);
|
|
2327
|
+
g = hue2rgb(p, q, h);
|
|
2328
|
+
b = hue2rgb(p, q, h - 1 / 3);
|
|
2329
|
+
}
|
|
2330
|
+
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
2331
|
+
}
|
|
2332
|
+
function rgbToHsv(r, g, b) {
|
|
2333
|
+
r = bound01(r, 255);
|
|
2334
|
+
g = bound01(g, 255);
|
|
2335
|
+
b = bound01(b, 255);
|
|
2336
|
+
var max = Math.max(r, g, b);
|
|
2337
|
+
var min = Math.min(r, g, b);
|
|
2338
|
+
var h = 0;
|
|
2339
|
+
var v = max;
|
|
2340
|
+
var d = max - min;
|
|
2341
|
+
var s = max === 0 ? 0 : d / max;
|
|
2342
|
+
if (max === min) {
|
|
2343
|
+
h = 0;
|
|
2344
|
+
} else {
|
|
2345
|
+
switch (max) {
|
|
2346
|
+
case r:
|
|
2347
|
+
h = (g - b) / d + (g < b ? 6 : 0);
|
|
2348
|
+
break;
|
|
2349
|
+
case g:
|
|
2350
|
+
h = (b - r) / d + 2;
|
|
2351
|
+
break;
|
|
2352
|
+
case b:
|
|
2353
|
+
h = (r - g) / d + 4;
|
|
2354
|
+
break;
|
|
2355
|
+
}
|
|
2356
|
+
h /= 6;
|
|
2357
|
+
}
|
|
2358
|
+
return { h, s, v };
|
|
2359
|
+
}
|
|
2360
|
+
function hsvToRgb(h, s, v) {
|
|
2361
|
+
h = bound01(h, 360) * 6;
|
|
2362
|
+
s = bound01(s, 100);
|
|
2363
|
+
v = bound01(v, 100);
|
|
2364
|
+
var i = Math.floor(h);
|
|
2365
|
+
var f = h - i;
|
|
2366
|
+
var p = v * (1 - s);
|
|
2367
|
+
var q = v * (1 - f * s);
|
|
2368
|
+
var t = v * (1 - (1 - f) * s);
|
|
2369
|
+
var mod = i % 6;
|
|
2370
|
+
var r = [v, q, p, p, t, v][mod];
|
|
2371
|
+
var g = [t, v, v, q, p, p][mod];
|
|
2372
|
+
var b = [p, p, t, v, v, q][mod];
|
|
2373
|
+
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
2374
|
+
}
|
|
2375
|
+
function rgbToHex(r, g, b, allow3Char) {
|
|
2376
|
+
var hex = [
|
|
2377
|
+
pad2(Math.round(r).toString(16)),
|
|
2378
|
+
pad2(Math.round(g).toString(16)),
|
|
2379
|
+
pad2(Math.round(b).toString(16))
|
|
2380
|
+
];
|
|
2381
|
+
if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
|
|
2382
|
+
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
2383
|
+
}
|
|
2384
|
+
return hex.join("");
|
|
2385
|
+
}
|
|
2386
|
+
function rgbaToHex(r, g, b, a, allow4Char) {
|
|
2387
|
+
var hex = [
|
|
2388
|
+
pad2(Math.round(r).toString(16)),
|
|
2389
|
+
pad2(Math.round(g).toString(16)),
|
|
2390
|
+
pad2(Math.round(b).toString(16)),
|
|
2391
|
+
pad2(convertDecimalToHex(a))
|
|
2392
|
+
];
|
|
2393
|
+
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))) {
|
|
2394
|
+
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
|
|
2395
|
+
}
|
|
2396
|
+
return hex.join("");
|
|
2397
|
+
}
|
|
2398
|
+
function convertDecimalToHex(d) {
|
|
2399
|
+
return Math.round(parseFloat(d) * 255).toString(16);
|
|
2400
|
+
}
|
|
2401
|
+
function convertHexToDecimal(h) {
|
|
2402
|
+
return parseIntFromHex(h) / 255;
|
|
2403
|
+
}
|
|
2404
|
+
function parseIntFromHex(val) {
|
|
2405
|
+
return parseInt(val, 16);
|
|
2406
|
+
}
|
|
2407
|
+
function numberInputToObject(color) {
|
|
2408
|
+
return {
|
|
2409
|
+
r: color >> 16,
|
|
2410
|
+
g: (color & 65280) >> 8,
|
|
2411
|
+
b: color & 255
|
|
2412
|
+
};
|
|
2413
|
+
}
|
|
2414
|
+
var names = {
|
|
2415
|
+
aliceblue: "#f0f8ff",
|
|
2416
|
+
antiquewhite: "#faebd7",
|
|
2417
|
+
aqua: "#00ffff",
|
|
2418
|
+
aquamarine: "#7fffd4",
|
|
2419
|
+
azure: "#f0ffff",
|
|
2420
|
+
beige: "#f5f5dc",
|
|
2421
|
+
bisque: "#ffe4c4",
|
|
2422
|
+
black: "#000000",
|
|
2423
|
+
blanchedalmond: "#ffebcd",
|
|
2424
|
+
blue: "#0000ff",
|
|
2425
|
+
blueviolet: "#8a2be2",
|
|
2426
|
+
brown: "#a52a2a",
|
|
2427
|
+
burlywood: "#deb887",
|
|
2428
|
+
cadetblue: "#5f9ea0",
|
|
2429
|
+
chartreuse: "#7fff00",
|
|
2430
|
+
chocolate: "#d2691e",
|
|
2431
|
+
coral: "#ff7f50",
|
|
2432
|
+
cornflowerblue: "#6495ed",
|
|
2433
|
+
cornsilk: "#fff8dc",
|
|
2434
|
+
crimson: "#dc143c",
|
|
2435
|
+
cyan: "#00ffff",
|
|
2436
|
+
darkblue: "#00008b",
|
|
2437
|
+
darkcyan: "#008b8b",
|
|
2438
|
+
darkgoldenrod: "#b8860b",
|
|
2439
|
+
darkgray: "#a9a9a9",
|
|
2440
|
+
darkgreen: "#006400",
|
|
2441
|
+
darkgrey: "#a9a9a9",
|
|
2442
|
+
darkkhaki: "#bdb76b",
|
|
2443
|
+
darkmagenta: "#8b008b",
|
|
2444
|
+
darkolivegreen: "#556b2f",
|
|
2445
|
+
darkorange: "#ff8c00",
|
|
2446
|
+
darkorchid: "#9932cc",
|
|
2447
|
+
darkred: "#8b0000",
|
|
2448
|
+
darksalmon: "#e9967a",
|
|
2449
|
+
darkseagreen: "#8fbc8f",
|
|
2450
|
+
darkslateblue: "#483d8b",
|
|
2451
|
+
darkslategray: "#2f4f4f",
|
|
2452
|
+
darkslategrey: "#2f4f4f",
|
|
2453
|
+
darkturquoise: "#00ced1",
|
|
2454
|
+
darkviolet: "#9400d3",
|
|
2455
|
+
deeppink: "#ff1493",
|
|
2456
|
+
deepskyblue: "#00bfff",
|
|
2457
|
+
dimgray: "#696969",
|
|
2458
|
+
dimgrey: "#696969",
|
|
2459
|
+
dodgerblue: "#1e90ff",
|
|
2460
|
+
firebrick: "#b22222",
|
|
2461
|
+
floralwhite: "#fffaf0",
|
|
2462
|
+
forestgreen: "#228b22",
|
|
2463
|
+
fuchsia: "#ff00ff",
|
|
2464
|
+
gainsboro: "#dcdcdc",
|
|
2465
|
+
ghostwhite: "#f8f8ff",
|
|
2466
|
+
goldenrod: "#daa520",
|
|
2467
|
+
gold: "#ffd700",
|
|
2468
|
+
gray: "#808080",
|
|
2469
|
+
green: "#008000",
|
|
2470
|
+
greenyellow: "#adff2f",
|
|
2471
|
+
grey: "#808080",
|
|
2472
|
+
honeydew: "#f0fff0",
|
|
2473
|
+
hotpink: "#ff69b4",
|
|
2474
|
+
indianred: "#cd5c5c",
|
|
2475
|
+
indigo: "#4b0082",
|
|
2476
|
+
ivory: "#fffff0",
|
|
2477
|
+
khaki: "#f0e68c",
|
|
2478
|
+
lavenderblush: "#fff0f5",
|
|
2479
|
+
lavender: "#e6e6fa",
|
|
2480
|
+
lawngreen: "#7cfc00",
|
|
2481
|
+
lemonchiffon: "#fffacd",
|
|
2482
|
+
lightblue: "#add8e6",
|
|
2483
|
+
lightcoral: "#f08080",
|
|
2484
|
+
lightcyan: "#e0ffff",
|
|
2485
|
+
lightgoldenrodyellow: "#fafad2",
|
|
2486
|
+
lightgray: "#d3d3d3",
|
|
2487
|
+
lightgreen: "#90ee90",
|
|
2488
|
+
lightgrey: "#d3d3d3",
|
|
2489
|
+
lightpink: "#ffb6c1",
|
|
2490
|
+
lightsalmon: "#ffa07a",
|
|
2491
|
+
lightseagreen: "#20b2aa",
|
|
2492
|
+
lightskyblue: "#87cefa",
|
|
2493
|
+
lightslategray: "#778899",
|
|
2494
|
+
lightslategrey: "#778899",
|
|
2495
|
+
lightsteelblue: "#b0c4de",
|
|
2496
|
+
lightyellow: "#ffffe0",
|
|
2497
|
+
lime: "#00ff00",
|
|
2498
|
+
limegreen: "#32cd32",
|
|
2499
|
+
linen: "#faf0e6",
|
|
2500
|
+
magenta: "#ff00ff",
|
|
2501
|
+
maroon: "#800000",
|
|
2502
|
+
mediumaquamarine: "#66cdaa",
|
|
2503
|
+
mediumblue: "#0000cd",
|
|
2504
|
+
mediumorchid: "#ba55d3",
|
|
2505
|
+
mediumpurple: "#9370db",
|
|
2506
|
+
mediumseagreen: "#3cb371",
|
|
2507
|
+
mediumslateblue: "#7b68ee",
|
|
2508
|
+
mediumspringgreen: "#00fa9a",
|
|
2509
|
+
mediumturquoise: "#48d1cc",
|
|
2510
|
+
mediumvioletred: "#c71585",
|
|
2511
|
+
midnightblue: "#191970",
|
|
2512
|
+
mintcream: "#f5fffa",
|
|
2513
|
+
mistyrose: "#ffe4e1",
|
|
2514
|
+
moccasin: "#ffe4b5",
|
|
2515
|
+
navajowhite: "#ffdead",
|
|
2516
|
+
navy: "#000080",
|
|
2517
|
+
oldlace: "#fdf5e6",
|
|
2518
|
+
olive: "#808000",
|
|
2519
|
+
olivedrab: "#6b8e23",
|
|
2520
|
+
orange: "#ffa500",
|
|
2521
|
+
orangered: "#ff4500",
|
|
2522
|
+
orchid: "#da70d6",
|
|
2523
|
+
palegoldenrod: "#eee8aa",
|
|
2524
|
+
palegreen: "#98fb98",
|
|
2525
|
+
paleturquoise: "#afeeee",
|
|
2526
|
+
palevioletred: "#db7093",
|
|
2527
|
+
papayawhip: "#ffefd5",
|
|
2528
|
+
peachpuff: "#ffdab9",
|
|
2529
|
+
peru: "#cd853f",
|
|
2530
|
+
pink: "#ffc0cb",
|
|
2531
|
+
plum: "#dda0dd",
|
|
2532
|
+
powderblue: "#b0e0e6",
|
|
2533
|
+
purple: "#800080",
|
|
2534
|
+
rebeccapurple: "#663399",
|
|
2535
|
+
red: "#ff0000",
|
|
2536
|
+
rosybrown: "#bc8f8f",
|
|
2537
|
+
royalblue: "#4169e1",
|
|
2538
|
+
saddlebrown: "#8b4513",
|
|
2539
|
+
salmon: "#fa8072",
|
|
2540
|
+
sandybrown: "#f4a460",
|
|
2541
|
+
seagreen: "#2e8b57",
|
|
2542
|
+
seashell: "#fff5ee",
|
|
2543
|
+
sienna: "#a0522d",
|
|
2544
|
+
silver: "#c0c0c0",
|
|
2545
|
+
skyblue: "#87ceeb",
|
|
2546
|
+
slateblue: "#6a5acd",
|
|
2547
|
+
slategray: "#708090",
|
|
2548
|
+
slategrey: "#708090",
|
|
2549
|
+
snow: "#fffafa",
|
|
2550
|
+
springgreen: "#00ff7f",
|
|
2551
|
+
steelblue: "#4682b4",
|
|
2552
|
+
tan: "#d2b48c",
|
|
2553
|
+
teal: "#008080",
|
|
2554
|
+
thistle: "#d8bfd8",
|
|
2555
|
+
tomato: "#ff6347",
|
|
2556
|
+
turquoise: "#40e0d0",
|
|
2557
|
+
violet: "#ee82ee",
|
|
2558
|
+
wheat: "#f5deb3",
|
|
2559
|
+
white: "#ffffff",
|
|
2560
|
+
whitesmoke: "#f5f5f5",
|
|
2561
|
+
yellow: "#ffff00",
|
|
2562
|
+
yellowgreen: "#9acd32"
|
|
2563
|
+
};
|
|
2564
|
+
function inputToRGB(color) {
|
|
2565
|
+
var rgb = { r: 0, g: 0, b: 0 };
|
|
2566
|
+
var a = 1;
|
|
2567
|
+
var s = null;
|
|
2568
|
+
var v = null;
|
|
2569
|
+
var l = null;
|
|
2570
|
+
var ok = false;
|
|
2571
|
+
var format = false;
|
|
2572
|
+
if (typeof color === "string") {
|
|
2573
|
+
color = stringInputToObject(color);
|
|
2574
|
+
}
|
|
2575
|
+
if (typeof color === "object") {
|
|
2576
|
+
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
2577
|
+
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
2578
|
+
ok = true;
|
|
2579
|
+
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
|
2580
|
+
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
2581
|
+
s = convertToPercentage(color.s);
|
|
2582
|
+
v = convertToPercentage(color.v);
|
|
2583
|
+
rgb = hsvToRgb(color.h, s, v);
|
|
2584
|
+
ok = true;
|
|
2585
|
+
format = "hsv";
|
|
2586
|
+
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
2587
|
+
s = convertToPercentage(color.s);
|
|
2588
|
+
l = convertToPercentage(color.l);
|
|
2589
|
+
rgb = hslToRgb(color.h, s, l);
|
|
2590
|
+
ok = true;
|
|
2591
|
+
format = "hsl";
|
|
2592
|
+
}
|
|
2593
|
+
if (Object.prototype.hasOwnProperty.call(color, "a")) {
|
|
2594
|
+
a = color.a;
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
a = boundAlpha(a);
|
|
2598
|
+
return {
|
|
2599
|
+
ok,
|
|
2600
|
+
format: color.format || format,
|
|
2601
|
+
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
2602
|
+
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
2603
|
+
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
2604
|
+
a
|
|
2605
|
+
};
|
|
2606
|
+
}
|
|
2607
|
+
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
|
2608
|
+
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
|
|
2609
|
+
var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
|
|
2610
|
+
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
|
|
2611
|
+
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
|
|
2612
|
+
var matchers = {
|
|
2613
|
+
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
2614
|
+
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
|
2615
|
+
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
|
|
2616
|
+
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
|
|
2617
|
+
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
|
|
2618
|
+
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
|
|
2619
|
+
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
|
|
2620
|
+
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
2621
|
+
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
2622
|
+
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
2623
|
+
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
2624
|
+
};
|
|
2625
|
+
function stringInputToObject(color) {
|
|
2626
|
+
color = color.trim().toLowerCase();
|
|
2627
|
+
if (color.length === 0) {
|
|
2628
|
+
return false;
|
|
2629
|
+
}
|
|
2630
|
+
var named = false;
|
|
2631
|
+
if (names[color]) {
|
|
2632
|
+
color = names[color];
|
|
2633
|
+
named = true;
|
|
2634
|
+
} else if (color === "transparent") {
|
|
2635
|
+
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
|
|
2636
|
+
}
|
|
2637
|
+
var match = matchers.rgb.exec(color);
|
|
2638
|
+
if (match) {
|
|
2639
|
+
return { r: match[1], g: match[2], b: match[3] };
|
|
2640
|
+
}
|
|
2641
|
+
match = matchers.rgba.exec(color);
|
|
2642
|
+
if (match) {
|
|
2643
|
+
return { r: match[1], g: match[2], b: match[3], a: match[4] };
|
|
2644
|
+
}
|
|
2645
|
+
match = matchers.hsl.exec(color);
|
|
2646
|
+
if (match) {
|
|
2647
|
+
return { h: match[1], s: match[2], l: match[3] };
|
|
2648
|
+
}
|
|
2649
|
+
match = matchers.hsla.exec(color);
|
|
2650
|
+
if (match) {
|
|
2651
|
+
return { h: match[1], s: match[2], l: match[3], a: match[4] };
|
|
2652
|
+
}
|
|
2653
|
+
match = matchers.hsv.exec(color);
|
|
2654
|
+
if (match) {
|
|
2655
|
+
return { h: match[1], s: match[2], v: match[3] };
|
|
2656
|
+
}
|
|
2657
|
+
match = matchers.hsva.exec(color);
|
|
2658
|
+
if (match) {
|
|
2659
|
+
return { h: match[1], s: match[2], v: match[3], a: match[4] };
|
|
2660
|
+
}
|
|
2661
|
+
match = matchers.hex8.exec(color);
|
|
2662
|
+
if (match) {
|
|
2663
|
+
return {
|
|
2664
|
+
r: parseIntFromHex(match[1]),
|
|
2665
|
+
g: parseIntFromHex(match[2]),
|
|
2666
|
+
b: parseIntFromHex(match[3]),
|
|
2667
|
+
a: convertHexToDecimal(match[4]),
|
|
2668
|
+
format: named ? "name" : "hex8"
|
|
2669
|
+
};
|
|
2670
|
+
}
|
|
2671
|
+
match = matchers.hex6.exec(color);
|
|
2672
|
+
if (match) {
|
|
2673
|
+
return {
|
|
2674
|
+
r: parseIntFromHex(match[1]),
|
|
2675
|
+
g: parseIntFromHex(match[2]),
|
|
2676
|
+
b: parseIntFromHex(match[3]),
|
|
2677
|
+
format: named ? "name" : "hex"
|
|
2678
|
+
};
|
|
2679
|
+
}
|
|
2680
|
+
match = matchers.hex4.exec(color);
|
|
2681
|
+
if (match) {
|
|
2682
|
+
return {
|
|
2683
|
+
r: parseIntFromHex(match[1] + match[1]),
|
|
2684
|
+
g: parseIntFromHex(match[2] + match[2]),
|
|
2685
|
+
b: parseIntFromHex(match[3] + match[3]),
|
|
2686
|
+
a: convertHexToDecimal(match[4] + match[4]),
|
|
2687
|
+
format: named ? "name" : "hex8"
|
|
2688
|
+
};
|
|
2689
|
+
}
|
|
2690
|
+
match = matchers.hex3.exec(color);
|
|
2691
|
+
if (match) {
|
|
2692
|
+
return {
|
|
2693
|
+
r: parseIntFromHex(match[1] + match[1]),
|
|
2694
|
+
g: parseIntFromHex(match[2] + match[2]),
|
|
2695
|
+
b: parseIntFromHex(match[3] + match[3]),
|
|
2696
|
+
format: named ? "name" : "hex"
|
|
2697
|
+
};
|
|
2698
|
+
}
|
|
2699
|
+
return false;
|
|
2700
|
+
}
|
|
2701
|
+
function isValidCSSUnit(color) {
|
|
2702
|
+
return Boolean(matchers.CSS_UNIT.exec(String(color)));
|
|
2703
|
+
}
|
|
2704
|
+
var TinyColor = (
|
|
2705
|
+
/** @class */
|
|
2706
|
+
(function() {
|
|
2707
|
+
function TinyColor2(color, opts) {
|
|
2708
|
+
if (color === void 0) {
|
|
2709
|
+
color = "";
|
|
2710
|
+
}
|
|
2711
|
+
if (opts === void 0) {
|
|
2712
|
+
opts = {};
|
|
2713
|
+
}
|
|
2714
|
+
var _a2;
|
|
2715
|
+
if (color instanceof TinyColor2) {
|
|
2716
|
+
return color;
|
|
2717
|
+
}
|
|
2718
|
+
if (typeof color === "number") {
|
|
2719
|
+
color = numberInputToObject(color);
|
|
2720
|
+
}
|
|
2721
|
+
this.originalInput = color;
|
|
2722
|
+
var rgb = inputToRGB(color);
|
|
2723
|
+
this.originalInput = color;
|
|
2724
|
+
this.r = rgb.r;
|
|
2725
|
+
this.g = rgb.g;
|
|
2726
|
+
this.b = rgb.b;
|
|
2727
|
+
this.a = rgb.a;
|
|
2728
|
+
this.roundA = Math.round(100 * this.a) / 100;
|
|
2729
|
+
this.format = (_a2 = opts.format) !== null && _a2 !== void 0 ? _a2 : rgb.format;
|
|
2730
|
+
this.gradientType = opts.gradientType;
|
|
2731
|
+
if (this.r < 1) {
|
|
2732
|
+
this.r = Math.round(this.r);
|
|
2733
|
+
}
|
|
2734
|
+
if (this.g < 1) {
|
|
2735
|
+
this.g = Math.round(this.g);
|
|
2736
|
+
}
|
|
2737
|
+
if (this.b < 1) {
|
|
2738
|
+
this.b = Math.round(this.b);
|
|
2739
|
+
}
|
|
2740
|
+
this.isValid = rgb.ok;
|
|
2741
|
+
}
|
|
2742
|
+
TinyColor2.prototype.isDark = function() {
|
|
2743
|
+
return this.getBrightness() < 128;
|
|
2744
|
+
};
|
|
2745
|
+
TinyColor2.prototype.isLight = function() {
|
|
2746
|
+
return !this.isDark();
|
|
2747
|
+
};
|
|
2748
|
+
TinyColor2.prototype.getBrightness = function() {
|
|
2749
|
+
var rgb = this.toRgb();
|
|
2750
|
+
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
|
|
2751
|
+
};
|
|
2752
|
+
TinyColor2.prototype.getLuminance = function() {
|
|
2753
|
+
var rgb = this.toRgb();
|
|
2754
|
+
var R;
|
|
2755
|
+
var G;
|
|
2756
|
+
var B;
|
|
2757
|
+
var RsRGB = rgb.r / 255;
|
|
2758
|
+
var GsRGB = rgb.g / 255;
|
|
2759
|
+
var BsRGB = rgb.b / 255;
|
|
2760
|
+
if (RsRGB <= 0.03928) {
|
|
2761
|
+
R = RsRGB / 12.92;
|
|
2762
|
+
} else {
|
|
2763
|
+
R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
|
2764
|
+
}
|
|
2765
|
+
if (GsRGB <= 0.03928) {
|
|
2766
|
+
G = GsRGB / 12.92;
|
|
2767
|
+
} else {
|
|
2768
|
+
G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
2769
|
+
}
|
|
2770
|
+
if (BsRGB <= 0.03928) {
|
|
2771
|
+
B = BsRGB / 12.92;
|
|
2772
|
+
} else {
|
|
2773
|
+
B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
2774
|
+
}
|
|
2775
|
+
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
2776
|
+
};
|
|
2777
|
+
TinyColor2.prototype.getAlpha = function() {
|
|
2778
|
+
return this.a;
|
|
2779
|
+
};
|
|
2780
|
+
TinyColor2.prototype.setAlpha = function(alpha) {
|
|
2781
|
+
this.a = boundAlpha(alpha);
|
|
2782
|
+
this.roundA = Math.round(100 * this.a) / 100;
|
|
2783
|
+
return this;
|
|
2784
|
+
};
|
|
2785
|
+
TinyColor2.prototype.isMonochrome = function() {
|
|
2786
|
+
var s = this.toHsl().s;
|
|
2787
|
+
return s === 0;
|
|
2788
|
+
};
|
|
2789
|
+
TinyColor2.prototype.toHsv = function() {
|
|
2790
|
+
var hsv = rgbToHsv(this.r, this.g, this.b);
|
|
2791
|
+
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
|
|
2792
|
+
};
|
|
2793
|
+
TinyColor2.prototype.toHsvString = function() {
|
|
2794
|
+
var hsv = rgbToHsv(this.r, this.g, this.b);
|
|
2795
|
+
var h = Math.round(hsv.h * 360);
|
|
2796
|
+
var s = Math.round(hsv.s * 100);
|
|
2797
|
+
var v = Math.round(hsv.v * 100);
|
|
2798
|
+
return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
|
|
2799
|
+
};
|
|
2800
|
+
TinyColor2.prototype.toHsl = function() {
|
|
2801
|
+
var hsl = rgbToHsl(this.r, this.g, this.b);
|
|
2802
|
+
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
|
|
2803
|
+
};
|
|
2804
|
+
TinyColor2.prototype.toHslString = function() {
|
|
2805
|
+
var hsl = rgbToHsl(this.r, this.g, this.b);
|
|
2806
|
+
var h = Math.round(hsl.h * 360);
|
|
2807
|
+
var s = Math.round(hsl.s * 100);
|
|
2808
|
+
var l = Math.round(hsl.l * 100);
|
|
2809
|
+
return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
|
|
2810
|
+
};
|
|
2811
|
+
TinyColor2.prototype.toHex = function(allow3Char) {
|
|
2812
|
+
if (allow3Char === void 0) {
|
|
2813
|
+
allow3Char = false;
|
|
2814
|
+
}
|
|
2815
|
+
return rgbToHex(this.r, this.g, this.b, allow3Char);
|
|
2816
|
+
};
|
|
2817
|
+
TinyColor2.prototype.toHexString = function(allow3Char) {
|
|
2818
|
+
if (allow3Char === void 0) {
|
|
2819
|
+
allow3Char = false;
|
|
2820
|
+
}
|
|
2821
|
+
return "#" + this.toHex(allow3Char);
|
|
2822
|
+
};
|
|
2823
|
+
TinyColor2.prototype.toHex8 = function(allow4Char) {
|
|
2824
|
+
if (allow4Char === void 0) {
|
|
2825
|
+
allow4Char = false;
|
|
2826
|
+
}
|
|
2827
|
+
return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
|
|
2828
|
+
};
|
|
2829
|
+
TinyColor2.prototype.toHex8String = function(allow4Char) {
|
|
2830
|
+
if (allow4Char === void 0) {
|
|
2831
|
+
allow4Char = false;
|
|
2832
|
+
}
|
|
2833
|
+
return "#" + this.toHex8(allow4Char);
|
|
2834
|
+
};
|
|
2835
|
+
TinyColor2.prototype.toHexShortString = function(allowShortChar) {
|
|
2836
|
+
if (allowShortChar === void 0) {
|
|
2837
|
+
allowShortChar = false;
|
|
2838
|
+
}
|
|
2839
|
+
return this.a === 1 ? this.toHexString(allowShortChar) : this.toHex8String(allowShortChar);
|
|
2840
|
+
};
|
|
2841
|
+
TinyColor2.prototype.toRgb = function() {
|
|
2842
|
+
return {
|
|
2843
|
+
r: Math.round(this.r),
|
|
2844
|
+
g: Math.round(this.g),
|
|
2845
|
+
b: Math.round(this.b),
|
|
2846
|
+
a: this.a
|
|
2847
|
+
};
|
|
2848
|
+
};
|
|
2849
|
+
TinyColor2.prototype.toRgbString = function() {
|
|
2850
|
+
var r = Math.round(this.r);
|
|
2851
|
+
var g = Math.round(this.g);
|
|
2852
|
+
var b = Math.round(this.b);
|
|
2853
|
+
return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
|
|
2854
|
+
};
|
|
2855
|
+
TinyColor2.prototype.toPercentageRgb = function() {
|
|
2856
|
+
var fmt = function(x) {
|
|
2857
|
+
return "".concat(Math.round(bound01(x, 255) * 100), "%");
|
|
2858
|
+
};
|
|
2859
|
+
return {
|
|
2860
|
+
r: fmt(this.r),
|
|
2861
|
+
g: fmt(this.g),
|
|
2862
|
+
b: fmt(this.b),
|
|
2863
|
+
a: this.a
|
|
2864
|
+
};
|
|
2865
|
+
};
|
|
2866
|
+
TinyColor2.prototype.toPercentageRgbString = function() {
|
|
2867
|
+
var rnd = function(x) {
|
|
2868
|
+
return Math.round(bound01(x, 255) * 100);
|
|
2869
|
+
};
|
|
2870
|
+
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, ")");
|
|
2871
|
+
};
|
|
2872
|
+
TinyColor2.prototype.toName = function() {
|
|
2873
|
+
if (this.a === 0) {
|
|
2874
|
+
return "transparent";
|
|
2875
|
+
}
|
|
2876
|
+
if (this.a < 1) {
|
|
2877
|
+
return false;
|
|
2878
|
+
}
|
|
2879
|
+
var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
|
|
2880
|
+
for (var _i = 0, _a2 = Object.entries(names); _i < _a2.length; _i++) {
|
|
2881
|
+
var _b = _a2[_i], key = _b[0], value = _b[1];
|
|
2882
|
+
if (hex === value) {
|
|
2883
|
+
return key;
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
2886
|
+
return false;
|
|
2887
|
+
};
|
|
2888
|
+
TinyColor2.prototype.toString = function(format) {
|
|
2889
|
+
var formatSet = Boolean(format);
|
|
2890
|
+
format = format !== null && format !== void 0 ? format : this.format;
|
|
2891
|
+
var formattedString = false;
|
|
2892
|
+
var hasAlpha = this.a < 1 && this.a >= 0;
|
|
2893
|
+
var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
|
|
2894
|
+
if (needsAlphaFormat) {
|
|
2895
|
+
if (format === "name" && this.a === 0) {
|
|
2896
|
+
return this.toName();
|
|
2897
|
+
}
|
|
2898
|
+
return this.toRgbString();
|
|
2899
|
+
}
|
|
2900
|
+
if (format === "rgb") {
|
|
2901
|
+
formattedString = this.toRgbString();
|
|
2902
|
+
}
|
|
2903
|
+
if (format === "prgb") {
|
|
2904
|
+
formattedString = this.toPercentageRgbString();
|
|
2905
|
+
}
|
|
2906
|
+
if (format === "hex" || format === "hex6") {
|
|
2907
|
+
formattedString = this.toHexString();
|
|
2908
|
+
}
|
|
2909
|
+
if (format === "hex3") {
|
|
2910
|
+
formattedString = this.toHexString(true);
|
|
2911
|
+
}
|
|
2912
|
+
if (format === "hex4") {
|
|
2913
|
+
formattedString = this.toHex8String(true);
|
|
2914
|
+
}
|
|
2915
|
+
if (format === "hex8") {
|
|
2916
|
+
formattedString = this.toHex8String();
|
|
2917
|
+
}
|
|
2918
|
+
if (format === "name") {
|
|
2919
|
+
formattedString = this.toName();
|
|
2920
|
+
}
|
|
2921
|
+
if (format === "hsl") {
|
|
2922
|
+
formattedString = this.toHslString();
|
|
2923
|
+
}
|
|
2924
|
+
if (format === "hsv") {
|
|
2925
|
+
formattedString = this.toHsvString();
|
|
2926
|
+
}
|
|
2927
|
+
return formattedString || this.toHexString();
|
|
2928
|
+
};
|
|
2929
|
+
TinyColor2.prototype.toNumber = function() {
|
|
2930
|
+
return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
|
|
2931
|
+
};
|
|
2932
|
+
TinyColor2.prototype.clone = function() {
|
|
2933
|
+
return new TinyColor2(this.toString());
|
|
2934
|
+
};
|
|
2935
|
+
TinyColor2.prototype.lighten = function(amount) {
|
|
2936
|
+
if (amount === void 0) {
|
|
2937
|
+
amount = 10;
|
|
2938
|
+
}
|
|
2939
|
+
var hsl = this.toHsl();
|
|
2940
|
+
hsl.l += amount / 100;
|
|
2941
|
+
hsl.l = clamp01(hsl.l);
|
|
2942
|
+
return new TinyColor2(hsl);
|
|
2943
|
+
};
|
|
2944
|
+
TinyColor2.prototype.brighten = function(amount) {
|
|
2945
|
+
if (amount === void 0) {
|
|
2946
|
+
amount = 10;
|
|
2947
|
+
}
|
|
2948
|
+
var rgb = this.toRgb();
|
|
2949
|
+
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
|
|
2950
|
+
rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
|
|
2951
|
+
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
|
|
2952
|
+
return new TinyColor2(rgb);
|
|
2953
|
+
};
|
|
2954
|
+
TinyColor2.prototype.darken = function(amount) {
|
|
2955
|
+
if (amount === void 0) {
|
|
2956
|
+
amount = 10;
|
|
2957
|
+
}
|
|
2958
|
+
var hsl = this.toHsl();
|
|
2959
|
+
hsl.l -= amount / 100;
|
|
2960
|
+
hsl.l = clamp01(hsl.l);
|
|
2961
|
+
return new TinyColor2(hsl);
|
|
2962
|
+
};
|
|
2963
|
+
TinyColor2.prototype.tint = function(amount) {
|
|
2964
|
+
if (amount === void 0) {
|
|
2965
|
+
amount = 10;
|
|
2966
|
+
}
|
|
2967
|
+
return this.mix("white", amount);
|
|
2968
|
+
};
|
|
2969
|
+
TinyColor2.prototype.shade = function(amount) {
|
|
2970
|
+
if (amount === void 0) {
|
|
2971
|
+
amount = 10;
|
|
2972
|
+
}
|
|
2973
|
+
return this.mix("black", amount);
|
|
2974
|
+
};
|
|
2975
|
+
TinyColor2.prototype.desaturate = function(amount) {
|
|
2976
|
+
if (amount === void 0) {
|
|
2977
|
+
amount = 10;
|
|
2978
|
+
}
|
|
2979
|
+
var hsl = this.toHsl();
|
|
2980
|
+
hsl.s -= amount / 100;
|
|
2981
|
+
hsl.s = clamp01(hsl.s);
|
|
2982
|
+
return new TinyColor2(hsl);
|
|
2983
|
+
};
|
|
2984
|
+
TinyColor2.prototype.saturate = function(amount) {
|
|
2985
|
+
if (amount === void 0) {
|
|
2986
|
+
amount = 10;
|
|
2987
|
+
}
|
|
2988
|
+
var hsl = this.toHsl();
|
|
2989
|
+
hsl.s += amount / 100;
|
|
2990
|
+
hsl.s = clamp01(hsl.s);
|
|
2991
|
+
return new TinyColor2(hsl);
|
|
2992
|
+
};
|
|
2993
|
+
TinyColor2.prototype.greyscale = function() {
|
|
2994
|
+
return this.desaturate(100);
|
|
2995
|
+
};
|
|
2996
|
+
TinyColor2.prototype.spin = function(amount) {
|
|
2997
|
+
var hsl = this.toHsl();
|
|
2998
|
+
var hue = (hsl.h + amount) % 360;
|
|
2999
|
+
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
3000
|
+
return new TinyColor2(hsl);
|
|
3001
|
+
};
|
|
3002
|
+
TinyColor2.prototype.mix = function(color, amount) {
|
|
3003
|
+
if (amount === void 0) {
|
|
3004
|
+
amount = 50;
|
|
3005
|
+
}
|
|
3006
|
+
var rgb1 = this.toRgb();
|
|
3007
|
+
var rgb2 = new TinyColor2(color).toRgb();
|
|
3008
|
+
var p = amount / 100;
|
|
3009
|
+
var rgba = {
|
|
3010
|
+
r: (rgb2.r - rgb1.r) * p + rgb1.r,
|
|
3011
|
+
g: (rgb2.g - rgb1.g) * p + rgb1.g,
|
|
3012
|
+
b: (rgb2.b - rgb1.b) * p + rgb1.b,
|
|
3013
|
+
a: (rgb2.a - rgb1.a) * p + rgb1.a
|
|
3014
|
+
};
|
|
3015
|
+
return new TinyColor2(rgba);
|
|
3016
|
+
};
|
|
3017
|
+
TinyColor2.prototype.analogous = function(results, slices) {
|
|
3018
|
+
if (results === void 0) {
|
|
3019
|
+
results = 6;
|
|
3020
|
+
}
|
|
3021
|
+
if (slices === void 0) {
|
|
3022
|
+
slices = 30;
|
|
3023
|
+
}
|
|
3024
|
+
var hsl = this.toHsl();
|
|
3025
|
+
var part = 360 / slices;
|
|
3026
|
+
var ret = [this];
|
|
3027
|
+
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
|
|
3028
|
+
hsl.h = (hsl.h + part) % 360;
|
|
3029
|
+
ret.push(new TinyColor2(hsl));
|
|
3030
|
+
}
|
|
3031
|
+
return ret;
|
|
3032
|
+
};
|
|
3033
|
+
TinyColor2.prototype.complement = function() {
|
|
3034
|
+
var hsl = this.toHsl();
|
|
3035
|
+
hsl.h = (hsl.h + 180) % 360;
|
|
3036
|
+
return new TinyColor2(hsl);
|
|
3037
|
+
};
|
|
3038
|
+
TinyColor2.prototype.monochromatic = function(results) {
|
|
3039
|
+
if (results === void 0) {
|
|
3040
|
+
results = 6;
|
|
3041
|
+
}
|
|
3042
|
+
var hsv = this.toHsv();
|
|
3043
|
+
var h = hsv.h;
|
|
3044
|
+
var s = hsv.s;
|
|
3045
|
+
var v = hsv.v;
|
|
3046
|
+
var res = [];
|
|
3047
|
+
var modification = 1 / results;
|
|
3048
|
+
while (results--) {
|
|
3049
|
+
res.push(new TinyColor2({ h, s, v }));
|
|
3050
|
+
v = (v + modification) % 1;
|
|
3051
|
+
}
|
|
3052
|
+
return res;
|
|
3053
|
+
};
|
|
3054
|
+
TinyColor2.prototype.splitcomplement = function() {
|
|
3055
|
+
var hsl = this.toHsl();
|
|
3056
|
+
var h = hsl.h;
|
|
3057
|
+
return [
|
|
3058
|
+
this,
|
|
3059
|
+
new TinyColor2({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
|
|
3060
|
+
new TinyColor2({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })
|
|
3061
|
+
];
|
|
3062
|
+
};
|
|
3063
|
+
TinyColor2.prototype.onBackground = function(background) {
|
|
3064
|
+
var fg = this.toRgb();
|
|
3065
|
+
var bg = new TinyColor2(background).toRgb();
|
|
3066
|
+
var alpha = fg.a + bg.a * (1 - fg.a);
|
|
3067
|
+
return new TinyColor2({
|
|
3068
|
+
r: (fg.r * fg.a + bg.r * bg.a * (1 - fg.a)) / alpha,
|
|
3069
|
+
g: (fg.g * fg.a + bg.g * bg.a * (1 - fg.a)) / alpha,
|
|
3070
|
+
b: (fg.b * fg.a + bg.b * bg.a * (1 - fg.a)) / alpha,
|
|
3071
|
+
a: alpha
|
|
3072
|
+
});
|
|
3073
|
+
};
|
|
3074
|
+
TinyColor2.prototype.triad = function() {
|
|
3075
|
+
return this.polyad(3);
|
|
3076
|
+
};
|
|
3077
|
+
TinyColor2.prototype.tetrad = function() {
|
|
3078
|
+
return this.polyad(4);
|
|
3079
|
+
};
|
|
3080
|
+
TinyColor2.prototype.polyad = function(n) {
|
|
3081
|
+
var hsl = this.toHsl();
|
|
3082
|
+
var h = hsl.h;
|
|
3083
|
+
var result = [this];
|
|
3084
|
+
var increment = 360 / n;
|
|
3085
|
+
for (var i = 1; i < n; i++) {
|
|
3086
|
+
result.push(new TinyColor2({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
|
|
3087
|
+
}
|
|
3088
|
+
return result;
|
|
3089
|
+
};
|
|
3090
|
+
TinyColor2.prototype.equals = function(color) {
|
|
3091
|
+
return this.toRgbString() === new TinyColor2(color).toRgbString();
|
|
3092
|
+
};
|
|
3093
|
+
return TinyColor2;
|
|
3094
|
+
})()
|
|
3095
|
+
);
|
|
3096
|
+
function darken(color, amount = 20) {
|
|
3097
|
+
return color.mix("#141414", amount).toString();
|
|
3098
|
+
}
|
|
3099
|
+
function useButtonCustomStyle(props) {
|
|
3100
|
+
const _disabled = useFormDisabled();
|
|
3101
|
+
const ns = useNamespace("button");
|
|
3102
|
+
return computed(() => {
|
|
3103
|
+
let styles = {};
|
|
3104
|
+
let buttonColor = props.color;
|
|
3105
|
+
if (buttonColor) {
|
|
3106
|
+
const match = buttonColor.match(/var\((.*?)\)/);
|
|
3107
|
+
if (match) {
|
|
3108
|
+
buttonColor = window.getComputedStyle(window.document.documentElement).getPropertyValue(match[1]);
|
|
3109
|
+
}
|
|
3110
|
+
const color = new TinyColor(buttonColor);
|
|
3111
|
+
const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
|
|
3112
|
+
if (props.plain) {
|
|
3113
|
+
styles = ns.cssVarBlock({
|
|
3114
|
+
"bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
|
|
3115
|
+
"text-color": buttonColor,
|
|
3116
|
+
"border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
|
|
3117
|
+
"hover-text-color": `var(${ns.cssVarName("color-white")})`,
|
|
3118
|
+
"hover-bg-color": buttonColor,
|
|
3119
|
+
"hover-border-color": buttonColor,
|
|
3120
|
+
"active-bg-color": activeBgColor,
|
|
3121
|
+
"active-text-color": `var(${ns.cssVarName("color-white")})`,
|
|
3122
|
+
"active-border-color": activeBgColor
|
|
3123
|
+
});
|
|
3124
|
+
if (_disabled.value) {
|
|
3125
|
+
styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString();
|
|
3126
|
+
styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString();
|
|
3127
|
+
styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString();
|
|
3128
|
+
}
|
|
3129
|
+
} else {
|
|
3130
|
+
const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
|
|
3131
|
+
const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
|
|
3132
|
+
styles = ns.cssVarBlock({
|
|
3133
|
+
"bg-color": buttonColor,
|
|
3134
|
+
"text-color": textColor,
|
|
3135
|
+
"border-color": buttonColor,
|
|
3136
|
+
"hover-bg-color": hoverBgColor,
|
|
3137
|
+
"hover-text-color": textColor,
|
|
3138
|
+
"hover-border-color": hoverBgColor,
|
|
3139
|
+
"active-bg-color": activeBgColor,
|
|
3140
|
+
"active-border-color": activeBgColor
|
|
3141
|
+
});
|
|
3142
|
+
if (_disabled.value) {
|
|
3143
|
+
const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
|
|
3144
|
+
styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
|
|
3145
|
+
styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
|
|
3146
|
+
styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
|
|
3147
|
+
}
|
|
3148
|
+
}
|
|
3149
|
+
}
|
|
3150
|
+
return styles;
|
|
3151
|
+
});
|
|
3152
|
+
}
|
|
3153
|
+
const __default__$4 = defineComponent({
|
|
3154
|
+
name: "ElButton"
|
|
3155
|
+
});
|
|
3156
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
3157
|
+
...__default__$4,
|
|
3158
|
+
props: buttonProps,
|
|
3159
|
+
emits: buttonEmits,
|
|
3160
|
+
setup(__props, { expose, emit }) {
|
|
3161
|
+
const props = __props;
|
|
3162
|
+
const buttonStyle = useButtonCustomStyle(props);
|
|
3163
|
+
const ns = useNamespace("button");
|
|
3164
|
+
const {
|
|
3165
|
+
_ref,
|
|
3166
|
+
_size,
|
|
3167
|
+
_type,
|
|
3168
|
+
_disabled,
|
|
3169
|
+
_props,
|
|
3170
|
+
_plain,
|
|
3171
|
+
_round,
|
|
3172
|
+
shouldAddSpace,
|
|
3173
|
+
handleClick
|
|
3174
|
+
} = useButton(props, emit);
|
|
3175
|
+
const buttonKls = computed(() => [
|
|
3176
|
+
ns.b(),
|
|
3177
|
+
ns.m(_type.value),
|
|
3178
|
+
ns.m(_size.value),
|
|
3179
|
+
ns.is("disabled", _disabled.value),
|
|
3180
|
+
ns.is("loading", props.loading),
|
|
3181
|
+
ns.is("plain", _plain.value),
|
|
3182
|
+
ns.is("round", _round.value),
|
|
3183
|
+
ns.is("circle", props.circle),
|
|
3184
|
+
ns.is("text", props.text),
|
|
3185
|
+
ns.is("link", props.link),
|
|
3186
|
+
ns.is("has-bg", props.bg)
|
|
3187
|
+
]);
|
|
3188
|
+
expose({
|
|
3189
|
+
ref: _ref,
|
|
3190
|
+
size: _size,
|
|
3191
|
+
type: _type,
|
|
3192
|
+
disabled: _disabled,
|
|
3193
|
+
shouldAddSpace
|
|
3194
|
+
});
|
|
3195
|
+
return (_ctx, _cache) => {
|
|
3196
|
+
return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), mergeProps({
|
|
3197
|
+
ref_key: "_ref",
|
|
3198
|
+
ref: _ref
|
|
3199
|
+
}, unref(_props), {
|
|
3200
|
+
class: unref(buttonKls),
|
|
3201
|
+
style: unref(buttonStyle),
|
|
3202
|
+
onClick: unref(handleClick)
|
|
3203
|
+
}), {
|
|
3204
|
+
default: withCtx(() => [
|
|
3205
|
+
_ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
3206
|
+
_ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
|
|
3207
|
+
key: 1,
|
|
3208
|
+
class: normalizeClass(unref(ns).is("loading"))
|
|
3209
|
+
}, {
|
|
3210
|
+
default: withCtx(() => [
|
|
3211
|
+
(openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
|
|
3212
|
+
]),
|
|
3213
|
+
_: 1
|
|
3214
|
+
}, 8, ["class"]))
|
|
3215
|
+
], 64)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
|
|
3216
|
+
default: withCtx(() => [
|
|
3217
|
+
_ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
|
|
3218
|
+
]),
|
|
3219
|
+
_: 3
|
|
3220
|
+
})) : createCommentVNode("v-if", true),
|
|
3221
|
+
_ctx.$slots.default ? (openBlock(), createElementBlock("span", {
|
|
3222
|
+
key: 2,
|
|
3223
|
+
class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
|
|
3224
|
+
}, [
|
|
3225
|
+
renderSlot(_ctx.$slots, "default")
|
|
3226
|
+
], 2)) : createCommentVNode("v-if", true)
|
|
3227
|
+
]),
|
|
3228
|
+
_: 3
|
|
3229
|
+
}, 16, ["class", "style", "onClick"]);
|
|
3230
|
+
};
|
|
3231
|
+
}
|
|
3232
|
+
});
|
|
3233
|
+
var Button = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "button.vue"]]);
|
|
3234
|
+
const buttonGroupProps = {
|
|
3235
|
+
size: buttonProps.size,
|
|
3236
|
+
type: buttonProps.type
|
|
3237
|
+
};
|
|
3238
|
+
const __default__$3 = defineComponent({
|
|
3239
|
+
name: "ElButtonGroup"
|
|
3240
|
+
});
|
|
3241
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
3242
|
+
...__default__$3,
|
|
3243
|
+
props: buttonGroupProps,
|
|
3244
|
+
setup(__props) {
|
|
3245
|
+
const props = __props;
|
|
3246
|
+
provide(buttonGroupContextKey, reactive({
|
|
3247
|
+
size: toRef(props, "size"),
|
|
3248
|
+
type: toRef(props, "type")
|
|
3249
|
+
}));
|
|
3250
|
+
const ns = useNamespace("button");
|
|
3251
|
+
return (_ctx, _cache) => {
|
|
3252
|
+
return openBlock(), createElementBlock("div", {
|
|
3253
|
+
class: normalizeClass(unref(ns).b("group"))
|
|
3254
|
+
}, [
|
|
3255
|
+
renderSlot(_ctx.$slots, "default")
|
|
3256
|
+
], 2);
|
|
3257
|
+
};
|
|
3258
|
+
}
|
|
3259
|
+
});
|
|
3260
|
+
var ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "button-group.vue"]]);
|
|
3261
|
+
const ElButton = withInstall(Button, {
|
|
3262
|
+
ButtonGroup
|
|
3263
|
+
});
|
|
3264
|
+
withNoopInstall(ButtonGroup);
|
|
3265
|
+
const checkboxProps = {
|
|
3266
|
+
modelValue: {
|
|
3267
|
+
type: [Number, String, Boolean],
|
|
3268
|
+
default: void 0
|
|
3269
|
+
},
|
|
3270
|
+
label: {
|
|
3271
|
+
type: [String, Boolean, Number, Object],
|
|
3272
|
+
default: void 0
|
|
3273
|
+
},
|
|
3274
|
+
value: {
|
|
3275
|
+
type: [String, Boolean, Number, Object],
|
|
3276
|
+
default: void 0
|
|
3277
|
+
},
|
|
3278
|
+
indeterminate: Boolean,
|
|
3279
|
+
disabled: Boolean,
|
|
3280
|
+
checked: Boolean,
|
|
3281
|
+
name: {
|
|
3282
|
+
type: String,
|
|
3283
|
+
default: void 0
|
|
3284
|
+
},
|
|
3285
|
+
trueValue: {
|
|
3286
|
+
type: [String, Number],
|
|
3287
|
+
default: void 0
|
|
3288
|
+
},
|
|
3289
|
+
falseValue: {
|
|
3290
|
+
type: [String, Number],
|
|
3291
|
+
default: void 0
|
|
3292
|
+
},
|
|
3293
|
+
trueLabel: {
|
|
3294
|
+
type: [String, Number],
|
|
3295
|
+
default: void 0
|
|
3296
|
+
},
|
|
3297
|
+
falseLabel: {
|
|
3298
|
+
type: [String, Number],
|
|
3299
|
+
default: void 0
|
|
3300
|
+
},
|
|
3301
|
+
id: {
|
|
3302
|
+
type: String,
|
|
3303
|
+
default: void 0
|
|
3304
|
+
},
|
|
3305
|
+
border: Boolean,
|
|
3306
|
+
size: useSizeProp,
|
|
3307
|
+
tabindex: [String, Number],
|
|
3308
|
+
validateEvent: {
|
|
3309
|
+
type: Boolean,
|
|
3310
|
+
default: true
|
|
3311
|
+
},
|
|
3312
|
+
...useAriaProps(["ariaControls"])
|
|
3313
|
+
};
|
|
3314
|
+
const checkboxEmits = {
|
|
3315
|
+
[UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
|
|
3316
|
+
change: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
|
|
3317
|
+
};
|
|
3318
|
+
const checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
|
|
3319
|
+
const useCheckboxDisabled = ({
|
|
3320
|
+
model,
|
|
3321
|
+
isChecked
|
|
3322
|
+
}) => {
|
|
3323
|
+
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
3324
|
+
const isLimitDisabled = computed(() => {
|
|
3325
|
+
var _a2, _b;
|
|
3326
|
+
const max = (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a2.value;
|
|
3327
|
+
const min = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value;
|
|
3328
|
+
return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value;
|
|
3329
|
+
});
|
|
3330
|
+
const isDisabled = useFormDisabled(computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.disabled.value) || isLimitDisabled.value));
|
|
3331
|
+
return {
|
|
3332
|
+
isDisabled,
|
|
3333
|
+
isLimitDisabled
|
|
3334
|
+
};
|
|
3335
|
+
};
|
|
3336
|
+
const useCheckboxEvent = (props, {
|
|
3337
|
+
model,
|
|
3338
|
+
isLimitExceeded,
|
|
3339
|
+
hasOwnLabel,
|
|
3340
|
+
isDisabled,
|
|
3341
|
+
isLabeledByFormItem
|
|
3342
|
+
}) => {
|
|
3343
|
+
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
3344
|
+
const { formItem } = useFormItem();
|
|
3345
|
+
const { emit } = getCurrentInstance();
|
|
3346
|
+
function getLabeledValue(value) {
|
|
3347
|
+
var _a2, _b, _c, _d;
|
|
3348
|
+
return [true, props.trueValue, props.trueLabel].includes(value) ? (_b = (_a2 = props.trueValue) != null ? _a2 : props.trueLabel) != null ? _b : true : (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false;
|
|
3349
|
+
}
|
|
3350
|
+
function emitChangeEvent(checked, e) {
|
|
3351
|
+
emit(CHANGE_EVENT, getLabeledValue(checked), e);
|
|
3352
|
+
}
|
|
3353
|
+
function handleChange(e) {
|
|
3354
|
+
if (isLimitExceeded.value)
|
|
3355
|
+
return;
|
|
3356
|
+
const target = e.target;
|
|
3357
|
+
emit(CHANGE_EVENT, getLabeledValue(target.checked), e);
|
|
3358
|
+
}
|
|
3359
|
+
async function onClickRoot(e) {
|
|
3360
|
+
if (isLimitExceeded.value)
|
|
3361
|
+
return;
|
|
3362
|
+
if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
|
|
3363
|
+
const eventTargets = e.composedPath();
|
|
3364
|
+
const hasLabel = eventTargets.some((item) => item.tagName === "LABEL");
|
|
3365
|
+
if (!hasLabel) {
|
|
3366
|
+
model.value = getLabeledValue([false, props.falseValue, props.falseLabel].includes(model.value));
|
|
3367
|
+
await nextTick();
|
|
3368
|
+
emitChangeEvent(model.value, e);
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3371
|
+
}
|
|
3372
|
+
const validateEvent = computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.validateEvent) || props.validateEvent);
|
|
3373
|
+
watch(() => props.modelValue, () => {
|
|
3374
|
+
if (validateEvent.value) {
|
|
3375
|
+
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
|
|
3376
|
+
}
|
|
3377
|
+
});
|
|
3378
|
+
return {
|
|
3379
|
+
handleChange,
|
|
3380
|
+
onClickRoot
|
|
3381
|
+
};
|
|
3382
|
+
};
|
|
3383
|
+
const useCheckboxModel = (props) => {
|
|
3384
|
+
const selfModel = ref(false);
|
|
3385
|
+
const { emit } = getCurrentInstance();
|
|
3386
|
+
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
3387
|
+
const isGroup = computed(() => isUndefined(checkboxGroup) === false);
|
|
3388
|
+
const isLimitExceeded = ref(false);
|
|
3389
|
+
const model = computed({
|
|
3390
|
+
get() {
|
|
3391
|
+
var _a2, _b;
|
|
3392
|
+
return isGroup.value ? (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.modelValue) == null ? void 0 : _a2.value : (_b = props.modelValue) != null ? _b : selfModel.value;
|
|
3393
|
+
},
|
|
3394
|
+
set(val) {
|
|
3395
|
+
var _a2, _b;
|
|
3396
|
+
if (isGroup.value && isArray$1(val)) {
|
|
3397
|
+
isLimitExceeded.value = ((_a2 = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a2.value) !== void 0 && val.length > (checkboxGroup == null ? void 0 : checkboxGroup.max.value) && val.length > model.value.length;
|
|
3398
|
+
isLimitExceeded.value === false && ((_b = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _b.call(checkboxGroup, val));
|
|
3399
|
+
} else {
|
|
3400
|
+
emit(UPDATE_MODEL_EVENT, val);
|
|
3401
|
+
selfModel.value = val;
|
|
3402
|
+
}
|
|
3403
|
+
}
|
|
3404
|
+
});
|
|
3405
|
+
return {
|
|
3406
|
+
model,
|
|
3407
|
+
isGroup,
|
|
3408
|
+
isLimitExceeded
|
|
3409
|
+
};
|
|
3410
|
+
};
|
|
3411
|
+
const useCheckboxStatus = (props, slots, { model }) => {
|
|
3412
|
+
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
3413
|
+
const isFocused = ref(false);
|
|
3414
|
+
const actualValue = computed(() => {
|
|
3415
|
+
if (!isPropAbsent(props.value)) {
|
|
3416
|
+
return props.value;
|
|
3417
|
+
}
|
|
3418
|
+
return props.label;
|
|
3419
|
+
});
|
|
3420
|
+
const isChecked = computed(() => {
|
|
3421
|
+
const value = model.value;
|
|
3422
|
+
if (isBoolean(value)) {
|
|
3423
|
+
return value;
|
|
3424
|
+
} else if (isArray$1(value)) {
|
|
3425
|
+
if (isObject$1(actualValue.value)) {
|
|
3426
|
+
return value.map(toRaw).some((o) => isEqual(o, actualValue.value));
|
|
3427
|
+
} else {
|
|
3428
|
+
return value.map(toRaw).includes(actualValue.value);
|
|
3429
|
+
}
|
|
3430
|
+
} else if (value !== null && value !== void 0) {
|
|
3431
|
+
return value === props.trueValue || value === props.trueLabel;
|
|
3432
|
+
} else {
|
|
3433
|
+
return !!value;
|
|
3434
|
+
}
|
|
3435
|
+
});
|
|
3436
|
+
const checkboxButtonSize = useFormSize(computed(() => {
|
|
3437
|
+
var _a2;
|
|
3438
|
+
return (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a2.value;
|
|
3439
|
+
}), {
|
|
3440
|
+
prop: true
|
|
3441
|
+
});
|
|
3442
|
+
const checkboxSize = useFormSize(computed(() => {
|
|
3443
|
+
var _a2;
|
|
3444
|
+
return (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a2.value;
|
|
3445
|
+
}));
|
|
3446
|
+
const hasOwnLabel = computed(() => {
|
|
3447
|
+
return !!slots.default || !isPropAbsent(actualValue.value);
|
|
3448
|
+
});
|
|
3449
|
+
return {
|
|
3450
|
+
checkboxButtonSize,
|
|
3451
|
+
isChecked,
|
|
3452
|
+
isFocused,
|
|
3453
|
+
checkboxSize,
|
|
3454
|
+
hasOwnLabel,
|
|
3455
|
+
actualValue
|
|
3456
|
+
};
|
|
3457
|
+
};
|
|
3458
|
+
const useCheckbox = (props, slots) => {
|
|
3459
|
+
const { formItem: elFormItem } = useFormItem();
|
|
3460
|
+
const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
|
|
3461
|
+
const {
|
|
3462
|
+
isFocused,
|
|
3463
|
+
isChecked,
|
|
3464
|
+
checkboxButtonSize,
|
|
3465
|
+
checkboxSize,
|
|
3466
|
+
hasOwnLabel,
|
|
3467
|
+
actualValue
|
|
3468
|
+
} = useCheckboxStatus(props, slots, { model });
|
|
3469
|
+
const { isDisabled } = useCheckboxDisabled({ model, isChecked });
|
|
3470
|
+
const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
|
|
3471
|
+
formItemContext: elFormItem,
|
|
3472
|
+
disableIdGeneration: hasOwnLabel,
|
|
3473
|
+
disableIdManagement: isGroup
|
|
3474
|
+
});
|
|
3475
|
+
const { handleChange, onClickRoot } = useCheckboxEvent(props, {
|
|
3476
|
+
model,
|
|
3477
|
+
isLimitExceeded,
|
|
3478
|
+
hasOwnLabel,
|
|
3479
|
+
isDisabled,
|
|
3480
|
+
isLabeledByFormItem
|
|
3481
|
+
});
|
|
3482
|
+
const setStoreValue = () => {
|
|
3483
|
+
function addToStore() {
|
|
3484
|
+
var _a2, _b;
|
|
3485
|
+
if (isArray$1(model.value) && !model.value.includes(actualValue.value)) {
|
|
3486
|
+
model.value.push(actualValue.value);
|
|
3487
|
+
} else {
|
|
3488
|
+
model.value = (_b = (_a2 = props.trueValue) != null ? _a2 : props.trueLabel) != null ? _b : true;
|
|
3489
|
+
}
|
|
3490
|
+
}
|
|
3491
|
+
props.checked && addToStore();
|
|
3492
|
+
};
|
|
3493
|
+
setStoreValue();
|
|
3494
|
+
useDeprecated({
|
|
3495
|
+
from: "label act as value",
|
|
3496
|
+
replacement: "value",
|
|
3497
|
+
version: "3.0.0",
|
|
3498
|
+
scope: "el-checkbox",
|
|
3499
|
+
ref: "https://element-plus.org/en-US/component/checkbox.html"
|
|
3500
|
+
}, computed(() => isGroup.value && isPropAbsent(props.value)));
|
|
3501
|
+
useDeprecated({
|
|
3502
|
+
from: "true-label",
|
|
3503
|
+
replacement: "true-value",
|
|
3504
|
+
version: "3.0.0",
|
|
3505
|
+
scope: "el-checkbox",
|
|
3506
|
+
ref: "https://element-plus.org/en-US/component/checkbox.html"
|
|
3507
|
+
}, computed(() => !!props.trueLabel));
|
|
3508
|
+
useDeprecated({
|
|
3509
|
+
from: "false-label",
|
|
3510
|
+
replacement: "false-value",
|
|
3511
|
+
version: "3.0.0",
|
|
3512
|
+
scope: "el-checkbox",
|
|
3513
|
+
ref: "https://element-plus.org/en-US/component/checkbox.html"
|
|
3514
|
+
}, computed(() => !!props.falseLabel));
|
|
3515
|
+
return {
|
|
3516
|
+
inputId,
|
|
3517
|
+
isLabeledByFormItem,
|
|
3518
|
+
isChecked,
|
|
3519
|
+
isDisabled,
|
|
3520
|
+
isFocused,
|
|
3521
|
+
checkboxButtonSize,
|
|
3522
|
+
checkboxSize,
|
|
3523
|
+
hasOwnLabel,
|
|
3524
|
+
model,
|
|
3525
|
+
actualValue,
|
|
3526
|
+
handleChange,
|
|
3527
|
+
onClickRoot
|
|
3528
|
+
};
|
|
3529
|
+
};
|
|
3530
|
+
const __default__$2 = defineComponent({
|
|
3531
|
+
name: "ElCheckbox"
|
|
3532
|
+
});
|
|
3533
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
3534
|
+
...__default__$2,
|
|
3535
|
+
props: checkboxProps,
|
|
3536
|
+
emits: checkboxEmits,
|
|
3537
|
+
setup(__props) {
|
|
3538
|
+
const props = __props;
|
|
3539
|
+
const slots = useSlots();
|
|
3540
|
+
const {
|
|
3541
|
+
inputId,
|
|
3542
|
+
isLabeledByFormItem,
|
|
3543
|
+
isChecked,
|
|
3544
|
+
isDisabled,
|
|
3545
|
+
isFocused,
|
|
3546
|
+
checkboxSize,
|
|
3547
|
+
hasOwnLabel,
|
|
3548
|
+
model,
|
|
3549
|
+
actualValue,
|
|
3550
|
+
handleChange,
|
|
3551
|
+
onClickRoot
|
|
3552
|
+
} = useCheckbox(props, slots);
|
|
3553
|
+
const ns = useNamespace("checkbox");
|
|
3554
|
+
const compKls = computed(() => {
|
|
3555
|
+
return [
|
|
3556
|
+
ns.b(),
|
|
3557
|
+
ns.m(checkboxSize.value),
|
|
3558
|
+
ns.is("disabled", isDisabled.value),
|
|
3559
|
+
ns.is("bordered", props.border),
|
|
3560
|
+
ns.is("checked", isChecked.value)
|
|
3561
|
+
];
|
|
3562
|
+
});
|
|
3563
|
+
const spanKls = computed(() => {
|
|
3564
|
+
return [
|
|
3565
|
+
ns.e("input"),
|
|
3566
|
+
ns.is("disabled", isDisabled.value),
|
|
3567
|
+
ns.is("checked", isChecked.value),
|
|
3568
|
+
ns.is("indeterminate", props.indeterminate),
|
|
3569
|
+
ns.is("focus", isFocused.value)
|
|
3570
|
+
];
|
|
3571
|
+
});
|
|
3572
|
+
return (_ctx, _cache) => {
|
|
3573
|
+
return openBlock(), createBlock(resolveDynamicComponent(!unref(hasOwnLabel) && unref(isLabeledByFormItem) ? "span" : "label"), {
|
|
3574
|
+
class: normalizeClass(unref(compKls)),
|
|
3575
|
+
"aria-controls": _ctx.indeterminate ? _ctx.ariaControls : null,
|
|
3576
|
+
onClick: unref(onClickRoot)
|
|
3577
|
+
}, {
|
|
3578
|
+
default: withCtx(() => {
|
|
3579
|
+
var _a2, _b, _c, _d;
|
|
3580
|
+
return [
|
|
3581
|
+
createElementVNode("span", {
|
|
3582
|
+
class: normalizeClass(unref(spanKls))
|
|
3583
|
+
}, [
|
|
3584
|
+
_ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
|
|
3585
|
+
key: 0,
|
|
3586
|
+
id: unref(inputId),
|
|
3587
|
+
"onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
|
|
3588
|
+
class: normalizeClass(unref(ns).e("original")),
|
|
3589
|
+
type: "checkbox",
|
|
3590
|
+
indeterminate: _ctx.indeterminate,
|
|
3591
|
+
name: _ctx.name,
|
|
3592
|
+
tabindex: _ctx.tabindex,
|
|
3593
|
+
disabled: unref(isDisabled),
|
|
3594
|
+
"true-value": (_b = (_a2 = _ctx.trueValue) != null ? _a2 : _ctx.trueLabel) != null ? _b : true,
|
|
3595
|
+
"false-value": (_d = (_c = _ctx.falseValue) != null ? _c : _ctx.falseLabel) != null ? _d : false,
|
|
3596
|
+
onChange: unref(handleChange),
|
|
3597
|
+
onFocus: ($event) => isFocused.value = true,
|
|
3598
|
+
onBlur: ($event) => isFocused.value = false,
|
|
3599
|
+
onClick: withModifiers(() => {
|
|
3600
|
+
}, ["stop"])
|
|
3601
|
+
}, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
|
|
3602
|
+
[vModelCheckbox, unref(model)]
|
|
3603
|
+
]) : withDirectives((openBlock(), createElementBlock("input", {
|
|
3604
|
+
key: 1,
|
|
3605
|
+
id: unref(inputId),
|
|
3606
|
+
"onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
|
|
3607
|
+
class: normalizeClass(unref(ns).e("original")),
|
|
3608
|
+
type: "checkbox",
|
|
3609
|
+
indeterminate: _ctx.indeterminate,
|
|
3610
|
+
disabled: unref(isDisabled),
|
|
3611
|
+
value: unref(actualValue),
|
|
3612
|
+
name: _ctx.name,
|
|
3613
|
+
tabindex: _ctx.tabindex,
|
|
3614
|
+
onChange: unref(handleChange),
|
|
3615
|
+
onFocus: ($event) => isFocused.value = true,
|
|
3616
|
+
onBlur: ($event) => isFocused.value = false,
|
|
3617
|
+
onClick: withModifiers(() => {
|
|
3618
|
+
}, ["stop"])
|
|
3619
|
+
}, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "disabled", "value", "name", "tabindex", "onChange", "onFocus", "onBlur", "onClick"])), [
|
|
3620
|
+
[vModelCheckbox, unref(model)]
|
|
3621
|
+
]),
|
|
3622
|
+
createElementVNode("span", {
|
|
3623
|
+
class: normalizeClass(unref(ns).e("inner"))
|
|
3624
|
+
}, null, 2)
|
|
3625
|
+
], 2),
|
|
3626
|
+
unref(hasOwnLabel) ? (openBlock(), createElementBlock("span", {
|
|
3627
|
+
key: 0,
|
|
3628
|
+
class: normalizeClass(unref(ns).e("label"))
|
|
3629
|
+
}, [
|
|
3630
|
+
renderSlot(_ctx.$slots, "default"),
|
|
3631
|
+
!_ctx.$slots.default ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
3632
|
+
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
3633
|
+
], 64)) : createCommentVNode("v-if", true)
|
|
3634
|
+
], 2)) : createCommentVNode("v-if", true)
|
|
3635
|
+
];
|
|
3636
|
+
}),
|
|
3637
|
+
_: 3
|
|
3638
|
+
}, 8, ["class", "aria-controls", "onClick"]);
|
|
3639
|
+
};
|
|
3640
|
+
}
|
|
3641
|
+
});
|
|
3642
|
+
var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "checkbox.vue"]]);
|
|
3643
|
+
const __default__$1 = defineComponent({
|
|
3644
|
+
name: "ElCheckboxButton"
|
|
3645
|
+
});
|
|
3646
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
3647
|
+
...__default__$1,
|
|
3648
|
+
props: checkboxProps,
|
|
3649
|
+
emits: checkboxEmits,
|
|
3650
|
+
setup(__props) {
|
|
3651
|
+
const props = __props;
|
|
3652
|
+
const slots = useSlots();
|
|
3653
|
+
const {
|
|
3654
|
+
isFocused,
|
|
3655
|
+
isChecked,
|
|
3656
|
+
isDisabled,
|
|
3657
|
+
checkboxButtonSize,
|
|
3658
|
+
model,
|
|
3659
|
+
actualValue,
|
|
3660
|
+
handleChange
|
|
3661
|
+
} = useCheckbox(props, slots);
|
|
3662
|
+
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
3663
|
+
const ns = useNamespace("checkbox");
|
|
3664
|
+
const activeStyle = computed(() => {
|
|
3665
|
+
var _a2, _b, _c, _d;
|
|
3666
|
+
const fillValue = (_b = (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a2.value) != null ? _b : "";
|
|
3667
|
+
return {
|
|
3668
|
+
backgroundColor: fillValue,
|
|
3669
|
+
borderColor: fillValue,
|
|
3670
|
+
color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
|
|
3671
|
+
boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
|
|
3672
|
+
};
|
|
3673
|
+
});
|
|
3674
|
+
const labelKls = computed(() => {
|
|
3675
|
+
return [
|
|
3676
|
+
ns.b("button"),
|
|
3677
|
+
ns.bm("button", checkboxButtonSize.value),
|
|
3678
|
+
ns.is("disabled", isDisabled.value),
|
|
3679
|
+
ns.is("checked", isChecked.value),
|
|
3680
|
+
ns.is("focus", isFocused.value)
|
|
3681
|
+
];
|
|
3682
|
+
});
|
|
3683
|
+
return (_ctx, _cache) => {
|
|
3684
|
+
var _a2, _b, _c, _d;
|
|
3685
|
+
return openBlock(), createElementBlock("label", {
|
|
3686
|
+
class: normalizeClass(unref(labelKls))
|
|
3687
|
+
}, [
|
|
3688
|
+
_ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
|
|
3689
|
+
key: 0,
|
|
3690
|
+
"onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
|
|
3691
|
+
class: normalizeClass(unref(ns).be("button", "original")),
|
|
3692
|
+
type: "checkbox",
|
|
3693
|
+
name: _ctx.name,
|
|
3694
|
+
tabindex: _ctx.tabindex,
|
|
3695
|
+
disabled: unref(isDisabled),
|
|
3696
|
+
"true-value": (_b = (_a2 = _ctx.trueValue) != null ? _a2 : _ctx.trueLabel) != null ? _b : true,
|
|
3697
|
+
"false-value": (_d = (_c = _ctx.falseValue) != null ? _c : _ctx.falseLabel) != null ? _d : false,
|
|
3698
|
+
onChange: unref(handleChange),
|
|
3699
|
+
onFocus: ($event) => isFocused.value = true,
|
|
3700
|
+
onBlur: ($event) => isFocused.value = false,
|
|
3701
|
+
onClick: withModifiers(() => {
|
|
3702
|
+
}, ["stop"])
|
|
3703
|
+
}, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
|
|
3704
|
+
[vModelCheckbox, unref(model)]
|
|
3705
|
+
]) : withDirectives((openBlock(), createElementBlock("input", {
|
|
3706
|
+
key: 1,
|
|
3707
|
+
"onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
|
|
3708
|
+
class: normalizeClass(unref(ns).be("button", "original")),
|
|
3709
|
+
type: "checkbox",
|
|
3710
|
+
name: _ctx.name,
|
|
3711
|
+
tabindex: _ctx.tabindex,
|
|
3712
|
+
disabled: unref(isDisabled),
|
|
3713
|
+
value: unref(actualValue),
|
|
3714
|
+
onChange: unref(handleChange),
|
|
3715
|
+
onFocus: ($event) => isFocused.value = true,
|
|
3716
|
+
onBlur: ($event) => isFocused.value = false,
|
|
3717
|
+
onClick: withModifiers(() => {
|
|
3718
|
+
}, ["stop"])
|
|
3719
|
+
}, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "value", "onChange", "onFocus", "onBlur", "onClick"])), [
|
|
3720
|
+
[vModelCheckbox, unref(model)]
|
|
3721
|
+
]),
|
|
3722
|
+
_ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
|
|
3723
|
+
key: 2,
|
|
3724
|
+
class: normalizeClass(unref(ns).be("button", "inner")),
|
|
3725
|
+
style: normalizeStyle(unref(isChecked) ? unref(activeStyle) : void 0)
|
|
3726
|
+
}, [
|
|
3727
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
3728
|
+
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
3729
|
+
])
|
|
3730
|
+
], 6)) : createCommentVNode("v-if", true)
|
|
3731
|
+
], 2);
|
|
3732
|
+
};
|
|
3733
|
+
}
|
|
3734
|
+
});
|
|
3735
|
+
var CheckboxButton = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "checkbox-button.vue"]]);
|
|
3736
|
+
const checkboxGroupProps = buildProps({
|
|
3737
|
+
modelValue: {
|
|
3738
|
+
type: definePropType(Array),
|
|
3739
|
+
default: () => []
|
|
3740
|
+
},
|
|
3741
|
+
disabled: Boolean,
|
|
3742
|
+
min: Number,
|
|
3743
|
+
max: Number,
|
|
3744
|
+
size: useSizeProp,
|
|
3745
|
+
fill: String,
|
|
3746
|
+
textColor: String,
|
|
3747
|
+
tag: {
|
|
3748
|
+
type: String,
|
|
3749
|
+
default: "div"
|
|
3750
|
+
},
|
|
3751
|
+
validateEvent: {
|
|
3752
|
+
type: Boolean,
|
|
3753
|
+
default: true
|
|
3754
|
+
},
|
|
3755
|
+
...useAriaProps(["ariaLabel"])
|
|
3756
|
+
});
|
|
3757
|
+
const checkboxGroupEmits = {
|
|
3758
|
+
[UPDATE_MODEL_EVENT]: (val) => isArray$1(val),
|
|
3759
|
+
change: (val) => isArray$1(val)
|
|
3760
|
+
};
|
|
3761
|
+
const __default__ = defineComponent({
|
|
3762
|
+
name: "ElCheckboxGroup"
|
|
3763
|
+
});
|
|
3764
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3765
|
+
...__default__,
|
|
3766
|
+
props: checkboxGroupProps,
|
|
3767
|
+
emits: checkboxGroupEmits,
|
|
3768
|
+
setup(__props, { emit }) {
|
|
3769
|
+
const props = __props;
|
|
3770
|
+
const ns = useNamespace("checkbox");
|
|
3771
|
+
const { formItem } = useFormItem();
|
|
3772
|
+
const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
|
|
3773
|
+
formItemContext: formItem
|
|
3774
|
+
});
|
|
3775
|
+
const changeEvent = async (value) => {
|
|
3776
|
+
emit(UPDATE_MODEL_EVENT, value);
|
|
3777
|
+
await nextTick();
|
|
3778
|
+
emit(CHANGE_EVENT, value);
|
|
3779
|
+
};
|
|
3780
|
+
const modelValue = computed({
|
|
3781
|
+
get() {
|
|
3782
|
+
return props.modelValue;
|
|
3783
|
+
},
|
|
3784
|
+
set(val) {
|
|
3785
|
+
changeEvent(val);
|
|
3786
|
+
}
|
|
3787
|
+
});
|
|
3788
|
+
provide(checkboxGroupContextKey, {
|
|
3789
|
+
...pick(toRefs(props), [
|
|
3790
|
+
"size",
|
|
3791
|
+
"min",
|
|
3792
|
+
"max",
|
|
3793
|
+
"disabled",
|
|
3794
|
+
"validateEvent",
|
|
3795
|
+
"fill",
|
|
3796
|
+
"textColor"
|
|
3797
|
+
]),
|
|
3798
|
+
modelValue,
|
|
3799
|
+
changeEvent
|
|
3800
|
+
});
|
|
3801
|
+
watch(() => props.modelValue, (newVal, oldValue) => {
|
|
3802
|
+
if (props.validateEvent && !isEqual(newVal, oldValue)) {
|
|
3803
|
+
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
|
|
3804
|
+
}
|
|
3805
|
+
});
|
|
3806
|
+
return (_ctx, _cache) => {
|
|
3807
|
+
var _a2;
|
|
3808
|
+
return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
|
|
3809
|
+
id: unref(groupId),
|
|
3810
|
+
class: normalizeClass(unref(ns).b("group")),
|
|
3811
|
+
role: "group",
|
|
3812
|
+
"aria-label": !unref(isLabeledByFormItem) ? _ctx.ariaLabel || "checkbox-group" : void 0,
|
|
3813
|
+
"aria-labelledby": unref(isLabeledByFormItem) ? (_a2 = unref(formItem)) == null ? void 0 : _a2.labelId : void 0
|
|
3814
|
+
}, {
|
|
3815
|
+
default: withCtx(() => [
|
|
3816
|
+
renderSlot(_ctx.$slots, "default")
|
|
3817
|
+
]),
|
|
3818
|
+
_: 3
|
|
3819
|
+
}, 8, ["id", "class", "aria-label", "aria-labelledby"]);
|
|
3820
|
+
};
|
|
3821
|
+
}
|
|
3822
|
+
});
|
|
3823
|
+
var CheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "checkbox-group.vue"]]);
|
|
3824
|
+
const ElCheckbox = withInstall(Checkbox, {
|
|
3825
|
+
CheckboxButton,
|
|
3826
|
+
CheckboxGroup
|
|
3827
|
+
});
|
|
3828
|
+
withNoopInstall(CheckboxButton);
|
|
3829
|
+
withNoopInstall(CheckboxGroup);
|
|
1323
3830
|
class Lines extends THREE.LineSegments {
|
|
1324
3831
|
geometry = new THREE.BufferGeometry();
|
|
1325
3832
|
points = [];
|
|
@@ -1622,64 +4129,39 @@ const SelectLocalFile = Object.assign(selectLocalFileFun, {
|
|
|
1622
4129
|
}
|
|
1623
4130
|
});
|
|
1624
4131
|
export {
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
ElIcon as E,
|
|
1631
|
-
isArray$1 as F,
|
|
1632
|
-
isPropAbsent as G,
|
|
1633
|
-
isObject$1 as H,
|
|
1634
|
-
Lines as I,
|
|
1635
|
-
DomEventRegister as J,
|
|
1636
|
-
DomContainer as K,
|
|
1637
|
-
ListCache as L,
|
|
1638
|
-
Map as M,
|
|
1639
|
-
SelectLocalFile as N,
|
|
1640
|
-
isString as O,
|
|
1641
|
-
noop as P,
|
|
1642
|
-
resolveUnref as Q,
|
|
4132
|
+
isElement as A,
|
|
4133
|
+
withInstallFunction as B,
|
|
4134
|
+
DomEventRegister as D,
|
|
4135
|
+
ElButton as E,
|
|
4136
|
+
Lines as L,
|
|
1643
4137
|
Renderer as R,
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
isClient as U,
|
|
1647
|
-
tryOnMounted as V,
|
|
1648
|
-
identity as W,
|
|
1649
|
-
addUnit as X,
|
|
1650
|
-
useEmptyValuesProps as Y,
|
|
1651
|
-
provideGlobalConfig as Z,
|
|
4138
|
+
SelectLocalFile as S,
|
|
4139
|
+
TypeComponentsMap as T,
|
|
1652
4140
|
_export_sfc as _,
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
useGetDerivedNamespace as u,
|
|
1680
|
-
iconPropType as v,
|
|
1681
|
-
useSizeProp as w,
|
|
1682
|
-
useNamespace as x,
|
|
1683
|
-
withInstall as y,
|
|
1684
|
-
withNoopInstall as z
|
|
4141
|
+
DomContainer as a,
|
|
4142
|
+
ElCheckbox as b,
|
|
4143
|
+
isClient as c,
|
|
4144
|
+
tryOnMounted as d,
|
|
4145
|
+
identity as e,
|
|
4146
|
+
buildProps as f,
|
|
4147
|
+
definePropType as g,
|
|
4148
|
+
isNumber as h,
|
|
4149
|
+
isString as i,
|
|
4150
|
+
addUnit as j,
|
|
4151
|
+
useEmptyValuesProps as k,
|
|
4152
|
+
useSizeProp as l,
|
|
4153
|
+
iconPropType as m,
|
|
4154
|
+
noop as n,
|
|
4155
|
+
useGlobalComponentSettings as o,
|
|
4156
|
+
provideGlobalConfig as p,
|
|
4157
|
+
ElIcon as q,
|
|
4158
|
+
resolveUnref as r,
|
|
4159
|
+
TypeComponents as s,
|
|
4160
|
+
tryOnScopeDispose as t,
|
|
4161
|
+
useNamespace as u,
|
|
4162
|
+
useTimeoutFn as v,
|
|
4163
|
+
withInstall as w,
|
|
4164
|
+
isString$1 as x,
|
|
4165
|
+
isFunction$1 as y,
|
|
4166
|
+
isBoolean as z
|
|
1685
4167
|
};
|