@pisell/materials 2.2.28 → 2.2.30

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 (100) 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 +2 -2
  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 +13 -13
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +19 -19
  11. package/es/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.d.ts +10 -0
  12. package/es/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.js +62 -0
  13. package/es/components/pisellAdjustPrice/index.d.ts +10 -0
  14. package/es/components/pisellAdjustPrice/index.js +148 -0
  15. package/es/components/pisellAdjustPrice/index.less +30 -0
  16. package/es/components/pisellFloatingPanel/index.d.ts +17 -0
  17. package/es/components/pisellFloatingPanel/index.js +89 -0
  18. package/es/components/pisellFloatingPanel/index.less +30 -0
  19. package/es/components/pisellStatisticList/index.d.ts +18 -0
  20. package/es/components/pisellStatisticList/index.js +67 -0
  21. package/es/components/pisellStatisticList/index.less +47 -0
  22. package/es/components/segmented/index.d.ts +1 -0
  23. package/es/components/segmented/index.js +1 -0
  24. package/es/components/segmented/index.less +3 -0
  25. package/es/components/virtual-keyboard/Amount/index.d.ts +22 -0
  26. package/es/components/virtual-keyboard/Amount/index.js +65 -0
  27. package/es/components/virtual-keyboard/BaseNumberKeyboard/Presets.d.ts +12 -0
  28. package/es/components/virtual-keyboard/BaseNumberKeyboard/Presets.js +22 -0
  29. package/es/components/virtual-keyboard/BaseNumberKeyboard/Presets.less +18 -0
  30. package/es/components/virtual-keyboard/BaseNumberKeyboard/index.d.ts +19 -0
  31. package/es/components/virtual-keyboard/BaseNumberKeyboard/index.js +213 -0
  32. package/es/components/virtual-keyboard/BaseNumberKeyboard/index.less +9 -0
  33. package/es/components/virtual-keyboard/Keyboard/index.d.ts +8 -6
  34. package/es/components/virtual-keyboard/Keyboard/index.js +59 -15
  35. package/es/components/virtual-keyboard/Keyboard/index.less +35 -24
  36. package/es/components/virtual-keyboard/Number/index.d.ts +14 -0
  37. package/es/components/virtual-keyboard/Number/index.js +35 -0
  38. package/es/components/virtual-keyboard/VirtualInput/index.d.ts +9 -0
  39. package/es/components/virtual-keyboard/VirtualInput/index.js +41 -0
  40. package/es/components/virtual-keyboard/VirtualInput/index.less +46 -0
  41. package/es/components/virtual-keyboard/VirtualKeyInput/index.d.ts +6 -3
  42. package/es/components/virtual-keyboard/VirtualKeyInput/index.js +27 -20
  43. package/es/index.d.ts +6 -0
  44. package/es/index.js +7 -1
  45. package/es/locales/en-US.d.ts +6 -0
  46. package/es/locales/en-US.js +8 -1
  47. package/es/locales/zh-CN.d.ts +6 -0
  48. package/es/locales/zh-CN.js +8 -1
  49. package/es/locales/zh-TW.d.ts +6 -0
  50. package/es/locales/zh-TW.js +8 -1
  51. package/lib/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.d.ts +10 -0
  52. package/lib/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.js +84 -0
  53. package/lib/components/pisellAdjustPrice/index.d.ts +10 -0
  54. package/lib/components/pisellAdjustPrice/index.js +156 -0
  55. package/lib/components/pisellAdjustPrice/index.less +30 -0
  56. package/lib/components/pisellFloatingPanel/index.d.ts +17 -0
  57. package/lib/components/pisellFloatingPanel/index.js +113 -0
  58. package/lib/components/pisellFloatingPanel/index.less +30 -0
  59. package/lib/components/pisellStatisticList/index.d.ts +18 -0
  60. package/lib/components/pisellStatisticList/index.js +109 -0
  61. package/lib/components/pisellStatisticList/index.less +47 -0
  62. package/lib/components/segmented/index.d.ts +1 -0
  63. package/lib/components/segmented/index.js +1 -0
  64. package/lib/components/segmented/index.less +3 -0
  65. package/lib/components/virtual-keyboard/Amount/index.d.ts +22 -0
  66. package/lib/components/virtual-keyboard/Amount/index.js +96 -0
  67. package/lib/components/virtual-keyboard/BaseNumberKeyboard/Presets.d.ts +12 -0
  68. package/lib/components/virtual-keyboard/BaseNumberKeyboard/Presets.js +46 -0
  69. package/lib/components/virtual-keyboard/BaseNumberKeyboard/Presets.less +18 -0
  70. package/lib/components/virtual-keyboard/BaseNumberKeyboard/index.d.ts +19 -0
  71. package/lib/components/virtual-keyboard/BaseNumberKeyboard/index.js +245 -0
  72. package/lib/components/virtual-keyboard/BaseNumberKeyboard/index.less +9 -0
  73. package/lib/components/virtual-keyboard/Keyboard/index.d.ts +8 -6
  74. package/lib/components/virtual-keyboard/Keyboard/index.js +51 -4
  75. package/lib/components/virtual-keyboard/Keyboard/index.less +35 -24
  76. package/lib/components/virtual-keyboard/Number/index.d.ts +14 -0
  77. package/lib/components/virtual-keyboard/Number/index.js +65 -0
  78. package/lib/components/virtual-keyboard/VirtualInput/index.d.ts +9 -0
  79. package/lib/components/virtual-keyboard/VirtualInput/index.js +63 -0
  80. package/lib/components/virtual-keyboard/VirtualInput/index.less +46 -0
  81. package/lib/components/virtual-keyboard/VirtualKeyInput/index.d.ts +6 -3
  82. package/lib/components/virtual-keyboard/VirtualKeyInput/index.js +20 -11
  83. package/lib/index.d.ts +6 -0
  84. package/lib/index.js +18 -0
  85. package/lib/locales/en-US.d.ts +6 -0
  86. package/lib/locales/en-US.js +8 -1
  87. package/lib/locales/zh-CN.d.ts +6 -0
  88. package/lib/locales/zh-CN.js +8 -1
  89. package/lib/locales/zh-TW.d.ts +6 -0
  90. package/lib/locales/zh-TW.js +8 -1
  91. package/lowcode/input/meta.ts +25 -0
  92. package/lowcode/pisell-adjust-price/meta.ts +58 -0
  93. package/lowcode/pisell-adjust-price/snippets.ts +10 -0
  94. package/lowcode/pisell-adjust-price-input-number/meta.ts +245 -0
  95. package/lowcode/pisell-floating-panel/meta.ts +232 -0
  96. package/lowcode/pisell-modal.information/meta.ts +5 -0
  97. package/lowcode/pisell-number-keyboard/meta.ts +98 -0
  98. package/lowcode/pisell-price-keyboard/meta.ts +174 -0
  99. package/lowcode/pisell-statistic-list/meta.ts +264 -0
  100. package/package.json +3 -3
