@pisell/materials 6.4.8 → 6.4.9

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 (184) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +146 -146
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +24 -23
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +25 -24
  11. package/es/components/auto-resize-text/auto-text-size-standalone.d.ts +20 -0
  12. package/es/components/auto-resize-text/auto-text-size-standalone.js +258 -0
  13. package/es/components/auto-resize-text/index.d.ts +6 -0
  14. package/es/components/auto-resize-text/index.js +40 -0
  15. package/es/components/batch-editor/index.d.ts +0 -1
  16. package/es/components/dataSourceComponents/dataSourceForm/BaseForm.d.ts +3 -0
  17. package/es/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
  18. package/es/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +2 -2
  19. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +3 -3
  20. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +1 -1
  21. package/es/components/dataSourceComponents/fields/Upload/type.d.ts +37 -0
  22. package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
  23. package/es/components/dataSourceComponents/fields/index.d.ts +11 -12
  24. package/es/components/date-picker/index.d.ts +0 -1
  25. package/es/components/drag-sort-tree/TreeItem/index.d.ts +18 -0
  26. package/es/components/filter/types.d.ts +1 -0
  27. package/es/components/iconfont/index.d.ts +8 -0
  28. package/es/components/keyboard/index.d.ts +22 -0
  29. package/es/components/keyboard/index.js +159 -0
  30. package/es/components/keyboard/index.less +44 -0
  31. package/es/components/page/index.d.ts +0 -1
  32. package/es/components/pisell-config-provider/context.d.ts +22 -0
  33. package/es/components/pisell-config-provider/index.d.ts +13 -0
  34. package/es/components/pisellAdjustPrice/status.d.ts +32 -0
  35. package/es/components/pisellAdjustPrice/type.d.ts +22 -0
  36. package/es/components/pisellQRScanner/index.d.ts +0 -13
  37. package/es/components/pisellQRScanner/index.js +0 -8
  38. package/es/components/pisellToast/squareToast/index.d.ts +15 -0
  39. package/es/components/pisellToast/squareToast/methods.d.ts +13 -0
  40. package/es/components/pisellToast/squareToast/renderImperatively.d.ts +29 -0
  41. package/es/components/pisellToast/squareToast/toast.d.ts +25 -0
  42. package/es/components/pisellWalletPassCard/index.d.ts +1 -1
  43. package/es/components/pisellWalletPassCard/index.js +2 -1
  44. package/es/components/productCard/cartSkuCard/components/MultiDay/index.d.ts +3 -0
  45. package/es/components/productCard/cartSkuCard/components/MultiDay/utils.d.ts +14 -0
  46. package/es/components/productCard/cartSkuCard/components/holders/index.d.ts +3 -0
  47. package/es/components/productCard/cartSkuCard/components/packages/utils.d.ts +1 -1
  48. package/es/components/productCard/cartSkuCard/components/resources/index.d.ts +3 -0
  49. package/es/components/productCard/cartSkuCard/components/timeRange/index.d.ts +6 -0
  50. package/es/components/productCard/cartSkuCard/locales.d.ts +96 -0
  51. package/es/components/productCard/components/Action/index.d.ts +3 -0
  52. package/es/components/productCard/components/Packages/utils.d.ts +1 -1
  53. package/es/components/productCard/locales.d.ts +84 -0
  54. package/es/components/productCard/status.d.ts +32 -0
  55. package/es/components/productCard/types.d.ts +84 -0
  56. package/es/components/table/Gallery/components/VirtualGrid/useGapSize.d.ts +2 -2
  57. package/es/components/table/Table/SelectField/index.d.ts +0 -1
  58. package/es/components/table/Table/fields/index.d.ts +0 -1
  59. package/es/components/table/Table/fields/select/filterUtil/index.d.ts +1 -1
  60. package/es/components/table/Table/fields/text/Show/index.d.ts +0 -1
  61. package/es/components/table/Table/fields/text/index.d.ts +0 -1
  62. package/es/components/table/Table/fields/treeSelect/filterUtil/index.d.ts +1 -1
  63. package/es/components/table/Table/utils.d.ts +1 -1
  64. package/es/components/table/hooks/useTableSetting.js +1 -1
  65. package/es/components/virtual-keyboard/Amount/themeConfig.d.ts +32 -0
  66. package/es/components/virtual-keyboard/Amount/types.d.ts +44 -0
  67. package/es/components/virtual-keyboard/BaseNumberKeyboard/Presets.d.ts +5 -1
  68. package/es/components/virtual-keyboard/BaseNumberKeyboard/Presets.js +21 -7
  69. package/es/components/virtual-keyboard/BaseNumberKeyboard/Presets.less +9 -5
  70. package/es/components/virtual-keyboard/BaseNumberKeyboard/index.d.ts +4 -0
  71. package/es/components/virtual-keyboard/BaseNumberKeyboard/index.js +44 -25
  72. package/es/components/virtual-keyboard/Keyboard/index.d.ts +21 -0
  73. package/es/components/virtual-keyboard/Number/themeConfig.d.ts +32 -0
  74. package/es/components/virtual-keyboard/Number/types.d.ts +26 -0
  75. package/es/components/virtual-keyboard/VirtualKeyInput/index.d.ts +13 -0
  76. package/es/components/virtualInput/BaseVirtualInput/index.d.ts +40 -0
  77. package/es/components/virtualInput/BaseVirtualInput/index.js +163 -0
  78. package/es/components/virtualInput/BaseVirtualInput/index.less +78 -0
  79. package/es/components/virtualInput/index.d.ts +24 -0
  80. package/es/components/virtualInput/index.js +60 -0
  81. package/es/components/virtualInput/index.less +42 -0
  82. package/es/components/walletCard/Guide/index.d.ts +3 -0
  83. package/es/components/walletCard/index.d.ts +67 -0
  84. package/es/index.d.ts +2 -0
  85. package/es/index.js +3 -1
  86. package/es/locales/en-US.d.ts +286 -0
  87. package/es/locales/en-US.js +1 -0
  88. package/es/locales/zh-CN.d.ts +281 -0
  89. package/es/locales/zh-CN.js +1 -0
  90. package/es/locales/zh-TW.d.ts +281 -0
  91. package/es/locales/zh-TW.js +1 -0
  92. package/es/utils/index.d.ts +1 -1
  93. package/es/utils/platform.d.ts +1 -1
  94. package/lib/components/auto-resize-text/auto-text-size-standalone.d.ts +20 -0
  95. package/lib/components/auto-resize-text/auto-text-size-standalone.js +273 -0
  96. package/lib/components/auto-resize-text/index.d.ts +6 -0
  97. package/lib/components/auto-resize-text/index.js +71 -0
  98. package/lib/components/batch-editor/index.d.ts +0 -1
  99. package/lib/components/dataSourceComponents/dataSourceForm/BaseForm.d.ts +3 -0
  100. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
  101. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +2 -2
  102. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +3 -3
  103. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +1 -1
  104. package/lib/components/dataSourceComponents/fields/Upload/type.d.ts +37 -0
  105. package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
  106. package/lib/components/dataSourceComponents/fields/index.d.ts +11 -12
  107. package/lib/components/date-picker/index.d.ts +0 -1
  108. package/lib/components/drag-sort-tree/TreeItem/index.d.ts +18 -0
  109. package/lib/components/filter/types.d.ts +1 -0
  110. package/lib/components/iconfont/index.d.ts +8 -0
  111. package/lib/components/keyboard/index.d.ts +22 -0
  112. package/lib/components/keyboard/index.js +223 -0
  113. package/lib/components/keyboard/index.less +44 -0
  114. package/lib/components/page/index.d.ts +0 -1
  115. package/lib/components/pisell-config-provider/context.d.ts +22 -0
  116. package/lib/components/pisell-config-provider/index.d.ts +13 -0
  117. package/lib/components/pisellAdjustPrice/status.d.ts +32 -0
  118. package/lib/components/pisellAdjustPrice/type.d.ts +22 -0
  119. package/lib/components/pisellQRScanner/index.d.ts +0 -13
  120. package/lib/components/pisellToast/squareToast/index.d.ts +15 -0
  121. package/lib/components/pisellToast/squareToast/methods.d.ts +13 -0
  122. package/lib/components/pisellToast/squareToast/renderImperatively.d.ts +29 -0
  123. package/lib/components/pisellToast/squareToast/toast.d.ts +25 -0
  124. package/lib/components/pisellWalletPassCard/index.d.ts +1 -1
  125. package/lib/components/pisellWalletPassCard/index.js +2 -1
  126. package/lib/components/productCard/cartSkuCard/components/MultiDay/index.d.ts +3 -0
  127. package/lib/components/productCard/cartSkuCard/components/MultiDay/utils.d.ts +14 -0
  128. package/lib/components/productCard/cartSkuCard/components/holders/index.d.ts +3 -0
  129. package/lib/components/productCard/cartSkuCard/components/packages/utils.d.ts +1 -1
  130. package/lib/components/productCard/cartSkuCard/components/resources/index.d.ts +3 -0
  131. package/lib/components/productCard/cartSkuCard/components/timeRange/index.d.ts +6 -0
  132. package/lib/components/productCard/cartSkuCard/locales.d.ts +96 -0
  133. package/lib/components/productCard/components/Action/index.d.ts +3 -0
  134. package/lib/components/productCard/components/Packages/utils.d.ts +1 -1
  135. package/lib/components/productCard/locales.d.ts +84 -0
  136. package/lib/components/productCard/status.d.ts +32 -0
  137. package/lib/components/productCard/types.d.ts +84 -0
  138. package/lib/components/table/Gallery/components/VirtualGrid/useGapSize.d.ts +2 -2
  139. package/lib/components/table/Table/SelectField/index.d.ts +0 -1
  140. package/lib/components/table/Table/fields/index.d.ts +0 -1
  141. package/lib/components/table/Table/fields/select/filterUtil/index.d.ts +1 -1
  142. package/lib/components/table/Table/fields/text/Show/index.d.ts +0 -1
  143. package/lib/components/table/Table/fields/text/index.d.ts +0 -1
  144. package/lib/components/table/Table/fields/treeSelect/filterUtil/index.d.ts +1 -1
  145. package/lib/components/table/Table/utils.d.ts +1 -1
  146. package/lib/components/table/hooks/useTableSetting.js +1 -1
  147. package/lib/components/virtual-keyboard/Amount/themeConfig.d.ts +32 -0
  148. package/lib/components/virtual-keyboard/Amount/types.d.ts +44 -0
  149. package/lib/components/virtual-keyboard/BaseNumberKeyboard/Presets.d.ts +5 -1
  150. package/lib/components/virtual-keyboard/BaseNumberKeyboard/Presets.js +19 -2
  151. package/lib/components/virtual-keyboard/BaseNumberKeyboard/Presets.less +9 -5
  152. package/lib/components/virtual-keyboard/BaseNumberKeyboard/index.d.ts +4 -0
  153. package/lib/components/virtual-keyboard/BaseNumberKeyboard/index.js +45 -27
  154. package/lib/components/virtual-keyboard/Keyboard/index.d.ts +21 -0
  155. package/lib/components/virtual-keyboard/Number/themeConfig.d.ts +32 -0
  156. package/lib/components/virtual-keyboard/Number/types.d.ts +26 -0
  157. package/lib/components/virtual-keyboard/VirtualKeyInput/index.d.ts +13 -0
  158. package/lib/components/virtualInput/BaseVirtualInput/index.d.ts +40 -0
  159. package/lib/components/virtualInput/BaseVirtualInput/index.js +179 -0
  160. package/lib/components/virtualInput/BaseVirtualInput/index.less +78 -0
  161. package/lib/components/virtualInput/index.d.ts +24 -0
  162. package/lib/components/virtualInput/index.js +102 -0
  163. package/lib/components/virtualInput/index.less +42 -0
  164. package/lib/components/walletCard/Guide/index.d.ts +3 -0
  165. package/lib/components/walletCard/index.d.ts +67 -0
  166. package/lib/index.d.ts +2 -0
  167. package/lib/index.js +6 -0
  168. package/lib/locales/en-US.d.ts +286 -0
  169. package/lib/locales/en-US.js +1 -0
  170. package/lib/locales/zh-CN.d.ts +281 -0
  171. package/lib/locales/zh-CN.js +1 -0
  172. package/lib/locales/zh-TW.d.ts +281 -0
  173. package/lib/locales/zh-TW.js +1 -0
  174. package/lib/utils/index.d.ts +1 -1
  175. package/lib/utils/platform.d.ts +1 -1
  176. package/package.json +3 -3
  177. package/dist/umd/materials.min.css +0 -1
  178. package/dist/umd/materials.min.js +0 -1
  179. package/dist/umd/static/DotsSix.57d66266.svg +0 -1
  180. package/dist/umd/static/arrow-left.e542294f.svg +0 -1
  181. package/dist/umd/static/arrow-right.763f03e0.svg +0 -1
  182. package/dist/umd/static/filter-lines.04a54ae9.svg +0 -1
  183. package/dist/umd/static/help-circle.31c9be40.svg +0 -1
  184. package/dist/umd/static/switch-vertical-01.7ebe3ba8.svg +0 -1
