react-dialogger 1.1.134 → 1.1.136
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.
|
@@ -70,7 +70,7 @@ declare class DialogBase<V, I> extends Component<BaseDialogProps<V, I>, BaseDial
|
|
|
70
70
|
[key: string]: ActionApiDef;
|
|
71
71
|
};
|
|
72
72
|
updateBody(body: TDialogCallbackFn<V, I>): void;
|
|
73
|
-
processingListener(listener: (inProcess: boolean) => void): this;
|
|
73
|
+
processingListener(listener: (inProcess: boolean, message: string) => void): this;
|
|
74
74
|
onAbort(callbackFn: TDialogCallbackFn<V, I, void>): this;
|
|
75
75
|
getDom: () => HTMLDivElement;
|
|
76
76
|
get snackbar(): {
|
package/components/DialogBase.js
CHANGED
|
@@ -88,14 +88,13 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
88
88
|
_this.setInProcess = function (process, message, holder) {
|
|
89
89
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
90
90
|
_this._inProcess = __assign({ inProcess: process }, message ? { message: message } : {});
|
|
91
|
-
if
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
91
|
+
// if(!process){
|
|
92
|
+
// this._holder = null;
|
|
93
|
+
// } else {
|
|
94
|
+
// if(holder){
|
|
95
|
+
// this._holder = holder;
|
|
96
|
+
// }
|
|
97
|
+
// }
|
|
99
98
|
if ((_b = (_a = _this._dialogOptions.base) === null || _a === void 0 ? void 0 : _a.actions) === null || _b === void 0 ? void 0 : _b.disabledOnDialogProcessing) {
|
|
100
99
|
if (process) {
|
|
101
100
|
for (var actionKey in _this._actionRefs) {
|
|
@@ -125,7 +124,7 @@ var DialogBase = /** @class */ (function (_super) {
|
|
|
125
124
|
for (var _i = 0, _m = _this._processingListeners; _i < _m.length; _i++) {
|
|
126
125
|
var listener = _m[_i];
|
|
127
126
|
if (typeof listener === "function") {
|
|
128
|
-
listener(process);
|
|
127
|
+
listener(process, message);
|
|
129
128
|
}
|
|
130
129
|
}
|
|
131
130
|
console.log('setInProcess_process', process);
|
|
@@ -104,24 +104,28 @@ var PlaceholderWrapper = function (_a) {
|
|
|
104
104
|
var _d = (_b = dialog.dialogOptions.slotProps.loader) !== null && _b !== void 0 ? _b : { message: null }, message = _d.message, loading = _d.loading;
|
|
105
105
|
var _e = React.useState({
|
|
106
106
|
message: message,
|
|
107
|
-
|
|
107
|
+
loading: typeof loading === "boolean" ? loading : true
|
|
108
108
|
}), inProcess = _e[0], setInProcess = _e[1];
|
|
109
109
|
React.useEffect(function () {
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
dialog.processingListener(function (processing, message) {
|
|
111
|
+
console.log('PlaceholderWrapper_useEffect_processingListener', processing, message);
|
|
112
|
+
setInProcess({
|
|
113
|
+
message: message,
|
|
114
|
+
loading: processing
|
|
115
|
+
});
|
|
112
116
|
});
|
|
113
|
-
|
|
114
|
-
}, []);
|
|
117
|
+
}, [dialog]);
|
|
115
118
|
var initialElement = React.useState(function () {
|
|
116
119
|
if (!children)
|
|
117
120
|
return null;
|
|
118
121
|
return React.isValidElement(children) ? children : React.createElement(children, {});
|
|
119
122
|
})[0];
|
|
123
|
+
console.log('PlaceholderWrapper_useEffect_processingListener_2', inProcess.loading);
|
|
120
124
|
var LoaderSlotElement = initialElement
|
|
121
125
|
? React.cloneElement(initialElement, __assign(__assign({}, dialog.dialogOptions.slotProps.loader), { values: dialog.values, inProcess: dialog.isInProcess() }))
|
|
122
126
|
: null;
|
|
123
127
|
var backgroundColor = (_c = dialogOptions.base.style.backgroundColor) !== null && _c !== void 0 ? _c : "#FFFFFF";
|
|
124
|
-
return (0, jsx_runtime_1.jsx)("div", { className: 'dialog-content-placeholder', style: { display: inProcess.
|
|
128
|
+
return (0, jsx_runtime_1.jsx)("div", { className: 'dialog-content-placeholder', style: { display: inProcess.loading ? 'flex' : 'none', backgroundColor: backgroundColor }, children: LoaderSlotElement });
|
|
125
129
|
};
|
|
126
130
|
// const DialogContentBody: React.FC<IContentBodyProps> = React.forwardRef(({
|
|
127
131
|
// body
|
|
@@ -140,23 +144,29 @@ var DialogContentBody = React.forwardRef(function (_a, ref) {
|
|
|
140
144
|
setProcessing: setProcessing,
|
|
141
145
|
inProcess: inProcess
|
|
142
146
|
}); });
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
//
|
|
146
|
-
//
|
|
147
|
-
//
|
|
148
|
-
//
|
|
149
|
-
//
|
|
150
|
-
//
|
|
151
|
-
//
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
147
|
+
return (0, jsx_runtime_1.jsxs)("div", { className: 'dialog-body', style: { height: '100%' }, children: [dialog.holder &&
|
|
148
|
+
(0, jsx_runtime_1.jsx)(PlaceholderWrapper, { dialog: dialog, dialogOptions: dialog.dialogOptions, children: dialog.holder }), body(dialog)] });
|
|
149
|
+
// if(body instanceof Function){
|
|
150
|
+
// return <div className={'dialog-body'} style={{ height: '100%'}}>
|
|
151
|
+
// {/*{dialog.holder && <Placeholder dialogOptions={dialog.dialogOptions} placeholder={dialog.holder} />}*/}
|
|
152
|
+
// {
|
|
153
|
+
// dialog.holder &&
|
|
154
|
+
// <PlaceholderWrapper dialog={dialog} dialogOptions={dialog.dialogOptions}>
|
|
155
|
+
// {dialog.holder as any}
|
|
156
|
+
// </PlaceholderWrapper>
|
|
157
|
+
// }
|
|
158
|
+
// {body(dialog)}
|
|
159
|
+
// </div>
|
|
160
|
+
// }
|
|
161
|
+
// return <div className={'dialog-body'} style={{height: '100%', padding: 10}} >
|
|
162
|
+
// {
|
|
163
|
+
// dialog.holder ?
|
|
164
|
+
// // <Placeholder dialogOptions={dialog.dialogOptions} placeholder={dialog.holder} />
|
|
165
|
+
// <PlaceholderWrapper dialog={dialog} dialogOptions={dialog.dialogOptions}>
|
|
166
|
+
// {dialog.holder as any}
|
|
167
|
+
// </PlaceholderWrapper>
|
|
168
|
+
// :
|
|
169
|
+
// body }
|
|
170
|
+
// </div>
|
|
161
171
|
});
|
|
162
172
|
exports.DialogContentBody = DialogContentBody;
|
package/models/Dialog.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { TInitialHolder, IDialogSize, TDialogStateListenerCallbackType, DialogOp
|
|
|
4
4
|
declare class Dialog<V, I> {
|
|
5
5
|
private _initialValues?;
|
|
6
6
|
private _inject?;
|
|
7
|
+
private static _globalWrapper?;
|
|
8
|
+
static setGlobalWrapper(wrapper: React.ComponentType): void;
|
|
7
9
|
private readonly _processingListeners;
|
|
8
10
|
private readonly _abortedListeners;
|
|
9
11
|
private _stateListener;
|
package/models/Dialog.js
CHANGED
|
@@ -107,6 +107,9 @@ var Dialog = /** @class */ (function () {
|
|
|
107
107
|
}
|
|
108
108
|
// this._xrefs = {} as DialogExternalRefs<StockDialogRefs>;
|
|
109
109
|
}
|
|
110
|
+
Dialog.setGlobalWrapper = function (wrapper) {
|
|
111
|
+
Dialog._globalWrapper = wrapper;
|
|
112
|
+
};
|
|
110
113
|
Dialog.prototype.inject = function (args) {
|
|
111
114
|
// @ts-ignore
|
|
112
115
|
var t = new Dialog(this._apiRef, this._dialogOptions, this._initialValues, args);
|
|
@@ -200,7 +203,12 @@ var Dialog = /** @class */ (function () {
|
|
|
200
203
|
// root.render( React.createElement( DialogBase as React.ComponentType<
|
|
201
204
|
// typeof this._initialValues
|
|
202
205
|
// >, props ) );
|
|
203
|
-
root.render(React.createElement(
|
|
206
|
+
// root.render( React.createElement( DialogBase as React.ComponentType<BaseDialogProps<Values, I>>, props ) );
|
|
207
|
+
var element = React.createElement(DialogBase_1.default, props);
|
|
208
|
+
// Wrapper varsa sar, yoksa direkt render
|
|
209
|
+
root.render(Dialog._globalWrapper
|
|
210
|
+
? React.createElement(Dialog._globalWrapper, null, element)
|
|
211
|
+
: element);
|
|
204
212
|
};
|
|
205
213
|
return Dialog;
|
|
206
214
|
}());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-dialogger",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.136",
|
|
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
|
@@ -50,7 +50,7 @@ export interface BaseDialogProps<V extends Record<string, any>, I> {
|
|
|
50
50
|
root?: any;
|
|
51
51
|
keyboardListener: (key: string, dialog: IDialogApiDef<V, I>) => void;
|
|
52
52
|
resizeListener?: (size: IDialogSize, dialog: IDialogApiDef<V, I>) => void;
|
|
53
|
-
processingListeners?: Array<(inProcess: boolean) => void>;
|
|
53
|
+
processingListeners?: Array<(inProcess: boolean, message: string) => void>;
|
|
54
54
|
abortedListeners?: Array<(dialog: IDialogApiDef<V, I>) => void>;
|
|
55
55
|
zFinder: () => number;
|
|
56
56
|
}
|