@arco-design/mobile-react 2.23.0 → 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 +16 -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-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/input/hooks.js +1 -0
- package/cjs/input/index.d.ts +5 -0
- package/cjs/input/index.js +6 -2
- 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/index.js +7 -1
- 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 +115 -43
- package/dist/index.min.js +3 -3
- package/dist/style.css +13 -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-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/input/hooks.js +1 -0
- package/esm/input/index.d.ts +5 -0
- package/esm/input/index.js +6 -2
- 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/index.js +7 -1
- 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/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-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/input/hooks.js +1 -0
- package/umd/input/index.d.ts +5 -0
- package/umd/input/index.js +6 -2
- 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/index.js +7 -1
- 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/esm/checkbox/checkbox.js
CHANGED
@@ -136,6 +136,10 @@ export var Checkbox = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
136
136
|
return /*#__PURE__*/React.createElement(ContextLayout, null, function (_ref) {
|
137
137
|
var prefixCls = _ref.prefixCls;
|
138
138
|
return /*#__PURE__*/React.createElement("div", {
|
139
|
+
role: "checkbox",
|
140
|
+
"aria-checked": checked,
|
141
|
+
"aria-disabled": disabled,
|
142
|
+
tabIndex: 0,
|
139
143
|
ref: domRef,
|
140
144
|
style: style,
|
141
145
|
className: cls(className, prefixCls + "-" + componentName, "shape-" + shape, {
|
@@ -149,6 +149,10 @@ var CircleProgress = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
149
149
|
function renderCircleProgress(_ref) {
|
150
150
|
var prefixCls = _ref.prefixCls;
|
151
151
|
return /*#__PURE__*/React.createElement("div", {
|
152
|
+
role: "progressbar",
|
153
|
+
"aria-valuemin": 0,
|
154
|
+
"aria-valuemax": 100,
|
155
|
+
"aria-valuenow": percentage,
|
152
156
|
className: cls(prefixCls + "-circle-progress", disabled ? prefixCls + "-circle-progress-disabled" : '', "" + className),
|
153
157
|
style: _extends({
|
154
158
|
width: circleSize,
|
@@ -41,6 +41,9 @@ export declare const GlobalContext: React.Context<GlobalContextParams>;
|
|
41
41
|
export interface ContextProviderProps extends GlobalContextParams {
|
42
42
|
children: React.ReactNode;
|
43
43
|
}
|
44
|
+
export declare type WithGlobalContext<T> = T & {
|
45
|
+
context?: GlobalContextParams;
|
46
|
+
};
|
44
47
|
/**
|
45
48
|
* 全局数据控制组件,用于替换全局数据。
|
46
49
|
* @en Global data control component, used to replace global data.
|
@@ -51,3 +54,4 @@ export interface ContextProviderProps extends GlobalContextParams {
|
|
51
54
|
*/
|
52
55
|
export default function ContextProvider(props: ContextProviderProps): JSX.Element;
|
53
56
|
export declare const ContextLayout: React.Consumer<GlobalContextParams>;
|
57
|
+
export declare function CompWithGlobalContext<P extends JSX.IntrinsicAttributes>(Component: React.FunctionComponent<P>): (props: WithGlobalContext<P>) => JSX.Element;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
3
|
-
var _excluded = ["children", "useDarkMode", "isDarkMode", "theme", "locale"]
|
3
|
+
var _excluded = ["children", "useDarkMode", "isDarkMode", "theme", "locale"],
|
4
|
+
_excluded2 = ["context"];
|
4
5
|
import React, { createContext, useState, useEffect, useCallback } from 'react';
|
5
6
|
import { addCssRules, removeCssStyleDom, defaultLocale } from '@arco-design/mobile-utils';
|
6
7
|
export var defaultContext = {
|
@@ -78,4 +79,14 @@ export default function ContextProvider(props) {
|
|
78
79
|
})
|
79
80
|
}, children);
|
80
81
|
}
|
81
|
-
export var ContextLayout = GlobalContext.Consumer;
|
82
|
+
export var ContextLayout = GlobalContext.Consumer;
|
83
|
+
export function CompWithGlobalContext(Component) {
|
84
|
+
return function (props) {
|
85
|
+
var propsContext = props.context,
|
86
|
+
others = _objectWithoutPropertiesLoose(props, _excluded2);
|
87
|
+
|
88
|
+
return /*#__PURE__*/React.createElement(ContextLayout, null, function (context) {
|
89
|
+
return /*#__PURE__*/React.createElement(ContextProvider, _extends({}, context, propsContext), /*#__PURE__*/React.createElement(Component, others));
|
90
|
+
});
|
91
|
+
};
|
92
|
+
}
|
package/esm/dialog/index.d.ts
CHANGED
@@ -137,7 +137,7 @@ export declare function methodsGenerator<P extends OpenBaseProps, A = AlertOptio
|
|
137
137
|
* @param {AlertOptions & DialogProps} config Configuration
|
138
138
|
* @returns {{ close: () => void; update: (newConfig: AlertOptions & DialogProps) => void; }}
|
139
139
|
*/
|
140
|
-
alert: (config: A) => {
|
140
|
+
alert: (config: A, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
141
141
|
close: () => void;
|
142
142
|
update: (newConfig: A) => void;
|
143
143
|
};
|
@@ -147,7 +147,7 @@ export declare function methodsGenerator<P extends OpenBaseProps, A = AlertOptio
|
|
147
147
|
* @param {ConfirmOptions & AlertOptions} config Configuration
|
148
148
|
* @returns {{ close: () => void; update: (newConfig: ConfirmOptions & AlertOptions) => void; }}
|
149
149
|
*/
|
150
|
-
confirm: (config: C) => {
|
150
|
+
confirm: (config: C, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
151
151
|
close: () => void;
|
152
152
|
update: (newConfig: C) => void;
|
153
153
|
};
|
@@ -159,7 +159,7 @@ export declare function methodsGenerator<P extends OpenBaseProps, A = AlertOptio
|
|
159
159
|
*/
|
160
160
|
open: (config: Pick<P, Exclude<keyof P, "visible" | "close">> & {
|
161
161
|
key?: string | undefined;
|
162
|
-
}) => {
|
162
|
+
}, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
163
163
|
close: () => void;
|
164
164
|
update: (newConfig: Pick<P, Exclude<keyof P, "visible" | "close">> & {
|
165
165
|
key?: string | undefined;
|
@@ -173,7 +173,7 @@ declare const _default: React.ForwardRefExoticComponent<DialogProps & React.RefA
|
|
173
173
|
* @param {AlertOptions & DialogProps} config Configuration
|
174
174
|
* @returns {{ close: () => void; update: (newConfig: AlertOptions & DialogProps) => void; }}
|
175
175
|
*/
|
176
|
-
alert: (config: AlertOptions) => {
|
176
|
+
alert: (config: AlertOptions, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
177
177
|
close: () => void;
|
178
178
|
update: (newConfig: AlertOptions) => void;
|
179
179
|
};
|
@@ -183,7 +183,7 @@ declare const _default: React.ForwardRefExoticComponent<DialogProps & React.RefA
|
|
183
183
|
* @param {ConfirmOptions & AlertOptions} config Configuration
|
184
184
|
* @returns {{ close: () => void; update: (newConfig: ConfirmOptions & AlertOptions) => void; }}
|
185
185
|
*/
|
186
|
-
confirm: (config: ConfirmOptions) => {
|
186
|
+
confirm: (config: ConfirmOptions, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
187
187
|
close: () => void;
|
188
188
|
update: (newConfig: ConfirmOptions) => void;
|
189
189
|
};
|
@@ -193,11 +193,11 @@ declare const _default: React.ForwardRefExoticComponent<DialogProps & React.RefA
|
|
193
193
|
* @param {DialogProps} config Configuration
|
194
194
|
* @returns {{ close: () => void; update: (newConfig: DialogProps) => void; }}
|
195
195
|
*/
|
196
|
-
open: (config: Pick<DialogProps & React.RefAttributes<DialogRef
|
196
|
+
open: (config: Pick<import("../context-provider").WithGlobalContext<DialogProps & React.RefAttributes<DialogRef>>, "platform" | "footer" | "title" | "ref" | "children" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer" | "footerType" | "renderFooter" | "footerCollapseCount" | "titleAlign" | "contentAlign" | "extra"> & {
|
197
197
|
key?: string | undefined;
|
198
|
-
}) => {
|
198
|
+
}, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
199
199
|
close: () => void;
|
200
|
-
update: (newConfig: Pick<DialogProps & React.RefAttributes<DialogRef
|
200
|
+
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<DialogProps & React.RefAttributes<DialogRef>>, "platform" | "footer" | "title" | "ref" | "children" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer" | "footerType" | "renderFooter" | "footerCollapseCount" | "titleAlign" | "contentAlign" | "extra"> & {
|
201
201
|
key?: string | undefined;
|
202
202
|
}) => void;
|
203
203
|
};
|
package/esm/dialog/index.js
CHANGED
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutP
|
|
3
3
|
var _excluded = ["close", "children", "title", "footer", "footerType", "renderFooter", "footerCollapseCount", "titleAlign", "contentAlign", "className", "maskClass", "contentClass", "contentStyle", "contentTransitionType", "maskTransitionTimeout", "contentTransitionTimeout", "extra"];
|
4
4
|
import React, { forwardRef, useImperativeHandle, useRef } from 'react';
|
5
5
|
import { cls, componentWrapper } from '@arco-design/mobile-utils';
|
6
|
-
import { ContextLayout } from '../context-provider';
|
6
|
+
import { ContextLayout, CompWithGlobalContext } from '../context-provider';
|
7
7
|
import Masking from '../masking';
|
8
8
|
import { alert, confirm, open } from './methods';
|
9
9
|
import { useSystem } from '../_helpers';
|
@@ -143,6 +143,7 @@ export function methodsGenerator(Comp) {
|
|
143
143
|
open: open(Comp)
|
144
144
|
};
|
145
145
|
}
|
146
|
+
var DialogWithGlobalContext = CompWithGlobalContext(Dialog);
|
146
147
|
/**
|
147
148
|
* 模态对话框,在浮层中显示,引导用户进行相关操作。默认做了防滚动穿透处理,如果弹层内容中需要滚动,则需将滚动容器传入`getScrollContainer`属性以在未滚动到顶部或底部时释放滚动。
|
148
149
|
* @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.
|
@@ -152,4 +153,4 @@ export function methodsGenerator(Comp) {
|
|
152
153
|
* @name_en Dialog
|
153
154
|
*/
|
154
155
|
|
155
|
-
export default componentWrapper(Dialog, methodsGenerator(
|
156
|
+
export default componentWrapper(Dialog, methodsGenerator(DialogWithGlobalContext));
|
package/esm/dialog/methods.d.ts
CHANGED
@@ -2,17 +2,17 @@ import React from 'react';
|
|
2
2
|
import { OpenBaseProps } from '../masking/methods';
|
3
3
|
export declare function normalizeAlert<AlertOptions, P>(config: AlertOptions): P;
|
4
4
|
export declare function normalizeConfirm<ConfirmOptions, P>(config: ConfirmOptions): P;
|
5
|
-
export declare function alert<AlertOptions, P extends OpenBaseProps>(Component: React.FunctionComponent<P>, normalize?: <T, Props>(config: T) => Props): (config: AlertOptions) => {
|
5
|
+
export declare function alert<AlertOptions, P extends OpenBaseProps>(Component: React.FunctionComponent<P>, normalize?: <T, Props>(config: T) => Props): (config: AlertOptions, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
6
6
|
close: () => void;
|
7
7
|
update: (newConfig: AlertOptions) => void;
|
8
8
|
};
|
9
|
-
export declare function confirm<ConfirmOptions, P extends OpenBaseProps>(Component: React.FunctionComponent<P>, normalize?: <T, Props>(config: T) => Props): (config: ConfirmOptions) => {
|
9
|
+
export declare function confirm<ConfirmOptions, P extends OpenBaseProps>(Component: React.FunctionComponent<P>, normalize?: <T, Props>(config: T) => Props): (config: ConfirmOptions, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
10
10
|
close: () => void;
|
11
11
|
update: (newConfig: ConfirmOptions) => void;
|
12
12
|
};
|
13
13
|
export declare function open<P extends OpenBaseProps>(Component: React.FunctionComponent<P>): (config: Pick<P, Exclude<keyof P, "visible" | "close">> & {
|
14
14
|
key?: string | undefined;
|
15
|
-
}) => {
|
15
|
+
}, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
16
16
|
close: () => void;
|
17
17
|
update: (newConfig: Pick<P, Exclude<keyof P, "visible" | "close">> & {
|
18
18
|
key?: string | undefined;
|
@@ -252,7 +252,7 @@ export declare function methodsGenerator<P extends ImagePreviewProps>(Comp: Reac
|
|
252
252
|
* @param {ImagePreviewProps} config configuration
|
253
253
|
* @returns {{ close: () => void; update: (newConfig: ImagePreviewProps) => void; }}
|
254
254
|
*/
|
255
|
-
open: (config: Pick<P, Exclude<keyof P, "close"
|
255
|
+
open: (config: Pick<P, Exclude<keyof P, "close">>, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
256
256
|
close: () => void;
|
257
257
|
update: (newConfig: Pick<P, Exclude<keyof P, "close">>) => void;
|
258
258
|
};
|
@@ -264,9 +264,9 @@ declare const _default: React.ForwardRefExoticComponent<ImagePreviewProps & Reac
|
|
264
264
|
* @param {ImagePreviewProps} config configuration
|
265
265
|
* @returns {{ close: () => void; update: (newConfig: ImagePreviewProps) => void; }}
|
266
266
|
*/
|
267
|
-
open: (config: Pick<ImagePreviewProps & React.RefAttributes<ImagePreviewRef
|
267
|
+
open: (config: Pick<import("../context-provider").WithGlobalContext<ImagePreviewProps & React.RefAttributes<ImagePreviewRef>>, "style" | "ref" | "key" | "context" | "getContainer" | "className" | "onClose" | "onTouchMove" | "fit" | "loadingArea" | "errorArea" | "showLoading" | "showError" | "retryTime" | "staticLabel" | "onChange" | "onTouchEnd" | "onTouchStart" | "animateDurationSlide" | "loop" | "swipeable" | "renderIndicator" | "indicatorPos" | "showIndicator" | "hideSingleIndicator" | "spaceBetween" | "percentToChange" | "distanceToChange" | "speedToChange" | "lazyloadCount" | "onAfterChange" | "images" | "openIndex" | "displayDuration" | "replaceFallbackWhenLoaded" | "noselect" | "scrollBezier" | "swipeToClose" | "getMinScale" | "getMaxScale" | "getDoubleClickScale" | "getThumbBounds" | "onImageClick" | "onImageDoubleClick" | "onImageLongTap">, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
268
268
|
close: () => void;
|
269
|
-
update: (newConfig: Pick<ImagePreviewProps & React.RefAttributes<ImagePreviewRef
|
269
|
+
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<ImagePreviewProps & React.RefAttributes<ImagePreviewRef>>, "style" | "ref" | "key" | "context" | "getContainer" | "className" | "onClose" | "onTouchMove" | "fit" | "loadingArea" | "errorArea" | "showLoading" | "showError" | "retryTime" | "staticLabel" | "onChange" | "onTouchEnd" | "onTouchStart" | "animateDurationSlide" | "loop" | "swipeable" | "renderIndicator" | "indicatorPos" | "showIndicator" | "hideSingleIndicator" | "spaceBetween" | "percentToChange" | "distanceToChange" | "speedToChange" | "lazyloadCount" | "onAfterChange" | "images" | "openIndex" | "displayDuration" | "replaceFallbackWhenLoaded" | "noselect" | "scrollBezier" | "swipeToClose" | "getMinScale" | "getMaxScale" | "getDoubleClickScale" | "getThumbBounds" | "onImageClick" | "onImageDoubleClick" | "onImageLongTap">) => void;
|
270
270
|
};
|
271
271
|
};
|
272
272
|
/**
|
@@ -4,7 +4,7 @@ var _excluded = ["style", "className", "images", "loop", "openIndex", "fit", "no
|
|
4
4
|
import React, { useRef, forwardRef, useImperativeHandle, useEffect, useState } from 'react';
|
5
5
|
import { nextTick, componentWrapper, preventEleScroll, freeEleScroll, cls } from '@arco-design/mobile-utils';
|
6
6
|
import TransformAble from '@arco-design/transformable';
|
7
|
-
import { ContextLayout } from '../context-provider';
|
7
|
+
import { ContextLayout, CompWithGlobalContext } from '../context-provider';
|
8
8
|
import Carousel from '../carousel';
|
9
9
|
import Transition from '../transition';
|
10
10
|
import BaseImage from '../image';
|
@@ -980,6 +980,7 @@ export function methodsGenerator(Comp) {
|
|
980
980
|
open: open(Comp)
|
981
981
|
};
|
982
982
|
}
|
983
|
+
var ImagePreviewWithGlobalContext = CompWithGlobalContext(ImagePreview);
|
983
984
|
/**
|
984
985
|
* 图片预览组件,支持循环轮播、双指/双击缩放、缩略图放大效果。
|
985
986
|
* @en The image preview, supports circular rotation, two-finger/double-tap zoom, and thumbnail zoom effects.
|
@@ -989,4 +990,4 @@ export function methodsGenerator(Comp) {
|
|
989
990
|
* @name_en ImagePreview
|
990
991
|
*/
|
991
992
|
|
992
|
-
export default componentWrapper(ImagePreview, methodsGenerator(
|
993
|
+
export default componentWrapper(ImagePreview, methodsGenerator(ImagePreviewWithGlobalContext));
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import { GlobalContextParams } from '../context-provider';
|
2
3
|
export interface OpenBaseProps {
|
3
4
|
onClose?: () => void;
|
4
5
|
close: (e: any) => void;
|
5
6
|
openIndex: number;
|
6
7
|
images: any[];
|
7
8
|
}
|
8
|
-
export declare function open<P extends OpenBaseProps>(Component: React.FunctionComponent<P>): (config: Pick<P, Exclude<keyof P, "close"
|
9
|
+
export declare function open<P extends OpenBaseProps>(Component: React.FunctionComponent<P>): (config: Pick<P, Exclude<keyof P, "close">>, context?: GlobalContextParams | undefined) => {
|
9
10
|
close: () => void;
|
10
11
|
update: (newConfig: Pick<P, Exclude<keyof P, "close">>) => void;
|
11
12
|
};
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import { appendElementById, removeElement } from '@arco-design/mobile-utils';
|
3
3
|
import { ReactDOMRender } from '../_helpers/render';
|
4
4
|
export function open(Component) {
|
5
|
-
return function (config) {
|
5
|
+
return function (config, context) {
|
6
6
|
var baseProps = _extends({
|
7
7
|
unmountOnExit: true
|
8
8
|
}, config || {}, {
|
@@ -20,7 +20,7 @@ export function open(Component) {
|
|
20
20
|
|
21
21
|
var leaving = false;
|
22
22
|
|
23
|
-
var _ReactDOMRender = new ReactDOMRender(Component, div),
|
23
|
+
var _ReactDOMRender = new ReactDOMRender(Component, div, context),
|
24
24
|
render = _ReactDOMRender.render;
|
25
25
|
|
26
26
|
function update(newConfig) {
|
package/esm/input/hooks.js
CHANGED
@@ -200,6 +200,7 @@ export function useInputLogic(props, inputRef) {
|
|
200
200
|
|
201
201
|
function renderWrapper(prefixCls, type, children) {
|
202
202
|
return /*#__PURE__*/React.createElement("div", {
|
203
|
+
role: "search",
|
203
204
|
className: prefixCls + "-container all-border-box " + (className || ''),
|
204
205
|
style: style,
|
205
206
|
ref: wrapRef
|
package/esm/input/index.d.ts
CHANGED
@@ -27,6 +27,11 @@ export interface InputProps extends BasicInputProps {
|
|
27
27
|
* @en Other unlisted native properties have lower priority than listed component properties
|
28
28
|
*/
|
29
29
|
nativeProps?: React.InputHTMLAttributes<HTMLInputElement>;
|
30
|
+
/**
|
31
|
+
* 无障碍label
|
32
|
+
* @en accessible label
|
33
|
+
*/
|
34
|
+
ariaLabel?: string;
|
30
35
|
}
|
31
36
|
export interface InputRef {
|
32
37
|
/**
|
package/esm/input/index.js
CHANGED
@@ -27,7 +27,9 @@ var Input = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
27
27
|
inputClass = props.inputClass,
|
28
28
|
inputStyle = props.inputStyle,
|
29
29
|
_props$nativeProps = props.nativeProps,
|
30
|
-
nativeProps = _props$nativeProps === void 0 ? {} : _props$nativeProps
|
30
|
+
nativeProps = _props$nativeProps === void 0 ? {} : _props$nativeProps,
|
31
|
+
_props$ariaLabel = props.ariaLabel,
|
32
|
+
ariaLabel = _props$ariaLabel === void 0 ? '' : _props$ariaLabel;
|
31
33
|
var inputRef = useRef(null);
|
32
34
|
|
33
35
|
var _useInputLogic = useInputLogic(props, inputRef),
|
@@ -71,7 +73,9 @@ var Input = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
71
73
|
onChange: handleChange,
|
72
74
|
onInput: handleInput,
|
73
75
|
onKeyDown: handleKeyDown,
|
74
|
-
onClick: handleClick
|
76
|
+
onClick: handleClick,
|
77
|
+
"aria-disabled": disabled,
|
78
|
+
"aria-label": ariaLabel
|
75
79
|
})));
|
76
80
|
}
|
77
81
|
|
package/esm/masking/index.d.ts
CHANGED
@@ -191,12 +191,7 @@ export declare function methodsGenerator<P extends OpenBaseProps>(Comp: React.Fu
|
|
191
191
|
*/
|
192
192
|
open: (config: Pick<P, Exclude<keyof P, "visible" | "close">> & {
|
193
193
|
key?: string | undefined;
|
194
|
-
}) => {
|
195
|
-
/**
|
196
|
-
* 点击蒙层是否关闭菜单
|
197
|
-
* @en Whether to click the mask to close the menu
|
198
|
-
* @default true
|
199
|
-
*/
|
194
|
+
}, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
200
195
|
close: () => void;
|
201
196
|
update: (newConfig: Pick<P, Exclude<keyof P, "visible" | "close">> & {
|
202
197
|
key?: string | undefined;
|
@@ -210,16 +205,11 @@ declare const _default: React.ForwardRefExoticComponent<MaskingProps & React.Ref
|
|
210
205
|
* @param {MaskingProps} config Configuration
|
211
206
|
* @returns {{ close: () => void; update: (newConfig: MaskingProps) => void; }}
|
212
207
|
*/
|
213
|
-
open: (config: Pick<MaskingProps & React.RefAttributes<MaskingRef
|
208
|
+
open: (config: Pick<import("../context-provider").WithGlobalContext<MaskingProps & React.RefAttributes<MaskingRef>>, "ref" | "children" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "contentAtCenter" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer"> & {
|
214
209
|
key?: string | undefined;
|
215
|
-
}) => {
|
216
|
-
/**
|
217
|
-
* 点击蒙层是否关闭菜单
|
218
|
-
* @en Whether to click the mask to close the menu
|
219
|
-
* @default true
|
220
|
-
*/
|
210
|
+
}, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
221
211
|
close: () => void;
|
222
|
-
update: (newConfig: Pick<MaskingProps & React.RefAttributes<MaskingRef
|
212
|
+
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<MaskingProps & React.RefAttributes<MaskingRef>>, "ref" | "children" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "contentAtCenter" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer"> & {
|
223
213
|
key?: string | undefined;
|
224
214
|
}) => void;
|
225
215
|
};
|
package/esm/masking/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { useRef, forwardRef, useImperativeHandle, useEffect, useState } from 'react';
|
2
2
|
import { cls, nextTick, componentWrapper } from '@arco-design/mobile-utils';
|
3
|
-
import { ContextLayout } from '../context-provider';
|
3
|
+
import { ContextLayout, CompWithGlobalContext } from '../context-provider';
|
4
4
|
import Portal from '../portal';
|
5
5
|
import Transition from '../transition';
|
6
6
|
import { usePopupScroll, usePreventBodyScroll } from '../_helpers';
|
@@ -190,6 +190,7 @@ export function methodsGenerator(Comp) {
|
|
190
190
|
open: open(Comp)
|
191
191
|
};
|
192
192
|
}
|
193
|
+
var MaskingWithGlobalContext = CompWithGlobalContext(Masking);
|
193
194
|
/**
|
194
195
|
* 通用模态弹窗,内部内容自定义。默认做了防滚动穿透处理,如果弹层内容中需要滚动,则需将滚动容器传入`getScrollContainer`属性以在未滚动到顶部或底部时释放滚动。
|
195
196
|
* @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.
|
@@ -199,4 +200,4 @@ export function methodsGenerator(Comp) {
|
|
199
200
|
* @name_en Masking
|
200
201
|
*/
|
201
202
|
|
202
|
-
export default componentWrapper(Masking, methodsGenerator(
|
203
|
+
export default componentWrapper(Masking, methodsGenerator(MaskingWithGlobalContext));
|
package/esm/masking/methods.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import { GlobalContextParams } from '../context-provider';
|
2
3
|
export interface OpenBaseProps {
|
3
4
|
unmountOnExit?: boolean;
|
4
5
|
getContainer?: () => HTMLElement;
|
@@ -8,13 +9,13 @@ export interface OpenBaseProps {
|
|
8
9
|
}
|
9
10
|
export declare function getOpenMethod<T extends {
|
10
11
|
key?: string;
|
11
|
-
}, P extends OpenBaseProps>(Component: React.FunctionComponent<P>, containerId?: string, normalize?: (config: T) => P): (config: T) => {
|
12
|
+
}, P extends OpenBaseProps>(Component: React.FunctionComponent<P>, containerId?: string, normalize?: (config: T) => P): (config: T, context?: GlobalContextParams | undefined) => {
|
12
13
|
close: () => void;
|
13
14
|
update: (newConfig: T) => void;
|
14
15
|
};
|
15
16
|
export declare function open<P extends OpenBaseProps>(Component: React.FunctionComponent<P>, containerId?: string): (config: Pick<P, Exclude<keyof P, "visible" | "close">> & {
|
16
17
|
key?: string | undefined;
|
17
|
-
}) => {
|
18
|
+
}, context?: GlobalContextParams | undefined) => {
|
18
19
|
close: () => void;
|
19
20
|
update: (newConfig: Pick<P, Exclude<keyof P, "visible" | "close">> & {
|
20
21
|
key?: string | undefined;
|
package/esm/masking/methods.js
CHANGED
@@ -8,7 +8,7 @@ export function getOpenMethod(Component, containerId, normalize) {
|
|
8
8
|
};
|
9
9
|
}
|
10
10
|
|
11
|
-
return function (config) {
|
11
|
+
return function (config, context) {
|
12
12
|
var baseProps = _extends({
|
13
13
|
unmountOnExit: true
|
14
14
|
}, normalize(config), {
|
@@ -26,7 +26,7 @@ export function getOpenMethod(Component, containerId, normalize) {
|
|
26
26
|
|
27
27
|
var leaving = false;
|
28
28
|
|
29
|
-
var _ReactDOMRender = new ReactDOMRender(Component, div),
|
29
|
+
var _ReactDOMRender = new ReactDOMRender(Component, div, context),
|
30
30
|
render = _ReactDOMRender.render;
|
31
31
|
|
32
32
|
function update(newConfig) {
|
package/esm/nav-bar/index.d.ts
CHANGED
@@ -105,6 +105,18 @@ export interface NavBarProps {
|
|
105
105
|
* @en Set a custom style according to the scroll offset value. After setting this property, the scroll event of the scroll container will be monitored.
|
106
106
|
*/
|
107
107
|
getComputedStyleByScroll?: (offset: number) => CSSProperties;
|
108
|
+
/**
|
109
|
+
* 无障碍aria-label属性
|
110
|
+
* @en Accessibility attribute aria-label
|
111
|
+
* @default ""
|
112
|
+
*/
|
113
|
+
ariaLabel?: string;
|
114
|
+
/**
|
115
|
+
* 无障碍role属性
|
116
|
+
* @en Accessibility attribute role
|
117
|
+
* @default "banner"
|
118
|
+
*/
|
119
|
+
ariaRole?: string;
|
108
120
|
}
|
109
121
|
/**
|
110
122
|
* 导航栏组件,支持吸顶和沉浸式,支持在指定滚动位置展示,支持根据滚动位置实时更新style。
|
package/esm/nav-bar/index.js
CHANGED
@@ -39,7 +39,11 @@ var NavBar = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
39
39
|
getScrollContainer = props.getScrollContainer,
|
40
40
|
_props$showOffset = props.showOffset,
|
41
41
|
showOffset = _props$showOffset === void 0 ? 0 : _props$showOffset,
|
42
|
-
getComputedStyleByScroll = props.getComputedStyleByScroll
|
42
|
+
getComputedStyleByScroll = props.getComputedStyleByScroll,
|
43
|
+
_props$ariaLabel = props.ariaLabel,
|
44
|
+
ariaLabel = _props$ariaLabel === void 0 ? '' : _props$ariaLabel,
|
45
|
+
_props$ariaRole = props.ariaRole,
|
46
|
+
ariaRole = _props$ariaRole === void 0 ? 'banner' : _props$ariaRole;
|
43
47
|
var navBarRef = useRef(null);
|
44
48
|
|
45
49
|
var _useState = useState(showOffset > 0),
|
@@ -127,7 +131,9 @@ var NavBar = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
127
131
|
paddingTop: fixed && statusBarHeight ? statusBarHeight + "px" : ''
|
128
132
|
}, style || {}, relBackground ? {
|
129
133
|
background: relBackground
|
130
|
-
} : {})
|
134
|
+
} : {}),
|
135
|
+
"aria-label": ariaLabel,
|
136
|
+
role: ariaRole
|
131
137
|
}, /*#__PURE__*/React.createElement("div", {
|
132
138
|
className: cls(className, system, prefixCls + "-nav-bar-wrapper", (_cls2 = {}, _cls2[prefixCls + "-nav-bar-wrapper-fixed"] = fixed, _cls2[prefixCls + "-nav-bar-wrapper-border"] = hasBottomLine, _cls2)),
|
133
139
|
style: _extends({
|
package/esm/notify/index.d.ts
CHANGED
@@ -9,7 +9,7 @@ export declare function methodsGenerator<P extends NotifyBaseProps>(Comp: React.
|
|
9
9
|
* @param {string | NotifyProps} config
|
10
10
|
* @returns {{ update: (config: NotifyProps) => void; close: () => void }}
|
11
11
|
*/
|
12
|
-
info: (originConfig: string | Pick<P, Exclude<keyof P, "visible" | "close"
|
12
|
+
info: (originConfig: string | Pick<P, Exclude<keyof P, "visible" | "close">>, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
13
13
|
update: (newConfig: Pick<P, Exclude<keyof P, "visible" | "close">>) => void;
|
14
14
|
close: () => void;
|
15
15
|
};
|
@@ -19,7 +19,7 @@ export declare function methodsGenerator<P extends NotifyBaseProps>(Comp: React.
|
|
19
19
|
* @param {string | NotifyProps} config
|
20
20
|
* @returns {{ update: (config: NotifyProps) => void; close: () => void }}
|
21
21
|
*/
|
22
|
-
success: (originConfig: string | Pick<P, Exclude<keyof P, "visible" | "close"
|
22
|
+
success: (originConfig: string | Pick<P, Exclude<keyof P, "visible" | "close">>, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
23
23
|
update: (newConfig: Pick<P, Exclude<keyof P, "visible" | "close">>) => void;
|
24
24
|
close: () => void;
|
25
25
|
};
|
@@ -29,7 +29,7 @@ export declare function methodsGenerator<P extends NotifyBaseProps>(Comp: React.
|
|
29
29
|
* @param {string | NotifyProps} config
|
30
30
|
* @returns {{ update: (config: NotifyProps) => void; close: () => void }}
|
31
31
|
*/
|
32
|
-
error: (originConfig: string | Pick<P, Exclude<keyof P, "visible" | "close"
|
32
|
+
error: (originConfig: string | Pick<P, Exclude<keyof P, "visible" | "close">>, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
33
33
|
update: (newConfig: Pick<P, Exclude<keyof P, "visible" | "close">>) => void;
|
34
34
|
close: () => void;
|
35
35
|
};
|
@@ -39,7 +39,7 @@ export declare function methodsGenerator<P extends NotifyBaseProps>(Comp: React.
|
|
39
39
|
* @param {string | NotifyProps} config
|
40
40
|
* @returns {{ update: (config: NotifyProps) => void; close: () => void }}
|
41
41
|
*/
|
42
|
-
warn: (originConfig: string | Pick<P, Exclude<keyof P, "visible" | "close"
|
42
|
+
warn: (originConfig: string | Pick<P, Exclude<keyof P, "visible" | "close">>, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
43
43
|
update: (newConfig: Pick<P, Exclude<keyof P, "visible" | "close">>) => void;
|
44
44
|
close: () => void;
|
45
45
|
};
|
@@ -51,8 +51,8 @@ declare const _default: React.ForwardRefExoticComponent<NotifyProps & React.RefA
|
|
51
51
|
* @param {string | NotifyProps} config
|
52
52
|
* @returns {{ update: (config: NotifyProps) => void; close: () => void }}
|
53
53
|
*/
|
54
|
-
info: (originConfig: string | Pick<NotifyProps & React.RefAttributes<NotifyRef
|
55
|
-
update: (newConfig: Pick<NotifyProps & React.RefAttributes<NotifyRef
|
54
|
+
info: (originConfig: string | Pick<import("../context-provider").WithGlobalContext<NotifyProps & React.RefAttributes<NotifyRef>>, "style" | "content" | "transitionDuration" | "ref" | "key" | "context" | "getContainer" | "type" | "className" | "duration" | "onClose">, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
55
|
+
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<NotifyProps & React.RefAttributes<NotifyRef>>, "style" | "content" | "transitionDuration" | "ref" | "key" | "context" | "getContainer" | "type" | "className" | "duration" | "onClose">) => void;
|
56
56
|
close: () => void;
|
57
57
|
};
|
58
58
|
/**
|
@@ -61,8 +61,8 @@ declare const _default: React.ForwardRefExoticComponent<NotifyProps & React.RefA
|
|
61
61
|
* @param {string | NotifyProps} config
|
62
62
|
* @returns {{ update: (config: NotifyProps) => void; close: () => void }}
|
63
63
|
*/
|
64
|
-
success: (originConfig: string | Pick<NotifyProps & React.RefAttributes<NotifyRef
|
65
|
-
update: (newConfig: Pick<NotifyProps & React.RefAttributes<NotifyRef
|
64
|
+
success: (originConfig: string | Pick<import("../context-provider").WithGlobalContext<NotifyProps & React.RefAttributes<NotifyRef>>, "style" | "content" | "transitionDuration" | "ref" | "key" | "context" | "getContainer" | "type" | "className" | "duration" | "onClose">, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
65
|
+
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<NotifyProps & React.RefAttributes<NotifyRef>>, "style" | "content" | "transitionDuration" | "ref" | "key" | "context" | "getContainer" | "type" | "className" | "duration" | "onClose">) => void;
|
66
66
|
close: () => void;
|
67
67
|
};
|
68
68
|
/**
|
@@ -71,8 +71,8 @@ declare const _default: React.ForwardRefExoticComponent<NotifyProps & React.RefA
|
|
71
71
|
* @param {string | NotifyProps} config
|
72
72
|
* @returns {{ update: (config: NotifyProps) => void; close: () => void }}
|
73
73
|
*/
|
74
|
-
error: (originConfig: string | Pick<NotifyProps & React.RefAttributes<NotifyRef
|
75
|
-
update: (newConfig: Pick<NotifyProps & React.RefAttributes<NotifyRef
|
74
|
+
error: (originConfig: string | Pick<import("../context-provider").WithGlobalContext<NotifyProps & React.RefAttributes<NotifyRef>>, "style" | "content" | "transitionDuration" | "ref" | "key" | "context" | "getContainer" | "type" | "className" | "duration" | "onClose">, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
75
|
+
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<NotifyProps & React.RefAttributes<NotifyRef>>, "style" | "content" | "transitionDuration" | "ref" | "key" | "context" | "getContainer" | "type" | "className" | "duration" | "onClose">) => void;
|
76
76
|
close: () => void;
|
77
77
|
};
|
78
78
|
/**
|
@@ -81,8 +81,8 @@ declare const _default: React.ForwardRefExoticComponent<NotifyProps & React.RefA
|
|
81
81
|
* @param {string | NotifyProps} config
|
82
82
|
* @returns {{ update: (config: NotifyProps) => void; close: () => void }}
|
83
83
|
*/
|
84
|
-
warn: (originConfig: string | Pick<NotifyProps & React.RefAttributes<NotifyRef
|
85
|
-
update: (newConfig: Pick<NotifyProps & React.RefAttributes<NotifyRef
|
84
|
+
warn: (originConfig: string | Pick<import("../context-provider").WithGlobalContext<NotifyProps & React.RefAttributes<NotifyRef>>, "style" | "content" | "transitionDuration" | "ref" | "key" | "context" | "getContainer" | "type" | "className" | "duration" | "onClose">, context?: import("../context-provider").GlobalContextParams | undefined) => {
|
85
|
+
update: (newConfig: Pick<import("../context-provider").WithGlobalContext<NotifyProps & React.RefAttributes<NotifyRef>>, "style" | "content" | "transitionDuration" | "ref" | "key" | "context" | "getContainer" | "type" | "className" | "duration" | "onClose">) => void;
|
86
86
|
close: () => void;
|
87
87
|
};
|
88
88
|
};
|
package/esm/notify/index.js
CHANGED
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useRef, forwardRef, useImperativeHandle, useEffect, useState } from 'react';
|
3
3
|
import ReactDOM from 'react-dom';
|
4
4
|
import { componentWrapper, nextTick } from '@arco-design/mobile-utils';
|
5
|
-
import { ContextLayout } from '../context-provider';
|
5
|
+
import { ContextLayout, CompWithGlobalContext } from '../context-provider';
|
6
6
|
import { getStyleWithVendor, useUpdateEffect } from '../_helpers';
|
7
7
|
import { notify } from './methods';
|
8
8
|
export * from './type';
|
@@ -145,6 +145,7 @@ export function methodsGenerator(Comp) {
|
|
145
145
|
warn: notify(Comp, 'warn')
|
146
146
|
};
|
147
147
|
}
|
148
|
+
var NotifyWithGlobalContext = CompWithGlobalContext(Notify);
|
148
149
|
/**
|
149
150
|
* 主动操作后显示的反馈信息横条,可采用方法调用或者组件调用的方式
|
150
151
|
* @en The feedback information bar displayed after active operation can be called by method or by component.
|
@@ -154,4 +155,4 @@ export function methodsGenerator(Comp) {
|
|
154
155
|
* @name_en Notify
|
155
156
|
*/
|
156
157
|
|
157
|
-
export default componentWrapper(Notify, methodsGenerator(
|
158
|
+
export default componentWrapper(Notify, methodsGenerator(NotifyWithGlobalContext));
|
package/esm/notify/methods.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import { GlobalContextParams } from '../context-provider';
|
2
3
|
export interface NotifyBaseProps {
|
3
4
|
getContainer?: () => HTMLElement;
|
4
5
|
onClose?: (scene?: string) => void;
|
@@ -7,7 +8,7 @@ export interface NotifyBaseProps {
|
|
7
8
|
close?: (e: any) => void;
|
8
9
|
type?: string;
|
9
10
|
}
|
10
|
-
export declare function notify<P extends NotifyBaseProps>(Component: React.FC<P>, type?: string): (originConfig: string | Pick<P, Exclude<keyof P, "visible" | "close"
|
11
|
+
export declare function notify<P extends NotifyBaseProps>(Component: React.FC<P>, type?: string): (originConfig: string | Pick<P, Exclude<keyof P, "visible" | "close">>, context?: GlobalContextParams | undefined) => {
|
11
12
|
update: (newConfig: Pick<P, Exclude<keyof P, "visible" | "close">>) => void;
|
12
13
|
close: () => void;
|
13
14
|
};
|