@pisell/materials 2.2.39 → 2.2.40

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 (73) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +142 -142
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +24 -24
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +14 -14
  11. package/dist/umd/materials.min.css +1 -0
  12. package/dist/umd/materials.min.js +1 -0
  13. package/dist/umd/static/DotsSix.57d66266.svg +1 -0
  14. package/dist/umd/static/arrow-left.e542294f.svg +1 -0
  15. package/dist/umd/static/arrow-right.763f03e0.svg +1 -0
  16. package/dist/umd/static/filter-lines.04a54ae9.svg +1 -0
  17. package/dist/umd/static/help-circle.31c9be40.svg +1 -0
  18. package/dist/umd/static/switch-vertical-01.7ebe3ba8.svg +1 -0
  19. package/es/components/collapse/index.js +27 -4
  20. package/es/components/productCard/components/Action/index.js +1 -1
  21. package/es/components/productCard/components/AmountFooter/index.d.ts +1 -1
  22. package/es/components/productCard/components/AmountFooter/index.js +30 -10
  23. package/es/components/productCard/components/AmountFooter/index.less +11 -0
  24. package/es/components/productCard/components/Header/index.js +22 -14
  25. package/es/components/productCard/components/MultiDay/index.d.ts +4 -0
  26. package/es/components/productCard/components/MultiDay/index.js +79 -0
  27. package/es/components/productCard/components/MultiDay/index.less +34 -0
  28. package/es/components/productCard/components/MultiDay/utils.d.ts +14 -0
  29. package/es/components/productCard/components/MultiDay/utils.js +54 -0
  30. package/es/components/productCard/components/Packages/components/collapsibleList/utils.js +11 -5
  31. package/es/components/productCard/components/Packages/components/options/index.js +2 -2
  32. package/es/components/productCard/components/Packages/index.js +1 -2
  33. package/es/components/productCard/components/Sales/index.js +2 -2
  34. package/es/components/productCard/components/Time/index.js +15 -13
  35. package/es/components/productCard/index.d.ts +1 -1
  36. package/es/components/productCard/index.js +34 -20
  37. package/es/components/productCard/index.less +3 -2
  38. package/es/components/productCard/status.d.ts +24 -1
  39. package/es/components/productCard/status.js +52 -2
  40. package/es/components/productCard/types.d.ts +60 -1
  41. package/es/components/productCard/utils.d.ts +10 -144
  42. package/es/components/productCard/utils.js +36 -673
  43. package/es/components/table/Table/utils.d.ts +1 -1
  44. package/lib/components/collapse/index.js +30 -4
  45. package/lib/components/productCard/components/Action/index.js +1 -1
  46. package/lib/components/productCard/components/AmountFooter/index.d.ts +1 -1
  47. package/lib/components/productCard/components/AmountFooter/index.js +33 -9
  48. package/lib/components/productCard/components/AmountFooter/index.less +11 -0
  49. package/lib/components/productCard/components/Header/index.js +16 -8
  50. package/lib/components/productCard/components/MultiDay/index.d.ts +4 -0
  51. package/lib/components/productCard/components/MultiDay/index.js +72 -0
  52. package/lib/components/productCard/components/MultiDay/index.less +34 -0
  53. package/lib/components/productCard/components/MultiDay/utils.d.ts +14 -0
  54. package/lib/components/productCard/components/MultiDay/utils.js +77 -0
  55. package/lib/components/productCard/components/Packages/components/collapsibleList/utils.js +2 -1
  56. package/lib/components/productCard/components/Packages/components/options/index.js +2 -2
  57. package/lib/components/productCard/components/Packages/index.js +1 -1
  58. package/lib/components/productCard/components/Sales/index.js +1 -2
  59. package/lib/components/productCard/components/Time/index.js +14 -11
  60. package/lib/components/productCard/index.d.ts +1 -1
  61. package/lib/components/productCard/index.js +32 -20
  62. package/lib/components/productCard/index.less +3 -2
  63. package/lib/components/productCard/status.d.ts +24 -1
  64. package/lib/components/productCard/status.js +35 -2
  65. package/lib/components/productCard/types.d.ts +60 -1
  66. package/lib/components/productCard/utils.d.ts +10 -144
  67. package/lib/components/productCard/utils.js +30 -567
  68. package/lib/components/table/Table/utils.d.ts +1 -1
  69. package/package.json +1 -1
  70. package/es/components/table/Actions/component/ExportImport/utils/index.d.ts +0 -9
  71. package/es/components/table/Actions/component/ExportImport/utils/index.js +0 -11
  72. package/lib/components/table/Actions/component/ExportImport/utils/index.d.ts +0 -9
  73. package/lib/components/table/Actions/component/ExportImport/utils/index.js +0 -31
