@pisell/materials 2.2.87 → 2.2.89

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 (76) 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 +7 -7
  6. package/build/lowcode/preview.js +160 -144
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +36 -26
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +40 -30
  11. package/es/components/iconfont/index.d.ts +8 -0
  12. package/es/components/pisell-config-provider/index.d.ts +12 -0
  13. package/es/components/pisellWalletPassCard/index.d.ts +0 -1
  14. package/es/components/productCard/cartSkuCard/index.js +1 -1
  15. package/es/components/productCard/cartSkuCard/locales.d.ts +96 -0
  16. package/es/components/productCard/cartSkuCard/locales.js +6 -3
  17. package/es/components/select-time/index.d.ts +0 -1
  18. package/es/components/virtual-keyboard/Amount/index.js +73 -6
  19. package/es/components/virtual-keyboard/Amount/index.less +39 -0
  20. package/es/components/virtual-keyboard/Amount/themeConfig.js +32 -0
  21. package/es/components/virtual-keyboard/Amount/types.js +1 -0
  22. package/es/components/virtual-keyboard/Number/index.js +77 -7
  23. package/es/components/virtual-keyboard/Number/index.less +39 -0
  24. package/es/components/virtual-keyboard/Number/themeConfig.js +32 -0
  25. package/es/components/virtual-keyboard/Number/types.js +1 -0
  26. package/es/components/virtual-keyboard/index.d.ts +11 -0
  27. package/es/components/virtual-keyboard/index.js +88 -3
  28. package/es/components/virtual-keyboard/index.less +33 -1
  29. package/lib/components/iconfont/index.d.ts +8 -0
  30. package/lib/components/pisell-config-provider/index.d.ts +12 -0
  31. package/lib/components/pisellWalletPassCard/index.d.ts +0 -1
  32. package/lib/components/productCard/cartSkuCard/index.js +1 -1
  33. package/lib/components/productCard/cartSkuCard/locales.d.ts +96 -0
  34. package/lib/components/productCard/cartSkuCard/locales.js +6 -3
  35. package/lib/components/select-time/index.d.ts +0 -1
  36. package/lib/components/virtual-keyboard/Amount/index.js +68 -17
  37. package/lib/components/virtual-keyboard/Amount/index.less +39 -0
  38. package/lib/components/virtual-keyboard/Amount/themeConfig.js +60 -0
  39. package/lib/components/virtual-keyboard/Amount/types.js +17 -0
  40. package/lib/components/virtual-keyboard/Number/index.js +65 -11
  41. package/lib/components/virtual-keyboard/Number/index.less +39 -0
  42. package/lib/components/virtual-keyboard/Number/themeConfig.js +60 -0
  43. package/lib/components/virtual-keyboard/Number/types.js +17 -0
  44. package/lib/components/virtual-keyboard/index.d.ts +11 -0
  45. package/lib/components/virtual-keyboard/index.js +60 -2
  46. package/lib/components/virtual-keyboard/index.less +33 -1
  47. package/lowcode/pisell-number-keyboard/meta.ts +167 -0
  48. package/lowcode/pisell-price-keyboard/meta.ts +167 -0
  49. package/lowcode/virtual-keyboard/meta.ts +131 -0
  50. package/package.json +1 -1
  51. package/es/components/pisellAdjustPrice/index.d.ts +0 -4
  52. package/es/components/pisellAdjustPrice/status.d.ts +0 -32
  53. package/es/components/pisellAdjustPrice/type.d.ts +0 -20
  54. package/es/components/productCard/components/Warning/index.d.ts +0 -7
  55. package/es/components/productCard/index.d.ts +0 -7
  56. package/es/components/productCard/utils.d.ts +0 -31
  57. package/es/components/table/Actions/component/ExportImport/index.d.ts +0 -7
  58. package/es/components/virtual-keyboard/Amount/index.d.ts +0 -32
  59. package/es/components/virtual-keyboard/BaseNumberKeyboard/index.d.ts +0 -21
  60. package/es/components/virtual-keyboard/Keyboard/index.d.ts +0 -21
  61. package/es/components/virtual-keyboard/Number/index.d.ts +0 -13
  62. package/es/components/virtual-keyboard/VirtualKeyInput/index.d.ts +0 -13
  63. package/es/index.d.ts +0 -140
  64. package/lib/components/pisellAdjustPrice/index.d.ts +0 -4
  65. package/lib/components/pisellAdjustPrice/status.d.ts +0 -32
  66. package/lib/components/pisellAdjustPrice/type.d.ts +0 -20
  67. package/lib/components/productCard/components/Warning/index.d.ts +0 -7
  68. package/lib/components/productCard/index.d.ts +0 -7
  69. package/lib/components/productCard/utils.d.ts +0 -31
  70. package/lib/components/table/Actions/component/ExportImport/index.d.ts +0 -7
  71. package/lib/components/virtual-keyboard/Amount/index.d.ts +0 -32
  72. package/lib/components/virtual-keyboard/BaseNumberKeyboard/index.d.ts +0 -21
  73. package/lib/components/virtual-keyboard/Keyboard/index.d.ts +0 -21
  74. package/lib/components/virtual-keyboard/Number/index.d.ts +0 -13
  75. package/lib/components/virtual-keyboard/VirtualKeyInput/index.d.ts +0 -13
  76. package/lib/index.d.ts +0 -140
