@vuetify/nightly 3.7.15-dev.2025-03-06 → 3.7.15-dev.2025-03-08
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/CHANGELOG.md +10 -3
- package/dist/json/attributes.json +2892 -2852
- package/dist/json/importMap-labs.json +20 -20
- package/dist/json/importMap.json +162 -162
- package/dist/json/tags.json +10 -0
- package/dist/json/web-types.json +5263 -5172
- package/dist/vuetify-labs.css +2710 -2709
- package/dist/vuetify-labs.d.ts +238 -182
- package/dist/vuetify-labs.esm.js +849 -838
- package/dist/vuetify-labs.esm.js.map +1 -1
- package/dist/vuetify-labs.js +849 -838
- package/dist/vuetify-labs.min.css +2 -2
- package/dist/vuetify.css +4710 -4709
- package/dist/vuetify.d.ts +218 -162
- package/dist/vuetify.esm.js +849 -838
- package/dist/vuetify.esm.js.map +1 -1
- package/dist/vuetify.js +849 -838
- package/dist/vuetify.js.map +1 -1
- package/dist/vuetify.min.css +2 -2
- package/dist/vuetify.min.js +479 -476
- package/dist/vuetify.min.js.map +1 -1
- package/lib/components/VAutocomplete/VAutocomplete.js +2 -13
- package/lib/components/VAutocomplete/VAutocomplete.js.map +1 -1
- package/lib/components/VColorPicker/VColorPicker.css +3 -2
- package/lib/components/VColorPicker/VColorPicker.d.ts +259 -156
- package/lib/components/VColorPicker/VColorPicker.js +16 -17
- package/lib/components/VColorPicker/VColorPicker.js.map +1 -1
- package/lib/components/VColorPicker/VColorPicker.sass +2 -1
- package/lib/components/VColorPicker/_variables.scss +1 -0
- package/lib/components/VCombobox/VCombobox.js +2 -13
- package/lib/components/VCombobox/VCombobox.js.map +1 -1
- package/lib/components/VDatePicker/VDatePicker.d.ts +6 -6
- package/lib/components/VDatePicker/VDatePicker.js +5 -2
- package/lib/components/VDatePicker/VDatePicker.js.map +1 -1
- package/lib/composables/filter.d.ts +13 -9
- package/lib/composables/filter.js +39 -8
- package/lib/composables/filter.js.map +1 -1
- package/lib/entry-bundler.js +1 -1
- package/lib/framework.d.ts +53 -53
- package/lib/framework.js +1 -1
- package/lib/labs/VCalendar/VCalendar.d.ts +6 -6
- package/lib/labs/VDateInput/VDateInput.d.ts +25 -25
- package/package.json +1 -1
package/dist/vuetify-labs.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Vuetify v3.7.15-dev.2025-03-
|
2
|
+
* Vuetify v3.7.15-dev.2025-03-08
|
3
3
|
* Forged by John Leider
|
4
4
|
* Released under the MIT License.
|
5
5
|
*/
|
@@ -12928,17 +12928,31 @@
|
|
12928
12928
|
// Types
|
12929
12929
|
|
12930
12930
|
/**
|
12931
|
-
* - match without highlight
|
12932
|
-
* - single match (index), length already known
|
12933
|
-
* - single match (start, end)
|
12934
|
-
* - multiple matches (start, end),
|
12931
|
+
* - boolean: match without highlight
|
12932
|
+
* - number: single match (index), length already known
|
12933
|
+
* - []: single match (start, end)
|
12934
|
+
* - [][]: multiple matches (start, end), shouldn't overlap
|
12935
12935
|
*/
|
12936
12936
|
|
12937
12937
|
// Composables
|
12938
12938
|
const defaultFilter = (value, query, item) => {
|
12939
12939
|
if (value == null || query == null) return -1;
|
12940
|
-
|
12940
|
+
value = value.toString().toLocaleLowerCase();
|
12941
|
+
query = query.toString().toLocaleLowerCase();
|
12942
|
+
const result = [];
|
12943
|
+
let idx = value.indexOf(query);
|
12944
|
+
while (~idx) {
|
12945
|
+
result.push([idx, idx + query.length]);
|
12946
|
+
idx = value.indexOf(query, idx + query.length);
|
12947
|
+
}
|
12948
|
+
return result.length ? result : -1;
|
12941
12949
|
};
|
12950
|
+
function normaliseMatch(match, query) {
|
12951
|
+
if (match == null || typeof match === 'boolean' || match === -1) return;
|
12952
|
+
if (typeof match === 'number') return [[match, query.length]];
|
12953
|
+
if (Array.isArray(match[0])) return match;
|
12954
|
+
return [match];
|
12955
|
+
}
|
12942
12956
|
const makeFilterProps = propsFactory({
|
12943
12957
|
customFilter: Function,
|
12944
12958
|
customKeyFilter: Object,
|
@@ -12969,7 +12983,7 @@
|
|
12969
12983
|
const keyFilter = options?.customKeyFilter?.[key];
|
12970
12984
|
match = keyFilter ? keyFilter(value, query, item) : filter(value, query, item);
|
12971
12985
|
if (match !== -1 && match !== false) {
|
12972
|
-
if (keyFilter) customMatches[key] = match;else defaultMatches[key] = match;
|
12986
|
+
if (keyFilter) customMatches[key] = normaliseMatch(match, query);else defaultMatches[key] = normaliseMatch(match, query);
|
12973
12987
|
} else if (options?.filterMode === 'every') {
|
12974
12988
|
continue loop;
|
12975
12989
|
}
|
@@ -12977,7 +12991,7 @@
|
|
12977
12991
|
} else {
|
12978
12992
|
match = filter(item, query, item);
|
12979
12993
|
if (match !== -1 && match !== false) {
|
12980
|
-
defaultMatches.title = match;
|
12994
|
+
defaultMatches.title = normaliseMatch(match, query);
|
12981
12995
|
}
|
12982
12996
|
}
|
12983
12997
|
const defaultMatchesLength = Object.keys(defaultMatches).length;
|
@@ -13037,20 +13051,26 @@
|
|
13037
13051
|
getMatches
|
13038
13052
|
};
|
13039
13053
|
}
|
13054
|
+
function highlightResult(name, text, matches) {
|
13055
|
+
if (matches == null || !matches.length) return text;
|
13056
|
+
return matches.map((match, i) => {
|
13057
|
+
const start = i === 0 ? 0 : matches[i - 1][1];
|
13058
|
+
const result = [vue.createVNode("span", {
|
13059
|
+
"class": `${name}__unmask`
|
13060
|
+
}, [text.slice(start, match[0])]), vue.createVNode("span", {
|
13061
|
+
"class": `${name}__mask`
|
13062
|
+
}, [text.slice(match[0], match[1])])];
|
13063
|
+
if (i === matches.length - 1) {
|
13064
|
+
result.push(vue.createVNode("span", {
|
13065
|
+
"class": `${name}__unmask`
|
13066
|
+
}, [text.slice(match[1])]));
|
13067
|
+
}
|
13068
|
+
return vue.createVNode(vue.Fragment, null, [result]);
|
13069
|
+
});
|
13070
|
+
}
|
13040
13071
|
|
13041
13072
|
// Types
|
13042
13073
|
|
13043
|
-
function highlightResult$1(text, matches, length) {
|
13044
|
-
if (matches == null) return text;
|
13045
|
-
if (Array.isArray(matches)) throw new Error('Multiple matches is not implemented');
|
13046
|
-
return typeof matches === 'number' && ~matches ? vue.createVNode(vue.Fragment, null, [vue.createVNode("span", {
|
13047
|
-
"class": "v-autocomplete__unmask"
|
13048
|
-
}, [text.substr(0, matches)]), vue.createVNode("span", {
|
13049
|
-
"class": "v-autocomplete__mask"
|
13050
|
-
}, [text.substr(matches, length)]), vue.createVNode("span", {
|
13051
|
-
"class": "v-autocomplete__unmask"
|
13052
|
-
}, [text.substr(matches + length)])]) : text;
|
13053
|
-
}
|
13054
13074
|
const makeVAutocompleteProps = propsFactory({
|
13055
13075
|
autoSelectFirst: {
|
13056
13076
|
type: [Boolean, String]
|
@@ -13422,7 +13442,7 @@
|
|
13422
13442
|
}, null)]);
|
13423
13443
|
},
|
13424
13444
|
title: () => {
|
13425
|
-
return isPristine.value ? item.title : highlightResult
|
13445
|
+
return isPristine.value ? item.title : highlightResult('v-autocomplete', item.title, getMatches(item)?.title);
|
13426
13446
|
}
|
13427
13447
|
});
|
13428
13448
|
}
|
@@ -16708,6 +16728,9 @@
|
|
16708
16728
|
}
|
16709
16729
|
});
|
16710
16730
|
|
16731
|
+
// Utilities
|
16732
|
+
const VPickerTitle = createSimpleFunctional('v-picker-title');
|
16733
|
+
|
16711
16734
|
const makeVSheetProps = propsFactory({
|
16712
16735
|
color: String,
|
16713
16736
|
...makeBorderProps(),
|
@@ -16762,676 +16785,66 @@
|
|
16762
16785
|
|
16763
16786
|
// Types
|
16764
16787
|
|
16765
|
-
const
|
16766
|
-
|
16767
|
-
|
16768
|
-
|
16769
|
-
|
16770
|
-
|
16771
|
-
|
16772
|
-
|
16773
|
-
|
16774
|
-
|
16775
|
-
|
16776
|
-
|
16777
|
-
|
16778
|
-
|
16779
|
-
type: String,
|
16780
|
-
default: 'rgba',
|
16781
|
-
validator: v => Object.keys(modes).includes(v)
|
16782
|
-
},
|
16783
|
-
modes: {
|
16784
|
-
type: Array,
|
16785
|
-
default: () => Object.keys(modes),
|
16786
|
-
validator: v => Array.isArray(v) && v.every(m => Object.keys(modes).includes(m))
|
16787
|
-
},
|
16788
|
-
showSwatches: Boolean,
|
16789
|
-
swatches: Array,
|
16790
|
-
swatchesMaxHeight: {
|
16791
|
-
type: [Number, String],
|
16792
|
-
default: 150
|
16793
|
-
},
|
16794
|
-
modelValue: {
|
16795
|
-
type: [Object, String]
|
16796
|
-
},
|
16797
|
-
...omit(makeVSheetProps({
|
16798
|
-
width: 300
|
16799
|
-
}), ['height', 'location', 'minHeight', 'maxHeight', 'minWidth', 'maxWidth'])
|
16800
|
-
}, 'VColorPicker');
|
16801
|
-
const VColorPicker = defineComponent({
|
16802
|
-
name: 'VColorPicker',
|
16803
|
-
props: makeVColorPickerProps(),
|
16804
|
-
emits: {
|
16805
|
-
'update:modelValue': color => true,
|
16806
|
-
'update:mode': mode => true
|
16807
|
-
},
|
16808
|
-
setup(props) {
|
16809
|
-
const mode = useProxiedModel(props, 'mode');
|
16810
|
-
const hue = vue.ref(null);
|
16811
|
-
const model = useProxiedModel(props, 'modelValue', undefined, v => {
|
16812
|
-
if (v == null || v === '') return null;
|
16813
|
-
let c;
|
16814
|
-
try {
|
16815
|
-
c = RGBtoHSV(parseColor(v));
|
16816
|
-
} catch (err) {
|
16817
|
-
consoleWarn(err);
|
16818
|
-
return null;
|
16819
|
-
}
|
16820
|
-
return c;
|
16821
|
-
}, v => {
|
16822
|
-
if (!v) return null;
|
16823
|
-
return extractColor(v, props.modelValue);
|
16824
|
-
});
|
16825
|
-
const currentColor = vue.computed(() => {
|
16826
|
-
return model.value ? {
|
16827
|
-
...model.value,
|
16828
|
-
h: hue.value ?? model.value.h
|
16829
|
-
} : null;
|
16830
|
-
});
|
16788
|
+
const makeVPickerProps = propsFactory({
|
16789
|
+
bgColor: String,
|
16790
|
+
landscape: Boolean,
|
16791
|
+
title: String,
|
16792
|
+
hideHeader: Boolean,
|
16793
|
+
...makeVSheetProps()
|
16794
|
+
}, 'VPicker');
|
16795
|
+
const VPicker = genericComponent()({
|
16796
|
+
name: 'VPicker',
|
16797
|
+
props: makeVPickerProps(),
|
16798
|
+
setup(props, _ref) {
|
16799
|
+
let {
|
16800
|
+
slots
|
16801
|
+
} = _ref;
|
16831
16802
|
const {
|
16832
|
-
|
16833
|
-
|
16834
|
-
|
16835
|
-
vue.watch(model, v => {
|
16836
|
-
if (!externalChange) {
|
16837
|
-
// prevent hue shift from rgb conversion inaccuracy
|
16838
|
-
externalChange = true;
|
16839
|
-
return;
|
16840
|
-
}
|
16841
|
-
if (!v) return;
|
16842
|
-
hue.value = v.h;
|
16843
|
-
}, {
|
16844
|
-
immediate: true
|
16845
|
-
});
|
16846
|
-
const updateColor = hsva => {
|
16847
|
-
externalChange = false;
|
16848
|
-
hue.value = hsva.h;
|
16849
|
-
model.value = hsva;
|
16850
|
-
};
|
16851
|
-
vue.onBeforeMount(() => {
|
16852
|
-
if (!props.modes.includes(mode.value)) mode.value = props.modes[0];
|
16853
|
-
});
|
16854
|
-
provideDefaults({
|
16855
|
-
VSlider: {
|
16856
|
-
color: undefined,
|
16857
|
-
trackColor: undefined,
|
16858
|
-
trackFillColor: undefined
|
16859
|
-
}
|
16860
|
-
});
|
16803
|
+
backgroundColorClasses,
|
16804
|
+
backgroundColorStyles
|
16805
|
+
} = useBackgroundColor(vue.toRef(props, 'color'));
|
16861
16806
|
useRender(() => {
|
16862
16807
|
const sheetProps = VSheet.filterProps(props);
|
16863
|
-
|
16864
|
-
|
16865
|
-
"
|
16866
|
-
"
|
16867
|
-
|
16868
|
-
|
16869
|
-
|
16870
|
-
|
16871
|
-
a: 1
|
16872
|
-
})
|
16873
|
-
}, props.style]
|
16874
|
-
}, sheetProps, {
|
16875
|
-
"maxWidth": props.width
|
16808
|
+
const hasTitle = !!(props.title || slots.title);
|
16809
|
+
return vue.createVNode(VSheet, vue.mergeProps(sheetProps, {
|
16810
|
+
"color": props.bgColor,
|
16811
|
+
"class": ['v-picker', {
|
16812
|
+
'v-picker--landscape': props.landscape,
|
16813
|
+
'v-picker--with-actions': !!slots.actions
|
16814
|
+
}, props.class],
|
16815
|
+
"style": props.style
|
16876
16816
|
}), {
|
16877
|
-
default: () => [!props.
|
16878
|
-
"key": "
|
16879
|
-
"
|
16880
|
-
"
|
16881
|
-
|
16882
|
-
"
|
16883
|
-
|
16884
|
-
|
16885
|
-
}
|
16886
|
-
"
|
16887
|
-
|
16888
|
-
|
16889
|
-
|
16890
|
-
"
|
16891
|
-
|
16892
|
-
|
16893
|
-
|
16894
|
-
|
16895
|
-
|
16896
|
-
|
16897
|
-
|
16898
|
-
|
16899
|
-
|
16900
|
-
|
16901
|
-
"disabled": props.disabled
|
16902
|
-
}, null)]), props.showSwatches && vue.createVNode(VColorPickerSwatches, {
|
16903
|
-
"key": "swatches",
|
16904
|
-
"color": currentColor.value,
|
16905
|
-
"onUpdate:color": updateColor,
|
16906
|
-
"maxHeight": props.swatchesMaxHeight,
|
16907
|
-
"swatches": props.swatches,
|
16908
|
-
"disabled": props.disabled
|
16909
|
-
}, null)]
|
16817
|
+
default: () => [!props.hideHeader && vue.createVNode("div", {
|
16818
|
+
"key": "header",
|
16819
|
+
"class": [backgroundColorClasses.value],
|
16820
|
+
"style": [backgroundColorStyles.value]
|
16821
|
+
}, [hasTitle && vue.createVNode(VPickerTitle, {
|
16822
|
+
"key": "picker-title"
|
16823
|
+
}, {
|
16824
|
+
default: () => [slots.title?.() ?? props.title]
|
16825
|
+
}), slots.header && vue.createVNode("div", {
|
16826
|
+
"class": "v-picker__header"
|
16827
|
+
}, [slots.header()])]), vue.createVNode("div", {
|
16828
|
+
"class": "v-picker__body"
|
16829
|
+
}, [slots.default?.()]), slots.actions && vue.createVNode(VDefaultsProvider, {
|
16830
|
+
"defaults": {
|
16831
|
+
VBtn: {
|
16832
|
+
slim: true,
|
16833
|
+
variant: 'text'
|
16834
|
+
}
|
16835
|
+
}
|
16836
|
+
}, {
|
16837
|
+
default: () => [vue.createVNode("div", {
|
16838
|
+
"class": "v-picker__actions"
|
16839
|
+
}, [slots.actions()])]
|
16840
|
+
})]
|
16910
16841
|
});
|
16911
16842
|
});
|
16912
16843
|
return {};
|
16913
16844
|
}
|
16914
16845
|
});
|
16915
|
-
|
16916
|
-
//
|
16917
|
-
|
16918
|
-
function highlightResult(text, matches, length) {
|
16919
|
-
if (matches == null) return text;
|
16920
|
-
if (Array.isArray(matches)) throw new Error('Multiple matches is not implemented');
|
16921
|
-
return typeof matches === 'number' && ~matches ? vue.createVNode(vue.Fragment, null, [vue.createVNode("span", {
|
16922
|
-
"class": "v-combobox__unmask"
|
16923
|
-
}, [text.substr(0, matches)]), vue.createVNode("span", {
|
16924
|
-
"class": "v-combobox__mask"
|
16925
|
-
}, [text.substr(matches, length)]), vue.createVNode("span", {
|
16926
|
-
"class": "v-combobox__unmask"
|
16927
|
-
}, [text.substr(matches + length)])]) : text;
|
16928
|
-
}
|
16929
|
-
const makeVComboboxProps = propsFactory({
|
16930
|
-
autoSelectFirst: {
|
16931
|
-
type: [Boolean, String]
|
16932
|
-
},
|
16933
|
-
clearOnSelect: {
|
16934
|
-
type: Boolean,
|
16935
|
-
default: true
|
16936
|
-
},
|
16937
|
-
delimiters: Array,
|
16938
|
-
...makeFilterProps({
|
16939
|
-
filterKeys: ['title']
|
16940
|
-
}),
|
16941
|
-
...makeSelectProps({
|
16942
|
-
hideNoData: true,
|
16943
|
-
returnObject: true
|
16944
|
-
}),
|
16945
|
-
...omit(makeVTextFieldProps({
|
16946
|
-
modelValue: null,
|
16947
|
-
role: 'combobox'
|
16948
|
-
}), ['validationValue', 'dirty', 'appendInnerIcon']),
|
16949
|
-
...makeTransitionProps({
|
16950
|
-
transition: false
|
16951
|
-
})
|
16952
|
-
}, 'VCombobox');
|
16953
|
-
const VCombobox = genericComponent()({
|
16954
|
-
name: 'VCombobox',
|
16955
|
-
props: makeVComboboxProps(),
|
16956
|
-
emits: {
|
16957
|
-
'update:focused': focused => true,
|
16958
|
-
'update:modelValue': value => true,
|
16959
|
-
'update:search': value => true,
|
16960
|
-
'update:menu': value => true
|
16961
|
-
},
|
16962
|
-
setup(props, _ref) {
|
16963
|
-
let {
|
16964
|
-
emit,
|
16965
|
-
slots
|
16966
|
-
} = _ref;
|
16967
|
-
const {
|
16968
|
-
t
|
16969
|
-
} = useLocale();
|
16970
|
-
const vTextFieldRef = vue.ref();
|
16971
|
-
const isFocused = vue.shallowRef(false);
|
16972
|
-
const isPristine = vue.shallowRef(true);
|
16973
|
-
const listHasFocus = vue.shallowRef(false);
|
16974
|
-
const vMenuRef = vue.ref();
|
16975
|
-
const vVirtualScrollRef = vue.ref();
|
16976
|
-
const _menu = useProxiedModel(props, 'menu');
|
16977
|
-
const menu = vue.computed({
|
16978
|
-
get: () => _menu.value,
|
16979
|
-
set: v => {
|
16980
|
-
if (_menu.value && !v && vMenuRef.value?.ΨopenChildren.size) return;
|
16981
|
-
_menu.value = v;
|
16982
|
-
}
|
16983
|
-
});
|
16984
|
-
const selectionIndex = vue.shallowRef(-1);
|
16985
|
-
let cleared = false;
|
16986
|
-
const color = vue.computed(() => vTextFieldRef.value?.color);
|
16987
|
-
const label = vue.computed(() => menu.value ? props.closeText : props.openText);
|
16988
|
-
const {
|
16989
|
-
items,
|
16990
|
-
transformIn,
|
16991
|
-
transformOut
|
16992
|
-
} = useItems(props);
|
16993
|
-
const {
|
16994
|
-
textColorClasses,
|
16995
|
-
textColorStyles
|
16996
|
-
} = useTextColor(color);
|
16997
|
-
const model = useProxiedModel(props, 'modelValue', [], v => transformIn(wrapInArray(v)), v => {
|
16998
|
-
const transformed = transformOut(v);
|
16999
|
-
return props.multiple ? transformed : transformed[0] ?? null;
|
17000
|
-
});
|
17001
|
-
const form = useForm(props);
|
17002
|
-
const hasChips = vue.computed(() => !!(props.chips || slots.chip));
|
17003
|
-
const hasSelectionSlot = vue.computed(() => hasChips.value || !!slots.selection);
|
17004
|
-
const _search = vue.shallowRef(!props.multiple && !hasSelectionSlot.value ? model.value[0]?.title ?? '' : '');
|
17005
|
-
const search = vue.computed({
|
17006
|
-
get: () => {
|
17007
|
-
return _search.value;
|
17008
|
-
},
|
17009
|
-
set: val => {
|
17010
|
-
_search.value = val ?? '';
|
17011
|
-
if (!props.multiple && !hasSelectionSlot.value) {
|
17012
|
-
model.value = [transformItem$3(props, val)];
|
17013
|
-
}
|
17014
|
-
if (val && props.multiple && props.delimiters?.length) {
|
17015
|
-
const values = val.split(new RegExp(`(?:${props.delimiters.join('|')})+`));
|
17016
|
-
if (values.length > 1) {
|
17017
|
-
values.forEach(v => {
|
17018
|
-
v = v.trim();
|
17019
|
-
if (v) select(transformItem$3(props, v));
|
17020
|
-
});
|
17021
|
-
_search.value = '';
|
17022
|
-
}
|
17023
|
-
}
|
17024
|
-
if (!val) selectionIndex.value = -1;
|
17025
|
-
isPristine.value = !val;
|
17026
|
-
}
|
17027
|
-
});
|
17028
|
-
const counterValue = vue.computed(() => {
|
17029
|
-
return typeof props.counterValue === 'function' ? props.counterValue(model.value) : typeof props.counterValue === 'number' ? props.counterValue : props.multiple ? model.value.length : search.value.length;
|
17030
|
-
});
|
17031
|
-
vue.watch(_search, value => {
|
17032
|
-
if (cleared) {
|
17033
|
-
// wait for clear to finish, VTextField sets _search to null
|
17034
|
-
// then search computed triggers and updates _search to ''
|
17035
|
-
vue.nextTick(() => cleared = false);
|
17036
|
-
} else if (isFocused.value && !menu.value) {
|
17037
|
-
menu.value = true;
|
17038
|
-
}
|
17039
|
-
emit('update:search', value);
|
17040
|
-
});
|
17041
|
-
vue.watch(model, value => {
|
17042
|
-
if (!props.multiple && !hasSelectionSlot.value) {
|
17043
|
-
_search.value = value[0]?.title ?? '';
|
17044
|
-
}
|
17045
|
-
});
|
17046
|
-
const {
|
17047
|
-
filteredItems,
|
17048
|
-
getMatches
|
17049
|
-
} = useFilter(props, items, () => isPristine.value ? '' : search.value);
|
17050
|
-
const displayItems = vue.computed(() => {
|
17051
|
-
if (props.hideSelected) {
|
17052
|
-
return filteredItems.value.filter(filteredItem => !model.value.some(s => s.value === filteredItem.value));
|
17053
|
-
}
|
17054
|
-
return filteredItems.value;
|
17055
|
-
});
|
17056
|
-
const selectedValues = vue.computed(() => model.value.map(selection => selection.value));
|
17057
|
-
const highlightFirst = vue.computed(() => {
|
17058
|
-
const selectFirst = props.autoSelectFirst === true || props.autoSelectFirst === 'exact' && search.value === displayItems.value[0]?.title;
|
17059
|
-
return selectFirst && displayItems.value.length > 0 && !isPristine.value && !listHasFocus.value;
|
17060
|
-
});
|
17061
|
-
const menuDisabled = vue.computed(() => props.hideNoData && !displayItems.value.length || form.isReadonly.value || form.isDisabled.value);
|
17062
|
-
const listRef = vue.ref();
|
17063
|
-
const listEvents = useScrolling(listRef, vTextFieldRef);
|
17064
|
-
function onClear(e) {
|
17065
|
-
cleared = true;
|
17066
|
-
if (props.openOnClear) {
|
17067
|
-
menu.value = true;
|
17068
|
-
}
|
17069
|
-
}
|
17070
|
-
function onMousedownControl() {
|
17071
|
-
if (menuDisabled.value) return;
|
17072
|
-
menu.value = true;
|
17073
|
-
}
|
17074
|
-
function onMousedownMenuIcon(e) {
|
17075
|
-
if (menuDisabled.value) return;
|
17076
|
-
if (isFocused.value) {
|
17077
|
-
e.preventDefault();
|
17078
|
-
e.stopPropagation();
|
17079
|
-
}
|
17080
|
-
menu.value = !menu.value;
|
17081
|
-
}
|
17082
|
-
function onListKeydown(e) {
|
17083
|
-
if (e.key !== ' ' && checkPrintable(e)) {
|
17084
|
-
vTextFieldRef.value?.focus();
|
17085
|
-
}
|
17086
|
-
}
|
17087
|
-
// eslint-disable-next-line complexity
|
17088
|
-
function onKeydown(e) {
|
17089
|
-
if (isComposingIgnoreKey(e) || form.isReadonly.value) return;
|
17090
|
-
const selectionStart = vTextFieldRef.value.selectionStart;
|
17091
|
-
const length = model.value.length;
|
17092
|
-
if (['Enter', 'ArrowDown', 'ArrowUp'].includes(e.key)) {
|
17093
|
-
e.preventDefault();
|
17094
|
-
}
|
17095
|
-
if (['Enter', 'ArrowDown'].includes(e.key)) {
|
17096
|
-
menu.value = true;
|
17097
|
-
}
|
17098
|
-
if (['Escape'].includes(e.key)) {
|
17099
|
-
menu.value = false;
|
17100
|
-
}
|
17101
|
-
if (['Enter', 'Escape', 'Tab'].includes(e.key)) {
|
17102
|
-
if (highlightFirst.value && ['Enter', 'Tab'].includes(e.key) && !model.value.some(_ref2 => {
|
17103
|
-
let {
|
17104
|
-
value
|
17105
|
-
} = _ref2;
|
17106
|
-
return value === displayItems.value[0].value;
|
17107
|
-
})) {
|
17108
|
-
select(filteredItems.value[0]);
|
17109
|
-
}
|
17110
|
-
isPristine.value = true;
|
17111
|
-
}
|
17112
|
-
if (e.key === 'ArrowDown' && highlightFirst.value) {
|
17113
|
-
listRef.value?.focus('next');
|
17114
|
-
}
|
17115
|
-
if (e.key === 'Enter' && search.value) {
|
17116
|
-
select(transformItem$3(props, search.value));
|
17117
|
-
if (hasSelectionSlot.value) _search.value = '';
|
17118
|
-
}
|
17119
|
-
if (['Backspace', 'Delete'].includes(e.key)) {
|
17120
|
-
if (!props.multiple && hasSelectionSlot.value && model.value.length > 0 && !search.value) return select(model.value[0], false);
|
17121
|
-
if (~selectionIndex.value) {
|
17122
|
-
e.preventDefault();
|
17123
|
-
const originalSelectionIndex = selectionIndex.value;
|
17124
|
-
select(model.value[selectionIndex.value], false);
|
17125
|
-
selectionIndex.value = originalSelectionIndex >= length - 1 ? length - 2 : originalSelectionIndex;
|
17126
|
-
} else if (e.key === 'Backspace' && !search.value) {
|
17127
|
-
selectionIndex.value = length - 1;
|
17128
|
-
}
|
17129
|
-
return;
|
17130
|
-
}
|
17131
|
-
if (!props.multiple) return;
|
17132
|
-
if (e.key === 'ArrowLeft') {
|
17133
|
-
if (selectionIndex.value < 0 && selectionStart > 0) return;
|
17134
|
-
const prev = selectionIndex.value > -1 ? selectionIndex.value - 1 : length - 1;
|
17135
|
-
if (model.value[prev]) {
|
17136
|
-
selectionIndex.value = prev;
|
17137
|
-
} else {
|
17138
|
-
selectionIndex.value = -1;
|
17139
|
-
vTextFieldRef.value.setSelectionRange(search.value.length, search.value.length);
|
17140
|
-
}
|
17141
|
-
} else if (e.key === 'ArrowRight') {
|
17142
|
-
if (selectionIndex.value < 0) return;
|
17143
|
-
const next = selectionIndex.value + 1;
|
17144
|
-
if (model.value[next]) {
|
17145
|
-
selectionIndex.value = next;
|
17146
|
-
} else {
|
17147
|
-
selectionIndex.value = -1;
|
17148
|
-
vTextFieldRef.value.setSelectionRange(0, 0);
|
17149
|
-
}
|
17150
|
-
} else if (~selectionIndex.value && checkPrintable(e)) {
|
17151
|
-
selectionIndex.value = -1;
|
17152
|
-
}
|
17153
|
-
}
|
17154
|
-
function onAfterEnter() {
|
17155
|
-
if (props.eager) {
|
17156
|
-
vVirtualScrollRef.value?.calculateVisibleItems();
|
17157
|
-
}
|
17158
|
-
}
|
17159
|
-
function onAfterLeave() {
|
17160
|
-
if (isFocused.value) {
|
17161
|
-
isPristine.value = true;
|
17162
|
-
vTextFieldRef.value?.focus();
|
17163
|
-
}
|
17164
|
-
}
|
17165
|
-
/** @param set - null means toggle */
|
17166
|
-
function select(item) {
|
17167
|
-
let set = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
17168
|
-
if (!item || item.props.disabled) return;
|
17169
|
-
if (props.multiple) {
|
17170
|
-
const index = model.value.findIndex(selection => (props.valueComparator || deepEqual)(selection.value, item.value));
|
17171
|
-
const add = set == null ? !~index : set;
|
17172
|
-
if (~index) {
|
17173
|
-
const value = add ? [...model.value, item] : [...model.value];
|
17174
|
-
value.splice(index, 1);
|
17175
|
-
model.value = value;
|
17176
|
-
} else if (add) {
|
17177
|
-
model.value = [...model.value, item];
|
17178
|
-
}
|
17179
|
-
if (props.clearOnSelect) {
|
17180
|
-
search.value = '';
|
17181
|
-
}
|
17182
|
-
} else {
|
17183
|
-
const add = set !== false;
|
17184
|
-
model.value = add ? [item] : [];
|
17185
|
-
_search.value = add && !hasSelectionSlot.value ? item.title : '';
|
17186
|
-
|
17187
|
-
// watch for search watcher to trigger
|
17188
|
-
vue.nextTick(() => {
|
17189
|
-
menu.value = false;
|
17190
|
-
isPristine.value = true;
|
17191
|
-
});
|
17192
|
-
}
|
17193
|
-
}
|
17194
|
-
function onFocusin(e) {
|
17195
|
-
isFocused.value = true;
|
17196
|
-
setTimeout(() => {
|
17197
|
-
listHasFocus.value = true;
|
17198
|
-
});
|
17199
|
-
}
|
17200
|
-
function onFocusout(e) {
|
17201
|
-
listHasFocus.value = false;
|
17202
|
-
}
|
17203
|
-
function onUpdateModelValue(v) {
|
17204
|
-
if (v == null || v === '' && !props.multiple && !hasSelectionSlot.value) model.value = [];
|
17205
|
-
}
|
17206
|
-
vue.watch(isFocused, (val, oldVal) => {
|
17207
|
-
if (val || val === oldVal) return;
|
17208
|
-
selectionIndex.value = -1;
|
17209
|
-
menu.value = false;
|
17210
|
-
if (search.value) {
|
17211
|
-
if (props.multiple) {
|
17212
|
-
select(transformItem$3(props, search.value));
|
17213
|
-
return;
|
17214
|
-
}
|
17215
|
-
if (!hasSelectionSlot.value) return;
|
17216
|
-
if (model.value.some(_ref3 => {
|
17217
|
-
let {
|
17218
|
-
title
|
17219
|
-
} = _ref3;
|
17220
|
-
return title === search.value;
|
17221
|
-
})) {
|
17222
|
-
_search.value = '';
|
17223
|
-
} else {
|
17224
|
-
select(transformItem$3(props, search.value));
|
17225
|
-
}
|
17226
|
-
}
|
17227
|
-
});
|
17228
|
-
vue.watch(menu, () => {
|
17229
|
-
if (!props.hideSelected && menu.value && model.value.length) {
|
17230
|
-
const index = displayItems.value.findIndex(item => model.value.some(s => (props.valueComparator || deepEqual)(s.value, item.value)));
|
17231
|
-
IN_BROWSER && window.requestAnimationFrame(() => {
|
17232
|
-
index >= 0 && vVirtualScrollRef.value?.scrollToIndex(index);
|
17233
|
-
});
|
17234
|
-
}
|
17235
|
-
});
|
17236
|
-
vue.watch(() => props.items, (newVal, oldVal) => {
|
17237
|
-
if (menu.value) return;
|
17238
|
-
if (isFocused.value && !oldVal.length && newVal.length) {
|
17239
|
-
menu.value = true;
|
17240
|
-
}
|
17241
|
-
});
|
17242
|
-
useRender(() => {
|
17243
|
-
const hasList = !!(!props.hideNoData || displayItems.value.length || slots['prepend-item'] || slots['append-item'] || slots['no-data']);
|
17244
|
-
const isDirty = model.value.length > 0;
|
17245
|
-
const textFieldProps = VTextField.filterProps(props);
|
17246
|
-
return vue.createVNode(VTextField, vue.mergeProps({
|
17247
|
-
"ref": vTextFieldRef
|
17248
|
-
}, textFieldProps, {
|
17249
|
-
"modelValue": search.value,
|
17250
|
-
"onUpdate:modelValue": [$event => search.value = $event, onUpdateModelValue],
|
17251
|
-
"focused": isFocused.value,
|
17252
|
-
"onUpdate:focused": $event => isFocused.value = $event,
|
17253
|
-
"validationValue": model.externalValue,
|
17254
|
-
"counterValue": counterValue.value,
|
17255
|
-
"dirty": isDirty,
|
17256
|
-
"class": ['v-combobox', {
|
17257
|
-
'v-combobox--active-menu': menu.value,
|
17258
|
-
'v-combobox--chips': !!props.chips,
|
17259
|
-
'v-combobox--selection-slot': !!hasSelectionSlot.value,
|
17260
|
-
'v-combobox--selecting-index': selectionIndex.value > -1,
|
17261
|
-
[`v-combobox--${props.multiple ? 'multiple' : 'single'}`]: true
|
17262
|
-
}, props.class],
|
17263
|
-
"style": props.style,
|
17264
|
-
"readonly": form.isReadonly.value,
|
17265
|
-
"placeholder": isDirty ? undefined : props.placeholder,
|
17266
|
-
"onClick:clear": onClear,
|
17267
|
-
"onMousedown:control": onMousedownControl,
|
17268
|
-
"onKeydown": onKeydown
|
17269
|
-
}), {
|
17270
|
-
...slots,
|
17271
|
-
default: () => vue.createVNode(vue.Fragment, null, [vue.createVNode(VMenu, vue.mergeProps({
|
17272
|
-
"ref": vMenuRef,
|
17273
|
-
"modelValue": menu.value,
|
17274
|
-
"onUpdate:modelValue": $event => menu.value = $event,
|
17275
|
-
"activator": "parent",
|
17276
|
-
"contentClass": "v-combobox__content",
|
17277
|
-
"disabled": menuDisabled.value,
|
17278
|
-
"eager": props.eager,
|
17279
|
-
"maxHeight": 310,
|
17280
|
-
"openOnClick": false,
|
17281
|
-
"closeOnContentClick": false,
|
17282
|
-
"transition": props.transition,
|
17283
|
-
"onAfterEnter": onAfterEnter,
|
17284
|
-
"onAfterLeave": onAfterLeave
|
17285
|
-
}, props.menuProps), {
|
17286
|
-
default: () => [hasList && vue.createVNode(VList, vue.mergeProps({
|
17287
|
-
"ref": listRef,
|
17288
|
-
"selected": selectedValues.value,
|
17289
|
-
"selectStrategy": props.multiple ? 'independent' : 'single-independent',
|
17290
|
-
"onMousedown": e => e.preventDefault(),
|
17291
|
-
"onKeydown": onListKeydown,
|
17292
|
-
"onFocusin": onFocusin,
|
17293
|
-
"onFocusout": onFocusout,
|
17294
|
-
"tabindex": "-1",
|
17295
|
-
"aria-live": "polite",
|
17296
|
-
"color": props.itemColor ?? props.color
|
17297
|
-
}, listEvents, props.listProps), {
|
17298
|
-
default: () => [slots['prepend-item']?.(), !displayItems.value.length && !props.hideNoData && (slots['no-data']?.() ?? vue.createVNode(VListItem, {
|
17299
|
-
"key": "no-data",
|
17300
|
-
"title": t(props.noDataText)
|
17301
|
-
}, null)), vue.createVNode(VVirtualScroll, {
|
17302
|
-
"ref": vVirtualScrollRef,
|
17303
|
-
"renderless": true,
|
17304
|
-
"items": displayItems.value,
|
17305
|
-
"itemKey": "value"
|
17306
|
-
}, {
|
17307
|
-
default: _ref4 => {
|
17308
|
-
let {
|
17309
|
-
item,
|
17310
|
-
index,
|
17311
|
-
itemRef
|
17312
|
-
} = _ref4;
|
17313
|
-
const itemProps = vue.mergeProps(item.props, {
|
17314
|
-
ref: itemRef,
|
17315
|
-
key: item.value,
|
17316
|
-
active: highlightFirst.value && index === 0 ? true : undefined,
|
17317
|
-
onClick: () => select(item, null)
|
17318
|
-
});
|
17319
|
-
return slots.item?.({
|
17320
|
-
item,
|
17321
|
-
index,
|
17322
|
-
props: itemProps
|
17323
|
-
}) ?? vue.createVNode(VListItem, vue.mergeProps(itemProps, {
|
17324
|
-
"role": "option"
|
17325
|
-
}), {
|
17326
|
-
prepend: _ref5 => {
|
17327
|
-
let {
|
17328
|
-
isSelected
|
17329
|
-
} = _ref5;
|
17330
|
-
return vue.createVNode(vue.Fragment, null, [props.multiple && !props.hideSelected ? vue.createVNode(VCheckboxBtn, {
|
17331
|
-
"key": item.value,
|
17332
|
-
"modelValue": isSelected,
|
17333
|
-
"ripple": false,
|
17334
|
-
"tabindex": "-1"
|
17335
|
-
}, null) : undefined, item.props.prependAvatar && vue.createVNode(VAvatar, {
|
17336
|
-
"image": item.props.prependAvatar
|
17337
|
-
}, null), item.props.prependIcon && vue.createVNode(VIcon, {
|
17338
|
-
"icon": item.props.prependIcon
|
17339
|
-
}, null)]);
|
17340
|
-
},
|
17341
|
-
title: () => {
|
17342
|
-
return isPristine.value ? item.title : highlightResult(item.title, getMatches(item)?.title, search.value?.length ?? 0);
|
17343
|
-
}
|
17344
|
-
});
|
17345
|
-
}
|
17346
|
-
}), slots['append-item']?.()]
|
17347
|
-
})]
|
17348
|
-
}), model.value.map((item, index) => {
|
17349
|
-
function onChipClose(e) {
|
17350
|
-
e.stopPropagation();
|
17351
|
-
e.preventDefault();
|
17352
|
-
select(item, false);
|
17353
|
-
}
|
17354
|
-
const slotProps = {
|
17355
|
-
'onClick:close': onChipClose,
|
17356
|
-
onKeydown(e) {
|
17357
|
-
if (e.key !== 'Enter' && e.key !== ' ') return;
|
17358
|
-
e.preventDefault();
|
17359
|
-
e.stopPropagation();
|
17360
|
-
onChipClose(e);
|
17361
|
-
},
|
17362
|
-
onMousedown(e) {
|
17363
|
-
e.preventDefault();
|
17364
|
-
e.stopPropagation();
|
17365
|
-
},
|
17366
|
-
modelValue: true,
|
17367
|
-
'onUpdate:modelValue': undefined
|
17368
|
-
};
|
17369
|
-
const hasSlot = hasChips.value ? !!slots.chip : !!slots.selection;
|
17370
|
-
const slotContent = hasSlot ? ensureValidVNode(hasChips.value ? slots.chip({
|
17371
|
-
item,
|
17372
|
-
index,
|
17373
|
-
props: slotProps
|
17374
|
-
}) : slots.selection({
|
17375
|
-
item,
|
17376
|
-
index
|
17377
|
-
})) : undefined;
|
17378
|
-
if (hasSlot && !slotContent) return undefined;
|
17379
|
-
return vue.createVNode("div", {
|
17380
|
-
"key": item.value,
|
17381
|
-
"class": ['v-combobox__selection', index === selectionIndex.value && ['v-combobox__selection--selected', textColorClasses.value]],
|
17382
|
-
"style": index === selectionIndex.value ? textColorStyles.value : {}
|
17383
|
-
}, [hasChips.value ? !slots.chip ? vue.createVNode(VChip, vue.mergeProps({
|
17384
|
-
"key": "chip",
|
17385
|
-
"closable": props.closableChips,
|
17386
|
-
"size": "small",
|
17387
|
-
"text": item.title,
|
17388
|
-
"disabled": item.props.disabled
|
17389
|
-
}, slotProps), null) : vue.createVNode(VDefaultsProvider, {
|
17390
|
-
"key": "chip-defaults",
|
17391
|
-
"defaults": {
|
17392
|
-
VChip: {
|
17393
|
-
closable: props.closableChips,
|
17394
|
-
size: 'small',
|
17395
|
-
text: item.title
|
17396
|
-
}
|
17397
|
-
}
|
17398
|
-
}, {
|
17399
|
-
default: () => [slotContent]
|
17400
|
-
}) : slotContent ?? vue.createVNode("span", {
|
17401
|
-
"class": "v-combobox__selection-text"
|
17402
|
-
}, [item.title, props.multiple && index < model.value.length - 1 && vue.createVNode("span", {
|
17403
|
-
"class": "v-combobox__selection-comma"
|
17404
|
-
}, [vue.createTextVNode(",")])])]);
|
17405
|
-
})]),
|
17406
|
-
'append-inner': function () {
|
17407
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
17408
|
-
args[_key] = arguments[_key];
|
17409
|
-
}
|
17410
|
-
return vue.createVNode(vue.Fragment, null, [slots['append-inner']?.(...args), (!props.hideNoData || props.items.length) && props.menuIcon ? vue.createVNode(VIcon, {
|
17411
|
-
"class": "v-combobox__menu-icon",
|
17412
|
-
"icon": props.menuIcon,
|
17413
|
-
"onMousedown": onMousedownMenuIcon,
|
17414
|
-
"onClick": noop,
|
17415
|
-
"aria-label": t(label.value),
|
17416
|
-
"title": t(label.value),
|
17417
|
-
"tabindex": "-1"
|
17418
|
-
}, null) : undefined]);
|
17419
|
-
}
|
17420
|
-
});
|
17421
|
-
});
|
17422
|
-
return forwardRefs({
|
17423
|
-
isFocused,
|
17424
|
-
isPristine,
|
17425
|
-
menu,
|
17426
|
-
search,
|
17427
|
-
selectionIndex,
|
17428
|
-
filteredItems,
|
17429
|
-
select
|
17430
|
-
}, vTextFieldRef);
|
17431
|
-
}
|
17432
|
-
});
|
17433
|
-
|
17434
|
-
// Utilities
|
16846
|
+
|
16847
|
+
// Utilities
|
17435
16848
|
|
17436
16849
|
// Types
|
17437
16850
|
|
@@ -18153,101 +17566,760 @@
|
|
18153
17566
|
endOfYear(date) {
|
18154
17567
|
return endOfYear(date);
|
18155
17568
|
}
|
18156
|
-
}
|
17569
|
+
}
|
17570
|
+
|
17571
|
+
// Composables
|
17572
|
+
const DateOptionsSymbol = Symbol.for('vuetify:date-options');
|
17573
|
+
const DateAdapterSymbol = Symbol.for('vuetify:date-adapter');
|
17574
|
+
function createDate(options, locale) {
|
17575
|
+
const _options = mergeDeep({
|
17576
|
+
adapter: VuetifyDateAdapter,
|
17577
|
+
locale: {
|
17578
|
+
af: 'af-ZA',
|
17579
|
+
// ar: '', # not the same value for all variants
|
17580
|
+
bg: 'bg-BG',
|
17581
|
+
ca: 'ca-ES',
|
17582
|
+
ckb: '',
|
17583
|
+
cs: 'cs-CZ',
|
17584
|
+
de: 'de-DE',
|
17585
|
+
el: 'el-GR',
|
17586
|
+
en: 'en-US',
|
17587
|
+
// es: '', # not the same value for all variants
|
17588
|
+
et: 'et-EE',
|
17589
|
+
fa: 'fa-IR',
|
17590
|
+
fi: 'fi-FI',
|
17591
|
+
// fr: '', #not the same value for all variants
|
17592
|
+
hr: 'hr-HR',
|
17593
|
+
hu: 'hu-HU',
|
17594
|
+
he: 'he-IL',
|
17595
|
+
id: 'id-ID',
|
17596
|
+
it: 'it-IT',
|
17597
|
+
ja: 'ja-JP',
|
17598
|
+
ko: 'ko-KR',
|
17599
|
+
lv: 'lv-LV',
|
17600
|
+
lt: 'lt-LT',
|
17601
|
+
nl: 'nl-NL',
|
17602
|
+
no: 'no-NO',
|
17603
|
+
pl: 'pl-PL',
|
17604
|
+
pt: 'pt-PT',
|
17605
|
+
ro: 'ro-RO',
|
17606
|
+
ru: 'ru-RU',
|
17607
|
+
sk: 'sk-SK',
|
17608
|
+
sl: 'sl-SI',
|
17609
|
+
srCyrl: 'sr-SP',
|
17610
|
+
srLatn: 'sr-SP',
|
17611
|
+
sv: 'sv-SE',
|
17612
|
+
th: 'th-TH',
|
17613
|
+
tr: 'tr-TR',
|
17614
|
+
az: 'az-AZ',
|
17615
|
+
uk: 'uk-UA',
|
17616
|
+
vi: 'vi-VN',
|
17617
|
+
zhHans: 'zh-CN',
|
17618
|
+
zhHant: 'zh-TW'
|
17619
|
+
}
|
17620
|
+
}, options);
|
17621
|
+
return {
|
17622
|
+
options: _options,
|
17623
|
+
instance: createInstance(_options, locale)
|
17624
|
+
};
|
17625
|
+
}
|
17626
|
+
function createInstance(options, locale) {
|
17627
|
+
const instance = vue.reactive(typeof options.adapter === 'function'
|
17628
|
+
// eslint-disable-next-line new-cap
|
17629
|
+
? new options.adapter({
|
17630
|
+
locale: options.locale[locale.current.value] ?? locale.current.value,
|
17631
|
+
formats: options.formats
|
17632
|
+
}) : options.adapter);
|
17633
|
+
vue.watch(locale.current, value => {
|
17634
|
+
instance.locale = options.locale[value] ?? value ?? instance.locale;
|
17635
|
+
});
|
17636
|
+
return instance;
|
17637
|
+
}
|
17638
|
+
function useDate() {
|
17639
|
+
const options = vue.inject(DateOptionsSymbol);
|
17640
|
+
if (!options) throw new Error('[Vuetify] Could not find injected date options');
|
17641
|
+
const locale = useLocale();
|
17642
|
+
return createInstance(options, locale);
|
17643
|
+
}
|
17644
|
+
|
17645
|
+
// https://stackoverflow.com/questions/274861/how-do-i-calculate-the-week-number-given-a-date/275024#275024
|
17646
|
+
function getWeek(adapter, value) {
|
17647
|
+
const date = adapter.toJsDate(value);
|
17648
|
+
let year = date.getFullYear();
|
17649
|
+
let d1w1 = new Date(year, 0, 1);
|
17650
|
+
if (date < d1w1) {
|
17651
|
+
year = year - 1;
|
17652
|
+
d1w1 = new Date(year, 0, 1);
|
17653
|
+
} else {
|
17654
|
+
const tv = new Date(year + 1, 0, 1);
|
17655
|
+
if (date >= tv) {
|
17656
|
+
year = year + 1;
|
17657
|
+
d1w1 = tv;
|
17658
|
+
}
|
17659
|
+
}
|
17660
|
+
const diffTime = Math.abs(date.getTime() - d1w1.getTime());
|
17661
|
+
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
17662
|
+
return Math.floor(diffDays / 7) + 1;
|
17663
|
+
}
|
17664
|
+
|
17665
|
+
// Types
|
17666
|
+
|
17667
|
+
const makeVColorPickerProps = propsFactory({
|
17668
|
+
canvasHeight: {
|
17669
|
+
type: [String, Number],
|
17670
|
+
default: 150
|
17671
|
+
},
|
17672
|
+
disabled: Boolean,
|
17673
|
+
dotSize: {
|
17674
|
+
type: [Number, String],
|
17675
|
+
default: 10
|
17676
|
+
},
|
17677
|
+
hideCanvas: Boolean,
|
17678
|
+
hideSliders: Boolean,
|
17679
|
+
hideInputs: Boolean,
|
17680
|
+
mode: {
|
17681
|
+
type: String,
|
17682
|
+
default: 'rgba',
|
17683
|
+
validator: v => Object.keys(modes).includes(v)
|
17684
|
+
},
|
17685
|
+
modes: {
|
17686
|
+
type: Array,
|
17687
|
+
default: () => Object.keys(modes),
|
17688
|
+
validator: v => Array.isArray(v) && v.every(m => Object.keys(modes).includes(m))
|
17689
|
+
},
|
17690
|
+
showSwatches: Boolean,
|
17691
|
+
swatches: Array,
|
17692
|
+
swatchesMaxHeight: {
|
17693
|
+
type: [Number, String],
|
17694
|
+
default: 150
|
17695
|
+
},
|
17696
|
+
modelValue: {
|
17697
|
+
type: [Object, String]
|
17698
|
+
},
|
17699
|
+
...makeVPickerProps({
|
17700
|
+
hideHeader: true
|
17701
|
+
})
|
17702
|
+
}, 'VColorPicker');
|
17703
|
+
const VColorPicker = defineComponent({
|
17704
|
+
name: 'VColorPicker',
|
17705
|
+
props: makeVColorPickerProps(),
|
17706
|
+
emits: {
|
17707
|
+
'update:modelValue': color => true,
|
17708
|
+
'update:mode': mode => true
|
17709
|
+
},
|
17710
|
+
setup(props, _ref) {
|
17711
|
+
let {
|
17712
|
+
slots
|
17713
|
+
} = _ref;
|
17714
|
+
const mode = useProxiedModel(props, 'mode');
|
17715
|
+
const hue = vue.ref(null);
|
17716
|
+
const model = useProxiedModel(props, 'modelValue', undefined, v => {
|
17717
|
+
if (v == null || v === '') return null;
|
17718
|
+
let c;
|
17719
|
+
try {
|
17720
|
+
c = RGBtoHSV(parseColor(v));
|
17721
|
+
} catch (err) {
|
17722
|
+
consoleWarn(err);
|
17723
|
+
return null;
|
17724
|
+
}
|
17725
|
+
return c;
|
17726
|
+
}, v => {
|
17727
|
+
if (!v) return null;
|
17728
|
+
return extractColor(v, props.modelValue);
|
17729
|
+
});
|
17730
|
+
const currentColor = vue.computed(() => {
|
17731
|
+
return model.value ? {
|
17732
|
+
...model.value,
|
17733
|
+
h: hue.value ?? model.value.h
|
17734
|
+
} : null;
|
17735
|
+
});
|
17736
|
+
const {
|
17737
|
+
rtlClasses
|
17738
|
+
} = useRtl();
|
17739
|
+
let externalChange = true;
|
17740
|
+
vue.watch(model, v => {
|
17741
|
+
if (!externalChange) {
|
17742
|
+
// prevent hue shift from rgb conversion inaccuracy
|
17743
|
+
externalChange = true;
|
17744
|
+
return;
|
17745
|
+
}
|
17746
|
+
if (!v) return;
|
17747
|
+
hue.value = v.h;
|
17748
|
+
}, {
|
17749
|
+
immediate: true
|
17750
|
+
});
|
17751
|
+
const updateColor = hsva => {
|
17752
|
+
externalChange = false;
|
17753
|
+
hue.value = hsva.h;
|
17754
|
+
model.value = hsva;
|
17755
|
+
};
|
17756
|
+
vue.onBeforeMount(() => {
|
17757
|
+
if (!props.modes.includes(mode.value)) mode.value = props.modes[0];
|
17758
|
+
});
|
17759
|
+
provideDefaults({
|
17760
|
+
VSlider: {
|
17761
|
+
color: undefined,
|
17762
|
+
trackColor: undefined,
|
17763
|
+
trackFillColor: undefined
|
17764
|
+
}
|
17765
|
+
});
|
17766
|
+
useRender(() => {
|
17767
|
+
const pickerProps = VPicker.filterProps(props);
|
17768
|
+
return vue.createVNode(VPicker, vue.mergeProps(pickerProps, {
|
17769
|
+
"class": ['v-color-picker', rtlClasses.value, props.class],
|
17770
|
+
"style": [{
|
17771
|
+
'--v-color-picker-color-hsv': HSVtoCSS({
|
17772
|
+
...(currentColor.value ?? nullColor),
|
17773
|
+
a: 1
|
17774
|
+
})
|
17775
|
+
}, props.style]
|
17776
|
+
}), {
|
17777
|
+
...slots,
|
17778
|
+
default: () => vue.createVNode(vue.Fragment, null, [!props.hideCanvas && vue.createVNode(VColorPickerCanvas, {
|
17779
|
+
"key": "canvas",
|
17780
|
+
"color": currentColor.value,
|
17781
|
+
"onUpdate:color": updateColor,
|
17782
|
+
"disabled": props.disabled,
|
17783
|
+
"dotSize": props.dotSize,
|
17784
|
+
"width": props.width,
|
17785
|
+
"height": props.canvasHeight
|
17786
|
+
}, null), (!props.hideSliders || !props.hideInputs) && vue.createVNode("div", {
|
17787
|
+
"key": "controls",
|
17788
|
+
"class": "v-color-picker__controls"
|
17789
|
+
}, [!props.hideSliders && vue.createVNode(VColorPickerPreview, {
|
17790
|
+
"key": "preview",
|
17791
|
+
"color": currentColor.value,
|
17792
|
+
"onUpdate:color": updateColor,
|
17793
|
+
"hideAlpha": !mode.value.endsWith('a'),
|
17794
|
+
"disabled": props.disabled
|
17795
|
+
}, null), !props.hideInputs && vue.createVNode(VColorPickerEdit, {
|
17796
|
+
"key": "edit",
|
17797
|
+
"modes": props.modes,
|
17798
|
+
"mode": mode.value,
|
17799
|
+
"onUpdate:mode": m => mode.value = m,
|
17800
|
+
"color": currentColor.value,
|
17801
|
+
"onUpdate:color": updateColor,
|
17802
|
+
"disabled": props.disabled
|
17803
|
+
}, null)]), props.showSwatches && vue.createVNode(VColorPickerSwatches, {
|
17804
|
+
"key": "swatches",
|
17805
|
+
"color": currentColor.value,
|
17806
|
+
"onUpdate:color": updateColor,
|
17807
|
+
"maxHeight": props.swatchesMaxHeight,
|
17808
|
+
"swatches": props.swatches,
|
17809
|
+
"disabled": props.disabled
|
17810
|
+
}, null)])
|
17811
|
+
});
|
17812
|
+
});
|
17813
|
+
return {};
|
17814
|
+
}
|
17815
|
+
});
|
18157
17816
|
|
18158
|
-
//
|
18159
|
-
|
18160
|
-
const
|
18161
|
-
|
18162
|
-
|
18163
|
-
|
18164
|
-
|
18165
|
-
|
18166
|
-
|
18167
|
-
|
18168
|
-
|
18169
|
-
|
18170
|
-
|
18171
|
-
|
18172
|
-
|
18173
|
-
|
18174
|
-
|
18175
|
-
|
18176
|
-
|
18177
|
-
|
18178
|
-
|
18179
|
-
|
18180
|
-
|
18181
|
-
|
18182
|
-
|
18183
|
-
|
18184
|
-
|
18185
|
-
|
18186
|
-
|
18187
|
-
|
18188
|
-
|
18189
|
-
|
18190
|
-
|
18191
|
-
|
18192
|
-
|
18193
|
-
|
18194
|
-
|
18195
|
-
|
18196
|
-
|
18197
|
-
|
18198
|
-
|
18199
|
-
|
18200
|
-
|
18201
|
-
|
18202
|
-
|
18203
|
-
|
18204
|
-
|
18205
|
-
|
17817
|
+
// Types
|
17818
|
+
|
17819
|
+
const makeVComboboxProps = propsFactory({
|
17820
|
+
autoSelectFirst: {
|
17821
|
+
type: [Boolean, String]
|
17822
|
+
},
|
17823
|
+
clearOnSelect: {
|
17824
|
+
type: Boolean,
|
17825
|
+
default: true
|
17826
|
+
},
|
17827
|
+
delimiters: Array,
|
17828
|
+
...makeFilterProps({
|
17829
|
+
filterKeys: ['title']
|
17830
|
+
}),
|
17831
|
+
...makeSelectProps({
|
17832
|
+
hideNoData: true,
|
17833
|
+
returnObject: true
|
17834
|
+
}),
|
17835
|
+
...omit(makeVTextFieldProps({
|
17836
|
+
modelValue: null,
|
17837
|
+
role: 'combobox'
|
17838
|
+
}), ['validationValue', 'dirty', 'appendInnerIcon']),
|
17839
|
+
...makeTransitionProps({
|
17840
|
+
transition: false
|
17841
|
+
})
|
17842
|
+
}, 'VCombobox');
|
17843
|
+
const VCombobox = genericComponent()({
|
17844
|
+
name: 'VCombobox',
|
17845
|
+
props: makeVComboboxProps(),
|
17846
|
+
emits: {
|
17847
|
+
'update:focused': focused => true,
|
17848
|
+
'update:modelValue': value => true,
|
17849
|
+
'update:search': value => true,
|
17850
|
+
'update:menu': value => true
|
17851
|
+
},
|
17852
|
+
setup(props, _ref) {
|
17853
|
+
let {
|
17854
|
+
emit,
|
17855
|
+
slots
|
17856
|
+
} = _ref;
|
17857
|
+
const {
|
17858
|
+
t
|
17859
|
+
} = useLocale();
|
17860
|
+
const vTextFieldRef = vue.ref();
|
17861
|
+
const isFocused = vue.shallowRef(false);
|
17862
|
+
const isPristine = vue.shallowRef(true);
|
17863
|
+
const listHasFocus = vue.shallowRef(false);
|
17864
|
+
const vMenuRef = vue.ref();
|
17865
|
+
const vVirtualScrollRef = vue.ref();
|
17866
|
+
const _menu = useProxiedModel(props, 'menu');
|
17867
|
+
const menu = vue.computed({
|
17868
|
+
get: () => _menu.value,
|
17869
|
+
set: v => {
|
17870
|
+
if (_menu.value && !v && vMenuRef.value?.ΨopenChildren.size) return;
|
17871
|
+
_menu.value = v;
|
17872
|
+
}
|
17873
|
+
});
|
17874
|
+
const selectionIndex = vue.shallowRef(-1);
|
17875
|
+
let cleared = false;
|
17876
|
+
const color = vue.computed(() => vTextFieldRef.value?.color);
|
17877
|
+
const label = vue.computed(() => menu.value ? props.closeText : props.openText);
|
17878
|
+
const {
|
17879
|
+
items,
|
17880
|
+
transformIn,
|
17881
|
+
transformOut
|
17882
|
+
} = useItems(props);
|
17883
|
+
const {
|
17884
|
+
textColorClasses,
|
17885
|
+
textColorStyles
|
17886
|
+
} = useTextColor(color);
|
17887
|
+
const model = useProxiedModel(props, 'modelValue', [], v => transformIn(wrapInArray(v)), v => {
|
17888
|
+
const transformed = transformOut(v);
|
17889
|
+
return props.multiple ? transformed : transformed[0] ?? null;
|
17890
|
+
});
|
17891
|
+
const form = useForm(props);
|
17892
|
+
const hasChips = vue.computed(() => !!(props.chips || slots.chip));
|
17893
|
+
const hasSelectionSlot = vue.computed(() => hasChips.value || !!slots.selection);
|
17894
|
+
const _search = vue.shallowRef(!props.multiple && !hasSelectionSlot.value ? model.value[0]?.title ?? '' : '');
|
17895
|
+
const search = vue.computed({
|
17896
|
+
get: () => {
|
17897
|
+
return _search.value;
|
17898
|
+
},
|
17899
|
+
set: val => {
|
17900
|
+
_search.value = val ?? '';
|
17901
|
+
if (!props.multiple && !hasSelectionSlot.value) {
|
17902
|
+
model.value = [transformItem$3(props, val)];
|
17903
|
+
}
|
17904
|
+
if (val && props.multiple && props.delimiters?.length) {
|
17905
|
+
const values = val.split(new RegExp(`(?:${props.delimiters.join('|')})+`));
|
17906
|
+
if (values.length > 1) {
|
17907
|
+
values.forEach(v => {
|
17908
|
+
v = v.trim();
|
17909
|
+
if (v) select(transformItem$3(props, v));
|
17910
|
+
});
|
17911
|
+
_search.value = '';
|
17912
|
+
}
|
17913
|
+
}
|
17914
|
+
if (!val) selectionIndex.value = -1;
|
17915
|
+
isPristine.value = !val;
|
17916
|
+
}
|
17917
|
+
});
|
17918
|
+
const counterValue = vue.computed(() => {
|
17919
|
+
return typeof props.counterValue === 'function' ? props.counterValue(model.value) : typeof props.counterValue === 'number' ? props.counterValue : props.multiple ? model.value.length : search.value.length;
|
17920
|
+
});
|
17921
|
+
vue.watch(_search, value => {
|
17922
|
+
if (cleared) {
|
17923
|
+
// wait for clear to finish, VTextField sets _search to null
|
17924
|
+
// then search computed triggers and updates _search to ''
|
17925
|
+
vue.nextTick(() => cleared = false);
|
17926
|
+
} else if (isFocused.value && !menu.value) {
|
17927
|
+
menu.value = true;
|
17928
|
+
}
|
17929
|
+
emit('update:search', value);
|
17930
|
+
});
|
17931
|
+
vue.watch(model, value => {
|
17932
|
+
if (!props.multiple && !hasSelectionSlot.value) {
|
17933
|
+
_search.value = value[0]?.title ?? '';
|
17934
|
+
}
|
17935
|
+
});
|
17936
|
+
const {
|
17937
|
+
filteredItems,
|
17938
|
+
getMatches
|
17939
|
+
} = useFilter(props, items, () => isPristine.value ? '' : search.value);
|
17940
|
+
const displayItems = vue.computed(() => {
|
17941
|
+
if (props.hideSelected) {
|
17942
|
+
return filteredItems.value.filter(filteredItem => !model.value.some(s => s.value === filteredItem.value));
|
17943
|
+
}
|
17944
|
+
return filteredItems.value;
|
17945
|
+
});
|
17946
|
+
const selectedValues = vue.computed(() => model.value.map(selection => selection.value));
|
17947
|
+
const highlightFirst = vue.computed(() => {
|
17948
|
+
const selectFirst = props.autoSelectFirst === true || props.autoSelectFirst === 'exact' && search.value === displayItems.value[0]?.title;
|
17949
|
+
return selectFirst && displayItems.value.length > 0 && !isPristine.value && !listHasFocus.value;
|
17950
|
+
});
|
17951
|
+
const menuDisabled = vue.computed(() => props.hideNoData && !displayItems.value.length || form.isReadonly.value || form.isDisabled.value);
|
17952
|
+
const listRef = vue.ref();
|
17953
|
+
const listEvents = useScrolling(listRef, vTextFieldRef);
|
17954
|
+
function onClear(e) {
|
17955
|
+
cleared = true;
|
17956
|
+
if (props.openOnClear) {
|
17957
|
+
menu.value = true;
|
17958
|
+
}
|
18206
17959
|
}
|
18207
|
-
|
18208
|
-
|
18209
|
-
|
18210
|
-
|
18211
|
-
|
18212
|
-
|
18213
|
-
|
18214
|
-
|
18215
|
-
|
18216
|
-
|
18217
|
-
|
18218
|
-
|
18219
|
-
|
18220
|
-
|
18221
|
-
|
18222
|
-
|
18223
|
-
|
18224
|
-
|
18225
|
-
|
18226
|
-
|
18227
|
-
|
18228
|
-
|
18229
|
-
|
18230
|
-
|
17960
|
+
function onMousedownControl() {
|
17961
|
+
if (menuDisabled.value) return;
|
17962
|
+
menu.value = true;
|
17963
|
+
}
|
17964
|
+
function onMousedownMenuIcon(e) {
|
17965
|
+
if (menuDisabled.value) return;
|
17966
|
+
if (isFocused.value) {
|
17967
|
+
e.preventDefault();
|
17968
|
+
e.stopPropagation();
|
17969
|
+
}
|
17970
|
+
menu.value = !menu.value;
|
17971
|
+
}
|
17972
|
+
function onListKeydown(e) {
|
17973
|
+
if (e.key !== ' ' && checkPrintable(e)) {
|
17974
|
+
vTextFieldRef.value?.focus();
|
17975
|
+
}
|
17976
|
+
}
|
17977
|
+
// eslint-disable-next-line complexity
|
17978
|
+
function onKeydown(e) {
|
17979
|
+
if (isComposingIgnoreKey(e) || form.isReadonly.value) return;
|
17980
|
+
const selectionStart = vTextFieldRef.value.selectionStart;
|
17981
|
+
const length = model.value.length;
|
17982
|
+
if (['Enter', 'ArrowDown', 'ArrowUp'].includes(e.key)) {
|
17983
|
+
e.preventDefault();
|
17984
|
+
}
|
17985
|
+
if (['Enter', 'ArrowDown'].includes(e.key)) {
|
17986
|
+
menu.value = true;
|
17987
|
+
}
|
17988
|
+
if (['Escape'].includes(e.key)) {
|
17989
|
+
menu.value = false;
|
17990
|
+
}
|
17991
|
+
if (['Enter', 'Escape', 'Tab'].includes(e.key)) {
|
17992
|
+
if (highlightFirst.value && ['Enter', 'Tab'].includes(e.key) && !model.value.some(_ref2 => {
|
17993
|
+
let {
|
17994
|
+
value
|
17995
|
+
} = _ref2;
|
17996
|
+
return value === displayItems.value[0].value;
|
17997
|
+
})) {
|
17998
|
+
select(filteredItems.value[0]);
|
17999
|
+
}
|
18000
|
+
isPristine.value = true;
|
18001
|
+
}
|
18002
|
+
if (e.key === 'ArrowDown' && highlightFirst.value) {
|
18003
|
+
listRef.value?.focus('next');
|
18004
|
+
}
|
18005
|
+
if (e.key === 'Enter' && search.value) {
|
18006
|
+
select(transformItem$3(props, search.value));
|
18007
|
+
if (hasSelectionSlot.value) _search.value = '';
|
18008
|
+
}
|
18009
|
+
if (['Backspace', 'Delete'].includes(e.key)) {
|
18010
|
+
if (!props.multiple && hasSelectionSlot.value && model.value.length > 0 && !search.value) return select(model.value[0], false);
|
18011
|
+
if (~selectionIndex.value) {
|
18012
|
+
e.preventDefault();
|
18013
|
+
const originalSelectionIndex = selectionIndex.value;
|
18014
|
+
select(model.value[selectionIndex.value], false);
|
18015
|
+
selectionIndex.value = originalSelectionIndex >= length - 1 ? length - 2 : originalSelectionIndex;
|
18016
|
+
} else if (e.key === 'Backspace' && !search.value) {
|
18017
|
+
selectionIndex.value = length - 1;
|
18018
|
+
}
|
18019
|
+
return;
|
18020
|
+
}
|
18021
|
+
if (!props.multiple) return;
|
18022
|
+
if (e.key === 'ArrowLeft') {
|
18023
|
+
if (selectionIndex.value < 0 && selectionStart > 0) return;
|
18024
|
+
const prev = selectionIndex.value > -1 ? selectionIndex.value - 1 : length - 1;
|
18025
|
+
if (model.value[prev]) {
|
18026
|
+
selectionIndex.value = prev;
|
18027
|
+
} else {
|
18028
|
+
selectionIndex.value = -1;
|
18029
|
+
vTextFieldRef.value.setSelectionRange(search.value.length, search.value.length);
|
18030
|
+
}
|
18031
|
+
} else if (e.key === 'ArrowRight') {
|
18032
|
+
if (selectionIndex.value < 0) return;
|
18033
|
+
const next = selectionIndex.value + 1;
|
18034
|
+
if (model.value[next]) {
|
18035
|
+
selectionIndex.value = next;
|
18036
|
+
} else {
|
18037
|
+
selectionIndex.value = -1;
|
18038
|
+
vTextFieldRef.value.setSelectionRange(0, 0);
|
18039
|
+
}
|
18040
|
+
} else if (~selectionIndex.value && checkPrintable(e)) {
|
18041
|
+
selectionIndex.value = -1;
|
18042
|
+
}
|
18043
|
+
}
|
18044
|
+
function onAfterEnter() {
|
18045
|
+
if (props.eager) {
|
18046
|
+
vVirtualScrollRef.value?.calculateVisibleItems();
|
18047
|
+
}
|
18048
|
+
}
|
18049
|
+
function onAfterLeave() {
|
18050
|
+
if (isFocused.value) {
|
18051
|
+
isPristine.value = true;
|
18052
|
+
vTextFieldRef.value?.focus();
|
18053
|
+
}
|
18054
|
+
}
|
18055
|
+
/** @param set - null means toggle */
|
18056
|
+
function select(item) {
|
18057
|
+
let set = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
18058
|
+
if (!item || item.props.disabled) return;
|
18059
|
+
if (props.multiple) {
|
18060
|
+
const index = model.value.findIndex(selection => (props.valueComparator || deepEqual)(selection.value, item.value));
|
18061
|
+
const add = set == null ? !~index : set;
|
18062
|
+
if (~index) {
|
18063
|
+
const value = add ? [...model.value, item] : [...model.value];
|
18064
|
+
value.splice(index, 1);
|
18065
|
+
model.value = value;
|
18066
|
+
} else if (add) {
|
18067
|
+
model.value = [...model.value, item];
|
18068
|
+
}
|
18069
|
+
if (props.clearOnSelect) {
|
18070
|
+
search.value = '';
|
18071
|
+
}
|
18072
|
+
} else {
|
18073
|
+
const add = set !== false;
|
18074
|
+
model.value = add ? [item] : [];
|
18075
|
+
_search.value = add && !hasSelectionSlot.value ? item.title : '';
|
18231
18076
|
|
18232
|
-
|
18233
|
-
|
18234
|
-
|
18235
|
-
|
18236
|
-
|
18237
|
-
|
18238
|
-
|
18239
|
-
|
18240
|
-
|
18241
|
-
|
18242
|
-
|
18243
|
-
|
18244
|
-
d1w1 = tv;
|
18077
|
+
// watch for search watcher to trigger
|
18078
|
+
vue.nextTick(() => {
|
18079
|
+
menu.value = false;
|
18080
|
+
isPristine.value = true;
|
18081
|
+
});
|
18082
|
+
}
|
18083
|
+
}
|
18084
|
+
function onFocusin(e) {
|
18085
|
+
isFocused.value = true;
|
18086
|
+
setTimeout(() => {
|
18087
|
+
listHasFocus.value = true;
|
18088
|
+
});
|
18245
18089
|
}
|
18090
|
+
function onFocusout(e) {
|
18091
|
+
listHasFocus.value = false;
|
18092
|
+
}
|
18093
|
+
function onUpdateModelValue(v) {
|
18094
|
+
if (v == null || v === '' && !props.multiple && !hasSelectionSlot.value) model.value = [];
|
18095
|
+
}
|
18096
|
+
vue.watch(isFocused, (val, oldVal) => {
|
18097
|
+
if (val || val === oldVal) return;
|
18098
|
+
selectionIndex.value = -1;
|
18099
|
+
menu.value = false;
|
18100
|
+
if (search.value) {
|
18101
|
+
if (props.multiple) {
|
18102
|
+
select(transformItem$3(props, search.value));
|
18103
|
+
return;
|
18104
|
+
}
|
18105
|
+
if (!hasSelectionSlot.value) return;
|
18106
|
+
if (model.value.some(_ref3 => {
|
18107
|
+
let {
|
18108
|
+
title
|
18109
|
+
} = _ref3;
|
18110
|
+
return title === search.value;
|
18111
|
+
})) {
|
18112
|
+
_search.value = '';
|
18113
|
+
} else {
|
18114
|
+
select(transformItem$3(props, search.value));
|
18115
|
+
}
|
18116
|
+
}
|
18117
|
+
});
|
18118
|
+
vue.watch(menu, () => {
|
18119
|
+
if (!props.hideSelected && menu.value && model.value.length) {
|
18120
|
+
const index = displayItems.value.findIndex(item => model.value.some(s => (props.valueComparator || deepEqual)(s.value, item.value)));
|
18121
|
+
IN_BROWSER && window.requestAnimationFrame(() => {
|
18122
|
+
index >= 0 && vVirtualScrollRef.value?.scrollToIndex(index);
|
18123
|
+
});
|
18124
|
+
}
|
18125
|
+
});
|
18126
|
+
vue.watch(() => props.items, (newVal, oldVal) => {
|
18127
|
+
if (menu.value) return;
|
18128
|
+
if (isFocused.value && !oldVal.length && newVal.length) {
|
18129
|
+
menu.value = true;
|
18130
|
+
}
|
18131
|
+
});
|
18132
|
+
useRender(() => {
|
18133
|
+
const hasList = !!(!props.hideNoData || displayItems.value.length || slots['prepend-item'] || slots['append-item'] || slots['no-data']);
|
18134
|
+
const isDirty = model.value.length > 0;
|
18135
|
+
const textFieldProps = VTextField.filterProps(props);
|
18136
|
+
return vue.createVNode(VTextField, vue.mergeProps({
|
18137
|
+
"ref": vTextFieldRef
|
18138
|
+
}, textFieldProps, {
|
18139
|
+
"modelValue": search.value,
|
18140
|
+
"onUpdate:modelValue": [$event => search.value = $event, onUpdateModelValue],
|
18141
|
+
"focused": isFocused.value,
|
18142
|
+
"onUpdate:focused": $event => isFocused.value = $event,
|
18143
|
+
"validationValue": model.externalValue,
|
18144
|
+
"counterValue": counterValue.value,
|
18145
|
+
"dirty": isDirty,
|
18146
|
+
"class": ['v-combobox', {
|
18147
|
+
'v-combobox--active-menu': menu.value,
|
18148
|
+
'v-combobox--chips': !!props.chips,
|
18149
|
+
'v-combobox--selection-slot': !!hasSelectionSlot.value,
|
18150
|
+
'v-combobox--selecting-index': selectionIndex.value > -1,
|
18151
|
+
[`v-combobox--${props.multiple ? 'multiple' : 'single'}`]: true
|
18152
|
+
}, props.class],
|
18153
|
+
"style": props.style,
|
18154
|
+
"readonly": form.isReadonly.value,
|
18155
|
+
"placeholder": isDirty ? undefined : props.placeholder,
|
18156
|
+
"onClick:clear": onClear,
|
18157
|
+
"onMousedown:control": onMousedownControl,
|
18158
|
+
"onKeydown": onKeydown
|
18159
|
+
}), {
|
18160
|
+
...slots,
|
18161
|
+
default: () => vue.createVNode(vue.Fragment, null, [vue.createVNode(VMenu, vue.mergeProps({
|
18162
|
+
"ref": vMenuRef,
|
18163
|
+
"modelValue": menu.value,
|
18164
|
+
"onUpdate:modelValue": $event => menu.value = $event,
|
18165
|
+
"activator": "parent",
|
18166
|
+
"contentClass": "v-combobox__content",
|
18167
|
+
"disabled": menuDisabled.value,
|
18168
|
+
"eager": props.eager,
|
18169
|
+
"maxHeight": 310,
|
18170
|
+
"openOnClick": false,
|
18171
|
+
"closeOnContentClick": false,
|
18172
|
+
"transition": props.transition,
|
18173
|
+
"onAfterEnter": onAfterEnter,
|
18174
|
+
"onAfterLeave": onAfterLeave
|
18175
|
+
}, props.menuProps), {
|
18176
|
+
default: () => [hasList && vue.createVNode(VList, vue.mergeProps({
|
18177
|
+
"ref": listRef,
|
18178
|
+
"selected": selectedValues.value,
|
18179
|
+
"selectStrategy": props.multiple ? 'independent' : 'single-independent',
|
18180
|
+
"onMousedown": e => e.preventDefault(),
|
18181
|
+
"onKeydown": onListKeydown,
|
18182
|
+
"onFocusin": onFocusin,
|
18183
|
+
"onFocusout": onFocusout,
|
18184
|
+
"tabindex": "-1",
|
18185
|
+
"aria-live": "polite",
|
18186
|
+
"color": props.itemColor ?? props.color
|
18187
|
+
}, listEvents, props.listProps), {
|
18188
|
+
default: () => [slots['prepend-item']?.(), !displayItems.value.length && !props.hideNoData && (slots['no-data']?.() ?? vue.createVNode(VListItem, {
|
18189
|
+
"key": "no-data",
|
18190
|
+
"title": t(props.noDataText)
|
18191
|
+
}, null)), vue.createVNode(VVirtualScroll, {
|
18192
|
+
"ref": vVirtualScrollRef,
|
18193
|
+
"renderless": true,
|
18194
|
+
"items": displayItems.value,
|
18195
|
+
"itemKey": "value"
|
18196
|
+
}, {
|
18197
|
+
default: _ref4 => {
|
18198
|
+
let {
|
18199
|
+
item,
|
18200
|
+
index,
|
18201
|
+
itemRef
|
18202
|
+
} = _ref4;
|
18203
|
+
const itemProps = vue.mergeProps(item.props, {
|
18204
|
+
ref: itemRef,
|
18205
|
+
key: item.value,
|
18206
|
+
active: highlightFirst.value && index === 0 ? true : undefined,
|
18207
|
+
onClick: () => select(item, null)
|
18208
|
+
});
|
18209
|
+
return slots.item?.({
|
18210
|
+
item,
|
18211
|
+
index,
|
18212
|
+
props: itemProps
|
18213
|
+
}) ?? vue.createVNode(VListItem, vue.mergeProps(itemProps, {
|
18214
|
+
"role": "option"
|
18215
|
+
}), {
|
18216
|
+
prepend: _ref5 => {
|
18217
|
+
let {
|
18218
|
+
isSelected
|
18219
|
+
} = _ref5;
|
18220
|
+
return vue.createVNode(vue.Fragment, null, [props.multiple && !props.hideSelected ? vue.createVNode(VCheckboxBtn, {
|
18221
|
+
"key": item.value,
|
18222
|
+
"modelValue": isSelected,
|
18223
|
+
"ripple": false,
|
18224
|
+
"tabindex": "-1"
|
18225
|
+
}, null) : undefined, item.props.prependAvatar && vue.createVNode(VAvatar, {
|
18226
|
+
"image": item.props.prependAvatar
|
18227
|
+
}, null), item.props.prependIcon && vue.createVNode(VIcon, {
|
18228
|
+
"icon": item.props.prependIcon
|
18229
|
+
}, null)]);
|
18230
|
+
},
|
18231
|
+
title: () => {
|
18232
|
+
return isPristine.value ? item.title : highlightResult('v-combobox', item.title, getMatches(item)?.title);
|
18233
|
+
}
|
18234
|
+
});
|
18235
|
+
}
|
18236
|
+
}), slots['append-item']?.()]
|
18237
|
+
})]
|
18238
|
+
}), model.value.map((item, index) => {
|
18239
|
+
function onChipClose(e) {
|
18240
|
+
e.stopPropagation();
|
18241
|
+
e.preventDefault();
|
18242
|
+
select(item, false);
|
18243
|
+
}
|
18244
|
+
const slotProps = {
|
18245
|
+
'onClick:close': onChipClose,
|
18246
|
+
onKeydown(e) {
|
18247
|
+
if (e.key !== 'Enter' && e.key !== ' ') return;
|
18248
|
+
e.preventDefault();
|
18249
|
+
e.stopPropagation();
|
18250
|
+
onChipClose(e);
|
18251
|
+
},
|
18252
|
+
onMousedown(e) {
|
18253
|
+
e.preventDefault();
|
18254
|
+
e.stopPropagation();
|
18255
|
+
},
|
18256
|
+
modelValue: true,
|
18257
|
+
'onUpdate:modelValue': undefined
|
18258
|
+
};
|
18259
|
+
const hasSlot = hasChips.value ? !!slots.chip : !!slots.selection;
|
18260
|
+
const slotContent = hasSlot ? ensureValidVNode(hasChips.value ? slots.chip({
|
18261
|
+
item,
|
18262
|
+
index,
|
18263
|
+
props: slotProps
|
18264
|
+
}) : slots.selection({
|
18265
|
+
item,
|
18266
|
+
index
|
18267
|
+
})) : undefined;
|
18268
|
+
if (hasSlot && !slotContent) return undefined;
|
18269
|
+
return vue.createVNode("div", {
|
18270
|
+
"key": item.value,
|
18271
|
+
"class": ['v-combobox__selection', index === selectionIndex.value && ['v-combobox__selection--selected', textColorClasses.value]],
|
18272
|
+
"style": index === selectionIndex.value ? textColorStyles.value : {}
|
18273
|
+
}, [hasChips.value ? !slots.chip ? vue.createVNode(VChip, vue.mergeProps({
|
18274
|
+
"key": "chip",
|
18275
|
+
"closable": props.closableChips,
|
18276
|
+
"size": "small",
|
18277
|
+
"text": item.title,
|
18278
|
+
"disabled": item.props.disabled
|
18279
|
+
}, slotProps), null) : vue.createVNode(VDefaultsProvider, {
|
18280
|
+
"key": "chip-defaults",
|
18281
|
+
"defaults": {
|
18282
|
+
VChip: {
|
18283
|
+
closable: props.closableChips,
|
18284
|
+
size: 'small',
|
18285
|
+
text: item.title
|
18286
|
+
}
|
18287
|
+
}
|
18288
|
+
}, {
|
18289
|
+
default: () => [slotContent]
|
18290
|
+
}) : slotContent ?? vue.createVNode("span", {
|
18291
|
+
"class": "v-combobox__selection-text"
|
18292
|
+
}, [item.title, props.multiple && index < model.value.length - 1 && vue.createVNode("span", {
|
18293
|
+
"class": "v-combobox__selection-comma"
|
18294
|
+
}, [vue.createTextVNode(",")])])]);
|
18295
|
+
})]),
|
18296
|
+
'append-inner': function () {
|
18297
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
18298
|
+
args[_key] = arguments[_key];
|
18299
|
+
}
|
18300
|
+
return vue.createVNode(vue.Fragment, null, [slots['append-inner']?.(...args), (!props.hideNoData || props.items.length) && props.menuIcon ? vue.createVNode(VIcon, {
|
18301
|
+
"class": "v-combobox__menu-icon",
|
18302
|
+
"icon": props.menuIcon,
|
18303
|
+
"onMousedown": onMousedownMenuIcon,
|
18304
|
+
"onClick": noop,
|
18305
|
+
"aria-label": t(label.value),
|
18306
|
+
"title": t(label.value),
|
18307
|
+
"tabindex": "-1"
|
18308
|
+
}, null) : undefined]);
|
18309
|
+
}
|
18310
|
+
});
|
18311
|
+
});
|
18312
|
+
return forwardRefs({
|
18313
|
+
isFocused,
|
18314
|
+
isPristine,
|
18315
|
+
menu,
|
18316
|
+
search,
|
18317
|
+
selectionIndex,
|
18318
|
+
filteredItems,
|
18319
|
+
select
|
18320
|
+
}, vTextFieldRef);
|
18246
18321
|
}
|
18247
|
-
|
18248
|
-
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
18249
|
-
return Math.floor(diffDays / 7) + 1;
|
18250
|
-
}
|
18322
|
+
});
|
18251
18323
|
|
18252
18324
|
// Types
|
18253
18325
|
|
@@ -22196,70 +22268,6 @@
|
|
22196
22268
|
}
|
22197
22269
|
});
|
22198
22270
|
|
22199
|
-
// Utilities
|
22200
|
-
const VPickerTitle = createSimpleFunctional('v-picker-title');
|
22201
|
-
|
22202
|
-
// Types
|
22203
|
-
|
22204
|
-
const makeVPickerProps = propsFactory({
|
22205
|
-
bgColor: String,
|
22206
|
-
landscape: Boolean,
|
22207
|
-
title: String,
|
22208
|
-
hideHeader: Boolean,
|
22209
|
-
...makeVSheetProps()
|
22210
|
-
}, 'VPicker');
|
22211
|
-
const VPicker = genericComponent()({
|
22212
|
-
name: 'VPicker',
|
22213
|
-
props: makeVPickerProps(),
|
22214
|
-
setup(props, _ref) {
|
22215
|
-
let {
|
22216
|
-
slots
|
22217
|
-
} = _ref;
|
22218
|
-
const {
|
22219
|
-
backgroundColorClasses,
|
22220
|
-
backgroundColorStyles
|
22221
|
-
} = useBackgroundColor(vue.toRef(props, 'color'));
|
22222
|
-
useRender(() => {
|
22223
|
-
const sheetProps = VSheet.filterProps(props);
|
22224
|
-
const hasTitle = !!(props.title || slots.title);
|
22225
|
-
return vue.createVNode(VSheet, vue.mergeProps(sheetProps, {
|
22226
|
-
"color": props.bgColor,
|
22227
|
-
"class": ['v-picker', {
|
22228
|
-
'v-picker--landscape': props.landscape,
|
22229
|
-
'v-picker--with-actions': !!slots.actions
|
22230
|
-
}, props.class],
|
22231
|
-
"style": props.style
|
22232
|
-
}), {
|
22233
|
-
default: () => [!props.hideHeader && vue.createVNode("div", {
|
22234
|
-
"key": "header",
|
22235
|
-
"class": [backgroundColorClasses.value],
|
22236
|
-
"style": [backgroundColorStyles.value]
|
22237
|
-
}, [hasTitle && vue.createVNode(VPickerTitle, {
|
22238
|
-
"key": "picker-title"
|
22239
|
-
}, {
|
22240
|
-
default: () => [slots.title?.() ?? props.title]
|
22241
|
-
}), slots.header && vue.createVNode("div", {
|
22242
|
-
"class": "v-picker__header"
|
22243
|
-
}, [slots.header()])]), vue.createVNode("div", {
|
22244
|
-
"class": "v-picker__body"
|
22245
|
-
}, [slots.default?.()]), slots.actions && vue.createVNode(VDefaultsProvider, {
|
22246
|
-
"defaults": {
|
22247
|
-
VBtn: {
|
22248
|
-
slim: true,
|
22249
|
-
variant: 'text'
|
22250
|
-
}
|
22251
|
-
}
|
22252
|
-
}, {
|
22253
|
-
default: () => [vue.createVNode("div", {
|
22254
|
-
"class": "v-picker__actions"
|
22255
|
-
}, [slots.actions()])]
|
22256
|
-
})]
|
22257
|
-
});
|
22258
|
-
});
|
22259
|
-
return {};
|
22260
|
-
}
|
22261
|
-
});
|
22262
|
-
|
22263
22271
|
// Types
|
22264
22272
|
|
22265
22273
|
// Types
|
@@ -22320,6 +22328,9 @@
|
|
22320
22328
|
const {
|
22321
22329
|
t
|
22322
22330
|
} = useLocale();
|
22331
|
+
const {
|
22332
|
+
rtlClasses
|
22333
|
+
} = useRtl();
|
22323
22334
|
const model = useProxiedModel(props, 'modelValue', undefined, v => wrapInArray(v), v => props.multiple ? v : v[0]);
|
22324
22335
|
const viewMode = useProxiedModel(props, 'viewMode');
|
22325
22336
|
// const inputMode = useProxiedModel(props, 'inputMode')
|
@@ -22457,7 +22468,7 @@
|
|
22457
22468
|
return vue.createVNode(VPicker, vue.mergeProps(pickerProps, {
|
22458
22469
|
"class": ['v-date-picker', `v-date-picker--${viewMode.value}`, {
|
22459
22470
|
'v-date-picker--show-week': props.showWeek
|
22460
|
-
}, props.class],
|
22471
|
+
}, rtlClasses.value, props.class],
|
22461
22472
|
"style": props.style
|
22462
22473
|
}), {
|
22463
22474
|
title: () => slots.title?.() ?? vue.createVNode("div", {
|
@@ -31152,7 +31163,7 @@
|
|
31152
31163
|
};
|
31153
31164
|
});
|
31154
31165
|
}
|
31155
|
-
const version$1 = "3.7.15-dev.2025-03-
|
31166
|
+
const version$1 = "3.7.15-dev.2025-03-08";
|
31156
31167
|
createVuetify$1.version = version$1;
|
31157
31168
|
|
31158
31169
|
// Vue's inject() can only be used in setup
|
@@ -31405,7 +31416,7 @@
|
|
31405
31416
|
|
31406
31417
|
/* eslint-disable local-rules/sort-imports */
|
31407
31418
|
|
31408
|
-
const version = "3.7.15-dev.2025-03-
|
31419
|
+
const version = "3.7.15-dev.2025-03-08";
|
31409
31420
|
|
31410
31421
|
/* eslint-disable local-rules/sort-imports */
|
31411
31422
|
|