@formio/js 5.0.0-dev.5837.9b0fdec → 5.0.0-dev.5839.ce94528

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.
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Component_1 = __importDefault(require("./_classes/component/Component"));
7
7
  const utils_1 = __importDefault(require("./_classes/component/editForm/utils"));
8
8
  const Component_form_1 = __importDefault(require("./_classes/component/Component.form"));
9
+ const utils_2 = require("../utils/utils");
9
10
  const lodash_1 = __importDefault(require("lodash"));
10
11
  class Components {
11
12
  static set EditFormUtils(value) {
@@ -56,7 +57,8 @@ class Components {
56
57
  static getComponentPath(component) {
57
58
  var _a;
58
59
  let path = '';
59
- if (component.component.key) {
60
+ const componentKey = (0, utils_2.getComponentKey)(component.component);
61
+ if (componentKey) {
60
62
  let thisPath = ((_a = component.options) === null || _a === void 0 ? void 0 : _a.parent) || component;
61
63
  while (thisPath && !thisPath.allowData && thisPath.parent) {
62
64
  thisPath = thisPath.parent;
@@ -68,7 +70,7 @@ class Components {
68
70
  const rowIndex = component.row;
69
71
  const rowIndexPath = rowIndex && !['container'].includes(thisPath.component.type) ? `[${Number.parseInt(rowIndex)}]` : '';
70
72
  path = `${thisPath.path}${rowIndexPath}.`;
71
- path += component.component.key;
73
+ path += componentKey;
72
74
  return lodash_1.default.trim(path, '.');
73
75
  }
74
76
  return path;
@@ -214,6 +214,16 @@ class AddressComponent extends Container_1.default {
214
214
  isValueInLegacyFormat(value) {
215
215
  return value && !value.mode;
216
216
  }
217
+ set dataValue(value) {
218
+ super.dataValue = value;
219
+ }
220
+ get dataValue() {
221
+ const resultValue = lodash_1.default.get(this._data, this.component.path);
222
+ if (!lodash_1.default.isArray(resultValue) && this.component.multiple) {
223
+ return [resultValue];
224
+ }
225
+ return super.dataValue;
226
+ }
217
227
  normalizeValue(value) {
218
228
  return (this.manualModeEnabled && this.isValueInLegacyFormat(value))
219
229
  ? {
@@ -79,6 +79,14 @@ class RadioComponent extends ListComponent_1.default {
79
79
  }
80
80
  return defaultValue;
81
81
  }
82
+ resetValue() {
83
+ this.unset();
84
+ this.setValue(this.emptyValue, {
85
+ noUpdateEvent: true,
86
+ noValidate: true,
87
+ resetValue: true
88
+ });
89
+ }
82
90
  get inputInfo() {
83
91
  var _a;
84
92
  const info = super.elementInfo();
@@ -1,6 +1,7 @@
1
1
  import Component from './_classes/component/Component';
2
2
  import EditFormUtils from './_classes/component/editForm/utils';
3
3
  import BaseEditForm from './_classes/component/Component.form';
4
+ import { getComponentKey } from '../utils/utils';
4
5
  import _ from 'lodash';
5
6
  export default class Components {
6
7
  static _editFormUtils = EditFormUtils;
@@ -52,7 +53,8 @@ export default class Components {
52
53
  */
53
54
  static getComponentPath(component) {
54
55
  let path = '';
55
- if (component.component.key) {
56
+ const componentKey = getComponentKey(component.component);
57
+ if (componentKey) {
56
58
  let thisPath = component.options?.parent || component;
57
59
  while (thisPath && !thisPath.allowData && thisPath.parent) {
58
60
  thisPath = thisPath.parent;
@@ -64,7 +66,7 @@ export default class Components {
64
66
  const rowIndex = component.row;
65
67
  const rowIndexPath = rowIndex && !['container'].includes(thisPath.component.type) ? `[${Number.parseInt(rowIndex)}]` : '';
66
68
  path = `${thisPath.path}${rowIndexPath}.`;
67
- path += component.component.key;
69
+ path += componentKey;
68
70
  return _.trim(path, '.');
69
71
  }
70
72
  return path;
@@ -210,6 +210,16 @@ export default class AddressComponent extends ContainerComponent {
210
210
  isValueInLegacyFormat(value) {
211
211
  return value && !value.mode;
212
212
  }
213
+ set dataValue(value) {
214
+ super.dataValue = value;
215
+ }
216
+ get dataValue() {
217
+ const resultValue = _.get(this._data, this.component.path);
218
+ if (!_.isArray(resultValue) && this.component.multiple) {
219
+ return [resultValue];
220
+ }
221
+ return super.dataValue;
222
+ }
213
223
  normalizeValue(value) {
214
224
  return (this.manualModeEnabled && this.isValueInLegacyFormat(value))
215
225
  ? {
@@ -80,6 +80,14 @@ export default class RadioComponent extends ListComponent {
80
80
  }
81
81
  return defaultValue;
82
82
  }
83
+ resetValue() {
84
+ this.unset();
85
+ this.setValue(this.emptyValue, {
86
+ noUpdateEvent: true,
87
+ noValidate: true,
88
+ resetValue: true
89
+ });
90
+ }
83
91
  get inputInfo() {
84
92
  const info = super.elementInfo();
85
93
  info.type = 'input';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5837.9b0fdec",
3
+ "version": "5.0.0-dev.5839.ce94528",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {