Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sheet): set bottom by default for vertical align #1929

Merged
merged 3 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,11 @@ export class FormulaDependencyTree extends Disposable {
}

const sheetRangeMap = dependencyRangeList.get(unitId)!;

if (!sheetRangeMap.has(sheetId)) {
continue;
}

const dependencyRanges = sheetRangeMap.get(sheetId)!;

const excludedCell = unitExcludedCell?.[unitId]?.[sheetId];

let {
Expand All @@ -166,28 +164,20 @@ export class FormulaDependencyTree extends Disposable {
if (Number.isNaN(rangeStartRow)) {
rangeStartRow = 0;
}

if (Number.isNaN(rangeStartColumn)) {
rangeStartColumn = 0;
}

if (Number.isNaN(rangeEndRow)) {
rangeEndRow = Number.POSITIVE_INFINITY;
}

if (Number.isNaN(rangeEndColumn)) {
rangeEndColumn = Number.POSITIVE_INFINITY;
}

for (const dependencyRange of dependencyRanges) {
const { startRow, startColumn, endRow, endColumn } = dependencyRange;

if (
rangeStartRow > endRow ||
rangeEndRow < startRow ||
rangeStartColumn > endColumn ||
rangeEndColumn < startColumn
) {
if (rangeStartRow > endRow || rangeEndRow < startRow || rangeStartColumn > endColumn || rangeEndColumn < startColumn) {
continue;
} else {
let isInclude = true;
Expand All @@ -196,12 +186,7 @@ export class FormulaDependencyTree extends Disposable {
* This is because its impact was already considered during the first calculation.
*/
excludedCell?.forValue((row, column) => {
if (
row >= rangeStartRow &&
row <= rangeEndRow &&
column >= rangeStartColumn &&
column <= rangeEndColumn
) {
if (row >= rangeStartRow && row <= rangeEndRow && column >= rangeStartColumn && column <= rangeEndColumn) {
isInclude = false;
return false;
}
Expand All @@ -213,7 +198,6 @@ export class FormulaDependencyTree extends Disposable {
}
}
}

return false;
}

Expand Down
6 changes: 3 additions & 3 deletions packages/sheets-ui/src/controllers/menu/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ export function VerticalAlignMenuItemFactory(accessor: IAccessor): IMenuSelector
type: MenuItemType.SELECTOR,
positions: [MenuPosition.TOOLBAR_START],
selections: VERTICAL_ALIGN_CHILDREN,
value$: deriveStateFromActiveSheet$(univerInstanceService, VerticalAlign.TOP, ({ worksheet }) => new Observable<VerticalAlign>((subscriber) => {
value$: deriveStateFromActiveSheet$(univerInstanceService, VerticalAlign.BOTTOM, ({ worksheet }) => new Observable<VerticalAlign>((subscriber) => {
const disposable = accessor.get(ICommandService).onCommandExecuted((c) => {
const id = c.id;
if (id !== SetVerticalTextAlignCommand.id && id !== SetSelectionsOperation.id && id !== SetWorksheetActiveOperation.id) {
Expand All @@ -700,7 +700,7 @@ export function VerticalAlignMenuItemFactory(accessor: IAccessor): IMenuSelector
va = range?.getVerticalAlignment();
}

subscriber.next(va ?? VerticalAlign.TOP);
subscriber.next(va ?? VerticalAlign.BOTTOM);
});

const primary = selectionManagerService.getLast()?.primary;
Expand All @@ -710,7 +710,7 @@ export function VerticalAlignMenuItemFactory(accessor: IAccessor): IMenuSelector
va = range?.getVerticalAlignment();
}

subscriber.next(va ?? VerticalAlign.TOP);
subscriber.next(va ?? VerticalAlign.BOTTOM);

return disposable.dispose;
})),
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/src/services/menu/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import type { Observable } from 'rxjs';

export type OneOrMany<T> = T | T[];

export const enum MenuPosition {
export enum MenuPosition {
VOID = 'void',
TOOLBAR_START = 'uiToolbar.start',
TOOLBAR_INSERT = 'uiToolbar.insert',
Expand All @@ -30,7 +30,7 @@ export const enum MenuPosition {
CONTEXT_MENU = 'contextMenu',
}

export const enum MenuGroup {
export enum MenuGroup {
TOOLBAR_HISTORY,
TOOLBAR_FORMAT,
TOOLBAR_LAYOUT,
Expand All @@ -45,7 +45,7 @@ export const enum MenuGroup {
CONTEXT_MENU_OTHERS,
}

export const enum MenuItemType {
export enum MenuItemType {
/** Button style menu item. */
BUTTON,
/** Menu item with submenus. Submenus could be other IMenuItem or an ID of a registered component. */
Expand Down
Loading