Skip to content

Commit

Permalink
Scope the css var for # of columns to the table (#225)
Browse files Browse the repository at this point in the history
* scope the css var for # of columns to the table

* ts typing fix
  • Loading branch information
phndiaye authored Jan 16, 2025
1 parent 50065eb commit 8b15f3d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions addon/components/hyper-table-v2/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@

<div
class="hypertable"
style={{this.columnsCountStyle}}
{{sortable-group direction="x" onChange=this.reorderColumns groupName=this.hypertableInstanceID}}
>
{{#each @handler.columns as |column index|}}
Expand Down
5 changes: 5 additions & 0 deletions addon/components/hyper-table-v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { tracked } from '@glimmer/tracking';
import { action, set } from '@ember/object';
import { debounce, scheduleOnce } from '@ember/runloop';
import { isEmpty } from '@ember/utils';
import { htmlSafe } from '@ember/template';

import TableHandler from '@upfluence/hypertable/core/handler';
import { Column, Row } from '@upfluence/hypertable/core/interfaces';
Expand Down Expand Up @@ -153,6 +154,10 @@ export default class HyperTableV2 extends Component<HyperTableV2Args> {
window.location.reload();
}

get columnsCountStyle(): ReturnType<typeof htmlSafe> {
return htmlSafe(`--hypertable-responsive-columns-number: ${this.args.handler.columns.length - 1}`);
}

private _resetFilters(): void {
this.loadingResetFilters = true;
this.args.handler.resetColumns(this.args.handler.columns).finally(() => {
Expand Down

0 comments on commit 8b15f3d

Please sign in to comment.