Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add toggleAll option to all tablelist

Krzysztof Bialoglowiczf95e3a511d8a
diff --git a/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx b/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx
index d6c83b46b2..92942c3b27 100644
--- a/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx
+++ b/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx
@@ -44,6 +44,9 @@ const styles = (theme: Theme) =>
colSubcategories: {
textAlign: "center"
},
+ relative: {
+ position: "relative"
+ },
tableRow: {
cursor: "pointer"
}
@@ -95,7 +98,7 @@ const CategoryList = withStyles(styles, { name: "CategoryList" })(
}
/>
)}
- <Table>
+ <Table className={classes.relative}>
<TableHead
selected={selected}
disabled={disabled}
diff --git a/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx b/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx
index 03980513e8..696ddd8313 100644
--- a/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx
+++ b/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx
@@ -38,6 +38,9 @@ const styles = (theme: Theme) =>
colProducts: {
textAlign: "center"
},
+ relative: {
+ position: "relative"
+ },
tableRow: {
cursor: "pointer" as "pointer"
}
@@ -66,7 +69,7 @@ const CollectionList = withStyles(styles, { name: "CollectionList" })(
toolbar
}: CollectionListProps) => (
<Card>
- <Table>
+ <Table className={classes.relative}>
<TableHead
selected={selected}
disabled={disabled}
diff --git a/saleor/static/dashboard-next/components/ProductList/ProductList.tsx b/saleor/static/dashboard-next/components/ProductList/ProductList.tsx
index c2d28ba58a..f6f8e95356 100644
--- a/saleor/static/dashboard-next/components/ProductList/ProductList.tsx
+++ b/saleor/static/dashboard-next/components/ProductList/ProductList.tsx
@@ -53,6 +53,9 @@ const styles = (theme: Theme) =>
link: {
cursor: "pointer"
},
+ relative: {
+ position: "relative"
+ },
textLeft: {
textAlign: "left"
},
@@ -83,7 +86,7 @@ export const ProductList = withStyles(styles, { name: "ProductList" })(
onPreviousPage,
onRowClick
}: ProductListProps) => (
- <Table>
+ <Table className={classes.relative}>
<TableHead
selected={selected}
disabled={disabled}
@@ -92,7 +95,6 @@ export const ProductList = withStyles(styles, { name: "ProductList" })(
toolbar={toolbar}
tablebar={
<>
- <TableCell />
<TableCell />
<TableCell className={classes.colName}>
{i18n.t("Name", { context: "object" })}
diff --git a/saleor/static/dashboard-next/components/TableHead/TableHead.tsx b/saleor/static/dashboard-next/components/TableHead/TableHead.tsx
index 9ec7f9da4c..f977a03752 100644
--- a/saleor/static/dashboard-next/components/TableHead/TableHead.tsx
+++ b/saleor/static/dashboard-next/components/TableHead/TableHead.tsx
@@ -42,7 +42,9 @@ const styles = (theme: Theme) =>
root: {
backgroundColor: fade(theme.palette.primary.main, 0.05),
paddingLeft: 12,
- paddingRight: 24
+ paddingRight: 24,
+ position: "absolute",
+ width: "calc(100% - 72px)"
},
spacer: {
flex: 1
diff --git a/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx b/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx
index a7da16ae90..f631c75605 100644
--- a/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx
+++ b/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx
@@ -35,6 +35,9 @@ const styles = (theme: Theme) =>
colOrders: {
textAlign: "center"
},
+ relative: {
+ position: "relative"
+ },
tableRow: {
cursor: "pointer"
}
@@ -63,16 +66,15 @@ const CustomerList = withStyles(styles, { name: "CustomerList" })(
isChecked
}: CustomerListProps) => (
<Card>
- <Table>
+ <Table className={classes.relative}>
<TableHead
selected={selected}
disabled={disabled}
- items={products}
+ items={customers}
toggleAll={toggleAll}
toolbar={toolbar}
tablebar={
<>
- <TableCell />
<TableCell className={classes.colName}>
{i18n.t("Customer Name", { context: "table header" })}
</TableCell>
diff --git a/saleor/static/dashboard-next/discounts/components/DiscountCategories/DiscountCategories.tsx b/saleor/static/dashboard-next/discounts/components/DiscountCategories/DiscountCategories.tsx
index f39a21b916..9fbb0355f0 100644
--- a/saleor/static/dashboard-next/discounts/components/DiscountCategories/DiscountCategories.tsx
+++ b/saleor/static/dashboard-next/discounts/components/DiscountCategories/DiscountCategories.tsx
@@ -81,18 +81,25 @@ const DiscountCategories = withStyles(styles, {
}
/>
<Table>
- <TableHead selected={selected} toolbar={toolbar}>
- <TableRow>
- <TableCell />
- <TableCell className={classes.wideColumn}>
- {i18n.t("Category name")}
- </TableCell>
- <TableCell className={classes.textRight}>
- {i18n.t("Products")}
- </TableCell>
- <TableCell />
- </TableRow>
- </TableHead>
+ <TableHead
+ selected={selected}
+ disabled={disabled}
+ items={sale}
+ toggleAll={toggleAll}
+ toolbar={toolbar}
+ tablebar={
+ <>
+ <TableCell />
+ <TableCell className={classes.wideColumn}>
+ {i18n.t("Category name")}
+ </TableCell>
+ <TableCell className={classes.textRight}>
+ {i18n.t("Products")}
+ </TableCell>
+ <TableCell />
+ </>
+ }
+ />
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/discounts/components/DiscountCollections/DiscountCollections.tsx b/saleor/static/dashboard-next/discounts/components/DiscountCollections/DiscountCollections.tsx
index 7f058f1b83..2e98aa64fd 100644
--- a/saleor/static/dashboard-next/discounts/components/DiscountCollections/DiscountCollections.tsx
+++ b/saleor/static/dashboard-next/discounts/components/DiscountCollections/DiscountCollections.tsx
@@ -66,6 +66,7 @@ const DiscountCollections = withStyles(styles, {
isChecked,
selected,
toggle,
+ toggleAll,
toolbar
}: DiscountCollectionsProps & WithStyles<typeof styles>) => (
<Card>
@@ -80,18 +81,25 @@ const DiscountCollections = withStyles(styles, {
}
/>
<Table>
- <TableHead selected={selected} toolbar={toolbar}>
- <TableRow>
- <TableCell />
- <TableCell className={classes.wideColumn}>
- {i18n.t("Collection name")}
- </TableCell>
- <TableCell className={classes.textRight}>
- {i18n.t("Products")}
- </TableCell>
- <TableCell />
- </TableRow>
- </TableHead>
+ <TableHead
+ selected={selected}
+ disabled={disabled}
+ items={sale}
+ toggleAll={toggleAll}
+ toolbar={toolbar}
+ tablebar={
+ <>
+ <TableCell />
+ <TableCell className={classes.wideColumn}>
+ {i18n.t("Collection name")}
+ </TableCell>
+ <TableCell className={classes.textRight}>
+ {i18n.t("Products")}
+ </TableCell>
+ <TableCell />
+ </>
+ }
+ />
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/discounts/components/DiscountProducts/DiscountProducts.tsx b/saleor/static/dashboard-next/discounts/components/DiscountProducts/DiscountProducts.tsx
index ce41e96537..cad9ba4c3c 100644
--- a/saleor/static/dashboard-next/discounts/components/DiscountProducts/DiscountProducts.tsx
+++ b/saleor/static/dashboard-next/discounts/components/DiscountProducts/DiscountProducts.tsx
@@ -74,6 +74,7 @@ const DiscountProducts = withStyles(styles, {
isChecked,
selected,
toggle,
+ toggleAll,
toolbar
}: SaleProductsProps & WithStyles<typeof styles>) => (
<Card>
@@ -88,22 +89,29 @@ const DiscountProducts = withStyles(styles, {
}
/>
<Table>
- <TableHead selected={selected} toolbar={toolbar}>
- <TableRow>
- <TableCell />
- <TableCell />
- <TableCell className={classes.colName}>
- {i18n.t("Product name")}
- </TableCell>
- <TableCell className={classes.colType}>
- {i18n.t("Product Type")}
- </TableCell>
- <TableCell className={classes.colPublished}>
- {i18n.t("Published")}
- </TableCell>
- <TableCell />
- </TableRow>
- </TableHead>
+ <TableHead
+ selected={selected}
+ disabled={disabled}
+ items={sale}
+ toggleAll={toggleAll}
+ toolbar={toolbar}
+ tablebar={
+ <>
+ <TableCell />
+ <TableCell />
+ <TableCell className={classes.colName}>
+ {i18n.t("Product name")}
+ </TableCell>
+ <TableCell className={classes.colType}>
+ {i18n.t("Product Type")}
+ </TableCell>
+ <TableCell className={classes.colPublished}>
+ {i18n.t("Published")}
+ </TableCell>
+ <TableCell />
+ </>
+ }
+ />
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/discounts/components/SaleDetailsPage/SaleDetailsPage.tsx b/saleor/static/dashboard-next/discounts/components/SaleDetailsPage/SaleDetailsPage.tsx
index 64a0b43113..4b6c512d78 100644
--- a/saleor/static/dashboard-next/discounts/components/SaleDetailsPage/SaleDetailsPage.tsx
+++ b/saleor/static/dashboard-next/discounts/components/SaleDetailsPage/SaleDetailsPage.tsx
@@ -100,7 +100,8 @@ const SaleDetailsPage: React.StatelessComponent<SaleDetailsPageProps> = ({
productListToolbar,
isChecked,
selected,
- toggle
+ toggle,
+ toggleAll
}) => {
const initialForm: FormData = {
endDate: maybe(() => (sale.endDate ? sale.endDate : ""), ""),
@@ -181,6 +182,7 @@ const SaleDetailsPage: React.StatelessComponent<SaleDetailsPageProps> = ({
isChecked={isChecked}
selected={selected}
toggle={toggle}
+ toggleAll={toggleAll}
toolbar={categoryListToolbar}
/>
) : activeTab === SaleDetailsPageTab.collections ? (
@@ -196,6 +198,7 @@ const SaleDetailsPage: React.StatelessComponent<SaleDetailsPageProps> = ({
isChecked={isChecked}
selected={selected}
toggle={toggle}
+ toggleAll={toggleAll}
toolbar={collectionListToolbar}
/>
) : (
@@ -211,6 +214,7 @@ const SaleDetailsPage: React.StatelessComponent<SaleDetailsPageProps> = ({
isChecked={isChecked}
selected={selected}
toggle={toggle}
+ toggleAll={toggleAll}
toolbar={productListToolbar}
/>
)}
diff --git a/saleor/static/dashboard-next/discounts/components/SaleList/SaleList.tsx b/saleor/static/dashboard-next/discounts/components/SaleList/SaleList.tsx
index 32d89b2f2f..53c8371bdd 100644
--- a/saleor/static/dashboard-next/discounts/components/SaleList/SaleList.tsx
+++ b/saleor/static/dashboard-next/discounts/components/SaleList/SaleList.tsx
@@ -54,6 +54,9 @@ const styles = (theme: Theme) =>
colValue: {
textAlign: "right"
},
+ relative: {
+ position: "relative"
+ },
tableRow: {
cursor: "pointer"
}
@@ -74,35 +77,42 @@ const SaleList = withStyles(styles, {
isChecked,
selected,
toggle,
+ toggleAll,
toolbar
}: SaleListProps & WithStyles<typeof styles>) => (
<Card>
- <Table>
- <TableHead selected={selected} toolbar={toolbar}>
- <TableRow>
- <TableCell />
- <TableCell className={classes.colName}>
- {i18n.t("Name", {
- context: "sale list table header"
- })}
- </TableCell>
- <TableCell className={classes.colStart}>
- {i18n.t("Starts", {
- context: "sale list table header"
- })}
- </TableCell>
- <TableCell className={classes.colEnd}>
- {i18n.t("Ends", {
- context: "sale list table header"
- })}
- </TableCell>
- <TableCell className={classes.colValue}>
- {i18n.t("Value", {
- context: "sale list table header"
- })}
- </TableCell>
- </TableRow>
- </TableHead>
+ <Table className={classes.relative}>
+ <TableHead
+ selected={selected}
+ disabled={disabled}
+ items={sales}
+ toggleAll={toggleAll}
+ toolbar={toolbar}
+ tablebar={
+ <>
+ <TableCell className={classes.colName}>
+ {i18n.t("Name", {
+ context: "sale list table header"
+ })}
+ </TableCell>
+ <TableCell className={classes.colStart}>
+ {i18n.t("Starts", {
+ context: "sale list table header"
+ })}
+ </TableCell>
+ <TableCell className={classes.colEnd}>
+ {i18n.t("Ends", {
+ context: "sale list table header"
+ })}
+ </TableCell>
+ <TableCell className={classes.colValue}>
+ {i18n.t("Value", {
+ context: "sale list table header"
+ })}
+ </TableCell>
+ </>
+ }
+ />
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/discounts/components/VoucherDetailsPage/VoucherDetailsPage.tsx b/saleor/static/dashboard-next/discounts/components/VoucherDetailsPage/VoucherDetailsPage.tsx
index 5748496615..bed569930e 100644
--- a/saleor/static/dashboard-next/discounts/components/VoucherDetailsPage/VoucherDetailsPage.tsx
+++ b/saleor/static/dashboard-next/discounts/components/VoucherDetailsPage/VoucherDetailsPage.tsx
@@ -110,6 +110,7 @@ const VoucherDetailsPage: React.StatelessComponent<VoucherDetailsPageProps> = ({
onRemove,
onSubmit,
toggle,
+ toggleAll,
selected,
isChecked,
categoryListToolbar,
@@ -209,6 +210,7 @@ const VoucherDetailsPage: React.StatelessComponent<VoucherDetailsPageProps> = ({
isChecked={isChecked}
selected={selected}
toggle={toggle}
+ toggleAll={toggleAll}
toolbar={categoryListToolbar}
/>
) : activeTab === VoucherDetailsPageTab.collections ? (
@@ -224,6 +226,7 @@ const VoucherDetailsPage: React.StatelessComponent<VoucherDetailsPageProps> = ({
isChecked={isChecked}
selected={selected}
toggle={toggle}
+ toggleAll={toggleAll}
toolbar={collectionListToolbar}
/>
) : (
@@ -239,6 +242,7 @@ const VoucherDetailsPage: React.StatelessComponent<VoucherDetailsPageProps> = ({
isChecked={isChecked}
selected={selected}
toggle={toggle}
+ toggleAll={toggleAll}
toolbar={productListToolbar}
/>
)}
diff --git a/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx b/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx
index b4fd7fb08b..51923fb9e6 100644
--- a/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx
+++ b/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx
@@ -66,6 +66,9 @@ const styles = (theme: Theme) =>
colValue: {
textAlign: "right"
},
+ relative: {
+ position: "relative"
+ },
tableRow: {
cursor: "pointer"
},
@@ -89,45 +92,52 @@ const VoucherList = withStyles(styles, {
isChecked,
selected,
toggle,
+ toggleAll,
toolbar
}: VoucherListProps & WithStyles<typeof styles>) => (
<Card>
- <Table>
- <TableHead selected={selected} toolbar={toolbar}>
- <TableRow>
- <TableCell />
- <TableCell className={classes.colName}>
- {i18n.t("Name", {
- context: "voucher list table header"
- })}
- </TableCell>
- <TableCell className={classes.colMinSpent}>
- {i18n.t("Min. Spent", {
- context: "voucher list table header"
- })}
- </TableCell>
- <TableCell className={classes.colStart}>
- {i18n.t("Starts", {
- context: "voucher list table header"
- })}
- </TableCell>
- <TableCell className={classes.colEnd}>
- {i18n.t("Ends", {
- context: "voucher list table header"
- })}
- </TableCell>
- <TableCell className={classes.colValue}>
- {i18n.t("Value", {
- context: "voucher list table header"
- })}
- </TableCell>
- <TableCell className={classes.colUses}>
- {i18n.t("Uses", {
- context: "voucher list table header"
- })}
- </TableCell>
- </TableRow>
- </TableHead>
+ <Table className={classes.relative}>
+ <TableHead
+ selected={selected}
+ disabled={disabled}
+ items={vouchers}
+ toggleAll={toggleAll}
+ toolbar={toolbar}
+ tablebar={
+ <>
+ <TableCell className={classes.colName}>
+ {i18n.t("Name", {
+ context: "voucher list table header"
+ })}
+ </TableCell>
+ <TableCell className={classes.colMinSpent}>
+ {i18n.t("Min. Spent", {
+ context: "voucher list table header"
+ })}
+ </TableCell>
+ <TableCell className={classes.colStart}>
+ {i18n.t("Starts", {
+ context: "voucher list table header"
+ })}
+ </TableCell>
+ <TableCell className={classes.colEnd}>
+ {i18n.t("Ends", {
+ context: "voucher list table header"
+ })}
+ </TableCell>
+ <TableCell className={classes.colValue}>
+ {i18n.t("Value", {
+ context: "voucher list table header"
+ })}
+ </TableCell>
+ <TableCell className={classes.colUses}>
+ {i18n.t("Uses", {
+ context: "voucher list table header"
+ })}
+ </TableCell>
+ </>
+ }
+ />
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/discounts/components/VoucherListPage/VoucherListPage.tsx b/saleor/static/dashboard-next/discounts/components/VoucherListPage/VoucherListPage.tsx
index e3c71be45c..b6c25796d4 100644
--- a/saleor/static/dashboard-next/discounts/components/VoucherListPage/VoucherListPage.tsx
+++ b/saleor/static/dashboard-next/discounts/components/VoucherListPage/VoucherListPage.tsx
@@ -26,6 +26,7 @@ const VoucherListPage: React.StatelessComponent<VoucherListPageProps> = ({
isChecked,
selected,
toggle,
+ toggleAll,
toolbar
}) => (
<Container>
@@ -46,6 +47,8 @@ const VoucherListPage: React.StatelessComponent<VoucherListPageProps> = ({
isChecked={isChecked}
selected={selected}
toggle={toggle}
+ toggleAll={toggleAll}
+ toggleAll={toggleAll}
toolbar={toolbar}
/>
</Container>
diff --git a/saleor/static/dashboard-next/discounts/views/SaleDetails.tsx b/saleor/static/dashboard-next/discounts/views/SaleDetails.tsx
index 39be6b4232..5d3b2154f8 100644
--- a/saleor/static/dashboard-next/discounts/views/SaleDetails.tsx
+++ b/saleor/static/dashboard-next/discounts/views/SaleDetails.tsx
@@ -63,7 +63,7 @@ export const SaleDetails: React.StatelessComponent<SaleDetailsProps> = ({
const paginate = usePaginator();
const notify = useNotifier();
const shop = useShop();
- const { isSelected, listElements, reset, toggle } = useBulkActions(
+ const { isSelected, listElements, reset, toggle, toggleAll } = useBulkActions(
params.ids
);
@@ -323,6 +323,7 @@ export const SaleDetails: React.StatelessComponent<SaleDetailsProps> = ({
isChecked={isSelected}
selected={listElements.length}
toggle={toggle}
+ toggleAll={toggleAll}
/>
<SearchProductsProvider>
{(searchProducts, searchProductsOpts) => (
diff --git a/saleor/static/dashboard-next/discounts/views/SaleList.tsx b/saleor/static/dashboard-next/discounts/views/SaleList.tsx
index ebd9b0084a..38dd277d47 100644
--- a/saleor/static/dashboard-next/discounts/views/SaleList.tsx
+++ b/saleor/static/dashboard-next/discounts/views/SaleList.tsx
@@ -36,7 +36,7 @@ export const SaleList: React.StatelessComponent<SaleListProps> = ({
const notify = useNotifier();
const paginate = usePaginator();
const shop = useShop();
- const { isSelected, listElements, reset, toggle } = useBulkActions(
+ const { isSelected, listElements, reset, toggle, toggleAll } = useBulkActions(
params.ids
);
@@ -94,6 +94,7 @@ export const SaleList: React.StatelessComponent<SaleListProps> = ({
isChecked={isSelected}
selected={listElements.length}
toggle={toggle}
+ toggleAll={toggleAll}
toolbar={
<IconButton
color="primary"
diff --git a/saleor/static/dashboard-next/discounts/views/VoucherDetails.tsx b/saleor/static/dashboard-next/discounts/views/VoucherDetails.tsx
index 688fcfba58..3b1971db34 100644
--- a/saleor/static/dashboard-next/discounts/views/VoucherDetails.tsx
+++ b/saleor/static/dashboard-next/discounts/views/VoucherDetails.tsx
@@ -69,7 +69,7 @@ export const VoucherDetails: React.StatelessComponent<VoucherDetailsProps> = ({
const paginate = usePaginator();
const notify = useNotifier();
const shop = useShop();
- const { isSelected, listElements, reset, toggle } = useBulkActions(
+ const { isSelected, listElements, reset, toggle, toggleAll } = useBulkActions(
params.ids
);
@@ -377,6 +377,7 @@ export const VoucherDetails: React.StatelessComponent<VoucherDetailsProps> = ({
isChecked={isSelected}
selected={listElements.length}
toggle={toggle}
+ toggleAll={toggleAll}
/>
<SearchCategoriesProvider>
{(searchCategories, searchCategoriesOpts) => (
diff --git a/saleor/static/dashboard-next/discounts/views/VoucherList.tsx b/saleor/static/dashboard-next/discounts/views/VoucherList.tsx
index f32b151bd0..717fbfee42 100644
--- a/saleor/static/dashboard-next/discounts/views/VoucherList.tsx
+++ b/saleor/static/dashboard-next/discounts/views/VoucherList.tsx
@@ -36,7 +36,7 @@ export const VoucherList: React.StatelessComponent<VoucherListProps> = ({
const notify = useNotifier();
const paginate = usePaginator();
const shop = useShop();
- const { isSelected, listElements, reset, toggle } = useBulkActions(
+ const { isSelected, listElements, reset, toggle, toggleAll } = useBulkActions(
params.ids
);
@@ -95,6 +95,7 @@ export const VoucherList: React.StatelessComponent<VoucherListProps> = ({
isChecked={isSelected}
selected={listElements.length}
toggle={toggle}
+ toggleAll={toggleAll}
toolbar={
<IconButton
color="primary"
diff --git a/saleor/static/dashboard-next/navigation/components/MenuList/MenuList.tsx b/saleor/static/dashboard-next/navigation/components/MenuList/MenuList.tsx
index a892c44c61..8bf268b513 100644
--- a/saleor/static/dashboard-next/navigation/components/MenuList/MenuList.tsx
+++ b/saleor/static/dashboard-next/navigation/components/MenuList/MenuList.tsx
@@ -40,6 +40,9 @@ const styles = (theme: Theme) =>
textAlign: "right"
},
colTitle: {},
+ relative: {
+ position: "relative"
+ },
row: {
cursor: "pointer"
}
@@ -57,22 +60,28 @@ const MenuList = withStyles(styles, { name: "MenuList" })(
pageInfo,
selected,
toggle,
+ toggleAll,
toolbar
}: MenuListProps & WithStyles<typeof styles>) => (
<Card>
- <Table>
- <TableHead selected={selected} toolbar={toolbar}>
- <TableRow>
- <TableCell padding="checkbox" />
- <TableCell className={classes.colTitle}>
- {i18n.t("Menu Title", { context: "object" })}
- </TableCell>
- <TableCell className={classes.colItems}>
- {i18n.t("Items", { context: "number of menu items" })}
- </TableCell>
- <TableCell />
- </TableRow>
- </TableHead>
+ <Table className={classes.relative}>
+ <TableHead
+ selected={selected}
+ disabled={disabled}
+ items={menus}
+ toggleAll={toggleAll}
+ toolbar={toolbar}
+ tablebar={
+ <>
+ <TableCell className={classes.colTitle}>
+ {i18n.t("Menu Title", { context: "object" })}
+ </TableCell>
+ <TableCell className={classes.colItems}>
+ {i18n.t("Items", { context: "number of menu items" })}
+ </TableCell>
+ </>
+ }
+ />
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/navigation/views/MenuList.tsx b/saleor/static/dashboard-next/navigation/views/MenuList.tsx
index 6c8a61ac2d..62cc19f192 100644
--- a/saleor/static/dashboard-next/navigation/views/MenuList.tsx
+++ b/saleor/static/dashboard-next/navigation/views/MenuList.tsx
@@ -32,7 +32,7 @@ const MenuList: React.FC<MenuListProps> = ({ params }) => {
const navigate = useNavigator();
const notify = useNotifier();
const paginate = usePaginator();
- const { isSelected, listElements, reset, toggle } = useBulkActions(
+ const { isSelected, listElements, reset, toggle, toggleAll } = useBulkActions(
params.ids
);
@@ -151,6 +151,7 @@ const MenuList: React.FC<MenuListProps> = ({ params }) => {
isChecked={isSelected}
selected={listElements.length}
toggle={toggle}
+ toggleAll={toggleAll}
toolbar={
<Button
color="primary"
diff --git a/saleor/static/dashboard-next/orders/components/OrderDraftList/OrderDraftList.tsx b/saleor/static/dashboard-next/orders/components/OrderDraftList/OrderDraftList.tsx
index 5bc7e7b52a..d266e71f75 100644
--- a/saleor/static/dashboard-next/orders/components/OrderDraftList/OrderDraftList.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderDraftList/OrderDraftList.tsx
@@ -71,6 +71,7 @@ export const OrderDraftList = withStyles(styles, { name: "OrderDraftList" })(
isChecked,
selected,
toggle,
+ toggleAll,
toolbar
}: OrderDraftListProps) => {
const orderDraftList = orders
@@ -82,23 +83,29 @@ export const OrderDraftList = withStyles(styles, { name: "OrderDraftList" })(
: undefined;
return (
<Table>
- <TableHead selected={selected} toolbar={toolbar}>
- <TableRow>
- <TableCell />
- <TableCell padding="dense" className={classes.colNumber}>
- {i18n.t("No. of Order", { context: "table header" })}
- </TableCell>
- <TableCell padding="dense" className={classes.colDate}>
- {i18n.t("Date", { context: "table header" })}
- </TableCell>
- <TableCell padding="dense" className={classes.colCustomer}>
- {i18n.t("Customer", { context: "table header" })}
- </TableCell>
- <TableCell className={classes.colTotal} padding="dense">
- {i18n.t("Total", { context: "table header" })}
- </TableCell>
- </TableRow>
- </TableHead>
+ <TableHead
+ selected={selected}
+ disabled={disabled}
+ items={orders}
+ toggleAll={toggleAll}
+ toolbar={toolbar}
+ tablebar={
+ <>
+ <TableCell padding="dense" className={classes.colNumber}>
+ {i18n.t("No. of Order", { context: "table header" })}
+ </TableCell>
+ <TableCell padding="dense" className={classes.colDate}>
+ {i18n.t("Date", { context: "table header" })}
+ </TableCell>
+ <TableCell padding="dense" className={classes.colCustomer}>
+ {i18n.t("Customer", { context: "table header" })}
+ </TableCell>
+ <TableCell className={classes.colTotal} padding="dense">
+ {i18n.t("Total", { context: "table header" })}
+ </TableCell>
+ </>
+ }
+ />
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx b/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx
index 6a45a41b92..c03dea6e05 100644
--- a/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx
@@ -56,6 +56,9 @@ const styles = (theme: Theme) =>
},
link: {
cursor: "pointer"
+ },
+ relative: {
+ position: "relative"
}
});
@@ -78,6 +81,7 @@ export const OrderList = withStyles(styles, { name: "OrderList" })(
isChecked,
selected,
toggle,
+ toggleAll,
toolbar
}: OrderListProps) => {
const orderList = orders
@@ -88,30 +92,36 @@ export const OrderList = withStyles(styles, { name: "OrderList" })(
}))
: undefined;
return (
- <Table>
- <TableHead selected={selected} toolbar={toolbar}>
- <TableRow>
- <TableCell />
- <TableCell padding="dense" className={classes.colNumber}>
- {i18n.t("No. of Order", { context: "table header" })}
- </TableCell>
- <TableCell padding="dense" className={classes.colDate}>
- {i18n.t("Date", { context: "table header" })}
- </TableCell>
- <TableCell padding="dense" className={classes.colCustomer}>
- {i18n.t("Customer", { context: "table header" })}
- </TableCell>
- <TableCell padding="dense" className={classes.colPayment}>
- {i18n.t("Payment", { context: "table header" })}
- </TableCell>
- <TableCell padding="dense" className={classes.colFulfillment}>
- {i18n.t("Fulfillment status", { context: "table header" })}
- </TableCell>
- <TableCell className={classes.colTotal} padding="dense">
- {i18n.t("Total", { context: "table header" })}
- </TableCell>
- </TableRow>
- </TableHead>
+ <Table className={classes.relative}>
+ <TableHead
+ selected={selected}
+ disabled={disabled}
+ items={orders}
+ toggleAll={toggleAll}
+ toolbar={toolbar}
+ tablebar={
+ <>
+ <TableCell padding="dense" className={classes.colNumber}>
+ {i18n.t("No. of Order", { context: "table header" })}
+ </TableCell>
+ <TableCell padding="dense" className={classes.colDate}>
+ {i18n.t("Date", { context: "table header" })}
+ </TableCell>
+ <TableCell padding="dense" className={classes.colCustomer}>
+ {i18n.t("Customer", { context: "table header" })}
+ </TableCell>
+ <TableCell padding="dense" className={classes.colPayment}>
+ {i18n.t("Payment", { context: "table header" })}
+ </TableCell>
+ <TableCell padding="dense" className={classes.colFulfillment}>
+ {i18n.t("Fulfillment status", { context: "table header" })}
+ </TableCell>
+ <TableCell className={classes.colTotal} padding="dense">
+ {i18n.t("Total", { context: "table header" })}
+ </TableCell>
+ </>
+ }
+ />
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/orders/views/OrderDraftList.tsx b/saleor/static/dashboard-next/orders/views/OrderDraftList.tsx
index 8d8692b1c2..5d8b1c6560 100644
--- a/saleor/static/dashboard-next/orders/views/OrderDraftList.tsx
+++ b/saleor/static/dashboard-next/orders/views/OrderDraftList.tsx
@@ -36,7 +36,7 @@ export const OrderDraftList: React.StatelessComponent<OrderDraftListProps> = ({
const navigate = useNavigator();
const notify = useNotifier();
const paginate = usePaginator();
- const { isSelected, listElements, reset, toggle } = useBulkActions(
+ const { isSelected, listElements, reset, toggle, toggleAll } = useBulkActions(
params.ids
);
@@ -116,6 +116,7 @@ export const OrderDraftList: React.StatelessComponent<OrderDraftListProps> = ({
isChecked={isSelected}
selected={listElements.length}
toggle={toggle}
+ toggleAll={toggleAll}
toolbar={
<IconButton
color="primary"
diff --git a/saleor/static/dashboard-next/orders/views/OrderList.tsx b/saleor/static/dashboard-next/orders/views/OrderList.tsx
index e21272c54a..769ccf2193 100644
--- a/saleor/static/dashboard-next/orders/views/OrderList.tsx
+++ b/saleor/static/dashboard-next/orders/views/OrderList.tsx
@@ -37,7 +37,7 @@ export const OrderList: React.StatelessComponent<OrderListProps> = ({
const navigate = useNavigator();
const notify = useNotifier();
const paginate = usePaginator();
- const { isSelected, listElements, reset, toggle } = useBulkActions(
+ const { isSelected, listElements, reset, toggle, toggleAll } = useBulkActions(
params.ids
);
@@ -152,6 +152,7 @@ export const OrderList: React.StatelessComponent<OrderListProps> = ({
isChecked={isSelected}
selected={listElements.length}
toggle={toggle}
+ toggleAll={toggleAll}
toolbar={
<Button
color="primary"
diff --git a/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx b/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx
index c930e3c1dc..39aaa24049 100644
--- a/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx
+++ b/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx
@@ -42,6 +42,9 @@ const styles = (theme: Theme) =>
colVisibility: {},
link: {
cursor: "pointer"
+ },
+ relative: {
+ position: "relative"
}
});
const PageList = withStyles(styles, { name: "PageList" })(
@@ -56,24 +59,31 @@ const PageList = withStyles(styles, { name: "PageList" })(
isChecked,
selected,
toggle,
+ toggleAll,
toolbar
}: PageListProps & WithStyles<typeof styles>) => (
<Card>
- <Table>
- <TableHead selected={selected} toolbar={toolbar}>
- <TableRow>
- <TableCell />
- <TableCell className={classes.colTitle} padding="dense">
- {i18n.t("Title", { context: "table header" })}
- </TableCell>
- <TableCell className={classes.colSlug} padding="dense">
- {i18n.t("Slug", { context: "table header" })}
- </TableCell>
- <TableCell className={classes.colVisibility} padding="dense">
- {i18n.t("Visibility", { context: "table header" })}
- </TableCell>
- </TableRow>
- </TableHead>
+ <Table className={classes.relative}>
+ <TableHead
+ selected={selected}
+ disabled={disabled}
+ items={pages}
+ toggleAll={toggleAll}
+ toolbar={toolbar}
+ tablebar={
+ <>
+ <TableCell className={classes.colTitle} padding="dense">
+ {i18n.t("Title", { context: "table header" })}
+ </TableCell>
+ <TableCell className={classes.colSlug} padding="dense">
+ {i18n.t("Slug", { context: "table header" })}
+ </TableCell>
+ <TableCell className={classes.colVisibility} padding="dense">
+ {i18n.t("Visibility", { context: "table header" })}
+ </TableCell>
+ </>
+ }
+ />
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/pages/components/PageListPage/PageListPage.tsx b/saleor/static/dashboard-next/pages/components/PageListPage/PageListPage.tsx
index d8312b57ff..35cfa6849a 100644
--- a/saleor/static/dashboard-next/pages/components/PageListPage/PageListPage.tsx
+++ b/saleor/static/dashboard-next/pages/components/PageListPage/PageListPage.tsx
@@ -27,6 +27,7 @@ const PageListPage: React.StatelessComponent<PageListPageProps> = ({
isChecked,
selected,
toggle,
+ toggleAll,
toolbar
}) => (
<Container>
@@ -52,6 +53,7 @@ const PageListPage: React.StatelessComponent<PageListPageProps> = ({
isChecked={isChecked}
selected={selected}
toggle={toggle}
+ toggleAll={toggleAll}
toolbar={toolbar}
/>
</Container>
diff --git a/saleor/static/dashboard-next/pages/views/PageList.tsx b/saleor/static/dashboard-next/pages/views/PageList.tsx
index a3c601f382..c8c898cf1f 100644
--- a/saleor/static/dashboard-next/pages/views/PageList.tsx
+++ b/saleor/static/dashboard-next/pages/views/PageList.tsx
@@ -37,7 +37,7 @@ export const PageList: React.StatelessComponent<PageListProps> = ({
const navigate = useNavigator();
const notify = useNotifier();
const paginate = usePaginator();
- const { isSelected, listElements, reset, toggle } = useBulkActions(
+ const { isSelected, listElements, reset, toggle, toggleAll } = useBulkActions(
params.ids
);
@@ -150,6 +150,7 @@ export const PageList: React.StatelessComponent<PageListProps> = ({
isChecked={isSelected}
selected={listElements.length}
toggle={toggle}
+ toggleAll={toggleAll}
/>
<ActionDialog
open={params.action === "publish"}
diff --git a/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx b/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx
index 59ca4d5bd5..1c8eabb1b0 100644
--- a/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx
+++ b/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx
@@ -38,6 +38,9 @@ const styles = (theme: Theme) =>
colType: {},
link: {
cursor: "pointer"
+ },
+ relative: {
+ position: "relative"
}
});
@@ -60,24 +63,31 @@ const ProductTypeList = withStyles(styles, { name: "ProductTypeList" })(
isChecked,
selected,
toggle,
+ toggleAll,
toolbar
}: ProductTypeListProps) => (
<Card>
- <Table>
- <TableHead selected={selected} toolbar={toolbar}>
- <TableRow>
- <TableCell />
- <TableCell className={classes.colName}>
- {i18n.t("Type Name", { context: "table header" })}
- </TableCell>
- <TableCell className={classes.colType}>
- {i18n.t("Type", { context: "table header" })}
- </TableCell>
- <TableCell className={classes.colTax}>
- {i18n.t("Tax", { context: "table header" })}
- </TableCell>
- </TableRow>
- </TableHead>
+ <Table className={classes.relative}>
+ <TableHead
+ selected={selected}
+ disabled={disabled}
+ items={productTypes}
+ toggleAll={toggleAll}
+ toolbar={toolbar}
+ tablebar={
+ <>
+ <TableCell className={classes.colName}>
+ {i18n.t("Type Name", { context: "table header" })}
+ </TableCell>
+ <TableCell className={classes.colType}>
+ {i18n.t("Type", { context: "table header" })}
+ </TableCell>
+ <TableCell className={classes.colTax}>
+ {i18n.t("Tax", { context: "table header" })}
+ </TableCell>
+ </>
+ }
+ />
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/productTypes/views/ProductTypeList.tsx b/saleor/static/dashboard-next/productTypes/views/ProductTypeList.tsx
index c239c1d356..f914883311 100644
--- a/saleor/static/dashboard-next/productTypes/views/ProductTypeList.tsx
+++ b/saleor/static/dashboard-next/productTypes/views/ProductTypeList.tsx
@@ -34,7 +34,7 @@ export const ProductTypeList: React.StatelessComponent<
const navigate = useNavigator();
const notify = useNotifier();
const paginate = usePaginator();
- const { isSelected, listElements, reset, toggle } = useBulkActions(
+ const { isSelected, listElements, reset, toggle, toggleAll } = useBulkActions(
params.ids
);
@@ -103,6 +103,7 @@ export const ProductTypeList: React.StatelessComponent<
isChecked={isSelected}
selected={listElements.length}
toggle={toggle}
+ toggleAll={toggleAll}
toolbar={
<IconButton
color="primary"
diff --git a/saleor/static/dashboard-next/products/components/ProductListCard/ProductListCard.tsx b/saleor/static/dashboard-next/products/components/ProductListCard/ProductListCard.tsx
index cc0866aaac..74416278ba 100644
--- a/saleor/static/dashboard-next/products/components/ProductListCard/ProductListCard.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductListCard/ProductListCard.tsx
@@ -68,6 +68,7 @@ export const ProductListCard: React.StatelessComponent<
selected={selected}
isChecked={isChecked}
toggle={toggle}
+ toggleAll={toggleAll}
onNextPage={onNextPage}
onPreviousPage={onPreviousPage}
onRowClick={onRowClick}
diff --git a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
index f0ac0c15e0..6f40dda32a 100644
--- a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
@@ -126,6 +126,7 @@ export const ProductUpdate: React.StatelessComponent<ProductUpdateProps> = ({
isChecked,
selected,
toggle,
+ toggleAll,
toolbar
}) => {
const initialData: FormData = {
@@ -248,6 +249,7 @@ export const ProductUpdate: React.StatelessComponent<ProductUpdateProps> = ({
isChecked={isChecked}
selected={selected}
toggle={toggle}
+ toggleAll={toggleAll}
/>
) : (
<ProductStock
diff --git a/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx b/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx
index f33d274a8e..bd870970cb 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx
@@ -84,6 +84,7 @@ export const ProductVariants = withStyles(styles, { name: "ProductVariants" })(
isChecked,
selected,
toggle,
+ toggleAll,
toolbar
}: ProductVariantsProps) => (
<Card>
@@ -108,21 +109,29 @@ export const ProductVariants = withStyles(styles, { name: "ProductVariants" })(
</Typography>
</CardContent>
<Table className={classes.denseTable}>
- <TableHead selected={selected} toolbar={toolbar}>
- <TableRow>
- <TableCell />
- <TableCell className={classes.colName}>{i18n.t("Name")}</TableCell>
- <TableCell className={classes.colStatus}>
- {i18n.t("Status")}
- </TableCell>
- <TableCell className={classes.colSku}>{i18n.t("SKU")}</TableCell>
- <Hidden smDown>
- <TableCell className={classes.colPrice}>
- {i18n.t("Price")}
+ <TableHead
+ selected={selected}
+ disabled={disabled}
+ items={productTypes}
+ toggleAll={toggleAll}
+ toolbar={toolbar}
+ tablebar={
+ <>
+ <TableCell className={classes.colName}>
+ {i18n.t("Name")}
</TableCell>
- </Hidden>
- </TableRow>
- </TableHead>
+ <TableCell className={classes.colStatus}>
+ {i18n.t("Status")}
+ </TableCell>
+ <TableCell className={classes.colSku}>{i18n.t("SKU")}</TableCell>
+ <Hidden smDown>
+ <TableCell className={classes.colPrice}>
+ {i18n.t("Price")}
+ </TableCell>
+ </Hidden>
+ </>
+ }
+ />
<TableBody>
{renderCollection(
variants,
diff --git a/saleor/static/dashboard-next/products/views/ProductUpdate.tsx b/saleor/static/dashboard-next/products/views/ProductUpdate.tsx
index fbbb9c7e49..c61b4b5758 100644
--- a/saleor/static/dashboard-next/products/views/ProductUpdate.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductUpdate.tsx
@@ -303,6 +303,7 @@ export const ProductUpdate: React.StatelessComponent<ProductUpdateProps> = ({
isChecked={isSelected}
selected={listElements.length}
toggle={toggle}
+ toggleAll={toggleAll}
/>
<ActionDialog
open={params.action === "remove"}
diff --git a/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx b/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx
index b700774d77..a59cebb56c 100644
--- a/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx
+++ b/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx
@@ -46,6 +46,9 @@ const styles = (theme: Theme) =>
},
colCountries: {},
colName: {},
+ relative: {
+ position: "relative"
+ },
row: {
cursor: "pointer"
}
@@ -64,6 +67,7 @@ const ShippingZonesList = withStyles(styles, { name: "ShippingZonesList" })(
isChecked,
selected,
toggle,
+ toggleAll,
toolbar
}: ShippingZonesListProps & WithStyles<typeof styles>) => (
<Card>
@@ -78,19 +82,24 @@ const ShippingZonesList = withStyles(styles, { name: "ShippingZonesList" })(
</Button>
}
/>
- <Table>
- <TableHead selected={selected} toolbar={toolbar}>
- <TableRow>
- <TableCell />
- <TableCell className={classes.colName}>
- {i18n.t("Name", { context: "object" })}
- </TableCell>
- <TableCell className={classes.colCountries}>
- {i18n.t("Countries", { context: "object" })}
- </TableCell>
- <TableCell />
- </TableRow>
- </TableHead>
+ <Table className={classes.relative}>
+ <TableHead
+ selected={selected}
+ disabled={disabled}
+ items={shippingZones}
+ toggleAll={toggleAll}
+ toolbar={toolbar}
+ tablebar={
+ <>
+ <TableCell className={classes.colName}>
+ {i18n.t("Name", { context: "object" })}
+ </TableCell>
+ <TableCell className={classes.colCountries}>
+ {i18n.t("Countries", { context: "object" })}
+ </TableCell>
+ </>
+ }
+ />
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/shipping/views/ShippingZonesList.tsx b/saleor/static/dashboard-next/shipping/views/ShippingZonesList.tsx
index b0f4e8a1a3..034442f716 100644
--- a/saleor/static/dashboard-next/shipping/views/ShippingZonesList.tsx
+++ b/saleor/static/dashboard-next/shipping/views/ShippingZonesList.tsx
@@ -42,7 +42,7 @@ export const ShippingZonesList: React.StatelessComponent<
const notify = useNotifier();
const paginate = usePaginator();
const shop = useShop();
- const { isSelected, listElements, reset, toggle } = useBulkActions(
+ const { isSelected, listElements, reset, toggle, toggleAll } = useBulkActions(
params.ids
);
@@ -176,6 +176,7 @@ export const ShippingZonesList: React.StatelessComponent<
isChecked={isSelected}
selected={listElements.length}
toggle={toggle}
+ toggleAll={toggleAll}
toolbar={
<IconButton
color="primary"