@formio/js 5.1.0-dev.6180.de668a0 → 5.1.0-dev.6192.9d1d8f4

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.
@@ -454,18 +454,20 @@ class PDFBuilder extends WebformBuilder_1.default {
454
454
  const repeatablePathsComps = this.findComponentsWithRepeatablePaths();
455
455
  // update elements which path was duplicated if any pathes have been changed
456
456
  if (!lodash_1.default.isEqual(this.repeatablePathsComps, repeatablePathsComps)) {
457
- (0, utils_1.eachComponent)(this.webform.getComponents(), (comp) => {
458
- if (this.repeatablePathsComps.includes(comp.component)) {
459
- this.webform.postMessage({ name: 'updateElement', data: comp.component });
460
- }
461
- });
457
+ if (!lodash_1.default.isEmpty(this.repeatablePathsComps)) {
458
+ (0, utils_1.eachComponent)(this.webform.getComponents(), (comp) => {
459
+ if (this.repeatablePathsComps.includes(comp.component)) {
460
+ this.webform.postMessage({ name: 'updateElement', data: comp.component });
461
+ }
462
+ });
463
+ }
462
464
  this.repeatablePathsComps = repeatablePathsComps;
463
465
  }
464
466
  if (!repeatablePathsComps.length) {
465
467
  return;
466
468
  }
467
469
  (0, utils_1.eachComponent)(this.webform.getComponents(), (comp) => {
468
- if (this.repeatablePathsComps.includes(comp)) {
470
+ if (this.repeatablePathsComps.includes(comp.component)) {
469
471
  this.webform.postMessage({
470
472
  name: 'showBuilderErrors',
471
473
  data: {
@@ -2563,7 +2563,7 @@ class Component extends Element_1.default {
2563
2563
  if ((value !== null) && (value !== undefined)) {
2564
2564
  value = this.hook('setDataValue', value, this.key, this._data);
2565
2565
  }
2566
- if ((value === null) || (value === undefined)) {
2566
+ if ((value === null) || (value === undefined) || lodash_1.default.isNaN(value)) {
2567
2567
  this.unset();
2568
2568
  return;
2569
2569
  }
@@ -160,6 +160,13 @@ class TagsComponent extends Input_1.default {
160
160
  this.refs.input[0].parentNode.lastChild.focus();
161
161
  }
162
162
  }
163
+ getValue() {
164
+ if (this.choices) {
165
+ const value = this.choices.getValue(true);
166
+ return value.join(`${this.delimiter}`);
167
+ }
168
+ return super.getValue();
169
+ }
163
170
  getValueAsString(value) {
164
171
  if (!value) {
165
172
  return '';
@@ -127,13 +127,17 @@ function url(formio) {
127
127
  deleteFile(fileInfo, options) {
128
128
  return new Promise((resolve, reject) => {
129
129
  const xhr = new XMLHttpRequest();
130
- xhr.open('DELETE', fileInfo.url, true);
130
+ xhr.open("DELETE", fileInfo.url, true);
131
+ const token = formio.getToken();
132
+ if (token) {
133
+ xhr.setRequestHeader("x-jwt-token", token);
134
+ }
131
135
  xhr.onload = () => {
132
136
  if (xhr.status >= 200 && xhr.status < 300) {
133
- resolve('File deleted');
137
+ resolve("File deleted");
134
138
  }
135
139
  else {
136
- reject(xhr.response || 'Unable to delete file');
140
+ reject(xhr.response || "Unable to delete file");
137
141
  }
138
142
  };
139
143
  if (options) {
@@ -447,18 +447,20 @@ export default class PDFBuilder extends WebformBuilder {
447
447
  const repeatablePathsComps = this.findComponentsWithRepeatablePaths();
448
448
  // update elements which path was duplicated if any pathes have been changed
449
449
  if (!_.isEqual(this.repeatablePathsComps, repeatablePathsComps)) {
450
- eachComponent(this.webform.getComponents(), (comp) => {
451
- if (this.repeatablePathsComps.includes(comp.component)) {
452
- this.webform.postMessage({ name: 'updateElement', data: comp.component });
453
- }
454
- });
450
+ if (!_.isEmpty(this.repeatablePathsComps)) {
451
+ eachComponent(this.webform.getComponents(), (comp) => {
452
+ if (this.repeatablePathsComps.includes(comp.component)) {
453
+ this.webform.postMessage({ name: 'updateElement', data: comp.component });
454
+ }
455
+ });
456
+ }
455
457
  this.repeatablePathsComps = repeatablePathsComps;
456
458
  }
457
459
  if (!repeatablePathsComps.length) {
458
460
  return;
459
461
  }
460
462
  eachComponent(this.webform.getComponents(), (comp) => {
461
- if (this.repeatablePathsComps.includes(comp)) {
463
+ if (this.repeatablePathsComps.includes(comp.component)) {
462
464
  this.webform.postMessage({
463
465
  name: 'showBuilderErrors',
464
466
  data: {
@@ -2555,7 +2555,7 @@ export default class Component extends Element {
2555
2555
  if ((value !== null) && (value !== undefined)) {
2556
2556
  value = this.hook('setDataValue', value, this.key, this._data);
2557
2557
  }
2558
- if ((value === null) || (value === undefined)) {
2558
+ if ((value === null) || (value === undefined) || _.isNaN(value)) {
2559
2559
  this.unset();
2560
2560
  return;
2561
2561
  }
@@ -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 '';
@@ -125,13 +125,17 @@ function url(formio) {
125
125
  deleteFile(fileInfo, options) {
126
126
  return new Promise((resolve, reject) => {
127
127
  const xhr = new XMLHttpRequest();
128
- xhr.open('DELETE', fileInfo.url, true);
128
+ xhr.open("DELETE", fileInfo.url, true);
129
+ const token = formio.getToken();
130
+ if (token) {
131
+ xhr.setRequestHeader("x-jwt-token", token);
132
+ }
129
133
  xhr.onload = () => {
130
134
  if (xhr.status >= 200 && xhr.status < 300) {
131
- resolve('File deleted');
135
+ resolve("File deleted");
132
136
  }
133
137
  else {
134
- reject(xhr.response || 'Unable to delete file');
138
+ reject(xhr.response || "Unable to delete file");
135
139
  }
136
140
  };
137
141
  if (options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.1.0-dev.6180.de668a0",
3
+ "version": "5.1.0-dev.6192.9d1d8f4",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {