mirror of
https://github.com/dream-num/univer.git
synced 2026-09-24 15:32:18 +08:00
fix(ui): fix missing context menu items (#3758)
This commit is contained in:
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 108 KiB |
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { IAccessor, ICommand } from '@univerjs/core';
|
||||
import { CommandType, ICommandService, LocaleService } from '@univerjs/core';
|
||||
import { IConfirmService } from '@univerjs/ui';
|
||||
import type { IAccessor, ICommand } from '@univerjs/core';
|
||||
import { COMPONENT_DOC_CREATE_TABLE_CONFIRM } from '../../views/table/create/component-name';
|
||||
import { CreateDocTableCommand } from '../commands/table/doc-table-create.command';
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ContextMenuGroup, ContextMenuPosition, RibbonStartGroup } from '@univerjs/ui';
|
||||
import type { MenuSchemaType } from '@univerjs/ui';
|
||||
import { ContextMenuGroup, ContextMenuPosition, RibbonStartGroup } from '@univerjs/ui';
|
||||
import { DocCopyCommand, DocCutCommand, DocPasteCommand } from '../commands/commands/clipboard.command';
|
||||
import { DeleteLeftCommand } from '../commands/commands/delete.command';
|
||||
import { OpenHeaderFooterPanelCommand } from '../commands/commands/doc-header-footer.command';
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { IAccessor } from '@univerjs/core';
|
||||
import type { IRectRangeWithStyle } from '@univerjs/engine-render';
|
||||
import type { IMenuButtonItem, IMenuSelectorItem } from '@univerjs/ui';
|
||||
import { IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
|
||||
import { DocSelectionManagerService } from '@univerjs/docs';
|
||||
import { getMenuHiddenObservable, MenuItemType } from '@univerjs/ui';
|
||||
import { combineLatest, Observable } from 'rxjs';
|
||||
import type { IAccessor } from '@univerjs/core';
|
||||
import type { IRectRangeWithStyle } from '@univerjs/engine-render';
|
||||
import type { IMenuButtonItem, IMenuSelectorItem } from '@univerjs/ui';
|
||||
import { DocCopyCommand, DocCutCommand, DocPasteCommand } from '../../commands/commands/clipboard.command';
|
||||
import { DeleteLeftCommand } from '../../commands/commands/delete.command';
|
||||
import { DocTableDeleteColumnsCommand, DocTableDeleteRowsCommand, DocTableDeleteTableCommand } from '../../commands/commands/table/doc-table-delete.command';
|
||||
@@ -85,6 +85,8 @@ const getDisableWhenSelectionNotInTableObservable = (accessor: IAccessor) => {
|
||||
subscriber.next(true);
|
||||
});
|
||||
|
||||
subscriber.next(true);
|
||||
|
||||
return () => observable.unsubscribe();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { MenuSchemaType } from '@univerjs/ui';
|
||||
import {
|
||||
AddWorksheetMergeAllCommand,
|
||||
AddWorksheetMergeCommand,
|
||||
@@ -42,7 +43,6 @@ import {
|
||||
SetWorksheetRowIsAutoHeightCommand,
|
||||
} from '@univerjs/sheets';
|
||||
import { ContextMenuGroup, ContextMenuPosition, RibbonStartGroup } from '@univerjs/ui';
|
||||
import type { MenuSchemaType } from '@univerjs/ui';
|
||||
import {
|
||||
SheetCopyCommand,
|
||||
// SheetCutCommand,
|
||||
|
||||
@@ -34,7 +34,7 @@ import { CheckMarkSingle, MoreSingle } from '@univerjs/icons';
|
||||
import clsx from 'clsx';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
|
||||
import { combineLatest, isObservable, map, Observable } from 'rxjs';
|
||||
import { combineLatest, isObservable, Observable } from 'rxjs';
|
||||
import { ILayoutService } from '../../../services/layout/layout.service';
|
||||
import { MenuItemType } from '../../../services/menu/menu';
|
||||
import { IMenuManagerService } from '../../../services/menu/menu-manager.service';
|
||||
@@ -74,18 +74,19 @@ function MenuWrapper(props: IBaseMenuProps) {
|
||||
if (!item.children) return item;
|
||||
|
||||
let hasChildren = false;
|
||||
const hiddenObservables = item.children?.map((item) => item.item?.hidden$ ?? new Observable<boolean>((n) => n.next(false)));
|
||||
const hiddenObservables = item.children?.map((subItem) => {
|
||||
return subItem.item?.hidden$ ?? new Observable<boolean>((s) => {
|
||||
s.next(false);
|
||||
return s.unsubscribe();
|
||||
});
|
||||
});
|
||||
combineLatest(hiddenObservables).subscribe((hiddenValues) => {
|
||||
hasChildren = hiddenValues.every((hidden) => hidden === true);
|
||||
|
||||
combineLatest(hiddenObservables)
|
||||
.pipe(
|
||||
map((hiddenValues) => hiddenValues.every((hidden) => hidden === true))
|
||||
)
|
||||
.subscribe((allHidden) => {
|
||||
if (!allHidden) {
|
||||
hasChildren = true;
|
||||
}
|
||||
})
|
||||
.unsubscribe();
|
||||
if (!hasChildren) {
|
||||
hasChildren = true;
|
||||
}
|
||||
}).unsubscribe();
|
||||
|
||||
return hasChildren;
|
||||
});
|
||||
|
||||
@@ -14,18 +14,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { connectInjector, Disposable, toDisposable } from '@univerjs/core';
|
||||
import { type IDisposable, Inject, Injector } from '@univerjs/core';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
import type { IConfirmPartMethodOptions } from '../../views/components/confirm-part/interface';
|
||||
import { BuiltInUIPart, IUIPartsService } from '../parts/parts.service';
|
||||
import { ConfirmPart } from '../../views/components/confirm-part/ConfirmPart';
|
||||
import type { IConfirmService } from './confirm.service';
|
||||
import { connectInjector, Disposable, toDisposable } from '@univerjs/core';
|
||||
|
||||
import { type IDisposable, Inject, Injector } from '@univerjs/core';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { ConfirmPart } from '../../views/components/confirm-part/ConfirmPart';
|
||||
import { BuiltInUIPart, IUIPartsService } from '../parts/parts.service';
|
||||
|
||||
export class DesktopConfirmService extends Disposable implements IConfirmService {
|
||||
private _confirmOptions: IConfirmPartMethodOptions[] = [];
|
||||
readonly confirmOptions$ = new Subject<IConfirmPartMethodOptions[]>();
|
||||
readonly confirmOptions$ = new BehaviorSubject<IConfirmPartMethodOptions[]>([]);
|
||||
|
||||
constructor(
|
||||
@Inject(Injector) protected readonly _injector: Injector,
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
|
||||
import type { IAccessor, Nullable } from '@univerjs/core';
|
||||
import { createIdentifier, Disposable, IConfigService, Inject, Injector, Tools } from '@univerjs/core';
|
||||
import type { Observable } from 'rxjs';
|
||||
import { Subject } from 'rxjs';
|
||||
import type { IMenuItem } from '../menu/menu';
|
||||
import { createIdentifier, Disposable, IConfigService, Inject, Injector, Tools } from '@univerjs/core';
|
||||
import { Subject } from 'rxjs';
|
||||
import { mergeMenuConfigs } from '../../common/menu-merge-configs';
|
||||
import { ContextMenuGroup, ContextMenuPosition, MenuManagerPosition, RibbonDataGroup, RibbonFormulasGroup, RibbonInsertGroup, RibbonOthersGroup, RibbonPosition, RibbonStartGroup, RibbonViewGroup } from './types';
|
||||
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
|
||||
import type { IConfirmProps } from '@univerjs/design';
|
||||
import { Confirm } from '@univerjs/design';
|
||||
import type { IConfirmPartMethodOptions } from './interface';
|
||||
import { useDependency } from '@univerjs/core';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Confirm } from '@univerjs/design';
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { CustomLabel } from '../../../components/custom-label/CustomLabel';
|
||||
import { IConfirmService } from '../../../services/confirm/confirm.service';
|
||||
import type { IConfirmPartMethodOptions } from './interface';
|
||||
|
||||
export function ConfirmPart() {
|
||||
const confirmService = useDependency(IConfirmService);
|
||||
|
||||
Reference in New Issue
Block a user