@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
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export interface PisellStatisticListProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ backgroundColors?: string[];
5
+ labelColor?: string;
6
+ valueColor?: string;
7
+ data: {
8
+ label: string;
9
+ value: string;
10
+ tip?: string;
11
+ children?: {
12
+ label: string;
13
+ value: string;
14
+ }[];
15
+ }[];
16
+ }
17
+ declare const PisellStatisticList: (props: PisellStatisticListProps) => React.JSX.Element;
18
+ export default PisellStatisticList;
@@ -0,0 +1,109 @@
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/pisellStatisticList/index.tsx
30
+ var pisellStatisticList_exports = {};
31
+ __export(pisellStatisticList_exports, {
32
+ default: () => pisellStatisticList_default
33
+ });
34
+ module.exports = __toCommonJS(pisellStatisticList_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
37
+ var import_pisellTooltip = __toESM(require("../pisellTooltip"));
38
+ var import_iconfont = __toESM(require("../iconfont"));
39
+ var import_index = require("./index.less");
40
+ var defaultColors = [
41
+ "rgba(224, 79, 22, 0.20)",
42
+ "rgba(202, 133, 4, 0.20)",
43
+ "rgba(127, 86, 217, 0.22)",
44
+ "rgba(7, 148, 85, 0.20)",
45
+ "rgba(21, 112, 239, 0.23)"
46
+ ];
47
+ var PisellStatisticList = (props) => {
48
+ const {
49
+ backgroundColors = defaultColors,
50
+ labelColor = "#fff",
51
+ valueColor = "#fff",
52
+ data,
53
+ ...others
54
+ } = props;
55
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-statistic-list-wrap", ...others }, data.map((item, index) => {
56
+ var _a;
57
+ return /* @__PURE__ */ import_react.default.createElement(
58
+ "div",
59
+ {
60
+ className: "pisell-lowcode-statistic-list-item",
61
+ style: {
62
+ background: backgroundColors[index % backgroundColors.length]
63
+ }
64
+ },
65
+ /* @__PURE__ */ import_react.default.createElement(
66
+ "div",
67
+ {
68
+ className: "pisell-lowcode-statistic-list-item-label",
69
+ style: { color: labelColor }
70
+ },
71
+ item.label,
72
+ item.tip && /* @__PURE__ */ import_react.default.createElement(import_pisellTooltip.default, { title: item.tip }, /* @__PURE__ */ import_react.default.createElement(
73
+ import_iconfont.default,
74
+ {
75
+ style: { color: labelColor },
76
+ type: "pisell2-help-circle",
77
+ className: "pisell-lowcode-statistic-list-item-label-tip-icon"
78
+ }
79
+ ))
80
+ ),
81
+ /* @__PURE__ */ import_react.default.createElement(
82
+ "div",
83
+ {
84
+ className: "pisell-lowcode-statistic-list-item-value",
85
+ style: { color: valueColor }
86
+ },
87
+ item.value
88
+ ),
89
+ !!((_a = item.children) == null ? void 0 : _a.length) && /* @__PURE__ */ import_react.default.createElement(import_antd.Row, { className: "pisell-lowcode-statistic-list-item-children-wrap" }, item.children.map((child) => {
90
+ return /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 12, className: "pisell-lowcode-statistic-list-item-children-item" }, /* @__PURE__ */ import_react.default.createElement(
91
+ "span",
92
+ {
93
+ className: "pisell-lowcode-statistic-list-item-children-label",
94
+ style: { color: labelColor }
95
+ },
96
+ child.label
97
+ ), /* @__PURE__ */ import_react.default.createElement(
98
+ "span",
99
+ {
100
+ className: "pisell-lowcode-statistic-list-item-children-value",
101
+ style: { color: valueColor }
102
+ },
103
+ child.value
104
+ ));
105
+ }))
106
+ );
107
+ }));
108
+ };
109
+ var pisellStatisticList_default = PisellStatisticList;
@@ -0,0 +1,47 @@
1
+ .pisell-lowcode-statistic-list-wrap {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 16px;
5
+ .pisell-lowcode-statistic-list-item {
6
+ padding: 16px;
7
+ border-radius: 8px;
8
+ border: 1px solid var(--Gray-600, #475467);
9
+ .pisell-lowcode-statistic-list-item-label {
10
+ color: var(--Base-White, #fff);
11
+ font-size: 14px;
12
+ font-weight: 600;
13
+ line-height: 20px; /* 142.857% */
14
+ display: flex;
15
+ gap: 10px;
16
+ align-items: center;
17
+ .pisell-lowcode-statistic-list-item-label-tip-icon {
18
+ font-size: 20px;
19
+ }
20
+ }
21
+ .pisell-lowcode-statistic-list-item-value {
22
+ color: var(--Base-White, #fff);
23
+ font-size: 18px;
24
+ font-weight: 700;
25
+ line-height: 28px; /* 155.556% */
26
+ }
27
+ .pisell-lowcode-statistic-list-item-children-wrap {
28
+ .pisell-lowcode-statistic-list-item-children-item {
29
+ display: flex;
30
+ align-items: baseline;
31
+ }
32
+ .pisell-lowcode-statistic-list-item-children-label {
33
+ color: var(--Base-White, #fff);
34
+ font-size: 12px;
35
+ font-weight: 400;
36
+ line-height: 18px; /* 150% */
37
+ margin-right: 4px;
38
+ }
39
+ .pisell-lowcode-statistic-list-item-children-value {
40
+ color: var(--Base-White, #fff);
41
+ font-size: 18px;
42
+ font-weight: 700;
43
+ line-height: 28px; /* 155.556% */
44
+ }
45
+ }
46
+ }
47
+ }
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
2
  import { SegmentedProps } from "antd";
3
+ import "./index.less";
3
4
  declare const Segmented: (props: SegmentedProps) => React.JSX.Element;
4
5
  export default Segmented;
@@ -34,6 +34,7 @@ __export(segmented_exports, {
34
34
  module.exports = __toCommonJS(segmented_exports);
35
35
  var import_react = __toESM(require("react"));
36
36
  var import_antd = require("antd");
37
+ var import_index = require("./index.less");
37
38
  var Segmented = (props) => {
38
39
  return /* @__PURE__ */ import_react.default.createElement(import_antd.Segmented, { ...props });
39
40
  };
@@ -0,0 +1,3 @@
1
+ .pisell-lowcode-segmented .pisell-lowcode-segmented-item::after {
2
+ z-index: -1;
3
+ }
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { BaseNumberKeyboardProps } from '../BaseNumberKeyboard';
3
+ export interface AmountProps {
4
+ max?: number;
5
+ min?: number;
6
+ doneText?: string;
7
+ resetText?: string;
8
+ defaultValue?: string | number;
9
+ placeholder?: string;
10
+ amountProps?: {
11
+ showCurrencySymbol: boolean;
12
+ useThousandsSeparator: boolean;
13
+ };
14
+ presets?: BaseNumberKeyboardProps['presets'];
15
+ value?: string | number;
16
+ onChange?: (val: string | number) => void;
17
+ onEnter?: (val: string | number) => void;
18
+ defaultSelect?: boolean;
19
+ inputFormat?: (_v: string) => React.ReactNode | null;
20
+ }
21
+ declare const Amount: (props: AmountProps) => React.JSX.Element;
22
+ export default Amount;
@@ -0,0 +1,96 @@
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/virtual-keyboard/Amount/index.tsx
30
+ var Amount_exports = {};
31
+ __export(Amount_exports, {
32
+ default: () => Amount_default
33
+ });
34
+ module.exports = __toCommonJS(Amount_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_ahooks = require("ahooks");
37
+ var import_BaseNumberKeyboard = __toESM(require("../BaseNumberKeyboard"));
38
+ var import_pisellText = __toESM(require("../../pisellText"));
39
+ var Amount = (props) => {
40
+ const {
41
+ min,
42
+ max,
43
+ amountProps,
44
+ doneText,
45
+ resetText,
46
+ defaultValue,
47
+ placeholder,
48
+ onEnter,
49
+ presets,
50
+ defaultSelect,
51
+ inputFormat
52
+ } = props;
53
+ const [value, setValue] = (0, import_ahooks.useControllableValue)(props, {
54
+ defaultValue: defaultValue || ""
55
+ });
56
+ (0, import_react.useEffect)(() => {
57
+ document.body.id = "body";
58
+ }, []);
59
+ const format = (_v) => {
60
+ const v = `${_v}`;
61
+ if (inputFormat == null ? void 0 : inputFormat(v)) {
62
+ return inputFormat == null ? void 0 : inputFormat(v);
63
+ }
64
+ const precision = v.includes(".") ? v.split(".")[1].length : 0;
65
+ const endWith = v.endsWith(".");
66
+ const value2 = endWith ? v.slice(0, -1) : v;
67
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
68
+ import_pisellText.default.Amount,
69
+ {
70
+ value: value2,
71
+ precision,
72
+ hideDecimalForWholeNumbers: false,
73
+ showCurrencySymbol: amountProps == null ? void 0 : amountProps.showCurrencySymbol,
74
+ useThousandsSeparator: amountProps == null ? void 0 : amountProps.useThousandsSeparator
75
+ }
76
+ ), endWith && ".");
77
+ };
78
+ return /* @__PURE__ */ import_react.default.createElement(
79
+ import_BaseNumberKeyboard.default,
80
+ {
81
+ defaultSelect,
82
+ max,
83
+ min,
84
+ value,
85
+ onChange: setValue,
86
+ placeholder,
87
+ defaultValue,
88
+ format,
89
+ doneText,
90
+ resetText,
91
+ onEnter,
92
+ presets
93
+ }
94
+ );
95
+ };
96
+ var Amount_default = Amount;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import "./Presets.less";
3
+ export declare type PresetsItem = {
4
+ label: string;
5
+ value: number | string;
6
+ };
7
+ export interface PresetsProps {
8
+ presets?: PresetsItem[];
9
+ onChange: (val: string) => void;
10
+ }
11
+ declare const Presets: (props: PresetsProps) => React.JSX.Element | null;
12
+ export default Presets;
@@ -0,0 +1,46 @@
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/virtual-keyboard/BaseNumberKeyboard/Presets.tsx
30
+ var Presets_exports = {};
31
+ __export(Presets_exports, {
32
+ default: () => Presets_default
33
+ });
34
+ module.exports = __toCommonJS(Presets_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_Presets = require("./Presets.less");
37
+ var Presets = (props) => {
38
+ const { presets, onChange } = props;
39
+ return (0, import_react.useMemo)(() => {
40
+ if (!(presets == null ? void 0 : presets.length)) {
41
+ return null;
42
+ }
43
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-virtual-keyboard-preset" }, presets.map((item) => /* @__PURE__ */ import_react.default.createElement("div", { onClick: () => onChange(`${item.value}`), className: "pisell-virtual-keyboard-preset-item" }, item.label)));
44
+ }, [presets]);
45
+ };
46
+ var Presets_default = Presets;
@@ -0,0 +1,18 @@
1
+ .pisell-virtual-keyboard-preset {
2
+ display: flex;
3
+ gap: 7px;
4
+ flex-wrap: wrap;
5
+ margin-bottom: 8px;
6
+ .pisell-virtual-keyboard-preset-item {
7
+ display: flex;
8
+ flex: 1;
9
+ padding: 12px 20px;
10
+ align-items: center;
11
+ justify-content: center;
12
+ height: 48px;
13
+ border-radius: 8px;
14
+ border: 1px solid var(--Gray-300, #D0D5DD);
15
+ box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
16
+ background: var(--Primary-25, #FCFAFF);
17
+ }
18
+ }
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { PresetsProps } from "./Presets";
3
+ import './index.less';
4
+ export interface BaseNumberKeyboardProps {
5
+ placeholder?: string;
6
+ format?: (val: string) => React.ReactNode;
7
+ defaultValue?: string | number;
8
+ doneText?: string;
9
+ resetText?: string;
10
+ onChange?: (val: string) => void;
11
+ onEnter?: (val: string) => void;
12
+ value?: string | number;
13
+ max?: number;
14
+ min?: number;
15
+ presets?: PresetsProps['presets'];
16
+ defaultSelect?: boolean;
17
+ }
18
+ declare const BaseNumberKeyboard: (props: BaseNumberKeyboardProps) => React.JSX.Element;
19
+ export default BaseNumberKeyboard;
@@ -0,0 +1,245 @@
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/virtual-keyboard/BaseNumberKeyboard/index.tsx
30
+ var BaseNumberKeyboard_exports = {};
31
+ __export(BaseNumberKeyboard_exports, {
32
+ default: () => BaseNumberKeyboard_default
33
+ });
34
+ module.exports = __toCommonJS(BaseNumberKeyboard_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_Delete = __toESM(require("@pisell/icon/es/Delete"));
37
+ var import_ahooks = require("ahooks");
38
+ var import_utils = require("@pisell/utils");
39
+ var import_Presets = __toESM(require("./Presets"));
40
+ var import_Keyboard = __toESM(require("../Keyboard"));
41
+ var import_VirtualKeyInput = __toESM(require("../VirtualKeyInput"));
42
+ var import_VirtualInput = __toESM(require("../VirtualInput"));
43
+ var import_index = require("./index.less");
44
+ var items = [
45
+ {
46
+ value: 1,
47
+ label: "1",
48
+ disabled: false,
49
+ type: "text"
50
+ },
51
+ {
52
+ value: 2,
53
+ label: "2",
54
+ disabled: false,
55
+ type: "text"
56
+ },
57
+ {
58
+ value: 3,
59
+ label: "3",
60
+ disabled: false,
61
+ type: "text"
62
+ },
63
+ {
64
+ value: 4,
65
+ label: "4",
66
+ disabled: false,
67
+ type: "text"
68
+ },
69
+ {
70
+ value: 5,
71
+ label: "5",
72
+ disabled: false,
73
+ type: "text"
74
+ },
75
+ {
76
+ value: 6,
77
+ label: "6",
78
+ disabled: false,
79
+ type: "text"
80
+ },
81
+ {
82
+ value: 7,
83
+ label: "7",
84
+ disabled: false,
85
+ type: "text"
86
+ },
87
+ {
88
+ value: 8,
89
+ label: "8",
90
+ disabled: false,
91
+ type: "text"
92
+ },
93
+ {
94
+ value: 9,
95
+ label: "9",
96
+ disabled: false,
97
+ type: "text"
98
+ },
99
+ {
100
+ value: "0",
101
+ label: "0",
102
+ disabled: false,
103
+ type: "text"
104
+ },
105
+ {
106
+ value: "00",
107
+ label: "00",
108
+ disabled: false,
109
+ type: "text"
110
+ },
111
+ {
112
+ value: ".",
113
+ label: ".",
114
+ disabled: false,
115
+ type: "text"
116
+ }
117
+ ];
118
+ var BaseNumberKeyboard = (props) => {
119
+ const {
120
+ onChange,
121
+ placeholder,
122
+ format,
123
+ defaultValue = "",
124
+ doneText,
125
+ resetText,
126
+ max,
127
+ min,
128
+ onEnter,
129
+ presets,
130
+ defaultSelect
131
+ } = props;
132
+ const [value, setValue] = (0, import_ahooks.useControllableValue)(props, {
133
+ defaultValue
134
+ });
135
+ const [select, setSelect] = (0, import_react.useState)(defaultSelect ?? false);
136
+ (0, import_react.useEffect)(() => {
137
+ document.body.id = "body";
138
+ }, []);
139
+ const rightItems = (0, import_react.useMemo)(() => {
140
+ return [
141
+ {
142
+ value: "delete",
143
+ label: /* @__PURE__ */ import_react.default.createElement(import_Delete.default, { className: "virtual-keyboard-input-delete-icon" }),
144
+ disabled: false,
145
+ type: "text"
146
+ },
147
+ {
148
+ value: "reset",
149
+ label: resetText || "Reset",
150
+ disabled: false,
151
+ type: "text",
152
+ style: {
153
+ fontSize: "18px",
154
+ color: "#D92D20"
155
+ }
156
+ },
157
+ {
158
+ value: "done",
159
+ label: doneText || "Done",
160
+ disabled: false,
161
+ type: "primary",
162
+ size: 2,
163
+ style: {
164
+ fontSize: "18px",
165
+ background: "var(--Green-light-600, #4CA30D)",
166
+ color: "#fff"
167
+ }
168
+ }
169
+ ];
170
+ }, [doneText, resetText]);
171
+ const checkValue = (val) => {
172
+ if ((0, import_utils.isNumber)(max) && Number(val) > max) {
173
+ const newValue = Math.min(Number(val), Number(max));
174
+ setValue(`${newValue}`);
175
+ return { message: "" };
176
+ }
177
+ if ((0, import_utils.isNumber)(min) && Number(val) < min) {
178
+ const newValue = Math.max(Number(val), Number(min));
179
+ setValue(`${newValue}`);
180
+ return { message: "" };
181
+ }
182
+ };
183
+ const handleChangeValue = (val) => {
184
+ const detail = checkValue(val);
185
+ if (detail)
186
+ return;
187
+ setValue(val);
188
+ };
189
+ const actions = {
190
+ ".": (val) => {
191
+ if (value.includes("."))
192
+ return;
193
+ actions.default(val);
194
+ },
195
+ delete: () => {
196
+ handleChangeValue(select ? "" : `${value || ""}`.slice(0, -1));
197
+ },
198
+ reset: () => {
199
+ handleChangeValue(`${defaultValue || ""}` || "");
200
+ },
201
+ done: () => {
202
+ onEnter == null ? void 0 : onEnter(value);
203
+ },
204
+ ok: () => {
205
+ onEnter == null ? void 0 : onEnter(value);
206
+ },
207
+ default: (val) => {
208
+ handleChangeValue(select ? `${val}` : `${value}${val}`);
209
+ }
210
+ };
211
+ const handleKeyboardChange = (0, import_ahooks.useMemoizedFn)((val) => {
212
+ return (actions[val] || actions.default)(val);
213
+ });
214
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-virtual-keyboard-base" }, /* @__PURE__ */ import_react.default.createElement(
215
+ import_VirtualKeyInput.default,
216
+ {
217
+ value,
218
+ onChange: (e) => handleChangeValue(e.target.value),
219
+ renderInput: (props2) => {
220
+ if ((0, import_utils.isUndefined)(props2.value) || props2.value === "") {
221
+ return /* @__PURE__ */ import_react.default.createElement(
222
+ import_VirtualInput.default,
223
+ {
224
+ autoFocus: true,
225
+ placeholder,
226
+ value: props2.value
227
+ }
228
+ );
229
+ }
230
+ return (format == null ? void 0 : format(props2.value)) || props2.value;
231
+ },
232
+ showDelete: false,
233
+ onValueSelect: setSelect,
234
+ defaultSelect
235
+ }
236
+ ), /* @__PURE__ */ import_react.default.createElement(import_Presets.default, { presets, onChange: handleChangeValue }), /* @__PURE__ */ import_react.default.createElement(
237
+ import_Keyboard.default,
238
+ {
239
+ items,
240
+ rightItems,
241
+ onChange: handleKeyboardChange
242
+ }
243
+ ));
244
+ };
245
+ var BaseNumberKeyboard_default = BaseNumberKeyboard;
@@ -0,0 +1,9 @@
1
+ .pisell-virtual-keyboard-base {
2
+ width: 340px;
3
+ .virtual-keyboard-input-wrap {
4
+ box-shadow: 0px 1px 3px 0px rgba(16, 24, 40, 0.10), 0px 1px 2px 0px rgba(16, 24, 40, 0.06);
5
+ }
6
+ .virtual-keyboard-wrap .virtual-keyboard-content .virtual-keyboard-item {
7
+ box-shadow: 0px 1px 3px 0px rgba(16, 24, 40, 0.10), 0px 1px 2px 0px rgba(16, 24, 40, 0.06);
8
+ }
9
+ }