@vixoniccom/modules 2.11.0 → 2.12.0-dev.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/.vscode/settings.json +2 -2
- package/CHANGELOG.md +289 -264
- package/dist/index.d.ts +6 -6
- package/dist/index.js +32 -31
- package/dist/lib/base.d.ts +28 -36
- package/dist/lib/base.js +63 -58
- package/dist/lib/containers/dynamic-matrix.d.ts +48 -48
- package/dist/lib/containers/dynamic-matrix.js +85 -76
- package/dist/lib/containers/group.d.ts +21 -21
- package/dist/lib/containers/group.js +56 -47
- package/dist/lib/containers/index.d.ts +6 -6
- package/dist/lib/containers/index.js +14 -13
- package/dist/lib/containers/list.d.ts +66 -66
- package/dist/lib/containers/list.js +114 -105
- package/dist/lib/errors.d.ts +22 -22
- package/dist/lib/errors.js +24 -23
- package/dist/lib/index.d.ts +29 -29
- package/dist/lib/index.js +136 -128
- package/dist/lib/inputs/autocomplete.d.ts +31 -31
- package/dist/lib/inputs/autocomplete.js +55 -49
- package/dist/lib/inputs/color-picker.d.ts +23 -23
- package/dist/lib/inputs/color-picker.js +48 -42
- package/dist/lib/inputs/date-input.d.ts +35 -35
- package/dist/lib/inputs/date-input.js +87 -78
- package/dist/lib/inputs/index.d.ts +24 -24
- package/dist/lib/inputs/index.js +52 -49
- package/dist/lib/inputs/number-input.d.ts +29 -29
- package/dist/lib/inputs/number-input.js +62 -53
- package/dist/lib/inputs/select-asset-kna.d.ts +34 -34
- package/dist/lib/inputs/select-asset-kna.js +56 -50
- package/dist/lib/inputs/select-input.d.ts +18 -18
- package/dist/lib/inputs/select-input.js +35 -29
- package/dist/lib/inputs/service-input.d.ts +27 -27
- package/dist/lib/inputs/service-input.js +47 -41
- package/dist/lib/inputs/slider.d.ts +33 -33
- package/dist/lib/inputs/slider.js +57 -51
- package/dist/lib/inputs/switch.d.ts +21 -21
- package/dist/lib/inputs/switch.js +45 -39
- package/dist/lib/inputs/text-area.d.ts +20 -20
- package/dist/lib/inputs/text-area.js +46 -37
- package/dist/lib/inputs/text-format.d.ts +28 -28
- package/dist/lib/inputs/text-format.js +43 -37
- package/dist/lib/inputs/text-input.d.ts +34 -34
- package/dist/lib/inputs/text-input.js +73 -64
- package/dist/lib/ui/index.d.ts +4 -4
- package/dist/lib/ui/index.js +6 -5
- package/dist/lib/ui/label.d.ts +18 -18
- package/dist/lib/ui/label.js +36 -30
- package/dist/lib/utils/index.d.ts +2 -1
- package/dist/lib/utils/index.js +28 -22
- package/dist/lib/utils/typeDefs.d.ts +7 -7
- package/dist/lib/utils/typeDefs.js +19 -18
- package/dist/lib/utils/validation.d.ts +7 -7
- package/dist/lib/utils/validation.js +27 -26
- package/dist/lib/values.d.ts +21 -21
- package/dist/lib/values.js +92 -86
- package/dist/lib/visibility.d.ts +2 -2
- package/dist/lib/visibility.js +21 -20
- package/package.json +23 -22
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { List, Group, DynamicMatrix } from './containers';
|
|
2
|
-
export { Group, List, DynamicMatrix };
|
|
3
|
-
import { InputValue } from './inputs';
|
|
4
|
-
import { ErrorsMap } from './errors';
|
|
5
|
-
export declare namespace Configuration {
|
|
6
|
-
type Value = {
|
|
7
|
-
[key: string]: InputValue;
|
|
8
|
-
};
|
|
9
|
-
type Options = {
|
|
10
|
-
schema: (Group | List | DynamicMatrix)[];
|
|
11
|
-
durationFormula?: string;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export declare class Configuration {
|
|
15
|
-
readonly schema: (Group | List | DynamicMatrix)[];
|
|
16
|
-
readonly durationFormula: string | undefined;
|
|
17
|
-
constructor(options: Configuration.Options);
|
|
18
|
-
validate(state: Configuration.Value): ErrorsMap;
|
|
19
|
-
toJSON(): {
|
|
20
|
-
durationFormula: string | undefined;
|
|
21
|
-
schema: (Group | List | DynamicMatrix)[];
|
|
22
|
-
};
|
|
23
|
-
getDuration(_values: Configuration.Value): number | undefined;
|
|
24
|
-
static fromJSON(input: any): Configuration;
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
export * from './inputs';
|
|
28
|
-
export * from './ui';
|
|
29
|
-
export * from './values';
|
|
1
|
+
import { List, Group, DynamicMatrix } from './containers';
|
|
2
|
+
export { Group, List, DynamicMatrix };
|
|
3
|
+
import { InputValue } from './inputs';
|
|
4
|
+
import { ErrorsMap } from './errors';
|
|
5
|
+
export declare namespace Configuration {
|
|
6
|
+
type Value = {
|
|
7
|
+
[key: string]: InputValue;
|
|
8
|
+
};
|
|
9
|
+
type Options = {
|
|
10
|
+
schema: (Group | List | DynamicMatrix)[];
|
|
11
|
+
durationFormula?: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export declare class Configuration {
|
|
15
|
+
readonly schema: (Group | List | DynamicMatrix)[];
|
|
16
|
+
readonly durationFormula: string | undefined;
|
|
17
|
+
constructor(options: Configuration.Options);
|
|
18
|
+
validate(state: Configuration.Value): ErrorsMap;
|
|
19
|
+
toJSON(): {
|
|
20
|
+
durationFormula: string | undefined;
|
|
21
|
+
schema: (Group | List | DynamicMatrix)[];
|
|
22
|
+
};
|
|
23
|
+
getDuration(_values: Configuration.Value): number | undefined;
|
|
24
|
+
static fromJSON(input: any): Configuration;
|
|
25
|
+
get declarationFileString(): string;
|
|
26
|
+
}
|
|
27
|
+
export * from './inputs';
|
|
28
|
+
export * from './ui';
|
|
29
|
+
export * from './values';
|
package/dist/lib/index.js
CHANGED
|
@@ -1,128 +1,136 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
errors[container.id] =
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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
|
+
exports.Configuration = exports.DynamicMatrix = exports.List = exports.Group = void 0;
|
|
14
|
+
var containers_1 = require("./containers");
|
|
15
|
+
Object.defineProperty(exports, "List", { enumerable: true, get: function () { return containers_1.List; } });
|
|
16
|
+
Object.defineProperty(exports, "Group", { enumerable: true, get: function () { return containers_1.Group; } });
|
|
17
|
+
Object.defineProperty(exports, "DynamicMatrix", { enumerable: true, get: function () { return containers_1.DynamicMatrix; } });
|
|
18
|
+
var typeDefs_1 = require("./utils/typeDefs");
|
|
19
|
+
var inputs_1 = require("./inputs");
|
|
20
|
+
var Configuration = /** @class */ (function () {
|
|
21
|
+
function Configuration(options) {
|
|
22
|
+
this.schema = options.schema;
|
|
23
|
+
this.durationFormula = options.durationFormula;
|
|
24
|
+
}
|
|
25
|
+
Configuration.prototype.validate = function (state) {
|
|
26
|
+
var errors = {};
|
|
27
|
+
this.schema.forEach(function (container) {
|
|
28
|
+
var visible = container.shouldShow(state);
|
|
29
|
+
if (visible === false)
|
|
30
|
+
return;
|
|
31
|
+
if (containers_1.Group.isInstance(container)) {
|
|
32
|
+
var groupErrors_1 = {};
|
|
33
|
+
// Validate each input in a group.
|
|
34
|
+
container.items.forEach(function (input) {
|
|
35
|
+
if (inputs_1.isInput(input)) {
|
|
36
|
+
var inputErrors = input.validate(state[input.id], state);
|
|
37
|
+
groupErrors_1[input.id] = inputErrors;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
errors[container.id] = groupErrors_1;
|
|
41
|
+
}
|
|
42
|
+
else if (containers_1.List.isInstance(container)) {
|
|
43
|
+
// Validate the list.
|
|
44
|
+
errors[container.id] = container.validate(state[container.id], state);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
// Validate the dynamic matrix.
|
|
48
|
+
errors[container.id] = container.validate(state[container.id], state);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return errors;
|
|
52
|
+
};
|
|
53
|
+
Configuration.prototype.toJSON = function () {
|
|
54
|
+
var allIds = [];
|
|
55
|
+
this.schema.forEach(function (cont) {
|
|
56
|
+
allIds.push(cont.id);
|
|
57
|
+
if (containers_1.Group.isInstance(cont)) {
|
|
58
|
+
cont.items.forEach(function (item) {
|
|
59
|
+
if (item.hasOwnProperty('id'))
|
|
60
|
+
allIds.push(item.id);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
var duplicatedIds = allIds.filter(function (e, i, s) { return s.indexOf(e) !== i; });
|
|
65
|
+
if (duplicatedIds.length > 0)
|
|
66
|
+
console.warn("Attention, your configuration has duplicated ids [\"" + duplicatedIds.join('", "') + "\"]. If it is not intentional please check it.");
|
|
67
|
+
return {
|
|
68
|
+
durationFormula: this.durationFormula,
|
|
69
|
+
schema: this.schema
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
Configuration.prototype.getDuration = function (_values) {
|
|
73
|
+
if (!this.durationFormula)
|
|
74
|
+
return undefined;
|
|
75
|
+
var jsEval = this.durationFormula;
|
|
76
|
+
try {
|
|
77
|
+
var regexp = new RegExp('{{(.*?)}}', 'ig');
|
|
78
|
+
jsEval = jsEval.replace(regexp, "_values.$1");
|
|
79
|
+
// tslint:disable-next-line
|
|
80
|
+
var time = eval(jsEval);
|
|
81
|
+
if (typeof time === 'number') {
|
|
82
|
+
// validate number
|
|
83
|
+
if (isNaN(time) || time < 4 || time >= 86400) {
|
|
84
|
+
console.warn("Computed time error: Number is not valid [" + time + "]");
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
return time;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
console.warn("Computed time error: Time expression result is not a number [\"" + typeof time + "\"]");
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
catch (e) {
|
|
95
|
+
console.warn('Computed time error: Unable to parse time expression:', jsEval, e);
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
Configuration.fromJSON = function (input) {
|
|
100
|
+
var schema = input.schema;
|
|
101
|
+
var durationFormula = input.durationFormula;
|
|
102
|
+
return new Configuration({
|
|
103
|
+
durationFormula: durationFormula,
|
|
104
|
+
schema: schema.map(function (i) {
|
|
105
|
+
switch (i.type) {
|
|
106
|
+
case containers_1.List.type:
|
|
107
|
+
return containers_1.List.fromJSON(i);
|
|
108
|
+
case containers_1.Group.type:
|
|
109
|
+
return containers_1.Group.fromJSON(i);
|
|
110
|
+
case containers_1.DynamicMatrix.type:
|
|
111
|
+
return containers_1.DynamicMatrix.fromJSON(i);
|
|
112
|
+
}
|
|
113
|
+
throw new Error("Invalid component type \"" + i.type + "\" in root configuration.");
|
|
114
|
+
})
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
Object.defineProperty(Configuration.prototype, "declarationFileString", {
|
|
118
|
+
get: function () {
|
|
119
|
+
var declarations = [];
|
|
120
|
+
this.schema.forEach(function (g) {
|
|
121
|
+
declarations = declarations.concat(g.valueTypeDef());
|
|
122
|
+
});
|
|
123
|
+
return "declare type VixonicData = {\n downloadsPath: string\n services: { [key: string]: { data?: any, updatedAt?: number } }\n parameters: VixonicParameters\n}\n\ndeclare type VixonicParameters = Partial<{\n " + typeDefs_1.defsMapToString(declarations) + "\n}>";
|
|
124
|
+
},
|
|
125
|
+
enumerable: false,
|
|
126
|
+
configurable: true
|
|
127
|
+
});
|
|
128
|
+
return Configuration;
|
|
129
|
+
}());
|
|
130
|
+
exports.Configuration = Configuration;
|
|
131
|
+
// Input components
|
|
132
|
+
__exportStar(require("./inputs"), exports);
|
|
133
|
+
// UI components
|
|
134
|
+
__exportStar(require("./ui"), exports);
|
|
135
|
+
// Values
|
|
136
|
+
__exportStar(require("./values"), exports);
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { Input, IInput } from '../base';
|
|
2
|
-
import { ValueError } from '../errors';
|
|
3
|
-
export interface IAutocomplete<T extends Autocomplete.Value> extends IInput {
|
|
4
|
-
items: AutocompleteItem<T>[];
|
|
5
|
-
description?: string;
|
|
6
|
-
required?: boolean;
|
|
7
|
-
defaultValue?: T;
|
|
8
|
-
}
|
|
9
|
-
export declare type AutocompleteItem<T> = {
|
|
10
|
-
label: string;
|
|
11
|
-
value: T;
|
|
12
|
-
};
|
|
13
|
-
export declare namespace Autocomplete {
|
|
14
|
-
type Error = ValueError.Required | ValueError.InvalidValue;
|
|
15
|
-
type Value = number | string;
|
|
16
|
-
}
|
|
17
|
-
export declare class Autocomplete<T extends Autocomplete.Value> extends Input<Autocomplete.Value, Autocomplete.Error> {
|
|
18
|
-
static type: string;
|
|
19
|
-
type: string;
|
|
20
|
-
readonly items: AutocompleteItem<T>[];
|
|
21
|
-
readonly description?: string;
|
|
22
|
-
readonly required?: boolean;
|
|
23
|
-
readonly multiple?: boolean;
|
|
24
|
-
readonly searchEnabled?: boolean;
|
|
25
|
-
readonly defaultValue?: T;
|
|
26
|
-
constructor(options: IAutocomplete<T>);
|
|
27
|
-
validateInput(value: T): Autocomplete.Error[];
|
|
28
|
-
isValidValue(value: any): value is T;
|
|
29
|
-
static fromJSON(value: IAutocomplete<any>): Autocomplete<any>;
|
|
30
|
-
valueTypeDef: () => string;
|
|
31
|
-
}
|
|
1
|
+
import { Input, IInput } from '../base';
|
|
2
|
+
import { ValueError } from '../errors';
|
|
3
|
+
export interface IAutocomplete<T extends Autocomplete.Value> extends IInput {
|
|
4
|
+
items: AutocompleteItem<T>[];
|
|
5
|
+
description?: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
defaultValue?: T;
|
|
8
|
+
}
|
|
9
|
+
export declare type AutocompleteItem<T> = {
|
|
10
|
+
label: string;
|
|
11
|
+
value: T;
|
|
12
|
+
};
|
|
13
|
+
export declare namespace Autocomplete {
|
|
14
|
+
type Error = ValueError.Required | ValueError.InvalidValue;
|
|
15
|
+
type Value = number | string;
|
|
16
|
+
}
|
|
17
|
+
export declare class Autocomplete<T extends Autocomplete.Value> extends Input<Autocomplete.Value, Autocomplete.Error> {
|
|
18
|
+
static type: string;
|
|
19
|
+
type: string;
|
|
20
|
+
readonly items: AutocompleteItem<T>[];
|
|
21
|
+
readonly description?: string;
|
|
22
|
+
readonly required?: boolean;
|
|
23
|
+
readonly multiple?: boolean;
|
|
24
|
+
readonly searchEnabled?: boolean;
|
|
25
|
+
readonly defaultValue?: T;
|
|
26
|
+
constructor(options: IAutocomplete<T>);
|
|
27
|
+
validateInput(value: T): Autocomplete.Error[];
|
|
28
|
+
isValidValue(value: any): value is T;
|
|
29
|
+
static fromJSON(value: IAutocomplete<any>): Autocomplete<any>;
|
|
30
|
+
valueTypeDef: () => string;
|
|
31
|
+
}
|
|
@@ -1,49 +1,55 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
extendStatics(d, b);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return
|
|
45
|
-
};
|
|
46
|
-
Autocomplete.
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.Autocomplete = void 0;
|
|
19
|
+
var base_1 = require("../base");
|
|
20
|
+
var validation_1 = require("../utils/validation");
|
|
21
|
+
var Autocomplete = /** @class */ (function (_super) {
|
|
22
|
+
__extends(Autocomplete, _super);
|
|
23
|
+
function Autocomplete(options) {
|
|
24
|
+
var _this = _super.call(this, options) || this;
|
|
25
|
+
_this.type = Autocomplete.type;
|
|
26
|
+
_this.valueTypeDef = function () {
|
|
27
|
+
var options = _this.items.map(function (i) {
|
|
28
|
+
if (typeof i.value === 'string')
|
|
29
|
+
return "'" + i.value + "'";
|
|
30
|
+
else
|
|
31
|
+
return i.value.toString();
|
|
32
|
+
}).join(' | ');
|
|
33
|
+
return _this.multiple ? "(" + options + ")[]" : options;
|
|
34
|
+
};
|
|
35
|
+
_this.description = options.description;
|
|
36
|
+
_this.items = options.items;
|
|
37
|
+
_this.required = options.required;
|
|
38
|
+
_this.defaultValue = options.defaultValue;
|
|
39
|
+
return _this;
|
|
40
|
+
}
|
|
41
|
+
Autocomplete.prototype.validateInput = function (value) {
|
|
42
|
+
var errors = [];
|
|
43
|
+
errors = errors.concat(validation_1.Validator.required(value, this.required, true));
|
|
44
|
+
return errors;
|
|
45
|
+
};
|
|
46
|
+
Autocomplete.prototype.isValidValue = function (value) {
|
|
47
|
+
return Array.isArray(value) || typeof value === 'string' || typeof value === 'number';
|
|
48
|
+
};
|
|
49
|
+
Autocomplete.fromJSON = function (value) {
|
|
50
|
+
return new Autocomplete(value);
|
|
51
|
+
};
|
|
52
|
+
Autocomplete.type = 'autocomplete';
|
|
53
|
+
return Autocomplete;
|
|
54
|
+
}(base_1.Input));
|
|
55
|
+
exports.Autocomplete = Autocomplete;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { Input, IInput } from '../base';
|
|
2
|
-
import { ValueError
|
|
3
|
-
export interface IColorPicker extends IInput {
|
|
4
|
-
description?: string;
|
|
5
|
-
required?: boolean;
|
|
6
|
-
output?: 'hex' | 'rgba';
|
|
7
|
-
}
|
|
8
|
-
export declare namespace ColorPicker {
|
|
9
|
-
type Error = ValueError.Required | ValueError.InvalidValue;
|
|
10
|
-
type Value = string;
|
|
11
|
-
}
|
|
12
|
-
export declare class ColorPicker extends Input<ColorPicker.Value, ColorPicker.Error> {
|
|
13
|
-
static type: string;
|
|
14
|
-
type: string;
|
|
15
|
-
readonly description?: string;
|
|
16
|
-
readonly required?: boolean;
|
|
17
|
-
readonly output: 'hex' | 'rgba' | 'auto';
|
|
18
|
-
constructor(options: IColorPicker);
|
|
19
|
-
validateInput(value: string):
|
|
20
|
-
isValidValue(value: any): value is ColorPicker.Value;
|
|
21
|
-
static fromJSON: (value: IColorPicker) => ColorPicker;
|
|
22
|
-
valueTypeDef: () => string;
|
|
23
|
-
}
|
|
1
|
+
import { Input, IInput } from '../base';
|
|
2
|
+
import { ValueError } from '../errors';
|
|
3
|
+
export interface IColorPicker extends IInput {
|
|
4
|
+
description?: string;
|
|
5
|
+
required?: boolean;
|
|
6
|
+
output?: 'hex' | 'rgba';
|
|
7
|
+
}
|
|
8
|
+
export declare namespace ColorPicker {
|
|
9
|
+
type Error = ValueError.Required | ValueError.InvalidValue;
|
|
10
|
+
type Value = string;
|
|
11
|
+
}
|
|
12
|
+
export declare class ColorPicker extends Input<ColorPicker.Value, ColorPicker.Error> {
|
|
13
|
+
static type: string;
|
|
14
|
+
type: string;
|
|
15
|
+
readonly description?: string;
|
|
16
|
+
readonly required?: boolean;
|
|
17
|
+
readonly output: 'hex' | 'rgba' | 'auto';
|
|
18
|
+
constructor(options: IColorPicker);
|
|
19
|
+
validateInput(value: string): ColorPicker.Error[];
|
|
20
|
+
isValidValue(value: any): value is ColorPicker.Value;
|
|
21
|
+
static fromJSON: (value: IColorPicker) => ColorPicker;
|
|
22
|
+
valueTypeDef: () => string;
|
|
23
|
+
}
|