Skip to content

Commit

Permalink
Merge pull request #695 from revolist/type-selection
Browse files Browse the repository at this point in the history
feat: provided extra type info for selection
  • Loading branch information
m2a2x authored Feb 25, 2025
2 parents c10e886 + 529394d commit 293c9e1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/revoGrid/revo-grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ export class RevoGridComponent {
/**
* Get the currently selected Range.
*/
@Method() async getSelectedRange(): Promise<RangeArea | null> {
@Method() async getSelectedRange(): Promise<RangeArea & AllDimensionType | null> {
return this.viewport?.getSelectedRange() ?? null;
}

Expand Down
26 changes: 24 additions & 2 deletions src/components/revoGrid/viewport.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { CONTENT_SLOT, FOOTER_SLOT, HEADER_SLOT, viewportDataPartition, VPPartit
import ColumnDataProvider from '../../services/column.data.provider';
import { DataProvider } from '../../services/data.provider';
import type {
AllDimensionType,
Cell,
ColumnRegular,
DimensionCols,
Expand Down Expand Up @@ -324,8 +325,29 @@ export default class ViewportService {
}
}

getSelectedRange(): RangeArea | null | undefined {
return this.config.selectionStoreConnector.selectedRange;
getSelectedRange(): RangeArea & AllDimensionType | null | undefined {

const focused = this.config.selectionStoreConnector.focusedStore;
if (!focused) {
return null;
}
// get column data
const colType =
this.config.selectionStoreConnector.storesXToType[focused.position.x];

// get row data
const rowType =
this.config.selectionStoreConnector.storesYToType[focused.position.y];

const range = focused.entity.store.get('range');
if (!range) {
return null;
}
return {
...range,
colType,
rowType,
}
}

setEdit(
Expand Down

0 comments on commit 293c9e1

Please sign in to comment.