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