react-dialogger 1.1.48 → 1.1.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/components/Actions.d.ts +7 -0
- package/components/Actions.js +17 -0
- package/components/DialogActionBase.d.ts +10 -0
- package/components/DialogActionBase.js +13 -11
- package/components/DialogBase.d.ts +42 -109
- package/components/DialogBase.js +104 -762
- package/components/DialogContent.d.ts +1 -19
- package/components/DialogContent.js +66 -72
- package/components/DialogContentBody.d.ts +3 -5
- package/components/DialogContentBody.js +2 -23
- package/components/DialogContentFooter.d.ts +4 -0
- package/components/{DialogContenFooter.js → DialogContentFooter.js} +6 -33
- package/components/DialogContentHeader.d.ts +6 -6
- package/components/DialogContentHeader.js +74 -32
- package/components/DialogWithBackdropWrapper.d.ts +4 -0
- package/components/DialogWithBackdropWrapper.js +72 -0
- package/components/Features/DialogCloseAction.js +18 -0
- package/components/Features/DialogFullscreenAction.js +24 -0
- package/components/{Futures → Features}/DialogInfoAction.js +8 -11
- package/components/Features/DialogProcessing.js +14 -0
- package/components/RippleButton.d.ts +2 -2
- package/components/RippleButton.js +1 -3
- package/components/index.d.ts +9 -0
- package/components/index.js +24 -0
- package/components/utils/effects/jumper-animate.d.ts +2 -0
- package/components/utils/effects/jumper-animate.js +36 -0
- package/context/index.d.ts +3 -0
- package/context/index.js +54 -0
- package/{models → helpers}/Resizeable.d.ts +2 -2
- package/{models → helpers}/Resizeable.js +23 -11
- package/helpers/dialogBoundsMemoize.d.ts +5 -5
- package/helpers/dialogBoundsMemoize.js +82 -77
- package/helpers/dialogRectAuto.d.ts +3 -0
- package/helpers/dialogRectAuto.js +21 -0
- package/helpers/formInputKeyListeners.d.ts +2 -0
- package/helpers/formInputKeyListeners.js +18 -0
- package/helpers/hexToRgb.d.ts +2 -0
- package/helpers/hexToRgb.js +19 -0
- package/helpers/index.d.ts +1 -0
- package/helpers/index.js +3 -1
- package/helpers/initDialogMemoizeBounds.d.ts +7 -2
- package/helpers/initDialogMemoizeBounds.js +19 -14
- package/index.d.ts +3 -4
- package/index.js +12 -15
- package/models/Dialog.d.ts +30 -35
- package/models/Dialog.js +112 -99
- package/models/DialogAction.d.ts +1 -39
- package/models/DialogAction.js +2 -171
- package/models/baseDialogOptions.d.ts +5 -0
- package/models/baseDialogOptions.js +63 -0
- package/models/index.d.ts +3 -0
- package/models/index.js +13 -0
- package/package.json +1 -1
- package/styles/dialog.css +1 -2
- package/{helpers → types}/BoundTypes.d.ts +4 -1
- package/types/DialogActionTypes.d.ts +14 -6
- package/types/DialogTypes.d.ts +81 -31
- package/types/SizePosTypes.d.ts +3 -2
- package/types/index.d.ts +1 -1
- package/types/types.d.ts +1 -0
- package/components/DialogContenFooter.d.ts +0 -13
- package/components/Futures/DialogCloseAction.js +0 -30
- package/components/Futures/DialogFullscreenAction.js +0 -37
- package/components/Futures/DialogProcessing.js +0 -18
- package/hooks/useDialogOptions.d.ts +0 -3
- package/hooks/useDialogOptions.js +0 -82
- /package/components/{Futures → Features}/DialogCloseAction.d.ts +0 -0
- /package/components/{Futures → Features}/DialogFullscreenAction.d.ts +0 -0
- /package/components/{Futures → Features}/DialogHeaderActionsWrapper.d.ts +0 -0
- /package/components/{Futures → Features}/DialogHeaderActionsWrapper.js +0 -0
- /package/components/{Futures → Features}/DialogInfoAction.d.ts +0 -0
- /package/components/{Futures → Features}/DialogProcessing.d.ts +0 -0
- /package/components/{Futures → Features}/index.d.ts +0 -0
- /package/components/{Futures → Features}/index.js +0 -0
- /package/{helpers → types}/BoundTypes.js +0 -0
package/components/DialogBase.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
110
|
-
|
|
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,43 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
242
138
|
};
|
|
243
139
|
_this.close = function (callbackFn) {
|
|
244
140
|
var _a;
|
|
245
|
-
if (_this.
|
|
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
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
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);
|
|
153
|
+
if (typeof _this.props.onClose === "function") {
|
|
154
|
+
_this.props.onClose(_this);
|
|
155
|
+
}
|
|
275
156
|
};
|
|
276
157
|
_this.focus = function () {
|
|
277
158
|
if (_this._dialogRef.current) {
|
|
278
159
|
_this._dialogRef.current.focus();
|
|
279
160
|
}
|
|
280
161
|
};
|
|
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
162
|
_this.getDom = function () {
|
|
311
163
|
return _this.props.dom;
|
|
312
164
|
};
|
|
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
165
|
_this.render = function () {
|
|
615
|
-
|
|
616
|
-
return (0, jsx_runtime_1.jsx)(
|
|
166
|
+
console.log('this._prevDialogRect', _this.state.prevDialogRect);
|
|
167
|
+
return (0, jsx_runtime_1.jsx)(_1.DialogWithBackdropWrapper, { initialValues: _this.props.initialValues, dialog: _this,
|
|
168
|
+
// Component
|
|
169
|
+
header: _this.props.header, body: _this.props.body, actions: _this.props.actions,
|
|
170
|
+
// Refs Props
|
|
171
|
+
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 });
|
|
172
|
+
};
|
|
173
|
+
_this.state = {
|
|
174
|
+
inProcess: { inProcess: false },
|
|
175
|
+
prevDialogRect: (0, dialogRectAuto_1.dialogRectAuto)()
|
|
617
176
|
};
|
|
618
|
-
|
|
619
|
-
/**@deprecated use FormikProps Values*/
|
|
620
|
-
values: props.initialValues, inProcess: { inProcess: false } });
|
|
177
|
+
console.log('Class_Type', _this instanceof DialogBase);
|
|
621
178
|
var defaultOptions = {
|
|
622
179
|
base: {
|
|
623
180
|
initialAnchor: {
|
|
@@ -635,16 +192,6 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
635
192
|
}
|
|
636
193
|
}
|
|
637
194
|
};
|
|
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
195
|
if (props.dialogSize) {
|
|
649
196
|
_this._dialogSize = props.dialogSize;
|
|
650
197
|
}
|
|
@@ -656,30 +203,22 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
656
203
|
size: _this._dialogSize
|
|
657
204
|
}
|
|
658
205
|
}, _this._dialogOptions);
|
|
659
|
-
|
|
660
|
-
_this.
|
|
661
|
-
|
|
662
|
-
_this.
|
|
663
|
-
_this.
|
|
664
|
-
_this.
|
|
665
|
-
_this.
|
|
206
|
+
_this._dialogOptions = (0, lodash_1.merge)({}, defaultOptions, window["dialogOptions"], props.initialOptions);
|
|
207
|
+
_this._header = props.header;
|
|
208
|
+
_this._body = props.body;
|
|
209
|
+
_this._actions = props.actions;
|
|
210
|
+
_this._backdropRef = React.createRef();
|
|
211
|
+
_this._dialogRef = React.createRef();
|
|
212
|
+
_this._dialogBodyRef = React.createRef();
|
|
213
|
+
_this._inProcess = { inProcess: false };
|
|
214
|
+
_this._snackbarRef = React.createRef();
|
|
666
215
|
_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
216
|
// Initialize _actionRefs as an empty object
|
|
674
217
|
_this._actionRefs = {};
|
|
675
|
-
// Initialize Slots
|
|
676
|
-
// this._slots = this._dialogOptions.base.slots
|
|
677
218
|
_this._initialValues = props.initialValues;
|
|
678
|
-
_this.
|
|
679
|
-
|
|
680
|
-
|
|
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;
|
|
219
|
+
_this._dialogWithBackDropRef = (0, react_1.createRef)();
|
|
220
|
+
_this._parent = props.parent;
|
|
221
|
+
console.log('this._dialogOptions', _this._dialogOptions);
|
|
683
222
|
return _this;
|
|
684
223
|
}
|
|
685
224
|
Object.defineProperty(DialogBase.prototype, "parent", {
|
|
@@ -689,38 +228,38 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
689
228
|
enumerable: false,
|
|
690
229
|
configurable: true
|
|
691
230
|
});
|
|
692
|
-
Object.defineProperty(DialogBase.prototype, "
|
|
231
|
+
Object.defineProperty(DialogBase.prototype, "dialogTranslate", {
|
|
693
232
|
get: function () {
|
|
694
|
-
return this.
|
|
233
|
+
return this._dialogTranslate;
|
|
695
234
|
},
|
|
696
235
|
enumerable: false,
|
|
697
236
|
configurable: true
|
|
698
237
|
});
|
|
699
|
-
Object.defineProperty(DialogBase.prototype, "
|
|
238
|
+
Object.defineProperty(DialogBase.prototype, "accessFrom", {
|
|
700
239
|
get: function () {
|
|
701
|
-
return this.
|
|
240
|
+
return this._accessFrom;
|
|
241
|
+
},
|
|
242
|
+
set: function (accessFrom) {
|
|
243
|
+
this._accessFrom = accessFrom;
|
|
702
244
|
},
|
|
703
245
|
enumerable: false,
|
|
704
246
|
configurable: true
|
|
705
247
|
});
|
|
706
|
-
Object.defineProperty(DialogBase.prototype, "
|
|
248
|
+
Object.defineProperty(DialogBase.prototype, "dialogOptions", {
|
|
707
249
|
get: function () {
|
|
708
|
-
return this.
|
|
250
|
+
return this._dialogOptions;
|
|
709
251
|
},
|
|
710
252
|
enumerable: false,
|
|
711
253
|
configurable: true
|
|
712
254
|
});
|
|
713
|
-
Object.defineProperty(DialogBase.prototype, "
|
|
255
|
+
Object.defineProperty(DialogBase.prototype, "holder", {
|
|
714
256
|
get: function () {
|
|
715
|
-
return this.
|
|
257
|
+
return this._holder;
|
|
716
258
|
},
|
|
717
259
|
enumerable: false,
|
|
718
260
|
configurable: true
|
|
719
261
|
});
|
|
720
262
|
Object.defineProperty(DialogBase.prototype, "formikProps", {
|
|
721
|
-
// get state(): T | Readonly<BaseDialogState> {
|
|
722
|
-
// return super.state
|
|
723
|
-
// }
|
|
724
263
|
get: function () {
|
|
725
264
|
return this._formikProps;
|
|
726
265
|
},
|
|
@@ -751,250 +290,101 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
751
290
|
enumerable: false,
|
|
752
291
|
configurable: true
|
|
753
292
|
});
|
|
293
|
+
Object.defineProperty(DialogBase.prototype, "inlineFormikProps", {
|
|
294
|
+
// ✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨
|
|
295
|
+
// ༄ inlineFormikProps 👉 Will Be initialized from Body or Content Component
|
|
296
|
+
// Instead of Dialog stateValues use FormikEngine
|
|
297
|
+
set: function (inlineFormikProps) {
|
|
298
|
+
this._inlineFormikProps = inlineFormikProps;
|
|
299
|
+
},
|
|
300
|
+
enumerable: false,
|
|
301
|
+
configurable: true
|
|
302
|
+
});
|
|
754
303
|
Object.defineProperty(DialogBase.prototype, "values", {
|
|
755
|
-
//
|
|
756
|
-
//
|
|
757
|
-
// get values(): DialogValues {
|
|
304
|
+
// ✨✨✨✨✨✨✨✨✨✨✨
|
|
758
305
|
get: function () {
|
|
759
|
-
return this.
|
|
760
|
-
//
|
|
306
|
+
return this._inlineFormikProps.values;
|
|
307
|
+
// UseImperative
|
|
308
|
+
// return this._dialogWithBackDropRef?.current?.formikProps.values;
|
|
761
309
|
},
|
|
762
310
|
enumerable: false,
|
|
763
311
|
configurable: true
|
|
764
312
|
});
|
|
765
|
-
//
|
|
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
|
-
};
|
|
313
|
+
// ✨✨✨✨✨✨✨✨✨✨✨
|
|
776
314
|
DialogBase.prototype.setValue = function (key, value) {
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
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);
|
|
315
|
+
var _a;
|
|
316
|
+
(_a = this._inlineFormikProps) === null || _a === void 0 ? void 0 : _a.setFieldValue(key, value);
|
|
317
|
+
// UseImperative
|
|
318
|
+
// this._dialogWithBackDropRef?.current?.formikProps?.setFieldValue(key, value);
|
|
794
319
|
};
|
|
320
|
+
// ✨✨✨✨✨✨✨✨✨✨✨
|
|
321
|
+
DialogBase.prototype.setValues = function (values, callbackFn) {
|
|
322
|
+
this._inlineFormikProps.setValues(values);
|
|
323
|
+
// UseImperative
|
|
324
|
+
// this._dialogWithBackDropRef?.current?.formikProps?.setValues(values);
|
|
325
|
+
if (typeof callbackFn === "function") {
|
|
326
|
+
callbackFn();
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
// ✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨
|
|
795
330
|
DialogBase.prototype.componentDidMount = function () {
|
|
796
|
-
var
|
|
797
|
-
var _a, _b, _c, _d;
|
|
331
|
+
var _a, _b, _c, _d, _e;
|
|
798
332
|
console.log('clalisan componentDidMount');
|
|
799
333
|
// İlk konumları global seçeneklerden al
|
|
800
|
-
var
|
|
334
|
+
var _f = this._dialogOptions.snackbar.anchorOrigin, vertical = _f.vertical, horizontal = _f.horizontal;
|
|
801
335
|
var initialAnchor = { vertical: vertical, horizontal: horizontal };
|
|
802
336
|
// Kullanıcı tanımlı konumlar varsa, onları ilk konumlarla birleştir
|
|
803
337
|
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
|
-
|
|
805
|
-
|
|
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) {
|
|
338
|
+
if (typeof ((_c = this.props) === null || _c === void 0 ? void 0 : _c.didMountCallback) === "function") {
|
|
339
|
+
this.props.didMountCallback(this);
|
|
861
340
|
}
|
|
862
341
|
// Register Dialog Bounds
|
|
863
|
-
if ((
|
|
342
|
+
if ((_d = this._dialogOptions.base) === null || _d === void 0 ? void 0 : _d.memoBounds) {
|
|
864
343
|
if (!helpers_1.InitDialogMemoizeBoundsDeclared) {
|
|
865
344
|
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
345
|
'InitDialogMemoizeBounds()\n' +
|
|
867
346
|
'const App() => {...');
|
|
868
347
|
}
|
|
869
|
-
var
|
|
870
|
-
(0, helpers_1.dialogRegister)(this._dialogOptions.base, {
|
|
348
|
+
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;
|
|
349
|
+
(0, helpers_1.dialogRegister)(this._dialogOptions.base.id, {
|
|
871
350
|
width: width,
|
|
872
351
|
height: height,
|
|
873
352
|
x: x,
|
|
874
|
-
y: y
|
|
353
|
+
y: y,
|
|
354
|
+
fullscreen: false
|
|
875
355
|
});
|
|
876
356
|
}
|
|
357
|
+
// Parent objesinin accessFrom özelliğini ayarla
|
|
358
|
+
this.accessFrom = "internal";
|
|
877
359
|
};
|
|
878
|
-
DialogBase.prototype.
|
|
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) {
|
|
360
|
+
DialogBase.prototype.kill = function (callbackFn) {
|
|
893
361
|
var _this = this;
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
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);
|
|
362
|
+
// ReactDOM.unmountComponentAtNode(this.props.dom);
|
|
363
|
+
var _backdrop = this._backdropRef.current;
|
|
364
|
+
var _dialog = this._dialogRef.current;
|
|
365
|
+
_backdrop === null || _backdrop === void 0 ? void 0 : _backdrop.classList.remove('dialog-backdrop-show');
|
|
366
|
+
_backdrop === null || _backdrop === void 0 ? void 0 : _backdrop.classList.add('dialog-backdrop-hide');
|
|
367
|
+
_dialog === null || _dialog === void 0 ? void 0 : _dialog.classList.remove('show-position-' + this._dialogOptions.base.initialAnchor.vertical);
|
|
368
|
+
_dialog === null || _dialog === void 0 ? void 0 : _dialog.classList.add('hide-position-' + this._dialogOptions.base.initialAnchor.vertical);
|
|
369
|
+
setTimeout(function () {
|
|
370
|
+
_this.props.root.unmount();
|
|
371
|
+
_this.props.dom.remove();
|
|
372
|
+
// unmountComponentAtNode(this.props.dom);
|
|
373
|
+
// @deprecated
|
|
374
|
+
if (typeof _this._onClose === "function") {
|
|
375
|
+
_this._onClose(_this);
|
|
376
|
+
}
|
|
377
|
+
if (typeof callbackFn === "function") {
|
|
378
|
+
callbackFn();
|
|
928
379
|
}
|
|
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;
|
|
380
|
+
}, this._shInterval);
|
|
983
381
|
};
|
|
984
382
|
Object.defineProperty(DialogBase.prototype, "actions", {
|
|
985
383
|
get: function () {
|
|
986
384
|
var _this = this;
|
|
987
385
|
var __actions = {};
|
|
988
386
|
this._actions.forEach(function (action, index) {
|
|
989
|
-
// if (!this.slotActionsRef[index]) {
|
|
990
|
-
// this.slotActionsRef[index] = createRef();
|
|
991
|
-
// }
|
|
992
387
|
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
388
|
__actions[action.name] = (_b = (_a = _this._actionRefs[action.name]) === null || _a === void 0 ? void 0 : _a.current) !== null && _b !== void 0 ? _b : action;
|
|
999
389
|
});
|
|
1000
390
|
return __actions;
|
|
@@ -1038,54 +428,6 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
1038
428
|
enumerable: false,
|
|
1039
429
|
configurable: true
|
|
1040
430
|
});
|
|
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
431
|
return DialogBase;
|
|
1090
432
|
}(react_1.Component));
|
|
1091
433
|
exports.default = DialogBase;
|