@@ -1,18 +1,22 @@
1
1
  .pisell-virtual-keyboard-preset {
2
- display: flex;
2
+ display: grid;
3
+ grid-template-columns: repeat(4, 1fr);
3
4
  gap: 7px;
4
- flex-wrap: wrap;
5
5
  margin-bottom: 8px;
6
+
6
7
  .pisell-virtual-keyboard-preset-item {
7
8
  display: flex;
8
- flex: 1;
9
9
  padding: 12px 20px;
10
10
  align-items: center;
11
11
  justify-content: center;
12
- height: 48px;
12
+ height: 40px;
13
13
  border-radius: 8px;
14
- border: 1px solid var(--Gray-300, #D0D5DD);
14
+ border: 1px solid var(--Gray-300, #E9D7FE);
15
15
  box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
16
16
  background: var(--Primary-25, #FCFAFF);
17
+ font-weight: 600;
18
+ color: #6941C6;
19
+ cursor: pointer;
20
+ position: relative;
17
21
  }
18
22
  }
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { PresetsProps } from './Presets';
3
+ import { KeyboardProps } from '../Keyboard';
3
4
  import { RightItemsStyleProps } from '../Amount';
4
5
  import './index.less';
5
6
  export interface BaseNumberKeyboardProps {
@@ -16,6 +17,9 @@ export interface BaseNumberKeyboardProps {
16
17
  presets?: PresetsProps['presets'];
17
18
  defaultSelect?: boolean;
18
19
  rightItemsStyle?: RightItemsStyleProps;
20
+ customDisplay?: React.ReactNode | ((props: any) => React.ReactNode);
21
+ keyboardProps?: KeyboardProps;
22
+ style?: React.CSSProperties;
19
23
  }
20
24
  declare const BaseNumberKeyboard: (props: BaseNumberKeyboardProps) => JSX.Element;
21
25
  export default BaseNumberKeyboard;
@@ -128,7 +128,9 @@ var BaseNumberKeyboard = (props) => {
128
128
  onEnter,
129
129
  presets,
130
130
  defaultSelect,
131
- rightItemsStyle
131
+ rightItemsStyle,
132
+ customDisplay,
133
+ style
132
134
  } = props;
133
135
  const [value, setValue] = (0, import_ahooks.useControllableValue)(props, {
134
136
  defaultValue
@@ -200,6 +202,8 @@ var BaseNumberKeyboard = (props) => {
200
202
  }
201
203
  };
202
204
  const handleChangeValue = (val) => {
205
+ var _a;
206
+ val = typeof val === "string" ? val : ((_a = val == null ? void 0 : val.target) == null ? void 0 : _a.value) || "";
203
207
  const detail = checkValue(val);
204
208
  if (detail) return;
205
209
  setValue(val);
@@ -228,38 +232,52 @@ var BaseNumberKeyboard = (props) => {
228
232
  const handleKeyboardChange = (0, import_ahooks.useMemoizedFn)((val) => {
229
233
  return (actions[val] || actions.default)(val);
230
234
  });
231
- return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-virtual-keyboard-base" }, /* @__PURE__ */ import_react.default.createElement(
232
- import_VirtualKeyInput.default,
233
- {
234
- value,
235
- onChange: (e) => handleChangeValue(e.target.value),
236
- renderInput: (props2) => {
237
- if ((0, import_utils.isUndefined)(props2.value) || props2.value === "") {
238
- return /* @__PURE__ */ import_react.default.createElement(
239
- import_VirtualInput.default,
240
- {
241
- autoFocus: true,
242
- placeholder,
243
- value: props2.value
244
- }
245
- );
246
- }
247
- return (format == null ? void 0 : format(props2.value)) || props2.value;
248
- },
249
- showDelete: false,
250
- onValueSelect: setSelect,
251
- defaultSelect,
252
- style: {
253
- backgroundColor: (rightItemsStyle == null ? void 0 : rightItemsStyle.buttonBackgroundColor) || "#fff",
254
- color: (rightItemsStyle == null ? void 0 : rightItemsStyle.textColor) || "#000000"
235
+ const renderDisplayField = () => {
236
+ if (customDisplay) {
237
+ if (typeof customDisplay === "function") {
238
+ return customDisplay({
239
+ value,
240
+ onChange: handleChangeValue,
241
+ onValueSelect: setSelect
242
+ });
255
243
  }
244
+ return customDisplay;
256
245
  }
257
- ), /* @__PURE__ */ import_react.default.createElement(import_Presets.default, { presets, onChange: handleChangeValue }), /* @__PURE__ */ import_react.default.createElement(
246
+ return /* @__PURE__ */ import_react.default.createElement(
247
+ import_VirtualKeyInput.default,
248
+ {
249
+ value,
250
+ onChange: (e) => handleChangeValue(e.target.value),
251
+ renderInput: (props2) => {
252
+ if ((0, import_utils.isUndefined)(props2.value) || props2.value === "") {
253
+ return /* @__PURE__ */ import_react.default.createElement(
254
+ import_VirtualInput.default,
255
+ {
256
+ autoFocus: true,
257
+ placeholder,
258
+ value: props2.value
259
+ }
260
+ );
261
+ }
262
+ return (format == null ? void 0 : format(props2.value)) || props2.value;
263
+ },
264
+ showDelete: false,
265
+ onValueSelect: setSelect,
266
+ defaultSelect,
267
+ style: {
268
+ backgroundColor: (rightItemsStyle == null ? void 0 : rightItemsStyle.buttonBackgroundColor) || "#fff",
269
+ color: (rightItemsStyle == null ? void 0 : rightItemsStyle.textColor) || "#000000"
270
+ }
271
+ }
272
+ );
273
+ };
274
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-virtual-keyboard-base", style }, renderDisplayField(), /* @__PURE__ */ import_react.default.createElement(import_Presets.default, { presets, onChange: handleChangeValue }), /* @__PURE__ */ import_react.default.createElement(
258
275
  import_Keyboard.default,
259
276
  {
260
277
  items: itemsWithStyle,
261
278
  rightItems,
262
- onChange: handleKeyboardChange
279
+ onChange: handleKeyboardChange,
280
+ ...props.keyboardProps || {}
263
281
  }
264
282
  ));
265
283
  };
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export declare type ItemValue = string | number;
4
+ export interface Item {
5
+ value: ItemValue;
6
+ label: React.ReactNode;
7
+ disabled: boolean;
8
+ type: 'text' | 'primary';
9
+ style?: React.CSSProperties;
10
+ size?: number;
11
+ }
12
+ export interface KeyboardProps {
13
+ className?: string;
14
+ style?: React.CSSProperties;
15
+ onChange?: (value?: ItemValue) => void;
16
+ items?: Item[];
17
+ rightItems?: Item[];
18
+ keydown?: boolean;
19
+ }
20
+ declare const _default: React.MemoExoticComponent<(props: KeyboardProps) => JSX.Element>;
21
+ export default _default;
@@ -0,0 +1,32 @@
1
+ export declare const numberThemeConfig: {
2
+ dark: {
3
+ backgroundColor: string;
4
+ containerBackgroundColor: string;
5
+ buttonBackgroundColor: string;
6
+ textColor: string;
7
+ resetButtonBackgroundColor: string;
8
+ resetButtonTextColor: string;
9
+ isDoneButtonFollowTheme: boolean;
10
+ doneButtonBackgroundColor: string;
11
+ doneButtonTextColor: string;
12
+ keyboardBackgroundColor: string;
13
+ keyboardButtonBackgroundColor: string;
14
+ keyboardButtonTextColor: string;
15
+ keyboardButtonHoverColor: string;
16
+ };
17
+ light: {
18
+ backgroundColor: string;
19
+ containerBackgroundColor: string;
20
+ buttonBackgroundColor: string;
21
+ textColor: string;
22
+ resetButtonBackgroundColor: string;
23
+ resetButtonTextColor: string;
24
+ isDoneButtonFollowTheme: boolean;
25
+ doneButtonBackgroundColor: string;
26
+ doneButtonTextColor: string;
27
+ keyboardBackgroundColor: string;
28
+ keyboardButtonBackgroundColor: string;
29
+ keyboardButtonTextColor: string;
30
+ keyboardButtonHoverColor: string;
31
+ };
32
+ };
@@ -0,0 +1,26 @@
1
+ export interface NumberProps {
2
+ max?: number;
3
+ min?: number;
4
+ doneText?: string;
5
+ resetText: string;
6
+ defaultValue?: string | number;
7
+ placeholder?: string;
8
+ value?: string | number;
9
+ onChange?: (val: string | number) => void;
10
+ onEnter?: (val: string | number) => void;
11
+ defaultSelect?: boolean;
12
+ selectType?: 'light' | 'dark';
13
+ backgroundColor?: string;
14
+ containerBackgroundColor?: string;
15
+ buttonBackgroundColor?: string;
16
+ textColor?: string;
17
+ resetButtonBackgroundColor?: string;
18
+ resetButtonTextColor?: string;
19
+ isDoneButtonFollowTheme?: boolean;
20
+ doneButtonBackgroundColor?: string;
21
+ doneButtonTextColor?: string;
22
+ keyboardBackgroundColor?: string;
23
+ keyboardButtonBackgroundColor?: string;
24
+ keyboardButtonTextColor?: string;
25
+ keyboardButtonHoverColor?: string;
26
+ }
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { InputProps } from 'antd';
3
+ import './index.less';
4
+ export interface VirtualKeyInputProps extends InputProps {
5
+ previewValue?: string;
6
+ renderInput?: (props: any) => any;
7
+ showDelete?: boolean;
8
+ onValueSelect?: (selected: boolean) => void;
9
+ defaultSelect?: boolean;
10
+ style?: React.CSSProperties;
11
+ }
12
+ declare const VirtualKeyInput: (props: VirtualKeyInputProps) => JSX.Element;
13
+ export default VirtualKeyInput;
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export interface BaseVirtualInputProps {
4
+ /** 输入值 */
5
+ value?: string | React.ReactNode;
6
+ /** 占位符 */
7
+ placeholder?: string;
8
+ /** 是否自动聚焦 */
9
+ autoFocus?: boolean;
10
+ /** 是否禁用 */
11
+ disabled?: boolean;
12
+ /** 组件高度,默认60px */
13
+ height?: number | string;
14
+ /** 字体大小,默认48px,如果不设置会根据高度自动计算 */
15
+ fontSize?: number | string;
16
+ /** 聚焦回调 */
17
+ onFocus?: () => void;
18
+ /** 失焦回调 */
19
+ onBlur?: () => void;
20
+ /** 文字位置 */
21
+ textAlign?: 'start' | 'center' | 'end';
22
+ /** 自定义样式 */
23
+ style?: React.CSSProperties;
24
+ /** 自定义类名 */
25
+ className?: string;
26
+ /** showCursor */
27
+ showCursor?: boolean;
28
+ /** 防止失焦的元素选择器或ref */
29
+ preventBlurElements?: Array<string | React.RefObject<HTMLElement>>;
30
+ /** 是否聚焦(受控模式) */
31
+ focused?: boolean;
32
+ }
33
+ export interface BaseVirtualInputRef {
34
+ /** 手动聚焦 */
35
+ focus: () => void;
36
+ /** 手动失焦 */
37
+ blur: () => void;
38
+ }
39
+ declare const BaseVirtualInput: React.ForwardRefExoticComponent<BaseVirtualInputProps & React.RefAttributes<BaseVirtualInputRef>>;
40
+ export default BaseVirtualInput;
@@ -0,0 +1,179 @@
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/virtualInput/BaseVirtualInput/index.tsx
30
+ var BaseVirtualInput_exports = {};
31
+ __export(BaseVirtualInput_exports, {
32
+ default: () => BaseVirtualInput_default
33
+ });
34
+ module.exports = __toCommonJS(BaseVirtualInput_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_classnames = __toESM(require("classnames"));
37
+ var import_auto_resize_text = __toESM(require("../../auto-resize-text"));
38
+ var import_index = require("./index.less");
39
+ var BaseVirtualInput = (0, import_react.forwardRef)(
40
+ (props, ref) => {
41
+ const {
42
+ value = "",
43
+ placeholder = "",
44
+ autoFocus = false,
45
+ disabled = false,
46
+ height = 60,
47
+ fontSize,
48
+ onFocus,
49
+ onBlur,
50
+ style,
51
+ className,
52
+ preventBlurElements = [],
53
+ focused,
54
+ showCursor = true
55
+ } = props;
56
+ const [localFocused, setLocalFocused] = (0, import_react.useState)(focused ?? autoFocus);
57
+ const internalFocused = "focused" in props ? props.focused : localFocused;
58
+ const containerRef = (0, import_react.useRef)(null);
59
+ const handleFocus = (0, import_react.useCallback)(() => {
60
+ if (disabled) return;
61
+ setLocalFocused(true);
62
+ onFocus == null ? void 0 : onFocus();
63
+ }, [disabled, onFocus]);
64
+ const handleBlur = (0, import_react.useCallback)(() => {
65
+ setLocalFocused(false);
66
+ onBlur == null ? void 0 : onBlur();
67
+ }, [onBlur]);
68
+ const shouldPreventBlur = (0, import_react.useCallback)(
69
+ (target) => {
70
+ if (!target || !(target instanceof Element)) return false;
71
+ return preventBlurElements.some((element) => {
72
+ if (typeof element === "string") {
73
+ const matchedElements = document.querySelectorAll(element);
74
+ return Array.from(matchedElements).some(
75
+ (el) => el.contains(target) || el === target
76
+ );
77
+ } else if (element && "current" in element && element.current) {
78
+ return element.current.contains(target);
79
+ }
80
+ return false;
81
+ });
82
+ },
83
+ [preventBlurElements]
84
+ );
85
+ (0, import_react.useEffect)(() => {
86
+ const handleGlobalClick = (event) => {
87
+ if (!internalFocused) return;
88
+ const target = event.target;
89
+ if (containerRef.current && containerRef.current.contains(target)) {
90
+ return;
91
+ }
92
+ if (shouldPreventBlur(target)) {
93
+ return;
94
+ }
95
+ handleBlur();
96
+ };
97
+ if (internalFocused) {
98
+ document.addEventListener("mousedown", handleGlobalClick);
99
+ }
100
+ return () => {
101
+ document.removeEventListener("mousedown", handleGlobalClick);
102
+ };
103
+ }, [internalFocused, handleBlur, shouldPreventBlur]);
104
+ const handleClick = (0, import_react.useCallback)(
105
+ (event) => {
106
+ handleFocus();
107
+ },
108
+ [handleFocus]
109
+ );
110
+ (0, import_react.useImperativeHandle)(
111
+ ref,
112
+ () => ({
113
+ focus: handleFocus,
114
+ blur: handleBlur
115
+ }),
116
+ [handleFocus, handleBlur]
117
+ );
118
+ const componentHeight = typeof height === "number" ? `${height}px` : height;
119
+ const getBaseFontSize = (0, import_react.useCallback)(() => {
120
+ if (fontSize) {
121
+ return typeof fontSize === "number" ? fontSize : parseFloat(fontSize);
122
+ }
123
+ return typeof height === "number" ? height * 0.8 : 48;
124
+ }, [fontSize, height]);
125
+ const baseFontSize = getBaseFontSize();
126
+ const minFontSize = Math.max(10, baseFontSize * 0.2);
127
+ const maxFontSize = baseFontSize;
128
+ const caretHeight = `calc(${componentHeight} * 0.67)`;
129
+ const mergedStyle = {
130
+ ...style,
131
+ "--virtual-input-height": componentHeight,
132
+ "--virtual-input-caret-height": caretHeight,
133
+ "--virtual-input-font-size": `${baseFontSize}px`
134
+ };
135
+ const showPlaceholder = value === void 0 || value === "";
136
+ return /* @__PURE__ */ import_react.default.createElement(
137
+ "div",
138
+ {
139
+ ref: containerRef,
140
+ className: (0, import_classnames.default)(
141
+ "pisell-base-virtual-input",
142
+ {
143
+ "pisell-base-virtual-input--focused": internalFocused,
144
+ "pisell-base-virtual-input--disabled": disabled
145
+ },
146
+ className
147
+ ),
148
+ style: mergedStyle,
149
+ onClick: handleClick
150
+ },
151
+ showPlaceholder && /* @__PURE__ */ import_react.default.createElement(
152
+ import_auto_resize_text.default,
153
+ {
154
+ className: "pisell-base-virtual-input-placeholder",
155
+ mode: "oneline",
156
+ minFontSizePx: minFontSize,
157
+ maxFontSizePx: maxFontSize,
158
+ fontSizePrecisionPx: 0.5
159
+ },
160
+ placeholder
161
+ ),
162
+ !!value && /* @__PURE__ */ import_react.default.createElement(
163
+ import_auto_resize_text.default,
164
+ {
165
+ className: "pisell-base-virtual-input-value",
166
+ mode: "oneline",
167
+ minFontSizePx: minFontSize,
168
+ maxFontSizePx: maxFontSize,
169
+ fontSizePrecisionPx: 0.5,
170
+ scrollToEnd: true
171
+ },
172
+ value
173
+ ),
174
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-base-virtual-input-caret-container" }, internalFocused && !disabled && showCursor && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-base-virtual-input-caret" }))
175
+ );
176
+ }
177
+ );
178
+ BaseVirtualInput.displayName = "BaseVirtualInput";
179
+ var BaseVirtualInput_default = BaseVirtualInput;
@@ -0,0 +1,78 @@
1
+ .pisell-base-virtual-input {
2
+ width: 100%;
3
+ display: flex;
4
+ align-items: center;
5
+ background-color: transparent;
6
+ cursor: pointer;
7
+ transition: all 0.2s ease;
8
+ outline: none;
9
+ position: relative;
10
+ height: var(--virtual-input-height);
11
+
12
+ &--disabled {
13
+ cursor: not-allowed;
14
+ opacity: 0.6;
15
+ }
16
+ }
17
+
18
+ .pisell-base-virtual-input-placeholder {
19
+ color: #98a2b3;
20
+ font-weight: 400;
21
+ user-select: none;
22
+ position: absolute;
23
+ left: 0;
24
+ top: 0;
25
+ width: 100%;
26
+ max-width: 100%;
27
+ overflow: hidden;
28
+ pointer-events: none;
29
+ font-size: var(--virtual-input-font-size);
30
+ height: var(--virtual-input-height);
31
+ line-height: var(--virtual-input-height);
32
+ }
33
+
34
+ .pisell-base-virtual-input-value {
35
+ color: #101828;
36
+ font-weight: 600;
37
+ white-space: nowrap;
38
+ flex-shrink: 0;
39
+ // width: 100%;
40
+ max-width: 100%;
41
+ overflow-y: hidden;
42
+ overflow-x: auto;
43
+ font-size: var(--virtual-input-font-size);
44
+ line-height: var(--virtual-input-height);
45
+ height: var(--virtual-input-height);
46
+
47
+ -ms-overflow-style: none; /* IE 和 Edge */
48
+ scrollbar-width: none; /* Firefox */
49
+ &::-webkit-scrollbar {
50
+ display: none; /* Chrome, Safari 和 Opera */
51
+ }
52
+ }
53
+
54
+ .pisell-base-virtual-input-caret-container {
55
+ height: 100%;
56
+ display: flex;
57
+ align-items: center;
58
+ flex-shrink: 0;
59
+ }
60
+
61
+ .pisell-base-virtual-input-caret {
62
+ width: 2px;
63
+ height: var(--virtual-input-caret-height);
64
+ background-color: #1570ef;
65
+ border-radius: 1px;
66
+ animation: pisell-base-virtual-input-caret-blink 1s infinite;
67
+ }
68
+
69
+ @keyframes pisell-base-virtual-input-caret-blink {
70
+ 0%,
71
+ 50% {
72
+ opacity: 1;
73
+ }
74
+ 51%,
75
+ 100% {
76
+ opacity: 0;
77
+ }
78
+ }
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { BaseVirtualInputProps, BaseVirtualInputRef } from './BaseVirtualInput';
3
+ import './index.less';
4
+ export { BaseVirtualInputProps, BaseVirtualInputRef } from './BaseVirtualInput';
5
+ export interface VirtualInputProps extends BaseVirtualInputProps {
6
+ /** 在VirtualInput上方显示的额外内容 */
7
+ topContent?: React.ReactNode;
8
+ /** 在VirtualInput下方显示的额外内容 */
9
+ bottomContent?: React.ReactNode;
10
+ /** wrapper class */
11
+ wrapperClassName?: string;
12
+ /** 虚拟输入框包装器的样式 */
13
+ wrapperStyle?: React.CSSProperties;
14
+ /** 是否允许清除输入框中的内容 */
15
+ allowClear?: boolean;
16
+ /** 清除输入框内容的回调函数 */
17
+ onClear?: () => void;
18
+ /** 自定义清除按钮的样式 */
19
+ clearButtonStyle?: React.CSSProperties;
20
+ }
21
+ export interface VirtualInputRef extends BaseVirtualInputRef {
22
+ }
23
+ declare const VirtualInput: React.ForwardRefExoticComponent<VirtualInputProps & React.RefAttributes<VirtualInputRef>>;
24
+ export default VirtualInput;
@@ -0,0 +1,102 @@
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/virtualInput/index.tsx
30
+ var virtualInput_exports = {};
31
+ __export(virtualInput_exports, {
32
+ BaseVirtualInputProps: () => import_BaseVirtualInput2.BaseVirtualInputProps,
33
+ BaseVirtualInputRef: () => import_BaseVirtualInput2.BaseVirtualInputRef,
34
+ default: () => virtualInput_default
35
+ });
36
+ module.exports = __toCommonJS(virtualInput_exports);
37
+ var import_react = __toESM(require("react"));
38
+ var import_classnames = __toESM(require("classnames"));
39
+ var import_icon = __toESM(require("../icon"));
40
+ var import_BaseVirtualInput = __toESM(require("./BaseVirtualInput"));
41
+ var import_index = require("./index.less");
42
+ var import_BaseVirtualInput2 = require("./BaseVirtualInput");
43
+ var VirtualInput = (0, import_react.forwardRef)(
44
+ ({
45
+ topContent,
46
+ bottomContent,
47
+ wrapperStyle,
48
+ wrapperClassName,
49
+ allowClear = false,
50
+ onClear,
51
+ value,
52
+ clearButtonStyle,
53
+ ...virtualInputProps
54
+ }, ref) => {
55
+ const baseInputRef = (0, import_react.useRef)(null);
56
+ const handleClear = () => {
57
+ onClear == null ? void 0 : onClear();
58
+ };
59
+ (0, import_react.useImperativeHandle)(ref, () => ({
60
+ focus: () => {
61
+ var _a;
62
+ return (_a = baseInputRef.current) == null ? void 0 : _a.focus();
63
+ },
64
+ blur: () => {
65
+ var _a;
66
+ return (_a = baseInputRef.current) == null ? void 0 : _a.blur();
67
+ }
68
+ }));
69
+ return /* @__PURE__ */ import_react.default.createElement(
70
+ "div",
71
+ {
72
+ className: (0, import_classnames.default)("pisell-virtual-input-wrapper", wrapperClassName),
73
+ style: wrapperStyle
74
+ },
75
+ topContent,
76
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-virtual-input-container" }, /* @__PURE__ */ import_react.default.createElement(
77
+ import_BaseVirtualInput.default,
78
+ {
79
+ ref: baseInputRef,
80
+ value,
81
+ ...virtualInputProps
82
+ }
83
+ ), allowClear && /* @__PURE__ */ import_react.default.createElement(
84
+ "div",
85
+ {
86
+ className: "pisell-virtual-input-clear-button",
87
+ onClick: handleClear,
88
+ style: clearButtonStyle
89
+ },
90
+ /* @__PURE__ */ import_react.default.createElement(import_icon.default, { type: "pisell2-delete" })
91
+ )),
92
+ bottomContent
93
+ );
94
+ }
95
+ );
96
+ VirtualInput.displayName = "VirtualInput";
97
+ var virtualInput_default = VirtualInput;
98
+ // Annotate the CommonJS export names for ESM import in node:
99
+ 0 && (module.exports = {
100
+ BaseVirtualInputProps,
101
+ BaseVirtualInputRef
102
+ });