refactor: optimize the Ribbon style (#4757)

This commit is contained in:
白熱
2025-03-03 18:14:26 +08:00
committed by GitHub
parent 2699cb9b6a
commit ce26bab8fc
287 changed files with 2746 additions and 2371 deletions
-1
View File
@@ -126,7 +126,6 @@ exports.baseRules = {
'ts/ban-ts-comment': 'off',
'ts/no-duplicate-enum-values': 'off',
'no-cond-assign': 'warn',
'antfu/consistent-list-newline': 'off',
'ts/no-use-before-define': 'warn',
'intunicorn/number-literal-case': 'off',
'test/no-identical-title': 'warn',
+10 -10
View File
@@ -16,28 +16,28 @@
"build:storybook": "storybook build"
},
"dependencies": {
"@chromatic-com/storybook": "^3.2.4",
"@storybook/addon-essentials": "^8.5.8",
"@storybook/addon-interactions": "^8.5.8",
"@storybook/addon-links": "^8.5.8",
"@chromatic-com/storybook": "^3.2.5",
"@storybook/addon-essentials": "^8.6.3",
"@storybook/addon-interactions": "^8.6.3",
"@storybook/addon-links": "^8.6.3",
"@storybook/addon-styling-webpack": "^1.0.1",
"@storybook/addon-webpack5-compiler-swc": "^2.1.0",
"@storybook/blocks": "^8.5.8",
"@storybook/blocks": "^8.6.3",
"@storybook/icons": "^1.3.2",
"@storybook/react": "^8.5.8",
"@storybook/react-webpack5": "^8.5.8",
"@storybook/types": "^8.5.8",
"@storybook/react": "^8.6.3",
"@storybook/react-webpack5": "^8.6.3",
"@storybook/types": "^8.6.3",
"@univerjs/core": "workspace:*",
"@univerjs/design": "workspace:*",
"@univerjs/ui": "workspace:*",
"css-loader": "^7.1.2",
"less-loader": "^12.2.0",
"postcss-loader": "^8.1.1",
"storybook": "^8.5.8",
"storybook": "^8.6.3",
"storybook-addon-swc": "^1.2.0",
"style-loader": "^4.0.0",
"tsconfig-paths-webpack-plugin": "^4.2.0",
"typescript": "^5.7.3"
"typescript": "^5.8.2"
},
"devDependencies": {
"@types/fs-extra": "^11.0.4",
Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

+8 -4
View File
@@ -29,7 +29,8 @@ export default antfu(
ignores: [
'mockdata/**/*.json',
],
}, {
},
{
files: ['**/*.ts', '**/*.tsx'],
ignores: [
'packages/engine-render/src/components/docs/**/*.ts',
@@ -46,7 +47,8 @@ export default antfu(
complexity: ['warn', { max: 20 }],
'max-lines-per-function': ['warn', 80],
},
}, {
},
{
files: ['**/*.ts', '**/*.tsx'],
ignores: ['**/*.d.ts', '**/vite.config.ts', '**/vitest.config.ts', 'playwright.config.ts'],
plugins: {
@@ -78,7 +80,8 @@ export default antfu(
2,
],
},
}, {
},
{
// Not penetrating for source files
files: ['**/*.ts', '**/*.tsx'],
plugins: {
@@ -92,7 +95,8 @@ export default antfu(
rules: {
'penetrating/no-penetrating-import': 2,
},
}, {
},
{
files: ['**/*/src/index.ts'],
rules: {
'perfectionist/sort-exports': 'off',
+1 -1
View File
@@ -97,6 +97,6 @@
"postcss": "^8.5.3",
"tailwindcss": "^3.4.17",
"tailwindcss-animate": "^1.0.7",
"typescript": "^5.7.3"
"typescript": "^5.8.2"
}
}
+4 -2
View File
@@ -111,7 +111,8 @@ function registerBasicPlugins(univer: Univer) {
[DocUIController, {
useFactory: (injector) => {
injector.createInstance(UniDocsUIController, {});
}, deps: [Injector],
},
deps: [Injector],
}],
],
});
@@ -132,7 +133,8 @@ function registerSheetPlugins(univer: Univer) {
[SheetUIController, {
useFactory: (injector) => {
injector.createInstance(UniSheetsUIController, {});
}, deps: [Injector],
},
deps: [Injector],
}],
],
});
+1 -1
View File
@@ -42,6 +42,6 @@
},
"devDependencies": {
"@univerjs-infra/shared": "workspace:*",
"typescript": "^5.7.3"
"typescript": "^5.8.2"
}
}
File diff suppressed because one or more lines are too long
+4 -4
View File
@@ -3,7 +3,7 @@
"type": "module",
"version": "0.6.2",
"private": true,
"packageManager": "pnpm@10.4.1",
"packageManager": "pnpm@10.5.2",
"author": "DreamNum Co., Ltd. <developer@univer.ai>",
"license": "Apache-2.0",
"funding": {
@@ -47,7 +47,7 @@
"@antfu/eslint-config": "4.3.0",
"@commitlint/cli": "^19.7.1",
"@commitlint/config-conventional": "^19.7.1",
"@eslint-react/eslint-plugin": "^1.28.0",
"@eslint-react/eslint-plugin": "^1.29.0",
"@playwright/test": "^1.50.1",
"@release-it-plugins/workspaces": "^4.2.0",
"@release-it/conventional-changelog": "^9.0.4",
@@ -65,7 +65,7 @@
"eslint-plugin-no-barrel-import": "^0.0.2",
"eslint-plugin-no-penetrating-import": "^0.0.1",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-hooks": "5.1.0",
"eslint-plugin-react-hooks": "5.2.0",
"eslint-plugin-react-refresh": "^0.4.19",
"husky": "^9.1.7",
"lint-staged": "^15.4.3",
@@ -76,7 +76,7 @@
"serve": "^14.2.4",
"tsx": "^4.19.3",
"turbo": "^2.4.4",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vitest": "^3.0.7"
},
"pnpm": {
@@ -80,7 +80,7 @@
"react": "18.3.1",
"rxjs": "^7.8.1",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
@@ -16,7 +16,8 @@
import { Disposable, ICommandService, Inject, Injector } from '@univerjs/core';
import { RecordSingle } from '@univerjs/icons';
import { AddWorksheetMergeAllCommand,
import {
AddWorksheetMergeAllCommand,
AddWorksheetMergeCommand,
AddWorksheetMergeHorizontalCommand,
AddWorksheetMergeVerticalCommand,
@@ -47,7 +48,10 @@ import { AddWorksheetMergeAllCommand,
SetWorksheetActiveOperation,
} from '@univerjs/sheets';
import { RemoveSheetFilterCommand, SetSheetFilterRangeCommand, SetSheetsFilterCriteriaCommand } from '@univerjs/sheets-filter';
import { AutoFillCommand, RefillCommand, SetRangeBoldCommand,
import {
AutoFillCommand,
RefillCommand,
SetRangeBoldCommand,
SetRangeFontFamilyCommand,
SetRangeFontSizeCommand,
SetRangeItalicCommand,
+1 -1
View File
@@ -83,7 +83,7 @@
"react": "18.3.1",
"rxjs": "^7.8.1",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7",
"vue": "^3.5.13"
@@ -71,7 +71,7 @@
"devDependencies": {
"@univerjs-infra/shared": "workspace:*",
"rxjs": "^7.8.1",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
@@ -72,7 +72,7 @@
"postcss": "^8.5.3",
"rxjs": "^7.8.1",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
@@ -85,7 +85,7 @@
"react": "18.3.1",
"rxjs": "^7.8.1",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
@@ -21,8 +21,10 @@ import type {
IDisposable,
IDocumentBody,
Nullable,
SlideDataModel } from '@univerjs/core';
SlideDataModel,
} from '@univerjs/core';
import type { IDocFormulaCache, ISlideFormulaCache } from '@univerjs/uni-formula';
import type { IDocPopupPosition, ISlidePopupPosition } from '../commands/operations/operation';
import {
BuildTextUtils,
CommandType,
@@ -45,7 +47,7 @@ import { RegisterOtherFormulaService } from '@univerjs/sheets-formula';
import { CanvasView } from '@univerjs/slides-ui';
import { DumbUniFormulaService, IUniFormulaService } from '@univerjs/uni-formula';
import { take } from 'rxjs';
import { type IDocPopupPosition, type ISlidePopupPosition, isSlidePosition } from '../commands/operations/operation';
import { isSlidePosition } from '../commands/operations/operation';
const PSEUDO_SUBUNIT = 'PSEUDO_SUBUNIT';
@@ -60,7 +60,7 @@
},
"devDependencies": {
"@univerjs-infra/shared": "workspace:*",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
@@ -77,7 +77,7 @@
"react": "18.3.1",
"rxjs": "^7.8.1",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
@@ -74,7 +74,7 @@
"react": "18.3.1",
"rxjs": "^7.8.1",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
+1 -1
View File
@@ -79,7 +79,7 @@
"react-dom": "18.3.1",
"rxjs": "^7.8.1",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
+1 -1
View File
@@ -86,7 +86,7 @@
"@types/rbush": "^4.0.0",
"@univerjs-infra/shared": "workspace:*",
"rxjs": "^7.8.1",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
+2 -1
View File
@@ -320,7 +320,8 @@ const re_weburl = new RegExp(
'(?::\\d{2,5})?' +
// resource path (optional)
'(?:[/?#]\\S*)?' +
'$', 'i'
'$',
'i'
);
export function isLegalUrl(url: string) {
// skip number 0.1
@@ -14,11 +14,12 @@
* limitations under the License.
*/
import type { IDocumentBody } from '../../../../types/interfaces';
import type { TextXAction } from '../action-types';
import { describe, expect, it } from 'vitest';
import { UpdateDocsAttributeType } from '../../../../shared';
import { BooleanNumber, HorizontalAlign } from '../../../../types/enum';
import { CustomRangeType, type IDocumentBody } from '../../../../types/interfaces';
import { CustomRangeType } from '../../../../types/interfaces';
import { PresetListType } from '../../preset-list-type';
import { TextXActionType } from '../action-types';
import { TextX } from '../text-x';
@@ -290,7 +291,8 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
}, {
},
{
t: TextXActionType.RETAIN,
len: 1,
body: {
@@ -309,7 +311,8 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
}, {
},
{
t: TextXActionType.RETAIN,
len: 1,
body: {
@@ -349,7 +352,8 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
}, {
},
{
t: TextXActionType.RETAIN,
len: 1,
coverType: UpdateDocsAttributeType.REPLACE,
@@ -369,7 +373,8 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
}, {
},
{
t: TextXActionType.RETAIN,
len: 1,
coverType: UpdateDocsAttributeType.REPLACE,
@@ -410,7 +415,8 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
}, {
},
{
t: TextXActionType.RETAIN,
len: 1,
coverType: UpdateDocsAttributeType.REPLACE,
@@ -435,7 +441,8 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
}, {
},
{
t: TextXActionType.RETAIN,
len: 1,
coverType: UpdateDocsAttributeType.REPLACE,
@@ -481,7 +488,8 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
}, {
},
{
t: TextXActionType.RETAIN,
len: 1,
body: {
@@ -539,7 +547,8 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
}, {
},
{
t: TextXActionType.INSERT,
len: 1,
body: {
@@ -558,7 +567,8 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 2,
}, {
},
{
t: TextXActionType.INSERT,
len: 1,
body: {
@@ -614,7 +624,8 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 2,
}, {
},
{
t: TextXActionType.INSERT,
len: 1,
body: {
@@ -403,8 +403,7 @@ export function splitCustomRangesByIndex(customRanges: ICustomRange[], currentIn
startIndex: matchedCustomRange.startIndex,
endIndex: currentIndex - 1,
properties: { ...matchedCustomRange.properties },
},
{
}, {
rangeId: matchedCustomRange.rangeId,
rangeType: matchedCustomRange.rangeType,
startIndex: currentIndex,
@@ -451,8 +450,7 @@ export function splitCustomDecoratesByIndex(customDecorations: ICustomDecoration
type: matched.type,
startIndex: matched.startIndex,
endIndex: currentIndex - 1,
},
{
}, {
id: matched.id,
type: matched.type,
startIndex: currentIndex,
+11 -15
View File
@@ -232,13 +232,11 @@ export class FUniver extends Disposable {
this.Event.DocDisposed,
() => univerInstanceService.unitDisposed$.subscribe((unit) => {
if (unit.type === UniverInstanceType.UNIVER_DOC) {
this.fireEvent(this.Event.DocDisposed,
{
unitId: unit.getUnitId(),
unitType: unit.type,
snapshot: unit.getSnapshot() as IDocumentData,
}
);
this.fireEvent(this.Event.DocDisposed, {
unitId: unit.getUnitId(),
unitType: unit.type,
snapshot: unit.getSnapshot() as IDocumentData,
});
}
})
);
@@ -249,14 +247,12 @@ export class FUniver extends Disposable {
if (unit.type === UniverInstanceType.UNIVER_DOC) {
const doc = unit as DocumentDataModel;
const docUnit = injector.createInstance(FDoc, doc);
this.fireEvent(this.Event.DocCreated,
{
unitId: unit.getUnitId(),
type: unit.type,
doc: docUnit,
unit: docUnit,
}
);
this.fireEvent(this.Event.DocCreated, {
unitId: unit.getUnitId(),
type: unit.type,
doc: docUnit,
unit: docUnit,
});
}
})
);
@@ -18,7 +18,9 @@ import { BehaviorSubject, Subject } from 'rxjs';
import { createDefaultUser } from './const';
export interface IUser {
userID: string; name: string; avatar?: string;
userID: string;
name: string;
avatar?: string;
};
export class UserManagerService {
@@ -25,7 +25,9 @@ describe('test ObjectMatrix', () => {
});
const getHasNullPrimitiveObj = () => ({
1: '111', 2: null, 3: '333',
1: '111',
2: null,
3: '333',
});
it('test deleteValue', () => {
@@ -79,7 +81,9 @@ describe('test ObjectMatrix', () => {
const primitiveObject = getHasNullPrimitiveObj();
moveMatrixArray(2, 1, 0, primitiveObject);
expect(primitiveObject).toStrictEqual({
0: null, 2: '111', 3: '333',
0: null,
2: '111',
3: '333',
});
});
@@ -87,7 +91,9 @@ describe('test ObjectMatrix', () => {
const primitiveObject = getHasNullPrimitiveObj();
moveMatrixArray(2, 1, 4, primitiveObject);
expect(primitiveObject).toStrictEqual({
1: '111', 2: '333', 3: null,
1: '111',
2: '333',
3: null,
});
});
it('test spliceMatrix row', () => {
+1 -1
View File
@@ -69,7 +69,7 @@
"@univerjs/protocol": "0.1.43",
"@univerjs/sheets": "workspace:*",
"rxjs": "^7.8.1",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
@@ -35,7 +35,8 @@ export interface IRuleChange {
}
interface ISubUnitDataValidation {
map: Map<string, IDataValidationRule>; list: IDataValidationRule[];
map: Map<string, IDataValidationRule>;
list: IDataValidationRule[];
}
export class DataValidationModel extends Disposable {
+1 -1
View File
@@ -99,7 +99,7 @@
"react-dom": "18.3.1",
"tailwindcss": "^3.4.17",
"tailwindcss-animate": "^1.0.7",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
@@ -285,10 +285,10 @@ export function Tooltip(props: ITooltipProps) {
: (
<div
ref={triggerRef}
className={`
${className}
univer-inline-block
`}
className={clsx(
className,
'univer-inline-block'
)}
>
{children}
</div>
+1 -1
View File
@@ -84,7 +84,7 @@
"react": "18.3.1",
"rxjs": "^7.8.1",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
@@ -14,8 +14,9 @@
* limitations under the License.
*/
import type { IDrawingParam } from '@univerjs/core';
import type { IDrawingGroupUpdateParam } from '@univerjs/drawing';
import { DrawingTypeEnum, type IDrawingParam } from '@univerjs/core';
import { DrawingTypeEnum } from '@univerjs/core';
import { getGroupState, transformObjectOutOfGroup } from '@univerjs/engine-render';
export function ungroupToGroup(ungroupParams: IDrawingGroupUpdateParam[]) {
@@ -30,7 +31,9 @@ export function ungroupToGroup(ungroupParams: IDrawingGroupUpdateParam[]) {
const transform = drawing.transform || { left: 0, top: 0 };
const { unitId, subUnitId, drawingId } = drawing;
return {
unitId, subUnitId, drawingId,
unitId,
subUnitId,
drawingId,
transform: {
...transform,
left: transform.left! - groupTransform.left,
@@ -71,7 +74,9 @@ export function groupToUngroup(groupParams: IDrawingGroupUpdateParam[]) {
const { unitId, subUnitId, drawingId } = object;
const newTransform = transformObjectOutOfGroup(transform || {}, groupTransform, groupTransform.width || 0, groupTransform.height || 0);
return {
unitId, subUnitId, drawingId,
unitId,
subUnitId,
drawingId,
transform: newTransform,
groupId: undefined,
};
@@ -20,8 +20,15 @@ import type { IDrawingDocTransform } from '../commands/commands/update-doc-drawi
import {
BooleanNumber,
COLORS,
Disposable, ICommandService, IUniverInstanceService, ObjectRelativeFromH, ObjectRelativeFromV,
PositionedObjectLayoutType, throttle, toDisposable, Tools,
Disposable,
ICommandService,
IUniverInstanceService,
ObjectRelativeFromH,
ObjectRelativeFromV,
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';
@@ -377,7 +384,8 @@ export class DocDrawingTransformerController extends Disposable {
const activeViewport = scene.getViewports()[0];
const {
pageLayoutType = PageLayoutType.VERTICAL,
pageMarginLeft, pageMarginTop,
pageMarginLeft,
pageMarginTop,
} = documentComponent.getOffsetConfig();
let glyphAnchor: Nullable<IDocumentSkeletonGlyph> = null;
let isBack = false;
@@ -395,14 +403,11 @@ export class DocDrawingTransformerController extends Disposable {
return;
}
const nodeInfo = skeleton?.findNodeByCoord(
coord, pageLayoutType, pageMarginLeft, pageMarginTop,
{
strict: false,
segmentId: docSelectionRenderService.getSegment(),
segmentPage: docSelectionRenderService.getSegmentPage(),
}
);
const nodeInfo = skeleton?.findNodeByCoord(coord, pageLayoutType, pageMarginLeft, pageMarginTop, {
strict: false,
segmentId: docSelectionRenderService.getSegment(),
segmentPage: docSelectionRenderService.getSegmentPage(),
});
if (nodeInfo) {
const { node, ratioX, segmentPage, segmentId: nodeSegmentId } = nodeInfo;
isBack = ratioX < HALF;
@@ -835,7 +840,8 @@ export class DocDrawingTransformerController extends Disposable {
const { mainComponent, scene } = currentRender;
const documentComponent = mainComponent as Documents;
const {
docsLeft, docsTop,
docsLeft,
docsTop,
} = documentComponent.getOffsetConfig();
const bounding = getAnchorBounding(pointsGroup);
const { left: boundingLeft, top: boundingTop, height } = bounding;
@@ -166,7 +166,11 @@ export class DocDrawingTransformUpdateController extends Disposable implements I
if (headerPage) {
this._calculateDrawingPosition(
unitId, headerPage, docsLeft, docsTop, updateDrawingMap,
unitId,
headerPage,
docsLeft,
docsTop,
updateDrawingMap,
headerPage.marginTop,
page.marginLeft
);
@@ -178,7 +182,11 @@ export class DocDrawingTransformUpdateController extends Disposable implements I
if (footerPage) {
this._calculateDrawingPosition(
unitId, footerPage, docsLeft, docsTop, updateDrawingMap,
unitId,
footerPage,
docsLeft,
docsTop,
updateDrawingMap,
page.pageHeight - page.marginBottom + footerPage.marginTop,
page.marginLeft
);
@@ -19,19 +19,20 @@ import type { IDocDrawing } from '@univerjs/docs-drawing';
import type { IImageIoServiceParam } from '@univerjs/drawing';
import type { Documents, Image, IRenderContext, IRenderModule } from '@univerjs/engine-render';
import type { IInsertDrawingCommandParams } from '../../commands/commands/interfaces';
import type { ISetDrawingArrangeCommandParams } from '../../commands/commands/set-drawing-arrange.command';
import { BooleanNumber, Disposable, DrawingTypeEnum, FOCUSING_COMMON_DRAWINGS, ICommandService, IContextService, Inject, LocaleService, ObjectRelativeFromH, ObjectRelativeFromV, PositionedObjectLayoutType, WrapTextType } from '@univerjs/core';
import { MessageType } from '@univerjs/design';
import { DocSelectionManagerService, DocSkeletonManagerService, RichTextEditingMutation } from '@univerjs/docs';
import { IDocDrawingService } from '@univerjs/docs-drawing';
import { docDrawingPositionToTransform, DocSelectionRenderService } from '@univerjs/docs-ui';
import { DRAWING_IMAGE_ALLOW_IMAGE_LIST, DRAWING_IMAGE_ALLOW_SIZE, DRAWING_IMAGE_COUNT_LIMIT, DRAWING_IMAGE_HEIGHT_LIMIT, DRAWING_IMAGE_WIDTH_LIMIT, getDrawingShapeKeyByDrawingSearch, getImageSize, IDrawingManagerService, IImageIoService, ImageUploadStatusType } from '@univerjs/drawing';
import { DocumentEditArea, IRenderManagerService } from '@univerjs/engine-render';
import { DocumentEditArea, IRenderManagerService } from '@univerjs/engine-render';
import { ILocalFileService, IMessageService } from '@univerjs/ui';
import { debounceTime } from 'rxjs';
import { GroupDocDrawingCommand } from '../../commands/commands/group-doc-drawing.command';
import { InsertDocDrawingCommand } from '../../commands/commands/insert-doc-drawing.command';
import { type ISetDrawingArrangeCommandParams, SetDocDrawingArrangeCommand } from '../../commands/commands/set-drawing-arrange.command';
import { SetDocDrawingArrangeCommand } from '../../commands/commands/set-drawing-arrange.command';
import { UngroupDocDrawingCommand } from '../../commands/commands/ungroup-doc-drawing.command';
import { DocRefreshDrawingsService } from '../../services/doc-refresh-drawings.service';
@@ -188,7 +189,8 @@ export class DocDrawingUpdateRenderController extends Disposable implements IRen
}
private _getImagePosition(
imageWidth: number, imageHeight: number
imageWidth: number,
imageHeight: number
): Nullable<IDocDrawingPosition> {
const activeTextRange = this._docSelectionRenderService.getActiveTextRange();
// TODO: NO need to get the cursor position, because the insert image is inline.
@@ -173,7 +173,10 @@ export const DocDrawingTextWrap = (props: IDocDrawingTextWrapProps) => {
}
const {
distT = 0, distL = 0, distB = 0, distR = 0,
distT = 0,
distL = 0,
distB = 0,
distR = 0,
layoutType = PositionedObjectLayoutType.INLINE,
behindDoc = BooleanNumber.FALSE,
wrapText = WrapTextType.BOTH_SIDES,
+1 -1
View File
@@ -61,7 +61,7 @@
},
"devDependencies": {
"@univerjs-infra/shared": "workspace:*",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
+1 -1
View File
@@ -81,7 +81,7 @@
"react": "18.3.1",
"rxjs": "^7.8.1",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
+1 -1
View File
@@ -60,7 +60,7 @@
},
"devDependencies": {
"@univerjs-infra/shared": "workspace:*",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
+1 -1
View File
@@ -75,7 +75,7 @@
"react": "18.3.1",
"rxjs": "^7.8.1",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
+1 -1
View File
@@ -75,7 +75,7 @@
"react": "18.3.1",
"rxjs": "^7.8.1",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
+1 -1
View File
@@ -90,7 +90,7 @@
"react": "18.3.1",
"rxjs": "^7.8.1",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
@@ -16,19 +16,29 @@
import type {
DocumentDataModel,
ICommand, IDocumentBody, IMutationInfo, IStyleBase, ITextDecoration, ITextRun,
ICommand,
IDocumentBody,
IMutationInfo,
IStyleBase,
ITextDecoration,
ITextRun,
ITextStyle,
Nullable,
} from '@univerjs/core';
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
import {
BaselineOffset, BooleanNumber, CommandType,
BaselineOffset,
BooleanNumber,
CommandType,
DOC_RANGE_TYPE,
getBodySlice,
ICommandService, IUniverInstanceService,
JSONX, MemoryCursor,
TextX, TextXActionType,
ICommandService,
IUniverInstanceService,
JSONX,
MemoryCursor,
TextX,
TextXActionType,
Tools,
UniverInstanceType,
} from '@univerjs/core';
@@ -18,7 +18,8 @@ import type { ICommand, IMutationInfo, IParagraphStyle } from '@univerjs/core';
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import {
CommandType, HorizontalAlign,
CommandType,
HorizontalAlign,
ICommandService,
IUniverInstanceService,
JSONX,
@@ -112,8 +112,15 @@ export class DocMoveCursorController extends Disposable {
}
const {
startOffset, endOffset, style, collapsed, direction: rangeDirection,
segmentId, startNodePosition, endNodePosition, segmentPage,
startOffset,
endOffset,
style,
collapsed,
direction: rangeDirection,
segmentId,
startNodePosition,
endNodePosition,
segmentPage,
} = activeRange;
if (allRanges.length > 1) {
+3 -1
View File
@@ -15,7 +15,9 @@
*/
import type { DocumentDataModel, IDocumentData } from '@univerjs/core';
import { DOC_RANGE_TYPE, ICommandService,
import {
DOC_RANGE_TYPE,
ICommandService,
Inject,
Injector,
IResourceManagerService,
@@ -141,7 +141,9 @@ export class DocClipboardService extends Disposable implements IDocClipboardServ
}
async legacyPaste(options: {
html?: string; text?: string; files: File[];
html?: string;
text?: string;
files: File[];
}): Promise<boolean> {
let { html, text, files } = options;
const currentDocInstance = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
@@ -192,7 +192,14 @@ export class DocSelectionRenderService extends RxDisposable implements IRenderMo
const generalAddRange = (startOffset: number, endOffset: number) => {
const rangeList = getRangeListFromCharIndex(
startOffset, endOffset, scene, document, docSkeleton, style, segmentId, segmentPage
startOffset,
endOffset,
scene,
document,
docSkeleton,
style,
segmentId,
segmentPage
);
if (rangeList == null) {
@@ -1233,7 +1240,11 @@ export class DocSelectionRenderService extends RxDisposable implements IRenderMo
} = document.getOffsetConfig();
const nodeInfo = skeleton.findNodeByCoord(
coord, pageLayoutType, pageMarginLeft, pageMarginTop, restrictions
coord,
pageLayoutType,
pageMarginLeft,
pageMarginTop,
restrictions
);
return nodeInfo;
@@ -14,9 +14,10 @@
* limitations under the License.
*/
import type { Nullable } from '@univerjs/core';
import type { Documents, DocumentSkeleton, INodePosition, IPoint, ITextSelectionStyle, Scene } from '@univerjs/engine-render';
import type { IDocRange } from './range-interface';
import { COLORS, DOC_RANGE_TYPE, type Nullable, RANGE_DIRECTION, Rectangle, Tools } from '@univerjs/core';
import { COLORS, DOC_RANGE_TYPE, RANGE_DIRECTION, Rectangle, Tools } from '@univerjs/core';
import { getColor, NORMAL_TEXT_SELECTION_PLUGIN_STYLE, RegularPolygon } from '@univerjs/engine-render';
import { compareNodePositionInTable, NodePositionConvertToRectRange } from './convert-rect-range';
import { TEXT_RANGE_LAYER_INDEX } from './text-range';
@@ -39,7 +40,14 @@ export function convertPositionsToRectRanges(
const nodePositionGroup = convertor.getNodePositionGroup(anchorNodePosition, focusNodePosition);
return (nodePositionGroup ?? []).map((position) => new RectRange(
scene, document, docSkeleton, position.anchor, position.focus, style, segmentId, segmentPage
scene,
document,
docSkeleton,
position.anchor,
position.focus,
style,
segmentId,
segmentPage
));
}
@@ -48,7 +48,14 @@ export function cursorConvertToTextRange(
? docSkeleton.findNodePositionByCharIndex(endOffset, true, segmentId, segmentPage)
: null;
const textRange = new TextRange(
scene, document, docSkeleton, anchorNodePosition, focusNodePosition, style, segmentId, segmentPage
scene,
document,
docSkeleton,
anchorNodePosition,
focusNodePosition,
style,
segmentId,
segmentPage
);
return textRange;
@@ -33,7 +33,12 @@ import {
import styles from './index.module.less';
const AutoFocusInputNumber = (props: {
value: number; onChange: (v: number) => Promise<unknown>; className?: string; min?: number; max?: number; step?: number;
value: number;
onChange: (v: number) => Promise<unknown>;
className?: string;
min?: number;
max?: number;
step?: number;
}) => {
const { value, onChange, className = '', min = 0, max = 100, step = 1 } = props;
const ref = useRef<HTMLInputElement>(null);
@@ -65,8 +70,8 @@ export function ParagraphSetting() {
{ label: localeService.t('toolbar.alignLeft'), value: String(HorizontalAlign.LEFT), icon: <LeftJustifyingSingle /> },
{ label: localeService.t('toolbar.alignCenter'), value: String(HorizontalAlign.CENTER), icon: <HorizontallySingle /> },
{ label: localeService.t('toolbar.alignRight'), value: String(HorizontalAlign.RIGHT), icon: <RightJustifyingSingle /> },
{ label: localeService.t('toolbar.alignJustify'), value: String(HorizontalAlign.JUSTIFIED), icon: <AlignTextBothSingle /> }],
[]);
{ label: localeService.t('toolbar.alignJustify'), value: String(HorizontalAlign.JUSTIFIED), icon: <AlignTextBothSingle /> },
], []);
const currentParagraph = useCurrentParagraph();
const [horizontalAlignValue, horizontalAlignSet] = useFirstParagraphHorizontalAlign(currentParagraph, alignmentOptions[0].value);
@@ -101,8 +106,7 @@ export function ParagraphSetting() {
return (
<Tooltip title={item.label} key={item.value} placement="bottom">
<span
className={clsx(styles.paragraphSettingIconListItem,
{ [styles.paragraphSettingIconListActive]: horizontalAlignValue === item.value })}
className={clsx(styles.paragraphSettingIconListItem, { [styles.paragraphSettingIconListActive]: horizontalAlignValue === item.value })}
onClick={() => horizontalAlignSet(item.value)}
>
@@ -304,7 +304,8 @@ export const useFirstParagraphLineSpacing = (paragraph: IParagraph[]) => {
});
return a;
}, {} as { spacingRule?: SpacingRule; lineSpacing?: number });
})).subscribe((v) => {
})
).subscribe((v) => {
return commandService.executeCommand(DocParagraphSettingCommand.id, {
paragraph: { ...v },
} as IDocParagraphSettingCommandParams);
+1 -1
View File
@@ -67,7 +67,7 @@
"devDependencies": {
"@univerjs-infra/shared": "workspace:*",
"rxjs": "^7.8.1",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
+1 -1
View File
@@ -80,7 +80,7 @@
"react": "18.3.1",
"rxjs": "^7.8.1",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
@@ -695,10 +695,15 @@ export class DrawingUpdateController extends Disposable {
}
const {
left = 0, top = 0, width = 0, height = 0,
left = 0,
top = 0,
width = 0,
height = 0,
angle = 0,
flipX = false, flipY = false,
skewX = 0, skewY = 0,
flipX = false,
flipY = false,
skewX = 0,
skewY = 0,
} = transform;
drawingShape.transformByState({ left, top, width, height, angle, flipX, flipY, skewX, skewY });
@@ -321,7 +321,10 @@ export class ImageCropperController extends Disposable {
...drawingParam,
transform: {
...drawingParam.transform,
left, top, height, width,
left,
top,
height,
width,
},
srcRect: srcRect.srcRectAngle,
}] as IImageData[]);
@@ -14,9 +14,10 @@
* limitations under the License.
*/
import type { IDrawingSearch } from '@univerjs/core';
import type { IImageData } from '@univerjs/drawing';
import type { IImageProps, Scene } from '@univerjs/engine-render';
import { DrawingTypeEnum, type IDrawingSearch } from '@univerjs/core';
import { DrawingTypeEnum } from '@univerjs/core';
import { getDrawingShapeKeyByDrawingSearch, IDrawingManagerService, IImageIoService, ImageSourceType } from '@univerjs/drawing';
import { DRAWING_OBJECT_LAYER_INDEX, Image } from '@univerjs/engine-render';
import { IDialogService } from '@univerjs/ui';
@@ -35,8 +36,18 @@ export class DrawingRenderService {
// eslint-disable-next-line max-lines-per-function
async renderImages(imageParam: IImageData, scene: Scene) {
const {
transform: singleTransform, drawingType, source, imageSourceType, srcRect,
prstGeom, groupId, unitId, subUnitId, drawingId, isMultiTransform, transforms: multiTransforms,
transform: singleTransform,
drawingType,
source,
imageSourceType,
srcRect,
prstGeom,
groupId,
unitId,
subUnitId,
drawingId,
isMultiTransform,
transforms: multiTransforms,
} = imageParam;
if (drawingType !== DrawingTypeEnum.DRAWING_IMAGE) {
return;
@@ -45,10 +45,12 @@ export const DrawingAlign = (props: IDrawingAlignProps) => {
{
label: localeService.t('image-panel.align.left'),
value: AlignType.left,
}, {
},
{
label: localeService.t('image-panel.align.center'),
value: AlignType.center,
}, {
},
{
label: localeService.t('image-panel.align.right'),
value: AlignType.right,
},
@@ -59,20 +61,24 @@ export const DrawingAlign = (props: IDrawingAlignProps) => {
{
label: localeService.t('image-panel.align.top'),
value: AlignType.top,
}, {
},
{
label: localeService.t('image-panel.align.middle'),
value: AlignType.middle,
}, {
},
{
label: localeService.t('image-panel.align.bottom'),
value: AlignType.bottom,
},
],
}, {
},
{
options: [
{
label: localeService.t('image-panel.align.horizon'),
value: AlignType.horizon,
}, {
},
{
label: localeService.t('image-panel.align.vertical'),
value: AlignType.vertical,
},
@@ -65,7 +65,9 @@ export const DrawingGroup = (props: IDrawingGroupProps) => {
const transform = drawing.transform || { left: 0, top: 0 };
const { unitId, subUnitId, drawingId } = drawing;
return {
unitId, subUnitId, drawingId,
unitId,
subUnitId,
drawingId,
transform: {
...transform,
left: transform.left! - groupTransform.left,
@@ -103,7 +105,9 @@ export const DrawingGroup = (props: IDrawingGroupProps) => {
const { unitId, subUnitId, drawingId } = object;
const newTransform = transformObjectOutOfGroup(transform || {}, groupTransform, groupTransform.width || 0, groupTransform.height || 0);
return {
unitId, subUnitId, drawingId,
unitId,
subUnitId,
drawingId,
transform: {
...transform,
...newTransform,
@@ -48,31 +48,40 @@ export const ImageCropper = (props: IImageCropperProps) => {
{
label: localeService.t('image-panel.crop.mode'),
value: CropType.FREE,
}, {
},
{
label: '1:1',
value: CropType.R1_1,
}, {
},
{
label: '16:9',
value: CropType.R16_9,
}, {
},
{
label: '9:16',
value: CropType.R9_16,
}, {
},
{
label: '5:4',
value: CropType.R5_4,
}, {
},
{
label: '4:5',
value: CropType.R4_5,
}, {
},
{
label: '4:3',
value: CropType.R4_3,
}, {
},
{
label: '3:4',
value: CropType.R3_4,
}, {
},
{
label: '3:2',
value: CropType.R3_2,
}, {
},
{
label: '2:3',
value: CropType.R2_3,
},
+1 -1
View File
@@ -65,7 +65,7 @@
"devDependencies": {
"@univerjs-infra/shared": "workspace:*",
"rxjs": "^7.8.1",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
+1 -1
View File
@@ -77,7 +77,7 @@
"devDependencies": {
"@univerjs-infra/shared": "workspace:*",
"rxjs": "^7.8.1",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
@@ -399,17 +399,37 @@ export function erf(x: number): number {
return 0;
}
// eslint-disable-next-line
const cof = [-1.3026537197817094, 6.4196979235649026e-1, 1.9476473204185836e-2,
-9.561514786808631e-3, -9.46595344482036e-4, 3.66839497852761e-4,
4.2523324806907e-5, -2.0278578112534e-5, -1.624290004647e-6,
1.303655835580e-6, 1.5626441722e-8, -8.5238095915e-8,
6.529054439e-9, 5.059343495e-9, -9.91364156e-10,
-2.27365122e-10, 9.6467911e-11, 2.394038e-12,
-6.886027e-12, 8.94487e-13, 3.13092e-13,
-1.12708e-13, 3.81e-16, 7.106e-15,
-1.523e-15, -9.4e-17, 1.21e-16,
-2.8e-17];
const cof = [
-1.3026537197817094,
// eslint-disable-next-line no-loss-of-precision
6.4196979235649026e-1,
1.9476473204185836e-2,
-9.561514786808631e-3,
-9.46595344482036e-4,
3.66839497852761e-4,
4.2523324806907e-5,
-2.0278578112534e-5,
-1.624290004647e-6,
1.303655835580e-6,
1.5626441722e-8,
-8.5238095915e-8,
6.529054439e-9,
5.059343495e-9,
-9.91364156e-10,
-2.27365122e-10,
9.6467911e-11,
2.394038e-12,
-6.886027e-12,
8.94487e-13,
3.13092e-13,
-1.12708e-13,
3.81e-16,
7.106e-15,
-1.523e-15,
-9.4e-17,
1.21e-16,
-2.8e-17,
];
let _x = x;
let isNeg = false;
@@ -358,14 +358,26 @@ export function forecastLinear(x: number, knownYs: number[], knownXs: number[]):
export function gamma(x: number): number {
const p = [
-1.716185138865495, 24.76565080557592, -379.80425647094563,
629.3311553128184, 866.9662027904133, -31451.272968848367,
-36144.413418691176, 66456.14382024054,
-1.716185138865495,
24.76565080557592,
-379.80425647094563,
629.3311553128184,
866.9662027904133,
-31451.272968848367,
-36144.413418691176,
66456.14382024054,
];
const q = [
-30.8402300119739, 315.35062697960416, -1015.1563674902192,
-3107.771671572311, 22538.118420980151, 4755.8462775278811, // eslint-disable-line
-134659.9598649693, -115132.2596755535,
-30.8402300119739,
315.35062697960416,
-1015.1563674902192,
-3107.771671572311,
// eslint-disable-next-line no-loss-of-precision
22538.118420980151,
// eslint-disable-next-line no-loss-of-precision
4755.8462775278811,
-134659.9598649693,
-115132.2596755535,
];
let fact = 0;
@@ -457,7 +469,9 @@ export function gammaINV(probability: number, alpha: number, beta: number): numb
export function gammaln(x: number): number {
const coefficients = [
76.18009172947146, -86.50532032941677, 24.01409824083091, // eslint-disable-line
-1.231739572450155, 0.1208650973866179e-2, -0.5395239384953e-5,
-1.231739572450155,
0.1208650973866179e-2,
-0.5395239384953e-5,
];
let y = x;
@@ -19,7 +19,8 @@ import type { ISetDefinedNameMutationParam } from '../commands/mutations/set-def
import type {
IRemoveFeatureCalculationMutationParam,
ISetFeatureCalculationMutation } from '../commands/mutations/set-feature-calculation.mutation';
ISetFeatureCalculationMutation,
} from '../commands/mutations/set-feature-calculation.mutation';
import type { ISetFormulaDataMutationParams } from '../commands/mutations/set-formula-data.mutation';
import type { IRemoveOtherFormulaMutationParams, ISetOtherFormulaMutationParams } from '../commands/mutations/set-other-formula.mutation';
import { Disposable, ICommandService, ObjectMatrix } from '@univerjs/core';
@@ -38,7 +39,8 @@ export class SetDependencyController extends Disposable {
@ICommandService private readonly _commandService: ICommandService,
@IFeatureCalculationManagerService
@IDependencyManagerService private readonly _dependencyManagerService: IDependencyManagerService,
@IFeatureCalculationManagerService private readonly _featureCalculationManagerService: IFeatureCalculationManagerService) {
@IFeatureCalculationManagerService private readonly _featureCalculationManagerService: IFeatureCalculationManagerService
) {
super();
this._initialize();
@@ -22,7 +22,8 @@ import type {
AsyncObject,
BaseReferenceObject,
FunctionVariantType,
NodeValueType } from '../reference-object/base-reference-object';
NodeValueType,
} from '../reference-object/base-reference-object';
import type { BaseValueObject } from '../value-object/base-value-object';
import type { FormulaFunctionResultValueType } from '../value-object/primitive-object';
import { Inject, Injector } from '@univerjs/core';
@@ -106,10 +106,7 @@ describe('arrayValueObject atan2 method test', () => {
expect((atan2ArrayValueObject.atan2(originArrayValueObject) as ArrayValueObject).toValue()).toStrictEqual([
[1.1071487177940904, 0.7853981633974483, 0.5880026035475675, 0.6435011087932844, 0.5404195002705842],
[0.3217505543966422, 0.27829965900511133, 0.24497866312686414, 0.3217505543966422, 0.2914567944778671],
[
0.17985349979247828, 0.16514867741462683, 0.15264932839526518, 0.21109333322274654,
0.19739555984988078,
],
[0.17985349979247828, 0.16514867741462683, 0.15264932839526518, 0.21109333322274654, 0.19739555984988078],
]);
});
@@ -126,14 +123,8 @@ describe('arrayValueObject atan2 method test', () => {
expect((atan2ArrayValueObject.atan2(originArrayValueObject) as ArrayValueObject).toValue()).toStrictEqual([
[1.2490457723982544, 0.982793723247329, 0.7853981633974483, 0.6435011087932844, 0.5404195002705842],
[
0.3217505543966422, 0.27829965900511133, 0.24497866312686414, 0.21866894587394195,
0.19739555984988078,
],
[
0.09065988720074511, 0.08314123188844122, 0.07677189126977804, 0.07130746478529032,
0.06656816377582381,
],
[0.3217505543966422, 0.27829965900511133, 0.24497866312686414, 0.21866894587394195, 0.19739555984988078],
[0.09065988720074511, 0.08314123188844122, 0.07677189126977804, 0.07130746478529032, 0.06656816377582381],
]);
});
@@ -69,8 +69,7 @@ describe('Test datevalue function', () => {
it('Serial number is array', () => {
const serialNumber = ArrayValueObject.create({
calculateValueList: transformToValueObject([[1, ' ', 1.23, true, false, null],
[0, '100', '2.34', 'test', -3, ErrorType.NAME]]),
calculateValueList: transformToValueObject([[1, ' ', 1.23, true, false, null], [0, '100', '2.34', 'test', -3, ErrorType.NAME]]),
rowCount: 2,
columnCount: 6,
unitId: '',
@@ -79,7 +78,21 @@ describe('Test datevalue function', () => {
column: 0,
});
const result = testFunction.calculate(serialNumber);
expect(transformToValue(result.getArrayValue())).toStrictEqual([[ErrorType.VALUE, ErrorType.VALUE, ErrorType.VALUE, ErrorType.VALUE, ErrorType.VALUE, ErrorType.VALUE], [ErrorType.VALUE, ErrorType.VALUE, ErrorType.VALUE, ErrorType.VALUE, ErrorType.VALUE, ErrorType.NAME]]);
expect(transformToValue(result.getArrayValue())).toStrictEqual([[
ErrorType.VALUE,
ErrorType.VALUE,
ErrorType.VALUE,
ErrorType.VALUE,
ErrorType.VALUE,
ErrorType.VALUE,
], [
ErrorType.VALUE,
ErrorType.VALUE,
ErrorType.VALUE,
ErrorType.VALUE,
ErrorType.VALUE,
ErrorType.NAME,
]]);
});
});
});
@@ -16,12 +16,12 @@
import { describe, expect, it } from 'vitest';
import { FUNCTION_NAMES_DATE } from '../../function-names';
import { Day } from '../index';
import { NumberValueObject, StringValueObject } from '../../../../engine/value-object/primitive-object';
import { ErrorType } from '../../../../basics/error-type';
import { ArrayValueObject, transformToValue, transformToValueObject } from '../../../../engine/value-object/array-value-object';
import { ErrorValueObject } from '../../../../engine/value-object/base-value-object';
import { ErrorType } from '../../../../basics/error-type';
import { NumberValueObject, StringValueObject } from '../../../../engine/value-object/primitive-object';
import { FUNCTION_NAMES_DATE } from '../../function-names';
import { Day } from '../index';
describe('Test day function', () => {
const testFunction = new Day(FUNCTION_NAMES_DATE.DAY);
@@ -46,8 +46,7 @@ describe('Test day function', () => {
it('Serial number is array', () => {
const serialNumber = ArrayValueObject.create({
calculateValueList: transformToValueObject([[1, ' ', 1.23, true, false, null],
[0, '100', '2.34', 'test', -3, 1900]]),
calculateValueList: transformToValueObject([[1, ' ', 1.23, true, false, null], [0, '100', '2.34', 'test', -3, 1900]]),
rowCount: 2,
columnCount: 6,
unitId: '',
@@ -16,10 +16,10 @@
import { describe, expect, it } from 'vitest';
import { ArrayValueObject, transformToValue, transformToValueObject } from '../../../../engine/value-object/array-value-object';
import { NumberValueObject } from '../../../../engine/value-object/primitive-object';
import { FUNCTION_NAMES_DATE } from '../../function-names';
import { Edate } from '../index';
import { NumberValueObject } from '../../../../engine/value-object/primitive-object';
import { ArrayValueObject, transformToValue, transformToValueObject } from '../../../../engine/value-object/array-value-object';
describe('Test edate function', () => {
const testFunction = new Edate(FUNCTION_NAMES_DATE.EDATE);
@@ -83,8 +83,7 @@ describe('Test edate function', () => {
it('Months is array with multiple format values', () => {
const startDate = NumberValueObject.create(43831);
const months = ArrayValueObject.create({
calculateValueList: transformToValueObject([[1, ' ', 1.23, true, false, null],
[0, '100', '2.34', 'test', -3, 1900]]),
calculateValueList: transformToValueObject([[1, ' ', 1.23, true, false, null], [0, '100', '2.34', 'test', -3, 1900]]),
rowCount: 2,
columnCount: 6,
unitId: '',
@@ -16,10 +16,10 @@
import { describe, expect, it } from 'vitest';
import { ArrayValueObject, transformToValue, transformToValueObject } from '../../../../engine/value-object/array-value-object';
import { NumberValueObject, StringValueObject } from '../../../../engine/value-object/primitive-object';
import { FUNCTION_NAMES_DATE } from '../../function-names';
import { Month } from '../index';
import { NumberValueObject, StringValueObject } from '../../../../engine/value-object/primitive-object';
import { ArrayValueObject, transformToValue, transformToValueObject } from '../../../../engine/value-object/array-value-object';
describe('Test month function', () => {
const testFunction = new Month(FUNCTION_NAMES_DATE.MONTH);
@@ -39,8 +39,7 @@ describe('Test month function', () => {
it('Serial number is array', () => {
const serialNumber = ArrayValueObject.create({
calculateValueList: transformToValueObject([[1, ' ', 1.23, true, false, null],
[0, '100', '2.34', 'test', -3, 1900]]),
calculateValueList: transformToValueObject([[1, ' ', 1.23, true, false, null], [0, '100', '2.34', 'test', -3, 1900]]),
rowCount: 2,
columnCount: 6,
unitId: '',
@@ -16,12 +16,12 @@
import { describe, expect, it } from 'vitest';
import { FUNCTION_NAMES_DATE } from '../../function-names';
import { Timevalue } from '../index';
import { BooleanValueObject, NullValueObject, NumberValueObject, StringValueObject } from '../../../../engine/value-object/primitive-object';
import { ErrorType } from '../../../../basics/error-type';
import { ArrayValueObject, transformToValue, transformToValueObject } from '../../../../engine/value-object/array-value-object';
import { ErrorValueObject } from '../../../../engine/value-object/base-value-object';
import { ErrorType } from '../../../../basics/error-type';
import { BooleanValueObject, NullValueObject, NumberValueObject, StringValueObject } from '../../../../engine/value-object/primitive-object';
import { FUNCTION_NAMES_DATE } from '../../function-names';
import { Timevalue } from '../index';
describe('Test timevalue function', () => {
const testFunction = new Timevalue(FUNCTION_NAMES_DATE.TIMEVALUE);
@@ -65,8 +65,7 @@ describe('Test timevalue function', () => {
it('Serial number is array', () => {
const serialNumber = ArrayValueObject.create({
calculateValueList: transformToValueObject([[1, ' ', 1.23, true, false, null],
[0, '100', '2.34', 'test', -3, ErrorType.NAME]]),
calculateValueList: transformToValueObject([[1, ' ', 1.23, true, false, null], [0, '100', '2.34', 'test', -3, ErrorType.NAME]]),
rowCount: 2,
columnCount: 6,
unitId: '',
@@ -16,10 +16,10 @@
import { describe, expect, it } from 'vitest';
import { ArrayValueObject, transformToValue, transformToValueObject } from '../../../../engine/value-object/array-value-object';
import { NumberValueObject, StringValueObject } from '../../../../engine/value-object/primitive-object';
import { FUNCTION_NAMES_DATE } from '../../function-names';
import { Year } from '../index';
import { NumberValueObject, StringValueObject } from '../../../../engine/value-object/primitive-object';
import { ArrayValueObject, transformToValue, transformToValueObject } from '../../../../engine/value-object/array-value-object';
describe('Test year function', () => {
const testFunction = new Year(FUNCTION_NAMES_DATE.YEAR);
@@ -38,8 +38,7 @@ describe('Test year function', () => {
it('Serial number is array', () => {
const serialNumber = ArrayValueObject.create({
calculateValueList: transformToValueObject([[1, ' ', 1.23, true, false, null],
[0, '100', '2.34', 'test', -3, 1900]]),
calculateValueList: transformToValueObject([[1, ' ', 1.23, true, false, null], [0, '100', '2.34', 'test', -3, 1900]]),
rowCount: 2,
columnCount: 6,
unitId: '',
@@ -14,14 +14,16 @@
* limitations under the License.
*/
import type { ArrayValueObject } from '../../../engine/value-object/array-value-object';
import type { IRange } from '@univerjs/core';
import { AbsoluteRefType, type IRange } from '@univerjs/core';
import type { ArrayValueObject } from '../../../engine/value-object/array-value-object';
import type { BaseValueObject } from '../../../engine/value-object/base-value-object';
import { AbsoluteRefType } from '@univerjs/core';
import { ErrorType } from '../../../basics/error-type';
import { expandArrayValueObject } from '../../../engine/utils/array-object';
import { serializeRangeToR1C1 } from '../../../engine/utils/r1c1-reference';
import { addQuotesBothSides, serializeRange } from '../../../engine/utils/reference';
import { type BaseValueObject, ErrorValueObject } from '../../../engine/value-object/base-value-object';
import { ErrorValueObject } from '../../../engine/value-object/base-value-object';
import { BooleanValueObject, NumberValueObject, StringValueObject } from '../../../engine/value-object/primitive-object';
import { BaseFunction } from '../../base-function';
@@ -116,11 +118,7 @@ export class Address extends BaseFunction {
});
}
private _calculateSingleCell(rowNumber: BaseValueObject,
columnNumber: BaseValueObject,
absNumber: BaseValueObject,
a1: BaseValueObject,
sheetText: BaseValueObject) {
private _calculateSingleCell(rowNumber: BaseValueObject, columnNumber: BaseValueObject, absNumber: BaseValueObject, a1: BaseValueObject, sheetText: BaseValueObject) {
const row = Number.parseInt(`${Number(rowNumber.getValue()) - 1}`);
const column = Number.parseInt(`${Number(columnNumber.getValue()) - 1}`);
const absNumberValue = Number.parseInt(`${Number(absNumber.getValue())}`);
@@ -15,14 +15,15 @@
*/
import type { IObjectArrayPrimitiveType, IRowData, Nullable } from '@univerjs/core';
import type { BaseReferenceObject, FunctionVariantType } from '../../../engine/reference-object/base-reference-object';
import type { ArrayValueObject } from '../../../engine/value-object/array-value-object';
import type { BaseValueObject } from '../../../engine/value-object/base-value-object';
import { BooleanNumber } from '@univerjs/core';
import { ErrorType } from '../../../basics/error-type';
import type { BaseReferenceObject, FunctionVariantType } from '../../../engine/reference-object/base-reference-object';
import { type BaseValueObject, ErrorValueObject } from '../../../engine/value-object/base-value-object';
import { BaseFunction } from '../../base-function';
import { createNewArray } from '../../../engine/utils/array-object';
import { ErrorValueObject } from '../../../engine/value-object/base-value-object';
import { NumberValueObject } from '../../../engine/value-object/primitive-object';
import type { ArrayValueObject } from '../../../engine/value-object/array-value-object';
import { BaseFunction } from '../../base-function';
enum FunctionNum {
AVERAGE = 1,
@@ -407,8 +408,7 @@ export class Subtotal extends BaseFunction {
return createNewArray(flattenValues, 1, flattenValues[0].length);
}
private _isRowHidden(rowData: IObjectArrayPrimitiveType<Partial<IRowData>>, rowIndex: number
) {
private _isRowHidden(rowData: IObjectArrayPrimitiveType<Partial<IRowData>>, rowIndex: number) {
const row = rowData[rowIndex];
if (!row) {
return false;
@@ -85,7 +85,9 @@ export class DefinedNamesService extends Disposable implements IDefinedNamesServ
readonly update$ = this._update$.asObservable();
private _currentRange: IUnitRange = {
unitId: '', sheetId: '', range: {
unitId: '',
sheetId: '',
range: {
startRow: 0,
endRow: 0,
startColumn: 0,
+1 -1
View File
@@ -59,7 +59,7 @@
},
"devDependencies": {
"@univerjs-infra/shared": "workspace:*",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
}
+1 -1
View File
@@ -72,7 +72,7 @@
"@types/opentype.js": "^1.3.8",
"@univerjs-infra/shared": "workspace:*",
"rxjs": "^7.8.1",
"typescript": "^5.7.3",
"typescript": "^5.8.2",
"vite": "^6.2.0",
"vitest": "^3.0.7"
},
@@ -398,14 +398,7 @@ function _divideOperator(
);
}
_divideOperator(ctx,
glyphGroup,
pages,
sectionBreakConfig,
paragraphConfig,
isParagraphFirstShapedText,
breakPointType);
_divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType);
return;
}
@@ -414,15 +407,7 @@ function _divideOperator(
updateDivideInfo(divide, { breakType: breakPointType });
}
} else {
_lineOperator(ctx,
glyphGroup,
pages,
sectionBreakConfig,
paragraphConfig,
isParagraphFirstShapedText,
breakPointType,
defaultSpanLineHeight);
_lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType, defaultSpanLineHeight);
}
}
@@ -483,7 +468,12 @@ function _lineOperator(
} = paragraphStyle;
const {
paragraphLineGapDefault, linePitch, lineSpacing, spacingRule, snapToGrid, gridType,
paragraphLineGapDefault,
linePitch,
lineSpacing,
spacingRule,
snapToGrid,
gridType,
} = getLineHeightConfig(
sectionBreakConfig,
paragraphConfig
@@ -761,7 +751,13 @@ function __getWrapTablePosition(
const left = getPositionHorizon(positionH, column, page, width, isPageBreak) ?? 0;
const top = getPositionVertical(
positionV, page, lineTop, lineHeight, height, drawingAnchorTop, isPageBreak
positionV,
page,
lineTop,
lineHeight,
height,
drawingAnchorTop,
isPageBreak
) ?? 0;
return { left, top };
@@ -1038,18 +1034,9 @@ function _columnOperator(
const columnIsFull = isColumnFull(lastPage);
if (columnIsFull === true) {
_pageOperator(ctx,
glyphGroup,
pages,
sectionBreakConfig,
paragraphConfig,
isParagraphFirstShapedText,
breakPointType, defaultSpanLineHeight);
_pageOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType, defaultSpanLineHeight);
} else {
_lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig,
isParagraphFirstShapedText,
breakPointType, defaultSpanLineHeight);
_lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType, defaultSpanLineHeight);
}
}
@@ -1067,14 +1054,7 @@ function _pageOperator(
const { skeHeaders, skeFooters } = paragraphConfig;
pages.push(createSkeletonPage(ctx, sectionBreakConfig, { skeHeaders, skeFooters }, curSkeletonPage?.pageNumber + 1));
_columnOperator(ctx, glyphGroup,
pages,
sectionBreakConfig,
paragraphConfig,
isParagraphFirstShapedText,
breakPointType,
defaultSpanLineHeight);
_columnOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType, defaultSpanLineHeight);
}
/**
@@ -1301,7 +1281,13 @@ function __getDrawingPosition(
drawing.aLeft = getPositionHorizon(positionH, column, page, width, isPageBreak) ?? 0;
drawing.aTop = getPositionVertical(
positionV, page, lineTop, lineHeight, height, blockAnchorTop, isPageBreak
positionV,
page,
lineTop,
lineHeight,
height,
blockAnchorTop,
isPageBreak
) ?? 0;
drawing.width = width;
drawing.height = height;
@@ -14,6 +14,7 @@
* limitations under the License.
*/
/* eslint-disable antfu/consistent-list-newline */
import fs from 'node:fs';
import { resolve } from 'node:path';
import { describe, expect, it } from 'vitest';
@@ -18,10 +18,10 @@
import type { Nullable } from '@univerjs/core';
import type { ILineBreakRule } from './rule';
import { Break, BreakPointType } from './break';
import { AI, AL, BA, BK, CJ, CR, HL, HY, LF, NL, NS, RI, SA, SG, SP, WJ, XX, ZWJ } from './classes';
import { CI_BRK, CP_BRK, DI_BRK, IN_BRK, pairTable, PR_BRK } from './pairs';
import type { ILineBreakRule } from './rule';
import { Rule } from './rule';
import data from './trie-data';
import UnicodeTrie from './unicode-trie';
@@ -14,6 +14,7 @@
* limitations under the License.
*/
/* eslint-disable antfu/consistent-list-newline */
export default new Uint8Array([
0, 8, 14, 0, 0, 0, 0, 0, 176, 232, 0, 0, 1, 181, 15, 74, 240, 237, 157, 11, 140, 93, 69, 25, 199, 231, 178, 187,
183, 123, 31, 187, 237, 46, 108, 193, 194, 22, 104, 41, 200, 242, 48, 128, 104, 16, 129, 152, 162, 64, 42, 10, 193,
@@ -15,10 +15,10 @@
*/
import type { ISectionColumnProperties } from '@univerjs/core';
import { ColumnSeparatorType } from '@univerjs/core';
import type { IDocumentSkeletonColumn } from '../../../../basics/i-document-skeleton-cached';
import { ColumnSeparatorType } from '@univerjs/core';
export function createSkeletonColumn(
columnIndex: number = 0,
columnProperties: ISectionColumnProperties[],
@@ -209,9 +209,16 @@ function _createSkeletonHeaderFooter(
count = 0
): IDocumentSkeletonHeaderFooter {
const {
lists, footerTreeMap, headerTreeMap, localeService, pageSize, drawings,
marginLeft = 0, marginRight = 0,
marginHeader = 0, marginFooter = 0,
lists,
footerTreeMap,
headerTreeMap,
localeService,
pageSize,
drawings,
marginLeft = 0,
marginRight = 0,
marginHeader = 0,
marginFooter = 0,
} = sectionBreakConfig;
const pageWidth = pageSize?.width || Number.POSITIVE_INFINITY;
const pageHeight = pageSize?.height || Number.POSITIVE_INFINITY;
@@ -14,7 +14,8 @@
* limitations under the License.
*/
import { BooleanNumber, type IStyleBase, type Nullable } from '@univerjs/core';
import type { IStyleBase, Nullable } from '@univerjs/core';
import { BooleanNumber } from '@univerjs/core';
interface IFontData {
readonly family: string;
@@ -14,10 +14,11 @@
* limitations under the License.
*/
import { BooleanNumber, type IDocumentBody, type IStyleBase, type Nullable } from '@univerjs/core';
import type { IDocumentBody, IStyleBase, Nullable } from '@univerjs/core';
import type Opentype from 'opentype.js';
import { BooleanNumber } from '@univerjs/core';
// @ts-ignore
import { parse } from 'opentype.js/dist/opentype.module';
import type Opentype from 'opentype.js';
import { DEFAULT_FONTFACE_PLANE } from '../../../../basics/const';
import { EMOJI_REG } from '../../../../basics/tools';
import { fontLibrary } from './font-library';
@@ -525,7 +525,8 @@ export function lineIterator(
column: IDocumentSkeletonColumn,
section: IDocumentSkeletonSection,
page: IDocumentSkeletonPage
) => void) {
) => void
) {
for (const pageOrCell of pagesOrCells) {
const { sections } = pageOrCell;
@@ -188,7 +188,8 @@ export class SpreadsheetSkeleton extends SheetSkeleton {
this.disposeWithMe(
this._scene.onTransformChange$.subscribeEvent((param: ITransformChangeState) => {
this.setScale(param.value.scaleX || 1, param.value.scaleY);
}));
})
);
}
override _updateLayout() {
@@ -278,7 +278,17 @@ export class Spreadsheet extends SheetComponent {
// scrolling && no dirty
this.addRenderTagToScene('scrolling', true);
this.paintNewAreaForScrolling(viewportInfo, {
cacheCanvas, cacheCtx, mainCtx, topOrigin, leftOrigin, bufferEdgeX, bufferEdgeY, scaleX, scaleY, columnHeaderHeight, rowHeaderWidth,
cacheCanvas,
cacheCtx,
mainCtx,
topOrigin,
leftOrigin,
bufferEdgeX,
bufferEdgeY,
scaleX,
scaleY,
columnHeaderHeight,
rowHeaderWidth,
});
}
// support for browser native zoom (only windows has this problem)
@@ -15,14 +15,14 @@
*/
import type { Nullable } from '@univerjs/core';
import { COLORS, EventSubject } from '@univerjs/core';
import { CURSOR_TYPE } from '../../basics/const';
import type { IMouseEvent, IPointerEvent } from '../../basics/i-events';
import { attachObjectHover } from '../../basics/quick-event';
import { getColor } from '../../basics/tools';
import type { UniverRenderingContext } from '../../context';
import type { Scene } from '../../scene';
import { COLORS, EventSubject } from '@univerjs/core';
import { CURSOR_TYPE } from '../../basics/const';
import { attachObjectHover } from '../../basics/quick-event';
import { getColor } from '../../basics/tools';
import { SceneViewer } from '../../scene-viewer';
import { Path } from '../../shape/path';
+98 -26
View File
@@ -15,25 +15,28 @@
*/
import type { IAbsoluteTransform, IKeyValue, Nullable } from '@univerjs/core';
import type { IMouseEvent, IPointerEvent } from './basics/i-events';
import type { Subscription } from 'rxjs';
import type { BaseObject } from './base-object';
import type { IMouseEvent, IPointerEvent } from './basics/i-events';
import type { ITransformerConfig } from './basics/transformer-config';
import type { IPoint } from './basics/vector2';
import type { Scene } from './scene';
import type { IRectProps } from './shape/rect';
import type { IRegularPolygonProps } from './shape/regular-polygon';
import { Disposable, MOVE_BUFFER_VALUE, requestImmediateMacroTask, toDisposable } from '@univerjs/core';
import { Subject, type Subscription } from 'rxjs';
import { type BaseObject, ObjectType } from './base-object';
import { Subject } from 'rxjs';
import { ObjectType } from './base-object';
import { CURSOR_TYPE } from './basics/const';
import { offsetRotationAxis } from './basics/offset-rotation-axis';
import { offsetRotationAxis } from './basics/offset-rotation-axis';
import { getCurrentScrollXY } from './basics/scroll-xy';
import { degToRad, precisionTo, radToDeg } from './basics/tools';
import { Vector2 } from './basics/vector2';
import { Group } from './group';
import { ScrollTimer } from './scroll-timer';
import { Rect } from './shape/rect';
import { type IRegularPolygonProps, RegularPolygon } from './shape/regular-polygon';
import { RegularPolygon } from './shape/regular-polygon';
enum TransformerManagerType {
RESIZE_LT = '__SpreadsheetTransformerResizeLT__',
@@ -284,16 +287,39 @@ export class Transformer extends Disposable implements ITransformerConfig {
this._createControl(applyObject);
}
// eslint-disable-next-line complexity
// eslint-disable-next-line max-lines-per-function, complexity
private _getConfig(applyObject: BaseObject) {
const objectTransformerConfig = applyObject.transformerConfig;
let {
isCropper, hoverEnabled, hoverEnterFunc, hoverLeaveFunc, resizeEnabled,
rotateEnabled, rotationSnaps, rotationSnapTolerance, rotateAnchorOffset, rotateSize, rotateCornerRadius,
borderEnabled, borderStroke, borderStrokeWidth, borderDash, borderSpacing,
anchorFill, anchorStroke, anchorStrokeWidth, anchorSize, anchorCornerRadius,
keepRatio, centeredScaling, enabledAnchors, flipEnabled, ignoreStroke,
boundBoxFunc, useSingleNodeRotation, shouldOverdrawWholeArea,
isCropper,
hoverEnabled,
hoverEnterFunc,
hoverLeaveFunc,
resizeEnabled,
rotateEnabled,
rotationSnaps,
rotationSnapTolerance,
rotateAnchorOffset,
rotateSize,
rotateCornerRadius,
borderEnabled,
borderStroke,
borderStrokeWidth,
borderDash,
borderSpacing,
anchorFill,
anchorStroke,
anchorStrokeWidth,
anchorSize,
anchorCornerRadius,
keepRatio,
centeredScaling,
enabledAnchors,
flipEnabled,
ignoreStroke,
boundBoxFunc,
useSingleNodeRotation,
shouldOverdrawWholeArea,
} = this;
if (objectTransformerConfig != null) {
isCropper = objectTransformerConfig.isCropper ?? isCropper;
@@ -328,12 +354,35 @@ export class Transformer extends Disposable implements ITransformerConfig {
}
return {
isCropper, hoverEnabled, hoverEnterFunc, hoverLeaveFunc, resizeEnabled,
rotateEnabled, rotationSnaps, rotationSnapTolerance, rotateAnchorOffset, rotateSize, rotateCornerRadius,
borderEnabled, borderStroke, borderStrokeWidth, borderDash, borderSpacing,
anchorFill, anchorStroke, anchorStrokeWidth, anchorSize, anchorCornerRadius,
keepRatio, centeredScaling, enabledAnchors, flipEnabled, ignoreStroke,
boundBoxFunc, useSingleNodeRotation, shouldOverdrawWholeArea,
isCropper,
hoverEnabled,
hoverEnterFunc,
hoverLeaveFunc,
resizeEnabled,
rotateEnabled,
rotationSnaps,
rotationSnapTolerance,
rotateAnchorOffset,
rotateSize,
rotateCornerRadius,
borderEnabled,
borderStroke,
borderStrokeWidth,
borderDash,
borderSpacing,
anchorFill,
anchorStroke,
anchorStrokeWidth,
anchorSize,
anchorCornerRadius,
keepRatio,
centeredScaling,
enabledAnchors,
flipEnabled,
ignoreStroke,
boundBoxFunc,
useSingleNodeRotation,
shouldOverdrawWholeArea,
};
}
@@ -538,8 +587,13 @@ export class Transformer extends Disposable implements ITransformerConfig {
const moveObject = selectedObjects[i];
const boundary = this._checkMoveBoundary(
moveObject, moveLeft, moveTop, ancestorLeft,
ancestorTop, topSceneWidth, topSceneHeight
moveObject,
moveLeft,
moveTop,
ancestorLeft,
ancestorTop,
topSceneWidth,
topSceneHeight
);
moveLeft = boundary.moveLeft;
@@ -1566,27 +1620,45 @@ export class Transformer extends Disposable implements ITransformerConfig {
if (borderEnabled && !isCropper) {
const outline = new Rect(`${TransformerManagerType.OUTLINE}_${zIndex}`, {
zIndex: zIndex - 1, evented: false, strokeWidth: borderStrokeWidth, stroke: borderStroke,
zIndex: zIndex - 1,
evented: false,
strokeWidth: borderStrokeWidth,
stroke: borderStroke,
...this._getOutlinePosition(width, height, borderSpacing, borderStrokeWidth),
});
groupElements.push(outline);
}
if (resizeEnabled && !isCropper) {
const { left: lineLeft, top: lineTop } = this._getRotateAnchorPosition(
TransformerManagerType.ROTATE_LINE, height, width, applyObject
TransformerManagerType.ROTATE_LINE,
height,
width,
applyObject
);
if (rotateEnabled) {
const rotateLine = new Rect(`${TransformerManagerType.ROTATE_LINE}_${zIndex}`, {
zIndex: zIndex - 1, evented: false, left: lineLeft, top: lineTop, height: rotateAnchorOffset, width: 1,
strokeWidth: borderStrokeWidth, stroke: borderStroke,
zIndex: zIndex - 1,
evented: false,
left: lineLeft,
top: lineTop,
height: rotateAnchorOffset,
width: 1,
strokeWidth: borderStrokeWidth,
stroke: borderStroke,
});
const { left, top } = this._getRotateAnchorPosition(TransformerManagerType.ROTATE, height, width, applyObject);
const cursor = this._getRotateAnchorCursor(TransformerManagerType.ROTATE);
const rotate = new Rect(`${TransformerManagerType.ROTATE}_${zIndex}`, {
zIndex: zIndex - 1, left, top, height: rotateSize, width: rotateSize,
radius: rotateCornerRadius, strokeWidth: borderStrokeWidth * 2, stroke: borderStroke,
zIndex: zIndex - 1,
left,
top,
height: rotateSize,
width: rotateSize,
radius: rotateCornerRadius,
strokeWidth: borderStrokeWidth * 2,
stroke: borderStroke,
});
this._attachEventToRotate(rotate, applyObject);
this._attachHover(rotate, cursor, CURSOR_TYPE.DEFAULT);
+2 -2
View File
@@ -16,10 +16,10 @@
import type { IKeyValue } from '@univerjs/core';
import { TRANSFORM_CHANGE_OBSERVABLE_TYPE } from '../basics/interfaces';
import type { UniverRenderingContext } from '../context';
import { ObjectType } from '../base-object';
import type { IShapeProps } from './shape';
import { ObjectType } from '../base-object';
import { TRANSFORM_CHANGE_OBSERVABLE_TYPE } from '../basics/interfaces';
import { Shape } from './shape';
export interface ICircleProps extends IShapeProps {
@@ -14,10 +14,10 @@
* limitations under the License.
*/
import { Rectangle } from '@univerjs/core';
import type { IViewportInfo } from '../basics/vector2';
import type { UniverRenderingContext } from '../context';
import type { IRectProps } from './rect';
import { Rectangle } from '@univerjs/core';
import { Rect } from './rect';
export class DashedRect extends Rect {
+4 -4
View File
@@ -16,13 +16,13 @@
import type { ISrcRect, Nullable, PresetGeometryType } from '@univerjs/core';
import type { UniverRenderingContext } from '../context';
import type { IObjectFullState, ITransformChangeState, IViewportInfo } from '../basics';
import type { UniverRenderingContext } from '../context';
import type { Scene } from '../scene';
import type { IShapeProps } from './shape';
import { ObjectType } from '../base-object';
import { RENDER_CLASS_TYPE, Vector2 } from '../basics';
import { offsetRotationAxis } from '../basics/offset-rotation-axis';
import type { Scene } from '../scene';
import { ObjectType } from '../base-object';
import type { IShapeProps } from './shape';
import { Shape } from './shape';
export interface IImageProps extends IShapeProps {
+1 -1
View File
@@ -17,9 +17,9 @@
import type { IKeyValue, Nullable } from '@univerjs/core';
import type { IObjectFullState } from '../basics/interfaces';
import { TRANSFORM_CHANGE_OBSERVABLE_TYPE } from '../basics/interfaces';
import type { UniverRenderingContext } from '../context';
import type { IShapeProps } from './shape';
import { TRANSFORM_CHANGE_OBSERVABLE_TYPE } from '../basics/interfaces';
import { Shape } from './shape';
interface IPathDataArray {
@@ -17,10 +17,10 @@
import type { IKeyValue } from '@univerjs/core';
import type { IObjectFullState } from '../basics/interfaces';
import { TRANSFORM_CHANGE_OBSERVABLE_TYPE } from '../basics/interfaces';
import type { IPoint, Vector2 } from '../basics/vector2';
import type { UniverRenderingContext } from '../context';
import type { IShapeProps } from './shape';
import { TRANSFORM_CHANGE_OBSERVABLE_TYPE } from '../basics/interfaces';
import { Shape } from './shape';
export interface IRegularPolygonProps extends IShapeProps {
@@ -25,16 +25,16 @@ import type {
LocaleService,
Nullable,
} from '@univerjs/core';
import { BooleanNumber, DEFAULT_EMPTY_DOCUMENT_VALUE, DocumentDataModel } from '@univerjs/core';
import type { BASE_OBJECT_ARRAY } from '../base-object';
import type { IViewportInfo } from '../basics/vector2';
import type { UniverRenderingContext } from '../context';
import { BooleanNumber, DEFAULT_EMPTY_DOCUMENT_VALUE, DocumentDataModel } from '@univerjs/core';
import { BaseObject, ObjectType } from '../base-object';
import { TRANSFORM_CHANGE_OBSERVABLE_TYPE } from '../basics/interfaces';
import type { IViewportInfo } from '../basics/vector2';
import { DocumentSkeleton } from '../components/docs/layout/doc-skeleton';
import { Documents } from '../components/docs/document';
import { DocumentSkeleton } from '../components/docs/layout/doc-skeleton';
import { DocumentViewModel } from '../components/docs/view-model/document-view-model';
import type { UniverRenderingContext } from '../context';
export interface IRichTextProps extends ITransformState, IStyleBase {
text?: string;

Some files were not shown because too many files have changed in this diff Show More