mirror of
https://github.com/dream-num/univer.git
synced 2026-09-24 15:32:18 +08:00
refactor: data-validation model (#3383)
This commit is contained in:
@@ -139,6 +139,8 @@ const dataValidation: IDataValidationRule[] = [
|
||||
startColumn: 0,
|
||||
endColumn: 5,
|
||||
}],
|
||||
formula1: 'TRUE',
|
||||
formula2: 'FALSE',
|
||||
},
|
||||
{
|
||||
uid: 'xxx-3',
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { Plugin, PluginCtor } from '@univerjs/core';
|
||||
import { UniverActionRecorderPlugin } from '@univerjs/action-recorder';
|
||||
import { UniverSheetsCrosshairHighlightPlugin } from '@univerjs/sheets-crosshair-highlight';
|
||||
import { UniverSheetsFilterUIPlugin } from '@univerjs/sheets-filter-ui';
|
||||
import { UniverSheetsFindReplacePlugin } from '@univerjs/sheets-find-replace';
|
||||
import { UniverSheetsCrosshairHighlightPlugin } from '@univerjs/sheets-crosshair-highlight';
|
||||
import { UniverUniscriptPlugin } from '@univerjs/uniscript';
|
||||
import { UniverActionRecorderPlugin } from '@univerjs/action-recorder';
|
||||
import type { Plugin, PluginCtor } from '@univerjs/core';
|
||||
|
||||
export default function getLazyPlugins(): Array<[PluginCtor<Plugin>] | [PluginCtor<Plugin>, unknown]> {
|
||||
return [
|
||||
|
||||
+24
-20
@@ -14,36 +14,36 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { Nullable } from '@univerjs/core';
|
||||
import { LocaleType, LogLevel, Univer, UniverInstanceType, UserManagerService } from '@univerjs/core';
|
||||
import { UniverRenderEnginePlugin } from '@univerjs/engine-render';
|
||||
import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
|
||||
import { UniverDebuggerPlugin } from '@univerjs/debugger';
|
||||
import { defaultTheme } from '@univerjs/design';
|
||||
import { UniverUIPlugin } from '@univerjs/ui';
|
||||
import { UniverDocsPlugin } from '@univerjs/docs';
|
||||
import { UniverDocsUIPlugin } from '@univerjs/docs-ui';
|
||||
import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
|
||||
import { UniverRenderEnginePlugin } from '@univerjs/engine-render';
|
||||
import { FUniver } from '@univerjs/facade';
|
||||
import { UniverRPCMainThreadPlugin } from '@univerjs/rpc';
|
||||
import { UniverSheetsPlugin } from '@univerjs/sheets';
|
||||
import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';
|
||||
import { UniverSheetsConditionalFormattingPlugin } from '@univerjs/sheets-conditional-formatting';
|
||||
import { UniverSheetsConditionalFormattingUIPlugin } from '@univerjs/sheets-conditional-formatting-ui';
|
||||
|
||||
import { UniverDebuggerPlugin } from '@univerjs/debugger';
|
||||
import { UniverSheetsHyperLinkUIPlugin } from '@univerjs/sheets-hyper-link-ui';
|
||||
import type { IThreadCommentMentionDataSource } from '@univerjs/thread-comment-ui';
|
||||
import { IThreadCommentMentionDataService, UniverThreadCommentUIPlugin } from '@univerjs/thread-comment-ui';
|
||||
import { UniverSheetsThreadCommentPlugin } from '@univerjs/sheets-thread-comment';
|
||||
import type { IUniverRPCMainThreadConfig } from '@univerjs/rpc';
|
||||
import { UniverRPCMainThreadPlugin } from '@univerjs/rpc';
|
||||
import { UniverSheetsFormulaPlugin } from '@univerjs/sheets-formula';
|
||||
import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt';
|
||||
import { UniverSheetsDataValidationPlugin } from '@univerjs/sheets-data-validation';
|
||||
import { FUniver } from '@univerjs/facade';
|
||||
import { UniverSheetsZenEditorPlugin } from '@univerjs/sheets-zen-editor';
|
||||
import { UniverSheetsSortUIPlugin } from '@univerjs/sheets-sort-ui';
|
||||
import { UniverSheetsDrawingUIPlugin } from '@univerjs/sheets-drawing-ui';
|
||||
import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';
|
||||
import { enUS, ruRU, viVN, zhCN, zhTW } from '../locales';
|
||||
import { UniverSheetsFormulaPlugin } from '@univerjs/sheets-formula';
|
||||
import { UniverSheetsHyperLinkUIPlugin } from '@univerjs/sheets-hyper-link-ui';
|
||||
import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt';
|
||||
import { UniverSheetsSortUIPlugin } from '@univerjs/sheets-sort-ui';
|
||||
import { UniverSheetsThreadCommentPlugin } from '@univerjs/sheets-thread-comment';
|
||||
import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';
|
||||
import { UniverSheetsZenEditorPlugin } from '@univerjs/sheets-zen-editor';
|
||||
import { IThreadCommentMentionDataService, UniverThreadCommentUIPlugin } from '@univerjs/thread-comment-ui';
|
||||
import { UniverUIPlugin } from '@univerjs/ui';
|
||||
import type { Nullable } from '@univerjs/core';
|
||||
import type { IUniverRPCMainThreadConfig } from '@univerjs/rpc';
|
||||
import type { IThreadCommentMentionDataSource } from '@univerjs/thread-comment-ui';
|
||||
import { DEFAULT_WORKBOOK_DATA_DEMO } from '../data/sheets/demo/default-workbook-data-demo';
|
||||
import { enUS, ruRU, viVN, zhCN, zhTW } from '../locales';
|
||||
|
||||
/* eslint-disable-next-line node/prefer-global/process */
|
||||
const IS_E2E: boolean = !!process.env.IS_E2E;
|
||||
@@ -84,8 +84,12 @@ univer.registerPlugin(UniverSheetsFormulaPlugin, { notExecuteFormula: true });
|
||||
univer.registerPlugin(UniverSheetsFilterPlugin);
|
||||
// hyperlink
|
||||
univer.registerPlugin(UniverSheetsHyperLinkUIPlugin);
|
||||
// data validation
|
||||
univer.registerPlugin(UniverSheetsDataValidationPlugin);
|
||||
|
||||
// mock lazy load data validation
|
||||
setTimeout(() => {
|
||||
univer.registerPlugin(UniverSheetsDataValidationPlugin);
|
||||
}, 500);
|
||||
|
||||
// sort
|
||||
univer.registerPlugin(UniverSheetsSortUIPlugin);
|
||||
// condition formatting
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
*/
|
||||
|
||||
import { CommandType, type ICommand } from '@univerjs/core';
|
||||
import { IMessageService } from '@univerjs/ui';
|
||||
import { MessageType } from '@univerjs/design';
|
||||
import { IMessageService } from '@univerjs/ui';
|
||||
import { ActionReplayService } from '../../services/replay.service';
|
||||
|
||||
export const ReplayLocalRecordCommand: ICommand = {
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { IOperation } from '@univerjs/core';
|
||||
import { CommandType } from '@univerjs/core';
|
||||
import type { IOperation } from '@univerjs/core';
|
||||
import { ActionRecorderService } from '../../services/action-recorder.service';
|
||||
|
||||
export const OpenRecordPanelOperation: IOperation = {
|
||||
|
||||
+7
-7
@@ -15,16 +15,16 @@
|
||||
*/
|
||||
|
||||
import { connectInjector, Disposable, ICommandService, Inject, Injector } from '@univerjs/core';
|
||||
import { BuiltInUIPart, ComponentManager, IMenuManagerService, IUIPartsService } from '@univerjs/ui';
|
||||
import { CopySheetCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, DeltaColumnWidthCommand, DeltaRowHeightCommand, InsertColAfterCommand, InsertColBeforeCommand, InsertRowAfterCommand, InsertRowBeforeCommand, InsertSheetCommand, RemoveSheetCommand, SetFrozenCancelCommand, SetFrozenCommand, SetHorizontalTextAlignCommand, SetOverlineCommand, SetRangeProtectionCommand, SetRangeValuesCommand, SetSelectionsOperation, SetStrikeThroughCommand, SetStyleCommand, SetTextColorCommand, SetTextRotationCommand, SetTextWrapCommand, SetVerticalTextAlignCommand, SetWorksheetActivateCommand, SetWorksheetActiveOperation } from '@univerjs/sheets';
|
||||
import { SetRangeBoldCommand, SetRangeFontFamilyCommand, SetRangeFontSizeCommand, SetRangeItalicCommand, SetRangeStrickThroughCommand, SetRangeSubscriptCommand, SetRangeSuperscriptCommand, SetRangeTextColorCommand, SetRangeUnderlineCommand, SheetCopyCommand, SheetCutCommand, SheetPasteBesidesBorderCommand, SheetPasteColWidthCommand, SheetPasteCommand, SheetPasteFormatCommand, SheetPasteShortKeyCommand, SheetPasteValueCommand } from '@univerjs/sheets-ui';
|
||||
import { RemoveSheetFilterCommand, SetSheetFilterRangeCommand, SetSheetsFilterCriteriaCommand } from '@univerjs/sheets-filter-ui';
|
||||
import { RecordSingle } from '@univerjs/icons';
|
||||
import { CloseRecordPanelOperation, OpenRecordPanelOperation } from '../commands/operations/operation';
|
||||
import { RecorderPanel } from '../views/components/RecorderPanel';
|
||||
import { CopySheetCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, DeltaColumnWidthCommand, DeltaRowHeightCommand, InsertColAfterCommand, InsertColBeforeCommand, InsertRowAfterCommand, InsertRowBeforeCommand, InsertSheetCommand, RemoveSheetCommand, SetFrozenCancelCommand, SetFrozenCommand, SetHorizontalTextAlignCommand, SetOverlineCommand, SetRangeProtectionCommand, SetRangeValuesCommand, SetSelectionsOperation, SetStrikeThroughCommand, SetStyleCommand, SetTextColorCommand, SetTextRotationCommand, SetTextWrapCommand, SetVerticalTextAlignCommand, SetWorksheetActivateCommand, SetWorksheetActiveOperation } from '@univerjs/sheets';
|
||||
import { RemoveSheetFilterCommand, SetSheetFilterRangeCommand, SetSheetsFilterCriteriaCommand } from '@univerjs/sheets-filter-ui';
|
||||
import { SetRangeBoldCommand, SetRangeFontFamilyCommand, SetRangeFontSizeCommand, SetRangeItalicCommand, SetRangeStrickThroughCommand, SetRangeSubscriptCommand, SetRangeSuperscriptCommand, SetRangeTextColorCommand, SetRangeUnderlineCommand, SheetCopyCommand, SheetCutCommand, SheetPasteBesidesBorderCommand, SheetPasteColWidthCommand, SheetPasteCommand, SheetPasteFormatCommand, SheetPasteShortKeyCommand, SheetPasteValueCommand } from '@univerjs/sheets-ui';
|
||||
import { BuiltInUIPart, ComponentManager, IMenuManagerService, IUIPartsService } from '@univerjs/ui';
|
||||
import { CompleteRecordingActionCommand, StartRecordingActionCommand, StopRecordingActionCommand } from '../commands/commands/record.command';
|
||||
import { ActionRecorderService } from '../services/action-recorder.service';
|
||||
import { ReplayLocalRecordCommand } from '../commands/commands/replay.command';
|
||||
import { CloseRecordPanelOperation, OpenRecordPanelOperation } from '../commands/operations/operation';
|
||||
import { ActionRecorderService } from '../services/action-recorder.service';
|
||||
import { RecorderPanel } from '../views/components/RecorderPanel';
|
||||
import { menuSchema } from './action-recorder.menu';
|
||||
|
||||
export class ActionRecorderController extends Disposable {
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { Dependency } from '@univerjs/core';
|
||||
import { Inject, Injector, Plugin } from '@univerjs/core';
|
||||
import { ActionRecorderService } from './services/action-recorder.service';
|
||||
import type { Dependency } from '@univerjs/core';
|
||||
import { ActionRecorderController } from './controllers/action-recorder.controller';
|
||||
import { ActionRecorderService } from './services/action-recorder.service';
|
||||
import { ActionReplayService } from './services/replay.service';
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { ICommand, ICommandInfo, IDisposable, Nullable } from '@univerjs/core';
|
||||
import { CommandType, Disposable, ICommandService, ILogService } from '@univerjs/core';
|
||||
import { SetSelectionsOperation } from '@univerjs/sheets';
|
||||
import { ILocalFileService } from '@univerjs/ui';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import type { ICommand, ICommandInfo, IDisposable, Nullable } from '@univerjs/core';
|
||||
|
||||
/**
|
||||
* This service is for recording commands. What commands should be recorded can be configured by other
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { ICommandInfo } from '@univerjs/core';
|
||||
import { Disposable, ICommandService, ILogService, IUniverInstanceService } from '@univerjs/core';
|
||||
import { MessageType } from '@univerjs/design';
|
||||
import { ILocalFileService, IMessageService } from '@univerjs/ui';
|
||||
import type { ICommandInfo } from '@univerjs/core';
|
||||
|
||||
/**
|
||||
* This service is for replaying user actions.
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
*/
|
||||
|
||||
import { ICommandService, useDependency } from '@univerjs/core';
|
||||
import React, { useCallback } from 'react';
|
||||
import { useObservable } from '@univerjs/ui';
|
||||
import { Button } from '@univerjs/design';
|
||||
import { RecordSingle } from '@univerjs/icons';
|
||||
import { useObservable } from '@univerjs/ui';
|
||||
import clsx from 'clsx';
|
||||
import { ActionRecorderService } from '../../services/action-recorder.service';
|
||||
import React, { useCallback } from 'react';
|
||||
import { CompleteRecordingActionCommand, StartRecordingActionCommand, StopRecordingActionCommand } from '../../commands/commands/record.command';
|
||||
import { CloseRecordPanelOperation } from '../../commands/operations/operation';
|
||||
import { ActionRecorderService } from '../../services/action-recorder.service';
|
||||
import styles from './index.module.less';
|
||||
|
||||
export function RecorderPanel() {
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { IAccessor } from '@univerjs/core';
|
||||
import { BooleanNumber, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, ICommandService, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
|
||||
import { DocSelectionManagerService, DocSkeletonManagerService, SetTextSelectionsOperation } from '@univerjs/docs';
|
||||
import { SetInlineFormatCommand } from '@univerjs/docs-ui';
|
||||
import { DocumentEditArea, IRenderManagerService } from '@univerjs/engine-render';
|
||||
|
||||
import { getHeaderFooterMenuHiddenObservable, getMenuHiddenObservable, type IMenuButtonItem, type IMenuItem, MenuItemType } from '@univerjs/ui';
|
||||
|
||||
import { combineLatest, Observable } from 'rxjs';
|
||||
import type { IAccessor } from '@univerjs/core';
|
||||
|
||||
export const DOC_ITALIC_MUTATION_ID = 'doc.command.uni-italic';
|
||||
export const DOC_BOLD_MUTATION_ID = 'doc.command.uni-bold';
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
|
||||
import { ICommandService, IConfigService, Inject, Injector, IUniverInstanceService, LifecycleStages, OnLifecycle, UniverInstanceType } from '@univerjs/core';
|
||||
import { IMAGE_MENU_ID as DocsImageMenuId } from '@univerjs/docs-drawing-ui';
|
||||
import { BulletListCommand, DocCreateTableOperation, DocUIController, OrderListCommand, SetInlineFormatBoldCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatTextBackgroundColorCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand } from '@univerjs/docs-ui';
|
||||
import { ComponentManager, ILayoutService, IMenuManagerService, IShortcutService, IUIPartsService } from '@univerjs/ui';
|
||||
import { BuiltinUniToolbarItemId, generateCloneMutation, UniToolbarService } from '@univerjs/uniui';
|
||||
import { BulletListCommand, DocCreateTableOperation, DocUIController, OrderListCommand, SetInlineFormatBoldCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatTextBackgroundColorCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand } from '@univerjs/docs-ui';
|
||||
import { IMAGE_MENU_ID as DocsImageMenuId } from '@univerjs/docs-drawing-ui';
|
||||
import { DOC_BOLD_MUTATION_ID, DOC_ITALIC_MUTATION_ID, DOC_STRIKE_MUTATION_ID, DOC_TABLE_MUTATION_ID, DOC_UNDERLINE_MUTATION_ID } from './menu';
|
||||
import { menuSchema } from './menu.schema';
|
||||
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { ICommand, IDocumentBody, IMutationInfo } from '@univerjs/core';
|
||||
import { CommandType, CustomRangeType, generateRandomId, ICommandService, LocaleService, makeCustomRangeStream, sequenceExecute } from '@univerjs/core';
|
||||
import { makeSelection, replaceSelectionFactory } from '@univerjs/docs-ui';
|
||||
import type { IAddDocUniFormulaMutationParams, IRemoveDocUniFormulaMutationParams, IUpdateDocUniFormulaMutationParams } from '@univerjs/uni-formula';
|
||||
import { AddDocUniFormulaMutation, RemoveDocUniFormulaMutation, UpdateDocUniFormulaMutation } from '@univerjs/uni-formula';
|
||||
import type { ICommand, IDocumentBody, IMutationInfo } from '@univerjs/core';
|
||||
import type { IAddDocUniFormulaMutationParams, IRemoveDocUniFormulaMutationParams, IUpdateDocUniFormulaMutationParams } from '@univerjs/uni-formula';
|
||||
|
||||
export interface IAddDocUniFormulaCommandParams {
|
||||
unitId: string;
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { ICommand, IDocumentBody } from '@univerjs/core';
|
||||
import { CommandType, CustomRangeType, generateRandomId, ICommandService, LocaleService, makeCustomRangeStream } from '@univerjs/core';
|
||||
import { SLIDE_EDITOR_ID } from '@univerjs/slides-ui';
|
||||
import { makeSelection, replaceSelectionFactory } from '@univerjs/docs-ui';
|
||||
import { SLIDE_EDITOR_ID } from '@univerjs/slides-ui';
|
||||
import type { ICommand, IDocumentBody } from '@univerjs/core';
|
||||
import { SlideUIFormulaCacheService } from '../../services/slide-ui-formula-cache.service';
|
||||
|
||||
export interface IAddSlideUniFormulaCommandParams {
|
||||
|
||||
+7
-7
@@ -14,20 +14,20 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { DocumentDataModel } from '@univerjs/core';
|
||||
import { CustomRangeType, Disposable, ICommandService, ILogService, Inject, IUniverInstanceService, LifecycleStages, OnLifecycle, UniverInstanceType } from '@univerjs/core';
|
||||
import { DocSelectionManagerService } from '@univerjs/docs';
|
||||
import { IEditorService } from '@univerjs/ui';
|
||||
import type { IInsertCommandParams } from '@univerjs/docs-ui';
|
||||
import { DeleteLeftCommand, DocEventManagerService, InsertCommand, MoveCursorOperation } from '@univerjs/docs-ui';
|
||||
|
||||
import { filter, map, mergeMap } from 'rxjs';
|
||||
import { IRenderManagerService } from '@univerjs/engine-render';
|
||||
import { IEditorService } from '@univerjs/ui';
|
||||
import { filter, map, mergeMap } from 'rxjs';
|
||||
|
||||
import type { DocumentDataModel } from '@univerjs/core';
|
||||
import type { IInsertCommandParams } from '@univerjs/docs-ui';
|
||||
import { AddDocUniFormulaCommand, RemoveDocUniFormulaCommand, UpdateDocUniFormulaCommand } from '../commands/commands/doc.command';
|
||||
import type { IShowFormulaPopupOperationParams } from '../commands/operations/operation';
|
||||
import { CloseFormulaPopupOperation, ShowFormulaPopupOperation } from '../commands/operations/operation';
|
||||
import { UNI_FORMULA_EDITOR_ID } from '../views/components/DocFormulaPopup';
|
||||
import { UniFormulaPopupService } from '../services/formula-popup.service';
|
||||
import { UNI_FORMULA_EDITOR_ID } from '../views/components/DocFormulaPopup';
|
||||
import type { IShowFormulaPopupOperationParams } from '../commands/operations/operation';
|
||||
|
||||
const FORMULA_INPUT_TRIGGER_CHAR = '=';
|
||||
|
||||
|
||||
+6
-6
@@ -15,16 +15,16 @@
|
||||
*/
|
||||
|
||||
import { Disposable, ICommandService, Inject, Injector, IUniverInstanceService, LifecycleStages, OnLifecycle, UniverInstanceType } from '@univerjs/core';
|
||||
import { IEditorService } from '@univerjs/ui';
|
||||
import { DocSelectionManagerService } from '@univerjs/docs';
|
||||
import { ISlideEditorBridgeService } from '@univerjs/slides-ui';
|
||||
import type { IInsertCommandParams } from '@univerjs/docs-ui';
|
||||
import { InsertCommand } from '@univerjs/docs-ui';
|
||||
import { ISlideEditorBridgeService } from '@univerjs/slides-ui';
|
||||
import { IEditorService } from '@univerjs/ui';
|
||||
import type { IInsertCommandParams } from '@univerjs/docs-ui';
|
||||
import { AddSlideUniFormulaCommand } from '../commands/commands/slide.command';
|
||||
import { UNI_FORMULA_EDITOR_ID } from '../views/components/DocFormulaPopup';
|
||||
import { UniFormulaPopupService } from '../services/formula-popup.service';
|
||||
import type { IShowFormulaPopupOperationParams, ISlidePopupPosition } from '../commands/operations/operation';
|
||||
import { CloseFormulaPopupOperation, ShowFormulaPopupOperation } from '../commands/operations/operation';
|
||||
import { UniFormulaPopupService } from '../services/formula-popup.service';
|
||||
import { UNI_FORMULA_EDITOR_ID } from '../views/components/DocFormulaPopup';
|
||||
import type { IShowFormulaPopupOperationParams, ISlidePopupPosition } from '../commands/operations/operation';
|
||||
|
||||
const FORMULA_INPUT_TRIGGER_CHAR = '=';
|
||||
|
||||
|
||||
@@ -14,20 +14,20 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { IDisposable, Nullable } from '@univerjs/core';
|
||||
import { Disposable, FORMULA_EDITOR_ACTIVATED, ICommandService, IContextService, ILogService, Inject } from '@univerjs/core';
|
||||
import { DocCanvasPopManagerService, makeSelection } from '@univerjs/docs-ui';
|
||||
import { BehaviorSubject, Subject } from 'rxjs';
|
||||
import type { IShortcutItem } from '@univerjs/ui';
|
||||
import { IShortcutService, KeyCode } from '@univerjs/ui';
|
||||
import { FORMULA_PROMPT_ACTIVATED } from '@univerjs/sheets-formula';
|
||||
import { IShortcutService, KeyCode } from '@univerjs/ui';
|
||||
import { IUniFormulaService } from '@univerjs/uni-formula';
|
||||
import type { IAddDocUniFormulaCommandParams } from '../commands/commands/doc.command';
|
||||
import { BehaviorSubject, Subject } from 'rxjs';
|
||||
import type { IDisposable, Nullable } from '@univerjs/core';
|
||||
import type { IShortcutItem } from '@univerjs/ui';
|
||||
import { AddDocUniFormulaCommand } from '../commands/commands/doc.command';
|
||||
import type { IPopupPosition } from '../commands/operations/operation';
|
||||
import { ConfirmFormulaPopupCommand, isSlidePosition } from '../commands/operations/operation';
|
||||
import type { IAddSlideUniFormulaCommandParams } from '../commands/commands/slide.command';
|
||||
import { AddSlideUniFormulaCommand } from '../commands/commands/slide.command';
|
||||
import { ConfirmFormulaPopupCommand, isSlidePosition } from '../commands/operations/operation';
|
||||
import type { IAddDocUniFormulaCommandParams } from '../commands/commands/doc.command';
|
||||
import type { IAddSlideUniFormulaCommandParams } from '../commands/commands/slide.command';
|
||||
import type { IPopupPosition } from '../commands/operations/operation';
|
||||
|
||||
export const DOC_FORMULA_POPUP_KEY = 'DOC_FORMULA_POPUP' as const;
|
||||
|
||||
|
||||
@@ -14,14 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type {
|
||||
DocumentDataModel,
|
||||
ICellData,
|
||||
ICommand,
|
||||
IDisposable,
|
||||
IDocumentBody,
|
||||
Nullable,
|
||||
SlideDataModel } from '@univerjs/core';
|
||||
import {
|
||||
CommandType,
|
||||
CustomRangeType,
|
||||
@@ -36,14 +28,22 @@ import {
|
||||
toDisposable,
|
||||
UniverInstanceType,
|
||||
} from '@univerjs/core';
|
||||
import { makeSelection, replaceSelectionFactory } from '@univerjs/docs-ui';
|
||||
import { RichText } from '@univerjs/engine-render';
|
||||
import { DataSyncPrimaryController } from '@univerjs/rpc';
|
||||
import { RegisterOtherFormulaService } from '@univerjs/sheets-formula';
|
||||
import type { IDocFormulaCache, ISlideFormulaCache } from '@univerjs/uni-formula';
|
||||
import { CanvasView } from '@univerjs/slides-ui';
|
||||
import { DumbUniFormulaService, IUniFormulaService } from '@univerjs/uni-formula';
|
||||
import { take } from 'rxjs';
|
||||
import { RichText } from '@univerjs/engine-render';
|
||||
import { CanvasView } from '@univerjs/slides-ui';
|
||||
import { makeSelection, replaceSelectionFactory } from '@univerjs/docs-ui';
|
||||
import type {
|
||||
DocumentDataModel,
|
||||
ICellData,
|
||||
ICommand,
|
||||
IDisposable,
|
||||
IDocumentBody,
|
||||
Nullable,
|
||||
SlideDataModel } from '@univerjs/core';
|
||||
import type { IDocFormulaCache, ISlideFormulaCache } from '@univerjs/uni-formula';
|
||||
import { type IDocPopupPosition, type ISlidePopupPosition, isSlidePosition } from '../commands/operations/operation';
|
||||
|
||||
const PSEUDO_SUBUNIT = 'PSEUDO_SUBUNIT';
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { IAccessor } from '@univerjs/core';
|
||||
import { BooleanNumber, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, EDITOR_ACTIVATED, FOCUSING_SHEET, FontItalic, FontWeight, ICommandService, IContextService, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
|
||||
import { DocSelectionManagerService, SetTextSelectionsOperation } from '@univerjs/docs';
|
||||
import { SetInlineFormatCommand } from '@univerjs/docs-ui';
|
||||
import {
|
||||
RangeProtectionPermissionEditPoint,
|
||||
SetRangeValuesMutation,
|
||||
@@ -27,10 +27,10 @@ import {
|
||||
WorksheetEditPermission,
|
||||
WorksheetSetCellStylePermission,
|
||||
} from '@univerjs/sheets';
|
||||
import { SetInlineFormatCommand } from '@univerjs/docs-ui';
|
||||
import { deriveStateFromActiveSheet$, getCurrentRangeDisable$ } from '@univerjs/sheets-ui';
|
||||
import { getMenuHiddenObservable, type IMenuButtonItem, MenuItemType } from '@univerjs/ui';
|
||||
import { Observable } from 'rxjs';
|
||||
import type { IAccessor } from '@univerjs/core';
|
||||
|
||||
export const SHEET_BOLD_MUTATION_ID = 'sheet.command.uni-bold';
|
||||
export const SHEET_ITALIC_MUTATION_ID = 'sheet.command.uni-italic';
|
||||
|
||||
@@ -64,7 +64,6 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@univerjs/core": "workspace:*",
|
||||
"@univerjs/sheets": "workspace:*",
|
||||
"rxjs": ">=7.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -74,6 +73,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@univerjs-infra/shared": "workspace:*",
|
||||
"@univerjs/core": "workspace:*",
|
||||
"rxjs": "^7.8.1",
|
||||
"typescript": "^5.6.2",
|
||||
"vite": "^5.4.4",
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
import { CommandType, ICommandService, ILogService, IUndoRedoService } from '@univerjs/core';
|
||||
import type { ICommand, IDataValidationRule, IDataValidationRuleBase, IDataValidationRuleOptions, IMutationInfo, Injector, IRange, ISheetDataValidationRule } from '@univerjs/core';
|
||||
import type { ISheetCommandSharedParams } from '@univerjs/sheets';
|
||||
import type { IAddDataValidationMutationParams, IRemoveDataValidationMutationParams, IUpdateDataValidationMutationParams } from '../mutations/data-validation.mutation';
|
||||
import { AddDataValidationMutation, RemoveDataValidationMutation, UpdateDataValidationMutation } from '../mutations/data-validation.mutation';
|
||||
import { DataValidatorRegistryService } from '../../services/data-validator-registry.service';
|
||||
@@ -24,6 +23,11 @@ import { DataValidationModel } from '../../models/data-validation-model';
|
||||
import { getRuleOptions, getRuleSetting } from '../../common/util';
|
||||
import { UpdateRuleType } from '../../types/enum/update-rule-type';
|
||||
|
||||
interface ISheetCommandSharedParams {
|
||||
unitId: string;
|
||||
subUnitId: string;
|
||||
}
|
||||
|
||||
export interface IAddDataValidationCommandParams extends ISheetCommandSharedParams {
|
||||
rule: Omit<IDataValidationRule, 'ranges'> & {
|
||||
range: IRange;
|
||||
@@ -32,14 +36,14 @@ export interface IAddDataValidationCommandParams extends ISheetCommandSharedPara
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @deprecated `AddDataValidationCommand` is deprecated, please use `AddSheetDataValidationCommand` in `@univerjs/sheets-data-validation` instead!
|
||||
*/
|
||||
export const AddDataValidationCommand: ICommand<IAddDataValidationCommandParams> = {
|
||||
type: CommandType.COMMAND,
|
||||
id: 'data-validation.command.addRule',
|
||||
async handler(accessor, params) {
|
||||
const logService = accessor.get(ILogService);
|
||||
logService.warn('[Deprecated] AddDataValidationCommand is deprecated, please use AddSheetDataValidationCommand in @univerjs/sheets-data-validation instead!');
|
||||
logService.error('[Deprecated]: `AddDataValidationCommand` is deprecated, please use `AddSheetDataValidationCommand` in `@univerjs/sheets-data-validation` instead!');
|
||||
if (!params) {
|
||||
return false;
|
||||
}
|
||||
@@ -112,10 +116,16 @@ export const removeDataValidationUndoFactory = (accessor: Injector, redoParams:
|
||||
return undoMutations;
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated `RemoveDataValidationCommand` is deprecated, please use `RemoveSheetDataValidationCommand` in `@univerjs/sheets-data-validation` instead!
|
||||
*/
|
||||
export const RemoveDataValidationCommand: ICommand<IRemoveDataValidationCommandParams> = {
|
||||
type: CommandType.COMMAND,
|
||||
id: 'data-validation.command.removeRule',
|
||||
handler(accessor, params) {
|
||||
const logService = accessor.get(ILogService);
|
||||
logService.error('[Deprecated]: `RemoveDataValidationCommand` is deprecated, please use `RemoveSheetDataValidationCommand` in `@univerjs/sheets-data-validation` instead!');
|
||||
|
||||
if (!params) {
|
||||
return false;
|
||||
}
|
||||
@@ -157,14 +167,14 @@ export interface IUpdateDataValidationOptionsCommandParams extends ISheetCommand
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @deprecated `UpdateDataValidationOptionsCommand` is deprecated, please use `UpdateSheetDataValidationOptionsCommand` in `@univerjs/sheets-data-validation` instead!
|
||||
*/
|
||||
export const UpdateDataValidationOptionsCommand: ICommand<IUpdateDataValidationOptionsCommandParams> = {
|
||||
type: CommandType.COMMAND,
|
||||
id: 'data-validation.command.updateDataValidationSetting',
|
||||
handler(accessor, params) {
|
||||
const logService = accessor.get(ILogService);
|
||||
logService.warn('[Deprecated] UpdateDataValidationOptionsCommand is deprecated, please use UpdateSheetDataValidationOptionsCommand in @univerjs/sheets-data-validation instead!');
|
||||
logService.warn('[Deprecated]: `UpdateDataValidationOptionsCommand` is deprecated, please use `UpdateSheetDataValidationOptionsCommand` in `@univerjs/sheets-data-validation` instead!');
|
||||
if (!params) {
|
||||
return false;
|
||||
}
|
||||
@@ -224,14 +234,15 @@ export interface IUpdateDataValidationSettingCommandParams extends ISheetCommand
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @deprecated `UpdateDataValidationSettingCommand` is deprecated, please use `UpdateSheetDataValidationSettingCommand` in `@univerjs/sheets-data-validation` instead!
|
||||
*/
|
||||
export const UpdateDataValidationSettingCommand: ICommand<IUpdateDataValidationSettingCommandParams> = {
|
||||
type: CommandType.COMMAND,
|
||||
id: 'data-validation.command.updateDataValidationOptions',
|
||||
handler(accessor, params) {
|
||||
const logService = accessor.get(ILogService);
|
||||
logService.warn('[Deprecated] UpdateDataValidationSettingCommand is deprecated, please use UpdateSheetDataValidationSettingCommand in @univerjs/sheets-data-validation instead!');
|
||||
logService.error('[Deprecated]: `UpdateDataValidationSettingCommand` is deprecated, please use `UpdateSheetDataValidationSettingCommand` in `@univerjs/sheets-data-validation` instead!');
|
||||
|
||||
if (!params) {
|
||||
return false;
|
||||
}
|
||||
@@ -264,7 +275,7 @@ export const UpdateDataValidationSettingCommand: ICommand<IUpdateDataValidationS
|
||||
type: UpdateRuleType.SETTING,
|
||||
payload: {
|
||||
...setting,
|
||||
...validator.normlizeFormula(newRule, unitId, subUnitId),
|
||||
...validator.normalizeFormula(newRule, unitId, subUnitId),
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -301,10 +312,16 @@ export const UpdateDataValidationSettingCommand: ICommand<IUpdateDataValidationS
|
||||
export interface IRemoveAllDataValidationCommandParams extends ISheetCommandSharedParams {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated `RemoveAllDataValidationCommand` is deprecated, please use `RemoveSheetAllDataValidationCommand` in `@univerjs/sheets-data-validation` instead!
|
||||
*/
|
||||
export const RemoveAllDataValidationCommand: ICommand<IRemoveAllDataValidationCommandParams> = {
|
||||
type: CommandType.COMMAND,
|
||||
id: 'data-validation.command.removeAll',
|
||||
handler(accessor, params) {
|
||||
const logService = accessor.get(ILogService);
|
||||
logService.error('[Deprecated]: `RemoveAllDataValidationCommand` is deprecated, please use `RemoveSheetAllDataValidationCommand` in `@univerjs/sheets-data-validation` instead!');
|
||||
|
||||
if (!params) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -16,15 +16,16 @@
|
||||
|
||||
import { CommandType } from '@univerjs/core';
|
||||
import type { ICommand, IDataValidationRule } from '@univerjs/core';
|
||||
import type { ISheetCommandSharedParams } from '@univerjs/sheets';
|
||||
import type { IUpdateRulePayload } from '../../types/interfaces/i-update-rule-payload';
|
||||
import type { DataValidationChangeSource } from '../../models/data-validation-model';
|
||||
import { DataValidationModel } from '../../models/data-validation-model';
|
||||
|
||||
export interface IAddDataValidationMutationParams extends ISheetCommandSharedParams {
|
||||
export interface IAddDataValidationMutationParams {
|
||||
rule: IDataValidationRule | IDataValidationRule[];
|
||||
index?: number;
|
||||
source?: DataValidationChangeSource;
|
||||
unitId: string;
|
||||
subUnitId: string;
|
||||
}
|
||||
|
||||
export const AddDataValidationMutation: ICommand<IAddDataValidationMutationParams> = {
|
||||
@@ -42,9 +43,11 @@ export const AddDataValidationMutation: ICommand<IAddDataValidationMutationParam
|
||||
},
|
||||
};
|
||||
|
||||
export interface IRemoveDataValidationMutationParams extends ISheetCommandSharedParams {
|
||||
export interface IRemoveDataValidationMutationParams {
|
||||
ruleId: string | string[];
|
||||
source?: DataValidationChangeSource;
|
||||
unitId: string;
|
||||
subUnitId: string;
|
||||
}
|
||||
|
||||
export const RemoveDataValidationMutation: ICommand<IRemoveDataValidationMutationParams> = {
|
||||
@@ -69,10 +72,12 @@ export const RemoveDataValidationMutation: ICommand<IRemoveDataValidationMutatio
|
||||
},
|
||||
};
|
||||
|
||||
export interface IUpdateDataValidationMutationParams extends ISheetCommandSharedParams {
|
||||
export interface IUpdateDataValidationMutationParams {
|
||||
payload: IUpdateRulePayload;
|
||||
ruleId: string;
|
||||
source?: DataValidationChangeSource;
|
||||
unitId: string;
|
||||
subUnitId: string;
|
||||
}
|
||||
|
||||
export const UpdateDataValidationMutation: ICommand<IUpdateDataValidationMutationParams> = {
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { IAccessor, IDataValidationRuleBase, IDataValidationRuleOptions } from '@univerjs/core';
|
||||
import { DataValidationOperator, DataValidationType, Tools } from '@univerjs/core';
|
||||
import { SheetsSelectionsService } from '@univerjs/sheets';
|
||||
import type { IDataValidationRuleBase, IDataValidationRuleOptions } from '@univerjs/core';
|
||||
|
||||
export function getRuleSetting(rule: IDataValidationRuleBase): IDataValidationRuleBase {
|
||||
return {
|
||||
@@ -44,17 +42,3 @@ export function getRuleOptions(rule: IDataValidationRuleOptions): IDataValidatio
|
||||
};
|
||||
}
|
||||
|
||||
export function createDefaultNewRule(accessor: IAccessor) {
|
||||
const selectionManagerService = accessor.get(SheetsSelectionsService);
|
||||
const currentRanges = selectionManagerService.getCurrentSelections().map((s) => s.range);
|
||||
const uid = Tools.generateRandomId(6);
|
||||
const rule = {
|
||||
uid,
|
||||
type: DataValidationType.DECIMAL,
|
||||
operator: DataValidationOperator.EQUAL,
|
||||
formula1: '100',
|
||||
ranges: currentRanges ?? [{ startColumn: 0, endColumn: 0, startRow: 0, endRow: 0 }],
|
||||
};
|
||||
|
||||
return rule;
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { ISheetDataValidationRule } from '@univerjs/core';
|
||||
import { Disposable, Inject, IResourceManagerService, IUniverInstanceService, LifecycleStages, OnLifecycle, UniverInstanceType } from '@univerjs/core';
|
||||
import type { ISheetDataValidationRule } from '@univerjs/core';
|
||||
import { DataValidationModel } from '../models/data-validation-model';
|
||||
|
||||
type DataValidationJSON = Record<string, ISheetDataValidationRule[]>;
|
||||
|
||||
@@ -19,7 +19,6 @@ export { DataValidatorRegistryService, DataValidatorRegistryScope } from './serv
|
||||
export { DataValidationModel, type DataValidationChangeSource, type IRuleChange, type IValidStatusChange } from './models/data-validation-model';
|
||||
|
||||
export {
|
||||
createDefaultNewRule,
|
||||
getRuleOptions,
|
||||
getRuleSetting,
|
||||
} from './common/util';
|
||||
@@ -32,27 +31,12 @@ export type { IDataValidationDropdownProps } from './types/interfaces/i-data-val
|
||||
export { BaseDataValidator } from './validators/base-data-validator';
|
||||
export type { IFormulaResult, IValidatorCellInfo } from './validators/base-data-validator';
|
||||
export type { IBaseDataValidationWidget } from './validators/base-widget';
|
||||
export { DataValidationManager } from './models/data-validation-manager';
|
||||
export type { IFormulaValidResult } from './validators/base-data-validator';
|
||||
export { TWO_FORMULA_OPERATOR_COUNT } from './types/const/two-formula-operators';
|
||||
export { DataValidationResourceController } from './controllers/dv-resource.controller';
|
||||
export { DataValidationSheetController } from './controllers/dv-sheet.controller';
|
||||
export { TextLengthErrorTitleMap } from './types/const/operator-text-map';
|
||||
|
||||
// #region - all commands
|
||||
|
||||
export {
|
||||
AddDataValidationCommand,
|
||||
RemoveDataValidationCommand,
|
||||
UpdateDataValidationOptionsCommand,
|
||||
UpdateDataValidationSettingCommand,
|
||||
RemoveAllDataValidationCommand,
|
||||
removeDataValidationUndoFactory,
|
||||
type IRemoveDataValidationCommandParams,
|
||||
type IAddDataValidationCommandParams,
|
||||
type IRemoveAllDataValidationCommandParams,
|
||||
} from './commands/commands/data-validation.command';
|
||||
|
||||
export {
|
||||
AddDataValidationMutation,
|
||||
RemoveDataValidationMutation,
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
/**
|
||||
* Copyright 2023-present DreamNum Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { ICellDataForSheetInterceptor, IDataValidationRule, Nullable } from '@univerjs/core';
|
||||
import { DataValidationStatus, Disposable } from '@univerjs/core';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import type { IUpdateRulePayload } from '../types/interfaces/i-update-rule-payload';
|
||||
import { UpdateRuleType } from '../types/enum/update-rule-type';
|
||||
import { getRuleOptions, getRuleSetting } from '../common/util';
|
||||
|
||||
export interface IDataValidationPos {
|
||||
row: number;
|
||||
col: number;
|
||||
unitId: string;
|
||||
subUnitId: string;
|
||||
}
|
||||
|
||||
export class DataValidationManager<T extends IDataValidationRule> extends Disposable {
|
||||
private _dataValidations: T[] = [];
|
||||
private _dataValidationMap = new Map<string, T>();
|
||||
private _dataValidations$ = new BehaviorSubject<T[]>(this._dataValidations);
|
||||
|
||||
readonly unitId: string;
|
||||
readonly subUnitId: string;
|
||||
readonly dataValidations$ = this._dataValidations$.asObservable();
|
||||
|
||||
constructor(unitId: string, subUnitId: string) {
|
||||
super();
|
||||
this.unitId = unitId;
|
||||
this.subUnitId = subUnitId;
|
||||
this._notice();
|
||||
|
||||
this.disposeWithMe({
|
||||
dispose: () => {
|
||||
this._dataValidations$.complete();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private _notice() {
|
||||
this._dataValidations$.next(this._dataValidations);
|
||||
}
|
||||
|
||||
getRuleById(id: string) {
|
||||
return this._dataValidationMap.get(id);
|
||||
}
|
||||
|
||||
getRuleIndex(id: string) {
|
||||
return this._dataValidations.findIndex((rule) => rule.uid === id);
|
||||
}
|
||||
|
||||
addRule(rule: T | T[], index?: number) {
|
||||
const _rules = Array.isArray(rule) ? rule : [rule];
|
||||
const rules = _rules.filter((item) => !this._dataValidationMap.has(item.uid));
|
||||
|
||||
if (typeof index === 'number' && index < this._dataValidations.length) {
|
||||
this._dataValidations.splice(index, 0, ...rules);
|
||||
} else {
|
||||
this._dataValidations.push(...rules);
|
||||
}
|
||||
|
||||
rules.forEach((item) => {
|
||||
this._dataValidationMap.set(item.uid, item);
|
||||
});
|
||||
|
||||
this._notice();
|
||||
}
|
||||
|
||||
removeRule(ruleId: string) {
|
||||
const index = this._dataValidations.findIndex((item) => item.uid === ruleId);
|
||||
if (index > -1) {
|
||||
this._dataValidations.splice(index, 1);
|
||||
this._dataValidationMap.delete(ruleId);
|
||||
this._notice();
|
||||
}
|
||||
}
|
||||
|
||||
updateRule(ruleId: string, payload: IUpdateRulePayload) {
|
||||
const oldRule = this._dataValidationMap.get(ruleId);
|
||||
const index = this._dataValidations.findIndex((rule) => ruleId === rule.uid);
|
||||
|
||||
if (!oldRule) {
|
||||
throw new Error(`Data validation rule is not found, ruleId: ${ruleId}.`);
|
||||
}
|
||||
|
||||
const rule = { ...oldRule };
|
||||
|
||||
switch (payload.type) {
|
||||
case UpdateRuleType.RANGE: {
|
||||
rule.ranges = payload.payload;
|
||||
break;
|
||||
}
|
||||
case UpdateRuleType.SETTING: {
|
||||
Object.assign(rule, getRuleSetting(payload.payload));
|
||||
break;
|
||||
}
|
||||
|
||||
case UpdateRuleType.OPTIONS: {
|
||||
Object.assign(rule, getRuleOptions(payload.payload));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
this._dataValidations[index] = rule;
|
||||
this._dataValidationMap.set(ruleId, rule);
|
||||
this._notice();
|
||||
return rule;
|
||||
}
|
||||
|
||||
getDataValidations() {
|
||||
return this._dataValidations;
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return this._dataValidations;
|
||||
}
|
||||
|
||||
validator(_value: Nullable<ICellDataForSheetInterceptor>, _rule: IDataValidationRule, _pos: IDataValidationPos, _onComplete: (status: DataValidationStatus, changed: boolean) => void) {
|
||||
return DataValidationStatus.VALID;
|
||||
}
|
||||
}
|
||||
@@ -14,23 +14,24 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { DataValidationStatus, ICellDataForSheetInterceptor, IDataValidationRule, Nullable } from '@univerjs/core';
|
||||
import { Disposable, ILogService } from '@univerjs/core';
|
||||
import type { DataValidationStatus, IDataValidationRule } from '@univerjs/core';
|
||||
import { Disposable, ILogService, Tools } from '@univerjs/core';
|
||||
import { debounceTime, Subject } from 'rxjs';
|
||||
import type { IUpdateRulePayload } from '../types/interfaces/i-update-rule-payload';
|
||||
import type { IDataValidationPos } from './data-validation-manager';
|
||||
import { DataValidationManager } from './data-validation-manager';
|
||||
import { UpdateRuleType } from '../types/enum/update-rule-type';
|
||||
import { getRuleOptions, getRuleSetting } from '../common/util';
|
||||
|
||||
type ManagerCreator<T extends IDataValidationRule> = (unitId: string, subUnitId: string) => DataValidationManager<T>;
|
||||
type DataValidationChangeType = 'update' | 'add' | 'remove';
|
||||
export type DataValidationChangeSource = 'command' | 'patched';
|
||||
|
||||
export interface IRuleChange<T extends IDataValidationRule> {
|
||||
rule?: T;
|
||||
export interface IRuleChange {
|
||||
rule: IDataValidationRule;
|
||||
type: DataValidationChangeType;
|
||||
unitId: string;
|
||||
subUnitId: string;
|
||||
source: DataValidationChangeSource;
|
||||
updatePayload?: IUpdateRulePayload;
|
||||
oldRule?: IDataValidationRule;
|
||||
}
|
||||
|
||||
export interface IValidStatusChange {
|
||||
@@ -40,15 +41,16 @@ export interface IValidStatusChange {
|
||||
status: DataValidationStatus;
|
||||
}
|
||||
|
||||
export class DataValidationModel<T extends IDataValidationRule = IDataValidationRule> extends Disposable {
|
||||
private readonly _model = new Map<string, Map<string, DataValidationManager<T>>>();
|
||||
private _managerCreator: ManagerCreator<T> = (unitId: string, subUnitId: string) => new DataValidationManager<T>(unitId, subUnitId);
|
||||
private readonly _ruleChange$ = new Subject<IRuleChange<T>>();
|
||||
private readonly _validStatusChange$ = new Subject<IValidStatusChange>();
|
||||
interface ISubUnitDataValidation {
|
||||
map: Map<string, IDataValidationRule>; list: IDataValidationRule[];
|
||||
}
|
||||
|
||||
export class DataValidationModel extends Disposable {
|
||||
private readonly _model = new Map<string, Map<string, ISubUnitDataValidation>>();
|
||||
private readonly _ruleChange$ = new Subject<IRuleChange>();
|
||||
|
||||
ruleChange$ = this._ruleChange$.asObservable();
|
||||
ruleChangeDebounce$ = this.ruleChange$.pipe(debounceTime(20));
|
||||
validStatusChange$ = this._validStatusChange$.asObservable().pipe(debounceTime(20));
|
||||
|
||||
constructor(
|
||||
@ILogService private readonly _logService: ILogService
|
||||
@@ -58,16 +60,11 @@ export class DataValidationModel<T extends IDataValidationRule = IDataValidation
|
||||
this.disposeWithMe({
|
||||
dispose: () => {
|
||||
this._ruleChange$.complete();
|
||||
this._validStatusChange$.complete();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
setManagerCreator(creator: (unitId: string, subUnitId: string) => DataValidationManager<T>) {
|
||||
this._managerCreator = creator;
|
||||
}
|
||||
|
||||
ensureManager(unitId: string, subUnitId: string) {
|
||||
private _ensureMap(unitId: string, subUnitId: string) {
|
||||
if (!this._model.has(unitId)) {
|
||||
this._model.set(unitId, new Map());
|
||||
}
|
||||
@@ -77,15 +74,74 @@ export class DataValidationModel<T extends IDataValidationRule = IDataValidation
|
||||
return unitMap.get(subUnitId)!;
|
||||
}
|
||||
|
||||
const manager = this._managerCreator(unitId, subUnitId);
|
||||
unitMap.set(subUnitId, manager);
|
||||
this.disposeWithMe(manager);
|
||||
return manager;
|
||||
const map = { map: new Map<string, IDataValidationRule>(), list: [] as IDataValidationRule[] };
|
||||
unitMap.set(subUnitId, map);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
private _addRuleSideEffect(unitId: string, subUnitId: string, rule: T, source: DataValidationChangeSource) {
|
||||
const manager = this.ensureManager(unitId, subUnitId);
|
||||
const oldRule = manager.getRuleById(rule.uid);
|
||||
private _addSubUnitRule(subUnit: ISubUnitDataValidation, rule: IDataValidationRule | IDataValidationRule[], index?: number) {
|
||||
const { map: dataValidationMap, list: dataValidations } = subUnit;
|
||||
const _rules = Array.isArray(rule) ? rule : [rule];
|
||||
const rules = _rules.filter((item) => !dataValidationMap.has(item.uid));
|
||||
|
||||
if (typeof index === 'number' && index < dataValidations.length) {
|
||||
dataValidations.splice(index, 0, ...rules);
|
||||
} else {
|
||||
dataValidations.push(...rules);
|
||||
}
|
||||
|
||||
rules.forEach((item) => {
|
||||
dataValidationMap.set(item.uid, item);
|
||||
});
|
||||
}
|
||||
|
||||
private _removeSubUnitRule(subUnit: ISubUnitDataValidation, ruleId: string) {
|
||||
const { map: dataValidationMap, list: dataValidations } = subUnit;
|
||||
const index = dataValidations.findIndex((item) => item.uid === ruleId);
|
||||
if (index > -1) {
|
||||
dataValidations.splice(index, 1);
|
||||
dataValidationMap.delete(ruleId);
|
||||
}
|
||||
}
|
||||
|
||||
private _updateSubUnitRule(subUnit: ISubUnitDataValidation, ruleId: string, payload: IUpdateRulePayload): IDataValidationRule {
|
||||
const { map: dataValidationMap, list: dataValidations } = subUnit;
|
||||
const oldRule = dataValidationMap.get(ruleId);
|
||||
const index = dataValidations.findIndex((rule) => ruleId === rule.uid);
|
||||
|
||||
if (!oldRule) {
|
||||
throw new Error(`Data validation rule is not found, ruleId: ${ruleId}.`);
|
||||
}
|
||||
|
||||
const rule = { ...oldRule };
|
||||
|
||||
switch (payload.type) {
|
||||
case UpdateRuleType.RANGE: {
|
||||
rule.ranges = payload.payload;
|
||||
break;
|
||||
}
|
||||
case UpdateRuleType.SETTING: {
|
||||
Object.assign(rule, getRuleSetting(payload.payload));
|
||||
break;
|
||||
}
|
||||
|
||||
case UpdateRuleType.OPTIONS: {
|
||||
Object.assign(rule, getRuleOptions(payload.payload));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
dataValidations[index] = rule;
|
||||
dataValidationMap.set(ruleId, rule);
|
||||
return rule;
|
||||
}
|
||||
|
||||
private _addRuleSideEffect(unitId: string, subUnitId: string, rule: IDataValidationRule, source: DataValidationChangeSource) {
|
||||
const subUnitMap = this._ensureMap(unitId, subUnitId);
|
||||
const oldRule = subUnitMap.map.get(rule.uid);
|
||||
if (oldRule) {
|
||||
return;
|
||||
}
|
||||
@@ -98,15 +154,15 @@ export class DataValidationModel<T extends IDataValidationRule = IDataValidation
|
||||
});
|
||||
}
|
||||
|
||||
addRule(unitId: string, subUnitId: string, rule: T | T[], source: DataValidationChangeSource, index?: number) {
|
||||
addRule(unitId: string, subUnitId: string, rule: IDataValidationRule | IDataValidationRule[], source: DataValidationChangeSource, index?: number) {
|
||||
try {
|
||||
const manager = this.ensureManager(unitId, subUnitId);
|
||||
const subUnitMap = this._ensureMap(unitId, subUnitId);
|
||||
const rules = Array.isArray(rule) ? rule : [rule];
|
||||
rules.forEach((item) => {
|
||||
this._addRuleSideEffect(unitId, subUnitId, item, source);
|
||||
});
|
||||
|
||||
manager.addRule(rule, index);
|
||||
this._addSubUnitRule(subUnitMap, rule, index);
|
||||
} catch (error) {
|
||||
this._logService.error(error);
|
||||
}
|
||||
@@ -114,15 +170,20 @@ export class DataValidationModel<T extends IDataValidationRule = IDataValidation
|
||||
|
||||
updateRule(unitId: string, subUnitId: string, ruleId: string, payload: IUpdateRulePayload, source: DataValidationChangeSource) {
|
||||
try {
|
||||
const manager = this.ensureManager(unitId, subUnitId);
|
||||
const rule = manager.updateRule(ruleId, payload);
|
||||
|
||||
const subUnitMap = this._ensureMap(unitId, subUnitId);
|
||||
const oldRule = Tools.deepClone(subUnitMap.map.get(ruleId));
|
||||
if (!oldRule) {
|
||||
throw new Error(`Data validation rule is not found, ruleId: ${ruleId}.`);
|
||||
}
|
||||
const rule = this._updateSubUnitRule(subUnitMap, ruleId, payload);
|
||||
this._ruleChange$.next({
|
||||
rule,
|
||||
type: 'update',
|
||||
unitId,
|
||||
subUnitId,
|
||||
source,
|
||||
updatePayload: payload,
|
||||
oldRule,
|
||||
});
|
||||
} catch (error) {
|
||||
this._logService.error(error);
|
||||
@@ -131,10 +192,10 @@ export class DataValidationModel<T extends IDataValidationRule = IDataValidation
|
||||
|
||||
removeRule(unitId: string, subUnitId: string, ruleId: string, source: DataValidationChangeSource) {
|
||||
try {
|
||||
const manager = this.ensureManager(unitId, subUnitId);
|
||||
const oldRule = manager.getRuleById(ruleId);
|
||||
const map = this._ensureMap(unitId, subUnitId);
|
||||
const oldRule = map.map.get(ruleId);
|
||||
if (oldRule) {
|
||||
manager.removeRule(ruleId);
|
||||
this._removeSubUnitRule(map, ruleId);
|
||||
this._ruleChange$.next({
|
||||
rule: oldRule,
|
||||
type: 'remove',
|
||||
@@ -149,33 +210,18 @@ export class DataValidationModel<T extends IDataValidationRule = IDataValidation
|
||||
}
|
||||
|
||||
getRuleById(unitId: string, subUnitId: string, ruleId: string) {
|
||||
const manager = this.ensureManager(unitId, subUnitId);
|
||||
return manager.getRuleById(ruleId);
|
||||
const map = this._ensureMap(unitId, subUnitId);
|
||||
return map.map.get(ruleId);
|
||||
}
|
||||
|
||||
getRuleIndex(unitId: string, subUnitId: string, ruleId: string) {
|
||||
const manager = this.ensureManager(unitId, subUnitId);
|
||||
return manager.getRuleIndex(ruleId);
|
||||
const map = this._ensureMap(unitId, subUnitId);
|
||||
return map.list.findIndex((rule) => rule.uid === ruleId);
|
||||
}
|
||||
|
||||
getRules(unitId: string, subUnitId: string) {
|
||||
const manager = this.ensureManager(unitId, subUnitId);
|
||||
return manager.getDataValidations();
|
||||
}
|
||||
|
||||
validator(rule: T, pos: IDataValidationPos, value: Nullable<ICellDataForSheetInterceptor>) {
|
||||
const { unitId, subUnitId } = pos;
|
||||
const manager = this.ensureManager(unitId, subUnitId);
|
||||
return manager.validator(value, rule, pos, (status, changed) => {
|
||||
if (changed) {
|
||||
this._validStatusChange$.next({
|
||||
unitId,
|
||||
subUnitId,
|
||||
ruleId: rule.uid,
|
||||
status,
|
||||
});
|
||||
}
|
||||
});
|
||||
const manager = this._ensureMap(unitId, subUnitId);
|
||||
return [...manager.list];
|
||||
}
|
||||
|
||||
getUnitRules(unitId: string) {
|
||||
@@ -185,8 +231,8 @@ export class DataValidationModel<T extends IDataValidationRule = IDataValidation
|
||||
}
|
||||
const res = [] as [string, IDataValidationRule[]][];
|
||||
|
||||
unitMap.forEach((manager) => {
|
||||
res.push([manager.subUnitId, manager.getDataValidations()]);
|
||||
unitMap.forEach((manager, subUnitId) => {
|
||||
res.push([subUnitId, manager.list]);
|
||||
});
|
||||
|
||||
return res;
|
||||
@@ -199,4 +245,8 @@ export class DataValidationModel<T extends IDataValidationRule = IDataValidation
|
||||
getSubUnitIds(unitId: string) {
|
||||
return Array.from(this._model.get(unitId)?.keys() ?? []);
|
||||
}
|
||||
|
||||
getAll() {
|
||||
return Array.from(this._model.keys()).map((unitId) => [unitId, this.getUnitRules(unitId)] as const);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import { DataValidationModel } from './models/data-validation-model';
|
||||
import { AddDataValidationCommand, RemoveAllDataValidationCommand, RemoveDataValidationCommand, UpdateDataValidationOptionsCommand, UpdateDataValidationSettingCommand } from './commands/commands/data-validation.command';
|
||||
import { AddDataValidationMutation, RemoveDataValidationMutation, UpdateDataValidationMutation } from './commands/mutations/data-validation.mutation';
|
||||
import { DataValidationResourceController } from './controllers/dv-resource.controller';
|
||||
import { DataValidationSheetController } from './controllers/dv-sheet.controller';
|
||||
import type { IUniverDataValidationConfig } from './controllers/config.schema';
|
||||
import { defaultPluginConfig, PLUGIN_CONFIG_KEY } from './controllers/config.schema';
|
||||
|
||||
@@ -49,7 +48,6 @@ export class UniverDataValidationPlugin extends Plugin {
|
||||
[DataValidationModel],
|
||||
[DataValidatorRegistryService],
|
||||
[DataValidationResourceController],
|
||||
[DataValidationSheetController],
|
||||
] as Dependency[]).forEach((d) => this._injector.add(d));
|
||||
|
||||
[
|
||||
|
||||
@@ -131,7 +131,7 @@ export abstract class BaseDataValidator<DataType = CellValue> {
|
||||
|
||||
abstract validatorFormula(rule: IDataValidationRule, unitId: string, subUnitId: string): IFormulaValidResult;
|
||||
|
||||
normlizeFormula(rule: IDataValidationRule, unitId: string, subUnitId: string) {
|
||||
normalizeFormula(rule: IDataValidationRule, unitId: string, subUnitId: string) {
|
||||
return {
|
||||
formula1: rule.formula1,
|
||||
formula2: rule.formula2,
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { IAccessor, ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
|
||||
import {
|
||||
CommandType,
|
||||
ICommandService,
|
||||
@@ -23,9 +22,10 @@ import {
|
||||
TextX,
|
||||
TextXActionType,
|
||||
} from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import { getCustomBlockIdsInSelections, getRetainAndDeleteFromReplace, getRichTextEditPath } from '@univerjs/docs-ui';
|
||||
import type { IAccessor, ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import type { IInsertDrawingCommandParams } from './interfaces';
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { IAccessor, ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
|
||||
import {
|
||||
CommandType,
|
||||
ICommandService,
|
||||
@@ -24,10 +23,11 @@ import {
|
||||
TextX,
|
||||
TextXActionType,
|
||||
} from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { RichTextEditingMutation } from '@univerjs/docs';
|
||||
import { IRenderManagerService, type ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
import { DocSelectionRenderService, getRichTextEditPath } from '@univerjs/docs-ui';
|
||||
import { IRenderManagerService, type ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
import type { IAccessor, ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import type { IDeleteDrawingCommandParams } from './interfaces';
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { DocumentDataModel, IAccessor, ICommand, IDocDrawingBase, IDocDrawingPosition, IMutationInfo, IObjectPositionH, IObjectPositionV, ISize, JSONXActions, WrapTextType } from '@univerjs/core';
|
||||
import {
|
||||
BooleanNumber,
|
||||
CommandType,
|
||||
@@ -28,11 +27,12 @@ import {
|
||||
TextXActionType,
|
||||
Tools,
|
||||
} from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { DocSkeletonManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import type { IDocDrawing } from '@univerjs/docs-drawing';
|
||||
import { DocumentEditArea, IRenderManagerService } from '@univerjs/engine-render';
|
||||
import { DocSelectionRenderService, getRichTextEditPath } from '@univerjs/docs-ui';
|
||||
import { DocumentEditArea, IRenderManagerService } from '@univerjs/engine-render';
|
||||
import type { DocumentDataModel, IAccessor, ICommand, IDocDrawingBase, IDocDrawingPosition, IMutationInfo, IObjectPositionH, IObjectPositionV, ISize, JSONXActions, WrapTextType } from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import type { IDocDrawing } from '@univerjs/docs-drawing';
|
||||
import { DocRefreshDrawingsService } from '../../services/doc-refresh-drawings.service';
|
||||
|
||||
export enum TextWrappingStyle {
|
||||
|
||||
+2
-2
@@ -21,11 +21,11 @@ import {
|
||||
OnLifecycle, PositionedObjectLayoutType, throttle, toDisposable, Tools,
|
||||
} from '@univerjs/core';
|
||||
import { DocSkeletonManagerService } from '@univerjs/docs';
|
||||
import { DocSelectionRenderService, getAnchorBounding, getDocObject, getOneTextSelectionRange, NodePositionConvertToCursor, TEXT_RANGE_LAYER_INDEX } from '@univerjs/docs-ui';
|
||||
import { IDrawingManagerService } from '@univerjs/drawing';
|
||||
import { DocumentSkeletonPageType, getColor, IRenderManagerService, Liquid, PageLayoutType, Rect, Vector2 } from '@univerjs/engine-render';
|
||||
import type { IDocDrawingBase, IDocDrawingPosition, Nullable } from '@univerjs/core';
|
||||
import type { BaseObject, Documents, IDocumentSkeletonGlyph, IDocumentSkeletonPage, Image, INodeSearch, IPoint, Viewport } from '@univerjs/engine-render';
|
||||
import { DocumentSkeletonPageType, getColor, IRenderManagerService, Liquid, PageLayoutType, Rect, Vector2 } from '@univerjs/engine-render';
|
||||
import { DocSelectionRenderService, getAnchorBounding, getDocObject, getOneTextSelectionRange, NodePositionConvertToCursor, TEXT_RANGE_LAYER_INDEX } from '@univerjs/docs-ui';
|
||||
import { IMoveInlineDrawingCommand, ITransformNonInlineDrawingCommand, UpdateDrawingDocTransformCommand } from '../commands/commands/update-doc-drawing.command';
|
||||
import type { IDrawingDocTransform } from '../commands/commands/update-doc-drawing.command';
|
||||
|
||||
|
||||
+4
-4
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { DocumentDataModel, ICommandInfo, IDrawingParam, ITransformState } from '@univerjs/core';
|
||||
import {
|
||||
BooleanNumber,
|
||||
Disposable,
|
||||
@@ -26,14 +25,15 @@ import {
|
||||
LifecycleStages,
|
||||
PositionedObjectLayoutType,
|
||||
} from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { DocSkeletonManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import { SetDocZoomRatioOperation } from '@univerjs/docs-ui';
|
||||
import { IDrawingManagerService } from '@univerjs/drawing';
|
||||
import type { Documents, DocumentSkeleton, IDocumentSkeletonHeaderFooter, IDocumentSkeletonPage, Image, IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
||||
import { Liquid, TRANSFORM_CHANGE_OBSERVABLE_TYPE } from '@univerjs/engine-render';
|
||||
import { IEditorService } from '@univerjs/ui';
|
||||
import { debounceTime, filter } from 'rxjs';
|
||||
import { SetDocZoomRatioOperation } from '@univerjs/docs-ui';
|
||||
import type { DocumentDataModel, ICommandInfo, IDrawingParam, ITransformState } from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import type { Documents, DocumentSkeleton, IDocumentSkeletonHeaderFooter, IDocumentSkeletonPage, Image, IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
||||
import { DocRefreshDrawingsService } from '../../services/doc-refresh-drawings.service';
|
||||
|
||||
interface IDrawingParamsWithBehindText {
|
||||
|
||||
@@ -14,18 +14,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { ICommandInfo, IObjectPositionH, IObjectPositionV, Nullable } from '@univerjs/core';
|
||||
import { ICommandService, IUniverInstanceService, LocaleService, ObjectRelativeFromH, ObjectRelativeFromV, PositionedObjectLayoutType, useDependency } from '@univerjs/core';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import clsx from 'clsx';
|
||||
import type { IDocumentSkeletonDrawing } from '@univerjs/engine-render';
|
||||
import { IRenderManagerService } from '@univerjs/engine-render';
|
||||
import type { IDocDrawing } from '@univerjs/docs-drawing';
|
||||
import { IDrawingManagerService, type IDrawingParam } from '@univerjs/drawing';
|
||||
import { Checkbox, InputNumber, Select } from '@univerjs/design';
|
||||
|
||||
import { DocSkeletonManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import { DocSelectionRenderService } from '@univerjs/docs-ui';
|
||||
import { IDrawingManagerService, type IDrawingParam } from '@univerjs/drawing';
|
||||
import { IRenderManagerService } from '@univerjs/engine-render';
|
||||
import clsx from 'clsx';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import type { ICommandInfo, IObjectPositionH, IObjectPositionV, Nullable } from '@univerjs/core';
|
||||
|
||||
import type { IDocDrawing } from '@univerjs/docs-drawing';
|
||||
import type { IDocumentSkeletonDrawing } from '@univerjs/engine-render';
|
||||
import { UpdateDrawingDocTransformCommand } from '../../commands/commands/update-doc-drawing.command';
|
||||
import styles from './index.module.less';
|
||||
|
||||
@@ -161,7 +161,8 @@ export const DocDrawingPosition = (props: IDocDrawingPositionProps) => {
|
||||
let drawing: Nullable<IDocumentSkeletonDrawing> = null;
|
||||
let pageMarginLeft = 0;
|
||||
const skeleton = renderManagerService.getRenderById(unitId)
|
||||
?.with(DocSkeletonManagerService).getSkeleton();
|
||||
?.with(DocSkeletonManagerService)
|
||||
.getSkeleton();
|
||||
|
||||
const skeletonData = skeleton?.getSkeletonData();
|
||||
|
||||
@@ -240,7 +241,8 @@ export const DocDrawingPosition = (props: IDocDrawingPositionProps) => {
|
||||
const { drawingId, unitId } = focusDrawings[0];
|
||||
const documentDataModel = univerInstanceService.getUniverDocInstance(unitId);
|
||||
const skeleton = renderManagerService.getRenderById(unitId)
|
||||
?.with(DocSkeletonManagerService).getSkeleton();
|
||||
?.with(DocSkeletonManagerService)
|
||||
.getSkeleton();
|
||||
|
||||
const docSelectionRenderService = renderManagerService.getRenderById(unitId)?.with(DocSelectionRenderService);
|
||||
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { getMenuHiddenObservable, type IMenuItem, MenuItemType } from '@univerjs/ui';
|
||||
import { IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
|
||||
import type { IAccessor } from '@univerjs/core';
|
||||
|
||||
import { DocSelectionManagerService } from '@univerjs/docs';
|
||||
import { getMenuHiddenObservable, type IMenuItem, MenuItemType } from '@univerjs/ui';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import type { IAccessor } from '@univerjs/core';
|
||||
import { InsertDocImageCommand } from '../../commands/commands/insert-image.command';
|
||||
|
||||
export const ImageUploadIcon = 'addition-and-subtraction-single';
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { ICommand } from '@univerjs/core';
|
||||
import { CommandType, ICommandService } from '@univerjs/core';
|
||||
import { deleteCustomRangeFactory } from '@univerjs/docs-ui';
|
||||
import type { ICommand } from '@univerjs/core';
|
||||
|
||||
export interface IDeleteDocHyperLinkMutationParams {
|
||||
unitId: string;
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { DocumentDataModel, IAccessor, ICommand, ITextRange } from '@univerjs/core';
|
||||
import { CommandType, CustomRangeType, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
|
||||
import { DocSelectionManagerService } from '@univerjs/docs';
|
||||
import { getCustomRangesInterestsWithRange } from '@univerjs/docs-ui';
|
||||
import type { DocumentDataModel, IAccessor, ICommand, ITextRange } from '@univerjs/core';
|
||||
import { DocHyperLinkPopupService } from '../../services/hyper-link-popup.service';
|
||||
|
||||
export const shouldDisableAddLink = (accessor: IAccessor) => {
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { IAccessor } from '@univerjs/core';
|
||||
import { UniverInstanceType } from '@univerjs/core';
|
||||
import type { IMenuButtonItem, IShortcutItem } from '@univerjs/ui';
|
||||
import { getMenuHiddenObservable, KeyCode, MenuItemType, MetaKeys } from '@univerjs/ui';
|
||||
import { debounceTime, Observable } from 'rxjs';
|
||||
import { DocSelectionManagerService } from '@univerjs/docs';
|
||||
import { whenDocAndEditorFocused } from '@univerjs/docs-ui';
|
||||
import { getMenuHiddenObservable, KeyCode, MenuItemType, MetaKeys } from '@univerjs/ui';
|
||||
import { debounceTime, Observable } from 'rxjs';
|
||||
import type { IAccessor } from '@univerjs/core';
|
||||
import type { IMenuButtonItem, IShortcutItem } from '@univerjs/ui';
|
||||
import { shouldDisableAddLink, ShowDocHyperLinkEditPopupOperation } from '../commands/operations/popup.operation';
|
||||
|
||||
export const DOC_LINK_ICON = 'doc-hyper-link-icon';
|
||||
|
||||
+3
-3
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { DocumentDataModel } from '@univerjs/core';
|
||||
import { CustomRangeType, Disposable, ICommandService, Inject } from '@univerjs/core';
|
||||
import { DocEventManagerService } from '@univerjs/docs-ui';
|
||||
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
||||
import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
|
||||
import { DocEventManagerService } from '@univerjs/docs-ui';
|
||||
import type { DocumentDataModel } from '@univerjs/core';
|
||||
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
||||
import { ClickDocHyperLinkOperation, ToggleDocHyperLinkInfoPopupOperation } from '../../commands/operations/popup.operation';
|
||||
import { DocHyperLinkPopupService } from '../../services/hyper-link-popup.service';
|
||||
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { DocumentDataModel, IDisposable, ITextRangeParam, Nullable } from '@univerjs/core';
|
||||
import { Disposable, Inject, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
|
||||
import { DocSelectionManagerService } from '@univerjs/docs';
|
||||
import { DocCanvasPopManagerService } from '@univerjs/docs-ui';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { DocSelectionManagerService } from '@univerjs/docs';
|
||||
import type { DocumentDataModel, IDisposable, ITextRangeParam, Nullable } from '@univerjs/core';
|
||||
import { DocHyperLinkEdit } from '../views/hyper-link-edit';
|
||||
import { DocLinkPopup } from '../views/hyper-link-popup';
|
||||
|
||||
|
||||
@@ -14,17 +14,17 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Button, FormLayout, Input } from '@univerjs/design';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { getBodySlice, ICommandService, IUniverInstanceService, LocaleService, Tools, UniverInstanceType, useDependency, useObservable } from '@univerjs/core';
|
||||
import type { DocumentDataModel } from '@univerjs/core';
|
||||
import { Button, FormLayout, Input } from '@univerjs/design';
|
||||
import { DocSelectionManagerService } from '@univerjs/docs';
|
||||
import { KeyCode } from '@univerjs/ui';
|
||||
import { IRenderManagerService } from '@univerjs/engine-render';
|
||||
import { DocSelectionRenderService, getPlainTextFormBody } from '@univerjs/docs-ui';
|
||||
import { DocHyperLinkPopupService } from '../../services/hyper-link-popup.service';
|
||||
import { IRenderManagerService } from '@univerjs/engine-render';
|
||||
import { KeyCode } from '@univerjs/ui';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import type { DocumentDataModel } from '@univerjs/core';
|
||||
import { AddDocHyperLinkCommand } from '../../commands/commands/add-link.command';
|
||||
import { UpdateDocHyperLinkCommand } from '../../commands/commands/update-link.command';
|
||||
import { DocHyperLinkPopupService } from '../../services/hyper-link-popup.service';
|
||||
import styles from './index.module.less';
|
||||
|
||||
function hasProtocol(urlString: string) {
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { ICommand, IDocumentBody } from '@univerjs/core';
|
||||
import { CommandType, CustomRangeType, DataStreamTreeTokenType, ICommandService } from '@univerjs/core';
|
||||
import { DocSelectionManagerService } from '@univerjs/docs';
|
||||
import { deleteCustomRangeFactory, replaceSelectionFactory } from '@univerjs/docs-ui';
|
||||
import type { ICommand, IDocumentBody } from '@univerjs/core';
|
||||
import type { IDocMention } from '../../types/interfaces/i-mention';
|
||||
|
||||
export interface IAddDocMentionCommandParams {
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
|
||||
import { Disposable, ICommandService, Inject, LifecycleStages, OnLifecycle, Tools } from '@univerjs/core';
|
||||
import { DocSelectionManagerService } from '@univerjs/docs';
|
||||
import type { IInsertCommandParams } from '@univerjs/docs-ui';
|
||||
import { DeleteLeftCommand, InsertCommand, MoveCursorOperation } from '@univerjs/docs-ui';
|
||||
import { DocMentionPopupService } from '../services/doc-mention-popup.service';
|
||||
import type { IInsertCommandParams } from '@univerjs/docs-ui';
|
||||
import { CloseMentionEditPopupOperation, ShowMentionEditPopupOperation } from '../commands/operations/mention-popup.operation';
|
||||
import { DocMentionService } from '../services/doc-mention.service';
|
||||
import { DocMentionPopupService } from '../services/doc-mention-popup.service';
|
||||
|
||||
@OnLifecycle(LifecycleStages.Rendered, DocMentionTriggerController)
|
||||
export class DocMentionTriggerController extends Disposable {
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
|
||||
import { ICommandService, IUniverInstanceService, Tools, UniverInstanceType, useDependency, useObservable, UserManagerService } from '@univerjs/core';
|
||||
import React, { useEffect } from 'react';
|
||||
import { IRenderManagerService } from '@univerjs/engine-render';
|
||||
import { DocSelectionRenderService } from '@univerjs/docs-ui';
|
||||
import { DocMentionPopupService } from '../../services/doc-mention-popup.service';
|
||||
import { MentionList } from '../mention-list';
|
||||
import { IRenderManagerService } from '@univerjs/engine-render';
|
||||
import React, { useEffect } from 'react';
|
||||
import { AddDocMentionCommand } from '../../commands/commands/doc-mention.command';
|
||||
import { DocMentionPopupService } from '../../services/doc-mention-popup.service';
|
||||
import { MentionType } from '../../types/enums/mention-type';
|
||||
import { MentionList } from '../mention-list';
|
||||
import type { IMention } from '../../types/interfaces/i-mention';
|
||||
|
||||
export const MentionEditPopup = () => {
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { ICommand, ITextRange } from '@univerjs/core';
|
||||
import { CommandType, CustomDecorationType, ICommandService, sequenceExecuteAsync } from '@univerjs/core';
|
||||
import type { IThreadComment } from '@univerjs/thread-comment';
|
||||
import { addCustomDecorationBySelectionFactory } from '@univerjs/docs-ui';
|
||||
import { AddCommentMutation, IThreadCommentDataSourceService } from '@univerjs/thread-comment';
|
||||
import { SetActiveCommentOperation } from '@univerjs/thread-comment-ui';
|
||||
import { addCustomDecorationBySelectionFactory } from '@univerjs/docs-ui';
|
||||
import type { ICommand, ITextRange } from '@univerjs/core';
|
||||
import type { IThreadComment } from '@univerjs/thread-comment';
|
||||
import { DEFAULT_DOC_SUBUNIT_ID } from '../../common/const';
|
||||
|
||||
export interface IAddDocCommentComment {
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { ICommand } from '@univerjs/core';
|
||||
import { CommandType, ICommandService, sequenceExecute } from '@univerjs/core';
|
||||
import { deleteCustomDecorationFactory } from '@univerjs/docs-ui';
|
||||
import type { ICommand } from '@univerjs/core';
|
||||
|
||||
export interface IDeleteDocCommentComment {
|
||||
unitId: string;
|
||||
|
||||
+6
-6
@@ -14,17 +14,17 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { DocumentDataModel, ICommand } from '@univerjs/core';
|
||||
import { CommandType, ICommandService, IUniverInstanceService, UniverInstanceType, UserManagerService } from '@univerjs/core';
|
||||
import type { ActiveCommentInfo } from '@univerjs/thread-comment-ui';
|
||||
import { DocSelectionManagerService } from '@univerjs/docs';
|
||||
import { DocSelectionRenderService, getSelectionText } from '@univerjs/docs-ui';
|
||||
import { IRenderManagerService } from '@univerjs/engine-render';
|
||||
import { getDT, ThreadCommentPanelService } from '@univerjs/thread-comment-ui';
|
||||
import { ISidebarService } from '@univerjs/ui';
|
||||
import { DocSelectionManagerService } from '@univerjs/docs';
|
||||
import { IRenderManagerService } from '@univerjs/engine-render';
|
||||
import { DocSelectionRenderService, getSelectionText } from '@univerjs/docs-ui';
|
||||
import { DocThreadCommentPanel } from '../../views/doc-thread-comment-panel';
|
||||
import type { DocumentDataModel, ICommand } from '@univerjs/core';
|
||||
import type { ActiveCommentInfo } from '@univerjs/thread-comment-ui';
|
||||
import { DEFAULT_DOC_SUBUNIT_ID } from '../../common/const';
|
||||
import { DocThreadCommentService } from '../../services/doc-thread-comment.service';
|
||||
import { DocThreadCommentPanel } from '../../views/doc-thread-comment-panel';
|
||||
|
||||
export interface IShowCommentPanelOperationParams {
|
||||
activeComment: ActiveCommentInfo;
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { IAccessor } from '@univerjs/core';
|
||||
import { UniverInstanceType } from '@univerjs/core';
|
||||
import type { IMenuButtonItem } from '@univerjs/ui';
|
||||
import { getMenuHiddenObservable, MenuItemType } from '@univerjs/ui';
|
||||
import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
|
||||
import { DocumentEditArea, IRenderManagerService } from '@univerjs/engine-render';
|
||||
import { getMenuHiddenObservable, MenuItemType } from '@univerjs/ui';
|
||||
import { debounceTime, Observable } from 'rxjs';
|
||||
import type { IAccessor } from '@univerjs/core';
|
||||
import type { IMenuButtonItem } from '@univerjs/ui';
|
||||
import { StartAddCommentOperation, ToggleCommentPanelOperation } from '../commands/operations/show-comment-panel.operation';
|
||||
|
||||
export const shouldDisableAddComment = (accessor: IAccessor) => {
|
||||
|
||||
@@ -14,19 +14,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { DocumentDataModel } from '@univerjs/core';
|
||||
import { ICommandService, Injector, IUniverInstanceService, UniverInstanceType, useDependency, useObservable } from '@univerjs/core';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import { ThreadCommentPanel } from '@univerjs/thread-comment-ui';
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import { debounceTime, Observable } from 'rxjs';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import { DEFAULT_DOC_SUBUNIT_ID } from '../../common/const';
|
||||
import { StartAddCommentOperation } from '../../commands/operations/show-comment-panel.operation';
|
||||
import { DocThreadCommentService } from '../../services/doc-thread-comment.service';
|
||||
import type { IAddDocCommentComment } from '../../commands/commands/add-doc-comment.command';
|
||||
import type { DocumentDataModel } from '@univerjs/core';
|
||||
import { AddDocCommentComment } from '../../commands/commands/add-doc-comment.command';
|
||||
import { DeleteDocCommentComment, type IDeleteDocCommentComment } from '../../commands/commands/delete-doc-comment.command';
|
||||
import { StartAddCommentOperation } from '../../commands/operations/show-comment-panel.operation';
|
||||
import { DEFAULT_DOC_SUBUNIT_ID } from '../../common/const';
|
||||
import { shouldDisableAddComment } from '../../controllers/menu';
|
||||
import { DocThreadCommentService } from '../../services/doc-thread-comment.service';
|
||||
import type { IAddDocCommentComment } from '../../commands/commands/add-doc-comment.command';
|
||||
|
||||
export const DocThreadCommentPanel = () => {
|
||||
const univerInstanceService = useDependency(IUniverInstanceService);
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { DocumentDataModel, IUniverInstanceService, Nullable } from '@univerjs/core';
|
||||
import { UniverInstanceType } from '@univerjs/core';
|
||||
import type { DocumentDataModel, IUniverInstanceService, Nullable } from '@univerjs/core';
|
||||
import type { DocBackground, Documents, Engine, IRenderContext, IRenderManagerService, Scene } from '@univerjs/engine-render';
|
||||
import { DOCS_VIEW_KEY } from './docs-view-key';
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { CustomDecorationType, DocumentDataModel, IAccessor, IMutationInfo } from '@univerjs/core';
|
||||
import { getBodySlice, IUniverInstanceService, JSONX, TextX, TextXActionType, Tools, UniverInstanceType, UpdateDocsAttributeType } from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import type { CustomDecorationType, DocumentDataModel, IAccessor, IMutationInfo } from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
|
||||
interface IAddCustomDecorationParam {
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { CustomRangeType, DocumentDataModel, IAccessor, IDocumentBody, IMutationInfo, ITextRange } from '@univerjs/core';
|
||||
import { DataStreamTreeTokenType, IUniverInstanceService, JSONX, TextX, TextXActionType, UniverInstanceType } from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import type { CustomRangeType, DocumentDataModel, IAccessor, IDocumentBody, IMutationInfo, ITextRange } from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { getRichTextEditPath } from '../commands/util';
|
||||
import { getSelectionForAddCustomRange, normalizeSelection } from './selection';
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { ICustomRange, ITextRange } from '@univerjs/core';
|
||||
import { DataStreamTreeTokenType, generateRandomId, Tools } from '@univerjs/core';
|
||||
import type { ICustomRange, ITextRange } from '@univerjs/core';
|
||||
|
||||
export function isCustomRangeSplitSymbol(text: string) {
|
||||
return text === DataStreamTreeTokenType.CUSTOM_RANGE_END || text === DataStreamTreeTokenType.CUSTOM_RANGE_START;
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { IDocumentBody, IDocumentData } from '@univerjs/core';
|
||||
import { DataStreamTreeTokenType } from '@univerjs/core';
|
||||
import type { IDocumentBody, IDocumentData } from '@univerjs/core';
|
||||
|
||||
/**
|
||||
* get plain text from rich-text
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { DocumentDataModel, IAccessor, IDeleteAction, IDocumentBody, IMutationInfo, IRetainAction, ITextRange, ITextRangeParam } from '@univerjs/core';
|
||||
import { IUniverInstanceService, JSONX, TextX, TextXActionType } from '@univerjs/core';
|
||||
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import type { DocumentDataModel, IAccessor, IDeleteAction, IDocumentBody, IMutationInfo, IRetainAction, ITextRange, ITextRangeParam } from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
import { getRichTextEditPath } from '../commands/util';
|
||||
import { isIntersecting, shouldDeleteCustomRange } from './custom-range';
|
||||
import { getDeleteSelection } from './selection';
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { IDeleteAction, IDocumentBody, IRetainAction, ITextRange } from '@univerjs/core';
|
||||
import { TextXActionType } from '@univerjs/core';
|
||||
import type { IDeleteAction, IDocumentBody, IRetainAction, ITextRange } from '@univerjs/core';
|
||||
import { isIntersecting, shouldDeleteCustomRange } from './custom-range';
|
||||
|
||||
export function getRetainAndDeleteFromReplace(
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { IDocumentBody, ITextRange, Nullable } from '@univerjs/core';
|
||||
import { DataStreamTreeTokenType } from '@univerjs/core';
|
||||
import { isSegmentIntersects } from '@univerjs/docs';
|
||||
import type { IDocumentBody, ITextRange, Nullable } from '@univerjs/core';
|
||||
import { DeleteDirection } from '../../../docs-ui/src/types/delete-direction';
|
||||
import { isCustomRangeSplitSymbol } from './custom-range';
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { DocumentSkeletonPageType, getLastLine, lineIterator } from '@univerjs/engine-render';
|
||||
import type { Nullable } from '@univerjs/core';
|
||||
import type { IDocumentSkeletonCached, IDocumentSkeletonLine, IDocumentSkeletonPage, IDocumentSkeletonRow, IDocumentSkeletonTable } from '@univerjs/engine-render';
|
||||
import { DocumentSkeletonPageType, getLastLine, lineIterator } from '@univerjs/engine-render';
|
||||
|
||||
export function firstLineInTable(table: IDocumentSkeletonTable) {
|
||||
const firstRow = table.rows[0];
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { DocumentDataModel, ICommand, IDocumentData, Injector, IStyleBase, Univer } from '@univerjs/core';
|
||||
import { BooleanNumber, ICommandService, IUniverInstanceService, UndoCommand, UniverInstanceType } from '@univerjs/core';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation, SetTextSelectionsOperation } from '@univerjs/docs';
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
||||
|
||||
import { DocSelectionManagerService, RichTextEditingMutation, SetTextSelectionsOperation } from '@univerjs/docs';
|
||||
import type { IInnerCutCommandParams, IInnerPasteCommandParams } from '../clipboard.inner.command';
|
||||
import type { DocumentDataModel, ICommand, IDocumentData, Injector, IStyleBase, Univer } from '@univerjs/core';
|
||||
import { CutContentCommand, InnerPasteCommand } from '../clipboard.inner.command';
|
||||
import { createCommandTestBed } from './create-command-test-bed';
|
||||
import type { IInnerCutCommandParams, IInnerPasteCommandParams } from '../clipboard.inner.command';
|
||||
|
||||
function getDocumentData() {
|
||||
const TEST_DOCUMENT_DATA_EN: IDocumentData = {
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { Injector, Univer } from '@univerjs/core';
|
||||
import { ICommandService } from '@univerjs/core';
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
||||
import type { Injector, Univer } from '@univerjs/core';
|
||||
|
||||
import { SetInlineFormatBoldCommand } from '../inline-format.command';
|
||||
import { createCommandTestBed } from './create-command-test-bed';
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
/* eslint-disable ts/no-explicit-any */
|
||||
|
||||
import type { Ctor, Dependency, DependencyIdentifier, DocumentDataModel, IDocumentData, Nullable } from '@univerjs/core';
|
||||
import {
|
||||
BooleanNumber,
|
||||
DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
|
||||
@@ -31,13 +30,14 @@ import {
|
||||
Univer,
|
||||
UniverInstanceType,
|
||||
} from '@univerjs/core';
|
||||
import type { DocumentSkeleton, IRender, IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
||||
import { DocumentViewModel, IRenderManagerService } from '@univerjs/engine-render';
|
||||
|
||||
import { BehaviorSubject, takeUntil } from 'rxjs';
|
||||
import { DocSelectionManagerService, DocSkeletonManagerService, DocStateEmitService } from '@univerjs/docs';
|
||||
import { DocStateChangeManagerService } from '../../../services/doc-state-change-manager.service';
|
||||
import { DocumentViewModel, IRenderManagerService } from '@univerjs/engine-render';
|
||||
import { BehaviorSubject, takeUntil } from 'rxjs';
|
||||
|
||||
import type { Ctor, Dependency, DependencyIdentifier, DocumentDataModel, IDocumentData, Nullable } from '@univerjs/core';
|
||||
import type { DocumentSkeleton, IRender, IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
||||
import { DocIMEInputManagerService } from '../../../services/doc-ime-input-manager.service';
|
||||
import { DocStateChangeManagerService } from '../../../services/doc-state-change-manager.service';
|
||||
import { DocSelectionRenderService } from '../../../services/selection/doc-selection-render.service';
|
||||
|
||||
const TEST_DOCUMENT_DATA_EN: IDocumentData = {
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { DocumentDataModel, ICommand, Injector, IStyleBase, Univer } from '@univerjs/core';
|
||||
import { BooleanNumber, ICommandService, IUniverInstanceService, RedoCommand, UndoCommand, UniverInstanceType } from '@univerjs/core';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation, SetTextSelectionsOperation } from '@univerjs/docs';
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
||||
|
||||
import { DocSelectionManagerService, RichTextEditingMutation, SetTextSelectionsOperation } from '@univerjs/docs';
|
||||
import type { DocumentDataModel, ICommand, Injector, IStyleBase, Univer } from '@univerjs/core';
|
||||
import {
|
||||
SetInlineFormatBoldCommand,
|
||||
SetInlineFormatCommand,
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { DocumentDataModel, ICommand, IDocumentData, Injector, Univer } from '@univerjs/core';
|
||||
import { ICommandService, IUniverInstanceService, RedoCommand, UndoCommand, UniverInstanceType } from '@univerjs/core';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation, SetTextSelectionsOperation } from '@univerjs/docs';
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
||||
|
||||
import { DocSelectionManagerService, RichTextEditingMutation, SetTextSelectionsOperation } from '@univerjs/docs';
|
||||
import type { DocumentDataModel, ICommand, IDocumentData, Injector, Univer } from '@univerjs/core';
|
||||
import { CoverContentCommand, ReplaceContentCommand } from '../replace-content.command';
|
||||
import { createCommandTestBed } from './create-command-test-bed';
|
||||
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { ICommand, IParagraph } from '@univerjs/core';
|
||||
import { BooleanNumber, CommandType, DataStreamTreeTokenType, getBodySlice, ICommandService, IUniverInstanceService, normalizeBody, PresetListType, Tools, updateAttributeByInsert } from '@univerjs/core';
|
||||
import { DocSelectionManagerService } from '@univerjs/docs';
|
||||
import { getInsertSelection } from '../../basics/selection';
|
||||
import type { ICommand, IParagraph } from '@univerjs/core';
|
||||
import { copyCustomRange } from '../../basics/custom-range';
|
||||
import { getInsertSelection } from '../../basics/selection';
|
||||
import { InsertCommand } from './core-editing.command';
|
||||
|
||||
export function generateParagraphs(dataStream: string, prevParagraph?: IParagraph): IParagraph[] {
|
||||
|
||||
@@ -14,16 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type {
|
||||
DocumentDataModel,
|
||||
ICommand,
|
||||
IDocumentBody,
|
||||
IDocumentData,
|
||||
IMutationInfo,
|
||||
ITextRange,
|
||||
JSONXActions,
|
||||
Nullable,
|
||||
} from '@univerjs/core';
|
||||
import {
|
||||
CommandType,
|
||||
ICommandService,
|
||||
@@ -34,12 +24,22 @@ import {
|
||||
TextXActionType,
|
||||
Tools,
|
||||
} from '@univerjs/core';
|
||||
import type { DocumentViewModel, IRectRangeWithStyle, ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import type {
|
||||
DocumentDataModel,
|
||||
ICommand,
|
||||
IDocumentBody,
|
||||
IDocumentData,
|
||||
IMutationInfo,
|
||||
ITextRange,
|
||||
JSONXActions,
|
||||
Nullable,
|
||||
} from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import type { DocumentViewModel, IRectRangeWithStyle, ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
import { getRetainAndDeleteAndExcludeLineBreak } from '../../basics/replace';
|
||||
import { getCommandSkeleton, getRichTextEditPath } from '../util';
|
||||
import { getRetainAndDeleteFromReplace } from '../../basics/retain-delete-params';
|
||||
import { getCommandSkeleton, getRichTextEditPath } from '../util';
|
||||
import { getDeleteRowContentActionParams, getDeleteRowsActionsParams, getDeleteTableActionParams } from './table/table';
|
||||
|
||||
export function getCustomBlockIdsInSelections(body: IDocumentBody, selections: ITextRange[]): string[] {
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { CommandType, ICommandService, IUniverInstanceService, JSONX, TextX, TextXActionType, UniverInstanceType } from '@univerjs/core';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import type {
|
||||
DocumentDataModel,
|
||||
ICommand,
|
||||
@@ -23,15 +25,13 @@ import type {
|
||||
ITextRange,
|
||||
UpdateDocsAttributeType,
|
||||
} from '@univerjs/core';
|
||||
import { CommandType, ICommandService, IUniverInstanceService, JSONX, TextX, TextXActionType, UniverInstanceType } from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
import { getInsertSelection } from '../../basics/selection';
|
||||
import { isIntersecting, shouldDeleteCustomRange } from '../../basics/custom-range';
|
||||
import { getRetainAndDeleteFromReplace } from '../../basics/retain-delete-params';
|
||||
import { getInsertSelection } from '../../basics/selection';
|
||||
import { DeleteDirection } from '../../types/delete-direction';
|
||||
import { getRichTextEditPath } from '../util';
|
||||
import { getRetainAndDeleteFromReplace } from '../../basics/retain-delete-params';
|
||||
|
||||
export interface IInsertCommandParams {
|
||||
unitId: string;
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { IAccessor, ICommand, ICustomBlock, IDocumentBody, IMutationInfo, IParagraph, ITextRange, ITextRun, JSONXActions, Nullable } from '@univerjs/core';
|
||||
import {
|
||||
CommandType,
|
||||
DataStreamTreeTokenType,
|
||||
@@ -30,14 +29,15 @@ import {
|
||||
Tools,
|
||||
UpdateDocsAttributeType,
|
||||
} from '@univerjs/core';
|
||||
import type { IRectRangeWithStyle, ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import { getParagraphByGlyph, hasListGlyph, isFirstGlyph, isIndentByGlyph } from '@univerjs/engine-render';
|
||||
import type { IAccessor, ICommand, ICustomBlock, IDocumentBody, IMutationInfo, IParagraph, ITextRange, ITextRun, JSONXActions, Nullable } from '@univerjs/core';
|
||||
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import type { IRectRangeWithStyle, ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
import { getDeleteSelection } from '../../basics/selection';
|
||||
import { getCommandSkeleton, getRichTextEditPath } from '../util';
|
||||
import { DeleteDirection } from '../../types/delete-direction';
|
||||
import { getCommandSkeleton, getRichTextEditPath } from '../util';
|
||||
import { CutContentCommand } from './clipboard.inner.command';
|
||||
import { DeleteCommand, UpdateCommand } from './core-editing.command';
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { DocumentDataModel, IAccessor, ICommand, IMutationInfo, IParagraphStyle } from '@univerjs/core';
|
||||
import { CommandType, ICommandService, IUniverInstanceService, JSONX, MemoryCursor, TextX, TextXActionType, UniverInstanceType, UpdateDocsAttributeType } from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import type { DocumentDataModel, IAccessor, ICommand, IMutationInfo, IParagraphStyle } from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { getRichTextEditPath } from '../util';
|
||||
import { getParagraphsInRanges } from './list.command';
|
||||
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { ICommand, ICommandInfo } from '@univerjs/core';
|
||||
import { CommandType, ICommandService, IUniverInstanceService, JSONX, TextX, TextXActionType } from '@univerjs/core';
|
||||
import { IRenderManagerService, type ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { RichTextEditingMutation } from '@univerjs/docs';
|
||||
import { DocIMEInputManagerService } from '../../services/doc-ime-input-manager.service';
|
||||
import { getInsertSelection } from '../../basics/selection';
|
||||
import { getRichTextEditPath } from '../util';
|
||||
import { IRenderManagerService, type ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
import type { ICommand, ICommandInfo } from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { getRetainAndDeleteFromReplace } from '../../basics/retain-delete-params';
|
||||
import { getInsertSelection } from '../../basics/selection';
|
||||
import { DocIMEInputManagerService } from '../../services/doc-ime-input-manager.service';
|
||||
import { getRichTextEditPath } from '../util';
|
||||
|
||||
export interface IIMEInputCommandParams {
|
||||
unitId: string;
|
||||
|
||||
@@ -14,17 +14,17 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type {
|
||||
ICommand, IDocumentBody, IMutationInfo, IStyleBase, ITextDecoration, ITextRun,
|
||||
} from '@univerjs/core';
|
||||
import {
|
||||
BaselineOffset, BooleanNumber, CommandType,
|
||||
ICommandService, IUniverInstanceService,
|
||||
JSONX, MemoryCursor,
|
||||
TextX, TextXActionType,
|
||||
} from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import type {
|
||||
ICommand, IDocumentBody, IMutationInfo, IStyleBase, ITextDecoration, ITextRun,
|
||||
} from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
import { getRichTextEditPath } from '../util';
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { ICommand, IListData, IMutationInfo, IParagraph, IParagraphRange, ISectionBreak } from '@univerjs/core';
|
||||
import {
|
||||
CommandType,
|
||||
GridType,
|
||||
@@ -30,12 +29,13 @@ import {
|
||||
Tools,
|
||||
UpdateDocsAttributeType,
|
||||
} from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
import { getCharSpaceApply, getNumberUnitValue } from '@univerjs/engine-render';
|
||||
import { getRichTextEditPath } from '../util';
|
||||
import type { ICommand, IListData, IMutationInfo, IParagraph, IParagraphRange, ISectionBreak } from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
import { hasParagraphInTable } from '../../basics/paragraph';
|
||||
import { getRichTextEditPath } from '../util';
|
||||
|
||||
interface IListOperationCommandParams {
|
||||
listType: PresetListType;
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { ICommand, IMutationInfo, IParagraphStyle } from '@univerjs/core';
|
||||
import {
|
||||
CommandType, HorizontalAlign,
|
||||
ICommandService,
|
||||
@@ -25,9 +24,10 @@ import {
|
||||
TextXActionType,
|
||||
UpdateDocsAttributeType,
|
||||
} from '@univerjs/core';
|
||||
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
|
||||
import type { ICommand, IMutationInfo, IParagraphStyle } from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { getRichTextEditPath } from '../util';
|
||||
import { getParagraphsInRanges } from './list.command';
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { DocumentDataModel, ICommand, IDocumentBody, IMutationInfo, ITextRange } from '@univerjs/core';
|
||||
import { CommandType, ICommandService, IUndoRedoService, IUniverInstanceService, JSONX, TextX, TextXActionType } from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import type { DocumentDataModel, ICommand, IDocumentBody, IMutationInfo, ITextRange } from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
import { getRetainAndDeleteAndExcludeLineBreak } from '../../basics/replace';
|
||||
import { getRichTextEditPath } from '../util';
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { IAccessor, ICommand } from '@univerjs/core';
|
||||
import { CommandType, ICommandService, IUndoRedoService, IUniverInstanceService } from '@univerjs/core';
|
||||
import type { IAccessor, ICommand } from '@univerjs/core';
|
||||
|
||||
import type { ISetDocZoomRatioOperationParams } from '../operations/set-doc-zoom-ratio.operation';
|
||||
import {
|
||||
SetDocZoomRatioOperation,
|
||||
SetDocZoomRatioUndoMutationFactory,
|
||||
} from '../operations/set-doc-zoom-ratio.operation';
|
||||
import type { ISetDocZoomRatioOperationParams } from '../operations/set-doc-zoom-ratio.operation';
|
||||
|
||||
export interface ISetDocZoomRatioCommandParams {
|
||||
zoomRatio?: number;
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
|
||||
import { CommandType, DataStreamTreeTokenType, ICommandService, IUniverInstanceService, JSONX, TextX, TextXActionType } from '@univerjs/core';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import type { ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
import { getInsertSelection } from '../../../basics/selection';
|
||||
import { getCommandSkeleton, getRichTextEditPath } from '../../util';
|
||||
import { generateParagraphs } from '../break-line.command';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
import { genEmptyTable, genTableSource } from './table';
|
||||
|
||||
export const CreateDocTableCommandId = 'doc.command.create-table';
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
|
||||
import { CommandType, ICommandService, IUniverInstanceService, JSONX, TextX, TextXActionType } from '@univerjs/core';
|
||||
import type { ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
|
||||
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import type { ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
import { getCommandSkeleton, getRichTextEditPath } from '../../util';
|
||||
import { getDeleteColumnsActionParams, getDeleteRowsActionsParams, getDeleteTableActionParams, getRangeInfoFromRanges } from './table';
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
|
||||
import { CommandType, ICommandService, IUniverInstanceService, JSONX, TextX, TextXActionType } from '@univerjs/core';
|
||||
import type { ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
|
||||
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import type { ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
import { getCommandSkeleton, getRichTextEditPath } from '../../util';
|
||||
import { getColumnWidths, getEmptyTableCell, getEmptyTableRow, getInsertColumnActionsParams, getInsertColumnBody, getInsertRowActionsParams, getInsertRowBody, getRangeInfoFromRanges, getTableColumn, INSERT_COLUMN_POSITION, INSERT_ROW_POSITION } from './table';
|
||||
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { ICommand, Nullable } from '@univerjs/core';
|
||||
import { CommandType, ICommandService, IUniverInstanceService } from '@univerjs/core';
|
||||
import { DocSelectionManagerService } from '@univerjs/docs';
|
||||
import type { ICommand, Nullable } from '@univerjs/core';
|
||||
import { getCommandSkeleton } from '../../util';
|
||||
import type { IOffsets } from './table';
|
||||
import { CellPosition, getCellOffsets, INSERT_ROW_POSITION } from './table';
|
||||
import { DocTableInsertRowCommand } from './doc-table-insert.command';
|
||||
import { CellPosition, getCellOffsets, INSERT_ROW_POSITION } from './table';
|
||||
import type { IOffsets } from './table';
|
||||
|
||||
export interface IDocTableTabCommandParams {
|
||||
shift: boolean;
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { IParagraph, ISectionBreak, ITable, ITableCell, ITableColumn, ITableRow, Nullable } from '@univerjs/core';
|
||||
import { DataStreamTreeTokenType, generateRandomId, ObjectRelativeFromH, ObjectRelativeFromV, TableAlignmentType, TableCellHeightRule, TableSizeType, TableTextWrapType, Tools } from '@univerjs/core';
|
||||
import type { IParagraph, ISectionBreak, ITable, ITableCell, ITableColumn, ITableRow, Nullable } from '@univerjs/core';
|
||||
import type { DataStreamTreeNode, DocumentViewModel, ITextRangeWithStyle } from '@univerjs/engine-render';
|
||||
|
||||
export enum INSERT_ROW_POSITION {
|
||||
|
||||
@@ -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 type { Direction, IOperation } from '@univerjs/core';
|
||||
import { CommandType } from '@univerjs/core';
|
||||
import type { Direction, IOperation } from '@univerjs/core';
|
||||
|
||||
export interface IMoveCursorOperationParams {
|
||||
direction: Direction;
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { ICommand } from '@univerjs/core';
|
||||
import { CommandType, IUniverInstanceService } from '@univerjs/core';
|
||||
import { DocSelectionManagerService } from '@univerjs/docs';
|
||||
import type { ICommand } from '@univerjs/core';
|
||||
|
||||
interface ISelectAllOperationParams { }
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { IAccessor, IOperation } from '@univerjs/core';
|
||||
import { CommandType, IUniverInstanceService, Tools } from '@univerjs/core';
|
||||
import type { IAccessor, IOperation } from '@univerjs/core';
|
||||
|
||||
export interface ISetDocZoomRatioOperationParams {
|
||||
zoomRatio: number;
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { DocSkeletonManagerService } from '@univerjs/docs';
|
||||
import { IRenderManagerService } from '@univerjs/engine-render';
|
||||
import type { DocumentDataModel, IAccessor } from '@univerjs/core';
|
||||
import { DocSkeletonManagerService } from '@univerjs/docs';
|
||||
|
||||
/**
|
||||
* Get the skeleton of the command's target.
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
|
||||
import { Disposable, Inject, LifecycleStages, OnLifecycle, QuickListTypeMap } from '@univerjs/core';
|
||||
import type { Nullable } from 'vitest';
|
||||
import { DocAutoFormatService } from '../services/doc-auto-format.service';
|
||||
import type { ITabCommandParams } from '../commands/commands/auto-format.command';
|
||||
import { AfterSpaceCommand, EnterCommand, TabCommand } from '../commands/commands/auto-format.command';
|
||||
import { BreakLineCommand } from '../commands/commands/break-line.command';
|
||||
import { ChangeListNestingLevelCommand, ChangeListNestingLevelType, ListOperationCommand, QuickListCommand } from '../commands/commands/list.command';
|
||||
import { DocTableTabCommand } from '../commands/commands/table/doc-table-tab.command';
|
||||
import { DocAutoFormatService } from '../services/doc-auto-format.service';
|
||||
import { isInSameTableCell } from '../services/selection/convert-rect-range';
|
||||
import { BreakLineCommand } from '../commands/commands/break-line.command';
|
||||
import type { ITabCommandParams } from '../commands/commands/auto-format.command';
|
||||
|
||||
@OnLifecycle(LifecycleStages.Rendered, DocAutoFormatController)
|
||||
export class DocAutoFormatController extends Disposable {
|
||||
|
||||
@@ -14,20 +14,20 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { DocumentDataModel } from '@univerjs/core';
|
||||
import { BooleanNumber, Disposable, DocumentFlavor, ICommandService, Inject, IUniverInstanceService, LocaleService, toDisposable, Tools } from '@univerjs/core';
|
||||
import type { Documents, DocumentViewModel, IMouseEvent, IPageRenderConfig, IPathProps, IPointerEvent, IRenderContext, IRenderModule, RenderComponentType } from '@univerjs/engine-render';
|
||||
import { DocumentEditArea, IRenderManagerService, PageLayoutType, Path, Rect, Vector2 } from '@univerjs/engine-render';
|
||||
|
||||
import { ComponentManager, IEditorService } from '@univerjs/ui';
|
||||
import { DocSkeletonManagerService } from '@univerjs/docs';
|
||||
import { DocumentEditArea, IRenderManagerService, PageLayoutType, Path, Rect, Vector2 } from '@univerjs/engine-render';
|
||||
import { ComponentManager, IEditorService } from '@univerjs/ui';
|
||||
|
||||
import type { DocumentDataModel } from '@univerjs/core';
|
||||
import type { Documents, DocumentViewModel, IMouseEvent, IPageRenderConfig, IPathProps, IPointerEvent, IRenderContext, IRenderModule, RenderComponentType } from '@univerjs/engine-render';
|
||||
import type { Nullable } from 'vitest';
|
||||
import { TextBubbleShape } from '../views/header-footer/text-bubble';
|
||||
import { neoGetDocObject } from '../basics/component-tools';
|
||||
import { CoreHeaderFooterCommand } from '../commands/commands/doc-header-footer.command';
|
||||
import { DocSelectionRenderService } from '../services/selection/doc-selection-render.service';
|
||||
import { COMPONENT_DOC_HEADER_FOOTER_PANEL } from '../views/header-footer/panel/component-name';
|
||||
import { DocHeaderFooterPanel } from '../views/header-footer/panel/DocHeaderFooterPanel';
|
||||
import { DocSelectionRenderService } from '../services/selection/doc-selection-render.service';
|
||||
import { neoGetDocObject } from '../basics/component-tools';
|
||||
import { TextBubbleShape } from '../views/header-footer/text-bubble';
|
||||
|
||||
const HEADER_FOOTER_STROKE_COLOR = 'rgba(58, 96, 247, 1)';
|
||||
const HEADER_FOOTER_FILL_COLOR = 'rgba(58, 96, 247, 0.08)';
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { ICommandInfo, Nullable } from '@univerjs/core';
|
||||
import {
|
||||
DataStreamTreeTokenType,
|
||||
Direction,
|
||||
@@ -26,6 +25,9 @@ import {
|
||||
OnLifecycle,
|
||||
RANGE_DIRECTION,
|
||||
} from '@univerjs/core';
|
||||
import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
|
||||
import { DocumentSkeletonPageType, IRenderManagerService } from '@univerjs/engine-render';
|
||||
import type { ICommandInfo, Nullable } from '@univerjs/core';
|
||||
import type {
|
||||
DocumentSkeleton,
|
||||
IDocumentSkeletonCached,
|
||||
@@ -36,15 +38,13 @@ import type {
|
||||
INodePosition,
|
||||
INodeSearch,
|
||||
} from '@univerjs/engine-render';
|
||||
import { DocumentSkeletonPageType, IRenderManagerService } from '@univerjs/engine-render';
|
||||
import type { Subscription } from 'rxjs';
|
||||
|
||||
import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
|
||||
import type { Subscription } from 'rxjs';
|
||||
import { getDocObject } from '../basics/component-tools';
|
||||
import { findAboveCell, findBellowCell, findLineBeforeAndAfterTable, findTableAfterLine, findTableBeforeLine, firstLineInCell, firstLineInTable, lastLineInCell, lastLineInTable } from '../basics/table';
|
||||
import { MoveCursorOperation, MoveSelectionOperation } from '../commands/operations/doc-cursor.operation';
|
||||
import { NodePositionConvertToCursor } from '../services/selection/convert-text-range';
|
||||
import type { IMoveCursorOperationParams } from '../commands/operations/doc-cursor.operation';
|
||||
import { MoveCursorOperation, MoveSelectionOperation } from '../commands/operations/doc-cursor.operation';
|
||||
import { findAboveCell, findBellowCell, findLineBeforeAndAfterTable, findTableAfterLine, findTableBeforeLine, firstLineInCell, firstLineInTable, lastLineInCell, lastLineInTable } from '../basics/table';
|
||||
import { getDocObject } from '../basics/component-tools';
|
||||
|
||||
@OnLifecycle(LifecycleStages.Rendered, DocMoveCursorController)
|
||||
export class DocMoveCursorController extends Disposable {
|
||||
@@ -105,7 +105,8 @@ export class DocMoveCursorController extends Disposable {
|
||||
}
|
||||
|
||||
const skeleton = this._renderManagerService.getRenderById(docDataModel.getUnitId())
|
||||
?.with(DocSkeletonManagerService).getSkeleton();
|
||||
?.with(DocSkeletonManagerService)
|
||||
.getSkeleton();
|
||||
const docObject = this._getDocObject();
|
||||
|
||||
if (activeRange == null || skeleton == null || docObject == null) {
|
||||
@@ -218,7 +219,8 @@ export class DocMoveCursorController extends Disposable {
|
||||
}
|
||||
|
||||
const skeleton = this._renderManagerService.getRenderById(docDataModel.getUnitId())
|
||||
?.with(DocSkeletonManagerService).getSkeleton();
|
||||
?.with(DocSkeletonManagerService)
|
||||
.getSkeleton();
|
||||
const docObject = this._getDocObject();
|
||||
if (activeRange == null || skeleton == null || docObject == null || allRanges == null) {
|
||||
return;
|
||||
|
||||
@@ -26,10 +26,12 @@ import {
|
||||
OnLifecycle,
|
||||
UniverInstanceType,
|
||||
} from '@univerjs/core';
|
||||
import { BuiltInUIPart, ComponentManager, ILayoutService, IMenuManagerService, IShortcutService, IUIPartsService } from '@univerjs/ui';
|
||||
|
||||
import { IRenderManagerService } from '@univerjs/engine-render';
|
||||
|
||||
import { TodoList } from '@univerjs/icons';
|
||||
import { BuiltInUIPart, ComponentManager, ILayoutService, IMenuManagerService, IShortcutService, IUIPartsService } from '@univerjs/ui';
|
||||
import { CoreHeaderFooterCommand, OpenHeaderFooterPanelCommand } from '../commands/commands/doc-header-footer.command';
|
||||
import { SidebarDocHeaderFooterPanelOperation } from '../commands/operations/doc-header-footer-panel.operation';
|
||||
import { COLOR_PICKER_COMPONENT, ColorPicker } from '../components/color-picker';
|
||||
import {
|
||||
FONT_FAMILY_COMPONENT,
|
||||
@@ -38,9 +40,9 @@ import {
|
||||
FontFamilyItem,
|
||||
} from '../components/font-family';
|
||||
import { FONT_SIZE_COMPONENT, FontSize } from '../components/font-size';
|
||||
import { CoreHeaderFooterCommand, OpenHeaderFooterPanelCommand } from '../commands/commands/doc-header-footer.command';
|
||||
import { SidebarDocHeaderFooterPanelOperation } from '../commands/operations/doc-header-footer-panel.operation';
|
||||
import { DocFooter } from '../views/doc-footer';
|
||||
import { BULLET_LIST_TYPE_COMPONENT, BulletListTypePicker, ORDER_LIST_TYPE_COMPONENT, OrderListTypePicker } from '../components/list-type-picker';
|
||||
import { DocSelectionRenderService } from '../services/selection/doc-selection-render.service';
|
||||
import { TabShortCut } from '../shortcuts/format.shortcut';
|
||||
import {
|
||||
AlignCenterShortCut,
|
||||
AlignJustifyShortCut,
|
||||
@@ -55,12 +57,10 @@ import {
|
||||
SuperscriptShortCut,
|
||||
UnderlineShortCut,
|
||||
} from '../shortcuts/toolbar.shortcut';
|
||||
import { TabShortCut } from '../shortcuts/format.shortcut';
|
||||
import { BULLET_LIST_TYPE_COMPONENT, BulletListTypePicker, ORDER_LIST_TYPE_COMPONENT, OrderListTypePicker } from '../components/list-type-picker';
|
||||
import { DocSelectionRenderService } from '../services/selection/doc-selection-render.service';
|
||||
import { DocFooter } from '../views/doc-footer';
|
||||
import { PLUGIN_CONFIG_KEY } from './config.schema';
|
||||
import { menuSchema } from './menu.schema';
|
||||
import type { IUniverDocsUIConfig } from './config.schema';
|
||||
import { PLUGIN_CONFIG_KEY } from './config.schema';
|
||||
|
||||
// FIXME: LifecycleStages.Rendered must be used, otherwise the menu cannot be added to the DOM, but the sheet ui plug-in can be added in LifecycleStages.Ready
|
||||
@OnLifecycle(LifecycleStages.Rendered, DocUIController)
|
||||
|
||||
@@ -14,19 +14,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { MenuSchemaType } from '@univerjs/ui';
|
||||
import { ContextMenuGroup, ContextMenuPosition, RibbonStartGroup } from '@univerjs/ui';
|
||||
import { DocCreateTableOperation } from '../commands/operations/doc-create-table.operation';
|
||||
import { OpenHeaderFooterPanelCommand } from '../commands/commands/doc-header-footer.command';
|
||||
import type { MenuSchemaType } from '@univerjs/ui';
|
||||
import { DocCopyCommand, DocCutCommand, DocPasteCommand } from '../commands/commands/clipboard.command';
|
||||
import { DocParagraphSettingPanelOperation } from '../commands/operations/doc-paragraph-setting-panel.operation';
|
||||
import { ResetInlineFormatTextBackgroundColorCommand, SetInlineFormatBoldCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatTextBackgroundColorCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand } from '../commands/commands/inline-format.command';
|
||||
|
||||
import { BulletListCommand, CheckListCommand, OrderListCommand } from '../commands/commands/list.command';
|
||||
import { AlignCenterCommand, AlignJustifyCommand, AlignLeftCommand, AlignRightCommand } from '../commands/commands/paragraph-align.command';
|
||||
import { DeleteLeftCommand } from '../commands/commands/delete.command';
|
||||
import { DocTableInsertColumnLeftCommand, DocTableInsertColumnRightCommand, DocTableInsertRowAboveCommand, DocTableInsertRowBellowCommand } from '../commands/commands/table/doc-table-insert.command';
|
||||
import { OpenHeaderFooterPanelCommand } from '../commands/commands/doc-header-footer.command';
|
||||
import { ResetInlineFormatTextBackgroundColorCommand, SetInlineFormatBoldCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatTextBackgroundColorCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand } from '../commands/commands/inline-format.command';
|
||||
import { BulletListCommand, CheckListCommand, OrderListCommand } from '../commands/commands/list.command';
|
||||
|
||||
import { AlignCenterCommand, AlignJustifyCommand, AlignLeftCommand, AlignRightCommand } from '../commands/commands/paragraph-align.command';
|
||||
import { DocTableDeleteColumnsCommand, DocTableDeleteRowsCommand, DocTableDeleteTableCommand } from '../commands/commands/table/doc-table-delete.command';
|
||||
import { DocTableInsertColumnLeftCommand, DocTableInsertColumnRightCommand, DocTableInsertRowAboveCommand, DocTableInsertRowBellowCommand } from '../commands/commands/table/doc-table-insert.command';
|
||||
import { DocCreateTableOperation } from '../commands/operations/doc-create-table.operation';
|
||||
import { DocParagraphSettingPanelOperation } from '../commands/operations/doc-paragraph-setting-panel.operation';
|
||||
import {
|
||||
CopyMenuFactory,
|
||||
CutMenuFactory,
|
||||
|
||||
@@ -14,18 +14,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { IAccessor } from '@univerjs/core';
|
||||
import { IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
|
||||
import type { IMenuButtonItem, IMenuSelectorItem } from '@univerjs/ui';
|
||||
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 { DocSelectionManagerService } from '@univerjs/docs';
|
||||
import type { IMenuButtonItem, IMenuSelectorItem } from '@univerjs/ui';
|
||||
import { DocCopyCommand, DocCutCommand, DocPasteCommand } from '../../commands/commands/clipboard.command';
|
||||
import { DocParagraphSettingPanelOperation } from '../../commands/operations/doc-paragraph-setting-panel.operation';
|
||||
import { DeleteLeftCommand } from '../../commands/commands/delete.command';
|
||||
import { DocTableInsertColumnLeftCommand, DocTableInsertColumnRightCommand, DocTableInsertRowAboveCommand, DocTableInsertRowBellowCommand } from '../../commands/commands/table/doc-table-insert.command';
|
||||
import { DocTableDeleteColumnsCommand, DocTableDeleteRowsCommand, DocTableDeleteTableCommand } from '../../commands/commands/table/doc-table-delete.command';
|
||||
import { DocTableInsertColumnLeftCommand, DocTableInsertColumnRightCommand, DocTableInsertRowAboveCommand, DocTableInsertRowBellowCommand } from '../../commands/commands/table/doc-table-insert.command';
|
||||
import { DocParagraphSettingPanelOperation } from '../../commands/operations/doc-paragraph-setting-panel.operation';
|
||||
|
||||
const getDisableOnCollapsedObservable = (accessor: IAccessor) => {
|
||||
const docSelectionManagerService = accessor.get(DocSelectionManagerService);
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
DocSkeletonManagerService,
|
||||
SetTextSelectionsOperation,
|
||||
} from '@univerjs/docs';
|
||||
import type { IMenuButtonItem, IMenuItem, IMenuSelectorItem } from '@univerjs/ui';
|
||||
import { DocumentEditArea, IRenderManagerService } from '@univerjs/engine-render';
|
||||
import {
|
||||
FONT_FAMILY_LIST,
|
||||
FONT_SIZE_LIST,
|
||||
@@ -36,21 +36,21 @@ import {
|
||||
getMenuHiddenObservable,
|
||||
MenuItemType,
|
||||
} from '@univerjs/ui';
|
||||
import type { IAccessor, PresetListType } from '@univerjs/core';
|
||||
import type { Subscription } from 'rxjs';
|
||||
import { combineLatest, map, Observable } from 'rxjs';
|
||||
import type { IAccessor, PresetListType } from '@univerjs/core';
|
||||
import type { IMenuButtonItem, IMenuItem, IMenuSelectorItem } from '@univerjs/ui';
|
||||
|
||||
import { DocumentEditArea, IRenderManagerService } from '@univerjs/engine-render';
|
||||
import type { Subscription } from 'rxjs';
|
||||
import { OpenHeaderFooterPanelCommand } from '../../commands/commands/doc-header-footer.command';
|
||||
import { ResetInlineFormatTextBackgroundColorCommand, SetInlineFormatBoldCommand, SetInlineFormatCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatTextBackgroundColorCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand } from '../../commands/commands/inline-format.command';
|
||||
import { BulletListCommand, CheckListCommand, getParagraphsInRange, OrderListCommand } from '../../commands/commands/list.command';
|
||||
import { AlignCenterCommand, AlignJustifyCommand, AlignLeftCommand, AlignOperationCommand, AlignRightCommand } from '../../commands/commands/paragraph-align.command';
|
||||
import { DocCreateTableOperation } from '../../commands/operations/doc-create-table.operation';
|
||||
import { getCommandSkeleton } from '../../commands/util';
|
||||
import { COLOR_PICKER_COMPONENT } from '../../components/color-picker';
|
||||
import { FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT } from '../../components/font-family';
|
||||
import { FONT_SIZE_COMPONENT } from '../../components/font-size';
|
||||
import { OpenHeaderFooterPanelCommand } from '../../commands/commands/doc-header-footer.command';
|
||||
import { BULLET_LIST_TYPE_COMPONENT, ORDER_LIST_TYPE_COMPONENT } from '../../components/list-type-picker';
|
||||
import { DocCreateTableOperation } from '../../commands/operations/doc-create-table.operation';
|
||||
import { getCommandSkeleton } from '../../commands/util';
|
||||
import { ResetInlineFormatTextBackgroundColorCommand, SetInlineFormatBoldCommand, SetInlineFormatCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatTextBackgroundColorCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand } from '../../commands/commands/inline-format.command';
|
||||
import { AlignCenterCommand, AlignJustifyCommand, AlignLeftCommand, AlignOperationCommand, AlignRightCommand } from '../../commands/commands/paragraph-align.command';
|
||||
import { BulletListCommand, CheckListCommand, getParagraphsInRange, OrderListCommand } from '../../commands/commands/list.command';
|
||||
|
||||
function getInsertTableHiddenObservable(
|
||||
accessor: IAccessor
|
||||
|
||||
+4
-4
@@ -14,17 +14,17 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { DocumentDataModel, ITextRange, Nullable } from '@univerjs/core';
|
||||
import { Inject, IUniverInstanceService, RxDisposable } from '@univerjs/core';
|
||||
import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
|
||||
import type { INodePosition, IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
||||
import { IRenderManagerService } from '@univerjs/engine-render';
|
||||
import { IEditorService } from '@univerjs/ui';
|
||||
import { takeUntil } from 'rxjs';
|
||||
import type { DocumentDataModel, ITextRange, Nullable } from '@univerjs/core';
|
||||
import type { INodePosition, IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
||||
import { getDocObject } from '../../basics/component-tools';
|
||||
import { VIEWPORT_KEY } from '../../basics/docs-view-key';
|
||||
import { NodePositionConvertToCursor } from '../../services/selection/convert-text-range';
|
||||
import { getAnchorBounding } from '../../services/selection/text-range';
|
||||
import { VIEWPORT_KEY } from '../../basics/docs-view-key';
|
||||
import { getDocObject } from '../../basics/component-tools';
|
||||
|
||||
const ANCHOR_WIDTH = 1.5;
|
||||
|
||||
|
||||
+4
-4
@@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { Documents, IRenderContext, IRenderModule, Viewport } from '@univerjs/engine-render';
|
||||
import { CURSOR_TYPE, Vector2 } from '@univerjs/engine-render';
|
||||
import type { DocumentDataModel } from '@univerjs/core';
|
||||
import { Disposable, ICommandService, Inject } from '@univerjs/core';
|
||||
import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
|
||||
import { DocEventManagerService } from '../../services/doc-event-manager.service';
|
||||
import { CURSOR_TYPE, Vector2 } from '@univerjs/engine-render';
|
||||
import type { DocumentDataModel } from '@univerjs/core';
|
||||
import type { Documents, IRenderContext, IRenderModule, Viewport } from '@univerjs/engine-render';
|
||||
import { ToggleCheckListCommand } from '../../commands/commands/list.command';
|
||||
import { DocEventManagerService } from '../../services/doc-event-manager.service';
|
||||
|
||||
export class DocChecklistRenderController extends Disposable implements IRenderModule {
|
||||
constructor(
|
||||
|
||||
@@ -14,16 +14,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { DocumentDataModel } from '@univerjs/core';
|
||||
import {
|
||||
ICommandService,
|
||||
IContextService,
|
||||
Inject,
|
||||
RxDisposable,
|
||||
} from '@univerjs/core';
|
||||
|
||||
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
||||
import { takeUntil } from 'rxjs';
|
||||
|
||||
import type { DocumentDataModel } from '@univerjs/core';
|
||||
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
||||
import { whenDocOrEditor, whenFocusEditor } from '../../commands/commands/clipboard.command';
|
||||
import { IDocClipboardService } from '../../services/clipboard/clipboard.service';
|
||||
import { DocSelectionRenderService } from '../../services/selection/doc-selection-render.service';
|
||||
|
||||
+2
-2
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { Workbook } from '@univerjs/core';
|
||||
import {
|
||||
DEFAULT_EMPTY_DOCUMENT_VALUE,
|
||||
Disposable,
|
||||
@@ -24,8 +23,9 @@ import {
|
||||
ICommandService,
|
||||
} from '@univerjs/core';
|
||||
import { RichTextEditingMutation } from '@univerjs/docs';
|
||||
import type { Documents, IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
||||
import { ContextMenuPosition, IContextMenuService } from '@univerjs/ui';
|
||||
import type { Workbook } from '@univerjs/core';
|
||||
import type { Documents, IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
||||
|
||||
const SKIP_UNIT_IDS = [
|
||||
DEFAULT_EMPTY_DOCUMENT_VALUE,
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { DocumentDataModel, ICommandInfo, Nullable, Workbook } from '@univerjs/core';
|
||||
import { checkForSubstrings, Disposable, ICommandService, Inject, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
|
||||
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
||||
import { IRenderManagerService, ScrollBar } from '@univerjs/engine-render';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import { DocSkeletonManagerService, RichTextEditingMutation } from '@univerjs/docs';
|
||||
import { IRenderManagerService, ScrollBar } from '@univerjs/engine-render';
|
||||
import { IEditorService, SetEditorResizeOperation } from '@univerjs/ui';
|
||||
import { fromEvent } from 'rxjs';
|
||||
import type { DocumentDataModel, ICommandInfo, Nullable, Workbook } from '@univerjs/core';
|
||||
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
|
||||
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
||||
import { VIEWPORT_KEY } from '../../basics/docs-view-key';
|
||||
import { CoverContentCommand } from '../../commands/commands/replace-content.command';
|
||||
import { DocSelectionRenderService } from '../../services/selection/doc-selection-render.service';
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { DocumentDataModel, Nullable } from '@univerjs/core';
|
||||
import {
|
||||
Disposable,
|
||||
ICommandService,
|
||||
@@ -22,15 +21,16 @@ import {
|
||||
IUniverInstanceService,
|
||||
Tools,
|
||||
} from '@univerjs/core';
|
||||
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
||||
import { IRenderManagerService } from '@univerjs/engine-render';
|
||||
import type { Subscription } from 'rxjs';
|
||||
|
||||
import { DocSkeletonManagerService } from '@univerjs/docs';
|
||||
import { IRenderManagerService } from '@univerjs/engine-render';
|
||||
import type { DocumentDataModel, Nullable } from '@univerjs/core';
|
||||
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
||||
|
||||
import type { Subscription } from 'rxjs';
|
||||
import { IMEInputCommand } from '../../commands/commands/ime-input.command';
|
||||
import { DocIMEInputManagerService } from '../../services/doc-ime-input-manager.service';
|
||||
import type { IEditorInputConfig } from '../../services/selection/doc-selection-render.service';
|
||||
import { DocSelectionRenderService } from '../../services/selection/doc-selection-render.service';
|
||||
import type { IEditorInputConfig } from '../../services/selection/doc-selection-render.service';
|
||||
|
||||
export class DocIMEInputController extends Disposable implements IRenderModule {
|
||||
private _previousIMEContent: string = '';
|
||||
@@ -111,7 +111,8 @@ export class DocIMEInputController extends Disposable implements IRenderModule {
|
||||
}
|
||||
|
||||
const skeleton = this._renderManagerSrv.getRenderById(documentModel.getUnitId())
|
||||
?.with(DocSkeletonManagerService).getSkeleton();
|
||||
?.with(DocSkeletonManagerService)
|
||||
.getSkeleton();
|
||||
|
||||
const { event, activeRange } = config;
|
||||
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { DocumentDataModel, Nullable } from '@univerjs/core';
|
||||
import { Disposable, ICommandService, Inject } from '@univerjs/core';
|
||||
import { DocSkeletonManagerService } from '@univerjs/docs';
|
||||
import type { DocumentDataModel, Nullable } from '@univerjs/core';
|
||||
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
||||
import type { Subscription } from 'rxjs';
|
||||
import { DocSkeletonManagerService } from '@univerjs/docs';
|
||||
import { DocSelectionRenderService } from '../../services/selection/doc-selection-render.service';
|
||||
import { InsertCommand } from '../../commands/commands/core-editing.command';
|
||||
import { AfterSpaceCommand } from '../../commands/commands/auto-format.command';
|
||||
import { InsertCommand } from '../../commands/commands/core-editing.command';
|
||||
import { DocSelectionRenderService } from '../../services/selection/doc-selection-render.service';
|
||||
|
||||
export class DocInputController extends Disposable implements IRenderModule {
|
||||
private _onInputSubscription: Nullable<Subscription>;
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
|
||||
import { Disposable, DOCS_ZEN_EDITOR_UNIT_ID_KEY, fromEventSubject, Inject, isInternalEditorID } from '@univerjs/core';
|
||||
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
||||
import { DocSelectionManagerService } from '@univerjs/docs';
|
||||
import { TRANSFORM_CHANGE_OBSERVABLE_TYPE } from '@univerjs/engine-render';
|
||||
import { animationFrameScheduler, filter, throttleTime } from 'rxjs';
|
||||
import { DocSelectionManagerService } from '@univerjs/docs';
|
||||
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
||||
import { DocPageLayoutService } from '../../services/doc-page-layout.service';
|
||||
|
||||
export class DocResizeRenderController extends Disposable implements IRenderModule {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user