From e1c418e66457e0b8964f6e64f56768641ef06ec3 Mon Sep 17 00:00:00 2001 From: wumeimin0107 <321512939@qq.com> Date: Wed, 18 Dec 2024 16:22:31 +0800 Subject: [PATCH] fix(grid): should show icon in front of action button (#199) --- .../src/components/context-menu/context-menu.component.html | 2 +- src/app/component/common/content/content.component.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/grid/src/components/context-menu/context-menu.component.html b/packages/grid/src/components/context-menu/context-menu.component.html index 60a87d98..58e7cc16 100644 --- a/packages/grid/src/components/context-menu/context-menu.component.html +++ b/packages/grid/src/components/context-menu/context-menu.component.html @@ -8,7 +8,7 @@ (click)="execute(menu)" [thyDisabled]="disabled" > - + {{ menu.name }} } diff --git a/src/app/component/common/content/content.component.ts b/src/app/component/common/content/content.component.ts index d5481d95..4798e3ed 100644 --- a/src/app/component/common/content/content.component.ts +++ b/src/app/component/common/content/content.component.ts @@ -65,6 +65,7 @@ export class DemoTableContent { aiFieldConfig: Signal = computed(() => { const readonly = this.tableService.readonly(); + const onlyOneField = this.tableService.fields().length === 1; return { fieldRenderers: { [AITableFieldType.date]: { @@ -94,14 +95,14 @@ export class DemoTableContent { hidden: (aiTable: AITable, field: Signal) => false, disabled: (aiTable: AITable, field: Signal) => false }, - { ...DividerMenuItem, hidden: () => readonly }, + { ...DividerMenuItem, hidden: () => readonly || onlyOneField }, { ...buildRemoveFieldItem(() => { const member = 'member_03'; const time = new Date().getTime(); return { updated_at: time, updated_by: member }; }), - hidden: () => readonly + hidden: () => readonly || onlyOneField } ] };