@ackplus/react-tanstack-data-table 1.0.19-beta-0.6 → 1.0.19-beta-0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -11
- package/{index.js → src/index.d.ts} +3 -26
- package/src/index.js +31 -0
- package/src/lib/components/droupdown/menu-dropdown.d.ts +17 -0
- package/src/lib/components/droupdown/menu-dropdown.js +52 -0
- package/src/lib/components/filters/filter-value-input.d.ts +9 -0
- package/src/lib/components/filters/filter-value-input.js +58 -0
- package/src/lib/components/filters/index.d.ts +23 -0
- package/{lib → src/lib}/components/filters/index.js +6 -2
- package/src/lib/components/headers/draggable-header.d.ts +12 -0
- package/{lib → src/lib}/components/headers/draggable-header.js +35 -49
- package/{lib/components/headers/index.js → src/lib/components/headers/index.d.ts} +0 -3
- package/src/lib/components/headers/index.js +5 -0
- package/src/lib/components/headers/table-header.d.ts +10 -0
- package/src/lib/components/headers/table-header.js +48 -0
- package/src/lib/components/index.d.ts +7 -0
- package/src/lib/components/index.js +10 -0
- package/src/lib/components/pagination/data-table-pagination.d.ts +11 -0
- package/src/lib/components/pagination/data-table-pagination.js +25 -0
- package/src/lib/components/pagination/index.d.ts +1 -0
- package/src/lib/components/pagination/index.js +4 -0
- package/src/lib/components/rows/data-table-row.d.ts +13 -0
- package/src/lib/components/rows/data-table-row.js +31 -0
- package/src/lib/components/rows/empty-data-row.d.ts +6 -0
- package/src/lib/components/rows/empty-data-row.js +11 -0
- package/{lib/components/rows/index.js → src/lib/components/rows/index.d.ts} +0 -3
- package/src/lib/components/rows/index.js +6 -0
- package/src/lib/components/rows/loading-rows.d.ts +5 -0
- package/src/lib/components/rows/loading-rows.js +49 -0
- package/src/lib/components/table/data-table.d.ts +3 -0
- package/src/lib/components/table/data-table.js +492 -0
- package/src/lib/components/table/data-table.types.d.ts +114 -0
- package/src/lib/components/table/data-table.types.js +2 -0
- package/{lib/components/table/index.js → src/lib/components/table/index.d.ts} +0 -3
- package/src/lib/components/table/index.js +5 -0
- package/src/lib/components/toolbar/bulk-actions-toolbar.d.ts +9 -0
- package/src/lib/components/toolbar/bulk-actions-toolbar.js +25 -0
- package/src/lib/components/toolbar/column-custom-filter-control.d.ts +1 -0
- package/src/lib/components/toolbar/column-custom-filter-control.js +137 -0
- package/src/lib/components/toolbar/column-pinning-control.d.ts +1 -0
- package/src/lib/components/toolbar/column-pinning-control.js +105 -0
- package/src/lib/components/toolbar/column-reset-control.d.ts +1 -0
- package/src/lib/components/toolbar/column-reset-control.js +16 -0
- package/src/lib/components/toolbar/column-visibility-control.d.ts +1 -0
- package/src/lib/components/toolbar/column-visibility-control.js +31 -0
- package/src/lib/components/toolbar/data-table-toolbar.d.ts +14 -0
- package/src/lib/components/toolbar/data-table-toolbar.js +26 -0
- package/{lib/components/toolbar/index.js → src/lib/components/toolbar/index.d.ts} +1 -6
- package/src/lib/components/toolbar/index.js +17 -0
- package/src/lib/components/toolbar/table-export-control.d.ts +25 -0
- package/src/lib/components/toolbar/table-export-control.js +93 -0
- package/src/lib/components/toolbar/table-search-control.d.ts +1 -0
- package/src/lib/components/toolbar/table-search-control.js +61 -0
- package/src/lib/components/toolbar/table-size-control.d.ts +1 -0
- package/src/lib/components/toolbar/table-size-control.js +36 -0
- package/src/lib/contexts/data-table-context.d.ts +43 -0
- package/{lib → src/lib}/contexts/data-table-context.js +12 -8
- package/src/lib/examples/advanced-features-example.d.ts +1 -0
- package/src/lib/examples/advanced-features-example.js +264 -0
- package/src/lib/examples/bulk-actions-test.d.ts +1 -0
- package/src/lib/examples/bulk-actions-test.js +44 -0
- package/src/lib/examples/custom-column-filter-example.d.ts +1 -0
- package/{lib → src/lib}/examples/custom-column-filter-example.js +10 -10
- package/src/lib/examples/index.js +13 -0
- package/src/lib/examples/selection-test-example.d.ts +1 -0
- package/src/lib/examples/selection-test-example.js +101 -0
- package/src/lib/examples/simple-local-example.d.ts +1 -0
- package/{lib → src/lib}/examples/simple-local-example.js +14 -18
- package/src/lib/features/custom-column-filter.feature.d.ts +45 -0
- package/{lib → src/lib}/features/custom-column-filter.feature.js +40 -99
- package/src/lib/features/custom-selection.feature.d.ts +46 -0
- package/{lib → src/lib}/features/custom-selection.feature.js +18 -70
- package/src/lib/features/index.d.ts +2 -0
- package/src/lib/features/index.js +8 -0
- package/src/lib/hooks/index.d.ts +1 -0
- package/src/lib/hooks/index.js +4 -0
- package/src/lib/hooks/use-data-table-api.d.ts +56 -0
- package/{lib → src/lib}/hooks/use-data-table-api.js +79 -136
- package/src/lib/icons/add-icon.d.ts +2 -0
- package/src/lib/icons/add-icon.js +8 -0
- package/src/lib/icons/csv-icon.d.ts +2 -0
- package/src/lib/icons/csv-icon.js +8 -0
- package/src/lib/icons/delete-icon.d.ts +2 -0
- package/src/lib/icons/delete-icon.js +8 -0
- package/src/lib/icons/excel-icon.d.ts +2 -0
- package/src/lib/icons/excel-icon.js +8 -0
- package/src/lib/icons/index.js +17 -0
- package/src/lib/icons/unpin-icon.d.ts +2 -0
- package/src/lib/icons/unpin-icon.js +8 -0
- package/src/lib/icons/view-comfortable-icon.d.ts +2 -0
- package/src/lib/icons/view-comfortable-icon.js +8 -0
- package/src/lib/icons/view-compact-icon.d.ts +2 -0
- package/src/lib/icons/view-compact-icon.js +8 -0
- package/src/lib/types/column.types.d.ts +29 -0
- package/src/lib/types/column.types.js +5 -0
- package/src/lib/types/data-table-api.d.ts +134 -0
- package/src/lib/types/data-table-api.js +2 -0
- package/src/lib/types/export.types.d.ts +99 -0
- package/src/lib/types/export.types.js +2 -0
- package/src/lib/types/index.d.ts +6 -0
- package/src/lib/types/index.js +8 -0
- package/src/lib/types/slots.types.d.ts +272 -0
- package/src/lib/types/slots.types.js +2 -0
- package/src/lib/types/table.types.d.ts +63 -0
- package/src/lib/types/table.types.js +2 -0
- package/src/lib/utils/column-helpers.d.ts +7 -0
- package/src/lib/utils/column-helpers.js +43 -0
- package/src/lib/utils/debounced-fetch.utils.d.ts +11 -0
- package/{lib → src/lib}/utils/debounced-fetch.utils.js +15 -17
- package/src/lib/utils/export-utils.d.ts +30 -0
- package/src/lib/utils/export-utils.js +152 -0
- package/{lib/utils/index.js → src/lib/utils/index.d.ts} +0 -10
- package/src/lib/utils/index.js +10 -0
- package/src/lib/utils/slot-helpers.d.ts +9 -0
- package/src/lib/utils/slot-helpers.js +21 -0
- package/src/lib/utils/special-columns.utils.d.ts +6 -0
- package/src/lib/utils/special-columns.utils.js +52 -0
- package/src/lib/utils/styling-helpers.d.ts +36 -0
- package/src/lib/utils/styling-helpers.js +61 -0
- package/src/lib/utils/table-helpers.d.ts +9 -0
- package/{lib → src/lib}/utils/table-helpers.js +16 -31
- package/tsconfig.tsbuildinfo +1 -0
- package/LICENSE +0 -21
- package/index.d.ts.map +0 -1
- package/lib/components/droupdown/menu-dropdown.d.ts.map +0 -1
- package/lib/components/droupdown/menu-dropdown.js +0 -47
- package/lib/components/export-progress-dialog.d.ts.map +0 -1
- package/lib/components/export-progress-dialog.js +0 -30
- package/lib/components/filters/filter-value-input.d.ts.map +0 -1
- package/lib/components/filters/filter-value-input.js +0 -64
- package/lib/components/filters/index.d.ts.map +0 -1
- package/lib/components/headers/draggable-header.d.ts.map +0 -1
- package/lib/components/headers/index.d.ts.map +0 -1
- package/lib/components/headers/table-header.d.ts.map +0 -1
- package/lib/components/headers/table-header.js +0 -59
- package/lib/components/index.d.ts.map +0 -1
- package/lib/components/index.js +0 -18
- package/lib/components/pagination/data-table-pagination.d.ts.map +0 -1
- package/lib/components/pagination/data-table-pagination.js +0 -24
- package/lib/components/pagination/index.d.ts.map +0 -1
- package/lib/components/pagination/index.js +0 -4
- package/lib/components/rows/data-table-row.d.ts.map +0 -1
- package/lib/components/rows/data-table-row.js +0 -42
- package/lib/components/rows/empty-data-row.d.ts.map +0 -1
- package/lib/components/rows/empty-data-row.js +0 -8
- package/lib/components/rows/index.d.ts.map +0 -1
- package/lib/components/rows/loading-rows.d.ts.map +0 -1
- package/lib/components/rows/loading-rows.js +0 -46
- package/lib/components/table/data-table.d.ts.map +0 -1
- package/lib/components/table/data-table.js +0 -663
- package/lib/components/table/data-table.types.d.ts.map +0 -1
- package/lib/components/table/data-table.types.js +0 -6
- package/lib/components/table/index.d.ts.map +0 -1
- package/lib/components/toolbar/bulk-actions-toolbar.d.ts.map +0 -1
- package/lib/components/toolbar/bulk-actions-toolbar.js +0 -31
- package/lib/components/toolbar/column-custom-filter-control.d.ts.map +0 -1
- package/lib/components/toolbar/column-custom-filter-control.js +0 -149
- package/lib/components/toolbar/column-custum-filter-control.d.ts.map +0 -1
- package/lib/components/toolbar/column-custum-filter-control.js +0 -150
- package/lib/components/toolbar/column-pinning-control.d.ts.map +0 -1
- package/lib/components/toolbar/column-pinning-control.js +0 -103
- package/lib/components/toolbar/column-reset-control.d.ts.map +0 -1
- package/lib/components/toolbar/column-reset-control.js +0 -13
- package/lib/components/toolbar/column-visibility-control.d.ts.map +0 -1
- package/lib/components/toolbar/column-visibility-control.js +0 -27
- package/lib/components/toolbar/data-table-toolbar.d.ts.map +0 -1
- package/lib/components/toolbar/data-table-toolbar.js +0 -23
- package/lib/components/toolbar/index.d.ts.map +0 -1
- package/lib/components/toolbar/table-export-control.d.ts.map +0 -1
- package/lib/components/toolbar/table-export-control.js +0 -94
- package/lib/components/toolbar/table-search-control.d.ts.map +0 -1
- package/lib/components/toolbar/table-search-control.js +0 -61
- package/lib/components/toolbar/table-size-control.d.ts.map +0 -1
- package/lib/components/toolbar/table-size-control.js +0 -33
- package/lib/contexts/data-table-context.d.ts.map +0 -1
- package/lib/examples/advanced-features-example.d.ts.map +0 -1
- package/lib/examples/advanced-features-example.js +0 -282
- package/lib/examples/basic-example.d.ts.map +0 -1
- package/lib/examples/basic-example.js +0 -323
- package/lib/examples/bulk-actions-test.d.ts.map +0 -1
- package/lib/examples/bulk-actions-test.js +0 -47
- package/lib/examples/crud-api-example.d.ts.map +0 -1
- package/lib/examples/crud-api-example.js +0 -321
- package/lib/examples/custom-column-filter-example.d.ts.map +0 -1
- package/lib/examples/custom-selection-example.d.ts.map +0 -1
- package/lib/examples/custom-selection-example.js +0 -184
- package/lib/examples/export-callbacks-example.d.ts.map +0 -1
- package/lib/examples/export-callbacks-example.js +0 -155
- package/lib/examples/improved-export-example.d.ts.map +0 -1
- package/lib/examples/improved-export-example.js +0 -153
- package/lib/examples/improved-server-selection-example.d.ts.map +0 -1
- package/lib/examples/improved-server-selection-example.js +0 -118
- package/lib/examples/index.d.ts.map +0 -1
- package/lib/examples/selection-test-example.d.ts.map +0 -1
- package/lib/examples/selection-test-example.js +0 -111
- package/lib/examples/simple-local-example.d.ts.map +0 -1
- package/lib/examples/simple-server-selection-example.d.ts.map +0 -1
- package/lib/examples/simple-server-selection-example.js +0 -178
- package/lib/examples/virtualized-example.d.ts.map +0 -1
- package/lib/examples/virtualized-example.js +0 -119
- package/lib/features/custom-column-filter.feature.d.ts.map +0 -1
- package/lib/features/custom-selection.feature.d.ts.map +0 -1
- package/lib/features/index.d.ts.map +0 -1
- package/lib/features/index.js +0 -9
- package/lib/hooks/index.d.ts.map +0 -1
- package/lib/hooks/index.js +0 -6
- package/lib/hooks/use-data-table-api.d.ts.map +0 -1
- package/lib/hooks/use-table-state.d.ts.map +0 -1
- package/lib/hooks/use-table-state.js +0 -74
- package/lib/icons/add-icon.d.ts.map +0 -1
- package/lib/icons/add-icon.js +0 -5
- package/lib/icons/csv-icon.d.ts.map +0 -1
- package/lib/icons/csv-icon.js +0 -5
- package/lib/icons/delete-icon.d.ts.map +0 -1
- package/lib/icons/delete-icon.js +0 -5
- package/lib/icons/excel-icon.d.ts.map +0 -1
- package/lib/icons/excel-icon.js +0 -5
- package/lib/icons/index.d.ts.map +0 -1
- package/lib/icons/unpin-icon.d.ts.map +0 -1
- package/lib/icons/unpin-icon.js +0 -5
- package/lib/icons/view-comfortable-icon.d.ts.map +0 -1
- package/lib/icons/view-comfortable-icon.js +0 -5
- package/lib/icons/view-compact-icon.d.ts.map +0 -1
- package/lib/icons/view-compact-icon.js +0 -5
- package/lib/types/column.types.d.ts.map +0 -1
- package/lib/types/column.types.js +0 -2
- package/lib/types/data-table-api.d.ts.map +0 -1
- package/lib/types/data-table-api.js +0 -1
- package/lib/types/export.types.d.ts.map +0 -1
- package/lib/types/export.types.js +0 -5
- package/lib/types/hooks.types.d.ts.map +0 -1
- package/lib/types/hooks.types.js +0 -1
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/index.js +0 -14
- package/lib/types/slots.types.d.ts.map +0 -1
- package/lib/types/slots.types.js +0 -1
- package/lib/types/table.types.d.ts.map +0 -1
- package/lib/types/table.types.js +0 -1
- package/lib/utils/column-helpers.d.ts.map +0 -1
- package/lib/utils/column-helpers.js +0 -46
- package/lib/utils/debounced-fetch.utils.d.ts.map +0 -1
- package/lib/utils/export-utils.d.ts.map +0 -1
- package/lib/utils/export-utils.js +0 -181
- package/lib/utils/index.d.ts.map +0 -1
- package/lib/utils/selection-helpers.d.ts.map +0 -1
- package/lib/utils/selection-helpers.js +0 -162
- package/lib/utils/slot-helpers.d.ts.map +0 -1
- package/lib/utils/slot-helpers.js +0 -27
- package/lib/utils/special-columns.utils.d.ts.map +0 -1
- package/lib/utils/special-columns.utils.js +0 -77
- package/lib/utils/styling-helpers.d.ts.map +0 -1
- package/lib/utils/styling-helpers.js +0 -97
- package/lib/utils/table-helpers.d.ts.map +0 -1
- package/lib/utils/value-helpers.d.ts.map +0 -1
- package/lib/utils/value-helpers.js +0 -48
- package/tsconfig.lib.tsbuildinfo +0 -1
- /package/{lib/examples/index.js → src/lib/examples/index.d.ts} +0 -0
- /package/{lib/icons/index.js → src/lib/icons/index.d.ts} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"table.types.d.ts","sourceRoot":"","sources":["../../../src/lib/types/table.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG/D;;;GAGG;AAEH;;GAEG;AAEH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAI3C,MAAM,WAAW,UAAU;IACvB,mBAAmB,EAAE,uBAAuB,CAAC;IAC7C,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,UAAU,CAAC,EAAE;QACT,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE;QACZ,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;IACF,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,YAAY;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,uBAAuB,CAAC;IAC7C,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,EAAE;QACR,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,EAAE;QACX,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;CACL;AAED,MAAM,WAAW,oBAAoB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,mBAAmB,CAAC,EAAE,uBAAuB,CAAC;CACjD;AAED,MAAM,WAAW,uBAAuB;IACpC,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAEpB,cAAc,EAAE,gBAAgB,EAAE,CAAC;IACnC,YAAY,EAAE,KAAK,GAAG,IAAI,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,IAAI,CAAC;CACtB"}
|
package/lib/types/table.types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"column-helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/column-helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG/C,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEvF;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,UAAU,CAMtE;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,GAAG,CAG1E;AAGD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,GAAG,EAAE,CAsBpE;AAGD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,OAAO,CAQjF"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get the type of a column from its metadata
|
|
3
|
-
*/
|
|
4
|
-
export function getColumnType(column) {
|
|
5
|
-
// Check if column has explicit type in columnDef
|
|
6
|
-
if (column?.columnDef?.type) {
|
|
7
|
-
return column.columnDef.type;
|
|
8
|
-
}
|
|
9
|
-
return 'text'; // Default to text
|
|
10
|
-
}
|
|
11
|
-
export function getCustomFilterComponent(column) {
|
|
12
|
-
// Check if column has custom filter component in meta
|
|
13
|
-
return column?.columnDef?.filterComponent || column?.columnDef?.editComponent;
|
|
14
|
-
}
|
|
15
|
-
export function getColumnOptions(column) {
|
|
16
|
-
// Check if column has explicit options in meta
|
|
17
|
-
if (column?.columnDef?.options) {
|
|
18
|
-
return column?.columnDef.options || [];
|
|
19
|
-
}
|
|
20
|
-
// Default options for boolean type
|
|
21
|
-
const columnType = getColumnType(column);
|
|
22
|
-
if (columnType === 'boolean') {
|
|
23
|
-
return [
|
|
24
|
-
{
|
|
25
|
-
value: true,
|
|
26
|
-
label: 'Yes',
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
value: false,
|
|
30
|
-
label: 'No',
|
|
31
|
-
},
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
return [];
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Determine if a column should be filterable
|
|
38
|
-
*/
|
|
39
|
-
export function isColumnFilterable(column) {
|
|
40
|
-
// Check if column is explicitly marked as filterable
|
|
41
|
-
if (column?.filterable !== undefined) {
|
|
42
|
-
return column?.filterable;
|
|
43
|
-
}
|
|
44
|
-
// Default to filterable for data columns
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debounced-fetch.utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/debounced-fetch.utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAGhD,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3D,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC;IAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,GAAG,SAAS,EACnG,KAAK,SAAM;8BAMwC,oBAAoB;cAWxC,CAAC,EAAE;eAAS,MAAM;;;EAsCpD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"export-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/export-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAGtE,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,KAAK,GAAG,OAAO,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAClG,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACzF,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAChE;AAGD,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACtD,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,cAAc,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClG,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,SAAS,CAAC,EAAE,cAAc,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EACxC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,EACnB,OAAO,EAAE,aAAa,GACvB,OAAO,CAAC,IAAI,CAAC,CAwDf;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EACxC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,EACnB,OAAO,EAAE,mBAAmB,GAC7B,OAAO,CAAC,IAAI,CAAC,CA4Ef"}
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import * as XLSX from 'xlsx';
|
|
2
|
-
/**
|
|
3
|
-
* Export data for client-side tables
|
|
4
|
-
* - If rows are selected, export only selected rows
|
|
5
|
-
* - Otherwise export all filtered/visible rows
|
|
6
|
-
* - Only export visible columns
|
|
7
|
-
*/
|
|
8
|
-
export async function exportClientData(table, options) {
|
|
9
|
-
const { format, filename, onProgress, onComplete, onError } = options;
|
|
10
|
-
try {
|
|
11
|
-
// Get selected rows if any are selected
|
|
12
|
-
// const selectedRowIds = Object.keys(table.getState().rowSelection).filter(
|
|
13
|
-
// key => table.getState().rowSelection[key]
|
|
14
|
-
// );
|
|
15
|
-
// const hasSelectedRows = selectedRowIds.length > 0;
|
|
16
|
-
// // Get the rows to export
|
|
17
|
-
// const rowsToExport = hasSelectedRows ? table.getSelectedRowModel().rows : table.getFilteredRowModel().rows;
|
|
18
|
-
const selectedRows = table.getSelectedRows ? table.getSelectedRows() : [];
|
|
19
|
-
const hasSelectedRows = selectedRows.length > 0;
|
|
20
|
-
const rowsToExport = hasSelectedRows ? selectedRows : table.getFilteredRowModel().rows;
|
|
21
|
-
// Prepare data for export - just get all visible columns and their values
|
|
22
|
-
const exportData = rowsToExport.map((row, index) => {
|
|
23
|
-
onProgress?.({
|
|
24
|
-
processedRows: index + 1,
|
|
25
|
-
totalRows: rowsToExport.length,
|
|
26
|
-
percentage: Math.round(((index + 1) / rowsToExport.length) * 100),
|
|
27
|
-
});
|
|
28
|
-
const rowData = {};
|
|
29
|
-
// Get all visible cells for this row
|
|
30
|
-
row.getVisibleCells().forEach(cell => {
|
|
31
|
-
const header = typeof cell.column.columnDef.header === 'string'
|
|
32
|
-
? cell.column.columnDef.header
|
|
33
|
-
: cell.column.id;
|
|
34
|
-
// Use getValue() - it already handles all formatting
|
|
35
|
-
rowData[header] = cell.getValue() || '';
|
|
36
|
-
});
|
|
37
|
-
return rowData;
|
|
38
|
-
});
|
|
39
|
-
// Export the data
|
|
40
|
-
await exportToFile(exportData, format, filename);
|
|
41
|
-
onComplete?.({
|
|
42
|
-
success: true,
|
|
43
|
-
filename: `${filename}.${format === 'excel' ? 'xlsx' : 'csv'}`,
|
|
44
|
-
totalRows: exportData.length,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
console.error('Client export failed:', error);
|
|
49
|
-
onError?.({
|
|
50
|
-
message: error instanceof Error ? error.message : 'Export failed',
|
|
51
|
-
code: 'CLIENT_EXPORT_ERROR',
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Export data for server-side tables
|
|
57
|
-
* - Fetch data using provided fetchData function
|
|
58
|
-
* - Pass selection information to server for filtering
|
|
59
|
-
* - Export all returned data (server handles selection/filtering)
|
|
60
|
-
*/
|
|
61
|
-
export async function exportServerData(table, options) {
|
|
62
|
-
const { format, filename, fetchData, currentFilters, selection, onProgress, onComplete, onError } = options;
|
|
63
|
-
try {
|
|
64
|
-
onProgress?.({
|
|
65
|
-
processedRows: 0,
|
|
66
|
-
totalRows: 0,
|
|
67
|
-
percentage: 0,
|
|
68
|
-
});
|
|
69
|
-
// Fetch data from server with selection information
|
|
70
|
-
const { data } = await fetchData(currentFilters, selection);
|
|
71
|
-
if (!data || !Array.isArray(data)) {
|
|
72
|
-
throw new Error('Invalid data received from server');
|
|
73
|
-
}
|
|
74
|
-
// Get visible columns for proper headers and data processing
|
|
75
|
-
const visibleColumns = table.getVisibleLeafColumns().filter(col => col.getIsVisible());
|
|
76
|
-
// Prepare data for export with proper column processing
|
|
77
|
-
const exportData = data.map((rowData, index) => {
|
|
78
|
-
onProgress?.({
|
|
79
|
-
processedRows: index + 1,
|
|
80
|
-
totalRows: data.length,
|
|
81
|
-
percentage: Math.round(((index + 1) / data.length) * 100),
|
|
82
|
-
});
|
|
83
|
-
const exportRow = {};
|
|
84
|
-
visibleColumns.forEach(column => {
|
|
85
|
-
const columnId = column.id;
|
|
86
|
-
const header = typeof column.columnDef.header === 'string'
|
|
87
|
-
? column.columnDef.header
|
|
88
|
-
: columnId;
|
|
89
|
-
// Get value from raw data
|
|
90
|
-
let value = rowData[columnId];
|
|
91
|
-
// Apply accessorFn if defined
|
|
92
|
-
const columnDef = column.columnDef;
|
|
93
|
-
if (columnDef.accessorFn && typeof columnDef.accessorFn === 'function') {
|
|
94
|
-
value = columnDef.accessorFn(rowData);
|
|
95
|
-
}
|
|
96
|
-
// Convert to string for export
|
|
97
|
-
if (value === null || value === undefined) {
|
|
98
|
-
value = '';
|
|
99
|
-
}
|
|
100
|
-
else if (typeof value === 'object') {
|
|
101
|
-
value = JSON.stringify(value);
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
value = String(value);
|
|
105
|
-
}
|
|
106
|
-
exportRow[header] = value;
|
|
107
|
-
});
|
|
108
|
-
return exportRow;
|
|
109
|
-
});
|
|
110
|
-
// Export the data
|
|
111
|
-
await exportToFile(exportData, format, filename);
|
|
112
|
-
onComplete?.({
|
|
113
|
-
success: true,
|
|
114
|
-
filename: `${filename}.${format === 'excel' ? 'xlsx' : 'csv'}`,
|
|
115
|
-
totalRows: exportData.length,
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
catch (error) {
|
|
119
|
-
console.error('Server export failed:', error);
|
|
120
|
-
onError?.({
|
|
121
|
-
message: error instanceof Error ? error.message : 'Export failed',
|
|
122
|
-
code: 'SERVER_EXPORT_ERROR',
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Export data to file (CSV or Excel)
|
|
128
|
-
*/
|
|
129
|
-
async function exportToFile(data, format, filename) {
|
|
130
|
-
if (data.length === 0) {
|
|
131
|
-
throw new Error('No data to export');
|
|
132
|
-
}
|
|
133
|
-
if (format === 'csv') {
|
|
134
|
-
const csv = convertToCSV(data);
|
|
135
|
-
downloadFile(csv, `${filename}.csv`, 'text/csv');
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
const workbook = XLSX.utils.book_new();
|
|
139
|
-
const worksheet = XLSX.utils.json_to_sheet(data);
|
|
140
|
-
XLSX.utils.book_append_sheet(workbook, worksheet, 'Data');
|
|
141
|
-
const excelBuffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });
|
|
142
|
-
const blob = new Blob([excelBuffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
|
143
|
-
downloadFile(blob, `${filename}.xlsx`, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Convert data to CSV format
|
|
148
|
-
*/
|
|
149
|
-
function convertToCSV(data) {
|
|
150
|
-
if (data.length === 0)
|
|
151
|
-
return '';
|
|
152
|
-
const headers = Object.keys(data[0]);
|
|
153
|
-
const csvRows = [headers.join(',')];
|
|
154
|
-
for (const row of data) {
|
|
155
|
-
const values = headers.map(header => {
|
|
156
|
-
const value = row[header] || '';
|
|
157
|
-
// Escape quotes and wrap in quotes if contains comma or quote
|
|
158
|
-
if (typeof value === 'string' && (value.includes(',') || value.includes('"') || value.includes('\n'))) {
|
|
159
|
-
return `"${value.replace(/"/g, '""')}"`;
|
|
160
|
-
}
|
|
161
|
-
return value;
|
|
162
|
-
});
|
|
163
|
-
csvRows.push(values.join(','));
|
|
164
|
-
}
|
|
165
|
-
return csvRows.join('\n');
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Download file to user's device
|
|
169
|
-
*/
|
|
170
|
-
function downloadFile(content, filename, mimeType) {
|
|
171
|
-
const blob = content instanceof Blob ? content : new Blob([content], { type: mimeType });
|
|
172
|
-
const url = URL.createObjectURL(blob);
|
|
173
|
-
const link = document.createElement('a');
|
|
174
|
-
link.href = url;
|
|
175
|
-
link.download = filename;
|
|
176
|
-
link.style.display = 'none';
|
|
177
|
-
document.body.appendChild(link);
|
|
178
|
-
link.click();
|
|
179
|
-
document.body.removeChild(link);
|
|
180
|
-
URL.revokeObjectURL(url);
|
|
181
|
-
}
|
package/lib/utils/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,cAAc,mBAAmB,CAAC;AAGlC,cAAc,iBAAiB,CAAC;AAGhC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,gBAAgB,CAAC;AAG/B,cAAc,yBAAyB,CAAC;AAGxC,cAAc,yBAAyB,CAAC;AAGxC,cAAc,gBAAgB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"selection-helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/selection-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE,MAAM,WAAW,qBAAqB;IAClC,UAAU,EAAE,MAAM,GAAG,KAAK,CAAC;IAC3B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,sBAAsB,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAC7B,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EACf,MAAM,EAAE,qBAAqB,GAC9B,IAAI,CAgCN;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EACvB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EACf,MAAM,EAAE,qBAAqB,GAC9B,IAAI,CAiBN;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EACzB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EACf,MAAM,EAAE,qBAAqB,GAC9B,IAAI,CAMN;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAChC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,qBAAqB,EAC7B,QAAQ,CAAC,EAAC,OAAO,GAClB,IAAI,CAeN;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC3B,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EACf,MAAM,EAAE,qBAAqB,GAC9B,OAAO,CAeT;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC1B,MAAM,CAAC,EAAE,qBAAqB,GAC/B,OAAO,CAYT;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,qBAAqB,GAC9B,OAAO,CAaT;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAC9B,MAAM,EAAE,qBAAqB,GAC9B,MAAM,CAUR"}
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Selection Helper Utilities
|
|
3
|
-
*
|
|
4
|
-
* Common selection logic that can be shared between the API hook and selection column
|
|
5
|
-
* to avoid dependency on API reference in selection column
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Toggle select all logic
|
|
9
|
-
*/
|
|
10
|
-
export function toggleSelectAll(table, config) {
|
|
11
|
-
const { selectMode, selectionState, onSelectionStateChange } = config;
|
|
12
|
-
const isSomeSelect = isSomeSelected(config);
|
|
13
|
-
const isAllSelect = isAllSelected(table, config);
|
|
14
|
-
if (selectMode === 'all') {
|
|
15
|
-
let type;
|
|
16
|
-
if (!isAllSelect && isSomeSelect) {
|
|
17
|
-
type = 'include';
|
|
18
|
-
}
|
|
19
|
-
else if (selectionState?.type === 'include') {
|
|
20
|
-
type = 'exclude';
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
type = 'include';
|
|
24
|
-
}
|
|
25
|
-
onSelectionStateChange({
|
|
26
|
-
ids: [],
|
|
27
|
-
type,
|
|
28
|
-
});
|
|
29
|
-
// Clear TanStack Table selections
|
|
30
|
-
table.toggleAllRowsSelected(false);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
// For 'page' mode: toggle current page selection
|
|
34
|
-
const currentPageRows = table.getPaginationRowModel().rows;
|
|
35
|
-
const isCurrentPageAllSelected = currentPageRows.every(row => selectionState?.ids.includes(row.id));
|
|
36
|
-
onSelectionStateChange({
|
|
37
|
-
ids: isCurrentPageAllSelected ? [] : currentPageRows.map(row => row.id),
|
|
38
|
-
type: 'include',
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Select all logic
|
|
44
|
-
*/
|
|
45
|
-
export function selectAll(table, config) {
|
|
46
|
-
const { selectMode, onSelectionStateChange } = config;
|
|
47
|
-
if (selectMode === 'all') {
|
|
48
|
-
// For 'all' mode: exclude nothing (select all)
|
|
49
|
-
onSelectionStateChange({
|
|
50
|
-
ids: [],
|
|
51
|
-
type: 'include',
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
// For 'page' mode: include current page rows
|
|
56
|
-
const currentPageRows = table.getPaginationRowModel().rows;
|
|
57
|
-
onSelectionStateChange({
|
|
58
|
-
ids: currentPageRows.map(row => row.id),
|
|
59
|
-
type: 'include',
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Deselect all logic
|
|
65
|
-
*/
|
|
66
|
-
export function deselectAll(table, config) {
|
|
67
|
-
const { onSelectionStateChange } = config;
|
|
68
|
-
onSelectionStateChange({
|
|
69
|
-
ids: [],
|
|
70
|
-
type: 'include',
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Toggle individual row selection
|
|
75
|
-
*/
|
|
76
|
-
export function toggleRowSelection(rowId, config, isSelect) {
|
|
77
|
-
const { selectionState, onSelectionStateChange } = config;
|
|
78
|
-
let ids = selectionState?.ids || [];
|
|
79
|
-
const hasRowId = ids.includes(rowId);
|
|
80
|
-
if (isSelect === undefined) {
|
|
81
|
-
ids = hasRowId ? ids.filter(id => id !== rowId) : [...ids, rowId];
|
|
82
|
-
}
|
|
83
|
-
else if (isSelect === true && !hasRowId) {
|
|
84
|
-
ids = [...ids, rowId];
|
|
85
|
-
}
|
|
86
|
-
else if (isSelect === false && hasRowId) {
|
|
87
|
-
ids = ids.filter(id => id !== rowId);
|
|
88
|
-
}
|
|
89
|
-
onSelectionStateChange({
|
|
90
|
-
ids,
|
|
91
|
-
type: selectionState?.type || 'include',
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Check if all rows are selected
|
|
96
|
-
*/
|
|
97
|
-
export function isAllSelected(table, config) {
|
|
98
|
-
const { selectMode, selectionState } = config;
|
|
99
|
-
if (!selectionState) {
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
if (selectMode === 'all') {
|
|
103
|
-
if (selectionState.type === 'exclude') {
|
|
104
|
-
return selectionState.ids.length === 0;
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
return selectionState.ids.length === table.getRowCount();
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
const currentPageRows = table.getPaginationRowModel().rows;
|
|
112
|
-
return currentPageRows.every(row => selectionState?.ids.includes(row.id));
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Check if some rows are selected (indeterminate state)
|
|
117
|
-
*/
|
|
118
|
-
export function isSomeSelected(config) {
|
|
119
|
-
const { selectMode, selectionState } = config;
|
|
120
|
-
if (selectMode === 'all') {
|
|
121
|
-
if (!selectionState) {
|
|
122
|
-
return false;
|
|
123
|
-
}
|
|
124
|
-
return (selectionState.type === 'exclude' && selectionState.ids?.length > 0) ||
|
|
125
|
-
(selectionState.type === 'include' && selectionState.ids?.length > 0);
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
return selectionState?.ids?.length > 0;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Check if a specific row is selected
|
|
133
|
-
*/
|
|
134
|
-
export function isRowSelected(rowId, config) {
|
|
135
|
-
const { selectMode, selectionState } = config;
|
|
136
|
-
if (!selectionState) {
|
|
137
|
-
return false;
|
|
138
|
-
}
|
|
139
|
-
if (selectMode === 'all' && selectionState?.type === 'exclude') {
|
|
140
|
-
// all selection mode
|
|
141
|
-
return !selectionState.ids.includes(rowId);
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
// In individual mode, selected only if included
|
|
145
|
-
return selectionState.ids.includes(rowId);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Get selected row count
|
|
150
|
-
*/
|
|
151
|
-
export function getSelectedCount(config) {
|
|
152
|
-
const { selectMode, selectionState, totalRow } = config;
|
|
153
|
-
if (!selectionState) {
|
|
154
|
-
return 0;
|
|
155
|
-
}
|
|
156
|
-
if (selectMode === 'all' && selectionState.type === 'exclude') {
|
|
157
|
-
return (totalRow || 0) - selectionState.ids.length;
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
return selectionState.ids.length;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slot-helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/slot-helpers.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,cAAc,CAAC,CAAC,CAAC,EACjE,KAAK,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,EAC7C,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,aAAa,CAAC,GAAG,CAAC,GAC7B,aAAa,CAAC,GAAG,CAAC,CAEpB;AAED;;GAEG;AACH,wBAAgB,UAAU,CACtB,aAAa,EAAE,aAAa,CAAC,GAAG,CAAC,EACjC,YAAY,EAAE,GAAG,EACjB,SAAS,CAAC,EAAE,GAAG,2CASlB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,cAAc,CAAC,CAAC,CAAC,EACzE,QAAQ,EAAE,CAAC,EACX,gBAAgB,EAAE,aAAa,CAAC,GAAG,CAAC,IAED,OAAO;IACtC,KAAK,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,cAAc,EAAE,GAAG,CAAC;CACvB,6CAaJ"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* Get slot component or fallback to default
|
|
4
|
-
*/
|
|
5
|
-
export function getSlotComponent(slots, slotName, fallback) {
|
|
6
|
-
return slots?.[slotName] || fallback;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Render a slot component with merged props
|
|
10
|
-
*/
|
|
11
|
-
export function renderSlot(slotComponent, defaultProps, slotProps) {
|
|
12
|
-
const mergedProps = {
|
|
13
|
-
...defaultProps,
|
|
14
|
-
...slotProps,
|
|
15
|
-
};
|
|
16
|
-
const Component = slotComponent;
|
|
17
|
-
return _jsx(Component, { ...mergedProps });
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Higher-order component factory for creating slottable components
|
|
21
|
-
*/
|
|
22
|
-
export function createSlottableComponent(slotName, defaultComponent) {
|
|
23
|
-
return function SlottableComponent(props) {
|
|
24
|
-
const SlotComponent = getSlotComponent(props.slots, slotName, defaultComponent);
|
|
25
|
-
return renderSlot(SlotComponent, props.componentProps, props.slotProps?.[slotName]);
|
|
26
|
-
};
|
|
27
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"special-columns.utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/special-columns.utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAgE,MAAM,UAAU,CAAC;AAEzG;;GAEG;AACH,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACpC,WAAW,CAAC,EAAE,OAAO,CAAC;CAEzB;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,EAAE,QAAQ,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAAC,KAAG,eAAe,CAAC,CAAC,CAoDzH,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,EAAE,QAAQ,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,KAAG,eAAe,CAAC,CAAC,CAiB9F,CAAC"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { KeyboardArrowDownOutlined, KeyboardArrowUpOutlined } from '@mui/icons-material';
|
|
2
|
-
import { Checkbox, IconButton } from '@mui/material';
|
|
3
|
-
import { createElement } from 'react';
|
|
4
|
-
import { DEFAULT_EXPANDING_COLUMN_NAME, DEFAULT_SELECTION_COLUMN_NAME } from '../types';
|
|
5
|
-
/**
|
|
6
|
-
* Creates a default selection column using TanStack Table custom feature methods
|
|
7
|
-
*/
|
|
8
|
-
export const createSelectionColumn = (config) => ({
|
|
9
|
-
id: DEFAULT_SELECTION_COLUMN_NAME,
|
|
10
|
-
size: 60,
|
|
11
|
-
align: 'center',
|
|
12
|
-
filterable: false,
|
|
13
|
-
enableResizing: false,
|
|
14
|
-
enableSorting: false,
|
|
15
|
-
enableHiding: false,
|
|
16
|
-
enablePinning: false,
|
|
17
|
-
hideInExport: true,
|
|
18
|
-
header: ({ table }) => {
|
|
19
|
-
if (!config.multiSelect)
|
|
20
|
-
return null;
|
|
21
|
-
// Use TanStack Table custom feature methods (same pattern as TanStack documentation)
|
|
22
|
-
const allSelected = table.getIsAllRowsSelected?.() || false;
|
|
23
|
-
const someSelected = table.getIsSomeRowsSelected?.() || false;
|
|
24
|
-
return createElement(Checkbox, {
|
|
25
|
-
checked: allSelected,
|
|
26
|
-
indeterminate: someSelected && !allSelected,
|
|
27
|
-
disabled: false,
|
|
28
|
-
onChange: () => {
|
|
29
|
-
table.toggleAllRowsSelected?.();
|
|
30
|
-
},
|
|
31
|
-
size: 'small',
|
|
32
|
-
sx: { p: 0 },
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
cell: ({ row, table }) => {
|
|
36
|
-
const rowId = row.id;
|
|
37
|
-
// Use TanStack Table custom feature methods (same pattern as TanStack documentation)
|
|
38
|
-
const checked = table.getIsRowSelected?.(rowId) || false;
|
|
39
|
-
const canSelect = table.canSelectRow?.(rowId) ?? true;
|
|
40
|
-
return createElement(Checkbox, {
|
|
41
|
-
checked,
|
|
42
|
-
disabled: !canSelect,
|
|
43
|
-
onChange: () => {
|
|
44
|
-
if (canSelect) {
|
|
45
|
-
table.toggleRowSelected?.(rowId);
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
size: 'small',
|
|
49
|
-
sx: {
|
|
50
|
-
p: 0,
|
|
51
|
-
opacity: canSelect ? 1 : 0.5
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
...config,
|
|
56
|
-
});
|
|
57
|
-
/**
|
|
58
|
-
* Creates a default expanding column
|
|
59
|
-
*/
|
|
60
|
-
export const createExpandingColumn = (config) => ({
|
|
61
|
-
id: DEFAULT_EXPANDING_COLUMN_NAME,
|
|
62
|
-
size: 60,
|
|
63
|
-
align: 'center',
|
|
64
|
-
filterable: false,
|
|
65
|
-
enableResizing: false,
|
|
66
|
-
enableSorting: false,
|
|
67
|
-
enableHiding: false,
|
|
68
|
-
enablePinning: false,
|
|
69
|
-
hideInExport: true,
|
|
70
|
-
header: '',
|
|
71
|
-
cell: ({ row }) => createElement(IconButton, {
|
|
72
|
-
onClick: row.getToggleExpandedHandler(),
|
|
73
|
-
size: 'small',
|
|
74
|
-
sx: { p: 0 },
|
|
75
|
-
}, row.getIsExpanded() ? createElement(KeyboardArrowUpOutlined) : createElement(KeyboardArrowDownOutlined)),
|
|
76
|
-
...config,
|
|
77
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styling-helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/styling-helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAqB1E;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,wBAAwB;;;;;;;;;;EAmDrE;AAED;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;CAUlB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;CAWjB,CAAC;AAEX;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAG7F"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Styling utilities for DataTable components
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Generate box shadow for pinned columns using subtle theme-compatible shadows
|
|
6
|
-
* Only shows shadow on the trailing edge of pinned columns
|
|
7
|
-
*/
|
|
8
|
-
const getBoxShadow = (isPinned, isLastLeftPinnedColumn, isFirstRightPinnedColumn) => {
|
|
9
|
-
if (isPinned === 'left' && isLastLeftPinnedColumn) {
|
|
10
|
-
// Subtle shadow on right side of left-pinned column
|
|
11
|
-
return '1px 0 3px rgba(0, 0, 0, 0.12)';
|
|
12
|
-
}
|
|
13
|
-
if (isPinned === 'right' && isFirstRightPinnedColumn) {
|
|
14
|
-
// Subtle shadow on left side of right-pinned column
|
|
15
|
-
return '-1px 0 3px rgba(0, 0, 0, 0.12)';
|
|
16
|
-
}
|
|
17
|
-
return 'none';
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Generate consistent styling for pinned columns
|
|
21
|
-
*/
|
|
22
|
-
export function getPinnedColumnStyle(options) {
|
|
23
|
-
const { width = 'auto', isPinned, pinnedPosition, pinnedRightPosition, isLastLeftPinnedColumn, isFirstRightPinnedColumn, zIndex = 1, disableStickyHeader = false, } = options;
|
|
24
|
-
// Pinned columns should ALWAYS be sticky, regardless of enableStickyHeader setting
|
|
25
|
-
const needsPinnedPositioning = isPinned;
|
|
26
|
-
const shouldBeSticky = isPinned; // Pinned columns are always sticky
|
|
27
|
-
// Position logic
|
|
28
|
-
let positionStyle = {};
|
|
29
|
-
if (shouldBeSticky) {
|
|
30
|
-
// Pinned columns must always be sticky
|
|
31
|
-
positionStyle = { position: 'sticky' };
|
|
32
|
-
}
|
|
33
|
-
else if (!disableStickyHeader) {
|
|
34
|
-
// Non-pinned columns: only sticky when enableStickyHeader is false
|
|
35
|
-
positionStyle = { position: 'relative' };
|
|
36
|
-
}
|
|
37
|
-
// When disableStickyHeader is true and column is not pinned, let Table handle stickiness
|
|
38
|
-
return {
|
|
39
|
-
// Width constraints - more strict for narrow columns
|
|
40
|
-
width,
|
|
41
|
-
maxWidth: width,
|
|
42
|
-
overflow: 'hidden',
|
|
43
|
-
whiteSpace: 'nowrap',
|
|
44
|
-
// Position handling
|
|
45
|
-
...positionStyle,
|
|
46
|
-
// Pinned positioning (works with both sticky modes)
|
|
47
|
-
...(needsPinnedPositioning ? {
|
|
48
|
-
left: isPinned === 'left' ? pinnedPosition : undefined,
|
|
49
|
-
right: isPinned === 'right' ? pinnedRightPosition : undefined,
|
|
50
|
-
zIndex,
|
|
51
|
-
} : {}),
|
|
52
|
-
// Background handling for pinned columns - simpler approach
|
|
53
|
-
...(isPinned && {
|
|
54
|
-
// Use theme background as fallback, but allow inheritance from parent
|
|
55
|
-
backgroundColor: 'background.paper',
|
|
56
|
-
}),
|
|
57
|
-
// Box shadow only on trailing edge with subtle shadows
|
|
58
|
-
boxShadow: getBoxShadow(isPinned, !!isLastLeftPinnedColumn, !!isFirstRightPinnedColumn),
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Common table cell styling
|
|
63
|
-
*/
|
|
64
|
-
export const tableCellStyles = {
|
|
65
|
-
sticky: {
|
|
66
|
-
position: 'sticky',
|
|
67
|
-
zIndex: 10,
|
|
68
|
-
backgroundColor: 'background.paper',
|
|
69
|
-
},
|
|
70
|
-
pinned: {
|
|
71
|
-
borderRight: '1px solid',
|
|
72
|
-
borderColor: 'divider',
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* Common table row styling
|
|
77
|
-
*/
|
|
78
|
-
export const tableRowStyles = {
|
|
79
|
-
hover: {
|
|
80
|
-
'&:hover': {
|
|
81
|
-
backgroundColor: 'action.hover',
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
striped: {
|
|
85
|
-
'&:nth-of-type(odd)': {
|
|
86
|
-
backgroundColor: 'action.selected',
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* Get text alignment style from column metadata
|
|
92
|
-
*/
|
|
93
|
-
export function getColumnAlignment(column) {
|
|
94
|
-
if (!column)
|
|
95
|
-
return 'left';
|
|
96
|
-
return column.align || 'left';
|
|
97
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"table-helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/table-helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG7C,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE/C;;GAEG;AACH,wBAAgB,qBAAqB,CACjC,eAAe,EAAE,MAAM,EACvB,SAAS,EAAE,MAAM,EACjB,OAAO,SAAK,GACb,MAAM,CAGR;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,GAAG,MAAM,CAK/E;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACvC,OAAO,EAAE,GAAG,EAAE,EACd,IAAI,EAAE,MAAM,GAAG,OAAO,GACvB,MAAM,CAIR;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAChC,WAAW,EAAE,OAAO,EACpB,oBAAoB,EAAE,OAAO,EAC7B,YAAY,EAAE,MAAM,GACrB,OAAO,CAET;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAehE;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACtD,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,MAAM,GACb,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAMlC;AAED;;GAEG;AAEH,wBAAgB,qBAAqB,CACjC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,GAAG,EAAE,EACd,eAAe,EAAE,MAAM,GACxB,YAAY,CAOd"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"value-helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/value-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,oBAAoB,GAAG,GAAG,CAqB9D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,oBAAoB,GAAG,GAAG,CAGnE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,KAEtB,2BAA2B,GAAG,SAOzC"}
|