react-dialogger 1.1.48 → 1.1.49

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.
Files changed (76) hide show
  1. package/README.md +2 -1
  2. package/components/Actions.d.ts +7 -0
  3. package/components/Actions.js +17 -0
  4. package/components/DialogActionBase.d.ts +10 -0
  5. package/components/DialogActionBase.js +13 -11
  6. package/components/DialogBase.d.ts +42 -109
  7. package/components/DialogBase.js +101 -762
  8. package/components/DialogContent.d.ts +1 -19
  9. package/components/DialogContent.js +66 -72
  10. package/components/DialogContentBody.d.ts +3 -5
  11. package/components/DialogContentBody.js +2 -23
  12. package/components/DialogContentFooter.d.ts +4 -0
  13. package/components/{DialogContenFooter.js → DialogContentFooter.js} +6 -33
  14. package/components/DialogContentHeader.d.ts +6 -6
  15. package/components/DialogContentHeader.js +74 -32
  16. package/components/DialogWithBackdropWrapper.d.ts +4 -0
  17. package/components/DialogWithBackdropWrapper.js +72 -0
  18. package/components/Features/DialogCloseAction.js +18 -0
  19. package/components/Features/DialogFullscreenAction.js +24 -0
  20. package/components/{Futures → Features}/DialogInfoAction.js +8 -11
  21. package/components/Features/DialogProcessing.js +14 -0
  22. package/components/RippleButton.d.ts +2 -2
  23. package/components/RippleButton.js +1 -3
  24. package/components/index.d.ts +9 -0
  25. package/components/index.js +24 -0
  26. package/components/utils/effects/jumper-animate.d.ts +2 -0
  27. package/components/utils/effects/jumper-animate.js +36 -0
  28. package/context/index.d.ts +3 -0
  29. package/context/index.js +54 -0
  30. package/{models → helpers}/Resizeable.d.ts +2 -2
  31. package/{models → helpers}/Resizeable.js +23 -11
  32. package/helpers/dialogBoundsMemoize.d.ts +5 -5
  33. package/helpers/dialogBoundsMemoize.js +82 -77
  34. package/helpers/dialogRectAuto.d.ts +3 -0
  35. package/helpers/dialogRectAuto.js +21 -0
  36. package/helpers/formInputKeyListeners.d.ts +2 -0
  37. package/helpers/formInputKeyListeners.js +18 -0
  38. package/helpers/hexToRgb.d.ts +2 -0
  39. package/helpers/hexToRgb.js +19 -0
  40. package/helpers/index.d.ts +1 -0
  41. package/helpers/index.js +3 -1
  42. package/helpers/initDialogMemoizeBounds.d.ts +7 -2
  43. package/helpers/initDialogMemoizeBounds.js +19 -14
  44. package/index.d.ts +3 -4
  45. package/index.js +12 -15
  46. package/models/Dialog.d.ts +29 -36
  47. package/models/Dialog.js +108 -99
  48. package/models/DialogAction.d.ts +1 -39
  49. package/models/DialogAction.js +2 -171
  50. package/models/baseDialogOptions.d.ts +5 -0
  51. package/models/baseDialogOptions.js +63 -0
  52. package/models/index.d.ts +3 -0
  53. package/models/index.js +13 -0
  54. package/package.json +1 -1
  55. package/styles/dialog.css +1 -2
  56. package/{helpers → types}/BoundTypes.d.ts +4 -1
  57. package/types/DialogActionTypes.d.ts +14 -6
  58. package/types/DialogTypes.d.ts +81 -31
  59. package/types/SizePosTypes.d.ts +3 -2
  60. package/types/index.d.ts +1 -1
  61. package/types/types.d.ts +1 -0
  62. package/components/DialogContenFooter.d.ts +0 -13
  63. package/components/Futures/DialogCloseAction.js +0 -30
  64. package/components/Futures/DialogFullscreenAction.js +0 -37
  65. package/components/Futures/DialogProcessing.js +0 -18
  66. package/hooks/useDialogOptions.d.ts +0 -3
  67. package/hooks/useDialogOptions.js +0 -82
  68. /package/components/{Futures → Features}/DialogCloseAction.d.ts +0 -0
  69. /package/components/{Futures → Features}/DialogFullscreenAction.d.ts +0 -0
  70. /package/components/{Futures → Features}/DialogHeaderActionsWrapper.d.ts +0 -0
  71. /package/components/{Futures → Features}/DialogHeaderActionsWrapper.js +0 -0
  72. /package/components/{Futures → Features}/DialogInfoAction.d.ts +0 -0
  73. /package/components/{Futures → Features}/DialogProcessing.d.ts +0 -0
  74. /package/components/{Futures → Features}/index.d.ts +0 -0
  75. /package/components/{Futures → Features}/index.js +0 -0
  76. /package/{helpers → types}/BoundTypes.js +0 -0
