@pisell/materials 1.8.55 → 1.8.56

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.
@@ -15,5 +15,9 @@
15
15
  overflow: hidden;
16
16
  text-overflow: ellipsis;
17
17
  margin: 0;
18
+
19
+ .resource-icon {
20
+ margin-right: 2px;
21
+ }
18
22
  }
19
23
  }
@@ -12,6 +12,7 @@ import Promotion from "../cartSkuCard/components/Promotion/index.js";
12
12
  import Gift from "../cartSkuCard/components/Gift/index.js";
13
13
  import LineItemTimeRange from "./components/TimeRange/index.js";
14
14
  import LineItemResources from "./components/Resources/index.js";
15
+ import LineItemHolders from "./components/Holders/index.js";
15
16
  import React, { useMemo } from "react";
16
17
  import { locales } from "@pisell/utils";
17
18
  import { Button, Divider, Dropdown } from "antd";
@@ -27,6 +28,7 @@ const _excluded = [
27
28
  "rightActions",
28
29
  "escapeDom",
29
30
  "isShowImage",
31
+ "isFormSubject",
30
32
  "isShowDelete",
31
33
  "isShowNote",
32
34
  "isShowAmountFooter",
@@ -36,6 +38,7 @@ const _excluded = [
36
38
  "statusLoading",
37
39
  "statusDisabled",
38
40
  "isShowRelatedProduct",
41
+ "holderOptions",
39
42
  "onBookingStatusChange",
40
43
  "onAction",
41
44
  "onDelete",
@@ -77,8 +80,8 @@ const getResourceName = (booking, translationOriginal) => {
77
80
  }).filter(Boolean).join(", ");
78
81
  };
79
82
  const BookingLineItem = (props) => {
80
- var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _dataSource$promotion;
81
- const { dataSource, type, cartSkuType, relatedProductDataSource, rightActions = [], escapeDom, isShowImage, isShowDelete, isShowNote, isShowAmountFooter, disabledClick, disabledEdit, statusOptions = [], statusLoading = false, statusDisabled = false, isShowRelatedProduct = true, onBookingStatusChange, onAction, onDelete, onNote, onCard, onPromotion, onGift } = props, other = _objectWithoutProperties(props, _excluded);
83
+ var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _ref, _ref2, _dataSource$promotion;
84
+ const { dataSource, type, cartSkuType, relatedProductDataSource, rightActions = [], escapeDom, isShowImage, isFormSubject, isShowDelete, isShowNote, isShowAmountFooter, disabledClick, disabledEdit, statusOptions = [], statusLoading = false, statusDisabled = false, isShowRelatedProduct = true, holderOptions, onBookingStatusChange, onAction, onDelete, onNote, onCard, onPromotion, onGift } = props, other = _objectWithoutProperties(props, _excluded);
82
85
  const context = useEngineContext();
83
86
  const translationOriginal = context.appHelper.utils.translationOriginal;
84
87
  const locale = ((_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut.getApp) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.call(_context$appHelper$ut)) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.locales) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut3 = _context$appHelper$ut2.getLocale) === null || _context$appHelper$ut3 === void 0 ? void 0 : _context$appHelper$ut3.call(_context$appHelper$ut2)) || ((_context$appHelper$ut4 = context.appHelper.utils) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut4.storage) === null || _context$appHelper$ut4 === void 0 ? void 0 : _context$appHelper$ut4.get("umi_locale")) || "en-US";
@@ -101,6 +104,8 @@ const BookingLineItem = (props) => {
101
104
  }
102
105
  };
103
106
  const bookingRightActions = isShowDelete ? [deleteAction, ...rightActions] : rightActions;
107
+ const resolvedHolderOptions = (_ref = (_ref2 = holderOptions !== null && holderOptions !== void 0 ? holderOptions : dataSource === null || dataSource === void 0 ? void 0 : dataSource.holderOptions) !== null && _ref2 !== void 0 ? _ref2 : dataSource === null || dataSource === void 0 ? void 0 : dataSource.holders) !== null && _ref !== void 0 ? _ref : [];
108
+ const resolvedIsFormSubject = isFormSubject !== null && isFormSubject !== void 0 ? isFormSubject : dataSource === null || dataSource === void 0 ? void 0 : dataSource.isFormSubject;
104
109
  const bookingTitle = String((dataSource === null || dataSource === void 0 ? void 0 : dataSource.booking_id) || "");
