Skip to content
Merged
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.33.3",
"version": "7.33.4",
"description": "Components, models, actions, and utility functions for LabKey applications and pages",
"sideEffects": false,
"files": [
Expand Down
5 changes: 5 additions & 0 deletions packages/components/releaseNotes/components.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# @labkey/components
Components, models, actions, and utility functions for LabKey applications and pages

### version 7.33.4
*Released*: 3 May 2026
- Consolidate Dataclass data update methods - use DIB for update only
- Remove `altUpdateKeys` from `QueryInfo`

### version 7.33.3
*Released*: 1 May 2026
- Accessibility improvements: add labels or aria-labels to input elements
Expand Down
10 changes: 1 addition & 9 deletions packages/components/src/internal/components/editable/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,22 +123,14 @@ export const initEditorModel = async (
}

if (forUpdate) {
// If we're updating then we need to ensure that the pkCols and altUpdateKeys are in the columnMap
// If we're updating then we need to ensure that the pkCols are in the columnMap
queryInfo.getPkCols().forEach(pkCol => {
if (!columnMap[pkCol.fieldKey.toLowerCase()]) {
columnMap[pkCol.fieldKey.toLowerCase()] = pkCol;
columns.push(pkCol);
}
});

queryInfo.altUpdateKeys?.forEach(fieldKey => {
const col = queryInfo.getColumn(fieldKey);
if (col && !columnMap[fieldKey.toLowerCase()]) {
columnMap[fieldKey.toLowerCase()] = col;
columns.push(col);
}
});

const hasContainerCol =
columns.filter(c => c.fieldKey.toLowerCase() === 'container' || c.fieldKey.toLowerCase() === 'folder')
.length > 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -952,18 +952,6 @@ describe('EditorModel', () => {
expect(updatedRows[0][expInputCol.fieldKey.toLowerCase()]).toBeUndefined();
});
});
test('altUpdateKeys', () => {
const queryInfo = basicEditorModel.queryInfo.mutate({ altUpdateKeys: new Set([colTwoFk]) });
const cellKey = genCellKey(colOneFk, 0);
const value = List([{ display: 'Changed', raw: 'changed' } as ValueDescriptor]);
const model = modifyEm({
cellValues: basicEditorModel.cellValues.set(cellKey, value),
queryInfo,
});
const updatedRows = model.getUpdatedData();
// altUpdateKeys are always appended to row values even if not changed
expect(updatedRows[0]).toHaveProperty(colTwoFk);
});
test('field added', () => {
const addedColumn = new QueryColumn({
name: 'added',
Expand Down Expand Up @@ -1489,25 +1477,14 @@ describe('EditorModel', () => {
}),
};
const queryInfo = new QueryInfo(config);
const queryInfoWithAltKey = new QueryInfo({
...config,
altUpdateKeys: new Set<string>(['lsid']),
});
const cellValues = fromJS({
[genCellKey('RowId', 0)]: List([{ raw: 1 } as ValueDescriptor]),
[genCellKey('lsid', 0)]: List([{ raw: 'abc' } as ValueDescriptor]),
});
let model = new EditorModel({
const model = new EditorModel({
queryInfo,
cellValues,
});
expect(model.getPkValues(0)).toStrictEqual({ RowId: 1 });

model = new EditorModel({
queryInfo: queryInfoWithAltKey,
cellValues,
});
expect(model.getPkValues(0)).toStrictEqual({ RowId: 1, lsid: 'abc' });
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ export class EditorModel
const data = {};
const pkCols = new Set<string>();
this.queryInfo.getPkCols().forEach(col => pkCols.add(col.fieldKey));
this.queryInfo.altUpdateKeys?.forEach(key => pkCols.add(key));
pkCols.forEach(pkCol => {
const pkVal = this.getValue(pkCol, rowIndex).get(0).raw;

Expand Down Expand Up @@ -764,10 +763,6 @@ export class EditorModel
const updatedRows: UpdatedRow[] = [];
editorRows.forEach((editedRow, idx) => {
const id = editedRow.get(pkFieldKey);
const altIds = {};
queryInfo.altUpdateKeys?.forEach(altIdField => {
altIds[altIdField] = altIdField ? editedRow.get(altIdField) : undefined;
});
const originalRow = originalData.get(id.toString());
if (originalRow) {
// Issue 52038: key here is almost always the column name (not the fieldKey) and should remain so since that is
Expand Down Expand Up @@ -875,7 +870,6 @@ export class EditorModel
// Always append folder if it's in the original data so cross folder updates work
const folder = caseInsensitive(originalRow?.toJS(), FOLDER_COL)?.[0]?.value;
if (folder !== undefined) row[FOLDER_COL] = folder;
Object.assign(row, altIds);
updatedRows.push(row);
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export class BulkUpdateForm extends PureComponent<BulkUpdateFormProps, State> {
}

const rows = !Utils.isEmptyObj(data)
? getUpdatedData(this.state.originalDataForSelection, data, queryInfo, queryInfo.altUpdateKeys)
? getUpdatedData(this.state.originalDataForSelection, data, queryInfo)
: [];

return updateRows(queryInfo.schemaQuery, rows, comment);
Expand Down
2 changes: 0 additions & 2 deletions packages/components/src/internal/query/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ export function applyQueryMetadata(rawQueryInfo: any, schemaName?: string, query

const queryLabel = rawQueryInfo.title || _queryName;
const disabledSystemFields = new Set<string>(rawQueryInfo.disabledSystemFields ?? []);
const altUpdateKeys = new Set<string>(rawQueryInfo.altUpdateKeys ?? []);
const defaultQueryMeta = {
queryLabel,
plural: queryLabel,
Expand All @@ -254,7 +253,6 @@ export function applyQueryMetadata(rawQueryInfo: any, schemaName?: string, query
};

queryInfo = Object.assign({}, rawQueryInfo, schemaMeta, defaultQueryMeta, queryMeta, {
altUpdateKeys,
disabledSystemFields,
// derived fields
columns,
Expand Down
31 changes: 0 additions & 31 deletions packages/components/src/internal/util/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -934,37 +934,6 @@ describe('getUpdatedData', () => {
});
});

test('with additionalCols', () => {
const updatedData = getUpdatedData(
originalData,
{
Value: 'val',
And$C$D$SAgain: 'again',
Other: 'other3',
},
queryInfo,
new Set(['Data'])
);
expect(updatedData).toHaveLength(3);
expect(updatedData[0]).toStrictEqual({
RowId: 445,
Other: 'other3',
Data: 'data1',
});
expect(updatedData[1]).toStrictEqual({
RowId: 447,
Value: 'val',
Other: 'other3',
Data: 'data1',
});
expect(updatedData[2]).toStrictEqual({
RowId: 448,
Value: 'val',
Other: 'other3',
Data: 'data1',
});
});

test('with folder', () => {
const originalData_ = fromJS({
'448': {
Expand Down
5 changes: 1 addition & 4 deletions packages/components/src/internal/util/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,19 +346,16 @@ export function isSameWithStringCompare(value1: any, value2: any): boolean {
* @param originalData a map from an id field to a Map from fieldKeys to an object with a 'value' field
* @param updatedValues an object mapping fieldKeys to values that are being updated
* @param queryInfo the queryInfo to get column information from
* @param additionalCols additional array of fieldKeys to include
*/
export function getUpdatedData(
originalData: Map<string, any>, // the rows in the original data have column names as keys
updatedValues: Record<string, any>, // the keys here are column fieldKeys
queryInfo: QueryInfo,
additionalCols?: Set<string>
queryInfo: QueryInfo
): any[] {
const updateValuesMap = Map<any, any>(updatedValues);
const pkColsLc = new Set<string>();
const pkColsInUse = new Set<string>();
queryInfo.pkCols.forEach(key => pkColsLc.add(key.toLowerCase()));
additionalCols?.forEach(col => pkColsLc.add(col.toLowerCase()));

// if the originalData has the container/folder values, keep those as well (i.e., treat it as a primary key)
const folderKey = originalData
Expand Down
4 changes: 0 additions & 4 deletions packages/components/src/public/QueryInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export enum QueryInfoStatus {
}

const QUERY_INFO_DEFAULTS = {
altUpdateKeys: undefined,
disabledSystemFields: undefined,
// canEdit: false,
// canEditSharedViews: false,
Expand Down Expand Up @@ -73,7 +72,6 @@ export interface ImportTemplate {
// Commented out attributes are not used in app, but are returned by the server
export class QueryInfo {
declare appEditableTable: boolean; // use isAppEditable()
declare altUpdateKeys: Set<string>;
declare disabledSystemFields: Set<string>;
// declare canEdit: boolean;
// declare canEditSharedViews: boolean;
Expand Down Expand Up @@ -153,7 +151,6 @@ export class QueryInfo {
});

const disabledSystemFields = new Set<string>(queryInfoJson.disabledSystemFields ?? []);
const altUpdateKeys = new Set<string>(queryInfoJson.altUpdateKeys ?? []);
const views = new ExtendedMap<string, ViewInfo>();
if (includeViews) {
queryInfoJson.views.forEach(view => {
Expand All @@ -164,7 +161,6 @@ export class QueryInfo {

return new QueryInfo(
Object.assign({}, queryInfoJson, {
altUpdateKeys,
disabledSystemFields,
columns,
schemaQuery,
Expand Down