@@ -0,0 +1,8 @@
1
+ import { IconComponentProps } from '@ant-design/icons/es/components/Icon';
2
+ import React from 'react';
3
+ interface IconFontProps extends IconComponentProps {
4
+ type: string;
5
+ onClick?: React.MouseEventHandler<HTMLSpanElement>;
6
+ }
7
+ declare const IconFont: React.FC<IconFontProps>;
8
+ export default IconFont;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { PisellContextType } from './context';
3
+ interface PisellConfigProviderType {
4
+ platform?: PisellContextType['platform'];
5
+ children: React.ReactNode;
6
+ /** 货币符号 */
7
+ symbol?: string;
8
+ /** 当前语言环境 */
9
+ locale?: string;
10
+ }
11
+ declare const PisellConfigProvider: React.FC<PisellConfigProviderType>;
12
+ export default PisellConfigProvider;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  export interface PisellWalletPassCardProps {
4
3
  id: number;
@@ -75,7 +75,7 @@ var CartSkuCard = function CartSkuCard(props) {
75
75
  style: {
76
76
  fontSize: 12
77
77
  }
78
- }, "\u5220\u9664")),
78
+ }, locales.getText('pisell2.cart.sku-card.actions.delete'))),
79
79
  color: 'danger',
80
80
  onClick: function onClick(e) {
81
81
  e.preventDefault();
@@ -0,0 +1,96 @@
1
+ declare const _default: {
2
+ en: {
3
+ 'pisell2.product.card.discount.reason': string;
4
+ 'pisell2.cart.sku-card.more': string;
5
+ 'pisell2.cart.sku-card.packages.title': string;
6
+ 'pisell2.cart.sku-card.sales.title': string;
7
+ 'pisell2.cart.sku-card.actions.delete': string;
8
+ 'pisell2.product.card.day': (val: number) => string;
9
+ 'pisell2.product.card.day.event': (val: number) => string;
10
+ 'pisell2.product.card.minute': (val: number) => string;
11
+ 'pisell2.product.card.discount.note': string;
12
+ 'pisell2.product.card.edit': string;
13
+ 'pisell2.product.card.discount.add.note': string;
14
+ 'pisell2.product.card.discount.edit.note': string;
15
+ 'pisell2.product.card.confirm': string;
16
+ 'pisell2.product.card.cancel': string;
17
+ 'pisell2.product.card.note.pla': string;
18
+ 'pisell2.product.card.items.package': string;
19
+ 'pisell2.product.card.view-all': string;
20
+ 'pisell2.product.card.view-less': string;
21
+ 'pisell2.product.card.add.holder.button.text': (val: string) => string;
22
+ 'pisell2.product.card.add.holder.placeholder': (val: string) => string;
23
+ 'pisell2.product.card.add.holder.placeholder.multiple': (num: number, val: string) => string;
24
+ 'pisell2.product.card.add.holder.modal.title.1': string;
25
+ 'pisell2.product.card.hour.minute': (hour: number, minute: number) => string;
26
+ 'pisell2.product.card.sales': string;
27
+ 'pisell2.product.card.add.holder.modal.cancel': string;
28
+ 'pisell2.product.card.add.holder.modal.clear': string;
29
+ 'pisell2.product.card.add.holder.modal.apply': string;
30
+ 'pisell2.product.card.add.holder.modal.add': string;
31
+ 'pisell2.product.card.closing-soon.warning': string;
32
+ };
33
+ 'zh-CN': {
34
+ 'pisell2.product.card.discount.reason': string;
35
+ 'pisell2.cart.sku-card.more': string;
36
+ 'pisell2.cart.sku-card.packages.title': string;
37
+ 'pisell2.cart.sku-card.sales.title': string;
38
+ 'pisell2.cart.sku-card.actions.delete': string;
39
+ 'pisell2.product.card.edit': string;
40
+ 'pisell2.product.card.day': (val: number) => string;
41
+ 'pisell2.product.card.day.event': (val: number) => string;
42
+ 'pisell2.product.card.minute': (val: number) => string;
43
+ 'pisell2.product.card.discount.note': string;
44
+ 'pisell2.product.card.discount.add.note': string;
45
+ 'pisell2.product.card.discount.edit.note': string;
46
+ 'pisell2.product.card.confirm': string;
47
+ 'pisell2.product.card.cancel': string;
48
+ 'pisell2.product.card.note.pla': string;
49
+ 'pisell2.product.card.items.package': string;
50
+ 'pisell2.product.card.view-all': string;
51
+ 'pisell2.product.card.view-less': string;
52
+ 'pisell2.product.card.add.holder.button.text': (val: string) => string;
53
+ 'pisell2.product.card.add.holder.placeholder': (val: string) => string;
54
+ 'pisell2.product.card.add.holder.placeholder.multiple': (num: number, val: string) => string;
55
+ 'pisell2.product.card.add.holder.modal.title.1': string;
56
+ 'pisell2.product.card.hour.minute': (hour: number, minute: number) => string;
57
+ 'pisell2.product.card.sales': string;
58
+ 'pisell2.product.card.add.holder.modal.cancel': string;
59
+ 'pisell2.product.card.add.holder.modal.clear': string;
60
+ 'pisell2.product.card.add.holder.modal.apply': string;
61
+ 'pisell2.product.card.add.holder.modal.add': string;
62
+ 'pisell2.product.card.closing-soon.warning': string;
63
+ };
64
+ 'zh-HK': {
65
+ 'pisell2.product.card.discount.reason': string;
66
+ 'pisell2.cart.sku-card.more': string;
67
+ 'pisell2.cart.sku-card.packages.title': string;
68
+ 'pisell2.cart.sku-card.sales.title': string;
69
+ 'pisell2.cart.sku-card.actions.delete': string;
70
+ 'pisell2.product.card.edit': string;
71
+ 'pisell2.product.card.day': (val: number) => string;
72
+ 'pisell2.product.card.day.event': (val: number) => string;
73
+ 'pisell2.product.card.minute': (val: number) => string;
74
+ 'pisell2.product.card.discount.note': string;
75
+ 'pisell2.product.card.discount.add.note': string;
76
+ 'pisell2.product.card.discount.edit.note': string;
77
+ 'pisell2.product.card.confirm': string;
78
+ 'pisell2.product.card.cancel': string;
79
+ 'pisell2.product.card.note.pla': string;
80
+ 'pisell2.product.card.items.package': string;
81
+ 'pisell2.product.card.view-all': string;
82
+ 'pisell2.product.card.view-less': string;
83
+ 'pisell2.product.card.add.holder.button.text': (val: string) => string;
84
+ 'pisell2.product.card.add.holder.placeholder': (val: string) => string;
85
+ 'pisell2.product.card.add.holder.placeholder.multiple': (num: number, val: string) => string;
86
+ 'pisell2.product.card.add.holder.modal.title.1': string;
87
+ 'pisell2.product.card.hour.minute': (hour: number, minute: number) => string;
88
+ 'pisell2.product.card.sales': string;
89
+ 'pisell2.product.card.add.holder.modal.cancel': string;
90
+ 'pisell2.product.card.add.holder.modal.clear': string;
91
+ 'pisell2.product.card.add.holder.modal.apply': string;
92
+ 'pisell2.product.card.add.holder.modal.add': string;
93
+ 'pisell2.product.card.closing-soon.warning': string;
94
+ };
95
+ };
96
+ export default _default;
@@ -10,18 +10,21 @@ export default {
10
10
  'pisell2.product.card.discount.reason': 'Discount reason',
11
11
  'pisell2.cart.sku-card.more': 'more...',
12
12
  'pisell2.cart.sku-card.packages.title': 'Items in package',
13
- 'pisell2.cart.sku-card.sales.title': 'Sales'
13
+ 'pisell2.cart.sku-card.sales.title': 'Sales',
14
+ 'pisell2.cart.sku-card.actions.delete': 'Delete'
14
15
  }),
