@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,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DropdownHelper = void 0;
|
|
4
|
-
const
|
|
4
|
+
const react_1 = require("@fluentui/react");
|
|
5
5
|
const SingleValueInputElements_1 = require("../SingleValueInputElements");
|
|
6
6
|
class DropdownHelper {
|
|
7
7
|
static getNormalizedOptions(defaultOption, allOptions) {
|
|
@@ -14,7 +14,7 @@ class DropdownHelper {
|
|
|
14
14
|
allOptions.forEach((o) => {
|
|
15
15
|
if (!o)
|
|
16
16
|
return;
|
|
17
|
-
const newOption =
|
|
17
|
+
const newOption = this.toNormalizedDropdownOption(o);
|
|
18
18
|
options.push(newOption);
|
|
19
19
|
});
|
|
20
20
|
return options;
|
|
@@ -40,19 +40,20 @@ DropdownHelper.toNormalizedDropdownOption = (inputOption) => {
|
|
|
40
40
|
if (inputOption.type !== undefined) {
|
|
41
41
|
switch (inputOption.type) {
|
|
42
42
|
case SingleValueInputElements_1.DropdownOptionType.Normal:
|
|
43
|
-
itemType =
|
|
43
|
+
itemType = react_1.SelectableOptionMenuItemType.Normal;
|
|
44
44
|
break;
|
|
45
45
|
case SingleValueInputElements_1.DropdownOptionType.Divider:
|
|
46
|
-
itemType =
|
|
46
|
+
itemType = react_1.SelectableOptionMenuItemType.Divider;
|
|
47
47
|
break;
|
|
48
48
|
case SingleValueInputElements_1.DropdownOptionType.Header:
|
|
49
|
-
itemType =
|
|
49
|
+
itemType = react_1.SelectableOptionMenuItemType.Header;
|
|
50
50
|
break;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
return {
|
|
54
54
|
text: inputOption.text,
|
|
55
55
|
key: inputOption.key,
|
|
56
|
-
itemType: itemType
|
|
56
|
+
itemType: itemType,
|
|
57
|
+
disabled: !!inputOption.disabled
|
|
57
58
|
};
|
|
58
59
|
};
|
|
@@ -8,8 +8,14 @@ function getFormState(inputs) {
|
|
|
8
8
|
let hasChanges = false;
|
|
9
9
|
let index = 0;
|
|
10
10
|
while ((isValid || !hasChanges) && index < inputs.length) {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const currentInput = inputs[index];
|
|
12
|
+
if (!currentInput) {
|
|
13
|
+
isValid = false;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
isValid = isValid && currentInput.isValid;
|
|
17
|
+
hasChanges = hasChanges || currentInput.hasChanges;
|
|
18
|
+
}
|
|
13
19
|
index++;
|
|
14
20
|
}
|
|
15
21
|
return {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { UpdateCallback } from '../IInputElement';
|
|
3
|
+
import { ValidationRule } from '../IValueInputElement';
|
|
4
|
+
import { IDynamicProps, IOperativeProps, ISingleValueInputElement, ISingleValueInputElementConfiguration, ISingleValueInputElementProps } from '../SingleValueInputElements';
|
|
5
|
+
declare class InputElementBuilder<TValue> {
|
|
6
|
+
private readonly _config;
|
|
7
|
+
private readonly _updateCallback;
|
|
8
|
+
private readonly _validationRules;
|
|
9
|
+
constructor(config: ISingleValueInputElementConfiguration<TValue>, updateCallback: UpdateCallback, validationRules: ValidationRule<TValue>[]);
|
|
10
|
+
materialize<TComponentProps, TDynamicProps>(component: React.ComponentType<ISingleValueInputElementProps<TValue> & IDynamicProps<TDynamicProps> & IOperativeProps<TComponentProps>>, props: TComponentProps): ISingleValueInputElement<TValue, TComponentProps, TDynamicProps>;
|
|
11
|
+
}
|
|
12
|
+
export declare function prepareInputElement<TValue>(config: ISingleValueInputElementConfiguration<TValue>, updateCallback: UpdateCallback, ...validationRules: ValidationRule<TValue>[]): InputElementBuilder<TValue>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prepareInputElement = void 0;
|
|
4
|
+
const SingleValueInputElements_1 = require("../SingleValueInputElements");
|
|
5
|
+
class InputElementBuilder {
|
|
6
|
+
constructor(config, updateCallback, validationRules) {
|
|
7
|
+
this._config = config;
|
|
8
|
+
this._updateCallback = updateCallback;
|
|
9
|
+
this._validationRules = validationRules;
|
|
10
|
+
}
|
|
11
|
+
materialize(component, props) {
|
|
12
|
+
return new SingleValueInputElements_1.SingleValueInputElement(this._config, component, props, this._updateCallback, ...this._validationRules);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function prepareInputElement(config, updateCallback, ...validationRules) {
|
|
16
|
+
return new InputElementBuilder(config, updateCallback, validationRules);
|
|
17
|
+
}
|
|
18
|
+
exports.prepareInputElement = prepareInputElement;
|
package/lib/Utilities/index.d.ts
CHANGED
package/lib/Utilities/index.js
CHANGED
|
@@ -7,10 +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("./DropdownHelper"), exports);
|
|
14
14
|
__exportStar(require("./FormHelper"), exports);
|
|
15
|
+
__exportStar(require("./InputElementsBuilding"), exports);
|
|
15
16
|
__exportStar(require("./StylingHelper"), exports);
|
|
16
17
|
__exportStar(require("./TypingHelper"), exports);
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -7,9 +7,10 @@ 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
|
+
__exportStar(require("./Components"), exports);
|
|
13
14
|
__exportStar(require("./ExtendedInputElement"), exports);
|
|
14
15
|
__exportStar(require("./IChangingInputElement"), exports);
|
|
15
16
|
__exportStar(require("./IHidingInputElement"), exports);
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@try-at-software/input-elements",
|
|
3
|
-
"version": "1.2.0-
|
|
3
|
+
"version": "1.2.0-beta.2",
|
|
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",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"start-dev": "npm run lint && webpack
|
|
8
|
+
"start-dev": "npm run lint && webpack serve --mode development --open",
|
|
9
9
|
"lint": ".\\node_modules\\.bin\\eslint \"./src/**/*.{js,jsx,ts,tsx}\" && prettier --check \"src/**/*.{ts,tsx,js,jsx,css,less,json}\"",
|
|
10
10
|
"fix-code-style": "prettier --write \"src/**/*.{ts,tsx,js,jsx,css,less,json}\"",
|
|
11
11
|
"test": "jest",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
},
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
24
|
-
"url": "https://
|
|
24
|
+
"url": "https://github.com/TryAtSoftware/InputElements"
|
|
25
25
|
},
|
|
26
|
-
"homepage": "https://
|
|
26
|
+
"homepage": "https://github.com/TryAtSoftware/InputElements",
|
|
27
27
|
"files": [
|
|
28
28
|
"lib/**/*"
|
|
29
29
|
],
|
|
@@ -34,44 +34,46 @@
|
|
|
34
34
|
"validation"
|
|
35
35
|
],
|
|
36
36
|
"author": "Tony Troeff",
|
|
37
|
-
"license": "
|
|
37
|
+
"license": "MIT",
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@
|
|
40
|
-
"@types/enzyme
|
|
41
|
-
"@types/
|
|
42
|
-
"@types/
|
|
43
|
-
"@types/react
|
|
44
|
-
"@types/react-
|
|
45
|
-
"@
|
|
46
|
-
"@typescript-eslint/
|
|
47
|
-
"
|
|
48
|
-
"copyfiles": "
|
|
49
|
-
"css-loader": "
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"eslint": "
|
|
53
|
-
"eslint-
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"react-dom": "
|
|
63
|
-
"rimraf": "
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"ts-
|
|
67
|
-
"typescript": "
|
|
68
|
-
"webpack": "
|
|
69
|
-
"webpack-cli": "
|
|
70
|
-
"webpack-dev-server": "
|
|
39
|
+
"@testing-library/react": "12.1.4",
|
|
40
|
+
"@types/enzyme": "3.10.12",
|
|
41
|
+
"@types/enzyme-adapter-react-16": "1.0.6",
|
|
42
|
+
"@types/jest": "27.4.1",
|
|
43
|
+
"@types/react": "16.9.0",
|
|
44
|
+
"@types/react-beautiful-dnd": "13.1.2",
|
|
45
|
+
"@types/react-dom": "16.9.0",
|
|
46
|
+
"@typescript-eslint/eslint-plugin": "5.18.0",
|
|
47
|
+
"@typescript-eslint/parser": "5.18.0",
|
|
48
|
+
"copyfiles": "2.4.1",
|
|
49
|
+
"css-loader": "6.7.1",
|
|
50
|
+
"eslint": "8.13.0",
|
|
51
|
+
"eslint-config-prettier": "8.5.0",
|
|
52
|
+
"eslint-plugin-prettier": "4.0.0",
|
|
53
|
+
"eslint-plugin-react": "7.29.4",
|
|
54
|
+
"html-webpack-plugin": "5.5.0",
|
|
55
|
+
"jest": "27.5.1",
|
|
56
|
+
"jest-each": "27.5.1",
|
|
57
|
+
"less": "4.1.2",
|
|
58
|
+
"less-loader": "10.2.0",
|
|
59
|
+
"@fluentui/react": "8.41.0",
|
|
60
|
+
"prettier": "2.6.2",
|
|
61
|
+
"react": "16.9.0",
|
|
62
|
+
"react-dom": "16.9.0",
|
|
63
|
+
"rimraf": "3.0.2",
|
|
64
|
+
"style-loader": "3.3.1",
|
|
65
|
+
"ts-jest": "27.1.4",
|
|
66
|
+
"ts-loader": "9.2.8",
|
|
67
|
+
"typescript": "4.3.2",
|
|
68
|
+
"webpack": "5.72.0",
|
|
69
|
+
"webpack-cli": "4.9.2",
|
|
70
|
+
"webpack-dev-server": "4.8.1"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
"react-beautiful-dnd": "13.1.0"
|
|
74
|
+
},
|
|
75
|
+
"peerDependencies": {
|
|
76
|
+
"@fluentui/react": ">=7.179.1",
|
|
77
|
+
"react": ">=16.9.0"
|
|
76
78
|
}
|
|
77
79
|
}
|
package/lib/SingleValueInputElements/DependentInputElement/DependentInputElementInitializer.d.ts
DELETED
|
File without changes
|
package/lib/SingleValueInputElements/DependentInputElement/DependentInputElementInitializer.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// import { ISingleValueInputElement } from '../ISingleValueInputElement';
|
|
2
|
-
// import { UpdateType } from '../../UpdateType';
|
|
3
|
-
//
|
|
4
|
-
// export class DependentInputElementInitializer {
|
|
5
|
-
// public static initializeDependency<TDependent, TPrincipal, TDependentProps = unknown, TPrincipalProps = unknown>(
|
|
6
|
-
// principal: ISingleValueInputElement<TPrincipal, TPrincipalProps>,
|
|
7
|
-
// dependent: ISingleValueInputElement<TDependent, TDependentProps>,
|
|
8
|
-
// onPrincipalValueChanged: (newValue: TPrincipal, doneCallback: () => void) => void,
|
|
9
|
-
// handleFalsyPrincipalValue?: () => void,
|
|
10
|
-
// handleInitialRender?: () => void
|
|
11
|
-
// ): void {
|
|
12
|
-
// if (!dependent || !principal || !onPrincipalValueChanged) return;
|
|
13
|
-
//
|
|
14
|
-
// // If the dependent input element is required, this means that the principal should be required as well.
|
|
15
|
-
// if (!!dependent.configuration?.isRequired) {
|
|
16
|
-
// if (!principal.configuration) principal.configuration = { isRequired: true };
|
|
17
|
-
// else principal.configuration.isRequired = true;
|
|
18
|
-
// }
|
|
19
|
-
//
|
|
20
|
-
// const originalUpdateFunction = principal.update;
|
|
21
|
-
// principal.update = (updateType: UpdateType): void => {
|
|
22
|
-
// if (!!originalUpdateFunction) originalUpdateFunction(updateType);
|
|
23
|
-
//
|
|
24
|
-
// if (updateType === UpdateType.System) {
|
|
25
|
-
// // Handle the system events - loading/ hiding an input element.
|
|
26
|
-
// if (principal.isLoading || !principal.isVisible) dependent.hide();
|
|
27
|
-
// else dependent.show();
|
|
28
|
-
// } else {
|
|
29
|
-
// dependent.resetValue();
|
|
30
|
-
// if (!!principal.value === false) {
|
|
31
|
-
// // If the falsy value is handled explicitly, execute that callback.
|
|
32
|
-
// // In every other case, hide the dependent component.
|
|
33
|
-
// if (!!handleFalsyPrincipalValue) handleFalsyPrincipalValue();
|
|
34
|
-
// else if (dependent.isVisible) dependent.hide();
|
|
35
|
-
// } else {
|
|
36
|
-
// // Ensure that the dependent input element is visible.
|
|
37
|
-
// if (!dependent.isVisible) dependent.show();
|
|
38
|
-
//
|
|
39
|
-
// dependent.load((finish: () => void): void => {
|
|
40
|
-
// onPrincipalValueChanged(principal.value, finish);
|
|
41
|
-
// });
|
|
42
|
-
// }
|
|
43
|
-
// }
|
|
44
|
-
// };
|
|
45
|
-
//
|
|
46
|
-
// // If a callback to handle the initial render is passed, execute it.
|
|
47
|
-
// // Else, hide the input element.
|
|
48
|
-
// if (!!handleInitialRender) handleInitialRender();
|
|
49
|
-
// else dependent.hide();
|
|
50
|
-
// }
|
|
51
|
-
// }
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// export * from './DependentInputElementInitializer';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { UpdateCallback } from '../../IInputElement';
|
|
2
|
-
import { ValidationRule } from '../../IValueInputElement';
|
|
3
|
-
import { IBaseInputElementProps } from '../IBaseInputElementProps';
|
|
4
|
-
import { ISingleValueInputElementConfiguration } from '../ISingleInputElementConfiguration';
|
|
5
|
-
import { SingleValueInputElement } from '../SingleValueInputElement';
|
|
6
|
-
import { IDropdownInputProps } from './IDropdownInputProps';
|
|
7
|
-
export declare class DropdownInputElement extends SingleValueInputElement<string, IBaseInputElementProps, IDropdownInputProps> {
|
|
8
|
-
constructor(config: ISingleValueInputElementConfiguration<string>, props: IBaseInputElementProps, update: UpdateCallback, ...validationRules: ValidationRule<string>[]);
|
|
9
|
-
private static consistencyErrorMessage;
|
|
10
|
-
private getConsistencyValidationRule;
|
|
11
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DropdownInputElement = void 0;
|
|
4
|
-
const SingleValueInputElement_1 = require("../SingleValueInputElement");
|
|
5
|
-
const DropdownInput_1 = require("./DropdownInput");
|
|
6
|
-
class DropdownInputElement extends SingleValueInputElement_1.SingleValueInputElement {
|
|
7
|
-
constructor(config, props, update, ...validationRules) {
|
|
8
|
-
super(config, DropdownInput_1.DropdownInput, props, update, ...validationRules);
|
|
9
|
-
this.validationRules.push(this.getConsistencyValidationRule());
|
|
10
|
-
}
|
|
11
|
-
getConsistencyValidationRule() {
|
|
12
|
-
return (newValue) => {
|
|
13
|
-
const dynamicProps = this.getDynamicProps();
|
|
14
|
-
if (!dynamicProps)
|
|
15
|
-
return DropdownInputElement.consistencyErrorMessage;
|
|
16
|
-
const allOptions = [];
|
|
17
|
-
if (dynamicProps.defaultOption)
|
|
18
|
-
allOptions.push(dynamicProps.defaultOption);
|
|
19
|
-
if (dynamicProps.options && Array.isArray(dynamicProps.options)) {
|
|
20
|
-
dynamicProps.options.forEach((o) => {
|
|
21
|
-
if (!o)
|
|
22
|
-
return;
|
|
23
|
-
allOptions.push(o);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
if (allOptions.some((o) => o.key === newValue))
|
|
27
|
-
return null;
|
|
28
|
-
return DropdownInputElement.consistencyErrorMessage;
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.DropdownInputElement = DropdownInputElement;
|
|
33
|
-
DropdownInputElement.consistencyErrorMessage = 'The value is not present within the specified options.';
|