@@ -0,0 +1 @@
1
+ <svg width="24" height="24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M8 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM8 6a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM8 20a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM16 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM16 6a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM16 20a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>
@@ -0,0 +1 @@
1
+ <svg width="24" height="24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.707 4.293a1 1 0 0 1 0 1.414L7.414 11H19a1 1 0 1 1 0 2H7.414l5.293 5.293a1 1 0 0 1-1.414 1.414l-7-7a1 1 0 0 1 0-1.414l7-7a1 1 0 0 1 1.414 0Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg width="24" height="24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M11.293 4.293a1 1 0 0 1 1.414 0l7 7a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414-1.414L16.586 13H5a1 1 0 1 1 0-2h11.586l-5.293-5.293a1 1 0 0 1 0-1.414Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg width="24" height="24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M2 6a1 1 0 0 1 1-1h18a1 1 0 1 1 0 2H3a1 1 0 0 1-1-1Zm3 6a1 1 0 0 1 1-1h12a1 1 0 1 1 0 2H6a1 1 0 0 1-1-1Zm3 6a1 1 0 0 1 1-1h6a1 1 0 1 1 0 2H9a1 1 0 0 1-1-1Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg width="24" height="24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18ZM1 12C1 5.925 5.925 1 12 1s11 4.925 11 11-4.925 11-11 11S1 18.075 1 12Zm11.258-3.976a2 2 0 0 0-2.225 1.308 1 1 0 1 1-1.886-.664 4 4 0 0 1 7.773 1.333c0 1.53-1.135 2.54-1.945 3.081a8.044 8.044 0 0 1-1.686.848l-.035.013-.011.003-.004.002h-.002L11.92 13l.316.949a1 1 0 0 1-.633-1.897l.016-.006.074-.027a6.051 6.051 0 0 0 1.172-.6c.69-.46 1.055-.95 1.055-1.419v-.001a2 2 0 0 0-1.662-1.975ZM11 17a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2H12a1 1 0 0 1-1-1Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg width="24" height="24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M6.293 3.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1-1.414 1.414L8 6.414V20a1 1 0 1 1-2 0V6.414L3.707 8.707a1 1 0 0 1-1.414-1.414l4-4ZM16 17.586V4a1 1 0 1 1 2 0v13.586l2.293-2.293a1 1 0 0 1 1.414 1.414l-4 4a1 1 0 0 1-1.414 0l-4-4a1 1 0 0 1 1.414-1.414L16 17.586Z"/></svg>
@@ -1,5 +1,6 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
2
  var _excluded = ["panelBackground", "panelMarginBottom", "panelBorderRadius", "items", "showHeader", "headerColor", "headerFontSize", "expandIcon"];
3
+ var _templateObject;
3
4
  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
5
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -8,9 +9,26 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
8
9
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
9
10
  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; }
10
11
  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; }
12
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
11
13
  import React, { useMemo } from 'react';
12
14
  import { Collapse as OriginalCollapse } from 'antd';
15
+ import styled from 'styled-components';
13
16
  import "./index.less";
17
+ var CustomCollapse = styled(OriginalCollapse)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.custom-collapse {\n background-color: ", ";\n }\n\n // .ant-collapse-item {\n // background-color: ", ";\n // margin-bottom: ", ";\n // border-radius: ", ";\n // }\n\n // .pisell-lowcode-collapse-header {\n // background-color: ", ";\n // border-radius: ", " !important;\n // }\n\n .pisell-lowcode-collapse-content {\n background-color: ", ";\n }\n"])), function (props) {
18
+ return props.panelBackground || '#ffffff';
19
+ }, function (props) {
20
+ return props.panelBackground || '#ffffff';
21
+ }, function (props) {
22
+ return props.panelMarginBottom || '0';
23
+ }, function (props) {
24
+ return props.panelBorderRadius || '0';
25
+ }, function (props) {
26
+ return props.panelBackground || '#ffffff';
27
+ }, function (props) {
28
+ return props.panelBorderRadius || '0';
29
+ }, function (props) {
30
+ return props.panelBackground || '#ffffff';
31
+ });
14
32
  var Collapse = function Collapse(props) {
15
33
  var panelBackground = props.panelBackground,
16
34
  panelMarginBottom = props.panelMarginBottom,
@@ -65,15 +83,20 @@ var Collapse = function Collapse(props) {
65
83
  fontSize: headerFontSize
66
84
  }
67
85
  }, item === null || item === void 0 ? void 0 : item.label) : null,
68
- style: panelStyle
86
+ children: item.children,
87
+ className: 'custom-collapse-panel'
69
88
  });
70
89
  });
71
- }, [items, headerColor, showHeader, headerFontSize, panelStyle]);
72
- return /*#__PURE__*/React.createElement(OriginalCollapse, _extends({}, rest, {
90
+ }, [items, headerColor, showHeader, headerFontSize]);
91
+ return /*#__PURE__*/React.createElement(CustomCollapse, _extends({}, rest, {
73
92
  expandIcon: expandIcon ? function () {
74
93
  return expandIcon;
75
94
  } : undefined,
76
- items: itemsMap
95
+ items: itemsMap,
96
+ className: "custom-collapse",
97
+ panelBackground: panelBackground,
98
+ panelMarginBottom: panelMarginBottom,
99
+ panelBorderRadius: panelBorderRadius
77
100
  }));
78
101
  };
