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