@univerjs/sheets-formula-ui 0.6.1 → 0.6.2

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 (35) hide show
  1. package/lib/cjs/facade.js +1 -0
  2. package/lib/cjs/index.js +20 -23
  3. package/lib/es/facade.js +11 -0
  4. package/lib/es/index.js +2564 -2674
  5. package/lib/index.css +1 -1
  6. package/lib/types/facade/f-univer.d.ts +32 -0
  7. package/lib/types/{views/range-selector/hooks/use-refocus.d.ts → facade/index.d.ts} +2 -1
  8. package/lib/types/index.d.ts +2 -1
  9. package/lib/types/services/range-selector.service.d.ts +14 -0
  10. package/lib/types/sheets-formula-ui.plugin.d.ts +4 -1
  11. package/lib/types/views/formula-editor/hooks/use-formula-search.d.ts +1 -1
  12. package/lib/types/views/{range-selector → formula-editor}/hooks/use-highlight.d.ts +1 -1
  13. package/lib/types/views/{range-selector → formula-editor}/hooks/use-left-and-right-arrow.d.ts +1 -1
  14. package/lib/types/views/formula-editor/hooks/use-sheet-selection-change.d.ts +1 -1
  15. package/lib/types/views/formula-editor/index.d.ts +2 -2
  16. package/lib/types/views/range-selector/{hooks/use-only-one-range.d.ts → global.d.ts} +1 -1
  17. package/lib/types/views/range-selector/hooks/use-ranges-highlight.d.ts +6 -0
  18. package/lib/types/views/range-selector/hooks/use-selection-change.d.ts +7 -0
  19. package/lib/types/views/range-selector/index.d.ts +34 -26
  20. package/lib/types/views/range-selector/util.d.ts +6 -0
  21. package/lib/umd/facade.js +1 -0
  22. package/lib/umd/index.js +20 -23
  23. package/package.json +19 -18
  24. package/lib/types/views/range-selector/hooks/use-editor-input.d.ts +0 -8
  25. package/lib/types/views/range-selector/hooks/use-first-highlight-doc.d.ts +0 -3
  26. package/lib/types/views/range-selector/hooks/use-sheet-selection-change.d.ts +0 -2
  27. package/lib/types/views/range-selector/hooks/use-verify.d.ts +0 -3
  28. /package/lib/types/views/{range-selector → formula-editor}/hooks/use-focus.d.ts +0 -0
  29. /package/lib/types/views/{range-selector → formula-editor}/hooks/use-formula-token.d.ts +0 -0
  30. /package/lib/types/views/{range-selector → formula-editor}/hooks/use-is-first-render.d.ts +0 -0
  31. /package/lib/types/views/{range-selector → formula-editor}/hooks/use-keyboard-event.d.ts +0 -0
  32. /package/lib/types/views/{range-selector → formula-editor}/hooks/use-refactor-effect.d.ts +0 -0
  33. /package/lib/types/views/{range-selector → formula-editor}/hooks/use-reset-selection.d.ts +0 -0
  34. /package/lib/types/views/{range-selector → formula-editor}/hooks/use-resize.d.ts +0 -0
  35. /package/lib/types/views/{range-selector → formula-editor}/hooks/use-switch-sheet.d.ts +0 -0
