@formio/js 5.1.0-dev.6220.2e623f9 → 5.1.0-dev.6221.d976115

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.
@@ -533,9 +533,9 @@ class Element {
533
533
  if (this.component.filter === string && !this.options.building) {
534
534
  const evalContext = this.evalContext(data);
535
535
  evalContext.data = lodash_1.default.mapValues(evalContext.data, (val) => lodash_1.default.isString(val) ? encodeURIComponent(val) : val);
536
- return utils_1.default.Evaluator.interpolate(string, evalContext, options);
536
+ return utils_1.default.interpolate(string, evalContext, options);
537
537
  }
538
- return utils_1.default.Evaluator.interpolate(string, this.evalContext(data), options);
538
+ return utils_1.default.interpolate(string, this.evalContext(data), options);
539
539
  }
540
540
  /**
541
541
  * Performs an evaluation using the evaluation context of this component.
@@ -1208,6 +1208,7 @@ class WebformBuilder extends Component_1.default {
1208
1208
  submissionData = submissionData.componentJson || submissionData;
1209
1209
  if (submissionData.components && this.originalDefaultValue) {
1210
1210
  submissionData.components = this.originalDefaultValue.components;
1211
+ this.originalDefaultValue = null;
1211
1212
  }
1212
1213
  const fieldsToRemoveDoubleQuotes = ['label', 'tooltip'];
1213
1214
  this.replaceDoubleQuotes(submissionData, fieldsToRemoveDoubleQuotes);
@@ -42,6 +42,7 @@ export default class FormComponent extends Component {
42
42
  everyComponent(...args: any[]): any;
43
43
  setSubFormDisabled(subForm: any): void;
44
44
  updateSubWizards(subForm: any): void;
45
+ setComponentsMap(): void;
45
46
  /**
46
47
  * Create a subform instance.
47
48
  * @param {boolean} [fromAttach] - This function is being called from an `attach` method.
@@ -315,6 +315,7 @@ class FormComponent extends Component_1.default {
315
315
  }
316
316
  }
317
317
  postAttach();
318
+ this.setComponentsMap();
318
319
  });
319
320
  }
320
321
  postAttach();
@@ -395,6 +396,14 @@ class FormComponent extends Component_1.default {
395
396
  this.emit('subWizardsUpdated', subForm);
396
397
  }
397
398
  }
399
+ setComponentsMap() {
400
+ if (!this.subForm) {
401
+ return;
402
+ }
403
+ const componentsMap = this.componentsMap;
404
+ const formComponentsMap = this.subForm.componentsMap;
405
+ lodash_1.default.assign(componentsMap, formComponentsMap);
406
+ }
398
407
  /**
399
408
  * Create a subform instance.
400
409
  * @param {boolean} [fromAttach] - This function is being called from an `attach` method.
@@ -420,9 +429,6 @@ class FormComponent extends Component_1.default {
420
429
  this.subForm = instance;
421
430
  this.subForm.currentForm = this;
422
431
  this.subForm.parentVisible = this.visible;
423
- const componentsMap = this.componentsMap;
424
- const formComponentsMap = this.subForm.componentsMap;
425
- lodash_1.default.assign(componentsMap, formComponentsMap);
426
432
  this.component.components = (_a = this.subForm._form) === null || _a === void 0 ? void 0 : _a.components;
427
433
  this.component.display = (_b = this.subForm._form) === null || _b === void 0 ? void 0 : _b.display;
428
434
  this.subForm.on('change', () => {
@@ -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
- export { Components, Displays, Providers, Widgets, Templates, Utils, Form, Formio, Licenses, EventEmitter, Webform };
26
+ import { DefaultEvaluator } from './utils';
27
+ export { Components, Displays, Providers, Widgets, Templates, Utils, Form, Formio, Licenses, EventEmitter, Webform, DefaultEvaluator };
@@ -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.Webform = exports.EventEmitter = exports.Licenses = exports.Formio = exports.Form = exports.Utils = exports.Templates = exports.Widgets = exports.Providers = exports.Displays = exports.Components = exports.FormioCore = exports.useModule = exports.registerModule = void 0;
6
+ exports.DefaultEvaluator = exports.Webform = exports.EventEmitter = exports.Licenses = exports.Formio = exports.Form = exports.Utils = exports.Templates = exports.Widgets = exports.Providers = exports.Displays = exports.Components = exports.FormioCore = 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; } });
@@ -30,6 +30,7 @@ const Webform_1 = __importDefault(require("./Webform"));
30
30
  exports.Webform = Webform_1.default;
31
31
  const core_1 = require("@formio/core");
32
32
  const utils_2 = require("./utils");
33
+ Object.defineProperty(exports, "DefaultEvaluator", { enumerable: true, get: function () { return utils_2.DefaultEvaluator; } });
33
34
  Formio_1.Formio.loadModules = (path = `${Formio_1.Formio.getApiUrl()}/externalModules.js`, name = 'externalModules') => {
34
35
  Formio_1.Formio.requireLibrary(name, name, path, true)
35
36
  .then((modules) => {
@@ -2,7 +2,7 @@ export * from "./utils";
2
2
  export * from "./formUtils";
3
3
  export default FormioUtils;
4
4
  declare const FormioUtils: {
5
- Evaluator: import("./Evaluator").DefaultEvaluator;
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;
@@ -164,7 +164,8 @@ declare const FormioUtils: {
164
164
  interpolateErrors: (component: Component, errors: FieldError[], interpolateFn: Function) => [];
165
165
  };
166
166
  import { Evaluator } from './Evaluator';
167
+ import { DefaultEvaluator } from './Evaluator';
167
168
  import { registerEvaluator } from './Evaluator';
168
169
  import { interpolate } from './Evaluator';
169
170
  import moment from 'moment';
170
- export { FormioUtils as Utils, Evaluator, registerEvaluator };
171
+ export { FormioUtils as Utils, Evaluator, DefaultEvaluator, registerEvaluator };
@@ -29,12 +29,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
29
29
  return (mod && mod.__esModule) ? mod : { "default": mod };
30
30
  };
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.registerEvaluator = exports.Evaluator = exports.Utils = void 0;
32
+ exports.registerEvaluator = exports.DefaultEvaluator = exports.Evaluator = exports.Utils = void 0;
33
33
  const utils = __importStar(require("./utils"));
34
34
  const formUtils = __importStar(require("./formUtils"));
35
35
  const Evaluator_1 = require("./Evaluator");
36
36
  Object.defineProperty(exports, "Evaluator", { enumerable: true, get: function () { return Evaluator_1.Evaluator; } });
37
37
  Object.defineProperty(exports, "registerEvaluator", { enumerable: true, get: function () { return Evaluator_1.registerEvaluator; } });
38
+ Object.defineProperty(exports, "DefaultEvaluator", { enumerable: true, get: function () { return Evaluator_1.DefaultEvaluator; } });
38
39
  const conditionOperators_1 = __importDefault(require("./conditionOperators"));
39
40
  const lodash_1 = __importDefault(require("lodash"));
40
41
  const moment_1 = __importDefault(require("moment"));
@@ -525,9 +525,9 @@ export default class Element {
525
525
  if (this.component.filter === string && !this.options.building) {
526
526
  const evalContext = this.evalContext(data);
527
527
  evalContext.data = _.mapValues(evalContext.data, (val) => _.isString(val) ? encodeURIComponent(val) : val);
528
- return FormioUtils.Evaluator.interpolate(string, evalContext, options);
528
+ return FormioUtils.interpolate(string, evalContext, options);
529
529
  }
530
- return FormioUtils.Evaluator.interpolate(string, this.evalContext(data), options);
530
+ return FormioUtils.interpolate(string, this.evalContext(data), options);
531
531
  }
532
532
  /**
533
533
  * Performs an evaluation using the evaluation context of this component.
@@ -1190,6 +1190,7 @@ export default class WebformBuilder extends Component {
1190
1190
  submissionData = submissionData.componentJson || submissionData;
1191
1191
  if (submissionData.components && this.originalDefaultValue) {
1192
1192
  submissionData.components = this.originalDefaultValue.components;
1193
+ this.originalDefaultValue = null;
1193
1194
  }
1194
1195
  const fieldsToRemoveDoubleQuotes = ['label', 'tooltip'];
1195
1196
  this.replaceDoubleQuotes(submissionData, fieldsToRemoveDoubleQuotes);
@@ -42,6 +42,7 @@ export default class FormComponent extends Component {
42
42
  everyComponent(...args: any[]): any;
43
43
  setSubFormDisabled(subForm: any): void;
44
44
  updateSubWizards(subForm: any): void;
45
+ setComponentsMap(): void;
45
46
  /**
46
47
  * Create a subform instance.
47
48
  * @param {boolean} [fromAttach] - This function is being called from an `attach` method.
@@ -311,6 +311,7 @@ export default class FormComponent extends Component {
311
311
  }
312
312
  }
313
313
  postAttach();
314
+ this.setComponentsMap();
314
315
  });
315
316
  }
316
317
  postAttach();
@@ -389,6 +390,14 @@ export default class FormComponent extends Component {
389
390
  this.emit('subWizardsUpdated', subForm);
390
391
  }
391
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
+ }
392
401
  /**
393
402
  * Create a subform instance.
394
403
  * @param {boolean} [fromAttach] - This function is being called from an `attach` method.
@@ -413,9 +422,6 @@ export default class FormComponent extends Component {
413
422
  this.subForm = instance;
414
423
  this.subForm.currentForm = this;
415
424
  this.subForm.parentVisible = this.visible;
416
- const componentsMap = this.componentsMap;
417
- const formComponentsMap = this.subForm.componentsMap;
418
- _.assign(componentsMap, formComponentsMap);
419
425
  this.component.components = this.subForm._form?.components;
420
426
  this.component.display = this.subForm._form?.display;
421
427
  this.subForm.on('change', () => {
@@ -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
- export { Components, Displays, Providers, Widgets, Templates, Utils, Form, Formio, Licenses, EventEmitter, Webform };
26
+ import { DefaultEvaluator } from './utils';
27
+ export { Components, Displays, Providers, Widgets, Templates, Utils, Form, Formio, Licenses, EventEmitter, Webform, DefaultEvaluator };
@@ -12,7 +12,7 @@ import Licenses from './licenses';
12
12
  import EventEmitter from './EventEmitter';
13
13
  import Webform from './Webform';
14
14
  import { I18n } from '@formio/core';
15
- import { Evaluator, registerEvaluator } from './utils';
15
+ import { Evaluator, registerEvaluator, DefaultEvaluator } from './utils';
16
16
  Formio.loadModules = (path = `${Formio.getApiUrl()}/externalModules.js`, name = 'externalModules') => {
17
17
  Formio.requireLibrary(name, name, path, true)
18
18
  .then((modules) => {
@@ -130,4 +130,4 @@ export function useModule(defaultFn = null) {
130
130
  Formio.use = useModule();
131
131
  export { Formio as FormioCore } from './Formio';
132
132
  // Export the components.
133
- export { Components, Displays, Providers, Widgets, Templates, Utils, Form, Formio, Licenses, EventEmitter, Webform };
133
+ export { Components, Displays, Providers, Widgets, Templates, Utils, Form, Formio, Licenses, EventEmitter, Webform, DefaultEvaluator };
@@ -2,7 +2,7 @@ export * from "./utils";
2
2
  export * from "./formUtils";
3
3
  export default FormioUtils;
4
4
  declare const FormioUtils: {
5
- Evaluator: import("./Evaluator").DefaultEvaluator;
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;
@@ -164,7 +164,8 @@ declare const FormioUtils: {
164
164
  interpolateErrors: (component: Component, errors: FieldError[], interpolateFn: Function) => [];
165
165
  };
166
166
  import { Evaluator } from './Evaluator';
167
+ import { DefaultEvaluator } from './Evaluator';
167
168
  import { registerEvaluator } from './Evaluator';
168
169
  import { interpolate } from './Evaluator';
169
170
  import moment from 'moment';
170
- export { FormioUtils as Utils, Evaluator, registerEvaluator };
171
+ export { FormioUtils as Utils, Evaluator, DefaultEvaluator, registerEvaluator };
@@ -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, DefaultEvaluator, registerEvaluator };
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.1.0-dev.6220.2e623f9",
3
+ "version": "5.1.0-dev.6221.d976115",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {