@formio/js 5.1.0-rc.10 → 5.1.0-rc.11

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.
Files changed (34) hide show
  1. package/dist/formio.builder.css +22 -24
  2. package/dist/formio.builder.min.css +1 -1
  3. package/dist/formio.embed.js +1 -1
  4. package/dist/formio.embed.min.js +1 -1
  5. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  6. package/dist/formio.form.css +22 -24
  7. package/dist/formio.form.js +6 -6
  8. package/dist/formio.form.min.css +1 -1
  9. package/dist/formio.form.min.js +1 -1
  10. package/dist/formio.form.min.js.LICENSE.txt +3 -3
  11. package/dist/formio.full.css +22 -24
  12. package/dist/formio.full.js +6 -6
  13. package/dist/formio.full.min.css +1 -1
  14. package/dist/formio.full.min.js +1 -1
  15. package/dist/formio.full.min.js.LICENSE.txt +3 -3
  16. package/dist/formio.js +2 -2
  17. package/dist/formio.min.js +1 -1
  18. package/dist/formio.min.js.LICENSE.txt +1 -1
  19. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  20. package/lib/cjs/Embed.js +1 -1
  21. package/lib/cjs/Formio.js +1 -1
  22. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
  23. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +3 -0
  24. package/lib/cjs/components/datagrid/DataGrid.js +4 -1
  25. package/lib/cjs/components/form/Form.d.ts +1 -0
  26. package/lib/cjs/components/form/Form.js +7 -3
  27. package/lib/mjs/Embed.js +1 -1
  28. package/lib/mjs/Formio.js +1 -1
  29. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
  30. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +3 -0
  31. package/lib/mjs/components/datagrid/DataGrid.js +4 -1
  32. package/lib/mjs/components/form/Form.d.ts +1 -0
  33. package/lib/mjs/components/form/Form.js +6 -3
  34. package/package.json +2 -2
@@ -20,7 +20,7 @@
20
20
 
21
21
  /*! @license DOMPurify 3.2.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.3/LICENSE */
22
22
 
23
- /*! formiojs v5.1.0-rc.10 | https://unpkg.com/formiojs@5.1.0-rc.10/LICENSE.txt */
23
+ /*! formiojs v5.1.0-rc.11 | https://unpkg.com/formiojs@5.1.0-rc.11/LICENSE.txt */
24
24
 
25
25
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
26
26
 
@@ -20,7 +20,7 @@
20
20
 
21
21
  /*! @license DOMPurify 3.2.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.3/LICENSE */
22
22
 
23
- /*! formiojs v5.1.0-rc.10 | https://unpkg.com/formiojs@5.1.0-rc.10/LICENSE.txt */
23
+ /*! formiojs v5.1.0-rc.11 | https://unpkg.com/formiojs@5.1.0-rc.11/LICENSE.txt */
24
24
 
25
25
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
26
26
 
package/lib/cjs/Embed.js CHANGED
@@ -418,7 +418,7 @@ Formio.formioReady = new Promise((ready, reject) => {
418
418
  _a._formioReady = ready;
419
419
  _a._formioReadyReject = reject;
420
420
  });
421
- Formio.version = '5.1.0-rc.10';
421
+ Formio.version = '5.1.0-rc.11';
422
422
  // Create a report.