79
102
  Collapse.Panel = OriginalCollapse.Panel;
@@ -16,6 +16,6 @@ var Action = function Action(_ref) {
16
16
  e.stopPropagation();
17
17
  onAction();
18
18
  }
19
- }, item._actionText));
19
+ }, item.actionText));
20
20
  };
21
21
  export default Action;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import './index.less';
3
- declare const Footer: ({ item, hideDivider, type }: any) => React.JSX.Element;
3
+ declare const Footer: ({ item, hideDivider, type, isOnlyTotal }: any) => React.JSX.Element;
4
4
  export default Footer;
@@ -1,15 +1,23 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import classNames from 'classnames';
3
+ import { Tooltip } from 'antd';
4
+ import { QuestionCircleOutlined } from '@ant-design/icons';
3
5
  import { _formatAmount } from "../Packages/utils";
4
6
  import Divider from "../Divider";
5
7
  import "./index.less";
6
8
  import { locales } from '@pisell/utils';
7
9
  var prefix = 'pisell-lowcode-';
8
10
  var Footer = function Footer(_ref) {
9
- var _item$_extend, _item$_extend2;
10
11
  var item = _ref.item,
11
12
  hideDivider = _ref.hideDivider,
12
- type = _ref.type;
13
+ type = _ref.type,
14
+ isOnlyTotal = _ref.isOnlyTotal;
15
+ var total = item.total,
16
+ origin_total = item.origin_total,
17
+ symbol = item.symbol,
18
+ tip = item.tip,
19
+ num = item.num,
20
+ discount_reason = item.discount_reason;
13
21
  /**
14
22
  * @title: 折扣
15
23
  * @description:
@@ -20,19 +28,31 @@ var Footer = function Footer(_ref) {
20
28
  */
21
29
  var isDiscount = useMemo(function () {
22
30
  // item中没有该属性则不展示
23
- if (!(item !== null && item !== void 0 && item.hasOwnProperty('origin_total'))) return false;
24
- return Number(item === null || item === void 0 ? void 0 : item.total) != Number(item === null || item === void 0 ? void 0 : item.origin_total);
25
- }, [item]);
31
+ if (!origin_total) return false;
32
+ return Number(total) != Number(origin_total);
33
+ }, [total, origin_total]);
26
34
  return /*#__PURE__*/React.createElement(React.Fragment, null, !hideDivider ? /*#__PURE__*/React.createElement(Divider, {
27
35
  type: type !== 'total' ? 'inside' : ''
28
36
  }) : null, /*#__PURE__*/React.createElement("div", {
29
- className: classNames("".concat(prefix, "packages-product-footer"), hideDivider && "".concat(prefix, "packages-product-hide-divider-footer"))
30
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, _formatAmount(item === null || item === void 0 ? void 0 : item.total, item === null || item === void 0 ? void 0 : item.symbol)), /*#__PURE__*/React.createElement("span", null, "\xD7".concat(item === null || item === void 0 ? void 0 : item.num)), /*#__PURE__*/React.createElement("span", {
37
+ className: classNames("".concat(prefix, "packages-product-footer"), hideDivider && "".concat(prefix, "packages-product-hide-divider-footer"), isOnlyTotal && "".concat(prefix, "packages-product-only-total-footer"))
38
+ }, /*#__PURE__*/React.createElement("div", {
39
+ className: classNames("".concat(prefix, "packages-product-footer-price-wrap"))
40
+ }, !isOnlyTotal ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
41
+ className: classNames("".concat(prefix, "packages-product-footer-price"))
42
+ }, /*#__PURE__*/React.createElement("span", null, _formatAmount(total, symbol)), tip ? /*#__PURE__*/React.createElement(Tooltip, {
43
+ title: locales.getText(tip),
44
+ destroyTooltipOnHide: true
45
+ }, /*#__PURE__*/React.createElement(QuestionCircleOutlined, {
46
+ style: {
47
+ fontSize: '16px',
48
+ color: '#1570ef'
49
+ }
50
+ })) : null), /*#__PURE__*/React.createElement("span", null, "\xD7".concat(num))) : null, /*#__PURE__*/React.createElement("span", {
31
51
  className: "".concat(prefix, "packages-product-footer-total")
32
- }, _formatAmount((item === null || item === void 0 ? void 0 : item.total) * (item === null || item === void 0 ? void 0 : item.num), item === null || item === void 0 ? void 0 : item.symbol))), isDiscount ? /*#__PURE__*/React.createElement("div", {
52
+ }, _formatAmount(total * num, symbol))), isDiscount ? /*#__PURE__*/React.createElement("div", {
33
53
  className: "".concat(prefix, "packages-product-footer-discount")
34
- }, /*#__PURE__*/React.createElement("span", null, _formatAmount(item === null || item === void 0 ? void 0 : item.origin_total, item === null || item === void 0 ? void 0 : item.symbol)), /*#__PURE__*/React.createElement("span", null, _formatAmount((item === null || item === void 0 ? void 0 : item.origin_total) * (item === null || item === void 0 ? void 0 : item.num), item === null || item === void 0 ? void 0 : item.symbol, 2))) : null), isDiscount && (_item$_extend = item._extend) !== null && _item$_extend !== void 0 && _item$_extend.discount_reason && type === 'total' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement("div", {
54
+ }, !isOnlyTotal ? /*#__PURE__*/React.createElement("span", null, _formatAmount(origin_total, symbol)) : null, /*#__PURE__*/React.createElement("span", null, _formatAmount(origin_total * num, symbol, 2))) : null), isDiscount && discount_reason && type === 'total' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement("div", {
35
55
  className: "".concat(prefix, "product-item-discount-reason")
36
- }, /*#__PURE__*/React.createElement("span", null, "".concat(locales.getText('pisell2.product.card.discount.reason'), ": ").concat((_item$_extend2 = item._extend) === null || _item$_extend2 === void 0 ? void 0 : _item$_extend2.discount_reason)))) : null);
56
+ }, /*#__PURE__*/React.createElement("span", null, "".concat(locales.getText('pisell2.product.card.discount.reason'), ": ").concat(discount_reason)))) : null);
37
57
  };
