react-dialogger 1.1.50 → 1.1.52

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.
@@ -42,6 +42,8 @@ declare class DialogActionBase extends Component<ActionProps, ActionState> {
42
42
  * @deprecated
43
43
  * @see use isDisabled */
44
44
  getDisabled: () => boolean;
45
+ /**
46
+ * @deprecated use Options*/
45
47
  isDisabled: () => boolean;
46
48
  setInProcess: (inProcess: boolean) => DialogActionBase;
47
49
  isInProcess: () => boolean;
@@ -121,6 +121,8 @@ var DialogActionBase = /** @class */ (function (_super) {
121
121
  _this.getDisabled = function () {
122
122
  return _this._options.disabled;
123
123
  };
124
+ /**
125
+ * @deprecated use Options*/
124
126
  _this.isDisabled = function () {
125
127
  return _this._options.disabled;
126
128
  };
@@ -38,6 +38,7 @@ declare class DialogBase<Values extends Record<string, any>> extends Component<B
38
38
  private readonly _dialogWithBackDropRef;
39
39
  protected readonly _parent: Dialog;
40
40
  private _accessFrom;
41
+ private _processingListener;
41
42
  constructor(props?: Readonly<BaseDialogProps>);
42
43
  get parent(): Dialog;
43
44
  get dialogTranslate(): {
@@ -63,8 +64,10 @@ declare class DialogBase<Values extends Record<string, any>> extends Component<B
63
64
  close: (callbackFn?: () => void) => void;
64
65
  focus: () => void;
65
66
  get actions(): {
66
- [key: string]: Pick<DialogActionBase, "setOptions" | "setInProcess" | "getLabel" | "options" | "click" | "remove">;
67
+ [key: string]: Pick<DialogActionBase, "setOptions" | "setInProcess" | "getLabel" | "options" | "click" | "remove" | "name">;
67
68
  };
69
+ updateBody(body: TDialogCallbackFn): void;
70
+ processingListener(listener: (inProcess: boolean) => void): this;
68
71
  getDom: () => HTMLDivElement;
69
72
  get snackbar(): {
70
73
  open: (message: string, severity: TSeverity, key?: string, action?: ((key: string, snackbarRef: any) => ReactNode | void), autoHideDuration?: number | null) => void;
@@ -126,6 +126,9 @@ var DialogBase = /** @class */ (function (_super) {
126
126
  if (!process) {
127
127
  _this.snackbar.close("kInProcess");
128
128
  }
129
+ if (typeof _this._processingListener === "function") {
130
+ _this._processingListener(process);
131
+ }
129
132
  // @ts-ignore
130
133
  (_c = _this._footerRef.current) === null || _c === void 0 ? void 0 : _c.setProcessing(process);
131
134
  return _this;
@@ -166,13 +169,14 @@ var DialogBase = /** @class */ (function (_super) {
166
169
  console.log('this._prevDialogRect', _this.state.prevDialogRect);
167
170
  return (0, jsx_runtime_1.jsx)(_1.DialogWithBackdropWrapper, { initialValues: _this.props.initialValues, dialog: _this,
168
171
  // Component
169
- header: _this.props.header, body: _this.props.body, actions: _this.props.actions,
172
+ header: _this.props.header, body: _this.state.body, actions: _this.props.actions,
170
173
  // Refs Props
171
174
  ref: _this._dialogWithBackDropRef, dialogRef: _this._dialogRef, headerRef: _this._headerRef, bodyRef: _this._dialogBodyRef, footerRef: _this._footerRef, backdropRef: _this._backdropRef, snackbarRef: _this._snackbarRef, prevDialogRect: _this.state.prevDialogRect });
172
175
  };
173
176
  _this.state = {
174
177
  inProcess: { inProcess: false },
175
- prevDialogRect: (0, dialogRectAuto_1.dialogRectAuto)()
178
+ prevDialogRect: (0, dialogRectAuto_1.dialogRectAuto)(),
179
+ body: props.body
176
180
  };
177
181
  console.log('Class_Type', _this instanceof DialogBase);
178
182
  var defaultOptions = {
@@ -218,6 +222,7 @@ var DialogBase = /** @class */ (function (_super) {
218
222
  _this._initialValues = props.initialValues;
219
223
  _this._dialogWithBackDropRef = (0, react_1.createRef)();
220
224
  _this._parent = props.parent;
225
+ _this._processingListener = props.processingListener;
221
226
  console.log('this._dialogOptions', _this._dialogOptions);
222
227
  return _this;
223
228
  }
@@ -392,6 +397,15 @@ var DialogBase = /** @class */ (function (_super) {
392
397
  enumerable: false,
393
398
  configurable: true
394
399
  });
400
+ DialogBase.prototype.updateBody = function (body) {
401
+ var _this = this;
402
+ this.setState(function (prevState) { return (__assign(__assign({}, _this.state), { body: body })); });
403
+ };
404
+ DialogBase.prototype.processingListener = function (listener) {
405
+ // @ts-ignore
406
+ this._processingListener = listener;
407
+ return this;
408
+ };
395
409
  Object.defineProperty(DialogBase.prototype, "snackbar", {
396
410
  // Reference: https://notistack.com/api-reference#mutual-props
397
411
  get: function () {
package/models/Dialog.js CHANGED
@@ -150,7 +150,7 @@ var Dialog = /** @class */ (function () {
150
150
  // Refs
151
151
  headerRef: this._headerRef,
152
152
  // Listeners
153
- stateListener: this._stateListener, keyboardListener: this._keyboardListener, resizeListener: this._resizeListener,
153
+ stateListener: this._stateListener, keyboardListener: this._keyboardListener, resizeListener: this._resizeListener, processingListener: this._processingListener,
154
154
  // Others
155
155
  dialogSize: this._dialogSize, initialHolder: this._initialHolder, snackbarAnchor: this._snackbarAnchor, root: root, dom: dom, parent: this }, this._apiRef ? { ref: this._apiRef } : null), { onClose: this._onCloseCallback });
156
156
  // @ts-ignore
@@ -49,6 +49,57 @@ var DialogAction = /** @class */ (function (_super) {
49
49
  _super.prototype.onClick.call(_this, callback);
50
50
  return _this;
51
51
  };
52
+ // /**
53
+ // * @deprecated
54
+ // * @see onClickHandler */
55
+ // public getAction(): DialogActionType {
56
+ // return this._onClick;
57
+ // }
58
+ // /**
59
+ // * @deprecated
60
+ // * @see DialogActionOptionsType
61
+ // * @info Define this prop inside new DialogAction('varName', {>here<})*/
62
+ // setVariant = ( variant: TBVariant): this => {
63
+ // if( this._baseDialogAction?.dialogBaseComponent.parent.accessFrom === "internal"){
64
+ // this._baseDialogAction.setVariant(variant);
65
+ // return this;
66
+ // }
67
+ // if (this._options) {
68
+ // this._options.variant = variant; // _options'ın başlatıldığını varsayarak erişim
69
+ // } else {
70
+ // console.error('DialogAction _options is not initialized');
71
+ // }
72
+ // return this;
73
+ // }
74
+ // getVariant = (): TBVariant => {
75
+ // if( this._baseDialogAction?.dialogBaseComponent.parent.accessFrom === "internal"){
76
+ // return this._baseDialogAction.getVariant();
77
+ // }
78
+ // return this._options.variant;
79
+ // }
80
+ // /**
81
+ // * @deprecated
82
+ // * @see DialogActionOptionsType
83
+ // * @info Define this prop inside new DialogAction('varName', {>here<})*/
84
+ // setColor = ( color: TBColor): this => {
85
+ // if( this._baseDialogAction?.dialogBaseComponent.parent.accessFrom === "internal"){
86
+ // this._baseDialogAction.setColor(color);
87
+ // return this;
88
+ // }
89
+ // if (this._options) {
90
+ // this._options.color = color; // _options'ın başlatıldığını varsayarak erişim
91
+ // } else {
92
+ // console.error('DialogAction _options is not initialized');
93
+ // }
94
+ // return this;
95
+ // }
96
+ //
97
+ // getColor = (): TBColor => {
98
+ // if( this._baseDialogAction?.dialogBaseComponent.parent.accessFrom === "internal"){
99
+ // return this._baseDialogAction.getColor();
100
+ // }
101
+ // return this._options.color;
102
+ // }
52
103
  /**
53
104
  * Only from init */
54
105
  _this.stateListener = function (listener) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-dialogger",
3
- "version": "1.1.50",
3
+ "version": "1.1.52",
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",
@@ -6,8 +6,8 @@ import { CSSProperties } from "react";
6
6
  import * as React from "react";
7
7
  import { DialogAction } from "../models";
8
8
  export type ActionDialogDef = Omit<IDialogApiDef, 'switchFullScreen'>;
9
- export type ActionDef = Pick<DialogAction, 'onClick' | 'setInProcess' | 'getLabel' | 'getColor' | 'getVariant' | 'isDisabled' | 'setOptions' | 'isInProcess' | 'setLabel' | 'name'>;
10
- export type ActionBaseDef = Pick<DialogActionBase, 'setOptions' | 'setInProcess' | 'getLabel' | 'options' | 'click' | 'remove'>;
9
+ export type ActionDef = Pick<DialogAction, 'onClick' | 'setOptions' | 'name'>;
10
+ export type ActionBaseDef = Pick<DialogActionBase, 'setOptions' | 'setInProcess' | 'getLabel' | 'options' | 'click' | 'remove' | 'name'>;
11
11
  export interface IDialogActionDef extends ActionBaseDef {
12
12
  }
13
13
  export type DialogActionType = (button: ActionBaseDef, dialog: Omit<IDialogApiDef, 'switchFullScreen'>) => void;
@@ -18,6 +18,7 @@ export interface BaseDialogState {
18
18
  inProcess: IInProcess;
19
19
  fullscreenMode?: boolean;
20
20
  prevDialogRect: WithBackdrop['prevDialogRect'];
21
+ body: TDialogCallbackFn;
21
22
  }
22
23
  export interface BaseDialogProps {
23
24
  initialOptions?: DialogOptionsType;
@@ -36,6 +37,7 @@ export interface BaseDialogProps {
36
37
  root?: any;
37
38
  keyboardListener: (key: string, dialog: IDialogApiDef) => void;
38
39
  resizeListener?: (size: IDialogSize, dialog: IDialogApiDef) => void;
40
+ processingListener?: (inProcess: boolean) => void;
39
41
  }
40
42
  export interface IDialogSize {
41
43
  width?: ITypeWidth | number;
@@ -119,13 +121,13 @@ export interface BaseDialogSlotProps {
119
121
  }
120
122
  export interface IStateDef extends Pick<BaseDialogState, "values" | "fullscreenMode" | "inProcess"> {
121
123
  }
122
- export interface IListenerDialogDef extends Omit<IDialogApiDef, "state" | "values" | "setValues"> {
124
+ export interface IListenerDialogDef extends Omit<IDialogApiDef, "values" | "setValues"> {
123
125
  }
124
126
  export type TDialogStateListenerCallbackType = (values: FormikProps<any>['values'], dialog: IListenerDialogDef) => void;
125
127
  export type TDialogCallbackFn<T = React.ReactNode> = (dialog: IDialogApiDef) => T;
126
128
  export type TDialogHeader = TDialogCallbackFn | React.ReactNode | React.JSX.Element;
127
129
  export type TDialogCallbackVoidFn = TDialogCallbackFn<void>;
128
- export interface IDialogApiDef extends Pick<DialogBase<any>, 'isInProcess' | 'setInProcess' | 'values' | 'setValue' | 'setValues' | 'close' | 'dialogOptions' | 'actions' | 'snackbar' | 'formikValidate' | 'formikProps' | 'focus'> {
130
+ export interface IDialogApiDef extends Pick<DialogBase<any>, 'isInProcess' | 'setInProcess' | 'values' | 'setValue' | 'setValues' | 'close' | 'dialogOptions' | 'actions' | 'snackbar' | 'formikValidate' | 'formikProps' | 'focus' | 'updateBody' | 'processingListener'> {
129
131
  }
130
132
  export interface IDialogCloseRef extends Pick<DialogBase<any>, 'close'> {
131
133
  }