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