38
58
  export default Footer;
@@ -12,6 +12,17 @@
12
12
  justify-content: space-between;
13
13
  }
14
14
  }
15
+ &-packages-product-only-total-footer {
16
+ > div {
17
+ justify-content: end !important;
18
+ }
19
+ }
20
+
21
+ &-packages-product-footer-price {
22
+ display: flex;
23
+ align-items: center;
24
+ gap: 4px;
25
+ }
15
26
 
16
27
  &-packages-product-footer-discount {
17
28
  font-size: 12px;
@@ -2,7 +2,7 @@ import { Button } from 'antd';
2
2
  import React, { useMemo } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import Iconfont from "../../../iconfont";
5
- import { image, formatAmount } from '@pisell/utils';
5
+ import { image as imageAli, formatAmount } from '@pisell/utils';
6
6
  import Options from "../Packages/components/options";
7
7
  import "./index.less";
8
8
  var prefix = 'pisell-lowcode-';
@@ -12,6 +12,14 @@ var Header = function Header(props) {
12
12
  showImage = props.showImage,
13
13
  onDelete = props.onDelete,
14
14
  disabledEdit = props.disabledEdit;
15
+ var id = item.id,
16
+ options = item.options,
17
+ bundle = item.bundle,
18
+ product_option_string = item.product_option_string,
19
+ image = item.image,
20
+ name = item.name,
21
+ price = item.price,
22
+ symbol = item.symbol;
15
23
 
16
24
  /**
17
25
  * @title: 是否显示价格
@@ -22,9 +30,10 @@ var Header = function Header(props) {
22
30
  * @Date: 2024-11-23 16:13
23
31
  */
24
32
  var showPrice = useMemo(function () {
25
- var _item$bundle, _item$options;
26
- return (item === null || item === void 0 ? void 0 : (_item$bundle = item.bundle) === null || _item$bundle === void 0 ? void 0 : _item$bundle.length) > 0 || (item === null || item === void 0 ? void 0 : (_item$options = item.options) === null || _item$options === void 0 ? void 0 : _item$options.length) > 0;
27
- }, [item === null || item === void 0 ? void 0 : item.bundle, item === null || item === void 0 ? void 0 : item.options]);
33
+ // 如果有报价单则不需要显示价格
34
+
35
+ return (bundle === null || bundle === void 0 ? void 0 : bundle.length) > 0 || (options === null || options === void 0 ? void 0 : options.length) > 0;
36
+ }, [bundle, options]);
28
37
 
29
38
  /**
30
39
  * @title: 样式是否居中
@@ -35,9 +44,8 @@ var Header = function Header(props) {
35
44
  * @Date: 2024-11-23 17:37
36
45
  */
