@try-at-software/input-elements 1.2.4 → 1.2.5

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.
@@ -13,4 +13,5 @@ export declare abstract class ChangingInputElement<TValue> extends InputElement
13
13
  /** @inheritdoc */
14
14
  resetValue(): void;
15
15
  protected abstract setInternalValue(value: TValue, isInitial: boolean): void;
16
+ protected abstract resetInternalValue(): void;
16
17
  }
@@ -27,8 +27,13 @@ class ChangingInputElement extends InputElement_1.InputElement {
27
27
  resetValue() {
28
28
  if (!this._valueIsSet && !this._initialValueIsSet)
29
29
  return;
30
- this.setInternalValue(undefined, false);
31
- this.updateInternally();
30
+ this._valueIsSet = false;
31
+ if (this._initialValueIsSet) {
32
+ this._initialValueIsSet = false;
33
+ this.setInitialValue(this.initialValue);
34
+ }
35
+ else
36
+ this.resetInternalValue();
32
37
  }
33
38
  }
34
39
  exports.ChangingInputElement = ChangingInputElement;
@@ -41,5 +41,7 @@ export declare class DynamicListInputElement<TValue> extends ExtendedInputElemen
41
41
  private reorder;
42
42
  private convert;
43
43
  protected setInternalValue(valueChange: IDynamicValueChange<TValue>[], isInitial: boolean): void;
44
+ /** @inheritdoc */
45
+ protected resetInternalValue(): void;
44
46
  private filterInputs;
45
47
  }
@@ -110,6 +110,10 @@ class DynamicListInputElement extends ExtendedInputElement_1.ExtendedInputElemen
110
110
  this._inputs = newInputs;
111
111
  (_a = this._componentRef.current) === null || _a === void 0 ? void 0 : _a.update(this._inputs);
112
112
  }
113
+ /** @inheritdoc */
114
+ resetInternalValue() {
115
+ this._inputs = [];
116
+ }
113
117
  filterInputs() {
114
118
  var _a;
115
119
  return (_a = this._inputs) === null || _a === void 0 ? void 0 : _a.filter((i) => !!(i === null || i === void 0 ? void 0 : i.input));
@@ -26,6 +26,8 @@ export declare class SingleValueInputElement<TValue, TOperativeProps, TDynamicPr
26
26
  /** @inheritdoc */
27
27
  protected setInternalValue(value: TValue, isInitial: boolean): void;
28
28
  /** @inheritdoc */
29
+ protected resetInternalValue(): void;
30
+ /** @inheritdoc */
29
31
  get hasChanges(): boolean;
30
32
  /** @inheritdoc */
31
33
  value: TValue;
@@ -78,6 +78,17 @@ class SingleValueInputElement extends ExtendedInputElement_1.ExtendedInputElemen
78
78
  this.invalidValueChangeSubscriptions.forEach((x) => x === null || x === void 0 ? void 0 : x());
79
79
  }
80
80
  /** @inheritdoc */
81
+ resetInternalValue() {
82
+ var _a;
83
+ this.setError(undefined);
84
+ this.value = undefined;
85
+ if (this._isInvalidated)
86
+ this._isInvalidated = false;
87
+ if ((_a = this._componentRef) === null || _a === void 0 ? void 0 : _a.current)
88
+ this._componentRef.current.update(undefined);
89
+ this.updateInternally();
90
+ }
91
+ /** @inheritdoc */
81
92
  get hasChanges() {
82
93
  var _a;
83
94
  return !!((_a = this._configuration) === null || _a === void 0 ? void 0 : _a.comparator)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@try-at-software/input-elements",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "A package providing different input elements that are extensible and easily configurable for your custom needs.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",