@multiplatform.one/table 7.10.0 → 7.15.0
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/README.md +61 -1
- package/dist/cjs/components/ChildTable/index.cjs +8 -2
- package/dist/cjs/components/ChildTable/index.native.js +8 -2
- package/dist/cjs/components/ChildTable/index.native.js.map +1 -1
- package/dist/cjs/components/ColumnHeaderFilter/index.cjs +77 -111
- package/dist/cjs/components/ColumnHeaderFilter/index.native.js +89 -129
- package/dist/cjs/components/ColumnHeaderFilter/index.native.js.map +1 -1
- package/dist/cjs/components/DataTable/DataTableCardControls.cjs +90 -54
- package/dist/cjs/components/DataTable/DataTableCardControls.native.js +93 -56
- package/dist/cjs/components/DataTable/DataTableCardControls.native.js.map +1 -1
- package/dist/cjs/components/DataTable/DataTableRoot.cjs +68 -9
- package/dist/cjs/components/DataTable/DataTableRoot.native.js +78 -11
- package/dist/cjs/components/DataTable/DataTableRoot.native.js.map +1 -1
- package/dist/cjs/components/DataTableCell/CellModalEditor.cjs +72 -70
- package/dist/cjs/components/DataTableCell/index.cjs +2 -2
- package/dist/cjs/components/DataTableCell/index.native.js +2 -11
- package/dist/cjs/components/DataTableCell/index.native.js.map +1 -1
- package/dist/cjs/components/DataTableDateFilter/index.cjs +135 -158
- package/dist/cjs/components/DataTableDateFilter/index.native.js +153 -183
- package/dist/cjs/components/DataTableDateFilter/index.native.js.map +1 -1
- package/dist/cjs/components/DataTableExport/index.cjs +122 -139
- package/dist/cjs/components/DataTableExport/index.native.js +135 -157
- package/dist/cjs/components/DataTableExport/index.native.js.map +1 -1
- package/dist/cjs/components/DataTableFilterButton/index.cjs +14 -0
- package/dist/cjs/components/DataTableFilterButton/index.native.js +15 -0
- package/dist/cjs/components/DataTableFilterButton/index.native.js.map +1 -1
- package/dist/cjs/components/DataTableGrouping/index.cjs +192 -212
- package/dist/cjs/components/DataTableGrouping/index.native.js +209 -230
- package/dist/cjs/components/DataTableGrouping/index.native.js.map +1 -1
- package/dist/cjs/components/DataTableSearch/index.cjs +103 -115
- package/dist/cjs/components/DataTableSearch/index.native.js +111 -123
- package/dist/cjs/components/DataTableSearch/index.native.js.map +1 -1
- package/dist/cjs/components/DataTableToolbar/index.cjs +161 -101
- package/dist/cjs/components/DataTableToolbar/index.native.js +168 -109
- package/dist/cjs/components/DataTableToolbar/index.native.js.map +1 -1
- package/dist/cjs/components/DataTableViewOptions/index.cjs +38 -54
- package/dist/cjs/components/DataTableViewOptions/index.native.js +40 -56
- package/dist/cjs/components/DataTableViewOptions/index.native.js.map +1 -1
- package/dist/cjs/components/FilterOperatorValueEditor/index.cjs +3 -11
- package/dist/cjs/components/FilterOperatorValueEditor/index.native.js +3 -11
- package/dist/cjs/components/FilterOperatorValueEditor/index.native.js.map +1 -1
- package/dist/cjs/components/SimpleTable/index.cjs +2 -6
- package/dist/cjs/components/SimpleTable/index.native.js +2 -6
- package/dist/cjs/components/SimpleTable/index.native.js.map +1 -1
- package/dist/cjs/components/TableInput/RowDetailEditor.cjs +190 -0
- package/dist/cjs/components/TableInput/RowDetailEditor.native.js +172 -0
- package/dist/cjs/components/TableInput/RowDetailEditor.native.js.map +1 -0
- package/dist/cjs/components/TableInput/index.cjs +42 -5
- package/dist/cjs/components/TableInput/index.native.js +64 -1
- package/dist/cjs/components/TableInput/index.native.js.map +1 -1
- package/dist/cjs/components/TableInput/shared.cjs +8 -0
- package/dist/cjs/components/TableInput/shared.native.js +10 -0
- package/dist/cjs/components/TableInput/shared.native.js.map +1 -1
- package/dist/cjs/hooks/useDataTable.cjs +43 -2
- package/dist/cjs/hooks/useDataTable.native.js +49 -3
- package/dist/cjs/hooks/useDataTable.native.js.map +1 -1
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/utils/rowPress.cjs +4 -1
- package/dist/cjs/utils/rowPress.native.js +4 -1
- package/dist/cjs/utils/rowPress.native.js.map +1 -1
- package/dist/esm/components/ChildTable/index.mjs +8 -2
- package/dist/esm/components/ChildTable/index.mjs.map +1 -1
- package/dist/esm/components/ChildTable/index.native.js +8 -2
- package/dist/esm/components/ChildTable/index.native.js.map +1 -1
- package/dist/esm/components/ColumnHeaderFilter/index.mjs +80 -114
- package/dist/esm/components/ColumnHeaderFilter/index.mjs.map +1 -1
- package/dist/esm/components/ColumnHeaderFilter/index.native.js +92 -132
- package/dist/esm/components/ColumnHeaderFilter/index.native.js.map +1 -1
- package/dist/esm/components/DataTable/DataTableCardControls.mjs +89 -54
- package/dist/esm/components/DataTable/DataTableCardControls.mjs.map +1 -1
- package/dist/esm/components/DataTable/DataTableCardControls.native.js +92 -56
- package/dist/esm/components/DataTable/DataTableCardControls.native.js.map +1 -1
- package/dist/esm/components/DataTable/DataTableRoot.mjs +70 -11
- package/dist/esm/components/DataTable/DataTableRoot.mjs.map +1 -1
- package/dist/esm/components/DataTable/DataTableRoot.native.js +80 -13
- package/dist/esm/components/DataTable/DataTableRoot.native.js.map +1 -1
- package/dist/esm/components/DataTableCell/CellModalEditor.mjs +76 -74
- package/dist/esm/components/DataTableCell/CellModalEditor.mjs.map +1 -1
- package/dist/esm/components/DataTableCell/index.mjs +3 -3
- package/dist/esm/components/DataTableCell/index.mjs.map +1 -1
- package/dist/esm/components/DataTableCell/index.native.js +3 -12
- package/dist/esm/components/DataTableCell/index.native.js.map +1 -1
- package/dist/esm/components/DataTableDateFilter/index.mjs +137 -160
- package/dist/esm/components/DataTableDateFilter/index.mjs.map +1 -1
- package/dist/esm/components/DataTableDateFilter/index.native.js +155 -185
- package/dist/esm/components/DataTableDateFilter/index.native.js.map +1 -1
- package/dist/esm/components/DataTableExport/index.mjs +124 -141
- package/dist/esm/components/DataTableExport/index.mjs.map +1 -1
- package/dist/esm/components/DataTableExport/index.native.js +137 -159
- package/dist/esm/components/DataTableExport/index.native.js.map +1 -1
- package/dist/esm/components/DataTableFilterButton/index.mjs +14 -1
- package/dist/esm/components/DataTableFilterButton/index.mjs.map +1 -1
- package/dist/esm/components/DataTableFilterButton/index.native.js +15 -1
- package/dist/esm/components/DataTableFilterButton/index.native.js.map +1 -1
- package/dist/esm/components/DataTableGrouping/index.mjs +194 -214
- package/dist/esm/components/DataTableGrouping/index.mjs.map +1 -1
- package/dist/esm/components/DataTableGrouping/index.native.js +211 -232
- package/dist/esm/components/DataTableGrouping/index.native.js.map +1 -1
- package/dist/esm/components/DataTableSearch/index.mjs +105 -117
- package/dist/esm/components/DataTableSearch/index.mjs.map +1 -1
- package/dist/esm/components/DataTableSearch/index.native.js +113 -125
- package/dist/esm/components/DataTableSearch/index.native.js.map +1 -1
- package/dist/esm/components/DataTableToolbar/index.mjs +165 -106
- package/dist/esm/components/DataTableToolbar/index.mjs.map +1 -1
- package/dist/esm/components/DataTableToolbar/index.native.js +172 -114
- package/dist/esm/components/DataTableToolbar/index.native.js.map +1 -1
- package/dist/esm/components/DataTableViewOptions/index.mjs +40 -56
- package/dist/esm/components/DataTableViewOptions/index.mjs.map +1 -1
- package/dist/esm/components/DataTableViewOptions/index.native.js +42 -58
- package/dist/esm/components/DataTableViewOptions/index.native.js.map +1 -1
- package/dist/esm/components/FilterOperatorValueEditor/index.mjs +3 -11
- package/dist/esm/components/FilterOperatorValueEditor/index.mjs.map +1 -1
- package/dist/esm/components/FilterOperatorValueEditor/index.native.js +3 -11
- package/dist/esm/components/FilterOperatorValueEditor/index.native.js.map +1 -1
- package/dist/esm/components/SimpleTable/index.mjs +3 -7
- package/dist/esm/components/SimpleTable/index.mjs.map +1 -1
- package/dist/esm/components/SimpleTable/index.native.js +3 -7
- package/dist/esm/components/SimpleTable/index.native.js.map +1 -1
- package/dist/esm/components/TableInput/RowDetailEditor.mjs +165 -0
- package/dist/esm/components/TableInput/RowDetailEditor.mjs.map +1 -0
- package/dist/esm/components/TableInput/RowDetailEditor.native.js +144 -0
- package/dist/esm/components/TableInput/RowDetailEditor.native.js.map +1 -0
- package/dist/esm/components/TableInput/index.mjs +42 -5
- package/dist/esm/components/TableInput/index.mjs.map +1 -1
- package/dist/esm/components/TableInput/index.native.js +64 -1
- package/dist/esm/components/TableInput/index.native.js.map +1 -1
- package/dist/esm/components/TableInput/shared.mjs +7 -1
- package/dist/esm/components/TableInput/shared.mjs.map +1 -1
- package/dist/esm/components/TableInput/shared.native.js +9 -1
- package/dist/esm/components/TableInput/shared.native.js.map +1 -1
- package/dist/esm/hooks/useDataTable.mjs +43 -2
- package/dist/esm/hooks/useDataTable.mjs.map +1 -1
- package/dist/esm/hooks/useDataTable.native.js +49 -3
- package/dist/esm/hooks/useDataTable.native.js.map +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/utils/rowPress.mjs +4 -1
- package/dist/esm/utils/rowPress.mjs.map +1 -1
- package/dist/esm/utils/rowPress.native.js +4 -1
- package/dist/esm/utils/rowPress.native.js.map +1 -1
- package/dist/jsx/components/ChildTable/index.mjs +8 -2
- package/dist/jsx/components/ChildTable/index.mjs.map +1 -1
- package/dist/jsx/components/ChildTable/index.native.js +8 -2
- package/dist/jsx/components/ChildTable/index.native.js.map +1 -1
- package/dist/jsx/components/ColumnHeaderFilter/index.mjs +80 -114
- package/dist/jsx/components/ColumnHeaderFilter/index.mjs.map +1 -1
- package/dist/jsx/components/ColumnHeaderFilter/index.native.js +89 -129
- package/dist/jsx/components/ColumnHeaderFilter/index.native.js.map +1 -1
- package/dist/jsx/components/DataTable/DataTableCardControls.mjs +89 -54
- package/dist/jsx/components/DataTable/DataTableCardControls.mjs.map +1 -1
- package/dist/jsx/components/DataTable/DataTableCardControls.native.js +93 -56
- package/dist/jsx/components/DataTable/DataTableCardControls.native.js.map +1 -1
- package/dist/jsx/components/DataTable/DataTableRoot.mjs +70 -11
- package/dist/jsx/components/DataTable/DataTableRoot.mjs.map +1 -1
- package/dist/jsx/components/DataTable/DataTableRoot.native.js +78 -11
- package/dist/jsx/components/DataTable/DataTableRoot.native.js.map +1 -1
- package/dist/jsx/components/DataTableCell/CellModalEditor.mjs +76 -74
- package/dist/jsx/components/DataTableCell/CellModalEditor.mjs.map +1 -1
- package/dist/jsx/components/DataTableCell/index.mjs +3 -3
- package/dist/jsx/components/DataTableCell/index.mjs.map +1 -1
- package/dist/jsx/components/DataTableCell/index.native.js +2 -11
- package/dist/jsx/components/DataTableCell/index.native.js.map +1 -1
- package/dist/jsx/components/DataTableDateFilter/index.mjs +137 -160
- package/dist/jsx/components/DataTableDateFilter/index.mjs.map +1 -1
- package/dist/jsx/components/DataTableDateFilter/index.native.js +153 -183
- package/dist/jsx/components/DataTableDateFilter/index.native.js.map +1 -1
- package/dist/jsx/components/DataTableExport/index.mjs +124 -141
- package/dist/jsx/components/DataTableExport/index.mjs.map +1 -1
- package/dist/jsx/components/DataTableExport/index.native.js +135 -157
- package/dist/jsx/components/DataTableExport/index.native.js.map +1 -1
- package/dist/jsx/components/DataTableFilterButton/index.mjs +14 -1
- package/dist/jsx/components/DataTableFilterButton/index.mjs.map +1 -1
- package/dist/jsx/components/DataTableFilterButton/index.native.js +15 -0
- package/dist/jsx/components/DataTableFilterButton/index.native.js.map +1 -1
- package/dist/jsx/components/DataTableGrouping/index.mjs +194 -214
- package/dist/jsx/components/DataTableGrouping/index.mjs.map +1 -1
- package/dist/jsx/components/DataTableGrouping/index.native.js +209 -230
- package/dist/jsx/components/DataTableGrouping/index.native.js.map +1 -1
- package/dist/jsx/components/DataTableSearch/index.mjs +105 -117
- package/dist/jsx/components/DataTableSearch/index.mjs.map +1 -1
- package/dist/jsx/components/DataTableSearch/index.native.js +111 -123
- package/dist/jsx/components/DataTableSearch/index.native.js.map +1 -1
- package/dist/jsx/components/DataTableToolbar/index.mjs +165 -106
- package/dist/jsx/components/DataTableToolbar/index.mjs.map +1 -1
- package/dist/jsx/components/DataTableToolbar/index.native.js +168 -109
- package/dist/jsx/components/DataTableToolbar/index.native.js.map +1 -1
- package/dist/jsx/components/DataTableViewOptions/index.mjs +40 -56
- package/dist/jsx/components/DataTableViewOptions/index.mjs.map +1 -1
- package/dist/jsx/components/DataTableViewOptions/index.native.js +40 -56
- package/dist/jsx/components/DataTableViewOptions/index.native.js.map +1 -1
- package/dist/jsx/components/FilterOperatorValueEditor/index.mjs +3 -11
- package/dist/jsx/components/FilterOperatorValueEditor/index.mjs.map +1 -1
- package/dist/jsx/components/FilterOperatorValueEditor/index.native.js +3 -11
- package/dist/jsx/components/FilterOperatorValueEditor/index.native.js.map +1 -1
- package/dist/jsx/components/SimpleTable/index.mjs +3 -7
- package/dist/jsx/components/SimpleTable/index.mjs.map +1 -1
- package/dist/jsx/components/SimpleTable/index.native.js +2 -6
- package/dist/jsx/components/SimpleTable/index.native.js.map +1 -1
- package/dist/jsx/components/TableInput/RowDetailEditor.mjs +165 -0
- package/dist/jsx/components/TableInput/RowDetailEditor.mjs.map +1 -0
- package/dist/jsx/components/TableInput/RowDetailEditor.native.js +172 -0
- package/dist/jsx/components/TableInput/RowDetailEditor.native.js.map +1 -0
- package/dist/jsx/components/TableInput/index.mjs +42 -5
- package/dist/jsx/components/TableInput/index.mjs.map +1 -1
- package/dist/jsx/components/TableInput/index.native.js +64 -1
- package/dist/jsx/components/TableInput/index.native.js.map +1 -1
- package/dist/jsx/components/TableInput/shared.mjs +7 -1
- package/dist/jsx/components/TableInput/shared.mjs.map +1 -1
- package/dist/jsx/components/TableInput/shared.native.js +10 -0
- package/dist/jsx/components/TableInput/shared.native.js.map +1 -1
- package/dist/jsx/hooks/useDataTable.mjs +43 -2
- package/dist/jsx/hooks/useDataTable.mjs.map +1 -1
- package/dist/jsx/hooks/useDataTable.native.js +49 -3
- package/dist/jsx/hooks/useDataTable.native.js.map +1 -1
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/utils/rowPress.mjs +4 -1
- package/dist/jsx/utils/rowPress.mjs.map +1 -1
- package/dist/jsx/utils/rowPress.native.js +4 -1
- package/dist/jsx/utils/rowPress.native.js.map +1 -1
- package/package.json +16 -16
- package/src/components/ChildTable/childTable.cellHidden.spec.tsx +57 -0
- package/src/components/ChildTable/childTable.rowDetail.spec.tsx +120 -0
- package/src/components/ChildTable/index.tsx +16 -0
- package/src/components/ColumnHeaderFilter/index.tsx +89 -116
- package/src/components/DataTable/DataTable.stories.tsx +130 -6
- package/src/components/DataTable/DataTableCardControls.stories.tsx +61 -2
- package/src/components/DataTable/DataTableCardControls.tsx +92 -66
- package/src/components/DataTable/DataTableRoot.tsx +109 -18
- package/src/components/DataTable/cardLayout.spec.tsx +4 -3
- package/src/components/DataTable/cardToolbar.spec.tsx +238 -0
- package/src/components/DataTable/chromeInterplay.spec.tsx +7 -5
- package/src/components/DataTable/columnWidthLayout.spec.tsx +189 -0
- package/src/components/DataTable/dataTableCardControls.spec.tsx +3 -2
- package/src/components/DataTable/dataTableMobileCards.spec.tsx +1 -4
- package/src/components/DataTable/footerLayout.spec.tsx +250 -0
- package/src/components/DataTable/headerContainment.spec.tsx +91 -0
- package/src/components/DataTable/pinningGeometry.spec.tsx +66 -1
- package/src/components/DataTable/rowPress.spec.tsx +2 -6
- package/src/components/DataTableBulkActions/DataTableBulkActions.stories.tsx +5 -4
- package/src/components/DataTableCell/CellModalEditor.tsx +95 -75
- package/src/components/DataTableCell/cellDraftPolicy.spec.tsx +12 -2
- package/src/components/DataTableCell/cellModalEditor.spec.tsx +75 -49
- package/src/components/DataTableCell/dataTableCell.spec.tsx +31 -14
- package/src/components/DataTableCell/index.tsx +3 -2
- package/src/components/DataTableDateFilter/DataTableDateFilter.spec.tsx +6 -3
- package/src/components/DataTableDateFilter/index.tsx +151 -180
- package/src/components/DataTableExport/DataTableExport.spec.tsx +42 -18
- package/src/components/DataTableExport/index.tsx +135 -142
- package/src/components/DataTableFilterButton/index.tsx +9 -0
- package/src/components/DataTableGrouping/index.tsx +193 -195
- package/src/components/DataTableSearch/index.tsx +111 -109
- package/src/components/DataTableToolbar/index.tsx +179 -107
- package/src/components/DataTableViewOptions/DataTableViewOptions.stories.tsx +52 -0
- package/src/components/DataTableViewOptions/index.tsx +32 -40
- package/src/components/FilterOperatorValueEditor/FilterOperatorValueEditor.spec.tsx +64 -2
- package/src/components/FilterOperatorValueEditor/index.tsx +0 -8
- package/src/components/SimpleTable/index.tsx +3 -2
- package/src/components/SimpleTable/simpleTable.spec.tsx +15 -0
- package/src/components/Table/accessibility.spec.tsx +7 -19
- package/src/components/TableInput/RowDetailEditor.native.tsx +134 -0
- package/src/components/TableInput/RowDetailEditor.tsx +173 -0
- package/src/components/TableInput/index.native.tsx +49 -1
- package/src/components/TableInput/index.tsx +65 -10
- package/src/components/TableInput/shared.ts +29 -0
- package/src/components/tableDropdowns.spec.tsx +172 -0
- package/src/hooks/useDataTable.spec.ts +153 -0
- package/src/hooks/useDataTable.ts +38 -2
- package/src/index.ts +1 -0
- package/src/types.ts +14 -12
- package/src/utils/rowPress.ts +3 -0
- package/types/components/ChildTable/index.d.ts +10 -0
- package/types/components/ChildTable/index.d.ts.map +1 -1
- package/types/components/ColumnHeaderFilter/index.d.ts +1 -1
- package/types/components/ColumnHeaderFilter/index.d.ts.map +1 -1
- package/types/components/DataTable/DataTableCardControls.d.ts +3 -0
- package/types/components/DataTable/DataTableCardControls.d.ts.map +1 -1
- package/types/components/DataTable/DataTableRoot.d.ts.map +1 -1
- package/types/components/DataTableCell/CellModalEditor.d.ts +10 -7
- package/types/components/DataTableCell/CellModalEditor.d.ts.map +1 -1
- package/types/components/DataTableCell/index.d.ts.map +1 -1
- package/types/components/DataTableDateFilter/index.d.ts.map +1 -1
- package/types/components/DataTableFilterButton/index.d.ts +2 -1
- package/types/components/DataTableFilterButton/index.d.ts.map +1 -1
- package/types/components/DataTableGrouping/index.d.ts.map +1 -1
- package/types/components/DataTableSearch/index.d.ts.map +1 -1
- package/types/components/DataTableToolbar/index.d.ts +1 -0
- package/types/components/DataTableToolbar/index.d.ts.map +1 -1
- package/types/components/FilterOperatorValueEditor/index.d.ts.map +1 -1
- package/types/components/SimpleTable/index.d.ts.map +1 -1
- package/types/components/TableInput/RowDetailEditor.d.ts +24 -0
- package/types/components/TableInput/RowDetailEditor.d.ts.map +1 -0
- package/types/components/TableInput/RowDetailEditor.native.d.ts +11 -0
- package/types/components/TableInput/RowDetailEditor.native.d.ts.map +1 -0
- package/types/components/TableInput/index.d.ts +11 -2
- package/types/components/TableInput/index.d.ts.map +1 -1
- package/types/components/TableInput/index.native.d.ts +8 -1
- package/types/components/TableInput/index.native.d.ts.map +1 -1
- package/types/components/TableInput/shared.d.ts +11 -0
- package/types/components/TableInput/shared.d.ts.map +1 -1
- package/types/hooks/useDataTable.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/types.d.ts +14 -12
- package/types/types.d.ts.map +1 -1
- package/types/utils/rowPress.d.ts.map +1 -1
|
@@ -43,7 +43,7 @@ import type {
|
|
|
43
43
|
} from "../../types";
|
|
44
44
|
import { DataTableColumnPinning } from "../DataTableColumnPinning";
|
|
45
45
|
import { DataTablePagination } from "../DataTablePagination";
|
|
46
|
-
import { DataTableToolbar } from "../DataTableToolbar";
|
|
46
|
+
import { DataTableCardToolbar, DataTableToolbar } from "../DataTableToolbar";
|
|
47
47
|
import { DataTableBulkActions } from "../DataTableBulkActions";
|
|
48
48
|
import { DataTableCell } from "../DataTableCell";
|
|
49
49
|
import { ColumnHeaderFilter } from "../ColumnHeaderFilter";
|
|
@@ -56,7 +56,7 @@ import type {
|
|
|
56
56
|
DataTableStateContextValue,
|
|
57
57
|
FilterEditTarget,
|
|
58
58
|
} from "./DataTableStateContext";
|
|
59
|
-
import { DataTableCardControls } from "./DataTableCardControls";
|
|
59
|
+
import { DataTableCardControls, DataTableCardSortControl } from "./DataTableCardControls";
|
|
60
60
|
import { DataTableMobileCards } from "./DataTableMobileCards";
|
|
61
61
|
import { DataTableDocumentList } from "./DataTableDocumentList";
|
|
62
62
|
import { DataTableVirtualized } from "./DataTableVirtualized";
|
|
@@ -334,6 +334,7 @@ export function DataTableRoot<TData extends Record<string, any> = Record<string,
|
|
|
334
334
|
flexBasis: "auto" as const,
|
|
335
335
|
};
|
|
336
336
|
}
|
|
337
|
+
if (columnLayout === "equal" && !enableColumnResizing) return {};
|
|
337
338
|
// Scroll layout needs one concrete width per column (from the column
|
|
338
339
|
// def, TanStack default otherwise) so independent flex rows stay
|
|
339
340
|
// aligned while the table grows past its container.
|
|
@@ -461,13 +462,13 @@ export function DataTableRoot<TData extends Record<string, any> = Record<string,
|
|
|
461
462
|
// flexBasis auto, not the `flex: 0` shorthand: RN expands `flex: 0` to
|
|
462
463
|
// basis 0, which overrides per-column widths and crushes every cell to
|
|
463
464
|
// the minWidth floor (contents then overflow and get clipped).
|
|
464
|
-
return { flexGrow: 0, flexShrink: 0, flexBasis: "auto" as const, minWidth:
|
|
465
|
+
return { flexGrow: 0, flexShrink: 0, flexBasis: "auto" as const, minWidth: 0 };
|
|
465
466
|
}
|
|
466
467
|
// Same flexBasis trap as the scroll branch above: `flex: 0` expands to
|
|
467
468
|
// basis 0 and the per-column width from getColSizeProps loses, crushing
|
|
468
469
|
// every resizable cell to the min-width floor (content then overlaps).
|
|
469
470
|
if (enableColumnResizing) {
|
|
470
|
-
return { flexGrow: 0, flexShrink: 0, flexBasis: "auto" as const };
|
|
471
|
+
return { flexGrow: 0, flexShrink: 0, flexBasis: "auto" as const, minWidth: 0 };
|
|
471
472
|
}
|
|
472
473
|
return { flex: 1, flexShrink: 1, flexGrow: 1, flexBasis: 0, minWidth: 0 };
|
|
473
474
|
}, [isFlexLayout, columnLayout, enableColumnResizing]);
|
|
@@ -1124,6 +1125,12 @@ export function DataTableRoot<TData extends Record<string, any> = Record<string,
|
|
|
1124
1125
|
[table, state, actions, computed, selectAllScope, filterUi],
|
|
1125
1126
|
);
|
|
1126
1127
|
|
|
1128
|
+
const hasCardSort =
|
|
1129
|
+
showCards &&
|
|
1130
|
+
enableSorting &&
|
|
1131
|
+
table.getVisibleLeafColumns().some((column) => column.getCanSort());
|
|
1132
|
+
const defaultCardToolbar = showCards && !renderToolbar;
|
|
1133
|
+
const ToolbarComponent = defaultCardToolbar ? DataTableCardToolbar : DataTableToolbar;
|
|
1127
1134
|
const renderToolbarComponent = () => {
|
|
1128
1135
|
const activeFilterCount = table.getState().columnFilters?.length || 0;
|
|
1129
1136
|
|
|
@@ -1143,10 +1150,20 @@ export function DataTableRoot<TData extends Record<string, any> = Record<string,
|
|
|
1143
1150
|
}
|
|
1144
1151
|
|
|
1145
1152
|
return (
|
|
1146
|
-
<
|
|
1153
|
+
<ToolbarComponent
|
|
1147
1154
|
globalFilter={state.globalFilter || ""}
|
|
1148
1155
|
onGlobalFilterChange={actions.setGlobalFilter}
|
|
1149
1156
|
onClearFilters={actions.clearFilters}
|
|
1157
|
+
customActions={
|
|
1158
|
+
defaultCardToolbar && hasCardSort ? (
|
|
1159
|
+
<DataTableCardSortControl
|
|
1160
|
+
table={table}
|
|
1161
|
+
compact={isCompact}
|
|
1162
|
+
disabled={disabled}
|
|
1163
|
+
contained
|
|
1164
|
+
/>
|
|
1165
|
+
) : undefined
|
|
1166
|
+
}
|
|
1150
1167
|
activeFilterCount={activeFilterCount}
|
|
1151
1168
|
onSaveView={actions.saveView}
|
|
1152
1169
|
onLoadView={actions.loadView}
|
|
@@ -1192,7 +1209,8 @@ export function DataTableRoot<TData extends Record<string, any> = Record<string,
|
|
|
1192
1209
|
newValue: any,
|
|
1193
1210
|
) => Promise<void>,
|
|
1194
1211
|
) => {
|
|
1195
|
-
const hasToolbar =
|
|
1212
|
+
const hasToolbar =
|
|
1213
|
+
enableGlobalSearch || enableFiltering || enableViews || (defaultCardToolbar && hasCardSort);
|
|
1196
1214
|
const scrollContainerRef = useRef<HTMLDivElement>(null);
|
|
1197
1215
|
|
|
1198
1216
|
// DF-12 / Axiom 6 HONEST STATE — a height-constrained body clips rows
|
|
@@ -1347,14 +1365,16 @@ export function DataTableRoot<TData extends Record<string, any> = Record<string,
|
|
|
1347
1365
|
<>
|
|
1348
1366
|
{/* Header affordances (sort / per-column filter) live in the
|
|
1349
1367
|
grid headers; the card list restores them here. */}
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1368
|
+
{!defaultCardToolbar && (
|
|
1369
|
+
<DataTableCardControls
|
|
1370
|
+
table={table}
|
|
1371
|
+
enableSorting={enableSorting}
|
|
1372
|
+
enableFiltering={enableFiltering}
|
|
1373
|
+
availableColumns={cardFilterColumns}
|
|
1374
|
+
compact={isCompact}
|
|
1375
|
+
disabled={disabled}
|
|
1376
|
+
/>
|
|
1377
|
+
)}
|
|
1358
1378
|
<DataTableMobileCards
|
|
1359
1379
|
tableRows={displayRows}
|
|
1360
1380
|
enableRowSelection={enableRowSelection}
|
|
@@ -1638,21 +1658,39 @@ export function DataTableRoot<TData extends Record<string, any> = Record<string,
|
|
|
1638
1658
|
}
|
|
1639
1659
|
: {})}
|
|
1640
1660
|
>
|
|
1661
|
+
{/* LC-10 (MPO-336): only the label yields
|
|
1662
|
+
to a narrow column; the glyphs keep their
|
|
1663
|
+
size or they paint into the next one. The
|
|
1664
|
+
filter cluster wraps under the label first,
|
|
1665
|
+
so the label keeps the column's width. */}
|
|
1641
1666
|
<View
|
|
1642
1667
|
flexDirection="row"
|
|
1668
|
+
flexWrap="wrap"
|
|
1643
1669
|
gap="$2"
|
|
1644
1670
|
alignItems="center"
|
|
1645
1671
|
justifyContent={isRightAligned ? "flex-end" : "space-between"}
|
|
1646
1672
|
flex={1}
|
|
1673
|
+
minWidth={0}
|
|
1647
1674
|
>
|
|
1648
1675
|
<View
|
|
1649
1676
|
flexDirection="row"
|
|
1650
1677
|
gap="$2"
|
|
1651
1678
|
alignItems="center"
|
|
1652
|
-
|
|
1679
|
+
flexGrow={isRightAligned ? 0 : 1}
|
|
1680
|
+
flexShrink={1}
|
|
1681
|
+
flexBasis="auto"
|
|
1682
|
+
minWidth={0}
|
|
1653
1683
|
justifyContent={isRightAligned ? "flex-end" : undefined}
|
|
1654
1684
|
>
|
|
1655
|
-
<Text
|
|
1685
|
+
<Text
|
|
1686
|
+
fontSize={knobProps.sizeToken}
|
|
1687
|
+
userSelect="none"
|
|
1688
|
+
flexShrink={1}
|
|
1689
|
+
minWidth={0}
|
|
1690
|
+
textAlign={isRightAligned ? "right" : undefined}
|
|
1691
|
+
data-header-label=""
|
|
1692
|
+
{...(isWeb ? { style: { overflowWrap: "anywhere" } } : {})}
|
|
1693
|
+
>
|
|
1656
1694
|
{header.isPlaceholder
|
|
1657
1695
|
? null
|
|
1658
1696
|
: flexRender(
|
|
@@ -1670,7 +1708,7 @@ export function DataTableRoot<TData extends Record<string, any> = Record<string,
|
|
|
1670
1708
|
: t("Click to sort (Shift+click for multi-sort)")
|
|
1671
1709
|
}
|
|
1672
1710
|
>
|
|
1673
|
-
<View aria-hidden={true} role="presentation">
|
|
1711
|
+
<View aria-hidden={true} role="presentation" flexShrink={0}>
|
|
1674
1712
|
{sortDirection === "asc" && (
|
|
1675
1713
|
<CaretDownIcon
|
|
1676
1714
|
size={chrome.iconPx}
|
|
@@ -1694,7 +1732,12 @@ export function DataTableRoot<TData extends Record<string, any> = Record<string,
|
|
|
1694
1732
|
</Tooltip>
|
|
1695
1733
|
)}
|
|
1696
1734
|
</View>
|
|
1697
|
-
<View
|
|
1735
|
+
<View
|
|
1736
|
+
flexDirection="row"
|
|
1737
|
+
gap="$1"
|
|
1738
|
+
alignItems="center"
|
|
1739
|
+
flexShrink={0}
|
|
1740
|
+
>
|
|
1698
1741
|
{enableFiltering && header.column.getCanFilter() && (
|
|
1699
1742
|
<ColumnHeaderFilter
|
|
1700
1743
|
columnId={header.column.id}
|
|
@@ -2085,7 +2128,31 @@ export function DataTableRoot<TData extends Record<string, any> = Record<string,
|
|
|
2085
2128
|
<Table.Foot>
|
|
2086
2129
|
{footerGroups.map((footerGroup: any) => (
|
|
2087
2130
|
<Table.Row key={footerGroup.id}>
|
|
2131
|
+
{enableRowSelection && (
|
|
2132
|
+
<Table.Cell
|
|
2133
|
+
cellWidth={selectionColWidth}
|
|
2134
|
+
cellHeight={cellHeight as any}
|
|
2135
|
+
cellLocation="first"
|
|
2136
|
+
/>
|
|
2137
|
+
)}
|
|
2138
|
+
{showRowNumbers && (
|
|
2139
|
+
<Table.Cell
|
|
2140
|
+
cellWidth={chrome.rowNumberCol}
|
|
2141
|
+
cellHeight={cellHeight as any}
|
|
2142
|
+
cellLocation={enableRowSelection ? "middle" : "first"}
|
|
2143
|
+
/>
|
|
2144
|
+
)}
|
|
2145
|
+
{enableRowExpansion && (
|
|
2146
|
+
<Table.Cell
|
|
2147
|
+
cellWidth={chrome.expandCol}
|
|
2148
|
+
cellHeight={cellHeight as any}
|
|
2149
|
+
cellLocation={
|
|
2150
|
+
enableRowSelection || showRowNumbers ? "middle" : "first"
|
|
2151
|
+
}
|
|
2152
|
+
/>
|
|
2153
|
+
)}
|
|
2088
2154
|
{footerGroup.headers.map((header: any) => {
|
|
2155
|
+
const stickyStyle = getStickyStyle(header.column.id);
|
|
2089
2156
|
const columnAlign = resolveColumnAlign({
|
|
2090
2157
|
...(header.column.columnDef as DataTableColumn),
|
|
2091
2158
|
id: header.column.id,
|
|
@@ -2093,6 +2160,23 @@ export function DataTableRoot<TData extends Record<string, any> = Record<string,
|
|
|
2093
2160
|
return (
|
|
2094
2161
|
<Table.Cell
|
|
2095
2162
|
key={header.id}
|
|
2163
|
+
{...cellFlexProps}
|
|
2164
|
+
{...getColSizeProps(header.column)}
|
|
2165
|
+
{...(isWeb && stickyStyle
|
|
2166
|
+
? {
|
|
2167
|
+
style: {
|
|
2168
|
+
position: "sticky",
|
|
2169
|
+
...("insetInlineStart" in stickyStyle && {
|
|
2170
|
+
insetInlineStart: stickyStyle.insetInlineStart,
|
|
2171
|
+
}),
|
|
2172
|
+
...("insetInlineEnd" in stickyStyle && {
|
|
2173
|
+
insetInlineEnd: stickyStyle.insetInlineEnd,
|
|
2174
|
+
}),
|
|
2175
|
+
zIndex: 2,
|
|
2176
|
+
backgroundColor: "var(--color2)",
|
|
2177
|
+
} as React.CSSProperties,
|
|
2178
|
+
}
|
|
2179
|
+
: {})}
|
|
2096
2180
|
justifyContent={alignToFlex(columnAlign)}
|
|
2097
2181
|
data-align={columnAlign}
|
|
2098
2182
|
>
|
|
@@ -2115,6 +2199,13 @@ export function DataTableRoot<TData extends Record<string, any> = Record<string,
|
|
|
2115
2199
|
</Table.Cell>
|
|
2116
2200
|
);
|
|
2117
2201
|
})}
|
|
2202
|
+
{showDeleteRow && !readOnly && (
|
|
2203
|
+
<Table.Cell
|
|
2204
|
+
cellWidth={chrome.deleteCol}
|
|
2205
|
+
cellHeight={cellHeight as any}
|
|
2206
|
+
cellLocation="last"
|
|
2207
|
+
/>
|
|
2208
|
+
)}
|
|
2118
2209
|
</Table.Row>
|
|
2119
2210
|
))}
|
|
2120
2211
|
</Table.Foot>
|
|
@@ -283,11 +283,12 @@ describe("DataTable card layout", () => {
|
|
|
283
283
|
expect(titles).toEqual(["John"]);
|
|
284
284
|
});
|
|
285
285
|
|
|
286
|
-
it("renders the
|
|
287
|
-
const {
|
|
286
|
+
it("renders the canonical Filter in card layout", () => {
|
|
287
|
+
const { getByRole, queryByText } = renderWithProviders(
|
|
288
288
|
<DataTable data={sampleData} columns={columns} onStateChange={vi.fn()} />,
|
|
289
289
|
);
|
|
290
|
-
expect(
|
|
290
|
+
expect(getByRole("button", { name: "Filter" })).toBeDefined();
|
|
291
|
+
expect(queryByText("Add Filter")).toBeNull();
|
|
291
292
|
});
|
|
292
293
|
|
|
293
294
|
it("hides sort/filter chrome when sorting and filtering are disabled", () => {
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
2
|
+
import { fireEvent, screen, waitFor, within } from "@testing-library/react";
|
|
3
|
+
import { describe, expect, it, vi } from "vitest";
|
|
4
|
+
import type { DataTableColumn, FilterableField } from "../../types";
|
|
5
|
+
import { DataTableCardToolbar, DataTableToolbar } from "../DataTableToolbar";
|
|
6
|
+
import { DataTableCardSortControl } from "./DataTableCardControls";
|
|
7
|
+
import { useDataTableState } from "./DataTableStateContext";
|
|
8
|
+
import { DataTable } from "./index";
|
|
9
|
+
|
|
10
|
+
const filings = [
|
|
11
|
+
{ id: "a", form: "Alpha", entity: "personal", year: 2023 },
|
|
12
|
+
{ id: "b", form: "Beta", entity: "business", year: 2024 },
|
|
13
|
+
{ id: "c", form: "Gamma", entity: "personal", year: 2023 },
|
|
14
|
+
];
|
|
15
|
+
const columns: DataTableColumn<(typeof filings)[number]>[] = [
|
|
16
|
+
{ accessorKey: "form", header: "Form" },
|
|
17
|
+
{ accessorKey: "entity", header: "Entity" },
|
|
18
|
+
];
|
|
19
|
+
const filterableFields: FilterableField[] = [{ id: "year", label: "Year", type: "number" }];
|
|
20
|
+
|
|
21
|
+
function Cards(props: Record<string, any>) {
|
|
22
|
+
return (
|
|
23
|
+
<DataTable
|
|
24
|
+
data={filings}
|
|
25
|
+
columns={columns}
|
|
26
|
+
filterableFields={filterableFields}
|
|
27
|
+
layout="cards"
|
|
28
|
+
enableGlobalSearch={false}
|
|
29
|
+
onStateChange={vi.fn()}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function cardTitles(container: HTMLElement) {
|
|
36
|
+
return [...container.querySelectorAll('[data-card-slot="title"]')].map((el) => el.textContent);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function AllCardActionsToolbar(props: Record<string, any>) {
|
|
40
|
+
const { table } = useDataTableState()!;
|
|
41
|
+
return (
|
|
42
|
+
<DataTableCardToolbar
|
|
43
|
+
{...props}
|
|
44
|
+
enableExport
|
|
45
|
+
enableViews
|
|
46
|
+
isFetching
|
|
47
|
+
customActions={<DataTableCardSortControl table={table} contained />}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
describe("default card toolbar", () => {
|
|
53
|
+
it("owns Filter and Sort in one primary row with no duplicate controls", () => {
|
|
54
|
+
const { container } = renderWithProviders(<Cards />);
|
|
55
|
+
const toolbar = screen.getByRole("toolbar", { name: "Table toolbar" });
|
|
56
|
+
expect(screen.getAllByRole("toolbar")).toHaveLength(1);
|
|
57
|
+
const primary = container.querySelector<HTMLElement>("[data-table-card-primary]")!;
|
|
58
|
+
expect(toolbar.contains(primary)).toBe(true);
|
|
59
|
+
expect(primary.contains(screen.getByRole("button", { name: "Filter" }))).toBe(true);
|
|
60
|
+
expect(primary.contains(screen.getByLabelText("Sort rows"))).toBe(true);
|
|
61
|
+
expect(screen.queryByText("Add Filter")).toBeNull();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("keeps search and secondary view/fetching controls outside the primary pair", () => {
|
|
65
|
+
const { container } = renderWithProviders(<Cards enableGlobalSearch enableViews isFetching />);
|
|
66
|
+
const primary = container.querySelector<HTMLElement>("[data-table-card-primary]")!;
|
|
67
|
+
const secondary = container.querySelector<HTMLElement>("[data-table-card-secondary]")!;
|
|
68
|
+
expect(primary).not.toBeNull();
|
|
69
|
+
expect(secondary).not.toBeNull();
|
|
70
|
+
expect(primary.contains(screen.getByLabelText("Search table data"))).toBe(false);
|
|
71
|
+
expect(secondary.contains(screen.getByLabelText("Save view"))).toBe(true);
|
|
72
|
+
expect(secondary.querySelector("[data-table-fetching]")).not.toBeNull();
|
|
73
|
+
expect(primary.contains(secondary)).toBe(false);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it("keeps a sort-only toolbar when search, filtering and views are all off", () => {
|
|
77
|
+
renderWithProviders(<Cards enableFiltering={false} enableViews={false} />);
|
|
78
|
+
const toolbar = screen.getByRole("toolbar", { name: "Table toolbar" });
|
|
79
|
+
expect(within(toolbar).getByLabelText("Sort rows")).toBeTruthy();
|
|
80
|
+
expect(screen.queryByRole("button", { name: "Filter" })).toBeNull();
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("does not create an empty toolbar for unsortable columns", () => {
|
|
84
|
+
renderWithProviders(
|
|
85
|
+
<Cards
|
|
86
|
+
enableFiltering={false}
|
|
87
|
+
columns={columns.map((column) => ({ ...column, enableSorting: false }))}
|
|
88
|
+
/>,
|
|
89
|
+
);
|
|
90
|
+
expect(screen.queryByRole("toolbar")).toBeNull();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it("exposes the full active sorting identity without replacing the button label recipe", () => {
|
|
94
|
+
const longHeader = "Form with a deliberately long distinguishing classification suffix";
|
|
95
|
+
renderWithProviders(
|
|
96
|
+
<Cards
|
|
97
|
+
columns={[{ accessorKey: "form", header: longHeader }]}
|
|
98
|
+
initialState={{ sorting: [{ id: "form", desc: true }] }}
|
|
99
|
+
/>,
|
|
100
|
+
);
|
|
101
|
+
const trigger = screen.getByLabelText("Sort rows");
|
|
102
|
+
expect(trigger.getAttribute("aria-description")).toBe(`${longHeader} ↓`);
|
|
103
|
+
expect(trigger.textContent).toContain(`${longHeader} ↓`);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("retains hidden Year filtering, chip edit and removal in readOnly cards", async () => {
|
|
107
|
+
const { container } = renderWithProviders(<Cards readOnly />);
|
|
108
|
+
expect(screen.queryByText("Add Filter")).toBeNull();
|
|
109
|
+
fireEvent.click(screen.getByRole("button", { name: "Filter" }));
|
|
110
|
+
fireEvent.click(await screen.findByRole("option", { name: "Year" }));
|
|
111
|
+
fireEvent.change(await screen.findByPlaceholderText("Enter value..."), {
|
|
112
|
+
target: { value: "2023" },
|
|
113
|
+
});
|
|
114
|
+
await waitFor(() => expect(cardTitles(container)).toEqual(["Alpha", "Gamma"]));
|
|
115
|
+
fireEvent.keyDown(document, { key: "Escape" });
|
|
116
|
+
await waitFor(() => expect(screen.queryByPlaceholderText("Enter value...")).toBeNull());
|
|
117
|
+
fireEvent.click(await screen.findByRole("button", { name: /Edit filter.*Year/ }));
|
|
118
|
+
const value = await screen.findByPlaceholderText("Enter value...");
|
|
119
|
+
expect((value as HTMLInputElement).value).toBe("2023");
|
|
120
|
+
fireEvent.change(value, { target: { value: "2024" } });
|
|
121
|
+
await waitFor(() => expect(cardTitles(container)).toEqual(["Beta"]));
|
|
122
|
+
fireEvent.keyDown(document, { key: "Escape" });
|
|
123
|
+
await waitFor(() => expect(screen.queryByPlaceholderText("Enter value...")).toBeNull());
|
|
124
|
+
fireEvent.click(screen.getByRole("button", { name: "Remove" }));
|
|
125
|
+
await waitFor(() => expect(cardTitles(container)).toEqual(["Alpha", "Beta", "Gamma"]));
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it("keeps the custom-toolbar fallback and clears its active filter", async () => {
|
|
129
|
+
const { container } = renderWithProviders(
|
|
130
|
+
<Cards
|
|
131
|
+
renderToolbar={() => <div>Custom actions</div>}
|
|
132
|
+
initialState={{
|
|
133
|
+
filters: [{ id: "f", columnId: "form", value: { operator: "contains", value: "Alpha" } }],
|
|
134
|
+
}}
|
|
135
|
+
/>,
|
|
136
|
+
);
|
|
137
|
+
expect(screen.getByText("Custom actions")).toBeTruthy();
|
|
138
|
+
const fallback = screen.getByRole("toolbar", { name: "Card list controls" });
|
|
139
|
+
expect(within(fallback).getByRole("button", { name: /Add Filter/ })).toBeTruthy();
|
|
140
|
+
expect(cardTitles(container)).toEqual(["Alpha"]);
|
|
141
|
+
fireEvent.click(within(fallback).getByRole("button", { name: "Clear" }));
|
|
142
|
+
await waitFor(() => expect(cardTitles(container)).toEqual(["Alpha", "Beta", "Gamma"]));
|
|
143
|
+
fireEvent.click(within(fallback).getByRole("button", { name: "Add Filter" }));
|
|
144
|
+
expect(await screen.findByText("Select column")).toBeTruthy();
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it("leaves an explicitly supplied canonical custom toolbar intact", () => {
|
|
148
|
+
renderWithProviders(<Cards renderToolbar={(props: any) => <DataTableToolbar {...props} />} />);
|
|
149
|
+
expect(screen.getByRole("button", { name: "Filter" })).toBeTruthy();
|
|
150
|
+
expect(screen.getByRole("button", { name: "Add Filter" })).toBeTruthy();
|
|
151
|
+
expect(screen.getByRole("toolbar", { name: "Card list controls" })).toBeTruthy();
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it("partitions actual export, long saved view, save and fetching from Filter and Sort", () => {
|
|
155
|
+
const name = "Saved view with a deliberately long distinguishing classification suffix";
|
|
156
|
+
const { container } = renderWithProviders(
|
|
157
|
+
<Cards
|
|
158
|
+
enableGlobalSearch
|
|
159
|
+
initialState={{
|
|
160
|
+
activeViewId: "long",
|
|
161
|
+
views: [
|
|
162
|
+
{
|
|
163
|
+
id: "long",
|
|
164
|
+
name,
|
|
165
|
+
columns: {},
|
|
166
|
+
filters: [],
|
|
167
|
+
sorting: [],
|
|
168
|
+
pagination: { pageIndex: 0, pageSize: 10 },
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
}}
|
|
172
|
+
renderToolbar={(props: any) => <AllCardActionsToolbar {...props} />}
|
|
173
|
+
/>,
|
|
174
|
+
);
|
|
175
|
+
const primary = container.querySelector<HTMLElement>("[data-table-card-primary]")!;
|
|
176
|
+
const secondary = container.querySelector<HTMLElement>("[data-table-card-secondary]")!;
|
|
177
|
+
expect(within(primary).getByLabelText("Sort rows")).toBeTruthy();
|
|
178
|
+
expect(within(primary).getByRole("button", { name: "Filter" })).toBeTruthy();
|
|
179
|
+
expect(within(secondary).getByRole("button", { name: /Export as CSV/ })).toBeTruthy();
|
|
180
|
+
expect(within(secondary).getByLabelText("Saved views").textContent).toContain(name);
|
|
181
|
+
expect(within(secondary).getByLabelText("Save view")).toBeTruthy();
|
|
182
|
+
expect(secondary.querySelector("[data-table-fetching]")).not.toBeNull();
|
|
183
|
+
expect(within(primary).queryByLabelText("Saved views")).toBeNull();
|
|
184
|
+
const sort = primary.querySelector("[data-table-card-sort]")!;
|
|
185
|
+
expect(sort.contains(within(primary).getByLabelText("Sort rows"))).toBe(true);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
it("retains hidden filters and sort order when cards change to grid and back", () => {
|
|
189
|
+
const initialState = {
|
|
190
|
+
filters: [{ id: "year", columnId: "year", value: { operator: "is", value: "2023" } }],
|
|
191
|
+
sorting: [{ id: "form", desc: true }],
|
|
192
|
+
};
|
|
193
|
+
const { container, rerender } = renderWithProviders(<Cards initialState={initialState} />);
|
|
194
|
+
expect(cardTitles(container)).toEqual(["Gamma", "Alpha"]);
|
|
195
|
+
rerender(<Cards initialState={initialState} layout="table" />);
|
|
196
|
+
expect(cardTitles(container)).toEqual([]);
|
|
197
|
+
expect(screen.queryByLabelText("Sort rows")).toBeNull();
|
|
198
|
+
expect(screen.getByText("Gamma")).toBeTruthy();
|
|
199
|
+
expect(screen.queryByText("Beta")).toBeNull();
|
|
200
|
+
rerender(<Cards initialState={initialState} />);
|
|
201
|
+
expect(cardTitles(container)).toEqual(["Gamma", "Alpha"]);
|
|
202
|
+
expect(screen.getByLabelText("Sort rows").getAttribute("aria-description")).toBe("Form ↓");
|
|
203
|
+
expect(screen.getAllByRole("button", { name: "Filter" })).toHaveLength(1);
|
|
204
|
+
expect(screen.queryByPlaceholderText("Enter value...")).toBeNull();
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it("clears hidden and visible advanced filters together without clearing plain column filters", async () => {
|
|
208
|
+
const { container } = renderWithProviders(
|
|
209
|
+
<Cards
|
|
210
|
+
initialState={{
|
|
211
|
+
filters: [
|
|
212
|
+
{ id: "year", columnId: "year", value: { operator: "is", value: "2023" } },
|
|
213
|
+
{ id: "form", columnId: "form", value: { operator: "contains", value: "Alpha" } },
|
|
214
|
+
],
|
|
215
|
+
columnFilters: [{ id: "entity", value: "personal" }],
|
|
216
|
+
}}
|
|
217
|
+
/>,
|
|
218
|
+
);
|
|
219
|
+
expect(cardTitles(container)).toEqual(["Alpha"]);
|
|
220
|
+
fireEvent.click(screen.getByRole("button", { name: "Clear all" }));
|
|
221
|
+
await waitFor(() => expect(cardTitles(container)).toEqual(["Alpha", "Gamma"]));
|
|
222
|
+
expect(screen.queryByRole("button", { name: /Edit filter/ })).toBeNull();
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it("leaves the public standalone toolbar in its original layout", () => {
|
|
226
|
+
const { container } = renderWithProviders(
|
|
227
|
+
<DataTableToolbar
|
|
228
|
+
enableGlobalSearch
|
|
229
|
+
enableViews
|
|
230
|
+
customActions={<button type="button">Custom action</button>}
|
|
231
|
+
/>,
|
|
232
|
+
);
|
|
233
|
+
expect(container.querySelector<HTMLElement>("[data-table-card-primary]")).toBeNull();
|
|
234
|
+
expect(container.querySelector<HTMLElement>("[data-table-card-secondary]")).toBeNull();
|
|
235
|
+
expect(screen.getByLabelText("Search table data")).toBeTruthy();
|
|
236
|
+
expect(screen.getByText("Custom action")).toBeTruthy();
|
|
237
|
+
});
|
|
238
|
+
});
|
|
@@ -204,8 +204,11 @@ describe("chrome interplay: Search × injected filters × enableFiltering", () =
|
|
|
204
204
|
expect(screen.getByLabelText("Search table data")).toBeInTheDocument();
|
|
205
205
|
});
|
|
206
206
|
|
|
207
|
-
it("enableFiltering=false suppresses the card layout's
|
|
207
|
+
it("enableFiltering=false suppresses the card layout's filter control too", () => {
|
|
208
208
|
// auto layout renders cards below sm (the test env default).
|
|
209
|
+
// MPO-300: the default card path owns the canonical all-field Filter in
|
|
210
|
+
// the toolbar; the lower Card list controls toolbar and its Add Filter
|
|
211
|
+
// builder only mount behind a custom toolbar now.
|
|
209
212
|
const control = renderWithProviders(
|
|
210
213
|
<DataTable
|
|
211
214
|
data={rows}
|
|
@@ -214,10 +217,8 @@ describe("chrome interplay: Search × injected filters × enableFiltering", () =
|
|
|
214
217
|
initialState={{ filters: injectedReadyFilter }}
|
|
215
218
|
/>,
|
|
216
219
|
);
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
// aria-label is the stable handle, as the sibling arms above use.
|
|
220
|
-
expect(screen.getByLabelText("Add Filter")).toBeInTheDocument();
|
|
220
|
+
expect(screen.getByRole("button", { name: "Filter" })).toBeInTheDocument();
|
|
221
|
+
expect(screen.queryByText("Add Filter")).not.toBeInTheDocument();
|
|
221
222
|
control.unmount();
|
|
222
223
|
|
|
223
224
|
renderWithProviders(
|
|
@@ -228,6 +229,7 @@ describe("chrome interplay: Search × injected filters × enableFiltering", () =
|
|
|
228
229
|
initialState={{ filters: injectedReadyFilter }}
|
|
229
230
|
/>,
|
|
230
231
|
);
|
|
232
|
+
expect(screen.queryByRole("button", { name: "Filter" })).not.toBeInTheDocument();
|
|
231
233
|
expect(screen.queryByText("Add Filter")).not.toBeInTheDocument();
|
|
232
234
|
// Injected filters still scope the card list.
|
|
233
235
|
expect(screen.getByText("Alpha")).toBeInTheDocument();
|