@coreui/vue-pro 4.9.0-beta.2 → 4.9.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/README.md +1 -1
- package/dist/components/dropdown/CDropdown.d.ts +62 -4
- package/dist/components/dropdown/CDropdownToggle.d.ts +1 -1
- package/dist/components/multi-select/CMultiSelect.d.ts +6 -6
- package/dist/components/popover/CPopover.d.ts +75 -6
- package/dist/components/toast/CToast.d.ts +1 -1
- package/dist/components/tooltip/CTooltip.d.ts +77 -8
- package/dist/composables/index.d.ts +2 -2
- package/dist/composables/useColorModes.d.ts +1 -1
- package/dist/composables/usePopper.d.ts +6 -0
- package/dist/index.es.js +424 -325
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +423 -324
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils/getRTLPlacement.d.ts +3 -0
- package/dist/utils/index.d.ts +2 -1
- package/package.json +10 -10
- package/src/components/date-range-picker/CDateRangePicker.ts +50 -17
- package/src/components/dropdown/CDropdown.ts +116 -61
- package/src/components/dropdown/CDropdownMenu.ts +2 -47
- package/src/components/dropdown/CDropdownToggle.ts +5 -5
- package/src/components/multi-select/CMultiSelect.ts +58 -67
- package/src/components/multi-select/CMultiSelectSelection.ts +10 -11
- package/src/components/picker/CPicker.ts +22 -7
- package/src/components/popover/CPopover.ts +96 -50
- package/src/components/time-picker/CTimePicker.ts +63 -34
- package/src/components/tooltip/CTooltip.ts +97 -51
- package/src/composables/index.ts +2 -2
- package/src/composables/usePopper.ts +25 -0
- package/src/types.ts +1 -1
- package/src/utils/getRTLPlacement.ts +18 -0
- package/src/utils/index.ts +2 -1
- package/src/composables/useColorModes.ts +0 -62
package/dist/index.js
CHANGED
|
@@ -1831,6 +1831,30 @@ const CCardPlugin = {
|
|
|
1831
1831
|
},
|
|
1832
1832
|
};
|
|
1833
1833
|
|
|
1834
|
+
const isRTL = (element) => {
|
|
1835
|
+
if (typeof document !== 'undefined' && document.documentElement.dir === 'rtl') {
|
|
1836
|
+
return true;
|
|
1837
|
+
}
|
|
1838
|
+
if (element) {
|
|
1839
|
+
return element.closest('[dir="rtl"]') !== null;
|
|
1840
|
+
}
|
|
1841
|
+
return false;
|
|
1842
|
+
};
|
|
1843
|
+
|
|
1844
|
+
const getRTLPlacement = (placement, element) => {
|
|
1845
|
+
switch (placement) {
|
|
1846
|
+
case 'right': {
|
|
1847
|
+
return isRTL(element) ? 'left' : 'right';
|
|
1848
|
+
}
|
|
1849
|
+
case 'left': {
|
|
1850
|
+
return isRTL(element) ? 'right' : 'left';
|
|
1851
|
+
}
|
|
1852
|
+
default: {
|
|
1853
|
+
return placement;
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
};
|
|
1857
|
+
|
|
1834
1858
|
const getUID = (prefix) => {
|
|
1835
1859
|
do {
|
|
1836
1860
|
prefix += Math.floor(Math.random() * 1_000_000);
|
|
@@ -1857,16 +1881,6 @@ const isObjectInArray = (array, item, ignore = []) => array.some((_item) => {
|
|
|
1857
1881
|
return result;
|
|
1858
1882
|
});
|
|
1859
1883
|
|
|
1860
|
-
const isRTL = (element) => {
|
|
1861
|
-
if (typeof document !== 'undefined' && document.documentElement.dir === 'rtl') {
|
|
1862
|
-
return true;
|
|
1863
|
-
}
|
|
1864
|
-
if (element) {
|
|
1865
|
-
return element.closest('[dir="rtl"]') !== null;
|
|
1866
|
-
}
|
|
1867
|
-
return false;
|
|
1868
|
-
};
|
|
1869
|
-
|
|
1870
1884
|
const CCarousel = vue.defineComponent({
|
|
1871
1885
|
name: 'CCarousel',
|
|
1872
1886
|
props: {
|
|
@@ -6489,6 +6503,8 @@ const CPicker = vue.defineComponent({
|
|
|
6489
6503
|
default: {
|
|
6490
6504
|
return () => vue.h('div', {
|
|
6491
6505
|
class: [
|
|
6506
|
+
'dropdown',
|
|
6507
|
+
'picker',
|
|
6492
6508
|
attrs.class,
|
|
6493
6509
|
{
|
|
6494
6510
|
show: visible.value,
|
|
@@ -6510,7 +6526,16 @@ const CPicker = vue.defineComponent({
|
|
|
6510
6526
|
togglerRef.value = el;
|
|
6511
6527
|
},
|
|
6512
6528
|
})),
|
|
6513
|
-
vue.h('div', {
|
|
6529
|
+
vue.h('div', {
|
|
6530
|
+
class: [
|
|
6531
|
+
'dropdown-menu',
|
|
6532
|
+
{
|
|
6533
|
+
show: visible.value,
|
|
6534
|
+
},
|
|
6535
|
+
props.dropdownClassNames,
|
|
6536
|
+
],
|
|
6537
|
+
ref: dropdownRef,
|
|
6538
|
+
}, [
|
|
6514
6539
|
slots.default && slots.default(),
|
|
6515
6540
|
/**
|
|
6516
6541
|
* @slot Location for the footer element.
|
|
@@ -7010,10 +7035,18 @@ const CTimePicker = vue.defineComponent({
|
|
|
7010
7035
|
emit('change', _date.toTimeString(), _date.toLocaleTimeString(props.locale), _date);
|
|
7011
7036
|
emit('update:time', _date.toLocaleTimeString(props.locale));
|
|
7012
7037
|
};
|
|
7013
|
-
const InputGroup = () => vue.h('div', {
|
|
7038
|
+
const InputGroup = () => vue.h('div', {
|
|
7039
|
+
class: [
|
|
7040
|
+
'input-group',
|
|
7041
|
+
'picker-input-group',
|
|
7042
|
+
{
|
|
7043
|
+
[`input-group-${props.size}`]: props.size,
|
|
7044
|
+
},
|
|
7045
|
+
],
|
|
7046
|
+
}, [
|
|
7014
7047
|
vue.h('input', {
|
|
7015
7048
|
autocomplete: 'off',
|
|
7016
|
-
class: '
|
|
7049
|
+
class: 'form-control',
|
|
7017
7050
|
disabled: props.disabled,
|
|
7018
7051
|
onInput: (event) => {
|
|
7019
7052
|
if (isValidTime(event.target.value)) {
|
|
@@ -7031,18 +7064,28 @@ const CTimePicker = vue.defineComponent({
|
|
|
7031
7064
|
})
|
|
7032
7065
|
: '',
|
|
7033
7066
|
}),
|
|
7034
|
-
props.indicator
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7067
|
+
(props.indicator || props.cleaner) &&
|
|
7068
|
+
vue.h('div', { class: 'input-group-text' }, [
|
|
7069
|
+
props.indicator &&
|
|
7070
|
+
vue.h('span', {
|
|
7071
|
+
class: 'picker-input-group-indicator',
|
|
7072
|
+
}, slots.indicator
|
|
7073
|
+
? slots.indicator()
|
|
7074
|
+
: vue.h('span', { class: 'picker-input-group-icon time-picker-input-icon' })),
|
|
7075
|
+
props.cleaner &&
|
|
7076
|
+
vue.h('span', {
|
|
7077
|
+
class: 'picker-input-group-cleaner',
|
|
7078
|
+
onClick: (event) => handleClear(event),
|
|
7079
|
+
role: 'button',
|
|
7080
|
+
}, slots.cleaner
|
|
7081
|
+
? slots.cleaner()
|
|
7082
|
+
: vue.h('span', { class: 'picker-input-group-icon time-picker-cleaner-icon' })),
|
|
7083
|
+
]),
|
|
7041
7084
|
]);
|
|
7042
7085
|
const TimePickerSelect = () => [
|
|
7043
7086
|
vue.h('span', { class: 'time-picker-inline-icon' }),
|
|
7044
7087
|
vue.h('select', {
|
|
7045
|
-
class: '
|
|
7088
|
+
class: 'form-select',
|
|
7046
7089
|
disabled: props.disabled,
|
|
7047
7090
|
onChange: (event) => handleTimeChange('hours', event.target.value),
|
|
7048
7091
|
...(date.value && { value: getSelectedHour(date.value, props.locale) }),
|
|
@@ -7052,7 +7095,7 @@ const CTimePicker = vue.defineComponent({
|
|
|
7052
7095
|
}, option.label))),
|
|
7053
7096
|
':',
|
|
7054
7097
|
vue.h('select', {
|
|
7055
|
-
class: '
|
|
7098
|
+
class: 'form-select',
|
|
7056
7099
|
disabled: props.disabled,
|
|
7057
7100
|
onChange: (event) => handleTimeChange('minutes', event.target.value),
|
|
7058
7101
|
...(date.value && { value: getSelectedMinutes(date.value) }),
|
|
@@ -7063,7 +7106,7 @@ const CTimePicker = vue.defineComponent({
|
|
|
7063
7106
|
props.seconds && ':',
|
|
7064
7107
|
props.seconds &&
|
|
7065
7108
|
vue.h('select', {
|
|
7066
|
-
class: '
|
|
7109
|
+
class: 'form-select',
|
|
7067
7110
|
disabled: props.disabled,
|
|
7068
7111
|
onChange: (event) => handleTimeChange('seconds', event.target.value),
|
|
7069
7112
|
...(date.value && { value: getSelectedSeconds(date.value) }),
|
|
@@ -7074,7 +7117,7 @@ const CTimePicker = vue.defineComponent({
|
|
|
7074
7117
|
localizedTimePartials.value &&
|
|
7075
7118
|
localizedTimePartials.value.hour12 &&
|
|
7076
7119
|
vue.h('select', {
|
|
7077
|
-
class: '
|
|
7120
|
+
class: 'form-select',
|
|
7078
7121
|
disabled: props.disabled,
|
|
7079
7122
|
onChange: (event) => handleTimeChange('toggle', event.target.value),
|
|
7080
7123
|
value: ampm.value,
|
|
@@ -7131,7 +7174,6 @@ const CTimePicker = vue.defineComponent({
|
|
|
7131
7174
|
class: [
|
|
7132
7175
|
'time-picker',
|
|
7133
7176
|
{
|
|
7134
|
-
[`time-picker-${props.size}`]: props.size,
|
|
7135
7177
|
disabled: props.disabled,
|
|
7136
7178
|
'is-invalid': isValid.value === false ? true : false,
|
|
7137
7179
|
'is-valid': isValid.value,
|
|
@@ -7169,7 +7211,7 @@ const CTimePicker = vue.defineComponent({
|
|
|
7169
7211
|
},
|
|
7170
7212
|
],
|
|
7171
7213
|
}, props.variant === 'select' ? TimePickerSelect() : TimePickerRoll()),
|
|
7172
|
-
footer: () => vue.h('div', { class: '
|
|
7214
|
+
footer: () => vue.h('div', { class: 'picker-footer' }, [
|
|
7173
7215
|
props.cancelButton &&
|
|
7174
7216
|
vue.h(CButton, {
|
|
7175
7217
|
color: props.cancelButtonColor,
|
|
@@ -7708,14 +7750,16 @@ const CDateRangePicker = vue.defineComponent({
|
|
|
7708
7750
|
});
|
|
7709
7751
|
vue.watch(() => props.startDate, () => {
|
|
7710
7752
|
if (props.startDate) {
|
|
7711
|
-
|
|
7712
|
-
|
|
7753
|
+
const date = new Date(props.startDate);
|
|
7754
|
+
calendarDate.value = date;
|
|
7755
|
+
startDate.value = date;
|
|
7713
7756
|
}
|
|
7714
7757
|
});
|
|
7715
7758
|
vue.watch(() => props.endDate, () => {
|
|
7716
7759
|
if (props.endDate) {
|
|
7717
|
-
|
|
7718
|
-
|
|
7760
|
+
const date = new Date(props.endDate);
|
|
7761
|
+
calendarDate.value = date;
|
|
7762
|
+
endDate.value = date;
|
|
7719
7763
|
}
|
|
7720
7764
|
});
|
|
7721
7765
|
vue.watch(() => props.maxDate, () => {
|
|
@@ -7820,12 +7864,18 @@ const CDateRangePicker = vue.defineComponent({
|
|
|
7820
7864
|
emit('update:end-date', null);
|
|
7821
7865
|
};
|
|
7822
7866
|
const InputGroup = () => vue.h('div', {
|
|
7823
|
-
class:
|
|
7867
|
+
class: [
|
|
7868
|
+
'input-group',
|
|
7869
|
+
'picker-input-group',
|
|
7870
|
+
{
|
|
7871
|
+
[`input-group-${props.size}`]: props.size,
|
|
7872
|
+
},
|
|
7873
|
+
],
|
|
7824
7874
|
}, [
|
|
7825
7875
|
vue.h('input', {
|
|
7826
7876
|
autocomplete: 'off',
|
|
7827
7877
|
class: [
|
|
7828
|
-
'date-picker-input',
|
|
7878
|
+
'form-control date-picker-input',
|
|
7829
7879
|
{
|
|
7830
7880
|
hover: inputStartHoverValue.value,
|
|
7831
7881
|
},
|
|
@@ -7852,12 +7902,16 @@ const CDateRangePicker = vue.defineComponent({
|
|
|
7852
7902
|
? setInputValue(inputStartHoverValue.value)
|
|
7853
7903
|
: setInputValue(startDate.value),
|
|
7854
7904
|
}),
|
|
7855
|
-
props.range &&
|
|
7905
|
+
props.range &&
|
|
7906
|
+
props.separator !== false &&
|
|
7907
|
+
vue.h('span', { class: 'input-group-text' }, slots.separator
|
|
7908
|
+
? slots.separator()
|
|
7909
|
+
: vue.h('span', { class: 'picker-input-group-icon date-picker-arrow-icon' })),
|
|
7856
7910
|
props.range &&
|
|
7857
7911
|
vue.h('input', {
|
|
7858
7912
|
autocomplete: 'off',
|
|
7859
7913
|
class: [
|
|
7860
|
-
'date-picker-input',
|
|
7914
|
+
'form-control date-picker-input',
|
|
7861
7915
|
{
|
|
7862
7916
|
hover: inputEndHoverValue.value,
|
|
7863
7917
|
},
|
|
@@ -7882,13 +7936,23 @@ const CDateRangePicker = vue.defineComponent({
|
|
|
7882
7936
|
? setInputValue(inputEndHoverValue.value)
|
|
7883
7937
|
: setInputValue(endDate.value),
|
|
7884
7938
|
}),
|
|
7885
|
-
props.indicator
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7939
|
+
(props.indicator || props.cleaner) &&
|
|
7940
|
+
vue.h('span', { class: 'input-group-text' }, [
|
|
7941
|
+
props.indicator &&
|
|
7942
|
+
vue.h('span', {
|
|
7943
|
+
class: 'picker-input-group-indicator',
|
|
7944
|
+
}, slots.indicator
|
|
7945
|
+
? slots.indicator()
|
|
7946
|
+
: vue.h('span', { class: 'picker-input-group-icon date-picker-input-icon' })),
|
|
7947
|
+
props.cleaner &&
|
|
7948
|
+
vue.h('span', {
|
|
7949
|
+
class: 'picker-input-group-cleaner',
|
|
7950
|
+
onClick: (event) => handleClear(event),
|
|
7951
|
+
role: 'button',
|
|
7952
|
+
}, slots.cleaner
|
|
7953
|
+
? slots.cleaner()
|
|
7954
|
+
: vue.h('span', { class: 'picker-input-group-icon date-picker-cleaner-icon' })),
|
|
7955
|
+
]),
|
|
7892
7956
|
]);
|
|
7893
7957
|
return () => vue.h(CFormControlWrapper, {
|
|
7894
7958
|
describedby: attrs['aria-describedby'],
|
|
@@ -7906,7 +7970,6 @@ const CDateRangePicker = vue.defineComponent({
|
|
|
7906
7970
|
class: [
|
|
7907
7971
|
'date-picker',
|
|
7908
7972
|
{
|
|
7909
|
-
[`date-picker-${props.size}`]: props.size,
|
|
7910
7973
|
disabled: props.disabled,
|
|
7911
7974
|
'is-invalid': isValid.value === false ? true : false,
|
|
7912
7975
|
'is-valid': isValid.value,
|
|
@@ -7933,7 +7996,7 @@ const CDateRangePicker = vue.defineComponent({
|
|
|
7933
7996
|
visible: visible.value,
|
|
7934
7997
|
}, {
|
|
7935
7998
|
toggler: () => InputGroup(),
|
|
7936
|
-
footer: () => vue.h('div', { class: '
|
|
7999
|
+
footer: () => vue.h('div', { class: 'picker-footer' }, [
|
|
7937
8000
|
props.todayButton &&
|
|
7938
8001
|
vue.h(CButton, {
|
|
7939
8002
|
class: 'me-auto',
|
|
@@ -8381,6 +8444,43 @@ const CDatePickerPlugin = {
|
|
|
8381
8444
|
},
|
|
8382
8445
|
};
|
|
8383
8446
|
|
|
8447
|
+
const usePopper = () => {
|
|
8448
|
+
const _popper = vue.ref();
|
|
8449
|
+
const initPopper = (reference, popper, options) => {
|
|
8450
|
+
_popper.value = createPopper(reference, popper, options);
|
|
8451
|
+
};
|
|
8452
|
+
const destroyPopper = () => {
|
|
8453
|
+
if (_popper.value) {
|
|
8454
|
+
_popper.value.destroy();
|
|
8455
|
+
}
|
|
8456
|
+
_popper.value = undefined;
|
|
8457
|
+
};
|
|
8458
|
+
return {
|
|
8459
|
+
popper: _popper.value,
|
|
8460
|
+
initPopper,
|
|
8461
|
+
destroyPopper,
|
|
8462
|
+
};
|
|
8463
|
+
};
|
|
8464
|
+
|
|
8465
|
+
const getPlacement = (placement, direction, alignment, isRTL) => {
|
|
8466
|
+
let _placement = placement;
|
|
8467
|
+
if (direction === 'dropup') {
|
|
8468
|
+
_placement = isRTL ? 'top-end' : 'top-start';
|
|
8469
|
+
}
|
|
8470
|
+
if (direction === 'dropup-center') {
|
|
8471
|
+
_placement = 'top';
|
|
8472
|
+
}
|
|
8473
|
+
if (direction === 'dropend') {
|
|
8474
|
+
_placement = isRTL ? 'left-start' : 'right-start';
|
|
8475
|
+
}
|
|
8476
|
+
if (direction === 'dropstart') {
|
|
8477
|
+
_placement = isRTL ? 'right-start' : 'left-start';
|
|
8478
|
+
}
|
|
8479
|
+
if (alignment === 'end') {
|
|
8480
|
+
_placement = isRTL ? 'bottom-start' : 'bottom-end';
|
|
8481
|
+
}
|
|
8482
|
+
return _placement;
|
|
8483
|
+
};
|
|
8384
8484
|
const CDropdown = vue.defineComponent({
|
|
8385
8485
|
name: 'CDropdown',
|
|
8386
8486
|
props: {
|
|
@@ -8452,6 +8552,15 @@ const CDropdown = vue.defineComponent({
|
|
|
8452
8552
|
* Toggle the disabled state for the component.
|
|
8453
8553
|
*/
|
|
8454
8554
|
disabled: Boolean,
|
|
8555
|
+
/**
|
|
8556
|
+
* Offset of the dropdown menu relative to its target.
|
|
8557
|
+
*
|
|
8558
|
+
* @since 4.9.0
|
|
8559
|
+
*/
|
|
8560
|
+
offset: {
|
|
8561
|
+
type: Array,
|
|
8562
|
+
default: () => [0, 2],
|
|
8563
|
+
},
|
|
8455
8564
|
/**
|
|
8456
8565
|
* Describes the placement of your component after Popper.js has applied all the modifiers that may have flipped or altered the originally provided placement property.
|
|
8457
8566
|
*
|
|
@@ -8505,14 +8614,37 @@ const CDropdown = vue.defineComponent({
|
|
|
8505
8614
|
setup(props, { slots, emit }) {
|
|
8506
8615
|
const dropdownToggleRef = vue.ref();
|
|
8507
8616
|
const dropdownMenuRef = vue.ref();
|
|
8508
|
-
const
|
|
8509
|
-
const popper = vue.ref();
|
|
8617
|
+
const popper = vue.ref(typeof props.alignment === 'object' ? false : props.popper);
|
|
8510
8618
|
const visible = vue.ref(props.visible);
|
|
8619
|
+
const { initPopper, destroyPopper } = usePopper();
|
|
8620
|
+
const popperConfig = {
|
|
8621
|
+
modifiers: [
|
|
8622
|
+
{
|
|
8623
|
+
name: 'offset',
|
|
8624
|
+
options: {
|
|
8625
|
+
offset: props.offset,
|
|
8626
|
+
},
|
|
8627
|
+
},
|
|
8628
|
+
],
|
|
8629
|
+
placement: getPlacement(props.placement, props.direction, props.alignment, isRTL(dropdownMenuRef.value)),
|
|
8630
|
+
};
|
|
8511
8631
|
vue.watch(() => props.visible, () => {
|
|
8512
8632
|
visible.value = props.visible;
|
|
8513
8633
|
});
|
|
8634
|
+
vue.watch(visible, () => {
|
|
8635
|
+
if (visible.value && dropdownToggleRef.value && dropdownMenuRef.value) {
|
|
8636
|
+
popper.value && initPopper(dropdownToggleRef.value, dropdownMenuRef.value, popperConfig);
|
|
8637
|
+
window.addEventListener('mouseup', handleMouseUp);
|
|
8638
|
+
window.addEventListener('keyup', handleKeyup);
|
|
8639
|
+
emit('show');
|
|
8640
|
+
return;
|
|
8641
|
+
}
|
|
8642
|
+
popper.value && destroyPopper();
|
|
8643
|
+
window.removeEventListener('mouseup', handleMouseUp);
|
|
8644
|
+
window.removeEventListener('keyup', handleKeyup);
|
|
8645
|
+
emit('hide');
|
|
8646
|
+
});
|
|
8514
8647
|
vue.provide('config', {
|
|
8515
|
-
autoClose: props.autoClose,
|
|
8516
8648
|
alignment: props.alignment,
|
|
8517
8649
|
dark: props.dark,
|
|
8518
8650
|
popper: props.popper,
|
|
@@ -8521,24 +8653,31 @@ const CDropdown = vue.defineComponent({
|
|
|
8521
8653
|
vue.provide('visible', visible);
|
|
8522
8654
|
vue.provide('dropdownToggleRef', dropdownToggleRef);
|
|
8523
8655
|
vue.provide('dropdownMenuRef', dropdownMenuRef);
|
|
8524
|
-
const
|
|
8525
|
-
|
|
8526
|
-
if (typeof props.alignment === 'object') {
|
|
8656
|
+
const handleKeyup = (event) => {
|
|
8657
|
+
if (props.autoClose === false) {
|
|
8527
8658
|
return;
|
|
8528
8659
|
}
|
|
8529
|
-
if (
|
|
8530
|
-
|
|
8531
|
-
placement: placement.value,
|
|
8532
|
-
});
|
|
8660
|
+
if (event.key === 'Escape') {
|
|
8661
|
+
setVisible(false);
|
|
8533
8662
|
}
|
|
8534
8663
|
};
|
|
8535
|
-
const
|
|
8536
|
-
if (
|
|
8537
|
-
|
|
8664
|
+
const handleMouseUp = (event) => {
|
|
8665
|
+
if (!dropdownToggleRef.value || !dropdownMenuRef.value) {
|
|
8666
|
+
return;
|
|
8667
|
+
}
|
|
8668
|
+
if (dropdownToggleRef.value.contains(event.target)) {
|
|
8669
|
+
return;
|
|
8670
|
+
}
|
|
8671
|
+
if (props.autoClose === true ||
|
|
8672
|
+
(props.autoClose === 'inside' &&
|
|
8673
|
+
dropdownMenuRef.value.contains(event.target)) ||
|
|
8674
|
+
(props.autoClose === 'outside' &&
|
|
8675
|
+
!dropdownMenuRef.value.contains(event.target))) {
|
|
8676
|
+
setVisible(false);
|
|
8677
|
+
return;
|
|
8538
8678
|
}
|
|
8539
|
-
popper.value = undefined;
|
|
8540
8679
|
};
|
|
8541
|
-
const
|
|
8680
|
+
const setVisible = (_visible) => {
|
|
8542
8681
|
if (props.disabled) {
|
|
8543
8682
|
return;
|
|
8544
8683
|
}
|
|
@@ -8552,38 +8691,7 @@ const CDropdown = vue.defineComponent({
|
|
|
8552
8691
|
}
|
|
8553
8692
|
visible.value = true;
|
|
8554
8693
|
};
|
|
8555
|
-
vue.provide('
|
|
8556
|
-
const hideMenu = () => {
|
|
8557
|
-
if (props.disabled) {
|
|
8558
|
-
return;
|
|
8559
|
-
}
|
|
8560
|
-
visible.value = false;
|
|
8561
|
-
};
|
|
8562
|
-
vue.provide('hideMenu', hideMenu);
|
|
8563
|
-
vue.watch(visible, () => {
|
|
8564
|
-
props.popper && (visible.value ? initPopper() : destroyPopper());
|
|
8565
|
-
visible.value ? emit('show') : emit('hide');
|
|
8566
|
-
});
|
|
8567
|
-
vue.onMounted(() => {
|
|
8568
|
-
if (props.direction === 'center') {
|
|
8569
|
-
placement.value = 'bottom';
|
|
8570
|
-
}
|
|
8571
|
-
if (props.direction === 'dropup') {
|
|
8572
|
-
placement.value = isRTL(dropdownMenuRef.value) ? 'top-end' : 'top-start';
|
|
8573
|
-
}
|
|
8574
|
-
if (props.direction === 'dropup-center') {
|
|
8575
|
-
placement.value = 'top';
|
|
8576
|
-
}
|
|
8577
|
-
if (props.direction === 'dropend') {
|
|
8578
|
-
placement.value = isRTL(dropdownMenuRef.value) ? 'left-start' : 'right-start';
|
|
8579
|
-
}
|
|
8580
|
-
if (props.direction === 'dropstart') {
|
|
8581
|
-
placement.value = isRTL(dropdownMenuRef.value) ? 'right-start' : 'left-start';
|
|
8582
|
-
}
|
|
8583
|
-
if (props.alignment === 'end') {
|
|
8584
|
-
placement.value = isRTL(dropdownMenuRef.value) ? 'bottom-start' : 'bottom-end';
|
|
8585
|
-
}
|
|
8586
|
-
});
|
|
8694
|
+
vue.provide('setVisible', setVisible);
|
|
8587
8695
|
return () => props.variant === 'input-group'
|
|
8588
8696
|
? [slots.default && slots.default()]
|
|
8589
8697
|
: vue.h('div', {
|
|
@@ -8676,12 +8784,10 @@ const CDropdownMenu = vue.defineComponent({
|
|
|
8676
8784
|
},
|
|
8677
8785
|
},
|
|
8678
8786
|
setup(props, { slots }) {
|
|
8679
|
-
const dropdownToggleRef = vue.inject('dropdownToggleRef');
|
|
8680
8787
|
const dropdownMenuRef = vue.inject('dropdownMenuRef');
|
|
8681
8788
|
const config = vue.inject('config'); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
8682
|
-
const hideMenu = vue.inject('hideMenu');
|
|
8683
8789
|
const visible = vue.inject('visible');
|
|
8684
|
-
const {
|
|
8790
|
+
const { alignment, dark, popper } = config;
|
|
8685
8791
|
// eslint-disable-next-line @typescript-eslint/ban-types, unicorn/consistent-function-scoping
|
|
8686
8792
|
const alignmentClassNames = (alignment) => {
|
|
8687
8793
|
const classNames = [];
|
|
@@ -8695,39 +8801,6 @@ const CDropdownMenu = vue.defineComponent({
|
|
|
8695
8801
|
}
|
|
8696
8802
|
return classNames;
|
|
8697
8803
|
};
|
|
8698
|
-
const handleKeyup = (event) => {
|
|
8699
|
-
if (autoClose === false) {
|
|
8700
|
-
return;
|
|
8701
|
-
}
|
|
8702
|
-
if (event.key === 'Escape') {
|
|
8703
|
-
hideMenu();
|
|
8704
|
-
}
|
|
8705
|
-
};
|
|
8706
|
-
const handleMouseUp = (event) => {
|
|
8707
|
-
if (dropdownToggleRef.value?.contains(event.target)) {
|
|
8708
|
-
return;
|
|
8709
|
-
}
|
|
8710
|
-
if (autoClose === true) {
|
|
8711
|
-
hideMenu();
|
|
8712
|
-
return;
|
|
8713
|
-
}
|
|
8714
|
-
if (autoClose === 'inside' && dropdownMenuRef.value?.contains(event.target)) {
|
|
8715
|
-
hideMenu();
|
|
8716
|
-
return;
|
|
8717
|
-
}
|
|
8718
|
-
if (autoClose === 'outside' &&
|
|
8719
|
-
!dropdownMenuRef.value?.contains(event.target)) {
|
|
8720
|
-
hideMenu();
|
|
8721
|
-
}
|
|
8722
|
-
};
|
|
8723
|
-
vue.onUpdated(() => {
|
|
8724
|
-
visible.value && window.addEventListener('mouseup', handleMouseUp);
|
|
8725
|
-
visible.value && window.addEventListener('keyup', handleKeyup);
|
|
8726
|
-
});
|
|
8727
|
-
vue.onUnmounted(() => {
|
|
8728
|
-
window.removeEventListener('mouseup', handleMouseUp);
|
|
8729
|
-
window.removeEventListener('keyup', handleKeyup);
|
|
8730
|
-
});
|
|
8731
8804
|
return () => vue.h(props.component, {
|
|
8732
8805
|
class: [
|
|
8733
8806
|
'dropdown-menu',
|
|
@@ -8824,7 +8897,7 @@ const CDropdownToggle = vue.defineComponent({
|
|
|
8824
8897
|
const dropdownToggleRef = vue.inject('dropdownToggleRef');
|
|
8825
8898
|
const dropdownVariant = vue.inject('variant');
|
|
8826
8899
|
const visible = vue.inject('visible');
|
|
8827
|
-
const
|
|
8900
|
+
const setVisible = vue.inject('setVisible');
|
|
8828
8901
|
const className = [
|
|
8829
8902
|
{
|
|
8830
8903
|
'dropdown-toggle': props.caret,
|
|
@@ -8839,7 +8912,7 @@ const CDropdownToggle = vue.defineComponent({
|
|
|
8839
8912
|
if (props.disabled) {
|
|
8840
8913
|
return;
|
|
8841
8914
|
}
|
|
8842
|
-
|
|
8915
|
+
setVisible();
|
|
8843
8916
|
},
|
|
8844
8917
|
}),
|
|
8845
8918
|
...((props.trigger === 'focus' || props.trigger.includes('focus')) && {
|
|
@@ -8847,13 +8920,13 @@ const CDropdownToggle = vue.defineComponent({
|
|
|
8847
8920
|
if (props.disabled) {
|
|
8848
8921
|
return;
|
|
8849
8922
|
}
|
|
8850
|
-
|
|
8923
|
+
setVisible(true);
|
|
8851
8924
|
},
|
|
8852
8925
|
onblur: () => {
|
|
8853
8926
|
if (props.disabled) {
|
|
8854
8927
|
return;
|
|
8855
8928
|
}
|
|
8856
|
-
|
|
8929
|
+
setVisible(false);
|
|
8857
8930
|
},
|
|
8858
8931
|
}),
|
|
8859
8932
|
};
|
|
@@ -11223,12 +11296,7 @@ const CMultiSelectSelection = vue.defineComponent({
|
|
|
11223
11296
|
emit('remove', option);
|
|
11224
11297
|
};
|
|
11225
11298
|
return () => vue.h('div', {
|
|
11226
|
-
class:
|
|
11227
|
-
'form-multi-select-selection',
|
|
11228
|
-
{
|
|
11229
|
-
'form-multi-select-selection-tags': props.multiple && props.selectionType === 'tags',
|
|
11230
|
-
},
|
|
11231
|
-
],
|
|
11299
|
+
class: 'form-multi-select-selection',
|
|
11232
11300
|
}, [
|
|
11233
11301
|
props.multiple &&
|
|
11234
11302
|
props.selectionType === 'counter' &&
|
|
@@ -11248,10 +11316,10 @@ const CMultiSelectSelection = vue.defineComponent({
|
|
|
11248
11316
|
option.text,
|
|
11249
11317
|
!option.disabled &&
|
|
11250
11318
|
vue.h('button', {
|
|
11251
|
-
class: 'form-multi-select-tag-delete',
|
|
11319
|
+
class: 'form-multi-select-tag-delete close',
|
|
11252
11320
|
ariaLabel: 'Close',
|
|
11253
11321
|
onClick: () => handleRemove(option),
|
|
11254
|
-
}),
|
|
11322
|
+
}, vue.h('span', { ariaHidden: 'true' }, 'x')),
|
|
11255
11323
|
]);
|
|
11256
11324
|
}
|
|
11257
11325
|
return;
|
|
@@ -11271,7 +11339,7 @@ const CMultiSelect = vue.defineComponent({
|
|
|
11271
11339
|
/**
|
|
11272
11340
|
* Allow users to create options if they are not in the list of options.
|
|
11273
11341
|
*
|
|
11274
|
-
* @since 4.9.0
|
|
11342
|
+
* @since 4.9.0
|
|
11275
11343
|
*/
|
|
11276
11344
|
allowCreateOptions: Boolean,
|
|
11277
11345
|
/**
|
|
@@ -11286,7 +11354,7 @@ const CMultiSelect = vue.defineComponent({
|
|
|
11286
11354
|
/**
|
|
11287
11355
|
* Clear current search on selecting an item.
|
|
11288
11356
|
*
|
|
11289
|
-
* @since 4.9.0
|
|
11357
|
+
* @since 4.9.0
|
|
11290
11358
|
*/
|
|
11291
11359
|
clearSearchOnSelect: Boolean,
|
|
11292
11360
|
/**
|
|
@@ -11330,7 +11398,7 @@ const CMultiSelect = vue.defineComponent({
|
|
|
11330
11398
|
/**
|
|
11331
11399
|
* When set, the options list will have a loading style: loading spinner and reduced opacity.
|
|
11332
11400
|
*
|
|
11333
|
-
* @since 4.9.0
|
|
11401
|
+
* @since 4.9.0
|
|
11334
11402
|
*/
|
|
11335
11403
|
loading: Boolean,
|
|
11336
11404
|
/**
|
|
@@ -11716,13 +11784,17 @@ const CMultiSelect = vue.defineComponent({
|
|
|
11716
11784
|
}, {
|
|
11717
11785
|
default: () => vue.h('div', {
|
|
11718
11786
|
class: [
|
|
11787
|
+
'dropdown',
|
|
11788
|
+
'picker',
|
|
11719
11789
|
'form-multi-select',
|
|
11720
11790
|
{
|
|
11791
|
+
'form-multi-select-with-cleaner': props.cleaner,
|
|
11721
11792
|
disabled: props.disabled,
|
|
11722
11793
|
[`form-multi-select-${props.size}`]: props.size,
|
|
11794
|
+
'form-multi-select-selection-tags': props.multiple && props.selectionType === 'tags',
|
|
11795
|
+
show: visible.value,
|
|
11723
11796
|
'is-invalid': props.invalid,
|
|
11724
11797
|
'is-valid': props.valid,
|
|
11725
|
-
show: visible.value,
|
|
11726
11798
|
},
|
|
11727
11799
|
],
|
|
11728
11800
|
'aria-expanded': visible.value,
|
|
@@ -11746,56 +11818,51 @@ const CMultiSelect = vue.defineComponent({
|
|
|
11746
11818
|
selected: selected.value,
|
|
11747
11819
|
selectionType: props.selectionType,
|
|
11748
11820
|
selectionTypeCounterText: props.selectionTypeCounterText,
|
|
11749
|
-
}, {
|
|
11750
|
-
default: () => props.search &&
|
|
11751
|
-
vue.h('input', {
|
|
11752
|
-
type: 'text',
|
|
11753
|
-
class: 'form-multi-select-search',
|
|
11754
|
-
disabled: props.disabled,
|
|
11755
|
-
autocomplete: 'off',
|
|
11756
|
-
onInput: (event) => handleSearchChange(event),
|
|
11757
|
-
onKeydown: (event) => handleSearchKeyDown(event),
|
|
11758
|
-
...(selected.value.length === 0 && {
|
|
11759
|
-
placeholder: props.placeholder,
|
|
11760
|
-
}),
|
|
11761
|
-
...(selected.value.length > 0 &&
|
|
11762
|
-
props.selectionType === 'counter' && {
|
|
11763
|
-
placeholder: `${selected.value.length} ${props.selectionTypeCounterText}`,
|
|
11764
|
-
}),
|
|
11765
|
-
...(selected.value.length > 0 &&
|
|
11766
|
-
!props.multiple && {
|
|
11767
|
-
placeholder: selected.value.map((option) => option.text)[0],
|
|
11768
|
-
}),
|
|
11769
|
-
...(props.multiple &&
|
|
11770
|
-
selected.value.length > 0 &&
|
|
11771
|
-
props.selectionType !== 'counter' && {
|
|
11772
|
-
size: searchValue.value.length + 2,
|
|
11773
|
-
}),
|
|
11774
|
-
ref: searchRef,
|
|
11775
|
-
}),
|
|
11776
11821
|
}),
|
|
11777
|
-
|
|
11778
|
-
|
|
11779
|
-
|
|
11780
|
-
|
|
11781
|
-
|
|
11782
|
-
|
|
11822
|
+
props.multiple &&
|
|
11823
|
+
props.cleaner &&
|
|
11824
|
+
selected.value.length > 0 &&
|
|
11825
|
+
!props.disabled &&
|
|
11826
|
+
vue.h('button', {
|
|
11827
|
+
type: 'button',
|
|
11828
|
+
class: 'form-multi-select-selection-cleaner',
|
|
11829
|
+
onClick: () => handleDeselectAll(),
|
|
11830
|
+
}),
|
|
11831
|
+
props.search &&
|
|
11832
|
+
vue.h('input', {
|
|
11833
|
+
type: 'text',
|
|
11834
|
+
class: 'form-multi-select-search',
|
|
11835
|
+
disabled: props.disabled,
|
|
11836
|
+
autocomplete: 'off',
|
|
11837
|
+
onInput: (event) => handleSearchChange(event),
|
|
11838
|
+
onKeydown: (event) => handleSearchKeyDown(event),
|
|
11839
|
+
...(selected.value.length === 0 && {
|
|
11840
|
+
placeholder: props.placeholder,
|
|
11783
11841
|
}),
|
|
11784
|
-
|
|
11785
|
-
|
|
11786
|
-
|
|
11787
|
-
event.preventDefault();
|
|
11788
|
-
event.stopPropagation();
|
|
11789
|
-
visible.value = !visible.value;
|
|
11790
|
-
},
|
|
11791
|
-
type: 'button',
|
|
11842
|
+
...(selected.value.length > 0 &&
|
|
11843
|
+
props.selectionType === 'counter' && {
|
|
11844
|
+
placeholder: `${selected.value.length} ${props.selectionTypeCounterText}`,
|
|
11792
11845
|
}),
|
|
11793
|
-
|
|
11794
|
-
|
|
11846
|
+
...(selected.value.length > 0 &&
|
|
11847
|
+
!props.multiple && {
|
|
11848
|
+
placeholder: selected.value.map((option) => option.text)[0],
|
|
11849
|
+
}),
|
|
11850
|
+
...(props.multiple &&
|
|
11851
|
+
selected.value.length > 0 &&
|
|
11852
|
+
props.selectionType !== 'counter' && {
|
|
11853
|
+
size: searchValue.value.length + 2,
|
|
11854
|
+
}),
|
|
11855
|
+
ref: searchRef,
|
|
11856
|
+
}),
|
|
11795
11857
|
],
|
|
11796
11858
|
}),
|
|
11797
11859
|
vue.h('div', {
|
|
11798
|
-
class:
|
|
11860
|
+
class: [
|
|
11861
|
+
'dropdown-menu',
|
|
11862
|
+
{
|
|
11863
|
+
show: visible.value,
|
|
11864
|
+
},
|
|
11865
|
+
],
|
|
11799
11866
|
role: 'menu',
|
|
11800
11867
|
ref: dropdownRef,
|
|
11801
11868
|
}, {
|
|
@@ -12720,26 +12787,49 @@ const CProgressPlugin = {
|
|
|
12720
12787
|
},
|
|
12721
12788
|
};
|
|
12722
12789
|
|
|
12723
|
-
const getPlacement$1 = (placement, element) => {
|
|
12724
|
-
switch (placement) {
|
|
12725
|
-
case 'right': {
|
|
12726
|
-
return isRTL(element) ? 'left' : 'right';
|
|
12727
|
-
}
|
|
12728
|
-
case 'left': {
|
|
12729
|
-
return isRTL(element) ? 'right' : 'left';
|
|
12730
|
-
}
|
|
12731
|
-
default: {
|
|
12732
|
-
return placement;
|
|
12733
|
-
}
|
|
12734
|
-
}
|
|
12735
|
-
};
|
|
12736
12790
|
const CPopover = vue.defineComponent({
|
|
12737
12791
|
name: 'CPopover',
|
|
12738
12792
|
props: {
|
|
12793
|
+
/**
|
|
12794
|
+
* Apply a CSS fade transition to the popover.
|
|
12795
|
+
*
|
|
12796
|
+
* @since 4.9.0
|
|
12797
|
+
*/
|
|
12798
|
+
animation: {
|
|
12799
|
+
type: Boolean,
|
|
12800
|
+
default: true,
|
|
12801
|
+
},
|
|
12739
12802
|
/**
|
|
12740
12803
|
* Content for your component. If you want to pass non-string value please use dedicated slot `<template #content>...</template>`
|
|
12741
12804
|
*/
|
|
12742
12805
|
content: String,
|
|
12806
|
+
/**
|
|
12807
|
+
* The delay for displaying and hiding the popover (in milliseconds). When a numerical value is provided, the delay applies to both the hide and show actions. The object structure for specifying the delay is as follows: delay: `{ 'show': 500, 'hide': 100 }`.
|
|
12808
|
+
*
|
|
12809
|
+
* @since 4.9.0
|
|
12810
|
+
*/
|
|
12811
|
+
delay: {
|
|
12812
|
+
type: [Number, Object],
|
|
12813
|
+
default: 0,
|
|
12814
|
+
},
|
|
12815
|
+
/**
|
|
12816
|
+
* Specify the desired order of fallback placements by providing a list of placements as an array. The placements should be prioritized based on preference.
|
|
12817
|
+
*
|
|
12818
|
+
* @since 4.9.0
|
|
12819
|
+
*/
|
|
12820
|
+
fallbackPlacements: {
|
|
12821
|
+
type: [String, Array],
|
|
12822
|
+
default: () => ['top', 'right', 'bottom', 'left'],
|
|
12823
|
+
validator: (value) => {
|
|
12824
|
+
if (typeof value === 'string') {
|
|
12825
|
+
return ['top', 'right', 'bottom', 'left'].includes(value);
|
|
12826
|
+
}
|
|
12827
|
+
if (Array.isArray(value)) {
|
|
12828
|
+
return value.every((e) => ['top', 'right', 'bottom', 'left'].includes(e));
|
|
12829
|
+
}
|
|
12830
|
+
return false;
|
|
12831
|
+
},
|
|
12832
|
+
},
|
|
12743
12833
|
/**
|
|
12744
12834
|
* Offset of the popover relative to its target.
|
|
12745
12835
|
*/
|
|
@@ -12797,11 +12887,35 @@ const CPopover = vue.defineComponent({
|
|
|
12797
12887
|
setup(props, { attrs, slots, emit }) {
|
|
12798
12888
|
const togglerRef = vue.ref();
|
|
12799
12889
|
const popoverRef = vue.ref();
|
|
12800
|
-
const popper = vue.ref();
|
|
12801
12890
|
const visible = vue.ref(props.visible);
|
|
12891
|
+
const { initPopper, destroyPopper } = usePopper();
|
|
12892
|
+
const delay = typeof props.delay === 'number' ? { show: props.delay, hide: props.delay } : props.delay;
|
|
12893
|
+
const popperConfig = {
|
|
12894
|
+
modifiers: [
|
|
12895
|
+
{
|
|
12896
|
+
name: 'arrow',
|
|
12897
|
+
options: {
|
|
12898
|
+
element: '.popover-arrow',
|
|
12899
|
+
},
|
|
12900
|
+
},
|
|
12901
|
+
{
|
|
12902
|
+
name: 'flip',
|
|
12903
|
+
options: {
|
|
12904
|
+
fallbackPlacements: props.fallbackPlacements,
|
|
12905
|
+
},
|
|
12906
|
+
},
|
|
12907
|
+
{
|
|
12908
|
+
name: 'offset',
|
|
12909
|
+
options: {
|
|
12910
|
+
offset: props.offset,
|
|
12911
|
+
},
|
|
12912
|
+
},
|
|
12913
|
+
],
|
|
12914
|
+
placement: getRTLPlacement(props.placement, togglerRef.value),
|
|
12915
|
+
};
|
|
12802
12916
|
const handleEnter = (el, done) => {
|
|
12803
12917
|
emit('show');
|
|
12804
|
-
initPopper();
|
|
12918
|
+
initPopper(togglerRef.value, popoverRef.value, popperConfig);
|
|
12805
12919
|
el.classList.add('show');
|
|
12806
12920
|
executeAfterTransition(() => done(), el);
|
|
12807
12921
|
};
|
|
@@ -12813,30 +12927,17 @@ const CPopover = vue.defineComponent({
|
|
|
12813
12927
|
destroyPopper();
|
|
12814
12928
|
}, el);
|
|
12815
12929
|
};
|
|
12816
|
-
const
|
|
12930
|
+
const toggleVisible = (event, _visible) => {
|
|
12817
12931
|
togglerRef.value = event.target;
|
|
12818
|
-
|
|
12819
|
-
|
|
12820
|
-
|
|
12821
|
-
|
|
12822
|
-
|
|
12823
|
-
placement: getPlacement$1(props.placement, togglerRef.value),
|
|
12824
|
-
modifiers: [
|
|
12825
|
-
{
|
|
12826
|
-
name: 'offset',
|
|
12827
|
-
options: {
|
|
12828
|
-
offset: props.offset,
|
|
12829
|
-
},
|
|
12830
|
-
},
|
|
12831
|
-
],
|
|
12832
|
-
});
|
|
12833
|
-
}
|
|
12834
|
-
};
|
|
12835
|
-
const destroyPopper = () => {
|
|
12836
|
-
if (popper.value) {
|
|
12837
|
-
popper.value.destroy();
|
|
12932
|
+
if (_visible) {
|
|
12933
|
+
setTimeout(() => {
|
|
12934
|
+
visible.value = true;
|
|
12935
|
+
}, delay.show);
|
|
12936
|
+
return;
|
|
12838
12937
|
}
|
|
12839
|
-
|
|
12938
|
+
setTimeout(() => {
|
|
12939
|
+
visible.value = false;
|
|
12940
|
+
}, delay.hide);
|
|
12840
12941
|
};
|
|
12841
12942
|
return () => [
|
|
12842
12943
|
vue.h(vue.Teleport, {
|
|
@@ -12846,12 +12947,18 @@ const CPopover = vue.defineComponent({
|
|
|
12846
12947
|
onLeave: (el, done) => handleLeave(el, done),
|
|
12847
12948
|
}, () => visible.value &&
|
|
12848
12949
|
vue.h('div', {
|
|
12849
|
-
class:
|
|
12950
|
+
class: [
|
|
12951
|
+
'popover',
|
|
12952
|
+
'bs-popover-auto',
|
|
12953
|
+
{
|
|
12954
|
+
fade: props.animation,
|
|
12955
|
+
},
|
|
12956
|
+
],
|
|
12850
12957
|
ref: popoverRef,
|
|
12851
12958
|
role: 'tooltip',
|
|
12852
12959
|
...attrs,
|
|
12853
12960
|
}, [
|
|
12854
|
-
vue.h('div', { class: 'popover-arrow'
|
|
12961
|
+
vue.h('div', { class: 'popover-arrow' }),
|
|
12855
12962
|
(props.title || slots.title) &&
|
|
12856
12963
|
vue.h('div', { class: 'popover-header' }, {
|
|
12857
12964
|
default: () => (slots.title && slots.title()) || props.title,
|
|
@@ -12864,11 +12971,11 @@ const CPopover = vue.defineComponent({
|
|
|
12864
12971
|
slots.toggler &&
|
|
12865
12972
|
slots.toggler({
|
|
12866
12973
|
on: {
|
|
12867
|
-
click: (event) => props.trigger.includes('click') &&
|
|
12868
|
-
blur: (event) => props.trigger.includes('focus') &&
|
|
12869
|
-
focus: (event) => props.trigger.includes('focus') &&
|
|
12870
|
-
mouseenter: (event) => props.trigger.includes('hover') &&
|
|
12871
|
-
mouseleave: (event) => props.trigger.includes('hover') &&
|
|
12974
|
+
click: (event) => props.trigger.includes('click') && toggleVisible(event, !visible.value),
|
|
12975
|
+
blur: (event) => props.trigger.includes('focus') && toggleVisible(event, false),
|
|
12976
|
+
focus: (event) => props.trigger.includes('focus') && toggleVisible(event, true),
|
|
12977
|
+
mouseenter: (event) => props.trigger.includes('hover') && toggleVisible(event, true),
|
|
12978
|
+
mouseleave: (event) => props.trigger.includes('hover') && toggleVisible(event, false),
|
|
12872
12979
|
},
|
|
12873
12980
|
}),
|
|
12874
12981
|
];
|
|
@@ -15428,26 +15535,49 @@ const CToastPlugin = {
|
|
|
15428
15535
|
},
|
|
15429
15536
|
};
|
|
15430
15537
|
|
|
15431
|
-
const getPlacement = (placement, element) => {
|
|
15432
|
-
switch (placement) {
|
|
15433
|
-
case 'right': {
|
|
15434
|
-
return isRTL(element) ? 'left' : 'right';
|
|
15435
|
-
}
|
|
15436
|
-
case 'left': {
|
|
15437
|
-
return isRTL(element) ? 'right' : 'left';
|
|
15438
|
-
}
|
|
15439
|
-
default: {
|
|
15440
|
-
return placement;
|
|
15441
|
-
}
|
|
15442
|
-
}
|
|
15443
|
-
};
|
|
15444
15538
|
const CTooltip = vue.defineComponent({
|
|
15445
15539
|
name: 'CTooltip',
|
|
15446
15540
|
props: {
|
|
15541
|
+
/**
|
|
15542
|
+
* Apply a CSS fade transition to the tooltip.
|
|
15543
|
+
*
|
|
15544
|
+
* @since 4.9.0
|
|
15545
|
+
*/
|
|
15546
|
+
animation: {
|
|
15547
|
+
type: Boolean,
|
|
15548
|
+
default: true,
|
|
15549
|
+
},
|
|
15447
15550
|
/**
|
|
15448
15551
|
* Content for your component. If you want to pass non-string value please use dedicated slot `<template #content>...</template>`
|
|
15449
15552
|
*/
|
|
15450
15553
|
content: String,
|
|
15554
|
+
/**
|
|
15555
|
+
* The delay for displaying and hiding the popover (in milliseconds). When a numerical value is provided, the delay applies to both the hide and show actions. The object structure for specifying the delay is as follows: delay: `{ 'show': 500, 'hide': 100 }`.
|
|
15556
|
+
*
|
|
15557
|
+
* @since 4.9.0
|
|
15558
|
+
*/
|
|
15559
|
+
delay: {
|
|
15560
|
+
type: [Number, Object],
|
|
15561
|
+
default: 0,
|
|
15562
|
+
},
|
|
15563
|
+
/**
|
|
15564
|
+
* Specify the desired order of fallback placements by providing a list of placements as an array. The placements should be prioritized based on preference.
|
|
15565
|
+
*
|
|
15566
|
+
* @since 4.9.0
|
|
15567
|
+
*/
|
|
15568
|
+
fallbackPlacements: {
|
|
15569
|
+
type: [String, Array],
|
|
15570
|
+
default: () => ['top', 'right', 'bottom', 'left'],
|
|
15571
|
+
validator: (value) => {
|
|
15572
|
+
if (typeof value === 'string') {
|
|
15573
|
+
return ['top', 'right', 'bottom', 'left'].includes(value);
|
|
15574
|
+
}
|
|
15575
|
+
if (Array.isArray(value)) {
|
|
15576
|
+
return value.every((e) => ['top', 'right', 'bottom', 'left'].includes(e));
|
|
15577
|
+
}
|
|
15578
|
+
return false;
|
|
15579
|
+
},
|
|
15580
|
+
},
|
|
15451
15581
|
/**
|
|
15452
15582
|
* Offset of the tooltip relative to its target.
|
|
15453
15583
|
*/
|
|
@@ -15472,7 +15602,7 @@ const CTooltip = vue.defineComponent({
|
|
|
15472
15602
|
*/
|
|
15473
15603
|
trigger: {
|
|
15474
15604
|
type: [String, Array],
|
|
15475
|
-
default: 'hover',
|
|
15605
|
+
default: () => ['hover', 'focus'],
|
|
15476
15606
|
validator: (value) => {
|
|
15477
15607
|
if (typeof value === 'string') {
|
|
15478
15608
|
return ['click', 'focus', 'hover'].includes(value);
|
|
@@ -15501,11 +15631,35 @@ const CTooltip = vue.defineComponent({
|
|
|
15501
15631
|
setup(props, { attrs, slots, emit }) {
|
|
15502
15632
|
const togglerRef = vue.ref();
|
|
15503
15633
|
const tooltipRef = vue.ref();
|
|
15504
|
-
const popper = vue.ref();
|
|
15505
15634
|
const visible = vue.ref(props.visible);
|
|
15635
|
+
const { initPopper, destroyPopper } = usePopper();
|
|
15636
|
+
const delay = typeof props.delay === 'number' ? { show: props.delay, hide: props.delay } : props.delay;
|
|
15637
|
+
const popperConfig = {
|
|
15638
|
+
modifiers: [
|
|
15639
|
+
{
|
|
15640
|
+
name: 'arrow',
|
|
15641
|
+
options: {
|
|
15642
|
+
element: '.tooltip-arrow',
|
|
15643
|
+
},
|
|
15644
|
+
},
|
|
15645
|
+
{
|
|
15646
|
+
name: 'flip',
|
|
15647
|
+
options: {
|
|
15648
|
+
fallbackPlacements: props.fallbackPlacements,
|
|
15649
|
+
},
|
|
15650
|
+
},
|
|
15651
|
+
{
|
|
15652
|
+
name: 'offset',
|
|
15653
|
+
options: {
|
|
15654
|
+
offset: props.offset,
|
|
15655
|
+
},
|
|
15656
|
+
},
|
|
15657
|
+
],
|
|
15658
|
+
placement: getRTLPlacement(props.placement, togglerRef.value),
|
|
15659
|
+
};
|
|
15506
15660
|
const handleEnter = (el, done) => {
|
|
15507
15661
|
emit('show');
|
|
15508
|
-
initPopper();
|
|
15662
|
+
initPopper(togglerRef.value, tooltipRef.value, popperConfig);
|
|
15509
15663
|
el.classList.add('show');
|
|
15510
15664
|
executeAfterTransition(() => done(), el);
|
|
15511
15665
|
};
|
|
@@ -15517,30 +15671,17 @@ const CTooltip = vue.defineComponent({
|
|
|
15517
15671
|
destroyPopper();
|
|
15518
15672
|
}, el);
|
|
15519
15673
|
};
|
|
15520
|
-
const
|
|
15674
|
+
const toggleVisible = (event, _visible) => {
|
|
15521
15675
|
togglerRef.value = event.target;
|
|
15522
|
-
|
|
15523
|
-
|
|
15524
|
-
|
|
15525
|
-
|
|
15526
|
-
|
|
15527
|
-
placement: getPlacement(props.placement, togglerRef.value),
|
|
15528
|
-
modifiers: [
|
|
15529
|
-
{
|
|
15530
|
-
name: 'offset',
|
|
15531
|
-
options: {
|
|
15532
|
-
offset: props.offset,
|
|
15533
|
-
},
|
|
15534
|
-
},
|
|
15535
|
-
],
|
|
15536
|
-
});
|
|
15537
|
-
}
|
|
15538
|
-
};
|
|
15539
|
-
const destroyPopper = () => {
|
|
15540
|
-
if (popper.value) {
|
|
15541
|
-
popper.value.destroy();
|
|
15676
|
+
if (_visible) {
|
|
15677
|
+
setTimeout(() => {
|
|
15678
|
+
visible.value = true;
|
|
15679
|
+
}, delay.show);
|
|
15680
|
+
return;
|
|
15542
15681
|
}
|
|
15543
|
-
|
|
15682
|
+
setTimeout(() => {
|
|
15683
|
+
visible.value = false;
|
|
15684
|
+
}, delay.hide);
|
|
15544
15685
|
};
|
|
15545
15686
|
return () => [
|
|
15546
15687
|
vue.h(vue.Teleport, {
|
|
@@ -15550,12 +15691,18 @@ const CTooltip = vue.defineComponent({
|
|
|
15550
15691
|
onLeave: (el, done) => handleLeave(el, done),
|
|
15551
15692
|
}, () => visible.value &&
|
|
15552
15693
|
vue.h('div', {
|
|
15553
|
-
class:
|
|
15694
|
+
class: [
|
|
15695
|
+
'tooltip',
|
|
15696
|
+
'bs-tooltip-auto',
|
|
15697
|
+
{
|
|
15698
|
+
fade: props.animation,
|
|
15699
|
+
},
|
|
15700
|
+
],
|
|
15554
15701
|
ref: tooltipRef,
|
|
15555
15702
|
role: 'tooltip',
|
|
15556
15703
|
...attrs,
|
|
15557
15704
|
}, [
|
|
15558
|
-
vue.h('div', { class: 'tooltip-arrow'
|
|
15705
|
+
vue.h('div', { class: 'tooltip-arrow' }),
|
|
15559
15706
|
(props.content || slots.content) &&
|
|
15560
15707
|
vue.h('div', { class: 'tooltip-inner' }, {
|
|
15561
15708
|
default: () => (slots.content && slots.content()) || props.content,
|
|
@@ -15564,11 +15711,11 @@ const CTooltip = vue.defineComponent({
|
|
|
15564
15711
|
slots.toggler &&
|
|
15565
15712
|
slots.toggler({
|
|
15566
15713
|
on: {
|
|
15567
|
-
click: (event) => props.trigger.includes('click') &&
|
|
15568
|
-
blur: (event) => props.trigger.includes('focus') &&
|
|
15569
|
-
focus: (event) => props.trigger.includes('focus') &&
|
|
15570
|
-
mouseenter: (event) => props.trigger.includes('hover') &&
|
|
15571
|
-
mouseleave: (event) => props.trigger.includes('hover') &&
|
|
15714
|
+
click: (event) => props.trigger.includes('click') && toggleVisible(event, !visible.value),
|
|
15715
|
+
blur: (event) => props.trigger.includes('focus') && toggleVisible(event, false),
|
|
15716
|
+
focus: (event) => props.trigger.includes('focus') && toggleVisible(event, true),
|
|
15717
|
+
mouseenter: (event) => props.trigger.includes('hover') && toggleVisible(event, true),
|
|
15718
|
+
mouseleave: (event) => props.trigger.includes('hover') && toggleVisible(event, false),
|
|
15572
15719
|
},
|
|
15573
15720
|
}),
|
|
15574
15721
|
];
|
|
@@ -16413,54 +16560,6 @@ var Directives = /*#__PURE__*/Object.freeze({
|
|
|
16413
16560
|
vctooltip: vCTooltip
|
|
16414
16561
|
});
|
|
16415
16562
|
|
|
16416
|
-
const getStoredTheme = (localStorageItemName) => typeof window !== 'undefined' && localStorage.getItem(localStorageItemName);
|
|
16417
|
-
const setStoredTheme = (localStorageItemName, colorMode) => localStorage.setItem(localStorageItemName, colorMode);
|
|
16418
|
-
const getPreferredColorScheme = (localStorageItemName) => {
|
|
16419
|
-
if (typeof window === 'undefined') {
|
|
16420
|
-
return;
|
|
16421
|
-
}
|
|
16422
|
-
const storedTheme = getStoredTheme(localStorageItemName);
|
|
16423
|
-
if (storedTheme) {
|
|
16424
|
-
return storedTheme;
|
|
16425
|
-
}
|
|
16426
|
-
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
16427
|
-
};
|
|
16428
|
-
const setTheme = (colorMode) => {
|
|
16429
|
-
document.documentElement.dataset.coreuiTheme =
|
|
16430
|
-
colorMode === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
16431
|
-
? 'dark'
|
|
16432
|
-
: colorMode;
|
|
16433
|
-
const event = new Event('ColorSchemeChange');
|
|
16434
|
-
document.documentElement.dispatchEvent(event);
|
|
16435
|
-
};
|
|
16436
|
-
const useColorModes = (localStorageItemName = 'coreui-vue-color-scheme') => {
|
|
16437
|
-
const colorMode = vue.ref(getPreferredColorScheme(localStorageItemName));
|
|
16438
|
-
vue.watch(colorMode, () => {
|
|
16439
|
-
if (colorMode.value) {
|
|
16440
|
-
setStoredTheme(localStorageItemName, colorMode.value);
|
|
16441
|
-
setTheme(colorMode.value);
|
|
16442
|
-
}
|
|
16443
|
-
});
|
|
16444
|
-
vue.onBeforeMount(() => {
|
|
16445
|
-
if (typeof getStoredTheme(localStorageItemName) === 'string' && colorMode.value) {
|
|
16446
|
-
setTheme(colorMode.value);
|
|
16447
|
-
}
|
|
16448
|
-
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
|
|
16449
|
-
const storedTheme = getStoredTheme(localStorageItemName);
|
|
16450
|
-
if (storedTheme !== 'light' && storedTheme !== 'dark' && colorMode.value) {
|
|
16451
|
-
setTheme(colorMode.value);
|
|
16452
|
-
}
|
|
16453
|
-
});
|
|
16454
|
-
});
|
|
16455
|
-
return {
|
|
16456
|
-
getColorMode: () => colorMode.value,
|
|
16457
|
-
isColorModeSet: () => Boolean(getStoredTheme(localStorageItemName)),
|
|
16458
|
-
setColorMode: (mode) => {
|
|
16459
|
-
colorMode.value = mode;
|
|
16460
|
-
},
|
|
16461
|
-
};
|
|
16462
|
-
};
|
|
16463
|
-
|
|
16464
16563
|
const CoreuiVue = {
|
|
16465
16564
|
install: (app) => {
|
|
16466
16565
|
for (const key in Components) {
|
|
@@ -16652,7 +16751,7 @@ exports.CWidgetStatsE = CWidgetStatsE;
|
|
|
16652
16751
|
exports.CWidgetStatsF = CWidgetStatsF;
|
|
16653
16752
|
exports.CWidgetsStatsPlugin = CWidgetsStatsPlugin;
|
|
16654
16753
|
exports.default = CoreuiVue;
|
|
16655
|
-
exports.
|
|
16754
|
+
exports.usePopper = usePopper;
|
|
16656
16755
|
exports.vcplaceholder = vCPlaceholder;
|
|
16657
16756
|
exports.vcpopover = vCPopover;
|
|
16658
16757
|
exports.vctooltip = vCTooltip;
|