react-dialogger 1.1.36 → 1.1.38
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/DialogActionBase.d.ts +1 -1
- package/components/DialogBase.d.ts +23 -17
- package/components/DialogBase.js +60 -32
- package/components/DialogContent.d.ts +0 -0
- package/components/DialogContent.js +181 -0
- package/models/Dialog.d.ts +1 -1
- package/package.json +1 -1
- package/types/DialogActionTypes.d.ts +1 -1
- package/types/DialogTypes.d.ts +6 -6
|
@@ -2,7 +2,7 @@ import { Component } from "react";
|
|
|
2
2
|
import DialogBase from "./DialogBase";
|
|
3
3
|
import { ActionProps, ActionState, DialogActionType, TBVariant, TBColor, DialogActionOptionsType, TDialogStateListenerForActionCallbackType } from "../types/DialogActionTypes";
|
|
4
4
|
declare class DialogActionBase extends Component<ActionProps, ActionState> {
|
|
5
|
-
get dialogBaseComponent(): DialogBase
|
|
5
|
+
get dialogBaseComponent(): DialogBase<any>;
|
|
6
6
|
protected _options: DialogActionOptionsType;
|
|
7
7
|
_stateListener: TDialogStateListenerForActionCallbackType;
|
|
8
8
|
protected _baseDialogAction?: DialogActionBase;
|
|
@@ -8,7 +8,7 @@ import { IInProcess, ComponentOrderType, TInitialHolder, ISnackbarAnchor, Compon
|
|
|
8
8
|
import { BaseDialogProps, BaseDialogState, IDialogSize, DialogOptionsType, TBaseDialogState, TDialogStateListenerCallbackType, IDialogDef, TDialogCallbackNodeFn, TDialogCallbackVoidFn } from "../types/DialogTypes";
|
|
9
9
|
import Resizeable from "../models/Resizeable";
|
|
10
10
|
export declare const DialogHeaderFooterContext: React.Context<any>;
|
|
11
|
-
declare class DialogBase extends Component<BaseDialogProps, BaseDialogState> {
|
|
11
|
+
declare class DialogBase<Values extends Record<string, any>> extends Component<BaseDialogProps, BaseDialogState> {
|
|
12
12
|
get parent(): Dialog;
|
|
13
13
|
protected _dom: HTMLDivElement;
|
|
14
14
|
protected _innerRef: React.RefObject<any>;
|
|
@@ -28,6 +28,7 @@ declare class DialogBase extends Component<BaseDialogProps, BaseDialogState> {
|
|
|
28
28
|
protected _dialogSize: IDialogSize;
|
|
29
29
|
protected _holder?: TInitialHolder;
|
|
30
30
|
protected _formikProps: FormikProps<any>;
|
|
31
|
+
/**@deprecated use outside Content component*/
|
|
31
32
|
protected _dialogTranslate: {
|
|
32
33
|
lastX: number;
|
|
33
34
|
lastY: number;
|
|
@@ -48,6 +49,7 @@ declare class DialogBase extends Component<BaseDialogProps, BaseDialogState> {
|
|
|
48
49
|
* @see dialogOptions.snackbar.anchorOrigin */
|
|
49
50
|
protected _snackbarAnchor: ISnackbarAnchor;
|
|
50
51
|
protected _Resizeable: Resizeable;
|
|
52
|
+
/**@deprecated use outside Content component*/
|
|
51
53
|
protected readonly dialogPosFromMultipleDialogs: BaseDialogDOMRect;
|
|
52
54
|
private readonly _actionRefs;
|
|
53
55
|
/**@deprecated
|
|
@@ -77,26 +79,26 @@ declare class DialogBase extends Component<BaseDialogProps, BaseDialogState> {
|
|
|
77
79
|
get formikProps(): FormikProps<any>;
|
|
78
80
|
set formikProps(value: FormikProps<any>);
|
|
79
81
|
get formikValidate(): Promise<FormikProps<any>>;
|
|
80
|
-
get values():
|
|
81
|
-
setValues(values:
|
|
82
|
-
setValue(key: string,
|
|
82
|
+
get values(): FormikProps<Values>;
|
|
83
|
+
setValues(values: FormikProps<Values>, callbackFn?: () => void): void;
|
|
84
|
+
setValue(key: string, value: any): void;
|
|
83
85
|
private dialogAutoPos;
|
|
84
86
|
componentDidMount(): void;
|
|
85
87
|
onResize(callbackFn: (size: IDialogSize, dialog: IDialogDef) => void): void;
|
|
86
88
|
componentWillUnmount(): void;
|
|
87
89
|
setState<K extends keyof BaseDialogState>(state: ((prevState: Readonly<BaseDialogState>, props: Readonly<BaseDialogProps>) => (Pick<BaseDialogState, K> | BaseDialogState | null)) | Pick<BaseDialogState, K> | BaseDialogState | null, callback?: () => void): void;
|
|
88
|
-
protected setHeader(header: TDialogCallbackNodeFn):
|
|
89
|
-
setBody(body: TDialogCallbackNodeFn):
|
|
90
|
-
protected addActions(actions: Array<DialogAction>):
|
|
91
|
-
protected addAction(action: DialogAction):
|
|
92
|
-
stateListener(listener: TDialogStateListenerCallbackType):
|
|
93
|
-
protected keyboardListener(listener: (key: string, dialog: IDialogDef) => void):
|
|
94
|
-
protected resizeListener(listener: (size: IDialogSize, dialog: IDialogDef) => void):
|
|
95
|
-
processingListener(listener: (inProcess: boolean) => void):
|
|
96
|
-
protected initialHolder(holder: TInitialHolder):
|
|
97
|
-
protected onClose(callback: TDialogCallbackVoidFn):
|
|
98
|
-
setInProcess_noRef: (process: boolean, message?: string, holder?: TInitialHolder) =>
|
|
99
|
-
setInProcess: (process: boolean, message?: string, holder?: TInitialHolder) =>
|
|
90
|
+
protected setHeader(header: TDialogCallbackNodeFn): this;
|
|
91
|
+
setBody(body: TDialogCallbackNodeFn): this;
|
|
92
|
+
protected addActions(actions: Array<DialogAction>): this;
|
|
93
|
+
protected addAction(action: DialogAction): this;
|
|
94
|
+
stateListener(listener: TDialogStateListenerCallbackType): this;
|
|
95
|
+
protected keyboardListener(listener: (key: string, dialog: IDialogDef) => void): this;
|
|
96
|
+
protected resizeListener(listener: (size: IDialogSize, dialog: IDialogDef) => void): this;
|
|
97
|
+
processingListener(listener: (inProcess: boolean) => void): this;
|
|
98
|
+
protected initialHolder(holder: TInitialHolder): this;
|
|
99
|
+
protected onClose(callback: TDialogCallbackVoidFn): this;
|
|
100
|
+
setInProcess_noRef: (process: boolean, message?: string, holder?: TInitialHolder) => this;
|
|
101
|
+
setInProcess: (process: boolean, message?: string, holder?: TInitialHolder) => this;
|
|
100
102
|
isInProcess: () => IInProcess;
|
|
101
103
|
close: (callbackFn?: any) => void;
|
|
102
104
|
focus: () => void;
|
|
@@ -110,7 +112,7 @@ declare class DialogBase extends Component<BaseDialogProps, BaseDialogState> {
|
|
|
110
112
|
* Please use an alternative approach for setting dialog ordering or layout.
|
|
111
113
|
* The dialog ordering functionality will be managed differently in future versions.
|
|
112
114
|
*/
|
|
113
|
-
setOrder: (position: ComponentOrderPositions, component: HTMLElement) =>
|
|
115
|
+
setOrder: (position: ComponentOrderPositions, component: HTMLElement) => this;
|
|
114
116
|
getDom: () => HTMLDivElement;
|
|
115
117
|
get snackbar(): {
|
|
116
118
|
open: (message: string, severity: TSeverity, key?: string, action?: ((key: string, snackbarRef: any) => ReactNode | void), autoHideDuration?: number | null) => void;
|
|
@@ -124,6 +126,10 @@ declare class DialogBase extends Component<BaseDialogProps, BaseDialogState> {
|
|
|
124
126
|
close: (key?: string) => void;
|
|
125
127
|
};
|
|
126
128
|
getSize: () => IDialogSize;
|
|
129
|
+
/**
|
|
130
|
+
* @deprecated
|
|
131
|
+
* use outside Content component
|
|
132
|
+
* */
|
|
127
133
|
private baseZoomEffect;
|
|
128
134
|
private withBackdrop;
|
|
129
135
|
switchFullScreen: () => void;
|
package/components/DialogBase.js
CHANGED
|
@@ -65,6 +65,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
65
65
|
exports.DialogHeaderFooterContext = void 0;
|
|
66
66
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
67
67
|
var react_1 = require("react");
|
|
68
|
+
// import {JSX} from "react";
|
|
69
|
+
// import {FormikProps} from "../types/FormikProps";
|
|
70
|
+
var formik_1 = require("formik");
|
|
68
71
|
var React = __importStar(require("react"));
|
|
69
72
|
var react_draggable_1 = __importDefault(require("react-draggable"));
|
|
70
73
|
var notistack_1 = require("notistack");
|
|
@@ -106,6 +109,7 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
106
109
|
if (props === void 0) { props = {}; }
|
|
107
110
|
var _a, _b;
|
|
108
111
|
var _this = _super.call(this, props) || this; // This ensures that props is treated as readonly
|
|
112
|
+
/**@deprecated use outside Content component*/
|
|
109
113
|
_this._dialogTranslate = { lastX: 0, lastY: 0 };
|
|
110
114
|
_this._shInterval = 300;
|
|
111
115
|
_this._inProcess = { inProcess: false };
|
|
@@ -311,8 +315,11 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
311
315
|
_this.getSize = function () {
|
|
312
316
|
return _this._dialogSize;
|
|
313
317
|
};
|
|
318
|
+
/**
|
|
319
|
+
* @deprecated
|
|
320
|
+
* use outside Content component
|
|
321
|
+
* */
|
|
314
322
|
_this.baseZoomEffect = function () {
|
|
315
|
-
console.log('this._dialogTranslate', _this._dialogTranslate);
|
|
316
323
|
var _a = _this._dialogTranslate, lastX = _a.lastX, lastY = _a.lastY;
|
|
317
324
|
_this._dialogRef.current.animate([
|
|
318
325
|
// key frames
|
|
@@ -342,7 +349,7 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
342
349
|
return;
|
|
343
350
|
}
|
|
344
351
|
_this.baseZoomEffect();
|
|
345
|
-
}, children: _this.Content
|
|
352
|
+
}, children: (0, jsx_runtime_1.jsx)(_this.Content, { body: body, header: header, actions: actions }) });
|
|
346
353
|
};
|
|
347
354
|
_this.switchFullScreen = function () {
|
|
348
355
|
if (!_this.state.fullscreenMode) {
|
|
@@ -402,7 +409,8 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
402
409
|
}
|
|
403
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 });
|
|
404
411
|
};
|
|
405
|
-
_this.Body = function (
|
|
412
|
+
_this.Body = function (_a) {
|
|
413
|
+
var body = _a.body;
|
|
406
414
|
if (body instanceof Function) {
|
|
407
415
|
return (0, jsx_runtime_1.jsxs)("div", { ref: _this._dialogBodyRef, className: 'dialog-body', style: { height: '100%' }, children: [_this.Placeholder(_this._holder), body(_this)] });
|
|
408
416
|
}
|
|
@@ -524,9 +532,16 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
524
532
|
style: action.options.style, baseStyle: _this._dialogOptions.base.actions.baseStyle, fontFamily: _this._fontFamily, stateListener: action._stateListener }, index.toString());
|
|
525
533
|
}) });
|
|
526
534
|
};
|
|
527
|
-
_this.Content = function (
|
|
528
|
-
var
|
|
529
|
-
var
|
|
535
|
+
_this.Content = function (_a) {
|
|
536
|
+
var _b;
|
|
537
|
+
var _c, _d;
|
|
538
|
+
var body = _a.body, header = _a.header, actions = _a.actions;
|
|
539
|
+
_this._formikProps = (0, formik_1.useFormik)({
|
|
540
|
+
initialValues: _this._initialValues,
|
|
541
|
+
onSubmit: function (values, formikHelpers) {
|
|
542
|
+
// No Necessary
|
|
543
|
+
}
|
|
544
|
+
});
|
|
530
545
|
if (_this._dialogRef.current) {
|
|
531
546
|
// Öncelikle ref'i al ve input elemanlarını bul
|
|
532
547
|
var inputElements = _this._dialogRef.current.querySelectorAll("input");
|
|
@@ -573,10 +588,10 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
573
588
|
}
|
|
574
589
|
},
|
|
575
590
|
// className={this._dialogSize.width === 'auto' ? 'auto' : `dialog-width-${this._dialogSize.width} dialog-main show-opacity show-position-${this._dialogOptions.base.initialAnchor.vertical}`}
|
|
576
|
-
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: (
|
|
591
|
+
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._footeRef, actions: actions })] }), (_this._dialogOptions.base.resizeable) &&
|
|
577
592
|
(0, jsx_runtime_1.jsx)(React.Fragment, { children: (0, jsx_runtime_1.jsx)("div", { className: "resizable-handle", style: {
|
|
578
593
|
zIndex: parseInt(domZIndex) + 1
|
|
579
|
-
}, onMouseDown: (
|
|
594
|
+
}, onMouseDown: (_d = _this._Resizeable) === null || _d === void 0 ? void 0 : _d.resizeHandleMouseDown, children: (0, jsx_runtime_1.jsx)(ResizeIcon_1.default, { color: '#286e94' }) }) })] }) });
|
|
580
595
|
};
|
|
581
596
|
_this.highestZ = function () {
|
|
582
597
|
var presentationElements = document.querySelectorAll('div[data-family="presentation"]');
|
|
@@ -717,27 +732,40 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
717
732
|
configurable: true
|
|
718
733
|
});
|
|
719
734
|
Object.defineProperty(DialogBase.prototype, "values", {
|
|
735
|
+
// get values(): DialogValues {
|
|
720
736
|
get: function () {
|
|
721
|
-
|
|
737
|
+
var _a;
|
|
738
|
+
// return this.state.values;
|
|
739
|
+
return (_a = this._formikProps) === null || _a === void 0 ? void 0 : _a.values;
|
|
722
740
|
},
|
|
723
741
|
enumerable: false,
|
|
724
742
|
configurable: true
|
|
725
743
|
});
|
|
726
744
|
DialogBase.prototype.setValues = function (values, callbackFn) {
|
|
727
|
-
var
|
|
728
|
-
//
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
745
|
+
var _a;
|
|
746
|
+
// const prevValues = {...this.state.values};
|
|
747
|
+
//
|
|
748
|
+
//
|
|
749
|
+
// // this.setState( prevState => ({...prevState, values: {...prevValues, ...values}}) );
|
|
750
|
+
// this.setState((prevState) => ({
|
|
751
|
+
// ...prevState,
|
|
752
|
+
// values: {...prevValues, ...values}
|
|
753
|
+
// }), () => {
|
|
754
|
+
// if( typeof callbackFn === 'function' ){
|
|
755
|
+
// callbackFn();
|
|
756
|
+
// }
|
|
757
|
+
// });
|
|
758
|
+
(_a = this._formikProps) === null || _a === void 0 ? void 0 : _a.setValues(values);
|
|
734
759
|
};
|
|
735
|
-
DialogBase.prototype.setValue = function (key,
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
760
|
+
DialogBase.prototype.setValue = function (key, value) {
|
|
761
|
+
var _a;
|
|
762
|
+
// this.setState( prevState => {
|
|
763
|
+
//
|
|
764
|
+
// const clonedVal = {...prevState.values};
|
|
765
|
+
// clonedVal[key] = values;
|
|
766
|
+
// return {...prevState, values: clonedVal}
|
|
767
|
+
// });
|
|
768
|
+
(_a = this._formikProps) === null || _a === void 0 ? void 0 : _a.setFieldValue(key, value);
|
|
741
769
|
};
|
|
742
770
|
DialogBase.prototype.componentDidMount = function () {
|
|
743
771
|
var _this = this;
|
|
@@ -994,16 +1022,16 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
994
1022
|
this._dom.setAttribute('data-family', 'presentation');
|
|
995
1023
|
this._dom.classList.add('appinsource-dialog-root');
|
|
996
1024
|
this._dom.style.setProperty('z-index', String(this.highestZ()));
|
|
997
|
-
//
|
|
998
|
-
|
|
999
|
-
//
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1025
|
+
// Find root element
|
|
1026
|
+
var rootElement = document.getElementById('root');
|
|
1027
|
+
// const AppElement = rootElement.firstElementChild;
|
|
1028
|
+
if (rootElement) {
|
|
1029
|
+
rootElement.appendChild(this._dom);
|
|
1030
|
+
// AppElement.prepend(this._dom);
|
|
1031
|
+
}
|
|
1032
|
+
else {
|
|
1033
|
+
document.body.appendChild(this._dom);
|
|
1034
|
+
}
|
|
1007
1035
|
var root = (0, client_1.createRoot)(this._dom);
|
|
1008
1036
|
var props = {
|
|
1009
1037
|
ref: this._innerRef,
|
|
File without changes
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// import Draggable from "react-draggable";
|
|
2
|
+
// import {setDialogBounds} from "../helpers";
|
|
3
|
+
// import * as React from "react";
|
|
4
|
+
// import ResizeIcon from "./icons/ResizeIcon";
|
|
5
|
+
// import {IBaseDialogOptions, TDialogCallbackNodeFn} from "../types/DialogTypes";
|
|
6
|
+
// import {Dialog} from "../index";
|
|
7
|
+
// import {BaseDialogDOMRect} from "../types/types";
|
|
8
|
+
//
|
|
9
|
+
// interface IBodyProps {
|
|
10
|
+
// body: TDialogCallbackNodeFn;
|
|
11
|
+
// header: TDialogCallbackNodeFn;
|
|
12
|
+
// actions: any;
|
|
13
|
+
// dialogRef: React.RefObject<Dialog>;
|
|
14
|
+
// backdropRef: React.RefObject<any>; // 👈 Type ???
|
|
15
|
+
// baseOptions: IBaseDialogOptions;
|
|
16
|
+
// dom: HTMLDivElement;
|
|
17
|
+
// }
|
|
18
|
+
//
|
|
19
|
+
// const dialogAutoPos = (): BaseDialogDOMRect => {
|
|
20
|
+
// const nodes = Array.from(document.querySelectorAll('.appinsource-dialog-root'));
|
|
21
|
+
// if(nodes.length > 1 ) {
|
|
22
|
+
// const lastDialog = nodes[nodes.length - 2];
|
|
23
|
+
// const dialogMain = lastDialog.querySelector('#dialog-main')
|
|
24
|
+
// return {
|
|
25
|
+
// top: dialogMain?.getBoundingClientRect().top + 10,
|
|
26
|
+
// left: dialogMain?.getBoundingClientRect().left + 10,
|
|
27
|
+
// isMultiple: true
|
|
28
|
+
// }
|
|
29
|
+
// }
|
|
30
|
+
// return {top: 0 ,left: 0, isMultiple: false}
|
|
31
|
+
// }
|
|
32
|
+
//
|
|
33
|
+
// const baseZoomEffect = (dialogRef: React.RefObject<Dialog>, lastX: number, lastY: number) => {
|
|
34
|
+
//
|
|
35
|
+
// // const {lastX, lastY} = this._dialogTranslate;
|
|
36
|
+
// dialogRef.current.animate([
|
|
37
|
+
// // key frames
|
|
38
|
+
// { transform: `translate(${lastX}px, ${lastY}px) scale(1)` },
|
|
39
|
+
// { transform: `translate(${lastX}px, ${lastY}px) scale(1.01)`},
|
|
40
|
+
// // { boxShadow: `0 0 20px red`},
|
|
41
|
+
// { transform: `translate(${lastX}px, ${lastY}px) scale(1)` }
|
|
42
|
+
// ], {
|
|
43
|
+
// // sync options
|
|
44
|
+
// duration: 300,
|
|
45
|
+
// iterations: 1
|
|
46
|
+
// });
|
|
47
|
+
// }
|
|
48
|
+
//
|
|
49
|
+
// const DialogContent: React.FC<IBodyProps> = ({
|
|
50
|
+
// body,
|
|
51
|
+
// header,
|
|
52
|
+
// actions,
|
|
53
|
+
// dialogRef,
|
|
54
|
+
// baseOptions,
|
|
55
|
+
// dom,
|
|
56
|
+
// backdropRef
|
|
57
|
+
//
|
|
58
|
+
// }) => {
|
|
59
|
+
//
|
|
60
|
+
// const position: BaseDialogDOMRect = dialogAutoPos();
|
|
61
|
+
//
|
|
62
|
+
// const [fullscreenMode, setFullscreenMode] = React.useState<booleab>(false);
|
|
63
|
+
// const [dialogTranslate, setDialogTranslate] = React.useState<{lastX: number, lastY: number}>({lastX: 0, lastY: 0});
|
|
64
|
+
//
|
|
65
|
+
//
|
|
66
|
+
// if(dialogRef.current){
|
|
67
|
+
// // Öncelikle ref'i al ve input elemanlarını bul
|
|
68
|
+
// const inputElements = dialogRef.current.querySelectorAll("input");
|
|
69
|
+
// // Tüm input elemanlarını döngüye al
|
|
70
|
+
// inputElements.forEach((input) => {
|
|
71
|
+
// console.log(input); // Her bir input elemanını burada işleyebilirsiniz
|
|
72
|
+
// // Örneğin, input değerini okuma veya ayarlama
|
|
73
|
+
// input.addEventListener('keydown', (e: KeyboardEvent) => e.key === "Enter" && e.preventDefault()); // Değerini boşaltmak için örnek
|
|
74
|
+
// input.addEventListener('keyup', (e: KeyboardEvent) => e.key === "Enter" && e.preventDefault()); // Değerini boşaltmak için örnek
|
|
75
|
+
// input.addEventListener('keypress', (e: KeyboardEvent) => e.key === "Enter" && e.preventDefault()); // Değerini boşaltmak için örnek
|
|
76
|
+
// });
|
|
77
|
+
// }
|
|
78
|
+
//
|
|
79
|
+
//
|
|
80
|
+
// console.log('Content:', actions);
|
|
81
|
+
//
|
|
82
|
+
// const xKey = position.isMultiple ? "left":"marginLeft"
|
|
83
|
+
// const yKey = position.isMultiple ? "top":"marginTop"
|
|
84
|
+
//
|
|
85
|
+
// /**
|
|
86
|
+
// * default null
|
|
87
|
+
// * eget momoize islemi uygulanmissa read from memory
|
|
88
|
+
// * */
|
|
89
|
+
// const bounds = baseOptions.memoBounds;
|
|
90
|
+
//
|
|
91
|
+
// // console.log('MAIN DOM', window.getComputedStyle(this.props.dom).zIndex);
|
|
92
|
+
// const domZIndex = window.getComputedStyle(dom).zIndex;
|
|
93
|
+
//
|
|
94
|
+
//
|
|
95
|
+
// // Burda kaldik
|
|
96
|
+
//
|
|
97
|
+
// return <Draggable
|
|
98
|
+
// disabled={!baseOptions.draggable || fullscreenMode}
|
|
99
|
+
// axis={'both'}
|
|
100
|
+
// handle={baseOptions.draggable ? '.drag-handle' : ''}
|
|
101
|
+
// scale={1}
|
|
102
|
+
// ref={backdropRef}
|
|
103
|
+
// onDrag={(event, data) => {
|
|
104
|
+
// event.stopPropagation();
|
|
105
|
+
// setDialogTranslate({lastX: data.lastX, lastY: data.lastY})
|
|
106
|
+
// }}
|
|
107
|
+
// onStop={(event, data) => {
|
|
108
|
+
// event.stopPropagation();
|
|
109
|
+
// event.preventDefault();
|
|
110
|
+
//
|
|
111
|
+
// console.log('onDragStop', 'fired');
|
|
112
|
+
//
|
|
113
|
+
// const {width, height, x, y} = this._dialogRef.current?.getBoundingClientRect()
|
|
114
|
+
// setDialogBounds(
|
|
115
|
+
// this._dialogOptions.base.id,
|
|
116
|
+
// {
|
|
117
|
+
// width, height, x, y
|
|
118
|
+
// },
|
|
119
|
+
// this._dialogRef
|
|
120
|
+
// );
|
|
121
|
+
// }}
|
|
122
|
+
// >
|
|
123
|
+
// <div
|
|
124
|
+
// id={"dialog-main"}
|
|
125
|
+
// ref={this._dialogRef}
|
|
126
|
+
// onClick={e => {
|
|
127
|
+
// e.stopPropagation()
|
|
128
|
+
// }}
|
|
129
|
+
// onKeyDown={e => {
|
|
130
|
+
//
|
|
131
|
+
// if (typeof this.props.keyboardListener === "function") {
|
|
132
|
+
// // @ts-ignore
|
|
133
|
+
// this.props.keyboardListener(e.key, this);
|
|
134
|
+
// }
|
|
135
|
+
// }}
|
|
136
|
+
// // className={this._dialogSize.width === 'auto' ? 'auto' : `dialog-width-${this._dialogSize.width} dialog-main show-opacity show-position-${this._dialogOptions.base.initialAnchor.vertical}`}
|
|
137
|
+
// className={this._dialogOptions.base.size.width === 'auto' ? 'auto' : `dialog-width-${this._dialogOptions.base.size.width} dialog-main show-opacity show-position-${this._dialogOptions.base.initialAnchor.vertical}`}
|
|
138
|
+
// style={{
|
|
139
|
+
//
|
|
140
|
+
// alignSelf: this._dialogOptions.base.initialAnchor.vertical,
|
|
141
|
+
// height: this._dialogOptions.base.size.height ?? 'auto',
|
|
142
|
+
// ...typeof this._dialogOptions.base.size.width === "number" ? {width: this._dialogOptions.base.size.width} : null,
|
|
143
|
+
// outline: 'none',
|
|
144
|
+
// [yKey]: this.dialogPosFromMultipleDialogs.top + 'px',
|
|
145
|
+
// [xKey]: this.dialogPosFromMultipleDialogs.left + 'px',
|
|
146
|
+
// //...this._Resizeable ? {width: this._Resizeable.width } : null,
|
|
147
|
+
// // ...this._Resizeable ? {height: this._Resizeable.height } : null,
|
|
148
|
+
// ...this._dialogOptions.base.style,
|
|
149
|
+
// fontFamily: this._fontFamily,
|
|
150
|
+
//
|
|
151
|
+
// // overwrite
|
|
152
|
+
// ...bounds ? {position: 'absolute', top: bounds.y, left: bounds.x, width: bounds.width, height: bounds.height} : null
|
|
153
|
+
//
|
|
154
|
+
// }}
|
|
155
|
+
// >
|
|
156
|
+
// <WithSnackbar snackbarRef={this._snackbarRef} maxSnack={this._dialogOptions.snackbar.maxSnack} >
|
|
157
|
+
// { (this._header || this._dialogOptions.slot.header) && this.Header(header)}
|
|
158
|
+
// {this.Body(body)}
|
|
159
|
+
// {/*{this.Footer(actions)}*/}
|
|
160
|
+
// <this.Footer ref={this._footeRef} actions={actions} />
|
|
161
|
+
// </WithSnackbar>
|
|
162
|
+
//
|
|
163
|
+
// {
|
|
164
|
+
// (this._dialogOptions.base.resizeable) &&
|
|
165
|
+
// <React.Fragment>
|
|
166
|
+
// <div className="resizable-handle" style={{
|
|
167
|
+
// zIndex: parseInt(domZIndex) + 1
|
|
168
|
+
// }}
|
|
169
|
+
// onMouseDown={this._Resizeable?.resizeHandleMouseDown}
|
|
170
|
+
// >
|
|
171
|
+
// <ResizeIcon color={'#286e94'} />
|
|
172
|
+
// </div>
|
|
173
|
+
//
|
|
174
|
+
// </React.Fragment>
|
|
175
|
+
// }
|
|
176
|
+
//
|
|
177
|
+
// </div>
|
|
178
|
+
//
|
|
179
|
+
//
|
|
180
|
+
// </Draggable>
|
|
181
|
+
// }
|
package/models/Dialog.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import DialogBase from "../components/DialogBase";
|
|
|
4
4
|
import { TInitialHolder, TAccessFrom, ComponentOrderPositions, ISnackbarAnchor, DialogValues } from "../types/types";
|
|
5
5
|
import { IDialogSize, TDialogStateListenerCallbackType, DialogOptionsType, IDialogDef, TDialogCallbackNodeFn, TDialogCallbackVoidFn } from "../types/DialogTypes";
|
|
6
6
|
import { FormikProps } from "formik";
|
|
7
|
-
declare class Dialog extends DialogBase {
|
|
7
|
+
declare class Dialog extends DialogBase<any> {
|
|
8
8
|
constructor(dialogRef?: React.RefObject<IDialogDef | undefined | null> | null, options?: DialogOptionsType);
|
|
9
9
|
/**
|
|
10
10
|
* @deprecated
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-dialogger",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.38",
|
|
4
4
|
"description": "This package is a continuation of the react-araci package. Due to an error, react-araci was removed, and it has been decided to continue under the new package name react-dialogger",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Sueleyman Topaloglu",
|
package/types/DialogTypes.d.ts
CHANGED
|
@@ -34,8 +34,8 @@ export interface BaseDialogProps {
|
|
|
34
34
|
parent?: Dialog;
|
|
35
35
|
onClose?: TDialogCallbackVoidFn;
|
|
36
36
|
root?: any;
|
|
37
|
-
keyboardListener: (key: string, dialog:
|
|
38
|
-
resizeListener?: (size: IDialogSize, dialog:
|
|
37
|
+
keyboardListener: (key: string, dialog: IDialogDef) => void;
|
|
38
|
+
resizeListener?: (size: IDialogSize, dialog: IDialogDef) => void;
|
|
39
39
|
}
|
|
40
40
|
export interface IDialogSize {
|
|
41
41
|
width?: ITypeWidth | number;
|
|
@@ -123,12 +123,12 @@ export type TDialogStateListenerCallbackType = (state: IStateDef, values: Dialog
|
|
|
123
123
|
type TDialogCallbackFn<T> = (dialog?: IDialogDef) => T;
|
|
124
124
|
export type TDialogCallbackNodeFn = TDialogCallbackFn<string | React.ReactElement<any>> | React.ReactNode | React.JSX.Element;
|
|
125
125
|
export type TDialogCallbackVoidFn = TDialogCallbackFn<void>;
|
|
126
|
-
export interface IDialogDef extends Omit<Partial<Pick<DialogBase
|
|
126
|
+
export interface IDialogDef extends Omit<Partial<Pick<DialogBase<any>, 'isInProcess' | 'setInProcess' | 'values' | 'setValue' | 'setValues' | 'close' | 'dialogOptions' | 'switchFullScreen' | 'actions' | 'snackbar' | 'formikValidate' | 'formikProps' | 'focus' | 'setOrder' | 'setBody' | 'onResize' | 'processingListener'>>, 'switchFullScreen'> {
|
|
127
127
|
/** @deprecated Deprecated, use setValues instead. */
|
|
128
|
-
switchFullScreen?: DialogBase['switchFullScreen'];
|
|
128
|
+
switchFullScreen?: DialogBase<any>['switchFullScreen'];
|
|
129
129
|
/** @deprecated Deprecated, never use. */
|
|
130
|
-
setOrder?: DialogBase['setOrder'];
|
|
130
|
+
setOrder?: DialogBase<any>['setOrder'];
|
|
131
131
|
}
|
|
132
|
-
export interface IDialogCloseRef extends Pick<DialogBase
|
|
132
|
+
export interface IDialogCloseRef extends Pick<DialogBase<any>, 'close'> {
|
|
133
133
|
}
|
|
134
134
|
export {};
|