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