@univerjs-pro/shape-editor-ui 1.0.1 → 1.0.3

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.
Files changed (92) hide show
  1. package/lib/cjs/index.js +1 -1
  2. package/lib/cjs/locale/ar-SA.js +1 -1
  3. package/lib/cjs/locale/ca-ES.js +1 -1
  4. package/lib/cjs/locale/de-DE.js +1 -1
  5. package/lib/cjs/locale/en-US.js +1 -1
  6. package/lib/cjs/locale/es-ES.js +1 -1
  7. package/lib/cjs/locale/fa-IR.js +1 -1
  8. package/lib/cjs/locale/fr-FR.js +1 -1
  9. package/lib/cjs/locale/id-ID.js +1 -1
  10. package/lib/cjs/locale/it-IT.js +1 -1
  11. package/lib/cjs/locale/ja-JP.js +1 -1
  12. package/lib/cjs/locale/ko-KR.js +1 -1
  13. package/lib/cjs/locale/pl-PL.js +1 -1
  14. package/lib/cjs/locale/pt-BR.js +1 -1
  15. package/lib/cjs/locale/ru-RU.js +1 -1
  16. package/lib/cjs/locale/sk-SK.js +1 -1
  17. package/lib/cjs/locale/vi-VN.js +1 -1
  18. package/lib/cjs/locale/zh-CN.js +1 -1
  19. package/lib/cjs/locale/zh-HK.js +1 -1
  20. package/lib/cjs/locale/zh-TW.js +1 -1
  21. package/lib/es/index.js +1 -1
  22. package/lib/es/locale/ar-SA.js +1 -1
  23. package/lib/es/locale/ca-ES.js +1 -1
  24. package/lib/es/locale/de-DE.js +1 -1
  25. package/lib/es/locale/en-US.js +1 -1
  26. package/lib/es/locale/es-ES.js +1 -1
  27. package/lib/es/locale/fa-IR.js +1 -1
  28. package/lib/es/locale/fr-FR.js +1 -1
  29. package/lib/es/locale/id-ID.js +1 -1
  30. package/lib/es/locale/it-IT.js +1 -1
  31. package/lib/es/locale/ja-JP.js +1 -1
  32. package/lib/es/locale/ko-KR.js +1 -1
  33. package/lib/es/locale/pl-PL.js +1 -1
  34. package/lib/es/locale/pt-BR.js +1 -1
  35. package/lib/es/locale/ru-RU.js +1 -1
  36. package/lib/es/locale/sk-SK.js +1 -1
  37. package/lib/es/locale/vi-VN.js +1 -1
  38. package/lib/es/locale/zh-CN.js +1 -1
  39. package/lib/es/locale/zh-HK.js +1 -1
  40. package/lib/es/locale/zh-TW.js +1 -1
  41. package/lib/index.js +1 -1
  42. package/lib/locale/ar-SA.js +1 -1
  43. package/lib/locale/ca-ES.js +1 -1
  44. package/lib/locale/de-DE.js +1 -1
  45. package/lib/locale/en-US.js +1 -1
  46. package/lib/locale/es-ES.js +1 -1
  47. package/lib/locale/fa-IR.js +1 -1
  48. package/lib/locale/fr-FR.js +1 -1
  49. package/lib/locale/id-ID.js +1 -1
  50. package/lib/locale/it-IT.js +1 -1
  51. package/lib/locale/ja-JP.js +1 -1
  52. package/lib/locale/ko-KR.js +1 -1
  53. package/lib/locale/pl-PL.js +1 -1
  54. package/lib/locale/pt-BR.js +1 -1
  55. package/lib/locale/ru-RU.js +1 -1
  56. package/lib/locale/sk-SK.js +1 -1
  57. package/lib/locale/vi-VN.js +1 -1
  58. package/lib/locale/zh-CN.js +1 -1
  59. package/lib/locale/zh-HK.js +1 -1
  60. package/lib/locale/zh-TW.js +1 -1
  61. package/lib/types/commands/shape-text-hyper-link.command.d.ts +2 -0
  62. package/lib/types/controllers/shape-text-hyper-link-hover.controller.d.ts +31 -0
  63. package/lib/types/index.d.ts +3 -0
  64. package/lib/types/services/formula-binding-unit-viewer.service.d.ts +67 -0
  65. package/lib/types/services/shape-formula-editor.d.ts +20 -0
  66. package/lib/types/services/shape-formula-reference.d.ts +15 -0
  67. package/lib/types/services/shape-formula-unit-viewer.service.d.ts +67 -0
  68. package/lib/types/services/shape-text-hyper-link-popup.service.d.ts +5 -0
  69. package/lib/types/utils/shape-text-hyper-link-hit.d.ts +21 -0
  70. package/lib/types/views/formula-shape/FormulaShapeNumberFormat.d.ts +24 -0
  71. package/lib/types/views/formula-shape/formula-shape-number-format-utils.d.ts +17 -0
  72. package/lib/umd/index.js +1 -1
  73. package/lib/umd/locale/ar-SA.js +1 -1
  74. package/lib/umd/locale/ca-ES.js +1 -1
  75. package/lib/umd/locale/de-DE.js +1 -1
  76. package/lib/umd/locale/en-US.js +1 -1
  77. package/lib/umd/locale/es-ES.js +1 -1
  78. package/lib/umd/locale/fa-IR.js +1 -1
  79. package/lib/umd/locale/fr-FR.js +1 -1
  80. package/lib/umd/locale/id-ID.js +1 -1
  81. package/lib/umd/locale/it-IT.js +1 -1
  82. package/lib/umd/locale/ja-JP.js +1 -1
  83. package/lib/umd/locale/ko-KR.js +1 -1
  84. package/lib/umd/locale/pl-PL.js +1 -1
  85. package/lib/umd/locale/pt-BR.js +1 -1
  86. package/lib/umd/locale/ru-RU.js +1 -1
  87. package/lib/umd/locale/sk-SK.js +1 -1
  88. package/lib/umd/locale/vi-VN.js +1 -1
  89. package/lib/umd/locale/zh-CN.js +1 -1
  90. package/lib/umd/locale/zh-HK.js +1 -1
  91. package/lib/umd/locale/zh-TW.js +1 -1
  92. package/package.json +20 -20
