Skip to content

Commit 26064c5

Browse files
Issue 868: Add more nouns for count units (#1975)
1 parent e115140 commit 26064c5

7 files changed

Lines changed: 24 additions & 12 deletions

File tree

packages/components/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@labkey/components",
3-
"version": "7.28.2",
3+
"version": "7.29.1",
44
"description": "Components, models, actions, and utility functions for LabKey applications and pages",
55
"sideEffects": false,
66
"files": [

packages/components/releaseNotes/components.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# @labkey/components
22
Components, models, actions, and utility functions for LabKey applications and pages
33

4+
### version 7.29.1
5+
*Released*: 7 April 2026
6+
- GitHub Issue 868: Add more nouns for count units
7+
48
### version 7.28.2
59
*Released*: 7 April 2026
6-
- Update `FEEZER_ITEM_SAMPLE_MAPPER` to return undefined if not matched, for consistency with other mappers
10+
- Update `FREEZER_ITEM_SAMPLE_MAPPER` to return undefined if not matched, for consistency with other mappers
711

812
### version 7.28.1
913
*Released*: 3 April 2026

packages/components/src/internal/components/domainproperties/samples/SampleTypePropertiesPanel.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,11 @@ import {
5353
getMeasurementUnit,
5454
getMetricUnitOptions,
5555
getMetricUnitOptionsFromKind,
56+
MEASUREMENT_UNITS,
5657
UNITS_KIND,
5758
} from '../../../util/measurement';
5859
import { Alert } from '../../base/Alert';
60+
import { makeCommaSeparatedString } from '../../../util/utils';
5961

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

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { FormsyInput } from './FormsyReactComponents';
1111
import { Operation } from '../../../../public/QueryColumn';
1212
import { STORED_AMOUNT_FIELDS } from '../../samples/constants';
1313
import { Alert } from '../../base/Alert';
14+
import { LOOKUP_DEFAULT_SIZE } from '../../../constants';
1415

1516
export const AmountUnitInput: FC<InputRendererProps> = memo(props => {
1617
const {
@@ -102,6 +103,7 @@ export const AmountUnitInput: FC<InputRendererProps> = memo(props => {
102103
id={id}
103104
inputClass={''}
104105
name={unitCol.fieldKey}
106+
maxRows={LOOKUP_DEFAULT_SIZE}
105107
onQSChange={onSelectChange}
106108
placeholder="Select or type to search..."
107109
queryFilters={queryFilter}

packages/components/src/internal/util/measurement.test.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ describe('MetricUnit utils', () => {
134134
])
135135
);
136136

137-
expect(getMetricUnitOptions(null).length).toBe(18);
138-
expect(getMetricUnitOptions('').length).toBe(18);
139-
expect(getMetricUnitOptions('bad').length).toBe(18);
137+
expect(getMetricUnitOptions(null).length).toBe(22);
138+
expect(getMetricUnitOptions('').length).toBe(22);
139+
expect(getMetricUnitOptions('bad').length).toBe(22);
140140
});
141141

142142
test('getMetricUnitOptions with filterFn', () => {
@@ -197,17 +197,21 @@ describe('MetricUnit utils', () => {
197197
'boxes',
198198
'cells',
199199
'kits',
200+
'organisms',
200201
'packs',
201202
'pieces',
202203
'slides',
204+
'syringes',
203205
'tests',
206+
'tubes',
204207
'unit',
208+
'vials',
205209
]);
206210

207211
// include all options when no unitTypeStr or an invalid unitTypeStr is provided
208-
expect(getAltUnitKeys(null).length).toBe(18);
209-
expect(getAltUnitKeys('').length).toBe(18);
210-
expect(getAltUnitKeys('bad').length).toBe(18);
212+
expect(getAltUnitKeys(null).length).toBe(22);
213+
expect(getAltUnitKeys('').length).toBe(22);
214+
expect(getAltUnitKeys('bad').length).toBe(22);
211215
});
212216

213217
test('getMeasurementUnit', () => {

packages/components/src/internal/util/measurement.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ export const MEASUREMENT_UNITS: Record<string, MeasurementUnit> = {
181181
kind: UNITS_KIND.COUNT,
182182
ratio: 1,
183183
displayPrecision: 2,
184-
altLabels: ['blocks', 'bottles', 'boxes', 'cells', 'kits', 'packs', 'pieces', 'slides', 'tests', 'unit'],
184+
altLabels: ['blocks', 'bottles', 'boxes', 'cells', 'kits', 'organisms', 'packs', 'pieces', 'slides', 'syringes', 'tests', 'tubes', 'unit', 'vials'],
185185
},
186186
};
187187

0 commit comments

Comments
 (0)