@formio/js 5.0.0-rc.20 → 5.0.0-rc.21
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/formio.embed.css +1 -39
- package/dist/formio.embed.js +2 -90
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +57 -35
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +58 -36
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +2 -2
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +1 -1
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/CDN.d.ts +1 -0
- package/lib/cjs/CDN.js +1 -0
- package/lib/cjs/Embed.d.ts +21 -1
- package/lib/cjs/Embed.js +211 -308
- package/lib/cjs/Form.d.ts +1 -1
- package/lib/cjs/Form.js +1 -1
- package/lib/cjs/Webform.d.ts +6 -6
- package/lib/cjs/Webform.js +6 -6
- package/lib/cjs/WebformBuilder.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +16 -6
- package/lib/cjs/components/_classes/component/Component.js +26 -6
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +4 -0
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +4 -0
- package/lib/cjs/components/address/Address.js +5 -0
- package/lib/cjs/components/button/Button.d.ts +1 -0
- package/lib/cjs/components/button/Button.js +3 -0
- package/lib/cjs/components/checkbox/Checkbox.d.ts +28 -0
- package/lib/cjs/components/checkbox/Checkbox.js +17 -2
- package/lib/cjs/components/columns/Columns.d.ts +1 -0
- package/lib/cjs/components/columns/Columns.js +3 -0
- package/lib/cjs/components/container/Container.js +3 -0
- package/lib/cjs/components/content/Content.d.ts +1 -0
- package/lib/cjs/components/content/Content.js +3 -0
- package/lib/cjs/components/datamap/DataMap.d.ts +1 -0
- package/lib/cjs/components/datamap/DataMap.js +3 -0
- package/lib/cjs/components/datetime/DateTime.d.ts +19 -0
- package/lib/cjs/components/datetime/DateTime.js +9 -10
- package/lib/cjs/components/day/Day.d.ts +21 -0
- package/lib/cjs/components/day/Day.js +8 -10
- package/lib/cjs/components/fieldset/Fieldset.d.ts +1 -0
- package/lib/cjs/components/fieldset/Fieldset.js +3 -0
- package/lib/cjs/components/file/File.d.ts +21 -1
- package/lib/cjs/components/file/File.js +15 -7
- package/lib/cjs/components/form/Form.d.ts +1 -0
- package/lib/cjs/components/form/Form.js +3 -0
- package/lib/cjs/components/html/HTML.d.ts +1 -0
- package/lib/cjs/components/html/HTML.js +3 -0
- package/lib/cjs/components/number/Number.d.ts +20 -1
- package/lib/cjs/components/number/Number.js +10 -15
- package/lib/cjs/components/panel/Panel.d.ts +1 -0
- package/lib/cjs/components/panel/Panel.js +3 -0
- package/lib/cjs/components/radio/Radio.d.ts +19 -0
- package/lib/cjs/components/radio/Radio.js +30 -0
- package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -0
- package/lib/cjs/components/recaptcha/ReCaptcha.js +3 -0
- package/lib/cjs/components/select/Select.d.ts +19 -1
- package/lib/cjs/components/select/Select.js +37 -3
- package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +26 -1
- package/lib/cjs/components/selectboxes/SelectBoxes.js +8 -1
- package/lib/cjs/components/signature/Signature.d.ts +21 -0
- package/lib/cjs/components/signature/Signature.js +9 -1
- package/lib/cjs/components/survey/Survey.d.ts +21 -0
- package/lib/cjs/components/survey/Survey.js +7 -1
- package/lib/cjs/components/table/Table.d.ts +1 -0
- package/lib/cjs/components/table/Table.js +3 -0
- package/lib/cjs/components/tabs/Tabs.d.ts +1 -0
- package/lib/cjs/components/tabs/Tabs.js +3 -0
- package/lib/cjs/components/tags/Tags.d.ts +21 -0
- package/lib/cjs/components/tags/Tags.js +9 -1
- package/lib/cjs/components/textfield/TextField.d.ts +21 -0
- package/lib/cjs/components/textfield/TextField.js +7 -1
- package/lib/cjs/components/time/Time.d.ts +8 -1
- package/lib/cjs/components/well/Well.d.ts +1 -0
- package/lib/cjs/components/well/Well.js +3 -0
- package/lib/cjs/formio.embed.d.ts +2 -1
- package/lib/cjs/formio.embed.js +96 -1
- package/lib/cjs/formio.form.d.ts +4 -3
- package/lib/cjs/formio.form.js +17 -8
- package/lib/cjs/licenses/Licenses.d.ts +7 -0
- package/lib/cjs/licenses/Licenses.js +22 -0
- package/lib/cjs/licenses/index.d.ts +2 -0
- package/lib/cjs/licenses/index.js +7 -0
- package/lib/cjs/utils/utils.d.ts +10 -0
- package/lib/cjs/utils/utils.js +21 -1
- package/lib/mjs/CDN.d.ts +1 -0
- package/lib/mjs/CDN.js +1 -0
- package/lib/mjs/Embed.d.ts +21 -1
- package/lib/mjs/Embed.js +208 -322
- package/lib/mjs/Form.d.ts +1 -1
- package/lib/mjs/Form.js +1 -1
- package/lib/mjs/Webform.d.ts +6 -6
- package/lib/mjs/Webform.js +6 -6
- package/lib/mjs/WebformBuilder.js +1 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +16 -6
- package/lib/mjs/components/_classes/component/Component.js +26 -6
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +4 -0
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +4 -0
- package/lib/mjs/components/address/Address.js +5 -0
- package/lib/mjs/components/button/Button.d.ts +1 -0
- package/lib/mjs/components/button/Button.js +4 -1
- package/lib/mjs/components/checkbox/Checkbox.d.ts +28 -0
- package/lib/mjs/components/checkbox/Checkbox.js +18 -3
- package/lib/mjs/components/columns/Columns.d.ts +1 -0
- package/lib/mjs/components/columns/Columns.js +3 -0
- package/lib/mjs/components/container/Container.js +4 -1
- package/lib/mjs/components/content/Content.d.ts +1 -0
- package/lib/mjs/components/content/Content.js +3 -0
- package/lib/mjs/components/datamap/DataMap.d.ts +1 -0
- package/lib/mjs/components/datamap/DataMap.js +4 -1
- package/lib/mjs/components/datetime/DateTime.d.ts +19 -0
- package/lib/mjs/components/datetime/DateTime.js +11 -12
- package/lib/mjs/components/day/Day.d.ts +21 -0
- package/lib/mjs/components/day/Day.js +12 -14
- package/lib/mjs/components/fieldset/Fieldset.d.ts +1 -0
- package/lib/mjs/components/fieldset/Fieldset.js +3 -0
- package/lib/mjs/components/file/File.d.ts +21 -1
- package/lib/mjs/components/file/File.js +16 -8
- package/lib/mjs/components/form/Form.d.ts +1 -0
- package/lib/mjs/components/form/Form.js +4 -1
- package/lib/mjs/components/html/HTML.d.ts +1 -0
- package/lib/mjs/components/html/HTML.js +3 -0
- package/lib/mjs/components/number/Number.d.ts +20 -1
- package/lib/mjs/components/number/Number.js +11 -12
- package/lib/mjs/components/panel/Panel.d.ts +1 -0
- package/lib/mjs/components/panel/Panel.js +3 -0
- package/lib/mjs/components/radio/Radio.d.ts +19 -0
- package/lib/mjs/components/radio/Radio.js +34 -1
- package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -0
- package/lib/mjs/components/recaptcha/ReCaptcha.js +3 -0
- package/lib/mjs/components/select/Select.d.ts +19 -1
- package/lib/mjs/components/select/Select.js +39 -5
- package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +26 -1
- package/lib/mjs/components/selectboxes/SelectBoxes.js +8 -1
- package/lib/mjs/components/signature/Signature.d.ts +21 -0
- package/lib/mjs/components/signature/Signature.js +9 -1
- package/lib/mjs/components/survey/Survey.d.ts +21 -0
- package/lib/mjs/components/survey/Survey.js +8 -2
- package/lib/mjs/components/table/Table.d.ts +1 -0
- package/lib/mjs/components/table/Table.js +3 -0
- package/lib/mjs/components/tabs/Tabs.d.ts +1 -0
- package/lib/mjs/components/tabs/Tabs.js +3 -0
- package/lib/mjs/components/tags/Tags.d.ts +21 -0
- package/lib/mjs/components/tags/Tags.js +10 -2
- package/lib/mjs/components/textfield/TextField.d.ts +21 -0
- package/lib/mjs/components/textfield/TextField.js +8 -2
- package/lib/mjs/components/time/Time.d.ts +8 -1
- package/lib/mjs/components/well/Well.d.ts +1 -0
- package/lib/mjs/components/well/Well.js +3 -0
- package/lib/mjs/formio.embed.d.ts +2 -1
- package/lib/mjs/formio.embed.js +96 -2
- package/lib/mjs/formio.form.d.ts +4 -3
- package/lib/mjs/formio.form.js +16 -8
- package/lib/mjs/licenses/Licenses.d.ts +7 -0
- package/lib/mjs/licenses/Licenses.js +17 -0
- package/lib/mjs/licenses/index.d.ts +2 -0
- package/lib/mjs/licenses/index.js +2 -0
- package/lib/mjs/utils/utils.d.ts +10 -0
- package/lib/mjs/utils/utils.js +19 -0
- package/package.json +5 -1
- package/types/index.d.ts +1 -0
- package/types/licenses.d.ts +7 -0
- package/types/utils.d.ts +2 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
import Field from '../_classes/field/Field';
|
2
|
-
import { uniqueName } from '../../utils/utils';
|
2
|
+
import { componentValueTypes, getComponentSavedTypes, uniqueName } from '../../utils/utils';
|
3
3
|
import download from 'downloadjs';
|
4
4
|
import _ from 'lodash';
|
5
5
|
import fileProcessor from '../../providers/processor/fileProcessor';
|
@@ -54,11 +54,18 @@ export default class FileComponent extends Field {
|
|
54
54
|
};
|
55
55
|
}
|
56
56
|
static get serverConditionSettings() {
|
57
|
+
return FileComponent.conditionOperatorsSettings;
|
58
|
+
}
|
59
|
+
static get conditionOperatorsSettings() {
|
57
60
|
return {
|
58
|
-
...super.
|
61
|
+
...super.conditionOperatorsSettings,
|
59
62
|
operators: ['isEmpty', 'isNotEmpty'],
|
60
63
|
};
|
61
64
|
}
|
65
|
+
static savedValueTypes(schema) {
|
66
|
+
schema = schema || {};
|
67
|
+
return getComponentSavedTypes(schema) || [componentValueTypes.object];
|
68
|
+
}
|
62
69
|
init() {
|
63
70
|
super.init();
|
64
71
|
webViewCamera = navigator.camera || Camera;
|
@@ -353,8 +360,10 @@ export default class FileComponent extends Field {
|
|
353
360
|
this.refs.fileStatusRemove.forEach((fileStatusRemove, index) => {
|
354
361
|
this.addEventListener(fileStatusRemove, 'click', (event) => {
|
355
362
|
event.preventDefault();
|
356
|
-
|
357
|
-
|
363
|
+
const fileUpload = this.statuses[index];
|
364
|
+
_.pull(this.filesUploading, fileUpload.originalName);
|
365
|
+
if (fileUpload.abort) {
|
366
|
+
fileUpload.abort();
|
358
367
|
}
|
359
368
|
this.statuses.splice(index, 1);
|
360
369
|
this.redraw();
|
@@ -560,6 +569,7 @@ export default class FileComponent extends Field {
|
|
560
569
|
const fileName = uniqueName(file.name, this.component.fileNameTemplate, this.evalContext());
|
561
570
|
const escapedFileName = file.name ? file.name.replaceAll('<', '<').replaceAll('>', '>') : file.name;
|
562
571
|
const fileUpload = {
|
572
|
+
abort: () => null,
|
563
573
|
originalName: escapedFileName,
|
564
574
|
name: fileName,
|
565
575
|
size: file.size,
|
@@ -678,7 +688,7 @@ export default class FileComponent extends Field {
|
|
678
688
|
}
|
679
689
|
}
|
680
690
|
}
|
681
|
-
fileUpload.message = this.t('Starting upload
|
691
|
+
fileUpload.message = this.t('Starting upload...');
|
682
692
|
this.redraw();
|
683
693
|
const filePromise = fileService.uploadFile(storage, processedFile || file, fileName, dir,
|
684
694
|
// Progress callback
|
@@ -691,9 +701,7 @@ export default class FileComponent extends Field {
|
|
691
701
|
// Upload start callback
|
692
702
|
() => {
|
693
703
|
this.emit('fileUploadingStart', filePromise);
|
694
|
-
},
|
695
|
-
// Abort upload callback
|
696
|
-
(abort) => this.abortUpload = abort).then((fileInfo) => {
|
704
|
+
}, (abort) => fileUpload.abort = abort).then((fileInfo) => {
|
697
705
|
const index = this.statuses.indexOf(fileUpload);
|
698
706
|
if (index !== -1) {
|
699
707
|
this.statuses.splice(index, 1);
|
@@ -2,7 +2,7 @@ import _ from 'lodash';
|
|
2
2
|
import Component from '../_classes/component/Component';
|
3
3
|
import ComponentModal from '../_classes/componentModal/ComponentModal';
|
4
4
|
import EventEmitter from 'eventemitter3';
|
5
|
-
import { isMongoId, eachComponent, getStringFromComponentPath, getArrayFromComponentPath } from '../../utils/utils';
|
5
|
+
import { isMongoId, eachComponent, getStringFromComponentPath, getArrayFromComponentPath, componentValueTypes } from '../../utils/utils';
|
6
6
|
import { Formio } from '../../Formio';
|
7
7
|
import Form from '../../Form';
|
8
8
|
export default class FormComponent extends Component {
|
@@ -28,6 +28,9 @@ export default class FormComponent extends Component {
|
|
28
28
|
schema: FormComponent.schema()
|
29
29
|
};
|
30
30
|
}
|
31
|
+
static savedValueTypes() {
|
32
|
+
return [componentValueTypes.object];
|
33
|
+
}
|
31
34
|
init() {
|
32
35
|
super.init();
|
33
36
|
this.formObj = {
|
@@ -8,9 +8,28 @@ export default class NumberComponent extends Input {
|
|
8
8
|
schema: any;
|
9
9
|
};
|
10
10
|
static get serverConditionSettings(): {
|
11
|
-
operators:
|
11
|
+
operators: any[];
|
12
12
|
valueComponent(classComp: any): any;
|
13
|
+
constructor: Function;
|
14
|
+
toString(): string;
|
15
|
+
toLocaleString(): string;
|
16
|
+
valueOf(): Object;
|
17
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
18
|
+
isPrototypeOf(v: Object): boolean;
|
19
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
13
20
|
};
|
21
|
+
static get conditionOperatorsSettings(): {
|
22
|
+
operators: any[];
|
23
|
+
valueComponent(classComp: any): any;
|
24
|
+
constructor: Function;
|
25
|
+
toString(): string;
|
26
|
+
toLocaleString(): string;
|
27
|
+
valueOf(): Object;
|
28
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
29
|
+
isPrototypeOf(v: Object): boolean;
|
30
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
31
|
+
};
|
32
|
+
static savedValueTypes(schema: any): string[];
|
14
33
|
constructor(...args: any[]);
|
15
34
|
validators: string[];
|
16
35
|
delimiter: any;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { createNumberMask } from '@formio/text-mask-addons';
|
2
2
|
import { conformToMask, maskInput } from '@formio/vanilla-text-mask';
|
3
3
|
import _ from 'lodash';
|
4
|
-
import { getNumberDecimalLimit, getNumberSeparators } from '../../utils/utils';
|
5
4
|
import Input from '../_classes/input/Input';
|
5
|
+
import { getNumberSeparators, getNumberDecimalLimit, componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
|
6
6
|
export default class NumberComponent extends Input {
|
7
7
|
static schema(...extend) {
|
8
8
|
return Input.schema({
|
@@ -28,22 +28,21 @@ export default class NumberComponent extends Input {
|
|
28
28
|
};
|
29
29
|
}
|
30
30
|
static get serverConditionSettings() {
|
31
|
+
return NumberComponent.conditionOperatorsSettings;
|
32
|
+
}
|
33
|
+
static get conditionOperatorsSettings() {
|
31
34
|
return {
|
32
|
-
|
33
|
-
|
34
|
-
'isNotEqual',
|
35
|
-
'isEmpty',
|
36
|
-
'isNotEmpty',
|
37
|
-
'greaterThan',
|
38
|
-
'greaterThanOrEqual',
|
39
|
-
'lessThan',
|
40
|
-
'lessThanOrEqual',
|
41
|
-
],
|
35
|
+
...super.conditionOperatorsSettings,
|
36
|
+
operators: [...super.conditionOperatorsSettings.operators, 'lessThan', 'greaterThan', 'lessThanOrEqual', 'greaterThanOrEqual'],
|
42
37
|
valueComponent(classComp) {
|
43
38
|
return { ...classComp, type: 'number' };
|
44
|
-
}
|
39
|
+
}
|
45
40
|
};
|
46
41
|
}
|
42
|
+
static savedValueTypes(schema) {
|
43
|
+
schema = schema || {};
|
44
|
+
return getComponentSavedTypes(schema) || [componentValueTypes.number];
|
45
|
+
}
|
47
46
|
constructor(...args) {
|
48
47
|
super(...args);
|
49
48
|
this.validators = this.validators.concat(['min', 'max']);
|
@@ -7,6 +7,25 @@ export default class RadioComponent extends ListComponent {
|
|
7
7
|
documentation: string;
|
8
8
|
schema: any;
|
9
9
|
};
|
10
|
+
static get conditionOperatorsSettings(): {
|
11
|
+
valueComponent(classComp: any): {
|
12
|
+
type: string;
|
13
|
+
dataSrc: string;
|
14
|
+
valueProperty: string;
|
15
|
+
dataType: any;
|
16
|
+
data: {
|
17
|
+
custom(): any;
|
18
|
+
};
|
19
|
+
};
|
20
|
+
constructor: Function;
|
21
|
+
toString(): string;
|
22
|
+
toLocaleString(): string;
|
23
|
+
valueOf(): Object;
|
24
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
25
|
+
isPrototypeOf(v: Object): boolean;
|
26
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
27
|
+
};
|
28
|
+
static savedValueTypes(schema: any): any[];
|
10
29
|
constructor(component: any, options: any, data: any);
|
11
30
|
previousValue: any;
|
12
31
|
get inputInfo(): {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import ListComponent from '../_classes/list/ListComponent';
|
3
3
|
import { Formio } from '../../Formio';
|
4
|
-
import { boolValue } from '../../utils/utils';
|
4
|
+
import { boolValue, componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
|
5
5
|
export default class RadioComponent extends ListComponent {
|
6
6
|
static schema(...extend) {
|
7
7
|
return ListComponent.schema({
|
@@ -26,6 +26,39 @@ export default class RadioComponent extends ListComponent {
|
|
26
26
|
schema: RadioComponent.schema()
|
27
27
|
};
|
28
28
|
}
|
29
|
+
static get conditionOperatorsSettings() {
|
30
|
+
return {
|
31
|
+
...super.conditionOperatorsSettings,
|
32
|
+
valueComponent(classComp) {
|
33
|
+
return {
|
34
|
+
type: 'select',
|
35
|
+
dataSrc: 'custom',
|
36
|
+
valueProperty: 'value',
|
37
|
+
dataType: classComp.dataType || '',
|
38
|
+
data: {
|
39
|
+
custom() {
|
40
|
+
return classComp.values;
|
41
|
+
}
|
42
|
+
},
|
43
|
+
};
|
44
|
+
}
|
45
|
+
};
|
46
|
+
}
|
47
|
+
static savedValueTypes(schema) {
|
48
|
+
const { boolean, string, number, object, array } = componentValueTypes;
|
49
|
+
const { dataType } = schema;
|
50
|
+
const types = getComponentSavedTypes(schema);
|
51
|
+
if (types) {
|
52
|
+
return types;
|
53
|
+
}
|
54
|
+
if (dataType === 'object') {
|
55
|
+
return [object, array];
|
56
|
+
}
|
57
|
+
if (componentValueTypes[dataType]) {
|
58
|
+
return [componentValueTypes[dataType]];
|
59
|
+
}
|
60
|
+
return [boolean, string, number, object, array];
|
61
|
+
}
|
29
62
|
constructor(component, options, data) {
|
30
63
|
super(component, options, data);
|
31
64
|
this.previousValue = this.dataValue || null;
|
@@ -9,8 +9,25 @@ export default class SelectComponent extends ListComponent {
|
|
9
9
|
};
|
10
10
|
static get serverConditionSettings(): {
|
11
11
|
valueComponent(classComp: any): any;
|
12
|
-
|
12
|
+
constructor: Function;
|
13
|
+
toString(): string;
|
14
|
+
toLocaleString(): string;
|
15
|
+
valueOf(): Object;
|
16
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
17
|
+
isPrototypeOf(v: Object): boolean;
|
18
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
13
19
|
};
|
20
|
+
static get conditionOperatorsSettings(): {
|
21
|
+
valueComponent(classComp: any): any;
|
22
|
+
constructor: Function;
|
23
|
+
toString(): string;
|
24
|
+
toLocaleString(): string;
|
25
|
+
valueOf(): Object;
|
26
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
27
|
+
isPrototypeOf(v: Object): boolean;
|
28
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
29
|
+
};
|
30
|
+
static savedValueTypes(schema: any): any[];
|
14
31
|
templateData: {} | undefined;
|
15
32
|
triggerUpdate: ((...args: any[]) => any) | undefined;
|
16
33
|
set itemsLoaded(arg: any);
|
@@ -40,6 +57,7 @@ export default class SelectComponent extends ListComponent {
|
|
40
57
|
get isSelectResource(): boolean;
|
41
58
|
get itemsFromUrl(): boolean;
|
42
59
|
get isInfiniteScrollProvided(): boolean;
|
60
|
+
get shouldInitialLoad(): any;
|
43
61
|
isEntireObjectDisplay(): boolean;
|
44
62
|
selectValueAndLabel(data: any): {
|
45
63
|
value: any;
|
@@ -2,7 +2,7 @@ import _ from 'lodash';
|
|
2
2
|
import { Formio } from '../../Formio';
|
3
3
|
import ListComponent from '../_classes/list/ListComponent';
|
4
4
|
import Form from '../../Form';
|
5
|
-
import { getRandomComponentId, boolValue, isPromise } from '../../utils/utils';
|
5
|
+
import { getRandomComponentId, boolValue, isPromise, componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
|
6
6
|
import Choices from '../../utils/ChoicesWrapper';
|
7
7
|
export default class SelectComponent extends ListComponent {
|
8
8
|
static schema(...extend) {
|
@@ -54,13 +54,34 @@ export default class SelectComponent extends ListComponent {
|
|
54
54
|
};
|
55
55
|
}
|
56
56
|
static get serverConditionSettings() {
|
57
|
+
return SelectComponent.conditionOperatorsSettings;
|
58
|
+
}
|
59
|
+
static get conditionOperatorsSettings() {
|
57
60
|
return {
|
58
|
-
...super.
|
61
|
+
...super.conditionOperatorsSettings,
|
59
62
|
valueComponent(classComp) {
|
60
63
|
return { ...classComp, type: 'select' };
|
61
|
-
}
|
64
|
+
}
|
62
65
|
};
|
63
66
|
}
|
67
|
+
static savedValueTypes(schema) {
|
68
|
+
const { boolean, string, number, object, array } = componentValueTypes;
|
69
|
+
const { dataType, reference } = schema;
|
70
|
+
const types = getComponentSavedTypes(schema);
|
71
|
+
if (types) {
|
72
|
+
return types;
|
73
|
+
}
|
74
|
+
if (reference) {
|
75
|
+
return [object];
|
76
|
+
}
|
77
|
+
if (dataType === 'object') {
|
78
|
+
return [object, array];
|
79
|
+
}
|
80
|
+
if (componentValueTypes[dataType]) {
|
81
|
+
return [componentValueTypes[dataType]];
|
82
|
+
}
|
83
|
+
return [boolean, string, number, object, array];
|
84
|
+
}
|
64
85
|
init() {
|
65
86
|
super.init();
|
66
87
|
this.templateData = {};
|
@@ -172,6 +193,15 @@ export default class SelectComponent extends ListComponent {
|
|
172
193
|
get shouldDisabled() {
|
173
194
|
return super.shouldDisabled || this.parentDisabled;
|
174
195
|
}
|
196
|
+
get shouldInitialLoad() {
|
197
|
+
if (this.component.widget === 'html5' &&
|
198
|
+
this.isEntireObjectDisplay() &&
|
199
|
+
this.component.searchField &&
|
200
|
+
this.dataValue) {
|
201
|
+
return false;
|
202
|
+
}
|
203
|
+
return super.shouldLoad;
|
204
|
+
}
|
175
205
|
isEntireObjectDisplay() {
|
176
206
|
return this.component.dataSrc === 'resource' && this.valueProperty === 'data';
|
177
207
|
}
|
@@ -482,7 +512,11 @@ export default class SelectComponent extends ListComponent {
|
|
482
512
|
});
|
483
513
|
// Add search capability.
|
484
514
|
if (this.component.searchField && search) {
|
485
|
-
const searchValue = Array.isArray(search)
|
515
|
+
const searchValue = Array.isArray(search)
|
516
|
+
? search.join(',')
|
517
|
+
: typeof search === 'object'
|
518
|
+
? JSON.stringify(search)
|
519
|
+
: search;
|
486
520
|
query[this.component.searchField] = this.component.searchField.endsWith('__regex')
|
487
521
|
? _.escapeRegExp(searchValue)
|
488
522
|
: searchValue;
|
@@ -1195,7 +1229,7 @@ export default class SelectComponent extends ListComponent {
|
|
1195
1229
|
!this.active &&
|
1196
1230
|
!this.selectOptions.length &&
|
1197
1231
|
hasValue &&
|
1198
|
-
this.
|
1232
|
+
this.shouldInitialLoad &&
|
1199
1233
|
this.visible && (this.component.searchField || this.component.valueProperty);
|
1200
1234
|
}
|
1201
1235
|
setChoicesValue(value, hasPreviousValue, flags = {}) {
|
@@ -9,8 +9,33 @@ export default class SelectBoxesComponent extends RadioComponent {
|
|
9
9
|
custom: string;
|
10
10
|
};
|
11
11
|
};
|
12
|
-
|
12
|
+
constructor: Function;
|
13
|
+
toString(): string;
|
14
|
+
toLocaleString(): string;
|
15
|
+
valueOf(): Object;
|
16
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
17
|
+
isPrototypeOf(v: Object): boolean;
|
18
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
13
19
|
};
|
20
|
+
static get conditionOperatorsSettings(): {
|
21
|
+
valueComponent(classComp: any): {
|
22
|
+
type: string;
|
23
|
+
dataSrc: string;
|
24
|
+
valueProperty: string;
|
25
|
+
valueType: string;
|
26
|
+
data: {
|
27
|
+
custom: string;
|
28
|
+
};
|
29
|
+
};
|
30
|
+
constructor: Function;
|
31
|
+
toString(): string;
|
32
|
+
toLocaleString(): string;
|
33
|
+
valueOf(): Object;
|
34
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
35
|
+
isPrototypeOf(v: Object): boolean;
|
36
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
37
|
+
};
|
38
|
+
static savedValueTypes(schema: any): string[];
|
14
39
|
constructor(...args: any[]);
|
15
40
|
validators: string[];
|
16
41
|
get emptyValue(): any;
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import _ from 'lodash';
|
2
|
+
import { componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
|
2
3
|
import RadioComponent from '../radio/Radio';
|
3
4
|
export default class SelectBoxesComponent extends RadioComponent {
|
4
5
|
static schema(...extend) {
|
@@ -20,8 +21,11 @@ export default class SelectBoxesComponent extends RadioComponent {
|
|
20
21
|
};
|
21
22
|
}
|
22
23
|
static get serverConditionSettings() {
|
24
|
+
return SelectBoxesComponent.conditionOperatorsSettings;
|
25
|
+
}
|
26
|
+
static get conditionOperatorsSettings() {
|
23
27
|
return {
|
24
|
-
...super.
|
28
|
+
...super.conditionOperatorsSettings,
|
25
29
|
valueComponent(classComp) {
|
26
30
|
return {
|
27
31
|
type: 'select',
|
@@ -35,6 +39,9 @@ export default class SelectBoxesComponent extends RadioComponent {
|
|
35
39
|
}
|
36
40
|
};
|
37
41
|
}
|
42
|
+
static savedValueTypes(schema) {
|
43
|
+
return getComponentSavedTypes(schema) || [componentValueTypes.object];
|
44
|
+
}
|
38
45
|
constructor(...args) {
|
39
46
|
super(...args);
|
40
47
|
this.validators = this.validators.concat('minSelectedCount', 'maxSelectedCount', 'availableValueProperty');
|
@@ -7,6 +7,27 @@ export default class SignatureComponent extends Input {
|
|
7
7
|
documentation: string;
|
8
8
|
schema: any;
|
9
9
|
};
|
10
|
+
static get serverConditionSettings(): {
|
11
|
+
operators: string[];
|
12
|
+
constructor: Function;
|
13
|
+
toString(): string;
|
14
|
+
toLocaleString(): string;
|
15
|
+
valueOf(): Object;
|
16
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
17
|
+
isPrototypeOf(v: Object): boolean;
|
18
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
19
|
+
};
|
20
|
+
static get conditionOperatorsSettings(): {
|
21
|
+
operators: string[];
|
22
|
+
constructor: Function;
|
23
|
+
toString(): string;
|
24
|
+
toLocaleString(): string;
|
25
|
+
valueOf(): Object;
|
26
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
27
|
+
isPrototypeOf(v: Object): boolean;
|
28
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
29
|
+
};
|
30
|
+
static savedValueTypes(schema: any): string[];
|
10
31
|
currentWidth: any;
|
11
32
|
scale: any;
|
12
33
|
ratio: number | undefined;
|
@@ -2,6 +2,7 @@ import SignaturePad from 'signature_pad';
|
|
2
2
|
import _ResizeObserver from 'resize-observer-polyfill';
|
3
3
|
import Input from '../_classes/input/Input';
|
4
4
|
import _ from 'lodash';
|
5
|
+
import { componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
|
5
6
|
export default class SignatureComponent extends Input {
|
6
7
|
static schema(...extend) {
|
7
8
|
return Input.schema({
|
@@ -29,11 +30,18 @@ export default class SignatureComponent extends Input {
|
|
29
30
|
};
|
30
31
|
}
|
31
32
|
static get serverConditionSettings() {
|
33
|
+
return SignatureComponent.conditionOperatorsSettings;
|
34
|
+
}
|
35
|
+
static get conditionOperatorsSettings() {
|
32
36
|
return {
|
33
|
-
...super.
|
37
|
+
...super.conditionOperatorsSettings,
|
34
38
|
operators: ['isEmpty', 'isNotEmpty'],
|
35
39
|
};
|
36
40
|
}
|
41
|
+
static savedValueTypes(schema) {
|
42
|
+
schema = schema || {};
|
43
|
+
return getComponentSavedTypes(schema) || [componentValueTypes.string];
|
44
|
+
}
|
37
45
|
init() {
|
38
46
|
super.init();
|
39
47
|
this.currentWidth = 0;
|
@@ -7,6 +7,27 @@ export default class SurveyComponent extends Field {
|
|
7
7
|
documentation: string;
|
8
8
|
schema: any;
|
9
9
|
};
|
10
|
+
static get serverConditionSettings(): {
|
11
|
+
operators: string[];
|
12
|
+
constructor: Function;
|
13
|
+
toString(): string;
|
14
|
+
toLocaleString(): string;
|
15
|
+
valueOf(): Object;
|
16
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
17
|
+
isPrototypeOf(v: Object): boolean;
|
18
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
19
|
+
};
|
20
|
+
static get conditionOperatorsSettings(): {
|
21
|
+
operators: string[];
|
22
|
+
constructor: Function;
|
23
|
+
toString(): string;
|
24
|
+
toLocaleString(): string;
|
25
|
+
valueOf(): Object;
|
26
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
27
|
+
isPrototypeOf(v: Object): boolean;
|
28
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
29
|
+
};
|
30
|
+
static savedValueTypes(schema: any): string[];
|
10
31
|
render(): any;
|
11
32
|
setValue(value: any, flags?: {}): boolean;
|
12
33
|
get emptyValue(): {};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import Field from '../_classes/field/Field';
|
3
|
-
import { boolValue } from '../../utils/utils';
|
3
|
+
import { boolValue, componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
|
4
4
|
export default class SurveyComponent extends Field {
|
5
5
|
static schema(...extend) {
|
6
6
|
return Field.schema({
|
@@ -22,11 +22,17 @@ export default class SurveyComponent extends Field {
|
|
22
22
|
};
|
23
23
|
}
|
24
24
|
static get serverConditionSettings() {
|
25
|
+
return SurveyComponent.conditionOperatorsSettings;
|
26
|
+
}
|
27
|
+
static get conditionOperatorsSettings() {
|
25
28
|
return {
|
26
|
-
...super.
|
29
|
+
...super.conditionOperatorsSettings,
|
27
30
|
operators: ['isEmpty', 'isNotEmpty'],
|
28
31
|
};
|
29
32
|
}
|
33
|
+
static savedValueTypes(schema) {
|
34
|
+
return getComponentSavedTypes(schema) || [componentValueTypes.object];
|
35
|
+
}
|
30
36
|
get defaultSchema() {
|
31
37
|
return SurveyComponent.schema();
|
32
38
|
}
|
@@ -7,6 +7,27 @@ export default class TagsComponent extends Input {
|
|
7
7
|
weight: number;
|
8
8
|
schema: any;
|
9
9
|
};
|
10
|
+
static get serverConditionSettings(): {
|
11
|
+
operators: any[];
|
12
|
+
constructor: Function;
|
13
|
+
toString(): string;
|
14
|
+
toLocaleString(): string;
|
15
|
+
valueOf(): Object;
|
16
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
17
|
+
isPrototypeOf(v: Object): boolean;
|
18
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
19
|
+
};
|
20
|
+
static get conditionOperatorsSettings(): {
|
21
|
+
operators: any[];
|
22
|
+
constructor: Function;
|
23
|
+
toString(): string;
|
24
|
+
toLocaleString(): string;
|
25
|
+
valueOf(): Object;
|
26
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
27
|
+
isPrototypeOf(v: Object): boolean;
|
28
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
29
|
+
};
|
30
|
+
static savedValueTypes(schema: any): any[];
|
10
31
|
get emptyValue(): "" | never[];
|
11
32
|
get delimiter(): any;
|
12
33
|
attachElement(element: any, index: any): void;
|