react-dialogger 1.1.47 → 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 +103 -767
  8. package/components/DialogContent.d.ts +1 -18
  9. package/components/DialogContent.js +69 -62
  10. package/components/DialogContentBody.d.ts +3 -2
  11. package/components/DialogContentBody.js +36 -5
  12. package/components/DialogContentFooter.d.ts +4 -0
  13. package/components/{DialogContenFooter.js → DialogContentFooter.js} +6 -33
  14. package/components/DialogContentHeader.d.ts +6 -2
  15. package/components/DialogContentHeader.js +73 -19
  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 +82 -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
@@ -58,63 +58,26 @@ var __importStar = (this && this.__importStar) || (function () {
58
58
  return result;
59
59
  };
60
60
  })();
61
- var __importDefault = (this && this.__importDefault) || function (mod) {
62
- return (mod && mod.__esModule) ? mod : { "default": mod };
63
- };
64
61
  Object.defineProperty(exports, "__esModule", { value: true });
65
- exports.DialogHeaderFooterContext = exports.WithHeaderFooterContext = void 0;
66
62
  var jsx_runtime_1 = require("react/jsx-runtime");
67
63
  var react_1 = require("react");
68
- // import {JSX} from "react";
69
- // import {FormikProps} from "../types/FormikProps";
70
- var formik_1 = require("formik");
71
64
  var React = __importStar(require("react"));
72
- var react_draggable_1 = __importDefault(require("react-draggable"));
73
- var notistack_1 = require("notistack");
74
- var lodash_isequal_1 = __importDefault(require("lodash.isequal"));
75
65
  var lodash_1 = require("lodash");
76
- var DialogActionBase_1 = __importDefault(require("./DialogActionBase"));
77
- var client_1 = require("react-dom/client");
78
- var Resizeable_1 = __importDefault(require("../models/Resizeable"));
79
- var ResizeIcon_1 = __importDefault(require("./icons/ResizeIcon"));
80
- var Futures_1 = require("./Futures");
66
+ var _1 = require("./");
81
67
  // Bounds methods
82
68
  var helpers_1 = require("../helpers");
