@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
@@ -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,163 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ import React, { useState, useCallback, useEffect, useRef, forwardRef, useImperativeHandle } from 'react';
14
+ import classNames from 'classnames';
15
+ import AutoResizeText from "../../auto-resize-text";
16
+ import "./index.less";
17
+ var BaseVirtualInput = /*#__PURE__*/forwardRef(function (props, ref) {
18
+ var _props$value = props.value,
19
+ value = _props$value === void 0 ? '' : _props$value,
20
+ _props$placeholder = props.placeholder,
21
+ placeholder = _props$placeholder === void 0 ? '' : _props$placeholder,
22
+ _props$autoFocus = props.autoFocus,
23
+ autoFocus = _props$autoFocus === void 0 ? false : _props$autoFocus,
24
+ _props$disabled = props.disabled,
25
+ disabled = _props$disabled === void 0 ? false : _props$disabled,
26
+ _props$height = props.height,
27
+ height = _props$height === void 0 ? 60 : _props$height,
28
+ fontSize = props.fontSize,
29
+ onFocus = props.onFocus,
30
+ onBlur = props.onBlur,
31
+ style = props.style,
32
+ className = props.className,
33
+ _props$preventBlurEle = props.preventBlurElements,
34
+ preventBlurElements = _props$preventBlurEle === void 0 ? [] : _props$preventBlurEle,
35
+ focused = props.focused,
36
+ _props$showCursor = props.showCursor,
37
+ showCursor = _props$showCursor === void 0 ? true : _props$showCursor;
38
+ // 使用 useControllableValue 管理 focused 状态
39
+ var _useState = useState(focused !== null && focused !== void 0 ? focused : autoFocus),
40
+ _useState2 = _slicedToArray(_useState, 2),
41
+ localFocused = _useState2[0],
42
+ setLocalFocused = _useState2[1];
43
+ var internalFocused = 'focused' in props ? props.focused : localFocused;
44
+ var containerRef = useRef(null);
45
+
46
+ // 处理聚焦
47
+ var handleFocus = useCallback(function () {
48
+ if (disabled) return;
49
+ setLocalFocused(true);
50
+ onFocus === null || onFocus === void 0 || onFocus();
51
+ }, [disabled, onFocus]);
52
+
53
+ // 处理失焦
54
+ var handleBlur = useCallback(function () {
55
+ setLocalFocused(false);
56
+ onBlur === null || onBlur === void 0 || onBlur();
57
+ }, [onBlur]);
58
+ var shouldPreventBlur = useCallback(function (target) {
59
+ if (!target || !(target instanceof Element)) return false;
60
+ return preventBlurElements.some(function (element) {
61
+ if (typeof element === 'string') {
62
+ // 字符串选择器 - 查找页面中所有匹配的元素,检查是否包含目标元素
63
+ var matchedElements = document.querySelectorAll(element);
64
+ return Array.from(matchedElements).some(function (el) {
65
+ return el.contains(target) || el === target;
66
+ });
67
+ } else if (element && 'current' in element && element.current) {
68
+ // React ref
69
+ return element.current.contains(target);
70
+ }
71
+ return false;
72
+ });
73
+ }, [preventBlurElements]);
74
+ useEffect(function () {
75
+ var handleGlobalClick = function handleGlobalClick(event) {
76
+ if (!internalFocused) return;
77
+ var target = event.target;
78
+ if (containerRef.current && containerRef.current.contains(target)) {
79
+ return;
80
+ }
81
+ if (shouldPreventBlur(target)) {
82
+ return;
83
+ }
84
+ handleBlur();
85
+ };
86
+ if (internalFocused) {
87
+ document.addEventListener('mousedown', handleGlobalClick);
88
+ }
89
+ return function () {
90
+ document.removeEventListener('mousedown', handleGlobalClick);
91
+ };
92
+ }, [internalFocused, handleBlur, shouldPreventBlur]);
93
+
94
+ // 处理点击事件
95
+ var handleClick = useCallback(function (event) {
96
+ handleFocus();
97
+ }, [handleFocus]);
98
+
99
+ // 暴露给父组件的方法
100
+ useImperativeHandle(ref, function () {
101
+ return {
102
+ focus: handleFocus,
103
+ blur: handleBlur
104
+ };
105
+ }, [handleFocus, handleBlur]);
106
+
107
+ // 计算组件高度
108
+ var componentHeight = typeof height === 'number' ? "".concat(height, "px") : height;
109
+
110
+ // 获取基础字体大小
111
+ var getBaseFontSize = useCallback(function () {
112
+ if (fontSize) {
113
+ return typeof fontSize === 'number' ? fontSize : parseFloat(fontSize);
114
+ }
115
+ return typeof height === 'number' ? height * 0.8 : 48;
116
+ }, [fontSize, height]);
117
+
118
+ // 计算最小和最大字体大小
119
+ var baseFontSize = getBaseFontSize();
120
+ var minFontSize = Math.max(10, baseFontSize * 0.2);
121
+ var maxFontSize = baseFontSize;
122
+
123
+ // 计算光标高度(容器高度的三分之二)
124
+ var caretHeight = "calc(".concat(componentHeight, " * 0.67)");
125
+
126
+ // 合并样式,将高度和光标高度传递给组件
127
+ var mergedStyle = _objectSpread(_objectSpread({}, style), {}, {
128
+ '--virtual-input-height': componentHeight,
129
+ '--virtual-input-caret-height': caretHeight,
130
+ '--virtual-input-font-size': "".concat(baseFontSize, "px")
131
+ });
132
+
133
+ // 是否显示占位符
134
+ var showPlaceholder = value === undefined || value === '';
135
+ return /*#__PURE__*/React.createElement("div", {
136
+ ref: containerRef,
137
+ className: classNames('pisell-base-virtual-input', {
138
+ 'pisell-base-virtual-input--focused': internalFocused,
139
+ 'pisell-base-virtual-input--disabled': disabled
140
+ }, className),
141
+ style: mergedStyle,
142
+ onClick: handleClick
143
+ }, showPlaceholder && /*#__PURE__*/React.createElement(AutoResizeText, {
144
+ className: "pisell-base-virtual-input-placeholder",
145
+ mode: "oneline",
146
+ minFontSizePx: minFontSize,
147
+ maxFontSizePx: maxFontSize,
148
+ fontSizePrecisionPx: 0.5
149
+ }, placeholder), !!value && /*#__PURE__*/React.createElement(AutoResizeText, {
150
+ className: "pisell-base-virtual-input-value",
151
+ mode: "oneline",
152
+ minFontSizePx: minFontSize,
153
+ maxFontSizePx: maxFontSize,
154
+ fontSizePrecisionPx: 0.5,
155
+ scrollToEnd: true
156
+ }, value), /*#__PURE__*/React.createElement("div", {
157
+ className: "pisell-base-virtual-input-caret-container"
158
+ }, internalFocused && !disabled && showCursor && /*#__PURE__*/React.createElement("div", {
159
+ className: "pisell-base-virtual-input-caret"
160
+ })));
161
+ });
162
+ BaseVirtualInput.displayName = 'BaseVirtualInput';
163
+ export 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,60 @@
1
+ var _excluded = ["topContent", "bottomContent", "wrapperStyle", "wrapperClassName", "allowClear", "onClear", "value", "clearButtonStyle"];
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
+ import React, { forwardRef, useImperativeHandle, useRef } from 'react';
6
+ import classNames from 'classnames';
7
+ import Icon from "../icon";
8
+ import BaseVirtualInput from "./BaseVirtualInput";
9
+ import "./index.less";
10
+ export { BaseVirtualInputProps, BaseVirtualInputRef } from "./BaseVirtualInput";
11
+ var VirtualInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
12
+ var topContent = _ref.topContent,
13
+ bottomContent = _ref.bottomContent,
14
+ wrapperStyle = _ref.wrapperStyle,
15
+ wrapperClassName = _ref.wrapperClassName,
16
+ _ref$allowClear = _ref.allowClear,
17
+ allowClear = _ref$allowClear === void 0 ? false : _ref$allowClear,
18
+ onClear = _ref.onClear,
19
+ value = _ref.value,
20
+ clearButtonStyle = _ref.clearButtonStyle,
21
+ virtualInputProps = _objectWithoutProperties(_ref, _excluded);
22
+ var baseInputRef = useRef(null);
23
+
24
+ // 处理清除操作
25
+ var handleClear = function handleClear() {
26
+ // 全部清除
27
+ onClear === null || onClear === void 0 || onClear();
28
+ };
29
+
30
+ // 暴露给父组件的方法
31
+ useImperativeHandle(ref, function () {
32
+ return {
33
+ focus: function focus() {
34
+ var _baseInputRef$current;
35
+ return (_baseInputRef$current = baseInputRef.current) === null || _baseInputRef$current === void 0 ? void 0 : _baseInputRef$current.focus();
36
+ },
37
+ blur: function blur() {
38
+ var _baseInputRef$current2;
39
+ return (_baseInputRef$current2 = baseInputRef.current) === null || _baseInputRef$current2 === void 0 ? void 0 : _baseInputRef$current2.blur();
40
+ }
41
+ };
42
+ });
43
+ return /*#__PURE__*/React.createElement("div", {
44
+ className: classNames('pisell-virtual-input-wrapper', wrapperClassName),
45
+ style: wrapperStyle
46
+ }, topContent, /*#__PURE__*/React.createElement("div", {
47
+ className: "pisell-virtual-input-container"
48
+ }, /*#__PURE__*/React.createElement(BaseVirtualInput, _extends({
49
+ ref: baseInputRef,
50
+ value: value
51
+ }, virtualInputProps)), allowClear && /*#__PURE__*/React.createElement("div", {
52
+ className: "pisell-virtual-input-clear-button",
53
+ onClick: handleClear,
54
+ style: clearButtonStyle
55
+ }, /*#__PURE__*/React.createElement(Icon, {
56
+ type: "pisell2-delete"
57
+ }))), bottomContent);
58
+ });
59
+ VirtualInput.displayName = 'VirtualInput';
60
+ export default VirtualInput;
@@ -0,0 +1,42 @@
1
+ .pisell-virtual-input-wrapper {
2
+ overflow: hidden;
3
+ }
4
+
5
+ .pisell-virtual-input-container {
6
+ position: relative;
7
+ display: flex;
8
+ align-items: center;
9
+ width: 100%;
10
+ }
11
+
12
+ .pisell-virtual-input-clear-button {
13
+ position: absolute;
14
+ right: 8px;
15
+ top: 50%;
16
+ transform: translateY(-50%);
17
+ display: flex;
18
+ align-items: center;
19
+ justify-content: center;
20
+ width: 24px;
21
+ height: 24px;
22
+ cursor: pointer;
23
+ border-radius: 4px;
24
+ transition: all 0.2s ease;
25
+ color: #667085;
26
+ background-color: transparent;
27
+ z-index: 1;
28
+
29
+ &:hover {
30
+ background-color: #f2f4f7;
31
+ color: #344054;
32
+ }
33
+
34
+ &:active {
35
+ background-color: #e4e7ec;
36
+ }
37
+
38
+ svg {
39
+ width: 16px;
40
+ height: 16px;
41
+ }
42
+ }
@@ -0,0 +1,3 @@
1
+ import './index.less';
2
+ declare const Guide: (props: any) => JSX.Element;
3
+ export default Guide;
@@ -0,0 +1,67 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ declare global {
4
+ namespace JSX {
5
+ interface IntrinsicElements {
6
+ [elemName: string]: any;
7
+ }
8
+ }
9
+ }
10
+ export interface WalletCardItem {
11
+ key: string;
12
+ label?: string;
13
+ hidden?: boolean;
14
+ value?: number;
15
+ }
16
+ export interface WalletCardProps {
17
+ /** 二维码弹窗适配平台 */
18
+ platform?: 'pc' | 'h5' | 'ipad';
19
+ /** 卡片主题 */
20
+ mode?: 'dark' | 'light';
21
+ /** 默认还是完整显示code */
22
+ cardStyle?: 'normal' | 'full';
23
+ /** 条形码还是二维码 */
24
+ codeType?: 'barCode' | 'orCode';
25
+ /** 二维码方向 */
26
+ codeDirection?: 'bottom' | 'top';
27
+ /** 自定义背景图 */
28
+ customBackgroundImage?: string;
29
+ /** 图标:可以是React组件或图片URL */
30
+ showIcon?: boolean;
31
+ showWalletName?: boolean;
32
+ iconImg?: string;
33
+ /** 钱包名称 */
34
+ walletName?: string;
35
+ /** 店铺名称 */
36
+ shopName?: string;
37
+ /** 是否显示店铺名称 */
38
+ showShopName?: boolean;
39
+ /** 卡号 */
40
+ cardNo?: string;
41
+ /** 是否显示卡号 */
42
+ showCardNo?: boolean;
43
+ /** 是否显示二维码 */
44
+ showCode?: boolean;
45
+ /** 点击二维码/条形码的回调 */
46
+ onCodeClick?: () => void;
47
+ /** 货币符号 */
48
+ symbol: string;
49
+ /** 点击卡片的回调 */
50
+ onClick?: () => void;
51
+ /** 自定义类名 */
52
+ className?: string;
53
+ items: WalletCardItem[];
54
+ /** 自定义样式 */
55
+ style?: React.CSSProperties;
56
+ title?: string;
57
+ subTitle?: string;
58
+ align?: 'left' | 'center';
59
+ buttonText?: string;
60
+ [key: string]: any;
61
+ /** 是否已登录 */
62
+ isLogin?: boolean;
63
+ /** 是否是引导页 */
64
+ isGuide?: boolean;
65
+ }
66
+ declare const WalletCard: React.FC<WalletCardProps>;
67
+ export default WalletCard;
package/es/index.d.ts CHANGED
@@ -140,3 +140,5 @@ export { default as SectionFooters } from './components/section-footers';
140
140
  export { default as ProductCard } from './components/productCard';
141
141
  export { default as Collapse } from './components/collapse';
142
142
  export { default as PisellGoodPassCard } from './components/pisellGoodPassCard';
143
+ export { default as Keyboard } from './components/keyboard';
144
+ export { default as VirtualInput } from './components/virtualInput';
package/es/index.js CHANGED
@@ -138,4 +138,6 @@ export { default as PisellList01 } from "./components/pisellList01";
138
138
  export { default as SectionFooters } from "./components/section-footers";
139
139
  export { default as ProductCard } from "./components/productCard";
140
140
  export { default as Collapse } from "./components/collapse";
141
- export { default as PisellGoodPassCard } from "./components/pisellGoodPassCard";
141
+ export { default as PisellGoodPassCard } from "./components/pisellGoodPassCard";
142
+ export { default as Keyboard } from "./components/keyboard";
143
+ export { default as VirtualInput } from "./components/virtualInput";