@pisell/private-materials 3.0.54 → 3.0.56

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 (52) 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 +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +7 -7
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +8 -8
  11. package/es/components/booking/components/footer/index.js +23 -16
  12. package/es/components/booking/deposit/DepositItem/index.js +1 -1
  13. package/es/components/booking/deposit/index.js +4 -1
  14. package/es/components/booking/locales.js +1 -1
  15. package/es/components/index.d.ts +2 -1
  16. package/es/components/index.js +2 -1
  17. package/es/components/listComponent/index.d.ts +15 -0
  18. package/es/components/listComponent/index.js +75 -0
  19. package/es/components/ruleSetting/index.d.ts +10 -0
  20. package/es/components/ruleSetting/index.js +335 -0
  21. package/es/components/ruleSetting/index.less +81 -0
  22. package/es/components/ruleSetting/locales.d.ts +48 -0
  23. package/es/components/ruleSetting/locales.js +47 -0
  24. package/es/components/ruleSetting/ruleBorder/index.d.ts +10 -0
  25. package/es/components/ruleSetting/ruleBorder/index.js +66 -0
  26. package/es/components/ruleSetting/ruleBorder/index.less +30 -0
  27. package/es/components/ruleSetting/server.d.ts +4 -0
  28. package/es/components/ruleSetting/server.js +149 -0
  29. package/es/index.d.ts +1 -0
  30. package/es/index.js +2 -1
  31. package/lib/components/booking/components/footer/index.js +8 -2
  32. package/lib/components/booking/deposit/DepositItem/index.js +1 -1
  33. package/lib/components/booking/deposit/index.js +4 -1
  34. package/lib/components/booking/locales.js +1 -1
  35. package/lib/components/index.d.ts +2 -1
  36. package/lib/components/index.js +3 -0
  37. package/lib/components/listComponent/index.d.ts +15 -0
  38. package/lib/components/listComponent/index.js +85 -0
  39. package/lib/components/ruleSetting/index.d.ts +10 -0
  40. package/lib/components/ruleSetting/index.js +379 -0
  41. package/lib/components/ruleSetting/index.less +81 -0
  42. package/lib/components/ruleSetting/locales.d.ts +48 -0
  43. package/lib/components/ruleSetting/locales.js +71 -0
  44. package/lib/components/ruleSetting/ruleBorder/index.d.ts +10 -0
  45. package/lib/components/ruleSetting/ruleBorder/index.js +89 -0
  46. package/lib/components/ruleSetting/ruleBorder/index.less +30 -0
  47. package/lib/components/ruleSetting/server.d.ts +4 -0
  48. package/lib/components/ruleSetting/server.js +107 -0
  49. package/lib/index.d.ts +1 -0
  50. package/lib/index.js +3 -0
  51. package/lowcode/rule-setting/meta.ts +74 -0
  52. package/package.json +1 -1
@@ -40,7 +40,7 @@ import { DownOutlined } from "@ant-design/icons";
40
40
  * @Date: 2024-01-30 16:51
41
41
  */
