ordering-ui-admin-external 1.42.7 → 1.42.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -166,6 +166,7 @@ var BusinessProductList = exports.BusinessProductList = function BusinessProduct
166
166
  }) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (isLazyLoadProducts ? categoryState.products : currentProducts).sort(function (a, b) {
167
167
  return a.rank - b.rank;
168
168
  }).map(function (product, i) {
169
+ var _categorySelected$sub;
169
170
  return /*#__PURE__*/_react.default.createElement(_SingleBusinessProduct.SingleBusinessProduct, _extends({}, props, {
170
171
  key: "".concat(product === null || product === void 0 ? void 0 : product.id, "_").concat(i),
171
172
  productDetailsId: productDetailsId,
@@ -176,7 +177,11 @@ var BusinessProductList = exports.BusinessProductList = function BusinessProduct
176
177
  dataSelected: dataSelected,
177
178
  setDataSelected: setDataSelected,
178
179
  category: categoryState,
179
- isLastProduct: currentProducts.length - 1 === i
180
+ isLastProduct: currentProducts.length - 1 === i,
181
+ hasSubcategories: categorySelected === null || categorySelected === void 0 || (_categorySelected$sub = categorySelected.subcategories) === null || _categorySelected$sub === void 0 ? void 0 : _categorySelected$sub.some(function (subcategory) {
182
+ var _subcategory$products;
183
+ return (subcategory === null || subcategory === void 0 || (_subcategory$products = subcategory.products) === null || _subcategory$products === void 0 ? void 0 : _subcategory$products.length) > 0;
184
+ })
180
185
  }));
181
186
  })))), /*#__PURE__*/_react.default.createElement(_styles2.ProductListBottom, null, !businessState.loading && (businessState === null || businessState === void 0 || (_businessState$busine2 = businessState.business) === null || _businessState$busine2 === void 0 || (_businessState$busine2 = _businessState$busine2.categories) === null || _businessState$busine2 === void 0 ? void 0 : _businessState$busine2.length) > 0 && categorySelected && /*#__PURE__*/_react.default.createElement(_styles2.AddProductBtnWrapper, null, /*#__PURE__*/_react.default.createElement(_styles.LinkButton, {
182
187
  onClick: function onClick() {
@@ -48,7 +48,8 @@ var SingleBusinessProductUI = function SingleBusinessProductUI(props) {
48
48
  handleDrop = props.handleDrop,
49
49
  handleDragEnd = props.handleDragEnd,
50
50
  isLastProduct = props.isLastProduct,
51
- isProductsBottom = props.isProductsBottom;
51
+ isProductsBottom = props.isProductsBottom,
52
+ hasSubcategories = props.hasSubcategories;
52
53
  var theme = (0, _styledComponents.useTheme)();
53
54
  var _useLanguage = (0, _orderingComponentsAdminExternal.useLanguage)(),
54
55
  _useLanguage2 = _slicedToArray(_useLanguage, 2),
@@ -171,7 +172,7 @@ var SingleBusinessProductUI = function SingleBusinessProductUI(props) {
171
172
  onDragEnd: function onDragEnd(e) {
172
173
  return handleDragEnd(e);
173
174
  },
174
- className: "draggable-product",
175
+ className: !hasSubcategories ? 'draggable-product' : '',
175
176
  "data-index": product.id,
176
177
  isAccept: dataSelected && dataSelected === (product === null || product === void 0 || (_product$id = product.id) === null || _product$id === void 0 ? void 0 : _product$id.toString()),
177
178
  isBorderBottom: isProductsBottom && isLastProduct
@@ -179,12 +180,12 @@ var SingleBusinessProductUI = function SingleBusinessProductUI(props) {
179
180
  className: "products"
180
181
  }, /*#__PURE__*/_react.default.createElement(_styles.DragableContainer, {
181
182
  className: "product_info"
182
- }, /*#__PURE__*/_react.default.createElement(_styles.DragImageWrapper, null, /*#__PURE__*/_react.default.createElement("img", {
183
+ }, /*#__PURE__*/_react.default.createElement(_styles.DragImageWrapper, null, !hasSubcategories && /*#__PURE__*/_react.default.createElement("img", {
183
184
  src: (_theme$images$icons = theme.images.icons) === null || _theme$images$icons === void 0 ? void 0 : _theme$images$icons.sixDots,
184
185
  alt: "six dots",
185
- draggable: true,
186
+ draggable: !hasSubcategories,
186
187
  onDragStart: function onDragStart(e) {
187
- return handleDragStart === null || handleDragStart === void 0 ? void 0 : handleDragStart(e, product.id);
188
+ return handleDragStart === null || handleDragStart === void 0 ? void 0 : handleDragStart(e, product);
188
189
  }
189
190
  })), /*#__PURE__*/_react.default.createElement(_styles.BusinessGeneralInfo, null, /*#__PURE__*/_react.default.createElement(_styles.ProductTypeImage, {
190
191
  onClick: function onClick() {
@@ -62,7 +62,7 @@ var UploadWrapper = exports.UploadWrapper = _styledComponents.default.div(_templ
62
62
  return props.theme.colors.lightGray;
63
63
  });
64
64
  var DragableContainer = exports.DragableContainer = _styledComponents.default.div(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n"])));
65
- var DragImageWrapper = exports.DragImageWrapper = _styledComponents.default.div(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["\n img {\n ", "\n &:hover {\n cursor: grab;\n }\n }\n"])), function (props) {
65
+ var DragImageWrapper = exports.DragImageWrapper = _styledComponents.default.div(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["\n ", "\n\n img {\n &:hover {\n cursor: grab;\n }\n }\n"])), function (props) {
66
66
  var _props$theme4;
67
67
  return (_props$theme4 = props.theme) !== null && _props$theme4 !== void 0 && _props$theme4.rtl ? (0, _styledComponents.css)(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["\n margin-left: 14px;\n "]))) : (0, _styledComponents.css)(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral(["\n margin-right: 14px;\n "])));
68
68
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-admin-external",
3
- "version": "1.42.7",
3
+ "version": "1.42.8",
4
4
  "description": "Ordering UI Admin Components",
5
5
  "main": "./_modules/index.js",
6
6
  "exports": {
@@ -83,7 +83,7 @@
83
83
  "lodash": "^4.17.20",
84
84
  "moment": "^2.29.1",
85
85
  "moment-range": "^4.0.2",
86
- "ordering-components-admin-external": "1.42.4",
86
+ "ordering-components-admin-external": "1.42.5",
87
87
  "polished": "^3.6.7",
88
88
  "prop-types": "^15.7.2",
89
89
  "react-big-calendar": "^1.4.2",
@@ -187,6 +187,7 @@ export const BusinessProductList = (props) => {
187
187
  setDataSelected={setDataSelected}
188
188
  category={categoryState}
189
189
  isLastProduct={currentProducts.length - 1 === i}
190
+ hasSubcategories={categorySelected?.subcategories?.some(subcategory => subcategory?.products?.length > 0)}
190
191
  />
191
192
  ))
192
193
  }
@@ -45,7 +45,8 @@ const SingleBusinessProductUI = (props) => {
45
45
  handleDrop,
46
46
  handleDragEnd,
47
47
  isLastProduct,
48
- isProductsBottom
48
+ isProductsBottom,
49
+ hasSubcategories
49
50
  } = props
50
51
 
51
52
  const theme = useTheme()
@@ -189,7 +190,7 @@ const SingleBusinessProductUI = (props) => {
189
190
  onDragOver={e => handleDragOver?.(e, isLastProduct)}
190
191
  onDrop={e => handleDrop(e)}
191
192
  onDragEnd={e => handleDragEnd(e)}
192
- className='draggable-product'
193
+ className={!hasSubcategories ? 'draggable-product' : ''}
193
194
  data-index={product.id}
194
195
  isAccept={dataSelected && dataSelected === product?.id?.toString()}
195
196
  isBorderBottom={isProductsBottom && isLastProduct}
@@ -199,12 +200,14 @@ const SingleBusinessProductUI = (props) => {
199
200
  <td className='products'>
200
201
  <DragableContainer className='product_info'>
201
202
  <DragImageWrapper>
202
- <img
203
- src={theme.images.icons?.sixDots}
204
- alt='six dots'
205
- draggable
206
- onDragStart={e => handleDragStart?.(e, product.id)}
207
- />
203
+ {!hasSubcategories && (
204
+ <img
205
+ src={theme.images.icons?.sixDots}
206
+ alt='six dots'
207
+ draggable={!hasSubcategories}
208
+ onDragStart={e => handleDragStart?.(e, product)}
209
+ />
210
+ )}
208
211
  </DragImageWrapper>
209
212
  <BusinessGeneralInfo>
210
213
  <ProductTypeImage
@@ -160,12 +160,13 @@ export const DragableContainer = styled.div`
160
160
  `
161
161
 
162
162
  export const DragImageWrapper = styled.div`
163
- img {
164
- ${props => props.theme?.rtl ? css`
163
+ ${props => props.theme?.rtl ? css`
165
164
  margin-left: 14px;
166
165
  ` : css`
167
166
  margin-right: 14px;
168
167
  `}
168
+
169
+ img {
169
170
  &:hover {
170
171
  cursor: grab;
171
172
  }