From 0d09ef453489676ded3a21da93b9a127041eb700 Mon Sep 17 00:00:00 2001 From: Matthew Runyon Date: Thu, 6 Feb 2025 09:41:28 -0600 Subject: [PATCH] fix: DH-18415: Cannot expand rows after applying rollup to ui.table (#1109) Fixes #1079 Tested with the steps in DH-18415 --- .../src/js/src/elements/UITable/JsTableProxy.ts | 2 +- .../src/js/src/elements/UITable/UITableModel.ts | 16 +++++++--------- tests/ui_table.spec.ts | 3 +-- ...> UI-table-t-alignment-1-chromium-linux.png} | Bin ...=> UI-table-t-alignment-1-firefox-linux.png} | Bin ... => UI-table-t-alignment-1-webkit-linux.png} | Bin ...ble-t-background-color-1-chromium-linux.png} | Bin ...able-t-background-color-1-firefox-linux.png} | Bin ...table-t-background-color-1-webkit-linux.png} | Bin ...ng => UI-table-t-color-1-chromium-linux.png} | Bin ...png => UI-table-t-color-1-firefox-linux.png} | Bin ....png => UI-table-t-color-1-webkit-linux.png} | Bin ...-t-color-column-source-1-chromium-linux.png} | Bin ...e-t-color-column-source-1-firefox-linux.png} | Bin ...le-t-color-column-source-1-webkit-linux.png} | Bin ...-table-t-display-names-1-chromium-linux.png} | Bin ...I-table-t-display-names-1-firefox-linux.png} | Bin ...UI-table-t-display-names-1-webkit-linux.png} | Bin ...=> UI-table-t-priority-1-chromium-linux.png} | Bin ... => UI-table-t-priority-1-firefox-linux.png} | Bin ...g => UI-table-t-priority-1-webkit-linux.png} | Bin ...I-table-t-value-format-1-chromium-linux.png} | Bin ...UI-table-t-value-format-1-firefox-linux.png} | Bin ... UI-table-t-value-format-1-webkit-linux.png} | Bin 24 files changed, 9 insertions(+), 12 deletions(-) rename tests/ui_table.spec.ts-snapshots/{UI-flex-components-t-alignment-1-chromium-linux.png => UI-table-t-alignment-1-chromium-linux.png} (100%) rename tests/ui_table.spec.ts-snapshots/{UI-flex-components-t-alignment-1-firefox-linux.png => UI-table-t-alignment-1-firefox-linux.png} (100%) rename tests/ui_table.spec.ts-snapshots/{UI-flex-components-t-alignment-1-webkit-linux.png => UI-table-t-alignment-1-webkit-linux.png} (100%) rename tests/ui_table.spec.ts-snapshots/{UI-flex-components-t-background-color-1-chromium-linux.png => UI-table-t-background-color-1-chromium-linux.png} (100%) rename tests/ui_table.spec.ts-snapshots/{UI-flex-components-t-background-color-1-firefox-linux.png => UI-table-t-background-color-1-firefox-linux.png} (100%) rename tests/ui_table.spec.ts-snapshots/{UI-flex-components-t-background-color-1-webkit-linux.png => UI-table-t-background-color-1-webkit-linux.png} (100%) rename tests/ui_table.spec.ts-snapshots/{UI-flex-components-t-color-1-chromium-linux.png => UI-table-t-color-1-chromium-linux.png} (100%) rename tests/ui_table.spec.ts-snapshots/{UI-flex-components-t-color-1-firefox-linux.png => UI-table-t-color-1-firefox-linux.png} (100%) rename tests/ui_table.spec.ts-snapshots/{UI-flex-components-t-color-1-webkit-linux.png => UI-table-t-color-1-webkit-linux.png} (100%) rename tests/ui_table.spec.ts-snapshots/{UI-flex-components-t-color-column-source-1-chromium-linux.png => UI-table-t-color-column-source-1-chromium-linux.png} (100%) rename tests/ui_table.spec.ts-snapshots/{UI-flex-components-t-color-column-source-1-firefox-linux.png => UI-table-t-color-column-source-1-firefox-linux.png} (100%) rename tests/ui_table.spec.ts-snapshots/{UI-flex-components-t-color-column-source-1-webkit-linux.png => UI-table-t-color-column-source-1-webkit-linux.png} (100%) rename tests/ui_table.spec.ts-snapshots/{UI-flex-components-t-display-names-1-chromium-linux.png => UI-table-t-display-names-1-chromium-linux.png} (100%) rename tests/ui_table.spec.ts-snapshots/{UI-flex-components-t-display-names-1-firefox-linux.png => UI-table-t-display-names-1-firefox-linux.png} (100%) rename tests/ui_table.spec.ts-snapshots/{UI-flex-components-t-display-names-1-webkit-linux.png => UI-table-t-display-names-1-webkit-linux.png} (100%) rename tests/ui_table.spec.ts-snapshots/{UI-flex-components-t-priority-1-chromium-linux.png => UI-table-t-priority-1-chromium-linux.png} (100%) rename tests/ui_table.spec.ts-snapshots/{UI-flex-components-t-priority-1-firefox-linux.png => UI-table-t-priority-1-firefox-linux.png} (100%) rename tests/ui_table.spec.ts-snapshots/{UI-flex-components-t-priority-1-webkit-linux.png => UI-table-t-priority-1-webkit-linux.png} (100%) rename tests/ui_table.spec.ts-snapshots/{UI-flex-components-t-value-format-1-chromium-linux.png => UI-table-t-value-format-1-chromium-linux.png} (100%) rename tests/ui_table.spec.ts-snapshots/{UI-flex-components-t-value-format-1-firefox-linux.png => UI-table-t-value-format-1-firefox-linux.png} (100%) rename tests/ui_table.spec.ts-snapshots/{UI-flex-components-t-value-format-1-webkit-linux.png => UI-table-t-value-format-1-webkit-linux.png} (100%) diff --git a/plugins/ui/src/js/src/elements/UITable/JsTableProxy.ts b/plugins/ui/src/js/src/elements/UITable/JsTableProxy.ts index ebae4cd5e..bbdc23068 100644 --- a/plugins/ui/src/js/src/elements/UITable/JsTableProxy.ts +++ b/plugins/ui/src/js/src/elements/UITable/JsTableProxy.ts @@ -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); diff --git a/plugins/ui/src/js/src/elements/UITable/UITableModel.ts b/plugins/ui/src/js/src/elements/UITable/UITableModel.ts index 11576c838..132436b7c 100644 --- a/plugins/ui/src/js/src/elements/UITable/UITableModel.ts +++ b/plugins/ui/src/js/src/elements/UITable/UITableModel.ts @@ -12,6 +12,7 @@ import { ColumnName, IrisGridModel, IrisGridModelFactory, + IrisGridTableModel, type IrisGridThemeType, isIrisGridTableModelTemplate, UIRow, @@ -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 @@ -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; @@ -159,7 +158,6 @@ class UITableModel extends IrisGridModel { constructor({ dh, model, - table, databars, format, displayNameMap, @@ -174,7 +172,6 @@ class UITableModel extends IrisGridModel { super(dh); this.model = model; - this.table = table; this.displayNameMap = displayNameMap; this.databars = new Map(); @@ -209,6 +206,7 @@ class UITableModel extends IrisGridModel { ); const trueTarget = proxyHasProp || proxyHasFn ? target : target.model; + return Reflect.get(trueTarget, prop); }, set(target, prop, value) { @@ -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); }, }); } @@ -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}`); } diff --git a/tests/ui_table.spec.ts b/tests/ui_table.spec.ts index 9815f2e8e..276890561 100644 --- a/tests/ui_table.spec.ts +++ b/tests/ui_table.spec.ts @@ -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', diff --git a/tests/ui_table.spec.ts-snapshots/UI-flex-components-t-alignment-1-chromium-linux.png b/tests/ui_table.spec.ts-snapshots/UI-table-t-alignment-1-chromium-linux.png similarity index 100% rename from tests/ui_table.spec.ts-snapshots/UI-flex-components-t-alignment-1-chromium-linux.png rename to tests/ui_table.spec.ts-snapshots/UI-table-t-alignment-1-chromium-linux.png diff --git a/tests/ui_table.spec.ts-snapshots/UI-flex-components-t-alignment-1-firefox-linux.png b/tests/ui_table.spec.ts-snapshots/UI-table-t-alignment-1-firefox-linux.png similarity index 100% rename from tests/ui_table.spec.ts-snapshots/UI-flex-components-t-alignment-1-firefox-linux.png rename to tests/ui_table.spec.ts-snapshots/UI-table-t-alignment-1-firefox-linux.png diff --git a/tests/ui_table.spec.ts-snapshots/UI-flex-components-t-alignment-1-webkit-linux.png b/tests/ui_table.spec.ts-snapshots/UI-table-t-alignment-1-webkit-linux.png similarity index 100% rename from tests/ui_table.spec.ts-snapshots/UI-flex-components-t-alignment-1-webkit-linux.png rename to tests/ui_table.spec.ts-snapshots/UI-table-t-alignment-1-webkit-linux.png diff --git a/tests/ui_table.spec.ts-snapshots/UI-flex-components-t-background-color-1-chromium-linux.png b/tests/ui_table.spec.ts-snapshots/UI-table-t-background-color-1-chromium-linux.png similarity index 100% rename from tests/ui_table.spec.ts-snapshots/UI-flex-components-t-background-color-1-chromium-linux.png rename to tests/ui_table.spec.ts-snapshots/UI-table-t-background-color-1-chromium-linux.png diff --git a/tests/ui_table.spec.ts-snapshots/UI-flex-components-t-background-color-1-firefox-linux.png b/tests/ui_table.spec.ts-snapshots/UI-table-t-background-color-1-firefox-linux.png similarity index 100% rename from tests/ui_table.spec.ts-snapshots/UI-flex-components-t-background-color-1-firefox-linux.png rename to tests/ui_table.spec.ts-snapshots/UI-table-t-background-color-1-firefox-linux.png diff --git a/tests/ui_table.spec.ts-snapshots/UI-flex-components-t-background-color-1-webkit-linux.png b/tests/ui_table.spec.ts-snapshots/UI-table-t-background-color-1-webkit-linux.png similarity index 100% rename from tests/ui_table.spec.ts-snapshots/UI-flex-components-t-background-color-1-webkit-linux.png rename to tests/ui_table.spec.ts-snapshots/UI-table-t-background-color-1-webkit-linux.png diff --git a/tests/ui_table.spec.ts-snapshots/UI-flex-components-t-color-1-chromium-linux.png b/tests/ui_table.spec.ts-snapshots/UI-table-t-color-1-chromium-linux.png similarity index 100% rename from tests/ui_table.spec.ts-snapshots/UI-flex-components-t-color-1-chromium-linux.png rename to tests/ui_table.spec.ts-snapshots/UI-table-t-color-1-chromium-linux.png diff --git a/tests/ui_table.spec.ts-snapshots/UI-flex-components-t-color-1-firefox-linux.png b/tests/ui_table.spec.ts-snapshots/UI-table-t-color-1-firefox-linux.png similarity index 100% rename from tests/ui_table.spec.ts-snapshots/UI-flex-components-t-color-1-firefox-linux.png rename to tests/ui_table.spec.ts-snapshots/UI-table-t-color-1-firefox-linux.png diff --git a/tests/ui_table.spec.ts-snapshots/UI-flex-components-t-color-1-webkit-linux.png b/tests/ui_table.spec.ts-snapshots/UI-table-t-color-1-webkit-linux.png similarity index 100% rename from tests/ui_table.spec.ts-snapshots/UI-flex-components-t-color-1-webkit-linux.png rename to tests/ui_table.spec.ts-snapshots/UI-table-t-color-1-webkit-linux.png diff --git a/tests/ui_table.spec.ts-snapshots/UI-flex-components-t-color-column-source-1-chromium-linux.png b/tests/ui_table.spec.ts-snapshots/UI-table-t-color-column-source-1-chromium-linux.png similarity index 100% rename from tests/ui_table.spec.ts-snapshots/UI-flex-components-t-color-column-source-1-chromium-linux.png rename to tests/ui_table.spec.ts-snapshots/UI-table-t-color-column-source-1-chromium-linux.png diff --git a/tests/ui_table.spec.ts-snapshots/UI-flex-components-t-color-column-source-1-firefox-linux.png b/tests/ui_table.spec.ts-snapshots/UI-table-t-color-column-source-1-firefox-linux.png similarity index 100% rename from tests/ui_table.spec.ts-snapshots/UI-flex-components-t-color-column-source-1-firefox-linux.png rename to tests/ui_table.spec.ts-snapshots/UI-table-t-color-column-source-1-firefox-linux.png diff --git a/tests/ui_table.spec.ts-snapshots/UI-flex-components-t-color-column-source-1-webkit-linux.png b/tests/ui_table.spec.ts-snapshots/UI-table-t-color-column-source-1-webkit-linux.png similarity index 100% rename from tests/ui_table.spec.ts-snapshots/UI-flex-components-t-color-column-source-1-webkit-linux.png rename to tests/ui_table.spec.ts-snapshots/UI-table-t-color-column-source-1-webkit-linux.png diff --git a/tests/ui_table.spec.ts-snapshots/UI-flex-components-t-display-names-1-chromium-linux.png b/tests/ui_table.spec.ts-snapshots/UI-table-t-display-names-1-chromium-linux.png similarity index 100% rename from tests/ui_table.spec.ts-snapshots/UI-flex-components-t-display-names-1-chromium-linux.png rename to tests/ui_table.spec.ts-snapshots/UI-table-t-display-names-1-chromium-linux.png diff --git a/tests/ui_table.spec.ts-snapshots/UI-flex-components-t-display-names-1-firefox-linux.png b/tests/ui_table.spec.ts-snapshots/UI-table-t-display-names-1-firefox-linux.png similarity index 100% rename from tests/ui_table.spec.ts-snapshots/UI-flex-components-t-display-names-1-firefox-linux.png rename to tests/ui_table.spec.ts-snapshots/UI-table-t-display-names-1-firefox-linux.png diff --git a/tests/ui_table.spec.ts-snapshots/UI-flex-components-t-display-names-1-webkit-linux.png b/tests/ui_table.spec.ts-snapshots/UI-table-t-display-names-1-webkit-linux.png similarity index 100% rename from tests/ui_table.spec.ts-snapshots/UI-flex-components-t-display-names-1-webkit-linux.png rename to tests/ui_table.spec.ts-snapshots/UI-table-t-display-names-1-webkit-linux.png diff --git a/tests/ui_table.spec.ts-snapshots/UI-flex-components-t-priority-1-chromium-linux.png b/tests/ui_table.spec.ts-snapshots/UI-table-t-priority-1-chromium-linux.png similarity index 100% rename from tests/ui_table.spec.ts-snapshots/UI-flex-components-t-priority-1-chromium-linux.png rename to tests/ui_table.spec.ts-snapshots/UI-table-t-priority-1-chromium-linux.png diff --git a/tests/ui_table.spec.ts-snapshots/UI-flex-components-t-priority-1-firefox-linux.png b/tests/ui_table.spec.ts-snapshots/UI-table-t-priority-1-firefox-linux.png similarity index 100% rename from tests/ui_table.spec.ts-snapshots/UI-flex-components-t-priority-1-firefox-linux.png rename to tests/ui_table.spec.ts-snapshots/UI-table-t-priority-1-firefox-linux.png diff --git a/tests/ui_table.spec.ts-snapshots/UI-flex-components-t-priority-1-webkit-linux.png b/tests/ui_table.spec.ts-snapshots/UI-table-t-priority-1-webkit-linux.png similarity index 100% rename from tests/ui_table.spec.ts-snapshots/UI-flex-components-t-priority-1-webkit-linux.png rename to tests/ui_table.spec.ts-snapshots/UI-table-t-priority-1-webkit-linux.png diff --git a/tests/ui_table.spec.ts-snapshots/UI-flex-components-t-value-format-1-chromium-linux.png b/tests/ui_table.spec.ts-snapshots/UI-table-t-value-format-1-chromium-linux.png similarity index 100% rename from tests/ui_table.spec.ts-snapshots/UI-flex-components-t-value-format-1-chromium-linux.png rename to tests/ui_table.spec.ts-snapshots/UI-table-t-value-format-1-chromium-linux.png diff --git a/tests/ui_table.spec.ts-snapshots/UI-flex-components-t-value-format-1-firefox-linux.png b/tests/ui_table.spec.ts-snapshots/UI-table-t-value-format-1-firefox-linux.png similarity index 100% rename from tests/ui_table.spec.ts-snapshots/UI-flex-components-t-value-format-1-firefox-linux.png rename to tests/ui_table.spec.ts-snapshots/UI-table-t-value-format-1-firefox-linux.png diff --git a/tests/ui_table.spec.ts-snapshots/UI-flex-components-t-value-format-1-webkit-linux.png b/tests/ui_table.spec.ts-snapshots/UI-table-t-value-format-1-webkit-linux.png similarity index 100% rename from tests/ui_table.spec.ts-snapshots/UI-flex-components-t-value-format-1-webkit-linux.png rename to tests/ui_table.spec.ts-snapshots/UI-table-t-value-format-1-webkit-linux.png