Skip to content

Commit

Permalink
fix: #WIK-17103 【AITable】不可编辑表格表头更多菜单点击显示空的弹窗 (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
icezeros authored Feb 11, 2025
1 parent aa94e11 commit 6f1f07e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
24 changes: 22 additions & 2 deletions packages/grid/src/core/context.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { Signal, WritableSignal } from '@angular/core';
import { AITableContext, AITableLinearRow, AITablePointPosition, AITableReferences, AITableScrollState, ScrollActionOptions } from '../types';
import {
AIFieldConfig,
AITableContext,
AITableLinearRow,
AITablePointPosition,
AITableReferences,
AITableScrollState,
ScrollActionOptions
} from '../types';

export class RendererContext {
linearRows: Signal<AITableLinearRow[]>;
Expand All @@ -9,10 +17,21 @@ export class RendererContext {
visibleRowsIndexMap: Signal<Map<string, number>>;
frozenColumnCount: Signal<number>;
references: Signal<AITableReferences>;
aiFieldConfig: Signal<AIFieldConfig | undefined>;
scrollAction: (options: ScrollActionOptions) => void;

constructor(options: AITableContext) {
const { linearRows, pointPosition, scrollState, visibleColumnsIndexMap, visibleRowsIndexMap, frozenColumnCount, references, scrollAction } = options;
const {
linearRows,
pointPosition,
scrollState,
visibleColumnsIndexMap,
visibleRowsIndexMap,
frozenColumnCount,
references,
aiFieldConfig,
scrollAction
} = options;
this.linearRows = linearRows;
this.pointPosition = pointPosition;
this.scrollState = scrollState;
Expand All @@ -21,6 +40,7 @@ export class RendererContext {
this.visibleRowsIndexMap = visibleRowsIndexMap;
this.frozenColumnCount = frozenColumnCount;
this.references = references;
this.aiFieldConfig = aiFieldConfig;
}

setPointPosition(position: Partial<AITablePointPosition>) {
Expand Down
1 change: 1 addition & 0 deletions packages/grid/src/grid.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export class AITableGrid extends AITableGridBase implements OnInit, OnDestroy {
scrollState: signal(DEFAULT_SCROLL_STATE),
frozenColumnCount: this.frozenColumnCount,
references: this.aiReferences,
aiFieldConfig: this.aiFieldConfig,
scrollAction: this.scrollAction
});
}
Expand Down
7 changes: 6 additions & 1 deletion packages/grid/src/renderer/creations/create-heads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ export const createColumnHeads = (config: AITableColumnHeadsConfig) => {
};

const fieldHeads: AITableFieldHeadConfig[] = [];
const fieldMenus = config.aiTable.context?.aiFieldConfig()?.fieldMenus || [];
let noMoreIcon = false;
if (fieldMenus.length === 0) {
noMoreIcon = true;
}
for (let columnIndex = columnStartIndex; columnIndex <= columnStopIndex; columnIndex++) {
if (columnIndex > columnCount - 1) break;
if (columnIndex < 0) continue;
Expand All @@ -36,7 +41,7 @@ export const createColumnHeads = (config: AITableColumnHeadsConfig) => {
height: fieldHeadHeight,
field,
stroke: columnIndex === 0 ? colors.transparent : undefined,
iconVisible,
iconVisible: noMoreIcon ? false : iconVisible,
isSelected,
isHoverIcon
};
Expand Down
1 change: 1 addition & 0 deletions packages/grid/src/types/grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,5 @@ export interface AITableContext {
visibleRowsIndexMap: Signal<Map<string, number>>;
frozenColumnCount: Signal<number>;
references: Signal<AITableReferences>;
aiFieldConfig: Signal<AIFieldConfig | undefined>;
}

0 comments on commit 6f1f07e

Please sign in to comment.