react-dialogger 1.1.17 → 1.1.18

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.
@@ -14,6 +14,7 @@ declare class DialogBase extends Component<BaseDialogProps, BaseDialogState> {
14
14
  protected _innerRef: React.RefObject<any>;
15
15
  protected _stateListener: TDialogStateListenerCallbackType;
16
16
  protected _keyboardListener: (key: string, dialog: IDialogDef) => void;
17
+ protected _resizeListener: (size: IDialogSize, dialog: IDialogDef) => void;
17
18
  protected _initialHolder: TInitialHolder;
18
19
  protected _accessFrom: TAccessFrom;
19
20
  protected _header: TDialogCallbackNodeFn;
@@ -52,6 +53,7 @@ declare class DialogBase extends Component<BaseDialogProps, BaseDialogState> {
52
53
  protected _initialState: TInitialValues<any>;
53
54
  protected _initialValues: DialogValues;
54
55
  readonly state: Readonly<BaseDialogState>;
56
+ private _resizeListenersStore;
55
57
  /**
56
58
  * The error you're encountering
57
59
  * is related to the type of the props passed to the
@@ -77,6 +79,7 @@ declare class DialogBase extends Component<BaseDialogProps, BaseDialogState> {
77
79
  setValue(key: string, values: any): void;
78
80
  private dialogAutoPos;
79
81
  componentDidMount(): void;
82
+ onResize(callbackFn: (size: IDialogSize, dialog: IDialogDef) => void): void;
80
83
  componentDidUpdate(prevProps: Readonly<BaseDialogProps>, prevState: Readonly<BaseDialogState>, snapshot?: any): void;
81
84
  componentWillUnmount(): void;
82
85
  setState<K extends keyof BaseDialogState>(state: ((prevState: Readonly<BaseDialogState>, props: Readonly<BaseDialogProps>) => (Pick<BaseDialogState, K> | BaseDialogState | null)) | Pick<BaseDialogState, K> | BaseDialogState | null, callback?: () => void): void;
@@ -86,6 +89,7 @@ declare class DialogBase extends Component<BaseDialogProps, BaseDialogState> {
86
89
  protected addAction(action: DialogAction): DialogBase;
87
90
  stateListener(listener: TDialogStateListenerCallbackType): DialogBase;
88
91
  protected keyboardListener(listener: (key: string, dialog: IDialogDef) => void): DialogBase;
92
+ protected resizeListener(listener: (size: IDialogSize, dialog: IDialogDef) => void): DialogBase;
89
93
  protected initialHolder(holder: TInitialHolder): DialogBase;
90
94
  protected onClose(callback: TDialogCallbackVoidFn): DialogBase;
91
95
  setInProcess_noRef: (process: boolean, message?: string, holder?: TInitialHolder) => DialogBase;
@@ -560,6 +560,7 @@ var DialogBase = /** @class */ (function (_super) {
560
560
  // Initialize Slots
561
561
  // this._slots = this._dialogOptions.base.slots
562
562
  _this._initialValues = props.initialValues;
563
+ _this._resizeListenersStore = [];
563
564
  return _this;
564
565
  }
565
566
  Object.defineProperty(DialogBase.prototype, "parent", {
@@ -673,6 +674,17 @@ var DialogBase = /** @class */ (function (_super) {
673
674
  this._dialogRef.current.focus();
674
675
  if (this._Resizeable) {
675
676
  this._Resizeable.setContainer(this._dialogRef.current);
677
+ if (typeof this.props.resizeListener === "function") {
678
+ this._resizeListenersStore.push(this.props.resizeListener);
679
+ this._Resizeable.onResizeListener(function (width, height) {
680
+ // this.props.resizeListener({width, height}, this);
681
+ // Butun eklenmis Resize collbackler ayni anda maplenerek cevap veriliyor
682
+ _this._resizeListenersStore.map(function (itemCallback) {
683
+ // @ts-ignore
684
+ itemCallback({ width: width, height: height }, _this);
685
+ });
686
+ });
687
+ }
676
688
  }
677
689
  }
678
690
  // Initialize SlotsProps
@@ -688,6 +700,25 @@ var DialogBase = /** @class */ (function (_super) {
688
700
  // Parent objesinin accessFrom özelliğini ayarla
689
701
  this.props.parent.accessFrom = "internal";
690
702
  };
703
+ DialogBase.prototype.onResize = function (callbackFn) {
704
+ if (typeof callbackFn === "function") {
705
+ // Header body veya baska biserden gelen callback i storla
706
+ // Bu olay overwite olmasinin onune gecer
707
+ // Cunku en sonku callback calistirildigi icin ornedin header ve
708
+ this._resizeListenersStore.push(callbackFn);
709
+ // if(this._Resizeable){
710
+ // this._Resizeable.onResizeListener((width, height) => {
711
+ // // @ts-ignore
712
+ // callbackFn({width, height}, this);
713
+ // });
714
+ // }
715
+ }
716
+ };
717
+ // onResize: (callbackFn: (size: IDialogSize, dialog: IDialogDef) => void){
718
+ // if(typeof callbackFn === "function"){
719
+ //
720
+ // }
721
+ // }
691
722
  DialogBase.prototype.componentDidUpdate = function (prevProps, prevState, snapshot) {
692
723
  /*if(this._dialogRef.current && this._dialogOptions.base.resizeable && !this._Resizeable){
693
724
  console.log('this._Resizeable.onResizeListener', this._Resizeable );
@@ -767,6 +798,10 @@ var DialogBase = /** @class */ (function (_super) {
767
798
  this._keyboardListener = listener;
768
799
  return this;
769
800
  };
801
+ DialogBase.prototype.resizeListener = function (listener) {
802
+ this._resizeListener = listener;
803
+ return this;
804
+ };
770
805
  DialogBase.prototype.initialHolder = function (holder) {
771
806
  this._initialHolder = holder;
772
807
  return this;
@@ -859,6 +894,7 @@ var DialogBase = /** @class */ (function (_super) {
859
894
  dialogSize: this._dialogSize,
860
895
  didMountCallback: callback,
861
896
  keyboardListener: this._keyboardListener,
897
+ resizeListener: this._resizeListener,
862
898
  /**Dialog order with Reference Element, like before-after-same reference*/
863
899
  order: this._order,
864
900
  // initialState: this._initialState,
@@ -39,6 +39,7 @@ declare class Dialog extends DialogBase {
39
39
  getDom: () => HTMLDivElement;
40
40
  onClose(callback: TDialogCallbackVoidFn): this;
41
41
  keyboardListener(listener: (key: string, dialog: IDialogDef) => void): this;
42
+ resizeListener(listener: (size: IDialogSize, dialog: IDialogDef) => void): this;
42
43
  show: (callback?: TDialogCallbackVoidFn) => void;
43
44
  }
44
45
  export default Dialog;
package/models/Dialog.js CHANGED
@@ -137,6 +137,10 @@ var Dialog = /** @class */ (function (_super) {
137
137
  _super.prototype.keyboardListener.call(this, listener); // overrided and return current dialog instance directly
138
138
  return this;
139
139
  };
140
+ Dialog.prototype.resizeListener = function (listener) {
141
+ _super.prototype.resizeListener.call(this, listener);
142
+ return this;
143
+ };
140
144
  return Dialog;
141
145
  }(DialogBase_1.default));
142
146
  exports.default = Dialog;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-dialogger",
3
- "version": "1.1.17",
3
+ "version": "1.1.18",
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",
@@ -35,6 +35,7 @@ export interface BaseDialogProps {
35
35
  onClose?: TDialogCallbackVoidFn;
36
36
  root?: any;
37
37
  keyboardListener: (key: string, dialog: Dialog) => void;
38
+ resizeListener?: (size: IDialogSize, dialog: Dialog) => void;
38
39
  }
39
40
  export interface IDialogSize {
40
41
  width?: ITypeWidth | number;
@@ -117,7 +118,7 @@ export type TDialogStateListenerCallbackType = (state: IStateDef, values: Dialog
117
118
  type TDialogCallbackFn<T> = (dialog?: IDialogDef) => T;
118
119
  export type TDialogCallbackNodeFn = TDialogCallbackFn<string | React.ReactElement<any>> | React.ReactNode | React.JSX.Element;
119
120
  export type TDialogCallbackVoidFn = TDialogCallbackFn<void>;
120
- export interface IDialogDef extends Omit<Partial<Pick<DialogBase, 'isInProcess' | 'setInProcess' | 'values' | 'setValue' | 'setValues' | 'close' | 'dialogOptions' | 'switchFullScreen' | 'actions' | 'snackbar' | 'formikValidate' | 'formikProps' | 'focus' | 'setOrder' | 'setBody'>>, 'switchFullScreen'> {
121
+ 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'> {
121
122
  /** @deprecated Deprecated, use setValues instead. */
122
123
  switchFullScreen?: DialogBase['switchFullScreen'];
123
124
  /** @deprecated Deprecated, never use. */
package/types/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- export { IFooterProps, IHeaderProps, IBaseFooterProps, IBaseHeaderProps, IDialogCloseRef, IDialogDef, } from "./DialogTypes";
1
+ export { IFooterProps, IHeaderProps, IBaseFooterProps, IBaseHeaderProps, IDialogCloseRef, IDialogDef, // <-- Required
2
+ IDialogSize } from "./DialogTypes";
2
3
  export { DialogValues } from "./types";
3
4
  export { ActionDef, ActionDialogDef, // <-- Action -> Dialog dialog of action
4
5
  IDialogActionDef } from "./DialogActionTypes";