= memo(({ data, col
return null;
}
- if (
- List.isList(data) &&
- data.size === 1 &&
- (col?.isFileInput)
- ) {
+ if (List.isList(data) && data.size === 1 && col?.isFileInput) {
return ;
}
+ let valueArray = data;
+ if (col?.isMultiChoice && Map.isMap(data) && data.has('value')) {
+ valueArray = data.get('value');
+ }
+
let i = -1;
return (
- {data
+ {valueArray
.map((item, key) => {
let text: ReactNode;
let url: string;
diff --git a/packages/components/src/internal/util/utils.test.ts b/packages/components/src/internal/util/utils.test.ts
index 765badb11f..ec4d3963e8 100644
--- a/packages/components/src/internal/util/utils.test.ts
+++ b/packages/components/src/internal/util/utils.test.ts
@@ -186,6 +186,9 @@ describe('getCommonDataForSelection', () => {
field2: {
value: 'value2',
},
+ field3: {
+ value: ['value2'],
+ },
},
'2': {
field1: {
@@ -194,11 +197,14 @@ describe('getCommonDataForSelection', () => {
field2: {
value: 'value4',
},
+ field3: {
+ value: ['value2', 'value4'],
+ },
},
});
const res1 = getCommonDataValues(data);
expect(res1.fieldValues).toEqual({});
- expect(res1.fieldsInConflict).toEqual(['field1', 'field2']);
+ expect(res1.fieldsInConflict).toEqual(['field1', 'field2', 'field3']);
});
test('empty values', () => {
@@ -210,6 +216,9 @@ describe('getCommonDataForSelection', () => {
field2: {
value: null,
},
+ field3: {
+ value: null,
+ },
},
'2': {
field1: {
@@ -218,6 +227,9 @@ describe('getCommonDataForSelection', () => {
field2: {
value: undefined,
},
+ field3: {
+ value: [],
+ },
},
});
const res1 = getCommonDataValues(data);
@@ -234,6 +246,9 @@ describe('getCommonDataForSelection', () => {
field2: {
value: 0,
},
+ field3: {
+ value: [],
+ },
},
'2': {
field1: {
@@ -242,6 +257,9 @@ describe('getCommonDataForSelection', () => {
field2: {
value: 0,
},
+ field3: {
+ value: [],
+ },
},
});
const res1 = getCommonDataValues(data);
@@ -319,6 +337,9 @@ describe('getCommonDataForSelection', () => {
displayValue: 'sampletype/blood.pdf',
url: '/labkey/Sample%20Management/core-downloadFileLink.view?propertyId=552',
},
+ MVTC: {
+ value: ['a', 'b'],
+ },
},
'447': {
RowId: {
@@ -346,6 +367,9 @@ describe('getCommonDataForSelection', () => {
displayValue: 'sampletype/blood.pdf',
url: '/labkey/Sample%20Management/core-downloadFileLink.view?propertyId=552',
},
+ MVTC: {
+ value: ['a', 'b'],
+ },
},
'446': {
RowId: {
@@ -373,6 +397,9 @@ describe('getCommonDataForSelection', () => {
displayValue: 'sampletype/blood.pdf',
url: '/labkey/Sample%20Management/core-downloadFileLink.view?propertyId=552',
},
+ MVTC: {
+ value: ['a', 'b'],
+ },
},
'445': {
RowId: {
@@ -400,6 +427,9 @@ describe('getCommonDataForSelection', () => {
displayValue: 'sampletype/blood.pdf',
url: '/labkey/Sample%20Management/core-downloadFileLink.view?propertyId=552',
},
+ MVTC: {
+ value: ['a', 'b'],
+ },
},
'367': {
RowId: {
@@ -427,6 +457,9 @@ describe('getCommonDataForSelection', () => {
displayValue: 'sampletype/blood.pdf',
url: '/labkey/Sample%20Management/core-downloadFileLink.view?propertyId=552',
},
+ MVTC: {
+ value: ['b', 'a'],
+ },
},
});
expect(getCommonDataValues(data)).toEqual({
@@ -434,6 +467,7 @@ describe('getCommonDataForSelection', () => {
AndAgain: 'again',
Data: 'data1',
Pdf: '/root/lk/Sample%20Management/blood.pdf',
+ MVTC: ['a', 'b'],
},
fieldsInConflict: ['RowId', 'Value', 'Name', 'Other'],
});
@@ -441,6 +475,7 @@ describe('getCommonDataForSelection', () => {
fieldValues: {
AndAgain: 'again',
Data: 'data1',
+ MVTC: ['a', 'b'],
Pdf: fromJS({
value: '/root/lk/Sample%20Management/blood.pdf',
displayValue: 'sampletype/blood.pdf',
diff --git a/packages/components/src/internal/util/utils.ts b/packages/components/src/internal/util/utils.ts
index d2ce4e94e8..378b2fb605 100644
--- a/packages/components/src/internal/util/utils.ts
+++ b/packages/components/src/internal/util/utils.ts
@@ -226,15 +226,12 @@ export function getCommonDataValues(
value = data.toJS();
} else {
value = data.get('value');
+ if (List.isList(value)) value = value.toJS();
}
}
const currentValueEmpty = valueIsEmpty(value);
const havePreviousValue = valueMap.has(key);
- const arrayNotEqual =
- Array.isArray(value) &&
- valueMap.get(key) &&
- (!Array.isArray(valueMap.get(key)) || !unorderedEqual(valueMap.get(key), value));
if (!currentValueEmpty) {
// non-empty value, so let's see if we have the same value
@@ -246,9 +243,16 @@ export function getCommonDataValues(
fileMap[key] = rawValue;
}
}
- if (arrayNotEqual) {
- fieldsInConflict = fieldsInConflict.add(key);
- valueMap = valueMap.delete(key);
+
+ if (Array.isArray(value)) {
+ const arrayNotEqual =
+ valueMap.get(key) &&
+ (!Array.isArray(valueMap.get(key)) || !unorderedEqual(valueMap.get(key), value));
+
+ if (arrayNotEqual) {
+ fieldsInConflict = fieldsInConflict.add(key);
+ valueMap = valueMap.delete(key);
+ }
} else if (valueMap.get(key) !== value) {
fieldsInConflict = fieldsInConflict.add(key);
valueMap = valueMap.delete(key);
diff --git a/packages/components/src/public/QueryColumn.ts b/packages/components/src/public/QueryColumn.ts
index f0a11b930c..fa65d79084 100644
--- a/packages/components/src/public/QueryColumn.ts
+++ b/packages/components/src/public/QueryColumn.ts
@@ -18,6 +18,7 @@ import { SAMPLES_WITH_TYPES_FILTER } from '../internal/components/samples/consta
import { SchemaQuery } from './SchemaQuery';
import { IQueryColumn } from './IQueryColumn';
+import { PropDescType } from '../internal/components/domainproperties/PropDescType';
export enum Operation {
insert = 'insert',
@@ -424,6 +425,10 @@ export class QueryColumn implements IQueryColumn {
return this.inputType === 'file';
}
+ get isMultiChoice(): boolean {
+ return PropDescType.isMultiChoice(this.rangeURI);
+ }
+
allowFaceting(): boolean {
switch (this.facetingBehaviorType) {
case 'ALWAYS_OFF':
@@ -434,6 +439,7 @@ export class QueryColumn implements IQueryColumn {
// auto rules are if the column is a lookup or dimension
// OR if it is of type : (boolean, int, date, text), multiline excluded
if (this.lookup || this.dimension) return true;
+ else if (this.isMultiChoice) return true;
else if (
this.jsonType === 'boolean' ||
this.jsonType === 'int' ||