@pisell/materials 2.2.35 → 2.2.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +2 -2
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +30 -30
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +23 -23
- package/es/components/cardPro/index.d.ts +4 -0
- package/es/components/cardPro/index.js +69 -0
- package/es/components/cardPro/index.less +55 -0
- package/es/components/collapse/index.d.ts +15 -0
- package/es/components/collapse/index.js +80 -0
- package/es/components/collapse/index.less +0 -0
- package/es/components/productCard/components/Action/index.d.ts +4 -0
- package/es/components/productCard/components/Action/index.js +21 -0
- package/es/components/productCard/components/Action/index.less +14 -0
- package/es/components/productCard/components/AmountFooter/index.d.ts +4 -0
- package/es/components/productCard/components/AmountFooter/index.js +38 -0
- package/es/components/productCard/components/AmountFooter/index.less +39 -0
- package/es/components/productCard/components/Divider/index.d.ts +4 -0
- package/es/components/productCard/components/Divider/index.js +11 -0
- package/es/components/productCard/components/Divider/index.less +13 -0
- package/es/components/productCard/components/Header/index.d.ts +4 -0
- package/es/components/productCard/components/Header/index.js +70 -0
- package/es/components/productCard/components/Header/index.less +63 -0
- package/es/components/productCard/components/Note/index.d.ts +4 -0
- package/es/components/productCard/components/Note/index.js +25 -0
- package/es/components/productCard/components/Note/index.less +20 -0
- package/es/components/productCard/components/Packages/components/collapsibleList/index.d.ts +10 -0
- package/es/components/productCard/components/Packages/components/collapsibleList/index.js +96 -0
- package/es/components/productCard/components/Packages/components/collapsibleList/index.less +53 -0
- package/es/components/productCard/components/Packages/components/collapsibleList/utils.d.ts +2 -0
- package/es/components/productCard/components/Packages/components/collapsibleList/utils.js +33 -0
- package/es/components/productCard/components/Packages/components/options/index.d.ts +4 -0
- package/es/components/productCard/components/Packages/components/options/index.js +23 -0
- package/es/components/productCard/components/Packages/components/options/index.less +29 -0
- package/es/components/productCard/components/Packages/index.d.ts +4 -0
- package/es/components/productCard/components/Packages/index.js +32 -0
- package/es/components/productCard/components/Packages/index.less +17 -0
- package/es/components/productCard/components/Packages/utils.d.ts +20 -0
- package/es/components/productCard/components/Packages/utils.js +40 -0
- package/es/components/productCard/components/Sales/index.d.ts +4 -0
- package/es/components/productCard/components/Sales/index.js +39 -0
- package/es/components/productCard/components/Sales/index.less +18 -0
- package/es/components/productCard/components/Time/components/Like/index.d.ts +9 -0
- package/es/components/productCard/components/Time/components/Like/index.js +26 -0
- package/es/components/productCard/components/Time/components/Like/index.less +6 -0
- package/es/components/productCard/components/Time/components/Like/like-heart.png +0 -0
- package/es/components/productCard/components/Time/components/Like/like-hide-heart.png +0 -0
- package/es/components/productCard/components/Time/index.d.ts +4 -0
- package/es/components/productCard/components/Time/index.js +44 -0
- package/es/components/productCard/components/Time/index.less +35 -0
- package/es/components/productCard/hooks/useOpenNote.d.ts +3 -0
- package/es/components/productCard/hooks/useOpenNote.js +66 -0
- package/es/components/productCard/index.d.ts +5 -0
- package/es/components/productCard/index.js +131 -0
- package/es/components/productCard/index.less +53 -0
- package/es/components/productCard/locales.d.ts +42 -0
- package/es/components/productCard/locales.js +47 -0
- package/es/components/productCard/status.d.ts +9 -0
- package/es/components/productCard/status.js +15 -0
- package/es/components/productCard/types.d.ts +17 -0
- package/es/components/productCard/types.js +1 -0
- package/es/components/productCard/utils.d.ts +162 -0
- package/es/components/productCard/utils.js +700 -0
- package/es/components/table/Table/utils.d.ts +1 -1
- package/es/index.d.ts +4 -2
- package/es/index.js +7 -2
- package/lib/components/cardPro/index.d.ts +4 -0
- package/lib/components/cardPro/index.js +101 -0
- package/lib/components/cardPro/index.less +55 -0
- package/lib/components/collapse/index.d.ts +15 -0
- package/lib/components/collapse/index.js +83 -0
- package/lib/components/collapse/index.less +0 -0
- package/lib/components/productCard/components/Action/index.d.ts +4 -0
- package/lib/components/productCard/components/Action/index.js +55 -0
- package/lib/components/productCard/components/Action/index.less +14 -0
- package/lib/components/productCard/components/AmountFooter/index.d.ts +4 -0
- package/lib/components/productCard/components/AmountFooter/index.js +61 -0
- package/lib/components/productCard/components/AmountFooter/index.less +39 -0
- package/lib/components/productCard/components/Divider/index.d.ts +4 -0
- package/lib/components/productCard/components/Divider/index.js +50 -0
- package/lib/components/productCard/components/Divider/index.less +13 -0
- package/lib/components/productCard/components/Header/index.d.ts +4 -0
- package/lib/components/productCard/components/Header/index.js +82 -0
- package/lib/components/productCard/components/Header/index.less +63 -0
- package/lib/components/productCard/components/Note/index.d.ts +4 -0
- package/lib/components/productCard/components/Note/index.js +56 -0
- package/lib/components/productCard/components/Note/index.less +20 -0
- package/lib/components/productCard/components/Packages/components/collapsibleList/index.d.ts +10 -0
- package/lib/components/productCard/components/Packages/components/collapsibleList/index.js +93 -0
- package/lib/components/productCard/components/Packages/components/collapsibleList/index.less +53 -0
- package/lib/components/productCard/components/Packages/components/collapsibleList/utils.d.ts +2 -0
- package/lib/components/productCard/components/Packages/components/collapsibleList/utils.js +52 -0
- package/lib/components/productCard/components/Packages/components/options/index.d.ts +4 -0
- package/lib/components/productCard/components/Packages/components/options/index.js +73 -0
- package/lib/components/productCard/components/Packages/components/options/index.less +29 -0
- package/lib/components/productCard/components/Packages/index.d.ts +4 -0
- package/lib/components/productCard/components/Packages/index.js +56 -0
- package/lib/components/productCard/components/Packages/index.less +17 -0
- package/lib/components/productCard/components/Packages/utils.d.ts +20 -0
- package/lib/components/productCard/components/Packages/utils.js +44 -0
- package/lib/components/productCard/components/Sales/index.d.ts +4 -0
- package/lib/components/productCard/components/Sales/index.js +61 -0
- package/lib/components/productCard/components/Sales/index.less +18 -0
- package/lib/components/productCard/components/Time/components/Like/index.d.ts +9 -0
- package/lib/components/productCard/components/Time/components/Like/index.js +64 -0
- package/lib/components/productCard/components/Time/components/Like/index.less +6 -0
- package/lib/components/productCard/components/Time/components/Like/like-heart.png +0 -0
- package/lib/components/productCard/components/Time/components/Like/like-hide-heart.png +0 -0
- package/lib/components/productCard/components/Time/index.d.ts +4 -0
- package/lib/components/productCard/components/Time/index.js +64 -0
- package/lib/components/productCard/components/Time/index.less +35 -0
- package/lib/components/productCard/hooks/useOpenNote.d.ts +3 -0
- package/lib/components/productCard/hooks/useOpenNote.js +84 -0
- package/lib/components/productCard/index.d.ts +5 -0
- package/lib/components/productCard/index.js +160 -0
- package/lib/components/productCard/index.less +53 -0
- package/lib/components/productCard/locales.d.ts +42 -0
- package/lib/components/productCard/locales.js +65 -0
- package/lib/components/productCard/status.d.ts +9 -0
- package/lib/components/productCard/status.js +36 -0
- package/lib/components/productCard/types.d.ts +17 -0
- package/lib/components/productCard/types.js +17 -0
- package/lib/components/productCard/utils.d.ts +162 -0
- package/lib/components/productCard/utils.js +613 -0
- package/lib/components/table/Table/utils.d.ts +1 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.js +38 -32
- package/lowcode/card-pro/meta.ts +338 -0
- package/lowcode/card-pro/snippe.ts +39 -0
- package/lowcode/collapse/meta.ts +85 -1
- package/lowcode/date-picker.range-picker/meta.ts +20 -0
- package/lowcode/product-card/meta.ts +92 -0
- package/lowcode/product-card/snippets.ts +23 -0
- package/package.json +2 -2
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
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."); }
|
|
3
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
4
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
import React, { useState, useMemo } from 'react';
|
|
12
|
+
import { locales } from '@pisell/utils';
|
|
13
|
+
import classNames from 'classnames';
|
|
14
|
+
import "./index.less";
|
|
15
|
+
var MAX_LIMIT = 3;
|
|
16
|
+
var CollapsibleList = function CollapsibleList(props) {
|
|
17
|
+
var _props$list = props.list,
|
|
18
|
+
list = _props$list === void 0 ? [] : _props$list,
|
|
19
|
+
renderItem = props.renderItem,
|
|
20
|
+
className = props.className,
|
|
21
|
+
style = props.style;
|
|
22
|
+
var _useState = useState(MAX_LIMIT),
|
|
23
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
24
|
+
maxLimit = _useState2[0],
|
|
25
|
+
setMaxLimit = _useState2[1];
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @title: 展开和收起
|
|
29
|
+
* @description:
|
|
30
|
+
* @param {any} d
|
|
31
|
+
* @return {*}
|
|
32
|
+
* @Author: zhiwei.Wang
|
|
33
|
+
* @Date: 2024-01-30 17:08
|
|
34
|
+
*/
|
|
35
|
+
var handlePreviewAll = function handlePreviewAll() {
|
|
36
|
+
var _maxLimit = maxLimit;
|
|
37
|
+
if (_maxLimit === MAX_LIMIT) {
|
|
38
|
+
_maxLimit = 99;
|
|
39
|
+
} else {
|
|
40
|
+
_maxLimit = MAX_LIMIT;
|
|
41
|
+
}
|
|
42
|
+
setMaxLimit(_maxLimit);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @title: 是否展开全部
|
|
47
|
+
* @description:
|
|
48
|
+
* @param {*} useMemo
|
|
49
|
+
* @return {*}
|
|
50
|
+
* @Author: zhiwei.Wang
|
|
51
|
+
* @Date: 2024-01-30 17:08
|
|
52
|
+
*/
|
|
53
|
+
var showAll = useMemo(function () {
|
|
54
|
+
return list.length > MAX_LIMIT;
|
|
55
|
+
}, [list]);
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @title: 展开文案
|
|
59
|
+
* @description:
|
|
60
|
+
* @return {*}
|
|
61
|
+
* @Author: zhiwei.Wang
|
|
62
|
+
* @Date: 2024-01-30 17:08
|
|
63
|
+
*/
|
|
64
|
+
var viewAllText = useMemo(function () {
|
|
65
|
+
var _maxLimit = maxLimit;
|
|
66
|
+
if (_maxLimit === MAX_LIMIT) {
|
|
67
|
+
return locales.getText('pisell2.product.card.view-all');
|
|
68
|
+
}
|
|
69
|
+
return locales.getText('pisell2.product.card.view-less');
|
|
70
|
+
}, [maxLimit]);
|
|
71
|
+
var _list = useMemo(function () {
|
|
72
|
+
var arr = _toConsumableArray(list);
|
|
73
|
+
// 默认展示3条, 点击更多时展示全部
|
|
74
|
+
var _maxLimit = maxLimit;
|
|
75
|
+
if (list.length > _maxLimit) {
|
|
76
|
+
arr = arr.slice(0, _maxLimit);
|
|
77
|
+
}
|
|
78
|
+
return arr;
|
|
79
|
+
}, [list, maxLimit]);
|
|
80
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
81
|
+
className: classNames('pisell2-collapsible-list-wrap', className),
|
|
82
|
+
style: style
|
|
83
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
84
|
+
className: "pisell2-collapsible-list"
|
|
85
|
+
}, _list.map(function (d, i) {
|
|
86
|
+
return renderItem(d, i);
|
|
87
|
+
})), showAll ? /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
className: "pisell2-collapsible-list-view-all",
|
|
89
|
+
onClick: function onClick(e) {
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
e.stopPropagation();
|
|
92
|
+
handlePreviewAll();
|
|
93
|
+
}
|
|
94
|
+
}, viewAllText) : null);
|
|
95
|
+
};
|
|
96
|
+
export default CollapsibleList;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
@pisell-prefix: pisell-lowcode;
|
|
2
|
+
|
|
3
|
+
.@{pisell-prefix} {
|
|
4
|
+
&-packages-product-bundle-item {
|
|
5
|
+
width: 100%;
|
|
6
|
+
padding: 8px;
|
|
7
|
+
border-radius: 6px;
|
|
8
|
+
border: 1px solid var(--Gray-300, #d0d5dd);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&-packages-product-bundle-info {
|
|
12
|
+
width: 100%;
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: space-between;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&-packages-product-bundle-info-title {
|
|
19
|
+
color: var(--Gray-500, #667085);
|
|
20
|
+
font-family: Inter;
|
|
21
|
+
font-size: 14px;
|
|
22
|
+
font-style: normal;
|
|
23
|
+
font-weight: 600;
|
|
24
|
+
line-height: 20px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&-packages-product-bundle-info-num {
|
|
28
|
+
color: var(--Gray-500, #667085);
|
|
29
|
+
font-size: 14px;
|
|
30
|
+
font-style: normal;
|
|
31
|
+
font-weight: 500;
|
|
32
|
+
line-height: 20px;
|
|
33
|
+
flex-shrink: 0;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.pisell2-collapsible-list-wrap {
|
|
38
|
+
.pisell2-collapsible-list {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
gap: 8px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.pisell2-collapsible-list-view-all {
|
|
45
|
+
margin-top: 4px;
|
|
46
|
+
color: #7f56d9;
|
|
47
|
+
font-size: 16px;
|
|
48
|
+
font-style: normal;
|
|
49
|
+
font-weight: 700;
|
|
50
|
+
line-height: 24px;
|
|
51
|
+
user-select: none;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Footer from "../../../AmountFooter";
|
|
3
|
+
import Note from "../../../Note";
|
|
4
|
+
import useEngineContext from "../../../../../../hooks/useEngineContext";
|
|
5
|
+
import { _formatAmount } from "../../utils";
|
|
6
|
+
import Options from "../options";
|
|
7
|
+
var prefix = 'pisell-lowcode-';
|
|
8
|
+
export var renderBundles = function renderBundles(item, hidePrice, isShowPackageNote) {
|
|
9
|
+
var _context$appHelper, _context$appHelper$ut;
|
|
10
|
+
var translationOriginal = function translationOriginal(text) {
|
|
11
|
+
return '';
|
|
12
|
+
};
|
|
13
|
+
var context = useEngineContext();
|
|
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
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
16
|
+
key: item.id,
|
|
17
|
+
className: "".concat(prefix, "packages-product-bundle-item")
|
|
18
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
19
|
+
className: "".concat(prefix, "packages-product-bundle-info")
|
|
20
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: "".concat(prefix, "packages-product-bundle-info-title")
|
|
22
|
+
}, translationOriginal(item === null || item === void 0 ? void 0 : item.title)), !hidePrice ? /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
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
|
|
27
|
+
}), /*#__PURE__*/React.createElement(Footer, {
|
|
28
|
+
item: item
|
|
29
|
+
}), isShowPackageNote ? /*#__PURE__*/React.createElement(Note, {
|
|
30
|
+
item: item,
|
|
31
|
+
type: "inside"
|
|
32
|
+
}) : null);
|
|
33
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { _formatAmount } from "../../utils";
|
|
3
|
+
import "./index.less";
|
|
4
|
+
var prefix = 'pisell-lowcode-';
|
|
5
|
+
var Options = function Options(_ref) {
|
|
6
|
+
var options = _ref.options,
|
|
7
|
+
amountSymbol = _ref.amountSymbol;
|
|
8
|
+
return (options === null || options === void 0 ? void 0 : options.length) > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
9
|
+
className: "".concat(prefix, "packages-product-bundle-option")
|
|
10
|
+
}, options.map(function (option, index) {
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
key: option.id,
|
|
13
|
+
className: "".concat(prefix, "packages-product-bundle-option-item")
|
|
14
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
className: "".concat(prefix, "packages-product-bundle-option-item-left")
|
|
16
|
+
}, /*#__PURE__*/React.createElement("span", null, option === null || option === void 0 ? void 0 : option.name), /*#__PURE__*/React.createElement("div", {
|
|
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", {
|
|
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)));
|
|
21
|
+
})) : null;
|
|
22
|
+
};
|
|
23
|
+
export default Options;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
@pisell-prefix: pisell-lowcode;
|
|
2
|
+
|
|
3
|
+
.@{pisell-prefix} {
|
|
4
|
+
&-packages-product-bundle-option {
|
|
5
|
+
color: var(--gray-500, #667085);
|
|
6
|
+
font-size: 14px;
|
|
7
|
+
font-style: normal;
|
|
8
|
+
font-weight: 400;
|
|
9
|
+
line-height: 20px;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&-packages-product-bundle-option-item {
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: space-between;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&-packages-product-bundle-option-item-left {
|
|
20
|
+
display: flex;
|
|
21
|
+
gap: 4px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&-packages-product-bundle-option-item-left-amount {
|
|
25
|
+
margin-left: 8px;
|
|
26
|
+
display: flex;
|
|
27
|
+
gap: 4px;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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 from 'react';
|
|
8
|
+
import Divider from "../Divider";
|
|
9
|
+
import { locales } from '@pisell/utils';
|
|
10
|
+
import CollapsibleList from "./components/collapsibleList";
|
|
11
|
+
import { renderBundles } from "./components/collapsibleList/utils";
|
|
12
|
+
import "./index.less";
|
|
13
|
+
var prefix = 'pisell-lowcode-';
|
|
14
|
+
var Packages = function Packages(_ref) {
|
|
15
|
+
var item = _ref.item,
|
|
16
|
+
isShowPackageNote = _ref.isShowPackageNote;
|
|
17
|
+
var bundle = (item === null || item === void 0 ? void 0 : item.bundle) || [];
|
|
18
|
+
return (bundle === null || bundle === void 0 ? void 0 : bundle.length) > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement("div", {
|
|
19
|
+
className: "".concat(prefix, "product-packages-wrap")
|
|
20
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: "".concat(prefix, "product-packages-title")
|
|
22
|
+
}, locales.getText('pisell2.product.card.items.package')), /*#__PURE__*/React.createElement(CollapsibleList, {
|
|
23
|
+
list: bundle || [],
|
|
24
|
+
renderItem: function renderItem(items) {
|
|
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
|
|
28
|
+
}), false, isShowPackageNote);
|
|
29
|
+
}
|
|
30
|
+
}))) : null;
|
|
31
|
+
};
|
|
32
|
+
export default Packages;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@pisell-prefix: pisell-lowcode;
|
|
2
|
+
|
|
3
|
+
.@{pisell-prefix} {
|
|
4
|
+
&-product-packages-wrap {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
gap: 8px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
&-product-packages-title {
|
|
11
|
+
color: var(--Gray-900, #101828);
|
|
12
|
+
font-size: 14px;
|
|
13
|
+
font-style: normal;
|
|
14
|
+
font-weight: 600;
|
|
15
|
+
line-height: 20px;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @title: 金额是否是负
|
|
3
|
+
* @description:
|
|
4
|
+
* @param {string} type
|
|
5
|
+
* @return {*}
|
|
6
|
+
* @Author: WangHan
|
|
7
|
+
* @Date: 2024-11-22 10:01
|
|
8
|
+
*/
|
|
9
|
+
export declare const minusSign: (item: any, type?: string) => "" | "-";
|
|
10
|
+
/**
|
|
11
|
+
* @title: 金额格式化
|
|
12
|
+
* @description:
|
|
13
|
+
* @param {number} price
|
|
14
|
+
* @param {string} amountSymbol
|
|
15
|
+
* @param {number} digit
|
|
16
|
+
* @return {*}
|
|
17
|
+
* @Author: WangHan
|
|
18
|
+
* @Date: 2024-11-22 10:58
|
|
19
|
+
*/
|
|
20
|
+
export declare const _formatAmount: (price?: number, amountSymbol?: string, digit?: number) => string | number;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { formatAmount } from '@pisell/utils';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @title: 金额是否是负
|
|
5
|
+
* @description:
|
|
6
|
+
* @param {string} type
|
|
7
|
+
* @return {*}
|
|
8
|
+
* @Author: WangHan
|
|
9
|
+
* @Date: 2024-11-22 10:01
|
|
10
|
+
*/
|
|
11
|
+
export var minusSign = function minusSign(item, type) {
|
|
12
|
+
// 单个商品 + 单规格价格之后的价格
|
|
13
|
+
if (type === 'total') {
|
|
14
|
+
var _price2 = (item === null || item === void 0 ? void 0 : item.bundle_sum_price) || 0;
|
|
15
|
+
var _isMarkdown = (item === null || item === void 0 ? void 0 : item.bundle_sum_type) === 'markdown';
|
|
16
|
+
return _price2 > 0 && _isMarkdown ? '-' : '';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// 单个商品的价格
|
|
20
|
+
var _price = (item === null || item === void 0 ? void 0 : item.price) || 0;
|
|
21
|
+
var isMarkdown = (item === null || item === void 0 ? void 0 : item.price_type) === 'markdown';
|
|
22
|
+
return _price > 0 && isMarkdown ? '-' : '';
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @title: 金额格式化
|
|
27
|
+
* @description:
|
|
28
|
+
* @param {number} price
|
|
29
|
+
* @param {string} amountSymbol
|
|
30
|
+
* @param {number} digit
|
|
31
|
+
* @return {*}
|
|
32
|
+
* @Author: WangHan
|
|
33
|
+
* @Date: 2024-11-22 10:58
|
|
34
|
+
*/
|
|
35
|
+
export var _formatAmount = function _formatAmount() {
|
|
36
|
+
var price = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
37
|
+
var amountSymbol = arguments.length > 1 ? arguments[1] : undefined;
|
|
38
|
+
var digit = arguments.length > 2 ? arguments[2] : undefined;
|
|
39
|
+
return formatAmount(price, digit, amountSymbol);
|
|
40
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
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 from 'react';
|
|
8
|
+
import CollapsibleList from "../Packages/components/collapsibleList";
|
|
9
|
+
import { renderBundles } from "../Packages/components/collapsibleList/utils";
|
|
10
|
+
import "./index.less";
|
|
11
|
+
var prefix = 'pisell-lowcode-';
|
|
12
|
+
var Sales = function Sales(_ref) {
|
|
13
|
+
var _item$_extend, _other_products;
|
|
14
|
+
var item = _ref.item,
|
|
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) || [];
|
|
17
|
+
|
|
18
|
+
// 格式化商品数据
|
|
19
|
+
other_products = other_products.map(function (p) {
|
|
20
|
+
return _objectSpread(_objectSpread({}, p), {}, {
|
|
21
|
+
title: p === null || p === void 0 ? void 0 : p.product_title,
|
|
22
|
+
price: p === null || p === void 0 ? void 0 : p.payment_price,
|
|
23
|
+
symbol: item.symbol,
|
|
24
|
+
num: p === null || p === void 0 ? void 0 : p.product_quantity,
|
|
25
|
+
total: p === null || p === void 0 ? void 0 : p.payment_price
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
return ((_other_products = other_products) === null || _other_products === void 0 ? void 0 : _other_products.length) > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
className: "".concat(prefix, "product-sales-wrap")
|
|
30
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
className: "".concat(prefix, "product-sales-title")
|
|
32
|
+
}, "Sales"), /*#__PURE__*/React.createElement(CollapsibleList, {
|
|
33
|
+
list: other_products || [],
|
|
34
|
+
renderItem: function renderItem(items) {
|
|
35
|
+
return renderBundles(items, true, isShowNote);
|
|
36
|
+
}
|
|
37
|
+
}))) : null;
|
|
38
|
+
};
|
|
39
|
+
export default Sales;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@pisell-prefix: pisell-lowcode;
|
|
2
|
+
|
|
3
|
+
.@{pisell-prefix} {
|
|
4
|
+
&-product-sales-wrap {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
gap: 8px;
|
|
8
|
+
margin-top: 8px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&-product-sales-title {
|
|
12
|
+
color: var(--Gray-900, #101828);
|
|
13
|
+
font-size: 14px;
|
|
14
|
+
font-style: normal;
|
|
15
|
+
font-weight: 600;
|
|
16
|
+
line-height: 20px;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import likeHeart from "./like-heart.png";
|
|
3
|
+
import likeHideHeart from "./like-hide-heart.png";
|
|
4
|
+
import "./index.less";
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
var Like = function Like(_ref) {
|
|
7
|
+
var status = _ref.status,
|
|
8
|
+
onLike = _ref.onLike,
|
|
9
|
+
className = _ref.className,
|
|
10
|
+
style = _ref.style;
|
|
11
|
+
var url = status === 'like' ? likeHeart : likeHideHeart;
|
|
12
|
+
return /*#__PURE__*/React.createElement("img", {
|
|
13
|
+
style: style,
|
|
14
|
+
src: url,
|
|
15
|
+
className: classNames('like-icon', className),
|
|
16
|
+
onClick: function onClick(e) {
|
|
17
|
+
if (!onLike) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
e.preventDefault();
|
|
21
|
+
e.stopPropagation();
|
|
22
|
+
onLike === null || onLike === void 0 ? void 0 : onLike(status === 'like' ? 'common' : 'like');
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
export default Like;
|
|
Binary file
|
|
@@ -0,0 +1,44 @@
|
|
|
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 { getServiceTime } from "../../utils";
|
|
9
|
+
import Divider from "../Divider";
|
|
10
|
+
import Like from "./components/Like";
|
|
11
|
+
import "./index.less";
|
|
12
|
+
var prefix = 'pisell-lowcode-';
|
|
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
|
+
var item = _ref.item,
|
|
16
|
+
isShowHolder = _ref.isShowHolder,
|
|
17
|
+
_onLike = _ref.onLike;
|
|
18
|
+
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]);
|
|
22
|
+
return isShow ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
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", {
|
|
25
|
+
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", {
|
|
27
|
+
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", {
|
|
29
|
+
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, {
|
|
31
|
+
style: {
|
|
32
|
+
marginRight: 4
|
|
33
|
+
},
|
|
34
|
+
status: (_item$_extend11 = item._extend) === null || _item$_extend11 === void 0 ? void 0 : _item$_extend11.like_status,
|
|
35
|
+
onLike: function onLike(e) {
|
|
36
|
+
_onLike(_objectSpread(_objectSpread({}, item), {}, {
|
|
37
|
+
_extend: _objectSpread(_objectSpread({}, item._extend), {}, {
|
|
38
|
+
like_status: e
|
|
39
|
+
})
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
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;
|
|
43
|
+
};
|
|
44
|
+
export default Time;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@pisell-prefix: pisell-lowcode;
|
|
2
|
+
|
|
3
|
+
.@{pisell-prefix} {
|
|
4
|
+
&-product-time-wrap {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
gap: 6px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
&-product-date {
|
|
11
|
+
color: var(--gray-500, #667085);
|
|
12
|
+
font-size: 14px;
|
|
13
|
+
font-style: normal;
|
|
14
|
+
font-weight: 400;
|
|
15
|
+
line-height: 20px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&-product-holder-wrap {
|
|
19
|
+
color: var(--Gray-500, #667085);
|
|
20
|
+
font-size: 14px;
|
|
21
|
+
font-style: normal;
|
|
22
|
+
font-weight: 600;
|
|
23
|
+
line-height: 20px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&-product-technician {
|
|
27
|
+
color: var(--gray-500, #667085);
|
|
28
|
+
font-size: 14px;
|
|
29
|
+
font-style: normal;
|
|
30
|
+
font-weight: 400;
|
|
31
|
+
line-height: 20px;
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useState, forwardRef, useImperativeHandle } from 'react';
|
|
8
|
+
import { locales } from '@pisell/utils';
|
|
9
|
+
import { PisellModal, Input } from "../../../index";
|
|
10
|
+
var useOpenNote = function useOpenNote(_ref, ref) {
|
|
11
|
+
var onNoteChange = _ref.onNoteChange;
|
|
12
|
+
var _useState = useState(false),
|
|
13
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
14
|
+
open = _useState2[0],
|
|
15
|
+
setOpen = _useState2[1];
|
|
16
|
+
var _useState3 = useState({}),
|
|
17
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
18
|
+
item = _useState4[0],
|
|
19
|
+
setItem = _useState4[1];
|
|
20
|
+
var _useState5 = useState(),
|
|
21
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
22
|
+
value = _useState6[0],
|
|
23
|
+
setValue = _useState6[1];
|
|
24
|
+
useImperativeHandle(ref, function () {
|
|
25
|
+
return {
|
|
26
|
+
open: function open(_ref2) {
|
|
27
|
+
var item = _ref2.item;
|
|
28
|
+
setItem(item);
|
|
29
|
+
setValue(item === null || item === void 0 ? void 0 : item.note);
|
|
30
|
+
setOpen(true);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
var handleOk = function handleOk() {
|
|
35
|
+
onNoteChange(value);
|
|
36
|
+
setOpen(false);
|
|
37
|
+
};
|
|
38
|
+
return /*#__PURE__*/React.createElement(PisellModal, {
|
|
39
|
+
platform: 'pc',
|
|
40
|
+
open: open,
|
|
41
|
+
bodyStyle: {
|
|
42
|
+
padding: 0
|
|
43
|
+
},
|
|
44
|
+
title: item !== null && item !== void 0 && item.note ? locales.getText('pisell2.product.card.discount.edit.note') : locales.getText('pisell2.product.card.discount.add.note'),
|
|
45
|
+
onCancel: function onCancel() {
|
|
46
|
+
return setOpen(false);
|
|
47
|
+
},
|
|
48
|
+
onOk: handleOk,
|
|
49
|
+
destroyOnClose: true,
|
|
50
|
+
className: "pisell-lowcode__booking-select-pet-modal-wrap",
|
|
51
|
+
okText: locales.getText('pisell2.product.card.confirm'),
|
|
52
|
+
cancelText: locales.getText('pisell2.product.card.cancel')
|
|
53
|
+
}, /*#__PURE__*/React.createElement(Input.TextArea, {
|
|
54
|
+
size: "large",
|
|
55
|
+
placeholder: locales.getText('pisell2.product.card.note.pla'),
|
|
56
|
+
autoSize: {
|
|
57
|
+
minRows: 4
|
|
58
|
+
},
|
|
59
|
+
allowClear: true,
|
|
60
|
+
value: value,
|
|
61
|
+
onChange: function onChange(e) {
|
|
62
|
+
setValue(e.target.value);
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
65
|
+
};
|
|
66
|
+
export default /*#__PURE__*/forwardRef(useOpenNote);
|