@coreui/vue-pro 4.1.2 → 4.2.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/button/CButton.d.ts +29 -2
- package/dist/components/dropdown/CDropdown.d.ts +25 -0
- package/dist/components/dropdown/CDropdownToggle.d.ts +35 -1
- package/dist/components/smart-table/CSmartTable.d.ts +0 -3
- package/dist/components/smart-table/CSmartTableBody.d.ts +0 -11
- package/dist/components/smart-table/CSmartTableHead.d.ts +1 -1
- package/dist/index.es.js +206 -101
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +205 -100
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
- package/src/components/accordion/CAccordionButton.ts +1 -0
- package/src/components/accordion/__tests__/__snapshots__/CAccordionButton.spec.ts.snap +1 -1
- package/src/components/accordion/__tests__/__snapshots__/CAccordionHeader.spec.ts.snap +1 -1
- package/src/components/button/CButton.ts +30 -1
- package/src/components/button/__tests__/__snapshots__/CButton.spec.ts.snap +1 -1
- package/src/components/close-button/CCloseButton.ts +4 -1
- package/src/components/dropdown/CDropdown.ts +48 -49
- package/src/components/dropdown/CDropdownMenu.ts +50 -7
- package/src/components/dropdown/CDropdownToggle.ts +78 -29
- package/src/components/dropdown/__tests__/CDropdownMenu.spec.ts +7 -7
- package/src/components/dropdown/__tests__/CDropdownToggle.spec.ts +4 -5
- package/src/components/dropdown/__tests__/__snapshots__/CDropdownToggle.spec.ts.snap +2 -2
- package/src/components/form/CFormCheck.ts +2 -1
- package/src/components/form/CFormSwitch.ts +1 -7
- package/src/components/form/__tests__/__snapshots__/CFormCheck.spec.ts.snap +2 -8
- package/src/components/modal/__tests__/__snapshots__/CModal.spec.ts.snap +2 -1
- package/src/components/sidebar/__tests__/__snapshots__/CSidebar.spec.ts.snap +8 -2
- package/src/components/smart-table/CSmartTable.ts +18 -15
- package/src/components/smart-table/CSmartTableBody.ts +0 -5
- package/src/components/toast/__tests__/__snapshots__/CToastClose.spec.ts.snap +1 -1
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, nextTick, vShow, computed, Teleport, onBeforeUnmount } from 'vue';
|
|
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',
|
|
@@ -172,6 +172,7 @@ const CAccordionButton = defineComponent({
|
|
|
172
172
|
const toggleVisibility = inject('toggleVisibility');
|
|
173
173
|
const visible = inject('visible');
|
|
174
174
|
return () => h$1('button', {
|
|
175
|
+
type: 'button',
|
|
175
176
|
'aria-expanded': !visible.value,
|
|
176
177
|
class: ['accordion-button', { ['collapsed']: !visible.value }],
|
|
177
178
|
onClick: () => toggleVisibility(),
|
|
@@ -343,6 +344,9 @@ const CCloseButton = defineComponent({
|
|
|
343
344
|
],
|
|
344
345
|
setup(props, { emit }) {
|
|
345
346
|
const handleClick = () => {
|
|
347
|
+
if (props.disabled) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
346
350
|
emit('click');
|
|
347
351
|
};
|
|
348
352
|
return () => h$1('button', {
|
|
@@ -818,6 +822,20 @@ const CButton = defineComponent({
|
|
|
818
822
|
return ['sm', 'lg'].includes(value);
|
|
819
823
|
},
|
|
820
824
|
},
|
|
825
|
+
/**
|
|
826
|
+
* Specifies the type of button. Always specify the type attribute for the `<button>` element.
|
|
827
|
+
* Different browsers may use different default types for the `<button>` element.
|
|
828
|
+
*
|
|
829
|
+
* @values 'button', 'submit', 'reset'
|
|
830
|
+
*/
|
|
831
|
+
type: {
|
|
832
|
+
type: String,
|
|
833
|
+
default: 'button',
|
|
834
|
+
required: false,
|
|
835
|
+
validator: (value) => {
|
|
836
|
+
return ['button', 'submit', 'reset'].includes(value);
|
|
837
|
+
},
|
|
838
|
+
},
|
|
821
839
|
/**
|
|
822
840
|
* Set the button variant to an outlined button or a ghost button.
|
|
823
841
|
*
|
|
@@ -832,7 +850,19 @@ const CButton = defineComponent({
|
|
|
832
850
|
},
|
|
833
851
|
},
|
|
834
852
|
},
|
|
835
|
-
|
|
853
|
+
emits: [
|
|
854
|
+
/**
|
|
855
|
+
* Event called when the user clicks on the button.
|
|
856
|
+
*/
|
|
857
|
+
'click',
|
|
858
|
+
],
|
|
859
|
+
setup(props, { emit, slots }) {
|
|
860
|
+
const handleClick = () => {
|
|
861
|
+
if (props.disabled) {
|
|
862
|
+
return;
|
|
863
|
+
}
|
|
864
|
+
emit('click');
|
|
865
|
+
};
|
|
836
866
|
return () => h$1(props.component, {
|
|
837
867
|
class: [
|
|
838
868
|
'btn',
|
|
@@ -847,6 +877,8 @@ const CButton = defineComponent({
|
|
|
847
877
|
disabled: props.disabled && props.component !== 'a',
|
|
848
878
|
...(props.component === 'a' && props.disabled && { 'aria-disabled': true, tabIndex: -1 }),
|
|
849
879
|
...(props.component === 'a' && props.href && { href: props.href }),
|
|
880
|
+
...(props.component === 'button' && { type: props.type }),
|
|
881
|
+
onClick: handleClick,
|
|
850
882
|
}, slots.default && slots.default());
|
|
851
883
|
},
|
|
852
884
|
});
|
|
@@ -1805,6 +1837,10 @@ function getContainingBlock(element) {
|
|
|
1805
1837
|
|
|
1806
1838
|
var currentNode = getParentNode(element);
|
|
1807
1839
|
|
|
1840
|
+
if (isShadowRoot(currentNode)) {
|
|
1841
|
+
currentNode = currentNode.host;
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1808
1844
|
while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
|
|
1809
1845
|
var css = getComputedStyle$1(currentNode); // This is non-exhaustive but covers the most common CSS properties that
|
|
1810
1846
|
// create a containing block.
|
|
@@ -2037,7 +2073,7 @@ function mapToStyles(_ref2) {
|
|
|
2037
2073
|
|
|
2038
2074
|
if (placement === top || (placement === left || placement === right) && variation === end) {
|
|
2039
2075
|
sideY = bottom;
|
|
2040
|
-
var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
|
|
2076
|
+
var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
|
|
2041
2077
|
offsetParent[heightProp];
|
|
2042
2078
|
y -= offsetY - popperRect.height;
|
|
2043
2079
|
y *= gpuAcceleration ? 1 : -1;
|
|
@@ -2045,7 +2081,7 @@ function mapToStyles(_ref2) {
|
|
|
2045
2081
|
|
|
2046
2082
|
if (placement === left || (placement === top || placement === bottom) && variation === end) {
|
|
2047
2083
|
sideX = right;
|
|
2048
|
-
var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
|
|
2084
|
+
var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
|
|
2049
2085
|
offsetParent[widthProp];
|
|
2050
2086
|
x -= offsetX - popperRect.width;
|
|
2051
2087
|
x *= gpuAcceleration ? 1 : -1;
|
|
@@ -3504,6 +3540,20 @@ const CDropdown = defineComponent({
|
|
|
3504
3540
|
}
|
|
3505
3541
|
},
|
|
3506
3542
|
},
|
|
3543
|
+
/**
|
|
3544
|
+
* Configure the auto close behavior of the dropdown:
|
|
3545
|
+
* - `true` - the dropdown will be closed by clicking outside or inside the dropdown menu.
|
|
3546
|
+
* - `false` - the dropdown will be closed by clicking the toggle button and manually calling hide or toggle method. (Also will not be closed by pressing esc key)
|
|
3547
|
+
* - `'inside'` - the dropdown will be closed (only) by clicking inside the dropdown menu.
|
|
3548
|
+
* - `'outside'` - the dropdown will be closed (only) by clicking outside the dropdown menu.
|
|
3549
|
+
*/
|
|
3550
|
+
autoClose: {
|
|
3551
|
+
type: [Boolean, String],
|
|
3552
|
+
default: true,
|
|
3553
|
+
validator: (value) => {
|
|
3554
|
+
return typeof value === 'boolean' || ['inside', 'outside'].includes(value);
|
|
3555
|
+
},
|
|
3556
|
+
},
|
|
3507
3557
|
/**
|
|
3508
3558
|
* Sets a darker color scheme to match a dark navbar.
|
|
3509
3559
|
*/
|
|
@@ -3589,21 +3639,23 @@ const CDropdown = defineComponent({
|
|
|
3589
3639
|
'show',
|
|
3590
3640
|
],
|
|
3591
3641
|
setup(props, { slots, emit }) {
|
|
3592
|
-
const
|
|
3642
|
+
const dropdownToggleRef = ref();
|
|
3593
3643
|
const dropdownMenuRef = ref();
|
|
3594
3644
|
const placement = ref(props.placement);
|
|
3595
3645
|
const popper = ref();
|
|
3596
|
-
const
|
|
3646
|
+
const visible = ref(props.visible);
|
|
3647
|
+
watch(() => props.visible, () => {
|
|
3648
|
+
visible.value = props.visible;
|
|
3649
|
+
});
|
|
3650
|
+
provide('config', {
|
|
3651
|
+
autoClose: props.autoClose,
|
|
3597
3652
|
alignment: props.alignment,
|
|
3598
3653
|
dark: props.dark,
|
|
3599
3654
|
popper: props.popper,
|
|
3600
|
-
visible: props.visible,
|
|
3601
3655
|
});
|
|
3602
|
-
const { visible } = toRefs(config);
|
|
3603
|
-
provide('config', config);
|
|
3604
3656
|
provide('variant', props.variant);
|
|
3605
3657
|
provide('visible', visible);
|
|
3606
|
-
provide('
|
|
3658
|
+
provide('dropdownToggleRef', dropdownToggleRef);
|
|
3607
3659
|
provide('dropdownMenuRef', dropdownMenuRef);
|
|
3608
3660
|
if (props.direction === 'dropup') {
|
|
3609
3661
|
placement.value = 'top-start';
|
|
@@ -3622,8 +3674,8 @@ const CDropdown = defineComponent({
|
|
|
3622
3674
|
if (typeof props.alignment === 'object') {
|
|
3623
3675
|
return;
|
|
3624
3676
|
}
|
|
3625
|
-
if (
|
|
3626
|
-
popper.value = createPopper(
|
|
3677
|
+
if (dropdownToggleRef.value) {
|
|
3678
|
+
popper.value = createPopper(dropdownToggleRef.value, dropdownMenuRef.value, {
|
|
3627
3679
|
placement: placement.value,
|
|
3628
3680
|
});
|
|
3629
3681
|
}
|
|
@@ -3634,40 +3686,28 @@ const CDropdown = defineComponent({
|
|
|
3634
3686
|
}
|
|
3635
3687
|
popper.value = undefined;
|
|
3636
3688
|
};
|
|
3637
|
-
const toggleMenu =
|
|
3638
|
-
if (props.disabled
|
|
3639
|
-
|
|
3640
|
-
visible.value = false;
|
|
3641
|
-
}
|
|
3642
|
-
else {
|
|
3643
|
-
visible.value = true;
|
|
3644
|
-
}
|
|
3689
|
+
const toggleMenu = (_visible) => {
|
|
3690
|
+
if (props.disabled) {
|
|
3691
|
+
return;
|
|
3645
3692
|
}
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
if (props.disabled === false) {
|
|
3650
|
-
visible.value = false;
|
|
3693
|
+
if (typeof _visible == 'boolean') {
|
|
3694
|
+
visible.value = _visible;
|
|
3695
|
+
return;
|
|
3651
3696
|
}
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
hideMenu();
|
|
3697
|
+
if (visible.value === true) {
|
|
3698
|
+
visible.value = false;
|
|
3699
|
+
return;
|
|
3656
3700
|
}
|
|
3701
|
+
visible.value = true;
|
|
3657
3702
|
};
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3703
|
+
provide('toggleMenu', toggleMenu);
|
|
3704
|
+
const hideMenu = () => {
|
|
3705
|
+
if (props.disabled) {
|
|
3706
|
+
return;
|
|
3661
3707
|
}
|
|
3708
|
+
visible.value = false;
|
|
3662
3709
|
};
|
|
3663
|
-
|
|
3664
|
-
window.addEventListener('click', handleClickOutside);
|
|
3665
|
-
window.addEventListener('keyup', handleKeyup);
|
|
3666
|
-
});
|
|
3667
|
-
onUnmounted(() => {
|
|
3668
|
-
window.removeEventListener('click', handleClickOutside);
|
|
3669
|
-
window.removeEventListener('keyup', handleKeyup);
|
|
3670
|
-
});
|
|
3710
|
+
provide('hideMenu', hideMenu);
|
|
3671
3711
|
watch(visible, () => {
|
|
3672
3712
|
props.popper && (visible.value ? initPopper() : destroyPopper());
|
|
3673
3713
|
visible.value ? emit('show') : emit('hide');
|
|
@@ -3773,10 +3813,12 @@ const CDropdownMenu = defineComponent({
|
|
|
3773
3813
|
},
|
|
3774
3814
|
},
|
|
3775
3815
|
setup(props, { slots }) {
|
|
3816
|
+
const dropdownToggleRef = inject('dropdownToggleRef');
|
|
3776
3817
|
const dropdownMenuRef = inject('dropdownMenuRef');
|
|
3777
|
-
// eslint-disable-
|
|
3778
|
-
const
|
|
3779
|
-
const
|
|
3818
|
+
const config = inject('config'); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
3819
|
+
const hideMenu = inject('hideMenu');
|
|
3820
|
+
const visible = inject('visible');
|
|
3821
|
+
const { autoClose, alignment, dark, popper } = config;
|
|
3780
3822
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
3781
3823
|
const alignmentClassNames = (alignment) => {
|
|
3782
3824
|
const classNames = [];
|
|
@@ -3790,13 +3832,46 @@ const CDropdownMenu = defineComponent({
|
|
|
3790
3832
|
}
|
|
3791
3833
|
return classNames;
|
|
3792
3834
|
};
|
|
3835
|
+
const handleKeyup = (event) => {
|
|
3836
|
+
if (autoClose === false) {
|
|
3837
|
+
return;
|
|
3838
|
+
}
|
|
3839
|
+
if (!dropdownMenuRef.value?.contains(event.target)) {
|
|
3840
|
+
hideMenu();
|
|
3841
|
+
}
|
|
3842
|
+
};
|
|
3843
|
+
const handleMouseUp = (event) => {
|
|
3844
|
+
if (dropdownToggleRef.value?.contains(event.target)) {
|
|
3845
|
+
return;
|
|
3846
|
+
}
|
|
3847
|
+
if (autoClose === true) {
|
|
3848
|
+
hideMenu();
|
|
3849
|
+
return;
|
|
3850
|
+
}
|
|
3851
|
+
if (autoClose === 'inside' && dropdownMenuRef.value?.contains(event.target)) {
|
|
3852
|
+
hideMenu();
|
|
3853
|
+
return;
|
|
3854
|
+
}
|
|
3855
|
+
if (autoClose === 'outside' &&
|
|
3856
|
+
!dropdownMenuRef.value?.contains(event.target)) {
|
|
3857
|
+
hideMenu();
|
|
3858
|
+
}
|
|
3859
|
+
};
|
|
3860
|
+
onUpdated(() => {
|
|
3861
|
+
visible.value && window.addEventListener('mouseup', handleMouseUp);
|
|
3862
|
+
visible.value && window.addEventListener('keyup', handleKeyup);
|
|
3863
|
+
});
|
|
3864
|
+
onUnmounted(() => {
|
|
3865
|
+
window.removeEventListener('mouseup', handleMouseUp);
|
|
3866
|
+
window.removeEventListener('keyup', handleKeyup);
|
|
3867
|
+
});
|
|
3793
3868
|
return () => h$1(props.component, {
|
|
3794
3869
|
class: [
|
|
3795
3870
|
'dropdown-menu',
|
|
3796
|
-
{ 'dropdown-menu-dark': dark
|
|
3797
|
-
alignmentClassNames(alignment
|
|
3871
|
+
{ 'dropdown-menu-dark': dark, show: visible.value },
|
|
3872
|
+
alignmentClassNames(alignment),
|
|
3798
3873
|
],
|
|
3799
|
-
...((typeof alignment
|
|
3874
|
+
...((typeof alignment === 'object' || !popper) && {
|
|
3800
3875
|
'data-coreui-popper': 'static',
|
|
3801
3876
|
}),
|
|
3802
3877
|
ref: dropdownMenuRef,
|
|
@@ -3839,6 +3914,10 @@ const CDropdownToggle = defineComponent({
|
|
|
3839
3914
|
default: 'button',
|
|
3840
3915
|
require: false,
|
|
3841
3916
|
},
|
|
3917
|
+
/**
|
|
3918
|
+
* Create a custom toggler which accepts any content.
|
|
3919
|
+
*/
|
|
3920
|
+
custom: Boolean,
|
|
3842
3921
|
/**
|
|
3843
3922
|
* Toggle the disabled state for the component.
|
|
3844
3923
|
*/
|
|
@@ -3870,6 +3949,16 @@ const CDropdownToggle = defineComponent({
|
|
|
3870
3949
|
type: Boolean,
|
|
3871
3950
|
required: false,
|
|
3872
3951
|
},
|
|
3952
|
+
/**
|
|
3953
|
+
* Sets which event handlers you’d like provided to your toggle prop. You can specify one trigger or an array of them.
|
|
3954
|
+
*
|
|
3955
|
+
* @type 'hover' | 'focus' | 'click'
|
|
3956
|
+
*/
|
|
3957
|
+
trigger: {
|
|
3958
|
+
type: String,
|
|
3959
|
+
default: 'click',
|
|
3960
|
+
required: false,
|
|
3961
|
+
},
|
|
3873
3962
|
/**
|
|
3874
3963
|
* Set the button variant to an outlined button or a ghost button.
|
|
3875
3964
|
*
|
|
@@ -3885,7 +3974,8 @@ const CDropdownToggle = defineComponent({
|
|
|
3885
3974
|
},
|
|
3886
3975
|
},
|
|
3887
3976
|
setup(props, { slots }) {
|
|
3888
|
-
const
|
|
3977
|
+
const togglerRef = ref();
|
|
3978
|
+
const dropdownToggleRef = inject('dropdownToggleRef');
|
|
3889
3979
|
const dropdownVariant = inject('variant');
|
|
3890
3980
|
const visible = inject('visible');
|
|
3891
3981
|
const toggleMenu = inject('toggleMenu');
|
|
@@ -3893,43 +3983,70 @@ const CDropdownToggle = defineComponent({
|
|
|
3893
3983
|
{
|
|
3894
3984
|
'dropdown-toggle': props.caret,
|
|
3895
3985
|
'dropdown-toggle-split': props.split,
|
|
3896
|
-
show: visible,
|
|
3897
3986
|
active: props.active,
|
|
3898
3987
|
disabled: props.disabled,
|
|
3899
3988
|
},
|
|
3900
3989
|
];
|
|
3901
|
-
const
|
|
3902
|
-
'
|
|
3903
|
-
|
|
3904
|
-
{
|
|
3905
|
-
[`btn-${props.size}`]: props.size,
|
|
3906
|
-
},
|
|
3907
|
-
props.shape,
|
|
3908
|
-
];
|
|
3909
|
-
return () => dropdownVariant === 'nav-item'
|
|
3910
|
-
? h$1('a', {
|
|
3911
|
-
active: props.active,
|
|
3912
|
-
class: ['nav-link', className],
|
|
3913
|
-
disabled: props.disabled,
|
|
3914
|
-
href: '#',
|
|
3915
|
-
onClick: (event) => {
|
|
3916
|
-
event.preventDefault();
|
|
3917
|
-
return toggleMenu();
|
|
3918
|
-
},
|
|
3919
|
-
ref: dropdownRef,
|
|
3920
|
-
}, { default: () => slots.default && slots.default() })
|
|
3921
|
-
: h$1(
|
|
3922
|
-
// TODO: check how to use CButton component
|
|
3923
|
-
props.component, {
|
|
3924
|
-
class: [...className, ...buttonClassName],
|
|
3925
|
-
active: props.active,
|
|
3926
|
-
disabled: props.disabled,
|
|
3990
|
+
const triggers = {
|
|
3991
|
+
...((props.trigger === 'click' || props.trigger.includes('click')) &&
|
|
3992
|
+
!props.disabled && {
|
|
3927
3993
|
onClick: () => toggleMenu(),
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
:
|
|
3994
|
+
}),
|
|
3995
|
+
...((props.trigger === 'focus' || props.trigger.includes('focus')) &&
|
|
3996
|
+
!props.disabled && {
|
|
3997
|
+
onfocus: () => toggleMenu(true),
|
|
3998
|
+
onblur: () => toggleMenu(false),
|
|
3999
|
+
}),
|
|
4000
|
+
};
|
|
4001
|
+
onMounted(() => {
|
|
4002
|
+
if (togglerRef.value) {
|
|
4003
|
+
dropdownToggleRef.value = togglerRef.value.$el;
|
|
4004
|
+
}
|
|
4005
|
+
});
|
|
4006
|
+
return () => props.custom
|
|
4007
|
+
? slots.default &&
|
|
4008
|
+
slots.default().map((slot) => cloneVNode(slot, {
|
|
4009
|
+
ref: (el) => {
|
|
4010
|
+
togglerRef.value = el;
|
|
4011
|
+
},
|
|
4012
|
+
...triggers,
|
|
4013
|
+
}))
|
|
4014
|
+
: dropdownVariant === 'nav-item'
|
|
4015
|
+
? h$1('a', {
|
|
4016
|
+
active: props.active,
|
|
4017
|
+
class: [
|
|
4018
|
+
'nav-link',
|
|
4019
|
+
className,
|
|
4020
|
+
{
|
|
4021
|
+
show: visible.value,
|
|
4022
|
+
},
|
|
4023
|
+
],
|
|
4024
|
+
disabled: props.disabled,
|
|
4025
|
+
href: '#',
|
|
4026
|
+
ref: dropdownToggleRef,
|
|
4027
|
+
...triggers,
|
|
4028
|
+
}, { default: () => slots.default && slots.default() })
|
|
4029
|
+
: h$1(CButton, {
|
|
4030
|
+
class: [
|
|
4031
|
+
className,
|
|
4032
|
+
{
|
|
4033
|
+
show: visible.value,
|
|
4034
|
+
},
|
|
4035
|
+
],
|
|
4036
|
+
active: props.active,
|
|
4037
|
+
color: props.color,
|
|
4038
|
+
disabled: props.disabled,
|
|
4039
|
+
ref: (el) => {
|
|
4040
|
+
togglerRef.value = el;
|
|
4041
|
+
},
|
|
4042
|
+
shape: props.shape,
|
|
4043
|
+
size: props.size,
|
|
4044
|
+
...triggers,
|
|
4045
|
+
...(props.component === 'button' && { type: 'button' }),
|
|
4046
|
+
variant: props.variant,
|
|
4047
|
+
}, () => props.split
|
|
4048
|
+
? h$1('span', { class: 'visually-hidden' }, 'Toggle Dropdown')
|
|
4049
|
+
: slots.default && slots.default());
|
|
3933
4050
|
},
|
|
3934
4051
|
});
|
|
3935
4052
|
|
|
@@ -4335,6 +4452,7 @@ const CFormCheck = defineComponent({
|
|
|
4335
4452
|
};
|
|
4336
4453
|
const formControl = () => {
|
|
4337
4454
|
return h$1('input', {
|
|
4455
|
+
...attrs,
|
|
4338
4456
|
checked: props.modelValue,
|
|
4339
4457
|
class: [
|
|
4340
4458
|
props.button ? 'btn-check' : 'form-check-input',
|
|
@@ -4347,7 +4465,6 @@ const CFormCheck = defineComponent({
|
|
|
4347
4465
|
indeterminate: props.indeterminate,
|
|
4348
4466
|
onChange: (event) => handleChange(event),
|
|
4349
4467
|
type: props.type,
|
|
4350
|
-
...attrs,
|
|
4351
4468
|
});
|
|
4352
4469
|
};
|
|
4353
4470
|
const formLabel = () => {
|
|
@@ -4380,6 +4497,7 @@ const CFormCheck = defineComponent({
|
|
|
4380
4497
|
'is-invalid': props.invalid,
|
|
4381
4498
|
'is-valid': props.valid,
|
|
4382
4499
|
},
|
|
4500
|
+
attrs.class,
|
|
4383
4501
|
],
|
|
4384
4502
|
}, [formControl(), props.label && formLabel()])
|
|
4385
4503
|
: formControl();
|
|
@@ -4828,11 +4946,6 @@ const CFormSwitch = defineComponent({
|
|
|
4828
4946
|
],
|
|
4829
4947
|
setup(props, { attrs, emit }) {
|
|
4830
4948
|
const checked = ref(attrs.checked);
|
|
4831
|
-
onMounted(() => {
|
|
4832
|
-
if (props.modelValue && typeof props.modelValue === 'boolean') {
|
|
4833
|
-
console.log(props.modelValue);
|
|
4834
|
-
}
|
|
4835
|
-
});
|
|
4836
4949
|
watch(() => props.modelValue, () => {
|
|
4837
4950
|
if (typeof props.modelValue === 'boolean')
|
|
4838
4951
|
checked.value = props.modelValue;
|
|
@@ -8550,11 +8663,6 @@ const CSmartTableBody = defineComponent({
|
|
|
8550
8663
|
default: undefined,
|
|
8551
8664
|
require: false,
|
|
8552
8665
|
},
|
|
8553
|
-
columns: {
|
|
8554
|
-
type: Array,
|
|
8555
|
-
default: () => [],
|
|
8556
|
-
require: true,
|
|
8557
|
-
},
|
|
8558
8666
|
rawColumnNames: {
|
|
8559
8667
|
type: Array,
|
|
8560
8668
|
default: () => [],
|
|
@@ -9148,7 +9256,6 @@ const CSmartTable = defineComponent({
|
|
|
9148
9256
|
*/
|
|
9149
9257
|
columns: {
|
|
9150
9258
|
type: Array,
|
|
9151
|
-
default: () => [],
|
|
9152
9259
|
required: false,
|
|
9153
9260
|
},
|
|
9154
9261
|
/**
|
|
@@ -9456,7 +9563,7 @@ const CSmartTable = defineComponent({
|
|
|
9456
9563
|
});
|
|
9457
9564
|
// functions
|
|
9458
9565
|
const isSortable = (i) => {
|
|
9459
|
-
const isDataColumn = itemsDataColumns.value.includes(rawColumnNames[i]);
|
|
9566
|
+
const isDataColumn = itemsDataColumns.value.includes(rawColumnNames.value[i]);
|
|
9460
9567
|
let column;
|
|
9461
9568
|
if (props.columns)
|
|
9462
9569
|
column = props.columns[i];
|
|
@@ -9554,16 +9661,16 @@ const CSmartTable = defineComponent({
|
|
|
9554
9661
|
sorterState.state = '';
|
|
9555
9662
|
};
|
|
9556
9663
|
// computed
|
|
9557
|
-
const genCols = Object.keys(items.value[0] || {}).filter((el) => el.charAt(0) !== '_');
|
|
9558
|
-
const rawColumnNames = props.columns
|
|
9664
|
+
const genCols = computed(() => Object.keys(items.value[0] || {}).filter((el) => el.charAt(0) !== '_'));
|
|
9665
|
+
const rawColumnNames = computed(() => props.columns
|
|
9559
9666
|
? props.columns.map((column) => {
|
|
9560
9667
|
if (typeof column === 'object')
|
|
9561
9668
|
return column.key;
|
|
9562
9669
|
else
|
|
9563
9670
|
return column;
|
|
9564
9671
|
})
|
|
9565
|
-
: genCols; //! || el
|
|
9566
|
-
const itemsDataColumns = computed(() => rawColumnNames.filter((name) => genCols.includes(name)));
|
|
9672
|
+
: genCols.value); //! || el
|
|
9673
|
+
const itemsDataColumns = computed(() => rawColumnNames.value.filter((name) => genCols.value.includes(name)));
|
|
9567
9674
|
// variables
|
|
9568
9675
|
const columnFiltered = () => {
|
|
9569
9676
|
let _items = items.value;
|
|
@@ -9669,7 +9776,7 @@ const CSmartTable = defineComponent({
|
|
|
9669
9776
|
...props.tableHeadProps,
|
|
9670
9777
|
columnFilter: props.columnFilter,
|
|
9671
9778
|
columnFilterValue: columnFilterState.value,
|
|
9672
|
-
columns: props.columns,
|
|
9779
|
+
columns: props.columns ? props.columns : rawColumnNames.value,
|
|
9673
9780
|
columnSorter: props.columnSorter,
|
|
9674
9781
|
selectable: props.selectable,
|
|
9675
9782
|
selectAll: selectedAll.value,
|
|
@@ -9716,12 +9823,11 @@ const CSmartTable = defineComponent({
|
|
|
9716
9823
|
currentItems: currentItems.value,
|
|
9717
9824
|
firstItemOnActivePageIndex: firstItemOnActivePageIndex.value,
|
|
9718
9825
|
noItemsLabel: props.noItemsLabel,
|
|
9719
|
-
columns: props.columns,
|
|
9720
9826
|
scopedSlots: slots,
|
|
9721
9827
|
selectable: props.selectable,
|
|
9722
9828
|
onRowChecked: (id, value) => handleRowChecked(id, value),
|
|
9723
9829
|
onRowClick: (item, index, columnName, event) => handleRowClick(item, index, columnName, event),
|
|
9724
|
-
rawColumnNames: rawColumnNames,
|
|
9830
|
+
rawColumnNames: rawColumnNames.value,
|
|
9725
9831
|
clickableRows: props.clickableRows,
|
|
9726
9832
|
...props.tableBodyProps,
|
|
9727
9833
|
}),
|
|
@@ -9731,7 +9837,7 @@ const CSmartTable = defineComponent({
|
|
|
9731
9837
|
...props.tableFootProps,
|
|
9732
9838
|
columnFilter: false,
|
|
9733
9839
|
columnSorter: false,
|
|
9734
|
-
columns: props.columns,
|
|
9840
|
+
columns: props.columns ? props.columns : rawColumnNames.value,
|
|
9735
9841
|
selectable: props.selectable,
|
|
9736
9842
|
selectAll: selectedAll.value,
|
|
9737
9843
|
onFilterInput: (key, value) => columnFilterChange(key, value, 'input'),
|
|
@@ -9761,7 +9867,6 @@ const CSmartTable = defineComponent({
|
|
|
9761
9867
|
pages: numberOfPages.value,
|
|
9762
9868
|
activePage: activePage.value,
|
|
9763
9869
|
onActivePageChange: handleActivePageChange,
|
|
9764
|
-
limit: itemsPerPage.value,
|
|
9765
9870
|
})
|
|
9766
9871
|
: ''),
|
|
9767
9872
|
h$1('div', {
|