react-dialogger 1.1.52 → 1.1.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Actions.js +2 -1
- package/components/DialogActionBase.d.ts +7 -5
- package/components/DialogActionBase.js +30 -10
- package/components/DialogBase.d.ts +6 -2
- package/components/DialogBase.js +31 -35
- package/components/DialogContent.d.ts +1 -2
- package/components/DialogContent.js +47 -26
- package/components/DialogContentBody.d.ts +0 -3
- package/components/DialogContentBody.js +11 -2
- package/components/DialogContentFooter.js +8 -7
- package/components/DialogContentHeader.d.ts +0 -4
- package/components/DialogContentHeader.js +7 -9
- package/components/DialogWithBackdropWrapper.d.ts +1 -3
- package/components/DialogWithBackdropWrapper.js +5 -50
- package/components/Features/DialogFullscreenAction.js +1 -0
- package/components/utils/resizeManager.d.ts +5 -0
- package/components/utils/resizeManager.js +21 -0
- package/context/DialogContentContextProvider.d.ts +5 -0
- package/context/DialogContentContextProvider.js +106 -0
- package/helpers/dialogBoundsMemoize.js +1 -1
- package/models/DialogAction.d.ts +17 -1
- package/models/DialogAction.js +24 -53
- package/models/baseDialogOptions.js +19 -0
- package/package.json +1 -1
- package/styles/dialog.css +1 -1
- package/types/DialogActionTypes.d.ts +9 -4
- package/types/DialogActionTypes.js +1 -0
- package/types/DialogContentContextTypes.d.ts +22 -0
- package/types/DialogContentContextTypes.js +2 -0
- package/types/DialogTypes.d.ts +11 -4
- package/README.md +0 -320
package/components/Actions.js
CHANGED
|
@@ -10,8 +10,9 @@ var Actions = function (_a) {
|
|
|
10
10
|
var actions = _a.actions, dialog = _a.dialog;
|
|
11
11
|
var dialogOptions = dialog.dialogOptions;
|
|
12
12
|
return (0, jsx_runtime_1.jsx)("div", { style: { position: 'relative', display: 'flex', flexDirection: 'row', columnGap: 10, alignItems: 'center' }, children: actions.map(function (action, index) {
|
|
13
|
+
console.log('Actions_action', action, action.getIntent());
|
|
13
14
|
var referencedAction = dialog.initializeActionRef(action.name);
|
|
14
|
-
return (0, jsx_runtime_1.jsx)(DialogActionBase_1.default, { name: action.name, ref: referencedAction, dialogBaseComponent: dialog, options: action.options, onClick: action.onClickHandler(), inProcess: action.isInProcess(), style: action.options.style, baseStyle: dialogOptions.base.actions.baseStyle, fontFamily: dialogOptions.base.style.fontFamily, stateListener: action._stateListener }, index.toString());
|
|
15
|
+
return (0, jsx_runtime_1.jsx)(DialogActionBase_1.default, { name: action.name, ref: referencedAction, dialogBaseComponent: dialog, options: action.options, onClick: action.onClickHandler(), inProcess: action.isInProcess(), style: action.options.style, baseStyle: dialogOptions.base.actions.baseStyle, fontFamily: dialogOptions.base.style.fontFamily, stateListener: action._stateListener, intent: action.getIntent() }, index.toString());
|
|
15
16
|
}) });
|
|
16
17
|
};
|
|
17
18
|
exports.Actions = Actions;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Component } from "react";
|
|
2
2
|
import DialogBase from "./DialogBase";
|
|
3
|
-
import { ActionProps, ActionState, DialogActionType, TBVariant, TBColor, DialogActionOptionsType, TDialogStateListenerForActionCallbackType } from "../types/DialogActionTypes";
|
|
3
|
+
import { ActionProps, ActionState, DialogActionType, TBVariant, TBColor, DialogActionOptionsType, TDialogStateListenerForActionCallbackType, ActionIntent } from "../types/DialogActionTypes";
|
|
4
4
|
declare class DialogActionBase extends Component<ActionProps, ActionState> {
|
|
5
5
|
get dialogBaseComponent(): DialogBase<any>;
|
|
6
6
|
protected _options: DialogActionOptionsType;
|
|
7
|
+
protected _intent: ActionIntent;
|
|
7
8
|
_stateListener: TDialogStateListenerForActionCallbackType;
|
|
8
9
|
protected _baseDialogAction?: DialogActionBase;
|
|
9
10
|
protected _name: string;
|
|
@@ -18,20 +19,20 @@ declare class DialogActionBase extends Component<ActionProps, ActionState> {
|
|
|
18
19
|
componentDidMount(): void;
|
|
19
20
|
get baseDialogAction(): DialogActionBase;
|
|
20
21
|
getInitialClickHandler: () => DialogActionType;
|
|
21
|
-
|
|
22
|
+
updateOptions(options: DialogActionOptionsType): this;
|
|
22
23
|
get options(): DialogActionOptionsType;
|
|
23
|
-
|
|
24
|
+
updateLabel: (label: string) => DialogActionBase;
|
|
24
25
|
getLabel(): string;
|
|
25
26
|
protected onClick(callback: DialogActionType): DialogActionBase;
|
|
26
27
|
/**
|
|
27
28
|
* @deprecated use Options*/
|
|
28
|
-
|
|
29
|
+
updateVariant: (variant: TBVariant) => DialogActionBase;
|
|
29
30
|
/**
|
|
30
31
|
* @deprecated use Options*/
|
|
31
32
|
getVariant: () => TBVariant;
|
|
32
33
|
/**
|
|
33
34
|
* @deprecated use Options*/
|
|
34
|
-
|
|
35
|
+
updateColor: (color: TBColor) => DialogActionBase;
|
|
35
36
|
/**
|
|
36
37
|
* @deprecated use Options*/
|
|
37
38
|
getColor: () => TBColor;
|
|
@@ -45,6 +46,7 @@ declare class DialogActionBase extends Component<ActionProps, ActionState> {
|
|
|
45
46
|
/**
|
|
46
47
|
* @deprecated use Options*/
|
|
47
48
|
isDisabled: () => boolean;
|
|
49
|
+
updateIntent: (intent: ActionIntent) => DialogActionBase;
|
|
48
50
|
setInProcess: (inProcess: boolean) => DialogActionBase;
|
|
49
51
|
isInProcess: () => boolean;
|
|
50
52
|
remove: () => void;
|
|
@@ -75,17 +75,18 @@ var DialogActionBase = /** @class */ (function (_super) {
|
|
|
75
75
|
disabled: false,
|
|
76
76
|
prevDisabled: false
|
|
77
77
|
};
|
|
78
|
+
_this._intent = null; // {color: "primary", variant: 'contained'};
|
|
78
79
|
_this.getInitialClickHandler = function () {
|
|
79
80
|
return _this._initialClickHandler;
|
|
80
81
|
};
|
|
81
|
-
_this.
|
|
82
|
+
_this.updateLabel = function (label) {
|
|
82
83
|
_this._options.label = label;
|
|
83
84
|
_this.forceUpdate();
|
|
84
85
|
return _this;
|
|
85
86
|
};
|
|
86
87
|
/**
|
|
87
88
|
* @deprecated use Options*/
|
|
88
|
-
_this.
|
|
89
|
+
_this.updateVariant = function (variant) {
|
|
89
90
|
_this._options.variant = variant;
|
|
90
91
|
_this.forceUpdate();
|
|
91
92
|
return _this;
|
|
@@ -97,7 +98,7 @@ var DialogActionBase = /** @class */ (function (_super) {
|
|
|
97
98
|
};
|
|
98
99
|
/**
|
|
99
100
|
* @deprecated use Options*/
|
|
100
|
-
_this.
|
|
101
|
+
_this.updateColor = function (color) {
|
|
101
102
|
// this._color = color;
|
|
102
103
|
_this._options.color = color;
|
|
103
104
|
_this.forceUpdate();
|
|
@@ -126,6 +127,10 @@ var DialogActionBase = /** @class */ (function (_super) {
|
|
|
126
127
|
_this.isDisabled = function () {
|
|
127
128
|
return _this._options.disabled;
|
|
128
129
|
};
|
|
130
|
+
_this.updateIntent = function (intent) {
|
|
131
|
+
_this.setState(function (prevState) { return (__assign(__assign({}, _this.state), { intent: intent })); });
|
|
132
|
+
return _this;
|
|
133
|
+
};
|
|
129
134
|
_this.setInProcess = function (inProcess) {
|
|
130
135
|
_this._inProcess = inProcess;
|
|
131
136
|
_this._options.disabled = inProcess;
|
|
@@ -147,8 +152,16 @@ var DialogActionBase = /** @class */ (function (_super) {
|
|
|
147
152
|
return _this._onClick;
|
|
148
153
|
};
|
|
149
154
|
_this.render = function () {
|
|
150
|
-
|
|
151
|
-
|
|
155
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
156
|
+
console.log('Dialog_Action_Base_render', _this._options, _this._intent);
|
|
157
|
+
// Set as default converted from action name prop
|
|
158
|
+
var converted = (_b = (_a = _this.props.name) === null || _a === void 0 ? void 0 : _a.replace(/action/i, '')) !== null && _b !== void 0 ? _b : _this.props.name;
|
|
159
|
+
_this._options.label = (_g = ((_f = (_e = (_d = (_c = _this.props.dialogBaseComponent) === null || _c === void 0 ? void 0 : _c.dialogOptions) === null || _d === void 0 ? void 0 : _d.localText) === null || _e === void 0 ? void 0 : _e[converted]) !== null && _f !== void 0 ? _f : converted)) !== null && _g !== void 0 ? _g : 'Button';
|
|
160
|
+
return (0, jsx_runtime_1.jsx)(index_1.RippleButton, { ref: _this._buttonRef, innerRef: _this._rippleButtonRef,
|
|
161
|
+
// Intent Based
|
|
162
|
+
variant: (_k = (_j = (_h = _this.state) === null || _h === void 0 ? void 0 : _h.intent) === null || _j === void 0 ? void 0 : _j.variant) !== null && _k !== void 0 ? _k : _this._options.variant,
|
|
163
|
+
// Intent Based
|
|
164
|
+
color: (_o = (_m = (_l = _this.state) === null || _l === void 0 ? void 0 : _l.intent) === null || _m === void 0 ? void 0 : _m.color) !== null && _o !== void 0 ? _o : _this._options.color, disabled: _this._options.disabled, onClick: function (e) {
|
|
152
165
|
if (_this._options.disabled || _this.isInProcess())
|
|
153
166
|
return;
|
|
154
167
|
// @ts-ignore
|
|
@@ -159,8 +172,16 @@ var DialogActionBase = /** @class */ (function (_super) {
|
|
|
159
172
|
buttonRef.style.minWidth = buttonRef.getBoundingClientRect().width + 'px';
|
|
160
173
|
}
|
|
161
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* 🎯 Amaç:
|
|
177
|
+
* action veya Action kelimesini silmek
|
|
178
|
+
* this.props.name.replace(/action/i, '');
|
|
179
|
+
* /action/ → kelime
|
|
180
|
+
* i → case-insensitive
|
|
181
|
+
* Daha temiz, daha kısa
|
|
182
|
+
*/
|
|
162
183
|
return (0, jsx_runtime_1.jsxs)(React.Fragment, { children: [(0, jsx_runtime_1.jsx)(index_1.CircularProgress, { size: 15, inProcess: { inProcess: _this.isInProcess() } }), !_this.isInProcess() &&
|
|
163
|
-
_this.
|
|
184
|
+
_this.options.label] });
|
|
164
185
|
} });
|
|
165
186
|
};
|
|
166
187
|
_this._options = props.options;
|
|
@@ -172,7 +193,8 @@ var DialogActionBase = /** @class */ (function (_super) {
|
|
|
172
193
|
_this._inProcess = props.inProcess;
|
|
173
194
|
_this.state = {
|
|
174
195
|
coords: { x: -1, y: -1 },
|
|
175
|
-
isRippling: false
|
|
196
|
+
isRippling: false,
|
|
197
|
+
intent: props.intent
|
|
176
198
|
};
|
|
177
199
|
_this._buttonRef = React.createRef();
|
|
178
200
|
_this._rippleButtonRef = React.createRef();
|
|
@@ -208,9 +230,7 @@ var DialogActionBase = /** @class */ (function (_super) {
|
|
|
208
230
|
enumerable: false,
|
|
209
231
|
configurable: true
|
|
210
232
|
});
|
|
211
|
-
DialogActionBase.prototype.
|
|
212
|
-
console.log(23);
|
|
213
|
-
console.log('setOptions-XAA', JSON.stringify(options));
|
|
233
|
+
DialogActionBase.prototype.updateOptions = function (options) {
|
|
214
234
|
this._options = __assign(__assign({}, this._options), options);
|
|
215
235
|
this.forceUpdate();
|
|
216
236
|
return this;
|
|
@@ -7,6 +7,7 @@ import { DialogContentFooterReturnType } from "../types/DialogActionTypes";
|
|
|
7
7
|
import Dialog, { DialogAction } from "../index";
|
|
8
8
|
interface IFormikAdapter extends Pick<FormikProps<any>, 'setValues' | 'setFieldValue' | 'values'> {
|
|
9
9
|
}
|
|
10
|
+
type FeatureType = Partial<Record<string, any>>;
|
|
10
11
|
declare class DialogBase<Values extends Record<string, any>> extends Component<BaseDialogProps, BaseDialogState> {
|
|
11
12
|
_dialogTranslate: {
|
|
12
13
|
lastX: number;
|
|
@@ -15,7 +16,6 @@ declare class DialogBase<Values extends Record<string, any>> extends Component<B
|
|
|
15
16
|
readonly _actionRefs: {
|
|
16
17
|
[key: string]: RefObject<DialogActionBase>;
|
|
17
18
|
};
|
|
18
|
-
private _keyboardListener;
|
|
19
19
|
protected _inlineFormikProps: IFormikAdapter;
|
|
20
20
|
protected _header: TDialogCallbackFn;
|
|
21
21
|
protected _body: TDialogCallbackFn;
|
|
@@ -40,6 +40,10 @@ declare class DialogBase<Values extends Record<string, any>> extends Component<B
|
|
|
40
40
|
private _accessFrom;
|
|
41
41
|
private _processingListener;
|
|
42
42
|
constructor(props?: Readonly<BaseDialogProps>);
|
|
43
|
+
private T;
|
|
44
|
+
private readonly _features;
|
|
45
|
+
addFeature(key: string, value: any): void;
|
|
46
|
+
getFeature(key: string): FeatureType;
|
|
43
47
|
get parent(): Dialog;
|
|
44
48
|
get dialogTranslate(): {
|
|
45
49
|
lastX: number;
|
|
@@ -64,7 +68,7 @@ declare class DialogBase<Values extends Record<string, any>> extends Component<B
|
|
|
64
68
|
close: (callbackFn?: () => void) => void;
|
|
65
69
|
focus: () => void;
|
|
66
70
|
get actions(): {
|
|
67
|
-
[key: string]: Pick<DialogActionBase, "
|
|
71
|
+
[key: string]: Pick<DialogActionBase, "updateOptions" | "setInProcess" | "getLabel" | "options" | "click" | "remove" | "name">;
|
|
68
72
|
};
|
|
69
73
|
updateBody(body: TDialogCallbackFn): void;
|
|
70
74
|
processingListener(listener: (inProcess: boolean) => void): this;
|
package/components/DialogBase.js
CHANGED
|
@@ -58,15 +58,17 @@ 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
|
+
};
|
|
61
64
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
65
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
63
66
|
var react_1 = require("react");
|
|
64
67
|
var React = __importStar(require("react"));
|
|
65
68
|
var lodash_1 = require("lodash");
|
|
66
69
|
var _1 = require("./");
|
|
67
|
-
// Bounds methods
|
|
68
|
-
var helpers_1 = require("../helpers");
|
|
69
70
|
var dialogRectAuto_1 = require("../helpers/dialogRectAuto");
|
|
71
|
+
var DialogContentContextProvider_1 = __importDefault(require("../context/DialogContentContextProvider"));
|
|
70
72
|
var DialogBase = /** @class */ (function (_super) {
|
|
71
73
|
__extends(DialogBase, _super);
|
|
72
74
|
function DialogBase(props) {
|
|
@@ -78,6 +80,8 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
78
80
|
_this._inProcess = { inProcess: false };
|
|
79
81
|
_this._footerRef = React.createRef();
|
|
80
82
|
_this._headerRef = React.createRef();
|
|
83
|
+
_this.T = [];
|
|
84
|
+
_this._features = {};
|
|
81
85
|
// Initialize a ref for each action dynamically
|
|
82
86
|
_this.initializeActionRef = function (key) {
|
|
83
87
|
if (!_this._actionRefs.hasOwnProperty(key)) {
|
|
@@ -107,7 +111,7 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
107
111
|
// Set the options with prevDisabled as the current disabled state
|
|
108
112
|
if (currentDisabled !== process) {
|
|
109
113
|
action.current
|
|
110
|
-
.
|
|
114
|
+
.updateOptions(__assign(__assign({}, action.current.options), { prevDisabled: currentDisabled, disabled: process // Set the new disabled state based on the process
|
|
111
115
|
}));
|
|
112
116
|
}
|
|
113
117
|
}
|
|
@@ -118,7 +122,7 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
118
122
|
// Restore the previous disabled state from options
|
|
119
123
|
// Call prevDisabled state from memo
|
|
120
124
|
action.current
|
|
121
|
-
.
|
|
125
|
+
.updateOptions(__assign(__assign({}, action.current.options), { disabled: action.current.options.prevDisabled // Set the new disabled state based on the process
|
|
122
126
|
}));
|
|
123
127
|
}
|
|
124
128
|
}
|
|
@@ -134,18 +138,15 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
134
138
|
return _this;
|
|
135
139
|
};
|
|
136
140
|
_this.isInProcess = function () {
|
|
137
|
-
// return this.state.inProcess;
|
|
138
141
|
return _this._inProcess;
|
|
139
|
-
// @ts-ignore
|
|
140
|
-
// return this._footerRef?.current?.inProcess ?? false;
|
|
141
142
|
};
|
|
142
143
|
_this.close = function (callbackFn) {
|
|
143
|
-
var _a;
|
|
144
|
+
var _a, _b, _c, _d;
|
|
144
145
|
if (_this._footerRef.current.inProcess) {
|
|
145
146
|
var notify = (_a = _this._dialogOptions.base.notifyOnClosing) !== null && _a !== void 0 ? _a : "snackbar";
|
|
146
147
|
if (notify === "snackbar") {
|
|
147
|
-
|
|
148
|
-
_this.snackbar.open(
|
|
148
|
+
var busyMessage = (_d = (_c = (_b = _this._dialogOptions) === null || _b === void 0 ? void 0 : _b.localText) === null || _c === void 0 ? void 0 : _c.busyMessage) !== null && _d !== void 0 ? _d : 'In Process, Please wait...';
|
|
149
|
+
_this.snackbar.open(busyMessage, "warning");
|
|
149
150
|
}
|
|
150
151
|
else {
|
|
151
152
|
_this._dialogWithBackDropRef.current.baseZoomEffect();
|
|
@@ -167,11 +168,15 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
167
168
|
};
|
|
168
169
|
_this.render = function () {
|
|
169
170
|
console.log('this._prevDialogRect', _this.state.prevDialogRect);
|
|
170
|
-
return (0, jsx_runtime_1.jsx)(
|
|
171
|
+
return (0, jsx_runtime_1.jsx)(DialogContentContextProvider_1.default
|
|
172
|
+
// 1️⃣initialValues={this.props.initialValues}
|
|
173
|
+
, {
|
|
174
|
+
// 1️⃣initialValues={this.props.initialValues}
|
|
175
|
+
dialogBase: _this,
|
|
171
176
|
// Component
|
|
172
|
-
|
|
177
|
+
body: _this.state.body,
|
|
173
178
|
// Refs Props
|
|
174
|
-
|
|
179
|
+
dialogRef: _this._dialogRef, headerRef: _this._headerRef, bodyRef: _this._dialogBodyRef, footerRef: _this._footerRef, backdropRef: _this._backdropRef, snackbarRef: _this._snackbarRef, prevDialogRect: _this.state.prevDialogRect, children: (0, jsx_runtime_1.jsx)(_1.DialogWithBackdropWrapper, {}) });
|
|
175
180
|
};
|
|
176
181
|
_this.state = {
|
|
177
182
|
inProcess: { inProcess: false },
|
|
@@ -207,6 +212,7 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
207
212
|
size: _this._dialogSize
|
|
208
213
|
}
|
|
209
214
|
}, _this._dialogOptions);
|
|
215
|
+
console.log('Dialog_Base_Options', defaultOptions, window["dialogOptions"], props.initialOptions);
|
|
210
216
|
_this._dialogOptions = (0, lodash_1.merge)({}, defaultOptions, window["dialogOptions"], props.initialOptions);
|
|
211
217
|
_this._header = props.header;
|
|
212
218
|
_this._body = props.body;
|
|
@@ -223,9 +229,16 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
223
229
|
_this._dialogWithBackDropRef = (0, react_1.createRef)();
|
|
224
230
|
_this._parent = props.parent;
|
|
225
231
|
_this._processingListener = props.processingListener;
|
|
232
|
+
_this._features = [];
|
|
226
233
|
console.log('this._dialogOptions', _this._dialogOptions);
|
|
227
234
|
return _this;
|
|
228
235
|
}
|
|
236
|
+
DialogBase.prototype.addFeature = function (key, value) {
|
|
237
|
+
this._features[key] = value;
|
|
238
|
+
};
|
|
239
|
+
DialogBase.prototype.getFeature = function (key) {
|
|
240
|
+
return this._features[key];
|
|
241
|
+
};
|
|
229
242
|
Object.defineProperty(DialogBase.prototype, "parent", {
|
|
230
243
|
get: function () {
|
|
231
244
|
return this._parent;
|
|
@@ -333,33 +346,16 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
333
346
|
};
|
|
334
347
|
// ✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨
|
|
335
348
|
DialogBase.prototype.componentDidMount = function () {
|
|
336
|
-
var _a, _b, _c
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
var _f = this._dialogOptions.snackbar.anchorOrigin, vertical = _f.vertical, horizontal = _f.horizontal;
|
|
349
|
+
var _a, _b, _c;
|
|
350
|
+
// First position take from Global
|
|
351
|
+
var _d = this._dialogOptions.snackbar.anchorOrigin, vertical = _d.vertical, horizontal = _d.horizontal;
|
|
340
352
|
var initialAnchor = { vertical: vertical, horizontal: horizontal };
|
|
341
|
-
//
|
|
353
|
+
// Merge user defied positions with global positions!
|
|
342
354
|
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 } : {}));
|
|
343
355
|
if (typeof ((_c = this.props) === null || _c === void 0 ? void 0 : _c.didMountCallback) === "function") {
|
|
344
356
|
this.props.didMountCallback(this);
|
|
345
357
|
}
|
|
346
|
-
//
|
|
347
|
-
if ((_d = this._dialogOptions.base) === null || _d === void 0 ? void 0 : _d.memoBounds) {
|
|
348
|
-
if (!helpers_1.InitDialogMemoizeBoundsDeclared) {
|
|
349
|
-
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' +
|
|
350
|
-
'InitDialogMemoizeBounds()\n' +
|
|
351
|
-
'const App() => {...');
|
|
352
|
-
}
|
|
353
|
-
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;
|
|
354
|
-
(0, helpers_1.dialogRegister)(this._dialogOptions.base.id, {
|
|
355
|
-
width: width,
|
|
356
|
-
height: height,
|
|
357
|
-
x: x,
|
|
358
|
-
y: y,
|
|
359
|
-
fullscreen: false
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
// Parent objesinin accessFrom özelliğini ayarla
|
|
358
|
+
// accessFrom Property of Parent object Internal->External
|
|
363
359
|
this.accessFrom = "internal";
|
|
364
360
|
};
|
|
365
361
|
DialogBase.prototype.kill = function (callbackFn) {
|
|
@@ -70,22 +70,26 @@ var _1 = require("./");
|
|
|
70
70
|
var react_1 = require("react");
|
|
71
71
|
var helpers_2 = require("../helpers");
|
|
72
72
|
var jumper_animate_1 = require("./utils/effects/jumper-animate");
|
|
73
|
-
var
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
var
|
|
77
|
-
var
|
|
78
|
-
var
|
|
73
|
+
var DialogContentContextProvider_1 = require("../context/DialogContentContextProvider");
|
|
74
|
+
var DialogContent = function (props) {
|
|
75
|
+
var _a, _b, _c, _d, _e;
|
|
76
|
+
var _f = (0, react_1.useContext)(DialogContentContextProvider_1.DialogContentContext), dialog = _f.dialog, dialogRef = _f.dialogRef, prevDialogRect = _f.prevDialogRect, backdropRef = _f.backdropRef, snackbarRef = _f.snackbarRef, footerRef = _f.footerRef, resizeableObject = _f.resizeableObject;
|
|
77
|
+
var dialogOptions = dialog.dialogOptions;
|
|
78
|
+
var baseOptions = dialogOptions.base;
|
|
79
79
|
var _g = React.useState(false), fullscreenMode = _g[0], setFullscreenMode = _g[1];
|
|
80
80
|
var _h = React.useState(null), rect = _h[0], setRect = _h[1];
|
|
81
|
-
var
|
|
82
|
-
/**
|
|
83
|
-
* default null
|
|
84
|
-
* If memoized, than read values from memory
|
|
85
|
-
* */
|
|
86
|
-
var base = dialogOptions.base;
|
|
87
|
-
var bounds = ((_b = dialogOptions.base) === null || _b === void 0 ? void 0 : _b.memoBounds) ? (0, helpers_1.getDialogBounds)(base.id) : null;
|
|
81
|
+
var bounds = ((_a = dialog.dialogOptions.base) === null || _a === void 0 ? void 0 : _a.memoBounds) ? (0, helpers_1.getDialogBounds)(dialog.dialogOptions.base.id) : null;
|
|
88
82
|
var domZIndex = window.getComputedStyle(dialog.getDom()).zIndex;
|
|
83
|
+
var positionSelector = function () {
|
|
84
|
+
var _a;
|
|
85
|
+
var dialogRectSelectors = { xKey: 'marginLeft', yKey: 'marginTop' };
|
|
86
|
+
if (prevDialogRect === null || prevDialogRect === void 0 ? void 0 : prevDialogRect.isMultiple) {
|
|
87
|
+
dialogRectSelectors = { xKey: 'left', yKey: 'top' };
|
|
88
|
+
}
|
|
89
|
+
var _b = bounds !== null && bounds !== void 0 ? bounds : {}, fullscreen = _b.fullscreen, x = _b.x, y = _b.y, restBounds = __rest(_b, ["fullscreen", "x", "y"]);
|
|
90
|
+
var cssBounds = __assign(__assign(__assign(__assign({}, restBounds), (_a = {}, _a[dialogRectSelectors.xKey] = prevDialogRect === null || prevDialogRect === void 0 ? void 0 : prevDialogRect.left, _a[dialogRectSelectors.yKey] = prevDialogRect === null || prevDialogRect === void 0 ? void 0 : prevDialogRect.top, _a)), prevDialogRect.isMultiple ? { position: 'absolute' } : null), { translate: prevDialogRect.isMultiple ? "".concat(5, "px ").concat(5, "px") : 'none' });
|
|
91
|
+
return __assign({}, bounds ? { position: 'absolute', top: bounds.y, left: bounds.x, width: bounds.width, height: bounds.height } : cssBounds);
|
|
92
|
+
};
|
|
89
93
|
// Effect Listener
|
|
90
94
|
(0, react_1.useEffect)(function () {
|
|
91
95
|
var _a;
|
|
@@ -101,6 +105,7 @@ var DialogContent = function (_a) {
|
|
|
101
105
|
}
|
|
102
106
|
}
|
|
103
107
|
}, [dialog === null || dialog === void 0 ? void 0 : dialog.values]);
|
|
108
|
+
// Listener & Animate
|
|
104
109
|
(0, react_1.useEffect)(function () {
|
|
105
110
|
// setDialogRect();
|
|
106
111
|
(0, helpers_2.formInputKeyListeners)(dialogRef.current);
|
|
@@ -108,15 +113,31 @@ var DialogContent = function (_a) {
|
|
|
108
113
|
(0, jumper_animate_1.jumperAnimate)(dialogRef.current);
|
|
109
114
|
}
|
|
110
115
|
}, []);
|
|
116
|
+
// Set Rect
|
|
111
117
|
(0, react_1.useEffect)(function () {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
setRect(positionSelector());
|
|
119
|
+
}, []);
|
|
120
|
+
// Register Dialog If already not registered
|
|
121
|
+
(0, react_1.useEffect)(function () {
|
|
122
|
+
// Register Dialog Bounds
|
|
123
|
+
setTimeout(function () {
|
|
124
|
+
var _a, _b;
|
|
125
|
+
if ((_a = dialog.dialogOptions.base) === null || _a === void 0 ? void 0 : _a.memoBounds) {
|
|
126
|
+
if (!helpers_1.InitDialogMemoizeBoundsDeclared) {
|
|
127
|
+
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' +
|
|
128
|
+
'InitDialogMemoizeBounds()\n' +
|
|
129
|
+
'const App() => {...');
|
|
130
|
+
}
|
|
131
|
+
var _c = (_b = dialogRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect(), width = _c.width, height = _c.height, x = _c.x, y = _c.y;
|
|
132
|
+
(0, helpers_1.dialogRegister)(dialog.dialogOptions.base.id, {
|
|
133
|
+
width: width,
|
|
134
|
+
height: height,
|
|
135
|
+
x: x,
|
|
136
|
+
y: y,
|
|
137
|
+
fullscreen: false
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}, 1000);
|
|
120
141
|
}, []);
|
|
121
142
|
return (0, jsx_runtime_1.jsx)(react_draggable_1.default, { disabled: !baseOptions.draggable || fullscreenMode, axis: 'both', handle: baseOptions.draggable ? '.drag-handle' : '', scale: 1, ref: backdropRef, onDrag: function (event, data) {
|
|
122
143
|
event.stopPropagation();
|
|
@@ -134,7 +155,7 @@ var DialogContent = function (_a) {
|
|
|
134
155
|
y: y,
|
|
135
156
|
fullscreen: false
|
|
136
157
|
}, dialogRef);
|
|
137
|
-
}, children: (0, jsx_runtime_1.
|
|
158
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { id: "dialog-main", ref: dialogRef, onClick: function (e) {
|
|
138
159
|
e.stopPropagation();
|
|
139
160
|
}, tabIndex: 0, onKeyDown: function (e) {
|
|
140
161
|
var target = e.target;
|
|
@@ -147,9 +168,9 @@ var DialogContent = function (_a) {
|
|
|
147
168
|
// @ts-ignore
|
|
148
169
|
dialog.props.keyboardListener(e.key, _this);
|
|
149
170
|
}
|
|
150
|
-
}, className: baseOptions.size.width === 'auto' ? 'auto' : "dialog-width-".concat(dialogOptions.base.size.width, " dialog-main show-opacity show-position-").concat(baseOptions.initialAnchor.vertical), style: __assign(__assign(__assign(__assign({ height: (
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
171
|
+
}, className: baseOptions.size.width === 'auto' ? 'auto' : "dialog-width-".concat(dialogOptions.base.size.width, " dialog-main show-opacity show-position-").concat(baseOptions.initialAnchor.vertical), style: __assign(__assign(__assign(__assign({ height: (_b = baseOptions.size.height) !== null && _b !== void 0 ? _b : 'auto' }, typeof baseOptions.size.width === "number" ? { width: "".concat(baseOptions.size.width, "px") } : { width: "".concat(baseOptions.size.width) }), { outline: 'none', fontFamily: (_c = baseOptions.style.fontFamily) !== null && _c !== void 0 ? _c : 'Arial' }), rect), { alignSelf: (_d = baseOptions.initialAnchor.vertical) !== null && _d !== void 0 ? _d : 'flex-start', justifySelf: (_e = baseOptions.initialAnchor.horizontal) !== null && _e !== void 0 ? _e : 'flex-start' }), children: (0, jsx_runtime_1.jsxs)(notistack_1.SnackbarProvider, { ref: snackbarRef, maxSnack: dialog.dialogOptions.snackbar.maxSnack, children: [(dialog.props.header || dialogOptions.slot.header) && ((0, jsx_runtime_1.jsx)(_1.DialogContentHeader, { header: dialog.props.header, bounds: bounds })), (0, jsx_runtime_1.jsx)(_1.DialogContentBody, { body: dialog.state.body }), (0, jsx_runtime_1.jsx)(_1.DialogContentFooter, { ref: footerRef }), (baseOptions.resizeable) &&
|
|
172
|
+
(0, jsx_runtime_1.jsx)(React.Fragment, { children: (0, jsx_runtime_1.jsx)("div", { className: "resizable-handle", style: {
|
|
173
|
+
zIndex: parseInt(domZIndex) + 1
|
|
174
|
+
}, onMouseDown: resizeableObject === null || resizeableObject === void 0 ? void 0 : resizeableObject.resizeHandleMouseDown, children: (0, jsx_runtime_1.jsx)(ResizeIcon_1.default, { color: '#286e94' }) }) })] }) }) });
|
|
154
175
|
};
|
|
155
176
|
exports.DialogContent = DialogContent;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { TDialogCallbackFn } from "../types/DialogTypes";
|
|
3
|
-
import DialogBase from "./DialogBase";
|
|
4
3
|
interface IContentBodyProps {
|
|
5
4
|
body: TDialogCallbackFn;
|
|
6
|
-
dialog: DialogBase<any>;
|
|
7
|
-
ref?: React.RefObject<any>;
|
|
8
5
|
}
|
|
9
6
|
declare const DialogContentBody: React.FC<IContentBodyProps>;
|
|
10
7
|
export { DialogContentBody };
|
|
@@ -36,6 +36,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.DialogContentBody = void 0;
|
|
37
37
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
38
|
var React = __importStar(require("react"));
|
|
39
|
+
var react_1 = require("react");
|
|
40
|
+
var DialogContentContextProvider_1 = require("../context/DialogContentContextProvider");
|
|
39
41
|
var Placeholder = function (_a) {
|
|
40
42
|
var dialogOptions = _a.dialogOptions, placeholder = _a.placeholder;
|
|
41
43
|
var bgColor = dialogOptions.base.style.backgroundColor ?
|
|
@@ -49,9 +51,16 @@ var Placeholder = function (_a) {
|
|
|
49
51
|
}, children: placeholder });
|
|
50
52
|
};
|
|
51
53
|
var DialogContentBody = React.forwardRef(function (_a, ref) {
|
|
52
|
-
|
|
54
|
+
// const [localBody, setLocalBody] = React.useState(null);
|
|
55
|
+
var body = _a.body;
|
|
56
|
+
var dialog = (0, react_1.useContext)(DialogContentContextProvider_1.DialogContentContext).dialog;
|
|
57
|
+
// useEffect(() => {
|
|
58
|
+
// setLocalBody(body(dialog));
|
|
59
|
+
// }, [body]);
|
|
53
60
|
if (body instanceof Function) {
|
|
54
|
-
|
|
61
|
+
var BodyElement = body(dialog); // localBody;
|
|
62
|
+
console.log('Typeof BodyElement', BodyElement);
|
|
63
|
+
return (0, jsx_runtime_1.jsxs)("div", { className: 'dialog-body', style: { height: '100%' }, children: [dialog.holder && (0, jsx_runtime_1.jsx)(Placeholder, { dialogOptions: dialog.dialogOptions, placeholder: dialog.holder }), (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: BodyElement })] });
|
|
55
64
|
}
|
|
56
65
|
return (0, jsx_runtime_1.jsx)("div", { className: 'dialog-body', style: { height: '100%', padding: 10 }, children: dialog.holder ?
|
|
57
66
|
(0, jsx_runtime_1.jsx)(Placeholder, { dialogOptions: dialog.dialogOptions, placeholder: dialog.holder })
|
|
@@ -52,13 +52,14 @@ var react_1 = require("react");
|
|
|
52
52
|
var Features_1 = require("./Features");
|
|
53
53
|
var context_1 = require("../context");
|
|
54
54
|
var _1 = require("./");
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
var
|
|
55
|
+
var DialogContentContextProvider_1 = require("../context/DialogContentContextProvider");
|
|
56
|
+
var DialogContentFooter = (0, react_1.forwardRef)(function (props, ref) {
|
|
57
|
+
var _a, _b, _c;
|
|
58
|
+
var dialog = (0, react_1.useContext)(DialogContentContextProvider_1.DialogContentContext).dialog;
|
|
58
59
|
var dialogOptions = dialog.dialogOptions;
|
|
59
|
-
var CustomFooter = (
|
|
60
|
+
var CustomFooter = (_a = dialogOptions.slot) === null || _a === void 0 ? void 0 : _a.footer;
|
|
60
61
|
// Imperative handle
|
|
61
|
-
var
|
|
62
|
+
var _d = React.useState(false), inProcess = _d[0], setInProcess = _d[1];
|
|
62
63
|
var setProcessing = function (inProcess) {
|
|
63
64
|
setInProcess(inProcess);
|
|
64
65
|
};
|
|
@@ -77,9 +78,9 @@ var DialogContentFooter = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
77
78
|
inProcess: dialog.isInProcess()
|
|
78
79
|
});
|
|
79
80
|
}
|
|
80
|
-
return (0, jsx_runtime_1.jsxs)("div", { className: 'dialog-footer', style: (
|
|
81
|
+
return (0, jsx_runtime_1.jsxs)("div", { className: 'dialog-footer', style: (_c = (_b = dialogOptions.base) === null || _b === void 0 ? void 0 : _b.footer) === null || _c === void 0 ? void 0 : _c.style, children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(context_1.WithHeaderFooterContext, __assign({}, staticProps, { dialog: dialog, children: dialogOptions.slot.footer ?
|
|
81
82
|
(0, jsx_runtime_1.jsx)(CustomFooter, __assign({}, staticProps, footerProps))
|
|
82
83
|
:
|
|
83
|
-
(0, jsx_runtime_1.jsx)(Features_1.DialogProcessing, {}) })) }), (0, jsx_runtime_1.jsx)(_1.Actions, { dialog: dialog, actions: actions })] });
|
|
84
|
+
(0, jsx_runtime_1.jsx)(Features_1.DialogProcessing, {}) })) }), (0, jsx_runtime_1.jsx)(_1.Actions, { dialog: dialog, actions: dialog.props.actions })] });
|
|
84
85
|
});
|
|
85
86
|
exports.DialogContentFooter = DialogContentFooter;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { TDialogCallbackFn } from "../types/DialogTypes";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import DialogBase from "./DialogBase";
|
|
4
3
|
import { IDialogBoundsDef } from "../types/BoundTypes";
|
|
5
4
|
interface IContentHeaderProps {
|
|
6
5
|
header: TDialogCallbackFn;
|
|
7
|
-
dialog: DialogBase<any>;
|
|
8
|
-
ref: React.RefObject<any>;
|
|
9
|
-
dialogRef: React.RefObject<any>;
|
|
10
6
|
bounds: IDialogBoundsDef;
|
|
11
7
|
}
|
|
12
8
|
declare const DialogContentHeader: React.FC<IContentHeaderProps>;
|
|
@@ -52,15 +52,14 @@ var React = __importStar(require("react"));
|
|
|
52
52
|
var react_1 = require("react");
|
|
53
53
|
var helpers_1 = require("../helpers");
|
|
54
54
|
var context_1 = require("../context");
|
|
55
|
-
var
|
|
55
|
+
var DialogContentContextProvider_1 = require("../context/DialogContentContextProvider");
|
|
56
|
+
var DialogContentHeader = function (_a) {
|
|
56
57
|
var _b, _c, _d, _e;
|
|
57
|
-
var header = _a.header,
|
|
58
|
+
var header = _a.header, bounds = _a.bounds;
|
|
59
|
+
var _f = (0, react_1.useContext)(DialogContentContextProvider_1.DialogContentContext), dialog = _f.dialog, dialogRef = _f.dialogRef;
|
|
58
60
|
var dialogOptions = dialog.dialogOptions;
|
|
59
|
-
var
|
|
60
|
-
(0
|
|
61
|
-
setFullscreen: setFullscreen,
|
|
62
|
-
fullscreen: fullscreen
|
|
63
|
-
}); });
|
|
61
|
+
var baseOptions = dialogOptions.base;
|
|
62
|
+
var _g = React.useState(bounds === null || bounds === void 0 ? void 0 : bounds.fullscreen), fullscreen = _g[0], setFullscreen = _g[1];
|
|
64
63
|
(0, react_1.useEffect)(function () {
|
|
65
64
|
if (fullscreen) {
|
|
66
65
|
dialogRef.current.classList.add('fullscreen');
|
|
@@ -73,7 +72,6 @@ var DialogContentHeader = React.forwardRef(function (_a, ref) {
|
|
|
73
72
|
dialogRef.current.classList.remove('no-user-select');
|
|
74
73
|
}, 300);
|
|
75
74
|
}, [fullscreen]);
|
|
76
|
-
var baseOptions = dialogOptions.base;
|
|
77
75
|
var CustomHeader = (_b = dialogOptions.slot) === null || _b === void 0 ? void 0 : _b.header;
|
|
78
76
|
var staticProps = {
|
|
79
77
|
dialogOptions: dialogOptions,
|
|
@@ -105,5 +103,5 @@ var DialogContentHeader = React.forwardRef(function (_a, ref) {
|
|
|
105
103
|
(0, jsx_runtime_1.jsx)(Features_1.DialogInfoAction, {})] }) })] });
|
|
106
104
|
}
|
|
107
105
|
return (0, jsx_runtime_1.jsx)("div", { style: (_e = baseOptions === null || baseOptions === void 0 ? void 0 : baseOptions.header) === null || _e === void 0 ? void 0 : _e.style, className: 'drag-handle dialog-header', children: header });
|
|
108
|
-
}
|
|
106
|
+
};
|
|
109
107
|
exports.DialogContentHeader = DialogContentHeader;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { DialogWithBackdropWrapperRefProps, WithBackdrop } from "../types/DialogTypes";
|
|
3
|
-
declare const DialogWithBackdropWrapper: React.ForwardRefExoticComponent<Omit<WithBackdrop, "ref"> & React.RefAttributes<DialogWithBackdropWrapperRefProps>>;
|
|
1
|
+
declare const DialogWithBackdropWrapper: () => import("react/jsx-runtime").JSX.Element;
|
|
4
2
|
export { DialogWithBackdropWrapper };
|