@apdesign/web-react 1.1.2 → 1.2.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/dist/arco-icon.min.js +1 -1
- package/dist/arco.development.js +112 -4
- package/dist/arco.min.js +3 -3
- package/es/DatePicker/util.d.ts +1 -1
- package/es/Menu/context.d.ts +1 -1
- package/es/Modal/interface.d.ts +13 -1
- package/es/Modal/modal.js +19 -11
- package/es/Typography/base.d.ts +1 -1
- package/es/_class/VirtualList/index.js +17 -15
- package/es/_util/constant.d.ts +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/lib/Modal/interface.d.ts +13 -1
- package/lib/Modal/modal.js +19 -11
- package/lib/_class/VirtualList/index.js +14 -14
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/package.json +2 -1
package/es/DatePicker/util.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dayjs } from 'dayjs';
|
|
2
2
|
export declare function isTimeArrayChange(prevTime: Dayjs[], nextTime: Dayjs[]): boolean;
|
|
3
|
-
export declare function getAvailableDayjsLength(value: any):
|
|
3
|
+
export declare function getAvailableDayjsLength(value: any): 0 | 1 | 2;
|
|
4
4
|
export declare function isDisabledDate(cellDate: any, disabledDate: any, mode: any): boolean;
|
|
5
5
|
declare type WeekStartType = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
6
6
|
export declare function getDefaultWeekStart(dayjsLocale: string): WeekStartType;
|
package/es/Menu/context.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare type HotkeyInfo = {
|
|
|
6
6
|
type: 'sibling' | 'generation' | 'enter';
|
|
7
7
|
};
|
|
8
8
|
export declare type ResetHotkeyInfo = (activeKey?: string) => void;
|
|
9
|
-
declare const MenuContext: import("react").Context<Pick<MenuProps, "
|
|
9
|
+
declare const MenuContext: import("react").Context<Pick<MenuProps, "collapse" | "mode" | "triggerProps" | "inDropdown" | "theme" | "levelIndent" | "icons" | "autoScrollIntoView" | "selectedKeys" | "openKeys" | "scrollConfig" | "tooltipProps"> & {
|
|
10
10
|
id?: string;
|
|
11
11
|
prefixCls?: string;
|
|
12
12
|
onClickMenuItem?: (key: string, event: any) => void;
|
package/es/Modal/interface.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { DraggableCoreProps } from 'react-draggable';
|
|
2
3
|
import { ButtonProps } from '../Button';
|
|
3
4
|
import { ConfirmProps } from './confirm';
|
|
4
5
|
/**
|
|
@@ -171,6 +172,17 @@ export interface ModalProps {
|
|
|
171
172
|
*/
|
|
172
173
|
modalRender?: (modalNode: ReactNode) => ReactNode;
|
|
173
174
|
prefixCls?: string;
|
|
175
|
+
/**
|
|
176
|
+
* @zh 是否可以拖动弹窗
|
|
177
|
+
* @en Whether the Modal can be dragged
|
|
178
|
+
* @defaultValue true
|
|
179
|
+
*/
|
|
180
|
+
draggable?: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* @zh 拖动弹窗额外参数
|
|
183
|
+
* @en The extra parameters of the Modal
|
|
184
|
+
*/
|
|
185
|
+
draggableProps?: Partial<DraggableCoreProps>;
|
|
174
186
|
}
|
|
175
187
|
export declare type ModalReturnProps = {
|
|
176
188
|
update: Function;
|
package/es/Modal/modal.js
CHANGED
|
@@ -37,6 +37,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
37
37
|
return ar;
|
|
38
38
|
};
|
|
39
39
|
import React, { useState, forwardRef, useContext, useRef, useEffect, useCallback, } from 'react';
|
|
40
|
+
import Draggable from 'react-draggable';
|
|
40
41
|
import FocusLock from 'react-focus-lock';
|
|
41
42
|
import IconClose from '../../icon/react-icon/IconClose';
|
|
42
43
|
import cs from '../_util/classNames';
|
|
@@ -77,13 +78,14 @@ var defaultProps = {
|
|
|
77
78
|
escToExit: true,
|
|
78
79
|
getPopupContainer: function () { return document.body; },
|
|
79
80
|
alignCenter: true,
|
|
81
|
+
draggable: true,
|
|
80
82
|
};
|
|
81
83
|
function Modal(baseProps, ref) {
|
|
82
84
|
var _a, _b;
|
|
83
85
|
var _c;
|
|
84
86
|
var context = useContext(ConfigContext);
|
|
85
87
|
var props = useMergeProps(baseProps, defaultProps, (_c = context.componentConfig) === null || _c === void 0 ? void 0 : _c.Modal);
|
|
86
|
-
var className = props.className, style = props.style, visible = props.visible, simple = props.simple, title = props.title, children = props.children, cancelText = props.cancelText, okText = props.okText, okButtonProps = props.okButtonProps, cancelButtonProps = props.cancelButtonProps, _d = props.getPopupContainer, getPopupContainer = _d === void 0 ? function () { return document.body; } : _d, footer = props.footer, afterClose = props.afterClose, confirmLoading = props.confirmLoading, mountOnEnter = props.mountOnEnter, unmountOnExit = props.unmountOnExit, afterOpen = props.afterOpen, hideCancel = props.hideCancel, autoFocus = props.autoFocus, focusLock = props.focusLock, maskClosable = props.maskClosable, mask = props.mask, alignCenter = props.alignCenter, getChildrenPopupContainer = props.getChildrenPopupContainer, wrapClassName = props.wrapClassName, escToExit = props.escToExit, modalRender = props.modalRender, maskStyle = props.maskStyle, wrapStyle = props.wrapStyle, closeIcon = props.closeIcon, rest = __rest(props, ["className", "style", "visible", "simple", "title", "children", "cancelText", "okText", "okButtonProps", "cancelButtonProps", "getPopupContainer", "footer", "afterClose", "confirmLoading", "mountOnEnter", "unmountOnExit", "afterOpen", "hideCancel", "autoFocus", "focusLock", "maskClosable", "mask", "alignCenter", "getChildrenPopupContainer", "wrapClassName", "escToExit", "modalRender", "maskStyle", "wrapStyle", "closeIcon"]);
|
|
88
|
+
var className = props.className, style = props.style, visible = props.visible, simple = props.simple, title = props.title, children = props.children, cancelText = props.cancelText, okText = props.okText, okButtonProps = props.okButtonProps, cancelButtonProps = props.cancelButtonProps, _d = props.getPopupContainer, getPopupContainer = _d === void 0 ? function () { return document.body; } : _d, footer = props.footer, afterClose = props.afterClose, confirmLoading = props.confirmLoading, mountOnEnter = props.mountOnEnter, unmountOnExit = props.unmountOnExit, afterOpen = props.afterOpen, hideCancel = props.hideCancel, autoFocus = props.autoFocus, focusLock = props.focusLock, maskClosable = props.maskClosable, mask = props.mask, alignCenter = props.alignCenter, getChildrenPopupContainer = props.getChildrenPopupContainer, wrapClassName = props.wrapClassName, escToExit = props.escToExit, modalRender = props.modalRender, maskStyle = props.maskStyle, wrapStyle = props.wrapStyle, closeIcon = props.closeIcon, draggable = props.draggable, draggableProps = props.draggableProps, rest = __rest(props, ["className", "style", "visible", "simple", "title", "children", "cancelText", "okText", "okButtonProps", "cancelButtonProps", "getPopupContainer", "footer", "afterClose", "confirmLoading", "mountOnEnter", "unmountOnExit", "afterOpen", "hideCancel", "autoFocus", "focusLock", "maskClosable", "mask", "alignCenter", "getChildrenPopupContainer", "wrapClassName", "escToExit", "modalRender", "maskStyle", "wrapStyle", "closeIcon", "draggable", "draggableProps"]);
|
|
87
89
|
var modalWrapperRef = useRef(null);
|
|
88
90
|
var contentWrapper = useRef(null);
|
|
89
91
|
var modalRef = useRef(null);
|
|
@@ -200,7 +202,7 @@ function Modal(baseProps, ref) {
|
|
|
200
202
|
? getChildrenPopupContainer(node)
|
|
201
203
|
: contentWrapper.current;
|
|
202
204
|
} }),
|
|
203
|
-
title && (React.createElement("div", { className: prefixCls + "-header" },
|
|
205
|
+
title && (React.createElement("div", { className: prefixCls + "-header", style: { cursor: draggable ? 'move' : null } },
|
|
204
206
|
React.createElement("div", { className: prefixCls + "-title", id: "arco-dialog-" + dialogIndex.current }, title))),
|
|
205
207
|
React.createElement("div", { ref: contentWrapper, className: prefixCls + "-content" }, children),
|
|
206
208
|
renderFooter(),
|
|
@@ -211,10 +213,21 @@ function Modal(baseProps, ref) {
|
|
|
211
213
|
var modalDom = (React.createElement("div", __assign({ role: "dialog", "aria-modal": "true" }, ariaProps, { className: cs(prefixCls, (_a = {},
|
|
212
214
|
_a[prefixCls + "-simple"] = simple,
|
|
213
215
|
_a[prefixCls + "-rtl"] = rtl,
|
|
214
|
-
_a), className), style: style, ref: modalRef }), innerFocusLock ? (React.createElement(FocusLock, { crossFrame: false, disabled: !visible, autoFocus: innerAutoFocus, lockProps: {
|
|
216
|
+
_a), className), style: __assign({ display: draggable ? 'block' : null }, style), ref: modalRef }), innerFocusLock ? (React.createElement(FocusLock, { crossFrame: false, disabled: !visible, autoFocus: innerAutoFocus, lockProps: {
|
|
215
217
|
tabIndex: -1,
|
|
216
218
|
onKeyDown: onEscExit,
|
|
217
219
|
} }, element)) : (React.createElement(React.Fragment, null, element))));
|
|
220
|
+
var modalWithMouseEventsDom = React.cloneElement(modalDom, {
|
|
221
|
+
onMouseDown: function () {
|
|
222
|
+
maskClickRef.current = false;
|
|
223
|
+
},
|
|
224
|
+
onMouseUp: function () {
|
|
225
|
+
maskClickRef.current = false;
|
|
226
|
+
},
|
|
227
|
+
});
|
|
228
|
+
// 包装在Draggable中的modal
|
|
229
|
+
var wrappedModalDom = draggable && title ? (React.createElement(Draggable, __assign({ bounds: "parent", handle: "." + prefixCls + "-header" }, draggableProps),
|
|
230
|
+
React.createElement("div", { style: { top: 0, verticalAlign: 'middle', display: 'inline-block' } }, modalWithMouseEventsDom))) : (modalWithMouseEventsDom);
|
|
218
231
|
var setTransformOrigin = function (e) {
|
|
219
232
|
if (haveOriginTransformOrigin.current)
|
|
220
233
|
return;
|
|
@@ -252,6 +265,8 @@ function Modal(baseProps, ref) {
|
|
|
252
265
|
'onConfirm',
|
|
253
266
|
'closable',
|
|
254
267
|
'prefixCls',
|
|
268
|
+
'draggable',
|
|
269
|
+
'draggableProps',
|
|
255
270
|
]), { tabIndex: !innerFocusLock || !innerAutoFocus ? -1 : null, ref: function (node) {
|
|
256
271
|
modalWrapperRef.current = node;
|
|
257
272
|
initPopupZIndex();
|
|
@@ -292,14 +307,7 @@ function Modal(baseProps, ref) {
|
|
|
292
307
|
if (unmountOnExit) {
|
|
293
308
|
modalRef.current = null;
|
|
294
309
|
}
|
|
295
|
-
} },
|
|
296
|
-
onMouseDown: function () {
|
|
297
|
-
maskClickRef.current = false;
|
|
298
|
-
},
|
|
299
|
-
onMouseUp: function () {
|
|
300
|
-
maskClickRef.current = false;
|
|
301
|
-
},
|
|
302
|
-
})))))) : null;
|
|
310
|
+
} }, isFunction(modalRender) ? modalRender(wrappedModalDom) : wrappedModalDom))))) : null;
|
|
303
311
|
}
|
|
304
312
|
var ExportedModalComponent = forwardRef(Modal);
|
|
305
313
|
ExportedModalComponent.displayName = 'Modal';
|
package/es/Typography/base.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TypographyParagraphProps, TypographyTitleProps } from './interface';
|
|
3
3
|
declare const _default: React.ForwardRefExoticComponent<TypographyParagraphProps & TypographyTitleProps & import("./interface").CommonProps & {
|
|
4
|
-
componentType: "
|
|
4
|
+
componentType: "Paragraph" | "Title" | "Text";
|
|
5
5
|
} & React.RefAttributes<unknown>>;
|
|
6
6
|
export default _default;
|
|
@@ -36,7 +36,9 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
36
36
|
}
|
|
37
37
|
return ar;
|
|
38
38
|
};
|
|
39
|
-
import React, { useEffect, useImperativeHandle, useRef,
|
|
39
|
+
import React, { useEffect, useImperativeHandle, useRef,
|
|
40
|
+
// useMemo,
|
|
41
|
+
useState, } from 'react';
|
|
40
42
|
import { getValidScrollTop, getCompareItemRelativeTop, getItemAbsoluteTop, getItemRelativeTop, getNodeHeight, getRangeIndex, getScrollPercentage, GHOST_ITEM_KEY, getLongestItemIndex, getLocationItem, } from './utils/itemUtil';
|
|
41
43
|
import { raf, caf } from '../../_util/raf';
|
|
42
44
|
import { isNumber } from '../../_util/is';
|
|
@@ -100,7 +102,7 @@ var VirtualList = React.forwardRef(function (props, ref) {
|
|
|
100
102
|
refItemHeightMap.current[KEY_VIRTUAL_ITEM_HEIGHT] ||
|
|
101
103
|
DEFAULT_VIRTUAL_ITEM_HEIGHT;
|
|
102
104
|
var viewportHeight = isNumber(styleListMaxHeight) ? styleListMaxHeight : stateHeight;
|
|
103
|
-
var itemCountVisible = Math.ceil(viewportHeight / itemHeight);
|
|
105
|
+
var itemCountVisible = Math.ceil(viewportHeight / itemHeight) * 2;
|
|
104
106
|
var itemTotalHeight = itemHeight * itemCount;
|
|
105
107
|
var isVirtual = threshold !== null &&
|
|
106
108
|
itemCount >= threshold &&
|
|
@@ -110,18 +112,17 @@ var VirtualList = React.forwardRef(function (props, ref) {
|
|
|
110
112
|
var refLockScroll = useRef(false);
|
|
111
113
|
var refIsVirtual = useRef(isVirtual);
|
|
112
114
|
// The paddingTop of the record scrolling list is used to correct the scrolling distance
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}, [refList.current]);
|
|
115
|
+
// const scrollListPadding = useMemo<{ top: number; bottom: number }>(() => {
|
|
116
|
+
// if (refList.current) {
|
|
117
|
+
// const getPadding = (property) =>
|
|
118
|
+
// +window.getComputedStyle(refList.current)[property].replace(/\D/g, '');
|
|
119
|
+
// return {
|
|
120
|
+
// top: getPadding('paddingTop'),
|
|
121
|
+
// bottom: getPadding('paddingBottom'),
|
|
122
|
+
// };
|
|
123
|
+
// }
|
|
124
|
+
// return { top: 0, bottom: 0 };
|
|
125
|
+
// }, [refList.current]);
|
|
125
126
|
var _l = __read(useStateWithPromise({
|
|
126
127
|
// measure status
|
|
127
128
|
status: 'NONE',
|
|
@@ -320,7 +321,8 @@ var VirtualList = React.forwardRef(function (props, ref) {
|
|
|
320
321
|
var startItemTop = getItemAbsoluteTop({
|
|
321
322
|
scrollPtg: scrollPtg,
|
|
322
323
|
clientHeight: clientHeight,
|
|
323
|
-
scrollTop: scrollTop
|
|
324
|
+
scrollTop: scrollTop,
|
|
325
|
+
// scrollTop: scrollTop - (scrollListPadding.top + scrollListPadding.bottom) * scrollPtg,
|
|
324
326
|
itemHeight: getCachedItemHeight(getItemKeyByIndex(state.itemIndex)),
|
|
325
327
|
itemOffsetPtg: state.itemOffsetPtg,
|
|
326
328
|
});
|
package/es/_util/constant.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const NOOP: () => void;
|
|
2
2
|
export declare function newArray(length: number): any;
|
|
3
|
-
export declare function pickTriggerPropsFromRest(rest: any): Pick<any, "onClick" | "
|
|
3
|
+
export declare function pickTriggerPropsFromRest(rest: any): Pick<any, "onClick" | "tabIndex" | "onFocus" | "onBlur" | "onContextMenu" | "onMouseEnter" | "onMouseLeave" | "onMouseMove">;
|
package/es/index.d.ts
CHANGED
|
@@ -139,4 +139,4 @@ export type { WatermarkProps } from './Watermark/interface';
|
|
|
139
139
|
export { default as Watermark } from './Watermark';
|
|
140
140
|
export type { ImageProps, ImagePreviewProps, ImagePreviewActionProps, ImagePreviewGroupProps } from './Image/interface';
|
|
141
141
|
export { default as Image } from './Image';
|
|
142
|
-
export declare const version = "1.
|
|
142
|
+
export declare const version = "1.2.0";
|
package/es/index.js
CHANGED
package/lib/Modal/interface.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { DraggableCoreProps } from 'react-draggable';
|
|
2
3
|
import { ButtonProps } from '../Button';
|
|
3
4
|
import { ConfirmProps } from './confirm';
|
|
4
5
|
/**
|
|
@@ -171,6 +172,17 @@ export interface ModalProps {
|
|
|
171
172
|
*/
|
|
172
173
|
modalRender?: (modalNode: ReactNode) => ReactNode;
|
|
173
174
|
prefixCls?: string;
|
|
175
|
+
/**
|
|
176
|
+
* @zh 是否可以拖动弹窗
|
|
177
|
+
* @en Whether the Modal can be dragged
|
|
178
|
+
* @defaultValue true
|
|
179
|
+
*/
|
|
180
|
+
draggable?: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* @zh 拖动弹窗额外参数
|
|
183
|
+
* @en The extra parameters of the Modal
|
|
184
|
+
*/
|
|
185
|
+
draggableProps?: Partial<DraggableCoreProps>;
|
|
174
186
|
}
|
|
175
187
|
export declare type ModalReturnProps = {
|
|
176
188
|
update: Function;
|
package/lib/Modal/modal.js
CHANGED
|
@@ -61,6 +61,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
61
61
|
};
|
|
62
62
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
63
63
|
var react_1 = __importStar(require("react"));
|
|
64
|
+
var react_draggable_1 = __importDefault(require("react-draggable"));
|
|
64
65
|
var react_focus_lock_1 = __importDefault(require("react-focus-lock"));
|
|
65
66
|
var IconClose_1 = __importDefault(require("../../icon/react-icon-cjs/IconClose"));
|
|
66
67
|
var classNames_1 = __importDefault(require("../_util/classNames"));
|
|
@@ -101,13 +102,14 @@ var defaultProps = {
|
|
|
101
102
|
escToExit: true,
|
|
102
103
|
getPopupContainer: function () { return document.body; },
|
|
103
104
|
alignCenter: true,
|
|
105
|
+
draggable: true,
|
|
104
106
|
};
|
|
105
107
|
function Modal(baseProps, ref) {
|
|
106
108
|
var _a, _b;
|
|
107
109
|
var _c;
|
|
108
110
|
var context = (0, react_1.useContext)(ConfigProvider_1.ConfigContext);
|
|
109
111
|
var props = (0, useMergeProps_1.default)(baseProps, defaultProps, (_c = context.componentConfig) === null || _c === void 0 ? void 0 : _c.Modal);
|
|
110
|
-
var className = props.className, style = props.style, visible = props.visible, simple = props.simple, title = props.title, children = props.children, cancelText = props.cancelText, okText = props.okText, okButtonProps = props.okButtonProps, cancelButtonProps = props.cancelButtonProps, _d = props.getPopupContainer, getPopupContainer = _d === void 0 ? function () { return document.body; } : _d, footer = props.footer, afterClose = props.afterClose, confirmLoading = props.confirmLoading, mountOnEnter = props.mountOnEnter, unmountOnExit = props.unmountOnExit, afterOpen = props.afterOpen, hideCancel = props.hideCancel, autoFocus = props.autoFocus, focusLock = props.focusLock, maskClosable = props.maskClosable, mask = props.mask, alignCenter = props.alignCenter, getChildrenPopupContainer = props.getChildrenPopupContainer, wrapClassName = props.wrapClassName, escToExit = props.escToExit, modalRender = props.modalRender, maskStyle = props.maskStyle, wrapStyle = props.wrapStyle, closeIcon = props.closeIcon, rest = __rest(props, ["className", "style", "visible", "simple", "title", "children", "cancelText", "okText", "okButtonProps", "cancelButtonProps", "getPopupContainer", "footer", "afterClose", "confirmLoading", "mountOnEnter", "unmountOnExit", "afterOpen", "hideCancel", "autoFocus", "focusLock", "maskClosable", "mask", "alignCenter", "getChildrenPopupContainer", "wrapClassName", "escToExit", "modalRender", "maskStyle", "wrapStyle", "closeIcon"]);
|
|
112
|
+
var className = props.className, style = props.style, visible = props.visible, simple = props.simple, title = props.title, children = props.children, cancelText = props.cancelText, okText = props.okText, okButtonProps = props.okButtonProps, cancelButtonProps = props.cancelButtonProps, _d = props.getPopupContainer, getPopupContainer = _d === void 0 ? function () { return document.body; } : _d, footer = props.footer, afterClose = props.afterClose, confirmLoading = props.confirmLoading, mountOnEnter = props.mountOnEnter, unmountOnExit = props.unmountOnExit, afterOpen = props.afterOpen, hideCancel = props.hideCancel, autoFocus = props.autoFocus, focusLock = props.focusLock, maskClosable = props.maskClosable, mask = props.mask, alignCenter = props.alignCenter, getChildrenPopupContainer = props.getChildrenPopupContainer, wrapClassName = props.wrapClassName, escToExit = props.escToExit, modalRender = props.modalRender, maskStyle = props.maskStyle, wrapStyle = props.wrapStyle, closeIcon = props.closeIcon, draggable = props.draggable, draggableProps = props.draggableProps, rest = __rest(props, ["className", "style", "visible", "simple", "title", "children", "cancelText", "okText", "okButtonProps", "cancelButtonProps", "getPopupContainer", "footer", "afterClose", "confirmLoading", "mountOnEnter", "unmountOnExit", "afterOpen", "hideCancel", "autoFocus", "focusLock", "maskClosable", "mask", "alignCenter", "getChildrenPopupContainer", "wrapClassName", "escToExit", "modalRender", "maskStyle", "wrapStyle", "closeIcon", "draggable", "draggableProps"]);
|
|
111
113
|
var modalWrapperRef = (0, react_1.useRef)(null);
|
|
112
114
|
var contentWrapper = (0, react_1.useRef)(null);
|
|
113
115
|
var modalRef = (0, react_1.useRef)(null);
|
|
@@ -224,7 +226,7 @@ function Modal(baseProps, ref) {
|
|
|
224
226
|
? getChildrenPopupContainer(node)
|
|
225
227
|
: contentWrapper.current;
|
|
226
228
|
} }),
|
|
227
|
-
title && (react_1.default.createElement("div", { className: prefixCls + "-header" },
|
|
229
|
+
title && (react_1.default.createElement("div", { className: prefixCls + "-header", style: { cursor: draggable ? 'move' : null } },
|
|
228
230
|
react_1.default.createElement("div", { className: prefixCls + "-title", id: "arco-dialog-" + dialogIndex.current }, title))),
|
|
229
231
|
react_1.default.createElement("div", { ref: contentWrapper, className: prefixCls + "-content" }, children),
|
|
230
232
|
renderFooter(),
|
|
@@ -235,10 +237,21 @@ function Modal(baseProps, ref) {
|
|
|
235
237
|
var modalDom = (react_1.default.createElement("div", __assign({ role: "dialog", "aria-modal": "true" }, ariaProps, { className: (0, classNames_1.default)(prefixCls, (_a = {},
|
|
236
238
|
_a[prefixCls + "-simple"] = simple,
|
|
237
239
|
_a[prefixCls + "-rtl"] = rtl,
|
|
238
|
-
_a), className), style: style, ref: modalRef }), innerFocusLock ? (react_1.default.createElement(react_focus_lock_1.default, { crossFrame: false, disabled: !visible, autoFocus: innerAutoFocus, lockProps: {
|
|
240
|
+
_a), className), style: __assign({ display: draggable ? 'block' : null }, style), ref: modalRef }), innerFocusLock ? (react_1.default.createElement(react_focus_lock_1.default, { crossFrame: false, disabled: !visible, autoFocus: innerAutoFocus, lockProps: {
|
|
239
241
|
tabIndex: -1,
|
|
240
242
|
onKeyDown: onEscExit,
|
|
241
243
|
} }, element)) : (react_1.default.createElement(react_1.default.Fragment, null, element))));
|
|
244
|
+
var modalWithMouseEventsDom = react_1.default.cloneElement(modalDom, {
|
|
245
|
+
onMouseDown: function () {
|
|
246
|
+
maskClickRef.current = false;
|
|
247
|
+
},
|
|
248
|
+
onMouseUp: function () {
|
|
249
|
+
maskClickRef.current = false;
|
|
250
|
+
},
|
|
251
|
+
});
|
|
252
|
+
// 包装在Draggable中的modal
|
|
253
|
+
var wrappedModalDom = draggable && title ? (react_1.default.createElement(react_draggable_1.default, __assign({ bounds: "parent", handle: "." + prefixCls + "-header" }, draggableProps),
|
|
254
|
+
react_1.default.createElement("div", { style: { top: 0, verticalAlign: 'middle', display: 'inline-block' } }, modalWithMouseEventsDom))) : (modalWithMouseEventsDom);
|
|
242
255
|
var setTransformOrigin = function (e) {
|
|
243
256
|
if (haveOriginTransformOrigin.current)
|
|
244
257
|
return;
|
|
@@ -276,6 +289,8 @@ function Modal(baseProps, ref) {
|
|
|
276
289
|
'onConfirm',
|
|
277
290
|
'closable',
|
|
278
291
|
'prefixCls',
|
|
292
|
+
'draggable',
|
|
293
|
+
'draggableProps',
|
|
279
294
|
]), { tabIndex: !innerFocusLock || !innerAutoFocus ? -1 : null, ref: function (node) {
|
|
280
295
|
modalWrapperRef.current = node;
|
|
281
296
|
initPopupZIndex();
|
|
@@ -316,14 +331,7 @@ function Modal(baseProps, ref) {
|
|
|
316
331
|
if (unmountOnExit) {
|
|
317
332
|
modalRef.current = null;
|
|
318
333
|
}
|
|
319
|
-
} },
|
|
320
|
-
onMouseDown: function () {
|
|
321
|
-
maskClickRef.current = false;
|
|
322
|
-
},
|
|
323
|
-
onMouseUp: function () {
|
|
324
|
-
maskClickRef.current = false;
|
|
325
|
-
},
|
|
326
|
-
})))))) : null;
|
|
334
|
+
} }, (0, is_1.isFunction)(modalRender) ? modalRender(wrappedModalDom) : wrappedModalDom))))) : null;
|
|
327
335
|
}
|
|
328
336
|
var ExportedModalComponent = (0, react_1.forwardRef)(Modal);
|
|
329
337
|
ExportedModalComponent.displayName = 'Modal';
|
|
@@ -124,7 +124,7 @@ var VirtualList = react_1.default.forwardRef(function (props, ref) {
|
|
|
124
124
|
refItemHeightMap.current[KEY_VIRTUAL_ITEM_HEIGHT] ||
|
|
125
125
|
DEFAULT_VIRTUAL_ITEM_HEIGHT;
|
|
126
126
|
var viewportHeight = (0, is_1.isNumber)(styleListMaxHeight) ? styleListMaxHeight : stateHeight;
|
|
127
|
-
var itemCountVisible = Math.ceil(viewportHeight / itemHeight);
|
|
127
|
+
var itemCountVisible = Math.ceil(viewportHeight / itemHeight) * 2;
|
|
128
128
|
var itemTotalHeight = itemHeight * itemCount;
|
|
129
129
|
var isVirtual = threshold !== null &&
|
|
130
130
|
itemCount >= threshold &&
|
|
@@ -134,18 +134,17 @@ var VirtualList = react_1.default.forwardRef(function (props, ref) {
|
|
|
134
134
|
var refLockScroll = (0, react_1.useRef)(false);
|
|
135
135
|
var refIsVirtual = (0, react_1.useRef)(isVirtual);
|
|
136
136
|
// The paddingTop of the record scrolling list is used to correct the scrolling distance
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}, [refList.current]);
|
|
137
|
+
// const scrollListPadding = useMemo<{ top: number; bottom: number }>(() => {
|
|
138
|
+
// if (refList.current) {
|
|
139
|
+
// const getPadding = (property) =>
|
|
140
|
+
// +window.getComputedStyle(refList.current)[property].replace(/\D/g, '');
|
|
141
|
+
// return {
|
|
142
|
+
// top: getPadding('paddingTop'),
|
|
143
|
+
// bottom: getPadding('paddingBottom'),
|
|
144
|
+
// };
|
|
145
|
+
// }
|
|
146
|
+
// return { top: 0, bottom: 0 };
|
|
147
|
+
// }, [refList.current]);
|
|
149
148
|
var _l = __read((0, useStateWithPromise_1.default)({
|
|
150
149
|
// measure status
|
|
151
150
|
status: 'NONE',
|
|
@@ -344,7 +343,8 @@ var VirtualList = react_1.default.forwardRef(function (props, ref) {
|
|
|
344
343
|
var startItemTop = (0, itemUtil_1.getItemAbsoluteTop)({
|
|
345
344
|
scrollPtg: scrollPtg,
|
|
346
345
|
clientHeight: clientHeight,
|
|
347
|
-
scrollTop: scrollTop
|
|
346
|
+
scrollTop: scrollTop,
|
|
347
|
+
// scrollTop: scrollTop - (scrollListPadding.top + scrollListPadding.bottom) * scrollPtg,
|
|
348
348
|
itemHeight: getCachedItemHeight(getItemKeyByIndex(state.itemIndex)),
|
|
349
349
|
itemOffsetPtg: state.itemOffsetPtg,
|
|
350
350
|
});
|
package/lib/index.d.ts
CHANGED
|
@@ -139,4 +139,4 @@ export type { WatermarkProps } from './Watermark/interface';
|
|
|
139
139
|
export { default as Watermark } from './Watermark';
|
|
140
140
|
export type { ImageProps, ImagePreviewProps, ImagePreviewActionProps, ImagePreviewGroupProps } from './Image/interface';
|
|
141
141
|
export { default as Image } from './Image';
|
|
142
|
-
export declare const version = "1.
|
|
142
|
+
export declare const version = "1.2.0";
|
package/lib/index.js
CHANGED
|
@@ -147,4 +147,4 @@ var Watermark_1 = require("./Watermark");
|
|
|
147
147
|
Object.defineProperty(exports, "Watermark", { enumerable: true, get: function () { return __importDefault(Watermark_1).default; } });
|
|
148
148
|
var Image_1 = require("./Image");
|
|
149
149
|
Object.defineProperty(exports, "Image", { enumerable: true, get: function () { return __importDefault(Image_1).default; } });
|
|
150
|
-
exports.version = '1.
|
|
150
|
+
exports.version = '1.2.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apdesign/web-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "AP Design React UI Library.",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -126,6 +126,7 @@
|
|
|
126
126
|
"dayjs": "^1.10.5",
|
|
127
127
|
"lodash": "^4.17.21",
|
|
128
128
|
"number-precision": "^1.3.1",
|
|
129
|
+
"react-draggable": "^4.4.6",
|
|
129
130
|
"react-focus-lock": "^2.12.1",
|
|
130
131
|
"react-is": "^18.2.0",
|
|
131
132
|
"react-transition-group": "^4.3.0",
|