@univerjs-pro/shape-editor-ui 1.0.0-alpha.6 → 1.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/formula-shape-en-us-B0fVf3OO.js +1 -0
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/locale/ar-SA.js +1 -1
- package/lib/cjs/locale/ca-ES.js +1 -1
- package/lib/cjs/locale/de-DE.js +1 -1
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/es-ES.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/id-ID.js +1 -1
- package/lib/cjs/locale/it-IT.js +1 -1
- package/lib/cjs/locale/ja-JP.js +1 -1
- package/lib/cjs/locale/ko-KR.js +1 -1
- package/lib/cjs/locale/pl-PL.js +1 -1
- package/lib/cjs/locale/pt-BR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/sk-SK.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-HK.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/formula-shape-en-us-BbvC914f.js +1 -0
- package/lib/es/index.js +1 -1
- package/lib/es/locale/ar-SA.js +1 -1
- package/lib/es/locale/ca-ES.js +1 -1
- package/lib/es/locale/de-DE.js +1 -1
- package/lib/es/locale/en-US.js +1 -1
- package/lib/es/locale/es-ES.js +1 -1
- package/lib/es/locale/fa-IR.js +1 -1
- package/lib/es/locale/fr-FR.js +1 -1
- package/lib/es/locale/id-ID.js +1 -1
- package/lib/es/locale/it-IT.js +1 -1
- package/lib/es/locale/ja-JP.js +1 -1
- package/lib/es/locale/ko-KR.js +1 -1
- package/lib/es/locale/pl-PL.js +1 -1
- package/lib/es/locale/pt-BR.js +1 -1
- package/lib/es/locale/ru-RU.js +1 -1
- package/lib/es/locale/sk-SK.js +1 -1
- package/lib/es/locale/vi-VN.js +1 -1
- package/lib/es/locale/zh-CN.js +1 -1
- package/lib/es/locale/zh-HK.js +1 -1
- package/lib/es/locale/zh-TW.js +1 -1
- package/lib/formula-shape-en-us-BbvC914f.js +1 -0
- package/lib/index.css +134 -0
- package/lib/index.js +1 -1
- package/lib/locale/ar-SA.js +1 -1
- package/lib/locale/ca-ES.js +1 -1
- package/lib/locale/de-DE.js +1 -1
- package/lib/locale/en-US.js +1 -1
- package/lib/locale/es-ES.js +1 -1
- package/lib/locale/fa-IR.js +1 -1
- package/lib/locale/fr-FR.js +1 -1
- package/lib/locale/id-ID.js +1 -1
- package/lib/locale/it-IT.js +1 -1
- package/lib/locale/ja-JP.js +1 -1
- package/lib/locale/ko-KR.js +1 -1
- package/lib/locale/pl-PL.js +1 -1
- package/lib/locale/pt-BR.js +1 -1
- package/lib/locale/ru-RU.js +1 -1
- package/lib/locale/sk-SK.js +1 -1
- package/lib/locale/vi-VN.js +1 -1
- package/lib/locale/zh-CN.js +1 -1
- package/lib/locale/zh-HK.js +1 -1
- package/lib/locale/zh-TW.js +1 -1
- package/lib/types/common/formula-shape-en-us.d.ts +44 -0
- package/lib/types/config/config.d.ts +20 -0
- package/lib/types/index.d.ts +9 -1
- package/lib/types/locale/en-US.d.ts +44 -0
- package/lib/types/services/shape-formula-editor.d.ts +20 -0
- package/lib/types/services/shape-formula-reference.d.ts +15 -0
- package/lib/types/services/shape-formula-unit-viewer.service.d.ts +67 -0
- package/lib/types/views/formula-shape/FormulaShapeNumberFormat.d.ts +23 -0
- package/lib/types/views/formula-shape/UseFormulaShapeToolbar.d.ts +13 -0
- package/lib/types/views/formula-shape/formula-shape-animation.d.ts +33 -0
- package/lib/types/views/formula-shape/formula-shape-auto-fit.d.ts +15 -0
- package/lib/types/views/formula-shape/formula-shape-number-format-utils.d.ts +17 -0
- package/lib/types/views/shape-floating-toolbar/ShapeFloatingToolbar.d.ts +13 -1
- package/lib/types/views/shape-text-editor/shape-text-behavior.d.ts +0 -3
- package/lib/types/views/shape-text-editor/shape-text-placeholder.d.ts +1 -0
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +25 -11
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare const formulaShapeEnUS: {
|
|
2
|
+
panelTitle: string;
|
|
3
|
+
editFormula: string;
|
|
4
|
+
numberFormat: string;
|
|
5
|
+
moreFormats: string;
|
|
6
|
+
customFormatPlaceholder: string;
|
|
7
|
+
formatTypes: string;
|
|
8
|
+
decimalPlaces: string;
|
|
9
|
+
currencySymbol: string;
|
|
10
|
+
negativeNumberType: string;
|
|
11
|
+
dateType: string;
|
|
12
|
+
preview: string;
|
|
13
|
+
generalDescription: string;
|
|
14
|
+
accountingDescription: string;
|
|
15
|
+
currencyDescription: string;
|
|
16
|
+
dateDescription: string;
|
|
17
|
+
numberDescription: string;
|
|
18
|
+
customFormatDescription: string;
|
|
19
|
+
formulaPlaceholder: string;
|
|
20
|
+
sheetUnit: string;
|
|
21
|
+
baseUnit: string;
|
|
22
|
+
confirm: string;
|
|
23
|
+
cancel: string;
|
|
24
|
+
animation: string;
|
|
25
|
+
formats: {
|
|
26
|
+
general: string;
|
|
27
|
+
text: string;
|
|
28
|
+
number: string;
|
|
29
|
+
percent: string;
|
|
30
|
+
percentage: string;
|
|
31
|
+
scientific: string;
|
|
32
|
+
accounting: string;
|
|
33
|
+
financial: string;
|
|
34
|
+
currency: string;
|
|
35
|
+
roundingCurrency: string;
|
|
36
|
+
date: string;
|
|
37
|
+
time: string;
|
|
38
|
+
dateTime: string;
|
|
39
|
+
durationTime: string;
|
|
40
|
+
thousandSeparator: string;
|
|
41
|
+
custom: string;
|
|
42
|
+
more: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -1,5 +1,25 @@
|
|
|
1
|
+
import type { IBaseSnapshot, IWorkbookData, UniverInstanceType } from '@univerjs/core';
|
|
1
2
|
export declare const SHAPE_EDITOR_UI_PLUGIN_CONFIG_KEY = "shape-editor-ui.config";
|
|
2
3
|
export declare const configSymbol: unique symbol;
|
|
4
|
+
export type ShapeFormulaUnitType = UniverInstanceType.UNIVER_SHEET | UniverInstanceType.UNIVER_BASE;
|
|
5
|
+
interface IShapeFormulaUnitResourceBase {
|
|
6
|
+
unitId: string;
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
|
9
|
+
export type IShapeFormulaUnitResource = IShapeFormulaUnitResourceBase & ({
|
|
10
|
+
type: UniverInstanceType.UNIVER_SHEET;
|
|
11
|
+
loadSnapshot: () => Promise<IWorkbookData>;
|
|
12
|
+
} | {
|
|
13
|
+
type: UniverInstanceType.UNIVER_BASE;
|
|
14
|
+
loadSnapshot: () => Promise<IBaseSnapshot>;
|
|
15
|
+
});
|
|
16
|
+
/** Supplies remote units that are visible to the current user. Loaded units are included automatically. */
|
|
17
|
+
export interface IShapeFormulaUnitProvider {
|
|
18
|
+
listUnits: () => Promise<IShapeFormulaUnitResource[]>;
|
|
19
|
+
}
|
|
3
20
|
export interface IUniverShapeEditorUIConfig {
|
|
21
|
+
formulaUnitProvider?: IShapeFormulaUnitProvider;
|
|
22
|
+
formulaViewerWorkerURL?: string | Worker;
|
|
4
23
|
}
|
|
5
24
|
export declare const defaultPluginConfig: IUniverShapeEditorUIConfig;
|
|
25
|
+
export {};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import './global.css';
|
|
2
2
|
export { FillStyleTabsEditor } from './components/fill-style-tabs-editor/FillStyleTabsEditor';
|
|
3
|
+
export { SHAPE_EDITOR_UI_PLUGIN_CONFIG_KEY } from './config/config';
|
|
4
|
+
export type { IShapeFormulaUnitProvider, IShapeFormulaUnitResource, IUniverShapeEditorUIConfig, ShapeFormulaUnitType, } from './config/config';
|
|
3
5
|
export { UniverShapeEditorUIPlugin } from './plugin';
|
|
6
|
+
export { ShapeFormulaUnitViewerService } from './services/shape-formula-unit-viewer.service';
|
|
7
|
+
export type { ShapeFormulaViewerUnit } from './services/shape-formula-unit-viewer.service';
|
|
4
8
|
export { activateDrawingObject, clearActiveDrawingObjects } from './utils/activate-drawing-object';
|
|
5
9
|
export { SHAPE_FLOATING_TOOLBAR_TOP_OFFSET, SHEET_DOC_SHAPE_FLOATING_TOOLBAR_TOP_OFFSET } from './utils/shape-floating-toolbar-config';
|
|
6
10
|
export { SHAPE_EDITOR_TRANSFORMER_CONFIG } from './utils/shape-transformer-config';
|
|
7
11
|
export { getTextModel, getTextStyle, normalizeShapeTextModel } from './utils/util';
|
|
12
|
+
export { drawFormulaShapeAnimationLayers, FormulaShapeAnimationController, } from './views/formula-shape/formula-shape-animation';
|
|
13
|
+
export type { IFormulaShapeAnimationLayer } from './views/formula-shape/formula-shape-animation';
|
|
14
|
+
export { resolveFormulaShapeAutoFitSize } from './views/formula-shape/formula-shape-auto-fit';
|
|
15
|
+
export { useFormulaShapeToolbar } from './views/formula-shape/UseFormulaShapeToolbar';
|
|
8
16
|
export { ShapeEditPanel } from './views/shape-editor-panel/ShapeEditorPanel';
|
|
9
17
|
export { getInitialShapeFillType, ShapeFillEditor, } from './views/shape-editor-panel/ShapeFillEditor';
|
|
10
18
|
export { ShapeImageFillEditor } from './views/shape-editor-panel/ShapeImageFillEditor';
|
|
@@ -18,7 +26,7 @@ export { ShapePickerDropdown, ShapePickerPanel } from './views/shape-picker/Shap
|
|
|
18
26
|
export { ShapeGroupEnum, shapeTypeOptions } from './views/shape-picker/shapes';
|
|
19
27
|
export type { ShapeTypeOption } from './views/shape-picker/shapes';
|
|
20
28
|
export { DocParagraphTypeDropdown } from './views/shape-text-editor/DocParagraphTypeDropdown';
|
|
21
|
-
export {
|
|
29
|
+
export { resolveShapeTextEditorBehaviorShapeData, resolveShapeTextEditorFlowAxis, resolveShapeTextEditorWrapStrategy, shouldAllowShapeTextEditorHostSizeShrink, shouldAutoFitShapeTextEditorNoWrap, shouldClipShapeTextDocument, } from './views/shape-text-editor/shape-text-behavior';
|
|
22
30
|
export type { ShapeTextFlowAxis } from './views/shape-text-editor/shape-text-behavior';
|
|
23
31
|
export { plainShapeTextToDocumentData, prepareShapeTextDocumentData, resolveShapeTextDocumentAlignment, resolveShapeTextDocumentPageHeight, stripShapeTextDocumentLayout, } from './views/shape-text-editor/shape-text-document';
|
|
24
32
|
export { SHAPE_TEXT_EDITOR_QUOTE_COMMAND_ID } from './views/shape-text-editor/shape-text-editor-commands';
|
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
declare const locale: {
|
|
2
2
|
'shape-editor-ui': {
|
|
3
3
|
title: string;
|
|
4
|
+
formulaShape: {
|
|
5
|
+
panelTitle: string;
|
|
6
|
+
editFormula: string;
|
|
7
|
+
numberFormat: string;
|
|
8
|
+
moreFormats: string;
|
|
9
|
+
customFormatPlaceholder: string;
|
|
10
|
+
formatTypes: string;
|
|
11
|
+
decimalPlaces: string;
|
|
12
|
+
currencySymbol: string;
|
|
13
|
+
negativeNumberType: string;
|
|
14
|
+
dateType: string;
|
|
15
|
+
preview: string;
|
|
16
|
+
generalDescription: string;
|
|
17
|
+
accountingDescription: string;
|
|
18
|
+
currencyDescription: string;
|
|
19
|
+
dateDescription: string;
|
|
20
|
+
numberDescription: string;
|
|
21
|
+
customFormatDescription: string;
|
|
22
|
+
formulaPlaceholder: string;
|
|
23
|
+
sheetUnit: string;
|
|
24
|
+
baseUnit: string;
|
|
25
|
+
confirm: string;
|
|
26
|
+
cancel: string;
|
|
27
|
+
animation: string;
|
|
28
|
+
formats: {
|
|
29
|
+
general: string;
|
|
30
|
+
text: string;
|
|
31
|
+
number: string;
|
|
32
|
+
percent: string;
|
|
33
|
+
percentage: string;
|
|
34
|
+
scientific: string;
|
|
35
|
+
accounting: string;
|
|
36
|
+
financial: string;
|
|
37
|
+
currency: string;
|
|
38
|
+
roundingCurrency: string;
|
|
39
|
+
date: string;
|
|
40
|
+
time: string;
|
|
41
|
+
dateTime: string;
|
|
42
|
+
durationTime: string;
|
|
43
|
+
thousandSeparator: string;
|
|
44
|
+
custom: string;
|
|
45
|
+
more: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
4
48
|
insertShape: string;
|
|
5
49
|
openPanel: string;
|
|
6
50
|
deleteShape: string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { FormulaSequenceNode, IFormulaRefSelection } from '@univerjs/formula-ui';
|
|
2
|
+
export interface IShapeFormulaReferenceSelectionChange {
|
|
3
|
+
references: string[];
|
|
4
|
+
visibleReferenceIndexes: number[];
|
|
5
|
+
activeReferenceIndex?: number;
|
|
6
|
+
isCtrlAddMode: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface IShapeFormulaReferenceEditResult {
|
|
9
|
+
formula: string;
|
|
10
|
+
selectionStart: number;
|
|
11
|
+
selectionEnd: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function applyShapeFormulaReferenceSelection(options: {
|
|
14
|
+
formula: string;
|
|
15
|
+
sequenceNodes: FormulaSequenceNode[];
|
|
16
|
+
referenceSelections?: IFormulaRefSelection[];
|
|
17
|
+
selectionStart: number;
|
|
18
|
+
selectionEnd: number;
|
|
19
|
+
change: IShapeFormulaReferenceSelectionChange;
|
|
20
|
+
}): IShapeFormulaReferenceEditResult | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IShapeFormulaIdentity } from '@univerjs-pro/shape-editor';
|
|
2
|
+
import type { IBaseSnapshot, IRange, Workbook, Worksheet } from '@univerjs/core';
|
|
3
|
+
export declare function buildSheetShapeFormulaReference(options: {
|
|
4
|
+
host: IShapeFormulaIdentity;
|
|
5
|
+
range: IRange;
|
|
6
|
+
workbook: Workbook;
|
|
7
|
+
worksheet: Worksheet;
|
|
8
|
+
}): string;
|
|
9
|
+
export declare function buildBaseShapeFormulaReference(options: {
|
|
10
|
+
fieldIds: string[];
|
|
11
|
+
hostUnitId: string;
|
|
12
|
+
snapshot: IBaseSnapshot;
|
|
13
|
+
sourceUnitId: string;
|
|
14
|
+
tableId: string;
|
|
15
|
+
}): string | null;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { IShapeFormulaIdentity } from '@univerjs-pro/shape-editor';
|
|
2
|
+
import type { BaseDataModel } from '@univerjs/core';
|
|
3
|
+
import type { FormulaSequenceNode, IFormulaRefSelection } from '@univerjs/formula-ui';
|
|
4
|
+
import type { IShapeFormulaUnitResource } from '../config/config';
|
|
5
|
+
import type { IShapeFormulaReferenceSelectionChange } from './shape-formula-editor';
|
|
6
|
+
import { Disposable, IConfigService, IUniverInstanceService, LocaleService, ThemeService, Workbook } from '@univerjs/core';
|
|
7
|
+
export type ShapeFormulaViewerUnit = Workbook | BaseDataModel;
|
|
8
|
+
export interface IShapeFormulaViewerFormulaContext {
|
|
9
|
+
formula: string;
|
|
10
|
+
sequenceNodes: FormulaSequenceNode[];
|
|
11
|
+
refSelections: IFormulaRefSelection[];
|
|
12
|
+
selectionStart: number;
|
|
13
|
+
selectionEnd: number;
|
|
14
|
+
}
|
|
15
|
+
/** Owns the real, isolated Univer rendered inside the cross-unit formula editor. */
|
|
16
|
+
export declare class ShapeFormulaUnitViewerService extends Disposable {
|
|
17
|
+
private readonly _configService;
|
|
18
|
+
private readonly _instanceService;
|
|
19
|
+
private readonly _localeService;
|
|
20
|
+
private readonly _themeService;
|
|
21
|
+
private _univer;
|
|
22
|
+
private _activeUnitId;
|
|
23
|
+
private _container;
|
|
24
|
+
private _generation;
|
|
25
|
+
private _selectionDisposables;
|
|
26
|
+
private _formulaContext;
|
|
27
|
+
private _host;
|
|
28
|
+
private _resource;
|
|
29
|
+
private _onSelectReferences;
|
|
30
|
+
private _activeWorkbook;
|
|
31
|
+
private _activeBase;
|
|
32
|
+
private _visibleReferenceIndexes;
|
|
33
|
+
private _isApplyingBaseHighlight;
|
|
34
|
+
private _pointerCtrlKey;
|
|
35
|
+
private _pointerListener;
|
|
36
|
+
private _selectionChangingDisposable;
|
|
37
|
+
private _controlDisposables;
|
|
38
|
+
private _isDraggingFormulaSelection;
|
|
39
|
+
private _closeRequest;
|
|
40
|
+
constructor(_configService: IConfigService, _instanceService: IUniverInstanceService, _localeService: LocaleService, _themeService: ThemeService);
|
|
41
|
+
listUnits(): Promise<IShapeFormulaUnitResource[]>;
|
|
42
|
+
mount(container: HTMLElement): void;
|
|
43
|
+
switchUnit(resource: IShapeFormulaUnitResource, host: IShapeFormulaIdentity, onSelectReferences: (change: IShapeFormulaReferenceSelectionChange) => void): Promise<ShapeFormulaViewerUnit | null>;
|
|
44
|
+
private _makeBaseSnapshotReadOnly;
|
|
45
|
+
private _setBasePermissionsReadOnly;
|
|
46
|
+
updateFormulaContext(context: IShapeFormulaViewerFormulaContext): void;
|
|
47
|
+
close(): void;
|
|
48
|
+
/** Defers nested Univer disposal until the owning React tree has finished unmounting. */
|
|
49
|
+
scheduleClose(): void;
|
|
50
|
+
private _closeNow;
|
|
51
|
+
dispose(): void;
|
|
52
|
+
private _createUniver;
|
|
53
|
+
private _observeSheetSelection;
|
|
54
|
+
private _observeBaseSelection;
|
|
55
|
+
private _handleBaseSelectionChange;
|
|
56
|
+
private _getBaseReferenceSource;
|
|
57
|
+
private _emitSheetSelectionChange;
|
|
58
|
+
private _refreshFormulaSelections;
|
|
59
|
+
private _refreshSheetFormulaSelections;
|
|
60
|
+
private _refreshBaseFormulaSelection;
|
|
61
|
+
private _bindFormulaSelectionControls;
|
|
62
|
+
private _getEditingContext;
|
|
63
|
+
private _canSelectFormulaReference;
|
|
64
|
+
private _matchesSheetReference;
|
|
65
|
+
private _matchesUnitQualifier;
|
|
66
|
+
private _listLoadedUnits;
|
|
67
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type FormulaShapeNumberFormatType = 'general' | 'accounting' | 'currency' | 'date' | 'number' | 'custom';
|
|
2
|
+
export type FormulaShapeNumberFormatMenuEntry = {
|
|
3
|
+
kind: 'format';
|
|
4
|
+
key: string;
|
|
5
|
+
pattern: string;
|
|
6
|
+
} | {
|
|
7
|
+
kind: 'separator';
|
|
8
|
+
key: string;
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'more';
|
|
11
|
+
};
|
|
12
|
+
export declare function createFormulaShapeNumberFormatMenuEntries(currencySymbol: string): FormulaShapeNumberFormatMenuEntry[];
|
|
13
|
+
export declare function resolveFormulaShapeNumberFormatType(pattern: string): FormulaShapeNumberFormatType;
|
|
14
|
+
export declare function FormulaShapeNumberFormatMenu(props: {
|
|
15
|
+
onSelect: (pattern: string) => void;
|
|
16
|
+
onMore: () => void;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
18
|
+
export declare function FormulaShapeNumberFormatDialog(props: {
|
|
19
|
+
open: boolean;
|
|
20
|
+
pattern: string;
|
|
21
|
+
onClose: () => void;
|
|
22
|
+
onConfirm: (pattern: string) => void;
|
|
23
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IShapeData, IShapeFormulaBinding } from '@univerjs-pro/engine-shape';
|
|
2
|
+
import type { IShapeFormulaIdentity } from '@univerjs-pro/shape-editor';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import type { IShapeFloatingToolbarExtensionGroup } from '../shape-floating-toolbar/ShapeFloatingToolbar';
|
|
5
|
+
interface IUseFormulaShapeToolbarOptions extends IShapeFormulaIdentity {
|
|
6
|
+
shapeData?: IShapeData;
|
|
7
|
+
onUpdateBinding: (binding: IShapeFormulaBinding) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function useFormulaShapeToolbar(options: IUseFormulaShapeToolbarOptions): {
|
|
10
|
+
extensionGroups?: IShapeFloatingToolbarExtensionGroup[];
|
|
11
|
+
panel: ReactNode;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { IShapeFormulaPresentation } from '@univerjs-pro/shape-editor';
|
|
2
|
+
import type { UniverRenderingContext } from '@univerjs/engine-render';
|
|
3
|
+
export declare const FORMULA_SHAPE_ANIMATION_DURATION = 360;
|
|
4
|
+
export declare const FORMULA_SHAPE_TEXT_FLOAT_DISTANCE = 8;
|
|
5
|
+
export interface IFormulaShapeAnimationLayer {
|
|
6
|
+
key: 'current' | 'previous';
|
|
7
|
+
offsetY: number;
|
|
8
|
+
opacity: number;
|
|
9
|
+
presentation: IShapeFormulaPresentation | undefined;
|
|
10
|
+
}
|
|
11
|
+
export declare function resolveFormulaShapeAnimationLayers(previous: IShapeFormulaPresentation | undefined, current: IShapeFormulaPresentation | undefined, progress: number): IFormulaShapeAnimationLayer[];
|
|
12
|
+
export declare class FormulaShapeAnimationController {
|
|
13
|
+
private readonly _makeDirty;
|
|
14
|
+
private readonly _onAnimationCompleted;
|
|
15
|
+
private _current;
|
|
16
|
+
private _previous;
|
|
17
|
+
private _lastResolved;
|
|
18
|
+
private _progress;
|
|
19
|
+
private _startedAt;
|
|
20
|
+
private _frameId;
|
|
21
|
+
constructor(_makeDirty: () => void, _onAnimationCompleted?: () => void);
|
|
22
|
+
setPresentation(presentation: IShapeFormulaPresentation | undefined, animate?: boolean): void;
|
|
23
|
+
getLayers(): IFormulaShapeAnimationLayer[];
|
|
24
|
+
/**
|
|
25
|
+
* Returns the resolved presentations whose text must fit inside the shape while an animation is active.
|
|
26
|
+
* Keeping both endpoints prevents either the outgoing or incoming value from overflowing the transformer.
|
|
27
|
+
*/
|
|
28
|
+
getAutoFitPresentations(): IShapeFormulaPresentation[];
|
|
29
|
+
dispose(): void;
|
|
30
|
+
private readonly _tick;
|
|
31
|
+
private _cancelFrame;
|
|
32
|
+
}
|
|
33
|
+
export declare function drawFormulaShapeAnimationLayers(ctx: UniverRenderingContext, controller: FormulaShapeAnimationController, draw: (ctx: UniverRenderingContext, presentation: IShapeFormulaPresentation | undefined, layerKey: IFormulaShapeAnimationLayer['key']) => void): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IShapeData, IShapeRect } from '@univerjs-pro/engine-shape';
|
|
2
|
+
import type { IDocumentData } from '@univerjs/core';
|
|
3
|
+
export interface IFormulaShapeAutoFitSize {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}
|
|
7
|
+
/** Resolves the runtime size implied by the standard OOXML shape-text auto-fit properties. */
|
|
8
|
+
export declare function resolveFormulaShapeAutoFitSize(options: {
|
|
9
|
+
documentData: IDocumentData | readonly IDocumentData[];
|
|
10
|
+
height: number;
|
|
11
|
+
shapeData: IShapeData;
|
|
12
|
+
textRect: IShapeRect;
|
|
13
|
+
width: number;
|
|
14
|
+
widthBuffer?: number;
|
|
15
|
+
}): IFormulaShapeAutoFitSize | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare function getFormulaShapeCurrencyType(pattern: string): string | undefined;
|
|
2
|
+
export declare function getFormulaShapeDecimalFromPattern(pattern: string, defaultValue?: number): number;
|
|
3
|
+
export declare function setFormulaShapePatternDecimal(patterns: string, decimalLength: number): string;
|
|
4
|
+
export declare function getFormulaShapeCurrencyFormatOptions(symbol: string): {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
color: string | undefined;
|
|
8
|
+
}[];
|
|
9
|
+
export declare function getFormulaShapeDateFormatOptions(): {
|
|
10
|
+
label: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}[];
|
|
13
|
+
export declare function getFormulaShapeNumberFormatOptions(): {
|
|
14
|
+
label: string;
|
|
15
|
+
value: string;
|
|
16
|
+
color: string | undefined;
|
|
17
|
+
}[];
|
|
@@ -65,12 +65,15 @@ export interface IShapeFloatingToolbarProps {
|
|
|
65
65
|
defaultStrokeColor?: string;
|
|
66
66
|
onUpdateShapeData: (oldShapeJSON: {
|
|
67
67
|
oldShapeData?: IShapeData;
|
|
68
|
-
}, shapeData?: IShapeData) => void;
|
|
68
|
+
}, shapeData?: IShapeData, patch?: IShapeData) => void;
|
|
69
69
|
onUpdateText: (params: IShapeTextUpdateOptions) => void;
|
|
70
70
|
onUpdateWrappingStyle?: (value: IShapeFloatingToolbarWrappingStyle) => void;
|
|
71
71
|
groupAction?: IShapeFloatingToolbarGroupAction;
|
|
72
72
|
layerActions?: IShapeFloatingToolbarLayerActions;
|
|
73
73
|
extensionGroups?: IShapeFloatingToolbarExtensionGroup[];
|
|
74
|
+
collapseLabel?: string;
|
|
75
|
+
expandLabel?: string;
|
|
76
|
+
deleteLabel?: string;
|
|
74
77
|
onOpenPanel?: () => void;
|
|
75
78
|
onDelete?: () => void;
|
|
76
79
|
}
|
|
@@ -93,6 +96,7 @@ export declare function ShapeFloatingToolbarButton(props: {
|
|
|
93
96
|
children: ReactNode;
|
|
94
97
|
className?: string;
|
|
95
98
|
sizeClassName?: string;
|
|
99
|
+
tooltipVisible?: boolean;
|
|
96
100
|
ariaExpanded?: boolean;
|
|
97
101
|
onClick?: () => void;
|
|
98
102
|
onMouseDown?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
@@ -115,6 +119,10 @@ export declare function ShapeFloatingToolbarFontSizeSelect(props: {
|
|
|
115
119
|
onAfterChange?: () => void;
|
|
116
120
|
}): import("react").JSX.Element;
|
|
117
121
|
export type ShapeStrokePanelMode = 'none' | 'solid' | 'dash' | 'dot';
|
|
122
|
+
export declare function buildShapeStrokeDataUpdate(currentStroke: IShapeData['stroke'], resolvedStroke: NonNullable<IShapeData['stroke']>, partial: Partial<NonNullable<IShapeData['stroke']>>): {
|
|
123
|
+
nextShapeData: IShapeData;
|
|
124
|
+
patch: IShapeData;
|
|
125
|
+
};
|
|
118
126
|
export interface IShapeStrokePanelContentProps {
|
|
119
127
|
titleKey: string;
|
|
120
128
|
shapeData: IShapeData;
|
|
@@ -136,18 +144,22 @@ export declare function ShapeStrokePanelContent(props: IShapeStrokePanelContentP
|
|
|
136
144
|
export declare function ShapeStrokePanelButton(props: {
|
|
137
145
|
titleKey: string;
|
|
138
146
|
shapeData: IShapeData;
|
|
147
|
+
open?: boolean;
|
|
139
148
|
disabled?: boolean;
|
|
140
149
|
resetLabelKey?: string;
|
|
141
150
|
fallbackColor?: string;
|
|
142
151
|
onReset?: () => void;
|
|
152
|
+
onOpenChange?: (open: boolean) => void;
|
|
143
153
|
onUpdateShapeData: IShapeFloatingToolbarProps['onUpdateShapeData'];
|
|
144
154
|
}): import("react").JSX.Element;
|
|
145
155
|
export declare function ShapeFillButton(props: {
|
|
146
156
|
titleKey: string;
|
|
147
157
|
shapeData: IShapeData;
|
|
158
|
+
open?: boolean;
|
|
148
159
|
disabled?: boolean;
|
|
149
160
|
fallbackColor?: string;
|
|
150
161
|
fallbackGradientEndColor?: string;
|
|
162
|
+
onOpenChange?: (open: boolean) => void;
|
|
151
163
|
onUpdateShapeData: IShapeFloatingToolbarProps['onUpdateShapeData'];
|
|
152
164
|
}): import("react").JSX.Element;
|
|
153
165
|
export declare function TextFillButton(props: {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { IShapeData, IShapeTextData } from '@univerjs-pro/engine-shape';
|
|
2
2
|
import type { Nullable, WrapStrategy as WrapStrategyType } from '@univerjs/core';
|
|
3
|
-
export declare function createShapeTextBoxShapeData(options: Pick<IShapeData, 'fill' | 'stroke'> & {
|
|
4
|
-
isHorizontal: boolean;
|
|
5
|
-
}): IShapeData;
|
|
6
3
|
export declare function resolveShapeTextEditorBehaviorShapeData(shapeData: Nullable<IShapeData> | undefined, shapeTextData: IShapeTextData): IShapeData;
|
|
7
4
|
export declare function resolveShapeTextEditorWrapStrategy(shapeData: IShapeData, fallbackWrapStrategy?: WrapStrategyType): WrapStrategyType;
|
|
8
5
|
export declare function shouldClipShapeTextDocument(shapeData: IShapeData, wrapStrategy?: WrapStrategyType): boolean;
|