Skip to content

Commit

Permalink
fix: DH-18415: Cannot expand rows after applying rollup to ui.table (#…
Browse files Browse the repository at this point in the history
…1109)

Fixes #1079 
Tested with the steps in DH-18415
  • Loading branch information
mattrunyon authored Feb 6, 2025
1 parent 7fcfdfd commit 0d09ef4
Show file tree
Hide file tree
Showing 24 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion plugins/ui/src/js/src/elements/UITable/JsTableProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class JsTableProxy implements dh.Table {
const proxyHasProp = Object.prototype.hasOwnProperty.call(target, prop);

if (proxyHasSetter || proxyHasProp) {
return Reflect.set(target, prop, value, target);
return Reflect.set(target, prop, value);
}

return Reflect.set(target.table, prop, value, target.table);
Expand Down
16 changes: 7 additions & 9 deletions plugins/ui/src/js/src/elements/UITable/UITableModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
ColumnName,
IrisGridModel,
IrisGridModelFactory,
IrisGridTableModel,
type IrisGridThemeType,
isIrisGridTableModelTemplate,
UIRow,
Expand Down Expand Up @@ -130,7 +131,7 @@ function getFormatCustomColumnName(i: number): string {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface UITableModel extends IrisGridModel {}
interface UITableModel extends IrisGridTableModel {}

type NumericValue =
| number
Expand All @@ -141,8 +142,6 @@ type NumericValue =
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
class UITableModel extends IrisGridModel {
table: DhType.Table;

private model: IrisGridModel;

private databars: Map<ColumnName, DatabarConfig>;
Expand All @@ -159,7 +158,6 @@ class UITableModel extends IrisGridModel {
constructor({
dh,
model,
table,
databars,
format,
displayNameMap,
Expand All @@ -174,7 +172,6 @@ class UITableModel extends IrisGridModel {
super(dh);

this.model = model;
this.table = table;
this.displayNameMap = displayNameMap;

this.databars = new Map<ColumnName, DatabarConfig>();
Expand Down Expand Up @@ -209,6 +206,7 @@ class UITableModel extends IrisGridModel {
);

const trueTarget = proxyHasProp || proxyHasFn ? target : target.model;

return Reflect.get(trueTarget, prop);
},
set(target, prop, value) {
Expand All @@ -219,10 +217,10 @@ class UITableModel extends IrisGridModel {
const proxyHasProp = Object.prototype.hasOwnProperty.call(target, prop);

if (proxyHasSetter || proxyHasProp) {
return Reflect.set(target, prop, value, target);
return Reflect.set(target, prop, value);
}

return Reflect.set(target.model, prop, value, target.model);
return Reflect.set(target.model, prop, value);
},
});
}
Expand Down Expand Up @@ -277,11 +275,11 @@ class UITableModel extends IrisGridModel {
columnName: ColumnName,
valueType: string
): number {
if (row != null) {
if (row != null && isIrisGridTableModelTemplate(this.model)) {
let column;

try {
column = this.table.findColumn(columnName);
column = this.model.table.findColumn(columnName);
} catch {
throw new Error(`Can't find databar ${valueType} column ${columnName}`);
}
Expand Down
3 changes: 1 addition & 2 deletions tests/ui_table.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { openPanel, gotoPage } from './utils';

const REACT_PANEL_VISIBLE = '.dh-react-panel:visible';

// Tests flex components render as expected
test.describe('UI flex components', () => {
test.describe('UI table', () => {
[
't_alignment',
't_background_color',
Expand Down

0 comments on commit 0d09ef4

Please sign in to comment.