@pisell/materials 6.11.256 → 6.11.258

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.
Files changed (41) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/meta.js +1 -1
  5. package/build/lowcode/render/default/view.css +1 -1
  6. package/build/lowcode/render/default/view.js +32 -32
  7. package/build/lowcode/view.css +1 -1
  8. package/build/lowcode/view.js +32 -32
  9. package/es/components/pisellWalletPassCard/index.d.ts +2 -0
  10. package/es/components/pisellWalletPassCard/index.js +2 -2
  11. package/es/components/productCard/cartSkuCard/components/AmountFooter/index.js +2 -1
  12. package/es/components/productCard/cartSkuCard/components/Note/index.less +6 -2
  13. package/es/components/productCard/cartSkuCard/components/basicInfo/index.js +5 -4
  14. package/es/components/productCard/cartSkuCard/components/packages/index.js +5 -3
  15. package/es/components/productCard/cartSkuCard/components/specs/index.js +5 -3
  16. package/es/components/productCard/cartSkuCard/index.js +33 -3
  17. package/es/components/productCard/cartSkuCard/index.less +18 -0
  18. package/es/components/productCard/cartSkuCard/types.d.ts +56 -0
  19. package/es/components/productCard/cartSkuCard/variants/A12/index.js +126 -0
  20. package/es/components/productCard/cartSkuCard/variants/A12/index.less +279 -0
  21. package/es/components/productCard/components/Packages/components/options/index.js +3 -2
  22. package/es/components/productCard/lineItem/index.js +57 -19
  23. package/es/components/productCard/types.d.ts +4 -1
  24. package/es/index.d.ts +2 -1
  25. package/lib/components/pisellWalletPassCard/index.d.ts +2 -0
  26. package/lib/components/pisellWalletPassCard/index.js +2 -2
  27. package/lib/components/productCard/cartSkuCard/components/AmountFooter/index.js +2 -1
  28. package/lib/components/productCard/cartSkuCard/components/Note/index.less +6 -2
  29. package/lib/components/productCard/cartSkuCard/components/basicInfo/index.js +5 -4
  30. package/lib/components/productCard/cartSkuCard/components/packages/index.js +5 -3
  31. package/lib/components/productCard/cartSkuCard/components/specs/index.js +5 -3
  32. package/lib/components/productCard/cartSkuCard/index.js +33 -3
  33. package/lib/components/productCard/cartSkuCard/index.less +18 -0
  34. package/lib/components/productCard/cartSkuCard/types.d.ts +56 -0
  35. package/lib/components/productCard/cartSkuCard/variants/A12/index.js +129 -0
  36. package/lib/components/productCard/cartSkuCard/variants/A12/index.less +279 -0
  37. package/lib/components/productCard/components/Packages/components/options/index.js +3 -2
  38. package/lib/components/productCard/lineItem/index.js +57 -19
  39. package/lib/components/productCard/types.d.ts +4 -1
  40. package/lib/index.d.ts +2 -1
  41. package/package.json +2 -2
@@ -20,6 +20,8 @@ interface PisellWalletPassCardProps {
20
20
  storeName: string;
21
21
  /** 余额 */
22
22
  balance?: number;
23
+ /** 已格式化的余额展示内容 */
24
+ formattedBalance?: React.ReactNode;
23
25
  /** 识别码编号 */
24
26
  code: string;
25
27
  /** 有效期 */
@@ -39,7 +39,7 @@ const PisellWalletPassCard = (props) => {
39
39
  if (pressTimer) clearTimeout(pressTimer);
40
40
  };
41
41
  }, [pressTimer]);
42
- const { id, type, code, qrCode, balance, disabledReason, name, storeName, redeem, validDate, disabled, active = false, cover, balanceTitle, redeemTitle, showCover = true, showDetail = true, showBalance = true, showRedeem = true, showName = true, showCode = true, showStoreName = true, showValidDate = true, showQrCode = true, showBalanceSymbol = true, showDisabledReason = true, showDiscount = false, discount, showActions, actions, beforeEdit, onBeforeEditAmount, onConfirmEdit, onConfirmEditAmount, onDetail, useExternalDetail = false, originData, style = {}, mode = "multiple", showActiveIcon, enableEditAmount, showStatus, cardStatus, nameTitleStyle, formatBalance, formatBalanceTitle, formatRedeem, formatRedeemTitle, maxRedeem, showHolderName = true, holder, onSetHolder, validDateBySchedule, scheduleList } = props;
42
+ const { id, type, code, qrCode, balance, formattedBalance, disabledReason, name, storeName, redeem, validDate, disabled, active = false, cover, balanceTitle, redeemTitle, showCover = true, showDetail = true, showBalance = true, showRedeem = true, showName = true, showCode = true, showStoreName = true, showValidDate = true, showQrCode = true, showBalanceSymbol = true, showDisabledReason = true, showDiscount = false, discount, showActions, actions, beforeEdit, onBeforeEditAmount, onConfirmEdit, onConfirmEditAmount, onDetail, useExternalDetail = false, originData, style = {}, mode = "multiple", showActiveIcon, enableEditAmount, showStatus, cardStatus, nameTitleStyle, formatBalance, formatBalanceTitle, formatRedeem, formatRedeemTitle, maxRedeem, showHolderName = true, holder, onSetHolder, validDateBySchedule, scheduleList } = props;
43
43
  useEffect(() => {
44
44
  document.body.id = "body";
45
45
  }, []);
