@arco-design/mobile-react 2.22.3 → 2.24.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.
- package/CHANGELOG.md +32 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/_helpers/render.d.ts +3 -1
- package/cjs/_helpers/render.js +10 -3
- package/cjs/action-sheet/index.d.ts +5 -5
- package/cjs/action-sheet/index.js +4 -3
- package/cjs/action-sheet/methods.d.ts +1 -1
- package/cjs/badge/style/css/index.css +1 -2
- package/cjs/checkbox/checkbox.js +4 -0
- package/cjs/circle-progress/index.js +4 -0
- package/cjs/context-provider/index.d.ts +4 -0
- package/cjs/context-provider/index.js +14 -2
- package/cjs/dialog/index.d.ts +8 -8
- package/cjs/dialog/index.js +3 -2
- package/cjs/dialog/methods.d.ts +3 -3
- package/cjs/dialog/style/css/index.css +1 -2
- package/cjs/image-picker/index.js +18 -12
- package/cjs/image-picker/type.d.ts +10 -0
- package/cjs/image-preview/index.d.ts +3 -3
- package/cjs/image-preview/index.js +3 -2
- package/cjs/image-preview/methods.d.ts +2 -1
- package/cjs/image-preview/methods.js +2 -2
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +5 -1
- package/cjs/input/hooks.js +1 -0
- package/cjs/input/index.d.ts +5 -0
- package/cjs/input/index.js +6 -2
- package/cjs/input/style/css/index.css +1 -0
- package/cjs/input/style/index.less +1 -0
- package/cjs/masking/index.d.ts +4 -14
- package/cjs/masking/index.js +3 -2
- package/cjs/masking/methods.d.ts +3 -2
- package/cjs/masking/methods.js +2 -2
- package/cjs/nav-bar/index.d.ts +12 -0
- package/cjs/nav-bar/index.js +8 -2
- package/cjs/notify/index.d.ts +12 -12
- package/cjs/notify/index.js +3 -2
- package/cjs/notify/methods.d.ts +2 -1
- package/cjs/notify/methods.js +2 -2
- package/cjs/picker-view/components/picker-cell.js +3 -1
- package/cjs/popup/index.d.ts +4 -4
- package/cjs/popup/index.js +3 -2
- package/cjs/popup/methods.d.ts +1 -1
- package/cjs/popup-swiper/index.d.ts +12 -6
- package/cjs/popup-swiper/index.js +3 -2
- package/cjs/popup-swiper/methods.d.ts +1 -1
- package/cjs/progress/index.js +4 -0
- package/cjs/rate/index.js +5 -0
- package/cjs/slider/index.js +6 -1
- package/cjs/stepper/demo/style/css/mobile.css +4 -0
- package/cjs/stepper/demo/style/mobile.less +10 -0
- package/cjs/stepper/hooks/useButtonClick.d.ts +11 -0
- package/cjs/stepper/hooks/useButtonClick.js +74 -0
- package/cjs/stepper/hooks/useInputEvent.d.ts +9 -0
- package/cjs/stepper/hooks/useInputEvent.js +59 -0
- package/cjs/stepper/hooks/useValue.d.ts +6 -0
- package/cjs/stepper/hooks/useValue.js +44 -0
- package/cjs/stepper/index.d.ts +13 -0
- package/cjs/stepper/index.js +190 -0
- package/cjs/stepper/style/css/index.css +76 -0
- package/cjs/stepper/style/css/index.d.ts +2 -0
- package/cjs/stepper/style/css/index.js +5 -0
- package/cjs/stepper/style/index.d.ts +2 -0
- package/cjs/stepper/style/index.js +5 -0
- package/cjs/stepper/style/index.less +80 -0
- package/cjs/stepper/type.d.ts +159 -0
- package/cjs/stepper/type.js +3 -0
- package/cjs/style.d.ts +1 -0
- package/cjs/style.js +2 -0
- package/cjs/swipe-action/index.d.ts +1 -0
- package/cjs/swipe-action/index.js +10 -0
- package/cjs/switch/index.js +4 -0
- package/cjs/toast/index.d.ts +18 -18
- package/cjs/toast/index.js +3 -2
- package/cjs/toast/methods.d.ts +2 -1
- package/cjs/toast/methods.js +2 -2
- package/dist/index.js +463 -52
- package/dist/index.min.js +3 -3
- package/dist/style.css +77 -113
- package/dist/style.min.css +1 -1
- package/esm/_helpers/render.d.ts +3 -1
- package/esm/_helpers/render.js +10 -3
- package/esm/action-sheet/index.d.ts +5 -5
- package/esm/action-sheet/index.js +4 -3
- package/esm/action-sheet/methods.d.ts +1 -1
- package/esm/badge/style/css/index.css +1 -2
- package/esm/checkbox/checkbox.js +4 -0
- package/esm/circle-progress/index.js +4 -0
- package/esm/context-provider/index.d.ts +4 -0
- package/esm/context-provider/index.js +13 -2
- package/esm/dialog/index.d.ts +8 -8
- package/esm/dialog/index.js +3 -2
- package/esm/dialog/methods.d.ts +3 -3
- package/esm/dialog/style/css/index.css +1 -2
- package/esm/image-picker/index.js +18 -12
- package/esm/image-picker/type.d.ts +10 -0
- package/esm/image-preview/index.d.ts +3 -3
- package/esm/image-preview/index.js +3 -2
- package/esm/image-preview/methods.d.ts +2 -1
- package/esm/image-preview/methods.js +2 -2
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/input/hooks.js +1 -0
- package/esm/input/index.d.ts +5 -0
- package/esm/input/index.js +6 -2
- package/esm/input/style/css/index.css +1 -0
- package/esm/input/style/index.less +1 -0
- package/esm/masking/index.d.ts +4 -14
- package/esm/masking/index.js +3 -2
- package/esm/masking/methods.d.ts +3 -2
- package/esm/masking/methods.js +2 -2
- package/esm/nav-bar/index.d.ts +12 -0
- package/esm/nav-bar/index.js +8 -2
- package/esm/notify/index.d.ts +12 -12
- package/esm/notify/index.js +3 -2
- package/esm/notify/methods.d.ts +2 -1
- package/esm/notify/methods.js +2 -2
- package/esm/picker-view/components/picker-cell.js +3 -1
- package/esm/popup/index.d.ts +4 -4
- package/esm/popup/index.js +3 -2
- package/esm/popup/methods.d.ts +1 -1
- package/esm/popup-swiper/index.d.ts +12 -6
- package/esm/popup-swiper/index.js +3 -2
- package/esm/popup-swiper/methods.d.ts +1 -1
- package/esm/progress/index.js +4 -0
- package/esm/rate/index.js +5 -0
- package/esm/slider/index.js +6 -1
- package/esm/stepper/demo/style/css/mobile.css +4 -0
- package/esm/stepper/demo/style/mobile.less +10 -0
- package/esm/stepper/hooks/useButtonClick.d.ts +11 -0
- package/esm/stepper/hooks/useButtonClick.js +69 -0
- package/esm/stepper/hooks/useInputEvent.d.ts +9 -0
- package/esm/stepper/hooks/useInputEvent.js +53 -0
- package/esm/stepper/hooks/useValue.d.ts +6 -0
- package/esm/stepper/hooks/useValue.js +38 -0
- package/esm/stepper/index.d.ts +13 -0
- package/esm/stepper/index.js +163 -0
- package/esm/stepper/style/css/index.css +76 -0
- package/esm/stepper/style/css/index.d.ts +2 -0
- package/esm/stepper/style/css/index.js +2 -0
- package/esm/stepper/style/index.d.ts +2 -0
- package/esm/stepper/style/index.js +2 -0
- package/esm/stepper/style/index.less +80 -0
- package/esm/stepper/type.d.ts +159 -0
- package/esm/stepper/type.js +1 -0
- package/esm/style.d.ts +1 -0
- package/esm/style.js +1 -0
- package/esm/swipe-action/index.d.ts +1 -0
- package/esm/swipe-action/index.js +1 -0
- package/esm/switch/index.js +4 -0
- package/esm/toast/index.d.ts +18 -18
- package/esm/toast/index.js +3 -2
- package/esm/toast/methods.d.ts +2 -1
- package/esm/toast/methods.js +2 -2
- package/package.json +3 -3
- package/style/css/public.css +4 -4
- package/tokens/app/arcodesign/default/css-variables.less +15 -0
- package/tokens/app/arcodesign/default/index.d.ts +15 -0
- package/tokens/app/arcodesign/default/index.js +16 -1
- package/tokens/app/arcodesign/default/index.json +180 -0
- package/tokens/app/arcodesign/default/index.less +15 -0
- package/umd/_helpers/render.d.ts +3 -1
- package/umd/_helpers/render.js +13 -7
- package/umd/action-sheet/index.d.ts +5 -5
- package/umd/action-sheet/index.js +4 -3
- package/umd/action-sheet/methods.d.ts +1 -1
- package/umd/badge/style/css/index.css +1 -2
- package/umd/checkbox/checkbox.js +4 -0
- package/umd/circle-progress/index.js +4 -0
- package/umd/context-provider/index.d.ts +4 -0
- package/umd/context-provider/index.js +13 -1
- package/umd/dialog/index.d.ts +8 -8
- package/umd/dialog/index.js +3 -2
- package/umd/dialog/methods.d.ts +3 -3
- package/umd/dialog/style/css/index.css +1 -2
- package/umd/image-picker/index.js +18 -12
- package/umd/image-picker/type.d.ts +10 -0
- package/umd/image-preview/index.d.ts +3 -3
- package/umd/image-preview/index.js +3 -2
- package/umd/image-preview/methods.d.ts +2 -1
- package/umd/image-preview/methods.js +2 -2
- package/umd/index.d.ts +1 -0
- package/umd/index.js +7 -5
- package/umd/input/hooks.js +1 -0
- package/umd/input/index.d.ts +5 -0
- package/umd/input/index.js +6 -2
- package/umd/input/style/css/index.css +1 -0
- package/umd/input/style/index.less +1 -0
- package/umd/masking/index.d.ts +4 -14
- package/umd/masking/index.js +3 -2
- package/umd/masking/methods.d.ts +3 -2
- package/umd/masking/methods.js +2 -2
- package/umd/nav-bar/index.d.ts +12 -0
- package/umd/nav-bar/index.js +8 -2
- package/umd/notify/index.d.ts +12 -12
- package/umd/notify/index.js +3 -2
- package/umd/notify/methods.d.ts +2 -1
- package/umd/notify/methods.js +2 -2
- package/umd/picker-view/components/picker-cell.js +3 -1
- package/umd/popup/index.d.ts +4 -4
- package/umd/popup/index.js +3 -2
- package/umd/popup/methods.d.ts +1 -1
- package/umd/popup-swiper/index.d.ts +12 -6
- package/umd/popup-swiper/index.js +3 -2
- package/umd/popup-swiper/methods.d.ts +1 -1
- package/umd/progress/index.js +4 -0
- package/umd/rate/index.js +5 -0
- package/umd/slider/index.js +6 -1
- package/umd/stepper/demo/style/css/mobile.css +4 -0
- package/umd/stepper/demo/style/mobile.less +10 -0
- package/umd/stepper/hooks/useButtonClick.d.ts +11 -0
- package/umd/stepper/hooks/useButtonClick.js +86 -0
- package/umd/stepper/hooks/useInputEvent.d.ts +9 -0
- package/umd/stepper/hooks/useInputEvent.js +71 -0
- package/umd/stepper/hooks/useValue.d.ts +6 -0
- package/umd/stepper/hooks/useValue.js +56 -0
- package/umd/stepper/index.d.ts +13 -0
- package/umd/stepper/index.js +191 -0
- package/umd/stepper/style/css/index.css +76 -0
- package/umd/stepper/style/css/index.d.ts +2 -0
- package/umd/stepper/style/css/index.js +15 -0
- package/umd/stepper/style/index.d.ts +2 -0
- package/umd/stepper/style/index.js +15 -0
- package/umd/stepper/style/index.less +80 -0
- package/umd/stepper/type.d.ts +159 -0
- package/umd/stepper/type.js +17 -0
- package/umd/style.d.ts +1 -0
- package/umd/style.js +4 -4
- package/umd/swipe-action/index.d.ts +1 -0
- package/umd/swipe-action/index.js +11 -4
- package/umd/switch/index.js +4 -0
- package/umd/toast/index.d.ts +18 -18
- package/umd/toast/index.js +3 -2
- package/umd/toast/methods.d.ts +2 -1
- package/umd/toast/methods.js +2 -2
package/dist/index.js
CHANGED
@@ -898,6 +898,10 @@
|
|
898
898
|
SearchBar: {
|
899
899
|
placeholder: '请输入要查询的内容',
|
900
900
|
cancelBtn: '取消'
|
901
|
+
},
|
902
|
+
Stepper: {
|
903
|
+
minusButtonName: '减少',
|
904
|
+
addButtonName: '增加'
|
901
905
|
}
|
902
906
|
};
|
903
907
|
|
@@ -1147,6 +1151,16 @@
|
|
1147
1151
|
}, children);
|
1148
1152
|
}
|
1149
1153
|
var ContextLayout = GlobalContext.Consumer;
|
1154
|
+
function CompWithGlobalContext(Component) {
|
1155
|
+
return function (props) {
|
1156
|
+
var propsContext = props.context,
|
1157
|
+
others = __rest(props, ["context"]);
|
1158
|
+
|
1159
|
+
return /*#__PURE__*/React__default["default"].createElement(ContextLayout, null, function (context) {
|
1160
|
+
return /*#__PURE__*/React__default["default"].createElement(ContextProvider, __assign({}, __assign(__assign({}, context), propsContext)), /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, others)));
|
1161
|
+
});
|
1162
|
+
};
|
1163
|
+
}
|
1150
1164
|
|
1151
1165
|
/**
|
1152
1166
|
* React.createPortal的简单封装。
|
@@ -2576,16 +2590,20 @@
|
|
2576
2590
|
var ReactDOMRender =
|
2577
2591
|
/** @class */
|
2578
2592
|
function () {
|
2579
|
-
function ReactDOMRender(app, container) {
|
2593
|
+
function ReactDOMRender(app, container, context) {
|
2580
2594
|
var _this = this;
|
2581
2595
|
|
2582
2596
|
this.render = function (props) {
|
2583
2597
|
var CustomApp = _this.app;
|
2584
2598
|
|
2599
|
+
var propsWithContext = __assign(__assign({}, props), {
|
2600
|
+
context: _this.context
|
2601
|
+
});
|
2602
|
+
|
2585
2603
|
if (_this.root) {
|
2586
|
-
_this.root.render( /*#__PURE__*/React__default["default"].createElement(CustomApp, __assign({},
|
2604
|
+
_this.root.render( /*#__PURE__*/React__default["default"].createElement(CustomApp, __assign({}, propsWithContext)));
|
2587
2605
|
} else {
|
2588
|
-
_this.root = render( /*#__PURE__*/React__default["default"].createElement(CustomApp, __assign({},
|
2606
|
+
_this.root = render( /*#__PURE__*/React__default["default"].createElement(CustomApp, __assign({}, propsWithContext)), _this.container);
|
2589
2607
|
}
|
2590
2608
|
};
|
2591
2609
|
|
@@ -2598,6 +2616,7 @@
|
|
2598
2616
|
|
2599
2617
|
this.app = app;
|
2600
2618
|
this.container = container;
|
2619
|
+
this.context = context;
|
2601
2620
|
}
|
2602
2621
|
|
2603
2622
|
return ReactDOMRender;
|
@@ -2610,7 +2629,7 @@
|
|
2610
2629
|
};
|
2611
2630
|
}
|
2612
2631
|
|
2613
|
-
return function (config) {
|
2632
|
+
return function (config, context) {
|
2614
2633
|
var baseProps = __assign(__assign({
|
2615
2634
|
unmountOnExit: true
|
2616
2635
|
}, normalize(config)), {
|
@@ -2624,7 +2643,7 @@
|
|
2624
2643
|
var id = "_" + (containerId || 'ARCO_MASKING') + "_DIV_" + (config.key || '') + "_";
|
2625
2644
|
var div = appendElementById(id, baseProps.getContainer).child;
|
2626
2645
|
var leaving = false;
|
2627
|
-
var render = new ReactDOMRender(Component, div).render;
|
2646
|
+
var render = new ReactDOMRender(Component, div, context).render;
|
2628
2647
|
|
2629
2648
|
function update(newConfig) {
|
2630
2649
|
dynamicProps = __assign(__assign({}, dynamicProps), normalize(newConfig));
|
@@ -2847,6 +2866,7 @@
|
|
2847
2866
|
open: open$5(Comp)
|
2848
2867
|
};
|
2849
2868
|
}
|
2869
|
+
var MaskingWithGlobalContext = CompWithGlobalContext(Masking);
|
2850
2870
|
/**
|
2851
2871
|
* 通用模态弹窗,内部内容自定义。默认做了防滚动穿透处理,如果弹层内容中需要滚动,则需将滚动容器传入`getScrollContainer`属性以在未滚动到顶部或底部时释放滚动。
|
2852
2872
|
* @en Generic modal popup with custom internal content. By default, anti-scroll penetration processing is performed. If scrolling is required in the content of the bullet layer, need to pass the scroll container to the `getScrollContainer` to release scrolling when it is not scrolled to the top or bottom.
|
@@ -2856,7 +2876,7 @@
|
|
2856
2876
|
* @name_en Masking
|
2857
2877
|
*/
|
2858
2878
|
|
2859
|
-
var Masking$1 = componentWrapper(Masking, methodsGenerator$7(
|
2879
|
+
var Masking$1 = componentWrapper(Masking, methodsGenerator$7(MaskingWithGlobalContext));
|
2860
2880
|
|
2861
2881
|
function open$4(Component) {
|
2862
2882
|
return open$5(Component, 'ARCO_POPUP');
|
@@ -2924,6 +2944,7 @@
|
|
2924
2944
|
open: open$4(Comp)
|
2925
2945
|
};
|
2926
2946
|
}
|
2947
|
+
var PopupWithGlobalContext = CompWithGlobalContext(Popup);
|
2927
2948
|
/**
|
2928
2949
|
* 基于模态弹窗的的全屏菜单,支持各个方向。默认做了防滚动穿透处理,如果弹层内容中需要滚动,则需将滚动容器传入`getScrollContainer`属性以在未滚动到顶部或底部时释放滚动。
|
2929
2950
|
* @en A full-screen menu based on a modal popup, supporting all directions. By default, anti-scroll penetration processing is performed. If scrolling is required in the content of the popup layer, you need to pass the scroll container to the `getScrollContainer` property to release scrolling when it is not scrolled to the top or bottom.
|
@@ -2933,7 +2954,7 @@
|
|
2933
2954
|
* @name_en Popup
|
2934
2955
|
*/
|
2935
2956
|
|
2936
|
-
var Popup$1 = componentWrapper(Popup, methodsGenerator$6(
|
2957
|
+
var Popup$1 = componentWrapper(Popup, methodsGenerator$6(PopupWithGlobalContext));
|
2937
2958
|
|
2938
2959
|
function open$3(Component) {
|
2939
2960
|
return open$5(Component, 'ARCO_ACTION_SHEET');
|
@@ -3020,16 +3041,17 @@
|
|
3020
3041
|
open: open$3(Comp)
|
3021
3042
|
};
|
3022
3043
|
}
|
3044
|
+
var ActionSheetWithGlobalContext = CompWithGlobalContext(ActionSheet);
|
3023
3045
|
/**
|
3024
3046
|
* 动作面板组件
|
3025
|
-
* @en ActionSheet
|
3047
|
+
* @en ActionSheet Component
|
3026
3048
|
* @type 反馈
|
3027
3049
|
* @type_en FeedBack
|
3028
3050
|
* @name 动作面板
|
3029
3051
|
* @name_en ActionSheet
|
3030
3052
|
*/
|
3031
3053
|
|
3032
|
-
var index$e = componentWrapper(ActionSheet, methodsGenerator$5(
|
3054
|
+
var index$e = componentWrapper(ActionSheet, methodsGenerator$5(ActionSheetWithGlobalContext));
|
3033
3055
|
|
3034
3056
|
var GroupContext = /*#__PURE__*/React__default["default"].createContext({
|
3035
3057
|
isFromGroup: false
|
@@ -5272,7 +5294,7 @@
|
|
5272
5294
|
}
|
5273
5295
|
|
5274
5296
|
function toast(Component, type) {
|
5275
|
-
return function (originConfig) {
|
5297
|
+
return function (originConfig, context) {
|
5276
5298
|
var config = typeof originConfig === 'string' ? {
|
5277
5299
|
content: originConfig,
|
5278
5300
|
type: 'info'
|
@@ -5286,7 +5308,7 @@
|
|
5286
5308
|
var div = document.createElement('div');
|
5287
5309
|
document.body.appendChild(div);
|
5288
5310
|
|
5289
|
-
var _a = new ReactDOMRender(Component, div),
|
5311
|
+
var _a = new ReactDOMRender(Component, div, context),
|
5290
5312
|
render = _a.render,
|
5291
5313
|
unmount = _a.unmount;
|
5292
5314
|
|
@@ -5517,6 +5539,7 @@
|
|
5517
5539
|
warn: toast(Comp, 'warn')
|
5518
5540
|
};
|
5519
5541
|
}
|
5542
|
+
var ToastWithGlobalContext = CompWithGlobalContext(Toast);
|
5520
5543
|
/**
|
5521
5544
|
* 轻提示组件,支持各个场景下调用方法。
|
5522
5545
|
* @en The toast component, supports calling methods in various scenarios.
|
@@ -5526,7 +5549,7 @@
|
|
5526
5549
|
* @name_en Toast
|
5527
5550
|
*/
|
5528
5551
|
|
5529
|
-
var index$b = componentWrapper(Toast, methodsGenerator$4(
|
5552
|
+
var index$b = componentWrapper(Toast, methodsGenerator$4(ToastWithGlobalContext));
|
5530
5553
|
|
5531
5554
|
/**
|
5532
5555
|
* 开关组件,支持点击和滑动触发开关动作。
|
@@ -5630,6 +5653,10 @@
|
|
5630
5653
|
return /*#__PURE__*/React__default["default"].createElement(ContextLayout, null, function (_a) {
|
5631
5654
|
var prefixCls = _a.prefixCls;
|
5632
5655
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
5656
|
+
role: "switch",
|
5657
|
+
"aria-checked": switchChecked,
|
5658
|
+
"aria-disabled": disabled,
|
5659
|
+
tabIndex: 0,
|
5633
5660
|
ref: domRef,
|
5634
5661
|
className: cls(prefixCls + "-switch all-border-box", className, "type-" + platform, "system-" + system, shape, {
|
5635
5662
|
checked: switchChecked,
|
@@ -6066,6 +6093,10 @@
|
|
6066
6093
|
return /*#__PURE__*/React__default["default"].createElement(ContextLayout, null, function (_a) {
|
6067
6094
|
var prefixCls = _a.prefixCls;
|
6068
6095
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
6096
|
+
role: "checkbox",
|
6097
|
+
"aria-checked": checked,
|
6098
|
+
"aria-disabled": disabled,
|
6099
|
+
tabIndex: 0,
|
6069
6100
|
ref: domRef,
|
6070
6101
|
style: style,
|
6071
6102
|
className: cls(className, prefixCls + "-" + componentName, "shape-" + shape, {
|
@@ -6240,6 +6271,10 @@
|
|
6240
6271
|
function renderCircleProgress(_a) {
|
6241
6272
|
var prefixCls = _a.prefixCls;
|
6242
6273
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
6274
|
+
role: "progressbar",
|
6275
|
+
"aria-valuemin": 0,
|
6276
|
+
"aria-valuemax": 100,
|
6277
|
+
"aria-valuenow": percentage,
|
6243
6278
|
className: cls(prefixCls + "-circle-progress", disabled ? prefixCls + "-circle-progress-disabled" : '', "" + className),
|
6244
6279
|
style: __assign({
|
6245
6280
|
width: circleSize,
|
@@ -8589,6 +8624,7 @@
|
|
8589
8624
|
open: open$2(Comp)
|
8590
8625
|
};
|
8591
8626
|
}
|
8627
|
+
var DialogWithGlobalContext = CompWithGlobalContext(Dialog);
|
8592
8628
|
/**
|
8593
8629
|
* 模态对话框,在浮层中显示,引导用户进行相关操作。默认做了防滚动穿透处理,如果弹层内容中需要滚动,则需将滚动容器传入`getScrollContainer`属性以在未滚动到顶部或底部时释放滚动。
|
8594
8630
|
* @en A modal dialog, displayed in a floating layer, guides the user to perform related operations. By default, anti-scroll penetration processing is performed. If scrolling is required in the content of the bullet layer, you need to pass the scroll container to `getScrollContainer` to release scrolling when it is not scrolled to the top or bottom.
|
@@ -8598,7 +8634,7 @@
|
|
8598
8634
|
* @name_en Dialog
|
8599
8635
|
*/
|
8600
8636
|
|
8601
|
-
var index$9 = componentWrapper(Dialog, methodsGenerator$3(
|
8637
|
+
var index$9 = componentWrapper(Dialog, methodsGenerator$3(DialogWithGlobalContext));
|
8602
8638
|
|
8603
8639
|
// 定义秒,分,小时,天的转化常量
|
8604
8640
|
// @en Define conversion constants for seconds, minutes, hours, days
|
@@ -9389,12 +9425,14 @@
|
|
9389
9425
|
ref: wrapRef,
|
9390
9426
|
onTouchStart: _handleItemTouchStart,
|
9391
9427
|
onTouchEnd: _handleColumnTouchEnd,
|
9392
|
-
onTouchCancel: _handleColumnTouchEnd
|
9428
|
+
onTouchCancel: _handleColumnTouchEnd,
|
9429
|
+
"aria-disabled": disabled
|
9393
9430
|
}, data.map(function (item, index) {
|
9394
9431
|
var _a;
|
9395
9432
|
|
9396
9433
|
var dis = Math.abs(index - currentIndex);
|
9397
9434
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
9435
|
+
"aria-label": index === currentIndex ? "" + item.value : '',
|
9398
9436
|
key: index + "_" + item.value,
|
9399
9437
|
className: cls(prefixCls + "-column-item", (_a = {
|
9400
9438
|
selected: index === currentIndex
|
@@ -14178,6 +14216,30 @@
|
|
14178
14216
|
|
14179
14217
|
});
|
14180
14218
|
|
14219
|
+
function IconMinus(props) {
|
14220
|
+
var _a = props.className,
|
14221
|
+
className = _a === void 0 ? '' : _a,
|
14222
|
+
_b = props.useCurrentColor,
|
14223
|
+
useCurrentColor = _b === void 0 ? true : _b,
|
14224
|
+
style = props.style,
|
14225
|
+
other = __rest(props, ["className", "useCurrentColor", "style"]);
|
14226
|
+
|
14227
|
+
return /*#__PURE__*/React__default["default"].createElement(ContextLayout, null, function (_a) {
|
14228
|
+
var prefixCls = _a.prefixCls;
|
14229
|
+
return /*#__PURE__*/React__default["default"].createElement("svg", __assign({
|
14230
|
+
className: prefixCls + "-icon " + prefixCls + "-icon-minus " + className,
|
14231
|
+
width: "1em",
|
14232
|
+
height: "1em",
|
14233
|
+
style: style,
|
14234
|
+
fill: useCurrentColor ? 'currentColor' : '#000',
|
14235
|
+
viewBox: "0 0 1024 1024",
|
14236
|
+
xmlns: "http://www.w3.org/2000/svg"
|
14237
|
+
}, other), /*#__PURE__*/React__default["default"].createElement("defs", null, /*#__PURE__*/React__default["default"].createElement("style", null)), /*#__PURE__*/React__default["default"].createElement("path", {
|
14238
|
+
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"
|
14239
|
+
}));
|
14240
|
+
});
|
14241
|
+
}
|
14242
|
+
|
14181
14243
|
function IconStarFill(props) {
|
14182
14244
|
var _a = props.className,
|
14183
14245
|
className = _a === void 0 ? '' : _a,
|
@@ -14440,7 +14502,9 @@
|
|
14440
14502
|
onMaxSizeExceed = props.onMaxSizeExceed,
|
14441
14503
|
onLimitExceed = props.onLimitExceed,
|
14442
14504
|
upload = props.upload,
|
14443
|
-
selectAdapter = props.selectAdapter
|
14505
|
+
selectAdapter = props.selectAdapter,
|
14506
|
+
onSelectClick = props.onSelectClick,
|
14507
|
+
onDeleteClick = props.onDeleteClick;
|
14444
14508
|
var domRef = React.useRef(null);
|
14445
14509
|
var fileRef = React.useRef(null);
|
14446
14510
|
var cacheRef = React.useRef([]);
|
@@ -14541,6 +14605,7 @@
|
|
14541
14605
|
};
|
14542
14606
|
|
14543
14607
|
var handleDelete = function handleDelete(index) {
|
14608
|
+
onDeleteClick && onDeleteClick(index);
|
14544
14609
|
onChange(images.filter(function (_i, j) {
|
14545
14610
|
return j !== index;
|
14546
14611
|
}));
|
@@ -14564,17 +14629,20 @@
|
|
14564
14629
|
}
|
14565
14630
|
};
|
14566
14631
|
|
14567
|
-
var handleSelect = function handleSelect() {
|
14632
|
+
var handleSelect = function handleSelect(e) {
|
14568
14633
|
var _a;
|
14569
14634
|
|
14570
|
-
|
14571
|
-
|
14572
|
-
|
14573
|
-
|
14574
|
-
|
14575
|
-
|
14576
|
-
|
14577
|
-
|
14635
|
+
if (e.target !== fileRef.current) {
|
14636
|
+
onSelectClick && onSelectClick();
|
14637
|
+
selectAdapter ? selectAdapter().then(function (_a) {
|
14638
|
+
var files = _a.files;
|
14639
|
+
return handleChange({
|
14640
|
+
target: {
|
14641
|
+
files: files
|
14642
|
+
}
|
14643
|
+
}, true);
|
14644
|
+
}) : (_a = fileRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
14645
|
+
}
|
14578
14646
|
};
|
14579
14647
|
|
14580
14648
|
var getGridData = function getGridData(prefixCls, locale) {
|
@@ -16841,7 +16909,7 @@
|
|
16841
16909
|
}();
|
16842
16910
|
|
16843
16911
|
function open$1(Component) {
|
16844
|
-
return function (config) {
|
16912
|
+
return function (config, context) {
|
16845
16913
|
var baseProps = __assign(__assign({
|
16846
16914
|
unmountOnExit: true
|
16847
16915
|
}, config || {}), {
|
@@ -16855,7 +16923,7 @@
|
|
16855
16923
|
var id = "_ARCO_IMAGE_PREVIEW_DIV_" + (baseProps.key || '') + "_";
|
16856
16924
|
var div = appendElementById(id, baseProps.getContainer).child;
|
16857
16925
|
var leaving = false;
|
16858
|
-
var render = new ReactDOMRender(Component, div).render;
|
16926
|
+
var render = new ReactDOMRender(Component, div, context).render;
|
16859
16927
|
|
16860
16928
|
function update(newConfig) {
|
16861
16929
|
dynamicProps = __assign(__assign({}, dynamicProps), newConfig || {});
|
@@ -17860,6 +17928,7 @@
|
|
17860
17928
|
open: open$1(Comp)
|
17861
17929
|
};
|
17862
17930
|
}
|
17931
|
+
var ImagePreviewWithGlobalContext = CompWithGlobalContext(ImagePreview);
|
17863
17932
|
/**
|
17864
17933
|
* 图片预览组件,支持循环轮播、双指/双击缩放、缩略图放大效果。
|
17865
17934
|
* @en The image preview, supports circular rotation, two-finger/double-tap zoom, and thumbnail zoom effects.
|
@@ -17869,7 +17938,7 @@
|
|
17869
17938
|
* @name_en ImagePreview
|
17870
17939
|
*/
|
17871
17940
|
|
17872
|
-
var index$7 = componentWrapper(ImagePreview, methodsGenerator$2(
|
17941
|
+
var index$7 = componentWrapper(ImagePreview, methodsGenerator$2(ImagePreviewWithGlobalContext));
|
17873
17942
|
|
17874
17943
|
function useInputLogic(props, inputRef) {
|
17875
17944
|
var value = props.value,
|
@@ -18069,6 +18138,7 @@
|
|
18069
18138
|
|
18070
18139
|
function renderWrapper(prefixCls, type, children) {
|
18071
18140
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
18141
|
+
role: "search",
|
18072
18142
|
className: prefixCls + "-container all-border-box " + (className || ''),
|
18073
18143
|
style: style,
|
18074
18144
|
ref: wrapRef
|
@@ -18131,19 +18201,21 @@
|
|
18131
18201
|
inputClass = props.inputClass,
|
18132
18202
|
inputStyle = props.inputStyle,
|
18133
18203
|
_b = props.nativeProps,
|
18134
|
-
nativeProps = _b === void 0 ? {} : _b
|
18204
|
+
nativeProps = _b === void 0 ? {} : _b,
|
18205
|
+
_c = props.ariaLabel,
|
18206
|
+
ariaLabel = _c === void 0 ? '' : _c;
|
18135
18207
|
var inputRef = React.useRef(null);
|
18136
18208
|
|
18137
|
-
var
|
18138
|
-
inputValue =
|
18139
|
-
handleChange =
|
18140
|
-
handleInput =
|
18141
|
-
handleKeyDown =
|
18142
|
-
handleFocus =
|
18143
|
-
handleBlur =
|
18144
|
-
handleClick =
|
18145
|
-
renderWrapper =
|
18146
|
-
wrapRef =
|
18209
|
+
var _d = useInputLogic(props, inputRef),
|
18210
|
+
inputValue = _d.inputValue,
|
18211
|
+
handleChange = _d.handleChange,
|
18212
|
+
handleInput = _d.handleInput,
|
18213
|
+
handleKeyDown = _d.handleKeyDown,
|
18214
|
+
handleFocus = _d.handleFocus,
|
18215
|
+
handleBlur = _d.handleBlur,
|
18216
|
+
handleClick = _d.handleClick,
|
18217
|
+
renderWrapper = _d.renderWrapper,
|
18218
|
+
wrapRef = _d.wrapRef;
|
18147
18219
|
|
18148
18220
|
React.useImperativeHandle(ref, function () {
|
18149
18221
|
return {
|
@@ -18175,7 +18247,9 @@
|
|
18175
18247
|
onChange: handleChange,
|
18176
18248
|
onInput: handleInput,
|
18177
18249
|
onKeyDown: handleKeyDown,
|
18178
|
-
onClick: handleClick
|
18250
|
+
onClick: handleClick,
|
18251
|
+
"aria-disabled": disabled,
|
18252
|
+
"aria-label": ariaLabel
|
18179
18253
|
})));
|
18180
18254
|
}
|
18181
18255
|
|
@@ -18409,18 +18483,22 @@
|
|
18409
18483
|
getScrollContainer = props.getScrollContainer,
|
18410
18484
|
_h = props.showOffset,
|
18411
18485
|
showOffset = _h === void 0 ? 0 : _h,
|
18412
|
-
getComputedStyleByScroll = props.getComputedStyleByScroll
|
18486
|
+
getComputedStyleByScroll = props.getComputedStyleByScroll,
|
18487
|
+
_j = props.ariaLabel,
|
18488
|
+
ariaLabel = _j === void 0 ? '' : _j,
|
18489
|
+
_k = props.ariaRole,
|
18490
|
+
ariaRole = _k === void 0 ? 'banner' : _k;
|
18413
18491
|
var navBarRef = React.useRef(null);
|
18414
18492
|
|
18415
|
-
var
|
18416
|
-
scrollToggleHide =
|
18417
|
-
setScrollToggleHide =
|
18493
|
+
var _l = React.useState(showOffset > 0),
|
18494
|
+
scrollToggleHide = _l[0],
|
18495
|
+
setScrollToggleHide = _l[1];
|
18418
18496
|
|
18419
18497
|
var relBackground = scrollToggleHide ? 'transparent' : '';
|
18420
18498
|
|
18421
|
-
var
|
18422
|
-
customStyle =
|
18423
|
-
setCustomStyle =
|
18499
|
+
var _m = React.useState({}),
|
18500
|
+
customStyle = _m[0],
|
18501
|
+
setCustomStyle = _m[1];
|
18424
18502
|
|
18425
18503
|
var system = useSystem();
|
18426
18504
|
|
@@ -18497,7 +18575,9 @@
|
|
18497
18575
|
paddingTop: fixed && statusBarHeight ? statusBarHeight + "px" : ''
|
18498
18576
|
}, style || {}), relBackground ? {
|
18499
18577
|
background: relBackground
|
18500
|
-
} : {})
|
18578
|
+
} : {}),
|
18579
|
+
"aria-label": ariaLabel,
|
18580
|
+
role: ariaRole
|
18501
18581
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
18502
18582
|
className: cls(className, system, prefixCls + "-nav-bar-wrapper", (_c = {}, _c[prefixCls + "-nav-bar-wrapper-fixed"] = fixed, _c[prefixCls + "-nav-bar-wrapper-border"] = hasBottomLine, _c)),
|
18503
18583
|
style: __assign({
|
@@ -18701,7 +18781,7 @@
|
|
18701
18781
|
});
|
18702
18782
|
|
18703
18783
|
function notify(Component, type) {
|
18704
|
-
return function (originConfig) {
|
18784
|
+
return function (originConfig, context) {
|
18705
18785
|
var config = typeof originConfig === 'string' ? {
|
18706
18786
|
content: originConfig,
|
18707
18787
|
type: 'info'
|
@@ -18720,7 +18800,7 @@
|
|
18720
18800
|
document.body.appendChild(div);
|
18721
18801
|
}
|
18722
18802
|
|
18723
|
-
var _a = new ReactDOMRender(Component, div),
|
18803
|
+
var _a = new ReactDOMRender(Component, div, context),
|
18724
18804
|
render = _a.render,
|
18725
18805
|
unmount = _a.unmount;
|
18726
18806
|
|
@@ -18906,6 +18986,7 @@
|
|
18906
18986
|
warn: notify(Comp, 'warn')
|
18907
18987
|
};
|
18908
18988
|
}
|
18989
|
+
var NotifyWithGlobalContext = CompWithGlobalContext(Notify);
|
18909
18990
|
/**
|
18910
18991
|
* 主动操作后显示的反馈信息横条,可采用方法调用或者组件调用的方式
|
18911
18992
|
* @en The feedback information bar displayed after active operation can be called by method or by component.
|
@@ -18915,7 +18996,7 @@
|
|
18915
18996
|
* @name_en Notify
|
18916
18997
|
*/
|
18917
18998
|
|
18918
|
-
var index$6 = componentWrapper(Notify, methodsGenerator$1(
|
18999
|
+
var index$6 = componentWrapper(Notify, methodsGenerator$1(NotifyWithGlobalContext));
|
18919
19000
|
|
18920
19001
|
function Arrow() {
|
18921
19002
|
return /*#__PURE__*/React__default["default"].createElement("svg", {
|
@@ -20575,6 +20656,7 @@
|
|
20575
20656
|
open: open(Comp)
|
20576
20657
|
};
|
20577
20658
|
}
|
20659
|
+
var PopupSwiperWithGlobalContext = CompWithGlobalContext(PopupSwiper);
|
20578
20660
|
/**
|
20579
20661
|
* 基于弹出层(Popup)封装的具有手势关闭功能的弹出层组件,拥有 Popup 组件的其他能力。
|
20580
20662
|
* @en The popup with gesture closing function based on the popup encapsulation, has other capabilities of the Popup component.
|
@@ -20584,7 +20666,7 @@
|
|
20584
20666
|
* @name_en PopupSwiper
|
20585
20667
|
*/
|
20586
20668
|
|
20587
|
-
var index$4 = componentWrapper(PopupSwiper, methodsGenerator(
|
20669
|
+
var index$4 = componentWrapper(PopupSwiper, methodsGenerator(PopupSwiperWithGlobalContext));
|
20588
20670
|
|
20589
20671
|
/**
|
20590
20672
|
* 进度条组件,可根据外界传递进来的百分比进行进度展示
|
@@ -20669,6 +20751,10 @@
|
|
20669
20751
|
function renderBarProgress(_a) {
|
20670
20752
|
var prefixCls = _a.prefixCls;
|
20671
20753
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
20754
|
+
role: "progressbar",
|
20755
|
+
"aria-valuenow": percentage,
|
20756
|
+
"aria-valuemax": 100,
|
20757
|
+
"aria-valuemin": 0,
|
20672
20758
|
className: cls(prefixCls + "-progress", {
|
20673
20759
|
'progress-fixed': mode === 'nav'
|
20674
20760
|
}, {
|
@@ -21572,6 +21658,11 @@
|
|
21572
21658
|
return /*#__PURE__*/React__default["default"].createElement(ContextLayout, null, function (_a) {
|
21573
21659
|
var prefixCls = _a.prefixCls;
|
21574
21660
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
21661
|
+
role: "slider",
|
21662
|
+
"aria-valuemin": 0,
|
21663
|
+
"aria-valuemax": count,
|
21664
|
+
"aria-valuenow": innerValue,
|
21665
|
+
"aria-disabled": disabled,
|
21575
21666
|
className: cls(prefixCls + "-rate", className, {
|
21576
21667
|
disabled: disabled
|
21577
21668
|
}),
|
@@ -22313,7 +22404,12 @@
|
|
22313
22404
|
'show-marks': showMarks
|
22314
22405
|
}),
|
22315
22406
|
style: style,
|
22316
|
-
ref: domRef
|
22407
|
+
ref: domRef,
|
22408
|
+
role: "slider",
|
22409
|
+
"aria-valuemin": min,
|
22410
|
+
"aria-valuemax": max,
|
22411
|
+
"aria-valuenow": Array.isArray(valueGroup) ? valueGroup[0] : valueGroup,
|
22412
|
+
"aria-disabled": disabled
|
22317
22413
|
}, isHorizontal ? renderPrefixLabel : renderSuffixLabel, /*#__PURE__*/React__default["default"].createElement("div", {
|
22318
22414
|
className: prefixCls + "-slider-wrapper"
|
22319
22415
|
}, /*#__PURE__*/React__default["default"].createElement(Marks, {
|
@@ -22735,6 +22831,320 @@
|
|
22735
22831
|
return /*#__PURE__*/React__default["default"].createElement(ContextLayout, null, renderSearchBar);
|
22736
22832
|
});
|
22737
22833
|
|
22834
|
+
function correctCalculation(leftNumber, rightNumber, operator) {
|
22835
|
+
var magnification = 1e17;
|
22836
|
+
var left = leftNumber * magnification;
|
22837
|
+
var right = rightNumber * magnification;
|
22838
|
+
return operator === '-' ? (left - right) / magnification : (left + right) / magnification;
|
22839
|
+
}
|
22840
|
+
|
22841
|
+
function useButtonClick(params) {
|
22842
|
+
var actualInputValue = params.actualInputValue,
|
22843
|
+
min = params.min,
|
22844
|
+
max = params.max,
|
22845
|
+
step = params.step,
|
22846
|
+
disabled = params.disabled,
|
22847
|
+
equalLimitDisabled = params.equalLimitDisabled,
|
22848
|
+
updateValue = params.updateValue,
|
22849
|
+
onAddButtonClick = params.onAddButtonClick,
|
22850
|
+
onMinusButtonClick = params.onMinusButtonClick;
|
22851
|
+
|
22852
|
+
var _a = React.useState(function () {
|
22853
|
+
return actualInputValue === min || disabled;
|
22854
|
+
}),
|
22855
|
+
minusButtonDisable = _a[0],
|
22856
|
+
setMinusButtonDisable = _a[1];
|
22857
|
+
|
22858
|
+
var _b = React.useState(function () {
|
22859
|
+
return actualInputValue === max || disabled;
|
22860
|
+
}),
|
22861
|
+
addButtonDisable = _b[0],
|
22862
|
+
setAddButtonDisable = _b[1];
|
22863
|
+
|
22864
|
+
var handleMinusButtonClick = function handleMinusButtonClick(e) {
|
22865
|
+
if (minusButtonDisable) {
|
22866
|
+
return;
|
22867
|
+
}
|
22868
|
+
|
22869
|
+
updateValue(function (oldValue) {
|
22870
|
+
var result = correctCalculation(oldValue, step, '-');
|
22871
|
+
return result < min ? equalLimitDisabled ? oldValue : min : result;
|
22872
|
+
});
|
22873
|
+
onMinusButtonClick && onMinusButtonClick(e);
|
22874
|
+
};
|
22875
|
+
|
22876
|
+
var handleAddButtonClick = function handleAddButtonClick(e) {
|
22877
|
+
if (addButtonDisable) {
|
22878
|
+
return;
|
22879
|
+
}
|
22880
|
+
|
22881
|
+
updateValue(function (oldValue) {
|
22882
|
+
var result = correctCalculation(Number(oldValue), step, '+');
|
22883
|
+
return result > max ? equalLimitDisabled ? oldValue : max : result;
|
22884
|
+
});
|
22885
|
+
onAddButtonClick && onAddButtonClick(e);
|
22886
|
+
}; // 当前值改变时,更新按钮状态
|
22887
|
+
// Changes button status when value changed
|
22888
|
+
|
22889
|
+
|
22890
|
+
React.useEffect(function () {
|
22891
|
+
setMinusButtonDisable(actualInputValue <= min);
|
22892
|
+
setAddButtonDisable(actualInputValue >= max);
|
22893
|
+
}, [actualInputValue]);
|
22894
|
+
return {
|
22895
|
+
minusButtonDisable: minusButtonDisable,
|
22896
|
+
addButtonDisable: addButtonDisable,
|
22897
|
+
handleMinusButtonClick: handleMinusButtonClick,
|
22898
|
+
handleAddButtonClick: handleAddButtonClick
|
22899
|
+
};
|
22900
|
+
}
|
22901
|
+
|
22902
|
+
function useInputEvent(params) {
|
22903
|
+
var defaultValue = params.defaultValue,
|
22904
|
+
min = params.min,
|
22905
|
+
max = params.max,
|
22906
|
+
digits = params.digits,
|
22907
|
+
actualInputValue = params.actualInputValue,
|
22908
|
+
allowEmpty = params.allowEmpty,
|
22909
|
+
updateValue = params.updateValue,
|
22910
|
+
onBlur = params.onBlur,
|
22911
|
+
onChange = params.onChange,
|
22912
|
+
onInput = params.onInput;
|
22913
|
+
|
22914
|
+
var handleInput = function handleInput(e) {
|
22915
|
+
var targetValue = e.target.value;
|
22916
|
+
var numberValue = Number(targetValue);
|
22917
|
+
var pointIndex = targetValue.indexOf('.');
|
22918
|
+
|
22919
|
+
if (digits > 0 && pointIndex !== -1) {
|
22920
|
+
var decimalLength = targetValue.slice(pointIndex + 1).length;
|
22921
|
+
updateValue(decimalLength > digits ? actualInputValue : numberValue);
|
22922
|
+
} else if (allowEmpty && targetValue === '') {
|
22923
|
+
updateValue(Number.MIN_VALUE);
|
22924
|
+
} else {
|
22925
|
+
updateValue(numberValue);
|
22926
|
+
}
|
22927
|
+
|
22928
|
+
onInput && onInput(e);
|
22929
|
+
};
|
22930
|
+
|
22931
|
+
var handleBlur = function handleBlur(e) {
|
22932
|
+
var targetValue = e.target.value;
|
22933
|
+
var numberValue = Number(targetValue);
|
22934
|
+
|
22935
|
+
if (allowEmpty && targetValue === '') {
|
22936
|
+
updateValue(Number.MIN_VALUE);
|
22937
|
+
} else if (!allowEmpty && targetValue === '') {
|
22938
|
+
updateValue(defaultValue);
|
22939
|
+
} else {
|
22940
|
+
updateValue(Math.max(min, Math.min(max, numberValue)));
|
22941
|
+
}
|
22942
|
+
|
22943
|
+
onBlur && onBlur(e);
|
22944
|
+
};
|
22945
|
+
|
22946
|
+
useUpdateEffect(function () {
|
22947
|
+
onChange && onChange(actualInputValue);
|
22948
|
+
}, [actualInputValue]);
|
22949
|
+
return {
|
22950
|
+
handleInput: handleInput,
|
22951
|
+
handleBlur: handleBlur
|
22952
|
+
};
|
22953
|
+
}
|
22954
|
+
|
22955
|
+
function useValue(params) {
|
22956
|
+
var defaultValue = params.defaultValue,
|
22957
|
+
formatter = params.formatter,
|
22958
|
+
max = params.max,
|
22959
|
+
min = params.min,
|
22960
|
+
value = params.value,
|
22961
|
+
digits = params.digits;
|
22962
|
+
|
22963
|
+
var _a = React.useState(defaultValue),
|
22964
|
+
innerValue = _a[0],
|
22965
|
+
setInnerValue = _a[1];
|
22966
|
+
|
22967
|
+
var updateValue = function updateValue(updater) {
|
22968
|
+
var tempValue = typeof updater === 'function' ? updater(innerValue) : updater;
|
22969
|
+
|
22970
|
+
if (formatter) {
|
22971
|
+
new Promise(function (resolve) {
|
22972
|
+
resolve(formatter(Number(tempValue)));
|
22973
|
+
}).then(function (result) {
|
22974
|
+
var res = Math.max(min, Math.min(max, result));
|
22975
|
+
setInnerValue(res);
|
22976
|
+
});
|
22977
|
+
} else {
|
22978
|
+
setInnerValue(tempValue);
|
22979
|
+
}
|
22980
|
+
};
|
22981
|
+
|
22982
|
+
var actualInputValue = value !== undefined ? value : innerValue; // 将actualInputValue等于Number.MIN_VALUE的情况视为空值
|
22983
|
+
// @en If actualInputValue equal Number.MIN_VALUE, actualInputValue equal ''
|
22984
|
+
|
22985
|
+
var showValue = actualInputValue === Number.MIN_VALUE ? '' : digits > 0 ? parseFloat(String(actualInputValue)).toFixed(digits) : actualInputValue;
|
22986
|
+
return {
|
22987
|
+
updateValue: updateValue,
|
22988
|
+
actualInputValue: actualInputValue,
|
22989
|
+
showValue: showValue
|
22990
|
+
};
|
22991
|
+
}
|
22992
|
+
|
22993
|
+
/**
|
22994
|
+
* 步进器组件,支持受控模式
|
22995
|
+
* @en Stepper component, provide controlled mode
|
22996
|
+
* @type 数据录入
|
22997
|
+
* @type_en Data Entry
|
22998
|
+
* @name 步进器
|
22999
|
+
* @name_en Stepper
|
23000
|
+
*/
|
23001
|
+
|
23002
|
+
var Stepper = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
23003
|
+
var _a = props.className,
|
23004
|
+
className = _a === void 0 ? '' : _a,
|
23005
|
+
style = props.style,
|
23006
|
+
inputStyle = props.inputStyle,
|
23007
|
+
_b = props.inputClass,
|
23008
|
+
inputClass = _b === void 0 ? '' : _b,
|
23009
|
+
value = props.value,
|
23010
|
+
_c = props.defaultValue,
|
23011
|
+
defaultValue = _c === void 0 ? 1 : _c,
|
23012
|
+
_d = props.allowEmpty,
|
23013
|
+
allowEmpty = _d === void 0 ? false : _d,
|
23014
|
+
_e = props.digits,
|
23015
|
+
digits = _e === void 0 ? 0 : _e,
|
23016
|
+
_f = props.disabled,
|
23017
|
+
disabled = _f === void 0 ? false : _f,
|
23018
|
+
_g = props.inputReadonly,
|
23019
|
+
inputReadonly = _g === void 0 ? false : _g,
|
23020
|
+
_h = props.max,
|
23021
|
+
max = _h === void 0 ? Infinity : _h,
|
23022
|
+
_j = props.min,
|
23023
|
+
min = _j === void 0 ? 1 : _j,
|
23024
|
+
_k = props.equalLimitDisabled,
|
23025
|
+
equalLimitDisabled = _k === void 0 ? false : _k,
|
23026
|
+
_l = props.step,
|
23027
|
+
step = _l === void 0 ? 1 : _l,
|
23028
|
+
_m = props.theme,
|
23029
|
+
theme = _m === void 0 ? 'default' : _m,
|
23030
|
+
formatter = props.formatter,
|
23031
|
+
addButton = props.addButton,
|
23032
|
+
minusButton = props.minusButton,
|
23033
|
+
renderContent = props.renderContent,
|
23034
|
+
onBlur = props.onBlur,
|
23035
|
+
onChange = props.onChange,
|
23036
|
+
onFocus = props.onFocus,
|
23037
|
+
onAddButtonClick = props.onAddButtonClick,
|
23038
|
+
onMinusButtonClick = props.onMinusButtonClick,
|
23039
|
+
onClick = props.onClick,
|
23040
|
+
onInput = props.onInput; // 值的相关逻辑
|
23041
|
+
// @en The logic is that handle value
|
23042
|
+
|
23043
|
+
var _o = useValue({
|
23044
|
+
defaultValue: defaultValue,
|
23045
|
+
formatter: formatter,
|
23046
|
+
min: min,
|
23047
|
+
max: max,
|
23048
|
+
value: value,
|
23049
|
+
digits: digits
|
23050
|
+
}),
|
23051
|
+
updateValue = _o.updateValue,
|
23052
|
+
actualInputValue = _o.actualInputValue,
|
23053
|
+
showValue = _o.showValue; // 按钮点击的相关逻辑
|
23054
|
+
// @en The logic is that handle button click
|
23055
|
+
|
23056
|
+
|
23057
|
+
var _p = useButtonClick({
|
23058
|
+
actualInputValue: actualInputValue,
|
23059
|
+
min: min,
|
23060
|
+
max: max,
|
23061
|
+
step: step,
|
23062
|
+
disabled: disabled,
|
23063
|
+
digits: digits,
|
23064
|
+
equalLimitDisabled: equalLimitDisabled,
|
23065
|
+
updateValue: updateValue,
|
23066
|
+
onAddButtonClick: onAddButtonClick,
|
23067
|
+
onMinusButtonClick: onMinusButtonClick
|
23068
|
+
}),
|
23069
|
+
minusButtonDisable = _p.minusButtonDisable,
|
23070
|
+
addButtonDisable = _p.addButtonDisable,
|
23071
|
+
handleAddButtonClick = _p.handleAddButtonClick,
|
23072
|
+
handleMinusButtonClick = _p.handleMinusButtonClick; // 输入框操作的相关逻辑
|
23073
|
+
// @en The logic is that handle input operation
|
23074
|
+
|
23075
|
+
|
23076
|
+
var _q = useInputEvent({
|
23077
|
+
defaultValue: defaultValue,
|
23078
|
+
min: min,
|
23079
|
+
max: max,
|
23080
|
+
digits: digits,
|
23081
|
+
actualInputValue: actualInputValue,
|
23082
|
+
allowEmpty: allowEmpty,
|
23083
|
+
updateValue: updateValue,
|
23084
|
+
onBlur: onBlur,
|
23085
|
+
onChange: onChange,
|
23086
|
+
onInput: onInput
|
23087
|
+
}),
|
23088
|
+
handleInput = _q.handleInput,
|
23089
|
+
handleBlur = _q.handleBlur;
|
23090
|
+
|
23091
|
+
var domRef = React.useRef(null);
|
23092
|
+
var inputRef = React.useRef(null);
|
23093
|
+
React.useImperativeHandle(ref, function () {
|
23094
|
+
return {
|
23095
|
+
dom: domRef.current,
|
23096
|
+
input: inputRef.current,
|
23097
|
+
changeValue: function changeValue(newValue) {
|
23098
|
+
var tempValue = newValue != null ? newValue : defaultValue;
|
23099
|
+
tempValue = Math.min(max, Math.max(tempValue, min));
|
23100
|
+
updateValue(tempValue);
|
23101
|
+
}
|
23102
|
+
};
|
23103
|
+
});
|
23104
|
+
return /*#__PURE__*/React__default["default"].createElement(ContextLayout, null, function (_a) {
|
23105
|
+
var prefixCls = _a.prefixCls;
|
23106
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
23107
|
+
className: cls(prefixCls + "-stepper", prefixCls + "-" + theme, className),
|
23108
|
+
style: style,
|
23109
|
+
ref: domRef,
|
23110
|
+
onClick: onClick
|
23111
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
23112
|
+
"aria-label": "decrease",
|
23113
|
+
onClick: handleMinusButtonClick
|
23114
|
+
}, minusButton || /*#__PURE__*/React__default["default"].createElement("div", {
|
23115
|
+
className: cls(prefixCls + "-stepper-minus-button")
|
23116
|
+
}, /*#__PURE__*/React__default["default"].createElement(IconMinus, {
|
23117
|
+
className: cls(prefixCls + "-stepper-minus-button-icon", {
|
23118
|
+
disabled: minusButtonDisable
|
23119
|
+
})
|
23120
|
+
}))), renderContent ? renderContent(actualInputValue) : /*#__PURE__*/React__default["default"].createElement("input", {
|
23121
|
+
style: inputStyle,
|
23122
|
+
className: cls(prefixCls + "-stepper-input", inputClass),
|
23123
|
+
onFocus: onFocus,
|
23124
|
+
onInput: handleInput,
|
23125
|
+
onBlur: handleBlur,
|
23126
|
+
disabled: disabled,
|
23127
|
+
value: showValue,
|
23128
|
+
readOnly: inputReadonly,
|
23129
|
+
ref: inputRef,
|
23130
|
+
type: "number",
|
23131
|
+
role: "spinbutton",
|
23132
|
+
"aria-valuenow": Number(showValue),
|
23133
|
+
"aria-valuemax": max,
|
23134
|
+
"aria-valuemin": min
|
23135
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
23136
|
+
"aria-label": "increase",
|
23137
|
+
onClick: handleAddButtonClick
|
23138
|
+
}, addButton || /*#__PURE__*/React__default["default"].createElement("div", {
|
23139
|
+
className: cls(prefixCls + "-stepper-add-button")
|
23140
|
+
}, /*#__PURE__*/React__default["default"].createElement(IconAdd, {
|
23141
|
+
className: cls(prefixCls + "-stepper-add-button-icon", {
|
23142
|
+
disabled: addButtonDisable
|
23143
|
+
})
|
23144
|
+
}))));
|
23145
|
+
});
|
23146
|
+
});
|
23147
|
+
|
22738
23148
|
var Step = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
22739
23149
|
var title = props.title,
|
22740
23150
|
description = props.description,
|
@@ -24214,6 +24624,7 @@
|
|
24214
24624
|
exports.SearchBar = SearchBar;
|
24215
24625
|
exports.ShowMonitor = ShowMonitor;
|
24216
24626
|
exports.Slider = SliderWrapper;
|
24627
|
+
exports.Stepper = Stepper;
|
24217
24628
|
exports.Steps = index$2;
|
24218
24629
|
exports.Sticky = Sticky;
|
24219
24630
|
exports.SwipeAction = SwipeAction;
|