15
16
  'zh-CN': _objectSpread(_objectSpread({}, localeTexts['zh-CN']), {}, {
16
17
  'pisell2.product.card.discount.reason': '折扣原因',
17
18
  'pisell2.cart.sku-card.more': '更多……',
18
19
  'pisell2.cart.sku-card.packages.title': '包含的商品',
19
- 'pisell2.cart.sku-card.sales.title': '销售'
20
+ 'pisell2.cart.sku-card.sales.title': '销售',
21
+ 'pisell2.cart.sku-card.actions.delete': '删除'
20
22
  }),
21
23
  'zh-HK': _objectSpread(_objectSpread({}, localeTexts['zh-HK']), {}, {
22
24
  'pisell2.product.card.discount.reason': '折扣原因',
23
25
  'pisell2.cart.sku-card.more': '更多……',
24
26
  'pisell2.cart.sku-card.packages.title': '包含的商品',
25
- 'pisell2.cart.sku-card.sales.title': '銷售'
27
+ 'pisell2.cart.sku-card.sales.title': '銷售',
28
+ 'pisell2.cart.sku-card.actions.delete': '刪除'
26
29
  })
27
30
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { VirtualKeyboardTimeProps } from "../virtual-keyboard/Time";
3
2
  import { PopoverProps, TimePickerProps } from "antd";
4
3
  import "./index.less";
@@ -1,14 +1,29 @@
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
+ var _excluded = ["min", "max", "amountProps", "doneText", "resetText", "defaultValue", "placeholder", "onEnter", "presets", "defaultSelect", "inputFormat", "rightItemsStyle", "selectType"];
3
+ 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; }
4
+ 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; }
5
+ 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; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ 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); }
1
8
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
9
  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."); }
3
10
  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); }
4
11
  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; }
5
12
  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; } }
6
13
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import React, { useEffect } from 'react';
14
+ 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; }
15
+ 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; }
16
+ import React, { useEffect, useMemo } from 'react';
8
17
  import { useControllableValue } from 'ahooks';
18
+ import classNames from 'classnames';
19
+ import { setTheme } from '@pisell/utils';
9
20
  import BaseNumberKeyboard from "../BaseNumberKeyboard";
10
21
  import PisellText from "../../pisellText";
22
+ import usePisellConfig from "../../pisell-config-provider/hooks/usePisellConfig";
23
+ import { amountThemeConfig } from "./themeConfig";
24
+ import "./index.less";
11
25
  var Amount = function Amount(props) {
26
+ var _rightItemsStyle$isDo;
12
27
  var min = props.min,
13
28
  max = props.max,
14
29
  amountProps = props.amountProps,
@@ -20,7 +35,11 @@ var Amount = function Amount(props) {
20
35
  presets = props.presets,
21
36
  defaultSelect = props.defaultSelect,
22
37
  inputFormat = props.inputFormat,
23
- rightItemsStyle = props.rightItemsStyle;
38
+ rightItemsStyle = props.rightItemsStyle,
39
+ _props$selectType = props.selectType,
40
+ selectType = _props$selectType === void 0 ? 'light' : _props$selectType,
41
+ others = _objectWithoutProperties(props, _excluded);
42
+ var config = usePisellConfig();
24
43
  var _useControllableValue = useControllableValue(props, {
25
44
  defaultValue: defaultValue || ''
26
45
  }),
@@ -30,6 +49,41 @@ var Amount = function Amount(props) {
30
49
  useEffect(function () {
31
50
  document.body.id = 'body';
32
51
  }, []);
52
+
53
+ /**
54
+ * 配置颜色
55
+ * 根据 props 和 selectType 生成最终的配置颜色
56
+ */
57
+ var configColor = useMemo(function () {
58
+ var currentConfig = amountThemeConfig[selectType];
59
+
60
+ // 过滤出有效的 props 并合并到默认配置中
61
+ var validProps = Object.entries(props).reduce(function (acc, _ref) {
62
+ var _ref2 = _slicedToArray(_ref, 2),
63
+ key = _ref2[0],
64
+ value = _ref2[1];
65
+ if (value !== undefined && key in currentConfig) {
66
+ acc[key] = value;
67
+ }
68
+ return acc;
69
+ }, {});
70
+ return _objectSpread(_objectSpread({}, currentConfig), validProps);
71
+ }, [selectType, props]);
72
+ useEffect(function () {
73
+ setTheme({
74
+ '--pisell-amount-background-color': configColor.backgroundColor,
75
+ '--pisell-amount-container-background-color': configColor.containerBackgroundColor,
76
+ '--pisell-amount-text-color': configColor.textColor,
77
+ '--pisell-amount-keyboard-background-color': configColor.keyboardBackgroundColor,
78
+ '--pisell-amount-keyboard-button-background-color': configColor.keyboardButtonBackgroundColor,
79
+ '--pisell-amount-keyboard-button-text-color': configColor.keyboardButtonTextColor,
80
+ '--pisell-amount-keyboard-button-hover-color': configColor.keyboardButtonHoverColor,
81
+ '--pisell-amount-reset-button-background-color': configColor.resetButtonBackgroundColor,
82
+ '--pisell-amount-reset-button-text-color': configColor.resetButtonTextColor,
83
+ '--pisell-amount-done-button-background-color': configColor.doneButtonBackgroundColor,
84
+ '--pisell-amount-done-button-text-color': configColor.doneButtonTextColor
85
+ });
86
+ }, [configColor]);
33
87
  var format = function format(_v) {
34
88
  var v = "".concat(_v);
35
89
  if (inputFormat !== null && inputFormat !== void 0 && inputFormat(v)) {
@@ -47,11 +101,16 @@ var Amount = function Amount(props) {
47
101
  showCurrencySymbol: amountProps === null || amountProps === void 0 ? void 0 : amountProps.showCurrencySymbol,
48
102
  useThousandsSeparator: amountProps === null || amountProps === void 0 ? void 0 : amountProps.useThousandsSeparator,
49
103
  style: {
50
- color: (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.textColor) || '#000000'
104
+ color: (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.textColor) || configColor.textColor
51
105
  }
52
106
  }), endWith && '.');
53
107
  };
54
- return /*#__PURE__*/React.createElement(BaseNumberKeyboard, {
108
+ return /*#__PURE__*/React.createElement("div", {
109
+ className: classNames('pisell-amount-keyboard-wrap', {
110
+ 'pisell-amount-keyboard-dark': selectType === 'dark',
111
+ 'pisell-amount-keyboard-light': selectType === 'light'
112
+ })
113
+ }, /*#__PURE__*/React.createElement(BaseNumberKeyboard, {
55
114
  defaultSelect: defaultSelect,
56
115
  max: max,
57
116
  min: min,
@@ -64,7 +123,15 @@ var Amount = function Amount(props) {
64
123
  resetText: resetText,
65
124
  onEnter: onEnter,
66
125
  presets: presets,
67
- rightItemsStyle: rightItemsStyle
68
- });
126
+ rightItemsStyle: _objectSpread(_objectSpread({}, rightItemsStyle), {}, {
127
+ buttonBackgroundColor: (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.buttonBackgroundColor) || configColor.buttonBackgroundColor,
128
+ textColor: (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.textColor) || configColor.textColor,
129
+ resetButtonBackgroundColor: (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.resetButtonBackgroundColor) || configColor.resetButtonBackgroundColor,
130
+ resetButtonTextColor: (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.resetButtonTextColor) || configColor.resetButtonTextColor,
131
+ isDoneButtonFollowTheme: (_rightItemsStyle$isDo = rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.isDoneButtonFollowTheme) !== null && _rightItemsStyle$isDo !== void 0 ? _rightItemsStyle$isDo : configColor.isDoneButtonFollowTheme,
132
+ doneButtonBackgroundColor: (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.doneButtonBackgroundColor) || configColor.doneButtonBackgroundColor,
133
+ doneButtonTextColor: (rightItemsStyle === null || rightItemsStyle === void 0 ? void 0 : rightItemsStyle.doneButtonTextColor) || configColor.doneButtonTextColor
134
+ })
135
+ }));
69
136
  };
70
137
  export default Amount;
@@ -0,0 +1,39 @@
1
+ .pisell-amount-keyboard-wrap {
2
+ background-color: var(--pisell-amount-background-color, #ffffff);
3
+
4
+ &.pisell-amount-keyboard-dark {
5
+ background-color: var(--pisell-amount-background-color, rgba(0, 0, 0, 0.70));
6
+ }
7
+
8
+ &.pisell-amount-keyboard-light {
9
+ background-color: var(--pisell-amount-background-color, #ffffff);
10
+ }
11
+
12
+ .pisell-virtual-keyboard-input {
13
+ background-color: var(--pisell-amount-container-background-color, #d0d5dd);
14
+ color: var(--pisell-amount-text-color, #000000);
15
+ }
16
+
17
+ .pisell-keyboard {
18
+ background-color: var(--pisell-amount-keyboard-background-color, #f9f9f9);
19
+
20
+ .pisell-keyboard-item {
21
+ background-color: var(--pisell-amount-keyboard-button-background-color, #ffffff);
22
+ color: var(--pisell-amount-keyboard-button-text-color, #000000);
23
+
24
+ &:hover {
25
+ background-color: var(--pisell-amount-keyboard-button-hover-color, #f5f5f5);
26
+ }
27
+ }
28
+
29
+ .pisell-keyboard-reset-button {
30
+ background-color: var(--pisell-amount-reset-button-background-color, #ffffff);
31
+ color: var(--pisell-amount-reset-button-text-color, #d92d20);
32
+ }
33
+
34
+ .pisell-keyboard-done-button {
35
+ background-color: var(--pisell-amount-done-button-background-color, #4ca30d);
36
+ color: var(--pisell-amount-done-button-text-color, #ffffff);
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,32 @@
1
+ export var amountThemeConfig = {
2
+ dark: {
3
+ backgroundColor: 'rgba(0, 0, 0, 0.70)',
4
+ containerBackgroundColor: 'rgba(0, 0, 0, 0.40)',
5
+ buttonBackgroundColor: '#ffffff',
6
+ textColor: '#000000',
7
+ resetButtonBackgroundColor: '#ffffff',
8
+ resetButtonTextColor: '#d92d20',
9
+ isDoneButtonFollowTheme: true,
10
+ doneButtonBackgroundColor: '#4ca30d',
11
+ doneButtonTextColor: '#ffffff',
12
+ keyboardBackgroundColor: 'rgba(0, 0, 0, 0.40)',
13
+ keyboardButtonBackgroundColor: '#ffffff',
14
+ keyboardButtonTextColor: '#000000',
15
+ keyboardButtonHoverColor: '#f5f5f5'
16
+ },
17
+ light: {
18
+ backgroundColor: '#ffffff',
19
+ containerBackgroundColor: '#d0d5dd',
20
+ buttonBackgroundColor: '#ffffff',
21
+ textColor: '#000000',
22
+ resetButtonBackgroundColor: '#ffffff',
23
+ resetButtonTextColor: '#d92d20',
24
+ isDoneButtonFollowTheme: true,
25
+ doneButtonBackgroundColor: '#4ca30d',
26
+ doneButtonTextColor: '#ffffff',
27
+ keyboardBackgroundColor: '#f9f9f9',
28
+ keyboardButtonBackgroundColor: '#ffffff',
29
+ keyboardButtonTextColor: '#000000',
30
+ keyboardButtonHoverColor: '#f5f5f5'
31
+ }
32
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,27 +1,88 @@
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
+ var _excluded = ["min", "max", "doneText", "resetText", "defaultValue", "placeholder", "onEnter", "selectType"];
3
+ 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; }
4
+ 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; }
5
+ 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; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ 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); }
1
8
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
9
  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."); }
3
10
  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); }
4
11
  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; }
5
12
  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; } }
6
13
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import React from 'react';
14
+ 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; }
15
+ 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; }
16
+ import React, { useEffect, useMemo } from 'react';
8
17
  import { useControllableValue } from 'ahooks';
18
+ import classNames from 'classnames';
19
+ import { setTheme } from '@pisell/utils';
9
20
  import BaseNumberKeyboard from "../BaseNumberKeyboard";
10
- var Number = function Number(props) {
21
+ import usePisellConfig from "../../pisell-config-provider/hooks/usePisellConfig";
22
+ import { numberThemeConfig } from "./themeConfig";
23
+ import "./index.less";
24
+ var _Number = function _Number(props) {
11
25
  var min = props.min,
12
26
  max = props.max,
13
27
  doneText = props.doneText,
14
28
  resetText = props.resetText,
15
29
  defaultValue = props.defaultValue,
16
30
  placeholder = props.placeholder,
17
- onEnter = props.onEnter;
31
+ onEnter = props.onEnter,
32
+ _props$selectType = props.selectType,
33
+ selectType = _props$selectType === void 0 ? 'light' : _props$selectType,
34
+ others = _objectWithoutProperties(props, _excluded);
35
+ var config = usePisellConfig();
18
36
  var _useControllableValue = useControllableValue(props, {
19
37
  defaultValue: defaultValue || ""
20
38
  }),
21
39
  _useControllableValue2 = _slicedToArray(_useControllableValue, 2),
22
40
  value = _useControllableValue2[0],
23
41
  setValue = _useControllableValue2[1];
24
- return /*#__PURE__*/React.createElement(BaseNumberKeyboard, {
42
+ useEffect(function () {
43
+ document.body.id = 'body';
44
+ }, []);
45
+
46
+ /**
47
+ * 配置颜色
48
+ * 根据 props 和 selectType 生成最终的配置颜色
49
+ */
50
+ var configColor = useMemo(function () {
51
+ var currentConfig = numberThemeConfig[selectType];
52
+
53
+ // 过滤出有效的 props 并合并到默认配置中
54
+ var validProps = Object.entries(props).reduce(function (acc, _ref) {
55
+ var _ref2 = _slicedToArray(_ref, 2),
56
+ key = _ref2[0],
57
+ value = _ref2[1];
58
+ if (value !== undefined && key in currentConfig) {
59
+ acc[key] = value;
60
+ }
61
+ return acc;
62
+ }, {});
63
+ return _objectSpread(_objectSpread({}, currentConfig), validProps);
64
+ }, [selectType, props]);
65
+ useEffect(function () {
66
+ setTheme({
67
+ '--pisell-number-background-color': configColor.backgroundColor,
68
+ '--pisell-number-container-background-color': configColor.containerBackgroundColor,
69
+ '--pisell-number-text-color': configColor.textColor,
70
+ '--pisell-number-keyboard-background-color': configColor.keyboardBackgroundColor,
71
+ '--pisell-number-keyboard-button-background-color': configColor.keyboardButtonBackgroundColor,
72
+ '--pisell-number-keyboard-button-text-color': configColor.keyboardButtonTextColor,
73
+ '--pisell-number-keyboard-button-hover-color': configColor.keyboardButtonHoverColor,
74
+ '--pisell-number-reset-button-background-color': configColor.resetButtonBackgroundColor,
75
+ '--pisell-number-reset-button-text-color': configColor.resetButtonTextColor,
76
+ '--pisell-number-done-button-background-color': configColor.doneButtonBackgroundColor,
77
+ '--pisell-number-done-button-text-color': configColor.doneButtonTextColor
78
+ });
79
+ }, [configColor]);
80
+ return /*#__PURE__*/React.createElement("div", {
81
+ className: classNames('pisell-number-keyboard-wrap', {
82
+ 'pisell-number-keyboard-dark': selectType === 'dark',
83
+ 'pisell-number-keyboard-light': selectType === 'light'
84
+ })
85
+ }, /*#__PURE__*/React.createElement(BaseNumberKeyboard, {
25
86
  max: max,
26
87
  min: min,
27
88
  value: value,
@@ -29,7 +90,16 @@ var Number = function Number(props) {
29
90
  placeholder: placeholder,
30
91
  doneText: doneText,
31
92
  resetText: resetText,
32
- onEnter: onEnter
33
- });
93
+ onEnter: onEnter,
94
+ rightItemsStyle: {
95
+ buttonBackgroundColor: configColor.buttonBackgroundColor,
96
+ textColor: configColor.textColor,
97
+ resetButtonBackgroundColor: configColor.resetButtonBackgroundColor,
98
+ resetButtonTextColor: configColor.resetButtonTextColor,
99
+ isDoneButtonFollowTheme: configColor.isDoneButtonFollowTheme,
100
+ doneButtonBackgroundColor: configColor.doneButtonBackgroundColor,
101
+ doneButtonTextColor: configColor.doneButtonTextColor
102
+ }
103
+ }));
34
104
  };
35
- export default Number;
105
+ export default _Number;
@@ -0,0 +1,39 @@
1
+ .pisell-number-keyboard-wrap {
2
+ background-color: var(--pisell-number-background-color, #ffffff);
3
+
4
+ &.pisell-number-keyboard-dark {
5
+ background-color: var(--pisell-number-background-color, rgba(0, 0, 0, 0.70));
6
+ }
7
+
8
+ &.pisell-number-keyboard-light {
9
+ background-color: var(--pisell-number-background-color, #ffffff);
10
+ }
11
+
12
+ .pisell-virtual-keyboard-input {
13
+ background-color: var(--pisell-number-container-background-color, #d0d5dd);
14
+ color: var(--pisell-number-text-color, #000000);
15
+ }
16
+
17
+ .pisell-keyboard {
18
+ background-color: var(--pisell-number-keyboard-background-color, #f9f9f9);
19
+
20
+ .pisell-keyboard-item {
21
+ background-color: var(--pisell-number-keyboard-button-background-color, #ffffff);
22
+ color: var(--pisell-number-keyboard-button-text-color, #000000);
23
+
24
+ &:hover {
25
+ background-color: var(--pisell-number-keyboard-button-hover-color, #f5f5f5);
26
+ }
27
+ }
28
+
29
+ .pisell-keyboard-reset-button {
30
+ background-color: var(--pisell-number-reset-button-background-color, #ffffff);
31
+ color: var(--pisell-number-reset-button-text-color, #d92d20);
32
+ }
33
+
34
+ .pisell-keyboard-done-button {
35
+ background-color: var(--pisell-number-done-button-background-color, #4ca30d);
36
+ color: var(--pisell-number-done-button-text-color, #ffffff);
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,32 @@
1
+ export var numberThemeConfig = {
2
+ dark: {
3
+ backgroundColor: 'rgba(0, 0, 0, 0.70)',
4
+ containerBackgroundColor: 'rgba(0, 0, 0, 0.40)',
5
+ buttonBackgroundColor: '#ffffff',
6
+ textColor: '#000000',
7
+ resetButtonBackgroundColor: '#ffffff',
8
+ resetButtonTextColor: '#d92d20',
9
+ isDoneButtonFollowTheme: true,
10
+ doneButtonBackgroundColor: '#4ca30d',
11
+ doneButtonTextColor: '#ffffff',
12
+ keyboardBackgroundColor: 'rgba(0, 0, 0, 0.40)',
13
+ keyboardButtonBackgroundColor: '#ffffff',
14
+ keyboardButtonTextColor: '#000000',
15
+ keyboardButtonHoverColor: '#f5f5f5'
16
+ },
17
+ light: {
18
+ backgroundColor: '#ffffff',
19
+ containerBackgroundColor: '#d0d5dd',
20
+ buttonBackgroundColor: '#ffffff',
21
+ textColor: '#000000',
22
+ resetButtonBackgroundColor: '#ffffff',
23
+ resetButtonTextColor: '#d92d20',
24
+ isDoneButtonFollowTheme: true,
25
+ doneButtonBackgroundColor: '#4ca30d',
26
+ doneButtonTextColor: '#ffffff',
27
+ keyboardBackgroundColor: '#f9f9f9',
28
+ keyboardButtonBackgroundColor: '#ffffff',
29
+ keyboardButtonTextColor: '#000000',
30
+ keyboardButtonHoverColor: '#f5f5f5'
31
+ }
32
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -9,6 +9,17 @@ interface VirtualKeyboardProps extends React.HTMLAttributes<HTMLDivElement> {
9
9
  style?: React.CSSProperties;
10
10
  onChange?: (value?: any) => void;
11
11
  value?: string;
12
+ selectType?: 'light' | 'dark';
13
+ backgroundColor?: string;
14
+ containerBackgroundColor?: string;
15
+ buttonBackgroundColor?: string;
16
+ textColor?: string;
17
+ keyboardBackgroundColor?: string;
18
+ keyboardButtonBackgroundColor?: string;
19
+ keyboardButtonTextColor?: string;
20
+ keyboardButtonHoverColor?: string;
21
+ primaryButtonBackgroundColor?: string;
22
+ primaryButtonTextColor?: string;
12
23
  }
13
24
  declare const VirtualKeyboard: (props: VirtualKeyboardProps) => JSX.Element;
14
25
  export default VirtualKeyboard;