package/lib/index.css CHANGED
@@ -1 +1 @@
1
- .univer-sheet-range-selector-text-wrap{height:32px;padding:6px 8px 2px 6px;width:100%;display:flex;justify-content:space-around;align-items:center;gap:8px;border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-base);box-sizing:border-box;position:relative}.univer-sheet-range-selector-placeholder{font-size:14px;color:rgb(var(--grey-500));position:absolute;left:5px;bottom:8px}.univer-sheet-range-selector-error{border:1px solid rgb(var(--red-500))!important}.univer-sheet-range-selector-error-wrap{font-size:12px;color:rgb(var(--red-500));position:absolute;bottom:-18px;left:0}.univer-sheet-range-selector-text{position:relative;height:22px;width:100%}.univer-sheet-range-selector-active{border-color:rgb(var(--hyacinth-500))}.univer-sheet-range-selector-icon{cursor:pointer}.univer-sheet-range-selector-dialog-item{display:flex;align-items:center;justify-content:flex-start;gap:16px;margin-bottom:8px}.univer-sheet-range-selector-dialog-item-delete{cursor:pointer}.univer-sheet-embedding-formula-editor-active{border-color:rgb(var(--hyacinth-500))!important}.univer-sheet-embedding-formula-editor-wrap{height:32px;padding:6px 8px 2px 6px;width:100%;display:flex;justify-content:space-around;align-items:center;gap:8px;border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-base);box-sizing:border-box;position:relative}.univer-sheet-embedding-formula-editor-wrap .univer-sheet-embedding-formula-editor-text{width:100%;height:100%;position:relative}.univer-sheet-embedding-formula-editor-error{border:1px solid rgb(var(--red-500))!important}.univer-sheet-embedding-formula-editor .univer-sheet-embedding-formula-editor-error-wrap{font-size:12px;color:rgb(var(--red-500));margin:var(--margin-xxs) 0}.univer-formula-help-function{-webkit-user-select:none;-moz-user-select:none;user-select:none;box-sizing:border-box;width:250px;margin:0;line-height:20px;list-style:none;background-color:rgb(var(--bg-color-secondary));border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-lg);outline:none;box-shadow:var(--box-shadow-base)}.univer-formula-help-function-title{display:flex;align-items:center;justify-content:space-between;box-sizing:border-box;padding:var(--padding-base) var(--padding-lg);font-size:var(--font-size-xxs);font-weight:500;color:rgb(var(--text-color));word-wrap:anywhere;border-bottom:1px solid rgb(var(--border-color))}.univer-formula-help-function-title-icons{display:flex}.univer-formula-help-function-title-icon{cursor:pointer;display:flex;align-items:center;justify-content:center;width:24px;height:24px;margin-left:var(--margin-xs);padding:0;font-size:var(--font-size-xs);color:rgb(var(--text-color-secondary));background-color:transparent;border:none;border-radius:var(--border-radius-base);outline:none;transition:background-color .2s}.univer-formula-help-function-title-icon:hover{background-color:rgb(var(--bg-color-hover))}.univer-formula-help-function-content{overflow-y:auto;box-sizing:border-box;max-height:350px;padding:0 var(--padding-lg) var(--padding-base) var(--padding-lg)}.univer-formula-help-function-content-inner{margin-top:var(--margin-sm)}.univer-formula-help-function-content-params{margin:var(--margin-xs) 0}.univer-formula-help-function-content-params-title{margin-bottom:var(--margin-xs);font-size:var(--font-size-xs);font-weight:500;color:rgb(var(--text-color))}.univer-formula-help-function-content-params-detail{font-size:var(--font-size-xxs);font-weight:400;white-space:pre-wrap;word-wrap:break-word;color:rgb(var(--text-color-secondary))}.univer-formula-help-function-active{color:rgb(var(--primary-color))}.univer-formula-help-decorator{cursor:pointer;position:fixed;z-index:10;display:flex;align-items:center;justify-content:center;padding:var(--padding-xs)}.univer-formula-help-param,.univer-formula-help-param-prefix,.univer-formula-help-param-item,.univer-formula-help-param-active{z-index:1}.univer-formula-search-function{box-sizing:border-box;width:250px;max-height:400px;margin:0;padding:var(--padding-sm);line-height:20px;list-style:none;background-color:rgb(var(--bg-color-secondary));border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-lg);outline:none;box-shadow:var(--box-shadow-base);overflow:hidden;overflow-y:auto}.univer-formula-search-function-item{cursor:pointer;box-sizing:border-box;padding:var(--padding-xs) var(--padding-sm);color:rgb(var(--text-color));border-radius:var(--border-radius-base);transition:background .2s}.univer-formula-search-function-item-name{font-size:var(--font-size-xxs)}.univer-formula-search-function-item-name-light{color:rgb(var(--error-color))}.univer-formula-search-function-item-desc{display:block;font-size:var(--font-size-xxs);color:rgb(var(--grey-500))}.univer-formula-search-function-item-active{background-color:rgb(var(--bg-color-hover))}.univer-formula-more-functions{display:flex;flex-direction:column;justify-content:space-between;height:100%;line-height:20px}.univer-formula-more-functions-operation{display:flex;justify-content:flex-end}.univer-formula-more-functions-operation>button{margin:0 0 var(--margin-lg) var(--margin-base)}.univer-formula-function-params{margin-bottom:var(--margin-xs);font-size:var(--font-size-xxs)}.univer-formula-function-params-title{font-weight:500;color:rgb(var(--text-color-secondary))}.univer-formula-function-params-detail{font-weight:400;color:rgb(var(--text-color))}.univer-formula-input-params-list{overflow-y:auto;height:364px}.univer-formula-input-params-list-item-name{font-size:var(--font-size-sm)}.univer-formula-input-params-list-item-selector{margin:var(--margin-xxs) 0 var(--margin-xs) 0}.univer-formula-select-function-select{display:flex;gap:10%;align-items:center;justify-content:space-between}.univer-formula-select-function-result{-webkit-user-select:none;-moz-user-select:none;user-select:none;overflow-y:auto;box-sizing:border-box;width:100%;max-height:364px;margin:0;margin-top:var(--margin-xs);padding:var(--padding-base);list-style:none;border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-base);outline:none}.univer-formula-select-function-result-item{cursor:pointer;position:relative;box-sizing:border-box;padding:var(--padding-xs) 28px;font-size:var(--font-size-xs);color:rgb(var(--text-color));border-radius:var(--border-radius-base);transition:background .2s}.univer-formula-select-function-result-item>span{display:block}.univer-formula-select-function-result-item-name-light{color:rgb(var(--error-color))}.univer-formula-select-function-result-item-selected{position:absolute;top:50%;left:6px;transform:translateY(-50%);display:inline-flex;font-size:var(--font-size-lg);color:rgb(var(--success-color))}.univer-formula-select-function-result-item-active{background-color:rgb(var(--bg-color-hover))}.univer-formula-select-function-content{overflow-y:auto;max-height:307px;margin:var(--margin-xs) 0}
1
+ .univer-sheet-embedding-formula-editor-active{border-color:rgb(var(--hyacinth-500))!important}.univer-sheet-embedding-formula-editor-wrap{height:32px;padding:6px 8px 2px 6px;width:100%;display:flex;justify-content:space-around;align-items:center;gap:8px;border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-base);box-sizing:border-box;position:relative}.univer-sheet-embedding-formula-editor-wrap .univer-sheet-embedding-formula-editor-text{width:100%;height:100%;position:relative}.univer-sheet-embedding-formula-editor-error{border:1px solid rgb(var(--red-500))!important}.univer-sheet-embedding-formula-editor .univer-sheet-embedding-formula-editor-error-wrap{font-size:12px;color:rgb(var(--red-500));margin:var(--margin-xxs) 0}.univer-sheet-range-selector-text-wrap{height:32px;padding:6px 8px 2px 6px;width:100%;display:flex;justify-content:space-around;align-items:center;gap:8px;border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-base);box-sizing:border-box;position:relative}.univer-sheet-range-selector-placeholder{font-size:14px;color:rgb(var(--grey-500));position:absolute;left:5px;bottom:8px}.univer-sheet-range-selector-error{border:1px solid rgb(var(--red-500))!important}.univer-sheet-range-selector-error-wrap{font-size:12px;color:rgb(var(--red-500));position:absolute;bottom:-18px;left:0}.univer-sheet-range-selector-text{position:relative;height:22px;width:100%}.univer-sheet-range-selector-active{border-color:rgb(var(--hyacinth-500))}.univer-sheet-range-selector-icon{cursor:pointer}.univer-sheet-range-selector-dialog{max-height:240px;overflow-y:scroll;scrollbar-color:rgba(115,115,115,.4) transparent;scrollbar-gutter:stable;scrollbar-width:thin}.univer-sheet-range-selector-dialog-item{display:flex;align-items:center;justify-content:flex-start;gap:16px;margin-bottom:8px}.univer-sheet-range-selector-dialog-item-delete{cursor:pointer}.univer-formula-help-function{-webkit-user-select:none;-moz-user-select:none;user-select:none;box-sizing:border-box;width:250px;margin:0;line-height:20px;list-style:none;background-color:rgb(var(--bg-color-secondary));border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-lg);outline:none;box-shadow:var(--box-shadow-base)}.univer-formula-help-function-title{display:flex;align-items:center;justify-content:space-between;box-sizing:border-box;padding:var(--padding-base) var(--padding-lg);font-size:var(--font-size-xxs);font-weight:500;color:rgb(var(--text-color));word-wrap:anywhere;border-bottom:1px solid rgb(var(--border-color))}.univer-formula-help-function-title-icons{display:flex}.univer-formula-help-function-title-icon{cursor:pointer;display:flex;align-items:center;justify-content:center;width:24px;height:24px;margin-left:var(--margin-xs);padding:0;font-size:var(--font-size-xs);color:rgb(var(--text-color-secondary));background-color:transparent;border:none;border-radius:var(--border-radius-base);outline:none;transition:background-color .2s}.univer-formula-help-function-title-icon:hover{background-color:rgb(var(--bg-color-hover))}.univer-formula-help-function-content{overflow-y:auto;box-sizing:border-box;max-height:350px;padding:0 var(--padding-lg) var(--padding-base) var(--padding-lg)}.univer-formula-help-function-content-inner{margin-top:var(--margin-sm)}.univer-formula-help-function-content-params{margin:var(--margin-xs) 0}.univer-formula-help-function-content-params-title{margin-bottom:var(--margin-xs);font-size:var(--font-size-xs);font-weight:500;color:rgb(var(--text-color))}.univer-formula-help-function-content-params-detail{font-size:var(--font-size-xxs);font-weight:400;white-space:pre-wrap;word-wrap:break-word;color:rgb(var(--text-color-secondary))}.univer-formula-help-function-active{color:rgb(var(--primary-color))}.univer-formula-help-decorator{cursor:pointer;position:fixed;z-index:10;display:flex;align-items:center;justify-content:center;padding:var(--padding-xs)}.univer-formula-help-param,.univer-formula-help-param-prefix,.univer-formula-help-param-item,.univer-formula-help-param-active{z-index:1}.univer-formula-search-function{box-sizing:border-box;width:250px;max-height:400px;margin:0;padding:var(--padding-sm);line-height:20px;list-style:none;background-color:rgb(var(--bg-color-secondary));border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-lg);outline:none;box-shadow:var(--box-shadow-base);overflow:hidden;overflow-y:auto}.univer-formula-search-function-item{cursor:pointer;box-sizing:border-box;padding:var(--padding-xs) var(--padding-sm);color:rgb(var(--text-color));border-radius:var(--border-radius-base);transition:background .2s}.univer-formula-search-function-item-name{font-size:var(--font-size-xxs)}.univer-formula-search-function-item-name-light{color:rgb(var(--error-color))}.univer-formula-search-function-item-desc{display:block;font-size:var(--font-size-xxs);color:rgb(var(--grey-500))}.univer-formula-search-function-item-active{background-color:rgb(var(--bg-color-hover))}.univer-formula-more-functions{display:flex;flex-direction:column;justify-content:space-between;height:100%;line-height:20px}.univer-formula-more-functions-operation{display:flex;justify-content:flex-end}.univer-formula-more-functions-operation>button{margin:0 0 var(--margin-lg) var(--margin-base)}.univer-formula-function-params{margin-bottom:var(--margin-xs);font-size:var(--font-size-xxs)}.univer-formula-function-params-title{font-weight:500;color:rgb(var(--text-color-secondary))}.univer-formula-function-params-detail{font-weight:400;color:rgb(var(--text-color))}.univer-formula-input-params-list{overflow-y:auto;height:364px}.univer-formula-input-params-list-item-name{font-size:var(--font-size-sm)}.univer-formula-input-params-list-item-selector{margin:var(--margin-xxs) 0 var(--margin-xs) 0}.univer-formula-select-function-select{display:flex;gap:10%;align-items:center;justify-content:space-between}.univer-formula-select-function-result{-webkit-user-select:none;-moz-user-select:none;user-select:none;overflow-y:auto;box-sizing:border-box;width:100%;max-height:364px;margin:0;margin-top:var(--margin-xs);padding:var(--padding-base);list-style:none;border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-base);outline:none}.univer-formula-select-function-result-item{cursor:pointer;position:relative;box-sizing:border-box;padding:var(--padding-xs) 28px;font-size:var(--font-size-xs);color:rgb(var(--text-color));border-radius:var(--border-radius-base);transition:background .2s}.univer-formula-select-function-result-item>span{display:block}.univer-formula-select-function-result-item-name-light{color:rgb(var(--error-color))}.univer-formula-select-function-result-item-selected{position:absolute;top:50%;left:6px;transform:translateY(-50%);display:inline-flex;font-size:var(--font-size-lg);color:rgb(var(--success-color))}.univer-formula-select-function-result-item-active{background-color:rgb(var(--bg-color-hover))}.univer-formula-select-function-content{overflow-y:auto;max-height:307px;margin:var(--margin-xs) 0}
@@ -0,0 +1,32 @@
1
+ import { IUnitRangeName } from '@univerjs/core';
2
+ import { IShowRangeSelectorDialogOptions } from '@univerjs/sheets-formula-ui';
3
+ import { FUniver } from '@univerjs/core/facade';
4
+ export interface ISheetsFormulaUIMixin {
5
+ /**
6
+ * Shows the range selector dialog.
7
+ *
8
+ * @param {IShowRangeSelectorDialogOptions} opts The options of the range selector dialog.
9
+ * @returns {Promise<IUnitRangeName[]>} The selected ranges.
10
+ * @example
11
+ * ```typescript
12
+ * this.univer.showRangeSelectorDialog({
13
+ * unitId: 'unit1',
14
+ * subUnitId: 'subUnit1',
15
+ * initialValue: [{ sheetName: 'Sheet1', range: 'A1:B2' }],
16
+ * maxRangeCount: 2,
17
+ * supportAcrossSheet: true,
18
+ * callback: (ranges, isCancel) => {
19
+ * // Handle the selected ranges
20
+ * }
21
+ * })
22
+ * ```
23
+ */
24
+ showRangeSelectorDialog(opts: IShowRangeSelectorDialogOptions): Promise<IUnitRangeName[]>;
25
+ }
26
+ export declare class FSheetsFormulaUIUniver extends FUniver implements ISheetsFormulaUIMixin {
27
+ showRangeSelectorDialog(opts: IShowRangeSelectorDialogOptions): Promise<IUnitRangeName[]>;
28
+ }
29
+ declare module '@univerjs/core/facade' {
30
+ interface FUniver extends ISheetsFormulaUIMixin {
31
+ }
32
+ }
@@ -13,4 +13,5 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const useRefocus: () => void;
16
+ import './f-univer';
17
+ export * from './f-univer';
@@ -21,8 +21,9 @@ export { InsertFunctionOperation } from './commands/operations/insert-function.o
21
21
  export { MoreFunctionsOperation } from './commands/operations/more-functions.operation';
22
22
  export { ReferenceAbsoluteOperation } from './commands/operations/reference-absolute.operation';
23
23
  export { SearchFunctionOperation } from './commands/operations/search-function.operation';
24
- export { RangeSelector } from './views/range-selector/index';
25
24
  export { FormulaEditor } from './views/formula-editor/index';
25
+ export { type IRangeSelectorInstance, type IRangeSelectorProps, RangeSelector } from './views/range-selector/index';
26
26
  export { RefSelectionsRenderService } from './services/render-services/ref-selections.render-service';
27
+ export { GlobalRangeSelectorService, type IShowRangeSelectorDialogOptions } from './services/range-selector.service';
27
28
  export { FORMULA_PROMPT_ACTIVATED } from './services/prompt.service';
28
29
  export { UniverSheetsFormulaUIPlugin } from './sheets-formula-ui.plugin';
@@ -0,0 +1,14 @@
1
+ import { IUnitRangeName } from '@univerjs/core';
2
+ export interface IShowRangeSelectorDialogOptions {
3
+ unitId: string;
4
+ subUnitId: string;
5
+ initialValue?: IUnitRangeName[];
6
+ maxRangeCount?: number;
7
+ supportAcrossSheet?: boolean;
8
+ callback: (ranges: IUnitRangeName[], isCancel: boolean) => void;
9
+ }
10
+ export declare class GlobalRangeSelectorService {
11
+ private _currentSelector$;
12
+ currentSelector$: import('rxjs').Observable<IShowRangeSelectorDialogOptions | null>;
13
+ showRangeSelectorDialog(opts: IShowRangeSelectorDialogOptions): Promise<IUnitRangeName[]>;
14
+ }
@@ -1,6 +1,7 @@
1
1
  import { IUniverSheetsFormulaBaseConfig } from './controllers/config.schema';
2
2
  import { IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
3
3
  import { IRenderManagerService } from '@univerjs/engine-render';
4
+ import { IUIPartsService } from '@univerjs/ui';
4
5
  /**
5
6
  * The configuration of the formula UI plugin.
6
7
  */
@@ -9,10 +10,12 @@ export declare class UniverSheetsFormulaUIPlugin extends Plugin {
9
10
  readonly _injector: Injector;
10
11
  private readonly _renderManagerService;
11
12
  private readonly _configService;
13
+ private readonly _uiPartsService;
12
14
  static pluginName: string;
13
15
  static type: UniverInstanceType;
14
- constructor(_config: Partial<IUniverSheetsFormulaBaseConfig> | undefined, _injector: Injector, _renderManagerService: IRenderManagerService, _configService: IConfigService);
16
+ constructor(_config: Partial<IUniverSheetsFormulaBaseConfig> | undefined, _injector: Injector, _renderManagerService: IRenderManagerService, _configService: IConfigService, _uiPartsService: IUIPartsService);
15
17
  onStarting(): void;
16
18
  onRendered(): void;
17
19
  onSteady(): void;
20
+ private _initUIPart;
18
21
  }
@@ -1,6 +1,6 @@
1
1
  import { Editor } from '@univerjs/docs-ui';
2
2
  import { ISearchItem } from '@univerjs/sheets-formula';
3
- import { INode } from '../../range-selector/hooks/use-formula-token';
3
+ import { INode } from './use-formula-token';
4
4
  export declare const useFormulaSearch: (isNeed: boolean, nodes?: INode[], editor?: Editor) => {
5
5
  searchList: ISearchItem[];
6
6
  searchText: string;
@@ -31,7 +31,7 @@ export declare function calcHighlightRanges(opts: {
31
31
  * @param {IRefSelection[]} refSelections
32
32
  */
33
33
  export declare function useSheetHighlight(unitId: string, subUnitId: string): (refSelections: IRefSelection[], editor?: Editor) => void;
34
- export declare function useDocHight(_leadingCharacter?: string): (editor: Editor, sequenceNodes: INode[], isNeedResetSelection?: boolean, newSelections?: ITextRange[]) => IRefSelection[];
34
+ export declare function useDocHight(_leadingCharacter?: string): (editor: Editor, sequenceNodes: INode[], isNeedResetSelection?: any, newSelections?: ITextRange[]) => IRefSelection[];
35
35
  interface IColorMap {
36
36
  formulaRefColors: string[];
37
37
  numberColor: string;
@@ -1,4 +1,4 @@
1
1
  import { Editor } from '@univerjs/docs-ui';
2
2
  import { KeyCode, MetaKeys } from '@univerjs/ui';
3
- import { FormulaSelectingType } from '../../formula-editor/hooks/use-formula-selection';
3
+ import { FormulaSelectingType } from './use-formula-selection';
4
4
  export declare const useLeftAndRightArrow: (isNeed: boolean, shouldMoveSelection: FormulaSelectingType, editor?: Editor, onMoveInEditor?: (keyCode: KeyCode, metaKey?: MetaKeys) => void) => void;
@@ -1,5 +1,5 @@
1
1
  import { Editor } from '@univerjs/docs-ui';
2
2
  import { RefObject } from 'react';
3
- import { IRefSelection } from '../../range-selector/hooks/use-highlight';
3
+ import { IRefSelection } from './use-highlight';
4
4
  import { FormulaSelectingType } from './use-formula-selection';
5
5
  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;
@@ -1,6 +1,6 @@
1
1
  import { IKeyboardEventConfig } from '@univerjs/docs-ui';
2
2
  import { KeyCode, MetaKeys } from '@univerjs/ui';
3
- import { ReactNode, default as React } from 'react';
3
+ import { CSSProperties, ReactNode } from 'react';
4
4
  import { FormulaSelectingType } from './hooks/use-formula-selection';
5
5
  export interface IFormulaEditorProps {
6
6
  unitId: string;
@@ -30,6 +30,6 @@ export interface IFormulaEditorProps {
30
30
  */
31
31
  disableSelectionOnClick?: boolean;
32
32
  disableContextMenu?: boolean;
33
- style?: React.CSSProperties;
33
+ style?: CSSProperties;
34
34
  }
35
35
  export declare function FormulaEditor(props: IFormulaEditorProps): import("react/jsx-runtime").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 useOnlyOneRange: (unitId: string, isOnlyOneRange: boolean) => void;
16
+ export declare const GlobalRangeSelector: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { Nullable } from '@univerjs/core';
2
+ import { Editor } from '@univerjs/docs-ui';
3
+ import { ISequenceNode } from '@univerjs/engine-formula';
4
+ export declare function useRangesHighlight(editor: Nullable<Editor>, focusing: boolean, unitId: string, subUnitId: string): {
5
+ sequenceNodes: (string | ISequenceNode)[];
6
+ };
@@ -0,0 +1,7 @@
1
+ import { IUnitRangeName } from '@univerjs/core';
2
+ export declare function useRangeSelectorSelectionChange(opts: {
3
+ supportAcrossSheet?: boolean;
4
+ unitId: string;
5
+ subUnitId: string;
6
+ onChange: (ranges: IUnitRangeName[], isStart: boolean) => void;
7
+ }): void;
@@ -1,31 +1,39 @@
1
- import { IUnitRangeName } from '@univerjs/core';
2
- import { ReactNode } from 'react';
3
- export interface IRangeSelectorProps {
4
- initValue: string | IUnitRangeName[];
5
- onChange: (result: string) => void;
1
+ import { IUnitRangeName, Nullable } from '@univerjs/core';
2
+ import { Editor, IRichTextEditorProps } from '@univerjs/docs-ui';
3
+ import { ISelectionWithStyle } from '@univerjs/sheets';
4
+ export interface IRangeSelectorInstance {
5
+ editor: Nullable<Editor>;
6
+ blur: () => void;
7
+ focus: () => void;
8
+ showDialog: (ranges: IUnitRangeName[]) => void;
9
+ hideDialog: () => void;
10
+ verify: () => boolean;
11
+ getValue: () => string;
12
+ }
13
+ export interface IRangeSelectorProps extends IRichTextEditorProps {
6
14
  unitId: string;
7
15
  subUnitId: string;
8
- errorText?: string | ReactNode;
9
- onVerify?: (res: boolean, result: string) => void;
10
- placeholder?: string;
11
- isFocus?: boolean;
12
- onBlur?: () => void;
13
- onFocus?: () => void;
14
- actions?: {
15
- handleOutClick?: (e: MouseEvent, cb: () => void) => void;
16
- };
17
- /**
18
- * 是否只允许最多一个 range 区域,默认为 false。
19
- * @type {boolean}
20
- */
21
- isOnlyOneRange?: boolean;
22
- /**
23
- * 是否支持跨表选择选区.
24
- * 如果不支持,那么会舍弃所有的 sheetName 信息
25
- * @type {boolean}
26
- * @memberof IRangeSelectorProps
27
- */
28
- isSupportAcrossSheet?: boolean;
16
+ maxRangeCount?: number;
17
+ supportAcrossSheet?: boolean;
18
+ selectorRef?: React.RefObject<IRangeSelectorInstance | null>;
19
+ onVerify?: (res: boolean, rangeText: string) => void;
29
20
  onRangeSelectorDialogVisibleChange?: (visible: boolean) => void;
21
+ hideEditor?: boolean;
22
+ forceShowDialogWhenSelectionChanged?: boolean;
23
+ resetRange?: ISelectionWithStyle[];
24
+ }
25
+ export interface IRangeSelectorDialogProps {
26
+ visible: boolean;
27
+ initialValue: IUnitRangeName[];
28
+ unitId: string;
29
+ subUnitId: string;
30
+ maxRangeCount?: number;
31
+ supportAcrossSheet?: boolean;
32
+ onConfirm: (ranges: IUnitRangeName[]) => void;
33
+ onClose: () => void;
34
+ onShowBySelection?: (ranges: IUnitRangeName[]) => boolean;
30
35
  }
36
+ export declare function RangeSelectorDialog(props: IRangeSelectorDialogProps): import("react/jsx-runtime").JSX.Element;
37
+ export declare function parseRanges(rangeString: string): IUnitRangeName[];
38
+ export declare function stringifyRanges(ranges: IUnitRangeName[]): string;
31
39
  export declare function RangeSelector(props: IRangeSelectorProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { ISequenceNode } from '@univerjs/engine-formula';
2
+ /**
3
+ * @param {((string | ISequenceNode)[])} sequenceNodes
4
+ * @return {*}
5
+ */
6
+ export declare const verifyRange: (sequenceNodes: (string | ISequenceNode)[]) => boolean;
@@ -0,0 +1 @@
1
+ (function(e,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("@univerjs/core/facade"),require("@univerjs/sheets-formula-ui")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core/facade","@univerjs/sheets-formula-ui"],r):(e=typeof globalThis<"u"?globalThis:e||self,r(e.UniverSheetsFormulaUiFacade={},e.UniverCoreFacade,e.UniverSheetsFormulaUi))})(this,function(e,r,n){"use strict";class i extends r.FUniver{showRangeSelectorDialog(o){return this._injector.get(n.GlobalRangeSelectorService).showRangeSelectorDialog(o)}}r.FUniver.extend(i),e.FSheetsFormulaUIUniver=i,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});