Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

refactor(drawing): fix dependencies #2386

Merged
merged 3 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions packages/core/src/docs/data-model/subdocument.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* 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:https://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.
*/

export const DEFAULT_DOCUMENT_SUB_COMPONENT_ID = '__default_document_sub_component_id20231101__';
21 changes: 1 addition & 20 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import { installShims } from './common/shims';

export { DEFAULT_DOCUMENT_SUB_COMPONENT_ID } from './docs/data-model/subdocument';
export { type UnitType, UnitModel, UniverInstanceType } from './common/unit';
export { Registry, RegistryAsMap } from './common/registry';
export { Univer } from './univer';
Expand Down Expand Up @@ -77,26 +78,6 @@ export { IConfigService } from './services/config/config.service';
export * from './services/context/context';
export { ContextService, IContextService } from './services/context/context.service';
export { ErrorService, type IError } from './services/error/error.service';
export type { IOffset, IScale, ISize, ITransformState, IRotationSkewFlipTransform, IAbsoluteTransform, ISrcRect } from './services/drawing/drawing-interfaces';
export {
DEFAULT_DOCUMENT_SUB_COMPONENT_ID,
type DrawingType,
DrawingTypeEnum,
type IDrawingSearch,
type IDrawingSpace,
type IDrawingParam,
IDrawingManagerService,
type IDrawingOrderUpdateParam,
type IUnitDrawingService,
type IDrawingMap,
type IDrawingSubunitMap,
type IDrawingOrderMapParam,
type IDrawingGroupUpdateParam,
type IDrawingVisibleParam,
type IDrawingMapItemData,
type IDrawingMapItem,
ArrangeTypeEnum,
} from './services/drawing/drawing-manager.service';
export { IUniverInstanceService } from './services/instance/instance.service';
export { LifecycleStages, OnLifecycle, runOnLifecycle } from './services/lifecycle/lifecycle';
export { LifecycleService } from './services/lifecycle/lifecycle.service';
Expand Down
200 changes: 0 additions & 200 deletions packages/core/src/services/drawing/drawing-manager.service.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/core/src/shared/check-if-move.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import type { Nullable } from '../common/type-util';
import type { ITransformState } from '../services/drawing/drawing-interfaces';
import type { ITransformState } from '../types/interfaces/i-document-data';

export const MOVE_BUFFER_VALUE = 2;

Expand Down
1 change: 1 addition & 0 deletions packages/core/src/shared/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export { RefAlias } from './ref-alias';
export * from './row-col-iter';
export * from './sequence';
export * from './sort-rules';
export * from './shape';
export * from './tools';
export * from './types';
export * from './debounce';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,9 @@ export interface IOffset {
top?: number;
}

export interface IRotationSkewFlipTransform {
angle?: number;
skewX?: number;
skewY?: number;
flipX?: boolean;
flipY?: boolean;
}

export interface ISrcRect extends IOffset {
right?: number;
bottom?: number;
}

export interface IAbsoluteTransform extends ISize, IOffset, IScale {

}

export interface ITransformState extends IAbsoluteTransform, IRotationSkewFlipTransform {

}
export interface IAbsoluteTransform extends ISize, IOffset, IScale {}
2 changes: 2 additions & 0 deletions packages/core/src/types/enum/prst-geom-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

// TODO@Jocs: should be moved out of core.

export enum BasicShapes {
Line = 'line',
LineInv = 'lineInv',
Expand Down
66 changes: 64 additions & 2 deletions packages/core/src/types/interfaces/i-document-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import type { ISize } from '../../services/drawing/drawing-interfaces';
import type { IDrawingParam } from '../../services/drawing/drawing-manager.service';
import type { Nullable } from '../../common/type-util';
import type { IAbsoluteTransform, ISize } from '../../shared/shape';
import type { BooleanNumber, CellValueType, HorizontalAlign, LocaleType, TextDirection, VerticalAlign, WrapStrategy } from '../enum';
import type { IExtraModelData } from './i-extra-model-data';
import type { IColorStyle, IStyleBase } from './i-style-data';
Expand Down Expand Up @@ -881,3 +881,65 @@ export enum PageOrientType {
PORTRAIT,
LANDSCAPE,
}

// #region - tech dept

// TODO@Jocs: these types are here because of drawing coupled into the core of the document's model, which
// is an anti-pattern. After fixing the problem, these types should be removed.

/** @deprecated */
export enum ArrangeTypeEnum {
forward,
backward,
front,
back,
}

/** @deprecated */
export enum DrawingTypeEnum {
UNRECOGNIZED = -1,
DRAWING_IMAGE = 0,
DRAWING_SHAPE = 1,
DRAWING_CHART = 2,
DRAWING_TABLE = 3,
DRAWING_SMART_ART = 4,
DRAWING_VIDEO = 5,
DRAWING_GROUP = 6,
DRAWING_UNIT = 7,
DRAWING_DOM = 8,
}

/** @deprecated */
export type DrawingType = DrawingTypeEnum | number;

/** @deprecated */
export interface IDrawingSpace {
unitId: string;
subUnitId: string; //sheetId, pageId and so on, it has a default name in doc business
}

/** @deprecated */
export interface IDrawingSearch extends IDrawingSpace {
drawingId: string;
}

/** @deprecated */
export interface IRotationSkewFlipTransform {
angle?: number;
skewX?: number;
skewY?: number;
flipX?: boolean;
flipY?: boolean;
}

/** @deprecated */
export interface ITransformState extends IAbsoluteTransform, IRotationSkewFlipTransform {}

/** @deprecated */
export interface IDrawingParam extends IDrawingSearch {
drawingType: DrawingType;
transform?: Nullable<ITransformState>;
groupId?: string;
}

// #endregion
Loading
Loading