dry-ux 1.51.0 → 1.53.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/dajaxice/DajaxiceProxy.test.d.ts +1 -1
- package/dist/dajaxice/Proxy.interface.d.ts +3 -3
- package/dist/error/ErrorBoundary.d.ts +1 -1
- package/dist/error/ErrorScreen.d.ts +1 -1
- package/dist/helpers/flat.d.ts +2 -2
- package/dist/helpers/flat.js +3 -2
- package/dist/helpers/utilities.d.ts +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/ui-utils/Modal.d.ts +3 -2
- package/dist/ui-utils/Modal.js +14 -6
- package/dist/ui-utils/RenderWhenVisible.d.ts +3 -1
- package/dist/ui-utils/RenderWhenVisible.js +3 -2
- package/dist/ui-utils/Spinner.d.ts +1 -1
- package/dist/ui-utils/{uiUtil.interface.d.ts → UIUtil.interface.d.ts} +21 -32
- package/dist/ui-utils/UIUtilProvider.d.ts +24 -18
- package/dist/ui-utils/UIUtilProvider.js +12 -15
- package/dist/ui-utils/UIUtilRenderer.d.ts +1 -1
- package/package.json +1 -1
- /package/dist/ui-utils/{uiUtil.interface.js → UIUtil.interface.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type Args<T = void> = {
|
|
1
|
+
export declare type Args<T = void> = {
|
|
2
2
|
args: T;
|
|
3
3
|
/**
|
|
4
4
|
* If true, it will show a loader when a Dajaxice function is called. Defaults to false.
|
|
@@ -27,9 +27,9 @@ export type Args<T = void> = {
|
|
|
27
27
|
loader?: boolean;
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
|
-
type ArgType<T> = T extends void ? Omit<Args, "args"> | void : Args<T>;
|
|
30
|
+
declare type ArgType<T> = T extends void ? Omit<Args, "args"> | void : Args<T>;
|
|
31
31
|
export declare type DajaxiceFn<TArgs = void> = <TResult = any>(args: ArgType<TArgs>) => Promise<TResult>;
|
|
32
|
-
export type MethodArgs = Partial<Args<any>>;
|
|
32
|
+
export declare type MethodArgs = Partial<Args<any>>;
|
|
33
33
|
export interface IDajaxiceProxy<TModule> {
|
|
34
34
|
modules: TModule;
|
|
35
35
|
authCheck?: {
|
|
@@ -15,7 +15,7 @@ export declare class ErrorBoundary extends React.PureComponent<IErrorBoundaryPro
|
|
|
15
15
|
error: Error;
|
|
16
16
|
};
|
|
17
17
|
componentDidCatch(error: Error, info: React.ErrorInfo): void;
|
|
18
|
-
render: () =>
|
|
18
|
+
render: () => JSX.Element & React.ReactNode;
|
|
19
19
|
private handleError;
|
|
20
20
|
private resetError;
|
|
21
21
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
export declare const ErrorScreen: React.MemoExoticComponent<() =>
|
|
2
|
+
export declare const ErrorScreen: React.MemoExoticComponent<() => JSX.Element>;
|
package/dist/helpers/flat.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type FlattenOptions = {
|
|
1
|
+
declare type FlattenOptions = {
|
|
2
2
|
delimiter?: string;
|
|
3
3
|
maxDepth?: number;
|
|
4
4
|
transformKey?: (key: any) => any;
|
|
@@ -12,7 +12,7 @@ type FlattenOptions = {
|
|
|
12
12
|
export declare function flatten(target: any, opts?: FlattenOptions): {
|
|
13
13
|
[key: string]: any;
|
|
14
14
|
};
|
|
15
|
-
type UnflattenOptions = Pick<FlattenOptions, "delimiter" | "transformKey"> & {
|
|
15
|
+
declare type UnflattenOptions = Pick<FlattenOptions, "delimiter" | "transformKey"> & {
|
|
16
16
|
overwrite?: boolean;
|
|
17
17
|
object?: boolean;
|
|
18
18
|
};
|
package/dist/helpers/flat.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.flatten =
|
|
4
|
-
exports.unflatten = unflatten;
|
|
3
|
+
exports.unflatten = exports.flatten = void 0;
|
|
5
4
|
function isBuffer(obj) {
|
|
6
5
|
return obj && obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
|
|
7
6
|
}
|
|
@@ -41,6 +40,7 @@ function flatten(target, opts) {
|
|
|
41
40
|
step(target, null, null);
|
|
42
41
|
return output;
|
|
43
42
|
}
|
|
43
|
+
exports.flatten = flatten;
|
|
44
44
|
/**
|
|
45
45
|
* Unflattens an object with the paths for keys.
|
|
46
46
|
* @param target The object to unflatten.
|
|
@@ -122,3 +122,4 @@ function unflatten(target, opts) {
|
|
|
122
122
|
});
|
|
123
123
|
return result;
|
|
124
124
|
}
|
|
125
|
+
exports.unflatten = unflatten;
|
|
@@ -48,8 +48,8 @@ export declare const insertUrlParams: (params: {
|
|
|
48
48
|
}) => void;
|
|
49
49
|
export declare const getUrlParams: <T>() => T;
|
|
50
50
|
export declare class Deferred<T> {
|
|
51
|
-
_resolve
|
|
52
|
-
_reject
|
|
51
|
+
private _resolve;
|
|
52
|
+
private _reject;
|
|
53
53
|
readonly promise: Promise<T>;
|
|
54
54
|
constructor();
|
|
55
55
|
get resolve(): (result: T) => void;
|
|
@@ -59,5 +59,5 @@ export declare const tryParseJson: <T = any>(json: string, errorValue?: {}) => {
|
|
|
59
59
|
export declare const useIsVisible: (ref: React.MutableRefObject<any>) => boolean;
|
|
60
60
|
export declare const usePubSub: <T>() => {
|
|
61
61
|
usePub: () => <TName extends keyof T, TPayload extends T[TName]>(event: TName, data?: TPayload) => void;
|
|
62
|
-
useSub: <
|
|
62
|
+
useSub: <TName_1 extends keyof T, TPayload_1 extends T[TName_1]>(event: TName_1, callback: (data: TPayload_1) => void) => () => void;
|
|
63
63
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { useUIUtilContext as useDryUxContext, UIUtilContext as DryUXContext } from "./ui-utils/UIUtilProvider";
|
|
2
2
|
export { UIUtilRenderer as DryUXRenderer } from "./ui-utils/UIUtilRenderer";
|
|
3
3
|
export { Money as Money } from "./ui-utils/Money";
|
|
4
|
-
export * from "./ui-utils/
|
|
4
|
+
export * from "./ui-utils/UIUtil.interface";
|
|
5
5
|
export { DryUXProvider } from "./provider";
|
|
6
6
|
export * from "./helpers/utilities";
|
|
7
7
|
export * from "./helpers/logger";
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ var UIUtilRenderer_1 = require("./ui-utils/UIUtilRenderer");
|
|
|
22
22
|
Object.defineProperty(exports, "DryUXRenderer", { enumerable: true, get: function () { return UIUtilRenderer_1.UIUtilRenderer; } });
|
|
23
23
|
var Money_1 = require("./ui-utils/Money");
|
|
24
24
|
Object.defineProperty(exports, "Money", { enumerable: true, get: function () { return Money_1.Money; } });
|
|
25
|
-
__exportStar(require("./ui-utils/
|
|
25
|
+
__exportStar(require("./ui-utils/UIUtil.interface"), exports);
|
|
26
26
|
var provider_1 = require("./provider");
|
|
27
27
|
Object.defineProperty(exports, "DryUXProvider", { enumerable: true, get: function () { return provider_1.DryUXProvider; } });
|
|
28
28
|
__exportStar(require("./helpers/utilities"), exports);
|
package/dist/ui-utils/Modal.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { PopUpOptions } from "./UIUtil.interface";
|
|
3
3
|
export interface IModalProps {
|
|
4
|
-
options:
|
|
4
|
+
options: PopUpOptions;
|
|
5
5
|
handleClose: () => void;
|
|
6
6
|
shown: boolean;
|
|
7
7
|
config: {
|
|
@@ -10,6 +10,7 @@ export interface IModalProps {
|
|
|
10
10
|
};
|
|
11
11
|
defaultModalStyles?: boolean;
|
|
12
12
|
setBackdropHeight?: boolean;
|
|
13
|
+
centered?: boolean;
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
16
|
declare const Modal: React.FC<IModalProps & {
|
package/dist/ui-utils/Modal.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const React = require("react");
|
|
4
4
|
const react_bootstrap_1 = require("react-bootstrap");
|
|
5
|
-
const Modal = React.memo(({ handleClose, shown, options: { content, footerContent, cssClass, closeBtn, title, width, onClose, titleCloseBtn = true }, config: { defaultModalStyles = false, styles = {}, setBackdropHeight = true }, }) => {
|
|
5
|
+
const Modal = React.memo(({ handleClose, shown, options: { content, footerContent, cssClass, closeBtn, title, width, onClose, titleCloseBtn = true, centered }, config: { defaultModalStyles = false, styles = {}, setBackdropHeight = true, centered: globalCentered }, }) => {
|
|
6
|
+
const isCentered = centered !== null && centered !== void 0 ? centered : globalCentered;
|
|
6
7
|
const applyStyles = React.useCallback(() => {
|
|
7
8
|
document.querySelectorAll(".modal-dialog").forEach((el) => {
|
|
8
9
|
el.style.width = typeof width == "number" ? `${width}px` : width;
|
|
@@ -12,6 +13,13 @@ const Modal = React.memo(({ handleClose, shown, options: { content, footerConten
|
|
|
12
13
|
el.querySelectorAll(".modal-header").forEach((el) => (el.style.display = "block"));
|
|
13
14
|
el.querySelectorAll(".modal-title").forEach((el) => (el.style.marginTop = "0"));
|
|
14
15
|
}
|
|
16
|
+
if (isCentered) {
|
|
17
|
+
el.style.position = "absolute";
|
|
18
|
+
el.style.transform = "translate(-50%, -50%)";
|
|
19
|
+
el.style.top = "50%";
|
|
20
|
+
el.style.left = "50%";
|
|
21
|
+
el.style.marginTop = "unset";
|
|
22
|
+
}
|
|
15
23
|
});
|
|
16
24
|
document.querySelectorAll("[role=dialog]").forEach((el) => (el.style.opacity = "1"));
|
|
17
25
|
if (setBackdropHeight) {
|
|
@@ -26,24 +34,24 @@ const Modal = React.memo(({ handleClose, shown, options: { content, footerConten
|
|
|
26
34
|
});
|
|
27
35
|
});
|
|
28
36
|
});
|
|
29
|
-
}, [width, defaultModalStyles]);
|
|
37
|
+
}, [width, defaultModalStyles, isCentered, styles, setBackdropHeight]);
|
|
30
38
|
React.useEffect(() => {
|
|
31
39
|
if (shown) {
|
|
32
40
|
applyStyles();
|
|
33
41
|
}
|
|
34
42
|
}, [shown, width, defaultModalStyles]);
|
|
35
|
-
const
|
|
43
|
+
const onHide = () => {
|
|
36
44
|
handleClose();
|
|
37
45
|
onClose && onClose();
|
|
38
46
|
};
|
|
39
47
|
const contentToRender = typeof content == "string" ? React.createElement("div", { dangerouslySetInnerHTML: { __html: content } }) : content;
|
|
40
48
|
const showFooter = closeBtn || footerContent;
|
|
41
|
-
return (React.createElement(react_bootstrap_1.Modal, { onHide:
|
|
42
|
-
!!title && (React.createElement(react_bootstrap_1.Modal.Header, { closeButton: titleCloseBtn, onHide:
|
|
49
|
+
return (React.createElement(react_bootstrap_1.Modal, { onHide: onHide, show: shown, animation: true, autoFocus: true, keyboard: false, className: cssClass, backdropStyle: { zIndex: 1040, opacity: 0.5 }, backdrop: "static" },
|
|
50
|
+
!!title && (React.createElement(react_bootstrap_1.Modal.Header, { closeButton: titleCloseBtn, onHide: onHide },
|
|
43
51
|
React.createElement(react_bootstrap_1.Modal.Title, null, title))),
|
|
44
52
|
React.createElement(react_bootstrap_1.Modal.Body, null, contentToRender),
|
|
45
53
|
showFooter && (React.createElement(react_bootstrap_1.Modal.Footer, null,
|
|
46
54
|
footerContent,
|
|
47
|
-
closeBtn && (React.createElement(react_bootstrap_1.Button, { bsClass: "btn btn-danger", onClick:
|
|
55
|
+
closeBtn && (React.createElement(react_bootstrap_1.Button, { bsClass: "btn btn-danger", onClick: onHide }, "Close"))))));
|
|
48
56
|
});
|
|
49
57
|
exports.default = Modal;
|
|
@@ -3,14 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RenderWhenVisible = void 0;
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const utilities_1 = require("../helpers/utilities");
|
|
6
|
-
exports.RenderWhenVisible = React.memo(({
|
|
6
|
+
exports.RenderWhenVisible = React.memo(({ children, minHeight, onLoad }) => {
|
|
7
7
|
const [isLoaded, setIsLoaded] = React.useState(false);
|
|
8
8
|
const ref = React.useRef(null);
|
|
9
9
|
const isVisible = (0, utilities_1.useIsVisible)(ref);
|
|
10
10
|
React.useEffect(() => {
|
|
11
11
|
if (!isLoaded && isVisible) {
|
|
12
12
|
setIsLoaded(true);
|
|
13
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad();
|
|
13
14
|
}
|
|
14
15
|
}, [isVisible]);
|
|
15
|
-
return React.createElement("div", { ref: ref }, isLoaded &&
|
|
16
|
+
return (React.createElement("div", { style: { minHeight }, ref: ref }, isLoaded && children));
|
|
16
17
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
export declare const Spinner: React.MemoExoticComponent<() =>
|
|
2
|
+
export declare const Spinner: React.MemoExoticComponent<() => JSX.Element>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare type PopUp = {
|
|
2
3
|
/**
|
|
3
4
|
* Hides the modal.
|
|
4
5
|
*/
|
|
@@ -11,8 +12,8 @@ export interface IModalCreate {
|
|
|
11
12
|
* Removes the modal.
|
|
12
13
|
*/
|
|
13
14
|
remove: () => void;
|
|
14
|
-
}
|
|
15
|
-
export type
|
|
15
|
+
};
|
|
16
|
+
export declare type PopUpOptions = {
|
|
16
17
|
/**
|
|
17
18
|
* The content of the modal.
|
|
18
19
|
*/
|
|
@@ -49,10 +50,13 @@ export type ModalOptions = {
|
|
|
49
50
|
* If true, the modal will be destroyed when it is closed.
|
|
50
51
|
*/
|
|
51
52
|
destroyOnClose?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* If true, the modal will be centered vertically.
|
|
55
|
+
*/
|
|
56
|
+
centered?: boolean;
|
|
52
57
|
};
|
|
53
|
-
export type
|
|
54
|
-
export type
|
|
55
|
-
export interface IUtilModalAction {
|
|
58
|
+
export declare type ButtonType = "primary" | "info" | "success" | "warning" | "danger";
|
|
59
|
+
export declare type PopUpAction = {
|
|
56
60
|
/**
|
|
57
61
|
* The content to display in the modal.
|
|
58
62
|
*/
|
|
@@ -69,25 +73,25 @@ export interface IUtilModalAction {
|
|
|
69
73
|
* If true, the modal will be closed when the button is clicked.
|
|
70
74
|
*/
|
|
71
75
|
closeOnClick?: boolean;
|
|
72
|
-
}
|
|
73
|
-
export
|
|
76
|
+
};
|
|
77
|
+
export declare type UIUtilModal = {
|
|
74
78
|
/**
|
|
75
79
|
* Creates a non-unique modal.
|
|
76
80
|
* @param options The options for the modal.
|
|
77
81
|
*/
|
|
78
|
-
show: (options:
|
|
82
|
+
show: (options: PopUpOptions) => PopUp;
|
|
79
83
|
/**
|
|
80
84
|
* Creates a unique (by id) modal
|
|
81
85
|
* @param id The id of the modal.
|
|
82
86
|
* @param options The options for the modal.
|
|
83
87
|
*/
|
|
84
|
-
create: (id: string, options:
|
|
88
|
+
create: (id: string, options: PopUpOptions) => PopUp;
|
|
85
89
|
/**
|
|
86
90
|
* Dictionary of modal instances in memory.
|
|
87
91
|
*/
|
|
88
92
|
instances: {
|
|
89
93
|
[id: string]: {
|
|
90
|
-
options:
|
|
94
|
+
options: PopUpOptions;
|
|
91
95
|
shown: boolean;
|
|
92
96
|
handleClose: (id: string, shown: boolean, destroyOnClose: boolean) => void;
|
|
93
97
|
};
|
|
@@ -95,26 +99,26 @@ export interface IUIUtilModal {
|
|
|
95
99
|
/**
|
|
96
100
|
* Gets the current modal instance.
|
|
97
101
|
*/
|
|
98
|
-
getCurrent: () =>
|
|
102
|
+
getCurrent: () => PopUp;
|
|
99
103
|
/**
|
|
100
104
|
* Shows an alert style modal.
|
|
101
105
|
* @param content The content to display in the modal.
|
|
102
106
|
*/
|
|
103
|
-
showAlert: (content:
|
|
107
|
+
showAlert: (content: PopUpOptions["content"], onClose?: PopUpOptions["onClose"]) => PopUp;
|
|
104
108
|
/**
|
|
105
109
|
* Shows a confirm style modal.
|
|
106
110
|
* @param options The options for the modal.
|
|
107
111
|
* @param onYes The function to call when the yes button is clicked.
|
|
108
112
|
* @param onNo The function to call when the no button is clicked.
|
|
109
113
|
*/
|
|
110
|
-
showConfirm: (options:
|
|
114
|
+
showConfirm: (options: PopUpOptions, onYes: () => void, onNo?: () => void) => PopUp;
|
|
111
115
|
/**
|
|
112
116
|
* Shows a modal with custom actions.
|
|
113
117
|
* @param options The options for the modal.
|
|
114
118
|
* @param actions The actions to display in the modal.
|
|
115
119
|
*/
|
|
116
|
-
showActions: (options:
|
|
117
|
-
}
|
|
120
|
+
showActions: (options: PopUpOptions, actions: PopUpAction[]) => PopUp;
|
|
121
|
+
};
|
|
118
122
|
export interface IUIUtilLoader {
|
|
119
123
|
/**
|
|
120
124
|
* Status of the loader.
|
|
@@ -129,19 +133,4 @@ export interface IUIUtilLoader {
|
|
|
129
133
|
*/
|
|
130
134
|
hide: () => void;
|
|
131
135
|
}
|
|
132
|
-
export
|
|
133
|
-
/**
|
|
134
|
-
* Shows an alert.
|
|
135
|
-
* @param message The message to display in the alert.
|
|
136
|
-
* @param alertType The type of alert to display.
|
|
137
|
-
* @param position The position of the alert.
|
|
138
|
-
* @param bindToElement The element to bind the alert to.
|
|
139
|
-
*/
|
|
140
|
-
show: (message: string, alertType?: AlertType, position?: string, bindToElement?: any) => void;
|
|
141
|
-
/**
|
|
142
|
-
* Shows an alert using Noty library.
|
|
143
|
-
* @param message The message to display in the alert.
|
|
144
|
-
* @param alertType The type of alert to display.
|
|
145
|
-
*/
|
|
146
|
-
showNoty: (message: string, alertType: AlertType) => void;
|
|
147
|
-
}
|
|
136
|
+
export declare type UIUtilPrompt = Pick<UIUtilModal, "showConfirm" | "showActions" | "instances" | "getCurrent">;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { IUIUtilLoader, UIUtilModal, PopUp, PopUpAction, PopUpOptions, UIUtilPrompt } from "./UIUtil.interface";
|
|
3
3
|
import "../types";
|
|
4
4
|
export interface IUIUtilProviderState {
|
|
5
|
-
modal:
|
|
6
|
-
|
|
5
|
+
modal: UIUtilModal;
|
|
6
|
+
prompt: UIUtilPrompt;
|
|
7
7
|
customLoader: IUIUtilLoader;
|
|
8
8
|
loader: Pick<IUIUtilLoader, "show" | "hide">;
|
|
9
9
|
}
|
|
@@ -14,23 +14,19 @@ export declare class UIUtilProvider extends React.PureComponent<{}, IUIUtilProvi
|
|
|
14
14
|
constructor(props: any);
|
|
15
15
|
get modalDefaults(): {
|
|
16
16
|
create: any;
|
|
17
|
-
show: (options:
|
|
18
|
-
getCurrent: () =>
|
|
19
|
-
showAlert: (content:
|
|
20
|
-
showConfirm: (options:
|
|
21
|
-
showActions: (options:
|
|
17
|
+
show: (options: PopUpOptions) => PopUp;
|
|
18
|
+
getCurrent: () => PopUp;
|
|
19
|
+
showAlert: (content: PopUpOptions["content"], onClose?: PopUpOptions["onClose"]) => PopUp;
|
|
20
|
+
showConfirm: (options: PopUpOptions, onYes: () => void, onNo?: () => void) => PopUp;
|
|
21
|
+
showActions: (options: PopUpOptions, actions: PopUpAction[]) => PopUp;
|
|
22
22
|
instances: {
|
|
23
23
|
[id: string]: {
|
|
24
|
-
options:
|
|
24
|
+
options: PopUpOptions;
|
|
25
25
|
shown: boolean;
|
|
26
26
|
handleClose: (id: string, shown: boolean, destroyOnClose: boolean) => void;
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
|
-
get alertDefaults(): {
|
|
31
|
-
show: any;
|
|
32
|
-
showNoty: any;
|
|
33
|
-
};
|
|
34
30
|
get customLoaderDefaults(): {
|
|
35
31
|
show: () => void;
|
|
36
32
|
hide: () => void;
|
|
@@ -40,11 +36,21 @@ export declare class UIUtilProvider extends React.PureComponent<{}, IUIUtilProvi
|
|
|
40
36
|
show: () => void;
|
|
41
37
|
hide: () => void;
|
|
42
38
|
};
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
get promptDefaults(): {
|
|
40
|
+
getCurrent: () => PopUp;
|
|
41
|
+
showConfirm: (options: PopUpOptions, onYes: () => void, onNo?: () => void) => PopUp;
|
|
42
|
+
showActions: (options: PopUpOptions, actions: PopUpAction[]) => PopUp;
|
|
43
|
+
instances: {
|
|
44
|
+
[id: string]: {
|
|
45
|
+
options: PopUpOptions;
|
|
46
|
+
shown: boolean;
|
|
47
|
+
handleClose: (id: string, shown: boolean, destroyOnClose: boolean) => void;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
45
51
|
toggleModalInstance(id: string, shown: boolean, destroyOnClose?: boolean): void;
|
|
46
52
|
removeModalInstance(id: string): void;
|
|
47
|
-
getCurrentModal(id: string):
|
|
48
|
-
createModal(id: string, options:
|
|
49
|
-
render():
|
|
53
|
+
getCurrentModal(id: string): PopUp;
|
|
54
|
+
createModal(id: string, options: PopUpOptions): PopUp;
|
|
55
|
+
render(): JSX.Element;
|
|
50
56
|
}
|
|
@@ -15,9 +15,11 @@ const defaultState = {
|
|
|
15
15
|
showConfirm: null,
|
|
16
16
|
showActions: null,
|
|
17
17
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
prompt: {
|
|
19
|
+
showConfirm: null,
|
|
20
|
+
showActions: null,
|
|
21
|
+
instances: {},
|
|
22
|
+
getCurrent: null,
|
|
21
23
|
},
|
|
22
24
|
customLoader: {
|
|
23
25
|
shown: false,
|
|
@@ -36,7 +38,7 @@ class UIUtilProvider extends React.PureComponent {
|
|
|
36
38
|
constructor(props) {
|
|
37
39
|
super(props);
|
|
38
40
|
this.loader = Loader_1.Loader.getInstance();
|
|
39
|
-
this.state = Object.assign(Object.assign({}, defaultState), { modal: this.modalDefaults,
|
|
41
|
+
this.state = Object.assign(Object.assign({}, defaultState), { modal: this.modalDefaults, customLoader: this.customLoaderDefaults, loader: this.loaderDefaults, prompt: this.promptDefaults });
|
|
40
42
|
}
|
|
41
43
|
get modalDefaults() {
|
|
42
44
|
return Object.assign(Object.assign({}, defaultState.modal), { create: this.createModal.bind(this), show: (options) => this.createModal(null, options), getCurrent: () => {
|
|
@@ -59,12 +61,6 @@ class UIUtilProvider extends React.PureComponent {
|
|
|
59
61
|
closeOnClick && this.toggleModalInstance("actions", false, true);
|
|
60
62
|
} }, content))))) })) });
|
|
61
63
|
}
|
|
62
|
-
get alertDefaults() {
|
|
63
|
-
return {
|
|
64
|
-
show: this.showNotifyAlert.bind(this),
|
|
65
|
-
showNoty: this.showNoty.bind(this),
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
64
|
get customLoaderDefaults() {
|
|
69
65
|
return Object.assign(Object.assign({}, defaultState.customLoader), { show: () => this.setState({
|
|
70
66
|
customLoader: Object.assign(Object.assign({}, this.state.customLoader), { shown: true }),
|
|
@@ -75,11 +71,12 @@ class UIUtilProvider extends React.PureComponent {
|
|
|
75
71
|
get loaderDefaults() {
|
|
76
72
|
return Object.assign(Object.assign({}, defaultState.loader), { show: () => this.loader.show(), hide: () => this.loader.hide() });
|
|
77
73
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
74
|
+
get promptDefaults() {
|
|
75
|
+
return Object.assign(Object.assign({}, defaultState.prompt), { getCurrent: () => {
|
|
76
|
+
const { prompt: { instances }, } = this.state;
|
|
77
|
+
const id = Object.keys(instances).find(id => instances[id].shown);
|
|
78
|
+
return this.getCurrentModal(id);
|
|
79
|
+
} });
|
|
83
80
|
}
|
|
84
81
|
toggleModalInstance(id, shown, destroyOnClose = false) {
|
|
85
82
|
const { modal: { instances }, } = this.state;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { IModalProps } from "./Modal";
|
|
3
|
-
export type UIUtilRendererProps = {
|
|
3
|
+
export declare type UIUtilRendererProps = {
|
|
4
4
|
modalConfig?: IModalProps["config"];
|
|
5
5
|
};
|
|
6
6
|
export declare const UIUtilRenderer: React.FC<UIUtilRendererProps>;
|
package/package.json
CHANGED
|
File without changes
|