From 34f11f9298640352e252e5c1df6d6869ffbb978f Mon Sep 17 00:00:00 2001 From: cipchk Date: Fri, 11 Oct 2024 18:39:00 +0700 Subject: [PATCH 1/2] fix(abc:st): a more friendly expandIcon - close https://github.com/ng-alain/ng-alain/issues/2507 --- packages/abc/st/demo/expand.md | 18 ++++++++++++++++-- packages/abc/st/st.component.html | 7 ++++++- packages/abc/st/st.component.ts | 2 +- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/packages/abc/st/demo/expand.md b/packages/abc/st/demo/expand.md index 0542207b27..96bdc5422a 100644 --- a/packages/abc/st/demo/expand.md +++ b/packages/abc/st/demo/expand.md @@ -17,20 +17,34 @@ Use `#expand` template implement expandable, allowing you to receive three value import { Component } from '@angular/core'; import { STColumn, STData, STModule } from '@delon/abc/st'; +import { NzButtonComponent } from 'ng-zorro-antd/button'; +import { NzIconDirective } from 'ng-zorro-antd/icon'; @Component({ selector: 'app-demo', template: ` - + + {{ item.description }} + + + `, standalone: true, - imports: [STModule] + imports: [STModule, NzIconDirective, NzButtonComponent] }) export class DemoComponent { + customIcon = false; users: STData[] = Array(10) .fill({}) .map((_, idx) => ({ diff --git a/packages/abc/st/st.component.html b/packages/abc/st/st.component.html index 931c1f07c2..1f0b3f7fa5 100644 --- a/packages/abc/st/st.component.html +++ b/packages/abc/st/st.component.html @@ -160,11 +160,16 @@ + + + + + } @for (c of _columns; track cIdx; let cIdx = $index) { @if (i._values[cIdx].props?.colSpan > 0 && i._values[cIdx].props?.rowSpan > 0) { diff --git a/packages/abc/st/st.component.ts b/packages/abc/st/st.component.ts index 340bf8bc7f..a2a2af6611 100644 --- a/packages/abc/st/st.component.ts +++ b/packages/abc/st/st.component.ts @@ -214,7 +214,7 @@ export class STComponent implements AfterViewInit, OnChanges { @Input({ transform: booleanAttribute }) expandRowByClick = false; @Input({ transform: booleanAttribute }) expandAccordion = false; @Input() expand: TemplateRef<{ $implicit: NzSafeAny; index: number }> | null = null; - @Input() expandIcon: TemplateRef | null = null; + @Input() expandIcon: TemplateRef<{ $implicit: NzSafeAny; index: number }> | null = null; @Input() noResult?: string | TemplateRef | null; @Input({ transform: booleanAttribute }) responsive: boolean = true; @Input({ transform: booleanAttribute }) responsiveHideHeaderFooter?: boolean; From 549b0781cf1671592741fda42c11494ff692e713 Mon Sep 17 00:00:00 2001 From: cipchk Date: Fri, 11 Oct 2024 18:42:39 +0700 Subject: [PATCH 2/2] docs: update --- packages/abc/st/index.en-US.md | 4 ++-- packages/abc/st/index.zh-CN.md | 4 ++-- packages/abc/st/st.component.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/abc/st/index.en-US.md b/packages/abc/st/index.en-US.md index f0f18dae80..673f10d06f 100644 --- a/packages/abc/st/index.en-US.md +++ b/packages/abc/st/index.en-US.md @@ -82,8 +82,8 @@ When an exception is thrown when parsing column data, *INVALID DATA* will be for | `[widthConfig]` | Set col width can not used with width of STColumn | `string[]` | - | - | | `[expandRowByClick]` | Whether to expand row by clicking anywhere in the whole row | `boolean` | `false` | ✅ | | `[expandAccordion]` | Accordion mode | `boolean` | `false` | ✅ | -| `[expand]` | Whether current column include expand icon | `TemplateRef` | - | - | -| `[expandIcon]` | Custom expand icon | `TemplateRef` | - | +| `[expand]` | Whether current column include expand icon | `TemplateRef<{ $implicit: STData; index: number }>` | - | - | +| `[expandIcon]` | Custom expand icon | `TemplateRef<{ $implicit: STData; index: number }>` | - | | `[responsive]` | Whether to turn on responsive | `boolean` | `true` | ✅ | | `[responsiveHideHeaderFooter]` | Whether to display the header and footer under the small screen | `boolean` | `false` | ✅ | | `[resizable]` | Resize header of the current table, **Multiple headers not supported** | `STResizable, boolean` | - | - | diff --git a/packages/abc/st/index.zh-CN.md b/packages/abc/st/index.zh-CN.md index 73bd8815e3..a7eb83c233 100644 --- a/packages/abc/st/index.zh-CN.md +++ b/packages/abc/st/index.zh-CN.md @@ -82,8 +82,8 @@ module: import { STModule } from '@delon/abc/st'; | `[widthConfig]` | 表头分组时指定每列宽度,与 STColumn 的 width 不可混用 | `string[]` | - | - | | `[expandRowByClick]` | 通过点击行来展开子行 | `boolean` | `false` | ✅ | | `[expandAccordion]` | 手风琴模式 | `boolean` | `false` | ✅ | -| `[expand]` | 当前列是否包含展开按钮,当数据源中包括 `expand` 表示展开状态 | `TemplateRef` | - | - | -| `[expandIcon]` | 自定义展开图标 | `TemplateRef` | - | +| `[expand]` | 当前列是否包含展开按钮,当数据源中包括 `expand` 表示展开状态 | `TemplateRef<{ $implicit: STData; index: number }>` | - | - | +| `[expandIcon]` | 自定义展开图标 | `TemplateRef<{ $implicit: STData; index: number }>` | - | | `[responsive]` | 是否开启响应式 | `boolean` | `true` | ✅ | | `[responsiveHideHeaderFooter]` | 是否在小屏幕下才显示顶部与底部 | `boolean` | `false` | ✅ | | `[resizable]` | 当前表格所有列的调整表头配置项,**不支持多表头** | `STResizable, boolean` | - | - | diff --git a/packages/abc/st/st.component.ts b/packages/abc/st/st.component.ts index a2a2af6611..f50a291798 100644 --- a/packages/abc/st/st.component.ts +++ b/packages/abc/st/st.component.ts @@ -213,8 +213,8 @@ export class STComponent implements AfterViewInit, OnChanges { @Input() body?: TemplateRef<{ $implicit: STStatisticalResults }> | null; @Input({ transform: booleanAttribute }) expandRowByClick = false; @Input({ transform: booleanAttribute }) expandAccordion = false; - @Input() expand: TemplateRef<{ $implicit: NzSafeAny; index: number }> | null = null; - @Input() expandIcon: TemplateRef<{ $implicit: NzSafeAny; index: number }> | null = null; + @Input() expand: TemplateRef<{ $implicit: STData; index: number }> | null = null; + @Input() expandIcon: TemplateRef<{ $implicit: STData; index: number }> | null = null; @Input() noResult?: string | TemplateRef | null; @Input({ transform: booleanAttribute }) responsive: boolean = true; @Input({ transform: booleanAttribute }) responsiveHideHeaderFooter?: boolean;