Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tanstack/table-core

Package Overview
Dependencies
Maintainers
2
Versions
195
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanstack/table-core - npm Package Compare versions

Comparing version 8.9.7 to 8.9.8

2

build/lib/core/cell.js

@@ -41,3 +41,3 @@ /**

table._features.forEach(feature => {
Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, table));
feature.createCell == null || feature.createCell(cell, column, row, table);
}, {});

@@ -44,0 +44,0 @@ return cell;

@@ -85,5 +85,5 @@ /**

};
column = table._features.reduce((obj, feature) => {
return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, table));
}, column);
for (const feature of table._features) {
feature.createColumn == null || feature.createColumn(column, table);
}

@@ -90,0 +90,0 @@ // Yes, we have to convert table to uknown, because we know more than the compiler here.

@@ -51,3 +51,3 @@ /**

table._features.forEach(feature => {
Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header, table));
feature.createHeader == null || feature.createHeader(header, table);
});

@@ -58,186 +58,187 @@ return header;

createTable: table => {
return {
// Header Groups
// Header Groups
getHeaderGroups: utils.memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
var _left$map$filter, _right$map$filter;
const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table);
return headerGroups;
}, {
key: process.env.NODE_ENV === 'development' && 'getHeaderGroups',
debug: () => {
var _table$options$debugA;
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugHeaders;
}
}),
getCenterHeaderGroups: utils.memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
return buildHeaderGroups(allColumns, leafColumns, table, 'center');
}, {
key: process.env.NODE_ENV === 'development' && 'getCenterHeaderGroups',
debug: () => {
var _table$options$debugA2;
return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugHeaders;
}
}),
getLeftHeaderGroups: utils.memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => {
var _left$map$filter2;
const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left');
}, {
key: process.env.NODE_ENV === 'development' && 'getLeftHeaderGroups',
debug: () => {
var _table$options$debugA3;
return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugHeaders;
}
}),
getRightHeaderGroups: utils.memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => {
var _right$map$filter2;
const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right');
}, {
key: process.env.NODE_ENV === 'development' && 'getRightHeaderGroups',
debug: () => {
var _table$options$debugA4;
return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugHeaders;
}
}),
// Footer Groups
table.getHeaderGroups = utils.memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
var _left$map$filter, _right$map$filter;
const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table);
return headerGroups;
}, {
key: process.env.NODE_ENV === 'development' && 'getHeaderGroups',
debug: () => {
var _table$options$debugA;
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugHeaders;
}
});
table.getCenterHeaderGroups = utils.memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
return buildHeaderGroups(allColumns, leafColumns, table, 'center');
}, {
key: process.env.NODE_ENV === 'development' && 'getCenterHeaderGroups',
debug: () => {
var _table$options$debugA2;
return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugHeaders;
}
});
table.getLeftHeaderGroups = utils.memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => {
var _left$map$filter2;
const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left');
}, {
key: process.env.NODE_ENV === 'development' && 'getLeftHeaderGroups',
debug: () => {
var _table$options$debugA3;
return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugHeaders;
}
});
table.getRightHeaderGroups = utils.memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => {
var _right$map$filter2;
const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right');
}, {
key: process.env.NODE_ENV === 'development' && 'getRightHeaderGroups',
debug: () => {
var _table$options$debugA4;
return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugHeaders;
}
});
getFooterGroups: utils.memo(() => [table.getHeaderGroups()], headerGroups => {
return [...headerGroups].reverse();
}, {
key: process.env.NODE_ENV === 'development' && 'getFooterGroups',
debug: () => {
var _table$options$debugA5;
return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugHeaders;
}
}),
getLeftFooterGroups: utils.memo(() => [table.getLeftHeaderGroups()], headerGroups => {
return [...headerGroups].reverse();
}, {
key: process.env.NODE_ENV === 'development' && 'getLeftFooterGroups',
debug: () => {
var _table$options$debugA6;
return (_table$options$debugA6 = table.options.debugAll) != null ? _table$options$debugA6 : table.options.debugHeaders;
}
}),
getCenterFooterGroups: utils.memo(() => [table.getCenterHeaderGroups()], headerGroups => {
return [...headerGroups].reverse();
}, {
key: process.env.NODE_ENV === 'development' && 'getCenterFooterGroups',
debug: () => {
var _table$options$debugA7;
return (_table$options$debugA7 = table.options.debugAll) != null ? _table$options$debugA7 : table.options.debugHeaders;
}
}),
getRightFooterGroups: utils.memo(() => [table.getRightHeaderGroups()], headerGroups => {
return [...headerGroups].reverse();
}, {
key: process.env.NODE_ENV === 'development' && 'getRightFooterGroups',
debug: () => {
var _table$options$debugA8;
return (_table$options$debugA8 = table.options.debugAll) != null ? _table$options$debugA8 : table.options.debugHeaders;
}
}),
// Flat Headers
// Footer Groups
getFlatHeaders: utils.memo(() => [table.getHeaderGroups()], headerGroups => {
return headerGroups.map(headerGroup => {
return headerGroup.headers;
}).flat();
}, {
key: process.env.NODE_ENV === 'development' && 'getFlatHeaders',
debug: () => {
var _table$options$debugA9;
return (_table$options$debugA9 = table.options.debugAll) != null ? _table$options$debugA9 : table.options.debugHeaders;
}
}),
getLeftFlatHeaders: utils.memo(() => [table.getLeftHeaderGroups()], left => {
return left.map(headerGroup => {
return headerGroup.headers;
}).flat();
}, {
key: process.env.NODE_ENV === 'development' && 'getLeftFlatHeaders',
debug: () => {
var _table$options$debugA10;
return (_table$options$debugA10 = table.options.debugAll) != null ? _table$options$debugA10 : table.options.debugHeaders;
}
}),
getCenterFlatHeaders: utils.memo(() => [table.getCenterHeaderGroups()], left => {
return left.map(headerGroup => {
return headerGroup.headers;
}).flat();
}, {
key: process.env.NODE_ENV === 'development' && 'getCenterFlatHeaders',
debug: () => {
var _table$options$debugA11;
return (_table$options$debugA11 = table.options.debugAll) != null ? _table$options$debugA11 : table.options.debugHeaders;
}
}),
getRightFlatHeaders: utils.memo(() => [table.getRightHeaderGroups()], left => {
return left.map(headerGroup => {
return headerGroup.headers;
}).flat();
}, {
key: process.env.NODE_ENV === 'development' && 'getRightFlatHeaders',
debug: () => {
var _table$options$debugA12;
return (_table$options$debugA12 = table.options.debugAll) != null ? _table$options$debugA12 : table.options.debugHeaders;
}
}),
// Leaf Headers
table.getFooterGroups = utils.memo(() => [table.getHeaderGroups()], headerGroups => {
return [...headerGroups].reverse();
}, {
key: process.env.NODE_ENV === 'development' && 'getFooterGroups',
debug: () => {
var _table$options$debugA5;
return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugHeaders;
}
});
table.getLeftFooterGroups = utils.memo(() => [table.getLeftHeaderGroups()], headerGroups => {
return [...headerGroups].reverse();
}, {
key: process.env.NODE_ENV === 'development' && 'getLeftFooterGroups',
debug: () => {
var _table$options$debugA6;
return (_table$options$debugA6 = table.options.debugAll) != null ? _table$options$debugA6 : table.options.debugHeaders;
}
});
table.getCenterFooterGroups = utils.memo(() => [table.getCenterHeaderGroups()], headerGroups => {
return [...headerGroups].reverse();
}, {
key: process.env.NODE_ENV === 'development' && 'getCenterFooterGroups',
debug: () => {
var _table$options$debugA7;
return (_table$options$debugA7 = table.options.debugAll) != null ? _table$options$debugA7 : table.options.debugHeaders;
}
});
table.getRightFooterGroups = utils.memo(() => [table.getRightHeaderGroups()], headerGroups => {
return [...headerGroups].reverse();
}, {
key: process.env.NODE_ENV === 'development' && 'getRightFooterGroups',
debug: () => {
var _table$options$debugA8;
return (_table$options$debugA8 = table.options.debugAll) != null ? _table$options$debugA8 : table.options.debugHeaders;
}
});
getCenterLeafHeaders: utils.memo(() => [table.getCenterFlatHeaders()], flatHeaders => {
return flatHeaders.filter(header => {
var _header$subHeaders;
return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);
});
}, {
key: process.env.NODE_ENV === 'development' && 'getCenterLeafHeaders',
debug: () => {
var _table$options$debugA13;
return (_table$options$debugA13 = table.options.debugAll) != null ? _table$options$debugA13 : table.options.debugHeaders;
}
}),
getLeftLeafHeaders: utils.memo(() => [table.getLeftFlatHeaders()], flatHeaders => {
return flatHeaders.filter(header => {
var _header$subHeaders2;
return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);
});
}, {
key: process.env.NODE_ENV === 'development' && 'getLeftLeafHeaders',
debug: () => {
var _table$options$debugA14;
return (_table$options$debugA14 = table.options.debugAll) != null ? _table$options$debugA14 : table.options.debugHeaders;
}
}),
getRightLeafHeaders: utils.memo(() => [table.getRightFlatHeaders()], flatHeaders => {
return flatHeaders.filter(header => {
var _header$subHeaders3;
return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);
});
}, {
key: process.env.NODE_ENV === 'development' && 'getRightLeafHeaders',
debug: () => {
var _table$options$debugA15;
return (_table$options$debugA15 = table.options.debugAll) != null ? _table$options$debugA15 : table.options.debugHeaders;
}
}),
getLeafHeaders: utils.memo(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => {
var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
return [...((_left$0$headers = (_left$ = left[0]) == null ? void 0 : _left$.headers) != null ? _left$0$headers : []), ...((_center$0$headers = (_center$ = center[0]) == null ? void 0 : _center$.headers) != null ? _center$0$headers : []), ...((_right$0$headers = (_right$ = right[0]) == null ? void 0 : _right$.headers) != null ? _right$0$headers : [])].map(header => {
return header.getLeafHeaders();
}).flat();
}, {
key: process.env.NODE_ENV === 'development' && 'getLeafHeaders',
debug: () => {
var _table$options$debugA16;
return (_table$options$debugA16 = table.options.debugAll) != null ? _table$options$debugA16 : table.options.debugHeaders;
}
})
};
// Flat Headers
table.getFlatHeaders = utils.memo(() => [table.getHeaderGroups()], headerGroups => {
return headerGroups.map(headerGroup => {
return headerGroup.headers;
}).flat();
}, {
key: process.env.NODE_ENV === 'development' && 'getFlatHeaders',
debug: () => {
var _table$options$debugA9;
return (_table$options$debugA9 = table.options.debugAll) != null ? _table$options$debugA9 : table.options.debugHeaders;
}
});
table.getLeftFlatHeaders = utils.memo(() => [table.getLeftHeaderGroups()], left => {
return left.map(headerGroup => {
return headerGroup.headers;
}).flat();
}, {
key: process.env.NODE_ENV === 'development' && 'getLeftFlatHeaders',
debug: () => {
var _table$options$debugA10;
return (_table$options$debugA10 = table.options.debugAll) != null ? _table$options$debugA10 : table.options.debugHeaders;
}
});
table.getCenterFlatHeaders = utils.memo(() => [table.getCenterHeaderGroups()], left => {
return left.map(headerGroup => {
return headerGroup.headers;
}).flat();
}, {
key: process.env.NODE_ENV === 'development' && 'getCenterFlatHeaders',
debug: () => {
var _table$options$debugA11;
return (_table$options$debugA11 = table.options.debugAll) != null ? _table$options$debugA11 : table.options.debugHeaders;
}
});
table.getRightFlatHeaders = utils.memo(() => [table.getRightHeaderGroups()], left => {
return left.map(headerGroup => {
return headerGroup.headers;
}).flat();
}, {
key: process.env.NODE_ENV === 'development' && 'getRightFlatHeaders',
debug: () => {
var _table$options$debugA12;
return (_table$options$debugA12 = table.options.debugAll) != null ? _table$options$debugA12 : table.options.debugHeaders;
}
});
// Leaf Headers
table.getCenterLeafHeaders = utils.memo(() => [table.getCenterFlatHeaders()], flatHeaders => {
return flatHeaders.filter(header => {
var _header$subHeaders;
return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);
});
}, {
key: process.env.NODE_ENV === 'development' && 'getCenterLeafHeaders',
debug: () => {
var _table$options$debugA13;
return (_table$options$debugA13 = table.options.debugAll) != null ? _table$options$debugA13 : table.options.debugHeaders;
}
});
table.getLeftLeafHeaders = utils.memo(() => [table.getLeftFlatHeaders()], flatHeaders => {
return flatHeaders.filter(header => {
var _header$subHeaders2;
return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);
});
}, {
key: process.env.NODE_ENV === 'development' && 'getLeftLeafHeaders',
debug: () => {
var _table$options$debugA14;
return (_table$options$debugA14 = table.options.debugAll) != null ? _table$options$debugA14 : table.options.debugHeaders;
}
});
table.getRightLeafHeaders = utils.memo(() => [table.getRightFlatHeaders()], flatHeaders => {
return flatHeaders.filter(header => {
var _header$subHeaders3;
return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);
});
}, {
key: process.env.NODE_ENV === 'development' && 'getRightLeafHeaders',
debug: () => {
var _table$options$debugA15;
return (_table$options$debugA15 = table.options.debugAll) != null ? _table$options$debugA15 : table.options.debugHeaders;
}
});
table.getLeafHeaders = utils.memo(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => {
var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
return [...((_left$0$headers = (_left$ = left[0]) == null ? void 0 : _left$.headers) != null ? _left$0$headers : []), ...((_center$0$headers = (_center$ = center[0]) == null ? void 0 : _center$.headers) != null ? _center$0$headers : []), ...((_right$0$headers = (_right$ = right[0]) == null ? void 0 : _right$.headers) != null ? _right$0$headers : [])].map(header => {
return header.getLeafHeaders();
}).flat();
}, {
key: process.env.NODE_ENV === 'development' && 'getLeafHeaders',
debug: () => {
var _table$options$debugA16;
return (_table$options$debugA16 = table.options.debugAll) != null ? _table$options$debugA16 : table.options.debugHeaders;
}
});
}

@@ -244,0 +245,0 @@ };

@@ -97,3 +97,3 @@ /**

const feature = table._features[i];
Object.assign(row, feature == null || feature.createRow == null ? void 0 : feature.createRow(row, table));
feature == null || feature.createRow == null || feature.createRow(row, table);
}

@@ -100,0 +100,0 @@ return row;

@@ -221,5 +221,6 @@ /**

Object.assign(table, coreInstance);
table._features.forEach(feature => {
return Object.assign(table, feature.createTable == null ? void 0 : feature.createTable(table));
});
for (let index = 0; index < table._features.length; index++) {
const feature = table._features[index];
feature == null || feature.createTable == null || feature.createTable(table);
}
return table;

@@ -226,0 +227,0 @@ }

@@ -53,201 +53,195 @@ /**

createColumn: (column, table) => {
return {
getSize: () => {
var _column$columnDef$min, _ref, _column$columnDef$max;
const columnSize = table.getState().columnSizing[column.id];
return Math.min(Math.max((_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize);
},
getStart: position => {
const columns = !position ? table.getVisibleLeafColumns() : position === 'left' ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns();
const index = columns.findIndex(d => d.id === column.id);
if (index > 0) {
const prevSiblingColumn = columns[index - 1];
return prevSiblingColumn.getStart(position) + prevSiblingColumn.getSize();
}
return 0;
},
resetSize: () => {
table.setColumnSizing(_ref2 => {
let {
[column.id]: _,
...rest
} = _ref2;
return rest;
});
},
getCanResize: () => {
var _column$columnDef$ena, _table$options$enable;
return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true);
},
getIsResizing: () => {
return table.getState().columnSizingInfo.isResizingColumn === column.id;
column.getSize = () => {
var _column$columnDef$min, _ref, _column$columnDef$max;
const columnSize = table.getState().columnSizing[column.id];
return Math.min(Math.max((_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize);
};
column.getStart = position => {
const columns = !position ? table.getVisibleLeafColumns() : position === 'left' ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns();
const index = columns.findIndex(d => d.id === column.id);
if (index > 0) {
const prevSiblingColumn = columns[index - 1];
return prevSiblingColumn.getStart(position) + prevSiblingColumn.getSize();
}
return 0;
};
column.resetSize = () => {
table.setColumnSizing(_ref2 => {
let {
[column.id]: _,
...rest
} = _ref2;
return rest;
});
};
column.getCanResize = () => {
var _column$columnDef$ena, _table$options$enable;
return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true);
};
column.getIsResizing = () => {
return table.getState().columnSizingInfo.isResizingColumn === column.id;
};
},
createHeader: (header, table) => {
return {
getSize: () => {
let sum = 0;
const recurse = header => {
if (header.subHeaders.length) {
header.subHeaders.forEach(recurse);
} else {
var _header$column$getSiz;
sum += (_header$column$getSiz = header.column.getSize()) != null ? _header$column$getSiz : 0;
header.getSize = () => {
let sum = 0;
const recurse = header => {
if (header.subHeaders.length) {
header.subHeaders.forEach(recurse);
} else {
var _header$column$getSiz;
sum += (_header$column$getSiz = header.column.getSize()) != null ? _header$column$getSiz : 0;
}
};
recurse(header);
return sum;
};
header.getStart = () => {
if (header.index > 0) {
const prevSiblingHeader = header.headerGroup.headers[header.index - 1];
return prevSiblingHeader.getStart() + prevSiblingHeader.getSize();
}
return 0;
};
header.getResizeHandler = () => {
const column = table.getColumn(header.column.id);
const canResize = column == null ? void 0 : column.getCanResize();
return e => {
if (!column || !canResize) {
return;
}
e.persist == null || e.persist();
if (isTouchStartEvent(e)) {
// lets not respond to multiple touches (e.g. 2 or 3 fingers)
if (e.touches && e.touches.length > 1) {
return;
}
};
recurse(header);
return sum;
},
getStart: () => {
if (header.index > 0) {
const prevSiblingHeader = header.headerGroup.headers[header.index - 1];
return prevSiblingHeader.getStart() + prevSiblingHeader.getSize();
}
return 0;
},
getResizeHandler: () => {
const column = table.getColumn(header.column.id);
const canResize = column == null ? void 0 : column.getCanResize();
return e => {
if (!column || !canResize) {
const startSize = header.getSize();
const columnSizingStart = header ? header.getLeafHeaders().map(d => [d.column.id, d.column.getSize()]) : [[column.id, column.getSize()]];
const clientX = isTouchStartEvent(e) ? Math.round(e.touches[0].clientX) : e.clientX;
const newColumnSizing = {};
const updateOffset = (eventType, clientXPos) => {
if (typeof clientXPos !== 'number') {
return;
}
e.persist == null || e.persist();
if (isTouchStartEvent(e)) {
// lets not respond to multiple touches (e.g. 2 or 3 fingers)
if (e.touches && e.touches.length > 1) {
return;
}
}
const startSize = header.getSize();
const columnSizingStart = header ? header.getLeafHeaders().map(d => [d.column.id, d.column.getSize()]) : [[column.id, column.getSize()]];
const clientX = isTouchStartEvent(e) ? Math.round(e.touches[0].clientX) : e.clientX;
const newColumnSizing = {};
const updateOffset = (eventType, clientXPos) => {
if (typeof clientXPos !== 'number') {
return;
}
table.setColumnSizingInfo(old => {
var _old$startOffset, _old$startSize;
const deltaOffset = clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0);
const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999);
old.columnSizingStart.forEach(_ref3 => {
let [columnId, headerSize] = _ref3;
newColumnSizing[columnId] = Math.round(Math.max(headerSize + headerSize * deltaPercentage, 0) * 100) / 100;
});
return {
...old,
deltaOffset,
deltaPercentage
};
table.setColumnSizingInfo(old => {
var _old$startOffset, _old$startSize;
const deltaOffset = clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0);
const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999);
old.columnSizingStart.forEach(_ref3 => {
let [columnId, headerSize] = _ref3;
newColumnSizing[columnId] = Math.round(Math.max(headerSize + headerSize * deltaPercentage, 0) * 100) / 100;
});
if (table.options.columnResizeMode === 'onChange' || eventType === 'end') {
table.setColumnSizing(old => ({
...old,
...newColumnSizing
}));
}
};
const onMove = clientXPos => updateOffset('move', clientXPos);
const onEnd = clientXPos => {
updateOffset('end', clientXPos);
table.setColumnSizingInfo(old => ({
return {
...old,
isResizingColumn: false,
startOffset: null,
startSize: null,
deltaOffset: null,
deltaPercentage: null,
columnSizingStart: []
deltaOffset,
deltaPercentage
};
});
if (table.options.columnResizeMode === 'onChange' || eventType === 'end') {
table.setColumnSizing(old => ({
...old,
...newColumnSizing
}));
};
const mouseEvents = {
moveHandler: e => onMove(e.clientX),
upHandler: e => {
document.removeEventListener('mousemove', mouseEvents.moveHandler);
document.removeEventListener('mouseup', mouseEvents.upHandler);
onEnd(e.clientX);
}
};
const touchEvents = {
moveHandler: e => {
if (e.cancelable) {
e.preventDefault();
e.stopPropagation();
}
onMove(e.touches[0].clientX);
return false;
},
upHandler: e => {
var _e$touches$;
document.removeEventListener('touchmove', touchEvents.moveHandler);
document.removeEventListener('touchend', touchEvents.upHandler);
if (e.cancelable) {
e.preventDefault();
e.stopPropagation();
}
onEnd((_e$touches$ = e.touches[0]) == null ? void 0 : _e$touches$.clientX);
}
};
const passiveIfSupported = passiveEventSupported() ? {
passive: false
} : false;
if (isTouchStartEvent(e)) {
document.addEventListener('touchmove', touchEvents.moveHandler, passiveIfSupported);
document.addEventListener('touchend', touchEvents.upHandler, passiveIfSupported);
} else {
document.addEventListener('mousemove', mouseEvents.moveHandler, passiveIfSupported);
document.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported);
}
};
const onMove = clientXPos => updateOffset('move', clientXPos);
const onEnd = clientXPos => {
updateOffset('end', clientXPos);
table.setColumnSizingInfo(old => ({
...old,
startOffset: clientX,
startSize,
deltaOffset: 0,
deltaPercentage: 0,
columnSizingStart,
isResizingColumn: column.id
isResizingColumn: false,
startOffset: null,
startSize: null,
deltaOffset: null,
deltaPercentage: null,
columnSizingStart: []
}));
};
}
const mouseEvents = {
moveHandler: e => onMove(e.clientX),
upHandler: e => {
document.removeEventListener('mousemove', mouseEvents.moveHandler);
document.removeEventListener('mouseup', mouseEvents.upHandler);
onEnd(e.clientX);
}
};
const touchEvents = {
moveHandler: e => {
if (e.cancelable) {
e.preventDefault();
e.stopPropagation();
}
onMove(e.touches[0].clientX);
return false;
},
upHandler: e => {
var _e$touches$;
document.removeEventListener('touchmove', touchEvents.moveHandler);
document.removeEventListener('touchend', touchEvents.upHandler);
if (e.cancelable) {
e.preventDefault();
e.stopPropagation();
}
onEnd((_e$touches$ = e.touches[0]) == null ? void 0 : _e$touches$.clientX);
}
};
const passiveIfSupported = passiveEventSupported() ? {
passive: false
} : false;
if (isTouchStartEvent(e)) {
document.addEventListener('touchmove', touchEvents.moveHandler, passiveIfSupported);
document.addEventListener('touchend', touchEvents.upHandler, passiveIfSupported);
} else {
document.addEventListener('mousemove', mouseEvents.moveHandler, passiveIfSupported);
document.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported);
}
table.setColumnSizingInfo(old => ({
...old,
startOffset: clientX,
startSize,
deltaOffset: 0,
deltaPercentage: 0,
columnSizingStart,
isResizingColumn: column.id
}));
};
};
},
createTable: table => {
return {
setColumnSizing: updater => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater),
setColumnSizingInfo: updater => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater),
resetColumnSizing: defaultState => {
var _table$initialState$c;
table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {});
},
resetHeaderSizeInfo: defaultState => {
var _table$initialState$c2;
table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState());
},
getTotalSize: () => {
var _table$getHeaderGroup, _table$getHeaderGroup2;
return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum, header) => {
return sum + header.getSize();
}, 0)) != null ? _table$getHeaderGroup : 0;
},
getLeftTotalSize: () => {
var _table$getLeftHeaderG, _table$getLeftHeaderG2;
return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum, header) => {
return sum + header.getSize();
}, 0)) != null ? _table$getLeftHeaderG : 0;
},
getCenterTotalSize: () => {
var _table$getCenterHeade, _table$getCenterHeade2;
return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum, header) => {
return sum + header.getSize();
}, 0)) != null ? _table$getCenterHeade : 0;
},
getRightTotalSize: () => {
var _table$getRightHeader, _table$getRightHeader2;
return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum, header) => {
return sum + header.getSize();
}, 0)) != null ? _table$getRightHeader : 0;
}
table.setColumnSizing = updater => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater);
table.setColumnSizingInfo = updater => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater);
table.resetColumnSizing = defaultState => {
var _table$initialState$c;
table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {});
};
table.resetHeaderSizeInfo = defaultState => {
var _table$initialState$c2;
table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState());
};
table.getTotalSize = () => {
var _table$getHeaderGroup, _table$getHeaderGroup2;
return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum, header) => {
return sum + header.getSize();
}, 0)) != null ? _table$getHeaderGroup : 0;
};
table.getLeftTotalSize = () => {
var _table$getLeftHeaderG, _table$getLeftHeaderG2;
return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum, header) => {
return sum + header.getSize();
}, 0)) != null ? _table$getLeftHeaderG : 0;
};
table.getCenterTotalSize = () => {
var _table$getCenterHeade, _table$getCenterHeade2;
return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum, header) => {
return sum + header.getSize();
}, 0)) != null ? _table$getCenterHeade : 0;
};
table.getRightTotalSize = () => {
var _table$getRightHeader, _table$getRightHeader2;
return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum, header) => {
return sum + header.getSize();
}, 0)) != null ? _table$getRightHeader : 0;
};
}

@@ -254,0 +248,0 @@ };

@@ -35,133 +35,129 @@ /**

let queued = false;
return {
_autoResetExpanded: () => {
var _ref, _table$options$autoRe;
if (!registered) {
table._queue(() => {
registered = true;
});
return;
}
if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) {
if (queued) return;
queued = true;
table._queue(() => {
table.resetExpanded();
queued = false;
});
}
},
setExpanded: updater => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater),
toggleAllRowsExpanded: expanded => {
if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) {
table.setExpanded(true);
} else {
table.setExpanded({});
}
},
resetExpanded: defaultState => {
var _table$initialState$e, _table$initialState;
table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {});
},
getCanSomeRowsExpand: () => {
return table.getPrePaginationRowModel().flatRows.some(row => row.getCanExpand());
},
getToggleAllRowsExpandedHandler: () => {
return e => {
e.persist == null || e.persist();
table.toggleAllRowsExpanded();
};
},
getIsSomeRowsExpanded: () => {
const expanded = table.getState().expanded;
return expanded === true || Object.values(expanded).some(Boolean);
},
getIsAllRowsExpanded: () => {
const expanded = table.getState().expanded;
table._autoResetExpanded = () => {
var _ref, _table$options$autoRe;
if (!registered) {
table._queue(() => {
registered = true;
});
return;
}
if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) {
if (queued) return;
queued = true;
table._queue(() => {
table.resetExpanded();
queued = false;
});
}
};
table.setExpanded = updater => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater);
table.toggleAllRowsExpanded = expanded => {
if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) {
table.setExpanded(true);
} else {
table.setExpanded({});
}
};
table.resetExpanded = defaultState => {
var _table$initialState$e, _table$initialState;
table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {});
};
table.getCanSomeRowsExpand = () => {
return table.getPrePaginationRowModel().flatRows.some(row => row.getCanExpand());
};
table.getToggleAllRowsExpandedHandler = () => {
return e => {
e.persist == null || e.persist();
table.toggleAllRowsExpanded();
};
};
table.getIsSomeRowsExpanded = () => {
const expanded = table.getState().expanded;
return expanded === true || Object.values(expanded).some(Boolean);
};
table.getIsAllRowsExpanded = () => {
const expanded = table.getState().expanded;
// If expanded is true, save some cycles and return true
if (typeof expanded === 'boolean') {
return expanded === true;
}
if (!Object.keys(expanded).length) {
return false;
}
// If expanded is true, save some cycles and return true
if (typeof expanded === 'boolean') {
return expanded === true;
}
if (!Object.keys(expanded).length) {
return false;
}
// If any row is not expanded, return false
if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) {
return false;
}
// If any row is not expanded, return false
if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) {
return false;
}
// They must all be expanded :shrug:
return true;
},
getExpandedDepth: () => {
let maxDepth = 0;
const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded);
rowIds.forEach(id => {
const splitId = id.split('.');
maxDepth = Math.max(maxDepth, splitId.length);
});
return maxDepth;
},
getPreExpandedRowModel: () => table.getSortedRowModel(),
getExpandedRowModel: () => {
if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {
table._getExpandedRowModel = table.options.getExpandedRowModel(table);
}
if (table.options.manualExpanding || !table._getExpandedRowModel) {
return table.getPreExpandedRowModel();
}
return table._getExpandedRowModel();
// They must all be expanded :shrug:
return true;
};
table.getExpandedDepth = () => {
let maxDepth = 0;
const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded);
rowIds.forEach(id => {
const splitId = id.split('.');
maxDepth = Math.max(maxDepth, splitId.length);
});
return maxDepth;
};
table.getPreExpandedRowModel = () => table.getSortedRowModel();
table.getExpandedRowModel = () => {
if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {
table._getExpandedRowModel = table.options.getExpandedRowModel(table);
}
if (table.options.manualExpanding || !table._getExpandedRowModel) {
return table.getPreExpandedRowModel();
}
return table._getExpandedRowModel();
};
},
createRow: (row, table) => {
return {
toggleExpanded: expanded => {
table.setExpanded(old => {
var _expanded;
const exists = old === true ? true : !!(old != null && old[row.id]);
let oldExpanded = {};
if (old === true) {
Object.keys(table.getRowModel().rowsById).forEach(rowId => {
oldExpanded[rowId] = true;
});
} else {
oldExpanded = old;
}
expanded = (_expanded = expanded) != null ? _expanded : !exists;
if (!exists && expanded) {
return {
...oldExpanded,
[row.id]: true
};
}
if (exists && !expanded) {
const {
[row.id]: _,
...rest
} = oldExpanded;
return rest;
}
return old;
});
},
getIsExpanded: () => {
var _table$options$getIsR;
const expanded = table.getState().expanded;
return !!((_table$options$getIsR = table.options.getIsRowExpanded == null ? void 0 : table.options.getIsRowExpanded(row)) != null ? _table$options$getIsR : expanded === true || (expanded == null ? void 0 : expanded[row.id]));
},
getCanExpand: () => {
var _table$options$getRow, _table$options$enable, _row$subRows;
return (_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ? _table$options$getRow : ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
},
getToggleExpandedHandler: () => {
const canExpand = row.getCanExpand();
return () => {
if (!canExpand) return;
row.toggleExpanded();
};
}
row.toggleExpanded = expanded => {
table.setExpanded(old => {
var _expanded;
const exists = old === true ? true : !!(old != null && old[row.id]);
let oldExpanded = {};
if (old === true) {
Object.keys(table.getRowModel().rowsById).forEach(rowId => {
oldExpanded[rowId] = true;
});
} else {
oldExpanded = old;
}
expanded = (_expanded = expanded) != null ? _expanded : !exists;
if (!exists && expanded) {
return {
...oldExpanded,
[row.id]: true
};
}
if (exists && !expanded) {
const {
[row.id]: _,
...rest
} = oldExpanded;
return rest;
}
return old;
});
};
row.getIsExpanded = () => {
var _table$options$getIsR;
const expanded = table.getState().expanded;
return !!((_table$options$getIsR = table.options.getIsRowExpanded == null ? void 0 : table.options.getIsRowExpanded(row)) != null ? _table$options$getIsR : expanded === true || (expanded == null ? void 0 : expanded[row.id]));
};
row.getCanExpand = () => {
var _table$options$getRow, _table$options$enable, _row$subRows;
return (_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ? _table$options$getRow : ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
};
row.getToggleExpandedHandler = () => {
const canExpand = row.getCanExpand();
return () => {
if (!canExpand) return;
row.toggleExpanded();
};
};
}

@@ -168,0 +164,0 @@ };

@@ -50,181 +50,173 @@ /**

createColumn: (column, table) => {
return {
getAutoFilterFn: () => {
const firstRow = table.getCoreRowModel().flatRows[0];
const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
if (typeof value === 'string') {
return filterFns.filterFns.includesString;
}
if (typeof value === 'number') {
return filterFns.filterFns.inNumberRange;
}
if (typeof value === 'boolean') {
return filterFns.filterFns.equals;
}
if (value !== null && typeof value === 'object') {
return filterFns.filterFns.equals;
}
if (Array.isArray(value)) {
return filterFns.filterFns.arrIncludes;
}
return filterFns.filterFns.weakEquals;
},
getFilterFn: () => {
var _table$options$filter, _table$options$filter2;
return utils.isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn()
// @ts-ignore
: (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[column.columnDef.filterFn]) != null ? _table$options$filter : filterFns.filterFns[column.columnDef.filterFn];
},
getCanFilter: () => {
var _column$columnDef$ena, _table$options$enable, _table$options$enable2;
return ((_column$columnDef$ena = column.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnFilters) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && !!column.accessorFn;
},
getCanGlobalFilter: () => {
var _column$columnDef$ena2, _table$options$enable3, _table$options$enable4, _table$options$getCol;
return ((_column$columnDef$ena2 = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena2 : true) && ((_table$options$enable3 = table.options.enableGlobalFilter) != null ? _table$options$enable3 : true) && ((_table$options$enable4 = table.options.enableFilters) != null ? _table$options$enable4 : true) && ((_table$options$getCol = table.options.getColumnCanGlobalFilter == null ? void 0 : table.options.getColumnCanGlobalFilter(column)) != null ? _table$options$getCol : true) && !!column.accessorFn;
},
getIsFiltered: () => column.getFilterIndex() > -1,
getFilterValue: () => {
var _table$getState$colum;
return (_table$getState$colum = table.getState().columnFilters) == null || (_table$getState$colum = _table$getState$colum.find(d => d.id === column.id)) == null ? void 0 : _table$getState$colum.value;
},
getFilterIndex: () => {
var _table$getState$colum2, _table$getState$colum3;
return (_table$getState$colum2 = (_table$getState$colum3 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum3.findIndex(d => d.id === column.id)) != null ? _table$getState$colum2 : -1;
},
setFilterValue: value => {
table.setColumnFilters(old => {
const filterFn = column.getFilterFn();
const previousfilter = old == null ? void 0 : old.find(d => d.id === column.id);
const newFilter = utils.functionalUpdate(value, previousfilter ? previousfilter.value : undefined);
column.getAutoFilterFn = () => {
const firstRow = table.getCoreRowModel().flatRows[0];
const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
if (typeof value === 'string') {
return filterFns.filterFns.includesString;
}
if (typeof value === 'number') {
return filterFns.filterFns.inNumberRange;
}
if (typeof value === 'boolean') {
return filterFns.filterFns.equals;
}
if (value !== null && typeof value === 'object') {
return filterFns.filterFns.equals;
}
if (Array.isArray(value)) {
return filterFns.filterFns.arrIncludes;
}
return filterFns.filterFns.weakEquals;
};
column.getFilterFn = () => {
var _table$options$filter, _table$options$filter2;
return utils.isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn() : // @ts-ignore
(_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[column.columnDef.filterFn]) != null ? _table$options$filter : filterFns.filterFns[column.columnDef.filterFn];
};
column.getCanFilter = () => {
var _column$columnDef$ena, _table$options$enable, _table$options$enable2;
return ((_column$columnDef$ena = column.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnFilters) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && !!column.accessorFn;
};
column.getCanGlobalFilter = () => {
var _column$columnDef$ena2, _table$options$enable3, _table$options$enable4, _table$options$getCol;
return ((_column$columnDef$ena2 = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena2 : true) && ((_table$options$enable3 = table.options.enableGlobalFilter) != null ? _table$options$enable3 : true) && ((_table$options$enable4 = table.options.enableFilters) != null ? _table$options$enable4 : true) && ((_table$options$getCol = table.options.getColumnCanGlobalFilter == null ? void 0 : table.options.getColumnCanGlobalFilter(column)) != null ? _table$options$getCol : true) && !!column.accessorFn;
};
column.getIsFiltered = () => column.getFilterIndex() > -1;
column.getFilterValue = () => {
var _table$getState$colum;
return (_table$getState$colum = table.getState().columnFilters) == null || (_table$getState$colum = _table$getState$colum.find(d => d.id === column.id)) == null ? void 0 : _table$getState$colum.value;
};
column.getFilterIndex = () => {
var _table$getState$colum2, _table$getState$colum3;
return (_table$getState$colum2 = (_table$getState$colum3 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum3.findIndex(d => d.id === column.id)) != null ? _table$getState$colum2 : -1;
};
column.setFilterValue = value => {
table.setColumnFilters(old => {
const filterFn = column.getFilterFn();
const previousfilter = old == null ? void 0 : old.find(d => d.id === column.id);
const newFilter = utils.functionalUpdate(value, previousfilter ? previousfilter.value : undefined);
//
if (shouldAutoRemoveFilter(filterFn, newFilter, column)) {
var _old$filter;
return (_old$filter = old == null ? void 0 : old.filter(d => d.id !== column.id)) != null ? _old$filter : [];
}
const newFilterObj = {
id: column.id,
value: newFilter
};
if (previousfilter) {
var _old$map;
return (_old$map = old == null ? void 0 : old.map(d => {
if (d.id === column.id) {
return newFilterObj;
}
return d;
})) != null ? _old$map : [];
}
if (old != null && old.length) {
return [...old, newFilterObj];
}
return [newFilterObj];
});
},
_getFacetedRowModel: table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column.id),
getFacetedRowModel: () => {
if (!column._getFacetedRowModel) {
return table.getPreFilteredRowModel();
//
if (shouldAutoRemoveFilter(filterFn, newFilter, column)) {
var _old$filter;
return (_old$filter = old == null ? void 0 : old.filter(d => d.id !== column.id)) != null ? _old$filter : [];
}
return column._getFacetedRowModel();
},
_getFacetedUniqueValues: table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id),
getFacetedUniqueValues: () => {
if (!column._getFacetedUniqueValues) {
return new Map();
const newFilterObj = {
id: column.id,
value: newFilter
};
if (previousfilter) {
var _old$map;
return (_old$map = old == null ? void 0 : old.map(d => {
if (d.id === column.id) {
return newFilterObj;
}
return d;
})) != null ? _old$map : [];
}
return column._getFacetedUniqueValues();
},
_getFacetedMinMaxValues: table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column.id),
getFacetedMinMaxValues: () => {
if (!column._getFacetedMinMaxValues) {
return undefined;
if (old != null && old.length) {
return [...old, newFilterObj];
}
return column._getFacetedMinMaxValues();
return [newFilterObj];
});
};
column._getFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column.id);
column.getFacetedRowModel = () => {
if (!column._getFacetedRowModel) {
return table.getPreFilteredRowModel();
}
// () => [column.getFacetedRowModel()],
// facetedRowModel => getRowModelMinMaxValues(facetedRowModel, column.id),
return column._getFacetedRowModel();
};
column._getFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id);
column.getFacetedUniqueValues = () => {
if (!column._getFacetedUniqueValues) {
return new Map();
}
return column._getFacetedUniqueValues();
};
column._getFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column.id);
column.getFacetedMinMaxValues = () => {
if (!column._getFacetedMinMaxValues) {
return undefined;
}
return column._getFacetedMinMaxValues();
};
// () => [column.getFacetedRowModel()],
// facetedRowModel => getRowModelMinMaxValues(facetedRowModel, column.id),
},
createRow: (row, table) => {
return {
columnFilters: {},
columnFiltersMeta: {}
};
row.columnFilters = {};
row.columnFiltersMeta = {};
},
createTable: table => {
return {
getGlobalAutoFilterFn: () => {
return filterFns.filterFns.includesString;
},
getGlobalFilterFn: () => {
var _table$options$filter3, _table$options$filter4;
const {
globalFilterFn: globalFilterFn
} = table.options;
return utils.isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? table.getGlobalAutoFilterFn()
// @ts-ignore
: (_table$options$filter3 = (_table$options$filter4 = table.options.filterFns) == null ? void 0 : _table$options$filter4[globalFilterFn]) != null ? _table$options$filter3 : filterFns.filterFns[globalFilterFn];
},
setColumnFilters: updater => {
const leafColumns = table.getAllLeafColumns();
const updateFn = old => {
var _functionalUpdate;
return (_functionalUpdate = utils.functionalUpdate(updater, old)) == null ? void 0 : _functionalUpdate.filter(filter => {
const column = leafColumns.find(d => d.id === filter.id);
if (column) {
const filterFn = column.getFilterFn();
if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {
return false;
}
table.getGlobalAutoFilterFn = () => {
return filterFns.filterFns.includesString;
};
table.getGlobalFilterFn = () => {
var _table$options$filter3, _table$options$filter4;
const {
globalFilterFn: globalFilterFn
} = table.options;
return utils.isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? table.getGlobalAutoFilterFn() : // @ts-ignore
(_table$options$filter3 = (_table$options$filter4 = table.options.filterFns) == null ? void 0 : _table$options$filter4[globalFilterFn]) != null ? _table$options$filter3 : filterFns.filterFns[globalFilterFn];
};
table.setColumnFilters = updater => {
const leafColumns = table.getAllLeafColumns();
const updateFn = old => {
var _functionalUpdate;
return (_functionalUpdate = utils.functionalUpdate(updater, old)) == null ? void 0 : _functionalUpdate.filter(filter => {
const column = leafColumns.find(d => d.id === filter.id);
if (column) {
const filterFn = column.getFilterFn();
if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {
return false;
}
return true;
});
};
table.options.onColumnFiltersChange == null || table.options.onColumnFiltersChange(updateFn);
},
setGlobalFilter: updater => {
table.options.onGlobalFilterChange == null || table.options.onGlobalFilterChange(updater);
},
resetGlobalFilter: defaultState => {
table.setGlobalFilter(defaultState ? undefined : table.initialState.globalFilter);
},
resetColumnFilters: defaultState => {
var _table$initialState$c, _table$initialState;
table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []);
},
getPreFilteredRowModel: () => table.getCoreRowModel(),
getFilteredRowModel: () => {
if (!table._getFilteredRowModel && table.options.getFilteredRowModel) {
table._getFilteredRowModel = table.options.getFilteredRowModel(table);
}
if (table.options.manualFiltering || !table._getFilteredRowModel) {
return table.getPreFilteredRowModel();
}
return table._getFilteredRowModel();
},
_getGlobalFacetedRowModel: table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, '__global__'),
getGlobalFacetedRowModel: () => {
if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {
return table.getPreFilteredRowModel();
}
return table._getGlobalFacetedRowModel();
},
_getGlobalFacetedUniqueValues: table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, '__global__'),
getGlobalFacetedUniqueValues: () => {
if (!table._getGlobalFacetedUniqueValues) {
return new Map();
}
return table._getGlobalFacetedUniqueValues();
},
_getGlobalFacetedMinMaxValues: table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, '__global__'),
getGlobalFacetedMinMaxValues: () => {
if (!table._getGlobalFacetedMinMaxValues) {
return;
}
return table._getGlobalFacetedMinMaxValues();
}
return true;
});
};
table.options.onColumnFiltersChange == null || table.options.onColumnFiltersChange(updateFn);
};
table.setGlobalFilter = updater => {
table.options.onGlobalFilterChange == null || table.options.onGlobalFilterChange(updater);
};
table.resetGlobalFilter = defaultState => {
table.setGlobalFilter(defaultState ? undefined : table.initialState.globalFilter);
};
table.resetColumnFilters = defaultState => {
var _table$initialState$c, _table$initialState;
table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []);
};
table.getPreFilteredRowModel = () => table.getCoreRowModel();
table.getFilteredRowModel = () => {
if (!table._getFilteredRowModel && table.options.getFilteredRowModel) {
table._getFilteredRowModel = table.options.getFilteredRowModel(table);
}
if (table.options.manualFiltering || !table._getFilteredRowModel) {
return table.getPreFilteredRowModel();
}
return table._getFilteredRowModel();
};
table._getGlobalFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, '__global__');
table.getGlobalFacetedRowModel = () => {
if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {
return table.getPreFilteredRowModel();
}
return table._getGlobalFacetedRowModel();
};
table._getGlobalFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, '__global__');
table.getGlobalFacetedUniqueValues = () => {
if (!table._getGlobalFacetedUniqueValues) {
return new Map();
}
return table._getGlobalFacetedUniqueValues();
};
table._getGlobalFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, '__global__');
table.getGlobalFacetedMinMaxValues = () => {
if (!table._getGlobalFacetedMinMaxValues) {
return;
}
return table._getGlobalFacetedMinMaxValues();
};
}

@@ -231,0 +223,0 @@ };

@@ -43,94 +43,86 @@ /**

createColumn: (column, table) => {
return {
toggleGrouping: () => {
table.setGrouping(old => {
// Find any existing grouping for this column
if (old != null && old.includes(column.id)) {
return old.filter(d => d !== column.id);
}
return [...(old != null ? old : []), column.id];
});
},
getCanGroup: () => {
var _ref, _ref2, _ref3, _column$columnDef$ena;
return (_ref = (_ref2 = (_ref3 = (_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) != null ? _ref3 : table.options.enableGrouping) != null ? _ref2 : true) != null ? _ref : !!column.accessorFn;
},
getIsGrouped: () => {
var _table$getState$group;
return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id);
},
getGroupedIndex: () => {
var _table$getState$group2;
return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id);
},
getToggleGroupingHandler: () => {
const canGroup = column.getCanGroup();
return () => {
if (!canGroup) return;
column.toggleGrouping();
};
},
getAutoAggregationFn: () => {
const firstRow = table.getCoreRowModel().flatRows[0];
const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
if (typeof value === 'number') {
return aggregationFns.aggregationFns.sum;
column.toggleGrouping = () => {
table.setGrouping(old => {
// Find any existing grouping for this column
if (old != null && old.includes(column.id)) {
return old.filter(d => d !== column.id);
}
if (Object.prototype.toString.call(value) === '[object Date]') {
return aggregationFns.aggregationFns.extent;
}
},
getAggregationFn: () => {
var _table$options$aggreg, _table$options$aggreg2;
if (!column) {
throw new Error();
}
return utils.isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_table$options$aggreg = (_table$options$aggreg2 = table.options.aggregationFns) == null ? void 0 : _table$options$aggreg2[column.columnDef.aggregationFn]) != null ? _table$options$aggreg : aggregationFns.aggregationFns[column.columnDef.aggregationFn];
return [...(old != null ? old : []), column.id];
});
};
column.getCanGroup = () => {
var _ref, _ref2, _ref3, _column$columnDef$ena;
return (_ref = (_ref2 = (_ref3 = (_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) != null ? _ref3 : table.options.enableGrouping) != null ? _ref2 : true) != null ? _ref : !!column.accessorFn;
};
column.getIsGrouped = () => {
var _table$getState$group;
return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id);
};
column.getGroupedIndex = () => {
var _table$getState$group2;
return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id);
};
column.getToggleGroupingHandler = () => {
const canGroup = column.getCanGroup();
return () => {
if (!canGroup) return;
column.toggleGrouping();
};
};
column.getAutoAggregationFn = () => {
const firstRow = table.getCoreRowModel().flatRows[0];
const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
if (typeof value === 'number') {
return aggregationFns.aggregationFns.sum;
}
if (Object.prototype.toString.call(value) === '[object Date]') {
return aggregationFns.aggregationFns.extent;
}
};
column.getAggregationFn = () => {
var _table$options$aggreg, _table$options$aggreg2;
if (!column) {
throw new Error();
}
return utils.isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_table$options$aggreg = (_table$options$aggreg2 = table.options.aggregationFns) == null ? void 0 : _table$options$aggreg2[column.columnDef.aggregationFn]) != null ? _table$options$aggreg : aggregationFns.aggregationFns[column.columnDef.aggregationFn];
};
},
createTable: table => {
return {
setGrouping: updater => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater),
resetGrouping: defaultState => {
var _table$initialState$g, _table$initialState;
table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []);
},
getPreGroupedRowModel: () => table.getFilteredRowModel(),
getGroupedRowModel: () => {
if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {
table._getGroupedRowModel = table.options.getGroupedRowModel(table);
}
if (table.options.manualGrouping || !table._getGroupedRowModel) {
return table.getPreGroupedRowModel();
}
return table._getGroupedRowModel();
table.setGrouping = updater => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater);
table.resetGrouping = defaultState => {
var _table$initialState$g, _table$initialState;
table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []);
};
table.getPreGroupedRowModel = () => table.getFilteredRowModel();
table.getGroupedRowModel = () => {
if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {
table._getGroupedRowModel = table.options.getGroupedRowModel(table);
}
if (table.options.manualGrouping || !table._getGroupedRowModel) {
return table.getPreGroupedRowModel();
}
return table._getGroupedRowModel();
};
},
createRow: (row, table) => {
return {
getIsGrouped: () => !!row.groupingColumnId,
getGroupingValue: columnId => {
if (row._groupingValuesCache.hasOwnProperty(columnId)) {
return row._groupingValuesCache[columnId];
}
const column = table.getColumn(columnId);
if (!(column != null && column.columnDef.getGroupingValue)) {
return row.getValue(columnId);
}
row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(row.original);
row.getIsGrouped = () => !!row.groupingColumnId;
row.getGroupingValue = columnId => {
if (row._groupingValuesCache.hasOwnProperty(columnId)) {
return row._groupingValuesCache[columnId];
},
_groupingValuesCache: {}
}
const column = table.getColumn(columnId);
if (!(column != null && column.columnDef.getGroupingValue)) {
return row.getValue(columnId);
}
row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(row.original);
return row._groupingValuesCache[columnId];
};
row._groupingValuesCache = {};
},
createCell: (cell, column, row, table) => {
return {
getIsGrouped: () => column.getIsGrouped() && column.id === row.groupingColumnId,
getIsPlaceholder: () => !cell.getIsGrouped() && column.getIsGrouped(),
getIsAggregated: () => {
var _row$subRows;
return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
}
cell.getIsGrouped = () => column.getIsGrouped() && column.id === row.groupingColumnId;
cell.getIsPlaceholder = () => !cell.getIsGrouped() && column.getIsGrouped();
cell.getIsAggregated = () => {
var _row$subRows;
return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
};

@@ -137,0 +129,0 @@ }

@@ -33,42 +33,40 @@ /**

createTable: table => {
return {
setColumnOrder: updater => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater),
resetColumnOrder: defaultState => {
var _table$initialState$c;
table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []);
},
_getOrderColumnsFn: utils.memo(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => {
// Sort grouped columns to the start of the column list
// before the headers are built
let orderedColumns = [];
table.setColumnOrder = updater => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater);
table.resetColumnOrder = defaultState => {
var _table$initialState$c;
table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []);
};
table._getOrderColumnsFn = utils.memo(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => {
// Sort grouped columns to the start of the column list
// before the headers are built
let orderedColumns = [];
// If there is no order, return the normal columns
if (!(columnOrder != null && columnOrder.length)) {
orderedColumns = columns;
} else {
const columnOrderCopy = [...columnOrder];
// If there is no order, return the normal columns
if (!(columnOrder != null && columnOrder.length)) {
orderedColumns = columns;
} else {
const columnOrderCopy = [...columnOrder];
// If there is an order, make a copy of the columns
const columnsCopy = [...columns];
// If there is an order, make a copy of the columns
const columnsCopy = [...columns];
// And make a new ordered array of the columns
// And make a new ordered array of the columns
// Loop over the columns and place them in order into the new array
while (columnsCopy.length && columnOrderCopy.length) {
const targetColumnId = columnOrderCopy.shift();
const foundIndex = columnsCopy.findIndex(d => d.id === targetColumnId);
if (foundIndex > -1) {
orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]);
}
// Loop over the columns and place them in order into the new array
while (columnsCopy.length && columnOrderCopy.length) {
const targetColumnId = columnOrderCopy.shift();
const foundIndex = columnsCopy.findIndex(d => d.id === targetColumnId);
if (foundIndex > -1) {
orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]);
}
}
// If there are any columns left, add them to the end
orderedColumns = [...orderedColumns, ...columnsCopy];
}
return Grouping.orderColumns(orderedColumns, grouping, groupedColumnMode);
}, {
key: process.env.NODE_ENV === 'development' && 'getOrderColumnsFn'
// debug: () => table.options.debugAll ?? table.options.debugTable,
})
};
// If there are any columns left, add them to the end
orderedColumns = [...orderedColumns, ...columnsCopy];
}
return Grouping.orderColumns(orderedColumns, grouping, groupedColumnMode);
}, {
key: process.env.NODE_ENV === 'development' && 'getOrderColumnsFn'
// debug: () => table.options.debugAll ?? table.options.debugTable,
});
}

@@ -75,0 +73,0 @@ };

@@ -43,123 +43,121 @@ /**

let queued = false;
return {
_autoResetPageIndex: () => {
var _ref, _table$options$autoRe;
if (!registered) {
table._queue(() => {
registered = true;
});
return;
}
if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) {
if (queued) return;
queued = true;
table._queue(() => {
table.resetPageIndex();
queued = false;
});
}
},
setPagination: updater => {
const safeUpdater = old => {
let newState = utils.functionalUpdate(updater, old);
return newState;
};
return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater);
},
resetPagination: defaultState => {
var _table$initialState$p;
table.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState());
},
setPageIndex: updater => {
table.setPagination(old => {
let pageIndex = utils.functionalUpdate(updater, old.pageIndex);
const maxPageIndex = typeof table.options.pageCount === 'undefined' || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1;
pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex));
return {
...old,
pageIndex
};
table._autoResetPageIndex = () => {
var _ref, _table$options$autoRe;
if (!registered) {
table._queue(() => {
registered = true;
});
},
resetPageIndex: defaultState => {
var _table$initialState$p2, _table$initialState;
table.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = (_table$initialState = table.initialState) == null || (_table$initialState = _table$initialState.pagination) == null ? void 0 : _table$initialState.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex);
},
resetPageSize: defaultState => {
var _table$initialState$p3, _table$initialState2;
table.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p3 = (_table$initialState2 = table.initialState) == null || (_table$initialState2 = _table$initialState2.pagination) == null ? void 0 : _table$initialState2.pageSize) != null ? _table$initialState$p3 : defaultPageSize);
},
setPageSize: updater => {
table.setPagination(old => {
const pageSize = Math.max(1, utils.functionalUpdate(updater, old.pageSize));
const topRowIndex = old.pageSize * old.pageIndex;
const pageIndex = Math.floor(topRowIndex / pageSize);
return {
...old,
pageIndex,
pageSize
};
return;
}
if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) {
if (queued) return;
queued = true;
table._queue(() => {
table.resetPageIndex();
queued = false;
});
},
setPageCount: updater => table.setPagination(old => {
var _table$options$pageCo;
let newPageCount = utils.functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1);
if (typeof newPageCount === 'number') {
newPageCount = Math.max(-1, newPageCount);
}
}
};
table.setPagination = updater => {
const safeUpdater = old => {
let newState = utils.functionalUpdate(updater, old);
return newState;
};
return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater);
};
table.resetPagination = defaultState => {
var _table$initialState$p;
table.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState());
};
table.setPageIndex = updater => {
table.setPagination(old => {
let pageIndex = utils.functionalUpdate(updater, old.pageIndex);
const maxPageIndex = typeof table.options.pageCount === 'undefined' || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1;
pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex));
return {
...old,
pageCount: newPageCount
pageIndex
};
}),
getPageOptions: utils.memo(() => [table.getPageCount()], pageCount => {
let pageOptions = [];
if (pageCount && pageCount > 0) {
pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i);
}
return pageOptions;
}, {
key: process.env.NODE_ENV === 'development' && 'getPageOptions',
debug: () => {
var _table$options$debugA;
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
}
}),
getCanPreviousPage: () => table.getState().pagination.pageIndex > 0,
getCanNextPage: () => {
const {
pageIndex
} = table.getState().pagination;
const pageCount = table.getPageCount();
if (pageCount === -1) {
return true;
}
if (pageCount === 0) {
return false;
}
return pageIndex < pageCount - 1;
},
previousPage: () => {
return table.setPageIndex(old => old - 1);
},
nextPage: () => {
return table.setPageIndex(old => {
return old + 1;
});
},
getPrePaginationRowModel: () => table.getExpandedRowModel(),
getPaginationRowModel: () => {
if (!table._getPaginationRowModel && table.options.getPaginationRowModel) {
table._getPaginationRowModel = table.options.getPaginationRowModel(table);
}
if (table.options.manualPagination || !table._getPaginationRowModel) {
return table.getPrePaginationRowModel();
}
return table._getPaginationRowModel();
},
getPageCount: () => {
var _table$options$pageCo2;
return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getPrePaginationRowModel().rows.length / table.getState().pagination.pageSize);
});
};
table.resetPageIndex = defaultState => {
var _table$initialState$p2, _table$initialState;
table.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = (_table$initialState = table.initialState) == null || (_table$initialState = _table$initialState.pagination) == null ? void 0 : _table$initialState.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex);
};
table.resetPageSize = defaultState => {
var _table$initialState$p3, _table$initialState2;
table.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p3 = (_table$initialState2 = table.initialState) == null || (_table$initialState2 = _table$initialState2.pagination) == null ? void 0 : _table$initialState2.pageSize) != null ? _table$initialState$p3 : defaultPageSize);
};
table.setPageSize = updater => {
table.setPagination(old => {
const pageSize = Math.max(1, utils.functionalUpdate(updater, old.pageSize));
const topRowIndex = old.pageSize * old.pageIndex;
const pageIndex = Math.floor(topRowIndex / pageSize);
return {
...old,
pageIndex,
pageSize
};
});
};
table.setPageCount = updater => table.setPagination(old => {
var _table$options$pageCo;
let newPageCount = utils.functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1);
if (typeof newPageCount === 'number') {
newPageCount = Math.max(-1, newPageCount);
}
return {
...old,
pageCount: newPageCount
};
});
table.getPageOptions = utils.memo(() => [table.getPageCount()], pageCount => {
let pageOptions = [];
if (pageCount && pageCount > 0) {
pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i);
}
return pageOptions;
}, {
key: process.env.NODE_ENV === 'development' && 'getPageOptions',
debug: () => {
var _table$options$debugA;
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
}
});
table.getCanPreviousPage = () => table.getState().pagination.pageIndex > 0;
table.getCanNextPage = () => {
const {
pageIndex
} = table.getState().pagination;
const pageCount = table.getPageCount();
if (pageCount === -1) {
return true;
}
if (pageCount === 0) {
return false;
}
return pageIndex < pageCount - 1;
};
table.previousPage = () => {
return table.setPageIndex(old => old - 1);
};
table.nextPage = () => {
return table.setPageIndex(old => {
return old + 1;
});
};
table.getPrePaginationRowModel = () => table.getExpandedRowModel();
table.getPaginationRowModel = () => {
if (!table._getPaginationRowModel && table.options.getPaginationRowModel) {
table._getPaginationRowModel = table.options.getPaginationRowModel(table);
}
if (table.options.manualPagination || !table._getPaginationRowModel) {
return table.getPrePaginationRowModel();
}
return table._getPaginationRowModel();
};
table.getPageCount = () => {
var _table$options$pageCo2;
return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getPrePaginationRowModel().rows.length / table.getState().pagination.pageSize);
};
}

@@ -166,0 +164,0 @@ };

@@ -36,136 +36,130 @@ /**

createColumn: (column, table) => {
return {
pin: position => {
const columnIds = column.getLeafColumns().map(d => d.id).filter(Boolean);
table.setColumnPinning(old => {
var _old$left3, _old$right3;
if (position === 'right') {
var _old$left, _old$right;
return {
left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter(d => !(columnIds != null && columnIds.includes(d))),
right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds]
};
}
if (position === 'left') {
var _old$left2, _old$right2;
return {
left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds],
right: ((_old$right2 = old == null ? void 0 : old.right) != null ? _old$right2 : []).filter(d => !(columnIds != null && columnIds.includes(d)))
};
}
column.pin = position => {
const columnIds = column.getLeafColumns().map(d => d.id).filter(Boolean);
table.setColumnPinning(old => {
var _old$left3, _old$right3;
if (position === 'right') {
var _old$left, _old$right;
return {
left: ((_old$left3 = old == null ? void 0 : old.left) != null ? _old$left3 : []).filter(d => !(columnIds != null && columnIds.includes(d))),
right: ((_old$right3 = old == null ? void 0 : old.right) != null ? _old$right3 : []).filter(d => !(columnIds != null && columnIds.includes(d)))
left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter(d => !(columnIds != null && columnIds.includes(d))),
right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds]
};
});
},
getCanPin: () => {
const leafColumns = column.getLeafColumns();
return leafColumns.some(d => {
var _d$columnDef$enablePi, _table$options$enable;
return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_table$options$enable = table.options.enablePinning) != null ? _table$options$enable : true);
});
},
getIsPinned: () => {
const leafColumnIds = column.getLeafColumns().map(d => d.id);
const {
left,
right
} = table.getState().columnPinning;
const isLeft = leafColumnIds.some(d => left == null ? void 0 : left.includes(d));
const isRight = leafColumnIds.some(d => right == null ? void 0 : right.includes(d));
return isLeft ? 'left' : isRight ? 'right' : false;
},
getPinnedIndex: () => {
var _table$getState$colum, _table$getState$colum2;
const position = column.getIsPinned();
return position ? (_table$getState$colum = (_table$getState$colum2 = table.getState().columnPinning) == null || (_table$getState$colum2 = _table$getState$colum2[position]) == null ? void 0 : _table$getState$colum2.indexOf(column.id)) != null ? _table$getState$colum : -1 : 0;
}
};
},
createRow: (row, table) => {
return {
getCenterVisibleCells: utils.memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => {
const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
return allCells.filter(d => !leftAndRight.includes(d.column.id));
}, {
key: process.env.NODE_ENV === 'production' && 'row.getCenterVisibleCells',
debug: () => {
var _table$options$debugA;
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
}
}),
getLeftVisibleCells: utils.memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left,,], (allCells, left) => {
const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({
...d,
position: 'left'
}));
return cells;
}, {
key: process.env.NODE_ENV === 'production' && 'row.getLeftVisibleCells',
debug: () => {
var _table$options$debugA2;
return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
if (position === 'left') {
var _old$left2, _old$right2;
return {
left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds],
right: ((_old$right2 = old == null ? void 0 : old.right) != null ? _old$right2 : []).filter(d => !(columnIds != null && columnIds.includes(d)))
};
}
}),
getRightVisibleCells: utils.memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => {
const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({
...d,
position: 'right'
}));
return cells;
}, {
key: process.env.NODE_ENV === 'production' && 'row.getRightVisibleCells',
debug: () => {
var _table$options$debugA3;
return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugRows;
}
})
return {
left: ((_old$left3 = old == null ? void 0 : old.left) != null ? _old$left3 : []).filter(d => !(columnIds != null && columnIds.includes(d))),
right: ((_old$right3 = old == null ? void 0 : old.right) != null ? _old$right3 : []).filter(d => !(columnIds != null && columnIds.includes(d)))
};
});
};
column.getCanPin = () => {
const leafColumns = column.getLeafColumns();
return leafColumns.some(d => {
var _d$columnDef$enablePi, _table$options$enable;
return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_table$options$enable = table.options.enablePinning) != null ? _table$options$enable : true);
});
};
column.getIsPinned = () => {
const leafColumnIds = column.getLeafColumns().map(d => d.id);
const {
left,
right
} = table.getState().columnPinning;
const isLeft = leafColumnIds.some(d => left == null ? void 0 : left.includes(d));
const isRight = leafColumnIds.some(d => right == null ? void 0 : right.includes(d));
return isLeft ? 'left' : isRight ? 'right' : false;
};
column.getPinnedIndex = () => {
var _table$getState$colum, _table$getState$colum2;
const position = column.getIsPinned();
return position ? (_table$getState$colum = (_table$getState$colum2 = table.getState().columnPinning) == null || (_table$getState$colum2 = _table$getState$colum2[position]) == null ? void 0 : _table$getState$colum2.indexOf(column.id)) != null ? _table$getState$colum : -1 : 0;
};
},
createRow: (row, table) => {
row.getCenterVisibleCells = utils.memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => {
const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
return allCells.filter(d => !leftAndRight.includes(d.column.id));
}, {
key: process.env.NODE_ENV === 'production' && 'row.getCenterVisibleCells',
debug: () => {
var _table$options$debugA;
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
}
});
row.getLeftVisibleCells = utils.memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left,,], (allCells, left) => {
const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({
...d,
position: 'left'
}));
return cells;
}, {
key: process.env.NODE_ENV === 'production' && 'row.getLeftVisibleCells',
debug: () => {
var _table$options$debugA2;
return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
}
});
row.getRightVisibleCells = utils.memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => {
const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({
...d,
position: 'right'
}));
return cells;
}, {
key: process.env.NODE_ENV === 'production' && 'row.getRightVisibleCells',
debug: () => {
var _table$options$debugA3;
return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugRows;
}
});
},
createTable: table => {
return {
setColumnPinning: updater => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater),
resetColumnPinning: defaultState => {
var _table$initialState$c, _table$initialState;
return table.setColumnPinning(defaultState ? getDefaultPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultPinningState());
},
getIsSomeColumnsPinned: position => {
var _pinningState$positio;
const pinningState = table.getState().columnPinning;
if (!position) {
var _pinningState$left, _pinningState$right;
return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length));
}
return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
},
getLeftLeafColumns: utils.memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {
return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
}, {
key: process.env.NODE_ENV === 'development' && 'getLeftLeafColumns',
debug: () => {
var _table$options$debugA4;
return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugColumns;
}
}),
getRightLeafColumns: utils.memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => {
return (right != null ? right : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
}, {
key: process.env.NODE_ENV === 'development' && 'getRightLeafColumns',
debug: () => {
var _table$options$debugA5;
return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugColumns;
}
}),
getCenterLeafColumns: utils.memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => {
const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
return allColumns.filter(d => !leftAndRight.includes(d.id));
}, {
key: process.env.NODE_ENV === 'development' && 'getCenterLeafColumns',
debug: () => {
var _table$options$debugA6;
return (_table$options$debugA6 = table.options.debugAll) != null ? _table$options$debugA6 : table.options.debugColumns;
}
})
table.setColumnPinning = updater => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater);
table.resetColumnPinning = defaultState => {
var _table$initialState$c, _table$initialState;
return table.setColumnPinning(defaultState ? getDefaultPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultPinningState());
};
table.getIsSomeColumnsPinned = position => {
var _pinningState$positio;
const pinningState = table.getState().columnPinning;
if (!position) {
var _pinningState$left, _pinningState$right;
return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length));
}
return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
};
table.getLeftLeafColumns = utils.memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {
return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
}, {
key: process.env.NODE_ENV === 'development' && 'getLeftLeafColumns',
debug: () => {
var _table$options$debugA4;
return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugColumns;
}
});
table.getRightLeafColumns = utils.memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => {
return (right != null ? right : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
}, {
key: process.env.NODE_ENV === 'development' && 'getRightLeafColumns',
debug: () => {
var _table$options$debugA5;
return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugColumns;
}
});
table.getCenterLeafColumns = utils.memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => {
const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
return allColumns.filter(d => !leftAndRight.includes(d.id));
}, {
key: process.env.NODE_ENV === 'development' && 'getCenterLeafColumns',
debug: () => {
var _table$options$debugA6;
return (_table$options$debugA6 = table.options.debugAll) != null ? _table$options$debugA6 : table.options.debugColumns;
}
});
}

@@ -172,0 +166,0 @@ };

@@ -39,275 +39,273 @@ /**

createTable: table => {
return {
setRowSelection: updater => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater),
resetRowSelection: defaultState => {
var _table$initialState$r;
return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {});
},
toggleAllRowsSelected: value => {
table.setRowSelection(old => {
value = typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected();
const rowSelection = {
...old
};
const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows;
// We don't use `mutateRowIsSelected` here for performance reasons.
// All of the rows are flat already, so it wouldn't be worth it
if (value) {
preGroupedFlatRows.forEach(row => {
if (!row.getCanSelect()) {
return;
}
rowSelection[row.id] = true;
});
} else {
preGroupedFlatRows.forEach(row => {
delete rowSelection[row.id];
});
}
return rowSelection;
});
},
toggleAllPageRowsSelected: value => table.setRowSelection(old => {
const resolvedValue = typeof value !== 'undefined' ? value : !table.getIsAllPageRowsSelected();
table.setRowSelection = updater => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater);
table.resetRowSelection = defaultState => {
var _table$initialState$r;
return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {});
};
table.toggleAllRowsSelected = value => {
table.setRowSelection(old => {
value = typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected();
const rowSelection = {
...old
};
table.getRowModel().rows.forEach(row => {
mutateRowIsSelected(rowSelection, row.id, resolvedValue, table);
});
const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows;
// We don't use `mutateRowIsSelected` here for performance reasons.
// All of the rows are flat already, so it wouldn't be worth it
if (value) {
preGroupedFlatRows.forEach(row => {
if (!row.getCanSelect()) {
return;
}
rowSelection[row.id] = true;
});
} else {
preGroupedFlatRows.forEach(row => {
delete rowSelection[row.id];
});
}
return rowSelection;
}),
// addRowSelectionRange: rowId => {
// const {
// rows,
// rowsById,
// options: { selectGroupingRows, selectSubRows },
// } = table
});
};
table.toggleAllPageRowsSelected = value => table.setRowSelection(old => {
const resolvedValue = typeof value !== 'undefined' ? value : !table.getIsAllPageRowsSelected();
const rowSelection = {
...old
};
table.getRowModel().rows.forEach(row => {
mutateRowIsSelected(rowSelection, row.id, resolvedValue, table);
});
return rowSelection;
});
// const findSelectedRow = (rows: Row[]) => {
// let found
// rows.find(d => {
// if (d.getIsSelected()) {
// found = d
// return true
// }
// const subFound = findSelectedRow(d.subRows || [])
// if (subFound) {
// found = subFound
// return true
// }
// return false
// })
// return found
// }
// addRowSelectionRange: rowId => {
// const {
// rows,
// rowsById,
// options: { selectGroupingRows, selectSubRows },
// } = table
// const firstRow = findSelectedRow(rows) || rows[0]
// const lastRow = rowsById[rowId]
// const findSelectedRow = (rows: Row[]) => {
// let found
// rows.find(d => {
// if (d.getIsSelected()) {
// found = d
// return true
// }
// const subFound = findSelectedRow(d.subRows || [])
// if (subFound) {
// found = subFound
// return true
// }
// return false
// })
// return found
// }
// let include = false
// const selectedRowIds = {}
// const firstRow = findSelectedRow(rows) || rows[0]
// const lastRow = rowsById[rowId]
// const addRow = (row: Row) => {
// mutateRowIsSelected(selectedRowIds, row.id, true, {
// rowsById,
// selectGroupingRows: selectGroupingRows!,
// selectSubRows: selectSubRows!,
// })
// }
// let include = false
// const selectedRowIds = {}
// table.rows.forEach(row => {
// const isFirstRow = row.id === firstRow.id
// const isLastRow = row.id === lastRow.id
// const addRow = (row: Row) => {
// mutateRowIsSelected(selectedRowIds, row.id, true, {
// rowsById,
// selectGroupingRows: selectGroupingRows!,
// selectSubRows: selectSubRows!,
// })
// }
// if (isFirstRow || isLastRow) {
// if (!include) {
// include = true
// } else if (include) {
// addRow(row)
// include = false
// }
// }
// table.rows.forEach(row => {
// const isFirstRow = row.id === firstRow.id
// const isLastRow = row.id === lastRow.id
// if (include) {
// addRow(row)
// }
// })
// if (isFirstRow || isLastRow) {
// if (!include) {
// include = true
// } else if (include) {
// addRow(row)
// include = false
// }
// }
// table.setRowSelection(selectedRowIds)
// },
getPreSelectedRowModel: () => table.getCoreRowModel(),
getSelectedRowModel: utils.memo(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => {
if (!Object.keys(rowSelection).length) {
return {
rows: [],
flatRows: [],
rowsById: {}
};
}
return selectRowsFn(table, rowModel);
}, {
key: process.env.NODE_ENV === 'development' && 'getSelectedRowModel',
debug: () => {
var _table$options$debugA;
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
}
}),
getFilteredSelectedRowModel: utils.memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => {
if (!Object.keys(rowSelection).length) {
return {
rows: [],
flatRows: [],
rowsById: {}
};
}
return selectRowsFn(table, rowModel);
}, {
key: process.env.NODE_ENV === 'production' && 'getFilteredSelectedRowModel',
debug: () => {
var _table$options$debugA2;
return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugTable;
}
}),
getGroupedSelectedRowModel: utils.memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => {
if (!Object.keys(rowSelection).length) {
return {
rows: [],
flatRows: [],
rowsById: {}
};
}
return selectRowsFn(table, rowModel);
}, {
key: process.env.NODE_ENV === 'production' && 'getGroupedSelectedRowModel',
debug: () => {
var _table$options$debugA3;
return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugTable;
}
}),
///
// if (include) {
// addRow(row)
// }
// })
// getGroupingRowCanSelect: rowId => {
// const row = table.getRow(rowId)
// table.setRowSelection(selectedRowIds)
// },
table.getPreSelectedRowModel = () => table.getCoreRowModel();
table.getSelectedRowModel = utils.memo(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => {
if (!Object.keys(rowSelection).length) {
return {
rows: [],
flatRows: [],
rowsById: {}
};
}
return selectRowsFn(table, rowModel);
}, {
key: process.env.NODE_ENV === 'development' && 'getSelectedRowModel',
debug: () => {
var _table$options$debugA;
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
}
});
table.getFilteredSelectedRowModel = utils.memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => {
if (!Object.keys(rowSelection).length) {
return {
rows: [],
flatRows: [],
rowsById: {}
};
}
return selectRowsFn(table, rowModel);
}, {
key: process.env.NODE_ENV === 'production' && 'getFilteredSelectedRowModel',
debug: () => {
var _table$options$debugA2;
return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugTable;
}
});
table.getGroupedSelectedRowModel = utils.memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => {
if (!Object.keys(rowSelection).length) {
return {
rows: [],
flatRows: [],
rowsById: {}
};
}
return selectRowsFn(table, rowModel);
}, {
key: process.env.NODE_ENV === 'production' && 'getGroupedSelectedRowModel',
debug: () => {
var _table$options$debugA3;
return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugTable;
}
});
// if (!row) {
// throw new Error()
// }
///
// if (typeof table.options.enableGroupingRowSelection === 'function') {
// return table.options.enableGroupingRowSelection(row)
// }
// getGroupingRowCanSelect: rowId => {
// const row = table.getRow(rowId)
// return table.options.enableGroupingRowSelection ?? false
// },
// if (!row) {
// throw new Error()
// }
getIsAllRowsSelected: () => {
const preGroupedFlatRows = table.getFilteredRowModel().flatRows;
const {
rowSelection
} = table.getState();
let isAllRowsSelected = Boolean(preGroupedFlatRows.length && Object.keys(rowSelection).length);
if (isAllRowsSelected) {
if (preGroupedFlatRows.some(row => row.getCanSelect() && !rowSelection[row.id])) {
isAllRowsSelected = false;
}
// if (typeof table.options.enableGroupingRowSelection === 'function') {
// return table.options.enableGroupingRowSelection(row)
// }
// return table.options.enableGroupingRowSelection ?? false
// },
table.getIsAllRowsSelected = () => {
const preGroupedFlatRows = table.getFilteredRowModel().flatRows;
const {
rowSelection
} = table.getState();
let isAllRowsSelected = Boolean(preGroupedFlatRows.length && Object.keys(rowSelection).length);
if (isAllRowsSelected) {
if (preGroupedFlatRows.some(row => row.getCanSelect() && !rowSelection[row.id])) {
isAllRowsSelected = false;
}
return isAllRowsSelected;
},
getIsAllPageRowsSelected: () => {
const paginationFlatRows = table.getPaginationRowModel().flatRows.filter(row => row.getCanSelect());
const {
rowSelection
} = table.getState();
let isAllPageRowsSelected = !!paginationFlatRows.length;
if (isAllPageRowsSelected && paginationFlatRows.some(row => !rowSelection[row.id])) {
isAllPageRowsSelected = false;
}
return isAllPageRowsSelected;
},
getIsSomeRowsSelected: () => {
var _table$getState$rowSe;
const totalSelected = Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length;
return totalSelected > 0 && totalSelected < table.getFilteredRowModel().flatRows.length;
},
getIsSomePageRowsSelected: () => {
const paginationFlatRows = table.getPaginationRowModel().flatRows;
return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.filter(row => row.getCanSelect()).some(d => d.getIsSelected() || d.getIsSomeSelected());
},
getToggleAllRowsSelectedHandler: () => {
return e => {
table.toggleAllRowsSelected(e.target.checked);
};
},
getToggleAllPageRowsSelectedHandler: () => {
return e => {
table.toggleAllPageRowsSelected(e.target.checked);
};
}
return isAllRowsSelected;
};
table.getIsAllPageRowsSelected = () => {
const paginationFlatRows = table.getPaginationRowModel().flatRows.filter(row => row.getCanSelect());
const {
rowSelection
} = table.getState();
let isAllPageRowsSelected = !!paginationFlatRows.length;
if (isAllPageRowsSelected && paginationFlatRows.some(row => !rowSelection[row.id])) {
isAllPageRowsSelected = false;
}
return isAllPageRowsSelected;
};
table.getIsSomeRowsSelected = () => {
var _table$getState$rowSe;
const totalSelected = Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length;
return totalSelected > 0 && totalSelected < table.getFilteredRowModel().flatRows.length;
};
table.getIsSomePageRowsSelected = () => {
const paginationFlatRows = table.getPaginationRowModel().flatRows;
return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.filter(row => row.getCanSelect()).some(d => d.getIsSelected() || d.getIsSomeSelected());
};
table.getToggleAllRowsSelectedHandler = () => {
return e => {
table.toggleAllRowsSelected(e.target.checked);
};
};
table.getToggleAllPageRowsSelectedHandler = () => {
return e => {
table.toggleAllPageRowsSelected(e.target.checked);
};
};
},
createRow: (row, table) => {
return {
toggleSelected: value => {
const isSelected = row.getIsSelected();
table.setRowSelection(old => {
value = typeof value !== 'undefined' ? value : !isSelected;
if (isSelected === value) {
return old;
}
const selectedRowIds = {
...old
};
mutateRowIsSelected(selectedRowIds, row.id, value, table);
return selectedRowIds;
});
},
getIsSelected: () => {
const {
rowSelection
} = table.getState();
return isRowSelected(row, rowSelection);
},
getIsSomeSelected: () => {
const {
rowSelection
} = table.getState();
return isSubRowSelected(row, rowSelection) === 'some';
},
getIsAllSubRowsSelected: () => {
const {
rowSelection
} = table.getState();
return isSubRowSelected(row, rowSelection) === 'all';
},
getCanSelect: () => {
var _table$options$enable;
if (typeof table.options.enableRowSelection === 'function') {
return table.options.enableRowSelection(row);
row.toggleSelected = value => {
const isSelected = row.getIsSelected();
table.setRowSelection(old => {
value = typeof value !== 'undefined' ? value : !isSelected;
if (isSelected === value) {
return old;
}
return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true;
},
getCanSelectSubRows: () => {
var _table$options$enable2;
if (typeof table.options.enableSubRowSelection === 'function') {
return table.options.enableSubRowSelection(row);
}
return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true;
},
getCanMultiSelect: () => {
var _table$options$enable3;
if (typeof table.options.enableMultiRowSelection === 'function') {
return table.options.enableMultiRowSelection(row);
}
return (_table$options$enable3 = table.options.enableMultiRowSelection) != null ? _table$options$enable3 : true;
},
getToggleSelectedHandler: () => {
const canSelect = row.getCanSelect();
return e => {
var _target;
if (!canSelect) return;
row.toggleSelected((_target = e.target) == null ? void 0 : _target.checked);
const selectedRowIds = {
...old
};
mutateRowIsSelected(selectedRowIds, row.id, value, table);
return selectedRowIds;
});
};
row.getIsSelected = () => {
const {
rowSelection
} = table.getState();
return isRowSelected(row, rowSelection);
};
row.getIsSomeSelected = () => {
const {
rowSelection
} = table.getState();
return isSubRowSelected(row, rowSelection) === 'some';
};
row.getIsAllSubRowsSelected = () => {
const {
rowSelection
} = table.getState();
return isSubRowSelected(row, rowSelection) === 'all';
};
row.getCanSelect = () => {
var _table$options$enable;
if (typeof table.options.enableRowSelection === 'function') {
return table.options.enableRowSelection(row);
}
return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true;
};
row.getCanSelectSubRows = () => {
var _table$options$enable2;
if (typeof table.options.enableSubRowSelection === 'function') {
return table.options.enableSubRowSelection(row);
}
return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true;
};
row.getCanMultiSelect = () => {
var _table$options$enable3;
if (typeof table.options.enableMultiRowSelection === 'function') {
return table.options.enableMultiRowSelection(row);
}
return (_table$options$enable3 = table.options.enableMultiRowSelection) != null ? _table$options$enable3 : true;
};
row.getToggleSelectedHandler = () => {
const canSelect = row.getCanSelect();
return e => {
var _target;
if (!canSelect) return;
row.toggleSelected((_target = e.target) == null ? void 0 : _target.checked);
};
};
}

@@ -314,0 +312,0 @@ };

@@ -42,187 +42,183 @@ /**

createColumn: (column, table) => {
return {
getAutoSortingFn: () => {
const firstRows = table.getFilteredRowModel().flatRows.slice(10);
let isString = false;
for (const row of firstRows) {
const value = row == null ? void 0 : row.getValue(column.id);
if (Object.prototype.toString.call(value) === '[object Date]') {
return sortingFns.sortingFns.datetime;
}
if (typeof value === 'string') {
isString = true;
if (value.split(sortingFns.reSplitAlphaNumeric).length > 1) {
return sortingFns.sortingFns.alphanumeric;
}
}
column.getAutoSortingFn = () => {
const firstRows = table.getFilteredRowModel().flatRows.slice(10);
let isString = false;
for (const row of firstRows) {
const value = row == null ? void 0 : row.getValue(column.id);
if (Object.prototype.toString.call(value) === '[object Date]') {
return sortingFns.sortingFns.datetime;
}
if (isString) {
return sortingFns.sortingFns.text;
}
return sortingFns.sortingFns.basic;
},
getAutoSortDir: () => {
const firstRow = table.getFilteredRowModel().flatRows[0];
const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
if (typeof value === 'string') {
return 'asc';
isString = true;
if (value.split(sortingFns.reSplitAlphaNumeric).length > 1) {
return sortingFns.sortingFns.alphanumeric;
}
}
return 'desc';
},
getSortingFn: () => {
var _table$options$sortin, _table$options$sortin2;
if (!column) {
throw new Error();
}
return utils.isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : (_table$options$sortin = (_table$options$sortin2 = table.options.sortingFns) == null ? void 0 : _table$options$sortin2[column.columnDef.sortingFn]) != null ? _table$options$sortin : sortingFns.sortingFns[column.columnDef.sortingFn];
},
toggleSorting: (desc, multi) => {
// if (column.columns.length) {
// column.columns.forEach((c, i) => {
// if (c.id) {
// table.toggleColumnSorting(c.id, undefined, multi || !!i)
// }
// })
// return
// }
}
if (isString) {
return sortingFns.sortingFns.text;
}
return sortingFns.sortingFns.basic;
};
column.getAutoSortDir = () => {
const firstRow = table.getFilteredRowModel().flatRows[0];
const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
if (typeof value === 'string') {
return 'asc';
}
return 'desc';
};
column.getSortingFn = () => {
var _table$options$sortin, _table$options$sortin2;
if (!column) {
throw new Error();
}
return utils.isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : (_table$options$sortin = (_table$options$sortin2 = table.options.sortingFns) == null ? void 0 : _table$options$sortin2[column.columnDef.sortingFn]) != null ? _table$options$sortin : sortingFns.sortingFns[column.columnDef.sortingFn];
};
column.toggleSorting = (desc, multi) => {
// if (column.columns.length) {
// column.columns.forEach((c, i) => {
// if (c.id) {
// table.toggleColumnSorting(c.id, undefined, multi || !!i)
// }
// })
// return
// }
// this needs to be outside of table.setSorting to be in sync with rerender
const nextSortingOrder = column.getNextSortingOrder();
const hasManualValue = typeof desc !== 'undefined' && desc !== null;
table.setSorting(old => {
// Find any existing sorting for this column
const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
const existingIndex = old == null ? void 0 : old.findIndex(d => d.id === column.id);
let newSorting = [];
// this needs to be outside of table.setSorting to be in sync with rerender
const nextSortingOrder = column.getNextSortingOrder();
const hasManualValue = typeof desc !== 'undefined' && desc !== null;
table.setSorting(old => {
// Find any existing sorting for this column
const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
const existingIndex = old == null ? void 0 : old.findIndex(d => d.id === column.id);
let newSorting = [];
// What should we do with this sort action?
let sortAction;
let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc';
// What should we do with this sort action?
let sortAction;
let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc';
// Multi-mode
if (old != null && old.length && column.getCanMultiSort() && multi) {
if (existingSorting) {
sortAction = 'toggle';
} else {
sortAction = 'add';
}
// Multi-mode
if (old != null && old.length && column.getCanMultiSort() && multi) {
if (existingSorting) {
sortAction = 'toggle';
} else {
// Normal mode
if (old != null && old.length && existingIndex !== old.length - 1) {
sortAction = 'replace';
} else if (existingSorting) {
sortAction = 'toggle';
} else {
sortAction = 'replace';
}
sortAction = 'add';
}
} else {
// Normal mode
if (old != null && old.length && existingIndex !== old.length - 1) {
sortAction = 'replace';
} else if (existingSorting) {
sortAction = 'toggle';
} else {
sortAction = 'replace';
}
}
// Handle toggle states that will remove the sorting
if (sortAction === 'toggle') {
// If we are "actually" toggling (not a manual set value), should we remove the sorting?
if (!hasManualValue) {
// Is our intention to remove?
if (!nextSortingOrder) {
sortAction = 'remove';
}
// Handle toggle states that will remove the sorting
if (sortAction === 'toggle') {
// If we are "actually" toggling (not a manual set value), should we remove the sorting?
if (!hasManualValue) {
// Is our intention to remove?
if (!nextSortingOrder) {
sortAction = 'remove';
}
}
if (sortAction === 'add') {
var _table$options$maxMul;
newSorting = [...old, {
id: column.id,
desc: nextDesc
}];
// Take latest n columns
newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER));
} else if (sortAction === 'toggle') {
// This flips (or sets) the
newSorting = old.map(d => {
if (d.id === column.id) {
return {
...d,
desc: nextDesc
};
}
return d;
});
} else if (sortAction === 'remove') {
newSorting = old.filter(d => d.id !== column.id);
} else {
newSorting = [{
id: column.id,
desc: nextDesc
}];
}
return newSorting;
});
},
getFirstSortDir: () => {
var _ref, _column$columnDef$sor;
const sortDescFirst = (_ref = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column.getAutoSortDir() === 'desc';
return sortDescFirst ? 'desc' : 'asc';
},
getNextSortingOrder: multi => {
var _table$options$enable, _table$options$enable2;
const firstSortDirection = column.getFirstSortDir();
const isSorted = column.getIsSorted();
if (!isSorted) {
return firstSortDirection;
}
if (isSorted !== firstSortDirection && ((_table$options$enable = table.options.enableSortingRemoval) != null ? _table$options$enable : true) && (
// If enableSortRemove, enable in general
multi ? (_table$options$enable2 = table.options.enableMultiRemove) != null ? _table$options$enable2 : true : true) // If multi, don't allow if enableMultiRemove))
) {
return false;
if (sortAction === 'add') {
var _table$options$maxMul;
newSorting = [...old, {
id: column.id,
desc: nextDesc
}];
// Take latest n columns
newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER));
} else if (sortAction === 'toggle') {
// This flips (or sets) the
newSorting = old.map(d => {
if (d.id === column.id) {
return {
...d,
desc: nextDesc
};
}
return d;
});
} else if (sortAction === 'remove') {
newSorting = old.filter(d => d.id !== column.id);
} else {
newSorting = [{
id: column.id,
desc: nextDesc
}];
}
return isSorted === 'desc' ? 'asc' : 'desc';
},
getCanSort: () => {
var _column$columnDef$ena, _table$options$enable3;
return ((_column$columnDef$ena = column.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_table$options$enable3 = table.options.enableSorting) != null ? _table$options$enable3 : true) && !!column.accessorFn;
},
getCanMultiSort: () => {
var _ref2, _column$columnDef$ena2;
return (_ref2 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column.accessorFn;
},
getIsSorted: () => {
var _table$getState$sorti;
const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find(d => d.id === column.id);
return !columnSort ? false : columnSort.desc ? 'desc' : 'asc';
},
getSortIndex: () => {
var _table$getState$sorti2, _table$getState$sorti3;
return (_table$getState$sorti2 = (_table$getState$sorti3 = table.getState().sorting) == null ? void 0 : _table$getState$sorti3.findIndex(d => d.id === column.id)) != null ? _table$getState$sorti2 : -1;
},
clearSorting: () => {
//clear sorting for just 1 column
table.setSorting(old => old != null && old.length ? old.filter(d => d.id !== column.id) : []);
},
getToggleSortingHandler: () => {
const canSort = column.getCanSort();
return e => {
if (!canSort) return;
e.persist == null || e.persist();
column.toggleSorting == null || column.toggleSorting(undefined, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e) : false);
};
return newSorting;
});
};
column.getFirstSortDir = () => {
var _ref, _column$columnDef$sor;
const sortDescFirst = (_ref = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column.getAutoSortDir() === 'desc';
return sortDescFirst ? 'desc' : 'asc';
};
column.getNextSortingOrder = multi => {
var _table$options$enable, _table$options$enable2;
const firstSortDirection = column.getFirstSortDir();
const isSorted = column.getIsSorted();
if (!isSorted) {
return firstSortDirection;
}
if (isSorted !== firstSortDirection && ((_table$options$enable = table.options.enableSortingRemoval) != null ? _table$options$enable : true) && (
// If enableSortRemove, enable in general
multi ? (_table$options$enable2 = table.options.enableMultiRemove) != null ? _table$options$enable2 : true : true) // If multi, don't allow if enableMultiRemove))
) {
return false;
}
return isSorted === 'desc' ? 'asc' : 'desc';
};
column.getCanSort = () => {
var _column$columnDef$ena, _table$options$enable3;
return ((_column$columnDef$ena = column.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_table$options$enable3 = table.options.enableSorting) != null ? _table$options$enable3 : true) && !!column.accessorFn;
};
column.getCanMultiSort = () => {
var _ref2, _column$columnDef$ena2;
return (_ref2 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column.accessorFn;
};
column.getIsSorted = () => {
var _table$getState$sorti;
const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find(d => d.id === column.id);
return !columnSort ? false : columnSort.desc ? 'desc' : 'asc';
};
column.getSortIndex = () => {
var _table$getState$sorti2, _table$getState$sorti3;
return (_table$getState$sorti2 = (_table$getState$sorti3 = table.getState().sorting) == null ? void 0 : _table$getState$sorti3.findIndex(d => d.id === column.id)) != null ? _table$getState$sorti2 : -1;
};
column.clearSorting = () => {
//clear sorting for just 1 column
table.setSorting(old => old != null && old.length ? old.filter(d => d.id !== column.id) : []);
};
column.getToggleSortingHandler = () => {
const canSort = column.getCanSort();
return e => {
if (!canSort) return;
e.persist == null || e.persist();
column.toggleSorting == null || column.toggleSorting(undefined, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e) : false);
};
};
},
createTable: table => {
return {
setSorting: updater => table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater),
resetSorting: defaultState => {
var _table$initialState$s, _table$initialState;
table.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []);
},
getPreSortedRowModel: () => table.getGroupedRowModel(),
getSortedRowModel: () => {
if (!table._getSortedRowModel && table.options.getSortedRowModel) {
table._getSortedRowModel = table.options.getSortedRowModel(table);
}
if (table.options.manualSorting || !table._getSortedRowModel) {
return table.getPreSortedRowModel();
}
return table._getSortedRowModel();
table.setSorting = updater => table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater);
table.resetSorting = defaultState => {
var _table$initialState$s, _table$initialState;
table.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []);
};
table.getPreSortedRowModel = () => table.getGroupedRowModel();
table.getSortedRowModel = () => {
if (!table._getSortedRowModel && table.options.getSortedRowModel) {
table._getSortedRowModel = table.options.getSortedRowModel(table);
}
if (table.options.manualSorting || !table._getSortedRowModel) {
return table.getPreSortedRowModel();
}
return table._getSortedRowModel();
};

@@ -229,0 +225,0 @@ }

@@ -32,45 +32,41 @@ /**

createColumn: (column, table) => {
return {
toggleVisibility: value => {
if (column.getCanHide()) {
table.setColumnVisibility(old => ({
...old,
[column.id]: value != null ? value : !column.getIsVisible()
}));
}
},
getIsVisible: () => {
var _table$getState$colum, _table$getState$colum2;
return (_table$getState$colum = (_table$getState$colum2 = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum2[column.id]) != null ? _table$getState$colum : true;
},
getCanHide: () => {
var _column$columnDef$ena, _table$options$enable;
return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true);
},
getToggleVisibilityHandler: () => {
return e => {
column.toggleVisibility == null || column.toggleVisibility(e.target.checked);
};
column.toggleVisibility = value => {
if (column.getCanHide()) {
table.setColumnVisibility(old => ({
...old,
[column.id]: value != null ? value : !column.getIsVisible()
}));
}
};
column.getIsVisible = () => {
var _table$getState$colum, _table$getState$colum2;
return (_table$getState$colum = (_table$getState$colum2 = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum2[column.id]) != null ? _table$getState$colum : true;
};
column.getCanHide = () => {
var _column$columnDef$ena, _table$options$enable;
return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true);
};
column.getToggleVisibilityHandler = () => {
return e => {
column.toggleVisibility == null || column.toggleVisibility(e.target.checked);
};
};
},
createRow: (row, table) => {
return {
_getAllVisibleCells: utils.memo(() => [row.getAllCells(), table.getState().columnVisibility], cells => {
return cells.filter(cell => cell.column.getIsVisible());
}, {
key: process.env.NODE_ENV === 'production' && 'row._getAllVisibleCells',
debug: () => {
var _table$options$debugA;
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
}
}),
getVisibleCells: utils.memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], {
key: process.env.NODE_ENV === 'development' && 'row.getVisibleCells',
debug: () => {
var _table$options$debugA2;
return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
}
})
};
row._getAllVisibleCells = utils.memo(() => [row.getAllCells(), table.getState().columnVisibility], cells => {
return cells.filter(cell => cell.column.getIsVisible());
}, {
key: process.env.NODE_ENV === 'production' && 'row._getAllVisibleCells',
debug: () => {
var _table$options$debugA;
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
}
});
row.getVisibleCells = utils.memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], {
key: process.env.NODE_ENV === 'development' && 'row.getVisibleCells',
debug: () => {
var _table$options$debugA2;
return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
}
});
},

@@ -89,30 +85,28 @@ createTable: table => {

};
return {
getVisibleFlatColumns: makeVisibleColumnsMethod('getVisibleFlatColumns', () => table.getAllFlatColumns()),
getVisibleLeafColumns: makeVisibleColumnsMethod('getVisibleLeafColumns', () => table.getAllLeafColumns()),
getLeftVisibleLeafColumns: makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => table.getLeftLeafColumns()),
getRightVisibleLeafColumns: makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => table.getRightLeafColumns()),
getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => table.getCenterLeafColumns()),
setColumnVisibility: updater => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater),
resetColumnVisibility: defaultState => {
var _table$initialState$c;
table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {});
},
toggleAllColumnsVisible: value => {
var _value;
value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible();
table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({
...obj,
[column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
}), {}));
},
getIsAllColumnsVisible: () => !table.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())),
getIsSomeColumnsVisible: () => table.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()),
getToggleAllColumnsVisibilityHandler: () => {
return e => {
var _target;
table.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
};
}
table.getVisibleFlatColumns = makeVisibleColumnsMethod('getVisibleFlatColumns', () => table.getAllFlatColumns());
table.getVisibleLeafColumns = makeVisibleColumnsMethod('getVisibleLeafColumns', () => table.getAllLeafColumns());
table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => table.getLeftLeafColumns());
table.getRightVisibleLeafColumns = makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => table.getRightLeafColumns());
table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => table.getCenterLeafColumns());
table.setColumnVisibility = updater => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater);
table.resetColumnVisibility = defaultState => {
var _table$initialState$c;
table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {});
};
table.toggleAllColumnsVisible = value => {
var _value;
value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible();
table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({
...obj,
[column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
}), {}));
};
table.getIsAllColumnsVisible = () => !table.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible()));
table.getIsSomeColumnsVisible = () => table.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible());
table.getToggleAllColumnsVisibilityHandler = () => {
return e => {
var _target;
table.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
};
};
}

@@ -119,0 +113,0 @@ };

@@ -11,3 +11,3 @@ /**

*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TableCore={})}(this,(function(e){"use strict";function t(e,t){return"function"==typeof e?e(t):e}function n(e,n){return l=>{n.setState((n=>({...n,[e]:t(l,n[e])})))}}function l(e){return e instanceof Function}function o(e){return Array.isArray(e)&&e.every((e=>"number"==typeof e))}function i(e,t){const n=[],l=e=>{e.forEach((e=>{n.push(e);const o=t(e);null!=o&&o.length&&l(o)}))};return l(e),n}function r(e,t,n){let l,o=[];return()=>{let i;n.key&&n.debug&&(i=Date.now());const r=e();if(!(r.length!==o.length||r.some(((e,t)=>o[t]!==e))))return l;let u;if(o=r,n.key&&n.debug&&(u=Date.now()),l=t(...r),null==n||null==n.onChange||n.onChange(l),n.key&&n.debug&&null!=n&&n.debug()){const e=Math.round(100*(Date.now()-i))/100,t=Math.round(100*(Date.now()-u))/100,l=t/16,o=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${o(t,5)} /${o(e,5)} ms`,`\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(0,Math.min(120-120*l,120))}deg 100% 31%);`,null==n?void 0:n.key)}return l}}function u(e,t,n,l){var o,i;const u={...e._getDefaultColumnDef(),...t},a=u.accessorKey;let s,g=null!=(o=null!=(i=u.id)?i:a?a.replace(".","_"):void 0)?o:"string"==typeof u.header?u.header:void 0;if(u.accessorFn?s=u.accessorFn:a&&(s=a.includes(".")?e=>{let t=e;for(const e of a.split(".")){var n;t=null==(n=t)?void 0:n[e]}return t}:e=>e[u.accessorKey]),!g)throw new Error;let d={id:`${String(g)}`,accessorFn:s,parent:l,depth:n,columnDef:u,columns:[],getFlatColumns:r((()=>[!0]),(()=>{var e;return[d,...null==(e=d.columns)?void 0:e.flatMap((e=>e.getFlatColumns()))]}),{key:"column.getFlatColumns",debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugColumns}}),getLeafColumns:r((()=>[e._getOrderColumnsFn()]),(e=>{var t;if(null!=(t=d.columns)&&t.length){let t=d.columns.flatMap((e=>e.getLeafColumns()));return e(t)}return[d]}),{key:"column.getLeafColumns",debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugColumns}})};return d=e._features.reduce(((t,n)=>Object.assign(t,null==n.createColumn?void 0:n.createColumn(d,e))),d),d}function a(e,t,n){var l;let o={id:null!=(l=n.id)?l:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(o),e},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach((t=>{Object.assign(o,null==t.createHeader?void 0:t.createHeader(o,e))})),o}const s={createTable:e=>({getHeaderGroups:r((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right]),((t,n,l,o)=>{var i,r;const u=null!=(i=null==l?void 0:l.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?i:[],a=null!=(r=null==o?void 0:o.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?r:[];return g(t,[...u,...n.filter((e=>!(null!=l&&l.includes(e.id)||null!=o&&o.includes(e.id)))),...a],e)}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getCenterHeaderGroups:r((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right]),((t,n,l,o)=>g(t,n=n.filter((e=>!(null!=l&&l.includes(e.id)||null!=o&&o.includes(e.id)))),e,"center")),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getLeftHeaderGroups:r((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left]),((t,n,l)=>{var o;return g(t,null!=(o=null==l?void 0:l.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?o:[],e,"left")}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getRightHeaderGroups:r((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right]),((t,n,l)=>{var o;return g(t,null!=(o=null==l?void 0:l.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?o:[],e,"right")}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getFooterGroups:r((()=>[e.getHeaderGroups()]),(e=>[...e].reverse()),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getLeftFooterGroups:r((()=>[e.getLeftHeaderGroups()]),(e=>[...e].reverse()),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getCenterFooterGroups:r((()=>[e.getCenterHeaderGroups()]),(e=>[...e].reverse()),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getRightFooterGroups:r((()=>[e.getRightHeaderGroups()]),(e=>[...e].reverse()),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getFlatHeaders:r((()=>[e.getHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getLeftFlatHeaders:r((()=>[e.getLeftHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getCenterFlatHeaders:r((()=>[e.getCenterHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getRightFlatHeaders:r((()=>[e.getRightHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getCenterLeafHeaders:r((()=>[e.getCenterFlatHeaders()]),(e=>e.filter((e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}))),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getLeftLeafHeaders:r((()=>[e.getLeftFlatHeaders()]),(e=>e.filter((e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}))),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getRightLeafHeaders:r((()=>[e.getRightFlatHeaders()]),(e=>e.filter((e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}))),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),getLeafHeaders:r((()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()]),((e,t,n)=>{var l,o,i,r,u,a;return[...null!=(l=null==(o=e[0])?void 0:o.headers)?l:[],...null!=(i=null==(r=t[0])?void 0:r.headers)?i:[],...null!=(u=null==(a=n[0])?void 0:a.headers)?u:[]].map((e=>e.getLeafHeaders())).flat()}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}})})};function g(e,t,n,l){var o,i;let r=0;const u=function(e,t){void 0===t&&(t=1),r=Math.max(r,t),e.filter((e=>e.getIsVisible())).forEach((e=>{var n;null!=(n=e.columns)&&n.length&&u(e.columns,t+1)}),0)};u(e);let s=[];const g=(e,t)=>{const o={depth:t,id:[l,`${t}`].filter(Boolean).join("_"),headers:[]},i=[];e.forEach((e=>{const r=[...i].reverse()[0];let u,s=!1;if(e.column.depth===o.depth&&e.column.parent?u=e.column.parent:(u=e.column,s=!0),r&&(null==r?void 0:r.column)===u)r.subHeaders.push(e);else{const o=a(n,u,{id:[l,t,u.id,null==e?void 0:e.id].filter(Boolean).join("_"),isPlaceholder:s,placeholderId:s?`${i.filter((e=>e.column===u)).length}`:void 0,depth:t,index:i.length});o.subHeaders.push(e),i.push(o)}o.headers.push(e),e.headerGroup=o})),s.push(o),t>0&&g(i,t-1)},d=t.map(((e,t)=>a(n,e,{depth:r,index:t})));g(d,r-1),s.reverse();const c=e=>e.filter((e=>e.column.getIsVisible())).map((e=>{let t=0,n=0,l=[0];e.subHeaders&&e.subHeaders.length?(l=[],c(e.subHeaders).forEach((e=>{let{colSpan:n,rowSpan:o}=e;t+=n,l.push(o)}))):t=1;return n+=Math.min(...l),e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}}));return c(null!=(o=null==(i=s[0])?void 0:i.headers)?o:[]),s}const d={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},c={getDefaultColumnDef:()=>d,getInitialState:e=>({columnSizing:{},columnSizingInfo:{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]},...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",onColumnSizingChange:n("columnSizing",e),onColumnSizingInfoChange:n("columnSizingInfo",e)}),createColumn:(e,t)=>({getSize:()=>{var n,l,o;const i=t.getState().columnSizing[e.id];return Math.min(Math.max(null!=(n=e.columnDef.minSize)?n:d.minSize,null!=(l=null!=i?i:e.columnDef.size)?l:d.size),null!=(o=e.columnDef.maxSize)?o:d.maxSize)},getStart:n=>{const l=n?"left"===n?t.getLeftVisibleLeafColumns():t.getRightVisibleLeafColumns():t.getVisibleLeafColumns(),o=l.findIndex((t=>t.id===e.id));if(o>0){const e=l[o-1];return e.getStart(n)+e.getSize()}return 0},resetSize:()=>{t.setColumnSizing((t=>{let{[e.id]:n,...l}=t;return l}))},getCanResize:()=>{var n,l;return(null==(n=e.columnDef.enableResizing)||n)&&(null==(l=t.options.enableColumnResizing)||l)},getIsResizing:()=>t.getState().columnSizingInfo.isResizingColumn===e.id}),createHeader:(e,t)=>({getSize:()=>{let t=0;const n=e=>{var l;e.subHeaders.length?e.subHeaders.forEach(n):t+=null!=(l=e.column.getSize())?l:0};return n(e),t},getStart:()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},getResizeHandler:()=>{const n=t.getColumn(e.column.id),l=null==n?void 0:n.getCanResize();return o=>{if(!n||!l)return;if(null==o.persist||o.persist(),m(o)&&o.touches&&o.touches.length>1)return;const i=e.getSize(),r=e?e.getLeafHeaders().map((e=>[e.column.id,e.column.getSize()])):[[n.id,n.getSize()]],u=m(o)?Math.round(o.touches[0].clientX):o.clientX,a={},s=(e,n)=>{"number"==typeof n&&(t.setColumnSizingInfo((e=>{var t,l;const o=n-(null!=(t=null==e?void 0:e.startOffset)?t:0),i=Math.max(o/(null!=(l=null==e?void 0:e.startSize)?l:0),-.999999);return e.columnSizingStart.forEach((e=>{let[t,n]=e;a[t]=Math.round(100*Math.max(n+n*i,0))/100})),{...e,deltaOffset:o,deltaPercentage:i}})),"onChange"!==t.options.columnResizeMode&&"end"!==e||t.setColumnSizing((e=>({...e,...a}))))},g=e=>s("move",e),d=e=>{s("end",e),t.setColumnSizingInfo((e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]})))},c={moveHandler:e=>g(e.clientX),upHandler:e=>{document.removeEventListener("mousemove",c.moveHandler),document.removeEventListener("mouseup",c.upHandler),d(e.clientX)}},p={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),g(e.touches[0].clientX),!1),upHandler:e=>{var t;document.removeEventListener("touchmove",p.moveHandler),document.removeEventListener("touchend",p.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),d(null==(t=e.touches[0])?void 0:t.clientX)}},b=!!f()&&{passive:!1};m(o)?(document.addEventListener("touchmove",p.moveHandler,b),document.addEventListener("touchend",p.upHandler,b)):(document.addEventListener("mousemove",c.moveHandler,b),document.addEventListener("mouseup",c.upHandler,b)),t.setColumnSizingInfo((e=>({...e,startOffset:u,startSize:i,deltaOffset:0,deltaPercentage:0,columnSizingStart:r,isResizingColumn:n.id})))}}}),createTable:e=>({setColumnSizing:t=>null==e.options.onColumnSizingChange?void 0:e.options.onColumnSizingChange(t),setColumnSizingInfo:t=>null==e.options.onColumnSizingInfoChange?void 0:e.options.onColumnSizingInfoChange(t),resetColumnSizing:t=>{var n;e.setColumnSizing(t?{}:null!=(n=e.initialState.columnSizing)?n:{})},resetHeaderSizeInfo:t=>{var n;e.setColumnSizingInfo(t?{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}:null!=(n=e.initialState.columnSizingInfo)?n:{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]})},getTotalSize:()=>{var t,n;return null!=(t=null==(n=e.getHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0},getLeftTotalSize:()=>{var t,n;return null!=(t=null==(n=e.getLeftHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0},getCenterTotalSize:()=>{var t,n;return null!=(t=null==(n=e.getCenterHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0},getRightTotalSize:()=>{var t,n;return null!=(t=null==(n=e.getRightHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0}})};let p=null;function f(){if("boolean"==typeof p)return p;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch(t){e=!1}return p=e,p}function m(e){return"touchstart"===e.type}const b={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:n("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;return{_autoResetExpanded:()=>{var l,o;if(t){if(null!=(l=null!=(o=e.options.autoResetAll)?o:e.options.autoResetExpanded)?l:!e.options.manualExpanding){if(n)return;n=!0,e._queue((()=>{e.resetExpanded(),n=!1}))}}else e._queue((()=>{t=!0}))},setExpanded:t=>null==e.options.onExpandedChange?void 0:e.options.onExpandedChange(t),toggleAllRowsExpanded:t=>{(null!=t?t:!e.getIsAllRowsExpanded())?e.setExpanded(!0):e.setExpanded({})},resetExpanded:t=>{var n,l;e.setExpanded(t?{}:null!=(n=null==(l=e.initialState)?void 0:l.expanded)?n:{})},getCanSomeRowsExpand:()=>e.getPrePaginationRowModel().flatRows.some((e=>e.getCanExpand())),getToggleAllRowsExpandedHandler:()=>t=>{null==t.persist||t.persist(),e.toggleAllRowsExpanded()},getIsSomeRowsExpanded:()=>{const t=e.getState().expanded;return!0===t||Object.values(t).some(Boolean)},getIsAllRowsExpanded:()=>{const t=e.getState().expanded;return"boolean"==typeof t?!0===t:!!Object.keys(t).length&&!e.getRowModel().flatRows.some((e=>!e.getIsExpanded()))},getExpandedDepth:()=>{let t=0;return(!0===e.getState().expanded?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach((e=>{const n=e.split(".");t=Math.max(t,n.length)})),t},getPreExpandedRowModel:()=>e.getSortedRowModel(),getExpandedRowModel:()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())}},createRow:(e,t)=>({toggleExpanded:n=>{t.setExpanded((l=>{var o;const i=!0===l||!(null==l||!l[e.id]);let r={};if(!0===l?Object.keys(t.getRowModel().rowsById).forEach((e=>{r[e]=!0})):r=l,n=null!=(o=n)?o:!i,!i&&n)return{...r,[e.id]:!0};if(i&&!n){const{[e.id]:t,...n}=r;return n}return l}))},getIsExpanded:()=>{var n;const l=t.getState().expanded;return!!(null!=(n=null==t.options.getIsRowExpanded?void 0:t.options.getIsRowExpanded(e))?n:!0===l||(null==l?void 0:l[e.id]))},getCanExpand:()=>{var n,l,o;return null!=(n=null==t.options.getRowCanExpand?void 0:t.options.getRowCanExpand(e))?n:(null==(l=t.options.enableExpanding)||l)&&!(null==(o=e.subRows)||!o.length)},getToggleExpandedHandler:()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}})},v=(e,t,n)=>{var l;const o=n.toLowerCase();return Boolean(null==(l=e.getValue(t))||null==(l=l.toString())||null==(l=l.toLowerCase())?void 0:l.includes(o))};v.autoRemove=e=>I(e);const w=(e,t,n)=>{var l;return Boolean(null==(l=e.getValue(t))||null==(l=l.toString())?void 0:l.includes(n))};w.autoRemove=e=>I(e);const h=(e,t,n)=>{var l;return(null==(l=e.getValue(t))||null==(l=l.toString())?void 0:l.toLowerCase())===(null==n?void 0:n.toLowerCase())};h.autoRemove=e=>I(e);const C=(e,t,n)=>{var l;return null==(l=e.getValue(t))?void 0:l.includes(n)};C.autoRemove=e=>I(e)||!(null!=e&&e.length);const S=(e,t,n)=>!n.some((n=>{var l;return!(null!=(l=e.getValue(t))&&l.includes(n))}));S.autoRemove=e=>I(e)||!(null!=e&&e.length);const R=(e,t,n)=>n.some((n=>{var l;return null==(l=e.getValue(t))?void 0:l.includes(n)}));R.autoRemove=e=>I(e)||!(null!=e&&e.length);const F=(e,t,n)=>e.getValue(t)===n;F.autoRemove=e=>I(e);const M=(e,t,n)=>e.getValue(t)==n;M.autoRemove=e=>I(e);const V=(e,t,n)=>{let[l,o]=n;const i=e.getValue(t);return i>=l&&i<=o};V.resolveFilterValue=e=>{let[t,n]=e,l="number"!=typeof t?parseFloat(t):t,o="number"!=typeof n?parseFloat(n):n,i=null===t||Number.isNaN(l)?-1/0:l,r=null===n||Number.isNaN(o)?1/0:o;if(i>r){const e=i;i=r,r=e}return[i,r]},V.autoRemove=e=>I(e)||I(e[0])&&I(e[1]);const y={includesString:v,includesStringSensitive:w,equalsString:h,arrIncludes:C,arrIncludesAll:S,arrIncludesSome:R,equals:F,weakEquals:M,inNumberRange:V};function I(e){return null==e||""===e}const x={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:n("columnFilters",e),onGlobalFilterChange:n("globalFilter",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100,globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const l=null==(n=e.getCoreRowModel().flatRows[0])||null==(n=n._getAllCellsByColumnId()[t.id])?void 0:n.getValue();return"string"==typeof l||"number"==typeof l}}),createColumn:(e,n)=>({getAutoFilterFn:()=>{const t=n.getCoreRowModel().flatRows[0],l=null==t?void 0:t.getValue(e.id);return"string"==typeof l?y.includesString:"number"==typeof l?y.inNumberRange:"boolean"==typeof l||null!==l&&"object"==typeof l?y.equals:Array.isArray(l)?y.arrIncludes:y.weakEquals},getFilterFn:()=>{var t,o;return l(e.columnDef.filterFn)?e.columnDef.filterFn:"auto"===e.columnDef.filterFn?e.getAutoFilterFn():null!=(t=null==(o=n.options.filterFns)?void 0:o[e.columnDef.filterFn])?t:y[e.columnDef.filterFn]},getCanFilter:()=>{var t,l,o;return(null==(t=e.columnDef.enableColumnFilter)||t)&&(null==(l=n.options.enableColumnFilters)||l)&&(null==(o=n.options.enableFilters)||o)&&!!e.accessorFn},getCanGlobalFilter:()=>{var t,l,o,i;return(null==(t=e.columnDef.enableGlobalFilter)||t)&&(null==(l=n.options.enableGlobalFilter)||l)&&(null==(o=n.options.enableFilters)||o)&&(null==(i=null==n.options.getColumnCanGlobalFilter?void 0:n.options.getColumnCanGlobalFilter(e))||i)&&!!e.accessorFn},getIsFiltered:()=>e.getFilterIndex()>-1,getFilterValue:()=>{var t;return null==(t=n.getState().columnFilters)||null==(t=t.find((t=>t.id===e.id)))?void 0:t.value},getFilterIndex:()=>{var t,l;return null!=(t=null==(l=n.getState().columnFilters)?void 0:l.findIndex((t=>t.id===e.id)))?t:-1},setFilterValue:l=>{n.setColumnFilters((n=>{const o=e.getFilterFn(),i=null==n?void 0:n.find((t=>t.id===e.id)),r=t(l,i?i.value:void 0);var u;if(_(o,r,e))return null!=(u=null==n?void 0:n.filter((t=>t.id!==e.id)))?u:[];const a={id:e.id,value:r};var s;return i?null!=(s=null==n?void 0:n.map((t=>t.id===e.id?a:t)))?s:[]:null!=n&&n.length?[...n,a]:[a]}))},_getFacetedRowModel:n.options.getFacetedRowModel&&n.options.getFacetedRowModel(n,e.id),getFacetedRowModel:()=>e._getFacetedRowModel?e._getFacetedRowModel():n.getPreFilteredRowModel(),_getFacetedUniqueValues:n.options.getFacetedUniqueValues&&n.options.getFacetedUniqueValues(n,e.id),getFacetedUniqueValues:()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,_getFacetedMinMaxValues:n.options.getFacetedMinMaxValues&&n.options.getFacetedMinMaxValues(n,e.id),getFacetedMinMaxValues:()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}),createRow:(e,t)=>({columnFilters:{},columnFiltersMeta:{}}),createTable:e=>({getGlobalAutoFilterFn:()=>y.includesString,getGlobalFilterFn:()=>{var t,n;const{globalFilterFn:o}=e.options;return l(o)?o:"auto"===o?e.getGlobalAutoFilterFn():null!=(t=null==(n=e.options.filterFns)?void 0:n[o])?t:y[o]},setColumnFilters:n=>{const l=e.getAllLeafColumns();null==e.options.onColumnFiltersChange||e.options.onColumnFiltersChange((e=>{var o;return null==(o=t(n,e))?void 0:o.filter((e=>{const t=l.find((t=>t.id===e.id));if(t){if(_(t.getFilterFn(),e.value,t))return!1}return!0}))}))},setGlobalFilter:t=>{null==e.options.onGlobalFilterChange||e.options.onGlobalFilterChange(t)},resetGlobalFilter:t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)},resetColumnFilters:t=>{var n,l;e.setColumnFilters(t?[]:null!=(n=null==(l=e.initialState)?void 0:l.columnFilters)?n:[])},getPreFilteredRowModel:()=>e.getCoreRowModel(),getFilteredRowModel:()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel()),_getGlobalFacetedRowModel:e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),getGlobalFacetedRowModel:()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),_getGlobalFacetedUniqueValues:e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),getGlobalFacetedUniqueValues:()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,_getGlobalFacetedMinMaxValues:e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),getGlobalFacetedMinMaxValues:()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}})};function _(e,t,n){return!(!e||!e.autoRemove)&&e.autoRemove(t,n)||void 0===t||"string"==typeof t&&!t}const P={sum:(e,t,n)=>n.reduce(((t,n)=>{const l=n.getValue(e);return t+("number"==typeof l?l:0)}),0),min:(e,t,n)=>{let l;return n.forEach((t=>{const n=t.getValue(e);null!=n&&(l>n||void 0===l&&n>=n)&&(l=n)})),l},max:(e,t,n)=>{let l;return n.forEach((t=>{const n=t.getValue(e);null!=n&&(l<n||void 0===l&&n>=n)&&(l=n)})),l},extent:(e,t,n)=>{let l,o;return n.forEach((t=>{const n=t.getValue(e);null!=n&&(void 0===l?n>=n&&(l=o=n):(l>n&&(l=n),o<n&&(o=n)))})),[l,o]},mean:(e,t)=>{let n=0,l=0;if(t.forEach((t=>{let o=t.getValue(e);null!=o&&(o=+o)>=o&&(++n,l+=o)})),n)return l/n},median:(e,t)=>{if(!t.length)return;const n=t.map((t=>t.getValue(e)));if(!o(n))return;if(1===n.length)return n[0];const l=Math.floor(n.length/2),i=n.sort(((e,t)=>e-t));return n.length%2!=0?i[l]:(i[l-1]+i[l])/2},unique:(e,t)=>Array.from(new Set(t.map((t=>t.getValue(e)))).values()),uniqueCount:(e,t)=>new Set(t.map((t=>t.getValue(e)))).size,count:(e,t)=>t.length},A={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return null!=(t=null==(n=e.getValue())||null==n.toString?void 0:n.toString())?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:n("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>({toggleGrouping:()=>{t.setGrouping((t=>null!=t&&t.includes(e.id)?t.filter((t=>t!==e.id)):[...null!=t?t:[],e.id]))},getCanGroup:()=>{var n,l,o,i;return null!=(n=null==(l=null!=(o=null==(i=e.columnDef.enableGrouping)||i)?o:t.options.enableGrouping)||l)?n:!!e.accessorFn},getIsGrouped:()=>{var n;return null==(n=t.getState().grouping)?void 0:n.includes(e.id)},getGroupedIndex:()=>{var n;return null==(n=t.getState().grouping)?void 0:n.indexOf(e.id)},getToggleGroupingHandler:()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},getAutoAggregationFn:()=>{const n=t.getCoreRowModel().flatRows[0],l=null==n?void 0:n.getValue(e.id);return"number"==typeof l?P.sum:"[object Date]"===Object.prototype.toString.call(l)?P.extent:void 0},getAggregationFn:()=>{var n,o;if(!e)throw new Error;return l(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:"auto"===e.columnDef.aggregationFn?e.getAutoAggregationFn():null!=(n=null==(o=t.options.aggregationFns)?void 0:o[e.columnDef.aggregationFn])?n:P[e.columnDef.aggregationFn]}}),createTable:e=>({setGrouping:t=>null==e.options.onGroupingChange?void 0:e.options.onGroupingChange(t),resetGrouping:t=>{var n,l;e.setGrouping(t?[]:null!=(n=null==(l=e.initialState)?void 0:l.grouping)?n:[])},getPreGroupedRowModel:()=>e.getFilteredRowModel(),getGroupedRowModel:()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())}),createRow:(e,t)=>({getIsGrouped:()=>!!e.groupingColumnId,getGroupingValue:n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const l=t.getColumn(n);return null!=l&&l.columnDef.getGroupingValue?(e._groupingValuesCache[n]=l.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},_groupingValuesCache:{}}),createCell:(e,t,n,l)=>({getIsGrouped:()=>t.getIsGrouped()&&t.id===n.groupingColumnId,getIsPlaceholder:()=>!e.getIsGrouped()&&t.getIsGrouped(),getIsAggregated:()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!(null==(t=n.subRows)||!t.length)}})};function E(e,t,n){if(null==t||!t.length||!n)return e;const l=e.filter((e=>!t.includes(e.id)));if("remove"===n)return l;return[...t.map((t=>e.find((e=>e.id===t)))).filter(Boolean),...l]}const G={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:n("columnOrder",e)}),createTable:e=>({setColumnOrder:t=>null==e.options.onColumnOrderChange?void 0:e.options.onColumnOrderChange(t),resetColumnOrder:t=>{var n;e.setColumnOrder(t?[]:null!=(n=e.initialState.columnOrder)?n:[])},_getOrderColumnsFn:r((()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode]),((e,t,n)=>l=>{let o=[];if(null!=e&&e.length){const t=[...e],n=[...l];for(;n.length&&t.length;){const e=t.shift(),l=n.findIndex((t=>t.id===e));l>-1&&o.push(n.splice(l,1)[0])}o=[...o,...n]}else o=l;return E(o,t,n)}),{key:!1})})},H={getInitialState:e=>({...e,pagination:{pageIndex:0,pageSize:10,...null==e?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:n("pagination",e)}),createTable:e=>{let n=!1,l=!1;return{_autoResetPageIndex:()=>{var t,o;if(n){if(null!=(t=null!=(o=e.options.autoResetAll)?o:e.options.autoResetPageIndex)?t:!e.options.manualPagination){if(l)return;l=!0,e._queue((()=>{e.resetPageIndex(),l=!1}))}}else e._queue((()=>{n=!0}))},setPagination:n=>null==e.options.onPaginationChange?void 0:e.options.onPaginationChange((e=>t(n,e))),resetPagination:t=>{var n;e.setPagination(t?{pageIndex:0,pageSize:10}:null!=(n=e.initialState.pagination)?n:{pageIndex:0,pageSize:10})},setPageIndex:n=>{e.setPagination((l=>{let o=t(n,l.pageIndex);const i=void 0===e.options.pageCount||-1===e.options.pageCount?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return o=Math.max(0,Math.min(o,i)),{...l,pageIndex:o}}))},resetPageIndex:t=>{var n,l;e.setPageIndex(t?0:null!=(n=null==(l=e.initialState)||null==(l=l.pagination)?void 0:l.pageIndex)?n:0)},resetPageSize:t=>{var n,l;e.setPageSize(t?10:null!=(n=null==(l=e.initialState)||null==(l=l.pagination)?void 0:l.pageSize)?n:10)},setPageSize:n=>{e.setPagination((e=>{const l=Math.max(1,t(n,e.pageSize)),o=e.pageSize*e.pageIndex,i=Math.floor(o/l);return{...e,pageIndex:i,pageSize:l}}))},setPageCount:n=>e.setPagination((l=>{var o;let i=t(n,null!=(o=e.options.pageCount)?o:-1);return"number"==typeof i&&(i=Math.max(-1,i)),{...l,pageCount:i}})),getPageOptions:r((()=>[e.getPageCount()]),(e=>{let t=[];return e&&e>0&&(t=[...new Array(e)].fill(null).map(((e,t)=>t))),t}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable}}),getCanPreviousPage:()=>e.getState().pagination.pageIndex>0,getCanNextPage:()=>{const{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return-1===n||0!==n&&t<n-1},previousPage:()=>e.setPageIndex((e=>e-1)),nextPage:()=>e.setPageIndex((e=>e+1)),getPrePaginationRowModel:()=>e.getExpandedRowModel(),getPaginationRowModel:()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),getPageCount:()=>{var t;return null!=(t=e.options.pageCount)?t:Math.ceil(e.getPrePaginationRowModel().rows.length/e.getState().pagination.pageSize)}}}},z={getInitialState:e=>({columnPinning:{left:[],right:[]},...e}),getDefaultOptions:e=>({onColumnPinningChange:n("columnPinning",e)}),createColumn:(e,t)=>({pin:n=>{const l=e.getLeafColumns().map((e=>e.id)).filter(Boolean);t.setColumnPinning((e=>{var t,o,i,r,u,a;return"right"===n?{left:(null!=(i=null==e?void 0:e.left)?i:[]).filter((e=>!(null!=l&&l.includes(e)))),right:[...(null!=(r=null==e?void 0:e.right)?r:[]).filter((e=>!(null!=l&&l.includes(e)))),...l]}:"left"===n?{left:[...(null!=(u=null==e?void 0:e.left)?u:[]).filter((e=>!(null!=l&&l.includes(e)))),...l],right:(null!=(a=null==e?void 0:e.right)?a:[]).filter((e=>!(null!=l&&l.includes(e))))}:{left:(null!=(t=null==e?void 0:e.left)?t:[]).filter((e=>!(null!=l&&l.includes(e)))),right:(null!=(o=null==e?void 0:e.right)?o:[]).filter((e=>!(null!=l&&l.includes(e))))}}))},getCanPin:()=>e.getLeafColumns().some((e=>{var n,l;return(null==(n=e.columnDef.enablePinning)||n)&&(null==(l=t.options.enablePinning)||l)})),getIsPinned:()=>{const n=e.getLeafColumns().map((e=>e.id)),{left:l,right:o}=t.getState().columnPinning,i=n.some((e=>null==l?void 0:l.includes(e))),r=n.some((e=>null==o?void 0:o.includes(e)));return i?"left":!!r&&"right"},getPinnedIndex:()=>{var n,l;const o=e.getIsPinned();return o?null!=(n=null==(l=t.getState().columnPinning)||null==(l=l[o])?void 0:l.indexOf(e.id))?n:-1:0}}),createRow:(e,t)=>({getCenterVisibleCells:r((()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right]),((e,t,n)=>{const l=[...null!=t?t:[],...null!=n?n:[]];return e.filter((e=>!l.includes(e.column.id)))}),{key:"row.getCenterVisibleCells",debug:()=>{var e;return null!=(e=t.options.debugAll)?e:t.options.debugRows}}),getLeftVisibleCells:r((()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,,]),((e,t)=>(null!=t?t:[]).map((t=>e.find((e=>e.column.id===t)))).filter(Boolean).map((e=>({...e,position:"left"})))),{key:"row.getLeftVisibleCells",debug:()=>{var e;return null!=(e=t.options.debugAll)?e:t.options.debugRows}}),getRightVisibleCells:r((()=>[e._getAllVisibleCells(),t.getState().columnPinning.right]),((e,t)=>(null!=t?t:[]).map((t=>e.find((e=>e.column.id===t)))).filter(Boolean).map((e=>({...e,position:"right"})))),{key:"row.getRightVisibleCells",debug:()=>{var e;return null!=(e=t.options.debugAll)?e:t.options.debugRows}})}),createTable:e=>({setColumnPinning:t=>null==e.options.onColumnPinningChange?void 0:e.options.onColumnPinningChange(t),resetColumnPinning:t=>{var n,l;return e.setColumnPinning(t?{left:[],right:[]}:null!=(n=null==(l=e.initialState)?void 0:l.columnPinning)?n:{left:[],right:[]})},getIsSomeColumnsPinned:t=>{var n;const l=e.getState().columnPinning;var o,i;return t?Boolean(null==(n=l[t])?void 0:n.length):Boolean((null==(o=l.left)?void 0:o.length)||(null==(i=l.right)?void 0:i.length))},getLeftLeafColumns:r((()=>[e.getAllLeafColumns(),e.getState().columnPinning.left]),((e,t)=>(null!=t?t:[]).map((t=>e.find((e=>e.id===t)))).filter(Boolean)),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugColumns}}),getRightLeafColumns:r((()=>[e.getAllLeafColumns(),e.getState().columnPinning.right]),((e,t)=>(null!=t?t:[]).map((t=>e.find((e=>e.id===t)))).filter(Boolean)),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugColumns}}),getCenterLeafColumns:r((()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right]),((e,t,n)=>{const l=[...null!=t?t:[],...null!=n?n:[]];return e.filter((e=>!l.includes(e.id)))}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugColumns}})})},L={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:n("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>({setRowSelection:t=>null==e.options.onRowSelectionChange?void 0:e.options.onRowSelectionChange(t),resetRowSelection:t=>{var n;return e.setRowSelection(t?{}:null!=(n=e.initialState.rowSelection)?n:{})},toggleAllRowsSelected:t=>{e.setRowSelection((n=>{t=void 0!==t?t:!e.getIsAllRowsSelected();const l={...n},o=e.getPreGroupedRowModel().flatRows;return t?o.forEach((e=>{e.getCanSelect()&&(l[e.id]=!0)})):o.forEach((e=>{delete l[e.id]})),l}))},toggleAllPageRowsSelected:t=>e.setRowSelection((n=>{const l=void 0!==t?t:!e.getIsAllPageRowsSelected(),o={...n};return e.getRowModel().rows.forEach((t=>{D(o,t.id,l,e)})),o})),getPreSelectedRowModel:()=>e.getCoreRowModel(),getSelectedRowModel:r((()=>[e.getState().rowSelection,e.getCoreRowModel()]),((t,n)=>Object.keys(t).length?k(e,n):{rows:[],flatRows:[],rowsById:{}}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable}}),getFilteredSelectedRowModel:r((()=>[e.getState().rowSelection,e.getFilteredRowModel()]),((t,n)=>Object.keys(t).length?k(e,n):{rows:[],flatRows:[],rowsById:{}}),{key:"getFilteredSelectedRowModel",debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable}}),getGroupedSelectedRowModel:r((()=>[e.getState().rowSelection,e.getSortedRowModel()]),((t,n)=>Object.keys(t).length?k(e,n):{rows:[],flatRows:[],rowsById:{}}),{key:"getGroupedSelectedRowModel",debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable}}),getIsAllRowsSelected:()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let l=Boolean(t.length&&Object.keys(n).length);return l&&t.some((e=>e.getCanSelect()&&!n[e.id]))&&(l=!1),l},getIsAllPageRowsSelected:()=>{const t=e.getPaginationRowModel().flatRows.filter((e=>e.getCanSelect())),{rowSelection:n}=e.getState();let l=!!t.length;return l&&t.some((e=>!n[e.id]))&&(l=!1),l},getIsSomeRowsSelected:()=>{var t;const n=Object.keys(null!=(t=e.getState().rowSelection)?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},getIsSomePageRowsSelected:()=>{const t=e.getPaginationRowModel().flatRows;return!e.getIsAllPageRowsSelected()&&t.filter((e=>e.getCanSelect())).some((e=>e.getIsSelected()||e.getIsSomeSelected()))},getToggleAllRowsSelectedHandler:()=>t=>{e.toggleAllRowsSelected(t.target.checked)},getToggleAllPageRowsSelectedHandler:()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}}),createRow:(e,t)=>({toggleSelected:n=>{const l=e.getIsSelected();t.setRowSelection((o=>{if(l===(n=void 0!==n?n:!l))return o;const i={...o};return D(i,e.id,n,t),i}))},getIsSelected:()=>{const{rowSelection:n}=t.getState();return O(e,n)},getIsSomeSelected:()=>{const{rowSelection:n}=t.getState();return"some"===T(e,n)},getIsAllSubRowsSelected:()=>{const{rowSelection:n}=t.getState();return"all"===T(e,n)},getCanSelect:()=>{var n;return"function"==typeof t.options.enableRowSelection?t.options.enableRowSelection(e):null==(n=t.options.enableRowSelection)||n},getCanSelectSubRows:()=>{var n;return"function"==typeof t.options.enableSubRowSelection?t.options.enableSubRowSelection(e):null==(n=t.options.enableSubRowSelection)||n},getCanMultiSelect:()=>{var n;return"function"==typeof t.options.enableMultiRowSelection?t.options.enableMultiRowSelection(e):null==(n=t.options.enableMultiRowSelection)||n},getToggleSelectedHandler:()=>{const t=e.getCanSelect();return n=>{var l;t&&e.toggleSelected(null==(l=n.target)?void 0:l.checked)}}})},D=(e,t,n,l)=>{var o;const i=l.getRow(t);n?(i.getCanMultiSelect()||Object.keys(e).forEach((t=>delete e[t])),i.getCanSelect()&&(e[t]=!0)):delete e[t],null!=(o=i.subRows)&&o.length&&i.getCanSelectSubRows()&&i.subRows.forEach((t=>D(e,t.id,n,l)))};function k(e,t){const n=e.getState().rowSelection,l=[],o={},i=function(e,t){return e.map((e=>{var t;const r=O(e,n);if(r&&(l.push(e),o[e.id]=e),null!=(t=e.subRows)&&t.length&&(e={...e,subRows:i(e.subRows)}),r)return e})).filter(Boolean)};return{rows:i(t.rows),flatRows:l,rowsById:o}}function O(e,t){var n;return null!=(n=t[e.id])&&n}function T(e,t,n){if(e.subRows&&e.subRows.length){let n=!0,l=!1;return e.subRows.forEach((e=>{l&&!n||(O(e,t)?l=!0:n=!1)})),n?"all":!!l&&"some"}return!1}const B=/([0-9]+)/gm;function q(e,t){return e===t?0:e>t?1:-1}function j(e){return"number"==typeof e?isNaN(e)||e===1/0||e===-1/0?"":String(e):"string"==typeof e?e:""}function N(e,t){const n=e.split(B).filter(Boolean),l=t.split(B).filter(Boolean);for(;n.length&&l.length;){const e=n.shift(),t=l.shift(),o=parseInt(e,10),i=parseInt(t,10),r=[o,i].sort();if(isNaN(r[0])){if(e>t)return 1;if(t>e)return-1}else{if(isNaN(r[1]))return isNaN(o)?-1:1;if(o>i)return 1;if(i>o)return-1}}return n.length-l.length}const U={alphanumeric:(e,t,n)=>N(j(e.getValue(n)).toLowerCase(),j(t.getValue(n)).toLowerCase()),alphanumericCaseSensitive:(e,t,n)=>N(j(e.getValue(n)),j(t.getValue(n))),text:(e,t,n)=>q(j(e.getValue(n)).toLowerCase(),j(t.getValue(n)).toLowerCase()),textCaseSensitive:(e,t,n)=>q(j(e.getValue(n)),j(t.getValue(n))),datetime:(e,t,n)=>{const l=e.getValue(n),o=t.getValue(n);return l>o?1:l<o?-1:0},basic:(e,t,n)=>q(e.getValue(n),t.getValue(n))},$={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:n("sorting",e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>({getAutoSortingFn:()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let l=!1;for(const t of n){const n=null==t?void 0:t.getValue(e.id);if("[object Date]"===Object.prototype.toString.call(n))return U.datetime;if("string"==typeof n&&(l=!0,n.split(B).length>1))return U.alphanumeric}return l?U.text:U.basic},getAutoSortDir:()=>{const n=t.getFilteredRowModel().flatRows[0];return"string"==typeof(null==n?void 0:n.getValue(e.id))?"asc":"desc"},getSortingFn:()=>{var n,o;if(!e)throw new Error;return l(e.columnDef.sortingFn)?e.columnDef.sortingFn:"auto"===e.columnDef.sortingFn?e.getAutoSortingFn():null!=(n=null==(o=t.options.sortingFns)?void 0:o[e.columnDef.sortingFn])?n:U[e.columnDef.sortingFn]},toggleSorting:(n,l)=>{const o=e.getNextSortingOrder(),i=null!=n;t.setSorting((r=>{const u=null==r?void 0:r.find((t=>t.id===e.id)),a=null==r?void 0:r.findIndex((t=>t.id===e.id));let s,g=[],d=i?n:"desc"===o;var c;(s=null!=r&&r.length&&e.getCanMultiSort()&&l?u?"toggle":"add":null!=r&&r.length&&a!==r.length-1?"replace":u?"toggle":"replace","toggle"===s&&(i||o||(s="remove")),"add"===s)?(g=[...r,{id:e.id,desc:d}],g.splice(0,g.length-(null!=(c=t.options.maxMultiSortColCount)?c:Number.MAX_SAFE_INTEGER))):g="toggle"===s?r.map((t=>t.id===e.id?{...t,desc:d}:t)):"remove"===s?r.filter((t=>t.id!==e.id)):[{id:e.id,desc:d}];return g}))},getFirstSortDir:()=>{var n,l;return(null!=(n=null!=(l=e.columnDef.sortDescFirst)?l:t.options.sortDescFirst)?n:"desc"===e.getAutoSortDir())?"desc":"asc"},getNextSortingOrder:n=>{var l,o;const i=e.getFirstSortDir(),r=e.getIsSorted();return r?!!(r===i||null!=(l=t.options.enableSortingRemoval)&&!l||n&&null!=(o=t.options.enableMultiRemove)&&!o)&&("desc"===r?"asc":"desc"):i},getCanSort:()=>{var n,l;return(null==(n=e.columnDef.enableSorting)||n)&&(null==(l=t.options.enableSorting)||l)&&!!e.accessorFn},getCanMultiSort:()=>{var n,l;return null!=(n=null!=(l=e.columnDef.enableMultiSort)?l:t.options.enableMultiSort)?n:!!e.accessorFn},getIsSorted:()=>{var n;const l=null==(n=t.getState().sorting)?void 0:n.find((t=>t.id===e.id));return!!l&&(l.desc?"desc":"asc")},getSortIndex:()=>{var n,l;return null!=(n=null==(l=t.getState().sorting)?void 0:l.findIndex((t=>t.id===e.id)))?n:-1},clearSorting:()=>{t.setSorting((t=>null!=t&&t.length?t.filter((t=>t.id!==e.id)):[]))},getToggleSortingHandler:()=>{const n=e.getCanSort();return l=>{n&&(null==l.persist||l.persist(),null==e.toggleSorting||e.toggleSorting(void 0,!!e.getCanMultiSort()&&(null==t.options.isMultiSortEvent?void 0:t.options.isMultiSortEvent(l))))}}}),createTable:e=>({setSorting:t=>null==e.options.onSortingChange?void 0:e.options.onSortingChange(t),resetSorting:t=>{var n,l;e.setSorting(t?[]:null!=(n=null==(l=e.initialState)?void 0:l.sorting)?n:[])},getPreSortedRowModel:()=>e.getGroupedRowModel(),getSortedRowModel:()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())})},X={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:n("columnVisibility",e)}),createColumn:(e,t)=>({toggleVisibility:n=>{e.getCanHide()&&t.setColumnVisibility((t=>({...t,[e.id]:null!=n?n:!e.getIsVisible()})))},getIsVisible:()=>{var n,l;return null==(n=null==(l=t.getState().columnVisibility)?void 0:l[e.id])||n},getCanHide:()=>{var n,l;return(null==(n=e.columnDef.enableHiding)||n)&&(null==(l=t.options.enableHiding)||l)},getToggleVisibilityHandler:()=>t=>{null==e.toggleVisibility||e.toggleVisibility(t.target.checked)}}),createRow:(e,t)=>({_getAllVisibleCells:r((()=>[e.getAllCells(),t.getState().columnVisibility]),(e=>e.filter((e=>e.column.getIsVisible()))),{key:"row._getAllVisibleCells",debug:()=>{var e;return null!=(e=t.options.debugAll)?e:t.options.debugRows}}),getVisibleCells:r((()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()]),((e,t,n)=>[...e,...t,...n]),{key:!1,debug:()=>{var e;return null!=(e=t.options.debugAll)?e:t.options.debugRows}})}),createTable:e=>{const t=(t,n)=>r((()=>[n(),n().filter((e=>e.getIsVisible())).map((e=>e.id)).join("_")]),(e=>e.filter((e=>null==e.getIsVisible?void 0:e.getIsVisible()))),{key:t,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugColumns}});return{getVisibleFlatColumns:t("getVisibleFlatColumns",(()=>e.getAllFlatColumns())),getVisibleLeafColumns:t("getVisibleLeafColumns",(()=>e.getAllLeafColumns())),getLeftVisibleLeafColumns:t("getLeftVisibleLeafColumns",(()=>e.getLeftLeafColumns())),getRightVisibleLeafColumns:t("getRightVisibleLeafColumns",(()=>e.getRightLeafColumns())),getCenterVisibleLeafColumns:t("getCenterVisibleLeafColumns",(()=>e.getCenterLeafColumns())),setColumnVisibility:t=>null==e.options.onColumnVisibilityChange?void 0:e.options.onColumnVisibilityChange(t),resetColumnVisibility:t=>{var n;e.setColumnVisibility(t?{}:null!=(n=e.initialState.columnVisibility)?n:{})},toggleAllColumnsVisible:t=>{var n;t=null!=(n=t)?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce(((e,n)=>({...e,[n.id]:t||!(null!=n.getCanHide&&n.getCanHide())})),{}))},getIsAllColumnsVisible:()=>!e.getAllLeafColumns().some((e=>!(null!=e.getIsVisible&&e.getIsVisible()))),getIsSomeColumnsVisible:()=>e.getAllLeafColumns().some((e=>null==e.getIsVisible?void 0:e.getIsVisible())),getToggleAllColumnsVisibilityHandler:()=>t=>{var n;e.toggleAllColumnsVisible(null==(n=t.target)?void 0:n.checked)}}}},K=[s,X,G,z,x,$,A,b,H,L,c];function J(e,t,n,l){const o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(l),renderValue:()=>{var t;return null!=(t=o.getValue())?t:e.options.renderFallbackValue},getContext:r((()=>[e,n,t,o]),((e,t,n,l)=>({table:e,column:t,row:n,cell:l,getValue:l.getValue,renderValue:l.renderValue})),{key:!1,debug:()=>e.options.debugAll})};return e._features.forEach((l=>{Object.assign(o,null==l.createCell?void 0:l.createCell(o,n,t,e))}),{}),o}const Q=(e,t,n,l,o,u,a)=>{let s={id:t,index:l,original:n,depth:o,parentId:a,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(s._valuesCache.hasOwnProperty(t))return s._valuesCache[t];const n=e.getColumn(t);return null!=n&&n.accessorFn?(s._valuesCache[t]=n.accessorFn(s.original,l),s._valuesCache[t]):void 0},getUniqueValues:t=>{if(s._uniqueValuesCache.hasOwnProperty(t))return s._uniqueValuesCache[t];const n=e.getColumn(t);return null!=n&&n.accessorFn?n.columnDef.getUniqueValues?(s._uniqueValuesCache[t]=n.columnDef.getUniqueValues(s.original,l),s._uniqueValuesCache[t]):(s._uniqueValuesCache[t]=[s.getValue(t)],s._uniqueValuesCache[t]):void 0},renderValue:t=>{var n;return null!=(n=s.getValue(t))?n:e.options.renderFallbackValue},subRows:null!=u?u:[],getLeafRows:()=>i(s.subRows,(e=>e.subRows)),getParentRow:()=>s.parentId?e.getRow(s.parentId):void 0,getParentRows:()=>{let e=[],t=s;for(;;){const n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:r((()=>[e.getAllLeafColumns()]),(t=>t.map((t=>J(e,s,t,t.id)))),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugRows}}),_getAllCellsByColumnId:r((()=>[s.getAllCells()]),(e=>e.reduce(((e,t)=>(e[t.column.id]=t,e)),{})),{key:"row.getAllCellsByColumnId",debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugRows}})};for(let t=0;t<e._features.length;t++){const n=e._features[t];Object.assign(s,null==n||null==n.createRow?void 0:n.createRow(s,e))}return s};function W(e,t,n){return n.options.filterFromLeafRows?function(e,t,n){var l;const o=[],i={},r=null!=(l=n.options.maxLeafRowFilterDepth)?l:100,u=function(e,l){void 0===l&&(l=0);const a=[];for(let g=0;g<e.length;g++){var s;let d=e[g];const c=Q(n,d.id,d.original,d.index,d.depth,void 0,d.parentId);if(c.columnFilters=d.columnFilters,null!=(s=d.subRows)&&s.length&&l<r){if(c.subRows=u(d.subRows,l+1),d=c,t(d)&&!c.subRows.length){a.push(d),i[d.id]=d,o.push(d);continue}if(t(d)||c.subRows.length){a.push(d),i[d.id]=d,o.push(d);continue}}else d=c,t(d)&&(a.push(d),i[d.id]=d,o.push(d))}return a};return{rows:u(e),flatRows:o,rowsById:i}}(e,t,n):function(e,t,n){var l;const o=[],i={},r=null!=(l=n.options.maxLeafRowFilterDepth)?l:100,u=function(e,l){void 0===l&&(l=0);const a=[];for(let g=0;g<e.length;g++){let d=e[g];if(t(d)){var s;if(null!=(s=d.subRows)&&s.length&&l<r){const e=Q(n,d.id,d.original,d.index,d.depth,void 0,d.parentId);e.subRows=u(d.subRows,l+1),d=e}a.push(d),o.push(d),i[d.id]=d}}return a};return{rows:u(e),flatRows:o,rowsById:i}}(e,t,n)}function Y(e){const t=[],n=e=>{var l;t.push(e),null!=(l=e.subRows)&&l.length&&e.getIsExpanded()&&e.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}e.ColumnSizing=c,e.Expanding=b,e.Filters=x,e.Grouping=A,e.Headers=s,e.Ordering=G,e.Pagination=H,e.Pinning=z,e.RowSelection=L,e.Sorting=$,e.Visibility=X,e.aggregationFns=P,e.buildHeaderGroups=g,e.createCell=J,e.createColumn=u,e.createColumnHelper=function(){return{accessor:(e,t)=>"function"==typeof e?{...t,accessorFn:e}:{...t,accessorKey:e},display:e=>e,group:e=>e}},e.createRow=Q,e.createTable=function(e){var n;(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");let l={_features:K};const o=l._features.reduce(((e,t)=>Object.assign(e,null==t.getDefaultOptions?void 0:t.getDefaultOptions(l))),{});let i={...null!=(n=e.initialState)?n:{}};l._features.forEach((e=>{var t;i=null!=(t=null==e.getInitialState?void 0:e.getInitialState(i))?t:i}));const a=[];let s=!1;const g={_features:K,options:{...o,...e},initialState:i,_queue:e=>{a.push(e),s||(s=!0,Promise.resolve().then((()=>{for(;a.length;)a.shift()();s=!1})).catch((e=>setTimeout((()=>{throw e})))))},reset:()=>{l.setState(l.initialState)},setOptions:e=>{const n=t(e,l.options);l.options=(e=>l.options.mergeOptions?l.options.mergeOptions(o,e):{...o,...e})(n)},getState:()=>l.options.state,setState:e=>{null==l.options.onStateChange||l.options.onStateChange(e)},_getRowId:(e,t,n)=>{var o;return null!=(o=null==l.options.getRowId?void 0:l.options.getRowId(e,t,n))?o:`${n?[n.id,t].join("."):t}`},getCoreRowModel:()=>(l._getCoreRowModel||(l._getCoreRowModel=l.options.getCoreRowModel(l)),l._getCoreRowModel()),getRowModel:()=>l.getPaginationRowModel(),getRow:e=>{const t=l.getRowModel().rowsById[e];if(!t)throw new Error;return t},_getDefaultColumnDef:r((()=>[l.options.defaultColumn]),(e=>{var t;return e=null!=(t=e)?t:{},{header:e=>{const t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t,n;return null!=(t=null==(n=e.renderValue())||null==n.toString?void 0:n.toString())?t:null},...l._features.reduce(((e,t)=>Object.assign(e,null==t.getDefaultColumnDef?void 0:t.getDefaultColumnDef())),{}),...e}}),{debug:()=>{var e;return null!=(e=l.options.debugAll)?e:l.options.debugColumns},key:!1}),_getColumnDefs:()=>l.options.columns,getAllColumns:r((()=>[l._getColumnDefs()]),(e=>{const t=function(e,n,o){return void 0===o&&(o=0),e.map((e=>{const i=u(l,e,o,n),r=e;return i.columns=r.columns?t(r.columns,i,o+1):[],i}))};return t(e)}),{key:!1,debug:()=>{var e;return null!=(e=l.options.debugAll)?e:l.options.debugColumns}}),getAllFlatColumns:r((()=>[l.getAllColumns()]),(e=>e.flatMap((e=>e.getFlatColumns()))),{key:!1,debug:()=>{var e;return null!=(e=l.options.debugAll)?e:l.options.debugColumns}}),_getAllFlatColumnsById:r((()=>[l.getAllFlatColumns()]),(e=>e.reduce(((e,t)=>(e[t.id]=t,e)),{})),{key:!1,debug:()=>{var e;return null!=(e=l.options.debugAll)?e:l.options.debugColumns}}),getAllLeafColumns:r((()=>[l.getAllColumns(),l._getOrderColumnsFn()]),((e,t)=>t(e.flatMap((e=>e.getLeafColumns())))),{key:!1,debug:()=>{var e;return null!=(e=l.options.debugAll)?e:l.options.debugColumns}}),getColumn:e=>l._getAllFlatColumnsById()[e]};return Object.assign(l,g),l._features.forEach((e=>Object.assign(l,null==e.createTable?void 0:e.createTable(l)))),l},e.defaultColumnSizing=d,e.expandRows=Y,e.filterFns=y,e.flattenBy=i,e.functionalUpdate=t,e.getCoreRowModel=function(){return e=>r((()=>[e.options.data]),(t=>{const n={rows:[],flatRows:[],rowsById:{}},l=function(t,o,i){void 0===o&&(o=0);const r=[];for(let a=0;a<t.length;a++){const s=Q(e,e._getRowId(t[a],a,i),t[a],a,o,void 0,null==i?void 0:i.id);var u;if(n.flatRows.push(s),n.rowsById[s.id]=s,r.push(s),e.options.getSubRows)s.originalSubRows=e.options.getSubRows(t[a],a),null!=(u=s.originalSubRows)&&u.length&&(s.subRows=l(s.originalSubRows,o+1,s))}return r};return n.rows=l(t),n}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})},e.getExpandedRowModel=function(){return e=>r((()=>[e.getState().expanded,e.getPreExpandedRowModel(),e.options.paginateExpandedRows]),((e,t,n)=>!t.rows.length||!0!==e&&!Object.keys(null!=e?e:{}).length?t:n?Y(t):t),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable}})},e.getFacetedMinMaxValues=function(){return(e,t)=>r((()=>{var n;return[null==(n=e.getColumn(t))?void 0:n.getFacetedRowModel()]}),(e=>{var n;if(!e)return;const l=null==(n=e.flatRows[0])?void 0:n.getUniqueValues(t);if(void 0===l)return;let o=[l,l];for(let n=0;n<e.flatRows.length;n++){const l=e.flatRows[n].getUniqueValues(t);for(let e=0;e<l.length;e++){const t=l[e];t<o[0]?o[0]=t:t>o[1]&&(o[1]=t)}}return o}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable},onChange:()=>{}})},e.getFacetedRowModel=function(){return(e,t)=>r((()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()]),((n,l,o)=>{if(!n.rows.length||(null==l||!l.length)&&!o)return n;const i=[...l.map((e=>e.id)).filter((e=>e!==t)),o?"__global__":void 0].filter(Boolean);return W(n.rows,(e=>{for(let t=0;t<i.length;t++)if(!1===e.columnFilters[i[t]])return!1;return!0}),e)}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable},onChange:()=>{}})},e.getFacetedUniqueValues=function(){return(e,t)=>r((()=>{var n;return[null==(n=e.getColumn(t))?void 0:n.getFacetedRowModel()]}),(e=>{if(!e)return new Map;let n=new Map;for(let o=0;o<e.flatRows.length;o++){const i=e.flatRows[o].getUniqueValues(t);for(let e=0;e<i.length;e++){const t=i[e];var l;if(n.has(t))n.set(t,(null!=(l=n.get(t))?l:0)+1);else n.set(t,1)}}return n}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable},onChange:()=>{}})},e.getFilteredRowModel=function(){return e=>r((()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter]),((t,n,l)=>{if(!t.rows.length||(null==n||!n.length)&&!l){for(let e=0;e<t.flatRows.length;e++)t.flatRows[e].columnFilters={},t.flatRows[e].columnFiltersMeta={};return t}const o=[],i=[];(null!=n?n:[]).forEach((t=>{var n;const l=e.getColumn(t.id);if(!l)return;const i=l.getFilterFn();i&&o.push({id:t.id,filterFn:i,resolvedValue:null!=(n=null==i.resolveFilterValue?void 0:i.resolveFilterValue(t.value))?n:t.value})}));const r=n.map((e=>e.id)),u=e.getGlobalFilterFn(),a=e.getAllLeafColumns().filter((e=>e.getCanGlobalFilter()));let s,g;l&&u&&a.length&&(r.push("__global__"),a.forEach((e=>{var t;i.push({id:e.id,filterFn:u,resolvedValue:null!=(t=null==u.resolveFilterValue?void 0:u.resolveFilterValue(l))?t:l})})));for(let e=0;e<t.flatRows.length;e++){const n=t.flatRows[e];if(n.columnFilters={},o.length)for(let e=0;e<o.length;e++){s=o[e];const t=s.id;n.columnFilters[t]=s.filterFn(n,t,s.resolvedValue,(e=>{n.columnFiltersMeta[t]=e}))}if(i.length){for(let e=0;e<i.length;e++){g=i[e];const t=g.id;if(g.filterFn(n,t,g.resolvedValue,(e=>{n.columnFiltersMeta[t]=e}))){n.columnFilters.__global__=!0;break}}!0!==n.columnFilters.__global__&&(n.columnFilters.__global__=!1)}}return W(t.rows,(e=>{for(let t=0;t<r.length;t++)if(!1===e.columnFilters[r[t]])return!1;return!0}),e)}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})},e.getGroupedRowModel=function(){return e=>r((()=>[e.getState().grouping,e.getPreGroupedRowModel()]),((t,n)=>{if(!n.rows.length||!t.length)return n;const l=t.filter((t=>e.getColumn(t))),o=[],r={},u=function(t,n,a){if(void 0===n&&(n=0),n>=l.length)return t.map((e=>(e.depth=n,o.push(e),r[e.id]=e,e.subRows&&(e.subRows=u(e.subRows,n+1,e.id)),e)));const s=l[n],g=function(e,t){const n=new Map;return e.reduce(((e,n)=>{const l=`${n.getGroupingValue(t)}`,o=e.get(l);return o?o.push(n):e.set(l,[n]),e}),n)}(t,s),d=Array.from(g.entries()).map(((t,g)=>{let[d,c]=t,p=`${s}:${d}`;p=a?`${a}>${p}`:p;const f=u(c,n+1,p),m=n?i(c,(e=>e.subRows)):c,b=Q(e,p,m[0].original,g,n,void 0,a);return Object.assign(b,{groupingColumnId:s,groupingValue:d,subRows:f,leafRows:m,getValue:t=>{if(l.includes(t)){if(b._valuesCache.hasOwnProperty(t))return b._valuesCache[t];var n;if(c[0])b._valuesCache[t]=null!=(n=c[0].getValue(t))?n:void 0;return b._valuesCache[t]}if(b._groupingValuesCache.hasOwnProperty(t))return b._groupingValuesCache[t];const o=e.getColumn(t),i=null==o?void 0:o.getAggregationFn();return i?(b._groupingValuesCache[t]=i(t,m,c),b._groupingValuesCache[t]):void 0}}),f.forEach((e=>{o.push(e),r[e.id]=e})),b}));return d},a=u(n.rows,0);return a.forEach((e=>{o.push(e),r[e.id]=e})),{rows:a,flatRows:o,rowsById:r}}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable},onChange:()=>{e._queue((()=>{e._autoResetExpanded(),e._autoResetPageIndex()}))}})},e.getPaginationRowModel=function(e){return e=>r((()=>[e.getState().pagination,e.getPrePaginationRowModel(),e.options.paginateExpandedRows?void 0:e.getState().expanded]),((t,n)=>{if(!n.rows.length)return n;const{pageSize:l,pageIndex:o}=t;let{rows:i,flatRows:r,rowsById:u}=n;const a=l*o,s=a+l;let g;i=i.slice(a,s),g=e.options.paginateExpandedRows?{rows:i,flatRows:r,rowsById:u}:Y({rows:i,flatRows:r,rowsById:u}),g.flatRows=[];const d=e=>{g.flatRows.push(e),e.subRows.length&&e.subRows.forEach(d)};return g.rows.forEach(d),g}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable}})},e.getSortedRowModel=function(){return e=>r((()=>[e.getState().sorting,e.getPreSortedRowModel()]),((t,n)=>{if(!n.rows.length||null==t||!t.length)return n;const l=e.getState().sorting,o=[],i=l.filter((t=>{var n;return null==(n=e.getColumn(t.id))?void 0:n.getCanSort()})),r={};i.forEach((t=>{const n=e.getColumn(t.id);n&&(r[t.id]={sortUndefined:n.columnDef.sortUndefined,invertSorting:n.columnDef.invertSorting,sortingFn:n.getSortingFn()})}));const u=e=>{const t=[...e];return t.sort(((e,t)=>{for(let l=0;l<i.length;l+=1){var n;const o=i[l],u=r[o.id],a=null!=(n=null==o?void 0:o.desc)&&n;let s=0;if(u.sortUndefined){const n=void 0===e.getValue(o.id),l=void 0===t.getValue(o.id);(n||l)&&(s=n&&l?0:n?u.sortUndefined:-u.sortUndefined)}if(0===s&&(s=u.sortingFn(e,t,o.id)),0!==s)return a&&(s*=-1),u.invertSorting&&(s*=-1),s}return e.index-t.index})),t.forEach((e=>{var t;o.push(e),null!=(t=e.subRows)&&t.length&&(e.subRows=u(e.subRows))})),t};return{rows:u(n.rows),flatRows:o,rowsById:n.rowsById}}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})},e.isFunction=l,e.isNumberArray=o,e.isRowSelected=O,e.isSubRowSelected=T,e.makeStateUpdater=n,e.memo=r,e.noop=function(){},e.orderColumns=E,e.passiveEventSupported=f,e.reSplitAlphaNumeric=B,e.selectRowsFn=k,e.shouldAutoRemoveFilter=_,e.sortingFns=U,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TableCore={})}(this,(function(e){"use strict";function t(e,t){return"function"==typeof e?e(t):e}function n(e,n){return l=>{n.setState((n=>({...n,[e]:t(l,n[e])})))}}function l(e){return e instanceof Function}function o(e){return Array.isArray(e)&&e.every((e=>"number"==typeof e))}function i(e,t){const n=[],l=e=>{e.forEach((e=>{n.push(e);const o=t(e);null!=o&&o.length&&l(o)}))};return l(e),n}function r(e,t,n){let l,o=[];return()=>{let i;n.key&&n.debug&&(i=Date.now());const r=e();if(!(r.length!==o.length||r.some(((e,t)=>o[t]!==e))))return l;let u;if(o=r,n.key&&n.debug&&(u=Date.now()),l=t(...r),null==n||null==n.onChange||n.onChange(l),n.key&&n.debug&&null!=n&&n.debug()){const e=Math.round(100*(Date.now()-i))/100,t=Math.round(100*(Date.now()-u))/100,l=t/16,o=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${o(t,5)} /${o(e,5)} ms`,`\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(0,Math.min(120-120*l,120))}deg 100% 31%);`,null==n?void 0:n.key)}return l}}function u(e,t,n,l){var o,i;const u={...e._getDefaultColumnDef(),...t},a=u.accessorKey;let s,g=null!=(o=null!=(i=u.id)?i:a?a.replace(".","_"):void 0)?o:"string"==typeof u.header?u.header:void 0;if(u.accessorFn?s=u.accessorFn:a&&(s=a.includes(".")?e=>{let t=e;for(const e of a.split(".")){var n;t=null==(n=t)?void 0:n[e]}return t}:e=>e[u.accessorKey]),!g)throw new Error;let d={id:`${String(g)}`,accessorFn:s,parent:l,depth:n,columnDef:u,columns:[],getFlatColumns:r((()=>[!0]),(()=>{var e;return[d,...null==(e=d.columns)?void 0:e.flatMap((e=>e.getFlatColumns()))]}),{key:"column.getFlatColumns",debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugColumns}}),getLeafColumns:r((()=>[e._getOrderColumnsFn()]),(e=>{var t;if(null!=(t=d.columns)&&t.length){let t=d.columns.flatMap((e=>e.getLeafColumns()));return e(t)}return[d]}),{key:"column.getLeafColumns",debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugColumns}})};for(const t of e._features)null==t.createColumn||t.createColumn(d,e);return d}function a(e,t,n){var l;let o={id:null!=(l=n.id)?l:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(o),e},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach((t=>{null==t.createHeader||t.createHeader(o,e)})),o}const s={createTable:e=>{e.getHeaderGroups=r((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right]),((t,n,l,o)=>{var i,r;const u=null!=(i=null==l?void 0:l.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?i:[],a=null!=(r=null==o?void 0:o.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?r:[];return g(t,[...u,...n.filter((e=>!(null!=l&&l.includes(e.id)||null!=o&&o.includes(e.id)))),...a],e)}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),e.getCenterHeaderGroups=r((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right]),((t,n,l,o)=>g(t,n=n.filter((e=>!(null!=l&&l.includes(e.id)||null!=o&&o.includes(e.id)))),e,"center")),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),e.getLeftHeaderGroups=r((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left]),((t,n,l)=>{var o;return g(t,null!=(o=null==l?void 0:l.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?o:[],e,"left")}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),e.getRightHeaderGroups=r((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right]),((t,n,l)=>{var o;return g(t,null!=(o=null==l?void 0:l.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?o:[],e,"right")}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),e.getFooterGroups=r((()=>[e.getHeaderGroups()]),(e=>[...e].reverse()),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),e.getLeftFooterGroups=r((()=>[e.getLeftHeaderGroups()]),(e=>[...e].reverse()),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),e.getCenterFooterGroups=r((()=>[e.getCenterHeaderGroups()]),(e=>[...e].reverse()),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),e.getRightFooterGroups=r((()=>[e.getRightHeaderGroups()]),(e=>[...e].reverse()),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),e.getFlatHeaders=r((()=>[e.getHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),e.getLeftFlatHeaders=r((()=>[e.getLeftHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),e.getCenterFlatHeaders=r((()=>[e.getCenterHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),e.getRightFlatHeaders=r((()=>[e.getRightHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),e.getCenterLeafHeaders=r((()=>[e.getCenterFlatHeaders()]),(e=>e.filter((e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}))),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),e.getLeftLeafHeaders=r((()=>[e.getLeftFlatHeaders()]),(e=>e.filter((e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}))),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),e.getRightLeafHeaders=r((()=>[e.getRightFlatHeaders()]),(e=>e.filter((e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}))),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}}),e.getLeafHeaders=r((()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()]),((e,t,n)=>{var l,o,i,r,u,a;return[...null!=(l=null==(o=e[0])?void 0:o.headers)?l:[],...null!=(i=null==(r=t[0])?void 0:r.headers)?i:[],...null!=(u=null==(a=n[0])?void 0:a.headers)?u:[]].map((e=>e.getLeafHeaders())).flat()}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugHeaders}})}};function g(e,t,n,l){var o,i;let r=0;const u=function(e,t){void 0===t&&(t=1),r=Math.max(r,t),e.filter((e=>e.getIsVisible())).forEach((e=>{var n;null!=(n=e.columns)&&n.length&&u(e.columns,t+1)}),0)};u(e);let s=[];const g=(e,t)=>{const o={depth:t,id:[l,`${t}`].filter(Boolean).join("_"),headers:[]},i=[];e.forEach((e=>{const r=[...i].reverse()[0];let u,s=!1;if(e.column.depth===o.depth&&e.column.parent?u=e.column.parent:(u=e.column,s=!0),r&&(null==r?void 0:r.column)===u)r.subHeaders.push(e);else{const o=a(n,u,{id:[l,t,u.id,null==e?void 0:e.id].filter(Boolean).join("_"),isPlaceholder:s,placeholderId:s?`${i.filter((e=>e.column===u)).length}`:void 0,depth:t,index:i.length});o.subHeaders.push(e),i.push(o)}o.headers.push(e),e.headerGroup=o})),s.push(o),t>0&&g(i,t-1)},d=t.map(((e,t)=>a(n,e,{depth:r,index:t})));g(d,r-1),s.reverse();const c=e=>e.filter((e=>e.column.getIsVisible())).map((e=>{let t=0,n=0,l=[0];e.subHeaders&&e.subHeaders.length?(l=[],c(e.subHeaders).forEach((e=>{let{colSpan:n,rowSpan:o}=e;t+=n,l.push(o)}))):t=1;return n+=Math.min(...l),e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}}));return c(null!=(o=null==(i=s[0])?void 0:i.headers)?o:[]),s}const d={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},c={getDefaultColumnDef:()=>d,getInitialState:e=>({columnSizing:{},columnSizingInfo:{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]},...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",onColumnSizingChange:n("columnSizing",e),onColumnSizingInfoChange:n("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,l,o;const i=t.getState().columnSizing[e.id];return Math.min(Math.max(null!=(n=e.columnDef.minSize)?n:d.minSize,null!=(l=null!=i?i:e.columnDef.size)?l:d.size),null!=(o=e.columnDef.maxSize)?o:d.maxSize)},e.getStart=n=>{const l=n?"left"===n?t.getLeftVisibleLeafColumns():t.getRightVisibleLeafColumns():t.getVisibleLeafColumns(),o=l.findIndex((t=>t.id===e.id));if(o>0){const e=l[o-1];return e.getStart(n)+e.getSize()}return 0},e.resetSize=()=>{t.setColumnSizing((t=>{let{[e.id]:n,...l}=t;return l}))},e.getCanResize=()=>{var n,l;return(null==(n=e.columnDef.enableResizing)||n)&&(null==(l=t.options.enableColumnResizing)||l)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0;const n=e=>{var l;e.subHeaders.length?e.subHeaders.forEach(n):t+=null!=(l=e.column.getSize())?l:0};return n(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=()=>{const n=t.getColumn(e.column.id),l=null==n?void 0:n.getCanResize();return o=>{if(!n||!l)return;if(null==o.persist||o.persist(),m(o)&&o.touches&&o.touches.length>1)return;const i=e.getSize(),r=e?e.getLeafHeaders().map((e=>[e.column.id,e.column.getSize()])):[[n.id,n.getSize()]],u=m(o)?Math.round(o.touches[0].clientX):o.clientX,a={},s=(e,n)=>{"number"==typeof n&&(t.setColumnSizingInfo((e=>{var t,l;const o=n-(null!=(t=null==e?void 0:e.startOffset)?t:0),i=Math.max(o/(null!=(l=null==e?void 0:e.startSize)?l:0),-.999999);return e.columnSizingStart.forEach((e=>{let[t,n]=e;a[t]=Math.round(100*Math.max(n+n*i,0))/100})),{...e,deltaOffset:o,deltaPercentage:i}})),"onChange"!==t.options.columnResizeMode&&"end"!==e||t.setColumnSizing((e=>({...e,...a}))))},g=e=>s("move",e),d=e=>{s("end",e),t.setColumnSizingInfo((e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]})))},c={moveHandler:e=>g(e.clientX),upHandler:e=>{document.removeEventListener("mousemove",c.moveHandler),document.removeEventListener("mouseup",c.upHandler),d(e.clientX)}},p={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),g(e.touches[0].clientX),!1),upHandler:e=>{var t;document.removeEventListener("touchmove",p.moveHandler),document.removeEventListener("touchend",p.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),d(null==(t=e.touches[0])?void 0:t.clientX)}},b=!!f()&&{passive:!1};m(o)?(document.addEventListener("touchmove",p.moveHandler,b),document.addEventListener("touchend",p.upHandler,b)):(document.addEventListener("mousemove",c.moveHandler,b),document.addEventListener("mouseup",c.upHandler,b)),t.setColumnSizingInfo((e=>({...e,startOffset:u,startSize:i,deltaOffset:0,deltaPercentage:0,columnSizingStart:r,isResizingColumn:n.id})))}}},createTable:e=>{e.setColumnSizing=t=>null==e.options.onColumnSizingChange?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>null==e.options.onColumnSizingInfoChange?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:null!=(n=e.initialState.columnSizing)?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}:null!=(n=e.initialState.columnSizingInfo)?n:{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]})},e.getTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0},e.getLeftTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getLeftHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0},e.getCenterTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getCenterHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0},e.getRightTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getRightHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0}}};let p=null;function f(){if("boolean"==typeof p)return p;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch(t){e=!1}return p=e,p}function m(e){return"touchstart"===e.type}const b={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:n("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var l,o;if(t){if(null!=(l=null!=(o=e.options.autoResetAll)?o:e.options.autoResetExpanded)?l:!e.options.manualExpanding){if(n)return;n=!0,e._queue((()=>{e.resetExpanded(),n=!1}))}}else e._queue((()=>{t=!0}))},e.setExpanded=t=>null==e.options.onExpandedChange?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{(null!=t?t:!e.getIsAllRowsExpanded())?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{var n,l;e.setExpanded(t?{}:null!=(n=null==(l=e.initialState)?void 0:l.expanded)?n:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some((e=>e.getCanExpand())),e.getToggleAllRowsExpandedHandler=()=>t=>{null==t.persist||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const t=e.getState().expanded;return!0===t||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{const t=e.getState().expanded;return"boolean"==typeof t?!0===t:!!Object.keys(t).length&&!e.getRowModel().flatRows.some((e=>!e.getIsExpanded()))},e.getExpandedDepth=()=>{let t=0;return(!0===e.getState().expanded?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach((e=>{const n=e.split(".");t=Math.max(t,n.length)})),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded((l=>{var o;const i=!0===l||!(null==l||!l[e.id]);let r={};if(!0===l?Object.keys(t.getRowModel().rowsById).forEach((e=>{r[e]=!0})):r=l,n=null!=(o=n)?o:!i,!i&&n)return{...r,[e.id]:!0};if(i&&!n){const{[e.id]:t,...n}=r;return n}return l}))},e.getIsExpanded=()=>{var n;const l=t.getState().expanded;return!!(null!=(n=null==t.options.getIsRowExpanded?void 0:t.options.getIsRowExpanded(e))?n:!0===l||(null==l?void 0:l[e.id]))},e.getCanExpand=()=>{var n,l,o;return null!=(n=null==t.options.getRowCanExpand?void 0:t.options.getRowCanExpand(e))?n:(null==(l=t.options.enableExpanding)||l)&&!(null==(o=e.subRows)||!o.length)},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},v=(e,t,n)=>{var l;const o=n.toLowerCase();return Boolean(null==(l=e.getValue(t))||null==(l=l.toString())||null==(l=l.toLowerCase())?void 0:l.includes(o))};v.autoRemove=e=>I(e);const w=(e,t,n)=>{var l;return Boolean(null==(l=e.getValue(t))||null==(l=l.toString())?void 0:l.includes(n))};w.autoRemove=e=>I(e);const h=(e,t,n)=>{var l;return(null==(l=e.getValue(t))||null==(l=l.toString())?void 0:l.toLowerCase())===(null==n?void 0:n.toLowerCase())};h.autoRemove=e=>I(e);const C=(e,t,n)=>{var l;return null==(l=e.getValue(t))?void 0:l.includes(n)};C.autoRemove=e=>I(e)||!(null!=e&&e.length);const S=(e,t,n)=>!n.some((n=>{var l;return!(null!=(l=e.getValue(t))&&l.includes(n))}));S.autoRemove=e=>I(e)||!(null!=e&&e.length);const R=(e,t,n)=>n.some((n=>{var l;return null==(l=e.getValue(t))?void 0:l.includes(n)}));R.autoRemove=e=>I(e)||!(null!=e&&e.length);const F=(e,t,n)=>e.getValue(t)===n;F.autoRemove=e=>I(e);const M=(e,t,n)=>e.getValue(t)==n;M.autoRemove=e=>I(e);const V=(e,t,n)=>{let[l,o]=n;const i=e.getValue(t);return i>=l&&i<=o};V.resolveFilterValue=e=>{let[t,n]=e,l="number"!=typeof t?parseFloat(t):t,o="number"!=typeof n?parseFloat(n):n,i=null===t||Number.isNaN(l)?-1/0:l,r=null===n||Number.isNaN(o)?1/0:o;if(i>r){const e=i;i=r,r=e}return[i,r]},V.autoRemove=e=>I(e)||I(e[0])&&I(e[1]);const y={includesString:v,includesStringSensitive:w,equalsString:h,arrIncludes:C,arrIncludesAll:S,arrIncludesSome:R,equals:F,weakEquals:M,inNumberRange:V};function I(e){return null==e||""===e}const x={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:n("columnFilters",e),onGlobalFilterChange:n("globalFilter",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100,globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const l=null==(n=e.getCoreRowModel().flatRows[0])||null==(n=n._getAllCellsByColumnId()[t.id])?void 0:n.getValue();return"string"==typeof l||"number"==typeof l}}),createColumn:(e,n)=>{e.getAutoFilterFn=()=>{const t=n.getCoreRowModel().flatRows[0],l=null==t?void 0:t.getValue(e.id);return"string"==typeof l?y.includesString:"number"==typeof l?y.inNumberRange:"boolean"==typeof l||null!==l&&"object"==typeof l?y.equals:Array.isArray(l)?y.arrIncludes:y.weakEquals},e.getFilterFn=()=>{var t,o;return l(e.columnDef.filterFn)?e.columnDef.filterFn:"auto"===e.columnDef.filterFn?e.getAutoFilterFn():null!=(t=null==(o=n.options.filterFns)?void 0:o[e.columnDef.filterFn])?t:y[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,l,o;return(null==(t=e.columnDef.enableColumnFilter)||t)&&(null==(l=n.options.enableColumnFilters)||l)&&(null==(o=n.options.enableFilters)||o)&&!!e.accessorFn},e.getCanGlobalFilter=()=>{var t,l,o,i;return(null==(t=e.columnDef.enableGlobalFilter)||t)&&(null==(l=n.options.enableGlobalFilter)||l)&&(null==(o=n.options.enableFilters)||o)&&(null==(i=null==n.options.getColumnCanGlobalFilter?void 0:n.options.getColumnCanGlobalFilter(e))||i)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return null==(t=n.getState().columnFilters)||null==(t=t.find((t=>t.id===e.id)))?void 0:t.value},e.getFilterIndex=()=>{var t,l;return null!=(t=null==(l=n.getState().columnFilters)?void 0:l.findIndex((t=>t.id===e.id)))?t:-1},e.setFilterValue=l=>{n.setColumnFilters((n=>{const o=e.getFilterFn(),i=null==n?void 0:n.find((t=>t.id===e.id)),r=t(l,i?i.value:void 0);var u;if(_(o,r,e))return null!=(u=null==n?void 0:n.filter((t=>t.id!==e.id)))?u:[];const a={id:e.id,value:r};var s;return i?null!=(s=null==n?void 0:n.map((t=>t.id===e.id?a:t)))?s:[]:null!=n&&n.length?[...n,a]:[a]}))},e._getFacetedRowModel=n.options.getFacetedRowModel&&n.options.getFacetedRowModel(n,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():n.getPreFilteredRowModel(),e._getFacetedUniqueValues=n.options.getFacetedUniqueValues&&n.options.getFacetedUniqueValues(n,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=n.options.getFacetedMinMaxValues&&n.options.getFacetedMinMaxValues(n,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.getGlobalAutoFilterFn=()=>y.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:o}=e.options;return l(o)?o:"auto"===o?e.getGlobalAutoFilterFn():null!=(t=null==(n=e.options.filterFns)?void 0:n[o])?t:y[o]},e.setColumnFilters=n=>{const l=e.getAllLeafColumns();null==e.options.onColumnFiltersChange||e.options.onColumnFiltersChange((e=>{var o;return null==(o=t(n,e))?void 0:o.filter((e=>{const t=l.find((t=>t.id===e.id));if(t){if(_(t.getFilterFn(),e.value,t))return!1}return!0}))}))},e.setGlobalFilter=t=>{null==e.options.onGlobalFilterChange||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)},e.resetColumnFilters=t=>{var n,l;e.setColumnFilters(t?[]:null!=(n=null==(l=e.initialState)?void 0:l.columnFilters)?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel()),e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}};function _(e,t,n){return!(!e||!e.autoRemove)&&e.autoRemove(t,n)||void 0===t||"string"==typeof t&&!t}const P={sum:(e,t,n)=>n.reduce(((t,n)=>{const l=n.getValue(e);return t+("number"==typeof l?l:0)}),0),min:(e,t,n)=>{let l;return n.forEach((t=>{const n=t.getValue(e);null!=n&&(l>n||void 0===l&&n>=n)&&(l=n)})),l},max:(e,t,n)=>{let l;return n.forEach((t=>{const n=t.getValue(e);null!=n&&(l<n||void 0===l&&n>=n)&&(l=n)})),l},extent:(e,t,n)=>{let l,o;return n.forEach((t=>{const n=t.getValue(e);null!=n&&(void 0===l?n>=n&&(l=o=n):(l>n&&(l=n),o<n&&(o=n)))})),[l,o]},mean:(e,t)=>{let n=0,l=0;if(t.forEach((t=>{let o=t.getValue(e);null!=o&&(o=+o)>=o&&(++n,l+=o)})),n)return l/n},median:(e,t)=>{if(!t.length)return;const n=t.map((t=>t.getValue(e)));if(!o(n))return;if(1===n.length)return n[0];const l=Math.floor(n.length/2),i=n.sort(((e,t)=>e-t));return n.length%2!=0?i[l]:(i[l-1]+i[l])/2},unique:(e,t)=>Array.from(new Set(t.map((t=>t.getValue(e)))).values()),uniqueCount:(e,t)=>new Set(t.map((t=>t.getValue(e)))).size,count:(e,t)=>t.length},A={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return null!=(t=null==(n=e.getValue())||null==n.toString?void 0:n.toString())?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:n("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping((t=>null!=t&&t.includes(e.id)?t.filter((t=>t!==e.id)):[...null!=t?t:[],e.id]))},e.getCanGroup=()=>{var n,l,o,i;return null!=(n=null==(l=null!=(o=null==(i=e.columnDef.enableGrouping)||i)?o:t.options.enableGrouping)||l)?n:!!e.accessorFn},e.getIsGrouped=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],l=null==n?void 0:n.getValue(e.id);return"number"==typeof l?P.sum:"[object Date]"===Object.prototype.toString.call(l)?P.extent:void 0},e.getAggregationFn=()=>{var n,o;if(!e)throw new Error;return l(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:"auto"===e.columnDef.aggregationFn?e.getAutoAggregationFn():null!=(n=null==(o=t.options.aggregationFns)?void 0:o[e.columnDef.aggregationFn])?n:P[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>null==e.options.onGroupingChange?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,l;e.setGrouping(t?[]:null!=(n=null==(l=e.initialState)?void 0:l.grouping)?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const l=t.getColumn(n);return null!=l&&l.columnDef.getGroupingValue?(e._groupingValuesCache[n]=l.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,l)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!(null==(t=n.subRows)||!t.length)}}};function E(e,t,n){if(null==t||!t.length||!n)return e;const l=e.filter((e=>!t.includes(e.id)));if("remove"===n)return l;return[...t.map((t=>e.find((e=>e.id===t)))).filter(Boolean),...l]}const G={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:n("columnOrder",e)}),createTable:e=>{e.setColumnOrder=t=>null==e.options.onColumnOrderChange?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:null!=(n=e.initialState.columnOrder)?n:[])},e._getOrderColumnsFn=r((()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode]),((e,t,n)=>l=>{let o=[];if(null!=e&&e.length){const t=[...e],n=[...l];for(;n.length&&t.length;){const e=t.shift(),l=n.findIndex((t=>t.id===e));l>-1&&o.push(n.splice(l,1)[0])}o=[...o,...n]}else o=l;return E(o,t,n)}),{key:!1})}},H={getInitialState:e=>({...e,pagination:{pageIndex:0,pageSize:10,...null==e?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:n("pagination",e)}),createTable:e=>{let n=!1,l=!1;e._autoResetPageIndex=()=>{var t,o;if(n){if(null!=(t=null!=(o=e.options.autoResetAll)?o:e.options.autoResetPageIndex)?t:!e.options.manualPagination){if(l)return;l=!0,e._queue((()=>{e.resetPageIndex(),l=!1}))}}else e._queue((()=>{n=!0}))},e.setPagination=n=>null==e.options.onPaginationChange?void 0:e.options.onPaginationChange((e=>t(n,e))),e.resetPagination=t=>{var n;e.setPagination(t?{pageIndex:0,pageSize:10}:null!=(n=e.initialState.pagination)?n:{pageIndex:0,pageSize:10})},e.setPageIndex=n=>{e.setPagination((l=>{let o=t(n,l.pageIndex);const i=void 0===e.options.pageCount||-1===e.options.pageCount?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return o=Math.max(0,Math.min(o,i)),{...l,pageIndex:o}}))},e.resetPageIndex=t=>{var n,l;e.setPageIndex(t?0:null!=(n=null==(l=e.initialState)||null==(l=l.pagination)?void 0:l.pageIndex)?n:0)},e.resetPageSize=t=>{var n,l;e.setPageSize(t?10:null!=(n=null==(l=e.initialState)||null==(l=l.pagination)?void 0:l.pageSize)?n:10)},e.setPageSize=n=>{e.setPagination((e=>{const l=Math.max(1,t(n,e.pageSize)),o=e.pageSize*e.pageIndex,i=Math.floor(o/l);return{...e,pageIndex:i,pageSize:l}}))},e.setPageCount=n=>e.setPagination((l=>{var o;let i=t(n,null!=(o=e.options.pageCount)?o:-1);return"number"==typeof i&&(i=Math.max(-1,i)),{...l,pageCount:i}})),e.getPageOptions=r((()=>[e.getPageCount()]),(e=>{let t=[];return e&&e>0&&(t=[...new Array(e)].fill(null).map(((e,t)=>t))),t}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable}}),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return-1===n||0!==n&&t<n-1},e.previousPage=()=>e.setPageIndex((e=>e-1)),e.nextPage=()=>e.setPageIndex((e=>e+1)),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var t;return null!=(t=e.options.pageCount)?t:Math.ceil(e.getPrePaginationRowModel().rows.length/e.getState().pagination.pageSize)}}},z={getInitialState:e=>({columnPinning:{left:[],right:[]},...e}),getDefaultOptions:e=>({onColumnPinningChange:n("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const l=e.getLeafColumns().map((e=>e.id)).filter(Boolean);t.setColumnPinning((e=>{var t,o,i,r,u,a;return"right"===n?{left:(null!=(i=null==e?void 0:e.left)?i:[]).filter((e=>!(null!=l&&l.includes(e)))),right:[...(null!=(r=null==e?void 0:e.right)?r:[]).filter((e=>!(null!=l&&l.includes(e)))),...l]}:"left"===n?{left:[...(null!=(u=null==e?void 0:e.left)?u:[]).filter((e=>!(null!=l&&l.includes(e)))),...l],right:(null!=(a=null==e?void 0:e.right)?a:[]).filter((e=>!(null!=l&&l.includes(e))))}:{left:(null!=(t=null==e?void 0:e.left)?t:[]).filter((e=>!(null!=l&&l.includes(e)))),right:(null!=(o=null==e?void 0:e.right)?o:[]).filter((e=>!(null!=l&&l.includes(e))))}}))},e.getCanPin=()=>e.getLeafColumns().some((e=>{var n,l;return(null==(n=e.columnDef.enablePinning)||n)&&(null==(l=t.options.enablePinning)||l)})),e.getIsPinned=()=>{const n=e.getLeafColumns().map((e=>e.id)),{left:l,right:o}=t.getState().columnPinning,i=n.some((e=>null==l?void 0:l.includes(e))),r=n.some((e=>null==o?void 0:o.includes(e)));return i?"left":!!r&&"right"},e.getPinnedIndex=()=>{var n,l;const o=e.getIsPinned();return o?null!=(n=null==(l=t.getState().columnPinning)||null==(l=l[o])?void 0:l.indexOf(e.id))?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=r((()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right]),((e,t,n)=>{const l=[...null!=t?t:[],...null!=n?n:[]];return e.filter((e=>!l.includes(e.column.id)))}),{key:"row.getCenterVisibleCells",debug:()=>{var e;return null!=(e=t.options.debugAll)?e:t.options.debugRows}}),e.getLeftVisibleCells=r((()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,,]),((e,t)=>(null!=t?t:[]).map((t=>e.find((e=>e.column.id===t)))).filter(Boolean).map((e=>({...e,position:"left"})))),{key:"row.getLeftVisibleCells",debug:()=>{var e;return null!=(e=t.options.debugAll)?e:t.options.debugRows}}),e.getRightVisibleCells=r((()=>[e._getAllVisibleCells(),t.getState().columnPinning.right]),((e,t)=>(null!=t?t:[]).map((t=>e.find((e=>e.column.id===t)))).filter(Boolean).map((e=>({...e,position:"right"})))),{key:"row.getRightVisibleCells",debug:()=>{var e;return null!=(e=t.options.debugAll)?e:t.options.debugRows}})},createTable:e=>{e.setColumnPinning=t=>null==e.options.onColumnPinningChange?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,l;return e.setColumnPinning(t?{left:[],right:[]}:null!=(n=null==(l=e.initialState)?void 0:l.columnPinning)?n:{left:[],right:[]})},e.getIsSomeColumnsPinned=t=>{var n;const l=e.getState().columnPinning;var o,i;return t?Boolean(null==(n=l[t])?void 0:n.length):Boolean((null==(o=l.left)?void 0:o.length)||(null==(i=l.right)?void 0:i.length))},e.getLeftLeafColumns=r((()=>[e.getAllLeafColumns(),e.getState().columnPinning.left]),((e,t)=>(null!=t?t:[]).map((t=>e.find((e=>e.id===t)))).filter(Boolean)),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugColumns}}),e.getRightLeafColumns=r((()=>[e.getAllLeafColumns(),e.getState().columnPinning.right]),((e,t)=>(null!=t?t:[]).map((t=>e.find((e=>e.id===t)))).filter(Boolean)),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugColumns}}),e.getCenterLeafColumns=r((()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right]),((e,t,n)=>{const l=[...null!=t?t:[],...null!=n?n:[]];return e.filter((e=>!l.includes(e.id)))}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugColumns}})}},L={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:n("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>null==e.options.onRowSelectionChange?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:null!=(n=e.initialState.rowSelection)?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection((n=>{t=void 0!==t?t:!e.getIsAllRowsSelected();const l={...n},o=e.getPreGroupedRowModel().flatRows;return t?o.forEach((e=>{e.getCanSelect()&&(l[e.id]=!0)})):o.forEach((e=>{delete l[e.id]})),l}))},e.toggleAllPageRowsSelected=t=>e.setRowSelection((n=>{const l=void 0!==t?t:!e.getIsAllPageRowsSelected(),o={...n};return e.getRowModel().rows.forEach((t=>{D(o,t.id,l,e)})),o})),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=r((()=>[e.getState().rowSelection,e.getCoreRowModel()]),((t,n)=>Object.keys(t).length?k(e,n):{rows:[],flatRows:[],rowsById:{}}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable}}),e.getFilteredSelectedRowModel=r((()=>[e.getState().rowSelection,e.getFilteredRowModel()]),((t,n)=>Object.keys(t).length?k(e,n):{rows:[],flatRows:[],rowsById:{}}),{key:"getFilteredSelectedRowModel",debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable}}),e.getGroupedSelectedRowModel=r((()=>[e.getState().rowSelection,e.getSortedRowModel()]),((t,n)=>Object.keys(t).length?k(e,n):{rows:[],flatRows:[],rowsById:{}}),{key:"getGroupedSelectedRowModel",debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable}}),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let l=Boolean(t.length&&Object.keys(n).length);return l&&t.some((e=>e.getCanSelect()&&!n[e.id]))&&(l=!1),l},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter((e=>e.getCanSelect())),{rowSelection:n}=e.getState();let l=!!t.length;return l&&t.some((e=>!n[e.id]))&&(l=!1),l},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys(null!=(t=e.getState().rowSelection)?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows;return!e.getIsAllPageRowsSelected()&&t.filter((e=>e.getCanSelect())).some((e=>e.getIsSelected()||e.getIsSomeSelected()))},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=n=>{const l=e.getIsSelected();t.setRowSelection((o=>{if(l===(n=void 0!==n?n:!l))return o;const i={...o};return D(i,e.id,n,t),i}))},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return O(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return"some"===T(e,n)},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return"all"===T(e,n)},e.getCanSelect=()=>{var n;return"function"==typeof t.options.enableRowSelection?t.options.enableRowSelection(e):null==(n=t.options.enableRowSelection)||n},e.getCanSelectSubRows=()=>{var n;return"function"==typeof t.options.enableSubRowSelection?t.options.enableSubRowSelection(e):null==(n=t.options.enableSubRowSelection)||n},e.getCanMultiSelect=()=>{var n;return"function"==typeof t.options.enableMultiRowSelection?t.options.enableMultiRowSelection(e):null==(n=t.options.enableMultiRowSelection)||n},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return n=>{var l;t&&e.toggleSelected(null==(l=n.target)?void 0:l.checked)}}}},D=(e,t,n,l)=>{var o;const i=l.getRow(t);n?(i.getCanMultiSelect()||Object.keys(e).forEach((t=>delete e[t])),i.getCanSelect()&&(e[t]=!0)):delete e[t],null!=(o=i.subRows)&&o.length&&i.getCanSelectSubRows()&&i.subRows.forEach((t=>D(e,t.id,n,l)))};function k(e,t){const n=e.getState().rowSelection,l=[],o={},i=function(e,t){return e.map((e=>{var t;const r=O(e,n);if(r&&(l.push(e),o[e.id]=e),null!=(t=e.subRows)&&t.length&&(e={...e,subRows:i(e.subRows)}),r)return e})).filter(Boolean)};return{rows:i(t.rows),flatRows:l,rowsById:o}}function O(e,t){var n;return null!=(n=t[e.id])&&n}function T(e,t,n){if(e.subRows&&e.subRows.length){let n=!0,l=!1;return e.subRows.forEach((e=>{l&&!n||(O(e,t)?l=!0:n=!1)})),n?"all":!!l&&"some"}return!1}const B=/([0-9]+)/gm;function q(e,t){return e===t?0:e>t?1:-1}function j(e){return"number"==typeof e?isNaN(e)||e===1/0||e===-1/0?"":String(e):"string"==typeof e?e:""}function N(e,t){const n=e.split(B).filter(Boolean),l=t.split(B).filter(Boolean);for(;n.length&&l.length;){const e=n.shift(),t=l.shift(),o=parseInt(e,10),i=parseInt(t,10),r=[o,i].sort();if(isNaN(r[0])){if(e>t)return 1;if(t>e)return-1}else{if(isNaN(r[1]))return isNaN(o)?-1:1;if(o>i)return 1;if(i>o)return-1}}return n.length-l.length}const U={alphanumeric:(e,t,n)=>N(j(e.getValue(n)).toLowerCase(),j(t.getValue(n)).toLowerCase()),alphanumericCaseSensitive:(e,t,n)=>N(j(e.getValue(n)),j(t.getValue(n))),text:(e,t,n)=>q(j(e.getValue(n)).toLowerCase(),j(t.getValue(n)).toLowerCase()),textCaseSensitive:(e,t,n)=>q(j(e.getValue(n)),j(t.getValue(n))),datetime:(e,t,n)=>{const l=e.getValue(n),o=t.getValue(n);return l>o?1:l<o?-1:0},basic:(e,t,n)=>q(e.getValue(n),t.getValue(n))},$={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:n("sorting",e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let l=!1;for(const t of n){const n=null==t?void 0:t.getValue(e.id);if("[object Date]"===Object.prototype.toString.call(n))return U.datetime;if("string"==typeof n&&(l=!0,n.split(B).length>1))return U.alphanumeric}return l?U.text:U.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return"string"==typeof(null==n?void 0:n.getValue(e.id))?"asc":"desc"},e.getSortingFn=()=>{var n,o;if(!e)throw new Error;return l(e.columnDef.sortingFn)?e.columnDef.sortingFn:"auto"===e.columnDef.sortingFn?e.getAutoSortingFn():null!=(n=null==(o=t.options.sortingFns)?void 0:o[e.columnDef.sortingFn])?n:U[e.columnDef.sortingFn]},e.toggleSorting=(n,l)=>{const o=e.getNextSortingOrder(),i=null!=n;t.setSorting((r=>{const u=null==r?void 0:r.find((t=>t.id===e.id)),a=null==r?void 0:r.findIndex((t=>t.id===e.id));let s,g=[],d=i?n:"desc"===o;var c;(s=null!=r&&r.length&&e.getCanMultiSort()&&l?u?"toggle":"add":null!=r&&r.length&&a!==r.length-1?"replace":u?"toggle":"replace","toggle"===s&&(i||o||(s="remove")),"add"===s)?(g=[...r,{id:e.id,desc:d}],g.splice(0,g.length-(null!=(c=t.options.maxMultiSortColCount)?c:Number.MAX_SAFE_INTEGER))):g="toggle"===s?r.map((t=>t.id===e.id?{...t,desc:d}:t)):"remove"===s?r.filter((t=>t.id!==e.id)):[{id:e.id,desc:d}];return g}))},e.getFirstSortDir=()=>{var n,l;return(null!=(n=null!=(l=e.columnDef.sortDescFirst)?l:t.options.sortDescFirst)?n:"desc"===e.getAutoSortDir())?"desc":"asc"},e.getNextSortingOrder=n=>{var l,o;const i=e.getFirstSortDir(),r=e.getIsSorted();return r?!!(r===i||null!=(l=t.options.enableSortingRemoval)&&!l||n&&null!=(o=t.options.enableMultiRemove)&&!o)&&("desc"===r?"asc":"desc"):i},e.getCanSort=()=>{var n,l;return(null==(n=e.columnDef.enableSorting)||n)&&(null==(l=t.options.enableSorting)||l)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,l;return null!=(n=null!=(l=e.columnDef.enableMultiSort)?l:t.options.enableMultiSort)?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const l=null==(n=t.getState().sorting)?void 0:n.find((t=>t.id===e.id));return!!l&&(l.desc?"desc":"asc")},e.getSortIndex=()=>{var n,l;return null!=(n=null==(l=t.getState().sorting)?void 0:l.findIndex((t=>t.id===e.id)))?n:-1},e.clearSorting=()=>{t.setSorting((t=>null!=t&&t.length?t.filter((t=>t.id!==e.id)):[]))},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return l=>{n&&(null==l.persist||l.persist(),null==e.toggleSorting||e.toggleSorting(void 0,!!e.getCanMultiSort()&&(null==t.options.isMultiSortEvent?void 0:t.options.isMultiSortEvent(l))))}}},createTable:e=>{e.setSorting=t=>null==e.options.onSortingChange?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,l;e.setSorting(t?[]:null!=(n=null==(l=e.initialState)?void 0:l.sorting)?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},X={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:n("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility((t=>({...t,[e.id]:null!=n?n:!e.getIsVisible()})))},e.getIsVisible=()=>{var n,l;return null==(n=null==(l=t.getState().columnVisibility)?void 0:l[e.id])||n},e.getCanHide=()=>{var n,l;return(null==(n=e.columnDef.enableHiding)||n)&&(null==(l=t.options.enableHiding)||l)},e.getToggleVisibilityHandler=()=>t=>{null==e.toggleVisibility||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=r((()=>[e.getAllCells(),t.getState().columnVisibility]),(e=>e.filter((e=>e.column.getIsVisible()))),{key:"row._getAllVisibleCells",debug:()=>{var e;return null!=(e=t.options.debugAll)?e:t.options.debugRows}}),e.getVisibleCells=r((()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()]),((e,t,n)=>[...e,...t,...n]),{key:!1,debug:()=>{var e;return null!=(e=t.options.debugAll)?e:t.options.debugRows}})},createTable:e=>{const t=(t,n)=>r((()=>[n(),n().filter((e=>e.getIsVisible())).map((e=>e.id)).join("_")]),(e=>e.filter((e=>null==e.getIsVisible?void 0:e.getIsVisible()))),{key:t,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugColumns}});e.getVisibleFlatColumns=t("getVisibleFlatColumns",(()=>e.getAllFlatColumns())),e.getVisibleLeafColumns=t("getVisibleLeafColumns",(()=>e.getAllLeafColumns())),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",(()=>e.getLeftLeafColumns())),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",(()=>e.getRightLeafColumns())),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",(()=>e.getCenterLeafColumns())),e.setColumnVisibility=t=>null==e.options.onColumnVisibilityChange?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var n;e.setColumnVisibility(t?{}:null!=(n=e.initialState.columnVisibility)?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=null!=(n=t)?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce(((e,n)=>({...e,[n.id]:t||!(null!=n.getCanHide&&n.getCanHide())})),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some((e=>!(null!=e.getIsVisible&&e.getIsVisible()))),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some((e=>null==e.getIsVisible?void 0:e.getIsVisible())),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var n;e.toggleAllColumnsVisible(null==(n=t.target)?void 0:n.checked)}}},K=[s,X,G,z,x,$,A,b,H,L,c];function J(e,t,n,l){const o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(l),renderValue:()=>{var t;return null!=(t=o.getValue())?t:e.options.renderFallbackValue},getContext:r((()=>[e,n,t,o]),((e,t,n,l)=>({table:e,column:t,row:n,cell:l,getValue:l.getValue,renderValue:l.renderValue})),{key:!1,debug:()=>e.options.debugAll})};return e._features.forEach((l=>{null==l.createCell||l.createCell(o,n,t,e)}),{}),o}const Q=(e,t,n,l,o,u,a)=>{let s={id:t,index:l,original:n,depth:o,parentId:a,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(s._valuesCache.hasOwnProperty(t))return s._valuesCache[t];const n=e.getColumn(t);return null!=n&&n.accessorFn?(s._valuesCache[t]=n.accessorFn(s.original,l),s._valuesCache[t]):void 0},getUniqueValues:t=>{if(s._uniqueValuesCache.hasOwnProperty(t))return s._uniqueValuesCache[t];const n=e.getColumn(t);return null!=n&&n.accessorFn?n.columnDef.getUniqueValues?(s._uniqueValuesCache[t]=n.columnDef.getUniqueValues(s.original,l),s._uniqueValuesCache[t]):(s._uniqueValuesCache[t]=[s.getValue(t)],s._uniqueValuesCache[t]):void 0},renderValue:t=>{var n;return null!=(n=s.getValue(t))?n:e.options.renderFallbackValue},subRows:null!=u?u:[],getLeafRows:()=>i(s.subRows,(e=>e.subRows)),getParentRow:()=>s.parentId?e.getRow(s.parentId):void 0,getParentRows:()=>{let e=[],t=s;for(;;){const n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:r((()=>[e.getAllLeafColumns()]),(t=>t.map((t=>J(e,s,t,t.id)))),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugRows}}),_getAllCellsByColumnId:r((()=>[s.getAllCells()]),(e=>e.reduce(((e,t)=>(e[t.column.id]=t,e)),{})),{key:"row.getAllCellsByColumnId",debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugRows}})};for(let t=0;t<e._features.length;t++){const n=e._features[t];null==n||null==n.createRow||n.createRow(s,e)}return s};function W(e,t,n){return n.options.filterFromLeafRows?function(e,t,n){var l;const o=[],i={},r=null!=(l=n.options.maxLeafRowFilterDepth)?l:100,u=function(e,l){void 0===l&&(l=0);const a=[];for(let g=0;g<e.length;g++){var s;let d=e[g];const c=Q(n,d.id,d.original,d.index,d.depth,void 0,d.parentId);if(c.columnFilters=d.columnFilters,null!=(s=d.subRows)&&s.length&&l<r){if(c.subRows=u(d.subRows,l+1),d=c,t(d)&&!c.subRows.length){a.push(d),i[d.id]=d,o.push(d);continue}if(t(d)||c.subRows.length){a.push(d),i[d.id]=d,o.push(d);continue}}else d=c,t(d)&&(a.push(d),i[d.id]=d,o.push(d))}return a};return{rows:u(e),flatRows:o,rowsById:i}}(e,t,n):function(e,t,n){var l;const o=[],i={},r=null!=(l=n.options.maxLeafRowFilterDepth)?l:100,u=function(e,l){void 0===l&&(l=0);const a=[];for(let g=0;g<e.length;g++){let d=e[g];if(t(d)){var s;if(null!=(s=d.subRows)&&s.length&&l<r){const e=Q(n,d.id,d.original,d.index,d.depth,void 0,d.parentId);e.subRows=u(d.subRows,l+1),d=e}a.push(d),o.push(d),i[d.id]=d}}return a};return{rows:u(e),flatRows:o,rowsById:i}}(e,t,n)}function Y(e){const t=[],n=e=>{var l;t.push(e),null!=(l=e.subRows)&&l.length&&e.getIsExpanded()&&e.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}e.ColumnSizing=c,e.Expanding=b,e.Filters=x,e.Grouping=A,e.Headers=s,e.Ordering=G,e.Pagination=H,e.Pinning=z,e.RowSelection=L,e.Sorting=$,e.Visibility=X,e.aggregationFns=P,e.buildHeaderGroups=g,e.createCell=J,e.createColumn=u,e.createColumnHelper=function(){return{accessor:(e,t)=>"function"==typeof e?{...t,accessorFn:e}:{...t,accessorKey:e},display:e=>e,group:e=>e}},e.createRow=Q,e.createTable=function(e){var n;(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");let l={_features:K};const o=l._features.reduce(((e,t)=>Object.assign(e,null==t.getDefaultOptions?void 0:t.getDefaultOptions(l))),{});let i={...null!=(n=e.initialState)?n:{}};l._features.forEach((e=>{var t;i=null!=(t=null==e.getInitialState?void 0:e.getInitialState(i))?t:i}));const a=[];let s=!1;const g={_features:K,options:{...o,...e},initialState:i,_queue:e=>{a.push(e),s||(s=!0,Promise.resolve().then((()=>{for(;a.length;)a.shift()();s=!1})).catch((e=>setTimeout((()=>{throw e})))))},reset:()=>{l.setState(l.initialState)},setOptions:e=>{const n=t(e,l.options);l.options=(e=>l.options.mergeOptions?l.options.mergeOptions(o,e):{...o,...e})(n)},getState:()=>l.options.state,setState:e=>{null==l.options.onStateChange||l.options.onStateChange(e)},_getRowId:(e,t,n)=>{var o;return null!=(o=null==l.options.getRowId?void 0:l.options.getRowId(e,t,n))?o:`${n?[n.id,t].join("."):t}`},getCoreRowModel:()=>(l._getCoreRowModel||(l._getCoreRowModel=l.options.getCoreRowModel(l)),l._getCoreRowModel()),getRowModel:()=>l.getPaginationRowModel(),getRow:e=>{const t=l.getRowModel().rowsById[e];if(!t)throw new Error;return t},_getDefaultColumnDef:r((()=>[l.options.defaultColumn]),(e=>{var t;return e=null!=(t=e)?t:{},{header:e=>{const t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t,n;return null!=(t=null==(n=e.renderValue())||null==n.toString?void 0:n.toString())?t:null},...l._features.reduce(((e,t)=>Object.assign(e,null==t.getDefaultColumnDef?void 0:t.getDefaultColumnDef())),{}),...e}}),{debug:()=>{var e;return null!=(e=l.options.debugAll)?e:l.options.debugColumns},key:!1}),_getColumnDefs:()=>l.options.columns,getAllColumns:r((()=>[l._getColumnDefs()]),(e=>{const t=function(e,n,o){return void 0===o&&(o=0),e.map((e=>{const i=u(l,e,o,n),r=e;return i.columns=r.columns?t(r.columns,i,o+1):[],i}))};return t(e)}),{key:!1,debug:()=>{var e;return null!=(e=l.options.debugAll)?e:l.options.debugColumns}}),getAllFlatColumns:r((()=>[l.getAllColumns()]),(e=>e.flatMap((e=>e.getFlatColumns()))),{key:!1,debug:()=>{var e;return null!=(e=l.options.debugAll)?e:l.options.debugColumns}}),_getAllFlatColumnsById:r((()=>[l.getAllFlatColumns()]),(e=>e.reduce(((e,t)=>(e[t.id]=t,e)),{})),{key:!1,debug:()=>{var e;return null!=(e=l.options.debugAll)?e:l.options.debugColumns}}),getAllLeafColumns:r((()=>[l.getAllColumns(),l._getOrderColumnsFn()]),((e,t)=>t(e.flatMap((e=>e.getLeafColumns())))),{key:!1,debug:()=>{var e;return null!=(e=l.options.debugAll)?e:l.options.debugColumns}}),getColumn:e=>l._getAllFlatColumnsById()[e]};Object.assign(l,g);for(let e=0;e<l._features.length;e++){const t=l._features[e];null==t||null==t.createTable||t.createTable(l)}return l},e.defaultColumnSizing=d,e.expandRows=Y,e.filterFns=y,e.flattenBy=i,e.functionalUpdate=t,e.getCoreRowModel=function(){return e=>r((()=>[e.options.data]),(t=>{const n={rows:[],flatRows:[],rowsById:{}},l=function(t,o,i){void 0===o&&(o=0);const r=[];for(let a=0;a<t.length;a++){const s=Q(e,e._getRowId(t[a],a,i),t[a],a,o,void 0,null==i?void 0:i.id);var u;if(n.flatRows.push(s),n.rowsById[s.id]=s,r.push(s),e.options.getSubRows)s.originalSubRows=e.options.getSubRows(t[a],a),null!=(u=s.originalSubRows)&&u.length&&(s.subRows=l(s.originalSubRows,o+1,s))}return r};return n.rows=l(t),n}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})},e.getExpandedRowModel=function(){return e=>r((()=>[e.getState().expanded,e.getPreExpandedRowModel(),e.options.paginateExpandedRows]),((e,t,n)=>!t.rows.length||!0!==e&&!Object.keys(null!=e?e:{}).length?t:n?Y(t):t),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable}})},e.getFacetedMinMaxValues=function(){return(e,t)=>r((()=>{var n;return[null==(n=e.getColumn(t))?void 0:n.getFacetedRowModel()]}),(e=>{var n;if(!e)return;const l=null==(n=e.flatRows[0])?void 0:n.getUniqueValues(t);if(void 0===l)return;let o=[l,l];for(let n=0;n<e.flatRows.length;n++){const l=e.flatRows[n].getUniqueValues(t);for(let e=0;e<l.length;e++){const t=l[e];t<o[0]?o[0]=t:t>o[1]&&(o[1]=t)}}return o}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable},onChange:()=>{}})},e.getFacetedRowModel=function(){return(e,t)=>r((()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()]),((n,l,o)=>{if(!n.rows.length||(null==l||!l.length)&&!o)return n;const i=[...l.map((e=>e.id)).filter((e=>e!==t)),o?"__global__":void 0].filter(Boolean);return W(n.rows,(e=>{for(let t=0;t<i.length;t++)if(!1===e.columnFilters[i[t]])return!1;return!0}),e)}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable},onChange:()=>{}})},e.getFacetedUniqueValues=function(){return(e,t)=>r((()=>{var n;return[null==(n=e.getColumn(t))?void 0:n.getFacetedRowModel()]}),(e=>{if(!e)return new Map;let n=new Map;for(let o=0;o<e.flatRows.length;o++){const i=e.flatRows[o].getUniqueValues(t);for(let e=0;e<i.length;e++){const t=i[e];var l;if(n.has(t))n.set(t,(null!=(l=n.get(t))?l:0)+1);else n.set(t,1)}}return n}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable},onChange:()=>{}})},e.getFilteredRowModel=function(){return e=>r((()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter]),((t,n,l)=>{if(!t.rows.length||(null==n||!n.length)&&!l){for(let e=0;e<t.flatRows.length;e++)t.flatRows[e].columnFilters={},t.flatRows[e].columnFiltersMeta={};return t}const o=[],i=[];(null!=n?n:[]).forEach((t=>{var n;const l=e.getColumn(t.id);if(!l)return;const i=l.getFilterFn();i&&o.push({id:t.id,filterFn:i,resolvedValue:null!=(n=null==i.resolveFilterValue?void 0:i.resolveFilterValue(t.value))?n:t.value})}));const r=n.map((e=>e.id)),u=e.getGlobalFilterFn(),a=e.getAllLeafColumns().filter((e=>e.getCanGlobalFilter()));let s,g;l&&u&&a.length&&(r.push("__global__"),a.forEach((e=>{var t;i.push({id:e.id,filterFn:u,resolvedValue:null!=(t=null==u.resolveFilterValue?void 0:u.resolveFilterValue(l))?t:l})})));for(let e=0;e<t.flatRows.length;e++){const n=t.flatRows[e];if(n.columnFilters={},o.length)for(let e=0;e<o.length;e++){s=o[e];const t=s.id;n.columnFilters[t]=s.filterFn(n,t,s.resolvedValue,(e=>{n.columnFiltersMeta[t]=e}))}if(i.length){for(let e=0;e<i.length;e++){g=i[e];const t=g.id;if(g.filterFn(n,t,g.resolvedValue,(e=>{n.columnFiltersMeta[t]=e}))){n.columnFilters.__global__=!0;break}}!0!==n.columnFilters.__global__&&(n.columnFilters.__global__=!1)}}return W(t.rows,(e=>{for(let t=0;t<r.length;t++)if(!1===e.columnFilters[r[t]])return!1;return!0}),e)}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})},e.getGroupedRowModel=function(){return e=>r((()=>[e.getState().grouping,e.getPreGroupedRowModel()]),((t,n)=>{if(!n.rows.length||!t.length)return n;const l=t.filter((t=>e.getColumn(t))),o=[],r={},u=function(t,n,a){if(void 0===n&&(n=0),n>=l.length)return t.map((e=>(e.depth=n,o.push(e),r[e.id]=e,e.subRows&&(e.subRows=u(e.subRows,n+1,e.id)),e)));const s=l[n],g=function(e,t){const n=new Map;return e.reduce(((e,n)=>{const l=`${n.getGroupingValue(t)}`,o=e.get(l);return o?o.push(n):e.set(l,[n]),e}),n)}(t,s),d=Array.from(g.entries()).map(((t,g)=>{let[d,c]=t,p=`${s}:${d}`;p=a?`${a}>${p}`:p;const f=u(c,n+1,p),m=n?i(c,(e=>e.subRows)):c,b=Q(e,p,m[0].original,g,n,void 0,a);return Object.assign(b,{groupingColumnId:s,groupingValue:d,subRows:f,leafRows:m,getValue:t=>{if(l.includes(t)){if(b._valuesCache.hasOwnProperty(t))return b._valuesCache[t];var n;if(c[0])b._valuesCache[t]=null!=(n=c[0].getValue(t))?n:void 0;return b._valuesCache[t]}if(b._groupingValuesCache.hasOwnProperty(t))return b._groupingValuesCache[t];const o=e.getColumn(t),i=null==o?void 0:o.getAggregationFn();return i?(b._groupingValuesCache[t]=i(t,m,c),b._groupingValuesCache[t]):void 0}}),f.forEach((e=>{o.push(e),r[e.id]=e})),b}));return d},a=u(n.rows,0);return a.forEach((e=>{o.push(e),r[e.id]=e})),{rows:a,flatRows:o,rowsById:r}}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable},onChange:()=>{e._queue((()=>{e._autoResetExpanded(),e._autoResetPageIndex()}))}})},e.getPaginationRowModel=function(e){return e=>r((()=>[e.getState().pagination,e.getPrePaginationRowModel(),e.options.paginateExpandedRows?void 0:e.getState().expanded]),((t,n)=>{if(!n.rows.length)return n;const{pageSize:l,pageIndex:o}=t;let{rows:i,flatRows:r,rowsById:u}=n;const a=l*o,s=a+l;let g;i=i.slice(a,s),g=e.options.paginateExpandedRows?{rows:i,flatRows:r,rowsById:u}:Y({rows:i,flatRows:r,rowsById:u}),g.flatRows=[];const d=e=>{g.flatRows.push(e),e.subRows.length&&e.subRows.forEach(d)};return g.rows.forEach(d),g}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable}})},e.getSortedRowModel=function(){return e=>r((()=>[e.getState().sorting,e.getPreSortedRowModel()]),((t,n)=>{if(!n.rows.length||null==t||!t.length)return n;const l=e.getState().sorting,o=[],i=l.filter((t=>{var n;return null==(n=e.getColumn(t.id))?void 0:n.getCanSort()})),r={};i.forEach((t=>{const n=e.getColumn(t.id);n&&(r[t.id]={sortUndefined:n.columnDef.sortUndefined,invertSorting:n.columnDef.invertSorting,sortingFn:n.getSortingFn()})}));const u=e=>{const t=[...e];return t.sort(((e,t)=>{for(let l=0;l<i.length;l+=1){var n;const o=i[l],u=r[o.id],a=null!=(n=null==o?void 0:o.desc)&&n;let s=0;if(u.sortUndefined){const n=void 0===e.getValue(o.id),l=void 0===t.getValue(o.id);(n||l)&&(s=n&&l?0:n?u.sortUndefined:-u.sortUndefined)}if(0===s&&(s=u.sortingFn(e,t,o.id)),0!==s)return a&&(s*=-1),u.invertSorting&&(s*=-1),s}return e.index-t.index})),t.forEach((e=>{var t;o.push(e),null!=(t=e.subRows)&&t.length&&(e.subRows=u(e.subRows))})),t};return{rows:u(n.rows),flatRows:o,rowsById:n.rowsById}}),{key:!1,debug:()=>{var t;return null!=(t=e.options.debugAll)?t:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})},e.isFunction=l,e.isNumberArray=o,e.isRowSelected=O,e.isSubRowSelected=T,e.makeStateUpdater=n,e.memo=r,e.noop=function(){},e.orderColumns=E,e.passiveEventSupported=f,e.reSplitAlphaNumeric=B,e.selectRowsFn=k,e.shouldAutoRemoveFilter=_,e.sortingFns=U,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=index.production.js.map
{
"name": "@tanstack/table-core",
"author": "Tanner Linsley",
"version": "8.9.7",
"version": "8.9.8",
"description": "Headless UI for building powerful tables & datagrids for TS/JS.",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -55,10 +55,7 @@ import { RowData, Cell, Column, Row, Table } from '../types'

table._features.forEach(feature => {
Object.assign(
cell,
feature.createCell?.(
cell as Cell<TData, TValue>,
column,
row as Row<TData>,
table
)
feature.createCell?.(
cell as Cell<TData, TValue>,
column,
row as Row<TData>,
table
)

@@ -65,0 +62,0 @@ }, {})

@@ -122,5 +122,5 @@ import {

column = table._features.reduce((obj, feature) => {
return Object.assign(obj, feature.createColumn?.(column, table))
}, column)
for (const feature of table._features) {
feature.createColumn?.(column, table)
}

@@ -127,0 +127,0 @@ // Yes, we have to convert table to uknown, because we know more than the compiler here.

@@ -102,3 +102,3 @@ import { RowData, Column, Header, HeaderGroup, Table } from '../types'

table._features.forEach(feature => {
Object.assign(header, feature.createHeader?.(header, table))
feature.createHeader?.(header, table)
})

@@ -110,281 +110,265 @@

export const Headers: TableFeature = {
createTable: <TData extends RowData>(
table: Table<TData>
): HeadersInstance<TData> => {
return {
// Header Groups
createTable: <TData extends RowData>(table: Table<TData>): void => {
// Header Groups
getHeaderGroups: memo(
() => [
table.getAllColumns(),
table.getVisibleLeafColumns(),
table.getState().columnPinning.left,
table.getState().columnPinning.right,
],
(allColumns, leafColumns, left, right) => {
const leftColumns =
left
?.map(columnId => leafColumns.find(d => d.id === columnId)!)
.filter(Boolean) ?? []
table.getHeaderGroups = memo(
() => [
table.getAllColumns(),
table.getVisibleLeafColumns(),
table.getState().columnPinning.left,
table.getState().columnPinning.right,
],
(allColumns, leafColumns, left, right) => {
const leftColumns =
left
?.map(columnId => leafColumns.find(d => d.id === columnId)!)
.filter(Boolean) ?? []
const rightColumns =
right
?.map(columnId => leafColumns.find(d => d.id === columnId)!)
.filter(Boolean) ?? []
const rightColumns =
right
?.map(columnId => leafColumns.find(d => d.id === columnId)!)
.filter(Boolean) ?? []
const centerColumns = leafColumns.filter(
column => !left?.includes(column.id) && !right?.includes(column.id)
)
const centerColumns = leafColumns.filter(
column => !left?.includes(column.id) && !right?.includes(column.id)
)
const headerGroups = buildHeaderGroups(
allColumns,
[...leftColumns, ...centerColumns, ...rightColumns],
table
)
const headerGroups = buildHeaderGroups(
allColumns,
[...leftColumns, ...centerColumns, ...rightColumns],
table
)
return headerGroups
},
{
key: process.env.NODE_ENV === 'development' && 'getHeaderGroups',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
),
return headerGroups
},
{
key: process.env.NODE_ENV === 'development' && 'getHeaderGroups',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
)
getCenterHeaderGroups: memo(
() => [
table.getAllColumns(),
table.getVisibleLeafColumns(),
table.getState().columnPinning.left,
table.getState().columnPinning.right,
],
(allColumns, leafColumns, left, right) => {
leafColumns = leafColumns.filter(
column => !left?.includes(column.id) && !right?.includes(column.id)
)
return buildHeaderGroups(allColumns, leafColumns, table, 'center')
},
{
key:
process.env.NODE_ENV === 'development' && 'getCenterHeaderGroups',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
),
table.getCenterHeaderGroups = memo(
() => [
table.getAllColumns(),
table.getVisibleLeafColumns(),
table.getState().columnPinning.left,
table.getState().columnPinning.right,
],
(allColumns, leafColumns, left, right) => {
leafColumns = leafColumns.filter(
column => !left?.includes(column.id) && !right?.includes(column.id)
)
return buildHeaderGroups(allColumns, leafColumns, table, 'center')
},
{
key: process.env.NODE_ENV === 'development' && 'getCenterHeaderGroups',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
)
getLeftHeaderGroups: memo(
() => [
table.getAllColumns(),
table.getVisibleLeafColumns(),
table.getState().columnPinning.left,
],
(allColumns, leafColumns, left) => {
const orderedLeafColumns =
left
?.map(columnId => leafColumns.find(d => d.id === columnId)!)
.filter(Boolean) ?? []
table.getLeftHeaderGroups = memo(
() => [
table.getAllColumns(),
table.getVisibleLeafColumns(),
table.getState().columnPinning.left,
],
(allColumns, leafColumns, left) => {
const orderedLeafColumns =
left
?.map(columnId => leafColumns.find(d => d.id === columnId)!)
.filter(Boolean) ?? []
return buildHeaderGroups(
allColumns,
orderedLeafColumns,
table,
'left'
)
},
{
key: process.env.NODE_ENV === 'development' && 'getLeftHeaderGroups',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
),
return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left')
},
{
key: process.env.NODE_ENV === 'development' && 'getLeftHeaderGroups',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
)
getRightHeaderGroups: memo(
() => [
table.getAllColumns(),
table.getVisibleLeafColumns(),
table.getState().columnPinning.right,
],
(allColumns, leafColumns, right) => {
const orderedLeafColumns =
right
?.map(columnId => leafColumns.find(d => d.id === columnId)!)
.filter(Boolean) ?? []
table.getRightHeaderGroups = memo(
() => [
table.getAllColumns(),
table.getVisibleLeafColumns(),
table.getState().columnPinning.right,
],
(allColumns, leafColumns, right) => {
const orderedLeafColumns =
right
?.map(columnId => leafColumns.find(d => d.id === columnId)!)
.filter(Boolean) ?? []
return buildHeaderGroups(
allColumns,
orderedLeafColumns,
table,
'right'
)
},
{
key: process.env.NODE_ENV === 'development' && 'getRightHeaderGroups',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
),
return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right')
},
{
key: process.env.NODE_ENV === 'development' && 'getRightHeaderGroups',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
)
// Footer Groups
// Footer Groups
getFooterGroups: memo(
() => [table.getHeaderGroups()],
headerGroups => {
return [...headerGroups].reverse()
},
{
key: process.env.NODE_ENV === 'development' && 'getFooterGroups',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
),
table.getFooterGroups = memo(
() => [table.getHeaderGroups()],
headerGroups => {
return [...headerGroups].reverse()
},
{
key: process.env.NODE_ENV === 'development' && 'getFooterGroups',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
)
getLeftFooterGroups: memo(
() => [table.getLeftHeaderGroups()],
headerGroups => {
return [...headerGroups].reverse()
},
{
key: process.env.NODE_ENV === 'development' && 'getLeftFooterGroups',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
),
table.getLeftFooterGroups = memo(
() => [table.getLeftHeaderGroups()],
headerGroups => {
return [...headerGroups].reverse()
},
{
key: process.env.NODE_ENV === 'development' && 'getLeftFooterGroups',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
)
getCenterFooterGroups: memo(
() => [table.getCenterHeaderGroups()],
headerGroups => {
return [...headerGroups].reverse()
},
{
key:
process.env.NODE_ENV === 'development' && 'getCenterFooterGroups',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
),
table.getCenterFooterGroups = memo(
() => [table.getCenterHeaderGroups()],
headerGroups => {
return [...headerGroups].reverse()
},
{
key: process.env.NODE_ENV === 'development' && 'getCenterFooterGroups',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
)
getRightFooterGroups: memo(
() => [table.getRightHeaderGroups()],
headerGroups => {
return [...headerGroups].reverse()
},
{
key: process.env.NODE_ENV === 'development' && 'getRightFooterGroups',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
),
table.getRightFooterGroups = memo(
() => [table.getRightHeaderGroups()],
headerGroups => {
return [...headerGroups].reverse()
},
{
key: process.env.NODE_ENV === 'development' && 'getRightFooterGroups',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
)
// Flat Headers
// Flat Headers
getFlatHeaders: memo(
() => [table.getHeaderGroups()],
headerGroups => {
return headerGroups
.map(headerGroup => {
return headerGroup.headers
})
.flat()
},
{
key: process.env.NODE_ENV === 'development' && 'getFlatHeaders',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
),
table.getFlatHeaders = memo(
() => [table.getHeaderGroups()],
headerGroups => {
return headerGroups
.map(headerGroup => {
return headerGroup.headers
})
.flat()
},
{
key: process.env.NODE_ENV === 'development' && 'getFlatHeaders',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
)
getLeftFlatHeaders: memo(
() => [table.getLeftHeaderGroups()],
left => {
return left
.map(headerGroup => {
return headerGroup.headers
})
.flat()
},
{
key: process.env.NODE_ENV === 'development' && 'getLeftFlatHeaders',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
),
table.getLeftFlatHeaders = memo(
() => [table.getLeftHeaderGroups()],
left => {
return left
.map(headerGroup => {
return headerGroup.headers
})
.flat()
},
{
key: process.env.NODE_ENV === 'development' && 'getLeftFlatHeaders',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
)
getCenterFlatHeaders: memo(
() => [table.getCenterHeaderGroups()],
left => {
return left
.map(headerGroup => {
return headerGroup.headers
})
.flat()
},
{
key: process.env.NODE_ENV === 'development' && 'getCenterFlatHeaders',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
),
table.getCenterFlatHeaders = memo(
() => [table.getCenterHeaderGroups()],
left => {
return left
.map(headerGroup => {
return headerGroup.headers
})
.flat()
},
{
key: process.env.NODE_ENV === 'development' && 'getCenterFlatHeaders',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
)
getRightFlatHeaders: memo(
() => [table.getRightHeaderGroups()],
left => {
return left
.map(headerGroup => {
return headerGroup.headers
})
.flat()
},
{
key: process.env.NODE_ENV === 'development' && 'getRightFlatHeaders',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
),
table.getRightFlatHeaders = memo(
() => [table.getRightHeaderGroups()],
left => {
return left
.map(headerGroup => {
return headerGroup.headers
})
.flat()
},
{
key: process.env.NODE_ENV === 'development' && 'getRightFlatHeaders',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
)
// Leaf Headers
// Leaf Headers
getCenterLeafHeaders: memo(
() => [table.getCenterFlatHeaders()],
flatHeaders => {
return flatHeaders.filter(header => !header.subHeaders?.length)
},
{
key: process.env.NODE_ENV === 'development' && 'getCenterLeafHeaders',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
),
table.getCenterLeafHeaders = memo(
() => [table.getCenterFlatHeaders()],
flatHeaders => {
return flatHeaders.filter(header => !header.subHeaders?.length)
},
{
key: process.env.NODE_ENV === 'development' && 'getCenterLeafHeaders',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
)
getLeftLeafHeaders: memo(
() => [table.getLeftFlatHeaders()],
flatHeaders => {
return flatHeaders.filter(header => !header.subHeaders?.length)
},
{
key: process.env.NODE_ENV === 'development' && 'getLeftLeafHeaders',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
),
table.getLeftLeafHeaders = memo(
() => [table.getLeftFlatHeaders()],
flatHeaders => {
return flatHeaders.filter(header => !header.subHeaders?.length)
},
{
key: process.env.NODE_ENV === 'development' && 'getLeftLeafHeaders',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
)
getRightLeafHeaders: memo(
() => [table.getRightFlatHeaders()],
flatHeaders => {
return flatHeaders.filter(header => !header.subHeaders?.length)
},
{
key: process.env.NODE_ENV === 'development' && 'getRightLeafHeaders',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
),
table.getRightLeafHeaders = memo(
() => [table.getRightFlatHeaders()],
flatHeaders => {
return flatHeaders.filter(header => !header.subHeaders?.length)
},
{
key: process.env.NODE_ENV === 'development' && 'getRightLeafHeaders',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
)
getLeafHeaders: memo(
() => [
table.getLeftHeaderGroups(),
table.getCenterHeaderGroups(),
table.getRightHeaderGroups(),
],
(left, center, right) => {
return [
...(left[0]?.headers ?? []),
...(center[0]?.headers ?? []),
...(right[0]?.headers ?? []),
]
.map(header => {
return header.getLeafHeaders()
})
.flat()
},
{
key: process.env.NODE_ENV === 'development' && 'getLeafHeaders',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
),
}
table.getLeafHeaders = memo(
() => [
table.getLeftHeaderGroups(),
table.getCenterHeaderGroups(),
table.getRightHeaderGroups(),
],
(left, center, right) => {
return [
...(left[0]?.headers ?? []),
...(center[0]?.headers ?? []),
...(right[0]?.headers ?? []),
]
.map(header => {
return header.getLeafHeaders()
})
.flat()
},
{
key: process.env.NODE_ENV === 'development' && 'getLeafHeaders',
debug: () => table.options.debugAll ?? table.options.debugHeaders,
}
)
},

@@ -391,0 +375,0 @@ }

@@ -130,3 +130,3 @@ import { RowData, Cell, Row, Table } from '../types'

const feature = table._features[i]
Object.assign(row, feature?.createRow?.(row, table))
feature?.createRow?.(row, table)
}

@@ -133,0 +133,0 @@

@@ -350,7 +350,8 @@ import { functionalUpdate, memo, RequiredKeys } from '../utils'

table._features.forEach(feature => {
return Object.assign(table, feature.createTable?.(table))
})
for (let index = 0; index < table._features.length; index++) {
const feature = table._features[index]
feature?.createTable?.(table)
}
return table
}

@@ -113,49 +113,47 @@ import { TableFeature } from '../core/table'

table: Table<TData>
): ColumnSizingColumn => {
return {
getSize: () => {
const columnSize = table.getState().columnSizing[column.id]
): void => {
column.getSize = () => {
const columnSize = table.getState().columnSizing[column.id]
return Math.min(
Math.max(
column.columnDef.minSize ?? defaultColumnSizing.minSize,
columnSize ?? column.columnDef.size ?? defaultColumnSizing.size
),
column.columnDef.maxSize ?? defaultColumnSizing.maxSize
)
},
getStart: position => {
const columns = !position
? table.getVisibleLeafColumns()
: position === 'left'
? table.getLeftVisibleLeafColumns()
: table.getRightVisibleLeafColumns()
return Math.min(
Math.max(
column.columnDef.minSize ?? defaultColumnSizing.minSize,
columnSize ?? column.columnDef.size ?? defaultColumnSizing.size
),
column.columnDef.maxSize ?? defaultColumnSizing.maxSize
)
}
column.getStart = position => {
const columns = !position
? table.getVisibleLeafColumns()
: position === 'left'
? table.getLeftVisibleLeafColumns()
: table.getRightVisibleLeafColumns()
const index = columns.findIndex(d => d.id === column.id)
const index = columns.findIndex(d => d.id === column.id)
if (index > 0) {
const prevSiblingColumn = columns[index - 1]!
if (index > 0) {
const prevSiblingColumn = columns[index - 1]!
return (
prevSiblingColumn.getStart(position) + prevSiblingColumn.getSize()
)
}
return 0
},
resetSize: () => {
table.setColumnSizing(({ [column.id]: _, ...rest }) => {
return rest
})
},
getCanResize: () => {
return (
(column.columnDef.enableResizing ?? true) &&
(table.options.enableColumnResizing ?? true)
prevSiblingColumn.getStart(position) + prevSiblingColumn.getSize()
)
},
getIsResizing: () => {
return table.getState().columnSizingInfo.isResizingColumn === column.id
},
}
return 0
}
column.resetSize = () => {
table.setColumnSizing(({ [column.id]: _, ...rest }) => {
return rest
})
}
column.getCanResize = () => {
return (
(column.columnDef.enableResizing ?? true) &&
(table.options.enableColumnResizing ?? true)
)
}
column.getIsResizing = () => {
return table.getState().columnSizingInfo.isResizingColumn === column.id
}
},

@@ -166,225 +164,216 @@

table: Table<TData>
): ColumnSizingHeader => {
return {
getSize: () => {
let sum = 0
): void => {
header.getSize = () => {
let sum = 0
const recurse = (header: Header<TData, TValue>) => {
if (header.subHeaders.length) {
header.subHeaders.forEach(recurse)
} else {
sum += header.column.getSize() ?? 0
}
const recurse = (header: Header<TData, TValue>) => {
if (header.subHeaders.length) {
header.subHeaders.forEach(recurse)
} else {
sum += header.column.getSize() ?? 0
}
}
recurse(header)
recurse(header)
return sum
},
getStart: () => {
if (header.index > 0) {
const prevSiblingHeader =
header.headerGroup.headers[header.index - 1]!
return prevSiblingHeader.getStart() + prevSiblingHeader.getSize()
return sum
}
header.getStart = () => {
if (header.index > 0) {
const prevSiblingHeader = header.headerGroup.headers[header.index - 1]!
return prevSiblingHeader.getStart() + prevSiblingHeader.getSize()
}
return 0
}
header.getResizeHandler = () => {
const column = table.getColumn(header.column.id)
const canResize = column?.getCanResize()
return (e: unknown) => {
if (!column || !canResize) {
return
}
return 0
},
getResizeHandler: () => {
const column = table.getColumn(header.column.id)
const canResize = column?.getCanResize()
;(e as any).persist?.()
return (e: unknown) => {
if (!column || !canResize) {
if (isTouchStartEvent(e)) {
// lets not respond to multiple touches (e.g. 2 or 3 fingers)
if (e.touches && e.touches.length > 1) {
return
}
}
;(e as any).persist?.()
const startSize = header.getSize()
if (isTouchStartEvent(e)) {
// lets not respond to multiple touches (e.g. 2 or 3 fingers)
if (e.touches && e.touches.length > 1) {
return
}
}
const columnSizingStart: [string, number][] = header
? header.getLeafHeaders().map(d => [d.column.id, d.column.getSize()])
: [[column.id, column.getSize()]]
const startSize = header.getSize()
const clientX = isTouchStartEvent(e)
? Math.round(e.touches[0]!.clientX)
: (e as MouseEvent).clientX
const columnSizingStart: [string, number][] = header
? header
.getLeafHeaders()
.map(d => [d.column.id, d.column.getSize()])
: [[column.id, column.getSize()]]
const newColumnSizing: ColumnSizingState = {}
const clientX = isTouchStartEvent(e)
? Math.round(e.touches[0]!.clientX)
: (e as MouseEvent).clientX
const updateOffset = (
eventType: 'move' | 'end',
clientXPos?: number
) => {
if (typeof clientXPos !== 'number') {
return
}
const newColumnSizing: ColumnSizingState = {}
table.setColumnSizingInfo(old => {
const deltaOffset = clientXPos - (old?.startOffset ?? 0)
const deltaPercentage = Math.max(
deltaOffset / (old?.startSize ?? 0),
-0.999999
)
const updateOffset = (
eventType: 'move' | 'end',
clientXPos?: number
) => {
if (typeof clientXPos !== 'number') {
return
}
table.setColumnSizingInfo(old => {
const deltaOffset = clientXPos - (old?.startOffset ?? 0)
const deltaPercentage = Math.max(
deltaOffset / (old?.startSize ?? 0),
-0.999999
)
old.columnSizingStart.forEach(([columnId, headerSize]) => {
newColumnSizing[columnId] =
Math.round(
Math.max(headerSize + headerSize * deltaPercentage, 0) * 100
) / 100
})
return {
...old,
deltaOffset,
deltaPercentage,
}
old.columnSizingStart.forEach(([columnId, headerSize]) => {
newColumnSizing[columnId] =
Math.round(
Math.max(headerSize + headerSize * deltaPercentage, 0) * 100
) / 100
})
if (
table.options.columnResizeMode === 'onChange' ||
eventType === 'end'
) {
table.setColumnSizing(old => ({
...old,
...newColumnSizing,
}))
return {
...old,
deltaOffset,
deltaPercentage,
}
}
})
const onMove = (clientXPos?: number) =>
updateOffset('move', clientXPos)
const onEnd = (clientXPos?: number) => {
updateOffset('end', clientXPos)
table.setColumnSizingInfo(old => ({
if (
table.options.columnResizeMode === 'onChange' ||
eventType === 'end'
) {
table.setColumnSizing(old => ({
...old,
isResizingColumn: false,
startOffset: null,
startSize: null,
deltaOffset: null,
deltaPercentage: null,
columnSizingStart: [],
...newColumnSizing,
}))
}
}
const mouseEvents = {
moveHandler: (e: MouseEvent) => onMove(e.clientX),
upHandler: (e: MouseEvent) => {
document.removeEventListener('mousemove', mouseEvents.moveHandler)
document.removeEventListener('mouseup', mouseEvents.upHandler)
onEnd(e.clientX)
},
}
const onMove = (clientXPos?: number) => updateOffset('move', clientXPos)
const touchEvents = {
moveHandler: (e: TouchEvent) => {
if (e.cancelable) {
e.preventDefault()
e.stopPropagation()
}
onMove(e.touches[0]!.clientX)
return false
},
upHandler: (e: TouchEvent) => {
document.removeEventListener('touchmove', touchEvents.moveHandler)
document.removeEventListener('touchend', touchEvents.upHandler)
if (e.cancelable) {
e.preventDefault()
e.stopPropagation()
}
onEnd(e.touches[0]?.clientX)
},
}
const onEnd = (clientXPos?: number) => {
updateOffset('end', clientXPos)
const passiveIfSupported = passiveEventSupported()
? { passive: false }
: false
if (isTouchStartEvent(e)) {
document.addEventListener(
'touchmove',
touchEvents.moveHandler,
passiveIfSupported
)
document.addEventListener(
'touchend',
touchEvents.upHandler,
passiveIfSupported
)
} else {
document.addEventListener(
'mousemove',
mouseEvents.moveHandler,
passiveIfSupported
)
document.addEventListener(
'mouseup',
mouseEvents.upHandler,
passiveIfSupported
)
}
table.setColumnSizingInfo(old => ({
...old,
startOffset: clientX,
startSize,
deltaOffset: 0,
deltaPercentage: 0,
columnSizingStart,
isResizingColumn: column.id,
isResizingColumn: false,
startOffset: null,
startSize: null,
deltaOffset: null,
deltaPercentage: null,
columnSizingStart: [],
}))
}
},
const mouseEvents = {
moveHandler: (e: MouseEvent) => onMove(e.clientX),
upHandler: (e: MouseEvent) => {
document.removeEventListener('mousemove', mouseEvents.moveHandler)
document.removeEventListener('mouseup', mouseEvents.upHandler)
onEnd(e.clientX)
},
}
const touchEvents = {
moveHandler: (e: TouchEvent) => {
if (e.cancelable) {
e.preventDefault()
e.stopPropagation()
}
onMove(e.touches[0]!.clientX)
return false
},
upHandler: (e: TouchEvent) => {
document.removeEventListener('touchmove', touchEvents.moveHandler)
document.removeEventListener('touchend', touchEvents.upHandler)
if (e.cancelable) {
e.preventDefault()
e.stopPropagation()
}
onEnd(e.touches[0]?.clientX)
},
}
const passiveIfSupported = passiveEventSupported()
? { passive: false }
: false
if (isTouchStartEvent(e)) {
document.addEventListener(
'touchmove',
touchEvents.moveHandler,
passiveIfSupported
)
document.addEventListener(
'touchend',
touchEvents.upHandler,
passiveIfSupported
)
} else {
document.addEventListener(
'mousemove',
mouseEvents.moveHandler,
passiveIfSupported
)
document.addEventListener(
'mouseup',
mouseEvents.upHandler,
passiveIfSupported
)
}
table.setColumnSizingInfo(old => ({
...old,
startOffset: clientX,
startSize,
deltaOffset: 0,
deltaPercentage: 0,
columnSizingStart,
isResizingColumn: column.id,
}))
}
}
},
createTable: <TData extends RowData>(
table: Table<TData>
): ColumnSizingInstance => {
return {
setColumnSizing: updater => table.options.onColumnSizingChange?.(updater),
setColumnSizingInfo: updater =>
table.options.onColumnSizingInfoChange?.(updater),
resetColumnSizing: defaultState => {
table.setColumnSizing(
defaultState ? {} : table.initialState.columnSizing ?? {}
)
},
resetHeaderSizeInfo: defaultState => {
table.setColumnSizingInfo(
defaultState
? getDefaultColumnSizingInfoState()
: table.initialState.columnSizingInfo ??
getDefaultColumnSizingInfoState()
)
},
getTotalSize: () =>
table.getHeaderGroups()[0]?.headers.reduce((sum, header) => {
return sum + header.getSize()
}, 0) ?? 0,
getLeftTotalSize: () =>
table.getLeftHeaderGroups()[0]?.headers.reduce((sum, header) => {
return sum + header.getSize()
}, 0) ?? 0,
getCenterTotalSize: () =>
table.getCenterHeaderGroups()[0]?.headers.reduce((sum, header) => {
return sum + header.getSize()
}, 0) ?? 0,
getRightTotalSize: () =>
table.getRightHeaderGroups()[0]?.headers.reduce((sum, header) => {
return sum + header.getSize()
}, 0) ?? 0,
createTable: <TData extends RowData>(table: Table<TData>): void => {
table.setColumnSizing = updater =>
table.options.onColumnSizingChange?.(updater)
table.setColumnSizingInfo = updater =>
table.options.onColumnSizingInfoChange?.(updater)
table.resetColumnSizing = defaultState => {
table.setColumnSizing(
defaultState ? {} : table.initialState.columnSizing ?? {}
)
}
table.resetHeaderSizeInfo = defaultState => {
table.setColumnSizingInfo(
defaultState
? getDefaultColumnSizingInfoState()
: table.initialState.columnSizingInfo ??
getDefaultColumnSizingInfoState()
)
}
table.getTotalSize = () =>
table.getHeaderGroups()[0]?.headers.reduce((sum, header) => {
return sum + header.getSize()
}, 0) ?? 0
table.getLeftTotalSize = () =>
table.getLeftHeaderGroups()[0]?.headers.reduce((sum, header) => {
return sum + header.getSize()
}, 0) ?? 0
table.getCenterTotalSize = () =>
table.getCenterHeaderGroups()[0]?.headers.reduce((sum, header) => {
return sum + header.getSize()
}, 0) ?? 0
table.getRightTotalSize = () =>
table.getRightHeaderGroups()[0]?.headers.reduce((sum, header) => {
return sum + header.getSize()
}, 0) ?? 0
},

@@ -391,0 +380,0 @@ }

@@ -64,105 +64,99 @@ import { RowModel } from '..'

createTable: <TData extends RowData>(
table: Table<TData>
): ExpandedInstance<TData> => {
createTable: <TData extends RowData>(table: Table<TData>): void => {
let registered = false
let queued = false
return {
_autoResetExpanded: () => {
if (!registered) {
table._queue(() => {
registered = true
})
return
}
table._autoResetExpanded = () => {
if (!registered) {
table._queue(() => {
registered = true
})
return
}
if (
table.options.autoResetAll ??
table.options.autoResetExpanded ??
!table.options.manualExpanding
) {
if (queued) return
queued = true
table._queue(() => {
table.resetExpanded()
queued = false
})
}
},
setExpanded: updater => table.options.onExpandedChange?.(updater),
toggleAllRowsExpanded: expanded => {
if (expanded ?? !table.getIsAllRowsExpanded()) {
table.setExpanded(true)
} else {
table.setExpanded({})
}
},
resetExpanded: defaultState => {
table.setExpanded(
defaultState ? {} : table.initialState?.expanded ?? {}
)
},
getCanSomeRowsExpand: () => {
return table
.getPrePaginationRowModel()
.flatRows.some(row => row.getCanExpand())
},
getToggleAllRowsExpandedHandler: () => {
return (e: unknown) => {
;(e as any).persist?.()
table.toggleAllRowsExpanded()
}
},
getIsSomeRowsExpanded: () => {
const expanded = table.getState().expanded
return expanded === true || Object.values(expanded).some(Boolean)
},
getIsAllRowsExpanded: () => {
const expanded = table.getState().expanded
if (
table.options.autoResetAll ??
table.options.autoResetExpanded ??
!table.options.manualExpanding
) {
if (queued) return
queued = true
table._queue(() => {
table.resetExpanded()
queued = false
})
}
}
table.setExpanded = updater => table.options.onExpandedChange?.(updater)
table.toggleAllRowsExpanded = expanded => {
if (expanded ?? !table.getIsAllRowsExpanded()) {
table.setExpanded(true)
} else {
table.setExpanded({})
}
}
table.resetExpanded = defaultState => {
table.setExpanded(defaultState ? {} : table.initialState?.expanded ?? {})
}
table.getCanSomeRowsExpand = () => {
return table
.getPrePaginationRowModel()
.flatRows.some(row => row.getCanExpand())
}
table.getToggleAllRowsExpandedHandler = () => {
return (e: unknown) => {
;(e as any).persist?.()
table.toggleAllRowsExpanded()
}
}
table.getIsSomeRowsExpanded = () => {
const expanded = table.getState().expanded
return expanded === true || Object.values(expanded).some(Boolean)
}
table.getIsAllRowsExpanded = () => {
const expanded = table.getState().expanded
// If expanded is true, save some cycles and return true
if (typeof expanded === 'boolean') {
return expanded === true
}
// If expanded is true, save some cycles and return true
if (typeof expanded === 'boolean') {
return expanded === true
}
if (!Object.keys(expanded).length) {
return false
}
if (!Object.keys(expanded).length) {
return false
}
// If any row is not expanded, return false
if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) {
return false
}
// If any row is not expanded, return false
if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) {
return false
}
// They must all be expanded :shrug:
return true
},
getExpandedDepth: () => {
let maxDepth = 0
// They must all be expanded :shrug:
return true
}
table.getExpandedDepth = () => {
let maxDepth = 0
const rowIds =
table.getState().expanded === true
? Object.keys(table.getRowModel().rowsById)
: Object.keys(table.getState().expanded)
const rowIds =
table.getState().expanded === true
? Object.keys(table.getRowModel().rowsById)
: Object.keys(table.getState().expanded)
rowIds.forEach(id => {
const splitId = id.split('.')
maxDepth = Math.max(maxDepth, splitId.length)
})
rowIds.forEach(id => {
const splitId = id.split('.')
maxDepth = Math.max(maxDepth, splitId.length)
})
return maxDepth
},
getPreExpandedRowModel: () => table.getSortedRowModel(),
getExpandedRowModel: () => {
if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {
table._getExpandedRowModel = table.options.getExpandedRowModel(table)
}
return maxDepth
}
table.getPreExpandedRowModel = () => table.getSortedRowModel()
table.getExpandedRowModel = () => {
if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {
table._getExpandedRowModel = table.options.getExpandedRowModel(table)
}
if (table.options.manualExpanding || !table._getExpandedRowModel) {
return table.getPreExpandedRowModel()
}
if (table.options.manualExpanding || !table._getExpandedRowModel) {
return table.getPreExpandedRowModel()
}
return table._getExpandedRowModel()
},
return table._getExpandedRowModel()
}

@@ -174,59 +168,57 @@ },

table: Table<TData>
): ExpandedRow => {
return {
toggleExpanded: expanded => {
table.setExpanded(old => {
const exists = old === true ? true : !!old?.[row.id]
): void => {
row.toggleExpanded = expanded => {
table.setExpanded(old => {
const exists = old === true ? true : !!old?.[row.id]
let oldExpanded: ExpandedStateList = {}
let oldExpanded: ExpandedStateList = {}
if (old === true) {
Object.keys(table.getRowModel().rowsById).forEach(rowId => {
oldExpanded[rowId] = true
})
} else {
oldExpanded = old
}
if (old === true) {
Object.keys(table.getRowModel().rowsById).forEach(rowId => {
oldExpanded[rowId] = true
})
} else {
oldExpanded = old
}
expanded = expanded ?? !exists
expanded = expanded ?? !exists
if (!exists && expanded) {
return {
...oldExpanded,
[row.id]: true,
}
if (!exists && expanded) {
return {
...oldExpanded,
[row.id]: true,
}
}
if (exists && !expanded) {
const { [row.id]: _, ...rest } = oldExpanded
return rest
}
if (exists && !expanded) {
const { [row.id]: _, ...rest } = oldExpanded
return rest
}
return old
})
},
getIsExpanded: () => {
const expanded = table.getState().expanded
return old
})
}
row.getIsExpanded = () => {
const expanded = table.getState().expanded
return !!(
table.options.getIsRowExpanded?.(row) ??
(expanded === true || expanded?.[row.id])
)
},
getCanExpand: () => {
return (
table.options.getRowCanExpand?.(row) ??
((table.options.enableExpanding ?? true) && !!row.subRows?.length)
)
},
getToggleExpandedHandler: () => {
const canExpand = row.getCanExpand()
return !!(
table.options.getIsRowExpanded?.(row) ??
(expanded === true || expanded?.[row.id])
)
}
row.getCanExpand = () => {
return (
table.options.getRowCanExpand?.(row) ??
((table.options.enableExpanding ?? true) && !!row.subRows?.length)
)
}
row.getToggleExpandedHandler = () => {
const canExpand = row.getCanExpand()
return () => {
if (!canExpand) return
row.toggleExpanded()
}
},
return () => {
if (!canExpand) return
row.toggleExpanded()
}
}
},
}

@@ -204,142 +204,135 @@ import { RowModel } from '..'

table: Table<TData>
): FiltersColumn<TData> => {
return {
getAutoFilterFn: () => {
const firstRow = table.getCoreRowModel().flatRows[0]
): void => {
column.getAutoFilterFn = () => {
const firstRow = table.getCoreRowModel().flatRows[0]
const value = firstRow?.getValue(column.id)
const value = firstRow?.getValue(column.id)
if (typeof value === 'string') {
return filterFns.includesString
}
if (typeof value === 'string') {
return filterFns.includesString
}
if (typeof value === 'number') {
return filterFns.inNumberRange
}
if (typeof value === 'number') {
return filterFns.inNumberRange
}
if (typeof value === 'boolean') {
return filterFns.equals
}
if (typeof value === 'boolean') {
return filterFns.equals
}
if (value !== null && typeof value === 'object') {
return filterFns.equals
}
if (value !== null && typeof value === 'object') {
return filterFns.equals
}
if (Array.isArray(value)) {
return filterFns.arrIncludes
}
if (Array.isArray(value)) {
return filterFns.arrIncludes
}
return filterFns.weakEquals
},
getFilterFn: () => {
return isFunction(column.columnDef.filterFn)
? column.columnDef.filterFn
: column.columnDef.filterFn === 'auto'
? column.getAutoFilterFn()
// @ts-ignore
: table.options.filterFns?.[column.columnDef.filterFn as string] ??
filterFns[column.columnDef.filterFn as BuiltInFilterFn]
},
getCanFilter: () => {
return (
(column.columnDef.enableColumnFilter ?? true) &&
(table.options.enableColumnFilters ?? true) &&
(table.options.enableFilters ?? true) &&
!!column.accessorFn
)
},
return filterFns.weakEquals
}
column.getFilterFn = () => {
return isFunction(column.columnDef.filterFn)
? column.columnDef.filterFn
: column.columnDef.filterFn === 'auto'
? column.getAutoFilterFn()
: // @ts-ignore
table.options.filterFns?.[column.columnDef.filterFn as string] ??
filterFns[column.columnDef.filterFn as BuiltInFilterFn]
}
column.getCanFilter = () => {
return (
(column.columnDef.enableColumnFilter ?? true) &&
(table.options.enableColumnFilters ?? true) &&
(table.options.enableFilters ?? true) &&
!!column.accessorFn
)
}
getCanGlobalFilter: () => {
return (
(column.columnDef.enableGlobalFilter ?? true) &&
(table.options.enableGlobalFilter ?? true) &&
(table.options.enableFilters ?? true) &&
(table.options.getColumnCanGlobalFilter?.(column) ?? true) &&
!!column.accessorFn
)
},
column.getCanGlobalFilter = () => {
return (
(column.columnDef.enableGlobalFilter ?? true) &&
(table.options.enableGlobalFilter ?? true) &&
(table.options.enableFilters ?? true) &&
(table.options.getColumnCanGlobalFilter?.(column) ?? true) &&
!!column.accessorFn
)
}
getIsFiltered: () => column.getFilterIndex() > -1,
column.getIsFiltered = () => column.getFilterIndex() > -1
getFilterValue: () =>
table.getState().columnFilters?.find(d => d.id === column.id)?.value,
column.getFilterValue = () =>
table.getState().columnFilters?.find(d => d.id === column.id)?.value
getFilterIndex: () =>
table.getState().columnFilters?.findIndex(d => d.id === column.id) ??
-1,
column.getFilterIndex = () =>
table.getState().columnFilters?.findIndex(d => d.id === column.id) ?? -1
setFilterValue: value => {
table.setColumnFilters(old => {
const filterFn = column.getFilterFn()
const previousfilter = old?.find(d => d.id === column.id)
column.setFilterValue = value => {
table.setColumnFilters(old => {
const filterFn = column.getFilterFn()
const previousfilter = old?.find(d => d.id === column.id)
const newFilter = functionalUpdate(
value,
previousfilter ? previousfilter.value : undefined
)
const newFilter = functionalUpdate(
value,
previousfilter ? previousfilter.value : undefined
)
//
if (
shouldAutoRemoveFilter(
filterFn as FilterFn<TData>,
newFilter,
column
)
) {
return old?.filter(d => d.id !== column.id) ?? []
}
//
if (
shouldAutoRemoveFilter(filterFn as FilterFn<TData>, newFilter, column)
) {
return old?.filter(d => d.id !== column.id) ?? []
}
const newFilterObj = { id: column.id, value: newFilter }
const newFilterObj = { id: column.id, value: newFilter }
if (previousfilter) {
return (
old?.map(d => {
if (d.id === column.id) {
return newFilterObj
}
return d
}) ?? []
)
}
if (old?.length) {
return [...old, newFilterObj]
}
return [newFilterObj]
})
},
_getFacetedRowModel:
table.options.getFacetedRowModel &&
table.options.getFacetedRowModel(table, column.id),
getFacetedRowModel: () => {
if (!column._getFacetedRowModel) {
return table.getPreFilteredRowModel()
if (previousfilter) {
return (
old?.map(d => {
if (d.id === column.id) {
return newFilterObj
}
return d
}) ?? []
)
}
return column._getFacetedRowModel()
},
_getFacetedUniqueValues:
table.options.getFacetedUniqueValues &&
table.options.getFacetedUniqueValues(table, column.id),
getFacetedUniqueValues: () => {
if (!column._getFacetedUniqueValues) {
return new Map()
if (old?.length) {
return [...old, newFilterObj]
}
return column._getFacetedUniqueValues()
},
_getFacetedMinMaxValues:
table.options.getFacetedMinMaxValues &&
table.options.getFacetedMinMaxValues(table, column.id),
getFacetedMinMaxValues: () => {
if (!column._getFacetedMinMaxValues) {
return undefined
}
return [newFilterObj]
})
}
column._getFacetedRowModel =
table.options.getFacetedRowModel &&
table.options.getFacetedRowModel(table, column.id)
column.getFacetedRowModel = () => {
if (!column._getFacetedRowModel) {
return table.getPreFilteredRowModel()
}
return column._getFacetedMinMaxValues()
},
// () => [column.getFacetedRowModel()],
// facetedRowModel => getRowModelMinMaxValues(facetedRowModel, column.id),
return column._getFacetedRowModel()
}
column._getFacetedUniqueValues =
table.options.getFacetedUniqueValues &&
table.options.getFacetedUniqueValues(table, column.id)
column.getFacetedUniqueValues = () => {
if (!column._getFacetedUniqueValues) {
return new Map()
}
return column._getFacetedUniqueValues()
}
column._getFacetedMinMaxValues =
table.options.getFacetedMinMaxValues &&
table.options.getFacetedMinMaxValues(table, column.id)
column.getFacetedMinMaxValues = () => {
if (!column._getFacetedMinMaxValues) {
return undefined
}
return column._getFacetedMinMaxValues()
}
// () => [column.getFacetedRowModel()],
// facetedRowModel => getRowModelMinMaxValues(facetedRowModel, column.id),
},

@@ -350,113 +343,107 @@

table: Table<TData>
): FiltersRow<TData> => {
return {
columnFilters: {},
columnFiltersMeta: {},
}
): void => {
row.columnFilters = {}
row.columnFiltersMeta = {}
},
createTable: <TData extends RowData>(
table: Table<TData>
): FiltersInstance<TData> => {
return {
getGlobalAutoFilterFn: () => {
return filterFns.includesString
},
createTable: <TData extends RowData>(table: Table<TData>): void => {
table.getGlobalAutoFilterFn = () => {
return filterFns.includesString
}
getGlobalFilterFn: () => {
const { globalFilterFn: globalFilterFn } = table.options
table.getGlobalFilterFn = () => {
const { globalFilterFn: globalFilterFn } = table.options
return isFunction(globalFilterFn)
? globalFilterFn
: globalFilterFn === 'auto'
? table.getGlobalAutoFilterFn()
// @ts-ignore
: table.options.filterFns?.[globalFilterFn as string] ??
filterFns[globalFilterFn as BuiltInFilterFn]
},
return isFunction(globalFilterFn)
? globalFilterFn
: globalFilterFn === 'auto'
? table.getGlobalAutoFilterFn()
: // @ts-ignore
table.options.filterFns?.[globalFilterFn as string] ??
filterFns[globalFilterFn as BuiltInFilterFn]
}
setColumnFilters: (updater: Updater<ColumnFiltersState>) => {
const leafColumns = table.getAllLeafColumns()
table.setColumnFilters = (updater: Updater<ColumnFiltersState>) => {
const leafColumns = table.getAllLeafColumns()
const updateFn = (old: ColumnFiltersState) => {
return functionalUpdate(updater, old)?.filter(filter => {
const column = leafColumns.find(d => d.id === filter.id)
const updateFn = (old: ColumnFiltersState) => {
return functionalUpdate(updater, old)?.filter(filter => {
const column = leafColumns.find(d => d.id === filter.id)
if (column) {
const filterFn = column.getFilterFn()
if (column) {
const filterFn = column.getFilterFn()
if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {
return false
}
if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {
return false
}
}
return true
})
}
return true
})
}
table.options.onColumnFiltersChange?.(updateFn)
},
table.options.onColumnFiltersChange?.(updateFn)
}
setGlobalFilter: updater => {
table.options.onGlobalFilterChange?.(updater)
},
table.setGlobalFilter = updater => {
table.options.onGlobalFilterChange?.(updater)
}
resetGlobalFilter: defaultState => {
table.setGlobalFilter(
defaultState ? undefined : table.initialState.globalFilter
)
},
table.resetGlobalFilter = defaultState => {
table.setGlobalFilter(
defaultState ? undefined : table.initialState.globalFilter
)
}
resetColumnFilters: defaultState => {
table.setColumnFilters(
defaultState ? [] : table.initialState?.columnFilters ?? []
)
},
table.resetColumnFilters = defaultState => {
table.setColumnFilters(
defaultState ? [] : table.initialState?.columnFilters ?? []
)
}
getPreFilteredRowModel: () => table.getCoreRowModel(),
getFilteredRowModel: () => {
if (!table._getFilteredRowModel && table.options.getFilteredRowModel) {
table._getFilteredRowModel = table.options.getFilteredRowModel(table)
}
table.getPreFilteredRowModel = () => table.getCoreRowModel()
table.getFilteredRowModel = () => {
if (!table._getFilteredRowModel && table.options.getFilteredRowModel) {
table._getFilteredRowModel = table.options.getFilteredRowModel(table)
}
if (table.options.manualFiltering || !table._getFilteredRowModel) {
return table.getPreFilteredRowModel()
}
if (table.options.manualFiltering || !table._getFilteredRowModel) {
return table.getPreFilteredRowModel()
}
return table._getFilteredRowModel()
},
return table._getFilteredRowModel()
}
_getGlobalFacetedRowModel:
table.options.getFacetedRowModel &&
table.options.getFacetedRowModel(table, '__global__'),
table._getGlobalFacetedRowModel =
table.options.getFacetedRowModel &&
table.options.getFacetedRowModel(table, '__global__')
getGlobalFacetedRowModel: () => {
if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {
return table.getPreFilteredRowModel()
}
table.getGlobalFacetedRowModel = () => {
if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {
return table.getPreFilteredRowModel()
}
return table._getGlobalFacetedRowModel()
},
return table._getGlobalFacetedRowModel()
}
_getGlobalFacetedUniqueValues:
table.options.getFacetedUniqueValues &&
table.options.getFacetedUniqueValues(table, '__global__'),
getGlobalFacetedUniqueValues: () => {
if (!table._getGlobalFacetedUniqueValues) {
return new Map()
}
table._getGlobalFacetedUniqueValues =
table.options.getFacetedUniqueValues &&
table.options.getFacetedUniqueValues(table, '__global__')
table.getGlobalFacetedUniqueValues = () => {
if (!table._getGlobalFacetedUniqueValues) {
return new Map()
}
return table._getGlobalFacetedUniqueValues()
},
return table._getGlobalFacetedUniqueValues()
}
_getGlobalFacetedMinMaxValues:
table.options.getFacetedMinMaxValues &&
table.options.getFacetedMinMaxValues(table, '__global__'),
getGlobalFacetedMinMaxValues: () => {
if (!table._getGlobalFacetedMinMaxValues) {
return
}
table._getGlobalFacetedMinMaxValues =
table.options.getFacetedMinMaxValues &&
table.options.getFacetedMinMaxValues(table, '__global__')
table.getGlobalFacetedMinMaxValues = () => {
if (!table._getGlobalFacetedMinMaxValues) {
return
}
return table._getGlobalFacetedMinMaxValues()
},
return table._getGlobalFacetedMinMaxValues()
}

@@ -463,0 +450,0 @@ },

@@ -138,95 +138,85 @@ import { RowModel } from '..'

table: Table<TData>
): GroupingColumn<TData> => {
return {
toggleGrouping: () => {
table.setGrouping(old => {
// Find any existing grouping for this column
if (old?.includes(column.id)) {
return old.filter(d => d !== column.id)
}
): void => {
column.toggleGrouping = () => {
table.setGrouping(old => {
// Find any existing grouping for this column
if (old?.includes(column.id)) {
return old.filter(d => d !== column.id)
}
return [...(old ?? []), column.id]
})
},
return [...(old ?? []), column.id]
})
}
getCanGroup: () => {
return (
column.columnDef.enableGrouping ??
true ??
table.options.enableGrouping ??
true ??
!!column.accessorFn
)
},
column.getCanGroup = () => {
return (
column.columnDef.enableGrouping ??
true ??
table.options.enableGrouping ??
true ??
!!column.accessorFn
)
}
getIsGrouped: () => {
return table.getState().grouping?.includes(column.id)
},
column.getIsGrouped = () => {
return table.getState().grouping?.includes(column.id)
}
getGroupedIndex: () => table.getState().grouping?.indexOf(column.id),
column.getGroupedIndex = () => table.getState().grouping?.indexOf(column.id)
getToggleGroupingHandler: () => {
const canGroup = column.getCanGroup()
column.getToggleGroupingHandler = () => {
const canGroup = column.getCanGroup()
return () => {
if (!canGroup) return
column.toggleGrouping()
}
},
getAutoAggregationFn: () => {
const firstRow = table.getCoreRowModel().flatRows[0]
return () => {
if (!canGroup) return
column.toggleGrouping()
}
}
column.getAutoAggregationFn = () => {
const firstRow = table.getCoreRowModel().flatRows[0]
const value = firstRow?.getValue(column.id)
const value = firstRow?.getValue(column.id)
if (typeof value === 'number') {
return aggregationFns.sum
}
if (typeof value === 'number') {
return aggregationFns.sum
}
if (Object.prototype.toString.call(value) === '[object Date]') {
return aggregationFns.extent
}
},
getAggregationFn: () => {
if (!column) {
throw new Error()
}
if (Object.prototype.toString.call(value) === '[object Date]') {
return aggregationFns.extent
}
}
column.getAggregationFn = () => {
if (!column) {
throw new Error()
}
return isFunction(column.columnDef.aggregationFn)
? column.columnDef.aggregationFn
: column.columnDef.aggregationFn === 'auto'
? column.getAutoAggregationFn()
: table.options.aggregationFns?.[
column.columnDef.aggregationFn as string
] ??
aggregationFns[
column.columnDef.aggregationFn as BuiltInAggregationFn
]
},
return isFunction(column.columnDef.aggregationFn)
? column.columnDef.aggregationFn
: column.columnDef.aggregationFn === 'auto'
? column.getAutoAggregationFn()
: table.options.aggregationFns?.[
column.columnDef.aggregationFn as string
] ??
aggregationFns[column.columnDef.aggregationFn as BuiltInAggregationFn]
}
},
createTable: <TData extends RowData>(
table: Table<TData>
): GroupingInstance<TData> => {
return {
setGrouping: updater => table.options.onGroupingChange?.(updater),
createTable: <TData extends RowData>(table: Table<TData>): void => {
table.setGrouping = updater => table.options.onGroupingChange?.(updater)
resetGrouping: defaultState => {
table.setGrouping(
defaultState ? [] : table.initialState?.grouping ?? []
)
},
table.resetGrouping = defaultState => {
table.setGrouping(defaultState ? [] : table.initialState?.grouping ?? [])
}
getPreGroupedRowModel: () => table.getFilteredRowModel(),
getGroupedRowModel: () => {
if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {
table._getGroupedRowModel = table.options.getGroupedRowModel(table)
}
table.getPreGroupedRowModel = () => table.getFilteredRowModel()
table.getGroupedRowModel = () => {
if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {
table._getGroupedRowModel = table.options.getGroupedRowModel(table)
}
if (table.options.manualGrouping || !table._getGroupedRowModel) {
return table.getPreGroupedRowModel()
}
if (table.options.manualGrouping || !table._getGroupedRowModel) {
return table.getPreGroupedRowModel()
}
return table._getGroupedRowModel()
},
return table._getGroupedRowModel()
}

@@ -238,24 +228,22 @@ },

table: Table<TData>
): GroupingRow => {
return {
getIsGrouped: () => !!row.groupingColumnId,
getGroupingValue: columnId => {
if (row._groupingValuesCache.hasOwnProperty(columnId)) {
return row._groupingValuesCache[columnId]
}
): void => {
row.getIsGrouped = () => !!row.groupingColumnId
row.getGroupingValue = columnId => {
if (row._groupingValuesCache.hasOwnProperty(columnId)) {
return row._groupingValuesCache[columnId]
}
const column = table.getColumn(columnId)
const column = table.getColumn(columnId)
if (!column?.columnDef.getGroupingValue) {
return row.getValue(columnId)
}
if (!column?.columnDef.getGroupingValue) {
return row.getValue(columnId)
}
row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(
row.original
)
row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(
row.original
)
return row._groupingValuesCache[columnId]
},
_groupingValuesCache: {},
return row._groupingValuesCache[columnId]
}
row._groupingValuesCache = {}
},

@@ -268,15 +256,11 @@

table: Table<TData>
): GroupingCell => {
): void => {
const getRenderValue = () =>
cell.getValue() ?? table.options.renderFallbackValue
return {
getIsGrouped: () =>
column.getIsGrouped() && column.id === row.groupingColumnId,
getIsPlaceholder: () => !cell.getIsGrouped() && column.getIsGrouped(),
getIsAggregated: () =>
!cell.getIsGrouped() &&
!cell.getIsPlaceholder() &&
!!row.subRows?.length,
}
cell.getIsGrouped = () =>
column.getIsGrouped() && column.id === row.groupingColumnId
cell.getIsPlaceholder = () => !cell.getIsGrouped() && column.getIsGrouped()
cell.getIsAggregated = () =>
!cell.getIsGrouped() && !cell.getIsPlaceholder() && !!row.subRows?.length
},

@@ -283,0 +267,0 @@ }

@@ -48,58 +48,55 @@ import { makeStateUpdater, memo } from '../utils'

createTable: <TData extends RowData>(
table: Table<TData>
): ColumnOrderInstance<TData> => {
return {
setColumnOrder: updater => table.options.onColumnOrderChange?.(updater),
resetColumnOrder: defaultState => {
table.setColumnOrder(
defaultState ? [] : table.initialState.columnOrder ?? []
)
},
_getOrderColumnsFn: memo(
() => [
table.getState().columnOrder,
table.getState().grouping,
table.options.groupedColumnMode,
],
(columnOrder, grouping, groupedColumnMode) => columns => {
// Sort grouped columns to the start of the column list
// before the headers are built
let orderedColumns: Column<TData, unknown>[] = []
createTable: <TData extends RowData>(table: Table<TData>): void => {
table.setColumnOrder = updater =>
table.options.onColumnOrderChange?.(updater)
table.resetColumnOrder = defaultState => {
table.setColumnOrder(
defaultState ? [] : table.initialState.columnOrder ?? []
)
}
table._getOrderColumnsFn = memo(
() => [
table.getState().columnOrder,
table.getState().grouping,
table.options.groupedColumnMode,
],
(columnOrder, grouping, groupedColumnMode) => columns => {
// Sort grouped columns to the start of the column list
// before the headers are built
let orderedColumns: Column<TData, unknown>[] = []
// If there is no order, return the normal columns
if (!columnOrder?.length) {
orderedColumns = columns
} else {
const columnOrderCopy = [...columnOrder]
// If there is no order, return the normal columns
if (!columnOrder?.length) {
orderedColumns = columns
} else {
const columnOrderCopy = [...columnOrder]
// If there is an order, make a copy of the columns
const columnsCopy = [...columns]
// If there is an order, make a copy of the columns
const columnsCopy = [...columns]
// And make a new ordered array of the columns
// And make a new ordered array of the columns
// Loop over the columns and place them in order into the new array
while (columnsCopy.length && columnOrderCopy.length) {
const targetColumnId = columnOrderCopy.shift()
const foundIndex = columnsCopy.findIndex(
d => d.id === targetColumnId
)
if (foundIndex > -1) {
orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]!)
}
// Loop over the columns and place them in order into the new array
while (columnsCopy.length && columnOrderCopy.length) {
const targetColumnId = columnOrderCopy.shift()
const foundIndex = columnsCopy.findIndex(
d => d.id === targetColumnId
)
if (foundIndex > -1) {
orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]!)
}
// If there are any columns left, add them to the end
orderedColumns = [...orderedColumns, ...columnsCopy]
}
return orderColumns(orderedColumns, grouping, groupedColumnMode)
},
{
key: process.env.NODE_ENV === 'development' && 'getOrderColumnsFn',
// debug: () => table.options.debugAll ?? table.options.debugTable,
// If there are any columns left, add them to the end
orderedColumns = [...orderedColumns, ...columnsCopy]
}
),
}
return orderColumns(orderedColumns, grouping, groupedColumnMode)
},
{
key: process.env.NODE_ENV === 'development' && 'getOrderColumnsFn',
// debug: () => table.options.debugAll ?? table.options.debugTable,
}
)
},
}

@@ -79,179 +79,175 @@ import { TableFeature } from '../core/table'

createTable: <TData extends RowData>(
table: Table<TData>
): PaginationInstance<TData> => {
createTable: <TData extends RowData>(table: Table<TData>): void => {
let registered = false
let queued = false
return {
_autoResetPageIndex: () => {
if (!registered) {
table._queue(() => {
registered = true
})
return
}
table._autoResetPageIndex = () => {
if (!registered) {
table._queue(() => {
registered = true
})
return
}
if (
table.options.autoResetAll ??
table.options.autoResetPageIndex ??
!table.options.manualPagination
) {
if (queued) return
queued = true
table._queue(() => {
table.resetPageIndex()
queued = false
})
}
},
setPagination: updater => {
const safeUpdater: Updater<PaginationState> = old => {
let newState = functionalUpdate(updater, old)
if (
table.options.autoResetAll ??
table.options.autoResetPageIndex ??
!table.options.manualPagination
) {
if (queued) return
queued = true
table._queue(() => {
table.resetPageIndex()
queued = false
})
}
}
table.setPagination = updater => {
const safeUpdater: Updater<PaginationState> = old => {
let newState = functionalUpdate(updater, old)
return newState
}
return newState
}
return table.options.onPaginationChange?.(safeUpdater)
},
resetPagination: defaultState => {
table.setPagination(
defaultState
? getDefaultPaginationState()
: table.initialState.pagination ?? getDefaultPaginationState()
)
},
setPageIndex: updater => {
table.setPagination(old => {
let pageIndex = functionalUpdate(updater, old.pageIndex)
return table.options.onPaginationChange?.(safeUpdater)
}
table.resetPagination = defaultState => {
table.setPagination(
defaultState
? getDefaultPaginationState()
: table.initialState.pagination ?? getDefaultPaginationState()
)
}
table.setPageIndex = updater => {
table.setPagination(old => {
let pageIndex = functionalUpdate(updater, old.pageIndex)
const maxPageIndex =
typeof table.options.pageCount === 'undefined' ||
table.options.pageCount === -1
? Number.MAX_SAFE_INTEGER
: table.options.pageCount - 1
const maxPageIndex =
typeof table.options.pageCount === 'undefined' ||
table.options.pageCount === -1
? Number.MAX_SAFE_INTEGER
: table.options.pageCount - 1
pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex))
pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex))
return {
...old,
pageIndex,
}
})
},
resetPageIndex: defaultState => {
table.setPageIndex(
defaultState
? defaultPageIndex
: table.initialState?.pagination?.pageIndex ?? defaultPageIndex
return {
...old,
pageIndex,
}
})
}
table.resetPageIndex = defaultState => {
table.setPageIndex(
defaultState
? defaultPageIndex
: table.initialState?.pagination?.pageIndex ?? defaultPageIndex
)
}
table.resetPageSize = defaultState => {
table.setPageSize(
defaultState
? defaultPageSize
: table.initialState?.pagination?.pageSize ?? defaultPageSize
)
}
table.setPageSize = updater => {
table.setPagination(old => {
const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize))
const topRowIndex = old.pageSize * old.pageIndex!
const pageIndex = Math.floor(topRowIndex / pageSize)
return {
...old,
pageIndex,
pageSize,
}
})
}
table.setPageCount = updater =>
table.setPagination(old => {
let newPageCount = functionalUpdate(
updater,
table.options.pageCount ?? -1
)
},
resetPageSize: defaultState => {
table.setPageSize(
defaultState
? defaultPageSize
: table.initialState?.pagination?.pageSize ?? defaultPageSize
)
},
setPageSize: updater => {
table.setPagination(old => {
const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize))
const topRowIndex = old.pageSize * old.pageIndex!
const pageIndex = Math.floor(topRowIndex / pageSize)
return {
...old,
pageIndex,
pageSize,
}
})
},
setPageCount: updater =>
table.setPagination(old => {
let newPageCount = functionalUpdate(
updater,
table.options.pageCount ?? -1
)
if (typeof newPageCount === 'number') {
newPageCount = Math.max(-1, newPageCount)
}
if (typeof newPageCount === 'number') {
newPageCount = Math.max(-1, newPageCount)
}
return {
...old,
pageCount: newPageCount,
}
})
return {
...old,
pageCount: newPageCount,
}
}),
getPageOptions: memo(
() => [table.getPageCount()],
pageCount => {
let pageOptions: number[] = []
if (pageCount && pageCount > 0) {
pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i)
}
return pageOptions
},
{
key: process.env.NODE_ENV === 'development' && 'getPageOptions',
debug: () => table.options.debugAll ?? table.options.debugTable,
table.getPageOptions = memo(
() => [table.getPageCount()],
pageCount => {
let pageOptions: number[] = []
if (pageCount && pageCount > 0) {
pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i)
}
),
return pageOptions
},
{
key: process.env.NODE_ENV === 'development' && 'getPageOptions',
debug: () => table.options.debugAll ?? table.options.debugTable,
}
)
getCanPreviousPage: () => table.getState().pagination.pageIndex > 0,
table.getCanPreviousPage = () => table.getState().pagination.pageIndex > 0
getCanNextPage: () => {
const { pageIndex } = table.getState().pagination
table.getCanNextPage = () => {
const { pageIndex } = table.getState().pagination
const pageCount = table.getPageCount()
const pageCount = table.getPageCount()
if (pageCount === -1) {
return true
}
if (pageCount === -1) {
return true
}
if (pageCount === 0) {
return false
}
if (pageCount === 0) {
return false
}
return pageIndex < pageCount - 1
},
return pageIndex < pageCount - 1
}
previousPage: () => {
return table.setPageIndex(old => old - 1)
},
table.previousPage = () => {
return table.setPageIndex(old => old - 1)
}
nextPage: () => {
return table.setPageIndex(old => {
return old + 1
})
},
table.nextPage = () => {
return table.setPageIndex(old => {
return old + 1
})
}
getPrePaginationRowModel: () => table.getExpandedRowModel(),
getPaginationRowModel: () => {
if (
!table._getPaginationRowModel &&
table.options.getPaginationRowModel
) {
table._getPaginationRowModel =
table.options.getPaginationRowModel(table)
}
table.getPrePaginationRowModel = () => table.getExpandedRowModel()
table.getPaginationRowModel = () => {
if (
!table._getPaginationRowModel &&
table.options.getPaginationRowModel
) {
table._getPaginationRowModel =
table.options.getPaginationRowModel(table)
}
if (table.options.manualPagination || !table._getPaginationRowModel) {
return table.getPrePaginationRowModel()
}
if (table.options.manualPagination || !table._getPaginationRowModel) {
return table.getPrePaginationRowModel()
}
return table._getPaginationRowModel()
},
return table._getPaginationRowModel()
}
getPageCount: () => {
return (
table.options.pageCount ??
Math.ceil(
table.getPrePaginationRowModel().rows.length /
table.getState().pagination.pageSize
)
table.getPageCount = () => {
return (
table.options.pageCount ??
Math.ceil(
table.getPrePaginationRowModel().rows.length /
table.getState().pagination.pageSize
)
},
)
}
},
}

@@ -85,66 +85,64 @@ import { TableFeature } from '../core/table'

table: Table<TData>
): ColumnPinningColumn => {
return {
pin: position => {
const columnIds = column
.getLeafColumns()
.map(d => d.id)
.filter(Boolean) as string[]
): void => {
column.pin = position => {
const columnIds = column
.getLeafColumns()
.map(d => d.id)
.filter(Boolean) as string[]
table.setColumnPinning(old => {
if (position === 'right') {
return {
left: (old?.left ?? []).filter(d => !columnIds?.includes(d)),
right: [
...(old?.right ?? []).filter(d => !columnIds?.includes(d)),
...columnIds,
],
}
table.setColumnPinning(old => {
if (position === 'right') {
return {
left: (old?.left ?? []).filter(d => !columnIds?.includes(d)),
right: [
...(old?.right ?? []).filter(d => !columnIds?.includes(d)),
...columnIds,
],
}
}
if (position === 'left') {
return {
left: [
...(old?.left ?? []).filter(d => !columnIds?.includes(d)),
...columnIds,
],
right: (old?.right ?? []).filter(d => !columnIds?.includes(d)),
}
}
if (position === 'left') {
return {
left: (old?.left ?? []).filter(d => !columnIds?.includes(d)),
left: [
...(old?.left ?? []).filter(d => !columnIds?.includes(d)),
...columnIds,
],
right: (old?.right ?? []).filter(d => !columnIds?.includes(d)),
}
})
},
}
getCanPin: () => {
const leafColumns = column.getLeafColumns()
return {
left: (old?.left ?? []).filter(d => !columnIds?.includes(d)),
right: (old?.right ?? []).filter(d => !columnIds?.includes(d)),
}
})
}
return leafColumns.some(
d =>
(d.columnDef.enablePinning ?? true) &&
(table.options.enablePinning ?? true)
)
},
column.getCanPin = () => {
const leafColumns = column.getLeafColumns()
getIsPinned: () => {
const leafColumnIds = column.getLeafColumns().map(d => d.id)
return leafColumns.some(
d =>
(d.columnDef.enablePinning ?? true) &&
(table.options.enablePinning ?? true)
)
}
const { left, right } = table.getState().columnPinning
column.getIsPinned = () => {
const leafColumnIds = column.getLeafColumns().map(d => d.id)
const isLeft = leafColumnIds.some(d => left?.includes(d))
const isRight = leafColumnIds.some(d => right?.includes(d))
const { left, right } = table.getState().columnPinning
return isLeft ? 'left' : isRight ? 'right' : false
},
const isLeft = leafColumnIds.some(d => left?.includes(d))
const isRight = leafColumnIds.some(d => right?.includes(d))
getPinnedIndex: () => {
const position = column.getIsPinned()
return isLeft ? 'left' : isRight ? 'right' : false
}
return position
? table.getState().columnPinning?.[position]?.indexOf(column.id) ?? -1
: 0
},
column.getPinnedIndex = () => {
const position = column.getIsPinned()
return position
? table.getState().columnPinning?.[position]?.indexOf(column.id) ?? -1
: 0
}

@@ -156,134 +154,116 @@ },

table: Table<TData>
): ColumnPinningRow<TData> => {
return {
getCenterVisibleCells: memo(
() => [
row._getAllVisibleCells(),
table.getState().columnPinning.left,
table.getState().columnPinning.right,
],
(allCells, left, right) => {
const leftAndRight: string[] = [...(left ?? []), ...(right ?? [])]
): void => {
row.getCenterVisibleCells = memo(
() => [
row._getAllVisibleCells(),
table.getState().columnPinning.left,
table.getState().columnPinning.right,
],
(allCells, left, right) => {
const leftAndRight: string[] = [...(left ?? []), ...(right ?? [])]
return allCells.filter(d => !leftAndRight.includes(d.column.id))
},
{
key:
process.env.NODE_ENV === 'production' &&
'row.getCenterVisibleCells',
debug: () => table.options.debugAll ?? table.options.debugRows,
}
),
getLeftVisibleCells: memo(
() => [
row._getAllVisibleCells(),
table.getState().columnPinning.left,
,
],
(allCells, left) => {
const cells = (left ?? [])
.map(
columnId => allCells.find(cell => cell.column.id === columnId)!
)
.filter(Boolean)
.map(d => ({ ...d, position: 'left' } as Cell<TData, unknown>))
return allCells.filter(d => !leftAndRight.includes(d.column.id))
},
{
key:
process.env.NODE_ENV === 'production' && 'row.getCenterVisibleCells',
debug: () => table.options.debugAll ?? table.options.debugRows,
}
)
row.getLeftVisibleCells = memo(
() => [row._getAllVisibleCells(), table.getState().columnPinning.left, ,],
(allCells, left) => {
const cells = (left ?? [])
.map(columnId => allCells.find(cell => cell.column.id === columnId)!)
.filter(Boolean)
.map(d => ({ ...d, position: 'left' } as Cell<TData, unknown>))
return cells
},
{
key:
process.env.NODE_ENV === 'production' && 'row.getLeftVisibleCells',
debug: () => table.options.debugAll ?? table.options.debugRows,
}
),
getRightVisibleCells: memo(
() => [row._getAllVisibleCells(), table.getState().columnPinning.right],
(allCells, right) => {
const cells = (right ?? [])
.map(
columnId => allCells.find(cell => cell.column.id === columnId)!
)
.filter(Boolean)
.map(d => ({ ...d, position: 'right' } as Cell<TData, unknown>))
return cells
},
{
key: process.env.NODE_ENV === 'production' && 'row.getLeftVisibleCells',
debug: () => table.options.debugAll ?? table.options.debugRows,
}
)
row.getRightVisibleCells = memo(
() => [row._getAllVisibleCells(), table.getState().columnPinning.right],
(allCells, right) => {
const cells = (right ?? [])
.map(columnId => allCells.find(cell => cell.column.id === columnId)!)
.filter(Boolean)
.map(d => ({ ...d, position: 'right' } as Cell<TData, unknown>))
return cells
},
{
key:
process.env.NODE_ENV === 'production' && 'row.getRightVisibleCells',
debug: () => table.options.debugAll ?? table.options.debugRows,
}
),
}
return cells
},
{
key:
process.env.NODE_ENV === 'production' && 'row.getRightVisibleCells',
debug: () => table.options.debugAll ?? table.options.debugRows,
}
)
},
createTable: <TData extends RowData>(
table: Table<TData>
): ColumnPinningInstance<TData> => {
return {
setColumnPinning: updater =>
table.options.onColumnPinningChange?.(updater),
createTable: <TData extends RowData>(table: Table<TData>): void => {
table.setColumnPinning = updater =>
table.options.onColumnPinningChange?.(updater)
resetColumnPinning: defaultState =>
table.setColumnPinning(
defaultState
? getDefaultPinningState()
: table.initialState?.columnPinning ?? getDefaultPinningState()
),
table.resetColumnPinning = defaultState =>
table.setColumnPinning(
defaultState
? getDefaultPinningState()
: table.initialState?.columnPinning ?? getDefaultPinningState()
)
getIsSomeColumnsPinned: position => {
const pinningState = table.getState().columnPinning
table.getIsSomeColumnsPinned = position => {
const pinningState = table.getState().columnPinning
if (!position) {
return Boolean(
pinningState.left?.length || pinningState.right?.length
)
}
return Boolean(pinningState[position]?.length)
if (!position) {
return Boolean(pinningState.left?.length || pinningState.right?.length)
}
return Boolean(pinningState[position]?.length)
}
table.getLeftLeafColumns = memo(
() => [table.getAllLeafColumns(), table.getState().columnPinning.left],
(allColumns, left) => {
return (left ?? [])
.map(columnId => allColumns.find(column => column.id === columnId)!)
.filter(Boolean)
},
{
key: process.env.NODE_ENV === 'development' && 'getLeftLeafColumns',
debug: () => table.options.debugAll ?? table.options.debugColumns,
}
)
getLeftLeafColumns: memo(
() => [table.getAllLeafColumns(), table.getState().columnPinning.left],
(allColumns, left) => {
return (left ?? [])
.map(columnId => allColumns.find(column => column.id === columnId)!)
.filter(Boolean)
},
{
key: process.env.NODE_ENV === 'development' && 'getLeftLeafColumns',
debug: () => table.options.debugAll ?? table.options.debugColumns,
}
),
table.getRightLeafColumns = memo(
() => [table.getAllLeafColumns(), table.getState().columnPinning.right],
(allColumns, right) => {
return (right ?? [])
.map(columnId => allColumns.find(column => column.id === columnId)!)
.filter(Boolean)
},
{
key: process.env.NODE_ENV === 'development' && 'getRightLeafColumns',
debug: () => table.options.debugAll ?? table.options.debugColumns,
}
)
getRightLeafColumns: memo(
() => [table.getAllLeafColumns(), table.getState().columnPinning.right],
(allColumns, right) => {
return (right ?? [])
.map(columnId => allColumns.find(column => column.id === columnId)!)
.filter(Boolean)
},
{
key: process.env.NODE_ENV === 'development' && 'getRightLeafColumns',
debug: () => table.options.debugAll ?? table.options.debugColumns,
}
),
table.getCenterLeafColumns = memo(
() => [
table.getAllLeafColumns(),
table.getState().columnPinning.left,
table.getState().columnPinning.right,
],
(allColumns, left, right) => {
const leftAndRight: string[] = [...(left ?? []), ...(right ?? [])]
getCenterLeafColumns: memo(
() => [
table.getAllLeafColumns(),
table.getState().columnPinning.left,
table.getState().columnPinning.right,
],
(allColumns, left, right) => {
const leftAndRight: string[] = [...(left ?? []), ...(right ?? [])]
return allColumns.filter(d => !leftAndRight.includes(d.id))
},
{
key: process.env.NODE_ENV === 'development' && 'getCenterLeafColumns',
debug: () => table.options.debugAll ?? table.options.debugColumns,
}
),
}
return allColumns.filter(d => !leftAndRight.includes(d.id))
},
{
key: process.env.NODE_ENV === 'development' && 'getCenterLeafColumns',
debug: () => table.options.debugAll ?? table.options.debugColumns,
}
)
},
}

@@ -81,263 +81,259 @@ import { TableFeature } from '../core/table'

createTable: <TData extends RowData>(
table: Table<TData>
): RowSelectionInstance<TData> => {
return {
setRowSelection: updater => table.options.onRowSelectionChange?.(updater),
resetRowSelection: defaultState =>
table.setRowSelection(
defaultState ? {} : table.initialState.rowSelection ?? {}
),
toggleAllRowsSelected: value => {
table.setRowSelection(old => {
value =
typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected()
createTable: <TData extends RowData>(table: Table<TData>): void => {
table.setRowSelection = updater =>
table.options.onRowSelectionChange?.(updater)
table.resetRowSelection = defaultState =>
table.setRowSelection(
defaultState ? {} : table.initialState.rowSelection ?? {}
)
table.toggleAllRowsSelected = value => {
table.setRowSelection(old => {
value =
typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected()
const rowSelection = { ...old }
const rowSelection = { ...old }
const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows
const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows
// We don't use `mutateRowIsSelected` here for performance reasons.
// All of the rows are flat already, so it wouldn't be worth it
if (value) {
preGroupedFlatRows.forEach(row => {
if (!row.getCanSelect()) {
return
}
rowSelection[row.id] = true
})
} else {
preGroupedFlatRows.forEach(row => {
delete rowSelection[row.id]
})
}
// We don't use `mutateRowIsSelected` here for performance reasons.
// All of the rows are flat already, so it wouldn't be worth it
if (value) {
preGroupedFlatRows.forEach(row => {
if (!row.getCanSelect()) {
return
}
rowSelection[row.id] = true
})
} else {
preGroupedFlatRows.forEach(row => {
delete rowSelection[row.id]
})
}
return rowSelection
})
},
toggleAllPageRowsSelected: value =>
table.setRowSelection(old => {
const resolvedValue =
typeof value !== 'undefined'
? value
: !table.getIsAllPageRowsSelected()
return rowSelection
})
}
table.toggleAllPageRowsSelected = value =>
table.setRowSelection(old => {
const resolvedValue =
typeof value !== 'undefined'
? value
: !table.getIsAllPageRowsSelected()
const rowSelection: RowSelectionState = { ...old }
const rowSelection: RowSelectionState = { ...old }
table.getRowModel().rows.forEach(row => {
mutateRowIsSelected(rowSelection, row.id, resolvedValue, table)
})
table.getRowModel().rows.forEach(row => {
mutateRowIsSelected(rowSelection, row.id, resolvedValue, table)
})
return rowSelection
}),
return rowSelection
})
// addRowSelectionRange: rowId => {
// const {
// rows,
// rowsById,
// options: { selectGroupingRows, selectSubRows },
// } = table
// addRowSelectionRange: rowId => {
// const {
// rows,
// rowsById,
// options: { selectGroupingRows, selectSubRows },
// } = table
// const findSelectedRow = (rows: Row[]) => {
// let found
// rows.find(d => {
// if (d.getIsSelected()) {
// found = d
// return true
// }
// const subFound = findSelectedRow(d.subRows || [])
// if (subFound) {
// found = subFound
// return true
// }
// return false
// })
// return found
// }
// const findSelectedRow = (rows: Row[]) => {
// let found
// rows.find(d => {
// if (d.getIsSelected()) {
// found = d
// return true
// }
// const subFound = findSelectedRow(d.subRows || [])
// if (subFound) {
// found = subFound
// return true
// }
// return false
// })
// return found
// }
// const firstRow = findSelectedRow(rows) || rows[0]
// const lastRow = rowsById[rowId]
// const firstRow = findSelectedRow(rows) || rows[0]
// const lastRow = rowsById[rowId]
// let include = false
// const selectedRowIds = {}
// let include = false
// const selectedRowIds = {}
// const addRow = (row: Row) => {
// mutateRowIsSelected(selectedRowIds, row.id, true, {
// rowsById,
// selectGroupingRows: selectGroupingRows!,
// selectSubRows: selectSubRows!,
// })
// }
// const addRow = (row: Row) => {
// mutateRowIsSelected(selectedRowIds, row.id, true, {
// rowsById,
// selectGroupingRows: selectGroupingRows!,
// selectSubRows: selectSubRows!,
// })
// }
// table.rows.forEach(row => {
// const isFirstRow = row.id === firstRow.id
// const isLastRow = row.id === lastRow.id
// table.rows.forEach(row => {
// const isFirstRow = row.id === firstRow.id
// const isLastRow = row.id === lastRow.id
// if (isFirstRow || isLastRow) {
// if (!include) {
// include = true
// } else if (include) {
// addRow(row)
// include = false
// }
// }
// if (isFirstRow || isLastRow) {
// if (!include) {
// include = true
// } else if (include) {
// addRow(row)
// include = false
// }
// }
// if (include) {
// addRow(row)
// }
// })
// if (include) {
// addRow(row)
// }
// })
// table.setRowSelection(selectedRowIds)
// },
getPreSelectedRowModel: () => table.getCoreRowModel(),
getSelectedRowModel: memo(
() => [table.getState().rowSelection, table.getCoreRowModel()],
(rowSelection, rowModel) => {
if (!Object.keys(rowSelection).length) {
return {
rows: [],
flatRows: [],
rowsById: {},
}
// table.setRowSelection(selectedRowIds)
// },
table.getPreSelectedRowModel = () => table.getCoreRowModel()
table.getSelectedRowModel = memo(
() => [table.getState().rowSelection, table.getCoreRowModel()],
(rowSelection, rowModel) => {
if (!Object.keys(rowSelection).length) {
return {
rows: [],
flatRows: [],
rowsById: {},
}
return selectRowsFn(table, rowModel)
},
{
key: process.env.NODE_ENV === 'development' && 'getSelectedRowModel',
debug: () => table.options.debugAll ?? table.options.debugTable,
}
),
getFilteredSelectedRowModel: memo(
() => [table.getState().rowSelection, table.getFilteredRowModel()],
(rowSelection, rowModel) => {
if (!Object.keys(rowSelection).length) {
return {
rows: [],
flatRows: [],
rowsById: {},
}
return selectRowsFn(table, rowModel)
},
{
key: process.env.NODE_ENV === 'development' && 'getSelectedRowModel',
debug: () => table.options.debugAll ?? table.options.debugTable,
}
)
table.getFilteredSelectedRowModel = memo(
() => [table.getState().rowSelection, table.getFilteredRowModel()],
(rowSelection, rowModel) => {
if (!Object.keys(rowSelection).length) {
return {
rows: [],
flatRows: [],
rowsById: {},
}
return selectRowsFn(table, rowModel)
},
{
key:
process.env.NODE_ENV === 'production' &&
'getFilteredSelectedRowModel',
debug: () => table.options.debugAll ?? table.options.debugTable,
}
),
getGroupedSelectedRowModel: memo(
() => [table.getState().rowSelection, table.getSortedRowModel()],
(rowSelection, rowModel) => {
if (!Object.keys(rowSelection).length) {
return {
rows: [],
flatRows: [],
rowsById: {},
}
return selectRowsFn(table, rowModel)
},
{
key:
process.env.NODE_ENV === 'production' &&
'getFilteredSelectedRowModel',
debug: () => table.options.debugAll ?? table.options.debugTable,
}
)
table.getGroupedSelectedRowModel = memo(
() => [table.getState().rowSelection, table.getSortedRowModel()],
(rowSelection, rowModel) => {
if (!Object.keys(rowSelection).length) {
return {
rows: [],
flatRows: [],
rowsById: {},
}
return selectRowsFn(table, rowModel)
},
{
key:
process.env.NODE_ENV === 'production' &&
'getGroupedSelectedRowModel',
debug: () => table.options.debugAll ?? table.options.debugTable,
}
),
///
return selectRowsFn(table, rowModel)
},
{
key:
process.env.NODE_ENV === 'production' && 'getGroupedSelectedRowModel',
debug: () => table.options.debugAll ?? table.options.debugTable,
}
)
// getGroupingRowCanSelect: rowId => {
// const row = table.getRow(rowId)
///
// if (!row) {
// throw new Error()
// }
// getGroupingRowCanSelect: rowId => {
// const row = table.getRow(rowId)
// if (typeof table.options.enableGroupingRowSelection === 'function') {
// return table.options.enableGroupingRowSelection(row)
// }
// if (!row) {
// throw new Error()
// }
// return table.options.enableGroupingRowSelection ?? false
// },
// if (typeof table.options.enableGroupingRowSelection === 'function') {
// return table.options.enableGroupingRowSelection(row)
// }
getIsAllRowsSelected: () => {
const preGroupedFlatRows = table.getFilteredRowModel().flatRows
const { rowSelection } = table.getState()
// return table.options.enableGroupingRowSelection ?? false
// },
let isAllRowsSelected = Boolean(
preGroupedFlatRows.length && Object.keys(rowSelection).length
)
table.getIsAllRowsSelected = () => {
const preGroupedFlatRows = table.getFilteredRowModel().flatRows
const { rowSelection } = table.getState()
if (isAllRowsSelected) {
if (
preGroupedFlatRows.some(
row => row.getCanSelect() && !rowSelection[row.id]
)
) {
isAllRowsSelected = false
}
let isAllRowsSelected = Boolean(
preGroupedFlatRows.length && Object.keys(rowSelection).length
)
if (isAllRowsSelected) {
if (
preGroupedFlatRows.some(
row => row.getCanSelect() && !rowSelection[row.id]
)
) {
isAllRowsSelected = false
}
}
return isAllRowsSelected
},
return isAllRowsSelected
}
getIsAllPageRowsSelected: () => {
const paginationFlatRows = table
.getPaginationRowModel()
.flatRows.filter(row => row.getCanSelect())
const { rowSelection } = table.getState()
table.getIsAllPageRowsSelected = () => {
const paginationFlatRows = table
.getPaginationRowModel()
.flatRows.filter(row => row.getCanSelect())
const { rowSelection } = table.getState()
let isAllPageRowsSelected = !!paginationFlatRows.length
let isAllPageRowsSelected = !!paginationFlatRows.length
if (
isAllPageRowsSelected &&
paginationFlatRows.some(row => !rowSelection[row.id])
) {
isAllPageRowsSelected = false
}
if (
isAllPageRowsSelected &&
paginationFlatRows.some(row => !rowSelection[row.id])
) {
isAllPageRowsSelected = false
}
return isAllPageRowsSelected
},
return isAllPageRowsSelected
}
getIsSomeRowsSelected: () => {
const totalSelected = Object.keys(
table.getState().rowSelection ?? {}
).length
return (
totalSelected > 0 &&
totalSelected < table.getFilteredRowModel().flatRows.length
)
},
table.getIsSomeRowsSelected = () => {
const totalSelected = Object.keys(
table.getState().rowSelection ?? {}
).length
return (
totalSelected > 0 &&
totalSelected < table.getFilteredRowModel().flatRows.length
)
}
getIsSomePageRowsSelected: () => {
const paginationFlatRows = table.getPaginationRowModel().flatRows
return table.getIsAllPageRowsSelected()
? false
: paginationFlatRows
.filter(row => row.getCanSelect())
.some(d => d.getIsSelected() || d.getIsSomeSelected())
},
table.getIsSomePageRowsSelected = () => {
const paginationFlatRows = table.getPaginationRowModel().flatRows
return table.getIsAllPageRowsSelected()
? false
: paginationFlatRows
.filter(row => row.getCanSelect())
.some(d => d.getIsSelected() || d.getIsSomeSelected())
}
getToggleAllRowsSelectedHandler: () => {
return (e: unknown) => {
table.toggleAllRowsSelected(
((e as MouseEvent).target as HTMLInputElement).checked
)
}
},
table.getToggleAllRowsSelectedHandler = () => {
return (e: unknown) => {
table.toggleAllRowsSelected(
((e as MouseEvent).target as HTMLInputElement).checked
)
}
}
getToggleAllPageRowsSelectedHandler: () => {
return (e: unknown) => {
table.toggleAllPageRowsSelected(
((e as MouseEvent).target as HTMLInputElement).checked
)
}
},
table.getToggleAllPageRowsSelectedHandler = () => {
return (e: unknown) => {
table.toggleAllPageRowsSelected(
((e as MouseEvent).target as HTMLInputElement).checked
)
}
}

@@ -349,69 +345,67 @@ },

table: Table<TData>
): RowSelectionRow => {
return {
toggleSelected: value => {
const isSelected = row.getIsSelected()
): void => {
row.toggleSelected = value => {
const isSelected = row.getIsSelected()
table.setRowSelection(old => {
value = typeof value !== 'undefined' ? value : !isSelected
table.setRowSelection(old => {
value = typeof value !== 'undefined' ? value : !isSelected
if (isSelected === value) {
return old
}
if (isSelected === value) {
return old
}
const selectedRowIds = { ...old }
const selectedRowIds = { ...old }
mutateRowIsSelected(selectedRowIds, row.id, value, table)
mutateRowIsSelected(selectedRowIds, row.id, value, table)
return selectedRowIds
})
},
getIsSelected: () => {
const { rowSelection } = table.getState()
return isRowSelected(row, rowSelection)
},
return selectedRowIds
})
}
row.getIsSelected = () => {
const { rowSelection } = table.getState()
return isRowSelected(row, rowSelection)
}
getIsSomeSelected: () => {
const { rowSelection } = table.getState()
return isSubRowSelected(row, rowSelection, table) === 'some'
},
row.getIsSomeSelected = () => {
const { rowSelection } = table.getState()
return isSubRowSelected(row, rowSelection, table) === 'some'
}
getIsAllSubRowsSelected: () => {
const { rowSelection } = table.getState()
return isSubRowSelected(row, rowSelection, table) === 'all'
},
row.getIsAllSubRowsSelected = () => {
const { rowSelection } = table.getState()
return isSubRowSelected(row, rowSelection, table) === 'all'
}
getCanSelect: () => {
if (typeof table.options.enableRowSelection === 'function') {
return table.options.enableRowSelection(row)
}
row.getCanSelect = () => {
if (typeof table.options.enableRowSelection === 'function') {
return table.options.enableRowSelection(row)
}
return table.options.enableRowSelection ?? true
},
return table.options.enableRowSelection ?? true
}
getCanSelectSubRows: () => {
if (typeof table.options.enableSubRowSelection === 'function') {
return table.options.enableSubRowSelection(row)
}
row.getCanSelectSubRows = () => {
if (typeof table.options.enableSubRowSelection === 'function') {
return table.options.enableSubRowSelection(row)
}
return table.options.enableSubRowSelection ?? true
},
return table.options.enableSubRowSelection ?? true
}
getCanMultiSelect: () => {
if (typeof table.options.enableMultiRowSelection === 'function') {
return table.options.enableMultiRowSelection(row)
}
row.getCanMultiSelect = () => {
if (typeof table.options.enableMultiRowSelection === 'function') {
return table.options.enableMultiRowSelection(row)
}
return table.options.enableMultiRowSelection ?? true
},
getToggleSelectedHandler: () => {
const canSelect = row.getCanSelect()
return table.options.enableMultiRowSelection ?? true
}
row.getToggleSelectedHandler = () => {
const canSelect = row.getCanSelect()
return (e: unknown) => {
if (!canSelect) return
row.toggleSelected(
((e as MouseEvent).target as HTMLInputElement)?.checked
)
}
},
return (e: unknown) => {
if (!canSelect) return
row.toggleSelected(
((e as MouseEvent).target as HTMLInputElement)?.checked
)
}
}

@@ -418,0 +412,0 @@ },

@@ -137,247 +137,237 @@ import { RowModel } from '..'

table: Table<TData>
): SortingColumn<TData> => {
return {
getAutoSortingFn: () => {
const firstRows = table.getFilteredRowModel().flatRows.slice(10)
): void => {
column.getAutoSortingFn = () => {
const firstRows = table.getFilteredRowModel().flatRows.slice(10)
let isString = false
let isString = false
for (const row of firstRows) {
const value = row?.getValue(column.id)
for (const row of firstRows) {
const value = row?.getValue(column.id)
if (Object.prototype.toString.call(value) === '[object Date]') {
return sortingFns.datetime
}
if (Object.prototype.toString.call(value) === '[object Date]') {
return sortingFns.datetime
}
if (typeof value === 'string') {
isString = true
if (typeof value === 'string') {
isString = true
if (value.split(reSplitAlphaNumeric).length > 1) {
return sortingFns.alphanumeric
}
if (value.split(reSplitAlphaNumeric).length > 1) {
return sortingFns.alphanumeric
}
}
}
if (isString) {
return sortingFns.text
}
if (isString) {
return sortingFns.text
}
return sortingFns.basic
},
getAutoSortDir: () => {
const firstRow = table.getFilteredRowModel().flatRows[0]
return sortingFns.basic
}
column.getAutoSortDir = () => {
const firstRow = table.getFilteredRowModel().flatRows[0]
const value = firstRow?.getValue(column.id)
const value = firstRow?.getValue(column.id)
if (typeof value === 'string') {
return 'asc'
}
if (typeof value === 'string') {
return 'asc'
}
return 'desc'
},
getSortingFn: () => {
if (!column) {
throw new Error()
}
return 'desc'
}
column.getSortingFn = () => {
if (!column) {
throw new Error()
}
return isFunction(column.columnDef.sortingFn)
? column.columnDef.sortingFn
: column.columnDef.sortingFn === 'auto'
? column.getAutoSortingFn()
: table.options.sortingFns?.[column.columnDef.sortingFn as string] ??
sortingFns[column.columnDef.sortingFn as BuiltInSortingFn]
},
toggleSorting: (desc, multi) => {
// if (column.columns.length) {
// column.columns.forEach((c, i) => {
// if (c.id) {
// table.toggleColumnSorting(c.id, undefined, multi || !!i)
// }
// })
// return
// }
return isFunction(column.columnDef.sortingFn)
? column.columnDef.sortingFn
: column.columnDef.sortingFn === 'auto'
? column.getAutoSortingFn()
: table.options.sortingFns?.[column.columnDef.sortingFn as string] ??
sortingFns[column.columnDef.sortingFn as BuiltInSortingFn]
}
column.toggleSorting = (desc, multi) => {
// if (column.columns.length) {
// column.columns.forEach((c, i) => {
// if (c.id) {
// table.toggleColumnSorting(c.id, undefined, multi || !!i)
// }
// })
// return
// }
// this needs to be outside of table.setSorting to be in sync with rerender
const nextSortingOrder = column.getNextSortingOrder()
const hasManualValue = typeof desc !== 'undefined' && desc !== null
// this needs to be outside of table.setSorting to be in sync with rerender
const nextSortingOrder = column.getNextSortingOrder()
const hasManualValue = typeof desc !== 'undefined' && desc !== null
table.setSorting(old => {
// Find any existing sorting for this column
const existingSorting = old?.find(d => d.id === column.id)
const existingIndex = old?.findIndex(d => d.id === column.id)
table.setSorting(old => {
// Find any existing sorting for this column
const existingSorting = old?.find(d => d.id === column.id)
const existingIndex = old?.findIndex(d => d.id === column.id)
let newSorting: SortingState = []
let newSorting: SortingState = []
// What should we do with this sort action?
let sortAction: 'add' | 'remove' | 'toggle' | 'replace'
let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc'
// What should we do with this sort action?
let sortAction: 'add' | 'remove' | 'toggle' | 'replace'
let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc'
// Multi-mode
if (old?.length && column.getCanMultiSort() && multi) {
if (existingSorting) {
sortAction = 'toggle'
} else {
sortAction = 'add'
}
// Multi-mode
if (old?.length && column.getCanMultiSort() && multi) {
if (existingSorting) {
sortAction = 'toggle'
} else {
// Normal mode
if (old?.length && existingIndex !== old.length - 1) {
sortAction = 'replace'
} else if (existingSorting) {
sortAction = 'toggle'
} else {
sortAction = 'replace'
}
sortAction = 'add'
}
} else {
// Normal mode
if (old?.length && existingIndex !== old.length - 1) {
sortAction = 'replace'
} else if (existingSorting) {
sortAction = 'toggle'
} else {
sortAction = 'replace'
}
}
// Handle toggle states that will remove the sorting
if (sortAction === 'toggle') {
// If we are "actually" toggling (not a manual set value), should we remove the sorting?
if (!hasManualValue) {
// Is our intention to remove?
if (!nextSortingOrder) {
sortAction = 'remove'
}
// Handle toggle states that will remove the sorting
if (sortAction === 'toggle') {
// If we are "actually" toggling (not a manual set value), should we remove the sorting?
if (!hasManualValue) {
// Is our intention to remove?
if (!nextSortingOrder) {
sortAction = 'remove'
}
}
}
if (sortAction === 'add') {
newSorting = [
...old,
{
id: column.id,
if (sortAction === 'add') {
newSorting = [
...old,
{
id: column.id,
desc: nextDesc,
},
]
// Take latest n columns
newSorting.splice(
0,
newSorting.length -
(table.options.maxMultiSortColCount ?? Number.MAX_SAFE_INTEGER)
)
} else if (sortAction === 'toggle') {
// This flips (or sets) the
newSorting = old.map(d => {
if (d.id === column.id) {
return {
...d,
desc: nextDesc,
},
]
// Take latest n columns
newSorting.splice(
0,
newSorting.length -
(table.options.maxMultiSortColCount ?? Number.MAX_SAFE_INTEGER)
)
} else if (sortAction === 'toggle') {
// This flips (or sets) the
newSorting = old.map(d => {
if (d.id === column.id) {
return {
...d,
desc: nextDesc,
}
}
return d
})
} else if (sortAction === 'remove') {
newSorting = old.filter(d => d.id !== column.id)
} else {
newSorting = [
{
id: column.id,
desc: nextDesc,
},
]
}
}
return d
})
} else if (sortAction === 'remove') {
newSorting = old.filter(d => d.id !== column.id)
} else {
newSorting = [
{
id: column.id,
desc: nextDesc,
},
]
}
return newSorting
})
},
return newSorting
})
}
getFirstSortDir: () => {
const sortDescFirst =
column.columnDef.sortDescFirst ??
table.options.sortDescFirst ??
column.getAutoSortDir() === 'desc'
return sortDescFirst ? 'desc' : 'asc'
},
column.getFirstSortDir = () => {
const sortDescFirst =
column.columnDef.sortDescFirst ??
table.options.sortDescFirst ??
column.getAutoSortDir() === 'desc'
return sortDescFirst ? 'desc' : 'asc'
}
getNextSortingOrder: (multi?: boolean) => {
const firstSortDirection = column.getFirstSortDir()
const isSorted = column.getIsSorted()
column.getNextSortingOrder = (multi?: boolean) => {
const firstSortDirection = column.getFirstSortDir()
const isSorted = column.getIsSorted()
if (!isSorted) {
return firstSortDirection
}
if (!isSorted) {
return firstSortDirection
}
if (
isSorted !== firstSortDirection &&
(table.options.enableSortingRemoval ?? true) && // If enableSortRemove, enable in general
(multi ? table.options.enableMultiRemove ?? true : true) // If multi, don't allow if enableMultiRemove))
) {
return false
}
return isSorted === 'desc' ? 'asc' : 'desc'
},
if (
isSorted !== firstSortDirection &&
(table.options.enableSortingRemoval ?? true) && // If enableSortRemove, enable in general
(multi ? table.options.enableMultiRemove ?? true : true) // If multi, don't allow if enableMultiRemove))
) {
return false
}
return isSorted === 'desc' ? 'asc' : 'desc'
}
getCanSort: () => {
return (
(column.columnDef.enableSorting ?? true) &&
(table.options.enableSorting ?? true) &&
!!column.accessorFn
)
},
column.getCanSort = () => {
return (
(column.columnDef.enableSorting ?? true) &&
(table.options.enableSorting ?? true) &&
!!column.accessorFn
)
}
getCanMultiSort: () => {
return (
column.columnDef.enableMultiSort ??
table.options.enableMultiSort ??
!!column.accessorFn
)
},
column.getCanMultiSort = () => {
return (
column.columnDef.enableMultiSort ??
table.options.enableMultiSort ??
!!column.accessorFn
)
}
getIsSorted: () => {
const columnSort = table
.getState()
.sorting?.find(d => d.id === column.id)
column.getIsSorted = () => {
const columnSort = table.getState().sorting?.find(d => d.id === column.id)
return !columnSort ? false : columnSort.desc ? 'desc' : 'asc'
},
return !columnSort ? false : columnSort.desc ? 'desc' : 'asc'
}
getSortIndex: () =>
table.getState().sorting?.findIndex(d => d.id === column.id) ?? -1,
column.getSortIndex = () =>
table.getState().sorting?.findIndex(d => d.id === column.id) ?? -1
clearSorting: () => {
//clear sorting for just 1 column
table.setSorting(old =>
old?.length ? old.filter(d => d.id !== column.id) : []
)
},
column.clearSorting = () => {
//clear sorting for just 1 column
table.setSorting(old =>
old?.length ? old.filter(d => d.id !== column.id) : []
)
}
getToggleSortingHandler: () => {
const canSort = column.getCanSort()
column.getToggleSortingHandler = () => {
const canSort = column.getCanSort()
return (e: unknown) => {
if (!canSort) return
;(e as any).persist?.()
column.toggleSorting?.(
undefined,
column.getCanMultiSort()
? table.options.isMultiSortEvent?.(e)
: false
)
}
},
return (e: unknown) => {
if (!canSort) return
;(e as any).persist?.()
column.toggleSorting?.(
undefined,
column.getCanMultiSort() ? table.options.isMultiSortEvent?.(e) : false
)
}
}
},
createTable: <TData extends RowData>(
table: Table<TData>
): SortingInstance<TData> => {
return {
setSorting: updater => table.options.onSortingChange?.(updater),
resetSorting: defaultState => {
table.setSorting(defaultState ? [] : table.initialState?.sorting ?? [])
},
getPreSortedRowModel: () => table.getGroupedRowModel(),
getSortedRowModel: () => {
if (!table._getSortedRowModel && table.options.getSortedRowModel) {
table._getSortedRowModel = table.options.getSortedRowModel(table)
}
createTable: <TData extends RowData>(table: Table<TData>): void => {
table.setSorting = updater => table.options.onSortingChange?.(updater)
table.resetSorting = defaultState => {
table.setSorting(defaultState ? [] : table.initialState?.sorting ?? [])
}
table.getPreSortedRowModel = () => table.getGroupedRowModel()
table.getSortedRowModel = () => {
if (!table._getSortedRowModel && table.options.getSortedRowModel) {
table._getSortedRowModel = table.options.getSortedRowModel(table)
}
if (table.options.manualSorting || !table._getSortedRowModel) {
return table.getPreSortedRowModel()
}
if (table.options.manualSorting || !table._getSortedRowModel) {
return table.getPreSortedRowModel()
}
return table._getSortedRowModel()
},
return table._getSortedRowModel()
}
},
}

@@ -79,29 +79,27 @@ import { TableFeature } from '../core/table'

table: Table<TData>
): VisibilityColumn => {
return {
toggleVisibility: value => {
if (column.getCanHide()) {
table.setColumnVisibility(old => ({
...old,
[column.id]: value ?? !column.getIsVisible(),
}))
}
},
getIsVisible: () => {
return table.getState().columnVisibility?.[column.id] ?? true
},
): void => {
column.toggleVisibility = value => {
if (column.getCanHide()) {
table.setColumnVisibility(old => ({
...old,
[column.id]: value ?? !column.getIsVisible(),
}))
}
}
column.getIsVisible = () => {
return table.getState().columnVisibility?.[column.id] ?? true
}
getCanHide: () => {
return (
(column.columnDef.enableHiding ?? true) &&
(table.options.enableHiding ?? true)
column.getCanHide = () => {
return (
(column.columnDef.enableHiding ?? true) &&
(table.options.enableHiding ?? true)
)
}
column.getToggleVisibilityHandler = () => {
return (e: unknown) => {
column.toggleVisibility?.(
((e as MouseEvent).target as HTMLInputElement).checked
)
},
getToggleVisibilityHandler: () => {
return (e: unknown) => {
column.toggleVisibility?.(
((e as MouseEvent).target as HTMLInputElement).checked
)
}
},
}
}

@@ -113,33 +111,28 @@ },

table: Table<TData>
): VisibilityRow<TData> => {
return {
_getAllVisibleCells: memo(
() => [row.getAllCells(), table.getState().columnVisibility],
cells => {
return cells.filter(cell => cell.column.getIsVisible())
},
{
key:
process.env.NODE_ENV === 'production' && 'row._getAllVisibleCells',
debug: () => table.options.debugAll ?? table.options.debugRows,
}
),
getVisibleCells: memo(
() => [
row.getLeftVisibleCells(),
row.getCenterVisibleCells(),
row.getRightVisibleCells(),
],
(left, center, right) => [...left, ...center, ...right],
{
key: process.env.NODE_ENV === 'development' && 'row.getVisibleCells',
debug: () => table.options.debugAll ?? table.options.debugRows,
}
),
}
): void => {
row._getAllVisibleCells = memo(
() => [row.getAllCells(), table.getState().columnVisibility],
cells => {
return cells.filter(cell => cell.column.getIsVisible())
},
{
key: process.env.NODE_ENV === 'production' && 'row._getAllVisibleCells',
debug: () => table.options.debugAll ?? table.options.debugRows,
}
)
row.getVisibleCells = memo(
() => [
row.getLeftVisibleCells(),
row.getCenterVisibleCells(),
row.getRightVisibleCells(),
],
(left, center, right) => [...left, ...center, ...right],
{
key: process.env.NODE_ENV === 'development' && 'row.getVisibleCells',
debug: () => table.options.debugAll ?? table.options.debugRows,
}
)
},
createTable: <TData extends RowData>(
table: Table<TData>
): VisibilityInstance<TData> => {
createTable: <TData extends RowData>(table: Table<TData>): void => {
const makeVisibleColumnsMethod = (

@@ -167,62 +160,60 @@ key: string,

return {
getVisibleFlatColumns: makeVisibleColumnsMethod(
'getVisibleFlatColumns',
() => table.getAllFlatColumns()
),
getVisibleLeafColumns: makeVisibleColumnsMethod(
'getVisibleLeafColumns',
() => table.getAllLeafColumns()
),
getLeftVisibleLeafColumns: makeVisibleColumnsMethod(
'getLeftVisibleLeafColumns',
() => table.getLeftLeafColumns()
),
getRightVisibleLeafColumns: makeVisibleColumnsMethod(
'getRightVisibleLeafColumns',
() => table.getRightLeafColumns()
),
getCenterVisibleLeafColumns: makeVisibleColumnsMethod(
'getCenterVisibleLeafColumns',
() => table.getCenterLeafColumns()
),
table.getVisibleFlatColumns = makeVisibleColumnsMethod(
'getVisibleFlatColumns',
() => table.getAllFlatColumns()
)
table.getVisibleLeafColumns = makeVisibleColumnsMethod(
'getVisibleLeafColumns',
() => table.getAllLeafColumns()
)
table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod(
'getLeftVisibleLeafColumns',
() => table.getLeftLeafColumns()
)
table.getRightVisibleLeafColumns = makeVisibleColumnsMethod(
'getRightVisibleLeafColumns',
() => table.getRightLeafColumns()
)
table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod(
'getCenterVisibleLeafColumns',
() => table.getCenterLeafColumns()
)
setColumnVisibility: updater =>
table.options.onColumnVisibilityChange?.(updater),
table.setColumnVisibility = updater =>
table.options.onColumnVisibilityChange?.(updater)
resetColumnVisibility: defaultState => {
table.setColumnVisibility(
defaultState ? {} : table.initialState.columnVisibility ?? {}
)
},
table.resetColumnVisibility = defaultState => {
table.setColumnVisibility(
defaultState ? {} : table.initialState.columnVisibility ?? {}
)
}
toggleAllColumnsVisible: value => {
value = value ?? !table.getIsAllColumnsVisible()
table.toggleAllColumnsVisible = value => {
value = value ?? !table.getIsAllColumnsVisible()
table.setColumnVisibility(
table.getAllLeafColumns().reduce(
(obj, column) => ({
...obj,
[column.id]: !value ? !column.getCanHide?.() : value,
}),
{}
)
table.setColumnVisibility(
table.getAllLeafColumns().reduce(
(obj, column) => ({
...obj,
[column.id]: !value ? !column.getCanHide?.() : value,
}),
{}
)
},
)
}
getIsAllColumnsVisible: () =>
!table.getAllLeafColumns().some(column => !column.getIsVisible?.()),
table.getIsAllColumnsVisible = () =>
!table.getAllLeafColumns().some(column => !column.getIsVisible?.())
getIsSomeColumnsVisible: () =>
table.getAllLeafColumns().some(column => column.getIsVisible?.()),
table.getIsSomeColumnsVisible = () =>
table.getAllLeafColumns().some(column => column.getIsVisible?.())
getToggleAllColumnsVisibilityHandler: () => {
return (e: unknown) => {
table.toggleAllColumnsVisible(
((e as MouseEvent).target as HTMLInputElement)?.checked
)
}
},
table.getToggleAllColumnsVisibilityHandler = () => {
return (e: unknown) => {
table.toggleAllColumnsVisible(
((e as MouseEvent).target as HTMLInputElement)?.checked
)
}
}
},
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc