react-dialogger 1.1.21 → 1.1.23
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/CircularProgress.d.ts +1 -2
- package/components/CircularProgress.js +5 -8
- package/components/DialogActionBase.d.ts +1 -2
- package/components/DialogActionBase.js +10 -11
- package/components/DialogBase.d.ts +4 -4
- package/components/DialogBase.js +115 -105
- package/components/Futures/DialogCloseAction.d.ts +1 -2
- package/components/Futures/DialogCloseAction.js +4 -28
- package/components/Futures/DialogFullscreenAction.d.ts +1 -2
- package/components/Futures/DialogFullscreenAction.js +13 -36
- package/components/Futures/DialogHeaderActionsWrapper.d.ts +1 -1
- package/components/Futures/DialogHeaderActionsWrapper.js +2 -5
- package/components/Futures/DialogInfoAction.d.ts +1 -2
- package/components/Futures/DialogInfoAction.js +4 -15
- package/components/Futures/DialogProcessing.d.ts +1 -2
- package/components/Futures/DialogProcessing.js +2 -25
- package/components/RippleButton.js +3 -4
- package/components/dialogBoundsMemoize.d.ts +20 -0
- package/components/dialogBoundsMemoize.js +117 -0
- package/components/icons/CloseIcon.d.ts +1 -2
- package/components/icons/CloseIcon.js +2 -7
- package/components/icons/FullscreenExitIcon.d.ts +1 -2
- package/components/icons/FullscreenExitIcon.js +2 -7
- package/components/icons/FullscreenIcon.d.ts +1 -2
- package/components/icons/FullscreenIcon.js +2 -7
- package/components/icons/InfoIcon.d.ts +1 -2
- package/components/icons/InfoIcon.js +2 -7
- package/components/icons/ResizeIcon.d.ts +1 -2
- package/components/icons/ResizeIcon.js +3 -8
- package/helpers/BoundTypes.d.ts +11 -0
- package/helpers/BoundTypes.js +2 -0
- package/helpers/dialogBoundsMemoize.d.ts +5 -0
- package/helpers/dialogBoundsMemoize.js +117 -0
- package/helpers/index.d.ts +2 -0
- package/helpers/index.js +22 -0
- package/helpers/initDialogMemoizeBounds.d.ts +5 -0
- package/helpers/initDialogMemoizeBounds.js +40 -0
- package/hooks/initDialogMemoizeBounds.d.ts +4 -0
- package/hooks/initDialogMemoizeBounds.js +39 -0
- package/hooks/useDialogMemoizeBounds.d.ts +1 -0
- package/hooks/useDialogMemoizeBounds.js +37 -0
- package/index.d.ts +1 -0
- package/index.js +3 -1
- package/models/DialogAction.d.ts +1 -2
- package/models/DialogAction.js +2 -25
- package/models/Resizeable.d.ts +3 -1
- package/models/Resizeable.js +15 -9
- package/package.json +2 -2
- package/types/DialogTypes.d.ts +5 -0
- package/components/Dependencies/Body.d.ts +0 -8
- package/components/Dependencies/Body.js +0 -40
- package/components/Dependencies/DialogBody.d.ts +0 -8
- package/components/Dependencies/DialogBody.js +0 -40
- package/types/FormikProps.d.ts +0 -302
@@ -0,0 +1,117 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.setDialogBounds = exports.getDialogBounds = exports.dialogRegister = void 0;
|
4
|
+
// import {registeredDialogs} from "../hooks/initDialogMemoizeBounds";
|
5
|
+
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
|
+
/**
|
24
|
+
* RAM den okuyoruz...
|
25
|
+
* */
|
26
|
+
var dialogInStore = function (options) {
|
27
|
+
var stores = initDialogMemoizeBounds_1.registeredDialogs;
|
28
|
+
console.log('dialogInStoreX1', stores);
|
29
|
+
if (!stores)
|
30
|
+
return undefined;
|
31
|
+
var parsedStores = stores; // JSON.parse(stores);
|
32
|
+
var foundedStore = parsedStores.find(function (store) { return store.id === options.id; });
|
33
|
+
return foundedStore;
|
34
|
+
};
|
35
|
+
var dialogRegister = function (options, initialBounds) {
|
36
|
+
console.log('Regsister fired!!!', options);
|
37
|
+
if (dialogInStore(options))
|
38
|
+
return;
|
39
|
+
if (!options.id) {
|
40
|
+
throw new Error('Dialog bounds can not be memoized. Dialog id is required.');
|
41
|
+
}
|
42
|
+
// createBoundStore();
|
43
|
+
var newBounds = {
|
44
|
+
id: options.id,
|
45
|
+
bounds: {
|
46
|
+
width: initialBounds.width,
|
47
|
+
height: initialBounds.height,
|
48
|
+
x: initialBounds.x,
|
49
|
+
y: initialBounds.y + 100
|
50
|
+
}
|
51
|
+
};
|
52
|
+
var foundedDialog = initDialogMemoizeBounds_1.registeredDialogs.find(function (b) { return b.id === options.id; });
|
53
|
+
console.log('foundedDialog', foundedDialog);
|
54
|
+
if (!foundedDialog) {
|
55
|
+
initDialogMemoizeBounds_1.registeredDialogs.push(newBounds);
|
56
|
+
}
|
57
|
+
console.log('foundedDialog_2', initDialogMemoizeBounds_1.registeredDialogs);
|
58
|
+
// Register to Cookie
|
59
|
+
try {
|
60
|
+
window.localStorage.setItem(initDialogMemoizeBounds_1.BOUNDS_STORE_KEY, JSON.stringify(initDialogMemoizeBounds_1.registeredDialogs));
|
61
|
+
}
|
62
|
+
catch (e) {
|
63
|
+
console.log(e);
|
64
|
+
}
|
65
|
+
// registeredDialogs.push(newBounds);
|
66
|
+
console.log('Dialog_Bounds, initialBounds-A', initialBounds);
|
67
|
+
var bounds = (0, exports.getDialogBounds)(options);
|
68
|
+
return bounds;
|
69
|
+
};
|
70
|
+
exports.dialogRegister = dialogRegister;
|
71
|
+
var getDialogBounds = function (options) {
|
72
|
+
var dialog = dialogInStore(options);
|
73
|
+
if (!options.id) {
|
74
|
+
throw new Error('Dialog bounds can not be memoized. Dialog id is required.');
|
75
|
+
}
|
76
|
+
// Eget local vaiable icinde bulunamassa localStorage'dan al
|
77
|
+
if (!dialog) {
|
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
|
+
}
|
90
|
+
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
|
+
};
|
97
|
+
}
|
98
|
+
return undefined;
|
99
|
+
};
|
100
|
+
exports.getDialogBounds = getDialogBounds;
|
101
|
+
var setDialogBounds = function (dialogId, bounds, dialogRef) {
|
102
|
+
var newBounds = {
|
103
|
+
id: dialogId,
|
104
|
+
bounds: bounds
|
105
|
+
};
|
106
|
+
var founded = initDialogMemoizeBounds_1.registeredDialogs.find(function (b) { return b.id === dialogId; });
|
107
|
+
if (founded) {
|
108
|
+
founded.bounds = bounds;
|
109
|
+
try {
|
110
|
+
window.localStorage.setItem(initDialogMemoizeBounds_1.BOUNDS_STORE_KEY, JSON.stringify(initDialogMemoizeBounds_1.registeredDialogs));
|
111
|
+
}
|
112
|
+
catch (e) {
|
113
|
+
console.log(e);
|
114
|
+
}
|
115
|
+
}
|
116
|
+
};
|
117
|
+
exports.setDialogBounds = setDialogBounds;
|
package/helpers/index.js
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
exports.registeredDialogs = exports.InitDialogMemoizeBoundsDeclared = exports.InitDialogMemoizeBounds = void 0;
|
18
|
+
var initDialogMemoizeBounds_1 = require("./initDialogMemoizeBounds");
|
19
|
+
Object.defineProperty(exports, "InitDialogMemoizeBounds", { enumerable: true, get: function () { return initDialogMemoizeBounds_1.InitDialogMemoizeBounds; } });
|
20
|
+
Object.defineProperty(exports, "InitDialogMemoizeBoundsDeclared", { enumerable: true, get: function () { return initDialogMemoizeBounds_1.InitDialogMemoizeBoundsDeclared; } });
|
21
|
+
Object.defineProperty(exports, "registeredDialogs", { enumerable: true, get: function () { return initDialogMemoizeBounds_1.registeredDialogs; } });
|
22
|
+
__exportStar(require("./dialogBoundsMemoize"), exports);
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { IDialogBoundDef, IDialogBoundsMemoKey } from "./BoundTypes";
|
2
|
+
export declare let registeredDialogs: IDialogBoundDef[];
|
3
|
+
export declare let InitDialogMemoizeBoundsDeclared: boolean;
|
4
|
+
export declare const BOUNDS_STORE_KEY: IDialogBoundsMemoKey;
|
5
|
+
export declare const InitDialogMemoizeBounds: () => void;
|
@@ -0,0 +1,40 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.InitDialogMemoizeBounds = exports.BOUNDS_STORE_KEY = exports.InitDialogMemoizeBoundsDeclared = exports.registeredDialogs = void 0;
|
4
|
+
// Sayfa ilk yuklendiginde calisacak
|
5
|
+
exports.registeredDialogs = [];
|
6
|
+
exports.InitDialogMemoizeBoundsDeclared = false;
|
7
|
+
exports.BOUNDS_STORE_KEY = 'react-super-dialog';
|
8
|
+
// Bu App level sevyesinde olmali
|
9
|
+
// ILk Kayitlari olusturuyoruz
|
10
|
+
var InitDialogMemoizeBounds = function () {
|
11
|
+
var boundStoreExists = function () {
|
12
|
+
try {
|
13
|
+
return !!window.localStorage.getItem(exports.BOUNDS_STORE_KEY);
|
14
|
+
}
|
15
|
+
catch (e) {
|
16
|
+
return false;
|
17
|
+
}
|
18
|
+
};
|
19
|
+
var createBoundStore = function () {
|
20
|
+
if (!boundStoreExists()) {
|
21
|
+
try {
|
22
|
+
window.localStorage.setItem(exports.BOUNDS_STORE_KEY, JSON.stringify([]));
|
23
|
+
}
|
24
|
+
catch (e) {
|
25
|
+
console.log(e);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
};
|
29
|
+
var readFromStore = function () {
|
30
|
+
createBoundStore();
|
31
|
+
var boundsRaw = window.localStorage.getItem(exports.BOUNDS_STORE_KEY);
|
32
|
+
var boundsArray = boundsRaw ? JSON.parse(boundsRaw) : [];
|
33
|
+
return boundsArray;
|
34
|
+
};
|
35
|
+
console.log('readFromStore', readFromStore());
|
36
|
+
// Set this on App level
|
37
|
+
exports.registeredDialogs = readFromStore();
|
38
|
+
exports.InitDialogMemoizeBoundsDeclared = true;
|
39
|
+
};
|
40
|
+
exports.InitDialogMemoizeBounds = InitDialogMemoizeBounds;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.initDialogMemoizeBounds = exports.initDialogMemoizeBoundsDeclared = exports.registeredDialogs = void 0;
|
4
|
+
// Sayfa ilk yuklendiginde calisacak
|
5
|
+
exports.registeredDialogs = [];
|
6
|
+
exports.initDialogMemoizeBoundsDeclared = false;
|
7
|
+
// Bu App level sevyesinde olmali
|
8
|
+
var initDialogMemoizeBounds = function () {
|
9
|
+
var BOUNDS_STORE_KEY = 'react-super-dialog';
|
10
|
+
var boundStoreExists = function () {
|
11
|
+
try {
|
12
|
+
return !!window.localStorage.getItem(BOUNDS_STORE_KEY);
|
13
|
+
}
|
14
|
+
catch (e) {
|
15
|
+
return false;
|
16
|
+
}
|
17
|
+
};
|
18
|
+
var createBoundStore = function () {
|
19
|
+
if (!boundStoreExists()) {
|
20
|
+
try {
|
21
|
+
window.localStorage.setItem(BOUNDS_STORE_KEY, JSON.stringify([]));
|
22
|
+
}
|
23
|
+
catch (e) {
|
24
|
+
console.log(e);
|
25
|
+
}
|
26
|
+
}
|
27
|
+
};
|
28
|
+
var readFromStore = function () {
|
29
|
+
createBoundStore();
|
30
|
+
var boundsRaw = window.localStorage.getItem(BOUNDS_STORE_KEY);
|
31
|
+
var boundsArray = boundsRaw ? JSON.parse(boundsRaw) : [];
|
32
|
+
return boundsArray;
|
33
|
+
};
|
34
|
+
console.log('readFromStore', readFromStore());
|
35
|
+
// Set this on App level
|
36
|
+
exports.registeredDialogs = readFromStore();
|
37
|
+
exports.initDialogMemoizeBoundsDeclared = true;
|
38
|
+
};
|
39
|
+
exports.initDialogMemoizeBounds = initDialogMemoizeBounds;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const useDialogMemoizeBounds: () => void;
|
@@ -0,0 +1,37 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.useDialogMemoizeBounds = void 0;
|
4
|
+
// Sayfa ilk yuklendiginde calisacak
|
5
|
+
var registeredDialogs = [];
|
6
|
+
// Bu App level sevyesinde olmali
|
7
|
+
var useDialogMemoizeBounds = function () {
|
8
|
+
var BOUNDS_STORE_KEY = 'react-super-dialog';
|
9
|
+
var boundStoreExists = function () {
|
10
|
+
try {
|
11
|
+
return !!window.localStorage.getItem(BOUNDS_STORE_KEY);
|
12
|
+
}
|
13
|
+
catch (e) {
|
14
|
+
return false;
|
15
|
+
}
|
16
|
+
};
|
17
|
+
var createBoundStore = function () {
|
18
|
+
if (!boundStoreExists()) {
|
19
|
+
try {
|
20
|
+
window.localStorage.setItem(BOUNDS_STORE_KEY, JSON.stringify([]));
|
21
|
+
}
|
22
|
+
catch (e) {
|
23
|
+
console.log(e);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
};
|
27
|
+
var readFromStore = function () {
|
28
|
+
createBoundStore();
|
29
|
+
var boundsRaw = window.localStorage.getItem(BOUNDS_STORE_KEY);
|
30
|
+
var boundsArray = boundsRaw ? JSON.parse(boundsRaw) : [];
|
31
|
+
return boundsArray;
|
32
|
+
};
|
33
|
+
console.log('readFromStore', readFromStore());
|
34
|
+
// Set this on App level
|
35
|
+
registeredDialogs = readFromStore();
|
36
|
+
};
|
37
|
+
exports.useDialogMemoizeBounds = useDialogMemoizeBounds;
|
package/index.d.ts
CHANGED
@@ -6,3 +6,4 @@ export { default } from "./models/Dialog";
|
|
6
6
|
export { DialogProcessing, DialogCloseAction, DialogFullscreenAction, DialogHeaderActionsWrapper, DialogInfoAction } from "./components/Futures";
|
7
7
|
export { DialogAction, ActionProgress } from "./models/DialogAction";
|
8
8
|
export { useDialogOptions } from "./hooks/useDialogOptions";
|
9
|
+
export { InitDialogMemoizeBounds } from "./helpers/initDialogMemoizeBounds";
|
package/index.js
CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.useDialogOptions = exports.ActionProgress = exports.DialogAction = exports.DialogInfoAction = exports.DialogHeaderActionsWrapper = exports.DialogFullscreenAction = exports.DialogCloseAction = exports.DialogProcessing = exports.default = exports.Dialog = void 0;
|
6
|
+
exports.InitDialogMemoizeBounds = exports.useDialogOptions = exports.ActionProgress = exports.DialogAction = exports.DialogInfoAction = exports.DialogHeaderActionsWrapper = exports.DialogFullscreenAction = exports.DialogCloseAction = exports.DialogProcessing = exports.default = exports.Dialog = void 0;
|
7
7
|
require("./styles/dialog.css");
|
8
8
|
require("./styles/dialog.action.css");
|
9
9
|
require("./styles/circular-progress.css");
|
@@ -24,3 +24,5 @@ Object.defineProperty(exports, "ActionProgress", { enumerable: true, get: functi
|
|
24
24
|
// Hooks
|
25
25
|
var useDialogOptions_1 = require("./hooks/useDialogOptions");
|
26
26
|
Object.defineProperty(exports, "useDialogOptions", { enumerable: true, get: function () { return useDialogOptions_1.useDialogOptions; } });
|
27
|
+
var initDialogMemoizeBounds_1 = require("./helpers/initDialogMemoizeBounds");
|
28
|
+
Object.defineProperty(exports, "InitDialogMemoizeBounds", { enumerable: true, get: function () { return initDialogMemoizeBounds_1.InitDialogMemoizeBounds; } });
|
package/models/DialogAction.d.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import { TDialogStateListenerForActionCallbackType, DialogActionOptionsType, TBVariant, TBColor, ActionProps, DialogActionType } from "../types/DialogActionTypes";
|
2
2
|
import DialogActionBase from "../components/DialogActionBase";
|
3
|
-
|
4
|
-
declare const ActionProgress: () => React.JSX.Element;
|
3
|
+
declare const ActionProgress: () => import("react/jsx-runtime").JSX.Element;
|
5
4
|
export { ActionProgress };
|
6
5
|
declare class DialogAction extends DialogActionBase {
|
7
6
|
constructor(name: string, options?: DialogActionOptionsType);
|
package/models/DialogAction.js
CHANGED
@@ -25,39 +25,16 @@ var __assign = (this && this.__assign) || function () {
|
|
25
25
|
};
|
26
26
|
return __assign.apply(this, arguments);
|
27
27
|
};
|
28
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
29
|
-
if (k2 === undefined) k2 = k;
|
30
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
31
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
32
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
33
|
-
}
|
34
|
-
Object.defineProperty(o, k2, desc);
|
35
|
-
}) : (function(o, m, k, k2) {
|
36
|
-
if (k2 === undefined) k2 = k;
|
37
|
-
o[k2] = m[k];
|
38
|
-
}));
|
39
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
40
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
41
|
-
}) : function(o, v) {
|
42
|
-
o["default"] = v;
|
43
|
-
});
|
44
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
45
|
-
if (mod && mod.__esModule) return mod;
|
46
|
-
var result = {};
|
47
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
48
|
-
__setModuleDefault(result, mod);
|
49
|
-
return result;
|
50
|
-
};
|
51
28
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
52
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
53
30
|
};
|
54
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
55
32
|
exports.DialogAction = exports.ActionProgress = void 0;
|
33
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
56
34
|
var DialogActionBase_1 = __importDefault(require("../components/DialogActionBase"));
|
57
35
|
var CircularProgress_1 = __importDefault(require("../components/CircularProgress"));
|
58
|
-
var React = __importStar(require("react"));
|
59
36
|
var ActionProgress = function () {
|
60
|
-
return
|
37
|
+
return (0, jsx_runtime_1.jsx)(CircularProgress_1.default, { size: 20, inProcess: { inProcess: true } });
|
61
38
|
};
|
62
39
|
exports.ActionProgress = ActionProgress;
|
63
40
|
var DialogAction = /** @class */ (function (_super) {
|
package/models/Resizeable.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { MouseEvent } from "react";
|
2
|
+
import { DialogOptionsType } from "../types/DialogTypes";
|
2
3
|
declare class Resizeable {
|
3
4
|
onResizeListener: (callbackFn: (width: number, height: number) => void) => void;
|
4
5
|
get width(): number;
|
@@ -10,8 +11,9 @@ declare class Resizeable {
|
|
10
11
|
private _container;
|
11
12
|
private _width;
|
12
13
|
private _height;
|
14
|
+
private _dialogOptions;
|
13
15
|
constructor();
|
14
|
-
setContainer: (container:
|
16
|
+
setContainer: (container: React.RefObject<HTMLDivElement>, options: DialogOptionsType) => void;
|
15
17
|
private resizeHandleMouseUp;
|
16
18
|
resizeHandleMouseDown: () => void;
|
17
19
|
resizeHandleMouseMove: (e: MouseEvent) => void;
|
package/models/Resizeable.js
CHANGED
@@ -1,32 +1,38 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
var helpers_1 = require("../helpers");
|
3
4
|
var Resizeable = /** @class */ (function () {
|
4
5
|
function Resizeable() {
|
5
6
|
var _this = this;
|
6
7
|
this.onResizeListener = function (callbackFn) {
|
7
8
|
_this._onResizeListener = callbackFn;
|
8
9
|
};
|
9
|
-
this.setContainer = function (container) {
|
10
|
+
this.setContainer = function (container, options) {
|
10
11
|
_this._container = container;
|
12
|
+
_this._dialogOptions = options;
|
11
13
|
};
|
12
14
|
this.resizeHandleMouseUp = function () {
|
13
|
-
console.log('handleMouseUp', false);
|
14
|
-
_this._container.classList.remove('no-select-on-resize');
|
15
|
+
// console.log('handleMouseUp', false);
|
16
|
+
_this._container.current.classList.remove('no-select-on-resize');
|
15
17
|
_this.isResizing = false;
|
18
|
+
// Bounds case
|
19
|
+
var container = _this._container.current;
|
20
|
+
var _a = container === null || container === void 0 ? void 0 : container.getBoundingClientRect(), width = _a.width, height = _a.height, x = _a.x, y = _a.y;
|
21
|
+
(0, helpers_1.setDialogBounds)(_this._dialogOptions.base.id, { width: width, height: height, x: x, y: y }, _this._container);
|
16
22
|
};
|
17
23
|
this.resizeHandleMouseDown = function () {
|
18
24
|
console.log('resizeHandleMouseDown', true);
|
19
25
|
_this.isResizing = true;
|
20
|
-
_this._container.classList.add('no-select-on-resize');
|
26
|
+
_this._container.current.classList.add('no-select-on-resize');
|
21
27
|
_this.init();
|
22
28
|
};
|
23
29
|
this.resizeHandleMouseMove = function (e) {
|
24
|
-
if (!_this.isResizing || !_this._container)
|
30
|
+
if (!_this.isResizing || !_this._container.current)
|
25
31
|
return;
|
26
|
-
if (!_this._container) {
|
32
|
+
if (!_this._container.current) {
|
27
33
|
throw new Error('Please define container');
|
28
34
|
}
|
29
|
-
var container = _this._container;
|
35
|
+
var container = _this._container.current;
|
30
36
|
var newWidth = e.clientX - (container === null || container === void 0 ? void 0 : container.getBoundingClientRect().left) + 10;
|
31
37
|
var newHeight = e.clientY - (container === null || container === void 0 ? void 0 : container.getBoundingClientRect().top) + 10;
|
32
38
|
_this._width = Math.max(newWidth, 100); // Minimum genişlik
|
@@ -34,8 +40,8 @@ var Resizeable = /** @class */ (function () {
|
|
34
40
|
if (typeof _this._onResizeListener === "function") {
|
35
41
|
_this._onResizeListener(_this._width, _this._height);
|
36
42
|
}
|
37
|
-
_this._container.style.width = _this._width + 'px';
|
38
|
-
_this._container.style.height = _this._height + 'px';
|
43
|
+
_this._container.current.style.width = _this._width + 'px';
|
44
|
+
_this._container.current.style.height = _this._height + 'px';
|
39
45
|
};
|
40
46
|
this.init = function () {
|
41
47
|
if (_this.isResizing) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-dialogger",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.23",
|
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",
|
@@ -21,7 +21,7 @@
|
|
21
21
|
}
|
22
22
|
],
|
23
23
|
"scripts": {
|
24
|
-
"pb": "
|
24
|
+
"pb": "npm version patch && npm publish && cp ./package.json ../src/dist.package.json"
|
25
25
|
},
|
26
26
|
"keywords": [
|
27
27
|
"react",
|
package/types/DialogTypes.d.ts
CHANGED
@@ -83,6 +83,11 @@ export interface IBaseDialogOptions {
|
|
83
83
|
style?: React.CSSProperties;
|
84
84
|
size?: IDialogSize;
|
85
85
|
notifyOnClosing?: TNotifyOnClosing;
|
86
|
+
/**
|
87
|
+
* Momoize dialog sized and position
|
88
|
+
* */
|
89
|
+
memoBounds?: boolean;
|
90
|
+
id?: string;
|
86
91
|
actions?: {
|
87
92
|
disabledOnDialogProcessing?: boolean;
|
88
93
|
baseStyle?: React.CSSProperties;
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import { TDialogCallbackNodeFn } from "../../types/DialogTypes";
|
2
|
-
import * as React from "react";
|
3
|
-
import { IDialogDef } from "react-dialogger/types";
|
4
|
-
declare const Body: ({ body, apiRef }: {
|
5
|
-
body: TDialogCallbackNodeFn;
|
6
|
-
apiRef?: IDialogDef;
|
7
|
-
}) => React.JSX.Element;
|
8
|
-
export default Body;
|
@@ -1,40 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
var React = __importStar(require("react"));
|
27
|
-
var Body = function (_a) {
|
28
|
-
var body = _a.body, apiRef = _a.apiRef;
|
29
|
-
if (body instanceof Function) {
|
30
|
-
return React.createElement("div", { ref: apiRef._dialogBodyRef, className: 'dialog-body', style: { height: '100%' } },
|
31
|
-
apiRef.Placeholder(apiRef._holder),
|
32
|
-
body(apiRef));
|
33
|
-
}
|
34
|
-
return React.createElement("div", { style: { height: '100%', padding: 10 } }, apiRef._holder ?
|
35
|
-
apiRef.Placeholder(apiRef._holder)
|
36
|
-
:
|
37
|
-
//@ts-ignore
|
38
|
-
body);
|
39
|
-
};
|
40
|
-
exports.default = Body;
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import { TDialogCallbackNodeFn } from "../../types/DialogTypes";
|
2
|
-
import * as React from "react";
|
3
|
-
import DialogBase from "../DialogBase";
|
4
|
-
declare const DialogBody: ({ body, apiRef }: {
|
5
|
-
body: TDialogCallbackNodeFn;
|
6
|
-
apiRef?: DialogBase;
|
7
|
-
}) => React.JSX.Element;
|
8
|
-
export default DialogBody;
|
@@ -1,40 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
var React = __importStar(require("react"));
|
27
|
-
var DialogBody = function (_a) {
|
28
|
-
var body = _a.body, apiRef = _a.apiRef;
|
29
|
-
if (body instanceof Function) {
|
30
|
-
return React.createElement("div", { ref: apiRef.dialogBodyRef, className: 'dialog-body', style: { height: '100%' } },
|
31
|
-
apiRef.Placeholder(apiRef.holder),
|
32
|
-
body(apiRef));
|
33
|
-
}
|
34
|
-
return React.createElement("div", { style: { height: '100%', padding: 10 } }, apiRef.holder ?
|
35
|
-
apiRef.Placeholder(apiRef.holder)
|
36
|
-
:
|
37
|
-
//@ts-ignore
|
38
|
-
body);
|
39
|
-
};
|
40
|
-
exports.default = DialogBody;
|