react-dialogger 1.1.99 → 1.1.100
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.d.ts +7 -8
- package/components/DialogBase.js +1 -38
- package/models/Dialog.d.ts +4 -3
- package/models/Dialog.js +16 -2
- package/package.json +1 -1
- package/types/DialogTypes.d.ts +9 -6
|
@@ -1,12 +1,13 @@
|
|
|
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, TDialogCallbackVoidFn, WithBackdrop, IDialogSnackbar, IInProcess, TInitialHolder, ISnackbarAnchor, TSeverity, TAccessFrom, ActionApiDef, DialogContentFooterReturnType, DialogFormikAdapter, DialogHandlers, DialogHandlerFn,
|
|
4
|
+
import { BaseDialogProps, BaseDialogState, IDialogSize, DialogOptionsType, TDialogCallbackFn, TDialogCallbackVoidFn, WithBackdrop, IDialogSnackbar, IInProcess, TInitialHolder, ISnackbarAnchor, TSeverity, TAccessFrom, ActionApiDef, DialogContentFooterReturnType, DialogFormikAdapter, DialogHandlers, DialogHandlerFn, Dialogify } 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
8
|
type FeatureType = Partial<Record<string, any>>;
|
|
9
|
-
declare class DialogBase<Values extends
|
|
9
|
+
declare class DialogBase<Values extends Record<string, any>> extends Component<BaseDialogProps<Values>, BaseDialogState> {
|
|
10
|
+
protected _initialValues: Dialogify<Values>;
|
|
10
11
|
_dialogTranslate: {
|
|
11
12
|
lastX: number;
|
|
12
13
|
lastY: number;
|
|
@@ -29,7 +30,6 @@ declare class DialogBase<Values extends DialogValues<Record<string, any>>> exten
|
|
|
29
30
|
protected _onClose: TDialogCallbackVoidFn;
|
|
30
31
|
protected _shInterval: number;
|
|
31
32
|
protected _snackbarAnchor: ISnackbarAnchor;
|
|
32
|
-
protected _initialValues: DialogValues<Values>;
|
|
33
33
|
protected _parent: Dialog<Values>;
|
|
34
34
|
protected _handlers: DialogHandlers;
|
|
35
35
|
private _inProcess;
|
|
@@ -39,8 +39,7 @@ declare class DialogBase<Values extends DialogValues<Record<string, any>>> exten
|
|
|
39
39
|
private _accessFrom;
|
|
40
40
|
private readonly _processingListeners;
|
|
41
41
|
private readonly _abortedListeners;
|
|
42
|
-
constructor(props: BaseDialogProps & {
|
|
43
|
-
initialValues: DialogValues<Values>;
|
|
42
|
+
constructor(props: BaseDialogProps<Values> & {
|
|
44
43
|
parent: Dialog<Values>;
|
|
45
44
|
});
|
|
46
45
|
private T;
|
|
@@ -63,9 +62,9 @@ declare class DialogBase<Values extends DialogValues<Record<string, any>>> exten
|
|
|
63
62
|
set formikProps(value: FormikProps<any>);
|
|
64
63
|
get formikValidate(): Promise<DialogFormikAdapter<any>>;
|
|
65
64
|
set inlineFormikProps(inlineFormikProps: IFormikAdapter);
|
|
66
|
-
get values():
|
|
67
|
-
setValue(key: string, value:
|
|
68
|
-
setValues(values:
|
|
65
|
+
get values(): Values;
|
|
66
|
+
setValue<T>(key: string, value: Dialogify<T>): void;
|
|
67
|
+
setValues<T>(values: Dialogify<T>, callbackFn?: () => void): void;
|
|
69
68
|
componentDidMount(): void;
|
|
70
69
|
setInProcess: (process: boolean, message?: string, holder?: TInitialHolder) => this;
|
|
71
70
|
isInProcess: () => IInProcess;
|
package/components/DialogBase.js
CHANGED
|
@@ -68,8 +68,6 @@ var _helpers_1 = require("../helpers/index.js");
|
|
|
68
68
|
var _context_1 = require("../context/index.js");
|
|
69
69
|
var DialogBase = /** @class */ (function (_super) {
|
|
70
70
|
__extends(DialogBase, _super);
|
|
71
|
-
// constructor(props: Readonly<BaseDialogProps> = {} as Readonly<BaseDialogProps>) {
|
|
72
|
-
// constructor(props: BaseDialogProps) {
|
|
73
71
|
function DialogBase(props) {
|
|
74
72
|
var _a, _b;
|
|
75
73
|
var _this = _super.call(this, props) || this;
|
|
@@ -127,20 +125,12 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
127
125
|
if (!process) {
|
|
128
126
|
_this.snackbar.close("kInProcess");
|
|
129
127
|
}
|
|
130
|
-
// if( typeof this._processingListener === "function" ){
|
|
131
|
-
// this._processingListener(process);
|
|
132
|
-
//
|
|
133
|
-
// }
|
|
134
128
|
for (var _i = 0, _l = _this._processingListeners; _i < _l.length; _i++) {
|
|
135
129
|
var listener = _l[_i];
|
|
136
130
|
if (typeof listener === "function") {
|
|
137
131
|
listener(process);
|
|
138
132
|
}
|
|
139
133
|
}
|
|
140
|
-
// if( ._processingListener === "function" ){
|
|
141
|
-
// // this._processingListener(process);
|
|
142
|
-
// //
|
|
143
|
-
// // }
|
|
144
134
|
// @ts-ignore
|
|
145
135
|
(_k = _this._footerRef.current) === null || _k === void 0 ? void 0 : _k.setProcessing(process);
|
|
146
136
|
return _this;
|
|
@@ -197,15 +187,9 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
197
187
|
return _this.props.dom;
|
|
198
188
|
};
|
|
199
189
|
_this.render = function () {
|
|
200
|
-
return (0, jsx_runtime_1.jsx)(_context_1.DialogContentContextProvider
|
|
201
|
-
// 1️⃣initialValues={this.props.initialValues}
|
|
202
|
-
, {
|
|
203
|
-
// 1️⃣initialValues={this.props.initialValues}
|
|
204
|
-
dialogBase: _this,
|
|
190
|
+
return (0, jsx_runtime_1.jsx)(_context_1.DialogContentContextProvider, { dialogBase: _this,
|
|
205
191
|
// Component
|
|
206
|
-
// body={this.state.body(this)}
|
|
207
192
|
body: _this.state.body,
|
|
208
|
-
// body={<this.Body body={this.state.body} /> as any}
|
|
209
193
|
// Refs Props
|
|
210
194
|
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, {}) });
|
|
211
195
|
};
|
|
@@ -356,9 +340,6 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
356
340
|
configurable: true
|
|
357
341
|
});
|
|
358
342
|
Object.defineProperty(DialogBase.prototype, "inlineFormikProps", {
|
|
359
|
-
// ✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨
|
|
360
|
-
// ༄ inlineFormikProps 👉 Will Be initialized from Body or Content Component
|
|
361
|
-
// Instead of Dialog stateValues use FormikEngine
|
|
362
343
|
set: function (inlineFormikProps) {
|
|
363
344
|
this._inlineFormikProps = inlineFormikProps;
|
|
364
345
|
},
|
|
@@ -366,35 +347,22 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
366
347
|
configurable: true
|
|
367
348
|
});
|
|
368
349
|
Object.defineProperty(DialogBase.prototype, "values", {
|
|
369
|
-
// ✨✨✨✨✨✨✨✨✨✨✨
|
|
370
350
|
get: function () {
|
|
371
|
-
// get values(): DialogValues<Values> {
|
|
372
351
|
return this._inlineFormikProps.values;
|
|
373
|
-
// UseImperative
|
|
374
|
-
// return this._dialogWithBackDropRef?.current?.formikProps.values;
|
|
375
352
|
},
|
|
376
353
|
enumerable: false,
|
|
377
354
|
configurable: true
|
|
378
355
|
});
|
|
379
|
-
// ✨✨✨✨✨✨✨✨✨✨✨
|
|
380
356
|
DialogBase.prototype.setValue = function (key, value) {
|
|
381
357
|
var _a;
|
|
382
358
|
(_a = this._inlineFormikProps) === null || _a === void 0 ? void 0 : _a.setFieldValue(key, value);
|
|
383
|
-
// UseImperative
|
|
384
|
-
// this._dialogWithBackDropRef?.current?.formikProps?.setFieldValue(key, value);
|
|
385
359
|
};
|
|
386
|
-
// ✨✨✨✨✨✨✨✨✨✨✨
|
|
387
|
-
// public setValues(values: IFormikAdapter['values'], callbackFn?: () => void): void {
|
|
388
|
-
// 2 public setValues(values: DialogValues<Values>, callbackFn?: () => void): void {
|
|
389
360
|
DialogBase.prototype.setValues = function (values, callbackFn) {
|
|
390
361
|
this._inlineFormikProps.setValues(values);
|
|
391
|
-
// UseImperative
|
|
392
|
-
// this._dialogWithBackDropRef?.current?.formikProps?.setValues(values);
|
|
393
362
|
if (typeof callbackFn === "function") {
|
|
394
363
|
callbackFn();
|
|
395
364
|
}
|
|
396
365
|
};
|
|
397
|
-
// ✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨
|
|
398
366
|
DialogBase.prototype.componentDidMount = function () {
|
|
399
367
|
var _this = this;
|
|
400
368
|
var _a, _b, _c;
|
|
@@ -423,8 +391,6 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
423
391
|
setTimeout(function () {
|
|
424
392
|
_this.props.root.unmount();
|
|
425
393
|
_this.props.dom.remove();
|
|
426
|
-
// unmountComponentAtNode(this.props.dom);
|
|
427
|
-
// @deprecated
|
|
428
394
|
if (typeof _this._onClose === "function") {
|
|
429
395
|
_this._onClose(_this);
|
|
430
396
|
}
|
|
@@ -451,13 +417,10 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
451
417
|
this.setState(function (prevState) { return (__assign(__assign({}, _this.state), { body: body })); });
|
|
452
418
|
};
|
|
453
419
|
DialogBase.prototype.processingListener = function (listener) {
|
|
454
|
-
// @ts-ignore
|
|
455
|
-
// this._processingListeners = listener;
|
|
456
420
|
this._processingListeners.push(listener);
|
|
457
421
|
return this;
|
|
458
422
|
};
|
|
459
423
|
DialogBase.prototype.onAbort = function (callbackFn) {
|
|
460
|
-
// @ts-ignore
|
|
461
424
|
this._abortedListeners.push(callbackFn);
|
|
462
425
|
return this;
|
|
463
426
|
};
|
package/models/Dialog.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { DialogAction } from "./DialogAction";
|
|
3
|
-
import { TInitialHolder, IDialogSize, TDialogStateListenerCallbackType, DialogOptionsType, IDialogApiDef, TDialogCallbackVoidFn, TDialogCallbackFn, DialogHandlers,
|
|
4
|
-
declare class Dialog<Values extends
|
|
3
|
+
import { TInitialHolder, IDialogSize, TDialogStateListenerCallbackType, DialogOptionsType, IDialogApiDef, TDialogCallbackVoidFn, TDialogCallbackFn, DialogHandlers, Dialogify } from "../types/index.js";
|
|
4
|
+
declare class Dialog<Values extends Record<string, any>> {
|
|
5
5
|
private readonly _processingListeners;
|
|
6
6
|
private readonly _abortedListeners;
|
|
7
7
|
private _stateListener;
|
|
@@ -35,7 +35,7 @@ declare class Dialog<Values extends ModelDialogValues<Record<string, any>>> {
|
|
|
35
35
|
stateListener(listener: TDialogStateListenerCallbackType): this;
|
|
36
36
|
processingListener(listener: (inProcess: boolean) => void): this;
|
|
37
37
|
onAbort(callbackFn: TDialogCallbackFn<void>): this;
|
|
38
|
-
initialValues(values:
|
|
38
|
+
initialValues<T extends Record<string, any>>(values: Dialogify<T>): Dialog<T>;
|
|
39
39
|
handlers(handlers: DialogHandlers): this;
|
|
40
40
|
initialHolder(holder: TInitialHolder): this;
|
|
41
41
|
keyboardListener(listener: (key: string, dialog: IDialogApiDef) => void): this;
|
|
@@ -43,6 +43,7 @@ declare class Dialog<Values extends ModelDialogValues<Record<string, any>>> {
|
|
|
43
43
|
onClose(callback: TDialogCallbackVoidFn): this;
|
|
44
44
|
private highestZ;
|
|
45
45
|
private createDom;
|
|
46
|
+
get values(): Dialogify<Values>;
|
|
46
47
|
show(callback?: TDialogCallbackVoidFn): void;
|
|
47
48
|
}
|
|
48
49
|
export default Dialog;
|
package/models/Dialog.js
CHANGED
|
@@ -128,9 +128,16 @@ var Dialog = /** @class */ (function () {
|
|
|
128
128
|
this._abortedListeners.push(callbackFn);
|
|
129
129
|
return this;
|
|
130
130
|
};
|
|
131
|
+
// 👌Ok
|
|
132
|
+
// public initialValues<T>( values: Dialogify<T> ): this {
|
|
133
|
+
// this._initialValues = values as Dialogify<Values>;;
|
|
134
|
+
// return this;
|
|
135
|
+
// }
|
|
136
|
+
// 👌Ok Combined with Dialog Class
|
|
131
137
|
Dialog.prototype.initialValues = function (values) {
|
|
132
|
-
|
|
133
|
-
|
|
138
|
+
var next = this;
|
|
139
|
+
next._initialValues = values;
|
|
140
|
+
return next;
|
|
134
141
|
};
|
|
135
142
|
Dialog.prototype.handlers = function (handlers) {
|
|
136
143
|
this._handlers = handlers;
|
|
@@ -152,6 +159,13 @@ var Dialog = /** @class */ (function () {
|
|
|
152
159
|
this._onCloseCallback = callback;
|
|
153
160
|
return this;
|
|
154
161
|
};
|
|
162
|
+
Object.defineProperty(Dialog.prototype, "values", {
|
|
163
|
+
get: function () {
|
|
164
|
+
return this._initialValues;
|
|
165
|
+
},
|
|
166
|
+
enumerable: false,
|
|
167
|
+
configurable: true
|
|
168
|
+
});
|
|
155
169
|
Dialog.prototype.show = function (callback) {
|
|
156
170
|
var dom = this.createDom();
|
|
157
171
|
var root = (0, client_1.createRoot)(dom);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-dialogger",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.100",
|
|
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",
|
package/types/DialogTypes.d.ts
CHANGED
|
@@ -31,7 +31,8 @@ export interface DialogFormikAdapter<Values> extends Omit<FormikProps<any>, 'val
|
|
|
31
31
|
validateForm(): Promise<any>;
|
|
32
32
|
errors: any;
|
|
33
33
|
}
|
|
34
|
-
export interface BaseDialogProps {
|
|
34
|
+
export interface BaseDialogProps<Values extends Record<string, any>> {
|
|
35
|
+
initialValues: Dialogify<Values>;
|
|
35
36
|
initialOptions?: DialogOptionsType;
|
|
36
37
|
body: TDialogCallbackFn;
|
|
37
38
|
header?: TDialogCallbackFn;
|
|
@@ -39,7 +40,6 @@ export interface BaseDialogProps {
|
|
|
39
40
|
didMountCallback?: TDialogCallbackVoidFn;
|
|
40
41
|
dialogSize?: IDialogSize;
|
|
41
42
|
stateListener: TDialogStateListenerCallbackType;
|
|
42
|
-
initialValues: DialogValues<Record<string, any>>;
|
|
43
43
|
handlers: DialogHandlers;
|
|
44
44
|
initialHolder: TInitialHolder;
|
|
45
45
|
snackbarAnchor?: ISnackbarAnchor;
|
|
@@ -245,14 +245,17 @@ export type TInitialValues<T extends Record<string, any>> = T;
|
|
|
245
245
|
export type TUserProps = {
|
|
246
246
|
[K: string]: any;
|
|
247
247
|
};
|
|
248
|
-
export type NonFunction<T> = T extends
|
|
248
|
+
export type NonFunction<T> = T extends Function ? never : T;
|
|
249
249
|
export type DialogValue<T> = string | number | boolean | null | undefined | DialogValue<T>[] | {
|
|
250
250
|
[key: string]: DialogValue<T>;
|
|
251
|
-
}
|
|
251
|
+
};
|
|
252
252
|
export type ModelDialogValues<T> = {
|
|
253
|
-
[
|
|
253
|
+
[K in keyof T]: DialogValue<T>;
|
|
254
254
|
};
|
|
255
|
-
export type DialogValues<T
|
|
255
|
+
export type DialogValues<T extends Record<string, any>> = ModelDialogValues<T>;
|
|
256
|
+
export type Dialogify<T> = T extends Function ? never : T extends string | number | boolean | null | undefined ? T : T extends Array<infer U> ? Dialogify<U>[] : T extends object ? {
|
|
257
|
+
[K in keyof T]: Dialogify<T[K]>;
|
|
258
|
+
} : never;
|
|
256
259
|
export type DialogHandlerFn = (...args: any[]) => any;
|
|
257
260
|
export type DialogHandlers = Record<string, DialogHandlerFn>;
|
|
258
261
|
export interface BaseDialogDOMRect {
|