react-dialogger 1.1.106 → 1.1.107
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 -12
- package/components/DialogBase.js +10 -19
- package/models/Dialog.d.ts +4 -4
- package/models/Dialog.js +4 -4
- package/package.json +1 -1
- package/types/DialogTypes.d.ts +7 -7
|
@@ -1,11 +1,10 @@
|
|
|
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,
|
|
4
|
+
import { BaseDialogProps, BaseDialogState, IDialogSize, DialogOptionsType, TDialogCallbackFn, TDialogCallbackVoidFn, WithBackdrop, IDialogSnackbar, IInProcess, TInitialHolder, ISnackbarAnchor, TSeverity, TAccessFrom, ActionApiDef, DialogContentFooterReturnType, DialogFormikAdapter, DialogExternalHandlers, DialogExternalHandlerFn, Dialogify, DialogExternalRefs, DialogExternalRef } 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
|
-
type FeatureType = Partial<Record<string, any>>;
|
|
9
8
|
declare class DialogBase<Values extends Record<string, any>> extends Component<BaseDialogProps<Values>, BaseDialogState> {
|
|
10
9
|
protected _initialValues: Dialogify<Values>;
|
|
11
10
|
_dialogTranslate: {
|
|
@@ -31,8 +30,8 @@ declare class DialogBase<Values extends Record<string, any>> extends Component<B
|
|
|
31
30
|
protected _shInterval: number;
|
|
32
31
|
protected _snackbarAnchor: ISnackbarAnchor;
|
|
33
32
|
protected _parent: Dialog<Values>;
|
|
34
|
-
protected
|
|
35
|
-
protected
|
|
33
|
+
protected _xhandlers: DialogExternalHandlers;
|
|
34
|
+
protected _xrefs: DialogExternalRefs;
|
|
36
35
|
private _inProcess;
|
|
37
36
|
private _footerRef;
|
|
38
37
|
protected _headerRef: RefObject<DialogContentFooterReturnType>;
|
|
@@ -43,14 +42,10 @@ declare class DialogBase<Values extends Record<string, any>> extends Component<B
|
|
|
43
42
|
constructor(props: BaseDialogProps<Values> & {
|
|
44
43
|
parent: Dialog<Values>;
|
|
45
44
|
});
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
get
|
|
49
|
-
|
|
50
|
-
get externalRefs(): DialogExternalRefs;
|
|
51
|
-
addExternalRef(key: string, ref: DialogRef): void;
|
|
52
|
-
addFeature(key: string, value: any): void;
|
|
53
|
-
getFeature(key: string): FeatureType;
|
|
45
|
+
get xhandlers(): DialogExternalHandlers;
|
|
46
|
+
appendXHandler(key: string, handler: DialogExternalHandlerFn): void;
|
|
47
|
+
get xrefs(): DialogExternalRefs;
|
|
48
|
+
appendXRef(key: string, ref: DialogExternalRef): void;
|
|
54
49
|
get parent(): Dialog<Values>;
|
|
55
50
|
get dialogTranslate(): {
|
|
56
51
|
lastX: number;
|
package/components/DialogBase.js
CHANGED
|
@@ -78,8 +78,6 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
78
78
|
_this._inProcess = { inProcess: false };
|
|
79
79
|
_this._footerRef = React.createRef();
|
|
80
80
|
_this._headerRef = React.createRef();
|
|
81
|
-
_this.T = [];
|
|
82
|
-
_this._features = {};
|
|
83
81
|
// Initialize a ref for each action dynamically
|
|
84
82
|
_this.initializeActionRef = function (key) {
|
|
85
83
|
if (!_this._actionRefs.hasOwnProperty(key)) {
|
|
@@ -245,46 +243,39 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
245
243
|
_this._dialogWithBackDropRef = (0, react_1.createRef)();
|
|
246
244
|
_this._processingListeners = (_a = props.processingListeners) !== null && _a !== void 0 ? _a : [];
|
|
247
245
|
_this._abortedListeners = (_b = props.abortedListeners) !== null && _b !== void 0 ? _b : [];
|
|
248
|
-
_this.
|
|
249
|
-
_this._handlers = props.handlers;
|
|
250
|
-
_this._externalRefs = props.externalRefs;
|
|
246
|
+
_this._xhandlers = props.xhandlers;
|
|
251
247
|
return _this;
|
|
248
|
+
// this._externalRefs = props.externalRefs;
|
|
252
249
|
}
|
|
253
|
-
Object.defineProperty(DialogBase.prototype, "
|
|
250
|
+
Object.defineProperty(DialogBase.prototype, "xhandlers", {
|
|
254
251
|
get: function () {
|
|
255
|
-
return this.
|
|
252
|
+
return this._xhandlers;
|
|
256
253
|
},
|
|
257
254
|
enumerable: false,
|
|
258
255
|
configurable: true
|
|
259
256
|
});
|
|
260
|
-
DialogBase.prototype.
|
|
257
|
+
DialogBase.prototype.appendXHandler = function (key, handler) {
|
|
261
258
|
if (!key) {
|
|
262
259
|
throw new Error('Handler key is required');
|
|
263
260
|
}
|
|
264
261
|
if (typeof handler !== 'function') {
|
|
265
262
|
throw new Error("Handler \"".concat(key, "\" must be a function"));
|
|
266
263
|
}
|
|
267
|
-
this.
|
|
264
|
+
this._xhandlers[key] = handler;
|
|
268
265
|
};
|
|
269
|
-
Object.defineProperty(DialogBase.prototype, "
|
|
266
|
+
Object.defineProperty(DialogBase.prototype, "xrefs", {
|
|
270
267
|
get: function () {
|
|
271
|
-
return this.
|
|
268
|
+
return this._xrefs;
|
|
272
269
|
},
|
|
273
270
|
enumerable: false,
|
|
274
271
|
configurable: true
|
|
275
272
|
});
|
|
276
|
-
DialogBase.prototype.
|
|
273
|
+
DialogBase.prototype.appendXRef = function (key, ref) {
|
|
277
274
|
if (!key)
|
|
278
275
|
throw new Error('Ref key is required');
|
|
279
276
|
if (!(0, isRefObject_1.isRefObject)(ref))
|
|
280
277
|
throw new Error("Ref \"".concat(key, "\" must be a Reference RefObject"));
|
|
281
|
-
this.
|
|
282
|
-
};
|
|
283
|
-
DialogBase.prototype.addFeature = function (key, value) {
|
|
284
|
-
this._features[key] = value;
|
|
285
|
-
};
|
|
286
|
-
DialogBase.prototype.getFeature = function (key) {
|
|
287
|
-
return this._features[key];
|
|
278
|
+
this._xrefs[key] = ref;
|
|
288
279
|
};
|
|
289
280
|
Object.defineProperty(DialogBase.prototype, "parent", {
|
|
290
281
|
get: function () {
|
package/models/Dialog.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { DialogAction } from "./DialogAction";
|
|
3
|
-
import { TInitialHolder, IDialogSize, TDialogStateListenerCallbackType, DialogOptionsType, IDialogApiDef, TDialogCallbackVoidFn, TDialogCallbackFn,
|
|
3
|
+
import { TInitialHolder, IDialogSize, TDialogStateListenerCallbackType, DialogOptionsType, IDialogApiDef, TDialogCallbackVoidFn, TDialogCallbackFn, DialogExternalHandlers, Dialogify, DialogExternalRefs } from "../types/index.js";
|
|
4
4
|
declare class Dialog<Values extends Record<string, any>> {
|
|
5
5
|
private readonly _processingListeners;
|
|
6
6
|
private readonly _abortedListeners;
|
|
@@ -21,8 +21,8 @@ declare class Dialog<Values extends Record<string, any>> {
|
|
|
21
21
|
* Fonksiyon taşıdığını net anlatıyor
|
|
22
22
|
* UI / Dialog / Form bağlamında alışıldık
|
|
23
23
|
* */
|
|
24
|
-
private
|
|
25
|
-
private
|
|
24
|
+
private _xhandlers;
|
|
25
|
+
private _xrefs;
|
|
26
26
|
private _headerRef;
|
|
27
27
|
private readonly _apiRef;
|
|
28
28
|
private _onCloseCallback;
|
|
@@ -37,7 +37,7 @@ declare class Dialog<Values extends Record<string, any>> {
|
|
|
37
37
|
processingListener(listener: (inProcess: boolean) => void): this;
|
|
38
38
|
onAbort(callbackFn: TDialogCallbackFn<void>): this;
|
|
39
39
|
initialValues<T extends Record<string, any>>(values: Dialogify<T>): Dialog<T>;
|
|
40
|
-
registerHandlers(handlers:
|
|
40
|
+
registerHandlers(handlers: DialogExternalHandlers): this;
|
|
41
41
|
registerRefs(refs: DialogExternalRefs): this;
|
|
42
42
|
initialHolder(holder: TInitialHolder): this;
|
|
43
43
|
keyboardListener(listener: (key: string, dialog: IDialogApiDef) => void): this;
|
package/models/Dialog.js
CHANGED
|
@@ -95,7 +95,7 @@ var Dialog = /** @class */ (function () {
|
|
|
95
95
|
if (options) {
|
|
96
96
|
this._dialogOptions = options;
|
|
97
97
|
}
|
|
98
|
-
this.
|
|
98
|
+
this._xrefs = {};
|
|
99
99
|
}
|
|
100
100
|
Dialog.prototype.setHeader = function (header) {
|
|
101
101
|
this._header = header;
|
|
@@ -141,11 +141,11 @@ var Dialog = /** @class */ (function () {
|
|
|
141
141
|
return next;
|
|
142
142
|
};
|
|
143
143
|
Dialog.prototype.registerHandlers = function (handlers) {
|
|
144
|
-
this.
|
|
144
|
+
this._xhandlers = handlers;
|
|
145
145
|
return this;
|
|
146
146
|
};
|
|
147
147
|
Dialog.prototype.registerRefs = function (refs) {
|
|
148
|
-
this.
|
|
148
|
+
this._xrefs = refs;
|
|
149
149
|
return this;
|
|
150
150
|
};
|
|
151
151
|
Dialog.prototype.initialHolder = function (holder) {
|
|
@@ -176,7 +176,7 @@ var Dialog = /** @class */ (function () {
|
|
|
176
176
|
var root = (0, client_1.createRoot)(dom);
|
|
177
177
|
var props = __assign(__assign({
|
|
178
178
|
// Initials
|
|
179
|
-
initialOptions: this._dialogOptions, initialValues: this._initialValues,
|
|
179
|
+
initialOptions: this._dialogOptions, initialValues: this._initialValues, xhandlers: this._xhandlers, xrefs: this._xrefs, didMountCallback: callback,
|
|
180
180
|
// Component contents
|
|
181
181
|
header: this._header, body: this._body, actions: this._actions,
|
|
182
182
|
// Refs
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-dialogger",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.107",
|
|
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
|
@@ -40,8 +40,8 @@ export interface BaseDialogProps<Values extends Record<string, any>> {
|
|
|
40
40
|
didMountCallback?: TDialogCallbackVoidFn;
|
|
41
41
|
dialogSize?: IDialogSize;
|
|
42
42
|
stateListener: TDialogStateListenerCallbackType;
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
xhandlers: DialogExternalHandlers;
|
|
44
|
+
xrefs: DialogExternalRefs;
|
|
45
45
|
initialHolder: TInitialHolder;
|
|
46
46
|
snackbarAnchor?: ISnackbarAnchor;
|
|
47
47
|
dom: HTMLDivElement;
|
|
@@ -149,7 +149,7 @@ export type TDialogStateListenerCallbackType = (values: FormikProps<any>['values
|
|
|
149
149
|
export type TDialogCallbackFn<T = React.ReactNode | React.ReactElement> = (dialog: IDialogApiDef) => T;
|
|
150
150
|
export type TDialogHeader = TDialogCallbackFn | React.ReactNode | React.JSX.Element;
|
|
151
151
|
export type TDialogCallbackVoidFn = TDialogCallbackFn<void>;
|
|
152
|
-
export interface IDialogApiDef extends Pick<DialogBase<any>, 'isInProcess' | 'setInProcess' | 'values' | 'setValue' | 'setValues' | 'close' | 'dialogOptions' | 'actions' | 'snackbar' | 'formikValidate' | 'formikProps' | 'focus' | 'updateBody' | 'processingListener' | '
|
|
152
|
+
export interface IDialogApiDef extends Pick<DialogBase<any>, 'isInProcess' | 'setInProcess' | 'values' | 'setValue' | 'setValues' | 'close' | 'dialogOptions' | 'actions' | 'snackbar' | 'formikValidate' | 'formikProps' | 'focus' | 'updateBody' | 'processingListener' | 'onAbort' | 'xhandlers' | 'appendXHandler' | 'xrefs' | 'appendXRef'> {
|
|
153
153
|
}
|
|
154
154
|
export interface IDialogCloseRef extends Pick<DialogBase<any>, 'close'> {
|
|
155
155
|
}
|
|
@@ -257,13 +257,13 @@ export type DialogValues<T extends Record<string, any>> = ModelDialogValues<T>;
|
|
|
257
257
|
export type Dialogify<T> = T extends Function ? never : T extends string | number | boolean | null | undefined | Date ? T : T extends Array<infer U> ? Dialogify<U>[] : T extends object ? {
|
|
258
258
|
[K in keyof T]: Dialogify<T[K]>;
|
|
259
259
|
} : never;
|
|
260
|
-
export type
|
|
261
|
-
export type
|
|
262
|
-
export type
|
|
260
|
+
export type DialogExternalHandlerFn = (...args: any[]) => any;
|
|
261
|
+
export type DialogExternalHandlers = Record<string, DialogExternalHandlerFn>;
|
|
262
|
+
export type DialogExternalRef = {
|
|
263
263
|
current: unknown;
|
|
264
264
|
};
|
|
265
265
|
export type DialogExternalRefs = {
|
|
266
|
-
[key: string]:
|
|
266
|
+
[key: string]: DialogExternalRef;
|
|
267
267
|
};
|
|
268
268
|
export interface BaseDialogDOMRect {
|
|
269
269
|
height?: number;
|