@formio/js 5.0.0-dev.5893.c6cb848 → 5.0.0-dev.5896.56bf2bd

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.
@@ -312,12 +312,13 @@ class RadioComponent extends ListComponent_1.default {
312
312
  .then((response) => {
313
313
  this.loading = false;
314
314
  this.setItems(response);
315
- this.optionsLoaded = true;
316
- this.redraw();
317
315
  })
318
316
  .catch((err) => {
319
- this.optionsLoaded = true;
320
317
  this.handleLoadingError(err);
318
+ })
319
+ .finally(() => {
320
+ this.optionsLoaded = true;
321
+ this.redraw();
321
322
  });
322
323
  }
323
324
  loadItemsFromMetadata() {
@@ -341,9 +342,8 @@ class RadioComponent extends ListComponent_1.default {
341
342
  label: this.component.valueProperty ? this.itemTemplate(item, valueAtProperty) : this.itemTemplate(item, item, i)
342
343
  };
343
344
  listData.push(this.templateData[this.component.valueProperty ? valueAtProperty : i]);
344
- if ((this.component.valueProperty || !this.isRadio) && (lodash_1.default.isUndefined(valueAtProperty) ||
345
- (!this.isRadio && lodash_1.default.isObject(valueAtProperty)) ||
346
- (!this.isRadio && lodash_1.default.isBoolean(valueAtProperty)))) {
345
+ const value = this.loadedOptions[i].value;
346
+ if (!this.isRadio && (lodash_1.default.isObject(value) || lodash_1.default.isBoolean(value) || lodash_1.default.isUndefined(value))) {
347
347
  this.loadedOptions[i].invalid = true;
348
348
  }
349
349
  });
@@ -257,6 +257,18 @@ class SelectBoxesComponent extends Radio_1.default {
257
257
  }
258
258
  return super.checkComponentValidity(data, dirty, rowData, options, errors);
259
259
  }
260
+ setCustomValidity(messages, dirty, external) {
261
+ if (this.options.building && lodash_1.default.find(messages, { ruleName: 'invalidValueProperty' })) {
262
+ setTimeout(() => {
263
+ this.root && (0, utils_1.getComponent)(this.root.components, 'valueProperty').setCustomValidity(messages, dirty);
264
+ }, 0);
265
+ return super.setCustomValidity(lodash_1.default.filter(messages, (message) => message.ruleName !== 'invalidValueProperty'), dirty, external);
266
+ }
267
+ else {
268
+ return super.setCustomValidity(messages, dirty, external);
269
+ }
270
+ ;
271
+ }
260
272
  validateValueAvailability(setting, value) {
261
273
  if (!(0, utils_1.boolValue)(setting) || !value) {
262
274
  return true;
@@ -312,12 +312,13 @@ export default class RadioComponent extends ListComponent {
312
312
  .then((response) => {
313
313
  this.loading = false;
314
314
  this.setItems(response);
315
- this.optionsLoaded = true;
316
- this.redraw();
317
315
  })
318
316
  .catch((err) => {
319
- this.optionsLoaded = true;
320
317
  this.handleLoadingError(err);
318
+ })
319
+ .finally(() => {
320
+ this.optionsLoaded = true;
321
+ this.redraw();
321
322
  });
322
323
  }
323
324
  loadItemsFromMetadata() {
@@ -341,9 +342,8 @@ export default class RadioComponent extends ListComponent {
341
342
  label: this.component.valueProperty ? this.itemTemplate(item, valueAtProperty) : this.itemTemplate(item, item, i)
342
343
  };
343
344
  listData.push(this.templateData[this.component.valueProperty ? valueAtProperty : i]);
344
- if ((this.component.valueProperty || !this.isRadio) && (_.isUndefined(valueAtProperty) ||
345
- (!this.isRadio && _.isObject(valueAtProperty)) ||
346
- (!this.isRadio && _.isBoolean(valueAtProperty)))) {
345
+ const value = this.loadedOptions[i].value;
346
+ if (!this.isRadio && (_.isObject(value) || _.isBoolean(value) || _.isUndefined(value))) {
347
347
  this.loadedOptions[i].invalid = true;
348
348
  }
349
349
  });
@@ -1,5 +1,5 @@
1
1
  import _ from 'lodash';
2
- import { componentValueTypes, getComponentSavedTypes, boolValue } from '../../utils/utils';
2
+ import { componentValueTypes, getComponentSavedTypes, boolValue, getComponent } from '../../utils/utils';
3
3
  import RadioComponent from '../radio/Radio';
4
4
  export default class SelectBoxesComponent extends RadioComponent {
5
5
  static schema(...extend) {
@@ -258,6 +258,18 @@ export default class SelectBoxesComponent extends RadioComponent {
258
258
  }
259
259
  return super.checkComponentValidity(data, dirty, rowData, options, errors);
260
260
  }
261
+ setCustomValidity(messages, dirty, external) {
262
+ if (this.options.building && _.find(messages, { ruleName: 'invalidValueProperty' })) {
263
+ setTimeout(() => {
264
+ this.root && getComponent(this.root.components, 'valueProperty').setCustomValidity(messages, dirty);
265
+ }, 0);
266
+ return super.setCustomValidity(_.filter(messages, (message) => message.ruleName !== 'invalidValueProperty'), dirty, external);
267
+ }
268
+ else {
269
+ return super.setCustomValidity(messages, dirty, external);
270
+ }
271
+ ;
272
+ }
261
273
  validateValueAvailability(setting, value) {
262
274
  if (!boolValue(setting) || !value) {
263
275
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5893.c6cb848",
3
+ "version": "5.0.0-dev.5896.56bf2bd",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {