Skip to content

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

Do not propagate clicke event from bulk actions

dominik-zeglene3594742d34a
diff --git a/saleor/static/dashboard-next/attributes/components/AttributeList/AttributeList.tsx b/saleor/static/dashboard-next/attributes/components/AttributeList/AttributeList.tsx
index 3a0e2ace8e..b3826b85d5 100644
--- a/saleor/static/dashboard-next/attributes/components/AttributeList/AttributeList.tsx
+++ b/saleor/static/dashboard-next/attributes/components/AttributeList/AttributeList.tsx
@@ -12,7 +12,7 @@ import Skeleton from "@saleor/components/Skeleton";
import TableHead from "@saleor/components/TableHead";
import TablePagination from "@saleor/components/TablePagination";
import i18n from "@saleor/i18n";
-import { renderCollection } from "@saleor/misc";
+import { renderCollection, stopPropagation } from "@saleor/misc";
import { ListActions, ListProps } from "@saleor/types";
import { translateBoolean } from "@saleor/utils/i18n";
import { AttributeList_attributes_edges_node } from "../../types/AttributeList";
@@ -133,6 +133,7 @@ const AttributeList: React.StatelessComponent<AttributeListProps> = ({
<Checkbox
checked={isSelected}
disabled={disabled}
+ disableClickPropagation
onChange={() => toggle(attribute.id)}
/>
</TableCell>
diff --git a/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx b/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx
index c4d11a78d8..293e04830e 100644
--- a/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx
+++ b/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx
@@ -151,6 +151,7 @@ const CategoryList = withStyles(styles, { name: "CategoryList" })(
<Checkbox
checked={isSelected}
disabled={disabled}
+ disableClickPropagation
onChange={() => toggle(category.id)}
/>
</TableCell>
diff --git a/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx b/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx
index 9e647beced..fd63f69a33 100644
--- a/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx
+++ b/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx
@@ -123,6 +123,7 @@ const CollectionList = withStyles(styles, { name: "CollectionList" })(
<Checkbox
checked={isSelected}
disabled={disabled}
+ disableClickPropagation
onChange={() => toggle(collection.id)}
/>
</TableCell>
diff --git a/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsx b/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsx
index 8aff1808ff..b957a489a6 100644
--- a/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsx
+++ b/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsx
@@ -159,6 +159,7 @@ const CollectionProducts = withStyles(styles, { name: "CollectionProducts" })(
<Checkbox
checked={isSelected}
disabled={disabled}
+ disableClickPropagation
onChange={() => toggle(product.id)}
/>
</TableCell>
diff --git a/saleor/static/dashboard-next/components/Checkbox/Checkbox.tsx b/saleor/static/dashboard-next/components/Checkbox/Checkbox.tsx
index df6fd1b7dc..63dd179890 100644
--- a/saleor/static/dashboard-next/components/Checkbox/Checkbox.tsx
+++ b/saleor/static/dashboard-next/components/Checkbox/Checkbox.tsx
@@ -18,7 +18,9 @@ export type CheckboxProps = Omit<
| "indeterminateIcon"
| "classes"
| "onChange"
+ | "onClick"
> & {
+ disableClickPropagation?: boolean;
onChange?: (event: React.ChangeEvent<any>) => void;
};
@@ -81,9 +83,9 @@ const Checkbox = withStyles(styles, { name: "Checkbox" })(
className,
classes,
disabled,
+ disableClickPropagation,
indeterminate,
onChange,
- onClick,
value,
name,
...props
@@ -95,7 +97,14 @@ const Checkbox = withStyles(styles, { name: "Checkbox" })(
centerRipple
className={classNames(classes.root, className)}
disabled={disabled}
- onClick={() => inputRef.current.click()}
+ onClick={
+ disableClickPropagation
+ ? event => {
+ event.stopPropagation();
+ inputRef.current.click();
+ }
+ : () => inputRef.current.click()
+ }
>
<input
className={classNames(classes.box, {
diff --git a/saleor/static/dashboard-next/components/ControlledCheckbox.tsx b/saleor/static/dashboard-next/components/ControlledCheckbox.tsx
index 8ce485c108..aef9e52e2c 100644
--- a/saleor/static/dashboard-next/components/ControlledCheckbox.tsx
+++ b/saleor/static/dashboard-next/components/ControlledCheckbox.tsx
@@ -20,7 +20,7 @@ export const ControlledCheckbox: React.StatelessComponent<
<Checkbox
checked={checked}
name={name}
- onClick={() => onChange({ target: { name, value: !checked } })}
+ disableClickPropagation
onChange={() => onChange({ target: { name, value: !checked } })}
/>
}
diff --git a/saleor/static/dashboard-next/components/ProductList/ProductList.tsx b/saleor/static/dashboard-next/components/ProductList/ProductList.tsx
index 3cd1d08c67..4aa0b39dad 100644
--- a/saleor/static/dashboard-next/components/ProductList/ProductList.tsx
+++ b/saleor/static/dashboard-next/components/ProductList/ProductList.tsx
@@ -178,6 +178,7 @@ export const ProductList = withStyles(styles, { name: "ProductList" })(
<Checkbox
checked={isSelected}
disabled={disabled}
+ disableClickPropagation
onChange={() => toggle(product.id)}
/>
</TableCell>
diff --git a/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx b/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx
index 6bdef683fe..5381f23f66 100644
--- a/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx
+++ b/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx
@@ -119,6 +119,7 @@ const CustomerList = withStyles(styles, { name: "CustomerList" })(
<Checkbox
checked={isSelected}
disabled={disabled}
+ disableClickPropagation
onChange={() => toggle(customer.id)}
/>
</TableCell>
diff --git a/saleor/static/dashboard-next/discounts/components/DiscountCategories/DiscountCategories.tsx b/saleor/static/dashboard-next/discounts/components/DiscountCategories/DiscountCategories.tsx
index 606b256937..80189cf00b 100644
--- a/saleor/static/dashboard-next/discounts/components/DiscountCategories/DiscountCategories.tsx
+++ b/saleor/static/dashboard-next/discounts/components/DiscountCategories/DiscountCategories.tsx
@@ -131,6 +131,7 @@ const DiscountCategories = withStyles(styles, {
<Checkbox
checked={isSelected}
disabled={disabled}
+ disableClickPropagation
onChange={() => toggle(category.id)}
/>
</TableCell>
diff --git a/saleor/static/dashboard-next/discounts/components/DiscountCollections/DiscountCollections.tsx b/saleor/static/dashboard-next/discounts/components/DiscountCollections/DiscountCollections.tsx
index fe897e1c16..f863204dbb 100644
--- a/saleor/static/dashboard-next/discounts/components/DiscountCollections/DiscountCollections.tsx
+++ b/saleor/static/dashboard-next/discounts/components/DiscountCollections/DiscountCollections.tsx
@@ -128,6 +128,7 @@ const DiscountCollections = withStyles(styles, {
<Checkbox
checked={isSelected}
disabled={disabled}
+ disableClickPropagation
onChange={() => toggle(collection.id)}
/>
</TableCell>
diff --git a/saleor/static/dashboard-next/discounts/components/DiscountProducts/DiscountProducts.tsx b/saleor/static/dashboard-next/discounts/components/DiscountProducts/DiscountProducts.tsx
index 85d4ce93a0..3910cfad99 100644
--- a/saleor/static/dashboard-next/discounts/components/DiscountProducts/DiscountProducts.tsx
+++ b/saleor/static/dashboard-next/discounts/components/DiscountProducts/DiscountProducts.tsx
@@ -146,6 +146,7 @@ const DiscountProducts = withStyles(styles, {
<Checkbox
checked={isSelected}
disabled={disabled}
+ disableClickPropagation
onChange={() => toggle(product.id)}
/>
</TableCell>
diff --git a/saleor/static/dashboard-next/discounts/components/SaleList/SaleList.tsx b/saleor/static/dashboard-next/discounts/components/SaleList/SaleList.tsx
index 37a1c75934..54669a3f1a 100644
--- a/saleor/static/dashboard-next/discounts/components/SaleList/SaleList.tsx
+++ b/saleor/static/dashboard-next/discounts/components/SaleList/SaleList.tsx
@@ -145,6 +145,7 @@ const SaleList = withStyles(styles, {
<Checkbox
checked={isSelected}
disabled={disabled}
+ disableClickPropagation
onChange={() => toggle(sale.id)}
/>
</TableCell>
diff --git a/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx b/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx
index 9b836bbac9..0c8dda994c 100644
--- a/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx
+++ b/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx
@@ -170,6 +170,7 @@ const VoucherList = withStyles(styles, {
<Checkbox
checked={isSelected}
disabled={disabled}
+ disableClickPropagation
onChange={() => toggle(voucher.id)}
/>
</TableCell>
diff --git a/saleor/static/dashboard-next/navigation/components/MenuList/MenuList.tsx b/saleor/static/dashboard-next/navigation/components/MenuList/MenuList.tsx
index 79b387d498..75c89ef232 100644
--- a/saleor/static/dashboard-next/navigation/components/MenuList/MenuList.tsx
+++ b/saleor/static/dashboard-next/navigation/components/MenuList/MenuList.tsx
@@ -115,6 +115,7 @@ const MenuList = withStyles(styles, { name: "MenuList" })(
<Checkbox
checked={isSelected}
disabled={disabled}
+ disableClickPropagation
onChange={() => toggle(menu.id)}
/>
</TableCell>
diff --git a/saleor/static/dashboard-next/orders/components/OrderDraftList/OrderDraftList.tsx b/saleor/static/dashboard-next/orders/components/OrderDraftList/OrderDraftList.tsx
index 29d958fc43..8ebfde6335 100644
--- a/saleor/static/dashboard-next/orders/components/OrderDraftList/OrderDraftList.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderDraftList/OrderDraftList.tsx
@@ -141,6 +141,7 @@ export const OrderDraftList = withStyles(styles, { name: "OrderDraftList" })(
<Checkbox
checked={isSelected}
disabled={disabled}
+ disableClickPropagation
onChange={() => toggle(order.id)}
/>
</TableCell>
diff --git a/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx b/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx
index e1685d1df0..c0b772ab7d 100644
--- a/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx
@@ -154,6 +154,7 @@ export const OrderList = withStyles(styles, { name: "OrderList" })(
<Checkbox
checked={isSelected}
disabled={disabled}
+ disableClickPropagation
onChange={() => toggle(order.id)}
/>
</TableCell>
diff --git a/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx b/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx
index eca265c995..dc3ac0b36c 100644
--- a/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx
+++ b/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx
@@ -117,6 +117,7 @@ const PageList = withStyles(styles, { name: "PageList" })(
<Checkbox
checked={isSelected}
disabled={disabled}
+ disableClickPropagation
onChange={() => toggle(page.id)}
/>
</TableCell>
diff --git a/saleor/static/dashboard-next/productTypes/components/ProductTypeAttributes/ProductTypeAttributes.tsx b/saleor/static/dashboard-next/productTypes/components/ProductTypeAttributes/ProductTypeAttributes.tsx
index 423e7a472a..99087212cb 100644
--- a/saleor/static/dashboard-next/productTypes/components/ProductTypeAttributes/ProductTypeAttributes.tsx
+++ b/saleor/static/dashboard-next/productTypes/components/ProductTypeAttributes/ProductTypeAttributes.tsx
@@ -138,6 +138,7 @@ const ProductTypeAttributes = withStyles(styles, {
<Checkbox
checked={isSelected}
disabled={disabled}
+ disableClickPropagation
onChange={() => toggle(attribute.id)}
/>
</TableCell>
diff --git a/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx b/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx
index 5cad3c83af..1e2fdfc5a3 100644
--- a/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx
+++ b/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx
@@ -117,6 +117,7 @@ const ProductTypeList = withStyles(styles, { name: "ProductTypeList" })(
<Checkbox
checked={isSelected}
disabled={disabled}
+ disableClickPropagation
onChange={() => toggle(productType.id)}
/>
</TableCell>
diff --git a/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx b/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx
index 3a0d9fde06..6784d352de 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx
@@ -148,6 +148,7 @@ export const ProductVariants = withStyles(styles, { name: "ProductVariants" })(
<Checkbox
checked={isSelected}
disabled={disabled}
+ disableClickPropagation
onChange={() => toggle(variant.id)}
/>
</TableCell>
diff --git a/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx b/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx
index bd82514823..f38a21ab69 100644
--- a/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx
+++ b/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx
@@ -136,6 +136,7 @@ const ShippingZonesList = withStyles(styles, { name: "ShippingZonesList" })(
<Checkbox
checked={isSelected}
disabled={disabled}
+ disableClickPropagation
onChange={() => toggle(shippingZone.id)}
/>
</TableCell>