@pisell/materials 6.11.83 → 6.11.85
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/index.js +1 -1
- package/build/lowcode/preview.js +149 -149
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +18 -18
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +18 -18
- package/es/components/buttonGroupPreview/index.d.ts +19 -0
- package/es/components/buttonGroupPreview/index.js +10 -3
- package/es/components/productCard/cartSkuCard/components/BookingItem/index.d.ts +10 -0
- package/es/components/productCard/cartSkuCard/components/BookingItem/index.js +58 -0
- package/es/components/productCard/cartSkuCard/components/BookingItem/index.less +32 -0
- package/es/components/productCard/cartSkuCard/components/basicInfo/index.js +12 -3
- package/es/components/productCard/cartSkuCard/components/timeRange/index.js +1 -6
- package/es/components/productCard/cartSkuCard/components/weighing/index.d.ts +3 -5
- package/es/components/productCard/cartSkuCard/components/weighing/index.js +7 -18
- package/es/components/productCard/cartSkuCard/index.d.ts +4 -1
- package/es/components/productCard/cartSkuCard/index.js +20 -8
- package/es/components/productCard/lineItem/BookingLineItem.js +7 -17
- package/es/components/productCard/lineItem/components/Resources/index.d.ts +6 -0
- package/es/components/productCard/lineItem/components/Resources/index.js +42 -0
- package/es/components/productCard/lineItem/components/TimeRange/index.d.ts +11 -0
- package/es/components/productCard/lineItem/components/TimeRange/index.js +66 -0
- package/es/components/productCard/lineItem/index.less +21 -10
- package/es/components/table/BasicTable/index.js +2 -2
- package/lib/components/buttonGroupPreview/index.d.ts +19 -0
- package/lib/components/buttonGroupPreview/index.js +24 -17
- package/lib/components/productCard/cartSkuCard/components/BookingItem/index.d.ts +10 -0
- package/lib/components/productCard/cartSkuCard/components/BookingItem/index.js +60 -0
- package/lib/components/productCard/cartSkuCard/components/BookingItem/index.less +32 -0
- package/lib/components/productCard/cartSkuCard/components/basicInfo/index.js +9 -2
- package/lib/components/productCard/cartSkuCard/components/timeRange/index.js +1 -2
- package/lib/components/productCard/cartSkuCard/components/weighing/index.d.ts +3 -5
- package/lib/components/productCard/cartSkuCard/components/weighing/index.js +5 -13
- package/lib/components/productCard/cartSkuCard/index.d.ts +4 -1
- package/lib/components/productCard/cartSkuCard/index.js +15 -9
- package/lib/components/productCard/lineItem/BookingLineItem.js +3 -1
- package/lib/components/productCard/lineItem/components/Resources/index.d.ts +6 -0
- package/lib/components/productCard/lineItem/components/Resources/index.js +83 -0
- package/lib/components/productCard/lineItem/components/TimeRange/index.d.ts +11 -0
- package/lib/components/productCard/lineItem/components/TimeRange/index.js +103 -0
- package/lib/components/productCard/lineItem/index.less +21 -10
- package/lib/components/table/BasicTable/index.js +2 -3
- package/package.json +3 -3
|
@@ -71,7 +71,7 @@ var BasicTable = function BasicTable(props) {
|
|
|
71
71
|
var _page = formPagination.page;
|
|
72
72
|
var _size = formPagination.size || 10;
|
|
73
73
|
var list = [];
|
|
74
|
-
var _total =
|
|
74
|
+
var _total = total;
|
|
75
75
|
if (localPagination) {
|
|
76
76
|
// 这里本地前端过滤筛选
|
|
77
77
|
list = calcFilterSort({
|
|
@@ -89,7 +89,7 @@ var BasicTable = function BasicTable(props) {
|
|
|
89
89
|
list: list,
|
|
90
90
|
total: _total
|
|
91
91
|
};
|
|
92
|
-
}, [localPagination, dataSource, formPagination === null || formPagination === void 0 ? void 0 : formPagination.page, formPagination === null || formPagination === void 0 ? void 0 : formPagination.size, filter, sort, other.columns
|
|
92
|
+
}, [localPagination, dataSource, formPagination === null || formPagination === void 0 ? void 0 : formPagination.page, formPagination === null || formPagination === void 0 ? void 0 : formPagination.size, filter, sort, other.columns]);
|
|
93
93
|
|
|
94
94
|
// 总数
|
|
95
95
|
var total = useMemo(function () {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MenuProps, ButtonProps } from 'antd';
|
|
3
|
+
export interface ButtonGroupListItemProps {
|
|
4
|
+
id?: string;
|
|
5
|
+
isMore?: boolean;
|
|
6
|
+
menuData?: MenuProps['items'];
|
|
7
|
+
buttonProps?: ButtonProps;
|
|
8
|
+
}
|
|
9
|
+
interface ButtonConfigProps {
|
|
10
|
+
[id: string]: ButtonGroupListItemProps;
|
|
11
|
+
}
|
|
12
|
+
export declare type ButtonGroupListProps = ButtonGroupListItemProps[][];
|
|
13
|
+
interface ButtonGroupPreviewProps {
|
|
14
|
+
buttonConfig?: ButtonConfigProps;
|
|
15
|
+
buttonGroupList?: ButtonGroupListProps;
|
|
16
|
+
updateButtonProps?: ButtonGroupListItemProps;
|
|
17
|
+
}
|
|
18
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<ButtonGroupPreviewProps & React.RefAttributes<any>>>;
|
|
19
|
+
export default _default;
|
|
@@ -43,7 +43,7 @@ var updateSourceData = ({
|
|
|
43
43
|
if (Object.keys(buttonConfig).length !== 0) {
|
|
44
44
|
return buttonGroupList.map((subArray) => {
|
|
45
45
|
return subArray.map((item) => {
|
|
46
|
-
if (
|
|
46
|
+
if (item.id && Object.prototype.hasOwnProperty.call(buttonConfig, item.id)) {
|
|
47
47
|
return buttonConfig[item.id];
|
|
48
48
|
}
|
|
49
49
|
return item;
|
|
@@ -58,22 +58,29 @@ var ButtonGroupPreview = (0, import_react.forwardRef)(
|
|
|
58
58
|
const sourceDatas = (0, import_react.useMemo)(() => {
|
|
59
59
|
return updateSourceData({ buttonConfig, buttonGroupList });
|
|
60
60
|
}, [buttonGroupList, buttonConfig]);
|
|
61
|
-
return /* @__PURE__ */ import_react.default.createElement(import_antd.Flex, { wrap:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
...btnProps
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
61
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd.Flex, { wrap: "wrap", vertical: true, style: { marginBottom: 10 } }, sourceDatas.map(
|
|
62
|
+
(item, index) => import_react.default.createElement(
|
|
63
|
+
import_antd.Space,
|
|
64
|
+
{ key: index },
|
|
65
|
+
item.map((items, index2) => {
|
|
66
|
+
const {
|
|
67
|
+
isMore = false,
|
|
68
|
+
id = "",
|
|
69
|
+
menuData = [],
|
|
70
|
+
buttonProps
|
|
71
|
+
} = items;
|
|
72
|
+
const btnProps = { ...buttonProps, ...props.updateButtonProps };
|
|
73
|
+
const { children, ...dropdownButtonProps } = btnProps;
|
|
74
|
+
return isMore ? /* @__PURE__ */ import_react.default.createElement(import_antd.Dropdown, { menu: { items: menuData } }, /* @__PURE__ */ import_react.default.createElement(import_button.default, { key: id, ...dropdownButtonProps }, children ?? /* @__PURE__ */ import_react.default.createElement(import_icons.MoreOutlined, null))) : /* @__PURE__ */ import_react.default.createElement(
|
|
75
|
+
import_button.default,
|
|
76
|
+
{
|
|
77
|
+
key: id,
|
|
78
|
+
...btnProps
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
})
|
|
82
|
+
)
|
|
83
|
+
));
|
|
77
84
|
}
|
|
78
85
|
);
|
|
79
86
|
var buttonGroupPreview_default = (0, import_react.memo)(ButtonGroupPreview);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
interface BookingItemProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
isShowRelatedProduct?: boolean;
|
|
6
|
+
isShowDelete?: boolean;
|
|
7
|
+
dataSource: any;
|
|
8
|
+
}
|
|
9
|
+
declare const BookingItem: (props: BookingItemProps) => JSX.Element;
|
|
10
|
+
export default BookingItem;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/productCard/cartSkuCard/components/BookingItem/index.tsx
|
|
30
|
+
var BookingItem_exports = {};
|
|
31
|
+
__export(BookingItem_exports, {
|
|
32
|
+
default: () => BookingItem_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(BookingItem_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_classnames = __toESM(require("classnames"));
|
|
37
|
+
var import_antd = require("antd");
|
|
38
|
+
var import_timeRange = __toESM(require("../timeRange"));
|
|
39
|
+
var import_resources = __toESM(require("../resources"));
|
|
40
|
+
var import_index = require("./index.less");
|
|
41
|
+
var PREFIX = "pisell-cart-sku-card-booking-item";
|
|
42
|
+
var BookingItem = (props) => {
|
|
43
|
+
const {
|
|
44
|
+
children,
|
|
45
|
+
isShowRelatedProduct = true,
|
|
46
|
+
isShowDelete = false,
|
|
47
|
+
dataSource
|
|
48
|
+
} = props;
|
|
49
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: PREFIX }, /* @__PURE__ */ import_react.default.createElement(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
className: (0, import_classnames.default)(`${PREFIX}__info`, {
|
|
53
|
+
[`${PREFIX}__info--with-delete`]: isShowDelete
|
|
54
|
+
})
|
|
55
|
+
},
|
|
56
|
+
/* @__PURE__ */ import_react.default.createElement(import_timeRange.default, { dataSource }),
|
|
57
|
+
/* @__PURE__ */ import_react.default.createElement(import_resources.default, { dataSource })
|
|
58
|
+
), isShowRelatedProduct && /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_antd.Divider, { style: { margin: 0 } }), /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__related-product` }, children)));
|
|
59
|
+
};
|
|
60
|
+
var BookingItem_default = BookingItem;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.pisell-cart-sku-card-booking-item {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 4px;
|
|
5
|
+
|
|
6
|
+
&__info {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
gap: 4px;
|
|
10
|
+
min-width: 0;
|
|
11
|
+
|
|
12
|
+
&--with-delete {
|
|
13
|
+
padding-right: 44px;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&__resource-title {
|
|
18
|
+
color: var(--Gray-900, #101828);
|
|
19
|
+
font-size: 16px;
|
|
20
|
+
font-weight: 600;
|
|
21
|
+
line-height: 24px;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
text-overflow: ellipsis;
|
|
24
|
+
white-space: nowrap;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&__related-product {
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
gap: 4px;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -41,6 +41,12 @@ var import_weighing = __toESM(require("../weighing"));
|
|
|
41
41
|
var import__ = require("../../index");
|
|
42
42
|
var import_EditButton = __toESM(require("../../../components/Header/EditButton"));
|
|
43
43
|
var import_index = require("./index.less");
|
|
44
|
+
var UNIT_LABEL = {
|
|
45
|
+
KILOGRAMS: "kg",
|
|
46
|
+
GRAMS: "g",
|
|
47
|
+
POUNDS: "lb",
|
|
48
|
+
OUNCES: "oz"
|
|
49
|
+
};
|
|
44
50
|
var BasicInfo = (props) => {
|
|
45
51
|
var _a, _b;
|
|
46
52
|
const {
|
|
@@ -93,7 +99,7 @@ var BasicInfo = (props) => {
|
|
|
93
99
|
if (!hasProductMeta) {
|
|
94
100
|
return null;
|
|
95
101
|
}
|
|
96
|
-
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, hasWeighingInfo ? /* @__PURE__ */ import_react.default.createElement(import_weighing.default, { dataSource: weighingInfo
|
|
102
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, hasWeighingInfo ? /* @__PURE__ */ import_react.default.createElement(import_weighing.default, { dataSource: weighingInfo }) : null, hasSpecs ? /* @__PURE__ */ import_react.default.createElement(
|
|
97
103
|
import_specs.default,
|
|
98
104
|
{
|
|
99
105
|
dataSource,
|
|
@@ -104,7 +110,8 @@ var BasicInfo = (props) => {
|
|
|
104
110
|
};
|
|
105
111
|
const renderProductPrice = () => {
|
|
106
112
|
if (weighingInfo) {
|
|
107
|
-
|
|
113
|
+
const { unit, unit_price } = weighingInfo;
|
|
114
|
+
return `${(0, import_utils.formatAmount)(unit_price, 2, symbol)}/${UNIT_LABEL[unit]}`;
|
|
108
115
|
}
|
|
109
116
|
return (0, import_utils.formatAmount)(price, 2, symbol);
|
|
110
117
|
};
|
|
@@ -34,7 +34,6 @@ __export(timeRange_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(timeRange_exports);
|
|
35
35
|
var import_iconfont = __toESM(require("../../../../iconfont"));
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
|
-
var import_antd = require("antd");
|
|
38
37
|
var import_utils = require("../../../utils");
|
|
39
38
|
var import_dayjs = __toESM(require("dayjs"));
|
|
40
39
|
var import_zh_cn = require("dayjs/locale/zh-cn");
|
|
@@ -68,6 +67,6 @@ var TimeRange = (props) => {
|
|
|
68
67
|
const renderTimeItem = (time) => {
|
|
69
68
|
return /* @__PURE__ */ import_react.default.createElement("div", { className: "time-range-item" }, /* @__PURE__ */ import_react.default.createElement(import_iconfont.default, { className: "time-icon", type: "pisell2-clock" }), /* @__PURE__ */ import_react.default.createElement("span", { className: "time-str" }, (0, import_dayjs.default)(time).format(_format)));
|
|
70
69
|
};
|
|
71
|
-
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
70
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: `${import__.PREFIX}__time-range` }, /* @__PURE__ */ import_react.default.createElement(import_iconfont.default, { className: "time-icon", type: "pisell2-clock" }), (0, import_utils.getServiceTime)(dataSource, start_date)));
|
|
72
71
|
};
|
|
73
72
|
var timeRange_default = TimeRange;
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import './index.less';
|
|
2
2
|
declare type WeightUnit = 'KILOGRAMS' | 'GRAMS' | 'POUNDS' | 'OUNCES';
|
|
3
3
|
interface WeighingInfo {
|
|
4
|
-
weight?:
|
|
4
|
+
weight?: number;
|
|
5
5
|
tare?: {
|
|
6
6
|
id?: string;
|
|
7
7
|
label?: string;
|
|
8
|
-
value?:
|
|
8
|
+
value?: number;
|
|
9
9
|
unit?: WeightUnit;
|
|
10
10
|
};
|
|
11
|
-
net_weight?:
|
|
12
|
-
unit_price?: string | number;
|
|
11
|
+
net_weight?: number;
|
|
13
12
|
unit?: WeightUnit;
|
|
14
13
|
}
|
|
15
14
|
interface WeighingProps {
|
|
16
15
|
dataSource?: WeighingInfo;
|
|
17
|
-
symbol?: string;
|
|
18
16
|
}
|
|
19
17
|
declare const Weighing: (props: WeighingProps) => JSX.Element | null;
|
|
20
18
|
export default Weighing;
|
|
@@ -48,22 +48,14 @@ var formatWeight = (value, unit) => {
|
|
|
48
48
|
const displayUnit = UNIT_LABEL_MAP[unit || "KILOGRAMS"];
|
|
49
49
|
return `${displayValue.toFixed(3)} ${displayUnit}`;
|
|
50
50
|
};
|
|
51
|
-
var formatUnitPrice = (value, symbol = "") => {
|
|
52
|
-
return (0, import_utils.formatAmountWithOptions)(value ?? 0, symbol, {
|
|
53
|
-
precision: 2,
|
|
54
|
-
hideDecimalForWholeNumbers: false
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
51
|
var Weighing = (props) => {
|
|
58
|
-
const { dataSource
|
|
52
|
+
const { dataSource } = props;
|
|
59
53
|
if (!dataSource) {
|
|
60
54
|
return null;
|
|
61
55
|
}
|
|
62
|
-
const { weight, tare, net_weight,
|
|
63
|
-
const
|
|
64
|
-
const tareLabel = import_utils.locales.getText("pisell2.cart.sku-card.weighing.tare");
|
|
65
|
-
|
|
66
|
-
const unitPriceText = formatUnitPrice(unit_price, symbol);
|
|
67
|
-
return /* @__PURE__ */ import_react.default.createElement("div", { className: `${import__.PREFIX}__weighing` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${import__.PREFIX}__weighing-row` }, /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell2.cart.sku-card.weighing.gross"), ":"), /* @__PURE__ */ import_react.default.createElement("span", null, formatWeight(weight, unit))), /* @__PURE__ */ import_react.default.createElement("div", { className: `${import__.PREFIX}__weighing-row` }, /* @__PURE__ */ import_react.default.createElement("span", null, tareLabel, ":"), /* @__PURE__ */ import_react.default.createElement("span", null, formatWeight(tare == null ? void 0 : tare.value, (tare == null ? void 0 : tare.unit) || unit))), /* @__PURE__ */ import_react.default.createElement("div", { className: `${import__.PREFIX}__weighing-row` }, /* @__PURE__ */ import_react.default.createElement("span", null, formatWeight(net_weight, unit), " ", netLabel, " @ ", unitPriceText, "/", unitLabel)));
|
|
56
|
+
const { weight, tare, net_weight, unit = "KILOGRAMS" } = dataSource;
|
|
57
|
+
const tareValue = Number((tare == null ? void 0 : tare.value) || 0);
|
|
58
|
+
const tareLabel = (tare == null ? void 0 : tare.label) || import_utils.locales.getText("pisell2.cart.sku-card.weighing.tare");
|
|
59
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: `${import__.PREFIX}__weighing` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${import__.PREFIX}__weighing-row` }, /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell2.cart.sku-card.weighing.gross"), ":"), /* @__PURE__ */ import_react.default.createElement("span", null, formatWeight(weight, unit))), tareValue > 0 ? /* @__PURE__ */ import_react.default.createElement("div", { className: `${import__.PREFIX}__weighing-row` }, /* @__PURE__ */ import_react.default.createElement("span", null, tareLabel, ":"), /* @__PURE__ */ import_react.default.createElement("span", null, "-", formatWeight(tareValue, (tare == null ? void 0 : tare.unit) || unit))) : null, /* @__PURE__ */ import_react.default.createElement("div", { className: `${import__.PREFIX}__weighing-row` }, /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell2.cart.sku-card.weighing.net"), ":"), /* @__PURE__ */ import_react.default.createElement("span", null, formatWeight(net_weight, unit))));
|
|
68
60
|
};
|
|
69
61
|
var weighing_default = Weighing;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import './index.less';
|
|
2
2
|
import { ProductCardTypes } from '../types';
|
|
3
|
-
interface ISKUCardProps extends ProductCardTypes {
|
|
3
|
+
interface ISKUCardProps extends Omit<ProductCardTypes, 'dataSource'> {
|
|
4
|
+
dataSource: any;
|
|
5
|
+
itemType?: 'booking' | 'product';
|
|
4
6
|
type: 'a2' | 'a5' | 'a9';
|
|
5
7
|
rightActions: any[];
|
|
6
8
|
escapeDom?: string;
|
|
9
|
+
isShowRelatedProduct?: boolean;
|
|
7
10
|
}
|
|
8
11
|
export declare const PREFIX = "pisell-cart-sku-card";
|
|
9
12
|
declare const CartSkuCard: (props: ISKUCardProps) => JSX.Element | null;
|
|
@@ -49,6 +49,7 @@ var import_AmountFooter = __toESM(require("./components/AmountFooter"));
|
|
|
49
49
|
var import_MultiDay = __toESM(require("./components/MultiDay"));
|
|
50
50
|
var import_Promotion = __toESM(require("./components/Promotion"));
|
|
51
51
|
var import_Gift = __toESM(require("./components/Gift"));
|
|
52
|
+
var import_BookingItem = __toESM(require("./components/BookingItem"));
|
|
52
53
|
var import_index = require("./index.less");
|
|
53
54
|
var import_iconfont = __toESM(require("../../iconfont"));
|
|
54
55
|
var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext"));
|
|
@@ -79,10 +80,12 @@ var CartSkuCard = (props) => {
|
|
|
79
80
|
onPromotion,
|
|
80
81
|
onGift,
|
|
81
82
|
onChangeHolder,
|
|
83
|
+
itemType = "product",
|
|
82
84
|
type,
|
|
83
85
|
rightActions = [],
|
|
84
86
|
escapeDom,
|
|
85
87
|
maxSpecsCount = 1,
|
|
88
|
+
isShowRelatedProduct = true,
|
|
86
89
|
...other
|
|
87
90
|
} = props;
|
|
88
91
|
const useOpenNoteRef = (0, import_react.useRef)();
|
|
@@ -108,13 +111,7 @@ var CartSkuCard = (props) => {
|
|
|
108
111
|
padding: "10px 0px"
|
|
109
112
|
}
|
|
110
113
|
},
|
|
111
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
112
|
-
import_iconfont.default,
|
|
113
|
-
{
|
|
114
|
-
type: "pisell2-trash-01",
|
|
115
|
-
style: { fontSize: 20, marginRight: 4 }
|
|
116
|
-
}
|
|
117
|
-
),
|
|
114
|
+
/* @__PURE__ */ import_react.default.createElement("span", { style: { fontSize: 20, marginRight: 4, lineHeight: 1 } }, /* @__PURE__ */ import_react.default.createElement(import_iconfont.default, { type: "pisell2-trash-01" })),
|
|
118
115
|
/* @__PURE__ */ import_react.default.createElement("span", { style: { fontSize: 12, fontWeight: 500 } }, import_utils.locales.getText("pisell2.cart.sku-card.actions.delete"))
|
|
119
116
|
),
|
|
120
117
|
color: "danger",
|
|
@@ -190,7 +187,7 @@ var CartSkuCard = (props) => {
|
|
|
190
187
|
disabledEditClick,
|
|
191
188
|
onEditProduct
|
|
192
189
|
}
|
|
193
|
-
), /* @__PURE__ */ import_react.default.createElement(import_timeRange.default, { dataSource }), /* @__PURE__ */ import_react.default.createElement(import_resources.default, { dataSource }), /* @__PURE__ */ import_react.default.createElement(import_packages.default, { dataSource, isShowImage }), /* @__PURE__ */ import_react.default.createElement(
|
|
190
|
+
), itemType !== "booking" ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_timeRange.default, { dataSource }), /* @__PURE__ */ import_react.default.createElement(import_resources.default, { dataSource })) : null, /* @__PURE__ */ import_react.default.createElement(import_packages.default, { dataSource, isShowImage }), /* @__PURE__ */ import_react.default.createElement(
|
|
194
191
|
import_sales.default,
|
|
195
192
|
{
|
|
196
193
|
dataSource,
|
|
@@ -278,6 +275,7 @@ var CartSkuCard = (props) => {
|
|
|
278
275
|
return renderA2();
|
|
279
276
|
};
|
|
280
277
|
if (dataSource == null ? void 0 : dataSource.isGift) return null;
|
|
278
|
+
const content = renderContent();
|
|
281
279
|
return /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}-wrapper-container` }, /* @__PURE__ */ import_react.default.createElement(
|
|
282
280
|
import_swipeAction.SwipeAction,
|
|
283
281
|
{
|
|
@@ -297,7 +295,15 @@ var CartSkuCard = (props) => {
|
|
|
297
295
|
onCard == null ? void 0 : onCard(dataSource);
|
|
298
296
|
}
|
|
299
297
|
},
|
|
300
|
-
|
|
298
|
+
itemType === "booking" ? /* @__PURE__ */ import_react.default.createElement(
|
|
299
|
+
import_BookingItem.default,
|
|
300
|
+
{
|
|
301
|
+
dataSource,
|
|
302
|
+
isShowRelatedProduct,
|
|
303
|
+
isShowDelete
|
|
304
|
+
},
|
|
305
|
+
content
|
|
306
|
+
) : content
|
|
301
307
|
)
|
|
302
308
|
), /* @__PURE__ */ import_react.default.createElement(
|
|
303
309
|
import_Gift.default,
|
|
@@ -46,6 +46,8 @@ var import_Promotion = __toESM(require("../cartSkuCard/components/Promotion"));
|
|
|
46
46
|
var import_Gift = __toESM(require("../cartSkuCard/components/Gift"));
|
|
47
47
|
var import_swipeAction = require("../cartSkuCard/components/swipeAction");
|
|
48
48
|
var import_Action = __toESM(require("../components/Action"));
|
|
49
|
+
var import_TimeRange = __toESM(require("./components/TimeRange"));
|
|
50
|
+
var import_Resources = __toESM(require("./components/Resources"));
|
|
49
51
|
var import_iconfont = __toESM(require("../../iconfont"));
|
|
50
52
|
var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext"));
|
|
51
53
|
var PREFIX = "pisell-line-item";
|
|
@@ -221,7 +223,7 @@ var BookingLineItem = (props) => {
|
|
|
221
223
|
/* @__PURE__ */ import_react.default.createElement(import_iconfont.default, { type: "pisell2-trash-01" })
|
|
222
224
|
) : null))
|
|
223
225
|
),
|
|
224
|
-
/* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__booking-detail` }, /* @__PURE__ */ import_react.default.createElement(
|
|
226
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__booking-detail` }, /* @__PURE__ */ import_react.default.createElement(import_TimeRange.default, { dataSource }), /* @__PURE__ */ import_react.default.createElement(import_Resources.default, { dataSource })),
|
|
225
227
|
isShowRelatedProduct && relatedProductDataSource ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_antd.Divider, { style: { margin: 0 } }), /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__related-product` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__related-product-card` }, /* @__PURE__ */ import_react.default.createElement(
|
|
226
228
|
import_basicInfo.default,
|
|
227
229
|
{
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/productCard/lineItem/components/Resources/index.tsx
|
|
30
|
+
var Resources_exports = {};
|
|
31
|
+
__export(Resources_exports, {
|
|
32
|
+
default: () => Resources_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Resources_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_resources = require("../../../cartSkuCard/components/resources/index.less");
|
|
38
|
+
var PREFIX = "pisell-cart-sku-card";
|
|
39
|
+
var ResourceTag = import_antd.Tag;
|
|
40
|
+
var colors = [
|
|
41
|
+
"magenta",
|
|
42
|
+
"volcano",
|
|
43
|
+
"orange",
|
|
44
|
+
"gold",
|
|
45
|
+
"green",
|
|
46
|
+
"cyan",
|
|
47
|
+
"blue",
|
|
48
|
+
"geekblue",
|
|
49
|
+
"purple"
|
|
50
|
+
];
|
|
51
|
+
function getColor(n) {
|
|
52
|
+
return colors[n * 31 % colors.length];
|
|
53
|
+
}
|
|
54
|
+
var getResourceLabel = (resource, fallbackLabel) => {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
return ((_a = resource == null ? void 0 : resource.metadata) == null ? void 0 : _a.resource_name) || ((_b = resource == null ? void 0 : resource.metadata) == null ? void 0 : _b.form_name) || fallbackLabel || "";
|
|
57
|
+
};
|
|
58
|
+
var LineItemResources = (props) => {
|
|
59
|
+
const { dataSource = {} } = props;
|
|
60
|
+
const resources = Array.isArray(dataSource == null ? void 0 : dataSource.resources) ? dataSource.resources : [];
|
|
61
|
+
const fallbackResourceLabel = resources.length === 1 ? dataSource == null ? void 0 : dataSource.relation_form_name : "";
|
|
62
|
+
const resourceLabels = Array.isArray(dataSource == null ? void 0 : dataSource.resources) ? resources.map((resource, index) => ({
|
|
63
|
+
id: Number(resource == null ? void 0 : resource.form_id) || Number(resource == null ? void 0 : resource.relation_id) || index + 1,
|
|
64
|
+
label: getResourceLabel(resource, fallbackResourceLabel)
|
|
65
|
+
})) : [];
|
|
66
|
+
if (!resourceLabels.length && (dataSource == null ? void 0 : dataSource.relation_form_name)) {
|
|
67
|
+
resourceLabels.push({
|
|
68
|
+
id: 1,
|
|
69
|
+
label: dataSource.relation_form_name
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
if (!resourceLabels.length) return null;
|
|
73
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__resources` }, resourceLabels.map((resource) => /* @__PURE__ */ import_react.default.createElement(
|
|
74
|
+
ResourceTag,
|
|
75
|
+
{
|
|
76
|
+
key: `${resource.id}-${resource.label}`,
|
|
77
|
+
color: getColor(resource.id),
|
|
78
|
+
className: "resource-tag"
|
|
79
|
+
},
|
|
80
|
+
resource.label
|
|
81
|
+
)));
|
|
82
|
+
};
|
|
83
|
+
var Resources_default = LineItemResources;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import 'dayjs/locale/zh-cn';
|
|
2
|
+
import 'dayjs/locale/en';
|
|
3
|
+
import 'dayjs/locale/zh-tw';
|
|
4
|
+
import 'dayjs/locale/ja';
|
|
5
|
+
import 'dayjs/locale/pt';
|
|
6
|
+
import '../../../cartSkuCard/components/timeRange/index.less';
|
|
7
|
+
interface LineItemTimeRangeProps {
|
|
8
|
+
dataSource?: any;
|
|
9
|
+
}
|
|
10
|
+
declare const LineItemTimeRange: (props: LineItemTimeRangeProps) => JSX.Element | null;
|
|
11
|
+
export default LineItemTimeRange;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/productCard/lineItem/components/TimeRange/index.tsx
|
|
30
|
+
var TimeRange_exports = {};
|
|
31
|
+
__export(TimeRange_exports, {
|
|
32
|
+
default: () => TimeRange_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(TimeRange_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
37
|
+
var import_zh_cn = require("dayjs/locale/zh-cn");
|
|
38
|
+
var import_en = require("dayjs/locale/en");
|
|
39
|
+
var import_zh_tw = require("dayjs/locale/zh-tw");
|
|
40
|
+
var import_ja = require("dayjs/locale/ja");
|
|
41
|
+
var import_pt = require("dayjs/locale/pt");
|
|
42
|
+
var import_utils = require("@pisell/utils");
|
|
43
|
+
var import_iconfont = __toESM(require("../../../../iconfont"));
|
|
44
|
+
var import_useEngineContext = __toESM(require("../../../../../hooks/useEngineContext"));
|
|
45
|
+
var import_timeRange = require("../../../cartSkuCard/components/timeRange/index.less");
|
|
46
|
+
var localeTypes = {
|
|
47
|
+
"en-US": "en",
|
|
48
|
+
"zh-CN": "zh-cn",
|
|
49
|
+
"zh-HK": "zh-tw",
|
|
50
|
+
ja: "ja",
|
|
51
|
+
pt: "pt"
|
|
52
|
+
};
|
|
53
|
+
var PREFIX = "pisell-cart-sku-card";
|
|
54
|
+
var formatMultiDayDate = (start, end, isEn) => {
|
|
55
|
+
const format = isEn ? "ddd, DD/MM/YYYY" : "YYYY-MM-DD,ddd";
|
|
56
|
+
return `${start.format(format)} ~ ${end.format(format)}`;
|
|
57
|
+
};
|
|
58
|
+
var formatBookingTime = (booking, locale) => {
|
|
59
|
+
const start = (0, import_dayjs.default)(
|
|
60
|
+
(booking == null ? void 0 : booking.start_time) ? `${(booking == null ? void 0 : booking.start_date) || ""} ${booking.start_time}` : booking == null ? void 0 : booking.start_date
|
|
61
|
+
);
|
|
62
|
+
const end = (0, import_dayjs.default)(
|
|
63
|
+
(booking == null ? void 0 : booking.end_time) ? `${(booking == null ? void 0 : booking.end_date) || ""} ${booking.end_time}` : booking == null ? void 0 : booking.end_date
|
|
64
|
+
);
|
|
65
|
+
if (!start.isValid() || !end.isValid()) return "";
|
|
66
|
+
const isEn = locale === "en-US" || locale === "en";
|
|
67
|
+
const durationType = (booking == null ? void 0 : booking.sub_type) || (booking == null ? void 0 : booking.duration_type);
|
|
68
|
+
const startTime = (booking == null ? void 0 : booking.start_time) || start.format("HH:mm");
|
|
69
|
+
const endTime = (booking == null ? void 0 : booking.end_time) || end.format("HH:mm");
|
|
70
|
+
if (durationType === "days" && !start.isSame(end, "day")) {
|
|
71
|
+
const duration2 = end.diff(start, "day");
|
|
72
|
+
return `${formatMultiDayDate(start, end, isEn)} (${duration2}${import_utils.locales.getText(
|
|
73
|
+
"pisell2.product.card.day"
|
|
74
|
+
)(duration2)})`;
|
|
75
|
+
}
|
|
76
|
+
const dateFormat = isEn ? "DD/MM/YYYY" : "YYYY-MM-DD";
|
|
77
|
+
const dateTime = start.isSame(end, "day") ? isEn ? `${startTime} ~ ${endTime} ${start.format(dateFormat)}` : `${start.format(dateFormat)} ${startTime} ~ ${endTime}` : isEn ? `${startTime} ${start.format(dateFormat)} ~ ${endTime} ${end.format(dateFormat)}` : `${start.format(dateFormat)} ${startTime} ~ ${end.format(dateFormat)} ${endTime}`;
|
|
78
|
+
if (!durationType) return dateTime;
|
|
79
|
+
if (durationType === "minutes" || durationType === "flexible") {
|
|
80
|
+
const duration2 = end.diff(start, "minute");
|
|
81
|
+
const hours = Math.floor(duration2 / 60);
|
|
82
|
+
const minutes = duration2 % 60;
|
|
83
|
+
return `${dateTime} (${import_utils.locales.getText("pisell2.product.card.hour.minute")(
|
|
84
|
+
hours,
|
|
85
|
+
minutes
|
|
86
|
+
)})`;
|
|
87
|
+
}
|
|
88
|
+
const duration = end.diff(start, durationType);
|
|
89
|
+
return `${dateTime} (${duration})`;
|
|
90
|
+
};
|
|
91
|
+
var LineItemTimeRange = (props) => {
|
|
92
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
93
|
+
const { dataSource = {} } = props;
|
|
94
|
+
const context = (0, import_useEngineContext.default)();
|
|
95
|
+
const locale = ((_e = (_d = (_c = (_b = (_a = context.appHelper.utils) == null ? void 0 : _a.getApp) == null ? void 0 : _b.call(_a)) == null ? void 0 : _c.locales) == null ? void 0 : _d.getLocale) == null ? void 0 : _e.call(_d)) || ((_g = (_f = context.appHelper.utils) == null ? void 0 : _f.storage) == null ? void 0 : _g.get("umi_locale")) || (dataSource == null ? void 0 : dataSource.locale) || "en-US";
|
|
96
|
+
const serviceTime = (0, import_react.useMemo)(() => {
|
|
97
|
+
import_dayjs.default.locale(localeTypes[locale]);
|
|
98
|
+
return formatBookingTime(dataSource, locale);
|
|
99
|
+
}, [dataSource, locale]);
|
|
100
|
+
if (!serviceTime) return null;
|
|
101
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__time-range` }, /* @__PURE__ */ import_react.default.createElement(import_iconfont.default, { className: "time-icon", type: "pisell2-clock" }), serviceTime);
|
|
102
|
+
};
|
|
103
|
+
var TimeRange_default = LineItemTimeRange;
|