@@ -267,7 +267,7 @@ const PisellWalletPassCard = (props) => {
267
267
  active,
268
268
  data: props
269
269
  }) : balanceTitle || getText("pisell-wallet-pass-card-balance"), disabled || isMini ? ": " : "");
270
- const createOriginalBalanceDom = () => /* @__PURE__ */ React.createElement(Amount, {
270
+ const createOriginalBalanceDom = () => formattedBalance !== void 0 ? /* @__PURE__ */ React.createElement("span", { className: "pisell-card-amount-item-value" }, formattedBalance) : /* @__PURE__ */ React.createElement(Amount, {
271
271
  className: "pisell-card-amount-item-value",
272
272
  useThousandsSeparator: true,
273
273
  value: balance,
@@ -8,9 +8,10 @@ import classNames from "classnames";
8
8
  import "./index.less";
9
9
  //#region src/components/productCard/cartSkuCard/components/AmountFooter/index.tsx
10
10
  const Footer = ({ item, hideDivider, type, isOnlyTotal }) => {
11
- const { total, origin_total, symbol, tip, num, discount_reason } = item;
11
+ const { total, origin_total, symbol, tip, num, discount_reason, amountFormatter } = item;
12
12
  const weighingInfo = resolveWeighingSnapshot(item);
13
13
  const formatFooterAmount = (amount, precision = 2) => {
14
+ if (amountFormatter) return amountFormatter(amount, precision);
14
15
  if (!weighingInfo) return _formatAmount(amount, symbol, precision);
15
16
  return formatAmountWithOptions(amount, symbol, {
16
17
  precision,
@@ -10,15 +10,19 @@
10
10
  }
11
11
 
12
12
  &__note-text {
13
+ min-width: 0;
14
+ flex: 1;
15
+ overflow: hidden;
13
16
  color: #101828;
14
17
  font-size: 14px;
15
18
  font-weight: 400;
16
19
  line-height: 20px;
17
- word-break: keep-all;
18
- word-wrap: normal;
20
+ text-overflow: ellipsis;
21
+ white-space: nowrap;
19
22
  }
20
23
 
21
24
  &__note-btn {
25
+ flex-shrink: 0;
22
26
  color: var(--Blue-600, #1570ef);
23
27
  font-weight: 600;
24
28
  cursor: pointer;
@@ -10,7 +10,8 @@ import "./index.less";
10
10
  //#region src/components/productCard/cartSkuCard/components/basicInfo/index.tsx
11
11
  const BasicInfo = (props) => {
12
12
  const { isShowImage, isShowQuantityBadge = true, dataSource = {}, style, isMainProduct, type, maxSpecsCount = 1, isBundle, showFooter, isShowOriginalPrice = false, isShowEditProduct = false, onEditProduct, disabledEditClick = false } = props;
13
- const { image: image$1, bundle, options, product_option_string, name, price, symbol, total = 0, origin_total = 0, num = 1, holder_id, isFormSubject, totalDifference = 0 } = dataSource;
13
+ const { image: image$1, bundle, options, product_option_string, name, price, symbol, total = 0, origin_total = 0, num = 1, holder_id, isFormSubject, totalDifference = 0, amountFormatter } = dataSource;
14
+ const formatProductAmount = (value, precision = 2) => amountFormatter ? amountFormatter(value, precision) : formatAmount(value, precision, symbol);
14
15
  const renderNumTag = () => {
15
16
  return /* @__PURE__ */ React.createElement("div", { className: classNames(`num-tag`, { "is-main": isMainProduct }) }, num < 100 ? num : "99+");
16
17
  };
@@ -32,7 +33,7 @@ const BasicInfo = (props) => {
32
33
  };
33
34
  const renderProductPrice = () => {
34
35
  if (hasWeighingInfo) return null;
35
- return formatAmount(price, 2, symbol);
36
+ return formatProductAmount(price !== null && price !== void 0 ? price : 0);
36
37
  };
37
38
  const renderImage = () => {
38
39
  if (!isShowImage) return null;
@@ -78,12 +79,12 @@ const BasicInfo = (props) => {
78
79
  return /* @__PURE__ */ React.createElement("div", {
79
80
  className: basicInfoClassName,
80
81
  style: style || {}
81
- }, isShowQuantityBadge ? renderNumTag() : null, renderImage(), !isShowImage || !image$1 && !name ? /* @__PURE__ */ React.createElement("div", { style: { width: 20 } }) : null, /* @__PURE__ */ React.createElement("div", { className: `product-info product-info-a9` }, /* @__PURE__ */ React.createElement("div", { className: `product-basic-info-wrap` }, /* @__PURE__ */ React.createElement("div", { className: `product-basic-info ${isBundle ? "row" : ""}` }, /* @__PURE__ */ React.createElement("div", { className: `product-name ${renderEdit ? "product-name-edit" : ""}` }, name), /* @__PURE__ */ React.createElement("div", { className: `product-price` }, /* @__PURE__ */ React.createElement("span", null, renderProductPrice()), _isShowOriginalPrice ? /* @__PURE__ */ React.createElement("span", { className: `original-price` }, formatAmount(origin_total, 2, symbol)) : null)), renderProductMeta()), renderEdit));
82
+ }, isShowQuantityBadge ? renderNumTag() : null, renderImage(), !isShowImage || !image$1 && !name ? /* @__PURE__ */ React.createElement("div", { style: { width: 20 } }) : null, /* @__PURE__ */ React.createElement("div", { className: `product-info product-info-a9` }, /* @__PURE__ */ React.createElement("div", { className: `product-basic-info-wrap` }, /* @__PURE__ */ React.createElement("div", { className: `product-basic-info ${isBundle ? "row" : ""}` }, /* @__PURE__ */ React.createElement("div", { className: `product-name ${renderEdit ? "product-name-edit" : ""}` }, name), /* @__PURE__ */ React.createElement("div", { className: `product-price` }, /* @__PURE__ */ React.createElement("span", null, renderProductPrice()), _isShowOriginalPrice ? /* @__PURE__ */ React.createElement("span", { className: `original-price` }, formatProductAmount(origin_total)) : null)), renderProductMeta()), renderEdit));
82
83
  }
83
84
  return /* @__PURE__ */ React.createElement("div", {
84
85
  className: basicInfoClassName,
85
86
  style: style || {}
86
- }, isShowQuantityBadge ? renderNumTag() : null, renderImage(), !isShowImage || !image$1 && !name ? /* @__PURE__ */ React.createElement("div", { style: { width: 20 } }) : null, /* @__PURE__ */ React.createElement("div", { className: `product-info` }, /* @__PURE__ */ React.createElement("div", { className: `product-name` }, name), hasProductMeta ? renderProductMeta() : /* @__PURE__ */ React.createElement("div", { className: `product-price` }, renderProductPrice())), /* @__PURE__ */ React.createElement("div", { className: `product-amount` }, /* @__PURE__ */ React.createElement("div", { className: `total-amont` }, formatAmount(total * num - (totalDifference !== null && totalDifference !== void 0 ? totalDifference : 0), 2, symbol)), origin_total && Number(total) !== Number(origin_total) ? /* @__PURE__ */ React.createElement("div", { className: `origin-amount` }, formatAmount(origin_total * num, 2, symbol)) : null));
87
+ }, isShowQuantityBadge ? renderNumTag() : null, renderImage(), !isShowImage || !image$1 && !name ? /* @__PURE__ */ React.createElement("div", { style: { width: 20 } }) : null, /* @__PURE__ */ React.createElement("div", { className: `product-info` }, /* @__PURE__ */ React.createElement("div", { className: `product-name` }, name), hasProductMeta ? renderProductMeta() : /* @__PURE__ */ React.createElement("div", { className: `product-price` }, renderProductPrice())), /* @__PURE__ */ React.createElement("div", { className: `product-amount` }, /* @__PURE__ */ React.createElement("div", { className: `total-amont` }, formatProductAmount(total * num - (totalDifference !== null && totalDifference !== void 0 ? totalDifference : 0))), origin_total && Number(total) !== Number(origin_total) ? /* @__PURE__ */ React.createElement("div", { className: `origin-amount` }, formatProductAmount(origin_total * num)) : null));
87
88
  };
88
89
  //#endregion
89
90
  export { BasicInfo as default };
@@ -9,7 +9,7 @@ import { Divider } from "antd";
9
9
  import "./index.less";
10
10
  //#region src/components/productCard/cartSkuCard/components/packages/index.tsx
11
11
  const Packages = ({ isShowImage, isShowQuantityBadge, dataSource = {}, type }) => {
12
- const { bundle = [], symbol = "$" } = dataSource;
12
+ const { bundle = [], symbol = "$", amountFormatter } = dataSource;
13
13
  const showFooter = useCallback((_bundle) => {
14
14
  const { options = [], bundle = [] } = _bundle;
15
15
  const hasSpecs = (bundle === null || bundle === void 0 ? void 0 : bundle.length) || (options === null || options === void 0 ? void 0 : options.length);
@@ -29,7 +29,8 @@ const Packages = ({ isShowImage, isShowQuantityBadge, dataSource = {}, type }) =
29
29
  dataSource: _objectSpread2(_objectSpread2({}, item), {}, {
30
30
  name: item.title,
31
31
  image: item.cover,
32
- symbol
32
+ symbol,
33
+ amountFormatter
33
34
  }),
34
35
  type,
35
36
  isBundle: true,
@@ -37,7 +38,8 @@ const Packages = ({ isShowImage, isShowQuantityBadge, dataSource = {}, type }) =
37
38
  }), showFooter(item) ? /* @__PURE__ */ React.createElement(Footer, {
38
39
  item: _objectSpread2(_objectSpread2({}, item), {}, {
39
40
  total: item === null || item === void 0 ? void 0 : item.price,
40
- symbol: dataSource === null || dataSource === void 0 ? void 0 : dataSource.symbol
41
+ symbol: dataSource === null || dataSource === void 0 ? void 0 : dataSource.symbol,
42
+ amountFormatter
41
43
  }),
42
44
  hideDivider: false,
43
45
  type: "total"
@@ -6,7 +6,8 @@ import "./index.less";
6
6
  //#region src/components/productCard/cartSkuCard/components/specs/index.tsx
7
7
  const Specs = (props) => {
8
8
  const { dataSource = {}, maxSpecsCount = 1, type } = props;
9
- const { bundle, options, product_option_string, symbol } = dataSource;
9
+ const { bundle, options, product_option_string, symbol, amountFormatter } = dataSource;
10
+ const formatSpecAmount = (value) => amountFormatter ? amountFormatter(value, 2) : `${symbol || ""}${value}`;
10
11
  const more = /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__specs-more` }, locales.getText("pisell2.cart.sku-card.more"));
11
12
  /**
12
13
  * @description: 渲染多规格字符串
@@ -17,7 +18,8 @@ const Specs = (props) => {
17
18
  };
18
19
  if (type === "a9") return /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__specs-a9-wrap` }, product_option_string ? /* @__PURE__ */ React.createElement("div", { className: "option-string-wrap" }, renderOptionString()) : null, options && (options === null || options === void 0 ? void 0 : options.length) > 0 ? /* @__PURE__ */ React.createElement(Options, {
19
20
  options,
20
- amountSymbol: symbol
21
+ amountSymbol: symbol,
22
+ amountFormatter
21
23
  }) : null);
22
24
  if (Array.isArray(bundle) && (bundle === null || bundle === void 0 ? void 0 : bundle.length) > 0) {
23
25
  const displayItems = bundle.slice(0, maxSpecsCount);
@@ -29,7 +31,7 @@ const Specs = (props) => {
29
31
  return /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__specs` }, displayItems.map((item, index) => /* @__PURE__ */ React.createElement("div", {
30
32
  className: "spec-item",
31
33
  key: index
32
- }, /* @__PURE__ */ React.createElement("span", { className: "spec-name" }, item.name), /* @__PURE__ */ React.createElement("span", { className: "spec-num" }, /* @__PURE__ */ React.createElement("span", null, symbol, item.price), /* @__PURE__ */ React.createElement("span", null), "x", /* @__PURE__ */ React.createElement("span", null, item.num)))), options.length > maxSpecsCount ? more : null);
34
+ }, /* @__PURE__ */ React.createElement("span", { className: "spec-name" }, item.name), /* @__PURE__ */ React.createElement("span", { className: "spec-num" }, /* @__PURE__ */ React.createElement("span", null, formatSpecAmount(item.price)), /* @__PURE__ */ React.createElement("span", null), "x", /* @__PURE__ */ React.createElement("span", null, item.num)))), options.length > maxSpecsCount ? more : null);
33
35
  }
34
36
  return null;
35
37
  };
@@ -19,6 +19,7 @@ import Promotion from "./components/Promotion/index.js";
19
19
  import Gift from "./components/Gift/index.js";
20
20
  import BookingItem from "./components/BookingItem/index.js";
21
21
  import InlineActions from "./components/inlineActions/index.js";
22
+ import A12 from "./variants/A12/index.js";
22
23
  import React, { useMemo, useRef } from "react";
23
24
  import { locales } from "@pisell/utils";
24
25
  import classNames from "classnames";
@@ -56,12 +57,14 @@ const _excluded = [
56
57
  "rightActionsDisplay",
57
58
  "escapeDom",
58
59
  "maxSpecsCount",
59
- "isShowRelatedProduct"
60
+ "isShowRelatedProduct",
61
+ "a12Slots",
62
+ "a12Presentation"
60
63
  ];
61
64
  const PREFIX = "pisell-cart-sku-card";
62
65
  const CartSkuCard = (props) => {
63
66
  var _context$appHelper$ut;
64
- const { dataSource = defaultValue.dataSource, isShowImage = defaultValue.isShowImage, isShowQuantityBadge = true, isShowOriginalPrice = defaultValue.isShowOriginalPrice, isShowHolder = defaultValue.isShowHolder, isShowNote = defaultValue.isShowNote, isShowDelete = defaultValue.isShowDelete, isShowInlineDelete = isShowDelete, isShowAmountFooter = defaultValue.isShowAmountFooter, isShowPackageNote = defaultValue.isShowPackageNote, isShowEditProduct = defaultValue.isShowEditProduct, disabledClick = defaultValue.disabledClick, disabledEditClick = defaultValue.disabledEditClick, disabledNoteEdit, externalNoteEditor = false, onEditProduct, onAction, onDelete, onNote, onLike, onCard, onChangeResource, onPromotion, onGift, onChangeHolder, itemType = "product", type, rightActions = [], rightActionsDisplay = "swipe", escapeDom, maxSpecsCount = 1, isShowRelatedProduct = true } = props, other = _objectWithoutProperties(props, _excluded);
67
+ const { dataSource = defaultValue.dataSource, isShowImage = defaultValue.isShowImage, isShowQuantityBadge = true, isShowOriginalPrice = defaultValue.isShowOriginalPrice, isShowHolder = defaultValue.isShowHolder, isShowNote = defaultValue.isShowNote, isShowDelete = defaultValue.isShowDelete, isShowInlineDelete = isShowDelete, isShowAmountFooter = defaultValue.isShowAmountFooter, isShowPackageNote = defaultValue.isShowPackageNote, isShowEditProduct = defaultValue.isShowEditProduct, disabledClick = defaultValue.disabledClick, disabledEditClick = defaultValue.disabledEditClick, disabledNoteEdit, externalNoteEditor = false, onEditProduct, onAction, onDelete, onNote, onLike, onCard, onChangeResource, onPromotion, onGift, onChangeHolder, itemType = "product", type, rightActions = [], rightActionsDisplay = "swipe", escapeDom, maxSpecsCount = 1, isShowRelatedProduct = true, a12Slots, a12Presentation } = props, other = _objectWithoutProperties(props, _excluded);
65
68
  const useOpenNoteRef = useRef();
66
69
  const context = useEngineContext();
67
70
  locales.init(locales_default, ((_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut = _context$appHelper$ut.storage) === null || _context$appHelper$ut === void 0 ? void 0 : _context$appHelper$ut.get("umi_locale")) || "en");
@@ -219,13 +222,37 @@ const CartSkuCard = (props) => {
219
222
  openNote: openNoteEditor
220
223
  })) : null);
221
224
  };
225
+ const renderA12 = () => {
226
+ var _a12Slots$contentFoot;
227
+ const note = isShowNote ? /* @__PURE__ */ React.createElement(Note, _objectSpread2(_objectSpread2({}, other), {}, {
228
+ item: dataSource,
229
+ disabledEdit: disabledNoteEdit !== null && disabledNoteEdit !== void 0 ? disabledNoteEdit : other.disabledEdit,
230
+ openNote: openNoteEditor
231
+ })) : null;
232
+ const slots = note ? _objectSpread2(_objectSpread2({}, a12Slots), {}, { contentFooter: (_a12Slots$contentFoot = a12Slots === null || a12Slots === void 0 ? void 0 : a12Slots.contentFooter) !== null && _a12Slots$contentFoot !== void 0 ? _a12Slots$contentFoot : (() => note) }) : a12Slots;
233
+ return /* @__PURE__ */ React.createElement(A12, {
234
+ dataSource,
235
+ isShowImage,
236
+ isShowDelete,
237
+ isShowOriginalPrice,
238
+ isShowEditProduct,
239
+ disabled: Boolean(disabledClick),
240
+ disabledEditClick,
241
+ slots,
242
+ presentation: a12Presentation,
243
+ onDelete,
244
+ onEditProduct
245
+ });
246
+ };
222
247
  const renderContent = () => {
248
+ if (type === "a12") return renderA12();
223
249
  if (type === "a9") return renderA9();
224
250
  if (type === "a5") return renderA5();
225
251
  return renderA2();
226
252
  };
227
253
  if (dataSource === null || dataSource === void 0 ? void 0 : dataSource.isGift) return null;
228
254
  const content = renderContent();
255
+ const useIntegratedWrapper = type === "a12" || rightActionsDisplay === "inline";
229
256
  const cardContent = /* @__PURE__ */ React.createElement("div", {
230
257
  className: classNames(PREFIX, `${PREFIX}--${type}`),
231
258
  onClick: (e) => {
@@ -239,7 +266,10 @@ const CartSkuCard = (props) => {
239
266
  isShowRelatedProduct,
240
267
  isShowDelete
241
268
  }, content) : content);
242
- return /* @__PURE__ */ React.createElement("div", { className: classNames(`${PREFIX}-wrapper-container`, { [`${PREFIX}-wrapper-container--inline`]: rightActionsDisplay === "inline" }) }, rightActionsDisplay === "inline" ? /* @__PURE__ */ React.createElement("div", { className: classNames(`${PREFIX}-wrapper`, `${PREFIX}-wrapper--inline`) }, cardContent) : /* @__PURE__ */ React.createElement(SwipeAction, {
269
+ return /* @__PURE__ */ React.createElement("div", { className: classNames(`${PREFIX}-wrapper-container`, {
270
+ [`${PREFIX}-wrapper-container--inline`]: useIntegratedWrapper,
271
+ [`${PREFIX}-wrapper-container--a12`]: type === "a12"
272
+ }) }, useIntegratedWrapper ? /* @__PURE__ */ React.createElement("div", { className: classNames(`${PREFIX}-wrapper`, `${PREFIX}-wrapper--inline`, type === "a12" && `pisell-cart-sku-card-wrapper--a12`) }, cardContent) : /* @__PURE__ */ React.createElement(SwipeAction, {
243
273
  closeOnAction: false,
244
274
  className: classNames(`${PREFIX}-wrapper`),
245
275
  rightActions: _rightActions,
@@ -3,6 +3,10 @@
3
3
  width: 100%;
4
4
  min-width: 0;
5
5
  }
6
+
7
+ &--a12 {
8
+ container-type: inline-size;
9
+ }
6
10
  }
7
11
 
8
12
  .pisell-cart-sku-card-wrapper {
@@ -15,6 +19,14 @@
15
19
  width: 100%;
16
20
  overflow: hidden;
17
21
  }
22
+
23
+
24
+ &--a12 {
25
+ border: 0;
26
+ border-radius: 18px;
27
+ background: transparent;
28
+ overflow: visible;
29
+ }
18
30
  }
19
31
 
20
32
  .pisell-cart-sku-card__main-row {
@@ -51,6 +63,12 @@
51
63
  cursor: pointer;
52
64
  }
53
65
 
66
+ &--a12 {
67
+ display: block;
68
+ padding: 0;
69
+ gap: 0;
70
+ }
71
+
54
72
  &__delete-btn {
55
73
  cursor: pointer;
56
74
  position: absolute;
@@ -0,0 +1,56 @@
1
+ import { CSSProperties, ReactNode } from "react";
2
+
3
+ //#region src/components/productCard/cartSkuCard/types.d.ts
4
+ type CartSkuCardVariant = 'a2' | 'a5' | 'a9' | 'a12';
5
+ interface CartSkuCardA12Display {
6
+ eyebrow?: ReactNode;
7
+ quantityText?: ReactNode;
8
+ }
9
+ interface CartSkuCardSlotContext {
10
+ item: any;
11
+ disabled: boolean;
12
+ }
13
+ interface CartSkuCardA12Slots {
14
+ contentFooter?: (context: CartSkuCardSlotContext) => ReactNode;
15
+ quantityControl?: (context: CartSkuCardSlotContext) => ReactNode;
16
+ actionRail?: (context: CartSkuCardSlotContext & {
17
+ defaultPrice: ReactNode;
18
+ defaultEdit: ReactNode;
19
+ defaultQuantityControl: ReactNode;
20
+ }) => ReactNode;
21
+ specifications?: (context: CartSkuCardSlotContext & {
22
+ defaultSpecifications: ReactNode;
23
+ }) => ReactNode;
24
+ }
25
+ interface CartSkuCardA12Tokens {
26
+ background: string;
27
+ borderColor: string;
28
+ borderRadius: string;
29
+ minHeight: string;
30
+ mediaWidth: string;
31
+ actionRailWidth: string;
32
+ contentPadding: string;
33
+ actionRailPadding: string;
34
+ accentColor: string;
35
+ titleColor: string;
36
+ titleFontSize: string;
37
+ titleFontWeight: number;
38
+ priceColor: string;
39
+ priceFontSize: string;
40
+ optionBackground: string;
41
+ optionLabelColor: string;
42
+ optionValueColor: string;
43
+ optionGap: string;
44
+ shadow: string;
45
+ }
46
+ interface CartSkuCardA12Presentation {
47
+ density?: 'compact' | 'comfortable';
48
+ optionColumns?: 1 | 2 | 3;
49
+ mediaFit?: 'cover' | 'contain';
50
+ contentAlign?: 'start' | 'center';
51
+ className?: string;
52
+ style?: CSSProperties;
53
+ tokens?: Partial<CartSkuCardA12Tokens>;
54
+ }
55
+ //#endregion
56
+ export { CartSkuCardA12Display, CartSkuCardA12Presentation, CartSkuCardA12Slots, CartSkuCardVariant };
@@ -0,0 +1,126 @@
1
+ import { _objectSpread2 } from "../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
2
+ import IconFont from "../../../../iconfont/index.js";
3
+ import Weighing from "../../components/weighing/index.js";
4
+ import { PREFIX } from "../../index.js";
5
+ import React, { useMemo } from "react";
6
+ import { formatAmount, image, locales, resolveWeighingSnapshot } from "@pisell/utils";
7
+ import classNames from "classnames";
8
+ import "./index.less";
9
+ //#region src/components/productCard/cartSkuCard/variants/A12/index.tsx
10
+ const TOKEN_VARIABLES = {
11
+ background: "--pc-a12-bg",
12
+ borderColor: "--pc-a12-border-color",
13
+ borderRadius: "--pc-a12-radius",
14
+ minHeight: "--pc-a12-min-height",
15
+ mediaWidth: "--pc-a12-media-width",
16
+ actionRailWidth: "--pc-a12-rail-width",
17
+ contentPadding: "--pc-a12-content-padding",
18
+ actionRailPadding: "--pc-a12-rail-padding",
19
+ accentColor: "--pc-a12-accent",
20
+ titleColor: "--pc-a12-title-color",
21
+ titleFontSize: "--pc-a12-title-size",
22
+ titleFontWeight: "--pc-a12-title-weight",
23
+ priceColor: "--pc-a12-price-color",
24
+ priceFontSize: "--pc-a12-price-size",
25
+ optionBackground: "--pc-a12-option-bg",
26
+ optionLabelColor: "--pc-a12-option-label-color",
27
+ optionValueColor: "--pc-a12-option-value-color",
28
+ optionGap: "--pc-a12-option-gap",
29
+ shadow: "--pc-a12-shadow"
30
+ };
31
+ /** 复用其它变体使用的 options,只在展示阶段合并同组已选项。 */
32
+ function resolveSpecifications(dataSource) {
33
+ if (!Array.isArray(dataSource === null || dataSource === void 0 ? void 0 : dataSource.options)) return [];
34
+ const groups = /* @__PURE__ */ new Map();
35
+ dataSource.options.forEach((option, index) => {
36
+ var _ref, _option$name, _ref2, _option$quantity, _ref3, _ref4, _option$option_group_, _ref5, _ref6, _ref7, _option$option_group_2;
37
+ const name = (_ref = (_option$name = option === null || option === void 0 ? void 0 : option.name) !== null && _option$name !== void 0 ? _option$name : option === null || option === void 0 ? void 0 : option.title) !== null && _ref !== void 0 ? _ref : option === null || option === void 0 ? void 0 : option.variant_item_name;
38
+ if (name === void 0 || name === null || name === "") return;
39
+ const quantity = Math.max(1, Number((_ref2 = (_option$quantity = option.quantity) !== null && _option$quantity !== void 0 ? _option$quantity : option.num) !== null && _ref2 !== void 0 ? _ref2 : 1));
40
+ const value = quantity > 1 ? `${String(name)} × ${quantity}` : name;
41
+ const groupKey = String((_ref3 = (_ref4 = (_option$option_group_ = option.option_group_id) !== null && _option$option_group_ !== void 0 ? _option$option_group_ : option.group_id) !== null && _ref4 !== void 0 ? _ref4 : option.variant_group_id) !== null && _ref3 !== void 0 ? _ref3 : `option-${index}`);
42
+ const label = (_ref5 = (_ref6 = (_ref7 = (_option$option_group_2 = option.option_group_name) !== null && _option$option_group_2 !== void 0 ? _option$option_group_2 : option.group_name) !== null && _ref7 !== void 0 ? _ref7 : option.option_group_title) !== null && _ref6 !== void 0 ? _ref6 : option.group_title) !== null && _ref5 !== void 0 ? _ref5 : option.variant_group_name;
43
+ const current = groups.get(groupKey);
44
+ if (current) {
45
+ current.values.push(value);
46
+ if (!current.label && label) current.label = label;
47
+ return;
48
+ }
49
+ groups.set(groupKey, _objectSpread2(_objectSpread2({ key: groupKey }, label ? { label } : {}), {}, { values: [value] }));
50
+ });
51
+ return Array.from(groups.values()).map((group) => ({
52
+ key: group.key,
53
+ label: group.label,
54
+ value: group.values.map(String).join(", ")
55
+ }));
56
+ }
57
+ function getPresentationStyle(presentation) {
58
+ const style = _objectSpread2({}, (presentation === null || presentation === void 0 ? void 0 : presentation.style) || {});
59
+ Object.entries((presentation === null || presentation === void 0 ? void 0 : presentation.tokens) || {}).forEach(([key, value]) => {
60
+ if (value !== void 0) style[TOKEN_VARIABLES[key]] = value;
61
+ });
62
+ style["--pc-a12-option-columns"] = (presentation === null || presentation === void 0 ? void 0 : presentation.optionColumns) || 2;
63
+ return style;
64
+ }
65
+ const A12 = ({ dataSource, isShowImage = true, isShowDelete = false, isShowOriginalPrice = false, isShowEditProduct = false, disabled = false, disabledEditClick = false, slots, presentation, onDelete, onEditProduct }) => {
66
+ var _ref8, _dataSource$num, _dataSource$total, _dataSource$origin_to, _slots$contentFooter;
67
+ const display = (dataSource === null || dataSource === void 0 ? void 0 : dataSource.a12) || {};
68
+ const specificationsData = useMemo(() => resolveSpecifications(dataSource), [dataSource]);
69
+ const weighingInfo = useMemo(() => resolveWeighingSnapshot(dataSource), [dataSource]);
70
+ const quantity = Number((_ref8 = (_dataSource$num = dataSource === null || dataSource === void 0 ? void 0 : dataSource.num) !== null && _dataSource$num !== void 0 ? _dataSource$num : dataSource === null || dataSource === void 0 ? void 0 : dataSource.quantity) !== null && _ref8 !== void 0 ? _ref8 : 1) || 1;
71
+ const lineTotal = Number((_dataSource$total = dataSource === null || dataSource === void 0 ? void 0 : dataSource.total) !== null && _dataSource$total !== void 0 ? _dataSource$total : 0) * quantity - Number((dataSource === null || dataSource === void 0 ? void 0 : dataSource.totalDifference) || 0);
72
+ const originalTotal = Number((_dataSource$origin_to = dataSource === null || dataSource === void 0 ? void 0 : dataSource.origin_total) !== null && _dataSource$origin_to !== void 0 ? _dataSource$origin_to : 0) * quantity;
73
+ const symbol = dataSource === null || dataSource === void 0 ? void 0 : dataSource.symbol;
74
+ const slotContext = useMemo(() => ({
75
+ item: dataSource,
76
+ disabled
77
+ }), [dataSource, disabled]);
78
+ const style = useMemo(() => getPresentationStyle(presentation), [presentation]);
79
+ const defaultSpecifications = specificationsData.length ? /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}-a12__specifications` }, specificationsData.map((specification) => /* @__PURE__ */ React.createElement("div", {
80
+ className: `${PREFIX}-a12__specification`,
81
+ key: specification.key
82
+ }, specification.label ? /* @__PURE__ */ React.createElement("span", { className: `${PREFIX}-a12__specification-label` }, specification.label) : null, /* @__PURE__ */ React.createElement("strong", { className: `${PREFIX}-a12__specification-value` }, specification.value)))) : (dataSource === null || dataSource === void 0 ? void 0 : dataSource.product_option_string) ? /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}-a12__specification-summary` }, dataSource.product_option_string) : null;
83
+ const specifications = (slots === null || slots === void 0 ? void 0 : slots.specifications) ? slots.specifications(_objectSpread2(_objectSpread2({}, slotContext), {}, { defaultSpecifications })) : defaultSpecifications;
84
+ const contentFooter = slots === null || slots === void 0 || (_slots$contentFooter = slots.contentFooter) === null || _slots$contentFooter === void 0 ? void 0 : _slots$contentFooter.call(slots, slotContext);
85
+ const defaultPrice = /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}-a12__price` }, /* @__PURE__ */ React.createElement("strong", null, formatAmount(lineTotal, 2, symbol)), isShowOriginalPrice && originalTotal > 0 && originalTotal !== lineTotal ? /* @__PURE__ */ React.createElement("del", null, formatAmount(originalTotal, 2, symbol)) : null);
86
+ const defaultEdit = Boolean(isShowEditProduct && onEditProduct) ? /* @__PURE__ */ React.createElement("button", {
87
+ type: "button",
88
+ className: `${PREFIX}-a12__edit`,
89
+ disabled: disabled || disabledEditClick,
90
+ onClick: (event) => {
91
+ event.preventDefault();
92
+ event.stopPropagation();
93
+ onEditProduct === null || onEditProduct === void 0 || onEditProduct(dataSource);
94
+ }
95
+ }, locales.getText("pisell2.product.card.edit")) : null;
96
+ const defaultQuantityControl = (slots === null || slots === void 0 ? void 0 : slots.quantityControl) ? slots.quantityControl(slotContext) : /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}-a12__quantity-fallback` }, /* @__PURE__ */ React.createElement("span", null, display.quantityText || `× ${quantity}`));
97
+ const defaultActionRail = /* @__PURE__ */ React.createElement("aside", { className: `${PREFIX}-a12__rail` }, isShowDelete && onDelete ? /* @__PURE__ */ React.createElement("button", {
98
+ type: "button",
99
+ className: `${PREFIX}-a12__delete`,
100
+ "aria-label": locales.getText("pisell2.cart.sku-card.actions.delete"),
101
+ disabled,
102
+ onClick: (event) => {
103
+ event.preventDefault();
104
+ event.stopPropagation();
105
+ onDelete(dataSource);
106
+ }
107
+ }, /* @__PURE__ */ React.createElement(IconFont, { type: "pisell2-trash-01" })) : null, defaultPrice, defaultEdit, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}-a12__quantity-control` }, defaultQuantityControl));
108
+ const actionRail = (slots === null || slots === void 0 ? void 0 : slots.actionRail) ? slots.actionRail(_objectSpread2(_objectSpread2({}, slotContext), {}, {
109
+ defaultPrice,
110
+ defaultEdit,
111
+ defaultQuantityControl
112
+ })) : defaultActionRail;
113
+ return /* @__PURE__ */ React.createElement("div", {
114
+ className: classNames(`${PREFIX}-a12`, `${PREFIX}-a12--${(presentation === null || presentation === void 0 ? void 0 : presentation.density) || "comfortable"}`, `${PREFIX}-a12--align-${(presentation === null || presentation === void 0 ? void 0 : presentation.contentAlign) || "start"}`, !isShowImage && `pisell-cart-sku-card-a12--without-media`, presentation === null || presentation === void 0 ? void 0 : presentation.className),
115
+ style
116
+ }, isShowImage ? /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}-a12__media` }, (dataSource === null || dataSource === void 0 ? void 0 : dataSource.image) ? /* @__PURE__ */ React.createElement("img", {
117
+ alt: "",
118
+ src: image.ali(dataSource.image, 320),
119
+ style: { objectFit: (presentation === null || presentation === void 0 ? void 0 : presentation.mediaFit) || "cover" }
120
+ }) : /* @__PURE__ */ React.createElement("span", { "aria-hidden": "true" }, String((dataSource === null || dataSource === void 0 ? void 0 : dataSource.name) || "").slice(0, 2))) : null, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}-a12__content` }, display.eyebrow ? /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}-a12__eyebrow` }, display.eyebrow) : null, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}-a12__name` }, dataSource === null || dataSource === void 0 ? void 0 : dataSource.name), weighingInfo ? /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}-a12__weighing` }, /* @__PURE__ */ React.createElement(Weighing, {
121
+ dataSource: weighingInfo,
122
+ symbol
123
+ })) : null, specifications, contentFooter ? /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}-a12__content-footer` }, contentFooter) : null), actionRail);
124
+ };
125
+ //#endregion
126
+ export { A12 as default };