@pisell/materials 1.10.21 → 1.10.23
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.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +16 -16
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +19 -19
- package/es/components/PisellCards/index.d.ts +1 -0
- package/es/components/PisellFields/index.d.ts +1 -0
- package/es/components/PisellLayouts/index.d.ts +1 -0
- package/es/components/PisellMetrics/index.d.ts +1 -0
- package/es/components/PisellSelectionFlow/PisellSelectionFlow.js +2 -3
- package/es/components/appVersionControl/types.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Checkbox/WithMode.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Radio/WithMode.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/RecordListWrapper/index.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Select/index.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Tabs/index.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Translation/type.d.ts +1 -0
- package/es/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +1 -0
- package/es/components/drag-sort-tree/types.d.ts +1 -0
- package/es/components/filter/components/FilterButton/types.d.ts +1 -0
- package/es/components/input/index.d.ts +1 -0
- package/es/components/list/index.d.ts +1 -0
- package/es/components/page/dateLocale.js +33 -0
- package/es/components/page/index.d.ts +1 -0
- package/es/components/page/index.js +30 -4
- package/es/components/pisell-config-provider/context.d.ts +1 -0
- package/es/components/pisellFloorMapLayout/PisellFloorMapLayout.js +2 -1
- package/es/components/pisellFloorMapLayout/components/FigmaTableCard.d.ts +1 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapBuiltinShapeElement.d.ts +1 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapImageElement.d.ts +1 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapSelectionZoneElement.d.ts +1 -0
- package/es/components/pisellFloorMapLayout/components/ViewControlsWithZoom.js +22 -5
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapTransformMetrics.js +26 -3
- package/es/components/pisellGridPro/ToolBar/type.d.ts +1 -0
- package/es/components/pisellInput/index.d.ts +1 -0
- package/es/components/pisellMenu/types.d.ts +1 -0
- package/es/components/pisellQuickFilter/type.d.ts +1 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/PisellRecordBoardCalendarView.d.ts +1 -0
- package/es/components/pisellReservationSchedule/PisellReservationSchedule.d.ts +1 -0
- package/es/components/pisellReservationScheduleBand/PisellReservationScheduleBand.d.ts +1 -0
- package/es/components/pisellTimeNavigator/PisellTimeNavigator.d.ts +1 -0
- package/es/components/pisellWalletPassCard/index.d.ts +2 -0
- package/es/components/pisellWalletPassCard/index.js +2 -2
- package/es/components/productCard/cartSkuCard/index.js +33 -3
- package/es/components/productCard/cartSkuCard/index.less +18 -0
- package/es/components/productCard/cartSkuCard/types.d.ts +56 -0
- package/es/components/productCard/cartSkuCard/variants/A12/index.js +126 -0
- package/es/components/productCard/cartSkuCard/variants/A12/index.less +279 -0
- package/es/components/productCard/lineItem/index.js +42 -11
- package/es/components/productCard/types.d.ts +4 -1
- package/es/components/section-footers/index.d.ts +1 -0
- package/es/components/virtual-keyboard/Amount/types.d.ts +1 -0
- package/es/index.d.ts +2 -1
- package/lib/components/PisellBasicGrid/PisellBasicGrid.d.ts +1 -0
- package/lib/components/PisellCards/components/GraphicTextCard/GraphicTextCard.d.ts +1 -0
- package/lib/components/PisellCards/components/PisellImageCard/PisellImageCard.d.ts +1 -0
- package/lib/components/PisellCards/components/TabCard/TabCard.d.ts +1 -0
- package/lib/components/PisellCards/components/TextCard/TextCard.d.ts +1 -0
- package/lib/components/PisellCards/index.d.ts +1 -0
- package/lib/components/PisellFields/index.d.ts +1 -0
- package/lib/components/PisellGroupView/PisellGroupView.d.ts +1 -0
- package/lib/components/PisellLayouts/index.d.ts +1 -0
- package/lib/components/PisellMetrics/index.d.ts +1 -0
- package/lib/components/PisellSelectionFlow/PisellSelectionFlow.js +2 -3
- package/lib/components/appVersionControl/index.d.ts +1 -0
- package/lib/components/appVersionControl/types.d.ts +1 -0
- package/lib/components/auto-complete-number/index.d.ts +1 -0
- package/lib/components/badge/index.d.ts +1 -0
- package/lib/components/batch-editor/index.d.ts +1 -0
- package/lib/components/calendar/index.d.ts +1 -0
- package/lib/components/cardPro/index.d.ts +1 -0
- package/lib/components/checkbox/index.d.ts +1 -0
- package/lib/components/classicLayout/index.d.ts +1 -0
- package/lib/components/config-provider/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceWrapper/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Checkbox/WithMode.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Radio/WithMode.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Select/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Tabs/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Translation/type.d.ts +1 -0
- package/lib/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +1 -0
- package/lib/components/date-picker/index.d.ts +1 -0
- package/lib/components/drag-sort-tree/index.d.ts +1 -0
- package/lib/components/drag-sort-tree/types.d.ts +1 -0
- package/lib/components/dropdown/index.d.ts +1 -0
- package/lib/components/filter/components/FilterButton/types.d.ts +1 -0
- package/lib/components/filter/index.d.ts +1 -0
- package/lib/components/input/index.d.ts +1 -0
- package/lib/components/list/index.d.ts +1 -0
- package/lib/components/lowCodePage/index.d.ts +1 -0
- package/lib/components/page/dateLocale.js +35 -0
- package/lib/components/page/index.d.ts +2 -0
- package/lib/components/page/index.js +33 -4
- package/lib/components/pisell-config-provider/context.d.ts +1 -0
- package/lib/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.d.ts +1 -0
- package/lib/components/pisellAdjustPrice/index.d.ts +1 -0
- package/lib/components/pisellCard/index.d.ts +1 -0
- package/lib/components/pisellDatePicker/index.d.ts +1 -0
- package/lib/components/pisellFilter/index.d.ts +1 -0
- package/lib/components/pisellFloorMapLayout/PisellFloorMapLayout.js +2 -1
- package/lib/components/pisellFloorMapLayout/components/FigmaTableCard.d.ts +1 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapBuiltinShapeElement.d.ts +1 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapImageElement.d.ts +1 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapSelectionZoneElement.d.ts +1 -0
- package/lib/components/pisellFloorMapLayout/components/ViewControlsWithZoom.js +22 -5
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapTransformMetrics.js +26 -3
- package/lib/components/pisellGridPro/GridView/index.d.ts +1 -0
- package/lib/components/pisellGridPro/ToolBar/type.d.ts +1 -0
- package/lib/components/pisellInput/components/BankCard/index.d.ts +1 -0
- package/lib/components/pisellInput/components/Copy/index.d.ts +1 -0
- package/lib/components/pisellInput/components/SecurityCode/index.d.ts +1 -0
- package/lib/components/pisellInput/index.d.ts +1 -0
- package/lib/components/pisellLoading/index.d.ts +1 -0
- package/lib/components/pisellMenu/types.d.ts +1 -0
- package/lib/components/pisellQuickFilter/type.d.ts +1 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/PisellRecordBoardCalendarView.d.ts +1 -0
- package/lib/components/pisellReservationSchedule/PisellReservationSchedule.d.ts +1 -0
- package/lib/components/pisellReservationScheduleBand/PisellReservationScheduleBand.d.ts +1 -0
- package/lib/components/pisellSort/index.d.ts +1 -0
- package/lib/components/pisellTimeNavigator/PisellTimeNavigator.d.ts +1 -0
- package/lib/components/pisellTooltip/index.d.ts +1 -0
- package/lib/components/pisellUpload/index.d.ts +1 -0
- package/lib/components/pisellWalletPassCard/index.d.ts +2 -0
- package/lib/components/pisellWalletPassCard/index.js +2 -2
- package/lib/components/productCard/cartSkuCard/index.js +33 -3
- package/lib/components/productCard/cartSkuCard/index.less +18 -0
- package/lib/components/productCard/cartSkuCard/types.d.ts +56 -0
- package/lib/components/productCard/cartSkuCard/variants/A12/index.js +129 -0
- package/lib/components/productCard/cartSkuCard/variants/A12/index.less +279 -0
- package/lib/components/productCard/lineItem/index.js +42 -11
- package/lib/components/productCard/types.d.ts +4 -1
- package/lib/components/qrcode/index.d.ts +1 -0
- package/lib/components/radio/index.d.ts +1 -0
- package/lib/components/section-footers/index.d.ts +1 -0
- package/lib/components/segmented/index.d.ts +1 -0
- package/lib/components/select-time/index.d.ts +1 -0
- package/lib/components/skeleton/index.d.ts +1 -0
- package/lib/components/slider/index.d.ts +1 -0
- package/lib/components/time-picker/index.d.ts +1 -0
- package/lib/components/upload/index.d.ts +1 -0
- package/lib/components/versionSelect/index.d.ts +1 -0
- package/lib/components/virtual-keyboard/Amount/index.d.ts +1 -0
- package/lib/components/virtual-keyboard/Amount/types.d.ts +1 -0
- package/lib/components/virtual-keyboard/Number/index.d.ts +1 -0
- package/lib/index.d.ts +2 -1
- package/package.json +1 -1
|
@@ -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 };
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
.pisell-cart-sku-card-a12 {
|
|
2
|
+
--pc-a12-bg: #fff;
|
|
3
|
+
--pc-a12-border-color: #e4e7ec;
|
|
4
|
+
--pc-a12-radius: 18px;
|
|
5
|
+
--pc-a12-min-height: 164px;
|
|
6
|
+
--pc-a12-media-width: 228px;
|
|
7
|
+
--pc-a12-rail-width: 190px;
|
|
8
|
+
--pc-a12-content-padding: 20px 22px;
|
|
9
|
+
--pc-a12-rail-padding: 18px 20px;
|
|
10
|
+
--pc-a12-accent: #b20d12;
|
|
11
|
+
--pc-a12-title-color: #101828;
|
|
12
|
+
--pc-a12-title-size: 32px;
|
|
13
|
+
--pc-a12-title-weight: 800;
|
|
14
|
+
--pc-a12-price-color: var(--pc-a12-accent);
|
|
15
|
+
--pc-a12-price-size: 30px;
|
|
16
|
+
--pc-a12-option-bg: #f5f6f8;
|
|
17
|
+
--pc-a12-option-label-color: #667085;
|
|
18
|
+
--pc-a12-option-value-color: #101828;
|
|
19
|
+
--pc-a12-option-gap: 6px;
|
|
20
|
+
--pc-a12-shadow: 0 12px 28px rgba(16, 24, 40, 0.08);
|
|
21
|
+
|
|
22
|
+
display: grid;
|
|
23
|
+
grid-template-columns:
|
|
24
|
+
var(--pc-a12-media-width)
|
|
25
|
+
minmax(0, 1fr)
|
|
26
|
+
var(--pc-a12-rail-width);
|
|
27
|
+
min-height: var(--pc-a12-min-height);
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
border: 1px solid var(--pc-a12-border-color);
|
|
30
|
+
border-radius: var(--pc-a12-radius);
|
|
31
|
+
background: var(--pc-a12-bg);
|
|
32
|
+
box-shadow: var(--pc-a12-shadow);
|
|
33
|
+
hyphens: none;
|
|
34
|
+
overflow-wrap: normal;
|
|
35
|
+
word-break: normal;
|
|
36
|
+
|
|
37
|
+
&--without-media {
|
|
38
|
+
grid-template-columns: minmax(0, 1fr) var(--pc-a12-rail-width);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&__media {
|
|
42
|
+
position: relative;
|
|
43
|
+
display: grid;
|
|
44
|
+
min-height: var(--pc-a12-min-height);
|
|
45
|
+
place-items: center;
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
background: #f2f4f7;
|
|
48
|
+
color: var(--pc-a12-accent);
|
|
49
|
+
font-size: 32px;
|
|
50
|
+
font-weight: 800;
|
|
51
|
+
|
|
52
|
+
img {
|
|
53
|
+
position: absolute;
|
|
54
|
+
inset: 0;
|
|
55
|
+
display: block;
|
|
56
|
+
width: 100%;
|
|
57
|
+
height: 100%;
|
|
58
|
+
min-height: 0;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&__content {
|
|
63
|
+
display: flex;
|
|
64
|
+
min-width: 0;
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
justify-content: flex-start;
|
|
67
|
+
padding: var(--pc-a12-content-padding);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&__content-footer {
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
gap: 8px;
|
|
74
|
+
margin-top: auto;
|
|
75
|
+
padding-top: 12px;
|
|
76
|
+
|
|
77
|
+
.ant-divider {
|
|
78
|
+
margin: 0 !important;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&--align-center &__content {
|
|
83
|
+
justify-content: center;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&__eyebrow {
|
|
87
|
+
overflow: hidden;
|
|
88
|
+
margin-bottom: 4px;
|
|
89
|
+
color: var(--pc-a12-accent);
|
|
90
|
+
font-size: 14px;
|
|
91
|
+
font-weight: 800;
|
|
92
|
+
line-height: 20px;
|
|
93
|
+
text-overflow: ellipsis;
|
|
94
|
+
text-transform: uppercase;
|
|
95
|
+
white-space: nowrap;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&__name {
|
|
99
|
+
min-width: 0;
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
color: var(--pc-a12-title-color);
|
|
102
|
+
font-size: var(--pc-a12-title-size);
|
|
103
|
+
font-weight: var(--pc-a12-title-weight);
|
|
104
|
+
line-height: 1.15;
|
|
105
|
+
text-overflow: ellipsis;
|
|
106
|
+
white-space: nowrap;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&__weighing {
|
|
110
|
+
min-width: 0;
|
|
111
|
+
margin-top: 8px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&__specifications {
|
|
115
|
+
display: grid;
|
|
116
|
+
grid-template-columns: repeat(
|
|
117
|
+
var(--pc-a12-option-columns, 2),
|
|
118
|
+
minmax(0, 1fr)
|
|
119
|
+
);
|
|
120
|
+
gap: var(--pc-a12-option-gap);
|
|
121
|
+
margin-top: 10px;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&__specification,
|
|
125
|
+
&__specification-summary {
|
|
126
|
+
min-width: 0;
|
|
127
|
+
padding: 7px 9px;
|
|
128
|
+
border-radius: 7px;
|
|
129
|
+
background: var(--pc-a12-option-bg);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&__specification {
|
|
133
|
+
display: flex;
|
|
134
|
+
flex-direction: column;
|
|
135
|
+
gap: 2px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&__specification-label {
|
|
139
|
+
overflow: hidden;
|
|
140
|
+
color: var(--pc-a12-option-label-color);
|
|
141
|
+
font-size: 11px;
|
|
142
|
+
font-weight: 700;
|
|
143
|
+
line-height: 16px;
|
|
144
|
+
text-overflow: ellipsis;
|
|
145
|
+
white-space: nowrap;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&__specification-value,
|
|
149
|
+
&__specification-summary {
|
|
150
|
+
overflow: hidden;
|
|
151
|
+
color: var(--pc-a12-option-value-color);
|
|
152
|
+
font-size: 16px;
|
|
153
|
+
font-weight: 700;
|
|
154
|
+
line-height: 20px;
|
|
155
|
+
text-overflow: ellipsis;
|
|
156
|
+
white-space: nowrap;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&__rail {
|
|
160
|
+
position: relative;
|
|
161
|
+
display: flex;
|
|
162
|
+
min-width: 0;
|
|
163
|
+
flex-direction: column;
|
|
164
|
+
align-items: center;
|
|
165
|
+
justify-content: center;
|
|
166
|
+
padding: var(--pc-a12-rail-padding);
|
|
167
|
+
border-left: 1px solid var(--pc-a12-border-color);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
&__delete {
|
|
171
|
+
position: absolute;
|
|
172
|
+
top: 6px;
|
|
173
|
+
right: 6px;
|
|
174
|
+
display: grid;
|
|
175
|
+
width: 42px;
|
|
176
|
+
height: 42px;
|
|
177
|
+
padding: 0;
|
|
178
|
+
place-items: center;
|
|
179
|
+
border: 0;
|
|
180
|
+
border-radius: 50%;
|
|
181
|
+
background: transparent;
|
|
182
|
+
color: var(--pc-a12-accent);
|
|
183
|
+
font-size: 26px;
|
|
184
|
+
cursor: pointer;
|
|
185
|
+
|
|
186
|
+
.anticon,
|
|
187
|
+
svg {
|
|
188
|
+
width: 30px;
|
|
189
|
+
height: 30px;
|
|
190
|
+
font-size: 30px;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
&:active {
|
|
194
|
+
background: #fef3f2;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
&:disabled {
|
|
198
|
+
cursor: not-allowed;
|
|
199
|
+
opacity: 0.5;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
&__price {
|
|
204
|
+
display: flex;
|
|
205
|
+
flex-direction: column;
|
|
206
|
+
align-items: center;
|
|
207
|
+
color: var(--pc-a12-price-color);
|
|
208
|
+
|
|
209
|
+
strong {
|
|
210
|
+
font-size: var(--pc-a12-price-size);
|
|
211
|
+
font-weight: 800;
|
|
212
|
+
line-height: 1.15;
|
|
213
|
+
white-space: nowrap;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
del {
|
|
217
|
+
color: #667085;
|
|
218
|
+
font-size: 13px;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
&__edit {
|
|
223
|
+
min-width: 62px;
|
|
224
|
+
min-height: 38px;
|
|
225
|
+
margin-top: 10px;
|
|
226
|
+
padding: 7px 14px;
|
|
227
|
+
border: 1px solid #f5b7ba;
|
|
228
|
+
border-radius: 999px;
|
|
229
|
+
background: #fff;
|
|
230
|
+
color: var(--pc-a12-accent);
|
|
231
|
+
font: inherit;
|
|
232
|
+
font-size: 14px;
|
|
233
|
+
font-weight: 700;
|
|
234
|
+
white-space: nowrap;
|
|
235
|
+
cursor: pointer;
|
|
236
|
+
|
|
237
|
+
&:disabled {
|
|
238
|
+
cursor: not-allowed;
|
|
239
|
+
opacity: 0.5;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
&__quantity-control {
|
|
244
|
+
display: flex;
|
|
245
|
+
width: 100%;
|
|
246
|
+
min-height: 44px;
|
|
247
|
+
align-items: center;
|
|
248
|
+
justify-content: center;
|
|
249
|
+
margin-top: 10px;
|
|
250
|
+
padding-top: 10px;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
&__quantity-fallback {
|
|
254
|
+
display: flex;
|
|
255
|
+
align-items: center;
|
|
256
|
+
justify-content: center;
|
|
257
|
+
gap: 16px;
|
|
258
|
+
font-weight: 700;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
&--compact {
|
|
262
|
+
--pc-a12-min-height: 132px;
|
|
263
|
+
--pc-a12-media-width: 124px;
|
|
264
|
+
--pc-a12-rail-width: 156px;
|
|
265
|
+
--pc-a12-content-padding: 15px 18px;
|
|
266
|
+
--pc-a12-rail-padding: 14px 16px;
|
|
267
|
+
--pc-a12-price-size: 25px;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
@container (max-width: 620px) {
|
|
272
|
+
.pisell-cart-sku-card-a12 {
|
|
273
|
+
--pc-a12-media-width: 112px;
|
|
274
|
+
--pc-a12-rail-width: 150px;
|
|
275
|
+
--pc-a12-content-padding: 14px;
|
|
276
|
+
--pc-a12-price-size: 24px;
|
|
277
|
+
--pc-a12-option-columns: 1;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
@@ -34,6 +34,7 @@ const _excluded = [
|
|
|
34
34
|
"holderOptions",
|
|
35
35
|
"onBookingStatusChange",
|
|
36
36
|
"onAddTimeProductCard",
|
|
37
|
+
"a12UnsupportedFallback",
|
|
37
38
|
"onAction",
|
|
38
39
|
"onDelete",
|
|
39
40
|
"onNote",
|
|
@@ -47,6 +48,7 @@ const isBookingItem = (dataSource) => {
|
|
|
47
48
|
var _dataSource$_extend;
|
|
48
49
|
return Boolean((dataSource === null || dataSource === void 0 || (_dataSource$_extend = dataSource._extend) === null || _dataSource$_extend === void 0 ? void 0 : _dataSource$_extend.product) || (dataSource === null || dataSource === void 0 ? void 0 : dataSource.booking_id) || (dataSource === null || dataSource === void 0 ? void 0 : dataSource.appointment_status) || (dataSource === null || dataSource === void 0 ? void 0 : dataSource.start_date));
|
|
49
50
|
};
|
|
51
|
+
const resolveLineItemType = ({ requestedType, itemKind, hasBundle, fallback = "a9" }) => requestedType === "a12" && (itemKind === "booking" || hasBundle) ? fallback : requestedType;
|
|
50
52
|
const translateText = (text, translationOriginal) => {
|
|
51
53
|
if (typeof text === "string") return text;
|
|
52
54
|
if (!text) return "";
|
|
@@ -126,14 +128,36 @@ const mapLineItemOptions = (options, translationOriginal) => options.map((option
|
|
|
126
128
|
num: (_ref2 = (_option$num2 = option.num) !== null && _option$num2 !== void 0 ? _option$num2 : option.quantity) !== null && _ref2 !== void 0 ? _ref2 : 1
|
|
127
129
|
});
|
|
128
130
|
});
|
|
131
|
+
const getFirstDisplayText = (candidates, translationOriginal) => {
|
|
132
|
+
for (const candidate of candidates) {
|
|
133
|
+
const translated = translateText(candidate, translationOriginal).trim();
|
|
134
|
+
if (translated) return translated;
|
|
135
|
+
}
|
|
136
|
+
return "";
|
|
137
|
+
};
|
|
138
|
+
const resolveA12Eyebrow = (product, translationOriginal) => {
|
|
139
|
+
var _product$a, _product$metadata2, _product$metadata3, _categories$find, _categories$;
|
|
140
|
+
const categories = Array.isArray(product === null || product === void 0 ? void 0 : product.categories) ? product.categories : Array.isArray(product === null || product === void 0 ? void 0 : product.product_categories) ? product.product_categories : [];
|
|
141
|
+
return getFirstDisplayText([
|
|
142
|
+
product === null || product === void 0 || (_product$a = product.a12) === null || _product$a === void 0 ? void 0 : _product$a.eyebrow,
|
|
143
|
+
product === null || product === void 0 ? void 0 : product.category_name,
|
|
144
|
+
product === null || product === void 0 ? void 0 : product.product_category_name,
|
|
145
|
+
product === null || product === void 0 ? void 0 : product.product_type_name,
|
|
146
|
+
product === null || product === void 0 || (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.category_name,
|
|
147
|
+
product === null || product === void 0 || (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.product_category_name,
|
|
148
|
+
(_categories$find = categories.find((category) => category === null || category === void 0 ? void 0 : category.direct)) === null || _categories$find === void 0 ? void 0 : _categories$find.name,
|
|
149
|
+
(_categories$ = categories[0]) === null || _categories$ === void 0 ? void 0 : _categories$.name
|
|
150
|
+
], translationOriginal);
|
|
151
|
+
};
|
|
129
152
|
const convertProductToLineItemProduct = (product, translationOriginal, symbol, amountFormatter) => {
|
|
130
|
-
var _product$
|
|
153
|
+
var _product$metadata4, _ref3, _product$num, _ref4, _product$num2, _product$metadata5, _product$metadata6, _product$product_opti, _product$product_sku2, _product$discount_lis, _product$discount_lis2, _product$metadata7, _product$metadata8, _ref5, _product$num3;
|
|
131
154
|
const title = translateText(product.product_title || product.title, translationOriginal);
|
|
132
155
|
const bundle = (product.product_bundle || []).map((bundleItem) => convertBundle(bundleItem, translationOriginal, amountFormatter));
|
|
133
156
|
const lineOriginTotal = resolveLineOriginTotal(product);
|
|
134
157
|
const lineOptions = mapLineItemOptions(resolveLineItemOptions(product), translationOriginal);
|
|
158
|
+
const a12Eyebrow = resolveA12Eyebrow(product, translationOriginal);
|
|
135
159
|
return {
|
|
136
|
-
_id: ((_product$
|
|
160
|
+
_id: ((_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.unique_identification_number) || product.order_detail_id || product.product_id,
|
|
137
161
|
id: product.product_id,
|
|
138
162
|
product_id: product.product_id,
|
|
139
163
|
product_variant_id: product.product_variant_id,
|
|
@@ -144,11 +168,11 @@ const convertProductToLineItemProduct = (product, translationOriginal, symbol, a
|
|
|
144
168
|
image: product.cover,
|
|
145
169
|
num: (_ref3 = (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : product.product_quantity) !== null && _ref3 !== void 0 ? _ref3 : 1,
|
|
146
170
|
quantity: (_ref4 = (_product$num2 = product.num) !== null && _product$num2 !== void 0 ? _product$num2 : product.product_quantity) !== null && _ref4 !== void 0 ? _ref4 : 1,
|
|
147
|
-
price: (_product$
|
|
171
|
+
price: (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.source_product_price,
|
|
148
172
|
total: product.selling_price,
|
|
149
173
|
origin_total: lineOriginTotal,
|
|
150
174
|
original_total: lineOriginTotal,
|
|
151
|
-
source_product_price: (_product$
|
|
175
|
+
source_product_price: (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.source_product_price,
|
|
152
176
|
selling_price: product.selling_price,
|
|
153
177
|
payment_price: product.payment_price,
|
|
154
178
|
tax_fee: product.tax_fee,
|
|
@@ -158,12 +182,13 @@ const convertProductToLineItemProduct = (product, translationOriginal, symbol, a
|
|
|
158
182
|
product_sku: product.product_sku,
|
|
159
183
|
product_bundle: bundle,
|
|
160
184
|
bundle,
|
|
161
|
-
product_option_string: product.product_option_string,
|
|
185
|
+
product_option_string: (_product$product_opti = product.product_option_string) !== null && _product$product_opti !== void 0 ? _product$product_opti : (_product$product_sku2 = product.product_sku) === null || _product$product_sku2 === void 0 ? void 0 : _product$product_sku2.product_option_string,
|
|
162
186
|
options: lineOptions,
|
|
187
|
+
a12: _objectSpread2(_objectSpread2({}, product.a12 || {}), a12Eyebrow ? { eyebrow: a12Eyebrow } : {}),
|
|
163
188
|
discount_list: product.discount_list,
|
|
164
189
|
promotions: product.promotions,
|
|
165
|
-
discount_reason: (_product$discount_lis = (_product$discount_lis2 = product.discount_list) === null || _product$discount_lis2 === void 0 || (_product$discount_lis2 = _product$discount_lis2.find((d) => (d === null || d === void 0 ? void 0 : d.type) === "product")) === null || _product$discount_lis2 === void 0 || (_product$discount_lis2 = _product$discount_lis2.discount) === null || _product$discount_lis2 === void 0 ? void 0 : _product$discount_lis2.message) !== null && _product$discount_lis !== void 0 ? _product$discount_lis : (_product$
|
|
166
|
-
isGift: Boolean(product.gift_card || product.isGift || product._isGiftPromotion || ((_product$
|
|
190
|
+
discount_reason: (_product$discount_lis = (_product$discount_lis2 = product.discount_list) === null || _product$discount_lis2 === void 0 || (_product$discount_lis2 = _product$discount_lis2.find((d) => (d === null || d === void 0 ? void 0 : d.type) === "product")) === null || _product$discount_lis2 === void 0 || (_product$discount_lis2 = _product$discount_lis2.discount) === null || _product$discount_lis2 === void 0 ? void 0 : _product$discount_lis2.message) !== null && _product$discount_lis !== void 0 ? _product$discount_lis : (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.product_discount_reason,
|
|
191
|
+
isGift: Boolean(product.gift_card || product.isGift || product._isGiftPromotion || ((_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8._giftInfo) || product._giftInfo),
|
|
167
192
|
giftData: product.giftData,
|
|
168
193
|
_origin: product,
|
|
169
194
|
_extend: {
|
|
@@ -183,7 +208,7 @@ const convertProductToLineItemProduct = (product, translationOriginal, symbol, a
|
|
|
183
208
|
};
|
|
184
209
|
const LineItem = (props) => {
|
|
185
210
|
var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _dataSource$_extend2, _dataSource$_extend4;
|
|
186
|
-
const { dataSource = defaultValue.dataSource, itemType, type = "a9", isShowBookingHeader, rightActions = [], rightActionsDisplay = "swipe", escapeDom, isShowImage = defaultValue.isShowImage, isShowDelete = defaultValue.isShowDelete, isShowInlineDelete = isShowDelete, isShowNote = defaultValue.isShowNote, isShowAmountFooter = defaultValue.isShowAmountFooter, disabledClick = defaultValue.disabledClick, disabledEdit = defaultValue.disabledEdit, disabledNoteEdit = disabledEdit, statusOptions = [], statusLoading = false, statusDisabled = false, isShowRelatedProduct = true, holderOptions, onBookingStatusChange, onAddTimeProductCard, onAction, onDelete, onNote, onCard, onPromotion, onGift, symbol: amountSymbol, amountFormatter } = props, other = _objectWithoutProperties(props, _excluded);
|
|
211
|
+
const { dataSource = defaultValue.dataSource, itemType, type = "a9", isShowBookingHeader, rightActions = [], rightActionsDisplay = "swipe", escapeDom, isShowImage = defaultValue.isShowImage, isShowDelete = defaultValue.isShowDelete, isShowInlineDelete = isShowDelete, isShowNote = defaultValue.isShowNote, isShowAmountFooter = defaultValue.isShowAmountFooter, disabledClick = defaultValue.disabledClick, disabledEdit = defaultValue.disabledEdit, disabledNoteEdit = disabledEdit, statusOptions = [], statusLoading = false, statusDisabled = false, isShowRelatedProduct = true, holderOptions, onBookingStatusChange, onAddTimeProductCard, a12UnsupportedFallback = "a9", onAction, onDelete, onNote, onCard, onPromotion, onGift, symbol: amountSymbol, amountFormatter } = props, other = _objectWithoutProperties(props, _excluded);
|
|
187
212
|
const itemKind = itemType || (isBookingItem(dataSource) ? "booking" : "product");
|
|
188
213
|
const context = useEngineContext();
|
|
189
214
|
const translationOriginal = useTranslationOriginal();
|
|
@@ -217,9 +242,15 @@ const LineItem = (props) => {
|
|
|
217
242
|
symbol,
|
|
218
243
|
translationOriginal
|
|
219
244
|
]);
|
|
245
|
+
const resolvedType = resolveLineItemType({
|
|
246
|
+
requestedType: type,
|
|
247
|
+
itemKind,
|
|
248
|
+
hasBundle: Boolean(Array.isArray(dataSource === null || dataSource === void 0 ? void 0 : dataSource.product_bundle) && dataSource.product_bundle.length || Array.isArray(dataSource === null || dataSource === void 0 ? void 0 : dataSource.bundle) && dataSource.bundle.length),
|
|
249
|
+
fallback: a12UnsupportedFallback
|
|
250
|
+
});
|
|
220
251
|
if (itemKind === "product") return /* @__PURE__ */ React.createElement(CartSkuCard, _objectSpread2(_objectSpread2({}, other), {}, {
|
|
221
252
|
dataSource: productDataSource,
|
|
222
|
-
type,
|
|
253
|
+
type: resolvedType,
|
|
223
254
|
rightActions,
|
|
224
255
|
rightActionsDisplay,
|
|
225
256
|
escapeDom,
|
|
@@ -240,8 +271,8 @@ const LineItem = (props) => {
|
|
|
240
271
|
}));
|
|
241
272
|
return /* @__PURE__ */ React.createElement(BookingLineItem, _objectSpread2(_objectSpread2({}, other), {}, {
|
|
242
273
|
dataSource,
|
|
243
|
-
type,
|
|
244
|
-
cartSkuType:
|
|
274
|
+
type: resolvedType,
|
|
275
|
+
cartSkuType: resolvedType,
|
|
245
276
|
isShowBookingHeader,
|
|
246
277
|
relatedProductDataSource,
|
|
247
278
|
addTimeProductDataSources,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { CartSkuCardA12Display } from "./cartSkuCard/types.js";
|
|
2
|
+
|
|
1
3
|
//#region src/components/productCard/types.d.ts
|
|
2
4
|
type bundleType = {
|
|
3
5
|
id: number;
|
|
@@ -59,7 +61,8 @@ type productType = {
|
|
|
59
61
|
is_show_week?: boolean;
|
|
60
62
|
promotions?: any[];
|
|
61
63
|
isGift?: boolean;
|
|
62
|
-
giftData?: any;
|
|
64
|
+
giftData?: any; /** A12 横向购物车卡片的归一化展示数据。 */
|
|
65
|
+
a12?: CartSkuCardA12Display;
|
|
63
66
|
};
|
|
64
67
|
/**
|
|
65
68
|
* 排序总配置
|