@try-at-software/input-elements 1.2.0-aplha.4 → 1.2.0-beta.1
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/IDropdownInputOption.d.ts +1 -0
- 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 +34 -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 +1 -1
- 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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Try at software
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IChangingInputElement } from './IChangingInputElement';
|
|
2
|
+
import { UpdateCallback } from './IInputElement';
|
|
3
|
+
import { InputElement } from './InputElement';
|
|
4
|
+
export declare abstract class ChangingInputElement<TValue> extends InputElement implements IChangingInputElement<TValue> {
|
|
5
|
+
protected initialValue: TValue;
|
|
6
|
+
protected _valueIsSet: boolean;
|
|
7
|
+
protected _initialValueIsSet: boolean;
|
|
8
|
+
protected constructor(update: UpdateCallback);
|
|
9
|
+
/** @inheritdoc */
|
|
10
|
+
setInitialValue(value: TValue): void;
|
|
11
|
+
/** @inheritdoc */
|
|
12
|
+
setValue(value: TValue): void;
|
|
13
|
+
/** @inheritdoc */
|
|
14
|
+
resetValue(): void;
|
|
15
|
+
protected abstract setInternalValue(value: TValue, isInitial: boolean): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChangingInputElement = void 0;
|
|
4
|
+
const InputElement_1 = require("./InputElement");
|
|
5
|
+
class ChangingInputElement extends InputElement_1.InputElement {
|
|
6
|
+
constructor(update) {
|
|
7
|
+
super(update);
|
|
8
|
+
this._valueIsSet = false;
|
|
9
|
+
this._initialValueIsSet = false;
|
|
10
|
+
}
|
|
11
|
+
/** @inheritdoc */
|
|
12
|
+
setInitialValue(value) {
|
|
13
|
+
if (this._valueIsSet || this._initialValueIsSet)
|
|
14
|
+
return;
|
|
15
|
+
this._initialValueIsSet = true;
|
|
16
|
+
this.initialValue = value;
|
|
17
|
+
this.setInternalValue(value, true);
|
|
18
|
+
this.updateInternally();
|
|
19
|
+
}
|
|
20
|
+
/** @inheritdoc */
|
|
21
|
+
setValue(value) {
|
|
22
|
+
this._valueIsSet = true;
|
|
23
|
+
this.setInternalValue(value, false);
|
|
24
|
+
this.updateInternally();
|
|
25
|
+
}
|
|
26
|
+
/** @inheritdoc */
|
|
27
|
+
resetValue() {
|
|
28
|
+
if (!this._valueIsSet && !this._initialValueIsSet)
|
|
29
|
+
return;
|
|
30
|
+
this.setInternalValue(undefined, false);
|
|
31
|
+
this.updateInternally();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.ChangingInputElement = ChangingInputElement;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClearButton = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const react_1 = require("@fluentui/react");
|
|
6
|
+
class ClearButton extends React.Component {
|
|
7
|
+
render() {
|
|
8
|
+
const { className, isDisabled, onClick } = this.props;
|
|
9
|
+
return React.createElement(react_1.DefaultButton, { className: className, disabled: isDisabled, iconProps: { iconName: 'Clear' }, onClick: onClick });
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.ClearButton = ClearButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ClearButton';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./ClearButton"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MessageBarType } from '@fluentui/react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { FormText } from './Types';
|
|
4
|
+
interface IErrorRendererProps {
|
|
5
|
+
error: FormText;
|
|
6
|
+
messageBarType: MessageBarType;
|
|
7
|
+
}
|
|
8
|
+
export declare const ErrorRenderer: React.MemoExoticComponent<(props: IErrorRendererProps) => JSX.Element>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ErrorRenderer = void 0;
|
|
4
|
+
const react_1 = require("@fluentui/react");
|
|
5
|
+
const React = require("react");
|
|
6
|
+
const FormTextRenderer_1 = require("./FormTextRenderer");
|
|
7
|
+
const ErrorRendererComponent = (props) => {
|
|
8
|
+
const { error } = props;
|
|
9
|
+
if (!error)
|
|
10
|
+
return null;
|
|
11
|
+
return (React.createElement(react_1.MessageBar, { messageBarType: react_1.MessageBarType.warning },
|
|
12
|
+
React.createElement(FormTextRenderer_1.FormTextRenderer, { text: error })));
|
|
13
|
+
};
|
|
14
|
+
exports.ErrorRenderer = React.memo(ErrorRendererComponent);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { FormText } from './Types';
|
|
3
|
+
interface IFormTextRendererProps {
|
|
4
|
+
text: FormText;
|
|
5
|
+
}
|
|
6
|
+
export declare const FormTextRenderer: React.MemoExoticComponent<(props: IFormTextRendererProps) => JSX.Element>;
|
|
7
|
+
export declare function materializeErrorMessage(error: FormText): JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.materializeErrorMessage = exports.FormTextRenderer = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const FormTextRendererComponent = (props) => {
|
|
6
|
+
const { text: TextValue } = props;
|
|
7
|
+
if (!TextValue)
|
|
8
|
+
return null;
|
|
9
|
+
if (typeof TextValue === 'string')
|
|
10
|
+
return React.createElement(React.Fragment, null, TextValue);
|
|
11
|
+
return React.createElement(TextValue, null);
|
|
12
|
+
};
|
|
13
|
+
exports.FormTextRenderer = React.memo(FormTextRendererComponent);
|
|
14
|
+
function materializeErrorMessage(error) {
|
|
15
|
+
if (!error)
|
|
16
|
+
return null;
|
|
17
|
+
return React.createElement(exports.FormTextRenderer, { text: error });
|
|
18
|
+
}
|
|
19
|
+
exports.materializeErrorMessage = materializeErrorMessage;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { FormText } from './Types';
|
|
3
|
+
interface ILabelRendererProps {
|
|
4
|
+
label: FormText;
|
|
5
|
+
required: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const LabelRenderer: React.MemoExoticComponent<(props: ILabelRendererProps) => JSX.Element>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LabelRenderer = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const react_1 = require("@fluentui/react");
|
|
6
|
+
const LabelRendererComponent = (props) => {
|
|
7
|
+
if (!props)
|
|
8
|
+
return null;
|
|
9
|
+
const { label, required } = props;
|
|
10
|
+
if (!label)
|
|
11
|
+
return null;
|
|
12
|
+
return React.createElement(react_1.Label, { required: required }, label);
|
|
13
|
+
};
|
|
14
|
+
exports.LabelRenderer = React.memo(LabelRendererComponent);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./ErrorRenderer"), exports);
|
|
14
|
+
__exportStar(require("./FormTextRenderer"), exports);
|
|
15
|
+
__exportStar(require("./LabelRenderer"), exports);
|
|
16
|
+
__exportStar(require("./Types"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./Buttons"), exports);
|
|
14
|
+
__exportStar(require("./Text"), exports);
|
|
@@ -10,7 +10,7 @@ export interface IInputInformation<TValue> {
|
|
|
10
10
|
uniqueId: number;
|
|
11
11
|
input: InternalDynamicInput<TValue>;
|
|
12
12
|
}
|
|
13
|
-
export declare class DynamicListInputElement<TValue
|
|
13
|
+
export declare class DynamicListInputElement<TValue> extends ExtendedInputElement<IDynamicValueChange<TValue>[], DynamicListInputElementWrapper<TValue>> implements IDynamicListInputElement<TValue> {
|
|
14
14
|
private static counter;
|
|
15
15
|
private readonly _configuration;
|
|
16
16
|
private _inputs;
|
|
@@ -76,7 +76,7 @@ class DynamicListInputElement extends ExtendedInputElement_1.ExtendedInputElemen
|
|
|
76
76
|
/** @inheritdoc */
|
|
77
77
|
renderComponent() {
|
|
78
78
|
var _a, _b;
|
|
79
|
-
return (React.createElement(DynamicListInputElementWrapper_1.DynamicListInputElementWrapper, { className: this._configuration.className, inputs: this.filterInputs(), onDragEnd: this.onDragEnd, renderMenu: this.renderMenu, renderFooterMenu: this.renderFooterMenu,
|
|
79
|
+
return (React.createElement(DynamicListInputElementWrapper_1.DynamicListInputElementWrapper, { className: this._configuration.className, inputs: this.filterInputs(), onDragEnd: this.onDragEnd, renderMenu: this.renderMenu, renderFooterMenu: this.renderFooterMenu, loadingComponent: (_a = this._configuration) === null || _a === void 0 ? void 0 : _a.loadingComponent, renderMoveGripper: (_b = this._configuration) === null || _b === void 0 ? void 0 : _b.renderMoveGripper, ref: this._componentRef }));
|
|
80
80
|
}
|
|
81
81
|
reorder(startIndex, endIndex) {
|
|
82
82
|
const [removed] = this._inputs.splice(startIndex, 1);
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { IBasicMenuButtonConfiguration } from './IBasicMenuButtonConfiguration';
|
|
2
2
|
export interface IMenuButtonConfiguration extends IBasicMenuButtonConfiguration {
|
|
3
|
-
className?: string;
|
|
4
|
-
label?: string;
|
|
5
|
-
iconName?: string;
|
|
6
3
|
show?: boolean;
|
|
7
4
|
isEnabled?: boolean;
|
|
8
5
|
}
|
|
@@ -8,7 +8,7 @@ interface IDynamicListInputElementWrapperState<TValue> {
|
|
|
8
8
|
inputElements: IInputInformation<TValue>[];
|
|
9
9
|
}
|
|
10
10
|
export interface ICommonInputBehaviorConfiguration {
|
|
11
|
-
|
|
11
|
+
loadingComponent?: React.ComponentType;
|
|
12
12
|
}
|
|
13
13
|
export declare class DynamicListInputElementWrapper<TValue> extends React.Component<IDynamicInputListProps<TValue> & ICommonInputBehaviorConfiguration, IDynamicListInputElementWrapperState<TValue>> implements IChangingPresentation<IInputInformation<TValue>[]> {
|
|
14
14
|
constructor(props: IDynamicInputListProps<TValue> & ICommonInputBehaviorConfiguration);
|
package/lib/DynamicListInputElement/InternalPresentationComponents/DynamicListInputElementWrapper.js
CHANGED
|
@@ -32,7 +32,7 @@ class DynamicListInputElementWrapper extends React.Component {
|
|
|
32
32
|
this.setState({ inputElements: newValue });
|
|
33
33
|
};
|
|
34
34
|
this.render = () => {
|
|
35
|
-
return (React.createElement(Presentations_1.PresentationRenderer, { isVisible: this.state.isVisible, isLoading: this.state.isLoading, renderInternalContent: this.renderInternalContent,
|
|
35
|
+
return (React.createElement(Presentations_1.PresentationRenderer, { isVisible: this.state.isVisible, isLoading: this.state.isLoading, renderInternalContent: this.renderInternalContent, loadingIndicator: this.props.loadingComponent }));
|
|
36
36
|
};
|
|
37
37
|
this.renderInternalContent = () => {
|
|
38
38
|
return React.createElement(DynamicInputsList_1.DynamicInputsList, Object.assign({}, this.props, { inputs: this.state.inputElements }));
|
|
@@ -2,34 +2,40 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DynamicListMenu = void 0;
|
|
4
4
|
const React = require("react");
|
|
5
|
-
const
|
|
5
|
+
const react_1 = require("@fluentui/react");
|
|
6
|
+
const Components_1 = require("../../Components");
|
|
6
7
|
class DynamicListMenu extends React.Component {
|
|
7
8
|
render() {
|
|
8
|
-
var _a, _b
|
|
9
|
+
var _a, _b;
|
|
10
|
+
if (!this.props)
|
|
11
|
+
return null;
|
|
9
12
|
return (React.createElement("div", { className: "tas-dynamic-list-menu" },
|
|
10
|
-
((
|
|
11
|
-
((
|
|
13
|
+
((_a = this.props.insertButtonConfig) === null || _a === void 0 ? void 0 : _a.show) && this.renderInsertButton(),
|
|
14
|
+
((_b = this.props.removeButtonConfig) === null || _b === void 0 ? void 0 : _b.show) && this.renderRemoveButton()));
|
|
12
15
|
}
|
|
13
16
|
renderInsertButton() {
|
|
14
|
-
var _a, _b
|
|
17
|
+
var _a, _b;
|
|
15
18
|
const addOptions = this.getItems();
|
|
19
|
+
const buttonText = ((_a = this.props.insertButtonConfig) === null || _a === void 0 ? void 0 : _a.label) || 'Insert';
|
|
16
20
|
const commonProps = {
|
|
17
|
-
iconProps: { iconName: ((_b =
|
|
18
|
-
|
|
21
|
+
iconProps: { iconName: ((_b = this.props.insertButtonConfig) === null || _b === void 0 ? void 0 : _b.iconName) || 'Add' },
|
|
22
|
+
children: React.createElement(Components_1.FormTextRenderer, { text: buttonText })
|
|
19
23
|
};
|
|
20
24
|
if (!(addOptions === null || addOptions === void 0 ? void 0 : addOptions.items) || addOptions.items.length <= 0)
|
|
21
|
-
return React.createElement(
|
|
25
|
+
return React.createElement(react_1.PrimaryButton, Object.assign({}, commonProps, { disabled: true }));
|
|
22
26
|
else if (addOptions.items.length === 1) {
|
|
23
|
-
return (React.createElement(
|
|
27
|
+
return (React.createElement(react_1.CommandButton, Object.assign({}, commonProps, { disabled: false, onClick: () => {
|
|
24
28
|
addOptions.items[0].onClick();
|
|
25
29
|
} })));
|
|
26
30
|
}
|
|
27
31
|
else
|
|
28
|
-
return React.createElement(
|
|
32
|
+
return React.createElement(react_1.CommandButton, Object.assign({}, commonProps, { menuProps: addOptions, disabled: false }));
|
|
29
33
|
}
|
|
30
34
|
renderRemoveButton() {
|
|
31
|
-
var _a, _b, _c
|
|
32
|
-
|
|
35
|
+
var _a, _b, _c;
|
|
36
|
+
const buttonText = ((_a = this.props.removeButtonConfig) === null || _a === void 0 ? void 0 : _a.label) || 'Remove';
|
|
37
|
+
return (React.createElement(react_1.CommandButton, { iconProps: { iconName: ((_b = this.props.removeButtonConfig) === null || _b === void 0 ? void 0 : _b.iconName) || 'Remove' }, disabled: !((_c = this.props.removeButtonConfig) === null || _c === void 0 ? void 0 : _c.isEnabled), onClick: () => !!this.props.onRemoveClicked && this.props.onRemoveClicked() },
|
|
38
|
+
React.createElement(Components_1.FormTextRenderer, { text: buttonText })));
|
|
33
39
|
}
|
|
34
40
|
getItems() {
|
|
35
41
|
return {
|
|
@@ -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("./DynamicListMenu"), exports);
|
|
@@ -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("./DynamicListInputElement"), exports);
|
|
@@ -1,26 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ChangingInputElement } from './ChangingInputElement';
|
|
3
3
|
import { IHidingInputElement } from './IHidingInputElement';
|
|
4
4
|
import { UpdateCallback } from './IInputElement';
|
|
5
5
|
import { ILoadingInputElement } from './ILoadingInputElement';
|
|
6
|
-
import { InputElement } from './InputElement';
|
|
7
6
|
import { IPresentation } from './Presentations';
|
|
8
|
-
export declare abstract class ExtendedInputElement<TValue, TPresentation extends IPresentation> extends
|
|
9
|
-
protected initialValue: TValue;
|
|
10
|
-
protected _valueIsSet: boolean;
|
|
11
|
-
protected _initialValueIsSet: boolean;
|
|
7
|
+
export declare abstract class ExtendedInputElement<TValue, TPresentation extends IPresentation> extends ChangingInputElement<TValue> implements IHidingInputElement, ILoadingInputElement {
|
|
12
8
|
protected _componentRef: React.RefObject<TPresentation>;
|
|
13
9
|
private _isVisible;
|
|
14
10
|
private _isLoading;
|
|
15
11
|
protected constructor(update: UpdateCallback);
|
|
16
12
|
/** @inheritdoc */
|
|
17
|
-
setInitialValue(value: TValue): void;
|
|
18
|
-
/** @inheritdoc */
|
|
19
|
-
setValue(value: TValue): void;
|
|
20
|
-
/** @inheritdoc */
|
|
21
|
-
resetValue(): void;
|
|
22
|
-
protected abstract setInternalValue(value: TValue, isInitial: boolean): void;
|
|
23
|
-
/** @inheritdoc */
|
|
24
13
|
get isVisible(): boolean;
|
|
25
14
|
/** @inheritdoc */
|
|
26
15
|
hide(): void;
|
|
@@ -2,39 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ExtendedInputElement = void 0;
|
|
4
4
|
const React = require("react");
|
|
5
|
-
const
|
|
6
|
-
class ExtendedInputElement extends
|
|
5
|
+
const ChangingInputElement_1 = require("./ChangingInputElement");
|
|
6
|
+
class ExtendedInputElement extends ChangingInputElement_1.ChangingInputElement {
|
|
7
7
|
constructor(update) {
|
|
8
8
|
super(update);
|
|
9
|
-
this._valueIsSet = false;
|
|
10
|
-
this._initialValueIsSet = false;
|
|
11
9
|
this._isVisible = true;
|
|
12
10
|
this._isLoading = false;
|
|
13
11
|
this._componentRef = React.createRef();
|
|
14
12
|
}
|
|
15
13
|
/** @inheritdoc */
|
|
16
|
-
setInitialValue(value) {
|
|
17
|
-
if (this._valueIsSet || this._initialValueIsSet)
|
|
18
|
-
return;
|
|
19
|
-
this._initialValueIsSet = true;
|
|
20
|
-
this.initialValue = value;
|
|
21
|
-
this.setInternalValue(value, true);
|
|
22
|
-
this.updateInternally();
|
|
23
|
-
}
|
|
24
|
-
/** @inheritdoc */
|
|
25
|
-
setValue(value) {
|
|
26
|
-
this._valueIsSet = true;
|
|
27
|
-
this.setInternalValue(value, false);
|
|
28
|
-
this.updateInternally();
|
|
29
|
-
}
|
|
30
|
-
/** @inheritdoc */
|
|
31
|
-
resetValue() {
|
|
32
|
-
if (!this._valueIsSet)
|
|
33
|
-
return;
|
|
34
|
-
this.setInternalValue(undefined, false);
|
|
35
|
-
this.updateInternally();
|
|
36
|
-
}
|
|
37
|
-
/** @inheritdoc */
|
|
38
14
|
get isVisible() {
|
|
39
15
|
return this._isVisible;
|
|
40
16
|
}
|
package/lib/IInputElement.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { FormText } from './Components';
|
|
2
3
|
export interface IInputElement {
|
|
3
4
|
/**
|
|
4
5
|
* A boolean indicating if the entered value is valid (all validation rules pass).
|
|
@@ -7,7 +8,7 @@ export interface IInputElement {
|
|
|
7
8
|
/**
|
|
8
9
|
* The message of the first validation error that occurred if any.
|
|
9
10
|
*/
|
|
10
|
-
errorMessage:
|
|
11
|
+
errorMessage: FormText;
|
|
11
12
|
/**
|
|
12
13
|
* Gets or sets a value indicating whether the input element has any changes made.
|
|
13
14
|
*/
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { FormText } from './Components';
|
|
1
2
|
export interface IInputElementConfiguration {
|
|
2
3
|
/**
|
|
3
4
|
* The label associated with the input element.
|
|
4
5
|
* It should not be too long and should give enough information for the end user.
|
|
5
6
|
* Some input elements may not use this value if tey should not.
|
|
6
7
|
*/
|
|
7
|
-
label?:
|
|
8
|
+
label?: FormText;
|
|
8
9
|
/**
|
|
9
10
|
* A class name that should be used while rendering the input element.
|
|
10
11
|
*/
|
|
@@ -19,5 +20,5 @@ export interface IInputElementConfiguration {
|
|
|
19
20
|
/**
|
|
20
21
|
* A message that should be rendered instead of the default one whenever a required input element is empty.
|
|
21
22
|
*/
|
|
22
|
-
requiredValidationMessage?:
|
|
23
|
+
requiredValidationMessage?: FormText;
|
|
23
24
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
export interface ILoadingInputElementConfiguration {
|
|
3
3
|
/**
|
|
4
4
|
* This function can be used to customize the default loading UI of any loading input element.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
loadingComponent?: React.ComponentType;
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FormText } from './Components';
|
|
1
2
|
import { IInputElement } from './IInputElement';
|
|
2
3
|
export interface IValueInputElement<TValue> extends IInputElement {
|
|
3
4
|
/**
|
|
@@ -16,4 +17,4 @@ export interface IValueInputElement<TValue> extends IInputElement {
|
|
|
16
17
|
*/
|
|
17
18
|
validate(): void;
|
|
18
19
|
}
|
|
19
|
-
export declare type ValidationRule<TValue> = (value: TValue) =>
|
|
20
|
+
export declare type ValidationRule<TValue> = (value: TValue) => FormText;
|
package/lib/InputElement.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { FormText } from './Components';
|
|
2
3
|
import { IInputElement, UpdateCallback } from './IInputElement';
|
|
3
4
|
export declare abstract class InputElement implements IInputElement {
|
|
4
5
|
private _isRendered;
|
|
@@ -6,7 +7,7 @@ export declare abstract class InputElement implements IInputElement {
|
|
|
6
7
|
/** @inheritdoc */
|
|
7
8
|
abstract isValid: boolean;
|
|
8
9
|
/** @inheritdoc */
|
|
9
|
-
errorMessage:
|
|
10
|
+
errorMessage: FormText;
|
|
10
11
|
/** @inheritdoc */
|
|
11
12
|
abstract hasChanges: boolean;
|
|
12
13
|
/** @inheritdoc */
|
package/lib/InputElement.js
CHANGED
|
@@ -7,7 +7,7 @@ class InputElement {
|
|
|
7
7
|
/** @inheritdoc */
|
|
8
8
|
this.update = () => {
|
|
9
9
|
// This function should never ever be called in such a manner.
|
|
10
|
-
// Instead a custom function should be passed to the constructor and immediately after that - assigned to this property.
|
|
10
|
+
// Instead, a custom function should be passed to the constructor and immediately after that - assigned to this property.
|
|
11
11
|
throw new Error('This function should never be called!');
|
|
12
12
|
};
|
|
13
13
|
if (!update)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FormText } from '../Components';
|
|
1
2
|
export interface IPresentation {
|
|
2
3
|
startLoading(): void;
|
|
3
4
|
stopLoading(): void;
|
|
@@ -8,7 +9,7 @@ export interface IChangingPresentation<TValue> {
|
|
|
8
9
|
update(newValue: TValue): void;
|
|
9
10
|
}
|
|
10
11
|
export interface IRestrictedPresentation {
|
|
11
|
-
setError(errorMessage:
|
|
12
|
+
setError(errorMessage: FormText): void;
|
|
12
13
|
}
|
|
13
14
|
export interface IDynamicPresentation<TDynamicProps> {
|
|
14
15
|
changeDynamicProps(dynamicProps: TDynamicProps): void;
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
interface IPresentationRendererProps {
|
|
3
3
|
isVisible: boolean;
|
|
4
4
|
isLoading: boolean;
|
|
5
|
-
|
|
5
|
+
loadingIndicator?: React.ComponentType;
|
|
6
6
|
renderInternalContent: () => JSX.Element;
|
|
7
7
|
}
|
|
8
8
|
export declare class PresentationRenderer extends React.Component<IPresentationRendererProps> {
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PresentationRenderer = void 0;
|
|
4
|
-
const
|
|
4
|
+
const react_1 = require("@fluentui/react");
|
|
5
5
|
const React = require("react");
|
|
6
6
|
class PresentationRenderer extends React.Component {
|
|
7
7
|
render() {
|
|
8
|
-
|
|
9
|
-
if (!
|
|
8
|
+
const { isVisible } = this.props;
|
|
9
|
+
if (!isVisible)
|
|
10
10
|
return null;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const { isLoading } = this.props;
|
|
12
|
+
if (isLoading) {
|
|
13
|
+
const { loadingIndicator: LoadingIndicator } = this.props;
|
|
14
|
+
if (LoadingIndicator)
|
|
15
|
+
return React.createElement(LoadingIndicator, null);
|
|
16
|
+
return React.createElement(react_1.Spinner, { size: react_1.SpinnerSize.medium });
|
|
15
17
|
}
|
|
16
|
-
|
|
18
|
+
const { renderInternalContent } = this.props;
|
|
19
|
+
if (!renderInternalContent)
|
|
17
20
|
return null;
|
|
18
|
-
return
|
|
21
|
+
return renderInternalContent();
|
|
19
22
|
}
|
|
20
23
|
}
|
|
21
24
|
exports.PresentationRenderer = PresentationRenderer;
|
|
@@ -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("./IPresentation"), exports);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { IEqualityComparer } from './IEqualityComparer';
|
|
1
2
|
import { IValueComparator } from './IValueComparator';
|
|
2
3
|
export declare class ArrayComparator<T> implements IValueComparator<T[]> {
|
|
4
|
+
private readonly _equalityComparer;
|
|
5
|
+
constructor(equalityComparer?: IEqualityComparer<T>);
|
|
3
6
|
/** @inheritdoc */
|
|
4
7
|
areEqual(a: T[], b: T[]): boolean;
|
|
5
8
|
/** @inheritdoc */
|