@pisell/materials 1.10.12 → 1.10.14
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/index.js +1 -1
- package/build/lowcode/meta.js +3 -3
- package/build/lowcode/preview.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +48 -48
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +48 -48
- package/es/components/PisellProcedure/components/ProcedureHeader.js +3 -3
- package/es/components/productCard/cartSkuCard/components/AmountFooter/index.js +2 -1
- package/es/components/productCard/cartSkuCard/components/AmountFooter/index.less +1 -1
- package/es/components/productCard/cartSkuCard/components/Gift/index.js +0 -1
- package/es/components/productCard/cartSkuCard/components/basicInfo/index.js +5 -4
- package/es/components/productCard/cartSkuCard/components/packages/index.js +5 -3
- package/es/components/productCard/cartSkuCard/components/specs/index.js +5 -3
- package/es/components/productCard/cartSkuCard/components/specs/index.less +9 -4
- package/es/components/productCard/cartSkuCard/components/swipeAction/index.js +76 -25
- package/es/components/productCard/cartSkuCard/index.js +0 -1
- package/es/components/productCard/cartSkuCard/index.less +3 -0
- package/es/components/productCard/components/Packages/components/options/index.js +3 -2
- package/es/components/productCard/components/Time/components/SelectHolderMultiple/index.js +0 -2
- package/es/components/productCard/lineItem/BookingLineItem.js +17 -8
- package/es/components/productCard/lineItem/index.js +21 -14
- package/es/components/productCard/lineItem/index.less +14 -1
- package/es/hooks/useInitLocalesOnce.js +23 -0
- package/lib/components/PisellProcedure/components/ProcedureHeader.js +3 -3
- package/lib/components/productCard/cartSkuCard/components/AmountFooter/index.js +2 -1
- package/lib/components/productCard/cartSkuCard/components/AmountFooter/index.less +1 -1
- package/lib/components/productCard/cartSkuCard/components/Gift/index.js +0 -1
- package/lib/components/productCard/cartSkuCard/components/basicInfo/index.js +5 -4
- package/lib/components/productCard/cartSkuCard/components/packages/index.js +5 -3
- package/lib/components/productCard/cartSkuCard/components/specs/index.js +5 -3
- package/lib/components/productCard/cartSkuCard/components/specs/index.less +9 -4
- package/lib/components/productCard/cartSkuCard/components/swipeAction/index.js +76 -25
- package/lib/components/productCard/cartSkuCard/index.js +0 -1
- package/lib/components/productCard/cartSkuCard/index.less +3 -0
- package/lib/components/productCard/components/Packages/components/options/index.js +3 -2
- package/lib/components/productCard/components/Time/components/SelectHolderMultiple/index.js +0 -2
- package/lib/components/productCard/lineItem/BookingLineItem.js +17 -8
- package/lib/components/productCard/lineItem/index.js +21 -14
- package/lib/components/productCard/lineItem/index.less +14 -1
- package/lib/hooks/useInitLocalesOnce.js +24 -0
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ import React, { useCallback, useMemo, useState } from "react";
|
|
|
13
13
|
* @author Pisell Team
|
|
14
14
|
*/
|
|
15
15
|
const ProcedureHeader = ({ headerProps, currentStep, className, goPrev, goToStep, onClose, onFirstStepBack, onBackConfirm, onCloseConfirm }) => {
|
|
16
|
-
var _modalConfig$config2, _modalConfig$config3;
|
|
16
|
+
var _mergedStepsProps$mob, _mergedStepsProps$mob2, _modalConfig$config2, _modalConfig$config3;
|
|
17
17
|
/** 确认弹窗类型(back: 返回确认,close: 关闭确认,null: 不显示) */
|
|
18
18
|
const [modalType, setModalType] = useState(null);
|
|
19
19
|
/** 目标步骤索引(用于步骤跳转,-1 表示返回上一步) */
|
|
@@ -192,8 +192,8 @@ const ProcedureHeader = ({ headerProps, currentStep, className, goPrev, goToStep
|
|
|
192
192
|
else handleBackClick();
|
|
193
193
|
}
|
|
194
194
|
}, actualLeftSlot), (headerProps === null || headerProps === void 0 ? void 0 : headerProps.showSteps) !== false && /* @__PURE__ */ React.createElement("div", { className: "pisell-procedure-header__center" }, /* @__PURE__ */ React.createElement(PisellSteps_default, _objectSpread2(_objectSpread2({}, mergedStepsProps), {}, {
|
|
195
|
-
mobileMode: "auto",
|
|
196
|
-
mobileBreakpoint: 744
|
|
195
|
+
mobileMode: (_mergedStepsProps$mob = mergedStepsProps.mobileMode) !== null && _mergedStepsProps$mob !== void 0 ? _mergedStepsProps$mob : "auto",
|
|
196
|
+
mobileBreakpoint: (_mergedStepsProps$mob2 = mergedStepsProps.mobileBreakpoint) !== null && _mergedStepsProps$mob2 !== void 0 ? _mergedStepsProps$mob2 : 744
|
|
197
197
|
}))), showActualRightArea && /* @__PURE__ */ React.createElement("div", {
|
|
198
198
|
className: "pisell-procedure-header__right",
|
|
199
199
|
onClick: () => {
|
|
@@ -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,
|
|
@@ -18,7 +18,6 @@ const Gift = (props) => {
|
|
|
18
18
|
return /* @__PURE__ */ React.createElement("div", { className: `product-cover-text` }, displayText);
|
|
19
19
|
}, [displayGifts]);
|
|
20
20
|
if (!isShow) return null;
|
|
21
|
-
console.log("Gift777", props, selectedCount);
|
|
22
21
|
return /* @__PURE__ */ React.createElement("div", {
|
|
23
22
|
className: `${prefixCls}`,
|
|
24
23
|
onClick
|
|
@@ -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
|
|
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` },
|
|
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` },
|
|
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,
|
|
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
|
};
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
|
|
48
48
|
.pisell-cart-sku-card__product-meta--weighing & {
|
|
49
49
|
.pisell-lowcode-packages-product-bundle-option {
|
|
50
|
-
font-size: var(--pisell-cart-sku-card-
|
|
50
|
+
font-size: var(--pisell-cart-sku-card-weighing-meta-font-size, 18px);
|
|
51
51
|
line-height: 1.3;
|
|
52
|
-
letter-spacing: -0.
|
|
52
|
+
letter-spacing: -0.01em;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -62,8 +62,13 @@
|
|
|
62
62
|
|
|
63
63
|
.pisell-cart-sku-card__product-meta--weighing {
|
|
64
64
|
.pisell-cart-sku-card__specs {
|
|
65
|
-
font-size: var(--pisell-cart-sku-card-
|
|
65
|
+
font-size: var(--pisell-cart-sku-card-weighing-meta-font-size, 18px);
|
|
66
66
|
line-height: 1.3;
|
|
67
|
-
letter-spacing: -0.
|
|
67
|
+
letter-spacing: -0.01em;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.pisell-cart-sku-card__specs-more {
|
|
71
|
+
font-size: 14px;
|
|
72
|
+
line-height: 18px;
|
|
68
73
|
}
|
|
69
74
|
}
|
|
@@ -50,6 +50,10 @@ const SwipeAction = forwardRef((p, ref) => {
|
|
|
50
50
|
const rootRef = useRef(null);
|
|
51
51
|
const leftRef = useRef(null);
|
|
52
52
|
const rightRef = useRef(null);
|
|
53
|
+
const resizeObserverRef = useRef(null);
|
|
54
|
+
const touchOutsideCleanupRef = useRef(null);
|
|
55
|
+
const latestPropsRef = useRef(props);
|
|
56
|
+
latestPropsRef.current = props;
|
|
53
57
|
const [containerHeight, setContainerHeight] = useState(0);
|
|
54
58
|
function getWidth(ref) {
|
|
55
59
|
const element = ref.current;
|
|
@@ -70,6 +74,29 @@ const SwipeAction = forwardRef((p, ref) => {
|
|
|
70
74
|
function getRootHeight() {
|
|
71
75
|
return getHeight(rootRef);
|
|
72
76
|
}
|
|
77
|
+
function syncActionHeightClasses(height) {
|
|
78
|
+
const rightContainer = rightRef.current;
|
|
79
|
+
if (!rightContainer) return;
|
|
80
|
+
const heightSize = height > 180 ? "large" : height > 120 ? "medium" : "small";
|
|
81
|
+
rightContainer.classList.remove(`${classPrefix}-height-large`, `${classPrefix}-height-medium`, `${classPrefix}-height-small`);
|
|
82
|
+
rightContainer.classList.add(`${classPrefix}-height-${heightSize}`);
|
|
83
|
+
Array.from(rightContainer.children).forEach((element) => {
|
|
84
|
+
element.classList.remove(`${classPrefix}-action-height-large`, `${classPrefix}-action-height-medium`, `${classPrefix}-action-height-small`);
|
|
85
|
+
element.classList.add(`${classPrefix}-action-height-${heightSize}`);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function updateHeight() {
|
|
89
|
+
const height = getRootHeight();
|
|
90
|
+
syncActionHeightClasses(height);
|
|
91
|
+
setContainerHeight((currentHeight) => currentHeight === height ? currentHeight : height);
|
|
92
|
+
}
|
|
93
|
+
function startHeightTracking() {
|
|
94
|
+
if (resizeObserverRef.current) return;
|
|
95
|
+
updateHeight();
|
|
96
|
+
const resizeObserver = new ResizeObserver(updateHeight);
|
|
97
|
+
resizeObserverRef.current = resizeObserver;
|
|
98
|
+
if (rootRef.current) resizeObserver.observe(rootRef.current);
|
|
99
|
+
}
|
|
73
100
|
const [{ x }, api] = useSpring(() => ({
|
|
74
101
|
x: 0,
|
|
75
102
|
config: {
|
|
@@ -84,9 +111,43 @@ const SwipeAction = forwardRef((p, ref) => {
|
|
|
84
111
|
(_dragCancelRef$curren = dragCancelRef.current) === null || _dragCancelRef$curren === void 0 || _dragCancelRef$curren.call(dragCancelRef);
|
|
85
112
|
draggingRef.current = false;
|
|
86
113
|
}
|
|
114
|
+
function stopTouchOutsideListener() {
|
|
115
|
+
const cleanup = touchOutsideCleanupRef.current;
|
|
116
|
+
if (!cleanup) return;
|
|
117
|
+
cleanup();
|
|
118
|
+
touchOutsideCleanupRef.current = null;
|
|
119
|
+
}
|
|
120
|
+
function startTouchOutsideListener() {
|
|
121
|
+
if (!latestPropsRef.current.closeOnTouchOutside || touchOutsideCleanupRef.current) return;
|
|
122
|
+
const eventType = "ontouchstart" in window ? "touchstart" : "mousedown";
|
|
123
|
+
const handle = (e) => {
|
|
124
|
+
const latestProps = latestPropsRef.current;
|
|
125
|
+
if (e.target && latestProps.escapeDom) {
|
|
126
|
+
const container = document.querySelector(latestProps.escapeDom);
|
|
127
|
+
if (container === null || container === void 0 ? void 0 : container.contains(e.target)) return;
|
|
128
|
+
}
|
|
129
|
+
if (x.get() === 0) {
|
|
130
|
+
stopTouchOutsideListener();
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const root = rootRef.current;
|
|
134
|
+
if (root && !root.contains(e.target)) {
|
|
135
|
+
var _latestProps$onClose;
|
|
136
|
+
api.start({ x: 0 });
|
|
137
|
+
forceCancelDrag();
|
|
138
|
+
stopTouchOutsideListener();
|
|
139
|
+
(_latestProps$onClose = latestProps.onClose) === null || _latestProps$onClose === void 0 || _latestProps$onClose.call(latestProps);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
document.addEventListener(eventType, handle);
|
|
143
|
+
touchOutsideCleanupRef.current = () => {
|
|
144
|
+
document.removeEventListener(eventType, handle);
|
|
145
|
+
};
|
|
146
|
+
}
|
|
87
147
|
const bind = useDrag((state) => {
|
|
88
148
|
dragCancelRef.current = state.cancel;
|
|
89
149
|
if (!state.intentional) return;
|
|
150
|
+
startHeightTracking();
|
|
90
151
|
if (state.down) draggingRef.current = true;
|
|
91
152
|
if (!draggingRef.current) return;
|
|
92
153
|
const [offsetX] = state.offset;
|
|
@@ -105,8 +166,9 @@ const SwipeAction = forwardRef((p, ref) => {
|
|
|
105
166
|
api.start({ x: targetX });
|
|
106
167
|
if (targetX !== 0) {
|
|
107
168
|
var _p$onActionsReveal;
|
|
169
|
+
startTouchOutsideListener();
|
|
108
170
|
(_p$onActionsReveal = p.onActionsReveal) === null || _p$onActionsReveal === void 0 || _p$onActionsReveal.call(p, targetX > 0 ? "left" : "right");
|
|
109
|
-
}
|
|
171
|
+
} else stopTouchOutsideListener();
|
|
110
172
|
window.setTimeout(() => {
|
|
111
173
|
draggingRef.current = false;
|
|
112
174
|
});
|
|
@@ -132,46 +194,32 @@ const SwipeAction = forwardRef((p, ref) => {
|
|
|
132
194
|
var _props$onClose;
|
|
133
195
|
api.start({ x: 0 });
|
|
134
196
|
forceCancelDrag();
|
|
197
|
+
stopTouchOutsideListener();
|
|
135
198
|
(_props$onClose = props.onClose) === null || _props$onClose === void 0 || _props$onClose.call(props);
|
|
136
199
|
};
|
|
137
200
|
useImperativeHandle(ref, () => ({
|
|
138
201
|
show: (side = "right") => {
|
|
139
202
|
var _p$onActionsReveal2;
|
|
203
|
+
startHeightTracking();
|
|
140
204
|
if (side === "right") api.start({ x: -getRightWidth() });
|
|
141
205
|
else if (side === "left") api.start({ x: getLeftWidth() });
|
|
206
|
+
startTouchOutsideListener();
|
|
142
207
|
(_p$onActionsReveal2 = p.onActionsReveal) === null || _p$onActionsReveal2 === void 0 || _p$onActionsReveal2.call(p, side);
|
|
143
208
|
},
|
|
144
209
|
close
|
|
145
210
|
}));
|
|
146
211
|
useEffect(() => {
|
|
147
|
-
const updateHeight = () => {
|
|
148
|
-
setContainerHeight(getRootHeight());
|
|
149
|
-
};
|
|
150
|
-
updateHeight();
|
|
151
|
-
const resizeObserver = new ResizeObserver(updateHeight);
|
|
152
|
-
if (rootRef.current) resizeObserver.observe(rootRef.current);
|
|
153
212
|
return () => {
|
|
154
|
-
|
|
213
|
+
var _resizeObserverRef$cu;
|
|
214
|
+
(_resizeObserverRef$cu = resizeObserverRef.current) === null || _resizeObserverRef$cu === void 0 || _resizeObserverRef$cu.disconnect();
|
|
215
|
+
resizeObserverRef.current = null;
|
|
216
|
+
stopTouchOutsideListener();
|
|
155
217
|
};
|
|
156
218
|
}, []);
|
|
157
219
|
useEffect(() => {
|
|
158
|
-
if (!props.closeOnTouchOutside)
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
const container = document.querySelector(props.escapeDom);
|
|
162
|
-
if (container === null || container === void 0 ? void 0 : container.contains(e.target)) return;
|
|
163
|
-
}
|
|
164
|
-
if (x.get() === 0) return;
|
|
165
|
-
const root = rootRef.current;
|
|
166
|
-
if (root && !root.contains(e.target)) close();
|
|
167
|
-
}
|
|
168
|
-
if ("ontouchstart" in window) document.addEventListener("touchstart", handle);
|
|
169
|
-
else document.addEventListener("mousedown", handle);
|
|
170
|
-
return () => {
|
|
171
|
-
document.removeEventListener("touchstart", handle);
|
|
172
|
-
document.removeEventListener("mousedown", handle);
|
|
173
|
-
};
|
|
174
|
-
}, [props.closeOnTouchOutside, props.escapeDom]);
|
|
220
|
+
if (!props.closeOnTouchOutside) stopTouchOutsideListener();
|
|
221
|
+
else if (x.get() !== 0) startTouchOutsideListener();
|
|
222
|
+
}, [props.closeOnTouchOutside]);
|
|
175
223
|
const getRightContainerClass = () => {
|
|
176
224
|
const baseClass = `${classPrefix}-actions ${classPrefix}-actions-right`;
|
|
177
225
|
if (containerHeight > 180) return `${baseClass} ${classPrefix}-height-large`;
|
|
@@ -202,6 +250,9 @@ const SwipeAction = forwardRef((p, ref) => {
|
|
|
202
250
|
}
|
|
203
251
|
return withNativeProps(props, /* @__PURE__ */ React.createElement("div", _objectSpread2(_objectSpread2({ className: classPrefix }, bind()), {}, {
|
|
204
252
|
ref: rootRef,
|
|
253
|
+
onPointerDownCapture: startHeightTracking,
|
|
254
|
+
onTouchStartCapture: startHeightTracking,
|
|
255
|
+
onMouseDownCapture: startHeightTracking,
|
|
205
256
|
onClickCapture: (e) => {
|
|
206
257
|
if (draggingRef.current) {
|
|
207
258
|
e.stopPropagation();
|
|
@@ -63,7 +63,6 @@ const CartSkuCard = (props) => {
|
|
|
63
63
|
const useOpenNoteRef = useRef();
|
|
64
64
|
const context = useEngineContext();
|
|
65
65
|
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");
|
|
66
|
-
console.log("prodcut props", props);
|
|
67
66
|
const { isShowAction, actionText } = dataSource;
|
|
68
67
|
const _rightActions = useMemo(() => {
|
|
69
68
|
const deleteAction = {
|
|
@@ -36,6 +36,9 @@
|
|
|
36
36
|
var(--pisell-cart-sku-card-weighing-font-base) *
|
|
37
37
|
var(--pisell-cart-sku-card-device-font-scale)
|
|
38
38
|
);
|
|
39
|
+
// 称重卡片的辅助信息保持易读,但不与毛重/净重争夺视觉层级。
|
|
40
|
+
--pisell-cart-sku-card-weighing-meta-font-size: 18px;
|
|
41
|
+
--pisell-cart-sku-card-weighing-summary-font-size: 18px;
|
|
39
42
|
|
|
40
43
|
padding: 4px 8px 4px 4px;
|
|
41
44
|
border-radius: inherit;
|
|
@@ -3,12 +3,13 @@ import React from "react";
|
|
|
3
3
|
import "./index.less";
|
|
4
4
|
//#region src/components/productCard/components/Packages/components/options/index.tsx
|
|
5
5
|
const prefix = "pisell-lowcode-";
|
|
6
|
-
const Options = ({ options, amountSymbol }) => {
|
|
6
|
+
const Options = ({ options, amountSymbol, amountFormatter }) => {
|
|
7
|
+
const formatOptionAmount = (value) => amountFormatter ? amountFormatter(value, 2) : _formatAmount(value, amountSymbol);
|
|
7
8
|
return (options === null || options === void 0 ? void 0 : options.length) > 0 ? /* @__PURE__ */ React.createElement("div", { className: `${prefix}packages-product-bundle-option` }, options.map((option, index) => {
|
|
8
9
|
return /* @__PURE__ */ React.createElement("div", {
|
|
9
10
|
key: option.id,
|
|
10
11
|
className: `${prefix}packages-product-bundle-option-item`
|
|
11
|
-
}, /* @__PURE__ */ React.createElement("div", { className: `${prefix}packages-product-bundle-option-item-left` }, /* @__PURE__ */ React.createElement("span", null, option === null || option === void 0 ? void 0 : option.name), /* @__PURE__ */ React.createElement("div", { className: `${prefix}packages-product-bundle-option-item-left-amount` }, /* @__PURE__ */ React.createElement("span", null,
|
|
12
|
+
}, /* @__PURE__ */ React.createElement("div", { className: `${prefix}packages-product-bundle-option-item-left` }, /* @__PURE__ */ React.createElement("span", null, option === null || option === void 0 ? void 0 : option.name), /* @__PURE__ */ React.createElement("div", { className: `${prefix}packages-product-bundle-option-item-left-amount` }, /* @__PURE__ */ React.createElement("span", null, formatOptionAmount(option === null || option === void 0 ? void 0 : option.price)), /* @__PURE__ */ React.createElement("span", null, "×"), /* @__PURE__ */ React.createElement("span", null, option === null || option === void 0 ? void 0 : option.num))), /* @__PURE__ */ React.createElement("span", { className: `${prefix}packages-product-bundle-option-item-amount` }, formatOptionAmount((option === null || option === void 0 ? void 0 : option.price) * (option === null || option === void 0 ? void 0 : option.num))));
|
|
12
13
|
})) : null;
|
|
13
14
|
};
|
|
14
15
|
//#endregion
|
|
@@ -31,9 +31,7 @@ const SelectHolderMultiple = ({ lists, value, onChange, holderMode, isShowAddHol
|
|
|
31
31
|
return acc;
|
|
32
32
|
}, {});
|
|
33
33
|
}, [lists]);
|
|
34
|
-
console.log(optionsMap, value, "optionsMap");
|
|
35
34
|
const handleClose = (item) => {
|
|
36
|
-
console.log("item", item, value);
|
|
37
35
|
handleChange(value.filter((d) => d !== item));
|
|
38
36
|
};
|
|
39
37
|
const renderHolder = () => {
|
|
@@ -63,8 +63,9 @@ const getStatusOption = (status, statusOptions = []) => {
|
|
|
63
63
|
};
|
|
64
64
|
};
|
|
65
65
|
const BookingLineItem = (props) => {
|
|
66
|
-
var _ref, _ref2, _dataSource$promotion;
|
|
66
|
+
var _ref, _ref2, _dataSource$promotion, _dataSource$giftData;
|
|
67
67
|
const { dataSource, type, cartSkuType, isShowBookingHeader, relatedProductDataSource, addTimeProductDataSources = [], rightActions = [], rightActionsDisplay = "swipe", escapeDom, isShowImage, isShowQuantityBadge = true, isFormSubject, isShowDelete, isShowInlineDelete = isShowDelete, isShowNote, isShowAmountFooter, disabledClick, disabledEdit, statusOptions = [], statusLoading = false, statusDisabled = false, isShowRelatedProduct = true, holderOptions, onBookingStatusChange, onAddTimeProductCard, onAction, onDelete, onNote, onCard, onPromotion, onGift } = props, other = _objectWithoutProperties(props, _excluded);
|
|
68
|
+
const shouldRenderRelatedProduct = isShowRelatedProduct && Boolean(relatedProductDataSource);
|
|
68
69
|
const [isAddTimeProductsExpanded, setIsAddTimeProductsExpanded] = useState(false);
|
|
69
70
|
const { isShowAction, actionText } = dataSource;
|
|
70
71
|
const currentStatus = useMemo(() => getStatusOption(dataSource === null || dataSource === void 0 ? void 0 : dataSource.appointment_status, statusOptions), [dataSource === null || dataSource === void 0 ? void 0 : dataSource.appointment_status, statusOptions]);
|
|
@@ -115,7 +116,7 @@ const BookingLineItem = (props) => {
|
|
|
115
116
|
const renderProductCard = (productDataSource, source, options = {}) => {
|
|
116
117
|
var _productDataSource$pr;
|
|
117
118
|
if (!productDataSource || (productDataSource === null || productDataSource === void 0 ? void 0 : productDataSource.isGift)) return null;
|
|
118
|
-
const { showProductPromotion = true } = options;
|
|
119
|
+
const { showProductPromotion = true, showAmountFooter = true } = options;
|
|
119
120
|
const productPromotion = (productDataSource === null || productDataSource === void 0 || (_productDataSource$pr = productDataSource.promotions) === null || _productDataSource$pr === void 0 ? void 0 : _productDataSource$pr.length) ? /* @__PURE__ */ React.createElement(Promotion, {
|
|
120
121
|
promotions: productDataSource.promotions,
|
|
121
122
|
onClick: (item) => onPromotion === null || onPromotion === void 0 ? void 0 : onPromotion(item)
|
|
@@ -131,7 +132,7 @@ const BookingLineItem = (props) => {
|
|
|
131
132
|
isShowImage,
|
|
132
133
|
isShowQuantityBadge,
|
|
133
134
|
type: cartSkuType
|
|
134
|
-
}), isShowAmountFooter ? /* @__PURE__ */ React.createElement(Footer, {
|
|
135
|
+
}), isShowAmountFooter && showAmountFooter ? /* @__PURE__ */ React.createElement(Footer, {
|
|
135
136
|
item: productDataSource,
|
|
136
137
|
hideDivider: false,
|
|
137
138
|
type: "total"
|
|
@@ -171,7 +172,8 @@ const BookingLineItem = (props) => {
|
|
|
171
172
|
}, locales.getText(isAddTimeProductsExpanded ? "pisell2.line-item.collapse" : "pisell2.line-item.show-all")) : null));
|
|
172
173
|
};
|
|
173
174
|
if (dataSource === null || dataSource === void 0 ? void 0 : dataSource.isGift) return null;
|
|
174
|
-
const
|
|
175
|
+
const shouldRenderFullWidthAmountFooter = rightActionsDisplay === "inline" && isShowAmountFooter && shouldRenderRelatedProduct;
|
|
176
|
+
const cardContent = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
175
177
|
className: classNames(PREFIX, `${PREFIX}--booking`, `${PREFIX}--${type}`),
|
|
176
178
|
onClick: (e) => {
|
|
177
179
|
if (disabledClick) return;
|
|
@@ -192,16 +194,23 @@ const BookingLineItem = (props) => {
|
|
|
192
194
|
dataSource,
|
|
193
195
|
holderOptions: resolvedHolderOptions,
|
|
194
196
|
isFormSubject: resolvedIsFormSubject
|
|
195
|
-
}) : null), !isShowBookingHeader ? renderDeleteButton(true) : null),
|
|
197
|
+
}) : null), !isShowBookingHeader ? renderDeleteButton(true) : null), shouldRenderRelatedProduct ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Divider, { style: { margin: 0 } }), /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__related-product` }, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__related-product-card` }, renderProductCard(relatedProductDataSource, dataSource, {
|
|
198
|
+
showProductPromotion: false,
|
|
199
|
+
showAmountFooter: !shouldRenderFullWidthAmountFooter
|
|
200
|
+
}), renderPromotion, isShowAction && actionText ? /* @__PURE__ */ React.createElement(Action, {
|
|
196
201
|
item: dataSource,
|
|
197
202
|
onAction: () => onAction === null || onAction === void 0 ? void 0 : onAction(dataSource)
|
|
198
|
-
}) : null))) : null, renderAddTimeProducts());
|
|
199
|
-
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`) }, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}-inline-content` }, cardContent), /* @__PURE__ */ React.createElement(InlineActions, { actions: bookingRightActions })) : /* @__PURE__ */ React.createElement(
|
|
203
|
+
}) : null))) : null, renderAddTimeProducts()));
|
|
204
|
+
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`) }, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}-inline-main` }, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}-inline-content` }, cardContent), /* @__PURE__ */ React.createElement(InlineActions, { actions: bookingRightActions })), shouldRenderFullWidthAmountFooter ? /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__inline-amount-footer` }, /* @__PURE__ */ React.createElement(Footer, {
|
|
205
|
+
item: relatedProductDataSource,
|
|
206
|
+
hideDivider: false,
|
|
207
|
+
type: "total"
|
|
208
|
+
})) : null) : /* @__PURE__ */ React.createElement(SwipeAction, {
|
|
200
209
|
closeOnAction: false,
|
|
201
210
|
className: classNames(`${PREFIX}-wrapper`),
|
|
202
211
|
rightActions: bookingRightActions,
|
|
203
212
|
escapeDom
|
|
204
|
-
}, cardContent),
|
|
213
|
+
}, cardContent), (dataSource === null || dataSource === void 0 || (_dataSource$giftData = dataSource.giftData) === null || _dataSource$giftData === void 0 ? void 0 : _dataSource$giftData.isShow) ? /* @__PURE__ */ React.createElement(Gift, _objectSpread2(_objectSpread2({}, dataSource.giftData), {}, { onClick: () => onGift === null || onGift === void 0 ? void 0 : onGift(dataSource) })) : null);
|
|
205
214
|
};
|
|
206
215
|
//#endregion
|
|
207
216
|
export { BookingLineItem as default };
|
|
@@ -7,8 +7,8 @@ import locales_default from "../cartSkuCard/locales.js";
|
|
|
7
7
|
import CartSkuCard from "../cartSkuCard/index.js";
|
|
8
8
|
import locales_default$1 from "./locales.js";
|
|
9
9
|
import BookingLineItem from "./BookingLineItem.js";
|
|
10
|
+
import useInitLocalesOnce from "../../../hooks/useInitLocalesOnce.js";
|
|
10
11
|
import React, { useMemo } from "react";
|
|
11
|
-
import { locales } from "@pisell/utils";
|
|
12
12
|
import "./index.less";
|
|
13
13
|
//#region src/components/productCard/lineItem/index.tsx
|
|
14
14
|
const _excluded = [
|
|
@@ -38,7 +38,9 @@ const _excluded = [
|
|
|
38
38
|
"onNote",
|
|
39
39
|
"onCard",
|
|
40
40
|
"onPromotion",
|
|
41
|
-
"onGift"
|
|
41
|
+
"onGift",
|
|
42
|
+
"symbol",
|
|
43
|
+
"amountFormatter"
|
|
42
44
|
];
|
|
43
45
|
const isBookingItem = (dataSource) => {
|
|
44
46
|
var _dataSource$_extend;
|
|
@@ -75,7 +77,7 @@ const convertBundleOption = (option, translationOriginal) => {
|
|
|
75
77
|
num: (_ref = (_option$num = option.num) !== null && _option$num !== void 0 ? _option$num : option.quantity) !== null && _ref !== void 0 ? _ref : 1
|
|
76
78
|
});
|
|
77
79
|
};
|
|
78
|
-
const convertBundle = (bundle, translationOriginal) => {
|
|
80
|
+
const convertBundle = (bundle, translationOriginal, amountFormatter) => {
|
|
79
81
|
const options = (bundle.option || []).map((option) => convertBundleOption(option, translationOriginal));
|
|
80
82
|
const bundlePrice = bundle.price_type === "markdown" && Number.isFinite(Number(bundle.price)) ? -Math.abs(Number(bundle.price)) : bundle.price;
|
|
81
83
|
return _objectSpread2(_objectSpread2({}, bundle), {}, {
|
|
@@ -92,6 +94,7 @@ const convertBundle = (bundle, translationOriginal) => {
|
|
|
92
94
|
custom_price_type_ext: bundle.price_type_ext,
|
|
93
95
|
options,
|
|
94
96
|
option: options,
|
|
97
|
+
amountFormatter,
|
|
95
98
|
_origin: bundle
|
|
96
99
|
});
|
|
97
100
|
};
|
|
@@ -122,10 +125,10 @@ const mapLineItemOptions = (options, translationOriginal) => options.map((option
|
|
|
122
125
|
num: (_ref2 = (_option$num2 = option.num) !== null && _option$num2 !== void 0 ? _option$num2 : option.quantity) !== null && _ref2 !== void 0 ? _ref2 : 1
|
|
123
126
|
});
|
|
124
127
|
});
|
|
125
|
-
const convertProductToLineItemProduct = (product, translationOriginal, symbol) => {
|
|
128
|
+
const convertProductToLineItemProduct = (product, translationOriginal, symbol, amountFormatter) => {
|
|
126
129
|
var _product$metadata2, _ref3, _product$num, _ref4, _product$num2, _product$metadata3, _product$metadata4, _product$discount_lis, _product$discount_lis2, _product$metadata5, _product$metadata6, _ref5, _product$num3;
|
|
127
130
|
const title = translateText(product.product_title || product.title, translationOriginal);
|
|
128
|
-
const bundle = (product.product_bundle || []).map((bundleItem) => convertBundle(bundleItem, translationOriginal));
|
|
131
|
+
const bundle = (product.product_bundle || []).map((bundleItem) => convertBundle(bundleItem, translationOriginal, amountFormatter));
|
|
129
132
|
const lineOriginTotal = resolveLineOriginTotal(product);
|
|
130
133
|
const lineOptions = mapLineItemOptions(resolveLineItemOptions(product), translationOriginal);
|
|
131
134
|
return {
|
|
@@ -149,6 +152,7 @@ const convertProductToLineItemProduct = (product, translationOriginal, symbol) =
|
|
|
149
152
|
payment_price: product.payment_price,
|
|
150
153
|
tax_fee: product.tax_fee,
|
|
151
154
|
symbol,
|
|
155
|
+
amountFormatter,
|
|
152
156
|
note: product.note,
|
|
153
157
|
product_sku: product.product_sku,
|
|
154
158
|
product_bundle: bundle,
|
|
@@ -178,33 +182,36 @@ const convertProductToLineItemProduct = (product, translationOriginal, symbol) =
|
|
|
178
182
|
};
|
|
179
183
|
const LineItem = (props) => {
|
|
180
184
|
var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _dataSource$_extend2, _dataSource$_extend4;
|
|
181
|
-
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, statusOptions = [], statusLoading = false, statusDisabled = false, isShowRelatedProduct = true, holderOptions, onBookingStatusChange, onAddTimeProductCard, onAction, onDelete, onNote, onCard, onPromotion, onGift } = props, other = _objectWithoutProperties(props, _excluded);
|
|
182
|
-
|
|
185
|
+
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, statusOptions = [], statusLoading = false, statusDisabled = false, isShowRelatedProduct = true, holderOptions, onBookingStatusChange, onAddTimeProductCard, onAction, onDelete, onNote, onCard, onPromotion, onGift, symbol: amountSymbol, amountFormatter } = props, other = _objectWithoutProperties(props, _excluded);
|
|
186
|
+
const itemKind = itemType || (isBookingItem(dataSource) ? "booking" : "product");
|
|
183
187
|
const context = useEngineContext();
|
|
184
188
|
const translationOriginal = useTranslationOriginal();
|
|
185
|
-
const symbol = context.appHelper.utils.getSymbolic();
|
|
189
|
+
const symbol = amountSymbol || context.appHelper.utils.getSymbolic();
|
|
186
190
|
const locale = ((_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut.getApp) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.call(_context$appHelper$ut)) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.locales) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut3 = _context$appHelper$ut2.getLocale) === null || _context$appHelper$ut3 === void 0 ? void 0 : _context$appHelper$ut3.call(_context$appHelper$ut2)) || ((_context$appHelper$ut4 = context.appHelper.utils) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut4.storage) === null || _context$appHelper$ut4 === void 0 ? void 0 : _context$appHelper$ut4.get("umi_locale")) || "en-US";
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
+
useInitLocalesOnce(locales_default$1, locale);
|
|
192
|
+
useInitLocalesOnce(locales_default, locale);
|
|
193
|
+
const productDataSource = useMemo(() => itemKind === "product" ? convertProductToLineItemProduct(dataSource, translationOriginal, symbol, amountFormatter) : null, [
|
|
194
|
+
amountFormatter,
|
|
191
195
|
dataSource,
|
|
196
|
+
itemKind,
|
|
192
197
|
symbol,
|
|
193
198
|
translationOriginal
|
|
194
199
|
]);
|
|
195
200
|
const relatedProduct = dataSource === null || dataSource === void 0 || (_dataSource$_extend2 = dataSource._extend) === null || _dataSource$_extend2 === void 0 ? void 0 : _dataSource$_extend2.product;
|
|
196
201
|
const relatedProductDataSource = useMemo(() => {
|
|
197
202
|
if (!relatedProduct) return null;
|
|
198
|
-
return convertProductToLineItemProduct(relatedProduct, translationOriginal, symbol);
|
|
203
|
+
return convertProductToLineItemProduct(relatedProduct, translationOriginal, symbol, amountFormatter);
|
|
199
204
|
}, [
|
|
205
|
+
amountFormatter,
|
|
200
206
|
relatedProduct,
|
|
201
207
|
symbol,
|
|
202
208
|
translationOriginal
|
|
203
209
|
]);
|
|
204
210
|
const addTimeProductDataSources = useMemo(() => {
|
|
205
211
|
var _dataSource$_extend3;
|
|
206
|
-
return (Array.isArray(dataSource === null || dataSource === void 0 || (_dataSource$_extend3 = dataSource._extend) === null || _dataSource$_extend3 === void 0 ? void 0 : _dataSource$_extend3.addTimeProduct) ? dataSource._extend.addTimeProduct : []).map((item) => convertProductToLineItemProduct(item, translationOriginal, symbol));
|
|
212
|
+
return (Array.isArray(dataSource === null || dataSource === void 0 || (_dataSource$_extend3 = dataSource._extend) === null || _dataSource$_extend3 === void 0 ? void 0 : _dataSource$_extend3.addTimeProduct) ? dataSource._extend.addTimeProduct : []).map((item) => convertProductToLineItemProduct(item, translationOriginal, symbol, amountFormatter));
|
|
207
213
|
}, [
|
|
214
|
+
amountFormatter,
|
|
208
215
|
dataSource === null || dataSource === void 0 || (_dataSource$_extend4 = dataSource._extend) === null || _dataSource$_extend4 === void 0 ? void 0 : _dataSource$_extend4.addTimeProduct,
|
|
209
216
|
symbol,
|
|
210
217
|
translationOriginal
|
|
@@ -15,10 +15,16 @@
|
|
|
15
15
|
box-sizing: border-box;
|
|
16
16
|
width: 100%;
|
|
17
17
|
display: flex;
|
|
18
|
-
|
|
18
|
+
flex-direction: column;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
.pisell-line-item-inline-main {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: stretch;
|
|
25
|
+
min-width: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
22
28
|
.pisell-line-item-inline-content {
|
|
23
29
|
min-width: 0;
|
|
24
30
|
flex: 1;
|
|
@@ -249,6 +255,13 @@
|
|
|
249
255
|
padding: 6px 8px 8px;
|
|
250
256
|
}
|
|
251
257
|
|
|
258
|
+
// inline 操作仅占上方主体,价格栏放在其下方并占满整个预约卡。
|
|
259
|
+
&__inline-amount-footer {
|
|
260
|
+
box-sizing: border-box;
|
|
261
|
+
width: 100%;
|
|
262
|
+
padding: 0 8px 4px;
|
|
263
|
+
}
|
|
264
|
+
|
|
252
265
|
&__section-title {
|
|
253
266
|
color: #101828;
|
|
254
267
|
font-size: 12px;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import useEngineContext from "./useEngineContext.js";
|
|
2
|
+
import { locales } from "@pisell/utils";
|
|
3
|
+
//#region src/hooks/useInitLocalesOnce.ts
|
|
4
|
+
const DEFAULT_LOCALE = "en";
|
|
5
|
+
const initializedLocalesByTexts = /* @__PURE__ */ new WeakMap();
|
|
6
|
+
const isWeakMapKey = (value) => typeof value === "object" && value !== null || typeof value === "function";
|
|
7
|
+
const useInitLocalesOnce = (localeTexts, localeOverride) => {
|
|
8
|
+
var _context$appHelper, _context$engine;
|
|
9
|
+
const context = useEngineContext();
|
|
10
|
+
if (!localeTexts) return;
|
|
11
|
+
const _locale = localeOverride || (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.storage) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.get("umi_locale")) || (context === null || context === void 0 || (_context$engine = context.engine) === null || _context$engine === void 0 || (_context$engine = _context$engine.props) === null || _context$engine === void 0 ? void 0 : _context$engine.locale) || DEFAULT_LOCALE;
|
|
12
|
+
const normalizedLocale = locales.formatLocale(_locale);
|
|
13
|
+
const initializedLocales = isWeakMapKey(localeTexts) ? initializedLocalesByTexts.get(localeTexts) : void 0;
|
|
14
|
+
if ((initializedLocales === null || initializedLocales === void 0 ? void 0 : initializedLocales.has(normalizedLocale)) && locales.getLocale() === normalizedLocale) return;
|
|
15
|
+
locales.init(localeTexts, _locale);
|
|
16
|
+
if (isWeakMapKey(localeTexts)) {
|
|
17
|
+
const nextInitializedLocales = initializedLocales !== null && initializedLocales !== void 0 ? initializedLocales : /* @__PURE__ */ new Set();
|
|
18
|
+
nextInitializedLocales.add(normalizedLocale);
|
|
19
|
+
if (!initializedLocales) initializedLocalesByTexts.set(localeTexts, nextInitializedLocales);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { useInitLocalesOnce as default };
|