@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.
Files changed (43) hide show
  1. package/build/lowcode/index.js +1 -1
  2. package/build/lowcode/preview.js +149 -149
  3. package/build/lowcode/render/default/view.css +1 -1
  4. package/build/lowcode/render/default/view.js +18 -18
  5. package/build/lowcode/view.css +1 -1
  6. package/build/lowcode/view.js +18 -18
  7. package/es/components/buttonGroupPreview/index.d.ts +19 -0
  8. package/es/components/buttonGroupPreview/index.js +10 -3
  9. package/es/components/productCard/cartSkuCard/components/BookingItem/index.d.ts +10 -0
  10. package/es/components/productCard/cartSkuCard/components/BookingItem/index.js +58 -0
  11. package/es/components/productCard/cartSkuCard/components/BookingItem/index.less +32 -0
  12. package/es/components/productCard/cartSkuCard/components/basicInfo/index.js +12 -3
  13. package/es/components/productCard/cartSkuCard/components/timeRange/index.js +1 -6
  14. package/es/components/productCard/cartSkuCard/components/weighing/index.d.ts +3 -5
  15. package/es/components/productCard/cartSkuCard/components/weighing/index.js +7 -18
  16. package/es/components/productCard/cartSkuCard/index.d.ts +4 -1
  17. package/es/components/productCard/cartSkuCard/index.js +20 -8
  18. package/es/components/productCard/lineItem/BookingLineItem.js +7 -17
  19. package/es/components/productCard/lineItem/components/Resources/index.d.ts +6 -0
  20. package/es/components/productCard/lineItem/components/Resources/index.js +42 -0
  21. package/es/components/productCard/lineItem/components/TimeRange/index.d.ts +11 -0
  22. package/es/components/productCard/lineItem/components/TimeRange/index.js +66 -0
  23. package/es/components/productCard/lineItem/index.less +21 -10
  24. package/es/components/table/BasicTable/index.js +2 -2
  25. package/lib/components/buttonGroupPreview/index.d.ts +19 -0
  26. package/lib/components/buttonGroupPreview/index.js +24 -17
  27. package/lib/components/productCard/cartSkuCard/components/BookingItem/index.d.ts +10 -0
  28. package/lib/components/productCard/cartSkuCard/components/BookingItem/index.js +60 -0
  29. package/lib/components/productCard/cartSkuCard/components/BookingItem/index.less +32 -0
  30. package/lib/components/productCard/cartSkuCard/components/basicInfo/index.js +9 -2
  31. package/lib/components/productCard/cartSkuCard/components/timeRange/index.js +1 -2
  32. package/lib/components/productCard/cartSkuCard/components/weighing/index.d.ts +3 -5
  33. package/lib/components/productCard/cartSkuCard/components/weighing/index.js +5 -13
  34. package/lib/components/productCard/cartSkuCard/index.d.ts +4 -1
  35. package/lib/components/productCard/cartSkuCard/index.js +15 -9
  36. package/lib/components/productCard/lineItem/BookingLineItem.js +3 -1
  37. package/lib/components/productCard/lineItem/components/Resources/index.d.ts +6 -0
  38. package/lib/components/productCard/lineItem/components/Resources/index.js +83 -0
  39. package/lib/components/productCard/lineItem/components/TimeRange/index.d.ts +11 -0
  40. package/lib/components/productCard/lineItem/components/TimeRange/index.js +103 -0
  41. package/lib/components/productCard/lineItem/index.less +21 -10
  42. package/lib/components/table/BasicTable/index.js +2 -3
  43. package/package.json +3 -3
