@coreui/vue-pro 4.8.2 → 4.9.0-beta.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.
Files changed (226) hide show
  1. package/README.md +1 -1
  2. package/dist/components/accordion/CAccordion.d.ts +1 -1
  3. package/dist/components/accordion/CAccordionBody.d.ts +1 -1
  4. package/dist/components/accordion/CAccordionButton.d.ts +1 -1
  5. package/dist/components/accordion/CAccordionHeader.d.ts +1 -1
  6. package/dist/components/accordion/CAccordionItem.d.ts +1 -1
  7. package/dist/components/alert/CAlert.d.ts +1 -1
  8. package/dist/components/alert/CAlertHeading.d.ts +1 -1
  9. package/dist/components/alert/CAlertLink.d.ts +1 -1
  10. package/dist/components/avatar/CAvatar.d.ts +1 -1
  11. package/dist/components/backdrop/CBackdrop.d.ts +1 -1
  12. package/dist/components/badge/CBadge.d.ts +1 -1
  13. package/dist/components/breadcrumb/CBreadcrumb.d.ts +1 -1
  14. package/dist/components/breadcrumb/CBreadcrumbItem.d.ts +1 -1
  15. package/dist/components/button/CButton.d.ts +1 -1
  16. package/dist/components/button-group/CButtonGroup.d.ts +1 -1
  17. package/dist/components/button-group/CButtonToolbar.d.ts +1 -1
  18. package/dist/components/calendar/CCalendar.d.ts +33 -1
  19. package/dist/components/callout/CCallout.d.ts +1 -1
  20. package/dist/components/card/CCard.d.ts +1 -1
  21. package/dist/components/card/CCardBody.d.ts +1 -1
  22. package/dist/components/card/CCardFooter.d.ts +1 -1
  23. package/dist/components/card/CCardGroup.d.ts +1 -1
  24. package/dist/components/card/CCardHeader.d.ts +1 -1
  25. package/dist/components/card/CCardImage.d.ts +1 -1
  26. package/dist/components/card/CCardImageOverlay.d.ts +1 -1
  27. package/dist/components/card/CCardLink.d.ts +1 -1
  28. package/dist/components/card/CCardSubtitle.d.ts +1 -1
  29. package/dist/components/card/CCardText.d.ts +1 -1
  30. package/dist/components/card/CCardTitle.d.ts +1 -1
  31. package/dist/components/carousel/CCarousel.d.ts +1 -1
  32. package/dist/components/carousel/CCarouselCaption.d.ts +1 -1
  33. package/dist/components/carousel/CCarouselItem.d.ts +1 -1
  34. package/dist/components/close-button/CCloseButton.d.ts +1 -1
  35. package/dist/components/collapse/CCollapse.d.ts +1 -1
  36. package/dist/components/date-picker/CDatePicker.d.ts +35 -3
  37. package/dist/components/date-range-picker/CDateRangePicker.d.ts +89 -78
  38. package/dist/components/date-range-picker/utils.d.ts +1 -0
  39. package/dist/components/dropdown/CDropdown.d.ts +2 -2
  40. package/dist/components/dropdown/CDropdownDivider.d.ts +1 -1
  41. package/dist/components/dropdown/CDropdownHeader.d.ts +1 -1
  42. package/dist/components/dropdown/CDropdownItem.d.ts +1 -1
  43. package/dist/components/dropdown/CDropdownMenu.d.ts +1 -1
  44. package/dist/components/dropdown/CDropdownToggle.d.ts +1 -1
  45. package/dist/components/element-cover/CElementCover.d.ts +1 -1
  46. package/dist/components/footer/CFooter.d.ts +1 -1
  47. package/dist/components/form/CForm.d.ts +1 -1
  48. package/dist/components/form/CFormCheck.d.ts +10 -2
  49. package/dist/components/form/CFormControl.d.ts +2 -2
  50. package/dist/components/form/CFormControlValidation.d.ts +1 -1
  51. package/dist/components/form/CFormControlWrapper.d.ts +1 -1
  52. package/dist/components/form/CFormFeedback.d.ts +1 -1
  53. package/dist/components/form/CFormFloating.d.ts +1 -1
  54. package/dist/components/form/CFormInput.d.ts +12 -12
  55. package/dist/components/form/CFormLabel.d.ts +1 -1
  56. package/dist/components/form/CFormRange.d.ts +1 -1
  57. package/dist/components/form/CFormSelect.d.ts +1 -1
  58. package/dist/components/form/CFormSwitch.d.ts +1 -1
  59. package/dist/components/form/CFormText.d.ts +1 -1
  60. package/dist/components/form/CFormTextarea.d.ts +3 -3
  61. package/dist/components/form/CInputGroup.d.ts +1 -1
  62. package/dist/components/form/CInputGroupText.d.ts +1 -1
  63. package/dist/components/grid/CCol.d.ts +1 -1
  64. package/dist/components/grid/CContainer.d.ts +1 -1
  65. package/dist/components/grid/CRow.d.ts +1 -1
  66. package/dist/components/header/CHeader.d.ts +1 -1
  67. package/dist/components/header/CHeaderBrand.d.ts +1 -1
  68. package/dist/components/header/CHeaderDivider.d.ts +1 -1
  69. package/dist/components/header/CHeaderNav.d.ts +1 -1
  70. package/dist/components/header/CHeaderText.d.ts +1 -1
  71. package/dist/components/header/CHeaderToggler.d.ts +1 -1
  72. package/dist/components/image/CImage.d.ts +1 -1
  73. package/dist/components/link/CLink.d.ts +1 -1
  74. package/dist/components/list-group/CListGroup.d.ts +1 -1
  75. package/dist/components/list-group/CListGroupItem.d.ts +1 -1
  76. package/dist/components/loading-button/CLoadingButton.d.ts +1 -1
  77. package/dist/components/modal/CModal.d.ts +1 -1
  78. package/dist/components/modal/CModalBody.d.ts +1 -1
  79. package/dist/components/modal/CModalFooter.d.ts +1 -1
  80. package/dist/components/modal/CModalHeader.d.ts +1 -1
  81. package/dist/components/modal/CModalTitle.d.ts +1 -1
  82. package/dist/components/multi-select/CMultiSelect.d.ts +73 -59
  83. package/dist/components/multi-select/CMultiSelectNativeSelect.d.ts +9 -33
  84. package/dist/components/multi-select/CMultiSelectOptions.d.ts +12 -41
  85. package/dist/components/multi-select/CMultiSelectSelection.d.ts +6 -59
  86. package/dist/components/multi-select/types.d.ts +8 -3
  87. package/dist/components/multi-select/utils.d.ts +9 -4
  88. package/dist/components/nav/CNav.d.ts +1 -1
  89. package/dist/components/nav/CNavGroup.d.ts +1 -1
  90. package/dist/components/nav/CNavGroupItems.d.ts +1 -1
  91. package/dist/components/nav/CNavItem.d.ts +1 -1
  92. package/dist/components/nav/CNavLink.d.ts +1 -1
  93. package/dist/components/nav/CNavTitle.d.ts +1 -1
  94. package/dist/components/navbar/CNavbar.d.ts +1 -1
  95. package/dist/components/navbar/CNavbarBrand.d.ts +1 -1
  96. package/dist/components/navbar/CNavbarNav.d.ts +1 -1
  97. package/dist/components/navbar/CNavbarText.d.ts +1 -1
  98. package/dist/components/navbar/CNavbarToggler.d.ts +1 -1
  99. package/dist/components/offcanvas/COffcanvas.d.ts +1 -1
  100. package/dist/components/offcanvas/COffcanvasBody.d.ts +1 -1
  101. package/dist/components/offcanvas/COffcanvasHeader.d.ts +1 -1
  102. package/dist/components/offcanvas/COffcanvasTitle.d.ts +1 -1
  103. package/dist/components/pagination/CPagination.d.ts +1 -1
  104. package/dist/components/pagination/CPaginationItem.d.ts +1 -1
  105. package/dist/components/picker/CPicker.d.ts +57 -7
  106. package/dist/components/placeholder/CPlaceholder.d.ts +1 -1
  107. package/dist/components/popover/CPopover.d.ts +2 -2
  108. package/dist/components/progress/CProgress.d.ts +1 -1
  109. package/dist/components/progress/CProgressBar.d.ts +1 -1
  110. package/dist/components/sidebar/CSidebar.d.ts +1 -1
  111. package/dist/components/sidebar/CSidebarBrand.d.ts +1 -1
  112. package/dist/components/sidebar/CSidebarFooter.d.ts +1 -1
  113. package/dist/components/sidebar/CSidebarHeader.d.ts +1 -1
  114. package/dist/components/sidebar/CSidebarNav.d.ts +1 -1
  115. package/dist/components/sidebar/CSidebarToggler.d.ts +1 -1
  116. package/dist/components/smart-pagination/CSmartPagination.d.ts +1 -1
  117. package/dist/components/smart-table/CSmartTable.d.ts +20 -56
  118. package/dist/components/smart-table/CSmartTableBody.d.ts +1 -1
  119. package/dist/components/smart-table/CSmartTableCleaner.d.ts +1 -1
  120. package/dist/components/smart-table/CSmartTableFilter.d.ts +1 -1
  121. package/dist/components/smart-table/CSmartTableHead.d.ts +10 -1
  122. package/dist/components/smart-table/CSmartTableItemsPerPageSelector.d.ts +1 -1
  123. package/dist/components/smart-table/types.d.ts +12 -0
  124. package/dist/components/smart-table/utils.d.ts +12 -2
  125. package/dist/components/spinner/CSpinner.d.ts +1 -1
  126. package/dist/components/table/CTable.d.ts +1 -1
  127. package/dist/components/table/CTableBody.d.ts +1 -1
  128. package/dist/components/table/CTableCaption.d.ts +1 -1
  129. package/dist/components/table/CTableDataCell.d.ts +1 -1
  130. package/dist/components/table/CTableFoot.d.ts +1 -1
  131. package/dist/components/table/CTableHead.d.ts +1 -1
  132. package/dist/components/table/CTableHeaderCell.d.ts +1 -1
  133. package/dist/components/table/CTableRow.d.ts +1 -1
  134. package/dist/components/tabs/CTabContent.d.ts +1 -1
  135. package/dist/components/tabs/CTabPane.d.ts +1 -1
  136. package/dist/components/time-picker/CTimePicker.d.ts +1 -1
  137. package/dist/components/time-picker/CTimePickerRollCol.d.ts +1 -1
  138. package/dist/components/toast/CToast.d.ts +1 -1
  139. package/dist/components/toast/CToastBody.d.ts +1 -1
  140. package/dist/components/toast/CToastClose.d.ts +1 -1
  141. package/dist/components/toast/CToastHeader.d.ts +1 -1
  142. package/dist/components/toast/CToaster.d.ts +1 -1
  143. package/dist/components/tooltip/CTooltip.d.ts +2 -2
  144. package/dist/components/virtual-scroller/CVirtualScroller.d.ts +1 -1
  145. package/dist/components/widgets/CWidgetStatsA.d.ts +1 -1
  146. package/dist/components/widgets/CWidgetStatsB.d.ts +1 -1
  147. package/dist/components/widgets/CWidgetStatsC.d.ts +1 -1
  148. package/dist/components/widgets/CWidgetStatsD.d.ts +1 -1
  149. package/dist/components/widgets/CWidgetStatsE.d.ts +1 -1
  150. package/dist/components/widgets/CWidgetStatsF.d.ts +1 -1
  151. package/dist/composables/index.d.ts +2 -0
  152. package/dist/composables/useColorModes.d.ts +5 -0
  153. package/dist/directives/index.d.ts +1 -1
  154. package/dist/directives/v-c-visible.d.ts +1 -1
  155. package/dist/index.d.ts +2 -1
  156. package/dist/index.es.js +4224 -4159
  157. package/dist/index.es.js.map +1 -1
  158. package/dist/index.js +4226 -4160
  159. package/dist/index.js.map +1 -1
  160. package/dist/utils/getUID.d.ts +2 -0
  161. package/dist/utils/index.d.ts +4 -1
  162. package/dist/utils/isObjectInArray.d.ts +2 -0
  163. package/dist/utils/isRTL.d.ts +2 -0
  164. package/package.json +11 -11
  165. package/src/components/accordion/CAccordionItem.ts +2 -2
  166. package/src/components/backdrop/CBackdrop.ts +1 -1
  167. package/src/components/calendar/CCalendar.ts +111 -49
  168. package/src/components/carousel/CCarousel.ts +7 -7
  169. package/src/components/date-picker/CDatePicker.ts +16 -1
  170. package/src/components/date-range-picker/CDateRangePicker.ts +179 -128
  171. package/src/components/date-range-picker/utils.ts +49 -0
  172. package/src/components/dropdown/CDropdown.ts +34 -31
  173. package/src/components/dropdown/CDropdownMenu.ts +1 -1
  174. package/src/components/dropdown/CDropdownToggle.ts +1 -1
  175. package/src/components/element-cover/CElementCover.ts +1 -0
  176. package/src/components/form/CFormCheck.ts +10 -4
  177. package/src/components/form/CFormInput.ts +2 -2
  178. package/src/components/form/CFormLabel.ts +1 -1
  179. package/src/components/form/CFormSelect.ts +1 -1
  180. package/src/components/grid/CCol.ts +1 -1
  181. package/src/components/grid/CContainer.ts +1 -1
  182. package/src/components/header/CHeader.ts +1 -1
  183. package/src/components/modal/CModal.ts +1 -0
  184. package/src/components/multi-select/CMultiSelect.ts +337 -144
  185. package/src/components/multi-select/CMultiSelectNativeSelect.ts +8 -15
  186. package/src/components/multi-select/CMultiSelectOptions.ts +32 -39
  187. package/src/components/multi-select/CMultiSelectSelection.ts +24 -40
  188. package/src/components/multi-select/types.ts +10 -4
  189. package/src/components/multi-select/utils.ts +71 -37
  190. package/src/components/nav/CNavGroup.ts +4 -0
  191. package/src/components/navbar/CNavbar.ts +1 -1
  192. package/src/components/navbar/CNavbarBrand.ts +1 -1
  193. package/src/components/offcanvas/COffcanvas.ts +3 -2
  194. package/src/components/pagination/CPaginationItem.ts +1 -1
  195. package/src/components/picker/CPicker.ts +106 -157
  196. package/src/components/popover/CPopover.ts +18 -2
  197. package/src/components/props.ts +2 -6
  198. package/src/components/sidebar/CSidebar.ts +3 -2
  199. package/src/components/smart-table/CSmartTable.ts +45 -52
  200. package/src/components/smart-table/CSmartTableBody.ts +5 -3
  201. package/src/components/smart-table/CSmartTableHead.ts +41 -14
  202. package/src/components/smart-table/types.ts +13 -0
  203. package/src/components/smart-table/utils.ts +119 -21
  204. package/src/components/spinner/CSpinner.ts +4 -2
  205. package/src/components/table/CTable.ts +19 -18
  206. package/src/components/table/types.ts +19 -19
  207. package/src/components/time-picker/CTimePicker.ts +216 -125
  208. package/src/components/toast/CToast.ts +1 -1
  209. package/src/components/tooltip/CTooltip.ts +19 -3
  210. package/src/components/virtual-scroller/CVirtualScroller.ts +10 -8
  211. package/src/components/widgets/CWidgetStatsA.ts +1 -1
  212. package/src/components/widgets/CWidgetStatsB.ts +1 -1
  213. package/src/components/widgets/CWidgetStatsC.ts +1 -1
  214. package/src/components/widgets/CWidgetStatsE.ts +1 -1
  215. package/src/components/widgets/CWidgetStatsF.ts +1 -1
  216. package/src/composables/index.ts +3 -0
  217. package/src/composables/useColorModes.ts +57 -0
  218. package/src/directives/index.ts +1 -1
  219. package/src/directives/v-c-popover.ts +9 -13
  220. package/src/directives/v-c-tooltip.ts +8 -12
  221. package/src/directives/v-c-visible.ts +1 -1
  222. package/src/index.ts +8 -29
  223. package/src/utils/getUID.ts +9 -0
  224. package/src/utils/index.ts +4 -1
  225. package/src/utils/isObjectInArray.ts +14 -0
  226. package/src/utils/isRTL.ts +13 -0
