@pisell/materials 2.2.27 → 2.2.29

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 (93) 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 +14 -14
  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/segmented/index.d.ts +1 -0
  17. package/es/components/segmented/index.js +1 -0
  18. package/es/components/segmented/index.less +3 -0
  19. package/es/components/table/Actions/component/ExportImport/components/ExportTable/function.js +14 -4
  20. package/es/components/table/index.js +8 -1
  21. package/es/components/table/index.less +6 -0
  22. package/es/components/table/serve.js +7 -0
  23. package/es/components/virtual-keyboard/Amount/index.d.ts +22 -0
  24. package/es/components/virtual-keyboard/Amount/index.js +65 -0
  25. package/es/components/virtual-keyboard/BaseNumberKeyboard/Presets.d.ts +12 -0
  26. package/es/components/virtual-keyboard/BaseNumberKeyboard/Presets.js +22 -0
  27. package/es/components/virtual-keyboard/BaseNumberKeyboard/Presets.less +18 -0
  28. package/es/components/virtual-keyboard/BaseNumberKeyboard/index.d.ts +19 -0
  29. package/es/components/virtual-keyboard/BaseNumberKeyboard/index.js +213 -0
  30. package/es/components/virtual-keyboard/BaseNumberKeyboard/index.less +9 -0
  31. package/es/components/virtual-keyboard/Keyboard/index.d.ts +8 -6
  32. package/es/components/virtual-keyboard/Keyboard/index.js +59 -15
  33. package/es/components/virtual-keyboard/Keyboard/index.less +35 -24
  34. package/es/components/virtual-keyboard/Number/index.d.ts +14 -0
  35. package/es/components/virtual-keyboard/Number/index.js +35 -0
  36. package/es/components/virtual-keyboard/VirtualInput/index.d.ts +9 -0
  37. package/es/components/virtual-keyboard/VirtualInput/index.js +41 -0
  38. package/es/components/virtual-keyboard/VirtualInput/index.less +46 -0
  39. package/es/components/virtual-keyboard/VirtualKeyInput/index.d.ts +6 -3
  40. package/es/components/virtual-keyboard/VirtualKeyInput/index.js +27 -20
  41. package/es/index.d.ts +4 -0
  42. package/es/index.js +5 -1
  43. package/es/locales/en-US.d.ts +6 -0
  44. package/es/locales/en-US.js +8 -1
  45. package/es/locales/zh-CN.d.ts +6 -0
  46. package/es/locales/zh-CN.js +8 -1
  47. package/es/locales/zh-TW.d.ts +6 -0
  48. package/es/locales/zh-TW.js +8 -1
  49. package/lib/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.d.ts +10 -0
  50. package/lib/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.js +84 -0
  51. package/lib/components/pisellAdjustPrice/index.d.ts +10 -0
  52. package/lib/components/pisellAdjustPrice/index.js +156 -0
  53. package/lib/components/pisellAdjustPrice/index.less +30 -0
  54. package/lib/components/segmented/index.d.ts +1 -0
  55. package/lib/components/segmented/index.js +1 -0
  56. package/lib/components/segmented/index.less +3 -0
  57. package/lib/components/table/Actions/component/ExportImport/components/ExportTable/function.js +9 -2
  58. package/lib/components/table/index.js +41 -23
  59. package/lib/components/table/index.less +6 -0
  60. package/lib/components/table/serve.js +5 -0
  61. package/lib/components/virtual-keyboard/Amount/index.d.ts +22 -0
  62. package/lib/components/virtual-keyboard/Amount/index.js +96 -0
  63. package/lib/components/virtual-keyboard/BaseNumberKeyboard/Presets.d.ts +12 -0
  64. package/lib/components/virtual-keyboard/BaseNumberKeyboard/Presets.js +46 -0
  65. package/lib/components/virtual-keyboard/BaseNumberKeyboard/Presets.less +18 -0
  66. package/lib/components/virtual-keyboard/BaseNumberKeyboard/index.d.ts +19 -0
  67. package/lib/components/virtual-keyboard/BaseNumberKeyboard/index.js +245 -0
  68. package/lib/components/virtual-keyboard/BaseNumberKeyboard/index.less +9 -0
  69. package/lib/components/virtual-keyboard/Keyboard/index.d.ts +8 -6
  70. package/lib/components/virtual-keyboard/Keyboard/index.js +51 -4
  71. package/lib/components/virtual-keyboard/Keyboard/index.less +35 -24
  72. package/lib/components/virtual-keyboard/Number/index.d.ts +14 -0
  73. package/lib/components/virtual-keyboard/Number/index.js +65 -0
  74. package/lib/components/virtual-keyboard/VirtualInput/index.d.ts +9 -0
  75. package/lib/components/virtual-keyboard/VirtualInput/index.js +63 -0
  76. package/lib/components/virtual-keyboard/VirtualInput/index.less +46 -0
  77. package/lib/components/virtual-keyboard/VirtualKeyInput/index.d.ts +6 -3
  78. package/lib/components/virtual-keyboard/VirtualKeyInput/index.js +20 -11
  79. package/lib/index.d.ts +4 -0
  80. package/lib/index.js +12 -0
  81. package/lib/locales/en-US.d.ts +6 -0
  82. package/lib/locales/en-US.js +8 -1
  83. package/lib/locales/zh-CN.d.ts +6 -0
  84. package/lib/locales/zh-CN.js +8 -1
  85. package/lib/locales/zh-TW.d.ts +6 -0
  86. package/lib/locales/zh-TW.js +8 -1
  87. package/lowcode/input/meta.ts +25 -0
  88. package/lowcode/pisell-adjust-price/meta.ts +58 -0
  89. package/lowcode/pisell-adjust-price/snippets.ts +10 -0
  90. package/lowcode/pisell-adjust-price-input-number/meta.ts +245 -0
  91. package/lowcode/pisell-number-keyboard/meta.ts +98 -0
  92. package/lowcode/pisell-price-keyboard/meta.ts +174 -0
  93. package/package.json +2 -2
