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