bm-admin-ui 1.0.21-alpha → 1.0.22-alpha
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/es/components/feedback/index.js +25 -1306
- package/es/components/float-table/index.js +37 -28
- package/es/components/form-create/index.js +2769 -0
- package/es/components/form-designer/index.js +4178 -9
- package/es/components/index.js +1 -0
- package/es/components/input-tags-display/index.js +27 -1187
- package/es/components/multi-cascader-compose/index.js +31 -1199
- package/es/components/over-tooltips/index.js +27 -20
- package/es/components/search-filter/index.js +55 -1266
- package/es/components/shops-filter/index.js +24 -1182
- package/es/components/staffs-selector/index.js +130 -1240
- package/es/components/timeline/index.js +6 -6
- package/es/components/upload/index.js +98 -1333
- package/es/utils/uniqueId.js +5 -0
- package/es/utils/vxe-table.js +4 -3
- package/lib/components/feedback/index.js +23 -1304
- package/lib/components/float-table/index.js +37 -28
- package/lib/components/form-create/index.js +2781 -0
- package/lib/components/form-designer/index.js +4183 -8
- package/lib/components/index.js +7 -0
- package/lib/components/input-tags-display/index.js +27 -1187
- package/lib/components/multi-cascader-compose/index.js +30 -1198
- package/lib/components/over-tooltips/index.js +27 -20
- package/lib/components/search-filter/index.js +54 -1265
- package/lib/components/shops-filter/index.js +23 -1181
- package/lib/components/staffs-selector/index.js +129 -1239
- package/lib/components/timeline/index.js +6 -6
- package/lib/components/upload/index.js +97 -1332
- package/lib/utils/uniqueId.js +8 -0
- package/lib/utils/vxe-table.js +3 -2
- package/package.json +9 -4
- package/theme-chalk/button.css +1 -1
- package/theme-chalk/feedback.css +1 -1
- package/theme-chalk/float-table.css +1 -1
- package/theme-chalk/floating-vue.css +1 -1
- package/theme-chalk/flow-designer.css +1 -1
- package/theme-chalk/form-create.css +1 -0
- package/theme-chalk/form-designer.css +1 -0
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/input-tags-display.css +1 -1
- package/theme-chalk/modal.css +1 -1
- package/theme-chalk/multi-cascader-compose.css +1 -1
- package/theme-chalk/over-tooltips.css +1 -1
- package/theme-chalk/search-filter.css +1 -1
- package/theme-chalk/staffs-selector.css +1 -1
- package/theme-chalk/timeline.css +1 -1
- package/theme-chalk/upload.css +1 -1
- package/es/components/button/index.d.ts +0 -307
- package/es/components/button/src/button.d.ts +0 -12
- package/es/components/button/src/button.vue.d.ts +0 -308
- package/es/components/feedback/index.d.ts +0 -1037
- package/es/components/feedback/src/bmAlert.vue.d.ts +0 -193
- package/es/components/feedback/src/bmModal.vue.d.ts +0 -839
- package/es/components/float-table/index.d.ts +0 -70
- package/es/components/float-table/src/float-table.vue.d.ts +0 -69
- package/es/components/flow-designer/index.d.ts +0 -7
- package/es/components/flow-designer/src/flow-designer.vue.d.ts +0 -6
- package/es/components/form-designer/index.d.ts +0 -9
- package/es/components/form-designer/src/form-designer.vue.d.ts +0 -8
- package/es/components/index.d.ts +0 -13
- package/es/components/input-tags-display/index.d.ts +0 -113
- package/es/components/input-tags-display/src/input-tags-display.vue.d.ts +0 -110
- package/es/components/multi-cascader-compose/index.d.ts +0 -164
- package/es/components/multi-cascader-compose/src/multi-cascader-compose.vue.d.ts +0 -164
- package/es/components/multi-cascader-compose/src/props.d.ts +0 -40
- package/es/components/multi-cascader-compose/types.d.ts +0 -10
- package/es/components/over-tooltips/index.d.ts +0 -35
- package/es/components/over-tooltips/src/over-tooltips.vue.d.ts +0 -34
- package/es/components/search-filter/index.d.ts +0 -218
- package/es/components/search-filter/src/search-filter.d.ts +0 -77
- package/es/components/search-filter/src/search-filter.vue.d.ts +0 -217
- package/es/components/search-filter/src/search-reset-btn.vue.d.ts +0 -89
- package/es/components/shops-filter/index.d.ts +0 -99
- package/es/components/shops-filter/src/shops-filter.d.ts +0 -25
- package/es/components/shops-filter/src/shops-filter.vue.d.ts +0 -98
- package/es/components/staffs-selector/index.d.ts +0 -109
- package/es/components/staffs-selector/src/multipleCmp.vue.d.ts +0 -97
- package/es/components/staffs-selector/src/radioCmp.vue.d.ts +0 -31
- package/es/components/staffs-selector/src/staffs-selector.vue.d.ts +0 -108
- package/es/components/staffs-selector/src/variedCmp.vue.d.ts +0 -62
- package/es/components/timeline/index.d.ts +0 -107
- package/es/components/timeline/src/props.d.ts +0 -24
- package/es/components/timeline/src/timeline-item.vue.d.ts +0 -65
- package/es/components/timeline/src/timeline.vue.d.ts +0 -42
- package/es/components/upload/index.d.ts +0 -136
- package/es/components/upload/src/icons.d.ts +0 -13
- package/es/components/upload/src/upload.vue.d.ts +0 -135
- package/es/components/upload/utils/index.d.ts +0 -7
- package/es/index.d.ts +0 -6
- package/es/utils/bm-admin-ui-resolver.d.ts +0 -9
- package/es/utils/vxe-table.d.ts +0 -6
- package/es/utils/with-install.d.ts +0 -3
- package/index.esm.js +0 -47061
- package/index.js +0 -47091
- package/lib/components/button/index.d.ts +0 -307
- package/lib/components/button/src/button.d.ts +0 -12
- package/lib/components/button/src/button.vue.d.ts +0 -308
- package/lib/components/feedback/index.d.ts +0 -1037
- package/lib/components/feedback/src/bmAlert.vue.d.ts +0 -193
- package/lib/components/feedback/src/bmModal.vue.d.ts +0 -839
- package/lib/components/float-table/index.d.ts +0 -70
- package/lib/components/float-table/src/float-table.vue.d.ts +0 -69
- package/lib/components/flow-designer/index.d.ts +0 -7
- package/lib/components/flow-designer/src/flow-designer.vue.d.ts +0 -6
- package/lib/components/form-designer/index.d.ts +0 -9
- package/lib/components/form-designer/src/form-designer.vue.d.ts +0 -8
- package/lib/components/index.d.ts +0 -13
- package/lib/components/input-tags-display/index.d.ts +0 -113
- package/lib/components/input-tags-display/src/input-tags-display.vue.d.ts +0 -110
- package/lib/components/multi-cascader-compose/index.d.ts +0 -164
- package/lib/components/multi-cascader-compose/src/multi-cascader-compose.vue.d.ts +0 -164
- package/lib/components/multi-cascader-compose/src/props.d.ts +0 -40
- package/lib/components/multi-cascader-compose/types.d.ts +0 -10
- package/lib/components/over-tooltips/index.d.ts +0 -35
- package/lib/components/over-tooltips/src/over-tooltips.vue.d.ts +0 -34
- package/lib/components/search-filter/index.d.ts +0 -218
- package/lib/components/search-filter/src/search-filter.d.ts +0 -77
- package/lib/components/search-filter/src/search-filter.vue.d.ts +0 -217
- package/lib/components/search-filter/src/search-reset-btn.vue.d.ts +0 -89
- package/lib/components/shops-filter/index.d.ts +0 -99
- package/lib/components/shops-filter/src/shops-filter.d.ts +0 -25
- package/lib/components/shops-filter/src/shops-filter.vue.d.ts +0 -98
- package/lib/components/staffs-selector/index.d.ts +0 -109
- package/lib/components/staffs-selector/src/multipleCmp.vue.d.ts +0 -97
- package/lib/components/staffs-selector/src/radioCmp.vue.d.ts +0 -31
- package/lib/components/staffs-selector/src/staffs-selector.vue.d.ts +0 -108
- package/lib/components/staffs-selector/src/variedCmp.vue.d.ts +0 -62
- package/lib/components/timeline/index.d.ts +0 -107
- package/lib/components/timeline/src/props.d.ts +0 -24
- package/lib/components/timeline/src/timeline-item.vue.d.ts +0 -65
- package/lib/components/timeline/src/timeline.vue.d.ts +0 -42
- package/lib/components/upload/index.d.ts +0 -136
- package/lib/components/upload/src/icons.d.ts +0 -13
- package/lib/components/upload/src/upload.vue.d.ts +0 -135
- package/lib/components/upload/utils/index.d.ts +0 -7
- package/lib/index.d.ts +0 -6
- package/lib/utils/bm-admin-ui-resolver.d.ts +0 -9
- package/lib/utils/vxe-table.d.ts +0 -6
- package/lib/utils/with-install.d.ts +0 -3
- package/types/components/button/index.d.ts +0 -307
- package/types/components/button/src/button.d.ts +0 -12
- package/types/components/button/src/button.vue.d.ts +0 -308
- package/types/components/feedback/index.d.ts +0 -1037
- package/types/components/feedback/src/bmAlert.vue.d.ts +0 -193
- package/types/components/feedback/src/bmModal.vue.d.ts +0 -839
- package/types/components/float-table/index.d.ts +0 -70
- package/types/components/float-table/src/float-table.vue.d.ts +0 -69
- package/types/components/flow-designer/index.d.ts +0 -7
- package/types/components/flow-designer/src/flow-designer.vue.d.ts +0 -6
- package/types/components/form-designer/index.d.ts +0 -9
- package/types/components/form-designer/src/form-designer.vue.d.ts +0 -8
- package/types/components/index.d.ts +0 -13
- package/types/components/input-tags-display/index.d.ts +0 -113
- package/types/components/input-tags-display/src/input-tags-display.vue.d.ts +0 -110
- package/types/components/multi-cascader-compose/index.d.ts +0 -164
- package/types/components/multi-cascader-compose/src/multi-cascader-compose.vue.d.ts +0 -164
- package/types/components/multi-cascader-compose/src/props.d.ts +0 -40
- package/types/components/multi-cascader-compose/types.d.ts +0 -10
- package/types/components/over-tooltips/index.d.ts +0 -35
- package/types/components/over-tooltips/src/over-tooltips.vue.d.ts +0 -34
- package/types/components/search-filter/index.d.ts +0 -218
- package/types/components/search-filter/src/search-filter.d.ts +0 -77
- package/types/components/search-filter/src/search-filter.vue.d.ts +0 -217
- package/types/components/search-filter/src/search-reset-btn.vue.d.ts +0 -89
- package/types/components/shops-filter/index.d.ts +0 -99
- package/types/components/shops-filter/src/shops-filter.d.ts +0 -25
- package/types/components/shops-filter/src/shops-filter.vue.d.ts +0 -98
- package/types/components/staffs-selector/index.d.ts +0 -109
- package/types/components/staffs-selector/src/multipleCmp.vue.d.ts +0 -97
- package/types/components/staffs-selector/src/radioCmp.vue.d.ts +0 -31
- package/types/components/staffs-selector/src/staffs-selector.vue.d.ts +0 -108
- package/types/components/staffs-selector/src/variedCmp.vue.d.ts +0 -62
- package/types/components/timeline/index.d.ts +0 -107
- package/types/components/timeline/src/props.d.ts +0 -24
- package/types/components/timeline/src/timeline-item.vue.d.ts +0 -65
- package/types/components/timeline/src/timeline.vue.d.ts +0 -42
- package/types/components/upload/index.d.ts +0 -136
- package/types/components/upload/src/icons.d.ts +0 -13
- package/types/components/upload/src/upload.vue.d.ts +0 -135
- package/types/components/upload/utils/index.d.ts +0 -7
- package/types/index.d.ts +0 -6
- package/types/utils/bm-admin-ui-resolver.d.ts +0 -9
- package/types/utils/vxe-table.d.ts +0 -6
- package/types/utils/with-install.d.ts +0 -3
|
@@ -1,1132 +1,8 @@
|
|
|
1
1
|
import { withInstall } from 'bm-admin-ui/es/utils/with-install';
|
|
2
|
-
import { h, nextTick, createVNode, defineComponent, ref, watch, resolveComponent, openBlock, createElementBlock, normalizeProps, guardReactiveProps, withCtx, createElementVNode, toDisplayString, createTextVNode, withModifiers, Fragment, renderList, createBlock, createCommentVNode } from 'vue';
|
|
3
2
|
import ToolTip from 'ant-design-vue/lib/tooltip';
|
|
4
3
|
import Button from 'ant-design-vue/lib/button';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* Take input from [0, n] and return it as [0, 1]
|
|
8
|
-
* @hidden
|
|
9
|
-
*/
|
|
10
|
-
function bound01(n, max) {
|
|
11
|
-
if (isOnePointZero(n)) {
|
|
12
|
-
n = '100%';
|
|
13
|
-
}
|
|
14
|
-
var isPercent = isPercentage(n);
|
|
15
|
-
n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
|
|
16
|
-
// Automatically convert percentage into number
|
|
17
|
-
if (isPercent) {
|
|
18
|
-
n = parseInt(String(n * max), 10) / 100;
|
|
19
|
-
}
|
|
20
|
-
// Handle floating point rounding errors
|
|
21
|
-
if (Math.abs(n - max) < 0.000001) {
|
|
22
|
-
return 1;
|
|
23
|
-
}
|
|
24
|
-
// Convert into [0, 1] range if it isn't already
|
|
25
|
-
if (max === 360) {
|
|
26
|
-
// If n is a hue given in degrees,
|
|
27
|
-
// wrap around out-of-range values into [0, 360] range
|
|
28
|
-
// then convert into [0, 1].
|
|
29
|
-
n = (n < 0 ? (n % max) + max : n % max) / parseFloat(String(max));
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
// If n not a hue given in degrees
|
|
33
|
-
// Convert into [0, 1] range if it isn't already.
|
|
34
|
-
n = (n % max) / parseFloat(String(max));
|
|
35
|
-
}
|
|
36
|
-
return n;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
|
|
40
|
-
* <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
|
|
41
|
-
* @hidden
|
|
42
|
-
*/
|
|
43
|
-
function isOnePointZero(n) {
|
|
44
|
-
return typeof n === 'string' && n.indexOf('.') !== -1 && parseFloat(n) === 1;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Check to see if string passed in is a percentage
|
|
48
|
-
* @hidden
|
|
49
|
-
*/
|
|
50
|
-
function isPercentage(n) {
|
|
51
|
-
return typeof n === 'string' && n.indexOf('%') !== -1;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Return a valid alpha value [0,1] with all invalid values being set to 1
|
|
55
|
-
* @hidden
|
|
56
|
-
*/
|
|
57
|
-
function boundAlpha(a) {
|
|
58
|
-
a = parseFloat(a);
|
|
59
|
-
if (isNaN(a) || a < 0 || a > 1) {
|
|
60
|
-
a = 1;
|
|
61
|
-
}
|
|
62
|
-
return a;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Replace a decimal with it's percentage value
|
|
66
|
-
* @hidden
|
|
67
|
-
*/
|
|
68
|
-
function convertToPercentage(n) {
|
|
69
|
-
if (n <= 1) {
|
|
70
|
-
return Number(n) * 100 + "%";
|
|
71
|
-
}
|
|
72
|
-
return n;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Force a hex value to have 2 characters
|
|
76
|
-
* @hidden
|
|
77
|
-
*/
|
|
78
|
-
function pad2(c) {
|
|
79
|
-
return c.length === 1 ? '0' + c : String(c);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
|
|
83
|
-
// <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
|
|
84
|
-
/**
|
|
85
|
-
* Handle bounds / percentage checking to conform to CSS color spec
|
|
86
|
-
* <http://www.w3.org/TR/css3-color/>
|
|
87
|
-
* *Assumes:* r, g, b in [0, 255] or [0, 1]
|
|
88
|
-
* *Returns:* { r, g, b } in [0, 255]
|
|
89
|
-
*/
|
|
90
|
-
function rgbToRgb(r, g, b) {
|
|
91
|
-
return {
|
|
92
|
-
r: bound01(r, 255) * 255,
|
|
93
|
-
g: bound01(g, 255) * 255,
|
|
94
|
-
b: bound01(b, 255) * 255,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
function hue2rgb(p, q, t) {
|
|
98
|
-
if (t < 0) {
|
|
99
|
-
t += 1;
|
|
100
|
-
}
|
|
101
|
-
if (t > 1) {
|
|
102
|
-
t -= 1;
|
|
103
|
-
}
|
|
104
|
-
if (t < 1 / 6) {
|
|
105
|
-
return p + (q - p) * (6 * t);
|
|
106
|
-
}
|
|
107
|
-
if (t < 1 / 2) {
|
|
108
|
-
return q;
|
|
109
|
-
}
|
|
110
|
-
if (t < 2 / 3) {
|
|
111
|
-
return p + (q - p) * (2 / 3 - t) * 6;
|
|
112
|
-
}
|
|
113
|
-
return p;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Converts an HSL color value to RGB.
|
|
117
|
-
*
|
|
118
|
-
* *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
|
|
119
|
-
* *Returns:* { r, g, b } in the set [0, 255]
|
|
120
|
-
*/
|
|
121
|
-
function hslToRgb(h, s, l) {
|
|
122
|
-
var r;
|
|
123
|
-
var g;
|
|
124
|
-
var b;
|
|
125
|
-
h = bound01(h, 360);
|
|
126
|
-
s = bound01(s, 100);
|
|
127
|
-
l = bound01(l, 100);
|
|
128
|
-
if (s === 0) {
|
|
129
|
-
// achromatic
|
|
130
|
-
g = l;
|
|
131
|
-
b = l;
|
|
132
|
-
r = l;
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
136
|
-
var p = 2 * l - q;
|
|
137
|
-
r = hue2rgb(p, q, h + 1 / 3);
|
|
138
|
-
g = hue2rgb(p, q, h);
|
|
139
|
-
b = hue2rgb(p, q, h - 1 / 3);
|
|
140
|
-
}
|
|
141
|
-
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Converts an RGB color value to HSV
|
|
145
|
-
*
|
|
146
|
-
* *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
|
|
147
|
-
* *Returns:* { h, s, v } in [0,1]
|
|
148
|
-
*/
|
|
149
|
-
function rgbToHsv(r, g, b) {
|
|
150
|
-
r = bound01(r, 255);
|
|
151
|
-
g = bound01(g, 255);
|
|
152
|
-
b = bound01(b, 255);
|
|
153
|
-
var max = Math.max(r, g, b);
|
|
154
|
-
var min = Math.min(r, g, b);
|
|
155
|
-
var h = 0;
|
|
156
|
-
var v = max;
|
|
157
|
-
var d = max - min;
|
|
158
|
-
var s = max === 0 ? 0 : d / max;
|
|
159
|
-
if (max === min) {
|
|
160
|
-
h = 0; // achromatic
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
switch (max) {
|
|
164
|
-
case r:
|
|
165
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
166
|
-
break;
|
|
167
|
-
case g:
|
|
168
|
-
h = (b - r) / d + 2;
|
|
169
|
-
break;
|
|
170
|
-
case b:
|
|
171
|
-
h = (r - g) / d + 4;
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
174
|
-
h /= 6;
|
|
175
|
-
}
|
|
176
|
-
return { h: h, s: s, v: v };
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Converts an HSV color value to RGB.
|
|
180
|
-
*
|
|
181
|
-
* *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
|
|
182
|
-
* *Returns:* { r, g, b } in the set [0, 255]
|
|
183
|
-
*/
|
|
184
|
-
function hsvToRgb(h, s, v) {
|
|
185
|
-
h = bound01(h, 360) * 6;
|
|
186
|
-
s = bound01(s, 100);
|
|
187
|
-
v = bound01(v, 100);
|
|
188
|
-
var i = Math.floor(h);
|
|
189
|
-
var f = h - i;
|
|
190
|
-
var p = v * (1 - s);
|
|
191
|
-
var q = v * (1 - f * s);
|
|
192
|
-
var t = v * (1 - (1 - f) * s);
|
|
193
|
-
var mod = i % 6;
|
|
194
|
-
var r = [v, q, p, p, t, v][mod];
|
|
195
|
-
var g = [t, v, v, q, p, p][mod];
|
|
196
|
-
var b = [p, p, t, v, v, q][mod];
|
|
197
|
-
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Converts an RGB color to hex
|
|
201
|
-
*
|
|
202
|
-
* Assumes r, g, and b are contained in the set [0, 255]
|
|
203
|
-
* Returns a 3 or 6 character hex
|
|
204
|
-
*/
|
|
205
|
-
function rgbToHex(r, g, b, allow3Char) {
|
|
206
|
-
var hex = [
|
|
207
|
-
pad2(Math.round(r).toString(16)),
|
|
208
|
-
pad2(Math.round(g).toString(16)),
|
|
209
|
-
pad2(Math.round(b).toString(16)),
|
|
210
|
-
];
|
|
211
|
-
// Return a 3 character hex if possible
|
|
212
|
-
if (allow3Char &&
|
|
213
|
-
hex[0].startsWith(hex[0].charAt(1)) &&
|
|
214
|
-
hex[1].startsWith(hex[1].charAt(1)) &&
|
|
215
|
-
hex[2].startsWith(hex[2].charAt(1))) {
|
|
216
|
-
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
217
|
-
}
|
|
218
|
-
return hex.join('');
|
|
219
|
-
}
|
|
220
|
-
/** Converts a hex value to a decimal */
|
|
221
|
-
function convertHexToDecimal(h) {
|
|
222
|
-
return parseIntFromHex(h) / 255;
|
|
223
|
-
}
|
|
224
|
-
/** Parse a base-16 hex value into a base-10 integer */
|
|
225
|
-
function parseIntFromHex(val) {
|
|
226
|
-
return parseInt(val, 16);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// https://github.com/bahamas10/css-color-names/blob/master/css-color-names.json
|
|
230
|
-
/**
|
|
231
|
-
* @hidden
|
|
232
|
-
*/
|
|
233
|
-
var names = {
|
|
234
|
-
aliceblue: '#f0f8ff',
|
|
235
|
-
antiquewhite: '#faebd7',
|
|
236
|
-
aqua: '#00ffff',
|
|
237
|
-
aquamarine: '#7fffd4',
|
|
238
|
-
azure: '#f0ffff',
|
|
239
|
-
beige: '#f5f5dc',
|
|
240
|
-
bisque: '#ffe4c4',
|
|
241
|
-
black: '#000000',
|
|
242
|
-
blanchedalmond: '#ffebcd',
|
|
243
|
-
blue: '#0000ff',
|
|
244
|
-
blueviolet: '#8a2be2',
|
|
245
|
-
brown: '#a52a2a',
|
|
246
|
-
burlywood: '#deb887',
|
|
247
|
-
cadetblue: '#5f9ea0',
|
|
248
|
-
chartreuse: '#7fff00',
|
|
249
|
-
chocolate: '#d2691e',
|
|
250
|
-
coral: '#ff7f50',
|
|
251
|
-
cornflowerblue: '#6495ed',
|
|
252
|
-
cornsilk: '#fff8dc',
|
|
253
|
-
crimson: '#dc143c',
|
|
254
|
-
cyan: '#00ffff',
|
|
255
|
-
darkblue: '#00008b',
|
|
256
|
-
darkcyan: '#008b8b',
|
|
257
|
-
darkgoldenrod: '#b8860b',
|
|
258
|
-
darkgray: '#a9a9a9',
|
|
259
|
-
darkgreen: '#006400',
|
|
260
|
-
darkgrey: '#a9a9a9',
|
|
261
|
-
darkkhaki: '#bdb76b',
|
|
262
|
-
darkmagenta: '#8b008b',
|
|
263
|
-
darkolivegreen: '#556b2f',
|
|
264
|
-
darkorange: '#ff8c00',
|
|
265
|
-
darkorchid: '#9932cc',
|
|
266
|
-
darkred: '#8b0000',
|
|
267
|
-
darksalmon: '#e9967a',
|
|
268
|
-
darkseagreen: '#8fbc8f',
|
|
269
|
-
darkslateblue: '#483d8b',
|
|
270
|
-
darkslategray: '#2f4f4f',
|
|
271
|
-
darkslategrey: '#2f4f4f',
|
|
272
|
-
darkturquoise: '#00ced1',
|
|
273
|
-
darkviolet: '#9400d3',
|
|
274
|
-
deeppink: '#ff1493',
|
|
275
|
-
deepskyblue: '#00bfff',
|
|
276
|
-
dimgray: '#696969',
|
|
277
|
-
dimgrey: '#696969',
|
|
278
|
-
dodgerblue: '#1e90ff',
|
|
279
|
-
firebrick: '#b22222',
|
|
280
|
-
floralwhite: '#fffaf0',
|
|
281
|
-
forestgreen: '#228b22',
|
|
282
|
-
fuchsia: '#ff00ff',
|
|
283
|
-
gainsboro: '#dcdcdc',
|
|
284
|
-
ghostwhite: '#f8f8ff',
|
|
285
|
-
goldenrod: '#daa520',
|
|
286
|
-
gold: '#ffd700',
|
|
287
|
-
gray: '#808080',
|
|
288
|
-
green: '#008000',
|
|
289
|
-
greenyellow: '#adff2f',
|
|
290
|
-
grey: '#808080',
|
|
291
|
-
honeydew: '#f0fff0',
|
|
292
|
-
hotpink: '#ff69b4',
|
|
293
|
-
indianred: '#cd5c5c',
|
|
294
|
-
indigo: '#4b0082',
|
|
295
|
-
ivory: '#fffff0',
|
|
296
|
-
khaki: '#f0e68c',
|
|
297
|
-
lavenderblush: '#fff0f5',
|
|
298
|
-
lavender: '#e6e6fa',
|
|
299
|
-
lawngreen: '#7cfc00',
|
|
300
|
-
lemonchiffon: '#fffacd',
|
|
301
|
-
lightblue: '#add8e6',
|
|
302
|
-
lightcoral: '#f08080',
|
|
303
|
-
lightcyan: '#e0ffff',
|
|
304
|
-
lightgoldenrodyellow: '#fafad2',
|
|
305
|
-
lightgray: '#d3d3d3',
|
|
306
|
-
lightgreen: '#90ee90',
|
|
307
|
-
lightgrey: '#d3d3d3',
|
|
308
|
-
lightpink: '#ffb6c1',
|
|
309
|
-
lightsalmon: '#ffa07a',
|
|
310
|
-
lightseagreen: '#20b2aa',
|
|
311
|
-
lightskyblue: '#87cefa',
|
|
312
|
-
lightslategray: '#778899',
|
|
313
|
-
lightslategrey: '#778899',
|
|
314
|
-
lightsteelblue: '#b0c4de',
|
|
315
|
-
lightyellow: '#ffffe0',
|
|
316
|
-
lime: '#00ff00',
|
|
317
|
-
limegreen: '#32cd32',
|
|
318
|
-
linen: '#faf0e6',
|
|
319
|
-
magenta: '#ff00ff',
|
|
320
|
-
maroon: '#800000',
|
|
321
|
-
mediumaquamarine: '#66cdaa',
|
|
322
|
-
mediumblue: '#0000cd',
|
|
323
|
-
mediumorchid: '#ba55d3',
|
|
324
|
-
mediumpurple: '#9370db',
|
|
325
|
-
mediumseagreen: '#3cb371',
|
|
326
|
-
mediumslateblue: '#7b68ee',
|
|
327
|
-
mediumspringgreen: '#00fa9a',
|
|
328
|
-
mediumturquoise: '#48d1cc',
|
|
329
|
-
mediumvioletred: '#c71585',
|
|
330
|
-
midnightblue: '#191970',
|
|
331
|
-
mintcream: '#f5fffa',
|
|
332
|
-
mistyrose: '#ffe4e1',
|
|
333
|
-
moccasin: '#ffe4b5',
|
|
334
|
-
navajowhite: '#ffdead',
|
|
335
|
-
navy: '#000080',
|
|
336
|
-
oldlace: '#fdf5e6',
|
|
337
|
-
olive: '#808000',
|
|
338
|
-
olivedrab: '#6b8e23',
|
|
339
|
-
orange: '#ffa500',
|
|
340
|
-
orangered: '#ff4500',
|
|
341
|
-
orchid: '#da70d6',
|
|
342
|
-
palegoldenrod: '#eee8aa',
|
|
343
|
-
palegreen: '#98fb98',
|
|
344
|
-
paleturquoise: '#afeeee',
|
|
345
|
-
palevioletred: '#db7093',
|
|
346
|
-
papayawhip: '#ffefd5',
|
|
347
|
-
peachpuff: '#ffdab9',
|
|
348
|
-
peru: '#cd853f',
|
|
349
|
-
pink: '#ffc0cb',
|
|
350
|
-
plum: '#dda0dd',
|
|
351
|
-
powderblue: '#b0e0e6',
|
|
352
|
-
purple: '#800080',
|
|
353
|
-
rebeccapurple: '#663399',
|
|
354
|
-
red: '#ff0000',
|
|
355
|
-
rosybrown: '#bc8f8f',
|
|
356
|
-
royalblue: '#4169e1',
|
|
357
|
-
saddlebrown: '#8b4513',
|
|
358
|
-
salmon: '#fa8072',
|
|
359
|
-
sandybrown: '#f4a460',
|
|
360
|
-
seagreen: '#2e8b57',
|
|
361
|
-
seashell: '#fff5ee',
|
|
362
|
-
sienna: '#a0522d',
|
|
363
|
-
silver: '#c0c0c0',
|
|
364
|
-
skyblue: '#87ceeb',
|
|
365
|
-
slateblue: '#6a5acd',
|
|
366
|
-
slategray: '#708090',
|
|
367
|
-
slategrey: '#708090',
|
|
368
|
-
snow: '#fffafa',
|
|
369
|
-
springgreen: '#00ff7f',
|
|
370
|
-
steelblue: '#4682b4',
|
|
371
|
-
tan: '#d2b48c',
|
|
372
|
-
teal: '#008080',
|
|
373
|
-
thistle: '#d8bfd8',
|
|
374
|
-
tomato: '#ff6347',
|
|
375
|
-
turquoise: '#40e0d0',
|
|
376
|
-
violet: '#ee82ee',
|
|
377
|
-
wheat: '#f5deb3',
|
|
378
|
-
white: '#ffffff',
|
|
379
|
-
whitesmoke: '#f5f5f5',
|
|
380
|
-
yellow: '#ffff00',
|
|
381
|
-
yellowgreen: '#9acd32',
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
* Given a string or object, convert that input to RGB
|
|
386
|
-
*
|
|
387
|
-
* Possible string inputs:
|
|
388
|
-
* ```
|
|
389
|
-
* "red"
|
|
390
|
-
* "#f00" or "f00"
|
|
391
|
-
* "#ff0000" or "ff0000"
|
|
392
|
-
* "#ff000000" or "ff000000"
|
|
393
|
-
* "rgb 255 0 0" or "rgb (255, 0, 0)"
|
|
394
|
-
* "rgb 1.0 0 0" or "rgb (1, 0, 0)"
|
|
395
|
-
* "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
|
|
396
|
-
* "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
|
|
397
|
-
* "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
|
|
398
|
-
* "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
|
|
399
|
-
* "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
|
|
400
|
-
* ```
|
|
401
|
-
*/
|
|
402
|
-
function inputToRGB(color) {
|
|
403
|
-
var rgb = { r: 0, g: 0, b: 0 };
|
|
404
|
-
var a = 1;
|
|
405
|
-
var s = null;
|
|
406
|
-
var v = null;
|
|
407
|
-
var l = null;
|
|
408
|
-
var ok = false;
|
|
409
|
-
var format = false;
|
|
410
|
-
if (typeof color === 'string') {
|
|
411
|
-
color = stringInputToObject(color);
|
|
412
|
-
}
|
|
413
|
-
if (typeof color === 'object') {
|
|
414
|
-
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
415
|
-
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
416
|
-
ok = true;
|
|
417
|
-
format = String(color.r).substr(-1) === '%' ? 'prgb' : 'rgb';
|
|
418
|
-
}
|
|
419
|
-
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
420
|
-
s = convertToPercentage(color.s);
|
|
421
|
-
v = convertToPercentage(color.v);
|
|
422
|
-
rgb = hsvToRgb(color.h, s, v);
|
|
423
|
-
ok = true;
|
|
424
|
-
format = 'hsv';
|
|
425
|
-
}
|
|
426
|
-
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
427
|
-
s = convertToPercentage(color.s);
|
|
428
|
-
l = convertToPercentage(color.l);
|
|
429
|
-
rgb = hslToRgb(color.h, s, l);
|
|
430
|
-
ok = true;
|
|
431
|
-
format = 'hsl';
|
|
432
|
-
}
|
|
433
|
-
if (Object.prototype.hasOwnProperty.call(color, 'a')) {
|
|
434
|
-
a = color.a;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
a = boundAlpha(a);
|
|
438
|
-
return {
|
|
439
|
-
ok: ok,
|
|
440
|
-
format: color.format || format,
|
|
441
|
-
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
442
|
-
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
443
|
-
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
444
|
-
a: a,
|
|
445
|
-
};
|
|
446
|
-
}
|
|
447
|
-
// <http://www.w3.org/TR/css3-values/#integers>
|
|
448
|
-
var CSS_INTEGER = '[-\\+]?\\d+%?';
|
|
449
|
-
// <http://www.w3.org/TR/css3-values/#number-value>
|
|
450
|
-
var CSS_NUMBER = '[-\\+]?\\d*\\.\\d+%?';
|
|
451
|
-
// Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
|
|
452
|
-
var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
|
|
453
|
-
// Actual matching.
|
|
454
|
-
// Parentheses and commas are optional, but not required.
|
|
455
|
-
// Whitespace can take the place of commas or opening paren
|
|
456
|
-
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
457
|
-
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
458
|
-
var matchers = {
|
|
459
|
-
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
460
|
-
rgb: new RegExp('rgb' + PERMISSIVE_MATCH3),
|
|
461
|
-
rgba: new RegExp('rgba' + PERMISSIVE_MATCH4),
|
|
462
|
-
hsl: new RegExp('hsl' + PERMISSIVE_MATCH3),
|
|
463
|
-
hsla: new RegExp('hsla' + PERMISSIVE_MATCH4),
|
|
464
|
-
hsv: new RegExp('hsv' + PERMISSIVE_MATCH3),
|
|
465
|
-
hsva: new RegExp('hsva' + PERMISSIVE_MATCH4),
|
|
466
|
-
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
467
|
-
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
468
|
-
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
469
|
-
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
470
|
-
};
|
|
471
|
-
/**
|
|
472
|
-
* Permissive string parsing. Take in a number of formats, and output an object
|
|
473
|
-
* based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
|
|
474
|
-
*/
|
|
475
|
-
function stringInputToObject(color) {
|
|
476
|
-
color = color.trim().toLowerCase();
|
|
477
|
-
if (color.length === 0) {
|
|
478
|
-
return false;
|
|
479
|
-
}
|
|
480
|
-
var named = false;
|
|
481
|
-
if (names[color]) {
|
|
482
|
-
color = names[color];
|
|
483
|
-
named = true;
|
|
484
|
-
}
|
|
485
|
-
else if (color === 'transparent') {
|
|
486
|
-
return { r: 0, g: 0, b: 0, a: 0, format: 'name' };
|
|
487
|
-
}
|
|
488
|
-
// Try to match string input using regular expressions.
|
|
489
|
-
// Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
|
|
490
|
-
// Just return an object and let the conversion functions handle that.
|
|
491
|
-
// This way the result will be the same whether the tinycolor is initialized with string or object.
|
|
492
|
-
var match = matchers.rgb.exec(color);
|
|
493
|
-
if (match) {
|
|
494
|
-
return { r: match[1], g: match[2], b: match[3] };
|
|
495
|
-
}
|
|
496
|
-
match = matchers.rgba.exec(color);
|
|
497
|
-
if (match) {
|
|
498
|
-
return { r: match[1], g: match[2], b: match[3], a: match[4] };
|
|
499
|
-
}
|
|
500
|
-
match = matchers.hsl.exec(color);
|
|
501
|
-
if (match) {
|
|
502
|
-
return { h: match[1], s: match[2], l: match[3] };
|
|
503
|
-
}
|
|
504
|
-
match = matchers.hsla.exec(color);
|
|
505
|
-
if (match) {
|
|
506
|
-
return { h: match[1], s: match[2], l: match[3], a: match[4] };
|
|
507
|
-
}
|
|
508
|
-
match = matchers.hsv.exec(color);
|
|
509
|
-
if (match) {
|
|
510
|
-
return { h: match[1], s: match[2], v: match[3] };
|
|
511
|
-
}
|
|
512
|
-
match = matchers.hsva.exec(color);
|
|
513
|
-
if (match) {
|
|
514
|
-
return { h: match[1], s: match[2], v: match[3], a: match[4] };
|
|
515
|
-
}
|
|
516
|
-
match = matchers.hex8.exec(color);
|
|
517
|
-
if (match) {
|
|
518
|
-
return {
|
|
519
|
-
r: parseIntFromHex(match[1]),
|
|
520
|
-
g: parseIntFromHex(match[2]),
|
|
521
|
-
b: parseIntFromHex(match[3]),
|
|
522
|
-
a: convertHexToDecimal(match[4]),
|
|
523
|
-
format: named ? 'name' : 'hex8',
|
|
524
|
-
};
|
|
525
|
-
}
|
|
526
|
-
match = matchers.hex6.exec(color);
|
|
527
|
-
if (match) {
|
|
528
|
-
return {
|
|
529
|
-
r: parseIntFromHex(match[1]),
|
|
530
|
-
g: parseIntFromHex(match[2]),
|
|
531
|
-
b: parseIntFromHex(match[3]),
|
|
532
|
-
format: named ? 'name' : 'hex',
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
|
-
match = matchers.hex4.exec(color);
|
|
536
|
-
if (match) {
|
|
537
|
-
return {
|
|
538
|
-
r: parseIntFromHex(match[1] + match[1]),
|
|
539
|
-
g: parseIntFromHex(match[2] + match[2]),
|
|
540
|
-
b: parseIntFromHex(match[3] + match[3]),
|
|
541
|
-
a: convertHexToDecimal(match[4] + match[4]),
|
|
542
|
-
format: named ? 'name' : 'hex8',
|
|
543
|
-
};
|
|
544
|
-
}
|
|
545
|
-
match = matchers.hex3.exec(color);
|
|
546
|
-
if (match) {
|
|
547
|
-
return {
|
|
548
|
-
r: parseIntFromHex(match[1] + match[1]),
|
|
549
|
-
g: parseIntFromHex(match[2] + match[2]),
|
|
550
|
-
b: parseIntFromHex(match[3] + match[3]),
|
|
551
|
-
format: named ? 'name' : 'hex',
|
|
552
|
-
};
|
|
553
|
-
}
|
|
554
|
-
return false;
|
|
555
|
-
}
|
|
556
|
-
/**
|
|
557
|
-
* Check to see if it looks like a CSS unit
|
|
558
|
-
* (see `matchers` above for definition).
|
|
559
|
-
*/
|
|
560
|
-
function isValidCSSUnit(color) {
|
|
561
|
-
return Boolean(matchers.CSS_UNIT.exec(String(color)));
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
var hueStep = 2; // 色相阶梯
|
|
565
|
-
|
|
566
|
-
var saturationStep = 0.16; // 饱和度阶梯,浅色部分
|
|
567
|
-
|
|
568
|
-
var saturationStep2 = 0.05; // 饱和度阶梯,深色部分
|
|
569
|
-
|
|
570
|
-
var brightnessStep1 = 0.05; // 亮度阶梯,浅色部分
|
|
571
|
-
|
|
572
|
-
var brightnessStep2 = 0.15; // 亮度阶梯,深色部分
|
|
573
|
-
|
|
574
|
-
var lightColorCount = 5; // 浅色数量,主色上
|
|
575
|
-
|
|
576
|
-
var darkColorCount = 4; // 深色数量,主色下
|
|
577
|
-
// 暗色主题颜色映射关系表
|
|
578
|
-
|
|
579
|
-
var darkColorMap = [{
|
|
580
|
-
index: 7,
|
|
581
|
-
opacity: 0.15
|
|
582
|
-
}, {
|
|
583
|
-
index: 6,
|
|
584
|
-
opacity: 0.25
|
|
585
|
-
}, {
|
|
586
|
-
index: 5,
|
|
587
|
-
opacity: 0.3
|
|
588
|
-
}, {
|
|
589
|
-
index: 5,
|
|
590
|
-
opacity: 0.45
|
|
591
|
-
}, {
|
|
592
|
-
index: 5,
|
|
593
|
-
opacity: 0.65
|
|
594
|
-
}, {
|
|
595
|
-
index: 5,
|
|
596
|
-
opacity: 0.85
|
|
597
|
-
}, {
|
|
598
|
-
index: 4,
|
|
599
|
-
opacity: 0.9
|
|
600
|
-
}, {
|
|
601
|
-
index: 3,
|
|
602
|
-
opacity: 0.95
|
|
603
|
-
}, {
|
|
604
|
-
index: 2,
|
|
605
|
-
opacity: 0.97
|
|
606
|
-
}, {
|
|
607
|
-
index: 1,
|
|
608
|
-
opacity: 0.98
|
|
609
|
-
}]; // Wrapper function ported from TinyColor.prototype.toHsv
|
|
610
|
-
// Keep it here because of `hsv.h * 360`
|
|
611
|
-
|
|
612
|
-
function toHsv(_ref) {
|
|
613
|
-
var r = _ref.r,
|
|
614
|
-
g = _ref.g,
|
|
615
|
-
b = _ref.b;
|
|
616
|
-
var hsv = rgbToHsv(r, g, b);
|
|
617
|
-
return {
|
|
618
|
-
h: hsv.h * 360,
|
|
619
|
-
s: hsv.s,
|
|
620
|
-
v: hsv.v
|
|
621
|
-
};
|
|
622
|
-
} // Wrapper function ported from TinyColor.prototype.toHexString
|
|
623
|
-
// Keep it here because of the prefix `#`
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
function toHex(_ref2) {
|
|
627
|
-
var r = _ref2.r,
|
|
628
|
-
g = _ref2.g,
|
|
629
|
-
b = _ref2.b;
|
|
630
|
-
return "#".concat(rgbToHex(r, g, b, false));
|
|
631
|
-
} // Wrapper function ported from TinyColor.prototype.mix, not treeshakable.
|
|
632
|
-
// Amount in range [0, 1]
|
|
633
|
-
// Assume color1 & color2 has no alpha, since the following src code did so.
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
function mix(rgb1, rgb2, amount) {
|
|
637
|
-
var p = amount / 100;
|
|
638
|
-
var rgb = {
|
|
639
|
-
r: (rgb2.r - rgb1.r) * p + rgb1.r,
|
|
640
|
-
g: (rgb2.g - rgb1.g) * p + rgb1.g,
|
|
641
|
-
b: (rgb2.b - rgb1.b) * p + rgb1.b
|
|
642
|
-
};
|
|
643
|
-
return rgb;
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
function getHue(hsv, i, light) {
|
|
647
|
-
var hue; // 根据色相不同,色相转向不同
|
|
648
|
-
|
|
649
|
-
if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
|
|
650
|
-
hue = light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i;
|
|
651
|
-
} else {
|
|
652
|
-
hue = light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i;
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
if (hue < 0) {
|
|
656
|
-
hue += 360;
|
|
657
|
-
} else if (hue >= 360) {
|
|
658
|
-
hue -= 360;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
return hue;
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
function getSaturation(hsv, i, light) {
|
|
665
|
-
// grey color don't change saturation
|
|
666
|
-
if (hsv.h === 0 && hsv.s === 0) {
|
|
667
|
-
return hsv.s;
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
var saturation;
|
|
671
|
-
|
|
672
|
-
if (light) {
|
|
673
|
-
saturation = hsv.s - saturationStep * i;
|
|
674
|
-
} else if (i === darkColorCount) {
|
|
675
|
-
saturation = hsv.s + saturationStep;
|
|
676
|
-
} else {
|
|
677
|
-
saturation = hsv.s + saturationStep2 * i;
|
|
678
|
-
} // 边界值修正
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
if (saturation > 1) {
|
|
682
|
-
saturation = 1;
|
|
683
|
-
} // 第一格的 s 限制在 0.06-0.1 之间
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
if (light && i === lightColorCount && saturation > 0.1) {
|
|
687
|
-
saturation = 0.1;
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
if (saturation < 0.06) {
|
|
691
|
-
saturation = 0.06;
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
return Number(saturation.toFixed(2));
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
function getValue(hsv, i, light) {
|
|
698
|
-
var value;
|
|
699
|
-
|
|
700
|
-
if (light) {
|
|
701
|
-
value = hsv.v + brightnessStep1 * i;
|
|
702
|
-
} else {
|
|
703
|
-
value = hsv.v - brightnessStep2 * i;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
if (value > 1) {
|
|
707
|
-
value = 1;
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
return Number(value.toFixed(2));
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
function generate$1(color) {
|
|
714
|
-
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
715
|
-
var patterns = [];
|
|
716
|
-
var pColor = inputToRGB(color);
|
|
717
|
-
|
|
718
|
-
for (var i = lightColorCount; i > 0; i -= 1) {
|
|
719
|
-
var hsv = toHsv(pColor);
|
|
720
|
-
var colorString = toHex(inputToRGB({
|
|
721
|
-
h: getHue(hsv, i, true),
|
|
722
|
-
s: getSaturation(hsv, i, true),
|
|
723
|
-
v: getValue(hsv, i, true)
|
|
724
|
-
}));
|
|
725
|
-
patterns.push(colorString);
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
patterns.push(toHex(pColor));
|
|
729
|
-
|
|
730
|
-
for (var _i = 1; _i <= darkColorCount; _i += 1) {
|
|
731
|
-
var _hsv = toHsv(pColor);
|
|
732
|
-
|
|
733
|
-
var _colorString = toHex(inputToRGB({
|
|
734
|
-
h: getHue(_hsv, _i),
|
|
735
|
-
s: getSaturation(_hsv, _i),
|
|
736
|
-
v: getValue(_hsv, _i)
|
|
737
|
-
}));
|
|
738
|
-
|
|
739
|
-
patterns.push(_colorString);
|
|
740
|
-
} // dark theme patterns
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
if (opts.theme === 'dark') {
|
|
744
|
-
return darkColorMap.map(function (_ref3) {
|
|
745
|
-
var index = _ref3.index,
|
|
746
|
-
opacity = _ref3.opacity;
|
|
747
|
-
var darkColorString = toHex(mix(inputToRGB(opts.backgroundColor || '#141414'), inputToRGB(patterns[index]), opacity * 100));
|
|
748
|
-
return darkColorString;
|
|
749
|
-
});
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
return patterns;
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
var presetPrimaryColors = {
|
|
756
|
-
red: '#F5222D',
|
|
757
|
-
volcano: '#FA541C',
|
|
758
|
-
orange: '#FA8C16',
|
|
759
|
-
gold: '#FAAD14',
|
|
760
|
-
yellow: '#FADB14',
|
|
761
|
-
lime: '#A0D911',
|
|
762
|
-
green: '#52C41A',
|
|
763
|
-
cyan: '#13C2C2',
|
|
764
|
-
blue: '#1890FF',
|
|
765
|
-
geekblue: '#2F54EB',
|
|
766
|
-
purple: '#722ED1',
|
|
767
|
-
magenta: '#EB2F96',
|
|
768
|
-
grey: '#666666'
|
|
769
|
-
};
|
|
770
|
-
var presetPalettes = {};
|
|
771
|
-
var presetDarkPalettes = {};
|
|
772
|
-
Object.keys(presetPrimaryColors).forEach(function (key) {
|
|
773
|
-
presetPalettes[key] = generate$1(presetPrimaryColors[key]);
|
|
774
|
-
presetPalettes[key].primary = presetPalettes[key][5]; // dark presetPalettes
|
|
775
|
-
|
|
776
|
-
presetDarkPalettes[key] = generate$1(presetPrimaryColors[key], {
|
|
777
|
-
theme: 'dark',
|
|
778
|
-
backgroundColor: '#141414'
|
|
779
|
-
});
|
|
780
|
-
presetDarkPalettes[key].primary = presetDarkPalettes[key][5];
|
|
781
|
-
});
|
|
782
|
-
presetPalettes.red;
|
|
783
|
-
presetPalettes.volcano;
|
|
784
|
-
presetPalettes.gold;
|
|
785
|
-
presetPalettes.orange;
|
|
786
|
-
presetPalettes.yellow;
|
|
787
|
-
presetPalettes.lime;
|
|
788
|
-
presetPalettes.green;
|
|
789
|
-
presetPalettes.cyan;
|
|
790
|
-
presetPalettes.blue;
|
|
791
|
-
presetPalettes.geekblue;
|
|
792
|
-
presetPalettes.purple;
|
|
793
|
-
presetPalettes.magenta;
|
|
794
|
-
presetPalettes.grey;
|
|
795
|
-
|
|
796
|
-
// https://github.com/substack/insert-css
|
|
797
|
-
var containers = []; // will store container HTMLElement references
|
|
798
|
-
|
|
799
|
-
var styleElements = []; // will store {prepend: HTMLElement, append: HTMLElement}
|
|
800
|
-
|
|
801
|
-
var usage = 'insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).';
|
|
802
|
-
|
|
803
|
-
function createStyleElement() {
|
|
804
|
-
var styleElement = document.createElement('style');
|
|
805
|
-
styleElement.setAttribute('type', 'text/css');
|
|
806
|
-
return styleElement;
|
|
807
|
-
} // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
function insertCss(css, options) {
|
|
811
|
-
options = options || {};
|
|
812
|
-
|
|
813
|
-
if (css === undefined) {
|
|
814
|
-
throw new Error(usage);
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
var position = options.prepend === true ? 'prepend' : 'append';
|
|
818
|
-
var container = options.container !== undefined ? options.container : document.querySelector('head');
|
|
819
|
-
var containerId = containers.indexOf(container); // first time we see this container, create the necessary entries
|
|
820
|
-
|
|
821
|
-
if (containerId === -1) {
|
|
822
|
-
containerId = containers.push(container) - 1;
|
|
823
|
-
styleElements[containerId] = {};
|
|
824
|
-
} // try to get the correponding container + position styleElement, create it otherwise
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
var styleElement;
|
|
828
|
-
|
|
829
|
-
if (styleElements[containerId] !== undefined && styleElements[containerId][position] !== undefined) {
|
|
830
|
-
styleElement = styleElements[containerId][position];
|
|
831
|
-
} else {
|
|
832
|
-
styleElement = styleElements[containerId][position] = createStyleElement();
|
|
833
|
-
|
|
834
|
-
if (position === 'prepend') {
|
|
835
|
-
container.insertBefore(styleElement, container.childNodes[0]);
|
|
836
|
-
} else {
|
|
837
|
-
container.appendChild(styleElement);
|
|
838
|
-
}
|
|
839
|
-
} // strip potential UTF-8 BOM if css was read from a file
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
if (css.charCodeAt(0) === 0xfeff) {
|
|
843
|
-
css = css.substr(1, css.length);
|
|
844
|
-
} // actually add the stylesheet
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
if (styleElement.styleSheet) {
|
|
848
|
-
styleElement.styleSheet.cssText += css;
|
|
849
|
-
} else {
|
|
850
|
-
styleElement.textContent += css;
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
return styleElement;
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$3(target, key, source[key]); }); } return target; }
|
|
857
|
-
|
|
858
|
-
function _defineProperty$3(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
859
|
-
function warn(valid, message) {
|
|
860
|
-
// Support uglify
|
|
861
|
-
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
|
|
862
|
-
console.error("Warning: ".concat(message));
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
function warning(valid, message) {
|
|
866
|
-
warn(valid, "[@ant-design/icons-vue] ".concat(message));
|
|
867
|
-
} // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
868
|
-
|
|
869
|
-
function isIconDefinition(target) {
|
|
870
|
-
return typeof target === 'object' && typeof target.name === 'string' && typeof target.theme === 'string' && (typeof target.icon === 'object' || typeof target.icon === 'function');
|
|
871
|
-
}
|
|
872
|
-
function generate(node, key, rootProps) {
|
|
873
|
-
if (!rootProps) {
|
|
874
|
-
return h(node.tag, _objectSpread$3({
|
|
875
|
-
key: key
|
|
876
|
-
}, node.attrs), (node.children || []).map(function (child, index) {
|
|
877
|
-
return generate(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
|
|
878
|
-
}));
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
return h(node.tag, _objectSpread$3({
|
|
882
|
-
key: key
|
|
883
|
-
}, rootProps, node.attrs), (node.children || []).map(function (child, index) {
|
|
884
|
-
return generate(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
|
|
885
|
-
}));
|
|
886
|
-
}
|
|
887
|
-
function getSecondaryColor(primaryColor) {
|
|
888
|
-
// choose the second color
|
|
889
|
-
return generate$1(primaryColor)[0];
|
|
890
|
-
}
|
|
891
|
-
function normalizeTwoToneColors(twoToneColor) {
|
|
892
|
-
if (!twoToneColor) {
|
|
893
|
-
return [];
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
return Array.isArray(twoToneColor) ? twoToneColor : [twoToneColor];
|
|
897
|
-
} // These props make sure that the SVG behaviours like general text.
|
|
898
|
-
var iconStyles = "\n.anticon {\n display: inline-block;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n";
|
|
899
|
-
var cssInjectedFlag = false;
|
|
900
|
-
var useInsertStyles = function useInsertStyles() {
|
|
901
|
-
var styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : iconStyles;
|
|
902
|
-
nextTick(function () {
|
|
903
|
-
if (!cssInjectedFlag) {
|
|
904
|
-
if (typeof window !== 'undefined' && window.document && window.document.documentElement) {
|
|
905
|
-
insertCss(styleStr, {
|
|
906
|
-
prepend: true
|
|
907
|
-
});
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
cssInjectedFlag = true;
|
|
911
|
-
}
|
|
912
|
-
});
|
|
913
|
-
};
|
|
914
|
-
|
|
915
|
-
var _excluded$1 = ["icon", "primaryColor", "secondaryColor"];
|
|
916
|
-
|
|
917
|
-
function _objectWithoutProperties$1(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$1(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
918
|
-
|
|
919
|
-
function _objectWithoutPropertiesLoose$1(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
920
|
-
|
|
921
|
-
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$2(target, key, source[key]); }); } return target; }
|
|
922
|
-
|
|
923
|
-
function _defineProperty$2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
924
|
-
var twoToneColorPalette = {
|
|
925
|
-
primaryColor: '#333',
|
|
926
|
-
secondaryColor: '#E6E6E6',
|
|
927
|
-
calculated: false
|
|
928
|
-
};
|
|
929
|
-
|
|
930
|
-
function setTwoToneColors(_ref) {
|
|
931
|
-
var primaryColor = _ref.primaryColor,
|
|
932
|
-
secondaryColor = _ref.secondaryColor;
|
|
933
|
-
twoToneColorPalette.primaryColor = primaryColor;
|
|
934
|
-
twoToneColorPalette.secondaryColor = secondaryColor || getSecondaryColor(primaryColor);
|
|
935
|
-
twoToneColorPalette.calculated = !!secondaryColor;
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
function getTwoToneColors() {
|
|
939
|
-
return _objectSpread$2({}, twoToneColorPalette);
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
var IconBase = function IconBase(props, context) {
|
|
943
|
-
var _props$context$attrs = _objectSpread$2({}, props, context.attrs),
|
|
944
|
-
icon = _props$context$attrs.icon,
|
|
945
|
-
primaryColor = _props$context$attrs.primaryColor,
|
|
946
|
-
secondaryColor = _props$context$attrs.secondaryColor,
|
|
947
|
-
restProps = _objectWithoutProperties$1(_props$context$attrs, _excluded$1);
|
|
948
|
-
|
|
949
|
-
var colors = twoToneColorPalette;
|
|
950
|
-
|
|
951
|
-
if (primaryColor) {
|
|
952
|
-
colors = {
|
|
953
|
-
primaryColor: primaryColor,
|
|
954
|
-
secondaryColor: secondaryColor || getSecondaryColor(primaryColor)
|
|
955
|
-
};
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
useInsertStyles();
|
|
959
|
-
warning(isIconDefinition(icon), "icon should be icon definiton, but got ".concat(icon));
|
|
960
|
-
|
|
961
|
-
if (!isIconDefinition(icon)) {
|
|
962
|
-
return null;
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
var target = icon;
|
|
966
|
-
|
|
967
|
-
if (target && typeof target.icon === 'function') {
|
|
968
|
-
target = _objectSpread$2({}, target, {
|
|
969
|
-
icon: target.icon(colors.primaryColor, colors.secondaryColor)
|
|
970
|
-
});
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
return generate(target.icon, "svg-".concat(target.name), _objectSpread$2({}, restProps, {
|
|
974
|
-
'data-icon': target.name,
|
|
975
|
-
width: '1em',
|
|
976
|
-
height: '1em',
|
|
977
|
-
fill: 'currentColor',
|
|
978
|
-
'aria-hidden': 'true'
|
|
979
|
-
})); // },
|
|
980
|
-
};
|
|
981
|
-
|
|
982
|
-
IconBase.props = {
|
|
983
|
-
icon: Object,
|
|
984
|
-
primaryColor: String,
|
|
985
|
-
secondaryColor: String,
|
|
986
|
-
focusable: String
|
|
987
|
-
};
|
|
988
|
-
IconBase.inheritAttrs = false;
|
|
989
|
-
IconBase.displayName = 'IconBase';
|
|
990
|
-
IconBase.getTwoToneColors = getTwoToneColors;
|
|
991
|
-
IconBase.setTwoToneColors = setTwoToneColors;
|
|
992
|
-
var VueIcon = IconBase;
|
|
993
|
-
|
|
994
|
-
function _slicedToArray$1(arr, i) { return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1(); }
|
|
995
|
-
|
|
996
|
-
function _nonIterableRest$1() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
997
|
-
|
|
998
|
-
function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
|
|
999
|
-
|
|
1000
|
-
function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1001
|
-
|
|
1002
|
-
function _iterableToArrayLimit$1(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
1003
|
-
|
|
1004
|
-
function _arrayWithHoles$1(arr) { if (Array.isArray(arr)) return arr; }
|
|
1005
|
-
function setTwoToneColor(twoToneColor) {
|
|
1006
|
-
var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor),
|
|
1007
|
-
_normalizeTwoToneColo2 = _slicedToArray$1(_normalizeTwoToneColo, 2),
|
|
1008
|
-
primaryColor = _normalizeTwoToneColo2[0],
|
|
1009
|
-
secondaryColor = _normalizeTwoToneColo2[1];
|
|
1010
|
-
|
|
1011
|
-
return VueIcon.setTwoToneColors({
|
|
1012
|
-
primaryColor: primaryColor,
|
|
1013
|
-
secondaryColor: secondaryColor
|
|
1014
|
-
});
|
|
1015
|
-
}
|
|
1016
|
-
function getTwoToneColor() {
|
|
1017
|
-
var colors = VueIcon.getTwoToneColors();
|
|
1018
|
-
|
|
1019
|
-
if (!colors.calculated) {
|
|
1020
|
-
return colors.primaryColor;
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
return [colors.primaryColor, colors.secondaryColor];
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
|
-
var _excluded = ["class", "icon", "spin", "rotate", "tabindex", "twoToneColor", "onClick"];
|
|
1027
|
-
|
|
1028
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
1029
|
-
|
|
1030
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1031
|
-
|
|
1032
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
1033
|
-
|
|
1034
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1035
|
-
|
|
1036
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
1037
|
-
|
|
1038
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
1039
|
-
|
|
1040
|
-
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$1(target, key, source[key]); }); } return target; }
|
|
1041
|
-
|
|
1042
|
-
function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1043
|
-
|
|
1044
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
1045
|
-
|
|
1046
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
1047
|
-
|
|
1048
|
-
setTwoToneColor('#1890ff');
|
|
1049
|
-
|
|
1050
|
-
var Icon = function Icon(props, context) {
|
|
1051
|
-
var _classObj;
|
|
1052
|
-
|
|
1053
|
-
var _props$context$attrs = _objectSpread$1({}, props, context.attrs),
|
|
1054
|
-
cls = _props$context$attrs["class"],
|
|
1055
|
-
icon = _props$context$attrs.icon,
|
|
1056
|
-
spin = _props$context$attrs.spin,
|
|
1057
|
-
rotate = _props$context$attrs.rotate,
|
|
1058
|
-
tabindex = _props$context$attrs.tabindex,
|
|
1059
|
-
twoToneColor = _props$context$attrs.twoToneColor,
|
|
1060
|
-
onClick = _props$context$attrs.onClick,
|
|
1061
|
-
restProps = _objectWithoutProperties(_props$context$attrs, _excluded);
|
|
1062
|
-
|
|
1063
|
-
var classObj = (_classObj = {
|
|
1064
|
-
anticon: true
|
|
1065
|
-
}, _defineProperty$1(_classObj, "anticon-".concat(icon.name), Boolean(icon.name)), _defineProperty$1(_classObj, cls, cls), _classObj);
|
|
1066
|
-
var svgClassString = spin === '' || !!spin || icon.name === 'loading' ? 'anticon-spin' : '';
|
|
1067
|
-
var iconTabIndex = tabindex;
|
|
1068
|
-
|
|
1069
|
-
if (iconTabIndex === undefined && onClick) {
|
|
1070
|
-
iconTabIndex = -1;
|
|
1071
|
-
restProps.tabindex = iconTabIndex;
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1074
|
-
var svgStyle = rotate ? {
|
|
1075
|
-
msTransform: "rotate(".concat(rotate, "deg)"),
|
|
1076
|
-
transform: "rotate(".concat(rotate, "deg)")
|
|
1077
|
-
} : undefined;
|
|
1078
|
-
|
|
1079
|
-
var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor),
|
|
1080
|
-
_normalizeTwoToneColo2 = _slicedToArray(_normalizeTwoToneColo, 2),
|
|
1081
|
-
primaryColor = _normalizeTwoToneColo2[0],
|
|
1082
|
-
secondaryColor = _normalizeTwoToneColo2[1];
|
|
1083
|
-
|
|
1084
|
-
return createVNode("span", _objectSpread$1({
|
|
1085
|
-
"role": "img",
|
|
1086
|
-
"aria-label": icon.name
|
|
1087
|
-
}, restProps, {
|
|
1088
|
-
"onClick": onClick,
|
|
1089
|
-
"class": classObj
|
|
1090
|
-
}), [createVNode(VueIcon, {
|
|
1091
|
-
"class": svgClassString,
|
|
1092
|
-
"icon": icon,
|
|
1093
|
-
"primaryColor": primaryColor,
|
|
1094
|
-
"secondaryColor": secondaryColor,
|
|
1095
|
-
"style": svgStyle
|
|
1096
|
-
}, null)]);
|
|
1097
|
-
};
|
|
1098
|
-
|
|
1099
|
-
Icon.props = {
|
|
1100
|
-
spin: Boolean,
|
|
1101
|
-
rotate: Number,
|
|
1102
|
-
icon: Object,
|
|
1103
|
-
twoToneColor: String
|
|
1104
|
-
};
|
|
1105
|
-
Icon.displayName = 'AntdIcon';
|
|
1106
|
-
Icon.inheritAttrs = false;
|
|
1107
|
-
Icon.getTwoToneColor = getTwoToneColor;
|
|
1108
|
-
Icon.setTwoToneColor = setTwoToneColor;
|
|
1109
|
-
var AntdIcon = Icon;
|
|
1110
|
-
|
|
1111
|
-
// This icon file is generated automatically.
|
|
1112
|
-
var CloseCircleFilled$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 01-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z" } }] }, "name": "close-circle", "theme": "filled" };
|
|
1113
|
-
var CloseCircleFilledSvg = CloseCircleFilled$2;
|
|
1114
|
-
|
|
1115
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
|
1116
|
-
|
|
1117
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1118
|
-
|
|
1119
|
-
var CloseCircleFilled = function CloseCircleFilled(props, context) {
|
|
1120
|
-
var p = _objectSpread({}, props, context.attrs);
|
|
1121
|
-
|
|
1122
|
-
return createVNode(AntdIcon, _objectSpread({}, p, {
|
|
1123
|
-
"icon": CloseCircleFilledSvg
|
|
1124
|
-
}), null);
|
|
1125
|
-
};
|
|
1126
|
-
|
|
1127
|
-
CloseCircleFilled.displayName = 'CloseCircleFilled';
|
|
1128
|
-
CloseCircleFilled.inheritAttrs = false;
|
|
1129
|
-
var CloseCircleFilled$1 = CloseCircleFilled;
|
|
4
|
+
import { CloseCircleFilled } from '@ant-design/icons-vue';
|
|
5
|
+
import { defineComponent, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, createElementVNode, toDisplayString, withModifiers, Fragment, renderList, createBlock, createTextVNode, createCommentVNode } from 'vue';
|
|
1130
6
|
|
|
1131
7
|
var _export_sfc = (sfc, props) => {
|
|
1132
8
|
const target = sfc.__vccOpts || sfc;
|
|
@@ -1137,7 +13,7 @@ var _export_sfc = (sfc, props) => {
|
|
|
1137
13
|
};
|
|
1138
14
|
|
|
1139
15
|
const _sfc_main = defineComponent({
|
|
1140
|
-
components: { ToolTip, CloseCircleFilled
|
|
16
|
+
components: { ToolTip, CloseCircleFilled, Button },
|
|
1141
17
|
props: {
|
|
1142
18
|
list: {
|
|
1143
19
|
type: Array,
|
|
@@ -1147,17 +23,10 @@ const _sfc_main = defineComponent({
|
|
|
1147
23
|
type: Boolean,
|
|
1148
24
|
default: false
|
|
1149
25
|
},
|
|
1150
|
-
placeholder: {
|
|
1151
|
-
type: String
|
|
1152
|
-
},
|
|
1153
26
|
showEmptyBtn: {
|
|
1154
27
|
type: Boolean,
|
|
1155
28
|
default: true
|
|
1156
29
|
},
|
|
1157
|
-
unitStr: {
|
|
1158
|
-
type: String,
|
|
1159
|
-
default: "\u9879"
|
|
1160
|
-
},
|
|
1161
30
|
btnText: {
|
|
1162
31
|
type: String,
|
|
1163
32
|
default: "\u6DFB\u52A0"
|
|
@@ -1165,16 +34,6 @@ const _sfc_main = defineComponent({
|
|
|
1165
34
|
placement: {
|
|
1166
35
|
type: String,
|
|
1167
36
|
default: "bottom"
|
|
1168
|
-
},
|
|
1169
|
-
toolTipProps: {
|
|
1170
|
-
type: Object,
|
|
1171
|
-
default: () => {
|
|
1172
|
-
return {};
|
|
1173
|
-
}
|
|
1174
|
-
},
|
|
1175
|
-
alwaysInvoke: {
|
|
1176
|
-
type: Boolean,
|
|
1177
|
-
default: true
|
|
1178
37
|
}
|
|
1179
38
|
},
|
|
1180
39
|
emits: ["clear", "update:list", "addClick"],
|
|
@@ -1187,42 +46,19 @@ const _sfc_main = defineComponent({
|
|
|
1187
46
|
emit("update:list", []);
|
|
1188
47
|
emit("clear");
|
|
1189
48
|
if (!props.showEmptyBtn && !props.showEmpty) {
|
|
1190
|
-
console.error(
|
|
49
|
+
console.error(
|
|
50
|
+
"\u4E0D\u5E94\u5C06showEmptyBtn\u4E0EshowEmpty\u90FD\u7F6E\u4E3Afalse,\u8282\u70B9\u5E76\u672A\u5B9E\u9645\u9500\u6BC1"
|
|
51
|
+
);
|
|
1191
52
|
}
|
|
1192
53
|
}
|
|
1193
54
|
function toAddTags() {
|
|
1194
|
-
|
|
1195
|
-
emit("addClick");
|
|
55
|
+
emit("addClick");
|
|
1196
56
|
}
|
|
1197
|
-
const tooltipConfig = ref({
|
|
1198
|
-
align: void 0,
|
|
1199
|
-
arrowPointAtCenter: false,
|
|
1200
|
-
autoAdjustOverflow: true,
|
|
1201
|
-
color: "#fff",
|
|
1202
|
-
defaultVisible: false,
|
|
1203
|
-
destroyTooltipOnHide: false,
|
|
1204
|
-
getPopupContainer,
|
|
1205
|
-
mouseEnterDelay: 0.1,
|
|
1206
|
-
mouseLeaveDelay: 0.1,
|
|
1207
|
-
overlayClassName: "__list-filter-popover",
|
|
1208
|
-
overlayStyle: null,
|
|
1209
|
-
placement: props.placement,
|
|
1210
|
-
trigger: "hover"
|
|
1211
|
-
});
|
|
1212
|
-
watch(() => props.toolTipProps, (tooltipprop) => {
|
|
1213
|
-
tooltipConfig.value = {
|
|
1214
|
-
...tooltipConfig.value,
|
|
1215
|
-
...tooltipprop
|
|
1216
|
-
};
|
|
1217
|
-
}, {
|
|
1218
|
-
immediate: true,
|
|
1219
|
-
deep: true
|
|
1220
|
-
});
|
|
1221
57
|
return {
|
|
1222
58
|
containId,
|
|
1223
59
|
clear,
|
|
1224
60
|
toAddTags,
|
|
1225
|
-
|
|
61
|
+
getPopupContainer
|
|
1226
62
|
};
|
|
1227
63
|
}
|
|
1228
64
|
});
|
|
@@ -1231,9 +67,11 @@ const _hoisted_2 = ["id"];
|
|
|
1231
67
|
const _hoisted_3 = { class: "pop-seleted" };
|
|
1232
68
|
const _hoisted_4 = { class: "pop-seleted-title" };
|
|
1233
69
|
const _hoisted_5 = /* @__PURE__ */ createTextVNode(" \u5DF2\u9009\u62E9");
|
|
1234
|
-
const _hoisted_6 =
|
|
1235
|
-
const _hoisted_7 = {
|
|
1236
|
-
const _hoisted_8 =
|
|
70
|
+
const _hoisted_6 = /* @__PURE__ */ createTextVNode("\u9879 ");
|
|
71
|
+
const _hoisted_7 = { class: "select-input-wrapper" };
|
|
72
|
+
const _hoisted_8 = { key: 1 };
|
|
73
|
+
const _hoisted_9 = { key: 2 };
|
|
74
|
+
const _hoisted_10 = /* @__PURE__ */ createElementVNode("div", null, null, -1);
|
|
1237
75
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1238
76
|
const _component_a_tag = resolveComponent("a-tag");
|
|
1239
77
|
const _component_CloseCircleFilled = resolveComponent("CloseCircleFilled");
|
|
@@ -1245,13 +83,18 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1245
83
|
id: _ctx.containId,
|
|
1246
84
|
class: "bm-tags-display-wrapper"
|
|
1247
85
|
}, [
|
|
1248
|
-
createVNode(_component_ToolTip,
|
|
86
|
+
createVNode(_component_ToolTip, {
|
|
87
|
+
color: "#fff",
|
|
88
|
+
"get-popup-container": _ctx.getPopupContainer,
|
|
89
|
+
placement: _ctx.placement,
|
|
90
|
+
"overlay-class-name": "__list-filter-popover"
|
|
91
|
+
}, {
|
|
1249
92
|
title: withCtx(() => [
|
|
1250
93
|
createElementVNode("div", _hoisted_3, [
|
|
1251
94
|
createElementVNode("div", _hoisted_4, [
|
|
1252
95
|
_hoisted_5,
|
|
1253
96
|
createElementVNode("span", null, toDisplayString(_ctx.list.length), 1),
|
|
1254
|
-
|
|
97
|
+
_hoisted_6
|
|
1255
98
|
])
|
|
1256
99
|
]),
|
|
1257
100
|
createElementVNode("div", {
|
|
@@ -1273,10 +116,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1273
116
|
], 32)
|
|
1274
117
|
]),
|
|
1275
118
|
default: withCtx(() => [
|
|
1276
|
-
createElementVNode("div",
|
|
1277
|
-
class: "select-input-wrapper",
|
|
1278
|
-
onClick: _cache[4] || (_cache[4] = (...args) => _ctx.toAddTags && _ctx.toAddTags(...args))
|
|
1279
|
-
}, [
|
|
119
|
+
createElementVNode("div", _hoisted_7, [
|
|
1280
120
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.list, (item) => {
|
|
1281
121
|
return openBlock(), createBlock(_component_a_tag, {
|
|
1282
122
|
key: item.key
|
|
@@ -1300,9 +140,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1300
140
|
])
|
|
1301
141
|
]),
|
|
1302
142
|
_: 1
|
|
1303
|
-
},
|
|
143
|
+
}, 8, ["get-popup-container", "placement"])
|
|
1304
144
|
], 8, _hoisted_2)) : createCommentVNode("v-if", true),
|
|
1305
|
-
_ctx.showEmptyBtn && !_ctx.list.length ? (openBlock(), createElementBlock("div",
|
|
145
|
+
_ctx.showEmptyBtn && !_ctx.list.length ? (openBlock(), createElementBlock("div", _hoisted_8, [
|
|
1306
146
|
createVNode(_component_Button, {
|
|
1307
147
|
onClick: withModifiers(_ctx.toAddTags, ["stop"])
|
|
1308
148
|
}, {
|
|
@@ -1312,13 +152,13 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1312
152
|
_: 1
|
|
1313
153
|
}, 8, ["onClick"])
|
|
1314
154
|
])) : createCommentVNode("v-if", true),
|
|
1315
|
-
_ctx.showEmpty && !_ctx.list.length ? (openBlock(), createElementBlock("div",
|
|
155
|
+
_ctx.showEmpty && !_ctx.list.length ? (openBlock(), createElementBlock("div", _hoisted_9, [
|
|
1316
156
|
createElementVNode("div", {
|
|
1317
157
|
class: "selector-empty-input",
|
|
1318
|
-
onClick: _cache[
|
|
1319
|
-
}, "
|
|
158
|
+
onClick: _cache[4] || (_cache[4] = withModifiers((...args) => _ctx.toAddTags && _ctx.toAddTags(...args), ["stop"]))
|
|
159
|
+
}, "\xA0")
|
|
1320
160
|
])) : createCommentVNode("v-if", true),
|
|
1321
|
-
|
|
161
|
+
_hoisted_10
|
|
1322
162
|
]);
|
|
1323
163
|
}
|
|
1324
164
|
var InputTagsDisplay = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "input-tags-display.vue"]]);
|