@websolutespa/bom-mixer-forms 1.9.3 → 2.0.0

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/CHANGELOG.md CHANGED
@@ -1,114 +1,126 @@
1
- # @websolutespa/bom-mixer-forms
2
-
3
- ## 1.9.3
4
-
5
- ### Patch Changes
6
-
7
- - Modified: FormEmitter, FormAbstract, FormAbstractCollection
8
-
9
- ## 1.9.2
10
-
11
- ### Patch Changes
12
-
13
- - Added: emptyErrors
14
-
15
- ## 1.9.1
16
-
17
- ### Patch Changes
18
-
19
- - Added: FormState, FormEmitter
20
- - Modified: FormAbstract, FormAbstractCollection, useControl, useForm
21
-
22
- ## 1.9.0
23
-
24
- ### Minor Changes
25
-
26
- - Added: useFormSchema
27
-
28
- ## 1.8.1
29
-
30
- ### Patch Changes
31
-
32
- - 15ad595: Added: Validators parametric error key
33
-
34
- ## 1.8.0
35
-
36
- ### Patch Changes
37
-
38
- - Updated dependencies [f8a1d97]
39
- - @websolutespa/bom-core@1.8.0
40
- - @websolutespa/bom-mixer-hooks@1.8.0
41
-
42
- ## 0.3.5
43
-
44
- ### Patch Changes
45
-
46
- - Added: customData option
47
-
48
- ## 0.3.4
49
-
50
- ### Patch Changes
51
-
52
- - Removed: log
53
-
54
- ## 0.3.3
55
-
56
- ### Patch Changes
57
-
58
- - Modified: validators, useFormBuilder
59
- - Updated dependencies
60
- - @websolutespa/bom-core@1.7.9
61
-
62
- ## 0.3.2
63
-
64
- ### Patch Changes
65
-
66
- - Fixing: downgrading eslint to v8.56.0
67
- - Updated dependencies
68
- - @websolutespa/bom-mixer-hooks@1.7.4
69
- - @websolutespa/bom-core@1.7.8
70
-
71
- ## 0.3.1
72
-
73
- ### Patch Changes
74
-
75
- - Updating: dependencies
76
- - Updated dependencies
77
- - @websolutespa/bom-mixer-hooks@1.7.2
78
- - @websolutespa/bom-core@1.7.3
79
-
80
- ## 0.3.0
81
-
82
- ### Minor Changes
83
-
84
- - Updating: next 13.
85
-
86
- ## 0.2.2
87
-
88
- ### Patch Changes
89
-
90
- - Removed: unnecessary method deepCopy.
91
-
92
- ## 0.2.1
93
-
94
- ### Patch Changes
95
-
96
- - Added: source files.
97
-
98
- ## 0.2.0
99
-
100
- ### Minor Changes
101
-
102
- - Added: splat routes.
103
-
104
- ## 0.1.0
105
-
106
- ### Minor Changes
107
-
108
- - Added: @websolutespa/bom-core.
109
-
110
- ## 0.0.2
111
-
112
- ### Patch Changes
113
-
114
- - Added: first release.
1
+ # @websolutespa/bom-mixer-forms
2
+
3
+ ## 2.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - Release: Bom 2.0
8
+
9
+ ## 1.9.4
10
+
11
+ ### Patch Changes
12
+
13
+ - Added: propagation to updateStateAndChange\_
14
+
15
+ ## 1.9.3
16
+
17
+ ### Patch Changes
18
+
19
+ - Modified: FormEmitter, FormAbstract, FormAbstractCollection
20
+
21
+ ## 1.9.2
22
+
23
+ ### Patch Changes
24
+
25
+ - Added: emptyErrors
26
+
27
+ ## 1.9.1
28
+
29
+ ### Patch Changes
30
+
31
+ - Added: FormState, FormEmitter
32
+ - Modified: FormAbstract, FormAbstractCollection, useControl, useForm
33
+
34
+ ## 1.9.0
35
+
36
+ ### Minor Changes
37
+
38
+ - Added: useFormSchema
39
+
40
+ ## 1.8.1
41
+
42
+ ### Patch Changes
43
+
44
+ - 15ad595: Added: Validators parametric error key
45
+
46
+ ## 1.8.0
47
+
48
+ ### Patch Changes
49
+
50
+ - Updated dependencies [f8a1d97]
51
+ - @websolutespa/bom-core@1.8.0
52
+ - @websolutespa/bom-mixer-hooks@1.8.0
53
+
54
+ ## 0.3.5
55
+
56
+ ### Patch Changes
57
+
58
+ - Added: customData option
59
+
60
+ ## 0.3.4
61
+
62
+ ### Patch Changes
63
+
64
+ - Removed: log
65
+
66
+ ## 0.3.3
67
+
68
+ ### Patch Changes
69
+
70
+ - Modified: validators, useFormBuilder
71
+ - Updated dependencies
72
+ - @websolutespa/bom-core@1.7.9
73
+
74
+ ## 0.3.2
75
+
76
+ ### Patch Changes
77
+
78
+ - Fixing: downgrading eslint to v8.56.0
79
+ - Updated dependencies
80
+ - @websolutespa/bom-mixer-hooks@1.7.4
81
+ - @websolutespa/bom-core@1.7.8
82
+
83
+ ## 0.3.1
84
+
85
+ ### Patch Changes
86
+
87
+ - Updating: dependencies
88
+ - Updated dependencies
89
+ - @websolutespa/bom-mixer-hooks@1.7.2
90
+ - @websolutespa/bom-core@1.7.3
91
+
92
+ ## 0.3.0
93
+
94
+ ### Minor Changes
95
+
96
+ - Updating: next 13.
97
+
98
+ ## 0.2.2
99
+
100
+ ### Patch Changes
101
+
102
+ - Removed: unnecessary method deepCopy.
103
+
104
+ ## 0.2.1
105
+
106
+ ### Patch Changes
107
+
108
+ - Added: source files.
109
+
110
+ ## 0.2.0
111
+
112
+ ### Minor Changes
113
+
114
+ - Added: splat routes.
115
+
116
+ ## 0.1.0
117
+
118
+ ### Minor Changes
119
+
120
+ - Added: @websolutespa/bom-core.
121
+
122
+ ## 0.0.2
123
+
124
+ ### Patch Changes
125
+
126
+ - Added: first release.
package/dist/index.js CHANGED
@@ -313,8 +313,16 @@ var FormEmitter = class extends EventEmitter {
313
313
  }
