@univerjs/sheets-formula-ui 0.25.0 → 1.0.0-alpha.0

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 (26) hide show
  1. package/lib/cjs/index.js +3845 -3761
  2. package/lib/es/index.js +3847 -3763
  3. package/lib/index.js +3847 -3763
  4. package/lib/types/{views/formula-editor/hooks/use-resize.d.ts → controllers/components.controller.d.ts} +9 -1
  5. package/lib/types/controllers/formula-alert-render.controller.d.ts +1 -4
  6. package/lib/types/controllers/{formula-ui.controller.d.ts → ui.controller.d.ts} +2 -3
  7. package/lib/types/index.d.ts +7 -4
  8. package/lib/types/{views/formula-editor/hooks/use-keyboard-event.d.ts → locale/types.d.ts} +3 -1
  9. package/lib/types/menu/menu.d.ts +15 -14
  10. package/lib/types/services/render-services/ref-selections.render.service.d.ts +3 -1
  11. package/lib/types/views/formula-editor/help-function/HelpFunction.d.ts +1 -1
  12. package/lib/types/views/formula-editor/help-function/HelpHiddenTip.d.ts +1 -1
  13. package/lib/types/views/formula-editor/hooks/use-formula-selection.d.ts +1 -0
  14. package/lib/types/views/formula-editor/hooks/use-sheet-selection-change.d.ts +12 -1
  15. package/lib/types/views/formula-editor/index.d.ts +7 -1
  16. package/lib/types/views/formula-progress/FormulaProgress.d.ts +1 -1
  17. package/lib/types/views/more-functions/MoreFunctions.d.ts +1 -1
  18. package/lib/types/views/more-functions/function-help/FunctionHelp.d.ts +1 -1
  19. package/lib/types/views/more-functions/function-params/FunctionParams.d.ts +1 -1
  20. package/lib/types/views/more-functions/input-params/InputParams.d.ts +1 -1
  21. package/lib/types/views/more-functions/select-function/SelectFunction.d.ts +1 -1
  22. package/lib/types/views/range-selector/Global.d.ts +1 -1
  23. package/lib/types/views/range-selector/index.d.ts +4 -3
  24. package/lib/umd/index.js +3 -3
  25. package/package.json +14 -14
  26. package/lib/types/views/range-selector/util.d.ts +0 -21
@@ -13,4 +13,12 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { useResize } from '@univerjs/docs-ui';
16
+ import { Disposable } from '@univerjs/core';
17
+ import { ComponentManager, IconManager } from '@univerjs/ui';
18
+ export declare class ComponentsController extends Disposable {
19
+ private readonly _componentManager;
20
+ private readonly _iconManager;
21
+ constructor(_componentManager: ComponentManager, _iconManager: IconManager);
22
+ private _registerIcons;
23
+ private _registerComponents;
24
+ }
@@ -18,17 +18,14 @@ import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
18
18
  import { Disposable, LocaleService } from '@univerjs/core';
19
19
  import { FormulaDataModel } from '@univerjs/engine-formula';
20
20
  import { CellAlertManagerService, HoverManagerService } from '@univerjs/sheets-ui';
21
- import { IZenZoneService } from '@univerjs/ui';
22
21
  export declare class FormulaAlertRenderController extends Disposable implements IRenderModule {
23
22
  private readonly _context;
24
23
  private readonly _hoverManagerService;
25
24
  private readonly _cellAlertManagerService;
26
25
  private readonly _localeService;
27
26
  private readonly _formulaDataModel;
28
- private readonly _zenZoneService;
29
- constructor(_context: IRenderContext<Workbook>, _hoverManagerService: HoverManagerService, _cellAlertManagerService: CellAlertManagerService, _localeService: LocaleService, _formulaDataModel: FormulaDataModel, _zenZoneService: IZenZoneService);
27
+ constructor(_context: IRenderContext<Workbook>, _hoverManagerService: HoverManagerService, _cellAlertManagerService: CellAlertManagerService, _localeService: LocaleService, _formulaDataModel: FormulaDataModel);
30
28
  private _init;
31
29
  private _initCellAlertPopup;
32
- private _initZenService;
33
30
  private _hideAlert;
34
31
  }
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { Disposable, ICommandService, Injector } from '@univerjs/core';
17
17
  import { IRenderManagerService } from '@univerjs/engine-render';
18
- import { ComponentManager, IMenuManagerService, IShortcutService, IUIPartsService } from '@univerjs/ui';
18
+ import { IMenuManagerService, IShortcutService, IUIPartsService } from '@univerjs/ui';
19
19
  export declare class FormulaUIController extends Disposable {
20
20
  private readonly _injector;
21
21
  private readonly _menuManagerService;
@@ -23,8 +23,7 @@ export declare class FormulaUIController extends Disposable {
23
23
  private readonly _shortcutService;
24
24
  private readonly _uiPartsService;
25
25
  private readonly _renderManagerService;
26
- private readonly _componentManager;
27
- constructor(_injector: Injector, _menuManagerService: IMenuManagerService, _commandService: ICommandService, _shortcutService: IShortcutService, _uiPartsService: IUIPartsService, _renderManagerService: IRenderManagerService, _componentManager: ComponentManager);
26
+ constructor(_injector: Injector, _menuManagerService: IMenuManagerService, _commandService: ICommandService, _shortcutService: IShortcutService, _uiPartsService: IUIPartsService, _renderManagerService: IRenderManagerService);
28
27
  private _initialize;
29
28
  private _registerMenus;
30
29
  private _registerCommands;
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import './global.css';
17
- export { SheetCopyFormulaOnlyCommand, SheetOnlyPasteFormulaCommand } from './commands/commands/formula-clipboard.command';
17
+ export { SheetCopyFormulaOnlyCommand, SheetOnlyPasteFormulaCommand, } from './commands/commands/formula-clipboard.command';
18
18
  export { HelpFunctionOperation } from './commands/operations/help-function.operation';
19
19
  export { InsertFunctionOperation } from './commands/operations/insert-function.operation';
20
20
  export { MoreFunctionsOperation } from './commands/operations/more-functions.operation';
@@ -24,7 +24,10 @@ export type { IUniverSheetsFormulaUIConfig } from './config/config';
24
24
  export { FormulaReorderController } from './controllers/formula-reorder.controller';
25
25
  export { UniverSheetsFormulaUIPlugin } from './plugin';
26
26
  export { FORMULA_PROMPT_ACTIVATED } from './services/prompt.service';
27
- export { GlobalRangeSelectorService, type IShowRangeSelectorDialogOptions } from './services/range-selector.service';
27
+ export { GlobalRangeSelectorService } from './services/range-selector.service';
28
+ export type { IShowRangeSelectorDialogOptions } from './services/range-selector.service';
28
29
  export { RefSelectionsRenderService } from './services/render-services/ref-selections.render.service';
29
- export { FormulaEditor, type IFormulaEditorRef } from './views/formula-editor/index';
30
- export { type IRangeSelectorInstance, type IRangeSelectorProps, RangeSelector } from './views/range-selector/index';
30
+ export { FormulaEditor } from './views/formula-editor/index';
31
+ export type { IFormulaEditorRef } from './views/formula-editor/index';
32
+ export { RangeSelector } from './views/range-selector/index';
33
+ export type { IRangeSelectorInstance, IRangeSelectorProps } from './views/range-selector/index';
@@ -13,4 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { type IKeyboardEventConfig, useKeyboardEvent } from '@univerjs/docs-ui';
16
+ import type { LocaleLeafKeys } from '@univerjs/core';
17
+ import type enUS from './en-US';
18
+ export type LocaleKey = LocaleLeafKeys<typeof enUS>;
@@ -15,17 +15,18 @@
15
15
  */
16
16
  import type { IAccessor } from '@univerjs/core';
17
17
  import type { IMenuItem } from '@univerjs/ui';
18
- export declare function InsertCommonFunctionMenuItemFactory(accessor: IAccessor): IMenuItem;
19
- export declare const InsertFinancialFunctionMenuItemFactory: (accessor: IAccessor) => IMenuItem;
20
- export declare const InsertLogicalFunctionMenuItemFactory: (accessor: IAccessor) => IMenuItem;
21
- export declare const InsertTextFunctionMenuItemFactory: (accessor: IAccessor) => IMenuItem;
22
- export declare const InsertDateFunctionMenuItemFactory: (accessor: IAccessor) => IMenuItem;
23
- export declare const InsertLookupFunctionMenuItemFactory: (accessor: IAccessor) => IMenuItem;
24
- export declare const InsertMathFunctionMenuItemFactory: (accessor: IAccessor) => IMenuItem;
25
- export declare const InsertStatisticalFunctionMenuItemFactory: (accessor: IAccessor) => IMenuItem;
26
- export declare const InsertEngineeringFunctionMenuItemFactory: (accessor: IAccessor) => IMenuItem;
27
- export declare const InsertInformationFunctionMenuItemFactory: (accessor: IAccessor) => IMenuItem;
28
- export declare const InsertDatabaseFunctionMenuItemFactory: (accessor: IAccessor) => IMenuItem;
29
- export declare function AllFunctionsMenuItemFactory(accessor: IAccessor): IMenuItem;
30
- export declare function CopyFormulaOnlyMenuItemFactory(accessor: IAccessor): IMenuItem;
31
- export declare function PasteFormulaMenuItemFactory(accessor: IAccessor): IMenuItem;
18
+ import type { LocaleKey } from '../locale/types';
19
+ export declare function InsertCommonFunctionMenuItemFactory(accessor: IAccessor): IMenuItem<LocaleKey>;
20
+ export declare const InsertFinancialFunctionMenuItemFactory: (accessor: IAccessor) => IMenuItem<LocaleKey>;
21
+ export declare const InsertLogicalFunctionMenuItemFactory: (accessor: IAccessor) => IMenuItem<LocaleKey>;
22
+ export declare const InsertTextFunctionMenuItemFactory: (accessor: IAccessor) => IMenuItem<LocaleKey>;
23
+ export declare const InsertDateFunctionMenuItemFactory: (accessor: IAccessor) => IMenuItem<LocaleKey>;
24
+ export declare const InsertLookupFunctionMenuItemFactory: (accessor: IAccessor) => IMenuItem<LocaleKey>;
25
+ export declare const InsertMathFunctionMenuItemFactory: (accessor: IAccessor) => IMenuItem<LocaleKey>;
26
+ export declare const InsertStatisticalFunctionMenuItemFactory: (accessor: IAccessor) => IMenuItem<LocaleKey>;
27
+ export declare const InsertEngineeringFunctionMenuItemFactory: (accessor: IAccessor) => IMenuItem<LocaleKey>;
28
+ export declare const InsertInformationFunctionMenuItemFactory: (accessor: IAccessor) => IMenuItem<LocaleKey>;
29
+ export declare const InsertDatabaseFunctionMenuItemFactory: (accessor: IAccessor) => IMenuItem<LocaleKey>;
30
+ export declare function AllFunctionsMenuItemFactory(accessor: IAccessor): IMenuItem<LocaleKey>;
31
+ export declare function CopyFormulaOnlyMenuItemFactory(accessor: IAccessor): IMenuItem<LocaleKey>;
32
+ export declare function PasteFormulaMenuItemFactory(accessor: IAccessor): IMenuItem<LocaleKey>;
@@ -13,13 +13,15 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { IDisposable, Nullable, Workbook } from '@univerjs/core';
16
+ import type { IDisposable, IRange, Nullable, Workbook } from '@univerjs/core';
17
17
  import type { IMouseEvent, IPointerEvent, IRenderContext, IRenderModule, Scene, SpreadsheetSkeleton, Viewport } from '@univerjs/engine-render';
18
18
  import type { ISelectionWithStyle, SheetsSelectionsService } from '@univerjs/sheets';
19
19
  import { IContextService, Injector, RANGE_TYPE, ThemeService } from '@univerjs/core';
20
20
  import { ScrollTimerType } from '@univerjs/engine-render';
21
21
  import { BaseSelectionRenderService, SelectionControl, SheetSkeletonManagerService } from '@univerjs/sheets-ui';
22
22
  import { IShortcutService } from '@univerjs/ui';
23
+ export declare function getActiveSelectionControlIndex(selectionControls: SelectionControl[], activeSelectionControl: Nullable<SelectionControl>): number;
24
+ export declare function isSelectionRangeChanged(previous: Nullable<IRange>, current: Nullable<IRange>): boolean;
23
25
  /**
24
26
  * This service extends the existing `SelectionRenderService` to provide the rendering of prompt selections
25
27
  * when user is editing ref ranges in formulas.
@@ -21,5 +21,5 @@ interface IHelpFunctionProps {
21
21
  isFocus: boolean;
22
22
  formulaText: string;
23
23
  }
24
- export declare function HelpFunction(props: IHelpFunctionProps): import("react/jsx-runtime").JSX.Element | null;
24
+ export declare function HelpFunction(props: IHelpFunctionProps): import("react").JSX.Element | null;
25
25
  export {};
@@ -15,4 +15,4 @@
15
15
  */
16
16
  export declare const HelpHiddenTip: ({ onClick }: {
17
17
  onClick: () => void;
18
- }) => import("react/jsx-runtime").JSX.Element;
18
+ }) => import("react").JSX.Element;
@@ -20,6 +20,7 @@ export declare enum FormulaSelectingType {
20
20
  EDIT_OTHER_SHEET_REFERENCE = 3,
21
21
  EDIT_OTHER_WORKBOOK_REFERENCE = 4
22
22
  }
23
+ export declare function shouldSkipReferenceEditingByPointer(isDisabledByPointer: boolean, disableOnClick?: boolean): boolean;
23
24
  export declare function useFormulaSelecting(opts: {
24
25
  editorId: string;
25
26
  isFocus: boolean;
@@ -13,8 +13,19 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import type { IRange } from '@univerjs/core';
16
17
  import type { Editor } from '@univerjs/docs-ui';
17
18
  import type { RefObject } from 'react';
18
19
  import type { IRefSelection } from './use-highlight';
19
20
  import { FormulaSelectingType } from './use-formula-selection';
20
- export declare const useSheetSelectionChange: (isNeed: boolean, isFocus: boolean, isSelectingRef: RefObject<FormulaSelectingType>, unitId: string, subUnitId: string, refSelectionRef: React.MutableRefObject<IRefSelection[]>, isSupportAcrossSheet: boolean, listenSelectionSet: boolean, editor?: Editor, handleRangeChange?: ((refString: string, offset: number, isEnd: boolean, isModify?: boolean) => void)) => void;
21
+ export declare function getSelectionsForFormulaRefUpdate(selections: IRange[], updatingRefIndex: number, isCtrlAddMode?: boolean): {
22
+ orderedSelections: IRange[];
23
+ insertedSelection?: IRange;
24
+ };
25
+ export declare function createSelectionChangeHandler<TSelection>(opts: {
26
+ initialSelectionsCount: number;
27
+ onSelectionsChange: (selections: TSelection[], isEnd: boolean, isCtrlAddMode?: boolean) => void;
28
+ }): (selections: TSelection[], isEnd: boolean, options?: {
29
+ initial?: boolean;
30
+ }) => void;
31
+ export declare const useSheetSelectionChange: (isNeed: boolean, isFocus: boolean, isSelectingRef: RefObject<FormulaSelectingType>, unitId: string, subUnitId: string, getRefSelections: () => IRefSelection[], isSupportAcrossSheet: boolean, listenSelectionSet: boolean, editor?: Editor, handleRangeChange?: ((refString: string, offset: number, isEnd: boolean, isModify?: boolean) => void)) => void;
@@ -13,7 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { IKeyboardEventConfig } from '@univerjs/docs-ui';
16
+ import type { ITextRange } from '@univerjs/core';
17
+ import type { Editor, IKeyboardEventConfig } from '@univerjs/docs-ui';
17
18
  import type { KeyCode, MetaKeys } from '@univerjs/ui';
18
19
  import type { CSSProperties, ReactNode } from 'react';
19
20
  import type { FormulaSelectingType } from './hooks/use-formula-selection';
@@ -53,4 +54,9 @@ export interface IFormulaEditorProps {
53
54
  export interface IFormulaEditorRef {
54
55
  isClickOutSide: (e: MouseEvent) => boolean;
55
56
  }
57
+ interface IFormulaEditorSelectionSyncService {
58
+ getEditor: (editorId: string) => Pick<Editor, 'setSelectionRanges'> | null | undefined | void;
59
+ }
60
+ export declare function syncCounterpartFormulaEditorSelection(editorService: IFormulaEditorSelectionSyncService, editorId: string, selections: ITextRange[] | undefined): void;
56
61
  export declare const FormulaEditor: import("react").ForwardRefExoticComponent<IFormulaEditorProps & import("react").RefAttributes<IFormulaEditorRef>>;
62
+ export {};
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare function FormulaProgressBar(): import("react/jsx-runtime").JSX.Element;
16
+ export declare function FormulaProgressBar(): import("react").JSX.Element;
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare function MoreFunctions(): import("react/jsx-runtime").JSX.Element;
16
+ export declare function MoreFunctions(): import("react").JSX.Element;
@@ -32,5 +32,5 @@ interface IFunctionHelpProps {
32
32
  * @param props
33
33
  * @returns
34
34
  */
35
- export declare function FunctionHelp(props: IFunctionHelpProps): import("react/jsx-runtime").JSX.Element;
35
+ export declare function FunctionHelp(props: IFunctionHelpProps): import("react").JSX.Element;
36
36
  export {};
@@ -19,5 +19,5 @@ interface IParamsProps {
19
19
  title?: string | ReactElement;
20
20
  value?: string | ReactElement;
21
21
  }
22
- export declare function FunctionParams(props: IParamsProps): import("react/jsx-runtime").JSX.Element;
22
+ export declare function FunctionParams(props: IParamsProps): import("react").JSX.Element;
23
23
  export {};
@@ -18,4 +18,4 @@ export interface IInputParamsProps {
18
18
  functionInfo: IFunctionInfo | null;
19
19
  onChange: (params: string[]) => void;
20
20
  }
21
- export declare function InputParams(props: IInputParamsProps): import("react/jsx-runtime").JSX.Element | null;
21
+ export declare function InputParams(props: IInputParamsProps): import("react").JSX.Element | null;
@@ -17,4 +17,4 @@ import type { IFunctionInfo } from '@univerjs/engine-formula';
17
17
  export interface ISelectFunctionProps {
18
18
  onChange: (functionInfo: IFunctionInfo | null) => void;
19
19
  }
20
- export declare function SelectFunction(props: ISelectFunctionProps): import("react/jsx-runtime").JSX.Element;
20
+ export declare function SelectFunction(props: ISelectFunctionProps): import("react").JSX.Element;
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const GlobalRangeSelector: () => import("react/jsx-runtime").JSX.Element;
16
+ export declare const GlobalRangeSelector: () => import("react").JSX.Element;
@@ -16,6 +16,7 @@
16
16
  import type { IUnitRangeName, Nullable } from '@univerjs/core';
17
17
  import type { Editor, IRichTextEditorProps } from '@univerjs/docs-ui';
18
18
  import type { ISelectionWithStyle } from '@univerjs/sheets';
19
+ import type { RefObject } from 'react';
19
20
  export interface IRangeSelectorInstance {
20
21
  editor: Nullable<Editor>;
21
22
  blur: () => void;
@@ -34,7 +35,7 @@ export interface IRangeSelectorProps extends IRichTextEditorProps {
34
35
  * always return range ref with sheet name, default: false
35
36
  */
36
37
  keepSheetReference?: boolean;
37
- selectorRef?: React.RefObject<IRangeSelectorInstance | null>;
38
+ selectorRef?: RefObject<IRangeSelectorInstance | null>;
38
39
  onVerify?: (res: boolean, rangeText: string) => void;
39
40
  onRangeSelectorDialogVisibleChange?: (visible: boolean) => void;
40
41
  hideEditor?: boolean;
@@ -53,7 +54,7 @@ export interface IRangeSelectorDialogProps {
53
54
  onClose: () => void;
54
55
  onShowBySelection?: (ranges: IUnitRangeName[]) => boolean;
55
56
  }
56
- export declare function RangeSelectorDialog(props: IRangeSelectorDialogProps): import("react/jsx-runtime").JSX.Element;
57
+ export declare function RangeSelectorDialog(props: IRangeSelectorDialogProps): import("react").JSX.Element;
57
58
  export declare function parseRanges(rangeString: string): IUnitRangeName[];
58
59
  export declare function stringifyRanges(ranges: IUnitRangeName[]): string;
59
- export declare function RangeSelector(props: IRangeSelectorProps): import("react/jsx-runtime").JSX.Element;
60
+ export declare function RangeSelector(props: IRangeSelectorProps): import("react").JSX.Element;