37
46
  var headerCenterStyle = useMemo(function () {
38
- var _item$options2;
39
- return (item === null || item === void 0 ? void 0 : (_item$options2 = item.options) === null || _item$options2 === void 0 ? void 0 : _item$options2.length) > 0 || (item === null || item === void 0 ? void 0 : item.product_option_string);
40
- }, [item === null || item === void 0 ? void 0 : item.options, item === null || item === void 0 ? void 0 : item.product_option_string]);
47
+ return (options === null || options === void 0 ? void 0 : options.length) > 0 || product_option_string;
48
+ }, [options, product_option_string]);
41
49
  return /*#__PURE__*/React.createElement("div", {
42
50
  className: classNames("".concat(prefix, "product-header"), headerCenterStyle && "".concat(prefix, "product-options-header"))
43
51
  }, isShowDelete && !disabledEdit ? /*#__PURE__*/React.createElement("div", {
@@ -52,19 +60,19 @@ var Header = function Header(props) {
52
60
  type: "pisell2-trash-01"
53
61
  })
54
62
  })) : null, showImage ? /*#__PURE__*/React.createElement("img", {
55
- src: image.ali(item.cover, 64),
63
+ src: imageAli.ali(image, 64),
56
64
  className: "".concat(prefix, "product-header-cover")
57
- }) : null, item !== null && item !== void 0 && item.id ? /*#__PURE__*/React.createElement("div", {
65
+ }) : null, id ? /*#__PURE__*/React.createElement("div", {
58
66
  className: "".concat(prefix, "product-right-wrap")
59
67
  }, /*#__PURE__*/React.createElement("div", {
60
68
  className: "".concat(prefix, "product-title")
61
- }, /*#__PURE__*/React.createElement("span", null, item === null || item === void 0 ? void 0 : item.title), showPrice ? /*#__PURE__*/React.createElement("span", {
69
+ }, /*#__PURE__*/React.createElement("span", null, name), showPrice ? /*#__PURE__*/React.createElement("span", {
62
70
  className: "".concat(prefix, "product-title-price")
63
- }, formatAmount(item === null || item === void 0 ? void 0 : item.price, 2, item === null || item === void 0 ? void 0 : item.symbol)) : null), item !== null && item !== void 0 && item.product_option_string ? /*#__PURE__*/React.createElement("span", {
71
+ }, formatAmount(price, 2, symbol)) : null), product_option_string ? /*#__PURE__*/React.createElement("span", {
64
72
  className: "".concat(prefix, "product-title-variant")
65
- }, item === null || item === void 0 ? void 0 : item.product_option_string) : null, /*#__PURE__*/React.createElement(Options, {
66
- options: item === null || item === void 0 ? void 0 : item.options,
67
- amountSymbol: item === null || item === void 0 ? void 0 : item.symbol
73
+ }, product_option_string) : null, /*#__PURE__*/React.createElement(Options, {
74
+ options: options,
75
+ amountSymbol: symbol
68
76
  })) : null);
69
77
  };
70
78
  export default Header;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ declare const MultiDay: ({ dataSource, hideDivider }: any) => React.JSX.Element;
