@indico-data/design-system 2.60.10 → 2.60.11
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/lib/index.d.ts +1 -1
- package/lib/index.esm.js +87 -1
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +90 -0
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +10 -0
package/lib/index.js
CHANGED
|
@@ -24003,6 +24003,92 @@ function getCoreRowModel() {
|
|
|
24003
24003
|
}, getMemoOptions(table.options, 'debugTable', 'getRowModel', () => table._autoResetPageIndex()));
|
|
24004
24004
|
}
|
|
24005
24005
|
|
|
24006
|
+
function getSortedRowModel() {
|
|
24007
|
+
return table => memo(() => [table.getState().sorting, table.getPreSortedRowModel()], (sorting, rowModel) => {
|
|
24008
|
+
if (!rowModel.rows.length || !(sorting != null && sorting.length)) {
|
|
24009
|
+
return rowModel;
|
|
24010
|
+
}
|
|
24011
|
+
const sortingState = table.getState().sorting;
|
|
24012
|
+
const sortedFlatRows = [];
|
|
24013
|
+
|
|
24014
|
+
// Filter out sortings that correspond to non existing columns
|
|
24015
|
+
const availableSorting = sortingState.filter(sort => {
|
|
24016
|
+
var _table$getColumn;
|
|
24017
|
+
return (_table$getColumn = table.getColumn(sort.id)) == null ? void 0 : _table$getColumn.getCanSort();
|
|
24018
|
+
});
|
|
24019
|
+
const columnInfoById = {};
|
|
24020
|
+
availableSorting.forEach(sortEntry => {
|
|
24021
|
+
const column = table.getColumn(sortEntry.id);
|
|
24022
|
+
if (!column) return;
|
|
24023
|
+
columnInfoById[sortEntry.id] = {
|
|
24024
|
+
sortUndefined: column.columnDef.sortUndefined,
|
|
24025
|
+
invertSorting: column.columnDef.invertSorting,
|
|
24026
|
+
sortingFn: column.getSortingFn()
|
|
24027
|
+
};
|
|
24028
|
+
});
|
|
24029
|
+
const sortData = rows => {
|
|
24030
|
+
// This will also perform a stable sorting using the row index
|
|
24031
|
+
// if needed.
|
|
24032
|
+
const sortedData = rows.map(row => ({
|
|
24033
|
+
...row
|
|
24034
|
+
}));
|
|
24035
|
+
sortedData.sort((rowA, rowB) => {
|
|
24036
|
+
for (let i = 0; i < availableSorting.length; i += 1) {
|
|
24037
|
+
var _sortEntry$desc;
|
|
24038
|
+
const sortEntry = availableSorting[i];
|
|
24039
|
+
const columnInfo = columnInfoById[sortEntry.id];
|
|
24040
|
+
const sortUndefined = columnInfo.sortUndefined;
|
|
24041
|
+
const isDesc = (_sortEntry$desc = sortEntry == null ? void 0 : sortEntry.desc) != null ? _sortEntry$desc : false;
|
|
24042
|
+
let sortInt = 0;
|
|
24043
|
+
|
|
24044
|
+
// All sorting ints should always return in ascending order
|
|
24045
|
+
if (sortUndefined) {
|
|
24046
|
+
const aValue = rowA.getValue(sortEntry.id);
|
|
24047
|
+
const bValue = rowB.getValue(sortEntry.id);
|
|
24048
|
+
const aUndefined = aValue === undefined;
|
|
24049
|
+
const bUndefined = bValue === undefined;
|
|
24050
|
+
if (aUndefined || bUndefined) {
|
|
24051
|
+
if (sortUndefined === 'first') return aUndefined ? -1 : 1;
|
|
24052
|
+
if (sortUndefined === 'last') return aUndefined ? 1 : -1;
|
|
24053
|
+
sortInt = aUndefined && bUndefined ? 0 : aUndefined ? sortUndefined : -sortUndefined;
|
|
24054
|
+
}
|
|
24055
|
+
}
|
|
24056
|
+
if (sortInt === 0) {
|
|
24057
|
+
sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id);
|
|
24058
|
+
}
|
|
24059
|
+
|
|
24060
|
+
// If sorting is non-zero, take care of desc and inversion
|
|
24061
|
+
if (sortInt !== 0) {
|
|
24062
|
+
if (isDesc) {
|
|
24063
|
+
sortInt *= -1;
|
|
24064
|
+
}
|
|
24065
|
+
if (columnInfo.invertSorting) {
|
|
24066
|
+
sortInt *= -1;
|
|
24067
|
+
}
|
|
24068
|
+
return sortInt;
|
|
24069
|
+
}
|
|
24070
|
+
}
|
|
24071
|
+
return rowA.index - rowB.index;
|
|
24072
|
+
});
|
|
24073
|
+
|
|
24074
|
+
// If there are sub-rows, sort them
|
|
24075
|
+
sortedData.forEach(row => {
|
|
24076
|
+
var _row$subRows;
|
|
24077
|
+
sortedFlatRows.push(row);
|
|
24078
|
+
if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
|
|
24079
|
+
row.subRows = sortData(row.subRows);
|
|
24080
|
+
}
|
|
24081
|
+
});
|
|
24082
|
+
return sortedData;
|
|
24083
|
+
};
|
|
24084
|
+
return {
|
|
24085
|
+
rows: sortData(rowModel.rows),
|
|
24086
|
+
flatRows: sortedFlatRows,
|
|
24087
|
+
rowsById: rowModel.rowsById
|
|
24088
|
+
};
|
|
24089
|
+
}, getMemoOptions(table.options, 'debugTable', 'getSortedRowModel', () => table._autoResetPageIndex()));
|
|
24090
|
+
}
|
|
24091
|
+
|
|
24006
24092
|
/**
|
|
24007
24093
|
* react-table
|
|
24008
24094
|
*
|
|
@@ -43157,8 +43243,11 @@ exports.autoPlacement = autoPlacement;
|
|
|
43157
43243
|
exports.autoUpdate = autoUpdate$1;
|
|
43158
43244
|
exports.computePosition = computePosition$2;
|
|
43159
43245
|
exports.detectOverflow = detectOverflow$1;
|
|
43246
|
+
exports.flexRender = flexRender;
|
|
43160
43247
|
exports.flip = flip$2;
|
|
43248
|
+
exports.getCoreRowModel = getCoreRowModel;
|
|
43161
43249
|
exports.getOverflowAncestors = getOverflowAncestors$1;
|
|
43250
|
+
exports.getSortedRowModel = getSortedRowModel;
|
|
43162
43251
|
exports.hide = hide$1;
|
|
43163
43252
|
exports.inline = inline;
|
|
43164
43253
|
exports.limitShift = limitShift;
|
|
@@ -43169,4 +43258,5 @@ exports.shift = shift$2;
|
|
|
43169
43258
|
exports.size = size;
|
|
43170
43259
|
exports.toast = y;
|
|
43171
43260
|
exports.useFloating = useFloating$1;
|
|
43261
|
+
exports.useReactTable = useReactTable;
|
|
43172
43262
|
//# sourceMappingURL=index.js.map
|