@@ -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;
@@ -1,5 +1,8 @@
1
+ var _excluded = ["children"];
1
2
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
5
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
3
6
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
7
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
8
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -23,7 +26,7 @@ var updateSourceData = function updateSourceData(_ref) {
23
26
  if (Object.keys(buttonConfig).length !== 0) {
24
27
  return buttonGroupList.map(function (subArray) {
25
28
  return subArray.map(function (item) {
26
- if (buttonConfig.hasOwnProperty(item.id)) {
29
+ if (item.id && Object.prototype.hasOwnProperty.call(buttonConfig, item.id)) {
27
30
  return buttonConfig[item.id]; // 如果存在,则替换为新的对象
28
31
  }
29
32
  return item; // 保持其他对象不变
@@ -44,7 +47,7 @@ var ButtonGroupPreview = /*#__PURE__*/forwardRef(function (props, ref) {
44
47
  });
45
48
  }, [buttonGroupList, buttonConfig]);
46
49
  return /*#__PURE__*/React.createElement(Flex, {
47
- wrap: true,
50
+ wrap: "wrap",
48
51
  vertical: true,
49
52
  style: {
50
53
  marginBottom: 10
@@ -61,11 +64,15 @@ var ButtonGroupPreview = /*#__PURE__*/forwardRef(function (props, ref) {
61
64
  menuData = _items$menuData === void 0 ? [] : _items$menuData,
62
65
  buttonProps = items.buttonProps;
63
66
  var btnProps = _objectSpread(_objectSpread({}, buttonProps), props.updateButtonProps);
67
+ var children = btnProps.children,
68
+ dropdownButtonProps = _objectWithoutProperties(btnProps, _excluded);
64
69
  return isMore ? /*#__PURE__*/React.createElement(Dropdown, {
65
70
  menu: {
66
71
  items: menuData
67
72
  }
68
- }, /*#__PURE__*/React.createElement(Button, null, /*#__PURE__*/React.createElement(MoreOutlined, null))) : /*#__PURE__*/React.createElement(Button, _extends({
73
+ }, /*#__PURE__*/React.createElement(Button, _extends({
74
+ key: id
75
+ }, dropdownButtonProps), children !== null && children !== void 0 ? children : /*#__PURE__*/React.createElement(MoreOutlined, null))) : /*#__PURE__*/React.createElement(Button, _extends({
69
76
  key: id
70
77
  }, btnProps));
71
78
  }));
@@ -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,58 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
+ import React from 'react';
6
+ import classNames from 'classnames';
7
+ import { Divider } from 'antd';
8
+ import TimeRange from "../timeRange";
9
+ import Resources from "../resources";
10
+ import "./index.less";
11
+ var PREFIX = 'pisell-cart-sku-card-booking-item';
12
+ var getSelectedResourceNames = function getSelectedResourceNames(dataSource) {
13
+ var _ref = dataSource || {},
14
+ multiResources = _ref.multiResources,
15
+ isMultipleResource = _ref.isMultipleResource;
16
+ if (!isMultipleResource || !(multiResources !== null && multiResources !== void 0 && multiResources.length)) return [];
17
+ return multiResources.flatMap(function (resourceGroup) {
18
+ var _ref2 = resourceGroup || {},
19
+ ids = _ref2.id,
20
+ _ref2$lists = _ref2.lists,
21
+ lists = _ref2$lists === void 0 ? [] : _ref2$lists;
22
+ if (!Array.isArray(ids)) return [];
23
+ return ids.map(function (id) {
24
+ var targetRes = lists.find(function (resource) {
25
+ return resource.id === id;
26
+ });
27
+ return (targetRes === null || targetRes === void 0 ? void 0 : targetRes.label) || null;
28
+ }).filter(Boolean);
29
+ }).filter(Boolean).filter(function (name, index, names) {
30
+ return names.indexOf(name) === index;
31
+ });
32
+ };
33
+ var BookingItem = function BookingItem(props) {
34
+ var children = props.children,
35
+ _props$isShowRelatedP = props.isShowRelatedProduct,
36
+ isShowRelatedProduct = _props$isShowRelatedP === void 0 ? true : _props$isShowRelatedP,
37
+ _props$isShowDelete = props.isShowDelete,
38
+ isShowDelete = _props$isShowDelete === void 0 ? false : _props$isShowDelete,
39
+ dataSource = props.dataSource;
40
+ // const resourceTitle = getSelectedResourceNames(dataSource).join(' · ');
41
+
42
+ return /*#__PURE__*/React.createElement("div", {
43
+ className: PREFIX
44
+ }, /*#__PURE__*/React.createElement("div", {
45
+ className: classNames("".concat(PREFIX, "__info"), _defineProperty({}, "".concat(PREFIX, "__info--with-delete"), isShowDelete))
46
+ }, /*#__PURE__*/React.createElement(TimeRange, {
47
+ dataSource: dataSource
48
+ }), /*#__PURE__*/React.createElement(Resources, {
49
+ dataSource: dataSource
50
+ })), isShowRelatedProduct && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, {
51
+ style: {
52
+ margin: 0
53
+ }
54
+ }), /*#__PURE__*/React.createElement("div", {
55
+ className: "".concat(PREFIX, "__related-product")
56
+ }, children)));
57
+ };
58
+ export 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
+ }
@@ -7,6 +7,14 @@ import Weighing from "../weighing";
7
7
  import { PREFIX } from "../../index";
8
8
  import EditButton from "../../../components/Header/EditButton";
9
9
  import "./index.less";
10
+
11
+ /** 每种重量单位对应的展示缩写。 */
12
+ var UNIT_LABEL = {
13
+ KILOGRAMS: 'kg',
14
+ GRAMS: 'g',
15
+ POUNDS: 'lb',
16
+ OUNCES: 'oz'
17
+ };
10
18
  var BasicInfo = function BasicInfo(props) {
11
19
  var _origin;
12
20
  var isShowImage = props.isShowImage,
@@ -59,8 +67,7 @@ var BasicInfo = function BasicInfo(props) {
59
67
  return null;
60
68
  }
61
69
  return /*#__PURE__*/React.createElement(React.Fragment, null, hasWeighingInfo ? /*#__PURE__*/React.createElement(Weighing, {
62
- dataSource: weighingInfo,
63
- symbol: symbol
70
+ dataSource: weighingInfo
64
71
  }) : null, hasSpecs ? /*#__PURE__*/React.createElement(Specs, {
65
72
  dataSource: dataSource,
66
73
  maxSpecsCount: maxSpecsCount,
@@ -69,7 +76,9 @@ var BasicInfo = function BasicInfo(props) {
69
76
  };
70
77
  var renderProductPrice = function renderProductPrice() {
71
78
  if (weighingInfo) {
72
- return null;
79
+ var unit = weighingInfo.unit,
80
+ unit_price = weighingInfo.unit_price;
81
+ return "".concat(formatAmount(unit_price, 2, symbol), "/").concat(UNIT_LABEL[unit]);
73
82
  }
74
83
  return formatAmount(price, 2, symbol);
75
84
  };
@@ -1,6 +1,5 @@
1
1
  import Iconfont from "../../../../iconfont";
2
2
  import React, { useEffect, useMemo } from 'react';
3
- import { Divider } from 'antd';
4
3
  import { getServiceTime } from "../../../utils";
5
4
  import dayjs from 'dayjs';
6
5
  import 'dayjs/locale/zh-cn';
@@ -45,11 +44,7 @@ var TimeRange = function TimeRange(props) {
45
44
  className: "time-str"
46
45
  }, dayjs(time).format(_format)));
47
46
  };
48
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, {
49
- style: {
50
- margin: '0'
51
- }
52
- }), /*#__PURE__*/React.createElement("div", {
47
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
53
48
  className: "".concat(PREFIX, "__time-range")
54
49
  }, /*#__PURE__*/React.createElement(Iconfont, {
55
50
  className: "time-icon",
@@ -1,20 +1,18 @@
1
1
  import './index.less';
2
2
  declare type WeightUnit = 'KILOGRAMS' | 'GRAMS' | 'POUNDS' | 'OUNCES';
3
3
  interface WeighingInfo {
4
- weight?: string | number;
4
+ weight?: number;
5
5
  tare?: {
6
6
  id?: string;
7
7
  label?: string;
8
- value?: string | number;
8
+ value?: number;
9
9
  unit?: WeightUnit;
10
10
  };
11
- net_weight?: string | number;
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;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { formatAmountWithOptions, locales } from '@pisell/utils';
2
+ import { locales } from '@pisell/utils';
3
3
  import { PREFIX } from "../../index";
4
4
  import "./index.less";
5
5
  var UNIT_LABEL_MAP = {
@@ -14,37 +14,26 @@ var formatWeight = function formatWeight(value, unit) {
14
14
  var displayUnit = UNIT_LABEL_MAP[unit || 'KILOGRAMS'];
15
15
  return "".concat(displayValue.toFixed(3), " ").concat(displayUnit);
16
16
  };
17
- var formatUnitPrice = function formatUnitPrice(value) {
18
- var symbol = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
19
- return formatAmountWithOptions(value !== null && value !== void 0 ? value : 0, symbol, {
20
- precision: 2,
21
- hideDecimalForWholeNumbers: false
22
- });
23
- };
24
17
  var Weighing = function Weighing(props) {
25
- var dataSource = props.dataSource,
26
- symbol = props.symbol;
18
+ var dataSource = props.dataSource;
27
19
  if (!dataSource) {
28
20
  return null;
29
21
  }
30
22
  var weight = dataSource.weight,
31
23
  tare = dataSource.tare,
32
24
  net_weight = dataSource.net_weight,
33
- unit_price = dataSource.unit_price,
34
25
  _dataSource$unit = dataSource.unit,
35
26
  unit = _dataSource$unit === void 0 ? 'KILOGRAMS' : _dataSource$unit;
36
- var unitLabel = UNIT_LABEL_MAP[unit];
37
- var tareLabel = locales.getText('pisell2.cart.sku-card.weighing.tare');
38
- var netLabel = locales.getText('pisell2.cart.sku-card.weighing.net');
39
- var unitPriceText = formatUnitPrice(unit_price, symbol);
27
+ var tareValue = Number((tare === null || tare === void 0 ? void 0 : tare.value) || 0);
28
+ var tareLabel = (tare === null || tare === void 0 ? void 0 : tare.label) || locales.getText('pisell2.cart.sku-card.weighing.tare');
40
29
  return /*#__PURE__*/React.createElement("div", {
41
30
  className: "".concat(PREFIX, "__weighing")
42
31
  }, /*#__PURE__*/React.createElement("div", {
43
32
  className: "".concat(PREFIX, "__weighing-row")
44
- }, /*#__PURE__*/React.createElement("span", null, locales.getText('pisell2.cart.sku-card.weighing.gross'), ":"), /*#__PURE__*/React.createElement("span", null, formatWeight(weight, unit))), /*#__PURE__*/React.createElement("div", {
33
+ }, /*#__PURE__*/React.createElement("span", null, locales.getText('pisell2.cart.sku-card.weighing.gross'), ":"), /*#__PURE__*/React.createElement("span", null, formatWeight(weight, unit))), tareValue > 0 ? /*#__PURE__*/React.createElement("div", {
45
34
  className: "".concat(PREFIX, "__weighing-row")
46
- }, /*#__PURE__*/React.createElement("span", null, tareLabel, ":"), /*#__PURE__*/React.createElement("span", null, formatWeight(tare === null || tare === void 0 ? void 0 : tare.value, (tare === null || tare === void 0 ? void 0 : tare.unit) || unit))), /*#__PURE__*/React.createElement("div", {
35
+ }, /*#__PURE__*/React.createElement("span", null, tareLabel, ":"), /*#__PURE__*/React.createElement("span", null, "-", formatWeight(tareValue, (tare === null || tare === void 0 ? void 0 : tare.unit) || unit))) : null, /*#__PURE__*/React.createElement("div", {
47
36
  className: "".concat(PREFIX, "__weighing-row")
48
- }, /*#__PURE__*/React.createElement("span", null, formatWeight(net_weight, unit), " ", netLabel, " @ ", unitPriceText, "/", unitLabel)));
37
+ }, /*#__PURE__*/React.createElement("span", null, locales.getText('pisell2.cart.sku-card.weighing.net'), ":"), /*#__PURE__*/React.createElement("span", null, formatWeight(net_weight, unit))));
49
38
  };
50
39
  export 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;
@@ -1,4 +1,4 @@
1
- var _excluded = ["dataSource", "isShowImage", "isShowOriginalPrice", "isShowHolder", "isShowNote", "isShowDelete", "isShowAmountFooter", "isShowPackageNote", "isShowEditProduct", "disabledClick", "disabledEditClick", "onEditProduct", "onAction", "onDelete", "onNote", "onLike", "onCard", "onChangeResource", "onPromotion", "onGift", "onChangeHolder", "type", "rightActions", "escapeDom", "maxSpecsCount"];
1
+ var _excluded = ["dataSource", "isShowImage", "isShowOriginalPrice", "isShowHolder", "isShowNote", "isShowDelete", "isShowAmountFooter", "isShowPackageNote", "isShowEditProduct", "disabledClick", "disabledEditClick", "onEditProduct", "onAction", "onDelete", "onNote", "onLike", "onCard", "onChangeResource", "onPromotion", "onGift", "onChangeHolder", "itemType", "type", "rightActions", "escapeDom", "maxSpecsCount", "isShowRelatedProduct"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
4
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -24,6 +24,7 @@ import AmountFooter from "./components/AmountFooter";
24
24
  import Items from "./components/MultiDay";
25
25
  import Promotion from "./components/Promotion";
26
26
  import Gift from "./components/Gift";
27
+ import BookingItem from "./components/BookingItem";
27
28
  import "./index.less";
28
29
  import Iconfont from "../../iconfont";
29
30
  import useEngineContext from "../../../hooks/useEngineContext";
@@ -64,12 +65,16 @@ var CartSkuCard = function CartSkuCard(props) {
64
65
  onPromotion = props.onPromotion,
65
66
  onGift = props.onGift,
66
67
  onChangeHolder = props.onChangeHolder,
68
+ _props$itemType = props.itemType,
69
+ itemType = _props$itemType === void 0 ? 'product' : _props$itemType,
67
70
  type = props.type,
68
71
  _props$rightActions = props.rightActions,
69
72
  rightActions = _props$rightActions === void 0 ? [] : _props$rightActions,
70
73
  escapeDom = props.escapeDom,
71
74
  _props$maxSpecsCount = props.maxSpecsCount,
72
75
  maxSpecsCount = _props$maxSpecsCount === void 0 ? 1 : _props$maxSpecsCount,
76
+ _props$isShowRelatedP = props.isShowRelatedProduct,
77
+ isShowRelatedProduct = _props$isShowRelatedP === void 0 ? true : _props$isShowRelatedP,
73
78
  other = _objectWithoutProperties(props, _excluded);
74
79
  var useOpenNoteRef = useRef();
75
80
  var context = useEngineContext();
@@ -89,13 +94,15 @@ var CartSkuCard = function CartSkuCard(props) {
89
94
  cursor: 'pointer',
90
95
  padding: '10px 0px'
91
96
  }
92
- }, /*#__PURE__*/React.createElement(Iconfont, {
93
- type: "pisell2-trash-01",
97
+ }, /*#__PURE__*/React.createElement("span", {
94
98
  style: {
95
99
  fontSize: 20,
96
- marginRight: 4
100
+ marginRight: 4,
101
+ lineHeight: 1
97
102
  }
98
- }), /*#__PURE__*/React.createElement("span", {
103
+ }, /*#__PURE__*/React.createElement(Iconfont, {
104
+ type: "pisell2-trash-01"
105
+ })), /*#__PURE__*/React.createElement("span", {
99
106
  style: {
100
107
  fontSize: 12,
101
108
  fontWeight: 500
@@ -171,11 +178,11 @@ var CartSkuCard = function CartSkuCard(props) {
171
178
  isShowEditProduct: isShowEditProduct,
172
179
  disabledEditClick: disabledEditClick,
173
180
  onEditProduct: onEditProduct
174
- }), /*#__PURE__*/React.createElement(TimeRange, {
181
+ }), itemType !== 'booking' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TimeRange, {
175
182
  dataSource: dataSource
176
183
  }), /*#__PURE__*/React.createElement(Resources, {
177
184
  dataSource: dataSource
178
- }), /*#__PURE__*/React.createElement(Packages, {
185
+ })) : null, /*#__PURE__*/React.createElement(Packages, {
179
186
  dataSource: dataSource,
180
187
  isShowImage: isShowImage
181
188
  }), /*#__PURE__*/React.createElement(Sales, {
@@ -251,6 +258,7 @@ var CartSkuCard = function CartSkuCard(props) {
251
258
  return renderA2();
252
259
  };
253
260
  if (dataSource !== null && dataSource !== void 0 && dataSource.isGift) return null;
261
+ var content = renderContent();
254
262
  return /*#__PURE__*/React.createElement("div", {
255
263
  className: "".concat(PREFIX, "-wrapper-container")
256
264
  }, /*#__PURE__*/React.createElement(SwipeAction, {
@@ -266,7 +274,11 @@ var CartSkuCard = function CartSkuCard(props) {
266
274
  e.stopPropagation();
267
275
  onCard === null || onCard === void 0 || onCard(dataSource);
268
276
  }
269
- }, renderContent())), /*#__PURE__*/React.createElement(Gift, _extends({}, (dataSource === null || dataSource === void 0 ? void 0 : dataSource.giftData) || {}, {
277
+ }, itemType === 'booking' ? /*#__PURE__*/React.createElement(BookingItem, {
278
+ dataSource: dataSource,
279
+ isShowRelatedProduct: isShowRelatedProduct,
280
+ isShowDelete: isShowDelete
281
+ }, content) : content)), /*#__PURE__*/React.createElement(Gift, _extends({}, (dataSource === null || dataSource === void 0 ? void 0 : dataSource.giftData) || {}, {
270
282
  onClick: function onClick() {
271
283
  return onGift === null || onGift === void 0 ? void 0 : onGift(dataSource);
272
284
  }
@@ -22,6 +22,8 @@ import Promotion from "../cartSkuCard/components/Promotion";
22
22
  import Gift from "../cartSkuCard/components/Gift";
23
23
  import { SwipeAction } from "../cartSkuCard/components/swipeAction";
24
24
  import Action from "../components/Action";
25
+ import TimeRange from "./components/TimeRange";
26
+ import Resources from "./components/Resources";
25
27
  import Iconfont from "../../iconfont";
26
28
  import useEngineContext from "../../../hooks/useEngineContext";
27
29
  var PREFIX = 'pisell-line-item';
@@ -200,23 +202,11 @@ var BookingLineItem = function BookingLineItem(props) {
200
202
  type: "pisell2-trash-01"
201
203
  })) : null))), /*#__PURE__*/React.createElement("div", {
202
204
  className: "".concat(PREFIX, "__booking-detail")
203
- }, /*#__PURE__*/React.createElement("div", {
204
- className: "".concat(PREFIX, "__booking-field")
205
- }, /*#__PURE__*/React.createElement("div", {
206
- className: "".concat(PREFIX, "__booking-field-label")
207
- }, /*#__PURE__*/React.createElement(Iconfont, {
208
- type: "pisell2-marker-pin-01"
209
- }), /*#__PURE__*/React.createElement("span", null, locales.getText('pisell2.line-item.resource'))), /*#__PURE__*/React.createElement("div", {
210
- className: "".concat(PREFIX, "__booking-field-value")
211
- }, resourceName)), /*#__PURE__*/React.createElement("div", {
212
- className: "".concat(PREFIX, "__booking-field")
213
- }, /*#__PURE__*/React.createElement("div", {
214
- className: "".concat(PREFIX, "__booking-field-label")
215
- }, /*#__PURE__*/React.createElement(Iconfont, {
216
- type: "pisell2-clock"
217
- }), /*#__PURE__*/React.createElement("span", null, locales.getText('pisell2.line-item.time'))), /*#__PURE__*/React.createElement("div", {
218
- className: "".concat(PREFIX, "__booking-field-value")
219
- }, bookingTime || '-'))), isShowRelatedProduct && relatedProductDataSource ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, {
205
+ }, /*#__PURE__*/React.createElement(TimeRange, {
206
+ dataSource: dataSource
207
+ }), /*#__PURE__*/React.createElement(Resources, {
208
+ dataSource: dataSource
209
+ })), isShowRelatedProduct && relatedProductDataSource ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, {
220
210
  style: {
221
211
  margin: 0
222
212
  }
@@ -0,0 +1,6 @@
1
+ import '../../../cartSkuCard/components/resources/index.less';
2
+ interface LineItemResourcesProps {
3
+ dataSource?: any;
4
+ }
5
+ declare const LineItemResources: (props: LineItemResourcesProps) => JSX.Element | null;
6
+ export default LineItemResources;
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import { Tag } from 'antd';
3
+ import "../../../cartSkuCard/components/resources/index.less";
4
+ var PREFIX = 'pisell-cart-sku-card';
5
+ var ResourceTag = Tag;
6
+ var colors = ['magenta', 'volcano', 'orange', 'gold', 'green', 'cyan', 'blue', 'geekblue', 'purple'];
7
+ function getColor(n) {
8
+ return colors[n * 31 % colors.length];
9
+ }
10
+ var getResourceLabel = function getResourceLabel(resource, fallbackLabel) {
11
+ var _resource$metadata, _resource$metadata2;
12
+ return (resource === null || resource === void 0 || (_resource$metadata = resource.metadata) === null || _resource$metadata === void 0 ? void 0 : _resource$metadata.resource_name) || (resource === null || resource === void 0 || (_resource$metadata2 = resource.metadata) === null || _resource$metadata2 === void 0 ? void 0 : _resource$metadata2.form_name) || fallbackLabel || '';
13
+ };
14
+ var LineItemResources = function LineItemResources(props) {
15
+ var _props$dataSource = props.dataSource,
16
+ dataSource = _props$dataSource === void 0 ? {} : _props$dataSource;
17
+ var resources = Array.isArray(dataSource === null || dataSource === void 0 ? void 0 : dataSource.resources) ? dataSource.resources : [];
18
+ var fallbackResourceLabel = resources.length === 1 ? dataSource === null || dataSource === void 0 ? void 0 : dataSource.relation_form_name : '';
19
+ var resourceLabels = Array.isArray(dataSource === null || dataSource === void 0 ? void 0 : dataSource.resources) ? resources.map(function (resource, index) {
20
+ return {
21
+ id: Number(resource === null || resource === void 0 ? void 0 : resource.form_id) || Number(resource === null || resource === void 0 ? void 0 : resource.relation_id) || index + 1,
22
+ label: getResourceLabel(resource, fallbackResourceLabel)
23
+ };
24
+ }) : [];
25
+ if (!resourceLabels.length && dataSource !== null && dataSource !== void 0 && dataSource.relation_form_name) {
26
+ resourceLabels.push({
27
+ id: 1,
28
+ label: dataSource.relation_form_name
29
+ });
30
+ }
31
+ if (!resourceLabels.length) return null;
32
+ return /*#__PURE__*/React.createElement("div", {
33
+ className: "".concat(PREFIX, "__resources")
34
+ }, resourceLabels.map(function (resource) {
35
+ return /*#__PURE__*/React.createElement(ResourceTag, {
36
+ key: "".concat(resource.id, "-").concat(resource.label),
37
+ color: getColor(resource.id),
38
+ className: "resource-tag"
39
+ }, resource.label);
40
+ }));
41
+ };
42
+ export 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,66 @@
1
+ import React, { useMemo } from 'react';
2
+ import dayjs from 'dayjs';
3
+ import 'dayjs/locale/zh-cn';
4
+ import 'dayjs/locale/en';
5
+ import 'dayjs/locale/zh-tw';
6
+ import 'dayjs/locale/ja';
7
+ import 'dayjs/locale/pt';
8
+ import { locales } from '@pisell/utils';
9
+ import Iconfont from "../../../../iconfont";
10
+ import useEngineContext from "../../../../../hooks/useEngineContext";
11
+ import "../../../cartSkuCard/components/timeRange/index.less";
12
+ var localeTypes = {
13
+ 'en-US': 'en',
14
+ 'zh-CN': 'zh-cn',
15
+ 'zh-HK': 'zh-tw',
16
+ ja: 'ja',
17
+ pt: 'pt'
18
+ };
19
+ var PREFIX = 'pisell-cart-sku-card';
20
+ var formatMultiDayDate = function formatMultiDayDate(start, end, isEn) {
21
+ var format = isEn ? 'ddd, DD/MM/YYYY' : 'YYYY-MM-DD,ddd';
22
+ return "".concat(start.format(format), " ~ ").concat(end.format(format));
23
+ };
24
+ var formatBookingTime = function formatBookingTime(booking, locale) {
25
+ var start = dayjs(booking !== null && booking !== void 0 && booking.start_time ? "".concat((booking === null || booking === void 0 ? void 0 : booking.start_date) || '', " ").concat(booking.start_time) : booking === null || booking === void 0 ? void 0 : booking.start_date);
26
+ var end = dayjs(booking !== null && booking !== void 0 && booking.end_time ? "".concat((booking === null || booking === void 0 ? void 0 : booking.end_date) || '', " ").concat(booking.end_time) : booking === null || booking === void 0 ? void 0 : booking.end_date);
27
+ if (!start.isValid() || !end.isValid()) return '';
28
+ var isEn = locale === 'en-US' || locale === 'en';
29
+ var durationType = (booking === null || booking === void 0 ? void 0 : booking.sub_type) || (booking === null || booking === void 0 ? void 0 : booking.duration_type);
30
+ var startTime = (booking === null || booking === void 0 ? void 0 : booking.start_time) || start.format('HH:mm');
31
+ var endTime = (booking === null || booking === void 0 ? void 0 : booking.end_time) || end.format('HH:mm');
32
+ if (durationType === 'days' && !start.isSame(end, 'day')) {
33
+ var _duration = end.diff(start, 'day');
34
+ return "".concat(formatMultiDayDate(start, end, isEn), " (").concat(_duration).concat(locales.getText('pisell2.product.card.day')(_duration), ")");
35
+ }
36
+ var dateFormat = isEn ? 'DD/MM/YYYY' : 'YYYY-MM-DD';
37
+ var dateTime = start.isSame(end, 'day') ? isEn ? "".concat(startTime, " ~ ").concat(endTime, " ").concat(start.format(dateFormat)) : "".concat(start.format(dateFormat), " ").concat(startTime, " ~ ").concat(endTime) : isEn ? "".concat(startTime, " ").concat(start.format(dateFormat), " ~ ").concat(endTime, " ").concat(end.format(dateFormat)) : "".concat(start.format(dateFormat), " ").concat(startTime, " ~ ").concat(end.format(dateFormat), " ").concat(endTime);
38
+ if (!durationType) return dateTime;
39
+ if (durationType === 'minutes' || durationType === 'flexible') {
40
+ var _duration2 = end.diff(start, 'minute');
41
+ var hours = Math.floor(_duration2 / 60);
42
+ var minutes = _duration2 % 60;
43
+ return "".concat(dateTime, " (").concat(locales.getText('pisell2.product.card.hour.minute')(hours, minutes), ")");
44
+ }
45
+ var duration = end.diff(start, durationType);
46
+ return "".concat(dateTime, " (").concat(duration, ")");
47
+ };
48
+ var LineItemTimeRange = function LineItemTimeRange(props) {
49
+ var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4;
50
+ var _props$dataSource = props.dataSource,
51
+ dataSource = _props$dataSource === void 0 ? {} : _props$dataSource;
52
+ var context = useEngineContext();
53
+ var 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')) || (dataSource === null || dataSource === void 0 ? void 0 : dataSource.locale) || 'en-US';
54
+ var serviceTime = useMemo(function () {
55
+ dayjs.locale(localeTypes[locale]);
56
+ return formatBookingTime(dataSource, locale);
57
+ }, [dataSource, locale]);
58
+ if (!serviceTime) return null;
59
+ return /*#__PURE__*/React.createElement("div", {
60
+ className: "".concat(PREFIX, "__time-range")
61
+ }, /*#__PURE__*/React.createElement(Iconfont, {
62
+ className: "time-icon",
63
+ type: "pisell2-clock"
64
+ }), serviceTime);
65
+ };
66
+ export default LineItemTimeRange;
@@ -18,10 +18,10 @@
18
18
  &__delete-btn {
19
19
  width: 34px;
20
20
  height: 34px;
21
- border: 1px solid rgba(255, 255, 255, 0.35);
21
+ border: 1px solid var(--Gray-300, #d0d5dd);
22
22
  border-radius: 8px;
23
- background: rgba(255, 255, 255, 0.12);
24
- color: #fff;
23
+ background: var(--Gray-100, #f2f4f7);
24
+ color: var(--Gray-500, #667085);
25
25
  cursor: pointer;
26
26
  padding: 0;
27
27
  display: inline-flex;
@@ -87,10 +87,10 @@
87
87
  }
88
88
 
89
89
  &__status {
90
- border: 1px solid #0f1d40;
90
+ border: 1px solid rgba(16, 24, 40, 0.12);
91
91
  border-radius: 8px;
92
- background: #0f1d40;
93
- color: #fff;
92
+ background: rgba(255, 255, 255, 0.72);
93
+ color: #101828;
94
94
  display: inline-flex;
95
95
  align-items: center;
96
96
  justify-content: center;
@@ -103,13 +103,25 @@
103
103
  line-height: 20px;
104
104
  cursor: pointer;
105
105
  flex-shrink: 0;
106
+ box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
106
107
 
107
108
  .pisell-lowcodeicon-down,
108
109
  .anticon {
109
110
  font-size: 12px;
110
111
  }
111
112
 
113
+ &:hover,
114
+ &:focus,
115
+ &:active {
116
+ border-color: rgba(16, 24, 40, 0.18);
117
+ background: rgba(255, 255, 255, 0.86);
118
+ color: #101828;
119
+ }
120
+
112
121
  &:disabled {
122
+ border-color: rgba(16, 24, 40, 0.12);
123
+ background: rgba(255, 255, 255, 0.72);
124
+ color: #101828;
113
125
  cursor: default;
114
126
  }
115
127
  }
@@ -130,11 +142,10 @@
130
142
  }
131
143
 
132
144
  &__booking-detail {
133
- display: grid;
134
- grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
135
- gap: 12px 24px;
145
+ display: flex;
146
+ flex-direction: column;
147
+ gap: 4px;
136
148
  padding: 8px;
137
- background: #fff;
138
149
  }
139
150
 
140
151
  &__booking-field {