@factoringplus/pl-components-pack-v3 0.1.13 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pl-components-pack-v3.es.js +45 -1157
- package/dist/pl-components-pack-v3.umd.js +3 -3
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import { defineComponent, openBlock, createElementBlock, createElementVNode, warn, getCurrentInstance, computed, ref, inject, unref, mergeProps, renderSlot, shallowRef, watch, nextTick, onMounted, onUpdated, resolveComponent, withDirectives, normalizeClass, normalizeStyle, createCommentVNode, Fragment, createBlock, withCtx, resolveDynamicComponent, withModifiers, createVNode, toDisplayString, vShow,
|
|
20
|
+
import { defineComponent, openBlock, createElementBlock, createElementVNode, warn, getCurrentInstance, computed, ref, inject, unref, mergeProps, renderSlot, shallowRef, watch, nextTick, onMounted, onUpdated, resolveComponent, withDirectives, normalizeClass, normalizeStyle, createCommentVNode, Fragment, createBlock, withCtx, resolveDynamicComponent, withModifiers, createVNode, toDisplayString, vShow, onUnmounted, reactive } from "vue";
|
|
21
21
|
function fromPairs(pairs) {
|
|
22
22
|
var index = -1, length = pairs == null ? 0 : pairs.length, result = {};
|
|
23
23
|
while (++index < length) {
|
|
@@ -28,8 +28,6 @@ function fromPairs(pairs) {
|
|
|
28
28
|
}
|
|
29
29
|
const isClient = typeof window !== "undefined";
|
|
30
30
|
const isNumber = (val) => typeof val === "number";
|
|
31
|
-
const NOOP = () => {
|
|
32
|
-
};
|
|
33
31
|
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
34
32
|
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
|
35
33
|
const isString = (val) => typeof val === "string";
|
|
@@ -42,17 +40,17 @@ var _export_sfc$1 = (sfc, props) => {
|
|
|
42
40
|
}
|
|
43
41
|
return target;
|
|
44
42
|
};
|
|
45
|
-
const _sfc_main$
|
|
43
|
+
const _sfc_main$6 = defineComponent({
|
|
46
44
|
name: "CircleCheck"
|
|
47
45
|
});
|
|
48
|
-
const _hoisted_1$
|
|
46
|
+
const _hoisted_1$5 = {
|
|
49
47
|
class: "icon",
|
|
50
48
|
width: "200",
|
|
51
49
|
height: "200",
|
|
52
50
|
viewBox: "0 0 1024 1024",
|
|
53
51
|
xmlns: "http://www.w3.org/2000/svg"
|
|
54
52
|
};
|
|
55
|
-
const _hoisted_2$
|
|
53
|
+
const _hoisted_2$4 = /* @__PURE__ */ createElementVNode("path", {
|
|
56
54
|
fill: "currentColor",
|
|
57
55
|
d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"
|
|
58
56
|
}, null, -1);
|
|
@@ -61,24 +59,24 @@ const _hoisted_3$3 = /* @__PURE__ */ createElementVNode("path", {
|
|
|
61
59
|
d: "M745.344 361.344a32 32 0 0145.312 45.312l-288 288a32 32 0 01-45.312 0l-160-160a32 32 0 1145.312-45.312L480 626.752l265.344-265.408z"
|
|
62
60
|
}, null, -1);
|
|
63
61
|
const _hoisted_4$1 = [
|
|
64
|
-
_hoisted_2$
|
|
62
|
+
_hoisted_2$4,
|
|
65
63
|
_hoisted_3$3
|
|
66
64
|
];
|
|
67
65
|
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
68
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
66
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$5, _hoisted_4$1);
|
|
69
67
|
}
|
|
70
|
-
var circleCheck = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
71
|
-
const _sfc_main$
|
|
68
|
+
var circleCheck = /* @__PURE__ */ _export_sfc$1(_sfc_main$6, [["render", _sfc_render$4]]);
|
|
69
|
+
const _sfc_main$5 = defineComponent({
|
|
72
70
|
name: "CircleClose"
|
|
73
71
|
});
|
|
74
|
-
const _hoisted_1$
|
|
72
|
+
const _hoisted_1$4 = {
|
|
75
73
|
class: "icon",
|
|
76
74
|
width: "200",
|
|
77
75
|
height: "200",
|
|
78
76
|
viewBox: "0 0 1024 1024",
|
|
79
77
|
xmlns: "http://www.w3.org/2000/svg"
|
|
80
78
|
};
|
|
81
|
-
const _hoisted_2$
|
|
79
|
+
const _hoisted_2$3 = /* @__PURE__ */ createElementVNode("path", {
|
|
82
80
|
fill: "currentColor",
|
|
83
81
|
d: "M466.752 512l-90.496-90.496a32 32 0 0145.248-45.248L512 466.752l90.496-90.496a32 32 0 1145.248 45.248L557.248 512l90.496 90.496a32 32 0 11-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 01-45.248-45.248L466.752 512z"
|
|
84
82
|
}, null, -1);
|
|
@@ -87,55 +85,55 @@ const _hoisted_3$2 = /* @__PURE__ */ createElementVNode("path", {
|
|
|
87
85
|
d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"
|
|
88
86
|
}, null, -1);
|
|
89
87
|
const _hoisted_4 = [
|
|
90
|
-
_hoisted_2$
|
|
88
|
+
_hoisted_2$3,
|
|
91
89
|
_hoisted_3$2
|
|
92
90
|
];
|
|
93
91
|
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
94
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
92
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$4, _hoisted_4);
|
|
95
93
|
}
|
|
96
|
-
var circleClose = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
97
|
-
const _sfc_main$
|
|
94
|
+
var circleClose = /* @__PURE__ */ _export_sfc$1(_sfc_main$5, [["render", _sfc_render$3]]);
|
|
95
|
+
const _sfc_main$4 = defineComponent({
|
|
98
96
|
name: "Loading"
|
|
99
97
|
});
|
|
100
|
-
const _hoisted_1$
|
|
98
|
+
const _hoisted_1$3 = {
|
|
101
99
|
class: "icon",
|
|
102
100
|
width: "200",
|
|
103
101
|
height: "200",
|
|
104
102
|
viewBox: "0 0 1024 1024",
|
|
105
103
|
xmlns: "http://www.w3.org/2000/svg"
|
|
106
104
|
};
|
|
107
|
-
const _hoisted_2$
|
|
105
|
+
const _hoisted_2$2 = /* @__PURE__ */ createElementVNode("path", {
|
|
108
106
|
fill: "currentColor",
|
|
109
107
|
d: "M512 64a32 32 0 0132 32v192a32 32 0 01-64 0V96a32 32 0 0132-32zm0 640a32 32 0 0132 32v192a32 32 0 11-64 0V736a32 32 0 0132-32zm448-192a32 32 0 01-32 32H736a32 32 0 110-64h192a32 32 0 0132 32zm-640 0a32 32 0 01-32 32H96a32 32 0 010-64h192a32 32 0 0132 32zM195.2 195.2a32 32 0 0145.248 0L376.32 331.008a32 32 0 01-45.248 45.248L195.2 240.448a32 32 0 010-45.248zm452.544 452.544a32 32 0 0145.248 0L828.8 783.552a32 32 0 01-45.248 45.248L647.744 692.992a32 32 0 010-45.248zM828.8 195.264a32 32 0 010 45.184L692.992 376.32a32 32 0 01-45.248-45.248l135.808-135.808a32 32 0 0145.248 0zm-452.544 452.48a32 32 0 010 45.248L240.448 828.8a32 32 0 01-45.248-45.248l135.808-135.808a32 32 0 0145.248 0z"
|
|
110
108
|
}, null, -1);
|
|
111
109
|
const _hoisted_3$1 = [
|
|
112
|
-
_hoisted_2$
|
|
110
|
+
_hoisted_2$2
|
|
113
111
|
];
|
|
114
112
|
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
115
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
113
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$3, _hoisted_3$1);
|
|
116
114
|
}
|
|
117
|
-
var loading = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
118
|
-
const _sfc_main$
|
|
115
|
+
var loading = /* @__PURE__ */ _export_sfc$1(_sfc_main$4, [["render", _sfc_render$2]]);
|
|
116
|
+
const _sfc_main$3 = defineComponent({
|
|
119
117
|
name: "View"
|
|
120
118
|
});
|
|
121
|
-
const _hoisted_1$
|
|
119
|
+
const _hoisted_1$2 = {
|
|
122
120
|
class: "icon",
|
|
123
121
|
width: "200",
|
|
124
122
|
height: "200",
|
|
125
123
|
viewBox: "0 0 1024 1024",
|
|
126
124
|
xmlns: "http://www.w3.org/2000/svg"
|
|
127
125
|
};
|
|
128
|
-
const _hoisted_2$
|
|
126
|
+
const _hoisted_2$1 = /* @__PURE__ */ createElementVNode("path", {
|
|
129
127
|
fill: "currentColor",
|
|
130
128
|
d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 110 448 224 224 0 010-448zm0 64a160.192 160.192 0 00-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"
|
|
131
129
|
}, null, -1);
|
|
132
130
|
const _hoisted_3 = [
|
|
133
|
-
_hoisted_2$
|
|
131
|
+
_hoisted_2$1
|
|
134
132
|
];
|
|
135
133
|
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
136
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
134
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$2, _hoisted_3);
|
|
137
135
|
}
|
|
138
|
-
var view = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
136
|
+
var view = /* @__PURE__ */ _export_sfc$1(_sfc_main$3, [["render", _sfc_render$1]]);
|
|
139
137
|
const wrapperKey = Symbol();
|
|
140
138
|
const propKey = "__elPropsReservedKey";
|
|
141
139
|
function buildProp(option, key) {
|
|
@@ -198,10 +196,6 @@ const withInstall = (main, extra) => {
|
|
|
198
196
|
}
|
|
199
197
|
return main;
|
|
200
198
|
};
|
|
201
|
-
const withNoopInstall = (component) => {
|
|
202
|
-
component.install = NOOP;
|
|
203
|
-
return component;
|
|
204
|
-
};
|
|
205
199
|
function addUnit(value, defaultUnit = "px") {
|
|
206
200
|
if (!value)
|
|
207
201
|
return "";
|
|
@@ -231,7 +225,6 @@ const useAttrs = (params = {}) => {
|
|
|
231
225
|
};
|
|
232
226
|
const elFormKey = Symbol("elForm");
|
|
233
227
|
const elFormItemKey = Symbol("elFormItem");
|
|
234
|
-
const buttonGroupContextKey = Symbol("buttonGroupContextKey");
|
|
235
228
|
const configProviderContextKey = Symbol();
|
|
236
229
|
const useProp = (name) => {
|
|
237
230
|
const vm = getCurrentInstance();
|
|
@@ -327,11 +320,11 @@ const iconProps = buildProps({
|
|
|
327
320
|
type: String
|
|
328
321
|
}
|
|
329
322
|
});
|
|
330
|
-
const __default__$
|
|
323
|
+
const __default__$1 = {
|
|
331
324
|
name: "ElIcon",
|
|
332
325
|
inheritAttrs: false
|
|
333
326
|
};
|
|
334
|
-
const _sfc_main$
|
|
327
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
|
|
335
328
|
props: iconProps,
|
|
336
329
|
setup(__props) {
|
|
337
330
|
const props = __props;
|
|
@@ -354,7 +347,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
354
347
|
};
|
|
355
348
|
}
|
|
356
349
|
}));
|
|
357
|
-
const ElIcon = withInstall(_sfc_main$
|
|
350
|
+
const ElIcon = withInstall(_sfc_main$2);
|
|
358
351
|
let hiddenTextarea = void 0;
|
|
359
352
|
const HIDDEN_STYLE = `
|
|
360
353
|
height:0 !important;
|
|
@@ -522,7 +515,7 @@ const PENDANT_MAP = {
|
|
|
522
515
|
suffix: "append",
|
|
523
516
|
prefix: "prepend"
|
|
524
517
|
};
|
|
525
|
-
const _sfc_main$
|
|
518
|
+
const _sfc_main$1 = defineComponent({
|
|
526
519
|
name: "ElInput",
|
|
527
520
|
components: { ElIcon, CircleClose: circleClose, IconView: view },
|
|
528
521
|
inheritAttrs: false,
|
|
@@ -744,8 +737,8 @@ const _sfc_main$4 = defineComponent({
|
|
|
744
737
|
};
|
|
745
738
|
}
|
|
746
739
|
});
|
|
747
|
-
const _hoisted_1$
|
|
748
|
-
const _hoisted_2
|
|
740
|
+
const _hoisted_1$1 = ["type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder"];
|
|
741
|
+
const _hoisted_2 = ["tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder"];
|
|
749
742
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
750
743
|
const _component_el_icon = resolveComponent("el-icon");
|
|
751
744
|
const _component_circle_close = resolveComponent("circle-close");
|
|
@@ -799,7 +792,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
799
792
|
onBlur: _cache[5] || (_cache[5] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
|
|
800
793
|
onChange: _cache[6] || (_cache[6] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
|
|
801
794
|
onKeydown: _cache[7] || (_cache[7] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args))
|
|
802
|
-
}), null, 16, _hoisted_1$
|
|
795
|
+
}), null, 16, _hoisted_1$1),
|
|
803
796
|
createCommentVNode(" prefix slot "),
|
|
804
797
|
_ctx.$slots.prefix || _ctx.prefixIcon ? (openBlock(), createElementBlock("span", {
|
|
805
798
|
key: 1,
|
|
@@ -909,7 +902,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
909
902
|
onBlur: _cache[14] || (_cache[14] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
|
|
910
903
|
onChange: _cache[15] || (_cache[15] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
|
|
911
904
|
onKeydown: _cache[16] || (_cache[16] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args))
|
|
912
|
-
}), null, 16, _hoisted_2
|
|
905
|
+
}), null, 16, _hoisted_2),
|
|
913
906
|
_ctx.isWordLimitVisible ? (openBlock(), createElementBlock("span", {
|
|
914
907
|
key: 0,
|
|
915
908
|
class: normalizeClass(_ctx.nsInput.e("count"))
|
|
@@ -919,1122 +912,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
919
912
|
[vShow, _ctx.type !== "hidden"]
|
|
920
913
|
]);
|
|
921
914
|
}
|
|
922
|
-
var Input = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
915
|
+
var Input = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render]]);
|
|
923
916
|
const ElInput = withInstall(Input);
|
|
924
|
-
function bound01(n, max) {
|
|
925
|
-
if (isOnePointZero(n)) {
|
|
926
|
-
n = "100%";
|
|
927
|
-
}
|
|
928
|
-
var isPercent = isPercentage(n);
|
|
929
|
-
n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
|
|
930
|
-
if (isPercent) {
|
|
931
|
-
n = parseInt(String(n * max), 10) / 100;
|
|
932
|
-
}
|
|
933
|
-
if (Math.abs(n - max) < 1e-6) {
|
|
934
|
-
return 1;
|
|
935
|
-
}
|
|
936
|
-
if (max === 360) {
|
|
937
|
-
n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
|
|
938
|
-
} else {
|
|
939
|
-
n = n % max / parseFloat(String(max));
|
|
940
|
-
}
|
|
941
|
-
return n;
|
|
942
|
-
}
|
|
943
|
-
function clamp01(val) {
|
|
944
|
-
return Math.min(1, Math.max(0, val));
|
|
945
|
-
}
|
|
946
|
-
function isOnePointZero(n) {
|
|
947
|
-
return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
|
|
948
|
-
}
|
|
949
|
-
function isPercentage(n) {
|
|
950
|
-
return typeof n === "string" && n.indexOf("%") !== -1;
|
|
951
|
-
}
|
|
952
|
-
function boundAlpha(a) {
|
|
953
|
-
a = parseFloat(a);
|
|
954
|
-
if (isNaN(a) || a < 0 || a > 1) {
|
|
955
|
-
a = 1;
|
|
956
|
-
}
|
|
957
|
-
return a;
|
|
958
|
-
}
|
|
959
|
-
function convertToPercentage(n) {
|
|
960
|
-
if (n <= 1) {
|
|
961
|
-
return Number(n) * 100 + "%";
|
|
962
|
-
}
|
|
963
|
-
return n;
|
|
964
|
-
}
|
|
965
|
-
function pad2(c) {
|
|
966
|
-
return c.length === 1 ? "0" + c : String(c);
|
|
967
|
-
}
|
|
968
|
-
function rgbToRgb(r, g, b) {
|
|
969
|
-
return {
|
|
970
|
-
r: bound01(r, 255) * 255,
|
|
971
|
-
g: bound01(g, 255) * 255,
|
|
972
|
-
b: bound01(b, 255) * 255
|
|
973
|
-
};
|
|
974
|
-
}
|
|
975
|
-
function rgbToHsl(r, g, b) {
|
|
976
|
-
r = bound01(r, 255);
|
|
977
|
-
g = bound01(g, 255);
|
|
978
|
-
b = bound01(b, 255);
|
|
979
|
-
var max = Math.max(r, g, b);
|
|
980
|
-
var min = Math.min(r, g, b);
|
|
981
|
-
var h = 0;
|
|
982
|
-
var s = 0;
|
|
983
|
-
var l = (max + min) / 2;
|
|
984
|
-
if (max === min) {
|
|
985
|
-
s = 0;
|
|
986
|
-
h = 0;
|
|
987
|
-
} else {
|
|
988
|
-
var d = max - min;
|
|
989
|
-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
990
|
-
switch (max) {
|
|
991
|
-
case r:
|
|
992
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
993
|
-
break;
|
|
994
|
-
case g:
|
|
995
|
-
h = (b - r) / d + 2;
|
|
996
|
-
break;
|
|
997
|
-
case b:
|
|
998
|
-
h = (r - g) / d + 4;
|
|
999
|
-
break;
|
|
1000
|
-
}
|
|
1001
|
-
h /= 6;
|
|
1002
|
-
}
|
|
1003
|
-
return { h, s, l };
|
|
1004
|
-
}
|
|
1005
|
-
function hue2rgb(p, q, t) {
|
|
1006
|
-
if (t < 0) {
|
|
1007
|
-
t += 1;
|
|
1008
|
-
}
|
|
1009
|
-
if (t > 1) {
|
|
1010
|
-
t -= 1;
|
|
1011
|
-
}
|
|
1012
|
-
if (t < 1 / 6) {
|
|
1013
|
-
return p + (q - p) * (6 * t);
|
|
1014
|
-
}
|
|
1015
|
-
if (t < 1 / 2) {
|
|
1016
|
-
return q;
|
|
1017
|
-
}
|
|
1018
|
-
if (t < 2 / 3) {
|
|
1019
|
-
return p + (q - p) * (2 / 3 - t) * 6;
|
|
1020
|
-
}
|
|
1021
|
-
return p;
|
|
1022
|
-
}
|
|
1023
|
-
function hslToRgb(h, s, l) {
|
|
1024
|
-
var r;
|
|
1025
|
-
var g;
|
|
1026
|
-
var b;
|
|
1027
|
-
h = bound01(h, 360);
|
|
1028
|
-
s = bound01(s, 100);
|
|
1029
|
-
l = bound01(l, 100);
|
|
1030
|
-
if (s === 0) {
|
|
1031
|
-
g = l;
|
|
1032
|
-
b = l;
|
|
1033
|
-
r = l;
|
|
1034
|
-
} else {
|
|
1035
|
-
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
1036
|
-
var p = 2 * l - q;
|
|
1037
|
-
r = hue2rgb(p, q, h + 1 / 3);
|
|
1038
|
-
g = hue2rgb(p, q, h);
|
|
1039
|
-
b = hue2rgb(p, q, h - 1 / 3);
|
|
1040
|
-
}
|
|
1041
|
-
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
1042
|
-
}
|
|
1043
|
-
function rgbToHsv(r, g, b) {
|
|
1044
|
-
r = bound01(r, 255);
|
|
1045
|
-
g = bound01(g, 255);
|
|
1046
|
-
b = bound01(b, 255);
|
|
1047
|
-
var max = Math.max(r, g, b);
|
|
1048
|
-
var min = Math.min(r, g, b);
|
|
1049
|
-
var h = 0;
|
|
1050
|
-
var v = max;
|
|
1051
|
-
var d = max - min;
|
|
1052
|
-
var s = max === 0 ? 0 : d / max;
|
|
1053
|
-
if (max === min) {
|
|
1054
|
-
h = 0;
|
|
1055
|
-
} else {
|
|
1056
|
-
switch (max) {
|
|
1057
|
-
case r:
|
|
1058
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
1059
|
-
break;
|
|
1060
|
-
case g:
|
|
1061
|
-
h = (b - r) / d + 2;
|
|
1062
|
-
break;
|
|
1063
|
-
case b:
|
|
1064
|
-
h = (r - g) / d + 4;
|
|
1065
|
-
break;
|
|
1066
|
-
}
|
|
1067
|
-
h /= 6;
|
|
1068
|
-
}
|
|
1069
|
-
return { h, s, v };
|
|
1070
|
-
}
|
|
1071
|
-
function hsvToRgb(h, s, v) {
|
|
1072
|
-
h = bound01(h, 360) * 6;
|
|
1073
|
-
s = bound01(s, 100);
|
|
1074
|
-
v = bound01(v, 100);
|
|
1075
|
-
var i = Math.floor(h);
|
|
1076
|
-
var f = h - i;
|
|
1077
|
-
var p = v * (1 - s);
|
|
1078
|
-
var q = v * (1 - f * s);
|
|
1079
|
-
var t = v * (1 - (1 - f) * s);
|
|
1080
|
-
var mod = i % 6;
|
|
1081
|
-
var r = [v, q, p, p, t, v][mod];
|
|
1082
|
-
var g = [t, v, v, q, p, p][mod];
|
|
1083
|
-
var b = [p, p, t, v, v, q][mod];
|
|
1084
|
-
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
1085
|
-
}
|
|
1086
|
-
function rgbToHex(r, g, b, allow3Char) {
|
|
1087
|
-
var hex = [
|
|
1088
|
-
pad2(Math.round(r).toString(16)),
|
|
1089
|
-
pad2(Math.round(g).toString(16)),
|
|
1090
|
-
pad2(Math.round(b).toString(16))
|
|
1091
|
-
];
|
|
1092
|
-
if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
|
|
1093
|
-
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
1094
|
-
}
|
|
1095
|
-
return hex.join("");
|
|
1096
|
-
}
|
|
1097
|
-
function rgbaToHex(r, g, b, a, allow4Char) {
|
|
1098
|
-
var hex = [
|
|
1099
|
-
pad2(Math.round(r).toString(16)),
|
|
1100
|
-
pad2(Math.round(g).toString(16)),
|
|
1101
|
-
pad2(Math.round(b).toString(16)),
|
|
1102
|
-
pad2(convertDecimalToHex(a))
|
|
1103
|
-
];
|
|
1104
|
-
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))) {
|
|
1105
|
-
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
|
|
1106
|
-
}
|
|
1107
|
-
return hex.join("");
|
|
1108
|
-
}
|
|
1109
|
-
function convertDecimalToHex(d) {
|
|
1110
|
-
return Math.round(parseFloat(d) * 255).toString(16);
|
|
1111
|
-
}
|
|
1112
|
-
function convertHexToDecimal(h) {
|
|
1113
|
-
return parseIntFromHex(h) / 255;
|
|
1114
|
-
}
|
|
1115
|
-
function parseIntFromHex(val) {
|
|
1116
|
-
return parseInt(val, 16);
|
|
1117
|
-
}
|
|
1118
|
-
function numberInputToObject(color) {
|
|
1119
|
-
return {
|
|
1120
|
-
r: color >> 16,
|
|
1121
|
-
g: (color & 65280) >> 8,
|
|
1122
|
-
b: color & 255
|
|
1123
|
-
};
|
|
1124
|
-
}
|
|
1125
|
-
var names = {
|
|
1126
|
-
aliceblue: "#f0f8ff",
|
|
1127
|
-
antiquewhite: "#faebd7",
|
|
1128
|
-
aqua: "#00ffff",
|
|
1129
|
-
aquamarine: "#7fffd4",
|
|
1130
|
-
azure: "#f0ffff",
|
|
1131
|
-
beige: "#f5f5dc",
|
|
1132
|
-
bisque: "#ffe4c4",
|
|
1133
|
-
black: "#000000",
|
|
1134
|
-
blanchedalmond: "#ffebcd",
|
|
1135
|
-
blue: "#0000ff",
|
|
1136
|
-
blueviolet: "#8a2be2",
|
|
1137
|
-
brown: "#a52a2a",
|
|
1138
|
-
burlywood: "#deb887",
|
|
1139
|
-
cadetblue: "#5f9ea0",
|
|
1140
|
-
chartreuse: "#7fff00",
|
|
1141
|
-
chocolate: "#d2691e",
|
|
1142
|
-
coral: "#ff7f50",
|
|
1143
|
-
cornflowerblue: "#6495ed",
|
|
1144
|
-
cornsilk: "#fff8dc",
|
|
1145
|
-
crimson: "#dc143c",
|
|
1146
|
-
cyan: "#00ffff",
|
|
1147
|
-
darkblue: "#00008b",
|
|
1148
|
-
darkcyan: "#008b8b",
|
|
1149
|
-
darkgoldenrod: "#b8860b",
|
|
1150
|
-
darkgray: "#a9a9a9",
|
|
1151
|
-
darkgreen: "#006400",
|
|
1152
|
-
darkgrey: "#a9a9a9",
|
|
1153
|
-
darkkhaki: "#bdb76b",
|
|
1154
|
-
darkmagenta: "#8b008b",
|
|
1155
|
-
darkolivegreen: "#556b2f",
|
|
1156
|
-
darkorange: "#ff8c00",
|
|
1157
|
-
darkorchid: "#9932cc",
|
|
1158
|
-
darkred: "#8b0000",
|
|
1159
|
-
darksalmon: "#e9967a",
|
|
1160
|
-
darkseagreen: "#8fbc8f",
|
|
1161
|
-
darkslateblue: "#483d8b",
|
|
1162
|
-
darkslategray: "#2f4f4f",
|
|
1163
|
-
darkslategrey: "#2f4f4f",
|
|
1164
|
-
darkturquoise: "#00ced1",
|
|
1165
|
-
darkviolet: "#9400d3",
|
|
1166
|
-
deeppink: "#ff1493",
|
|
1167
|
-
deepskyblue: "#00bfff",
|
|
1168
|
-
dimgray: "#696969",
|
|
1169
|
-
dimgrey: "#696969",
|
|
1170
|
-
dodgerblue: "#1e90ff",
|
|
1171
|
-
firebrick: "#b22222",
|
|
1172
|
-
floralwhite: "#fffaf0",
|
|
1173
|
-
forestgreen: "#228b22",
|
|
1174
|
-
fuchsia: "#ff00ff",
|
|
1175
|
-
gainsboro: "#dcdcdc",
|
|
1176
|
-
ghostwhite: "#f8f8ff",
|
|
1177
|
-
goldenrod: "#daa520",
|
|
1178
|
-
gold: "#ffd700",
|
|
1179
|
-
gray: "#808080",
|
|
1180
|
-
green: "#008000",
|
|
1181
|
-
greenyellow: "#adff2f",
|
|
1182
|
-
grey: "#808080",
|
|
1183
|
-
honeydew: "#f0fff0",
|
|
1184
|
-
hotpink: "#ff69b4",
|
|
1185
|
-
indianred: "#cd5c5c",
|
|
1186
|
-
indigo: "#4b0082",
|
|
1187
|
-
ivory: "#fffff0",
|
|
1188
|
-
khaki: "#f0e68c",
|
|
1189
|
-
lavenderblush: "#fff0f5",
|
|
1190
|
-
lavender: "#e6e6fa",
|
|
1191
|
-
lawngreen: "#7cfc00",
|
|
1192
|
-
lemonchiffon: "#fffacd",
|
|
1193
|
-
lightblue: "#add8e6",
|
|
1194
|
-
lightcoral: "#f08080",
|
|
1195
|
-
lightcyan: "#e0ffff",
|
|
1196
|
-
lightgoldenrodyellow: "#fafad2",
|
|
1197
|
-
lightgray: "#d3d3d3",
|
|
1198
|
-
lightgreen: "#90ee90",
|
|
1199
|
-
lightgrey: "#d3d3d3",
|
|
1200
|
-
lightpink: "#ffb6c1",
|
|
1201
|
-
lightsalmon: "#ffa07a",
|
|
1202
|
-
lightseagreen: "#20b2aa",
|
|
1203
|
-
lightskyblue: "#87cefa",
|
|
1204
|
-
lightslategray: "#778899",
|
|
1205
|
-
lightslategrey: "#778899",
|
|
1206
|
-
lightsteelblue: "#b0c4de",
|
|
1207
|
-
lightyellow: "#ffffe0",
|
|
1208
|
-
lime: "#00ff00",
|
|
1209
|
-
limegreen: "#32cd32",
|
|
1210
|
-
linen: "#faf0e6",
|
|
1211
|
-
magenta: "#ff00ff",
|
|
1212
|
-
maroon: "#800000",
|
|
1213
|
-
mediumaquamarine: "#66cdaa",
|
|
1214
|
-
mediumblue: "#0000cd",
|
|
1215
|
-
mediumorchid: "#ba55d3",
|
|
1216
|
-
mediumpurple: "#9370db",
|
|
1217
|
-
mediumseagreen: "#3cb371",
|
|
1218
|
-
mediumslateblue: "#7b68ee",
|
|
1219
|
-
mediumspringgreen: "#00fa9a",
|
|
1220
|
-
mediumturquoise: "#48d1cc",
|
|
1221
|
-
mediumvioletred: "#c71585",
|
|
1222
|
-
midnightblue: "#191970",
|
|
1223
|
-
mintcream: "#f5fffa",
|
|
1224
|
-
mistyrose: "#ffe4e1",
|
|
1225
|
-
moccasin: "#ffe4b5",
|
|
1226
|
-
navajowhite: "#ffdead",
|
|
1227
|
-
navy: "#000080",
|
|
1228
|
-
oldlace: "#fdf5e6",
|
|
1229
|
-
olive: "#808000",
|
|
1230
|
-
olivedrab: "#6b8e23",
|
|
1231
|
-
orange: "#ffa500",
|
|
1232
|
-
orangered: "#ff4500",
|
|
1233
|
-
orchid: "#da70d6",
|
|
1234
|
-
palegoldenrod: "#eee8aa",
|
|
1235
|
-
palegreen: "#98fb98",
|
|
1236
|
-
paleturquoise: "#afeeee",
|
|
1237
|
-
palevioletred: "#db7093",
|
|
1238
|
-
papayawhip: "#ffefd5",
|
|
1239
|
-
peachpuff: "#ffdab9",
|
|
1240
|
-
peru: "#cd853f",
|
|
1241
|
-
pink: "#ffc0cb",
|
|
1242
|
-
plum: "#dda0dd",
|
|
1243
|
-
powderblue: "#b0e0e6",
|
|
1244
|
-
purple: "#800080",
|
|
1245
|
-
rebeccapurple: "#663399",
|
|
1246
|
-
red: "#ff0000",
|
|
1247
|
-
rosybrown: "#bc8f8f",
|
|
1248
|
-
royalblue: "#4169e1",
|
|
1249
|
-
saddlebrown: "#8b4513",
|
|
1250
|
-
salmon: "#fa8072",
|
|
1251
|
-
sandybrown: "#f4a460",
|
|
1252
|
-
seagreen: "#2e8b57",
|
|
1253
|
-
seashell: "#fff5ee",
|
|
1254
|
-
sienna: "#a0522d",
|
|
1255
|
-
silver: "#c0c0c0",
|
|
1256
|
-
skyblue: "#87ceeb",
|
|
1257
|
-
slateblue: "#6a5acd",
|
|
1258
|
-
slategray: "#708090",
|
|
1259
|
-
slategrey: "#708090",
|
|
1260
|
-
snow: "#fffafa",
|
|
1261
|
-
springgreen: "#00ff7f",
|
|
1262
|
-
steelblue: "#4682b4",
|
|
1263
|
-
tan: "#d2b48c",
|
|
1264
|
-
teal: "#008080",
|
|
1265
|
-
thistle: "#d8bfd8",
|
|
1266
|
-
tomato: "#ff6347",
|
|
1267
|
-
turquoise: "#40e0d0",
|
|
1268
|
-
violet: "#ee82ee",
|
|
1269
|
-
wheat: "#f5deb3",
|
|
1270
|
-
white: "#ffffff",
|
|
1271
|
-
whitesmoke: "#f5f5f5",
|
|
1272
|
-
yellow: "#ffff00",
|
|
1273
|
-
yellowgreen: "#9acd32"
|
|
1274
|
-
};
|
|
1275
|
-
function inputToRGB(color) {
|
|
1276
|
-
var rgb = { r: 0, g: 0, b: 0 };
|
|
1277
|
-
var a = 1;
|
|
1278
|
-
var s = null;
|
|
1279
|
-
var v = null;
|
|
1280
|
-
var l = null;
|
|
1281
|
-
var ok = false;
|
|
1282
|
-
var format = false;
|
|
1283
|
-
if (typeof color === "string") {
|
|
1284
|
-
color = stringInputToObject(color);
|
|
1285
|
-
}
|
|
1286
|
-
if (typeof color === "object") {
|
|
1287
|
-
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
1288
|
-
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
1289
|
-
ok = true;
|
|
1290
|
-
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
|
1291
|
-
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
1292
|
-
s = convertToPercentage(color.s);
|
|
1293
|
-
v = convertToPercentage(color.v);
|
|
1294
|
-
rgb = hsvToRgb(color.h, s, v);
|
|
1295
|
-
ok = true;
|
|
1296
|
-
format = "hsv";
|
|
1297
|
-
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
1298
|
-
s = convertToPercentage(color.s);
|
|
1299
|
-
l = convertToPercentage(color.l);
|
|
1300
|
-
rgb = hslToRgb(color.h, s, l);
|
|
1301
|
-
ok = true;
|
|
1302
|
-
format = "hsl";
|
|
1303
|
-
}
|
|
1304
|
-
if (Object.prototype.hasOwnProperty.call(color, "a")) {
|
|
1305
|
-
a = color.a;
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
a = boundAlpha(a);
|
|
1309
|
-
return {
|
|
1310
|
-
ok,
|
|
1311
|
-
format: color.format || format,
|
|
1312
|
-
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
1313
|
-
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
1314
|
-
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
1315
|
-
a
|
|
1316
|
-
};
|
|
1317
|
-
}
|
|
1318
|
-
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
|
1319
|
-
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
|
|
1320
|
-
var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
|
|
1321
|
-
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
1322
|
-
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
1323
|
-
var matchers = {
|
|
1324
|
-
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
1325
|
-
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
|
1326
|
-
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
|
|
1327
|
-
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
|
|
1328
|
-
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
|
|
1329
|
-
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
|
|
1330
|
-
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
|
|
1331
|
-
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
1332
|
-
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
1333
|
-
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
1334
|
-
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
1335
|
-
};
|
|
1336
|
-
function stringInputToObject(color) {
|
|
1337
|
-
color = color.trim().toLowerCase();
|
|
1338
|
-
if (color.length === 0) {
|
|
1339
|
-
return false;
|
|
1340
|
-
}
|
|
1341
|
-
var named = false;
|
|
1342
|
-
if (names[color]) {
|
|
1343
|
-
color = names[color];
|
|
1344
|
-
named = true;
|
|
1345
|
-
} else if (color === "transparent") {
|
|
1346
|
-
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
|
|
1347
|
-
}
|
|
1348
|
-
var match = matchers.rgb.exec(color);
|
|
1349
|
-
if (match) {
|
|
1350
|
-
return { r: match[1], g: match[2], b: match[3] };
|
|
1351
|
-
}
|
|
1352
|
-
match = matchers.rgba.exec(color);
|
|
1353
|
-
if (match) {
|
|
1354
|
-
return { r: match[1], g: match[2], b: match[3], a: match[4] };
|
|
1355
|
-
}
|
|
1356
|
-
match = matchers.hsl.exec(color);
|
|
1357
|
-
if (match) {
|
|
1358
|
-
return { h: match[1], s: match[2], l: match[3] };
|
|
1359
|
-
}
|
|
1360
|
-
match = matchers.hsla.exec(color);
|
|
1361
|
-
if (match) {
|
|
1362
|
-
return { h: match[1], s: match[2], l: match[3], a: match[4] };
|
|
1363
|
-
}
|
|
1364
|
-
match = matchers.hsv.exec(color);
|
|
1365
|
-
if (match) {
|
|
1366
|
-
return { h: match[1], s: match[2], v: match[3] };
|
|
1367
|
-
}
|
|
1368
|
-
match = matchers.hsva.exec(color);
|
|
1369
|
-
if (match) {
|
|
1370
|
-
return { h: match[1], s: match[2], v: match[3], a: match[4] };
|
|
1371
|
-
}
|
|
1372
|
-
match = matchers.hex8.exec(color);
|
|
1373
|
-
if (match) {
|
|
1374
|
-
return {
|
|
1375
|
-
r: parseIntFromHex(match[1]),
|
|
1376
|
-
g: parseIntFromHex(match[2]),
|
|
1377
|
-
b: parseIntFromHex(match[3]),
|
|
1378
|
-
a: convertHexToDecimal(match[4]),
|
|
1379
|
-
format: named ? "name" : "hex8"
|
|
1380
|
-
};
|
|
1381
|
-
}
|
|
1382
|
-
match = matchers.hex6.exec(color);
|
|
1383
|
-
if (match) {
|
|
1384
|
-
return {
|
|
1385
|
-
r: parseIntFromHex(match[1]),
|
|
1386
|
-
g: parseIntFromHex(match[2]),
|
|
1387
|
-
b: parseIntFromHex(match[3]),
|
|
1388
|
-
format: named ? "name" : "hex"
|
|
1389
|
-
};
|
|
1390
|
-
}
|
|
1391
|
-
match = matchers.hex4.exec(color);
|
|
1392
|
-
if (match) {
|
|
1393
|
-
return {
|
|
1394
|
-
r: parseIntFromHex(match[1] + match[1]),
|
|
1395
|
-
g: parseIntFromHex(match[2] + match[2]),
|
|
1396
|
-
b: parseIntFromHex(match[3] + match[3]),
|
|
1397
|
-
a: convertHexToDecimal(match[4] + match[4]),
|
|
1398
|
-
format: named ? "name" : "hex8"
|
|
1399
|
-
};
|
|
1400
|
-
}
|
|
1401
|
-
match = matchers.hex3.exec(color);
|
|
1402
|
-
if (match) {
|
|
1403
|
-
return {
|
|
1404
|
-
r: parseIntFromHex(match[1] + match[1]),
|
|
1405
|
-
g: parseIntFromHex(match[2] + match[2]),
|
|
1406
|
-
b: parseIntFromHex(match[3] + match[3]),
|
|
1407
|
-
format: named ? "name" : "hex"
|
|
1408
|
-
};
|
|
1409
|
-
}
|
|
1410
|
-
return false;
|
|
1411
|
-
}
|
|
1412
|
-
function isValidCSSUnit(color) {
|
|
1413
|
-
return Boolean(matchers.CSS_UNIT.exec(String(color)));
|
|
1414
|
-
}
|
|
1415
|
-
var TinyColor = function() {
|
|
1416
|
-
function TinyColor2(color, opts) {
|
|
1417
|
-
if (color === void 0) {
|
|
1418
|
-
color = "";
|
|
1419
|
-
}
|
|
1420
|
-
if (opts === void 0) {
|
|
1421
|
-
opts = {};
|
|
1422
|
-
}
|
|
1423
|
-
var _a;
|
|
1424
|
-
if (color instanceof TinyColor2) {
|
|
1425
|
-
return color;
|
|
1426
|
-
}
|
|
1427
|
-
if (typeof color === "number") {
|
|
1428
|
-
color = numberInputToObject(color);
|
|
1429
|
-
}
|
|
1430
|
-
this.originalInput = color;
|
|
1431
|
-
var rgb = inputToRGB(color);
|
|
1432
|
-
this.originalInput = color;
|
|
1433
|
-
this.r = rgb.r;
|
|
1434
|
-
this.g = rgb.g;
|
|
1435
|
-
this.b = rgb.b;
|
|
1436
|
-
this.a = rgb.a;
|
|
1437
|
-
this.roundA = Math.round(100 * this.a) / 100;
|
|
1438
|
-
this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format;
|
|
1439
|
-
this.gradientType = opts.gradientType;
|
|
1440
|
-
if (this.r < 1) {
|
|
1441
|
-
this.r = Math.round(this.r);
|
|
1442
|
-
}
|
|
1443
|
-
if (this.g < 1) {
|
|
1444
|
-
this.g = Math.round(this.g);
|
|
1445
|
-
}
|
|
1446
|
-
if (this.b < 1) {
|
|
1447
|
-
this.b = Math.round(this.b);
|
|
1448
|
-
}
|
|
1449
|
-
this.isValid = rgb.ok;
|
|
1450
|
-
}
|
|
1451
|
-
TinyColor2.prototype.isDark = function() {
|
|
1452
|
-
return this.getBrightness() < 128;
|
|
1453
|
-
};
|
|
1454
|
-
TinyColor2.prototype.isLight = function() {
|
|
1455
|
-
return !this.isDark();
|
|
1456
|
-
};
|
|
1457
|
-
TinyColor2.prototype.getBrightness = function() {
|
|
1458
|
-
var rgb = this.toRgb();
|
|
1459
|
-
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
|
|
1460
|
-
};
|
|
1461
|
-
TinyColor2.prototype.getLuminance = function() {
|
|
1462
|
-
var rgb = this.toRgb();
|
|
1463
|
-
var R;
|
|
1464
|
-
var G;
|
|
1465
|
-
var B;
|
|
1466
|
-
var RsRGB = rgb.r / 255;
|
|
1467
|
-
var GsRGB = rgb.g / 255;
|
|
1468
|
-
var BsRGB = rgb.b / 255;
|
|
1469
|
-
if (RsRGB <= 0.03928) {
|
|
1470
|
-
R = RsRGB / 12.92;
|
|
1471
|
-
} else {
|
|
1472
|
-
R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
|
1473
|
-
}
|
|
1474
|
-
if (GsRGB <= 0.03928) {
|
|
1475
|
-
G = GsRGB / 12.92;
|
|
1476
|
-
} else {
|
|
1477
|
-
G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
1478
|
-
}
|
|
1479
|
-
if (BsRGB <= 0.03928) {
|
|
1480
|
-
B = BsRGB / 12.92;
|
|
1481
|
-
} else {
|
|
1482
|
-
B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
1483
|
-
}
|
|
1484
|
-
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
1485
|
-
};
|
|
1486
|
-
TinyColor2.prototype.getAlpha = function() {
|
|
1487
|
-
return this.a;
|
|
1488
|
-
};
|
|
1489
|
-
TinyColor2.prototype.setAlpha = function(alpha) {
|
|
1490
|
-
this.a = boundAlpha(alpha);
|
|
1491
|
-
this.roundA = Math.round(100 * this.a) / 100;
|
|
1492
|
-
return this;
|
|
1493
|
-
};
|
|
1494
|
-
TinyColor2.prototype.toHsv = function() {
|
|
1495
|
-
var hsv = rgbToHsv(this.r, this.g, this.b);
|
|
1496
|
-
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
|
|
1497
|
-
};
|
|
1498
|
-
TinyColor2.prototype.toHsvString = function() {
|
|
1499
|
-
var hsv = rgbToHsv(this.r, this.g, this.b);
|
|
1500
|
-
var h = Math.round(hsv.h * 360);
|
|
1501
|
-
var s = Math.round(hsv.s * 100);
|
|
1502
|
-
var v = Math.round(hsv.v * 100);
|
|
1503
|
-
return this.a === 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this.roundA + ")";
|
|
1504
|
-
};
|
|
1505
|
-
TinyColor2.prototype.toHsl = function() {
|
|
1506
|
-
var hsl = rgbToHsl(this.r, this.g, this.b);
|
|
1507
|
-
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
|
|
1508
|
-
};
|
|
1509
|
-
TinyColor2.prototype.toHslString = function() {
|
|
1510
|
-
var hsl = rgbToHsl(this.r, this.g, this.b);
|
|
1511
|
-
var h = Math.round(hsl.h * 360);
|
|
1512
|
-
var s = Math.round(hsl.s * 100);
|
|
1513
|
-
var l = Math.round(hsl.l * 100);
|
|
1514
|
-
return this.a === 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this.roundA + ")";
|
|
1515
|
-
};
|
|
1516
|
-
TinyColor2.prototype.toHex = function(allow3Char) {
|
|
1517
|
-
if (allow3Char === void 0) {
|
|
1518
|
-
allow3Char = false;
|
|
1519
|
-
}
|
|
1520
|
-
return rgbToHex(this.r, this.g, this.b, allow3Char);
|
|
1521
|
-
};
|
|
1522
|
-
TinyColor2.prototype.toHexString = function(allow3Char) {
|
|
1523
|
-
if (allow3Char === void 0) {
|
|
1524
|
-
allow3Char = false;
|
|
1525
|
-
}
|
|
1526
|
-
return "#" + this.toHex(allow3Char);
|
|
1527
|
-
};
|
|
1528
|
-
TinyColor2.prototype.toHex8 = function(allow4Char) {
|
|
1529
|
-
if (allow4Char === void 0) {
|
|
1530
|
-
allow4Char = false;
|
|
1531
|
-
}
|
|
1532
|
-
return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
|
|
1533
|
-
};
|
|
1534
|
-
TinyColor2.prototype.toHex8String = function(allow4Char) {
|
|
1535
|
-
if (allow4Char === void 0) {
|
|
1536
|
-
allow4Char = false;
|
|
1537
|
-
}
|
|
1538
|
-
return "#" + this.toHex8(allow4Char);
|
|
1539
|
-
};
|
|
1540
|
-
TinyColor2.prototype.toRgb = function() {
|
|
1541
|
-
return {
|
|
1542
|
-
r: Math.round(this.r),
|
|
1543
|
-
g: Math.round(this.g),
|
|
1544
|
-
b: Math.round(this.b),
|
|
1545
|
-
a: this.a
|
|
1546
|
-
};
|
|
1547
|
-
};
|
|
1548
|
-
TinyColor2.prototype.toRgbString = function() {
|
|
1549
|
-
var r = Math.round(this.r);
|
|
1550
|
-
var g = Math.round(this.g);
|
|
1551
|
-
var b = Math.round(this.b);
|
|
1552
|
-
return this.a === 1 ? "rgb(" + r + ", " + g + ", " + b + ")" : "rgba(" + r + ", " + g + ", " + b + ", " + this.roundA + ")";
|
|
1553
|
-
};
|
|
1554
|
-
TinyColor2.prototype.toPercentageRgb = function() {
|
|
1555
|
-
var fmt = function(x) {
|
|
1556
|
-
return Math.round(bound01(x, 255) * 100) + "%";
|
|
1557
|
-
};
|
|
1558
|
-
return {
|
|
1559
|
-
r: fmt(this.r),
|
|
1560
|
-
g: fmt(this.g),
|
|
1561
|
-
b: fmt(this.b),
|
|
1562
|
-
a: this.a
|
|
1563
|
-
};
|
|
1564
|
-
};
|
|
1565
|
-
TinyColor2.prototype.toPercentageRgbString = function() {
|
|
1566
|
-
var rnd = function(x) {
|
|
1567
|
-
return Math.round(bound01(x, 255) * 100);
|
|
1568
|
-
};
|
|
1569
|
-
return this.a === 1 ? "rgb(" + rnd(this.r) + "%, " + rnd(this.g) + "%, " + rnd(this.b) + "%)" : "rgba(" + rnd(this.r) + "%, " + rnd(this.g) + "%, " + rnd(this.b) + "%, " + this.roundA + ")";
|
|
1570
|
-
};
|
|
1571
|
-
TinyColor2.prototype.toName = function() {
|
|
1572
|
-
if (this.a === 0) {
|
|
1573
|
-
return "transparent";
|
|
1574
|
-
}
|
|
1575
|
-
if (this.a < 1) {
|
|
1576
|
-
return false;
|
|
1577
|
-
}
|
|
1578
|
-
var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
|
|
1579
|
-
for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) {
|
|
1580
|
-
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
1581
|
-
if (hex === value) {
|
|
1582
|
-
return key;
|
|
1583
|
-
}
|
|
1584
|
-
}
|
|
1585
|
-
return false;
|
|
1586
|
-
};
|
|
1587
|
-
TinyColor2.prototype.toString = function(format) {
|
|
1588
|
-
var formatSet = Boolean(format);
|
|
1589
|
-
format = format !== null && format !== void 0 ? format : this.format;
|
|
1590
|
-
var formattedString = false;
|
|
1591
|
-
var hasAlpha = this.a < 1 && this.a >= 0;
|
|
1592
|
-
var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
|
|
1593
|
-
if (needsAlphaFormat) {
|
|
1594
|
-
if (format === "name" && this.a === 0) {
|
|
1595
|
-
return this.toName();
|
|
1596
|
-
}
|
|
1597
|
-
return this.toRgbString();
|
|
1598
|
-
}
|
|
1599
|
-
if (format === "rgb") {
|
|
1600
|
-
formattedString = this.toRgbString();
|
|
1601
|
-
}
|
|
1602
|
-
if (format === "prgb") {
|
|
1603
|
-
formattedString = this.toPercentageRgbString();
|
|
1604
|
-
}
|
|
1605
|
-
if (format === "hex" || format === "hex6") {
|
|
1606
|
-
formattedString = this.toHexString();
|
|
1607
|
-
}
|
|
1608
|
-
if (format === "hex3") {
|
|
1609
|
-
formattedString = this.toHexString(true);
|
|
1610
|
-
}
|
|
1611
|
-
if (format === "hex4") {
|
|
1612
|
-
formattedString = this.toHex8String(true);
|
|
1613
|
-
}
|
|
1614
|
-
if (format === "hex8") {
|
|
1615
|
-
formattedString = this.toHex8String();
|
|
1616
|
-
}
|
|
1617
|
-
if (format === "name") {
|
|
1618
|
-
formattedString = this.toName();
|
|
1619
|
-
}
|
|
1620
|
-
if (format === "hsl") {
|
|
1621
|
-
formattedString = this.toHslString();
|
|
1622
|
-
}
|
|
1623
|
-
if (format === "hsv") {
|
|
1624
|
-
formattedString = this.toHsvString();
|
|
1625
|
-
}
|
|
1626
|
-
return formattedString || this.toHexString();
|
|
1627
|
-
};
|
|
1628
|
-
TinyColor2.prototype.toNumber = function() {
|
|
1629
|
-
return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
|
|
1630
|
-
};
|
|
1631
|
-
TinyColor2.prototype.clone = function() {
|
|
1632
|
-
return new TinyColor2(this.toString());
|
|
1633
|
-
};
|
|
1634
|
-
TinyColor2.prototype.lighten = function(amount) {
|
|
1635
|
-
if (amount === void 0) {
|
|
1636
|
-
amount = 10;
|
|
1637
|
-
}
|
|
1638
|
-
var hsl = this.toHsl();
|
|
1639
|
-
hsl.l += amount / 100;
|
|
1640
|
-
hsl.l = clamp01(hsl.l);
|
|
1641
|
-
return new TinyColor2(hsl);
|
|
1642
|
-
};
|
|
1643
|
-
TinyColor2.prototype.brighten = function(amount) {
|
|
1644
|
-
if (amount === void 0) {
|
|
1645
|
-
amount = 10;
|
|
1646
|
-
}
|
|
1647
|
-
var rgb = this.toRgb();
|
|
1648
|
-
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
|
|
1649
|
-
rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
|
|
1650
|
-
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
|
|
1651
|
-
return new TinyColor2(rgb);
|
|
1652
|
-
};
|
|
1653
|
-
TinyColor2.prototype.darken = function(amount) {
|
|
1654
|
-
if (amount === void 0) {
|
|
1655
|
-
amount = 10;
|
|
1656
|
-
}
|
|
1657
|
-
var hsl = this.toHsl();
|
|
1658
|
-
hsl.l -= amount / 100;
|
|
1659
|
-
hsl.l = clamp01(hsl.l);
|
|
1660
|
-
return new TinyColor2(hsl);
|
|
1661
|
-
};
|
|
1662
|
-
TinyColor2.prototype.tint = function(amount) {
|
|
1663
|
-
if (amount === void 0) {
|
|
1664
|
-
amount = 10;
|
|
1665
|
-
}
|
|
1666
|
-
return this.mix("white", amount);
|
|
1667
|
-
};
|
|
1668
|
-
TinyColor2.prototype.shade = function(amount) {
|
|
1669
|
-
if (amount === void 0) {
|
|
1670
|
-
amount = 10;
|
|
1671
|
-
}
|
|
1672
|
-
return this.mix("black", amount);
|
|
1673
|
-
};
|
|
1674
|
-
TinyColor2.prototype.desaturate = function(amount) {
|
|
1675
|
-
if (amount === void 0) {
|
|
1676
|
-
amount = 10;
|
|
1677
|
-
}
|
|
1678
|
-
var hsl = this.toHsl();
|
|
1679
|
-
hsl.s -= amount / 100;
|
|
1680
|
-
hsl.s = clamp01(hsl.s);
|
|
1681
|
-
return new TinyColor2(hsl);
|
|
1682
|
-
};
|
|
1683
|
-
TinyColor2.prototype.saturate = function(amount) {
|
|
1684
|
-
if (amount === void 0) {
|
|
1685
|
-
amount = 10;
|
|
1686
|
-
}
|
|
1687
|
-
var hsl = this.toHsl();
|
|
1688
|
-
hsl.s += amount / 100;
|
|
1689
|
-
hsl.s = clamp01(hsl.s);
|
|
1690
|
-
return new TinyColor2(hsl);
|
|
1691
|
-
};
|
|
1692
|
-
TinyColor2.prototype.greyscale = function() {
|
|
1693
|
-
return this.desaturate(100);
|
|
1694
|
-
};
|
|
1695
|
-
TinyColor2.prototype.spin = function(amount) {
|
|
1696
|
-
var hsl = this.toHsl();
|
|
1697
|
-
var hue = (hsl.h + amount) % 360;
|
|
1698
|
-
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
1699
|
-
return new TinyColor2(hsl);
|
|
1700
|
-
};
|
|
1701
|
-
TinyColor2.prototype.mix = function(color, amount) {
|
|
1702
|
-
if (amount === void 0) {
|
|
1703
|
-
amount = 50;
|
|
1704
|
-
}
|
|
1705
|
-
var rgb1 = this.toRgb();
|
|
1706
|
-
var rgb2 = new TinyColor2(color).toRgb();
|
|
1707
|
-
var p = amount / 100;
|
|
1708
|
-
var rgba = {
|
|
1709
|
-
r: (rgb2.r - rgb1.r) * p + rgb1.r,
|
|
1710
|
-
g: (rgb2.g - rgb1.g) * p + rgb1.g,
|
|
1711
|
-
b: (rgb2.b - rgb1.b) * p + rgb1.b,
|
|
1712
|
-
a: (rgb2.a - rgb1.a) * p + rgb1.a
|
|
1713
|
-
};
|
|
1714
|
-
return new TinyColor2(rgba);
|
|
1715
|
-
};
|
|
1716
|
-
TinyColor2.prototype.analogous = function(results, slices) {
|
|
1717
|
-
if (results === void 0) {
|
|
1718
|
-
results = 6;
|
|
1719
|
-
}
|
|
1720
|
-
if (slices === void 0) {
|
|
1721
|
-
slices = 30;
|
|
1722
|
-
}
|
|
1723
|
-
var hsl = this.toHsl();
|
|
1724
|
-
var part = 360 / slices;
|
|
1725
|
-
var ret = [this];
|
|
1726
|
-
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
|
|
1727
|
-
hsl.h = (hsl.h + part) % 360;
|
|
1728
|
-
ret.push(new TinyColor2(hsl));
|
|
1729
|
-
}
|
|
1730
|
-
return ret;
|
|
1731
|
-
};
|
|
1732
|
-
TinyColor2.prototype.complement = function() {
|
|
1733
|
-
var hsl = this.toHsl();
|
|
1734
|
-
hsl.h = (hsl.h + 180) % 360;
|
|
1735
|
-
return new TinyColor2(hsl);
|
|
1736
|
-
};
|
|
1737
|
-
TinyColor2.prototype.monochromatic = function(results) {
|
|
1738
|
-
if (results === void 0) {
|
|
1739
|
-
results = 6;
|
|
1740
|
-
}
|
|
1741
|
-
var hsv = this.toHsv();
|
|
1742
|
-
var h = hsv.h;
|
|
1743
|
-
var s = hsv.s;
|
|
1744
|
-
var v = hsv.v;
|
|
1745
|
-
var res = [];
|
|
1746
|
-
var modification = 1 / results;
|
|
1747
|
-
while (results--) {
|
|
1748
|
-
res.push(new TinyColor2({ h, s, v }));
|
|
1749
|
-
v = (v + modification) % 1;
|
|
1750
|
-
}
|
|
1751
|
-
return res;
|
|
1752
|
-
};
|
|
1753
|
-
TinyColor2.prototype.splitcomplement = function() {
|
|
1754
|
-
var hsl = this.toHsl();
|
|
1755
|
-
var h = hsl.h;
|
|
1756
|
-
return [
|
|
1757
|
-
this,
|
|
1758
|
-
new TinyColor2({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
|
|
1759
|
-
new TinyColor2({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })
|
|
1760
|
-
];
|
|
1761
|
-
};
|
|
1762
|
-
TinyColor2.prototype.onBackground = function(background) {
|
|
1763
|
-
var fg = this.toRgb();
|
|
1764
|
-
var bg = new TinyColor2(background).toRgb();
|
|
1765
|
-
return new TinyColor2({
|
|
1766
|
-
r: bg.r + (fg.r - bg.r) * fg.a,
|
|
1767
|
-
g: bg.g + (fg.g - bg.g) * fg.a,
|
|
1768
|
-
b: bg.b + (fg.b - bg.b) * fg.a
|
|
1769
|
-
});
|
|
1770
|
-
};
|
|
1771
|
-
TinyColor2.prototype.triad = function() {
|
|
1772
|
-
return this.polyad(3);
|
|
1773
|
-
};
|
|
1774
|
-
TinyColor2.prototype.tetrad = function() {
|
|
1775
|
-
return this.polyad(4);
|
|
1776
|
-
};
|
|
1777
|
-
TinyColor2.prototype.polyad = function(n) {
|
|
1778
|
-
var hsl = this.toHsl();
|
|
1779
|
-
var h = hsl.h;
|
|
1780
|
-
var result = [this];
|
|
1781
|
-
var increment = 360 / n;
|
|
1782
|
-
for (var i = 1; i < n; i++) {
|
|
1783
|
-
result.push(new TinyColor2({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
|
|
1784
|
-
}
|
|
1785
|
-
return result;
|
|
1786
|
-
};
|
|
1787
|
-
TinyColor2.prototype.equals = function(color) {
|
|
1788
|
-
return this.toRgbString() === new TinyColor2(color).toRgbString();
|
|
1789
|
-
};
|
|
1790
|
-
return TinyColor2;
|
|
1791
|
-
}();
|
|
1792
|
-
const buttonTypes = [
|
|
1793
|
-
"default",
|
|
1794
|
-
"primary",
|
|
1795
|
-
"success",
|
|
1796
|
-
"warning",
|
|
1797
|
-
"info",
|
|
1798
|
-
"danger",
|
|
1799
|
-
"text",
|
|
1800
|
-
""
|
|
1801
|
-
];
|
|
1802
|
-
const buttonNativeTypes = ["button", "submit", "reset"];
|
|
1803
|
-
const buttonProps = buildProps({
|
|
1804
|
-
size: useSizeProp,
|
|
1805
|
-
disabled: Boolean,
|
|
1806
|
-
type: {
|
|
1807
|
-
type: String,
|
|
1808
|
-
values: buttonTypes,
|
|
1809
|
-
default: ""
|
|
1810
|
-
},
|
|
1811
|
-
icon: {
|
|
1812
|
-
type: iconPropType,
|
|
1813
|
-
default: ""
|
|
1814
|
-
},
|
|
1815
|
-
nativeType: {
|
|
1816
|
-
type: String,
|
|
1817
|
-
values: buttonNativeTypes,
|
|
1818
|
-
default: "button"
|
|
1819
|
-
},
|
|
1820
|
-
loading: Boolean,
|
|
1821
|
-
loadingIcon: {
|
|
1822
|
-
type: iconPropType,
|
|
1823
|
-
default: () => loading
|
|
1824
|
-
},
|
|
1825
|
-
plain: Boolean,
|
|
1826
|
-
autofocus: Boolean,
|
|
1827
|
-
round: Boolean,
|
|
1828
|
-
circle: Boolean,
|
|
1829
|
-
color: String,
|
|
1830
|
-
autoInsertSpace: {
|
|
1831
|
-
type: Boolean,
|
|
1832
|
-
default: void 0
|
|
1833
|
-
}
|
|
1834
|
-
});
|
|
1835
|
-
const buttonEmits = {
|
|
1836
|
-
click: (evt) => evt instanceof MouseEvent
|
|
1837
|
-
};
|
|
1838
|
-
const _hoisted_1$2 = ["disabled", "autofocus", "type"];
|
|
1839
|
-
const __default__$3 = {
|
|
1840
|
-
name: "ElButton"
|
|
1841
|
-
};
|
|
1842
|
-
const _sfc_main$3 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$3), {
|
|
1843
|
-
props: buttonProps,
|
|
1844
|
-
emits: buttonEmits,
|
|
1845
|
-
setup(__props, { expose, emit }) {
|
|
1846
|
-
const props = __props;
|
|
1847
|
-
const slots = useSlots();
|
|
1848
|
-
const buttonGroupContext = inject(buttonGroupContextKey, void 0);
|
|
1849
|
-
const globalConfig2 = useGlobalConfig("button");
|
|
1850
|
-
const ns = useNamespace("button");
|
|
1851
|
-
const { form } = useFormItem();
|
|
1852
|
-
const _size = useSize(computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
|
|
1853
|
-
const _disabled = useDisabled();
|
|
1854
|
-
const _ref = ref();
|
|
1855
|
-
const _type = computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
|
|
1856
|
-
const autoInsertSpace = computed(() => {
|
|
1857
|
-
var _a, _b, _c;
|
|
1858
|
-
return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a = globalConfig2.value) == null ? void 0 : _a.autoInsertSpace) != null ? _c : false;
|
|
1859
|
-
});
|
|
1860
|
-
const shouldAddSpace = computed(() => {
|
|
1861
|
-
var _a;
|
|
1862
|
-
const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots);
|
|
1863
|
-
if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
|
|
1864
|
-
const slot = defaultSlot[0];
|
|
1865
|
-
if ((slot == null ? void 0 : slot.type) === Text) {
|
|
1866
|
-
const text = slot.children;
|
|
1867
|
-
return /^\p{Unified_Ideograph}{2}$/u.test(text);
|
|
1868
|
-
}
|
|
1869
|
-
}
|
|
1870
|
-
return false;
|
|
1871
|
-
});
|
|
1872
|
-
const buttonStyle = computed(() => {
|
|
1873
|
-
let styles = {};
|
|
1874
|
-
const buttonColor = props.color;
|
|
1875
|
-
if (buttonColor) {
|
|
1876
|
-
const color = new TinyColor(buttonColor);
|
|
1877
|
-
const shadeBgColor = color.shade(20).toString();
|
|
1878
|
-
if (props.plain) {
|
|
1879
|
-
styles = {
|
|
1880
|
-
"--el-button-bg-color": color.tint(90).toString(),
|
|
1881
|
-
"--el-button-text-color": buttonColor,
|
|
1882
|
-
"--el-button-hover-text-color": "var(--el-color-white)",
|
|
1883
|
-
"--el-button-hover-bg-color": buttonColor,
|
|
1884
|
-
"--el-button-hover-border-color": buttonColor,
|
|
1885
|
-
"--el-button-active-bg-color": shadeBgColor,
|
|
1886
|
-
"--el-button-active-text-color": "var(--el-color-white)",
|
|
1887
|
-
"--el-button-active-border-color": shadeBgColor
|
|
1888
|
-
};
|
|
1889
|
-
} else {
|
|
1890
|
-
const tintBgColor = color.tint(30).toString();
|
|
1891
|
-
styles = {
|
|
1892
|
-
"--el-button-bg-color": buttonColor,
|
|
1893
|
-
"--el-button-border-color": buttonColor,
|
|
1894
|
-
"--el-button-hover-bg-color": tintBgColor,
|
|
1895
|
-
"--el-button-hover-border-color": tintBgColor,
|
|
1896
|
-
"--el-button-active-bg-color": shadeBgColor,
|
|
1897
|
-
"--el-button-active-border-color": shadeBgColor
|
|
1898
|
-
};
|
|
1899
|
-
}
|
|
1900
|
-
if (_disabled.value) {
|
|
1901
|
-
const disabledButtonColor = color.tint(50).toString();
|
|
1902
|
-
styles["--el-button-disabled-bg-color"] = disabledButtonColor;
|
|
1903
|
-
styles["--el-button-disabled-border-color"] = disabledButtonColor;
|
|
1904
|
-
}
|
|
1905
|
-
}
|
|
1906
|
-
return styles;
|
|
1907
|
-
});
|
|
1908
|
-
const handleClick = (evt) => {
|
|
1909
|
-
if (props.nativeType === "reset") {
|
|
1910
|
-
form == null ? void 0 : form.resetFields();
|
|
1911
|
-
}
|
|
1912
|
-
emit("click", evt);
|
|
1913
|
-
};
|
|
1914
|
-
expose({
|
|
1915
|
-
ref: _ref,
|
|
1916
|
-
size: _size,
|
|
1917
|
-
type: _type,
|
|
1918
|
-
disabled: _disabled,
|
|
1919
|
-
shouldAddSpace
|
|
1920
|
-
});
|
|
1921
|
-
return (_ctx, _cache) => {
|
|
1922
|
-
return openBlock(), createElementBlock("button", {
|
|
1923
|
-
ref_key: "_ref",
|
|
1924
|
-
ref: _ref,
|
|
1925
|
-
class: normalizeClass([
|
|
1926
|
-
unref(ns).b(),
|
|
1927
|
-
unref(ns).m(unref(_type)),
|
|
1928
|
-
unref(ns).m(unref(_size)),
|
|
1929
|
-
unref(ns).is("disabled", unref(_disabled)),
|
|
1930
|
-
unref(ns).is("loading", _ctx.loading),
|
|
1931
|
-
unref(ns).is("plain", _ctx.plain),
|
|
1932
|
-
unref(ns).is("round", _ctx.round),
|
|
1933
|
-
unref(ns).is("circle", _ctx.circle)
|
|
1934
|
-
]),
|
|
1935
|
-
disabled: unref(_disabled) || _ctx.loading,
|
|
1936
|
-
autofocus: _ctx.autofocus,
|
|
1937
|
-
type: _ctx.nativeType,
|
|
1938
|
-
style: normalizeStyle(unref(buttonStyle)),
|
|
1939
|
-
onClick: handleClick
|
|
1940
|
-
}, [
|
|
1941
|
-
_ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
1942
|
-
_ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
|
|
1943
|
-
key: 1,
|
|
1944
|
-
class: normalizeClass(unref(ns).is("loading"))
|
|
1945
|
-
}, {
|
|
1946
|
-
default: withCtx(() => [
|
|
1947
|
-
(openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
|
|
1948
|
-
]),
|
|
1949
|
-
_: 1
|
|
1950
|
-
}, 8, ["class"]))
|
|
1951
|
-
], 2112)) : _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
|
|
1952
|
-
default: withCtx(() => [
|
|
1953
|
-
(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
|
|
1954
|
-
]),
|
|
1955
|
-
_: 1
|
|
1956
|
-
})) : createCommentVNode("v-if", true),
|
|
1957
|
-
_ctx.$slots.default ? (openBlock(), createElementBlock("span", {
|
|
1958
|
-
key: 2,
|
|
1959
|
-
class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
|
|
1960
|
-
}, [
|
|
1961
|
-
renderSlot(_ctx.$slots, "default")
|
|
1962
|
-
], 2)) : createCommentVNode("v-if", true)
|
|
1963
|
-
], 14, _hoisted_1$2);
|
|
1964
|
-
};
|
|
1965
|
-
}
|
|
1966
|
-
}));
|
|
1967
|
-
const buttonGroupProps = {
|
|
1968
|
-
size: buttonProps.size,
|
|
1969
|
-
type: buttonProps.type
|
|
1970
|
-
};
|
|
1971
|
-
const __default__$2 = {
|
|
1972
|
-
name: "ElButtonGroup"
|
|
1973
|
-
};
|
|
1974
|
-
const _sfc_main$2 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$2), {
|
|
1975
|
-
props: buttonGroupProps,
|
|
1976
|
-
setup(__props) {
|
|
1977
|
-
const props = __props;
|
|
1978
|
-
provide(buttonGroupContextKey, reactive({
|
|
1979
|
-
size: toRef(props, "size"),
|
|
1980
|
-
type: toRef(props, "type")
|
|
1981
|
-
}));
|
|
1982
|
-
const ns = useNamespace("button");
|
|
1983
|
-
return (_ctx, _cache) => {
|
|
1984
|
-
return openBlock(), createElementBlock("div", {
|
|
1985
|
-
class: normalizeClass(`${unref(ns).b("group")}`)
|
|
1986
|
-
}, [
|
|
1987
|
-
renderSlot(_ctx.$slots, "default")
|
|
1988
|
-
], 2);
|
|
1989
|
-
};
|
|
1990
|
-
}
|
|
1991
|
-
}));
|
|
1992
|
-
const ElButton = withInstall(_sfc_main$3, {
|
|
1993
|
-
ButtonGroup: _sfc_main$2
|
|
1994
|
-
});
|
|
1995
|
-
withNoopInstall(_sfc_main$2);
|
|
1996
917
|
var base = "";
|
|
1997
|
-
var button = "";
|
|
1998
918
|
var input = "";
|
|
1999
|
-
const _hoisted_1$1 = /* @__PURE__ */ createElementVNode("p", null, "Hello NPM!", -1);
|
|
2000
|
-
const _hoisted_2 = /* @__PURE__ */ createTextVNode("Increment count");
|
|
2001
|
-
const __default__$1 = {
|
|
2002
|
-
name: "TestViteNpmComponent"
|
|
2003
|
-
};
|
|
2004
|
-
const _sfc_main$1 = /* @__PURE__ */ Object.assign(__default__$1, {
|
|
2005
|
-
setup(__props) {
|
|
2006
|
-
const msg = ref("");
|
|
2007
|
-
const count2 = ref(0);
|
|
2008
|
-
const incrementCount = () => count2.value++;
|
|
2009
|
-
return (_ctx, _cache) => {
|
|
2010
|
-
const _component_el_input = ElInput;
|
|
2011
|
-
const _component_el_button = ElButton;
|
|
2012
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
2013
|
-
_hoisted_1$1,
|
|
2014
|
-
createElementVNode("div", null, [
|
|
2015
|
-
createVNode(_component_el_input, {
|
|
2016
|
-
modelValue: msg.value,
|
|
2017
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => msg.value = $event),
|
|
2018
|
-
style: { "width": "40%" }
|
|
2019
|
-
}, null, 8, ["modelValue"]),
|
|
2020
|
-
createElementVNode("div", null, "This is input message: " + toDisplayString(msg.value), 1)
|
|
2021
|
-
]),
|
|
2022
|
-
createElementVNode("div", null, [
|
|
2023
|
-
createVNode(_component_el_button, {
|
|
2024
|
-
type: "primary",
|
|
2025
|
-
onClick: incrementCount
|
|
2026
|
-
}, {
|
|
2027
|
-
default: withCtx(() => [
|
|
2028
|
-
_hoisted_2
|
|
2029
|
-
]),
|
|
2030
|
-
_: 1
|
|
2031
|
-
}),
|
|
2032
|
-
createElementVNode("div", null, "This is count: " + toDisplayString(count2.value), 1)
|
|
2033
|
-
])
|
|
2034
|
-
], 64);
|
|
2035
|
-
};
|
|
2036
|
-
}
|
|
2037
|
-
});
|
|
2038
919
|
/**
|
|
2039
920
|
* Vue Currency Input 2.4.0
|
|
2040
921
|
* (c) 2018-2022 Matthias Stiller
|
|
@@ -2596,8 +1477,15 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
2596
1477
|
};
|
|
2597
1478
|
}
|
|
2598
1479
|
});
|
|
2599
|
-
const
|
|
2600
|
-
|
|
2601
|
-
|
|
1480
|
+
const PlCurrencynPlugin = {
|
|
1481
|
+
install(app) {
|
|
1482
|
+
app.component(_sfc_main);
|
|
1483
|
+
}
|
|
1484
|
+
};
|
|
1485
|
+
const MyKitPlugin = {
|
|
1486
|
+
install(app) {
|
|
1487
|
+
var _a;
|
|
1488
|
+
(_a = PlCurrencynPlugin.install) == null ? void 0 : _a.call(PlCurrencynPlugin, app);
|
|
1489
|
+
}
|
|
2602
1490
|
};
|
|
2603
|
-
export {
|
|
1491
|
+
export { _sfc_main as PlCurrency, PlCurrencynPlugin, MyKitPlugin as default };
|