Skip to content

Commit 6b2a61c

Browse files
committed
Merge remote-tracking branch 'origin/develop' into urlTargetWindow503
2 parents 103b1d3 + c773bea commit 6b2a61c

9 files changed

Lines changed: 40 additions & 54 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.7.1-fb-urlTargetWindow503.3",
3+
"version": "7.7.3",
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: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ Components, models, actions, and utility functions for LabKey applications and p
55
*Released*: TBD
66
- GitHub Issue 503: Field editor URL option to set target window (i.e. _blank)
77

8+
### version 7.7.3
9+
*Released*: 31 December 2025
10+
- [GitHub Issue #495](https://github.com/LabKey/internal-issues/issues/495)
11+
- Remove some gratuitous capitalization of field names in audit event details
12+
- When generating a column label for an added parent column in the editable grid, don't capitalize the query name
13+
14+
### version 7.7.2
15+
*Released*: 30 December 2025
16+
- Remove unused `getVolumeMinStep` method
17+
- Improve typings, test checks
18+
819
### version 7.7.1
920
*Released*: 29 December 2025
1021
- [GitHub Issue 734](https://github.com/LabKey/internal-issues/issues/734) Update sizing of comment input box for better display in narrow screens

packages/components/src/internal/components/auditlog/AuditDetails.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class AuditDetails extends Component<Props> {
9595
<div className="row margin-bottom" key={field}>
9696
<div className="left-padding right-padding">
9797
<span className="audit-detail-row-label right-padding">
98-
{capitalizeFirstChar(field)}
98+
{field}
9999
{!!providedVals.length && (
100100
<LabelHelpTip
101101
iconComponent={<i className="original-value-icon fa fa-info-circle left-padding" />}

packages/components/src/internal/components/entities/models.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ describe('EntityParentType', () => {
2727
'Display Column',
2828
SCHEMAS.DATA_CLASSES.SCHEMA
2929
);
30-
expect(col.caption).toBe('Dataclass Parents');
30+
expect(col.caption).toBe('dataclass Parents');
3131

3232
col = EntityParentType.create({ schema: SCHEMAS.DATA_CLASSES.SCHEMA, query: 'dataclass' }).generateColumn(
3333
'Display Column',
3434
SCHEMAS.SAMPLE_SETS.SCHEMA
3535
);
36-
expect(col.caption).toBe('Dataclass');
36+
expect(col.caption).toBe('dataclass');
3737

3838
col = EntityParentType.create({ schema: SCHEMAS.SAMPLE_SETS.SCHEMA, query: 'sampletype' }).generateColumn(
3939
'Display Column',
4040
SCHEMAS.SAMPLE_SETS.SCHEMA
4141
);
42-
expect(col.caption).toBe('Sampletype Parents');
42+
expect(col.caption).toBe('sampletype Parents');
4343

4444
col = EntityParentType.create({
4545
schema: SCHEMAS.SAMPLE_SETS.SCHEMA,

packages/components/src/internal/components/entities/models.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { ExtendedMap } from '../../../public/ExtendedMap';
2323
import { decodePart, encodePart, SchemaQuery } from '../../../public/SchemaQuery';
2424
import { IEntityDetails } from '../domainproperties/entities/models';
2525
import { SelectInputOption } from '../forms/input/SelectInput';
26-
import { capitalizeFirstChar, caseInsensitive, generateId } from '../../util/utils';
26+
import { caseInsensitive, generateId } from '../../util/utils';
2727
import { QueryColumn, QueryLookup } from '../../../public/QueryColumn';
2828
import { SCHEMAS } from '../../schemas';
2929
import { EntityCreationType } from '../samples/models';
@@ -107,7 +107,7 @@ export class EntityParentType extends Record({
107107
}
108108

109109
generateColumn(displayColumn: string, targetSchema: string): QueryColumn {
110-
const label_ = this.label ?? capitalizeFirstChar(this.query);
110+
const label_ = this.label ?? this.query;
111111
const parentColName = this.generateFieldKey();
112112

113113
// Issue 40233: SM app allows for two types of parents, sources and samples, and its confusing if both use

packages/components/src/internal/components/samples/actions.test.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,8 @@ describe('getGroupedSampleDomainFields', () => {
8484

8585
test('field split by derivationDataScope', () => {
8686
const result = _getGroupedSampleDomainFields(sampleTypeDomain, queryInfo);
87-
expect(result.aliquotFields.length).toBe(1);
88-
expect(result.aliquotFields[0]).toBe('aliq$c$d$s');
89-
expect(result.independentFields.length).toBe(1);
90-
expect(result.independentFields[0]).toBe('all$c$d$s');
91-
expect(result.metaFields.length).toBe(3);
92-
expect(result.metaFields[0]).toBe('name');
93-
expect(result.metaFields[1]).toBe('spec char$c$d$s');
94-
expect(result.metaFields[2]).toBe('parent$c$d$s');
87+
expect(result.aliquotFields).toEqual(['aliq$c$d$s']);
88+
expect(result.independentFields).toEqual(['all$c$d$s']);
89+
expect(result.metaFields).toEqual(['name', 'spec char$c$d$s', 'parent$c$d$s']);
9590
});
9691
});

packages/components/src/internal/components/samples/actions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ export function _getGroupedSampleDomainFields(
153153
sampleTypeDomain: DomainDetails,
154154
queryInfo: QueryInfo
155155
): GroupedSampleFields {
156-
const metaFields = [];
157-
const independentFields = [];
158-
const aliquotFields = [];
156+
const aliquotFields: string[] = [];
157+
const independentFields: string[] = [];
158+
const metaFields: string[] = [];
159159

160160
sampleTypeDomain.domainDesign.fields.forEach(field => {
161161
const col = queryInfo.getColumnFromName(field.name);

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

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,14 @@ export const MEASUREMENT_UNITS: Record<string, MeasurementUnit> = {
185185
},
186186
};
187187

188-
export function getMeasurementUnit(unitStr: string): MeasurementUnit {
188+
export function getMeasurementUnit(unitStr: string): MeasurementUnit | null {
189189
if (!unitStr) return null;
190+
const unitStrLc = unitStr.toLowerCase();
190191

191-
const unit = MEASUREMENT_UNITS[unitStr?.toLowerCase()];
192+
const unit = MEASUREMENT_UNITS[unitStrLc];
192193
if (unit) return unit;
193194

194-
const unitStrLc = unitStr.toLowerCase();
195-
if (MEASUREMENT_UNITS.unit.altLabels.indexOf(unitStrLc) > -1) {
195+
if (MEASUREMENT_UNITS.unit.altLabels?.indexOf(unitStrLc) > -1) {
196196
return {
197197
...MEASUREMENT_UNITS.unit,
198198
label: unitStrLc,
@@ -204,11 +204,7 @@ export function getMeasurementUnit(unitStr: string): MeasurementUnit {
204204
return null;
205205
}
206206

207-
/**
208-
* @param unitAStr
209-
* @param unitBStr
210-
*/
211-
export function areUnitsCompatible(unitAStr: string, unitBStr: string) {
207+
export function areUnitsCompatible(unitAStr: string, unitBStr: string): boolean {
212208
if (unitAStr == unitBStr) {
213209
return true;
214210
}
@@ -221,19 +217,19 @@ export function areUnitsCompatible(unitAStr: string, unitBStr: string) {
221217
if (!unitAStr && unitBStr) {
222218
return false;
223219
}
224-
const unitA: MeasurementUnit = getMeasurementUnit(unitAStr);
225-
const unitB: MeasurementUnit = getMeasurementUnit(unitBStr);
220+
const unitA = getMeasurementUnit(unitAStr);
221+
const unitB = getMeasurementUnit(unitBStr);
226222
if (!unitA || !unitB) {
227223
return false;
228224
}
229225
return unitA.kind === unitB.kind;
230226
}
231227

232228
export function getMetricUnitOptions(metricUnit?: string, showLongLabel?: boolean): { label: string; value: string }[] {
233-
const unit: MeasurementUnit = getMeasurementUnit(metricUnit);
229+
const unit = getMeasurementUnit(metricUnit);
234230

235231
const options = [];
236-
for (const [key, value] of Object.entries(MEASUREMENT_UNITS)) {
232+
for (const value of Object.values(MEASUREMENT_UNITS)) {
237233
if (!unit || value.kind === unit.kind) {
238234
if (value.kind === UNITS_KIND.COUNT) {
239235
if (showLongLabel)
@@ -274,36 +270,20 @@ export function getMetricUnitOptionsFromKind(
274270
return getMetricUnitOptions(metricUnit, showLongLabel);
275271
}
276272

277-
export function getAltUnitKeys(unitTypeStr): string[] {
278-
const unit: MeasurementUnit = getMeasurementUnit(unitTypeStr);
273+
export function getAltUnitKeys(unitTypeStr: string): string[] {
274+
const unit = getMeasurementUnit(unitTypeStr);
279275
const options = [];
280-
Object.values(MEASUREMENT_UNITS).forEach(value => {
276+
for (const value of Object.values(MEASUREMENT_UNITS)) {
281277
if (!unit || value.kind === unit.kind) {
282278
if (value.altLabels) {
283279
options.push(...value.altLabels);
284280
} else options.push(value.label);
285281
}
286-
});
287-
288-
return options;
289-
}
290-
291-
export function getVolumeMinStep(sampleTypeUnit?: MeasurementUnit | string) {
292-
const step = 0.01;
293-
if (!sampleTypeUnit) {
294-
return step;
295282
}
296283

297-
const unit = typeof sampleTypeUnit === 'string' ? getMeasurementUnit(sampleTypeUnit) : sampleTypeUnit;
298-
299-
// If we don't know the units, or it is 'unit' then use the default
300-
if (!unit || unit.baseUnit === MEASUREMENT_UNITS.unit.baseUnit) {
301-
return step;
302-
}
303-
304-
return Math.pow(10, -unit.displayPrecision); // Track uL and mg to a single unit
284+
return options;
305285
}
306286

307-
export function isMeasurementUnitIgnoreCase(expected: MeasurementUnit, val: string) {
287+
export function isMeasurementUnitIgnoreCase(expected: MeasurementUnit, val: string): boolean {
308288
return expected.label.localeCompare(val, 'en-US', { sensitivity: 'base' }) === 0;
309289
}

0 commit comments

Comments
 (0)