@@ -1,2 +1,3 @@
1
1
  export { InitDialogMemoizeBounds, InitDialogMemoizeBoundsDeclared, registeredDialogs } from "./initDialogMemoizeBounds";
2
2
  export * from "./dialogBoundsMemoize";
3
+ export { formInputKeyListeners } from "./formInputKeyListeners";
package/helpers/index.js CHANGED
@@ -14,9 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.registeredDialogs = exports.InitDialogMemoizeBoundsDeclared = exports.InitDialogMemoizeBounds = void 0;
17
+ exports.formInputKeyListeners = exports.registeredDialogs = exports.InitDialogMemoizeBoundsDeclared = exports.InitDialogMemoizeBounds = void 0;
18
18
  var initDialogMemoizeBounds_1 = require("./initDialogMemoizeBounds");
19
19
  Object.defineProperty(exports, "InitDialogMemoizeBounds", { enumerable: true, get: function () { return initDialogMemoizeBounds_1.InitDialogMemoizeBounds; } });
20
20
  Object.defineProperty(exports, "InitDialogMemoizeBoundsDeclared", { enumerable: true, get: function () { return initDialogMemoizeBounds_1.InitDialogMemoizeBoundsDeclared; } });
21
21
  Object.defineProperty(exports, "registeredDialogs", { enumerable: true, get: function () { return initDialogMemoizeBounds_1.registeredDialogs; } });
22
22
  __exportStar(require("./dialogBoundsMemoize"), exports);
23
+ var formInputKeyListeners_1 = require("./formInputKeyListeners");
24
+ Object.defineProperty(exports, "formInputKeyListeners", { enumerable: true, get: function () { return formInputKeyListeners_1.formInputKeyListeners; } });
@@ -1,5 +1,10 @@
1
- import { IDialogBoundDef, IDialogBoundsMemoKey } from "./BoundTypes";
2
- export declare let registeredDialogs: IDialogBoundDef[];
1
+ import { IDialogBoundsMemoKey, RegisteredDialogsMap } from "../types/BoundTypes";
2
+ export declare let registeredDialogs: RegisteredDialogsMap;
3
3
  export declare let InitDialogMemoizeBoundsDeclared: boolean;
4
4
  export declare const BOUNDS_STORE_KEY: IDialogBoundsMemoKey;
5
+ /**
6
+ * Fire by first load the page
7
+ * This should be in App level
8
+ * Create first records
9
+ * */
5
10
  export declare const InitDialogMemoizeBounds: () => void;
@@ -1,12 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InitDialogMemoizeBounds = exports.BOUNDS_STORE_KEY = exports.InitDialogMemoizeBoundsDeclared = exports.registeredDialogs = void 0;
4
- // Sayfa ilk yuklendiginde calisacak
5
- exports.registeredDialogs = [];
4
+ // export let registeredDialogs: IDialogBoundDef[] = [];
5
+ exports.registeredDialogs = new Map();
6
6
  exports.InitDialogMemoizeBoundsDeclared = false;