105
110
  formatBookingTime(dataSource, locale);
106
111
  getResourceName(dataSource, translationOriginal);
@@ -149,7 +154,11 @@ const BookingLineItem = (props) => {
149
154
  e.stopPropagation();
150
155
  onDelete === null || onDelete === void 0 || onDelete(dataSource);
151
156
  }
152
- }, /* @__PURE__ */ React.createElement(IconFont, { type: "pisell2-trash-01" })) : null))), /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__booking-detail` }, /* @__PURE__ */ React.createElement(LineItemTimeRange, { dataSource }), /* @__PURE__ */ React.createElement(LineItemResources, { dataSource })), isShowRelatedProduct && relatedProductDataSource ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Divider, { style: { margin: 0 } }), /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__related-product` }, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__related-product-card` }, /* @__PURE__ */ React.createElement(BasicInfo, {
157
+ }, /* @__PURE__ */ React.createElement(IconFont, { type: "pisell2-trash-01" })) : null))), /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__booking-detail` }, /* @__PURE__ */ React.createElement(LineItemTimeRange, { dataSource }), /* @__PURE__ */ React.createElement(LineItemResources, { dataSource }), resolvedIsFormSubject ? /* @__PURE__ */ React.createElement(LineItemHolders, {
158
+ dataSource,
159
+ holderOptions: resolvedHolderOptions,
160
+ isFormSubject: resolvedIsFormSubject
161
+ }) : null), isShowRelatedProduct && relatedProductDataSource ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Divider, { style: { margin: 0 } }), /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__related-product` }, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__related-product-card` }, /* @__PURE__ */ React.createElement(BasicInfo, {
153
162
  isShowImage,
154
163
  dataSource: relatedProductDataSource,
155
164
  type: cartSkuType,
@@ -0,0 +1,51 @@
1
+ import IconFont from "../../../../iconfont/index.js";
2
+ import React, { useMemo } from "react";
3
+ import { locales } from "@pisell/utils";
4
+ import "./index.less";
5
+ //#region src/components/productCard/lineItem/components/Holders/index.tsx
6
+ const PREFIX = "pisell-line-item";
7
+ const holderIconMap = {
8
+ form: "pisell2-file-05",
9
+ minors: "pisell2-user-check-01",
10
+ waiver: "pisell2-file-lock-03"
11
+ };
12
+ const isEmptyHolderId = (value) => {
13
+ if (Array.isArray(value)) return value.length === 0;
14
+ return value === void 0 || value === null || value === "";
15
+ };
16
+ const normalizeHolderIds = (value) => {
17
+ if (isEmptyHolderId(value)) return [];
18
+ return Array.isArray(value) ? value : [value];
19
+ };
20
+ const pickHolderId = (dataSource) => {
21
+ var _ref, _ref2, _dataSource$holder_id, _dataSource$metadata, _dataSource$_extend, _dataSource$_extend2;
22
+ return (_ref = (_ref2 = (_dataSource$holder_id = dataSource === null || dataSource === void 0 ? void 0 : dataSource.holder_id) !== null && _dataSource$holder_id !== void 0 ? _dataSource$holder_id : dataSource === null || dataSource === void 0 || (_dataSource$metadata = dataSource.metadata) === null || _dataSource$metadata === void 0 ? void 0 : _dataSource$metadata.holder_id) !== null && _ref2 !== void 0 ? _ref2 : dataSource === null || dataSource === void 0 || (_dataSource$_extend = dataSource._extend) === null || _dataSource$_extend === void 0 || (_dataSource$_extend = _dataSource$_extend.product) === null || _dataSource$_extend === void 0 || (_dataSource$_extend = _dataSource$_extend.metadata) === null || _dataSource$_extend === void 0 ? void 0 : _dataSource$_extend.holder_id) !== null && _ref !== void 0 ? _ref : dataSource === null || dataSource === void 0 || (_dataSource$_extend2 = dataSource._extend) === null || _dataSource$_extend2 === void 0 || (_dataSource$_extend2 = _dataSource$_extend2.product) === null || _dataSource$_extend2 === void 0 || (_dataSource$_extend2 = _dataSource$_extend2._extend) === null || _dataSource$_extend2 === void 0 ? void 0 : _dataSource$_extend2.holder_id;
23
+ };
24
+ const pickHolderMaxCount = (dataSource, holderIds) => {
25
+ var _ref3, _ref4, _ref5, _ref6, _ref7, _dataSource$holderMax, _dataSource$_extend3, _dataSource$_extend4, _dataSource$_extend5;
26
+ const count = ((_ref3 = (_ref4 = (_ref5 = (_ref6 = (_ref7 = (_dataSource$holderMax = dataSource === null || dataSource === void 0 ? void 0 : dataSource.holderMaxCount) !== null && _dataSource$holderMax !== void 0 ? _dataSource$holderMax : dataSource === null || dataSource === void 0 ? void 0 : dataSource.holder_max_count) !== null && _ref7 !== void 0 ? _ref7 : dataSource === null || dataSource === void 0 ? void 0 : dataSource.number) !== null && _ref6 !== void 0 ? _ref6 : dataSource === null || dataSource === void 0 || (_dataSource$_extend3 = dataSource._extend) === null || _dataSource$_extend3 === void 0 || (_dataSource$_extend3 = _dataSource$_extend3.product) === null || _dataSource$_extend3 === void 0 ? void 0 : _dataSource$_extend3.num) !== null && _ref5 !== void 0 ? _ref5 : dataSource === null || dataSource === void 0 || (_dataSource$_extend4 = dataSource._extend) === null || _dataSource$_extend4 === void 0 || (_dataSource$_extend4 = _dataSource$_extend4.product) === null || _dataSource$_extend4 === void 0 ? void 0 : _dataSource$_extend4.product_quantity) !== null && _ref4 !== void 0 ? _ref4 : dataSource === null || dataSource === void 0 || (_dataSource$_extend5 = dataSource._extend) === null || _dataSource$_extend5 === void 0 || (_dataSource$_extend5 = _dataSource$_extend5.product) === null || _dataSource$_extend5 === void 0 || (_dataSource$_extend5 = _dataSource$_extend5._extend) === null || _dataSource$_extend5 === void 0 ? void 0 : _dataSource$_extend5.quantity) !== null && _ref3 !== void 0 ? _ref3 : holderIds.length) || 1;
27
+ return Number(count) || 1;
28
+ };
29
+ const LineItemHolders = (props) => {
30
+ const { dataSource = {}, holderOptions = [], isFormSubject } = props;
31
+ const holderIds = useMemo(() => normalizeHolderIds(pickHolderId(dataSource)), [dataSource]);
32
+ const holderMaxCount = pickHolderMaxCount(dataSource, holderIds);
33
+ const showUnassigned = Boolean(isFormSubject || (dataSource === null || dataSource === void 0 ? void 0 : dataSource.isFormSubject));
34
+ const holderIcon = holderIconMap[(dataSource === null || dataSource === void 0 ? void 0 : dataSource.holderType) || (dataSource === null || dataSource === void 0 ? void 0 : dataSource.holder_type) || "minors"] || holderIconMap.minors;
35
+ if (!holderIds.length) {
36
+ if (!showUnassigned) return null;
37
+ return /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__holders` }, /* @__PURE__ */ React.createElement("div", { className: "holder-item unassigned" }, holderMaxCount > 1 ? /* @__PURE__ */ React.createElement("span", null, holderMaxCount, "/", holderMaxCount, " ") : null, /* @__PURE__ */ React.createElement("span", { className: "holder-label" }, locales.getText("pisell2.cart.sku-card.unassigned"))));
38
+ }
39
+ const renderHolder = (id, index) => {
40
+ var _holder$label;
41
+ const holder = holderOptions.find((item) => String(item.id) === String(id));
42
+ const label = (_holder$label = holder === null || holder === void 0 ? void 0 : holder.label) !== null && _holder$label !== void 0 ? _holder$label : String(id);
43
+ return /* @__PURE__ */ React.createElement("div", {
44
+ className: "holder-item",
45
+ key: `${id}-${index}`
46
+ }, /* @__PURE__ */ React.createElement("span", { className: "holder-icon" }, /* @__PURE__ */ React.createElement(IconFont, { type: holderIcon })), /* @__PURE__ */ React.createElement("span", { className: "holder-label" }, label));
47
+ };
48
+ return /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__holders` }, holderIds.map((id, index) => renderHolder(id, index)));
49
+ };
50
+ //#endregion
51
+ export { LineItemHolders as default };
@@ -0,0 +1,39 @@
1
+ .pisell-line-item__holders {
2
+ user-select: none;
3
+ display: flex;
4
+ gap: 16px;
5
+ overflow: hidden;
6
+
7
+ .holder-item {
8
+ min-width: 30px;
9
+ display: flex;
10
+ align-items: center;
11
+ overflow: hidden;
12
+ white-space: nowrap;
13
+
14
+ .holder-icon {
15
+ margin-right: 2px;
16
+ color: #7f56da;
17
+ font-size: 16px;
18
+ }
19
+
20
+ .holder-label {
21
+ display: inline-block;
22
+ overflow: hidden;
23
+ color: #667085;
24
+ font-size: 14px;
25
+ font-weight: 500;
26
+ line-height: 20px;
27
+ text-overflow: ellipsis;
28
+ white-space: nowrap;
29
+ }
30
+ }
31
+
32
+ .unassigned {
33
+ color: red;
34
+
35
+ .holder-label {
36
+ color: red;
37
+ }
38
+ }
39
+ }
@@ -26,6 +26,7 @@ const _excluded = [
26
26
  "statusLoading",
27
27
  "statusDisabled",
28
28
  "isShowRelatedProduct",
29
+ "holderOptions",
29
30
  "onBookingStatusChange",
30
31
  "onAction",
31
32
  "onDelete",
@@ -126,7 +127,7 @@ const convertProductToLineItemProduct = (product, translationOriginal, symbol) =
126
127
  };
127
128
  const LineItem = (props) => {
128
129
  var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _dataSource$_extend2;
129
- const { dataSource = defaultValue.dataSource, itemType, type = "a9", rightActions = [], escapeDom, isShowImage = defaultValue.isShowImage, isShowDelete = defaultValue.isShowDelete, isShowNote = defaultValue.isShowNote, isShowAmountFooter = defaultValue.isShowAmountFooter, disabledClick = defaultValue.disabledClick, disabledEdit = defaultValue.disabledEdit, statusOptions = [], statusLoading = false, statusDisabled = false, isShowRelatedProduct = true, onBookingStatusChange, onAction, onDelete, onNote, onCard, onPromotion, onGift } = props, other = _objectWithoutProperties(props, _excluded);
130
+ const { dataSource = defaultValue.dataSource, itemType, type = "a9", rightActions = [], escapeDom, isShowImage = defaultValue.isShowImage, isShowDelete = defaultValue.isShowDelete, isShowNote = defaultValue.isShowNote, isShowAmountFooter = defaultValue.isShowAmountFooter, disabledClick = defaultValue.disabledClick, disabledEdit = defaultValue.disabledEdit, statusOptions = [], statusLoading = false, statusDisabled = false, isShowRelatedProduct = true, holderOptions, onBookingStatusChange, onAction, onDelete, onNote, onCard, onPromotion, onGift } = props, other = _objectWithoutProperties(props, _excluded);
130
131
  const context = useEngineContext();
131
132
  const translationOriginal = context.appHelper.utils.translationOriginal;
132
133
  const symbol = context.appHelper.utils.getSymbolic();
@@ -183,6 +184,7 @@ const LineItem = (props) => {
183
184
  statusLoading,
184
185
  statusDisabled,
185
186
  isShowRelatedProduct,
187
+ holderOptions,
186
188
  onBookingStatusChange,
187
189
  onAction,
188
190
  onDelete,
@@ -66,6 +66,7 @@ type productType = {
66
66
  */
67
67
  type ProductCardTypes = {
68
68
  dataSource: productType;
69
+ isFormSubject?: boolean;
69
70
  isShowImage?: boolean;
70
71
  isShowOriginalPrice?: boolean;
71
72
  isShowHolder?: boolean;
@@ -15,5 +15,9 @@
15
15
  overflow: hidden;
16
16
  text-overflow: ellipsis;
17
17
  margin: 0;
18
+
19
+ .resource-icon {
20
+ margin-right: 2px;
21
+ }
18
22
  }
19
23
  }
@@ -13,6 +13,7 @@ const require_index$7 = require("../cartSkuCard/components/Promotion/index.js");
13
13
  const require_index$8 = require("../cartSkuCard/components/Gift/index.js");
14
14
  const require_index$9 = require("./components/TimeRange/index.js");
15
15
  const require_index$10 = require("./components/Resources/index.js");
16
+ const require_index$11 = require("./components/Holders/index.js");
16
17
  let react = require("react");
17
18
  react = require_runtime.__toESM(react);
18
19
  let _pisell_utils = require("@pisell/utils");
@@ -31,6 +32,7 @@ const _excluded = [
31
32
  "rightActions",
32
33
  "escapeDom",
33
34
  "isShowImage",
35
+ "isFormSubject",
34
36
  "isShowDelete",
35
37
  "isShowNote",
36
38
  "isShowAmountFooter",
@@ -40,6 +42,7 @@ const _excluded = [
40
42
  "statusLoading",
41
43
  "statusDisabled",
42
44
  "isShowRelatedProduct",
45
+ "holderOptions",
43
46
  "onBookingStatusChange",
44
47
  "onAction",
45
48
  "onDelete",
@@ -81,8 +84,8 @@ const getResourceName = (booking, translationOriginal) => {
81
84
  }).filter(Boolean).join(", ");
82
85
  };
83
86
  const BookingLineItem = (props) => {
84
- var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _dataSource$promotion;
85
- const { dataSource, type, cartSkuType, relatedProductDataSource, rightActions = [], escapeDom, isShowImage, isShowDelete, isShowNote, isShowAmountFooter, disabledClick, disabledEdit, statusOptions = [], statusLoading = false, statusDisabled = false, isShowRelatedProduct = true, onBookingStatusChange, onAction, onDelete, onNote, onCard, onPromotion, onGift } = props, other = require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
87
+ var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _ref, _ref2, _dataSource$promotion;
88
+ const { dataSource, type, cartSkuType, relatedProductDataSource, rightActions = [], escapeDom, isShowImage, isFormSubject, isShowDelete, isShowNote, isShowAmountFooter, disabledClick, disabledEdit, statusOptions = [], statusLoading = false, statusDisabled = false, isShowRelatedProduct = true, holderOptions, onBookingStatusChange, onAction, onDelete, onNote, onCard, onPromotion, onGift } = props, other = require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
86
89
  const context = require_useEngineContext.default();
87
90
  const translationOriginal = context.appHelper.utils.translationOriginal;
88
91
  const locale = ((_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut.getApp) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.call(_context$appHelper$ut)) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.locales) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut3 = _context$appHelper$ut2.getLocale) === null || _context$appHelper$ut3 === void 0 ? void 0 : _context$appHelper$ut3.call(_context$appHelper$ut2)) || ((_context$appHelper$ut4 = context.appHelper.utils) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut4.storage) === null || _context$appHelper$ut4 === void 0 ? void 0 : _context$appHelper$ut4.get("umi_locale")) || "en-US";
