@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
|
@@ -536,8 +536,11 @@ function useFloorMapTransformMetrics(params) {
|
|
|
536
536
|
persistKeyRef.current = viewportPersistKey;
|
|
537
537
|
const persistTimerRef = (0, react.useRef)(null);
|
|
538
538
|
const flushPersistRef = (0, react.useRef)(null);
|
|
539
|
-
|
|
540
|
-
|
|
539
|
+
/** Dock 按钮触发的是程序化动画,快速切画布时 onZoomStop 可能来不及触发。 */
|
|
540
|
+
const viewportControlPersistKeyRef = (0, react.useRef)();
|
|
541
|
+
const viewportControlTimerRef = (0, react.useRef)(null);
|
|
542
|
+
const schedulePersistViewport = (0, react.useCallback)((snapshot, explicitKey) => {
|
|
543
|
+
const key = explicitKey !== null && explicitKey !== void 0 ? explicitKey : persistKeyRef.current;
|
|
541
544
|
if (!key) return;
|
|
542
545
|
if (persistTimerRef.current != null) {
|
|
543
546
|
clearTimeout(persistTimerRef.current);
|
|
@@ -552,6 +555,14 @@ function useFloorMapTransformMetrics(params) {
|
|
|
552
555
|
flushPersistRef.current = doWrite;
|
|
553
556
|
persistTimerRef.current = setTimeout(doWrite, 300);
|
|
554
557
|
}, []);
|
|
558
|
+
const markViewportControlInteraction = (0, react.useCallback)(() => {
|
|
559
|
+
viewportControlPersistKeyRef.current = persistKeyRef.current;
|
|
560
|
+
if (viewportControlTimerRef.current != null) clearTimeout(viewportControlTimerRef.current);
|
|
561
|
+
viewportControlTimerRef.current = setTimeout(() => {
|
|
562
|
+
viewportControlTimerRef.current = null;
|
|
563
|
+
viewportControlPersistKeyRef.current = void 0;
|
|
564
|
+
}, FIT_BOUNDS_PROGRAMMATIC_TWEEN_GUARD_MS);
|
|
565
|
+
}, []);
|
|
555
566
|
/**
|
|
556
567
|
* 由 onTransformed 回调统一上报当前 transform:
|
|
557
568
|
* - 写 lastTransformRef(替代父组件直接赋值)
|
|
@@ -570,6 +581,12 @@ function useFloorMapTransformMetrics(params) {
|
|
|
570
581
|
y,
|
|
571
582
|
scale: nextScale
|
|
572
583
|
};
|
|
584
|
+
const controlKey = viewportControlPersistKeyRef.current;
|
|
585
|
+
if (controlKey) schedulePersistViewport({
|
|
586
|
+
x,
|
|
587
|
+
y,
|
|
588
|
+
scale: nextScale
|
|
589
|
+
}, controlKey);
|
|
573
590
|
const snap = lastFitSnapshotRef.current;
|
|
574
591
|
if (snap) {
|
|
575
592
|
const same = Math.abs(snap.x - x) < .5 && Math.abs(snap.y - y) < .5 && Math.abs(snap.scale - nextScale) < .005;
|
|
@@ -583,7 +600,7 @@ function useFloorMapTransformMetrics(params) {
|
|
|
583
600
|
}
|
|
584
601
|
setIsAtFitBounds((prev) => prev === same ? prev : same);
|
|
585
602
|
} else setIsAtFitBounds((prev) => prev ? false : prev);
|
|
586
|
-
}, [clearFitBoundsTweenHold]);
|
|
603
|
+
}, [clearFitBoundsTweenHold, schedulePersistViewport]);
|
|
587
604
|
/**
|
|
588
605
|
* 用户交互结束时(pan / zoom / pinch / wheel stop)调用:
|
|
589
606
|
* 以 lastTransformRef 当前值为快照写 localStorage(debounce 兜底高频 stop)。
|
|
@@ -718,6 +735,11 @@ function useFloorMapTransformMetrics(params) {
|
|
|
718
735
|
(0, react.useEffect)(() => {
|
|
719
736
|
return () => {
|
|
720
737
|
var _flushPersistRef$curr;
|
|
738
|
+
if (viewportControlTimerRef.current != null) {
|
|
739
|
+
clearTimeout(viewportControlTimerRef.current);
|
|
740
|
+
viewportControlTimerRef.current = null;
|
|
741
|
+
}
|
|
742
|
+
viewportControlPersistKeyRef.current = void 0;
|
|
721
743
|
if (persistTimerRef.current != null) {
|
|
722
744
|
clearTimeout(persistTimerRef.current);
|
|
723
745
|
persistTimerRef.current = null;
|
|
@@ -751,6 +773,7 @@ function useFloorMapTransformMetrics(params) {
|
|
|
751
773
|
isAtFitBounds,
|
|
752
774
|
notifyTransformed,
|
|
753
775
|
persistCurrentViewport,
|
|
776
|
+
markViewportControlInteraction,
|
|
754
777
|
attachTransformContext,
|
|
755
778
|
lastTransformRef,
|
|
756
779
|
isInteractingWithElement,
|
|
@@ -43,7 +43,7 @@ const PisellWalletPassCard = (props) => {
|
|
|
43
43
|
if (pressTimer) clearTimeout(pressTimer);
|
|
44
44
|
};
|
|
45
45
|
}, [pressTimer]);
|
|
46
|
-
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;
|
|
46
|
+
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;
|
|
47
47
|
(0, react.useEffect)(() => {
|
|
48
48
|
document.body.id = "body";
|
|
49
49
|
}, []);
|
|
@@ -271,7 +271,7 @@ const PisellWalletPassCard = (props) => {
|
|
|
271
271
|
active,
|
|
272
272
|
data: props
|
|
273
273
|
}) : balanceTitle || require_index.getText("pisell-wallet-pass-card-balance"), disabled || isMini ? ": " : "");
|
|
274
|
-
const createOriginalBalanceDom = () => /* @__PURE__ */ react.default.createElement(require_index$4.default, {
|
|
274
|
+
const createOriginalBalanceDom = () => formattedBalance !== void 0 ? /* @__PURE__ */ react.default.createElement("span", { className: "pisell-card-amount-item-value" }, formattedBalance) : /* @__PURE__ */ react.default.createElement(require_index$4.default, {
|
|
275
275
|
className: "pisell-card-amount-item-value",
|
|
276
276
|
useThousandsSeparator: true,
|
|
277
277
|
value: balance,
|
|
@@ -20,6 +20,7 @@ const require_index$12 = require("./components/Promotion/index.js");
|
|
|
20
20
|
const require_index$13 = require("./components/Gift/index.js");
|
|
21
21
|
const require_index$14 = require("./components/BookingItem/index.js");
|
|
22
22
|
const require_index$15 = require("./components/inlineActions/index.js");
|
|
23
|
+
const require_index$16 = require("./variants/A12/index.js");
|
|
23
24
|
let react = require("react");
|
|
24
25
|
react = require_runtime.__toESM(react);
|
|
25
26
|
let _pisell_utils = require("@pisell/utils");
|
|
@@ -59,12 +60,14 @@ const _excluded = [
|
|
|
59
60
|
"rightActionsDisplay",
|
|
60
61
|
"escapeDom",
|
|
61
62
|
"maxSpecsCount",
|
|
62
|
-
"isShowRelatedProduct"
|
|
63
|
+
"isShowRelatedProduct",
|
|
64
|
+
"a12Slots",
|
|
65
|
+
"a12Presentation"
|
|
63
66
|
];
|
|
64
67
|
const PREFIX = "pisell-cart-sku-card";
|
|
65
68
|
const CartSkuCard = (props) => {
|
|
66
69
|
var _context$appHelper$ut;
|
|
67
|
-
const { dataSource = require_status.defaultValue.dataSource, isShowImage = require_status.defaultValue.isShowImage, isShowQuantityBadge = true, isShowOriginalPrice = require_status.defaultValue.isShowOriginalPrice, isShowHolder = require_status.defaultValue.isShowHolder, isShowNote = require_status.defaultValue.isShowNote, isShowDelete = require_status.defaultValue.isShowDelete, isShowInlineDelete = isShowDelete, isShowAmountFooter = require_status.defaultValue.isShowAmountFooter, isShowPackageNote = require_status.defaultValue.isShowPackageNote, isShowEditProduct = require_status.defaultValue.isShowEditProduct, disabledClick = require_status.defaultValue.disabledClick, disabledEditClick = require_status.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 = require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
|
|
70
|
+
const { dataSource = require_status.defaultValue.dataSource, isShowImage = require_status.defaultValue.isShowImage, isShowQuantityBadge = true, isShowOriginalPrice = require_status.defaultValue.isShowOriginalPrice, isShowHolder = require_status.defaultValue.isShowHolder, isShowNote = require_status.defaultValue.isShowNote, isShowDelete = require_status.defaultValue.isShowDelete, isShowInlineDelete = isShowDelete, isShowAmountFooter = require_status.defaultValue.isShowAmountFooter, isShowPackageNote = require_status.defaultValue.isShowPackageNote, isShowEditProduct = require_status.defaultValue.isShowEditProduct, disabledClick = require_status.defaultValue.disabledClick, disabledEditClick = require_status.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 = require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
|
|
68
71
|
const useOpenNoteRef = (0, react.useRef)();
|
|
69
72
|
const context = require_useEngineContext.default();
|
|
70
73
|
_pisell_utils.locales.init(require_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");
|
|
@@ -222,13 +225,37 @@ const CartSkuCard = (props) => {
|
|
|
222
225
|
openNote: openNoteEditor
|
|
223
226
|
})) : null);
|
|
224
227
|
};
|
|
228
|
+
const renderA12 = () => {
|
|
229
|
+
var _a12Slots$contentFoot;
|
|
230
|
+
const note = isShowNote ? /* @__PURE__ */ react.default.createElement(require_index$9.default, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, other), {}, {
|
|
231
|
+
item: dataSource,
|
|
232
|
+
disabledEdit: disabledNoteEdit !== null && disabledNoteEdit !== void 0 ? disabledNoteEdit : other.disabledEdit,
|
|
233
|
+
openNote: openNoteEditor
|
|
234
|
+
})) : null;
|
|
235
|
+
const slots = note ? require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, a12Slots), {}, { contentFooter: (_a12Slots$contentFoot = a12Slots === null || a12Slots === void 0 ? void 0 : a12Slots.contentFooter) !== null && _a12Slots$contentFoot !== void 0 ? _a12Slots$contentFoot : (() => note) }) : a12Slots;
|
|
236
|
+
return /* @__PURE__ */ react.default.createElement(require_index$16.default, {
|
|
237
|
+
dataSource,
|
|
238
|
+
isShowImage,
|
|
239
|
+
isShowDelete,
|
|
240
|
+
isShowOriginalPrice,
|
|
241
|
+
isShowEditProduct,
|
|
242
|
+
disabled: Boolean(disabledClick),
|
|
243
|
+
disabledEditClick,
|
|
244
|
+
slots,
|
|
245
|
+
presentation: a12Presentation,
|
|
246
|
+
onDelete,
|
|
247
|
+
onEditProduct
|
|
248
|
+
});
|
|
249
|
+
};
|
|
225
250
|
const renderContent = () => {
|
|
251
|
+
if (type === "a12") return renderA12();
|
|
226
252
|
if (type === "a9") return renderA9();
|
|
227
253
|
if (type === "a5") return renderA5();
|
|
228
254
|
return renderA2();
|
|
229
255
|
};
|
|
230
256
|
if (dataSource === null || dataSource === void 0 ? void 0 : dataSource.isGift) return null;
|
|
231
257
|
const content = renderContent();
|
|
258
|
+
const useIntegratedWrapper = type === "a12" || rightActionsDisplay === "inline";
|
|
232
259
|
const cardContent = /* @__PURE__ */ react.default.createElement("div", {
|
|
233
260
|
className: (0, classnames.default)(PREFIX, `${PREFIX}--${type}`),
|
|
234
261
|
onClick: (e) => {
|
|
@@ -242,7 +269,10 @@ const CartSkuCard = (props) => {
|
|
|
242
269
|
isShowRelatedProduct,
|
|
243
270
|
isShowDelete
|
|
244
271
|
}, content) : content);
|
|
245
|
-
return /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)(`${PREFIX}-wrapper-container`, {
|
|
272
|
+
return /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)(`${PREFIX}-wrapper-container`, {
|
|
273
|
+
[`${PREFIX}-wrapper-container--inline`]: useIntegratedWrapper,
|
|
274
|
+
[`${PREFIX}-wrapper-container--a12`]: type === "a12"
|
|
275
|
+
}) }, useIntegratedWrapper ? /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)(`${PREFIX}-wrapper`, `${PREFIX}-wrapper--inline`, type === "a12" && `pisell-cart-sku-card-wrapper--a12`) }, cardContent) : /* @__PURE__ */ react.default.createElement(require_index$8.SwipeAction, {
|
|
246
276
|
closeOnAction: false,
|
|
247
277
|
className: (0, classnames.default)(`${PREFIX}-wrapper`),
|
|
248
278
|
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,129 @@
|
|
|
1
|
+
const require_runtime = require("../../../../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_objectSpread2 = require("../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
|
|
3
|
+
const require_index = require("../../../../iconfont/index.js");
|
|
4
|
+
const require_index$1 = require("../../components/weighing/index.js");
|
|
5
|
+
const require_index$2 = require("../../index.js");
|
|
6
|
+
let react = require("react");
|
|
7
|
+
react = require_runtime.__toESM(react);
|
|
8
|
+
let _pisell_utils = require("@pisell/utils");
|
|
9
|
+
let classnames = require("classnames");
|
|
10
|
+
classnames = require_runtime.__toESM(classnames);
|
|
11
|
+
require("./index.less");
|
|
12
|
+
//#region src/components/productCard/cartSkuCard/variants/A12/index.tsx
|
|
13
|
+
const TOKEN_VARIABLES = {
|
|
14
|
+
background: "--pc-a12-bg",
|
|
15
|
+
borderColor: "--pc-a12-border-color",
|
|
16
|
+
borderRadius: "--pc-a12-radius",
|
|
17
|
+
minHeight: "--pc-a12-min-height",
|
|
18
|
+
mediaWidth: "--pc-a12-media-width",
|
|
19
|
+
actionRailWidth: "--pc-a12-rail-width",
|
|
20
|
+
contentPadding: "--pc-a12-content-padding",
|
|
21
|
+
actionRailPadding: "--pc-a12-rail-padding",
|
|
22
|
+
accentColor: "--pc-a12-accent",
|
|
23
|
+
titleColor: "--pc-a12-title-color",
|
|
24
|
+
titleFontSize: "--pc-a12-title-size",
|
|
25
|
+
titleFontWeight: "--pc-a12-title-weight",
|
|
26
|
+
priceColor: "--pc-a12-price-color",
|
|
27
|
+
priceFontSize: "--pc-a12-price-size",
|
|
28
|
+
optionBackground: "--pc-a12-option-bg",
|
|
29
|
+
optionLabelColor: "--pc-a12-option-label-color",
|
|
30
|
+
optionValueColor: "--pc-a12-option-value-color",
|
|
31
|
+
optionGap: "--pc-a12-option-gap",
|
|
32
|
+
shadow: "--pc-a12-shadow"
|
|
33
|
+
};
|
|
34
|
+
/** 复用其它变体使用的 options,只在展示阶段合并同组已选项。 */
|
|
35
|
+
function resolveSpecifications(dataSource) {
|
|
36
|
+
if (!Array.isArray(dataSource === null || dataSource === void 0 ? void 0 : dataSource.options)) return [];
|
|
37
|
+
const groups = /* @__PURE__ */ new Map();
|
|
38
|
+
dataSource.options.forEach((option, index) => {
|
|
39
|
+
var _ref, _option$name, _ref2, _option$quantity, _ref3, _ref4, _option$option_group_, _ref5, _ref6, _ref7, _option$option_group_2;
|
|
40
|
+
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;
|
|
41
|
+
if (name === void 0 || name === null || name === "") return;
|
|
42
|
+
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));
|
|
43
|
+
const value = quantity > 1 ? `${String(name)} × ${quantity}` : name;
|
|
44
|
+
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}`);
|
|
45
|
+
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;
|
|
46
|
+
const current = groups.get(groupKey);
|
|
47
|
+
if (current) {
|
|
48
|
+
current.values.push(value);
|
|
49
|
+
if (!current.label && label) current.label = label;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
groups.set(groupKey, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({ key: groupKey }, label ? { label } : {}), {}, { values: [value] }));
|
|
53
|
+
});
|
|
54
|
+
return Array.from(groups.values()).map((group) => ({
|
|
55
|
+
key: group.key,
|
|
56
|
+
label: group.label,
|
|
57
|
+
value: group.values.map(String).join(", ")
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
function getPresentationStyle(presentation) {
|
|
61
|
+
const style = require_objectSpread2._objectSpread2({}, (presentation === null || presentation === void 0 ? void 0 : presentation.style) || {});
|
|
62
|
+
Object.entries((presentation === null || presentation === void 0 ? void 0 : presentation.tokens) || {}).forEach(([key, value]) => {
|
|
63
|
+
if (value !== void 0) style[TOKEN_VARIABLES[key]] = value;
|
|
64
|
+
});
|
|
65
|
+
style["--pc-a12-option-columns"] = (presentation === null || presentation === void 0 ? void 0 : presentation.optionColumns) || 2;
|
|
66
|
+
return style;
|
|
67
|
+
}
|
|
68
|
+
const A12 = ({ dataSource, isShowImage = true, isShowDelete = false, isShowOriginalPrice = false, isShowEditProduct = false, disabled = false, disabledEditClick = false, slots, presentation, onDelete, onEditProduct }) => {
|
|
69
|
+
var _ref8, _dataSource$num, _dataSource$total, _dataSource$origin_to, _slots$contentFooter;
|
|
70
|
+
const display = (dataSource === null || dataSource === void 0 ? void 0 : dataSource.a12) || {};
|
|
71
|
+
const specificationsData = (0, react.useMemo)(() => resolveSpecifications(dataSource), [dataSource]);
|
|
72
|
+
const weighingInfo = (0, react.useMemo)(() => (0, _pisell_utils.resolveWeighingSnapshot)(dataSource), [dataSource]);
|
|
73
|
+
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;
|
|
74
|
+
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);
|
|
75
|
+
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;
|
|
76
|
+
const symbol = dataSource === null || dataSource === void 0 ? void 0 : dataSource.symbol;
|
|
77
|
+
const slotContext = (0, react.useMemo)(() => ({
|
|
78
|
+
item: dataSource,
|
|
79
|
+
disabled
|
|
80
|
+
}), [dataSource, disabled]);
|
|
81
|
+
const style = (0, react.useMemo)(() => getPresentationStyle(presentation), [presentation]);
|
|
82
|
+
const defaultSpecifications = specificationsData.length ? /* @__PURE__ */ react.default.createElement("div", { className: `${require_index$2.PREFIX}-a12__specifications` }, specificationsData.map((specification) => /* @__PURE__ */ react.default.createElement("div", {
|
|
83
|
+
className: `${require_index$2.PREFIX}-a12__specification`,
|
|
84
|
+
key: specification.key
|
|
85
|
+
}, specification.label ? /* @__PURE__ */ react.default.createElement("span", { className: `${require_index$2.PREFIX}-a12__specification-label` }, specification.label) : null, /* @__PURE__ */ react.default.createElement("strong", { className: `${require_index$2.PREFIX}-a12__specification-value` }, specification.value)))) : (dataSource === null || dataSource === void 0 ? void 0 : dataSource.product_option_string) ? /* @__PURE__ */ react.default.createElement("div", { className: `${require_index$2.PREFIX}-a12__specification-summary` }, dataSource.product_option_string) : null;
|
|
86
|
+
const specifications = (slots === null || slots === void 0 ? void 0 : slots.specifications) ? slots.specifications(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, slotContext), {}, { defaultSpecifications })) : defaultSpecifications;
|
|
87
|
+
const contentFooter = slots === null || slots === void 0 || (_slots$contentFooter = slots.contentFooter) === null || _slots$contentFooter === void 0 ? void 0 : _slots$contentFooter.call(slots, slotContext);
|
|
88
|
+
const defaultPrice = /* @__PURE__ */ react.default.createElement("div", { className: `${require_index$2.PREFIX}-a12__price` }, /* @__PURE__ */ react.default.createElement("strong", null, (0, _pisell_utils.formatAmount)(lineTotal, 2, symbol)), isShowOriginalPrice && originalTotal > 0 && originalTotal !== lineTotal ? /* @__PURE__ */ react.default.createElement("del", null, (0, _pisell_utils.formatAmount)(originalTotal, 2, symbol)) : null);
|
|
89
|
+
const defaultEdit = Boolean(isShowEditProduct && onEditProduct) ? /* @__PURE__ */ react.default.createElement("button", {
|
|
90
|
+
type: "button",
|
|
91
|
+
className: `${require_index$2.PREFIX}-a12__edit`,
|
|
92
|
+
disabled: disabled || disabledEditClick,
|
|
93
|
+
onClick: (event) => {
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
event.stopPropagation();
|
|
96
|
+
onEditProduct === null || onEditProduct === void 0 || onEditProduct(dataSource);
|
|
97
|
+
}
|
|
98
|
+
}, _pisell_utils.locales.getText("pisell2.product.card.edit")) : null;
|
|
99
|
+
const defaultQuantityControl = (slots === null || slots === void 0 ? void 0 : slots.quantityControl) ? slots.quantityControl(slotContext) : /* @__PURE__ */ react.default.createElement("div", { className: `${require_index$2.PREFIX}-a12__quantity-fallback` }, /* @__PURE__ */ react.default.createElement("span", null, display.quantityText || `× ${quantity}`));
|
|
100
|
+
const defaultActionRail = /* @__PURE__ */ react.default.createElement("aside", { className: `${require_index$2.PREFIX}-a12__rail` }, isShowDelete && onDelete ? /* @__PURE__ */ react.default.createElement("button", {
|
|
101
|
+
type: "button",
|
|
102
|
+
className: `${require_index$2.PREFIX}-a12__delete`,
|
|
103
|
+
"aria-label": _pisell_utils.locales.getText("pisell2.cart.sku-card.actions.delete"),
|
|
104
|
+
disabled,
|
|
105
|
+
onClick: (event) => {
|
|
106
|
+
event.preventDefault();
|
|
107
|
+
event.stopPropagation();
|
|
108
|
+
onDelete(dataSource);
|
|
109
|
+
}
|
|
110
|
+
}, /* @__PURE__ */ react.default.createElement(require_index.default, { type: "pisell2-trash-01" })) : null, defaultPrice, defaultEdit, /* @__PURE__ */ react.default.createElement("div", { className: `${require_index$2.PREFIX}-a12__quantity-control` }, defaultQuantityControl));
|
|
111
|
+
const actionRail = (slots === null || slots === void 0 ? void 0 : slots.actionRail) ? slots.actionRail(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, slotContext), {}, {
|
|
112
|
+
defaultPrice,
|
|
113
|
+
defaultEdit,
|
|
114
|
+
defaultQuantityControl
|
|
115
|
+
})) : defaultActionRail;
|
|
116
|
+
return /* @__PURE__ */ react.default.createElement("div", {
|
|
117
|
+
className: (0, classnames.default)(`${require_index$2.PREFIX}-a12`, `${require_index$2.PREFIX}-a12--${(presentation === null || presentation === void 0 ? void 0 : presentation.density) || "comfortable"}`, `${require_index$2.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),
|
|
118
|
+
style
|
|
119
|
+
}, isShowImage ? /* @__PURE__ */ react.default.createElement("div", { className: `${require_index$2.PREFIX}-a12__media` }, (dataSource === null || dataSource === void 0 ? void 0 : dataSource.image) ? /* @__PURE__ */ react.default.createElement("img", {
|
|
120
|
+
alt: "",
|
|
121
|
+
src: _pisell_utils.image.ali(dataSource.image, 320),
|
|
122
|
+
style: { objectFit: (presentation === null || presentation === void 0 ? void 0 : presentation.mediaFit) || "cover" }
|
|
123
|
+
}) : /* @__PURE__ */ react.default.createElement("span", { "aria-hidden": "true" }, String((dataSource === null || dataSource === void 0 ? void 0 : dataSource.name) || "").slice(0, 2))) : null, /* @__PURE__ */ react.default.createElement("div", { className: `${require_index$2.PREFIX}-a12__content` }, display.eyebrow ? /* @__PURE__ */ react.default.createElement("div", { className: `${require_index$2.PREFIX}-a12__eyebrow` }, display.eyebrow) : null, /* @__PURE__ */ react.default.createElement("div", { className: `${require_index$2.PREFIX}-a12__name` }, dataSource === null || dataSource === void 0 ? void 0 : dataSource.name), weighingInfo ? /* @__PURE__ */ react.default.createElement("div", { className: `${require_index$2.PREFIX}-a12__weighing` }, /* @__PURE__ */ react.default.createElement(require_index$1.default, {
|
|
124
|
+
dataSource: weighingInfo,
|
|
125
|
+
symbol
|
|
126
|
+
})) : null, specifications, contentFooter ? /* @__PURE__ */ react.default.createElement("div", { className: `${require_index$2.PREFIX}-a12__content-footer` }, contentFooter) : null), actionRail);
|
|
127
|
+
};
|
|
128
|
+
//#endregion
|
|
129
|
+
exports.default = A12;
|