83
- var DialogContent_1 = require("./DialogContent");
84
- var WithSnackbar = function (props) {
85
- return (0, jsx_runtime_1.jsx)(notistack_1.SnackbarProvider, { ref: props.snackbarRef, maxSnack: props.maxSnack, children: props.children });
86
- };
87
- var WithHeaderFooterContext = function (props) {
88
- return (0, jsx_runtime_1.jsx)(exports.DialogHeaderFooterContext.Provider, { value: __assign({}, props), children: props.children });
89
- };
90
- exports.WithHeaderFooterContext = WithHeaderFooterContext;
91
- var hexToRgb = function (hex, opacity) {
92
- try {
93
- var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
94
- var colors = {
95
- r: parseInt(result[1], 16),
96
- g: parseInt(result[2], 16),
97
- b: parseInt(result[3], 16)
98
- };
99
- return "rgba(".concat(colors.r, ", ").concat(colors.g, ", ").concat(colors.b, ", ").concat(opacity, ")");
100
- }
101
- catch (e) {
102
- console.warn('Color should be hex string', e.message);
103
- }
104
- return '';
105
- };
106
- exports.DialogHeaderFooterContext = React.createContext(null);
107
- // export const DialogContext = React.createContext(null);
69
+ var dialogRectAuto_1 = require("../helpers/dialogRectAuto");
108
70
  var DialogBase = /** @class */ (function (_super) {
109
71
  __extends(DialogBase, _super);
110
72
  function DialogBase(props) {
111
73
  if (props === void 0) { props = {}; }
112
- var _a, _b;
113
- var _this = _super.call(this, props) || this; // This ensures that props is treated as readonly
74
+ var _this = _super.call(this, props) || this;
75
+ // ✨✨✨✨✨✨✨✨✨✨✨
114
76
  _this._dialogTranslate = { lastX: 0, lastY: 0 };
115
77
  _this._shInterval = 300;
116
78
  _this._inProcess = { inProcess: false };
117
79
  _this._footerRef = React.createRef();
80
+ _this._headerRef = React.createRef();
118
81
  // Initialize a ref for each action dynamically
119
82
  _this.initializeActionRef = function (key) {
120
83
  if (!_this._actionRefs.hasOwnProperty(key)) {
@@ -123,78 +86,9 @@ var DialogBase = /** @class */ (function (_super) {
123
86
  // Replace with referenced
124
87
  return _this._actionRefs[key];
125
88
  };
126
- /**@deprecate
127
- * @see this.state
128
- * */
129
- _this.getState = function () {
130
- return _this.state;
131
- };
132
- _this.dialogAutoPos = function () {
133
- var nodes = Array.from(document.querySelectorAll('.appinsource-dialog-root'));
134
- if (nodes.length > 1) {
135
- var lastDialog = nodes[nodes.length - 2];
136
- var dialogMain = lastDialog.querySelector('#dialog-main');
137
- return {
138
- top: (dialogMain === null || dialogMain === void 0 ? void 0 : dialogMain.getBoundingClientRect().top) + 10,
139
- left: (dialogMain === null || dialogMain === void 0 ? void 0 : dialogMain.getBoundingClientRect().left) + 10,
140
- isMultiple: true
141
- };
142
- }
143
- return { top: 0, left: 0, isMultiple: false };
144
- };
145
- _this.setInProcess_noRef = function (process, message, holder) {
146
- var _a, _b;
147
- _this._inProcess = __assign({ inProcess: process }, message ? { message: message } : {});
148
- // this.setState( prevState => ({
149
- // ...prevState, inProcess: { inProcess: process, ...message ? {message} : {} }
150
- // }));
151
- if (!process) {
152
- _this._holder = null;
153
- }
154
- else {
155
- if (holder) {
156
- _this._holder = holder;
157
- }
158
- }
159
- if ((_b = (_a = _this._dialogOptions.base) === null || _a === void 0 ? void 0 : _a.actions) === null || _b === void 0 ? void 0 : _b.disabledOnDialogProcessing) {
160
- if (process) {
161
- // Set current disabled of action
162
- _this._actions.forEach(function (action) {
163
- var _a;
164
- // Save the current disabled state before changing it
165
- // const currentDisabled = action.getDisabled();
166
- var currentDisabled = (_a = action.options.disabled) !== null && _a !== void 0 ? _a : action.getDisabled();
167
- console.log('this._actions', currentDisabled, process);
168
- // Set the options with prevDisabled as the current disabled state
169
- if (currentDisabled !== process) {
170
- action
171
- .setOptions(__assign(__assign({}, action.options), { prevDisabled: currentDisabled, disabled: process // Set the new disabled state based on the process
172
- }));
173
- }
174
- });
175
- }
176
- else {
177
- // Call prevDisabled state from memo
178
- _this._actions.forEach(function (action) {
179
- // Restore the previous disabled state from options
180
- action
181
- .setOptions(__assign(__assign({}, action.options), { disabled: action.options.prevDisabled // Set the new disabled state based on the process
182
- }));
183
- });
184
- }
185
- }
186
- if (!process) {
187
- _this.snackbar.close("kInProcess");
188
- }
189
- _this.forceUpdate();
190
- return _this;
191
- };
192
89
  _this.setInProcess = function (process, message, holder) {
193
90
  var _a, _b, _c;
194
91
  _this._inProcess = __assign({ inProcess: process }, message ? { message: message } : {});
195
- // this.setState( prevState => ({
196
- // ...prevState, inProcess: { inProcess: process, ...message ? {message} : {} }
197
- // }));
198
92
  if (!process) {
199
93
  _this._holder = null;
200
94
  }
@@ -234,7 +128,6 @@ var DialogBase = /** @class */ (function (_super) {
234
128
  }
235
129
  // @ts-ignore
236
130
  (_c = _this._footerRef.current) === null || _c === void 0 ? void 0 : _c.setProcessing(process);
237
- // this.forceUpdate();
238
131
  return _this;
239
132
  };
240
133
  _this.isInProcess = function () {
@@ -245,382 +138,40 @@ var DialogBase = /** @class */ (function (_super) {
245
138
  };
246
139
  _this.close = function (callbackFn) {
247
140
  var _a;
248
- if (_this.isInProcess().inProcess) {
141
+ if (_this._footerRef.current.inProcess) {
249
142
  var notify = (_a = _this._dialogOptions.base.notifyOnClosing) !== null && _a !== void 0 ? _a : "snackbar";
250
143
  if (notify === "snackbar") {
251
144
  // this.snackbar.open(this._dialogOptions.snackbar.busyMessage ? this._dialogOptions.snackbar.busyMessage : 'In Process, Please wait...', "warning", "kInProcess");
252
145
  _this.snackbar.open(_this._dialogOptions.snackbar.busyMessage ? _this._dialogOptions.snackbar.busyMessage : 'In Process, Please wait...', "warning");
253
146
  }
254
147
  else {
255
- _this.baseZoomEffect();
148
+ _this._dialogWithBackDropRef.current.baseZoomEffect();
256
149
  }
257
150
  return;
258
151
  }
259
- // ReactDOM.unmountComponentAtNode(this.props.dom);
260
- var _backdrop = _this._backdropRef.current;
261
- var _dialog = _this._dialogRef.current;
262
- _backdrop === null || _backdrop === void 0 ? void 0 : _backdrop.classList.remove('dialog-backdrop-show');
263
- _backdrop === null || _backdrop === void 0 ? void 0 : _backdrop.classList.add('dialog-backdrop-hide');
264
- _dialog === null || _dialog === void 0 ? void 0 : _dialog.classList.remove('show-position-' + _this._dialogOptions.base.initialAnchor.vertical);
265
- _dialog === null || _dialog === void 0 ? void 0 : _dialog.classList.add('hide-position-' + _this._dialogOptions.base.initialAnchor.vertical);
266
- setTimeout(function () {
267
- _this.props.root.unmount();
268
- _this.props.dom.remove();
269
- // unmountComponentAtNode(this.props.dom);
270
- // @deprecated
271
- if (typeof _this._onClose === "function") {
272
- _this._onClose(_this);
273
- }
274
- if (typeof callbackFn === "function") {
275
- callbackFn();
276
- }
277
- }, _this._shInterval);
152
+ _this.kill(callbackFn);
278
153
  };
279
154
  _this.focus = function () {
280
155
  if (_this._dialogRef.current) {
281
156
  _this._dialogRef.current.focus();
282
157
  }
283
158
  };
284
- _this.orderPositionWithReference = function () {
285
- try {
286
- if (undefined !== _this._order) {
287
- switch (_this._order.position) {
288
- case "after":
289
- _this.props.dom.before(_this._order.dom);
290
- break;
291
- case "before":
292
- _this.props.dom.after(_this._order.dom);
293
- break;
294
- default: // same
295
- }
296
- }
297
- }
298
- catch (e) {
299
- console.error('Error with orderPositionWithReference', e.message);
300
- }
301
- };
302
- /**
303
- * @deprecated
304
- * @info This method is deprecated and will be removed in a future release.
305
- * Please use an alternative approach for setting dialog ordering or layout.
306
- * The dialog ordering functionality will be managed differently in future versions.
307
- */
308
- _this.setOrder = function (position, component) {
309
- _this._order = { position: position, dom: component };
310
- _this.forceUpdate();
311
- return _this;
312
- };
313
159
  _this.getDom = function () {
314
160
  return _this.props.dom;
315
161
  };
316
- _this.getSize = function () {
317
- return _this._dialogSize;
318
- };
319
- /**
320
- * @deprecated
321
- * use outside Content component
322
- * */
323
- _this.baseZoomEffect = function () {
324
- var _a = _this._dialogTranslate, lastX = _a.lastX, lastY = _a.lastY;
325
- _this._dialogRef.current.animate([
326
- // key frames
327
- { transform: "translate(".concat(lastX, "px, ").concat(lastY, "px) scale(1)") },
328
- { transform: "translate(".concat(lastX, "px, ").concat(lastY, "px) scale(1.01)") },
329
- // { boxShadow: `0 0 20px red`},
330
- { transform: "translate(".concat(lastX, "px, ").concat(lastY, "px) scale(1)") }
331
- ], {
332
- // sync options
333
- duration: 300,
334
- iterations: 1
335
- });
336
- };
337
- // private withBackdrop = ( body: TDialogCallbackNodeFn, header: TDialogCallbackNodeFn, actions?: Array<DialogAction> ) => {
338
- _this.WithBackdrop = function (_a) {
339
- var body = _a.body, header = _a.header, actions = _a.actions;
340
- _this.orderPositionWithReference();
341
- var _b = _this._dialogOptions.backdrop, backgroundColor = _b.backgroundColor, opacity = _b.opacity;
342
- var bgCl = hexToRgb(backgroundColor, opacity);
343
- return (0, jsx_runtime_1.jsx)("div", { className: "dialog-backdrop dialog-backdrop-show", ref: _this._backdropRef, style: {
344
- justifyContent: _this._dialogOptions.base.initialAnchor.horizontal,
345
- // alignItems: dialogOptions.base.initialAnchor.vertical,
346
- background: bgCl
347
- }, onClick: function (e) {
348
- if (_this.state.fullscreenMode)
349
- return;
350
- if (_this._dialogOptions.backdrop.hideOnClick) {
351
- _this.close();
352
- return;
353
- }
354
- _this.baseZoomEffect();
355
- }, children: (0, jsx_runtime_1.jsx)(DialogContent_1.DialogContent, { body: body, header: header, actions: actions, dialogRef: _this._dialogRef, footerRef: _this._footerRef, backdropRef: _this._backdropRef, dialogOptions: _this.dialogOptions, dom: _this._dom, keyboardListener: _this._keyboardListener, dialog: _this, initialValues: _this._initialValues, formikProps: _this._formikProps }) });
356
- };
357
- _this.switchFullScreen = function () {
358
- if (!_this.state.fullscreenMode) {
359
- _this._dialogRef.current.classList.add('fullscreen');
360
- }
361
- else {
362
- // alert(2);
363
- _this._dialogRef.current.classList.remove('fullscreen');
364
- }
365
- _this._dialogRef.current.classList.add('no-user-select');
366
- setTimeout(function () {
367
- _this._dialogRef.current.classList.remove('no-user-select');
368
- }, 500);
369
- _this.setState(function (prevState) { return (__assign(__assign({}, prevState), { fullscreenMode: !_this.state.fullscreenMode })); });
370
- };
371
- _this.Placeholder = function (placeholder) {
372
- var bgColor = _this._dialogOptions.base.style.backgroundColor ?
373
- _this._dialogOptions.base.style.backgroundColor : "#FFFFFF";
374
- var bg = _this._dialogOptions.base.style.background ?
375
- _this._dialogOptions.base.style.background : "#FFFFFF";
376
- return (0, jsx_runtime_1.jsx)("div", { className: 'dialog-content-placeholder', style: {
377
- backgroundColor: bgColor,
378
- background: bg,
379
- display: placeholder ? 'flex' : 'none',
380
- }, children: placeholder });
381
- };
382
- _this.Header = function (header) {
383
- var _a, _b, _c, _d, _e, _f, _g;
384
- var CustomHeader = (_a = _this._dialogOptions.slot) === null || _a === void 0 ? void 0 : _a.header;
385
- var staticProps = {
386
- dialogValues: _this.state.values,
387
- dialogOptions: _this._dialogOptions,
388
- // apiRef: { current: this as IDialogRef } as RefObject<IDialogRef|IDialogCloseRef>
389
- // apiRef: { current: this as IDialogRef }
390
- dialog: _this
391
- };
392
- var headerProps = {};
393
- if (_this._dialogOptions.slotProps.header) {
394
- headerProps = _this._dialogOptions.slotProps.header(staticProps);
395
- }
396
- if (_this._dialogOptions.slot.header) {
397
- return (0, jsx_runtime_1.jsx)("div", { onDoubleClick: function (event) {
398
- if (_this._fullscreen) {
399
- _this.switchFullScreen();
400
- }
401
- }, style: (_c = (_b = _this._dialogOptions.base) === null || _b === void 0 ? void 0 : _b.header) === null || _c === void 0 ? void 0 : _c.style, className: "dialog-header ".concat(_this._draggable && !_this.state.fullscreenMode ? 'drag-handle' : ''), children: (0, jsx_runtime_1.jsx)(exports.WithHeaderFooterContext, __assign({}, staticProps, { children: (0, jsx_runtime_1.jsx)(CustomHeader, __assign({}, staticProps, headerProps, { dialog: _this })) })) });
402
- }
403
- if (header instanceof Function) {
404
- return (0, jsx_runtime_1.jsxs)("div", { onDoubleClick: function (event) {
405
- if (_this._fullscreen) {
406
- _this.switchFullScreen();
407
- }
408
- }, style: (_e = (_d = _this._dialogOptions.base) === null || _d === void 0 ? void 0 : _d.header) === null || _e === void 0 ? void 0 : _e.style, className: "dialog-header ".concat(_this._draggable && !_this.state.fullscreenMode ? 'drag-handle' : ''), children: [header(_this), (_this._closeable || _this._fullscreen) &&
409
- (0, jsx_runtime_1.jsx)(exports.WithHeaderFooterContext, { dialog: _this, children: (0, jsx_runtime_1.jsxs)(Futures_1.DialogHeaderActionsWrapper, { children: [_this._fullscreen &&
410
- (0, jsx_runtime_1.jsx)(Futures_1.DialogFullscreenAction, {}), _this._closeable &&
411
- (0, jsx_runtime_1.jsx)(Futures_1.DialogCloseAction, {})] }) })] });
412
- }
413
- return (0, jsx_runtime_1.jsx)("div", { style: (_g = (_f = _this._dialogOptions.base) === null || _f === void 0 ? void 0 : _f.header) === null || _g === void 0 ? void 0 : _g.style, className: 'drag-handle dialog-header', children: header });
414
- };
415
- // TODO Body
416
- _this.Body = function (_a) {
417
- var body = _a.body;
418
- if (body instanceof Function) {
419
- return (0, jsx_runtime_1.jsxs)("div", { ref: _this._dialogBodyRef, className: 'dialog-body', style: { height: '100%' }, children: [_this.Placeholder(_this._holder), body(_this)] });
420
- }
421
- return (0, jsx_runtime_1.jsx)("div", { className: 'dialog-body', style: { height: '100%', padding: 10 }, children: _this._holder ?
422
- _this.Placeholder(_this._holder)
423
- :
424
- //@ts-ignore
425
- body });
426
- };
427
- // private Footer = (actions?: DialogAction[]) => {
428
- //
429
- // const CustomFooter = this._dialogOptions.slot?.footer;
430
- //
431
- //
432
- // const staticProps: BaseDialogSlotProps = {
433
- // dialogValues: this.state.values,
434
- // dialogOptions: this._dialogOptions,
435
- // // apiRef: { current: this as IDialogRef } as RefObject<IDialogRef|IDialogCloseRef>
436
- // // apiRef: { current: this as IDialogRef }
437
- // dialog: this as IDialogDef
438
- // };
439
- //
440
- // let footerProps = {};
441
- //
442
- // if( this._dialogOptions.slotProps.footer ){
443
- // footerProps = this._dialogOptions.slotProps.footer({
444
- // dialogValues: this.state.values,
445
- // dialogOptions: this._dialogOptions,
446
- // inProcess: this.isInProcess()
447
- // })
448
- // }
449
- //
450
- //
451
- // console.log('FooterSlot_props_Y', footerProps, staticProps, 'V6 ya hazirlik -2');
452
- //
453
- // return <div className={'dialog-footer'} style={this._dialogOptions.base?.footer?.style}>
454
- // <div>
455
- // <WithHeaderFooterContext {...staticProps} dialog={this}>
456
- // {
457
- // this._dialogOptions.slot.footer ?
458
- // /*<CustomFooter inProcess={this._inProcess} dialogValues={this.state.values} dialogOptions={this._dialogOptions} />*/
459
- // <CustomFooter {...staticProps} {...footerProps} />
460
- // :
461
- // <DialogProcessing />
462
- // /*<CircularProgress size={20} inProcess={this._inProcess} color={this._dialogOptions.progress.color}/>*/
463
- // }
464
- // </WithHeaderFooterContext>
465
- //
466
- //
467
- // </div>
468
- // { this.Actions(actions)}
469
- // </div>
470
- //
471
- // };
472
- // Bu islem Dialog Base state inden bagimsiz calisir
473
- _this.Footer = React.forwardRef(function (_a, ref) {
474
- var _b, _c, _d;
475
- var actions = _a.actions;
476
- var CustomFooter = (_b = _this._dialogOptions.slot) === null || _b === void 0 ? void 0 : _b.footer;
477
- // Imperative handle
478
- var _e = React.useState(false), inProcess = _e[0], setInProcess = _e[1];
479
- var setProcessing = function (inProcess) {
480
- setInProcess(inProcess);
481
- };
482
- React.useImperativeHandle(ref, function () { return ({
483
- setProcessing: setProcessing,
484
- inProcess: inProcess
485
- }); });
486
- // console.log('processingListener', this._processingListener);
487
- if (typeof _this._processingListener === "function") {
488
- _this._processingListener(inProcess);
489
- }
490
- var staticProps = {
491
- dialogValues: _this.state.values,
492
- dialogOptions: _this._dialogOptions,
493
- // apiRef: { current: this as IDialogRef } as RefObject<IDialogRef|IDialogCloseRef>
494
- // apiRef: { current: this as IDialogRef }
495
- dialog: _this
496
- };
497
- var footerProps = {};
498
- if (_this._dialogOptions.slotProps.footer) {
499
- footerProps = _this._dialogOptions.slotProps.footer({
500
- dialogValues: _this.state.values,
501
- dialogOptions: _this._dialogOptions,
502
- inProcess: _this.isInProcess()
503
- });
504
- }
505
- console.log('FooterSlot_props_Y', footerProps, staticProps, 'V6 ya hazirlik -2');
506
- return (0, jsx_runtime_1.jsxs)("div", { className: 'dialog-footer', style: (_d = (_c = _this._dialogOptions.base) === null || _c === void 0 ? void 0 : _c.footer) === null || _d === void 0 ? void 0 : _d.style, children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(exports.WithHeaderFooterContext, __assign({}, staticProps, { dialog: _this, children: _this._dialogOptions.slot.footer ?
507
- /*<CustomFooter inProcess={this._inProcess} dialogValues={this.state.values} dialogOptions={this._dialogOptions} />*/
508
- (0, jsx_runtime_1.jsx)(CustomFooter, __assign({}, staticProps, footerProps))
509
- :
510
- (0, jsx_runtime_1.jsx)(Futures_1.DialogProcessing, {}) })) }), _this.Actions(actions)] });
511
- });
512
- _this.Actions = function (actions) {
513
- return (0, jsx_runtime_1.jsx)("div", { style: { position: 'relative', display: 'flex', flexDirection: 'row', columnGap: 10, alignItems: 'center' }, children: actions.map(function (action, index) {
514
- // const ref = this.slotActionsRef[index];
515
- // const ActionSlot = this._dialogOptions?.slot?.action;
516
- // // console.log('ActionSlot',ActionSlot);
517
- // if (ActionSlot) {
518
- // return <ActionSlot
519
- // ref={ref}
520
- // key={index.toString()}
521
- // {...this._dialogOptions?.slotProps?.action}
522
- // onClick={ (event: React.MouseEvent) => {
523
- // action._onClickSlot( ref, this );
524
- // }}
525
- // label={action.options.label}
526
- // style={{...this._dialogOptions.slotProps?.action?.style, ...action.options.style }}
527
- // />
528
- //
529
- // }
530
- var referencedAction = _this.initializeActionRef(action.name);
531
- // this._actions[action.name] = referencedAction.current
532
- return (0, jsx_runtime_1.jsx)(DialogActionBase_1.default, { name: action.name, ref: referencedAction, dialogBaseComponent: _this, options: action.options, onClick: action.onClickHandler(), inProcess: action.isInProcess(),
533
- // onLoad={ dialogAction => {
534
- // action.baseDialogAction = dialogAction;
535
- // }}
536
- style: action.options.style, baseStyle: _this._dialogOptions.base.actions.baseStyle, fontFamily: _this._fontFamily, stateListener: action._stateListener }, index.toString());
537
- }) });
538
- };
539
- // TODO Content
540
- _this.Content = function (_a) {
541
- var _b;
542
- var _c, _d;
543
- var body = _a.body, header = _a.header, actions = _a.actions;
544
- _this._formikProps.current = (0, formik_1.useFormik)({
545
- enableReinitialize: true,
546
- initialValues: _this._initialValues,
547
- onSubmit: function (values, formikHelpers) {
548
- // No Necessary
549
- }
550
- });
551
- if (_this._dialogRef.current) {
552
- // Öncelikle ref'i al ve input elemanlarını bul
553
- var inputElements = _this._dialogRef.current.querySelectorAll("input");
554
- // Tüm input elemanlarını döngüye al
555
- inputElements.forEach(function (input) {
556
- console.log(input); // Her bir input elemanını burada işleyebilirsiniz
557
- // Örneğin, input değerini okuma veya ayarlama
558
- input.addEventListener('keydown', function (e) { return e.key === "Enter" && e.preventDefault(); }); // Değerini boşaltmak için örnek
559
- input.addEventListener('keyup', function (e) { return e.key === "Enter" && e.preventDefault(); }); // Değerini boşaltmak için örnek
560
- input.addEventListener('keypress', function (e) { return e.key === "Enter" && e.preventDefault(); }); // Değerini boşaltmak için örnek
561
- });
562
- }
563
- console.log('Content:', actions);
564
- var xKey = _this.dialogPosFromMultipleDialogs.isMultiple ? "left" : "marginLeft";
565
- var yKey = _this.dialogPosFromMultipleDialogs.isMultiple ? "top" : "marginTop";
566
- /**
567
- * default null
568
- * eget momoize islemi uygulanmissa read from memory
569
- * */
570
- var bounds = _this._storedBounds;
571
- // console.log('MAIN DOM', window.getComputedStyle(this.props.dom).zIndex);
572
- var domZIndex = window.getComputedStyle(_this.props.dom).zIndex;
573
- return (0, jsx_runtime_1.jsx)(react_draggable_1.default, { disabled: !_this._draggable || _this.state.fullscreenMode, axis: 'both', handle: _this._draggable ? '.drag-handle' : '', scale: 1, ref: _this._backdropRef, onDrag: function (event, data) {
574
- event.stopPropagation();
575
- _this._dialogTranslate = { lastX: data.lastX, lastY: data.lastY };
576
- }, onStop: function (event, data) {
577
- var _a;
578
- event.stopPropagation();
579
- event.preventDefault();
580
- console.log('onDragStop', 'fired');
581
- var _b = (_a = _this._dialogRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect(), width = _b.width, height = _b.height, x = _b.x, y = _b.y;
582
- (0, helpers_1.setDialogBounds)(_this._dialogOptions.base.id, {
583
- width: width,
584
- height: height,
585
- x: x,
586
- y: y
587
- }, _this._dialogRef);
588
- }, children: (0, jsx_runtime_1.jsxs)("div", { id: "dialog-main", ref: _this._dialogRef, onClick: function (e) {
589
- e.stopPropagation();
590
- }, onKeyDown: function (e) {
591
- if (typeof _this.props.keyboardListener === "function") {
592
- // @ts-ignore
593
- _this.props.keyboardListener(e.key, _this);
594
- }
595
- },
596
- // className={this._dialogSize.width === 'auto' ? 'auto' : `dialog-width-${this._dialogSize.width} dialog-main show-opacity show-position-${this._dialogOptions.base.initialAnchor.vertical}`}
597
- className: _this._dialogOptions.base.size.width === 'auto' ? 'auto' : "dialog-width-".concat(_this._dialogOptions.base.size.width, " dialog-main show-opacity show-position-").concat(_this._dialogOptions.base.initialAnchor.vertical), style: __assign(__assign(__assign(__assign(__assign({ alignSelf: _this._dialogOptions.base.initialAnchor.vertical, height: (_c = _this._dialogOptions.base.size.height) !== null && _c !== void 0 ? _c : 'auto' }, typeof _this._dialogOptions.base.size.width === "number" ? { width: _this._dialogOptions.base.size.width } : null), (_b = { outline: 'none' }, _b[yKey] = _this.dialogPosFromMultipleDialogs.top + 'px', _b[xKey] = _this.dialogPosFromMultipleDialogs.left + 'px', _b)), _this._dialogOptions.base.style), { fontFamily: _this._fontFamily }), bounds ? { position: 'absolute', top: bounds.y, left: bounds.x, width: bounds.width, height: bounds.height } : null), children: [(0, jsx_runtime_1.jsxs)(WithSnackbar, { snackbarRef: _this._snackbarRef, maxSnack: _this._dialogOptions.snackbar.maxSnack, children: [(_this._header || _this._dialogOptions.slot.header) && _this.Header(header), (0, jsx_runtime_1.jsx)(_this.Body, { body: body }), (0, jsx_runtime_1.jsx)(_this.Footer, { ref: _this._footerRef, actions: actions })] }), (_this._dialogOptions.base.resizeable) &&
598
- (0, jsx_runtime_1.jsx)(React.Fragment, { children: (0, jsx_runtime_1.jsx)("div", { className: "resizable-handle", style: {
599
- zIndex: parseInt(domZIndex) + 1
600
- }, onMouseDown: (_d = _this._Resizeable) === null || _d === void 0 ? void 0 : _d.resizeHandleMouseDown, children: (0, jsx_runtime_1.jsx)(ResizeIcon_1.default, { color: '#286e94' }) }) })] }) });
601
- };
602
- _this.highestZ = function () {
603
- var presentationElements = document.querySelectorAll('div[data-family="presentation"]');
604
- var highest = 1201;
605
- presentationElements.forEach(function (element) {
606
- var z = parseInt(window.getComputedStyle(element).zIndex, 10);
607
- if (!isNaN(z) && z > highest) {
608
- highest = z;
609
- }
610
- });
611
- return highest + 1;
612
- };
613
- // render = () => {
614
- //
615
- // return this.withBackdrop(this._body, this._header, this._actions)
616
- // }
617
162
  _this.render = function () {
618
- // return this.withBackdrop(this._body, this._header, this._actions)
619
- return (0, jsx_runtime_1.jsx)(_this.WithBackdrop, { body: _this._body, header: _this._header, actions: _this._actions });
163
+ console.log('this._prevDialogRect', _this.state.prevDialogRect);
164
+ return (0, jsx_runtime_1.jsx)(_1.DialogWithBackdropWrapper, { initialValues: _this.props.initialValues, dialog: _this,
165
+ // Component
166
+ header: _this.props.header, body: _this.props.body, actions: _this.props.actions,
167
+ // Refs Props
168
+ ref: _this._dialogWithBackDropRef, dialogRef: _this._dialogRef, headerRef: _this._headerRef, bodyRef: _this._dialogBodyRef, footerRef: _this._footerRef, backdropRef: _this._backdropRef, snackbarRef: _this._snackbarRef, prevDialogRect: _this.state.prevDialogRect });
620
169
  };
621
- _this.state = __assign(__assign({}, _this._initialState), { fullscreenMode: false, isResizing: false,
622
- /**@deprecated use FormikProps Values*/
623
- values: props.initialValues, inProcess: { inProcess: false } });
170
+ _this.state = {
171
+ inProcess: { inProcess: false },
172
+ prevDialogRect: (0, dialogRectAuto_1.dialogRectAuto)()
173
+ };
174
+ console.log('Class_Type', _this instanceof DialogBase);
624
175
  var defaultOptions = {
625
176
  base: {
626
177
  initialAnchor: {
@@ -638,16 +189,6 @@ var DialogBase = /** @class */ (function (_super) {
638
189
  }
639
190
  }
640
191
  };
641
- _this._dialogOptions = (0, lodash_1.merge)({}, defaultOptions, window["dialogOptions"], props.options);
642
- _this._fontFamily = (_a = _this._dialogOptions.base.style.fontFamily) !== null && _a !== void 0 ? _a : 'Arial';
643
- _this._header = props.header;
644
- _this._body = props.body;
645
- _this._actions = props.actions;
646
- _this._backdropRef = React.createRef();
647
- _this._dialogRef = React.createRef();
648
- _this._dialogBodyRef = React.createRef();
649
- _this._inProcess = { inProcess: false };
650
- _this._snackbarRef = React.createRef();
651
192
  if (props.dialogSize) {
652
193
  _this._dialogSize = props.dialogSize;
653
194
  }
@@ -659,31 +200,22 @@ var DialogBase = /** @class */ (function (_super) {
659
200
  size: _this._dialogSize
660
201
  }
661
202
  }, _this._dialogOptions);
662
- // this._draggable = props.draggable ? props.draggable : this._dialogOptions.base.draggable;
663
- _this._draggable = typeof _this._dialogOptions.base.draggable === "boolean" ? _this._dialogOptions.base.draggable : true;
664
- // this._resizeable = props.resizeable ? props.resizeable : this._dialogOptions.base.resizeable;
665
- _this._resizeable = typeof _this._dialogOptions.base.resizeable === "boolean" ? _this._dialogOptions.base.resizeable : false;
666
- _this._closeable = typeof _this._dialogOptions.base.closeable === "boolean" ? _this._dialogOptions.base.closeable : false;
667
- _this._fullscreen = typeof _this._dialogOptions.base.fullscreen === "boolean" ? _this._dialogOptions.base.fullscreen : false;
668
- _this._order = props.order;
203
+ _this._dialogOptions = (0, lodash_1.merge)({}, defaultOptions, window["dialogOptions"], props.initialOptions);
204
+ _this._header = props.header;
205
+ _this._body = props.body;
206
+ _this._actions = props.actions;
207
+ _this._backdropRef = React.createRef();
208
+ _this._dialogRef = React.createRef();
209
+ _this._dialogBodyRef = React.createRef();
210
+ _this._inProcess = { inProcess: false };
211
+ _this._snackbarRef = React.createRef();
669
212
  _this._holder = props.initialHolder;
670
- _this._parent = props.parent;
671
- _this._onClose = props.onClose;
672
- _this.dialogPosFromMultipleDialogs = _this.dialogAutoPos();
673
- if (_this._dialogOptions.base.resizeable) {
674
- _this._Resizeable = new Resizeable_1.default();
675
- }
676
213
  // Initialize _actionRefs as an empty object
677
214
  _this._actionRefs = {};
678
- // Initialize Slots
679
- // this._slots = this._dialogOptions.base.slots
680
215
  _this._initialValues = props.initialValues;
681
- _this._resizeListenersStore = [];
682
- // Fetch Initial Dialog Bounds
683
- var base = _this._dialogOptions.base;
684
- var memoBounds = base.memoBounds;
685
- _this._storedBounds = ((_b = _this._dialogOptions.base) === null || _b === void 0 ? void 0 : _b.memoBounds) ? (0, helpers_1.getDialogBounds)(base) : null;
686
- _this._formikProps = (0, react_1.createRef)();
216
+ _this._dialogWithBackDropRef = (0, react_1.createRef)();
217
+ _this._parent = props.parent;
218
+ console.log('this._dialogOptions', _this._dialogOptions);
687
219
  return _this;
688
220
  }
689
221
  Object.defineProperty(DialogBase.prototype, "parent", {
@@ -693,43 +225,43 @@ var DialogBase = /** @class */ (function (_super) {
693
225
  enumerable: false,
694
226
  configurable: true
695
227
  });
696
- Object.defineProperty(DialogBase.prototype, "fullscreenMode", {
228
+ Object.defineProperty(DialogBase.prototype, "dialogTranslate", {
697
229
  get: function () {
698
- return this.state.fullscreenMode;
230
+ return this._dialogTranslate;
699
231
  },
700
232
  enumerable: false,
701
233
  configurable: true
702
234
  });
703
- Object.defineProperty(DialogBase.prototype, "dialogOptions", {
235
+ Object.defineProperty(DialogBase.prototype, "accessFrom", {
704
236
  get: function () {
705
- return this._dialogOptions;
237
+ return this._accessFrom;
238
+ },
239
+ set: function (accessFrom) {
240
+ this._accessFrom = accessFrom;
706
241
  },
707
242
  enumerable: false,
708
243
  configurable: true
709
244
  });
710
- Object.defineProperty(DialogBase.prototype, "holder", {
245
+ Object.defineProperty(DialogBase.prototype, "dialogOptions", {
711
246
  get: function () {
712
- return this._holder;
247
+ return this._dialogOptions;
713
248
  },
714
249
  enumerable: false,
715
250
  configurable: true
716
251
  });
717
- Object.defineProperty(DialogBase.prototype, "Resizeable", {
252
+ Object.defineProperty(DialogBase.prototype, "holder", {
718
253
  get: function () {
719
- return this._Resizeable;
254
+ return this._holder;
720
255
  },
721
256
  enumerable: false,
722
257
  configurable: true
723
258
  });
724
259
  Object.defineProperty(DialogBase.prototype, "formikProps", {
725
- // get state(): T | Readonly<BaseDialogState> {
726
- // return super.state
727
- // }
728
260
  get: function () {
729
- return this._formikProps.current;
261
+ return this._formikProps;
730
262
  },
731
263
  set: function (value) {
732
- this._formikProps.current = value;
264
+ this._formikProps = value;
733
265
  },
734
266
  enumerable: false,
735
267
  configurable: true
@@ -755,249 +287,101 @@ var DialogBase = /** @class */ (function (_super) {
755
287
  enumerable: false,
756
288
  configurable: true
757
289
  });
290
+ Object.defineProperty(DialogBase.prototype, "inlineFormikProps", {
291
+ // ✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨
292
+ // ༄ inlineFormikProps 👉 Will Be initialized from Body or Content Component
293
+ // Instead of Dialog stateValues use FormikEngine
294
+ set: function (inlineFormikProps) {
295
+ this._inlineFormikProps = inlineFormikProps;
296
+ },
297
+ enumerable: false,
298
+ configurable: true
299
+ });
758
300
  Object.defineProperty(DialogBase.prototype, "values", {
759
- // 1248
760
- //
761
- // get values(): DialogValues {
301
+ // ✨✨✨✨✨✨✨✨✨✨✨
762
302
  get: function () {
763
- return this.state.values;
764
- // return this._formikProps?.values;
303
+ return this._inlineFormikProps.values;
304
+ // UseImperative
305
+ // return this._dialogWithBackDropRef?.current?.formikProps.values;
765
306
  },
766
307
  enumerable: false,
767
308
  configurable: true
768
309
  });
769
- // public setValues(values: DialogValues, callbackFn?: () => void): void {
770
- DialogBase.prototype.setValues = function (values, callbackFn) {
771
- var prevValues = __assign({}, this.state.values);
772
- // this.setState( prevState => ({...prevState, values: {...prevValues, ...values}}) );
773
- this.setState(function (prevState) { return (__assign(__assign({}, prevState), { values: __assign(__assign({}, prevValues), values) })); }, function () {
774
- if (typeof callbackFn === 'function') {
775
- callbackFn();
776
- }
777
- });
778
- // this._formikProps?.setValues(values);
779
- };
310
+ // ✨✨✨✨✨✨✨✨✨✨✨
780
311
  DialogBase.prototype.setValue = function (key, value) {
781
- this.setState(function (prevState) {
782
- var clonedVal = __assign({}, prevState.values);
783
- clonedVal[key] = value;
784
- return __assign(__assign({}, prevState), { values: clonedVal });
785
- });
786
- // Cok mantikli Ama butun yapida zorluk cikrariyor
787
- // Eger direct kullanilmak istenirse olusacak sorun
788
- // Eget bir state icinde birden fazla domain kullaniliyor sadece bir domain sadece formikProps baglantisi varsa
789
- // O zaman setValues dedigim de ilgili domain i guncellemek yerine buton props lar etki altina girer
790
- // Ornek
791
- // initialValues/values icinde iki domain var {order: ... project...}
792
- // inputs formikProps ile direct baglanti kurabildigi icin order i ilgilendiren bir field artik order icindeki propla ulasamaz
793
- // cunju values icinde order, project tanimlanmistir formikProps.values={order, project}
794
- // Dogru bisekilde calismasi icin formikProps.values direct oreder field leri olmali {...} <- Order fields
795
- // O sebepten values dialog state ile baglantili eget dialog icinde form kullanmak isterse m
796
- // Bu Durumu sinirlandiriyor
797
- // this._formikProps?.setFieldValue(key, value);
312
+ var _a;
313
+ (_a = this._inlineFormikProps) === null || _a === void 0 ? void 0 : _a.setFieldValue(key, value);
314
+ // UseImperative
315
+ // this._dialogWithBackDropRef?.current?.formikProps?.setFieldValue(key, value);
316
+ };
317
+ // ✨✨✨✨✨✨✨✨✨✨✨
318
+ DialogBase.prototype.setValues = function (values, callbackFn) {
319
+ this._inlineFormikProps.setValues(values);
320
+ // UseImperative
321
+ // this._dialogWithBackDropRef?.current?.formikProps?.setValues(values);
322
+ if (typeof callbackFn === "function") {
323
+ callbackFn();
324
+ }
798
325
  };
326
+ // ✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨
799
327
  DialogBase.prototype.componentDidMount = function () {
800
- var _this = this;
801
- var _a, _b, _c, _d;
328
+ var _a, _b, _c, _d, _e;
802
329
  console.log('clalisan componentDidMount');
803
330
  // İlk konumları global seçeneklerden al
804
- var _e = this._dialogOptions.snackbar.anchorOrigin, vertical = _e.vertical, horizontal = _e.horizontal;
331
+ var _f = this._dialogOptions.snackbar.anchorOrigin, vertical = _f.vertical, horizontal = _f.horizontal;
805
332
  var initialAnchor = { vertical: vertical, horizontal: horizontal };
806
333
  // Kullanıcı tanımlı konumlar varsa, onları ilk konumlarla birleştir
807
334
  this._snackbarAnchor = __assign(__assign(__assign({}, initialAnchor), (((_a = this.props.snackbarAnchor) === null || _a === void 0 ? void 0 : _a.vertical) ? { vertical: this.props.snackbarAnchor.vertical } : {})), (((_b = this.props.snackbarAnchor) === null || _b === void 0 ? void 0 : _b.horizontal) ? { horizontal: this.props.snackbarAnchor.horizontal } : {}));
808
- // didMountCallback varsa, promise ile çağır
809
- if (undefined !== this.props.didMountCallback && typeof this.props.didMountCallback === "function") {
810
- // @ts-ignore
811
- // this.props.didMountCallback( this )
812
- new Promise(function (resolve, reject) {
813
- try {
814
- setTimeout(function () {
815
- resolve(true);
816
- }, _this._shInterval);
817
- }
818
- catch (e) {
819
- // fail(e);
820
- }
821
- }).then(function (completed) {
822
- if (completed) {
823
- // @ts-ignore
824
- _this.props.didMountCallback(_this);
825
- }
826
- });
827
- }
828
- if (this._dialogRef.current) {
829
- this._dialogRef.current.tabIndex = 0; // Odaklanabilir hale getirir
830
- this._dialogRef.current.focus();
831
- if (this._Resizeable) {
832
- this._Resizeable.setContainer(this._dialogRef, this._dialogOptions);
833
- this._Resizeable.onResizeListener(function (width, height) {
834
- if (typeof _this.props.resizeListener === "function") {
835
- _this._resizeListenersStore.push(_this.props.resizeListener);
836
- }
837
- // this.props.resizeListener({width, height}, this);
838
- // Butun eklenmis Resize collbackler ayni anda maplenerek cevap veriliyor
839
- _this._resizeListenersStore.map(function (itemCallback) {
840
- // @ts-ignore
841
- itemCallback({ width: width, height: height }, _this);
842
- });
843
- });
844
- }
845
- }
846
- // Initialize SlotsProps
847
- // this._slots?.forEach( (slot: any) => {
848
- // this._slotProps[slot.name] = slot;
849
- // });
850
- // // Callback Slot Props
851
- // try{
852
- // this._dialogOptions.base?.slotProps(this._slotProps);
853
- // } catch (e){
854
- //
855
- // }
856
- // Parent objesinin accessFrom özelliğini ayarla
857
- this.props.parent.accessFrom = "internal";
858
- // Check This
859
- try {
860
- var t = window.localStorage.getItem('react-super-dialog');
861
- console.log('Parsed Bounds Store', JSON.parse(t));
862
- }
863
- catch (e) {
335
+ if (typeof ((_c = this.props) === null || _c === void 0 ? void 0 : _c.didMountCallback) === "function") {
336
+ this.props.didMountCallback(this);
864
337
  }
865
338
  // Register Dialog Bounds
866
- if ((_c = this._dialogOptions.base) === null || _c === void 0 ? void 0 : _c.memoBounds) {
339
+ if ((_d = this._dialogOptions.base) === null || _d === void 0 ? void 0 : _d.memoBounds) {
867
340
  if (!helpers_1.InitDialogMemoizeBoundsDeclared) {
868
341
  throw new Error('InitDialogMemoizeBounds is not defined. Please make sure to declare it only once, at the top‑level of your module—outside of App or its render logic.\n' +
869
342
  'InitDialogMemoizeBounds()\n' +
870
343
  'const App() => {...');
871
344
  }
872
- var _f = (_d = this._dialogRef.current) === null || _d === void 0 ? void 0 : _d.getBoundingClientRect(), width = _f.width, height = _f.height, x = _f.x, y = _f.y;
873
- (0, helpers_1.dialogRegister)(this._dialogOptions.base, {
345
+ var _g = (_e = this._dialogRef.current) === null || _e === void 0 ? void 0 : _e.getBoundingClientRect(), width = _g.width, height = _g.height, x = _g.x, y = _g.y;
346
+ (0, helpers_1.dialogRegister)(this._dialogOptions.base.id, {
874
347
  width: width,
875
348
  height: height,
876
349
  x: x,
877
- y: y
350
+ y: y,
351
+ fullscreen: false
878
352
  });
879
353
  }
354
+ // Parent objesinin accessFrom özelliğini ayarla
355
+ this.accessFrom = "internal";
880
356
  };
881
- DialogBase.prototype.onResize = function (callbackFn) {
882
- if (typeof callbackFn === "function") {
883
- // Header body veya baska biserden gelen callback i storla
884
- // Bu olay overwite olmasinin onune gecer
885
- // Cunku en sonku callback calistirildigi icin ornedin header ve
886
- this._resizeListenersStore.push(callbackFn);
887
- }
888
- };
889
- DialogBase.prototype.componentWillUnmount = function () {
890
- if (this._Resizeable) {
891
- // Temizlik fonksiyonu
892
- this._Resizeable.cleanUp();
893
- }
894
- };
895
- DialogBase.prototype.setState = function (state, callback) {
357
+ DialogBase.prototype.kill = function (callbackFn) {
896
358
  var _this = this;
897
- var prevState = this.state;
898
- _super.prototype.setState.call(this, state, function () {
899
- // if( typeof this.props.stateListener === "function" && JSON.stringify(prevState) !== JSON.stringify(state) ){
900
- var _a;
901
- // Outer State Listener
902
- if (typeof _this.props.stateListener === "function" && !(0, lodash_isequal_1.default)(prevState, state)) {
903
- _this.props.stateListener(_this.state, _this.state.values, _this);
904
- }
905
- // Inner State Listener
906
- if (typeof _this._stateListener === "function" && !(0, lodash_isequal_1.default)(prevState, state)) {
907
- _this._stateListener(_this.state, _this.state.values, _this);
908
- }
909
- for (var actionKey in _this._actionRefs) {
910
- var action = _this._actionRefs[actionKey];
911
- if (typeof action.current._stateListener === "function") {
912
- // action.getStateListener()( this.state, this.state.values, action.baseDialogAction, this );
913
- // When using ref
914
- action.current._stateListener(_this.state, _this.state.values, (_a = _this._actionRefs[action.current.name]) === null || _a === void 0 ? void 0 : _a.current, _this);
915
- // action.getStateListener()( this.state, this.state.values, action.baseDialogAction, this );
916
- }
917
- // console.log('setStateRunned', action.current._stateListener, action.current.name, this._actionRefs, this );
918
- }
919
- // this._actions.forEach( action => {
920
- // if( typeof action.getStateListener() === "function" ){
921
- // // action.getStateListener()( this.state, this.state.values, action.baseDialogAction, this );
922
- // // When using ref
923
- // action.getStateListener()( this.state, this.state.values, this._actionRefs[action.name]?.current, this );
924
- // // action.getStateListener()( this.state, this.state.values, action.baseDialogAction, this );
925
- // }
926
- // })
927
- if (callback) {
928
- setTimeout(function () {
929
- callback();
930
- }, 100);
359
+ // ReactDOM.unmountComponentAtNode(this.props.dom);
360
+ var _backdrop = this._backdropRef.current;
361
+ var _dialog = this._dialogRef.current;
362
+ _backdrop === null || _backdrop === void 0 ? void 0 : _backdrop.classList.remove('dialog-backdrop-show');
363
+ _backdrop === null || _backdrop === void 0 ? void 0 : _backdrop.classList.add('dialog-backdrop-hide');
364
+ _dialog === null || _dialog === void 0 ? void 0 : _dialog.classList.remove('show-position-' + this._dialogOptions.base.initialAnchor.vertical);
365
+ _dialog === null || _dialog === void 0 ? void 0 : _dialog.classList.add('hide-position-' + this._dialogOptions.base.initialAnchor.vertical);
366
+ setTimeout(function () {
367
+ _this.props.root.unmount();
368
+ _this.props.dom.remove();
369
+ // unmountComponentAtNode(this.props.dom);
370
+ // @deprecated
371
+ if (typeof _this._onClose === "function") {
372
+ _this._onClose(_this);
373
+ }
374
+ if (typeof callbackFn === "function") {
375
+ callbackFn();
931
376
  }
932
- });
933
- };
934
- DialogBase.prototype.setHeader = function (header) {
935
- this._header = header;
936
- this.forceUpdate();
937
- return this;
938
- };
939
- DialogBase.prototype.setBody = function (body) {
940
- this._body = body;
941
- this.forceUpdate();
942
- return this;
943
- };
944
- DialogBase.prototype.addActions = function (actions) {
945
- this._actions = actions;
946
- return this;
947
- };
948
- DialogBase.prototype.addAction = function (action) {
949
- this._actions.push(action);
950
- return this;
951
- };
952
- DialogBase.prototype.stateListener = function (listener) {
953
- this._stateListener = listener;
954
- return this;
955
- };
956
- DialogBase.prototype.keyboardListener = function (listener) {
957
- this._keyboardListener = listener;
958
- return this;
959
- };
960
- DialogBase.prototype.resizeListener = function (listener) {
961
- this._resizeListener = listener;
962
- return this;
963
- };
964
- DialogBase.prototype.processingListener = function (listener) {
965
- // @ts-ignore
966
- this._processingListener = listener;
967
- return this;
968
- };
969
- DialogBase.prototype.initialHolder = function (holder) {
970
- this._initialHolder = holder;
971
- return this;
972
- };
973
- // protected initialValues<T extends TValues>(values: T): DialogWithValues<T> {
974
- //
975
- // this.setState( prevState => {
976
- // return {
977
- // ...prevState, values
978
- // }
979
- // })
980
- // // Burada yeni tipli bir sınıfa dönüyoruz
981
- // return this as unknown as DialogWithValues<T>;
982
- // }
983
- DialogBase.prototype.onClose = function (callback) {
984
- this._onClose = callback;
985
- return this;
377
+ }, this._shInterval);
986
378
  };
987
379
  Object.defineProperty(DialogBase.prototype, "actions", {
988
380
  get: function () {
989
381
  var _this = this;
990
382
  var __actions = {};
991
383
  this._actions.forEach(function (action, index) {
992
- // if (!this.slotActionsRef[index]) {
993
- // this.slotActionsRef[index] = createRef();
994
- // }
995
384
  var _a, _b;
996
- /**
997
- * Herbir action Ref Objecsine atandi Her Ref Objeside BaseDialogActionBase ine baglandi
998
- * inital Actionlar DialogAction i reference aliyor ve buda ic method erisimlerine engel oluyor DialogActionBase in ötelliklerine ulasamiyor o yuzden
999
- * hetBir Action ic Reference ataniyor ve ic referencedeki methodlar disaridan cagirilabiliyor
1000
- * */
1001
385
  __actions[action.name] = (_b = (_a = _this._actionRefs[action.name]) === null || _a === void 0 ? void 0 : _a.current) !== null && _b !== void 0 ? _b : action;
1002
386
  });
1003
387
  return __actions;
@@ -1041,54 +425,6 @@ var DialogBase = /** @class */ (function (_super) {
1041
425
  enumerable: false,
1042
426
  configurable: true
1043
427
  });
1044
- DialogBase.prototype.show = function (callback) {
1045
- var presentationElements = document.querySelectorAll('div[data-family="presentation"]');
1046
- console.log('String(this.highestZ()', presentationElements, String(this.highestZ()));
1047
- console.log('this._actions', this._actions);
1048
- this._dom = document.createElement('div');
1049
- this._dom.setAttribute('role', 'presentation');
1050
- this._dom.setAttribute('data-type', 'dialog');
1051
- this._dom.setAttribute('data-family', 'presentation');
1052
- this._dom.classList.add('appinsource-dialog-root');
1053
- this._dom.style.setProperty('z-index', String(this.highestZ()));
1054
- // Find root element
1055
- var rootElement = document.getElementById('root');
1056
- // const AppElement = rootElement.firstElementChild;
1057
- if (rootElement) {
1058
- rootElement.appendChild(this._dom);
1059
- // AppElement.prepend(this._dom);
1060
- }
1061
- else {
1062
- document.body.appendChild(this._dom);
1063
- }
1064
- var root = (0, client_1.createRoot)(this._dom);
1065
- var props = {
1066
- ref: this._innerRef,
1067
- options: this._dialogOptions,
1068
- header: this._header,
1069
- body: this._body,
1070
- actions: this._actions,
1071
- stateListener: this._stateListener,
1072
- dialogSize: this._dialogSize,
1073
- didMountCallback: callback,
1074
- keyboardListener: this._keyboardListener,
1075
- resizeListener: this._resizeListener,
1076
- /**Dialog order with Reference Element, like before-after-same reference*/
1077
- order: this._order,
1078
- // initialState: this._initialState,
1079
- // initialValues: this._initialValues,
1080
- // initialUserProps: this._initialUserProps,
1081
- initialValues: this._initialValues,
1082
- initialHolder: this._initialHolder,
1083
- snackbarAnchor: this._snackbarAnchor,
1084
- dom: this._dom,
1085
- parent: this,
1086
- onClose: this._onClose,
1087
- root: root,
1088
- };
1089
- // @ts-ignore
1090
- root.render(React.createElement(DialogBase, props));
1091
- };
1092
428
  return DialogBase;
1093
429
  }(react_1.Component));
1094
430
  exports.default = DialogBase;