7
7
  exports.BOUNDS_STORE_KEY = 'react-super-dialog';
8
- // Bu App level sevyesinde olmali
9
- // ILk Kayitlari olusturuyoruz
8
+ /**
9
+ * Fire by first load the page
10
+ * This should be in App level
11
+ * Create first records
12
+ * */
10
13
  var InitDialogMemoizeBounds = function () {
11
14
  var boundStoreExists = function () {
12
15
  try {
@@ -17,22 +20,24 @@ var InitDialogMemoizeBounds = function () {
17
20
  }
18
21
  };
19
22
  var createBoundStore = function () {
20
- if (!boundStoreExists()) {
21
- try {
22
- window.localStorage.setItem(exports.BOUNDS_STORE_KEY, JSON.stringify([]));
23
- }
24
- catch (e) {
25
- console.log(e);
26
- }
23
+ try {
24
+ window.localStorage.setItem(exports.BOUNDS_STORE_KEY, JSON.stringify([]));
25
+ }
26
+ catch (e) {
27
+ console.log(e);
27
28
  }
28
29
  };
29
30
  var readFromStore = function () {
30
- createBoundStore();
31
+ if (!boundStoreExists) {
32
+ createBoundStore();
33
+ }
31
34
  var boundsRaw = window.localStorage.getItem(exports.BOUNDS_STORE_KEY);
35
+ // console.log('boundsRaw', boundStoreExists, JSON.parse(boundsRaw));
32
36
  var boundsArray = boundsRaw ? JSON.parse(boundsRaw) : [];
33
- return boundsArray;
37
+ console.log('readFromStore-0', boundsArray);
38
+ return new Map(boundsArray.map(function (d) { return [d[0], d[1]]; }));
34
39
  };
35
- console.log('readFromStore', readFromStore());
40
+ console.log('readFromStore', window.localStorage.getItem(exports.BOUNDS_STORE_KEY), readFromStore());
36
41
  // Set this on App level
37
42
  exports.registeredDialogs = readFromStore();
38
43
  exports.InitDialogMemoizeBoundsDeclared = true;
package/index.d.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  import './styles/dialog.scss';
2
2
  import './styles/dialog.action.scss';
3
3
  import './styles/circular-progress.scss';
4
- export { default as Dialog } from "./models/Dialog";
5
4
  export { default } from "./models/Dialog";
6
- export { DialogProcessing, DialogCloseAction, DialogFullscreenAction, DialogHeaderActionsWrapper, DialogInfoAction } from "./components/Futures";
7
- export { DialogAction, ActionProgress } from "./models/DialogAction";
8
- export { useDialogOptions } from "./hooks/useDialogOptions";
5
+ export { DialogProcessing, DialogCloseAction, DialogFullscreenAction, DialogHeaderActionsWrapper, DialogInfoAction } from "./components/Features";
6
+ export { DialogAction, ActionProgress, baseDialogOptions } from "./models";
9
7
  export { InitDialogMemoizeBounds } from "./helpers/initDialogMemoizeBounds";
8
+ export { IDialogApiDef } from './types/DialogTypes';
package/index.js CHANGED
@@ -3,26 +3,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.InitDialogMemoizeBounds = exports.useDialogOptions = exports.ActionProgress = exports.DialogAction = exports.DialogInfoAction = exports.DialogHeaderActionsWrapper = exports.DialogFullscreenAction = exports.DialogCloseAction = exports.DialogProcessing = exports.default = exports.Dialog = void 0;
6
+ exports.InitDialogMemoizeBounds = exports.baseDialogOptions = exports.ActionProgress = exports.DialogAction = exports.DialogInfoAction = exports.DialogHeaderActionsWrapper = exports.DialogFullscreenAction = exports.DialogCloseAction = exports.DialogProcessing = exports.default = void 0;
7
7
  require("./styles/dialog.css");
8
8
  require("./styles/dialog.action.css");
9
9
  require("./styles/circular-progress.css");
10
10
  // Models
11
11
  var Dialog_1 = require("./models/Dialog");
12
- Object.defineProperty(exports, "Dialog", { enumerable: true, get: function () { return __importDefault(Dialog_1).default; } });
13
- var Dialog_2 = require("./models/Dialog");
14
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(Dialog_2).default; } });
15
- var Futures_1 = require("./components/Futures");
16
- Object.defineProperty(exports, "DialogProcessing", { enumerable: true, get: function () { return Futures_1.DialogProcessing; } });
17
- Object.defineProperty(exports, "DialogCloseAction", { enumerable: true, get: function () { return Futures_1.DialogCloseAction; } });
18
- Object.defineProperty(exports, "DialogFullscreenAction", { enumerable: true, get: function () { return Futures_1.DialogFullscreenAction; } });
19
- Object.defineProperty(exports, "DialogHeaderActionsWrapper", { enumerable: true, get: function () { return Futures_1.DialogHeaderActionsWrapper; } });
20
- Object.defineProperty(exports, "DialogInfoAction", { enumerable: true, get: function () { return Futures_1.DialogInfoAction; } });
21
- var DialogAction_1 = require("./models/DialogAction");
22
- Object.defineProperty(exports, "DialogAction", { enumerable: true, get: function () { return DialogAction_1.DialogAction; } });
23
- Object.defineProperty(exports, "ActionProgress", { enumerable: true, get: function () { return DialogAction_1.ActionProgress; } });
12
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(Dialog_1).default; } });
13
+ var Features_1 = require("./components/Features");
14
+ Object.defineProperty(exports, "DialogProcessing", { enumerable: true, get: function () { return Features_1.DialogProcessing; } });
15
+ Object.defineProperty(exports, "DialogCloseAction", { enumerable: true, get: function () { return Features_1.DialogCloseAction; } });
16
+ Object.defineProperty(exports, "DialogFullscreenAction", { enumerable: true, get: function () { return Features_1.DialogFullscreenAction; } });
17
+ Object.defineProperty(exports, "DialogHeaderActionsWrapper", { enumerable: true, get: function () { return Features_1.DialogHeaderActionsWrapper; } });
18
+ Object.defineProperty(exports, "DialogInfoAction", { enumerable: true, get: function () { return Features_1.DialogInfoAction; } });
19
+ var models_1 = require("./models");
20
+ Object.defineProperty(exports, "DialogAction", { enumerable: true, get: function () { return models_1.DialogAction; } });
21
+ Object.defineProperty(exports, "ActionProgress", { enumerable: true, get: function () { return models_1.ActionProgress; } });
22
+ Object.defineProperty(exports, "baseDialogOptions", { enumerable: true, get: function () { return models_1.baseDialogOptions; } });
24
23
  // Hooks
