@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.
Files changed (32) hide show
  1. package/README.md +1 -1
  2. package/dist/components/button/CButton.d.ts +29 -2
  3. package/dist/components/dropdown/CDropdown.d.ts +25 -0
  4. package/dist/components/dropdown/CDropdownToggle.d.ts +35 -1
  5. package/dist/components/smart-table/CSmartTable.d.ts +0 -3
  6. package/dist/components/smart-table/CSmartTableBody.d.ts +0 -11
  7. package/dist/components/smart-table/CSmartTableHead.d.ts +1 -1
  8. package/dist/index.es.js +206 -101
  9. package/dist/index.es.js.map +1 -1
  10. package/dist/index.js +205 -100
  11. package/dist/index.js.map +1 -1
  12. package/package.json +9 -9
  13. package/src/components/accordion/CAccordionButton.ts +1 -0
  14. package/src/components/accordion/__tests__/__snapshots__/CAccordionButton.spec.ts.snap +1 -1
  15. package/src/components/accordion/__tests__/__snapshots__/CAccordionHeader.spec.ts.snap +1 -1
  16. package/src/components/button/CButton.ts +30 -1
  17. package/src/components/button/__tests__/__snapshots__/CButton.spec.ts.snap +1 -1
  18. package/src/components/close-button/CCloseButton.ts +4 -1
  19. package/src/components/dropdown/CDropdown.ts +48 -49
  20. package/src/components/dropdown/CDropdownMenu.ts +50 -7
  21. package/src/components/dropdown/CDropdownToggle.ts +78 -29
  22. package/src/components/dropdown/__tests__/CDropdownMenu.spec.ts +7 -7
  23. package/src/components/dropdown/__tests__/CDropdownToggle.spec.ts +4 -5
  24. package/src/components/dropdown/__tests__/__snapshots__/CDropdownToggle.spec.ts.snap +2 -2
  25. package/src/components/form/CFormCheck.ts +2 -1
  26. package/src/components/form/CFormSwitch.ts +1 -7
  27. package/src/components/form/__tests__/__snapshots__/CFormCheck.spec.ts.snap +2 -8
  28. package/src/components/modal/__tests__/__snapshots__/CModal.spec.ts.snap +2 -1
  29. package/src/components/sidebar/__tests__/__snapshots__/CSidebar.spec.ts.snap +8 -2
  30. package/src/components/smart-table/CSmartTable.ts +18 -15
  31. package/src/components/smart-table/CSmartTableBody.ts +0 -5
  32. package/src/components/toast/__tests__/__snapshots__/CToastClose.spec.ts.snap +1 -1
@@ -7,7 +7,8 @@ exports[`Customize CModal component renders correctly 1`] = `
7
7
  <div class=\\"modal-content bazinga\\">Default slot</div>
8
8
  </div>
9
9
  </div>
10
- </transition-stub>"
10
+ </transition-stub>
11
+ <!---->"
11
12
  `;
12
13
 
13
14
  exports[`Loads and display CModal component renders correctly 1`] = `
@@ -1,5 +1,11 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Customize CSidebar component renders correctly 1`] = `"<div class=\\"sidebar sidebar-narrow sidebar-overlaid sidebar-fixed sidebar-xl sidebar-narrow-unfoldable\\">Default slot</div>"`;
3
+ exports[`Customize CSidebar component renders correctly 1`] = `
4
+ "<div class=\\"sidebar sidebar-narrow sidebar-overlaid sidebar-fixed sidebar-xl sidebar-narrow-unfoldable\\">Default slot</div>
5
+ <!---->"
6
+ `;
4
7
 