@@ -105,6 +108,8 @@ const BookingLineItem = (props) => {
105
108
  }
106
109
  };
107
110
  const bookingRightActions = isShowDelete ? [deleteAction, ...rightActions] : rightActions;
111
+ const resolvedHolderOptions = (_ref = (_ref2 = holderOptions !== null && holderOptions !== void 0 ? holderOptions : dataSource === null || dataSource === void 0 ? void 0 : dataSource.holderOptions) !== null && _ref2 !== void 0 ? _ref2 : dataSource === null || dataSource === void 0 ? void 0 : dataSource.holders) !== null && _ref !== void 0 ? _ref : [];
112
+ const resolvedIsFormSubject = isFormSubject !== null && isFormSubject !== void 0 ? isFormSubject : dataSource === null || dataSource === void 0 ? void 0 : dataSource.isFormSubject;
108
113
  const bookingTitle = String((dataSource === null || dataSource === void 0 ? void 0 : dataSource.booking_id) || "");
109
114
  formatBookingTime(dataSource, locale);
110
115
  getResourceName(dataSource, translationOriginal);
@@ -153,7 +158,11 @@ const BookingLineItem = (props) => {
153
158
  e.stopPropagation();
154
159
  onDelete === null || onDelete === void 0 || onDelete(dataSource);
155
160
  }
