Skip to content

Commit cacb2d3

Browse files
committed
clean
1 parent 858d263 commit cacb2d3

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

packages/components/src/internal/components/forms/input/SelectInput.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ export interface SelectInputProps {
273273
valueKey?: string;
274274
valueRenderer?: any;
275275
warning?: ReactNode;
276+
sortValues?: boolean;
276277
}
277278

278279
type SelectInputImplProps = FormsyInjectedProps<any> & SelectInputProps;
@@ -317,6 +318,7 @@ export class SelectInputImpl extends Component<SelectInputImplProps, State> {
317318
showIndicatorSeparator: true,
318319
tabSelectsValue: false, // Issue 52310
319320
valueKey: 'value',
321+
sortValues: false,
320322
};
321323

322324
private readonly _id: string;
@@ -468,7 +470,7 @@ export class SelectInputImpl extends Component<SelectInputImplProps, State> {
468470
};
469471

470472
_setOptionsAndValue(options: any): any {
471-
const { autoValue, delimiter, formsy, skipJoinValues, multiple, setValue, valueKey } = this.props;
473+
const { sortValues, autoValue, delimiter, formsy, skipJoinValues, multiple, setValue, valueKey } = this.props;
472474
let selectedOptions;
473475

474476
if (options === undefined || options === null || (Array.isArray(options) && options.length === 0)) {
@@ -478,7 +480,7 @@ export class SelectInputImpl extends Component<SelectInputImplProps, State> {
478480
}
479481

480482
if (autoValue) {
481-
if (Array.isArray(selectedOptions))
483+
if (sortValues && Array.isArray(selectedOptions))
482484
selectedOptions.sort((a, b) => {
483485
const aValue = valueKey ? a[valueKey] : a.value;
484486
const bValue = valueKey ? b[valueKey] : b.value;

packages/components/src/internal/components/forms/input/TextChoiceInput.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export class TextChoiceInput extends DisableableInput<Props, DisableableInputSta
2121
required={queryColumn.required}
2222
{...selectInputProps}
2323
multiple={queryColumn.isMultiChoice}
24+
sortValues={true}
2425
options={options}
2526
skipJoinValues={true}
2627
/>

packages/components/src/internal/components/search/FilterFacetedSelector.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { FC, memo, ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react';
1+
import React, { FC, memo, ReactNode, useCallback, useEffect, useMemo, useState } from 'react';
22

33
import { Filter, Query } from '@labkey/api';
44

@@ -260,7 +260,8 @@ export const FilterFacetedSelector: FC<Props> = memo(props => {
260260

261261
const filterType = resolveFilterType(newActiveFilterType?.value, field);
262262
let updatedFilterValues = fieldFilters[0]?.getValue();
263-
if (updatedFilterValues && multiChoices && !filterType.isMultiValued()) updatedFilterValues = null;
263+
const shouldClearUpdatedFilterValues = updatedFilterValues && multiChoices && !filterType.isMultiValued();
264+
if (shouldClearUpdatedFilterValues) updatedFilterValues = null;
264265

265266
newFilters = [Filter.create(fieldKey, updatedFilterValues, filterType), null];
266267

packages/components/src/internal/renderers/MultiValueRenderer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const MultiValueRenderer: FC<MultiValueRendererProps> = memo(({ data, col
3333
}
3434

3535
let valueArray = data;
36-
if (col?.isMultiChoice) {
36+
if (col?.isMultiChoice && Map.isMap(data) && data.has('value')) {
3737
valueArray = data.get('value');
3838
}
3939

0 commit comments

Comments
 (0)