@arco-design/mobile-react 2.22.3 → 2.23.0

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 (91) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.en-US.md +2 -2
  3. package/README.md +2 -2
  4. package/cjs/image-picker/index.js +18 -12
  5. package/cjs/image-picker/type.d.ts +10 -0
  6. package/cjs/index.d.ts +1 -0
  7. package/cjs/index.js +5 -1
  8. package/cjs/input/style/css/index.css +1 -0
  9. package/cjs/input/style/index.less +1 -0
  10. package/cjs/stepper/demo/style/css/mobile.css +4 -0
  11. package/cjs/stepper/demo/style/mobile.less +10 -0
  12. package/cjs/stepper/hooks/useButtonClick.d.ts +11 -0
  13. package/cjs/stepper/hooks/useButtonClick.js +74 -0
  14. package/cjs/stepper/hooks/useInputEvent.d.ts +9 -0
  15. package/cjs/stepper/hooks/useInputEvent.js +59 -0
  16. package/cjs/stepper/hooks/useValue.d.ts +6 -0
  17. package/cjs/stepper/hooks/useValue.js +44 -0
  18. package/cjs/stepper/index.d.ts +13 -0
  19. package/cjs/stepper/index.js +184 -0
  20. package/cjs/stepper/style/css/index.css +76 -0
  21. package/cjs/stepper/style/css/index.d.ts +2 -0
  22. package/cjs/stepper/style/css/index.js +5 -0
  23. package/cjs/stepper/style/index.d.ts +2 -0
  24. package/cjs/stepper/style/index.js +5 -0
  25. package/cjs/stepper/style/index.less +80 -0
  26. package/cjs/stepper/type.d.ts +159 -0
  27. package/cjs/stepper/type.js +3 -0
  28. package/cjs/style.d.ts +1 -0
  29. package/cjs/style.js +2 -0
  30. package/dist/index.js +349 -10
  31. package/dist/index.min.js +3 -3
  32. package/dist/style.css +64 -0
  33. package/dist/style.min.css +1 -1
  34. package/esm/image-picker/index.js +18 -12
  35. package/esm/image-picker/type.d.ts +10 -0
  36. package/esm/index.d.ts +1 -0
  37. package/esm/index.js +1 -0
  38. package/esm/input/style/css/index.css +1 -0
  39. package/esm/input/style/index.less +1 -0
  40. package/esm/stepper/demo/style/css/mobile.css +4 -0
  41. package/esm/stepper/demo/style/mobile.less +10 -0
  42. package/esm/stepper/hooks/useButtonClick.d.ts +11 -0
  43. package/esm/stepper/hooks/useButtonClick.js +69 -0
  44. package/esm/stepper/hooks/useInputEvent.d.ts +9 -0
  45. package/esm/stepper/hooks/useInputEvent.js +53 -0
  46. package/esm/stepper/hooks/useValue.d.ts +6 -0
  47. package/esm/stepper/hooks/useValue.js +38 -0
  48. package/esm/stepper/index.d.ts +13 -0
  49. package/esm/stepper/index.js +157 -0
  50. package/esm/stepper/style/css/index.css +76 -0
  51. package/esm/stepper/style/css/index.d.ts +2 -0
  52. package/esm/stepper/style/css/index.js +2 -0
  53. package/esm/stepper/style/index.d.ts +2 -0
  54. package/esm/stepper/style/index.js +2 -0
  55. package/esm/stepper/style/index.less +80 -0
  56. package/esm/stepper/type.d.ts +159 -0
  57. package/esm/stepper/type.js +1 -0
  58. package/esm/style.d.ts +1 -0
  59. package/esm/style.js +1 -0
  60. package/package.json +3 -3
  61. package/tokens/app/arcodesign/default/css-variables.less +15 -0
  62. package/tokens/app/arcodesign/default/index.d.ts +15 -0
  63. package/tokens/app/arcodesign/default/index.js +16 -1
  64. package/tokens/app/arcodesign/default/index.json +180 -0
  65. package/tokens/app/arcodesign/default/index.less +15 -0
  66. package/umd/image-picker/index.js +18 -12
  67. package/umd/image-picker/type.d.ts +10 -0
  68. package/umd/index.d.ts +1 -0
  69. package/umd/index.js +7 -5
  70. package/umd/input/style/css/index.css +1 -0
  71. package/umd/input/style/index.less +1 -0
  72. package/umd/stepper/demo/style/css/mobile.css +4 -0
  73. package/umd/stepper/demo/style/mobile.less +10 -0
  74. package/umd/stepper/hooks/useButtonClick.d.ts +11 -0
  75. package/umd/stepper/hooks/useButtonClick.js +86 -0
  76. package/umd/stepper/hooks/useInputEvent.d.ts +9 -0
  77. package/umd/stepper/hooks/useInputEvent.js +71 -0
  78. package/umd/stepper/hooks/useValue.d.ts +6 -0
  79. package/umd/stepper/hooks/useValue.js +56 -0
  80. package/umd/stepper/index.d.ts +13 -0
  81. package/umd/stepper/index.js +185 -0
  82. package/umd/stepper/style/css/index.css +76 -0
  83. package/umd/stepper/style/css/index.d.ts +2 -0
  84. package/umd/stepper/style/css/index.js +15 -0
  85. package/umd/stepper/style/index.d.ts +2 -0
  86. package/umd/stepper/style/index.js +15 -0
  87. package/umd/stepper/style/index.less +80 -0
  88. package/umd/stepper/type.d.ts +159 -0
  89. package/umd/stepper/type.js +17 -0
  90. package/umd/style.d.ts +1 -0
  91. package/umd/style.js +4 -4
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ require("../../../../style/css/public.css");
4
+
5
+ require("./index.css");
@@ -0,0 +1,2 @@
1
+ import '../../../style/public.less';
2
+ import './index.less';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ require("../../../style/public.less");
4
+
5
+ require("./index.less");
@@ -0,0 +1,80 @@
1
+ @import '../../../style/mixin.less';
2
+
3
+ .@{prefix}-stepper {
4
+ display: flex;
5
+ .use-var(font-size, stepper-font-size);
6
+
7
+ &.@{prefix}-square {
8
+ .use-var(border, stepper-square-border);
9
+ .use-var(border-radius, stepper-square-border-radius);
10
+
11
+ .@{prefix}-stepper {
12
+ &-add-button,
13
+ &-minus-button,
14
+ &-input {
15
+ .use-var(background, stepper-square-background-color);
16
+ }
17
+ &-input {
18
+ .use-var(border-left, stepper-square-border);
19
+ .use-var(border-right, stepper-square-border);
20
+ }
21
+ }
22
+ }
23
+
24
+ &.@{prefix}-round {
25
+ .@{prefix}-stepper {
26
+ &-minus-button,
27
+ &-add-button {
28
+ .use-var(border-radius, stepper-round-button-border-radius);
29
+ }
30
+ &-input {
31
+ .use-var(background, stepper-round-input-background-color);
32
+ }
33
+ }
34
+ }
35
+
36
+ &-minus-button {
37
+ display: flex;
38
+ align-items: center;
39
+ justify-content: center;
40
+ .use-var(font-size, stepper-button-icon-size);
41
+ .use-var(width, stepper-button-size);
42
+ .use-var(height, stepper-button-size);
43
+ .use-var(background, stepper-default-background-color);
44
+
45
+ &-icon {
46
+ .use-var(color, stepper-content-color);
47
+
48
+ &.disabled {
49
+ .use-var(color, stepper-disable-color);
50
+ }
51
+ }
52
+ }
53
+
54
+ &-input {
55
+ text-align: center;
56
+ .use-var(width, stepper-input-width);
57
+ .use-var(height, stepper-input-height);
58
+ .use-var(background, stepper-default-background-color);
59
+ .use-var(color, stepper-content-color);
60
+ .use-var(margin, stepper-input-margin);
61
+ }
62
+
63
+ &-add-button {
64
+ display: flex;
65
+ align-items: center;
66
+ justify-content: center;
67
+ .use-var(font-size, stepper-button-icon-size);
68
+ .use-var(width, stepper-button-size);
69
+ .use-var(height, stepper-button-size);
70
+ .use-var(background, stepper-default-background-color);
71
+
72
+ &-icon {
73
+ .use-var(color, stepper-content-color);
74
+
75
+ &.disabled {
76
+ .use-var(color, stepper-disable-color);
77
+ }
78
+ }
79
+ }
80
+ }
@@ -0,0 +1,159 @@
1
+ import { ReactNode } from 'react';
2
+ export interface StepperProps {
3
+ /**
4
+ * 自定义类名
5
+ * @en Custom classname
6
+ */
7
+ className?: string;
8
+ /**
9
+ * 自定义样式
10
+ * @en Custom stylesheet
11
+ * */
12
+ style?: React.CSSProperties;
13
+ /**
14
+ * input样式
15
+ * @en Input stylesheet
16
+ */
17
+ inputStyle?: React.CSSProperties;
18
+ /**
19
+ * input类名
20
+ * @en Input class
21
+ */
22
+ inputClass?: string;
23
+ /**
24
+ * 绑定值,传入即受控
25
+ * @en Bundled value (Controlled)
26
+ */
27
+ value?: number;
28
+ /**
29
+ * 默认值
30
+ * @en Default value
31
+ * @default 1
32
+ */
33
+ defaultValue?: number;
34
+ /**
35
+ * 是否允许内容为空
36
+ * @en Whether the content is allowed to be empty
37
+ * @default false
38
+ */
39
+ allowEmpty?: boolean;
40
+ /**
41
+ * 格式化到小数点后固定位数,设置为 0 表示格式化到整数
42
+ * @en Formatted to a decimal point after a fixed number of digits, set to 0 indicates formatting to an integer
43
+ * @default 0
44
+ */
45
+ digits?: number;
46
+ /**
47
+ * 是否禁用步进器
48
+ * @en Whether to disable the stepper
49
+ * @default false
50
+ */
51
+ disabled?: boolean;
52
+ /**
53
+ * 输入框只读状态
54
+ * @en Input read only status
55
+ * @default false
56
+ */
57
+ inputReadonly?: boolean;
58
+ /**
59
+ * 最大值
60
+ * @en Max value
61
+ * @default Infinity
62
+ */
63
+ max?: number;
64
+ /**
65
+ * 最小值
66
+ * @en Min value
67
+ * @default 1
68
+ */
69
+ min?: number;
70
+ /**
71
+ * 是否允许操作大于/小于极限值时,操作结果等于极限值
72
+ * @en If an operation is allowed to be greater more/less than the limit value, the result of the operation is equal to the limit value
73
+ */
74
+ equalLimitDisabled?: boolean;
75
+ /**
76
+ * 递增/减值
77
+ * @en Incremental/Impairment value
78
+ * @default 1
79
+ */
80
+ step?: number;
81
+ /**
82
+ * 边框风格
83
+ * @en Border style
84
+ * @default "default"
85
+ */
86
+ theme?: 'square' | 'round' | 'default';
87
+ /**
88
+ * 格式化内部值(优先级最高)
89
+ * @en Format the inner value
90
+ */
91
+ formatter?: (innerValue: number) => number | Promise<number>;
92
+ /**
93
+ * 增加按钮
94
+ * @en Add button
95
+ */
96
+ addButton?: ReactNode;
97
+ /**
98
+ * 删除按钮
99
+ * @en Delete button
100
+ */
101
+ minusButton?: ReactNode;
102
+ /**
103
+ * 自定义输入框函数
104
+ * @en The function of customizing the input
105
+ */
106
+ renderContent?: (innerValue: number) => ReactNode;
107
+ /**
108
+ * 输入框失去焦点时触发
109
+ * @en Triggers when the input loses focus
110
+ */
111
+ onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
112
+ /**
113
+ * 数据变化时的触发
114
+ * @en Triggers when the data change
115
+ */
116
+ onChange?: (value: number | null) => void;
117
+ /**
118
+ * 输入框获得焦点时触发
119
+ * @en Triggers when the input gets focus
120
+ */
121
+ onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;
122
+ /**
123
+ * 点击增加按钮时触发
124
+ * @en Triggers when the add button is clicked
125
+ */
126
+ onAddButtonClick?: (e: React.MouseEvent) => void;
127
+ /**
128
+ * 点击减少按钮时触发
129
+ * @en Triggers when the minus button is clicked
130
+ */
131
+ onMinusButtonClick?: (e: React.MouseEvent) => void;
132
+ /**
133
+ * 点击最外侧dom时触发
134
+ * @en Triggers when the most out dom is clicked
135
+ */
136
+ onClick?: (e: React.MouseEvent) => void;
137
+ /**
138
+ * 输入框输入时触发
139
+ * @en Triggers when the input is inputting
140
+ */
141
+ onInput?: (e: React.ChangeEvent) => void;
142
+ }
143
+ export interface StepperRef {
144
+ /**
145
+ * 最外层元素 DOM
146
+ * @en The most out element dom
147
+ */
148
+ dom: HTMLDivElement | null;
149
+ /**
150
+ * 输入框 DOM
151
+ * @en Input dom
152
+ */
153
+ input: HTMLInputElement | null;
154
+ /**
155
+ * 改变内部值的方法
156
+ * @en The function of changing inner value
157
+ */
158
+ changeValue: (newValue: number | null) => void;
159
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
package/cjs/style.d.ts CHANGED
@@ -43,6 +43,7 @@ import './radio/style';
43
43
  import './rate/style';
44
44
  import './slider/style';
45
45
  import './search-bar/style';
46
+ import './stepper/style';
46
47
  import './steps/style';
47
48
  import './sticky/style';
48
49
  import './swipe-action/style';
package/cjs/style.js CHANGED
@@ -90,6 +90,8 @@ require("./slider/style");
90
90
 
91
91
  require("./search-bar/style");
92
92
 
93
+ require("./stepper/style");
94
+
93
95
  require("./steps/style");
94
96
 
95
97
  require("./sticky/style");
package/dist/index.js CHANGED
@@ -14178,6 +14178,30 @@
14178
14178
 
14179
14179
  });
