@pisell/materials 3.0.48 → 3.0.49

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 (84) 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/virtual-keyboard/Amount/index.d.ts +22 -0
  20. package/es/components/virtual-keyboard/Amount/index.js +65 -0
  21. package/es/components/virtual-keyboard/BaseNumberKeyboard/Presets.d.ts +12 -0
  22. package/es/components/virtual-keyboard/BaseNumberKeyboard/Presets.js +22 -0
  23. package/es/components/virtual-keyboard/BaseNumberKeyboard/Presets.less +18 -0
  24. package/es/components/virtual-keyboard/BaseNumberKeyboard/index.d.ts +19 -0
  25. package/es/components/virtual-keyboard/BaseNumberKeyboard/index.js +213 -0
  26. package/es/components/virtual-keyboard/BaseNumberKeyboard/index.less +9 -0
  27. package/es/components/virtual-keyboard/Keyboard/index.d.ts +8 -6
  28. package/es/components/virtual-keyboard/Keyboard/index.js +59 -15
  29. package/es/components/virtual-keyboard/Keyboard/index.less +35 -24
  30. package/es/components/virtual-keyboard/Number/index.d.ts +14 -0
  31. package/es/components/virtual-keyboard/Number/index.js +35 -0
  32. package/es/components/virtual-keyboard/VirtualInput/index.d.ts +9 -0
  33. package/es/components/virtual-keyboard/VirtualInput/index.js +41 -0
  34. package/es/components/virtual-keyboard/VirtualInput/index.less +46 -0
  35. package/es/components/virtual-keyboard/VirtualKeyInput/index.d.ts +6 -3
  36. package/es/components/virtual-keyboard/VirtualKeyInput/index.js +27 -20
  37. package/es/index.d.ts +4 -0
  38. package/es/index.js +5 -1
  39. package/es/locales/en-US.d.ts +6 -0
  40. package/es/locales/en-US.js +8 -1
  41. package/es/locales/zh-CN.d.ts +6 -0
  42. package/es/locales/zh-CN.js +8 -1
  43. package/es/locales/zh-TW.d.ts +6 -0
  44. package/es/locales/zh-TW.js +8 -1
  45. package/lib/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.d.ts +10 -0
  46. package/lib/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.js +84 -0
  47. package/lib/components/pisellAdjustPrice/index.d.ts +10 -0
  48. package/lib/components/pisellAdjustPrice/index.js +156 -0
  49. package/lib/components/pisellAdjustPrice/index.less +30 -0
  50. package/lib/components/segmented/index.d.ts +1 -0
  51. package/lib/components/segmented/index.js +1 -0
  52. package/lib/components/segmented/index.less +3 -0
  53. package/lib/components/virtual-keyboard/Amount/index.d.ts +22 -0
  54. package/lib/components/virtual-keyboard/Amount/index.js +96 -0
  55. package/lib/components/virtual-keyboard/BaseNumberKeyboard/Presets.d.ts +12 -0
  56. package/lib/components/virtual-keyboard/BaseNumberKeyboard/Presets.js +46 -0
  57. package/lib/components/virtual-keyboard/BaseNumberKeyboard/Presets.less +18 -0
  58. package/lib/components/virtual-keyboard/BaseNumberKeyboard/index.d.ts +19 -0
  59. package/lib/components/virtual-keyboard/BaseNumberKeyboard/index.js +245 -0
  60. package/lib/components/virtual-keyboard/BaseNumberKeyboard/index.less +9 -0
  61. package/lib/components/virtual-keyboard/Keyboard/index.d.ts +8 -6
  62. package/lib/components/virtual-keyboard/Keyboard/index.js +51 -4
  63. package/lib/components/virtual-keyboard/Keyboard/index.less +35 -24
  64. package/lib/components/virtual-keyboard/Number/index.d.ts +14 -0
  65. package/lib/components/virtual-keyboard/Number/index.js +65 -0
  66. package/lib/components/virtual-keyboard/VirtualInput/index.d.ts +9 -0
  67. package/lib/components/virtual-keyboard/VirtualInput/index.js +63 -0
  68. package/lib/components/virtual-keyboard/VirtualInput/index.less +46 -0
  69. package/lib/components/virtual-keyboard/VirtualKeyInput/index.d.ts +6 -3
  70. package/lib/components/virtual-keyboard/VirtualKeyInput/index.js +20 -11
  71. package/lib/index.d.ts +4 -0
  72. package/lib/index.js +12 -0
  73. package/lib/locales/en-US.d.ts +6 -0
  74. package/lib/locales/en-US.js +8 -1
  75. package/lib/locales/zh-CN.d.ts +6 -0
  76. package/lib/locales/zh-CN.js +8 -1
  77. package/lib/locales/zh-TW.d.ts +6 -0
  78. package/lib/locales/zh-TW.js +8 -1
  79. package/lowcode/pisell-adjust-price/meta.ts +58 -0
  80. package/lowcode/pisell-adjust-price/snippets.ts +10 -0
  81. package/lowcode/pisell-adjust-price-input-number/meta.ts +245 -0
  82. package/lowcode/pisell-number-keyboard/meta.ts +98 -0
  83. package/lowcode/pisell-price-keyboard/meta.ts +174 -0
  84. package/package.json +2 -2
