@formio/js 5.0.0-rc.20 → 5.0.0-rc.22
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/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 +58 -36
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +59 -37
- 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/Element.js +5 -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 +12 -10
- package/lib/cjs/components/day/fixtures/comp5.d.ts +29 -0
- package/lib/cjs/components/day/fixtures/comp5.js +32 -0
- package/lib/cjs/components/day/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/day/fixtures/index.js +3 -1
- 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 +5 -1
- 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 +39 -4
- package/lib/cjs/components/select/fixtures/comp19.d.ts +23 -0
- package/lib/cjs/components/select/fixtures/comp19.js +36 -0
- package/lib/cjs/components/select/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/select/fixtures/index.js +3 -1
- 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 +11 -1
- package/lib/cjs/components/tags/fixtures/comp6.d.ts +17 -0
- package/lib/cjs/components/tags/fixtures/comp6.js +20 -0
- package/lib/cjs/components/tags/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/tags/fixtures/index.js +3 -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/Element.js +5 -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 +16 -14
- package/lib/mjs/components/day/fixtures/comp5.d.ts +29 -0
- package/lib/mjs/components/day/fixtures/comp5.js +30 -0
- package/lib/mjs/components/day/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/day/fixtures/index.js +2 -1
- 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 +6 -2
- 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 +41 -6
- package/lib/mjs/components/select/fixtures/comp19.d.ts +23 -0
- package/lib/mjs/components/select/fixtures/comp19.js +34 -0
- package/lib/mjs/components/select/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/select/fixtures/index.js +2 -1
- 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 +12 -2
- package/lib/mjs/components/tags/fixtures/comp6.d.ts +17 -0
- package/lib/mjs/components/tags/fixtures/comp6.js +18 -0
- package/lib/mjs/components/tags/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/tags/fixtures/index.js +2 -1
- 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
@@ -7,6 +7,7 @@ const signature_pad_1 = __importDefault(require("signature_pad"));
|
|
7
7
|
const resize_observer_polyfill_1 = __importDefault(require("resize-observer-polyfill"));
|
8
8
|
const Input_1 = __importDefault(require("../_classes/input/Input"));
|
9
9
|
const lodash_1 = __importDefault(require("lodash"));
|
10
|
+
const utils_1 = require("../../utils/utils");
|
10
11
|
class SignatureComponent extends Input_1.default {
|
11
12
|
static schema(...extend) {
|
12
13
|
return Input_1.default.schema({
|
@@ -34,7 +35,14 @@ class SignatureComponent extends Input_1.default {
|
|
34
35
|
};
|
35
36
|
}
|
36
37
|
static get serverConditionSettings() {
|
37
|
-
return
|
38
|
+
return SignatureComponent.conditionOperatorsSettings;
|
39
|
+
}
|
40
|
+
static get conditionOperatorsSettings() {
|
41
|
+
return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { operators: ['isEmpty', 'isNotEmpty'] });
|
42
|
+
}
|
43
|
+
static savedValueTypes(schema) {
|
44
|
+
schema = schema || {};
|
45
|
+
return (0, utils_1.getComponentSavedTypes)(schema) || [utils_1.componentValueTypes.string];
|
38
46
|
}
|
39
47
|
init() {
|
40
48
|
var _a, _b, _c, _d, _e;
|
@@ -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(): {};
|
@@ -27,7 +27,13 @@ class SurveyComponent extends Field_1.default {
|
|
27
27
|
};
|
28
28
|
}
|
29
29
|
static get serverConditionSettings() {
|
30
|
-
return
|
30
|
+
return SurveyComponent.conditionOperatorsSettings;
|
31
|
+
}
|
32
|
+
static get conditionOperatorsSettings() {
|
33
|
+
return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { operators: ['isEmpty', 'isNotEmpty'] });
|
34
|
+
}
|
35
|
+
static savedValueTypes(schema) {
|
36
|
+
return (0, utils_1.getComponentSavedTypes)(schema) || [utils_1.componentValueTypes.object];
|
31
37
|
}
|
32
38
|
get defaultSchema() {
|
33
39
|
return SurveyComponent.schema();
|
@@ -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;
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const utils_1 = require("../../utils/utils");
|
6
7
|
const Input_1 = __importDefault(require("../_classes/input/Input"));
|
7
8
|
const choices_js_1 = __importDefault(require("@formio/choices.js"));
|
8
9
|
class TagsComponent extends Input_1.default {
|
@@ -27,7 +28,14 @@ class TagsComponent extends Input_1.default {
|
|
27
28
|
};
|
28
29
|
}
|
29
30
|
static get serverConditionSettings() {
|
30
|
-
return
|
31
|
+
return TagsComponent.conditionOperatorsSettings;
|
32
|
+
}
|
33
|
+
static get conditionOperatorsSettings() {
|
34
|
+
return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { operators: [...super.conditionOperatorsSettings.operators, 'includes', 'notIncludes'] });
|
35
|
+
}
|
36
|
+
static savedValueTypes(schema) {
|
37
|
+
schema = schema || {};
|
38
|
+
return (0, utils_1.getComponentSavedTypes)(schema) || [utils_1.componentValueTypes[schema.storeas] || utils_1.componentValueTypes.string];
|
31
39
|
}
|
32
40
|
init() {
|
33
41
|
super.init();
|
@@ -76,6 +84,8 @@ class TagsComponent extends Input_1.default {
|
|
76
84
|
});
|
77
85
|
this.choices.itemList.element.tabIndex = element.tabIndex;
|
78
86
|
this.addEventListener(this.choices.input.element, 'blur', () => {
|
87
|
+
// Emit event to the native Formio input, so the listener attached in the Input.js will be invoked
|
88
|
+
element.dispatchEvent(new Event('blur'));
|
79
89
|
const value = this.choices.input.value;
|
80
90
|
const maxTagsNumber = this.component.maxTags;
|
81
91
|
const valuesCount = this.choices.getValue(true).length;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
declare namespace _default {
|
2
|
+
const type: string;
|
3
|
+
const display: string;
|
4
|
+
const components: {
|
5
|
+
label: string;
|
6
|
+
tableView: boolean;
|
7
|
+
storeas: string;
|
8
|
+
validate: {
|
9
|
+
custom: string;
|
10
|
+
};
|
11
|
+
validateOn: string;
|
12
|
+
key: string;
|
13
|
+
type: string;
|
14
|
+
input: boolean;
|
15
|
+
}[];
|
16
|
+
}
|
17
|
+
export default _default;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = {
|
4
|
+
type: 'form',
|
5
|
+
display: 'form',
|
6
|
+
components: [
|
7
|
+
{
|
8
|
+
label: 'Tags',
|
9
|
+
tableView: false,
|
10
|
+
storeas: 'array',
|
11
|
+
validate: {
|
12
|
+
custom: "valid = data && data.tags.length <= 2 ? true : 'You cannot add more than 2 items'"
|
13
|
+
},
|
14
|
+
validateOn: 'blur',
|
15
|
+
key: 'tags',
|
16
|
+
type: 'tags',
|
17
|
+
input: true
|
18
|
+
},
|
19
|
+
]
|
20
|
+
};
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
6
|
+
exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
7
7
|
const comp1_1 = __importDefault(require("./comp1"));
|
8
8
|
exports.comp1 = comp1_1.default;
|
9
9
|
const comp2_1 = __importDefault(require("./comp2"));
|
@@ -14,3 +14,5 @@ const comp4_1 = __importDefault(require("./comp4"));
|
|
14
14
|
exports.comp4 = comp4_1.default;
|
15
15
|
const comp5_1 = __importDefault(require("./comp5"));
|
16
16
|
exports.comp5 = comp5_1.default;
|
17
|
+
const comp6_1 = __importDefault(require("./comp6"));
|
18
|
+
exports.comp6 = comp6_1.default;
|
@@ -7,6 +7,27 @@ export default class TextFieldComponent 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): string[];
|
10
31
|
get emptyValue(): string;
|
11
32
|
/**
|
12
33
|
* Returns the mask value object.
|
@@ -61,7 +61,13 @@ class TextFieldComponent extends Input_1.default {
|
|
61
61
|
};
|
62
62
|
}
|
63
63
|
static get serverConditionSettings() {
|
64
|
-
return
|
64
|
+
return TextFieldComponent.conditionOperatorsSettings;
|
65
|
+
}
|
66
|
+
static get conditionOperatorsSettings() {
|
67
|
+
return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { operators: [...super.conditionOperatorsSettings.operators, 'includes', 'notIncludes', 'endsWith', 'startsWith'] });
|
68
|
+
}
|
69
|
+
static savedValueTypes(schema) {
|
70
|
+
return FormioUtils.getComponentSavedTypes(schema) || [FormioUtils.componentValueTypes.string];
|
65
71
|
}
|
66
72
|
get defaultSchema() {
|
67
73
|
return TextFieldComponent.schema();
|
@@ -1,7 +1,14 @@
|
|
1
1
|
export default class TimeComponent extends TextFieldComponent {
|
2
2
|
static get serverConditionSettings(): {
|
3
3
|
valueComponent(classComp: any): any;
|
4
|
-
operators:
|
4
|
+
operators: any[];
|
5
|
+
constructor: Function;
|
6
|
+
toString(): string;
|
7
|
+
toLocaleString(): string;
|
8
|
+
valueOf(): Object;
|
9
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
10
|
+
isPrototypeOf(v: Object): boolean;
|
11
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
5
12
|
};
|
6
13
|
rawData: string | never[];
|
7
14
|
get dataFormat(): any;
|
@@ -1 +1,2 @@
|
|
1
|
-
export {};
|
1
|
+
export { Formio };
|
2
|
+
import { Formio } from './Embed';
|
package/lib/cjs/formio.embed.js
CHANGED
@@ -1,4 +1,99 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Formio = void 0;
|
3
4
|
const Embed_1 = require("./Embed");
|
4
|
-
(
|
5
|
+
Object.defineProperty(exports, "Formio", { enumerable: true, get: function () { return Embed_1.Formio; } });
|
6
|
+
const scripts = document.getElementsByTagName('script');
|
7
|
+
const config = window.FormioConfig || {};
|
8
|
+
let thisScript = null;
|
9
|
+
let i = scripts.length;
|
10
|
+
const scriptName = config.scriptName || 'formio.embed.';
|
11
|
+
while (i--) {
|
12
|
+
if (scripts[i].src && (scripts[i].src.indexOf(scriptName) !== -1)) {
|
13
|
+
thisScript = scripts[i];
|
14
|
+
break;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
if (thisScript) {
|
18
|
+
const query = {};
|
19
|
+
const queryString = thisScript.src.replace(/^[^?]+\??/, '');
|
20
|
+
queryString.replace(/\?/g, '&').split('&').forEach((item) => {
|
21
|
+
query[item.split('=')[0]] = item.split('=')[1] && decodeURIComponent(item.split('=')[1]);
|
22
|
+
});
|
23
|
+
let scriptSrc = thisScript.src.replace(/^([^?]+).*/, '$1').split('/');
|
24
|
+
scriptSrc.pop();
|
25
|
+
if (config.formioPath) {
|
26
|
+
config.formioPath(scriptSrc);
|
27
|
+
}
|
28
|
+
scriptSrc = scriptSrc.join('/');
|
29
|
+
Embed_1.Formio.config = Object.assign({
|
30
|
+
script: query.script || (`${config.updatePath ? config.updatePath() : scriptSrc}/formio.form.min.js`),
|
31
|
+
style: query.styles || (`${config.updatePath ? config.updatePath() : scriptSrc}/formio.form.min.css`),
|
32
|
+
cdn: query.cdn,
|
33
|
+
class: (query.class || 'formio-form-wrapper'),
|
34
|
+
src: query.src,
|
35
|
+
form: null,
|
36
|
+
submission: null,
|
37
|
+
project: query.project,
|
38
|
+
base: query.base || 'https://api.form.io',
|
39
|
+
submit: query.submit,
|
40
|
+
includeLibs: (query.libs === 'true' || query.libs === '1'),
|
41
|
+
template: query.template,
|
42
|
+
debug: (query.debug === 'true' || query.debug === '1'),
|
43
|
+
config: {},
|
44
|
+
redirect: (query.return || query.redirect),
|
45
|
+
embedCSS: (`${config.updatePath ? config.updatePath() : scriptSrc}/formio.embed.css`),
|
46
|
+
before: null,
|
47
|
+
after: null
|
48
|
+
}, config);
|
49
|
+
const form = (Embed_1.Formio.config.form || Embed_1.Formio.config.src);
|
50
|
+
if (form) {
|
51
|
+
Embed_1.Formio.debug('Embedding Configuration', config);
|
52
|
+
if (Embed_1.Formio.config.addPremiumLib) {
|
53
|
+
Embed_1.Formio.config.addPremiumLib(Embed_1.Formio.config, scriptSrc);
|
54
|
+
}
|
55
|
+
// The id for this embedded form.
|
56
|
+
Embed_1.Formio.config.id = `formio-${Math.random().toString(36).substring(7)}`;
|
57
|
+
Embed_1.Formio.debug('Creating form element');
|
58
|
+
const element = Embed_1.Formio.createElement('div', {
|
59
|
+
'id': Embed_1.Formio.config.id,
|
60
|
+
class: Embed_1.Formio.config.class
|
61
|
+
});
|
62
|
+
// insertAfter doesn't exist, but effect is identical.
|
63
|
+
thisScript.parentNode.insertBefore(element, thisScript.parentNode.firstElementChild.nextSibling);
|
64
|
+
Embed_1.Formio.createForm(element, form, Embed_1.Formio.config.config).then((instance) => {
|
65
|
+
if (Embed_1.Formio.config.submit) {
|
66
|
+
instance.nosubmit = true;
|
67
|
+
}
|
68
|
+
// Configure a redirect.
|
69
|
+
instance.on('submit', (submission) => {
|
70
|
+
Embed_1.Formio.debug("on('submit')", submission);
|
71
|
+
if (Embed_1.Formio.config.submit) {
|
72
|
+
Embed_1.Formio.debug(`Sending submission to ${Embed_1.Formio.config.submit}`);
|
73
|
+
const headers = {
|
74
|
+
'content-type': 'application/json'
|
75
|
+
};
|
76
|
+
const token = Embed_1.Formio.FormioClass.getToken();
|
77
|
+
if (token) {
|
78
|
+
headers['x-jwt-token'] = token;
|
79
|
+
}
|
80
|
+
Embed_1.Formio.FormioClass.fetch(Embed_1.Formio.config.submit, {
|
81
|
+
body: JSON.stringify(submission),
|
82
|
+
headers: headers,
|
83
|
+
method: 'POST',
|
84
|
+
mode: 'cors',
|
85
|
+
})
|
86
|
+
.then(resp => resp.json())
|
87
|
+
.then(submission => Embed_1.Formio.submitDone(instance, submission));
|
88
|
+
}
|
89
|
+
else {
|
90
|
+
Embed_1.Formio.submitDone(instance, submission);
|
91
|
+
}
|
92
|
+
});
|
93
|
+
});
|
94
|
+
}
|
95
|
+
}
|
96
|
+
else {
|
97
|
+
// Show an error if the script cannot be found.
|
98
|
+
document.write('<span>Could not locate the Embedded form.</span>');
|
99
|
+
}
|
package/lib/cjs/formio.form.d.ts
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
* @param {*} plugin
|
4
4
|
* @returns
|
5
5
|
*/
|
6
|
-
export function registerModule(mod: any, defaultFn?: null): void;
|
7
|
-
export function useModule(defaultFn?: null): (
|
6
|
+
export function registerModule(mod: any, defaultFn?: null, options?: {}): void;
|
7
|
+
export function useModule(defaultFn?: null): (plugins: any, options?: {}) => void;
|
8
8
|
import Components from './components/Components';
|
9
9
|
import Displays from './displays/Displays';
|
10
10
|
import Providers from './providers';
|
@@ -19,4 +19,5 @@ import ValueSources from './validator/valueSources';
|
|
19
19
|
import Utils from './utils';
|
20
20
|
import Form from './Form';
|
21
21
|
import { Formio } from './Formio';
|
22
|
-
|
22
|
+
import Licenses from './licenses';
|
23
|
+
export { Components, Displays, Providers, Rules, Widgets, Templates, Conjunctions, Operators, QuickRules, Transformers, ValueSources, Utils, Form, Formio, Licenses };
|
package/lib/cjs/formio.form.js
CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.Formio = exports.Form = exports.Utils = exports.ValueSources = exports.Transformers = exports.QuickRules = exports.Operators = exports.Conjunctions = exports.Templates = exports.Widgets = exports.Rules = exports.Providers = exports.Displays = exports.Components = exports.useModule = exports.registerModule = void 0;
|
6
|
+
exports.Licenses = exports.Formio = exports.Form = exports.Utils = exports.ValueSources = exports.Transformers = exports.QuickRules = exports.Operators = exports.Conjunctions = exports.Templates = exports.Widgets = exports.Rules = exports.Providers = exports.Displays = exports.Components = exports.useModule = exports.registerModule = void 0;
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
8
8
|
const Formio_1 = require("./Formio");
|
9
9
|
Object.defineProperty(exports, "Formio", { enumerable: true, get: function () { return Formio_1.Formio; } });
|
@@ -35,6 +35,8 @@ exports.Form = Form_1.default;
|
|
35
35
|
const utils_1 = __importDefault(require("./utils"));
|
36
36
|
exports.Utils = utils_1.default;
|
37
37
|
const Evaluator_1 = __importDefault(require("./utils/Evaluator"));
|
38
|
+
const licenses_1 = __importDefault(require("./licenses"));
|
39
|
+
exports.Licenses = licenses_1.default;
|
38
40
|
Formio_1.Formio.loadModules = (path = `${Formio_1.Formio.getApiUrl()}/externalModules.js`, name = 'externalModules') => {
|
39
41
|
Formio_1.Formio.requireLibrary(name, name, path, true)
|
40
42
|
.then((modules) => {
|
@@ -57,6 +59,7 @@ Formio_1.Formio.QuickRules = quickRules_1.default;
|
|
57
59
|
Formio_1.Formio.Transformers = transformers_1.default;
|
58
60
|
Formio_1.Formio.ValueSources = valueSources_1.default;
|
59
61
|
Formio_1.Formio.AllComponents = components_1.default;
|
62
|
+
Formio_1.Formio.Licenses = licenses_1.default;
|
60
63
|
// This is strange, but is needed for "premium" components to import correctly.
|
61
64
|
Formio_1.Formio.Formio = Formio_1.Formio;
|
62
65
|
Formio_1.Formio.Components.setComponents(components_1.default);
|
@@ -65,7 +68,7 @@ Formio_1.Formio.Components.setComponents(components_1.default);
|
|
65
68
|
* @param {*} plugin
|
66
69
|
* @returns
|
67
70
|
*/
|
68
|
-
function registerModule(mod, defaultFn = null) {
|
71
|
+
function registerModule(mod, defaultFn = null, options = {}) {
|
69
72
|
// Sanity check.
|
70
73
|
if (typeof mod !== 'object') {
|
71
74
|
return;
|
@@ -124,6 +127,11 @@ function registerModule(mod, defaultFn = null) {
|
|
124
127
|
case 'valueSources':
|
125
128
|
Formio_1.Formio.ValueSources.addValueSources(mod.valueSources);
|
126
129
|
break;
|
130
|
+
case 'library':
|
131
|
+
options.license
|
132
|
+
? Formio_1.Formio.Licenses.addLicense(mod.library, mod.license)
|
133
|
+
: Formio_1.Formio.Licenses.removeLicense(mod.library);
|
134
|
+
break;
|
127
135
|
default:
|
128
136
|
if (defaultFn) {
|
129
137
|
if (!defaultFn(key, mod)) {
|
@@ -137,22 +145,23 @@ function registerModule(mod, defaultFn = null) {
|
|
137
145
|
}
|
138
146
|
exports.registerModule = registerModule;
|
139
147
|
function useModule(defaultFn = null) {
|
140
|
-
return (
|
148
|
+
return (plugins, options = {}) => {
|
149
|
+
plugins = lodash_1.default.isArray(plugins) ? plugins : [plugins];
|
141
150
|
plugins.forEach((plugin) => {
|
142
151
|
if (Array.isArray(plugin)) {
|
143
|
-
plugin.forEach(p => registerModule(p, defaultFn));
|
152
|
+
plugin.forEach(p => registerModule(p, defaultFn, options));
|
144
153
|
}
|
145
154
|
else {
|
146
|
-
registerModule(plugin, defaultFn);
|
155
|
+
registerModule(plugin, defaultFn, options);
|
147
156
|
}
|
148
157
|
});
|
149
158
|
};
|
150
159
|
}
|
151
160
|
exports.useModule = useModule;
|
152
161
|
/**
|
153
|
-
* Allows passing in plugins as
|
162
|
+
* Allows passing in plugins as an array of plugins or a single plugin.
|
154
163
|
*
|
155
|
-
* Formio.plugins(plugin1,
|
156
|
-
* Formio.plugins([plugin1, plugin2, etc]);
|
164
|
+
* Formio.plugins(plugin1, options);
|
165
|
+
* Formio.plugins([plugin1, plugin2, etc], options);
|
157
166
|
*/
|
158
167
|
Formio_1.Formio.use = useModule();
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const lodash_1 = __importDefault(require("lodash"));
|
7
|
+
class Licenses {
|
8
|
+
static addLicense(name, license) {
|
9
|
+
Licenses.licenses[name] = license;
|
10
|
+
}
|
11
|
+
static getLicense(name) {
|
12
|
+
return Licenses.licenses[name];
|
13
|
+
}
|
14
|
+
static removeLicense(name) {
|
15
|
+
lodash_1.default.unset(Licenses.licenses, name);
|
16
|
+
}
|
17
|
+
static getLicenses() {
|
18
|
+
return Licenses.licenses;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
Licenses.licenses = {};
|
22
|
+
exports.default = Licenses;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const Licenses_1 = __importDefault(require("./Licenses"));
|
7
|
+
exports.default = Licenses_1.default;
|
package/lib/cjs/utils/utils.d.ts
CHANGED
@@ -349,6 +349,7 @@ export function isPromise(value: any): boolean;
|
|
349
349
|
*/
|
350
350
|
export function isInsideScopingComponent(componentInstance: any, firstPass?: boolean): boolean | boolean | any;
|
351
351
|
export function getFocusableElements(element: any): any;
|
352
|
+
export function getComponentSavedTypes(fullSchema: any): string[] | null;
|
352
353
|
export * from "./formUtils";
|
353
354
|
/**
|
354
355
|
* Map values through unfold and return first non-nil value.
|
@@ -357,6 +358,15 @@ export * from "./formUtils";
|
|
357
358
|
* @return {T}
|
358
359
|
*/
|
359
360
|
export const firstNonNil: any;
|
361
|
+
export namespace componentValueTypes {
|
362
|
+
const number: string;
|
363
|
+
const string: string;
|
364
|
+
const boolean: string;
|
365
|
+
const array: string;
|
366
|
+
const object: string;
|
367
|
+
const date: string;
|
368
|
+
const any: string;
|
369
|
+
}
|
360
370
|
import jsonLogic from 'json-logic-js';
|
361
371
|
import ConditionOperators from './conditionOperators';
|
362
372
|
import Evaluator from './Evaluator';
|
package/lib/cjs/utils/utils.js
CHANGED
@@ -31,7 +31,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31
31
|
};
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
33
33
|
exports.observeOverload = exports.withSwitch = exports.firstNonNil = exports.unfold = exports.bootstrapVersion = exports.uniqueKey = exports.iterateKey = exports.delay = exports.fieldData = exports.getCurrencyAffixes = exports.getNumberDecimalLimit = exports.getNumberSeparators = exports.matchInputMask = exports.unmaskValue = exports.getInputMask = exports.convertFormatToMask = exports.convertFormatToMoment = exports.convertFormatToFlatpickr = exports.getLocaleDateFormatInfo = exports.formatOffset = exports.formatDate = exports.momentDate = exports.loadZones = exports.shouldLoadZones = exports.zonesLoaded = exports.offsetDate = exports.currentTimezone = exports.isValidDate = exports.getDateSetting = exports.guid = exports.uniqueName = exports.convertStringToHTMLElement = exports.unescapeHTML = exports.setActionProperty = exports.checkTrigger = exports.checkCondition = exports.checkJsonConditional = exports.checkCustomConditional = exports.getComponentActualValue = exports.checkSimpleConditional = exports.checkCalculated = exports.isMongoId = exports.boolValue = exports.getElementRect = exports.getPropertyValue = exports.getRandomComponentId = exports.evaluate = exports.moment = exports.ConditionOperators = exports.jsonLogic = void 0;
|
34
|
-
exports._ = exports.getFocusableElements = exports.isInsideScopingComponent = exports.isPromise = exports.getDataParentComponent = exports.getComponentPath = exports.getComponentPathWithoutIndicies = exports.getBrowserInfo = exports.getIEBrowserVersion = exports.round = exports.getStringFromComponentPath = exports.hasInvalidComponent = exports.getArrayFromComponentPath = exports.isInputComponent = exports.interpolate = exports.Evaluator = exports.fastCloneDeep = exports.sanitize = exports.translateHTMLTemplate = exports.getContextButtons = exports.getContextComponents = void 0;
|
34
|
+
exports.getComponentSavedTypes = exports.componentValueTypes = exports._ = exports.getFocusableElements = exports.isInsideScopingComponent = exports.isPromise = exports.getDataParentComponent = exports.getComponentPath = exports.getComponentPathWithoutIndicies = exports.getBrowserInfo = exports.getIEBrowserVersion = exports.round = exports.getStringFromComponentPath = exports.hasInvalidComponent = exports.getArrayFromComponentPath = exports.isInputComponent = exports.interpolate = exports.Evaluator = exports.fastCloneDeep = exports.sanitize = exports.translateHTMLTemplate = exports.getContextButtons = exports.getContextComponents = void 0;
|
35
35
|
const lodash_1 = __importDefault(require("lodash"));
|
36
36
|
exports._ = lodash_1.default;
|
37
37
|
const fetch_ponyfill_1 = __importDefault(require("fetch-ponyfill"));
|
@@ -1465,3 +1465,23 @@ function getFocusableElements(element) {
|
|
1465
1465
|
return element.querySelectorAll(focusableSelector);
|
1466
1466
|
}
|
1467
1467
|
exports.getFocusableElements = getFocusableElements;
|
1468
|
+
exports.componentValueTypes = {
|
1469
|
+
number: 'number',
|
1470
|
+
string: 'string',
|
1471
|
+
boolean: 'boolean',
|
1472
|
+
array: 'array',
|
1473
|
+
object: 'object',
|
1474
|
+
date: 'date',
|
1475
|
+
any: 'any',
|
1476
|
+
};
|
1477
|
+
function getComponentSavedTypes(fullSchema) {
|
1478
|
+
const schema = fullSchema || {};
|
1479
|
+
if (schema.persistent !== true) {
|
1480
|
+
return [];
|
1481
|
+
}
|
1482
|
+
if (schema.multiple) {
|
1483
|
+
return [exports.componentValueTypes.array];
|
1484
|
+
}
|
1485
|
+
return null;
|
1486
|
+
}
|
1487
|
+
exports.getComponentSavedTypes = getComponentSavedTypes;
|
package/lib/mjs/CDN.d.ts
CHANGED
package/lib/mjs/CDN.js
CHANGED
package/lib/mjs/Element.js
CHANGED
@@ -527,6 +527,11 @@ export default class Element {
|
|
527
527
|
&& !FormioUtils.Evaluator.templateSettings.interpolate.test(string)) {
|
528
528
|
string = FormioUtils.translateHTMLTemplate(String(string), (value) => this.t(value));
|
529
529
|
}
|
530
|
+
if (this.component.filter === string && !this.options.building) {
|
531
|
+
const evalContext = this.evalContext(data);
|
532
|
+
evalContext.data = _.mapValues(evalContext.data, (val) => _.isString(val) ? encodeURIComponent(val) : val);
|
533
|
+
return FormioUtils.interpolate(string, evalContext, options);
|
534
|
+
}
|
530
535
|
return FormioUtils.interpolate(string, this.evalContext(data), options);
|
531
536
|
}
|
532
537
|
/**
|