@formio/js 5.2.1-rc.8 → 5.2.1
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.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +13 -13
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +15 -15
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +3 -3
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +2 -2
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/Element.js +2 -2
- package/lib/cjs/Embed.js +1 -1
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/WebformBuilder.d.ts +1 -0
- package/lib/cjs/WebformBuilder.js +15 -0
- package/lib/cjs/Wizard.js +2 -6
- package/lib/cjs/WizardBuilder.js +4 -0
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +1 -1
- package/lib/cjs/components/_classes/nested/NestedComponent.js +1 -2
- package/lib/cjs/components/datagrid/DataGrid.js +8 -1
- package/lib/cjs/components/editgrid/EditGrid.d.ts +2 -2
- package/lib/cjs/components/form/Form.d.ts +2 -1
- package/lib/cjs/components/form/Form.js +32 -20
- package/lib/cjs/components/radio/Radio.js +1 -1
- package/lib/cjs/components/select/Select.js +1 -1
- package/lib/cjs/components/tags/Tags.js +7 -0
- package/lib/cjs/formio.form.d.ts +2 -1
- package/lib/cjs/formio.form.js +2 -1
- package/lib/cjs/utils/index.d.ts +3 -2
- package/lib/cjs/utils/index.js +2 -1
- package/lib/mjs/Element.js +2 -2
- package/lib/mjs/Embed.js +1 -1
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/WebformBuilder.d.ts +1 -0
- package/lib/mjs/WebformBuilder.js +14 -0
- package/lib/mjs/Wizard.js +2 -6
- package/lib/mjs/WizardBuilder.js +4 -0
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +1 -1
- package/lib/mjs/components/_classes/nested/NestedComponent.js +1 -2
- package/lib/mjs/components/datagrid/DataGrid.js +7 -1
- package/lib/mjs/components/editgrid/EditGrid.d.ts +2 -2
- package/lib/mjs/components/form/Form.d.ts +2 -1
- package/lib/mjs/components/form/Form.js +32 -20
- package/lib/mjs/components/radio/Radio.js +1 -1
- package/lib/mjs/components/select/Select.js +1 -1
- package/lib/mjs/components/tags/Tags.js +7 -0
- package/lib/mjs/formio.form.d.ts +2 -1
- package/lib/mjs/formio.form.js +2 -2
- package/lib/mjs/utils/index.d.ts +3 -2
- package/lib/mjs/utils/index.js +2 -2
- package/package.json +3 -3
@@ -286,29 +286,35 @@ export default class FormComponent extends Component {
|
|
286
286
|
return;
|
287
287
|
}
|
288
288
|
this.setContent(element, this.render());
|
289
|
+
const postAttach = () => {
|
290
|
+
if (!this.builderMode && this.component.modalEdit) {
|
291
|
+
const modalShouldBeOpened = this.componentModal ? this.componentModal.isOpened : false;
|
292
|
+
const currentValue = modalShouldBeOpened ? this.componentModal.currentValue : this.dataValue;
|
293
|
+
this.componentModal = new ComponentModal(this, element, modalShouldBeOpened, currentValue, this._referenceAttributeName);
|
294
|
+
this.subForm.element = this.componentModal.refs.componentContent || this.subForm.element;
|
295
|
+
this.setOpenModalElement();
|
296
|
+
}
|
297
|
+
this.calculateValue();
|
298
|
+
};
|
289
299
|
if (this.subForm) {
|
290
300
|
if (this.isNestedWizard) {
|
291
301
|
element = this.root.element;
|
292
302
|
}
|
293
|
-
this.subForm.attach(element)
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
303
|
+
return this.subForm.attach(element).then(() => {
|
304
|
+
this.valueChanged = this.hasSetValue;
|
305
|
+
if (!this.shouldConditionallyClear()) {
|
306
|
+
if (!this.valueChanged && this.dataValue.state !== 'submitted') {
|
307
|
+
this.setDefaultValue();
|
308
|
+
}
|
309
|
+
else {
|
310
|
+
this.restoreValue();
|
311
|
+
}
|
301
312
|
}
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
const modalShouldBeOpened = this.componentModal ? this.componentModal.isOpened : false;
|
306
|
-
const currentValue = modalShouldBeOpened ? this.componentModal.currentValue : this.dataValue;
|
307
|
-
this.componentModal = new ComponentModal(this, element, modalShouldBeOpened, currentValue, this._referenceAttributeName);
|
308
|
-
this.subForm.element = this.componentModal.refs.componentContent || this.subForm.element;
|
309
|
-
this.setOpenModalElement();
|
313
|
+
postAttach();
|
314
|
+
this.setComponentsMap();
|
315
|
+
});
|
310
316
|
}
|
311
|
-
|
317
|
+
postAttach();
|
312
318
|
});
|
313
319
|
});
|
314
320
|
}
|
@@ -384,6 +390,14 @@ export default class FormComponent extends Component {
|
|
384
390
|
this.emit('subWizardsUpdated', subForm);
|
385
391
|
}
|
386
392
|
}
|
393
|
+
setComponentsMap() {
|
394
|
+
if (!this.subForm) {
|
395
|
+
return;
|
396
|
+
}
|
397
|
+
const componentsMap = this.componentsMap;
|
398
|
+
const formComponentsMap = this.subForm.componentsMap;
|
399
|
+
_.assign(componentsMap, formComponentsMap);
|
400
|
+
}
|
387
401
|
/**
|
388
402
|
* Create a subform instance.
|
389
403
|
* @param {boolean} [fromAttach] - This function is being called from an `attach` method.
|
@@ -408,9 +422,7 @@ export default class FormComponent extends Component {
|
|
408
422
|
this.subForm = instance;
|
409
423
|
this.subForm.currentForm = this;
|
410
424
|
this.subForm.parentVisible = this.visible;
|
411
|
-
|
412
|
-
const formComponentsMap = this.subForm.componentsMap;
|
413
|
-
_.assign(componentsMap, formComponentsMap);
|
425
|
+
this.setComponentsMap();
|
414
426
|
this.component.components = this.subForm._form?.components;
|
415
427
|
this.component.display = this.subForm._form?.display;
|
416
428
|
this.subForm.on('change', () => {
|
@@ -142,7 +142,7 @@ export default class RadioComponent extends ListComponent {
|
|
142
142
|
});
|
143
143
|
this.optionsLoaded = !this.component.dataSrc || this.component.dataSrc === 'values';
|
144
144
|
this.loadedOptions = [];
|
145
|
-
if (!this.visible) {
|
145
|
+
if (!this.visible || this.optionsLoaded) {
|
146
146
|
this.itemsLoadedResolve();
|
147
147
|
}
|
148
148
|
// Get the template keys for this radio component.
|
@@ -1153,7 +1153,7 @@ export default class SelectComponent extends ListComponent {
|
|
1153
1153
|
}
|
1154
1154
|
// Choices will return undefined if nothing is selected. We really want '' to be empty.
|
1155
1155
|
if (value === undefined || value === null) {
|
1156
|
-
value =
|
1156
|
+
value = this.emptyValue;
|
1157
1157
|
}
|
1158
1158
|
return value;
|
1159
1159
|
}
|
@@ -158,6 +158,13 @@ export default class TagsComponent extends Input {
|
|
158
158
|
this.refs.input[0].parentNode.lastChild.focus();
|
159
159
|
}
|
160
160
|
}
|
161
|
+
getValue() {
|
162
|
+
if (this.choices) {
|
163
|
+
const value = this.choices.getValue(true);
|
164
|
+
return value.join(`${this.delimiter}`);
|
165
|
+
}
|
166
|
+
return super.getValue();
|
167
|
+
}
|
161
168
|
getValueAsString(value) {
|
162
169
|
if (!value) {
|
163
170
|
return '';
|
package/lib/mjs/formio.form.d.ts
CHANGED
@@ -23,4 +23,5 @@ import { Formio } from './Formio';
|
|
23
23
|
import Licenses from './licenses';
|
24
24
|
import EventEmitter from './EventEmitter';
|
25
25
|
import Webform from './Webform';
|
26
|
-
|
26
|
+
import { DefaultEvaluator } from './utils';
|
27
|
+
export { Components, Displays, Providers, Widgets, Templates, Utils, Form, Formio, Licenses, EventEmitter, Webform, DefaultEvaluator };
|
package/lib/mjs/formio.form.js
CHANGED
@@ -11,7 +11,7 @@ import Utils from './utils';
|
|
11
11
|
import Licenses from './licenses';
|
12
12
|
import EventEmitter from './EventEmitter';
|
13
13
|
import Webform from './Webform';
|
14
|
-
import { Evaluator, registerEvaluator } from './utils';
|
14
|
+
import { Evaluator, registerEvaluator, DefaultEvaluator } from './utils';
|
15
15
|
Formio.loadModules = (path = `${Formio.getApiUrl()}/externalModules.js`, name = 'externalModules') => {
|
16
16
|
Formio.requireLibrary(name, name, path, true)
|
17
17
|
.then((modules) => {
|
@@ -126,4 +126,4 @@ export function useModule(defaultFn = null) {
|
|
126
126
|
Formio.use = useModule();
|
127
127
|
export { Formio as FormioCore } from './Formio';
|
128
128
|
// Export the components.
|
129
|
-
export { Components, Displays, Providers, Widgets, Templates, Utils, Form, Formio, Licenses, EventEmitter, Webform };
|
129
|
+
export { Components, Displays, Providers, Widgets, Templates, Utils, Form, Formio, Licenses, EventEmitter, Webform, DefaultEvaluator };
|
package/lib/mjs/utils/index.d.ts
CHANGED
@@ -2,7 +2,7 @@ export * from "./utils";
|
|
2
2
|
export * from "./formUtils";
|
3
3
|
export default FormioUtils;
|
4
4
|
declare const FormioUtils: {
|
5
|
-
Evaluator:
|
5
|
+
Evaluator: DefaultEvaluator;
|
6
6
|
interpolate: typeof interpolate;
|
7
7
|
ConditionOperators: {
|
8
8
|
[x: string]: typeof import("./conditionOperators/IsEqualTo").default | typeof import("./conditionOperators/DateGreaterThan").default;
|
@@ -163,6 +163,7 @@ declare const FormioUtils: {
|
|
163
163
|
};
|
164
164
|
import { Evaluator } from './Evaluator';
|
165
165
|
import { registerEvaluator } from './Evaluator';
|
166
|
+
import { DefaultEvaluator } from './Evaluator';
|
166
167
|
import { interpolate } from './Evaluator';
|
167
168
|
import moment from 'moment';
|
168
|
-
export { FormioUtils as Utils, Evaluator, registerEvaluator };
|
169
|
+
export { FormioUtils as Utils, Evaluator, registerEvaluator, DefaultEvaluator };
|
package/lib/mjs/utils/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as utils from './utils';
|
2
2
|
import * as formUtils from './formUtils';
|
3
|
-
import { Evaluator, registerEvaluator, interpolate } from './Evaluator';
|
3
|
+
import { Evaluator, registerEvaluator, interpolate, DefaultEvaluator } from './Evaluator';
|
4
4
|
import ConditionOperators from './conditionOperators';
|
5
5
|
import _ from 'lodash';
|
6
6
|
import moment from 'moment';
|
@@ -17,7 +17,7 @@ if (typeof global === 'object') {
|
|
17
17
|
global.FormioUtils = FormioUtils;
|
18
18
|
}
|
19
19
|
export { FormioUtils as Utils };
|
20
|
-
export { Evaluator, registerEvaluator };
|
20
|
+
export { Evaluator, registerEvaluator, DefaultEvaluator };
|
21
21
|
export * from './utils';
|
22
22
|
export * from './formUtils';
|
23
23
|
export default FormioUtils;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@formio/js",
|
3
|
-
"version": "5.2.1
|
3
|
+
"version": "5.2.1",
|
4
4
|
"description": "JavaScript powered Forms with JSON Form Builder",
|
5
5
|
"main": "lib/cjs/index.js",
|
6
6
|
"exports": {
|
@@ -79,8 +79,8 @@
|
|
79
79
|
},
|
80
80
|
"homepage": "https://github.com/formio/formio.js#readme",
|
81
81
|
"dependencies": {
|
82
|
-
"@formio/bootstrap": "3.1.2
|
83
|
-
"@formio/core": "2.5.1
|
82
|
+
"@formio/bootstrap": "3.1.2",
|
83
|
+
"@formio/core": "2.5.1",
|
84
84
|
"@formio/text-mask-addons": "^3.8.0-formio.4",
|
85
85
|
"@formio/vanilla-text-mask": "^5.1.1-formio.1",
|
86
86
|
"abortcontroller-polyfill": "^1.7.5",
|