14180
14180
 
14181
+ function IconMinus(props) {
14182
+ var _a = props.className,
14183
+ className = _a === void 0 ? '' : _a,
14184
+ _b = props.useCurrentColor,
14185
+ useCurrentColor = _b === void 0 ? true : _b,
14186
+ style = props.style,
14187
+ other = __rest(props, ["className", "useCurrentColor", "style"]);
14188
+
14189
+ return /*#__PURE__*/React__default["default"].createElement(ContextLayout, null, function (_a) {
14190
+ var prefixCls = _a.prefixCls;
14191
+ return /*#__PURE__*/React__default["default"].createElement("svg", __assign({
14192
+ className: prefixCls + "-icon " + prefixCls + "-icon-minus " + className,
14193
+ width: "1em",
14194
+ height: "1em",
14195
+ style: style,
14196
+ fill: useCurrentColor ? 'currentColor' : '#000',
14197
+ viewBox: "0 0 1024 1024",
14198
+ xmlns: "http://www.w3.org/2000/svg"
14199
+ }, other), /*#__PURE__*/React__default["default"].createElement("defs", null, /*#__PURE__*/React__default["default"].createElement("style", null)), /*#__PURE__*/React__default["default"].createElement("path", {
14200
+ d: "M115.2 467.2h819.2c6.4 0 6.4 6.4 6.4 6.4V544c0 6.4-6.4 6.4-6.4 6.4H96c-6.4 0-6.4-6.4-6.4-6.4v-64c0-6.4 6.4-6.4 6.4-6.4 6.4-6.4 6.4-6.4 19.2-6.4z"
14201
+ }));
14202
+ });
14203
+ }
14204
+
14181
14205
  function IconStarFill(props) {
14182
14206
  var _a = props.className,
14183
14207
  className = _a === void 0 ? '' : _a,
@@ -14440,7 +14464,9 @@
14440
14464
  onMaxSizeExceed = props.onMaxSizeExceed,
14441
14465
  onLimitExceed = props.onLimitExceed,
14442
14466
  upload = props.upload,
14443
- selectAdapter = props.selectAdapter;
14467
+ selectAdapter = props.selectAdapter,
14468
+ onSelectClick = props.onSelectClick,
14469
+ onDeleteClick = props.onDeleteClick;
14444
14470
  var domRef = React.useRef(null);
14445
14471
  var fileRef = React.useRef(null);
14446
14472
  var cacheRef = React.useRef([]);
@@ -14541,6 +14567,7 @@
14541
14567
  };
14542
14568
 
14543
14569
  var handleDelete = function handleDelete(index) {
14570
+ onDeleteClick && onDeleteClick(index);
14544
14571
  onChange(images.filter(function (_i, j) {
14545
14572
  return j !== index;
14546
14573
  }));
@@ -14564,17 +14591,20 @@
14564
14591
  }
14565
14592
  };
14566
14593
 
14567
- var handleSelect = function handleSelect() {
14594
+ var handleSelect = function handleSelect(e) {
14568
14595
  var _a;
14569
14596
 
14570
- selectAdapter ? selectAdapter().then(function (_a) {
14571
- var files = _a.files;
14572
- return handleChange({
14573
- target: {
14574
- files: files
14575
- }
14576
- }, true);
14577
- }) : (_a = fileRef.current) === null || _a === void 0 ? void 0 : _a.click();
14597
+ if (e.target !== fileRef.current) {
14598
+ onSelectClick && onSelectClick();
14599
+ selectAdapter ? selectAdapter().then(function (_a) {
14600
+ var files = _a.files;
14601
+ return handleChange({
14602
+ target: {
14603
+ files: files
14604
+ }
14605
+ }, true);
14606
+ }) : (_a = fileRef.current) === null || _a === void 0 ? void 0 : _a.click();
14607
+ }
14578
14608
  };
14579
14609
 
14580
14610
  var getGridData = function getGridData(prefixCls, locale) {
@@ -22735,6 +22765,314 @@
22735
22765
  return /*#__PURE__*/React__default["default"].createElement(ContextLayout, null, renderSearchBar);
22736
22766
  });
