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(ui): fix display values for certain menu items #3522

Merged
merged 1 commit into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
68 changes: 34 additions & 34 deletions packages/sheets-ui/src/controllers/menu.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
*/

import type { MenuSchemaType } from '@univerjs/ui';
import { ContextMenuGroup, ContextMenuPosition, RibbonStartGroup } from '@univerjs/ui';
import {
AddWorksheetMergeAllCommand,
AddWorksheetMergeCommand,
Expand Down Expand Up @@ -43,16 +41,8 @@ import {
SetVerticalTextAlignCommand, SetWorksheetHideCommand,
SetWorksheetRowIsAutoHeightCommand,
} from '@univerjs/sheets';
import { SetOnceFormatPainterCommand } from '../commands/commands/set-format-painter.command';
import {
SetRangeBoldCommand,
SetRangeFontFamilyCommand,
SetRangeFontSizeCommand,
SetRangeItalicCommand,
SetRangeStrickThroughCommand,
SetRangeTextColorCommand,
SetRangeUnderlineCommand,
} from '../commands/commands/inline-format.command';
import { ContextMenuGroup, ContextMenuPosition, RibbonStartGroup } from '@univerjs/ui';
import type { MenuSchemaType } from '@univerjs/ui';
import {
SheetCopyCommand,
// SheetCutCommand,
Expand All @@ -62,12 +52,20 @@ import {
SheetPasteFormatCommand,
SheetPasteValueCommand,
} from '../commands/commands/clipboard.command';
import { InsertRangeMoveRightConfirmCommand } from '../commands/commands/insert-range-move-right-confirm.command';
import { InsertRangeMoveDownConfirmCommand } from '../commands/commands/insert-range-move-down-confirm.command';
import { RemoveColConfirmCommand, RemoveRowConfirmCommand } from '../commands/commands/remove-row-col-confirm.command';
import { DeleteRangeMoveLeftConfirmCommand } from '../commands/commands/delete-range-move-left-confirm.command';
import { DeleteRangeMoveUpConfirmCommand } from '../commands/commands/delete-range-move-up-confirm.command';
import { CancelFrozenCommand, SetColumnFrozenCommand, SetRowFrozenCommand, SetSelectionFrozenCommand } from '../commands/commands/set-frozen.command';
import { HideColConfirmCommand, HideRowConfirmCommand } from '../commands/commands/hide-row-col-confirm.command';
import {
SetRangeBoldCommand,
SetRangeFontFamilyCommand,
SetRangeFontSizeCommand,
SetRangeItalicCommand,
SetRangeStrickThroughCommand,
SetRangeTextColorCommand,
SetRangeUnderlineCommand,
} from '../commands/commands/inline-format.command';
import { InsertRangeMoveDownConfirmCommand } from '../commands/commands/insert-range-move-down-confirm.command';
import { InsertRangeMoveRightConfirmCommand } from '../commands/commands/insert-range-move-right-confirm.command';
import {
AddRangeProtectionFromContextMenuCommand,
AddRangeProtectionFromSheetBarCommand,
Expand All @@ -77,14 +75,32 @@ import {
ViewSheetPermissionFromContextMenuCommand,
ViewSheetPermissionFromSheetBarCommand,
} from '../commands/commands/range-protection.command';
import { HideColConfirmCommand, HideRowConfirmCommand } from '../commands/commands/hide-row-col-confirm.command';
import { RemoveColConfirmCommand, RemoveRowConfirmCommand } from '../commands/commands/remove-row-col-confirm.command';
import { RemoveSheetConfirmCommand } from '../commands/commands/remove-sheet-confirm.command';
import { RenameSheetOperation } from '../commands/operations/rename-sheet.operation';
import { SetOnceFormatPainterCommand } from '../commands/commands/set-format-painter.command';
import { CancelFrozenCommand, SetColumnFrozenCommand, SetRowFrozenCommand, SetSelectionFrozenCommand } from '../commands/commands/set-frozen.command';
import { ShowMenuListCommand } from '../commands/commands/unhide.command';
import {
ChangeSheetProtectionFromSheetBarCommand,
DeleteWorksheetProtectionFormSheetBarCommand,
} from '../commands/commands/worksheet-protection.command';
import { RenameSheetOperation } from '../commands/operations/rename-sheet.operation';
import { CellBorderSelectorMenuItemFactory } from './menu/border.menu';
import { CLEAR_SELECTION_MENU_ID, ClearSelectionAllMenuItemFactory, ClearSelectionContentMenuItemFactory, ClearSelectionFormatMenuItemFactory, ClearSelectionMenuItemFactory } from './menu/clear.menu';
import { DELETE_RANGE_MENU_ID, DeleteRangeMenuItemFactory, DeleteRangeMoveLeftMenuItemFactory, DeleteRangeMoveUpMenuItemFactory, RemoveColMenuItemFactory, RemoveRowMenuItemFactory } from './menu/delete.menu';
import {
CELL_INSERT_MENU_ID,
CellInsertMenuItemFactory,
COL_INSERT_MENU_ID,
ColInsertMenuItemFactory,
InsertColAfterMenuItemFactory,
InsertColBeforeMenuItemFactory,
InsertRangeMoveDownMenuItemFactory,
InsertRangeMoveRightMenuItemFactory,
InsertRowAfterMenuItemFactory,
InsertRowBeforeMenuItemFactory,
ROW_INSERT_MENU_ID, RowInsertMenuItemFactory,
} from './menu/insert.menu';
import {
BackgroundColorSelectorMenuItemFactory,
BoldMenuItemFactory,
Expand Down Expand Up @@ -128,22 +144,6 @@ import {
WrapTextMenuItemFactory,
} from './menu/menu';
import { CellMergeAllMenuItemFactory, CellMergeCancelMenuItemFactory, CellMergeHorizontalMenuItemFactory, CellMergeMenuItemFactory, CellMergeVerticalMenuItemFactory } from './menu/merge.menu';
import { CellBorderSelectorMenuItemFactory } from './menu/border.menu';
import { CLEAR_SELECTION_MENU_ID, ClearSelectionAllMenuItemFactory, ClearSelectionContentMenuItemFactory, ClearSelectionFormatMenuItemFactory, ClearSelectionMenuItemFactory } from './menu/clear.menu';
import {
CELL_INSERT_MENU_ID,
CellInsertMenuItemFactory,
COL_INSERT_MENU_ID,
ColInsertMenuItemFactory,
InsertColAfterMenuItemFactory,
InsertColBeforeMenuItemFactory,
InsertRangeMoveDownMenuItemFactory,
InsertRangeMoveRightMenuItemFactory,
InsertRowAfterMenuItemFactory,
InsertRowBeforeMenuItemFactory,
ROW_INSERT_MENU_ID, RowInsertMenuItemFactory,
} from './menu/insert.menu';
import { DELETE_RANGE_MENU_ID, DeleteRangeMenuItemFactory, DeleteRangeMoveLeftMenuItemFactory, DeleteRangeMoveUpMenuItemFactory, RemoveColMenuItemFactory, RemoveRowMenuItemFactory } from './menu/delete.menu';
import {
SHEET_PERMISSION_CONTEXT_MENU_ID,
sheetPermissionAddProtectContextMenuFactory,
Expand Down
6 changes: 4 additions & 2 deletions packages/ui/src/components/custom-label/CustomLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export function CustomLabel(props: ICustomLabelProps): JSX.Element | null {
let index = 0;

useEffect(() => {
setRealValue(value);

if (value$) {
const subscription = value$.subscribe((v) => {
setRealValue(v);
Expand All @@ -57,7 +59,7 @@ export function CustomLabel(props: ICustomLabelProps): JSX.Element | null {
subscription.unsubscribe();
};
}
}, []);
}, [value, value$]);

useEffect(() => {
let subscription = null;
Expand All @@ -72,7 +74,7 @@ export function CustomLabel(props: ICustomLabelProps): JSX.Element | null {
return () => {
subscription?.unsubscribe();
};
}, []);
}, [icon]);

// if value is not valid, use primary color
let isValid = false;
Expand Down
Loading