156
- }, /* @__PURE__ */ react.default.createElement(require_index.default, { type: "pisell2-trash-01" })) : null))), /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__booking-detail` }, /* @__PURE__ */ react.default.createElement(require_index$9.default, { dataSource }), /* @__PURE__ */ react.default.createElement(require_index$10.default, { dataSource })), isShowRelatedProduct && relatedProductDataSource ? /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement(antd.Divider, { style: { margin: 0 } }), /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__related-product` }, /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__related-product-card` }, /* @__PURE__ */ react.default.createElement(require_index$2.default, {
161
+ }, /* @__PURE__ */ react.default.createElement(require_index.default, { type: "pisell2-trash-01" })) : null))), /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__booking-detail` }, /* @__PURE__ */ react.default.createElement(require_index$9.default, { dataSource }), /* @__PURE__ */ react.default.createElement(require_index$10.default, { dataSource }), resolvedIsFormSubject ? /* @__PURE__ */ react.default.createElement(require_index$11.default, {
162
+ dataSource,
163
+ holderOptions: resolvedHolderOptions,
164
+ isFormSubject: resolvedIsFormSubject
165
+ }) : null), isShowRelatedProduct && relatedProductDataSource ? /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement(antd.Divider, { style: { margin: 0 } }), /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__related-product` }, /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__related-product-card` }, /* @__PURE__ */ react.default.createElement(require_index$2.default, {
157
166
  isShowImage,
158
167
  dataSource: relatedProductDataSource,
159
168
  type: cartSkuType,
@@ -0,0 +1,53 @@
1
+ const require_runtime = require("../../../../../_virtual/_rolldown/runtime.js");
2
+ const require_index = require("../../../../iconfont/index.js");
3
+ let react = require("react");
4
+ react = require_runtime.__toESM(react);
5
+ let _pisell_utils = require("@pisell/utils");
6
+ require("./index.less");
7
+ //#region src/components/productCard/lineItem/components/Holders/index.tsx
8
+ const PREFIX = "pisell-line-item";
9
+ const holderIconMap = {
10
+ form: "pisell2-file-05",
11
+ minors: "pisell2-user-check-01",
12
+ waiver: "pisell2-file-lock-03"
13
+ };
14
+ const isEmptyHolderId = (value) => {
15
+ if (Array.isArray(value)) return value.length === 0;
16
+ return value === void 0 || value === null || value === "";
17
+ };
18
+ const normalizeHolderIds = (value) => {
19
+ if (isEmptyHolderId(value)) return [];
20
+ return Array.isArray(value) ? value : [value];
21
+ };
22
+ const pickHolderId = (dataSource) => {
23
+ var _ref, _ref2, _dataSource$holder_id, _dataSource$metadata, _dataSource$_extend, _dataSource$_extend2;
24
+ return (_ref = (_ref2 = (_dataSource$holder_id = dataSource === null || dataSource === void 0 ? void 0 : dataSource.holder_id) !== null && _dataSource$holder_id !== void 0 ? _dataSource$holder_id : dataSource === null || dataSource === void 0 || (_dataSource$metadata = dataSource.metadata) === null || _dataSource$metadata === void 0 ? void 0 : _dataSource$metadata.holder_id) !== null && _ref2 !== void 0 ? _ref2 : dataSource === null || dataSource === void 0 || (_dataSource$_extend = dataSource._extend) === null || _dataSource$_extend === void 0 || (_dataSource$_extend = _dataSource$_extend.product) === null || _dataSource$_extend === void 0 || (_dataSource$_extend = _dataSource$_extend.metadata) === null || _dataSource$_extend === void 0 ? void 0 : _dataSource$_extend.holder_id) !== null && _ref !== void 0 ? _ref : dataSource === null || dataSource === void 0 || (_dataSource$_extend2 = dataSource._extend) === null || _dataSource$_extend2 === void 0 || (_dataSource$_extend2 = _dataSource$_extend2.product) === null || _dataSource$_extend2 === void 0 || (_dataSource$_extend2 = _dataSource$_extend2._extend) === null || _dataSource$_extend2 === void 0 ? void 0 : _dataSource$_extend2.holder_id;
25
+ };
26
+ const pickHolderMaxCount = (dataSource, holderIds) => {
27
+ var _ref3, _ref4, _ref5, _ref6, _ref7, _dataSource$holderMax, _dataSource$_extend3, _dataSource$_extend4, _dataSource$_extend5;
28
+ const count = ((_ref3 = (_ref4 = (_ref5 = (_ref6 = (_ref7 = (_dataSource$holderMax = dataSource === null || dataSource === void 0 ? void 0 : dataSource.holderMaxCount) !== null && _dataSource$holderMax !== void 0 ? _dataSource$holderMax : dataSource === null || dataSource === void 0 ? void 0 : dataSource.holder_max_count) !== null && _ref7 !== void 0 ? _ref7 : dataSource === null || dataSource === void 0 ? void 0 : dataSource.number) !== null && _ref6 !== void 0 ? _ref6 : dataSource === null || dataSource === void 0 || (_dataSource$_extend3 = dataSource._extend) === null || _dataSource$_extend3 === void 0 || (_dataSource$_extend3 = _dataSource$_extend3.product) === null || _dataSource$_extend3 === void 0 ? void 0 : _dataSource$_extend3.num) !== null && _ref5 !== void 0 ? _ref5 : dataSource === null || dataSource === void 0 || (_dataSource$_extend4 = dataSource._extend) === null || _dataSource$_extend4 === void 0 || (_dataSource$_extend4 = _dataSource$_extend4.product) === null || _dataSource$_extend4 === void 0 ? void 0 : _dataSource$_extend4.product_quantity) !== null && _ref4 !== void 0 ? _ref4 : dataSource === null || dataSource === void 0 || (_dataSource$_extend5 = dataSource._extend) === null || _dataSource$_extend5 === void 0 || (_dataSource$_extend5 = _dataSource$_extend5.product) === null || _dataSource$_extend5 === void 0 || (_dataSource$_extend5 = _dataSource$_extend5._extend) === null || _dataSource$_extend5 === void 0 ? void 0 : _dataSource$_extend5.quantity) !== null && _ref3 !== void 0 ? _ref3 : holderIds.length) || 1;
29
+ return Number(count) || 1;
30
+ };
31
+ const LineItemHolders = (props) => {
32
+ const { dataSource = {}, holderOptions = [], isFormSubject } = props;
33
+ const holderIds = (0, react.useMemo)(() => normalizeHolderIds(pickHolderId(dataSource)), [dataSource]);
34
+ const holderMaxCount = pickHolderMaxCount(dataSource, holderIds);
35
+ const showUnassigned = Boolean(isFormSubject || (dataSource === null || dataSource === void 0 ? void 0 : dataSource.isFormSubject));
36
+ const holderIcon = holderIconMap[(dataSource === null || dataSource === void 0 ? void 0 : dataSource.holderType) || (dataSource === null || dataSource === void 0 ? void 0 : dataSource.holder_type) || "minors"] || holderIconMap.minors;
37
+ if (!holderIds.length) {
38
+ if (!showUnassigned) return null;
39
+ return /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__holders` }, /* @__PURE__ */ react.default.createElement("div", { className: "holder-item unassigned" }, holderMaxCount > 1 ? /* @__PURE__ */ react.default.createElement("span", null, holderMaxCount, "/", holderMaxCount, " ") : null, /* @__PURE__ */ react.default.createElement("span", { className: "holder-label" }, _pisell_utils.locales.getText("pisell2.cart.sku-card.unassigned"))));
40
+ }
41
+ const renderHolder = (id, index) => {
42
+ var _holder$label;
43
+ const holder = holderOptions.find((item) => String(item.id) === String(id));
44
+ const label = (_holder$label = holder === null || holder === void 0 ? void 0 : holder.label) !== null && _holder$label !== void 0 ? _holder$label : String(id);
45
+ return /* @__PURE__ */ react.default.createElement("div", {
46
+ className: "holder-item",
47
+ key: `${id}-${index}`
48
+ }, /* @__PURE__ */ react.default.createElement("span", { className: "holder-icon" }, /* @__PURE__ */ react.default.createElement(require_index.default, { type: holderIcon })), /* @__PURE__ */ react.default.createElement("span", { className: "holder-label" }, label));
49
+ };
50
+ return /* @__PURE__ */ react.default.createElement("div", { className: `${PREFIX}__holders` }, holderIds.map((id, index) => renderHolder(id, index)));
51
+ };
52
+ //#endregion
53
+ exports.default = LineItemHolders;
@@ -0,0 +1,39 @@
1
+ .pisell-line-item__holders {
2
+ user-select: none;
3
+ display: flex;
4
+ gap: 16px;
5
+ overflow: hidden;
6
+
7
+ .holder-item {
8
+ min-width: 30px;
9
+ display: flex;
10
+ align-items: center;
11
+ overflow: hidden;
12
+ white-space: nowrap;
13
+
14
+ .holder-icon {
15
+ margin-right: 2px;
16
+ color: #7f56da;
17
+ font-size: 16px;
18
+ }
19
+
20
+ .holder-label {
21
+ display: inline-block;
22
+ overflow: hidden;
23
+ color: #667085;
24
+ font-size: 14px;
25
+ font-weight: 500;
26
+ line-height: 20px;
27
+ text-overflow: ellipsis;
28
+ white-space: nowrap;
29
+ }
30
+ }
31
+
32
+ .unassigned {
33
+ color: red;
34
+
35
+ .holder-label {
36
+ color: red;
37
+ }
38
+ }
39
+ }
@@ -28,6 +28,7 @@ const _excluded = [
28
28
  "statusLoading",
29
29
  "statusDisabled",
30
30
  "isShowRelatedProduct",
31
+ "holderOptions",
31
32
  "onBookingStatusChange",
32
33
  "onAction",
33
34
  "onDelete",
@@ -128,7 +129,7 @@ const convertProductToLineItemProduct = (product, translationOriginal, symbol) =
128
129
  };
129
130
  const LineItem = (props) => {
130
131
  var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _dataSource$_extend2;
131
- const { dataSource = require_status.defaultValue.dataSource, itemType, type = "a9", rightActions = [], escapeDom, isShowImage = require_status.defaultValue.isShowImage, isShowDelete = require_status.defaultValue.isShowDelete, isShowNote = require_status.defaultValue.isShowNote, isShowAmountFooter = require_status.defaultValue.isShowAmountFooter, disabledClick = require_status.defaultValue.disabledClick, disabledEdit = require_status.defaultValue.disabledEdit, statusOptions = [], statusLoading = false, statusDisabled = false, isShowRelatedProduct = true, onBookingStatusChange, onAction, onDelete, onNote, onCard, onPromotion, onGift } = props, other = require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
132
+ const { dataSource = require_status.defaultValue.dataSource, itemType, type = "a9", rightActions = [], escapeDom, isShowImage = require_status.defaultValue.isShowImage, isShowDelete = require_status.defaultValue.isShowDelete, isShowNote = require_status.defaultValue.isShowNote, isShowAmountFooter = require_status.defaultValue.isShowAmountFooter, disabledClick = require_status.defaultValue.disabledClick, disabledEdit = require_status.defaultValue.disabledEdit, statusOptions = [], statusLoading = false, statusDisabled = false, isShowRelatedProduct = true, holderOptions, onBookingStatusChange, onAction, onDelete, onNote, onCard, onPromotion, onGift } = props, other = require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
132
133
  const context = require_useEngineContext.default();
133
134
  const translationOriginal = context.appHelper.utils.translationOriginal;
134
135
  const symbol = context.appHelper.utils.getSymbolic();
@@ -185,6 +186,7 @@ const LineItem = (props) => {
185
186
  statusLoading,
186
187
  statusDisabled,
187
188
  isShowRelatedProduct,
189
+ holderOptions,
188
190
  onBookingStatusChange,
189
191
  onAction,
190
192
  onDelete,
@@ -66,6 +66,7 @@ type productType = {
66
66
  */
67
67
  type ProductCardTypes = {
68
68
  dataSource: productType;
69
+ isFormSubject?: boolean;
69
70
  isShowImage?: boolean;
70
71
  isShowOriginalPrice?: boolean;
71
72
  isShowHolder?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "1.8.55",
3
+ "version": "1.8.56",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -98,9 +98,9 @@
98
98
  "swiper": "^8.4.7",
99
99
  "antd-mobile": "^5.38.1",
100
100
  "vod-js-sdk-v6": "^1.4.11",
101
- "@pisell/date-picker": "3.0.8",
101
+ "@pisell/icon": "0.0.11",
102
102
  "@pisell/utils": "3.0.2",
103
- "@pisell/icon": "0.0.11"
103
+ "@pisell/date-picker": "3.0.8"
104
104
  },
105
105
  "peerDependencies": {
106
106
  "react": "^18.0.0",