42
42
  var Footer = function Footer(props) {
43
- var _context$appHelper, _store$getState, _store$getState$call, _store$getState$call$, _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$addons2, _state$addons4, _state$bookingDetail8;
43
+ var _context$appHelper, _store$getState, _store$getState$call, _store$getState$call$, _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$addons2, _state$addons4, _state$bookingDetail10;
44
44
  var state = props.state,
45
45
  buttons = props.buttons,
46
46
  dispatch = props.dispatch,
@@ -340,7 +340,7 @@ var Footer = function Footer(props) {
340
340
  _setLoading(false);
341
341
 
342
342
  // return数据 checkout时需要
343
- return _context4.abrupt("return", callbackData);
343
+ return _context4.abrupt("return", callbackData || values);
344
344
  case 30:
345
345
  _context4.prev = 30;
346
346
  _context4.t1 = _context4["catch"](13);
@@ -444,29 +444,36 @@ var Footer = function Footer(props) {
444
444
  }, [isEdit, checkoutLoading, isDisabled, state, source]);
445
445
  var handleMenuClick = /*#__PURE__*/function () {
446
446
  var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(e) {
447
- var id, res;
447
+ var id, customer, res, _state$bookingDetail;
448
448
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
449
449
  while (1) switch (_context6.prev = _context6.next) {
450
450
  case 0:
451
451
  id = state.bookingId;
452
+ customer = state.bookingDetail.customer;
452
453
  if (!isEdit) {
453
- _context6.next = 6;
454
+ _context6.next = 8;
454
455
  break;
455
456
  }
456
- _context6.next = 4;
457
+ _context6.next = 5;
457
458
  return handleSave({
458
459
  type: "checkout",
459
460
  messageShow: false
460
461
  });
461
- case 4:
462
+ case 5:
462
463
  res = _context6.sent;
463
464
  id = (res === null || res === void 0 ? void 0 : res.order_id) || state.bookingId;
464
- case 6:
465
+ customer = res !== null && res !== void 0 && res.customer_id ? {
466
+ id: res === null || res === void 0 ? void 0 : res.customer_id
467
+ } : state.bookingDetail.customer;
468
+ case 8:
465
469
  if (e.key === 'sendMail') {
466
470
  state.action({
467
471
  type: 'pisell1.sendPayLinkEmail',
468
472
  data: {
469
- id: id
473
+ id: id,
474
+ is_deposit: state.bookingDetail.is_deposit || Number((_state$bookingDetail = state.bookingDetail) === null || _state$bookingDetail === void 0 ? void 0 : _state$bookingDetail.deposit_amount),
475
+ deposit_payment_time: state.bookingDetail.deposit_payment_time,
476
+ customer: customer
470
477
  },
471
478
  callback: function callback() {}
472
479
  });
@@ -480,7 +487,7 @@ var Footer = function Footer(props) {
480
487
  callback: function callback() {}
481
488
  });
482
489
  }
483
- case 8:
490
+ case 10:
484
491
  case "end":
485
492
  return _context6.stop();
486
493
  }
@@ -579,10 +586,10 @@ var Footer = function Footer(props) {
579
586
  * @Date: 2024-01-30 16:58
580
587
  */
581
588
  var isCheckout = useMemo(function () {
582
- var _state$bookingDetail, _state$bookingDetail$, _state$bookingDetail2;
589
+ var _state$bookingDetail2, _state$bookingDetail3, _state$bookingDetail4;
583
590
  var list = ["unfulfilled", "partially_paid", "unpaid", "payment_processing"];
584
591
  // (支付状态 = 已支付 || 部分付款 || 未付款 || 支付处理中) && 预约状态 !== 已取消
585
- if (!state.bookingId || ((_state$bookingDetail = state.bookingDetail) === null || _state$bookingDetail === void 0 ? void 0 : (_state$bookingDetail$ = _state$bookingDetail.bookings) === null || _state$bookingDetail$ === void 0 ? void 0 : _state$bookingDetail$.appointment_status) !== "cancelled" && list.includes(state === null || state === void 0 ? void 0 : (_state$bookingDetail2 = state.bookingDetail) === null || _state$bookingDetail2 === void 0 ? void 0 : _state$bookingDetail2.payment_status) && !state.disabledEdit) {
592
+ if (!state.bookingId || ((_state$bookingDetail2 = state.bookingDetail) === null || _state$bookingDetail2 === void 0 ? void 0 : (_state$bookingDetail3 = _state$bookingDetail2.bookings) === null || _state$bookingDetail3 === void 0 ? void 0 : _state$bookingDetail3.appointment_status) !== "cancelled" && list.includes(state === null || state === void 0 ? void 0 : (_state$bookingDetail4 = state.bookingDetail) === null || _state$bookingDetail4 === void 0 ? void 0 : _state$bookingDetail4.payment_status) && !state.disabledEdit) {
586
593
  return true;
587
594
  } else {
588
595
  if (total.notPaidAmount > 0) {
@@ -657,8 +664,8 @@ var Footer = function Footer(props) {
657
664
  * 是否只有定金支付
658
665
  */
659
666
  var isOnlyDeposit = useMemo(function () {
660
- var _state$bookingDetail3, _state$bookingDetail4, _state$bookingDetail5, _state$bookingDetail6;
661
- if (state !== null && state !== void 0 && (_state$bookingDetail3 = state.bookingDetail) !== null && _state$bookingDetail3 !== void 0 && _state$bookingDetail3.deposit_payment_time && state !== null && state !== void 0 && (_state$bookingDetail4 = state.bookingDetail) !== null && _state$bookingDetail4 !== void 0 && (_state$bookingDetail5 = _state$bookingDetail4.payment_types) !== null && _state$bookingDetail5 !== void 0 && (_state$bookingDetail6 = _state$bookingDetail5.every) !== null && _state$bookingDetail6 !== void 0 && _state$bookingDetail6.call(_state$bookingDetail5, function (item) {
667
+ var _state$bookingDetail5, _state$bookingDetail6, _state$bookingDetail7, _state$bookingDetail8;
668
+ if (state !== null && state !== void 0 && (_state$bookingDetail5 = state.bookingDetail) !== null && _state$bookingDetail5 !== void 0 && _state$bookingDetail5.deposit_payment_time && state !== null && state !== void 0 && (_state$bookingDetail6 = state.bookingDetail) !== null && _state$bookingDetail6 !== void 0 && (_state$bookingDetail7 = _state$bookingDetail6.payment_types) !== null && _state$bookingDetail7 !== void 0 && (_state$bookingDetail8 = _state$bookingDetail7.every) !== null && _state$bookingDetail8 !== void 0 && _state$bookingDetail8.call(_state$bookingDetail7, function (item) {
662
669
  return item === 'deposit';
663
670
  })) {
664
671
  return true;
@@ -679,8 +686,8 @@ var Footer = function Footer(props) {
679
686
 
680
687
  // 只有定金支付时,直接展示
681
688
  if (isOnlyDeposit) {
682
- var _state$bookingDetail7;
683
- return "".concat(locales.getText("pisell2.text.deposit-paid"), " ").concat(formatAmount(state === null || state === void 0 ? void 0 : (_state$bookingDetail7 = state.bookingDetail) === null || _state$bookingDetail7 === void 0 ? void 0 : _state$bookingDetail7.deposit_amount, 2, (state === null || state === void 0 ? void 0 : state.amountSymbol) || "$"), " ").concat(total.duration ? "(".concat(total.duration, ")") : "");
689
+ var _state$bookingDetail9;
690
+ return "".concat(locales.getText("pisell2.text.deposit-paid"), " ").concat(formatAmount(state === null || state === void 0 ? void 0 : (_state$bookingDetail9 = state.bookingDetail) === null || _state$bookingDetail9 === void 0 ? void 0 : _state$bookingDetail9.deposit_amount, 2, (state === null || state === void 0 ? void 0 : state.amountSymbol) || "$"), " ").concat(total.duration ? "(".concat(total.duration, ")") : "");
684
691
  }
685
692
 
686
693
  // 有退款金额时, 直接展示 退款:$8.00
@@ -804,7 +811,7 @@ var Footer = function Footer(props) {
804
811
  className: "order-total-item-label"
805
812
  }, locales.getText("pisell1.text.subtotal")), /*#__PURE__*/React.createElement("span", {
806
813
  className: "order-total-item-value"
807
- }, formatAmount(total.productAmount, 2, (state === null || state === void 0 ? void 0 : state.amountSymbol) || "$"))), (((_state$bookingDetail8 = state.bookingDetail) === null || _state$bookingDetail8 === void 0 ? void 0 : _state$bookingDetail8.surcharge) || []).map(function (d) {
814
+ }, formatAmount(total.productAmount, 2, (state === null || state === void 0 ? void 0 : state.amountSymbol) || "$"))), (((_state$bookingDetail10 = state.bookingDetail) === null || _state$bookingDetail10 === void 0 ? void 0 : _state$bookingDetail10.surcharge) || []).map(function (d) {
808
815
  return /*#__PURE__*/React.createElement("div", {
809
816
  className: "order-total-item",
810
817
  key: d.id
@@ -41,7 +41,7 @@ var DepositItem = function DepositItem(props) {
41
41
  }, {
42
42
  key: "1",
43
43
  disabled: isPaid || isBookingCancelled,
44
- label: /*#__PURE__*/React.createElement("div", null, locales.getText("pisell2.text.deposit-generate-payment-link"))
44
+ label: /*#__PURE__*/React.createElement("div", null, locales.getText("pisell2.text.copy-to-clipboard"))
45
45
  }];
46
46
  var onClick = function onClick(_ref) {
47
47
  var key = _ref.key;
@@ -51,7 +51,10 @@ var Deposit = function Deposit(props) {
51
51
  action({
52
52
  type: 'pisell1.sendPayLinkEmail',
53
53
  data: {
54
- id: id
54
+ id: id,
55
+ is_deposit: 1,
56
+ deposit_payment_time: bookingDetail.deposit_payment_time,
57
+ customer: bookingDetail.customer
55
58
  },
56
59
  callback: function callback() {}
57
60
  });
@@ -158,7 +158,7 @@ export default {
158
158
  'pisell2.text.deposit-paid': "Deposit paid",
159
159
  "pisell2.text.stock": "Stock",
160
160
  'pisell2.text.payment-link': "Payment link",
161
- 'pisell2.text.send-mail': "Send mail",
161
+ 'pisell2.text.send-mail': "Send email",
162
162
  'pisell2.text.copy-to-clipboard': "Copy to clipboard",
163
163
  'pisell2.text.ok': "OK",
164
164
  'pisell2.text.terminal-edit-message': "This operation cannot be performed. To proceed, please use the Pisell Terminal."
@@ -6,4 +6,5 @@ import BookingAddons from './booking/addons';
6
6
  import BookingForms from './booking/forms';
7
7
  import Schedules from './schedules';
8
8
  import ProductExtension from './productExtension';
9
- export { Login, BookingInfo, Booking, BookingNotes, BookingAddons, BookingForms, Schedules, ProductExtension };
9
+ import RuleSetting from './ruleSetting';
10
+ export { Login, BookingInfo, Booking, BookingNotes, BookingAddons, BookingForms, Schedules, ProductExtension, RuleSetting };
@@ -6,4 +6,5 @@ import BookingAddons from "./booking/addons";
6
6
  import BookingForms from "./booking/forms";
7
7
  import Schedules from "./schedules";
8
8
  import ProductExtension from "./productExtension";
9
- export { Login, BookingInfo, Booking, BookingNotes, BookingAddons, BookingForms, Schedules, ProductExtension };
9
+ import RuleSetting from "./ruleSetting";
10
+ export { Login, BookingInfo, Booking, BookingNotes, BookingAddons, BookingForms, Schedules, ProductExtension, RuleSetting };
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ interface ListComponentProps {
3
+ value?: any[];
4
+ onChange?: (value: any) => void;
5
+ renderItem?: (item: any, index: number, handleDeleteItem: (item: any) => void, handleOnChangeItem: (item: any, newValue: any) => void) => React.ReactNode;
6
+ renderAddButton?: (handleAddItem: () => void) => React.ReactNode;
7
+ maxLength?: number;
8
+ createItem?: (item: any) => any;
9
+ rowKey?: string;
10
+ className?: string;
11
+ style?: React.CSSProperties;
12
+ wrapClassName?: string;
13
+ }
14
+ declare const _default: React.ForwardRefExoticComponent<ListComponentProps & React.RefAttributes<unknown>>;
15
+ export default _default;
@@ -0,0 +1,75 @@
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
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
8
+ 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."); }
9
+ 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); }
10
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
11
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
12
+ 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; }
13
+ import React, { useImperativeHandle, forwardRef } from "react";
14
+ import classNames from "classnames";
15
+ import { getUniqueId } from "@pisell/utils";
16
+ var ListComponent = function ListComponent(_ref, ref) {
17
+ var _ref$value = _ref.value,
18
+ value = _ref$value === void 0 ? [] : _ref$value,
19
+ _ref$onChange = _ref.onChange,
20
+ onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
21
+ _ref$renderItem = _ref.renderItem,
22
+ renderItem = _ref$renderItem === void 0 ? function () {
23
+ return null;
24
+ } : _ref$renderItem,
25
+ _ref$renderAddButton = _ref.renderAddButton,
26
+ renderAddButton = _ref$renderAddButton === void 0 ? function () {
27
+ return null;
28
+ } : _ref$renderAddButton,
29
+ _ref$createItem = _ref.createItem,
30
+ createItem = _ref$createItem === void 0 ? function (item) {
31
+ return item;
32
+ } : _ref$createItem,
33
+ _ref$maxLength = _ref.maxLength,
34
+ maxLength = _ref$maxLength === void 0 ? 999 : _ref$maxLength,
35
+ _ref$rowKey = _ref.rowKey,
36
+ rowKey = _ref$rowKey === void 0 ? "_id" : _ref$rowKey,
37
+ className = _ref.className,
38
+ style = _ref.style,
39
+ wrapClassName = _ref.wrapClassName;
40
+ var handleAddItem = function handleAddItem(item) {
41
+ if (value.length < maxLength) {
42
+ // 添加新项的逻辑
43
+ onChange([].concat(_toConsumableArray(value), [createItem(_objectSpread(_defineProperty({}, rowKey, getUniqueId()), item))]));
44
+ }
45
+ };
46
+ var handleOnChangeItem = function handleOnChangeItem(item, newValue) {
47
+ onChange(value.map(function (d) {
48
+ if (d[rowKey] === item[rowKey]) {
49
+ return _objectSpread(_objectSpread({}, d), newValue);
50
+ }
51
+ return d;
52
+ }));
53
+ };
54
+ var handleDeleteItem = function handleDeleteItem(current) {
55
+ // 删除选定项的逻辑
56
+ onChange(value.filter(function (item) {
57
+ return item[rowKey] !== current[rowKey];
58
+ }));
59
+ };
60
+ useImperativeHandle(ref, function () {
61
+ return {
62
+ add: handleAddItem,
63
+ delete: handleDeleteItem
64
+ };
65
+ });
66
+ return /*#__PURE__*/React.createElement("div", {
67
+ className: classNames("list-component-wrap", wrapClassName)
68
+ }, /*#__PURE__*/React.createElement("ul", {
69
+ className: classNames("list-component-ul", className),
70
+ style: style
71
+ }, value.map(function (item, index) {
72
+ return renderItem(item, index, handleDeleteItem, handleOnChangeItem);
73
+ })), value.length < maxLength && renderAddButton(handleAddItem));
74
+ };
75
+ export default /*#__PURE__*/forwardRef(ListComponent);
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import "./index.less";
3
+ interface RuleSettingProps {
4
+ value: any;
5
+ onChange: any;
6
+ className: string;
7
+ style: any;
8
+ }
9
+ declare const RuleSetting: (props: RuleSettingProps) => React.JSX.Element;
10
+ export default RuleSetting;
@@ -0,0 +1,335 @@
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 _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
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
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."); }
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
+ 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; }
8
+ 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; }
9
+ 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; }
10
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
11
+ 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); }
12
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
13
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
14
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
15
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
16
+ 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."); }
17
+ 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); }
18
+ 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; }
19
+ 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; } }
20
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
+ import React, { useState, useEffect, useRef, useMemo } from "react";
22
+ import { Button, Select, Skeleton } from "antd";
23
+ import { CloseOutlined, PlusOutlined } from "@ant-design/icons";
24
+ import classNames from "classnames";
25
+ import ListComponent from "../listComponent";
26
+ import { getUniqueId } from "@pisell/utils";
27
+ import useEngineContext from "../../hooks/useEngineContext";
28
+ import "./index.less";
29
+ import RuleBorder from "./ruleBorder";
30
+ import { request } from "../../utils/index";
31
+ import { locales } from "@pisell/utils";
32
+ import { getStaffList, getProductChannel, getOrderTypes, getPaymentTypes } from "./server";
33
+ import localeTexts from "./locales";
34
+ var createRuleItem = function createRuleItem() {
35
+ return {
36
+ operator: "contain",
37
+ class: "type",
38
+ value: ["all"],
39
+ _id: getUniqueId()
40
+ };
41
+ };
42
+ locales.init(localeTexts, localStorage.getItem("umi_locale") || "en");
43
+ var RuleSetting = function RuleSetting(props) {
44
+ var _context$appHelper, _context$appHelper$ut;
45
+ var _props$value = props.value,
46
+ value = _props$value === void 0 ? {
47
+ rule: [],
48
+ type: "and"
49
+ } : _props$value,
50
+ _onChange = props.onChange,
51
+ className = props.className,
52
+ style = props.style;
53
+ console.log("valuevalue", value);
54
+ var context = useEngineContext();
55
+ if (context !== null && context !== void 0 && (_context$appHelper = context.appHelper) !== null && _context$appHelper !== void 0 && (_context$appHelper$ut = _context$appHelper.utils) !== null && _context$appHelper$ut !== void 0 && _context$appHelper$ut.request) {
56
+ request.setRequest(context.appHelper.utils.request);
57
+ }
58
+ var listRef = useRef(null);
59
+ var _useState = useState(false),
60
+ _useState2 = _slicedToArray(_useState, 2),
61
+ loading = _useState2[0],
62
+ setLoading = _useState2[1];
63
+ var _useState3 = useState([]),
64
+ _useState4 = _slicedToArray(_useState3, 2),
65
+ orderTypes = _useState4[0],
66
+ setOrderTypes = _useState4[1];
67
+ var _useState5 = useState([]),
68
+ _useState6 = _slicedToArray(_useState5, 2),
69
+ salesChannels = _useState6[0],
70
+ setSalesChannels = _useState6[1];
71
+ var _useState7 = useState([]),
72
+ _useState8 = _slicedToArray(_useState7, 2),
73
+ staffs = _useState8[0],
74
+ setStaffs = _useState8[1];
75
+ var _useState9 = useState([]),
76
+ _useState10 = _slicedToArray(_useState9, 2),
77
+ paymentMethods = _useState10[0],
78
+ setPaymentMethod = _useState10[1];
79
+ var init = /*#__PURE__*/function () {
80
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
81
+ var _getStaffList, _getProductChannel, _getOrderTypes, _getPaymentTypes, _yield$Promise$all, _yield$Promise$all2, staffs, clannels, orders, payments;
82
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
83
+ while (1) switch (_context.prev = _context.next) {
84
+ case 0:
85
+ _getStaffList = getStaffList();
86
+ _getProductChannel = getProductChannel();
87
+ _getOrderTypes = getOrderTypes();
88
+ _getPaymentTypes = getPaymentTypes();
89
+ _context.next = 6;
90
+ return Promise.all([_getStaffList, _getProductChannel, _getOrderTypes, _getPaymentTypes]);
91
+ case 6:
92
+ _yield$Promise$all = _context.sent;
93
+ _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 4);
94
+ staffs = _yield$Promise$all2[0];
95
+ clannels = _yield$Promise$all2[1];
96
+ orders = _yield$Promise$all2[2];
97
+ payments = _yield$Promise$all2[3];
98
+ setStaffs(staffs);
99
+ setSalesChannels(clannels);
100
+ setOrderTypes(orders);
101
+ setPaymentMethod(payments);
102
+ case 16:
103
+ case "end":
104
+ return _context.stop();
105
+ }
106
+ }, _callee);
107
+ }));
108
+ return function init() {
109
+ return _ref.apply(this, arguments);
110
+ };
111
+ }();
112
+ useEffect(function () {
113
+ document.body.id = "body";
114
+ init();
115
+ }, []);
116
+ var config = useMemo(function () {
117
+ return {
118
+ type: {
119
+ key: "type",
120
+ style: {
121
+ width: 200
122
+ },
123
+ size: "large",
124
+ options: [{
125
+ label: locales.getText("pisell2.text.rule-setting.order_type"),
126
+ value: "type",
127
+ list: orderTypes
128
+ }, {
129
+ label: locales.getText("pisell2.text.rule-setting.sales_channel"),
130
+ value: "platform",
131
+ list: salesChannels
132
+ }, {
133
+ label: locales.getText("pisell2.text.rule-setting.staff"),
134
+ value: "staff",
135
+ list: staffs
136
+ }, {
137
+ label: locales.getText("pisell2.text.rule-setting.payment_method"),
138
+ value: "payment_method",
139
+ list: paymentMethods
140
+ }, {
141
+ label: locales.getText("pisell2.text.rule-setting.pisell_terminal_device"),
142
+ value: "pos",
143
+ list: [{
144
+ label: locales.getText("pisell2.text.rule-setting.current_device"),
145
+ value: "current"
146
+ }]
147
+ }]
148
+ },
149
+ rule: {
150
+ key: "rule",
151
+ style: {
152
+ width: 100
153
+ },
154
+ size: "large",
155
+ options: [{
156
+ label: locales.getText("pisell2.text.rule-setting.Contain"),
157
+ value: "contain"
158
+ }, {
159
+ label: locales.getText("pisell2.text.rule-setting.Exclude"),
160
+ value: "exclude"
161
+ }]
162
+ },
163
+ options: {
164
+ key: "options",
165
+ style: {
166
+ flex: 1
167
+ },
168
+ size: "large",
169
+ mode: "multiple"
170
+ }
171
+ };
172
+ }, [staffs, salesChannels, orderTypes, paymentMethods]);
173
+ var handleAddItem = function handleAddItem(item) {
174
+ var _item = _objectSpread({}, item);
175
+ _item.rule.push(createRuleItem());
176
+ return _item;
177
+ };
178
+ var updateRuleItem = function updateRuleItem(item, cId, val) {
179
+ var _item = _objectSpread(_objectSpread({}, item), {}, {
180
+ rule: item.rule.map(function (d) {
181
+ if (d._id === cId) {
182
+ return _objectSpread(_objectSpread({}, d), val);
183
+ }
184
+ return d;
185
+ })
186
+ });
187
+ return _item;
188
+ };
189
+ var filterAllOption = function filterAllOption(list, current) {
190
+ var _list = _toConsumableArray(list || []);
191
+
192
+ // 不包含 all
193
+ if (!_list.includes("all")) {
194
+ return _list;
195
+ }
196
+
197
+ // 只有 all
198
+ if (_list.length === 1) {
199
+ return _list;
200
+ }
201
+
202
+ // 当前选中的包含 all 并且 上一次的值里没有 all , 证明当前选择的是 all
203
+ if (!(current || []).includes("all")) {
204
+ return ["all"];
205
+ }
206
+ return _list.filter(function (d) {
207
+ return d !== "all";
208
+ });
209
+ };
210
+ return /*#__PURE__*/React.createElement(Skeleton, {
211
+ round: true,
212
+ active: true,
213
+ loading: loading,
214
+ className: className,
215
+ style: style
216
+ }, /*#__PURE__*/React.createElement("div", {
217
+ className: "rule-setting-wrap"
218
+ }, value.rule.length > 1 ? /*#__PURE__*/React.createElement(RuleBorder, {
219
+ value: value.type,
220
+ onChange: function onChange(e) {
221
+ _onChange(_objectSpread(_objectSpread({}, value), {}, {
222
+ type: e
223
+ }));
224
+ },
225
+ startDomClassName: "rule-setting-item-".concat(value.rule[0]._id),
226
+ endDomClassName: "rule-setting-item-".concat(value.rule[value.rule.length - 1]._id)
227
+ }) : null, /*#__PURE__*/React.createElement(ListComponent, {
228
+ ref: listRef,
229
+ value: value.rule,
230
+ onChange: function onChange(rule) {
231
+ _onChange(_objectSpread(_objectSpread({}, value), {}, {
232
+ rule: rule
233
+ }));
234
+ },
235
+ rowKey: "_id",
236
+ wrapClassName: "rule-setting-list",
237
+ createItem: function createItem(item) {
238
+ return _objectSpread(_objectSpread({}, item), {}, {
239
+ type: "and",
240
+ rule: [{
241
+ _id: "-1",
242
+ class: "type",
243
+ operator: "contain",
244
+ value: ["all"]
245
+ }]
246
+ });
247
+ },
248
+ renderItem: function renderItem(item, index, remove, update) {
249
+ return /*#__PURE__*/React.createElement("div", {
250
+ className: classNames("rule-setting-item", "rule-setting-item-".concat(item._id)),
251
+ key: item._id
252
+ }, /*#__PURE__*/React.createElement("div", {
253
+ className: "rule-setting-item-header"
254
+ }, /*#__PURE__*/React.createElement("div", {
255
+ className: "rule-setting-item-title"
256
+ }, locales.getText("pisell2.text.satisfy_any_condition")), /*#__PURE__*/React.createElement("div", {
257
+ className: "rule-setting-item-btns"
258
+ }, /*#__PURE__*/React.createElement(PlusOutlined, {
259
+ className: "rule-setting-item-btn",
260
+ onClick: function onClick() {
261
+ update(item, handleAddItem(item));
262
+ }
263
+ }), value.rule.length > 1 ? /*#__PURE__*/React.createElement(CloseOutlined, {
264
+ className: "rule-setting-item-btn",
265
+ onClick: function onClick() {
266
+ remove(item);
267
+ }
268
+ }) : null)), /*#__PURE__*/React.createElement("div", {
269
+ className: "rule-setting-item-body"
270
+ }, item.rule.length > 1 ? /*#__PURE__*/React.createElement(RuleBorder, {
271
+ value: item.type,
272
+ onChange: function onChange(e) {
273
+ update(item, _objectSpread(_objectSpread({}, item), {}, {
274
+ type: e
275
+ }));
276
+ },
277
+ startDomClassName: "rule-setting-item-body-item-".concat(item.rule[0]._id),
278
+ endDomClassName: "rule-setting-item-body-item-".concat(item.rule[item.rule.length - 1]._id)
279
+ }) : null, /*#__PURE__*/React.createElement("div", {
280
+ className: "rule-setting-item-body-list"
281
+ }, item.rule.map(function (rule) {
282
+ var _config$type$options$;
283
+ return /*#__PURE__*/React.createElement("div", {
284
+ className: classNames("rule-setting-item-body-item", "rule-setting-item-body-item-".concat(rule._id)),
285
+ key: rule._id
286
+ }, /*#__PURE__*/React.createElement(Select, _extends({}, config.type, {
287
+ value: rule.class,
288
+ onChange: function onChange(e) {
289
+ update(item, updateRuleItem(item, rule._id, {
290
+ class: e,
291
+ value: ["all"]
292
+ }));
293
+ }
294
+ })), /*#__PURE__*/React.createElement(Select, _extends({}, config.rule, {
295
+ value: rule.operator,
296
+ onChange: function onChange(e) {
297
+ update(item, updateRuleItem(item, rule._id, {
298
+ operator: e
299
+ }));
300
+ }
301
+ })), /*#__PURE__*/React.createElement(Select, _extends({}, config.options, {
302
+ options: ((_config$type$options$ = config.type.options.find(function (d) {
303
+ return d.value === rule.class;
304
+ })) === null || _config$type$options$ === void 0 ? void 0 : _config$type$options$.list) || [],
305
+ value: rule.value,
306
+ onChange: function onChange(e, option) {
307
+ console.log("options", option);
308
+ update(item, updateRuleItem(item, rule._id, {
309
+ value: filterAllOption(e, rule.value)
310
+ }));
311
+ }
312
+ })), item.rule.length > 1 ? /*#__PURE__*/React.createElement(CloseOutlined, {
313
+ onClick: function onClick() {
314
+ update(item, _objectSpread(_objectSpread({}, item), {}, {
315
+ rule: item.rule.filter(function (d) {
316
+ return d._id !== rule._id;
317
+ })
318
+ }));
319
+ }
320
+ }) : null);
321
+ }))));
322
+ },
323
+ renderAddButton: function renderAddButton() {
324
+ return null;
325
+ }
326
+ })), /*#__PURE__*/React.createElement("div", {
327
+ className: classNames("rule-setting-add-button-wrap", _defineProperty({}, "rule-setting-add-button-wrap-padding", value.rule.length > 1))
328
+ }, /*#__PURE__*/React.createElement(Button, {
329
+ size: "large",
330
+ onClick: function onClick() {
331
+ listRef.current.add();
332
+ }
333
+ }, locales.getText("pisell2.text.add"))));
334
+ };
335
+ export default RuleSetting;