@formio/js 5.0.0-dev.5543.201e658 → 5.0.0-dev.5543.3c780dd
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/Changelog.md +6102 -0
- package/dist/formio.builder.css +2 -2
- package/dist/formio.builder.min.css +1 -1
- package/dist/formio.form.css +2 -2
- package/dist/formio.form.js +7 -7
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +2 -2
- package/dist/formio.full.css +2 -2
- package/dist/formio.full.js +8 -8
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +2 -2
- package/lib/cjs/Form.d.ts +8 -0
- package/lib/cjs/Form.js +32 -1
- package/lib/cjs/Webform.js +3 -2
- package/lib/cjs/WebformBuilder.js +18 -2
- package/lib/cjs/components/datagrid/DataGrid.js +1 -1
- package/lib/cjs/components/datetime/fixtures/comp13.d.ts +123 -0
- package/lib/cjs/components/datetime/fixtures/comp13.js +118 -0
- package/lib/cjs/components/datetime/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/datetime/fixtures/index.js +3 -1
- package/lib/cjs/components/form/Form.js +25 -3
- package/lib/cjs/components/radio/Radio.d.ts +18 -0
- package/lib/cjs/components/radio/Radio.js +13 -0
- package/lib/cjs/widgets/CalendarWidget.js +8 -0
- package/lib/mjs/Form.d.ts +8 -0
- package/lib/mjs/Form.js +32 -1
- package/lib/mjs/Webform.js +3 -2
- package/lib/mjs/WebformBuilder.js +17 -1
- package/lib/mjs/components/datagrid/DataGrid.js +1 -1
- package/lib/mjs/components/datetime/fixtures/comp13.d.ts +123 -0
- package/lib/mjs/components/datetime/fixtures/comp13.js +116 -0
- package/lib/mjs/components/datetime/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/datetime/fixtures/index.js +2 -1
- package/lib/mjs/components/form/Form.js +23 -2
- package/lib/mjs/components/radio/Radio.d.ts +18 -0
- package/lib/mjs/components/radio/Radio.js +16 -0
- package/lib/mjs/widgets/CalendarWidget.js +8 -0
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Signature Pad v4.
|
|
3
|
-
* (c)
|
|
2
|
+
* Signature Pad v4.2.0 | https://github.com/szimek/signature_pad
|
|
3
|
+
* (c) 2024 Szymon Nowak | Released under the MIT license
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/*!
|
package/lib/cjs/Form.d.ts
CHANGED
|
@@ -62,6 +62,14 @@ export default class Form extends Element {
|
|
|
62
62
|
content: any;
|
|
63
63
|
}[];
|
|
64
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* Check Subdirectories path and provide correct options
|
|
67
|
+
*
|
|
68
|
+
* @param {string} url - The the URL of the form json.
|
|
69
|
+
* @param {form} object - The form json.
|
|
70
|
+
* @return {object} The initial options with base and project.
|
|
71
|
+
*/
|
|
72
|
+
getFormInitOptions(url: string, form: any): object;
|
|
65
73
|
setForm(formParam: any): any;
|
|
66
74
|
_form: any;
|
|
67
75
|
getSubmission(formio: any, opts: any): any;
|
package/lib/cjs/Form.js
CHANGED
|
@@ -178,6 +178,36 @@ class Form extends Element_1.default {
|
|
|
178
178
|
]
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Check Subdirectories path and provide correct options
|
|
183
|
+
*
|
|
184
|
+
* @param {string} url - The the URL of the form json.
|
|
185
|
+
* @param {form} object - The form json.
|
|
186
|
+
* @return {object} The initial options with base and project.
|
|
187
|
+
*/
|
|
188
|
+
getFormInitOptions(url, form) {
|
|
189
|
+
const options = {};
|
|
190
|
+
const index = url.indexOf(form === null || form === void 0 ? void 0 : form.path);
|
|
191
|
+
// form url doesn't include form path
|
|
192
|
+
if (index === -1) {
|
|
193
|
+
return options;
|
|
194
|
+
}
|
|
195
|
+
const projectUrl = url.substring(0, index - 1);
|
|
196
|
+
const urlParts = Formio_1.Formio.getUrlParts(projectUrl);
|
|
197
|
+
// project url doesn't include subdirectories path
|
|
198
|
+
if (!urlParts || urlParts.filter(part => !!part).length < 4) {
|
|
199
|
+
return options;
|
|
200
|
+
}
|
|
201
|
+
const baseUrl = `${urlParts[1]}${urlParts[2]}`;
|
|
202
|
+
// Skip if baseUrl has already been set
|
|
203
|
+
if (baseUrl !== Formio_1.Formio.baseUrl) {
|
|
204
|
+
return {
|
|
205
|
+
base: baseUrl,
|
|
206
|
+
project: projectUrl,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
return {};
|
|
210
|
+
}
|
|
181
211
|
setForm(formParam) {
|
|
182
212
|
let result;
|
|
183
213
|
formParam = formParam || this.form;
|
|
@@ -202,7 +232,8 @@ class Form extends Element_1.default {
|
|
|
202
232
|
}
|
|
203
233
|
this.loading = false;
|
|
204
234
|
this.instance = this.instance || this.create(form.display);
|
|
205
|
-
|
|
235
|
+
const options = this.getFormInitOptions(formParam, form);
|
|
236
|
+
this.instance.setUrl(formParam, options);
|
|
206
237
|
this.instance.nosubmit = false;
|
|
207
238
|
this._form = this.instance.form = form;
|
|
208
239
|
if (submission) {
|
package/lib/cjs/Webform.js
CHANGED
|
@@ -694,12 +694,13 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
694
694
|
* @param {userId} - The user id where we need to restore the draft from.
|
|
695
695
|
*/
|
|
696
696
|
restoreDraft(userId) {
|
|
697
|
-
|
|
697
|
+
const formio = this.formio || this.options.formio;
|
|
698
|
+
if (!formio) {
|
|
698
699
|
this.handleDraftError('restoreDraftInstanceError', null, true);
|
|
699
700
|
return;
|
|
700
701
|
}
|
|
701
702
|
this.savingDraft = true;
|
|
702
|
-
|
|
703
|
+
formio.loadSubmissions({
|
|
703
704
|
params: {
|
|
704
705
|
state: 'draft',
|
|
705
706
|
owner: userId
|
|
@@ -123,7 +123,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
123
123
|
}
|
|
124
124
|
this.options.hooks = this.options.hooks || {};
|
|
125
125
|
this.options.hooks.renderComponent = (html, { component, self }) => {
|
|
126
|
-
var _a;
|
|
126
|
+
var _a, _b;
|
|
127
127
|
if (self.type === 'form' && !self.key) {
|
|
128
128
|
const template = this.hook('renderComponentFormTemplate', html.replace('formio-component-form', ''));
|
|
129
129
|
// The main webform shouldn't have this class as it adds extra styles.
|
|
@@ -136,6 +136,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
136
136
|
html,
|
|
137
137
|
disableBuilderActions: (_a = self === null || self === void 0 ? void 0 : self.component) === null || _a === void 0 ? void 0 : _a.disableBuilderActions,
|
|
138
138
|
childComponent: component,
|
|
139
|
+
design: (_b = self === null || self === void 0 ? void 0 : self.options) === null || _b === void 0 ? void 0 : _b.design
|
|
139
140
|
});
|
|
140
141
|
};
|
|
141
142
|
this.options.hooks.renderComponents = (html, { components, self }) => {
|
|
@@ -486,6 +487,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
486
487
|
attach(element) {
|
|
487
488
|
this.on('change', (form) => {
|
|
488
489
|
this.populateRecaptchaSettings(form);
|
|
490
|
+
this.webform.setAlert(false);
|
|
489
491
|
});
|
|
490
492
|
return super.attach(element).then(() => {
|
|
491
493
|
this.loadRefs(element, {
|
|
@@ -819,6 +821,20 @@ class WebformBuilder extends Component_1.default {
|
|
|
819
821
|
return;
|
|
820
822
|
}
|
|
821
823
|
}
|
|
824
|
+
if (draggableComponent.uniqueComponent) {
|
|
825
|
+
let isCompAlreadyExists = false;
|
|
826
|
+
(0, formUtils_1.eachComponent)(this.webform.components, (component) => {
|
|
827
|
+
if (component.key === draggableComponent.schema.key) {
|
|
828
|
+
isCompAlreadyExists = true;
|
|
829
|
+
return;
|
|
830
|
+
}
|
|
831
|
+
}, true);
|
|
832
|
+
if (isCompAlreadyExists) {
|
|
833
|
+
this.webform.redraw();
|
|
834
|
+
this.webform.setAlert('danger', `You cannot add more than one ${draggableComponent.title} component to one page.`);
|
|
835
|
+
return;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
822
838
|
if (target !== source) {
|
|
823
839
|
// Ensure the key remains unique in its new container.
|
|
824
840
|
builder_1.default.uniquify(this.findNamespaceRoot(target.formioComponent), info);
|
|
@@ -851,7 +867,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
851
867
|
parent.addChildComponent(info, element, target, source, sibling);
|
|
852
868
|
}
|
|
853
869
|
const componentInDataGrid = parent.type === 'datagrid';
|
|
854
|
-
if (isNew && !this.options.noNewEdit && !info.noNewEdit) {
|
|
870
|
+
if (isNew && !this.options.noNewEdit && !info.noNewEdit && !(this.options.design && info.type === 'reviewpage')) {
|
|
855
871
|
this.editComponent(info, target, isNew, null, null, { inDataGrid: componentInDataGrid });
|
|
856
872
|
}
|
|
857
873
|
// Only rebuild the parts needing to be rebuilt.
|
|
@@ -198,7 +198,7 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
198
198
|
return this.hasAddButton() && ['bottom', 'both'].includes(this.addAnotherPosition);
|
|
199
199
|
}
|
|
200
200
|
get canAddColumn() {
|
|
201
|
-
return this.builderMode;
|
|
201
|
+
return this.builderMode && !this.options.design;
|
|
202
202
|
}
|
|
203
203
|
render() {
|
|
204
204
|
const columns = this.getColumns();
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
const type: string;
|
|
3
|
+
const display: string;
|
|
4
|
+
const components: ({
|
|
5
|
+
label: string;
|
|
6
|
+
tableView: boolean;
|
|
7
|
+
datePicker: {
|
|
8
|
+
disableWeekends: boolean;
|
|
9
|
+
disableWeekdays: boolean;
|
|
10
|
+
disableFunction?: undefined;
|
|
11
|
+
};
|
|
12
|
+
enableMinDateInput: boolean;
|
|
13
|
+
enableMaxDateInput: boolean;
|
|
14
|
+
key: string;
|
|
15
|
+
type: string;
|
|
16
|
+
input: boolean;
|
|
17
|
+
widget: {
|
|
18
|
+
type: string;
|
|
19
|
+
displayInTimezone: string;
|
|
20
|
+
locale: string;
|
|
21
|
+
useLocaleSettings: boolean;
|
|
22
|
+
allowInput: boolean;
|
|
23
|
+
mode: string;
|
|
24
|
+
enableTime: boolean;
|
|
25
|
+
noCalendar: boolean;
|
|
26
|
+
format: string;
|
|
27
|
+
hourIncrement: number;
|
|
28
|
+
minuteIncrement: number;
|
|
29
|
+
time_24hr: boolean;
|
|
30
|
+
minDate: null;
|
|
31
|
+
disableWeekends: boolean;
|
|
32
|
+
disableWeekdays: boolean;
|
|
33
|
+
maxDate: null;
|
|
34
|
+
disableFunction?: undefined;
|
|
35
|
+
};
|
|
36
|
+
validate?: undefined;
|
|
37
|
+
disableOnInvalid?: undefined;
|
|
38
|
+
} | {
|
|
39
|
+
label: string;
|
|
40
|
+
tableView: boolean;
|
|
41
|
+
enableMinDateInput: boolean;
|
|
42
|
+
datePicker: {
|
|
43
|
+
disableWeekends: boolean;
|
|
44
|
+
disableWeekdays: boolean;
|
|
45
|
+
disableFunction?: undefined;
|
|
46
|
+
};
|
|
47
|
+
enableMaxDateInput: boolean;
|
|
48
|
+
validate: {
|
|
49
|
+
custom: string;
|
|
50
|
+
};
|
|
51
|
+
key: string;
|
|
52
|
+
type: string;
|
|
53
|
+
input: boolean;
|
|
54
|
+
widget: {
|
|
55
|
+
type: string;
|
|
56
|
+
displayInTimezone: string;
|
|
57
|
+
locale: string;
|
|
58
|
+
useLocaleSettings: boolean;
|
|
59
|
+
allowInput: boolean;
|
|
60
|
+
mode: string;
|
|
61
|
+
enableTime: boolean;
|
|
62
|
+
noCalendar: boolean;
|
|
63
|
+
format: string;
|
|
64
|
+
hourIncrement: number;
|
|
65
|
+
minuteIncrement: number;
|
|
66
|
+
time_24hr: boolean;
|
|
67
|
+
minDate: null;
|
|
68
|
+
disableWeekends: boolean;
|
|
69
|
+
disableWeekdays: boolean;
|
|
70
|
+
maxDate: null;
|
|
71
|
+
disableFunction?: undefined;
|
|
72
|
+
};
|
|
73
|
+
disableOnInvalid?: undefined;
|
|
74
|
+
} | {
|
|
75
|
+
label: string;
|
|
76
|
+
tableView: boolean;
|
|
77
|
+
datePicker: {
|
|
78
|
+
disableFunction: string;
|
|
79
|
+
disableWeekends: boolean;
|
|
80
|
+
disableWeekdays: boolean;
|
|
81
|
+
};
|
|
82
|
+
enableMinDateInput: boolean;
|
|
83
|
+
enableMaxDateInput: boolean;
|
|
84
|
+
key: string;
|
|
85
|
+
customConditional: string;
|
|
86
|
+
type: string;
|
|
87
|
+
input: boolean;
|
|
88
|
+
widget: {
|
|
89
|
+
type: string;
|
|
90
|
+
displayInTimezone: string;
|
|
91
|
+
locale: string;
|
|
92
|
+
useLocaleSettings: boolean;
|
|
93
|
+
allowInput: boolean;
|
|
94
|
+
mode: string;
|
|
95
|
+
enableTime: boolean;
|
|
96
|
+
noCalendar: boolean;
|
|
97
|
+
format: string;
|
|
98
|
+
hourIncrement: number;
|
|
99
|
+
minuteIncrement: number;
|
|
100
|
+
time_24hr: boolean;
|
|
101
|
+
minDate: null;
|
|
102
|
+
disableWeekends: boolean;
|
|
103
|
+
disableWeekdays: boolean;
|
|
104
|
+
disableFunction: string;
|
|
105
|
+
maxDate: null;
|
|
106
|
+
};
|
|
107
|
+
validate?: undefined;
|
|
108
|
+
disableOnInvalid?: undefined;
|
|
109
|
+
} | {
|
|
110
|
+
type: string;
|
|
111
|
+
label: string;
|
|
112
|
+
key: string;
|
|
113
|
+
disableOnInvalid: boolean;
|
|
114
|
+
input: boolean;
|
|
115
|
+
tableView: boolean;
|
|
116
|
+
datePicker?: undefined;
|
|
117
|
+
enableMinDateInput?: undefined;
|
|
118
|
+
enableMaxDateInput?: undefined;
|
|
119
|
+
widget?: undefined;
|
|
120
|
+
validate?: undefined;
|
|
121
|
+
})[];
|
|
122
|
+
}
|
|
123
|
+
export default _default;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
type: 'form',
|
|
5
|
+
display: 'form',
|
|
6
|
+
components: [
|
|
7
|
+
{
|
|
8
|
+
label: 'Min Date',
|
|
9
|
+
tableView: false,
|
|
10
|
+
datePicker: {
|
|
11
|
+
disableWeekends: false,
|
|
12
|
+
disableWeekdays: false
|
|
13
|
+
},
|
|
14
|
+
enableMinDateInput: false,
|
|
15
|
+
enableMaxDateInput: false,
|
|
16
|
+
key: 'minDate',
|
|
17
|
+
type: 'datetime',
|
|
18
|
+
input: true,
|
|
19
|
+
widget: {
|
|
20
|
+
type: 'calendar',
|
|
21
|
+
displayInTimezone: 'viewer',
|
|
22
|
+
locale: 'en',
|
|
23
|
+
useLocaleSettings: false,
|
|
24
|
+
allowInput: true,
|
|
25
|
+
mode: 'single',
|
|
26
|
+
enableTime: true,
|
|
27
|
+
noCalendar: false,
|
|
28
|
+
format: 'yyyy-MM-dd hh:mm a',
|
|
29
|
+
hourIncrement: 1,
|
|
30
|
+
minuteIncrement: 1,
|
|
31
|
+
// eslint-disable-next-line camelcase
|
|
32
|
+
time_24hr: false,
|
|
33
|
+
minDate: null,
|
|
34
|
+
disableWeekends: false,
|
|
35
|
+
disableWeekdays: false,
|
|
36
|
+
maxDate: null
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: 'Max Date',
|
|
41
|
+
tableView: false,
|
|
42
|
+
enableMinDateInput: false,
|
|
43
|
+
datePicker: {
|
|
44
|
+
disableWeekends: false,
|
|
45
|
+
disableWeekdays: false
|
|
46
|
+
},
|
|
47
|
+
enableMaxDateInput: false,
|
|
48
|
+
validate: {
|
|
49
|
+
custom: "var minDate = moment(data.minDate);\nvar maxDate = moment(data.maxDate);\nvalid = maxDate.isAfter(minDate)? true : 'Max date must be after min date'"
|
|
50
|
+
},
|
|
51
|
+
key: 'maxDate',
|
|
52
|
+
type: 'datetime',
|
|
53
|
+
input: true,
|
|
54
|
+
widget: {
|
|
55
|
+
type: 'calendar',
|
|
56
|
+
displayInTimezone: 'viewer',
|
|
57
|
+
locale: 'en',
|
|
58
|
+
useLocaleSettings: false,
|
|
59
|
+
allowInput: true,
|
|
60
|
+
mode: 'single',
|
|
61
|
+
enableTime: true,
|
|
62
|
+
noCalendar: false,
|
|
63
|
+
format: 'yyyy-MM-dd hh:mm a',
|
|
64
|
+
hourIncrement: 1,
|
|
65
|
+
minuteIncrement: 1,
|
|
66
|
+
// eslint-disable-next-line camelcase
|
|
67
|
+
time_24hr: false,
|
|
68
|
+
minDate: null,
|
|
69
|
+
disableWeekends: false,
|
|
70
|
+
disableWeekdays: false,
|
|
71
|
+
maxDate: null
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
label: 'In Between Date',
|
|
76
|
+
tableView: false,
|
|
77
|
+
datePicker: {
|
|
78
|
+
disableFunction: '!moment(date).isBetween(moment(data.minDate), moment(data.maxDate))',
|
|
79
|
+
disableWeekends: false,
|
|
80
|
+
disableWeekdays: false
|
|
81
|
+
},
|
|
82
|
+
enableMinDateInput: false,
|
|
83
|
+
enableMaxDateInput: false,
|
|
84
|
+
key: 'inBetweenDate',
|
|
85
|
+
customConditional: 'show = !!data.minDate && !!data.maxDate',
|
|
86
|
+
type: 'datetime',
|
|
87
|
+
input: true,
|
|
88
|
+
widget: {
|
|
89
|
+
type: 'calendar',
|
|
90
|
+
displayInTimezone: 'viewer',
|
|
91
|
+
locale: 'en',
|
|
92
|
+
useLocaleSettings: false,
|
|
93
|
+
allowInput: true,
|
|
94
|
+
mode: 'single',
|
|
95
|
+
enableTime: true,
|
|
96
|
+
noCalendar: false,
|
|
97
|
+
format: 'yyyy-MM-dd hh:mm a',
|
|
98
|
+
hourIncrement: 1,
|
|
99
|
+
minuteIncrement: 1,
|
|
100
|
+
// eslint-disable-next-line camelcase
|
|
101
|
+
time_24hr: false,
|
|
102
|
+
minDate: null,
|
|
103
|
+
disableWeekends: false,
|
|
104
|
+
disableWeekdays: false,
|
|
105
|
+
disableFunction: '!moment(date).isBetween(moment(data.minDate), moment(data.maxDate))',
|
|
106
|
+
maxDate: null
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
type: 'button',
|
|
111
|
+
label: 'Submit',
|
|
112
|
+
key: 'submit',
|
|
113
|
+
disableOnInvalid: true,
|
|
114
|
+
input: true,
|
|
115
|
+
tableView: false
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
};
|
|
@@ -2,6 +2,7 @@ import comp1 from './comp1';
|
|
|
2
2
|
import comp10 from './comp10';
|
|
3
3
|
import comp11 from './comp11';
|
|
4
4
|
import comp12 from './comp12';
|
|
5
|
+
import comp13 from './comp13';
|
|
5
6
|
import comp2 from './comp2';
|
|
6
7
|
import comp3 from './comp3';
|
|
7
8
|
import comp5 from './comp5';
|
|
@@ -9,4 +10,4 @@ import comp6 from './comp6';
|
|
|
9
10
|
import comp7 from './comp7';
|
|
10
11
|
import comp8 from './comp8';
|
|
11
12
|
import comp9 from './comp9';
|
|
12
|
-
export { comp1, comp10, comp11, comp12, comp2, comp3, comp5, comp6, comp7, comp8, comp9 };
|
|
13
|
+
export { comp1, comp10, comp11, comp12, comp13, comp2, comp3, comp5, comp6, comp7, comp8, comp9 };
|
|
@@ -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.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp3 = exports.comp2 = exports.comp12 = exports.comp11 = exports.comp10 = exports.comp1 = void 0;
|
|
6
|
+
exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp3 = exports.comp2 = exports.comp13 = exports.comp12 = exports.comp11 = exports.comp10 = 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"));
|
|
@@ -26,3 +26,5 @@ const comp11_1 = __importDefault(require("./comp11"));
|
|
|
26
26
|
exports.comp11 = comp11_1.default;
|
|
27
27
|
const comp12_1 = __importDefault(require("./comp12"));
|
|
28
28
|
exports.comp12 = comp12_1.default;
|
|
29
|
+
const comp13_1 = __importDefault(require("./comp13"));
|
|
30
|
+
exports.comp13 = comp13_1.default;
|
|
@@ -142,6 +142,7 @@ class FormComponent extends Component_1.default {
|
|
|
142
142
|
return this.subForm.getComponent(path, fn, originalPathStr);
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
+
/* eslint-disable max-statements */
|
|
145
146
|
getSubOptions(options = {}) {
|
|
146
147
|
options.parentPath = `${this.path}.data.`;
|
|
147
148
|
options.events = this.createEmitter();
|
|
@@ -195,8 +196,16 @@ class FormComponent extends Component_1.default {
|
|
|
195
196
|
if (this.options.preview) {
|
|
196
197
|
options.preview = this.options.preview;
|
|
197
198
|
}
|
|
199
|
+
if (this.options.saveDraft) {
|
|
200
|
+
options.saveDraft = this.options.saveDraft;
|
|
201
|
+
options.formio = new Formio_1.Formio(this.formSrc);
|
|
202
|
+
}
|
|
203
|
+
if (this.options.saveDraftThrottle) {
|
|
204
|
+
options.saveDraftThrottle = this.options.saveDraftThrottle;
|
|
205
|
+
}
|
|
198
206
|
return options;
|
|
199
207
|
}
|
|
208
|
+
/* eslint-enable max-statements */
|
|
200
209
|
render() {
|
|
201
210
|
if (this.builderMode) {
|
|
202
211
|
return super.render(this.component.label || 'Nested form');
|
|
@@ -416,7 +425,7 @@ class FormComponent extends Component_1.default {
|
|
|
416
425
|
* Load the subform.
|
|
417
426
|
*/
|
|
418
427
|
loadSubForm(fromAttach) {
|
|
419
|
-
var _a;
|
|
428
|
+
var _a, _b, _c;
|
|
420
429
|
if (this.builderMode || this.isHidden() || (this.isSubFormLazyLoad() && !fromAttach)) {
|
|
421
430
|
return Promise.resolve();
|
|
422
431
|
}
|
|
@@ -430,7 +439,13 @@ class FormComponent extends Component_1.default {
|
|
|
430
439
|
}
|
|
431
440
|
else if (this.formSrc) {
|
|
432
441
|
this.subFormLoading = true;
|
|
433
|
-
|
|
442
|
+
const options = ((_b = this.root.formio) === null || _b === void 0 ? void 0 : _b.base) && ((_c = this.root.formio) === null || _c === void 0 ? void 0 : _c.projectUrl)
|
|
443
|
+
? {
|
|
444
|
+
base: this.root.formio.base,
|
|
445
|
+
project: this.root.formio.projectUrl,
|
|
446
|
+
}
|
|
447
|
+
: {};
|
|
448
|
+
return (new Formio_1.Formio(this.formSrc, options)).loadForm({ params: { live: 1 } })
|
|
434
449
|
.then((formObj) => {
|
|
435
450
|
this.formObj = formObj;
|
|
436
451
|
if (this.options.pdf && this.component.useOriginalRevision) {
|
|
@@ -603,6 +618,7 @@ class FormComponent extends Component_1.default {
|
|
|
603
618
|
return changed;
|
|
604
619
|
}
|
|
605
620
|
setSubFormValue(submission, flags) {
|
|
621
|
+
var _a, _b;
|
|
606
622
|
const shouldLoadSubmissionById = submission
|
|
607
623
|
&& submission._id
|
|
608
624
|
&& this.subForm.formio
|
|
@@ -610,7 +626,13 @@ class FormComponent extends Component_1.default {
|
|
|
610
626
|
if (shouldLoadSubmissionById) {
|
|
611
627
|
const formId = submission.form || this.formObj.form || this.component.form;
|
|
612
628
|
const submissionUrl = `${this.subForm.formio.formsUrl}/${formId}/submission/${submission._id}`;
|
|
613
|
-
this.
|
|
629
|
+
const options = ((_a = this.root.formio) === null || _a === void 0 ? void 0 : _a.base) && ((_b = this.root.formio) === null || _b === void 0 ? void 0 : _b.projectUrl)
|
|
630
|
+
? {
|
|
631
|
+
base: this.root.formio.base,
|
|
632
|
+
project: this.root.formio.projectUrl,
|
|
633
|
+
}
|
|
634
|
+
: {};
|
|
635
|
+
this.subForm.setUrl(submissionUrl, Object.assign(Object.assign({}, this.options), options));
|
|
614
636
|
this.subForm.loadSubmission().catch((err) => {
|
|
615
637
|
console.error(`Unable to load subform submission ${submission._id}:`, err);
|
|
616
638
|
});
|
|
@@ -25,6 +25,24 @@ export default class RadioComponent extends ListComponent {
|
|
|
25
25
|
isPrototypeOf(v: Object): boolean;
|
|
26
26
|
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
27
27
|
};
|
|
28
|
+
static get serverConditionSettings(): {
|
|
29
|
+
valueComponent(classComp: any): {
|
|
30
|
+
type: string;
|
|
31
|
+
dataSrc: string;
|
|
32
|
+
valueProperty: string;
|
|
33
|
+
dataType: any;
|
|
34
|
+
data: {
|
|
35
|
+
custom: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
constructor: Function;
|
|
39
|
+
toString(): string;
|
|
40
|
+
toLocaleString(): string;
|
|
41
|
+
valueOf(): Object;
|
|
42
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
|
43
|
+
isPrototypeOf(v: Object): boolean;
|
|
44
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
45
|
+
};
|
|
28
46
|
static savedValueTypes(schema: any): any[];
|
|
29
47
|
constructor(component: any, options: any, data: any);
|
|
30
48
|
previousValue: any;
|
|
@@ -46,6 +46,19 @@ class RadioComponent extends ListComponent_1.default {
|
|
|
46
46
|
};
|
|
47
47
|
} });
|
|
48
48
|
}
|
|
49
|
+
static get serverConditionSettings() {
|
|
50
|
+
return Object.assign(Object.assign({}, super.serverConditionSettings), { valueComponent(classComp) {
|
|
51
|
+
return {
|
|
52
|
+
type: 'select',
|
|
53
|
+
dataSrc: 'custom',
|
|
54
|
+
valueProperty: 'value',
|
|
55
|
+
dataType: classComp.dataType || '',
|
|
56
|
+
data: {
|
|
57
|
+
custom: `values = ${classComp && classComp.values ? JSON.stringify(classComp.values) : []}`,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
} });
|
|
61
|
+
}
|
|
49
62
|
static savedValueTypes(schema) {
|
|
50
63
|
const { boolean, string, number, object, array } = utils_1.componentValueTypes;
|
|
51
64
|
const { dataType } = schema;
|
|
@@ -419,6 +419,14 @@ class CalendarWidget extends InputWidget_1.default {
|
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
421
|
});
|
|
422
|
+
// If other fields are used to calculate disabled dates, we need to redraw calendar to refresh disabled dates
|
|
423
|
+
if (this.settings.disableFunction && this.componentInstance && this.componentInstance.root) {
|
|
424
|
+
this.componentInstance.root.on('change', (e) => {
|
|
425
|
+
if (e.changed && this.calendar) {
|
|
426
|
+
this.calendar.redraw();
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
}
|
|
422
430
|
// Restore the calendar value from the component value.
|
|
423
431
|
this.setValue(this.componentValue);
|
|
424
432
|
}
|
package/lib/mjs/Form.d.ts
CHANGED
|
@@ -62,6 +62,14 @@ export default class Form extends Element {
|
|
|
62
62
|
content: any;
|
|
63
63
|
}[];
|
|
64
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* Check Subdirectories path and provide correct options
|
|
67
|
+
*
|
|
68
|
+
* @param {string} url - The the URL of the form json.
|
|
69
|
+
* @param {form} object - The form json.
|
|
70
|
+
* @return {object} The initial options with base and project.
|
|
71
|
+
*/
|
|
72
|
+
getFormInitOptions(url: string, form: any): object;
|
|
65
73
|
setForm(formParam: any): any;
|
|
66
74
|
_form: any;
|
|
67
75
|
getSubmission(formio: any, opts: any): any;
|
package/lib/mjs/Form.js
CHANGED
|
@@ -150,6 +150,36 @@ export default class Form extends Element {
|
|
|
150
150
|
]
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Check Subdirectories path and provide correct options
|
|
155
|
+
*
|
|
156
|
+
* @param {string} url - The the URL of the form json.
|
|
157
|
+
* @param {form} object - The form json.
|
|
158
|
+
* @return {object} The initial options with base and project.
|
|
159
|
+
*/
|
|
160
|
+
getFormInitOptions(url, form) {
|
|
161
|
+
const options = {};
|
|
162
|
+
const index = url.indexOf(form?.path);
|
|
163
|
+
// form url doesn't include form path
|
|
164
|
+
if (index === -1) {
|
|
165
|
+
return options;
|
|
166
|
+
}
|
|
167
|
+
const projectUrl = url.substring(0, index - 1);
|
|
168
|
+
const urlParts = Formio.getUrlParts(projectUrl);
|
|
169
|
+
// project url doesn't include subdirectories path
|
|
170
|
+
if (!urlParts || urlParts.filter(part => !!part).length < 4) {
|
|
171
|
+
return options;
|
|
172
|
+
}
|
|
173
|
+
const baseUrl = `${urlParts[1]}${urlParts[2]}`;
|
|
174
|
+
// Skip if baseUrl has already been set
|
|
175
|
+
if (baseUrl !== Formio.baseUrl) {
|
|
176
|
+
return {
|
|
177
|
+
base: baseUrl,
|
|
178
|
+
project: projectUrl,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
return {};
|
|
182
|
+
}
|
|
153
183
|
setForm(formParam) {
|
|
154
184
|
let result;
|
|
155
185
|
formParam = formParam || this.form;
|
|
@@ -174,7 +204,8 @@ export default class Form extends Element {
|
|
|
174
204
|
}
|
|
175
205
|
this.loading = false;
|
|
176
206
|
this.instance = this.instance || this.create(form.display);
|
|
177
|
-
|
|
207
|
+
const options = this.getFormInitOptions(formParam, form);
|
|
208
|
+
this.instance.setUrl(formParam, options);
|
|
178
209
|
this.instance.nosubmit = false;
|
|
179
210
|
this._form = this.instance.form = form;
|
|
180
211
|
if (submission) {
|
package/lib/mjs/Webform.js
CHANGED
|
@@ -694,12 +694,13 @@ export default class Webform extends NestedDataComponent {
|
|
|
694
694
|
* @param {userId} - The user id where we need to restore the draft from.
|
|
695
695
|
*/
|
|
696
696
|
restoreDraft(userId) {
|
|
697
|
-
|
|
697
|
+
const formio = this.formio || this.options.formio;
|
|
698
|
+
if (!formio) {
|
|
698
699
|
this.handleDraftError('restoreDraftInstanceError', null, true);
|
|
699
700
|
return;
|
|
700
701
|
}
|
|
701
702
|
this.savingDraft = true;
|
|
702
|
-
|
|
703
|
+
formio.loadSubmissions({
|
|
703
704
|
params: {
|
|
704
705
|
state: 'draft',
|
|
705
706
|
owner: userId
|