Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New column picker for variant datagrid #4086

Merged
merged 22 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/lucky-otters-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": minor
---

New column picker for variant datagrid
20 changes: 4 additions & 16 deletions locale/defaultMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,6 @@
"context": "dialog header",
"string": "Change customer shipping address"
},
"142MJn": {
"context": "select visible columns button",
"string": "Columns"
},
"15PiOX": {
"context": "button title",
"string": "Unassign"
Expand Down Expand Up @@ -2838,10 +2834,6 @@
"IH47ID": {
"string": "Use button above to add new product variants"
},
"IHtOda": {
"context": "input label",
"string": "Selected columns"
},
"IKvOK+": {
"context": "Amount error message",
"string": "Amount must be bigger than 0"
Expand Down Expand Up @@ -4767,6 +4759,10 @@
"VyzsWZ": {
"string": "Default Billing Address"
},
"Vze3qI": {
"context": "column category descriptor",
"string": "Channels"
},
"W/Es0H": {
"string": "Order successfully cancelled"
},
Expand Down Expand Up @@ -5865,10 +5861,6 @@
"dPYqy0": {
"string": "We are currently exporting your requested CSV. As soon as it is available it will be sent to your email address"
},
"dS+SOT": {
"context": "header",
"string": "Column settings"
},
"dS8Adx": {
"context": "product",
"string": "Digital"
Expand Down Expand Up @@ -7347,10 +7339,6 @@
"context": "currency filter label",
"string": "Currency"
},
"p+HM56": {
"context": "header",
"string": "Customize list"
},
"p+UDec": {
"context": "payment status",
"string": "Payment"
Expand Down
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-strict-ignore
import { useColumns } from "@dashboard/components/Datagrid/ColumnPicker/useColumns";
import Datagrid from "@dashboard/components/Datagrid/Datagrid";
import { useColumnsDefault } from "@dashboard/components/Datagrid/hooks/useColumnsDefault";
import {
DatagridChangeStateContext,
useDatagridChangeState,
Expand Down Expand Up @@ -40,8 +40,11 @@ export const CategoryProductListDatagrid = ({
[products, availableColumns],
);

const { columns, onColumnMoved, onColumnResize } =
useColumnsDefault(availableColumns);
const { visibleColumns, handlers } = useColumns({
staticColumns: availableColumns,
selectedColumns: ["name"],
onSave: () => null,
});

const handleRowAnchor = useCallback(
([, row]: Item) => productUrl(products[row].id),
Expand All @@ -57,7 +60,7 @@ export const CategoryProductListDatagrid = ({
loading={disabled}
verticalBorder={false}
rowMarkers="checkbox"
availableColumns={columns}
availableColumns={visibleColumns}
rows={products?.length ?? 0}
getCellContent={getCellContent}
getCellError={() => false}
Expand All @@ -68,8 +71,8 @@ export const CategoryProductListDatagrid = ({
rowAnchor={handleRowAnchor}
menuItems={() => []}
selectionActions={() => selectionActionButton}
onColumnResize={onColumnResize}
onColumnMoved={onColumnMoved}
onColumnResize={handlers.onResize}
onColumnMoved={handlers.onMove}
onRowSelectionChange={onSelectProductsIds}
/>

Expand Down
149 changes: 0 additions & 149 deletions src/components/ColumnPicker/ColumnPicker.tsx

This file was deleted.

65 changes: 0 additions & 65 deletions src/components/ColumnPicker/ColumnPickerButton.tsx

This file was deleted.

Loading
Loading