From 3091b7b82f79e1346edd875a973e5e3f39545b24 Mon Sep 17 00:00:00 2001 From: lukasnys Date: Thu, 11 Jul 2024 09:24:59 +0200 Subject: [PATCH] add ability to customise the select and collapse visualisation PR: https://github.com/Addepar/ember-table/pull/1107/ --- addon/components/ember-td/template.hbs | 50 ++++++++++++++---------- types/components/ember-td/component.d.ts | 8 ++++ 2 files changed, 37 insertions(+), 21 deletions(-) diff --git a/addon/components/ember-td/template.hbs b/addon/components/ember-td/template.hbs index 4cbab5045..4678a15d5 100644 --- a/addon/components/ember-td/template.hbs +++ b/addon/components/ember-td/template.hbs @@ -1,30 +1,38 @@ {{#if this.isFirstColumn}}
{{#if this.canSelect}} - - - - + {{#if (has-block "select")}} + {{yield this.rowMeta (action "onSelectionToggled") to="select"}} + {{else}} + + + + + {{/if}} {{/if}} {{#if this.canCollapse}} - - - - + {{#if (has-block "collapse")}} + {{yield this.rowMeta (action "onCollapseToggled") to="collapse"}} + {{else}} + + + + + {{/if}} {{else}}
{{/if}} diff --git a/types/components/ember-td/component.d.ts b/types/components/ember-td/component.d.ts index 774b0ffe7..c42cc0aa3 100644 --- a/types/components/ember-td/component.d.ts +++ b/types/components/ember-td/component.d.ts @@ -23,6 +23,14 @@ export interface EmberTdSignature { columnMeta: unknown, rowMeta: TableRowMeta, ]; + select?: [ + rowMeta: TableRowMeta, + onSelectionToggled: () => void, + ]; + collapse?: [ + rowMeta: TableRowMeta, + onCollapseToggled: () => void, + ]; }; }