vuetify-swatches 1.3.10 → 1.4.0
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/dist/index.es.js +33 -2152
- package/dist/index.iife.js +35 -2155
- package/dist/index.umd.js +37 -2157
- package/dist/src/components/VSwatches.vue.d.ts +3 -3
- package/dist/style.css +2 -672
- package/package.json +28 -27
- package/src/components/VSwatches.vue +29 -8
- package/dist/stats.html +0 -6177
package/dist/index.es.js
CHANGED
|
@@ -5,2155 +5,15 @@
|
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
6
|
* @copyright 2022-2023 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 1.
|
|
8
|
+
* @version 1.4.0
|
|
9
9
|
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { defineComponent, ref, watch, openBlock, createBlock, unref, withCtx, createElementBlock, Fragment, renderList, normalizeClass, createTextVNode, toDisplayString, createCommentVNode } from 'vue';
|
|
13
|
+
import { VSheet, VBtn, VIcon } from 'vuetify/components';
|
|
13
14
|
import colors from 'vuetify/lib/util/colors.mjs';
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
const SUPPORTS_INTERSECTION = IN_BROWSER && 'IntersectionObserver' in window;
|
|
17
|
-
IN_BROWSER && typeof CSS !== 'undefined' && typeof CSS.supports !== 'undefined' && CSS.supports('selector(:focus-visible)');
|
|
18
|
-
|
|
19
|
-
// Utilities
|
|
20
|
-
function useResizeObserver(callback) {
|
|
21
|
-
const resizeRef = ref();
|
|
22
|
-
const contentRect = ref();
|
|
23
|
-
if (IN_BROWSER) {
|
|
24
|
-
const observer = new ResizeObserver(entries => {
|
|
25
|
-
callback?.(entries, observer);
|
|
26
|
-
if (!entries.length) return;
|
|
27
|
-
contentRect.value = entries[0].contentRect;
|
|
28
|
-
});
|
|
29
|
-
onBeforeUnmount(() => {
|
|
30
|
-
observer.disconnect();
|
|
31
|
-
});
|
|
32
|
-
watch(resizeRef, (newValue, oldValue) => {
|
|
33
|
-
if (oldValue) {
|
|
34
|
-
observer.unobserve(oldValue);
|
|
35
|
-
contentRect.value = undefined;
|
|
36
|
-
}
|
|
37
|
-
if (newValue) observer.observe(newValue);
|
|
38
|
-
}, {
|
|
39
|
-
flush: 'post'
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
return {
|
|
43
|
-
resizeRef,
|
|
44
|
-
contentRect: readonly(contentRect)
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function deepEqual(a, b) {
|
|
49
|
-
if (a === b) return true;
|
|
50
|
-
if (a instanceof Date && b instanceof Date && a.getTime() !== b.getTime()) {
|
|
51
|
-
// If the values are Date, compare them as timestamps
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
if (a !== Object(a) || b !== Object(b)) {
|
|
55
|
-
// If the values aren't objects, they were already checked for equality
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
const props = Object.keys(a);
|
|
59
|
-
if (props.length !== Object.keys(b).length) {
|
|
60
|
-
// Different number of props, don't bother to check
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
return props.every(p => deepEqual(a[p], b[p]));
|
|
64
|
-
}
|
|
65
|
-
function convertToUnit(str) {
|
|
66
|
-
let unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'px';
|
|
67
|
-
if (str == null || str === '') {
|
|
68
|
-
return undefined;
|
|
69
|
-
} else if (isNaN(+str)) {
|
|
70
|
-
return String(str);
|
|
71
|
-
} else if (!isFinite(+str)) {
|
|
72
|
-
return undefined;
|
|
73
|
-
} else {
|
|
74
|
-
return `${Number(str)}${unit}`;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
function isObject(obj) {
|
|
78
|
-
return obj !== null && typeof obj === 'object' && !Array.isArray(obj);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// KeyboardEvent.keyCode aliases
|
|
82
|
-
const keyCodes = Object.freeze({
|
|
83
|
-
enter: 13,
|
|
84
|
-
tab: 9,
|
|
85
|
-
delete: 46,
|
|
86
|
-
esc: 27,
|
|
87
|
-
space: 32,
|
|
88
|
-
up: 38,
|
|
89
|
-
down: 40,
|
|
90
|
-
left: 37,
|
|
91
|
-
right: 39,
|
|
92
|
-
end: 35,
|
|
93
|
-
home: 36,
|
|
94
|
-
del: 46,
|
|
95
|
-
backspace: 8,
|
|
96
|
-
insert: 45,
|
|
97
|
-
pageup: 33,
|
|
98
|
-
pagedown: 34,
|
|
99
|
-
shift: 16
|
|
100
|
-
});
|
|
101
|
-
function pick(obj, paths) {
|
|
102
|
-
const found = Object.create(null);
|
|
103
|
-
const rest = Object.create(null);
|
|
104
|
-
for (const key in obj) {
|
|
105
|
-
if (paths.some(path => path instanceof RegExp ? path.test(key) : path === key)) {
|
|
106
|
-
found[key] = obj[key];
|
|
107
|
-
} else {
|
|
108
|
-
rest[key] = obj[key];
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return [found, rest];
|
|
112
|
-
}
|
|
113
|
-
function wrapInArray(v) {
|
|
114
|
-
return v == null ? [] : Array.isArray(v) ? v : [v];
|
|
115
|
-
}
|
|
116
|
-
function mergeDeep() {
|
|
117
|
-
let source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
118
|
-
let target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
119
|
-
let arrayFn = arguments.length > 2 ? arguments[2] : undefined;
|
|
120
|
-
const out = {};
|
|
121
|
-
for (const key in source) {
|
|
122
|
-
out[key] = source[key];
|
|
123
|
-
}
|
|
124
|
-
for (const key in target) {
|
|
125
|
-
const sourceProperty = source[key];
|
|
126
|
-
const targetProperty = target[key];
|
|
127
|
-
|
|
128
|
-
// Only continue deep merging if
|
|
129
|
-
// both properties are objects
|
|
130
|
-
if (isObject(sourceProperty) && isObject(targetProperty)) {
|
|
131
|
-
out[key] = mergeDeep(sourceProperty, targetProperty, arrayFn);
|
|
132
|
-
continue;
|
|
133
|
-
}
|
|
134
|
-
if (Array.isArray(sourceProperty) && Array.isArray(targetProperty) && arrayFn) {
|
|
135
|
-
out[key] = arrayFn(sourceProperty, targetProperty);
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
out[key] = targetProperty;
|
|
139
|
-
}
|
|
140
|
-
return out;
|
|
141
|
-
}
|
|
142
|
-
function toKebabCase() {
|
|
143
|
-
let str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
144
|
-
if (toKebabCase.cache.has(str)) return toKebabCase.cache.get(str);
|
|
145
|
-
const kebab = str.replace(/[^a-z]/gi, '-').replace(/\B([A-Z])/g, '-$1').toLowerCase();
|
|
146
|
-
toKebabCase.cache.set(str, kebab);
|
|
147
|
-
return kebab;
|
|
148
|
-
}
|
|
149
|
-
toKebabCase.cache = new Map();
|
|
150
|
-
function findChildrenWithProvide(key, vnode) {
|
|
151
|
-
if (!vnode || typeof vnode !== 'object') return [];
|
|
152
|
-
if (Array.isArray(vnode)) {
|
|
153
|
-
return vnode.map(child => findChildrenWithProvide(key, child)).flat(1);
|
|
154
|
-
} else if (Array.isArray(vnode.children)) {
|
|
155
|
-
return vnode.children.map(child => findChildrenWithProvide(key, child)).flat(1);
|
|
156
|
-
} else if (vnode.component) {
|
|
157
|
-
if (Object.getOwnPropertySymbols(vnode.component.provides).includes(key)) {
|
|
158
|
-
return [vnode.component];
|
|
159
|
-
} else if (vnode.component.subTree) {
|
|
160
|
-
return findChildrenWithProvide(key, vnode.component.subTree).flat(1);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return [];
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// Only allow a single return type
|
|
167
|
-
|
|
168
|
-
function destructComputed(getter) {
|
|
169
|
-
const refs = reactive({});
|
|
170
|
-
const base = computed(getter);
|
|
171
|
-
watchEffect(() => {
|
|
172
|
-
for (const key in base.value) {
|
|
173
|
-
refs[key] = base.value[key];
|
|
174
|
-
}
|
|
175
|
-
}, {
|
|
176
|
-
flush: 'sync'
|
|
177
|
-
});
|
|
178
|
-
return toRefs(refs);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/** Array.includes but value can be any type */
|
|
182
|
-
function includes(arr, val) {
|
|
183
|
-
return arr.includes(val);
|
|
184
|
-
}
|
|
185
|
-
function hasEvent(props, name) {
|
|
186
|
-
name = 'on' + capitalize(name);
|
|
187
|
-
return !!(props[name] || props[`${name}Once`] || props[`${name}Capture`] || props[`${name}OnceCapture`] || props[`${name}CaptureOnce`]);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
const block = ['top', 'bottom'];
|
|
191
|
-
const inline = ['start', 'end', 'left', 'right'];
|
|
192
|
-
/** Parse a raw anchor string into an object */
|
|
193
|
-
function parseAnchor(anchor, isRtl) {
|
|
194
|
-
let [side, align] = anchor.split(' ');
|
|
195
|
-
if (!align) {
|
|
196
|
-
align = includes(block, side) ? 'start' : includes(inline, side) ? 'top' : 'center';
|
|
197
|
-
}
|
|
198
|
-
return {
|
|
199
|
-
side: toPhysical(side, isRtl),
|
|
200
|
-
align: toPhysical(align, isRtl)
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
function toPhysical(str, isRtl) {
|
|
204
|
-
if (str === 'start') return isRtl ? 'right' : 'left';
|
|
205
|
-
if (str === 'end') return isRtl ? 'left' : 'right';
|
|
206
|
-
return str;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/* eslint-disable no-console */
|
|
210
|
-
// import Vuetify from '../framework'
|
|
211
|
-
|
|
212
|
-
function createMessage(message, vm, parent) {
|
|
213
|
-
// if (Vuetify.config.silent) return
|
|
214
|
-
|
|
215
|
-
if (parent) {
|
|
216
|
-
vm = {
|
|
217
|
-
__isVue: true,
|
|
218
|
-
$parent: parent,
|
|
219
|
-
$options: vm
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
if (vm) {
|
|
223
|
-
// Only show each message once per instance
|
|
224
|
-
vm.$_alreadyWarned = vm.$_alreadyWarned || [];
|
|
225
|
-
if (vm.$_alreadyWarned.includes(message)) return;
|
|
226
|
-
vm.$_alreadyWarned.push(message);
|
|
227
|
-
}
|
|
228
|
-
return `[Vuetify] ${message}` + (vm ? generateComponentTrace(vm) : '');
|
|
229
|
-
}
|
|
230
|
-
function consoleWarn(message, vm, parent) {
|
|
231
|
-
const newMessage = createMessage(message, vm, parent);
|
|
232
|
-
newMessage != null && console.warn(newMessage);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Shamelessly stolen from vuejs/vue/blob/dev/src/core/util/debug.js
|
|
237
|
-
*/
|
|
238
|
-
|
|
239
|
-
const classifyRE = /(?:^|[-_])(\w)/g;
|
|
240
|
-
const classify = str => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
|
|
241
|
-
function formatComponentName(vm, includeFile) {
|
|
242
|
-
if (vm.$root === vm) {
|
|
243
|
-
return '<Root>';
|
|
244
|
-
}
|
|
245
|
-
const options = typeof vm === 'function' && vm.cid != null ? vm.options : vm.__isVue ? vm.$options || vm.constructor.options : vm || {};
|
|
246
|
-
let name = options.name || options._componentTag;
|
|
247
|
-
const file = options.__file;
|
|
248
|
-
if (!name && file) {
|
|
249
|
-
const match = file.match(/([^/\\]+)\.vue$/);
|
|
250
|
-
name = match?.[1];
|
|
251
|
-
}
|
|
252
|
-
return (name ? `<${classify(name)}>` : `<Anonymous>`) + (file && includeFile !== false ? ` at ${file}` : '');
|
|
253
|
-
}
|
|
254
|
-
function generateComponentTrace(vm) {
|
|
255
|
-
if (vm.__isVue && vm.$parent) {
|
|
256
|
-
const tree = [];
|
|
257
|
-
let currentRecursiveSequence = 0;
|
|
258
|
-
while (vm) {
|
|
259
|
-
if (tree.length > 0) {
|
|
260
|
-
const last = tree[tree.length - 1];
|
|
261
|
-
if (last.constructor === vm.constructor) {
|
|
262
|
-
currentRecursiveSequence++;
|
|
263
|
-
vm = vm.$parent;
|
|
264
|
-
continue;
|
|
265
|
-
} else if (currentRecursiveSequence > 0) {
|
|
266
|
-
tree[tree.length - 1] = [last, currentRecursiveSequence];
|
|
267
|
-
currentRecursiveSequence = 0;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
tree.push(vm);
|
|
271
|
-
vm = vm.$parent;
|
|
272
|
-
}
|
|
273
|
-
return '\n\nfound in\n\n' + tree.map((vm, i) => `${i === 0 ? '---> ' : ' '.repeat(5 + i * 2)}${Array.isArray(vm)
|
|
274
|
-
// eslint-disable-next-line sonarjs/no-nested-template-literals
|
|
275
|
-
? `${formatComponentName(vm[0])}... (${vm[1]} recursive calls)` : formatComponentName(vm)}`).join('\n');
|
|
276
|
-
} else {
|
|
277
|
-
return `\n\n(found in ${formatComponentName(vm)})`;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
// Utilities
|
|
282
|
-
function isCssColor(color) {
|
|
283
|
-
return !!color && /^(#|var\(--|(rgb|hsl)a?\()/.test(color);
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// Utilities
|
|
287
|
-
function getCurrentInstance(name, message) {
|
|
288
|
-
const vm = getCurrentInstance$1();
|
|
289
|
-
if (!vm) {
|
|
290
|
-
throw new Error(`[Vuetify] ${name} ${message || 'must be called from inside a setup function'}`);
|
|
291
|
-
}
|
|
292
|
-
return vm;
|
|
293
|
-
}
|
|
294
|
-
function getCurrentInstanceName() {
|
|
295
|
-
let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'composables';
|
|
296
|
-
const vm = getCurrentInstance(name).type;
|
|
297
|
-
return toKebabCase(vm?.aliasName || vm?.name);
|
|
298
|
-
}
|
|
299
|
-
let _uid = 0;
|
|
300
|
-
let _map = new WeakMap();
|
|
301
|
-
function getUid() {
|
|
302
|
-
const vm = getCurrentInstance('getUid');
|
|
303
|
-
if (_map.has(vm)) return _map.get(vm);else {
|
|
304
|
-
const uid = _uid++;
|
|
305
|
-
_map.set(vm, uid);
|
|
306
|
-
return uid;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
getUid.reset = () => {
|
|
310
|
-
_uid = 0;
|
|
311
|
-
_map = new WeakMap();
|
|
312
|
-
};
|
|
313
|
-
|
|
314
|
-
function injectSelf(key) {
|
|
315
|
-
const {
|
|
316
|
-
provides
|
|
317
|
-
} = getCurrentInstance('injectSelf');
|
|
318
|
-
if (provides && key in provides) {
|
|
319
|
-
// TS doesn't allow symbol as index type
|
|
320
|
-
return provides[key];
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* Creates a factory function for props definitions.
|
|
326
|
-
* This is used to define props in a composable then override
|
|
327
|
-
* default values in an implementing component.
|
|
328
|
-
*
|
|
329
|
-
* @example Simplified signature
|
|
330
|
-
* (props: Props) => (defaults?: Record<keyof props, any>) => Props
|
|
331
|
-
*
|
|
332
|
-
* @example Usage
|
|
333
|
-
* const makeProps = propsFactory({
|
|
334
|
-
* foo: String,
|
|
335
|
-
* })
|
|
336
|
-
*
|
|
337
|
-
* defineComponent({
|
|
338
|
-
* props: {
|
|
339
|
-
* ...makeProps({
|
|
340
|
-
* foo: 'a',
|
|
341
|
-
* }),
|
|
342
|
-
* },
|
|
343
|
-
* setup (props) {
|
|
344
|
-
* // would be "string | undefined", now "string" because a default has been provided
|
|
345
|
-
* props.foo
|
|
346
|
-
* },
|
|
347
|
-
* }
|
|
348
|
-
*/
|
|
349
|
-
|
|
350
|
-
function propsFactory(props, source) {
|
|
351
|
-
return defaults => {
|
|
352
|
-
return Object.keys(props).reduce((obj, prop) => {
|
|
353
|
-
const isObjectDefinition = typeof props[prop] === 'object' && props[prop] != null && !Array.isArray(props[prop]);
|
|
354
|
-
const definition = isObjectDefinition ? props[prop] : {
|
|
355
|
-
type: props[prop]
|
|
356
|
-
};
|
|
357
|
-
if (defaults && prop in defaults) {
|
|
358
|
-
obj[prop] = {
|
|
359
|
-
...definition,
|
|
360
|
-
default: defaults[prop]
|
|
361
|
-
};
|
|
362
|
-
} else {
|
|
363
|
-
obj[prop] = definition;
|
|
364
|
-
}
|
|
365
|
-
if (source && !obj[prop].source) {
|
|
366
|
-
obj[prop].source = source;
|
|
367
|
-
}
|
|
368
|
-
return obj;
|
|
369
|
-
}, {});
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
// Utilities
|
|
374
|
-
const DefaultsSymbol = Symbol.for('vuetify:defaults');
|
|
375
|
-
function useDefaults() {
|
|
376
|
-
const defaults = inject(DefaultsSymbol);
|
|
377
|
-
if (!defaults) throw new Error('[Vuetify] Could not find defaults instance');
|
|
378
|
-
return defaults;
|
|
379
|
-
}
|
|
380
|
-
function provideDefaults(defaults, options) {
|
|
381
|
-
const injectedDefaults = useDefaults();
|
|
382
|
-
const providedDefaults = ref(defaults);
|
|
383
|
-
const newDefaults = computed(() => {
|
|
384
|
-
const disabled = unref(options?.disabled);
|
|
385
|
-
if (disabled) return injectedDefaults.value;
|
|
386
|
-
const scoped = unref(options?.scoped);
|
|
387
|
-
const reset = unref(options?.reset);
|
|
388
|
-
const root = unref(options?.root);
|
|
389
|
-
let properties = mergeDeep(providedDefaults.value, {
|
|
390
|
-
prev: injectedDefaults.value
|
|
391
|
-
});
|
|
392
|
-
if (scoped) return properties;
|
|
393
|
-
if (reset || root) {
|
|
394
|
-
const len = Number(reset || Infinity);
|
|
395
|
-
for (let i = 0; i <= len; i++) {
|
|
396
|
-
if (!properties || !('prev' in properties)) {
|
|
397
|
-
break;
|
|
398
|
-
}
|
|
399
|
-
properties = properties.prev;
|
|
400
|
-
}
|
|
401
|
-
return properties;
|
|
402
|
-
}
|
|
403
|
-
return properties.prev ? mergeDeep(properties.prev, properties) : properties;
|
|
404
|
-
});
|
|
405
|
-
provide(DefaultsSymbol, newDefaults);
|
|
406
|
-
return newDefaults;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
function useToggleScope(source, fn) {
|
|
410
|
-
let scope;
|
|
411
|
-
function start() {
|
|
412
|
-
scope = effectScope();
|
|
413
|
-
scope.run(() => fn.length ? fn(() => {
|
|
414
|
-
scope?.stop();
|
|
415
|
-
start();
|
|
416
|
-
}) : fn());
|
|
417
|
-
}
|
|
418
|
-
watch(source, active => {
|
|
419
|
-
if (active && !scope) {
|
|
420
|
-
start();
|
|
421
|
-
} else if (!active) {
|
|
422
|
-
scope?.stop();
|
|
423
|
-
scope = undefined;
|
|
424
|
-
}
|
|
425
|
-
}, {
|
|
426
|
-
immediate: true
|
|
427
|
-
});
|
|
428
|
-
onScopeDispose(() => {
|
|
429
|
-
scope?.stop();
|
|
430
|
-
});
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
// Utils
|
|
434
|
-
function propIsDefined(vnode, prop) {
|
|
435
|
-
return typeof vnode.props?.[prop] !== 'undefined' || typeof vnode.props?.[toKebabCase(prop)] !== 'undefined';
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
// No props
|
|
439
|
-
|
|
440
|
-
// Implementation
|
|
441
|
-
function defineComponent(options) {
|
|
442
|
-
options._setup = options._setup ?? options.setup;
|
|
443
|
-
if (!options.name) {
|
|
444
|
-
consoleWarn('The component is missing an explicit name, unable to generate default prop value');
|
|
445
|
-
return options;
|
|
446
|
-
}
|
|
447
|
-
if (options._setup) {
|
|
448
|
-
options.props = propsFactory(options.props ?? {}, toKebabCase(options.name))();
|
|
449
|
-
const propKeys = Object.keys(options.props);
|
|
450
|
-
options.filterProps = function filterProps(props) {
|
|
451
|
-
return pick(props, propKeys);
|
|
452
|
-
};
|
|
453
|
-
options.props._as = String;
|
|
454
|
-
options.setup = function setup(props, ctx) {
|
|
455
|
-
const defaults = useDefaults();
|
|
456
|
-
|
|
457
|
-
// Skip props proxy if defaults are not provided
|
|
458
|
-
if (!defaults.value) return options._setup(props, ctx);
|
|
459
|
-
const vm = getCurrentInstance$1();
|
|
460
|
-
const componentDefaults = computed(() => defaults.value[props._as ?? options.name]);
|
|
461
|
-
const _props = new Proxy(props, {
|
|
462
|
-
get(target, prop) {
|
|
463
|
-
const propValue = Reflect.get(target, prop);
|
|
464
|
-
if (typeof prop === 'string' && !propIsDefined(vm.vnode, prop)) {
|
|
465
|
-
return componentDefaults.value?.[prop] ?? defaults.value.global?.[prop] ?? propValue;
|
|
466
|
-
}
|
|
467
|
-
return propValue;
|
|
468
|
-
}
|
|
469
|
-
});
|
|
470
|
-
const _subcomponentDefaults = shallowRef();
|
|
471
|
-
watchEffect(() => {
|
|
472
|
-
if (componentDefaults.value) {
|
|
473
|
-
const subComponents = Object.entries(componentDefaults.value).filter(_ref => {
|
|
474
|
-
let [key] = _ref;
|
|
475
|
-
return key.startsWith(key[0].toUpperCase());
|
|
476
|
-
});
|
|
477
|
-
if (subComponents.length) _subcomponentDefaults.value = Object.fromEntries(subComponents);
|
|
478
|
-
}
|
|
479
|
-
});
|
|
480
|
-
const setupBindings = options._setup(_props, ctx);
|
|
481
|
-
|
|
482
|
-
// If subcomponent defaults are provided, override any
|
|
483
|
-
// subcomponents provided by the component's setup function.
|
|
484
|
-
// This uses injectSelf so must be done after the original setup to work.
|
|
485
|
-
useToggleScope(_subcomponentDefaults, () => {
|
|
486
|
-
provideDefaults(mergeDeep(injectSelf(DefaultsSymbol)?.value ?? {}, _subcomponentDefaults.value));
|
|
487
|
-
});
|
|
488
|
-
return setupBindings;
|
|
489
|
-
};
|
|
490
|
-
}
|
|
491
|
-
return options;
|
|
492
|
-
}
|
|
493
|
-
// Implementation
|
|
494
|
-
function genericComponent() {
|
|
495
|
-
let exposeDefaults = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
496
|
-
return options => (exposeDefaults ? defineComponent : defineComponent$1)(options);
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
// Utilities
|
|
500
|
-
function useRender(render) {
|
|
501
|
-
const vm = getCurrentInstance('useRender');
|
|
502
|
-
vm.render = render;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
// Utilities
|
|
506
|
-
const ThemeSymbol = Symbol.for('vuetify:theme');
|
|
507
|
-
const makeThemeProps = propsFactory({
|
|
508
|
-
theme: String
|
|
509
|
-
}, 'theme');
|
|
510
|
-
function provideTheme(props) {
|
|
511
|
-
getCurrentInstance('provideTheme');
|
|
512
|
-
const theme = inject(ThemeSymbol, null);
|
|
513
|
-
if (!theme) throw new Error('Could not find Vuetify theme injection');
|
|
514
|
-
const name = computed(() => {
|
|
515
|
-
return props.theme ?? theme?.name.value;
|
|
516
|
-
});
|
|
517
|
-
const themeClasses = computed(() => theme.isDisabled ? undefined : `v-theme--${name.value}`);
|
|
518
|
-
const newTheme = {
|
|
519
|
-
...theme,
|
|
520
|
-
name,
|
|
521
|
-
themeClasses
|
|
522
|
-
};
|
|
523
|
-
provide(ThemeSymbol, newTheme);
|
|
524
|
-
return newTheme;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
// Utilities
|
|
528
|
-
// Composables
|
|
529
|
-
function useProxiedModel(props, prop, defaultValue) {
|
|
530
|
-
let transformIn = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : v => v;
|
|
531
|
-
let transformOut = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : v => v;
|
|
532
|
-
const vm = getCurrentInstance('useProxiedModel');
|
|
533
|
-
const internal = ref(props[prop] !== undefined ? props[prop] : defaultValue);
|
|
534
|
-
const kebabProp = toKebabCase(prop);
|
|
535
|
-
const checkKebab = kebabProp !== prop;
|
|
536
|
-
const isControlled = checkKebab ? computed(() => {
|
|
537
|
-
void props[prop];
|
|
538
|
-
return !!((vm.vnode.props?.hasOwnProperty(prop) || vm.vnode.props?.hasOwnProperty(kebabProp)) && (vm.vnode.props?.hasOwnProperty(`onUpdate:${prop}`) || vm.vnode.props?.hasOwnProperty(`onUpdate:${kebabProp}`)));
|
|
539
|
-
}) : computed(() => {
|
|
540
|
-
void props[prop];
|
|
541
|
-
return !!(vm.vnode.props?.hasOwnProperty(prop) && vm.vnode.props?.hasOwnProperty(`onUpdate:${prop}`));
|
|
542
|
-
});
|
|
543
|
-
useToggleScope(() => !isControlled.value, () => {
|
|
544
|
-
watch(() => props[prop], val => {
|
|
545
|
-
internal.value = val;
|
|
546
|
-
});
|
|
547
|
-
});
|
|
548
|
-
const model = computed({
|
|
549
|
-
get() {
|
|
550
|
-
return transformIn(isControlled.value ? props[prop] : internal.value);
|
|
551
|
-
},
|
|
552
|
-
set(internalValue) {
|
|
553
|
-
const newValue = transformOut(internalValue);
|
|
554
|
-
const value = toRaw(isControlled.value ? props[prop] : internal.value);
|
|
555
|
-
if (value === newValue || transformIn(value) === internalValue) {
|
|
556
|
-
return;
|
|
557
|
-
}
|
|
558
|
-
internal.value = newValue;
|
|
559
|
-
vm?.emit(`update:${prop}`, newValue);
|
|
560
|
-
}
|
|
561
|
-
});
|
|
562
|
-
Object.defineProperty(model, 'externalValue', {
|
|
563
|
-
get: () => isControlled.value ? props[prop] : internal.value
|
|
564
|
-
});
|
|
565
|
-
return model;
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
const LocaleSymbol = Symbol.for('vuetify:locale');
|
|
569
|
-
function useRtl() {
|
|
570
|
-
const locale = inject(LocaleSymbol);
|
|
571
|
-
if (!locale) throw new Error('[Vuetify] Could not find injected rtl instance');
|
|
572
|
-
return {
|
|
573
|
-
isRtl: locale.isRtl,
|
|
574
|
-
rtlClasses: locale.rtlClasses
|
|
575
|
-
};
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
// Composables
|
|
579
|
-
const VDefaultsProvider = genericComponent(false)({
|
|
580
|
-
name: 'VDefaultsProvider',
|
|
581
|
-
props: {
|
|
582
|
-
defaults: Object,
|
|
583
|
-
disabled: Boolean,
|
|
584
|
-
reset: [Number, String],
|
|
585
|
-
root: Boolean,
|
|
586
|
-
scoped: Boolean
|
|
587
|
-
},
|
|
588
|
-
setup(props, _ref) {
|
|
589
|
-
let {
|
|
590
|
-
slots
|
|
591
|
-
} = _ref;
|
|
592
|
-
const {
|
|
593
|
-
defaults,
|
|
594
|
-
disabled,
|
|
595
|
-
reset,
|
|
596
|
-
root,
|
|
597
|
-
scoped
|
|
598
|
-
} = toRefs(props);
|
|
599
|
-
provideDefaults(defaults, {
|
|
600
|
-
reset,
|
|
601
|
-
root,
|
|
602
|
-
scoped,
|
|
603
|
-
disabled
|
|
604
|
-
});
|
|
605
|
-
return () => slots.default?.();
|
|
606
|
-
}
|
|
607
|
-
});
|
|
608
|
-
|
|
609
|
-
// Utilities
|
|
610
|
-
// Composables
|
|
611
|
-
const makeDimensionProps = propsFactory({
|
|
612
|
-
height: [Number, String],
|
|
613
|
-
maxHeight: [Number, String],
|
|
614
|
-
maxWidth: [Number, String],
|
|
615
|
-
minHeight: [Number, String],
|
|
616
|
-
minWidth: [Number, String],
|
|
617
|
-
width: [Number, String]
|
|
618
|
-
}, 'dimension');
|
|
619
|
-
function useDimension(props) {
|
|
620
|
-
const dimensionStyles = computed(() => ({
|
|
621
|
-
height: convertToUnit(props.height),
|
|
622
|
-
maxHeight: convertToUnit(props.maxHeight),
|
|
623
|
-
maxWidth: convertToUnit(props.maxWidth),
|
|
624
|
-
minHeight: convertToUnit(props.minHeight),
|
|
625
|
-
minWidth: convertToUnit(props.minWidth),
|
|
626
|
-
width: convertToUnit(props.width)
|
|
627
|
-
}));
|
|
628
|
-
return {
|
|
629
|
-
dimensionStyles
|
|
630
|
-
};
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
// Utilities
|
|
634
|
-
// Composables
|
|
635
|
-
const makeTagProps = propsFactory({
|
|
636
|
-
tag: {
|
|
637
|
-
type: String,
|
|
638
|
-
default: 'div'
|
|
639
|
-
}
|
|
640
|
-
}, 'tag');
|
|
641
|
-
|
|
642
|
-
// Utilities
|
|
643
|
-
// Composables
|
|
644
|
-
const makeBorderProps = propsFactory({
|
|
645
|
-
border: [Boolean, Number, String]
|
|
646
|
-
}, 'border');
|
|
647
|
-
function useBorder(props) {
|
|
648
|
-
let name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getCurrentInstanceName();
|
|
649
|
-
const borderClasses = computed(() => {
|
|
650
|
-
const border = isRef(props) ? props.value : props.border;
|
|
651
|
-
const classes = [];
|
|
652
|
-
if (border === true || border === '') {
|
|
653
|
-
classes.push(`${name}--border`);
|
|
654
|
-
} else if (typeof border === 'string' || border === 0) {
|
|
655
|
-
for (const value of String(border).split(' ')) {
|
|
656
|
-
classes.push(`border-${value}`);
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
return classes;
|
|
660
|
-
});
|
|
661
|
-
return {
|
|
662
|
-
borderClasses
|
|
663
|
-
};
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
// Utilities
|
|
667
|
-
// Composables
|
|
668
|
-
const makeElevationProps = propsFactory({
|
|
669
|
-
elevation: {
|
|
670
|
-
type: [Number, String],
|
|
671
|
-
validator(v) {
|
|
672
|
-
const value = parseInt(v);
|
|
673
|
-
return !isNaN(value) && value >= 0 &&
|
|
674
|
-
// Material Design has a maximum elevation of 24
|
|
675
|
-
// https://material.io/design/environment/elevation.html#default-elevations
|
|
676
|
-
value <= 24;
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
}, 'elevation');
|
|
680
|
-
function useElevation(props) {
|
|
681
|
-
const elevationClasses = computed(() => {
|
|
682
|
-
const elevation = isRef(props) ? props.value : props.elevation;
|
|
683
|
-
const classes = [];
|
|
684
|
-
if (elevation == null) return classes;
|
|
685
|
-
classes.push(`elevation-${elevation}`);
|
|
686
|
-
return classes;
|
|
687
|
-
});
|
|
688
|
-
return {
|
|
689
|
-
elevationClasses
|
|
690
|
-
};
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
// Utilities
|
|
694
|
-
// Composables
|
|
695
|
-
const makeRoundedProps = propsFactory({
|
|
696
|
-
rounded: {
|
|
697
|
-
type: [Boolean, Number, String],
|
|
698
|
-
default: undefined
|
|
699
|
-
}
|
|
700
|
-
}, 'rounded');
|
|
701
|
-
function useRounded(props) {
|
|
702
|
-
let name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getCurrentInstanceName();
|
|
703
|
-
const roundedClasses = computed(() => {
|
|
704
|
-
const rounded = isRef(props) ? props.value : props.rounded;
|
|
705
|
-
const classes = [];
|
|
706
|
-
if (rounded === true || rounded === '') {
|
|
707
|
-
classes.push(`${name}--rounded`);
|
|
708
|
-
} else if (typeof rounded === 'string' || rounded === 0) {
|
|
709
|
-
for (const value of String(rounded).split(' ')) {
|
|
710
|
-
classes.push(`rounded-${value}`);
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
return classes;
|
|
714
|
-
});
|
|
715
|
-
return {
|
|
716
|
-
roundedClasses
|
|
717
|
-
};
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
// Utilities
|
|
721
|
-
// Composables
|
|
722
|
-
function useColor(colors) {
|
|
723
|
-
return destructComputed(() => {
|
|
724
|
-
const classes = [];
|
|
725
|
-
const styles = {};
|
|
726
|
-
if (colors.value.background) {
|
|
727
|
-
if (isCssColor(colors.value.background)) {
|
|
728
|
-
styles.backgroundColor = colors.value.background;
|
|
729
|
-
} else {
|
|
730
|
-
classes.push(`bg-${colors.value.background}`);
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
if (colors.value.text) {
|
|
734
|
-
if (isCssColor(colors.value.text)) {
|
|
735
|
-
styles.color = colors.value.text;
|
|
736
|
-
styles.caretColor = colors.value.text;
|
|
737
|
-
} else {
|
|
738
|
-
classes.push(`text-${colors.value.text}`);
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
return {
|
|
742
|
-
colorClasses: classes,
|
|
743
|
-
colorStyles: styles
|
|
744
|
-
};
|
|
745
|
-
});
|
|
746
|
-
}
|
|
747
|
-
function useTextColor(props, name) {
|
|
748
|
-
const colors = computed(() => ({
|
|
749
|
-
text: isRef(props) ? props.value : name ? props[name] : null
|
|
750
|
-
}));
|
|
751
|
-
const {
|
|
752
|
-
colorClasses: textColorClasses,
|
|
753
|
-
colorStyles: textColorStyles
|
|
754
|
-
} = useColor(colors);
|
|
755
|
-
return {
|
|
756
|
-
textColorClasses,
|
|
757
|
-
textColorStyles
|
|
758
|
-
};
|
|
759
|
-
}
|
|
760
|
-
function useBackgroundColor(props, name) {
|
|
761
|
-
const colors = computed(() => ({
|
|
762
|
-
background: isRef(props) ? props.value : name ? props[name] : null
|
|
763
|
-
}));
|
|
764
|
-
const {
|
|
765
|
-
colorClasses: backgroundColorClasses,
|
|
766
|
-
colorStyles: backgroundColorStyles
|
|
767
|
-
} = useColor(colors);
|
|
768
|
-
return {
|
|
769
|
-
backgroundColorClasses,
|
|
770
|
-
backgroundColorStyles
|
|
771
|
-
};
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
var VBtn$1 = '';
|
|
775
|
-
|
|
776
|
-
var VBtnToggle = '';
|
|
777
|
-
|
|
778
|
-
var VBtnGroup$1 = '';
|
|
779
|
-
|
|
780
|
-
// Utilities
|
|
781
|
-
const allowedDensities = [null, 'default', 'comfortable', 'compact'];
|
|
782
|
-
|
|
783
|
-
// typeof allowedDensities[number] evalutes to any
|
|
784
|
-
// when generating api types for whatever reason.
|
|
785
|
-
|
|
786
|
-
// Composables
|
|
787
|
-
const makeDensityProps = propsFactory({
|
|
788
|
-
density: {
|
|
789
|
-
type: String,
|
|
790
|
-
default: 'default',
|
|
791
|
-
validator: v => allowedDensities.includes(v)
|
|
792
|
-
}
|
|
793
|
-
}, 'density');
|
|
794
|
-
function useDensity(props) {
|
|
795
|
-
let name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getCurrentInstanceName();
|
|
796
|
-
const densityClasses = computed(() => {
|
|
797
|
-
return `${name}--density-${props.density}`;
|
|
798
|
-
});
|
|
799
|
-
return {
|
|
800
|
-
densityClasses
|
|
801
|
-
};
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
const allowedVariants = ['elevated', 'flat', 'tonal', 'outlined', 'text', 'plain'];
|
|
805
|
-
function genOverlays(isClickable, name) {
|
|
806
|
-
return createVNode(Fragment, null, [isClickable && createVNode("span", {
|
|
807
|
-
"key": "overlay",
|
|
808
|
-
"class": `${name}__overlay`
|
|
809
|
-
}, null), createVNode("span", {
|
|
810
|
-
"key": "underlay",
|
|
811
|
-
"class": `${name}__underlay`
|
|
812
|
-
}, null)]);
|
|
813
|
-
}
|
|
814
|
-
const makeVariantProps = propsFactory({
|
|
815
|
-
color: String,
|
|
816
|
-
variant: {
|
|
817
|
-
type: String,
|
|
818
|
-
default: 'elevated',
|
|
819
|
-
validator: v => allowedVariants.includes(v)
|
|
820
|
-
}
|
|
821
|
-
}, 'variant');
|
|
822
|
-
function useVariant(props) {
|
|
823
|
-
let name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getCurrentInstanceName();
|
|
824
|
-
const variantClasses = computed(() => {
|
|
825
|
-
const {
|
|
826
|
-
variant
|
|
827
|
-
} = unref(props);
|
|
828
|
-
return `${name}--variant-${variant}`;
|
|
829
|
-
});
|
|
830
|
-
const {
|
|
831
|
-
colorClasses,
|
|
832
|
-
colorStyles
|
|
833
|
-
} = useColor(computed(() => {
|
|
834
|
-
const {
|
|
835
|
-
variant,
|
|
836
|
-
color
|
|
837
|
-
} = unref(props);
|
|
838
|
-
return {
|
|
839
|
-
[['elevated', 'flat'].includes(variant) ? 'background' : 'text']: color
|
|
840
|
-
};
|
|
841
|
-
}));
|
|
842
|
-
return {
|
|
843
|
-
colorClasses,
|
|
844
|
-
colorStyles,
|
|
845
|
-
variantClasses
|
|
846
|
-
};
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
const makeVBtnGroupProps = propsFactory({
|
|
850
|
-
divided: Boolean,
|
|
851
|
-
...makeBorderProps(),
|
|
852
|
-
...makeDensityProps(),
|
|
853
|
-
...makeElevationProps(),
|
|
854
|
-
...makeRoundedProps(),
|
|
855
|
-
...makeTagProps(),
|
|
856
|
-
...makeThemeProps(),
|
|
857
|
-
...makeVariantProps()
|
|
858
|
-
}, 'v-btn-group');
|
|
859
|
-
const VBtnGroup = genericComponent()({
|
|
860
|
-
name: 'VBtnGroup',
|
|
861
|
-
props: makeVBtnGroupProps(),
|
|
862
|
-
setup(props, _ref) {
|
|
863
|
-
let {
|
|
864
|
-
slots
|
|
865
|
-
} = _ref;
|
|
866
|
-
const {
|
|
867
|
-
themeClasses
|
|
868
|
-
} = provideTheme(props);
|
|
869
|
-
const {
|
|
870
|
-
densityClasses
|
|
871
|
-
} = useDensity(props);
|
|
872
|
-
const {
|
|
873
|
-
borderClasses
|
|
874
|
-
} = useBorder(props);
|
|
875
|
-
const {
|
|
876
|
-
elevationClasses
|
|
877
|
-
} = useElevation(props);
|
|
878
|
-
const {
|
|
879
|
-
roundedClasses
|
|
880
|
-
} = useRounded(props);
|
|
881
|
-
provideDefaults({
|
|
882
|
-
VBtn: {
|
|
883
|
-
height: 'auto',
|
|
884
|
-
color: toRef(props, 'color'),
|
|
885
|
-
density: toRef(props, 'density'),
|
|
886
|
-
flat: true,
|
|
887
|
-
variant: toRef(props, 'variant')
|
|
888
|
-
}
|
|
889
|
-
});
|
|
890
|
-
useRender(() => {
|
|
891
|
-
return createVNode(props.tag, {
|
|
892
|
-
"class": ['v-btn-group', {
|
|
893
|
-
'v-btn-group--divided': props.divided
|
|
894
|
-
}, themeClasses.value, borderClasses.value, densityClasses.value, elevationClasses.value, roundedClasses.value]
|
|
895
|
-
}, slots);
|
|
896
|
-
});
|
|
897
|
-
}
|
|
898
|
-
});
|
|
899
|
-
|
|
900
|
-
// Composables
|
|
901
|
-
const makeGroupProps = propsFactory({
|
|
902
|
-
modelValue: {
|
|
903
|
-
type: null,
|
|
904
|
-
default: undefined
|
|
905
|
-
},
|
|
906
|
-
multiple: Boolean,
|
|
907
|
-
mandatory: [Boolean, String],
|
|
908
|
-
max: Number,
|
|
909
|
-
selectedClass: String,
|
|
910
|
-
disabled: Boolean
|
|
911
|
-
}, 'group');
|
|
912
|
-
const makeGroupItemProps = propsFactory({
|
|
913
|
-
value: null,
|
|
914
|
-
disabled: Boolean,
|
|
915
|
-
selectedClass: String
|
|
916
|
-
}, 'group-item');
|
|
917
|
-
function useGroupItem(props, injectKey) {
|
|
918
|
-
let required = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
919
|
-
const vm = getCurrentInstance('useGroupItem');
|
|
920
|
-
if (!vm) {
|
|
921
|
-
throw new Error('[Vuetify] useGroupItem composable must be used inside a component setup function');
|
|
922
|
-
}
|
|
923
|
-
const id = getUid();
|
|
924
|
-
provide(Symbol.for(`${injectKey.description}:id`), id);
|
|
925
|
-
const group = inject(injectKey, null);
|
|
926
|
-
if (!group) {
|
|
927
|
-
if (!required) return group;
|
|
928
|
-
throw new Error(`[Vuetify] Could not find useGroup injection with symbol ${injectKey.description}`);
|
|
929
|
-
}
|
|
930
|
-
const value = toRef(props, 'value');
|
|
931
|
-
const disabled = computed(() => group.disabled.value || props.disabled);
|
|
932
|
-
group.register({
|
|
933
|
-
id,
|
|
934
|
-
value,
|
|
935
|
-
disabled
|
|
936
|
-
}, vm);
|
|
937
|
-
onBeforeUnmount(() => {
|
|
938
|
-
group.unregister(id);
|
|
939
|
-
});
|
|
940
|
-
const isSelected = computed(() => {
|
|
941
|
-
return group.isSelected(id);
|
|
942
|
-
});
|
|
943
|
-
const selectedClass = computed(() => isSelected.value && [group.selectedClass.value, props.selectedClass]);
|
|
944
|
-
watch(isSelected, value => {
|
|
945
|
-
vm.emit('group:selected', {
|
|
946
|
-
value
|
|
947
|
-
});
|
|
948
|
-
});
|
|
949
|
-
return {
|
|
950
|
-
id,
|
|
951
|
-
isSelected,
|
|
952
|
-
toggle: () => group.select(id, !isSelected.value),
|
|
953
|
-
select: value => group.select(id, value),
|
|
954
|
-
selectedClass,
|
|
955
|
-
value,
|
|
956
|
-
disabled,
|
|
957
|
-
group
|
|
958
|
-
};
|
|
959
|
-
}
|
|
960
|
-
function useGroup(props, injectKey) {
|
|
961
|
-
let isUnmounted = false;
|
|
962
|
-
const items = reactive([]);
|
|
963
|
-
const selected = useProxiedModel(props, 'modelValue', [], v => {
|
|
964
|
-
if (v == null) return [];
|
|
965
|
-
return getIds(items, wrapInArray(v));
|
|
966
|
-
}, v => {
|
|
967
|
-
const arr = getValues(items, v);
|
|
968
|
-
return props.multiple ? arr : arr[0];
|
|
969
|
-
});
|
|
970
|
-
const groupVm = getCurrentInstance('useGroup');
|
|
971
|
-
function register(item, vm) {
|
|
972
|
-
// Is there a better way to fix this typing?
|
|
973
|
-
const unwrapped = item;
|
|
974
|
-
const key = Symbol.for(`${injectKey.description}:id`);
|
|
975
|
-
const children = findChildrenWithProvide(key, groupVm?.vnode);
|
|
976
|
-
const index = children.indexOf(vm);
|
|
977
|
-
if (index > -1) {
|
|
978
|
-
items.splice(index, 0, unwrapped);
|
|
979
|
-
} else {
|
|
980
|
-
items.push(unwrapped);
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
function unregister(id) {
|
|
984
|
-
if (isUnmounted) return;
|
|
985
|
-
|
|
986
|
-
// TODO: re-evaluate this line's importance in the future
|
|
987
|
-
// should we only modify the model if mandatory is set.
|
|
988
|
-
// selected.value = selected.value.filter(v => v !== id)
|
|
989
|
-
|
|
990
|
-
forceMandatoryValue();
|
|
991
|
-
const index = items.findIndex(item => item.id === id);
|
|
992
|
-
items.splice(index, 1);
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
// If mandatory and nothing is selected, then select first non-disabled item
|
|
996
|
-
function forceMandatoryValue() {
|
|
997
|
-
const item = items.find(item => !item.disabled);
|
|
998
|
-
if (item && props.mandatory === 'force' && !selected.value.length) {
|
|
999
|
-
selected.value = [item.id];
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
onMounted(() => {
|
|
1003
|
-
forceMandatoryValue();
|
|
1004
|
-
});
|
|
1005
|
-
onBeforeUnmount(() => {
|
|
1006
|
-
isUnmounted = true;
|
|
1007
|
-
});
|
|
1008
|
-
function select(id, value) {
|
|
1009
|
-
const item = items.find(item => item.id === id);
|
|
1010
|
-
if (value && item?.disabled) return;
|
|
1011
|
-
if (props.multiple) {
|
|
1012
|
-
const internalValue = selected.value.slice();
|
|
1013
|
-
const index = internalValue.findIndex(v => v === id);
|
|
1014
|
-
const isSelected = ~index;
|
|
1015
|
-
value = value ?? !isSelected;
|
|
1016
|
-
|
|
1017
|
-
// We can't remove value if group is
|
|
1018
|
-
// mandatory, value already exists,
|
|
1019
|
-
// and it is the only value
|
|
1020
|
-
if (isSelected && props.mandatory && internalValue.length <= 1) return;
|
|
1021
|
-
|
|
1022
|
-
// We can't add value if it would
|
|
1023
|
-
// cause max limit to be exceeded
|
|
1024
|
-
if (!isSelected && props.max != null && internalValue.length + 1 > props.max) return;
|
|
1025
|
-
if (index < 0 && value) internalValue.push(id);else if (index >= 0 && !value) internalValue.splice(index, 1);
|
|
1026
|
-
selected.value = internalValue;
|
|
1027
|
-
} else {
|
|
1028
|
-
const isSelected = selected.value.includes(id);
|
|
1029
|
-
if (props.mandatory && isSelected) return;
|
|
1030
|
-
selected.value = value ?? !isSelected ? [id] : [];
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
function step(offset) {
|
|
1034
|
-
// getting an offset from selected value obviously won't work with multiple values
|
|
1035
|
-
if (props.multiple) consoleWarn('This method is not supported when using "multiple" prop');
|
|
1036
|
-
if (!selected.value.length) {
|
|
1037
|
-
const item = items.find(item => !item.disabled);
|
|
1038
|
-
item && (selected.value = [item.id]);
|
|
1039
|
-
} else {
|
|
1040
|
-
const currentId = selected.value[0];
|
|
1041
|
-
const currentIndex = items.findIndex(i => i.id === currentId);
|
|
1042
|
-
let newIndex = (currentIndex + offset) % items.length;
|
|
1043
|
-
let newItem = items[newIndex];
|
|
1044
|
-
while (newItem.disabled && newIndex !== currentIndex) {
|
|
1045
|
-
newIndex = (newIndex + offset) % items.length;
|
|
1046
|
-
newItem = items[newIndex];
|
|
1047
|
-
}
|
|
1048
|
-
if (newItem.disabled) return;
|
|
1049
|
-
selected.value = [items[newIndex].id];
|
|
1050
|
-
}
|
|
1051
|
-
}
|
|
1052
|
-
const state = {
|
|
1053
|
-
register,
|
|
1054
|
-
unregister,
|
|
1055
|
-
selected,
|
|
1056
|
-
select,
|
|
1057
|
-
disabled: toRef(props, 'disabled'),
|
|
1058
|
-
prev: () => step(items.length - 1),
|
|
1059
|
-
next: () => step(1),
|
|
1060
|
-
isSelected: id => selected.value.includes(id),
|
|
1061
|
-
selectedClass: computed(() => props.selectedClass),
|
|
1062
|
-
items: computed(() => items),
|
|
1063
|
-
getItemIndex: value => getItemIndex(items, value)
|
|
1064
|
-
};
|
|
1065
|
-
provide(injectKey, state);
|
|
1066
|
-
return state;
|
|
1067
|
-
}
|
|
1068
|
-
function getItemIndex(items, value) {
|
|
1069
|
-
const ids = getIds(items, [value]);
|
|
1070
|
-
if (!ids.length) return -1;
|
|
1071
|
-
return items.findIndex(item => item.id === ids[0]);
|
|
1072
|
-
}
|
|
1073
|
-
function getIds(items, modelValue) {
|
|
1074
|
-
const ids = [];
|
|
1075
|
-
for (let i = 0; i < items.length; i++) {
|
|
1076
|
-
const item = items[i];
|
|
1077
|
-
if (item.value != null) {
|
|
1078
|
-
if (modelValue.find(value => deepEqual(value, item.value)) != null) {
|
|
1079
|
-
ids.push(item.id);
|
|
1080
|
-
}
|
|
1081
|
-
} else if (modelValue.includes(i)) {
|
|
1082
|
-
ids.push(item.id);
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
return ids;
|
|
1086
|
-
}
|
|
1087
|
-
function getValues(items, ids) {
|
|
1088
|
-
const values = [];
|
|
1089
|
-
for (let i = 0; i < items.length; i++) {
|
|
1090
|
-
const item = items[i];
|
|
1091
|
-
if (ids.includes(item.id)) {
|
|
1092
|
-
values.push(item.value != null ? item.value : i);
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
return values;
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
const VBtnToggleSymbol = Symbol.for('vuetify:v-btn-toggle');
|
|
1099
|
-
genericComponent()({
|
|
1100
|
-
name: 'VBtnToggle',
|
|
1101
|
-
props: {
|
|
1102
|
-
...makeVBtnGroupProps(),
|
|
1103
|
-
...makeGroupProps()
|
|
1104
|
-
},
|
|
1105
|
-
emits: {
|
|
1106
|
-
'update:modelValue': value => true
|
|
1107
|
-
},
|
|
1108
|
-
setup(props, _ref) {
|
|
1109
|
-
let {
|
|
1110
|
-
slots
|
|
1111
|
-
} = _ref;
|
|
1112
|
-
const {
|
|
1113
|
-
isSelected,
|
|
1114
|
-
next,
|
|
1115
|
-
prev,
|
|
1116
|
-
select,
|
|
1117
|
-
selected
|
|
1118
|
-
} = useGroup(props, VBtnToggleSymbol);
|
|
1119
|
-
useRender(() => {
|
|
1120
|
-
const [btnGroupProps] = VBtnGroup.filterProps(props);
|
|
1121
|
-
return createVNode(VBtnGroup, mergeProps({
|
|
1122
|
-
"class": "v-btn-toggle"
|
|
1123
|
-
}, btnGroupProps), {
|
|
1124
|
-
default: () => [slots.default?.({
|
|
1125
|
-
isSelected,
|
|
1126
|
-
next,
|
|
1127
|
-
prev,
|
|
1128
|
-
select,
|
|
1129
|
-
selected
|
|
1130
|
-
})]
|
|
1131
|
-
});
|
|
1132
|
-
});
|
|
1133
|
-
return {
|
|
1134
|
-
next,
|
|
1135
|
-
prev,
|
|
1136
|
-
select
|
|
1137
|
-
};
|
|
1138
|
-
}
|
|
1139
|
-
});
|
|
1140
|
-
|
|
1141
|
-
var VIcon$1 = '';
|
|
1142
|
-
|
|
1143
|
-
const IconValue = [String, Function, Object];
|
|
1144
|
-
const IconSymbol = Symbol.for('vuetify:icons');
|
|
1145
|
-
const makeIconProps = propsFactory({
|
|
1146
|
-
icon: {
|
|
1147
|
-
type: IconValue
|
|
1148
|
-
},
|
|
1149
|
-
// Could not remove this and use makeTagProps, types complained because it is not required
|
|
1150
|
-
tag: {
|
|
1151
|
-
type: String,
|
|
1152
|
-
required: true
|
|
1153
|
-
}
|
|
1154
|
-
}, 'icon');
|
|
1155
|
-
const VComponentIcon = genericComponent()({
|
|
1156
|
-
name: 'VComponentIcon',
|
|
1157
|
-
props: makeIconProps(),
|
|
1158
|
-
setup(props, _ref) {
|
|
1159
|
-
let {
|
|
1160
|
-
slots
|
|
1161
|
-
} = _ref;
|
|
1162
|
-
return () => {
|
|
1163
|
-
return createVNode(props.tag, null, {
|
|
1164
|
-
default: () => [props.icon ? createVNode(props.icon, null, null) : slots.default?.()]
|
|
1165
|
-
});
|
|
1166
|
-
};
|
|
1167
|
-
}
|
|
1168
|
-
});
|
|
1169
|
-
defineComponent({
|
|
1170
|
-
name: 'VSvgIcon',
|
|
1171
|
-
inheritAttrs: false,
|
|
1172
|
-
props: makeIconProps(),
|
|
1173
|
-
setup(props, _ref2) {
|
|
1174
|
-
let {
|
|
1175
|
-
attrs
|
|
1176
|
-
} = _ref2;
|
|
1177
|
-
return () => {
|
|
1178
|
-
return createVNode(props.tag, mergeProps(attrs, {
|
|
1179
|
-
"style": null
|
|
1180
|
-
}), {
|
|
1181
|
-
default: () => [createVNode("svg", {
|
|
1182
|
-
"class": "v-icon__svg",
|
|
1183
|
-
"xmlns": "http://www.w3.org/2000/svg",
|
|
1184
|
-
"viewBox": "0 0 24 24",
|
|
1185
|
-
"role": "img",
|
|
1186
|
-
"aria-hidden": "true"
|
|
1187
|
-
}, [createVNode("path", {
|
|
1188
|
-
"d": props.icon
|
|
1189
|
-
}, null)])]
|
|
1190
|
-
});
|
|
1191
|
-
};
|
|
1192
|
-
}
|
|
1193
|
-
});
|
|
1194
|
-
defineComponent({
|
|
1195
|
-
name: 'VLigatureIcon',
|
|
1196
|
-
props: makeIconProps(),
|
|
1197
|
-
setup(props) {
|
|
1198
|
-
return () => {
|
|
1199
|
-
return createVNode(props.tag, null, {
|
|
1200
|
-
default: () => [props.icon]
|
|
1201
|
-
});
|
|
1202
|
-
};
|
|
1203
|
-
}
|
|
1204
|
-
});
|
|
1205
|
-
defineComponent({
|
|
1206
|
-
name: 'VClassIcon',
|
|
1207
|
-
props: makeIconProps(),
|
|
1208
|
-
setup(props) {
|
|
1209
|
-
return () => {
|
|
1210
|
-
return createVNode(props.tag, {
|
|
1211
|
-
"class": props.icon
|
|
1212
|
-
}, null);
|
|
1213
|
-
};
|
|
1214
|
-
}
|
|
1215
|
-
});
|
|
1216
|
-
const useIcon = props => {
|
|
1217
|
-
const icons = inject(IconSymbol);
|
|
1218
|
-
if (!icons) throw new Error('Missing Vuetify Icons provide!');
|
|
1219
|
-
const iconData = computed(() => {
|
|
1220
|
-
const iconAlias = isRef(props) ? props.value : props.icon;
|
|
1221
|
-
if (!iconAlias) return {
|
|
1222
|
-
component: VComponentIcon
|
|
1223
|
-
};
|
|
1224
|
-
let icon = iconAlias;
|
|
1225
|
-
if (typeof icon === 'string') {
|
|
1226
|
-
icon = icon.trim();
|
|
1227
|
-
if (icon.startsWith('$')) {
|
|
1228
|
-
icon = icons.aliases?.[icon.slice(1)];
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
if (!icon) throw new Error(`Could not find aliased icon "${iconAlias}"`);
|
|
1232
|
-
if (typeof icon !== 'string') {
|
|
1233
|
-
return {
|
|
1234
|
-
component: VComponentIcon,
|
|
1235
|
-
icon
|
|
1236
|
-
};
|
|
1237
|
-
}
|
|
1238
|
-
const iconSetName = Object.keys(icons.sets).find(setName => typeof icon === 'string' && icon.startsWith(`${setName}:`));
|
|
1239
|
-
const iconName = iconSetName ? icon.slice(iconSetName.length + 1) : icon;
|
|
1240
|
-
const iconSet = icons.sets[iconSetName ?? icons.defaultSet];
|
|
1241
|
-
return {
|
|
1242
|
-
component: iconSet.component,
|
|
1243
|
-
icon: iconName
|
|
1244
|
-
};
|
|
1245
|
-
});
|
|
1246
|
-
return {
|
|
1247
|
-
iconData
|
|
1248
|
-
};
|
|
1249
|
-
};
|
|
1250
|
-
|
|
1251
|
-
// Utilities
|
|
1252
|
-
const predefinedSizes = ['x-small', 'small', 'default', 'large', 'x-large'];
|
|
1253
|
-
// Composables
|
|
1254
|
-
const makeSizeProps = propsFactory({
|
|
1255
|
-
size: {
|
|
1256
|
-
type: [String, Number],
|
|
1257
|
-
default: 'default'
|
|
1258
|
-
}
|
|
1259
|
-
}, 'size');
|
|
1260
|
-
function useSize(props) {
|
|
1261
|
-
let name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getCurrentInstanceName();
|
|
1262
|
-
return destructComputed(() => {
|
|
1263
|
-
let sizeClasses;
|
|
1264
|
-
let sizeStyles;
|
|
1265
|
-
if (includes(predefinedSizes, props.size)) {
|
|
1266
|
-
sizeClasses = `${name}--size-${props.size}`;
|
|
1267
|
-
} else if (props.size) {
|
|
1268
|
-
sizeStyles = {
|
|
1269
|
-
width: convertToUnit(props.size),
|
|
1270
|
-
height: convertToUnit(props.size)
|
|
1271
|
-
};
|
|
1272
|
-
}
|
|
1273
|
-
return {
|
|
1274
|
-
sizeClasses,
|
|
1275
|
-
sizeStyles
|
|
1276
|
-
};
|
|
1277
|
-
});
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
const makeVIconProps = propsFactory({
|
|
1281
|
-
color: String,
|
|
1282
|
-
start: Boolean,
|
|
1283
|
-
end: Boolean,
|
|
1284
|
-
icon: IconValue,
|
|
1285
|
-
...makeSizeProps(),
|
|
1286
|
-
...makeTagProps({
|
|
1287
|
-
tag: 'i'
|
|
1288
|
-
}),
|
|
1289
|
-
...makeThemeProps()
|
|
1290
|
-
}, 'v-icon');
|
|
1291
|
-
const VIcon = genericComponent()({
|
|
1292
|
-
name: 'VIcon',
|
|
1293
|
-
props: makeVIconProps(),
|
|
1294
|
-
setup(props, _ref) {
|
|
1295
|
-
let {
|
|
1296
|
-
attrs,
|
|
1297
|
-
slots
|
|
1298
|
-
} = _ref;
|
|
1299
|
-
let slotIcon;
|
|
1300
|
-
if (slots.default) {
|
|
1301
|
-
slotIcon = computed(() => {
|
|
1302
|
-
const slot = slots.default?.();
|
|
1303
|
-
if (!slot) return;
|
|
1304
|
-
return slot.filter(node => node.type === Text && node.children && typeof node.children === 'string')[0]?.children;
|
|
1305
|
-
});
|
|
1306
|
-
}
|
|
1307
|
-
const {
|
|
1308
|
-
themeClasses
|
|
1309
|
-
} = provideTheme(props);
|
|
1310
|
-
const {
|
|
1311
|
-
iconData
|
|
1312
|
-
} = useIcon(slotIcon || props);
|
|
1313
|
-
const {
|
|
1314
|
-
sizeClasses
|
|
1315
|
-
} = useSize(props);
|
|
1316
|
-
const {
|
|
1317
|
-
textColorClasses,
|
|
1318
|
-
textColorStyles
|
|
1319
|
-
} = useTextColor(toRef(props, 'color'));
|
|
1320
|
-
useRender(() => createVNode(iconData.value.component, {
|
|
1321
|
-
"tag": props.tag,
|
|
1322
|
-
"icon": iconData.value.icon,
|
|
1323
|
-
"class": ['v-icon', 'notranslate', themeClasses.value, sizeClasses.value, textColorClasses.value, {
|
|
1324
|
-
'v-icon--clickable': !!attrs.onClick,
|
|
1325
|
-
'v-icon--start': props.start,
|
|
1326
|
-
'v-icon--end': props.end
|
|
1327
|
-
}],
|
|
1328
|
-
"style": [!sizeClasses.value ? {
|
|
1329
|
-
fontSize: convertToUnit(props.size),
|
|
1330
|
-
height: convertToUnit(props.size),
|
|
1331
|
-
width: convertToUnit(props.size)
|
|
1332
|
-
} : undefined, textColorStyles.value],
|
|
1333
|
-
"role": attrs.onClick ? 'button' : undefined,
|
|
1334
|
-
"aria-hidden": !attrs.onClick
|
|
1335
|
-
}, {
|
|
1336
|
-
default: () => [slots.default?.()]
|
|
1337
|
-
}));
|
|
1338
|
-
return {};
|
|
1339
|
-
}
|
|
1340
|
-
});
|
|
1341
|
-
|
|
1342
|
-
var VProgressCircular$1 = '';
|
|
1343
|
-
|
|
1344
|
-
// Utilities
|
|
1345
|
-
function useIntersectionObserver(callback) {
|
|
1346
|
-
const intersectionRef = ref();
|
|
1347
|
-
const isIntersecting = ref(false);
|
|
1348
|
-
if (SUPPORTS_INTERSECTION) {
|
|
1349
|
-
const observer = new IntersectionObserver(entries => {
|
|
1350
|
-
callback?.(entries, observer);
|
|
1351
|
-
isIntersecting.value = !!entries.find(entry => entry.isIntersecting);
|
|
1352
|
-
});
|
|
1353
|
-
onBeforeUnmount(() => {
|
|
1354
|
-
observer.disconnect();
|
|
1355
|
-
});
|
|
1356
|
-
watch(intersectionRef, (newValue, oldValue) => {
|
|
1357
|
-
if (oldValue) {
|
|
1358
|
-
observer.unobserve(oldValue);
|
|
1359
|
-
isIntersecting.value = false;
|
|
1360
|
-
}
|
|
1361
|
-
if (newValue) observer.observe(newValue);
|
|
1362
|
-
}, {
|
|
1363
|
-
flush: 'post'
|
|
1364
|
-
});
|
|
1365
|
-
}
|
|
1366
|
-
return {
|
|
1367
|
-
intersectionRef,
|
|
1368
|
-
isIntersecting
|
|
1369
|
-
};
|
|
1370
|
-
}
|
|
1371
|
-
|
|
1372
|
-
const VProgressCircular = genericComponent()({
|
|
1373
|
-
name: 'VProgressCircular',
|
|
1374
|
-
props: {
|
|
1375
|
-
bgColor: String,
|
|
1376
|
-
color: String,
|
|
1377
|
-
indeterminate: [Boolean, String],
|
|
1378
|
-
modelValue: {
|
|
1379
|
-
type: [Number, String],
|
|
1380
|
-
default: 0
|
|
1381
|
-
},
|
|
1382
|
-
rotate: {
|
|
1383
|
-
type: [Number, String],
|
|
1384
|
-
default: 0
|
|
1385
|
-
},
|
|
1386
|
-
width: {
|
|
1387
|
-
type: [Number, String],
|
|
1388
|
-
default: 4
|
|
1389
|
-
},
|
|
1390
|
-
...makeSizeProps(),
|
|
1391
|
-
...makeTagProps({
|
|
1392
|
-
tag: 'div'
|
|
1393
|
-
}),
|
|
1394
|
-
...makeThemeProps()
|
|
1395
|
-
},
|
|
1396
|
-
setup(props, _ref) {
|
|
1397
|
-
let {
|
|
1398
|
-
slots
|
|
1399
|
-
} = _ref;
|
|
1400
|
-
const MAGIC_RADIUS_CONSTANT = 20;
|
|
1401
|
-
const CIRCUMFERENCE = 2 * Math.PI * MAGIC_RADIUS_CONSTANT;
|
|
1402
|
-
const root = ref();
|
|
1403
|
-
const {
|
|
1404
|
-
themeClasses
|
|
1405
|
-
} = provideTheme(props);
|
|
1406
|
-
const {
|
|
1407
|
-
sizeClasses,
|
|
1408
|
-
sizeStyles
|
|
1409
|
-
} = useSize(props);
|
|
1410
|
-
const {
|
|
1411
|
-
textColorClasses,
|
|
1412
|
-
textColorStyles
|
|
1413
|
-
} = useTextColor(toRef(props, 'color'));
|
|
1414
|
-
const {
|
|
1415
|
-
textColorClasses: underlayColorClasses,
|
|
1416
|
-
textColorStyles: underlayColorStyles
|
|
1417
|
-
} = useTextColor(toRef(props, 'bgColor'));
|
|
1418
|
-
const {
|
|
1419
|
-
intersectionRef,
|
|
1420
|
-
isIntersecting
|
|
1421
|
-
} = useIntersectionObserver();
|
|
1422
|
-
const {
|
|
1423
|
-
resizeRef,
|
|
1424
|
-
contentRect
|
|
1425
|
-
} = useResizeObserver();
|
|
1426
|
-
const normalizedValue = computed(() => Math.max(0, Math.min(100, parseFloat(props.modelValue))));
|
|
1427
|
-
const width = computed(() => Number(props.width));
|
|
1428
|
-
const size = computed(() => {
|
|
1429
|
-
// Get size from element if size prop value is small, large etc
|
|
1430
|
-
return sizeStyles.value ? Number(props.size) : contentRect.value ? contentRect.value.width : Math.max(width.value, 32);
|
|
1431
|
-
});
|
|
1432
|
-
const diameter = computed(() => MAGIC_RADIUS_CONSTANT / (1 - width.value / size.value) * 2);
|
|
1433
|
-
const strokeWidth = computed(() => width.value / size.value * diameter.value);
|
|
1434
|
-
const strokeDashOffset = computed(() => convertToUnit((100 - normalizedValue.value) / 100 * CIRCUMFERENCE));
|
|
1435
|
-
watchEffect(() => {
|
|
1436
|
-
intersectionRef.value = root.value;
|
|
1437
|
-
resizeRef.value = root.value;
|
|
1438
|
-
});
|
|
1439
|
-
useRender(() => createVNode(props.tag, {
|
|
1440
|
-
"ref": root,
|
|
1441
|
-
"class": ['v-progress-circular', {
|
|
1442
|
-
'v-progress-circular--indeterminate': !!props.indeterminate,
|
|
1443
|
-
'v-progress-circular--visible': isIntersecting.value,
|
|
1444
|
-
'v-progress-circular--disable-shrink': props.indeterminate === 'disable-shrink'
|
|
1445
|
-
}, themeClasses.value, sizeClasses.value, textColorClasses.value],
|
|
1446
|
-
"style": [sizeStyles.value, textColorStyles.value],
|
|
1447
|
-
"role": "progressbar",
|
|
1448
|
-
"aria-valuemin": "0",
|
|
1449
|
-
"aria-valuemax": "100",
|
|
1450
|
-
"aria-valuenow": props.indeterminate ? undefined : normalizedValue.value
|
|
1451
|
-
}, {
|
|
1452
|
-
default: () => [createVNode("svg", {
|
|
1453
|
-
"style": {
|
|
1454
|
-
transform: `rotate(calc(-90deg + ${Number(props.rotate)}deg))`
|
|
1455
|
-
},
|
|
1456
|
-
"xmlns": "http://www.w3.org/2000/svg",
|
|
1457
|
-
"viewBox": `0 0 ${diameter.value} ${diameter.value}`
|
|
1458
|
-
}, [createVNode("circle", {
|
|
1459
|
-
"class": ['v-progress-circular__underlay', underlayColorClasses.value],
|
|
1460
|
-
"style": underlayColorStyles.value,
|
|
1461
|
-
"fill": "transparent",
|
|
1462
|
-
"cx": "50%",
|
|
1463
|
-
"cy": "50%",
|
|
1464
|
-
"r": MAGIC_RADIUS_CONSTANT,
|
|
1465
|
-
"stroke-width": strokeWidth.value,
|
|
1466
|
-
"stroke-dasharray": CIRCUMFERENCE,
|
|
1467
|
-
"stroke-dashoffset": 0
|
|
1468
|
-
}, null), createVNode("circle", {
|
|
1469
|
-
"class": "v-progress-circular__overlay",
|
|
1470
|
-
"fill": "transparent",
|
|
1471
|
-
"cx": "50%",
|
|
1472
|
-
"cy": "50%",
|
|
1473
|
-
"r": MAGIC_RADIUS_CONSTANT,
|
|
1474
|
-
"stroke-width": strokeWidth.value,
|
|
1475
|
-
"stroke-dasharray": CIRCUMFERENCE,
|
|
1476
|
-
"stroke-dashoffset": strokeDashOffset.value
|
|
1477
|
-
}, null)]), slots.default && createVNode("div", {
|
|
1478
|
-
"class": "v-progress-circular__content"
|
|
1479
|
-
}, [slots.default({
|
|
1480
|
-
value: normalizedValue.value
|
|
1481
|
-
})])]
|
|
1482
|
-
}));
|
|
1483
|
-
return {};
|
|
1484
|
-
}
|
|
1485
|
-
});
|
|
1486
|
-
|
|
1487
|
-
var VRipple = '';
|
|
1488
|
-
|
|
1489
|
-
// Styles
|
|
1490
|
-
const stopSymbol = Symbol('rippleStop');
|
|
1491
|
-
const DELAY_RIPPLE = 80;
|
|
1492
|
-
function transform(el, value) {
|
|
1493
|
-
el.style.transform = value;
|
|
1494
|
-
el.style.webkitTransform = value;
|
|
1495
|
-
}
|
|
1496
|
-
function isTouchEvent(e) {
|
|
1497
|
-
return e.constructor.name === 'TouchEvent';
|
|
1498
|
-
}
|
|
1499
|
-
function isKeyboardEvent(e) {
|
|
1500
|
-
return e.constructor.name === 'KeyboardEvent';
|
|
1501
|
-
}
|
|
1502
|
-
const calculate = function (e, el) {
|
|
1503
|
-
let value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1504
|
-
let localX = 0;
|
|
1505
|
-
let localY = 0;
|
|
1506
|
-
if (!isKeyboardEvent(e)) {
|
|
1507
|
-
const offset = el.getBoundingClientRect();
|
|
1508
|
-
const target = isTouchEvent(e) ? e.touches[e.touches.length - 1] : e;
|
|
1509
|
-
localX = target.clientX - offset.left;
|
|
1510
|
-
localY = target.clientY - offset.top;
|
|
1511
|
-
}
|
|
1512
|
-
let radius = 0;
|
|
1513
|
-
let scale = 0.3;
|
|
1514
|
-
if (el._ripple?.circle) {
|
|
1515
|
-
scale = 0.15;
|
|
1516
|
-
radius = el.clientWidth / 2;
|
|
1517
|
-
radius = value.center ? radius : radius + Math.sqrt((localX - radius) ** 2 + (localY - radius) ** 2) / 4;
|
|
1518
|
-
} else {
|
|
1519
|
-
radius = Math.sqrt(el.clientWidth ** 2 + el.clientHeight ** 2) / 2;
|
|
1520
|
-
}
|
|
1521
|
-
const centerX = `${(el.clientWidth - radius * 2) / 2}px`;
|
|
1522
|
-
const centerY = `${(el.clientHeight - radius * 2) / 2}px`;
|
|
1523
|
-
const x = value.center ? centerX : `${localX - radius}px`;
|
|
1524
|
-
const y = value.center ? centerY : `${localY - radius}px`;
|
|
1525
|
-
return {
|
|
1526
|
-
radius,
|
|
1527
|
-
scale,
|
|
1528
|
-
x,
|
|
1529
|
-
y,
|
|
1530
|
-
centerX,
|
|
1531
|
-
centerY
|
|
1532
|
-
};
|
|
1533
|
-
};
|
|
1534
|
-
const ripples = {
|
|
1535
|
-
/* eslint-disable max-statements */
|
|
1536
|
-
show(e, el) {
|
|
1537
|
-
let value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1538
|
-
if (!el?._ripple?.enabled) {
|
|
1539
|
-
return;
|
|
1540
|
-
}
|
|
1541
|
-
const container = document.createElement('span');
|
|
1542
|
-
const animation = document.createElement('span');
|
|
1543
|
-
container.appendChild(animation);
|
|
1544
|
-
container.className = 'v-ripple__container';
|
|
1545
|
-
if (value.class) {
|
|
1546
|
-
container.className += ` ${value.class}`;
|
|
1547
|
-
}
|
|
1548
|
-
const {
|
|
1549
|
-
radius,
|
|
1550
|
-
scale,
|
|
1551
|
-
x,
|
|
1552
|
-
y,
|
|
1553
|
-
centerX,
|
|
1554
|
-
centerY
|
|
1555
|
-
} = calculate(e, el, value);
|
|
1556
|
-
const size = `${radius * 2}px`;
|
|
1557
|
-
animation.className = 'v-ripple__animation';
|
|
1558
|
-
animation.style.width = size;
|
|
1559
|
-
animation.style.height = size;
|
|
1560
|
-
el.appendChild(container);
|
|
1561
|
-
const computed = window.getComputedStyle(el);
|
|
1562
|
-
if (computed && computed.position === 'static') {
|
|
1563
|
-
el.style.position = 'relative';
|
|
1564
|
-
el.dataset.previousPosition = 'static';
|
|
1565
|
-
}
|
|
1566
|
-
animation.classList.add('v-ripple__animation--enter');
|
|
1567
|
-
animation.classList.add('v-ripple__animation--visible');
|
|
1568
|
-
transform(animation, `translate(${x}, ${y}) scale3d(${scale},${scale},${scale})`);
|
|
1569
|
-
animation.dataset.activated = String(performance.now());
|
|
1570
|
-
setTimeout(() => {
|
|
1571
|
-
animation.classList.remove('v-ripple__animation--enter');
|
|
1572
|
-
animation.classList.add('v-ripple__animation--in');
|
|
1573
|
-
transform(animation, `translate(${centerX}, ${centerY}) scale3d(1,1,1)`);
|
|
1574
|
-
}, 0);
|
|
1575
|
-
},
|
|
1576
|
-
hide(el) {
|
|
1577
|
-
if (!el?._ripple?.enabled) return;
|
|
1578
|
-
const ripples = el.getElementsByClassName('v-ripple__animation');
|
|
1579
|
-
if (ripples.length === 0) return;
|
|
1580
|
-
const animation = ripples[ripples.length - 1];
|
|
1581
|
-
if (animation.dataset.isHiding) return;else animation.dataset.isHiding = 'true';
|
|
1582
|
-
const diff = performance.now() - Number(animation.dataset.activated);
|
|
1583
|
-
const delay = Math.max(250 - diff, 0);
|
|
1584
|
-
setTimeout(() => {
|
|
1585
|
-
animation.classList.remove('v-ripple__animation--in');
|
|
1586
|
-
animation.classList.add('v-ripple__animation--out');
|
|
1587
|
-
setTimeout(() => {
|
|
1588
|
-
const ripples = el.getElementsByClassName('v-ripple__animation');
|
|
1589
|
-
if (ripples.length === 1 && el.dataset.previousPosition) {
|
|
1590
|
-
el.style.position = el.dataset.previousPosition;
|
|
1591
|
-
delete el.dataset.previousPosition;
|
|
1592
|
-
}
|
|
1593
|
-
if (animation.parentNode?.parentNode === el) el.removeChild(animation.parentNode);
|
|
1594
|
-
}, 300);
|
|
1595
|
-
}, delay);
|
|
1596
|
-
}
|
|
1597
|
-
};
|
|
1598
|
-
function isRippleEnabled(value) {
|
|
1599
|
-
return typeof value === 'undefined' || !!value;
|
|
1600
|
-
}
|
|
1601
|
-
function rippleShow(e) {
|
|
1602
|
-
const value = {};
|
|
1603
|
-
const element = e.currentTarget;
|
|
1604
|
-
if (!element?._ripple || element._ripple.touched || e[stopSymbol]) return;
|
|
1605
|
-
|
|
1606
|
-
// Don't allow the event to trigger ripples on any other elements
|
|
1607
|
-
e[stopSymbol] = true;
|
|
1608
|
-
if (isTouchEvent(e)) {
|
|
1609
|
-
element._ripple.touched = true;
|
|
1610
|
-
element._ripple.isTouch = true;
|
|
1611
|
-
} else {
|
|
1612
|
-
// It's possible for touch events to fire
|
|
1613
|
-
// as mouse events on Android/iOS, this
|
|
1614
|
-
// will skip the event call if it has
|
|
1615
|
-
// already been registered as touch
|
|
1616
|
-
if (element._ripple.isTouch) return;
|
|
1617
|
-
}
|
|
1618
|
-
value.center = element._ripple.centered || isKeyboardEvent(e);
|
|
1619
|
-
if (element._ripple.class) {
|
|
1620
|
-
value.class = element._ripple.class;
|
|
1621
|
-
}
|
|
1622
|
-
if (isTouchEvent(e)) {
|
|
1623
|
-
// already queued that shows or hides the ripple
|
|
1624
|
-
if (element._ripple.showTimerCommit) return;
|
|
1625
|
-
element._ripple.showTimerCommit = () => {
|
|
1626
|
-
ripples.show(e, element, value);
|
|
1627
|
-
};
|
|
1628
|
-
element._ripple.showTimer = window.setTimeout(() => {
|
|
1629
|
-
if (element?._ripple?.showTimerCommit) {
|
|
1630
|
-
element._ripple.showTimerCommit();
|
|
1631
|
-
element._ripple.showTimerCommit = null;
|
|
1632
|
-
}
|
|
1633
|
-
}, DELAY_RIPPLE);
|
|
1634
|
-
} else {
|
|
1635
|
-
ripples.show(e, element, value);
|
|
1636
|
-
}
|
|
1637
|
-
}
|
|
1638
|
-
function rippleStop(e) {
|
|
1639
|
-
e[stopSymbol] = true;
|
|
1640
|
-
}
|
|
1641
|
-
function rippleHide(e) {
|
|
1642
|
-
const element = e.currentTarget;
|
|
1643
|
-
if (!element?._ripple) return;
|
|
1644
|
-
window.clearTimeout(element._ripple.showTimer);
|
|
1645
|
-
|
|
1646
|
-
// The touch interaction occurs before the show timer is triggered.
|
|
1647
|
-
// We still want to show ripple effect.
|
|
1648
|
-
if (e.type === 'touchend' && element._ripple.showTimerCommit) {
|
|
1649
|
-
element._ripple.showTimerCommit();
|
|
1650
|
-
element._ripple.showTimerCommit = null;
|
|
1651
|
-
|
|
1652
|
-
// re-queue ripple hiding
|
|
1653
|
-
element._ripple.showTimer = window.setTimeout(() => {
|
|
1654
|
-
rippleHide(e);
|
|
1655
|
-
});
|
|
1656
|
-
return;
|
|
1657
|
-
}
|
|
1658
|
-
window.setTimeout(() => {
|
|
1659
|
-
if (element._ripple) {
|
|
1660
|
-
element._ripple.touched = false;
|
|
1661
|
-
}
|
|
1662
|
-
});
|
|
1663
|
-
ripples.hide(element);
|
|
1664
|
-
}
|
|
1665
|
-
function rippleCancelShow(e) {
|
|
1666
|
-
const element = e.currentTarget;
|
|
1667
|
-
if (!element?._ripple) return;
|
|
1668
|
-
if (element._ripple.showTimerCommit) {
|
|
1669
|
-
element._ripple.showTimerCommit = null;
|
|
1670
|
-
}
|
|
1671
|
-
window.clearTimeout(element._ripple.showTimer);
|
|
1672
|
-
}
|
|
1673
|
-
let keyboardRipple = false;
|
|
1674
|
-
function keyboardRippleShow(e) {
|
|
1675
|
-
if (!keyboardRipple && (e.keyCode === keyCodes.enter || e.keyCode === keyCodes.space)) {
|
|
1676
|
-
keyboardRipple = true;
|
|
1677
|
-
rippleShow(e);
|
|
1678
|
-
}
|
|
1679
|
-
}
|
|
1680
|
-
function keyboardRippleHide(e) {
|
|
1681
|
-
keyboardRipple = false;
|
|
1682
|
-
rippleHide(e);
|
|
1683
|
-
}
|
|
1684
|
-
function focusRippleHide(e) {
|
|
1685
|
-
if (keyboardRipple) {
|
|
1686
|
-
keyboardRipple = false;
|
|
1687
|
-
rippleHide(e);
|
|
1688
|
-
}
|
|
1689
|
-
}
|
|
1690
|
-
function updateRipple(el, binding, wasEnabled) {
|
|
1691
|
-
const {
|
|
1692
|
-
value,
|
|
1693
|
-
modifiers
|
|
1694
|
-
} = binding;
|
|
1695
|
-
const enabled = isRippleEnabled(value);
|
|
1696
|
-
if (!enabled) {
|
|
1697
|
-
ripples.hide(el);
|
|
1698
|
-
}
|
|
1699
|
-
el._ripple = el._ripple ?? {};
|
|
1700
|
-
el._ripple.enabled = enabled;
|
|
1701
|
-
el._ripple.centered = modifiers.center;
|
|
1702
|
-
el._ripple.circle = modifiers.circle;
|
|
1703
|
-
if (isObject(value) && value.class) {
|
|
1704
|
-
el._ripple.class = value.class;
|
|
1705
|
-
}
|
|
1706
|
-
if (enabled && !wasEnabled) {
|
|
1707
|
-
if (modifiers.stop) {
|
|
1708
|
-
el.addEventListener('touchstart', rippleStop, {
|
|
1709
|
-
passive: true
|
|
1710
|
-
});
|
|
1711
|
-
el.addEventListener('mousedown', rippleStop);
|
|
1712
|
-
return;
|
|
1713
|
-
}
|
|
1714
|
-
el.addEventListener('touchstart', rippleShow, {
|
|
1715
|
-
passive: true
|
|
1716
|
-
});
|
|
1717
|
-
el.addEventListener('touchend', rippleHide, {
|
|
1718
|
-
passive: true
|
|
1719
|
-
});
|
|
1720
|
-
el.addEventListener('touchmove', rippleCancelShow, {
|
|
1721
|
-
passive: true
|
|
1722
|
-
});
|
|
1723
|
-
el.addEventListener('touchcancel', rippleHide);
|
|
1724
|
-
el.addEventListener('mousedown', rippleShow);
|
|
1725
|
-
el.addEventListener('mouseup', rippleHide);
|
|
1726
|
-
el.addEventListener('mouseleave', rippleHide);
|
|
1727
|
-
el.addEventListener('keydown', keyboardRippleShow);
|
|
1728
|
-
el.addEventListener('keyup', keyboardRippleHide);
|
|
1729
|
-
el.addEventListener('blur', focusRippleHide);
|
|
1730
|
-
|
|
1731
|
-
// Anchor tags can be dragged, causes other hides to fail - #1537
|
|
1732
|
-
el.addEventListener('dragstart', rippleHide, {
|
|
1733
|
-
passive: true
|
|
1734
|
-
});
|
|
1735
|
-
} else if (!enabled && wasEnabled) {
|
|
1736
|
-
removeListeners(el);
|
|
1737
|
-
}
|
|
1738
|
-
}
|
|
1739
|
-
function removeListeners(el) {
|
|
1740
|
-
el.removeEventListener('mousedown', rippleShow);
|
|
1741
|
-
el.removeEventListener('touchstart', rippleShow);
|
|
1742
|
-
el.removeEventListener('touchend', rippleHide);
|
|
1743
|
-
el.removeEventListener('touchmove', rippleCancelShow);
|
|
1744
|
-
el.removeEventListener('touchcancel', rippleHide);
|
|
1745
|
-
el.removeEventListener('mouseup', rippleHide);
|
|
1746
|
-
el.removeEventListener('mouseleave', rippleHide);
|
|
1747
|
-
el.removeEventListener('keydown', keyboardRippleShow);
|
|
1748
|
-
el.removeEventListener('keyup', keyboardRippleHide);
|
|
1749
|
-
el.removeEventListener('dragstart', rippleHide);
|
|
1750
|
-
el.removeEventListener('blur', focusRippleHide);
|
|
1751
|
-
}
|
|
1752
|
-
function mounted(el, binding) {
|
|
1753
|
-
updateRipple(el, binding, false);
|
|
1754
|
-
}
|
|
1755
|
-
function unmounted(el) {
|
|
1756
|
-
delete el._ripple;
|
|
1757
|
-
removeListeners(el);
|
|
1758
|
-
}
|
|
1759
|
-
function updated(el, binding) {
|
|
1760
|
-
if (binding.value === binding.oldValue) {
|
|
1761
|
-
return;
|
|
1762
|
-
}
|
|
1763
|
-
const wasEnabled = isRippleEnabled(binding.oldValue);
|
|
1764
|
-
updateRipple(el, binding, wasEnabled);
|
|
1765
|
-
}
|
|
1766
|
-
const Ripple = {
|
|
1767
|
-
mounted,
|
|
1768
|
-
unmounted,
|
|
1769
|
-
updated
|
|
1770
|
-
};
|
|
1771
|
-
|
|
1772
|
-
// Composables
|
|
1773
|
-
const oppositeMap = {
|
|
1774
|
-
center: 'center',
|
|
1775
|
-
top: 'bottom',
|
|
1776
|
-
bottom: 'top',
|
|
1777
|
-
left: 'right',
|
|
1778
|
-
right: 'left'
|
|
1779
|
-
};
|
|
1780
|
-
const makeLocationProps = propsFactory({
|
|
1781
|
-
location: String
|
|
1782
|
-
}, 'location');
|
|
1783
|
-
function useLocation(props) {
|
|
1784
|
-
let opposite = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1785
|
-
let offset = arguments.length > 2 ? arguments[2] : undefined;
|
|
1786
|
-
const {
|
|
1787
|
-
isRtl
|
|
1788
|
-
} = useRtl();
|
|
1789
|
-
const locationStyles = computed(() => {
|
|
1790
|
-
if (!props.location) return {};
|
|
1791
|
-
const {
|
|
1792
|
-
side,
|
|
1793
|
-
align
|
|
1794
|
-
} = parseAnchor(props.location.split(' ').length > 1 ? props.location : `${props.location} center`, isRtl.value);
|
|
1795
|
-
function getOffset(side) {
|
|
1796
|
-
return offset ? offset(side) : 0;
|
|
1797
|
-
}
|
|
1798
|
-
const styles = {};
|
|
1799
|
-
if (side !== 'center') {
|
|
1800
|
-
if (opposite) styles[oppositeMap[side]] = `calc(100% - ${getOffset(side)}px)`;else styles[side] = 0;
|
|
1801
|
-
}
|
|
1802
|
-
if (align !== 'center') {
|
|
1803
|
-
if (opposite) styles[oppositeMap[align]] = `calc(100% - ${getOffset(align)}px)`;else styles[align] = 0;
|
|
1804
|
-
} else {
|
|
1805
|
-
if (side === 'center') styles.top = styles.left = '50%';else {
|
|
1806
|
-
styles[{
|
|
1807
|
-
top: 'left',
|
|
1808
|
-
bottom: 'left',
|
|
1809
|
-
left: 'top',
|
|
1810
|
-
right: 'top'
|
|
1811
|
-
}[side]] = '50%';
|
|
1812
|
-
}
|
|
1813
|
-
styles.transform = {
|
|
1814
|
-
top: 'translateX(-50%)',
|
|
1815
|
-
bottom: 'translateX(-50%)',
|
|
1816
|
-
left: 'translateY(-50%)',
|
|
1817
|
-
right: 'translateY(-50%)',
|
|
1818
|
-
center: 'translate(-50%, -50%)'
|
|
1819
|
-
}[side];
|
|
1820
|
-
}
|
|
1821
|
-
return styles;
|
|
1822
|
-
});
|
|
1823
|
-
return {
|
|
1824
|
-
locationStyles
|
|
1825
|
-
};
|
|
1826
|
-
}
|
|
1827
|
-
|
|
1828
|
-
// Composables
|
|
1829
|
-
const makeLoaderProps = propsFactory({
|
|
1830
|
-
loading: [Boolean, String]
|
|
1831
|
-
}, 'loader');
|
|
1832
|
-
function useLoader(props) {
|
|
1833
|
-
let name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getCurrentInstanceName();
|
|
1834
|
-
const loaderClasses = computed(() => ({
|
|
1835
|
-
[`${name}--loading`]: props.loading
|
|
1836
|
-
}));
|
|
1837
|
-
return {
|
|
1838
|
-
loaderClasses
|
|
1839
|
-
};
|
|
1840
|
-
}
|
|
1841
|
-
|
|
1842
|
-
// Utilities
|
|
1843
|
-
const positionValues = ['static', 'relative', 'fixed', 'absolute', 'sticky'];
|
|
1844
|
-
// Composables
|
|
1845
|
-
const makePositionProps = propsFactory({
|
|
1846
|
-
position: {
|
|
1847
|
-
type: String,
|
|
1848
|
-
validator: /* istanbul ignore next */v => positionValues.includes(v)
|
|
1849
|
-
}
|
|
1850
|
-
}, 'position');
|
|
1851
|
-
function usePosition(props) {
|
|
1852
|
-
let name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getCurrentInstanceName();
|
|
1853
|
-
const positionClasses = computed(() => {
|
|
1854
|
-
return props.position ? `${name}--${props.position}` : undefined;
|
|
1855
|
-
});
|
|
1856
|
-
return {
|
|
1857
|
-
positionClasses
|
|
1858
|
-
};
|
|
1859
|
-
}
|
|
1860
|
-
|
|
1861
|
-
// Utilities
|
|
1862
|
-
function useLink(props, attrs) {
|
|
1863
|
-
const RouterLink = resolveDynamicComponent('RouterLink');
|
|
1864
|
-
const isLink = computed(() => !!(props.href || props.to));
|
|
1865
|
-
const isClickable = computed(() => {
|
|
1866
|
-
return isLink?.value || hasEvent(attrs, 'click') || hasEvent(props, 'click');
|
|
1867
|
-
});
|
|
1868
|
-
if (typeof RouterLink === 'string') {
|
|
1869
|
-
return {
|
|
1870
|
-
isLink,
|
|
1871
|
-
isClickable,
|
|
1872
|
-
href: toRef(props, 'href')
|
|
1873
|
-
};
|
|
1874
|
-
}
|
|
1875
|
-
const link = props.to ? RouterLink.useLink(props) : undefined;
|
|
1876
|
-
return {
|
|
1877
|
-
isLink,
|
|
1878
|
-
isClickable,
|
|
1879
|
-
route: link?.route,
|
|
1880
|
-
navigate: link?.navigate,
|
|
1881
|
-
isActive: link && computed(() => props.exact ? link.isExactActive?.value : link.isActive?.value),
|
|
1882
|
-
href: computed(() => props.to ? link?.route.value.href : props.href)
|
|
1883
|
-
};
|
|
1884
|
-
}
|
|
1885
|
-
const makeRouterProps = propsFactory({
|
|
1886
|
-
href: String,
|
|
1887
|
-
replace: Boolean,
|
|
1888
|
-
to: [String, Object],
|
|
1889
|
-
exact: Boolean
|
|
1890
|
-
}, 'router');
|
|
1891
|
-
|
|
1892
|
-
// Utilities
|
|
1893
|
-
|
|
1894
|
-
// Types
|
|
1895
|
-
|
|
1896
|
-
function useSelectLink(link, select) {
|
|
1897
|
-
watch(() => link.isActive?.value, isActive => {
|
|
1898
|
-
if (link.isLink.value && isActive && select) {
|
|
1899
|
-
nextTick(() => {
|
|
1900
|
-
select(true);
|
|
1901
|
-
});
|
|
1902
|
-
}
|
|
1903
|
-
}, {
|
|
1904
|
-
immediate: true
|
|
1905
|
-
});
|
|
1906
|
-
}
|
|
1907
|
-
|
|
1908
|
-
const makeVBtnProps = propsFactory({
|
|
1909
|
-
active: {
|
|
1910
|
-
type: Boolean,
|
|
1911
|
-
default: undefined
|
|
1912
|
-
},
|
|
1913
|
-
symbol: {
|
|
1914
|
-
type: null,
|
|
1915
|
-
default: VBtnToggleSymbol
|
|
1916
|
-
},
|
|
1917
|
-
flat: Boolean,
|
|
1918
|
-
icon: [Boolean, String, Function, Object],
|
|
1919
|
-
prependIcon: IconValue,
|
|
1920
|
-
appendIcon: IconValue,
|
|
1921
|
-
block: Boolean,
|
|
1922
|
-
stacked: Boolean,
|
|
1923
|
-
ripple: {
|
|
1924
|
-
type: Boolean,
|
|
1925
|
-
default: true
|
|
1926
|
-
},
|
|
1927
|
-
...makeBorderProps(),
|
|
1928
|
-
...makeRoundedProps(),
|
|
1929
|
-
...makeDensityProps(),
|
|
1930
|
-
...makeDimensionProps(),
|
|
1931
|
-
...makeElevationProps(),
|
|
1932
|
-
...makeGroupItemProps(),
|
|
1933
|
-
...makeLoaderProps(),
|
|
1934
|
-
...makeLocationProps(),
|
|
1935
|
-
...makePositionProps(),
|
|
1936
|
-
...makeRouterProps(),
|
|
1937
|
-
...makeSizeProps(),
|
|
1938
|
-
...makeTagProps({
|
|
1939
|
-
tag: 'button'
|
|
1940
|
-
}),
|
|
1941
|
-
...makeThemeProps(),
|
|
1942
|
-
...makeVariantProps({
|
|
1943
|
-
variant: 'elevated'
|
|
1944
|
-
})
|
|
1945
|
-
}, 'VBtn');
|
|
1946
|
-
const VBtn = genericComponent()({
|
|
1947
|
-
name: 'VBtn',
|
|
1948
|
-
directives: {
|
|
1949
|
-
Ripple
|
|
1950
|
-
},
|
|
1951
|
-
props: makeVBtnProps(),
|
|
1952
|
-
emits: {
|
|
1953
|
-
'group:selected': val => true
|
|
1954
|
-
},
|
|
1955
|
-
setup(props, _ref) {
|
|
1956
|
-
let {
|
|
1957
|
-
attrs,
|
|
1958
|
-
slots
|
|
1959
|
-
} = _ref;
|
|
1960
|
-
const {
|
|
1961
|
-
themeClasses
|
|
1962
|
-
} = provideTheme(props);
|
|
1963
|
-
const {
|
|
1964
|
-
borderClasses
|
|
1965
|
-
} = useBorder(props);
|
|
1966
|
-
const {
|
|
1967
|
-
colorClasses,
|
|
1968
|
-
colorStyles,
|
|
1969
|
-
variantClasses
|
|
1970
|
-
} = useVariant(props);
|
|
1971
|
-
const {
|
|
1972
|
-
densityClasses
|
|
1973
|
-
} = useDensity(props);
|
|
1974
|
-
const {
|
|
1975
|
-
dimensionStyles
|
|
1976
|
-
} = useDimension(props);
|
|
1977
|
-
const {
|
|
1978
|
-
elevationClasses
|
|
1979
|
-
} = useElevation(props);
|
|
1980
|
-
const {
|
|
1981
|
-
loaderClasses
|
|
1982
|
-
} = useLoader(props);
|
|
1983
|
-
const {
|
|
1984
|
-
locationStyles
|
|
1985
|
-
} = useLocation(props);
|
|
1986
|
-
const {
|
|
1987
|
-
positionClasses
|
|
1988
|
-
} = usePosition(props);
|
|
1989
|
-
const {
|
|
1990
|
-
roundedClasses
|
|
1991
|
-
} = useRounded(props);
|
|
1992
|
-
const {
|
|
1993
|
-
sizeClasses,
|
|
1994
|
-
sizeStyles
|
|
1995
|
-
} = useSize(props);
|
|
1996
|
-
const group = useGroupItem(props, props.symbol, false);
|
|
1997
|
-
const link = useLink(props, attrs);
|
|
1998
|
-
const isActive = computed(() => {
|
|
1999
|
-
if (props.active !== undefined) {
|
|
2000
|
-
return props.active;
|
|
2001
|
-
}
|
|
2002
|
-
if (link.isLink.value) {
|
|
2003
|
-
return link.isActive?.value;
|
|
2004
|
-
}
|
|
2005
|
-
return group?.isSelected.value;
|
|
2006
|
-
});
|
|
2007
|
-
const isDisabled = computed(() => group?.disabled.value || props.disabled);
|
|
2008
|
-
const isElevated = computed(() => {
|
|
2009
|
-
return props.variant === 'elevated' && !(props.disabled || props.flat || props.border);
|
|
2010
|
-
});
|
|
2011
|
-
const valueAttr = computed(() => {
|
|
2012
|
-
if (props.value === undefined) return undefined;
|
|
2013
|
-
return Object(props.value) === props.value ? JSON.stringify(props.value, null, 0) : props.value;
|
|
2014
|
-
});
|
|
2015
|
-
useSelectLink(link, group?.select);
|
|
2016
|
-
useRender(() => {
|
|
2017
|
-
const Tag = link.isLink.value ? 'a' : props.tag;
|
|
2018
|
-
const hasPrepend = !!(props.prependIcon || slots.prepend);
|
|
2019
|
-
const hasAppend = !!(props.appendIcon || slots.append);
|
|
2020
|
-
const hasIcon = !!(props.icon && props.icon !== true);
|
|
2021
|
-
const hasColor = group?.isSelected.value && (!link.isLink.value || link.isActive?.value) || !group || link.isActive?.value;
|
|
2022
|
-
return withDirectives(createVNode(Tag, {
|
|
2023
|
-
"type": Tag === 'a' ? undefined : 'button',
|
|
2024
|
-
"class": ['v-btn', group?.selectedClass.value, {
|
|
2025
|
-
'v-btn--active': isActive.value,
|
|
2026
|
-
'v-btn--block': props.block,
|
|
2027
|
-
'v-btn--disabled': isDisabled.value,
|
|
2028
|
-
'v-btn--elevated': isElevated.value,
|
|
2029
|
-
'v-btn--flat': props.flat,
|
|
2030
|
-
'v-btn--icon': !!props.icon,
|
|
2031
|
-
'v-btn--loading': props.loading,
|
|
2032
|
-
'v-btn--stacked': props.stacked
|
|
2033
|
-
}, themeClasses.value, borderClasses.value, hasColor ? colorClasses.value : undefined, densityClasses.value, elevationClasses.value, loaderClasses.value, positionClasses.value, roundedClasses.value, sizeClasses.value, variantClasses.value],
|
|
2034
|
-
"style": [hasColor ? colorStyles.value : undefined, dimensionStyles.value, locationStyles.value, sizeStyles.value],
|
|
2035
|
-
"disabled": isDisabled.value || undefined,
|
|
2036
|
-
"href": link.href.value,
|
|
2037
|
-
"onClick": e => {
|
|
2038
|
-
if (isDisabled.value) return;
|
|
2039
|
-
link.navigate?.(e);
|
|
2040
|
-
group?.toggle();
|
|
2041
|
-
},
|
|
2042
|
-
"value": valueAttr.value
|
|
2043
|
-
}, {
|
|
2044
|
-
default: () => [genOverlays(true, 'v-btn'), !props.icon && hasPrepend && createVNode("span", {
|
|
2045
|
-
"key": "prepend",
|
|
2046
|
-
"class": "v-btn__prepend"
|
|
2047
|
-
}, [!slots.prepend ? createVNode(VIcon, {
|
|
2048
|
-
"key": "prepend-icon",
|
|
2049
|
-
"icon": props.prependIcon
|
|
2050
|
-
}, null) : createVNode(VDefaultsProvider, {
|
|
2051
|
-
"key": "prepend-defaults",
|
|
2052
|
-
"disabled": !props.prependIcon,
|
|
2053
|
-
"defaults": {
|
|
2054
|
-
VIcon: {
|
|
2055
|
-
icon: props.prependIcon
|
|
2056
|
-
}
|
|
2057
|
-
}
|
|
2058
|
-
}, slots.prepend)]), createVNode("span", {
|
|
2059
|
-
"class": "v-btn__content",
|
|
2060
|
-
"data-no-activator": ""
|
|
2061
|
-
}, [!slots.default && hasIcon ? createVNode(VIcon, {
|
|
2062
|
-
"key": "content-icon",
|
|
2063
|
-
"icon": props.icon
|
|
2064
|
-
}, null) : createVNode(VDefaultsProvider, {
|
|
2065
|
-
"key": "content-defaults",
|
|
2066
|
-
"disabled": !hasIcon,
|
|
2067
|
-
"defaults": {
|
|
2068
|
-
VIcon: {
|
|
2069
|
-
icon: props.icon
|
|
2070
|
-
}
|
|
2071
|
-
}
|
|
2072
|
-
}, slots.default)]), !props.icon && hasAppend && createVNode("span", {
|
|
2073
|
-
"key": "append",
|
|
2074
|
-
"class": "v-btn__append"
|
|
2075
|
-
}, [!slots.append ? createVNode(VIcon, {
|
|
2076
|
-
"key": "append-icon",
|
|
2077
|
-
"icon": props.appendIcon
|
|
2078
|
-
}, null) : createVNode(VDefaultsProvider, {
|
|
2079
|
-
"key": "append-defaults",
|
|
2080
|
-
"disabled": !props.appendIcon,
|
|
2081
|
-
"defaults": {
|
|
2082
|
-
VIcon: {
|
|
2083
|
-
icon: props.appendIcon
|
|
2084
|
-
}
|
|
2085
|
-
}
|
|
2086
|
-
}, slots.append)]), !!props.loading && createVNode("span", {
|
|
2087
|
-
"key": "loader",
|
|
2088
|
-
"class": "v-btn__loader"
|
|
2089
|
-
}, [slots.loader?.() ?? createVNode(VProgressCircular, {
|
|
2090
|
-
"color": typeof props.loading === 'boolean' ? undefined : props.loading,
|
|
2091
|
-
"indeterminate": true,
|
|
2092
|
-
"size": "23",
|
|
2093
|
-
"width": "2"
|
|
2094
|
-
}, null)])]
|
|
2095
|
-
}), [[resolveDirective("ripple"), !isDisabled.value && props.ripple, null]]);
|
|
2096
|
-
});
|
|
2097
|
-
return {};
|
|
2098
|
-
}
|
|
2099
|
-
});
|
|
2100
|
-
|
|
2101
|
-
var VSheet$1 = '';
|
|
2102
|
-
|
|
2103
|
-
const makeVSheetProps = propsFactory({
|
|
2104
|
-
color: String,
|
|
2105
|
-
...makeBorderProps(),
|
|
2106
|
-
...makeDimensionProps(),
|
|
2107
|
-
...makeElevationProps(),
|
|
2108
|
-
...makeLocationProps(),
|
|
2109
|
-
...makePositionProps(),
|
|
2110
|
-
...makeRoundedProps(),
|
|
2111
|
-
...makeTagProps(),
|
|
2112
|
-
...makeThemeProps()
|
|
2113
|
-
}, 'v-sheet');
|
|
2114
|
-
const VSheet = genericComponent()({
|
|
2115
|
-
name: 'VSheet',
|
|
2116
|
-
props: {
|
|
2117
|
-
...makeVSheetProps()
|
|
2118
|
-
},
|
|
2119
|
-
setup(props, _ref) {
|
|
2120
|
-
let {
|
|
2121
|
-
slots
|
|
2122
|
-
} = _ref;
|
|
2123
|
-
const {
|
|
2124
|
-
themeClasses
|
|
2125
|
-
} = provideTheme(props);
|
|
2126
|
-
const {
|
|
2127
|
-
backgroundColorClasses,
|
|
2128
|
-
backgroundColorStyles
|
|
2129
|
-
} = useBackgroundColor(toRef(props, 'color'));
|
|
2130
|
-
const {
|
|
2131
|
-
borderClasses
|
|
2132
|
-
} = useBorder(props);
|
|
2133
|
-
const {
|
|
2134
|
-
dimensionStyles
|
|
2135
|
-
} = useDimension(props);
|
|
2136
|
-
const {
|
|
2137
|
-
elevationClasses
|
|
2138
|
-
} = useElevation(props);
|
|
2139
|
-
const {
|
|
2140
|
-
locationStyles
|
|
2141
|
-
} = useLocation(props);
|
|
2142
|
-
const {
|
|
2143
|
-
positionClasses
|
|
2144
|
-
} = usePosition(props);
|
|
2145
|
-
const {
|
|
2146
|
-
roundedClasses
|
|
2147
|
-
} = useRounded(props);
|
|
2148
|
-
useRender(() => createVNode(props.tag, {
|
|
2149
|
-
"class": ['v-sheet', themeClasses.value, backgroundColorClasses.value, borderClasses.value, elevationClasses.value, positionClasses.value, roundedClasses.value],
|
|
2150
|
-
"style": [backgroundColorStyles.value, dimensionStyles.value, locationStyles.value]
|
|
2151
|
-
}, slots));
|
|
2152
|
-
return {};
|
|
2153
|
-
}
|
|
2154
|
-
});
|
|
2155
|
-
|
|
2156
|
-
var _sfc_main = /* @__PURE__ */ defineComponent$1({
|
|
16
|
+
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
2157
17
|
__name: "VSwatches",
|
|
2158
18
|
props: {
|
|
2159
19
|
/** Model value */
|
|
@@ -2187,11 +47,20 @@ var _sfc_main = /* @__PURE__ */ defineComponent$1({
|
|
|
2187
47
|
]
|
|
2188
48
|
},
|
|
2189
49
|
/** Swatch size */
|
|
2190
|
-
size: {
|
|
50
|
+
size: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: "2rem"
|
|
53
|
+
},
|
|
2191
54
|
/** Selected icon */
|
|
2192
|
-
icon: {
|
|
55
|
+
icon: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: "mdi-checkbox-marked-circle"
|
|
58
|
+
},
|
|
2193
59
|
/** selected icon size */
|
|
2194
|
-
iconSize: {
|
|
60
|
+
iconSize: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: "1rem"
|
|
63
|
+
},
|
|
2195
64
|
/**
|
|
2196
65
|
* The variant prop gives you easy access to several different button styles..
|
|
2197
66
|
*
|
|
@@ -2206,25 +75,37 @@ var _sfc_main = /* @__PURE__ */ defineComponent$1({
|
|
|
2206
75
|
*
|
|
2207
76
|
* @see {@link https://vuetifyjs.com/en/api/v-btn/#props-disabled}
|
|
2208
77
|
*/
|
|
2209
|
-
disabled: {
|
|
78
|
+
disabled: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: false
|
|
81
|
+
},
|
|
2210
82
|
/**
|
|
2211
83
|
* Applies a large border radius on the button.
|
|
2212
84
|
*
|
|
2213
85
|
* @see {@link https://vuetifyjs.com/en/components/buttons/#rounded}
|
|
2214
86
|
*/
|
|
2215
|
-
rounded: {
|
|
87
|
+
rounded: {
|
|
88
|
+
type: [String, Number, Boolean],
|
|
89
|
+
default: void 0
|
|
90
|
+
},
|
|
2216
91
|
/**
|
|
2217
92
|
* Applies border styles to component.
|
|
2218
93
|
*
|
|
2219
94
|
* @see {@link https://vuetifyjs.com/en/api/v-btn/#props-border}
|
|
2220
95
|
*/
|
|
2221
|
-
border: {
|
|
96
|
+
border: {
|
|
97
|
+
type: [String, Number, Boolean],
|
|
98
|
+
default: false
|
|
99
|
+
},
|
|
2222
100
|
/**
|
|
2223
101
|
* Designates an elevation applied to the component between 0 and 24.
|
|
2224
102
|
*
|
|
2225
103
|
* @see {@link https://vuetifyjs.com/en/api/v-btn/#props-elevation}
|
|
2226
104
|
*/
|
|
2227
|
-
elevation: {
|
|
105
|
+
elevation: {
|
|
106
|
+
type: [String, Number],
|
|
107
|
+
default: void 0
|
|
108
|
+
}
|
|
2228
109
|
},
|
|
2229
110
|
emits: {
|
|
2230
111
|
"update:modelValue": (value) => true
|
|
@@ -2255,7 +136,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent$1({
|
|
|
2255
136
|
variant: props.variant,
|
|
2256
137
|
width: props.size,
|
|
2257
138
|
"min-width": "auto",
|
|
2258
|
-
onClick:
|
|
139
|
+
onClick: onSwatchClick
|
|
2259
140
|
}, {
|
|
2260
141
|
default: withCtx(() => [
|
|
2261
142
|
color === __props.modelValue ? (openBlock(), createBlock(unref(VIcon), {
|