@@ -5,43 +5,50 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
5
5
  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; }
6
6
  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; } }
7
7
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
- import React, { useEffect, useState } from "react";
9
- import { Input } from "antd";
10
- import Delete from "@pisell/icon/es/Delete";
11
- import { useEventListener } from "ahooks";
12
- import classNames from "classnames";
8
+ import React, { useState } from 'react';
9
+ import { Input } from 'antd';
10
+ import Delete from '@pisell/icon/es/Delete';
11
+ import { useEventListener, useUpdateEffect } from 'ahooks';
12
+ import classNames from 'classnames';
13
13
  import "./index.less";
14
- var list = ["Backspace"];
14
+ var list = ['Backspace'];
15
15
  var VirtualKeyInput = function VirtualKeyInput(props) {
16
+ var _ref;
16
17
  var _props$previewValue = props.previewValue,
17
18
  previewValue = _props$previewValue === void 0 ? props.value : _props$previewValue,
18
- value = props.value;
19
- var _useState = useState(false),
19
+ value = props.value,
20
+ _props$showDelete = props.showDelete,
21
+ showDelete = _props$showDelete === void 0 ? true : _props$showDelete,
22
+ onValueSelect = props.onValueSelect,
23
+ defaultSelect = props.defaultSelect;
24
+ var _useState = useState(defaultSelect !== null && defaultSelect !== void 0 ? defaultSelect : false),
20
25
  _useState2 = _slicedToArray(_useState, 2),
21
26
  select = _useState2[0],
22
27
  setSelect = _useState2[1];
23
- useEventListener("keydown", function (ev) {
28
+ useEventListener('keydown', function (ev) {
24
29
  if (list.includes(ev.key)) {
25
30
  _onDelete === null || _onDelete === void 0 ? void 0 : _onDelete();
26
31
  }
27
32
  });
28
- useEffect(function () {
29
- if (value) {
30
- setSelect(false);
31
- }
33
+ var handleSelectChange = function handleSelectChange(selected) {
34
+ onValueSelect === null || onValueSelect === void 0 ? void 0 : onValueSelect(selected);
35
+ setSelect(selected);
36
+ };
37
+ useUpdateEffect(function () {
38
+ handleSelectChange(false);
32
39
  }, [value]);
33
40
  var _onDelete = function _onDelete() {
34
41
  if (select) {
35
42
  var _props$onChange;
36
43
  (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
37
44
  target: {
38
- value: ""
45
+ value: ''
39
46
  }
40
47
  });
41
- setSelect(false);
48
+ handleSelectChange(false);
42
49
  return;
43
50
  }
44
- var _val = props.value + "";
51
+ var _val = props.value + '';
45
52
  _val = _val.slice(0, _val.length - 1);
46
53
  props.onChange && props.onChange({
47
54
  target: {
@@ -52,12 +59,12 @@ var VirtualKeyInput = function VirtualKeyInput(props) {
52
59
  return /*#__PURE__*/React.createElement("div", {
53
60
  className: "virtual-keyboard-input-wrap"
54
61
  }, props.renderInput ? /*#__PURE__*/React.createElement("div", {
55
- className: classNames("virtual-keyboard-input", {
56
- "virtual-keyboard-input-select": select
62
+ className: classNames('virtual-keyboard-input', {
63
+ 'virtual-keyboard-input-select': select
57
64
  }),
58
65
  onClick: function onClick() {
59
66
  if (value) {
60
- setSelect(!select);
67
+ handleSelectChange(!select);
61
68
  }
62
69
  }
63
70
  }, props.renderInput(props)) : /*#__PURE__*/React.createElement(Input, _extends({
@@ -66,7 +73,7 @@ var VirtualKeyInput = function VirtualKeyInput(props) {
66
73
  }, props, {
67
74
  readOnly: true,
68
75
  value: previewValue
69
- })), value !== null && value !== void 0 && value.length ? /*#__PURE__*/React.createElement("div", {
76
+ })), (_ref = "".concat(value !== null && value !== void 0 ? value : "")) !== null && _ref !== void 0 && _ref.length && showDelete ? /*#__PURE__*/React.createElement("div", {
70
77
  className: "virtual-keyboard-input-delete",
71
78
  onClick: _onDelete
72
79
  }, /*#__PURE__*/React.createElement(Delete, {
package/es/index.d.ts CHANGED
@@ -102,3 +102,9 @@ export { default as PisellCard } from './components/pisellCard';
102
102
  export { default as PisellInformationEntry } from './components/pisellInformationEntry';
103
103
  export { default as usePisellConfig } from './components/pisell-config-provider/hooks/usePisellConfig';
104
104
  export { globalConfig, default as PisellContext } from './components/pisell-config-provider/context';
105
+ export { default as PisellPriceKeyboard } from './components/virtual-keyboard/Amount';
106
+ export { default as PisellNumberKeyboard } from './components/virtual-keyboard/Number';
107
+ export { default as PisellAdjustPrice } from './components/pisellAdjustPrice';
108
+ export { default as PisellAdjustPriceInputNumber } from './components/pisellAdjustPrice/PisellAdjustPriceInputNumber';
109
+ export { default as PisellStatisticList } from './components/pisellStatisticList';
110
+ export { default as PisellFloatingPanel } from './components/pisellFloatingPanel';
package/es/index.js CHANGED
@@ -123,4 +123,10 @@ export { default as PisellAlert } from "./components/pisellAlert";
123
123
  export { default as PisellCard } from "./components/pisellCard";
124
124
  export { default as PisellInformationEntry } from "./components/pisellInformationEntry";
125
125
  export { default as usePisellConfig } from "./components/pisell-config-provider/hooks/usePisellConfig";
126
- export { globalConfig, default as PisellContext } from "./components/pisell-config-provider/context";
126
+ export { globalConfig, default as PisellContext } from "./components/pisell-config-provider/context";
127
+ export { default as PisellPriceKeyboard } from "./components/virtual-keyboard/Amount";
128
+ export { default as PisellNumberKeyboard } from "./components/virtual-keyboard/Number";
129
+ export { default as PisellAdjustPrice } from "./components/pisellAdjustPrice";
130
+ export { default as PisellAdjustPriceInputNumber } from "./components/pisellAdjustPrice/PisellAdjustPriceInputNumber";
131
+ export { default as PisellStatisticList } from "./components/pisellStatisticList";
132
+ export { default as PisellFloatingPanel } from "./components/pisellFloatingPanel";
@@ -106,5 +106,11 @@ declare const _default: {
106
106
  'pisell-wallet-pass-card-redeem': string;
107
107
  'pisell-wallet-pass-card-balance': string;
108
108
  'pisell-wallet-pass-card-valid-to': string;
109
+ 'pisell-adjust-price-price-override': string;
110
+ 'pisell-adjust-price-discount': string;
111
+ 'pisell-adjust-price-discount-amount': string;
112
+ 'pisell-adjust-price-discount-percentage': string;
113
+ 'pisell-adjust-price-total-after-discount': string;
114
+ 'pisell-adjust-price-discount-can-be-maximum': string;
109
115
  };
110
116
  export default _default;
@@ -130,5 +130,12 @@ export default {
130
130
  'pisell-wallet-pass-card-detail': 'Detail',
131
131
  'pisell-wallet-pass-card-redeem': 'Redeem',
132
132
  'pisell-wallet-pass-card-balance': 'Balance',
133
- 'pisell-wallet-pass-card-valid-to': 'Valid to'
133
+ 'pisell-wallet-pass-card-valid-to': 'Valid to',
134
+ // 金额修改组件
135
+ 'pisell-adjust-price-price-override': "Price override",
136
+ 'pisell-adjust-price-discount': "Discount",
137
+ 'pisell-adjust-price-discount-amount': "Amount",
138
+ 'pisell-adjust-price-discount-percentage': "Percentage",
139
+ 'pisell-adjust-price-total-after-discount': "Total after discount: ",
140
+ 'pisell-adjust-price-discount-can-be-maximum': "Discount can be maximum"
134
141
  };
@@ -106,5 +106,11 @@ declare const _default: {
106
106
  'pisell-wallet-pass-card-redeem': string;
107
107
  'pisell-wallet-pass-card-balance': string;
108
108
  'pisell-wallet-pass-card-valid-to': string;
109
+ 'pisell-adjust-price-price-override': string;
110
+ 'pisell-adjust-price-discount': string;
111
+ 'pisell-adjust-price-discount-amount': string;
112
+ 'pisell-adjust-price-discount-percentage': string;
113
+ 'pisell-adjust-price-total-after-discount': string;
114
+ 'pisell-adjust-price-discount-can-be-maximum': string;
109
115
  };
110
116
  export default _default;
@@ -130,5 +130,12 @@ export default {
130
130
  'pisell-wallet-pass-card-detail': '详情',
131
131
  'pisell-wallet-pass-card-redeem': '兑换',
132
132
  'pisell-wallet-pass-card-balance': '余额',
133
- 'pisell-wallet-pass-card-valid-to': '有效期至'
133
+ 'pisell-wallet-pass-card-valid-to': '有效期至',
134
+ // 金额修改组件
135
+ 'pisell-adjust-price-price-override': "一口价",
136
+ 'pisell-adjust-price-discount': "折扣",
137
+ 'pisell-adjust-price-discount-amount': "金额",
138
+ 'pisell-adjust-price-discount-percentage': "百分比",
139
+ 'pisell-adjust-price-total-after-discount': "打折后总价",
140
+ 'pisell-adjust-price-discount-can-be-maximum': "折扣最高可达"
134
141
  };
@@ -106,5 +106,11 @@ declare const _default: {
106
106
  'pisell-wallet-pass-card-redeem': string;
107
107
  'pisell-wallet-pass-card-balance': string;
108
108
  'pisell-wallet-pass-card-valid-to': string;
109
+ 'pisell-adjust-price-price-override': string;
110
+ 'pisell-adjust-price-discount': string;
111
+ 'pisell-adjust-price-discount-amount': string;
112
+ 'pisell-adjust-price-discount-percentage': string;
113
+ 'pisell-adjust-price-total-after-discount': string;
114
+ 'pisell-adjust-price-discount-can-be-maximum': string;
109
115
  };
110
116
  export default _default;
@@ -130,5 +130,12 @@ export default {
130
130
  'pisell-wallet-pass-card-detail': '詳情',
131
131
  'pisell-wallet-pass-card-redeem': '兌換',
132
132
  'pisell-wallet-pass-card-balance': '餘額',
133
- 'pisell-wallet-pass-card-valid-to': '有效期至'
133
+ 'pisell-wallet-pass-card-valid-to': '有效期至',
134
+ // 金额修改组件
135
+ 'pisell-adjust-price-price-override': "一口價",
136
+ 'pisell-adjust-price-discount': "折扣",
137
+ 'pisell-adjust-price-discount-amount': "金額",
138
+ 'pisell-adjust-price-discount-percentage': "百分比",
139
+ 'pisell-adjust-price-total-after-discount': "打折后總價",
140
+ 'pisell-adjust-price-discount-can-be-maximum': "折扣最高可達"
134
141
  };
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { InputNumberProps } from 'antd/es/input-number';
3
+ export interface PisellAdjustPriceInputNumberProps extends Omit<InputNumberProps, 'onChange'> {
4
+ value?: number;
5
+ originValue: number;
6
+ defaultValue?: number;
7
+ onChange?: (val: number) => void;
8
+ }
9
+ declare const PisellAdjustPriceInputNumber: (props: PisellAdjustPriceInputNumberProps) => React.JSX.Element;
10
+ export default PisellAdjustPriceInputNumber;
@@ -0,0 +1,84 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.tsx
30
+ var PisellAdjustPriceInputNumber_exports = {};
31
+ __export(PisellAdjustPriceInputNumber_exports, {
32
+ default: () => PisellAdjustPriceInputNumber_default
33
+ });
34
+ module.exports = __toCommonJS(PisellAdjustPriceInputNumber_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
37
+ var import_index = __toESM(require("./index"));
38
+ var PisellAdjustPriceInputNumber = (props) => {
39
+ const { value, onChange, originValue, size, prefix, disabled, ...others } = props;
40
+ const [open, setOpen] = (0, import_react.useState)(false);
41
+ const handleChange = (val) => {
42
+ setOpen(false);
43
+ onChange == null ? void 0 : onChange(Number(val.toFixed(2)));
44
+ };
45
+ const content = (0, import_react.useMemo)(() => {
46
+ return /* @__PURE__ */ import_react.default.createElement(
47
+ import_index.default,
48
+ {
49
+ key: `${open}`,
50
+ originValue,
51
+ defaultValue: value,
52
+ value,
53
+ onChange: handleChange
54
+ }
55
+ );
56
+ }, [originValue, value, open]);
57
+ return /* @__PURE__ */ import_react.default.createElement(
58
+ import_antd.Popover,
59
+ {
60
+ open,
61
+ content,
62
+ trigger: ["click"],
63
+ overlayInnerStyle: { padding: 0 },
64
+ onOpenChange: (val) => setOpen(val),
65
+ destroyTooltipOnHide: true,
66
+ arrow: false,
67
+ align: {
68
+ offset: [0, 20]
69
+ }
70
+ },
71
+ /* @__PURE__ */ import_react.default.createElement("span", null, /* @__PURE__ */ import_react.default.createElement(
72
+ import_antd.InputNumber,
73
+ {
74
+ ...others,
75
+ disabled,
76
+ prefix,
77
+ size: size || "large",
78
+ value,
79
+ readOnly: true
80
+ }
81
+ ))
82
+ );
83
+ };
84
+ var PisellAdjustPriceInputNumber_default = PisellAdjustPriceInputNumber;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export interface PisellAdjustPriceProps {
4
+ value?: number;
5
+ originValue: number;
6
+ defaultValue?: number;
7
+ onChange?: (val: number) => void;
8
+ }
9
+ declare const PisellAdjustPrice: (props: PisellAdjustPriceProps) => React.JSX.Element;
10
+ export default PisellAdjustPrice;
@@ -0,0 +1,156 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/pisellAdjustPrice/index.tsx
30
+ var pisellAdjustPrice_exports = {};
31
+ __export(pisellAdjustPrice_exports, {
32
+ default: () => pisellAdjustPrice_default
33
+ });
34
+ module.exports = __toCommonJS(pisellAdjustPrice_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
37
+ var import_classnames = __toESM(require("classnames"));
38
+ var import_pisellText = __toESM(require("../pisellText"));
39
+ var import_Amount = __toESM(require("../virtual-keyboard/Amount"));
40
+ var import_locales = require("../../locales");
41
+ var import_index = require("./index.less");
42
+ var import_usePisellConfig = __toESM(require("../pisell-config-provider/hooks/usePisellConfig"));
43
+ var PisellAdjustPrice = (props) => {
44
+ const { value, onChange, defaultValue, originValue, ...others } = props;
45
+ const config = (0, import_usePisellConfig.default)();
46
+ const [newValue, setNewValue] = (0, import_react.useState)(value || 0);
47
+ const [updateMode, setUpdateMode] = (0, import_react.useState)(
48
+ "priceOverride"
49
+ );
50
+ const [discountMode, setDiscountMode] = (0, import_react.useState)(
51
+ "amount"
52
+ );
53
+ (0, import_react.useEffect)(() => {
54
+ document.body.id = "body";
55
+ }, []);
56
+ const handleEnter = () => {
57
+ if (isDiscountError) {
58
+ return;
59
+ }
60
+ if (updateMode === "priceOverride") {
61
+ onChange == null ? void 0 : onChange(Number(newValue));
62
+ } else {
63
+ onChange == null ? void 0 : onChange(Number(totalAfterDiscount));
64
+ }
65
+ };
66
+ const handleChange = (val) => {
67
+ setNewValue(val);
68
+ };
69
+ const totalAfterDiscount = (0, import_react.useMemo)(() => {
70
+ if (discountMode === "amount") {
71
+ return originValue - Number(newValue || 0);
72
+ }
73
+ return originValue - originValue * (Number(newValue || 0) / 100);
74
+ }, [originValue, newValue, discountMode]);
75
+ const isDiscountError = (0, import_react.useMemo)(() => {
76
+ if (updateMode === "priceOverride") {
77
+ return false;
78
+ }
79
+ return totalAfterDiscount < 0;
80
+ }, [updateMode, totalAfterDiscount]);
81
+ const handleUpdateMode = (val) => {
82
+ setUpdateMode(val);
83
+ setNewValue(val === "priceOverride" ? value || 0 : "");
84
+ };
85
+ const inputFormat = (v) => {
86
+ if (updateMode === "priceOverride") {
87
+ return null;
88
+ }
89
+ if (discountMode === "amount") {
90
+ return null;
91
+ } else {
92
+ return `${v}%`;
93
+ }
94
+ };
95
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-adjust-price-wrap" }, /* @__PURE__ */ import_react.default.createElement(
96
+ import_antd.Segmented,
97
+ {
98
+ size: "large",
99
+ options: [
100
+ {
101
+ label: (0, import_locales.getText)("pisell-adjust-price-price-override"),
102
+ value: "priceOverride"
103
+ },
104
+ { label: (0, import_locales.getText)("pisell-adjust-price-discount"), value: "discount" }
105
+ ],
106
+ value: updateMode,
107
+ onChange: handleUpdateMode,
108
+ block: true
109
+ }
110
+ ), updateMode === "discount" && /* @__PURE__ */ import_react.default.createElement(
111
+ import_antd.Segmented,
112
+ {
113
+ size: "large",
114
+ options: [
115
+ {
116
+ label: `${(0, import_locales.getText)("pisell-adjust-price-discount-amount")}(${(config == null ? void 0 : config.symbol) || "$"})`,
117
+ value: "amount"
118
+ },
119
+ {
120
+ label: `${(0, import_locales.getText)("pisell-adjust-price-discount-percentage")}(%)`,
121
+ value: "percentage"
122
+ }
123
+ ],
124
+ value: discountMode,
125
+ onChange: (val) => {
126
+ setNewValue("");
127
+ setDiscountMode(val);
128
+ },
129
+ block: true
130
+ }
131
+ ), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-adjust-price-amount-wrap" }, /* @__PURE__ */ import_react.default.createElement(
132
+ import_Amount.default,
133
+ {
134
+ ...others,
135
+ inputFormat,
136
+ defaultValue: updateMode === "priceOverride" ? defaultValue : "",
137
+ key: updateMode,
138
+ value: newValue,
139
+ defaultSelect: updateMode === "priceOverride",
140
+ onChange: handleChange,
141
+ onEnter: handleEnter,
142
+ placeholder: discountMode === "amount" ? "0" : "%"
143
+ }
144
+ )), updateMode === "discount" && /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-low-code-adjust-price-total" }, isDiscountError ? /* @__PURE__ */ import_react.default.createElement(import_pisellText.default.Amount, { value: originValue }) : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, newValue && (0, import_locales.getText)("pisell-adjust-price-total-after-discount"), /* @__PURE__ */ import_react.default.createElement(import_pisellText.default.Amount, { value: totalAfterDiscount }))), /* @__PURE__ */ import_react.default.createElement(
145
+ "div",
146
+ {
147
+ className: (0, import_classnames.default)("pisell-low-code-adjust-price-amount-desc", {
148
+ ["pisell-low-code-adjust-price-amount-desc-error"]: isDiscountError
149
+ })
150
+ },
151
+ (0, import_locales.getText)("pisell-adjust-price-discount-can-be-maximum"),
152
+ " ",
153
+ discountMode === "amount" ? /* @__PURE__ */ import_react.default.createElement(import_pisellText.default.Amount, { value: originValue }) : "100%"
154
+ )));
155
+ };
156
+ var pisellAdjustPrice_default = PisellAdjustPrice;
@@ -0,0 +1,30 @@
1
+ .pisell-lowcode-adjust-price-wrap {
2
+ width: 380px;
3
+ border-radius: 10px;
4
+ background-color: #fff;
5
+ padding: 10px;
6
+ display: flex;
7
+ flex-direction: column;
8
+ gap: 10px;
9
+ .pisell-lowcode-adjust-price-amount-wrap {
10
+ padding: 10px;
11
+ border-radius: 10px;
12
+ background: var(--Gray-300, #D0D5DD);
13
+ }
14
+ .pisell-low-code-adjust-price-total {
15
+ color: var(--Gray-900, #101828);
16
+ font-size: 20px;
17
+ font-weight: 600;
18
+ line-height: 30px; /* 150% */
19
+ }
20
+ .pisell-low-code-adjust-price-amount-desc {
21
+ color: var(--Gray-500, #667085);
22
+ font-size: 16px;
23
+ font-style: normal;
24
+ font-weight: 400;
25
+ line-height: 24px; /* 150% */
26
+ }
27
+ .pisell-low-code-adjust-price-amount-desc-error {
28
+ color: var(--Error-600, #D92D20);
29
+ }
30
+ }
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export interface PisellFloatingPanelProps {
4
+ fullHeight?: string | number;
5
+ retractHeight?: string | number;
6
+ width?: string | number;
7
+ open?: boolean;
8
+ onOpenChange?: (open: boolean) => void;
9
+ defaultOpen?: boolean;
10
+ isFloat?: boolean;
11
+ children?: React.ReactNode;
12
+ retractSlot?: React.ReactNode;
13
+ style?: React.CSSProperties;
14
+ retractIconStyle?: React.CSSProperties;
15
+ }
16
+ declare const PisellFloatingPanel: (props: PisellFloatingPanelProps) => React.JSX.Element;
17
+ export default PisellFloatingPanel;
@@ -0,0 +1,113 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/pisellFloatingPanel/index.tsx
30
+ var pisellFloatingPanel_exports = {};
31
+ __export(pisellFloatingPanel_exports, {
32
+ default: () => pisellFloatingPanel_default
33
+ });
34
+ module.exports = __toCommonJS(pisellFloatingPanel_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_classnames = __toESM(require("classnames"));
37
+ var import_ahooks = require("ahooks");
38
+ var import_iconfont = __toESM(require("../iconfont"));
39
+ var import_index = require("./index.less");
40
+ var PisellFloatingPanel = (props) => {
41
+ const {
42
+ defaultOpen = false,
43
+ onOpenChange,
44
+ isFloat,
45
+ open,
46
+ width,
47
+ children,
48
+ retractHeight,
49
+ fullHeight,
50
+ retractSlot,
51
+ style: propsStyle,
52
+ retractIconStyle
53
+ } = props;
54
+ const [isOpen, setIsOpen] = (0, import_react.useState)(defaultOpen);
55
+ (0, import_ahooks.useUpdateEffect)(() => {
56
+ if (open !== void 0) {
57
+ setIsOpen(open);
58
+ }
59
+ }, [open]);
60
+ (0, import_react.useEffect)(() => {
61
+ document.body.id = "body";
62
+ }, []);
63
+ const togglePanel = () => {
64
+ const newOpenState = !isOpen;
65
+ setIsOpen(newOpenState);
66
+ if (onOpenChange) {
67
+ onOpenChange(newOpenState);
68
+ }
69
+ };
70
+ const style = (0, import_react.useMemo)(() => {
71
+ let height = fullHeight;
72
+ let transform = isOpen ? "translateY(0)" : `translateY(calc(100% - ${retractHeight}))`;
73
+ if (!isFloat) {
74
+ height = isOpen ? fullHeight : retractHeight;
75
+ transform = "none";
76
+ }
77
+ return {
78
+ ...propsStyle,
79
+ height,
80
+ width,
81
+ position: isFloat ? "fixed" : "relative",
82
+ bottom: 0,
83
+ transition: "0.3s",
84
+ transform
85
+ };
86
+ }, [fullHeight, isFloat, retractHeight, isOpen, width, propsStyle]);
87
+ const iconType = (0, import_react.useMemo)(() => {
88
+ if (isOpen) {
89
+ return isFloat ? "pisell2-chevron-down-double" : "pisell2-chevron-up-double";
90
+ }
91
+ return isFloat ? "pisell2-chevron-up-double" : "pisell2-chevron-down-double";
92
+ }, [isOpen, isFloat]);
93
+ return /* @__PURE__ */ import_react.default.createElement(
94
+ "div",
95
+ {
96
+ className: (0, import_classnames.default)("pisell-lowcode-floating-panel-wrap", {
97
+ ["pisell-lowcode-floating-panel-wrap-floating"]: isFloat
98
+ }),
99
+ style
100
+ },
101
+ /* @__PURE__ */ import_react.default.createElement(
102
+ "div",
103
+ {
104
+ className: "pisell-lowcode-floating-panel-header",
105
+ onClick: togglePanel
106
+ },
107
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-floating-panel-handle" }, /* @__PURE__ */ import_react.default.createElement(import_iconfont.default, { type: iconType, style: retractIconStyle }))
108
+ ),
109
+ !isOpen && retractSlot,
110
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-floating-panel-content" }, children)
111
+ );
112
+ };
113
+ var pisellFloatingPanel_default = PisellFloatingPanel;
@@ -0,0 +1,30 @@
1
+ .pisell-lowcode-floating-panel-wrap {
2
+ background-color: #fff;
3
+ border-top-left-radius: 16px;
4
+ border-top-right-radius: 16px;
5
+ box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
6
+ overflow: hidden;
7
+ display: flex;
8
+ flex-direction: column;
9
+ }
10
+
11
+ .pisell-lowcode-floating-panel-wrap.pisell-lowcode-floating-panel-wrap-floating {
12
+ position: fixed;
13
+ bottom: 0;
14
+ left: 0;
15
+ }
16
+
17
+ .pisell-lowcode-floating-panel-content {
18
+ overflow-y: auto;
19
+ height: 100%;
20
+ }
21
+
22
+ .pisell-lowcode-floating-panel-header {
23
+ padding: 10px;
24
+ width: 100%;
25
+ height: 32px;
26
+ display: flex;
27
+ align-items: center;
28
+ justify-content: center;
29
+ cursor: pointer;
30
+ }