bm-admin-ui 1.0.34-alpha → 1.0.35-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/feedback/index.js +25 -1306
- package/es/components/float-table/index.js +36 -27
- package/es/components/form-create/index.js +2901 -0
- package/es/components/form-designer/index.js +4203 -9
- package/es/components/index.js +1 -0
- package/es/components/input-tags-display/index.js +19 -1137
- package/es/components/over-tooltips/index.js +27 -20
- package/es/components/search-filter/index.js +24 -1179
- package/es/components/shops-filter/index.js +24 -1182
- package/es/components/staffs-selector/index.js +124 -1234
- package/es/components/timeline/index.js +7 -7
- package/es/components/upload/index.js +122 -1249
- package/es/utils/bm-admin-ui-resolver.js +4 -2
- package/es/utils/uniqueId.js +5 -0
- package/es/utils/vxe-table.js +4 -2
- package/es/utils/with-install.js +0 -1
- package/index.esm.js +116090 -27969
- package/index.js +116286 -28164
- package/lib/components/feedback/index.js +23 -1304
- package/lib/components/float-table/index.js +36 -27
- package/lib/components/form-create/index.js +2913 -0
- package/lib/components/form-designer/index.js +4208 -8
- package/lib/components/index.js +7 -0
- package/lib/components/input-tags-display/index.js +18 -1136
- package/lib/components/over-tooltips/index.js +27 -20
- package/lib/components/search-filter/index.js +23 -1178
- package/lib/components/shops-filter/index.js +23 -1181
- package/lib/components/staffs-selector/index.js +123 -1233
- package/lib/components/timeline/index.js +7 -7
- package/lib/components/upload/index.js +121 -1248
- package/lib/utils/bm-admin-ui-resolver.js +4 -2
- package/lib/utils/uniqueId.js +8 -0
- package/lib/utils/vxe-table.js +3 -1
- package/lib/utils/with-install.js +0 -1
- package/package.json +9 -4
- package/theme-chalk/button.css +1 -1
- package/theme-chalk/feedback.css +1 -1
- package/theme-chalk/float-table.css +1 -1
- package/theme-chalk/floating-vue.css +1 -1
- package/theme-chalk/flow-designer.css +1 -1
- package/theme-chalk/form-create.css +1 -0
- package/theme-chalk/form-designer.css +1 -0
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/modal.css +1 -1
- package/theme-chalk/over-tooltips.css +1 -1
- package/theme-chalk/search-filter.css +1 -1
- package/theme-chalk/staffs-selector.css +1 -1
- package/theme-chalk/timeline.css +1 -1
- package/theme-chalk/upload.css +1 -1
- package/es/components/button/index.d.ts +0 -307
- package/es/components/button/src/button.d.ts +0 -12
- package/es/components/button/src/button.vue.d.ts +0 -308
- package/es/components/feedback/index.d.ts +0 -1037
- package/es/components/feedback/src/bmAlert.vue.d.ts +0 -193
- package/es/components/feedback/src/bmModal.vue.d.ts +0 -839
- package/es/components/float-table/index.d.ts +0 -70
- package/es/components/float-table/src/float-table.vue.d.ts +0 -69
- package/es/components/flow-designer/index.d.ts +0 -7
- package/es/components/flow-designer/src/bm-nodes/AddCondition.d.ts +0 -26
- package/es/components/flow-designer/src/bm-nodes/AddFlowNode.d.ts +0 -29
- package/es/components/flow-designer/src/bm-nodes/BmConditionNode.vue.d.ts +0 -249
- package/es/components/flow-designer/src/bm-nodes/BmFlowHtmlNode.d.ts +0 -19
- package/es/components/flow-designer/src/bm-nodes/BmHtmlNode.vue.d.ts +0 -15
- package/es/components/flow-designer/src/bm-nodes/BmPolyLine.d.ts +0 -21
- package/es/components/flow-designer/src/bm-nodes/EndCircle.d.ts +0 -19
- package/es/components/flow-designer/src/config.d.ts +0 -24
- package/es/components/flow-designer/src/flow-designer-test.d.ts +0 -20
- package/es/components/flow-designer/src/flow-designer.d.ts +0 -11
- package/es/components/flow-designer/src/flow-designer.vue.d.ts +0 -6
- package/es/components/flow-designer/src/utils.d.ts +0 -29
- package/es/components/form-designer/index.d.ts +0 -9
- package/es/components/form-designer/src/form-designer.vue.d.ts +0 -8
- package/es/components/index.d.ts +0 -12
- package/es/components/input-tags-display/index.d.ts +0 -131
- package/es/components/input-tags-display/src/input-tags-display.vue.d.ts +0 -128
- package/es/components/over-tooltips/index.d.ts +0 -35
- package/es/components/over-tooltips/src/over-tooltips.vue.d.ts +0 -34
- package/es/components/search-filter/index.d.ts +0 -223
- package/es/components/search-filter/src/search-filter.d.ts +0 -81
- package/es/components/search-filter/src/search-filter.vue.d.ts +0 -222
- package/es/components/search-filter/src/search-reset-btn.vue.d.ts +0 -106
- package/es/components/shops-filter/index.d.ts +0 -99
- package/es/components/shops-filter/src/shops-filter.d.ts +0 -25
- package/es/components/shops-filter/src/shops-filter.vue.d.ts +0 -98
- package/es/components/staffs-selector/index.d.ts +0 -109
- package/es/components/staffs-selector/src/multipleCmp.vue.d.ts +0 -97
- package/es/components/staffs-selector/src/radioCmp.vue.d.ts +0 -31
- package/es/components/staffs-selector/src/staffs-selector.vue.d.ts +0 -108
- package/es/components/staffs-selector/src/variedCmp.vue.d.ts +0 -62
- package/es/components/timeline/index.d.ts +0 -118
- package/es/components/timeline/src/props.d.ts +0 -27
- package/es/components/timeline/src/timeline-item.vue.d.ts +0 -66
- package/es/components/timeline/src/timeline.vue.d.ts +0 -52
- package/es/components/upload/index.d.ts +0 -138
- package/es/components/upload/src/icons.d.ts +0 -13
- package/es/components/upload/src/upload.vue.d.ts +0 -137
- package/es/components/upload/utils/index.d.ts +0 -7
- package/es/index.d.ts +0 -6
- package/es/utils/bm-admin-ui-resolver.d.ts +0 -9
- package/es/utils/vxe-table.d.ts +0 -6
- package/es/utils/with-install.d.ts +0 -3
- package/lib/components/button/index.d.ts +0 -307
- package/lib/components/button/src/button.d.ts +0 -12
- package/lib/components/button/src/button.vue.d.ts +0 -308
- package/lib/components/feedback/index.d.ts +0 -1037
- package/lib/components/feedback/src/bmAlert.vue.d.ts +0 -193
- package/lib/components/feedback/src/bmModal.vue.d.ts +0 -839
- package/lib/components/float-table/index.d.ts +0 -70
- package/lib/components/float-table/src/float-table.vue.d.ts +0 -69
- package/lib/components/flow-designer/index.d.ts +0 -7
- package/lib/components/flow-designer/src/bm-nodes/AddCondition.d.ts +0 -26
- package/lib/components/flow-designer/src/bm-nodes/AddFlowNode.d.ts +0 -29
- package/lib/components/flow-designer/src/bm-nodes/BmConditionNode.vue.d.ts +0 -249
- package/lib/components/flow-designer/src/bm-nodes/BmFlowHtmlNode.d.ts +0 -19
- package/lib/components/flow-designer/src/bm-nodes/BmHtmlNode.vue.d.ts +0 -15
- package/lib/components/flow-designer/src/bm-nodes/BmPolyLine.d.ts +0 -21
- package/lib/components/flow-designer/src/bm-nodes/EndCircle.d.ts +0 -19
- package/lib/components/flow-designer/src/config.d.ts +0 -24
- package/lib/components/flow-designer/src/flow-designer-test.d.ts +0 -20
- package/lib/components/flow-designer/src/flow-designer.d.ts +0 -11
- package/lib/components/flow-designer/src/flow-designer.vue.d.ts +0 -6
- package/lib/components/flow-designer/src/utils.d.ts +0 -29
- package/lib/components/form-designer/index.d.ts +0 -9
- package/lib/components/form-designer/src/form-designer.vue.d.ts +0 -8
- package/lib/components/index.d.ts +0 -12
- package/lib/components/input-tags-display/index.d.ts +0 -131
- package/lib/components/input-tags-display/src/input-tags-display.vue.d.ts +0 -128
- package/lib/components/over-tooltips/index.d.ts +0 -35
- package/lib/components/over-tooltips/src/over-tooltips.vue.d.ts +0 -34
- package/lib/components/search-filter/index.d.ts +0 -223
- package/lib/components/search-filter/src/search-filter.d.ts +0 -81
- package/lib/components/search-filter/src/search-filter.vue.d.ts +0 -222
- package/lib/components/search-filter/src/search-reset-btn.vue.d.ts +0 -106
- package/lib/components/shops-filter/index.d.ts +0 -99
- package/lib/components/shops-filter/src/shops-filter.d.ts +0 -25
- package/lib/components/shops-filter/src/shops-filter.vue.d.ts +0 -98
- package/lib/components/staffs-selector/index.d.ts +0 -109
- package/lib/components/staffs-selector/src/multipleCmp.vue.d.ts +0 -97
- package/lib/components/staffs-selector/src/radioCmp.vue.d.ts +0 -31
- package/lib/components/staffs-selector/src/staffs-selector.vue.d.ts +0 -108
- package/lib/components/staffs-selector/src/variedCmp.vue.d.ts +0 -62
- package/lib/components/timeline/index.d.ts +0 -118
- package/lib/components/timeline/src/props.d.ts +0 -27
- package/lib/components/timeline/src/timeline-item.vue.d.ts +0 -66
- package/lib/components/timeline/src/timeline.vue.d.ts +0 -52
- package/lib/components/upload/index.d.ts +0 -138
- package/lib/components/upload/src/icons.d.ts +0 -13
- package/lib/components/upload/src/upload.vue.d.ts +0 -137
- package/lib/components/upload/utils/index.d.ts +0 -7
- package/lib/index.d.ts +0 -6
- package/lib/utils/bm-admin-ui-resolver.d.ts +0 -9
- package/lib/utils/vxe-table.d.ts +0 -6
- package/lib/utils/with-install.d.ts +0 -3
- package/types/components/button/index.d.ts +0 -307
- package/types/components/button/src/button.d.ts +0 -12
- package/types/components/button/src/button.vue.d.ts +0 -308
- package/types/components/feedback/index.d.ts +0 -1037
- package/types/components/feedback/src/bmAlert.vue.d.ts +0 -193
- package/types/components/feedback/src/bmModal.vue.d.ts +0 -839
- package/types/components/float-table/index.d.ts +0 -70
- package/types/components/float-table/src/float-table.vue.d.ts +0 -69
- package/types/components/flow-designer/index.d.ts +0 -7
- package/types/components/flow-designer/src/bm-nodes/AddCondition.d.ts +0 -26
- package/types/components/flow-designer/src/bm-nodes/AddFlowNode.d.ts +0 -29
- package/types/components/flow-designer/src/bm-nodes/BmConditionNode.vue.d.ts +0 -249
- package/types/components/flow-designer/src/bm-nodes/BmFlowHtmlNode.d.ts +0 -19
- package/types/components/flow-designer/src/bm-nodes/BmHtmlNode.vue.d.ts +0 -15
- package/types/components/flow-designer/src/bm-nodes/BmPolyLine.d.ts +0 -21
- package/types/components/flow-designer/src/bm-nodes/EndCircle.d.ts +0 -19
- package/types/components/flow-designer/src/config.d.ts +0 -24
- package/types/components/flow-designer/src/flow-designer-test.d.ts +0 -20
- package/types/components/flow-designer/src/flow-designer.d.ts +0 -11
- package/types/components/flow-designer/src/flow-designer.vue.d.ts +0 -6
- package/types/components/flow-designer/src/utils.d.ts +0 -29
- package/types/components/form-designer/index.d.ts +0 -9
- package/types/components/form-designer/src/form-designer.vue.d.ts +0 -8
- package/types/components/index.d.ts +0 -12
- package/types/components/input-tags-display/index.d.ts +0 -131
- package/types/components/input-tags-display/src/input-tags-display.vue.d.ts +0 -128
- package/types/components/over-tooltips/index.d.ts +0 -35
- package/types/components/over-tooltips/src/over-tooltips.vue.d.ts +0 -34
- package/types/components/search-filter/index.d.ts +0 -223
- package/types/components/search-filter/src/search-filter.d.ts +0 -81
- package/types/components/search-filter/src/search-filter.vue.d.ts +0 -222
- package/types/components/search-filter/src/search-reset-btn.vue.d.ts +0 -106
- package/types/components/shops-filter/index.d.ts +0 -99
- package/types/components/shops-filter/src/shops-filter.d.ts +0 -25
- package/types/components/shops-filter/src/shops-filter.vue.d.ts +0 -98
- package/types/components/staffs-selector/index.d.ts +0 -109
- package/types/components/staffs-selector/src/multipleCmp.vue.d.ts +0 -97
- package/types/components/staffs-selector/src/radioCmp.vue.d.ts +0 -31
- package/types/components/staffs-selector/src/staffs-selector.vue.d.ts +0 -108
- package/types/components/staffs-selector/src/variedCmp.vue.d.ts +0 -62
- package/types/components/timeline/index.d.ts +0 -118
- package/types/components/timeline/src/props.d.ts +0 -27
- package/types/components/timeline/src/timeline-item.vue.d.ts +0 -66
- package/types/components/timeline/src/timeline.vue.d.ts +0 -52
- package/types/components/upload/index.d.ts +0 -138
- package/types/components/upload/src/icons.d.ts +0 -13
- package/types/components/upload/src/upload.vue.d.ts +0 -137
- package/types/components/upload/utils/index.d.ts +0 -7
- package/types/index.d.ts +0 -6
- package/types/utils/bm-admin-ui-resolver.d.ts +0 -9
- package/types/utils/vxe-table.d.ts +0 -6
- package/types/utils/with-install.d.ts +0 -3
|
@@ -1,1157 +1,13 @@
|
|
|
1
1
|
import { withInstall } from 'bm-admin-ui/es/utils/with-install';
|
|
2
2
|
import AModal from 'ant-design-vue/lib/modal';
|
|
3
|
-
import {
|
|
3
|
+
import { defineComponent, reactive, watch, onMounted, toRefs, resolveComponent, openBlock, createElementBlock, createElementVNode, createVNode, withCtx, Fragment, withDirectives, vShow, renderList, createTextVNode, toDisplayString, createBlock, createCommentVNode, withModifiers, ref, computed, readonly, normalizeClass } from 'vue';
|
|
4
|
+
import { CloseCircleFilled, SearchOutlined } from '@ant-design/icons-vue';
|
|
4
5
|
import Empty from 'ant-design-vue/lib/empty';
|
|
5
6
|
import AInput from 'ant-design-vue/lib/input';
|
|
6
7
|
import Checkbox from 'ant-design-vue/lib/checkbox';
|
|
7
8
|
import ATree from 'ant-design-vue/lib/tree';
|
|
8
9
|
import ARadio, { Group } from 'ant-design-vue/lib/radio';
|
|
9
10
|
|
|
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
|
-
|
|
1155
11
|
var _export_sfc = (sfc, props) => {
|
|
1156
12
|
const target = sfc.__vccOpts || sfc;
|
|
1157
13
|
for (const [key, val] of props) {
|
|
@@ -1162,8 +18,8 @@ var _export_sfc = (sfc, props) => {
|
|
|
1162
18
|
|
|
1163
19
|
const _sfc_main$3 = defineComponent({
|
|
1164
20
|
components: {
|
|
1165
|
-
CloseCircleFilled
|
|
1166
|
-
SearchOutlined
|
|
21
|
+
CloseCircleFilled,
|
|
22
|
+
SearchOutlined,
|
|
1167
23
|
Empty,
|
|
1168
24
|
AInput,
|
|
1169
25
|
Checkbox,
|
|
@@ -1260,39 +116,50 @@ const _sfc_main$3 = defineComponent({
|
|
|
1260
116
|
return data ? data.title : "\u672A\u77E5";
|
|
1261
117
|
}
|
|
1262
118
|
};
|
|
1263
|
-
watch(
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
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);
|
|
119
|
+
watch(
|
|
120
|
+
() => state.listChecked,
|
|
121
|
+
() => {
|
|
122
|
+
let list = [];
|
|
123
|
+
for (let [key, value] of Object.entries(state.listChecked)) {
|
|
124
|
+
value && list.push(key);
|
|
1283
125
|
}
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
126
|
+
if (props.limit > 0 && list.length >= props.limit)
|
|
127
|
+
state.isFulfill = true;
|
|
128
|
+
else
|
|
129
|
+
state.isFulfill = false;
|
|
130
|
+
methods.setState();
|
|
131
|
+
emit("update:selected", list);
|
|
132
|
+
},
|
|
133
|
+
{ deep: true }
|
|
134
|
+
);
|
|
135
|
+
watch(
|
|
136
|
+
() => state.departmentChecked,
|
|
137
|
+
() => {
|
|
138
|
+
let flatMap = props.dataMap;
|
|
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
|
+
}
|
|
146
|
+
}
|
|
147
|
+
for (let key of curselect) {
|
|
148
|
+
let obj = flatMap.get(key);
|
|
149
|
+
if (obj && !curselect.has(obj["parent"])) {
|
|
150
|
+
hadselected.add(key);
|
|
151
|
+
}
|
|
1289
152
|
}
|
|
153
|
+
emit("update:selected", Array.from(hadselected));
|
|
154
|
+
},
|
|
155
|
+
{ deep: true }
|
|
156
|
+
);
|
|
157
|
+
watch(
|
|
158
|
+
() => props.list,
|
|
159
|
+
() => {
|
|
160
|
+
!props.isTree && methods.setState();
|
|
1290
161
|
}
|
|
1291
|
-
|
|
1292
|
-
}, { deep: true });
|
|
1293
|
-
watch(() => props.list, () => {
|
|
1294
|
-
!props.isTree && methods.setState();
|
|
1295
|
-
});
|
|
162
|
+
);
|
|
1296
163
|
onMounted(() => {
|
|
1297
164
|
let list = props.selected;
|
|
1298
165
|
list && list.forEach((key) => {
|
|
@@ -1441,7 +308,7 @@ var multipleCmp = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_rend
|
|
|
1441
308
|
|
|
1442
309
|
const _sfc_main$2 = defineComponent({
|
|
1443
310
|
name: "RadioCmp",
|
|
1444
|
-
components: { ARadio, AInput, ARadioGroup: Group, Empty, SearchOutlined
|
|
311
|
+
components: { ARadio, AInput, ARadioGroup: Group, Empty, SearchOutlined },
|
|
1445
312
|
props: {
|
|
1446
313
|
list: {
|
|
1447
314
|
type: Array,
|
|
@@ -1540,8 +407,8 @@ var radioCmp = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$
|
|
|
1540
407
|
const _sfc_main$1 = defineComponent({
|
|
1541
408
|
name: "VariedCmp",
|
|
1542
409
|
components: {
|
|
1543
|
-
CloseCircleFilled
|
|
1544
|
-
SearchOutlined
|
|
410
|
+
CloseCircleFilled,
|
|
411
|
+
SearchOutlined,
|
|
1545
412
|
AInput,
|
|
1546
413
|
Checkbox,
|
|
1547
414
|
ATree,
|
|
@@ -1629,57 +496,73 @@ const _sfc_main$1 = defineComponent({
|
|
|
1629
496
|
return data ? data.title : "\u672A\u77E5";
|
|
1630
497
|
}
|
|
1631
498
|
};
|
|
1632
|
-
watch(
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
499
|
+
watch(
|
|
500
|
+
() => departmentChecked,
|
|
501
|
+
() => {
|
|
502
|
+
let flatMap = props.dataMap;
|
|
503
|
+
let curlistKeys = props.curlistKeys;
|
|
504
|
+
let hadselected = new Set(props.selected);
|
|
505
|
+
let curselect = new Set(departmentChecked.value);
|
|
506
|
+
for (let key of hadselected) {
|
|
507
|
+
if (curlistKeys.has(key) && (!curselect.has(key) || curselect.has(key) && curselect.has(flatMap.get(key)["parent"]))) {
|
|
508
|
+
hadselected.delete(key);
|
|
509
|
+
}
|
|
1640
510
|
}
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
511
|
+
for (let key of curselect) {
|
|
512
|
+
let obj = flatMap.get(key);
|
|
513
|
+
if (obj && !curselect.has(obj["parent"])) {
|
|
514
|
+
hadselected.add(key);
|
|
515
|
+
}
|
|
1646
516
|
}
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
517
|
+
emit("update:selected", Array.from(hadselected));
|
|
518
|
+
},
|
|
519
|
+
{ deep: true }
|
|
520
|
+
);
|
|
521
|
+
watch(
|
|
522
|
+
() => staffsChecked,
|
|
523
|
+
() => {
|
|
524
|
+
let set = new Set(props.selected.length ? props.selected : null);
|
|
525
|
+
for (let [key, value] of Object.entries(staffsChecked.value)) {
|
|
526
|
+
if (value) {
|
|
527
|
+
set.add(key);
|
|
528
|
+
} else {
|
|
529
|
+
set.has(key) && set.delete(key);
|
|
530
|
+
}
|
|
1657
531
|
}
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
532
|
+
emit("update:selected", Array.from(set));
|
|
533
|
+
},
|
|
534
|
+
{ deep: true }
|
|
535
|
+
);
|
|
536
|
+
watch(
|
|
537
|
+
() => shopChecked,
|
|
538
|
+
() => {
|
|
539
|
+
let set = new Set(props.selected.length ? props.selected : null);
|
|
540
|
+
for (let [key, value] of Object.entries(shopChecked.value)) {
|
|
541
|
+
if (value) {
|
|
542
|
+
set.add(key);
|
|
543
|
+
} else {
|
|
544
|
+
set.has(key) && set.delete(key);
|
|
545
|
+
}
|
|
1668
546
|
}
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
547
|
+
emit("update:selected", Array.from(set));
|
|
548
|
+
},
|
|
549
|
+
{ deep: true }
|
|
550
|
+
);
|
|
551
|
+
watch(
|
|
552
|
+
() => groupChecked,
|
|
553
|
+
() => {
|
|
554
|
+
let set = new Set(props.selected.length ? props.selected : null);
|
|
555
|
+
for (let [key, value] of Object.entries(groupChecked.value)) {
|
|
556
|
+
if (value) {
|
|
557
|
+
set.add(key);
|
|
558
|
+
} else {
|
|
559
|
+
set.has(key) && set.delete(key);
|
|
560
|
+
}
|
|
1679
561
|
}
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
562
|
+
emit("update:selected", Array.from(set));
|
|
563
|
+
},
|
|
564
|
+
{ deep: true }
|
|
565
|
+
);
|
|
1683
566
|
onMounted(() => {
|
|
1684
567
|
let list = props.selected;
|
|
1685
568
|
list && list.forEach((key) => {
|
|
@@ -1846,7 +729,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1846
729
|
]);
|
|
1847
730
|
}), 128))
|
|
1848
731
|
])) : createCommentVNode("v-if", true)
|
|
1849
|
-
],
|
|
732
|
+
], 64))
|
|
1850
733
|
])
|
|
1851
734
|
]),
|
|
1852
735
|
createElementVNode("div", _hoisted_14, [
|
|
@@ -1965,7 +848,10 @@ const _sfc_main = defineComponent({
|
|
|
1965
848
|
if (["string", "number"].includes(typeof state.selected)) {
|
|
1966
849
|
emit("update:select", [state.dataMap.get(state.selected)]);
|
|
1967
850
|
} else if (state.selected instanceof Array) {
|
|
1968
|
-
emit(
|
|
851
|
+
emit(
|
|
852
|
+
"update:select",
|
|
853
|
+
state.selected.map((item) => state.dataMap.get(item))
|
|
854
|
+
);
|
|
1969
855
|
} else ;
|
|
1970
856
|
state.list = [];
|
|
1971
857
|
methods.modalCancel();
|
|
@@ -1986,11 +872,15 @@ const _sfc_main = defineComponent({
|
|
|
1986
872
|
return 648;
|
|
1987
873
|
})
|
|
1988
874
|
});
|
|
1989
|
-
watch(
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
875
|
+
watch(
|
|
876
|
+
() => props.visible,
|
|
877
|
+
(val) => {
|
|
878
|
+
if (val && props.immediateFetch) {
|
|
879
|
+
methods.fetch({});
|
|
880
|
+
}
|
|
881
|
+
},
|
|
882
|
+
{ immediate: true }
|
|
883
|
+
);
|
|
1994
884
|
return {
|
|
1995
885
|
...methods,
|
|
1996
886
|
...toRefs(state)
|