@coldsmirk/ledger-mantine 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +21 -7
- package/dist/index.cjs +31 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -11
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -123,9 +123,10 @@ const dateRange = (row, columnId, filterValue) => {
|
|
|
123
123
|
};
|
|
124
124
|
dateRange.autoRemove = (value) => !value || !value[0] && !value[1];
|
|
125
125
|
/**
|
|
126
|
-
* Strict set membership for the multi-select variant. TanStack
|
|
127
|
-
*
|
|
128
|
-
*
|
|
126
|
+
* Strict set membership for the multi-select variant. No TanStack built-in covers both cell
|
|
127
|
+
* shapes exactly: `arrIncludesSome` rejects non-array row values outright, `arrHas` rejects
|
|
128
|
+
* array cells, and `arrIncludes` substring-matches strings ("active" would match "inactive") —
|
|
129
|
+
* the variant's semantics are exact membership for scalar and array cells.
|
|
129
130
|
*/
|
|
130
131
|
const oneOf = (row, columnId, filterValue) => {
|
|
131
132
|
const raw = row.getValue(columnId);
|
|
@@ -493,10 +494,12 @@ function RowReorderOverlay({ session }) {
|
|
|
493
494
|
function RowDragCell({ row, table }) {
|
|
494
495
|
const { labels, icons, rowReorderKeyboard } = useDataTableContext();
|
|
495
496
|
const orderable = table.options.meta?.ledger?.rowOrdering.orderable === true;
|
|
497
|
+
const pinned = table.options.enableRowPinning === true && row.getIsPinned() !== false;
|
|
496
498
|
const { ref, isDragSource } = useDraggable({
|
|
497
499
|
id: row.id,
|
|
498
|
-
disabled: !orderable
|
|
500
|
+
disabled: !orderable || pinned
|
|
499
501
|
});
|
|
502
|
+
if (pinned) return null;
|
|
500
503
|
const lifted = rowReorderKeyboard?.active(row.id) === true;
|
|
501
504
|
const handleKeyDown = (event) => {
|
|
502
505
|
const keyboard = rowReorderKeyboard;
|
|
@@ -2844,8 +2847,9 @@ function TableBody({ table, virtualization, columnWindow, viewportRef, loading,
|
|
|
2844
2847
|
//#endregion
|
|
2845
2848
|
//#region src/table-footer.tsx
|
|
2846
2849
|
/**
|
|
2847
|
-
* Column footers (totals row). Rendered only when at least one leaf
|
|
2848
|
-
* pinned columns keep their sticky offsets so the totals track their
|
|
2850
|
+
* Column footers (totals row). Rendered only when at least one column — leaf or group —
|
|
2851
|
+
* declares a `footer`; pinned columns keep their sticky offsets so the totals track their
|
|
2852
|
+
* columns.
|
|
2849
2853
|
*/
|
|
2850
2854
|
/**
|
|
2851
2855
|
* The footer rows that actually render. `getFooterGroups()` mirrors *every* header level, so a
|
|
@@ -3700,10 +3704,14 @@ function useColumnWidths(table, columns, viewport, tableMinWidth) {
|
|
|
3700
3704
|
* object so `typeof ledgerFeatures` (`LedgerFeatures`) can pre-bind the `TFeatures` generic of
|
|
3701
3705
|
* every re-exported type — consumers keep writing v8-shaped `ColumnDef<TData>` code.
|
|
3702
3706
|
*
|
|
3703
|
-
* - Every stock feature is registered EXCEPT
|
|
3704
|
-
*
|
|
3705
|
-
*
|
|
3706
|
-
*
|
|
3707
|
+
* - Every stock feature is registered EXCEPT the two below.
|
|
3708
|
+
* - `columnResizingFeature`: ledger owns the resize interaction end to end
|
|
3709
|
+
* (`use-column-resize.ts`), so TanStack's drag machinery — and with it the `columnResizing`
|
|
3710
|
+
* state slice, `getIsResizing()`, and `getResizeHandler()` — is not registered at all.
|
|
3711
|
+
* Feature-gated APIs cannot lie about a pipeline that never runs.
|
|
3712
|
+
* - `cellSelectionFeature`: cell selection is deferred until its own design round
|
|
3713
|
+
* (docs/DESIGN.md), so the `cellSelection` state slice, `enableCellSelection`, and
|
|
3714
|
+
* `cell.getIsSelected()` are likewise absent by the same rule.
|
|
3707
3715
|
* - Row model factories are registered statically; the `manualX` translations decide at runtime
|
|
3708
3716
|
* whether a model actually processes rows (client mode) or passes through (server mode).
|
|
3709
3717
|
* - Every built-in fn ships registered under its conventional name. v9 resolves string ids —
|
|
@@ -6029,6 +6037,18 @@ function useDataTable(options) {
|
|
|
6029
6037
|
enableRowSelection,
|
|
6030
6038
|
withExpander
|
|
6031
6039
|
]);
|
|
6040
|
+
const setPublicColumnPinning = useCallback((updater) => {
|
|
6041
|
+
setColumnPinning((old) => {
|
|
6042
|
+
const next = functionalUpdate(updater, old);
|
|
6043
|
+
const start = next.start.filter((id) => !isInternalColumn(id));
|
|
6044
|
+
const end = next.end.filter((id) => !isInternalColumn(id));
|
|
6045
|
+
if (start.length === next.start.length && end.length === next.end.length) return next;
|
|
6046
|
+
return start.length === old.start.length && end.length === old.end.length && start.every((id, index) => id === old.start[index]) && end.every((id, index) => id === old.end[index]) ? old : {
|
|
6047
|
+
end,
|
|
6048
|
+
start
|
|
6049
|
+
};
|
|
6050
|
+
});
|
|
6051
|
+
}, [setColumnPinning]);
|
|
6032
6052
|
if (isDev && (enableRowSelection || withExpander) && !getRowId) warnOnce("missing-get-row-id", "Row selection/expansion is enabled without getRowId — index-based row ids corrupt state across refetches.");
|
|
6033
6053
|
const churn = useRef({
|
|
6034
6054
|
renders: 0,
|
|
@@ -6126,7 +6146,7 @@ function useDataTable(options) {
|
|
|
6126
6146
|
onRowSelectionChange: setRowSelection,
|
|
6127
6147
|
onExpandedChange: setExpanded,
|
|
6128
6148
|
onColumnVisibilityChange: setColumnVisibility,
|
|
6129
|
-
onColumnPinningChange:
|
|
6149
|
+
onColumnPinningChange: setPublicColumnPinning,
|
|
6130
6150
|
onColumnOrderChange: setColumnOrder,
|
|
6131
6151
|
onColumnSizingChange: setColumnSizing,
|
|
6132
6152
|
onGroupingChange: setGrouping,
|