@das-fed/ui 1.1.4 → 6.3.0-beta.1
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/global/icons/index.local.js +1 -1
- package/global/style/index.css +1 -1
- package/global/style/scrollbar.css +22 -22
- package/global/theme/index.js +12 -12
- package/global/theme/module/color.js +31 -31
- package/global/theme/module/fontSize.js +5 -5
- package/global/theme/module/scrollbar.js +6 -6
- package/package.json +15 -9
- package/packages/business-components/app-container/index.js +154 -147
- package/packages/business-components/change-enterprises/index.css +1 -0
- package/packages/business-components/change-enterprises/index.js +241 -0
- package/packages/business-components/change-pwd/index.css +1 -0
- package/packages/business-components/change-pwd/index.js +330 -0
- package/packages/business-components/currency-page/index.css +1 -0
- package/packages/business-components/currency-page/index.js +99 -0
- package/packages/business-components/device-panel/index.css +1 -0
- package/packages/business-components/device-panel/index.js +115939 -0
- package/packages/business-components/echarts/index.js +93 -122
- package/packages/business-components/export-button/index.js +73 -66
- package/packages/business-components/import-button/index.js +213 -170
- package/packages/business-components/index.js +8 -1
- package/packages/business-components/layout-breadcrumb/index.js +82 -66
- package/packages/business-components/model-table-dialog/index.js +299 -289
- package/packages/business-components/process-configuration/index.css +1 -0
- package/packages/business-components/process-configuration/index.js +612 -0
- package/packages/business-components/process-form/index.css +1 -0
- package/packages/business-components/process-form/index.js +524 -0
- package/packages/business-components/process-search-form/index.js +73 -315
- package/packages/business-components/process-table/index.css +1 -1
- package/packages/business-components/process-table/index.js +186 -152
- package/packages/business-components/urgent-panel/index.css +1 -0
- package/packages/business-components/urgent-panel/index.js +3914 -0
- package/packages/business-components/user-org-dialog/index.js +466 -375
- package/packages/business-components/video-dialog/index.css +1 -0
- package/packages/business-components/video-dialog/index.js +1041 -0
- package/packages/business.js +1 -2
- package/packages/components/alert/index.js +449 -633
- package/packages/components/audio-video/index.css +1 -1
- package/packages/components/audio-video/index.js +312 -126
- package/packages/components/autocomplete/index.css +1 -1
- package/packages/components/autocomplete/index.js +312 -2923
- package/packages/components/breadcrumb/index.js +97 -82
- package/packages/components/button/index.css +1 -1
- package/packages/components/button/index.js +646 -787
- package/packages/components/calendar/index.css +1 -1
- package/packages/components/calendar/index.js +655 -3879
- package/packages/components/cascader/index.js +209 -203
- package/packages/components/checkbox/index.css +1 -1
- package/packages/components/checkbox/index.js +710 -872
- package/packages/components/collapse-panel/index.css +1 -1
- package/packages/components/collapse-panel/index.js +419 -601
- package/packages/components/collapse-transition/index.js +23 -21
- package/packages/components/collaspe/index.css +1 -1
- package/packages/components/collaspe/index.js +413 -595
- package/packages/components/color-picker/index.css +1 -1
- package/packages/components/color-picker/index.js +176 -133
- package/packages/components/custom-search-item/index.js +43 -37
- package/packages/components/date-picker/index.js +1338 -1459
- package/packages/components/dialog/index.js +429 -215
- package/packages/components/dimple-layout/index.css +1 -1
- package/packages/components/dimple-layout/index.js +1298 -1794
- package/packages/components/drawer/index.js +105 -77
- package/packages/components/dropdown/index.js +129 -109
- package/packages/components/edit-table/index.css +1 -1
- package/packages/components/edit-table/index.js +868 -752
- package/packages/components/empty/index.js +83 -78
- package/packages/components/form/index.js +22 -15
- package/packages/components/form-item/index.css +1 -1
- package/packages/components/form-item/index.js +601 -440
- package/packages/components/icon/index.css +1 -1
- package/packages/components/icon/index.js +38 -22
- package/packages/components/image-preview/index.css +1 -0
- package/packages/components/image-preview/index.js +2714 -0
- package/packages/components/image-upload/index.js +601 -765
- package/packages/components/image-viewer/index.css +1 -1
- package/packages/components/image-viewer/index.js +909 -990
- package/packages/components/index.js +2 -2
- package/packages/components/input/index.css +1 -1
- package/packages/components/input/index.js +284 -256
- package/packages/components/input-dialog-select/index.css +1 -1
- package/packages/components/input-dialog-select/index.js +179 -156
- package/packages/components/input-number/index.css +1 -1
- package/packages/components/input-number/index.js +157 -170
- package/packages/components/live-player/index.css +1 -0
- package/packages/components/live-player/index.js +170 -0
- package/packages/components/loading/index.js +17 -26
- package/packages/components/map/index.css +1 -1
- package/packages/components/map/index.js +18913 -461
- package/packages/components/menu-aside/index.css +1 -1
- package/packages/components/menu-aside/index.js +648 -713
- package/packages/components/menu-header/index.js +446 -629
- package/packages/components/message/index.js +25 -16
- package/packages/components/notification/index.js +386 -575
- package/packages/components/overlay/index.js +112 -103
- package/packages/components/pagination/index.js +260 -330
- package/packages/components/popover/index.js +104 -93
- package/packages/components/popup-mask/index.css +1 -1
- package/packages/components/popup-mask/index.js +77 -72
- package/packages/components/preview/index.js +33 -28
- package/packages/components/progress/index.js +214 -221
- package/packages/components/radio/index.css +1 -1
- package/packages/components/radio/index.js +699 -862
- package/packages/components/radio-tabs/index.js +144 -107
- package/packages/components/rich-editor/index.css +1 -1
- package/packages/components/rich-editor/index.js +105 -106
- package/packages/components/scrollbar/index.css +3 -2
- package/packages/components/scrollbar/index.js +2262 -1201
- package/packages/components/search/index.js +500 -664
- package/packages/components/search-form/index.css +1 -1
- package/packages/components/search-form/index.js +724 -626
- package/packages/components/select/index.css +1 -1
- package/packages/components/select/index.js +1052 -950
- package/packages/components/select-input/index.js +63 -53
- package/packages/components/select-list/index.css +1 -1
- package/packages/components/select-list/index.js +258 -235
- package/packages/components/special-range-picker-month/index.css +1 -1
- package/packages/components/special-range-picker-month/index.js +3068 -72555
- package/packages/components/special-range-picker-year/index.css +1 -1
- package/packages/components/special-range-picker-year/index.js +345 -339
- package/packages/components/spin/index.js +415 -594
- package/packages/components/split-panel/index.css +1 -1
- package/packages/components/split-panel/index.js +146 -127
- package/packages/components/step/index.js +414 -597
- package/packages/components/steps/index.js +407 -590
- package/packages/components/switch/index.js +23 -23
- package/packages/components/table/index.css +1 -1
- package/packages/components/table/index.js +80813 -27734
- package/packages/components/tabs/index.css +1 -1
- package/packages/components/tabs/index.js +620 -813
- package/packages/components/tag/index.js +63 -63
- package/packages/components/text-tooltip/index.css +9 -0
- package/packages/components/text-tooltip/index.js +2739 -33
- package/packages/components/time-line/index.js +464 -643
- package/packages/components/tooltip/index.css +1 -1
- package/packages/components/tooltip/index.js +108 -79
- package/packages/components/tree/index.css +1 -1
- package/packages/components/tree/index.js +840 -809
- package/packages/components/tree-select/index.js +271 -303
- package/packages/components/tree-table/index.js +461 -352
- package/packages/components/upload/index.js +682 -858
- package/packages/components/virtual-tree/index.css +1 -1
- package/packages/components/virtual-tree/index.js +144 -126
- package/packages/index.d.ts +1 -0
- package/packages/index.js +2 -2
- package/style/business.css +11 -4
- package/style/index.css +52 -42
- package/packages/business-components/low-code/index.css +0 -1
- package/packages/business-components/low-code/index.js +0 -60
- package/packages/components/audio-video-player/index.css +0 -1
- package/packages/components/audio-video-player/index.js +0 -83
- package/packages/components/table-column/index.css +0 -1
- package/packages/components/table-column/index.js +0 -82021
|
@@ -1,3146 +1,7 @@
|
|
|
1
|
-
import { withInstall
|
|
2
|
-
import { defineComponent,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { setThemeRule } from '@das-fed/web';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @vue/shared v3.4.21
|
|
9
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
10
|
-
* @license MIT
|
|
11
|
-
**/
|
|
12
|
-
|
|
13
|
-
!!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
|
|
14
|
-
!!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
|
|
15
|
-
const NOOP = () => {
|
|
16
|
-
};
|
|
17
|
-
const hasOwnProperty$4 = Object.prototype.hasOwnProperty;
|
|
18
|
-
const hasOwn = (val, key) => hasOwnProperty$4.call(val, key);
|
|
19
|
-
const isArray$1 = Array.isArray;
|
|
20
|
-
const isDate = (val) => toTypeString(val) === "[object Date]";
|
|
21
|
-
const isString = (val) => typeof val === "string";
|
|
22
|
-
const isObject$1 = (val) => val !== null && typeof val === "object";
|
|
23
|
-
const objectToString$1 = Object.prototype.toString;
|
|
24
|
-
const toTypeString = (value) => objectToString$1.call(value);
|
|
25
|
-
|
|
26
|
-
/** Detect free variable `global` from Node.js. */
|
|
27
|
-
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
|
28
|
-
|
|
29
|
-
/** Detect free variable `self`. */
|
|
30
|
-
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
31
|
-
|
|
32
|
-
/** Used as a reference to the global object. */
|
|
33
|
-
var root = freeGlobal || freeSelf || Function('return this')();
|
|
34
|
-
|
|
35
|
-
/** Built-in value references. */
|
|
36
|
-
var Symbol$1 = root.Symbol;
|
|
37
|
-
|
|
38
|
-
/** Used for built-in method references. */
|
|
39
|
-
var objectProto$4 = Object.prototype;
|
|
40
|
-
|
|
41
|
-
/** Used to check objects for own properties. */
|
|
42
|
-
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Used to resolve the
|
|
46
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
47
|
-
* of values.
|
|
48
|
-
*/
|
|
49
|
-
var nativeObjectToString$1 = objectProto$4.toString;
|
|
50
|
-
|
|
51
|
-
/** Built-in value references. */
|
|
52
|
-
var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
56
|
-
*
|
|
57
|
-
* @private
|
|
58
|
-
* @param {*} value The value to query.
|
|
59
|
-
* @returns {string} Returns the raw `toStringTag`.
|
|
60
|
-
*/
|
|
61
|
-
function getRawTag(value) {
|
|
62
|
-
var isOwn = hasOwnProperty$3.call(value, symToStringTag$1),
|
|
63
|
-
tag = value[symToStringTag$1];
|
|
64
|
-
|
|
65
|
-
try {
|
|
66
|
-
value[symToStringTag$1] = undefined;
|
|
67
|
-
var unmasked = true;
|
|
68
|
-
} catch (e) {}
|
|
69
|
-
|
|
70
|
-
var result = nativeObjectToString$1.call(value);
|
|
71
|
-
if (unmasked) {
|
|
72
|
-
if (isOwn) {
|
|
73
|
-
value[symToStringTag$1] = tag;
|
|
74
|
-
} else {
|
|
75
|
-
delete value[symToStringTag$1];
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return result;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/** Used for built-in method references. */
|
|
82
|
-
var objectProto$3 = Object.prototype;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Used to resolve the
|
|
86
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
87
|
-
* of values.
|
|
88
|
-
*/
|
|
89
|
-
var nativeObjectToString = objectProto$3.toString;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Converts `value` to a string using `Object.prototype.toString`.
|
|
93
|
-
*
|
|
94
|
-
* @private
|
|
95
|
-
* @param {*} value The value to convert.
|
|
96
|
-
* @returns {string} Returns the converted string.
|
|
97
|
-
*/
|
|
98
|
-
function objectToString(value) {
|
|
99
|
-
return nativeObjectToString.call(value);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/** `Object#toString` result references. */
|
|
103
|
-
var nullTag = '[object Null]',
|
|
104
|
-
undefinedTag = '[object Undefined]';
|
|
105
|
-
|
|
106
|
-
/** Built-in value references. */
|
|
107
|
-
var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
111
|
-
*
|
|
112
|
-
* @private
|
|
113
|
-
* @param {*} value The value to query.
|
|
114
|
-
* @returns {string} Returns the `toStringTag`.
|
|
115
|
-
*/
|
|
116
|
-
function baseGetTag(value) {
|
|
117
|
-
if (value == null) {
|
|
118
|
-
return value === undefined ? undefinedTag : nullTag;
|
|
119
|
-
}
|
|
120
|
-
return (symToStringTag && symToStringTag in Object(value))
|
|
121
|
-
? getRawTag(value)
|
|
122
|
-
: objectToString(value);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
127
|
-
* and has a `typeof` result of "object".
|
|
128
|
-
*
|
|
129
|
-
* @static
|
|
130
|
-
* @memberOf _
|
|
131
|
-
* @since 4.0.0
|
|
132
|
-
* @category Lang
|
|
133
|
-
* @param {*} value The value to check.
|
|
134
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
135
|
-
* @example
|
|
136
|
-
*
|
|
137
|
-
* _.isObjectLike({});
|
|
138
|
-
* // => true
|
|
139
|
-
*
|
|
140
|
-
* _.isObjectLike([1, 2, 3]);
|
|
141
|
-
* // => true
|
|
142
|
-
*
|
|
143
|
-
* _.isObjectLike(_.noop);
|
|
144
|
-
* // => false
|
|
145
|
-
*
|
|
146
|
-
* _.isObjectLike(null);
|
|
147
|
-
* // => false
|
|
148
|
-
*/
|
|
149
|
-
function isObjectLike(value) {
|
|
150
|
-
return value != null && typeof value == 'object';
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/** `Object#toString` result references. */
|
|
154
|
-
var symbolTag = '[object Symbol]';
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
158
|
-
*
|
|
159
|
-
* @static
|
|
160
|
-
* @memberOf _
|
|
161
|
-
* @since 4.0.0
|
|
162
|
-
* @category Lang
|
|
163
|
-
* @param {*} value The value to check.
|
|
164
|
-
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
165
|
-
* @example
|
|
166
|
-
*
|
|
167
|
-
* _.isSymbol(Symbol.iterator);
|
|
168
|
-
* // => true
|
|
169
|
-
*
|
|
170
|
-
* _.isSymbol('abc');
|
|
171
|
-
* // => false
|
|
172
|
-
*/
|
|
173
|
-
function isSymbol(value) {
|
|
174
|
-
return typeof value == 'symbol' ||
|
|
175
|
-
(isObjectLike(value) && baseGetTag(value) == symbolTag);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* A specialized version of `_.map` for arrays without support for iteratee
|
|
180
|
-
* shorthands.
|
|
181
|
-
*
|
|
182
|
-
* @private
|
|
183
|
-
* @param {Array} [array] The array to iterate over.
|
|
184
|
-
* @param {Function} iteratee The function invoked per iteration.
|
|
185
|
-
* @returns {Array} Returns the new mapped array.
|
|
186
|
-
*/
|
|
187
|
-
function arrayMap(array, iteratee) {
|
|
188
|
-
var index = -1,
|
|
189
|
-
length = array == null ? 0 : array.length,
|
|
190
|
-
result = Array(length);
|
|
191
|
-
|
|
192
|
-
while (++index < length) {
|
|
193
|
-
result[index] = iteratee(array[index], index, array);
|
|
194
|
-
}
|
|
195
|
-
return result;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Checks if `value` is classified as an `Array` object.
|
|
200
|
-
*
|
|
201
|
-
* @static
|
|
202
|
-
* @memberOf _
|
|
203
|
-
* @since 0.1.0
|
|
204
|
-
* @category Lang
|
|
205
|
-
* @param {*} value The value to check.
|
|
206
|
-
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
207
|
-
* @example
|
|
208
|
-
*
|
|
209
|
-
* _.isArray([1, 2, 3]);
|
|
210
|
-
* // => true
|
|
211
|
-
*
|
|
212
|
-
* _.isArray(document.body.children);
|
|
213
|
-
* // => false
|
|
214
|
-
*
|
|
215
|
-
* _.isArray('abc');
|
|
216
|
-
* // => false
|
|
217
|
-
*
|
|
218
|
-
* _.isArray(_.noop);
|
|
219
|
-
* // => false
|
|
220
|
-
*/
|
|
221
|
-
var isArray = Array.isArray;
|
|
222
|
-
|
|
223
|
-
/** Used as references for various `Number` constants. */
|
|
224
|
-
var INFINITY$1 = 1 / 0;
|
|
225
|
-
|
|
226
|
-
/** Used to convert symbols to primitives and strings. */
|
|
227
|
-
var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
|
|
228
|
-
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* The base implementation of `_.toString` which doesn't convert nullish
|
|
232
|
-
* values to empty strings.
|
|
233
|
-
*
|
|
234
|
-
* @private
|
|
235
|
-
* @param {*} value The value to process.
|
|
236
|
-
* @returns {string} Returns the string.
|
|
237
|
-
*/
|
|
238
|
-
function baseToString(value) {
|
|
239
|
-
// Exit early for strings to avoid a performance hit in some environments.
|
|
240
|
-
if (typeof value == 'string') {
|
|
241
|
-
return value;
|
|
242
|
-
}
|
|
243
|
-
if (isArray(value)) {
|
|
244
|
-
// Recursively convert values (susceptible to call stack limits).
|
|
245
|
-
return arrayMap(value, baseToString) + '';
|
|
246
|
-
}
|
|
247
|
-
if (isSymbol(value)) {
|
|
248
|
-
return symbolToString ? symbolToString.call(value) : '';
|
|
249
|
-
}
|
|
250
|
-
var result = (value + '');
|
|
251
|
-
return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Checks if `value` is the
|
|
256
|
-
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
257
|
-
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
258
|
-
*
|
|
259
|
-
* @static
|
|
260
|
-
* @memberOf _
|
|
261
|
-
* @since 0.1.0
|
|
262
|
-
* @category Lang
|
|
263
|
-
* @param {*} value The value to check.
|
|
264
|
-
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
265
|
-
* @example
|
|
266
|
-
*
|
|
267
|
-
* _.isObject({});
|
|
268
|
-
* // => true
|
|
269
|
-
*
|
|
270
|
-
* _.isObject([1, 2, 3]);
|
|
271
|
-
* // => true
|
|
272
|
-
*
|
|
273
|
-
* _.isObject(_.noop);
|
|
274
|
-
* // => true
|
|
275
|
-
*
|
|
276
|
-
* _.isObject(null);
|
|
277
|
-
* // => false
|
|
278
|
-
*/
|
|
279
|
-
function isObject(value) {
|
|
280
|
-
var type = typeof value;
|
|
281
|
-
return value != null && (type == 'object' || type == 'function');
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/** `Object#toString` result references. */
|
|
285
|
-
var asyncTag = '[object AsyncFunction]',
|
|
286
|
-
funcTag = '[object Function]',
|
|
287
|
-
genTag = '[object GeneratorFunction]',
|
|
288
|
-
proxyTag = '[object Proxy]';
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* Checks if `value` is classified as a `Function` object.
|
|
292
|
-
*
|
|
293
|
-
* @static
|
|
294
|
-
* @memberOf _
|
|
295
|
-
* @since 0.1.0
|
|
296
|
-
* @category Lang
|
|
297
|
-
* @param {*} value The value to check.
|
|
298
|
-
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
299
|
-
* @example
|
|
300
|
-
*
|
|
301
|
-
* _.isFunction(_);
|
|
302
|
-
* // => true
|
|
303
|
-
*
|
|
304
|
-
* _.isFunction(/abc/);
|
|
305
|
-
* // => false
|
|
306
|
-
*/
|
|
307
|
-
function isFunction(value) {
|
|
308
|
-
if (!isObject(value)) {
|
|
309
|
-
return false;
|
|
310
|
-
}
|
|
311
|
-
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
312
|
-
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
|
313
|
-
var tag = baseGetTag(value);
|
|
314
|
-
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
/** Used to detect overreaching core-js shims. */
|
|
318
|
-
var coreJsData = root['__core-js_shared__'];
|
|
319
|
-
|
|
320
|
-
/** Used to detect methods masquerading as native. */
|
|
321
|
-
var maskSrcKey = (function() {
|
|
322
|
-
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
|
323
|
-
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
324
|
-
}());
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* Checks if `func` has its source masked.
|
|
328
|
-
*
|
|
329
|
-
* @private
|
|
330
|
-
* @param {Function} func The function to check.
|
|
331
|
-
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
332
|
-
*/
|
|
333
|
-
function isMasked(func) {
|
|
334
|
-
return !!maskSrcKey && (maskSrcKey in func);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
/** Used for built-in method references. */
|
|
338
|
-
var funcProto$1 = Function.prototype;
|
|
339
|
-
|
|
340
|
-
/** Used to resolve the decompiled source of functions. */
|
|
341
|
-
var funcToString$1 = funcProto$1.toString;
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* Converts `func` to its source code.
|
|
345
|
-
*
|
|
346
|
-
* @private
|
|
347
|
-
* @param {Function} func The function to convert.
|
|
348
|
-
* @returns {string} Returns the source code.
|
|
349
|
-
*/
|
|
350
|
-
function toSource(func) {
|
|
351
|
-
if (func != null) {
|
|
352
|
-
try {
|
|
353
|
-
return funcToString$1.call(func);
|
|
354
|
-
} catch (e) {}
|
|
355
|
-
try {
|
|
356
|
-
return (func + '');
|
|
357
|
-
} catch (e) {}
|
|
358
|
-
}
|
|
359
|
-
return '';
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* Used to match `RegExp`
|
|
364
|
-
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
365
|
-
*/
|
|
366
|
-
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
367
|
-
|
|
368
|
-
/** Used to detect host constructors (Safari). */
|
|
369
|
-
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
370
|
-
|
|
371
|
-
/** Used for built-in method references. */
|
|
372
|
-
var funcProto = Function.prototype,
|
|
373
|
-
objectProto$2 = Object.prototype;
|
|
374
|
-
|
|
375
|
-
/** Used to resolve the decompiled source of functions. */
|
|
376
|
-
var funcToString = funcProto.toString;
|
|
377
|
-
|
|
378
|
-
/** Used to check objects for own properties. */
|
|
379
|
-
var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
|
|
380
|
-
|
|
381
|
-
/** Used to detect if a method is native. */
|
|
382
|
-
var reIsNative = RegExp('^' +
|
|
383
|
-
funcToString.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&')
|
|
384
|
-
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
385
|
-
);
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* The base implementation of `_.isNative` without bad shim checks.
|
|
389
|
-
*
|
|
390
|
-
* @private
|
|
391
|
-
* @param {*} value The value to check.
|
|
392
|
-
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
393
|
-
* else `false`.
|
|
394
|
-
*/
|
|
395
|
-
function baseIsNative(value) {
|
|
396
|
-
if (!isObject(value) || isMasked(value)) {
|
|
397
|
-
return false;
|
|
398
|
-
}
|
|
399
|
-
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
|
400
|
-
return pattern.test(toSource(value));
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Gets the value at `key` of `object`.
|
|
405
|
-
*
|
|
406
|
-
* @private
|
|
407
|
-
* @param {Object} [object] The object to query.
|
|
408
|
-
* @param {string} key The key of the property to get.
|
|
409
|
-
* @returns {*} Returns the property value.
|
|
410
|
-
*/
|
|
411
|
-
function getValue(object, key) {
|
|
412
|
-
return object == null ? undefined : object[key];
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* Gets the native function at `key` of `object`.
|
|
417
|
-
*
|
|
418
|
-
* @private
|
|
419
|
-
* @param {Object} object The object to query.
|
|
420
|
-
* @param {string} key The key of the method to get.
|
|
421
|
-
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
422
|
-
*/
|
|
423
|
-
function getNative(object, key) {
|
|
424
|
-
var value = getValue(object, key);
|
|
425
|
-
return baseIsNative(value) ? value : undefined;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
/**
|
|
429
|
-
* Performs a
|
|
430
|
-
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
431
|
-
* comparison between two values to determine if they are equivalent.
|
|
432
|
-
*
|
|
433
|
-
* @static
|
|
434
|
-
* @memberOf _
|
|
435
|
-
* @since 4.0.0
|
|
436
|
-
* @category Lang
|
|
437
|
-
* @param {*} value The value to compare.
|
|
438
|
-
* @param {*} other The other value to compare.
|
|
439
|
-
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
440
|
-
* @example
|
|
441
|
-
*
|
|
442
|
-
* var object = { 'a': 1 };
|
|
443
|
-
* var other = { 'a': 1 };
|
|
444
|
-
*
|
|
445
|
-
* _.eq(object, object);
|
|
446
|
-
* // => true
|
|
447
|
-
*
|
|
448
|
-
* _.eq(object, other);
|
|
449
|
-
* // => false
|
|
450
|
-
*
|
|
451
|
-
* _.eq('a', 'a');
|
|
452
|
-
* // => true
|
|
453
|
-
*
|
|
454
|
-
* _.eq('a', Object('a'));
|
|
455
|
-
* // => false
|
|
456
|
-
*
|
|
457
|
-
* _.eq(NaN, NaN);
|
|
458
|
-
* // => true
|
|
459
|
-
*/
|
|
460
|
-
function eq(value, other) {
|
|
461
|
-
return value === other || (value !== value && other !== other);
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
/** Used to match property names within property paths. */
|
|
465
|
-
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
466
|
-
reIsPlainProp = /^\w*$/;
|
|
467
|
-
|
|
468
|
-
/**
|
|
469
|
-
* Checks if `value` is a property name and not a property path.
|
|
470
|
-
*
|
|
471
|
-
* @private
|
|
472
|
-
* @param {*} value The value to check.
|
|
473
|
-
* @param {Object} [object] The object to query keys on.
|
|
474
|
-
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
|
475
|
-
*/
|
|
476
|
-
function isKey(value, object) {
|
|
477
|
-
if (isArray(value)) {
|
|
478
|
-
return false;
|
|
479
|
-
}
|
|
480
|
-
var type = typeof value;
|
|
481
|
-
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
|
482
|
-
value == null || isSymbol(value)) {
|
|
483
|
-
return true;
|
|
484
|
-
}
|
|
485
|
-
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
|
486
|
-
(object != null && value in Object(object));
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
/* Built-in method references that are verified to be native. */
|
|
490
|
-
var nativeCreate = getNative(Object, 'create');
|
|
491
|
-
|
|
492
|
-
/**
|
|
493
|
-
* Removes all key-value entries from the hash.
|
|
494
|
-
*
|
|
495
|
-
* @private
|
|
496
|
-
* @name clear
|
|
497
|
-
* @memberOf Hash
|
|
498
|
-
*/
|
|
499
|
-
function hashClear() {
|
|
500
|
-
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
501
|
-
this.size = 0;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
/**
|
|
505
|
-
* Removes `key` and its value from the hash.
|
|
506
|
-
*
|
|
507
|
-
* @private
|
|
508
|
-
* @name delete
|
|
509
|
-
* @memberOf Hash
|
|
510
|
-
* @param {Object} hash The hash to modify.
|
|
511
|
-
* @param {string} key The key of the value to remove.
|
|
512
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
513
|
-
*/
|
|
514
|
-
function hashDelete(key) {
|
|
515
|
-
var result = this.has(key) && delete this.__data__[key];
|
|
516
|
-
this.size -= result ? 1 : 0;
|
|
517
|
-
return result;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
/** Used to stand-in for `undefined` hash values. */
|
|
521
|
-
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
|
522
|
-
|
|
523
|
-
/** Used for built-in method references. */
|
|
524
|
-
var objectProto$1 = Object.prototype;
|
|
525
|
-
|
|
526
|
-
/** Used to check objects for own properties. */
|
|
527
|
-
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
528
|
-
|
|
529
|
-
/**
|
|
530
|
-
* Gets the hash value for `key`.
|
|
531
|
-
*
|
|
532
|
-
* @private
|
|
533
|
-
* @name get
|
|
534
|
-
* @memberOf Hash
|
|
535
|
-
* @param {string} key The key of the value to get.
|
|
536
|
-
* @returns {*} Returns the entry value.
|
|
537
|
-
*/
|
|
538
|
-
function hashGet(key) {
|
|
539
|
-
var data = this.__data__;
|
|
540
|
-
if (nativeCreate) {
|
|
541
|
-
var result = data[key];
|
|
542
|
-
return result === HASH_UNDEFINED$1 ? undefined : result;
|
|
543
|
-
}
|
|
544
|
-
return hasOwnProperty$1.call(data, key) ? data[key] : undefined;
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
/** Used for built-in method references. */
|
|
548
|
-
var objectProto = Object.prototype;
|
|
549
|
-
|
|
550
|
-
/** Used to check objects for own properties. */
|
|
551
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
552
|
-
|
|
553
|
-
/**
|
|
554
|
-
* Checks if a hash value for `key` exists.
|
|
555
|
-
*
|
|
556
|
-
* @private
|
|
557
|
-
* @name has
|
|
558
|
-
* @memberOf Hash
|
|
559
|
-
* @param {string} key The key of the entry to check.
|
|
560
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
561
|
-
*/
|
|
562
|
-
function hashHas(key) {
|
|
563
|
-
var data = this.__data__;
|
|
564
|
-
return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
/** Used to stand-in for `undefined` hash values. */
|
|
568
|
-
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
569
|
-
|
|
570
|
-
/**
|
|
571
|
-
* Sets the hash `key` to `value`.
|
|
572
|
-
*
|
|
573
|
-
* @private
|
|
574
|
-
* @name set
|
|
575
|
-
* @memberOf Hash
|
|
576
|
-
* @param {string} key The key of the value to set.
|
|
577
|
-
* @param {*} value The value to set.
|
|
578
|
-
* @returns {Object} Returns the hash instance.
|
|
579
|
-
*/
|
|
580
|
-
function hashSet(key, value) {
|
|
581
|
-
var data = this.__data__;
|
|
582
|
-
this.size += this.has(key) ? 0 : 1;
|
|
583
|
-
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
|
584
|
-
return this;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
/**
|
|
588
|
-
* Creates a hash object.
|
|
589
|
-
*
|
|
590
|
-
* @private
|
|
591
|
-
* @constructor
|
|
592
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
593
|
-
*/
|
|
594
|
-
function Hash(entries) {
|
|
595
|
-
var index = -1,
|
|
596
|
-
length = entries == null ? 0 : entries.length;
|
|
597
|
-
|
|
598
|
-
this.clear();
|
|
599
|
-
while (++index < length) {
|
|
600
|
-
var entry = entries[index];
|
|
601
|
-
this.set(entry[0], entry[1]);
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
// Add methods to `Hash`.
|
|
606
|
-
Hash.prototype.clear = hashClear;
|
|
607
|
-
Hash.prototype['delete'] = hashDelete;
|
|
608
|
-
Hash.prototype.get = hashGet;
|
|
609
|
-
Hash.prototype.has = hashHas;
|
|
610
|
-
Hash.prototype.set = hashSet;
|
|
611
|
-
|
|
612
|
-
/**
|
|
613
|
-
* Removes all key-value entries from the list cache.
|
|
614
|
-
*
|
|
615
|
-
* @private
|
|
616
|
-
* @name clear
|
|
617
|
-
* @memberOf ListCache
|
|
618
|
-
*/
|
|
619
|
-
function listCacheClear() {
|
|
620
|
-
this.__data__ = [];
|
|
621
|
-
this.size = 0;
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
/**
|
|
625
|
-
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
626
|
-
*
|
|
627
|
-
* @private
|
|
628
|
-
* @param {Array} array The array to inspect.
|
|
629
|
-
* @param {*} key The key to search for.
|
|
630
|
-
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
631
|
-
*/
|
|
632
|
-
function assocIndexOf(array, key) {
|
|
633
|
-
var length = array.length;
|
|
634
|
-
while (length--) {
|
|
635
|
-
if (eq(array[length][0], key)) {
|
|
636
|
-
return length;
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
return -1;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
/** Used for built-in method references. */
|
|
643
|
-
var arrayProto = Array.prototype;
|
|
644
|
-
|
|
645
|
-
/** Built-in value references. */
|
|
646
|
-
var splice = arrayProto.splice;
|
|
647
|
-
|
|
648
|
-
/**
|
|
649
|
-
* Removes `key` and its value from the list cache.
|
|
650
|
-
*
|
|
651
|
-
* @private
|
|
652
|
-
* @name delete
|
|
653
|
-
* @memberOf ListCache
|
|
654
|
-
* @param {string} key The key of the value to remove.
|
|
655
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
656
|
-
*/
|
|
657
|
-
function listCacheDelete(key) {
|
|
658
|
-
var data = this.__data__,
|
|
659
|
-
index = assocIndexOf(data, key);
|
|
660
|
-
|
|
661
|
-
if (index < 0) {
|
|
662
|
-
return false;
|
|
663
|
-
}
|
|
664
|
-
var lastIndex = data.length - 1;
|
|
665
|
-
if (index == lastIndex) {
|
|
666
|
-
data.pop();
|
|
667
|
-
} else {
|
|
668
|
-
splice.call(data, index, 1);
|
|
669
|
-
}
|
|
670
|
-
--this.size;
|
|
671
|
-
return true;
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
/**
|
|
675
|
-
* Gets the list cache value for `key`.
|
|
676
|
-
*
|
|
677
|
-
* @private
|
|
678
|
-
* @name get
|
|
679
|
-
* @memberOf ListCache
|
|
680
|
-
* @param {string} key The key of the value to get.
|
|
681
|
-
* @returns {*} Returns the entry value.
|
|
682
|
-
*/
|
|
683
|
-
function listCacheGet(key) {
|
|
684
|
-
var data = this.__data__,
|
|
685
|
-
index = assocIndexOf(data, key);
|
|
686
|
-
|
|
687
|
-
return index < 0 ? undefined : data[index][1];
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
/**
|
|
691
|
-
* Checks if a list cache value for `key` exists.
|
|
692
|
-
*
|
|
693
|
-
* @private
|
|
694
|
-
* @name has
|
|
695
|
-
* @memberOf ListCache
|
|
696
|
-
* @param {string} key The key of the entry to check.
|
|
697
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
698
|
-
*/
|
|
699
|
-
function listCacheHas(key) {
|
|
700
|
-
return assocIndexOf(this.__data__, key) > -1;
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
/**
|
|
704
|
-
* Sets the list cache `key` to `value`.
|
|
705
|
-
*
|
|
706
|
-
* @private
|
|
707
|
-
* @name set
|
|
708
|
-
* @memberOf ListCache
|
|
709
|
-
* @param {string} key The key of the value to set.
|
|
710
|
-
* @param {*} value The value to set.
|
|
711
|
-
* @returns {Object} Returns the list cache instance.
|
|
712
|
-
*/
|
|
713
|
-
function listCacheSet(key, value) {
|
|
714
|
-
var data = this.__data__,
|
|
715
|
-
index = assocIndexOf(data, key);
|
|
716
|
-
|
|
717
|
-
if (index < 0) {
|
|
718
|
-
++this.size;
|
|
719
|
-
data.push([key, value]);
|
|
720
|
-
} else {
|
|
721
|
-
data[index][1] = value;
|
|
722
|
-
}
|
|
723
|
-
return this;
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
/**
|
|
727
|
-
* Creates an list cache object.
|
|
728
|
-
*
|
|
729
|
-
* @private
|
|
730
|
-
* @constructor
|
|
731
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
732
|
-
*/
|
|
733
|
-
function ListCache(entries) {
|
|
734
|
-
var index = -1,
|
|
735
|
-
length = entries == null ? 0 : entries.length;
|
|
736
|
-
|
|
737
|
-
this.clear();
|
|
738
|
-
while (++index < length) {
|
|
739
|
-
var entry = entries[index];
|
|
740
|
-
this.set(entry[0], entry[1]);
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
// Add methods to `ListCache`.
|
|
745
|
-
ListCache.prototype.clear = listCacheClear;
|
|
746
|
-
ListCache.prototype['delete'] = listCacheDelete;
|
|
747
|
-
ListCache.prototype.get = listCacheGet;
|
|
748
|
-
ListCache.prototype.has = listCacheHas;
|
|
749
|
-
ListCache.prototype.set = listCacheSet;
|
|
750
|
-
|
|
751
|
-
/* Built-in method references that are verified to be native. */
|
|
752
|
-
var Map = getNative(root, 'Map');
|
|
753
|
-
|
|
754
|
-
/**
|
|
755
|
-
* Removes all key-value entries from the map.
|
|
756
|
-
*
|
|
757
|
-
* @private
|
|
758
|
-
* @name clear
|
|
759
|
-
* @memberOf MapCache
|
|
760
|
-
*/
|
|
761
|
-
function mapCacheClear() {
|
|
762
|
-
this.size = 0;
|
|
763
|
-
this.__data__ = {
|
|
764
|
-
'hash': new Hash,
|
|
765
|
-
'map': new (Map || ListCache),
|
|
766
|
-
'string': new Hash
|
|
767
|
-
};
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
/**
|
|
771
|
-
* Checks if `value` is suitable for use as unique object key.
|
|
772
|
-
*
|
|
773
|
-
* @private
|
|
774
|
-
* @param {*} value The value to check.
|
|
775
|
-
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
776
|
-
*/
|
|
777
|
-
function isKeyable(value) {
|
|
778
|
-
var type = typeof value;
|
|
779
|
-
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
|
780
|
-
? (value !== '__proto__')
|
|
781
|
-
: (value === null);
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
/**
|
|
785
|
-
* Gets the data for `map`.
|
|
786
|
-
*
|
|
787
|
-
* @private
|
|
788
|
-
* @param {Object} map The map to query.
|
|
789
|
-
* @param {string} key The reference key.
|
|
790
|
-
* @returns {*} Returns the map data.
|
|
791
|
-
*/
|
|
792
|
-
function getMapData(map, key) {
|
|
793
|
-
var data = map.__data__;
|
|
794
|
-
return isKeyable(key)
|
|
795
|
-
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
796
|
-
: data.map;
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
/**
|
|
800
|
-
* Removes `key` and its value from the map.
|
|
801
|
-
*
|
|
802
|
-
* @private
|
|
803
|
-
* @name delete
|
|
804
|
-
* @memberOf MapCache
|
|
805
|
-
* @param {string} key The key of the value to remove.
|
|
806
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
807
|
-
*/
|
|
808
|
-
function mapCacheDelete(key) {
|
|
809
|
-
var result = getMapData(this, key)['delete'](key);
|
|
810
|
-
this.size -= result ? 1 : 0;
|
|
811
|
-
return result;
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
/**
|
|
815
|
-
* Gets the map value for `key`.
|
|
816
|
-
*
|
|
817
|
-
* @private
|
|
818
|
-
* @name get
|
|
819
|
-
* @memberOf MapCache
|
|
820
|
-
* @param {string} key The key of the value to get.
|
|
821
|
-
* @returns {*} Returns the entry value.
|
|
822
|
-
*/
|
|
823
|
-
function mapCacheGet(key) {
|
|
824
|
-
return getMapData(this, key).get(key);
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
/**
|
|
828
|
-
* Checks if a map value for `key` exists.
|
|
829
|
-
*
|
|
830
|
-
* @private
|
|
831
|
-
* @name has
|
|
832
|
-
* @memberOf MapCache
|
|
833
|
-
* @param {string} key The key of the entry to check.
|
|
834
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
835
|
-
*/
|
|
836
|
-
function mapCacheHas(key) {
|
|
837
|
-
return getMapData(this, key).has(key);
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
/**
|
|
841
|
-
* Sets the map `key` to `value`.
|
|
842
|
-
*
|
|
843
|
-
* @private
|
|
844
|
-
* @name set
|
|
845
|
-
* @memberOf MapCache
|
|
846
|
-
* @param {string} key The key of the value to set.
|
|
847
|
-
* @param {*} value The value to set.
|
|
848
|
-
* @returns {Object} Returns the map cache instance.
|
|
849
|
-
*/
|
|
850
|
-
function mapCacheSet(key, value) {
|
|
851
|
-
var data = getMapData(this, key),
|
|
852
|
-
size = data.size;
|
|
853
|
-
|
|
854
|
-
data.set(key, value);
|
|
855
|
-
this.size += data.size == size ? 0 : 1;
|
|
856
|
-
return this;
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
/**
|
|
860
|
-
* Creates a map cache object to store key-value pairs.
|
|
861
|
-
*
|
|
862
|
-
* @private
|
|
863
|
-
* @constructor
|
|
864
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
865
|
-
*/
|
|
866
|
-
function MapCache(entries) {
|
|
867
|
-
var index = -1,
|
|
868
|
-
length = entries == null ? 0 : entries.length;
|
|
869
|
-
|
|
870
|
-
this.clear();
|
|
871
|
-
while (++index < length) {
|
|
872
|
-
var entry = entries[index];
|
|
873
|
-
this.set(entry[0], entry[1]);
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
// Add methods to `MapCache`.
|
|
878
|
-
MapCache.prototype.clear = mapCacheClear;
|
|
879
|
-
MapCache.prototype['delete'] = mapCacheDelete;
|
|
880
|
-
MapCache.prototype.get = mapCacheGet;
|
|
881
|
-
MapCache.prototype.has = mapCacheHas;
|
|
882
|
-
MapCache.prototype.set = mapCacheSet;
|
|
883
|
-
|
|
884
|
-
/** Error message constants. */
|
|
885
|
-
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
886
|
-
|
|
887
|
-
/**
|
|
888
|
-
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
889
|
-
* provided, it determines the cache key for storing the result based on the
|
|
890
|
-
* arguments provided to the memoized function. By default, the first argument
|
|
891
|
-
* provided to the memoized function is used as the map cache key. The `func`
|
|
892
|
-
* is invoked with the `this` binding of the memoized function.
|
|
893
|
-
*
|
|
894
|
-
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
895
|
-
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
896
|
-
* constructor with one whose instances implement the
|
|
897
|
-
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
898
|
-
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
899
|
-
*
|
|
900
|
-
* @static
|
|
901
|
-
* @memberOf _
|
|
902
|
-
* @since 0.1.0
|
|
903
|
-
* @category Function
|
|
904
|
-
* @param {Function} func The function to have its output memoized.
|
|
905
|
-
* @param {Function} [resolver] The function to resolve the cache key.
|
|
906
|
-
* @returns {Function} Returns the new memoized function.
|
|
907
|
-
* @example
|
|
908
|
-
*
|
|
909
|
-
* var object = { 'a': 1, 'b': 2 };
|
|
910
|
-
* var other = { 'c': 3, 'd': 4 };
|
|
911
|
-
*
|
|
912
|
-
* var values = _.memoize(_.values);
|
|
913
|
-
* values(object);
|
|
914
|
-
* // => [1, 2]
|
|
915
|
-
*
|
|
916
|
-
* values(other);
|
|
917
|
-
* // => [3, 4]
|
|
918
|
-
*
|
|
919
|
-
* object.a = 2;
|
|
920
|
-
* values(object);
|
|
921
|
-
* // => [1, 2]
|
|
922
|
-
*
|
|
923
|
-
* // Modify the result cache.
|
|
924
|
-
* values.cache.set(object, ['a', 'b']);
|
|
925
|
-
* values(object);
|
|
926
|
-
* // => ['a', 'b']
|
|
927
|
-
*
|
|
928
|
-
* // Replace `_.memoize.Cache`.
|
|
929
|
-
* _.memoize.Cache = WeakMap;
|
|
930
|
-
*/
|
|
931
|
-
function memoize(func, resolver) {
|
|
932
|
-
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
|
933
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
934
|
-
}
|
|
935
|
-
var memoized = function() {
|
|
936
|
-
var args = arguments,
|
|
937
|
-
key = resolver ? resolver.apply(this, args) : args[0],
|
|
938
|
-
cache = memoized.cache;
|
|
939
|
-
|
|
940
|
-
if (cache.has(key)) {
|
|
941
|
-
return cache.get(key);
|
|
942
|
-
}
|
|
943
|
-
var result = func.apply(this, args);
|
|
944
|
-
memoized.cache = cache.set(key, result) || cache;
|
|
945
|
-
return result;
|
|
946
|
-
};
|
|
947
|
-
memoized.cache = new (memoize.Cache || MapCache);
|
|
948
|
-
return memoized;
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
// Expose `MapCache`.
|
|
952
|
-
memoize.Cache = MapCache;
|
|
953
|
-
|
|
954
|
-
/** Used as the maximum memoize cache size. */
|
|
955
|
-
var MAX_MEMOIZE_SIZE = 500;
|
|
956
|
-
|
|
957
|
-
/**
|
|
958
|
-
* A specialized version of `_.memoize` which clears the memoized function's
|
|
959
|
-
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
|
|
960
|
-
*
|
|
961
|
-
* @private
|
|
962
|
-
* @param {Function} func The function to have its output memoized.
|
|
963
|
-
* @returns {Function} Returns the new memoized function.
|
|
964
|
-
*/
|
|
965
|
-
function memoizeCapped(func) {
|
|
966
|
-
var result = memoize(func, function(key) {
|
|
967
|
-
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
968
|
-
cache.clear();
|
|
969
|
-
}
|
|
970
|
-
return key;
|
|
971
|
-
});
|
|
972
|
-
|
|
973
|
-
var cache = result.cache;
|
|
974
|
-
return result;
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
/** Used to match property names within property paths. */
|
|
978
|
-
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
979
|
-
|
|
980
|
-
/** Used to match backslashes in property paths. */
|
|
981
|
-
var reEscapeChar = /\\(\\)?/g;
|
|
982
|
-
|
|
983
|
-
/**
|
|
984
|
-
* Converts `string` to a property path array.
|
|
985
|
-
*
|
|
986
|
-
* @private
|
|
987
|
-
* @param {string} string The string to convert.
|
|
988
|
-
* @returns {Array} Returns the property path array.
|
|
989
|
-
*/
|
|
990
|
-
var stringToPath = memoizeCapped(function(string) {
|
|
991
|
-
var result = [];
|
|
992
|
-
if (string.charCodeAt(0) === 46 /* . */) {
|
|
993
|
-
result.push('');
|
|
994
|
-
}
|
|
995
|
-
string.replace(rePropName, function(match, number, quote, subString) {
|
|
996
|
-
result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
|
|
997
|
-
});
|
|
998
|
-
return result;
|
|
999
|
-
});
|
|
1000
|
-
|
|
1001
|
-
/**
|
|
1002
|
-
* Converts `value` to a string. An empty string is returned for `null`
|
|
1003
|
-
* and `undefined` values. The sign of `-0` is preserved.
|
|
1004
|
-
*
|
|
1005
|
-
* @static
|
|
1006
|
-
* @memberOf _
|
|
1007
|
-
* @since 4.0.0
|
|
1008
|
-
* @category Lang
|
|
1009
|
-
* @param {*} value The value to convert.
|
|
1010
|
-
* @returns {string} Returns the converted string.
|
|
1011
|
-
* @example
|
|
1012
|
-
*
|
|
1013
|
-
* _.toString(null);
|
|
1014
|
-
* // => ''
|
|
1015
|
-
*
|
|
1016
|
-
* _.toString(-0);
|
|
1017
|
-
* // => '-0'
|
|
1018
|
-
*
|
|
1019
|
-
* _.toString([1, 2, 3]);
|
|
1020
|
-
* // => '1,2,3'
|
|
1021
|
-
*/
|
|
1022
|
-
function toString(value) {
|
|
1023
|
-
return value == null ? '' : baseToString(value);
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
|
-
/**
|
|
1027
|
-
* Casts `value` to a path array if it's not one.
|
|
1028
|
-
*
|
|
1029
|
-
* @private
|
|
1030
|
-
* @param {*} value The value to inspect.
|
|
1031
|
-
* @param {Object} [object] The object to query keys on.
|
|
1032
|
-
* @returns {Array} Returns the cast property path array.
|
|
1033
|
-
*/
|
|
1034
|
-
function castPath(value, object) {
|
|
1035
|
-
if (isArray(value)) {
|
|
1036
|
-
return value;
|
|
1037
|
-
}
|
|
1038
|
-
return isKey(value, object) ? [value] : stringToPath(toString(value));
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
/** Used as references for various `Number` constants. */
|
|
1042
|
-
var INFINITY = 1 / 0;
|
|
1043
|
-
|
|
1044
|
-
/**
|
|
1045
|
-
* Converts `value` to a string key if it's not a string or symbol.
|
|
1046
|
-
*
|
|
1047
|
-
* @private
|
|
1048
|
-
* @param {*} value The value to inspect.
|
|
1049
|
-
* @returns {string|symbol} Returns the key.
|
|
1050
|
-
*/
|
|
1051
|
-
function toKey(value) {
|
|
1052
|
-
if (typeof value == 'string' || isSymbol(value)) {
|
|
1053
|
-
return value;
|
|
1054
|
-
}
|
|
1055
|
-
var result = (value + '');
|
|
1056
|
-
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
/**
|
|
1060
|
-
* The base implementation of `_.get` without support for default values.
|
|
1061
|
-
*
|
|
1062
|
-
* @private
|
|
1063
|
-
* @param {Object} object The object to query.
|
|
1064
|
-
* @param {Array|string} path The path of the property to get.
|
|
1065
|
-
* @returns {*} Returns the resolved value.
|
|
1066
|
-
*/
|
|
1067
|
-
function baseGet(object, path) {
|
|
1068
|
-
path = castPath(path, object);
|
|
1069
|
-
|
|
1070
|
-
var index = 0,
|
|
1071
|
-
length = path.length;
|
|
1072
|
-
|
|
1073
|
-
while (object != null && index < length) {
|
|
1074
|
-
object = object[toKey(path[index++])];
|
|
1075
|
-
}
|
|
1076
|
-
return (index && index == length) ? object : undefined;
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
/**
|
|
1080
|
-
* Gets the value at `path` of `object`. If the resolved value is
|
|
1081
|
-
* `undefined`, the `defaultValue` is returned in its place.
|
|
1082
|
-
*
|
|
1083
|
-
* @static
|
|
1084
|
-
* @memberOf _
|
|
1085
|
-
* @since 3.7.0
|
|
1086
|
-
* @category Object
|
|
1087
|
-
* @param {Object} object The object to query.
|
|
1088
|
-
* @param {Array|string} path The path of the property to get.
|
|
1089
|
-
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
|
|
1090
|
-
* @returns {*} Returns the resolved value.
|
|
1091
|
-
* @example
|
|
1092
|
-
*
|
|
1093
|
-
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
|
1094
|
-
*
|
|
1095
|
-
* _.get(object, 'a[0].b.c');
|
|
1096
|
-
* // => 3
|
|
1097
|
-
*
|
|
1098
|
-
* _.get(object, ['a', '0', 'b', 'c']);
|
|
1099
|
-
* // => 3
|
|
1100
|
-
*
|
|
1101
|
-
* _.get(object, 'a.b.c', 'default');
|
|
1102
|
-
* // => 'default'
|
|
1103
|
-
*/
|
|
1104
|
-
function get(object, path, defaultValue) {
|
|
1105
|
-
var result = object == null ? undefined : baseGet(object, path);
|
|
1106
|
-
return result === undefined ? defaultValue : result;
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
/**
|
|
1110
|
-
* The inverse of `_.toPairs`; this method returns an object composed
|
|
1111
|
-
* from key-value `pairs`.
|
|
1112
|
-
*
|
|
1113
|
-
* @static
|
|
1114
|
-
* @memberOf _
|
|
1115
|
-
* @since 4.0.0
|
|
1116
|
-
* @category Array
|
|
1117
|
-
* @param {Array} pairs The key-value pairs.
|
|
1118
|
-
* @returns {Object} Returns the new object.
|
|
1119
|
-
* @example
|
|
1120
|
-
*
|
|
1121
|
-
* _.fromPairs([['a', 1], ['b', 2]]);
|
|
1122
|
-
* // => { 'a': 1, 'b': 2 }
|
|
1123
|
-
*/
|
|
1124
|
-
function fromPairs(pairs) {
|
|
1125
|
-
var index = -1,
|
|
1126
|
-
length = pairs == null ? 0 : pairs.length,
|
|
1127
|
-
result = {};
|
|
1128
|
-
|
|
1129
|
-
while (++index < length) {
|
|
1130
|
-
var pair = pairs[index];
|
|
1131
|
-
result[pair[0]] = pair[1];
|
|
1132
|
-
}
|
|
1133
|
-
return result;
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
const isUndefined = (val) => val === void 0;
|
|
1137
|
-
const isNumber = (val) => typeof val === "number";
|
|
1138
|
-
const isStringNumber = (val) => {
|
|
1139
|
-
if (!isString(val)) {
|
|
1140
|
-
return false;
|
|
1141
|
-
}
|
|
1142
|
-
return !Number.isNaN(Number(val));
|
|
1143
|
-
};
|
|
1144
|
-
|
|
1145
|
-
const keysOf = (arr) => Object.keys(arr);
|
|
1146
|
-
|
|
1147
|
-
class ElementPlusError extends Error {
|
|
1148
|
-
constructor(m) {
|
|
1149
|
-
super(m);
|
|
1150
|
-
this.name = "ElementPlusError";
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
function debugWarn(scope, message) {
|
|
1154
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1155
|
-
const error = isString(scope) ? new ElementPlusError(`[${scope}] ${message}`) : scope;
|
|
1156
|
-
console.warn(error);
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
const SCOPE = "utils/dom/style";
|
|
1161
|
-
function addUnit(value, defaultUnit = "px") {
|
|
1162
|
-
if (!value)
|
|
1163
|
-
return "";
|
|
1164
|
-
if (isNumber(value) || isStringNumber(value)) {
|
|
1165
|
-
return `${value}${defaultUnit}`;
|
|
1166
|
-
} else if (isString(value)) {
|
|
1167
|
-
return value;
|
|
1168
|
-
}
|
|
1169
|
-
debugWarn(SCOPE, "binding value must be a string or number");
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
|
-
/*! Element Plus Icons Vue v2.3.1 */
|
|
1173
|
-
|
|
1174
|
-
var loading_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
1175
|
-
name: "Loading",
|
|
1176
|
-
__name: "loading",
|
|
1177
|
-
setup(__props) {
|
|
1178
|
-
return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
|
|
1179
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1180
|
-
viewBox: "0 0 1024 1024"
|
|
1181
|
-
}, [
|
|
1182
|
-
createElementVNode("path", {
|
|
1183
|
-
fill: "currentColor",
|
|
1184
|
-
d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"
|
|
1185
|
-
})
|
|
1186
|
-
]));
|
|
1187
|
-
}
|
|
1188
|
-
});
|
|
1189
|
-
|
|
1190
|
-
// src/components/loading.vue
|
|
1191
|
-
var loading_default = loading_vue_vue_type_script_setup_true_lang_default;
|
|
1192
|
-
|
|
1193
|
-
const epPropKey = "__epPropKey";
|
|
1194
|
-
const definePropType = (val) => val;
|
|
1195
|
-
const isEpProp = (val) => isObject$1(val) && !!val[epPropKey];
|
|
1196
|
-
const buildProp = (prop, key) => {
|
|
1197
|
-
if (!isObject$1(prop) || isEpProp(prop))
|
|
1198
|
-
return prop;
|
|
1199
|
-
const { values, required, default: defaultValue, type, validator } = prop;
|
|
1200
|
-
const _validator = values || validator ? (val) => {
|
|
1201
|
-
let valid = false;
|
|
1202
|
-
let allowedValues = [];
|
|
1203
|
-
if (values) {
|
|
1204
|
-
allowedValues = Array.from(values);
|
|
1205
|
-
if (hasOwn(prop, "default")) {
|
|
1206
|
-
allowedValues.push(defaultValue);
|
|
1207
|
-
}
|
|
1208
|
-
valid || (valid = allowedValues.includes(val));
|
|
1209
|
-
}
|
|
1210
|
-
if (validator)
|
|
1211
|
-
valid || (valid = validator(val));
|
|
1212
|
-
if (!valid && allowedValues.length > 0) {
|
|
1213
|
-
const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
|
|
1214
|
-
warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
|
|
1215
|
-
}
|
|
1216
|
-
return valid;
|
|
1217
|
-
} : void 0;
|
|
1218
|
-
const epProp = {
|
|
1219
|
-
type,
|
|
1220
|
-
required: !!required,
|
|
1221
|
-
validator: _validator,
|
|
1222
|
-
[epPropKey]: true
|
|
1223
|
-
};
|
|
1224
|
-
if (hasOwn(prop, "default"))
|
|
1225
|
-
epProp.default = defaultValue;
|
|
1226
|
-
return epProp;
|
|
1227
|
-
};
|
|
1228
|
-
const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
|
|
1229
|
-
key,
|
|
1230
|
-
buildProp(option, key)
|
|
1231
|
-
]));
|
|
1232
|
-
|
|
1233
|
-
const iconPropType = definePropType([
|
|
1234
|
-
String,
|
|
1235
|
-
Object,
|
|
1236
|
-
Function
|
|
1237
|
-
]);
|
|
1238
|
-
|
|
1239
|
-
const withInstall = (main, extra) => {
|
|
1240
|
-
main.install = (app) => {
|
|
1241
|
-
for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
|
|
1242
|
-
app.component(comp.name, comp);
|
|
1243
|
-
}
|
|
1244
|
-
};
|
|
1245
|
-
if (extra) {
|
|
1246
|
-
for (const [key, comp] of Object.entries(extra)) {
|
|
1247
|
-
main[key] = comp;
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
return main;
|
|
1251
|
-
};
|
|
1252
|
-
const withNoopInstall = (component) => {
|
|
1253
|
-
component.install = NOOP;
|
|
1254
|
-
return component;
|
|
1255
|
-
};
|
|
1256
|
-
|
|
1257
|
-
const WEEK_DAYS = [
|
|
1258
|
-
"sun",
|
|
1259
|
-
"mon",
|
|
1260
|
-
"tue",
|
|
1261
|
-
"wed",
|
|
1262
|
-
"thu",
|
|
1263
|
-
"fri",
|
|
1264
|
-
"sat"
|
|
1265
|
-
];
|
|
1266
|
-
|
|
1267
|
-
const UPDATE_MODEL_EVENT = "update:modelValue";
|
|
1268
|
-
const INPUT_EVENT = "input";
|
|
1269
|
-
|
|
1270
|
-
const componentSizes = ["", "default", "small", "large"];
|
|
1271
|
-
|
|
1272
|
-
const useDeprecated = ({ from, replacement, scope, version, ref, type = "API" }, condition) => {
|
|
1273
|
-
watch(() => unref(condition), (val) => {
|
|
1274
|
-
if (val) {
|
|
1275
|
-
debugWarn(scope, `[${type}] ${from} is about to be deprecated in version ${version}, please use ${replacement} instead.
|
|
1276
|
-
For more detail, please visit: ${ref}
|
|
1277
|
-
`);
|
|
1278
|
-
}
|
|
1279
|
-
}, {
|
|
1280
|
-
immediate: true
|
|
1281
|
-
});
|
|
1282
|
-
};
|
|
1283
|
-
|
|
1284
|
-
var English = {
|
|
1285
|
-
name: "en",
|
|
1286
|
-
el: {
|
|
1287
|
-
colorpicker: {
|
|
1288
|
-
confirm: "OK",
|
|
1289
|
-
clear: "Clear",
|
|
1290
|
-
defaultLabel: "color picker",
|
|
1291
|
-
description: "current color is {color}. press enter to select a new color."
|
|
1292
|
-
},
|
|
1293
|
-
datepicker: {
|
|
1294
|
-
now: "Now",
|
|
1295
|
-
today: "Today",
|
|
1296
|
-
cancel: "Cancel",
|
|
1297
|
-
clear: "Clear",
|
|
1298
|
-
confirm: "OK",
|
|
1299
|
-
dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
|
|
1300
|
-
monthTablePrompt: "Use the arrow keys and enter to select the month",
|
|
1301
|
-
yearTablePrompt: "Use the arrow keys and enter to select the year",
|
|
1302
|
-
selectedDate: "Selected date",
|
|
1303
|
-
selectDate: "Select date",
|
|
1304
|
-
selectTime: "Select time",
|
|
1305
|
-
startDate: "Start Date",
|
|
1306
|
-
startTime: "Start Time",
|
|
1307
|
-
endDate: "End Date",
|
|
1308
|
-
endTime: "End Time",
|
|
1309
|
-
prevYear: "Previous Year",
|
|
1310
|
-
nextYear: "Next Year",
|
|
1311
|
-
prevMonth: "Previous Month",
|
|
1312
|
-
nextMonth: "Next Month",
|
|
1313
|
-
year: "",
|
|
1314
|
-
month1: "January",
|
|
1315
|
-
month2: "February",
|
|
1316
|
-
month3: "March",
|
|
1317
|
-
month4: "April",
|
|
1318
|
-
month5: "May",
|
|
1319
|
-
month6: "June",
|
|
1320
|
-
month7: "July",
|
|
1321
|
-
month8: "August",
|
|
1322
|
-
month9: "September",
|
|
1323
|
-
month10: "October",
|
|
1324
|
-
month11: "November",
|
|
1325
|
-
month12: "December",
|
|
1326
|
-
week: "week",
|
|
1327
|
-
weeks: {
|
|
1328
|
-
sun: "Sun",
|
|
1329
|
-
mon: "Mon",
|
|
1330
|
-
tue: "Tue",
|
|
1331
|
-
wed: "Wed",
|
|
1332
|
-
thu: "Thu",
|
|
1333
|
-
fri: "Fri",
|
|
1334
|
-
sat: "Sat"
|
|
1335
|
-
},
|
|
1336
|
-
weeksFull: {
|
|
1337
|
-
sun: "Sunday",
|
|
1338
|
-
mon: "Monday",
|
|
1339
|
-
tue: "Tuesday",
|
|
1340
|
-
wed: "Wednesday",
|
|
1341
|
-
thu: "Thursday",
|
|
1342
|
-
fri: "Friday",
|
|
1343
|
-
sat: "Saturday"
|
|
1344
|
-
},
|
|
1345
|
-
months: {
|
|
1346
|
-
jan: "Jan",
|
|
1347
|
-
feb: "Feb",
|
|
1348
|
-
mar: "Mar",
|
|
1349
|
-
apr: "Apr",
|
|
1350
|
-
may: "May",
|
|
1351
|
-
jun: "Jun",
|
|
1352
|
-
jul: "Jul",
|
|
1353
|
-
aug: "Aug",
|
|
1354
|
-
sep: "Sep",
|
|
1355
|
-
oct: "Oct",
|
|
1356
|
-
nov: "Nov",
|
|
1357
|
-
dec: "Dec"
|
|
1358
|
-
}
|
|
1359
|
-
},
|
|
1360
|
-
inputNumber: {
|
|
1361
|
-
decrease: "decrease number",
|
|
1362
|
-
increase: "increase number"
|
|
1363
|
-
},
|
|
1364
|
-
select: {
|
|
1365
|
-
loading: "Loading",
|
|
1366
|
-
noMatch: "No matching data",
|
|
1367
|
-
noData: "No data",
|
|
1368
|
-
placeholder: "Select"
|
|
1369
|
-
},
|
|
1370
|
-
dropdown: {
|
|
1371
|
-
toggleDropdown: "Toggle Dropdown"
|
|
1372
|
-
},
|
|
1373
|
-
cascader: {
|
|
1374
|
-
noMatch: "No matching data",
|
|
1375
|
-
loading: "Loading",
|
|
1376
|
-
placeholder: "Select",
|
|
1377
|
-
noData: "No data"
|
|
1378
|
-
},
|
|
1379
|
-
pagination: {
|
|
1380
|
-
goto: "Go to",
|
|
1381
|
-
pagesize: "/page",
|
|
1382
|
-
total: "Total {total}",
|
|
1383
|
-
pageClassifier: "",
|
|
1384
|
-
page: "Page",
|
|
1385
|
-
prev: "Go to previous page",
|
|
1386
|
-
next: "Go to next page",
|
|
1387
|
-
currentPage: "page {pager}",
|
|
1388
|
-
prevPages: "Previous {pager} pages",
|
|
1389
|
-
nextPages: "Next {pager} pages",
|
|
1390
|
-
deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
|
|
1391
|
-
},
|
|
1392
|
-
dialog: {
|
|
1393
|
-
close: "Close this dialog"
|
|
1394
|
-
},
|
|
1395
|
-
drawer: {
|
|
1396
|
-
close: "Close this dialog"
|
|
1397
|
-
},
|
|
1398
|
-
messagebox: {
|
|
1399
|
-
title: "Message",
|
|
1400
|
-
confirm: "OK",
|
|
1401
|
-
cancel: "Cancel",
|
|
1402
|
-
error: "Illegal input",
|
|
1403
|
-
close: "Close this dialog"
|
|
1404
|
-
},
|
|
1405
|
-
upload: {
|
|
1406
|
-
deleteTip: "press delete to remove",
|
|
1407
|
-
delete: "Delete",
|
|
1408
|
-
preview: "Preview",
|
|
1409
|
-
continue: "Continue"
|
|
1410
|
-
},
|
|
1411
|
-
slider: {
|
|
1412
|
-
defaultLabel: "slider between {min} and {max}",
|
|
1413
|
-
defaultRangeStartLabel: "pick start value",
|
|
1414
|
-
defaultRangeEndLabel: "pick end value"
|
|
1415
|
-
},
|
|
1416
|
-
table: {
|
|
1417
|
-
emptyText: "No Data",
|
|
1418
|
-
confirmFilter: "Confirm",
|
|
1419
|
-
resetFilter: "Reset",
|
|
1420
|
-
clearFilter: "All",
|
|
1421
|
-
sumText: "Sum"
|
|
1422
|
-
},
|
|
1423
|
-
tree: {
|
|
1424
|
-
emptyText: "No Data"
|
|
1425
|
-
},
|
|
1426
|
-
transfer: {
|
|
1427
|
-
noMatch: "No matching data",
|
|
1428
|
-
noData: "No data",
|
|
1429
|
-
titles: ["List 1", "List 2"],
|
|
1430
|
-
filterPlaceholder: "Enter keyword",
|
|
1431
|
-
noCheckedFormat: "{total} items",
|
|
1432
|
-
hasCheckedFormat: "{checked}/{total} checked"
|
|
1433
|
-
},
|
|
1434
|
-
image: {
|
|
1435
|
-
error: "FAILED"
|
|
1436
|
-
},
|
|
1437
|
-
pageHeader: {
|
|
1438
|
-
title: "Back"
|
|
1439
|
-
},
|
|
1440
|
-
popconfirm: {
|
|
1441
|
-
confirmButtonText: "Yes",
|
|
1442
|
-
cancelButtonText: "No"
|
|
1443
|
-
}
|
|
1444
|
-
}
|
|
1445
|
-
};
|
|
1446
|
-
|
|
1447
|
-
const buildTranslator = (locale) => (path, option) => translate(path, option, unref(locale));
|
|
1448
|
-
const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => {
|
|
1449
|
-
var _a;
|
|
1450
|
-
return `${(_a = option == null ? void 0 : option[key]) != null ? _a : `{${key}}`}`;
|
|
1451
|
-
});
|
|
1452
|
-
const buildLocaleContext = (locale) => {
|
|
1453
|
-
const lang = computed(() => unref(locale).name);
|
|
1454
|
-
const localeRef = isRef(locale) ? locale : ref(locale);
|
|
1455
|
-
return {
|
|
1456
|
-
lang,
|
|
1457
|
-
locale: localeRef,
|
|
1458
|
-
t: buildTranslator(locale)
|
|
1459
|
-
};
|
|
1460
|
-
};
|
|
1461
|
-
const localeContextKey = Symbol("localeContextKey");
|
|
1462
|
-
const useLocale = (localeOverrides) => {
|
|
1463
|
-
const locale = localeOverrides || inject(localeContextKey, ref());
|
|
1464
|
-
return buildLocaleContext(computed(() => locale.value || English));
|
|
1465
|
-
};
|
|
1466
|
-
|
|
1467
|
-
const defaultNamespace = "el";
|
|
1468
|
-
const statePrefix = "is-";
|
|
1469
|
-
const _bem = (namespace, block, blockSuffix, element, modifier) => {
|
|
1470
|
-
let cls = `${namespace}-${block}`;
|
|
1471
|
-
if (blockSuffix) {
|
|
1472
|
-
cls += `-${blockSuffix}`;
|
|
1473
|
-
}
|
|
1474
|
-
if (element) {
|
|
1475
|
-
cls += `__${element}`;
|
|
1476
|
-
}
|
|
1477
|
-
if (modifier) {
|
|
1478
|
-
cls += `--${modifier}`;
|
|
1479
|
-
}
|
|
1480
|
-
return cls;
|
|
1481
|
-
};
|
|
1482
|
-
const namespaceContextKey = Symbol("namespaceContextKey");
|
|
1483
|
-
const useGetDerivedNamespace = (namespaceOverrides) => {
|
|
1484
|
-
const derivedNamespace = namespaceOverrides || (getCurrentInstance() ? inject(namespaceContextKey, ref(defaultNamespace)) : ref(defaultNamespace));
|
|
1485
|
-
const namespace = computed(() => {
|
|
1486
|
-
return unref(derivedNamespace) || defaultNamespace;
|
|
1487
|
-
});
|
|
1488
|
-
return namespace;
|
|
1489
|
-
};
|
|
1490
|
-
const useNamespace = (block, namespaceOverrides) => {
|
|
1491
|
-
const namespace = useGetDerivedNamespace(namespaceOverrides);
|
|
1492
|
-
const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
|
|
1493
|
-
const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
|
|
1494
|
-
const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
|
|
1495
|
-
const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
|
|
1496
|
-
const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
|
|
1497
|
-
const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
|
|
1498
|
-
const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
|
|
1499
|
-
const is = (name, ...args) => {
|
|
1500
|
-
const state = args.length >= 1 ? args[0] : true;
|
|
1501
|
-
return name && state ? `${statePrefix}${name}` : "";
|
|
1502
|
-
};
|
|
1503
|
-
const cssVar = (object) => {
|
|
1504
|
-
const styles = {};
|
|
1505
|
-
for (const key in object) {
|
|
1506
|
-
if (object[key]) {
|
|
1507
|
-
styles[`--${namespace.value}-${key}`] = object[key];
|
|
1508
|
-
}
|
|
1509
|
-
}
|
|
1510
|
-
return styles;
|
|
1511
|
-
};
|
|
1512
|
-
const cssVarBlock = (object) => {
|
|
1513
|
-
const styles = {};
|
|
1514
|
-
for (const key in object) {
|
|
1515
|
-
if (object[key]) {
|
|
1516
|
-
styles[`--${namespace.value}-${block}-${key}`] = object[key];
|
|
1517
|
-
}
|
|
1518
|
-
}
|
|
1519
|
-
return styles;
|
|
1520
|
-
};
|
|
1521
|
-
const cssVarName = (name) => `--${namespace.value}-${name}`;
|
|
1522
|
-
const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
|
|
1523
|
-
return {
|
|
1524
|
-
namespace,
|
|
1525
|
-
b,
|
|
1526
|
-
e,
|
|
1527
|
-
m,
|
|
1528
|
-
be,
|
|
1529
|
-
em,
|
|
1530
|
-
bm,
|
|
1531
|
-
bem,
|
|
1532
|
-
is,
|
|
1533
|
-
cssVar,
|
|
1534
|
-
cssVarName,
|
|
1535
|
-
cssVarBlock,
|
|
1536
|
-
cssVarBlockName
|
|
1537
|
-
};
|
|
1538
|
-
};
|
|
1539
|
-
|
|
1540
|
-
const useProp = (name) => {
|
|
1541
|
-
const vm = getCurrentInstance();
|
|
1542
|
-
return computed(() => {
|
|
1543
|
-
var _a, _b;
|
|
1544
|
-
return (_b = (_a = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a.$props) == null ? void 0 : _b[name];
|
|
1545
|
-
});
|
|
1546
|
-
};
|
|
1547
|
-
|
|
1548
|
-
ref(0);
|
|
1549
|
-
const zIndexContextKey = Symbol("zIndexContextKey");
|
|
1550
|
-
|
|
1551
|
-
const useSizeProp = buildProp({
|
|
1552
|
-
type: String,
|
|
1553
|
-
values: componentSizes,
|
|
1554
|
-
required: false
|
|
1555
|
-
});
|
|
1556
|
-
const SIZE_INJECTION_KEY = Symbol("size");
|
|
1557
|
-
const useGlobalSize = () => {
|
|
1558
|
-
const injectedSize = inject(SIZE_INJECTION_KEY, {});
|
|
1559
|
-
return computed(() => {
|
|
1560
|
-
return unref(injectedSize.size) || "";
|
|
1561
|
-
});
|
|
1562
|
-
};
|
|
1563
|
-
|
|
1564
|
-
const configProviderContextKey = Symbol();
|
|
1565
|
-
|
|
1566
|
-
const globalConfig = ref();
|
|
1567
|
-
function useGlobalConfig(key, defaultValue = void 0) {
|
|
1568
|
-
const config = getCurrentInstance() ? inject(configProviderContextKey, globalConfig) : globalConfig;
|
|
1569
|
-
if (key) {
|
|
1570
|
-
return computed(() => {
|
|
1571
|
-
var _a, _b;
|
|
1572
|
-
return (_b = (_a = config.value) == null ? void 0 : _a[key]) != null ? _b : defaultValue;
|
|
1573
|
-
});
|
|
1574
|
-
} else {
|
|
1575
|
-
return config;
|
|
1576
|
-
}
|
|
1577
|
-
}
|
|
1578
|
-
const provideGlobalConfig = (config, app, global = false) => {
|
|
1579
|
-
var _a;
|
|
1580
|
-
const inSetup = !!getCurrentInstance();
|
|
1581
|
-
const oldConfig = inSetup ? useGlobalConfig() : void 0;
|
|
1582
|
-
const provideFn = (_a = app == null ? void 0 : app.provide) != null ? _a : inSetup ? provide : void 0;
|
|
1583
|
-
if (!provideFn) {
|
|
1584
|
-
debugWarn("provideGlobalConfig", "provideGlobalConfig() can only be used inside setup().");
|
|
1585
|
-
return;
|
|
1586
|
-
}
|
|
1587
|
-
const context = computed(() => {
|
|
1588
|
-
const cfg = unref(config);
|
|
1589
|
-
if (!(oldConfig == null ? void 0 : oldConfig.value))
|
|
1590
|
-
return cfg;
|
|
1591
|
-
return mergeConfig(oldConfig.value, cfg);
|
|
1592
|
-
});
|
|
1593
|
-
provideFn(configProviderContextKey, context);
|
|
1594
|
-
provideFn(localeContextKey, computed(() => context.value.locale));
|
|
1595
|
-
provideFn(namespaceContextKey, computed(() => context.value.namespace));
|
|
1596
|
-
provideFn(zIndexContextKey, computed(() => context.value.zIndex));
|
|
1597
|
-
provideFn(SIZE_INJECTION_KEY, {
|
|
1598
|
-
size: computed(() => context.value.size || "")
|
|
1599
|
-
});
|
|
1600
|
-
if (global || !globalConfig.value) {
|
|
1601
|
-
globalConfig.value = context.value;
|
|
1602
|
-
}
|
|
1603
|
-
return context;
|
|
1604
|
-
};
|
|
1605
|
-
const mergeConfig = (a, b) => {
|
|
1606
|
-
var _a;
|
|
1607
|
-
const keys = [.../* @__PURE__ */ new Set([...keysOf(a), ...keysOf(b)])];
|
|
1608
|
-
const obj = {};
|
|
1609
|
-
for (const key of keys) {
|
|
1610
|
-
obj[key] = (_a = b[key]) != null ? _a : a[key];
|
|
1611
|
-
}
|
|
1612
|
-
return obj;
|
|
1613
|
-
};
|
|
1614
|
-
|
|
1615
|
-
const configProviderProps = buildProps({
|
|
1616
|
-
a11y: {
|
|
1617
|
-
type: Boolean,
|
|
1618
|
-
default: true
|
|
1619
|
-
},
|
|
1620
|
-
locale: {
|
|
1621
|
-
type: definePropType(Object)
|
|
1622
|
-
},
|
|
1623
|
-
size: useSizeProp,
|
|
1624
|
-
button: {
|
|
1625
|
-
type: definePropType(Object)
|
|
1626
|
-
},
|
|
1627
|
-
experimentalFeatures: {
|
|
1628
|
-
type: definePropType(Object)
|
|
1629
|
-
},
|
|
1630
|
-
keyboardNavigation: {
|
|
1631
|
-
type: Boolean,
|
|
1632
|
-
default: true
|
|
1633
|
-
},
|
|
1634
|
-
message: {
|
|
1635
|
-
type: definePropType(Object)
|
|
1636
|
-
},
|
|
1637
|
-
zIndex: Number,
|
|
1638
|
-
namespace: {
|
|
1639
|
-
type: String,
|
|
1640
|
-
default: "el"
|
|
1641
|
-
}
|
|
1642
|
-
});
|
|
1643
|
-
|
|
1644
|
-
const messageConfig = {};
|
|
1645
|
-
const ConfigProvider = defineComponent({
|
|
1646
|
-
name: "ElConfigProvider",
|
|
1647
|
-
props: configProviderProps,
|
|
1648
|
-
setup(props, { slots }) {
|
|
1649
|
-
watch(() => props.message, (val) => {
|
|
1650
|
-
Object.assign(messageConfig, val != null ? val : {});
|
|
1651
|
-
}, { immediate: true, deep: true });
|
|
1652
|
-
const config = provideGlobalConfig(props);
|
|
1653
|
-
return () => renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
|
|
1654
|
-
}
|
|
1655
|
-
});
|
|
1656
|
-
|
|
1657
|
-
const ElConfigProvider = withInstall(ConfigProvider);
|
|
1658
|
-
|
|
1659
|
-
var _export_sfc$1 = (sfc, props) => {
|
|
1660
|
-
const target = sfc.__vccOpts || sfc;
|
|
1661
|
-
for (const [key, val] of props) {
|
|
1662
|
-
target[key] = val;
|
|
1663
|
-
}
|
|
1664
|
-
return target;
|
|
1665
|
-
};
|
|
1666
|
-
|
|
1667
|
-
const iconProps = buildProps({
|
|
1668
|
-
size: {
|
|
1669
|
-
type: definePropType([Number, String])
|
|
1670
|
-
},
|
|
1671
|
-
color: {
|
|
1672
|
-
type: String
|
|
1673
|
-
}
|
|
1674
|
-
});
|
|
1675
|
-
|
|
1676
|
-
const __default__$5 = defineComponent({
|
|
1677
|
-
name: "ElIcon",
|
|
1678
|
-
inheritAttrs: false
|
|
1679
|
-
});
|
|
1680
|
-
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
1681
|
-
...__default__$5,
|
|
1682
|
-
props: iconProps,
|
|
1683
|
-
setup(__props) {
|
|
1684
|
-
const props = __props;
|
|
1685
|
-
const ns = useNamespace("icon");
|
|
1686
|
-
const style = computed(() => {
|
|
1687
|
-
const { size, color } = props;
|
|
1688
|
-
if (!size && !color)
|
|
1689
|
-
return {};
|
|
1690
|
-
return {
|
|
1691
|
-
fontSize: isUndefined(size) ? void 0 : addUnit(size),
|
|
1692
|
-
"--color": color
|
|
1693
|
-
};
|
|
1694
|
-
});
|
|
1695
|
-
return (_ctx, _cache) => {
|
|
1696
|
-
return openBlock(), createElementBlock("i", mergeProps({
|
|
1697
|
-
class: unref(ns).b(),
|
|
1698
|
-
style: unref(style)
|
|
1699
|
-
}, _ctx.$attrs), [
|
|
1700
|
-
renderSlot(_ctx.$slots, "default")
|
|
1701
|
-
], 16);
|
|
1702
|
-
};
|
|
1703
|
-
}
|
|
1704
|
-
});
|
|
1705
|
-
var Icon = /* @__PURE__ */ _export_sfc$1(_sfc_main$5, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/icon/src/icon.vue"]]);
|
|
1706
|
-
|
|
1707
|
-
const ElIcon = withInstall(Icon);
|
|
1708
|
-
|
|
1709
|
-
const formContextKey = Symbol("formContextKey");
|
|
1710
|
-
const formItemContextKey = Symbol("formItemContextKey");
|
|
1711
|
-
|
|
1712
|
-
const useFormSize = (fallback, ignore = {}) => {
|
|
1713
|
-
const emptyRef = ref(void 0);
|
|
1714
|
-
const size = ignore.prop ? emptyRef : useProp("size");
|
|
1715
|
-
const globalConfig = ignore.global ? emptyRef : useGlobalSize();
|
|
1716
|
-
const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
|
|
1717
|
-
const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
|
|
1718
|
-
return computed(() => size.value || unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig.value || "");
|
|
1719
|
-
};
|
|
1720
|
-
const useFormDisabled = (fallback) => {
|
|
1721
|
-
const disabled = useProp("disabled");
|
|
1722
|
-
const form = inject(formContextKey, void 0);
|
|
1723
|
-
return computed(() => disabled.value || unref(fallback) || (form == null ? void 0 : form.disabled) || false);
|
|
1724
|
-
};
|
|
1725
|
-
|
|
1726
|
-
const useFormItem = () => {
|
|
1727
|
-
const form = inject(formContextKey, void 0);
|
|
1728
|
-
const formItem = inject(formItemContextKey, void 0);
|
|
1729
|
-
return {
|
|
1730
|
-
form,
|
|
1731
|
-
formItem
|
|
1732
|
-
};
|
|
1733
|
-
};
|
|
1734
|
-
|
|
1735
|
-
const buttonGroupContextKey = Symbol("buttonGroupContextKey");
|
|
1736
|
-
|
|
1737
|
-
const useButton = (props, emit) => {
|
|
1738
|
-
useDeprecated({
|
|
1739
|
-
from: "type.text",
|
|
1740
|
-
replacement: "link",
|
|
1741
|
-
version: "3.0.0",
|
|
1742
|
-
scope: "props",
|
|
1743
|
-
ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
|
|
1744
|
-
}, computed(() => props.type === "text"));
|
|
1745
|
-
const buttonGroupContext = inject(buttonGroupContextKey, void 0);
|
|
1746
|
-
const globalConfig = useGlobalConfig("button");
|
|
1747
|
-
const { form } = useFormItem();
|
|
1748
|
-
const _size = useFormSize(computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
|
|
1749
|
-
const _disabled = useFormDisabled();
|
|
1750
|
-
const _ref = ref();
|
|
1751
|
-
const slots = useSlots();
|
|
1752
|
-
const _type = computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
|
|
1753
|
-
const autoInsertSpace = computed(() => {
|
|
1754
|
-
var _a, _b, _c;
|
|
1755
|
-
return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.autoInsertSpace) != null ? _c : false;
|
|
1756
|
-
});
|
|
1757
|
-
const _props = computed(() => {
|
|
1758
|
-
if (props.tag === "button") {
|
|
1759
|
-
return {
|
|
1760
|
-
ariaDisabled: _disabled.value || props.loading,
|
|
1761
|
-
disabled: _disabled.value || props.loading,
|
|
1762
|
-
autofocus: props.autofocus,
|
|
1763
|
-
type: props.nativeType
|
|
1764
|
-
};
|
|
1765
|
-
}
|
|
1766
|
-
return {};
|
|
1767
|
-
});
|
|
1768
|
-
const shouldAddSpace = computed(() => {
|
|
1769
|
-
var _a;
|
|
1770
|
-
const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots);
|
|
1771
|
-
if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
|
|
1772
|
-
const slot = defaultSlot[0];
|
|
1773
|
-
if ((slot == null ? void 0 : slot.type) === Text) {
|
|
1774
|
-
const text = slot.children;
|
|
1775
|
-
return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
|
|
1776
|
-
}
|
|
1777
|
-
}
|
|
1778
|
-
return false;
|
|
1779
|
-
});
|
|
1780
|
-
const handleClick = (evt) => {
|
|
1781
|
-
if (props.nativeType === "reset") {
|
|
1782
|
-
form == null ? void 0 : form.resetFields();
|
|
1783
|
-
}
|
|
1784
|
-
emit("click", evt);
|
|
1785
|
-
};
|
|
1786
|
-
return {
|
|
1787
|
-
_disabled,
|
|
1788
|
-
_size,
|
|
1789
|
-
_type,
|
|
1790
|
-
_ref,
|
|
1791
|
-
_props,
|
|
1792
|
-
shouldAddSpace,
|
|
1793
|
-
handleClick
|
|
1794
|
-
};
|
|
1795
|
-
};
|
|
1796
|
-
|
|
1797
|
-
const buttonTypes = [
|
|
1798
|
-
"default",
|
|
1799
|
-
"primary",
|
|
1800
|
-
"success",
|
|
1801
|
-
"warning",
|
|
1802
|
-
"info",
|
|
1803
|
-
"danger",
|
|
1804
|
-
"text",
|
|
1805
|
-
""
|
|
1806
|
-
];
|
|
1807
|
-
const buttonNativeTypes = ["button", "submit", "reset"];
|
|
1808
|
-
const buttonProps = buildProps({
|
|
1809
|
-
size: useSizeProp,
|
|
1810
|
-
disabled: Boolean,
|
|
1811
|
-
type: {
|
|
1812
|
-
type: String,
|
|
1813
|
-
values: buttonTypes,
|
|
1814
|
-
default: ""
|
|
1815
|
-
},
|
|
1816
|
-
icon: {
|
|
1817
|
-
type: iconPropType
|
|
1818
|
-
},
|
|
1819
|
-
nativeType: {
|
|
1820
|
-
type: String,
|
|
1821
|
-
values: buttonNativeTypes,
|
|
1822
|
-
default: "button"
|
|
1823
|
-
},
|
|
1824
|
-
loading: Boolean,
|
|
1825
|
-
loadingIcon: {
|
|
1826
|
-
type: iconPropType,
|
|
1827
|
-
default: () => loading_default
|
|
1828
|
-
},
|
|
1829
|
-
plain: Boolean,
|
|
1830
|
-
text: Boolean,
|
|
1831
|
-
link: Boolean,
|
|
1832
|
-
bg: Boolean,
|
|
1833
|
-
autofocus: Boolean,
|
|
1834
|
-
round: Boolean,
|
|
1835
|
-
circle: Boolean,
|
|
1836
|
-
color: String,
|
|
1837
|
-
dark: Boolean,
|
|
1838
|
-
autoInsertSpace: {
|
|
1839
|
-
type: Boolean,
|
|
1840
|
-
default: void 0
|
|
1841
|
-
},
|
|
1842
|
-
tag: {
|
|
1843
|
-
type: definePropType([String, Object]),
|
|
1844
|
-
default: "button"
|
|
1845
|
-
}
|
|
1846
|
-
});
|
|
1847
|
-
const buttonEmits = {
|
|
1848
|
-
click: (evt) => evt instanceof MouseEvent
|
|
1849
|
-
};
|
|
1850
|
-
|
|
1851
|
-
/**
|
|
1852
|
-
* Take input from [0, n] and return it as [0, 1]
|
|
1853
|
-
* @hidden
|
|
1854
|
-
*/
|
|
1855
|
-
function bound01(n, max) {
|
|
1856
|
-
if (isOnePointZero(n)) {
|
|
1857
|
-
n = '100%';
|
|
1858
|
-
}
|
|
1859
|
-
var isPercent = isPercentage(n);
|
|
1860
|
-
n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
|
|
1861
|
-
// Automatically convert percentage into number
|
|
1862
|
-
if (isPercent) {
|
|
1863
|
-
n = parseInt(String(n * max), 10) / 100;
|
|
1864
|
-
}
|
|
1865
|
-
// Handle floating point rounding errors
|
|
1866
|
-
if (Math.abs(n - max) < 0.000001) {
|
|
1867
|
-
return 1;
|
|
1868
|
-
}
|
|
1869
|
-
// Convert into [0, 1] range if it isn't already
|
|
1870
|
-
if (max === 360) {
|
|
1871
|
-
// If n is a hue given in degrees,
|
|
1872
|
-
// wrap around out-of-range values into [0, 360] range
|
|
1873
|
-
// then convert into [0, 1].
|
|
1874
|
-
n = (n < 0 ? (n % max) + max : n % max) / parseFloat(String(max));
|
|
1875
|
-
}
|
|
1876
|
-
else {
|
|
1877
|
-
// If n not a hue given in degrees
|
|
1878
|
-
// Convert into [0, 1] range if it isn't already.
|
|
1879
|
-
n = (n % max) / parseFloat(String(max));
|
|
1880
|
-
}
|
|
1881
|
-
return n;
|
|
1882
|
-
}
|
|
1883
|
-
/**
|
|
1884
|
-
* Force a number between 0 and 1
|
|
1885
|
-
* @hidden
|
|
1886
|
-
*/
|
|
1887
|
-
function clamp01(val) {
|
|
1888
|
-
return Math.min(1, Math.max(0, val));
|
|
1889
|
-
}
|
|
1890
|
-
/**
|
|
1891
|
-
* Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
|
|
1892
|
-
* <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
|
|
1893
|
-
* @hidden
|
|
1894
|
-
*/
|
|
1895
|
-
function isOnePointZero(n) {
|
|
1896
|
-
return typeof n === 'string' && n.indexOf('.') !== -1 && parseFloat(n) === 1;
|
|
1897
|
-
}
|
|
1898
|
-
/**
|
|
1899
|
-
* Check to see if string passed in is a percentage
|
|
1900
|
-
* @hidden
|
|
1901
|
-
*/
|
|
1902
|
-
function isPercentage(n) {
|
|
1903
|
-
return typeof n === 'string' && n.indexOf('%') !== -1;
|
|
1904
|
-
}
|
|
1905
|
-
/**
|
|
1906
|
-
* Return a valid alpha value [0,1] with all invalid values being set to 1
|
|
1907
|
-
* @hidden
|
|
1908
|
-
*/
|
|
1909
|
-
function boundAlpha(a) {
|
|
1910
|
-
a = parseFloat(a);
|
|
1911
|
-
if (isNaN(a) || a < 0 || a > 1) {
|
|
1912
|
-
a = 1;
|
|
1913
|
-
}
|
|
1914
|
-
return a;
|
|
1915
|
-
}
|
|
1916
|
-
/**
|
|
1917
|
-
* Replace a decimal with it's percentage value
|
|
1918
|
-
* @hidden
|
|
1919
|
-
*/
|
|
1920
|
-
function convertToPercentage(n) {
|
|
1921
|
-
if (n <= 1) {
|
|
1922
|
-
return "".concat(Number(n) * 100, "%");
|
|
1923
|
-
}
|
|
1924
|
-
return n;
|
|
1925
|
-
}
|
|
1926
|
-
/**
|
|
1927
|
-
* Force a hex value to have 2 characters
|
|
1928
|
-
* @hidden
|
|
1929
|
-
*/
|
|
1930
|
-
function pad2(c) {
|
|
1931
|
-
return c.length === 1 ? '0' + c : String(c);
|
|
1932
|
-
}
|
|
1933
|
-
|
|
1934
|
-
// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
|
|
1935
|
-
// <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
|
|
1936
|
-
/**
|
|
1937
|
-
* Handle bounds / percentage checking to conform to CSS color spec
|
|
1938
|
-
* <http://www.w3.org/TR/css3-color/>
|
|
1939
|
-
* *Assumes:* r, g, b in [0, 255] or [0, 1]
|
|
1940
|
-
* *Returns:* { r, g, b } in [0, 255]
|
|
1941
|
-
*/
|
|
1942
|
-
function rgbToRgb(r, g, b) {
|
|
1943
|
-
return {
|
|
1944
|
-
r: bound01(r, 255) * 255,
|
|
1945
|
-
g: bound01(g, 255) * 255,
|
|
1946
|
-
b: bound01(b, 255) * 255,
|
|
1947
|
-
};
|
|
1948
|
-
}
|
|
1949
|
-
/**
|
|
1950
|
-
* Converts an RGB color value to HSL.
|
|
1951
|
-
* *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
|
|
1952
|
-
* *Returns:* { h, s, l } in [0,1]
|
|
1953
|
-
*/
|
|
1954
|
-
function rgbToHsl(r, g, b) {
|
|
1955
|
-
r = bound01(r, 255);
|
|
1956
|
-
g = bound01(g, 255);
|
|
1957
|
-
b = bound01(b, 255);
|
|
1958
|
-
var max = Math.max(r, g, b);
|
|
1959
|
-
var min = Math.min(r, g, b);
|
|
1960
|
-
var h = 0;
|
|
1961
|
-
var s = 0;
|
|
1962
|
-
var l = (max + min) / 2;
|
|
1963
|
-
if (max === min) {
|
|
1964
|
-
s = 0;
|
|
1965
|
-
h = 0; // achromatic
|
|
1966
|
-
}
|
|
1967
|
-
else {
|
|
1968
|
-
var d = max - min;
|
|
1969
|
-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
1970
|
-
switch (max) {
|
|
1971
|
-
case r:
|
|
1972
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
1973
|
-
break;
|
|
1974
|
-
case g:
|
|
1975
|
-
h = (b - r) / d + 2;
|
|
1976
|
-
break;
|
|
1977
|
-
case b:
|
|
1978
|
-
h = (r - g) / d + 4;
|
|
1979
|
-
break;
|
|
1980
|
-
}
|
|
1981
|
-
h /= 6;
|
|
1982
|
-
}
|
|
1983
|
-
return { h: h, s: s, l: l };
|
|
1984
|
-
}
|
|
1985
|
-
function hue2rgb(p, q, t) {
|
|
1986
|
-
if (t < 0) {
|
|
1987
|
-
t += 1;
|
|
1988
|
-
}
|
|
1989
|
-
if (t > 1) {
|
|
1990
|
-
t -= 1;
|
|
1991
|
-
}
|
|
1992
|
-
if (t < 1 / 6) {
|
|
1993
|
-
return p + (q - p) * (6 * t);
|
|
1994
|
-
}
|
|
1995
|
-
if (t < 1 / 2) {
|
|
1996
|
-
return q;
|
|
1997
|
-
}
|
|
1998
|
-
if (t < 2 / 3) {
|
|
1999
|
-
return p + (q - p) * (2 / 3 - t) * 6;
|
|
2000
|
-
}
|
|
2001
|
-
return p;
|
|
2002
|
-
}
|
|
2003
|
-
/**
|
|
2004
|
-
* Converts an HSL color value to RGB.
|
|
2005
|
-
*
|
|
2006
|
-
* *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
|
|
2007
|
-
* *Returns:* { r, g, b } in the set [0, 255]
|
|
2008
|
-
*/
|
|
2009
|
-
function hslToRgb(h, s, l) {
|
|
2010
|
-
var r;
|
|
2011
|
-
var g;
|
|
2012
|
-
var b;
|
|
2013
|
-
h = bound01(h, 360);
|
|
2014
|
-
s = bound01(s, 100);
|
|
2015
|
-
l = bound01(l, 100);
|
|
2016
|
-
if (s === 0) {
|
|
2017
|
-
// achromatic
|
|
2018
|
-
g = l;
|
|
2019
|
-
b = l;
|
|
2020
|
-
r = l;
|
|
2021
|
-
}
|
|
2022
|
-
else {
|
|
2023
|
-
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
2024
|
-
var p = 2 * l - q;
|
|
2025
|
-
r = hue2rgb(p, q, h + 1 / 3);
|
|
2026
|
-
g = hue2rgb(p, q, h);
|
|
2027
|
-
b = hue2rgb(p, q, h - 1 / 3);
|
|
2028
|
-
}
|
|
2029
|
-
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
2030
|
-
}
|
|
2031
|
-
/**
|
|
2032
|
-
* Converts an RGB color value to HSV
|
|
2033
|
-
*
|
|
2034
|
-
* *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
|
|
2035
|
-
* *Returns:* { h, s, v } in [0,1]
|
|
2036
|
-
*/
|
|
2037
|
-
function rgbToHsv(r, g, b) {
|
|
2038
|
-
r = bound01(r, 255);
|
|
2039
|
-
g = bound01(g, 255);
|
|
2040
|
-
b = bound01(b, 255);
|
|
2041
|
-
var max = Math.max(r, g, b);
|
|
2042
|
-
var min = Math.min(r, g, b);
|
|
2043
|
-
var h = 0;
|
|
2044
|
-
var v = max;
|
|
2045
|
-
var d = max - min;
|
|
2046
|
-
var s = max === 0 ? 0 : d / max;
|
|
2047
|
-
if (max === min) {
|
|
2048
|
-
h = 0; // achromatic
|
|
2049
|
-
}
|
|
2050
|
-
else {
|
|
2051
|
-
switch (max) {
|
|
2052
|
-
case r:
|
|
2053
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
2054
|
-
break;
|
|
2055
|
-
case g:
|
|
2056
|
-
h = (b - r) / d + 2;
|
|
2057
|
-
break;
|
|
2058
|
-
case b:
|
|
2059
|
-
h = (r - g) / d + 4;
|
|
2060
|
-
break;
|
|
2061
|
-
}
|
|
2062
|
-
h /= 6;
|
|
2063
|
-
}
|
|
2064
|
-
return { h: h, s: s, v: v };
|
|
2065
|
-
}
|
|
2066
|
-
/**
|
|
2067
|
-
* Converts an HSV color value to RGB.
|
|
2068
|
-
*
|
|
2069
|
-
* *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
|
|
2070
|
-
* *Returns:* { r, g, b } in the set [0, 255]
|
|
2071
|
-
*/
|
|
2072
|
-
function hsvToRgb(h, s, v) {
|
|
2073
|
-
h = bound01(h, 360) * 6;
|
|
2074
|
-
s = bound01(s, 100);
|
|
2075
|
-
v = bound01(v, 100);
|
|
2076
|
-
var i = Math.floor(h);
|
|
2077
|
-
var f = h - i;
|
|
2078
|
-
var p = v * (1 - s);
|
|
2079
|
-
var q = v * (1 - f * s);
|
|
2080
|
-
var t = v * (1 - (1 - f) * s);
|
|
2081
|
-
var mod = i % 6;
|
|
2082
|
-
var r = [v, q, p, p, t, v][mod];
|
|
2083
|
-
var g = [t, v, v, q, p, p][mod];
|
|
2084
|
-
var b = [p, p, t, v, v, q][mod];
|
|
2085
|
-
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
2086
|
-
}
|
|
2087
|
-
/**
|
|
2088
|
-
* Converts an RGB color to hex
|
|
2089
|
-
*
|
|
2090
|
-
* Assumes r, g, and b are contained in the set [0, 255]
|
|
2091
|
-
* Returns a 3 or 6 character hex
|
|
2092
|
-
*/
|
|
2093
|
-
function rgbToHex(r, g, b, allow3Char) {
|
|
2094
|
-
var hex = [
|
|
2095
|
-
pad2(Math.round(r).toString(16)),
|
|
2096
|
-
pad2(Math.round(g).toString(16)),
|
|
2097
|
-
pad2(Math.round(b).toString(16)),
|
|
2098
|
-
];
|
|
2099
|
-
// Return a 3 character hex if possible
|
|
2100
|
-
if (allow3Char &&
|
|
2101
|
-
hex[0].startsWith(hex[0].charAt(1)) &&
|
|
2102
|
-
hex[1].startsWith(hex[1].charAt(1)) &&
|
|
2103
|
-
hex[2].startsWith(hex[2].charAt(1))) {
|
|
2104
|
-
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
2105
|
-
}
|
|
2106
|
-
return hex.join('');
|
|
2107
|
-
}
|
|
2108
|
-
/**
|
|
2109
|
-
* Converts an RGBA color plus alpha transparency to hex
|
|
2110
|
-
*
|
|
2111
|
-
* Assumes r, g, b are contained in the set [0, 255] and
|
|
2112
|
-
* a in [0, 1]. Returns a 4 or 8 character rgba hex
|
|
2113
|
-
*/
|
|
2114
|
-
// eslint-disable-next-line max-params
|
|
2115
|
-
function rgbaToHex(r, g, b, a, allow4Char) {
|
|
2116
|
-
var hex = [
|
|
2117
|
-
pad2(Math.round(r).toString(16)),
|
|
2118
|
-
pad2(Math.round(g).toString(16)),
|
|
2119
|
-
pad2(Math.round(b).toString(16)),
|
|
2120
|
-
pad2(convertDecimalToHex(a)),
|
|
2121
|
-
];
|
|
2122
|
-
// Return a 4 character hex if possible
|
|
2123
|
-
if (allow4Char &&
|
|
2124
|
-
hex[0].startsWith(hex[0].charAt(1)) &&
|
|
2125
|
-
hex[1].startsWith(hex[1].charAt(1)) &&
|
|
2126
|
-
hex[2].startsWith(hex[2].charAt(1)) &&
|
|
2127
|
-
hex[3].startsWith(hex[3].charAt(1))) {
|
|
2128
|
-
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
|
|
2129
|
-
}
|
|
2130
|
-
return hex.join('');
|
|
2131
|
-
}
|
|
2132
|
-
/** Converts a decimal to a hex value */
|
|
2133
|
-
function convertDecimalToHex(d) {
|
|
2134
|
-
return Math.round(parseFloat(d) * 255).toString(16);
|
|
2135
|
-
}
|
|
2136
|
-
/** Converts a hex value to a decimal */
|
|
2137
|
-
function convertHexToDecimal(h) {
|
|
2138
|
-
return parseIntFromHex(h) / 255;
|
|
2139
|
-
}
|
|
2140
|
-
/** Parse a base-16 hex value into a base-10 integer */
|
|
2141
|
-
function parseIntFromHex(val) {
|
|
2142
|
-
return parseInt(val, 16);
|
|
2143
|
-
}
|
|
2144
|
-
function numberInputToObject(color) {
|
|
2145
|
-
return {
|
|
2146
|
-
r: color >> 16,
|
|
2147
|
-
g: (color & 0xff00) >> 8,
|
|
2148
|
-
b: color & 0xff,
|
|
2149
|
-
};
|
|
2150
|
-
}
|
|
2151
|
-
|
|
2152
|
-
// https://github.com/bahamas10/css-color-names/blob/master/css-color-names.json
|
|
2153
|
-
/**
|
|
2154
|
-
* @hidden
|
|
2155
|
-
*/
|
|
2156
|
-
var names = {
|
|
2157
|
-
aliceblue: '#f0f8ff',
|
|
2158
|
-
antiquewhite: '#faebd7',
|
|
2159
|
-
aqua: '#00ffff',
|
|
2160
|
-
aquamarine: '#7fffd4',
|
|
2161
|
-
azure: '#f0ffff',
|
|
2162
|
-
beige: '#f5f5dc',
|
|
2163
|
-
bisque: '#ffe4c4',
|
|
2164
|
-
black: '#000000',
|
|
2165
|
-
blanchedalmond: '#ffebcd',
|
|
2166
|
-
blue: '#0000ff',
|
|
2167
|
-
blueviolet: '#8a2be2',
|
|
2168
|
-
brown: '#a52a2a',
|
|
2169
|
-
burlywood: '#deb887',
|
|
2170
|
-
cadetblue: '#5f9ea0',
|
|
2171
|
-
chartreuse: '#7fff00',
|
|
2172
|
-
chocolate: '#d2691e',
|
|
2173
|
-
coral: '#ff7f50',
|
|
2174
|
-
cornflowerblue: '#6495ed',
|
|
2175
|
-
cornsilk: '#fff8dc',
|
|
2176
|
-
crimson: '#dc143c',
|
|
2177
|
-
cyan: '#00ffff',
|
|
2178
|
-
darkblue: '#00008b',
|
|
2179
|
-
darkcyan: '#008b8b',
|
|
2180
|
-
darkgoldenrod: '#b8860b',
|
|
2181
|
-
darkgray: '#a9a9a9',
|
|
2182
|
-
darkgreen: '#006400',
|
|
2183
|
-
darkgrey: '#a9a9a9',
|
|
2184
|
-
darkkhaki: '#bdb76b',
|
|
2185
|
-
darkmagenta: '#8b008b',
|
|
2186
|
-
darkolivegreen: '#556b2f',
|
|
2187
|
-
darkorange: '#ff8c00',
|
|
2188
|
-
darkorchid: '#9932cc',
|
|
2189
|
-
darkred: '#8b0000',
|
|
2190
|
-
darksalmon: '#e9967a',
|
|
2191
|
-
darkseagreen: '#8fbc8f',
|
|
2192
|
-
darkslateblue: '#483d8b',
|
|
2193
|
-
darkslategray: '#2f4f4f',
|
|
2194
|
-
darkslategrey: '#2f4f4f',
|
|
2195
|
-
darkturquoise: '#00ced1',
|
|
2196
|
-
darkviolet: '#9400d3',
|
|
2197
|
-
deeppink: '#ff1493',
|
|
2198
|
-
deepskyblue: '#00bfff',
|
|
2199
|
-
dimgray: '#696969',
|
|
2200
|
-
dimgrey: '#696969',
|
|
2201
|
-
dodgerblue: '#1e90ff',
|
|
2202
|
-
firebrick: '#b22222',
|
|
2203
|
-
floralwhite: '#fffaf0',
|
|
2204
|
-
forestgreen: '#228b22',
|
|
2205
|
-
fuchsia: '#ff00ff',
|
|
2206
|
-
gainsboro: '#dcdcdc',
|
|
2207
|
-
ghostwhite: '#f8f8ff',
|
|
2208
|
-
goldenrod: '#daa520',
|
|
2209
|
-
gold: '#ffd700',
|
|
2210
|
-
gray: '#808080',
|
|
2211
|
-
green: '#008000',
|
|
2212
|
-
greenyellow: '#adff2f',
|
|
2213
|
-
grey: '#808080',
|
|
2214
|
-
honeydew: '#f0fff0',
|
|
2215
|
-
hotpink: '#ff69b4',
|
|
2216
|
-
indianred: '#cd5c5c',
|
|
2217
|
-
indigo: '#4b0082',
|
|
2218
|
-
ivory: '#fffff0',
|
|
2219
|
-
khaki: '#f0e68c',
|
|
2220
|
-
lavenderblush: '#fff0f5',
|
|
2221
|
-
lavender: '#e6e6fa',
|
|
2222
|
-
lawngreen: '#7cfc00',
|
|
2223
|
-
lemonchiffon: '#fffacd',
|
|
2224
|
-
lightblue: '#add8e6',
|
|
2225
|
-
lightcoral: '#f08080',
|
|
2226
|
-
lightcyan: '#e0ffff',
|
|
2227
|
-
lightgoldenrodyellow: '#fafad2',
|
|
2228
|
-
lightgray: '#d3d3d3',
|
|
2229
|
-
lightgreen: '#90ee90',
|
|
2230
|
-
lightgrey: '#d3d3d3',
|
|
2231
|
-
lightpink: '#ffb6c1',
|
|
2232
|
-
lightsalmon: '#ffa07a',
|
|
2233
|
-
lightseagreen: '#20b2aa',
|
|
2234
|
-
lightskyblue: '#87cefa',
|
|
2235
|
-
lightslategray: '#778899',
|
|
2236
|
-
lightslategrey: '#778899',
|
|
2237
|
-
lightsteelblue: '#b0c4de',
|
|
2238
|
-
lightyellow: '#ffffe0',
|
|
2239
|
-
lime: '#00ff00',
|
|
2240
|
-
limegreen: '#32cd32',
|
|
2241
|
-
linen: '#faf0e6',
|
|
2242
|
-
magenta: '#ff00ff',
|
|
2243
|
-
maroon: '#800000',
|
|
2244
|
-
mediumaquamarine: '#66cdaa',
|
|
2245
|
-
mediumblue: '#0000cd',
|
|
2246
|
-
mediumorchid: '#ba55d3',
|
|
2247
|
-
mediumpurple: '#9370db',
|
|
2248
|
-
mediumseagreen: '#3cb371',
|
|
2249
|
-
mediumslateblue: '#7b68ee',
|
|
2250
|
-
mediumspringgreen: '#00fa9a',
|
|
2251
|
-
mediumturquoise: '#48d1cc',
|
|
2252
|
-
mediumvioletred: '#c71585',
|
|
2253
|
-
midnightblue: '#191970',
|
|
2254
|
-
mintcream: '#f5fffa',
|
|
2255
|
-
mistyrose: '#ffe4e1',
|
|
2256
|
-
moccasin: '#ffe4b5',
|
|
2257
|
-
navajowhite: '#ffdead',
|
|
2258
|
-
navy: '#000080',
|
|
2259
|
-
oldlace: '#fdf5e6',
|
|
2260
|
-
olive: '#808000',
|
|
2261
|
-
olivedrab: '#6b8e23',
|
|
2262
|
-
orange: '#ffa500',
|
|
2263
|
-
orangered: '#ff4500',
|
|
2264
|
-
orchid: '#da70d6',
|
|
2265
|
-
palegoldenrod: '#eee8aa',
|
|
2266
|
-
palegreen: '#98fb98',
|
|
2267
|
-
paleturquoise: '#afeeee',
|
|
2268
|
-
palevioletred: '#db7093',
|
|
2269
|
-
papayawhip: '#ffefd5',
|
|
2270
|
-
peachpuff: '#ffdab9',
|
|
2271
|
-
peru: '#cd853f',
|
|
2272
|
-
pink: '#ffc0cb',
|
|
2273
|
-
plum: '#dda0dd',
|
|
2274
|
-
powderblue: '#b0e0e6',
|
|
2275
|
-
purple: '#800080',
|
|
2276
|
-
rebeccapurple: '#663399',
|
|
2277
|
-
red: '#ff0000',
|
|
2278
|
-
rosybrown: '#bc8f8f',
|
|
2279
|
-
royalblue: '#4169e1',
|
|
2280
|
-
saddlebrown: '#8b4513',
|
|
2281
|
-
salmon: '#fa8072',
|
|
2282
|
-
sandybrown: '#f4a460',
|
|
2283
|
-
seagreen: '#2e8b57',
|
|
2284
|
-
seashell: '#fff5ee',
|
|
2285
|
-
sienna: '#a0522d',
|
|
2286
|
-
silver: '#c0c0c0',
|
|
2287
|
-
skyblue: '#87ceeb',
|
|
2288
|
-
slateblue: '#6a5acd',
|
|
2289
|
-
slategray: '#708090',
|
|
2290
|
-
slategrey: '#708090',
|
|
2291
|
-
snow: '#fffafa',
|
|
2292
|
-
springgreen: '#00ff7f',
|
|
2293
|
-
steelblue: '#4682b4',
|
|
2294
|
-
tan: '#d2b48c',
|
|
2295
|
-
teal: '#008080',
|
|
2296
|
-
thistle: '#d8bfd8',
|
|
2297
|
-
tomato: '#ff6347',
|
|
2298
|
-
turquoise: '#40e0d0',
|
|
2299
|
-
violet: '#ee82ee',
|
|
2300
|
-
wheat: '#f5deb3',
|
|
2301
|
-
white: '#ffffff',
|
|
2302
|
-
whitesmoke: '#f5f5f5',
|
|
2303
|
-
yellow: '#ffff00',
|
|
2304
|
-
yellowgreen: '#9acd32',
|
|
2305
|
-
};
|
|
2306
|
-
|
|
2307
|
-
/* eslint-disable @typescript-eslint/no-redundant-type-constituents */
|
|
2308
|
-
/**
|
|
2309
|
-
* Given a string or object, convert that input to RGB
|
|
2310
|
-
*
|
|
2311
|
-
* Possible string inputs:
|
|
2312
|
-
* ```
|
|
2313
|
-
* "red"
|
|
2314
|
-
* "#f00" or "f00"
|
|
2315
|
-
* "#ff0000" or "ff0000"
|
|
2316
|
-
* "#ff000000" or "ff000000"
|
|
2317
|
-
* "rgb 255 0 0" or "rgb (255, 0, 0)"
|
|
2318
|
-
* "rgb 1.0 0 0" or "rgb (1, 0, 0)"
|
|
2319
|
-
* "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
|
|
2320
|
-
* "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
|
|
2321
|
-
* "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
|
|
2322
|
-
* "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
|
|
2323
|
-
* "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
|
|
2324
|
-
* ```
|
|
2325
|
-
*/
|
|
2326
|
-
function inputToRGB(color) {
|
|
2327
|
-
var rgb = { r: 0, g: 0, b: 0 };
|
|
2328
|
-
var a = 1;
|
|
2329
|
-
var s = null;
|
|
2330
|
-
var v = null;
|
|
2331
|
-
var l = null;
|
|
2332
|
-
var ok = false;
|
|
2333
|
-
var format = false;
|
|
2334
|
-
if (typeof color === 'string') {
|
|
2335
|
-
color = stringInputToObject(color);
|
|
2336
|
-
}
|
|
2337
|
-
if (typeof color === 'object') {
|
|
2338
|
-
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
2339
|
-
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
2340
|
-
ok = true;
|
|
2341
|
-
format = String(color.r).substr(-1) === '%' ? 'prgb' : 'rgb';
|
|
2342
|
-
}
|
|
2343
|
-
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
2344
|
-
s = convertToPercentage(color.s);
|
|
2345
|
-
v = convertToPercentage(color.v);
|
|
2346
|
-
rgb = hsvToRgb(color.h, s, v);
|
|
2347
|
-
ok = true;
|
|
2348
|
-
format = 'hsv';
|
|
2349
|
-
}
|
|
2350
|
-
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
2351
|
-
s = convertToPercentage(color.s);
|
|
2352
|
-
l = convertToPercentage(color.l);
|
|
2353
|
-
rgb = hslToRgb(color.h, s, l);
|
|
2354
|
-
ok = true;
|
|
2355
|
-
format = 'hsl';
|
|
2356
|
-
}
|
|
2357
|
-
if (Object.prototype.hasOwnProperty.call(color, 'a')) {
|
|
2358
|
-
a = color.a;
|
|
2359
|
-
}
|
|
2360
|
-
}
|
|
2361
|
-
a = boundAlpha(a);
|
|
2362
|
-
return {
|
|
2363
|
-
ok: ok,
|
|
2364
|
-
format: color.format || format,
|
|
2365
|
-
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
2366
|
-
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
2367
|
-
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
2368
|
-
a: a,
|
|
2369
|
-
};
|
|
2370
|
-
}
|
|
2371
|
-
// <http://www.w3.org/TR/css3-values/#integers>
|
|
2372
|
-
var CSS_INTEGER = '[-\\+]?\\d+%?';
|
|
2373
|
-
// <http://www.w3.org/TR/css3-values/#number-value>
|
|
2374
|
-
var CSS_NUMBER = '[-\\+]?\\d*\\.\\d+%?';
|
|
2375
|
-
// Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
|
|
2376
|
-
var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
|
|
2377
|
-
// Actual matching.
|
|
2378
|
-
// Parentheses and commas are optional, but not required.
|
|
2379
|
-
// Whitespace can take the place of commas or opening paren
|
|
2380
|
-
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
|
|
2381
|
-
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
|
|
2382
|
-
var matchers = {
|
|
2383
|
-
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
2384
|
-
rgb: new RegExp('rgb' + PERMISSIVE_MATCH3),
|
|
2385
|
-
rgba: new RegExp('rgba' + PERMISSIVE_MATCH4),
|
|
2386
|
-
hsl: new RegExp('hsl' + PERMISSIVE_MATCH3),
|
|
2387
|
-
hsla: new RegExp('hsla' + PERMISSIVE_MATCH4),
|
|
2388
|
-
hsv: new RegExp('hsv' + PERMISSIVE_MATCH3),
|
|
2389
|
-
hsva: new RegExp('hsva' + PERMISSIVE_MATCH4),
|
|
2390
|
-
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
2391
|
-
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
2392
|
-
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
2393
|
-
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
2394
|
-
};
|
|
2395
|
-
/**
|
|
2396
|
-
* Permissive string parsing. Take in a number of formats, and output an object
|
|
2397
|
-
* based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
|
|
2398
|
-
*/
|
|
2399
|
-
function stringInputToObject(color) {
|
|
2400
|
-
color = color.trim().toLowerCase();
|
|
2401
|
-
if (color.length === 0) {
|
|
2402
|
-
return false;
|
|
2403
|
-
}
|
|
2404
|
-
var named = false;
|
|
2405
|
-
if (names[color]) {
|
|
2406
|
-
color = names[color];
|
|
2407
|
-
named = true;
|
|
2408
|
-
}
|
|
2409
|
-
else if (color === 'transparent') {
|
|
2410
|
-
return { r: 0, g: 0, b: 0, a: 0, format: 'name' };
|
|
2411
|
-
}
|
|
2412
|
-
// Try to match string input using regular expressions.
|
|
2413
|
-
// Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
|
|
2414
|
-
// Just return an object and let the conversion functions handle that.
|
|
2415
|
-
// This way the result will be the same whether the tinycolor is initialized with string or object.
|
|
2416
|
-
var match = matchers.rgb.exec(color);
|
|
2417
|
-
if (match) {
|
|
2418
|
-
return { r: match[1], g: match[2], b: match[3] };
|
|
2419
|
-
}
|
|
2420
|
-
match = matchers.rgba.exec(color);
|
|
2421
|
-
if (match) {
|
|
2422
|
-
return { r: match[1], g: match[2], b: match[3], a: match[4] };
|
|
2423
|
-
}
|
|
2424
|
-
match = matchers.hsl.exec(color);
|
|
2425
|
-
if (match) {
|
|
2426
|
-
return { h: match[1], s: match[2], l: match[3] };
|
|
2427
|
-
}
|
|
2428
|
-
match = matchers.hsla.exec(color);
|
|
2429
|
-
if (match) {
|
|
2430
|
-
return { h: match[1], s: match[2], l: match[3], a: match[4] };
|
|
2431
|
-
}
|
|
2432
|
-
match = matchers.hsv.exec(color);
|
|
2433
|
-
if (match) {
|
|
2434
|
-
return { h: match[1], s: match[2], v: match[3] };
|
|
2435
|
-
}
|
|
2436
|
-
match = matchers.hsva.exec(color);
|
|
2437
|
-
if (match) {
|
|
2438
|
-
return { h: match[1], s: match[2], v: match[3], a: match[4] };
|
|
2439
|
-
}
|
|
2440
|
-
match = matchers.hex8.exec(color);
|
|
2441
|
-
if (match) {
|
|
2442
|
-
return {
|
|
2443
|
-
r: parseIntFromHex(match[1]),
|
|
2444
|
-
g: parseIntFromHex(match[2]),
|
|
2445
|
-
b: parseIntFromHex(match[3]),
|
|
2446
|
-
a: convertHexToDecimal(match[4]),
|
|
2447
|
-
format: named ? 'name' : 'hex8',
|
|
2448
|
-
};
|
|
2449
|
-
}
|
|
2450
|
-
match = matchers.hex6.exec(color);
|
|
2451
|
-
if (match) {
|
|
2452
|
-
return {
|
|
2453
|
-
r: parseIntFromHex(match[1]),
|
|
2454
|
-
g: parseIntFromHex(match[2]),
|
|
2455
|
-
b: parseIntFromHex(match[3]),
|
|
2456
|
-
format: named ? 'name' : 'hex',
|
|
2457
|
-
};
|
|
2458
|
-
}
|
|
2459
|
-
match = matchers.hex4.exec(color);
|
|
2460
|
-
if (match) {
|
|
2461
|
-
return {
|
|
2462
|
-
r: parseIntFromHex(match[1] + match[1]),
|
|
2463
|
-
g: parseIntFromHex(match[2] + match[2]),
|
|
2464
|
-
b: parseIntFromHex(match[3] + match[3]),
|
|
2465
|
-
a: convertHexToDecimal(match[4] + match[4]),
|
|
2466
|
-
format: named ? 'name' : 'hex8',
|
|
2467
|
-
};
|
|
2468
|
-
}
|
|
2469
|
-
match = matchers.hex3.exec(color);
|
|
2470
|
-
if (match) {
|
|
2471
|
-
return {
|
|
2472
|
-
r: parseIntFromHex(match[1] + match[1]),
|
|
2473
|
-
g: parseIntFromHex(match[2] + match[2]),
|
|
2474
|
-
b: parseIntFromHex(match[3] + match[3]),
|
|
2475
|
-
format: named ? 'name' : 'hex',
|
|
2476
|
-
};
|
|
2477
|
-
}
|
|
2478
|
-
return false;
|
|
2479
|
-
}
|
|
2480
|
-
/**
|
|
2481
|
-
* Check to see if it looks like a CSS unit
|
|
2482
|
-
* (see `matchers` above for definition).
|
|
2483
|
-
*/
|
|
2484
|
-
function isValidCSSUnit(color) {
|
|
2485
|
-
return Boolean(matchers.CSS_UNIT.exec(String(color)));
|
|
2486
|
-
}
|
|
2487
|
-
|
|
2488
|
-
var TinyColor = /** @class */ (function () {
|
|
2489
|
-
function TinyColor(color, opts) {
|
|
2490
|
-
if (color === void 0) { color = ''; }
|
|
2491
|
-
if (opts === void 0) { opts = {}; }
|
|
2492
|
-
var _a;
|
|
2493
|
-
// If input is already a tinycolor, return itself
|
|
2494
|
-
if (color instanceof TinyColor) {
|
|
2495
|
-
// eslint-disable-next-line no-constructor-return
|
|
2496
|
-
return color;
|
|
2497
|
-
}
|
|
2498
|
-
if (typeof color === 'number') {
|
|
2499
|
-
color = numberInputToObject(color);
|
|
2500
|
-
}
|
|
2501
|
-
this.originalInput = color;
|
|
2502
|
-
var rgb = inputToRGB(color);
|
|
2503
|
-
this.originalInput = color;
|
|
2504
|
-
this.r = rgb.r;
|
|
2505
|
-
this.g = rgb.g;
|
|
2506
|
-
this.b = rgb.b;
|
|
2507
|
-
this.a = rgb.a;
|
|
2508
|
-
this.roundA = Math.round(100 * this.a) / 100;
|
|
2509
|
-
this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format;
|
|
2510
|
-
this.gradientType = opts.gradientType;
|
|
2511
|
-
// Don't let the range of [0,255] come back in [0,1].
|
|
2512
|
-
// Potentially lose a little bit of precision here, but will fix issues where
|
|
2513
|
-
// .5 gets interpreted as half of the total, instead of half of 1
|
|
2514
|
-
// If it was supposed to be 128, this was already taken care of by `inputToRgb`
|
|
2515
|
-
if (this.r < 1) {
|
|
2516
|
-
this.r = Math.round(this.r);
|
|
2517
|
-
}
|
|
2518
|
-
if (this.g < 1) {
|
|
2519
|
-
this.g = Math.round(this.g);
|
|
2520
|
-
}
|
|
2521
|
-
if (this.b < 1) {
|
|
2522
|
-
this.b = Math.round(this.b);
|
|
2523
|
-
}
|
|
2524
|
-
this.isValid = rgb.ok;
|
|
2525
|
-
}
|
|
2526
|
-
TinyColor.prototype.isDark = function () {
|
|
2527
|
-
return this.getBrightness() < 128;
|
|
2528
|
-
};
|
|
2529
|
-
TinyColor.prototype.isLight = function () {
|
|
2530
|
-
return !this.isDark();
|
|
2531
|
-
};
|
|
2532
|
-
/**
|
|
2533
|
-
* Returns the perceived brightness of the color, from 0-255.
|
|
2534
|
-
*/
|
|
2535
|
-
TinyColor.prototype.getBrightness = function () {
|
|
2536
|
-
// http://www.w3.org/TR/AERT#color-contrast
|
|
2537
|
-
var rgb = this.toRgb();
|
|
2538
|
-
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
|
|
2539
|
-
};
|
|
2540
|
-
/**
|
|
2541
|
-
* Returns the perceived luminance of a color, from 0-1.
|
|
2542
|
-
*/
|
|
2543
|
-
TinyColor.prototype.getLuminance = function () {
|
|
2544
|
-
// http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
|
2545
|
-
var rgb = this.toRgb();
|
|
2546
|
-
var R;
|
|
2547
|
-
var G;
|
|
2548
|
-
var B;
|
|
2549
|
-
var RsRGB = rgb.r / 255;
|
|
2550
|
-
var GsRGB = rgb.g / 255;
|
|
2551
|
-
var BsRGB = rgb.b / 255;
|
|
2552
|
-
if (RsRGB <= 0.03928) {
|
|
2553
|
-
R = RsRGB / 12.92;
|
|
2554
|
-
}
|
|
2555
|
-
else {
|
|
2556
|
-
// eslint-disable-next-line prefer-exponentiation-operator
|
|
2557
|
-
R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
|
2558
|
-
}
|
|
2559
|
-
if (GsRGB <= 0.03928) {
|
|
2560
|
-
G = GsRGB / 12.92;
|
|
2561
|
-
}
|
|
2562
|
-
else {
|
|
2563
|
-
// eslint-disable-next-line prefer-exponentiation-operator
|
|
2564
|
-
G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
2565
|
-
}
|
|
2566
|
-
if (BsRGB <= 0.03928) {
|
|
2567
|
-
B = BsRGB / 12.92;
|
|
2568
|
-
}
|
|
2569
|
-
else {
|
|
2570
|
-
// eslint-disable-next-line prefer-exponentiation-operator
|
|
2571
|
-
B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
2572
|
-
}
|
|
2573
|
-
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
2574
|
-
};
|
|
2575
|
-
/**
|
|
2576
|
-
* Returns the alpha value of a color, from 0-1.
|
|
2577
|
-
*/
|
|
2578
|
-
TinyColor.prototype.getAlpha = function () {
|
|
2579
|
-
return this.a;
|
|
2580
|
-
};
|
|
2581
|
-
/**
|
|
2582
|
-
* Sets the alpha value on the current color.
|
|
2583
|
-
*
|
|
2584
|
-
* @param alpha - The new alpha value. The accepted range is 0-1.
|
|
2585
|
-
*/
|
|
2586
|
-
TinyColor.prototype.setAlpha = function (alpha) {
|
|
2587
|
-
this.a = boundAlpha(alpha);
|
|
2588
|
-
this.roundA = Math.round(100 * this.a) / 100;
|
|
2589
|
-
return this;
|
|
2590
|
-
};
|
|
2591
|
-
/**
|
|
2592
|
-
* Returns whether the color is monochrome.
|
|
2593
|
-
*/
|
|
2594
|
-
TinyColor.prototype.isMonochrome = function () {
|
|
2595
|
-
var s = this.toHsl().s;
|
|
2596
|
-
return s === 0;
|
|
2597
|
-
};
|
|
2598
|
-
/**
|
|
2599
|
-
* Returns the object as a HSVA object.
|
|
2600
|
-
*/
|
|
2601
|
-
TinyColor.prototype.toHsv = function () {
|
|
2602
|
-
var hsv = rgbToHsv(this.r, this.g, this.b);
|
|
2603
|
-
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
|
|
2604
|
-
};
|
|
2605
|
-
/**
|
|
2606
|
-
* Returns the hsva values interpolated into a string with the following format:
|
|
2607
|
-
* "hsva(xxx, xxx, xxx, xx)".
|
|
2608
|
-
*/
|
|
2609
|
-
TinyColor.prototype.toHsvString = function () {
|
|
2610
|
-
var hsv = rgbToHsv(this.r, this.g, this.b);
|
|
2611
|
-
var h = Math.round(hsv.h * 360);
|
|
2612
|
-
var s = Math.round(hsv.s * 100);
|
|
2613
|
-
var v = Math.round(hsv.v * 100);
|
|
2614
|
-
return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
|
|
2615
|
-
};
|
|
2616
|
-
/**
|
|
2617
|
-
* Returns the object as a HSLA object.
|
|
2618
|
-
*/
|
|
2619
|
-
TinyColor.prototype.toHsl = function () {
|
|
2620
|
-
var hsl = rgbToHsl(this.r, this.g, this.b);
|
|
2621
|
-
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
|
|
2622
|
-
};
|
|
2623
|
-
/**
|
|
2624
|
-
* Returns the hsla values interpolated into a string with the following format:
|
|
2625
|
-
* "hsla(xxx, xxx, xxx, xx)".
|
|
2626
|
-
*/
|
|
2627
|
-
TinyColor.prototype.toHslString = function () {
|
|
2628
|
-
var hsl = rgbToHsl(this.r, this.g, this.b);
|
|
2629
|
-
var h = Math.round(hsl.h * 360);
|
|
2630
|
-
var s = Math.round(hsl.s * 100);
|
|
2631
|
-
var l = Math.round(hsl.l * 100);
|
|
2632
|
-
return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
|
|
2633
|
-
};
|
|
2634
|
-
/**
|
|
2635
|
-
* Returns the hex value of the color.
|
|
2636
|
-
* @param allow3Char will shorten hex value to 3 char if possible
|
|
2637
|
-
*/
|
|
2638
|
-
TinyColor.prototype.toHex = function (allow3Char) {
|
|
2639
|
-
if (allow3Char === void 0) { allow3Char = false; }
|
|
2640
|
-
return rgbToHex(this.r, this.g, this.b, allow3Char);
|
|
2641
|
-
};
|
|
2642
|
-
/**
|
|
2643
|
-
* Returns the hex value of the color -with a # prefixed.
|
|
2644
|
-
* @param allow3Char will shorten hex value to 3 char if possible
|
|
2645
|
-
*/
|
|
2646
|
-
TinyColor.prototype.toHexString = function (allow3Char) {
|
|
2647
|
-
if (allow3Char === void 0) { allow3Char = false; }
|
|
2648
|
-
return '#' + this.toHex(allow3Char);
|
|
2649
|
-
};
|
|
2650
|
-
/**
|
|
2651
|
-
* Returns the hex 8 value of the color.
|
|
2652
|
-
* @param allow4Char will shorten hex value to 4 char if possible
|
|
2653
|
-
*/
|
|
2654
|
-
TinyColor.prototype.toHex8 = function (allow4Char) {
|
|
2655
|
-
if (allow4Char === void 0) { allow4Char = false; }
|
|
2656
|
-
return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
|
|
2657
|
-
};
|
|
2658
|
-
/**
|
|
2659
|
-
* Returns the hex 8 value of the color -with a # prefixed.
|
|
2660
|
-
* @param allow4Char will shorten hex value to 4 char if possible
|
|
2661
|
-
*/
|
|
2662
|
-
TinyColor.prototype.toHex8String = function (allow4Char) {
|
|
2663
|
-
if (allow4Char === void 0) { allow4Char = false; }
|
|
2664
|
-
return '#' + this.toHex8(allow4Char);
|
|
2665
|
-
};
|
|
2666
|
-
/**
|
|
2667
|
-
* Returns the shorter hex value of the color depends on its alpha -with a # prefixed.
|
|
2668
|
-
* @param allowShortChar will shorten hex value to 3 or 4 char if possible
|
|
2669
|
-
*/
|
|
2670
|
-
TinyColor.prototype.toHexShortString = function (allowShortChar) {
|
|
2671
|
-
if (allowShortChar === void 0) { allowShortChar = false; }
|
|
2672
|
-
return this.a === 1 ? this.toHexString(allowShortChar) : this.toHex8String(allowShortChar);
|
|
2673
|
-
};
|
|
2674
|
-
/**
|
|
2675
|
-
* Returns the object as a RGBA object.
|
|
2676
|
-
*/
|
|
2677
|
-
TinyColor.prototype.toRgb = function () {
|
|
2678
|
-
return {
|
|
2679
|
-
r: Math.round(this.r),
|
|
2680
|
-
g: Math.round(this.g),
|
|
2681
|
-
b: Math.round(this.b),
|
|
2682
|
-
a: this.a,
|
|
2683
|
-
};
|
|
2684
|
-
};
|
|
2685
|
-
/**
|
|
2686
|
-
* Returns the RGBA values interpolated into a string with the following format:
|
|
2687
|
-
* "RGBA(xxx, xxx, xxx, xx)".
|
|
2688
|
-
*/
|
|
2689
|
-
TinyColor.prototype.toRgbString = function () {
|
|
2690
|
-
var r = Math.round(this.r);
|
|
2691
|
-
var g = Math.round(this.g);
|
|
2692
|
-
var b = Math.round(this.b);
|
|
2693
|
-
return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
|
|
2694
|
-
};
|
|
2695
|
-
/**
|
|
2696
|
-
* Returns the object as a RGBA object.
|
|
2697
|
-
*/
|
|
2698
|
-
TinyColor.prototype.toPercentageRgb = function () {
|
|
2699
|
-
var fmt = function (x) { return "".concat(Math.round(bound01(x, 255) * 100), "%"); };
|
|
2700
|
-
return {
|
|
2701
|
-
r: fmt(this.r),
|
|
2702
|
-
g: fmt(this.g),
|
|
2703
|
-
b: fmt(this.b),
|
|
2704
|
-
a: this.a,
|
|
2705
|
-
};
|
|
2706
|
-
};
|
|
2707
|
-
/**
|
|
2708
|
-
* Returns the RGBA relative values interpolated into a string
|
|
2709
|
-
*/
|
|
2710
|
-
TinyColor.prototype.toPercentageRgbString = function () {
|
|
2711
|
-
var rnd = function (x) { return Math.round(bound01(x, 255) * 100); };
|
|
2712
|
-
return this.a === 1
|
|
2713
|
-
? "rgb(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%)")
|
|
2714
|
-
: "rgba(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%, ").concat(this.roundA, ")");
|
|
2715
|
-
};
|
|
2716
|
-
/**
|
|
2717
|
-
* The 'real' name of the color -if there is one.
|
|
2718
|
-
*/
|
|
2719
|
-
TinyColor.prototype.toName = function () {
|
|
2720
|
-
if (this.a === 0) {
|
|
2721
|
-
return 'transparent';
|
|
2722
|
-
}
|
|
2723
|
-
if (this.a < 1) {
|
|
2724
|
-
return false;
|
|
2725
|
-
}
|
|
2726
|
-
var hex = '#' + rgbToHex(this.r, this.g, this.b, false);
|
|
2727
|
-
for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) {
|
|
2728
|
-
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
2729
|
-
if (hex === value) {
|
|
2730
|
-
return key;
|
|
2731
|
-
}
|
|
2732
|
-
}
|
|
2733
|
-
return false;
|
|
2734
|
-
};
|
|
2735
|
-
TinyColor.prototype.toString = function (format) {
|
|
2736
|
-
var formatSet = Boolean(format);
|
|
2737
|
-
format = format !== null && format !== void 0 ? format : this.format;
|
|
2738
|
-
var formattedString = false;
|
|
2739
|
-
var hasAlpha = this.a < 1 && this.a >= 0;
|
|
2740
|
-
var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith('hex') || format === 'name');
|
|
2741
|
-
if (needsAlphaFormat) {
|
|
2742
|
-
// Special case for "transparent", all other non-alpha formats
|
|
2743
|
-
// will return rgba when there is transparency.
|
|
2744
|
-
if (format === 'name' && this.a === 0) {
|
|
2745
|
-
return this.toName();
|
|
2746
|
-
}
|
|
2747
|
-
return this.toRgbString();
|
|
2748
|
-
}
|
|
2749
|
-
if (format === 'rgb') {
|
|
2750
|
-
formattedString = this.toRgbString();
|
|
2751
|
-
}
|
|
2752
|
-
if (format === 'prgb') {
|
|
2753
|
-
formattedString = this.toPercentageRgbString();
|
|
2754
|
-
}
|
|
2755
|
-
if (format === 'hex' || format === 'hex6') {
|
|
2756
|
-
formattedString = this.toHexString();
|
|
2757
|
-
}
|
|
2758
|
-
if (format === 'hex3') {
|
|
2759
|
-
formattedString = this.toHexString(true);
|
|
2760
|
-
}
|
|
2761
|
-
if (format === 'hex4') {
|
|
2762
|
-
formattedString = this.toHex8String(true);
|
|
2763
|
-
}
|
|
2764
|
-
if (format === 'hex8') {
|
|
2765
|
-
formattedString = this.toHex8String();
|
|
2766
|
-
}
|
|
2767
|
-
if (format === 'name') {
|
|
2768
|
-
formattedString = this.toName();
|
|
2769
|
-
}
|
|
2770
|
-
if (format === 'hsl') {
|
|
2771
|
-
formattedString = this.toHslString();
|
|
2772
|
-
}
|
|
2773
|
-
if (format === 'hsv') {
|
|
2774
|
-
formattedString = this.toHsvString();
|
|
2775
|
-
}
|
|
2776
|
-
return formattedString || this.toHexString();
|
|
2777
|
-
};
|
|
2778
|
-
TinyColor.prototype.toNumber = function () {
|
|
2779
|
-
return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
|
|
2780
|
-
};
|
|
2781
|
-
TinyColor.prototype.clone = function () {
|
|
2782
|
-
return new TinyColor(this.toString());
|
|
2783
|
-
};
|
|
2784
|
-
/**
|
|
2785
|
-
* Lighten the color a given amount. Providing 100 will always return white.
|
|
2786
|
-
* @param amount - valid between 1-100
|
|
2787
|
-
*/
|
|
2788
|
-
TinyColor.prototype.lighten = function (amount) {
|
|
2789
|
-
if (amount === void 0) { amount = 10; }
|
|
2790
|
-
var hsl = this.toHsl();
|
|
2791
|
-
hsl.l += amount / 100;
|
|
2792
|
-
hsl.l = clamp01(hsl.l);
|
|
2793
|
-
return new TinyColor(hsl);
|
|
2794
|
-
};
|
|
2795
|
-
/**
|
|
2796
|
-
* Brighten the color a given amount, from 0 to 100.
|
|
2797
|
-
* @param amount - valid between 1-100
|
|
2798
|
-
*/
|
|
2799
|
-
TinyColor.prototype.brighten = function (amount) {
|
|
2800
|
-
if (amount === void 0) { amount = 10; }
|
|
2801
|
-
var rgb = this.toRgb();
|
|
2802
|
-
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
|
|
2803
|
-
rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
|
|
2804
|
-
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
|
|
2805
|
-
return new TinyColor(rgb);
|
|
2806
|
-
};
|
|
2807
|
-
/**
|
|
2808
|
-
* Darken the color a given amount, from 0 to 100.
|
|
2809
|
-
* Providing 100 will always return black.
|
|
2810
|
-
* @param amount - valid between 1-100
|
|
2811
|
-
*/
|
|
2812
|
-
TinyColor.prototype.darken = function (amount) {
|
|
2813
|
-
if (amount === void 0) { amount = 10; }
|
|
2814
|
-
var hsl = this.toHsl();
|
|
2815
|
-
hsl.l -= amount / 100;
|
|
2816
|
-
hsl.l = clamp01(hsl.l);
|
|
2817
|
-
return new TinyColor(hsl);
|
|
2818
|
-
};
|
|
2819
|
-
/**
|
|
2820
|
-
* Mix the color with pure white, from 0 to 100.
|
|
2821
|
-
* Providing 0 will do nothing, providing 100 will always return white.
|
|
2822
|
-
* @param amount - valid between 1-100
|
|
2823
|
-
*/
|
|
2824
|
-
TinyColor.prototype.tint = function (amount) {
|
|
2825
|
-
if (amount === void 0) { amount = 10; }
|
|
2826
|
-
return this.mix('white', amount);
|
|
2827
|
-
};
|
|
2828
|
-
/**
|
|
2829
|
-
* Mix the color with pure black, from 0 to 100.
|
|
2830
|
-
* Providing 0 will do nothing, providing 100 will always return black.
|
|
2831
|
-
* @param amount - valid between 1-100
|
|
2832
|
-
*/
|
|
2833
|
-
TinyColor.prototype.shade = function (amount) {
|
|
2834
|
-
if (amount === void 0) { amount = 10; }
|
|
2835
|
-
return this.mix('black', amount);
|
|
2836
|
-
};
|
|
2837
|
-
/**
|
|
2838
|
-
* Desaturate the color a given amount, from 0 to 100.
|
|
2839
|
-
* Providing 100 will is the same as calling greyscale
|
|
2840
|
-
* @param amount - valid between 1-100
|
|
2841
|
-
*/
|
|
2842
|
-
TinyColor.prototype.desaturate = function (amount) {
|
|
2843
|
-
if (amount === void 0) { amount = 10; }
|
|
2844
|
-
var hsl = this.toHsl();
|
|
2845
|
-
hsl.s -= amount / 100;
|
|
2846
|
-
hsl.s = clamp01(hsl.s);
|
|
2847
|
-
return new TinyColor(hsl);
|
|
2848
|
-
};
|
|
2849
|
-
/**
|
|
2850
|
-
* Saturate the color a given amount, from 0 to 100.
|
|
2851
|
-
* @param amount - valid between 1-100
|
|
2852
|
-
*/
|
|
2853
|
-
TinyColor.prototype.saturate = function (amount) {
|
|
2854
|
-
if (amount === void 0) { amount = 10; }
|
|
2855
|
-
var hsl = this.toHsl();
|
|
2856
|
-
hsl.s += amount / 100;
|
|
2857
|
-
hsl.s = clamp01(hsl.s);
|
|
2858
|
-
return new TinyColor(hsl);
|
|
2859
|
-
};
|
|
2860
|
-
/**
|
|
2861
|
-
* Completely desaturates a color into greyscale.
|
|
2862
|
-
* Same as calling `desaturate(100)`
|
|
2863
|
-
*/
|
|
2864
|
-
TinyColor.prototype.greyscale = function () {
|
|
2865
|
-
return this.desaturate(100);
|
|
2866
|
-
};
|
|
2867
|
-
/**
|
|
2868
|
-
* Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
|
|
2869
|
-
* Values outside of this range will be wrapped into this range.
|
|
2870
|
-
*/
|
|
2871
|
-
TinyColor.prototype.spin = function (amount) {
|
|
2872
|
-
var hsl = this.toHsl();
|
|
2873
|
-
var hue = (hsl.h + amount) % 360;
|
|
2874
|
-
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
2875
|
-
return new TinyColor(hsl);
|
|
2876
|
-
};
|
|
2877
|
-
/**
|
|
2878
|
-
* Mix the current color a given amount with another color, from 0 to 100.
|
|
2879
|
-
* 0 means no mixing (return current color).
|
|
2880
|
-
*/
|
|
2881
|
-
TinyColor.prototype.mix = function (color, amount) {
|
|
2882
|
-
if (amount === void 0) { amount = 50; }
|
|
2883
|
-
var rgb1 = this.toRgb();
|
|
2884
|
-
var rgb2 = new TinyColor(color).toRgb();
|
|
2885
|
-
var p = amount / 100;
|
|
2886
|
-
var rgba = {
|
|
2887
|
-
r: (rgb2.r - rgb1.r) * p + rgb1.r,
|
|
2888
|
-
g: (rgb2.g - rgb1.g) * p + rgb1.g,
|
|
2889
|
-
b: (rgb2.b - rgb1.b) * p + rgb1.b,
|
|
2890
|
-
a: (rgb2.a - rgb1.a) * p + rgb1.a,
|
|
2891
|
-
};
|
|
2892
|
-
return new TinyColor(rgba);
|
|
2893
|
-
};
|
|
2894
|
-
TinyColor.prototype.analogous = function (results, slices) {
|
|
2895
|
-
if (results === void 0) { results = 6; }
|
|
2896
|
-
if (slices === void 0) { slices = 30; }
|
|
2897
|
-
var hsl = this.toHsl();
|
|
2898
|
-
var part = 360 / slices;
|
|
2899
|
-
var ret = [this];
|
|
2900
|
-
for (hsl.h = (hsl.h - ((part * results) >> 1) + 720) % 360; --results;) {
|
|
2901
|
-
hsl.h = (hsl.h + part) % 360;
|
|
2902
|
-
ret.push(new TinyColor(hsl));
|
|
2903
|
-
}
|
|
2904
|
-
return ret;
|
|
2905
|
-
};
|
|
2906
|
-
/**
|
|
2907
|
-
* taken from https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js
|
|
2908
|
-
*/
|
|
2909
|
-
TinyColor.prototype.complement = function () {
|
|
2910
|
-
var hsl = this.toHsl();
|
|
2911
|
-
hsl.h = (hsl.h + 180) % 360;
|
|
2912
|
-
return new TinyColor(hsl);
|
|
2913
|
-
};
|
|
2914
|
-
TinyColor.prototype.monochromatic = function (results) {
|
|
2915
|
-
if (results === void 0) { results = 6; }
|
|
2916
|
-
var hsv = this.toHsv();
|
|
2917
|
-
var h = hsv.h;
|
|
2918
|
-
var s = hsv.s;
|
|
2919
|
-
var v = hsv.v;
|
|
2920
|
-
var res = [];
|
|
2921
|
-
var modification = 1 / results;
|
|
2922
|
-
while (results--) {
|
|
2923
|
-
res.push(new TinyColor({ h: h, s: s, v: v }));
|
|
2924
|
-
v = (v + modification) % 1;
|
|
2925
|
-
}
|
|
2926
|
-
return res;
|
|
2927
|
-
};
|
|
2928
|
-
TinyColor.prototype.splitcomplement = function () {
|
|
2929
|
-
var hsl = this.toHsl();
|
|
2930
|
-
var h = hsl.h;
|
|
2931
|
-
return [
|
|
2932
|
-
this,
|
|
2933
|
-
new TinyColor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
|
|
2934
|
-
new TinyColor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l }),
|
|
2935
|
-
];
|
|
2936
|
-
};
|
|
2937
|
-
/**
|
|
2938
|
-
* Compute how the color would appear on a background
|
|
2939
|
-
*/
|
|
2940
|
-
TinyColor.prototype.onBackground = function (background) {
|
|
2941
|
-
var fg = this.toRgb();
|
|
2942
|
-
var bg = new TinyColor(background).toRgb();
|
|
2943
|
-
var alpha = fg.a + bg.a * (1 - fg.a);
|
|
2944
|
-
return new TinyColor({
|
|
2945
|
-
r: (fg.r * fg.a + bg.r * bg.a * (1 - fg.a)) / alpha,
|
|
2946
|
-
g: (fg.g * fg.a + bg.g * bg.a * (1 - fg.a)) / alpha,
|
|
2947
|
-
b: (fg.b * fg.a + bg.b * bg.a * (1 - fg.a)) / alpha,
|
|
2948
|
-
a: alpha,
|
|
2949
|
-
});
|
|
2950
|
-
};
|
|
2951
|
-
/**
|
|
2952
|
-
* Alias for `polyad(3)`
|
|
2953
|
-
*/
|
|
2954
|
-
TinyColor.prototype.triad = function () {
|
|
2955
|
-
return this.polyad(3);
|
|
2956
|
-
};
|
|
2957
|
-
/**
|
|
2958
|
-
* Alias for `polyad(4)`
|
|
2959
|
-
*/
|
|
2960
|
-
TinyColor.prototype.tetrad = function () {
|
|
2961
|
-
return this.polyad(4);
|
|
2962
|
-
};
|
|
2963
|
-
/**
|
|
2964
|
-
* Get polyad colors, like (for 1, 2, 3, 4, 5, 6, 7, 8, etc...)
|
|
2965
|
-
* monad, dyad, triad, tetrad, pentad, hexad, heptad, octad, etc...
|
|
2966
|
-
*/
|
|
2967
|
-
TinyColor.prototype.polyad = function (n) {
|
|
2968
|
-
var hsl = this.toHsl();
|
|
2969
|
-
var h = hsl.h;
|
|
2970
|
-
var result = [this];
|
|
2971
|
-
var increment = 360 / n;
|
|
2972
|
-
for (var i = 1; i < n; i++) {
|
|
2973
|
-
result.push(new TinyColor({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
|
|
2974
|
-
}
|
|
2975
|
-
return result;
|
|
2976
|
-
};
|
|
2977
|
-
/**
|
|
2978
|
-
* compare color vs current color
|
|
2979
|
-
*/
|
|
2980
|
-
TinyColor.prototype.equals = function (color) {
|
|
2981
|
-
return this.toRgbString() === new TinyColor(color).toRgbString();
|
|
2982
|
-
};
|
|
2983
|
-
return TinyColor;
|
|
2984
|
-
}());
|
|
2985
|
-
|
|
2986
|
-
function darken(color, amount = 20) {
|
|
2987
|
-
return color.mix("#141414", amount).toString();
|
|
2988
|
-
}
|
|
2989
|
-
function useButtonCustomStyle(props) {
|
|
2990
|
-
const _disabled = useFormDisabled();
|
|
2991
|
-
const ns = useNamespace("button");
|
|
2992
|
-
return computed(() => {
|
|
2993
|
-
let styles = {};
|
|
2994
|
-
const buttonColor = props.color;
|
|
2995
|
-
if (buttonColor) {
|
|
2996
|
-
const color = new TinyColor(buttonColor);
|
|
2997
|
-
const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
|
|
2998
|
-
if (props.plain) {
|
|
2999
|
-
styles = ns.cssVarBlock({
|
|
3000
|
-
"bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
|
|
3001
|
-
"text-color": buttonColor,
|
|
3002
|
-
"border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
|
|
3003
|
-
"hover-text-color": `var(${ns.cssVarName("color-white")})`,
|
|
3004
|
-
"hover-bg-color": buttonColor,
|
|
3005
|
-
"hover-border-color": buttonColor,
|
|
3006
|
-
"active-bg-color": activeBgColor,
|
|
3007
|
-
"active-text-color": `var(${ns.cssVarName("color-white")})`,
|
|
3008
|
-
"active-border-color": activeBgColor
|
|
3009
|
-
});
|
|
3010
|
-
if (_disabled.value) {
|
|
3011
|
-
styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString();
|
|
3012
|
-
styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString();
|
|
3013
|
-
styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString();
|
|
3014
|
-
}
|
|
3015
|
-
} else {
|
|
3016
|
-
const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
|
|
3017
|
-
const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
|
|
3018
|
-
styles = ns.cssVarBlock({
|
|
3019
|
-
"bg-color": buttonColor,
|
|
3020
|
-
"text-color": textColor,
|
|
3021
|
-
"border-color": buttonColor,
|
|
3022
|
-
"hover-bg-color": hoverBgColor,
|
|
3023
|
-
"hover-text-color": textColor,
|
|
3024
|
-
"hover-border-color": hoverBgColor,
|
|
3025
|
-
"active-bg-color": activeBgColor,
|
|
3026
|
-
"active-border-color": activeBgColor
|
|
3027
|
-
});
|
|
3028
|
-
if (_disabled.value) {
|
|
3029
|
-
const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
|
|
3030
|
-
styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
|
|
3031
|
-
styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
|
|
3032
|
-
styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
|
|
3033
|
-
}
|
|
3034
|
-
}
|
|
3035
|
-
}
|
|
3036
|
-
return styles;
|
|
3037
|
-
});
|
|
3038
|
-
}
|
|
3039
|
-
|
|
3040
|
-
const __default__$4 = defineComponent({
|
|
3041
|
-
name: "ElButton"
|
|
3042
|
-
});
|
|
3043
|
-
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
3044
|
-
...__default__$4,
|
|
3045
|
-
props: buttonProps,
|
|
3046
|
-
emits: buttonEmits,
|
|
3047
|
-
setup(__props, { expose, emit }) {
|
|
3048
|
-
const props = __props;
|
|
3049
|
-
const buttonStyle = useButtonCustomStyle(props);
|
|
3050
|
-
const ns = useNamespace("button");
|
|
3051
|
-
const { _ref, _size, _type, _disabled, _props, shouldAddSpace, handleClick } = useButton(props, emit);
|
|
3052
|
-
expose({
|
|
3053
|
-
ref: _ref,
|
|
3054
|
-
size: _size,
|
|
3055
|
-
type: _type,
|
|
3056
|
-
disabled: _disabled,
|
|
3057
|
-
shouldAddSpace
|
|
3058
|
-
});
|
|
3059
|
-
return (_ctx, _cache) => {
|
|
3060
|
-
return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), mergeProps({
|
|
3061
|
-
ref_key: "_ref",
|
|
3062
|
-
ref: _ref
|
|
3063
|
-
}, unref(_props), {
|
|
3064
|
-
class: [
|
|
3065
|
-
unref(ns).b(),
|
|
3066
|
-
unref(ns).m(unref(_type)),
|
|
3067
|
-
unref(ns).m(unref(_size)),
|
|
3068
|
-
unref(ns).is("disabled", unref(_disabled)),
|
|
3069
|
-
unref(ns).is("loading", _ctx.loading),
|
|
3070
|
-
unref(ns).is("plain", _ctx.plain),
|
|
3071
|
-
unref(ns).is("round", _ctx.round),
|
|
3072
|
-
unref(ns).is("circle", _ctx.circle),
|
|
3073
|
-
unref(ns).is("text", _ctx.text),
|
|
3074
|
-
unref(ns).is("link", _ctx.link),
|
|
3075
|
-
unref(ns).is("has-bg", _ctx.bg)
|
|
3076
|
-
],
|
|
3077
|
-
style: unref(buttonStyle),
|
|
3078
|
-
onClick: unref(handleClick)
|
|
3079
|
-
}), {
|
|
3080
|
-
default: withCtx(() => [
|
|
3081
|
-
_ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
3082
|
-
_ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
|
|
3083
|
-
key: 1,
|
|
3084
|
-
class: normalizeClass(unref(ns).is("loading"))
|
|
3085
|
-
}, {
|
|
3086
|
-
default: withCtx(() => [
|
|
3087
|
-
(openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
|
|
3088
|
-
]),
|
|
3089
|
-
_: 1
|
|
3090
|
-
}, 8, ["class"]))
|
|
3091
|
-
], 64)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
|
|
3092
|
-
default: withCtx(() => [
|
|
3093
|
-
_ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
|
|
3094
|
-
]),
|
|
3095
|
-
_: 3
|
|
3096
|
-
})) : createCommentVNode("v-if", true),
|
|
3097
|
-
_ctx.$slots.default ? (openBlock(), createElementBlock("span", {
|
|
3098
|
-
key: 2,
|
|
3099
|
-
class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
|
|
3100
|
-
}, [
|
|
3101
|
-
renderSlot(_ctx.$slots, "default")
|
|
3102
|
-
], 2)) : createCommentVNode("v-if", true)
|
|
3103
|
-
]),
|
|
3104
|
-
_: 3
|
|
3105
|
-
}, 16, ["class", "style", "onClick"]);
|
|
3106
|
-
};
|
|
3107
|
-
}
|
|
3108
|
-
});
|
|
3109
|
-
var Button = /* @__PURE__ */ _export_sfc$1(_sfc_main$4, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button.vue"]]);
|
|
3110
|
-
|
|
3111
|
-
const buttonGroupProps = {
|
|
3112
|
-
size: buttonProps.size,
|
|
3113
|
-
type: buttonProps.type
|
|
3114
|
-
};
|
|
3115
|
-
|
|
3116
|
-
const __default__$3 = defineComponent({
|
|
3117
|
-
name: "ElButtonGroup"
|
|
3118
|
-
});
|
|
3119
|
-
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
3120
|
-
...__default__$3,
|
|
3121
|
-
props: buttonGroupProps,
|
|
3122
|
-
setup(__props) {
|
|
3123
|
-
const props = __props;
|
|
3124
|
-
provide(buttonGroupContextKey, reactive({
|
|
3125
|
-
size: toRef(props, "size"),
|
|
3126
|
-
type: toRef(props, "type")
|
|
3127
|
-
}));
|
|
3128
|
-
const ns = useNamespace("button");
|
|
3129
|
-
return (_ctx, _cache) => {
|
|
3130
|
-
return openBlock(), createElementBlock("div", {
|
|
3131
|
-
class: normalizeClass(`${unref(ns).b("group")}`)
|
|
3132
|
-
}, [
|
|
3133
|
-
renderSlot(_ctx.$slots, "default")
|
|
3134
|
-
], 2);
|
|
3135
|
-
};
|
|
3136
|
-
}
|
|
3137
|
-
});
|
|
3138
|
-
var ButtonGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$3, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button-group.vue"]]);
|
|
3139
|
-
|
|
3140
|
-
const ElButton = withInstall(Button, {
|
|
3141
|
-
ButtonGroup
|
|
3142
|
-
});
|
|
3143
|
-
const ElButtonGroup = withNoopInstall(ButtonGroup);
|
|
1
|
+
import { withInstall } from '@das-fed/utils';
|
|
2
|
+
import { defineComponent, ref, computed, watch, nextTick, openBlock, createElementBlock, normalizeClass, Fragment, renderList, createElementVNode, toDisplayString, renderSlot, createCommentVNode, normalizeStyle, onMounted, onBeforeUnmount, createVNode, createSlots, withCtx, normalizeProps, mergeProps, guardReactiveProps, createBlock } from 'vue';
|
|
3
|
+
import { t, setI18nRule, setThemeRule } from '@das-fed/web';
|
|
4
|
+
import { SizeWatcher } from '@das-fed/utils/size-watcher';
|
|
3144
5
|
|
|
3145
6
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
3146
7
|
|
|
@@ -3157,8 +18,49 @@ var dayjs_min = {exports: {}};
|
|
|
3157
18
|
var dayjs_minExports = dayjs_min.exports;
|
|
3158
19
|
var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
|
|
3159
20
|
|
|
21
|
+
const adjacentMonth = (start, end) => {
|
|
22
|
+
const firstMonthLastDay = start.endOf("month");
|
|
23
|
+
const lastMonthFirstDay = end.startOf("month");
|
|
24
|
+
const isSameWeek = firstMonthLastDay.isSame(lastMonthFirstDay, "week");
|
|
25
|
+
const lastMonthStartDay = isSameWeek ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
|
|
26
|
+
return [
|
|
27
|
+
[start, firstMonthLastDay],
|
|
28
|
+
[lastMonthStartDay.startOf("week"), end]
|
|
29
|
+
];
|
|
30
|
+
};
|
|
31
|
+
const threeConsecutiveMonth = (start, end) => {
|
|
32
|
+
const firstMonthLastDay = start.endOf("month");
|
|
33
|
+
const secondMonthFirstDay = start.add(1, "month").startOf("month");
|
|
34
|
+
const secondMonthStartDay = firstMonthLastDay.isSame(
|
|
35
|
+
secondMonthFirstDay,
|
|
36
|
+
"week"
|
|
37
|
+
) ? secondMonthFirstDay.add(1, "week") : secondMonthFirstDay;
|
|
38
|
+
const secondMonthLastDay = secondMonthStartDay.endOf("month");
|
|
39
|
+
const lastMonthFirstDay = end.startOf("month");
|
|
40
|
+
const lastMonthStartDay = secondMonthLastDay.isSame(lastMonthFirstDay, "week") ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
|
|
41
|
+
return [
|
|
42
|
+
[start, firstMonthLastDay],
|
|
43
|
+
[secondMonthStartDay.startOf("week"), secondMonthLastDay],
|
|
44
|
+
[lastMonthStartDay.startOf("week"), end]
|
|
45
|
+
];
|
|
46
|
+
};
|
|
47
|
+
const calculateValidatedDateRange = (startDayjs, endDayjs) => {
|
|
48
|
+
const firstDay = startDayjs.startOf("week");
|
|
49
|
+
const lastDay = endDayjs.endOf("week");
|
|
50
|
+
const firstMonth = firstDay.get("month");
|
|
51
|
+
const lastMonth = lastDay.get("month");
|
|
52
|
+
if (firstMonth === lastMonth) {
|
|
53
|
+
return [[firstDay, lastDay]];
|
|
54
|
+
} else if ((firstMonth + 1) % 12 === lastMonth) {
|
|
55
|
+
return adjacentMonth(firstDay, lastDay);
|
|
56
|
+
} else if (firstMonth + 2 === lastMonth || (firstMonth + 1) % 11 === lastMonth) {
|
|
57
|
+
return threeConsecutiveMonth(firstDay, lastDay);
|
|
58
|
+
} else {
|
|
59
|
+
console.warn("start time and end time interval must not exceed two months");
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
};
|
|
3160
63
|
const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
|
|
3161
|
-
|
|
3162
64
|
const getPrevMonthLastDays = (date, count) => {
|
|
3163
65
|
const lastDay = date.subtract(1, "month").endOf("month").date();
|
|
3164
66
|
return rangeArr(count).map((_, index) => lastDay - (count - index - 1));
|
|
@@ -3171,24 +73,6 @@ const toNestedArr = (days) => rangeArr(days.length / 7).map((index) => {
|
|
|
3171
73
|
const start = index * 7;
|
|
3172
74
|
return days.slice(start, start + 7);
|
|
3173
75
|
});
|
|
3174
|
-
const dateTableProps = buildProps({
|
|
3175
|
-
selectedDay: {
|
|
3176
|
-
type: definePropType(Object)
|
|
3177
|
-
},
|
|
3178
|
-
range: {
|
|
3179
|
-
type: definePropType(Array)
|
|
3180
|
-
},
|
|
3181
|
-
date: {
|
|
3182
|
-
type: definePropType(Object),
|
|
3183
|
-
required: true
|
|
3184
|
-
},
|
|
3185
|
-
hideHeader: {
|
|
3186
|
-
type: Boolean
|
|
3187
|
-
}
|
|
3188
|
-
});
|
|
3189
|
-
const dateTableEmits = {
|
|
3190
|
-
pick: (value) => isObject$1(value)
|
|
3191
|
-
};
|
|
3192
76
|
|
|
3193
77
|
var localeData$1 = {exports: {}};
|
|
3194
78
|
|
|
@@ -3199,769 +83,611 @@ var localeData$1 = {exports: {}};
|
|
|
3199
83
|
var localeDataExports = localeData$1.exports;
|
|
3200
84
|
var localeData = /*@__PURE__*/getDefaultExportFromCjs(localeDataExports);
|
|
3201
85
|
|
|
3202
|
-
const
|
|
3203
|
-
|
|
3204
|
-
const firstDayOfWeek = dayjs.localeData().firstDayOfWeek();
|
|
3205
|
-
const { t, lang } = useLocale();
|
|
3206
|
-
const now = dayjs().locale(lang.value);
|
|
3207
|
-
const isInRange = computed(() => !!props.range && !!props.range.length);
|
|
3208
|
-
const rows = computed(() => {
|
|
3209
|
-
let days = [];
|
|
3210
|
-
if (isInRange.value) {
|
|
3211
|
-
const [start, end] = props.range;
|
|
3212
|
-
const currentMonthRange = rangeArr(end.date() - start.date() + 1).map((index) => ({
|
|
3213
|
-
text: start.date() + index,
|
|
3214
|
-
type: "current"
|
|
3215
|
-
}));
|
|
3216
|
-
let remaining = currentMonthRange.length % 7;
|
|
3217
|
-
remaining = remaining === 0 ? 0 : 7 - remaining;
|
|
3218
|
-
const nextMonthRange = rangeArr(remaining).map((_, index) => ({
|
|
3219
|
-
text: index + 1,
|
|
3220
|
-
type: "next"
|
|
3221
|
-
}));
|
|
3222
|
-
days = currentMonthRange.concat(nextMonthRange);
|
|
3223
|
-
} else {
|
|
3224
|
-
const firstDay = props.date.startOf("month").day();
|
|
3225
|
-
const prevMonthDays = getPrevMonthLastDays(props.date, (firstDay - firstDayOfWeek + 7) % 7).map((day) => ({
|
|
3226
|
-
text: day,
|
|
3227
|
-
type: "prev"
|
|
3228
|
-
}));
|
|
3229
|
-
const currentMonthDays = getMonthDays(props.date).map((day) => ({
|
|
3230
|
-
text: day,
|
|
3231
|
-
type: "current"
|
|
3232
|
-
}));
|
|
3233
|
-
days = [...prevMonthDays, ...currentMonthDays];
|
|
3234
|
-
const remaining = 7 - (days.length % 7 || 7);
|
|
3235
|
-
const nextMonthDays = rangeArr(remaining).map((_, index) => ({
|
|
3236
|
-
text: index + 1,
|
|
3237
|
-
type: "next"
|
|
3238
|
-
}));
|
|
3239
|
-
days = days.concat(nextMonthDays);
|
|
3240
|
-
}
|
|
3241
|
-
return toNestedArr(days);
|
|
3242
|
-
});
|
|
3243
|
-
const weekDays = computed(() => {
|
|
3244
|
-
const start = firstDayOfWeek;
|
|
3245
|
-
if (start === 0) {
|
|
3246
|
-
return WEEK_DAYS.map((_) => t(`el.datepicker.weeks.${_}`));
|
|
3247
|
-
} else {
|
|
3248
|
-
return WEEK_DAYS.slice(start).concat(WEEK_DAYS.slice(0, start)).map((_) => t(`el.datepicker.weeks.${_}`));
|
|
3249
|
-
}
|
|
3250
|
-
});
|
|
3251
|
-
const getFormattedDate = (day, type) => {
|
|
3252
|
-
switch (type) {
|
|
3253
|
-
case "prev":
|
|
3254
|
-
return props.date.startOf("month").subtract(1, "month").date(day);
|
|
3255
|
-
case "next":
|
|
3256
|
-
return props.date.startOf("month").add(1, "month").date(day);
|
|
3257
|
-
case "current":
|
|
3258
|
-
return props.date.date(day);
|
|
3259
|
-
}
|
|
3260
|
-
};
|
|
3261
|
-
const handlePickDay = ({ text, type }) => {
|
|
3262
|
-
const date = getFormattedDate(text, type);
|
|
3263
|
-
emit("pick", date);
|
|
3264
|
-
};
|
|
3265
|
-
const getSlotData = ({ text, type }) => {
|
|
3266
|
-
const day = getFormattedDate(text, type);
|
|
3267
|
-
return {
|
|
3268
|
-
isSelected: day.isSame(props.selectedDay),
|
|
3269
|
-
type: `${type}-month`,
|
|
3270
|
-
day: day.format("YYYY-MM-DD"),
|
|
3271
|
-
date: day.toDate()
|
|
3272
|
-
};
|
|
3273
|
-
};
|
|
3274
|
-
return {
|
|
3275
|
-
now,
|
|
3276
|
-
isInRange,
|
|
3277
|
-
rows,
|
|
3278
|
-
weekDays,
|
|
3279
|
-
getFormattedDate,
|
|
3280
|
-
handlePickDay,
|
|
3281
|
-
getSlotData
|
|
3282
|
-
};
|
|
86
|
+
const __default__$1 = {
|
|
87
|
+
name: "calendar-table"
|
|
3283
88
|
};
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
}
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
89
|
+
var _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
90
|
+
...__default__$1,
|
|
91
|
+
props: {
|
|
92
|
+
selectedDay: { type: null, required: false },
|
|
93
|
+
date: { type: null, required: true },
|
|
94
|
+
firstDayOfWeek: { type: Number, required: true },
|
|
95
|
+
range: { type: Array, required: false },
|
|
96
|
+
hideHeader: { type: Boolean, required: false },
|
|
97
|
+
parent: { type: null, required: true },
|
|
98
|
+
calendartType: { type: String, required: false },
|
|
99
|
+
highlightWeek: { type: Boolean, required: false },
|
|
100
|
+
highlightDay: { type: Boolean, required: false },
|
|
101
|
+
showZhou: { type: Boolean, required: false },
|
|
102
|
+
cellHeight: { type: Number, required: false }
|
|
103
|
+
},
|
|
104
|
+
emits: ["pick"],
|
|
105
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
106
|
+
const emit = __emit;
|
|
107
|
+
const now = dayjs();
|
|
3295
108
|
const props = __props;
|
|
3296
|
-
const
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
109
|
+
const trHeight = ref("128px");
|
|
110
|
+
const tableRef = ref();
|
|
111
|
+
const tHeadHeight = 60;
|
|
112
|
+
const WEEK_DAYS = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
|
|
113
|
+
const isInRange = computed(() => !!props.range && !!props.range.length);
|
|
114
|
+
const weekDays = computed(() => {
|
|
115
|
+
const start = props.firstDayOfWeek;
|
|
116
|
+
const str = props.showZhou ? `das-calendar-weeks-zhou-` : `das-calendar-weeks-`;
|
|
117
|
+
if (start === 0) {
|
|
118
|
+
return WEEK_DAYS.map((_) => t(`${str}${_}`));
|
|
119
|
+
} else {
|
|
120
|
+
return WEEK_DAYS.slice(start).concat(WEEK_DAYS.slice(0, start)).map((_) => t(`${str}${_}`));
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
const rows = computed(() => {
|
|
124
|
+
let days = [];
|
|
125
|
+
if (isInRange.value) {
|
|
126
|
+
const [start, end] = props.range;
|
|
127
|
+
let currentMonthRange = [];
|
|
128
|
+
if (start.isSame(end, "month")) {
|
|
129
|
+
currentMonthRange = rangeArr(end.date() - start.date() + 1).map((index) => ({
|
|
130
|
+
text: start.date() + index,
|
|
131
|
+
type: "current"
|
|
132
|
+
}));
|
|
133
|
+
} else {
|
|
134
|
+
currentMonthRange = rangeArr(start.endOf("month").date() - start.date() + 1).map((index) => ({
|
|
135
|
+
text: start.date() + index,
|
|
136
|
+
type: "current"
|
|
137
|
+
}));
|
|
138
|
+
}
|
|
139
|
+
let remaining = currentMonthRange.length % 7;
|
|
140
|
+
remaining = remaining === 0 ? 0 : 7 - remaining;
|
|
141
|
+
const nextMonthRange = rangeArr(remaining).map((_, index) => ({
|
|
142
|
+
text: index + 1,
|
|
143
|
+
type: "next"
|
|
144
|
+
}));
|
|
145
|
+
days = currentMonthRange.concat(nextMonthRange);
|
|
146
|
+
} else {
|
|
147
|
+
const firstDay = props.date.startOf("month").day();
|
|
148
|
+
const prevMonthDays = getPrevMonthLastDays(
|
|
149
|
+
props.date,
|
|
150
|
+
(firstDay - props.firstDayOfWeek + 7) % 7
|
|
151
|
+
).map((day) => ({
|
|
152
|
+
text: day,
|
|
153
|
+
type: "prev"
|
|
154
|
+
}));
|
|
155
|
+
const currentMonthDays = getMonthDays(props.date).map((day) => ({
|
|
156
|
+
text: day,
|
|
157
|
+
type: "current"
|
|
158
|
+
}));
|
|
159
|
+
days = [...prevMonthDays, ...currentMonthDays];
|
|
160
|
+
const remaining = 7 - (days.length % 7 || 7);
|
|
161
|
+
const nextMonthDays = rangeArr(remaining).map((_, index) => ({
|
|
162
|
+
text: index + 1,
|
|
163
|
+
type: "next"
|
|
164
|
+
}));
|
|
165
|
+
days = days.concat(nextMonthDays);
|
|
166
|
+
if (props.calendartType == "simple" && days.length / 7 < 6) {
|
|
167
|
+
const num = nextMonthDays.length ? nextMonthDays[nextMonthDays.length - 1].text : 0;
|
|
168
|
+
const nextMonthWeekDays = rangeArr(7).map((_, index) => ({
|
|
169
|
+
text: num + index + 1,
|
|
170
|
+
type: "next"
|
|
171
|
+
}));
|
|
172
|
+
days = days.concat(nextMonthWeekDays);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return toNestedArr(days);
|
|
176
|
+
});
|
|
177
|
+
watch(
|
|
178
|
+
() => rows.value,
|
|
179
|
+
(val) => {
|
|
180
|
+
if (props.cellHeight) {
|
|
181
|
+
trHeight.value = `${props.cellHeight}px`;
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
if (val && val.length) {
|
|
185
|
+
nextTick(() => {
|
|
186
|
+
const tableHeight = props.parent?.offsetHeight;
|
|
187
|
+
let height = Number(tableHeight) - tHeadHeight - 1;
|
|
188
|
+
trHeight.value = height / val.length - 1 + "px";
|
|
189
|
+
console.log("trHeight1", trHeight.value, height, val.length);
|
|
190
|
+
});
|
|
191
|
+
} else {
|
|
192
|
+
trHeight.value = "128px";
|
|
193
|
+
}
|
|
194
|
+
console.log("trHeight2", trHeight.value);
|
|
195
|
+
},
|
|
196
|
+
{ immediate: true }
|
|
197
|
+
);
|
|
198
|
+
const getHeight = () => {
|
|
199
|
+
console.log("getHeight", rows.value, props.cellHeight);
|
|
200
|
+
if (props.cellHeight) {
|
|
201
|
+
trHeight.value = `${props.cellHeight}px`;
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
nextTick(() => {
|
|
205
|
+
const tableHeight = props.parent?.offsetHeight;
|
|
206
|
+
let height = Number(tableHeight) - tHeadHeight;
|
|
207
|
+
console.log("height", tableHeight, height);
|
|
208
|
+
trHeight.value = height / rows.value.length - 1 * rows.value.length + "px";
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
const getFormattedDate = (day, type) => {
|
|
212
|
+
switch (type) {
|
|
213
|
+
case "prev":
|
|
214
|
+
return props.date.startOf("month").subtract(1, "month").date(day);
|
|
215
|
+
case "next":
|
|
216
|
+
return props.date.startOf("month").add(1, "month").date(day);
|
|
217
|
+
case "current":
|
|
218
|
+
return props.date.date(day);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
3307
221
|
const getCellClass = ({ text, type }) => {
|
|
3308
222
|
const classes = [type];
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
223
|
+
const date = getFormattedDate(text, type);
|
|
224
|
+
if (date.isSame(props.selectedDay, "day")) {
|
|
225
|
+
classes.push("is-selected");
|
|
226
|
+
}
|
|
227
|
+
if (date.isSame(now, "day")) {
|
|
228
|
+
classes.push("is-today");
|
|
229
|
+
}
|
|
230
|
+
return classes;
|
|
231
|
+
};
|
|
232
|
+
const handlePickDay = ({ text, type }) => {
|
|
233
|
+
const date = getFormattedDate(text, type);
|
|
234
|
+
emit("pick", date);
|
|
235
|
+
};
|
|
236
|
+
const getWeekDay = (index) => {
|
|
237
|
+
const row = rows.value[0];
|
|
238
|
+
if (row) {
|
|
239
|
+
const currentDay = row[index];
|
|
240
|
+
if (currentDay) {
|
|
241
|
+
const { text, type } = currentDay;
|
|
242
|
+
const day = getFormattedDate(text, type);
|
|
243
|
+
return day.format("MM/DD");
|
|
3313
244
|
}
|
|
3314
|
-
|
|
3315
|
-
|
|
245
|
+
}
|
|
246
|
+
return "";
|
|
247
|
+
};
|
|
248
|
+
const getWeekSlotData = (index) => {
|
|
249
|
+
const row = rows.value[0];
|
|
250
|
+
if (row) {
|
|
251
|
+
const currentDay = row[index];
|
|
252
|
+
if (currentDay) {
|
|
253
|
+
const { text, type } = currentDay;
|
|
254
|
+
const day = getFormattedDate(text, type);
|
|
255
|
+
return {
|
|
256
|
+
isSelected: day.isSame(props.selectedDay),
|
|
257
|
+
type: `${type}-month`,
|
|
258
|
+
day: day.format("YYYY-MM-DD"),
|
|
259
|
+
date: day.toDate()
|
|
260
|
+
};
|
|
3316
261
|
}
|
|
3317
262
|
}
|
|
3318
|
-
return
|
|
263
|
+
return {
|
|
264
|
+
isSelected: null,
|
|
265
|
+
type: null,
|
|
266
|
+
day: null,
|
|
267
|
+
date: null
|
|
268
|
+
};
|
|
3319
269
|
};
|
|
3320
|
-
|
|
3321
|
-
getFormattedDate
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
}, [
|
|
3329
|
-
!_ctx.hideHeader ? (openBlock(), createElementBlock("thead", _hoisted_1$1, [
|
|
3330
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(weekDays), (day) => {
|
|
3331
|
-
return openBlock(), createElementBlock("th", { key: day }, toDisplayString(day), 1);
|
|
3332
|
-
}), 128))
|
|
3333
|
-
])) : createCommentVNode("v-if", true),
|
|
3334
|
-
createElementVNode("tbody", null, [
|
|
3335
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, index) => {
|
|
3336
|
-
return openBlock(), createElementBlock("tr", {
|
|
3337
|
-
key: index,
|
|
3338
|
-
class: normalizeClass({
|
|
3339
|
-
[unref(nsTable).e("row")]: true,
|
|
3340
|
-
[unref(nsTable).em("row", "hide-border")]: index === 0 && _ctx.hideHeader
|
|
3341
|
-
})
|
|
3342
|
-
}, [
|
|
3343
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key) => {
|
|
3344
|
-
return openBlock(), createElementBlock("td", {
|
|
3345
|
-
key,
|
|
3346
|
-
class: normalizeClass(getCellClass(cell)),
|
|
3347
|
-
onClick: ($event) => unref(handlePickDay)(cell)
|
|
3348
|
-
}, [
|
|
3349
|
-
createElementVNode("div", {
|
|
3350
|
-
class: normalizeClass(unref(nsDay).b())
|
|
3351
|
-
}, [
|
|
3352
|
-
renderSlot(_ctx.$slots, "date-cell", {
|
|
3353
|
-
data: unref(getSlotData)(cell)
|
|
3354
|
-
}, () => [
|
|
3355
|
-
createElementVNode("span", null, toDisplayString(cell.text), 1)
|
|
3356
|
-
])
|
|
3357
|
-
], 2)
|
|
3358
|
-
], 10, _hoisted_2$1);
|
|
3359
|
-
}), 128))
|
|
3360
|
-
], 2);
|
|
3361
|
-
}), 128))
|
|
3362
|
-
])
|
|
3363
|
-
], 2);
|
|
270
|
+
const getSlotData = ({ text, type }) => {
|
|
271
|
+
const day = getFormattedDate(text, type);
|
|
272
|
+
return {
|
|
273
|
+
isSelected: day.isSame(props.selectedDay),
|
|
274
|
+
type: `${type}-month`,
|
|
275
|
+
day: day.format("YYYY-MM-DD"),
|
|
276
|
+
date: day.toDate()
|
|
277
|
+
};
|
|
3364
278
|
};
|
|
279
|
+
__expose({
|
|
280
|
+
getHeight
|
|
281
|
+
});
|
|
282
|
+
const __returned__ = { emit, now, props, trHeight, tableRef, tHeadHeight, WEEK_DAYS, isInRange, weekDays, rows, getHeight, getFormattedDate, getCellClass, handlePickDay, getWeekDay, getWeekSlotData, getSlotData };
|
|
283
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
284
|
+
return __returned__;
|
|
3365
285
|
}
|
|
3366
286
|
});
|
|
3367
|
-
var DateTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$2, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/calendar/src/date-table.vue"]]);
|
|
3368
|
-
|
|
3369
|
-
const adjacentMonth = (start, end) => {
|
|
3370
|
-
const firstMonthLastDay = start.endOf("month");
|
|
3371
|
-
const lastMonthFirstDay = end.startOf("month");
|
|
3372
|
-
const isSameWeek = firstMonthLastDay.isSame(lastMonthFirstDay, "week");
|
|
3373
|
-
const lastMonthStartDay = isSameWeek ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
|
|
3374
|
-
return [
|
|
3375
|
-
[start, firstMonthLastDay],
|
|
3376
|
-
[lastMonthStartDay.startOf("week"), end]
|
|
3377
|
-
];
|
|
3378
|
-
};
|
|
3379
|
-
const threeConsecutiveMonth = (start, end) => {
|
|
3380
|
-
const firstMonthLastDay = start.endOf("month");
|
|
3381
|
-
const secondMonthFirstDay = start.add(1, "month").startOf("month");
|
|
3382
|
-
const secondMonthStartDay = firstMonthLastDay.isSame(secondMonthFirstDay, "week") ? secondMonthFirstDay.add(1, "week") : secondMonthFirstDay;
|
|
3383
|
-
const secondMonthLastDay = secondMonthStartDay.endOf("month");
|
|
3384
|
-
const lastMonthFirstDay = end.startOf("month");
|
|
3385
|
-
const lastMonthStartDay = secondMonthLastDay.isSame(lastMonthFirstDay, "week") ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
|
|
3386
|
-
return [
|
|
3387
|
-
[start, firstMonthLastDay],
|
|
3388
|
-
[secondMonthStartDay.startOf("week"), secondMonthLastDay],
|
|
3389
|
-
[lastMonthStartDay.startOf("week"), end]
|
|
3390
|
-
];
|
|
3391
|
-
};
|
|
3392
|
-
const useCalendar = (props, emit, componentName) => {
|
|
3393
|
-
const slots = useSlots();
|
|
3394
|
-
const { lang } = useLocale();
|
|
3395
|
-
const selectedDay = ref();
|
|
3396
|
-
const now = dayjs().locale(lang.value);
|
|
3397
|
-
const realSelectedDay = computed({
|
|
3398
|
-
get() {
|
|
3399
|
-
if (!props.modelValue)
|
|
3400
|
-
return selectedDay.value;
|
|
3401
|
-
return date.value;
|
|
3402
|
-
},
|
|
3403
|
-
set(val) {
|
|
3404
|
-
if (!val)
|
|
3405
|
-
return;
|
|
3406
|
-
selectedDay.value = val;
|
|
3407
|
-
const result = val.toDate();
|
|
3408
|
-
emit(INPUT_EVENT, result);
|
|
3409
|
-
emit(UPDATE_MODEL_EVENT, result);
|
|
3410
|
-
}
|
|
3411
|
-
});
|
|
3412
|
-
const validatedRange = computed(() => {
|
|
3413
|
-
if (!props.range)
|
|
3414
|
-
return [];
|
|
3415
|
-
const rangeArrDayjs = props.range.map((_) => dayjs(_).locale(lang.value));
|
|
3416
|
-
const [startDayjs, endDayjs] = rangeArrDayjs;
|
|
3417
|
-
if (startDayjs.isAfter(endDayjs)) {
|
|
3418
|
-
debugWarn(componentName, "end time should be greater than start time");
|
|
3419
|
-
return [];
|
|
3420
|
-
}
|
|
3421
|
-
if (startDayjs.isSame(endDayjs, "month")) {
|
|
3422
|
-
return calculateValidatedDateRange(startDayjs, endDayjs);
|
|
3423
|
-
} else {
|
|
3424
|
-
if (startDayjs.add(1, "month").month() !== endDayjs.month()) {
|
|
3425
|
-
debugWarn(componentName, "start time and end time interval must not exceed two months");
|
|
3426
|
-
return [];
|
|
3427
|
-
}
|
|
3428
|
-
return calculateValidatedDateRange(startDayjs, endDayjs);
|
|
3429
|
-
}
|
|
3430
|
-
});
|
|
3431
|
-
const date = computed(() => {
|
|
3432
|
-
if (!props.modelValue) {
|
|
3433
|
-
return realSelectedDay.value || (validatedRange.value.length ? validatedRange.value[0][0] : now);
|
|
3434
|
-
} else {
|
|
3435
|
-
return dayjs(props.modelValue).locale(lang.value);
|
|
3436
|
-
}
|
|
3437
|
-
});
|
|
3438
|
-
const prevMonthDayjs = computed(() => date.value.subtract(1, "month").date(1));
|
|
3439
|
-
const nextMonthDayjs = computed(() => date.value.add(1, "month").date(1));
|
|
3440
|
-
const prevYearDayjs = computed(() => date.value.subtract(1, "year").date(1));
|
|
3441
|
-
const nextYearDayjs = computed(() => date.value.add(1, "year").date(1));
|
|
3442
|
-
const calculateValidatedDateRange = (startDayjs, endDayjs) => {
|
|
3443
|
-
const firstDay = startDayjs.startOf("week");
|
|
3444
|
-
const lastDay = endDayjs.endOf("week");
|
|
3445
|
-
const firstMonth = firstDay.get("month");
|
|
3446
|
-
const lastMonth = lastDay.get("month");
|
|
3447
|
-
if (firstMonth === lastMonth) {
|
|
3448
|
-
return [[firstDay, lastDay]];
|
|
3449
|
-
} else if ((firstMonth + 1) % 12 === lastMonth) {
|
|
3450
|
-
return adjacentMonth(firstDay, lastDay);
|
|
3451
|
-
} else if (firstMonth + 2 === lastMonth || (firstMonth + 1) % 11 === lastMonth) {
|
|
3452
|
-
return threeConsecutiveMonth(firstDay, lastDay);
|
|
3453
|
-
} else {
|
|
3454
|
-
debugWarn(componentName, "start time and end time interval must not exceed two months");
|
|
3455
|
-
return [];
|
|
3456
|
-
}
|
|
3457
|
-
};
|
|
3458
|
-
const pickDay = (day) => {
|
|
3459
|
-
realSelectedDay.value = day;
|
|
3460
|
-
};
|
|
3461
|
-
const selectDate = (type) => {
|
|
3462
|
-
const dateMap = {
|
|
3463
|
-
"prev-month": prevMonthDayjs.value,
|
|
3464
|
-
"next-month": nextMonthDayjs.value,
|
|
3465
|
-
"prev-year": prevYearDayjs.value,
|
|
3466
|
-
"next-year": nextYearDayjs.value,
|
|
3467
|
-
today: now
|
|
3468
|
-
};
|
|
3469
|
-
const day = dateMap[type];
|
|
3470
|
-
if (!day.isSame(date.value, "day")) {
|
|
3471
|
-
pickDay(day);
|
|
3472
|
-
}
|
|
3473
|
-
};
|
|
3474
|
-
useDeprecated({
|
|
3475
|
-
from: '"dateCell"',
|
|
3476
|
-
replacement: '"date-cell"',
|
|
3477
|
-
scope: "ElCalendar",
|
|
3478
|
-
version: "2.3.0",
|
|
3479
|
-
ref: "https://element-plus.org/en-US/component/calendar.html#slots",
|
|
3480
|
-
type: "Slot"
|
|
3481
|
-
}, computed(() => !!slots.dateCell));
|
|
3482
|
-
return {
|
|
3483
|
-
calculateValidatedDateRange,
|
|
3484
|
-
date,
|
|
3485
|
-
realSelectedDay,
|
|
3486
|
-
pickDay,
|
|
3487
|
-
selectDate,
|
|
3488
|
-
validatedRange
|
|
3489
|
-
};
|
|
3490
|
-
};
|
|
3491
287
|
|
|
3492
|
-
|
|
3493
|
-
const
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
},
|
|
3497
|
-
range: {
|
|
3498
|
-
type: definePropType(Array),
|
|
3499
|
-
validator: isValidRange
|
|
288
|
+
var _export_sfc = (sfc, props) => {
|
|
289
|
+
const target = sfc.__vccOpts || sfc;
|
|
290
|
+
for (const [key, val] of props) {
|
|
291
|
+
target[key] = val;
|
|
3500
292
|
}
|
|
3501
|
-
|
|
3502
|
-
const calendarEmits = {
|
|
3503
|
-
[UPDATE_MODEL_EVENT]: (value) => isDate(value),
|
|
3504
|
-
[INPUT_EVENT]: (value) => isDate(value)
|
|
293
|
+
return target;
|
|
3505
294
|
};
|
|
3506
295
|
|
|
3507
|
-
const
|
|
3508
|
-
const
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
});
|
|
3531
|
-
expose({
|
|
3532
|
-
selectedDay: realSelectedDay,
|
|
3533
|
-
pickDay,
|
|
3534
|
-
selectDate,
|
|
3535
|
-
calculateValidatedDateRange
|
|
3536
|
-
});
|
|
3537
|
-
return (_ctx, _cache) => {
|
|
3538
|
-
return openBlock(), createElementBlock("div", {
|
|
3539
|
-
class: normalizeClass(unref(ns).b())
|
|
3540
|
-
}, [
|
|
3541
|
-
createElementVNode("div", {
|
|
3542
|
-
class: normalizeClass(unref(ns).e("header"))
|
|
3543
|
-
}, [
|
|
3544
|
-
renderSlot(_ctx.$slots, "header", { date: unref(i18nDate) }, () => [
|
|
3545
|
-
createElementVNode("div", {
|
|
3546
|
-
class: normalizeClass(unref(ns).e("title"))
|
|
3547
|
-
}, toDisplayString(unref(i18nDate)), 3),
|
|
3548
|
-
unref(validatedRange).length === 0 ? (openBlock(), createElementBlock("div", {
|
|
3549
|
-
key: 0,
|
|
3550
|
-
class: normalizeClass(unref(ns).e("button-group"))
|
|
296
|
+
const _hoisted_1$1 = { key: 0 };
|
|
297
|
+
const _hoisted_2$1 = { class: "das-calendar-header-box" };
|
|
298
|
+
const _hoisted_3$1 = { class: "das-calendar-header-week-line" };
|
|
299
|
+
const _hoisted_4$1 = ["onClick"];
|
|
300
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
301
|
+
return $setup.rows.length ? (openBlock(), createElementBlock(
|
|
302
|
+
"table",
|
|
303
|
+
{
|
|
304
|
+
key: 0,
|
|
305
|
+
class: normalizeClass(["das-calendar-table", { "is-range": $setup.isInRange, "is-week": $props.calendartType == "week", simple: $props.calendartType == "simple" }]),
|
|
306
|
+
cellspacing: "0",
|
|
307
|
+
cellpadding: "0",
|
|
308
|
+
ref: "tableRef"
|
|
309
|
+
},
|
|
310
|
+
[
|
|
311
|
+
!$props.hideHeader ? (openBlock(), createElementBlock("thead", _hoisted_1$1, [
|
|
312
|
+
(openBlock(true), createElementBlock(
|
|
313
|
+
Fragment,
|
|
314
|
+
null,
|
|
315
|
+
renderList($setup.weekDays, (day, index) => {
|
|
316
|
+
return openBlock(), createElementBlock("th", {
|
|
317
|
+
class: "das-calendar-table-header",
|
|
318
|
+
key: day
|
|
3551
319
|
}, [
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
},
|
|
3567
|
-
default: withCtx(() => [
|
|
3568
|
-
createTextVNode(toDisplayString(unref(t)("el.datepicker.today")), 1)
|
|
3569
|
-
]),
|
|
3570
|
-
_: 1
|
|
3571
|
-
}),
|
|
3572
|
-
createVNode(unref(ElButton), {
|
|
3573
|
-
size: "small",
|
|
3574
|
-
onClick: _cache[2] || (_cache[2] = ($event) => unref(selectDate)("next-month"))
|
|
3575
|
-
}, {
|
|
3576
|
-
default: withCtx(() => [
|
|
3577
|
-
createTextVNode(toDisplayString(unref(t)("el.datepicker.nextMonth")), 1)
|
|
3578
|
-
]),
|
|
3579
|
-
_: 1
|
|
3580
|
-
})
|
|
320
|
+
createElementVNode("div", _hoisted_2$1, [
|
|
321
|
+
createElementVNode("div", _hoisted_3$1, [
|
|
322
|
+
createElementVNode(
|
|
323
|
+
"div",
|
|
324
|
+
{
|
|
325
|
+
class: normalizeClass(["das-calendar-header-week", { highlight: $props.highlightWeek }])
|
|
326
|
+
},
|
|
327
|
+
toDisplayString(day),
|
|
328
|
+
3
|
|
329
|
+
/* TEXT, CLASS */
|
|
330
|
+
),
|
|
331
|
+
$props.calendartType == "week" ? renderSlot(_ctx.$slots, "week-type", {
|
|
332
|
+
key: 0,
|
|
333
|
+
data: $setup.getWeekSlotData(index)
|
|
334
|
+
}) : createCommentVNode("v-if", true)
|
|
3581
335
|
]),
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
date: unref(date),
|
|
3593
|
-
"selected-day": unref(realSelectedDay),
|
|
3594
|
-
onPick: unref(pickDay)
|
|
3595
|
-
}, createSlots({ _: 2 }, [
|
|
3596
|
-
_ctx.$slots["date-cell"] || _ctx.$slots.dateCell ? {
|
|
3597
|
-
name: "date-cell",
|
|
3598
|
-
fn: withCtx((data) => [
|
|
3599
|
-
_ctx.$slots["date-cell"] ? renderSlot(_ctx.$slots, "date-cell", normalizeProps(mergeProps({ key: 0 }, data))) : renderSlot(_ctx.$slots, "dateCell", normalizeProps(mergeProps({ key: 1 }, data)))
|
|
336
|
+
$props.calendartType == "week" ? (openBlock(), createElementBlock(
|
|
337
|
+
"div",
|
|
338
|
+
{
|
|
339
|
+
key: 0,
|
|
340
|
+
class: normalizeClass(["das-calendar-header-day", { highlight: $props.highlightDay }])
|
|
341
|
+
},
|
|
342
|
+
toDisplayString($setup.getWeekDay(index)),
|
|
343
|
+
3
|
|
344
|
+
/* TEXT, CLASS */
|
|
345
|
+
)) : createCommentVNode("v-if", true)
|
|
3600
346
|
])
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
"
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
month9: "9 \u6708",
|
|
3668
|
-
month10: "10 \u6708",
|
|
3669
|
-
month11: "11 \u6708",
|
|
3670
|
-
month12: "12 \u6708",
|
|
3671
|
-
weeks: {
|
|
3672
|
-
sun: "\u65E5",
|
|
3673
|
-
mon: "\u4E00",
|
|
3674
|
-
tue: "\u4E8C",
|
|
3675
|
-
wed: "\u4E09",
|
|
3676
|
-
thu: "\u56DB",
|
|
3677
|
-
fri: "\u4E94",
|
|
3678
|
-
sat: "\u516D"
|
|
3679
|
-
},
|
|
3680
|
-
months: {
|
|
3681
|
-
jan: "\u4E00\u6708",
|
|
3682
|
-
feb: "\u4E8C\u6708",
|
|
3683
|
-
mar: "\u4E09\u6708",
|
|
3684
|
-
apr: "\u56DB\u6708",
|
|
3685
|
-
may: "\u4E94\u6708",
|
|
3686
|
-
jun: "\u516D\u6708",
|
|
3687
|
-
jul: "\u4E03\u6708",
|
|
3688
|
-
aug: "\u516B\u6708",
|
|
3689
|
-
sep: "\u4E5D\u6708",
|
|
3690
|
-
oct: "\u5341\u6708",
|
|
3691
|
-
nov: "\u5341\u4E00\u6708",
|
|
3692
|
-
dec: "\u5341\u4E8C\u6708"
|
|
3693
|
-
}
|
|
3694
|
-
},
|
|
3695
|
-
select: {
|
|
3696
|
-
loading: "\u52A0\u8F7D\u4E2D",
|
|
3697
|
-
noMatch: "\u65E0\u5339\u914D\u6570\u636E",
|
|
3698
|
-
noData: "\u65E0\u6570\u636E",
|
|
3699
|
-
placeholder: "\u8BF7\u9009\u62E9"
|
|
3700
|
-
},
|
|
3701
|
-
cascader: {
|
|
3702
|
-
noMatch: "\u65E0\u5339\u914D\u6570\u636E",
|
|
3703
|
-
loading: "\u52A0\u8F7D\u4E2D",
|
|
3704
|
-
placeholder: "\u8BF7\u9009\u62E9",
|
|
3705
|
-
noData: "\u6682\u65E0\u6570\u636E"
|
|
3706
|
-
},
|
|
3707
|
-
pagination: {
|
|
3708
|
-
goto: "\u524D\u5F80",
|
|
3709
|
-
pagesize: "\u6761/\u9875",
|
|
3710
|
-
total: "\u5171 {total} \u6761",
|
|
3711
|
-
pageClassifier: "\u9875",
|
|
3712
|
-
page: "\u9875",
|
|
3713
|
-
prev: "\u4E0A\u4E00\u9875",
|
|
3714
|
-
next: "\u4E0B\u4E00\u9875",
|
|
3715
|
-
currentPage: "\u7B2C {pager} \u9875",
|
|
3716
|
-
prevPages: "\u5411\u524D {pager} \u9875",
|
|
3717
|
-
nextPages: "\u5411\u540E {pager} \u9875",
|
|
3718
|
-
deprecationWarning: "\u4F60\u4F7F\u7528\u4E86\u4E00\u4E9B\u5DF2\u88AB\u5E9F\u5F03\u7684\u7528\u6CD5\uFF0C\u8BF7\u53C2\u8003 el-pagination \u7684\u5B98\u65B9\u6587\u6863"
|
|
3719
|
-
},
|
|
3720
|
-
messagebox: {
|
|
3721
|
-
title: "\u63D0\u793A",
|
|
3722
|
-
confirm: "\u786E\u5B9A",
|
|
3723
|
-
cancel: "\u53D6\u6D88",
|
|
3724
|
-
error: "\u8F93\u5165\u7684\u6570\u636E\u4E0D\u5408\u6CD5!"
|
|
3725
|
-
},
|
|
3726
|
-
upload: {
|
|
3727
|
-
deleteTip: "\u6309 delete \u952E\u53EF\u5220\u9664",
|
|
3728
|
-
delete: "\u5220\u9664",
|
|
3729
|
-
preview: "\u67E5\u770B\u56FE\u7247",
|
|
3730
|
-
continue: "\u7EE7\u7EED\u4E0A\u4F20"
|
|
3731
|
-
},
|
|
3732
|
-
table: {
|
|
3733
|
-
emptyText: "\u6682\u65E0\u6570\u636E",
|
|
3734
|
-
confirmFilter: "\u7B5B\u9009",
|
|
3735
|
-
resetFilter: "\u91CD\u7F6E",
|
|
3736
|
-
clearFilter: "\u5168\u90E8",
|
|
3737
|
-
sumText: "\u5408\u8BA1"
|
|
3738
|
-
},
|
|
3739
|
-
tree: {
|
|
3740
|
-
emptyText: "\u6682\u65E0\u6570\u636E"
|
|
3741
|
-
},
|
|
3742
|
-
transfer: {
|
|
3743
|
-
noMatch: "\u65E0\u5339\u914D\u6570\u636E",
|
|
3744
|
-
noData: "\u65E0\u6570\u636E",
|
|
3745
|
-
titles: ["\u5217\u8868 1", "\u5217\u8868 2"],
|
|
3746
|
-
filterPlaceholder: "\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",
|
|
3747
|
-
noCheckedFormat: "\u5171 {total} \u9879",
|
|
3748
|
-
hasCheckedFormat: "\u5DF2\u9009 {checked}/{total} \u9879"
|
|
3749
|
-
},
|
|
3750
|
-
image: {
|
|
3751
|
-
error: "\u52A0\u8F7D\u5931\u8D25"
|
|
3752
|
-
},
|
|
3753
|
-
pageHeader: {
|
|
3754
|
-
title: "\u8FD4\u56DE"
|
|
3755
|
-
},
|
|
3756
|
-
popconfirm: {
|
|
3757
|
-
confirmButtonText: "\u786E\u5B9A",
|
|
3758
|
-
cancelButtonText: "\u53D6\u6D88"
|
|
3759
|
-
}
|
|
3760
|
-
}
|
|
3761
|
-
};
|
|
3762
|
-
|
|
3763
|
-
var zhCn = {exports: {}};
|
|
3764
|
-
|
|
3765
|
-
(function (module, exports) {
|
|
3766
|
-
!function(e,_){module.exports=_(dayjs_minExports);}(commonjsGlobal,(function(e){function _(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=_(e),d={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(e,_){return "W"===_?e+"周":e+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(e,_){var t=100*e+_;return t<600?"凌晨":t<900?"早上":t<1100?"上午":t<1300?"中午":t<1800?"下午":"晚上"}};return t.default.locale(d,null,!0),d}));
|
|
3767
|
-
} (zhCn));
|
|
347
|
+
]);
|
|
348
|
+
}),
|
|
349
|
+
128
|
|
350
|
+
/* KEYED_FRAGMENT */
|
|
351
|
+
))
|
|
352
|
+
])) : createCommentVNode("v-if", true),
|
|
353
|
+
createElementVNode("tbody", null, [
|
|
354
|
+
(openBlock(true), createElementBlock(
|
|
355
|
+
Fragment,
|
|
356
|
+
null,
|
|
357
|
+
renderList($setup.rows, (row, index) => {
|
|
358
|
+
return openBlock(), createElementBlock(
|
|
359
|
+
"tr",
|
|
360
|
+
{
|
|
361
|
+
key: index,
|
|
362
|
+
class: normalizeClass({
|
|
363
|
+
"das-calendar-table-row": true,
|
|
364
|
+
"hide-border": index === 0 && $props.hideHeader
|
|
365
|
+
})
|
|
366
|
+
},
|
|
367
|
+
[
|
|
368
|
+
(openBlock(true), createElementBlock(
|
|
369
|
+
Fragment,
|
|
370
|
+
null,
|
|
371
|
+
renderList(row, (cell, key) => {
|
|
372
|
+
return openBlock(), createElementBlock("td", {
|
|
373
|
+
key,
|
|
374
|
+
class: normalizeClass($setup.getCellClass(cell)),
|
|
375
|
+
onClick: ($event) => $setup.handlePickDay(cell)
|
|
376
|
+
}, [
|
|
377
|
+
createCommentVNode(" v-scrollbar "),
|
|
378
|
+
createCommentVNode(' :style="{ height: trHeight }" '),
|
|
379
|
+
createElementVNode(
|
|
380
|
+
"div",
|
|
381
|
+
{
|
|
382
|
+
class: "das-calendar-day",
|
|
383
|
+
style: normalizeStyle({ height: $setup.trHeight })
|
|
384
|
+
},
|
|
385
|
+
[
|
|
386
|
+
renderSlot(_ctx.$slots, "date-cell", {
|
|
387
|
+
data: $setup.getSlotData(cell)
|
|
388
|
+
})
|
|
389
|
+
],
|
|
390
|
+
4
|
|
391
|
+
/* STYLE */
|
|
392
|
+
)
|
|
393
|
+
], 10, _hoisted_4$1);
|
|
394
|
+
}),
|
|
395
|
+
128
|
|
396
|
+
/* KEYED_FRAGMENT */
|
|
397
|
+
))
|
|
398
|
+
],
|
|
399
|
+
2
|
|
400
|
+
/* CLASS */
|
|
401
|
+
);
|
|
402
|
+
}),
|
|
403
|
+
128
|
|
404
|
+
/* KEYED_FRAGMENT */
|
|
405
|
+
))
|
|
406
|
+
])
|
|
407
|
+
],
|
|
408
|
+
2
|
|
409
|
+
/* CLASS */
|
|
410
|
+
)) : createCommentVNode("v-if", true);
|
|
411
|
+
}
|
|
412
|
+
var calendarTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__file", "/Users/xiecp/das/das-fe/framework/packages/das-ui/packages/components/calendar/src/calendar-table.vue"]]);
|
|
3768
413
|
|
|
3769
|
-
const _withScopeId = (n) => (pushScopeId("data-v-1746aeeb"), n = n(), popScopeId(), n);
|
|
3770
|
-
const _hoisted_1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode(
|
|
3771
|
-
"p",
|
|
3772
|
-
null,
|
|
3773
|
-
null,
|
|
3774
|
-
-1
|
|
3775
|
-
/* HOISTED */
|
|
3776
|
-
));
|
|
3777
|
-
const _hoisted_2 = ["onClick"];
|
|
3778
|
-
const _hoisted_3 = { class: "das-calendar-cell-cont" };
|
|
3779
414
|
const __default__ = {
|
|
3780
|
-
name: "
|
|
415
|
+
name: "test"
|
|
3781
416
|
};
|
|
3782
417
|
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3783
418
|
...__default__,
|
|
3784
419
|
props: {
|
|
3785
420
|
modelValue: { type: Date, required: true },
|
|
3786
|
-
|
|
421
|
+
range: { type: Array, required: false },
|
|
422
|
+
type: { type: String, required: false, default: "month" },
|
|
423
|
+
isSwitchSelection: { type: Boolean, required: false, default: true },
|
|
424
|
+
isSwitchMonth: { type: Boolean, required: false, default: false },
|
|
425
|
+
highlightWeek: { type: Boolean, required: false, default: false },
|
|
426
|
+
highlightDay: { type: Boolean, required: false, default: true },
|
|
427
|
+
showZhou: { type: Boolean, required: false, default: true },
|
|
428
|
+
firstDayOfWeek: { type: Number, required: false, default: dayjs.localeData().firstDayOfWeek() },
|
|
429
|
+
cellHeight: { type: Number, required: false, default: 0 }
|
|
3787
430
|
},
|
|
3788
431
|
emits: ["update:model-value", "itemClick"],
|
|
3789
432
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
3790
|
-
|
|
3791
|
-
"1746aeeb-trHeight": trHeight.value
|
|
3792
|
-
}));
|
|
433
|
+
dayjs.extend(localeData);
|
|
3793
434
|
const props = __props;
|
|
3794
|
-
const
|
|
3795
|
-
const activeValue = ref();
|
|
3796
|
-
const currRange = ref();
|
|
3797
|
-
const $emit = __emit;
|
|
3798
|
-
const attrs = useAttrs();
|
|
435
|
+
const emit = __emit;
|
|
3799
436
|
const $calendar = ref();
|
|
3800
|
-
const
|
|
3801
|
-
const
|
|
3802
|
-
const
|
|
3803
|
-
const
|
|
3804
|
-
const
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
return arr.join(";");
|
|
3816
|
-
} else {
|
|
3817
|
-
let arr = [];
|
|
3818
|
-
for (let i = 0; i < 7; i++) {
|
|
3819
|
-
arr.push(`--tHeadDateFmt${i + 1}: ''`);
|
|
3820
|
-
}
|
|
3821
|
-
return arr.join(";");
|
|
437
|
+
const $calendarTable = ref();
|
|
438
|
+
const calendarSizeWatcher = ref();
|
|
439
|
+
const selectedDay = ref();
|
|
440
|
+
const now = dayjs();
|
|
441
|
+
const realSelectedDay = computed({
|
|
442
|
+
get() {
|
|
443
|
+
if (!props.modelValue) return selectedDay.value;
|
|
444
|
+
selectedDay.value = date.value;
|
|
445
|
+
return date.value;
|
|
446
|
+
},
|
|
447
|
+
set(val) {
|
|
448
|
+
if (!val) return;
|
|
449
|
+
selectedDay.value = val;
|
|
450
|
+
const result = val.toDate();
|
|
451
|
+
if (props.isSwitchMonth) emit("update:model-value", result);
|
|
3822
452
|
}
|
|
3823
453
|
});
|
|
3824
|
-
const
|
|
3825
|
-
|
|
3826
|
-
|
|
454
|
+
const currRange = computed(() => {
|
|
455
|
+
if (props.type == "week") {
|
|
456
|
+
if (props.range) return props.range;
|
|
457
|
+
const firstDay = dayjs(props.modelValue).day();
|
|
458
|
+
const preWeekDay = (firstDay - props.firstDayOfWeek + 7) % 7;
|
|
459
|
+
const nextWeekday = 7 - (preWeekDay + 1);
|
|
460
|
+
const arr = [];
|
|
461
|
+
arr.push(dayjs(props.modelValue).subtract(preWeekDay, "day").toDate());
|
|
462
|
+
arr.push(dayjs(props.modelValue).add(nextWeekday, "day").toDate());
|
|
463
|
+
return arr;
|
|
464
|
+
} else {
|
|
465
|
+
return props.range ? props.range : void 0;
|
|
466
|
+
}
|
|
3827
467
|
});
|
|
3828
|
-
const
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
watch(
|
|
3837
|
-
() => currValue.value,
|
|
3838
|
-
(newVal, oldVal) => {
|
|
3839
|
-
console.log("watch-----", oldVal);
|
|
3840
|
-
$emit("update:model-value", currValue.value);
|
|
3841
|
-
init();
|
|
468
|
+
const validatedRange = computed(() => {
|
|
469
|
+
if (!currRange.value) return [];
|
|
470
|
+
const rangeArrDayjs = currRange.value.map((item) => dayjs(item));
|
|
471
|
+
const [startDayjs, endDayjs] = rangeArrDayjs;
|
|
472
|
+
if (props.type == "week") return [[startDayjs, endDayjs]];
|
|
473
|
+
if (startDayjs.isAfter(endDayjs)) {
|
|
474
|
+
console.warn("end time should be greater than start time");
|
|
475
|
+
return [];
|
|
3842
476
|
}
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
477
|
+
if (startDayjs.isSame(endDayjs, "month")) {
|
|
478
|
+
return calculateValidatedDateRange(startDayjs, endDayjs);
|
|
479
|
+
} else {
|
|
480
|
+
if (startDayjs.add(1, "month").month() !== endDayjs.month()) {
|
|
481
|
+
console.warn("start time and end time interval must not exceed two months");
|
|
482
|
+
return [];
|
|
483
|
+
}
|
|
484
|
+
return calculateValidatedDateRange(startDayjs, endDayjs);
|
|
3848
485
|
}
|
|
3849
|
-
);
|
|
3850
|
-
const
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
if (props.type == "week") {
|
|
3854
|
-
currRange.value = [dayjs(currValue.value).startOf("week").toDate(), dayjs(currValue.value).endOf("week").toDate()];
|
|
486
|
+
});
|
|
487
|
+
const date = computed(() => {
|
|
488
|
+
if (!props.modelValue) {
|
|
489
|
+
return realSelectedDay.value || (validatedRange.value.length ? validatedRange.value[0][0] : now);
|
|
3855
490
|
} else {
|
|
3856
|
-
|
|
491
|
+
return dayjs(props.modelValue);
|
|
3857
492
|
}
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
493
|
+
});
|
|
494
|
+
const prevMonthDayjs = computed(() => date.value.subtract(1, "month").date(1));
|
|
495
|
+
const nextMonthDayjs = computed(() => date.value.add(1, "month").date(1));
|
|
496
|
+
const prevYearDayjs = computed(() => date.value.subtract(1, "year").date(1));
|
|
497
|
+
const nextYearDayjs = computed(() => date.value.add(1, "year").date(1));
|
|
498
|
+
const i18nDate = computed(() => {
|
|
499
|
+
const pickedMonth = `das-calendar-month${date.value.format("M")}`;
|
|
500
|
+
return `${date.value.year()} ${t("das-calendar-year")} ${t(pickedMonth)}`;
|
|
501
|
+
});
|
|
502
|
+
onMounted(() => {
|
|
503
|
+
calendarSizeWatcher.value = SizeWatcher(() => {
|
|
504
|
+
if (Array.isArray($calendarTable.value)) {
|
|
505
|
+
$calendarTable.value[0]?.getHeight();
|
|
3866
506
|
} else {
|
|
3867
|
-
|
|
507
|
+
$calendarTable.value?.getHeight();
|
|
3868
508
|
}
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
509
|
+
}, $calendar.value);
|
|
510
|
+
});
|
|
511
|
+
onBeforeUnmount(() => {
|
|
512
|
+
calendarSizeWatcher.value.disconnect();
|
|
513
|
+
});
|
|
514
|
+
const pickDay = (day) => {
|
|
515
|
+
if (props.isSwitchSelection) realSelectedDay.value = day;
|
|
516
|
+
emit("itemClick", day.toDate());
|
|
517
|
+
};
|
|
518
|
+
const selectDate = (type) => {
|
|
519
|
+
const dateMap = {
|
|
520
|
+
"prev-month": prevMonthDayjs.value,
|
|
521
|
+
"next-month": nextMonthDayjs.value,
|
|
522
|
+
"prev-year": prevYearDayjs.value,
|
|
523
|
+
"next-year": nextYearDayjs.value,
|
|
524
|
+
today: now
|
|
525
|
+
};
|
|
526
|
+
const day = dateMap[type];
|
|
527
|
+
if (!day.isSame(date.value, "day")) {
|
|
528
|
+
pickDay(day);
|
|
529
|
+
}
|
|
3875
530
|
};
|
|
3876
|
-
const
|
|
3877
|
-
|
|
531
|
+
const setActive = (val) => {
|
|
532
|
+
realSelectedDay.value = dayjs(val);
|
|
533
|
+
emit("itemClick", val);
|
|
3878
534
|
};
|
|
3879
|
-
onMounted(() => {
|
|
3880
|
-
initDay();
|
|
3881
|
-
nextTick(() => {
|
|
3882
|
-
activeValue.value = currValue.value;
|
|
3883
|
-
init();
|
|
3884
|
-
});
|
|
3885
|
-
});
|
|
3886
535
|
__expose({
|
|
3887
536
|
$calendar,
|
|
3888
537
|
setActive
|
|
3889
538
|
});
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
{
|
|
3894
|
-
key: 0,
|
|
3895
|
-
class: normalizeClass(["das-ui-calendar", props.type == "week" ? "week" : ""]),
|
|
3896
|
-
style: normalizeStyle(tHeadDateFmt.value)
|
|
3897
|
-
},
|
|
3898
|
-
[
|
|
3899
|
-
createVNode(unref(ElConfigProvider), { locale: locale.value }, {
|
|
3900
|
-
default: withCtx(() => [
|
|
3901
|
-
createVNode(unref(ElCalendar), mergeProps(unref(attrs), {
|
|
3902
|
-
ref_key: "$calendar",
|
|
3903
|
-
ref: $calendar,
|
|
3904
|
-
"model-value": unref(currValue),
|
|
3905
|
-
range: currRange.value
|
|
3906
|
-
}), {
|
|
3907
|
-
header: withCtx(({}) => [
|
|
3908
|
-
renderSlot(_ctx.$slots, "header", {}, () => [
|
|
3909
|
-
_hoisted_1
|
|
3910
|
-
], true)
|
|
3911
|
-
]),
|
|
3912
|
-
"date-cell": withCtx((dataObj) => [
|
|
3913
|
-
createElementVNode("div", {
|
|
3914
|
-
class: "das-calendar-cell",
|
|
3915
|
-
onClick: () => cellClick(dataObj.data)
|
|
3916
|
-
}, [
|
|
3917
|
-
createElementVNode(
|
|
3918
|
-
"p",
|
|
3919
|
-
{
|
|
3920
|
-
class: normalizeClass(["das-calendar-cell-date", isActive.value(dataObj.data) ? "is-active" : ""])
|
|
3921
|
-
},
|
|
3922
|
-
[
|
|
3923
|
-
createElementVNode(
|
|
3924
|
-
"span",
|
|
3925
|
-
null,
|
|
3926
|
-
toDisplayString(Number(dataObj.data.day.split("-").slice(2)).toString()),
|
|
3927
|
-
1
|
|
3928
|
-
/* TEXT */
|
|
3929
|
-
)
|
|
3930
|
-
],
|
|
3931
|
-
2
|
|
3932
|
-
/* CLASS */
|
|
3933
|
-
),
|
|
3934
|
-
withDirectives((openBlock(), createElementBlock("div", _hoisted_3, [
|
|
3935
|
-
renderSlot(_ctx.$slots, "date-cell", normalizeProps(guardReactiveProps(dataObj)), void 0, true)
|
|
3936
|
-
])), [
|
|
3937
|
-
[unref(vScrollbar)]
|
|
3938
|
-
])
|
|
3939
|
-
], 8, _hoisted_2)
|
|
3940
|
-
]),
|
|
3941
|
-
_: 3
|
|
3942
|
-
/* FORWARDED */
|
|
3943
|
-
}, 16, ["model-value", "range"])
|
|
3944
|
-
]),
|
|
3945
|
-
_: 3
|
|
3946
|
-
/* FORWARDED */
|
|
3947
|
-
}, 8, ["locale"])
|
|
3948
|
-
],
|
|
3949
|
-
6
|
|
3950
|
-
/* CLASS, STYLE */
|
|
3951
|
-
)) : createCommentVNode("v-if", true);
|
|
3952
|
-
};
|
|
539
|
+
const __returned__ = { props, emit, $calendar, $calendarTable, calendarSizeWatcher, selectedDay, now, realSelectedDay, currRange, validatedRange, date, prevMonthDayjs, nextMonthDayjs, prevYearDayjs, nextYearDayjs, i18nDate, pickDay, selectDate, setActive, calendarTable };
|
|
540
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
541
|
+
return __returned__;
|
|
3953
542
|
}
|
|
3954
543
|
});
|
|
3955
544
|
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
545
|
+
const _hoisted_1 = {
|
|
546
|
+
ref: "$calendar",
|
|
547
|
+
class: "das-ui-calendar"
|
|
548
|
+
};
|
|
549
|
+
const _hoisted_2 = {
|
|
550
|
+
key: 0,
|
|
551
|
+
class: "das-calendar-body 1"
|
|
552
|
+
};
|
|
553
|
+
const _hoisted_3 = {
|
|
554
|
+
key: 1,
|
|
555
|
+
class: "das-calendar-cell-date"
|
|
556
|
+
};
|
|
557
|
+
const _hoisted_4 = {
|
|
558
|
+
key: 2,
|
|
559
|
+
class: "das-calendar-cell-cont"
|
|
560
|
+
};
|
|
561
|
+
const _hoisted_5 = {
|
|
562
|
+
key: 1,
|
|
563
|
+
class: "das-calendar-body 2"
|
|
564
|
+
};
|
|
565
|
+
const _hoisted_6 = {
|
|
566
|
+
key: 1,
|
|
567
|
+
class: "das-calendar-cell-date"
|
|
568
|
+
};
|
|
569
|
+
const _hoisted_7 = {
|
|
570
|
+
key: 2,
|
|
571
|
+
class: "das-calendar-cell-cont"
|
|
572
|
+
};
|
|
573
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
574
|
+
return openBlock(), createElementBlock(
|
|
575
|
+
"div",
|
|
576
|
+
_hoisted_1,
|
|
577
|
+
[
|
|
578
|
+
createCommentVNode(` <div class="das-calendar-header" >
|
|
579
|
+
<slot name="header" :date="i18nDate">
|
|
580
|
+
<div class="das-calendar-title" >{{ i18nDate }}</div>
|
|
581
|
+
<div class="das-calendar-button-group" v-if="validatedRange.length === 0" >
|
|
582
|
+
<das-button @click="selectDate('prev-month')" > {{ t('das-calendar-prevMonth') }}</das-button>
|
|
583
|
+
<das-button @click="selectDate('today')" > {{ t('das-calendar-today') }}</das-button>
|
|
584
|
+
<das-button @click="selectDate('next-month')" > {{ t('das-calendar-nextMonth') }}</das-button>
|
|
585
|
+
</div>
|
|
586
|
+
</slot>
|
|
587
|
+
</div> `),
|
|
588
|
+
$setup.validatedRange.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
589
|
+
createVNode($setup["calendarTable"], {
|
|
590
|
+
ref: "$calendarTable",
|
|
591
|
+
date: $setup.date,
|
|
592
|
+
firstDayOfWeek: $props.firstDayOfWeek,
|
|
593
|
+
parent: $setup.$calendar,
|
|
594
|
+
calendartType: $props.type,
|
|
595
|
+
highlightWeek: $props.highlightWeek,
|
|
596
|
+
highlightDay: $props.highlightDay,
|
|
597
|
+
showZhou: $props.showZhou,
|
|
598
|
+
cellHeight: $props.cellHeight,
|
|
599
|
+
"selected-day": $setup.selectedDay,
|
|
600
|
+
onPick: $setup.pickDay
|
|
601
|
+
}, createSlots({
|
|
602
|
+
"date-cell": withCtx((data) => [
|
|
603
|
+
_ctx.$slots.custom ? renderSlot(_ctx.$slots, "custom", normalizeProps(mergeProps({ key: 0 }, data))) : createCommentVNode("v-if", true),
|
|
604
|
+
$props.type != "week" && !_ctx.$slots.custom ? (openBlock(), createElementBlock("p", _hoisted_3, [
|
|
605
|
+
createElementVNode(
|
|
606
|
+
"span",
|
|
607
|
+
null,
|
|
608
|
+
toDisplayString(Number(data.data.day.split("-").slice(2)).toString()),
|
|
609
|
+
1
|
|
610
|
+
/* TEXT */
|
|
611
|
+
),
|
|
612
|
+
renderSlot(_ctx.$slots, "date-type", normalizeProps(guardReactiveProps(data)))
|
|
613
|
+
])) : createCommentVNode("v-if", true),
|
|
614
|
+
!_ctx.$slots.custom ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
615
|
+
renderSlot(_ctx.$slots, "date-cell", normalizeProps(guardReactiveProps(data)))
|
|
616
|
+
])) : createCommentVNode("v-if", true)
|
|
617
|
+
]),
|
|
618
|
+
_: 2
|
|
619
|
+
/* DYNAMIC */
|
|
620
|
+
}, [
|
|
621
|
+
_ctx.$slots["week-type"] && $props.type == "week" ? {
|
|
622
|
+
name: "week-type",
|
|
623
|
+
fn: withCtx((data) => [
|
|
624
|
+
renderSlot(_ctx.$slots, "week-type", normalizeProps(guardReactiveProps(data)))
|
|
625
|
+
]),
|
|
626
|
+
key: "0"
|
|
627
|
+
} : void 0
|
|
628
|
+
]), 1032, ["date", "firstDayOfWeek", "parent", "calendartType", "highlightWeek", "highlightDay", "showZhou", "cellHeight", "selected-day"])
|
|
629
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
630
|
+
(openBlock(true), createElementBlock(
|
|
631
|
+
Fragment,
|
|
632
|
+
null,
|
|
633
|
+
renderList($setup.validatedRange, (range_, index) => {
|
|
634
|
+
return openBlock(), createBlock($setup["calendarTable"], {
|
|
635
|
+
ref_for: true,
|
|
636
|
+
ref: "$calendarTable",
|
|
637
|
+
key: index,
|
|
638
|
+
firstDayOfWeek: $props.firstDayOfWeek,
|
|
639
|
+
date: range_[0],
|
|
640
|
+
calendartType: $props.type,
|
|
641
|
+
highlightWeek: $props.highlightWeek,
|
|
642
|
+
highlightDay: $props.highlightDay,
|
|
643
|
+
showZhou: $props.showZhou,
|
|
644
|
+
cellHeight: $props.cellHeight,
|
|
645
|
+
"selected-day": $setup.selectedDay,
|
|
646
|
+
range: range_,
|
|
647
|
+
parent: $setup.$calendar,
|
|
648
|
+
"hide-header": index !== 0,
|
|
649
|
+
onPick: $setup.pickDay
|
|
650
|
+
}, createSlots({
|
|
651
|
+
"date-cell": withCtx((data) => [
|
|
652
|
+
_ctx.$slots.custom ? renderSlot(_ctx.$slots, "custom", mergeProps({
|
|
653
|
+
key: 0,
|
|
654
|
+
ref_for: true
|
|
655
|
+
}, data)) : createCommentVNode("v-if", true),
|
|
656
|
+
$props.type != "week" && !_ctx.$slots.custom ? (openBlock(), createElementBlock("p", _hoisted_6, [
|
|
657
|
+
createElementVNode(
|
|
658
|
+
"span",
|
|
659
|
+
null,
|
|
660
|
+
toDisplayString(Number(data.data.day.split("-").slice(2)).toString()),
|
|
661
|
+
1
|
|
662
|
+
/* TEXT */
|
|
663
|
+
)
|
|
664
|
+
])) : createCommentVNode("v-if", true),
|
|
665
|
+
!_ctx.$slots.custom ? (openBlock(), createElementBlock("div", _hoisted_7, [
|
|
666
|
+
renderSlot(_ctx.$slots, "date-cell", mergeProps({ ref_for: true }, data))
|
|
667
|
+
])) : createCommentVNode("v-if", true)
|
|
668
|
+
]),
|
|
669
|
+
_: 2
|
|
670
|
+
/* DYNAMIC */
|
|
671
|
+
}, [
|
|
672
|
+
_ctx.$slots["week-type"] && $props.type == "week" ? {
|
|
673
|
+
name: "week-type",
|
|
674
|
+
fn: withCtx((data) => [
|
|
675
|
+
renderSlot(_ctx.$slots, "week-type", mergeProps({ ref_for: true }, data))
|
|
676
|
+
]),
|
|
677
|
+
key: "0"
|
|
678
|
+
} : void 0
|
|
679
|
+
]), 1032, ["firstDayOfWeek", "date", "calendartType", "highlightWeek", "highlightDay", "showZhou", "cellHeight", "selected-day", "range", "parent", "hide-header"]);
|
|
680
|
+
}),
|
|
681
|
+
128
|
|
682
|
+
/* KEYED_FRAGMENT */
|
|
683
|
+
))
|
|
684
|
+
]))
|
|
685
|
+
],
|
|
686
|
+
512
|
|
687
|
+
/* NEED_PATCH */
|
|
688
|
+
);
|
|
689
|
+
}
|
|
690
|
+
var calendar = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/xiecp/das/das-fe/framework/packages/das-ui/packages/components/calendar/src/Index.vue"]]);
|
|
3965
691
|
|
|
3966
692
|
var theme = {
|
|
3967
693
|
"--das-ui-calendar-color-primary": "#5582F3",
|
|
@@ -3976,14 +702,64 @@ var theme = {
|
|
|
3976
702
|
// 表格头部提示文字颜色
|
|
3977
703
|
"--das-ui-calendar-size-head-tip": "12px",
|
|
3978
704
|
// 表格头部提示文字大小
|
|
3979
|
-
"--das-ui-calendar-span-size": "
|
|
705
|
+
"--das-ui-calendar-span-size": "28px",
|
|
3980
706
|
// 日期高亮区域的宽高size
|
|
707
|
+
"--das-ui-calendar-color-pre-next": "#B2B2B2"
|
|
708
|
+
// 上/下一个月文字颜色
|
|
3981
709
|
// '--das-ui-calendar-head-height': '60px', // 日历表头高度
|
|
3982
710
|
// '--das-ui-calendar-cell-height': '128px', // 单元格高度
|
|
3983
711
|
};
|
|
3984
712
|
|
|
713
|
+
var i18n = {
|
|
714
|
+
"das-calendar-prevMonth": { "zh-CN": "\u4E0A\u4E2A\u6708", en: "Previous Month" },
|
|
715
|
+
"das-calendar-nextMonth": { "zh-CN": "\u4E0B\u4E2A\u6708", en: "Next Month" },
|
|
716
|
+
"das-calendar-prevYear": { "zh-CN": "\u524D\u4E00\u5E74", en: "Previous Year" },
|
|
717
|
+
"das-calendar-nextYear": { "zh-CN": "\u540E\u4E00\u5E74", en: "Next Year" },
|
|
718
|
+
"das-calendar-year": { "zh-CN": "\u5E74", en: "" },
|
|
719
|
+
"das-calendar-today": { "zh-CN": "\u4ECA\u5929", en: "Today" },
|
|
720
|
+
"das-calendar-month1": { "zh-CN": "1 \u6708", en: "January" },
|
|
721
|
+
"das-calendar-month2": { "zh-CN": "2 \u6708", en: "February" },
|
|
722
|
+
"das-calendar-month3": { "zh-CN": "3 \u6708", en: "March" },
|
|
723
|
+
"das-calendar-month4": { "zh-CN": "4 \u6708", en: "April" },
|
|
724
|
+
"das-calendar-month5": { "zh-CN": "5 \u6708", en: "May" },
|
|
725
|
+
"das-calendar-month6": { "zh-CN": "6 \u6708", en: "June" },
|
|
726
|
+
"das-calendar-month7": { "zh-CN": "7 \u6708", en: "July" },
|
|
727
|
+
"das-calendar-month8": { "zh-CN": "8 \u6708", en: "August" },
|
|
728
|
+
"das-calendar-month9": { "zh-CN": "9 \u6708", en: "September" },
|
|
729
|
+
"das-calendar-month10": { "zh-CN": "10 \u6708", en: "October" },
|
|
730
|
+
"das-calendar-month11": { "zh-CN": "11 \u6708", en: "November" },
|
|
731
|
+
"das-calendar-month12": { "zh-CN": "12 \u6708", en: "December" },
|
|
732
|
+
"das-calendar-weeks-sun": { "zh-CN": "\u65E5", en: "Sun" },
|
|
733
|
+
"das-calendar-weeks-mon": { "zh-CN": "\u4E00", en: "Mon" },
|
|
734
|
+
"das-calendar-weeks-tue": { "zh-CN": "\u4E8C", en: "Tue" },
|
|
735
|
+
"das-calendar-weeks-wed": { "zh-CN": "\u4E09", en: "Wed" },
|
|
736
|
+
"das-calendar-weeks-thu": { "zh-CN": "\u56DB", en: "Thu" },
|
|
737
|
+
"das-calendar-weeks-fri": { "zh-CN": "\u4E94", en: "Fri" },
|
|
738
|
+
"das-calendar-weeks-sat": { "zh-CN": "\u516D", en: "Sat" },
|
|
739
|
+
"das-calendar-weeks-zhou-sun": { "zh-CN": "\u5468\u65E5", en: "Sun" },
|
|
740
|
+
"das-calendar-weeks-zhou-mon": { "zh-CN": "\u5468\u4E00", en: "Mon" },
|
|
741
|
+
"das-calendar-weeks-zhou-tue": { "zh-CN": "\u5468\u4E8C", en: "Tue" },
|
|
742
|
+
"das-calendar-weeks-zhou-wed": { "zh-CN": "\u5468\u4E09", en: "Wed" },
|
|
743
|
+
"das-calendar-weeks-zhou-thu": { "zh-CN": "\u5468\u56DB", en: "Thu" },
|
|
744
|
+
"das-calendar-weeks-zhou-fri": { "zh-CN": "\u5468\u4E94", en: "Fri" },
|
|
745
|
+
"das-calendar-weeks-zhou-sat": { "zh-CN": "\u5468\u516D", en: "Sat" },
|
|
746
|
+
"das-calendar-months-jan": { "zh-CN": "\u4E00\u6708", en: "Jan" },
|
|
747
|
+
"das-calendar-months-feb": { "zh-CN": "\u4E8C\u6708", en: "Feb" },
|
|
748
|
+
"das-calendar-months-mar": { "zh-CN": "\u4E09\u6708", en: "Mar" },
|
|
749
|
+
"das-calendar-months-apr": { "zh-CN": "\u56DB\u6708", en: "Apr" },
|
|
750
|
+
"das-calendar-months-may": { "zh-CN": "\u4E94\u6708", en: "May" },
|
|
751
|
+
"das-calendar-months-jun": { "zh-CN": "\u516D\u6708", en: "Jun" },
|
|
752
|
+
"das-calendar-months-jul": { "zh-CN": "\u4E03\u6708", en: "Jul" },
|
|
753
|
+
"das-calendar-months-aug": { "zh-CN": "\u516B\u6708", en: "Aug" },
|
|
754
|
+
"das-calendar-months-sep": { "zh-CN": "\u4E5D\u6708", en: "Sep" },
|
|
755
|
+
"das-calendar-months-oct": { "zh-CN": "\u5341\u6708", en: "Oct" },
|
|
756
|
+
"das-calendar-months-nov": { "zh-CN": "\u5341\u4E00\u6708", en: "Nov" },
|
|
757
|
+
"das-calendar-months-dec": { "zh-CN": "\u5341\u4E8C\u6708", en: "Dec" }
|
|
758
|
+
};
|
|
759
|
+
|
|
760
|
+
setI18nRule(i18n);
|
|
3985
761
|
setThemeRule(theme);
|
|
3986
|
-
const DasCalendar = withInstall
|
|
762
|
+
const DasCalendar = withInstall(calendar);
|
|
3987
763
|
var index = { name: "calendar \u65E5\u5386" };
|
|
3988
764
|
|
|
3989
765
|
export { DasCalendar, index as default };
|