@formio/js 5.0.0-rc.70 → 5.0.0-rc.72

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,7 +20,7 @@
20
20
 
21
21
  /*! @license DOMPurify 3.1.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.5/LICENSE */
22
22
 
23
- /*! formiojs v5.0.0-rc.70 | https://unpkg.com/formiojs@5.0.0-rc.70/LICENSE.txt */
23
+ /*! formiojs v5.0.0-rc.72 | https://unpkg.com/formiojs@5.0.0-rc.72/LICENSE.txt */
24
24
 
25
25
  /**
26
26
  * @license
package/lib/cjs/PDF.js CHANGED
@@ -70,7 +70,7 @@ class PDF extends Webform_1.default {
70
70
  super.destroy(all);
71
71
  }
72
72
  rebuild() {
73
- if (this.attached && this.builderMode && this.component.components) {
73
+ if (this.builderMode && this.component.components) {
74
74
  this.destroyComponents();
75
75
  this.addComponents();
76
76
  return Promise.resolve();
@@ -819,7 +819,6 @@ class Webform extends NestedDataComponent_1.default {
819
819
  if (!submission || !submission.data) {
820
820
  submission = {
821
821
  data: {},
822
- metadata: submission.metadata,
823
822
  };
824
823
  }
825
824
  // Metadata needs to be available before setValue
@@ -497,6 +497,7 @@ class NestedComponent extends Field_1.default {
497
497
  header: 'single',
498
498
  collapsed: this.collapsed,
499
499
  [this.nestedKey]: 'single',
500
+ messageContainer: 'single-scope',
500
501
  });
501
502
  let childPromise = Promise.resolve();
502
503
  if (this.refs[this.nestedKey]) {
@@ -684,7 +685,7 @@ class NestedComponent extends Field_1.default {
684
685
  validationProcessor({ scope, data, row, instance, component }, flags) {
685
686
  const { dirty } = flags;
686
687
  if (this.root.hasExtraPages && this.page !== this.root.page) {
687
- instance = this.getComponentById(component.id);
688
+ instance = this.getComponent(component.path);
688
689
  }
689
690
  if (!instance) {
690
691
  return;
@@ -58,7 +58,6 @@ export default class DataGridComponent extends NestedArrayComponent {
58
58
  getRows(): {}[];
59
59
  getColumns(): any[];
60
60
  hasHeader(): any;
61
- loadRefs(element: any, refs: any): void;
62
61
  dragula: any;
63
62
  getComponentsContainer(): any;
64
63
  /**
@@ -261,13 +261,6 @@ class DataGridComponent extends NestedArrayComponent_1.default {
261
261
  return hasHeader || ((col.label || col.title) && !col.hideLabel);
262
262
  }, false);
263
263
  }
264
- loadRefs(element, refs) {
265
- super.loadRefs(element, refs);
266
- if (refs['messageContainer'] === 'single') {
267
- const container = lodash_1.default.last(element.querySelectorAll(`[${this._referenceAttributeName}=messageContainer]`));
268
- this.refs['messageContainer'] = container || this.refs['messageContainer'];
269
- }
270
- }
271
264
  attach(element) {
272
265
  this.loadRefs(element, {
273
266
  [`${this.datagridKey}-row`]: 'multiple',
@@ -276,7 +269,6 @@ class DataGridComponent extends NestedArrayComponent_1.default {
276
269
  [`${this.datagridKey}-removeRow`]: 'multiple',
277
270
  [`${this.datagridKey}-group-header`]: 'multiple',
278
271
  [this.datagridKey]: 'multiple',
279
- 'messageContainer': 'single'
280
272
  });
281
273
  if (this.allowReorder) {
282
274
  this.refs[`${this.datagridKey}-row`].forEach((row, index) => {
@@ -241,7 +241,7 @@ class DataMapComponent extends DataGrid_1.default {
241
241
  delete dataValue[key];
242
242
  const comp = components[this.valueKey];
243
243
  comp.component.key = newKey;
244
- comp.path = Components_1.default.calculateComponentPath(comp);
244
+ comp.path = Components_1.default.getComponentPath(comp);
245
245
  key = newKey;
246
246
  });
247
247
  const valueComponent = lodash_1.default.clone(this.component.valueComponent);
@@ -490,11 +490,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
490
490
  else {
491
491
  this.removeClass(this.refs.component, `formio-component-${this.component.type}-row-open`);
492
492
  }
493
- const superAttach = super.attach(element);
494
- this.loadRefs(element, {
495
- messageContainer: 'single-scope',
496
- });
497
- return superAttach;
493
+ return super.attach(element);
498
494
  }
499
495
  flattenRowDataValue(dataValue) {
500
496
  const flattened = {};
@@ -935,6 +935,10 @@ class FileComponent extends Field_1.default {
935
935
  : response.type === 'abort'
936
936
  ? this.t('Request was aborted')
937
937
  : response.toString();
938
+ this.emit('fileUploadError', {
939
+ fileToSync,
940
+ response,
941
+ });
938
942
  }
939
943
  finally {
940
944
  delete fileToSync.progress;
package/lib/mjs/PDF.js CHANGED
@@ -65,7 +65,7 @@ export default class PDF extends Webform {
65
65
  super.destroy(all);
66
66
  }
67
67
  rebuild() {
68
- if (this.attached && this.builderMode && this.component.components) {
68
+ if (this.builderMode && this.component.components) {
69
69
  this.destroyComponents();
70
70
  this.addComponents();
71
71
  return Promise.resolve();
@@ -823,7 +823,6 @@ export default class Webform extends NestedDataComponent {
823
823
  if (!submission || !submission.data) {
824
824
  submission = {
825
825
  data: {},
826
- metadata: submission.metadata,
827
826
  };
828
827
  }
829
828
  // Metadata needs to be available before setValue
@@ -493,6 +493,7 @@ export default class NestedComponent extends Field {
493
493
  header: 'single',
494
494
  collapsed: this.collapsed,
495
495
  [this.nestedKey]: 'single',
496
+ messageContainer: 'single-scope',
496
497
  });
497
498
  let childPromise = Promise.resolve();
498
499
  if (this.refs[this.nestedKey]) {
@@ -680,7 +681,7 @@ export default class NestedComponent extends Field {
680
681
  validationProcessor({ scope, data, row, instance, component }, flags) {
681
682
  const { dirty } = flags;
682
683
  if (this.root.hasExtraPages && this.page !== this.root.page) {
683
- instance = this.getComponentById(component.id);
684
+ instance = this.getComponent(component.path);
684
685
  }
685
686
  if (!instance) {
686
687
  return;
@@ -58,7 +58,6 @@ export default class DataGridComponent extends NestedArrayComponent {
58
58
  getRows(): {}[];
59
59
  getColumns(): any[];
60
60
  hasHeader(): any;
61
- loadRefs(element: any, refs: any): void;
62
61
  dragula: any;
63
62
  getComponentsContainer(): any;
64
63
  /**
@@ -258,13 +258,6 @@ export default class DataGridComponent extends NestedArrayComponent {
258
258
  return hasHeader || ((col.label || col.title) && !col.hideLabel);
259
259
  }, false);
260
260
  }
261
- loadRefs(element, refs) {
262
- super.loadRefs(element, refs);
263
- if (refs['messageContainer'] === 'single') {
264
- const container = _.last(element.querySelectorAll(`[${this._referenceAttributeName}=messageContainer]`));
265
- this.refs['messageContainer'] = container || this.refs['messageContainer'];
266
- }
267
- }
268
261
  attach(element) {
269
262
  this.loadRefs(element, {
270
263
  [`${this.datagridKey}-row`]: 'multiple',
@@ -273,7 +266,6 @@ export default class DataGridComponent extends NestedArrayComponent {
273
266
  [`${this.datagridKey}-removeRow`]: 'multiple',
274
267
  [`${this.datagridKey}-group-header`]: 'multiple',
275
268
  [this.datagridKey]: 'multiple',
276
- 'messageContainer': 'single'
277
269
  });
278
270
  if (this.allowReorder) {
279
271
  this.refs[`${this.datagridKey}-row`].forEach((row, index) => {
@@ -236,7 +236,7 @@ export default class DataMapComponent extends DataGridComponent {
236
236
  delete dataValue[key];
237
237
  const comp = components[this.valueKey];
238
238
  comp.component.key = newKey;
239
- comp.path = Components.calculateComponentPath(comp);
239
+ comp.path = Components.getComponentPath(comp);
240
240
  key = newKey;
241
241
  });
242
242
  const valueComponent = _.clone(this.component.valueComponent);
@@ -484,11 +484,7 @@ export default class EditGridComponent extends NestedArrayComponent {
484
484
  else {
485
485
  this.removeClass(this.refs.component, `formio-component-${this.component.type}-row-open`);
486
486
  }
487
- const superAttach = super.attach(element);
488
- this.loadRefs(element, {
489
- messageContainer: 'single-scope',
490
- });
491
- return superAttach;
487
+ return super.attach(element);
492
488
  }
493
489
  flattenRowDataValue(dataValue) {
494
490
  const flattened = {};
@@ -931,6 +931,10 @@ export default class FileComponent extends Field {
931
931
  : response.type === 'abort'
932
932
  ? this.t('Request was aborted')
933
933
  : response.toString();
934
+ this.emit('fileUploadError', {
935
+ fileToSync,
936
+ response,
937
+ });
934
938
  }
935
939
  finally {
936
940
  delete fileToSync.progress;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-rc.70",
3
+ "version": "5.0.0-rc.72",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -79,9 +79,9 @@
79
79
  },
80
80
  "homepage": "https://github.com/formio/formio.js#readme",
81
81
  "dependencies": {
82
- "@formio/bootstrap": "3.0.0-rc.36",
82
+ "@formio/bootstrap": "3.0.0-rc.37",
83
83
  "@formio/choices.js": "^10.2.1",
84
- "@formio/core": "2.2.0-rc.9",
84
+ "@formio/core": "2.2.2-rc.1",
85
85
  "@formio/text-mask-addons": "^3.8.0-formio.2",
86
86
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
87
87
  "abortcontroller-polyfill": "^1.7.5",