@try-at-software/input-elements 1.2.0-aplha.5 → 1.2.0-beta.2
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/LICENSE +21 -0
- package/lib/ChangingInputElement.d.ts +16 -0
- package/lib/ChangingInputElement.js +34 -0
- package/lib/Components/Buttons/ClearButton.d.ts +10 -0
- package/lib/Components/Buttons/ClearButton.js +12 -0
- package/lib/Components/Buttons/index.d.ts +1 -0
- package/lib/Components/Buttons/index.js +13 -0
- package/lib/Components/Text/ErrorRenderer.d.ts +9 -0
- package/lib/Components/Text/ErrorRenderer.js +14 -0
- package/lib/Components/Text/FormTextRenderer.d.ts +8 -0
- package/lib/Components/Text/FormTextRenderer.js +19 -0
- package/lib/Components/Text/LabelRenderer.d.ts +8 -0
- package/lib/Components/Text/LabelRenderer.js +14 -0
- package/lib/Components/Text/Types.d.ts +2 -0
- package/lib/Components/Text/Types.js +2 -0
- package/lib/Components/Text/index.d.ts +4 -0
- package/lib/Components/Text/index.js +16 -0
- package/lib/Components/index.d.ts +2 -0
- package/lib/Components/index.js +14 -0
- package/lib/DynamicListInputElement/DynamicListInputElement.d.ts +1 -1
- package/lib/DynamicListInputElement/DynamicListInputElement.js +1 -1
- package/lib/DynamicListInputElement/IBasicMenuButtonConfiguration.d.ts +2 -1
- package/lib/DynamicListInputElement/IMenuButtonConfiguration.d.ts +0 -3
- package/lib/DynamicListInputElement/InternalPresentationComponents/DynamicListInputElementWrapper.d.ts +1 -1
- package/lib/DynamicListInputElement/InternalPresentationComponents/DynamicListInputElementWrapper.js +1 -1
- package/lib/DynamicListInputElement/Menu/DynamicListMenu.js +18 -12
- package/lib/DynamicListInputElement/Menu/index.js +1 -1
- package/lib/DynamicListInputElement/index.js +1 -1
- package/lib/ExtendedInputElement.d.ts +2 -13
- package/lib/ExtendedInputElement.js +2 -26
- package/lib/IInputElement.d.ts +2 -1
- package/lib/IInputElementConfiguration.d.ts +3 -2
- package/lib/ILoadingInputElementConfiguration.d.ts +2 -2
- package/lib/IValueInputElement.d.ts +2 -1
- package/lib/InputElement.d.ts +2 -1
- package/lib/InputElement.js +1 -1
- package/lib/Presentations/IPresentation.d.ts +2 -1
- package/lib/Presentations/PresentationRenderers.d.ts +1 -1
- package/lib/Presentations/PresentationRenderers.js +12 -9
- package/lib/Presentations/index.js +1 -1
- package/lib/SingleValueInputElements/Comparators/ArrayComparator.d.ts +3 -0
- package/lib/SingleValueInputElements/Comparators/ArrayComparator.js +5 -1
- package/lib/SingleValueInputElements/Comparators/DefaultEqualityComparer.d.ts +4 -0
- package/lib/SingleValueInputElements/Comparators/DefaultEqualityComparer.js +9 -0
- package/lib/SingleValueInputElements/Comparators/IEqualityComparer.d.ts +3 -0
- package/lib/SingleValueInputElements/Comparators/IEqualityComparer.js +2 -0
- package/lib/SingleValueInputElements/Comparators/index.d.ts +2 -0
- package/lib/SingleValueInputElements/Comparators/index.js +3 -1
- package/lib/SingleValueInputElements/DropdownInputElement/ConsistencyValidationRules.d.ts +2 -1
- package/lib/SingleValueInputElements/DropdownInputElement/DropdownInput.d.ts +9 -4
- package/lib/SingleValueInputElements/DropdownInputElement/DropdownInput.js +24 -30
- package/lib/SingleValueInputElements/DropdownInputElement/IDropdownInputProps.d.ts +2 -2
- package/lib/SingleValueInputElements/DropdownInputElement/IFluentUiDropdownInputProps.d.ts +5 -0
- package/lib/SingleValueInputElements/DropdownInputElement/IFluentUiDropdownInputProps.js +2 -0
- package/lib/SingleValueInputElements/DropdownInputElement/MultiValueDropdownInput.d.ts +4 -2
- package/lib/SingleValueInputElements/DropdownInputElement/MultiValueDropdownInput.js +29 -19
- package/lib/SingleValueInputElements/DropdownInputElement/index.d.ts +1 -1
- package/lib/SingleValueInputElements/DropdownInputElement/index.js +2 -2
- package/lib/SingleValueInputElements/IBaseInputElementDynamicProps.d.ts +1 -1
- package/lib/SingleValueInputElements/IDynamicProps.d.ts +3 -0
- package/lib/SingleValueInputElements/IDynamicProps.js +2 -0
- package/lib/SingleValueInputElements/IOperativeProps.d.ts +3 -0
- package/lib/SingleValueInputElements/IOperativeProps.js +2 -0
- package/lib/SingleValueInputElements/ISingleValueInputElement.d.ts +5 -2
- package/lib/SingleValueInputElements/ISingleValueInputElementProps.d.ts +7 -3
- package/lib/SingleValueInputElements/IdentityPickerInputElement/IIdentityPickerProps.d.ts +2 -3
- package/lib/SingleValueInputElements/IdentityPickerInputElement/IdentityPicker.d.ts +6 -3
- package/lib/SingleValueInputElements/IdentityPickerInputElement/IdentityPicker.js +12 -10
- package/lib/SingleValueInputElements/IdentityPickerInputElement/index.js +1 -1
- package/lib/SingleValueInputElements/InternalPresentationComponents/SingleValueInputElementWrapper.d.ts +13 -8
- package/lib/SingleValueInputElements/InternalPresentationComponents/SingleValueInputElementWrapper.js +10 -5
- package/lib/SingleValueInputElements/NumberInputElement/INumberInputProps.d.ts +1 -2
- package/lib/SingleValueInputElements/NumberInputElement/NumberInput.d.ts +6 -2
- package/lib/SingleValueInputElements/NumberInputElement/NumberInput.js +34 -35
- package/lib/SingleValueInputElements/NumberInputElement/index.js +1 -1
- package/lib/SingleValueInputElements/SingleValueInputElement.d.ts +12 -8
- package/lib/SingleValueInputElements/SingleValueInputElement.js +35 -9
- package/lib/SingleValueInputElements/TextInputElement/EmptyValidationRules.d.ts +2 -1
- package/lib/SingleValueInputElements/TextInputElement/ITextInputProps.d.ts +1 -2
- package/lib/SingleValueInputElements/TextInputElement/LengthValidationRules.d.ts +3 -2
- package/lib/SingleValueInputElements/TextInputElement/LongTextInput.d.ts +4 -1
- package/lib/SingleValueInputElements/TextInputElement/LongTextInput.js +9 -5
- package/lib/SingleValueInputElements/TextInputElement/PathValidationRules.d.ts +2 -1
- package/lib/SingleValueInputElements/TextInputElement/TextInput.d.ts +4 -1
- package/lib/SingleValueInputElements/TextInputElement/TextInput.js +8 -5
- package/lib/SingleValueInputElements/TextInputElement/index.js +1 -1
- package/lib/SingleValueInputElements/TimePickerInputElement/ITimePickerProps.d.ts +3 -2
- package/lib/SingleValueInputElements/TimePickerInputElement/TimePicker.d.ts +6 -1
- package/lib/SingleValueInputElements/TimePickerInputElement/TimePicker.js +16 -7
- package/lib/SingleValueInputElements/TimePickerInputElement/TimePicker.less +28 -0
- package/lib/SingleValueInputElements/TimePickerInputElement/index.js +1 -1
- package/lib/SingleValueInputElements/index.d.ts +2 -0
- package/lib/SingleValueInputElements/index.js +3 -1
- package/lib/Subscriptions/ValueChangeSubscription.d.ts +2 -2
- package/lib/Subscriptions/index.js +1 -1
- package/lib/Utilities/DropdownHelper.d.ts +1 -1
- package/lib/Utilities/DropdownHelper.js +7 -6
- package/lib/Utilities/FormHelper.js +8 -2
- package/lib/Utilities/InputElementsBuilding.d.ts +13 -0
- package/lib/Utilities/InputElementsBuilding.js +18 -0
- package/lib/Utilities/index.d.ts +1 -0
- package/lib/Utilities/index.js +2 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -1
- package/package.json +42 -40
- package/lib/SingleValueInputElements/DependentInputElement/DependentInputElementInitializer.d.ts +0 -0
- package/lib/SingleValueInputElements/DependentInputElement/DependentInputElementInitializer.js +0 -51
- package/lib/SingleValueInputElements/DependentInputElement/index.d.ts +0 -0
- package/lib/SingleValueInputElements/DependentInputElement/index.js +0 -1
- package/lib/SingleValueInputElements/DropdownInputElement/DropdownInputElement.d.ts +0 -11
- package/lib/SingleValueInputElements/DropdownInputElement/DropdownInputElement.js +0 -33
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ArrayComparator = void 0;
|
|
4
|
+
const DefaultEqualityComparer_1 = require("./DefaultEqualityComparer");
|
|
4
5
|
class ArrayComparator {
|
|
6
|
+
constructor(equalityComparer = null) {
|
|
7
|
+
this._equalityComparer = equalityComparer !== null && equalityComparer !== void 0 ? equalityComparer : new DefaultEqualityComparer_1.DefaultEqualityComparer();
|
|
8
|
+
}
|
|
5
9
|
/** @inheritdoc */
|
|
6
10
|
areEqual(a, b) {
|
|
7
11
|
if (a === b)
|
|
@@ -11,7 +15,7 @@ class ArrayComparator {
|
|
|
11
15
|
if (a.length !== b.length)
|
|
12
16
|
return false;
|
|
13
17
|
for (let i = 0; i < a.length; ++i) {
|
|
14
|
-
if (a[i]
|
|
18
|
+
if (!this._equalityComparer.areEqual(a[i], b[i]))
|
|
15
19
|
return false;
|
|
16
20
|
}
|
|
17
21
|
return true;
|
|
@@ -7,9 +7,11 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
7
7
|
o[k2] = m[k];
|
|
8
8
|
}));
|
|
9
9
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./IValueComparator"), exports);
|
|
14
|
+
__exportStar(require("./DefaultEqualityComparer"), exports);
|
|
15
|
+
__exportStar(require("./IEqualityComparer"), exports);
|
|
14
16
|
__exportStar(require("./ArrayComparator"), exports);
|
|
15
17
|
__exportStar(require("./ZeroIsValidComparator"), exports);
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { FormText } from '../../Components';
|
|
1
2
|
import { ValidationRule } from '../../IValueInputElement';
|
|
2
|
-
export declare function ensureConsistency(errorMessage?:
|
|
3
|
+
export declare function ensureConsistency(errorMessage?: FormText): ValidationRule<string>;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { FormText } from '../../Components';
|
|
2
3
|
import { IBaseInputElementProps } from '../IBaseInputElementProps';
|
|
3
|
-
import {
|
|
4
|
+
import { IDynamicProps } from '../IDynamicProps';
|
|
5
|
+
import { IOperativeProps } from '../IOperativeProps';
|
|
4
6
|
import { ISingleValueInputElementProps } from '../ISingleValueInputElementProps';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
import { IDropdownInputProps } from './IDropdownInputProps';
|
|
8
|
+
import { IFluentUiDropdownInputProps } from './IFluentUiDropdownInputProps';
|
|
9
|
+
interface ISingleValueDropdownInputProps extends ISingleValueInputElementProps<string>, IOperativeProps<IBaseInputElementProps>, IDynamicProps<IDropdownInputProps & IFluentUiDropdownInputProps> {
|
|
10
|
+
consistencyErrorMessage?: FormText;
|
|
8
11
|
}
|
|
12
|
+
export declare const DropdownInput: React.MemoExoticComponent<(props: ISingleValueDropdownInputProps) => JSX.Element>;
|
|
13
|
+
export {};
|
|
@@ -1,34 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DropdownInput = void 0;
|
|
4
|
+
const react_1 = require("@fluentui/react");
|
|
4
5
|
const React = require("react");
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const newOption = Object.assign(Object.assign({}, o), { selected: false });
|
|
29
|
-
options.push(newOption);
|
|
30
|
-
});
|
|
31
|
-
return options;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.DropdownInput = DropdownInput;
|
|
6
|
+
const react_2 = require("react");
|
|
7
|
+
const Components_1 = require("../../Components");
|
|
8
|
+
const Utilities_1 = require("../../Utilities");
|
|
9
|
+
const ConsistencyErrorMessage = 'The value is not present within the specified options.';
|
|
10
|
+
const DropdownInputComponent = (props) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const { dynamicProps, operativeProps } = props;
|
|
13
|
+
const normalizedOptions = react_2.useMemo(() => Utilities_1.DropdownHelper.getNormalizedOptions(dynamicProps.defaultOption, dynamicProps.options), [dynamicProps.defaultOption, dynamicProps.options]);
|
|
14
|
+
react_2.useEffect(() => {
|
|
15
|
+
if (!props.value || normalizedOptions.some((o) => o.key === props.value))
|
|
16
|
+
return;
|
|
17
|
+
const invalidationOptions = { errorMessage: props.consistencyErrorMessage || ConsistencyErrorMessage };
|
|
18
|
+
props.invalidateInput(invalidationOptions);
|
|
19
|
+
}, [props.value, normalizedOptions, props.consistencyErrorMessage, props.invalidateInput]);
|
|
20
|
+
const DropdownComponent = react_2.useMemo(() => { var _a; return (_a = dynamicProps.dropdownComponent) !== null && _a !== void 0 ? _a : react_1.Dropdown; }, [dynamicProps.dropdownComponent]);
|
|
21
|
+
return (React.createElement(React.Fragment, null,
|
|
22
|
+
React.createElement(Components_1.LabelRenderer, { label: props.label, required: !!props.renderRequiredIndicator }),
|
|
23
|
+
React.createElement(DropdownComponent, { "data-automationid": "dropdown-input", options: normalizedOptions, onChange: (_event, option) => !!props.onChange && props.onChange(option.key), placeholder: operativeProps.placeholder,
|
|
24
|
+
// This value should never be `undefined`.
|
|
25
|
+
defaultSelectedKey: props.value || ((_a = dynamicProps.defaultOption) === null || _a === void 0 ? void 0 : _a.key) || null, disabled: dynamicProps.isDisabled }),
|
|
26
|
+
React.createElement(Components_1.ErrorRenderer, { error: props.errorMessage, messageBarType: react_1.MessageBarType.error })));
|
|
27
|
+
};
|
|
28
|
+
exports.DropdownInput = React.memo(DropdownInputComponent);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IBaseInputElementDynamicProps } from '../IBaseInputElementDynamicProps';
|
|
2
2
|
import { IDropdownInputOption } from './IDropdownInputOption';
|
|
3
3
|
export interface IDropdownInputProps extends IBaseInputElementDynamicProps {
|
|
4
|
-
options
|
|
4
|
+
options: IDropdownInputOption[];
|
|
5
5
|
/**
|
|
6
6
|
* The default option for the dropdown.
|
|
7
7
|
*/
|
|
8
|
-
defaultOption
|
|
8
|
+
defaultOption: IDropdownInputOption;
|
|
9
9
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { IBaseInputElementProps } from '../IBaseInputElementProps';
|
|
3
|
-
import {
|
|
3
|
+
import { IDynamicProps } from '../IDynamicProps';
|
|
4
|
+
import { IOperativeProps } from '../IOperativeProps';
|
|
4
5
|
import { ISingleValueInputElementProps } from '../ISingleValueInputElementProps';
|
|
5
|
-
|
|
6
|
+
import { IDropdownInputProps } from './IDropdownInputProps';
|
|
7
|
+
export declare class MultiValueDropdownInput extends React.Component<ISingleValueInputElementProps<string[]> & IOperativeProps<IBaseInputElementProps> & IDynamicProps<IDropdownInputProps>> {
|
|
6
8
|
render(): JSX.Element;
|
|
7
9
|
}
|
|
@@ -1,29 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MultiValueDropdownInput = void 0;
|
|
4
|
+
const react_1 = require("@fluentui/react");
|
|
4
5
|
const React = require("react");
|
|
5
|
-
const
|
|
6
|
+
const Components_1 = require("../../Components");
|
|
6
7
|
const Utilities_1 = require("../../Utilities");
|
|
7
8
|
class MultiValueDropdownInput extends React.Component {
|
|
8
9
|
render() {
|
|
9
|
-
var _a
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
currentValues =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
10
|
+
var _a;
|
|
11
|
+
if (!this.props)
|
|
12
|
+
return null;
|
|
13
|
+
const { dynamicProps, operativeProps } = this.props;
|
|
14
|
+
const normalizedOptions = Utilities_1.DropdownHelper.getNormalizedOptions(dynamicProps.defaultOption, dynamicProps.options);
|
|
15
|
+
return (React.createElement(React.Fragment, null,
|
|
16
|
+
React.createElement(Components_1.LabelRenderer, { label: this.props.label, required: !!this.props.renderRequiredIndicator }),
|
|
17
|
+
React.createElement(react_1.Dropdown, { "data-automationid": "multi-value-dropdown-input", options: normalizedOptions, onChange: (_event, option) => {
|
|
18
|
+
var _a, _b, _c;
|
|
19
|
+
const optionKey = (_a = option === null || option === void 0 ? void 0 : option.key) === null || _a === void 0 ? void 0 : _a.toString();
|
|
20
|
+
if (!optionKey)
|
|
21
|
+
return;
|
|
22
|
+
// We have to re-iterate the passed collection of values here in order to detect changes between the initial and the current values.
|
|
23
|
+
let currentValues = [];
|
|
24
|
+
if (this.props.value)
|
|
25
|
+
currentValues.push(...this.props.value);
|
|
26
|
+
// If the current option is selected, add it to the list.
|
|
27
|
+
// Else, remove it.
|
|
28
|
+
if (option.selected)
|
|
29
|
+
currentValues.push(optionKey);
|
|
30
|
+
else
|
|
31
|
+
currentValues = currentValues.filter((x) => x !== optionKey);
|
|
32
|
+
(_c = (_b = this.props).onChange) === null || _c === void 0 ? void 0 : _c.call(_b, currentValues);
|
|
33
|
+
}, required: !!this.props.renderRequiredIndicator, placeholder: operativeProps.placeholder,
|
|
34
|
+
// This value should never be `undefined`.
|
|
35
|
+
defaultSelectedKeys: this.props.value || [(_a = dynamicProps.defaultOption) === null || _a === void 0 ? void 0 : _a.key] || null, disabled: dynamicProps.isDisabled, multiSelect: true }),
|
|
36
|
+
React.createElement(Components_1.ErrorRenderer, { error: this.props.errorMessage, messageBarType: react_1.MessageBarType.error })));
|
|
27
37
|
}
|
|
28
38
|
}
|
|
29
39
|
exports.MultiValueDropdownInput = MultiValueDropdownInput;
|
|
@@ -7,11 +7,11 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
7
7
|
o[k2] = m[k];
|
|
8
8
|
}));
|
|
9
9
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./DropdownInput"), exports);
|
|
14
|
-
__exportStar(require("./DropdownInputElement"), exports);
|
|
15
14
|
__exportStar(require("./IDropdownInputOption"), exports);
|
|
16
15
|
__exportStar(require("./IDropdownInputProps"), exports);
|
|
16
|
+
__exportStar(require("./IFluentUiDropdownInputProps"), exports);
|
|
17
17
|
__exportStar(require("./MultiValueDropdownInput"), exports);
|
|
@@ -4,6 +4,8 @@ import { IHidingInputElement } from '../IHidingInputElement';
|
|
|
4
4
|
import { ILoadingInputElement } from '../ILoadingInputElement';
|
|
5
5
|
import { IValueInputElement } from '../IValueInputElement';
|
|
6
6
|
import { InvalidValueChangeSubscription, ValueChangeSubscription } from '../Subscriptions';
|
|
7
|
+
import { IDynamicProps } from './IDynamicProps';
|
|
8
|
+
import { IOperativeProps } from './IOperativeProps';
|
|
7
9
|
import { ISingleValueInputElementProps } from './ISingleValueInputElementProps';
|
|
8
10
|
export interface ISingleValueInputElement<TValue, TComponentProps = unknown, TDynamicProps = unknown> extends IValueInputElement<TValue>, IChangingInputElement<TValue>, IHidingInputElement, ILoadingInputElement {
|
|
9
11
|
/**
|
|
@@ -13,7 +15,7 @@ export interface ISingleValueInputElement<TValue, TComponentProps = unknown, TDy
|
|
|
13
15
|
*
|
|
14
16
|
* @see React.Component
|
|
15
17
|
*/
|
|
16
|
-
readonly componentToRender: React.ComponentType<ISingleValueInputElementProps<TValue> & TComponentProps & TDynamicProps
|
|
18
|
+
readonly componentToRender: React.ComponentType<ISingleValueInputElementProps<TValue> & IOperativeProps<TComponentProps> & IDynamicProps<TDynamicProps>>;
|
|
17
19
|
/**
|
|
18
20
|
* A property containing all additional props that the rendered component needs.
|
|
19
21
|
* They should be initialized before the 'render' method is ever called (the best way of doing that is by passing them into the constructor).
|
|
@@ -22,5 +24,6 @@ export interface ISingleValueInputElement<TValue, TComponentProps = unknown, TDy
|
|
|
22
24
|
getDynamicProps(): TDynamicProps;
|
|
23
25
|
changeDynamicProps<K extends keyof TDynamicProps>(dynamicProps: Pick<TDynamicProps, K>): void;
|
|
24
26
|
subscribeToValueChange(subscription: ValueChangeSubscription<TValue>): void;
|
|
25
|
-
|
|
27
|
+
subscribeToInitialValueChange(subscription: ValueChangeSubscription<TValue>): void;
|
|
28
|
+
subscribeToInvalidValueChange(subscription: InvalidValueChangeSubscription): void;
|
|
26
29
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { FormText } from '../Components';
|
|
2
|
+
export interface IInvalidationOptions {
|
|
3
|
+
errorMessage: FormText;
|
|
4
|
+
}
|
|
1
5
|
export interface ISingleValueInputElementProps<TValue> {
|
|
2
6
|
value: TValue;
|
|
3
|
-
label:
|
|
7
|
+
label: FormText;
|
|
4
8
|
renderRequiredIndicator: boolean;
|
|
5
|
-
errorMessage:
|
|
9
|
+
errorMessage: FormText;
|
|
6
10
|
onChange: (newValue: TValue) => void;
|
|
7
|
-
invalidateInput: () => void;
|
|
11
|
+
invalidateInput: (options?: IInvalidationOptions) => void;
|
|
8
12
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { IBasePickerSuggestionsProps, IPersonaProps } from '
|
|
2
|
-
import { IBaseInputElementDynamicProps } from '../IBaseInputElementDynamicProps';
|
|
1
|
+
import { IBasePickerSuggestionsProps, IPersonaProps } from '@fluentui/react';
|
|
3
2
|
import { IBaseInputElementProps } from '../IBaseInputElementProps';
|
|
4
|
-
export interface IIdentityPickerProps<TIdentity extends IPersonaProps = IPersonaProps> extends IBaseInputElementProps
|
|
3
|
+
export interface IIdentityPickerProps<TIdentity extends IPersonaProps = IPersonaProps> extends IBaseInputElementProps {
|
|
5
4
|
onResolveSuggestions: (query: string, selectedItems?: TIdentity[]) => Promise<TIdentity[]>;
|
|
6
5
|
getTextFromItem?: (item: TIdentity, currentValue?: string) => string;
|
|
7
6
|
onEmptyResolveSuggestions?: (currentPersonas?: TIdentity[]) => Promise<TIdentity[]>;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { IPersonaProps } from '@fluentui/react';
|
|
1
2
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
3
|
+
import { IBaseInputElementDynamicProps } from '../IBaseInputElementDynamicProps';
|
|
4
|
+
import { IDynamicProps } from '../IDynamicProps';
|
|
5
|
+
import { IOperativeProps } from '../IOperativeProps';
|
|
4
6
|
import { ISingleValueInputElementProps } from '../ISingleValueInputElementProps';
|
|
5
|
-
|
|
7
|
+
import { IIdentityPickerProps } from './IIdentityPickerProps';
|
|
8
|
+
export declare class IdentityPicker<TIdentity extends IPersonaProps = IPersonaProps> extends React.Component<ISingleValueInputElementProps<TIdentity[]> & IOperativeProps<IIdentityPickerProps<TIdentity>> & IDynamicProps<IBaseInputElementDynamicProps>> {
|
|
6
9
|
render(): JSX.Element;
|
|
7
10
|
}
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IdentityPicker = void 0;
|
|
4
|
+
const react_1 = require("@fluentui/react");
|
|
4
5
|
const React = require("react");
|
|
5
|
-
const
|
|
6
|
+
const Components_1 = require("../../Components");
|
|
6
7
|
class IdentityPicker extends React.Component {
|
|
7
8
|
render() {
|
|
8
|
-
var _a;
|
|
9
9
|
if (!this.props)
|
|
10
10
|
return null;
|
|
11
|
+
const { dynamicProps, operativeProps } = this.props;
|
|
11
12
|
return (React.createElement(React.Fragment, null,
|
|
12
|
-
|
|
13
|
-
React.createElement(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
React.createElement(Components_1.LabelRenderer, { label: this.props.label, required: !!this.props.renderRequiredIndicator }),
|
|
14
|
+
React.createElement("div", { "data-automationid": "identity-picker" },
|
|
15
|
+
React.createElement(react_1.NormalPeoplePicker, { onResolveSuggestions: operativeProps.onResolveSuggestions, onEmptyResolveSuggestions: operativeProps.onEmptyResolveSuggestions, getTextFromItem: operativeProps.getTextFromItem, pickerSuggestionsProps: operativeProps.suggestionProps, onRemoveSuggestion: operativeProps.onRemoveSuggestion, onInputChange: operativeProps.onInputChange, resolveDelay: operativeProps.resolveDelay, itemLimit: operativeProps.itemLimit, disabled: dynamicProps.isDisabled, defaultSelectedItems: this.props.value, inputProps: {
|
|
16
|
+
required: this.props.renderRequiredIndicator,
|
|
17
|
+
placeholder: !!this.props.value && this.props.value.length > 0 ? '' : operativeProps.placeholder
|
|
18
|
+
}, onChange: (items) => {
|
|
19
|
+
this.props.onChange(items);
|
|
20
|
+
} })),
|
|
21
|
+
React.createElement(Components_1.ErrorRenderer, { error: this.props.errorMessage, messageBarType: react_1.MessageBarType.warning })));
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
exports.IdentityPicker = IdentityPicker;
|
|
@@ -7,7 +7,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
7
7
|
o[k2] = m[k];
|
|
8
8
|
}));
|
|
9
9
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./IIdentityPickerProps"), exports);
|
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { FormText } from '../../Components';
|
|
2
3
|
import { IChangingPresentation, IDynamicPresentation, IPresentation, IRestrictedPresentation } from '../../Presentations';
|
|
4
|
+
import { IDynamicProps } from '../IDynamicProps';
|
|
5
|
+
import { IOperativeProps } from '../IOperativeProps';
|
|
3
6
|
import { ISingleValueInputElementProps } from '../ISingleValueInputElementProps';
|
|
4
7
|
interface ISingleValueInputElementWrapperState<TValue, TDynamicProps> {
|
|
5
8
|
value: TValue;
|
|
6
|
-
errorMessage:
|
|
9
|
+
errorMessage: FormText;
|
|
7
10
|
isLoading: boolean;
|
|
8
11
|
isVisible: boolean;
|
|
9
12
|
dynamicProps: TDynamicProps;
|
|
10
13
|
}
|
|
11
|
-
export interface ISingleValueInputElementWrapperProps<TValue, TComponentProps
|
|
12
|
-
internalComponent: React.ComponentType<TComponentProps & TDynamicProps
|
|
13
|
-
|
|
14
|
+
export interface ISingleValueInputElementWrapperProps<TValue, TComponentProps, TDynamicProps> {
|
|
15
|
+
internalComponent: React.ComponentType<ISingleValueInputElementProps<TValue> & IOperativeProps<TComponentProps> & IDynamicProps<TDynamicProps>>;
|
|
16
|
+
inputProps: ISingleValueInputElementProps<TValue>;
|
|
17
|
+
operativeProps: TComponentProps;
|
|
14
18
|
initialDynamicProps: TDynamicProps;
|
|
15
19
|
isInitiallyLoading: boolean;
|
|
16
20
|
isInitiallyVisible: boolean;
|
|
17
|
-
|
|
21
|
+
loadingIndicator: React.ComponentType;
|
|
22
|
+
renderErrors: boolean;
|
|
18
23
|
}
|
|
19
|
-
export declare class SingleValueInputElementWrapper<TValue, TComponentProps
|
|
20
|
-
constructor(props: ISingleValueInputElementWrapperProps<TValue, TComponentProps, TDynamicProps>);
|
|
24
|
+
export declare class SingleValueInputElementWrapper<TValue, TComponentProps, TDynamicProps> extends React.Component<ISingleValueInputElementWrapperProps<TValue, TComponentProps, TDynamicProps>, ISingleValueInputElementWrapperState<TValue, TDynamicProps>> implements IPresentation, IChangingPresentation<TValue>, IRestrictedPresentation, IDynamicPresentation<TDynamicProps> {
|
|
25
|
+
constructor(props: ISingleValueInputElementWrapperProps<TValue, ISingleValueInputElementProps<TValue> & TComponentProps, TDynamicProps>);
|
|
21
26
|
startLoading: () => void;
|
|
22
27
|
stopLoading: () => void;
|
|
23
28
|
hide: () => void;
|
|
24
29
|
show: () => void;
|
|
25
30
|
update: (newValue: TValue) => void;
|
|
26
|
-
setError: (errorMessage:
|
|
31
|
+
setError: (errorMessage: FormText) => void;
|
|
27
32
|
changeDynamicProps: (dynamicProps: TDynamicProps) => void;
|
|
28
33
|
render: () => JSX.Element;
|
|
29
34
|
private renderInternalContent;
|
|
@@ -37,19 +37,24 @@ class SingleValueInputElementWrapper extends React.Component {
|
|
|
37
37
|
this.setState({ dynamicProps: dynamicProps });
|
|
38
38
|
};
|
|
39
39
|
this.render = () => {
|
|
40
|
-
|
|
40
|
+
const { isVisible, isLoading } = this.state;
|
|
41
|
+
const { loadingIndicator } = this.props;
|
|
42
|
+
return (React.createElement(Presentations_1.PresentationRenderer, { isVisible: isVisible, isLoading: isLoading, renderInternalContent: this.renderInternalContent, loadingIndicator: loadingIndicator }));
|
|
41
43
|
};
|
|
42
44
|
this.renderInternalContent = () => {
|
|
43
|
-
|
|
45
|
+
var _a;
|
|
46
|
+
const { internalComponent: Component, inputProps, operativeProps } = this.props;
|
|
44
47
|
if (!Component)
|
|
45
48
|
return null;
|
|
46
|
-
|
|
49
|
+
const { renderErrors } = this.props;
|
|
50
|
+
const errorMessages = renderErrors ? this.state.errorMessage : null;
|
|
51
|
+
return (React.createElement(Component, Object.assign({ dynamicProps: (_a = this.state.dynamicProps) !== null && _a !== void 0 ? _a : {}, operativeProps: operativeProps }, inputProps, { value: this.state.value, errorMessage: errorMessages })));
|
|
47
52
|
};
|
|
48
53
|
this.state = {
|
|
49
54
|
isLoading: props.isInitiallyLoading,
|
|
50
55
|
isVisible: props.isInitiallyVisible,
|
|
51
|
-
errorMessage: (_a = props.
|
|
52
|
-
value: (_b = props.
|
|
56
|
+
errorMessage: (_a = props.inputProps) === null || _a === void 0 ? void 0 : _a.errorMessage,
|
|
57
|
+
value: (_b = props.inputProps) === null || _b === void 0 ? void 0 : _b.value,
|
|
53
58
|
dynamicProps: props.initialDynamicProps
|
|
54
59
|
};
|
|
55
60
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { IBaseInputElementDynamicProps } from '../IBaseInputElementDynamicProps';
|
|
2
1
|
import { IBaseInputElementProps } from '../IBaseInputElementProps';
|
|
3
|
-
export interface INumberInputProps extends IBaseInputElementProps
|
|
2
|
+
export interface INumberInputProps extends IBaseInputElementProps {
|
|
4
3
|
handleDecimalValues?: boolean;
|
|
5
4
|
min?: number;
|
|
6
5
|
max?: number;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { FormText } from '../../Components';
|
|
3
|
+
import { IBaseInputElementDynamicProps } from '../IBaseInputElementDynamicProps';
|
|
4
|
+
import { IDynamicProps } from '../IDynamicProps';
|
|
5
|
+
import { IOperativeProps } from '../IOperativeProps';
|
|
2
6
|
import { ISingleValueInputElementProps } from '../ISingleValueInputElementProps';
|
|
3
7
|
import { INumberInputProps } from './INumberInputProps';
|
|
4
8
|
interface INumberInputState {
|
|
5
9
|
intermediateValue: string;
|
|
6
|
-
customWarning:
|
|
10
|
+
customWarning: FormText;
|
|
7
11
|
}
|
|
8
|
-
export declare class NumberInput extends React.Component<ISingleValueInputElementProps<number> & INumberInputProps
|
|
12
|
+
export declare class NumberInput extends React.Component<ISingleValueInputElementProps<number> & IOperativeProps<INumberInputProps> & IDynamicProps<IBaseInputElementDynamicProps>, INumberInputState> {
|
|
9
13
|
state: INumberInputState;
|
|
10
14
|
render(): JSX.Element;
|
|
11
15
|
private handleUserInput;
|