Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

feat(sheet): demo dev

dream-num2a4b21ff32a0
diff --git a/packages/base-docs/src/View/Render/Views/DrawingsView.ts b/packages/base-docs/src/View/Render/Views/DrawingsView.ts
new file mode 100644
index 0000000000..a1aed215eb
--- /dev/null
+++ b/packages/base-docs/src/View/Render/Views/DrawingsView.ts
@@ -0,0 +1,82 @@
+import { getColor, Rect, Documents, DocumentSkeleton, CustomObject, IPageRenderConfig, Transform, ptToPx, BaseObject } from '@univer/base-render';
+import { BaseView, CanvasViewRegistry } from '../BaseView';
+import { DOCS_VIEW_KEY } from './DocsView';
+
+const DRAWINGS_VIEW_BACKGROUND = 'drawings_view_background';
+
+export class DrawingsView extends BaseView {
+ zIndex = 3;
+
+ viewKey = DRAWINGS_VIEW_BACKGROUND;
+
+ protected _initialize() {
+ const scene = this.getScene();
+ const context = this.getContext();
+
+ const documents = scene.getObject(DOCS_VIEW_KEY.MAIN) as Documents;
+
+ const docsSkeleton = documents.getSkeleton();
+
+ const skeletonData = docsSkeleton?.getSkeletonData();
+
+ if (!skeletonData) {
+ return;
+ }
+
+ const { left: docsLeft, top: docsTop } = documents;
+
+ const { pages } = skeletonData;
+ const objectList: BaseObject[] = [];
+ const pageMarginCache = new Map<string, { marginLeft: number; marginTop: number }>();
+ for (let page of pages) {
+ const { skeDrawings, marginLeft, marginTop } = page;
+
+ skeDrawings.forEach((drawing) => {
+ const { aLeft, aTop, height, width } = drawing;
+
+ const rect = new Rect(drawing.objectId, {
+ left: aLeft + docsLeft + marginLeft,
+ top: aTop + docsTop + marginTop,
+ width: width,
+ height: height,
+ fill: 'rgba(102,111,99, 0.8)',
+ zIndex: 11,
+ isTransformer: true,
+ });
+
+ pageMarginCache.set(drawing.objectId, {
+ marginLeft,
+ marginTop,
+ });
+
+ objectList.push(rect);
+ });
+ }
+ scene.openTransformer();
+ scene.addObjects(objectList);
+
+ scene.getTransformer()?.onChangingObservable.add((state) => {
+ const { objects } = state;
+
+ objects.forEach((object) => {
+ const { oKey, left, top, height, width } = object;
+ const cache = pageMarginCache.get(oKey);
+ const marginLeft = cache?.marginLeft || 0;
+ const marginTop = cache?.marginTop || 0;
+
+ docsSkeleton?.updateDrawing(oKey, {
+ left: left - docsLeft - marginLeft,
+ top: top - docsTop - marginTop,
+ height,
+ width,
+ });
+ });
+
+ docsSkeleton?.calculate();
+ });
+
+ // scene.addObjects([pageBackground], 0);
+ }
+}
+
+CanvasViewRegistry.add(new DrawingsView());
diff --git a/packages/base-docs/src/View/Render/Views/PageView.ts b/packages/base-docs/src/View/Render/Views/PageView.ts
index cab50d30a4..cd4c1ad677 100644
--- a/packages/base-docs/src/View/Render/Views/PageView.ts
+++ b/packages/base-docs/src/View/Render/Views/PageView.ts
@@ -7,6 +7,8 @@ const PAGE_VIEW_BACKGROUND = 'page_view_background';
export class PageView extends BaseView {
zIndex = 2;
+ viewKey = PAGE_VIEW_BACKGROUND;
+
protected _initialize() {
const scene = this.getScene();
const context = this.getContext();
diff --git a/packages/base-docs/src/View/Render/Views/index.ts b/packages/base-docs/src/View/Render/Views/index.ts
index c5ce756783..4d44b26c77 100644
--- a/packages/base-docs/src/View/Render/Views/index.ts
+++ b/packages/base-docs/src/View/Render/Views/index.ts
@@ -1,2 +1,3 @@
export * from './DocsView';
export * from './PageView';
+export * from './DrawingsView';
diff --git a/packages/base-render/src/Component/Docs/DocSkeleton.ts b/packages/base-render/src/Component/Docs/DocSkeleton.ts
index 3b4928d67a..0dd7c2a5c7 100644
--- a/packages/base-render/src/Component/Docs/DocSkeleton.ts
+++ b/packages/base-render/src/Component/Docs/DocSkeleton.ts
@@ -38,6 +38,13 @@ export enum DocumentSkeletonState {
INVALID = 'invalid',
}
+interface IDrawingUpdateConfig {
+ left: number;
+ top: number;
+ height: number;
+ width: number;
+}
+
export class DocumentSkeleton extends Skeleton {
private _documentData: IDocumentData;
@@ -52,6 +59,23 @@ export class DocumentSkeleton extends Skeleton {
this._documentData = documentData;
}
+ updateDrawing(id: string, config: IDrawingUpdateConfig) {
+ const drawings = this._documentData.drawings;
+ if (!drawings) {
+ return;
+ }
+
+ const drawing = drawings[id];
+
+ const objectProperties = drawing.objectProperties;
+
+ objectProperties.size.width = config.width;
+ objectProperties.size.height = config.height;
+
+ objectProperties.positionH.posOffset = config.left;
+ objectProperties.positionV.posOffset = config.top;
+ }
+
calculate(bounds?: IBoundRect) {
if (!this.dirty) {
return;
diff --git a/packages/base-render/src/Component/Docs/Document.ts b/packages/base-render/src/Component/Docs/Document.ts
index 2689655b09..f879689547 100644
--- a/packages/base-render/src/Component/Docs/Document.ts
+++ b/packages/base-render/src/Component/Docs/Document.ts
@@ -9,7 +9,6 @@ import './Extensions';
import { calculateRectRotate, getRotateOffsetAndFarthestHypotenuse } from '../../Basics/Draw';
import { fixLineWidthByScale, getScale, degToRad } from '../../Basics/Tools';
import { DocsEditor } from './Document.Editor';
-import { Scene } from '../../Scene';
export interface IDocumentsConfig {
pageMarginLeft?: number;
@@ -435,7 +434,7 @@ export class Documents extends DocComponent {
}
findNodeByCoord(offsetX: number, offsetY: number) {
- const scene = this.getScene() as Scene;
+ const scene = this.getScene();
const originCoord = scene.transformToSceneCoord(Vector2.FromArray([offsetX, offsetY]));
if (!originCoord) {
@@ -492,8 +491,8 @@ export class Documents extends DocComponent {
continue;
}
- x -= startX;
- y -= startY;
+ x -= startX + pagePaddingLeft;
+ y -= startY + pagePaddingTop;
const sections = page.sections;
for (let section of sections) {
diff --git a/packages/base-render/src/Scene.Transformer.ts b/packages/base-render/src/Scene.Transformer.ts
index 8c043e2af6..3f6fdb56d7 100644
--- a/packages/base-render/src/Scene.Transformer.ts
+++ b/packages/base-render/src/Scene.Transformer.ts
@@ -1,4 +1,4 @@
-import { Nullable, Observer } from '@univer/core';
+import { Nullable, Observable, Observer } from '@univer/core';
import { BaseObject } from './BaseObject';
import { CURSOR_TYPE, IMouseEvent, IPointerEvent } from './Basics';
import { getCurrentScrollXY } from './Basics/Position';
@@ -44,6 +44,19 @@ interface transformState {
height?: number;
}
+enum MoveObserverType {
+ MOVE_START,
+ MOVING,
+ MOVE_END,
+}
+
+interface IChangeObserverConfig {
+ objects: Map<string, BaseObject>;
+ moveX?: number;
+ moveY?: number;
+ type: MoveObserverType;
+}
+
export interface ITransformerConfig {
hoverEnabled?: boolean;
hoverEnterFunc?: (e: IPointerEvent | IMouseEvent) => void;
@@ -165,6 +178,12 @@ export class Transformer implements ITransformerConfig {
private _selectedObjectMap = new Map<string, BaseObject>();
+ onChangeStartObservable = new Observable<IChangeObserverConfig>();
+
+ onChangingObservable = new Observable<IChangeObserverConfig>();
+
+ onChangeEndObservable = new Observable<IChangeObserverConfig>();
+
constructor(private _scene: Scene, config?: ITransformerConfig) {
this._initialProps(config);
this._scene.onPointerDownObserver.add((moveEvt: IPointerEvent | IMouseEvent) => {
@@ -275,6 +294,13 @@ export class Transformer implements ITransformerConfig {
this._updateControlChildren();
+ this.onChangingObservable.notifyObservers({
+ objects: this._selectedObjectMap,
+ moveX: moveLeft,
+ moveY: moveTop,
+ type: MoveObserverType.MOVING,
+ });
+
this._startOffsetX = x;
this._startOffsetY = y;
}
@@ -671,6 +697,13 @@ export class Transformer implements ITransformerConfig {
moveObject.translate(moveLeft + moveObject.left, moveTop + moveObject.top);
});
+ this.onChangingObservable.notifyObservers({
+ objects: this._selectedObjectMap,
+ moveX: moveLeft,
+ moveY: moveTop,
+ type: MoveObserverType.MOVING,
+ });
+
this._startOffsetX = x;
this._startOffsetY = y;
}
@@ -732,6 +765,11 @@ export class Transformer implements ITransformerConfig {
scene.enableEvent();
this._updateControl();
scrollTimer.stopScroll();
+
+ this.onChangeEndObservable.notifyObservers({
+ objects: this._selectedObjectMap,
+ type: MoveObserverType.MOVE_END,
+ });
});
state.stopPropagation();
diff --git a/packages/base-render/src/Scene.ts b/packages/base-render/src/Scene.ts
index c40a0ff55c..a045d7fd35 100644
--- a/packages/base-render/src/Scene.ts
+++ b/packages/base-render/src/Scene.ts
@@ -567,6 +567,10 @@ export class Scene {
this._transformer?.attachTo(o);
}
+ getTransformer() {
+ return this._transformer;
+ }
+
transformToSceneCoord(coord: Vector2) {
const pickedViewport = this._viewports.find((vp) => vp.isHit(coord));
if (!this._evented || !pickedViewport) {
diff --git a/packages/base-render/src/Shape/Picture.ts b/packages/base-render/src/Shape/Picture.ts
index b6a7dc7b09..b2b67547e3 100644
--- a/packages/base-render/src/Shape/Picture.ts
+++ b/packages/base-render/src/Shape/Picture.ts
@@ -45,8 +45,8 @@ export class Picture extends Shape<IPictureProps> {
constructor(config: IPictureProps) {
super(undefined, config);
this._props = {
- autoWidth: true,
- autoHeight: true,
+ autoWidth: false,
+ autoHeight: false,
...config,
};
if (config.image) {
diff --git a/packages/base-sheets/index.html b/packages/base-sheets/index.html
index ee9054e4cb..fa9cd5c138 100644
--- a/packages/base-sheets/index.html
+++ b/packages/base-sheets/index.html
@@ -17,8 +17,8 @@
<body>
<div id="app" style="z-index: 1; position: fixed; font-size: 20px; color: green;"></div>
- <div id="universheet-demo-up" style="height: 50vh;"></div>
- <div id="universheet-demo-down" style="height: 50vh;"></div>
+ <div id="universheet-demo-up" style="height: 100%;"></div>
+ <!-- <div id="universheet-demo-down" style="height: 50vh;"></div> -->
<script type="module" src="/src/main.tsx"></script>
</body>
diff --git a/packages/base-slides/index.html b/packages/base-slides/index.html
index d0eb03769e..736af73a61 100644
--- a/packages/base-slides/index.html
+++ b/packages/base-slides/index.html
@@ -5,7 +5,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>UniverSheet</title>
+ <title>UniverSlide</title>
<style>
html,
body {
diff --git a/packages/base-slides/src/View/Render/Views/PageView.ts b/packages/base-slides/src/View/Render/Views/PageView.ts
deleted file mode 100644
index 29d2a694a1..0000000000
--- a/packages/base-slides/src/View/Render/Views/PageView.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-import { getColor, Rect, Documents, DocumentSkeleton, CustomObject, IPageRenderConfig, Transform, ptToPx } from '@univer/base-render';
-import { BaseView, CanvasViewRegistry } from '../BaseView';
-import { DOCS_VIEW_KEY } from './SlideView';
-
-const PAGE_VIEW_BACKGROUND = 'page_view_background';
-
-export class PageView extends BaseView {
- zIndex = 2;
-
- protected _initialize() {
- const scene = this.getScene();
- const context = this.getContext();
-
- const documents = scene.getObject(DOCS_VIEW_KEY.MAIN) as Documents;
-
- const pageSize = documents.getSkeleton()?.getPageSize();
-
- documents.onPageRenderObservable.add((config: IPageRenderConfig) => {
- const { page, pageLeft, pageTop, ctx } = config;
- const { width, height, marginBottom, marginLeft, marginRight, marginTop } = page;
- ctx.save();
- ctx.translate(pageLeft - 0.5, pageTop - 0.5);
- Rect.drawWith(ctx, {
- width: pageSize?.width || width,
- height: pageSize?.height || height,
- strokeWidth: 1,
- stroke: 'rgba(198,198,198, 1)',
- fill: 'rgba(255,255,255, 1)',
- zIndex: 3,
- });
- ctx.restore();
- });
-
- // scene.addObjects([pageBackground], 0);
- }
-}
-
-CanvasViewRegistry.add(new PageView());
diff --git a/packages/base-slides/src/View/Render/Views/SlideView.ts b/packages/base-slides/src/View/Render/Views/SlideView.ts
index f18b521bbf..7b07f24f30 100644
--- a/packages/base-slides/src/View/Render/Views/SlideView.ts
+++ b/packages/base-slides/src/View/Render/Views/SlideView.ts
@@ -1,4 +1,5 @@
-import { getColor, Rect, Documents, DocumentSkeleton } from '@univer/base-render';
+import { getColor, Rect, Documents, DocumentSkeleton, Picture, RichText } from '@univer/base-render';
+import { BlockType, IDocumentData, ParagraphElementType } from '@univer/core';
import { docsDemoData } from '../../../Basic/DemoData';
import { BaseView, CanvasViewRegistry } from '../BaseView';
import { CANVAS_VIEW_KEY } from '../BaseView';
@@ -7,6 +8,56 @@ export enum DOCS_VIEW_KEY {
MAIN = '__DocsRender__',
}
+const richTextTest: IDocumentData = {
+ documentId: 'd',
+ body: {
+ blockElements: {
+ twoParagraph: {
+ blockId: 'twoParagraph',
+ st: 0,
+ ed: 15,
+ blockType: BlockType.PARAGRAPH,
+ paragraph: {
+ elements: {
+ oneElement: {
+ eId: 'oneElement',
+ st: 0,
+ ed: 15,
+ et: ParagraphElementType.TEXT_RUN,
+ tr: {
+ ct: '祝贺Babylon中文网顺利启动!',
+ ts: {
+ fs: 30,
+ cl: {
+ rgb: 'rgb(196,62,28)',
+ },
+ },
+ },
+ },
+ },
+ elementOrder: [
+ {
+ elementId: 'oneElement',
+ paragraphElementType: ParagraphElementType.TEXT_RUN,
+ },
+ ],
+ },
+ },
+ },
+ blockElementOrder: ['twoParagraph'],
+ },
+ documentStyle: {
+ pageSize: {
+ width: Infinity,
+ height: Infinity,
+ },
+ marginTop: 0,
+ marginBottom: 0,
+ marginRight: 2,
+ marginLeft: 2,
+ },
+};
+
export class DocsView extends BaseView {
zIndex = 1;
@@ -20,52 +71,54 @@ export class DocsView extends BaseView {
const scene = this.getScene();
const context = this.getContext();
- const documentSkeleton = this._buildSkeleton();
-
- const documents = new Documents(DOCS_VIEW_KEY.MAIN, documentSkeleton);
- documents.zIndex = 1000;
- this._documentSkeleton = documentSkeleton;
- this._documents = documents;
-
- documentSkeleton.calculate();
-
- scene.addObjects([documents], 0);
-
const engine = scene.getEngine();
- if (engine) {
- const { width: engineWidth, height: engineHeight } = engine;
-
- const { width: docsWidth, height: docsHeight, pageMarginLeft, pageMarginTop } = documents;
-
- let docsLeft = 0;
- let docsTop = 0;
-
- let sceneWidth = 0;
-
- let sceneHeight = 0;
-
- if (engineWidth > docsWidth) {
- docsLeft = engineWidth / 2 - docsWidth / 2;
- sceneWidth = engineWidth - 30;
- } else {
- docsLeft = pageMarginLeft;
- sceneWidth = docsWidth + pageMarginLeft * 2;
- }
-
- if (engineHeight > docsHeight) {
- docsTop = engineHeight / 2 - docsHeight / 2;
- sceneHeight = engineHeight - 30;
- } else {
- docsTop = pageMarginTop;
- sceneHeight = docsHeight + pageMarginTop * 2;
- }
-
- scene.resize(sceneWidth, sceneHeight);
-
- documents.translate(docsLeft, docsTop);
+ if (!engine) {
+ return;
}
- documents.enableEditor();
+ const pageWidth = 1384;
+
+ const pageHeight = 500;
+
+ const { width: engineWidth, height: engineHeight } = engine;
+
+ const left = engineWidth / 2 - pageWidth / 2;
+
+ const top = engineHeight / 2 - pageHeight / 2;
+
+ const page = new Rect('canvas', {
+ left,
+ top,
+ width: pageWidth,
+ height: pageHeight,
+ strokeWidth: 1,
+ stroke: 'rgba(198,198,198, 1)',
+ fill: 'rgba(255,255,255, 1)',
+ zIndex: 3,
+ });
+
+ const picture = new Picture({
+ url: 'https://cnbabylon.com/assets/img/banner_doc_cnbabylon.jpg',
+ top: top + 68,
+ left,
+ width: 1384,
+ height: 432,
+ zIndex: 13,
+ isTransformer: true,
+ });
+
+ const richText = new RichText(this.getContext(), 'richText1', {
+ richText: richTextTest,
+ width: 420,
+ zIndex: 20,
+ left: engineWidth / 2 - 210,
+ top: top + 10,
+ isTransformer: true,
+ });
+
+ scene.openTransformer();
+
+ scene.addObjects([page, picture, richText]);
}
getDocumentSkeleton() {
diff --git a/packages/base-slides/src/View/Render/Views/index.ts b/packages/base-slides/src/View/Render/Views/index.ts
index 4fbca55477..6599f9ffaa 100644
--- a/packages/base-slides/src/View/Render/Views/index.ts
+++ b/packages/base-slides/src/View/Render/Views/index.ts
@@ -1,2 +1 @@
export * from './SlideView';
-export * from './PageView';
diff --git a/packages/base-slides/src/View/UI/SlideContainer/index.module.less b/packages/base-slides/src/View/UI/SlideContainer/index.module.less
index 7f106a557e..a31af51a3a 100644
--- a/packages/base-slides/src/View/UI/SlideContainer/index.module.less
+++ b/packages/base-slides/src/View/UI/SlideContainer/index.module.less
@@ -29,6 +29,7 @@
.content-inner-right-container {
width: 50%;
flex: 1;
+ background: rgb(240, 240, 240);
// position: relative;
}
}
diff --git a/packages/common-plugin-data/src/Sheets/DEFAULT_WORKBOOK_DATA.ts b/packages/common-plugin-data/src/Sheets/DEFAULT_WORKBOOK_DATA.ts
index 89805d28c1..a6e8a1be2a 100644
--- a/packages/common-plugin-data/src/Sheets/DEFAULT_WORKBOOK_DATA.ts
+++ b/packages/common-plugin-data/src/Sheets/DEFAULT_WORKBOOK_DATA.ts
@@ -12,8 +12,409 @@ import {
WrapStrategy,
SheetTypes,
Tools,
+ ObjectRelativeFromH,
+ ObjectRelativeFromV,
+ PositionedObjectLayoutType,
+ WrapTextType,
+ BulletAlignment,
+ GlyphType,
} from '@univer/core';
+const richTextTestFloat: IDocumentData = {
+ documentId: 'd',
+ drawings: {
+ shapeTest1: {
+ objectId: 'shapeTest1',
+ objectProperties: {
+ title: 'test shape',
+ description: 'test shape',
+ size: {
+ width: 100,
+ height: 400,
+ },
+ positionH: {
+ relativeFrom: ObjectRelativeFromH.COLUMN,
+ posOffset: 100,
+ },
+ positionV: {
+ relativeFrom: ObjectRelativeFromV.PARAGRAPH,
+ posOffset: 160,
+ },
+ angle: 0,
+ imageProperties: {
+ contentUrl: 'https://cnbabylon.com/assets/img/agents.png',
+ },
+ },
+ layoutType: PositionedObjectLayoutType.WRAP_SQUARE,
+ behindDoc: BooleanNumber.FALSE,
+ wrapText: WrapTextType.BOTH_SIDES,
+ },
+ },
+ lists: {
+ unorderedTest: {
+ listId: 'unorderedTest',
+ nestingLevel: [
+ {
+ bulletAlignment: BulletAlignment.START,
+ glyphFormat: ' %0',
+ textStyle: {
+ fs: 12,
+ },
+ startNumber: 0,
+ glyphSymbol: '\u25CF',
+ hanging: 21,
+ indentStart: 21,
+ },
+ {
+ bulletAlignment: BulletAlignment.START,
+ glyphFormat: ' %1',
+ textStyle: {
+ fs: 12,
+ },
+ startNumber: 0,
+ glyphSymbol: '\u25A0',
+ hanging: 21,
+ indentStart: 42,
+ },
+ {
+ bulletAlignment: BulletAlignment.START,
+ glyphFormat: ' %1',
+ textStyle: {
+ fs: 12,
+ },
+ startNumber: 0,
+ glyphSymbol: '\u25C6',
+ hanging: 21,
+ indentStart: 63,
+ },
+ ],
+ },
+ testBullet: {
+ listId: 'testBullet',
+ nestingLevel: [
+ {
+ bulletAlignment: BulletAlignment.START,
+ glyphFormat: ' %1.',
+ textStyle: {
+ fs: 12,
+ },
+ startNumber: 0,
+ glyphType: GlyphType.ROMAN,
+ hanging: 21,
+ indentStart: 21,
+ },
+ {
+ bulletAlignment: BulletAlignment.START,
+ glyphFormat: ' %1.%2)',
+ textStyle: {
+ fs: 12,
+ },
+ startNumber: 0,
+ glyphType: GlyphType.ROMAN,
+ hanging: 21,
+ indentStart: 42,
+ },
+ {
+ bulletAlignment: BulletAlignment.START,
+ glyphFormat: ' %1.%2.%3.',
+ textStyle: {
+ fs: 12,
+ },
+ startNumber: 0,
+ glyphType: GlyphType.ROMAN,
+ hanging: 21,
+ indentStart: 63,
+ },
+ ],
+ },
+ },
+ body: {
+ blockElements: {
+ oneParagraph: {
+ blockId: 'oneParagraph',
+ st: 0,
+ ed: 15,
+ blockType: BlockType.PARAGRAPH,
+ paragraph: {
+ bullet: {
+ listId: 'testBullet',
+ nestingLevel: 0,
+ textStyle: {
+ fs: 20,
+ },
+ },
+ elements: {
+ oneElement: {
+ eId: 'oneElement',
+ st: 0,
+ ed: 15,
+ et: ParagraphElementType.TEXT_RUN,
+ tr: {
+ ct: '在“第1题”工作表中完成以下操作',
+ ts: {
+ fs: 12,
+ bg: {
+ rgb: 'rgb(200,0,90)',
+ },
+ cl: {
+ rgb: 'rgb(255,130,0)',
+ },
+ },
+ },
+ },
+ smallSub: {
+ eId: 'smallSub',
+ st: 0,
+ ed: 15,
+ et: ParagraphElementType.TEXT_RUN,
+ tr: {
+ ct: '上标',
+ ts: {
+ fs: 14,
+ bg: {
+ rgb: 'rgb(2,128,2)',
+ },
+ cl: {
+ rgb: 'rgb(0,1,55)',
+ },
+ va: BaselineOffset.SUPERSCRIPT,
+ },
+ },
+ },
+ twoElement: {
+ eId: 'twoElement',
+ st: 0,
+ ed: 15,
+ et: ParagraphElementType.TEXT_RUN,
+ tr: {
+ ct: '日期列单元格数据验证,限制只能输入日期(介于1949年1月1日至2099年1月1日)',
+ ts: {
+ fs: 14,
+ bg: {
+ rgb: 'rgb(90,128,255)',
+ },
+ cl: {
+ rgb: 'rgb(0,1,255)',
+ },
+ },
+ },
+ },
+ },
+ elementOrder: [
+ {
+ elementId: 'oneElement',
+ paragraphElementType: ParagraphElementType.TEXT_RUN,
+ },
+ {
+ elementId: 'shapeTest1',
+ paragraphElementType: ParagraphElementType.DRAWING,
+ },
+ {
+ elementId: 'smallSub',
+ paragraphElementType: ParagraphElementType.TEXT_RUN,
+ },
+ {
+ elementId: 'twoElement',
+ paragraphElementType: ParagraphElementType.TEXT_RUN,
+ },
+ ],
+ },
+ },
+ twoParagraph: {
+ blockId: 'twoParagraph',
+ st: 0,
+ ed: 15,
+ blockType: BlockType.PARAGRAPH,
+ paragraph: {
+ bullet: {
+ listId: 'testBullet',
+ nestingLevel: 1,
+ textStyle: {
+ fs: 20,
+ },
+ },
+ elements: {
+ oneElement: {
+ eId: 'oneElement',
+ st: 0,
+ ed: 15,
+ et: ParagraphElementType.TEXT_RUN,
+ tr: {
+ ct: '细化埋点上报链路和指标方案梳理',
+ },
+ },
+ twoElement: {
+ eId: 'twoElement',
+ st: 0,
+ ed: 15,
+ et: ParagraphElementType.TEXT_RUN,
+ tr: {
+ ct: '目前通过每日定时任务发送报告',
+ },
+ },
+ },
+ elementOrder: [
+ {
+ elementId: 'oneElement',
+ paragraphElementType: ParagraphElementType.TEXT_RUN,
+ },
+ {
+ elementId: 'twoElement',
+ paragraphElementType: ParagraphElementType.TEXT_RUN,
+ },
+ ],
+ },
+ },
+ threeParagraph: {
+ blockId: 'threeParagraph',
+ st: 0,
+ ed: 15,
+ blockType: BlockType.PARAGRAPH,
+ paragraph: {
+ bullet: {
+ listId: 'testBullet',
+ nestingLevel: 0,
+ textStyle: {
+ fs: 20,
+ },
+ },
+ elements: {
+ oneElement: {
+ eId: 'oneElement',
+ st: 0,
+ ed: 15,
+ et: ParagraphElementType.TEXT_RUN,
+ tr: {
+ ct: '自2018年首届进博会举办以来,进博会已经成为全球新品的首发地、前沿技术的首选地、创新服务的首推地。',
+ },
+ },
+ twoElement: {
+ eId: 'twoElement',
+ st: 0,
+ ed: 15,
+ et: ParagraphElementType.TEXT_RUN,
+ tr: {
+ ct: '中国这十年”对外开放成就展湖北展区主要以图文、图表、数据、视频、企业展品、实物模型、光电科技等体现湖北十年开放成就、重大开放平台及产业。湖北省共计17家企业、机构的展品将在这一展区展示',
+ },
+ },
+ },
+ elementOrder: [
+ {
+ elementId: 'oneElement',
+ paragraphElementType: ParagraphElementType.TEXT_RUN,
+ },
+ {
+ elementId: 'twoElement',
+ paragraphElementType: ParagraphElementType.TEXT_RUN,
+ },
+ ],
+ },
+ },
+ fourParagraph: {
+ blockId: 'fourParagraph',
+ st: 0,
+ ed: 15,
+ blockType: BlockType.PARAGRAPH,
+ paragraph: {
+ bullet: {
+ listId: 'testBullet',
+ nestingLevel: 1,
+ textStyle: {
+ fs: 20,
+ },
+ },
+ elements: {
+ oneElement: {
+ eId: 'oneElement',
+ st: 0,
+ ed: 15,
+ et: ParagraphElementType.TEXT_RUN,
+ tr: {
+ ct: '国家主席习近平以视频方式出席在上海举行的第五届中国国际进口博览会开幕式并发表题为《共创开放繁荣的美好未来》的致辞',
+ },
+ },
+ twoElement: {
+ eId: 'twoElement',
+ st: 0,
+ ed: 15,
+ et: ParagraphElementType.TEXT_RUN,
+ tr: {
+ ct: '中国将推动各国各方共享深化国际合作机遇,全面深入参与世界贸易组织改革谈判',
+ },
+ },
+ },
+ elementOrder: [
+ {
+ elementId: 'oneElement',
+ paragraphElementType: ParagraphElementType.TEXT_RUN,
+ },
+ {
+ elementId: 'twoElement',
+ paragraphElementType: ParagraphElementType.TEXT_RUN,
+ },
+ ],
+ },
+ },
+ fiveParagraph: {
+ blockId: 'fiveParagraph',
+ st: 0,
+ ed: 15,
+ blockType: BlockType.PARAGRAPH,
+ paragraph: {
+ bullet: {
+ listId: 'testBullet',
+ nestingLevel: 2,
+ textStyle: {
+ fs: 20,
+ },
+ },
+ elements: {
+ oneElement: {
+ eId: 'oneElement',
+ st: 0,
+ ed: 15,
+ et: ParagraphElementType.TEXT_RUN,
+ tr: {
+ ct: '中国男排两名现役国手彭世坤和张秉龙分别效力的三得利太阳鸟和东京大熊本轮遭遇。',
+ },
+ },
+ twoElement: {
+ eId: 'twoElement',
+ st: 0,
+ ed: 15,
+ et: ParagraphElementType.TEXT_RUN,
+ tr: {
+ ct: '双方经过激战,主场作战的卫冕冠军三得利技高一筹3-2逆转击败对手,力夺第3场胜利',
+ },
+ },
+ },
+ elementOrder: [
+ {
+ elementId: 'oneElement',
+ paragraphElementType: ParagraphElementType.TEXT_RUN,
+ },
+ {
+ elementId: 'twoElement',
+ paragraphElementType: ParagraphElementType.TEXT_RUN,
+ },
+ ],
+ },
+ },
+ },
+ blockElementOrder: ['oneParagraph', 'twoParagraph', 'threeParagraph', 'fourParagraph', 'fiveParagraph'],
+ },
+ documentStyle: {
+ pageSize: {
+ width: Infinity,
+ height: Infinity,
+ },
+ marginTop: 0,
+ marginBottom: 0,
+ marginRight: 2,
+ marginLeft: 2,
+ },
+};
+
const richTextTest: IDocumentData = {
documentId: 'd',
body: {
@@ -219,6 +620,9 @@ export const DEFAULT_WORKBOOK_DATA: IWorkbookConfig = {
rgb: 'rgb(0, 0, 255)',
},
},
+ '5': {
+ tb: WrapStrategy.WRAP,
+ },
},
timeZone: 'GMT+8',
createdTime: '2021-11-28 12:10:10',
@@ -348,6 +752,12 @@ export const DEFAULT_WORKBOOK_DATA: IWorkbookConfig = {
s: '4',
},
},
+ '32': {
+ '3': {
+ p: richTextTestFloat,
+ s: '5',
+ },
+ },
},
name: 'sheet1',
tabColor: 'red',
@@ -404,6 +814,12 @@ export const DEFAULT_WORKBOOK_DATA: IWorkbookConfig = {
startColumn: 9,
endColumn: 10,
},
+ {
+ startRow: 32,
+ endRow: 53,
+ startColumn: 3,
+ endColumn: 5,
+ },
],
rowData: {
'3': {