@coreui/vue-pro 4.1.2 → 4.1.3
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/smart-table/CSmartTable.d.ts +0 -3
- package/dist/index.es.js +9 -11
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +9 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/smart-table/CSmartTable.ts +19 -15
package/package.json
CHANGED
|
@@ -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 =
|
|
540
|
+
const genCols = computed(() =>
|
|
541
|
+
Object.keys(items.value[0] || {}).filter((el) => el.charAt(0) !== '_'),
|
|
542
|
+
)
|
|
542
543
|
|
|
543
|
-
const rawColumnNames =
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
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(() =>
|
|
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:
|
|
716
|
+
columns: rawColumnNames.value,
|
|
712
717
|
columnSorter: props.columnSorter,
|
|
713
718
|
selectable: props.selectable,
|
|
714
719
|
selectAll: selectedAll.value,
|
|
@@ -762,7 +767,7 @@ const CSmartTable = defineComponent({
|
|
|
762
767
|
currentItems: currentItems.value,
|
|
763
768
|
firstItemOnActivePageIndex: firstItemOnActivePageIndex.value,
|
|
764
769
|
noItemsLabel: props.noItemsLabel,
|
|
765
|
-
columns:
|
|
770
|
+
columns: rawColumnNames.value,
|
|
766
771
|
scopedSlots: slots,
|
|
767
772
|
selectable: props.selectable,
|
|
768
773
|
onRowChecked: (id: number, value: boolean) => handleRowChecked(id, value),
|
|
@@ -772,7 +777,7 @@ const CSmartTable = defineComponent({
|
|
|
772
777
|
columnName: string,
|
|
773
778
|
event: MouseEvent | boolean,
|
|
774
779
|
) => handleRowClick(item, index, columnName, event),
|
|
775
|
-
rawColumnNames: rawColumnNames,
|
|
780
|
+
rawColumnNames: rawColumnNames.value,
|
|
776
781
|
clickableRows: props.clickableRows,
|
|
777
782
|
...props.tableBodyProps,
|
|
778
783
|
}),
|
|
@@ -782,7 +787,7 @@ const CSmartTable = defineComponent({
|
|
|
782
787
|
...props.tableFootProps,
|
|
783
788
|
columnFilter: false,
|
|
784
789
|
columnSorter: false,
|
|
785
|
-
columns:
|
|
790
|
+
columns: rawColumnNames.value,
|
|
786
791
|
selectable: props.selectable,
|
|
787
792
|
selectAll: selectedAll.value,
|
|
788
793
|
onFilterInput: (key: string, value: string) =>
|
|
@@ -822,7 +827,6 @@ const CSmartTable = defineComponent({
|
|
|
822
827
|
pages: numberOfPages.value,
|
|
823
828
|
activePage: activePage.value,
|
|
824
829
|
onActivePageChange: handleActivePageChange,
|
|
825
|
-
limit: itemsPerPage.value,
|
|
826
830
|
})
|
|
827
831
|
: '',
|
|
828
832
|
),
|