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
|
@@ -1,7 +1,1231 @@
|
|
|
1
1
|
import { withInstall } from 'bm-admin-ui/es/utils/with-install';
|
|
2
|
-
import { defineComponent, ref, resolveComponent, openBlock, createElementBlock, createTextVNode, toDisplayString, createBlock, unref, createCommentVNode, createElementVNode,
|
|
2
|
+
import { h, nextTick, createVNode, defineComponent, ref, resolveComponent, openBlock, createElementBlock, createTextVNode, toDisplayString, createBlock, unref, createCommentVNode, createElementVNode, withCtx, computed, Fragment, renderList, withModifiers, normalizeClass, renderSlot, reactive, onBeforeUnmount, watch } from 'vue';
|
|
3
3
|
import FormCreateCtr from '@form-create/ant-design-vue';
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Take input from [0, n] and return it as [0, 1]
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
function bound01(n, max) {
|
|
10
|
+
if (isOnePointZero(n)) {
|
|
11
|
+
n = '100%';
|
|
12
|
+
}
|
|
13
|
+
var isPercent = isPercentage(n);
|
|
14
|
+
n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
|
|
15
|
+
// Automatically convert percentage into number
|
|
16
|
+
if (isPercent) {
|
|
17
|
+
n = parseInt(String(n * max), 10) / 100;
|
|
18
|
+
}
|
|
19
|
+
// Handle floating point rounding errors
|
|
20
|
+
if (Math.abs(n - max) < 0.000001) {
|
|
21
|
+
return 1;
|
|
22
|
+
}
|
|
23
|
+
// Convert into [0, 1] range if it isn't already
|
|
24
|
+
if (max === 360) {
|
|
25
|
+
// If n is a hue given in degrees,
|
|
26
|
+
// wrap around out-of-range values into [0, 360] range
|
|
27
|
+
// then convert into [0, 1].
|
|
28
|
+
n = (n < 0 ? (n % max) + max : n % max) / parseFloat(String(max));
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
// If n not a hue given in degrees
|
|
32
|
+
// Convert into [0, 1] range if it isn't already.
|
|
33
|
+
n = (n % max) / parseFloat(String(max));
|
|
34
|
+
}
|
|
35
|
+
return n;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
|
|
39
|
+
* <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
|
|
40
|
+
* @hidden
|
|
41
|
+
*/
|
|
42
|
+
function isOnePointZero(n) {
|
|
43
|
+
return typeof n === 'string' && n.indexOf('.') !== -1 && parseFloat(n) === 1;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Check to see if string passed in is a percentage
|
|
47
|
+
* @hidden
|
|
48
|
+
*/
|
|
49
|
+
function isPercentage(n) {
|
|
50
|
+
return typeof n === 'string' && n.indexOf('%') !== -1;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Return a valid alpha value [0,1] with all invalid values being set to 1
|
|
54
|
+
* @hidden
|
|
55
|
+
*/
|
|
56
|
+
function boundAlpha(a) {
|
|
57
|
+
a = parseFloat(a);
|
|
58
|
+
if (isNaN(a) || a < 0 || a > 1) {
|
|
59
|
+
a = 1;
|
|
60
|
+
}
|
|
61
|
+
return a;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Replace a decimal with it's percentage value
|
|
65
|
+
* @hidden
|
|
66
|
+
*/
|
|
67
|
+
function convertToPercentage(n) {
|
|
68
|
+
if (n <= 1) {
|
|
69
|
+
return Number(n) * 100 + "%";
|
|
70
|
+
}
|
|
71
|
+
return n;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Force a hex value to have 2 characters
|
|
75
|
+
* @hidden
|
|
76
|
+
*/
|
|
77
|
+
function pad2(c) {
|
|
78
|
+
return c.length === 1 ? '0' + c : String(c);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
|
|
82
|
+
// <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
|
|
83
|
+
/**
|
|
84
|
+
* Handle bounds / percentage checking to conform to CSS color spec
|
|
85
|
+
* <http://www.w3.org/TR/css3-color/>
|
|
86
|
+
* *Assumes:* r, g, b in [0, 255] or [0, 1]
|
|
87
|
+
* *Returns:* { r, g, b } in [0, 255]
|
|
88
|
+
*/
|
|
89
|
+
function rgbToRgb(r, g, b) {
|
|
90
|
+
return {
|
|
91
|
+
r: bound01(r, 255) * 255,
|
|
92
|
+
g: bound01(g, 255) * 255,
|
|
93
|
+
b: bound01(b, 255) * 255,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function hue2rgb(p, q, t) {
|
|
97
|
+
if (t < 0) {
|
|
98
|
+
t += 1;
|
|
99
|
+
}
|
|
100
|
+
if (t > 1) {
|
|
101
|
+
t -= 1;
|
|
102
|
+
}
|
|
103
|
+
if (t < 1 / 6) {
|
|
104
|
+
return p + (q - p) * (6 * t);
|
|
105
|
+
}
|
|
106
|
+
if (t < 1 / 2) {
|
|
107
|
+
return q;
|
|
108
|
+
}
|
|
109
|
+
if (t < 2 / 3) {
|
|
110
|
+
return p + (q - p) * (2 / 3 - t) * 6;
|
|
111
|
+
}
|
|
112
|
+
return p;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Converts an HSL color value to RGB.
|
|
116
|
+
*
|
|
117
|
+
* *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
|
|
118
|
+
* *Returns:* { r, g, b } in the set [0, 255]
|
|
119
|
+
*/
|
|
120
|
+
function hslToRgb(h, s, l) {
|
|
121
|
+
var r;
|
|
122
|
+
var g;
|
|
123
|
+
var b;
|
|
124
|
+
h = bound01(h, 360);
|
|
125
|
+
s = bound01(s, 100);
|
|
126
|
+
l = bound01(l, 100);
|
|
127
|
+
if (s === 0) {
|
|
128
|
+
// achromatic
|
|
129
|
+
g = l;
|
|
130
|
+
b = l;
|
|
131
|
+
r = l;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
135
|
+
var p = 2 * l - q;
|
|
136
|
+
r = hue2rgb(p, q, h + 1 / 3);
|
|
137
|
+
g = hue2rgb(p, q, h);
|
|
138
|
+
b = hue2rgb(p, q, h - 1 / 3);
|
|
139
|
+
}
|
|
140
|
+
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Converts an RGB color value to HSV
|
|
144
|
+
*
|
|
145
|
+
* *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
|
|
146
|
+
* *Returns:* { h, s, v } in [0,1]
|
|
147
|
+
*/
|
|
148
|
+
function rgbToHsv(r, g, b) {
|
|
149
|
+
r = bound01(r, 255);
|
|
150
|
+
g = bound01(g, 255);
|
|
151
|
+
b = bound01(b, 255);
|
|
152
|
+
var max = Math.max(r, g, b);
|
|
153
|
+
var min = Math.min(r, g, b);
|
|
154
|
+
var h = 0;
|
|
155
|
+
var v = max;
|
|
156
|
+
var d = max - min;
|
|
157
|
+
var s = max === 0 ? 0 : d / max;
|
|
158
|
+
if (max === min) {
|
|
159
|
+
h = 0; // achromatic
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
switch (max) {
|
|
163
|
+
case r:
|
|
164
|
+
h = (g - b) / d + (g < b ? 6 : 0);
|
|
165
|
+
break;
|
|
166
|
+
case g:
|
|
167
|
+
h = (b - r) / d + 2;
|
|
168
|
+
break;
|
|
169
|
+
case b:
|
|
170
|
+
h = (r - g) / d + 4;
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
h /= 6;
|
|
174
|
+
}
|
|
175
|
+
return { h: h, s: s, v: v };
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Converts an HSV color value to RGB.
|
|
179
|
+
*
|
|
180
|
+
* *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
|
|
181
|
+
* *Returns:* { r, g, b } in the set [0, 255]
|
|
182
|
+
*/
|
|
183
|
+
function hsvToRgb(h, s, v) {
|
|
184
|
+
h = bound01(h, 360) * 6;
|
|
185
|
+
s = bound01(s, 100);
|
|
186
|
+
v = bound01(v, 100);
|
|
187
|
+
var i = Math.floor(h);
|
|
188
|
+
var f = h - i;
|
|
189
|
+
var p = v * (1 - s);
|
|
190
|
+
var q = v * (1 - f * s);
|
|
191
|
+
var t = v * (1 - (1 - f) * s);
|
|
192
|
+
var mod = i % 6;
|
|
193
|
+
var r = [v, q, p, p, t, v][mod];
|
|
194
|
+
var g = [t, v, v, q, p, p][mod];
|
|
195
|
+
var b = [p, p, t, v, v, q][mod];
|
|
196
|
+
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Converts an RGB color to hex
|
|
200
|
+
*
|
|
201
|
+
* Assumes r, g, and b are contained in the set [0, 255]
|
|
202
|
+
* Returns a 3 or 6 character hex
|
|
203
|
+
*/
|
|
204
|
+
function rgbToHex(r, g, b, allow3Char) {
|
|
205
|
+
var hex = [
|
|
206
|
+
pad2(Math.round(r).toString(16)),
|
|
207
|
+
pad2(Math.round(g).toString(16)),
|
|
208
|
+
pad2(Math.round(b).toString(16)),
|
|
209
|
+
];
|
|
210
|
+
// Return a 3 character hex if possible
|
|
211
|
+
if (allow3Char &&
|
|
212
|
+
hex[0].startsWith(hex[0].charAt(1)) &&
|
|
213
|
+
hex[1].startsWith(hex[1].charAt(1)) &&
|
|
214
|
+
hex[2].startsWith(hex[2].charAt(1))) {
|
|
215
|
+
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
216
|
+
}
|
|
217
|
+
return hex.join('');
|
|
218
|
+
}
|
|
219
|
+
/** Converts a hex value to a decimal */
|
|
220
|
+
function convertHexToDecimal(h) {
|
|
221
|
+
return parseIntFromHex(h) / 255;
|
|
222
|
+
}
|
|
223
|
+
/** Parse a base-16 hex value into a base-10 integer */
|
|
224
|
+
function parseIntFromHex(val) {
|
|
225
|
+
return parseInt(val, 16);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// https://github.com/bahamas10/css-color-names/blob/master/css-color-names.json
|
|
229
|
+
/**
|
|
230
|
+
* @hidden
|
|
231
|
+
*/
|
|
232
|
+
var names = {
|
|
233
|
+
aliceblue: '#f0f8ff',
|
|
234
|
+
antiquewhite: '#faebd7',
|
|
235
|
+
aqua: '#00ffff',
|
|
236
|
+
aquamarine: '#7fffd4',
|
|
237
|
+
azure: '#f0ffff',
|
|
238
|
+
beige: '#f5f5dc',
|
|
239
|
+
bisque: '#ffe4c4',
|
|
240
|
+
black: '#000000',
|
|
241
|
+
blanchedalmond: '#ffebcd',
|
|
242
|
+
blue: '#0000ff',
|
|
243
|
+
blueviolet: '#8a2be2',
|
|
244
|
+
brown: '#a52a2a',
|
|
245
|
+
burlywood: '#deb887',
|
|
246
|
+
cadetblue: '#5f9ea0',
|
|
247
|
+
chartreuse: '#7fff00',
|
|
248
|
+
chocolate: '#d2691e',
|
|
249
|
+
coral: '#ff7f50',
|
|
250
|
+
cornflowerblue: '#6495ed',
|
|
251
|
+
cornsilk: '#fff8dc',
|
|
252
|
+
crimson: '#dc143c',
|
|
253
|
+
cyan: '#00ffff',
|
|
254
|
+
darkblue: '#00008b',
|
|
255
|
+
darkcyan: '#008b8b',
|
|
256
|
+
darkgoldenrod: '#b8860b',
|
|
257
|
+
darkgray: '#a9a9a9',
|
|
258
|
+
darkgreen: '#006400',
|
|
259
|
+
darkgrey: '#a9a9a9',
|
|
260
|
+
darkkhaki: '#bdb76b',
|
|
261
|
+
darkmagenta: '#8b008b',
|
|
262
|
+
darkolivegreen: '#556b2f',
|
|
263
|
+
darkorange: '#ff8c00',
|
|
264
|
+
darkorchid: '#9932cc',
|
|
265
|
+
darkred: '#8b0000',
|
|
266
|
+
darksalmon: '#e9967a',
|
|
267
|
+
darkseagreen: '#8fbc8f',
|
|
268
|
+
darkslateblue: '#483d8b',
|
|
269
|
+
darkslategray: '#2f4f4f',
|
|
270
|
+
darkslategrey: '#2f4f4f',
|
|
271
|
+
darkturquoise: '#00ced1',
|
|
272
|
+
darkviolet: '#9400d3',
|
|
273
|
+
deeppink: '#ff1493',
|
|
274
|
+
deepskyblue: '#00bfff',
|
|
275
|
+
dimgray: '#696969',
|
|
276
|
+
dimgrey: '#696969',
|
|
277
|
+
dodgerblue: '#1e90ff',
|
|
278
|
+
firebrick: '#b22222',
|
|
279
|
+
floralwhite: '#fffaf0',
|
|
280
|
+
forestgreen: '#228b22',
|
|
281
|
+
fuchsia: '#ff00ff',
|
|
282
|
+
gainsboro: '#dcdcdc',
|
|
283
|
+
ghostwhite: '#f8f8ff',
|
|
284
|
+
goldenrod: '#daa520',
|
|
285
|
+
gold: '#ffd700',
|
|
286
|
+
gray: '#808080',
|
|
287
|
+
green: '#008000',
|
|
288
|
+
greenyellow: '#adff2f',
|
|
289
|
+
grey: '#808080',
|
|
290
|
+
honeydew: '#f0fff0',
|
|
291
|
+
hotpink: '#ff69b4',
|
|
292
|
+
indianred: '#cd5c5c',
|
|
293
|
+
indigo: '#4b0082',
|
|
294
|
+
ivory: '#fffff0',
|
|
295
|
+
khaki: '#f0e68c',
|
|
296
|
+
lavenderblush: '#fff0f5',
|
|
297
|
+
lavender: '#e6e6fa',
|
|
298
|
+
lawngreen: '#7cfc00',
|
|
299
|
+
lemonchiffon: '#fffacd',
|
|
300
|
+
lightblue: '#add8e6',
|
|
301
|
+
lightcoral: '#f08080',
|
|
302
|
+
lightcyan: '#e0ffff',
|
|
303
|
+
lightgoldenrodyellow: '#fafad2',
|
|
304
|
+
lightgray: '#d3d3d3',
|
|
305
|
+
lightgreen: '#90ee90',
|
|
306
|
+
lightgrey: '#d3d3d3',
|
|
307
|
+
lightpink: '#ffb6c1',
|
|
308
|
+
lightsalmon: '#ffa07a',
|
|
309
|
+
lightseagreen: '#20b2aa',
|
|
310
|
+
lightskyblue: '#87cefa',
|
|
311
|
+
lightslategray: '#778899',
|
|
312
|
+
lightslategrey: '#778899',
|
|
313
|
+
lightsteelblue: '#b0c4de',
|
|
314
|
+
lightyellow: '#ffffe0',
|
|
315
|
+
lime: '#00ff00',
|
|
316
|
+
limegreen: '#32cd32',
|
|
317
|
+
linen: '#faf0e6',
|
|
318
|
+
magenta: '#ff00ff',
|
|
319
|
+
maroon: '#800000',
|
|
320
|
+
mediumaquamarine: '#66cdaa',
|
|
321
|
+
mediumblue: '#0000cd',
|
|
322
|
+
mediumorchid: '#ba55d3',
|
|
323
|
+
mediumpurple: '#9370db',
|
|
324
|
+
mediumseagreen: '#3cb371',
|
|
325
|
+
mediumslateblue: '#7b68ee',
|
|
326
|
+
mediumspringgreen: '#00fa9a',
|
|
327
|
+
mediumturquoise: '#48d1cc',
|
|
328
|
+
mediumvioletred: '#c71585',
|
|
329
|
+
midnightblue: '#191970',
|
|
330
|
+
mintcream: '#f5fffa',
|
|
331
|
+
mistyrose: '#ffe4e1',
|
|
332
|
+
moccasin: '#ffe4b5',
|
|
333
|
+
navajowhite: '#ffdead',
|
|
334
|
+
navy: '#000080',
|
|
335
|
+
oldlace: '#fdf5e6',
|
|
336
|
+
olive: '#808000',
|
|
337
|
+
olivedrab: '#6b8e23',
|
|
338
|
+
orange: '#ffa500',
|
|
339
|
+
orangered: '#ff4500',
|
|
340
|
+
orchid: '#da70d6',
|
|
341
|
+
palegoldenrod: '#eee8aa',
|
|
342
|
+
palegreen: '#98fb98',
|
|
343
|
+
paleturquoise: '#afeeee',
|
|
344
|
+
palevioletred: '#db7093',
|
|
345
|
+
papayawhip: '#ffefd5',
|
|
346
|
+
peachpuff: '#ffdab9',
|
|
347
|
+
peru: '#cd853f',
|
|
348
|
+
pink: '#ffc0cb',
|
|
349
|
+
plum: '#dda0dd',
|
|
350
|
+
powderblue: '#b0e0e6',
|
|
351
|
+
purple: '#800080',
|
|
352
|
+
rebeccapurple: '#663399',
|
|
353
|
+
red: '#ff0000',
|
|
354
|
+
rosybrown: '#bc8f8f',
|
|
355
|
+
royalblue: '#4169e1',
|
|
356
|
+
saddlebrown: '#8b4513',
|
|
357
|
+
salmon: '#fa8072',
|
|
358
|
+
sandybrown: '#f4a460',
|
|
359
|
+
seagreen: '#2e8b57',
|
|
360
|
+
seashell: '#fff5ee',
|
|
361
|
+
sienna: '#a0522d',
|
|
362
|
+
silver: '#c0c0c0',
|
|
363
|
+
skyblue: '#87ceeb',
|
|
364
|
+
slateblue: '#6a5acd',
|
|
365
|
+
slategray: '#708090',
|
|
366
|
+
slategrey: '#708090',
|
|
367
|
+
snow: '#fffafa',
|
|
368
|
+
springgreen: '#00ff7f',
|
|
369
|
+
steelblue: '#4682b4',
|
|
370
|
+
tan: '#d2b48c',
|
|
371
|
+
teal: '#008080',
|
|
372
|
+
thistle: '#d8bfd8',
|
|
373
|
+
tomato: '#ff6347',
|
|
374
|
+
turquoise: '#40e0d0',
|
|
375
|
+
violet: '#ee82ee',
|
|
376
|
+
wheat: '#f5deb3',
|
|
377
|
+
white: '#ffffff',
|
|
378
|
+
whitesmoke: '#f5f5f5',
|
|
379
|
+
yellow: '#ffff00',
|
|
380
|
+
yellowgreen: '#9acd32',
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Given a string or object, convert that input to RGB
|
|
385
|
+
*
|
|
386
|
+
* Possible string inputs:
|
|
387
|
+
* ```
|
|
388
|
+
* "red"
|
|
389
|
+
* "#f00" or "f00"
|
|
390
|
+
* "#ff0000" or "ff0000"
|
|
391
|
+
* "#ff000000" or "ff000000"
|
|
392
|
+
* "rgb 255 0 0" or "rgb (255, 0, 0)"
|
|
393
|
+
* "rgb 1.0 0 0" or "rgb (1, 0, 0)"
|
|
394
|
+
* "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
|
|
395
|
+
* "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
|
|
396
|
+
* "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
|
|
397
|
+
* "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
|
|
398
|
+
* "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
|
|
399
|
+
* ```
|
|
400
|
+
*/
|
|
401
|
+
function inputToRGB(color) {
|
|
402
|
+
var rgb = { r: 0, g: 0, b: 0 };
|
|
403
|
+
var a = 1;
|
|
404
|
+
var s = null;
|
|
405
|
+
var v = null;
|
|
406
|
+
var l = null;
|
|
407
|
+
var ok = false;
|
|
408
|
+
var format = false;
|
|
409
|
+
if (typeof color === 'string') {
|
|
410
|
+
color = stringInputToObject(color);
|
|
411
|
+
}
|
|
412
|
+
if (typeof color === 'object') {
|
|
413
|
+
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
414
|
+
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
415
|
+
ok = true;
|
|
416
|
+
format = String(color.r).substr(-1) === '%' ? 'prgb' : 'rgb';
|
|
417
|
+
}
|
|
418
|
+
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
419
|
+
s = convertToPercentage(color.s);
|
|
420
|
+
v = convertToPercentage(color.v);
|
|
421
|
+
rgb = hsvToRgb(color.h, s, v);
|
|
422
|
+
ok = true;
|
|
423
|
+
format = 'hsv';
|
|
424
|
+
}
|
|
425
|
+
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
426
|
+
s = convertToPercentage(color.s);
|
|
427
|
+
l = convertToPercentage(color.l);
|
|
428
|
+
rgb = hslToRgb(color.h, s, l);
|
|
429
|
+
ok = true;
|
|
430
|
+
format = 'hsl';
|
|
431
|
+
}
|
|
432
|
+
if (Object.prototype.hasOwnProperty.call(color, 'a')) {
|
|
433
|
+
a = color.a;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
a = boundAlpha(a);
|
|
437
|
+
return {
|
|
438
|
+
ok: ok,
|
|
439
|
+
format: color.format || format,
|
|
440
|
+
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
441
|
+
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
442
|
+
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
443
|
+
a: a,
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
// <http://www.w3.org/TR/css3-values/#integers>
|
|
447
|
+
var CSS_INTEGER = '[-\\+]?\\d+%?';
|
|
448
|
+
// <http://www.w3.org/TR/css3-values/#number-value>
|
|
449
|
+
var CSS_NUMBER = '[-\\+]?\\d*\\.\\d+%?';
|
|
450
|
+
// Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
|
|
451
|
+
var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
|
|
452
|
+
// Actual matching.
|
|
453
|
+
// Parentheses and commas are optional, but not required.
|
|
454
|
+
// Whitespace can take the place of commas or opening paren
|
|
455
|
+
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
456
|
+
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
457
|
+
var matchers = {
|
|
458
|
+
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
459
|
+
rgb: new RegExp('rgb' + PERMISSIVE_MATCH3),
|
|
460
|
+
rgba: new RegExp('rgba' + PERMISSIVE_MATCH4),
|
|
461
|
+
hsl: new RegExp('hsl' + PERMISSIVE_MATCH3),
|
|
462
|
+
hsla: new RegExp('hsla' + PERMISSIVE_MATCH4),
|
|
463
|
+
hsv: new RegExp('hsv' + PERMISSIVE_MATCH3),
|
|
464
|
+
hsva: new RegExp('hsva' + PERMISSIVE_MATCH4),
|
|
465
|
+
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
466
|
+
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
467
|
+
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
468
|
+
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
469
|
+
};
|
|
470
|
+
/**
|
|
471
|
+
* Permissive string parsing. Take in a number of formats, and output an object
|
|
472
|
+
* based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
|
|
473
|
+
*/
|
|
474
|
+
function stringInputToObject(color) {
|
|
475
|
+
color = color.trim().toLowerCase();
|
|
476
|
+
if (color.length === 0) {
|
|
477
|
+
return false;
|
|
478
|
+
}
|
|
479
|
+
var named = false;
|
|
480
|
+
if (names[color]) {
|
|
481
|
+
color = names[color];
|
|
482
|
+
named = true;
|
|
483
|
+
}
|
|
484
|
+
else if (color === 'transparent') {
|
|
485
|
+
return { r: 0, g: 0, b: 0, a: 0, format: 'name' };
|
|
486
|
+
}
|
|
487
|
+
// Try to match string input using regular expressions.
|
|
488
|
+
// Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
|
|
489
|
+
// Just return an object and let the conversion functions handle that.
|
|
490
|
+
// This way the result will be the same whether the tinycolor is initialized with string or object.
|
|
491
|
+
var match = matchers.rgb.exec(color);
|
|
492
|
+
if (match) {
|
|
493
|
+
return { r: match[1], g: match[2], b: match[3] };
|
|
494
|
+
}
|
|
495
|
+
match = matchers.rgba.exec(color);
|
|
496
|
+
if (match) {
|
|
497
|
+
return { r: match[1], g: match[2], b: match[3], a: match[4] };
|
|
498
|
+
}
|
|
499
|
+
match = matchers.hsl.exec(color);
|
|
500
|
+
if (match) {
|
|
501
|
+
return { h: match[1], s: match[2], l: match[3] };
|
|
502
|
+
}
|
|
503
|
+
match = matchers.hsla.exec(color);
|
|
504
|
+
if (match) {
|
|
505
|
+
return { h: match[1], s: match[2], l: match[3], a: match[4] };
|
|
506
|
+
}
|
|
507
|
+
match = matchers.hsv.exec(color);
|
|
508
|
+
if (match) {
|
|
509
|
+
return { h: match[1], s: match[2], v: match[3] };
|
|
510
|
+
}
|
|
511
|
+
match = matchers.hsva.exec(color);
|
|
512
|
+
if (match) {
|
|
513
|
+
return { h: match[1], s: match[2], v: match[3], a: match[4] };
|
|
514
|
+
}
|
|
515
|
+
match = matchers.hex8.exec(color);
|
|
516
|
+
if (match) {
|
|
517
|
+
return {
|
|
518
|
+
r: parseIntFromHex(match[1]),
|
|
519
|
+
g: parseIntFromHex(match[2]),
|
|
520
|
+
b: parseIntFromHex(match[3]),
|
|
521
|
+
a: convertHexToDecimal(match[4]),
|
|
522
|
+
format: named ? 'name' : 'hex8',
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
match = matchers.hex6.exec(color);
|
|
526
|
+
if (match) {
|
|
527
|
+
return {
|
|
528
|
+
r: parseIntFromHex(match[1]),
|
|
529
|
+
g: parseIntFromHex(match[2]),
|
|
530
|
+
b: parseIntFromHex(match[3]),
|
|
531
|
+
format: named ? 'name' : 'hex',
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
match = matchers.hex4.exec(color);
|
|
535
|
+
if (match) {
|
|
536
|
+
return {
|
|
537
|
+
r: parseIntFromHex(match[1] + match[1]),
|
|
538
|
+
g: parseIntFromHex(match[2] + match[2]),
|
|
539
|
+
b: parseIntFromHex(match[3] + match[3]),
|
|
540
|
+
a: convertHexToDecimal(match[4] + match[4]),
|
|
541
|
+
format: named ? 'name' : 'hex8',
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
match = matchers.hex3.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
|
+
format: named ? 'name' : 'hex',
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
return false;
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Check to see if it looks like a CSS unit
|
|
557
|
+
* (see `matchers` above for definition).
|
|
558
|
+
*/
|
|
559
|
+
function isValidCSSUnit(color) {
|
|
560
|
+
return Boolean(matchers.CSS_UNIT.exec(String(color)));
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
var hueStep = 2; // 色相阶梯
|
|
564
|
+
|
|
565
|
+
var saturationStep = 0.16; // 饱和度阶梯,浅色部分
|
|
566
|
+
|
|
567
|
+
var saturationStep2 = 0.05; // 饱和度阶梯,深色部分
|
|
568
|
+
|
|
569
|
+
var brightnessStep1 = 0.05; // 亮度阶梯,浅色部分
|
|
570
|
+
|
|
571
|
+
var brightnessStep2 = 0.15; // 亮度阶梯,深色部分
|
|
572
|
+
|
|
573
|
+
var lightColorCount = 5; // 浅色数量,主色上
|
|
574
|
+
|
|
575
|
+
var darkColorCount = 4; // 深色数量,主色下
|
|
576
|
+
// 暗色主题颜色映射关系表
|
|
577
|
+
|
|
578
|
+
var darkColorMap = [{
|
|
579
|
+
index: 7,
|
|
580
|
+
opacity: 0.15
|
|
581
|
+
}, {
|
|
582
|
+
index: 6,
|
|
583
|
+
opacity: 0.25
|
|
584
|
+
}, {
|
|
585
|
+
index: 5,
|
|
586
|
+
opacity: 0.3
|
|
587
|
+
}, {
|
|
588
|
+
index: 5,
|
|
589
|
+
opacity: 0.45
|
|
590
|
+
}, {
|
|
591
|
+
index: 5,
|
|
592
|
+
opacity: 0.65
|
|
593
|
+
}, {
|
|
594
|
+
index: 5,
|
|
595
|
+
opacity: 0.85
|
|
596
|
+
}, {
|
|
597
|
+
index: 4,
|
|
598
|
+
opacity: 0.9
|
|
599
|
+
}, {
|
|
600
|
+
index: 3,
|
|
601
|
+
opacity: 0.95
|
|
602
|
+
}, {
|
|
603
|
+
index: 2,
|
|
604
|
+
opacity: 0.97
|
|
605
|
+
}, {
|
|
606
|
+
index: 1,
|
|
607
|
+
opacity: 0.98
|
|
608
|
+
}]; // Wrapper function ported from TinyColor.prototype.toHsv
|
|
609
|
+
// Keep it here because of `hsv.h * 360`
|
|
610
|
+
|
|
611
|
+
function toHsv(_ref) {
|
|
612
|
+
var r = _ref.r,
|
|
613
|
+
g = _ref.g,
|
|
614
|
+
b = _ref.b;
|
|
615
|
+
var hsv = rgbToHsv(r, g, b);
|
|
616
|
+
return {
|
|
617
|
+
h: hsv.h * 360,
|
|
618
|
+
s: hsv.s,
|
|
619
|
+
v: hsv.v
|
|
620
|
+
};
|
|
621
|
+
} // Wrapper function ported from TinyColor.prototype.toHexString
|
|
622
|
+
// Keep it here because of the prefix `#`
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
function toHex(_ref2) {
|
|
626
|
+
var r = _ref2.r,
|
|
627
|
+
g = _ref2.g,
|
|
628
|
+
b = _ref2.b;
|
|
629
|
+
return "#".concat(rgbToHex(r, g, b, false));
|
|
630
|
+
} // Wrapper function ported from TinyColor.prototype.mix, not treeshakable.
|
|
631
|
+
// Amount in range [0, 1]
|
|
632
|
+
// Assume color1 & color2 has no alpha, since the following src code did so.
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
function mix(rgb1, rgb2, amount) {
|
|
636
|
+
var p = amount / 100;
|
|
637
|
+
var rgb = {
|
|
638
|
+
r: (rgb2.r - rgb1.r) * p + rgb1.r,
|
|
639
|
+
g: (rgb2.g - rgb1.g) * p + rgb1.g,
|
|
640
|
+
b: (rgb2.b - rgb1.b) * p + rgb1.b
|
|
641
|
+
};
|
|
642
|
+
return rgb;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
function getHue(hsv, i, light) {
|
|
646
|
+
var hue; // 根据色相不同,色相转向不同
|
|
647
|
+
|
|
648
|
+
if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
|
|
649
|
+
hue = light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i;
|
|
650
|
+
} else {
|
|
651
|
+
hue = light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
if (hue < 0) {
|
|
655
|
+
hue += 360;
|
|
656
|
+
} else if (hue >= 360) {
|
|
657
|
+
hue -= 360;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
return hue;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
function getSaturation(hsv, i, light) {
|
|
664
|
+
// grey color don't change saturation
|
|
665
|
+
if (hsv.h === 0 && hsv.s === 0) {
|
|
666
|
+
return hsv.s;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
var saturation;
|
|
670
|
+
|
|
671
|
+
if (light) {
|
|
672
|
+
saturation = hsv.s - saturationStep * i;
|
|
673
|
+
} else if (i === darkColorCount) {
|
|
674
|
+
saturation = hsv.s + saturationStep;
|
|
675
|
+
} else {
|
|
676
|
+
saturation = hsv.s + saturationStep2 * i;
|
|
677
|
+
} // 边界值修正
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
if (saturation > 1) {
|
|
681
|
+
saturation = 1;
|
|
682
|
+
} // 第一格的 s 限制在 0.06-0.1 之间
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
if (light && i === lightColorCount && saturation > 0.1) {
|
|
686
|
+
saturation = 0.1;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
if (saturation < 0.06) {
|
|
690
|
+
saturation = 0.06;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
return Number(saturation.toFixed(2));
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
function getValue(hsv, i, light) {
|
|
697
|
+
var value;
|
|
698
|
+
|
|
699
|
+
if (light) {
|
|
700
|
+
value = hsv.v + brightnessStep1 * i;
|
|
701
|
+
} else {
|
|
702
|
+
value = hsv.v - brightnessStep2 * i;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
if (value > 1) {
|
|
706
|
+
value = 1;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
return Number(value.toFixed(2));
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
function generate$1(color) {
|
|
713
|
+
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
714
|
+
var patterns = [];
|
|
715
|
+
var pColor = inputToRGB(color);
|
|
716
|
+
|
|
717
|
+
for (var i = lightColorCount; i > 0; i -= 1) {
|
|
718
|
+
var hsv = toHsv(pColor);
|
|
719
|
+
var colorString = toHex(inputToRGB({
|
|
720
|
+
h: getHue(hsv, i, true),
|
|
721
|
+
s: getSaturation(hsv, i, true),
|
|
722
|
+
v: getValue(hsv, i, true)
|
|
723
|
+
}));
|
|
724
|
+
patterns.push(colorString);
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
patterns.push(toHex(pColor));
|
|
728
|
+
|
|
729
|
+
for (var _i = 1; _i <= darkColorCount; _i += 1) {
|
|
730
|
+
var _hsv = toHsv(pColor);
|
|
731
|
+
|
|
732
|
+
var _colorString = toHex(inputToRGB({
|
|
733
|
+
h: getHue(_hsv, _i),
|
|
734
|
+
s: getSaturation(_hsv, _i),
|
|
735
|
+
v: getValue(_hsv, _i)
|
|
736
|
+
}));
|
|
737
|
+
|
|
738
|
+
patterns.push(_colorString);
|
|
739
|
+
} // dark theme patterns
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
if (opts.theme === 'dark') {
|
|
743
|
+
return darkColorMap.map(function (_ref3) {
|
|
744
|
+
var index = _ref3.index,
|
|
745
|
+
opacity = _ref3.opacity;
|
|
746
|
+
var darkColorString = toHex(mix(inputToRGB(opts.backgroundColor || '#141414'), inputToRGB(patterns[index]), opacity * 100));
|
|
747
|
+
return darkColorString;
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
return patterns;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
var presetPrimaryColors = {
|
|
755
|
+
red: '#F5222D',
|
|
756
|
+
volcano: '#FA541C',
|
|
757
|
+
orange: '#FA8C16',
|
|
758
|
+
gold: '#FAAD14',
|
|
759
|
+
yellow: '#FADB14',
|
|
760
|
+
lime: '#A0D911',
|
|
761
|
+
green: '#52C41A',
|
|
762
|
+
cyan: '#13C2C2',
|
|
763
|
+
blue: '#1890FF',
|
|
764
|
+
geekblue: '#2F54EB',
|
|
765
|
+
purple: '#722ED1',
|
|
766
|
+
magenta: '#EB2F96',
|
|
767
|
+
grey: '#666666'
|
|
768
|
+
};
|
|
769
|
+
var presetPalettes = {};
|
|
770
|
+
var presetDarkPalettes = {};
|
|
771
|
+
Object.keys(presetPrimaryColors).forEach(function (key) {
|
|
772
|
+
presetPalettes[key] = generate$1(presetPrimaryColors[key]);
|
|
773
|
+
presetPalettes[key].primary = presetPalettes[key][5]; // dark presetPalettes
|
|
774
|
+
|
|
775
|
+
presetDarkPalettes[key] = generate$1(presetPrimaryColors[key], {
|
|
776
|
+
theme: 'dark',
|
|
777
|
+
backgroundColor: '#141414'
|
|
778
|
+
});
|
|
779
|
+
presetDarkPalettes[key].primary = presetDarkPalettes[key][5];
|
|
780
|
+
});
|
|
781
|
+
presetPalettes.red;
|
|
782
|
+
presetPalettes.volcano;
|
|
783
|
+
presetPalettes.gold;
|
|
784
|
+
presetPalettes.orange;
|
|
785
|
+
presetPalettes.yellow;
|
|
786
|
+
presetPalettes.lime;
|
|
787
|
+
presetPalettes.green;
|
|
788
|
+
presetPalettes.cyan;
|
|
789
|
+
presetPalettes.blue;
|
|
790
|
+
presetPalettes.geekblue;
|
|
791
|
+
presetPalettes.purple;
|
|
792
|
+
presetPalettes.magenta;
|
|
793
|
+
presetPalettes.grey;
|
|
794
|
+
|
|
795
|
+
// https://github.com/substack/insert-css
|
|
796
|
+
var containers = []; // will store container HTMLElement references
|
|
797
|
+
|
|
798
|
+
var styleElements = []; // will store {prepend: HTMLElement, append: HTMLElement}
|
|
799
|
+
|
|
800
|
+
var usage = 'insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).';
|
|
801
|
+
|
|
802
|
+
function createStyleElement() {
|
|
803
|
+
var styleElement = document.createElement('style');
|
|
804
|
+
styleElement.setAttribute('type', 'text/css');
|
|
805
|
+
return styleElement;
|
|
806
|
+
} // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
function insertCss(css, options) {
|
|
810
|
+
options = options || {};
|
|
811
|
+
|
|
812
|
+
if (css === undefined) {
|
|
813
|
+
throw new Error(usage);
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
var position = options.prepend === true ? 'prepend' : 'append';
|
|
817
|
+
var container = options.container !== undefined ? options.container : document.querySelector('head');
|
|
818
|
+
var containerId = containers.indexOf(container); // first time we see this container, create the necessary entries
|
|
819
|
+
|
|
820
|
+
if (containerId === -1) {
|
|
821
|
+
containerId = containers.push(container) - 1;
|
|
822
|
+
styleElements[containerId] = {};
|
|
823
|
+
} // try to get the correponding container + position styleElement, create it otherwise
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
var styleElement;
|
|
827
|
+
|
|
828
|
+
if (styleElements[containerId] !== undefined && styleElements[containerId][position] !== undefined) {
|
|
829
|
+
styleElement = styleElements[containerId][position];
|
|
830
|
+
} else {
|
|
831
|
+
styleElement = styleElements[containerId][position] = createStyleElement();
|
|
832
|
+
|
|
833
|
+
if (position === 'prepend') {
|
|
834
|
+
container.insertBefore(styleElement, container.childNodes[0]);
|
|
835
|
+
} else {
|
|
836
|
+
container.appendChild(styleElement);
|
|
837
|
+
}
|
|
838
|
+
} // strip potential UTF-8 BOM if css was read from a file
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
if (css.charCodeAt(0) === 0xfeff) {
|
|
842
|
+
css = css.substr(1, css.length);
|
|
843
|
+
} // actually add the stylesheet
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
if (styleElement.styleSheet) {
|
|
847
|
+
styleElement.styleSheet.cssText += css;
|
|
848
|
+
} else {
|
|
849
|
+
styleElement.textContent += css;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
return styleElement;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
function _objectSpread$8(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$8(target, key, source[key]); }); } return target; }
|
|
856
|
+
|
|
857
|
+
function _defineProperty$8(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; }
|
|
858
|
+
function warn(valid, message) {
|
|
859
|
+
// Support uglify
|
|
860
|
+
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
|
|
861
|
+
console.error("Warning: ".concat(message));
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
function warning(valid, message) {
|
|
865
|
+
warn(valid, "[@ant-design/icons-vue] ".concat(message));
|
|
866
|
+
} // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
867
|
+
|
|
868
|
+
function isIconDefinition(target) {
|
|
869
|
+
return typeof target === 'object' && typeof target.name === 'string' && typeof target.theme === 'string' && (typeof target.icon === 'object' || typeof target.icon === 'function');
|
|
870
|
+
}
|
|
871
|
+
function generate(node, key, rootProps) {
|
|
872
|
+
if (!rootProps) {
|
|
873
|
+
return h(node.tag, _objectSpread$8({
|
|
874
|
+
key: key
|
|
875
|
+
}, node.attrs), (node.children || []).map(function (child, index) {
|
|
876
|
+
return generate(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
|
|
877
|
+
}));
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
return h(node.tag, _objectSpread$8({
|
|
881
|
+
key: key
|
|
882
|
+
}, rootProps, node.attrs), (node.children || []).map(function (child, index) {
|
|
883
|
+
return generate(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
|
|
884
|
+
}));
|
|
885
|
+
}
|
|
886
|
+
function getSecondaryColor(primaryColor) {
|
|
887
|
+
// choose the second color
|
|
888
|
+
return generate$1(primaryColor)[0];
|
|
889
|
+
}
|
|
890
|
+
function normalizeTwoToneColors(twoToneColor) {
|
|
891
|
+
if (!twoToneColor) {
|
|
892
|
+
return [];
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
return Array.isArray(twoToneColor) ? twoToneColor : [twoToneColor];
|
|
896
|
+
} // These props make sure that the SVG behaviours like general text.
|
|
897
|
+
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";
|
|
898
|
+
var cssInjectedFlag = false;
|
|
899
|
+
var useInsertStyles = function useInsertStyles() {
|
|
900
|
+
var styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : iconStyles;
|
|
901
|
+
nextTick(function () {
|
|
902
|
+
if (!cssInjectedFlag) {
|
|
903
|
+
if (typeof window !== 'undefined' && window.document && window.document.documentElement) {
|
|
904
|
+
insertCss(styleStr, {
|
|
905
|
+
prepend: true
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
cssInjectedFlag = true;
|
|
910
|
+
}
|
|
911
|
+
});
|
|
912
|
+
};
|
|
913
|
+
|
|
914
|
+
var _excluded$1 = ["icon", "primaryColor", "secondaryColor"];
|
|
915
|
+
|
|
916
|
+
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; }
|
|
917
|
+
|
|
918
|
+
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; }
|
|
919
|
+
|
|
920
|
+
function _objectSpread$7(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$7(target, key, source[key]); }); } return target; }
|
|
921
|
+
|
|
922
|
+
function _defineProperty$7(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; }
|
|
923
|
+
var twoToneColorPalette = {
|
|
924
|
+
primaryColor: '#333',
|
|
925
|
+
secondaryColor: '#E6E6E6',
|
|
926
|
+
calculated: false
|
|
927
|
+
};
|
|
928
|
+
|
|
929
|
+
function setTwoToneColors(_ref) {
|
|
930
|
+
var primaryColor = _ref.primaryColor,
|
|
931
|
+
secondaryColor = _ref.secondaryColor;
|
|
932
|
+
twoToneColorPalette.primaryColor = primaryColor;
|
|
933
|
+
twoToneColorPalette.secondaryColor = secondaryColor || getSecondaryColor(primaryColor);
|
|
934
|
+
twoToneColorPalette.calculated = !!secondaryColor;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
function getTwoToneColors() {
|
|
938
|
+
return _objectSpread$7({}, twoToneColorPalette);
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
var IconBase = function IconBase(props, context) {
|
|
942
|
+
var _props$context$attrs = _objectSpread$7({}, props, context.attrs),
|
|
943
|
+
icon = _props$context$attrs.icon,
|
|
944
|
+
primaryColor = _props$context$attrs.primaryColor,
|
|
945
|
+
secondaryColor = _props$context$attrs.secondaryColor,
|
|
946
|
+
restProps = _objectWithoutProperties$1(_props$context$attrs, _excluded$1);
|
|
947
|
+
|
|
948
|
+
var colors = twoToneColorPalette;
|
|
949
|
+
|
|
950
|
+
if (primaryColor) {
|
|
951
|
+
colors = {
|
|
952
|
+
primaryColor: primaryColor,
|
|
953
|
+
secondaryColor: secondaryColor || getSecondaryColor(primaryColor)
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
useInsertStyles();
|
|
958
|
+
warning(isIconDefinition(icon), "icon should be icon definiton, but got ".concat(icon));
|
|
959
|
+
|
|
960
|
+
if (!isIconDefinition(icon)) {
|
|
961
|
+
return null;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
var target = icon;
|
|
965
|
+
|
|
966
|
+
if (target && typeof target.icon === 'function') {
|
|
967
|
+
target = _objectSpread$7({}, target, {
|
|
968
|
+
icon: target.icon(colors.primaryColor, colors.secondaryColor)
|
|
969
|
+
});
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
return generate(target.icon, "svg-".concat(target.name), _objectSpread$7({}, restProps, {
|
|
973
|
+
'data-icon': target.name,
|
|
974
|
+
width: '1em',
|
|
975
|
+
height: '1em',
|
|
976
|
+
fill: 'currentColor',
|
|
977
|
+
'aria-hidden': 'true'
|
|
978
|
+
})); // },
|
|
979
|
+
};
|
|
980
|
+
|
|
981
|
+
IconBase.props = {
|
|
982
|
+
icon: Object,
|
|
983
|
+
primaryColor: String,
|
|
984
|
+
secondaryColor: String,
|
|
985
|
+
focusable: String
|
|
986
|
+
};
|
|
987
|
+
IconBase.inheritAttrs = false;
|
|
988
|
+
IconBase.displayName = 'IconBase';
|
|
989
|
+
IconBase.getTwoToneColors = getTwoToneColors;
|
|
990
|
+
IconBase.setTwoToneColors = setTwoToneColors;
|
|
991
|
+
var VueIcon = IconBase;
|
|
992
|
+
|
|
993
|
+
function _slicedToArray$1(arr, i) { return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1(); }
|
|
994
|
+
|
|
995
|
+
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."); }
|
|
996
|
+
|
|
997
|
+
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); }
|
|
998
|
+
|
|
999
|
+
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; }
|
|
1000
|
+
|
|
1001
|
+
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; }
|
|
1002
|
+
|
|
1003
|
+
function _arrayWithHoles$1(arr) { if (Array.isArray(arr)) return arr; }
|
|
1004
|
+
function setTwoToneColor(twoToneColor) {
|
|
1005
|
+
var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor),
|
|
1006
|
+
_normalizeTwoToneColo2 = _slicedToArray$1(_normalizeTwoToneColo, 2),
|
|
1007
|
+
primaryColor = _normalizeTwoToneColo2[0],
|
|
1008
|
+
secondaryColor = _normalizeTwoToneColo2[1];
|
|
1009
|
+
|
|
1010
|
+
return VueIcon.setTwoToneColors({
|
|
1011
|
+
primaryColor: primaryColor,
|
|
1012
|
+
secondaryColor: secondaryColor
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
1015
|
+
function getTwoToneColor() {
|
|
1016
|
+
var colors = VueIcon.getTwoToneColors();
|
|
1017
|
+
|
|
1018
|
+
if (!colors.calculated) {
|
|
1019
|
+
return colors.primaryColor;
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
return [colors.primaryColor, colors.secondaryColor];
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
var _excluded = ["class", "icon", "spin", "rotate", "tabindex", "twoToneColor", "onClick"];
|
|
1026
|
+
|
|
1027
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
1028
|
+
|
|
1029
|
+
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."); }
|
|
1030
|
+
|
|
1031
|
+
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); }
|
|
1032
|
+
|
|
1033
|
+
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; }
|
|
1034
|
+
|
|
1035
|
+
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; }
|
|
1036
|
+
|
|
1037
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
1038
|
+
|
|
1039
|
+
function _objectSpread$6(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$6(target, key, source[key]); }); } return target; }
|
|
1040
|
+
|
|
1041
|
+
function _defineProperty$6(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; }
|
|
1042
|
+
|
|
1043
|
+
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; }
|
|
1044
|
+
|
|
1045
|
+
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; }
|
|
1046
|
+
|
|
1047
|
+
setTwoToneColor('#1890ff');
|
|
1048
|
+
|
|
1049
|
+
var Icon = function Icon(props, context) {
|
|
1050
|
+
var _classObj;
|
|
1051
|
+
|
|
1052
|
+
var _props$context$attrs = _objectSpread$6({}, props, context.attrs),
|
|
1053
|
+
cls = _props$context$attrs["class"],
|
|
1054
|
+
icon = _props$context$attrs.icon,
|
|
1055
|
+
spin = _props$context$attrs.spin,
|
|
1056
|
+
rotate = _props$context$attrs.rotate,
|
|
1057
|
+
tabindex = _props$context$attrs.tabindex,
|
|
1058
|
+
twoToneColor = _props$context$attrs.twoToneColor,
|
|
1059
|
+
onClick = _props$context$attrs.onClick,
|
|
1060
|
+
restProps = _objectWithoutProperties(_props$context$attrs, _excluded);
|
|
1061
|
+
|
|
1062
|
+
var classObj = (_classObj = {
|
|
1063
|
+
anticon: true
|
|
1064
|
+
}, _defineProperty$6(_classObj, "anticon-".concat(icon.name), Boolean(icon.name)), _defineProperty$6(_classObj, cls, cls), _classObj);
|
|
1065
|
+
var svgClassString = spin === '' || !!spin || icon.name === 'loading' ? 'anticon-spin' : '';
|
|
1066
|
+
var iconTabIndex = tabindex;
|
|
1067
|
+
|
|
1068
|
+
if (iconTabIndex === undefined && onClick) {
|
|
1069
|
+
iconTabIndex = -1;
|
|
1070
|
+
restProps.tabindex = iconTabIndex;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
var svgStyle = rotate ? {
|
|
1074
|
+
msTransform: "rotate(".concat(rotate, "deg)"),
|
|
1075
|
+
transform: "rotate(".concat(rotate, "deg)")
|
|
1076
|
+
} : undefined;
|
|
1077
|
+
|
|
1078
|
+
var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor),
|
|
1079
|
+
_normalizeTwoToneColo2 = _slicedToArray(_normalizeTwoToneColo, 2),
|
|
1080
|
+
primaryColor = _normalizeTwoToneColo2[0],
|
|
1081
|
+
secondaryColor = _normalizeTwoToneColo2[1];
|
|
1082
|
+
|
|
1083
|
+
return createVNode("span", _objectSpread$6({
|
|
1084
|
+
"role": "img",
|
|
1085
|
+
"aria-label": icon.name
|
|
1086
|
+
}, restProps, {
|
|
1087
|
+
"onClick": onClick,
|
|
1088
|
+
"class": classObj
|
|
1089
|
+
}), [createVNode(VueIcon, {
|
|
1090
|
+
"class": svgClassString,
|
|
1091
|
+
"icon": icon,
|
|
1092
|
+
"primaryColor": primaryColor,
|
|
1093
|
+
"secondaryColor": secondaryColor,
|
|
1094
|
+
"style": svgStyle
|
|
1095
|
+
}, null)]);
|
|
1096
|
+
};
|
|
1097
|
+
|
|
1098
|
+
Icon.props = {
|
|
1099
|
+
spin: Boolean,
|
|
1100
|
+
rotate: Number,
|
|
1101
|
+
icon: Object,
|
|
1102
|
+
twoToneColor: String
|
|
1103
|
+
};
|
|
1104
|
+
Icon.displayName = 'AntdIcon';
|
|
1105
|
+
Icon.inheritAttrs = false;
|
|
1106
|
+
Icon.getTwoToneColor = getTwoToneColor;
|
|
1107
|
+
Icon.setTwoToneColor = setTwoToneColor;
|
|
1108
|
+
var AntdIcon = Icon;
|
|
1109
|
+
|
|
1110
|
+
// This icon file is generated automatically.
|
|
1111
|
+
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" };
|
|
1112
|
+
var CloseCircleFilledSvg = CloseCircleFilled$2;
|
|
1113
|
+
|
|
1114
|
+
function _objectSpread$5(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$5(target, key, source[key]); }); } return target; }
|
|
1115
|
+
|
|
1116
|
+
function _defineProperty$5(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; }
|
|
1117
|
+
|
|
1118
|
+
var CloseCircleFilled = function CloseCircleFilled(props, context) {
|
|
1119
|
+
var p = _objectSpread$5({}, props, context.attrs);
|
|
1120
|
+
|
|
1121
|
+
return createVNode(AntdIcon, _objectSpread$5({}, p, {
|
|
1122
|
+
"icon": CloseCircleFilledSvg
|
|
1123
|
+
}), null);
|
|
1124
|
+
};
|
|
1125
|
+
|
|
1126
|
+
CloseCircleFilled.displayName = 'CloseCircleFilled';
|
|
1127
|
+
CloseCircleFilled.inheritAttrs = false;
|
|
1128
|
+
var CloseCircleFilled$1 = CloseCircleFilled;
|
|
1129
|
+
|
|
1130
|
+
// This icon file is generated automatically.
|
|
1131
|
+
var CloseOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 00203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z" } }] }, "name": "close", "theme": "outlined" };
|
|
1132
|
+
var CloseOutlinedSvg = CloseOutlined$2;
|
|
1133
|
+
|
|
1134
|
+
function _objectSpread$4(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$4(target, key, source[key]); }); } return target; }
|
|
1135
|
+
|
|
1136
|
+
function _defineProperty$4(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; }
|
|
1137
|
+
|
|
1138
|
+
var CloseOutlined = function CloseOutlined(props, context) {
|
|
1139
|
+
var p = _objectSpread$4({}, props, context.attrs);
|
|
1140
|
+
|
|
1141
|
+
return createVNode(AntdIcon, _objectSpread$4({}, p, {
|
|
1142
|
+
"icon": CloseOutlinedSvg
|
|
1143
|
+
}), null);
|
|
1144
|
+
};
|
|
1145
|
+
|
|
1146
|
+
CloseOutlined.displayName = 'CloseOutlined';
|
|
1147
|
+
CloseOutlined.inheritAttrs = false;
|
|
1148
|
+
var CloseOutlined$1 = CloseOutlined;
|
|
1149
|
+
|
|
1150
|
+
// This icon file is generated automatically.
|
|
1151
|
+
var DownOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z" } }] }, "name": "down", "theme": "outlined" };
|
|
1152
|
+
var DownOutlinedSvg = DownOutlined$2;
|
|
1153
|
+
|
|
1154
|
+
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; }
|
|
1155
|
+
|
|
1156
|
+
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; }
|
|
1157
|
+
|
|
1158
|
+
var DownOutlined = function DownOutlined(props, context) {
|
|
1159
|
+
var p = _objectSpread$3({}, props, context.attrs);
|
|
1160
|
+
|
|
1161
|
+
return createVNode(AntdIcon, _objectSpread$3({}, p, {
|
|
1162
|
+
"icon": DownOutlinedSvg
|
|
1163
|
+
}), null);
|
|
1164
|
+
};
|
|
1165
|
+
|
|
1166
|
+
DownOutlined.displayName = 'DownOutlined';
|
|
1167
|
+
DownOutlined.inheritAttrs = false;
|
|
1168
|
+
var DownOutlined$1 = DownOutlined;
|
|
1169
|
+
|
|
1170
|
+
// This icon file is generated automatically.
|
|
1171
|
+
var RightOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z" } }] }, "name": "right", "theme": "outlined" };
|
|
1172
|
+
var RightOutlinedSvg = RightOutlined$2;
|
|
1173
|
+
|
|
1174
|
+
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; }
|
|
1175
|
+
|
|
1176
|
+
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; }
|
|
1177
|
+
|
|
1178
|
+
var RightOutlined = function RightOutlined(props, context) {
|
|
1179
|
+
var p = _objectSpread$2({}, props, context.attrs);
|
|
1180
|
+
|
|
1181
|
+
return createVNode(AntdIcon, _objectSpread$2({}, p, {
|
|
1182
|
+
"icon": RightOutlinedSvg
|
|
1183
|
+
}), null);
|
|
1184
|
+
};
|
|
1185
|
+
|
|
1186
|
+
RightOutlined.displayName = 'RightOutlined';
|
|
1187
|
+
RightOutlined.inheritAttrs = false;
|
|
1188
|
+
var RightOutlined$1 = RightOutlined;
|
|
1189
|
+
|
|
1190
|
+
// This icon file is generated automatically.
|
|
1191
|
+
var SearchOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z" } }] }, "name": "search", "theme": "outlined" };
|
|
1192
|
+
var SearchOutlinedSvg = SearchOutlined$2;
|
|
1193
|
+
|
|
1194
|
+
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; }
|
|
1195
|
+
|
|
1196
|
+
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; }
|
|
1197
|
+
|
|
1198
|
+
var SearchOutlined = function SearchOutlined(props, context) {
|
|
1199
|
+
var p = _objectSpread$1({}, props, context.attrs);
|
|
1200
|
+
|
|
1201
|
+
return createVNode(AntdIcon, _objectSpread$1({}, p, {
|
|
1202
|
+
"icon": SearchOutlinedSvg
|
|
1203
|
+
}), null);
|
|
1204
|
+
};
|
|
1205
|
+
|
|
1206
|
+
SearchOutlined.displayName = 'SearchOutlined';
|
|
1207
|
+
SearchOutlined.inheritAttrs = false;
|
|
1208
|
+
var SearchOutlined$1 = SearchOutlined;
|
|
1209
|
+
|
|
1210
|
+
// This icon file is generated automatically.
|
|
1211
|
+
var UpOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z" } }] }, "name": "up", "theme": "outlined" };
|
|
1212
|
+
var UpOutlinedSvg = UpOutlined$2;
|
|
1213
|
+
|
|
1214
|
+
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; }
|
|
1215
|
+
|
|
1216
|
+
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; }
|
|
1217
|
+
|
|
1218
|
+
var UpOutlined = function UpOutlined(props, context) {
|
|
1219
|
+
var p = _objectSpread({}, props, context.attrs);
|
|
1220
|
+
|
|
1221
|
+
return createVNode(AntdIcon, _objectSpread({}, p, {
|
|
1222
|
+
"icon": UpOutlinedSvg
|
|
1223
|
+
}), null);
|
|
1224
|
+
};
|
|
1225
|
+
|
|
1226
|
+
UpOutlined.displayName = 'UpOutlined';
|
|
1227
|
+
UpOutlined.inheritAttrs = false;
|
|
1228
|
+
var UpOutlined$1 = UpOutlined;
|
|
5
1229
|
|
|
6
1230
|
const searchResetBtnProps = {
|
|
7
1231
|
showExpandBtn: {
|
|
@@ -12,6 +1236,18 @@ const searchResetBtnProps = {
|
|
|
12
1236
|
type: Boolean,
|
|
13
1237
|
default: false,
|
|
14
1238
|
},
|
|
1239
|
+
expandPlacement: {
|
|
1240
|
+
type: String,
|
|
1241
|
+
default: 'left',
|
|
1242
|
+
},
|
|
1243
|
+
expandText: {
|
|
1244
|
+
type: String,
|
|
1245
|
+
default: '展开',
|
|
1246
|
+
},
|
|
1247
|
+
collapseText: {
|
|
1248
|
+
type: String,
|
|
1249
|
+
default: '收起',
|
|
1250
|
+
},
|
|
15
1251
|
};
|
|
16
1252
|
const searchFilterProps = Object.assign({ userRule: {
|
|
17
1253
|
type: Array,
|
|
@@ -48,9 +1284,6 @@ const searchFilterProps = Object.assign({ userRule: {
|
|
|
48
1284
|
default() {
|
|
49
1285
|
return [];
|
|
50
1286
|
},
|
|
51
|
-
}, expandPlacement: {
|
|
52
|
-
type: String,
|
|
53
|
-
default: 'left',
|
|
54
1287
|
} }, searchResetBtnProps);
|
|
55
1288
|
|
|
56
1289
|
var _export_sfc = (sfc, props) => {
|
|
@@ -66,7 +1299,6 @@ const _hoisted_2$1 = { class: "bm-search-filter-actions" };
|
|
|
66
1299
|
const _hoisted_3$1 = /* @__PURE__ */ createTextVNode("\u91CD\u7F6E");
|
|
67
1300
|
const _hoisted_4$1 = /* @__PURE__ */ createTextVNode("\u67E5\u8BE2");
|
|
68
1301
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
69
|
-
__name: "search-reset-btn",
|
|
70
1302
|
props: searchResetBtnProps,
|
|
71
1303
|
emits: ["submit", "reset", "expand"],
|
|
72
1304
|
setup(__props, { emit: emits }) {
|
|
@@ -90,8 +1322,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
90
1322
|
class: "bm-search-filter-expand",
|
|
91
1323
|
onClick: handleExpandBtnChange
|
|
92
1324
|
}, [
|
|
93
|
-
createTextVNode(toDisplayString(isExpand.value ?
|
|
94
|
-
isExpand.value ? (openBlock(), createBlock(unref(UpOutlined), { key: 0 })) : (openBlock(), createBlock(unref(DownOutlined), { key: 1 }))
|
|
1325
|
+
createTextVNode(toDisplayString(isExpand.value ? props.collapseText : props.expandText), 1),
|
|
1326
|
+
isExpand.value ? (openBlock(), createBlock(unref(UpOutlined$1), { key: 0 })) : (openBlock(), createBlock(unref(DownOutlined$1), { key: 1 }))
|
|
95
1327
|
])) : createCommentVNode("v-if", true),
|
|
96
1328
|
createElementVNode("span", _hoisted_2$1, [
|
|
97
1329
|
createVNode(_component_a_button, { onClick: handleReset }, {
|
|
@@ -105,7 +1337,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
105
1337
|
onClick: handleSubmit
|
|
106
1338
|
}, {
|
|
107
1339
|
default: withCtx(() => [
|
|
108
|
-
props.showSearchIcon ? (openBlock(), createBlock(unref(SearchOutlined), { key: 0 })) : createCommentVNode("v-if", true),
|
|
1340
|
+
props.showSearchIcon ? (openBlock(), createBlock(unref(SearchOutlined$1), { key: 0 })) : createCommentVNode("v-if", true),
|
|
109
1341
|
_hoisted_4$1
|
|
110
1342
|
]),
|
|
111
1343
|
_: 1
|
|
@@ -271,9 +1503,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
271
1503
|
tempRes.push({ checked: true });
|
|
272
1504
|
} else {
|
|
273
1505
|
let tempRes2 = tempChildren[j];
|
|
274
|
-
let tempIndex2 = props.modelValue.indexOf(
|
|
275
|
-
tempRes2[props.optionValueName]
|
|
276
|
-
);
|
|
1506
|
+
let tempIndex2 = props.modelValue.indexOf(tempRes2[props.optionValueName]);
|
|
277
1507
|
if (tempIndex2 !== -1) {
|
|
278
1508
|
tempRes.push({ checked: true });
|
|
279
1509
|
} else {
|
|
@@ -299,9 +1529,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
299
1529
|
if (tempChildren) {
|
|
300
1530
|
for (let j = 0; j < tempChildren.length; j++) {
|
|
301
1531
|
let tempRes2 = tempChildren[j];
|
|
302
|
-
let tempIndex2 = props.modelValue.indexOf(
|
|
303
|
-
tempRes2[props.optionValueName]
|
|
304
|
-
);
|
|
1532
|
+
let tempIndex2 = props.modelValue.indexOf(tempRes2[props.optionValueName]);
|
|
305
1533
|
if (path.value[i] && tempRes2[props.optionValueName] === path.value[i][props.optionValueName] && tempIndex2 !== -1) {
|
|
306
1534
|
parentChecked = true;
|
|
307
1535
|
break;
|
|
@@ -383,9 +1611,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
383
1611
|
checked.push(tempOption?.[props.optionValueName]);
|
|
384
1612
|
if (tempOption?.children) {
|
|
385
1613
|
let allSonValues = getAllSonValues(tempOption.children);
|
|
386
|
-
allSonValues = allSonValues.filter(
|
|
387
|
-
(item) => item !== tempOption?.[props.optionValueName]
|
|
388
|
-
);
|
|
1614
|
+
allSonValues = allSonValues.filter((item) => item !== tempOption?.[props.optionValueName]);
|
|
389
1615
|
unChecked = unChecked.concat(allSonValues);
|
|
390
1616
|
}
|
|
391
1617
|
for (let i = level; i > 0; i--) {
|
|
@@ -400,9 +1626,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
400
1626
|
checked.push(tempOption2[props.optionValueName]);
|
|
401
1627
|
if (tempOption2.children) {
|
|
402
1628
|
let allSonValues = getAllSonValues(tempOption2.children);
|
|
403
|
-
allSonValues = allSonValues.filter(
|
|
404
|
-
(item) => item !== tempOption2[props.optionValueName]
|
|
405
|
-
);
|
|
1629
|
+
allSonValues = allSonValues.filter((item) => item !== tempOption2[props.optionValueName]);
|
|
406
1630
|
unChecked = unChecked.concat(allSonValues);
|
|
407
1631
|
}
|
|
408
1632
|
}
|
|
@@ -428,9 +1652,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
428
1652
|
if (tempStatus.checked) {
|
|
429
1653
|
checked = [];
|
|
430
1654
|
} else {
|
|
431
|
-
checked = modulersOptions.value[level].children?.map(
|
|
432
|
-
(item) => item[props.optionValueName]
|
|
433
|
-
) || [];
|
|
1655
|
+
checked = modulersOptions.value[level].children?.map((item) => item[props.optionValueName]) || [];
|
|
434
1656
|
}
|
|
435
1657
|
} else {
|
|
436
1658
|
if (tempStatus.checked) {
|
|
@@ -453,9 +1675,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
453
1675
|
checked.push(tempOption[props.optionValueName]);
|
|
454
1676
|
if (tempOption.children) {
|
|
455
1677
|
let allSonValues = getAllSonValues(tempOption.children);
|
|
456
|
-
allSonValues = allSonValues.filter(
|
|
457
|
-
(item) => item !== tempOption[props.optionValueName]
|
|
458
|
-
);
|
|
1678
|
+
allSonValues = allSonValues.filter((item) => item !== tempOption[props.optionValueName]);
|
|
459
1679
|
unChecked = unChecked.concat(allSonValues);
|
|
460
1680
|
}
|
|
461
1681
|
for (let i = level; i > 0; i--) {
|
|
@@ -470,9 +1690,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
470
1690
|
checked.push(tempOption2[props.optionValueName]);
|
|
471
1691
|
if (tempOption2.children) {
|
|
472
1692
|
let allSonValues = getAllSonValues(tempOption2.children);
|
|
473
|
-
allSonValues = allSonValues.filter(
|
|
474
|
-
(item) => item !== tempOption2[props.optionValueName]
|
|
475
|
-
);
|
|
1693
|
+
allSonValues = allSonValues.filter((item) => item !== tempOption2[props.optionValueName]);
|
|
476
1694
|
unChecked = unChecked.concat(allSonValues);
|
|
477
1695
|
}
|
|
478
1696
|
}
|
|
@@ -558,9 +1776,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
558
1776
|
return openBlock(), createElementBlock("div", {
|
|
559
1777
|
key: index,
|
|
560
1778
|
class: normalizeClass(["bm-multi-cascader-item", {
|
|
561
|
-
"is-active": path.value.find(
|
|
562
|
-
(item) => option[props.optionValueName] === item[props.optionValueName]
|
|
563
|
-
)
|
|
1779
|
+
"is-active": path.value.find((item) => option[props.optionValueName] === item[props.optionValueName])
|
|
564
1780
|
}]),
|
|
565
1781
|
onClick: ($event) => handleClick(option, level, index)
|
|
566
1782
|
}, [
|
|
@@ -579,7 +1795,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
579
1795
|
}, 1024),
|
|
580
1796
|
createElementVNode("span", _hoisted_16, [
|
|
581
1797
|
createElementVNode("span", _hoisted_17, toDisplayString(option[props.optionLabelName]), 1),
|
|
582
|
-
option.children ? (openBlock(), createBlock(unref(RightOutlined), {
|
|
1798
|
+
option.children ? (openBlock(), createBlock(unref(RightOutlined$1), {
|
|
583
1799
|
key: 0,
|
|
584
1800
|
class: "bm-multi-cascader-item-caret"
|
|
585
1801
|
})) : createCommentVNode("v-if", true)
|
|
@@ -615,7 +1831,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
615
1831
|
class: "bm-multi-cascader-tag-close",
|
|
616
1832
|
onClick: withModifiers(($event) => removeItem(item[props.optionValueName]), ["stop"])
|
|
617
1833
|
}, [
|
|
618
|
-
createVNode(unref(CloseOutlined), { class: "bm-multi-cascader-tag-close-inner" })
|
|
1834
|
+
createVNode(unref(CloseOutlined$1), { class: "bm-multi-cascader-tag-close-inner" })
|
|
619
1835
|
], 8, _hoisted_6)
|
|
620
1836
|
]);
|
|
621
1837
|
}), 128)),
|
|
@@ -627,12 +1843,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
627
1843
|
]),
|
|
628
1844
|
createElementVNode("div", _hoisted_10, [
|
|
629
1845
|
props.allowClear && props.modelValue.length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
630
|
-
createVNode(unref(DownOutlined), { class: "bm-multi-cascader-icon bm-multi-cascader-caret" }),
|
|
631
|
-
createVNode(unref(CloseCircleFilled), {
|
|
1846
|
+
createVNode(unref(DownOutlined$1), { class: "bm-multi-cascader-icon bm-multi-cascader-caret" }),
|
|
1847
|
+
createVNode(unref(CloseCircleFilled$1), {
|
|
632
1848
|
class: "bm-multi-cascader-icon bm-multi-cascader-remove-all",
|
|
633
1849
|
onClick: withModifiers(removeAll, ["stop"])
|
|
634
1850
|
}, null, 8, ["onClick"])
|
|
635
|
-
], 64)) : (openBlock(), createBlock(unref(DownOutlined), { key: 1 }))
|
|
1851
|
+
], 64)) : (openBlock(), createBlock(unref(DownOutlined$1), { key: 1 }))
|
|
636
1852
|
])
|
|
637
1853
|
])
|
|
638
1854
|
]),
|
|
@@ -664,7 +1880,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
664
1880
|
type: "SearchResetBtn",
|
|
665
1881
|
props: {
|
|
666
1882
|
showExpandBtn: props.showExpandBtn,
|
|
667
|
-
showSearchIcon: props.showSearchIcon
|
|
1883
|
+
showSearchIcon: props.showSearchIcon,
|
|
1884
|
+
expandText: props.expandText,
|
|
1885
|
+
collapseText: props.collapseText
|
|
668
1886
|
},
|
|
669
1887
|
on: {
|
|
670
1888
|
submit() {
|
|
@@ -730,15 +1948,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
730
1948
|
onBeforeUnmount(() => {
|
|
731
1949
|
window.removeEventListener("resize", handleResize);
|
|
732
1950
|
});
|
|
733
|
-
watch(
|
|
734
|
-
()
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
{
|
|
739
|
-
immediate: true
|
|
740
|
-
}
|
|
741
|
-
);
|
|
1951
|
+
watch(() => props.showExpandBtn, (val) => {
|
|
1952
|
+
handleShowExpandBtn(val);
|
|
1953
|
+
}, {
|
|
1954
|
+
immediate: true
|
|
1955
|
+
});
|
|
742
1956
|
const expandRule = computed(() => {
|
|
743
1957
|
const fixedCount = props.fixedCount && props.fixedCount >= 0 ? props.fixedCount : 0;
|
|
744
1958
|
const fixedFields = props.fixedFields?.length ? props.fixedFields : [];
|
|
@@ -757,15 +1971,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
757
1971
|
});
|
|
758
1972
|
}
|
|
759
1973
|
}
|
|
760
|
-
watch(
|
|
761
|
-
|
|
762
|
-
(val) => {
|
|
1974
|
+
watch(isExpand, (val) => {
|
|
1975
|
+
setTimeout(() => {
|
|
763
1976
|
handleChangeExpand(val);
|
|
764
|
-
},
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
);
|
|
1977
|
+
}, 0);
|
|
1978
|
+
}, {
|
|
1979
|
+
immediate: true
|
|
1980
|
+
});
|
|
769
1981
|
expose({
|
|
770
1982
|
fApi
|
|
771
1983
|
});
|
|
@@ -779,7 +1991,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
779
1991
|
"onUpdate:api": _cache[0] || (_cache[0] = ($event) => fApi.value = $event),
|
|
780
1992
|
"model-value": props.value,
|
|
781
1993
|
rule: unref(rule),
|
|
782
|
-
option,
|
|
1994
|
+
option: unref(option),
|
|
783
1995
|
onChange: handleChange
|
|
784
1996
|
}, null, 8, ["api", "model-value", "rule", "option"])
|
|
785
1997
|
], 2);
|