react-dialogger 1.1.115 → 1.1.117
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/DialogBase.js +7 -4
- package/components/DialogContent.js +2 -2
- package/components/DialogContentFooter.js +5 -4
- package/components/DialogContentHeader.d.ts +2 -2
- package/components/DialogContentHeader.js +17 -3
- package/context/WithHeaderFooterContext.js +1 -0
- package/package.json +1 -1
- package/types/DialogActionTypes.d.ts +6 -2
- package/types/DialogTypes.d.ts +1 -1
package/components/DialogBase.js
CHANGED
|
@@ -86,7 +86,7 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
86
86
|
return _this._actionRefs[key];
|
|
87
87
|
};
|
|
88
88
|
_this.setInProcess = function (process, message, holder) {
|
|
89
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
89
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
90
90
|
_this._inProcess = __assign({ inProcess: process }, message ? { message: message } : {});
|
|
91
91
|
if (!process) {
|
|
92
92
|
_this._holder = null;
|
|
@@ -123,14 +123,17 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
123
123
|
if (!process) {
|
|
124
124
|
_this.snackbar.close("kInProcess");
|
|
125
125
|
}
|
|
126
|
-
for (var _i = 0,
|
|
127
|
-
var listener =
|
|
126
|
+
for (var _i = 0, _m = _this._processingListeners; _i < _m.length; _i++) {
|
|
127
|
+
var listener = _m[_i];
|
|
128
128
|
if (typeof listener === "function") {
|
|
129
129
|
listener(process);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
+
console.log('setInProcess_process', process);
|
|
132
133
|
// @ts-ignore
|
|
133
|
-
(_k = _this._footerRef.current) === null || _k === void 0 ? void 0 : _k.setProcessing(
|
|
134
|
+
(_k = _this._footerRef.current) === null || _k === void 0 ? void 0 : _k.setProcessing(_this._inProcess);
|
|
135
|
+
(_l = _this._headerRef.current) === null || _l === void 0 ? void 0 : _l.setProcessing(_this._inProcess);
|
|
136
|
+
// this._footerRef.current?.setProcessing(process);
|
|
134
137
|
return _this;
|
|
135
138
|
};
|
|
136
139
|
_this.isInProcess = function () {
|
|
@@ -74,7 +74,7 @@ var appLogger_1 = require("../helpers/appLogger");
|
|
|
74
74
|
var DialogContent = function (props) {
|
|
75
75
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
76
76
|
var firstUpdate = React.useRef(true);
|
|
77
|
-
var _h = (0, react_1.useContext)(_context_1.DialogContentContext), dialog = _h.dialog, dialogRef = _h.dialogRef, prevDialogRect = _h.prevDialogRect, backdropRef = _h.backdropRef, snackbarRef = _h.snackbarRef, footerRef = _h.footerRef, resizeableObject = _h.resizeableObject, body = _h.body;
|
|
77
|
+
var _h = (0, react_1.useContext)(_context_1.DialogContentContext), dialog = _h.dialog, dialogRef = _h.dialogRef, prevDialogRect = _h.prevDialogRect, backdropRef = _h.backdropRef, snackbarRef = _h.snackbarRef, footerRef = _h.footerRef, headerRef = _h.headerRef, resizeableObject = _h.resizeableObject, body = _h.body;
|
|
78
78
|
var dialogOptions = dialog.dialogOptions;
|
|
79
79
|
var baseOptions = dialogOptions.base;
|
|
80
80
|
var _j = React.useState(false), fullscreenMode = _j[0], setFullscreenMode = _j[1];
|
|
@@ -177,7 +177,7 @@ var DialogContent = function (props) {
|
|
|
177
177
|
// @ts-ignore
|
|
178
178
|
dialog.props.keyboardListener(e.key, _this);
|
|
179
179
|
}
|
|
180
|
-
}, className: baseOptions.size.width === 'auto' ? 'auto' : "dialog-width-".concat(dialogOptions.base.size.width, " dialog-main show-opacity show-position-").concat(baseOptions.initialAnchor.vertical), style: __assign(__assign(__assign(__assign({ height: (_b = baseOptions.size.height) !== null && _b !== void 0 ? _b : 'auto' }, typeof baseOptions.size.width === "number" ? { width: "".concat(baseOptions.size.width, "px") } : { width: "".concat(baseOptions.size.width) }), { outline: 'none', fontFamily: (_c = baseOptions.style.fontFamily) !== null && _c !== void 0 ? _c : 'Arial' }), rect), { alignSelf: (_d = baseOptions.initialAnchor.vertical) !== null && _d !== void 0 ? _d : 'flex-start', justifySelf: (_e = baseOptions.initialAnchor.horizontal) !== null && _e !== void 0 ? _e : 'flex-start' }), children: (0, jsx_runtime_1.jsxs)(notistack_1.SnackbarProvider, { ref: snackbarRef, maxSnack: dialog.dialogOptions.snackbar.maxSnack, style: __assign({ width: 'min-content' }, (_g = (_f = dialog.dialogOptions) === null || _f === void 0 ? void 0 : _f.snackbar) === null || _g === void 0 ? void 0 : _g.style), children: [(dialog.props.header || dialogOptions.slot.header) && ((0, jsx_runtime_1.jsx)(_1.DialogContentHeader, { header: dialog.props.header, bounds: bounds })), (0, jsx_runtime_1.jsx)(_1.DialogContentBody, { body: body }), (0, jsx_runtime_1.jsx)(_1.DialogContentFooter, { ref: footerRef }), (baseOptions.resizeable) &&
|
|
180
|
+
}, className: baseOptions.size.width === 'auto' ? 'auto' : "dialog-width-".concat(dialogOptions.base.size.width, " dialog-main show-opacity show-position-").concat(baseOptions.initialAnchor.vertical), style: __assign(__assign(__assign(__assign({ height: (_b = baseOptions.size.height) !== null && _b !== void 0 ? _b : 'auto' }, typeof baseOptions.size.width === "number" ? { width: "".concat(baseOptions.size.width, "px") } : { width: "".concat(baseOptions.size.width) }), { outline: 'none', fontFamily: (_c = baseOptions.style.fontFamily) !== null && _c !== void 0 ? _c : 'Arial' }), rect), { alignSelf: (_d = baseOptions.initialAnchor.vertical) !== null && _d !== void 0 ? _d : 'flex-start', justifySelf: (_e = baseOptions.initialAnchor.horizontal) !== null && _e !== void 0 ? _e : 'flex-start' }), children: (0, jsx_runtime_1.jsxs)(notistack_1.SnackbarProvider, { ref: snackbarRef, maxSnack: dialog.dialogOptions.snackbar.maxSnack, style: __assign({ width: 'min-content' }, (_g = (_f = dialog.dialogOptions) === null || _f === void 0 ? void 0 : _f.snackbar) === null || _g === void 0 ? void 0 : _g.style), children: [(dialog.props.header || dialogOptions.slot.header) && ((0, jsx_runtime_1.jsx)(_1.DialogContentHeader, { ref: headerRef, header: dialog.props.header, bounds: bounds })), (0, jsx_runtime_1.jsx)(_1.DialogContentBody, { body: body }), (0, jsx_runtime_1.jsx)(_1.DialogContentFooter, { ref: footerRef }), (baseOptions.resizeable) &&
|
|
181
181
|
(0, jsx_runtime_1.jsx)(React.Fragment, { children: (0, jsx_runtime_1.jsx)("div", { className: "resizable-handle", style: {
|
|
182
182
|
zIndex: parseInt(domZIndex) + 1
|
|
183
183
|
}, onMouseDown: resizeableObject === null || resizeableObject === void 0 ? void 0 : resizeableObject.resizeHandleMouseDown, children: (0, jsx_runtime_1.jsx)(_icons_1.ResizeIcon, { color: '#286e94' }) }) })] }) }) });
|
|
@@ -58,15 +58,16 @@ var DialogContentFooter = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
58
58
|
var dialogOptions = dialog.dialogOptions;
|
|
59
59
|
var CustomFooter = (_a = dialogOptions.slot) === null || _a === void 0 ? void 0 : _a.footer;
|
|
60
60
|
// Imperative handle
|
|
61
|
-
var _d = React.useState(
|
|
61
|
+
var _d = React.useState({
|
|
62
|
+
inProcess: false
|
|
63
|
+
}), inProcess = _d[0], setInProcess = _d[1];
|
|
62
64
|
var inProcessRef = React.useRef(inProcess);
|
|
63
65
|
var setProcessing = function (processing) {
|
|
64
66
|
setInProcess(processing);
|
|
65
|
-
inProcessRef.current = processing;
|
|
66
67
|
};
|
|
67
68
|
React.useImperativeHandle(ref, function () { return ({
|
|
68
69
|
setProcessing: setProcessing,
|
|
69
|
-
inProcess:
|
|
70
|
+
inProcess: inProcess
|
|
70
71
|
}); });
|
|
71
72
|
var staticProps = {
|
|
72
73
|
dialogOptions: dialogOptions,
|
|
@@ -81,7 +82,7 @@ var DialogContentFooter = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
81
82
|
// footerProps = {...dialogOptions.slotProps.footer, dialogOptions: dialogOptions, inProcess: dialog.isInProcess() }
|
|
82
83
|
footerProps = dialogOptions.slotProps.footer;
|
|
83
84
|
}
|
|
84
|
-
console.log('
|
|
85
|
+
console.log('DialogBase_DialogContentFooter', dialog.isInProcess());
|
|
85
86
|
return (0, jsx_runtime_1.jsxs)("div", { className: 'dialog-footer', style: (_c = (_b = dialogOptions.base) === null || _b === void 0 ? void 0 : _b.footer) === null || _c === void 0 ? void 0 : _c.style, children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(_context_1.WithHeaderFooterContext, __assign({}, staticProps, { dialog: dialog, children: dialogOptions.slot.footer ?
|
|
86
87
|
(0, jsx_runtime_1.jsx)(CustomFooter, __assign({}, staticProps, footerProps))
|
|
87
88
|
:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { TDialogCallbackFn, IDialogBoundsDef } from "../types/index.js";
|
|
1
|
+
import { TDialogCallbackFn, IDialogBoundsDef, DialogContentFooterReturnType } from "../types/index.js";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
interface IContentHeaderProps {
|
|
4
4
|
header: TDialogCallbackFn<any, any>;
|
|
5
5
|
bounds: IDialogBoundsDef;
|
|
6
6
|
}
|
|
7
|
-
declare const DialogContentHeader: React.
|
|
7
|
+
declare const DialogContentHeader: React.ForwardRefExoticComponent<IContentHeaderProps & React.RefAttributes<DialogContentFooterReturnType>>;
|
|
8
8
|
export { DialogContentHeader };
|
|
@@ -51,13 +51,24 @@ var React = __importStar(require("react"));
|
|
|
51
51
|
var react_1 = require("react");
|
|
52
52
|
var _helpers_1 = require("../helpers/index.js");
|
|
53
53
|
var _context_1 = require("../context/index.js");
|
|
54
|
-
var DialogContentHeader = function (_a) {
|
|
54
|
+
var DialogContentHeader = React.forwardRef(function (_a, ref) {
|
|
55
55
|
var _b, _c, _d, _e;
|
|
56
56
|
var header = _a.header, bounds = _a.bounds;
|
|
57
57
|
var _f = (0, react_1.useContext)(_context_1.DialogContentContext), dialog = _f.dialog, dialogRef = _f.dialogRef;
|
|
58
58
|
var dialogOptions = dialog.dialogOptions;
|
|
59
59
|
var baseOptions = dialogOptions.base;
|
|
60
60
|
var _g = React.useState(bounds === null || bounds === void 0 ? void 0 : bounds.fullscreen), fullscreen = _g[0], setFullscreen = _g[1];
|
|
61
|
+
// Imperative handle
|
|
62
|
+
var _h = React.useState({
|
|
63
|
+
inProcess: false
|
|
64
|
+
}), inProcess = _h[0], setInProcess = _h[1];
|
|
65
|
+
var setProcessing = function (processing) {
|
|
66
|
+
setInProcess(processing);
|
|
67
|
+
};
|
|
68
|
+
React.useImperativeHandle(ref, function () { return ({
|
|
69
|
+
setProcessing: setProcessing,
|
|
70
|
+
inProcess: inProcess
|
|
71
|
+
}); });
|
|
61
72
|
(0, react_1.useEffect)(function () {
|
|
62
73
|
var _a, _b, _c;
|
|
63
74
|
if (fullscreen) {
|
|
@@ -80,7 +91,10 @@ var DialogContentHeader = function (_a) {
|
|
|
80
91
|
};
|
|
81
92
|
if (dialogOptions.slot.header) {
|
|
82
93
|
// const headerProps = dialogOptions.slotProps.header ? {...dialogOptions.slotProps.header(staticProps)} : {};
|
|
83
|
-
console.log('CustomHeader_Content',
|
|
94
|
+
console.log('CustomHeader_Content',
|
|
95
|
+
// dialogOptions.slot.header,
|
|
96
|
+
// fullscreen,
|
|
97
|
+
dialog.isInProcess());
|
|
84
98
|
var headerProps = dialogOptions.slotProps.header;
|
|
85
99
|
return (0, jsx_runtime_1.jsx)("div", { onDoubleClick: function (event) {
|
|
86
100
|
if (baseOptions.fullscreen) {
|
|
@@ -110,5 +124,5 @@ var DialogContentHeader = function (_a) {
|
|
|
110
124
|
(0, jsx_runtime_1.jsx)(_features_1.DialogInfoAction, {})] }) })] });
|
|
111
125
|
}
|
|
112
126
|
return (0, jsx_runtime_1.jsx)("div", { style: (_e = baseOptions === null || baseOptions === void 0 ? void 0 : baseOptions.header) === null || _e === void 0 ? void 0 : _e.style, className: 'drag-handle dialog-header', children: header });
|
|
113
|
-
};
|
|
127
|
+
});
|
|
114
128
|
exports.DialogContentHeader = DialogContentHeader;
|
|
@@ -48,6 +48,7 @@ exports.DialogHeaderFooterContext = exports.WithHeaderFooterContext = void 0;
|
|
|
48
48
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
49
49
|
var React = __importStar(require("react"));
|
|
50
50
|
var WithHeaderFooterContext = function (props) {
|
|
51
|
+
console.log('DialogBase_WithHeaderFooterContext', props.dialog.isInProcess());
|
|
51
52
|
return (0, jsx_runtime_1.jsx)(exports.DialogHeaderFooterContext.Provider, { value: __assign({}, props), children: props.children });
|
|
52
53
|
};
|
|
53
54
|
exports.WithHeaderFooterContext = WithHeaderFooterContext;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-dialogger",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.117",
|
|
4
4
|
"description": "This package is a continuation of the react-araci package. Due to an error, react-araci was removed, and it has been decided to continue under the new package name react-dialogger",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Sueleyman Topaloglu",
|
|
@@ -66,9 +66,13 @@ type TListenerButtonType = Pick<DialogActionBase, Exclude<keyof ActionApiDef, 'o
|
|
|
66
66
|
export type TDialogStateListenerForActionCallbackType = (values: Record<string, any>, button: TListenerButtonType, dialog: IListenerDialogDef) => void;
|
|
67
67
|
export interface IContentFooterProps {
|
|
68
68
|
}
|
|
69
|
-
export interface
|
|
70
|
-
setProcessing: React.Dispatch<React.SetStateAction<boolean>>;
|
|
69
|
+
export interface InProcessType {
|
|
71
70
|
inProcess: boolean;
|
|
71
|
+
message?: string;
|
|
72
|
+
}
|
|
73
|
+
export interface DialogContentFooterReturnType {
|
|
74
|
+
setProcessing: React.Dispatch<React.SetStateAction<InProcessType>>;
|
|
75
|
+
inProcess: InProcessType;
|
|
72
76
|
}
|
|
73
77
|
export interface IActionIntents {
|
|
74
78
|
positive?: ActionIntent;
|
package/types/DialogTypes.d.ts
CHANGED
|
@@ -270,7 +270,7 @@ export type DialogExternalRefs<T> = T extends {
|
|
|
270
270
|
} : never;
|
|
271
271
|
export type DialogInjectDef<T> = T extends Function ? T : T extends {
|
|
272
272
|
current: any;
|
|
273
|
-
} ? T : T extends string | number | boolean | null | undefined | Date ? never : T extends Array<infer U> ? never : T extends object ? {
|
|
273
|
+
} ? T : T extends string | number | boolean | null | undefined | Date ? never : T extends Array<infer U> ? never : T extends object ? (T extends Array<any> ? never : T) : T extends object ? {
|
|
274
274
|
[K in keyof T]: DialogInjectDef<T[K]>;
|
|
275
275
|
} : never;
|
|
276
276
|
export interface BaseDialogDOMRect {
|