@@ -0,0 +1,31 @@
1
+ import type { IDisposable, Nullable, UnitModel } from '@univerjs/core';
2
+ import type { BaseObject, IMouseEvent, IPointerEvent, IRenderContext } from '@univerjs/engine-render';
3
+ import type { Observable } from 'rxjs';
4
+ import type { IShapeTextHyperLinkInfo } from '../commands/shape-text-hyper-link.command';
5
+ import type { ShapeTextHyperLinkPopupService } from '../services/shape-text-hyper-link-popup.service';
6
+ import { Disposable } from '@univerjs/core';
7
+ export interface IShapeTextHyperLinkTarget {
8
+ object: BaseObject;
9
+ info: IShapeTextHyperLinkInfo;
10
+ attachPopup: () => IDisposable;
11
+ }
12
+ export interface IShapeTextHyperLinkHost {
13
+ resolve: (event: IPointerEvent | IMouseEvent) => IShapeTextHyperLinkTarget | null;
14
+ editing$: Observable<Nullable<{
15
+ visible?: boolean;
16
+ }>>;
17
+ }
18
+ /** Shared hover lifetime; hosts own picking, coordinates, permissions and popup anchors. */
19
+ export declare class ShapeTextHyperLinkHoverController extends Disposable {
20
+ private readonly _context;
21
+ private readonly _popup;
22
+ private _target;
23
+ private _targetLifetime;
24
+ private _ownsCursor;
25
+ private _editing;
26
+ constructor(_context: IRenderContext<UnitModel>, _popup: ShapeTextHyperLinkPopupService, host: IShapeTextHyperLinkHost);
27
+ clear(): void;
28
+ private _ownsPopup;
29
+ private _restoreCursor;
30
+ dispose(): void;
31
+ }
@@ -4,6 +4,7 @@ export { OpenShapeTextHyperLinkOperation } from './commands/shape-text-hyper-lin
4
4
  export { FillStyleTabsEditor } from './components/fill-style-tabs-editor/FillStyleTabsEditor';
5
5
  export { SHAPE_EDITOR_UI_PLUGIN_CONFIG_KEY } from './config/config';
6
6
  export type { IFormulaBindingEditorResult, IFormulaBindingEditorValue, IFormulaBindingHost, IUniverShapeEditorUIConfig, } from './config/config';
7
+ export { ShapeTextHyperLinkHoverController } from './controllers/shape-text-hyper-link-hover.controller';
7
8
  export { ShapeFloatingToolbarToggleFactory } from './menu/shape-floating-toolbar.menu';
8
9
  export { UniverShapeEditorMobileUIPlugin } from './mobile-plugin';
9
10
  export { UniverShapeEditorUIPlugin } from './plugin';
