@coreui/vue-pro 4.8.0-next.1 → 4.8.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 CHANGED
@@ -46,7 +46,7 @@
46
46
 
47
47
  Several quick start options are available:
48
48
 
49
- - [Download the latest release](https://github.com/coreui/coreui-vue-pro/archive/v4.7.0.zip)
49
+ - [Download the latest release](https://github.com/coreui/coreui-vue-pro/archive/v4.8.0.zip)
50
50
  - Clone the repo: `git clone https://github.com/coreui/coreui-vue-pro.git`
51
51
  - Install with [npm](https://www.npmjs.com/): `npm install @coreui/vue-pro`
52
52
  - Install with [yarn](https://yarnpkg.com/): `yarn add @coreui/vue-pro`
@@ -71,6 +71,12 @@ declare const CFormCheck: import("vue").DefineComponent<{
71
71
  type: (StringConstructor | BooleanConstructor)[];
72
72
  value: undefined;
73
73
  };
74
+ /**
75
+ * Put checkboxes or radios on the opposite side.
76
+ *
77
+ * @sinve 4.8.0
78
+ */
79
+ reverse: BooleanConstructor;
74
80
  /**
75
81
  * Display validation feedback in a styled tooltip.
76
82
  *
@@ -169,6 +175,12 @@ declare const CFormCheck: import("vue").DefineComponent<{
169
175
  type: (StringConstructor | BooleanConstructor)[];
170
176
  value: undefined;
171
177
  };
178
+ /**
179
+ * Put checkboxes or radios on the opposite side.
180
+ *
181
+ * @sinve 4.8.0
182
+ */
183
+ reverse: BooleanConstructor;
172
184
  /**
173
185
  * Display validation feedback in a styled tooltip.
174
186
  *
@@ -194,6 +206,7 @@ declare const CFormCheck: import("vue").DefineComponent<{
194
206
  onChange?: ((...args: any[]) => any) | undefined;
195
207
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
196
208
  }, {
209
+ reverse: boolean;
197
210
  type: string;
198
211
  invalid: boolean;
199
212
  valid: boolean;
@@ -24,6 +24,12 @@ declare const CFormSwitch: import("vue").DefineComponent<{
24
24
  type: (StringConstructor | BooleanConstructor)[];
25
25
  value: undefined;
26
26
  };
27
+ /**
28
+ * Put checkboxes or radios on the opposite side.
29
+ *
30
+ * @sinve 4.8.0
31
+ */
32
+ reverse: BooleanConstructor;
27
33
  /**
28
34
  * Size the component large or extra large. Works only with `switch`.
29
35
  *
@@ -76,6 +82,12 @@ declare const CFormSwitch: import("vue").DefineComponent<{
76
82
  type: (StringConstructor | BooleanConstructor)[];
77
83
  value: undefined;
78
84
  };
85
+ /**
86
+ * Put checkboxes or radios on the opposite side.
87
+ *
88
+ * @sinve 4.8.0
89
+ */
90
+ reverse: BooleanConstructor;
79
91
  /**
80
92
  * Size the component large or extra large. Works only with `switch`.
81
93
  *
@@ -104,6 +116,7 @@ declare const CFormSwitch: import("vue").DefineComponent<{
104
116
  onChange?: ((...args: any[]) => any) | undefined;
105
117
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
106
118
  }, {
119
+ reverse: boolean;
107
120
  type: string;
108
121
  invalid: boolean;
109
122
  valid: boolean;
@@ -501,12 +501,12 @@ declare const CSmartTable: import("vue").DefineComponent<{
501
501
  onSorterChange?: ((...args: any[]) => any) | undefined;
502
502
  onTableFilterChange?: ((...args: any[]) => any) | undefined;
503
503
  }, {
504
- items: Item[];
505
504
  selected: Item[];
506
505
  header: boolean;
507
506
  cleaner: boolean;
508
507
  loading: boolean;
509
508
  activePage: number;
509
+ items: Item[];
510
510
  clickableRows: boolean;
511
511
  noItemsLabel: string;
512
512
  selectable: boolean;
@@ -54,8 +54,8 @@ declare const CSmartTableHead: import("vue").DefineComponent<{
54
54
  onSortClick?: ((...args: any[]) => any) | undefined;
55
55
  }, {
56
56
  component: string;
57
- items: Item[];
58
57
  columns: (string | Column)[];
58
+ items: Item[];
59
59
  selectable: boolean;
60
60
  }>;
61
61
  export { CSmartTableHead };
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, computed, Teleport, onBeforeUnmount } from 'vue';
1
+ import { defineComponent, ref, provide, h as h$1, Transition, withDirectives, inject, watch, onBeforeMount, onMounted, onUpdated, toRefs, onUnmounted, cloneVNode, nextTick, vShow, computed, Teleport, onBeforeUnmount } from 'vue';
2
2
 
3
3
  const CAccordion = defineComponent({
4
4
  name: 'CAccordion',
@@ -1979,10 +1979,13 @@ const CCarousel = defineComponent({
1979
1979
  },
1980
1980
  setup(props, { slots }) {
1981
1981
  const carouselRef = ref();
1982
- const timeout = ref();
1982
+ const active = ref(props.index);
1983
1983
  const animating = ref(false);
1984
- const visible = ref();
1985
1984
  const customInterval = ref(props.interval);
1985
+ const direction = ref('next');
1986
+ const items = ref([]);
1987
+ const timeout = ref();
1988
+ const visible = ref();
1986
1989
  const setAnimating = (value) => {
1987
1990
  animating.value = value;
1988
1991
  };
@@ -1998,27 +2001,16 @@ const CCarousel = defineComponent({
1998
2001
  timeout.value = setTimeout(() => nextItemWhenVisible(), typeof customInterval.value === 'number' ? customInterval.value : props.interval);
1999
2002
  }
2000
2003
  };
2001
- const state = reactive({
2002
- items: [],
2003
- active: props.index,
2004
- direction: 'next',
2005
- });
2006
- onBeforeMount(() => {
2007
- if (slots.default) {
2008
- // @ts-expect-error TODO: fix types
2009
- state.items = slots.default().filter((child) => child.type.name === 'CCarouselItem');
2010
- }
2011
- });
2012
- const handleControlClick = (direction) => {
2004
+ const handleControlClick = (_direction) => {
2013
2005
  if (animating.value) {
2014
2006
  return;
2015
2007
  }
2016
- state.direction = direction;
2017
- if (direction === 'next') {
2018
- state.active === state.items.length - 1 ? (state.active = 0) : state.active++;
2008
+ direction.value = _direction;
2009
+ if (_direction === 'next') {
2010
+ active.value === items.value.length - 1 ? (active.value = 0) : active.value++;
2019
2011
  }
2020
2012
  else {
2021
- state.active === 0 ? (state.active = state.items.length - 1) : state.active--;
2013
+ active.value === 0 ? (active.value = items.value.length - 1) : active.value--;
2022
2014
  }
2023
2015
  };
2024
2016
  const nextItemWhenVisible = () => {
@@ -2029,17 +2021,17 @@ const CCarousel = defineComponent({
2029
2021
  }
2030
2022
  };
2031
2023
  const handleIndicatorClick = (index) => {
2032
- if (state.active === index) {
2024
+ if (active.value === index) {
2033
2025
  return;
2034
2026
  }
2035
- if (state.active < index) {
2036
- state.direction = 'next';
2037
- state.active = index;
2027
+ if (active.value < index) {
2028
+ direction.value = 'next';
2029
+ active.value = index;
2038
2030
  return;
2039
2031
  }
2040
- if (state.active > index) {
2041
- state.direction = 'prev';
2042
- state.active = index;
2032
+ if (active.value > index) {
2033
+ direction.value = 'prev';
2034
+ active.value = index;
2043
2035
  }
2044
2036
  };
2045
2037
  const handleScroll = () => {
@@ -2050,6 +2042,15 @@ const CCarousel = defineComponent({
2050
2042
  visible.value = false;
2051
2043
  }
2052
2044
  };
2045
+ onBeforeMount(() => {
2046
+ if (slots.default) {
2047
+ const children = typeof slots.default()[0].type === 'symbol' ? slots.default()[0].children : slots.default();
2048
+ if (children && Array.isArray(children)) {
2049
+ // @ts-expect-error TODO: fix types
2050
+ items.value = children.filter((child) => child.type.name === 'CCarouselItem');
2051
+ }
2052
+ }
2053
+ });
2053
2054
  onMounted(() => {
2054
2055
  window.addEventListener('scroll', handleScroll);
2055
2056
  });
@@ -2059,7 +2060,7 @@ const CCarousel = defineComponent({
2059
2060
  !animating.value && cycle();
2060
2061
  return;
2061
2062
  }
2062
- if (!props.wrap && state.active < state.items.length - 1) {
2063
+ if (!props.wrap && active.value < items.value.length - 1) {
2063
2064
  !animating.value && cycle();
2064
2065
  }
2065
2066
  });
@@ -2080,19 +2081,19 @@ const CCarousel = defineComponent({
2080
2081
  props.indicators &&
2081
2082
  h$1('div', {
2082
2083
  class: 'carousel-indicators',
2083
- }, state.items.map((_, index) => {
2084
+ }, items.value.map((_, index) => {
2084
2085
  return h$1('button', {
2085
2086
  type: 'button',
2086
2087
  id: index,
2087
2088
  'data-coreui-target': '',
2088
- ...(state.active === index && { class: 'active' }),
2089
+ ...(active.value === index && { class: 'active' }),
2089
2090
  onClick: () => handleIndicatorClick(index),
2090
2091
  });
2091
2092
  })),
2092
- h$1('div', { class: 'carousel-inner' }, state.items.map((item, index) => {
2093
+ h$1('div', { class: 'carousel-inner' }, items.value.map((item, index) => {
2093
2094
  return h$1(item, {
2094
- active: state.active === index ? true : false,
2095
- direction: state.direction,
2095
+ active: active.value === index ? true : false,
2096
+ direction: direction.value,
2096
2097
  });
2097
2098
  })),
2098
2099
  props.controls && [
@@ -4811,6 +4812,12 @@ const CFormCheck = defineComponent({
4811
4812
  type: [Boolean, String],
4812
4813
  value: undefined,
4813
4814
  },
4815
+ /**
4816
+ * Put checkboxes or radios on the opposite side.
4817
+ *
4818
+ * @sinve 4.8.0
4819
+ */
4820
+ reverse: Boolean,
4814
4821
  /**
4815
4822
  * Display validation feedback in a styled tooltip.
4816
4823
  *
@@ -4853,6 +4860,7 @@ const CFormCheck = defineComponent({
4853
4860
  'form-check',
4854
4861
  {
4855
4862
  'form-check-inline': props.inline,
4863
+ 'form-check-reverse': props.reverse,
4856
4864
  'is-invalid': props.invalid,
4857
4865
  'is-valid': props.valid,
4858
4866
  },
@@ -5550,6 +5558,12 @@ const CFormSwitch = defineComponent({
5550
5558
  type: [Boolean, String],
5551
5559
  value: undefined,
5552
5560
  },
5561
+ /**
5562
+ * Put checkboxes or radios on the opposite side.
5563
+ *
5564
+ * @sinve 4.8.0
5565
+ */
5566
+ reverse: Boolean,
5553
5567
  /**
5554
5568
  * Size the component large or extra large. Works only with `switch`.
5555
5569
  *
@@ -5597,6 +5611,7 @@ const CFormSwitch = defineComponent({
5597
5611
  class: [
5598
5612
  'form-check form-switch',
5599
5613
  {
5614
+ 'form-check-reverse': props.reverse,
5600
5615
  [`form-switch-${props.size}`]: props.size,
5601
5616
  'is-invalid': props.invalid,
5602
5617
  'is-valid': props.valid,