react-dialogger 1.1.47 → 1.1.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +103 -767
- package/components/DialogContent.d.ts +1 -18
- package/components/DialogContent.js +69 -62
- package/components/DialogContentBody.d.ts +3 -2
- package/components/DialogContentBody.js +36 -5
- package/components/DialogContentFooter.d.ts +4 -0
- package/components/{DialogContenFooter.js → DialogContentFooter.js} +6 -33
- package/components/DialogContentHeader.d.ts +6 -2
- package/components/DialogContentHeader.js +73 -19
- 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 +29 -36
- package/models/Dialog.js +108 -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 +82 -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
|
@@ -39,18 +39,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.DialogInfoAction = void 0;
|
|
40
40
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
41
|
var react_1 = require("react");
|
|
42
|
-
var DialogBase_1 = require("../DialogBase");
|
|
43
42
|
var InfoIcon_1 = __importDefault(require("../icons/InfoIcon"));
|
|
44
43
|
//@ts-ignore
|
|
45
44
|
var package_json_1 = __importDefault(require("../../package.json"));
|
|
46
|
-
var
|
|
45
|
+
var context_1 = require("../../context");
|
|
46
|
+
var models_1 = __importStar(require("../../models"));
|
|
47
47
|
// const DialogFullscreenAction = ({dialog}:{dialog: React.RefObject<IDialogRef> | undefined}) => {
|
|
48
48
|
var DialogInfoAction = function () {
|
|
49
49
|
var _a, _b, _c, _d;
|
|
50
|
-
var
|
|
51
|
-
var _dialog = dialogHeaderContext.dialog;
|
|
50
|
+
var prevDialog = (0, react_1.useContext)(context_1.DialogHeaderFooterContext).dialog;
|
|
52
51
|
return (0, jsx_runtime_1.jsx)("div", { className: 'info-icon-wrapper', onClick: function (event) {
|
|
53
|
-
var closeAction = new
|
|
52
|
+
var closeAction = new models_1.DialogAction('closeAction', {
|
|
54
53
|
label: 'Close',
|
|
55
54
|
variant: 'text',
|
|
56
55
|
color: 'default'
|
|
@@ -58,16 +57,15 @@ var DialogInfoAction = function () {
|
|
|
58
57
|
closeAction.onClick(function (button, dialog1) {
|
|
59
58
|
dialog1.close();
|
|
60
59
|
});
|
|
61
|
-
var dialog = new
|
|
60
|
+
var dialog = new models_1.default(null, {
|
|
62
61
|
base: {
|
|
63
62
|
resizeable: false,
|
|
64
63
|
draggable: false,
|
|
65
64
|
closeable: true,
|
|
66
65
|
size: {
|
|
67
|
-
width: 'xs'
|
|
68
|
-
height: 'initial'
|
|
66
|
+
width: 'xs'
|
|
69
67
|
},
|
|
70
|
-
initialAnchor:
|
|
68
|
+
initialAnchor: prevDialog.dialogOptions.base.initialAnchor,
|
|
71
69
|
footer: {
|
|
72
70
|
style: {
|
|
73
71
|
borderTop: 'none'
|
|
@@ -86,8 +84,7 @@ var DialogInfoAction = function () {
|
|
|
86
84
|
.addActions([
|
|
87
85
|
closeAction
|
|
88
86
|
])
|
|
89
|
-
.initialState({})
|
|
90
87
|
.show();
|
|
91
|
-
}, children: (0, jsx_runtime_1.jsx)(InfoIcon_1.default, { size: (_b = (_a =
|
|
88
|
+
}, children: (0, jsx_runtime_1.jsx)(InfoIcon_1.default, { size: (_b = (_a = prevDialog.dialogOptions.base.headerControllerIcons) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 24, color: (_d = (_c = prevDialog.dialogOptions.base.headerControllerIcons) === null || _c === void 0 ? void 0 : _c.color) !== null && _d !== void 0 ? _d : null }) });
|
|
92
89
|
};
|
|
93
90
|
exports.DialogInfoAction = DialogInfoAction;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DialogProcessing = void 0;
|
|
4
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
var react_1 = require("react");
|
|
6
|
+
var context_1 = require("../../context");
|
|
7
|
+
var index_1 = require("../index");
|
|
8
|
+
var DialogProcessing = function () {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
var dialog = (0, react_1.useContext)(context_1.DialogHeaderFooterContext).dialog;
|
|
11
|
+
var progressOption = dialog.dialogOptions.progress;
|
|
12
|
+
return (0, jsx_runtime_1.jsx)(index_1.CircularProgress, { size: (_a = progressOption.size) !== null && _a !== void 0 ? _a : 20, inProcess: dialog.isInProcess(), color: (_b = progressOption === null || progressOption === void 0 ? void 0 : progressOption.color) !== null && _b !== void 0 ? _b : '#399aec' });
|
|
13
|
+
};
|
|
14
|
+
exports.DialogProcessing = DialogProcessing;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { CSSProperties,
|
|
2
|
+
import { CSSProperties, ReactNode } from "react";
|
|
3
3
|
import { TBVariant, TBColor } from '../types/DialogActionTypes';
|
|
4
4
|
declare const _default: React.ForwardRefExoticComponent<{
|
|
5
5
|
variant: TBVariant;
|
|
6
6
|
color: TBColor;
|
|
7
|
-
children: (buttonRef: HTMLButtonElement) => string |
|
|
7
|
+
children: (buttonRef: HTMLButtonElement) => string | ReactNode;
|
|
8
8
|
disabled: boolean;
|
|
9
9
|
onClick: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
10
10
|
innerRef: React.RefObject<any>;
|
|
@@ -77,9 +77,7 @@ exports.default = React.forwardRef(function (_a, ref) {
|
|
|
77
77
|
rippleEffect: rippleEffect
|
|
78
78
|
}); });
|
|
79
79
|
console.log('Ripple_button_style', style);
|
|
80
|
-
return ((0, jsx_runtime_1.jsxs)("button", {
|
|
81
|
-
// ref={buttonRef}
|
|
82
|
-
ref: ref, disabled: disabled, className: "ripple-button ripple-button-".concat(variant, " ripple-button-").concat(color, " ").concat(disabled ? 'ripple-button-disabled' : ''), onClick: function (e) {
|
|
80
|
+
return ((0, jsx_runtime_1.jsxs)("button", { ref: ref, disabled: disabled, className: "ripple-button ripple-button-".concat(variant, " ripple-button-").concat(color, " ").concat(disabled ? 'ripple-button-disabled' : ''), onClick: function (e) {
|
|
83
81
|
//@ts-ignore
|
|
84
82
|
var rect = e.target.getBoundingClientRect();
|
|
85
83
|
setCoords({ x: e.clientX - rect.left, y: e.clientY - rect.top });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as CircularProgress } from "./CircularProgress";
|
|
2
|
+
export { DialogContentFooter } from "./DialogContentFooter";
|
|
3
|
+
export { DialogContentBody } from "./DialogContentBody";
|
|
4
|
+
export { DialogContent } from "./DialogContent";
|
|
5
|
+
export { default as DialogActionBase } from "./DialogActionBase";
|
|
6
|
+
export { DialogContentHeader } from "./DialogContentHeader";
|
|
7
|
+
export { DialogWithBackdropWrapper } from "./DialogWithBackdropWrapper";
|
|
8
|
+
export { Actions } from "./Actions";
|
|
9
|
+
export { default as RippleButton } from "./RippleButton";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RippleButton = exports.Actions = exports.DialogWithBackdropWrapper = exports.DialogContentHeader = exports.DialogActionBase = exports.DialogContent = exports.DialogContentBody = exports.DialogContentFooter = exports.CircularProgress = void 0;
|
|
7
|
+
var CircularProgress_1 = require("./CircularProgress");
|
|
8
|
+
Object.defineProperty(exports, "CircularProgress", { enumerable: true, get: function () { return __importDefault(CircularProgress_1).default; } });
|
|
9
|
+
var DialogContentFooter_1 = require("./DialogContentFooter");
|
|
10
|
+
Object.defineProperty(exports, "DialogContentFooter", { enumerable: true, get: function () { return DialogContentFooter_1.DialogContentFooter; } });
|
|
11
|
+
var DialogContentBody_1 = require("./DialogContentBody");
|
|
12
|
+
Object.defineProperty(exports, "DialogContentBody", { enumerable: true, get: function () { return DialogContentBody_1.DialogContentBody; } });
|
|
13
|
+
var DialogContent_1 = require("./DialogContent");
|
|
14
|
+
Object.defineProperty(exports, "DialogContent", { enumerable: true, get: function () { return DialogContent_1.DialogContent; } });
|
|
15
|
+
var DialogActionBase_1 = require("./DialogActionBase");
|
|
16
|
+
Object.defineProperty(exports, "DialogActionBase", { enumerable: true, get: function () { return __importDefault(DialogActionBase_1).default; } });
|
|
17
|
+
var DialogContentHeader_1 = require("./DialogContentHeader");
|
|
18
|
+
Object.defineProperty(exports, "DialogContentHeader", { enumerable: true, get: function () { return DialogContentHeader_1.DialogContentHeader; } });
|
|
19
|
+
var DialogWithBackdropWrapper_1 = require("./DialogWithBackdropWrapper");
|
|
20
|
+
Object.defineProperty(exports, "DialogWithBackdropWrapper", { enumerable: true, get: function () { return DialogWithBackdropWrapper_1.DialogWithBackdropWrapper; } });
|
|
21
|
+
var Actions_1 = require("./Actions");
|
|
22
|
+
Object.defineProperty(exports, "Actions", { enumerable: true, get: function () { return Actions_1.Actions; } });
|
|
23
|
+
var RippleButton_1 = require("./RippleButton");
|
|
24
|
+
Object.defineProperty(exports, "RippleButton", { enumerable: true, get: function () { return __importDefault(RippleButton_1).default; } });
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jumperAnimate = void 0;
|
|
4
|
+
var jumperAnimate = function (el) {
|
|
5
|
+
var animation = el.animate([
|
|
6
|
+
// key frames
|
|
7
|
+
// { transform: `translate(${20}px, ${20}px) scale(1)` },
|
|
8
|
+
// 1️⃣ Ortadan küçük başla
|
|
9
|
+
// { transform: 'translate(20px, 20px) scale(0.9)', boxShadow: '0 0 10px black' },
|
|
10
|
+
//
|
|
11
|
+
// // 2️⃣ Hafif büyü (kurulma)
|
|
12
|
+
// { transform: 'translate(20px, 20px) scale(1.05)', boxShadow: '0 0 50px black' },
|
|
13
|
+
//
|
|
14
|
+
// // 3️⃣ Orijinal boyuta dön
|
|
15
|
+
// { transform: 'translate(20px, 20px) scale(1)' ,boxShadow: '0 0 20px black'},
|
|
16
|
+
// { transform: 'translate(20px, 20px) scale(1.05)' ,boxShadow: '0 0 30px black'},
|
|
17
|
+
// { transform: 'translate(20px, 20px) scale(1)' ,boxShadow: '0 0 20px black'},
|
|
18
|
+
{ transform: 'scale(0.9)', boxShadow: '0 0 10px black' },
|
|
19
|
+
{ transform: 'scale(1.05)', boxShadow: '0 0 50px black' },
|
|
20
|
+
{ transform: 'scale(1)', boxShadow: '0 0 20px black' },
|
|
21
|
+
{ transform: 'scale(1.05)', boxShadow: '0 0 30px black' },
|
|
22
|
+
{ transform: 'scale(1)', boxShadow: '0 0 20px black' },
|
|
23
|
+
], {
|
|
24
|
+
// sync options
|
|
25
|
+
// duration: 250,
|
|
26
|
+
duration: 250,
|
|
27
|
+
iterations: 1,
|
|
28
|
+
fill: 'forwards'
|
|
29
|
+
});
|
|
30
|
+
animation.onfinish = function () {
|
|
31
|
+
// el.style.transform = 'none'; // stacking context kaldırılır
|
|
32
|
+
el.style.transform = 'scale(1)'; // stacking context kaldırılır
|
|
33
|
+
animation.cancel();
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
exports.jumperAnimate = jumperAnimate;
|
package/context/index.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
+
var ownKeys = function(o) {
|
|
31
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
+
var ar = [];
|
|
33
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
+
return ar;
|
|
35
|
+
};
|
|
36
|
+
return ownKeys(o);
|
|
37
|
+
};
|
|
38
|
+
return function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
exports.DialogHeaderFooterContext = exports.WithHeaderFooterContext = void 0;
|
|
48
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
49
|
+
var React = __importStar(require("react"));
|
|
50
|
+
var WithHeaderFooterContext = function (props) {
|
|
51
|
+
return (0, jsx_runtime_1.jsx)(exports.DialogHeaderFooterContext.Provider, { value: __assign({}, props), children: props.children });
|
|
52
|
+
};
|
|
53
|
+
exports.WithHeaderFooterContext = WithHeaderFooterContext;
|
|
54
|
+
exports.DialogHeaderFooterContext = React.createContext(null);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MouseEvent } from "react";
|
|
2
2
|
import { DialogOptionsType } from "../types/DialogTypes";
|
|
3
3
|
declare class Resizeable {
|
|
4
|
-
onResizeListener: (callbackFn: (width: number, height: number) => void) => void;
|
|
4
|
+
onResizeListener: (callbackFn: (width: number, height: number, rect?: DOMRect) => void) => void;
|
|
5
5
|
get width(): number;
|
|
6
6
|
get height(): number;
|
|
7
7
|
get isResizing(): boolean;
|
|
@@ -20,4 +20,4 @@ declare class Resizeable {
|
|
|
20
20
|
init: () => void;
|
|
21
21
|
cleanUp: () => void;
|
|
22
22
|
}
|
|
23
|
-
export
|
|
23
|
+
export { Resizeable };
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.Resizeable = void 0;
|
|
3
15
|
var helpers_1 = require("../helpers");
|
|
4
16
|
var Resizeable = /** @class */ (function () {
|
|
5
17
|
function Resizeable() {
|
|
@@ -12,16 +24,17 @@ var Resizeable = /** @class */ (function () {
|
|
|
12
24
|
_this._dialogOptions = options;
|
|
13
25
|
};
|
|
14
26
|
this.resizeHandleMouseUp = function () {
|
|
15
|
-
|
|
16
|
-
_this._container.current.classList.remove('no-select-on-resize');
|
|
27
|
+
var _a, _b, _c;
|
|
28
|
+
(_b = (_a = _this._container) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.classList.remove('no-select-on-resize');
|
|
17
29
|
_this.isResizing = false;
|
|
18
30
|
// Bounds case
|
|
19
31
|
var container = _this._container.current;
|
|
20
|
-
var
|
|
21
|
-
|
|
32
|
+
var _d = (_c = container === null || container === void 0 ? void 0 : container.getBoundingClientRect()) !== null && _c !== void 0 ? _c : {}, width = _d.width, height = _d.height, x = _d.x, y = _d.y;
|
|
33
|
+
console.log('resizeHandleMouseUp', container === null || container === void 0 ? void 0 : container.getBoundingClientRect().toJSON());
|
|
34
|
+
// setDialogBounds( this._dialogOptions.base.id, {width, height, x, y, fullscreen: false}, this._container );
|
|
35
|
+
(0, helpers_1.setDialogBounds)(_this._dialogOptions.base.id, __assign(__assign({}, container === null || container === void 0 ? void 0 : container.getBoundingClientRect().toJSON()), { fullscreen: false }), _this._container);
|
|
22
36
|
};
|
|
23
37
|
this.resizeHandleMouseDown = function () {
|
|
24
|
-
console.log('resizeHandleMouseDown', true);
|
|
25
38
|
_this.isResizing = true;
|
|
26
39
|
_this._container.current.classList.add('no-select-on-resize');
|
|
27
40
|
_this.init();
|
|
@@ -35,23 +48,22 @@ var Resizeable = /** @class */ (function () {
|
|
|
35
48
|
var container = _this._container.current;
|
|
36
49
|
var newWidth = e.clientX - (container === null || container === void 0 ? void 0 : container.getBoundingClientRect().left) + 10;
|
|
37
50
|
var newHeight = e.clientY - (container === null || container === void 0 ? void 0 : container.getBoundingClientRect().top) + 10;
|
|
38
|
-
_this._width = Math.max(newWidth, 100); //
|
|
39
|
-
_this._height = Math.max(newHeight, 100); //
|
|
51
|
+
_this._width = Math.max(newWidth, 100); // Min Width
|
|
52
|
+
_this._height = Math.max(newHeight, 100); // Min Height
|
|
53
|
+
var rect = __assign(__assign({}, container === null || container === void 0 ? void 0 : container.getBoundingClientRect().toJSON()), { width: _this._width, height: _this._height });
|
|
40
54
|
if (typeof _this._onResizeListener === "function") {
|
|
41
|
-
_this._onResizeListener(_this._width, _this._height);
|
|
55
|
+
_this._onResizeListener(_this._width, _this._height, rect);
|
|
42
56
|
}
|
|
43
57
|
_this._container.current.style.width = _this._width + 'px';
|
|
44
58
|
_this._container.current.style.height = _this._height + 'px';
|
|
45
59
|
};
|
|
46
60
|
this.init = function () {
|
|
47
61
|
if (_this.isResizing) {
|
|
48
|
-
// Fare olay dinleyicilerini ekliyoruz
|
|
49
62
|
// @ts-ignore
|
|
50
63
|
window.addEventListener('mousemove', _this.resizeHandleMouseMove);
|
|
51
64
|
window.addEventListener('mouseup', _this.resizeHandleMouseUp);
|
|
52
65
|
}
|
|
53
66
|
else {
|
|
54
|
-
// Fare olay dinleyicilerini kaldırıyoruz
|
|
55
67
|
// @ts-ignore
|
|
56
68
|
window.removeEventListener('mousemove', _this.resizeHandleMouseMove);
|
|
57
69
|
window.removeEventListener('mouseup', _this.resizeHandleMouseUp);
|
|
@@ -90,4 +102,4 @@ var Resizeable = /** @class */ (function () {
|
|
|
90
102
|
});
|
|
91
103
|
return Resizeable;
|
|
92
104
|
}());
|
|
93
|
-
exports.
|
|
105
|
+
exports.Resizeable = Resizeable;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IDialogBoundsDef } from "
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
1
|
+
import { IDialogBoundsDef, IDialogIdentificationType } from "../types/BoundTypes";
|
|
2
|
+
export declare const dialogRegister: (dialogId: IDialogIdentificationType, initialBounds: IDialogBoundsDef) => IDialogBoundsDef;
|
|
3
|
+
export declare const getDialogBounds: (dialogId: IDialogIdentificationType) => IDialogBoundsDef | undefined;
|
|
4
|
+
export declare const setDialogBounds: (dialogId: IDialogIdentificationType, bounds: IDialogBoundsDef, dialogRef: React.RefObject<any>) => void;
|
|
5
|
+
export declare const setDialogBound: (dialogId: IDialogIdentificationType, key: keyof IDialogBoundsDef, value: any) => void;
|
|
@@ -1,113 +1,99 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setDialogBounds = exports.getDialogBounds = exports.dialogRegister = void 0;
|
|
14
|
+
exports.setDialogBound = exports.setDialogBounds = exports.getDialogBounds = exports.dialogRegister = void 0;
|
|
4
15
|
// import {registeredDialogs} from "../hooks/initDialogMemoizeBounds";
|
|
5
16
|
var initDialogMemoizeBounds_1 = require("./initDialogMemoizeBounds");
|
|
6
|
-
// const BOUNDS_STORE_KEY: IDialogBoundsMemoKey = 'react-super-dialog';
|
|
7
|
-
// const boundStoreExists = () => {
|
|
8
|
-
// try{
|
|
9
|
-
// return !!window.localStorage.getItem(BOUNDS_STORE_KEY);
|
|
10
|
-
// } catch (e){
|
|
11
|
-
// return false;
|
|
12
|
-
// }
|
|
13
|
-
// }
|
|
14
|
-
// const createBoundStore = () => {
|
|
15
|
-
// if (!boundStoreExists()) {
|
|
16
|
-
// try{
|
|
17
|
-
// window.localStorage.setItem(BOUNDS_STORE_KEY, JSON.stringify([]));
|
|
18
|
-
// } catch (e){
|
|
19
|
-
// console.log(e);
|
|
20
|
-
// }
|
|
21
|
-
// }
|
|
22
|
-
// }
|
|
23
17
|
/**
|
|
24
|
-
*
|
|
18
|
+
* Read from RAM...
|
|
25
19
|
* */
|
|
26
|
-
var dialogInStore = function (
|
|
20
|
+
var dialogInStore = function (dialogId) {
|
|
27
21
|
var stores = initDialogMemoizeBounds_1.registeredDialogs;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return
|
|
22
|
+
var combined = ['guzzle', dialogId];
|
|
23
|
+
var isExists = stores.has(combined.join('-'));
|
|
24
|
+
if (isExists) {
|
|
25
|
+
return stores.get(combined.join('-'));
|
|
26
|
+
}
|
|
27
|
+
return undefined;
|
|
34
28
|
};
|
|
35
|
-
var dialogRegister = function (
|
|
36
|
-
|
|
37
|
-
if (dialogInStore(
|
|
29
|
+
var dialogRegister = function (dialogId, initialBounds) {
|
|
30
|
+
// If already registered ignore!
|
|
31
|
+
if (dialogInStore(dialogId))
|
|
38
32
|
return;
|
|
39
|
-
if (!
|
|
33
|
+
if (!dialogId) {
|
|
40
34
|
throw new Error('Dialog bounds can not be memoized. Dialog id is required.');
|
|
41
35
|
}
|
|
42
|
-
|
|
43
|
-
var
|
|
44
|
-
id:
|
|
36
|
+
var combined = ['guzzle', dialogId];
|
|
37
|
+
var newDialogBounds = {
|
|
38
|
+
id: combined.join('-'),
|
|
45
39
|
bounds: {
|
|
46
40
|
width: initialBounds.width,
|
|
47
41
|
height: initialBounds.height,
|
|
48
42
|
x: initialBounds.x,
|
|
49
|
-
y: initialBounds.y
|
|
43
|
+
y: initialBounds.y,
|
|
44
|
+
fullscreen: false
|
|
50
45
|
}
|
|
51
46
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
console.log('foundedDialog_2', initDialogMemoizeBounds_1.registeredDialogs);
|
|
58
|
-
// Register to Cookie
|
|
47
|
+
// To RAM
|
|
48
|
+
initDialogMemoizeBounds_1.registeredDialogs.set(combined.join('-'), newDialogBounds);
|
|
49
|
+
console.log('dialogRegister_combined', newDialogBounds, combined.join('-'), initDialogMemoizeBounds_1.registeredDialogs, Array.from(initDialogMemoizeBounds_1.registeredDialogs));
|
|
50
|
+
// To Store
|
|
59
51
|
try {
|
|
60
|
-
window.localStorage.setItem(initDialogMemoizeBounds_1.BOUNDS_STORE_KEY, JSON.stringify(initDialogMemoizeBounds_1.registeredDialogs));
|
|
52
|
+
window.localStorage.setItem(initDialogMemoizeBounds_1.BOUNDS_STORE_KEY, JSON.stringify(Array.from(initDialogMemoizeBounds_1.registeredDialogs)));
|
|
61
53
|
}
|
|
62
54
|
catch (e) {
|
|
63
55
|
console.log(e);
|
|
64
56
|
}
|
|
65
|
-
|
|
66
|
-
console.log('Dialog_Bounds, initialBounds-A', initialBounds);
|
|
67
|
-
var bounds = (0, exports.getDialogBounds)(options);
|
|
68
|
-
return bounds;
|
|
57
|
+
return (0, exports.getDialogBounds)(dialogId);
|
|
69
58
|
};
|
|
70
59
|
exports.dialogRegister = dialogRegister;
|
|
71
|
-
var getDialogBounds = function (
|
|
72
|
-
|
|
73
|
-
if (!options.id) {
|
|
60
|
+
var getDialogBounds = function (dialogId) {
|
|
61
|
+
if (!dialogId) {
|
|
74
62
|
throw new Error('Dialog bounds can not be memoized. Dialog id is required.');
|
|
75
63
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
var boundsRaw = window.localStorage.getItem(initDialogMemoizeBounds_1.BOUNDS_STORE_KEY);
|
|
79
|
-
var boundsArray = boundsRaw ? JSON.parse(boundsRaw) : [];
|
|
80
|
-
var founded = boundsArray.find(function (b) { return b.id === options.id; });
|
|
81
|
-
if (founded) {
|
|
82
|
-
return {
|
|
83
|
-
width: founded.bounds.width,
|
|
84
|
-
height: founded.bounds.height,
|
|
85
|
-
x: founded.bounds.x,
|
|
86
|
-
y: founded.bounds.y
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
}
|
|
64
|
+
var dialog = dialogInStore(dialogId);
|
|
65
|
+
console.log('getDialogBounds_dialog', initDialogMemoizeBounds_1.registeredDialogs, dialog);
|
|
90
66
|
if (dialog) {
|
|
91
|
-
return
|
|
92
|
-
width: dialog.bounds.width,
|
|
93
|
-
height: dialog.bounds.height,
|
|
94
|
-
x: dialog.bounds.x,
|
|
95
|
-
y: dialog.bounds.y
|
|
96
|
-
};
|
|
67
|
+
return dialog.bounds;
|
|
97
68
|
}
|
|
98
69
|
return undefined;
|
|
99
70
|
};
|
|
100
71
|
exports.getDialogBounds = getDialogBounds;
|
|
101
72
|
var setDialogBounds = function (dialogId, bounds, dialogRef) {
|
|
102
|
-
var
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
73
|
+
var combined = ['guzzle', dialogId];
|
|
74
|
+
var foundedDialog = initDialogMemoizeBounds_1.registeredDialogs.get(combined.join('-'));
|
|
75
|
+
console.log('setDialogBounds_combined', combined, combined.join('-'), bounds, foundedDialog);
|
|
76
|
+
if (foundedDialog) {
|
|
77
|
+
// Save to RAM
|
|
78
|
+
initDialogMemoizeBounds_1.registeredDialogs.set(combined.join('-'), {
|
|
79
|
+
id: combined.join('-'),
|
|
80
|
+
bounds: bounds
|
|
81
|
+
});
|
|
82
|
+
/**
|
|
83
|
+
* const myMap = new Map();
|
|
84
|
+
* myMap.set("a", 1);
|
|
85
|
+
* myMap.set("b", 2);
|
|
86
|
+
*
|
|
87
|
+
* const iterator = myMap.entries();
|
|
88
|
+
* console.log(iterator.next()); // { value: ["a", 1], done: false }
|
|
89
|
+
* console.log(iterator.next()); // { value: ["b", 2], done: false }
|
|
90
|
+
* console.log(iterator.next()); // { value: undefined, done: true }
|
|
91
|
+
*
|
|
92
|
+
* */
|
|
93
|
+
// Save to Store
|
|
94
|
+
console.log('registeredDialogs', initDialogMemoizeBounds_1.registeredDialogs);
|
|
109
95
|
try {
|
|
110
|
-
window.localStorage.setItem(initDialogMemoizeBounds_1.BOUNDS_STORE_KEY, JSON.stringify(initDialogMemoizeBounds_1.registeredDialogs));
|
|
96
|
+
window.localStorage.setItem(initDialogMemoizeBounds_1.BOUNDS_STORE_KEY, JSON.stringify(Array.from(initDialogMemoizeBounds_1.registeredDialogs)));
|
|
111
97
|
}
|
|
112
98
|
catch (e) {
|
|
113
99
|
console.log(e);
|
|
@@ -115,3 +101,22 @@ var setDialogBounds = function (dialogId, bounds, dialogRef) {
|
|
|
115
101
|
}
|
|
116
102
|
};
|
|
117
103
|
exports.setDialogBounds = setDialogBounds;
|
|
104
|
+
var setDialogBound = function (dialogId, key, value) {
|
|
105
|
+
var _a;
|
|
106
|
+
var combined = ['guzzle', dialogId];
|
|
107
|
+
var foundedDialog = initDialogMemoizeBounds_1.registeredDialogs.get(combined.join('-'));
|
|
108
|
+
if (foundedDialog) {
|
|
109
|
+
// Save to RAM
|
|
110
|
+
initDialogMemoizeBounds_1.registeredDialogs.set(combined.join('-'), {
|
|
111
|
+
id: combined.join('-'),
|
|
112
|
+
bounds: __assign(__assign({}, foundedDialog.bounds), (_a = {}, _a[key] = value, _a))
|
|
113
|
+
});
|
|
114
|
+
try {
|
|
115
|
+
window.localStorage.setItem(initDialogMemoizeBounds_1.BOUNDS_STORE_KEY, JSON.stringify(Array.from(initDialogMemoizeBounds_1.registeredDialogs)));
|
|
116
|
+
}
|
|
117
|
+
catch (e) {
|
|
118
|
+
console.log(e);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
exports.setDialogBound = setDialogBound;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dialogRectAuto = void 0;
|
|
4
|
+
var dialogRectAuto = function () {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
var nodes = Array.from(document.querySelectorAll('.react-guzzle-root[data-family="presentation"]'));
|
|
7
|
+
if (nodes.length > 1) {
|
|
8
|
+
var lastDialog = nodes[nodes.length - 2];
|
|
9
|
+
var dialogMain = lastDialog.querySelector('#dialog-main');
|
|
10
|
+
var rect = dialogMain === null || dialogMain === void 0 ? void 0 : dialogMain.getBoundingClientRect();
|
|
11
|
+
return {
|
|
12
|
+
top: ((_a = rect === null || rect === void 0 ? void 0 : rect.top) !== null && _a !== void 0 ? _a : 0) + 10,
|
|
13
|
+
left: ((_b = rect === null || rect === void 0 ? void 0 : rect.left) !== null && _b !== void 0 ? _b : 0) + 10,
|
|
14
|
+
x: rect.x,
|
|
15
|
+
y: rect.y,
|
|
16
|
+
isMultiple: true
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return { top: 0, left: 0, isMultiple: false };
|
|
20
|
+
};
|
|
21
|
+
exports.dialogRectAuto = dialogRectAuto;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formInputKeyListeners = void 0;
|
|
4
|
+
var formInputKeyListeners = function (wrapperEl) {
|
|
5
|
+
if (wrapperEl) {
|
|
6
|
+
// Öncelikle ref'i al ve input elemanlarını bul
|
|
7
|
+
var inputElements = wrapperEl.querySelectorAll("input");
|
|
8
|
+
// Tüm input elemanlarını döngüye al
|
|
9
|
+
inputElements.forEach(function (input) {
|
|
10
|
+
console.log(input); // Her bir input elemanını burada işleyebilirsiniz
|
|
11
|
+
// Örneğin, input değerini okuma veya ayarlama
|
|
12
|
+
input.addEventListener('keydown', function (e) { return e.key === "Enter" && e.preventDefault(); }); // Değerini boşaltmak için örnek
|
|
13
|
+
input.addEventListener('keyup', function (e) { return e.key === "Enter" && e.preventDefault(); }); // Değerini boşaltmak için örnek
|
|
14
|
+
input.addEventListener('keypress', function (e) { return e.key === "Enter" && e.preventDefault(); }); // Değerini boşaltmak için örnek
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
exports.formInputKeyListeners = formInputKeyListeners;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hexToRgb = void 0;
|
|
4
|
+
var hexToRgb = function (hex, opacity) {
|
|
5
|
+
try {
|
|
6
|
+
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
7
|
+
var colors = {
|
|
8
|
+
r: parseInt(result[1], 16),
|
|
9
|
+
g: parseInt(result[2], 16),
|
|
10
|
+
b: parseInt(result[3], 16)
|
|
11
|
+
};
|
|
12
|
+
return "rgba(".concat(colors.r, ", ").concat(colors.g, ", ").concat(colors.b, ", ").concat(opacity, ")");
|
|
13
|
+
}
|
|
14
|
+
catch (e) {
|
|
15
|
+
console.warn('Color should be hex string', e.message);
|
|
16
|
+
}
|
|
17
|
+
return '';
|
|
18
|
+
};
|
|
19
|
+
exports.hexToRgb = hexToRgb;
|
package/helpers/index.d.ts
CHANGED
package/helpers/index.js
CHANGED
|
@@ -14,9 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.registeredDialogs = exports.InitDialogMemoizeBoundsDeclared = exports.InitDialogMemoizeBounds = void 0;
|
|
17
|
+
exports.formInputKeyListeners = exports.registeredDialogs = exports.InitDialogMemoizeBoundsDeclared = exports.InitDialogMemoizeBounds = void 0;
|
|
18
18
|
var initDialogMemoizeBounds_1 = require("./initDialogMemoizeBounds");
|
|
19
19
|
Object.defineProperty(exports, "InitDialogMemoizeBounds", { enumerable: true, get: function () { return initDialogMemoizeBounds_1.InitDialogMemoizeBounds; } });
|
|
20
20
|
Object.defineProperty(exports, "InitDialogMemoizeBoundsDeclared", { enumerable: true, get: function () { return initDialogMemoizeBounds_1.InitDialogMemoizeBoundsDeclared; } });
|
|
21
21
|
Object.defineProperty(exports, "registeredDialogs", { enumerable: true, get: function () { return initDialogMemoizeBounds_1.registeredDialogs; } });
|
|
22
22
|
__exportStar(require("./dialogBoundsMemoize"), exports);
|
|
23
|
+
var formInputKeyListeners_1 = require("./formInputKeyListeners");
|
|
24
|
+
Object.defineProperty(exports, "formInputKeyListeners", { enumerable: true, get: function () { return formInputKeyListeners_1.formInputKeyListeners; } });
|