@@ -1,4 +1,4 @@
1
- import { defineComponent, h, PropType } from 'vue'
1
+ import { computed, defineComponent, h, PropType } from 'vue'
2
2
 
3
3
  import { CFormCheck, CFormInput } from '../form/'
4
4
  import { CTableFoot, CTableHead, CTableHeaderCell, CTableRow } from '../table/'
@@ -6,6 +6,8 @@ import { CTableFoot, CTableHead, CTableHeaderCell, CTableRow } from '../table/'
6
6
  import {
7
7
  getColumnKey,
8
8
  getColumnLabel,
9
+ getColumnGroups,
10
+ getColumns,
9
11
  getColumnSorterState,
10
12
  getColumnValues,
11
13
  getTableHeaderCellProps,
@@ -35,10 +37,17 @@ const CSmartTableHead = defineComponent({
35
37
  selectable: Boolean,
36
38
  selectAll: [Boolean, Object] as PropType<boolean | { external?: boolean }>,
37
39
  selectedAll: [Boolean, String],
40
+ showGroups: {
41
+ type: Boolean,
42
+ default: true,
43
+ },
38
44
  sorterState: Object as PropType<SorterValue>,
39
45
  },
40
46
  emits: ['customFilterChange', 'filterInput', 'filterChange', 'selectAllChecked', 'sortClick'],
41
47
  setup(props, { slots, emit }) {
48
+ const columns = computed(() => getColumns(props.columns))
49
+ const groups = computed(() => getColumnGroups(props.columns))
50
+
42
51
  const columnSorterIcon = (column: Column | string) => {
43
52
  if (getColumnSorterState(getColumnKey(column), props.sorterState) === 0) {
44
53
  return h(
@@ -73,6 +82,24 @@ const CSmartTableHead = defineComponent({
73
82
  {},
74
83
  {
75
84
  default: () => [
85
+ props.showGroups &&
86
+ groups.value &&
87
+ groups.value.length > 0 &&
88
+ groups.value.map((row) => [
89
+ h(CTableRow, {}, () => [
90
+ props.selectable && h(CTableHeaderCell),
91
+ row.map((cell) =>
92
+ h(
93
+ CTableHeaderCell,
94
+ {
95
+ colspan: cell.colspan,
96
+ ...getTableHeaderCellProps(cell),
97
+ },
98
+ () => cell.label,
99
+ ),
100
+ ),
101
+ ]),
102
+ ]),
76
103
  h(
77
104
  CTableRow,
78
105
  {},
@@ -81,14 +108,14 @@ const CSmartTableHead = defineComponent({
81
108
  props.selectable &&
82
109
  h(CTableHeaderCell, {}, () =>
83
110
  h(CFormCheck, {
84
- checked: typeof props.selectedAll === 'boolean' ? props.selectAll : false,
111
+ checked: typeof props.selectedAll === 'boolean' ? props.selectedAll : false,
85
112
  indeterminate: props.selectedAll === 'indeterminate' ? true : false,
86
113
  onChange: () => {
87
114
  emit('selectAllChecked')
88
115
  },
89
116
  }),
90
117
  ),
91
- props.columns.map((column, index: number) =>
118
+ columns.value.map((column, index: number) =>
92
119
  h(
93
120
  CTableHeaderCell,
94
121
  {
@@ -108,11 +135,11 @@ const CSmartTableHead = defineComponent({
108
135
  getColumnLabel(column),
109
136
  ),
110
137
  props.columnSorter &&
111
- (typeof column !== 'object'
112
- ? true
113
- : typeof column.sorter === 'undefined'
114
- ? true
115
- : column.sorter) &&
138
+ (typeof column === 'object'
139
+ ? typeof column.sorter === 'undefined'
140
+ ? true
141
+ : column.sorter
142
+ : true) &&
116
143
  columnSorterIcon(column),
117
144
  ],
118
145
  },
@@ -128,7 +155,7 @@ const CSmartTableHead = defineComponent({
128
155
  {
129
156
  default: () => [
130
157
  props.selectable && h(CTableHeaderCell),
131
- props.columns.map((column: Column | string) =>
158
+ columns.value.map((column: Column | string) =>
132
159
  h(
133
160
  CTableHeaderCell,
134
161
  {
@@ -137,11 +164,11 @@ const CSmartTableHead = defineComponent({
137
164
  {
138
165
  default: () =>
139
166
  (
140
- typeof column !== 'object'
141
- ? true
142
- : typeof column.filter === 'undefined'
143
- ? true
144
- : column.filter
167
+ typeof column === 'object'
168
+ ? column.filter === undefined
169
+ ? true
170
+ : column.filter
171
+ : true
145
172
  )
146
173
  ? typeof column !== 'string' && typeof column.filter === 'function'
147
174
  ? column.filter(
@@ -1,7 +1,9 @@
1
1
  import { VNode } from 'vue'
2
2
 
3
3
  export type Column = {
4
+ children?: Column[]
4
5
  filter?: boolean | ((values: any[], onChange: (value: any) => void) => VNode)
6
+ group?: string
5
7
  key: string
6
8
  label?: string
7
9
  sorter?: boolean
@@ -23,6 +25,17 @@ export type FooterItem = {
23
25
  _props?: any
24
26
  }
25
27
 
28
+ export type Group = {
29
+ children?: Group[] | Column[]
30
+ colspan?: number
31
+ deep?: number
32
+ group?: string
33
+ key: string
34
+ label?: string
35
+ _style?: any
36
+ _props?: any
37
+ }
38
+
26
39
  export type Item = {
27
40
  [key: string]: number | string | any
28
41
  _cellProps?: any
@@ -2,6 +2,7 @@ import type {
2
2
  Column,
3
3
  ColumnFilter,
4
4
  ColumnFilterValue,
5
+ Group,
5
6
  Item,
6
7
  Sorter,
7
8
  SorterValue,
@@ -77,13 +78,123 @@ export const getColumnLabel = (column: Column | string) =>
77
78
  : pretifyName(column.key)
78
79
  : pretifyName(column)
79
80
 
80
- export const getColumnNames = (columns: (string | Column)[] | undefined, items: Item[]) =>
81
- columns
82
- ? columns.map((column: Column | string) => {
83
- if (typeof column === 'object') return column.key
84
- else return column
81
+ export const getColumnNames = (
82
+ columns: (string | Column)[] | undefined,
83
+ items: Item[],
84
+ ): string[] => {
85
+ if (columns) {
86
+ const _columns = []
87
+
88
+ for (const column of columns) {
89
+ if (typeof column === 'object' && column.children) {
90
+ _columns.push(...getColumnNames(column.children, []))
91
+ continue
92
+ }
93
+
94
+ typeof column === 'object' ? _columns.push(column.key) : _columns.push(column)
95
+ }
96
+
97
+ return _columns
98
+ }
99
+
100
+ return getColumnNamesFromItems(items)
101
+ }
102
+
103
+ export const getColumns = (_columns: (Column | Group | string)[]): (Column | string)[] => {
104
+ const columns = []
105
+
106
+ for (const column of _columns) {
107
+ if (typeof column === 'object' && column.group && column.children) {
108
+ columns.push(...getColumns(column.children))
109
+ continue
110
+ }
111
+
112
+ if (typeof column === 'object' && column.children) {
113
+ columns.push(...getColumns(column.children))
114
+ }
115
+
116
+ columns.push(column)
117
+ }
118
+
119
+ return columns
120
+ }
121
+
122
+ export const countColumns = (columns: Column[], counter = 0) => {
123
+ let _counter = counter
124
+ for (const column of columns) {
125
+ if (!column.children) {
126
+ _counter++
127
+ }
128
+
129
+ if (column.children) {
130
+ _counter = countColumns(column.children, _counter)
131
+ }
132
+ }
133
+
134
+ return _counter
135
+ }
136
+
137
+ export const getColumnGroups = (columns: (string | Column)[] | undefined) => {
138
+ const groups = []
139
+
140
+ const traverseColumns = (column: Column, deep = 0, colSpan = 0): Group[] => {
141
+ const groups = []
142
+
143
+ if (column.children) {
144
+ for (const _column of column.children) {
145
+ if (!_column.group) {
146
+ colSpan++
147
+ }
148
+ groups.push(...traverseColumns(_column, deep + 1, colSpan))
149
+ }
150
+ }
151
+
152
+ if (typeof column === 'object' && column.group) {
153
+ const { children, group, ...rest } = column
154
+ groups.push({
155
+ deep: deep,
156
+ label: group,
157
+ ...(children && { colspan: countColumns(children) }),
158
+ ...rest,
85
159
  })
86
- : getColumnNamesFromItems(items)
160
+ }
161
+
162
+ return groups
163
+ }
164
+
165
+ if (columns) {
166
+ for (const column of columns) {
167
+ if (typeof column === 'object' && column.group) {
168
+ const objects = traverseColumns(column)
169
+
170
+ if (objects) {
171
+ for (const object of objects) {
172
+ const { deep, ...rest } = object
173
+
174
+ if (deep === undefined) {
175
+ continue
176
+ }
177
+
178
+ for (let i = 0; i < deep; i++) {
179
+ if (groups[i]) {
180
+ continue
181
+ }
182
+
183
+ groups.push([])
184
+ }
185
+
186
+ if (groups[deep]) {
187
+ groups[deep].push(rest)
188
+ } else {
189
+ groups.push([rest])
190
+ }
191
+ }
192
+ }
193
+ }
194
+ }
195
+ }
196
+ return groups
197
+ }
87
198
 
88
199
  export const getColumnNamesFromItems = (items: Item[]) =>
89
200
  Object.keys(items[0] || {}).filter((el) => el.charAt(0) !== '_')
@@ -132,7 +243,7 @@ export const getTableHeaderCellStyles = (
132
243
  if (
133
244
  columnSorter &&
134
245
  (typeof column !== 'object' ||
135
- (typeof column === 'object' && (typeof column.sorter === 'undefined' || column.sorter)))
246
+ (typeof column === 'object' && (column.sorter === undefined || column.sorter)))
136
247
  ) {
137
248
  style['cursor'] = 'pointer'
138
249
  }
@@ -143,19 +254,6 @@ export const getTableHeaderCellStyles = (
143
254
  return style
144
255
  }
145
256
 
146
- export const isObjectInArray = <T>(array: T[], item: T, ignore: string[] = []) =>
147
- array.some((_item: T) => {
148
- let result = true
149
- for (const key in item) {
150
- if (!ignore.includes(key) && item[key] !== _item[key]) {
151
- result = false
152
- break
153
- }
154
- }
155
-
156
- return result
157
- })
158
-
159
257
  export const isSortable = (
160
258
  i: number,
161
259
  columns: (string | Column)[] | undefined,
@@ -170,7 +268,7 @@ export const isSortable = (
170
268
  columnSorter &&
171
269
  (!columns ||
172
270
  typeof column !== 'object' ||
173
- (typeof column === 'object' && (typeof column.sorter === 'undefined' || column.sorter))) &&
271
+ (typeof column === 'object' && (column.sorter === undefined || column.sorter))) &&
174
272
  isDataColumn
175
273
  )
176
274
  }
@@ -68,8 +68,10 @@ const CSpinner = defineComponent({
68
68
  {
69
69
  class: [
70
70
  `spinner-${props.variant}`,
71
- `text-${props.color}`,
72
- props.size && `spinner-${props.variant}-${props.size}`,
71
+ {
72
+ [`spinner-${props.variant}-${props.size}`]: props.size,
73
+ [`text-${props.color}`]: props.color,
74
+ },
73
75
  ],
74
76
  role: 'status',
75
77
  },
@@ -236,24 +236,25 @@ const CTable = defineComponent({
236
236
  },
237
237
  {
238
238
  default: () => [
239
- columnNames.value && columnNames.value.map(
240
- (colName: string) =>
241
- item[colName] &&
242
- h(
243
- CTableDataCell,
244
- {
245
- ...(item._cellProps &&
246
- item._cellProps['all'] && { ...item._cellProps['all'] }),
247
- ...(item._cellProps &&
248
- item._cellProps[colName] && {
249
- ...item._cellProps[colName],
250
- }),
251
- },
252
- {
253
- default: () => item[colName],
254
- },
255
- ),
256
- ),
239
+ columnNames.value &&
240
+ columnNames.value.map(
241
+ (colName: string) =>
242
+ item[colName] !== undefined &&
243
+ h(
244
+ CTableDataCell,
245
+ {
246
+ ...(item._cellProps &&
247
+ item._cellProps['all'] && { ...item._cellProps['all'] }),
248
+ ...(item._cellProps &&
249
+ item._cellProps[colName] && {
250
+ ...item._cellProps[colName],
251
+ }),
252
+ },
253
+ {
254
+ default: () => item[colName],
255
+ },
256
+ ),
257
+ ),
257
258
  ],
258
259
  },
259
260
  ),
@@ -1,20 +1,20 @@
1
1
  export type Column = {
2
- label?: string
3
- key: string
4
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
- _style?: any
6
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
- _props?: any
8
- }
9
-
10
- export type FooterItem = {
11
- label?: string
12
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
- _props?: any
14
- }
15
-
16
- export type Item = {
17
- [key: string]: number | string | any
18
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
- _props?: any
20
- }
2
+ label?: string
3
+ key: string
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
+ _style?: any
6
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
+ _props?: any
8
+ }
9
+
10
+ export type FooterItem = {
11
+ label?: string
12
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
+ _props?: any
14
+ }
15
+
16
+ export type Item = {
17
+ [key: string]: number | string | any
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
+ _props?: any
20
+ }