@coreui/vue-pro 4.8.0-next.0 → 4.8.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.d.ts +1 -0
- package/dist/components/multi-select/CMultiSelect.d.ts +35 -44
- package/dist/components/multi-select/CMultiSelectNativeSelect.d.ts +1 -1
- package/dist/components/multi-select/CMultiSelectOptions.d.ts +13 -11
- package/dist/components/multi-select/CMultiSelectSelection.d.ts +1 -1
- package/dist/components/multi-select/types.d.ts +14 -0
- package/dist/components/multi-select/utils.d.ts +6 -0
- package/dist/components/virtual-scroller/CVirtualScroller.d.ts +23 -0
- package/dist/components/virtual-scroller/index.d.ts +6 -0
- package/dist/index.es.js +203 -104
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +203 -102
- package/dist/index.js.map +1 -1
- package/dist/utils/index.d.ts +1 -3
- package/package.json +1 -1
- package/src/components/index.ts +1 -0
- package/src/components/multi-select/CMultiSelect.ts +33 -89
- package/src/components/multi-select/CMultiSelectNativeSelect.ts +2 -1
- package/src/components/multi-select/CMultiSelectOptions.ts +31 -17
- package/src/components/multi-select/CMultiSelectSelection.ts +2 -1
- package/src/components/multi-select/types.ts +15 -0
- package/src/components/multi-select/utils.ts +92 -0
- package/src/components/virtual-scroller/CVirtualScroller.ts +109 -0
- package/src/components/virtual-scroller/index.ts +10 -0
- package/src/utils/index.ts +1 -3
- package/src/utils/getNextSibling.ts +0 -18
- package/src/utils/getPreviousSibling.ts +0 -18
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, provide, h as h$1, Transition, withDirectives, inject, watch, reactive, onBeforeMount, onMounted, onUpdated, toRefs, onUnmounted, cloneVNode, nextTick, vShow, Teleport, onBeforeUnmount
|
|
1
|
+
import { defineComponent, ref, provide, h as h$1, Transition, withDirectives, inject, watch, reactive, onBeforeMount, onMounted, onUpdated, toRefs, onUnmounted, cloneVNode, nextTick, vShow, computed, Teleport, onBeforeUnmount } from 'vue';
|
|
2
2
|
|
|
3
3
|
const CAccordion = defineComponent({
|
|
4
4
|
name: 'CAccordion',
|
|
@@ -1905,38 +1905,6 @@ const CCardPlugin = {
|
|
|
1905
1905
|
},
|
|
1906
1906
|
};
|
|
1907
1907
|
|
|
1908
|
-
const getNextSibling = (elem, selector) => {
|
|
1909
|
-
// Get the next sibling element
|
|
1910
|
-
let sibling = elem.nextElementSibling;
|
|
1911
|
-
// If there's no selector, return the first sibling
|
|
1912
|
-
if (!selector)
|
|
1913
|
-
return sibling;
|
|
1914
|
-
// If the sibling matches our selector, use it
|
|
1915
|
-
// If not, jump to the next sibling and continue the loop
|
|
1916
|
-
while (sibling) {
|
|
1917
|
-
if (sibling.matches(selector))
|
|
1918
|
-
return sibling;
|
|
1919
|
-
sibling = sibling.nextElementSibling;
|
|
1920
|
-
}
|
|
1921
|
-
return;
|
|
1922
|
-
};
|
|
1923
|
-
|
|
1924
|
-
const getPreviousSibling = (elem, selector) => {
|
|
1925
|
-
// Get the next sibling element
|
|
1926
|
-
let sibling = elem.previousElementSibling;
|
|
1927
|
-
// If there's no selector, return the first sibling
|
|
1928
|
-
if (!selector)
|
|
1929
|
-
return sibling;
|
|
1930
|
-
// If the sibling matches our selector, use it
|
|
1931
|
-
// If not, jump to the next sibling and continue the loop
|
|
1932
|
-
while (sibling) {
|
|
1933
|
-
if (sibling.matches(selector))
|
|
1934
|
-
return sibling;
|
|
1935
|
-
sibling = sibling.previousElementSibling;
|
|
1936
|
-
}
|
|
1937
|
-
return;
|
|
1938
|
-
};
|
|
1939
|
-
|
|
1940
1908
|
const isInViewport = (element) => {
|
|
1941
1909
|
const rect = element.getBoundingClientRect();
|
|
1942
1910
|
return (Math.floor(rect.top) >= 0 &&
|
|
@@ -11530,6 +11498,159 @@ const CMultiSelectNativeSelect = defineComponent({
|
|
|
11530
11498
|
},
|
|
11531
11499
|
});
|
|
11532
11500
|
|
|
11501
|
+
const CVirtualScroller = defineComponent({
|
|
11502
|
+
name: 'CVirtualScroller',
|
|
11503
|
+
props: {
|
|
11504
|
+
/**
|
|
11505
|
+
* Amount of visible items
|
|
11506
|
+
*/
|
|
11507
|
+
visibleItems: {
|
|
11508
|
+
type: Number,
|
|
11509
|
+
default: 10,
|
|
11510
|
+
},
|
|
11511
|
+
},
|
|
11512
|
+
setup(props, { slots }) {
|
|
11513
|
+
const virtualScrollRef = ref();
|
|
11514
|
+
const virtualScrollContentRef = ref();
|
|
11515
|
+
const currentItemIndex = ref(1);
|
|
11516
|
+
const itemHeight = ref(0);
|
|
11517
|
+
const itemsNumber = ref(0);
|
|
11518
|
+
const viewportPadding = ref(0);
|
|
11519
|
+
const buffer = computed(() => Math.floor(props.visibleItems / 2));
|
|
11520
|
+
const maxHeight = computed(() => itemsNumber.value * itemHeight.value + 2 * viewportPadding.value);
|
|
11521
|
+
const viewportHeight = computed(() => props.visibleItems * itemHeight.value + 2 * viewportPadding.value);
|
|
11522
|
+
onMounted(() => {
|
|
11523
|
+
if (virtualScrollRef.value) {
|
|
11524
|
+
viewportPadding.value = parseFloat(getComputedStyle(virtualScrollRef.value).paddingTop);
|
|
11525
|
+
// It's necessary to calculate heights of items
|
|
11526
|
+
virtualScrollRef.value.dispatchEvent(new CustomEvent('scroll'));
|
|
11527
|
+
}
|
|
11528
|
+
});
|
|
11529
|
+
const handleScroll = (scrollTop) => {
|
|
11530
|
+
currentItemIndex.value =
|
|
11531
|
+
itemHeight.value && Math.max(Math.ceil(scrollTop / itemHeight.value), 1);
|
|
11532
|
+
};
|
|
11533
|
+
return () => {
|
|
11534
|
+
const children = slots.default
|
|
11535
|
+
? Array.isArray(slots.default()[0].children)
|
|
11536
|
+
? slots.default()[0].children
|
|
11537
|
+
: slots.default()
|
|
11538
|
+
: [];
|
|
11539
|
+
itemsNumber.value = children && children.length ? children.length : 0;
|
|
11540
|
+
return h$1('div', {
|
|
11541
|
+
class: ['virtual-scroller'],
|
|
11542
|
+
onScroll: (event) => handleScroll(event.target.scrollTop),
|
|
11543
|
+
style: {
|
|
11544
|
+
height: `${maxHeight.value > viewportHeight.value ? viewportHeight.value : maxHeight.value}px`,
|
|
11545
|
+
overflowY: 'auto',
|
|
11546
|
+
},
|
|
11547
|
+
ref: virtualScrollRef,
|
|
11548
|
+
}, h$1('div', {
|
|
11549
|
+
class: 'virtual-scroller-content',
|
|
11550
|
+
style: {
|
|
11551
|
+
height: `${maxHeight.value}px`,
|
|
11552
|
+
},
|
|
11553
|
+
ref: virtualScrollContentRef,
|
|
11554
|
+
}, children.map((slot, index) => index + 1 > Math.max(currentItemIndex.value - buffer.value, 0) &&
|
|
11555
|
+
index + 1 <= currentItemIndex.value + props.visibleItems + buffer.value &&
|
|
11556
|
+
cloneVNode(slot, {
|
|
11557
|
+
class: [
|
|
11558
|
+
{
|
|
11559
|
+
'virtual-scroller-item-preload': index + 1 > currentItemIndex.value + props.visibleItems ||
|
|
11560
|
+
index + 1 < currentItemIndex.value,
|
|
11561
|
+
},
|
|
11562
|
+
],
|
|
11563
|
+
style: {
|
|
11564
|
+
...(currentItemIndex.value > buffer.value && {
|
|
11565
|
+
transform: `translateY(${(currentItemIndex.value - buffer.value) * itemHeight.value}px)`,
|
|
11566
|
+
}),
|
|
11567
|
+
},
|
|
11568
|
+
ref: (node) => {
|
|
11569
|
+
if (node && node.offsetHeight) {
|
|
11570
|
+
itemHeight.value =
|
|
11571
|
+
node.offsetHeight +
|
|
11572
|
+
parseFloat(getComputedStyle(node).marginTop) +
|
|
11573
|
+
parseFloat(getComputedStyle(node).marginBottom);
|
|
11574
|
+
}
|
|
11575
|
+
},
|
|
11576
|
+
}))));
|
|
11577
|
+
};
|
|
11578
|
+
},
|
|
11579
|
+
});
|
|
11580
|
+
|
|
11581
|
+
const CVirtualScrollerPlugin = {
|
|
11582
|
+
install: (app) => {
|
|
11583
|
+
app.component(CVirtualScroller.name, CVirtualScroller);
|
|
11584
|
+
},
|
|
11585
|
+
};
|
|
11586
|
+
|
|
11587
|
+
const filterOptionsList = (search, _options) => {
|
|
11588
|
+
return search.length
|
|
11589
|
+
? _options &&
|
|
11590
|
+
_options.reduce((acc, val) => {
|
|
11591
|
+
const options = val.options &&
|
|
11592
|
+
val.options.filter((element) => element.text && element.text.toLowerCase().includes(search.toLowerCase()));
|
|
11593
|
+
if ((val.text && val.text.toLowerCase().includes(search.toLowerCase())) ||
|
|
11594
|
+
(options && options.length)) {
|
|
11595
|
+
acc.push(Object.assign({}, val, options && options.length && { options }));
|
|
11596
|
+
}
|
|
11597
|
+
return acc;
|
|
11598
|
+
}, [])
|
|
11599
|
+
: _options;
|
|
11600
|
+
};
|
|
11601
|
+
const flattenArray = (options) => {
|
|
11602
|
+
return options.reduce((acc, val) => {
|
|
11603
|
+
return acc.concat(Array.isArray(val.options) ? flattenArray(val.options) : val);
|
|
11604
|
+
}, []);
|
|
11605
|
+
};
|
|
11606
|
+
const getNextSibling = (elem, selector) => {
|
|
11607
|
+
// Get the next sibling element
|
|
11608
|
+
let sibling = elem.nextElementSibling;
|
|
11609
|
+
// If there's no selector, return the first sibling
|
|
11610
|
+
if (!selector)
|
|
11611
|
+
return sibling;
|
|
11612
|
+
// If the sibling matches our selector, use it
|
|
11613
|
+
// If not, jump to the next sibling and continue the loop
|
|
11614
|
+
while (sibling) {
|
|
11615
|
+
if (sibling.matches(selector))
|
|
11616
|
+
return sibling;
|
|
11617
|
+
sibling = sibling.nextElementSibling;
|
|
11618
|
+
}
|
|
11619
|
+
return;
|
|
11620
|
+
};
|
|
11621
|
+
const getPreviousSibling = (elem, selector) => {
|
|
11622
|
+
// Get the next sibling element
|
|
11623
|
+
let sibling = elem.previousElementSibling;
|
|
11624
|
+
// If there's no selector, return the first sibling
|
|
11625
|
+
if (!selector)
|
|
11626
|
+
return sibling;
|
|
11627
|
+
// If the sibling matches our selector, use it
|
|
11628
|
+
// If not, jump to the next sibling and continue the loop
|
|
11629
|
+
while (sibling) {
|
|
11630
|
+
if (sibling.matches(selector))
|
|
11631
|
+
return sibling;
|
|
11632
|
+
sibling = sibling.previousElementSibling;
|
|
11633
|
+
}
|
|
11634
|
+
return;
|
|
11635
|
+
};
|
|
11636
|
+
const selectOptions = (options, selected, deselected) => {
|
|
11637
|
+
let _selected = [...selected, ...options];
|
|
11638
|
+
if (deselected) {
|
|
11639
|
+
_selected = _selected.filter((selectedOption) => !deselected.some((deselectedOption) => deselectedOption.value === selectedOption.value));
|
|
11640
|
+
}
|
|
11641
|
+
const deduplicated = _selected.reduce((unique, option) => {
|
|
11642
|
+
if (!unique.some((obj) => obj.value === option.value)) {
|
|
11643
|
+
unique.push({
|
|
11644
|
+
value: option.value,
|
|
11645
|
+
text: option.text,
|
|
11646
|
+
...(option.disabled && { disabled: option.disabled }),
|
|
11647
|
+
});
|
|
11648
|
+
}
|
|
11649
|
+
return unique;
|
|
11650
|
+
}, []);
|
|
11651
|
+
return deduplicated;
|
|
11652
|
+
};
|
|
11653
|
+
|
|
11533
11654
|
const CMultiSelectOptions = defineComponent({
|
|
11534
11655
|
name: 'CMultiSelectOptions',
|
|
11535
11656
|
props: {
|
|
@@ -11539,7 +11660,6 @@ const CMultiSelectOptions = defineComponent({
|
|
|
11539
11660
|
options: {
|
|
11540
11661
|
type: Array,
|
|
11541
11662
|
default: () => [],
|
|
11542
|
-
required: false,
|
|
11543
11663
|
},
|
|
11544
11664
|
/**
|
|
11545
11665
|
* Sets maxHeight of options list.
|
|
@@ -11549,7 +11669,6 @@ const CMultiSelectOptions = defineComponent({
|
|
|
11549
11669
|
optionsMaxHeight: {
|
|
11550
11670
|
type: [Number, String],
|
|
11551
11671
|
default: 'auto',
|
|
11552
|
-
required: false,
|
|
11553
11672
|
},
|
|
11554
11673
|
/**
|
|
11555
11674
|
* Sets option style.
|
|
@@ -11560,7 +11679,6 @@ const CMultiSelectOptions = defineComponent({
|
|
|
11560
11679
|
optionsStyle: {
|
|
11561
11680
|
type: String,
|
|
11562
11681
|
default: 'checkbox',
|
|
11563
|
-
required: false,
|
|
11564
11682
|
validator: (value) => {
|
|
11565
11683
|
return ['checkbox', 'text'].includes(value);
|
|
11566
11684
|
},
|
|
@@ -11571,12 +11689,15 @@ const CMultiSelectOptions = defineComponent({
|
|
|
11571
11689
|
searchNoResultsLabel: {
|
|
11572
11690
|
type: String,
|
|
11573
11691
|
default: 'no items',
|
|
11574
|
-
required: false,
|
|
11575
11692
|
},
|
|
11576
11693
|
selected: {
|
|
11577
11694
|
type: Array,
|
|
11578
11695
|
default: () => [],
|
|
11579
|
-
|
|
11696
|
+
},
|
|
11697
|
+
virtualScroller: Boolean,
|
|
11698
|
+
visibleItems: {
|
|
11699
|
+
type: Number,
|
|
11700
|
+
default: 10,
|
|
11580
11701
|
},
|
|
11581
11702
|
},
|
|
11582
11703
|
emits: ['optionClick'],
|
|
@@ -11628,12 +11749,19 @@ const CMultiSelectOptions = defineComponent({
|
|
|
11628
11749
|
tabindex: 0,
|
|
11629
11750
|
}, option.text))
|
|
11630
11751
|
: h$1('div', { class: 'form-multi-select-options-empty' }, props.searchNoResultsLabel);
|
|
11631
|
-
return () =>
|
|
11632
|
-
|
|
11633
|
-
|
|
11634
|
-
|
|
11635
|
-
}
|
|
11636
|
-
|
|
11752
|
+
return () => props.virtualScroller
|
|
11753
|
+
? h$1(CVirtualScroller, {
|
|
11754
|
+
class: 'form-multi-select-options',
|
|
11755
|
+
visibleItems: props.visibleItems,
|
|
11756
|
+
}, {
|
|
11757
|
+
default: () => createOptions(props.options),
|
|
11758
|
+
})
|
|
11759
|
+
: h$1('div', {
|
|
11760
|
+
class: 'form-multi-select-options',
|
|
11761
|
+
...(props.optionsMaxHeight !== 'auto' && {
|
|
11762
|
+
style: { maxHeight: props.optionsMaxHeight, overflow: 'scroll' },
|
|
11763
|
+
}),
|
|
11764
|
+
}, createOptions(props.options));
|
|
11637
11765
|
},
|
|
11638
11766
|
});
|
|
11639
11767
|
|
|
@@ -11724,11 +11852,6 @@ const CMultiSelectSelection = defineComponent({
|
|
|
11724
11852
|
},
|
|
11725
11853
|
});
|
|
11726
11854
|
|
|
11727
|
-
const flattenArray = (options) => {
|
|
11728
|
-
return options.reduce((acc, val) => {
|
|
11729
|
-
return acc.concat(Array.isArray(val.options) ? flattenArray(val.options) : val);
|
|
11730
|
-
}, []);
|
|
11731
|
-
};
|
|
11732
11855
|
const CMultiSelect = defineComponent({
|
|
11733
11856
|
name: 'CMultiSelect',
|
|
11734
11857
|
props: {
|
|
@@ -11739,7 +11862,6 @@ const CMultiSelect = defineComponent({
|
|
|
11739
11862
|
*/
|
|
11740
11863
|
cleaner: {
|
|
11741
11864
|
type: Boolean,
|
|
11742
|
-
required: false,
|
|
11743
11865
|
default: true,
|
|
11744
11866
|
},
|
|
11745
11867
|
/**
|
|
@@ -11747,7 +11869,6 @@ const CMultiSelect = defineComponent({
|
|
|
11747
11869
|
*/
|
|
11748
11870
|
disabled: {
|
|
11749
11871
|
type: Boolean,
|
|
11750
|
-
required: false,
|
|
11751
11872
|
default: false,
|
|
11752
11873
|
},
|
|
11753
11874
|
/**
|
|
@@ -11802,7 +11923,6 @@ const CMultiSelect = defineComponent({
|
|
|
11802
11923
|
multiple: {
|
|
11803
11924
|
type: Boolean,
|
|
11804
11925
|
default: true,
|
|
11805
|
-
required: false,
|
|
11806
11926
|
},
|
|
11807
11927
|
/**
|
|
11808
11928
|
* List of option elements.
|
|
@@ -11810,7 +11930,6 @@ const CMultiSelect = defineComponent({
|
|
|
11810
11930
|
options: {
|
|
11811
11931
|
type: Array,
|
|
11812
11932
|
default: () => [],
|
|
11813
|
-
required: false,
|
|
11814
11933
|
},
|
|
11815
11934
|
/**
|
|
11816
11935
|
* Sets maxHeight of options list.
|
|
@@ -11820,7 +11939,6 @@ const CMultiSelect = defineComponent({
|
|
|
11820
11939
|
optionsMaxHeight: {
|
|
11821
11940
|
type: [Number, String],
|
|
11822
11941
|
default: 'auto',
|
|
11823
|
-
required: false,
|
|
11824
11942
|
},
|
|
11825
11943
|
/**
|
|
11826
11944
|
* Sets option style.
|
|
@@ -11831,7 +11949,6 @@ const CMultiSelect = defineComponent({
|
|
|
11831
11949
|
optionsStyle: {
|
|
11832
11950
|
type: String,
|
|
11833
11951
|
default: 'checkbox',
|
|
11834
|
-
required: false,
|
|
11835
11952
|
validator: (value) => {
|
|
11836
11953
|
return ['checkbox', 'text'].includes(value);
|
|
11837
11954
|
},
|
|
@@ -11844,7 +11961,6 @@ const CMultiSelect = defineComponent({
|
|
|
11844
11961
|
placeholder: {
|
|
11845
11962
|
type: String,
|
|
11846
11963
|
default: 'Select...',
|
|
11847
|
-
required: false,
|
|
11848
11964
|
},
|
|
11849
11965
|
/**
|
|
11850
11966
|
* Enables search input element.
|
|
@@ -11852,7 +11968,6 @@ const CMultiSelect = defineComponent({
|
|
|
11852
11968
|
search: {
|
|
11853
11969
|
type: [Boolean, String],
|
|
11854
11970
|
default: true,
|
|
11855
|
-
required: false,
|
|
11856
11971
|
validator: (value) => {
|
|
11857
11972
|
if (typeof value == 'string') {
|
|
11858
11973
|
return ['external'].includes(value);
|
|
@@ -11869,7 +11984,6 @@ const CMultiSelect = defineComponent({
|
|
|
11869
11984
|
searchNoResultsLabel: {
|
|
11870
11985
|
type: String,
|
|
11871
11986
|
default: 'no items',
|
|
11872
|
-
required: false,
|
|
11873
11987
|
},
|
|
11874
11988
|
/**
|
|
11875
11989
|
* Enables select all button.
|
|
@@ -11878,7 +11992,6 @@ const CMultiSelect = defineComponent({
|
|
|
11878
11992
|
*/
|
|
11879
11993
|
selectAll: {
|
|
11880
11994
|
type: Boolean,
|
|
11881
|
-
required: false,
|
|
11882
11995
|
default: true,
|
|
11883
11996
|
},
|
|
11884
11997
|
/**
|
|
@@ -11888,7 +12001,6 @@ const CMultiSelect = defineComponent({
|
|
|
11888
12001
|
*/
|
|
11889
12002
|
selectAllLabel: {
|
|
11890
12003
|
type: String,
|
|
11891
|
-
required: false,
|
|
11892
12004
|
default: 'Select all options',
|
|
11893
12005
|
},
|
|
11894
12006
|
/**
|
|
@@ -11900,7 +12012,6 @@ const CMultiSelect = defineComponent({
|
|
|
11900
12012
|
selectionType: {
|
|
11901
12013
|
type: String,
|
|
11902
12014
|
default: 'tags',
|
|
11903
|
-
required: false,
|
|
11904
12015
|
validator: (value) => {
|
|
11905
12016
|
return ['counter', 'tags', 'text'].includes(value);
|
|
11906
12017
|
},
|
|
@@ -11913,7 +12024,6 @@ const CMultiSelect = defineComponent({
|
|
|
11913
12024
|
selectionTypeCounterText: {
|
|
11914
12025
|
type: String,
|
|
11915
12026
|
default: 'item(s) selected',
|
|
11916
|
-
required: false,
|
|
11917
12027
|
},
|
|
11918
12028
|
/**
|
|
11919
12029
|
* Size the component small or large.
|
|
@@ -11922,7 +12032,6 @@ const CMultiSelect = defineComponent({
|
|
|
11922
12032
|
*/
|
|
11923
12033
|
size: {
|
|
11924
12034
|
type: String,
|
|
11925
|
-
required: false,
|
|
11926
12035
|
validator: (value) => {
|
|
11927
12036
|
return ['sm', 'lg'].includes(value);
|
|
11928
12037
|
},
|
|
@@ -11947,6 +12056,12 @@ const CMultiSelect = defineComponent({
|
|
|
11947
12056
|
* @since 4.6.0
|
|
11948
12057
|
*/
|
|
11949
12058
|
valid: Boolean,
|
|
12059
|
+
/**
|
|
12060
|
+
* Enable virtual scroller for the options list.
|
|
12061
|
+
*
|
|
12062
|
+
* @since 4.8.0
|
|
12063
|
+
*/
|
|
12064
|
+
virtualScroller: Boolean,
|
|
11950
12065
|
/**
|
|
11951
12066
|
* Toggle the visibility of multi select dropdown.
|
|
11952
12067
|
*
|
|
@@ -11955,7 +12070,16 @@ const CMultiSelect = defineComponent({
|
|
|
11955
12070
|
visible: {
|
|
11956
12071
|
type: Boolean,
|
|
11957
12072
|
default: false,
|
|
11958
|
-
|
|
12073
|
+
},
|
|
12074
|
+
/**
|
|
12075
|
+
*
|
|
12076
|
+
* Amount of visible items when virtualScroller is set to `true`.
|
|
12077
|
+
*
|
|
12078
|
+
* @since 4.8.0
|
|
12079
|
+
*/
|
|
12080
|
+
visibleItems: {
|
|
12081
|
+
type: Number,
|
|
12082
|
+
default: 10,
|
|
11959
12083
|
},
|
|
11960
12084
|
},
|
|
11961
12085
|
emits: [
|
|
@@ -11972,29 +12096,12 @@ const CMultiSelect = defineComponent({
|
|
|
11972
12096
|
],
|
|
11973
12097
|
setup(props, { attrs, emit }) {
|
|
11974
12098
|
const nativeSelectRef = ref();
|
|
11975
|
-
provide('nativeSelectRef', nativeSelectRef);
|
|
11976
|
-
const searchRef = ref();
|
|
11977
12099
|
const options = ref(props.options);
|
|
11978
12100
|
const search = ref('');
|
|
12101
|
+
const searchRef = ref();
|
|
11979
12102
|
const selected = ref([]);
|
|
11980
12103
|
const visible = ref(props.visible);
|
|
11981
|
-
|
|
11982
|
-
let _selected = [...selected.value, ...options];
|
|
11983
|
-
if (deselected) {
|
|
11984
|
-
_selected = _selected.filter((selectedOption) => !deselected.some((deselectedOption) => deselectedOption.value === selectedOption.value));
|
|
11985
|
-
}
|
|
11986
|
-
const deduplicated = _selected.reduce((unique, option) => {
|
|
11987
|
-
if (!unique.some((obj) => obj.value === option.value)) {
|
|
11988
|
-
unique.push({
|
|
11989
|
-
value: option.value,
|
|
11990
|
-
text: option.text,
|
|
11991
|
-
...(option.disabled && { disabled: option.disabled }),
|
|
11992
|
-
});
|
|
11993
|
-
}
|
|
11994
|
-
return unique;
|
|
11995
|
-
}, []);
|
|
11996
|
-
selected.value = deduplicated;
|
|
11997
|
-
};
|
|
12104
|
+
provide('nativeSelectRef', nativeSelectRef);
|
|
11998
12105
|
watch(() => props.options, (newValue, oldValue) => {
|
|
11999
12106
|
if (JSON.stringify(newValue) !== JSON.stringify(oldValue)) {
|
|
12000
12107
|
options.value = newValue;
|
|
@@ -12012,27 +12119,15 @@ const CMultiSelect = defineComponent({
|
|
|
12012
12119
|
}
|
|
12013
12120
|
return;
|
|
12014
12121
|
});
|
|
12015
|
-
|
|
12122
|
+
if (_selected) {
|
|
12123
|
+
selected.value = selectOptions(_selected, selected.value, deselected);
|
|
12124
|
+
}
|
|
12016
12125
|
}
|
|
12017
|
-
});
|
|
12126
|
+
}, { immediate: true });
|
|
12018
12127
|
watch(selected, () => {
|
|
12019
12128
|
nativeSelectRef.value &&
|
|
12020
12129
|
nativeSelectRef.value.dispatchEvent(new Event('change', { bubbles: true }));
|
|
12021
12130
|
});
|
|
12022
|
-
const filterOptionsList = (search, _options) => {
|
|
12023
|
-
return search.length
|
|
12024
|
-
? _options &&
|
|
12025
|
-
_options.reduce((acc, val) => {
|
|
12026
|
-
const options = val.options &&
|
|
12027
|
-
val.options.filter((element) => element.text && element.text.toLowerCase().includes(search.toLowerCase()));
|
|
12028
|
-
if ((val.text && val.text.toLowerCase().includes(search.toLowerCase())) ||
|
|
12029
|
-
(options && options.length)) {
|
|
12030
|
-
acc.push(Object.assign({}, val, options && options.length && { options }));
|
|
12031
|
-
}
|
|
12032
|
-
return acc;
|
|
12033
|
-
}, [])
|
|
12034
|
-
: options.value;
|
|
12035
|
-
};
|
|
12036
12131
|
const handleSearchChange = (event) => {
|
|
12037
12132
|
const target = event.target;
|
|
12038
12133
|
search.value = target.value.toLowerCase();
|
|
@@ -12070,7 +12165,7 @@ const CMultiSelect = defineComponent({
|
|
|
12070
12165
|
}
|
|
12071
12166
|
};
|
|
12072
12167
|
const handleSelectAll = () => {
|
|
12073
|
-
selectOptions(flattenArray(options.value).filter((option) => !option.disabled));
|
|
12168
|
+
selected.value = selectOptions(flattenArray(options.value).filter((option) => !option.disabled), selected.value);
|
|
12074
12169
|
};
|
|
12075
12170
|
const handleDeselectAll = () => {
|
|
12076
12171
|
selected.value = selected.value.filter((option) => option.disabled);
|
|
@@ -12161,7 +12256,7 @@ const CMultiSelect = defineComponent({
|
|
|
12161
12256
|
ref: searchRef,
|
|
12162
12257
|
}),
|
|
12163
12258
|
]),
|
|
12164
|
-
default: () =>
|
|
12259
|
+
default: () => visible.value && [
|
|
12165
12260
|
props.multiple &&
|
|
12166
12261
|
props.selectAll &&
|
|
12167
12262
|
h$1('button', {
|
|
@@ -12177,9 +12272,11 @@ const CMultiSelect = defineComponent({
|
|
|
12177
12272
|
optionsMaxHeight: props.optionsMaxHeight,
|
|
12178
12273
|
optionsStyle: props.optionsStyle,
|
|
12179
12274
|
searchNoResultsLabel: props.searchNoResultsLabel,
|
|
12180
|
-
selected: selected.value
|
|
12275
|
+
selected: selected.value,
|
|
12276
|
+
virtualScroller: props.virtualScroller,
|
|
12277
|
+
visibleItems: props.visibleItems,
|
|
12181
12278
|
}),
|
|
12182
|
-
]
|
|
12279
|
+
],
|
|
12183
12280
|
}),
|
|
12184
12281
|
}),
|
|
12185
12282
|
];
|
|
@@ -16684,6 +16781,8 @@ var Components = /*#__PURE__*/Object.freeze({
|
|
|
16684
16781
|
CToaster: CToaster,
|
|
16685
16782
|
CTooltip: CTooltip,
|
|
16686
16783
|
CTooltipPlugin: CTooltipPlugin,
|
|
16784
|
+
CVirtualScroller: CVirtualScroller,
|
|
16785
|
+
CVirtualScrollerPlugin: CVirtualScrollerPlugin,
|
|
16687
16786
|
CWidgetStatsA: CWidgetStatsA,
|
|
16688
16787
|
CWidgetStatsB: CWidgetStatsB,
|
|
16689
16788
|
CWidgetStatsC: CWidgetStatsC,
|
|
@@ -16922,5 +17021,5 @@ const CoreuiVue = {
|
|
|
16922
17021
|
},
|
|
16923
17022
|
};
|
|
16924
17023
|
|
|
16925
|
-
export { CAccordion, CAccordionBody, CAccordionButton, CAccordionHeader, CAccordionItem, CAccordionPlugin, CAlert, CAlertHeading, CAlertLink, CAlertPlugin, CAvatar, CAvatarPlugin, CBackdrop, CBackdropPlugin, CBadge, CBadgePlugin, CBreadcrumb, CBreadcrumbItem, CBreadcrumbPlugin, CButton, CButtonGroup, CButtonGroupPlugin, CButtonPlugin, CButtonToolbar, CCLinkPlugin, CCalendar, CCalendarPlugin, CCallout, CCalloutPlugin, CCard, CCardBody, CCardFooter, CCardGroup, CCardHeader, CCardImage, CCardImageOverlay, CCardLink, CCardPlugin, CCardSubtitle, CCardText, CCardTitle, CCarousel, CCarouselCaption, CCarouselItem, CCarouselPlugin, CCloseButton, CCloseButtonPlugin, CCol, CCollapse, CCollapsePlugin, CContainer, CDatePicker, CDatePickerPlugin, CDateRangePicker, CDateRangePickerPlugin, CDropdown, CDropdownDivider, CDropdownHeader, CDropdownItem, CDropdownMenu, CDropdownPlugin, CDropdownToggle, CElementCover, CElementCoverPlugin, CFooter, CFooterPlugin, CForm, CFormCheck, CFormFeedback, CFormFloating, CFormInput, CFormLabel, CFormPlugin, CFormRange, CFormSelect, CFormSwitch, CFormText, CFormTextarea, CGridPlugin, CHeader, CHeaderBrand, CHeaderDivider, CHeaderNav, CHeaderPlugin, CHeaderText, CHeaderToggler, CImage, CImagePlugin, CInputGroup, CInputGroupText, CLink, CListGroup, CListGroupItem, CListGroupPlugin, CLoadingButton, CLoadingButtonPlugin, CModal, CModalBody, CModalFooter, CModalHeader, CModalPlugin, CModalTitle, CMultiSelect, CMultiSelectPlugin, CNav, CNavGroup, CNavGroupItems, CNavItem, CNavLink, CNavPlugin, CNavTitle, CNavbar, CNavbarBrand, CNavbarNav, CNavbarPlugin, CNavbarText, CNavbarToggler, COffcanvas, COffcanvasBody, COffcanvasHeader, COffcanvasPlugin, COffcanvasTitle, CPagination, CPaginationItem, CPaginationPlugin, CPicker, CPickerPlugin, CPlaceholder, CPlaceholderPlugin, CPopover, CPopoverPlugin, CProgress, CProgressBar, CProgressPlugin, CRow, CSidebar, CSidebarBrand, CSidebarFooter, CSidebarHeader, CSidebarNav, CSidebarPlugin, CSidebarToggler, CSmartPagination, CSmartPaginationPlugin, CSmartTable, CSmartTablePlugin, CSpinner, CSpinnerPlugin, CTabContent, CTabPane, CTable, CTableBody, CTableCaption, CTableDataCell, CTableFoot, CTableHead, CTableHeaderCell, CTablePlugin, CTableRow, CTabsPlugin, CTimePicker, CTimePickerPlugin, CToast, CToastBody, CToastClose, CToastHeader, CToastPlugin, CToaster, CTooltip, CTooltipPlugin, CWidgetStatsA, CWidgetStatsB, CWidgetStatsC, CWidgetStatsD, CWidgetStatsE, CWidgetStatsF, CWidgetsStatsPlugin, CoreuiVue as default, vcplaceholder, vcpopover, vctooltip };
|
|
17024
|
+
export { CAccordion, CAccordionBody, CAccordionButton, CAccordionHeader, CAccordionItem, CAccordionPlugin, CAlert, CAlertHeading, CAlertLink, CAlertPlugin, CAvatar, CAvatarPlugin, CBackdrop, CBackdropPlugin, CBadge, CBadgePlugin, CBreadcrumb, CBreadcrumbItem, CBreadcrumbPlugin, CButton, CButtonGroup, CButtonGroupPlugin, CButtonPlugin, CButtonToolbar, CCLinkPlugin, CCalendar, CCalendarPlugin, CCallout, CCalloutPlugin, CCard, CCardBody, CCardFooter, CCardGroup, CCardHeader, CCardImage, CCardImageOverlay, CCardLink, CCardPlugin, CCardSubtitle, CCardText, CCardTitle, CCarousel, CCarouselCaption, CCarouselItem, CCarouselPlugin, CCloseButton, CCloseButtonPlugin, CCol, CCollapse, CCollapsePlugin, CContainer, CDatePicker, CDatePickerPlugin, CDateRangePicker, CDateRangePickerPlugin, CDropdown, CDropdownDivider, CDropdownHeader, CDropdownItem, CDropdownMenu, CDropdownPlugin, CDropdownToggle, CElementCover, CElementCoverPlugin, CFooter, CFooterPlugin, CForm, CFormCheck, CFormFeedback, CFormFloating, CFormInput, CFormLabel, CFormPlugin, CFormRange, CFormSelect, CFormSwitch, CFormText, CFormTextarea, CGridPlugin, CHeader, CHeaderBrand, CHeaderDivider, CHeaderNav, CHeaderPlugin, CHeaderText, CHeaderToggler, CImage, CImagePlugin, CInputGroup, CInputGroupText, CLink, CListGroup, CListGroupItem, CListGroupPlugin, CLoadingButton, CLoadingButtonPlugin, CModal, CModalBody, CModalFooter, CModalHeader, CModalPlugin, CModalTitle, CMultiSelect, CMultiSelectPlugin, CNav, CNavGroup, CNavGroupItems, CNavItem, CNavLink, CNavPlugin, CNavTitle, CNavbar, CNavbarBrand, CNavbarNav, CNavbarPlugin, CNavbarText, CNavbarToggler, COffcanvas, COffcanvasBody, COffcanvasHeader, COffcanvasPlugin, COffcanvasTitle, CPagination, CPaginationItem, CPaginationPlugin, CPicker, CPickerPlugin, CPlaceholder, CPlaceholderPlugin, CPopover, CPopoverPlugin, CProgress, CProgressBar, CProgressPlugin, CRow, CSidebar, CSidebarBrand, CSidebarFooter, CSidebarHeader, CSidebarNav, CSidebarPlugin, CSidebarToggler, CSmartPagination, CSmartPaginationPlugin, CSmartTable, CSmartTablePlugin, CSpinner, CSpinnerPlugin, CTabContent, CTabPane, CTable, CTableBody, CTableCaption, CTableDataCell, CTableFoot, CTableHead, CTableHeaderCell, CTablePlugin, CTableRow, CTabsPlugin, CTimePicker, CTimePickerPlugin, CToast, CToastBody, CToastClose, CToastHeader, CToastPlugin, CToaster, CTooltip, CTooltipPlugin, CVirtualScroller, CVirtualScrollerPlugin, CWidgetStatsA, CWidgetStatsB, CWidgetStatsC, CWidgetStatsD, CWidgetStatsE, CWidgetStatsF, CWidgetsStatsPlugin, CoreuiVue as default, vcplaceholder, vcpopover, vctooltip };
|
|
16926
17025
|
//# sourceMappingURL=index.es.js.map
|