react-dialogger 1.1.113 → 1.1.115
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/Actions.d.ts +1 -1
- package/components/Actions.js +1 -1
- package/components/DialogActionBase.d.ts +1 -1
- package/components/DialogBase.d.ts +16 -20
- package/components/DialogBase.js +22 -38
- package/components/DialogContentBody.d.ts +1 -1
- package/components/DialogContentFooter.js +1 -0
- package/components/DialogContentHeader.d.ts +1 -1
- package/components/DialogContentHeader.js +1 -0
- package/context/DialogContentContextProvider.d.ts +1 -1
- package/models/Dialog.d.ts +15 -15
- package/models/Dialog.js +28 -26
- package/models/test.d.ts +0 -0
- package/models/test.js +79 -0
- package/package.json +8 -5
- package/types/DialogActionTypes.d.ts +3 -3
- package/types/DialogContentContextTypes.d.ts +5 -5
- package/types/DialogTypes.d.ts +34 -30
- package/utils/resizeManager.d.ts +1 -1
package/components/Actions.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import { DialogAction } from "../models/index.js";
|
|
|
2
2
|
import { DialogBase } from "./index.js";
|
|
3
3
|
declare const Actions: ({ actions, dialog }: {
|
|
4
4
|
actions?: DialogAction[];
|
|
5
|
-
dialog: DialogBase<any, any
|
|
5
|
+
dialog: DialogBase<any, any>;
|
|
6
6
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export { Actions };
|
package/components/Actions.js
CHANGED
|
@@ -6,7 +6,7 @@ var _components_1 = require("./index.js");
|
|
|
6
6
|
var Actions = function (_a) {
|
|
7
7
|
var actions = _a.actions, dialog = _a.dialog;
|
|
8
8
|
var dialogOptions = dialog.dialogOptions;
|
|
9
|
-
return (0, jsx_runtime_1.jsx)("div", { style: { position: 'relative', display: 'flex', flexDirection: 'row', columnGap: 10, alignItems: 'center' }, children: actions.map(function (action, index) {
|
|
9
|
+
return (0, jsx_runtime_1.jsx)("div", { style: { position: 'relative', display: 'flex', flexDirection: 'row', columnGap: 10, alignItems: 'center' }, children: actions === null || actions === void 0 ? void 0 : actions.map(function (action, index) {
|
|
10
10
|
var referencedAction = dialog.initializeActionRef(action.name);
|
|
11
11
|
action._actionComponent = referencedAction;
|
|
12
12
|
return (0, jsx_runtime_1.jsx)(_components_1.DialogActionBase, { name: action.name, ref: referencedAction, dialogBaseComponent: dialog,
|
|
@@ -16,7 +16,7 @@ export declare const BASE_INTENTS: {
|
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
18
|
declare class DialogActionBase extends Component<ActionProps, ActionState> {
|
|
19
|
-
get dialogBaseComponent(): DialogBase<any, any
|
|
19
|
+
get dialogBaseComponent(): DialogBase<any, any>;
|
|
20
20
|
protected _options: DialogActionOptionsType;
|
|
21
21
|
protected _intent: ActionIntent;
|
|
22
22
|
_stateListener: TDialogStateListenerForActionCallbackType;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Component, RefObject } from 'react';
|
|
2
2
|
import { FormikProps } from "formik";
|
|
3
3
|
import { DialogActionBase } from "./index.js";
|
|
4
|
-
import { BaseDialogProps, BaseDialogState, IDialogSize, DialogOptionsType, TDialogCallbackFn,
|
|
4
|
+
import { BaseDialogProps, BaseDialogState, IDialogSize, DialogOptionsType, TDialogCallbackFn, WithBackdrop, IDialogSnackbar, IInProcess, TInitialHolder, ISnackbarAnchor, TSeverity, TAccessFrom, ActionApiDef, DialogContentFooterReturnType, DialogFormikAdapter, Dialogify, DialogInjectDef } from "../types/index.js";
|
|
5
5
|
import Dialog, { DialogAction } from "../models/index.js";
|
|
6
6
|
interface IFormikAdapter extends Pick<FormikProps<any>, 'setValues' | 'setFieldValue' | 'values'> {
|
|
7
7
|
}
|
|
8
|
-
declare class DialogBase<
|
|
8
|
+
declare class DialogBase<V, I> extends Component<BaseDialogProps<V, I>, BaseDialogState<V, I>> {
|
|
9
9
|
_dialogTranslate: {
|
|
10
10
|
lastX: number;
|
|
11
11
|
lastY: number;
|
|
@@ -14,8 +14,8 @@ declare class DialogBase<Values extends Record<string, any>, StockDialogHandlers
|
|
|
14
14
|
[key: string]: RefObject<DialogActionBase>;
|
|
15
15
|
};
|
|
16
16
|
protected _inlineFormikProps: IFormikAdapter;
|
|
17
|
-
protected _header: TDialogCallbackFn
|
|
18
|
-
protected _body: TDialogCallbackFn
|
|
17
|
+
protected _header: TDialogCallbackFn<V, I>;
|
|
18
|
+
protected _body: TDialogCallbackFn<V, I>;
|
|
19
19
|
protected _actions: DialogAction[];
|
|
20
20
|
protected _dialogSize: IDialogSize;
|
|
21
21
|
protected _holder?: TInitialHolder;
|
|
@@ -25,13 +25,11 @@ declare class DialogBase<Values extends Record<string, any>, StockDialogHandlers
|
|
|
25
25
|
protected readonly _dialogBodyRef: RefObject<any>;
|
|
26
26
|
protected readonly _snackbarRef: WithBackdrop['snackbarRef'];
|
|
27
27
|
protected _dialogOptions?: DialogOptionsType;
|
|
28
|
-
protected _onClose:
|
|
28
|
+
protected _onClose: TDialogCallbackFn<V, I, void>;
|
|
29
29
|
protected _shInterval: number;
|
|
30
30
|
protected _snackbarAnchor: ISnackbarAnchor;
|
|
31
|
-
protected _parent: Dialog<
|
|
32
|
-
protected
|
|
33
|
-
protected _xrefs: DialogExternalRefs<StockDialogRefs>;
|
|
34
|
-
protected _initialValues: Dialogify<Values>;
|
|
31
|
+
protected _parent: Dialog<V, I>;
|
|
32
|
+
protected _initialValues: Dialogify<V>;
|
|
35
33
|
private _inProcess;
|
|
36
34
|
private _footerRef;
|
|
37
35
|
protected _headerRef: RefObject<DialogContentFooterReturnType>;
|
|
@@ -39,15 +37,14 @@ declare class DialogBase<Values extends Record<string, any>, StockDialogHandlers
|
|
|
39
37
|
private _accessFrom;
|
|
40
38
|
private readonly _processingListeners;
|
|
41
39
|
private readonly _abortedListeners;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
get deps(): DialogInjectDef<I>;
|
|
41
|
+
get values(): Readonly<{
|
|
42
|
+
[K in keyof V]: Dialogify<V[K]>;
|
|
43
|
+
}>;
|
|
44
|
+
inject<T>(key: string, value: DialogInjectDef<T>): DialogBase<V, T>;
|
|
45
|
+
constructor(props: BaseDialogProps<V, I> & {});
|
|
45
46
|
setValue<T>(key: string, value: Dialogify<T>): void;
|
|
46
|
-
get
|
|
47
|
-
appendXHandler<H>(key: string, handler: DialogExternalHandler): void;
|
|
48
|
-
get xrefs(): Record<string, DialogExternalRefs<DialogExternalRef>>;
|
|
49
|
-
appendXRef<R>(key: R, ref: DialogExternalRef): void;
|
|
50
|
-
get parent(): Dialog<Values, StockDialogHandlers, StockDialogRefs>;
|
|
47
|
+
get parent(): Dialog<V, I>;
|
|
51
48
|
get dialogTranslate(): {
|
|
52
49
|
lastX: number;
|
|
53
50
|
lastY: number;
|
|
@@ -61,7 +58,6 @@ declare class DialogBase<Values extends Record<string, any>, StockDialogHandlers
|
|
|
61
58
|
set formikProps(value: FormikProps<any>);
|
|
62
59
|
get formikValidate(): Promise<DialogFormikAdapter<any>>;
|
|
63
60
|
set inlineFormikProps(inlineFormikProps: IFormikAdapter);
|
|
64
|
-
get values(): Values;
|
|
65
61
|
setValues<T>(values: Dialogify<T>, callbackFn?: () => void): void;
|
|
66
62
|
componentDidMount(): void;
|
|
67
63
|
setInProcess: (process: boolean, message?: string, holder?: TInitialHolder) => this;
|
|
@@ -72,9 +68,9 @@ declare class DialogBase<Values extends Record<string, any>, StockDialogHandlers
|
|
|
72
68
|
get actions(): {
|
|
73
69
|
[key: string]: ActionApiDef;
|
|
74
70
|
};
|
|
75
|
-
updateBody(body: TDialogCallbackFn): void;
|
|
71
|
+
updateBody(body: TDialogCallbackFn<V, I>): void;
|
|
76
72
|
processingListener(listener: (inProcess: boolean) => void): this;
|
|
77
|
-
onAbort(callbackFn: TDialogCallbackFn<void>): this;
|
|
73
|
+
onAbort(callbackFn: TDialogCallbackFn<V, I, void>): this;
|
|
78
74
|
getDom: () => HTMLDivElement;
|
|
79
75
|
get snackbar(): {
|
|
80
76
|
open: (message: string, severity: TSeverity, key?: string, action?: IDialogSnackbar["action"], autoHideDuration?: number | null) => void;
|
package/components/DialogBase.js
CHANGED
|
@@ -66,7 +66,6 @@ var lodash_1 = require("lodash");
|
|
|
66
66
|
var _components_1 = require("./index.js");
|
|
67
67
|
var _helpers_1 = require("../helpers/index.js");
|
|
68
68
|
var _context_1 = require("../context/index.js");
|
|
69
|
-
var isRefObject_1 = require("../helpers/isRefObject");
|
|
70
69
|
var DialogBase = /** @class */ (function (_super) {
|
|
71
70
|
__extends(DialogBase, _super);
|
|
72
71
|
function DialogBase(props) {
|
|
@@ -192,11 +191,13 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
192
191
|
// Refs Props
|
|
193
192
|
dialogRef: _this._dialogRef, headerRef: _this._headerRef, bodyRef: _this._dialogBodyRef, footerRef: _this._footerRef, backdropRef: _this._backdropRef, snackbarRef: _this._snackbarRef, prevDialogRect: _this.state.prevDialogRect, children: (0, jsx_runtime_1.jsx)(_components_1.DialogWithBackdropWrapper, {}) });
|
|
194
193
|
};
|
|
194
|
+
// this.inject(props.inject);
|
|
195
195
|
_this.state = {
|
|
196
196
|
inProcess: { inProcess: false },
|
|
197
197
|
prevDialogRect: (0, _helpers_1.dialogRectAuto)(),
|
|
198
198
|
body: props.body,
|
|
199
|
-
aborted: false
|
|
199
|
+
aborted: false,
|
|
200
|
+
inject: props.inject
|
|
200
201
|
};
|
|
201
202
|
var defaultOptions = {
|
|
202
203
|
base: {
|
|
@@ -243,46 +244,32 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
243
244
|
_this._processingListeners = (_a = props.processingListeners) !== null && _a !== void 0 ? _a : [];
|
|
244
245
|
_this._abortedListeners = (_b = props.abortedListeners) !== null && _b !== void 0 ? _b : [];
|
|
245
246
|
_this._initialValues = props.initialValues;
|
|
246
|
-
_this._xhandlers = props.xhandlers;
|
|
247
|
-
_this._xrefs = props.xrefs;
|
|
248
247
|
return _this;
|
|
249
248
|
}
|
|
250
|
-
DialogBase.prototype
|
|
251
|
-
var _a;
|
|
252
|
-
(_a = this._inlineFormikProps) === null || _a === void 0 ? void 0 : _a.setFieldValue(key, value);
|
|
253
|
-
};
|
|
254
|
-
Object.defineProperty(DialogBase.prototype, "xhandlers", {
|
|
249
|
+
Object.defineProperty(DialogBase.prototype, "deps", {
|
|
255
250
|
get: function () {
|
|
256
|
-
|
|
257
|
-
return this._xhandlers;
|
|
251
|
+
return this.state.inject;
|
|
258
252
|
},
|
|
259
253
|
enumerable: false,
|
|
260
254
|
configurable: true
|
|
261
255
|
});
|
|
262
|
-
DialogBase.prototype
|
|
263
|
-
// public appendXHandler(key: string, handler: DialogExternalHandler) {
|
|
264
|
-
if (!key)
|
|
265
|
-
throw new Error('Handler key is required');
|
|
266
|
-
if (typeof handler !== 'function')
|
|
267
|
-
throw new Error("Handler \"".concat(String(key), "\" must be a function"));
|
|
268
|
-
// @ts-ignore
|
|
269
|
-
this._xhandlers[key] = handler;
|
|
270
|
-
};
|
|
271
|
-
Object.defineProperty(DialogBase.prototype, "xrefs", {
|
|
256
|
+
Object.defineProperty(DialogBase.prototype, "values", {
|
|
272
257
|
get: function () {
|
|
273
|
-
|
|
274
|
-
return this._xrefs;
|
|
258
|
+
return this._inlineFormikProps.values;
|
|
275
259
|
},
|
|
276
260
|
enumerable: false,
|
|
277
261
|
configurable: true
|
|
278
262
|
});
|
|
279
|
-
DialogBase.prototype.
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
263
|
+
DialogBase.prototype.inject = function (key, value) {
|
|
264
|
+
this.setState(function (prevState) {
|
|
265
|
+
var _a;
|
|
266
|
+
return (__assign(__assign({}, prevState), { inject: __assign(__assign({}, prevState.inject), (_a = {}, _a[key] = value, _a)) }));
|
|
267
|
+
});
|
|
268
|
+
return this;
|
|
269
|
+
};
|
|
270
|
+
DialogBase.prototype.setValue = function (key, value) {
|
|
271
|
+
var _a;
|
|
272
|
+
(_a = this._inlineFormikProps) === null || _a === void 0 ? void 0 : _a.setFieldValue(key, value);
|
|
286
273
|
};
|
|
287
274
|
Object.defineProperty(DialogBase.prototype, "parent", {
|
|
288
275
|
get: function () {
|
|
@@ -360,13 +347,9 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
360
347
|
enumerable: false,
|
|
361
348
|
configurable: true
|
|
362
349
|
});
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
},
|
|
367
|
-
enumerable: false,
|
|
368
|
-
configurable: true
|
|
369
|
-
});
|
|
350
|
+
// get values(): V {
|
|
351
|
+
// return this._inlineFormikProps.values;
|
|
352
|
+
// }
|
|
370
353
|
DialogBase.prototype.setValues = function (values, callbackFn) {
|
|
371
354
|
this._inlineFormikProps.setValues(values);
|
|
372
355
|
if (typeof callbackFn === "function") {
|
|
@@ -412,8 +395,9 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
412
395
|
Object.defineProperty(DialogBase.prototype, "actions", {
|
|
413
396
|
get: function () {
|
|
414
397
|
var _this = this;
|
|
398
|
+
var _a;
|
|
415
399
|
var __actions = {};
|
|
416
|
-
this._actions.forEach(function (action, index) {
|
|
400
|
+
(_a = this._actions) === null || _a === void 0 ? void 0 : _a.forEach(function (action, index) {
|
|
417
401
|
var _a;
|
|
418
402
|
__actions[action.name] = (_a = _this._actionRefs[action.name]) === null || _a === void 0 ? void 0 : _a.current; // ?? action;
|
|
419
403
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { TDialogCallbackFn } from "../types/index.js";
|
|
3
3
|
interface IContentBodyProps {
|
|
4
|
-
body: TDialogCallbackFn
|
|
4
|
+
body: TDialogCallbackFn<any, any>;
|
|
5
5
|
}
|
|
6
6
|
declare const DialogContentBody: React.FC<IContentBodyProps>;
|
|
7
7
|
export { DialogContentBody };
|
|
@@ -81,6 +81,7 @@ var DialogContentFooter = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
81
81
|
// footerProps = {...dialogOptions.slotProps.footer, dialogOptions: dialogOptions, inProcess: dialog.isInProcess() }
|
|
82
82
|
footerProps = dialogOptions.slotProps.footer;
|
|
83
83
|
}
|
|
84
|
+
console.log('DialogBase_Render', dialog.actions);
|
|
84
85
|
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 ?
|
|
85
86
|
(0, jsx_runtime_1.jsx)(CustomFooter, __assign({}, staticProps, footerProps))
|
|
86
87
|
:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TDialogCallbackFn, IDialogBoundsDef } from "../types/index.js";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
interface IContentHeaderProps {
|
|
4
|
-
header: TDialogCallbackFn
|
|
4
|
+
header: TDialogCallbackFn<any, any>;
|
|
5
5
|
bounds: IDialogBoundsDef;
|
|
6
6
|
}
|
|
7
7
|
declare const DialogContentHeader: React.FC<IContentHeaderProps>;
|
|
@@ -75,6 +75,7 @@ var DialogContentHeader = function (_a) {
|
|
|
75
75
|
var CustomHeader = (_b = dialogOptions.slot) === null || _b === void 0 ? void 0 : _b.header;
|
|
76
76
|
var staticProps = {
|
|
77
77
|
dialogOptions: dialogOptions,
|
|
78
|
+
// @ts-ignore
|
|
78
79
|
dialog: dialog
|
|
79
80
|
};
|
|
80
81
|
if (dialogOptions.slot.header) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { DialogContentContextProviderProps, DialogContentContextProviderSharedProps } from "../types/index.js";
|
|
3
|
-
export declare const DialogContentContext: React.Context<DialogContentContextProviderSharedProps
|
|
3
|
+
export declare const DialogContentContext: React.Context<DialogContentContextProviderSharedProps<Record<string, any>, unknown>>;
|
|
4
4
|
declare const DialogContentContextProvider: React.FC<DialogContentContextProviderProps>;
|
|
5
5
|
export { DialogContentContextProvider };
|
package/models/Dialog.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { DialogAction } from "./DialogAction";
|
|
3
|
-
import { TInitialHolder, IDialogSize, TDialogStateListenerCallbackType, DialogOptionsType, IDialogApiDef,
|
|
4
|
-
declare class Dialog<
|
|
3
|
+
import { TInitialHolder, IDialogSize, TDialogStateListenerCallbackType, DialogOptionsType, IDialogApiDef, TDialogCallbackFn, Dialogify, DialogInjectDef } from "../types/index.js";
|
|
4
|
+
declare class Dialog<V, I> {
|
|
5
|
+
private _initialValues?;
|
|
6
|
+
private _inject?;
|
|
5
7
|
private readonly _processingListeners;
|
|
6
8
|
private readonly _abortedListeners;
|
|
7
9
|
private _stateListener;
|
|
@@ -23,29 +25,27 @@ declare class Dialog<Values extends Record<string, any>, StockDialogHandlers ext
|
|
|
23
25
|
private _headerRef;
|
|
24
26
|
private readonly _apiRef;
|
|
25
27
|
private _onCloseCallback;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
setBody(body: TDialogCallbackFn): this;
|
|
28
|
+
constructor(dialogRef?: React.RefObject<IDialogApiDef | undefined | null> | null, options?: DialogOptionsType, _initialValues?: Dialogify<V>, _inject?: DialogInjectDef<I>);
|
|
29
|
+
inject<T>(args: DialogInjectDef<T>): Dialog<V, T>;
|
|
30
|
+
initialValues<K>(args: Dialogify<K>): Dialog<K, I>;
|
|
31
|
+
setHeader(header: TDialogCallbackFn<V, I>): this;
|
|
32
|
+
setBody(body: TDialogCallbackFn<V, I>): this;
|
|
32
33
|
addActions(actions: Array<DialogAction>): this;
|
|
33
34
|
addAction(action: DialogAction): this;
|
|
34
35
|
/**
|
|
35
36
|
* Only from init */
|
|
36
37
|
stateListener(listener: TDialogStateListenerCallbackType): this;
|
|
37
38
|
processingListener(listener: (inProcess: boolean) => void): this;
|
|
38
|
-
onAbort(callbackFn: TDialogCallbackFn<void>): this;
|
|
39
|
-
initialValues<T extends Record<string, any>>(values: Dialogify<T>): Dialog<T, any, any>;
|
|
40
|
-
registerHandlers<H extends StockDialogHandlers>(handlers: DialogExternalHandlers<H>): Dialog<any, H, any>;
|
|
41
|
-
registerRefs<R extends StockDialogRefs>(refs: DialogExternalRefs<R>): Dialog<any, any, R>;
|
|
39
|
+
onAbort(callbackFn: TDialogCallbackFn<V, I, void>): this;
|
|
42
40
|
initialHolder(holder: TInitialHolder): this;
|
|
43
41
|
keyboardListener(listener: (key: string, dialog: IDialogApiDef) => void): this;
|
|
44
42
|
resizeListener(listener: (size: IDialogSize, dialog: IDialogApiDef) => void): this;
|
|
45
|
-
onClose(callback:
|
|
43
|
+
onClose(callback: TDialogCallbackFn<V, I, void>): this;
|
|
46
44
|
private highestZ;
|
|
47
45
|
private createDom;
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
/**
|
|
47
|
+
* @deprecated only from inline */
|
|
48
|
+
get values(): Dialogify<V>;
|
|
49
|
+
show(callback?: TDialogCallbackFn<V, I, void>): void;
|
|
50
50
|
}
|
|
51
51
|
export default Dialog;
|
package/models/Dialog.js
CHANGED
|
@@ -52,8 +52,11 @@ var DialogBase_1 = __importDefault(require("../components/DialogBase"));
|
|
|
52
52
|
var client_1 = require("react-dom/client");
|
|
53
53
|
var appLogger_1 = require("../helpers/appLogger");
|
|
54
54
|
var Dialog = /** @class */ (function () {
|
|
55
|
-
|
|
55
|
+
// private _initialValues :Dialogify<V>;
|
|
56
|
+
function Dialog(dialogRef, options, _initialValues, _inject) {
|
|
56
57
|
var _this = this;
|
|
58
|
+
this._initialValues = _initialValues;
|
|
59
|
+
this._inject = _inject;
|
|
57
60
|
// ✨✨✨✨✨✨✨✨✨✨✨
|
|
58
61
|
this._processingListeners = [];
|
|
59
62
|
this._abortedListeners = [];
|
|
@@ -104,6 +107,22 @@ var Dialog = /** @class */ (function () {
|
|
|
104
107
|
}
|
|
105
108
|
// this._xrefs = {} as DialogExternalRefs<StockDialogRefs>;
|
|
106
109
|
}
|
|
110
|
+
Dialog.prototype.inject = function (args) {
|
|
111
|
+
// @ts-ignore
|
|
112
|
+
var t = new Dialog(this._apiRef, this._dialogOptions, this._initialValues, args);
|
|
113
|
+
var newDialog = Object.assign(this, t);
|
|
114
|
+
return newDialog;
|
|
115
|
+
};
|
|
116
|
+
// public initialValues<T extends Record<string, any>>( values: Dialogify<T> ): Dialog<T, I> {
|
|
117
|
+
Dialog.prototype.initialValues = function (args) {
|
|
118
|
+
// const next = this as unknown as Dialog<K, I>;
|
|
119
|
+
// next._initialValues = values;
|
|
120
|
+
// return next;
|
|
121
|
+
// @ts-ignore
|
|
122
|
+
var t = new Dialog(this._apiRef, this._dialogOptions, args, this._inject);
|
|
123
|
+
var newDialog = Object.assign(this, t);
|
|
124
|
+
return newDialog;
|
|
125
|
+
};
|
|
107
126
|
Dialog.prototype.setHeader = function (header) {
|
|
108
127
|
this._header = header;
|
|
109
128
|
return this;
|
|
@@ -136,29 +155,6 @@ var Dialog = /** @class */ (function () {
|
|
|
136
155
|
this._abortedListeners.push(callbackFn);
|
|
137
156
|
return this;
|
|
138
157
|
};
|
|
139
|
-
// 👌Ok
|
|
140
|
-
// public initialValues<T>( values: Dialogify<T> ): this {
|
|
141
|
-
// this._initialValues = values as Dialogify<Values>;;
|
|
142
|
-
// return this;
|
|
143
|
-
// }
|
|
144
|
-
// 👌Ok Combined with Dialog Class
|
|
145
|
-
Dialog.prototype.initialValues = function (values) {
|
|
146
|
-
var next = this;
|
|
147
|
-
next._initialValues = values;
|
|
148
|
-
return next;
|
|
149
|
-
};
|
|
150
|
-
Dialog.prototype.registerHandlers = function (handlers) {
|
|
151
|
-
// this._xhandlers = handlers;
|
|
152
|
-
// return this;
|
|
153
|
-
var next = this;
|
|
154
|
-
this._xhandlers = handlers;
|
|
155
|
-
return next;
|
|
156
|
-
};
|
|
157
|
-
Dialog.prototype.registerRefs = function (refs) {
|
|
158
|
-
var next = this;
|
|
159
|
-
this._xrefs = refs;
|
|
160
|
-
return next;
|
|
161
|
-
};
|
|
162
158
|
Dialog.prototype.initialHolder = function (holder) {
|
|
163
159
|
this._initialHolder = holder;
|
|
164
160
|
return this;
|
|
@@ -176,6 +172,8 @@ var Dialog = /** @class */ (function () {
|
|
|
176
172
|
return this;
|
|
177
173
|
};
|
|
178
174
|
Object.defineProperty(Dialog.prototype, "values", {
|
|
175
|
+
/**
|
|
176
|
+
* @deprecated only from inline */
|
|
179
177
|
get: function () {
|
|
180
178
|
return this._initialValues;
|
|
181
179
|
},
|
|
@@ -183,11 +181,12 @@ var Dialog = /** @class */ (function () {
|
|
|
183
181
|
configurable: true
|
|
184
182
|
});
|
|
185
183
|
Dialog.prototype.show = function (callback) {
|
|
184
|
+
// public show ( callback?: (dialog: DialogBase<Values, I> & IDialogApiDef ) => void ): void {
|
|
186
185
|
var dom = this.createDom();
|
|
187
186
|
var root = (0, client_1.createRoot)(dom);
|
|
188
187
|
var props = __assign(__assign({
|
|
189
188
|
// Initials
|
|
190
|
-
initialOptions: this._dialogOptions, initialValues: this._initialValues,
|
|
189
|
+
initialOptions: this._dialogOptions, initialValues: this._initialValues, didMountCallback: callback,
|
|
191
190
|
// Component contents
|
|
192
191
|
header: this._header, body: this._body, actions: this._actions,
|
|
193
192
|
// Refs
|
|
@@ -195,8 +194,11 @@ var Dialog = /** @class */ (function () {
|
|
|
195
194
|
// Listeners
|
|
196
195
|
stateListener: this._stateListener, keyboardListener: this._keyboardListener, resizeListener: this._resizeListener, processingListeners: this._processingListeners, abortedListeners: this._abortedListeners,
|
|
197
196
|
// Others
|
|
198
|
-
dialogSize: this._dialogSize, initialHolder: this._initialHolder, snackbarAnchor: this._snackbarAnchor, root: root, dom: dom, parent: this }, this._apiRef ? { ref: this._apiRef } : null), { onClose: this._onCloseCallback });
|
|
197
|
+
dialogSize: this._dialogSize, initialHolder: this._initialHolder, snackbarAnchor: this._snackbarAnchor, root: root, dom: dom, parent: this }, this._apiRef ? { ref: this._apiRef } : null), { onClose: this._onCloseCallback, inject: this._inject });
|
|
199
198
|
// @ts-ignore
|
|
199
|
+
// root.render( React.createElement( DialogBase as React.ComponentType<
|
|
200
|
+
// typeof this._initialValues
|
|
201
|
+
// >, props ) );
|
|
200
202
|
root.render(React.createElement(DialogBase_1.default, props));
|
|
201
203
|
};
|
|
202
204
|
return Dialog;
|
package/models/test.d.ts
ADDED
|
File without changes
|
package/models/test.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// import Dialog from "./Dialog";
|
|
2
|
+
//
|
|
3
|
+
// const myRef = { current: "HELLO" };
|
|
4
|
+
// const myFunction = (name: string, age: number) => {
|
|
5
|
+
// return 21;
|
|
6
|
+
// };
|
|
7
|
+
//
|
|
8
|
+
// const f = (new Dialog(null, {}))
|
|
9
|
+
// const z = f.inject({
|
|
10
|
+
// // name: 'Suleyman',
|
|
11
|
+
// myFunc: myFunction,
|
|
12
|
+
// myRef,
|
|
13
|
+
// array_: {
|
|
14
|
+
// name: myFunction
|
|
15
|
+
// }
|
|
16
|
+
// })
|
|
17
|
+
// const name = z.getInject().myFunc('Suleyman', 22)
|
|
18
|
+
// const refika = z.getInject().array_.name('Suleyman', 44);
|
|
19
|
+
// const d = z.showMe( data => {
|
|
20
|
+
// data.getInject().myFunc('Suleyman', 21);
|
|
21
|
+
// })
|
|
22
|
+
// // // const typedDialog = f.inject({}); // ✅ BOZMAYACAK
|
|
23
|
+
//
|
|
24
|
+
// // f.getInject().test('Suleyman', 21); // ✅
|
|
25
|
+
// // f.getInject().rt.;
|
|
26
|
+
//
|
|
27
|
+
// // // typedDialog.getInject().test()// ✅
|
|
28
|
+
//
|
|
29
|
+
//
|
|
30
|
+
// // function bar<T>(arg: T){
|
|
31
|
+
// // return arg;
|
|
32
|
+
// // }
|
|
33
|
+
//
|
|
34
|
+
// // const retval = bar({
|
|
35
|
+
// // a: 1, b: 2, c: 3
|
|
36
|
+
// // });
|
|
37
|
+
//
|
|
38
|
+
// // retval.a
|
|
39
|
+
//
|
|
40
|
+
// class M<T> {
|
|
41
|
+
//
|
|
42
|
+
// private _name: string;
|
|
43
|
+
// constructor(private b?: T) {}
|
|
44
|
+
//
|
|
45
|
+
// static create<U>(args: U): M<U> {
|
|
46
|
+
// return new M(args);
|
|
47
|
+
// }
|
|
48
|
+
//
|
|
49
|
+
// public name(name: string): this {
|
|
50
|
+
// this._name = name;
|
|
51
|
+
// return this;
|
|
52
|
+
// }
|
|
53
|
+
//
|
|
54
|
+
// initialValues<U>(args: U): M<U> {
|
|
55
|
+
// return new M(args);
|
|
56
|
+
// }
|
|
57
|
+
//
|
|
58
|
+
// getD(): T {
|
|
59
|
+
// return this.b;
|
|
60
|
+
// }
|
|
61
|
+
//
|
|
62
|
+
// getC( callback: (data: T) => void): M<T>{
|
|
63
|
+
// callback(this.b);
|
|
64
|
+
// return this;
|
|
65
|
+
// }
|
|
66
|
+
// }
|
|
67
|
+
//
|
|
68
|
+
// // const t = M.create({ a: 1 });
|
|
69
|
+
// const t = new M();
|
|
70
|
+
//
|
|
71
|
+
// // t.getD().; // ✅
|
|
72
|
+
// t.name('Suleyman')
|
|
73
|
+
// .initialValues({
|
|
74
|
+
// b: 2, c: 3, name: 'Suleyman', age: 29
|
|
75
|
+
// })
|
|
76
|
+
// .getC( data => {
|
|
77
|
+
// console.log('getC', data.age);
|
|
78
|
+
// }).getD().age
|
|
79
|
+
//
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-dialogger",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.115",
|
|
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",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"notistack": "^3.0.2",
|
|
10
9
|
"formik": "^2.4.6",
|
|
11
|
-
"react-draggable": "^4.4.6",
|
|
12
10
|
"lodash": "^4.17.21",
|
|
13
11
|
"lodash.isequal": "^4.5.0",
|
|
12
|
+
"notistack": "^3.0.2",
|
|
14
13
|
"react": "^18.2.0",
|
|
15
|
-
"react-dom": "^18.2.0"
|
|
14
|
+
"react-dom": "^18.2.0",
|
|
15
|
+
"react-draggable": "^4.4.6"
|
|
16
16
|
},
|
|
17
17
|
"maintainers": [
|
|
18
18
|
{
|
|
@@ -29,5 +29,8 @@
|
|
|
29
29
|
"react-component",
|
|
30
30
|
"dynamic dialog",
|
|
31
31
|
"react-dialogger"
|
|
32
|
-
]
|
|
32
|
+
],
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"tsx": "^4.21.0"
|
|
35
|
+
}
|
|
33
36
|
}
|
|
@@ -3,13 +3,13 @@ import { DialogBase, DialogActionBase } from "../components/index.js";
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { DialogAction } from "../models/index.js";
|
|
5
5
|
import { CSSProperties } from "react";
|
|
6
|
-
export type ActionDialogDef = Omit<IDialogApiDef, 'switchFullScreen'>;
|
|
6
|
+
export type ActionDialogDef<V, I> = Omit<IDialogApiDef, 'switchFullScreen'>;
|
|
7
7
|
export type ActionDef = Pick<DialogAction, 'onClick' | 'setOptions' | 'name'>;
|
|
8
8
|
export type ActionApiDef = Pick<InstanceType<typeof DialogActionBase>, 'updateOptions' | 'updateColor' | 'updateVariant' | 'updateLabel' | 'updateIntent' | 'setOptions' | 'setInProcess' | 'getLabel' | 'options' | 'click' | 'remove' | 'name'>;
|
|
9
9
|
export interface IDialogActionDef extends ActionApiDef {
|
|
10
10
|
}
|
|
11
11
|
export type DialogActionType = (button: ActionApiDef, dialog: Omit<IDialogApiDef, 'switchFullScreen'>) => void;
|
|
12
|
-
export interface ActionProps {
|
|
12
|
+
export interface ActionProps<V extends Record<string, any> = Record<string, any>, I extends Record<string, any> = Record<string, any>> {
|
|
13
13
|
name: string;
|
|
14
14
|
options?: DialogActionOptionsType;
|
|
15
15
|
/**
|
|
@@ -17,7 +17,7 @@ export interface ActionProps {
|
|
|
17
17
|
* @see options.label */
|
|
18
18
|
label?: string;
|
|
19
19
|
onClick: DialogActionType;
|
|
20
|
-
dialogBaseComponent?: DialogBase<
|
|
20
|
+
dialogBaseComponent?: DialogBase<V, I>;
|
|
21
21
|
/**
|
|
22
22
|
* @deprecated
|
|
23
23
|
* @see options.variant */
|
|
@@ -3,9 +3,9 @@ import DialogBase from "../components/DialogBase";
|
|
|
3
3
|
import { ReactNode, RefObject } from "react";
|
|
4
4
|
import { BaseDialogDOMRect } from "./index.js";
|
|
5
5
|
import { Resizeable } from "../helpers/index.js";
|
|
6
|
-
export interface DialogContentContextProviderProps {
|
|
7
|
-
dialogBase: DialogBase<
|
|
8
|
-
body: TDialogCallbackFn<ReturnType<any>>;
|
|
6
|
+
export interface DialogContentContextProviderProps<V extends Record<string, any> = Record<string, any>, I = unknown> {
|
|
7
|
+
dialogBase: DialogBase<V, I>;
|
|
8
|
+
body: TDialogCallbackFn<V, I, ReturnType<any>>;
|
|
9
9
|
dialogRef: RefObject<any>;
|
|
10
10
|
headerRef: RefObject<any>;
|
|
11
11
|
bodyRef: RefObject<any>;
|
|
@@ -15,8 +15,8 @@ export interface DialogContentContextProviderProps {
|
|
|
15
15
|
prevDialogRect: BaseDialogDOMRect;
|
|
16
16
|
children: ReactNode;
|
|
17
17
|
}
|
|
18
|
-
export interface DialogContentContextProviderSharedProps extends Partial<Pick<DialogContentContextProviderProps, 'body' | 'dialogRef' | 'headerRef' | 'bodyRef' | 'footerRef' | 'backdropRef' | 'snackbarRef' | 'prevDialogRect'>> {
|
|
18
|
+
export interface DialogContentContextProviderSharedProps<V extends Record<string, any> = Record<string, any>, I = unknown> extends Partial<Pick<DialogContentContextProviderProps<V, I>, 'body' | 'dialogRef' | 'headerRef' | 'bodyRef' | 'footerRef' | 'backdropRef' | 'snackbarRef' | 'prevDialogRect'>> {
|
|
19
19
|
baseZoomEffect: () => void;
|
|
20
|
-
dialog: DialogBase<
|
|
20
|
+
dialog: DialogBase<V, I>;
|
|
21
21
|
resizeableObject: Resizeable | null;
|
|
22
22
|
}
|
package/types/DialogTypes.d.ts
CHANGED
|
@@ -10,19 +10,19 @@ import { SharedProps, SnackbarKey, SnackbarProvider, VariantType } from "notista
|
|
|
10
10
|
export interface TBaseDialogState {
|
|
11
11
|
[K: string]: any;
|
|
12
12
|
}
|
|
13
|
-
export interface BaseDialogState {
|
|
13
|
+
export interface BaseDialogState<V, I> {
|
|
14
14
|
/**@deprecated use FormikProps Values*/
|
|
15
|
-
values: DialogValues<Record<string, any>>;
|
|
16
15
|
inProcess: IInProcess;
|
|
17
16
|
fullscreenMode?: boolean;
|
|
18
17
|
prevDialogRect: WithBackdrop['prevDialogRect'];
|
|
19
|
-
body: TDialogCallbackFn
|
|
18
|
+
body: TDialogCallbackFn<any, any>;
|
|
20
19
|
/**
|
|
21
20
|
* Indicates whether the operation was aborted by the user or the system.
|
|
22
21
|
* - true: The dialog or background process (e.g., API request) was aborted.
|
|
23
22
|
* - false: The operation is continuing or completed normally.
|
|
24
23
|
*/
|
|
25
24
|
aborted: boolean;
|
|
25
|
+
inject: DialogInjectDef<I>;
|
|
26
26
|
}
|
|
27
27
|
export interface DialogFormikAdapter<Values> extends Omit<FormikProps<any>, 'values' | 'setValues' | 'setFieldValue' | 'validateForm' | 'errors'> {
|
|
28
28
|
values: Values;
|
|
@@ -31,27 +31,26 @@ export interface DialogFormikAdapter<Values> extends Omit<FormikProps<any>, 'val
|
|
|
31
31
|
validateForm(): Promise<any>;
|
|
32
32
|
errors: any;
|
|
33
33
|
}
|
|
34
|
-
export interface BaseDialogProps<
|
|
35
|
-
|
|
34
|
+
export interface BaseDialogProps<V extends Record<string, any>, I> {
|
|
35
|
+
inject: DialogInjectDef<I>;
|
|
36
|
+
initialValues: Dialogify<V>;
|
|
36
37
|
initialOptions?: DialogOptionsType;
|
|
37
|
-
body: TDialogCallbackFn
|
|
38
|
-
header?: TDialogCallbackFn
|
|
38
|
+
body: TDialogCallbackFn<V, I>;
|
|
39
|
+
header?: TDialogCallbackFn<V, I>;
|
|
39
40
|
actions?: Array<DialogAction>;
|
|
40
|
-
didMountCallback?:
|
|
41
|
+
didMountCallback?: TDialogCallbackFn<V, I, void>;
|
|
41
42
|
dialogSize?: IDialogSize;
|
|
42
43
|
stateListener: TDialogStateListenerCallbackType;
|
|
43
|
-
xhandlers: DialogExternalHandlers<StockDialogHandlers>;
|
|
44
|
-
xrefs: DialogExternalRefs<StockDialogRefs>;
|
|
45
44
|
initialHolder: TInitialHolder;
|
|
46
45
|
snackbarAnchor?: ISnackbarAnchor;
|
|
47
46
|
dom: HTMLDivElement;
|
|
48
47
|
parent?: DialogValues<Record<string, any>>;
|
|
49
|
-
onClose?:
|
|
48
|
+
onClose?: TDialogCallbackFn<V, I, void>;
|
|
50
49
|
root?: any;
|
|
51
|
-
keyboardListener: (key: string, dialog: IDialogApiDef) => void;
|
|
52
|
-
resizeListener?: (size: IDialogSize, dialog: IDialogApiDef) => void;
|
|
50
|
+
keyboardListener: (key: string, dialog: IDialogApiDef<V, I>) => void;
|
|
51
|
+
resizeListener?: (size: IDialogSize, dialog: IDialogApiDef<V, I>) => void;
|
|
53
52
|
processingListeners?: Array<(inProcess: boolean) => void>;
|
|
54
|
-
abortedListeners?: Array<(dialog: IDialogApiDef) => void>;
|
|
53
|
+
abortedListeners?: Array<(dialog: IDialogApiDef<V, I>) => void>;
|
|
55
54
|
}
|
|
56
55
|
export interface IDialogSize {
|
|
57
56
|
width?: ITypeWidth | number;
|
|
@@ -141,15 +140,19 @@ export interface BaseDialogSlotProps {
|
|
|
141
140
|
dialogOptions: DialogOptionsType;
|
|
142
141
|
dialog?: IDialogApiDef;
|
|
143
142
|
}
|
|
144
|
-
export interface IStateDef extends Pick<BaseDialogState,
|
|
143
|
+
export interface IStateDef extends Pick<BaseDialogState<any, any>, "fullscreenMode" | "inProcess"> {
|
|
145
144
|
}
|
|
146
145
|
export interface IListenerDialogDef extends Omit<IDialogApiDef, "values" | "setValues"> {
|
|
147
146
|
}
|
|
148
147
|
export type TDialogStateListenerCallbackType = (values: FormikProps<any>['values'], dialog: IListenerDialogDef) => void;
|
|
149
|
-
export type TDialogCallbackFn<T = React.ReactNode | React.ReactElement> = (dialog: IDialogApiDef) => T;
|
|
150
|
-
export type
|
|
151
|
-
|
|
152
|
-
|
|
148
|
+
export type TDialogCallbackFn<V, I, T = React.ReactNode | React.ReactElement> = (dialog: DialogBase<V, I> & IDialogApiDef) => T;
|
|
149
|
+
export type DialogValues<V extends Record<string, any>> = {
|
|
150
|
+
[K in keyof V]: Dialogify<V[K]>;
|
|
151
|
+
};
|
|
152
|
+
export type DialogInjects<I extends Record<string, any>> = {
|
|
153
|
+
[K in keyof I]: DialogInjectDef<I[K]>;
|
|
154
|
+
};
|
|
155
|
+
export interface IDialogApiDef<V extends Record<string, any> = Record<string, any>, I extends Record<string, any> = Record<string, any>> extends Pick<DialogBase<V, I>, 'isInProcess' | 'setInProcess' | 'values' | 'setValue' | 'setValues' | 'close' | 'dialogOptions' | 'actions' | 'snackbar' | 'formikValidate' | 'formikProps' | 'focus' | 'updateBody' | 'processingListener' | 'onAbort' | 'deps' | 'inject'> {
|
|
153
156
|
}
|
|
154
157
|
interface OpenArgs {
|
|
155
158
|
message: any;
|
|
@@ -173,10 +176,10 @@ export interface IDialogSnackbar {
|
|
|
173
176
|
}
|
|
174
177
|
export interface WithBackdrop {
|
|
175
178
|
ref: React.RefObject<any>;
|
|
176
|
-
body: TDialogCallbackFn
|
|
177
|
-
header: TDialogCallbackFn
|
|
179
|
+
body: TDialogCallbackFn<any, any>;
|
|
180
|
+
header: TDialogCallbackFn<any, any>;
|
|
178
181
|
actions?: DialogAction[];
|
|
179
|
-
dialog: DialogBase<any, any
|
|
182
|
+
dialog: DialogBase<any, any>;
|
|
180
183
|
backdropRef: RefObject<any>;
|
|
181
184
|
initialValues: Partial<Record<string, any>>;
|
|
182
185
|
dialogRef: RefObject<any>;
|
|
@@ -194,8 +197,8 @@ export interface DialogWithBackdropWrapperRefProps {
|
|
|
194
197
|
formikProps?: FormikProps<any>;
|
|
195
198
|
}
|
|
196
199
|
export interface IContentProps {
|
|
197
|
-
body: TDialogCallbackFn
|
|
198
|
-
header: TDialogCallbackFn
|
|
200
|
+
body: TDialogCallbackFn<any, any>;
|
|
201
|
+
header: TDialogCallbackFn<any, any>;
|
|
199
202
|
actions: DialogAction[];
|
|
200
203
|
dialogRef: React.RefObject<any>;
|
|
201
204
|
headerRef: React.RefObject<any>;
|
|
@@ -203,7 +206,7 @@ export interface IContentProps {
|
|
|
203
206
|
footerRef: React.RefObject<DialogContentFooterReturnType>;
|
|
204
207
|
backdropRef: React.RefObject<any>;
|
|
205
208
|
dialogOptions: DialogOptionsType;
|
|
206
|
-
dialog: DialogBase<any, any
|
|
209
|
+
dialog: DialogBase<any, any>;
|
|
207
210
|
resizeableObject?: Resizeable | null;
|
|
208
211
|
prevDialogRect: WithBackdrop['prevDialogRect'];
|
|
209
212
|
snackbarRef: WithBackdrop['snackbarRef'];
|
|
@@ -248,10 +251,6 @@ export type NonFunction<T> = T extends Function ? never : T;
|
|
|
248
251
|
export type DialogValue<T> = string | number | boolean | null | undefined | DialogValue<T>[] | {
|
|
249
252
|
[key: string]: DialogValue<T>;
|
|
250
253
|
};
|
|
251
|
-
export type ModelDialogValues<T> = {
|
|
252
|
-
[K in keyof T]: DialogValue<T>;
|
|
253
|
-
};
|
|
254
|
-
export type DialogValues<T extends Record<string, any>> = ModelDialogValues<T>;
|
|
255
254
|
export type Dialogify<T> = T extends Function ? never : T extends {
|
|
256
255
|
current: null;
|
|
257
256
|
} ? never : T extends string | number | boolean | null | undefined | Date ? T : T extends Array<infer U> ? Dialogify<U>[] : T extends object ? {
|
|
@@ -269,6 +268,11 @@ export type DialogExternalRefs<T> = T extends {
|
|
|
269
268
|
} ? DialogExternalRef : T extends object ? {
|
|
270
269
|
[K in keyof T]: DialogExternalRefs<T[K]>;
|
|
271
270
|
} : never;
|
|
271
|
+
export type DialogInjectDef<T> = T extends Function ? T : T extends {
|
|
272
|
+
current: any;
|
|
273
|
+
} ? T : T extends string | number | boolean | null | undefined | Date ? never : T extends Array<infer U> ? never : T extends object ? {
|
|
274
|
+
[K in keyof T]: DialogInjectDef<T[K]>;
|
|
275
|
+
} : never;
|
|
272
276
|
export interface BaseDialogDOMRect {
|
|
273
277
|
height?: number;
|
|
274
278
|
width?: number;
|
|
@@ -292,6 +296,6 @@ export interface ICoords {
|
|
|
292
296
|
y: number;
|
|
293
297
|
}
|
|
294
298
|
export interface DialogProps {
|
|
295
|
-
setHeader(header: TDialogCallbackFn): Dialog<any, any
|
|
299
|
+
setHeader(header: TDialogCallbackFn<any, any>): Dialog<any, any>;
|
|
296
300
|
}
|
|
297
301
|
export {};
|
package/utils/resizeManager.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { DialogBase } from "../components/index.js";
|
|
3
3
|
import { Resizeable } from "../helpers/index.js";
|
|
4
|
-
declare const resizeManager: (dialogRef: React.RefObject<HTMLDivElement>, dialog: DialogBase<
|
|
4
|
+
declare const resizeManager: <V, I>(dialogRef: React.RefObject<HTMLDivElement>, dialog: DialogBase<V, I>) => Resizeable | null;
|
|
5
5
|
export { resizeManager };
|