@@ -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;
@@ -0,0 +1,65 @@
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/Number/index.tsx
30
+ var Number_exports = {};
31
+ __export(Number_exports, {
32
+ default: () => Number_default
33
+ });
34
+ module.exports = __toCommonJS(Number_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_ahooks = require("ahooks");
37
+ var import_BaseNumberKeyboard = __toESM(require("../BaseNumberKeyboard"));
38
+ var Number = (props) => {
39
+ const {
40
+ min,
41
+ max,
42
+ doneText,
43
+ resetText,
44
+ defaultValue,
45
+ placeholder,
46
+ onEnter
47
+ } = props;
48
+ const [value, setValue] = (0, import_ahooks.useControllableValue)(props, {
49
+ defaultValue: defaultValue || ""
50
+ });
51
+ return /* @__PURE__ */ import_react.default.createElement(
52
+ import_BaseNumberKeyboard.default,
53
+ {
54
+ max,
55
+ min,
56
+ value,
57
+ onChange: setValue,
58
+ placeholder,
59
+ doneText,
60
+ resetText,
61
+ onEnter
62
+ }
63
+ );
64
+ };
65
+ var Number_default = Number;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export interface VirtualInputProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ value?: string;
5
+ autoFocus?: boolean;
6
+ placeholder?: string;
7
+ }
8
+ declare const VirtualInput: (props: VirtualInputProps) => React.JSX.Element;
9
+ export default VirtualInput;
@@ -0,0 +1,63 @@
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/VirtualInput/index.tsx
30
+ var VirtualInput_exports = {};
31
+ __export(VirtualInput_exports, {
32
+ default: () => VirtualInput_default
33
+ });
34
+ module.exports = __toCommonJS(VirtualInput_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_classnames = __toESM(require("classnames"));
37
+ var import_utils = require("@pisell/utils");
38
+ var import_index = require("./index.less");
39
+ var VirtualInput = (props) => {
40
+ const { value, autoFocus, placeholder = "" } = props;
41
+ const [isFocus, setIsFocus] = (0, import_react.useState)(autoFocus);
42
+ const onFocus = () => {
43
+ setIsFocus(true);
44
+ };
45
+ const onBlur = () => {
46
+ setIsFocus(false);
47
+ };
48
+ return /* @__PURE__ */ import_react.default.createElement(
49
+ "div",
50
+ {
51
+ onFocus,
52
+ onBlur,
53
+ tabIndex: 0,
54
+ className: (0, import_classnames.default)("pisell-virtual-input-value", {
55
+ "pisell-virtual-input-value-focus": isFocus
56
+ })
57
+ },
58
+ value,
59
+ ((0, import_utils.isUndefined)(value) || value === "") && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-virtual-input-placeholder" }, placeholder),
60
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-virtual-input-caret-container" }, isFocus && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-virtual-input-caret" }))
61
+ );
62
+ };
63
+ var VirtualInput_default = VirtualInput;
@@ -0,0 +1,46 @@
1
+ .pisell-virtual-input-value {
2
+ width: 100%;
3
+ min-width: 80px;
4
+ height: 100%;
5
+ display: flex;
6
+ align-items: center;
7
+ .pisell-virtual-input-caret-container {
8
+ height: 100%;
9
+ display: flex;
10
+ align-items: center;
11
+ .pisell-virtual-input-caret {
12
+ height: 40px;
13
+ width: 4px;
14
+ position: relative;
15
+ background: var(--Blue-600, #1570EF);
16
+ }
17
+ }
18
+ .pisell-virtual-input-placeholder {
19
+ color: var(--Gray-300, #D0D5DD);
20
+ }
21
+ }
22
+
23
+ .pisell-virtual-input-value-focus {
24
+ .pisell-virtual-input-caret {
25
+ display: block;
26
+ animation-name: pisell-caret-blink;
27
+ animation-duration: 1s;
28
+ animation-timing-function: linear;
29
+ animation-iteration-count: infinite;
30
+ }
31
+ }
32
+
33
+ @keyframes pisell-caret-blink {
34
+ from {
35
+ opacity: 1;
36
+ }
37
+ 60% {
38
+ opacity: 1;
39
+ }
40
+ 80% {
41
+ opacity: 0;
42
+ }
43
+ to {
44
+ opacity: 0;
45
+ }
46
+ }
@@ -1,9 +1,12 @@
1
- import React from "react";
2
- import { InputProps } from "antd";
3
- import "./index.less";
1
+ import React from 'react';
2
+ import { InputProps } from 'antd';
3
+ import './index.less';
4
4
  export interface VirtualKeyInputProps extends InputProps {
5
5
  previewValue?: string;
6
6
  renderInput?: (props: any) => any;
7
+ showDelete?: boolean;
8
+ onValueSelect?: (selected: boolean) => void;
9
+ defaultSelect?: boolean;
7
10
  }
8
11
  declare const VirtualKeyInput: (props: VirtualKeyInputProps) => React.JSX.Element;
9
12
  export default VirtualKeyInput;