423
423
  Formio.Report = {
424
424
  create: (element, submission, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
package/lib/cjs/Formio.js CHANGED
@@ -11,7 +11,7 @@ const CDN_1 = __importDefault(require("./CDN"));
11
11
  const providers_1 = __importDefault(require("./providers"));
12
12
  sdk_1.Formio.cdn = new CDN_1.default();
13
13
  sdk_1.Formio.Providers = providers_1.default;
14
- sdk_1.Formio.version = '5.1.0-rc.10';
14
+ sdk_1.Formio.version = '5.1.0-rc.11';
15
15
  CDN_1.default.defaultCDN = sdk_1.Formio.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';
16
16
  const isNil = (val) => val === null || val === undefined;
17
17
  sdk_1.Formio.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {
@@ -3,6 +3,7 @@ export default class NestedDataComponent extends NestedComponent {
3
3
  hasChanged(newValue: any, oldValue: any): boolean;
4
4
  get allowData(): boolean;
5
5
  get emptyValue(): {};
6
+ get shouldAddDefaultValue(): boolean;
6
7
  componentContext(): any;
7
8
  getValueAsString(value: any, options: any): string;
8
9
  getDataValueAsTable(value: any, options: any): string;
@@ -26,6 +26,9 @@ class NestedDataComponent extends NestedComponent_1.default {
26
26
  get emptyValue() {
27
27
  return {};
28
28
  }
29
+ get shouldAddDefaultValue() {
30
+ return !this.options.noDefaults || !this.options.server;
31
+ }
29
32
  componentContext() {
30
33
  return this.dataValue;
31
34
  }
@@ -396,7 +396,7 @@ class DataGridComponent extends NestedArrayComponent_1.default {
396
396
  row
397
397
  });
398
398
  this.checkConditions();
399
- this.triggerChange();
399
+ this.triggerChange({ modified: true });
400
400
  this.redraw().then(() => {
401
401
  this.focusOnNewRowElement(this.rows[index]);
402
402
  });
@@ -476,6 +476,9 @@ class DataGridComponent extends NestedArrayComponent_1.default {
476
476
  options.name += `[${rowIndex}]`;
477
477
  options.row = `${rowIndex}-${colIndex}`;
478
478
  options.rowIndex = rowIndex;
479
+ options.onChange = (flags, changed, modified) => {
480
+ this.triggerChange({ modified });
481
+ };
479
482
  let columnComponent;
480
483
  if (this.builderMode) {
481
484
  col.id = col.id + rowIndex;
@@ -32,6 +32,7 @@ export default class FormComponent extends Component {
32
32
  attach(element: any): Promise<void>;
33
33
  get hasLoadedForm(): any;
34
34
  get isRevisionChanged(): any;
35
+ get subFormData(): any;
35
36
  subFormReady: Promise<any> | null | undefined;
36
37
  /**
37
38
  * Pass everyComponent to subform.
@@ -332,6 +332,10 @@ class FormComponent extends Component_1.default {
332
332
  && lodash_1.default.isNumber(this.formObj._vid)
333
333
  && this.formObj._vid !== this.subFormRevision;
334
334
  }
335
+ get subFormData() {
336
+ var _a;
337
+ return ((_a = this.dataValue) === null || _a === void 0 ? void 0 : _a.data) || {};
338
+ }
335
339
  destroy(all = false) {
336
340
  if (this.subForm) {
337
341
  this.subForm.destroy(all);
@@ -482,14 +486,14 @@ class FormComponent extends Component_1.default {
482
486
  return visible;
483
487
  }
484
488
  if (this.subForm) {
485
- return this.subForm.checkConditions(data, flags, row);
489
+ return this.subForm.checkConditions(this.subFormData, flags);
486
490
  }
487
491
  // There are few cases when subForm is not loaded when a change is triggered,
488
492
  // so we need to perform checkConditions after it is ready, or some conditional fields might be hidden in View mode
489
493
  else if (this.subFormReady) {
490
494
  this.subFormReady.then(() => {
491
495
  if (this.subForm) {
492
- return this.subForm.checkConditions(data, flags, row);
496
+ return this.subForm.checkConditions(this.subFormData, flags);
493
497
  }
494
498
  });
495
499
  }
@@ -497,7 +501,7 @@ class FormComponent extends Component_1.default {
497
501
  }
498
502
  calculateValue(data, flags, row) {
499
503
  if (this.subForm) {
500
- return this.subForm.calculateValue(data, flags, row);
504
+ return this.subForm.calculateValue(this.subFormData, flags);
501
505
  }
502
506
  return super.calculateValue(data, flags, row);
503
507
  }
package/lib/mjs/Embed.js CHANGED
@@ -14,7 +14,7 @@ export class Formio {
14
14
  Formio._formioReady = ready;
15
15
  Formio._formioReadyReject = reject;
16
16
  });
17
- static version = '5.1.0-rc.10';
17
+ static version = '5.1.0-rc.11';
18
18
  static setLicense(license, norecurse = false) {
19
19
  Formio.license = license;
20
20
  if (!norecurse && Formio.FormioClass) {
package/lib/mjs/Formio.js CHANGED
@@ -4,7 +4,7 @@ import CDN from './CDN';
4
4
  import Providers from './providers';
5
5
  FormioCore.cdn = new CDN();
6
6
  FormioCore.Providers = Providers;
7
- FormioCore.version = '5.1.0-rc.10';
7
+ FormioCore.version = '5.1.0-rc.11';
8
8
  CDN.defaultCDN = FormioCore.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';
9
9
  const isNil = (val) => val === null || val === undefined;
10
10
  FormioCore.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {
@@ -3,6 +3,7 @@ export default class NestedDataComponent extends NestedComponent {
3
3
  hasChanged(newValue: any, oldValue: any): boolean;
4
4
  get allowData(): boolean;
5
5
  get emptyValue(): {};
6
+ get shouldAddDefaultValue(): boolean;
6
7
  componentContext(): any;
7
8
  getValueAsString(value: any, options: any): string;
8
9
  getDataValueAsTable(value: any, options: any): string;
@@ -22,6 +22,9 @@ export default class NestedDataComponent extends NestedComponent {
22
22
  get emptyValue() {
23
23
  return {};
24
24
  }
25
+ get shouldAddDefaultValue() {
26
+ return !this.options.noDefaults || !this.options.server;
27
+ }
25
28
  componentContext() {
26
29
  return this.dataValue;
27
30
  }
@@ -393,7 +393,7 @@ export default class DataGridComponent extends NestedArrayComponent {
393
393
  row
394
394
  });
395
395
  this.checkConditions();
396
- this.triggerChange();
396
+ this.triggerChange({ modified: true });
397
397
  this.redraw().then(() => {
398
398
  this.focusOnNewRowElement(this.rows[index]);
399
399
  });
@@ -472,6 +472,9 @@ export default class DataGridComponent extends NestedArrayComponent {
472
472
  options.name += `[${rowIndex}]`;
473
473
  options.row = `${rowIndex}-${colIndex}`;
474
474
  options.rowIndex = rowIndex;
475
+ options.onChange = (flags, changed, modified) => {
476
+ this.triggerChange({ modified });
477
+ };
475
478
  let columnComponent;
476
479
  if (this.builderMode) {
477
480
  col.id = col.id + rowIndex;
@@ -32,6 +32,7 @@ export default class FormComponent extends Component {
32
32
  attach(element: any): Promise<void>;
33
33
  get hasLoadedForm(): any;
34
34
  get isRevisionChanged(): any;
35
+ get subFormData(): any;
35
36
  subFormReady: Promise<any> | null | undefined;
36
37
  /**
37
38
  * Pass everyComponent to subform.
@@ -329,6 +329,9 @@ export default class FormComponent extends Component {
329
329
  && _.isNumber(this.formObj._vid)
330
330
  && this.formObj._vid !== this.subFormRevision;
331
331
  }
332
+ get subFormData() {
333
+ return this.dataValue?.data || {};
334
+ }
332
335
  destroy(all = false) {
333
336
  if (this.subForm) {
334
337
  this.subForm.destroy(all);
@@ -477,14 +480,14 @@ export default class FormComponent extends Component {
477
480
  return visible;
478
481
  }
479
482
  if (this.subForm) {
480
- return this.subForm.checkConditions(data, flags, row);
483
+ return this.subForm.checkConditions(this.subFormData, flags);
481
484
  }
482
485
  // There are few cases when subForm is not loaded when a change is triggered,
483
486
  // so we need to perform checkConditions after it is ready, or some conditional fields might be hidden in View mode
484
487
  else if (this.subFormReady) {
485
488
  this.subFormReady.then(() => {
486
489
  if (this.subForm) {
487
- return this.subForm.checkConditions(data, flags, row);
490
+ return this.subForm.checkConditions(this.subFormData, flags);
488
491
  }
489
492
  });
490
493
  }
@@ -492,7 +495,7 @@ export default class FormComponent extends Component {
492
495
  }
493
496
  calculateValue(data, flags, row) {
494
497
  if (this.subForm) {
495
- return this.subForm.calculateValue(data, flags, row);
498
+ return this.subForm.calculateValue(this.subFormData, flags);
496
499
  }
497
500
  return super.calculateValue(data, flags, row);
498
501
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.1.0-rc.10",
3
+ "version": "5.1.0-rc.11",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -80,7 +80,7 @@
80
80
  "homepage": "https://github.com/formio/formio.js#readme",
81
81
  "dependencies": {
82
82
  "@formio/bootstrap": "3.1.0-rc.1",
83
- "@formio/choices.js": "^10.2.1",
83
+ "@formio/choices.js": "11.0.3-rc.1",
84
84
  "@formio/core": "2.4.0-rc.7",
85
85
  "@formio/text-mask-addons": "^3.8.0-formio.4",
86
86
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",