22737
22767
 
22768
+ function correctCalculation(leftNumber, rightNumber, operator) {
22769
+ var magnification = 1e17;
22770
+ var left = leftNumber * magnification;
22771
+ var right = rightNumber * magnification;
22772
+ return operator === '-' ? (left - right) / magnification : (left + right) / magnification;
22773
+ }
22774
+
22775
+ function useButtonClick(params) {
22776
+ var actualInputValue = params.actualInputValue,
22777
+ min = params.min,
22778
+ max = params.max,
22779
+ step = params.step,
22780
+ disabled = params.disabled,
22781
+ equalLimitDisabled = params.equalLimitDisabled,
22782
+ updateValue = params.updateValue,
22783
+ onAddButtonClick = params.onAddButtonClick,
22784
+ onMinusButtonClick = params.onMinusButtonClick;
22785
+
22786
+ var _a = React.useState(function () {
22787
+ return actualInputValue === min || disabled;
22788
+ }),
22789
+ minusButtonDisable = _a[0],
22790
+ setMinusButtonDisable = _a[1];
22791
+
22792
+ var _b = React.useState(function () {
22793
+ return actualInputValue === max || disabled;
22794
+ }),
22795
+ addButtonDisable = _b[0],
22796
+ setAddButtonDisable = _b[1];
22797
+
22798
+ var handleMinusButtonClick = function handleMinusButtonClick(e) {
22799
+ if (minusButtonDisable) {
22800
+ return;
22801
+ }
22802
+
22803
+ updateValue(function (oldValue) {
22804
+ var result = correctCalculation(oldValue, step, '-');
22805
+ return result < min ? equalLimitDisabled ? oldValue : min : result;
22806
+ });
22807
+ onMinusButtonClick && onMinusButtonClick(e);
22808
+ };
22809
+
22810
+ var handleAddButtonClick = function handleAddButtonClick(e) {
22811
+ if (addButtonDisable) {
22812
+ return;
22813
+ }
22814
+
22815
+ updateValue(function (oldValue) {
22816
+ var result = correctCalculation(Number(oldValue), step, '+');
22817
+ return result > max ? equalLimitDisabled ? oldValue : max : result;
22818
+ });
22819
+ onAddButtonClick && onAddButtonClick(e);
22820
+ }; // 当前值改变时,更新按钮状态
22821
+ // Changes button status when value changed
22822
+
22823
+
22824
+ React.useEffect(function () {
22825
+ setMinusButtonDisable(actualInputValue <= min);
22826
+ setAddButtonDisable(actualInputValue >= max);
22827
+ }, [actualInputValue]);
22828
+ return {
22829
+ minusButtonDisable: minusButtonDisable,
22830
+ addButtonDisable: addButtonDisable,
22831
+ handleMinusButtonClick: handleMinusButtonClick,
22832
+ handleAddButtonClick: handleAddButtonClick
22833
+ };
22834
+ }
22835
+
22836
+ function useInputEvent(params) {
22837
+ var defaultValue = params.defaultValue,
22838
+ min = params.min,
22839
+ max = params.max,
22840
+ digits = params.digits,
22841
+ actualInputValue = params.actualInputValue,
22842
+ allowEmpty = params.allowEmpty,
22843
+ updateValue = params.updateValue,
22844
+ onBlur = params.onBlur,
22845
+ onChange = params.onChange,
22846
+ onInput = params.onInput;
22847
+
22848
+ var handleInput = function handleInput(e) {
22849
+ var targetValue = e.target.value;
22850
+ var numberValue = Number(targetValue);
22851
+ var pointIndex = targetValue.indexOf('.');
22852
+
22853
+ if (digits > 0 && pointIndex !== -1) {
22854
+ var decimalLength = targetValue.slice(pointIndex + 1).length;
22855
+ updateValue(decimalLength > digits ? actualInputValue : numberValue);
22856
+ } else if (allowEmpty && targetValue === '') {
22857
+ updateValue(Number.MIN_VALUE);
22858
+ } else {
22859
+ updateValue(numberValue);
22860
+ }
22861
+
22862
+ onInput && onInput(e);
22863
+ };
22864
+
22865
+ var handleBlur = function handleBlur(e) {
22866
+ var targetValue = e.target.value;
22867
+ var numberValue = Number(targetValue);
22868
+
22869
+ if (allowEmpty && targetValue === '') {
22870
+ updateValue(Number.MIN_VALUE);
22871
+ } else if (!allowEmpty && targetValue === '') {
22872
+ updateValue(defaultValue);
22873
+ } else {
22874
+ updateValue(Math.max(min, Math.min(max, numberValue)));
22875
+ }
22876
+
22877
+ onBlur && onBlur(e);
22878
+ };
22879
+
22880
+ useUpdateEffect(function () {
22881
+ onChange && onChange(actualInputValue);
22882
+ }, [actualInputValue]);
22883
+ return {
22884
+ handleInput: handleInput,
22885
+ handleBlur: handleBlur
22886
+ };
22887
+ }
22888
+
22889
+ function useValue(params) {
22890
+ var defaultValue = params.defaultValue,
22891
+ formatter = params.formatter,
22892
+ max = params.max,
22893
+ min = params.min,
22894
+ value = params.value,
22895
+ digits = params.digits;
22896
+
22897
+ var _a = React.useState(defaultValue),
22898
+ innerValue = _a[0],
22899
+ setInnerValue = _a[1];
22900
+
22901
+ var updateValue = function updateValue(updater) {
22902
+ var tempValue = typeof updater === 'function' ? updater(innerValue) : updater;
22903
+
22904
+ if (formatter) {
22905
+ new Promise(function (resolve) {
22906
+ resolve(formatter(Number(tempValue)));
22907
+ }).then(function (result) {
22908
+ var res = Math.max(min, Math.min(max, result));
22909
+ setInnerValue(res);
22910
+ });
22911
+ } else {
22912
+ setInnerValue(tempValue);
22913
+ }
22914
+ };
22915
+
22916
+ var actualInputValue = value !== undefined ? value : innerValue; // 将actualInputValue等于Number.MIN_VALUE的情况视为空值
22917
+ // @en If actualInputValue equal Number.MIN_VALUE, actualInputValue equal ''
22918
+
22919
+ var showValue = actualInputValue === Number.MIN_VALUE ? '' : digits > 0 ? parseFloat(String(actualInputValue)).toFixed(digits) : actualInputValue;
22920
+ return {
22921
+ updateValue: updateValue,
22922
+ actualInputValue: actualInputValue,
22923
+ showValue: showValue
22924
+ };
22925
+ }
22926
+
22927
+ /**
22928
+ * 步进器组件,支持受控模式
22929
+ * @en Stepper component, provide controlled mode
22930
+ * @type 数据录入
22931
+ * @type_en Data Entry
22932
+ * @name 步进器
22933
+ * @name_en Stepper
22934
+ */
22935
+
22936
+ var Stepper = /*#__PURE__*/React.forwardRef(function (props, ref) {
22937
+ var _a = props.className,
22938
+ className = _a === void 0 ? '' : _a,
22939
+ style = props.style,
22940
+ inputStyle = props.inputStyle,
22941
+ _b = props.inputClass,
22942
+ inputClass = _b === void 0 ? '' : _b,
22943
+ value = props.value,
22944
+ _c = props.defaultValue,
22945
+ defaultValue = _c === void 0 ? 1 : _c,
22946
+ _d = props.allowEmpty,
22947
+ allowEmpty = _d === void 0 ? false : _d,
22948
+ _e = props.digits,
22949
+ digits = _e === void 0 ? 0 : _e,
22950
+ _f = props.disabled,
22951
+ disabled = _f === void 0 ? false : _f,
22952
+ _g = props.inputReadonly,
22953
+ inputReadonly = _g === void 0 ? false : _g,
22954
+ _h = props.max,
22955
+ max = _h === void 0 ? Infinity : _h,
22956
+ _j = props.min,
22957
+ min = _j === void 0 ? 1 : _j,
22958
+ _k = props.equalLimitDisabled,
22959
+ equalLimitDisabled = _k === void 0 ? false : _k,
22960
+ _l = props.step,
22961
+ step = _l === void 0 ? 1 : _l,
22962
+ _m = props.theme,
22963
+ theme = _m === void 0 ? 'default' : _m,
22964
+ formatter = props.formatter,
22965
+ addButton = props.addButton,
22966
+ minusButton = props.minusButton,
22967
+ renderContent = props.renderContent,
22968
+ onBlur = props.onBlur,
22969
+ onChange = props.onChange,
22970
+ onFocus = props.onFocus,
22971
+ onAddButtonClick = props.onAddButtonClick,
22972
+ onMinusButtonClick = props.onMinusButtonClick,
22973
+ onClick = props.onClick,
22974
+ onInput = props.onInput; // 值的相关逻辑
22975
+ // @en The logic is that handle value
22976
+
22977
+ var _o = useValue({
22978
+ defaultValue: defaultValue,
22979
+ formatter: formatter,
22980
+ min: min,
22981
+ max: max,
22982
+ value: value,
22983
+ digits: digits
22984
+ }),
22985
+ updateValue = _o.updateValue,
22986
+ actualInputValue = _o.actualInputValue,
22987
+ showValue = _o.showValue; // 按钮点击的相关逻辑
22988
+ // @en The logic is that handle button click
22989
+
22990
+
22991
+ var _p = useButtonClick({
22992
+ actualInputValue: actualInputValue,
22993
+ min: min,
22994
+ max: max,
22995
+ step: step,
22996
+ disabled: disabled,
22997
+ digits: digits,
22998
+ equalLimitDisabled: equalLimitDisabled,
22999
+ updateValue: updateValue,
23000
+ onAddButtonClick: onAddButtonClick,
23001
+ onMinusButtonClick: onMinusButtonClick
23002
+ }),
23003
+ minusButtonDisable = _p.minusButtonDisable,
23004
+ addButtonDisable = _p.addButtonDisable,
23005
+ handleAddButtonClick = _p.handleAddButtonClick,
23006
+ handleMinusButtonClick = _p.handleMinusButtonClick; // 输入框操作的相关逻辑
23007
+ // @en The logic is that handle input operation
23008
+
23009
+
23010
+ var _q = useInputEvent({
23011
+ defaultValue: defaultValue,
23012
+ min: min,
23013
+ max: max,
23014
+ digits: digits,
23015
+ actualInputValue: actualInputValue,
23016
+ allowEmpty: allowEmpty,
23017
+ updateValue: updateValue,
23018
+ onBlur: onBlur,
23019
+ onChange: onChange,
23020
+ onInput: onInput
23021
+ }),
23022
+ handleInput = _q.handleInput,
23023
+ handleBlur = _q.handleBlur;
23024
+
23025
+ var domRef = React.useRef(null);
23026
+ var inputRef = React.useRef(null);
23027
+ React.useImperativeHandle(ref, function () {
23028
+ return {
23029
+ dom: domRef.current,
23030
+ input: inputRef.current,
23031
+ changeValue: function changeValue(newValue) {
23032
+ var tempValue = newValue != null ? newValue : defaultValue;
23033
+ tempValue = Math.min(max, Math.max(tempValue, min));
23034
+ updateValue(tempValue);
23035
+ }
23036
+ };
23037
+ });
23038
+ return /*#__PURE__*/React__default["default"].createElement(ContextLayout, null, function (_a) {
23039
+ var prefixCls = _a.prefixCls;
23040
+ return /*#__PURE__*/React__default["default"].createElement("div", {
23041
+ className: cls(prefixCls + "-stepper", prefixCls + "-" + theme, className),
23042
+ style: style,
23043
+ ref: domRef,
23044
+ onClick: onClick
23045
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
23046
+ onClick: handleMinusButtonClick
23047
+ }, minusButton || /*#__PURE__*/React__default["default"].createElement("div", {
23048
+ className: cls(prefixCls + "-stepper-minus-button")
23049
+ }, /*#__PURE__*/React__default["default"].createElement(IconMinus, {
23050
+ className: cls(prefixCls + "-stepper-minus-button-icon", {
23051
+ disabled: minusButtonDisable
23052
+ })
23053
+ }))), renderContent ? renderContent(actualInputValue) : /*#__PURE__*/React__default["default"].createElement("input", {
23054
+ style: inputStyle,
23055
+ className: cls(prefixCls + "-stepper-input", inputClass),
23056
+ onFocus: onFocus,
23057
+ onInput: handleInput,
23058
+ onBlur: handleBlur,
23059
+ disabled: disabled,
23060
+ value: showValue,
23061
+ readOnly: inputReadonly,
23062
+ ref: inputRef,
23063
+ type: "number"
23064
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
23065
+ onClick: handleAddButtonClick
23066
+ }, addButton || /*#__PURE__*/React__default["default"].createElement("div", {
23067
+ className: cls(prefixCls + "-stepper-add-button")
23068
+ }, /*#__PURE__*/React__default["default"].createElement(IconAdd, {
23069
+ className: cls(prefixCls + "-stepper-add-button-icon", {
23070
+ disabled: addButtonDisable
23071
+ })
23072
+ }))));
23073
+ });
23074
+ });
23075
+
22738
23076
  var Step = /*#__PURE__*/React.forwardRef(function (props, ref) {
22739
23077
  var title = props.title,
22740
23078
  description = props.description,
@@ -24214,6 +24552,7 @@
24214
24552
  exports.SearchBar = SearchBar;
24215
24553
  exports.ShowMonitor = ShowMonitor;
24216
24554
  exports.Slider = SliderWrapper;
24555
+ exports.Stepper = Stepper;
24217
24556
  exports.Steps = index$2;
24218
24557
  exports.Sticky = Sticky;
24219
24558
  exports.SwipeAction = SwipeAction;