react-dialogger 1.1.117 → 1.1.118

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/README.md CHANGED
@@ -3,6 +3,9 @@
3
3
  npm i react-dialogger
4
4
  ```
5
5
 
6
+ Please use
7
+
8
+
6
9
  # GitHub
7
10
  You can find the example code and more information about the project on our [GitHub repository](https://github.com/appinsource2021/react-dialogger-example.git).
8
11
 
@@ -12,6 +15,83 @@ You can find the example code about the project on our [Codesandbox](https://cod
12
15
  # Youtube
13
16
  You can watch simple example on Youtube [Youtube](https://www.youtube.com/watch?v=vhSroEgdj1c)
14
17
 
18
+ #### ⚠️ Breaking Change: initialValues Scope Restriction
19
+ ` In previous versions, initialValues, setValue, and setValues were able to store any type of data, including:
20
+ Functions
21
+ Object references
22
+ Component refs
23
+ Arbitrary complex objects
24
+ This behavior has changed in the latest version.`
25
+
26
+ #### ✅ New Behavior
27
+ `initialValues now only supports serializable key–value data, such as:
28
+ Primitive values
29
+ Plain objects
30
+ Arrays
31
+ Collections that represent form/state data
32
+ Methods, functions, class instances, and object references are no longer supported in initialValues.
33
+ This change improves:
34
+ Predictability
35
+ State safety
36
+ Serialization compatibility
37
+ Debugging and maintainability`
38
+
39
+ #### 🔌 How to Pass Methods and References
40
+ * To pass methods or object references, use the new inject API.
41
+ ### Injection Example
42
+ ```js
43
+ dialog.inject({
44
+ myMethod,
45
+ myRef
46
+ });
47
+ ```
48
+
49
+ #### Accessing Injected Dependencies
50
+ * Injected dependencies are available via dialog.deps:
51
+ ```js
52
+ show(dialog => {
53
+ dialog.deps.myMethod('Suleyman');
54
+ dialog.deps.myRef.current;
55
+ });
56
+
57
+ ```
58
+
59
+ #### 🧠 Design Principle
60
+ * State (initialValues) → data only
61
+ * Behavior & references → dependency injection (inject)
62
+ * This separation enforces a clean architecture and prevents unintended side effects.
63
+
64
+
65
+ #### ❌ Invalid Usage (No Longer Supported)
66
+ ```js
67
+ initialValues: {
68
+ onSubmit: () => {},
69
+ tableRef: ref,
70
+ }
71
+ ```
72
+ #### ✅ Correct Usage
73
+ ```js
74
+ initialValues: {
75
+ status: 'active',
76
+ items: []
77
+ }
78
+
79
+ dialog.inject({
80
+ onSubmit,
81
+ tableRef
82
+ });
83
+ ```
84
+
85
+ #### 🚀 Migration Guide
86
+ `If you were previously storing functions or references inside initialValues:
87
+ Remove them from initialValues
88
+ Register them via dialog.inject(...)
89
+ Access them using dialog.deps.*`
90
+
91
+
92
+
93
+
94
+
15
95
  # Why react-dialogger?
16
96
  > react-dialogger is built for React applications that need dynamic, runtime-managed dialogs rather than static JSX-based modals.
17
97
  It enables centralized dialog configuration, action-driven logic, and dialog-owned state, making complex dialog flows easier to manage and scale.
@@ -60,6 +60,7 @@ declare class DialogBase<V, I> extends Component<BaseDialogProps<V, I>, BaseDial
60
60
  set inlineFormikProps(inlineFormikProps: IFormikAdapter);
61
61
  setValues<T>(values: Dialogify<T>, callbackFn?: () => void): void;
62
62
  componentDidMount(): void;
63
+ componentWillUnmount(): void;
63
64
  setInProcess: (process: boolean, message?: string, holder?: TInitialHolder) => this;
64
65
  isInProcess: () => IInProcess;
65
66
  private kill;
@@ -104,8 +104,7 @@ var DialogBase = /** @class */ (function (_super) {
104
104
  var currentDisabled = (_d = (_c = action.current) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.disabled;
105
105
  // Set the options with prevDisabled as the current disabled state
106
106
  if (currentDisabled !== process) {
107
- action.current
108
- .updateOptions(__assign(__assign({}, (_f = (_e = action.current) === null || _e === void 0 ? void 0 : _e.options) !== null && _f !== void 0 ? _f : {}), { prevDisabled: currentDisabled, disabled: process // Set the new disabled state based on the process
107
+ action === null || action === void 0 ? void 0 : action.current.updateOptions(__assign(__assign({}, (_f = (_e = action.current) === null || _e === void 0 ? void 0 : _e.options) !== null && _f !== void 0 ? _f : {}), { prevDisabled: currentDisabled, disabled: process // Set the new disabled state based on the process
109
108
  }));
110
109
  }
111
110
  }
@@ -154,7 +153,7 @@ var DialogBase = /** @class */ (function (_super) {
154
153
  };
155
154
  setTimeout(function () {
156
155
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
157
- if (((_b = (_a = _this._footerRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.inProcess) && !_this.state.aborted) {
156
+ if (((_b = (_a = _this._footerRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.inProcess.inProcess) && !_this.state.aborted) {
158
157
  var notify = (_e = (_d = (_c = _this._dialogOptions) === null || _c === void 0 ? void 0 : _c.base) === null || _d === void 0 ? void 0 : _d.notifyOnClosing) !== null && _e !== void 0 ? _e : "snackbar";
159
158
  if (notify === "snackbar") {
160
159
  var busyMessage = (_h = (_g = (_f = _this._dialogOptions) === null || _f === void 0 ? void 0 : _f.localText) === null || _g === void 0 ? void 0 : _g.busyMessage) !== null && _h !== void 0 ? _h : 'In Process, Please wait...';
@@ -375,6 +374,9 @@ var DialogBase = /** @class */ (function (_super) {
375
374
  // accessFrom Property of Parent object Internal->External
376
375
  this.accessFrom = "internal";
377
376
  };
377
+ DialogBase.prototype.componentWillUnmount = function () {
378
+ console.log('componentWillUnmount');
379
+ };
378
380
  DialogBase.prototype.kill = function (callbackFn) {
379
381
  var _this = this;
380
382
  // ReactDOM.unmountComponentAtNode(this.props.dom);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-dialogger",
3
- "version": "1.1.117",
3
+ "version": "1.1.118",
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",