@@ -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
+ }
@@ -1,18 +1,20 @@
1
- import React from "react";
2
- import "./index.less";
1
+ import React from 'react';
2
+ import './index.less';
3
3
  export declare type ItemValue = string | number;
4
4
  export interface Item {
5
5
  value: ItemValue;
6
- label: string;
6
+ label: React.ReactNode;
7
7
  disabled: boolean;
8
- type: "text" | "primary";
8
+ type: 'text' | 'primary';
9
9
  style?: React.CSSProperties;
10
+ size?: number;
10
11
  }
11
12
  export interface KeyboardProps {
12
13
  className?: string;
13
14
  style?: React.CSSProperties;
14
15
  onChange?: (value?: ItemValue) => void;
15
16
  items?: Item[];
17
+ rightItems?: Item[];
16
18
  }
17
- declare const Keyboard: (props: KeyboardProps) => React.JSX.Element;
18
- export default Keyboard;
19
+ declare const _default: React.MemoExoticComponent<(props: KeyboardProps) => React.JSX.Element>;
20
+ export default _default;
@@ -38,8 +38,11 @@ var import_index = require("./index.less");
38
38
  var import_classnames = __toESM(require("classnames"));
39
39
  var import_ahooks = require("ahooks");
40
40
  var list = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "ok"];