4
+ export default MultiDay;
@@ -0,0 +1,79 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ 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; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ import React, { useMemo } from 'react';
8
+ import classNames from 'classnames';
9
+ import Divider from "../Divider";
10
+ import AmountFooter from "../AmountFooter";
11
+ import { formatMultiDayDate } from "../../utils";
12
+ import useEngineContext from "../../../../hooks/useEngineContext";
13
+ import "./index.less";
14
+ import { formatDateRanges } from "./utils";
15
+ var prefix = 'pisell-lowcode-';
16
+ var MultiDay = function MultiDay(_ref) {
17
+ var _context$appHelper, _context$appHelper$ut;
18
+ var dataSource = _ref.dataSource,
19
+ hideDivider = _ref.hideDivider;
20
+ var items = dataSource.items,
21
+ symbol = dataSource.symbol,
22
+ locale = dataSource.locale;
23
+ var translationOriginal = function translationOriginal(text) {
24
+ return '';
25
+ };
26
+ var context = useEngineContext();
27
+ translationOriginal = context === null || context === void 0 ? void 0 : (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : (_context$appHelper$ut = _context$appHelper.utils) === null || _context$appHelper$ut === void 0 ? void 0 : _context$appHelper$ut.translationOriginal;
28
+
29
+ /**
30
+ * @title: 商品单价 + 套餐价格
31
+ * @description:
32
+ * @param {*} useMemo
33
+ * @return {*}
34
+ * @Author: WangHan
35
+ * @Date: 2024-12-28 23:00
36
+ */
37
+ var lists = useMemo(function () {
38
+ if (!(items !== null && items !== void 0 && items.length)) return [];
39
+
40
+ // // 套餐明细
41
+ // const bundleDetails = bundle
42
+ // ?.map(
43
+ // (b: any) =>
44
+ // `${translationOriginal(b?.title)} (${symbol}${
45
+ // Number(b.price) * Number(b.num)
46
+ // })`
47
+ // )
48
+ // ?.join('+');
49
+
50
+ return formatDateRanges(items);
51
+ }, [items]);
52
+ return /*#__PURE__*/React.createElement("div", {
53
+ className: classNames("".concat(prefix, "multi-day-wrap"))
54
+ }, lists === null || lists === void 0 ? void 0 : lists.map(function (m, index) {
55
+ return /*#__PURE__*/React.createElement("div", {
56
+ key: index
57
+ }, /*#__PURE__*/React.createElement(Divider, {
58
+ type: "inside"
59
+ }), /*#__PURE__*/React.createElement("div", {
60
+ className: classNames("".concat(prefix, "multi-day"))
61
+ }, /*#__PURE__*/React.createElement("div", null, formatMultiDayDate(_objectSpread(_objectSpread({}, m), {}, {
62
+ locale: locale
63
+ }))), /*#__PURE__*/React.createElement(AmountFooter, {
64
+ item: _objectSpread(_objectSpread({}, m), {}, {
65
+ symbol: symbol
66
+ }),
67
+ hideDivider: true
68
+ })));
69
+ }), /*#__PURE__*/React.createElement("div", {
70
+ className: classNames("".concat(prefix, "multi-day-total-wrap"))
71
+ }, /*#__PURE__*/React.createElement(AmountFooter, {
72
+ item: _objectSpread(_objectSpread({}, dataSource), {}, {
73
+ num: 1
74
+ }),
75
+ type: "total",
76
+ isOnlyTotal: true
77
+ })));
78
+ };
79
+ export default MultiDay;
@@ -0,0 +1,34 @@
1
+ @pisell-prefix: pisell-lowcode;
2
+
3
+ .@{pisell-prefix} {
4
+ &-multi-day-wrap {
5
+ margin-top: 16px;
6
+ }
7
+
8
+ &-multi-day {
9
+ color: var(--Gray-500, #667085);
10
+ font-size: 14px;
11
+ font-weight: 400;
12
+ line-height: 20px;
13
+ display: flex;
14
+ flex-direction: column;
15
+ }
16
+
17
+ &-multi-day-total {
18
+ color: var(--Gray-900, #101828);
19
+ text-align: right;
20
+ font-size: 14px;
21
+ font-weight: 600;
22
+ line-height: 20px;
23
+ display: flex;
24
+ flex-direction: column;
25
+ }
26
+
27
+ &-multi-day-total-discount {
28
+ font-size: 12px;
29
+ font-weight: 400;
30
+ line-height: 18px;
31
+ text-decoration-line: line-through;
32
+ color: var(--Gray-500, #667085);
33
+ }
34
+ }
@@ -0,0 +1,14 @@
1
+ interface InputItem {
2
+ start_date: string;
3
+ end_date: string;
4
+ total: number;
5
+ num: number;
6
+ }
7
+ interface OutputItem {
8
+ start_date: string;
9
+ end_date: string;
10
+ total: number;
11
+ num: number;
12
+ }
13
+ export declare function formatDateRanges(list: InputItem[]): OutputItem[];
14
+ export {};
@@ -0,0 +1,54 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ 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; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ import dayjs from 'dayjs';
8
+
9
+ // 定义输入数据的接口
10
+
11
+ export function formatDateRanges(list) {
12
+ var result = [];
13
+ var currentGroup = null;
14
+ list.forEach(function (item, index) {
15
+ // Convert string dates using dayjs
16
+ var currentStartDate = dayjs(item.start_date);
17
+ var currentEndDate = dayjs(item.end_date);
18
+ var currentTotal = item.total;
19
+ var currentNum = item.num;
20
+ if (!currentGroup) {
21
+ // Start a new group
22
+ currentGroup = _objectSpread(_objectSpread({}, item), {}, {
23
+ start_date: currentStartDate.format('YYYY-MM-DD'),
24
+ end_date: currentEndDate.format('YYYY-MM-DD'),
25
+ total: currentTotal,
26
+ num: currentNum
27
+ });
28
+ } else {
29
+ var prevEndDate = dayjs(currentGroup.end_date);
30
+
31
+ // Check if current item can be merged with current group
32
+ if (currentTotal === currentGroup.total && prevEndDate.isSame(currentStartDate, 'day')) {
33
+ // Update end date and add up num
34
+ currentGroup.end_date = currentEndDate.format('YYYY-MM-DD');
35
+ currentGroup.num += currentNum;
36
+ } else {
37
+ // Push current group and start a new one
38
+ result.push(currentGroup);
39
+ currentGroup = _objectSpread(_objectSpread({}, item), {}, {
40
+ start_date: currentStartDate.format('YYYY-MM-DD'),
41
+ end_date: currentEndDate.format('YYYY-MM-DD'),
42
+ total: currentTotal,
43
+ num: currentNum
44
+ });
45
+ }
46
+ }
47
+
48
+ // Push the last group
49
+ if (index === list.length - 1 && currentGroup) {
50
+ result.push(currentGroup);
51
+ }
52
+ });
53
+ return result;
54
+ }
@@ -12,18 +12,24 @@ export var renderBundles = function renderBundles(item, hidePrice, isShowPackage
12
12
  };
13
13
  var context = useEngineContext();
14
14
  translationOriginal = context === null || context === void 0 ? void 0 : (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : (_context$appHelper$ut = _context$appHelper.utils) === null || _context$appHelper$ut === void 0 ? void 0 : _context$appHelper$ut.translationOriginal;
15
+ var title = item.title,
16
+ name = item.name,
17
+ id = item.id,
18
+ price = item.price,
19
+ symbol = item.symbol,
20
+ option = item.option;
15
21
  return /*#__PURE__*/React.createElement("div", {
16
- key: item.id,
22
+ key: id,
17
23
  className: "".concat(prefix, "packages-product-bundle-item")
18
24
  }, /*#__PURE__*/React.createElement("div", {
19
25
  className: "".concat(prefix, "packages-product-bundle-info")
20
26
  }, /*#__PURE__*/React.createElement("div", {
21
27
  className: "".concat(prefix, "packages-product-bundle-info-title")
22
- }, translationOriginal(item === null || item === void 0 ? void 0 : item.title)), !hidePrice ? /*#__PURE__*/React.createElement("div", {
28
+ }, translationOriginal(title || name)), !hidePrice ? /*#__PURE__*/React.createElement("div", {
23
29
  className: "".concat(prefix, "packages-product-bundle-info-num")
24
- }, _formatAmount(item === null || item === void 0 ? void 0 : item.price, item === null || item === void 0 ? void 0 : item.symbol)) : null), /*#__PURE__*/React.createElement(Options, {
25
- options: item === null || item === void 0 ? void 0 : item.option,
26
- amountSymbol: item === null || item === void 0 ? void 0 : item.symbol
30
+ }, _formatAmount(price, symbol)) : null), /*#__PURE__*/React.createElement(Options, {
31
+ options: option,
32
+ amountSymbol: symbol
27
33
  }), /*#__PURE__*/React.createElement(Footer, {
28
34
  item: item
29
35
  }), isShowPackageNote ? /*#__PURE__*/React.createElement(Note, {
@@ -15,9 +15,9 @@ var Options = function Options(_ref) {
15
15
  className: "".concat(prefix, "packages-product-bundle-option-item-left")
16
16
  }, /*#__PURE__*/React.createElement("span", null, option === null || option === void 0 ? void 0 : option.name), /*#__PURE__*/React.createElement("div", {
17
17
  className: "".concat(prefix, "packages-product-bundle-option-item-left-amount")
18
- }, /*#__PURE__*/React.createElement("span", null, _formatAmount(option === null || option === void 0 ? void 0 : option.add_price, amountSymbol)), /*#__PURE__*/React.createElement("span", null, "\xD7"), /*#__PURE__*/React.createElement("span", null, option === null || option === void 0 ? void 0 : option.num))), /*#__PURE__*/React.createElement("span", {
18
+ }, /*#__PURE__*/React.createElement("span", null, _formatAmount(option === null || option === void 0 ? void 0 : option.price, amountSymbol)), /*#__PURE__*/React.createElement("span", null, "\xD7"), /*#__PURE__*/React.createElement("span", null, option === null || option === void 0 ? void 0 : option.num))), /*#__PURE__*/React.createElement("span", {
19
19
  className: "".concat(prefix, "packages-product-bundle-option-item-amount")
20
- }, _formatAmount((option === null || option === void 0 ? void 0 : option.add_price) * (option === null || option === void 0 ? void 0 : option.num), amountSymbol)));
20
+ }, _formatAmount((option === null || option === void 0 ? void 0 : option.price) * (option === null || option === void 0 ? void 0 : option.num), amountSymbol)));
21
21
  })) : null;
