d2coreui 23.0.45 → 23.0.46
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/components/input/maskedInput.d.ts +13 -13
- package/components/modal/impl/draggableModal.d.ts +1 -1
- package/components/modal/impl/draggableModal.js +0 -1
- package/components/modal/impl/draggableModal.js.map +1 -1
- package/components/modal/impl/draggableModalInner.d.ts +1 -1
- package/components/modal/impl/draggableModalInner.js +28 -5
- package/components/modal/impl/draggableModalInner.js.map +1 -1
- package/components/modal/impl/draggableModalReducer.d.ts +10 -0
- package/components/modal/impl/draggableModalReducer.js +18 -1
- package/components/modal/impl/draggableModalReducer.js.map +1 -1
- package/components/modal/impl/draggableModalStyles.d.ts +19 -0
- package/components/modal/impl/draggableModalStyles.js +140 -0
- package/components/modal/impl/draggableModalStyles.js.map +1 -0
- package/components/modal/impl/resizeHandle.d.ts +4 -2
- package/components/modal/impl/resizeHandle.js +16 -3
- package/components/modal/impl/resizeHandle.js.map +1 -1
- package/components/modal/modalDialog.d.ts +3 -8
- package/components/modal/modalDialog.js.map +1 -1
- package/i18n/components.cs.json +2 -0
- package/i18n/components.sk.json +2 -0
- package/i18n/components.uk.json +2 -0
- package/package.json +1 -1
- package/style/modal/DraggableModal.css +0 -40
- package/style/modal/ResizeHandle.css +0 -27
|
@@ -63,19 +63,9 @@ export default class MaskedInput extends Component<MaskedInputProps, {
|
|
|
63
63
|
style?: React.CSSProperties | undefined;
|
|
64
64
|
title?: string | undefined;
|
|
65
65
|
id?: string | undefined;
|
|
66
|
-
children?: React.ReactNode | undefined;
|
|
67
|
-
list?: string | undefined;
|
|
68
|
-
className?: string | undefined;
|
|
69
66
|
width?: number | string | undefined;
|
|
70
|
-
prefixCls?: string;
|
|
71
67
|
height?: number | string | undefined;
|
|
72
|
-
|
|
73
|
-
hidden?: boolean | undefined;
|
|
74
|
-
color?: string | undefined;
|
|
75
|
-
content?: string | undefined;
|
|
76
|
-
multiple?: boolean | undefined;
|
|
77
|
-
type?: import("rc-input/lib/utils/types").LiteralUnion<"button" | "checkbox" | "color" | "date" | "datetime-local" | "email" | "file" | "hidden" | "image" | "month" | "number" | "password" | "radio" | "range" | "reset" | "search" | "submit" | "tel" | "text" | "time" | "url" | "week", string>;
|
|
78
|
-
pattern?: string | undefined;
|
|
68
|
+
className?: string | undefined;
|
|
79
69
|
defaultChecked?: boolean | undefined;
|
|
80
70
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
81
71
|
suppressContentEditableWarning?: boolean | undefined;
|
|
@@ -87,6 +77,7 @@ export default class MaskedInput extends Component<MaskedInputProps, {
|
|
|
87
77
|
dir?: string | undefined;
|
|
88
78
|
draggable?: (boolean | "true" | "false") | undefined;
|
|
89
79
|
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
|
|
80
|
+
hidden?: boolean | undefined;
|
|
90
81
|
lang?: string | undefined;
|
|
91
82
|
nonce?: string | undefined;
|
|
92
83
|
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
@@ -95,6 +86,7 @@ export default class MaskedInput extends Component<MaskedInputProps, {
|
|
|
95
86
|
radioGroup?: string | undefined;
|
|
96
87
|
role?: React.AriaRole | undefined;
|
|
97
88
|
about?: string | undefined;
|
|
89
|
+
content?: string | undefined;
|
|
98
90
|
datatype?: string | undefined;
|
|
99
91
|
inlist?: any;
|
|
100
92
|
prefix?: React.ReactNode;
|
|
@@ -107,6 +99,7 @@ export default class MaskedInput extends Component<MaskedInputProps, {
|
|
|
107
99
|
autoCapitalize?: string | undefined;
|
|
108
100
|
autoCorrect?: string | undefined;
|
|
109
101
|
autoSave?: string | undefined;
|
|
102
|
+
color?: string | undefined;
|
|
110
103
|
itemProp?: string | undefined;
|
|
111
104
|
itemScope?: boolean | undefined;
|
|
112
105
|
itemType?: string | undefined;
|
|
@@ -170,6 +163,7 @@ export default class MaskedInput extends Component<MaskedInputProps, {
|
|
|
170
163
|
"aria-valuemin"?: number | undefined;
|
|
171
164
|
"aria-valuenow"?: number | undefined;
|
|
172
165
|
"aria-valuetext"?: string | undefined;
|
|
166
|
+
children?: React.ReactNode | undefined;
|
|
173
167
|
dangerouslySetInnerHTML?: {
|
|
174
168
|
__html: string | TrustedHTML;
|
|
175
169
|
} | undefined;
|
|
@@ -236,6 +230,7 @@ export default class MaskedInput extends Component<MaskedInputProps, {
|
|
|
236
230
|
onProgressCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
237
231
|
onRateChange?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
238
232
|
onRateChangeCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
233
|
+
onResize?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
239
234
|
onResizeCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
240
235
|
onSeeked?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
241
236
|
onSeekedCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
@@ -327,13 +322,18 @@ export default class MaskedInput extends Component<MaskedInputProps, {
|
|
|
327
322
|
onAnimationIterationCapture?: React.AnimationEventHandler<HTMLInputElement> | undefined;
|
|
328
323
|
onTransitionEnd?: React.TransitionEventHandler<HTMLInputElement> | undefined;
|
|
329
324
|
onTransitionEndCapture?: React.TransitionEventHandler<HTMLInputElement> | undefined;
|
|
325
|
+
list?: string | undefined;
|
|
326
|
+
prefixCls?: string;
|
|
327
|
+
multiple?: boolean | undefined;
|
|
328
|
+
name?: string | undefined;
|
|
329
|
+
value?: string | (readonly string[] & string) | undefined;
|
|
330
|
+
type?: import("rc-input/lib/utils/types").LiteralUnion<"button" | "checkbox" | "color" | "date" | "datetime-local" | "email" | "file" | "hidden" | "image" | "month" | "number" | "password" | "radio" | "range" | "reset" | "search" | "submit" | "tel" | "text" | "time" | "url" | "week", string>;
|
|
331
|
+
pattern?: string | undefined;
|
|
330
332
|
formAction?: string | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS] | undefined;
|
|
331
333
|
formEncType?: string | undefined;
|
|
332
334
|
formMethod?: string | undefined;
|
|
333
335
|
formNoValidate?: boolean | undefined;
|
|
334
336
|
formTarget?: string | undefined;
|
|
335
|
-
name?: string | undefined;
|
|
336
|
-
value?: string | (readonly string[] & string) | undefined;
|
|
337
337
|
step?: number | string | undefined;
|
|
338
338
|
accept?: string | undefined;
|
|
339
339
|
alt?: string | undefined;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FunctionComponent } from 'react';
|
|
2
2
|
import { ModalProps } from 'antd/lib/modal';
|
|
3
|
-
import '../../../style/modal/DraggableModal.css';
|
|
4
3
|
export interface DraggableModalProps extends Omit<ModalProps, "width"> {
|
|
5
4
|
initialWidth?: number;
|
|
6
5
|
initialHeight?: number;
|
|
6
|
+
maximizable?: boolean;
|
|
7
7
|
onResize?(size: {
|
|
8
8
|
width: number;
|
|
9
9
|
height: number;
|
|
@@ -4,7 +4,6 @@ import { useUID } from 'react-uid';
|
|
|
4
4
|
import { DraggableModalContext } from './draggableModalContext';
|
|
5
5
|
import { DraggableModalInner } from './draggableModalInner';
|
|
6
6
|
import { getModalState } from './draggableModalReducer';
|
|
7
|
-
import '../../../style/modal/DraggableModal.css';
|
|
8
7
|
export const DraggableModal = (props) => {
|
|
9
8
|
const id = useUID();
|
|
10
9
|
const modalProvider = useContext(DraggableModalContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draggableModal.js","sourceRoot":"","sources":["../../../../../components/modal/impl/draggableModal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAoB,UAAU,EAAC,MAAM,OAAO,CAAA;AACnD,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAA;AAChC,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAC,aAAa,EAAC,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"draggableModal.js","sourceRoot":"","sources":["../../../../../components/modal/impl/draggableModal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAoB,UAAU,EAAC,MAAM,OAAO,CAAA;AACnD,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAA;AAChC,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAC,aAAa,EAAC,MAAM,yBAAyB,CAAA;AAYrD,MAAM,CAAC,MAAM,cAAc,GAA2C,CAAC,KAA0B,EAAsB,EAAE;IAErH,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IAGpB,MAAM,aAAa,GAAG,UAAU,CAAC,qBAAqB,CAAC,CAAC;IACxD,IAAI,CAAC,aAAa,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAA;IAClC,CAAC;IAED,MAAM,EAAC,QAAQ,EAAE,KAAK,EAAC,GAAG,aAAa,CAAC;IACxC,MAAM,UAAU,GAAG,aAAa,CAAC,EAAC,KAAK,EAAE,EAAE,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,EAAC,CAAC,CAAC;IAKpH,OAAO,oBAAC,mBAAmB,kBAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,IAAM,KAAK,EAAI,CAAA;AACjG,CAAC,CAAC","sourcesContent":["// https://github.com/CUBETIQ/antd-modal/\r\n\r\nimport * as React from 'react'\r\nimport {FunctionComponent, useContext} from 'react'\r\nimport {useUID} from 'react-uid'\r\nimport {DraggableModalContext} from './draggableModalContext'\r\nimport {DraggableModalInner} from './draggableModalInner'\r\nimport {getModalState} from './draggableModalReducer'\r\nimport {ModalProps} from 'antd/lib/modal'\r\n\r\nexport interface DraggableModalProps extends Omit<ModalProps, \"width\"> {\r\n initialWidth?: number,\r\n initialHeight?: number\r\n /** show the maximize/restore button next to the close button (default true) */\r\n maximizable?: boolean\r\n // resize dialog handler\r\n onResize?(size: { width: number, height: number }): void\r\n}\r\n\r\nexport const DraggableModal: FunctionComponent<DraggableModalProps> = (props: DraggableModalProps): React.ReactElement => {\r\n // Get the unique ID of this modal.\r\n const id = useUID();\r\n\r\n // Get modal provider.\r\n const modalProvider = useContext(DraggableModalContext);\r\n if (!modalProvider) {\r\n throw new Error('No Provider')\r\n }\r\n\r\n const {dispatch, state} = modalProvider;\r\n const modalState = getModalState({state, id, initialWidth: props.initialWidth, initialHeight: props.initialHeight});\r\n\r\n // We do this so that we don't re-render all modals for every state change.\r\n // DraggableModalInner uses React.memo, so it only re-renders if\r\n // if props change (e.g. modalState).\r\n return <DraggableModalInner id={id} dispatch={dispatch} modalState={modalState} {...props} />\r\n};\r\n"]}
|
|
@@ -11,5 +11,5 @@ interface ContextProps extends DraggableModalContextMethods {
|
|
|
11
11
|
export interface DraggableModalInnerProps extends DraggableModalProps, ContextProps {
|
|
12
12
|
children?: React.ReactNode;
|
|
13
13
|
}
|
|
14
|
-
export declare const DraggableModalInner: React.MemoExoticComponent<({ id, modalState, dispatch, open, children, title, initialWidth, initialHeight, onResize, ...otherProps }: DraggableModalInnerProps) => React.JSX.Element>;
|
|
14
|
+
export declare const DraggableModalInner: React.MemoExoticComponent<({ id, modalState, dispatch, open, children, title, initialWidth, initialHeight, onResize, maximizable, ...otherProps }: DraggableModalInnerProps) => React.JSX.Element>;
|
|
15
15
|
export {};
|
|
@@ -10,15 +10,27 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import * as React from 'react';
|
|
13
|
-
import { memo, useCallback, useEffect, useMemo } from 'react';
|
|
13
|
+
import { memo, useCallback, useContext, useEffect, useMemo } from 'react';
|
|
14
14
|
import { Modal } from 'antd';
|
|
15
|
+
import { ConfigContext } from 'antd/es/config-provider';
|
|
16
|
+
import { FullscreenExitOutlined, FullscreenOutlined } from '@ant-design/icons';
|
|
17
|
+
import i18n from 'd2core/i18n/i18n';
|
|
15
18
|
import { ResizeHandle } from './resizeHandle';
|
|
16
19
|
import { useDrag } from './useDrag';
|
|
17
20
|
import { usePrevious } from './usePrevious';
|
|
18
21
|
import { useResize } from './useResize';
|
|
22
|
+
import { getWindowSize } from './getWindowSize';
|
|
23
|
+
import { headerButtonGeometry, useDraggableModalStyles } from "./draggableModalStyles";
|
|
19
24
|
const modalStyle = { margin: 0, paddingBottom: 0, pointerEvents: 'auto' };
|
|
25
|
+
const MAXIMIZE_MARGIN = 32;
|
|
20
26
|
export const DraggableModalInner = memo((_a) => {
|
|
21
|
-
var { id, modalState, dispatch, open, children, title, initialWidth, initialHeight, onResize } = _a, otherProps = __rest(_a, ["id", "modalState", "dispatch", "open", "children", "title", "initialWidth", "initialHeight", "onResize"]);
|
|
27
|
+
var { id, modalState, dispatch, open, children, title, initialWidth, initialHeight, onResize, maximizable = true } = _a, otherProps = __rest(_a, ["id", "modalState", "dispatch", "open", "children", "title", "initialWidth", "initialHeight", "onResize", "maximizable"]);
|
|
28
|
+
const { styles, cx, theme } = useDraggableModalStyles();
|
|
29
|
+
const { getPrefixCls } = useContext(ConfigContext);
|
|
30
|
+
const modalPrefixCls = getPrefixCls('modal');
|
|
31
|
+
const hasFooter = otherProps.footer !== null;
|
|
32
|
+
const titleReserve = headerButtonGeometry(theme)
|
|
33
|
+
.reserve((otherProps.closable === false ? 0 : 1) + (maximizable ? 1 : 0));
|
|
22
34
|
useEffect(() => {
|
|
23
35
|
dispatch({ type: 'mount', id, intialState: { initialWidth, initialHeight } });
|
|
24
36
|
return () => dispatch({ type: 'unmount', id });
|
|
@@ -45,12 +57,23 @@ export const DraggableModalInner = memo((_a) => {
|
|
|
45
57
|
onResize === null || onResize === void 0 ? void 0 : onResize({ width: args.width, height: args.height });
|
|
46
58
|
return dispatch(Object.assign({ type: 'resize', id }, args));
|
|
47
59
|
}, [dispatch, id,]);
|
|
60
|
+
const { restore } = modalState;
|
|
61
|
+
const maximized = restore !== undefined;
|
|
62
|
+
const onToggleMaximize = useCallback(() => {
|
|
63
|
+
const windowSize = getWindowSize();
|
|
64
|
+
onResize === null || onResize === void 0 ? void 0 : onResize(restore
|
|
65
|
+
? { width: restore.width, height: restore.height }
|
|
66
|
+
: { width: windowSize.width - MAXIMIZE_MARGIN, height: windowSize.height - MAXIMIZE_MARGIN });
|
|
67
|
+
dispatch({ type: 'maximize', id, margin: MAXIMIZE_MARGIN });
|
|
68
|
+
}, [dispatch, id, onResize, restore]);
|
|
48
69
|
const onMouseDrag = useDrag(x, y, onDragWithID);
|
|
49
70
|
const onMouseResize = useResize(x, y, width, height, onResizeWithID);
|
|
50
|
-
const titleElement = useMemo(() => (React.createElement("div", { className: "ant-design-draggable-modal-title", onMouseDown: onMouseDrag, onClick: onFocus }, title)), [onMouseDrag, onFocus, title]);
|
|
51
|
-
return (React.createElement(Modal, Object.assign({ wrapClassName: "ant-design-draggable-modal", style: style, destroyOnHidden: true, width: width, title: titleElement, open: open }, otherProps),
|
|
71
|
+
const titleElement = useMemo(() => (React.createElement("div", { className: cx("ant-design-draggable-modal-title", styles.title), style: titleReserve > 0 ? { paddingInlineEnd: titleReserve } : undefined, onMouseDown: onMouseDrag, onClick: onFocus }, title)), [onMouseDrag, onFocus, title, cx, styles.title, titleReserve]);
|
|
72
|
+
return (React.createElement(Modal, Object.assign({ wrapClassName: cx("ant-design-draggable-modal", styles.wrap, !hasFooter && styles.wrapWithoutFooter), style: style, destroyOnHidden: true, width: width, title: titleElement, open: open }, otherProps),
|
|
52
73
|
children,
|
|
53
|
-
React.createElement(
|
|
74
|
+
maximizable && React.createElement("button", { type: "button", "aria-label": maximized ? i18n("Restore") : i18n("Maximize"), title: maximized ? i18n("Restore") : i18n("Maximize"), className: `${modalPrefixCls}-close ant-design-draggable-modal-maximize`, onClick: onToggleMaximize },
|
|
75
|
+
React.createElement("span", { className: `${modalPrefixCls}-close-x` }, maximized ? React.createElement(FullscreenExitOutlined, null) : React.createElement(FullscreenOutlined, null))),
|
|
76
|
+
React.createElement(ResizeHandle, { className: styles.resizeHandle, innerClassName: styles.resizeHandleInner, onMouseDown: onMouseResize })));
|
|
54
77
|
});
|
|
55
78
|
if (process.env.NODE_ENV !== 'production') {
|
|
56
79
|
DraggableModalInner.displayName = 'DraggableModalInner';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draggableModalInner.js","sourceRoot":"","sources":["../../../../../components/modal/impl/draggableModalInner.tsx"],"names":[],"mappings":";;;;;;;;;;;AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAC,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAC,MAAM,OAAO,CAAA;AAC3D,OAAO,EAAC,KAAK,EAAC,MAAM,MAAM,CAAA;AAC1B,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAA;AAEzC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAA;AAGrC,MAAM,UAAU,GAAwB,EAAC,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,EAAC,CAAA;AAc5F,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CACnC,CAAC,EAW2B,EAAE,EAAE;QAX/B,EACI,EAAE,EACF,UAAU,EACV,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,aAAa,EACb,QAAQ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I,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;IACxC,mBAAmB,CAAC,WAAW,GAAG,qBAAqB,CAAA;AAC3D,CAAC","sourcesContent":["// https://github.com/CUBETIQ/antd-modal/\r\n\r\nimport * as React from 'react'\r\nimport {memo, useCallback, useEffect, useMemo} from 'react'\r\nimport {Modal} from 'antd'\r\nimport {ResizeHandle} from './resizeHandle'\r\nimport {useDrag} from './useDrag'\r\nimport {DraggableModalContextMethods} from './draggableModalContext'\r\nimport {usePrevious} from './usePrevious'\r\nimport {ModalID, ModalState} from './draggableModalReducer'\r\nimport {useResize} from './useResize'\r\nimport {DraggableModalProps} from \"./draggableModal\";\r\n\r\nconst modalStyle: React.CSSProperties = {margin: 0, paddingBottom: 0, pointerEvents: 'auto'}\r\n\r\ninterface ContextProps extends DraggableModalContextMethods {\r\n id: ModalID\r\n modalState: ModalState\r\n initialWidth?: number\r\n initialHeight?: number\r\n}\r\n\r\n//export type DraggableModalInnerProps = ModalProps & { children?: React.ReactNode } & ContextProps\r\nexport interface DraggableModalInnerProps extends DraggableModalProps, ContextProps {\r\n children?: React.ReactNode\r\n}\r\n\r\nexport const DraggableModalInner = memo(\r\n ({\r\n id,\r\n modalState,\r\n dispatch,\r\n open,\r\n children,\r\n title,\r\n initialWidth,\r\n initialHeight,\r\n onResize,\r\n ...otherProps\r\n }: DraggableModalInnerProps) => {\r\n // Call on mount and unmount.\r\n useEffect(() => {\r\n dispatch({type: 'mount', id, intialState: {initialWidth, initialHeight}});\r\n return () => dispatch({type: 'unmount', id})\r\n }, [dispatch, id, initialWidth, initialHeight]);\r\n\r\n // Bring this to the front if it's been opened with props.\r\n const visiblePrevious = usePrevious(open);\r\n useEffect(() => {\r\n if (open !== visiblePrevious) {\r\n if (open) {\r\n dispatch({type: 'show', id})\r\n } else {\r\n dispatch({type: 'hide', id})\r\n }\r\n }\r\n }, [open, visiblePrevious, id, dispatch]);\r\n\r\n const {x, y, width, height} = modalState;\r\n\r\n const style: React.CSSProperties = useMemo(\r\n () => ({...modalStyle, top: y, left: x, height}),\r\n [y, x, height],\r\n );\r\n\r\n const onFocus = useCallback(() => dispatch({type: 'focus', id}), [id, dispatch])\r\n\r\n const onDragWithID = useCallback((args: any) => dispatch({type: 'drag', id, ...args}), [\r\n dispatch,\r\n id,\r\n ]);\r\n\r\n const onResizeWithID = useCallback((args: any) => {\r\n onResize?.({width: args.width, height: args.height});\r\n return dispatch({type: 'resize', id, ...args})\r\n }, [dispatch, id,]);\r\n\r\n const onMouseDrag = useDrag(x, y, onDragWithID);\r\n const onMouseResize = useResize(x, y, width, height, onResizeWithID);\r\n\r\n const titleElement = useMemo(\r\n () => (\r\n <div\r\n className=\"ant-design-draggable-modal-title\"\r\n onMouseDown={onMouseDrag}\r\n onClick={onFocus}\r\n >\r\n {title}\r\n </div>\r\n ),\r\n [onMouseDrag, onFocus, title],\r\n );\r\n\r\n return (\r\n <Modal\r\n wrapClassName=\"ant-design-draggable-modal\"\r\n style={style}\r\n destroyOnHidden\r\n width={width}\r\n title={titleElement}\r\n open={open}\r\n {...otherProps}\r\n >\r\n {children}\r\n <ResizeHandle onMouseDown={onMouseResize}/>\r\n </Modal>\r\n )\r\n }\r\n);\r\n\r\nif (process.env.NODE_ENV !== 'production') {\r\n DraggableModalInner.displayName = 'DraggableModalInner'\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"draggableModalInner.js","sourceRoot":"","sources":["../../../../../components/modal/impl/draggableModalInner.tsx"],"names":[],"mappings":";;;;;;;;;;;AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAC,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAC,MAAM,OAAO,CAAA;AACvE,OAAO,EAAC,KAAK,EAAC,MAAM,MAAM,CAAA;AAC1B,OAAO,EAAC,aAAa,EAAC,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAAC,sBAAsB,EAAE,kBAAkB,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SAAS,CAAC,CAAC,CAAC,oBAAC,sBAAsB,OAAE,CAAC,CAAC,CAAC,oBAAC,kBAAkB,OAAE,CAC3D,CACF;QACT,oBAAC,YAAY,IAAC,SAAS,EAAE,MAAM,CAAC,YAAY,EAAE,cAAc,EAAE,MAAM,CAAC,iBAAiB,EACxE,WAAW,EAAE,aAAa,GAAG,CACvC,CACX,CAAA;AACL,CAAC,CACJ,CAAC;AAEF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;IACxC,mBAAmB,CAAC,WAAW,GAAG,qBAAqB,CAAA;AAC3D,CAAC","sourcesContent":["// https://github.com/CUBETIQ/antd-modal/\r\n\r\nimport * as React from 'react'\r\nimport {memo, useCallback, useContext, useEffect, useMemo} from 'react'\r\nimport {Modal} from 'antd'\r\nimport {ConfigContext} from 'antd/es/config-provider'\r\nimport {FullscreenExitOutlined, FullscreenOutlined} from '@ant-design/icons'\r\nimport i18n from 'd2core/i18n/i18n'\r\nimport {ResizeHandle} from './resizeHandle'\r\nimport {useDrag} from './useDrag'\r\nimport {DraggableModalContextMethods} from './draggableModalContext'\r\nimport {usePrevious} from './usePrevious'\r\nimport {ModalID, ModalState} from './draggableModalReducer'\r\nimport {useResize} from './useResize'\r\nimport {getWindowSize} from './getWindowSize'\r\nimport {DraggableModalProps} from \"./draggableModal\";\r\nimport {headerButtonGeometry, useDraggableModalStyles} from \"./draggableModalStyles\";\r\n\r\nconst modalStyle: React.CSSProperties = {margin: 0, paddingBottom: 0, pointerEvents: 'auto'}\r\n\r\n/** free space left around a maximized dialog, in total (half on each side) */\r\nconst MAXIMIZE_MARGIN = 32\r\n\r\ninterface ContextProps extends DraggableModalContextMethods {\r\n id: ModalID\r\n modalState: ModalState\r\n initialWidth?: number\r\n initialHeight?: number\r\n}\r\n\r\n//export type DraggableModalInnerProps = ModalProps & { children?: React.ReactNode } & ContextProps\r\nexport interface DraggableModalInnerProps extends DraggableModalProps, ContextProps {\r\n children?: React.ReactNode\r\n}\r\n\r\nexport const DraggableModalInner = memo(\r\n ({\r\n id,\r\n modalState,\r\n dispatch,\r\n open,\r\n children,\r\n title,\r\n initialWidth,\r\n initialHeight,\r\n onResize,\r\n maximizable = true,\r\n ...otherProps\r\n }: DraggableModalInnerProps) => {\r\n const {styles, cx, theme} = useDraggableModalStyles();\r\n const {getPrefixCls} = useContext(ConfigContext);\r\n const modalPrefixCls = getPrefixCls('modal');\r\n\r\n // NO_BUTTONS dialogs (and anyone passing footer={null}) render no footer, which is where the\r\n // bottom inset normally lives - the content has to take it back\r\n const hasFooter = otherProps.footer !== null;\r\n // room the title has to leave in the top-right corner so the buttons do not cover it\r\n const titleReserve = headerButtonGeometry(theme)\r\n .reserve((otherProps.closable === false ? 0 : 1) + (maximizable ? 1 : 0));\r\n\r\n // Call on mount and unmount.\r\n useEffect(() => {\r\n dispatch({type: 'mount', id, intialState: {initialWidth, initialHeight}});\r\n return () => dispatch({type: 'unmount', id})\r\n }, [dispatch, id, initialWidth, initialHeight]);\r\n\r\n // Bring this to the front if it's been opened with props.\r\n const visiblePrevious = usePrevious(open);\r\n useEffect(() => {\r\n if (open !== visiblePrevious) {\r\n if (open) {\r\n dispatch({type: 'show', id})\r\n } else {\r\n dispatch({type: 'hide', id})\r\n }\r\n }\r\n }, [open, visiblePrevious, id, dispatch]);\r\n\r\n const {x, y, width, height} = modalState;\r\n\r\n const style: React.CSSProperties = useMemo(\r\n () => ({...modalStyle, top: y, left: x, height}),\r\n [y, x, height],\r\n );\r\n\r\n const onFocus = useCallback(() => dispatch({type: 'focus', id}), [id, dispatch])\r\n\r\n const onDragWithID = useCallback((args: any) => dispatch({type: 'drag', id, ...args}), [\r\n dispatch,\r\n id,\r\n ]);\r\n\r\n const onResizeWithID = useCallback((args: any) => {\r\n onResize?.({width: args.width, height: args.height});\r\n return dispatch({type: 'resize', id, ...args})\r\n }, [dispatch, id,]);\r\n\r\n const {restore} = modalState;\r\n const maximized = restore !== undefined;\r\n\r\n const onToggleMaximize = useCallback(() => {\r\n const windowSize = getWindowSize();\r\n onResize?.(restore\r\n ? {width: restore.width, height: restore.height}\r\n : {width: windowSize.width - MAXIMIZE_MARGIN, height: windowSize.height - MAXIMIZE_MARGIN});\r\n dispatch({type: 'maximize', id, margin: MAXIMIZE_MARGIN})\r\n }, [dispatch, id, onResize, restore]);\r\n\r\n const onMouseDrag = useDrag(x, y, onDragWithID);\r\n const onMouseResize = useResize(x, y, width, height, onResizeWithID);\r\n\r\n const titleElement = useMemo(\r\n () => (\r\n <div\r\n // the legacy class name is kept as a styling hook for the app (e.g. .compact-modal)\r\n className={cx(\"ant-design-draggable-modal-title\", styles.title)}\r\n // inline so it wins over the class padding without a specificity contest\r\n style={titleReserve > 0 ? {paddingInlineEnd: titleReserve} : undefined}\r\n onMouseDown={onMouseDrag}\r\n onClick={onFocus}\r\n >\r\n {title}\r\n </div>\r\n ),\r\n [onMouseDrag, onFocus, title, cx, styles.title, titleReserve],\r\n );\r\n\r\n return (\r\n <Modal\r\n wrapClassName={cx(\"ant-design-draggable-modal\", styles.wrap, !hasFooter && styles.wrapWithoutFooter)}\r\n style={style}\r\n destroyOnHidden\r\n width={width}\r\n title={titleElement}\r\n open={open}\r\n {...otherProps}\r\n >\r\n {children}\r\n {/* reuses antd's close-button markup so it matches the button it sits next to */}\r\n {maximizable && <button type=\"button\"\r\n aria-label={maximized ? i18n(\"Restore\") : i18n(\"Maximize\")}\r\n title={maximized ? i18n(\"Restore\") : i18n(\"Maximize\")}\r\n className={`${modalPrefixCls}-close ant-design-draggable-modal-maximize`}\r\n onClick={onToggleMaximize}>\r\n <span className={`${modalPrefixCls}-close-x`}>\r\n {maximized ? <FullscreenExitOutlined/> : <FullscreenOutlined/>}\r\n </span>\r\n </button>}\r\n <ResizeHandle className={styles.resizeHandle} innerClassName={styles.resizeHandleInner}\r\n onMouseDown={onMouseResize}/>\r\n </Modal>\r\n )\r\n }\r\n);\r\n\r\nif (process.env.NODE_ENV !== 'production') {\r\n DraggableModalInner.displayName = 'DraggableModalInner'\r\n}\r\n"]}
|
|
@@ -5,6 +5,12 @@ export interface ModalState {
|
|
|
5
5
|
width: number;
|
|
6
6
|
height: number;
|
|
7
7
|
visible: boolean;
|
|
8
|
+
restore?: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
};
|
|
8
14
|
}
|
|
9
15
|
export interface ModalsState {
|
|
10
16
|
windowSize: {
|
|
@@ -47,6 +53,10 @@ export type Action = {
|
|
|
47
53
|
id: ModalID;
|
|
48
54
|
x: number;
|
|
49
55
|
y: number;
|
|
56
|
+
} | {
|
|
57
|
+
type: 'maximize';
|
|
58
|
+
id: ModalID;
|
|
59
|
+
margin: number;
|
|
50
60
|
} | {
|
|
51
61
|
type: 'resize';
|
|
52
62
|
id: ModalID;
|
|
@@ -34,7 +34,24 @@ export const draggableModalReducer = (state, action) => {
|
|
|
34
34
|
switch (action.type) {
|
|
35
35
|
case 'resize':
|
|
36
36
|
const size = clampResize(state.windowSize.width, state.windowSize.height, action.x, action.y, action.width, action.height);
|
|
37
|
-
return Object.assign(Object.assign({}, state), { modals: Object.assign(Object.assign({}, state.modals), { [action.id]: Object.assign(Object.assign({}, state.modals[action.id]), size) }) });
|
|
37
|
+
return Object.assign(Object.assign({}, state), { modals: Object.assign(Object.assign({}, state.modals), { [action.id]: Object.assign(Object.assign(Object.assign({}, state.modals[action.id]), size), { restore: undefined }) }) });
|
|
38
|
+
case 'maximize': {
|
|
39
|
+
const modalState = state.modals[action.id];
|
|
40
|
+
const { restore } = modalState;
|
|
41
|
+
if (restore) {
|
|
42
|
+
const position = clampDrag(state.windowSize.width, state.windowSize.height, restore.x, restore.y, restore.width, restore.height);
|
|
43
|
+
const size = clampResize(state.windowSize.width, state.windowSize.height, position.x, position.y, restore.width, restore.height);
|
|
44
|
+
return Object.assign(Object.assign({}, state), { modals: Object.assign(Object.assign({}, state.modals), { [action.id]: Object.assign(Object.assign(Object.assign(Object.assign({}, modalState), position), size), { restore: undefined }) }) });
|
|
45
|
+
}
|
|
46
|
+
const inset = action.margin / 2;
|
|
47
|
+
const maximized = clampResize(state.windowSize.width, state.windowSize.height, inset, inset, state.windowSize.width - action.margin, state.windowSize.height - action.margin);
|
|
48
|
+
return Object.assign(Object.assign({}, state), { modals: Object.assign(Object.assign({}, state.modals), { [action.id]: Object.assign(Object.assign(Object.assign(Object.assign({}, modalState), { x: inset, y: inset }), maximized), { restore: {
|
|
49
|
+
x: modalState.x,
|
|
50
|
+
y: modalState.y,
|
|
51
|
+
width: modalState.width,
|
|
52
|
+
height: modalState.height,
|
|
53
|
+
} }) }) });
|
|
54
|
+
}
|
|
38
55
|
case 'drag':
|
|
39
56
|
return Object.assign(Object.assign({}, state), { modals: Object.assign(Object.assign({}, state.modals), { [action.id]: Object.assign(Object.assign({}, state.modals[action.id]), clampDrag(state.windowSize.width, state.windowSize.height, action.x, action.y, state.modals[action.id].width, state.modals[action.id].height)) }) });
|
|
40
57
|
case 'show': {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draggableModalReducer.js","sourceRoot":"","sources":["../../../../../components/modal/impl/draggableModalReducer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAA;AAE7B,MAAM,SAAS,GAAG,CAAI,CAAuB,EAAE,CAAkB,EAAwB,EAAE,CACvF,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,CAAA;AAyBnE,MAAM,CAAC,MAAM,kBAAkB,GAAgB;IAC3C,UAAU,EAAE,aAAa,EA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AC,MAAM,EACvB,QAAQ,CAAC,CAAC,EACV,QAAQ,CAAC,CAAC,EACV,UAAU,CAAC,KAAK,EAChB,UAAU,CAAC,MAAM,CACpB,CAAA;oBACD,qDACO,UAAU,GACV,QAAQ,GACR,IAAI,EACV;gBACL,CAAC,CAAC,IACL;QACL;YACI,MAAM,IAAI,KAAK,EAAE,CAAA;IACzB,CAAC;AACL,CAAC,CAAA","sourcesContent":["// https://github.com/CUBETIQ/antd-modal/\r\n\r\nimport {getWindowSize} from './getWindowSize'\r\nimport {clamp} from './clamp'\r\n\r\nconst mapObject = <T>(o: { [key: string]: T }, f: (value: T) => T): { [key: string]: T } =>\r\n Object.assign({}, ...Object.keys(o).map(k => ({[k]: f(o[k])})))\r\n\r\n// ID for a specific modal.\r\nexport type ModalID = string\r\n\r\n// State for a specific modal.\r\nexport interface ModalState {\r\n x: number\r\n y: number\r\n width: number\r\n height: number\r\n visible: boolean\r\n}\r\n\r\n// State of all modals.\r\nexport interface ModalsState {\r\n windowSize: {\r\n width: number\r\n height: number\r\n }\r\n modals: {\r\n [key: string]: ModalState\r\n }\r\n}\r\n\r\nexport const initialModalsState: ModalsState = {\r\n windowSize: getWindowSize(),\r\n modals: {},\r\n};\r\n\r\nexport const initialModalState: ModalState = {\r\n x: 0,\r\n y: 0,\r\n width: 400,\r\n height: 400,\r\n visible: false,\r\n};\r\n\r\nconst getInitialModalState = ({\r\n initialWidth = initialModalState.width,\r\n initialHeight = initialModalState.height,\r\n }: {\r\n initialWidth?: number\r\n initialHeight?: number\r\n}) => {\r\n return {\r\n ...initialModalState,\r\n width: initialWidth,\r\n height: initialHeight,\r\n }\r\n}\r\n\r\nexport type Action =\r\n | { type: 'show'; id: ModalID }\r\n | { type: 'hide'; id: ModalID }\r\n | { type: 'focus'; id: ModalID }\r\n | { type: 'unmount'; id: ModalID }\r\n | { type: 'mount'; id: ModalID, intialState: { initialWidth?: number; initialHeight?: number } }\r\n | { type: 'windowResize'; size: { width: number; height: number } }\r\n | { type: 'drag'; id: ModalID; x: number; y: number }\r\n | {\r\n type: 'resize'\r\n id: ModalID\r\n x: number\r\n y: number\r\n width: number\r\n height: number\r\n}\r\n\r\nexport const getModalState = ({\r\n state,\r\n id,\r\n initialWidth,\r\n initialHeight,\r\n }: {\r\n state: ModalsState\r\n id: ModalID\r\n initialWidth?: number\r\n initialHeight?: number\r\n}): ModalState => state.modals[id] || getInitialModalState({ initialWidth, initialHeight })\r\n\r\nconst clampDrag = (\r\n windowWidth: number,\r\n windowHeight: number,\r\n x: number,\r\n y: number,\r\n width: number,\r\n height: number,\r\n): { x: number; y: number } => {\r\n const maxX = windowWidth - width;\r\n const maxY = windowHeight - height;\r\n const clampedX = clamp(0, maxX, x);\r\n const clampedY = clamp(0, maxY, y);\r\n return {x: clampedX, y: clampedY}\r\n}\r\n\r\nconst clampResize = (\r\n windowWidth: number,\r\n windowHeight: number,\r\n x: number,\r\n y: number,\r\n width: number,\r\n height: number,\r\n): { width: number; height: number } => {\r\n const maxWidth = windowWidth - x;\r\n const maxHeight = windowHeight - y;\r\n const clampedWidth = clamp(200, maxWidth, width);\r\n const clampedHeight = clamp(200, maxHeight, height);\r\n return {width: clampedWidth, height: clampedHeight}\r\n}\r\n\r\nexport const draggableModalReducer = (state: ModalsState, action: Action): ModalsState => {\r\n switch (action.type) {\r\n case 'resize':\r\n const size = clampResize(\r\n state.windowSize.width,\r\n state.windowSize.height,\r\n action.x,\r\n action.y,\r\n action.width,\r\n action.height,\r\n )\r\n return {\r\n ...state,\r\n modals: {\r\n ...state.modals,\r\n [action.id]: {\r\n ...state.modals[action.id],\r\n ...size,\r\n },\r\n },\r\n }\r\n case 'drag':\r\n return {\r\n ...state,\r\n modals: {\r\n ...state.modals,\r\n [action.id]: {\r\n ...state.modals[action.id],\r\n ...clampDrag(\r\n state.windowSize.width,\r\n state.windowSize.height,\r\n action.x,\r\n action.y,\r\n state.modals[action.id].width,\r\n state.modals[action.id].height,\r\n ),\r\n },\r\n },\r\n }\r\n case 'show': {\r\n const modalState = state.modals[action.id]\r\n const centerX = state.windowSize.width / 2 - modalState.width / 2\r\n const centerY = state.windowSize.height / 2 - modalState.height / 2\r\n const position = clampDrag(\r\n state.windowSize.width,\r\n state.windowSize.height,\r\n centerX,\r\n centerY,\r\n modalState.width,\r\n modalState.height,\r\n )\r\n const size = clampResize(\r\n state.windowSize.width,\r\n state.windowSize.height,\r\n position.x,\r\n position.y,\r\n modalState.width,\r\n modalState.height,\r\n )\r\n return {\r\n ...state,\r\n modals: {\r\n ...state.modals,\r\n [action.id]: {\r\n ...modalState,\r\n ...position,\r\n ...size,\r\n visible: true,\r\n },\r\n },\r\n }\r\n }\r\n case 'focus':\r\n const modalState = state.modals[action.id]\r\n return {\r\n ...state,\r\n modals: {\r\n ...state.modals,\r\n [action.id]: {\r\n ...modalState,\r\n },\r\n },\r\n }\r\n case 'hide': {\r\n const modalState = state.modals[action.id]\r\n return {\r\n ...state,\r\n modals: {\r\n ...state.modals,\r\n [action.id]: {\r\n ...modalState,\r\n visible: false,\r\n },\r\n },\r\n }\r\n }\r\n case 'mount':\r\n const initialState = getInitialModalState(action.intialState);\r\n return {\r\n ...state,\r\n modals: {\r\n ...state.modals,\r\n [action.id]: {\r\n ...initialState,\r\n x: state.windowSize.width / 2 - initialState.width / 2,\r\n y: state.windowSize.height / 2 - initialState.height / 2,\r\n },\r\n },\r\n };\r\n case 'unmount':\r\n const modalsClone = {...state.modals};\r\n delete modalsClone[action.id];\r\n return {\r\n ...state,\r\n modals: modalsClone,\r\n };\r\n case 'windowResize':\r\n return {\r\n ...state,\r\n windowSize: action.size,\r\n modals: mapObject(state.modals, (modalState: ModalState) => {\r\n if (!modalState.visible) {\r\n return modalState\r\n }\r\n const position = clampDrag(\r\n state.windowSize.width,\r\n state.windowSize.height,\r\n modalState.x,\r\n modalState.y,\r\n modalState.width,\r\n modalState.height,\r\n )\r\n const size = clampResize(\r\n state.windowSize.width,\r\n state.windowSize.height,\r\n position.x,\r\n position.y,\r\n modalState.width,\r\n modalState.height,\r\n )\r\n return {\r\n ...modalState,\r\n ...position,\r\n ...size,\r\n }\r\n }),\r\n }\r\n default:\r\n throw new Error()\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"draggableModalReducer.js","sourceRoot":"","sources":["../../../../../components/modal/impl/draggableModalReducer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAA;AAE7B,MAAM,SAAS,GAAG,CAAI,CAAuB,EAAE,CAAkB,EAAwB,EAAE,CACvF,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,CAAA;AA2BnE,MAAM,CAAC,MAAM,kBAAkB,GAAgB;IAC3C,UAAU,EAAE,aAAa,EAAE;IAC3B,MAAM,EAAE,EAAE;CACb,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAe;IACzC,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,KAAK,EAAE,GAAG;IACV,MAAM,EAAE,GAAG;IACX,OAAO,EAAE,KAAK;CACjB,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,EACI,YAAY,GAAG,iBAAiB,CAAC,KAAK,EACtC,aAAa,GAAG,iBAAiB,CAAC,MAAM,GAIzE,EAAE,EAAE;IACD,uCACO,iBAAiB,KACpB,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,aAAa,IACxB;AACL,CAAC,CAAA;AAwBD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EACI,KAAK,EACL,EAAE,EACF,YAAY,EACZ,aAAa,GAM9C,EAAc,EAAE,CAAC,KAAK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'./getWindowSize'\r\nimport {clamp} from './clamp'\r\n\r\nconst mapObject = <T>(o: { [key: string]: T }, f: (value: T) => T): { [key: string]: T } =>\r\n Object.assign({}, ...Object.keys(o).map(k => ({[k]: f(o[k])})))\r\n\r\n// ID for a specific modal.\r\nexport type ModalID = string\r\n\r\n// State for a specific modal.\r\nexport interface ModalState {\r\n x: number\r\n y: number\r\n width: number\r\n height: number\r\n visible: boolean\r\n /** rectangle to return to when un-maximizing; set only while the dialog is maximized */\r\n restore?: { x: number; y: number; width: number; height: number }\r\n}\r\n\r\n// State of all modals.\r\nexport interface ModalsState {\r\n windowSize: {\r\n width: number\r\n height: number\r\n }\r\n modals: {\r\n [key: string]: ModalState\r\n }\r\n}\r\n\r\nexport const initialModalsState: ModalsState = {\r\n windowSize: getWindowSize(),\r\n modals: {},\r\n};\r\n\r\nexport const initialModalState: ModalState = {\r\n x: 0,\r\n y: 0,\r\n width: 400,\r\n height: 400,\r\n visible: false,\r\n};\r\n\r\nconst getInitialModalState = ({\r\n initialWidth = initialModalState.width,\r\n initialHeight = initialModalState.height,\r\n }: {\r\n initialWidth?: number\r\n initialHeight?: number\r\n}) => {\r\n return {\r\n ...initialModalState,\r\n width: initialWidth,\r\n height: initialHeight,\r\n }\r\n}\r\n\r\nexport type Action =\r\n | { type: 'show'; id: ModalID }\r\n | { type: 'hide'; id: ModalID }\r\n | { type: 'focus'; id: ModalID }\r\n | { type: 'unmount'; id: ModalID }\r\n | { type: 'mount'; id: ModalID, intialState: { initialWidth?: number; initialHeight?: number } }\r\n | { type: 'windowResize'; size: { width: number; height: number } }\r\n | { type: 'drag'; id: ModalID; x: number; y: number }\r\n /**\r\n * Toggle: fills the window leaving `margin` px of free space in total (half of it on each side),\r\n * or returns to the rectangle from before maximizing.\r\n */\r\n | { type: 'maximize'; id: ModalID; margin: number }\r\n | {\r\n type: 'resize'\r\n id: ModalID\r\n x: number\r\n y: number\r\n width: number\r\n height: number\r\n}\r\n\r\nexport const getModalState = ({\r\n state,\r\n id,\r\n initialWidth,\r\n initialHeight,\r\n }: {\r\n state: ModalsState\r\n id: ModalID\r\n initialWidth?: number\r\n initialHeight?: number\r\n}): ModalState => state.modals[id] || getInitialModalState({ initialWidth, initialHeight })\r\n\r\nconst clampDrag = (\r\n windowWidth: number,\r\n windowHeight: number,\r\n x: number,\r\n y: number,\r\n width: number,\r\n height: number,\r\n): { x: number; y: number } => {\r\n const maxX = windowWidth - width;\r\n const maxY = windowHeight - height;\r\n const clampedX = clamp(0, maxX, x);\r\n const clampedY = clamp(0, maxY, y);\r\n return {x: clampedX, y: clampedY}\r\n}\r\n\r\nconst clampResize = (\r\n windowWidth: number,\r\n windowHeight: number,\r\n x: number,\r\n y: number,\r\n width: number,\r\n height: number,\r\n): { width: number; height: number } => {\r\n const maxWidth = windowWidth - x;\r\n const maxHeight = windowHeight - y;\r\n const clampedWidth = clamp(200, maxWidth, width);\r\n const clampedHeight = clamp(200, maxHeight, height);\r\n return {width: clampedWidth, height: clampedHeight}\r\n}\r\n\r\nexport const draggableModalReducer = (state: ModalsState, action: Action): ModalsState => {\r\n switch (action.type) {\r\n case 'resize':\r\n const size = clampResize(\r\n state.windowSize.width,\r\n state.windowSize.height,\r\n action.x,\r\n action.y,\r\n action.width,\r\n action.height,\r\n )\r\n return {\r\n ...state,\r\n modals: {\r\n ...state.modals,\r\n [action.id]: {\r\n ...state.modals[action.id],\r\n ...size,\r\n // resizing by hand takes the dialog out of the maximized state\r\n restore: undefined,\r\n },\r\n },\r\n }\r\n case 'maximize': {\r\n const modalState = state.modals[action.id];\r\n const {restore} = modalState;\r\n if (restore) {\r\n // the window may have shrunk in the meantime, so the old rectangle goes through the\r\n // same clamping as a manual drag/resize\r\n const position = clampDrag(\r\n state.windowSize.width,\r\n state.windowSize.height,\r\n restore.x,\r\n restore.y,\r\n restore.width,\r\n restore.height,\r\n )\r\n const size = clampResize(\r\n state.windowSize.width,\r\n state.windowSize.height,\r\n position.x,\r\n position.y,\r\n restore.width,\r\n restore.height,\r\n )\r\n return {\r\n ...state,\r\n modals: {\r\n ...state.modals,\r\n [action.id]: {\r\n ...modalState,\r\n ...position,\r\n ...size,\r\n restore: undefined,\r\n },\r\n },\r\n }\r\n }\r\n const inset = action.margin / 2;\r\n const maximized = clampResize(\r\n state.windowSize.width,\r\n state.windowSize.height,\r\n inset,\r\n inset,\r\n state.windowSize.width - action.margin,\r\n state.windowSize.height - action.margin,\r\n )\r\n return {\r\n ...state,\r\n modals: {\r\n ...state.modals,\r\n [action.id]: {\r\n ...modalState,\r\n x: inset,\r\n y: inset,\r\n ...maximized,\r\n restore: {\r\n x: modalState.x,\r\n y: modalState.y,\r\n width: modalState.width,\r\n height: modalState.height,\r\n },\r\n },\r\n },\r\n }\r\n }\r\n case 'drag':\r\n return {\r\n ...state,\r\n modals: {\r\n ...state.modals,\r\n [action.id]: {\r\n ...state.modals[action.id],\r\n ...clampDrag(\r\n state.windowSize.width,\r\n state.windowSize.height,\r\n action.x,\r\n action.y,\r\n state.modals[action.id].width,\r\n state.modals[action.id].height,\r\n ),\r\n },\r\n },\r\n }\r\n case 'show': {\r\n const modalState = state.modals[action.id]\r\n const centerX = state.windowSize.width / 2 - modalState.width / 2\r\n const centerY = state.windowSize.height / 2 - modalState.height / 2\r\n const position = clampDrag(\r\n state.windowSize.width,\r\n state.windowSize.height,\r\n centerX,\r\n centerY,\r\n modalState.width,\r\n modalState.height,\r\n )\r\n const size = clampResize(\r\n state.windowSize.width,\r\n state.windowSize.height,\r\n position.x,\r\n position.y,\r\n modalState.width,\r\n modalState.height,\r\n )\r\n return {\r\n ...state,\r\n modals: {\r\n ...state.modals,\r\n [action.id]: {\r\n ...modalState,\r\n ...position,\r\n ...size,\r\n visible: true,\r\n },\r\n },\r\n }\r\n }\r\n case 'focus':\r\n const modalState = state.modals[action.id]\r\n return {\r\n ...state,\r\n modals: {\r\n ...state.modals,\r\n [action.id]: {\r\n ...modalState,\r\n },\r\n },\r\n }\r\n case 'hide': {\r\n const modalState = state.modals[action.id]\r\n return {\r\n ...state,\r\n modals: {\r\n ...state.modals,\r\n [action.id]: {\r\n ...modalState,\r\n visible: false,\r\n },\r\n },\r\n }\r\n }\r\n case 'mount':\r\n const initialState = getInitialModalState(action.intialState);\r\n return {\r\n ...state,\r\n modals: {\r\n ...state.modals,\r\n [action.id]: {\r\n ...initialState,\r\n x: state.windowSize.width / 2 - initialState.width / 2,\r\n y: state.windowSize.height / 2 - initialState.height / 2,\r\n },\r\n },\r\n };\r\n case 'unmount':\r\n const modalsClone = {...state.modals};\r\n delete modalsClone[action.id];\r\n return {\r\n ...state,\r\n modals: modalsClone,\r\n };\r\n case 'windowResize':\r\n return {\r\n ...state,\r\n windowSize: action.size,\r\n modals: mapObject(state.modals, (modalState: ModalState) => {\r\n if (!modalState.visible) {\r\n return modalState\r\n }\r\n const position = clampDrag(\r\n state.windowSize.width,\r\n state.windowSize.height,\r\n modalState.x,\r\n modalState.y,\r\n modalState.width,\r\n modalState.height,\r\n )\r\n const size = clampResize(\r\n state.windowSize.width,\r\n state.windowSize.height,\r\n position.x,\r\n position.y,\r\n modalState.width,\r\n modalState.height,\r\n )\r\n return {\r\n ...modalState,\r\n ...position,\r\n ...size,\r\n }\r\n }),\r\n }\r\n default:\r\n throw new Error()\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface HeaderButtonToken {
|
|
2
|
+
controlHeight: number;
|
|
3
|
+
padding: number;
|
|
4
|
+
marginXXS: number;
|
|
5
|
+
lineHeightHeading5: number;
|
|
6
|
+
fontSizeHeading5: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const headerButtonGeometry: (token: HeaderButtonToken) => {
|
|
9
|
+
secondButtonInset: number;
|
|
10
|
+
reserve: (count: number) => number;
|
|
11
|
+
};
|
|
12
|
+
export declare const useDraggableModalStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
13
|
+
wrap: import("antd-style").SerializedStyles;
|
|
14
|
+
wrapWithoutFooter: import("antd-style").SerializedStyles;
|
|
15
|
+
title: import("antd-style").SerializedStyles;
|
|
16
|
+
resizeHandle: import("antd-style").SerializedStyles;
|
|
17
|
+
resizeHandleInner: import("antd-style").SerializedStyles;
|
|
18
|
+
}>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { createStyles } from "antd-style";
|
|
2
|
+
export const headerButtonGeometry = (token) => {
|
|
3
|
+
const size = token.controlHeight;
|
|
4
|
+
const headerHeight = token.lineHeightHeading5 * token.fontSizeHeading5 + token.padding * 2;
|
|
5
|
+
const inset = (headerHeight - size) / 2;
|
|
6
|
+
const gap = token.marginXXS;
|
|
7
|
+
return {
|
|
8
|
+
secondButtonInset: inset + size + gap,
|
|
9
|
+
reserve: (count) => count <= 0 ? 0 : inset + count * size + (count - 1) * gap,
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export const useDraggableModalStyles = createStyles(({ token, css, prefixCls }) => {
|
|
13
|
+
const modalCls = `.${prefixCls}-modal`;
|
|
14
|
+
const contentPaddingInline = token.paddingContentHorizontalLG;
|
|
15
|
+
const headerButtons = headerButtonGeometry(token);
|
|
16
|
+
const handleSize = 44;
|
|
17
|
+
const handleOverhang = 10;
|
|
18
|
+
const markerSize = 12;
|
|
19
|
+
return {
|
|
20
|
+
wrap: css `
|
|
21
|
+
overflow: hidden !important;
|
|
22
|
+
|
|
23
|
+
${modalCls} {
|
|
24
|
+
display: flex;
|
|
25
|
+
max-width: none;
|
|
26
|
+
transform-origin: 50% 50% !important;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/*
|
|
30
|
+
* rc-dialog puts an unclassed wrapper div between .ant-modal and .ant-modal-content.
|
|
31
|
+
* As a flex item with width:auto it only shrink-wraps its content, so the dialog would
|
|
32
|
+
* not follow the resized width. The focus sentinels matched by the same selector keep
|
|
33
|
+
* their inline width:0, so they are not affected.
|
|
34
|
+
*/
|
|
35
|
+
${modalCls} > div {
|
|
36
|
+
width: 100%;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* the height comes from the modal state - content has to fill it and lay the parts out vertically */
|
|
40
|
+
${modalCls}-content {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
flex: 1;
|
|
44
|
+
width: 100%;
|
|
45
|
+
height: 100%;
|
|
46
|
+
/*
|
|
47
|
+
* Deliberate deviation from the antd 5 default: the content carries no vertical inset
|
|
48
|
+
* at all. The top one belongs to the title (so the whole header area can be grabbed for
|
|
49
|
+
* dragging) and the bottom one to the footer, which keeps both dividers surrounded by
|
|
50
|
+
* padding instead of glued to the text. Horizontal inset is the antd default.
|
|
51
|
+
*/
|
|
52
|
+
padding: 0 ${contentPaddingInline}px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
${modalCls}-header,
|
|
56
|
+
${modalCls}-footer {
|
|
57
|
+
flex: 0 0 auto;
|
|
58
|
+
/*
|
|
59
|
+
* When the app configures dividers (Modal headerBorderBottom / footerBorderTop
|
|
60
|
+
* tokens - d2ui does), antd draws them on the header/footer box, which is inset by
|
|
61
|
+
* the content padding. The line then stops short of the dialog edges and reads as
|
|
62
|
+
* if the content had no padding. Bleed the box out to the content edges and keep
|
|
63
|
+
* the title/buttons where they were.
|
|
64
|
+
*/
|
|
65
|
+
margin-inline: -${contentPaddingInline}px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* The header contributes no spacing of its own - all of it lives on the drag area inside
|
|
70
|
+
* (see the title style below), so every pixel down to the divider drags the dialog. The gap
|
|
71
|
+
* to the body stays at the antd default (marginXS) and sits below the divider.
|
|
72
|
+
*/
|
|
73
|
+
${modalCls}-header {
|
|
74
|
+
padding: 0;
|
|
75
|
+
margin-bottom: ${token.marginXS}px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/*
|
|
79
|
+
* Mirror of the header: the footer carries the content's bottom inset itself, so the
|
|
80
|
+
* divider has padding below it instead of sitting right on the buttons. The gap above the
|
|
81
|
+
* divider stays at the antd default (marginSM).
|
|
82
|
+
*/
|
|
83
|
+
${modalCls}-footer {
|
|
84
|
+
padding: ${token.padding}px ${contentPaddingInline}px;
|
|
85
|
+
margin-top: ${token.marginSM}px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/*
|
|
89
|
+
* The maximize button reuses antd's .ant-modal-close markup so it looks and behaves like
|
|
90
|
+
* the close button next to it (hover, focus ring, icon size); it only gets parked one
|
|
91
|
+
* button width to the left. antd positions the close button with a two-class selector, so
|
|
92
|
+
* this override has to be at least as specific.
|
|
93
|
+
*/
|
|
94
|
+
${modalCls} .ant-design-draggable-modal-maximize {
|
|
95
|
+
inset-inline-end: ${headerButtons.secondButtonInset}px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* the only part that shrinks/grows with the dialog; min-height:0 lets it actually shrink in a flex column */
|
|
99
|
+
${modalCls}-body {
|
|
100
|
+
flex: 1 1 auto;
|
|
101
|
+
min-height: 0;
|
|
102
|
+
overflow: auto;
|
|
103
|
+
}
|
|
104
|
+
`,
|
|
105
|
+
wrapWithoutFooter: css `
|
|
106
|
+
${modalCls} ${modalCls}-content {
|
|
107
|
+
padding-bottom: ${token.padding}px;
|
|
108
|
+
}
|
|
109
|
+
`,
|
|
110
|
+
title: css `
|
|
111
|
+
cursor: move;
|
|
112
|
+
user-select: none;
|
|
113
|
+
/*
|
|
114
|
+
* Carries the whole header inset - the content's vertical padding and the horizontal
|
|
115
|
+
* padding the header would otherwise have - so the entire header area is a drag handle,
|
|
116
|
+
* right up to the dialog edges and down to the divider.
|
|
117
|
+
*/
|
|
118
|
+
padding: ${token.padding}px ${contentPaddingInline}px;
|
|
119
|
+
`,
|
|
120
|
+
resizeHandle: css `
|
|
121
|
+
position: absolute;
|
|
122
|
+
right: -${handleOverhang}px;
|
|
123
|
+
bottom: -${handleOverhang}px;
|
|
124
|
+
width: ${handleSize}px;
|
|
125
|
+
height: ${handleSize}px;
|
|
126
|
+
cursor: se-resize;
|
|
127
|
+
`,
|
|
128
|
+
resizeHandleInner: css `
|
|
129
|
+
position: absolute;
|
|
130
|
+
right: ${handleOverhang + token.paddingXXS}px;
|
|
131
|
+
bottom: ${handleOverhang + token.paddingXXS}px;
|
|
132
|
+
width: ${markerSize}px;
|
|
133
|
+
height: ${markerSize}px;
|
|
134
|
+
border: ${token.lineWidthBold}px ${token.lineType} ${token.colorTextTertiary};
|
|
135
|
+
border-top: 0;
|
|
136
|
+
border-left: 0;
|
|
137
|
+
`,
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
//# sourceMappingURL=draggableModalStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draggableModalStyles.js","sourceRoot":"","sources":["../../../../../components/modal/impl/draggableModalStyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAgBxC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAwB,EAAE,EAAE;IAC7D,MAAM,IAAI,GAAG,KAAK,CAAC,aAAa,CAAC;IACjC,MAAM,YAAY,GAAG,KAAK,CAAC,kBAAkB,GAAG,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC;IAC3F,MAAM,KAAK,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IACxC,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC;IAC5B,OAAO;QAEH,iBAAiB,EAAE,KAAK,GAAG,IAAI,GAAG,GAAG;QAErC,OAAO,EAAE,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,KAAK,GAAG,IAAI,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,GAAG;KAChG,CAAA;AACL,CAAC,CAAC;AAWF,MAAM,CAAC,MAAM,uBAAuB,GAAG,YAAY,C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;AACN,CAAC,CAAC,CAAC","sourcesContent":["import {createStyles} from \"antd-style\";\n\n/** the antd tokens the header-button geometry is derived from */\ninterface HeaderButtonToken {\n controlHeight: number\n padding: number\n marginXXS: number\n lineHeightHeading5: number\n fontSizeHeading5: number\n}\n\n/**\n * Geometry of the buttons in the top-right corner of the header. Mirrors antd's own close-button\n * math (prepareToken in antd/es/modal/style) so our maximize button lines up with antd's close\n * button, and so the title knows how much room to leave for them.\n */\nexport const headerButtonGeometry = (token: HeaderButtonToken) => {\n const size = token.controlHeight;\n const headerHeight = token.lineHeightHeading5 * token.fontSizeHeading5 + token.padding * 2;\n const inset = (headerHeight - size) / 2;\n const gap = token.marginXXS;\n return {\n /** inset-inline-end of the button sitting left of the close button */\n secondButtonInset: inset + size + gap,\n /** horizontal space the title has to leave free so `count` buttons do not cover it */\n reserve: (count: number): number => count <= 0 ? 0 : inset + count * size + (count - 1) * gap,\n }\n};\n\n/**\n * Styles of the resizable/draggable modal.\n *\n * Only what dragging + resizing actually needs is defined here (flex layout so the body can\n * grow/scroll, the drag cursor on the title, the resize handle). Everything that antd 5 styles\n * through its own Modal tokens - header/footer spacing, title typography - is deliberately NOT\n * overridden, so the dialog looks like a plain antd 5 Modal. The exception is the content inset,\n * see below.\n */\nexport const useDraggableModalStyles = createStyles(({token, css, prefixCls}) => {\n const modalCls = `.${prefixCls}-modal`;\n\n // horizontal inset of the content - antd's default contentPadding, mirrored here so the\n // header/footer dividers can be bled back out to the dialog edges\n const contentPaddingInline = token.paddingContentHorizontalLG;\n\n const headerButtons = headerButtonGeometry(token);\n\n // the grab area reaches slightly outside the content so it does not sit on top of the footer buttons\n const handleSize = 44;\n const handleOverhang = 10;\n // the visible corner marker inside the grab area\n const markerSize = 12;\n\n return {\n wrap: css`\n overflow: hidden !important;\n\n ${modalCls} {\n display: flex;\n max-width: none;\n transform-origin: 50% 50% !important;\n }\n\n /*\n * rc-dialog puts an unclassed wrapper div between .ant-modal and .ant-modal-content.\n * As a flex item with width:auto it only shrink-wraps its content, so the dialog would\n * not follow the resized width. The focus sentinels matched by the same selector keep\n * their inline width:0, so they are not affected.\n */\n ${modalCls} > div {\n width: 100%;\n }\n\n /* the height comes from the modal state - content has to fill it and lay the parts out vertically */\n ${modalCls}-content {\n display: flex;\n flex-direction: column;\n flex: 1;\n width: 100%;\n height: 100%;\n /*\n * Deliberate deviation from the antd 5 default: the content carries no vertical inset\n * at all. The top one belongs to the title (so the whole header area can be grabbed for\n * dragging) and the bottom one to the footer, which keeps both dividers surrounded by\n * padding instead of glued to the text. Horizontal inset is the antd default.\n */\n padding: 0 ${contentPaddingInline}px;\n }\n\n ${modalCls}-header,\n ${modalCls}-footer {\n flex: 0 0 auto;\n /*\n * When the app configures dividers (Modal headerBorderBottom / footerBorderTop\n * tokens - d2ui does), antd draws them on the header/footer box, which is inset by\n * the content padding. The line then stops short of the dialog edges and reads as\n * if the content had no padding. Bleed the box out to the content edges and keep\n * the title/buttons where they were.\n */\n margin-inline: -${contentPaddingInline}px;\n }\n\n /*\n * The header contributes no spacing of its own - all of it lives on the drag area inside\n * (see the title style below), so every pixel down to the divider drags the dialog. The gap\n * to the body stays at the antd default (marginXS) and sits below the divider.\n */\n ${modalCls}-header {\n padding: 0;\n margin-bottom: ${token.marginXS}px;\n }\n\n /*\n * Mirror of the header: the footer carries the content's bottom inset itself, so the\n * divider has padding below it instead of sitting right on the buttons. The gap above the\n * divider stays at the antd default (marginSM).\n */\n ${modalCls}-footer {\n padding: ${token.padding}px ${contentPaddingInline}px;\n margin-top: ${token.marginSM}px;\n }\n\n /*\n * The maximize button reuses antd's .ant-modal-close markup so it looks and behaves like\n * the close button next to it (hover, focus ring, icon size); it only gets parked one\n * button width to the left. antd positions the close button with a two-class selector, so\n * this override has to be at least as specific.\n */\n ${modalCls} .ant-design-draggable-modal-maximize {\n inset-inline-end: ${headerButtons.secondButtonInset}px;\n }\n\n /* the only part that shrinks/grows with the dialog; min-height:0 lets it actually shrink in a flex column */\n ${modalCls}-body {\n flex: 1 1 auto;\n min-height: 0;\n overflow: auto;\n }\n `,\n /*\n * The bottom inset normally lives on the footer (see above). Dialogs rendered without one -\n * every NO_BUTTONS ModalDialog, and anything passing footer={null} - would otherwise have\n * their content flush against the bottom edge, so the content takes the inset back. The\n * extra selector level is needed to outweigh the padding-block: 0 above.\n */\n wrapWithoutFooter: css`\n ${modalCls} ${modalCls}-content {\n padding-bottom: ${token.padding}px;\n }\n `,\n title: css`\n cursor: move;\n user-select: none;\n /*\n * Carries the whole header inset - the content's vertical padding and the horizontal\n * padding the header would otherwise have - so the entire header area is a drag handle,\n * right up to the dialog edges and down to the divider.\n */\n padding: ${token.padding}px ${contentPaddingInline}px;\n `,\n resizeHandle: css`\n position: absolute;\n right: -${handleOverhang}px;\n bottom: -${handleOverhang}px;\n width: ${handleSize}px;\n height: ${handleSize}px;\n cursor: se-resize;\n `,\n resizeHandleInner: css`\n position: absolute;\n right: ${handleOverhang + token.paddingXXS}px;\n bottom: ${handleOverhang + token.paddingXXS}px;\n width: ${markerSize}px;\n height: ${markerSize}px;\n border: ${token.lineWidthBold}px ${token.lineType} ${token.colorTextTertiary};\n border-top: 0;\n border-left: 0;\n `,\n };\n});\n"]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
export interface ResizeHandleProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
|
|
3
|
+
innerClassName?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const ResizeHandle: ({ className, innerClassName, ...props }: ResizeHandleProps) => React.ReactElement;
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
React.createElement("div", { className:
|
|
13
|
+
export const ResizeHandle = (_a) => {
|
|
14
|
+
var { className, innerClassName } = _a, props = __rest(_a, ["className", "innerClassName"]);
|
|
15
|
+
return (React.createElement("div", Object.assign({ className: `ant-design-draggable-modal-resize-handle ${className !== null && className !== void 0 ? className : ''}` }, props),
|
|
16
|
+
React.createElement("div", { className: `ant-design-draggable-modal-resize-handle-inner ${innerClassName !== null && innerClassName !== void 0 ? innerClassName : ''}` })));
|
|
17
|
+
};
|
|
5
18
|
//# sourceMappingURL=resizeHandle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resizeHandle.js","sourceRoot":"","sources":["../../../../../components/modal/impl/resizeHandle.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"resizeHandle.js","sourceRoot":"","sources":["../../../../../components/modal/impl/resizeHandle.tsx"],"names":[],"mappings":";;;;;;;;;;;AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAwD,EAAsB,EAAE;QAAhF,EAAC,SAAS,EAAE,cAAc,OAA8B,EAAzB,KAAK,cAApC,+BAAqC,CAAD;IAA6C,OAAA,CAE1G,2CAAK,SAAS,EAAE,4CAA4C,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,EAAE,IAAM,KAAK;QACpF,6BAAK,SAAS,EAAE,kDAAkD,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,EAAE,EAAE,GAAG,CACzF,CACT,CAAA;CAAA,CAAA","sourcesContent":["// https://github.com/CUBETIQ/antd-modal/\n\nimport * as React from 'react'\n\nexport interface ResizeHandleProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {\n /** class of the visible corner marker inside the grab area */\n innerClassName?: string\n}\n\nexport const ResizeHandle = ({className, innerClassName, ...props}: ResizeHandleProps): React.ReactElement => (\n // the legacy class names are kept as styling hooks for the app (e.g. .compact-modal)\n <div className={`ant-design-draggable-modal-resize-handle ${className ?? ''}`} {...props}>\n <div className={`ant-design-draggable-modal-resize-handle-inner ${innerClassName ?? ''}`}/>\n </div>\n)\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { ModalFuncProps
|
|
2
|
+
import { ModalFuncProps } from "antd/es/modal";
|
|
3
|
+
import { DraggableModalProps } from "d2coreui/components/modal/impl";
|
|
3
4
|
import { HookAPI } from "antd/es/modal/useModal";
|
|
4
5
|
export declare const enum ModalDialogMode {
|
|
5
6
|
NO_BUTTONS = "NO_BUTTONS",
|
|
@@ -13,14 +14,8 @@ export interface ModalDialogFuncProps extends ModalFuncProps {
|
|
|
13
14
|
denyText?: string;
|
|
14
15
|
onDeny?: (...args: any[]) => any;
|
|
15
16
|
}
|
|
16
|
-
export interface ModalDialogProps extends
|
|
17
|
+
export interface ModalDialogProps extends DraggableModalProps {
|
|
17
18
|
mode: ModalDialogMode;
|
|
18
|
-
initialWidth?: number;
|
|
19
|
-
initialHeight?: number;
|
|
20
|
-
onResize?(size: {
|
|
21
|
-
width: number;
|
|
22
|
-
height: number;
|
|
23
|
-
}): void;
|
|
24
19
|
}
|
|
25
20
|
export declare class ModalDialog extends React.Component<ModalDialogProps, {}> {
|
|
26
21
|
private static modalStatic;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modalDialog.js","sourceRoot":"","sources":["../../../../components/modal/modalDialog.tsx"],"names":[],"mappings":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CAAC;QAC5D,CAAC;QACD,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;YACrC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAChC,CAAC;QAED,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,EAAE,EAAC,KAAK,EAAE,EAAC,WAAW,EAAE,CAAC,EAAC,EAAC,CAAC,CAAC;QAE1H,IAAI,IAAI,SAAuB,EAAE,CAAC;YAC9B,IAAI,CAAC,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE,EAAC,KAAK,EAAE,EAAC,KAAK,EAAE,OAAO,EAAC,EAAC,CAAC,CAAC;QAC1I,CAAC;QAED,IAAI,IAAI,oBAAkC,EAAE,CAAC;YACzC,IAAI,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;gBACzD,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC;gBACzC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;gBAC5C,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;gBAChD,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,UAAU,GAAG,aAAa,CAAC;YAC5D,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import React from \"react\";\r\nimport {Button, Modal} from \"antd\";\r\nimport {ModalFuncProps, ModalProps} from \"antd/es/modal\";\r\nimport i18n from \"d2core/i18n/i18n\";\r\nimport {DraggableModal} from \"d2coreui/components/modal/impl\";\r\nimport {HookAPI} from \"antd/es/modal/useModal\";\r\n\r\nexport const enum ModalDialogMode {\r\n NO_BUTTONS = \"NO_BUTTONS\",\r\n OK_CANCEL = \"OK_CANCEL\",\r\n YES_NO = \"YES_NO\",\r\n YES_NO_CANCEL = \"YES_NO_CANCEL\",\r\n OK = \"OK\",\r\n}\r\n\r\nexport interface ModalDialogFuncProps extends ModalFuncProps {\r\n mode: ModalDialogMode\r\n denyText?: string\r\n onDeny?: (...args: any[]) => any;\r\n}\r\n\r\nexport interface ModalDialogProps extends Omit<ModalProps, \"width\"> {\r\n mode: ModalDialogMode\r\n initialWidth?: number,\r\n initialHeight?: number\r\n\r\n // resize dialog handler\r\n onResize?(size: { width: number, height: number }): void\r\n}\r\n\r\nexport class ModalDialog extends React.Component<ModalDialogProps, {}> {\r\n private static modalStatic: HookAPI;\r\n\r\n constructor(props: Readonly<ModalDialogProps>) {\r\n super(props);\r\n }\r\n\r\n public static setModalInstance(instance: HookAPI) {\r\n ModalDialog.modalStatic = instance;\r\n }\r\n\r\n public static confirm(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.confirm : Modal.confirm;\r\n dialogHandler = method(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n public static error(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.error : Modal.error;\r\n dialogHandler = method(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n public static delete(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.confirm : Modal.confirm;\r\n if (props.okButtonProps) {\r\n props.okButtonProps.danger = true;\r\n }\r\n dialogHandler = method(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n public static success(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.success : Modal.success;\r\n dialogHandler = method(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n public static info(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.info : Modal.info;\r\n dialogHandler = method(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n render() {\r\n const modalDialogProperties = ModalDialog.getModalProperties(this.props);\r\n return (\r\n <DraggableModal {...modalDialogProperties}>\r\n {this.props.children}\r\n </DraggableModal>);\r\n }\r\n\r\n private static getModalProperties(props: ModalDialogProps) {\r\n const {mode, ...rest} = props;\r\n if (mode === ModalDialogMode.NO_BUTTONS) {\r\n if (rest.footer === undefined) {\r\n rest.footer = null;\r\n }\r\n } else {\r\n switch (mode) {\r\n case ModalDialogMode.OK_CANCEL:\r\n rest.okText = props.okText ?? i18n(\"OK\");\r\n rest.cancelText = props.cancelText ?? i18n(\"Cancel\");\r\n break;\r\n case ModalDialogMode.YES_NO:\r\n rest.okText = props.okText ?? i18n(\"Yes\");\r\n rest.cancelText = props.cancelText ?? i18n(\"No\");\r\n break;\r\n case ModalDialogMode.OK:\r\n rest.okText = props.okText ?? i18n(\"OK\");\r\n rest.cancelButtonProps = undefined;\r\n break;\r\n }\r\n\r\n rest.okButtonProps = Object.assign(rest.okButtonProps !== undefined ? rest.okButtonProps : {}, {style: {marginRight: 8}});\r\n rest.cancelButtonProps = Object.assign(rest.cancelButtonProps !== undefined ? rest.cancelButtonProps : {}, {style: {float: \"right\"}});\r\n }\r\n return rest;\r\n }\r\n\r\n private static getModalFuncProperties(props: ModalDialogFuncProps, performClose: () => void) {\r\n const {mode, denyText, onDeny, ...rest} = props;\r\n switch (mode) {\r\n case ModalDialogMode.OK_CANCEL:\r\n rest.okText = rest.okText ?? i18n(\"OK\");\r\n rest.cancelText = rest.cancelText ?? i18n(\"Cancel\");\r\n break;\r\n case ModalDialogMode.YES_NO:\r\n rest.okText = rest.okText ?? i18n(\"Yes\");\r\n rest.cancelText = rest.cancelText ?? i18n(\"No\");\r\n break;\r\n case ModalDialogMode.YES_NO_CANCEL:\r\n rest.okText = rest.okText ?? i18n(\"Yes\");\r\n rest.cancelText = (<React.Fragment>\r\n <Button onClick={(e) => {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n e.nativeEvent.stopImmediatePropagation();\r\n onDeny?.(e);\r\n performClose();\r\n }}>{denyText ?? i18n(\"No\")}</Button>\r\n <Button>{rest.cancelText ?? i18n(\"Cancel\")}</Button>\r\n </React.Fragment>\r\n );\r\n if (!rest.cancelButtonProps) {\r\n rest.cancelButtonProps = {};\r\n }\r\n rest.cancelButtonProps.type = \"text\";\r\n break;\r\n case ModalDialogMode.OK:\r\n rest.okText = props.okText ?? i18n(\"OK\");\r\n rest.cancelButtonProps = {style: {display: \"none\"}};\r\n }\r\n if (rest.autoFocusButton === undefined) {\r\n rest.autoFocusButton = \"ok\";\r\n }\r\n\r\n rest.okButtonProps = Object.assign(rest.okButtonProps !== undefined ? rest.okButtonProps : {}, {style: {marginRight: 8}});\r\n\r\n if (mode !== ModalDialogMode.OK) {\r\n rest.cancelButtonProps = Object.assign(rest.cancelButtonProps !== undefined ? rest.cancelButtonProps : {}, {style: {float: \"right\"}});\r\n }\r\n\r\n if (mode === ModalDialogMode.YES_NO_CANCEL) {\r\n if (rest.cancelButtonProps && rest.cancelButtonProps.style) {\r\n rest.cancelButtonProps.style.padding = 0;\r\n rest.cancelButtonProps.style.marginTop = -1;\r\n rest.cancelButtonProps.style.cursor = \"default\";\r\n rest.cancelButtonProps.style.background = \"transparent\";\r\n }\r\n }\r\n return rest;\r\n }\r\n}"]}
|
|
1
|
+
{"version":3,"file":"modalDialog.js","sourceRoot":"","sources":["../../../../components/modal/modalDialog.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,MAAM,CAAC;AAEnC,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,EAAC,cAAc,EAAsB,MAAM,gCAAgC,CAAC;AAGnF,MAAM,CAAN,IAAkB,eAMjB;AAND,WAAkB,eAAe;IAC7B,4CAAyB,CAAA;IACzB,0CAAuB,CAAA;IACvB,oCAAiB,CAAA;IACjB,kDAA+B,CAAA;IAC/B,4BAAS,CAAA;AACb,CAAC,EANiB,eAAe,KAAf,eAAe,QAMhC;AAYD,MAAM,OAAO,WAAY,SAAQ,KAAK,CAAC,SAA+B;IAGlE,YAAY,KAAiC;QACzC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAEM,MAAM,CAAC,gBAAgB,CAAC,QAAiB;QAC5C,WAAW,CAAC,WAAW,GAAG,QAAQ,CAAC;IACvC,CAAC;IAEM,MAAM,CAAC,OAAO,CAAC,KAA2B;QAC7C,IAAI,aAAmF,CAAC;QAC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BAAiB,IAAI,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;gBACzD,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC;gBACzC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;gBAC5C,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;gBAChD,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,UAAU,GAAG,aAAa,CAAC;YAC5D,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import React from \"react\";\r\nimport {Button, Modal} from \"antd\";\r\nimport {ModalFuncProps} from \"antd/es/modal\";\r\nimport i18n from \"d2core/i18n/i18n\";\r\nimport {DraggableModal, DraggableModalProps} from \"d2coreui/components/modal/impl\";\r\nimport {HookAPI} from \"antd/es/modal/useModal\";\r\n\r\nexport const enum ModalDialogMode {\r\n NO_BUTTONS = \"NO_BUTTONS\",\r\n OK_CANCEL = \"OK_CANCEL\",\r\n YES_NO = \"YES_NO\",\r\n YES_NO_CANCEL = \"YES_NO_CANCEL\",\r\n OK = \"OK\",\r\n}\r\n\r\nexport interface ModalDialogFuncProps extends ModalFuncProps {\r\n mode: ModalDialogMode\r\n denyText?: string\r\n onDeny?: (...args: any[]) => any;\r\n}\r\n\r\nexport interface ModalDialogProps extends DraggableModalProps {\r\n mode: ModalDialogMode\r\n}\r\n\r\nexport class ModalDialog extends React.Component<ModalDialogProps, {}> {\r\n private static modalStatic: HookAPI;\r\n\r\n constructor(props: Readonly<ModalDialogProps>) {\r\n super(props);\r\n }\r\n\r\n public static setModalInstance(instance: HookAPI) {\r\n ModalDialog.modalStatic = instance;\r\n }\r\n\r\n public static confirm(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.confirm : Modal.confirm;\r\n dialogHandler = method(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n public static error(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.error : Modal.error;\r\n dialogHandler = method(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n public static delete(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.confirm : Modal.confirm;\r\n if (props.okButtonProps) {\r\n props.okButtonProps.danger = true;\r\n }\r\n dialogHandler = method(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n public static success(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.success : Modal.success;\r\n dialogHandler = method(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n public static info(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.info : Modal.info;\r\n dialogHandler = method(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n render() {\r\n const modalDialogProperties = ModalDialog.getModalProperties(this.props);\r\n return (\r\n <DraggableModal {...modalDialogProperties}>\r\n {this.props.children}\r\n </DraggableModal>);\r\n }\r\n\r\n private static getModalProperties(props: ModalDialogProps) {\r\n const {mode, ...rest} = props;\r\n if (mode === ModalDialogMode.NO_BUTTONS) {\r\n if (rest.footer === undefined) {\r\n rest.footer = null;\r\n }\r\n } else {\r\n switch (mode) {\r\n case ModalDialogMode.OK_CANCEL:\r\n rest.okText = props.okText ?? i18n(\"OK\");\r\n rest.cancelText = props.cancelText ?? i18n(\"Cancel\");\r\n break;\r\n case ModalDialogMode.YES_NO:\r\n rest.okText = props.okText ?? i18n(\"Yes\");\r\n rest.cancelText = props.cancelText ?? i18n(\"No\");\r\n break;\r\n case ModalDialogMode.OK:\r\n rest.okText = props.okText ?? i18n(\"OK\");\r\n rest.cancelButtonProps = undefined;\r\n break;\r\n }\r\n\r\n rest.okButtonProps = Object.assign(rest.okButtonProps !== undefined ? rest.okButtonProps : {}, {style: {marginRight: 8}});\r\n rest.cancelButtonProps = Object.assign(rest.cancelButtonProps !== undefined ? rest.cancelButtonProps : {}, {style: {float: \"right\"}});\r\n }\r\n return rest;\r\n }\r\n\r\n private static getModalFuncProperties(props: ModalDialogFuncProps, performClose: () => void) {\r\n const {mode, denyText, onDeny, ...rest} = props;\r\n switch (mode) {\r\n case ModalDialogMode.OK_CANCEL:\r\n rest.okText = rest.okText ?? i18n(\"OK\");\r\n rest.cancelText = rest.cancelText ?? i18n(\"Cancel\");\r\n break;\r\n case ModalDialogMode.YES_NO:\r\n rest.okText = rest.okText ?? i18n(\"Yes\");\r\n rest.cancelText = rest.cancelText ?? i18n(\"No\");\r\n break;\r\n case ModalDialogMode.YES_NO_CANCEL:\r\n rest.okText = rest.okText ?? i18n(\"Yes\");\r\n rest.cancelText = (<React.Fragment>\r\n <Button onClick={(e) => {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n e.nativeEvent.stopImmediatePropagation();\r\n onDeny?.(e);\r\n performClose();\r\n }}>{denyText ?? i18n(\"No\")}</Button>\r\n <Button>{rest.cancelText ?? i18n(\"Cancel\")}</Button>\r\n </React.Fragment>\r\n );\r\n if (!rest.cancelButtonProps) {\r\n rest.cancelButtonProps = {};\r\n }\r\n rest.cancelButtonProps.type = \"text\";\r\n break;\r\n case ModalDialogMode.OK:\r\n rest.okText = props.okText ?? i18n(\"OK\");\r\n rest.cancelButtonProps = {style: {display: \"none\"}};\r\n }\r\n if (rest.autoFocusButton === undefined) {\r\n rest.autoFocusButton = \"ok\";\r\n }\r\n\r\n rest.okButtonProps = Object.assign(rest.okButtonProps !== undefined ? rest.okButtonProps : {}, {style: {marginRight: 8}});\r\n\r\n if (mode !== ModalDialogMode.OK) {\r\n rest.cancelButtonProps = Object.assign(rest.cancelButtonProps !== undefined ? rest.cancelButtonProps : {}, {style: {float: \"right\"}});\r\n }\r\n\r\n if (mode === ModalDialogMode.YES_NO_CANCEL) {\r\n if (rest.cancelButtonProps && rest.cancelButtonProps.style) {\r\n rest.cancelButtonProps.style.padding = 0;\r\n rest.cancelButtonProps.style.marginTop = -1;\r\n rest.cancelButtonProps.style.cursor = \"default\";\r\n rest.cancelButtonProps.style.background = \"transparent\";\r\n }\r\n }\r\n return rest;\r\n }\r\n}"]}
|
package/i18n/components.cs.json
CHANGED
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"Hidden Columns": "Skryté sloupce",
|
|
34
34
|
"Hide Column": "Skrýt sloupec",
|
|
35
35
|
"Landscape": "Na šířku",
|
|
36
|
+
"Maximize": "Maximalizovat",
|
|
36
37
|
"No records found.": "Nebyly nalezeny žádné záznamy.",
|
|
37
38
|
"No": "Ne",
|
|
38
39
|
"OK": "Potvrdit",
|
|
@@ -47,6 +48,7 @@
|
|
|
47
48
|
"Refresh": "Obnovit",
|
|
48
49
|
"Reset Columns": "Resetovat sloupce",
|
|
49
50
|
"Reset": "Resetovat",
|
|
51
|
+
"Restore": "Obnovit velikost",
|
|
50
52
|
"Revert": "Vrátit změny",
|
|
51
53
|
"Revert configuration to predefined state": "Vrátit konfiguraci do výchozího nastavení",
|
|
52
54
|
"Revert filter to original state": "Vrátit filtr do původního nastavení",
|
package/i18n/components.sk.json
CHANGED
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"Hidden Columns": "Skryté stĺpce",
|
|
34
34
|
"Hide Column": "Skryť stĺpec",
|
|
35
35
|
"Landscape": "Na šírku",
|
|
36
|
+
"Maximize": "Maximalizovať",
|
|
36
37
|
"No records found.": "Neboli nájdené žiadne záznamy.",
|
|
37
38
|
"No": "Nie",
|
|
38
39
|
"OK": "Potvrdiť",
|
|
@@ -47,6 +48,7 @@
|
|
|
47
48
|
"Refresh": "Obnoviť",
|
|
48
49
|
"Reset Columns": "Resetovať stĺpce",
|
|
49
50
|
"Reset": "Resetovať",
|
|
51
|
+
"Restore": "Obnoviť veľkosť",
|
|
50
52
|
"Revert": "Vrátiť zmeny",
|
|
51
53
|
"Revert configuration to predefined state": "Vrátiť konfiguráciu do predvoleného nastavenia",
|
|
52
54
|
"Revert filter to original state": "Vrátiť filter do pôvodného nastavenia",
|
package/i18n/components.uk.json
CHANGED
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"Hidden Columns": "Приховані колонки",
|
|
34
34
|
"Hide Column": "Сховати стовпець",
|
|
35
35
|
"Landscape": "По ширині",
|
|
36
|
+
"Maximize": "Розгорнути",
|
|
36
37
|
"No records found.": "Записів не знайдено.",
|
|
37
38
|
"No": "ні",
|
|
38
39
|
"OK": "Підтвердити",
|
|
@@ -47,6 +48,7 @@
|
|
|
47
48
|
"Refresh": "Відновити",
|
|
48
49
|
"Reset Columns": "Скинути стовпці",
|
|
49
50
|
"Reset": "Скинути",
|
|
51
|
+
"Restore": "Відновити розмір",
|
|
50
52
|
"Revert": "Скасувати зміни",
|
|
51
53
|
"Revert configuration to predefined state": "Поверніть конфігурацію до налаштувань за замовчуванням",
|
|
52
54
|
"Revert filter to original state": "Поверніть фільтр до початкових налаштувань",
|
package/package.json
CHANGED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
.ant-design-draggable-modal {
|
|
2
|
-
overflow: hidden !important;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.ant-design-draggable-modal .ant-modal {
|
|
6
|
-
display: flex;
|
|
7
|
-
max-width: none;
|
|
8
|
-
transform-origin: 50% 50% !important;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.ant-design-draggable-modal .ant-modal-content {
|
|
12
|
-
flex: 1;
|
|
13
|
-
display: flex;
|
|
14
|
-
flex-direction: column;
|
|
15
|
-
height: 100%;
|
|
16
|
-
width: 100%;
|
|
17
|
-
padding: 0;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.ant-design-draggable-modal .ant-modal-header {
|
|
21
|
-
flex: 0;
|
|
22
|
-
padding: 0;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.ant-design-draggable-modal .ant-modal-footer {
|
|
26
|
-
flex: 0;
|
|
27
|
-
padding: 16px;
|
|
28
|
-
margin-top: 0;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.ant-design-draggable-modal .ant-design-draggable-modal-title {
|
|
32
|
-
cursor: move;
|
|
33
|
-
padding: 16px;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.ant-design-draggable-modal .ant-modal-body {
|
|
37
|
-
flex: 1;
|
|
38
|
-
overflow-y: auto;
|
|
39
|
-
padding: 16px;
|
|
40
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
.ant-design-draggable-modal-resize-handle-inner {
|
|
2
|
-
width: 12px;
|
|
3
|
-
right: 14px;
|
|
4
|
-
border: 2px solid grey;
|
|
5
|
-
height: 12px;
|
|
6
|
-
bottom: 14px;
|
|
7
|
-
position: absolute;
|
|
8
|
-
border-top: 0;
|
|
9
|
-
border-left: 0;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.ant-design-draggable-modal-resize-handle {
|
|
13
|
-
right: -10px;
|
|
14
|
-
width: 44px;
|
|
15
|
-
bottom: -10px;
|
|
16
|
-
cursor: se-resize;
|
|
17
|
-
height: 44px;
|
|
18
|
-
position: absolute;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.ant-modal > div{
|
|
22
|
-
width: 100%;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.ant-modal-content {
|
|
26
|
-
resize: both;
|
|
27
|
-
}
|