314
314
  }
315
315
  set options(options) {
316
+ var _a, _b;
316
317
  if (this.options_ !== options) {
317
318
  this.options_ = options;
319
+ const value = ((_a = this.optionsExtra) == null ? void 0 : _a.asEquatable) ? this.value : String((_b = this.value) == null ? void 0 : _b.id);
320
+ if (!(options == null ? void 0 : options.some((x) => String(x.id) === value))) {
321
+ this.value_ = null;
322
+ this.state_.dirty = false;
323
+ this.state_.touched = false;
324
+ this.state_.submitted = false;
325
+ }
318
326
  this.markAsDirty_ = true;
319
327
  }
320
328
  }
@@ -559,7 +567,7 @@ var FormAbstract = class extends FormEmitter {
559
567
  updateStateAndChange_() {
560
568
  return __async(this, null, function* () {
561
569
  this.updateState_();
562
- return this.change_();
570
+ return this.change_(true);
563
571
  });
564
572
  }
565
573
  updateState_() {
package/dist/index.mjs CHANGED
@@ -263,8 +263,16 @@ var FormEmitter = class extends EventEmitter {
263
263
  }
264
264
  }
265
265
  set options(options) {
266
+ var _a, _b;
266
267
  if (this.options_ !== options) {
267
268
  this.options_ = options;
269
+ const value = ((_a = this.optionsExtra) == null ? void 0 : _a.asEquatable) ? this.value : String((_b = this.value) == null ? void 0 : _b.id);
270
+ if (!(options == null ? void 0 : options.some((x) => String(x.id) === value))) {
271
+ this.value_ = null;
272
+ this.state_.dirty = false;
273
+ this.state_.touched = false;
274
+ this.state_.submitted = false;
275
+ }
268
276
  this.markAsDirty_ = true;
269
277
  }
270
278
  }
@@ -509,7 +517,7 @@ var FormAbstract = class extends FormEmitter {
509
517
  updateStateAndChange_() {
510
518
  return __async(this, null, function* () {
511
519
  this.updateState_();
512
- return this.change_();
520
+ return this.change_(true);
513
521
  });
514
522
  }
515
523
  updateState_() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/bom-mixer-forms",
3
- "version": "1.9.3",
3
+ "version": "2.0.0",
4
4
  "description": "Mixer Forms module of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",
@@ -24,18 +24,18 @@
24
24
  },
25
25
  "dependencies": {},
26
26
  "peerDependencies": {
27
- "@websolutespa/bom-core": "*",
28
- "@websolutespa/bom-mixer-hooks": "*",
27
+ "@websolutespa/bom-core": "^2.0.0",
28
+ "@websolutespa/bom-mixer-hooks": "^2.0.0",
29
29
  "react": ">= 18.2.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/react": "^18.2.75",
33
33
  "@types/react-dom": "^18.2.24",
34
- "@websolutespa/bom-cli": "*",
35
- "@websolutespa/test": "*",
36
- "@websolutespa/tsconfig": "*",
34
+ "@websolutespa/bom-cli": "^2.0.0",
35
+ "@websolutespa/test": "^2.0.0",
36
+ "@websolutespa/tsconfig": "^2.0.0",
37
37
  "eslint": "^8.56.0",
38
- "eslint-config-websolute": "*",
38
+ "eslint-config-websolute": "^2.0.0",
39
39
  "raw-loader": "^4.0.2",
40
40
  "ts-node": "^10.9.2",
41
41
  "tsup": "^6.7.0",
@@ -141,14 +141,14 @@ export class FormAbstract<T = FormValue> extends FormEmitter {
141
141
  protected async updateStateAndChange_(): Promise<boolean> {
142
142
  // console.log('FormAbstract.updateStateAndChange_', this.name);
143
143
  this.updateState_();
144
- return this.change_();
144
+ return this.change_(true);
145
145
  }
146
146
 
147
147
  protected updateState_() {
148
148
  }
149
149
 
150
150
  change_(propagate: boolean = false): boolean {
151
- // console.log('FormAbstract.change_', this.name, propagate);
151
+ // console.log('FormAbstract.change_', this.name, 'parent', this.parent, 'propagate', propagate);
152
152
  if (this.emitChange_() && this.parent && propagate) {
153
153
  this.parent.markAsDirty_ = true;
154
154
  this.parent.change_.call(this.parent);
@@ -109,6 +109,15 @@ export class FormEmitter<T = FormValue> extends EventEmitter {
109
109
  set options(options: IOption[] | undefined) {
110
110
  if (this.options_ !== options) {
111
111
  this.options_ = options;
112
+ const value = this.optionsExtra?.asEquatable ?
113
+ this.value :
114
+ String((this.value as IOption)?.id);
115
+ if (!options?.some(x => String(x.id) === value)) {
116
+ this.value_ = null;
117
+ this.state_.dirty = false;
118
+ this.state_.touched = false;
119
+ this.state_.submitted = false;
120
+ }
112
121
  this.markAsDirty_ = true;
113
122
  }
114
123
  }