@formio/js 5.0.0-rc.77 → 5.0.0-rc.79
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +21 -21
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +2 -2
- package/dist/formio.full.js +28 -28
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +2 -2
- package/dist/formio.js +3 -3
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +12 -12
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -2
- package/lib/cjs/Webform.js +5 -2
- package/lib/cjs/components/_classes/component/Component.js +2 -2
- package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +8 -0
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +18 -12
- package/lib/cjs/components/day/Day.d.ts +5 -0
- package/lib/cjs/components/day/Day.js +52 -12
- package/lib/cjs/components/day/editForm/Day.edit.day.d.ts +17 -0
- package/lib/cjs/components/day/editForm/Day.edit.day.js +19 -0
- package/lib/cjs/components/day/editForm/Day.edit.month.d.ts +5 -0
- package/lib/cjs/components/day/editForm/Day.edit.month.js +19 -0
- package/lib/cjs/components/day/editForm/Day.edit.year.d.ts +5 -0
- package/lib/cjs/components/day/editForm/Day.edit.year.js +13 -0
- package/lib/cjs/components/radio/Radio.js +1 -1
- package/lib/cjs/components/select/Select.d.ts +38 -0
- package/lib/cjs/components/select/Select.js +15 -2
- package/lib/cjs/components/select/editForm/Select.edit.validation.js +2 -1
- package/lib/cjs/components/select/fixtures/comp25.d.ts +44 -0
- package/lib/cjs/components/select/fixtures/comp25.js +59 -0
- package/lib/cjs/components/select/fixtures/comp27.d.ts +18 -0
- package/lib/cjs/components/select/fixtures/comp27.js +19 -0
- package/lib/cjs/components/select/fixtures/index.d.ts +3 -1
- package/lib/cjs/components/select/fixtures/index.js +7 -1
- package/lib/cjs/components/selectboxes/SelectBoxes.js +1 -1
- package/lib/cjs/utils/conditionOperators/DateGreaterThan.js +2 -1
- package/lib/cjs/utils/conditionOperators/IsEmptyValue.js +2 -2
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +2 -2
- package/lib/cjs/utils/formUtils.d.ts +1 -2
- package/lib/cjs/utils/formUtils.js +2 -3
- package/lib/mjs/Webform.js +9 -2
- package/lib/mjs/components/_classes/component/Component.js +2 -2
- package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +8 -0
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +18 -12
- package/lib/mjs/components/day/Day.d.ts +5 -0
- package/lib/mjs/components/day/Day.js +52 -12
- package/lib/mjs/components/day/editForm/Day.edit.day.d.ts +17 -0
- package/lib/mjs/components/day/editForm/Day.edit.day.js +16 -0
- package/lib/mjs/components/day/editForm/Day.edit.month.d.ts +5 -0
- package/lib/mjs/components/day/editForm/Day.edit.month.js +16 -0
- package/lib/mjs/components/day/editForm/Day.edit.year.d.ts +5 -0
- package/lib/mjs/components/day/editForm/Day.edit.year.js +10 -0
- package/lib/mjs/components/radio/Radio.js +1 -1
- package/lib/mjs/components/select/Select.d.ts +38 -0
- package/lib/mjs/components/select/Select.js +18 -3
- package/lib/mjs/components/select/editForm/Select.edit.validation.js +2 -1
- package/lib/mjs/components/select/fixtures/comp25.d.ts +44 -0
- package/lib/mjs/components/select/fixtures/comp25.js +57 -0
- package/lib/mjs/components/select/fixtures/comp27.d.ts +18 -0
- package/lib/mjs/components/select/fixtures/comp27.js +17 -0
- package/lib/mjs/components/select/fixtures/index.d.ts +3 -1
- package/lib/mjs/components/select/fixtures/index.js +4 -1
- package/lib/mjs/components/selectboxes/SelectBoxes.js +1 -1
- package/lib/mjs/utils/conditionOperators/DateGreaterThan.js +1 -1
- package/lib/mjs/utils/conditionOperators/IsEmptyValue.js +2 -2
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +2 -2
- package/lib/mjs/utils/formUtils.d.ts +1 -2
- package/lib/mjs/utils/formUtils.js +2 -2
- package/package.json +2 -2
@@ -18,9 +18,9 @@
|
|
18
18
|
* MIT licensed
|
19
19
|
*/
|
20
20
|
|
21
|
-
/*! @license DOMPurify 3.1.
|
21
|
+
/*! @license DOMPurify 3.1.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.6/LICENSE */
|
22
22
|
|
23
|
-
/*! formiojs v5.0.0-rc.
|
23
|
+
/*! formiojs v5.0.0-rc.79 | https://unpkg.com/formiojs@5.0.0-rc.79/LICENSE.txt */
|
24
24
|
|
25
25
|
/**
|
26
26
|
* @license
|
package/lib/cjs/Webform.js
CHANGED
@@ -1089,6 +1089,9 @@ class Webform extends NestedDataComponent_1.default {
|
|
1089
1089
|
if (!Array.isArray(errors)) {
|
1090
1090
|
errors = [errors];
|
1091
1091
|
}
|
1092
|
+
if (Array.isArray(this.errors)) {
|
1093
|
+
errors = lodash_1.default.union(errors, this.errors);
|
1094
|
+
}
|
1092
1095
|
errors = errors.concat(this.customErrors).filter((err) => !!err);
|
1093
1096
|
if (!errors.length) {
|
1094
1097
|
this.setAlert(false);
|
@@ -1236,10 +1239,10 @@ class Webform extends NestedDataComponent_1.default {
|
|
1236
1239
|
}
|
1237
1240
|
this.checkData(value.data, flags);
|
1238
1241
|
const shouldValidate = !flags.noValidate ||
|
1239
|
-
flags.
|
1242
|
+
flags.fromIframe ||
|
1240
1243
|
(flags.fromSubmission && this.rootPristine && this.pristine && flags.changed);
|
1241
1244
|
const errors = shouldValidate
|
1242
|
-
? this.validate(value.data, Object.assign(Object.assign({}, flags), { process:
|
1245
|
+
? this.validate(value.data, Object.assign(Object.assign({}, flags), { noValidate: false, process: 'change' }))
|
1243
1246
|
: [];
|
1244
1247
|
value.isValid = errors.length === 0;
|
1245
1248
|
this.loading = false;
|
@@ -2996,7 +2996,7 @@ class Component extends Element_1.default {
|
|
2996
2996
|
this.parent.childErrors.push(...errors);
|
2997
2997
|
}
|
2998
2998
|
else {
|
2999
|
-
lodash_1.default.remove(this.parent.childErrors, (err) => err.component.key === this.component.key);
|
2999
|
+
lodash_1.default.remove(this.parent.childErrors, (err) => { var _a, _b; return (((_a = err === null || err === void 0 ? void 0 : err.component) === null || _a === void 0 ? void 0 : _a.key) || ((_b = err === null || err === void 0 ? void 0 : err.context) === null || _b === void 0 ? void 0 : _b.key)) === this.component.key; });
|
3000
3000
|
}
|
3001
3001
|
}
|
3002
3002
|
this.showValidationErrors(errors, data, row, flags);
|
@@ -3012,7 +3012,7 @@ class Component extends Element_1.default {
|
|
3012
3012
|
this.parent.childErrors.push(...errors);
|
3013
3013
|
}
|
3014
3014
|
else {
|
3015
|
-
lodash_1.default.remove(this.parent.childErrors, (err) => err.component.key === this.component.key);
|
3015
|
+
lodash_1.default.remove(this.parent.childErrors, (err) => { var _a, _b; return (((_a = err === null || err === void 0 ? void 0 : err.component) === null || _a === void 0 ? void 0 : _a.key) || ((_b = err === null || err === void 0 ? void 0 : err.context) === null || _b === void 0 ? void 0 : _b.key)) === this.component.key; });
|
3016
3016
|
}
|
3017
3017
|
}
|
3018
3018
|
return errors.length === 0;
|
@@ -1,4 +1,12 @@
|
|
1
1
|
export default class Multivalue extends Field {
|
2
|
+
/**
|
3
|
+
* Normalize values coming into updateValue.
|
4
|
+
* @param {*} value - The value to normalize before setting.
|
5
|
+
* @param {object} flags - Flags to use when normalizing the value.
|
6
|
+
* @param {*} emptyValue - The empty value for the field.
|
7
|
+
* @returns {*} - The normalized value.
|
8
|
+
*/
|
9
|
+
normalizeValue(value: any, flags?: object, emptyValue?: any): any;
|
2
10
|
get addAnother(): string;
|
3
11
|
/**
|
4
12
|
* @returns {Field} - The created field.
|
@@ -5,41 +5,47 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const Field_1 = __importDefault(require("../field/Field"));
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
8
|
+
const core_1 = require("@formio/core");
|
8
9
|
class Multivalue extends Field_1.default {
|
9
10
|
/**
|
10
11
|
* Normalize values coming into updateValue.
|
11
12
|
* @param {*} value - The value to normalize before setting.
|
13
|
+
* @param {object} flags - Flags to use when normalizing the value.
|
14
|
+
* @param {*} emptyValue - The empty value for the field.
|
12
15
|
* @returns {*} - The normalized value.
|
13
16
|
*/
|
14
|
-
normalizeValue(value) {
|
17
|
+
normalizeValue(value, flags = {}, emptyValue = this.emptyValue) {
|
18
|
+
const underlyingValueShouldBeArray = core_1.Utils.getModelType(this.component) === 'array' || this.component.storeas === 'array' || Array.isArray(emptyValue);
|
15
19
|
if (this.component.multiple) {
|
16
20
|
if (Array.isArray(value)) {
|
17
|
-
if (
|
18
|
-
|
21
|
+
if (underlyingValueShouldBeArray) {
|
22
|
+
if (value.length === 0 || !Array.isArray(value[0])) {
|
23
|
+
return [value];
|
24
|
+
}
|
19
25
|
}
|
20
|
-
if (
|
21
|
-
return
|
26
|
+
if (value.length === 0) {
|
27
|
+
return [emptyValue];
|
22
28
|
}
|
23
|
-
return super.normalizeValue(value);
|
29
|
+
return super.normalizeValue(value, flags);
|
24
30
|
}
|
25
31
|
else {
|
26
|
-
return super.normalizeValue(value == null ? [
|
32
|
+
return super.normalizeValue(value == null ? [emptyValue] : [value], flags);
|
27
33
|
}
|
28
34
|
}
|
29
35
|
else {
|
30
|
-
if (Array.isArray(value) &&
|
36
|
+
if (Array.isArray(value) && !underlyingValueShouldBeArray) {
|
31
37
|
if (this.component.storeas === 'string') {
|
32
|
-
return super.normalizeValue(value.join(this.delimiter || ''));
|
38
|
+
return super.normalizeValue(value.join(this.delimiter || ''), flags);
|
33
39
|
}
|
34
|
-
return super.normalizeValue(value[0] ||
|
40
|
+
return super.normalizeValue(value[0] || emptyValue, flags);
|
35
41
|
}
|
36
42
|
else {
|
37
|
-
return super.normalizeValue(value);
|
43
|
+
return super.normalizeValue(value, flags);
|
38
44
|
}
|
39
45
|
}
|
40
46
|
}
|
41
47
|
get dataValue() {
|
42
|
-
return super.dataValue;
|
48
|
+
return this.normalizeValue(super.dataValue);
|
43
49
|
}
|
44
50
|
set dataValue(value) {
|
45
51
|
super.dataValue = value;
|
@@ -97,6 +97,11 @@ export default class DayComponent extends Field {
|
|
97
97
|
* @returns {null|void} - Returns null if the value is invalid, otherwise void.
|
98
98
|
*/
|
99
99
|
setValueAt(index: number, value: any): null | void;
|
100
|
+
getDayWithHiddenFields(parts: any): {
|
101
|
+
month: any;
|
102
|
+
day: any;
|
103
|
+
year: any;
|
104
|
+
};
|
100
105
|
getFieldValue(name: any): number;
|
101
106
|
get parts(): {
|
102
107
|
day: number;
|
@@ -344,6 +344,18 @@ class DayComponent extends Field_1.default {
|
|
344
344
|
const valueParts = value.split('/');
|
345
345
|
const [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
|
346
346
|
const defaultValue = this.component.defaultValue ? this.component.defaultValue.split('/') : '';
|
347
|
+
let defaultDay = '';
|
348
|
+
let defaultMonth = '';
|
349
|
+
let defaultYear = '';
|
350
|
+
if (defaultValue) {
|
351
|
+
const hasHiddenFields = defaultValue.length !== 3;
|
352
|
+
defaultDay = hasHiddenFields ? this.getDayWithHiddenFields(defaultValue).day : defaultValue[DAY];
|
353
|
+
defaultMonth = hasHiddenFields ? this.getDayWithHiddenFields(defaultValue).month : defaultValue[MONTH];
|
354
|
+
defaultYear = hasHiddenFields ? this.getDayWithHiddenFields(defaultValue).year : defaultValue[YEAR];
|
355
|
+
}
|
356
|
+
if (this.options.building && defaultValue.length === 3) {
|
357
|
+
return this.component.defaultValue;
|
358
|
+
}
|
347
359
|
const getNextPart = (shouldTake, defaultValue) => {
|
348
360
|
// Only push the part if it's not an empty string
|
349
361
|
const part = shouldTake ? valueParts.shift() : defaultValue;
|
@@ -352,13 +364,13 @@ class DayComponent extends Field_1.default {
|
|
352
364
|
}
|
353
365
|
};
|
354
366
|
if (this.dayFirst) {
|
355
|
-
getNextPart(this.showDay,
|
367
|
+
getNextPart(this.showDay, defaultDay);
|
356
368
|
}
|
357
|
-
getNextPart(this.showMonth,
|
369
|
+
getNextPart(this.showMonth, defaultMonth);
|
358
370
|
if (!this.dayFirst) {
|
359
|
-
getNextPart(this.showDay,
|
371
|
+
getNextPart(this.showDay, defaultDay);
|
360
372
|
}
|
361
|
-
getNextPart(this.showYear,
|
373
|
+
getNextPart(this.showYear, defaultYear);
|
362
374
|
return dateParts.join('/');
|
363
375
|
}
|
364
376
|
/**
|
@@ -373,16 +385,23 @@ class DayComponent extends Field_1.default {
|
|
373
385
|
if (value === 'Invalid date') {
|
374
386
|
return null;
|
375
387
|
}
|
388
|
+
let day, month, year;
|
376
389
|
const parts = value.split('/');
|
377
|
-
|
378
|
-
|
379
|
-
|
390
|
+
if (parts.length !== 3) {
|
391
|
+
day = this.getDayWithHiddenFields(parts).day;
|
392
|
+
month = this.getDayWithHiddenFields(parts).month;
|
393
|
+
year = this.getDayWithHiddenFields(parts).year;
|
380
394
|
}
|
381
|
-
|
382
|
-
|
383
|
-
|
395
|
+
else {
|
396
|
+
if (this.component.dayFirst) {
|
397
|
+
day = parts.shift();
|
398
|
+
}
|
399
|
+
month = parts.shift();
|
400
|
+
if (!this.component.dayFirst) {
|
401
|
+
day = parts.shift();
|
402
|
+
}
|
403
|
+
year = parts.shift();
|
384
404
|
}
|
385
|
-
const year = parts.shift();
|
386
405
|
if (this.refs.day && this.showDay) {
|
387
406
|
this.refs.day.value = day === '00' ? '' : parseInt(day, 10);
|
388
407
|
}
|
@@ -393,6 +412,27 @@ class DayComponent extends Field_1.default {
|
|
393
412
|
this.refs.year.value = year === '0000' ? '' : parseInt(year, 10);
|
394
413
|
}
|
395
414
|
}
|
415
|
+
getDayWithHiddenFields(parts) {
|
416
|
+
let [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
|
417
|
+
if (!this.showDay) {
|
418
|
+
MONTH = MONTH === 0 ? 0 : MONTH - 1;
|
419
|
+
YEAR = YEAR - 1;
|
420
|
+
DAY = null;
|
421
|
+
}
|
422
|
+
if (!this.showMonth) {
|
423
|
+
DAY = DAY === 0 ? 0 : DAY - 1;
|
424
|
+
YEAR = YEAR - 1;
|
425
|
+
MONTH = null;
|
426
|
+
}
|
427
|
+
if (!this.showYear) {
|
428
|
+
YEAR = null;
|
429
|
+
}
|
430
|
+
return {
|
431
|
+
month: lodash_1.default.isNull(MONTH) ? '' : parts[MONTH],
|
432
|
+
day: lodash_1.default.isNull(DAY) ? '' : parts[DAY],
|
433
|
+
year: lodash_1.default.isNull(YEAR) ? '' : parts[YEAR],
|
434
|
+
};
|
435
|
+
}
|
396
436
|
getFieldValue(name) {
|
397
437
|
const parts = this.dataValue ? this.dataValue.split('/') : [];
|
398
438
|
let val = 0;
|
@@ -561,7 +601,7 @@ class DayComponent extends Field_1.default {
|
|
561
601
|
}
|
562
602
|
isPartialDay(value) {
|
563
603
|
if (!value) {
|
564
|
-
return
|
604
|
+
return true;
|
565
605
|
}
|
566
606
|
const [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
|
567
607
|
const values = value.split('/');
|
@@ -14,6 +14,7 @@ declare const _default: ({
|
|
14
14
|
input?: undefined;
|
15
15
|
placeholder?: undefined;
|
16
16
|
tooltip?: undefined;
|
17
|
+
onChange?: undefined;
|
17
18
|
} | {
|
18
19
|
weight: number;
|
19
20
|
type: string;
|
@@ -25,16 +26,32 @@ declare const _default: ({
|
|
25
26
|
wieght?: undefined;
|
26
27
|
datasrc?: undefined;
|
27
28
|
data?: undefined;
|
29
|
+
onChange?: undefined;
|
28
30
|
} | {
|
29
31
|
weight: number;
|
30
32
|
type: string;
|
31
33
|
label: string;
|
32
34
|
tooltip: string;
|
33
35
|
key: string;
|
36
|
+
onChange: ({ data }: {
|
37
|
+
data: any;
|
38
|
+
}) => void;
|
34
39
|
input: boolean;
|
35
40
|
wieght?: undefined;
|
36
41
|
datasrc?: undefined;
|
37
42
|
data?: undefined;
|
38
43
|
placeholder?: undefined;
|
44
|
+
} | {
|
45
|
+
weight: number;
|
46
|
+
type: string;
|
47
|
+
label: string;
|
48
|
+
tooltip: string;
|
49
|
+
key: string;
|
50
|
+
input: boolean;
|
51
|
+
wieght?: undefined;
|
52
|
+
datasrc?: undefined;
|
53
|
+
data?: undefined;
|
54
|
+
placeholder?: undefined;
|
55
|
+
onChange?: undefined;
|
39
56
|
})[];
|
40
57
|
export default _default;
|
@@ -1,5 +1,9 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const lodash_1 = __importDefault(require("lodash"));
|
3
7
|
exports.default = [
|
4
8
|
{
|
5
9
|
wieght: 200,
|
@@ -35,6 +39,21 @@ exports.default = [
|
|
35
39
|
label: 'Hidden',
|
36
40
|
tooltip: 'Hide the Day part of the component.',
|
37
41
|
key: 'fields.day.hide',
|
42
|
+
onChange: ({ data }) => {
|
43
|
+
if (data.defaultValue) {
|
44
|
+
const defaultValueParts = data.defaultValue.split('/');
|
45
|
+
if (!data.fields.day.hide && defaultValueParts.length !== 3) {
|
46
|
+
const newDefaultValue = ['00'];
|
47
|
+
if (!data.fields.month.hide) {
|
48
|
+
data.dayFirst ? newDefaultValue.push(defaultValueParts[0]) : newDefaultValue.unshift(defaultValueParts[0]);
|
49
|
+
}
|
50
|
+
if (!data.fields.year.hide) {
|
51
|
+
newDefaultValue.push(defaultValueParts[1]);
|
52
|
+
}
|
53
|
+
lodash_1.default.set(data, 'defaultValue', newDefaultValue.join('/'));
|
54
|
+
}
|
55
|
+
}
|
56
|
+
},
|
38
57
|
input: true
|
39
58
|
},
|
40
59
|
{
|
@@ -14,6 +14,7 @@ declare const _default: ({
|
|
14
14
|
input?: undefined;
|
15
15
|
placeholder?: undefined;
|
16
16
|
tooltip?: undefined;
|
17
|
+
onChange?: undefined;
|
17
18
|
} | {
|
18
19
|
weight: number;
|
19
20
|
type: string;
|
@@ -25,12 +26,16 @@ declare const _default: ({
|
|
25
26
|
wieght?: undefined;
|
26
27
|
datasrc?: undefined;
|
27
28
|
data?: undefined;
|
29
|
+
onChange?: undefined;
|
28
30
|
} | {
|
29
31
|
weight: number;
|
30
32
|
type: string;
|
31
33
|
label: string;
|
32
34
|
tooltip: string;
|
33
35
|
key: string;
|
36
|
+
onChange: ({ data }: {
|
37
|
+
data: any;
|
38
|
+
}) => void;
|
34
39
|
input: boolean;
|
35
40
|
wieght?: undefined;
|
36
41
|
datasrc?: undefined;
|
@@ -1,5 +1,9 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const lodash_1 = __importDefault(require("lodash"));
|
3
7
|
exports.default = [
|
4
8
|
{
|
5
9
|
wieght: 200,
|
@@ -35,6 +39,21 @@ exports.default = [
|
|
35
39
|
label: 'Hidden',
|
36
40
|
tooltip: 'Hide the Month part of the component.',
|
37
41
|
key: 'fields.month.hide',
|
42
|
+
onChange: ({ data }) => {
|
43
|
+
if (data.defaultValue) {
|
44
|
+
const defaultValueParts = data.defaultValue.split('/');
|
45
|
+
if (!data.fields.month.hide && defaultValueParts.length !== 3) {
|
46
|
+
const newDefaultValue = ['00'];
|
47
|
+
if (!data.fields.day.hide) {
|
48
|
+
data.dayFirst ? newDefaultValue.unshift(defaultValueParts[0]) : newDefaultValue.push(defaultValueParts[0]);
|
49
|
+
}
|
50
|
+
if (!data.fields.year.hide) {
|
51
|
+
newDefaultValue.push(defaultValueParts[1]);
|
52
|
+
}
|
53
|
+
lodash_1.default.set(data, 'defaultValue', newDefaultValue.join('/'));
|
54
|
+
}
|
55
|
+
}
|
56
|
+
},
|
38
57
|
input: true
|
39
58
|
},
|
40
59
|
];
|
@@ -14,6 +14,7 @@ declare const _default: ({
|
|
14
14
|
input?: undefined;
|
15
15
|
placeholder?: undefined;
|
16
16
|
tooltip?: undefined;
|
17
|
+
onChange?: undefined;
|
17
18
|
} | {
|
18
19
|
weight: number;
|
19
20
|
type: string;
|
@@ -25,12 +26,16 @@ declare const _default: ({
|
|
25
26
|
wieght?: undefined;
|
26
27
|
datasrc?: undefined;
|
27
28
|
data?: undefined;
|
29
|
+
onChange?: undefined;
|
28
30
|
} | {
|
29
31
|
weight: number;
|
30
32
|
type: string;
|
31
33
|
label: string;
|
32
34
|
tooltip: string;
|
33
35
|
key: string;
|
36
|
+
onChange: ({ data }: {
|
37
|
+
data: any;
|
38
|
+
}) => void;
|
34
39
|
input: boolean;
|
35
40
|
wieght?: undefined;
|
36
41
|
datasrc?: undefined;
|
@@ -1,5 +1,9 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const lodash_1 = __importDefault(require("lodash"));
|
3
7
|
exports.default = [
|
4
8
|
{
|
5
9
|
wieght: 200,
|
@@ -53,6 +57,15 @@ exports.default = [
|
|
53
57
|
label: 'Hidden',
|
54
58
|
tooltip: 'Hide the Year part of the component.',
|
55
59
|
key: 'fields.year.hide',
|
60
|
+
onChange: ({ data }) => {
|
61
|
+
if (data.defaultValue) {
|
62
|
+
const defaultValueParts = data.defaultValue.split('/');
|
63
|
+
if (!data.fields.month.hide && defaultValueParts.length !== 3) {
|
64
|
+
defaultValueParts.push('0000');
|
65
|
+
lodash_1.default.set(data, 'defaultValue', defaultValueParts.join('/'));
|
66
|
+
}
|
67
|
+
}
|
68
|
+
},
|
56
69
|
input: true
|
57
70
|
},
|
58
71
|
];
|
@@ -212,7 +212,7 @@ class RadioComponent extends ListComponent_1.default {
|
|
212
212
|
if (!(0, utils_1.boolValue)(setting) || !value) {
|
213
213
|
return true;
|
214
214
|
}
|
215
|
-
const values = this.component.values;
|
215
|
+
const values = this.component.dataSrc === 'values' ? this.component.values : this.loadedOptions;
|
216
216
|
if (values) {
|
217
217
|
return values.findIndex(({ value: optionValue }) => this.normalizeValue(optionValue) === value) !== -1;
|
218
218
|
}
|
@@ -9,9 +9,47 @@ export default class SelectComponent extends ListComponent {
|
|
9
9
|
};
|
10
10
|
static get serverConditionSettings(): {
|
11
11
|
valueComponent(classComp: any): any;
|
12
|
+
dataTypeOperators: {
|
13
|
+
number: string[];
|
14
|
+
};
|
15
|
+
dataTypeValueComponents: {
|
16
|
+
number: {
|
17
|
+
lessThan: () => {
|
18
|
+
type: string;
|
19
|
+
};
|
20
|
+
greaterThan: () => {
|
21
|
+
type: string;
|
22
|
+
};
|
23
|
+
lessThanOrEqual: () => {
|
24
|
+
type: string;
|
25
|
+
};
|
26
|
+
greaterThanOrEqual: () => {
|
27
|
+
type: string;
|
28
|
+
};
|
29
|
+
};
|
30
|
+
};
|
12
31
|
};
|
13
32
|
static get conditionOperatorsSettings(): {
|
14
33
|
valueComponent(classComp: any): any;
|
34
|
+
dataTypeOperators: {
|
35
|
+
number: string[];
|
36
|
+
};
|
37
|
+
dataTypeValueComponents: {
|
38
|
+
number: {
|
39
|
+
lessThan: () => {
|
40
|
+
type: string;
|
41
|
+
};
|
42
|
+
greaterThan: () => {
|
43
|
+
type: string;
|
44
|
+
};
|
45
|
+
lessThanOrEqual: () => {
|
46
|
+
type: string;
|
47
|
+
};
|
48
|
+
greaterThanOrEqual: () => {
|
49
|
+
type: string;
|
50
|
+
};
|
51
|
+
};
|
52
|
+
};
|
15
53
|
};
|
16
54
|
static savedValueTypes(schema: any): any[];
|
17
55
|
templateData: {} | undefined;
|
@@ -63,6 +63,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
63
63
|
return SelectComponent.conditionOperatorsSettings;
|
64
64
|
}
|
65
65
|
static get conditionOperatorsSettings() {
|
66
|
+
const numberType = () => ({ type: 'number' });
|
66
67
|
return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { valueComponent(classComp) {
|
67
68
|
const valueComp = Object.assign(Object.assign({}, classComp), { type: 'select' });
|
68
69
|
if ((0, utils_1.isSelectResourceWithObjectValue)(classComp)) {
|
@@ -77,6 +78,15 @@ class SelectComponent extends ListComponent_1.default {
|
|
77
78
|
`;
|
78
79
|
}
|
79
80
|
return valueComp;
|
81
|
+
}, dataTypeOperators: {
|
82
|
+
number: ['lessThan', 'greaterThan', 'lessThanOrEqual', 'greaterThanOrEqual'],
|
83
|
+
}, dataTypeValueComponents: {
|
84
|
+
number: {
|
85
|
+
lessThan: numberType,
|
86
|
+
greaterThan: numberType,
|
87
|
+
lessThanOrEqual: numberType,
|
88
|
+
greaterThanOrEqual: numberType,
|
89
|
+
},
|
80
90
|
} });
|
81
91
|
}
|
82
92
|
static savedValueTypes(schema) {
|
@@ -1420,6 +1430,9 @@ class SelectComponent extends ListComponent_1.default {
|
|
1420
1430
|
case 'custom':
|
1421
1431
|
rawItems = this.getCustomItems();
|
1422
1432
|
break;
|
1433
|
+
case 'url':
|
1434
|
+
rawItems = this.selectItems;
|
1435
|
+
break;
|
1423
1436
|
}
|
1424
1437
|
if (typeof rawItems === 'string') {
|
1425
1438
|
try {
|
@@ -1478,7 +1491,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
1478
1491
|
if (Array.isArray(data)) {
|
1479
1492
|
data.forEach((item) => item[valueProperty] = item[valueProperty].toString());
|
1480
1493
|
}
|
1481
|
-
else {
|
1494
|
+
else if (lodash_1.default.isObject(data)) {
|
1482
1495
|
data[valueProperty] = data[valueProperty].toString();
|
1483
1496
|
}
|
1484
1497
|
return data;
|
@@ -1513,7 +1526,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
1513
1526
|
};
|
1514
1527
|
value = (this.component.multiple && Array.isArray(value))
|
1515
1528
|
? lodash_1.default.filter(items, (item) => value.includes(item.value))
|
1516
|
-
: valueProperty
|
1529
|
+
: (valueProperty && items)
|
1517
1530
|
? (_a = getFromValues()) !== null && _a !== void 0 ? _a : { value, label: value }
|
1518
1531
|
: value;
|
1519
1532
|
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
declare namespace _default {
|
2
|
+
let title: string;
|
3
|
+
let name: string;
|
4
|
+
let path: string;
|
5
|
+
let type: string;
|
6
|
+
let display: string;
|
7
|
+
let components: ({
|
8
|
+
label: string;
|
9
|
+
widget: string;
|
10
|
+
tableView: boolean;
|
11
|
+
data: {
|
12
|
+
values: {
|
13
|
+
label: string;
|
14
|
+
value: string;
|
15
|
+
}[];
|
16
|
+
};
|
17
|
+
dataType: string;
|
18
|
+
key: string;
|
19
|
+
type: string;
|
20
|
+
input: boolean;
|
21
|
+
applyMaskOn?: undefined;
|
22
|
+
conditional?: undefined;
|
23
|
+
} | {
|
24
|
+
label: string;
|
25
|
+
applyMaskOn: string;
|
26
|
+
tableView: boolean;
|
27
|
+
key: string;
|
28
|
+
type: string;
|
29
|
+
input: boolean;
|
30
|
+
conditional: {
|
31
|
+
show: boolean;
|
32
|
+
conjunction: string;
|
33
|
+
conditions: {
|
34
|
+
component: string;
|
35
|
+
operator: string;
|
36
|
+
value: number;
|
37
|
+
}[];
|
38
|
+
};
|
39
|
+
widget?: undefined;
|
40
|
+
data?: undefined;
|
41
|
+
dataType?: undefined;
|
42
|
+
})[];
|
43
|
+
}
|
44
|
+
export default _default;
|
@@ -0,0 +1,59 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = {
|
4
|
+
title: 'FIO-8072',
|
5
|
+
name: 'fio8072',
|
6
|
+
path: 'fio8072',
|
7
|
+
type: 'form',
|
8
|
+
display: 'form',
|
9
|
+
components: [
|
10
|
+
{
|
11
|
+
label: 'Select',
|
12
|
+
widget: 'choicesjs',
|
13
|
+
tableView: true,
|
14
|
+
data: {
|
15
|
+
values: [
|
16
|
+
{
|
17
|
+
label: 'A',
|
18
|
+
value: '1',
|
19
|
+
},
|
20
|
+
{
|
21
|
+
label: 'B',
|
22
|
+
value: '2',
|
23
|
+
},
|
24
|
+
{
|
25
|
+
label: 'C',
|
26
|
+
value: '10',
|
27
|
+
},
|
28
|
+
{
|
29
|
+
label: 'D',
|
30
|
+
value: '1d',
|
31
|
+
},
|
32
|
+
],
|
33
|
+
},
|
34
|
+
dataType: 'number',
|
35
|
+
key: 'select',
|
36
|
+
type: 'select',
|
37
|
+
input: true,
|
38
|
+
},
|
39
|
+
{
|
40
|
+
label: 'Text Field',
|
41
|
+
applyMaskOn: 'change',
|
42
|
+
tableView: true,
|
43
|
+
key: 'textField',
|
44
|
+
type: 'textfield',
|
45
|
+
input: true,
|
46
|
+
conditional: {
|
47
|
+
show: true,
|
48
|
+
conjunction: 'all',
|
49
|
+
conditions: [
|
50
|
+
{
|
51
|
+
component: 'select',
|
52
|
+
operator: 'lessThan',
|
53
|
+
value: 5,
|
54
|
+
},
|
55
|
+
],
|
56
|
+
},
|
57
|
+
},
|
58
|
+
],
|
59
|
+
};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
declare namespace _default {
|
2
|
+
let type: string;
|
3
|
+
let label: string;
|
4
|
+
let widget: string;
|
5
|
+
let tableView: boolean;
|
6
|
+
let dataSrc: string;
|
7
|
+
namespace data {
|
8
|
+
let custom: string;
|
9
|
+
}
|
10
|
+
let dataType: string;
|
11
|
+
let idPath: string;
|
12
|
+
let valueProperty: string;
|
13
|
+
let template: string;
|
14
|
+
let validateWhenHidden: boolean;
|
15
|
+
let key: string;
|
16
|
+
let input: boolean;
|
17
|
+
}
|
18
|
+
export default _default;
|