@dataloop-ai/components 0.18.91 → 0.18.93
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/package.json
CHANGED
|
@@ -575,7 +575,7 @@
|
|
|
575
575
|
<dl-pagination
|
|
576
576
|
v-if="displayPagination"
|
|
577
577
|
v-bind="marginalsScope.pagination"
|
|
578
|
-
:total-items="
|
|
578
|
+
:total-items="totalItemsCount"
|
|
579
579
|
@update:rowsPerPage="
|
|
580
580
|
(v) => updatePagination(v, 'rowsPerPage')
|
|
581
581
|
"
|
|
@@ -680,7 +680,8 @@ export default defineComponent({
|
|
|
680
680
|
tableHeaderClass,
|
|
681
681
|
dense,
|
|
682
682
|
draggable,
|
|
683
|
-
virtualScroll
|
|
683
|
+
virtualScroll,
|
|
684
|
+
rows
|
|
684
685
|
} = toRefs(props)
|
|
685
686
|
|
|
686
687
|
const rootRef = ref<HTMLDivElement>(null)
|
|
@@ -794,6 +795,10 @@ export default defineComponent({
|
|
|
794
795
|
let resizableManager: ResizableManager | null = null
|
|
795
796
|
let tableEl: HTMLTableElement = null
|
|
796
797
|
|
|
798
|
+
const totalItemsCount = computed(() => {
|
|
799
|
+
return computedPagination.value.rowsNumber || rows.value.length
|
|
800
|
+
})
|
|
801
|
+
|
|
797
802
|
onMounted(() => {
|
|
798
803
|
tableEl = (rootRef.value as HTMLDivElement).querySelector(
|
|
799
804
|
'table.dl-table'
|
|
@@ -939,23 +944,22 @@ export default defineComponent({
|
|
|
939
944
|
)
|
|
940
945
|
|
|
941
946
|
const { computedFilterMethod } = useTableFilter(props, setPagination)
|
|
942
|
-
const rowsPropRef = toRef(props, 'rows')
|
|
943
947
|
|
|
944
948
|
const { isRowExpanded, setExpanded, updateExpanded } =
|
|
945
949
|
useTableRowExpand(props, emit)
|
|
946
950
|
|
|
947
951
|
const filteredSortedRows = computed(() => {
|
|
948
|
-
let
|
|
952
|
+
let filtered = rows.value as DlTableRow[]
|
|
949
953
|
|
|
950
|
-
if (
|
|
951
|
-
return rows
|
|
954
|
+
if (filtered.length === 0) {
|
|
955
|
+
return rows.value as DlTableRow[]
|
|
952
956
|
}
|
|
953
957
|
|
|
954
958
|
const { sortBy, descending } = computedPagination.value
|
|
955
959
|
|
|
956
960
|
if (props.filter) {
|
|
957
|
-
|
|
958
|
-
rows,
|
|
961
|
+
filtered = computedFilterMethod.value(
|
|
962
|
+
rows.value,
|
|
959
963
|
props.filter,
|
|
960
964
|
computedCols.value,
|
|
961
965
|
getCellValue
|
|
@@ -963,14 +967,14 @@ export default defineComponent({
|
|
|
963
967
|
}
|
|
964
968
|
|
|
965
969
|
if (columnToSort.value !== null) {
|
|
966
|
-
|
|
967
|
-
|
|
970
|
+
filtered = computedSortMethod.value(
|
|
971
|
+
rows.value === filtered ? filtered.slice() : filtered,
|
|
968
972
|
sortBy,
|
|
969
973
|
descending
|
|
970
974
|
)
|
|
971
975
|
}
|
|
972
976
|
|
|
973
|
-
return
|
|
977
|
+
return filtered
|
|
974
978
|
})
|
|
975
979
|
|
|
976
980
|
const filteredSortedRowsNumber = computed(
|
|
@@ -978,25 +982,32 @@ export default defineComponent({
|
|
|
978
982
|
)
|
|
979
983
|
|
|
980
984
|
const computedRows = computed(() => {
|
|
981
|
-
let
|
|
985
|
+
let filtered = filteredSortedRows.value
|
|
982
986
|
|
|
983
987
|
const { rowsPerPage } = computedPagination.value
|
|
984
988
|
|
|
985
989
|
if (rowsPerPage !== 0) {
|
|
986
|
-
if (firstRowIndex.value === 0 &&
|
|
987
|
-
if (
|
|
988
|
-
|
|
990
|
+
if (firstRowIndex.value === 0 && rows.value !== filtered) {
|
|
991
|
+
if (filtered.length > lastRowIndex.value) {
|
|
992
|
+
filtered = filtered.slice(0, lastRowIndex.value)
|
|
989
993
|
}
|
|
990
994
|
} else {
|
|
991
|
-
|
|
995
|
+
if (
|
|
996
|
+
filtered.length > computedPagination.value.rowsPerPage
|
|
997
|
+
) {
|
|
998
|
+
filtered = filtered.slice(
|
|
999
|
+
firstRowIndex.value,
|
|
1000
|
+
lastRowIndex.value
|
|
1001
|
+
)
|
|
1002
|
+
}
|
|
992
1003
|
}
|
|
993
1004
|
}
|
|
994
1005
|
|
|
995
|
-
return props.flatTreeData ? flatTreeData(
|
|
1006
|
+
return props.flatTreeData ? flatTreeData(filtered) : filtered
|
|
996
1007
|
})
|
|
997
1008
|
|
|
998
1009
|
const additionalClasses = computed(() => {
|
|
999
|
-
const classes = []
|
|
1010
|
+
const classes: string[] = []
|
|
1000
1011
|
|
|
1001
1012
|
if (hasDraggableRows.value === true) {
|
|
1002
1013
|
classes.push('dl-table--draggable-rows')
|
|
@@ -1055,7 +1066,7 @@ export default defineComponent({
|
|
|
1055
1066
|
() =>
|
|
1056
1067
|
multipleSelection.value === true &&
|
|
1057
1068
|
computedRows.value.length > 0 &&
|
|
1058
|
-
computedRows.value.length <
|
|
1069
|
+
computedRows.value.length < rows.value.length
|
|
1059
1070
|
)
|
|
1060
1071
|
|
|
1061
1072
|
function onMultipleSelectionSet(val: boolean) {
|
|
@@ -1393,7 +1404,8 @@ export default defineComponent({
|
|
|
1393
1404
|
groupOptions,
|
|
1394
1405
|
visibleColumnsState,
|
|
1395
1406
|
handleVisibleColumnsUpdate,
|
|
1396
|
-
computedVisibleCols
|
|
1407
|
+
computedVisibleCols,
|
|
1408
|
+
totalItemsCount
|
|
1397
1409
|
}
|
|
1398
1410
|
}
|
|
1399
1411
|
})
|
|
@@ -8,12 +8,16 @@ import { useTableFilterProps } from '../hooks/tableFilter'
|
|
|
8
8
|
import { useTableSortProps } from '../hooks/tableSort'
|
|
9
9
|
import { useTableColumnSelectionProps } from '../hooks/tableColumnSelection'
|
|
10
10
|
import { useTableRowSelectionProps } from '../hooks/tableRowSelection'
|
|
11
|
+
import { DlTableColumn, DlTableRow } from '../types'
|
|
11
12
|
|
|
12
13
|
export const props = {
|
|
13
|
-
columns: {
|
|
14
|
+
columns: {
|
|
15
|
+
type: Array as PropType<DlTableColumn[]>,
|
|
16
|
+
default: () => [] as DlTableColumn[]
|
|
17
|
+
},
|
|
14
18
|
rows: {
|
|
15
|
-
type: Array
|
|
16
|
-
default: () => [] as
|
|
19
|
+
type: Array as PropType<DlTableRow[]>,
|
|
20
|
+
default: () => [] as DlTableRow[]
|
|
17
21
|
},
|
|
18
22
|
rowKey: {
|
|
19
23
|
type: [String, Function],
|