@@ -24,6 +25,8 @@ export { bindRenderTransformerLifecycle } from './utils/render-transformer-lifec
24
25
  export type { RenderTransformer } from './utils/render-transformer-lifecycle';
25
26
  export { resolveShapeContextualRibbonHostMode } from './utils/shape-contextual-ribbon-host';
26
27
  export { SHAPE_FLOATING_TOOLBAR_TOP_OFFSET, SHEET_DOC_SHAPE_FLOATING_TOOLBAR_TOP_OFFSET } from './utils/shape-floating-toolbar-config';
28
+ export { createShapeTextHyperLinkRegions, resolveShapeTextHyperLinkAt, resolveShapeTextHyperLinkObject } from './utils/shape-text-hyper-link-hit';
29
+ export type { IShapeTextHyperLinkRegion } from './utils/shape-text-hyper-link-hit';
27
30
  export { SHAPE_EDITOR_TRANSFORMER_CONFIG } from './utils/shape-transformer-config';
28
31
  export { getTextModel, getTextStyle, normalizeShapeTextModel } from './utils/util';
29
32
  export { getFormulaBindingCurrencyFormatOptions, getFormulaBindingCurrencyType, getFormulaBindingDateFormatOptions, getFormulaBindingDecimalFromPattern, getFormulaBindingNumberFormatOptions, setFormulaBindingPatternDecimal, } from './views/formula-binding-number-format-utils';
@@ -0,0 +1,67 @@
1
+ import type { BaseDataModel } from '@univerjs/core';
2
+ import type { FormulaSequenceNode, IFormulaRefSelection } from '@univerjs/engine-formula';
3
+ import type { IFormulaBindingHost, IFormulaBindingUnitResource } from '../config/config';
4
+ import type { IFormulaBindingReferenceSelectionChange } from './formula-binding-editor';
5
+ import { Disposable, IConfigService, IUniverInstanceService, LocaleService, ThemeService, Workbook } from '@univerjs/core';
6
+ export type FormulaBindingViewerUnit = Workbook | BaseDataModel;
7
+ export interface IFormulaBindingViewerFormulaContext {
8
+ formula: string;
9
+ sequenceNodes: FormulaSequenceNode[];
10
+ refSelections: IFormulaRefSelection[];
11
+ selectionStart: number;
12
+ selectionEnd: number;
13
+ }
14
+ /** Owns the real, isolated Univer rendered inside the cross-unit formula editor. */
15
+ export declare class FormulaBindingUnitViewerService extends Disposable {
16
+ private readonly _configService;
17
+ private readonly _instanceService;
18
+ private readonly _localeService;
19
+ private readonly _themeService;
20
+ private _univer;
21
+ private _activeUnitId;
22
+ private _container;
23
+ private _generation;
24
+ private _selectionDisposables;
25
+ private _formulaContext;
26
+ private _host;
27
+ private _resource;
28
+ private _onSelectReferences;
29
+ private _activeWorkbook;
30
+ private _activeBase;
31
+ private _visibleReferenceIndexes;
32
+ private _isApplyingBaseHighlight;
33
+ private _pointerCtrlKey;
34
+ private _pointerListener;
35
+ private _selectionChangingDisposable;
36
+ private _controlDisposables;
37
+ private _isDraggingFormulaSelection;
38
+ private _closeRequest;
39
+ constructor(_configService: IConfigService, _instanceService: IUniverInstanceService, _localeService: LocaleService, _themeService: ThemeService);
40
+ listUnits(): Promise<IFormulaBindingUnitResource[]>;
41
+ mount(container: HTMLElement): void;
42
+ switchUnit(resource: IFormulaBindingUnitResource, host: IFormulaBindingHost, onSelectReferences: (change: IFormulaBindingReferenceSelectionChange) => void): Promise<FormulaBindingViewerUnit | null>;
43
+ private _makeBaseSnapshotReadOnly;
44
+ private _setBasePermissionsReadOnly;
45
+ updateFormulaContext(context: IFormulaBindingViewerFormulaContext): void;
46
+ close(): void;
47
+ /** Defers nested Univer disposal until the owning React tree has finished unmounting. */
48
+ scheduleClose(): void;
49
+ private _closeNow;
50
+ dispose(): void;
51
+ private _createUniver;
52
+ private _observeSheetSelection;
53
+ private _observeBaseSelection;
54
+ private _handleBaseSelectionChange;
55
+ private _getBaseReferenceSource;
56
+ private _emitSheetSelectionChange;
57
+ private _refreshFormulaSelections;
58
+ private _refreshSheetFormulaSelections;
59
+ private _refreshBaseFormulaSelection;
60
+ private _bindFormulaSelectionControls;
61
+ private _getEditingContext;
62
+ private _canSelectFormulaReference;
63
+ private _matchesSheetReference;
64
+ private _matchesUnitQualifier;
65
+ private _createExternalReference;
66
+ private _listLoadedUnits;
67
+ }
@@ -0,0 +1,20 @@
1
+ import type { FormulaSequenceNode, IFormulaRefSelection } from '@univerjs/engine-formula';
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/engine-formula';
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
+ }
@@ -14,6 +14,8 @@ export declare class ShapeTextHyperLinkPopupService extends Disposable {
14
14
  private _editPopup;
15
15
  private _editPopupUnitId;
16
16
  private _infoPopup;
17
+ private _infoPopupHovered;
18
+ private _infoPopupHideTimer;
17
19
  private _infoPopupSuppressed;
18
20
  private _infoPopupSuppressionTimer;
19
21
  constructor(_docCanvasPopupManagerService: DocCanvasPopManagerService, _docSelectionManagerService: DocSelectionManagerService, _univerInstanceService: IUniverInstanceService);
@@ -25,5 +27,8 @@ export declare class ShapeTextHyperLinkPopupService extends Disposable {
25
27
  hideEditPopup(unitId?: string): void;
26
28
  showInfoPopup(info: IShapeTextHyperLinkInfo, attachPopup?: () => IDisposable): Nullable<IDisposable>;
27
29
  hideInfoPopup(): void;
30
+ setInfoPopupHovered(hovered: boolean): void;
31
+ scheduleHideInfoPopup(): void;
32
+ private _cancelScheduledHideInfoPopup;
28
33
  hideInfoPopupOnPointerDown(): void;
29
34
  }
@@ -0,0 +1,21 @@
1
+ import type { BaseObject, Documents, IBoundRectNoAngle, Scene, Vector2 } from '@univerjs/engine-render';
2
+ export interface IShapeTextHyperLinkHit {
3
+ linkId: string;
4
+ url: string;
5
+ startIndex: number;
6
+ endIndex: number;
7
+ }
8
+ export interface IShapeTextHyperLinkRegion extends IShapeTextHyperLinkHit {
9
+ rects: IBoundRectNoAngle[];
10
+ }
11
+ /** Capture rendered geometry before temporary document resources are disposed. */
12
+ export declare function createShapeTextHyperLinkRegions(documents: Documents, offset: {
13
+ left: number;
14
+ top: number;
15
+ }, clip?: IBoundRectNoAngle): IShapeTextHyperLinkRegion[];
16
+ export declare function resolveShapeTextHyperLinkAt(regions: readonly IShapeTextHyperLinkRegion[], point: {
17
+ x: number;
18
+ y: number;
19
+ }): IShapeTextHyperLinkHit | null;
20
+ /** Descend only into the picked group, retaining the first visible object as an occlusion boundary. */
21
+ export declare function resolveShapeTextHyperLinkObject(picked: BaseObject | Scene | null | undefined, point: Vector2): BaseObject | Scene | null;
@@ -0,0 +1,24 @@
1
+ import type * as ReactTypes from "react";
2
+ export type FormulaShapeNumberFormatType = 'general' | 'accounting' | 'currency' | 'date' | 'number' | 'custom';
3
+ export type FormulaShapeNumberFormatMenuEntry = {
4
+ kind: 'format';
5
+ key: string;
6
+ pattern: string;
7
+ } | {
8
+ kind: 'separator';
9
+ key: string;
10
+ } | {
11
+ kind: 'more';
12
+ };
13
+ export declare function createFormulaShapeNumberFormatMenuEntries(currencySymbol: string): FormulaShapeNumberFormatMenuEntry[];
14
+ export declare function resolveFormulaShapeNumberFormatType(pattern: string): FormulaShapeNumberFormatType;
15
+ export declare function FormulaShapeNumberFormatMenu(props: {
16
+ onSelect: (pattern: string) => void;
17
+ onMore: () => void;
18
+ }): ReactTypes.JSX.Element;
19
+ export declare function FormulaShapeNumberFormatDialog(props: {
20
+ open: boolean;
21
+ pattern: string;
22
+ onClose: () => void;
23
+ onConfirm: (pattern: string) => void;
24
+ }): ReactTypes.JSX.Element;
@@ -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
+ }[];