25
- var useDialogOptions_1 = require("./hooks/useDialogOptions");
26
- Object.defineProperty(exports, "useDialogOptions", { enumerable: true, get: function () { return useDialogOptions_1.useDialogOptions; } });
27
24
  var initDialogMemoizeBounds_1 = require("./helpers/initDialogMemoizeBounds");
28
25
  Object.defineProperty(exports, "InitDialogMemoizeBounds", { enumerable: true, get: function () { return initDialogMemoizeBounds_1.InitDialogMemoizeBounds; } });
@@ -1,47 +1,40 @@
1
1
  import * as React from "react";
2
2
  import { DialogAction } from "./DialogAction";
3
- import DialogBase from "../components/DialogBase";
4
- import { TInitialHolder, TAccessFrom, ComponentOrderPositions, ISnackbarAnchor, DialogValues } from "../types/types";
5
- import { IDialogSize, TDialogStateListenerCallbackType, DialogOptionsType, IDialogDef, TDialogCallbackNodeFn, TDialogCallbackVoidFn } from "../types/DialogTypes";
6
- import { FormikProps } from "formik";
7
- declare class Dialog extends DialogBase<any> {
8
- constructor(dialogRef?: React.RefObject<IDialogDef | undefined | null> | null, options?: DialogOptionsType);
9
- /**
10
- * @deprecated
11
- * @see dialogOptions.snackbar.anchorOrigin */
12
- snackbarAnchor(anchor?: ISnackbarAnchor): this;
13
- set accessFrom(accessFrom: TAccessFrom);
14
- get accessFrom(): TAccessFrom;
15
- setHeader(header: TDialogCallbackNodeFn): this;
16
- setBody(body: TDialogCallbackNodeFn): this;
17
- setFormik(formik: FormikProps<any>): this;
3
+ import { TInitialHolder, DialogValues } from "../types/types";
4
+ import { IDialogSize, TDialogStateListenerCallbackType, DialogOptionsType, IDialogApiDef, TDialogCallbackVoidFn, TDialogCallbackFn } from "../types/DialogTypes";
5
+ interface DialogProps {
6
+ setHeader(header: TDialogCallbackFn): Dialog;
7
+ }
8
+ declare class Dialog implements DialogProps {
9
+ private _processingListener;
10
+ private _stateListener;
11
+ private _keyboardListener;
12
+ private _resizeListener;
13
+ private _initialHolder;
14
+ private _header;
15
+ private _body;
16
+ private _actions;
17
+ private _dialogSize;
18
+ private readonly _dialogOptions?;
19
+ private _snackbarAnchor;
20
+ private _initialValues;
21
+ private _headerRef;
22
+ private readonly _apiRef;
23
+ constructor(dialogRef?: React.RefObject<IDialogApiDef | undefined | null> | null, options?: DialogOptionsType);
24
+ setHeader(header: TDialogCallbackFn): this;
25
+ setBody(body: TDialogCallbackFn): this;
18
26
  addActions(actions: Array<DialogAction>): this;
19
27
  addAction(action: DialogAction): this;
20
28
  /**
21
29
  * Only from init */
22
30
  stateListener(listener: TDialogStateListenerCallbackType): this;
23
- /** @deprecated use Dialog Options */
24
- setSize: (size: IDialogSize) => this;
25
- /**
26
- * @deprecated
27
- * @info Dialog ordering after of before Reference Dom Element
28
- * This method is deprecated and will be removed in a future release.
29
- * Please use an alternative approach for setting dialog ordering or layout.
30
- * The dialog ordering functionality will be managed differently in future versions.
31
- */
32
- setOrder: (position: ComponentOrderPositions, component: HTMLElement) => this;
33
- /**
34
- * @deprecated
35
- * @link initialValues */
36
- initialState(state: {
37
- [k: string]: any;
38
- }): this;
31
+ processingListener(listener: (inProcess: boolean) => void): this;
39
32
  initialValues(values: DialogValues): this;
40
33
  initialHolder(holder: TInitialHolder): this;
41
- getDom: () => HTMLDivElement;
42
- onClose(callback: TDialogCallbackVoidFn): this;
43
- keyboardListener(listener: (key: string, dialog: IDialogDef) => void): this;
44
- resizeListener(listener: (size: IDialogSize, dialog: IDialogDef) => void): this;
45
- show: (callback?: TDialogCallbackVoidFn) => void;
34
+ keyboardListener(listener: (key: string, dialog: IDialogApiDef) => void): this;
35
+ resizeListener(listener: (size: IDialogSize, dialog: IDialogApiDef) => void): this;
36
+ private highestZ;
37
+ private createDom;
38
+ show(callback?: TDialogCallbackVoidFn): void;
46
39
  }
47
40
  export default Dialog;
package/models/Dialog.js CHANGED
@@ -1,128 +1,122 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
8
37
  };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
