@try-at-software/input-elements 1.2.0-beta.1 → 1.2.0-beta.4
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.
|
@@ -3,12 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.LabelRenderer = void 0;
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const react_1 = require("@fluentui/react");
|
|
6
|
+
const FormTextRenderer_1 = require("./FormTextRenderer");
|
|
6
7
|
const LabelRendererComponent = (props) => {
|
|
7
8
|
if (!props)
|
|
8
9
|
return null;
|
|
9
10
|
const { label, required } = props;
|
|
10
11
|
if (!label)
|
|
11
12
|
return null;
|
|
12
|
-
return React.createElement(react_1.Label, { required: required },
|
|
13
|
+
return (React.createElement(react_1.Label, { required: required },
|
|
14
|
+
React.createElement(FormTextRenderer_1.FormTextRenderer, { text: label })));
|
|
13
15
|
};
|
|
14
16
|
exports.LabelRenderer = React.memo(LabelRendererComponent);
|
|
@@ -22,7 +22,7 @@ const DropdownInputComponent = (props) => {
|
|
|
22
22
|
React.createElement(Components_1.LabelRenderer, { label: props.label, required: !!props.renderRequiredIndicator }),
|
|
23
23
|
React.createElement(DropdownComponent, { "data-automationid": "dropdown-input", options: normalizedOptions, onChange: (_event, option) => !!props.onChange && props.onChange(option.key), placeholder: operativeProps.placeholder,
|
|
24
24
|
// This value should never be `undefined`.
|
|
25
|
-
|
|
25
|
+
selectedKey: props.value || ((_a = dynamicProps.defaultOption) === null || _a === void 0 ? void 0 : _a.key) || null, disabled: dynamicProps.isDisabled }),
|
|
26
26
|
React.createElement(Components_1.ErrorRenderer, { error: props.errorMessage, messageBarType: react_1.MessageBarType.error })));
|
|
27
27
|
};
|
|
28
28
|
exports.DropdownInput = React.memo(DropdownInputComponent);
|
|
@@ -63,15 +63,16 @@ class SingleValueInputElement extends ExtendedInputElement_1.ExtendedInputElemen
|
|
|
63
63
|
var _a;
|
|
64
64
|
if (this._isInvalidated)
|
|
65
65
|
this._isInvalidated = false;
|
|
66
|
+
const previousValue = this.value;
|
|
66
67
|
this.value = value;
|
|
67
68
|
if ((_a = this._componentRef) === null || _a === void 0 ? void 0 : _a.current)
|
|
68
69
|
this._componentRef.current.update(value);
|
|
69
70
|
this.validate();
|
|
70
71
|
if (this.isValid) {
|
|
71
72
|
if (isInitial)
|
|
72
|
-
this.initialValueChangeSubscriptions.forEach((x) => x === null || x === void 0 ? void 0 : x(this.value));
|
|
73
|
+
this.initialValueChangeSubscriptions.forEach((x) => x === null || x === void 0 ? void 0 : x(this.value, previousValue));
|
|
73
74
|
else
|
|
74
|
-
this.valueChangeSubscriptions.forEach((x) => x === null || x === void 0 ? void 0 : x(this.value));
|
|
75
|
+
this.valueChangeSubscriptions.forEach((x) => x === null || x === void 0 ? void 0 : x(this.value, previousValue));
|
|
75
76
|
}
|
|
76
77
|
else
|
|
77
78
|
this.invalidValueChangeSubscriptions.forEach((x) => x === null || x === void 0 ? void 0 : x());
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare type ValueChangeSubscription<TValue> = (newValue: TValue) => void;
|
|
1
|
+
export declare type ValueChangeSubscription<TValue> = (newValue: TValue, previousValue: TValue) => void;
|
|
2
2
|
export declare type InvalidValueChangeSubscription = () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@try-at-software/input-elements",
|
|
3
|
-
"version": "1.2.0-beta.
|
|
3
|
+
"version": "1.2.0-beta.4",
|
|
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",
|