22
22
  };
23
23
  export default Options;
@@ -23,8 +23,7 @@ var Packages = function Packages(_ref) {
23
23
  list: bundle || [],
24
24
  renderItem: function renderItem(items) {
25
25
  return renderBundles(_objectSpread(_objectSpread({}, items), {}, {
26
- symbol: item === null || item === void 0 ? void 0 : item.symbol,
27
- total: items === null || items === void 0 ? void 0 : items.price
26
+ symbol: item === null || item === void 0 ? void 0 : item.symbol
28
27
  }), false, isShowPackageNote);
29
28
  }
30
29
  }))) : null;
@@ -10,10 +10,10 @@ import { renderBundles } from "../Packages/components/collapsibleList/utils";
10
10
  import "./index.less";
11
11
  var prefix = 'pisell-lowcode-';
12
12
  var Sales = function Sales(_ref) {
13
- var _item$_extend, _other_products;
13
+ var _other_products;
14
14
  var item = _ref.item,
15
15
  isShowNote = _ref.isShowNote;
16
- var other_products = (item === null || item === void 0 ? void 0 : (_item$_extend = item._extend) === null || _item$_extend === void 0 ? void 0 : _item$_extend.relation_details) || [];
16
+ var other_products = (item === null || item === void 0 ? void 0 : item.relation_products) || [];
17
17
 
18
18
  // 格式化商品数据
19
19
  other_products = other_products.map(function (p) {
@@ -11,34 +11,36 @@ import Like from "./components/Like";
11
11
  import "./index.less";
12
12
  var prefix = 'pisell-lowcode-';
13
13
  var Time = function Time(_ref) {
14
- var _item$_extend5, _item$_extend5$date, _item$_extend6, _item$_extend7, _item$_extend8, _item$_extend9, _item$_extend10, _item$_extend11, _item$_extend12;
15
14
  var item = _ref.item,
16
15
  isShowHolder = _ref.isShowHolder,
17
16
  _onLike = _ref.onLike;
17
+ var start_date = item.start_date,
18
+ end_date = item.end_date,
19
+ holder_title = item.holder_title,
20
+ resource_id = item.resource_id,
21
+ relation_form_name = item.relation_form_name,
22
+ like_status = item.like_status;
18
23
  var isShow = useMemo(function () {
19
- var _item$_extend, _item$_extend$date, _item$_extend2, _item$_extend3, _item$_extend4;
20
- return (item === null || item === void 0 ? void 0 : (_item$_extend = item._extend) === null || _item$_extend === void 0 ? void 0 : (_item$_extend$date = _item$_extend.date) === null || _item$_extend$date === void 0 ? void 0 : _item$_extend$date.value) || isShowHolder && (item === null || item === void 0 ? void 0 : (_item$_extend2 = item._extend) === null || _item$_extend2 === void 0 ? void 0 : _item$_extend2.holder_title) || (item === null || item === void 0 ? void 0 : (_item$_extend3 = item._extend) === null || _item$_extend3 === void 0 ? void 0 : _item$_extend3.resource) || (item === null || item === void 0 ? void 0 : (_item$_extend4 = item._extend) === null || _item$_extend4 === void 0 ? void 0 : _item$_extend4.relation_form_name);
21
- }, [item === null || item === void 0 ? void 0 : item._extend, isShowHolder]);
24
+ return start_date && end_date || isShowHolder && holder_title || resource_id || relation_form_name;
25
+ }, [start_date, isShowHolder, holder_title, resource_id]);
22
26
  return isShow ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement("div", {
23
27
  className: "".concat(prefix, "product-time-wrap")
24
- }, item !== null && item !== void 0 && (_item$_extend5 = item._extend) !== null && _item$_extend5 !== void 0 && (_item$_extend5$date = _item$_extend5.date) !== null && _item$_extend5$date !== void 0 && _item$_extend5$date.value ? /*#__PURE__*/React.createElement("div", {
28
+ }, start_date && end_date ? /*#__PURE__*/React.createElement("div", {
25
29
  className: "".concat(prefix, "product-date")
26
- }, getServiceTime(item, (_item$_extend6 = item._extend) === null || _item$_extend6 === void 0 ? void 0 : _item$_extend6.start_date)) : null, isShowHolder && item !== null && item !== void 0 && (_item$_extend7 = item._extend) !== null && _item$_extend7 !== void 0 && _item$_extend7.holder_title ? /*#__PURE__*/React.createElement("div", {
30
+ }, getServiceTime(item, start_date)) : null, isShowHolder && holder_title ? /*#__PURE__*/React.createElement("div", {
27
31
  className: "".concat(prefix, "product-holder-wrap")
28
- }, item._extend.holder_title) : null, item !== null && item !== void 0 && (_item$_extend8 = item._extend) !== null && _item$_extend8 !== void 0 && _item$_extend8.resource || item !== null && item !== void 0 && (_item$_extend9 = item._extend) !== null && _item$_extend9 !== void 0 && _item$_extend9.relation_form_name ? /*#__PURE__*/React.createElement("div", {
32
+ }, holder_title) : null, resource_id || relation_form_name ? /*#__PURE__*/React.createElement("div", {
29
33
  className: "".concat(prefix, "product-technician")
30
- }, item !== null && item !== void 0 && (_item$_extend10 = item._extend) !== null && _item$_extend10 !== void 0 && _item$_extend10.resource ? /*#__PURE__*/React.createElement(Like, {
34
+ }, resource_id ? /*#__PURE__*/React.createElement(Like, {
31
35
  style: {
32
36
  marginRight: 4
33
37
  },
34
- status: (_item$_extend11 = item._extend) === null || _item$_extend11 === void 0 ? void 0 : _item$_extend11.like_status,
38
+ status: like_status,
35
39
  onLike: function onLike(e) {
36
40
  _onLike(_objectSpread(_objectSpread({}, item), {}, {
37
- _extend: _objectSpread(_objectSpread({}, item._extend), {}, {
38
- like_status: e
39
- })
41
+ like_status: e
40
42
  }));
41
43
  }
42
- }) : null, item === null || item === void 0 ? void 0 : (_item$_extend12 = item._extend) === null || _item$_extend12 === void 0 ? void 0 : _item$_extend12.relation_form_name) : null)) : null;
44
+ }) : null, relation_form_name) : null)) : null;
43
45
  };
44
46
  export default Time;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { ProductCardTypes } from './types';
3
3
  import './index.less';
4
- declare const ProductCard: (props: ProductCardTypes) => React.JSX.Element;
4
+ declare const ProductCard: React.FC<ProductCardTypes>;
5
5
  export default ProductCard;