@try-at-software/input-elements 1.2.5 → 1.2.6
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IChangingInputElement } from './IChangingInputElement';
|
|
1
|
+
import { IChangingInputElement, ResetValueOptions } from './IChangingInputElement';
|
|
2
2
|
import { UpdateCallback } from './IInputElement';
|
|
3
3
|
import { InputElement } from './InputElement';
|
|
4
4
|
export declare abstract class ChangingInputElement<TValue> extends InputElement implements IChangingInputElement<TValue> {
|
|
@@ -11,7 +11,7 @@ export declare abstract class ChangingInputElement<TValue> extends InputElement
|
|
|
11
11
|
/** @inheritdoc */
|
|
12
12
|
setValue(value: TValue): void;
|
|
13
13
|
/** @inheritdoc */
|
|
14
|
-
resetValue(): void;
|
|
14
|
+
resetValue(options?: ResetValueOptions): void;
|
|
15
15
|
protected abstract setInternalValue(value: TValue, isInitial: boolean): void;
|
|
16
16
|
protected abstract resetInternalValue(): void;
|
|
17
17
|
}
|
|
@@ -24,11 +24,11 @@ class ChangingInputElement extends InputElement_1.InputElement {
|
|
|
24
24
|
this.updateInternally();
|
|
25
25
|
}
|
|
26
26
|
/** @inheritdoc */
|
|
27
|
-
resetValue() {
|
|
27
|
+
resetValue(options) {
|
|
28
28
|
if (!this._valueIsSet && !this._initialValueIsSet)
|
|
29
29
|
return;
|
|
30
30
|
this._valueIsSet = false;
|
|
31
|
-
if (this._initialValueIsSet) {
|
|
31
|
+
if (!(options === null || options === void 0 ? void 0 : options.avoidFallbackToInitialValue) && this._initialValueIsSet) {
|
|
32
32
|
this._initialValueIsSet = false;
|
|
33
33
|
this.setInitialValue(this.initialValue);
|
|
34
34
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { IInputElement } from './IInputElement';
|
|
2
|
+
export declare type ResetValueOptions = {
|
|
3
|
+
avoidFallbackToInitialValue?: boolean;
|
|
4
|
+
};
|
|
2
5
|
export interface IChangingInputElement<TValue> extends IInputElement {
|
|
3
6
|
/**
|
|
4
7
|
* A method used to set new value, validate it and update the form.
|
|
@@ -13,6 +16,8 @@ export interface IChangingInputElement<TValue> extends IInputElement {
|
|
|
13
16
|
setInitialValue(value: TValue): void;
|
|
14
17
|
/**
|
|
15
18
|
* This method will reset the current value of the input element.
|
|
19
|
+
*
|
|
20
|
+
* @param options Additional options that can be used to refine the reset process.
|
|
16
21
|
*/
|
|
17
|
-
resetValue(): void;
|
|
22
|
+
resetValue(options?: ResetValueOptions): void;
|
|
18
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@try-at-software/input-elements",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
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",
|