build-dxf 0.0.19-1 → 0.0.19-11
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 -3
- package/src/build.d.ts +21 -1
- package/src/build.js +26 -4
- package/src/index.css +526 -1
- package/src/index.js +4 -2
- package/src/index2.js +2363 -3516
- package/src/index3.js +62 -65
- package/src/selectLocalFile.js +511 -2571
- package/src/utils/ComponentManager/ComponentManager.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/Editor/pages/EditorTool.vue.d.ts +3 -1
- package/src/utils/DxfSystem/plugin/RenderPlugin/components/DomEventRegister.d.ts +28 -6
- package/src/utils/DxfSystem/plugin/RenderPlugin/components/Renderer.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/RenderPlugin/index.d.ts +2 -1
package/src/selectLocalFile.js
CHANGED
|
@@ -1,5 +1,205 @@
|
|
|
1
|
-
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";
|
|
2
1
|
import * as THREE from "three";
|
|
2
|
+
import { Vector2 } from "three";
|
|
3
|
+
import { CSS3DObject, CSS3DSprite, CSS3DRenderer } from "three/addons/renderers/CSS3DRenderer.js";
|
|
4
|
+
import { CSS2DObject, CSS2DRenderer } from "three/addons/renderers/CSS2DRenderer.js";
|
|
5
|
+
import { OrbitControls } from "three/addons/controls/OrbitControls.js";
|
|
6
|
+
import * as TWEEN from "@tweenjs/tween.js";
|
|
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";
|
|
9
|
+
THREE.Object3D.DEFAULT_UP = new THREE.Vector3(0, 0, 1);
|
|
10
|
+
class Renderer extends Component {
|
|
11
|
+
static name = "Renderer";
|
|
12
|
+
static CSS2DObject = CSS2DObject;
|
|
13
|
+
static CSS3DObject = CSS3DObject;
|
|
14
|
+
static CSS3DSprite = CSS3DSprite;
|
|
15
|
+
static Group = THREE.Group;
|
|
16
|
+
static Object3D = THREE.Object3D;
|
|
17
|
+
static Mesh = THREE.Mesh;
|
|
18
|
+
static Line = THREE.Line;
|
|
19
|
+
static LineSegments = THREE.LineSegments;
|
|
20
|
+
static Points = THREE.Points;
|
|
21
|
+
scene;
|
|
22
|
+
camera;
|
|
23
|
+
renderer;
|
|
24
|
+
orbitControls;
|
|
25
|
+
resizeObserver;
|
|
26
|
+
description;
|
|
27
|
+
html2DRenderer;
|
|
28
|
+
html3DRenderer;
|
|
29
|
+
container = new THREE.Group();
|
|
30
|
+
onUpdate;
|
|
31
|
+
onResize;
|
|
32
|
+
tweenTaskList = [];
|
|
33
|
+
constructor(description) {
|
|
34
|
+
super();
|
|
35
|
+
this.description = description;
|
|
36
|
+
const {
|
|
37
|
+
scene = new THREE.Scene(),
|
|
38
|
+
camera = new THREE.PerspectiveCamera(45, 1, 0.01, 1e3)
|
|
39
|
+
} = description;
|
|
40
|
+
this.camera = camera;
|
|
41
|
+
this.scene = scene;
|
|
42
|
+
scene.add(this.container);
|
|
43
|
+
this.renderer = new THREE.WebGLRenderer({
|
|
44
|
+
canvas: this.description.canvas,
|
|
45
|
+
antialias: true
|
|
46
|
+
});
|
|
47
|
+
this.renderer.setPixelRatio(window.devicePixelRatio);
|
|
48
|
+
if (description.htmlRenderer) {
|
|
49
|
+
if (description.htmlRenderer["2d"]) {
|
|
50
|
+
this.html2DRenderer = new CSS2DRenderer();
|
|
51
|
+
Object.assign(this.html2DRenderer.domElement.style, { position: "absolute", left: "0px", top: "0px" });
|
|
52
|
+
description.htmlRenderer["2d"].appendChild(this.html2DRenderer.domElement);
|
|
53
|
+
}
|
|
54
|
+
if (description.htmlRenderer["3d"]) {
|
|
55
|
+
this.html3DRenderer = new CSS3DRenderer();
|
|
56
|
+
Object.assign(this.html3DRenderer.domElement.style, { position: "absolute", left: "0px", top: "0px" });
|
|
57
|
+
description.htmlRenderer["3d"].appendChild(this.html3DRenderer.domElement);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (description.orbitControls) {
|
|
61
|
+
this.orbitControls = new OrbitControls(this.camera, description.orbitControls.domElement);
|
|
62
|
+
Object.assign(this.orbitControls, description.orbitControls);
|
|
63
|
+
}
|
|
64
|
+
if (this.description.resizeObserver) {
|
|
65
|
+
const dom = this.description.resizeObserver;
|
|
66
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
67
|
+
const camera2 = this.camera;
|
|
68
|
+
const { width, height } = dom.getBoundingClientRect();
|
|
69
|
+
this.renderer.setSize(width, height);
|
|
70
|
+
if (this.html2DRenderer) this.html2DRenderer.setSize(width, height);
|
|
71
|
+
if (this.html3DRenderer) this.html3DRenderer.setSize(width, height);
|
|
72
|
+
if (camera2 instanceof THREE.PerspectiveCamera) {
|
|
73
|
+
camera2.aspect = width / height;
|
|
74
|
+
} else if (camera2 instanceof THREE.OrthographicCamera) {
|
|
75
|
+
camera2.left = -width * 0.5;
|
|
76
|
+
camera2.right = width * 0.5;
|
|
77
|
+
camera2.top = height * 0.5;
|
|
78
|
+
camera2.bottom = -height * 0.5;
|
|
79
|
+
}
|
|
80
|
+
camera2.updateProjectionMatrix();
|
|
81
|
+
this.onResize && this.onResize(width, height);
|
|
82
|
+
this.dispatchEvent({ type: "resize", width, height });
|
|
83
|
+
});
|
|
84
|
+
this.resizeObserver.observe(dom);
|
|
85
|
+
}
|
|
86
|
+
this.renderer.setAnimationLoop(() => {
|
|
87
|
+
if (this.html2DRenderer) this.html2DRenderer.render(this.scene, this.camera);
|
|
88
|
+
if (this.html3DRenderer) this.html3DRenderer.render(this.scene, this.camera);
|
|
89
|
+
this.renderer.render(this.scene, this.camera);
|
|
90
|
+
if (this.orbitControls && this.orbitControls.enabled) this.orbitControls.update();
|
|
91
|
+
this.tweenTaskList.forEach((tween) => tween.update());
|
|
92
|
+
this.onUpdate && this.onUpdate();
|
|
93
|
+
this.parent?.components.forEach((c) => c.dispatchEvent({ type: "update" }));
|
|
94
|
+
});
|
|
95
|
+
this.scene.add(new THREE.AmbientLight(16777215, 0.5));
|
|
96
|
+
this.scene.background = new THREE.Color(3355443);
|
|
97
|
+
const directLight = new THREE.DirectionalLight(16777215, 4);
|
|
98
|
+
directLight.position.set(100, -100, 100);
|
|
99
|
+
this.scene.add(directLight);
|
|
100
|
+
camera.position.set(10, 10, 10);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* 世界坐标转屏幕坐标
|
|
104
|
+
* @param worldPosition
|
|
105
|
+
* @param camera
|
|
106
|
+
* @param renderer
|
|
107
|
+
* @returns
|
|
108
|
+
*/
|
|
109
|
+
worldToScreenPosition(worldPosition) {
|
|
110
|
+
const vector = new THREE.Vector3();
|
|
111
|
+
vector.copy(worldPosition);
|
|
112
|
+
vector.project(this.camera);
|
|
113
|
+
const x = (vector.x * 0.5 + 0.5) * this.renderer.domElement.clientWidth;
|
|
114
|
+
const z = (-vector.z * 0.5 + 0.5) * this.renderer.domElement.clientHeight;
|
|
115
|
+
return new THREE.Vector2(x, z);
|
|
116
|
+
}
|
|
117
|
+
cameraPositionRecord = [];
|
|
118
|
+
/**
|
|
119
|
+
* 相机
|
|
120
|
+
* @param position
|
|
121
|
+
* @param lookAt
|
|
122
|
+
* @param onEnd
|
|
123
|
+
*/
|
|
124
|
+
cameraTo(position, lookAt, onEnd) {
|
|
125
|
+
this.cameraPositionRecord.push([
|
|
126
|
+
this.camera.position.clone(),
|
|
127
|
+
this.camera.quaternion.clone()
|
|
128
|
+
]);
|
|
129
|
+
const tween = new TWEEN.Tween(this.camera.position);
|
|
130
|
+
tween.to(position, 600);
|
|
131
|
+
tween.start();
|
|
132
|
+
tween.onUpdate(() => {
|
|
133
|
+
this.camera.lookAt(lookAt);
|
|
134
|
+
});
|
|
135
|
+
tween.onComplete(() => {
|
|
136
|
+
const i = this.tweenTaskList.indexOf(tween);
|
|
137
|
+
this.tweenTaskList.splice(i, 1);
|
|
138
|
+
onEnd && onEnd();
|
|
139
|
+
});
|
|
140
|
+
this.tweenTaskList.push(tween);
|
|
141
|
+
}
|
|
142
|
+
cameraBack() {
|
|
143
|
+
if (this.cameraPositionRecord.length) {
|
|
144
|
+
const [pos, quat] = this.cameraPositionRecord.pop();
|
|
145
|
+
this.camera.position.copy(pos);
|
|
146
|
+
this.camera.quaternion.copy(quat);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* 创建点
|
|
151
|
+
* @param pos
|
|
152
|
+
*/
|
|
153
|
+
createPointMesh(pos, size = 0.02, parameters, parent = this.container) {
|
|
154
|
+
const box = new THREE.Mesh(
|
|
155
|
+
new THREE.SphereGeometry(size),
|
|
156
|
+
new THREE.MeshBasicMaterial(parameters)
|
|
157
|
+
);
|
|
158
|
+
if (pos instanceof Point) box.position.set(pos.x, pos.y, 0);
|
|
159
|
+
else if (pos instanceof THREE.Vector3) box.position.copy(pos);
|
|
160
|
+
parent.add(box);
|
|
161
|
+
return box;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* 创建文本
|
|
165
|
+
* @param text
|
|
166
|
+
* @param pos
|
|
167
|
+
* @param style
|
|
168
|
+
*/
|
|
169
|
+
createText(text, pos, style, parent = this.container) {
|
|
170
|
+
const div = document.createElement("div");
|
|
171
|
+
div.innerHTML = text;
|
|
172
|
+
div.style.pointerEvents = "none";
|
|
173
|
+
Object.assign(div.style, { fontSize: "10px", color: "#ffffff", ...style });
|
|
174
|
+
const css2DObject = new Renderer.CSS2DObject(div);
|
|
175
|
+
if (pos instanceof Point) css2DObject.position.set(pos.x, pos.y, 0);
|
|
176
|
+
else if (pos instanceof THREE.Vector3) css2DObject.position.copy(pos);
|
|
177
|
+
parent.add(css2DObject);
|
|
178
|
+
return css2DObject;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* 创建几何缓冲区
|
|
182
|
+
* @param map
|
|
183
|
+
* @param count
|
|
184
|
+
*/
|
|
185
|
+
createLineSegments(map, count, parameters, parent = this.container) {
|
|
186
|
+
const geometry = new THREE.BufferGeometry();
|
|
187
|
+
Object.keys(map).forEach((key) => {
|
|
188
|
+
const value = map[key];
|
|
189
|
+
geometry.setAttribute(key, new THREE.BufferAttribute(new Float32Array(value), value.length / count));
|
|
190
|
+
});
|
|
191
|
+
const lineSegmentList = new THREE.LineSegments(geometry, new THREE.LineBasicMaterial({ ...parameters }));
|
|
192
|
+
parent.add(lineSegmentList);
|
|
193
|
+
return lineSegmentList;
|
|
194
|
+
}
|
|
195
|
+
destroy() {
|
|
196
|
+
if (this.resizeObserver) {
|
|
197
|
+
this.renderer.dispose();
|
|
198
|
+
this.resizeObserver.disconnect();
|
|
199
|
+
this.resizeObserver = void 0;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
3
203
|
const configProviderContextKey = Symbol();
|
|
4
204
|
const defaultNamespace = "el";
|
|
5
205
|
const statePrefix = "is-";
|
|
@@ -82,8 +282,8 @@ const useNamespace = (block, namespaceOverrides) => {
|
|
|
82
282
|
!!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
|
|
83
283
|
const NOOP = () => {
|
|
84
284
|
};
|
|
85
|
-
const hasOwnProperty$
|
|
86
|
-
const hasOwn = (val, key) => hasOwnProperty$
|
|
285
|
+
const hasOwnProperty$4 = Object.prototype.hasOwnProperty;
|
|
286
|
+
const hasOwn = (val, key) => hasOwnProperty$4.call(val, key);
|
|
87
287
|
const isArray$1 = Array.isArray;
|
|
88
288
|
const isFunction$1 = (val) => typeof val === "function";
|
|
89
289
|
const isString$1 = (val) => typeof val === "string";
|
|
@@ -92,12 +292,12 @@ var freeGlobal = typeof global == "object" && global && global.Object === Object
|
|
|
92
292
|
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
93
293
|
var root = freeGlobal || freeSelf || Function("return this")();
|
|
94
294
|
var Symbol$1 = root.Symbol;
|
|
95
|
-
var objectProto$
|
|
96
|
-
var hasOwnProperty$
|
|
97
|
-
var nativeObjectToString$1 = objectProto$
|
|
295
|
+
var objectProto$4 = Object.prototype;
|
|
296
|
+
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
297
|
+
var nativeObjectToString$1 = objectProto$4.toString;
|
|
98
298
|
var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0;
|
|
99
299
|
function getRawTag(value) {
|
|
100
|
-
var isOwn = hasOwnProperty$
|
|
300
|
+
var isOwn = hasOwnProperty$3.call(value, symToStringTag$1), tag = value[symToStringTag$1];
|
|
101
301
|
try {
|
|
102
302
|
value[symToStringTag$1] = void 0;
|
|
103
303
|
var unmasked = true;
|
|
@@ -113,8 +313,8 @@ function getRawTag(value) {
|
|
|
113
313
|
}
|
|
114
314
|
return result;
|
|
115
315
|
}
|
|
116
|
-
var objectProto$
|
|
117
|
-
var nativeObjectToString = objectProto$
|
|
316
|
+
var objectProto$3 = Object.prototype;
|
|
317
|
+
var nativeObjectToString = objectProto$3.toString;
|
|
118
318
|
function objectToString(value) {
|
|
119
319
|
return nativeObjectToString.call(value);
|
|
120
320
|
}
|
|
@@ -129,9 +329,9 @@ function baseGetTag(value) {
|
|
|
129
329
|
function isObjectLike(value) {
|
|
130
330
|
return value != null && typeof value == "object";
|
|
131
331
|
}
|
|
132
|
-
var symbolTag
|
|
332
|
+
var symbolTag = "[object Symbol]";
|
|
133
333
|
function isSymbol(value) {
|
|
134
|
-
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag
|
|
334
|
+
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
135
335
|
}
|
|
136
336
|
function arrayMap(array, iteratee) {
|
|
137
337
|
var index = -1, length = array == null ? 0 : array.length, result = Array(length);
|
|
@@ -141,7 +341,7 @@ function arrayMap(array, iteratee) {
|
|
|
141
341
|
return result;
|
|
142
342
|
}
|
|
143
343
|
var isArray = Array.isArray;
|
|
144
|
-
var symbolProto
|
|
344
|
+
var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolToString = symbolProto ? symbolProto.toString : void 0;
|
|
145
345
|
function baseToString(value) {
|
|
146
346
|
if (typeof value == "string") {
|
|
147
347
|
return value;
|
|
@@ -159,16 +359,13 @@ function isObject(value) {
|
|
|
159
359
|
var type = typeof value;
|
|
160
360
|
return value != null && (type == "object" || type == "function");
|
|
161
361
|
}
|
|
162
|
-
|
|
163
|
-
return value;
|
|
164
|
-
}
|
|
165
|
-
var asyncTag = "[object AsyncFunction]", funcTag$1 = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
|
|
362
|
+
var asyncTag = "[object AsyncFunction]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
|
|
166
363
|
function isFunction(value) {
|
|
167
364
|
if (!isObject(value)) {
|
|
168
365
|
return false;
|
|
169
366
|
}
|
|
170
367
|
var tag = baseGetTag(value);
|
|
171
|
-
return tag == funcTag
|
|
368
|
+
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
172
369
|
}
|
|
173
370
|
var coreJsData = root["__core-js_shared__"];
|
|
174
371
|
var maskSrcKey = (function() {
|
|
@@ -195,11 +392,11 @@ function toSource(func) {
|
|
|
195
392
|
}
|
|
196
393
|
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
197
394
|
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
198
|
-
var funcProto = Function.prototype, objectProto$
|
|
395
|
+
var funcProto = Function.prototype, objectProto$2 = Object.prototype;
|
|
199
396
|
var funcToString = funcProto.toString;
|
|
200
|
-
var hasOwnProperty$
|
|
397
|
+
var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
|
|
201
398
|
var reIsNative = RegExp(
|
|
202
|
-
"^" + funcToString.call(hasOwnProperty$
|
|
399
|
+
"^" + funcToString.call(hasOwnProperty$2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
203
400
|
);
|
|
204
401
|
function baseIsNative(value) {
|
|
205
402
|
if (!isObject(value) || isMasked(value)) {
|
|
@@ -215,213 +412,9 @@ function getNative(object, key) {
|
|
|
215
412
|
var value = getValue(object, key);
|
|
216
413
|
return baseIsNative(value) ? value : void 0;
|
|
217
414
|
}
|
|
218
|
-
var WeakMap = getNative(root, "WeakMap");
|
|
219
|
-
function apply(func, thisArg, args) {
|
|
220
|
-
switch (args.length) {
|
|
221
|
-
case 0:
|
|
222
|
-
return func.call(thisArg);
|
|
223
|
-
case 1:
|
|
224
|
-
return func.call(thisArg, args[0]);
|
|
225
|
-
case 2:
|
|
226
|
-
return func.call(thisArg, args[0], args[1]);
|
|
227
|
-
case 3:
|
|
228
|
-
return func.call(thisArg, args[0], args[1], args[2]);
|
|
229
|
-
}
|
|
230
|
-
return func.apply(thisArg, args);
|
|
231
|
-
}
|
|
232
|
-
var HOT_COUNT = 800, HOT_SPAN = 16;
|
|
233
|
-
var nativeNow = Date.now;
|
|
234
|
-
function shortOut(func) {
|
|
235
|
-
var count = 0, lastCalled = 0;
|
|
236
|
-
return function() {
|
|
237
|
-
var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
|
|
238
|
-
lastCalled = stamp;
|
|
239
|
-
if (remaining > 0) {
|
|
240
|
-
if (++count >= HOT_COUNT) {
|
|
241
|
-
return arguments[0];
|
|
242
|
-
}
|
|
243
|
-
} else {
|
|
244
|
-
count = 0;
|
|
245
|
-
}
|
|
246
|
-
return func.apply(void 0, arguments);
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
function constant(value) {
|
|
250
|
-
return function() {
|
|
251
|
-
return value;
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
var defineProperty = (function() {
|
|
255
|
-
try {
|
|
256
|
-
var func = getNative(Object, "defineProperty");
|
|
257
|
-
func({}, "", {});
|
|
258
|
-
return func;
|
|
259
|
-
} catch (e) {
|
|
260
|
-
}
|
|
261
|
-
})();
|
|
262
|
-
var baseSetToString = !defineProperty ? identity$1 : function(func, string) {
|
|
263
|
-
return defineProperty(func, "toString", {
|
|
264
|
-
"configurable": true,
|
|
265
|
-
"enumerable": false,
|
|
266
|
-
"value": constant(string),
|
|
267
|
-
"writable": true
|
|
268
|
-
});
|
|
269
|
-
};
|
|
270
|
-
var setToString = shortOut(baseSetToString);
|
|
271
|
-
var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
|
272
|
-
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
273
|
-
function isIndex(value, length) {
|
|
274
|
-
var type = typeof value;
|
|
275
|
-
length = length == null ? MAX_SAFE_INTEGER$1 : length;
|
|
276
|
-
return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
|
|
277
|
-
}
|
|
278
|
-
function baseAssignValue(object, key, value) {
|
|
279
|
-
if (key == "__proto__" && defineProperty) {
|
|
280
|
-
defineProperty(object, key, {
|
|
281
|
-
"configurable": true,
|
|
282
|
-
"enumerable": true,
|
|
283
|
-
"value": value,
|
|
284
|
-
"writable": true
|
|
285
|
-
});
|
|
286
|
-
} else {
|
|
287
|
-
object[key] = value;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
415
|
function eq(value, other) {
|
|
291
416
|
return value === other || value !== value && other !== other;
|
|
292
417
|
}
|
|
293
|
-
var objectProto$9 = Object.prototype;
|
|
294
|
-
var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
|
|
295
|
-
function assignValue(object, key, value) {
|
|
296
|
-
var objValue = object[key];
|
|
297
|
-
if (!(hasOwnProperty$7.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
|
|
298
|
-
baseAssignValue(object, key, value);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
var nativeMax = Math.max;
|
|
302
|
-
function overRest(func, start, transform) {
|
|
303
|
-
start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
|
|
304
|
-
return function() {
|
|
305
|
-
var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length);
|
|
306
|
-
while (++index < length) {
|
|
307
|
-
array[index] = args[start + index];
|
|
308
|
-
}
|
|
309
|
-
index = -1;
|
|
310
|
-
var otherArgs = Array(start + 1);
|
|
311
|
-
while (++index < start) {
|
|
312
|
-
otherArgs[index] = args[index];
|
|
313
|
-
}
|
|
314
|
-
otherArgs[start] = transform(array);
|
|
315
|
-
return apply(func, this, otherArgs);
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
319
|
-
function isLength(value) {
|
|
320
|
-
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
321
|
-
}
|
|
322
|
-
function isArrayLike(value) {
|
|
323
|
-
return value != null && isLength(value.length) && !isFunction(value);
|
|
324
|
-
}
|
|
325
|
-
var objectProto$8 = Object.prototype;
|
|
326
|
-
function isPrototype(value) {
|
|
327
|
-
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$8;
|
|
328
|
-
return value === proto;
|
|
329
|
-
}
|
|
330
|
-
function baseTimes(n, iteratee) {
|
|
331
|
-
var index = -1, result = Array(n);
|
|
332
|
-
while (++index < n) {
|
|
333
|
-
result[index] = iteratee(index);
|
|
334
|
-
}
|
|
335
|
-
return result;
|
|
336
|
-
}
|
|
337
|
-
var argsTag$2 = "[object Arguments]";
|
|
338
|
-
function baseIsArguments(value) {
|
|
339
|
-
return isObjectLike(value) && baseGetTag(value) == argsTag$2;
|
|
340
|
-
}
|
|
341
|
-
var objectProto$7 = Object.prototype;
|
|
342
|
-
var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
|
|
343
|
-
var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
|
|
344
|
-
var isArguments = baseIsArguments(/* @__PURE__ */ (function() {
|
|
345
|
-
return arguments;
|
|
346
|
-
})()) ? baseIsArguments : function(value) {
|
|
347
|
-
return isObjectLike(value) && hasOwnProperty$6.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
|
|
348
|
-
};
|
|
349
|
-
function stubFalse() {
|
|
350
|
-
return false;
|
|
351
|
-
}
|
|
352
|
-
var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
353
|
-
var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
|
|
354
|
-
var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
|
|
355
|
-
var Buffer = moduleExports$1 ? root.Buffer : void 0;
|
|
356
|
-
var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
|
|
357
|
-
var isBuffer = nativeIsBuffer || stubFalse;
|
|
358
|
-
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]";
|
|
359
|
-
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]";
|
|
360
|
-
var typedArrayTags = {};
|
|
361
|
-
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
|
|
362
|
-
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;
|
|
363
|
-
function baseIsTypedArray(value) {
|
|
364
|
-
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
|
365
|
-
}
|
|
366
|
-
function baseUnary(func) {
|
|
367
|
-
return function(value) {
|
|
368
|
-
return func(value);
|
|
369
|
-
};
|
|
370
|
-
}
|
|
371
|
-
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
372
|
-
var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
|
|
373
|
-
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
374
|
-
var freeProcess = moduleExports && freeGlobal.process;
|
|
375
|
-
var nodeUtil = (function() {
|
|
376
|
-
try {
|
|
377
|
-
var types = freeModule && freeModule.require && freeModule.require("util").types;
|
|
378
|
-
if (types) {
|
|
379
|
-
return types;
|
|
380
|
-
}
|
|
381
|
-
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
382
|
-
} catch (e) {
|
|
383
|
-
}
|
|
384
|
-
})();
|
|
385
|
-
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
386
|
-
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
387
|
-
var objectProto$6 = Object.prototype;
|
|
388
|
-
var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
|
|
389
|
-
function arrayLikeKeys(value, inherited) {
|
|
390
|
-
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;
|
|
391
|
-
for (var key in value) {
|
|
392
|
-
if (hasOwnProperty$5.call(value, key) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
393
|
-
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
394
|
-
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
395
|
-
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
|
|
396
|
-
isIndex(key, length)))) {
|
|
397
|
-
result.push(key);
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
return result;
|
|
401
|
-
}
|
|
402
|
-
function overArg(func, transform) {
|
|
403
|
-
return function(arg) {
|
|
404
|
-
return func(transform(arg));
|
|
405
|
-
};
|
|
406
|
-
}
|
|
407
|
-
var nativeKeys = overArg(Object.keys, Object);
|
|
408
|
-
var objectProto$5 = Object.prototype;
|
|
409
|
-
var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
|
|
410
|
-
function baseKeys(object) {
|
|
411
|
-
if (!isPrototype(object)) {
|
|
412
|
-
return nativeKeys(object);
|
|
413
|
-
}
|
|
414
|
-
var result = [];
|
|
415
|
-
for (var key in Object(object)) {
|
|
416
|
-
if (hasOwnProperty$4.call(object, key) && key != "constructor") {
|
|
417
|
-
result.push(key);
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
return result;
|
|
421
|
-
}
|
|
422
|
-
function keys(object) {
|
|
423
|
-
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
424
|
-
}
|
|
425
418
|
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
|
|
426
419
|
function isKey(value, object) {
|
|
427
420
|
if (isArray(value)) {
|
|
@@ -443,28 +436,28 @@ function hashDelete(key) {
|
|
|
443
436
|
this.size -= result ? 1 : 0;
|
|
444
437
|
return result;
|
|
445
438
|
}
|
|
446
|
-
var HASH_UNDEFINED$
|
|
447
|
-
var objectProto$
|
|
448
|
-
var hasOwnProperty$
|
|
439
|
+
var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
|
|
440
|
+
var objectProto$1 = Object.prototype;
|
|
441
|
+
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
449
442
|
function hashGet(key) {
|
|
450
443
|
var data = this.__data__;
|
|
451
444
|
if (nativeCreate) {
|
|
452
445
|
var result = data[key];
|
|
453
|
-
return result === HASH_UNDEFINED$
|
|
446
|
+
return result === HASH_UNDEFINED$1 ? void 0 : result;
|
|
454
447
|
}
|
|
455
|
-
return hasOwnProperty$
|
|
448
|
+
return hasOwnProperty$1.call(data, key) ? data[key] : void 0;
|
|
456
449
|
}
|
|
457
|
-
var objectProto
|
|
458
|
-
var hasOwnProperty
|
|
450
|
+
var objectProto = Object.prototype;
|
|
451
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
459
452
|
function hashHas(key) {
|
|
460
453
|
var data = this.__data__;
|
|
461
|
-
return nativeCreate ? data[key] !== void 0 : hasOwnProperty
|
|
454
|
+
return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
|
|
462
455
|
}
|
|
463
|
-
var HASH_UNDEFINED
|
|
456
|
+
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
464
457
|
function hashSet(key, value) {
|
|
465
458
|
var data = this.__data__;
|
|
466
459
|
this.size += this.has(key) ? 0 : 1;
|
|
467
|
-
data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED
|
|
460
|
+
data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
|
|
468
461
|
return this;
|
|
469
462
|
}
|
|
470
463
|
function Hash(entries) {
|
|
@@ -655,388 +648,6 @@ function get(object, path, defaultValue) {
|
|
|
655
648
|
var result = object == null ? void 0 : baseGet(object, path);
|
|
656
649
|
return result === void 0 ? defaultValue : result;
|
|
657
650
|
}
|
|
658
|
-
function arrayPush(array, values) {
|
|
659
|
-
var index = -1, length = values.length, offset = array.length;
|
|
660
|
-
while (++index < length) {
|
|
661
|
-
array[offset + index] = values[index];
|
|
662
|
-
}
|
|
663
|
-
return array;
|
|
664
|
-
}
|
|
665
|
-
var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : void 0;
|
|
666
|
-
function isFlattenable(value) {
|
|
667
|
-
return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
668
|
-
}
|
|
669
|
-
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
670
|
-
var index = -1, length = array.length;
|
|
671
|
-
predicate || (predicate = isFlattenable);
|
|
672
|
-
result || (result = []);
|
|
673
|
-
while (++index < length) {
|
|
674
|
-
var value = array[index];
|
|
675
|
-
if (predicate(value)) {
|
|
676
|
-
{
|
|
677
|
-
arrayPush(result, value);
|
|
678
|
-
}
|
|
679
|
-
} else {
|
|
680
|
-
result[result.length] = value;
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
return result;
|
|
684
|
-
}
|
|
685
|
-
function flatten(array) {
|
|
686
|
-
var length = array == null ? 0 : array.length;
|
|
687
|
-
return length ? baseFlatten(array) : [];
|
|
688
|
-
}
|
|
689
|
-
function flatRest(func) {
|
|
690
|
-
return setToString(overRest(func, void 0, flatten), func + "");
|
|
691
|
-
}
|
|
692
|
-
function stackClear() {
|
|
693
|
-
this.__data__ = new ListCache();
|
|
694
|
-
this.size = 0;
|
|
695
|
-
}
|
|
696
|
-
function stackDelete(key) {
|
|
697
|
-
var data = this.__data__, result = data["delete"](key);
|
|
698
|
-
this.size = data.size;
|
|
699
|
-
return result;
|
|
700
|
-
}
|
|
701
|
-
function stackGet(key) {
|
|
702
|
-
return this.__data__.get(key);
|
|
703
|
-
}
|
|
704
|
-
function stackHas(key) {
|
|
705
|
-
return this.__data__.has(key);
|
|
706
|
-
}
|
|
707
|
-
var LARGE_ARRAY_SIZE = 200;
|
|
708
|
-
function stackSet(key, value) {
|
|
709
|
-
var data = this.__data__;
|
|
710
|
-
if (data instanceof ListCache) {
|
|
711
|
-
var pairs = data.__data__;
|
|
712
|
-
if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
713
|
-
pairs.push([key, value]);
|
|
714
|
-
this.size = ++data.size;
|
|
715
|
-
return this;
|
|
716
|
-
}
|
|
717
|
-
data = this.__data__ = new MapCache(pairs);
|
|
718
|
-
}
|
|
719
|
-
data.set(key, value);
|
|
720
|
-
this.size = data.size;
|
|
721
|
-
return this;
|
|
722
|
-
}
|
|
723
|
-
function Stack(entries) {
|
|
724
|
-
var data = this.__data__ = new ListCache(entries);
|
|
725
|
-
this.size = data.size;
|
|
726
|
-
}
|
|
727
|
-
Stack.prototype.clear = stackClear;
|
|
728
|
-
Stack.prototype["delete"] = stackDelete;
|
|
729
|
-
Stack.prototype.get = stackGet;
|
|
730
|
-
Stack.prototype.has = stackHas;
|
|
731
|
-
Stack.prototype.set = stackSet;
|
|
732
|
-
function arrayFilter(array, predicate) {
|
|
733
|
-
var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
|
|
734
|
-
while (++index < length) {
|
|
735
|
-
var value = array[index];
|
|
736
|
-
if (predicate(value, index, array)) {
|
|
737
|
-
result[resIndex++] = value;
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
return result;
|
|
741
|
-
}
|
|
742
|
-
function stubArray() {
|
|
743
|
-
return [];
|
|
744
|
-
}
|
|
745
|
-
var objectProto$2 = Object.prototype;
|
|
746
|
-
var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
|
|
747
|
-
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
748
|
-
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
|
749
|
-
if (object == null) {
|
|
750
|
-
return [];
|
|
751
|
-
}
|
|
752
|
-
object = Object(object);
|
|
753
|
-
return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
|
754
|
-
return propertyIsEnumerable.call(object, symbol);
|
|
755
|
-
});
|
|
756
|
-
};
|
|
757
|
-
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
758
|
-
var result = keysFunc(object);
|
|
759
|
-
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
760
|
-
}
|
|
761
|
-
function getAllKeys(object) {
|
|
762
|
-
return baseGetAllKeys(object, keys, getSymbols);
|
|
763
|
-
}
|
|
764
|
-
var DataView = getNative(root, "DataView");
|
|
765
|
-
var Promise$1 = getNative(root, "Promise");
|
|
766
|
-
var Set$1 = getNative(root, "Set");
|
|
767
|
-
var mapTag$1 = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag$1 = "[object Set]", weakMapTag = "[object WeakMap]";
|
|
768
|
-
var dataViewTag$1 = "[object DataView]";
|
|
769
|
-
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap);
|
|
770
|
-
var getTag = baseGetTag;
|
|
771
|
-
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) {
|
|
772
|
-
getTag = function(value) {
|
|
773
|
-
var result = baseGetTag(value), Ctor = result == objectTag$1 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
|
|
774
|
-
if (ctorString) {
|
|
775
|
-
switch (ctorString) {
|
|
776
|
-
case dataViewCtorString:
|
|
777
|
-
return dataViewTag$1;
|
|
778
|
-
case mapCtorString:
|
|
779
|
-
return mapTag$1;
|
|
780
|
-
case promiseCtorString:
|
|
781
|
-
return promiseTag;
|
|
782
|
-
case setCtorString:
|
|
783
|
-
return setTag$1;
|
|
784
|
-
case weakMapCtorString:
|
|
785
|
-
return weakMapTag;
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
return result;
|
|
789
|
-
};
|
|
790
|
-
}
|
|
791
|
-
var Uint8Array = root.Uint8Array;
|
|
792
|
-
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
793
|
-
function setCacheAdd(value) {
|
|
794
|
-
this.__data__.set(value, HASH_UNDEFINED);
|
|
795
|
-
return this;
|
|
796
|
-
}
|
|
797
|
-
function setCacheHas(value) {
|
|
798
|
-
return this.__data__.has(value);
|
|
799
|
-
}
|
|
800
|
-
function SetCache(values) {
|
|
801
|
-
var index = -1, length = values == null ? 0 : values.length;
|
|
802
|
-
this.__data__ = new MapCache();
|
|
803
|
-
while (++index < length) {
|
|
804
|
-
this.add(values[index]);
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
|
808
|
-
SetCache.prototype.has = setCacheHas;
|
|
809
|
-
function arraySome(array, predicate) {
|
|
810
|
-
var index = -1, length = array == null ? 0 : array.length;
|
|
811
|
-
while (++index < length) {
|
|
812
|
-
if (predicate(array[index], index, array)) {
|
|
813
|
-
return true;
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
return false;
|
|
817
|
-
}
|
|
818
|
-
function cacheHas(cache, key) {
|
|
819
|
-
return cache.has(key);
|
|
820
|
-
}
|
|
821
|
-
var COMPARE_PARTIAL_FLAG$3 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
|
|
822
|
-
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
823
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, arrLength = array.length, othLength = other.length;
|
|
824
|
-
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
|
825
|
-
return false;
|
|
826
|
-
}
|
|
827
|
-
var arrStacked = stack.get(array);
|
|
828
|
-
var othStacked = stack.get(other);
|
|
829
|
-
if (arrStacked && othStacked) {
|
|
830
|
-
return arrStacked == other && othStacked == array;
|
|
831
|
-
}
|
|
832
|
-
var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$1 ? new SetCache() : void 0;
|
|
833
|
-
stack.set(array, other);
|
|
834
|
-
stack.set(other, array);
|
|
835
|
-
while (++index < arrLength) {
|
|
836
|
-
var arrValue = array[index], othValue = other[index];
|
|
837
|
-
if (customizer) {
|
|
838
|
-
var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
|
|
839
|
-
}
|
|
840
|
-
if (compared !== void 0) {
|
|
841
|
-
if (compared) {
|
|
842
|
-
continue;
|
|
843
|
-
}
|
|
844
|
-
result = false;
|
|
845
|
-
break;
|
|
846
|
-
}
|
|
847
|
-
if (seen) {
|
|
848
|
-
if (!arraySome(other, function(othValue2, othIndex) {
|
|
849
|
-
if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
|
|
850
|
-
return seen.push(othIndex);
|
|
851
|
-
}
|
|
852
|
-
})) {
|
|
853
|
-
result = false;
|
|
854
|
-
break;
|
|
855
|
-
}
|
|
856
|
-
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
|
857
|
-
result = false;
|
|
858
|
-
break;
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
stack["delete"](array);
|
|
862
|
-
stack["delete"](other);
|
|
863
|
-
return result;
|
|
864
|
-
}
|
|
865
|
-
function mapToArray(map) {
|
|
866
|
-
var index = -1, result = Array(map.size);
|
|
867
|
-
map.forEach(function(value, key) {
|
|
868
|
-
result[++index] = [key, value];
|
|
869
|
-
});
|
|
870
|
-
return result;
|
|
871
|
-
}
|
|
872
|
-
function setToArray(set) {
|
|
873
|
-
var index = -1, result = Array(set.size);
|
|
874
|
-
set.forEach(function(value) {
|
|
875
|
-
result[++index] = value;
|
|
876
|
-
});
|
|
877
|
-
return result;
|
|
878
|
-
}
|
|
879
|
-
var COMPARE_PARTIAL_FLAG$2 = 1, COMPARE_UNORDERED_FLAG = 2;
|
|
880
|
-
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]";
|
|
881
|
-
var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
|
|
882
|
-
var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
|
|
883
|
-
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
884
|
-
switch (tag) {
|
|
885
|
-
case dataViewTag:
|
|
886
|
-
if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
|
|
887
|
-
return false;
|
|
888
|
-
}
|
|
889
|
-
object = object.buffer;
|
|
890
|
-
other = other.buffer;
|
|
891
|
-
case arrayBufferTag:
|
|
892
|
-
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
|
893
|
-
return false;
|
|
894
|
-
}
|
|
895
|
-
return true;
|
|
896
|
-
case boolTag:
|
|
897
|
-
case dateTag:
|
|
898
|
-
case numberTag:
|
|
899
|
-
return eq(+object, +other);
|
|
900
|
-
case errorTag:
|
|
901
|
-
return object.name == other.name && object.message == other.message;
|
|
902
|
-
case regexpTag:
|
|
903
|
-
case stringTag:
|
|
904
|
-
return object == other + "";
|
|
905
|
-
case mapTag:
|
|
906
|
-
var convert = mapToArray;
|
|
907
|
-
case setTag:
|
|
908
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
|
|
909
|
-
convert || (convert = setToArray);
|
|
910
|
-
if (object.size != other.size && !isPartial) {
|
|
911
|
-
return false;
|
|
912
|
-
}
|
|
913
|
-
var stacked = stack.get(object);
|
|
914
|
-
if (stacked) {
|
|
915
|
-
return stacked == other;
|
|
916
|
-
}
|
|
917
|
-
bitmask |= COMPARE_UNORDERED_FLAG;
|
|
918
|
-
stack.set(object, other);
|
|
919
|
-
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
|
920
|
-
stack["delete"](object);
|
|
921
|
-
return result;
|
|
922
|
-
case symbolTag:
|
|
923
|
-
if (symbolValueOf) {
|
|
924
|
-
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
return false;
|
|
928
|
-
}
|
|
929
|
-
var COMPARE_PARTIAL_FLAG$1 = 1;
|
|
930
|
-
var objectProto$1 = Object.prototype;
|
|
931
|
-
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
932
|
-
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
933
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
|
|
934
|
-
if (objLength != othLength && !isPartial) {
|
|
935
|
-
return false;
|
|
936
|
-
}
|
|
937
|
-
var index = objLength;
|
|
938
|
-
while (index--) {
|
|
939
|
-
var key = objProps[index];
|
|
940
|
-
if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
|
|
941
|
-
return false;
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
var objStacked = stack.get(object);
|
|
945
|
-
var othStacked = stack.get(other);
|
|
946
|
-
if (objStacked && othStacked) {
|
|
947
|
-
return objStacked == other && othStacked == object;
|
|
948
|
-
}
|
|
949
|
-
var result = true;
|
|
950
|
-
stack.set(object, other);
|
|
951
|
-
stack.set(other, object);
|
|
952
|
-
var skipCtor = isPartial;
|
|
953
|
-
while (++index < objLength) {
|
|
954
|
-
key = objProps[index];
|
|
955
|
-
var objValue = object[key], othValue = other[key];
|
|
956
|
-
if (customizer) {
|
|
957
|
-
var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
|
|
958
|
-
}
|
|
959
|
-
if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
|
|
960
|
-
result = false;
|
|
961
|
-
break;
|
|
962
|
-
}
|
|
963
|
-
skipCtor || (skipCtor = key == "constructor");
|
|
964
|
-
}
|
|
965
|
-
if (result && !skipCtor) {
|
|
966
|
-
var objCtor = object.constructor, othCtor = other.constructor;
|
|
967
|
-
if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
|
|
968
|
-
result = false;
|
|
969
|
-
}
|
|
970
|
-
}
|
|
971
|
-
stack["delete"](object);
|
|
972
|
-
stack["delete"](other);
|
|
973
|
-
return result;
|
|
974
|
-
}
|
|
975
|
-
var COMPARE_PARTIAL_FLAG = 1;
|
|
976
|
-
var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
|
|
977
|
-
var objectProto = Object.prototype;
|
|
978
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
979
|
-
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
980
|
-
var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
|
|
981
|
-
objTag = objTag == argsTag ? objectTag : objTag;
|
|
982
|
-
othTag = othTag == argsTag ? objectTag : othTag;
|
|
983
|
-
var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
|
|
984
|
-
if (isSameTag && isBuffer(object)) {
|
|
985
|
-
if (!isBuffer(other)) {
|
|
986
|
-
return false;
|
|
987
|
-
}
|
|
988
|
-
objIsArr = true;
|
|
989
|
-
objIsObj = false;
|
|
990
|
-
}
|
|
991
|
-
if (isSameTag && !objIsObj) {
|
|
992
|
-
stack || (stack = new Stack());
|
|
993
|
-
return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
994
|
-
}
|
|
995
|
-
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
996
|
-
var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
|
|
997
|
-
if (objIsWrapped || othIsWrapped) {
|
|
998
|
-
var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
|
|
999
|
-
stack || (stack = new Stack());
|
|
1000
|
-
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
if (!isSameTag) {
|
|
1004
|
-
return false;
|
|
1005
|
-
}
|
|
1006
|
-
stack || (stack = new Stack());
|
|
1007
|
-
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
|
1008
|
-
}
|
|
1009
|
-
function baseIsEqual(value, other, bitmask, customizer, stack) {
|
|
1010
|
-
if (value === other) {
|
|
1011
|
-
return true;
|
|
1012
|
-
}
|
|
1013
|
-
if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
|
|
1014
|
-
return value !== value && other !== other;
|
|
1015
|
-
}
|
|
1016
|
-
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
|
1017
|
-
}
|
|
1018
|
-
function baseHasIn(object, key) {
|
|
1019
|
-
return object != null && key in Object(object);
|
|
1020
|
-
}
|
|
1021
|
-
function hasPath(object, path, hasFunc) {
|
|
1022
|
-
path = castPath(path, object);
|
|
1023
|
-
var index = -1, length = path.length, result = false;
|
|
1024
|
-
while (++index < length) {
|
|
1025
|
-
var key = toKey(path[index]);
|
|
1026
|
-
if (!(result = object != null && hasFunc(object, key))) {
|
|
1027
|
-
break;
|
|
1028
|
-
}
|
|
1029
|
-
object = object[key];
|
|
1030
|
-
}
|
|
1031
|
-
if (result || ++index != length) {
|
|
1032
|
-
return result;
|
|
1033
|
-
}
|
|
1034
|
-
length = object == null ? 0 : object.length;
|
|
1035
|
-
return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
|
|
1036
|
-
}
|
|
1037
|
-
function hasIn(object, path) {
|
|
1038
|
-
return object != null && hasPath(object, path, baseHasIn);
|
|
1039
|
-
}
|
|
1040
651
|
function fromPairs(pairs) {
|
|
1041
652
|
var index = -1, length = pairs == null ? 0 : pairs.length, result = {};
|
|
1042
653
|
while (++index < length) {
|
|
@@ -1045,53 +656,9 @@ function fromPairs(pairs) {
|
|
|
1045
656
|
}
|
|
1046
657
|
return result;
|
|
1047
658
|
}
|
|
1048
|
-
function isEqual(value, other) {
|
|
1049
|
-
return baseIsEqual(value, other);
|
|
1050
|
-
}
|
|
1051
659
|
function isNil(value) {
|
|
1052
660
|
return value == null;
|
|
1053
661
|
}
|
|
1054
|
-
function baseSet(object, path, value, customizer) {
|
|
1055
|
-
if (!isObject(object)) {
|
|
1056
|
-
return object;
|
|
1057
|
-
}
|
|
1058
|
-
path = castPath(path, object);
|
|
1059
|
-
var index = -1, length = path.length, lastIndex = length - 1, nested = object;
|
|
1060
|
-
while (nested != null && ++index < length) {
|
|
1061
|
-
var key = toKey(path[index]), newValue = value;
|
|
1062
|
-
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
1063
|
-
return object;
|
|
1064
|
-
}
|
|
1065
|
-
if (index != lastIndex) {
|
|
1066
|
-
var objValue = nested[key];
|
|
1067
|
-
newValue = void 0;
|
|
1068
|
-
if (newValue === void 0) {
|
|
1069
|
-
newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
assignValue(nested, key, newValue);
|
|
1073
|
-
nested = nested[key];
|
|
1074
|
-
}
|
|
1075
|
-
return object;
|
|
1076
|
-
}
|
|
1077
|
-
function basePickBy(object, paths, predicate) {
|
|
1078
|
-
var index = -1, length = paths.length, result = {};
|
|
1079
|
-
while (++index < length) {
|
|
1080
|
-
var path = paths[index], value = baseGet(object, path);
|
|
1081
|
-
if (predicate(value, path)) {
|
|
1082
|
-
baseSet(result, castPath(path, object), value);
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
return result;
|
|
1086
|
-
}
|
|
1087
|
-
function basePick(object, paths) {
|
|
1088
|
-
return basePickBy(object, paths, function(value, path) {
|
|
1089
|
-
return hasIn(object, path);
|
|
1090
|
-
});
|
|
1091
|
-
}
|
|
1092
|
-
var pick = flatRest(function(object, paths) {
|
|
1093
|
-
return object == null ? {} : basePick(object, paths);
|
|
1094
|
-
});
|
|
1095
662
|
const isUndefined = (val) => val === void 0;
|
|
1096
663
|
const isBoolean = (val) => typeof val === "boolean";
|
|
1097
664
|
const isNumber = (val) => typeof val === "number";
|
|
@@ -1561,15 +1128,13 @@ const provideGlobalConfig = (config, app, global2 = false) => {
|
|
|
1561
1128
|
return context;
|
|
1562
1129
|
};
|
|
1563
1130
|
const mergeConfig = (a, b) => {
|
|
1564
|
-
const
|
|
1131
|
+
const keys = [.../* @__PURE__ */ new Set([...keysOf(a), ...keysOf(b)])];
|
|
1565
1132
|
const obj = {};
|
|
1566
|
-
for (const key of
|
|
1133
|
+
for (const key of keys) {
|
|
1567
1134
|
obj[key] = b[key] !== void 0 ? b[key] : a[key];
|
|
1568
1135
|
}
|
|
1569
1136
|
return obj;
|
|
1570
1137
|
};
|
|
1571
|
-
const UPDATE_MODEL_EVENT = "update:modelValue";
|
|
1572
|
-
const CHANGE_EVENT = "change";
|
|
1573
1138
|
var _export_sfc = (sfc, props) => {
|
|
1574
1139
|
const target = sfc.__vccOpts || sfc;
|
|
1575
1140
|
for (const [key, val] of props) {
|
|
@@ -1586,8 +1151,6 @@ function addUnit(value, defaultUnit = "px") {
|
|
|
1586
1151
|
return value;
|
|
1587
1152
|
}
|
|
1588
1153
|
}
|
|
1589
|
-
function debugWarn(scope, message) {
|
|
1590
|
-
}
|
|
1591
1154
|
const withInstall = (main, extra) => {
|
|
1592
1155
|
main.install = (app) => {
|
|
1593
1156
|
for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
|
|
@@ -1620,12 +1183,12 @@ const iconProps = buildProps({
|
|
|
1620
1183
|
type: String
|
|
1621
1184
|
}
|
|
1622
1185
|
});
|
|
1623
|
-
const __default__
|
|
1186
|
+
const __default__ = defineComponent({
|
|
1624
1187
|
name: "ElIcon",
|
|
1625
1188
|
inheritAttrs: false
|
|
1626
1189
|
});
|
|
1627
|
-
const _sfc_main
|
|
1628
|
-
...__default__
|
|
1190
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1191
|
+
...__default__,
|
|
1629
1192
|
props: iconProps,
|
|
1630
1193
|
setup(__props) {
|
|
1631
1194
|
const props = __props;
|
|
@@ -1649,7 +1212,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
1649
1212
|
};
|
|
1650
1213
|
}
|
|
1651
1214
|
});
|
|
1652
|
-
var Icon = /* @__PURE__ */ _export_sfc(_sfc_main
|
|
1215
|
+
var Icon = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "icon.vue"]]);
|
|
1653
1216
|
const ElIcon = withInstall(Icon);
|
|
1654
1217
|
/*! Element Plus Icons Vue v2.3.2 */
|
|
1655
1218
|
var _sfc_main50 = /* @__PURE__ */ defineComponent({
|
|
@@ -1757,1876 +1320,6 @@ const TypeComponentsMap = {
|
|
|
1757
1320
|
error: circle_close_filled_default,
|
|
1758
1321
|
info: info_filled_default
|
|
1759
1322
|
};
|
|
1760
|
-
const ariaProps = buildProps({
|
|
1761
|
-
ariaLabel: String,
|
|
1762
|
-
ariaOrientation: {
|
|
1763
|
-
type: String,
|
|
1764
|
-
values: ["horizontal", "vertical", "undefined"]
|
|
1765
|
-
},
|
|
1766
|
-
ariaControls: String
|
|
1767
|
-
});
|
|
1768
|
-
const useAriaProps = (arias) => {
|
|
1769
|
-
return pick(ariaProps, arias);
|
|
1770
|
-
};
|
|
1771
|
-
const defaultIdInjection = {
|
|
1772
|
-
prefix: Math.floor(Math.random() * 1e4),
|
|
1773
|
-
current: 0
|
|
1774
|
-
};
|
|
1775
|
-
const ID_INJECTION_KEY = Symbol("elIdInjection");
|
|
1776
|
-
const useIdInjection = () => {
|
|
1777
|
-
return getCurrentInstance() ? inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
|
|
1778
|
-
};
|
|
1779
|
-
const useId = (deterministicId) => {
|
|
1780
|
-
const idInjection = useIdInjection();
|
|
1781
|
-
const namespace = useGetDerivedNamespace();
|
|
1782
|
-
const idRef = computedEager(() => unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
|
|
1783
|
-
return idRef;
|
|
1784
|
-
};
|
|
1785
|
-
const formContextKey = Symbol("formContextKey");
|
|
1786
|
-
const formItemContextKey = Symbol("formItemContextKey");
|
|
1787
|
-
const useFormItem = () => {
|
|
1788
|
-
const form = inject(formContextKey, void 0);
|
|
1789
|
-
const formItem = inject(formItemContextKey, void 0);
|
|
1790
|
-
return {
|
|
1791
|
-
form,
|
|
1792
|
-
formItem
|
|
1793
|
-
};
|
|
1794
|
-
};
|
|
1795
|
-
const useFormItemInputId = (props, {
|
|
1796
|
-
formItemContext,
|
|
1797
|
-
disableIdGeneration,
|
|
1798
|
-
disableIdManagement
|
|
1799
|
-
}) => {
|
|
1800
|
-
if (!disableIdGeneration) {
|
|
1801
|
-
disableIdGeneration = ref(false);
|
|
1802
|
-
}
|
|
1803
|
-
if (!disableIdManagement) {
|
|
1804
|
-
disableIdManagement = ref(false);
|
|
1805
|
-
}
|
|
1806
|
-
const instance = getCurrentInstance();
|
|
1807
|
-
const inLabel = () => {
|
|
1808
|
-
let parent = instance == null ? void 0 : instance.parent;
|
|
1809
|
-
while (parent) {
|
|
1810
|
-
if (parent.type.name === "ElFormItem") {
|
|
1811
|
-
return false;
|
|
1812
|
-
}
|
|
1813
|
-
if (parent.type.name === "ElLabelWrap") {
|
|
1814
|
-
return true;
|
|
1815
|
-
}
|
|
1816
|
-
parent = parent.parent;
|
|
1817
|
-
}
|
|
1818
|
-
return false;
|
|
1819
|
-
};
|
|
1820
|
-
const inputId = ref();
|
|
1821
|
-
let idUnwatch = void 0;
|
|
1822
|
-
const isLabeledByFormItem = computed(() => {
|
|
1823
|
-
var _a2;
|
|
1824
|
-
return !!(!(props.label || props.ariaLabel) && formItemContext && formItemContext.inputIds && ((_a2 = formItemContext.inputIds) == null ? void 0 : _a2.length) <= 1);
|
|
1825
|
-
});
|
|
1826
|
-
onMounted(() => {
|
|
1827
|
-
idUnwatch = watch([toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
|
|
1828
|
-
const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
|
|
1829
|
-
if (newId !== inputId.value) {
|
|
1830
|
-
if ((formItemContext == null ? void 0 : formItemContext.removeInputId) && !inLabel()) {
|
|
1831
|
-
inputId.value && formItemContext.removeInputId(inputId.value);
|
|
1832
|
-
if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
|
|
1833
|
-
formItemContext.addInputId(newId);
|
|
1834
|
-
}
|
|
1835
|
-
}
|
|
1836
|
-
inputId.value = newId;
|
|
1837
|
-
}
|
|
1838
|
-
}, { immediate: true });
|
|
1839
|
-
});
|
|
1840
|
-
onUnmounted(() => {
|
|
1841
|
-
idUnwatch && idUnwatch();
|
|
1842
|
-
if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
|
|
1843
|
-
inputId.value && formItemContext.removeInputId(inputId.value);
|
|
1844
|
-
}
|
|
1845
|
-
});
|
|
1846
|
-
return {
|
|
1847
|
-
isLabeledByFormItem,
|
|
1848
|
-
inputId
|
|
1849
|
-
};
|
|
1850
|
-
};
|
|
1851
|
-
const useProp = (name) => {
|
|
1852
|
-
const vm = getCurrentInstance();
|
|
1853
|
-
return computed(() => {
|
|
1854
|
-
var _a2, _b;
|
|
1855
|
-
return (_b = (_a2 = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a2.$props) == null ? void 0 : _b[name];
|
|
1856
|
-
});
|
|
1857
|
-
};
|
|
1858
|
-
const useFormSize = (fallback, ignore = {}) => {
|
|
1859
|
-
const emptyRef = ref(void 0);
|
|
1860
|
-
const size = ignore.prop ? emptyRef : useProp("size");
|
|
1861
|
-
const globalConfig2 = ignore.global ? emptyRef : useGlobalSize();
|
|
1862
|
-
const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
|
|
1863
|
-
const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
|
|
1864
|
-
return computed(() => size.value || unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig2.value || "");
|
|
1865
|
-
};
|
|
1866
|
-
const useFormDisabled = (fallback) => {
|
|
1867
|
-
const disabled = useProp("disabled");
|
|
1868
|
-
const form = inject(formContextKey, void 0);
|
|
1869
|
-
return computed(() => disabled.value || unref(fallback) || (form == null ? void 0 : form.disabled) || false);
|
|
1870
|
-
};
|
|
1871
|
-
const buttonGroupContextKey = Symbol("buttonGroupContextKey");
|
|
1872
|
-
const useDeprecated = ({ from, replacement, scope, version, ref: ref2, type = "API" }, condition) => {
|
|
1873
|
-
watch(() => unref(condition), (val) => {
|
|
1874
|
-
}, {
|
|
1875
|
-
immediate: true
|
|
1876
|
-
});
|
|
1877
|
-
};
|
|
1878
|
-
const useButton = (props, emit) => {
|
|
1879
|
-
useDeprecated({
|
|
1880
|
-
from: "type.text",
|
|
1881
|
-
replacement: "link",
|
|
1882
|
-
version: "3.0.0",
|
|
1883
|
-
scope: "props",
|
|
1884
|
-
ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
|
|
1885
|
-
}, computed(() => props.type === "text"));
|
|
1886
|
-
const buttonGroupContext = inject(buttonGroupContextKey, void 0);
|
|
1887
|
-
const globalConfig2 = useGlobalConfig("button");
|
|
1888
|
-
const { form } = useFormItem();
|
|
1889
|
-
const _size = useFormSize(computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
|
|
1890
|
-
const _disabled = useFormDisabled();
|
|
1891
|
-
const _ref = ref();
|
|
1892
|
-
const slots = useSlots();
|
|
1893
|
-
const _type = computed(() => {
|
|
1894
|
-
var _a2;
|
|
1895
|
-
return props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || ((_a2 = globalConfig2.value) == null ? void 0 : _a2.type) || "";
|
|
1896
|
-
});
|
|
1897
|
-
const autoInsertSpace = computed(() => {
|
|
1898
|
-
var _a2, _b, _c;
|
|
1899
|
-
return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a2 = globalConfig2.value) == null ? void 0 : _a2.autoInsertSpace) != null ? _c : false;
|
|
1900
|
-
});
|
|
1901
|
-
const _plain = computed(() => {
|
|
1902
|
-
var _a2, _b, _c;
|
|
1903
|
-
return (_c = (_b = props.plain) != null ? _b : (_a2 = globalConfig2.value) == null ? void 0 : _a2.plain) != null ? _c : false;
|
|
1904
|
-
});
|
|
1905
|
-
const _round = computed(() => {
|
|
1906
|
-
var _a2, _b, _c;
|
|
1907
|
-
return (_c = (_b = props.round) != null ? _b : (_a2 = globalConfig2.value) == null ? void 0 : _a2.round) != null ? _c : false;
|
|
1908
|
-
});
|
|
1909
|
-
const _props = computed(() => {
|
|
1910
|
-
if (props.tag === "button") {
|
|
1911
|
-
return {
|
|
1912
|
-
ariaDisabled: _disabled.value || props.loading,
|
|
1913
|
-
disabled: _disabled.value || props.loading,
|
|
1914
|
-
autofocus: props.autofocus,
|
|
1915
|
-
type: props.nativeType
|
|
1916
|
-
};
|
|
1917
|
-
}
|
|
1918
|
-
return {};
|
|
1919
|
-
});
|
|
1920
|
-
const shouldAddSpace = computed(() => {
|
|
1921
|
-
var _a2;
|
|
1922
|
-
const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
|
|
1923
|
-
if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
|
|
1924
|
-
const slot = defaultSlot[0];
|
|
1925
|
-
if ((slot == null ? void 0 : slot.type) === Text) {
|
|
1926
|
-
const text = slot.children;
|
|
1927
|
-
return new RegExp("^\\p{Unified_Ideograph}{2}$", "u").test(text.trim());
|
|
1928
|
-
}
|
|
1929
|
-
}
|
|
1930
|
-
return false;
|
|
1931
|
-
});
|
|
1932
|
-
const handleClick = (evt) => {
|
|
1933
|
-
if (_disabled.value || props.loading) {
|
|
1934
|
-
evt.stopPropagation();
|
|
1935
|
-
return;
|
|
1936
|
-
}
|
|
1937
|
-
if (props.nativeType === "reset") {
|
|
1938
|
-
form == null ? void 0 : form.resetFields();
|
|
1939
|
-
}
|
|
1940
|
-
emit("click", evt);
|
|
1941
|
-
};
|
|
1942
|
-
return {
|
|
1943
|
-
_disabled,
|
|
1944
|
-
_size,
|
|
1945
|
-
_type,
|
|
1946
|
-
_ref,
|
|
1947
|
-
_props,
|
|
1948
|
-
_plain,
|
|
1949
|
-
_round,
|
|
1950
|
-
shouldAddSpace,
|
|
1951
|
-
handleClick
|
|
1952
|
-
};
|
|
1953
|
-
};
|
|
1954
|
-
const buttonTypes = [
|
|
1955
|
-
"default",
|
|
1956
|
-
"primary",
|
|
1957
|
-
"success",
|
|
1958
|
-
"warning",
|
|
1959
|
-
"info",
|
|
1960
|
-
"danger",
|
|
1961
|
-
"text",
|
|
1962
|
-
""
|
|
1963
|
-
];
|
|
1964
|
-
const buttonNativeTypes = ["button", "submit", "reset"];
|
|
1965
|
-
const buttonProps = buildProps({
|
|
1966
|
-
size: useSizeProp,
|
|
1967
|
-
disabled: Boolean,
|
|
1968
|
-
type: {
|
|
1969
|
-
type: String,
|
|
1970
|
-
values: buttonTypes,
|
|
1971
|
-
default: ""
|
|
1972
|
-
},
|
|
1973
|
-
icon: {
|
|
1974
|
-
type: iconPropType
|
|
1975
|
-
},
|
|
1976
|
-
nativeType: {
|
|
1977
|
-
type: String,
|
|
1978
|
-
values: buttonNativeTypes,
|
|
1979
|
-
default: "button"
|
|
1980
|
-
},
|
|
1981
|
-
loading: Boolean,
|
|
1982
|
-
loadingIcon: {
|
|
1983
|
-
type: iconPropType,
|
|
1984
|
-
default: () => loading_default
|
|
1985
|
-
},
|
|
1986
|
-
plain: {
|
|
1987
|
-
type: Boolean,
|
|
1988
|
-
default: void 0
|
|
1989
|
-
},
|
|
1990
|
-
text: Boolean,
|
|
1991
|
-
link: Boolean,
|
|
1992
|
-
bg: Boolean,
|
|
1993
|
-
autofocus: Boolean,
|
|
1994
|
-
round: {
|
|
1995
|
-
type: Boolean,
|
|
1996
|
-
default: void 0
|
|
1997
|
-
},
|
|
1998
|
-
circle: Boolean,
|
|
1999
|
-
color: String,
|
|
2000
|
-
dark: Boolean,
|
|
2001
|
-
autoInsertSpace: {
|
|
2002
|
-
type: Boolean,
|
|
2003
|
-
default: void 0
|
|
2004
|
-
},
|
|
2005
|
-
tag: {
|
|
2006
|
-
type: definePropType([String, Object]),
|
|
2007
|
-
default: "button"
|
|
2008
|
-
}
|
|
2009
|
-
});
|
|
2010
|
-
const buttonEmits = {
|
|
2011
|
-
click: (evt) => evt instanceof MouseEvent
|
|
2012
|
-
};
|
|
2013
|
-
function bound01(n, max) {
|
|
2014
|
-
if (isOnePointZero(n)) {
|
|
2015
|
-
n = "100%";
|
|
2016
|
-
}
|
|
2017
|
-
var isPercent = isPercentage(n);
|
|
2018
|
-
n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
|
|
2019
|
-
if (isPercent) {
|
|
2020
|
-
n = parseInt(String(n * max), 10) / 100;
|
|
2021
|
-
}
|
|
2022
|
-
if (Math.abs(n - max) < 1e-6) {
|
|
2023
|
-
return 1;
|
|
2024
|
-
}
|
|
2025
|
-
if (max === 360) {
|
|
2026
|
-
n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
|
|
2027
|
-
} else {
|
|
2028
|
-
n = n % max / parseFloat(String(max));
|
|
2029
|
-
}
|
|
2030
|
-
return n;
|
|
2031
|
-
}
|
|
2032
|
-
function clamp01(val) {
|
|
2033
|
-
return Math.min(1, Math.max(0, val));
|
|
2034
|
-
}
|
|
2035
|
-
function isOnePointZero(n) {
|
|
2036
|
-
return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
|
|
2037
|
-
}
|
|
2038
|
-
function isPercentage(n) {
|
|
2039
|
-
return typeof n === "string" && n.indexOf("%") !== -1;
|
|
2040
|
-
}
|
|
2041
|
-
function boundAlpha(a) {
|
|
2042
|
-
a = parseFloat(a);
|
|
2043
|
-
if (isNaN(a) || a < 0 || a > 1) {
|
|
2044
|
-
a = 1;
|
|
2045
|
-
}
|
|
2046
|
-
return a;
|
|
2047
|
-
}
|
|
2048
|
-
function convertToPercentage(n) {
|
|
2049
|
-
if (n <= 1) {
|
|
2050
|
-
return "".concat(Number(n) * 100, "%");
|
|
2051
|
-
}
|
|
2052
|
-
return n;
|
|
2053
|
-
}
|
|
2054
|
-
function pad2(c) {
|
|
2055
|
-
return c.length === 1 ? "0" + c : String(c);
|
|
2056
|
-
}
|
|
2057
|
-
function rgbToRgb(r, g, b) {
|
|
2058
|
-
return {
|
|
2059
|
-
r: bound01(r, 255) * 255,
|
|
2060
|
-
g: bound01(g, 255) * 255,
|
|
2061
|
-
b: bound01(b, 255) * 255
|
|
2062
|
-
};
|
|
2063
|
-
}
|
|
2064
|
-
function rgbToHsl(r, g, b) {
|
|
2065
|
-
r = bound01(r, 255);
|
|
2066
|
-
g = bound01(g, 255);
|
|
2067
|
-
b = bound01(b, 255);
|
|
2068
|
-
var max = Math.max(r, g, b);
|
|
2069
|
-
var min = Math.min(r, g, b);
|
|
2070
|
-
var h = 0;
|
|
2071
|
-
var s = 0;
|
|
2072
|
-
var l = (max + min) / 2;
|
|
2073
|
-
if (max === min) {
|
|
2074
|
-
s = 0;
|
|
2075
|
-
h = 0;
|
|
2076
|
-
} else {
|
|
2077
|
-
var d = max - min;
|
|
2078
|
-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
2079
|
-
switch (max) {
|
|
2080
|
-
case r:
|
|
2081
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
2082
|
-
break;
|
|
2083
|
-
case g:
|
|
2084
|
-
h = (b - r) / d + 2;
|
|
2085
|
-
break;
|
|
2086
|
-
case b:
|
|
2087
|
-
h = (r - g) / d + 4;
|
|
2088
|
-
break;
|
|
2089
|
-
}
|
|
2090
|
-
h /= 6;
|
|
2091
|
-
}
|
|
2092
|
-
return { h, s, l };
|
|
2093
|
-
}
|
|
2094
|
-
function hue2rgb(p, q, t) {
|
|
2095
|
-
if (t < 0) {
|
|
2096
|
-
t += 1;
|
|
2097
|
-
}
|
|
2098
|
-
if (t > 1) {
|
|
2099
|
-
t -= 1;
|
|
2100
|
-
}
|
|
2101
|
-
if (t < 1 / 6) {
|
|
2102
|
-
return p + (q - p) * (6 * t);
|
|
2103
|
-
}
|
|
2104
|
-
if (t < 1 / 2) {
|
|
2105
|
-
return q;
|
|
2106
|
-
}
|
|
2107
|
-
if (t < 2 / 3) {
|
|
2108
|
-
return p + (q - p) * (2 / 3 - t) * 6;
|
|
2109
|
-
}
|
|
2110
|
-
return p;
|
|
2111
|
-
}
|
|
2112
|
-
function hslToRgb(h, s, l) {
|
|
2113
|
-
var r;
|
|
2114
|
-
var g;
|
|
2115
|
-
var b;
|
|
2116
|
-
h = bound01(h, 360);
|
|
2117
|
-
s = bound01(s, 100);
|
|
2118
|
-
l = bound01(l, 100);
|
|
2119
|
-
if (s === 0) {
|
|
2120
|
-
g = l;
|
|
2121
|
-
b = l;
|
|
2122
|
-
r = l;
|
|
2123
|
-
} else {
|
|
2124
|
-
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
2125
|
-
var p = 2 * l - q;
|
|
2126
|
-
r = hue2rgb(p, q, h + 1 / 3);
|
|
2127
|
-
g = hue2rgb(p, q, h);
|
|
2128
|
-
b = hue2rgb(p, q, h - 1 / 3);
|
|
2129
|
-
}
|
|
2130
|
-
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
2131
|
-
}
|
|
2132
|
-
function rgbToHsv(r, g, b) {
|
|
2133
|
-
r = bound01(r, 255);
|
|
2134
|
-
g = bound01(g, 255);
|
|
2135
|
-
b = bound01(b, 255);
|
|
2136
|
-
var max = Math.max(r, g, b);
|
|
2137
|
-
var min = Math.min(r, g, b);
|
|
2138
|
-
var h = 0;
|
|
2139
|
-
var v = max;
|
|
2140
|
-
var d = max - min;
|
|
2141
|
-
var s = max === 0 ? 0 : d / max;
|
|
2142
|
-
if (max === min) {
|
|
2143
|
-
h = 0;
|
|
2144
|
-
} else {
|
|
2145
|
-
switch (max) {
|
|
2146
|
-
case r:
|
|
2147
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
2148
|
-
break;
|
|
2149
|
-
case g:
|
|
2150
|
-
h = (b - r) / d + 2;
|
|
2151
|
-
break;
|
|
2152
|
-
case b:
|
|
2153
|
-
h = (r - g) / d + 4;
|
|
2154
|
-
break;
|
|
2155
|
-
}
|
|
2156
|
-
h /= 6;
|
|
2157
|
-
}
|
|
2158
|
-
return { h, s, v };
|
|
2159
|
-
}
|
|
2160
|
-
function hsvToRgb(h, s, v) {
|
|
2161
|
-
h = bound01(h, 360) * 6;
|
|
2162
|
-
s = bound01(s, 100);
|
|
2163
|
-
v = bound01(v, 100);
|
|
2164
|
-
var i = Math.floor(h);
|
|
2165
|
-
var f = h - i;
|
|
2166
|
-
var p = v * (1 - s);
|
|
2167
|
-
var q = v * (1 - f * s);
|
|
2168
|
-
var t = v * (1 - (1 - f) * s);
|
|
2169
|
-
var mod = i % 6;
|
|
2170
|
-
var r = [v, q, p, p, t, v][mod];
|
|
2171
|
-
var g = [t, v, v, q, p, p][mod];
|
|
2172
|
-
var b = [p, p, t, v, v, q][mod];
|
|
2173
|
-
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
2174
|
-
}
|
|
2175
|
-
function rgbToHex(r, g, b, allow3Char) {
|
|
2176
|
-
var hex = [
|
|
2177
|
-
pad2(Math.round(r).toString(16)),
|
|
2178
|
-
pad2(Math.round(g).toString(16)),
|
|
2179
|
-
pad2(Math.round(b).toString(16))
|
|
2180
|
-
];
|
|
2181
|
-
if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
|
|
2182
|
-
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
2183
|
-
}
|
|
2184
|
-
return hex.join("");
|
|
2185
|
-
}
|
|
2186
|
-
function rgbaToHex(r, g, b, a, allow4Char) {
|
|
2187
|
-
var hex = [
|
|
2188
|
-
pad2(Math.round(r).toString(16)),
|
|
2189
|
-
pad2(Math.round(g).toString(16)),
|
|
2190
|
-
pad2(Math.round(b).toString(16)),
|
|
2191
|
-
pad2(convertDecimalToHex(a))
|
|
2192
|
-
];
|
|
2193
|
-
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))) {
|
|
2194
|
-
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
|
|
2195
|
-
}
|
|
2196
|
-
return hex.join("");
|
|
2197
|
-
}
|
|
2198
|
-
function convertDecimalToHex(d) {
|
|
2199
|
-
return Math.round(parseFloat(d) * 255).toString(16);
|
|
2200
|
-
}
|
|
2201
|
-
function convertHexToDecimal(h) {
|
|
2202
|
-
return parseIntFromHex(h) / 255;
|
|
2203
|
-
}
|
|
2204
|
-
function parseIntFromHex(val) {
|
|
2205
|
-
return parseInt(val, 16);
|
|
2206
|
-
}
|
|
2207
|
-
function numberInputToObject(color) {
|
|
2208
|
-
return {
|
|
2209
|
-
r: color >> 16,
|
|
2210
|
-
g: (color & 65280) >> 8,
|
|
2211
|
-
b: color & 255
|
|
2212
|
-
};
|
|
2213
|
-
}
|
|
2214
|
-
var names = {
|
|
2215
|
-
aliceblue: "#f0f8ff",
|
|
2216
|
-
antiquewhite: "#faebd7",
|
|
2217
|
-
aqua: "#00ffff",
|
|
2218
|
-
aquamarine: "#7fffd4",
|
|
2219
|
-
azure: "#f0ffff",
|
|
2220
|
-
beige: "#f5f5dc",
|
|
2221
|
-
bisque: "#ffe4c4",
|
|
2222
|
-
black: "#000000",
|
|
2223
|
-
blanchedalmond: "#ffebcd",
|
|
2224
|
-
blue: "#0000ff",
|
|
2225
|
-
blueviolet: "#8a2be2",
|
|
2226
|
-
brown: "#a52a2a",
|
|
2227
|
-
burlywood: "#deb887",
|
|
2228
|
-
cadetblue: "#5f9ea0",
|
|
2229
|
-
chartreuse: "#7fff00",
|
|
2230
|
-
chocolate: "#d2691e",
|
|
2231
|
-
coral: "#ff7f50",
|
|
2232
|
-
cornflowerblue: "#6495ed",
|
|
2233
|
-
cornsilk: "#fff8dc",
|
|
2234
|
-
crimson: "#dc143c",
|
|
2235
|
-
cyan: "#00ffff",
|
|
2236
|
-
darkblue: "#00008b",
|
|
2237
|
-
darkcyan: "#008b8b",
|
|
2238
|
-
darkgoldenrod: "#b8860b",
|
|
2239
|
-
darkgray: "#a9a9a9",
|
|
2240
|
-
darkgreen: "#006400",
|
|
2241
|
-
darkgrey: "#a9a9a9",
|
|
2242
|
-
darkkhaki: "#bdb76b",
|
|
2243
|
-
darkmagenta: "#8b008b",
|
|
2244
|
-
darkolivegreen: "#556b2f",
|
|
2245
|
-
darkorange: "#ff8c00",
|
|
2246
|
-
darkorchid: "#9932cc",
|
|
2247
|
-
darkred: "#8b0000",
|
|
2248
|
-
darksalmon: "#e9967a",
|
|
2249
|
-
darkseagreen: "#8fbc8f",
|
|
2250
|
-
darkslateblue: "#483d8b",
|
|
2251
|
-
darkslategray: "#2f4f4f",
|
|
2252
|
-
darkslategrey: "#2f4f4f",
|
|
2253
|
-
darkturquoise: "#00ced1",
|
|
2254
|
-
darkviolet: "#9400d3",
|
|
2255
|
-
deeppink: "#ff1493",
|
|
2256
|
-
deepskyblue: "#00bfff",
|
|
2257
|
-
dimgray: "#696969",
|
|
2258
|
-
dimgrey: "#696969",
|
|
2259
|
-
dodgerblue: "#1e90ff",
|
|
2260
|
-
firebrick: "#b22222",
|
|
2261
|
-
floralwhite: "#fffaf0",
|
|
2262
|
-
forestgreen: "#228b22",
|
|
2263
|
-
fuchsia: "#ff00ff",
|
|
2264
|
-
gainsboro: "#dcdcdc",
|
|
2265
|
-
ghostwhite: "#f8f8ff",
|
|
2266
|
-
goldenrod: "#daa520",
|
|
2267
|
-
gold: "#ffd700",
|
|
2268
|
-
gray: "#808080",
|
|
2269
|
-
green: "#008000",
|
|
2270
|
-
greenyellow: "#adff2f",
|
|
2271
|
-
grey: "#808080",
|
|
2272
|
-
honeydew: "#f0fff0",
|
|
2273
|
-
hotpink: "#ff69b4",
|
|
2274
|
-
indianred: "#cd5c5c",
|
|
2275
|
-
indigo: "#4b0082",
|
|
2276
|
-
ivory: "#fffff0",
|
|
2277
|
-
khaki: "#f0e68c",
|
|
2278
|
-
lavenderblush: "#fff0f5",
|
|
2279
|
-
lavender: "#e6e6fa",
|
|
2280
|
-
lawngreen: "#7cfc00",
|
|
2281
|
-
lemonchiffon: "#fffacd",
|
|
2282
|
-
lightblue: "#add8e6",
|
|
2283
|
-
lightcoral: "#f08080",
|
|
2284
|
-
lightcyan: "#e0ffff",
|
|
2285
|
-
lightgoldenrodyellow: "#fafad2",
|
|
2286
|
-
lightgray: "#d3d3d3",
|
|
2287
|
-
lightgreen: "#90ee90",
|
|
2288
|
-
lightgrey: "#d3d3d3",
|
|
2289
|
-
lightpink: "#ffb6c1",
|
|
2290
|
-
lightsalmon: "#ffa07a",
|
|
2291
|
-
lightseagreen: "#20b2aa",
|
|
2292
|
-
lightskyblue: "#87cefa",
|
|
2293
|
-
lightslategray: "#778899",
|
|
2294
|
-
lightslategrey: "#778899",
|
|
2295
|
-
lightsteelblue: "#b0c4de",
|
|
2296
|
-
lightyellow: "#ffffe0",
|
|
2297
|
-
lime: "#00ff00",
|
|
2298
|
-
limegreen: "#32cd32",
|
|
2299
|
-
linen: "#faf0e6",
|
|
2300
|
-
magenta: "#ff00ff",
|
|
2301
|
-
maroon: "#800000",
|
|
2302
|
-
mediumaquamarine: "#66cdaa",
|
|
2303
|
-
mediumblue: "#0000cd",
|
|
2304
|
-
mediumorchid: "#ba55d3",
|
|
2305
|
-
mediumpurple: "#9370db",
|
|
2306
|
-
mediumseagreen: "#3cb371",
|
|
2307
|
-
mediumslateblue: "#7b68ee",
|
|
2308
|
-
mediumspringgreen: "#00fa9a",
|
|
2309
|
-
mediumturquoise: "#48d1cc",
|
|
2310
|
-
mediumvioletred: "#c71585",
|
|
2311
|
-
midnightblue: "#191970",
|
|
2312
|
-
mintcream: "#f5fffa",
|
|
2313
|
-
mistyrose: "#ffe4e1",
|
|
2314
|
-
moccasin: "#ffe4b5",
|
|
2315
|
-
navajowhite: "#ffdead",
|
|
2316
|
-
navy: "#000080",
|
|
2317
|
-
oldlace: "#fdf5e6",
|
|
2318
|
-
olive: "#808000",
|
|
2319
|
-
olivedrab: "#6b8e23",
|
|
2320
|
-
orange: "#ffa500",
|
|
2321
|
-
orangered: "#ff4500",
|
|
2322
|
-
orchid: "#da70d6",
|
|
2323
|
-
palegoldenrod: "#eee8aa",
|
|
2324
|
-
palegreen: "#98fb98",
|
|
2325
|
-
paleturquoise: "#afeeee",
|
|
2326
|
-
palevioletred: "#db7093",
|
|
2327
|
-
papayawhip: "#ffefd5",
|
|
2328
|
-
peachpuff: "#ffdab9",
|
|
2329
|
-
peru: "#cd853f",
|
|
2330
|
-
pink: "#ffc0cb",
|
|
2331
|
-
plum: "#dda0dd",
|
|
2332
|
-
powderblue: "#b0e0e6",
|
|
2333
|
-
purple: "#800080",
|
|
2334
|
-
rebeccapurple: "#663399",
|
|
2335
|
-
red: "#ff0000",
|
|
2336
|
-
rosybrown: "#bc8f8f",
|
|
2337
|
-
royalblue: "#4169e1",
|
|
2338
|
-
saddlebrown: "#8b4513",
|
|
2339
|
-
salmon: "#fa8072",
|
|
2340
|
-
sandybrown: "#f4a460",
|
|
2341
|
-
seagreen: "#2e8b57",
|
|
2342
|
-
seashell: "#fff5ee",
|
|
2343
|
-
sienna: "#a0522d",
|
|
2344
|
-
silver: "#c0c0c0",
|
|
2345
|
-
skyblue: "#87ceeb",
|
|
2346
|
-
slateblue: "#6a5acd",
|
|
2347
|
-
slategray: "#708090",
|
|
2348
|
-
slategrey: "#708090",
|
|
2349
|
-
snow: "#fffafa",
|
|
2350
|
-
springgreen: "#00ff7f",
|
|
2351
|
-
steelblue: "#4682b4",
|
|
2352
|
-
tan: "#d2b48c",
|
|
2353
|
-
teal: "#008080",
|
|
2354
|
-
thistle: "#d8bfd8",
|
|
2355
|
-
tomato: "#ff6347",
|
|
2356
|
-
turquoise: "#40e0d0",
|
|
2357
|
-
violet: "#ee82ee",
|
|
2358
|
-
wheat: "#f5deb3",
|
|
2359
|
-
white: "#ffffff",
|
|
2360
|
-
whitesmoke: "#f5f5f5",
|
|
2361
|
-
yellow: "#ffff00",
|
|
2362
|
-
yellowgreen: "#9acd32"
|
|
2363
|
-
};
|
|
2364
|
-
function inputToRGB(color) {
|
|
2365
|
-
var rgb = { r: 0, g: 0, b: 0 };
|
|
2366
|
-
var a = 1;
|
|
2367
|
-
var s = null;
|
|
2368
|
-
var v = null;
|
|
2369
|
-
var l = null;
|
|
2370
|
-
var ok = false;
|
|
2371
|
-
var format = false;
|
|
2372
|
-
if (typeof color === "string") {
|
|
2373
|
-
color = stringInputToObject(color);
|
|
2374
|
-
}
|
|
2375
|
-
if (typeof color === "object") {
|
|
2376
|
-
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
2377
|
-
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
2378
|
-
ok = true;
|
|
2379
|
-
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
|
2380
|
-
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
2381
|
-
s = convertToPercentage(color.s);
|
|
2382
|
-
v = convertToPercentage(color.v);
|
|
2383
|
-
rgb = hsvToRgb(color.h, s, v);
|
|
2384
|
-
ok = true;
|
|
2385
|
-
format = "hsv";
|
|
2386
|
-
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
2387
|
-
s = convertToPercentage(color.s);
|
|
2388
|
-
l = convertToPercentage(color.l);
|
|
2389
|
-
rgb = hslToRgb(color.h, s, l);
|
|
2390
|
-
ok = true;
|
|
2391
|
-
format = "hsl";
|
|
2392
|
-
}
|
|
2393
|
-
if (Object.prototype.hasOwnProperty.call(color, "a")) {
|
|
2394
|
-
a = color.a;
|
|
2395
|
-
}
|
|
2396
|
-
}
|
|
2397
|
-
a = boundAlpha(a);
|
|
2398
|
-
return {
|
|
2399
|
-
ok,
|
|
2400
|
-
format: color.format || format,
|
|
2401
|
-
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
2402
|
-
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
2403
|
-
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
2404
|
-
a
|
|
2405
|
-
};
|
|
2406
|
-
}
|
|
2407
|
-
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
|
2408
|
-
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
|
|
2409
|
-
var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
|
|
2410
|
-
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
|
|
2411
|
-
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
|
|
2412
|
-
var matchers = {
|
|
2413
|
-
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
2414
|
-
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
|
2415
|
-
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
|
|
2416
|
-
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
|
|
2417
|
-
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
|
|
2418
|
-
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
|
|
2419
|
-
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
|
|
2420
|
-
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
2421
|
-
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
2422
|
-
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
2423
|
-
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
2424
|
-
};
|
|
2425
|
-
function stringInputToObject(color) {
|
|
2426
|
-
color = color.trim().toLowerCase();
|
|
2427
|
-
if (color.length === 0) {
|
|
2428
|
-
return false;
|
|
2429
|
-
}
|
|
2430
|
-
var named = false;
|
|
2431
|
-
if (names[color]) {
|
|
2432
|
-
color = names[color];
|
|
2433
|
-
named = true;
|
|
2434
|
-
} else if (color === "transparent") {
|
|
2435
|
-
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
|
|
2436
|
-
}
|
|
2437
|
-
var match = matchers.rgb.exec(color);
|
|
2438
|
-
if (match) {
|
|
2439
|
-
return { r: match[1], g: match[2], b: match[3] };
|
|
2440
|
-
}
|
|
2441
|
-
match = matchers.rgba.exec(color);
|
|
2442
|
-
if (match) {
|
|
2443
|
-
return { r: match[1], g: match[2], b: match[3], a: match[4] };
|
|
2444
|
-
}
|
|
2445
|
-
match = matchers.hsl.exec(color);
|
|
2446
|
-
if (match) {
|
|
2447
|
-
return { h: match[1], s: match[2], l: match[3] };
|
|
2448
|
-
}
|
|
2449
|
-
match = matchers.hsla.exec(color);
|
|
2450
|
-
if (match) {
|
|
2451
|
-
return { h: match[1], s: match[2], l: match[3], a: match[4] };
|
|
2452
|
-
}
|
|
2453
|
-
match = matchers.hsv.exec(color);
|
|
2454
|
-
if (match) {
|
|
2455
|
-
return { h: match[1], s: match[2], v: match[3] };
|
|
2456
|
-
}
|
|
2457
|
-
match = matchers.hsva.exec(color);
|
|
2458
|
-
if (match) {
|
|
2459
|
-
return { h: match[1], s: match[2], v: match[3], a: match[4] };
|
|
2460
|
-
}
|
|
2461
|
-
match = matchers.hex8.exec(color);
|
|
2462
|
-
if (match) {
|
|
2463
|
-
return {
|
|
2464
|
-
r: parseIntFromHex(match[1]),
|
|
2465
|
-
g: parseIntFromHex(match[2]),
|
|
2466
|
-
b: parseIntFromHex(match[3]),
|
|
2467
|
-
a: convertHexToDecimal(match[4]),
|
|
2468
|
-
format: named ? "name" : "hex8"
|
|
2469
|
-
};
|
|
2470
|
-
}
|
|
2471
|
-
match = matchers.hex6.exec(color);
|
|
2472
|
-
if (match) {
|
|
2473
|
-
return {
|
|
2474
|
-
r: parseIntFromHex(match[1]),
|
|
2475
|
-
g: parseIntFromHex(match[2]),
|
|
2476
|
-
b: parseIntFromHex(match[3]),
|
|
2477
|
-
format: named ? "name" : "hex"
|
|
2478
|
-
};
|
|
2479
|
-
}
|
|
2480
|
-
match = matchers.hex4.exec(color);
|
|
2481
|
-
if (match) {
|
|
2482
|
-
return {
|
|
2483
|
-
r: parseIntFromHex(match[1] + match[1]),
|
|
2484
|
-
g: parseIntFromHex(match[2] + match[2]),
|
|
2485
|
-
b: parseIntFromHex(match[3] + match[3]),
|
|
2486
|
-
a: convertHexToDecimal(match[4] + match[4]),
|
|
2487
|
-
format: named ? "name" : "hex8"
|
|
2488
|
-
};
|
|
2489
|
-
}
|
|
2490
|
-
match = matchers.hex3.exec(color);
|
|
2491
|
-
if (match) {
|
|
2492
|
-
return {
|
|
2493
|
-
r: parseIntFromHex(match[1] + match[1]),
|
|
2494
|
-
g: parseIntFromHex(match[2] + match[2]),
|
|
2495
|
-
b: parseIntFromHex(match[3] + match[3]),
|
|
2496
|
-
format: named ? "name" : "hex"
|
|
2497
|
-
};
|
|
2498
|
-
}
|
|
2499
|
-
return false;
|
|
2500
|
-
}
|
|
2501
|
-
function isValidCSSUnit(color) {
|
|
2502
|
-
return Boolean(matchers.CSS_UNIT.exec(String(color)));
|
|
2503
|
-
}
|
|
2504
|
-
var TinyColor = (
|
|
2505
|
-
/** @class */
|
|
2506
|
-
(function() {
|
|
2507
|
-
function TinyColor2(color, opts) {
|
|
2508
|
-
if (color === void 0) {
|
|
2509
|
-
color = "";
|
|
2510
|
-
}
|
|
2511
|
-
if (opts === void 0) {
|
|
2512
|
-
opts = {};
|
|
2513
|
-
}
|
|
2514
|
-
var _a2;
|
|
2515
|
-
if (color instanceof TinyColor2) {
|
|
2516
|
-
return color;
|
|
2517
|
-
}
|
|
2518
|
-
if (typeof color === "number") {
|
|
2519
|
-
color = numberInputToObject(color);
|
|
2520
|
-
}
|
|
2521
|
-
this.originalInput = color;
|
|
2522
|
-
var rgb = inputToRGB(color);
|
|
2523
|
-
this.originalInput = color;
|
|
2524
|
-
this.r = rgb.r;
|
|
2525
|
-
this.g = rgb.g;
|
|
2526
|
-
this.b = rgb.b;
|
|
2527
|
-
this.a = rgb.a;
|
|
2528
|
-
this.roundA = Math.round(100 * this.a) / 100;
|
|
2529
|
-
this.format = (_a2 = opts.format) !== null && _a2 !== void 0 ? _a2 : rgb.format;
|
|
2530
|
-
this.gradientType = opts.gradientType;
|
|
2531
|
-
if (this.r < 1) {
|
|
2532
|
-
this.r = Math.round(this.r);
|
|
2533
|
-
}
|
|
2534
|
-
if (this.g < 1) {
|
|
2535
|
-
this.g = Math.round(this.g);
|
|
2536
|
-
}
|
|
2537
|
-
if (this.b < 1) {
|
|
2538
|
-
this.b = Math.round(this.b);
|
|
2539
|
-
}
|
|
2540
|
-
this.isValid = rgb.ok;
|
|
2541
|
-
}
|
|
2542
|
-
TinyColor2.prototype.isDark = function() {
|
|
2543
|
-
return this.getBrightness() < 128;
|
|
2544
|
-
};
|
|
2545
|
-
TinyColor2.prototype.isLight = function() {
|
|
2546
|
-
return !this.isDark();
|
|
2547
|
-
};
|
|
2548
|
-
TinyColor2.prototype.getBrightness = function() {
|
|
2549
|
-
var rgb = this.toRgb();
|
|
2550
|
-
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
|
|
2551
|
-
};
|
|
2552
|
-
TinyColor2.prototype.getLuminance = function() {
|
|
2553
|
-
var rgb = this.toRgb();
|
|
2554
|
-
var R;
|
|
2555
|
-
var G;
|
|
2556
|
-
var B;
|
|
2557
|
-
var RsRGB = rgb.r / 255;
|
|
2558
|
-
var GsRGB = rgb.g / 255;
|
|
2559
|
-
var BsRGB = rgb.b / 255;
|
|
2560
|
-
if (RsRGB <= 0.03928) {
|
|
2561
|
-
R = RsRGB / 12.92;
|
|
2562
|
-
} else {
|
|
2563
|
-
R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
|
2564
|
-
}
|
|
2565
|
-
if (GsRGB <= 0.03928) {
|
|
2566
|
-
G = GsRGB / 12.92;
|
|
2567
|
-
} else {
|
|
2568
|
-
G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
2569
|
-
}
|
|
2570
|
-
if (BsRGB <= 0.03928) {
|
|
2571
|
-
B = BsRGB / 12.92;
|
|
2572
|
-
} else {
|
|
2573
|
-
B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
2574
|
-
}
|
|
2575
|
-
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
2576
|
-
};
|
|
2577
|
-
TinyColor2.prototype.getAlpha = function() {
|
|
2578
|
-
return this.a;
|
|
2579
|
-
};
|
|
2580
|
-
TinyColor2.prototype.setAlpha = function(alpha) {
|
|
2581
|
-
this.a = boundAlpha(alpha);
|
|
2582
|
-
this.roundA = Math.round(100 * this.a) / 100;
|
|
2583
|
-
return this;
|
|
2584
|
-
};
|
|
2585
|
-
TinyColor2.prototype.isMonochrome = function() {
|
|
2586
|
-
var s = this.toHsl().s;
|
|
2587
|
-
return s === 0;
|
|
2588
|
-
};
|
|
2589
|
-
TinyColor2.prototype.toHsv = function() {
|
|
2590
|
-
var hsv = rgbToHsv(this.r, this.g, this.b);
|
|
2591
|
-
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
|
|
2592
|
-
};
|
|
2593
|
-
TinyColor2.prototype.toHsvString = function() {
|
|
2594
|
-
var hsv = rgbToHsv(this.r, this.g, this.b);
|
|
2595
|
-
var h = Math.round(hsv.h * 360);
|
|
2596
|
-
var s = Math.round(hsv.s * 100);
|
|
2597
|
-
var v = Math.round(hsv.v * 100);
|
|
2598
|
-
return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
|
|
2599
|
-
};
|
|
2600
|
-
TinyColor2.prototype.toHsl = function() {
|
|
2601
|
-
var hsl = rgbToHsl(this.r, this.g, this.b);
|
|
2602
|
-
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
|
|
2603
|
-
};
|
|
2604
|
-
TinyColor2.prototype.toHslString = function() {
|
|
2605
|
-
var hsl = rgbToHsl(this.r, this.g, this.b);
|
|
2606
|
-
var h = Math.round(hsl.h * 360);
|
|
2607
|
-
var s = Math.round(hsl.s * 100);
|
|
2608
|
-
var l = Math.round(hsl.l * 100);
|
|
2609
|
-
return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
|
|
2610
|
-
};
|
|
2611
|
-
TinyColor2.prototype.toHex = function(allow3Char) {
|
|
2612
|
-
if (allow3Char === void 0) {
|
|
2613
|
-
allow3Char = false;
|
|
2614
|
-
}
|
|
2615
|
-
return rgbToHex(this.r, this.g, this.b, allow3Char);
|
|
2616
|
-
};
|
|
2617
|
-
TinyColor2.prototype.toHexString = function(allow3Char) {
|
|
2618
|
-
if (allow3Char === void 0) {
|
|
2619
|
-
allow3Char = false;
|
|
2620
|
-
}
|
|
2621
|
-
return "#" + this.toHex(allow3Char);
|
|
2622
|
-
};
|
|
2623
|
-
TinyColor2.prototype.toHex8 = function(allow4Char) {
|
|
2624
|
-
if (allow4Char === void 0) {
|
|
2625
|
-
allow4Char = false;
|
|
2626
|
-
}
|
|
2627
|
-
return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
|
|
2628
|
-
};
|
|
2629
|
-
TinyColor2.prototype.toHex8String = function(allow4Char) {
|
|
2630
|
-
if (allow4Char === void 0) {
|
|
2631
|
-
allow4Char = false;
|
|
2632
|
-
}
|
|
2633
|
-
return "#" + this.toHex8(allow4Char);
|
|
2634
|
-
};
|
|
2635
|
-
TinyColor2.prototype.toHexShortString = function(allowShortChar) {
|
|
2636
|
-
if (allowShortChar === void 0) {
|
|
2637
|
-
allowShortChar = false;
|
|
2638
|
-
}
|
|
2639
|
-
return this.a === 1 ? this.toHexString(allowShortChar) : this.toHex8String(allowShortChar);
|
|
2640
|
-
};
|
|
2641
|
-
TinyColor2.prototype.toRgb = function() {
|
|
2642
|
-
return {
|
|
2643
|
-
r: Math.round(this.r),
|
|
2644
|
-
g: Math.round(this.g),
|
|
2645
|
-
b: Math.round(this.b),
|
|
2646
|
-
a: this.a
|
|
2647
|
-
};
|
|
2648
|
-
};
|
|
2649
|
-
TinyColor2.prototype.toRgbString = function() {
|
|
2650
|
-
var r = Math.round(this.r);
|
|
2651
|
-
var g = Math.round(this.g);
|
|
2652
|
-
var b = Math.round(this.b);
|
|
2653
|
-
return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
|
|
2654
|
-
};
|
|
2655
|
-
TinyColor2.prototype.toPercentageRgb = function() {
|
|
2656
|
-
var fmt = function(x) {
|
|
2657
|
-
return "".concat(Math.round(bound01(x, 255) * 100), "%");
|
|
2658
|
-
};
|
|
2659
|
-
return {
|
|
2660
|
-
r: fmt(this.r),
|
|
2661
|
-
g: fmt(this.g),
|
|
2662
|
-
b: fmt(this.b),
|
|
2663
|
-
a: this.a
|
|
2664
|
-
};
|
|
2665
|
-
};
|
|
2666
|
-
TinyColor2.prototype.toPercentageRgbString = function() {
|
|
2667
|
-
var rnd = function(x) {
|
|
2668
|
-
return Math.round(bound01(x, 255) * 100);
|
|
2669
|
-
};
|
|
2670
|
-
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, ")");
|
|
2671
|
-
};
|
|
2672
|
-
TinyColor2.prototype.toName = function() {
|
|
2673
|
-
if (this.a === 0) {
|
|
2674
|
-
return "transparent";
|
|
2675
|
-
}
|
|
2676
|
-
if (this.a < 1) {
|
|
2677
|
-
return false;
|
|
2678
|
-
}
|
|
2679
|
-
var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
|
|
2680
|
-
for (var _i = 0, _a2 = Object.entries(names); _i < _a2.length; _i++) {
|
|
2681
|
-
var _b = _a2[_i], key = _b[0], value = _b[1];
|
|
2682
|
-
if (hex === value) {
|
|
2683
|
-
return key;
|
|
2684
|
-
}
|
|
2685
|
-
}
|
|
2686
|
-
return false;
|
|
2687
|
-
};
|
|
2688
|
-
TinyColor2.prototype.toString = function(format) {
|
|
2689
|
-
var formatSet = Boolean(format);
|
|
2690
|
-
format = format !== null && format !== void 0 ? format : this.format;
|
|
2691
|
-
var formattedString = false;
|
|
2692
|
-
var hasAlpha = this.a < 1 && this.a >= 0;
|
|
2693
|
-
var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
|
|
2694
|
-
if (needsAlphaFormat) {
|
|
2695
|
-
if (format === "name" && this.a === 0) {
|
|
2696
|
-
return this.toName();
|
|
2697
|
-
}
|
|
2698
|
-
return this.toRgbString();
|
|
2699
|
-
}
|
|
2700
|
-
if (format === "rgb") {
|
|
2701
|
-
formattedString = this.toRgbString();
|
|
2702
|
-
}
|
|
2703
|
-
if (format === "prgb") {
|
|
2704
|
-
formattedString = this.toPercentageRgbString();
|
|
2705
|
-
}
|
|
2706
|
-
if (format === "hex" || format === "hex6") {
|
|
2707
|
-
formattedString = this.toHexString();
|
|
2708
|
-
}
|
|
2709
|
-
if (format === "hex3") {
|
|
2710
|
-
formattedString = this.toHexString(true);
|
|
2711
|
-
}
|
|
2712
|
-
if (format === "hex4") {
|
|
2713
|
-
formattedString = this.toHex8String(true);
|
|
2714
|
-
}
|
|
2715
|
-
if (format === "hex8") {
|
|
2716
|
-
formattedString = this.toHex8String();
|
|
2717
|
-
}
|
|
2718
|
-
if (format === "name") {
|
|
2719
|
-
formattedString = this.toName();
|
|
2720
|
-
}
|
|
2721
|
-
if (format === "hsl") {
|
|
2722
|
-
formattedString = this.toHslString();
|
|
2723
|
-
}
|
|
2724
|
-
if (format === "hsv") {
|
|
2725
|
-
formattedString = this.toHsvString();
|
|
2726
|
-
}
|
|
2727
|
-
return formattedString || this.toHexString();
|
|
2728
|
-
};
|
|
2729
|
-
TinyColor2.prototype.toNumber = function() {
|
|
2730
|
-
return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
|
|
2731
|
-
};
|
|
2732
|
-
TinyColor2.prototype.clone = function() {
|
|
2733
|
-
return new TinyColor2(this.toString());
|
|
2734
|
-
};
|
|
2735
|
-
TinyColor2.prototype.lighten = function(amount) {
|
|
2736
|
-
if (amount === void 0) {
|
|
2737
|
-
amount = 10;
|
|
2738
|
-
}
|
|
2739
|
-
var hsl = this.toHsl();
|
|
2740
|
-
hsl.l += amount / 100;
|
|
2741
|
-
hsl.l = clamp01(hsl.l);
|
|
2742
|
-
return new TinyColor2(hsl);
|
|
2743
|
-
};
|
|
2744
|
-
TinyColor2.prototype.brighten = function(amount) {
|
|
2745
|
-
if (amount === void 0) {
|
|
2746
|
-
amount = 10;
|
|
2747
|
-
}
|
|
2748
|
-
var rgb = this.toRgb();
|
|
2749
|
-
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
|
|
2750
|
-
rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
|
|
2751
|
-
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
|
|
2752
|
-
return new TinyColor2(rgb);
|
|
2753
|
-
};
|
|
2754
|
-
TinyColor2.prototype.darken = function(amount) {
|
|
2755
|
-
if (amount === void 0) {
|
|
2756
|
-
amount = 10;
|
|
2757
|
-
}
|
|
2758
|
-
var hsl = this.toHsl();
|
|
2759
|
-
hsl.l -= amount / 100;
|
|
2760
|
-
hsl.l = clamp01(hsl.l);
|
|
2761
|
-
return new TinyColor2(hsl);
|
|
2762
|
-
};
|
|
2763
|
-
TinyColor2.prototype.tint = function(amount) {
|
|
2764
|
-
if (amount === void 0) {
|
|
2765
|
-
amount = 10;
|
|
2766
|
-
}
|
|
2767
|
-
return this.mix("white", amount);
|
|
2768
|
-
};
|
|
2769
|
-
TinyColor2.prototype.shade = function(amount) {
|
|
2770
|
-
if (amount === void 0) {
|
|
2771
|
-
amount = 10;
|
|
2772
|
-
}
|
|
2773
|
-
return this.mix("black", amount);
|
|
2774
|
-
};
|
|
2775
|
-
TinyColor2.prototype.desaturate = function(amount) {
|
|
2776
|
-
if (amount === void 0) {
|
|
2777
|
-
amount = 10;
|
|
2778
|
-
}
|
|
2779
|
-
var hsl = this.toHsl();
|
|
2780
|
-
hsl.s -= amount / 100;
|
|
2781
|
-
hsl.s = clamp01(hsl.s);
|
|
2782
|
-
return new TinyColor2(hsl);
|
|
2783
|
-
};
|
|
2784
|
-
TinyColor2.prototype.saturate = function(amount) {
|
|
2785
|
-
if (amount === void 0) {
|
|
2786
|
-
amount = 10;
|
|
2787
|
-
}
|
|
2788
|
-
var hsl = this.toHsl();
|
|
2789
|
-
hsl.s += amount / 100;
|
|
2790
|
-
hsl.s = clamp01(hsl.s);
|
|
2791
|
-
return new TinyColor2(hsl);
|
|
2792
|
-
};
|
|
2793
|
-
TinyColor2.prototype.greyscale = function() {
|
|
2794
|
-
return this.desaturate(100);
|
|
2795
|
-
};
|
|
2796
|
-
TinyColor2.prototype.spin = function(amount) {
|
|
2797
|
-
var hsl = this.toHsl();
|
|
2798
|
-
var hue = (hsl.h + amount) % 360;
|
|
2799
|
-
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
2800
|
-
return new TinyColor2(hsl);
|
|
2801
|
-
};
|
|
2802
|
-
TinyColor2.prototype.mix = function(color, amount) {
|
|
2803
|
-
if (amount === void 0) {
|
|
2804
|
-
amount = 50;
|
|
2805
|
-
}
|
|
2806
|
-
var rgb1 = this.toRgb();
|
|
2807
|
-
var rgb2 = new TinyColor2(color).toRgb();
|
|
2808
|
-
var p = amount / 100;
|
|
2809
|
-
var rgba = {
|
|
2810
|
-
r: (rgb2.r - rgb1.r) * p + rgb1.r,
|
|
2811
|
-
g: (rgb2.g - rgb1.g) * p + rgb1.g,
|
|
2812
|
-
b: (rgb2.b - rgb1.b) * p + rgb1.b,
|
|
2813
|
-
a: (rgb2.a - rgb1.a) * p + rgb1.a
|
|
2814
|
-
};
|
|
2815
|
-
return new TinyColor2(rgba);
|
|
2816
|
-
};
|
|
2817
|
-
TinyColor2.prototype.analogous = function(results, slices) {
|
|
2818
|
-
if (results === void 0) {
|
|
2819
|
-
results = 6;
|
|
2820
|
-
}
|
|
2821
|
-
if (slices === void 0) {
|
|
2822
|
-
slices = 30;
|
|
2823
|
-
}
|
|
2824
|
-
var hsl = this.toHsl();
|
|
2825
|
-
var part = 360 / slices;
|
|
2826
|
-
var ret = [this];
|
|
2827
|
-
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
|
|
2828
|
-
hsl.h = (hsl.h + part) % 360;
|
|
2829
|
-
ret.push(new TinyColor2(hsl));
|
|
2830
|
-
}
|
|
2831
|
-
return ret;
|
|
2832
|
-
};
|
|
2833
|
-
TinyColor2.prototype.complement = function() {
|
|
2834
|
-
var hsl = this.toHsl();
|
|
2835
|
-
hsl.h = (hsl.h + 180) % 360;
|
|
2836
|
-
return new TinyColor2(hsl);
|
|
2837
|
-
};
|
|
2838
|
-
TinyColor2.prototype.monochromatic = function(results) {
|
|
2839
|
-
if (results === void 0) {
|
|
2840
|
-
results = 6;
|
|
2841
|
-
}
|
|
2842
|
-
var hsv = this.toHsv();
|
|
2843
|
-
var h = hsv.h;
|
|
2844
|
-
var s = hsv.s;
|
|
2845
|
-
var v = hsv.v;
|
|
2846
|
-
var res = [];
|
|
2847
|
-
var modification = 1 / results;
|
|
2848
|
-
while (results--) {
|
|
2849
|
-
res.push(new TinyColor2({ h, s, v }));
|
|
2850
|
-
v = (v + modification) % 1;
|
|
2851
|
-
}
|
|
2852
|
-
return res;
|
|
2853
|
-
};
|
|
2854
|
-
TinyColor2.prototype.splitcomplement = function() {
|
|
2855
|
-
var hsl = this.toHsl();
|
|
2856
|
-
var h = hsl.h;
|
|
2857
|
-
return [
|
|
2858
|
-
this,
|
|
2859
|
-
new TinyColor2({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
|
|
2860
|
-
new TinyColor2({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })
|
|
2861
|
-
];
|
|
2862
|
-
};
|
|
2863
|
-
TinyColor2.prototype.onBackground = function(background) {
|
|
2864
|
-
var fg = this.toRgb();
|
|
2865
|
-
var bg = new TinyColor2(background).toRgb();
|
|
2866
|
-
var alpha = fg.a + bg.a * (1 - fg.a);
|
|
2867
|
-
return new TinyColor2({
|
|
2868
|
-
r: (fg.r * fg.a + bg.r * bg.a * (1 - fg.a)) / alpha,
|
|
2869
|
-
g: (fg.g * fg.a + bg.g * bg.a * (1 - fg.a)) / alpha,
|
|
2870
|
-
b: (fg.b * fg.a + bg.b * bg.a * (1 - fg.a)) / alpha,
|
|
2871
|
-
a: alpha
|
|
2872
|
-
});
|
|
2873
|
-
};
|
|
2874
|
-
TinyColor2.prototype.triad = function() {
|
|
2875
|
-
return this.polyad(3);
|
|
2876
|
-
};
|
|
2877
|
-
TinyColor2.prototype.tetrad = function() {
|
|
2878
|
-
return this.polyad(4);
|
|
2879
|
-
};
|
|
2880
|
-
TinyColor2.prototype.polyad = function(n) {
|
|
2881
|
-
var hsl = this.toHsl();
|
|
2882
|
-
var h = hsl.h;
|
|
2883
|
-
var result = [this];
|
|
2884
|
-
var increment = 360 / n;
|
|
2885
|
-
for (var i = 1; i < n; i++) {
|
|
2886
|
-
result.push(new TinyColor2({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
|
|
2887
|
-
}
|
|
2888
|
-
return result;
|
|
2889
|
-
};
|
|
2890
|
-
TinyColor2.prototype.equals = function(color) {
|
|
2891
|
-
return this.toRgbString() === new TinyColor2(color).toRgbString();
|
|
2892
|
-
};
|
|
2893
|
-
return TinyColor2;
|
|
2894
|
-
})()
|
|
2895
|
-
);
|
|
2896
|
-
function darken(color, amount = 20) {
|
|
2897
|
-
return color.mix("#141414", amount).toString();
|
|
2898
|
-
}
|
|
2899
|
-
function useButtonCustomStyle(props) {
|
|
2900
|
-
const _disabled = useFormDisabled();
|
|
2901
|
-
const ns = useNamespace("button");
|
|
2902
|
-
return computed(() => {
|
|
2903
|
-
let styles = {};
|
|
2904
|
-
let buttonColor = props.color;
|
|
2905
|
-
if (buttonColor) {
|
|
2906
|
-
const match = buttonColor.match(/var\((.*?)\)/);
|
|
2907
|
-
if (match) {
|
|
2908
|
-
buttonColor = window.getComputedStyle(window.document.documentElement).getPropertyValue(match[1]);
|
|
2909
|
-
}
|
|
2910
|
-
const color = new TinyColor(buttonColor);
|
|
2911
|
-
const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
|
|
2912
|
-
if (props.plain) {
|
|
2913
|
-
styles = ns.cssVarBlock({
|
|
2914
|
-
"bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
|
|
2915
|
-
"text-color": buttonColor,
|
|
2916
|
-
"border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
|
|
2917
|
-
"hover-text-color": `var(${ns.cssVarName("color-white")})`,
|
|
2918
|
-
"hover-bg-color": buttonColor,
|
|
2919
|
-
"hover-border-color": buttonColor,
|
|
2920
|
-
"active-bg-color": activeBgColor,
|
|
2921
|
-
"active-text-color": `var(${ns.cssVarName("color-white")})`,
|
|
2922
|
-
"active-border-color": activeBgColor
|
|
2923
|
-
});
|
|
2924
|
-
if (_disabled.value) {
|
|
2925
|
-
styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString();
|
|
2926
|
-
styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString();
|
|
2927
|
-
styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString();
|
|
2928
|
-
}
|
|
2929
|
-
} else {
|
|
2930
|
-
const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
|
|
2931
|
-
const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
|
|
2932
|
-
styles = ns.cssVarBlock({
|
|
2933
|
-
"bg-color": buttonColor,
|
|
2934
|
-
"text-color": textColor,
|
|
2935
|
-
"border-color": buttonColor,
|
|
2936
|
-
"hover-bg-color": hoverBgColor,
|
|
2937
|
-
"hover-text-color": textColor,
|
|
2938
|
-
"hover-border-color": hoverBgColor,
|
|
2939
|
-
"active-bg-color": activeBgColor,
|
|
2940
|
-
"active-border-color": activeBgColor
|
|
2941
|
-
});
|
|
2942
|
-
if (_disabled.value) {
|
|
2943
|
-
const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
|
|
2944
|
-
styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
|
|
2945
|
-
styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
|
|
2946
|
-
styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
|
|
2947
|
-
}
|
|
2948
|
-
}
|
|
2949
|
-
}
|
|
2950
|
-
return styles;
|
|
2951
|
-
});
|
|
2952
|
-
}
|
|
2953
|
-
const __default__$4 = defineComponent({
|
|
2954
|
-
name: "ElButton"
|
|
2955
|
-
});
|
|
2956
|
-
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
2957
|
-
...__default__$4,
|
|
2958
|
-
props: buttonProps,
|
|
2959
|
-
emits: buttonEmits,
|
|
2960
|
-
setup(__props, { expose, emit }) {
|
|
2961
|
-
const props = __props;
|
|
2962
|
-
const buttonStyle = useButtonCustomStyle(props);
|
|
2963
|
-
const ns = useNamespace("button");
|
|
2964
|
-
const {
|
|
2965
|
-
_ref,
|
|
2966
|
-
_size,
|
|
2967
|
-
_type,
|
|
2968
|
-
_disabled,
|
|
2969
|
-
_props,
|
|
2970
|
-
_plain,
|
|
2971
|
-
_round,
|
|
2972
|
-
shouldAddSpace,
|
|
2973
|
-
handleClick
|
|
2974
|
-
} = useButton(props, emit);
|
|
2975
|
-
const buttonKls = computed(() => [
|
|
2976
|
-
ns.b(),
|
|
2977
|
-
ns.m(_type.value),
|
|
2978
|
-
ns.m(_size.value),
|
|
2979
|
-
ns.is("disabled", _disabled.value),
|
|
2980
|
-
ns.is("loading", props.loading),
|
|
2981
|
-
ns.is("plain", _plain.value),
|
|
2982
|
-
ns.is("round", _round.value),
|
|
2983
|
-
ns.is("circle", props.circle),
|
|
2984
|
-
ns.is("text", props.text),
|
|
2985
|
-
ns.is("link", props.link),
|
|
2986
|
-
ns.is("has-bg", props.bg)
|
|
2987
|
-
]);
|
|
2988
|
-
expose({
|
|
2989
|
-
ref: _ref,
|
|
2990
|
-
size: _size,
|
|
2991
|
-
type: _type,
|
|
2992
|
-
disabled: _disabled,
|
|
2993
|
-
shouldAddSpace
|
|
2994
|
-
});
|
|
2995
|
-
return (_ctx, _cache) => {
|
|
2996
|
-
return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), mergeProps({
|
|
2997
|
-
ref_key: "_ref",
|
|
2998
|
-
ref: _ref
|
|
2999
|
-
}, unref(_props), {
|
|
3000
|
-
class: unref(buttonKls),
|
|
3001
|
-
style: unref(buttonStyle),
|
|
3002
|
-
onClick: unref(handleClick)
|
|
3003
|
-
}), {
|
|
3004
|
-
default: withCtx(() => [
|
|
3005
|
-
_ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
3006
|
-
_ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
|
|
3007
|
-
key: 1,
|
|
3008
|
-
class: normalizeClass(unref(ns).is("loading"))
|
|
3009
|
-
}, {
|
|
3010
|
-
default: withCtx(() => [
|
|
3011
|
-
(openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
|
|
3012
|
-
]),
|
|
3013
|
-
_: 1
|
|
3014
|
-
}, 8, ["class"]))
|
|
3015
|
-
], 64)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
|
|
3016
|
-
default: withCtx(() => [
|
|
3017
|
-
_ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
|
|
3018
|
-
]),
|
|
3019
|
-
_: 3
|
|
3020
|
-
})) : createCommentVNode("v-if", true),
|
|
3021
|
-
_ctx.$slots.default ? (openBlock(), createElementBlock("span", {
|
|
3022
|
-
key: 2,
|
|
3023
|
-
class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
|
|
3024
|
-
}, [
|
|
3025
|
-
renderSlot(_ctx.$slots, "default")
|
|
3026
|
-
], 2)) : createCommentVNode("v-if", true)
|
|
3027
|
-
]),
|
|
3028
|
-
_: 3
|
|
3029
|
-
}, 16, ["class", "style", "onClick"]);
|
|
3030
|
-
};
|
|
3031
|
-
}
|
|
3032
|
-
});
|
|
3033
|
-
var Button = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "button.vue"]]);
|
|
3034
|
-
const buttonGroupProps = {
|
|
3035
|
-
size: buttonProps.size,
|
|
3036
|
-
type: buttonProps.type
|
|
3037
|
-
};
|
|
3038
|
-
const __default__$3 = defineComponent({
|
|
3039
|
-
name: "ElButtonGroup"
|
|
3040
|
-
});
|
|
3041
|
-
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
3042
|
-
...__default__$3,
|
|
3043
|
-
props: buttonGroupProps,
|
|
3044
|
-
setup(__props) {
|
|
3045
|
-
const props = __props;
|
|
3046
|
-
provide(buttonGroupContextKey, reactive({
|
|
3047
|
-
size: toRef(props, "size"),
|
|
3048
|
-
type: toRef(props, "type")
|
|
3049
|
-
}));
|
|
3050
|
-
const ns = useNamespace("button");
|
|
3051
|
-
return (_ctx, _cache) => {
|
|
3052
|
-
return openBlock(), createElementBlock("div", {
|
|
3053
|
-
class: normalizeClass(unref(ns).b("group"))
|
|
3054
|
-
}, [
|
|
3055
|
-
renderSlot(_ctx.$slots, "default")
|
|
3056
|
-
], 2);
|
|
3057
|
-
};
|
|
3058
|
-
}
|
|
3059
|
-
});
|
|
3060
|
-
var ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "button-group.vue"]]);
|
|
3061
|
-
const ElButton = withInstall(Button, {
|
|
3062
|
-
ButtonGroup
|
|
3063
|
-
});
|
|
3064
|
-
withNoopInstall(ButtonGroup);
|
|
3065
|
-
const checkboxProps = {
|
|
3066
|
-
modelValue: {
|
|
3067
|
-
type: [Number, String, Boolean],
|
|
3068
|
-
default: void 0
|
|
3069
|
-
},
|
|
3070
|
-
label: {
|
|
3071
|
-
type: [String, Boolean, Number, Object],
|
|
3072
|
-
default: void 0
|
|
3073
|
-
},
|
|
3074
|
-
value: {
|
|
3075
|
-
type: [String, Boolean, Number, Object],
|
|
3076
|
-
default: void 0
|
|
3077
|
-
},
|
|
3078
|
-
indeterminate: Boolean,
|
|
3079
|
-
disabled: Boolean,
|
|
3080
|
-
checked: Boolean,
|
|
3081
|
-
name: {
|
|
3082
|
-
type: String,
|
|
3083
|
-
default: void 0
|
|
3084
|
-
},
|
|
3085
|
-
trueValue: {
|
|
3086
|
-
type: [String, Number],
|
|
3087
|
-
default: void 0
|
|
3088
|
-
},
|
|
3089
|
-
falseValue: {
|
|
3090
|
-
type: [String, Number],
|
|
3091
|
-
default: void 0
|
|
3092
|
-
},
|
|
3093
|
-
trueLabel: {
|
|
3094
|
-
type: [String, Number],
|
|
3095
|
-
default: void 0
|
|
3096
|
-
},
|
|
3097
|
-
falseLabel: {
|
|
3098
|
-
type: [String, Number],
|
|
3099
|
-
default: void 0
|
|
3100
|
-
},
|
|
3101
|
-
id: {
|
|
3102
|
-
type: String,
|
|
3103
|
-
default: void 0
|
|
3104
|
-
},
|
|
3105
|
-
border: Boolean,
|
|
3106
|
-
size: useSizeProp,
|
|
3107
|
-
tabindex: [String, Number],
|
|
3108
|
-
validateEvent: {
|
|
3109
|
-
type: Boolean,
|
|
3110
|
-
default: true
|
|
3111
|
-
},
|
|
3112
|
-
...useAriaProps(["ariaControls"])
|
|
3113
|
-
};
|
|
3114
|
-
const checkboxEmits = {
|
|
3115
|
-
[UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
|
|
3116
|
-
change: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
|
|
3117
|
-
};
|
|
3118
|
-
const checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
|
|
3119
|
-
const useCheckboxDisabled = ({
|
|
3120
|
-
model,
|
|
3121
|
-
isChecked
|
|
3122
|
-
}) => {
|
|
3123
|
-
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
3124
|
-
const isLimitDisabled = computed(() => {
|
|
3125
|
-
var _a2, _b;
|
|
3126
|
-
const max = (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a2.value;
|
|
3127
|
-
const min = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value;
|
|
3128
|
-
return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value;
|
|
3129
|
-
});
|
|
3130
|
-
const isDisabled = useFormDisabled(computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.disabled.value) || isLimitDisabled.value));
|
|
3131
|
-
return {
|
|
3132
|
-
isDisabled,
|
|
3133
|
-
isLimitDisabled
|
|
3134
|
-
};
|
|
3135
|
-
};
|
|
3136
|
-
const useCheckboxEvent = (props, {
|
|
3137
|
-
model,
|
|
3138
|
-
isLimitExceeded,
|
|
3139
|
-
hasOwnLabel,
|
|
3140
|
-
isDisabled,
|
|
3141
|
-
isLabeledByFormItem
|
|
3142
|
-
}) => {
|
|
3143
|
-
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
3144
|
-
const { formItem } = useFormItem();
|
|
3145
|
-
const { emit } = getCurrentInstance();
|
|
3146
|
-
function getLabeledValue(value) {
|
|
3147
|
-
var _a2, _b, _c, _d;
|
|
3148
|
-
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;
|
|
3149
|
-
}
|
|
3150
|
-
function emitChangeEvent(checked, e) {
|
|
3151
|
-
emit(CHANGE_EVENT, getLabeledValue(checked), e);
|
|
3152
|
-
}
|
|
3153
|
-
function handleChange(e) {
|
|
3154
|
-
if (isLimitExceeded.value)
|
|
3155
|
-
return;
|
|
3156
|
-
const target = e.target;
|
|
3157
|
-
emit(CHANGE_EVENT, getLabeledValue(target.checked), e);
|
|
3158
|
-
}
|
|
3159
|
-
async function onClickRoot(e) {
|
|
3160
|
-
if (isLimitExceeded.value)
|
|
3161
|
-
return;
|
|
3162
|
-
if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
|
|
3163
|
-
const eventTargets = e.composedPath();
|
|
3164
|
-
const hasLabel = eventTargets.some((item) => item.tagName === "LABEL");
|
|
3165
|
-
if (!hasLabel) {
|
|
3166
|
-
model.value = getLabeledValue([false, props.falseValue, props.falseLabel].includes(model.value));
|
|
3167
|
-
await nextTick();
|
|
3168
|
-
emitChangeEvent(model.value, e);
|
|
3169
|
-
}
|
|
3170
|
-
}
|
|
3171
|
-
}
|
|
3172
|
-
const validateEvent = computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.validateEvent) || props.validateEvent);
|
|
3173
|
-
watch(() => props.modelValue, () => {
|
|
3174
|
-
if (validateEvent.value) {
|
|
3175
|
-
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
|
|
3176
|
-
}
|
|
3177
|
-
});
|
|
3178
|
-
return {
|
|
3179
|
-
handleChange,
|
|
3180
|
-
onClickRoot
|
|
3181
|
-
};
|
|
3182
|
-
};
|
|
3183
|
-
const useCheckboxModel = (props) => {
|
|
3184
|
-
const selfModel = ref(false);
|
|
3185
|
-
const { emit } = getCurrentInstance();
|
|
3186
|
-
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
3187
|
-
const isGroup = computed(() => isUndefined(checkboxGroup) === false);
|
|
3188
|
-
const isLimitExceeded = ref(false);
|
|
3189
|
-
const model = computed({
|
|
3190
|
-
get() {
|
|
3191
|
-
var _a2, _b;
|
|
3192
|
-
return isGroup.value ? (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.modelValue) == null ? void 0 : _a2.value : (_b = props.modelValue) != null ? _b : selfModel.value;
|
|
3193
|
-
},
|
|
3194
|
-
set(val) {
|
|
3195
|
-
var _a2, _b;
|
|
3196
|
-
if (isGroup.value && isArray$1(val)) {
|
|
3197
|
-
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;
|
|
3198
|
-
isLimitExceeded.value === false && ((_b = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _b.call(checkboxGroup, val));
|
|
3199
|
-
} else {
|
|
3200
|
-
emit(UPDATE_MODEL_EVENT, val);
|
|
3201
|
-
selfModel.value = val;
|
|
3202
|
-
}
|
|
3203
|
-
}
|
|
3204
|
-
});
|
|
3205
|
-
return {
|
|
3206
|
-
model,
|
|
3207
|
-
isGroup,
|
|
3208
|
-
isLimitExceeded
|
|
3209
|
-
};
|
|
3210
|
-
};
|
|
3211
|
-
const useCheckboxStatus = (props, slots, { model }) => {
|
|
3212
|
-
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
3213
|
-
const isFocused = ref(false);
|
|
3214
|
-
const actualValue = computed(() => {
|
|
3215
|
-
if (!isPropAbsent(props.value)) {
|
|
3216
|
-
return props.value;
|
|
3217
|
-
}
|
|
3218
|
-
return props.label;
|
|
3219
|
-
});
|
|
3220
|
-
const isChecked = computed(() => {
|
|
3221
|
-
const value = model.value;
|
|
3222
|
-
if (isBoolean(value)) {
|
|
3223
|
-
return value;
|
|
3224
|
-
} else if (isArray$1(value)) {
|
|
3225
|
-
if (isObject$1(actualValue.value)) {
|
|
3226
|
-
return value.map(toRaw).some((o) => isEqual(o, actualValue.value));
|
|
3227
|
-
} else {
|
|
3228
|
-
return value.map(toRaw).includes(actualValue.value);
|
|
3229
|
-
}
|
|
3230
|
-
} else if (value !== null && value !== void 0) {
|
|
3231
|
-
return value === props.trueValue || value === props.trueLabel;
|
|
3232
|
-
} else {
|
|
3233
|
-
return !!value;
|
|
3234
|
-
}
|
|
3235
|
-
});
|
|
3236
|
-
const checkboxButtonSize = useFormSize(computed(() => {
|
|
3237
|
-
var _a2;
|
|
3238
|
-
return (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a2.value;
|
|
3239
|
-
}), {
|
|
3240
|
-
prop: true
|
|
3241
|
-
});
|
|
3242
|
-
const checkboxSize = useFormSize(computed(() => {
|
|
3243
|
-
var _a2;
|
|
3244
|
-
return (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a2.value;
|
|
3245
|
-
}));
|
|
3246
|
-
const hasOwnLabel = computed(() => {
|
|
3247
|
-
return !!slots.default || !isPropAbsent(actualValue.value);
|
|
3248
|
-
});
|
|
3249
|
-
return {
|
|
3250
|
-
checkboxButtonSize,
|
|
3251
|
-
isChecked,
|
|
3252
|
-
isFocused,
|
|
3253
|
-
checkboxSize,
|
|
3254
|
-
hasOwnLabel,
|
|
3255
|
-
actualValue
|
|
3256
|
-
};
|
|
3257
|
-
};
|
|
3258
|
-
const useCheckbox = (props, slots) => {
|
|
3259
|
-
const { formItem: elFormItem } = useFormItem();
|
|
3260
|
-
const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
|
|
3261
|
-
const {
|
|
3262
|
-
isFocused,
|
|
3263
|
-
isChecked,
|
|
3264
|
-
checkboxButtonSize,
|
|
3265
|
-
checkboxSize,
|
|
3266
|
-
hasOwnLabel,
|
|
3267
|
-
actualValue
|
|
3268
|
-
} = useCheckboxStatus(props, slots, { model });
|
|
3269
|
-
const { isDisabled } = useCheckboxDisabled({ model, isChecked });
|
|
3270
|
-
const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
|
|
3271
|
-
formItemContext: elFormItem,
|
|
3272
|
-
disableIdGeneration: hasOwnLabel,
|
|
3273
|
-
disableIdManagement: isGroup
|
|
3274
|
-
});
|
|
3275
|
-
const { handleChange, onClickRoot } = useCheckboxEvent(props, {
|
|
3276
|
-
model,
|
|
3277
|
-
isLimitExceeded,
|
|
3278
|
-
hasOwnLabel,
|
|
3279
|
-
isDisabled,
|
|
3280
|
-
isLabeledByFormItem
|
|
3281
|
-
});
|
|
3282
|
-
const setStoreValue = () => {
|
|
3283
|
-
function addToStore() {
|
|
3284
|
-
var _a2, _b;
|
|
3285
|
-
if (isArray$1(model.value) && !model.value.includes(actualValue.value)) {
|
|
3286
|
-
model.value.push(actualValue.value);
|
|
3287
|
-
} else {
|
|
3288
|
-
model.value = (_b = (_a2 = props.trueValue) != null ? _a2 : props.trueLabel) != null ? _b : true;
|
|
3289
|
-
}
|
|
3290
|
-
}
|
|
3291
|
-
props.checked && addToStore();
|
|
3292
|
-
};
|
|
3293
|
-
setStoreValue();
|
|
3294
|
-
useDeprecated({
|
|
3295
|
-
from: "label act as value",
|
|
3296
|
-
replacement: "value",
|
|
3297
|
-
version: "3.0.0",
|
|
3298
|
-
scope: "el-checkbox",
|
|
3299
|
-
ref: "https://element-plus.org/en-US/component/checkbox.html"
|
|
3300
|
-
}, computed(() => isGroup.value && isPropAbsent(props.value)));
|
|
3301
|
-
useDeprecated({
|
|
3302
|
-
from: "true-label",
|
|
3303
|
-
replacement: "true-value",
|
|
3304
|
-
version: "3.0.0",
|
|
3305
|
-
scope: "el-checkbox",
|
|
3306
|
-
ref: "https://element-plus.org/en-US/component/checkbox.html"
|
|
3307
|
-
}, computed(() => !!props.trueLabel));
|
|
3308
|
-
useDeprecated({
|
|
3309
|
-
from: "false-label",
|
|
3310
|
-
replacement: "false-value",
|
|
3311
|
-
version: "3.0.0",
|
|
3312
|
-
scope: "el-checkbox",
|
|
3313
|
-
ref: "https://element-plus.org/en-US/component/checkbox.html"
|
|
3314
|
-
}, computed(() => !!props.falseLabel));
|
|
3315
|
-
return {
|
|
3316
|
-
inputId,
|
|
3317
|
-
isLabeledByFormItem,
|
|
3318
|
-
isChecked,
|
|
3319
|
-
isDisabled,
|
|
3320
|
-
isFocused,
|
|
3321
|
-
checkboxButtonSize,
|
|
3322
|
-
checkboxSize,
|
|
3323
|
-
hasOwnLabel,
|
|
3324
|
-
model,
|
|
3325
|
-
actualValue,
|
|
3326
|
-
handleChange,
|
|
3327
|
-
onClickRoot
|
|
3328
|
-
};
|
|
3329
|
-
};
|
|
3330
|
-
const __default__$2 = defineComponent({
|
|
3331
|
-
name: "ElCheckbox"
|
|
3332
|
-
});
|
|
3333
|
-
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
3334
|
-
...__default__$2,
|
|
3335
|
-
props: checkboxProps,
|
|
3336
|
-
emits: checkboxEmits,
|
|
3337
|
-
setup(__props) {
|
|
3338
|
-
const props = __props;
|
|
3339
|
-
const slots = useSlots();
|
|
3340
|
-
const {
|
|
3341
|
-
inputId,
|
|
3342
|
-
isLabeledByFormItem,
|
|
3343
|
-
isChecked,
|
|
3344
|
-
isDisabled,
|
|
3345
|
-
isFocused,
|
|
3346
|
-
checkboxSize,
|
|
3347
|
-
hasOwnLabel,
|
|
3348
|
-
model,
|
|
3349
|
-
actualValue,
|
|
3350
|
-
handleChange,
|
|
3351
|
-
onClickRoot
|
|
3352
|
-
} = useCheckbox(props, slots);
|
|
3353
|
-
const ns = useNamespace("checkbox");
|
|
3354
|
-
const compKls = computed(() => {
|
|
3355
|
-
return [
|
|
3356
|
-
ns.b(),
|
|
3357
|
-
ns.m(checkboxSize.value),
|
|
3358
|
-
ns.is("disabled", isDisabled.value),
|
|
3359
|
-
ns.is("bordered", props.border),
|
|
3360
|
-
ns.is("checked", isChecked.value)
|
|
3361
|
-
];
|
|
3362
|
-
});
|
|
3363
|
-
const spanKls = computed(() => {
|
|
3364
|
-
return [
|
|
3365
|
-
ns.e("input"),
|
|
3366
|
-
ns.is("disabled", isDisabled.value),
|
|
3367
|
-
ns.is("checked", isChecked.value),
|
|
3368
|
-
ns.is("indeterminate", props.indeterminate),
|
|
3369
|
-
ns.is("focus", isFocused.value)
|
|
3370
|
-
];
|
|
3371
|
-
});
|
|
3372
|
-
return (_ctx, _cache) => {
|
|
3373
|
-
return openBlock(), createBlock(resolveDynamicComponent(!unref(hasOwnLabel) && unref(isLabeledByFormItem) ? "span" : "label"), {
|
|
3374
|
-
class: normalizeClass(unref(compKls)),
|
|
3375
|
-
"aria-controls": _ctx.indeterminate ? _ctx.ariaControls : null,
|
|
3376
|
-
onClick: unref(onClickRoot)
|
|
3377
|
-
}, {
|
|
3378
|
-
default: withCtx(() => {
|
|
3379
|
-
var _a2, _b, _c, _d;
|
|
3380
|
-
return [
|
|
3381
|
-
createElementVNode("span", {
|
|
3382
|
-
class: normalizeClass(unref(spanKls))
|
|
3383
|
-
}, [
|
|
3384
|
-
_ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
|
|
3385
|
-
key: 0,
|
|
3386
|
-
id: unref(inputId),
|
|
3387
|
-
"onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
|
|
3388
|
-
class: normalizeClass(unref(ns).e("original")),
|
|
3389
|
-
type: "checkbox",
|
|
3390
|
-
indeterminate: _ctx.indeterminate,
|
|
3391
|
-
name: _ctx.name,
|
|
3392
|
-
tabindex: _ctx.tabindex,
|
|
3393
|
-
disabled: unref(isDisabled),
|
|
3394
|
-
"true-value": (_b = (_a2 = _ctx.trueValue) != null ? _a2 : _ctx.trueLabel) != null ? _b : true,
|
|
3395
|
-
"false-value": (_d = (_c = _ctx.falseValue) != null ? _c : _ctx.falseLabel) != null ? _d : false,
|
|
3396
|
-
onChange: unref(handleChange),
|
|
3397
|
-
onFocus: ($event) => isFocused.value = true,
|
|
3398
|
-
onBlur: ($event) => isFocused.value = false,
|
|
3399
|
-
onClick: withModifiers(() => {
|
|
3400
|
-
}, ["stop"])
|
|
3401
|
-
}, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
|
|
3402
|
-
[vModelCheckbox, unref(model)]
|
|
3403
|
-
]) : withDirectives((openBlock(), createElementBlock("input", {
|
|
3404
|
-
key: 1,
|
|
3405
|
-
id: unref(inputId),
|
|
3406
|
-
"onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
|
|
3407
|
-
class: normalizeClass(unref(ns).e("original")),
|
|
3408
|
-
type: "checkbox",
|
|
3409
|
-
indeterminate: _ctx.indeterminate,
|
|
3410
|
-
disabled: unref(isDisabled),
|
|
3411
|
-
value: unref(actualValue),
|
|
3412
|
-
name: _ctx.name,
|
|
3413
|
-
tabindex: _ctx.tabindex,
|
|
3414
|
-
onChange: unref(handleChange),
|
|
3415
|
-
onFocus: ($event) => isFocused.value = true,
|
|
3416
|
-
onBlur: ($event) => isFocused.value = false,
|
|
3417
|
-
onClick: withModifiers(() => {
|
|
3418
|
-
}, ["stop"])
|
|
3419
|
-
}, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "disabled", "value", "name", "tabindex", "onChange", "onFocus", "onBlur", "onClick"])), [
|
|
3420
|
-
[vModelCheckbox, unref(model)]
|
|
3421
|
-
]),
|
|
3422
|
-
createElementVNode("span", {
|
|
3423
|
-
class: normalizeClass(unref(ns).e("inner"))
|
|
3424
|
-
}, null, 2)
|
|
3425
|
-
], 2),
|
|
3426
|
-
unref(hasOwnLabel) ? (openBlock(), createElementBlock("span", {
|
|
3427
|
-
key: 0,
|
|
3428
|
-
class: normalizeClass(unref(ns).e("label"))
|
|
3429
|
-
}, [
|
|
3430
|
-
renderSlot(_ctx.$slots, "default"),
|
|
3431
|
-
!_ctx.$slots.default ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
3432
|
-
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
3433
|
-
], 64)) : createCommentVNode("v-if", true)
|
|
3434
|
-
], 2)) : createCommentVNode("v-if", true)
|
|
3435
|
-
];
|
|
3436
|
-
}),
|
|
3437
|
-
_: 3
|
|
3438
|
-
}, 8, ["class", "aria-controls", "onClick"]);
|
|
3439
|
-
};
|
|
3440
|
-
}
|
|
3441
|
-
});
|
|
3442
|
-
var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "checkbox.vue"]]);
|
|
3443
|
-
const __default__$1 = defineComponent({
|
|
3444
|
-
name: "ElCheckboxButton"
|
|
3445
|
-
});
|
|
3446
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
3447
|
-
...__default__$1,
|
|
3448
|
-
props: checkboxProps,
|
|
3449
|
-
emits: checkboxEmits,
|
|
3450
|
-
setup(__props) {
|
|
3451
|
-
const props = __props;
|
|
3452
|
-
const slots = useSlots();
|
|
3453
|
-
const {
|
|
3454
|
-
isFocused,
|
|
3455
|
-
isChecked,
|
|
3456
|
-
isDisabled,
|
|
3457
|
-
checkboxButtonSize,
|
|
3458
|
-
model,
|
|
3459
|
-
actualValue,
|
|
3460
|
-
handleChange
|
|
3461
|
-
} = useCheckbox(props, slots);
|
|
3462
|
-
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
3463
|
-
const ns = useNamespace("checkbox");
|
|
3464
|
-
const activeStyle = computed(() => {
|
|
3465
|
-
var _a2, _b, _c, _d;
|
|
3466
|
-
const fillValue = (_b = (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a2.value) != null ? _b : "";
|
|
3467
|
-
return {
|
|
3468
|
-
backgroundColor: fillValue,
|
|
3469
|
-
borderColor: fillValue,
|
|
3470
|
-
color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
|
|
3471
|
-
boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
|
|
3472
|
-
};
|
|
3473
|
-
});
|
|
3474
|
-
const labelKls = computed(() => {
|
|
3475
|
-
return [
|
|
3476
|
-
ns.b("button"),
|
|
3477
|
-
ns.bm("button", checkboxButtonSize.value),
|
|
3478
|
-
ns.is("disabled", isDisabled.value),
|
|
3479
|
-
ns.is("checked", isChecked.value),
|
|
3480
|
-
ns.is("focus", isFocused.value)
|
|
3481
|
-
];
|
|
3482
|
-
});
|
|
3483
|
-
return (_ctx, _cache) => {
|
|
3484
|
-
var _a2, _b, _c, _d;
|
|
3485
|
-
return openBlock(), createElementBlock("label", {
|
|
3486
|
-
class: normalizeClass(unref(labelKls))
|
|
3487
|
-
}, [
|
|
3488
|
-
_ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
|
|
3489
|
-
key: 0,
|
|
3490
|
-
"onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
|
|
3491
|
-
class: normalizeClass(unref(ns).be("button", "original")),
|
|
3492
|
-
type: "checkbox",
|
|
3493
|
-
name: _ctx.name,
|
|
3494
|
-
tabindex: _ctx.tabindex,
|
|
3495
|
-
disabled: unref(isDisabled),
|
|
3496
|
-
"true-value": (_b = (_a2 = _ctx.trueValue) != null ? _a2 : _ctx.trueLabel) != null ? _b : true,
|
|
3497
|
-
"false-value": (_d = (_c = _ctx.falseValue) != null ? _c : _ctx.falseLabel) != null ? _d : false,
|
|
3498
|
-
onChange: unref(handleChange),
|
|
3499
|
-
onFocus: ($event) => isFocused.value = true,
|
|
3500
|
-
onBlur: ($event) => isFocused.value = false,
|
|
3501
|
-
onClick: withModifiers(() => {
|
|
3502
|
-
}, ["stop"])
|
|
3503
|
-
}, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
|
|
3504
|
-
[vModelCheckbox, unref(model)]
|
|
3505
|
-
]) : withDirectives((openBlock(), createElementBlock("input", {
|
|
3506
|
-
key: 1,
|
|
3507
|
-
"onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
|
|
3508
|
-
class: normalizeClass(unref(ns).be("button", "original")),
|
|
3509
|
-
type: "checkbox",
|
|
3510
|
-
name: _ctx.name,
|
|
3511
|
-
tabindex: _ctx.tabindex,
|
|
3512
|
-
disabled: unref(isDisabled),
|
|
3513
|
-
value: unref(actualValue),
|
|
3514
|
-
onChange: unref(handleChange),
|
|
3515
|
-
onFocus: ($event) => isFocused.value = true,
|
|
3516
|
-
onBlur: ($event) => isFocused.value = false,
|
|
3517
|
-
onClick: withModifiers(() => {
|
|
3518
|
-
}, ["stop"])
|
|
3519
|
-
}, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "value", "onChange", "onFocus", "onBlur", "onClick"])), [
|
|
3520
|
-
[vModelCheckbox, unref(model)]
|
|
3521
|
-
]),
|
|
3522
|
-
_ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
|
|
3523
|
-
key: 2,
|
|
3524
|
-
class: normalizeClass(unref(ns).be("button", "inner")),
|
|
3525
|
-
style: normalizeStyle(unref(isChecked) ? unref(activeStyle) : void 0)
|
|
3526
|
-
}, [
|
|
3527
|
-
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
3528
|
-
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
3529
|
-
])
|
|
3530
|
-
], 6)) : createCommentVNode("v-if", true)
|
|
3531
|
-
], 2);
|
|
3532
|
-
};
|
|
3533
|
-
}
|
|
3534
|
-
});
|
|
3535
|
-
var CheckboxButton = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "checkbox-button.vue"]]);
|
|
3536
|
-
const checkboxGroupProps = buildProps({
|
|
3537
|
-
modelValue: {
|
|
3538
|
-
type: definePropType(Array),
|
|
3539
|
-
default: () => []
|
|
3540
|
-
},
|
|
3541
|
-
disabled: Boolean,
|
|
3542
|
-
min: Number,
|
|
3543
|
-
max: Number,
|
|
3544
|
-
size: useSizeProp,
|
|
3545
|
-
fill: String,
|
|
3546
|
-
textColor: String,
|
|
3547
|
-
tag: {
|
|
3548
|
-
type: String,
|
|
3549
|
-
default: "div"
|
|
3550
|
-
},
|
|
3551
|
-
validateEvent: {
|
|
3552
|
-
type: Boolean,
|
|
3553
|
-
default: true
|
|
3554
|
-
},
|
|
3555
|
-
...useAriaProps(["ariaLabel"])
|
|
3556
|
-
});
|
|
3557
|
-
const checkboxGroupEmits = {
|
|
3558
|
-
[UPDATE_MODEL_EVENT]: (val) => isArray$1(val),
|
|
3559
|
-
change: (val) => isArray$1(val)
|
|
3560
|
-
};
|
|
3561
|
-
const __default__ = defineComponent({
|
|
3562
|
-
name: "ElCheckboxGroup"
|
|
3563
|
-
});
|
|
3564
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3565
|
-
...__default__,
|
|
3566
|
-
props: checkboxGroupProps,
|
|
3567
|
-
emits: checkboxGroupEmits,
|
|
3568
|
-
setup(__props, { emit }) {
|
|
3569
|
-
const props = __props;
|
|
3570
|
-
const ns = useNamespace("checkbox");
|
|
3571
|
-
const { formItem } = useFormItem();
|
|
3572
|
-
const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
|
|
3573
|
-
formItemContext: formItem
|
|
3574
|
-
});
|
|
3575
|
-
const changeEvent = async (value) => {
|
|
3576
|
-
emit(UPDATE_MODEL_EVENT, value);
|
|
3577
|
-
await nextTick();
|
|
3578
|
-
emit(CHANGE_EVENT, value);
|
|
3579
|
-
};
|
|
3580
|
-
const modelValue = computed({
|
|
3581
|
-
get() {
|
|
3582
|
-
return props.modelValue;
|
|
3583
|
-
},
|
|
3584
|
-
set(val) {
|
|
3585
|
-
changeEvent(val);
|
|
3586
|
-
}
|
|
3587
|
-
});
|
|
3588
|
-
provide(checkboxGroupContextKey, {
|
|
3589
|
-
...pick(toRefs(props), [
|
|
3590
|
-
"size",
|
|
3591
|
-
"min",
|
|
3592
|
-
"max",
|
|
3593
|
-
"disabled",
|
|
3594
|
-
"validateEvent",
|
|
3595
|
-
"fill",
|
|
3596
|
-
"textColor"
|
|
3597
|
-
]),
|
|
3598
|
-
modelValue,
|
|
3599
|
-
changeEvent
|
|
3600
|
-
});
|
|
3601
|
-
watch(() => props.modelValue, (newVal, oldValue) => {
|
|
3602
|
-
if (props.validateEvent && !isEqual(newVal, oldValue)) {
|
|
3603
|
-
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
|
|
3604
|
-
}
|
|
3605
|
-
});
|
|
3606
|
-
return (_ctx, _cache) => {
|
|
3607
|
-
var _a2;
|
|
3608
|
-
return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
|
|
3609
|
-
id: unref(groupId),
|
|
3610
|
-
class: normalizeClass(unref(ns).b("group")),
|
|
3611
|
-
role: "group",
|
|
3612
|
-
"aria-label": !unref(isLabeledByFormItem) ? _ctx.ariaLabel || "checkbox-group" : void 0,
|
|
3613
|
-
"aria-labelledby": unref(isLabeledByFormItem) ? (_a2 = unref(formItem)) == null ? void 0 : _a2.labelId : void 0
|
|
3614
|
-
}, {
|
|
3615
|
-
default: withCtx(() => [
|
|
3616
|
-
renderSlot(_ctx.$slots, "default")
|
|
3617
|
-
]),
|
|
3618
|
-
_: 3
|
|
3619
|
-
}, 8, ["id", "class", "aria-label", "aria-labelledby"]);
|
|
3620
|
-
};
|
|
3621
|
-
}
|
|
3622
|
-
});
|
|
3623
|
-
var CheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "checkbox-group.vue"]]);
|
|
3624
|
-
const ElCheckbox = withInstall(Checkbox, {
|
|
3625
|
-
CheckboxButton,
|
|
3626
|
-
CheckboxGroup
|
|
3627
|
-
});
|
|
3628
|
-
withNoopInstall(CheckboxButton);
|
|
3629
|
-
withNoopInstall(CheckboxGroup);
|
|
3630
1323
|
class Lines extends THREE.LineSegments {
|
|
3631
1324
|
geometry = new THREE.BufferGeometry();
|
|
3632
1325
|
points = [];
|
|
@@ -3667,6 +1360,225 @@ class Lines extends THREE.LineSegments {
|
|
|
3667
1360
|
});
|
|
3668
1361
|
}
|
|
3669
1362
|
}
|
|
1363
|
+
class DomContainer extends Component {
|
|
1364
|
+
static name = "DomContainer";
|
|
1365
|
+
domElement = document.createElement("div");
|
|
1366
|
+
canvas = document.createElement("canvas");
|
|
1367
|
+
html2DRenderer = document.createElement("div");
|
|
1368
|
+
html3DRenderer = document.createElement("div");
|
|
1369
|
+
constructor() {
|
|
1370
|
+
super();
|
|
1371
|
+
this.domElement.id = "build-dxf-container";
|
|
1372
|
+
this.domElement.appendChild(this.canvas);
|
|
1373
|
+
this.domElement.appendChild(this.html3DRenderer);
|
|
1374
|
+
this.domElement.appendChild(this.html2DRenderer);
|
|
1375
|
+
Object.assign(this.domElement.style, {
|
|
1376
|
+
width: "100%",
|
|
1377
|
+
height: "100%",
|
|
1378
|
+
position: "relative",
|
|
1379
|
+
userSelect: "none"
|
|
1380
|
+
});
|
|
1381
|
+
Object.assign(this.html3DRenderer.style, {
|
|
1382
|
+
position: "absolute",
|
|
1383
|
+
left: 0,
|
|
1384
|
+
top: 0,
|
|
1385
|
+
// zIndex: 9,
|
|
1386
|
+
width: "100%",
|
|
1387
|
+
height: "100%"
|
|
1388
|
+
});
|
|
1389
|
+
Object.assign(this.html2DRenderer.style, {
|
|
1390
|
+
position: "absolute",
|
|
1391
|
+
left: 0,
|
|
1392
|
+
top: 0,
|
|
1393
|
+
// zIndex: 10,
|
|
1394
|
+
width: "100%",
|
|
1395
|
+
height: "100%"
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
class DomEventRegister extends Component {
|
|
1400
|
+
static name = "DomEventRegister";
|
|
1401
|
+
cancelDefaultBehaviorList = [];
|
|
1402
|
+
pointer = new Vector2();
|
|
1403
|
+
_isMouseEnter = false;
|
|
1404
|
+
set isMouseEnter(isMouseEnter) {
|
|
1405
|
+
if (this._isMouseEnter === isMouseEnter) return;
|
|
1406
|
+
this._isMouseEnter = isMouseEnter;
|
|
1407
|
+
}
|
|
1408
|
+
get isMouseEnter() {
|
|
1409
|
+
return this._isMouseEnter;
|
|
1410
|
+
}
|
|
1411
|
+
_mouseMoveEventProxylock = false;
|
|
1412
|
+
set mouseMoveEventProxylock(lock) {
|
|
1413
|
+
this._mouseMoveEventProxylock = lock;
|
|
1414
|
+
if (lock) {
|
|
1415
|
+
this._isMouseEnter = false;
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
get mouseMoveEventProxylock() {
|
|
1419
|
+
return this._mouseMoveEventProxylock;
|
|
1420
|
+
}
|
|
1421
|
+
/**
|
|
1422
|
+
* 组件被添加到父组件上时调用
|
|
1423
|
+
*/
|
|
1424
|
+
onAddFromParent() {
|
|
1425
|
+
this.initMouseMoveEventProxy();
|
|
1426
|
+
this.initKeyEvent();
|
|
1427
|
+
this.initWheelEvent();
|
|
1428
|
+
this.autoBodyCursor();
|
|
1429
|
+
}
|
|
1430
|
+
/**
|
|
1431
|
+
* 初始化鼠标事件代理(判断鼠标是否在domElement上)
|
|
1432
|
+
*/
|
|
1433
|
+
initMouseMoveEventProxy() {
|
|
1434
|
+
const domContainer = this.parent?.findComponentByType(DomContainer), domElement = domContainer.domElement, variable = this.parent?.findComponentByType(Variable), globalMousemoveFun = (e) => {
|
|
1435
|
+
if (this._mouseMoveEventProxylock) return;
|
|
1436
|
+
const rect = domElement.getBoundingClientRect(), offsetX = e.clientX - rect.left, offsetY = e.clientY - rect.top;
|
|
1437
|
+
if (offsetX >= 0 && offsetY >= 0 && offsetX <= rect.width && offsetY <= rect.height) {
|
|
1438
|
+
this.pointer.set(offsetX, offsetY);
|
|
1439
|
+
this.dispatchEvent({
|
|
1440
|
+
type: "mousemove",
|
|
1441
|
+
x: offsetX,
|
|
1442
|
+
y: offsetY,
|
|
1443
|
+
moveX: e.movementX,
|
|
1444
|
+
moveY: e.movementY
|
|
1445
|
+
});
|
|
1446
|
+
this.isMouseEnter = true;
|
|
1447
|
+
} else {
|
|
1448
|
+
this.isMouseEnter = false;
|
|
1449
|
+
}
|
|
1450
|
+
}, globalMousedownFun = (e) => {
|
|
1451
|
+
if (!this.isMouseEnter) return;
|
|
1452
|
+
const rect = domElement.getBoundingClientRect(), offsetX = e.clientX - rect.left, offsetY = e.clientY - rect.top;
|
|
1453
|
+
this.pointer.set(offsetX, offsetY);
|
|
1454
|
+
variable.set("currentMouseDown", "mouse_" + e.button);
|
|
1455
|
+
this.dispatchEvent({
|
|
1456
|
+
type: "mousedown",
|
|
1457
|
+
x: offsetX,
|
|
1458
|
+
y: offsetY
|
|
1459
|
+
});
|
|
1460
|
+
}, globalMouseupFun = (e) => {
|
|
1461
|
+
if (!this.isMouseEnter) return;
|
|
1462
|
+
variable.set("currentMouseUp", "mouse_" + e.button);
|
|
1463
|
+
};
|
|
1464
|
+
document.addEventListener("mousemove", globalMousemoveFun);
|
|
1465
|
+
document.addEventListener("mousedown", globalMousedownFun);
|
|
1466
|
+
document.addEventListener("mouseup", globalMouseupFun);
|
|
1467
|
+
this.addEventRecord("destory", () => {
|
|
1468
|
+
document.removeEventListener("mousemove", globalMousemoveFun);
|
|
1469
|
+
document.removeEventListener("mousedown", globalMousedownFun);
|
|
1470
|
+
document.removeEventListener("mouseup", globalMouseupFun);
|
|
1471
|
+
});
|
|
1472
|
+
}
|
|
1473
|
+
/**
|
|
1474
|
+
* 初始化键盘事件
|
|
1475
|
+
*/
|
|
1476
|
+
initKeyEvent() {
|
|
1477
|
+
const variable = this.parent?.findComponentByType(Variable);
|
|
1478
|
+
document.body.tabIndex = 1;
|
|
1479
|
+
const onKeyup = (e) => {
|
|
1480
|
+
if (!this.isMouseEnter) return;
|
|
1481
|
+
const key = e.key.toLocaleLowerCase();
|
|
1482
|
+
variable.set("currentKeyUp", key);
|
|
1483
|
+
for (let i = 0; i < this.cancelDefaultBehaviorList.length; i++) {
|
|
1484
|
+
const element = this.cancelDefaultBehaviorList[i];
|
|
1485
|
+
if (element(e)) e.preventDefault();
|
|
1486
|
+
}
|
|
1487
|
+
};
|
|
1488
|
+
document.body.addEventListener("keyup", onKeyup);
|
|
1489
|
+
const onKeydown = (e) => {
|
|
1490
|
+
if (!this.isMouseEnter) return;
|
|
1491
|
+
const key = e.key.toLocaleLowerCase();
|
|
1492
|
+
variable.set("currentKeyDown", key);
|
|
1493
|
+
for (let i = 0; i < this.cancelDefaultBehaviorList.length; i++) {
|
|
1494
|
+
const element = this.cancelDefaultBehaviorList[i];
|
|
1495
|
+
if (element(e)) e.preventDefault();
|
|
1496
|
+
}
|
|
1497
|
+
};
|
|
1498
|
+
document.body.addEventListener("keydown", onKeydown);
|
|
1499
|
+
const onFocus = () => variable.set("focus", true);
|
|
1500
|
+
document.body.addEventListener("focus", onFocus);
|
|
1501
|
+
const onBlur = () => variable.set("focus", false);
|
|
1502
|
+
document.body.addEventListener("blur", onBlur);
|
|
1503
|
+
this.addEventRecord("destory", () => {
|
|
1504
|
+
document.body.removeEventListener("keyup", onKeyup);
|
|
1505
|
+
document.body.removeEventListener("keydown", onKeydown);
|
|
1506
|
+
document.body.removeEventListener("focus", onFocus);
|
|
1507
|
+
document.body.removeEventListener("blur", onBlur);
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1510
|
+
/**
|
|
1511
|
+
* 初始化滚轮事件
|
|
1512
|
+
*/
|
|
1513
|
+
initWheelEvent() {
|
|
1514
|
+
const variable = this.parent?.findComponentByType(Variable);
|
|
1515
|
+
const onWheel = (e) => variable.set("currentWheel", e.wheelDelta);
|
|
1516
|
+
document.body.addEventListener("wheel", onWheel);
|
|
1517
|
+
this.addEventRecord("destory", () => {
|
|
1518
|
+
document.body.removeEventListener("wheel", onWheel);
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
/**
|
|
1522
|
+
* 根据domElement的cursor自动设置body的cursor
|
|
1523
|
+
*/
|
|
1524
|
+
autoBodyCursor() {
|
|
1525
|
+
const domContainer = this.parent?.findComponentByType(DomContainer), domElement = domContainer.domElement;
|
|
1526
|
+
let bodyCursor = null;
|
|
1527
|
+
this.addEventListener("update", () => {
|
|
1528
|
+
if (this._mouseMoveEventProxylock) return;
|
|
1529
|
+
if (this.isMouseEnter) {
|
|
1530
|
+
if (bodyCursor === null) {
|
|
1531
|
+
bodyCursor = document.body.style.cursor;
|
|
1532
|
+
}
|
|
1533
|
+
document.body.style.cursor = domElement.style.cursor;
|
|
1534
|
+
} else {
|
|
1535
|
+
if (bodyCursor !== null) {
|
|
1536
|
+
document.body.style.cursor = bodyCursor;
|
|
1537
|
+
bodyCursor = null;
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
});
|
|
1541
|
+
}
|
|
1542
|
+
/**
|
|
1543
|
+
*
|
|
1544
|
+
* @param callBack
|
|
1545
|
+
*/
|
|
1546
|
+
addCancelDefaultBehavior(callBack) {
|
|
1547
|
+
this.cancelDefaultBehaviorList.push(callBack);
|
|
1548
|
+
return this;
|
|
1549
|
+
}
|
|
1550
|
+
/**
|
|
1551
|
+
*
|
|
1552
|
+
* @param el
|
|
1553
|
+
* @param callBack
|
|
1554
|
+
* @param offset
|
|
1555
|
+
* @param condition
|
|
1556
|
+
*/
|
|
1557
|
+
static dragMoveHelper(el, callBack, offset = { x: 0, y: 0 }, condition = () => true) {
|
|
1558
|
+
function onMousedown() {
|
|
1559
|
+
if (!condition()) return;
|
|
1560
|
+
const move = (e) => {
|
|
1561
|
+
offset.x += e.movementX;
|
|
1562
|
+
offset.y += e.movementY;
|
|
1563
|
+
callBack({ ...offset }, e.movementX, e.movementY);
|
|
1564
|
+
};
|
|
1565
|
+
const end = () => {
|
|
1566
|
+
document.removeEventListener("mousemove", move);
|
|
1567
|
+
document.removeEventListener("mouseup", end);
|
|
1568
|
+
};
|
|
1569
|
+
document.addEventListener("mousemove", move);
|
|
1570
|
+
document.addEventListener("mouseup", end);
|
|
1571
|
+
}
|
|
1572
|
+
el.addEventListener("mousedown", onMousedown);
|
|
1573
|
+
callBack({ ...offset }, 0, 0);
|
|
1574
|
+
return () => {
|
|
1575
|
+
el.removeEventListener("mousedown", onMousedown);
|
|
1576
|
+
};
|
|
1577
|
+
}
|
|
1578
|
+
destroy() {
|
|
1579
|
+
this.canceEventRecord("destory");
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
3670
1582
|
function selectLocalFileFun() {
|
|
3671
1583
|
return new Promise((resolve) => {
|
|
3672
1584
|
const input = document.createElement("input");
|
|
@@ -3710,36 +1622,64 @@ const SelectLocalFile = Object.assign(selectLocalFileFun, {
|
|
|
3710
1622
|
}
|
|
3711
1623
|
});
|
|
3712
1624
|
export {
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
1625
|
+
useGlobalComponentSettings as $,
|
|
1626
|
+
isString$1 as A,
|
|
1627
|
+
isNumber as B,
|
|
1628
|
+
isBoolean as C,
|
|
1629
|
+
isUndefined as D,
|
|
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,
|
|
1643
|
+
Renderer as R,
|
|
1644
|
+
Symbol$1 as S,
|
|
1645
|
+
tryOnScopeDispose as T,
|
|
1646
|
+
isClient as U,
|
|
1647
|
+
tryOnMounted as V,
|
|
1648
|
+
identity as W,
|
|
1649
|
+
addUnit as X,
|
|
1650
|
+
useEmptyValuesProps as Y,
|
|
1651
|
+
provideGlobalConfig as Z,
|
|
3718
1652
|
_export_sfc as _,
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
1653
|
+
isObjectLike as a,
|
|
1654
|
+
TypeComponentsMap as a0,
|
|
1655
|
+
TypeComponents as a1,
|
|
1656
|
+
useTimeoutFn as a2,
|
|
1657
|
+
isFunction$1 as a3,
|
|
1658
|
+
isElement as a4,
|
|
1659
|
+
withInstallFunction as a5,
|
|
1660
|
+
baseGetTag as b,
|
|
1661
|
+
isArray as c,
|
|
1662
|
+
MapCache as d,
|
|
1663
|
+
eq as e,
|
|
1664
|
+
freeGlobal as f,
|
|
1665
|
+
getNative as g,
|
|
1666
|
+
castPath as h,
|
|
1667
|
+
isFunction as i,
|
|
1668
|
+
toKey as j,
|
|
1669
|
+
isObject as k,
|
|
1670
|
+
baseGet as l,
|
|
1671
|
+
buildProps as m,
|
|
1672
|
+
computedEager as n,
|
|
1673
|
+
useGlobalSize as o,
|
|
1674
|
+
useGlobalConfig as p,
|
|
1675
|
+
definePropType as q,
|
|
1676
|
+
root as r,
|
|
1677
|
+
loading_default as s,
|
|
1678
|
+
toSource as t,
|
|
1679
|
+
useGetDerivedNamespace as u,
|
|
1680
|
+
iconPropType as v,
|
|
1681
|
+
useSizeProp as w,
|
|
1682
|
+
useNamespace as x,
|
|
1683
|
+
withInstall as y,
|
|
1684
|
+
withNoopInstall as z
|
|
3745
1685
|
};
|