41
+ var defaultArr = [];
41
42
  var Keyboard = (props) => {
42
- const { items = [], className, style, onChange } = props;
43
+ const { items = defaultArr, className, style, onChange, rightItems } = props;
44
+ const contentRef = (0, import_react.useRef)(null);
45
+ const size = (0, import_ahooks.useSize)(contentRef);
43
46
  (0, import_ahooks.useEventListener)("keydown", (ev) => {
44
47
  console.log("ev", ev);
45
48
  let key = ev.key;
@@ -50,13 +53,16 @@ var Keyboard = (props) => {
50
53
  onChange == null ? void 0 : onChange(key);
51
54
  }
52
55
  });
56
+ const getHeight = (0, import_ahooks.useMemoizedFn)((itemSize = 1) => {
57
+ return ((size == null ? void 0 : size.width) || 0) / 4 * itemSize + (itemSize - 1) * 7;
58
+ });
53
59
  return /* @__PURE__ */ import_react.default.createElement(
54
60
  "div",
55
61
  {
56
62
  className: (0, import_classnames.default)("virtual-keyboard-wrap", className),
57
63
  style
58
64
  },
59
- items.map((item) => {
65
+ /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("virtual-keyboard-content"), ref: contentRef }, items.map((item) => {
60
66
  var _a;
61
67
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "virtual-keyboard-item", style: item.style }, /* @__PURE__ */ import_react.default.createElement(
62
68
  import_antd.Button,
@@ -75,7 +81,48 @@ var Keyboard = (props) => {
75
81
  },
76
82
  item.label
77
83
  ));
78
- })
84
+ })),
85
+ rightItems && /* @__PURE__ */ import_react.default.createElement(
86
+ "div",
87
+ {
88
+ className: (0, import_classnames.default)(
89
+ "virtual-keyboard-content",
90
+ "virtual-keyboard-right"
91
+ ),
92
+ style: { flex: `0 0 calc((100% - 21px) / 4 * 1)` }
93
+ },
94
+ rightItems == null ? void 0 : rightItems.map((item) => {
95
+ var _a, _b;
96
+ return /* @__PURE__ */ import_react.default.createElement(
97
+ "div",
98
+ {
99
+ className: "virtual-keyboard-item",
100
+ style: {
101
+ ...item.style || {},
102
+ height: getHeight(item.size)
103
+ }
104
+ },
105
+ /* @__PURE__ */ import_react.default.createElement(
106
+ import_antd.Button,
107
+ {
108
+ id: `virtual-keyboard-${item.value}`,
109
+ key: item.value,
110
+ type: item.type,
111
+ className: "virtual-keyboard-item-button",
112
+ style: {
113
+ fontSize: ((_a = item.style) == null ? void 0 : _a.fontSize) || 25,
114
+ color: item.type === "primary" ? "#fff" : ((_b = item.style) == null ? void 0 : _b.color) || void 0
115
+ },
116
+ disabled: item.disabled,
117
+ onClick: (e) => {
118
+ onChange == null ? void 0 : onChange(item.value);
119
+ }
120
+ },
121
+ item.label
122
+ )
123
+ );
124
+ })
125
+ )
79
126
  );
80
127
  };
81
- var Keyboard_default = Keyboard;
128
+ var Keyboard_default = import_react.default.memo(Keyboard);
@@ -1,32 +1,43 @@
1
1
  .virtual-keyboard-wrap {
2
- width: 100%;
3
2
  display: flex;
4
- flex-wrap: wrap;
5
- align-items: center;
6
- justify-content: flex-end;
7
3
  gap: 7px;
4
+ .virtual-keyboard-content {
5
+ width: 100%;
6
+ display: flex;
7
+ flex-wrap: wrap;
8
+ align-items: center;
9
+ justify-content: flex-end;
10
+ gap: 7px;
8
11
 
9
- .virtual-keyboard-item {
10
- border-radius: 5px;
11
- background: var(--Base-White, #FFF);
12
- box-shadow: 0px 1px 0px 0px #898A8D;
13
- overflow: hidden;
14
- width: calc((100% - 14px) / 3 * 1);
15
- padding-top: 25%;
16
- position: relative;
12
+ .virtual-keyboard-item {
13
+ border-radius: 5px;
14
+ background: var(--Base-White, #fff);
15
+ box-shadow: 0px 1px 0px 0px #898a8d;
16
+ overflow: hidden;
17
+ width: calc((100% - 14px) / 3 * 1);
18
+ padding-top: 25%;
19
+ position: relative;
17
20
 
18
- .virtual-keyboard-item-button {
19
- position: absolute;
20
- left: 0;
21
- top: 0;
21
+ .virtual-keyboard-item-button {
22
+ position: absolute;
23
+ left: 0;
24
+ top: 0;
25
+ width: 100%;
26
+ height: 100%;
27
+ border-radius: 5px;
28
+ color: var(--Base-Black, #000);
29
+ font-size: 25px;
30
+ font-style: normal;
31
+ font-weight: 400;
32
+ box-shadow: none;
33
+ }
34
+ }
35
+ }
36
+ .virtual-keyboard-right {
37
+ flex-direction: column;
38
+ justify-content: start;
39
+ .virtual-keyboard-item{
22
40
  width: 100%;
23
- height: 100%;
24
- border-radius: 5px;
25
- color: var(--Base-Black, #000);
26
- font-size: 25px;
27
- font-style: normal;
28
- font-weight: 400;
29
- box-shadow: none;
30
41
  }
31
42
  }
32
- }
43
+ }
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ export interface NumberProps {
3
+ max?: number;
4
+ min?: number;
5
+ doneText?: string;
6
+ resetText: string;
7
+ defaultValue?: string | number;
8
+ placeholder?: string;
9
+ value?: string | number;
10
+ onChange?: (val: string | number) => void;
11
+ onEnter?: (val: string | number) => void;
12
+ }
13
+ declare const Number: (props: NumberProps) => React.JSX.Element;
14
+ export default Number;