react-dialogger 1.1.26 → 1.1.28
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.js +17 -7
- package/components/DialogActionBase.js +17 -7
- package/components/DialogBase.d.ts +3 -1
- package/components/DialogBase.js +39 -11
- package/components/Futures/DialogInfoAction.js +17 -7
- package/components/RippleButton.js +17 -7
- package/models/DialogAction.d.ts +1 -1
- package/package.json +1 -1
- package/types/DialogTypes.d.ts +1 -1
- package/types/types.d.ts +1 -0
- package/components/dialogBoundsMemoize.d.ts +0 -20
- package/components/dialogBoundsMemoize.js +0 -117
- package/hooks/initDialogMemoizeBounds.d.ts +0 -4
- package/hooks/initDialogMemoizeBounds.js +0 -39
- package/hooks/useDialogMemoizeBounds.d.ts +0 -1
- package/hooks/useDialogMemoizeBounds.js +0 -37
|
@@ -26,13 +26,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
26
26
|
}) : function(o, v) {
|
|
27
27
|
o["default"] = v;
|
|
28
28
|
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
};
|
|
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
|
+
})();
|
|
36
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
47
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
48
|
var React = __importStar(require("react"));
|
|
@@ -41,13 +41,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
41
41
|
}) : function(o, v) {
|
|
42
42
|
o["default"] = v;
|
|
43
43
|
});
|
|
44
|
-
var __importStar = (this && this.__importStar) || function (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
44
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
45
|
+
var ownKeys = function(o) {
|
|
46
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
47
|
+
var ar = [];
|
|
48
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
49
|
+
return ar;
|
|
50
|
+
};
|
|
51
|
+
return ownKeys(o);
|
|
52
|
+
};
|
|
53
|
+
return function (mod) {
|
|
54
|
+
if (mod && mod.__esModule) return mod;
|
|
55
|
+
var result = {};
|
|
56
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
57
|
+
__setModuleDefault(result, mod);
|
|
58
|
+
return result;
|
|
59
|
+
};
|
|
60
|
+
})();
|
|
51
61
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
52
62
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
53
63
|
};
|
|
@@ -13,6 +13,7 @@ declare class DialogBase extends Component<BaseDialogProps, BaseDialogState> {
|
|
|
13
13
|
protected _dom: HTMLDivElement;
|
|
14
14
|
protected _innerRef: React.RefObject<any>;
|
|
15
15
|
protected _stateListener: TDialogStateListenerCallbackType;
|
|
16
|
+
protected _processingListener: (inProcess: boolean) => void;
|
|
16
17
|
protected _keyboardListener: (key: string, dialog: IDialogDef) => void;
|
|
17
18
|
protected _resizeListener: (size: IDialogSize, dialog: IDialogDef) => void;
|
|
18
19
|
protected _initialHolder: TInitialHolder;
|
|
@@ -91,6 +92,7 @@ declare class DialogBase extends Component<BaseDialogProps, BaseDialogState> {
|
|
|
91
92
|
stateListener(listener: TDialogStateListenerCallbackType): DialogBase;
|
|
92
93
|
protected keyboardListener(listener: (key: string, dialog: IDialogDef) => void): DialogBase;
|
|
93
94
|
protected resizeListener(listener: (size: IDialogSize, dialog: IDialogDef) => void): DialogBase;
|
|
95
|
+
processingListener(listener: (inProcess: boolean) => void): DialogBase;
|
|
94
96
|
protected initialHolder(holder: TInitialHolder): DialogBase;
|
|
95
97
|
protected onClose(callback: TDialogCallbackVoidFn): DialogBase;
|
|
96
98
|
setInProcess_noRef: (process: boolean, message?: string, holder?: TInitialHolder) => DialogBase;
|
|
@@ -111,7 +113,7 @@ declare class DialogBase extends Component<BaseDialogProps, BaseDialogState> {
|
|
|
111
113
|
setOrder: (position: ComponentOrderPositions, component: HTMLElement) => DialogBase;
|
|
112
114
|
getDom: () => HTMLDivElement;
|
|
113
115
|
get snackbar(): {
|
|
114
|
-
open: (message: string, severity: TSeverity, key?: string, action?: (key: string, snackbarRef: any) => ReactNode | void, autoHideDuration?: number | null) => void;
|
|
116
|
+
open: (message: string, severity: TSeverity, key?: string, action?: ((key: string, snackbarRef: any) => ReactNode | void), autoHideDuration?: number | null) => void;
|
|
115
117
|
openX: ({ message, severity, key, action, autoHideDuration }: {
|
|
116
118
|
message: string;
|
|
117
119
|
severity: TSeverity;
|
package/components/DialogBase.js
CHANGED
|
@@ -41,13 +41,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
41
41
|
}) : function(o, v) {
|
|
42
42
|
o["default"] = v;
|
|
43
43
|
});
|
|
44
|
-
var __importStar = (this && this.__importStar) || function (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
44
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
45
|
+
var ownKeys = function(o) {
|
|
46
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
47
|
+
var ar = [];
|
|
48
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
49
|
+
return ar;
|
|
50
|
+
};
|
|
51
|
+
return ownKeys(o);
|
|
52
|
+
};
|
|
53
|
+
return function (mod) {
|
|
54
|
+
if (mod && mod.__esModule) return mod;
|
|
55
|
+
var result = {};
|
|
56
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
57
|
+
__setModuleDefault(result, mod);
|
|
58
|
+
return result;
|
|
59
|
+
};
|
|
60
|
+
})();
|
|
51
61
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
52
62
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
53
63
|
};
|
|
@@ -223,8 +233,11 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
223
233
|
return _this;
|
|
224
234
|
};
|
|
225
235
|
_this.isInProcess = function () {
|
|
236
|
+
var _a, _b, _c;
|
|
226
237
|
// return this.state.inProcess;
|
|
227
|
-
return
|
|
238
|
+
// return this._inProcess;
|
|
239
|
+
// @ts-ignore
|
|
240
|
+
return (_c = (_b = (_a = _this._footeRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.inProcess) !== null && _c !== void 0 ? _c : false;
|
|
228
241
|
};
|
|
229
242
|
_this.close = function (callbackFn) {
|
|
230
243
|
var _a;
|
|
@@ -394,7 +407,7 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
394
407
|
if (body instanceof Function) {
|
|
395
408
|
return (0, jsx_runtime_1.jsxs)("div", { ref: _this._dialogBodyRef, className: 'dialog-body', style: { height: '100%' }, children: [_this.Placeholder(_this._holder), body(_this)] });
|
|
396
409
|
}
|
|
397
|
-
return (0, jsx_runtime_1.jsx)("div", { style: { height: '100%', padding: 10 }, children: _this._holder ?
|
|
410
|
+
return (0, jsx_runtime_1.jsx)("div", { className: 'dialog-body', style: { height: '100%', padding: 10 }, children: _this._holder ?
|
|
398
411
|
_this.Placeholder(_this._holder)
|
|
399
412
|
:
|
|
400
413
|
//@ts-ignore
|
|
@@ -456,8 +469,13 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
456
469
|
setInProcess(inProcess);
|
|
457
470
|
};
|
|
458
471
|
React.useImperativeHandle(ref, function () { return ({
|
|
459
|
-
setProcessing: setProcessing
|
|
472
|
+
setProcessing: setProcessing,
|
|
473
|
+
inProcess: inProcess
|
|
460
474
|
}); });
|
|
475
|
+
// console.log('processingListener', this._processingListener);
|
|
476
|
+
if (typeof _this._processingListener === "function") {
|
|
477
|
+
_this._processingListener(inProcess);
|
|
478
|
+
}
|
|
461
479
|
var staticProps = {
|
|
462
480
|
dialogValues: _this.state.values,
|
|
463
481
|
dialogOptions: _this._dialogOptions,
|
|
@@ -811,11 +829,16 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
811
829
|
var _this = this;
|
|
812
830
|
var prevState = this.state;
|
|
813
831
|
_super.prototype.setState.call(this, state, function () {
|
|
814
|
-
var _a;
|
|
815
832
|
// if( typeof this.props.stateListener === "function" && JSON.stringify(prevState) !== JSON.stringify(state) ){
|
|
833
|
+
var _a;
|
|
834
|
+
// Outer State Listener
|
|
816
835
|
if (typeof _this.props.stateListener === "function" && !(0, lodash_isequal_1.default)(prevState, state)) {
|
|
817
836
|
_this.props.stateListener(_this.state, _this.state.values, _this);
|
|
818
837
|
}
|
|
838
|
+
// Inner State Listener
|
|
839
|
+
if (typeof _this._stateListener === "function" && !(0, lodash_isequal_1.default)(prevState, state)) {
|
|
840
|
+
_this._stateListener(_this.state, _this.state.values, _this);
|
|
841
|
+
}
|
|
819
842
|
for (var actionKey in _this._actionRefs) {
|
|
820
843
|
var action = _this._actionRefs[actionKey];
|
|
821
844
|
if (typeof action.current._stateListener === "function") {
|
|
@@ -871,6 +894,11 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
871
894
|
this._resizeListener = listener;
|
|
872
895
|
return this;
|
|
873
896
|
};
|
|
897
|
+
DialogBase.prototype.processingListener = function (listener) {
|
|
898
|
+
// @ts-ignore
|
|
899
|
+
this._processingListener = listener;
|
|
900
|
+
return this;
|
|
901
|
+
};
|
|
874
902
|
DialogBase.prototype.initialHolder = function (holder) {
|
|
875
903
|
this._initialHolder = holder;
|
|
876
904
|
return this;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -26,13 +26,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
26
26
|
}) : function(o, v) {
|
|
27
27
|
o["default"] = v;
|
|
28
28
|
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
};
|
|
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
|
+
})();
|
|
36
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
47
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
48
|
var React = __importStar(require("react"));
|
package/models/DialogAction.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ declare class DialogAction extends DialogActionBase {
|
|
|
34
34
|
* Only from init */
|
|
35
35
|
stateListener: (listener: TDialogStateListenerForActionCallbackType) => this;
|
|
36
36
|
set baseDialogAction(baseDialogAction: DialogActionBase);
|
|
37
|
-
setInProcess: (inProcess: ActionProps[
|
|
37
|
+
setInProcess: (inProcess: ActionProps["inProcess"]) => this;
|
|
38
38
|
/**
|
|
39
39
|
* @deprecated
|
|
40
40
|
* @see isInProcess*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-dialogger",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.28",
|
|
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
|
@@ -123,7 +123,7 @@ 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, 'isInProcess' | 'setInProcess' | 'values' | 'setValue' | 'setValues' | 'close' | 'dialogOptions' | 'switchFullScreen' | 'actions' | 'snackbar' | 'formikValidate' | 'formikProps' | 'focus' | 'setOrder' | 'setBody' | 'onResize'>>, 'switchFullScreen'> {
|
|
126
|
+
export interface IDialogDef extends Omit<Partial<Pick<DialogBase, '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
128
|
switchFullScreen?: DialogBase['switchFullScreen'];
|
|
129
129
|
/** @deprecated Deprecated, never use. */
|
package/types/types.d.ts
CHANGED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { IBaseDialogOptions } from "../types/DialogTypes";
|
|
2
|
-
/**
|
|
3
|
-
* RAM den okuyoruz...
|
|
4
|
-
* */
|
|
5
|
-
declare const dialogInStore: (options: IBaseDialogOptions) => IDialogBoundDef | undefined;
|
|
6
|
-
declare const dialogRegister: (options: IBaseDialogOptions, initialBounds: IDialogBoundsDef) => IDialogBoundsDef;
|
|
7
|
-
declare const getDialogBounds: (options: IBaseDialogOptions) => IDialogBoundsDef | undefined;
|
|
8
|
-
declare const setDialogBounds: (dialogId: string, bounds: IDialogBoundsDef, dialogRef: React.RefObject<any>) => void;
|
|
9
|
-
export { dialogRegister, getDialogBounds, setDialogBounds, dialogInStore };
|
|
10
|
-
export type IDialogBoundsMemoKey = string | number;
|
|
11
|
-
export interface IDialogBoundsDef {
|
|
12
|
-
width: number;
|
|
13
|
-
height: number;
|
|
14
|
-
x: number;
|
|
15
|
-
y: number;
|
|
16
|
-
}
|
|
17
|
-
export interface IDialogBoundDef {
|
|
18
|
-
id: string;
|
|
19
|
-
bounds: IDialogBoundsDef;
|
|
20
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dialogInStore = exports.setDialogBounds = exports.getDialogBounds = exports.dialogRegister = void 0;
|
|
4
|
-
var initDialogMemoizeBounds_1 = require("../hooks/initDialogMemoizeBounds");
|
|
5
|
-
var BOUNDS_STORE_KEY = 'react-super-dialog';
|
|
6
|
-
// const boundStoreExists = () => {
|
|
7
|
-
// try{
|
|
8
|
-
// return !!window.localStorage.getItem(BOUNDS_STORE_KEY);
|
|
9
|
-
// } catch (e){
|
|
10
|
-
// return false;
|
|
11
|
-
// }
|
|
12
|
-
// }
|
|
13
|
-
// const createBoundStore = () => {
|
|
14
|
-
// if (!boundStoreExists()) {
|
|
15
|
-
// try{
|
|
16
|
-
// window.localStorage.setItem(BOUNDS_STORE_KEY, JSON.stringify([]));
|
|
17
|
-
// } catch (e){
|
|
18
|
-
// console.log(e);
|
|
19
|
-
// }
|
|
20
|
-
// }
|
|
21
|
-
// }
|
|
22
|
-
/**
|
|
23
|
-
* RAM den okuyoruz...
|
|
24
|
-
* */
|
|
25
|
-
var dialogInStore = function (options) {
|
|
26
|
-
var stores = initDialogMemoizeBounds_1.registeredDialogs;
|
|
27
|
-
console.log('dialogInStoreX1', stores);
|
|
28
|
-
if (!stores)
|
|
29
|
-
return undefined;
|
|
30
|
-
var parsedStores = stores; // JSON.parse(stores);
|
|
31
|
-
var foundedStore = parsedStores.find(function (store) { return store.id === options.id; });
|
|
32
|
-
return foundedStore;
|
|
33
|
-
};
|
|
34
|
-
exports.dialogInStore = dialogInStore;
|
|
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(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 = 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(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(BOUNDS_STORE_KEY, JSON.stringify(initDialogMemoizeBounds_1.registeredDialogs));
|
|
111
|
-
}
|
|
112
|
-
catch (e) {
|
|
113
|
-
console.log(e);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
exports.setDialogBounds = setDialogBounds;
|
|
@@ -1,39 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useDialogMemoizeBounds: () => void;
|
|
@@ -1,37 +0,0 @@
|
|
|
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;
|