15
44
  };
16
45
  })();
17
46
  var __importDefault = (this && this.__importDefault) || function (mod) {
18
47
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
48
  };
20
49
  Object.defineProperty(exports, "__esModule", { value: true });
50
+ var React = __importStar(require("react"));
21
51
  var DialogBase_1 = __importDefault(require("../components/DialogBase"));
22
- var Dialog = /** @class */ (function (_super) {
23
- __extends(Dialog, _super);
24
- // This property holds a callback function that listens to state changes within the dialog. It is used to track or respond to changes in dialog state.
25
- // private _stateListener: TDialogStateListenerCallbackType;
26
- // This property stores the initial state of the dialog, which could include default settings or values before any interactions.
27
- // private _initialState: TBaseDialogState;
28
- // private _initialValues: TInitialValues<any>;
29
- // This property represents the initial holder of the dialog. It is used before the dialog is shown, typically to manage resources or prepare the dialog for display (like loading animations or initial data).
30
- // private _initialHolder: TInitialHolder;
31
- // This property indicates where the dialog is accessed from, such as from a button or menu item, providing context about its origin.
32
- // private _accessFrom: TAccessFrom;
33
- // This property refers to the DOM element that will represent the dialog container on the web page. It is a `div` element dynamically created when the dialog is displayed.
34
- // private _dom: HTMLDivElement;
35
- // This property holds a function to handle keyboard events. It listens for key presses and performs actions based on the key and the current state of the dialog.
36
- // private _keyboardListener: (key: string, dialog: Dialog) => void;
37
- // This is a React reference (`RefObject`) used to access the dialog instance or DOM element directly within React components. It provides a way to interact with the DOM element programmatically without triggering re-renders.
38
- // private readonly _innerRef: React.RefObject<any>;
39
- // initialValues = ( values: T ): this => {
40
- // this._initialValues = values;
41
- // return this;
42
- // }
52
+ var client_1 = require("react-dom/client");
53
+ var Dialog = /** @class */ (function () {
43
54
  function Dialog(dialogRef, options) {
44
- var _this = _super.call(this) || this;
45
- /** @deprecated use Dialog Options */
46
- _this.setSize = function (size) {
47
- _this._dialogSize = size;
48
- return _this;
49
- };
50
- /**
51
- * @deprecated
52
- * @info Dialog ordering after of before Reference Dom Element
53
- * This method is deprecated and will be removed in a future release.
54
- * Please use an alternative approach for setting dialog ordering or layout.
55
- * The dialog ordering functionality will be managed differently in future versions.
56
- */
57
- _this.setOrder = function (position, component) {
58
- _this._order = { position: position, dom: component };
59
- return _this;
55
+ var _this = this;
56
+ this._headerRef = React.createRef();
57
+ this.highestZ = function () {
58
+ var presentationElements = document.querySelectorAll('div[data-family="presentation"]');
59
+ var highest = 1201;
60
+ presentationElements.forEach(function (element) {
61
+ var z = parseInt(window.getComputedStyle(element).zIndex, 10);
62
+ if (!isNaN(z) && z > highest) {
63
+ highest = z;
64
+ }
65
+ });
66
+ return highest + 1;
60
67
  };
61
- _this.getDom = function () {
62
- return _this._dom;
63
- };
64
- _this.show = function (callback) {
65
- _super.prototype.show.call(_this, callback);
68
+ this.createDom = function () {
69
+ console.log('this._actions', _this._actions);
70
+ var dom = document.createElement('div');
71
+ dom.setAttribute('role', 'presentation');
72
+ dom.setAttribute('data-type', 'dialog');
73
+ dom.setAttribute('data-family', 'presentation');
74
+ dom.classList.add('react-guzzle-root');
75
+ dom.style.setProperty('z-index', String(_this.highestZ()));
76
+ // Find root element
77
+ var rootElement = document.getElementById('root');
78
+ // const AppElement = rootElement.firstElementChild;
79
+ if (rootElement) {
80
+ rootElement.appendChild(dom);
81
+ // AppElement.prepend(this._dom);
82
+ }
83
+ else {
84
+ document.body.appendChild(dom);
85
+ }
86
+ return dom;
66
87
  };
67
88
  if (dialogRef) {
68
- _this._innerRef = dialogRef;
89
+ this._apiRef = dialogRef;
69
90
  }
70
91
  if (options) {
71
- _this._dialogOptions = options;
92
+ this._dialogOptions = options;
72
93
  }
73
- return _this;
74
94
  }
75
- /**
76
- * @deprecated
77
- * @see dialogOptions.snackbar.anchorOrigin */
78
- Dialog.prototype.snackbarAnchor = function (anchor) {
79
- this._snackbarAnchor = anchor;
80
- return this;
81
- };
82
- Object.defineProperty(Dialog.prototype, "accessFrom", {
83
- get: function () {
84
- return this._accessFrom;
85
- },
86
- set: function (accessFrom) {
87
- this._accessFrom = accessFrom;
88
- },
89
- enumerable: false,
90
- configurable: true
91
- });
92
95
  Dialog.prototype.setHeader = function (header) {
93
- _super.prototype.setHeader.call(this, header);
96
+ this._header = header;
94
97
  return this;
95
98
  };
96
- // setBody = ( body: CallbackFn['NodeFn'] ): Dialog => {
97
99
  Dialog.prototype.setBody = function (body) {
98
- _super.prototype.setBody.call(this, body);
99
- return this;
100
- };
101
- Dialog.prototype.setFormik = function (formik) {
102
- this.formikProps = formik;
100
+ this._body = body;
103
101
  return this;
104
102
  };
105
103
  Dialog.prototype.addActions = function (actions) {
106
- _super.prototype.addActions.call(this, actions); // overrided
104
+ this._actions = actions;
107
105
  return this;
108
106
  };
109
107
  Dialog.prototype.addAction = function (action) {
110
- _super.prototype.addAction.call(this, action);
108
+ this._actions.push(action);
111
109
  return this;
112
110
  };
113
111
  /**
114
112
  * Only from init */
115
113
  Dialog.prototype.stateListener = function (listener) {
116
- _super.prototype.stateListener.call(this, listener);
114
+ this._stateListener = listener;
117
115
  return this;
118
116
  };
119
- /**
120
- * @deprecated
121
- * @link initialValues */
122
- // initialState = ( state: TBaseDialogState ): this => {
123
- Dialog.prototype.initialState = function (state) {
124
- console.warn('Dialog Warning', 'initialState not more supported, replace this with initialValues');
125
- this._initialState = state;
117
+ Dialog.prototype.processingListener = function (listener) {
118
+ // @ts-ignore
119
+ this._processingListener = listener;
126
120
  return this;
127
121
  };
128
122
  Dialog.prototype.initialValues = function (values) {
@@ -130,21 +124,36 @@ var Dialog = /** @class */ (function (_super) {
130
124
  return this;
131
125
  };
132
126
  Dialog.prototype.initialHolder = function (holder) {
133
- _super.prototype.initialHolder.call(this, holder);
134
- return this;
135
- };
136
- Dialog.prototype.onClose = function (callback) {
137
- _super.prototype.onClose.call(this, callback);
127
+ this._initialHolder = holder;
138
128
  return this;
139
129
  };
140
130
  Dialog.prototype.keyboardListener = function (listener) {
141
- _super.prototype.keyboardListener.call(this, listener); // overrided and return current dialog instance directly
131
+ this._keyboardListener = listener;
142
132
  return this;
143
133
  };
144
134
  Dialog.prototype.resizeListener = function (listener) {
145
- _super.prototype.resizeListener.call(this, listener);
135
+ this._resizeListener = listener;
146
136
  return this;
147
137
  };
138
+ Dialog.prototype.show = function (callback) {
139
+ var dom = this.createDom();
140
+ var root = (0, client_1.createRoot)(dom);
141
+ var props = __assign({
142
+ // Initials
143
+ initialOptions: this._dialogOptions, initialValues: this._initialValues, didMountCallback: callback,
144
+ // Component contents
145
+ header: this._header, body: this._body, actions: this._actions,
146
+ // Refs
147
+ headerRef: this._headerRef,
148
+ // Listeners
149
+ stateListener: this._stateListener, keyboardListener: this._keyboardListener, resizeListener: this._resizeListener,
150
+ // Others
151
+ dialogSize: this._dialogSize, initialHolder: this._initialHolder, snackbarAnchor: this._snackbarAnchor, root: root, dom: dom, parent: this }, this._apiRef ? { ref: this._apiRef } : null);
152
+ // @ts-ignore
153
+ root.render(React.createElement(DialogBase_1.default, props));
154
+ };
148
155
  return Dialog;
149
- }(DialogBase_1.default));
156
+ }());
150
157
  exports.default = Dialog;
158
+ // const dialog = new Dialog();
159
+ // dialog.
@@ -1,4 +1,4 @@
1
- import { TDialogStateListenerForActionCallbackType, DialogActionOptionsType, TBVariant, TBColor, ActionProps, DialogActionType } from "../types/DialogActionTypes";
1
+ import { TDialogStateListenerForActionCallbackType, DialogActionOptionsType, DialogActionType } from "../types/DialogActionTypes";
2
2
  import DialogActionBase from "../components/DialogActionBase";
3
3
  declare const ActionProgress: () => import("react/jsx-runtime").JSX.Element;
4
4
  export { ActionProgress };
@@ -7,47 +7,9 @@ declare class DialogAction extends DialogActionBase {
7
7
  setOptions: (options: DialogActionOptionsType) => this;
8
8
  get options(): DialogActionOptionsType;
9
9
  get name(): string;
10
- /**
11
- * @deprecated
12
- * @see DialogActionOptionsType
13
- * @info Define this prop inside new DialogAction('varName', {>here<})*/
14
- setLabel: (label: string) => DialogAction;
15
- getLabel: () => string;
16
10
  onClick: (callback: DialogActionType) => this;
17
- /**
18
- * @deprecated
19
- * @see onClickHandler */
20
- getAction(): DialogActionType;
21
- /**
22
- * @deprecated
23
- * @see DialogActionOptionsType
24
- * @info Define this prop inside new DialogAction('varName', {>here<})*/
25
- setVariant: (variant: TBVariant) => this;
26
- getVariant: () => TBVariant;
27
- /**
28
- * @deprecated
29
- * @see DialogActionOptionsType
30
- * @info Define this prop inside new DialogAction('varName', {>here<})*/
31
- setColor: (color: TBColor) => this;
32
- getColor: () => TBColor;
33
11
  /**
34
12
  * Only from init */
35
13
  stateListener: (listener: TDialogStateListenerForActionCallbackType) => this;
36
- set baseDialogAction(baseDialogAction: DialogActionBase);
37
- setInProcess: (inProcess: ActionProps["inProcess"]) => this;
38
- /**
39
- * @deprecated
40
- * @see isInProcess*/
41
- getInProcess: () => boolean;
42
- isInProcess: () => boolean;
43
- /**
44
- * @deprecated
45
- * @see DialogActionOptionsType
46
- * @info Define this prop inside new DialogAction('varName', {>here<})*/
47
- setDisabled: (disabled: boolean) => this;
48
- getDisabled: () => boolean;
49
- isDisabled: () => boolean;
50
- remove: () => void;
51
- click: () => void;
52
14
  }
53
15
  export { DialogAction };