Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/components/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@labkey/components",
"version": "7.28.1",
"version": "7.28.2-moreCountUnits.1",
"description": "Components, models, actions, and utility functions for LabKey applications and pages",
"sideEffects": false,
"files": [
Expand Down
4 changes: 4 additions & 0 deletions packages/components/releaseNotes/components.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# @labkey/components
Components, models, actions, and utility functions for LabKey applications and pages

### version TBD
*Released*: TBD
- GitHub Issue 868: Add more nouns for count units

### version 7.28.1
*Released*: 3 April 2026
- GitHub Issue 613: Use "Status" instead of "SampleState" in error messaging.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ import {
getMeasurementUnit,
getMetricUnitOptions,
getMetricUnitOptionsFromKind,
MEASUREMENT_UNITS,
UNITS_KIND,
} from '../../../util/measurement';
import { Alert } from '../../base/Alert';
import { makeCommaSeparatedString } from '../../../util/utils';

const PROPERTIES_HEADER_ID = 'sample-type-properties-hdr';
const ALIQUOT_HELP_LINK = getHelpLink('aliquotIDs');
Expand Down Expand Up @@ -94,7 +96,7 @@ export const UnitKinds: Record<UNITS_KIND, UnitKindType> = {
value: UNITS_KIND.COUNT,
label: 'Other',
hideSubSelect: true,
msg: "Amounts can be entered as bottles, blocks, boxes, cells, kits, packs, pieces, slides, tests, or unit and won't be converted.",
msg: "Amounts can be entered as " + makeCommaSeparatedString(MEASUREMENT_UNITS.unit.altLabels, ', or ') + " and won't be converted",
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { FormsyInput } from './FormsyReactComponents';
import { Operation } from '../../../../public/QueryColumn';
import { STORED_AMOUNT_FIELDS } from '../../samples/constants';
import { Alert } from '../../base/Alert';
import { LOOKUP_DEFAULT_SIZE } from '../../../constants';

export const AmountUnitInput: FC<InputRendererProps> = memo(props => {
const {
Expand Down Expand Up @@ -102,6 +103,7 @@ export const AmountUnitInput: FC<InputRendererProps> = memo(props => {
id={id}
inputClass={''}
name={unitCol.fieldKey}
maxRows={LOOKUP_DEFAULT_SIZE}
onQSChange={onSelectChange}
placeholder="Select or type to search..."
queryFilters={queryFilter}
Expand Down
16 changes: 10 additions & 6 deletions packages/components/src/internal/util/measurement.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ describe('MetricUnit utils', () => {
])
);

expect(getMetricUnitOptions(null).length).toBe(18);
expect(getMetricUnitOptions('').length).toBe(18);
expect(getMetricUnitOptions('bad').length).toBe(18);
expect(getMetricUnitOptions(null).length).toBe(22);
expect(getMetricUnitOptions('').length).toBe(22);
expect(getMetricUnitOptions('bad').length).toBe(22);
});

test('getMetricUnitOptions with filterFn', () => {
Expand Down Expand Up @@ -197,17 +197,21 @@ describe('MetricUnit utils', () => {
'boxes',
'cells',
'kits',
'organisms',
'packs',
'pieces',
'slides',
'syringes',
'tests',
'tubes',
'unit',
'vials',
]);

// include all options when no unitTypeStr or an invalid unitTypeStr is provided
expect(getAltUnitKeys(null).length).toBe(18);
expect(getAltUnitKeys('').length).toBe(18);
expect(getAltUnitKeys('bad').length).toBe(18);
expect(getAltUnitKeys(null).length).toBe(22);
expect(getAltUnitKeys('').length).toBe(22);
expect(getAltUnitKeys('bad').length).toBe(22);
});

test('getMeasurementUnit', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/internal/util/measurement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export const MEASUREMENT_UNITS: Record<string, MeasurementUnit> = {
kind: UNITS_KIND.COUNT,
ratio: 1,
displayPrecision: 2,
altLabels: ['blocks', 'bottles', 'boxes', 'cells', 'kits', 'packs', 'pieces', 'slides', 'tests', 'unit'],
altLabels: ['blocks', 'bottles', 'boxes', 'cells', 'kits', 'organisms', 'packs', 'pieces', 'slides', 'syringes', 'tests', 'tubes', 'unit', 'vials'],
},
};

Expand Down
Loading