5
- exports[`Loads and display CSidebar component renders correctly 1`] = `"<div class=\\"sidebar hide\\">Default slot</div>"`;
8
+ exports[`Loads and display CSidebar component renders correctly 1`] = `
9
+ "<div class=\\"sidebar hide\\">Default slot</div>
10
+ <!---->"
11
+ `;
@@ -94,7 +94,6 @@ const CSmartTable = defineComponent({
94
94
  */
95
95
  columns: {
96
96
  type: Array as PropType<Column[] | string[]>,
97
- default: () => [],
98
97
  required: false,
99
98
  },
100
99
  /**
@@ -422,7 +421,7 @@ const CSmartTable = defineComponent({
422
421
  // functions
423
422
 
424
423
  const isSortable = (i: number): boolean | undefined => {
425
- const isDataColumn = itemsDataColumns.value.includes(rawColumnNames[i])
424
+ const isDataColumn = itemsDataColumns.value.includes(rawColumnNames.value[i])
426
425
  let column
427
426
  if (props.columns) column = props.columns[i]
428
427
  return (
@@ -538,16 +537,22 @@ const CSmartTable = defineComponent({
538
537
 
539
538
  // computed
540
539
 
541
- const genCols = Object.keys(items.value[0] || {}).filter((el) => el.charAt(0) !== '_')
540
+ const genCols = computed(() =>
541
+ Object.keys(items.value[0] || {}).filter((el) => el.charAt(0) !== '_'),
542
+ )
542
543
 
543
- const rawColumnNames = props.columns
544
- ? props.columns.map((column: Column | string) => {
545
- if (typeof column === 'object') return column.key
546
- else return column
547
- })
548
- : genCols //! || el
544
+ const rawColumnNames = computed(() =>
545
+ props.columns
546
+ ? props.columns.map((column: Column | string) => {
547
+ if (typeof column === 'object') return column.key
548
+ else return column
549
+ })
550
+ : genCols.value,
551
+ ) //! || el
549
552
 
550
- const itemsDataColumns = computed(() => rawColumnNames.filter((name) => genCols.includes(name)))
553
+ const itemsDataColumns = computed(() =>
554
+ rawColumnNames.value.filter((name) => genCols.value.includes(name)),
555
+ )
551
556
 
552
557
  // variables
553
558
 
@@ -708,7 +713,7 @@ const CSmartTable = defineComponent({
708
713
  ...props.tableHeadProps,
709
714
  columnFilter: props.columnFilter,
710
715
  columnFilterValue: columnFilterState.value,
711
- columns: props.columns,
716
+ columns: props.columns ? props.columns : rawColumnNames.value,
712
717
  columnSorter: props.columnSorter,
713
718
  selectable: props.selectable,
714
719
  selectAll: selectedAll.value,
@@ -762,7 +767,6 @@ const CSmartTable = defineComponent({
762
767
  currentItems: currentItems.value,
763
768
  firstItemOnActivePageIndex: firstItemOnActivePageIndex.value,
764
769
  noItemsLabel: props.noItemsLabel,
765
- columns: props.columns,
766
770
  scopedSlots: slots,
767
771
  selectable: props.selectable,
768
772
  onRowChecked: (id: number, value: boolean) => handleRowChecked(id, value),
@@ -772,7 +776,7 @@ const CSmartTable = defineComponent({
772
776
  columnName: string,
773
777
  event: MouseEvent | boolean,
774
778
  ) => handleRowClick(item, index, columnName, event),
775
- rawColumnNames: rawColumnNames,
779
+ rawColumnNames: rawColumnNames.value,
776
780
  clickableRows: props.clickableRows,
777
781
  ...props.tableBodyProps,
778
782
  }),
@@ -782,7 +786,7 @@ const CSmartTable = defineComponent({
782
786
  ...props.tableFootProps,
783
787
  columnFilter: false,
784
788
  columnSorter: false,
785
- columns: props.columns,
789
+ columns: props.columns ? props.columns : rawColumnNames.value,
786
790
  selectable: props.selectable,
787
791
  selectAll: selectedAll.value,
788
792
  onFilterInput: (key: string, value: string) =>
@@ -822,7 +826,6 @@ const CSmartTable = defineComponent({
822
826
  pages: numberOfPages.value,
823
827
  activePage: activePage.value,
824
828
  onActivePageChange: handleActivePageChange,
825
- limit: itemsPerPage.value,
826
829
  })
827
830
  : '',
828
831
  ),
@@ -27,11 +27,6 @@ const CSmartTableBody = defineComponent({
27
27
  default: undefined,
28
28
  require: false,
29
29
  },
30
- columns: {
31
- type: Array,
32
- default: () => [],
33
- require: true,
34
- },
35
30
  rawColumnNames: {
36
31
  type: Array as PropType<string[]>,
37
32
  default: () => [],
@@ -1,5 +1,5 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Customize CToastClose component renders correctly 1`] = `"<button class=\\"btn btn-undefined\\">Default slot</button>"`;
3
+ exports[`Customize CToastClose component renders correctly 1`] = `"<button class=\\"btn btn-undefined\\" type=\\"button\\">Default slot</button>"`;
4
4
 
5
5
  exports[`Loads and display CToastClose component renders correctly 1`] = `"<button class=\\"btn btn-close\\" aria-label=\\"Close\\"></button>"`;