@formio/js 5.0.0-dev.5850.b6b5101 → 5.0.0-dev.5853.716ddda

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.
@@ -246,7 +246,11 @@ class SelectComponent extends ListComponent_1.default {
246
246
  const value = (typeof itemLabel === 'string') ? this.t(itemLabel, { _userInput: true }) : itemLabel;
247
247
  return this.sanitize(value, this.shouldSanitizeValue);
248
248
  }
249
- if (this.component.multiple && lodash_1.default.isArray(this.dataValue) ? this.dataValue.find((val) => this.normalizeSingleValue(value) === val) : (this.dataValue === this.normalizeSingleValue(value))) {
249
+ // Inside DataTable component won't have dataValue set
250
+ const shouldUseSelectData = (this.component.multiple && lodash_1.default.isArray(this.dataValue)
251
+ ? this.dataValue.find((val) => this.normalizeSingleValue(value) === val)
252
+ : (this.dataValue === this.normalizeSingleValue(value))) || this.inDataTable;
253
+ if (shouldUseSelectData) {
250
254
  const selectData = this.selectData;
251
255
  if (selectData) {
252
256
  const templateValue = this.component.reference && (value === null || value === void 0 ? void 0 : value._id) ? value._id.toString() : value;
@@ -1213,7 +1217,7 @@ class SelectComponent extends ListComponent_1.default {
1213
1217
  // Check to see if we need to save off the template data into our metadata.
1214
1218
  const templateValue = this.component.reference && (value === null || value === void 0 ? void 0 : value._id) ? value._id.toString() : value;
1215
1219
  const shouldSaveData = !valueIsObject || this.component.reference;
1216
- if (templateValue && shouldSaveData && this.templateData && this.templateData[templateValue] && ((_a = this.root) === null || _a === void 0 ? void 0 : _a.submission)) {
1220
+ if (!lodash_1.default.isNil(templateValue) && shouldSaveData && this.templateData && this.templateData[templateValue] && ((_a = this.root) === null || _a === void 0 ? void 0 : _a.submission)) {
1217
1221
  const submission = this.root.submission;
1218
1222
  if (!submission.metadata) {
1219
1223
  submission.metadata = {};
@@ -1468,8 +1472,12 @@ class SelectComponent extends ListComponent_1.default {
1468
1472
  asString(value, options = {}) {
1469
1473
  var _a;
1470
1474
  value = value !== null && value !== void 0 ? value : this.getValue();
1471
- if (options.modalPreview) {
1472
- const template = this.itemTemplate(value, value);
1475
+ if (options.modalPreview || this.inDataTable) {
1476
+ if (this.inDataTable) {
1477
+ value = this.undoValueTyping(value);
1478
+ }
1479
+ const templateValue = (this.isEntireObjectDisplay() && !lodash_1.default.isObject(value.data)) ? { data: value } : value;
1480
+ const template = this.itemTemplate(templateValue, value, options);
1473
1481
  return template;
1474
1482
  }
1475
1483
  //need to convert values to strings to be able to compare values with available options that are strings
@@ -15,8 +15,8 @@ export const getComponentPath: typeof Utils.getComponentPath;
15
15
  export const isComponentNestedDataType: typeof Utils.isComponentNestedDataType;
16
16
  export const componentPath: typeof Utils.componentPath;
17
17
  export const componentChildPath: any;
18
- export const eachComponentDataAsync: (components: Component[], data: DataObject, fn: AsyncComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => Promise<void>;
19
- export const eachComponentData: (components: Component[], data: DataObject, fn: ComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => void;
18
+ export const eachComponentDataAsync: (components: Component[], data: DataObject, fn: EachComponentDataAsyncCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => Promise<void>;
19
+ export const eachComponentData: (components: Component[], data: DataObject, fn: EachComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => void;
20
20
  export const getComponentKey: typeof Utils.getComponentKey;
21
21
  export const getContextualRowPath: typeof Utils.getContextualRowPath;
22
22
  export const getContextualRowData: typeof Utils.getContextualRowData;
@@ -246,7 +246,11 @@ export default class SelectComponent extends ListComponent {
246
246
  const value = (typeof itemLabel === 'string') ? this.t(itemLabel, { _userInput: true }) : itemLabel;
247
247
  return this.sanitize(value, this.shouldSanitizeValue);
248
248
  }
249
- if (this.component.multiple && _.isArray(this.dataValue) ? this.dataValue.find((val) => this.normalizeSingleValue(value) === val) : (this.dataValue === this.normalizeSingleValue(value))) {
249
+ // Inside DataTable component won't have dataValue set
250
+ const shouldUseSelectData = (this.component.multiple && _.isArray(this.dataValue)
251
+ ? this.dataValue.find((val) => this.normalizeSingleValue(value) === val)
252
+ : (this.dataValue === this.normalizeSingleValue(value))) || this.inDataTable;
253
+ if (shouldUseSelectData) {
250
254
  const selectData = this.selectData;
251
255
  if (selectData) {
252
256
  const templateValue = this.component.reference && value?._id ? value._id.toString() : value;
@@ -1241,7 +1245,7 @@ export default class SelectComponent extends ListComponent {
1241
1245
  // Check to see if we need to save off the template data into our metadata.
1242
1246
  const templateValue = this.component.reference && value?._id ? value._id.toString() : value;
1243
1247
  const shouldSaveData = !valueIsObject || this.component.reference;
1244
- if (templateValue && shouldSaveData && this.templateData && this.templateData[templateValue] && this.root?.submission) {
1248
+ if (!_.isNil(templateValue) && shouldSaveData && this.templateData && this.templateData[templateValue] && this.root?.submission) {
1245
1249
  const submission = this.root.submission;
1246
1250
  if (!submission.metadata) {
1247
1251
  submission.metadata = {};
@@ -1495,8 +1499,12 @@ export default class SelectComponent extends ListComponent {
1495
1499
  }
1496
1500
  asString(value, options = {}) {
1497
1501
  value = value ?? this.getValue();
1498
- if (options.modalPreview) {
1499
- const template = this.itemTemplate(value, value);
1502
+ if (options.modalPreview || this.inDataTable) {
1503
+ if (this.inDataTable) {
1504
+ value = this.undoValueTyping(value);
1505
+ }
1506
+ const templateValue = (this.isEntireObjectDisplay() && !_.isObject(value.data)) ? { data: value } : value;
1507
+ const template = this.itemTemplate(templateValue, value, options);
1500
1508
  return template;
1501
1509
  }
1502
1510
  //need to convert values to strings to be able to compare values with available options that are strings
@@ -15,8 +15,8 @@ export const getComponentPath: typeof Utils.getComponentPath;
15
15
  export const isComponentNestedDataType: typeof Utils.isComponentNestedDataType;
16
16
  export const componentPath: typeof Utils.componentPath;
17
17
  export const componentChildPath: any;
18
- export const eachComponentDataAsync: (components: Component[], data: DataObject, fn: AsyncComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => Promise<void>;
19
- export const eachComponentData: (components: Component[], data: DataObject, fn: ComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => void;
18
+ export const eachComponentDataAsync: (components: Component[], data: DataObject, fn: EachComponentDataAsyncCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => Promise<void>;
19
+ export const eachComponentData: (components: Component[], data: DataObject, fn: EachComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => void;
20
20
  export const getComponentKey: typeof Utils.getComponentKey;
21
21
  export const getContextualRowPath: typeof Utils.getContextualRowPath;
22
22
  export const getContextualRowData: typeof Utils.getContextualRowData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5850.b6b5101",
3
+ "version": "5.0.0-dev.5853.716ddda",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -82,7 +82,7 @@
82
82
  "dependencies": {
83
83
  "@formio/bootstrap": "3.0.0-dev.98.17ba6ea",
84
84
  "@formio/choices.js": "^10.2.1",
85
- "@formio/core": "v2.1.0-dev.156.78a83fd",
85
+ "@formio/core": "v2.1.0-dev.165.e6994a9",
86
86
  "@formio/text-mask-addons": "^3.8.0-formio.2",
87
87
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
88
88
  "abortcontroller-polyfill": "^1.7.5",