dry-ux 1.25.0 → 1.27.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/helpers/DajaxiceProxy.d.ts +3 -2
- package/dist/helpers/DajaxiceProxy.test.d.ts +2 -1
- package/dist/helpers/DajaxiceProxy.test.js +3 -0
- package/dist/ui-utils/Modal.js +5 -2
- package/dist/ui-utils/UIUtilProvider.js +8 -8
- package/dist/ui-utils/uiUtil.interface.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
declare type Args<T> = {
|
|
2
|
-
args
|
|
2
|
+
args: T;
|
|
3
3
|
skipAuthCheck?: boolean;
|
|
4
4
|
};
|
|
5
5
|
declare type Result<T = void> = T extends void ? Promise<any> : Promise<T>;
|
|
6
|
-
|
|
6
|
+
declare type ArgType<T> = T extends void ? Omit<Args<any>, "args"> | void : Args<T>;
|
|
7
|
+
export declare type DajaxiceFn<TArgs = void> = <TResult = void>(args: ArgType<TArgs>) => Result<TResult>;
|
|
7
8
|
/**
|
|
8
9
|
* This function is used to create a type safe proxy for the Dajaxice functions.
|
|
9
10
|
* @param modules: The modules object from the Dajaxice generated file.
|
package/dist/ui-utils/Modal.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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, cssClass, closeBtn, title, width, onClose, titleCloseBtn = true } }) => {
|
|
5
|
+
const Modal = React.memo(({ handleClose, shown, options: { content, footerContent, cssClass, closeBtn, title, width, onClose, titleCloseBtn = true }, }) => {
|
|
6
6
|
React.useEffect(() => {
|
|
7
7
|
if (shown) {
|
|
8
8
|
$(".modal-dialog").css("width", width);
|
|
@@ -15,10 +15,13 @@ const Modal = React.memo(({ handleClose, shown, options: { content, cssClass, cl
|
|
|
15
15
|
onClose && onClose();
|
|
16
16
|
};
|
|
17
17
|
const contentToRender = typeof content == "string" ? React.createElement("div", { dangerouslySetInnerHTML: { __html: content } }) : content;
|
|
18
|
+
const showFooter = closeBtn || footerContent;
|
|
18
19
|
return (React.createElement(react_bootstrap_1.Modal, { onHide: hide, show: shown, animation: true, autoFocus: true, keyboard: false, className: cssClass, backdropStyle: { zIndex: 1040, opacity: 0.5 }, backdrop: "static" },
|
|
19
20
|
!!title && (React.createElement(react_bootstrap_1.Modal.Header, { closeButton: titleCloseBtn, onHide: hide },
|
|
20
21
|
React.createElement(react_bootstrap_1.Modal.Title, null, title))),
|
|
21
22
|
React.createElement(react_bootstrap_1.Modal.Body, null, contentToRender),
|
|
22
|
-
React.createElement(react_bootstrap_1.Modal.Footer, null,
|
|
23
|
+
showFooter && (React.createElement(react_bootstrap_1.Modal.Footer, null,
|
|
24
|
+
footerContent,
|
|
25
|
+
closeBtn && (React.createElement(react_bootstrap_1.Button, { bsClass: "btn btn-danger", onClick: hide }, "Close"))))));
|
|
23
26
|
});
|
|
24
27
|
exports.default = Modal;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.UIUtilProvider = exports.useUIUtilContext = exports.UIUtilContext = void 0;
|
|
4
4
|
const React = require("react");
|
|
5
5
|
require("../types");
|
|
6
|
+
const react_bootstrap_1 = require("react-bootstrap");
|
|
6
7
|
const defaultState = {
|
|
7
8
|
modal: {
|
|
8
9
|
show: null,
|
|
@@ -41,16 +42,15 @@ class UIUtilProvider extends React.PureComponent {
|
|
|
41
42
|
destroyOnClose: true,
|
|
42
43
|
closeBtn: true,
|
|
43
44
|
width: 400,
|
|
44
|
-
}), showConfirm: (options, onYes, onNo) => this.createModal("confirm", Object.assign(Object.assign({}, options), {
|
|
45
|
-
options.
|
|
46
|
-
React.createElement(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
React.createElement("div", { className: "text-center mtop" }, actions.map(({ content, type = "success", closeOnClick, onClick }, index) => (React.createElement("button", { className: `btn btn-${type} mright`, onClick: () => {
|
|
45
|
+
}), showConfirm: (options, onYes, onNo) => this.createModal("confirm", Object.assign(Object.assign({}, options), { footerContent: (React.createElement(React.Fragment, null,
|
|
46
|
+
options.footerContent,
|
|
47
|
+
React.createElement(react_bootstrap_1.Button, { bsClass: "btn btn-success mright", onClick: onYes }, "Yes"),
|
|
48
|
+
React.createElement(react_bootstrap_1.Button, { bsClass: "btn btn-danger", onClick: () => (onNo ? onNo() : this.toggleModalInstance("confirm", false, true)) }, "No"))) })), showActions: (options, actions) => this.createModal("actions", Object.assign(Object.assign({}, options), { footerContent: (React.createElement(React.Fragment, null,
|
|
49
|
+
options.footerContent,
|
|
50
|
+
actions.map(({ content, type = "success", closeOnClick, onClick }, index) => (React.createElement(react_bootstrap_1.Button, { bsClass: `btn btn-${type} mright`, onClick: () => {
|
|
51
51
|
onClick && onClick();
|
|
52
52
|
closeOnClick && this.toggleModalInstance("actions", false, true);
|
|
53
|
-
} }, content)))))
|
|
53
|
+
} }, content))))) })) });
|
|
54
54
|
}
|
|
55
55
|
get alertDefaults() {
|
|
56
56
|
return {
|