@univerjs/sheets 0.5.1 → 0.5.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 (34) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +3 -3
  3. package/lib/es/facade.js +1959 -500
  4. package/lib/es/index.js +3640 -3263
  5. package/lib/types/basics/cell-position.d.ts +25 -0
  6. package/lib/types/basics/index.d.ts +1 -0
  7. package/lib/types/basics/selection.d.ts +1 -1
  8. package/lib/types/basics/split-range-text.d.ts +42 -0
  9. package/lib/types/commands/commands/__tests__/set-gridlines-command.spec.d.ts +16 -0
  10. package/lib/types/commands/commands/add-worksheet-merge.command.d.ts +1 -1
  11. package/lib/types/commands/commands/set-gridlines-color.command.d.ts +7 -0
  12. package/lib/types/commands/commands/set-worksheet-show.command.d.ts +0 -1
  13. package/lib/types/commands/commands/split-text-to-columns.command.d.ts +15 -0
  14. package/lib/types/commands/mutations/set-gridlines-color.mutation.d.ts +12 -0
  15. package/lib/types/controllers/defined-name-data.controller.d.ts +1 -0
  16. package/lib/types/facade/f-defined-name.d.ts +294 -0
  17. package/lib/types/facade/f-permission.d.ts +49 -1
  18. package/lib/types/facade/f-range.d.ts +96 -5
  19. package/lib/types/facade/f-selection.d.ts +71 -1
  20. package/lib/types/facade/f-univer.d.ts +17 -3
  21. package/lib/types/facade/f-workbook.d.ts +345 -7
  22. package/lib/types/facade/f-worksheet.d.ts +350 -11
  23. package/lib/types/index.d.ts +13 -2
  24. package/lib/types/services/__tests__/move-active-cell.spec.d.ts +16 -0
  25. package/lib/types/services/exclusive-range/exclusive-range-service.d.ts +12 -0
  26. package/lib/types/services/permission/permission-point/const.d.ts +82 -0
  27. package/lib/types/services/ref-range/util.d.ts +1 -1
  28. package/lib/types/services/selections/index.d.ts +1 -1
  29. package/lib/types/services/selections/move-active-cell-util.d.ts +10 -0
  30. package/lib/types/services/selections/selection-data-model.d.ts +5 -10
  31. package/lib/types/services/selections/selection.service.d.ts +21 -1
  32. package/lib/umd/facade.js +1 -1
  33. package/lib/umd/index.js +3 -3
  34. package/package.json +8 -8
@@ -1,16 +1,25 @@
1
- import { CustomData, ICellData, IDisposable, IFreeze, IObjectArrayPrimitiveType, IStyleData, Nullable, Workbook, Worksheet, FBase, ICommandService, Injector, ObjectMatrix } from '@univerjs/core';
1
+ import { CustomData, ICellData, IDisposable, IFreeze, IObjectArrayPrimitiveType, IStyleData, Nullable, Workbook, Worksheet, FBase, ICommandService, ILogService, Injector, ObjectMatrix } from '@univerjs/core';
2
+ import { FDefinedName } from './f-defined-name';
2
3
  import { FWorkbook } from './f-workbook';
3
4
  import { SheetsSelectionsService } from '@univerjs/sheets';
4
5
  import { FRange } from './f-range';
5
6
  import { FSelection } from './f-selection';
7
+ interface IFacadeClearOptions {
8
+ contentsOnly?: boolean;
9
+ formatOnly?: boolean;
10
+ }
11
+ /**
12
+ * Represents a worksheet facade api instance. Which provides a set of methods to interact with the worksheet.
13
+ */
6
14
  export declare class FWorksheet extends FBase {
7
15
  protected readonly _fWorkbook: FWorkbook;
8
16
  protected readonly _workbook: Workbook;
9
17
  protected readonly _worksheet: Worksheet;
10
18
  protected readonly _injector: Injector;
11
19
  protected readonly _selectionManagerService: SheetsSelectionsService;
20
+ protected readonly _logService: ILogService;
12
21
  protected readonly _commandService: ICommandService;
13
- constructor(_fWorkbook: FWorkbook, _workbook: Workbook, _worksheet: Worksheet, _injector: Injector, _selectionManagerService: SheetsSelectionsService, _commandService: ICommandService);
22
+ constructor(_fWorkbook: FWorkbook, _workbook: Workbook, _worksheet: Worksheet, _injector: Injector, _selectionManagerService: SheetsSelectionsService, _logService: ILogService, _commandService: ICommandService);
14
23
  /**
15
24
  * Returns the injector
16
25
  * @returns The injector
@@ -18,23 +27,27 @@ export declare class FWorksheet extends FBase {
18
27
  getInject(): Injector;
19
28
  /**
20
29
  * Returns the workbook
21
- * @returns The workbook
30
+ * @returns {Workbook} The workbook instance.
22
31
  */
23
32
  getWorkbook(): Workbook;
24
33
  /**
25
- * Returns the worksheet id
26
- * @returns The id of the worksheet
34
+ * Returns the worksheet id.
35
+ * @returns {string} The id of the worksheet.
27
36
  */
28
37
  getSheetId(): string;
29
38
  /**
30
- * Returns the worksheet name
31
- * @returns The name of the worksheet
39
+ * Returns the worksheet name.
40
+ * @returns {string} The name of the worksheet.
32
41
  */
33
42
  getSheetName(): string;
43
+ /**
44
+ * Represents the selection ranges info of the worksheet.
45
+ * @returns {FSelection} return the current selections of the worksheet or null if there is no selection.
46
+ */
34
47
  getSelection(): FSelection | null;
35
48
  /**
36
49
  * Get the default style of the worksheet
37
- * @returns Default style
50
+ * @returns {IStyleData} Default style of the worksheet.
38
51
  */
39
52
  getDefaultStyle(): Nullable<IStyleData> | string;
40
53
  /**
@@ -53,20 +66,22 @@ export declare class FWorksheet extends FBase {
53
66
  getColumnDefaultStyle(index: number, keepRaw?: boolean): Nullable<IStyleData> | string;
54
67
  /**
55
68
  * Set the default style of the worksheet
56
- * @param style default style
57
- * @returns this worksheet
69
+ * @param {StyleDataInfo} style default style
70
+ * @returns {Promise<FWorksheet>} This sheet, for chaining.
58
71
  */
59
72
  setDefaultStyle(style: string): Promise<FWorksheet>;
60
73
  /**
61
74
  * Set the default style of the worksheet row
62
75
  * @param {number} index The row index
63
76
  * @param {string | Nullable<IStyleData>} style The style name or style data
77
+ * @returns {Promise<FWorksheet>} This sheet, for chaining.
64
78
  */
65
79
  setColumnDefaultStyle(index: number, style: string | Nullable<IStyleData>): Promise<FWorksheet>;
66
80
  /**
67
81
  * Set the default style of the worksheet column
68
82
  * @param {number} index The column index
69
83
  * @param {string | Nullable<IStyleData>} style The style name or style data
84
+ * @returns {Promise<FWorksheet>} This sheet, for chaining.
70
85
  */
71
86
  setRowDefaultStyle(index: number, style: string | Nullable<IStyleData>): Promise<FWorksheet>;
72
87
  /**
@@ -346,7 +361,10 @@ export declare class FWorksheet extends FBase {
346
361
  setActiveSelection: (range: FRange) => void;
347
362
  /**
348
363
  * Sets the frozen state of the current sheet.
349
- * @param freeze - The freeze object containing the parameters for freezing the sheet.
364
+ * @param freeze - the scrolling viewport start range and count of freezed rows and columns.
365
+ * that means if you want to freeze the first 3 rows and 2 columns, you should set freeze as { startRow: 3, startColumn: 2, xSplit: 2, ySplit: 3 }
366
+ *
367
+ * @deprecated use `setFrozenRows` and `setFrozenColumns` instead.
350
368
  * @returns True if the command was successful, false otherwise.
351
369
  */
352
370
  setFreeze(freeze: IFreeze): boolean;
@@ -358,6 +376,8 @@ export declare class FWorksheet extends FBase {
358
376
  /**
359
377
  * Get the freeze state of the current sheet.
360
378
  * @returns The freeze state of the current sheet.
379
+ *
380
+ * @deprecated use `getRowFreezeStatus` and `getColumnFreezeStatus` instead.
361
381
  */
362
382
  getFreeze(): IFreeze;
363
383
  /**
@@ -366,12 +386,44 @@ export declare class FWorksheet extends FBase {
366
386
  * To unfreeze all columns, set this value to 0.
367
387
  */
368
388
  setFrozenColumns(columns: number): void;
389
+ /**
390
+ * Set freeze column, then the range from startColumn to endColumn will be fixed.
391
+ * e.g. setFrozenColumns(0, 2) will fix the column range from 0 to 2.
392
+ * e.g. setFrozenColumns(2, 3) will fix the column range from 2 to 3, And column from 0 to 1 will be invisible.
393
+ *
394
+ * @example
395
+ * ``` ts
396
+ * const fWorkbook = univerAPI.getActiveWorkbook();
397
+ * const fWorkSheet = fWorkbook.getActiveSheet();
398
+ * // freeze the first too columns.
399
+ * fWorkSheet.setFrozenColumns(0, 2);
400
+ * ```
401
+ * @param startColumn
402
+ * @param endColumn
403
+ */
404
+ setFrozenColumns(startColumn: number, endColumn: number): void;
369
405
  /**
370
406
  * Set the number of frozen rows.
371
407
  * @param rows The number of rows to freeze.
372
408
  * To unfreeze all rows, set this value to 0.
373
409
  */
374
410
  setFrozenRows(rows: number): void;
411
+ /**
412
+ * Set freeze row, then the range from startRow to endRow will be fixed.
413
+ * e.g. setFrozenRows(0, 2) will fix the row range from 0 to 2.
414
+ * e.g. setFrozenRows(2, 3) will fix the row range from 2 to 3, And row from 0 to 1 will be invisible.
415
+ * @param startRow
416
+ * @param endRow
417
+ *
418
+ * @example
419
+ * ``` ts
420
+ * const fWorkbook = univerAPI.getActiveWorkbook();
421
+ * const fWorkSheet = fWorkbook.getActiveSheet();
422
+ * // freeze the first too rows.
423
+ * fWorkSheet.setFrozenRows(0, 2);
424
+ * ```
425
+ */
426
+ setFrozenRows(startColumn: number, endColumn: number): void;
375
427
  /**
376
428
  * Get the number of frozen columns.
377
429
  * @returns The number of frozen columns.
@@ -384,25 +436,312 @@ export declare class FWorksheet extends FBase {
384
436
  * Returns 0 if no rows are frozen.
385
437
  */
386
438
  getFrozenRows(): number;
439
+ /**
440
+ * Get freezed rows.
441
+ */
442
+ getFrozenRowRange(): {
443
+ startRow: number;
444
+ endRow: number;
445
+ };
446
+ /**
447
+ * Get freezed columns
448
+ */
449
+ getFrozenColumnRange(): {
450
+ startColumn: number;
451
+ endColumn: number;
452
+ };
387
453
  /**
388
454
  * Returns true if the sheet's gridlines are hidden; otherwise returns false. Gridlines are visible by default.
455
+ * @returns {boolean} True if the sheet's gridlines are hidden; otherwise false.
456
+ * @example
457
+ * ```ts
458
+ * const fWorkbook = univerAPI.getActiveWorkbook();
459
+ * const fWorkSheet = fWorkbook.getActiveSheet();
460
+ * // check if the gridlines are hidden
461
+ * if (fWorkSheet.hasHiddenGridLines()) {
462
+ * console.log('Gridlines are hidden');
463
+ * }
464
+ * ```
389
465
  */
390
466
  hasHiddenGridLines(): boolean;
391
467
  /**
392
468
  * Hides or reveals the sheet gridlines.
393
469
  * @param {boolean} hidden If `true`, hide gridlines in this sheet; otherwise show the gridlines.
470
+ * @example
471
+ * ``` ts
472
+ * const fWorkbook = univerAPI.getActiveWorkbook();
473
+ * const fWorkSheet = fWorkbook.getActiveSheet();
474
+ * // hide the gridlines
475
+ * fWorkSheet.setHiddenGridlines(true);
476
+ * ```
394
477
  */
395
478
  setHiddenGridlines(hidden: boolean): Promise<boolean>;
479
+ /**
480
+ * Set the color of the gridlines in the sheet.
481
+ * @param {string|undefined} color The color to set for the gridlines.Undefined or null to reset to the default color.
482
+ * @returns {Promise<boolean>} True if the command was successful, false otherwise.
483
+ * @example
484
+ * ```ts
485
+ * const fWorkbook = univerAPI.getActiveWorkbook();
486
+ * const fWorkSheet = fWorkbook.getActiveSheet();
487
+ * // set the gridlines color to red
488
+ * fWorkSheet.setGridLinesColor('#ff0000');
489
+ * ```
490
+ */
491
+ setGridLinesColor(color: string | undefined): Promise<boolean>;
492
+ /**
493
+ * Get the color of the gridlines in the sheet.
494
+ * @returns {string | undefined} The color of the gridlines in the sheet or undefined. The default color is 'rgb(214, 216, 219)'.
495
+ */
496
+ getGridLinesColor(): string | undefined;
497
+ /**
498
+ * Sets the sheet tab color.
499
+ * @param {string|null|undefined} color A color code in CSS notation (like '#ffffff' or 'white'), or null to reset the tab color.
500
+ * @returns {Promise<boolean>} True if the command was successful, false otherwise.
501
+ * @example
502
+ * ```ts
503
+ * const fWorkbook = univerAPI.getActiveWorkbook();
504
+ * const fWorkSheet = fWorkbook.getActiveSheet();
505
+ * // set the tab color to red
506
+ * fWorkSheet.setTabColor('#ff0000');
507
+ * ```
508
+ */
509
+ setTabColor(color: string): Promise<boolean>;
510
+ /**
511
+ * Get the tab color of the sheet.
512
+ * @returns {string} The tab color of the sheet or undefined.
513
+ * The default color is css style property 'unset'.
514
+ * @example
515
+ * ```ts
516
+ * const fWorkbook = univerAPI.getActiveWorkbook();
517
+ * const fWorkSheet = fWorkbook.getActiveSheet();
518
+ * // get the tab color of the sheet
519
+ * console.log(fWorkSheet.getTabColor());
520
+ * ```
521
+ */
522
+ getTabColor(): string | undefined;
396
523
  /**
397
524
  * Subscribe to the cell data change event.
398
525
  * @param callback - The callback function to be executed when the cell data changes.
399
526
  * @returns - A disposable object to unsubscribe from the event.
527
+ * @example
528
+ * ```ts
529
+ * const fWorkbook = univerAPI.getActiveWorkbook();
530
+ * const fWorkSheet = fWorkbook.getActiveSheet();
531
+ * // subscribe to the cell data change event
532
+ * const disposable = fWorkSheet.onCellDataChange((cellValue) => {
533
+ * console.log(cellValue.toArray());
534
+ * });
535
+ * // unsubscribe from the event
536
+ * disposable.dispose();
537
+ * ```
400
538
  */
401
539
  onCellDataChange(callback: (cellValue: ObjectMatrix<Nullable<ICellData>>) => void): IDisposable;
402
540
  /**
403
541
  * Subscribe to the cell data change event.
404
542
  * @param callback - The callback function to be executed before the cell data changes.
405
543
  * @returns - A disposable object to unsubscribe from the event.
544
+ * @example
545
+ * ```ts
546
+ * const fWorkbook = univerAPI.getActiveWorkbook();
547
+ * const fWorkSheet = fWorkbook.getActiveSheet();
548
+ * // subscribe to the cell data change event
549
+ * const disposable = fWorkSheet.onBeforeCellDataChange((cellValue) => {
550
+ * console.log(cellValue.toArray());
551
+ * });
552
+ * // unsubscribe from the event
553
+ * disposable.dispose();
554
+ * ```
406
555
  */
407
556
  onBeforeCellDataChange(callback: (cellValue: ObjectMatrix<Nullable<ICellData>>) => void): IDisposable;
557
+ /**
558
+ * Hides this sheet. Has no effect if the sheet is already hidden. If this method is called on the only visible sheet, it throws an exception.
559
+ * @example
560
+ * ```ts
561
+ * const fWorkbook = univerAPI.getActiveWorkbook();
562
+ * const fWorkSheet = fWorkbook.getActiveSheet();
563
+ * // hide the active sheet
564
+ * fWorkSheet.hideSheet();
565
+ * ``
566
+ */
567
+ hideSheet(): void;
568
+ /**
569
+ * Shows this sheet. Has no effect if the sheet is already visible.
570
+ * @returns {Promise<boolean>} True if the command was successful, false otherwise.
571
+ * @example
572
+ * ```ts
573
+ * const fWorkbook = univerAPI.getActiveWorkbook();
574
+ * const fWorkSheets = fWorkbook.getSheets();
575
+ * // show the last sheet
576
+ * fWorkSheets[fWorkSheets.length - 1].showSheet();
577
+ * ```
578
+ */
579
+ showSheet(): Promise<boolean>;
580
+ /**
581
+ * Returns true if the sheet is currently hidden.
582
+ * @returns {boolean} True if the sheet is hidden; otherwise, false.
583
+ */
584
+ isSheetHidden(): boolean;
585
+ /**
586
+ * Sets the sheet name.
587
+ * @param {string} name The new name for the sheet.
588
+ * @returns {Promise<boolean>} True if the command was successful, false otherwise.
589
+ * @example
590
+ * ```ts
591
+ * const fWorkbook = univerAPI.getActiveWorkbook();
592
+ * const fWorkSheet = fWorkbook.getActiveSheet();
593
+ * // set the sheet name to 'Sheet1'
594
+ * fWorkSheet.setName('Sheet1');
595
+ * ```
596
+ */
597
+ setName(name: string): Promise<boolean>;
598
+ /**
599
+ * Activates this sheet. Does not alter the sheet itself, only the parent's notion of the active sheet.
600
+ * @returns Current sheet, for chaining.
601
+ */
602
+ activate(): FWorksheet;
603
+ /**
604
+ * Gets the position of the sheet in its parent spreadsheet. Starts at 0.
605
+ * @returns {number} The position of the sheet in its parent spreadsheet.
606
+ * @example
607
+ * ```ts
608
+ * const fWorkbook = univerAPI.getActiveWorkbook();
609
+ * const fWorkSheet = fWorkbook.getActiveSheet();
610
+ * // get the position of the active sheet
611
+ * const position = fWorkSheet.getIndex();
612
+ * console.log(position); // 0
613
+ * ```
614
+ */
615
+ getIndex(): number;
616
+ /**
617
+ * Clears the sheet of content and formatting information.Or Optionally clears only the contents or only the formatting.
618
+ * @param {IFacadeClearOptions} [options] Options for clearing the sheet. If not provided, the contents and formatting are cleared both.
619
+ * @param {boolean} [options.contentsOnly] If true, the contents of the sheet are cleared. If false, the contents and formatting are cleared. Default is false.
620
+ * @param {boolean} [options.formatOnly] If true, the formatting of the sheet is cleared. If false, the contents and formatting are cleared. Default is false.
621
+ * @returns {Promise<boolean>} True if the command was successful, false otherwise.
622
+ * @example
623
+ * ```ts
624
+ * const fWorkbook = univerAPI.getActiveWorkbook();
625
+ * const fWorkSheet = fWorkbook.getActiveSheet();
626
+ * // clear the sheet of content and formatting information
627
+ * fWorkSheet.clear();
628
+ * // clear the sheet of content only
629
+ * fWorkSheet.clear({ contentsOnly: true });
630
+ * ```
631
+ */
632
+ clear(options?: IFacadeClearOptions): Promise<boolean>;
633
+ /**
634
+ * Clears the sheet of contents, while preserving formatting information.
635
+ * @returns {Promise<boolean>} True if the command was successful, false otherwise.
636
+ * @example
637
+ * ```ts
638
+ * const fWorkbook = univerAPI.getActiveWorkbook();
639
+ * const fWorkSheet = fWorkbook.getActiveSheet();
640
+ * // clear the sheet of content only
641
+ * fWorkSheet.clearContents();
642
+ * ```
643
+ */
644
+ clearContents(): Promise<boolean>;
645
+ /**
646
+ * Clears the sheet of formatting, while preserving contents.
647
+ * @returns {Promise<boolean>} True if the command was successful, false otherwise.
648
+ * @example
649
+ * ```ts
650
+ * const fWorkbook = univerAPI.getActiveWorkbook();
651
+ * const fWorkSheet = fWorkbook.getActiveSheet();
652
+ * // clear the sheet of formatting only
653
+ * fWorkSheet.clearFormats();
654
+ * ```
655
+ */
656
+ clearFormats(): Promise<boolean>;
657
+ /**
658
+ * Returns a Range corresponding to the dimensions in which data is present.
659
+ * This is functionally equivalent to creating a Range bounded by A1 and (Sheet.getLastColumns(), Sheet.getLastRows()).
660
+ * @returns {FRange} The range of the data in the sheet.
661
+ * @example
662
+ * ```ts
663
+ * const fWorkbook = univerAPI.getActiveWorkbook();
664
+ * const fWorkSheet = fWorkbook.getActiveSheet();
665
+ * // the sheet is a empty sheet
666
+ * const cellRange = fWorkSheet.getRange(200, 10, 1, 1);
667
+ * cellRange.setValue('Hello World');
668
+ * console.log(fWorkSheet.getDataRange().getA1Notation()); // A1:J200
669
+ * ```
670
+ */
671
+ getDataRange(): FRange;
672
+ /**
673
+ * Returns the position of the last column that has content.
674
+ * @returns {number} the last column of the sheet that contains content.
675
+ * @example
676
+ * ```ts
677
+ * const fWorkbook = univerAPI.getActiveWorkbook();
678
+ * const fWorkSheet = fWorkbook.getActiveSheet();
679
+ * const fRange = fWorkSheet.getRange(100, 20, 1, 1);
680
+ * console.log(fWorkSheet.getLastColumns()); // 20
681
+ * ```
682
+ */
683
+ getLastColumns(): number;
684
+ /**
685
+ * Returns the position of the last column that has content. Same as getLastColumns.
686
+ * @returns {number} the last column of the sheet that contains content.
687
+ * @example
688
+ * ```ts
689
+ * const fWorkbook = univerAPI.getActiveWorkbook();
690
+ * const fWorkSheet = fWorkbook.getActiveSheet();
691
+ * const fRange = fWorkSheet.getRange(100, 20, 1, 1);
692
+ * console.log(fWorkSheet.getLastColumn());
693
+ * ```
694
+ */
695
+ getLastColumn(): number;
696
+ /**
697
+ * Returns the position of the last row that has content.
698
+ * @returns {number} the last row of the sheet that contains content.
699
+ * @example
700
+ * ```ts
701
+ * const fWorkbook = univerAPI.getActiveWorkbook();
702
+ * const fWorkSheet = fWorkbook.getActiveSheet();
703
+ * const fRange = fWorkSheet.getRange(100,1,1,1);
704
+ * fRange.setValue('Hello World');
705
+ * console.log(fWorkSheet.getLastRows()); // 100
706
+ */
707
+ getLastRows(): number;
708
+ /**
709
+ * Returns the position of the last row that has content, same as getLastRows().
710
+ * @returns {number} the last row of the sheet that contains content.
711
+ * @example
712
+ * ```ts
713
+ * const fWorkbook = univerAPI.getActiveWorkbook();
714
+ * const fWorkSheet = fWorkbook.getActiveSheet();
715
+ * const fRange = fWorkSheet.getRange(100,1,1,1);
716
+ * fRange.setValue('Hello World');
717
+ * console.log(fWorkSheet.getLastRow());
718
+ */
719
+ getLastRow(): number;
720
+ /**
721
+ * Judge whether provided FWorksheet is equal to current.
722
+ * @param {FWorksheet} other the FWorksheet to compare with.
723
+ * @returns {boolean} true if the FWorksheet is equal to the current FWorksheet, false otherwise.
724
+ * @example
725
+ * ```ts
726
+ * const fWorkbook = univerAPI.getActiveWorkbook();
727
+ * const fWorkSheet = fWorkbook.getActiveSheet();
728
+ * const fWorkSheet2 = fWorkbook.getSheetByName('Sheet1');
729
+ * console.log(fWorkSheet.equals(fWorkSheet2)); // true, if the active sheet is 'Sheet1'
730
+ * ```
731
+ */
732
+ equalTo(other: FWorksheet): boolean;
733
+ insertDefinedName(name: string, formulaOrRefString: string): void;
734
+ /**
735
+ * Get all the defined names in the worksheet.
736
+ * @returns {FDefinedName[]} All the defined names in the worksheet
737
+ * @example
738
+ * ```ts
739
+ * // The code below gets all the defined names in the worksheet
740
+ * const activeSpreadsheet = univerAPI.getActiveWorkbook();
741
+ * const sheet1 = activeSpreadsheet.getSheetByName('Sheet1');
742
+ * const definedNames = sheet1.getDefinedNames();
743
+ * ```
744
+ */
745
+ getDefinedNames(): FDefinedName[];
408
746
  }
747
+ export {};
@@ -24,7 +24,7 @@ export { BorderStyleManagerService, type IBorderInfo } from './services/border-s
24
24
  export * from './services/permission/permission-point';
25
25
  export { WorksheetPermissionService } from './services/permission/worksheet-permission/worksheet-permission.service';
26
26
  export { WorkbookPermissionService } from './services/permission/workbook-permission/workbook-permission.service';
27
- export { DISABLE_NORMAL_SELECTIONS, IRefSelectionsService, RefSelectionsService, SelectionMoveType, SheetsSelectionsService, WorkbookSelectionModel, } from './services/selections';
27
+ export * from './services/selections';
28
28
  export { getAddMergeMutationRangeByType } from './controllers/merge-cell.controller';
29
29
  export { NumfmtService } from './services/numfmt/numfmt.service';
30
30
  export type { INumfmtItem, INumfmtItemWithCache } from './services/numfmt/type';
@@ -33,7 +33,8 @@ export { RefRangeService } from './services/ref-range/ref-range.service';
33
33
  export type { EffectRefRangeParams, IOperator } from './services/ref-range/type';
34
34
  export { EffectRefRangId, OperatorType } from './services/ref-range/type';
35
35
  export { DefinedNameDataController } from './controllers/defined-name-data.controller';
36
- export { getSeparateEffectedRangesOnCommand, handleBaseInsertRange, handleBaseMoveRowsCols, handleBaseRemoveRange, handleCommonDefaultRangeChangeWithEffectRefCommands, handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests, handleDefaultRangeChangeWithEffectRefCommands, handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests, handleDeleteRangeMoveLeft, handleDeleteRangeMoveUp, handleInsertCol, handleInsertRangeMoveDown, handleInsertRangeMoveRight, handleInsertRow, handleIRemoveCol, handleIRemoveRow, handleMoveCols, handleMoveRange, handleMoveRows, rotateRange, runRefRangeMutations, } from './services/ref-range/util';
36
+ export { adjustRangeOnMutation, getSeparateEffectedRangesOnCommand, handleBaseInsertRange, handleBaseMoveRowsCols, handleBaseRemoveRange, handleCommonDefaultRangeChangeWithEffectRefCommands, handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests, handleDefaultRangeChangeWithEffectRefCommands, handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests, handleDeleteRangeMoveLeft, handleDeleteRangeMoveUp, handleInsertCol, handleInsertRangeMoveDown, handleInsertRangeMoveRight, handleInsertRow, handleIRemoveCol, handleIRemoveRow, handleMoveCols, handleMoveRange, handleMoveRows, rotateRange, runRefRangeMutations, } from './services/ref-range/util';
37
+ export type { MutationsAffectRange } from './services/ref-range/util';
37
38
  export { InterceptCellContentPriority, INTERCEPTOR_POINT } from './services/sheet-interceptor/interceptor-const';
38
39
  export { AFTER_CELL_EDIT, AFTER_CELL_EDIT_ASYNC, BEFORE_CELL_EDIT, SheetInterceptorService } from './services/sheet-interceptor/sheet-interceptor.service';
39
40
  export type { ISheetLocation, ISheetLocationBase, ISheetRowLocation } from './services/sheet-interceptor/utils/interceptor';
@@ -41,12 +42,16 @@ export { MERGE_CELL_INTERCEPTOR_CHECK, MergeCellController } from './controllers
41
42
  export { AddMergeRedoSelectionsOperationFactory, AddMergeUndoSelectionsOperationFactory } from './commands/utils/handle-merge-operation';
42
43
  export type { FormatType } from './services/numfmt/type';
43
44
  export { expandToContinuousRange } from './basics/expand-range';
45
+ export { splitRangeText } from './basics/split-range-text';
46
+ export type { SplitDelimiterEnum } from './basics/split-range-text';
47
+ export { getNextPrimaryCell } from './services/selections/move-active-cell-util';
44
48
  export { ExclusiveRangeService, IExclusiveRangeService } from './services/exclusive-range/exclusive-range-service';
45
49
  export { defaultWorksheetPermissionPoint, getAllWorksheetPermissionPoint, getAllWorksheetPermissionPointByPointPanel } from './services/permission';
46
50
  export type { IWorksheetProtectionRule } from './services/permission/type';
47
51
  export { WorksheetProtectionPointModel, WorksheetProtectionRuleModel } from './services/permission/worksheet-permission';
48
52
  export { defaultWorkbookPermissionPoints, getAllWorkbookPermissionPoint } from './services/permission/workbook-permission';
49
53
  export { WorkbookCommentPermission, WorkbookCopyPermission, WorkbookCreateProtectPermission, WorkbookCreateSheetPermission, WorkbookDeleteSheetPermission, WorkbookDuplicatePermission, WorkbookEditablePermission, WorkbookExportPermission, WorkbookHideSheetPermission, WorkbookHistoryPermission, WorkbookManageCollaboratorPermission, WorkbookMoveSheetPermission, WorkbookPrintPermission, WorkbookRecoverHistoryPermission, WorkbookRenameSheetPermission, WorkbookSharePermission, WorkbookViewHistoryPermission, WorkbookViewPermission, WorksheetCopyPermission, WorksheetDeleteColumnPermission, WorksheetDeleteProtectionPermission, WorksheetDeleteRowPermission, WorksheetEditExtraObjectPermission, WorksheetEditPermission, WorksheetFilterPermission, WorksheetInsertColumnPermission, WorksheetInsertHyperlinkPermission, WorksheetInsertRowPermission, WorksheetManageCollaboratorPermission, WorksheetPivotTablePermission, WorksheetSelectProtectedCellsPermission, WorksheetSelectUnProtectedCellsPermission, WorksheetSetCellStylePermission, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, WorksheetSortPermission, WorksheetViewPermission, } from './services/permission/permission-point';
54
+ export { PermissionPointsDefinitions } from './services/permission/permission-point/const';
50
55
  export { UnitAction, UnitObject } from '@univerjs/protocol';
51
56
  export { checkRangesEditablePermission } from './services/permission/util';
52
57
  export { type ICellPermission, RangeProtectionRenderModel } from './model/range-protection-render.model';
@@ -108,6 +113,7 @@ export { SetDefinedNameCommand } from './commands/commands/set-defined-name.comm
108
113
  export { type ICancelFrozenCommandParams, type ISetFrozenCommandParams } from './commands/commands/set-frozen.command';
109
114
  export { CancelFrozenCommand, SetFrozenCommand } from './commands/commands/set-frozen.command';
110
115
  export { type IToggleGridlinesCommandParams, ToggleGridlinesCommand } from './commands/commands/toggle-gridlines.command';
116
+ export { type ISetGridlinesColorCommandParams, SetGridlinesColorCommand } from './commands/commands/set-gridlines-color.command';
111
117
  export { type ISetRangeValuesCommandParams, SetRangeValuesCommand } from './commands/commands/set-range-values.command';
112
118
  export { type ISetSpecificRowsVisibleCommandParams, SetRowHiddenCommand, SetSelectedRowsVisibleCommand, SetSpecificRowsVisibleCommand, } from './commands/commands/set-row-visible.command';
113
119
  export { type ISetColorCommandParams, type ISetFontFamilyCommandParams, type ISetFontSizeCommandParams, type ISetHorizontalTextAlignCommandParams, type ISetStyleCommandParams, type ISetTextRotationCommandParams, type ISetTextWrapCommandParams, type ISetVerticalTextAlignCommandParams, type IStyleTypeValue, ResetBackgroundColorCommand, ResetTextColorCommand, SetBackgroundColorCommand, SetBoldCommand, SetFontFamilyCommand, SetFontSizeCommand, SetHorizontalTextAlignCommand, SetItalicCommand, SetOverlineCommand, SetStrikeThroughCommand, SetStyleCommand, SetTextColorCommand, SetTextRotationCommand, SetTextWrapCommand, SetUnderlineCommand, SetVerticalTextAlignCommand, } from './commands/commands/set-style.command';
@@ -122,6 +128,8 @@ export { SetWorksheetPermissionPointsCommand } from './commands/commands/set-wor
122
128
  export { SetWorksheetRightToLeftCommand } from './commands/commands/set-worksheet-right-to-left.command';
123
129
  export { DeltaRowHeightCommand, type IDeltaRowHeightCommand, type ISetWorksheetRowIsAutoHeightCommandParams, SetRowHeightCommand, SetWorksheetRowIsAutoHeightCommand, } from './commands/commands/set-worksheet-row-height.command';
124
130
  export { SetWorksheetShowCommand } from './commands/commands/set-worksheet-show.command';
131
+ export { SplitTextToColumnsCommand } from './commands/commands/split-text-to-columns.command';
132
+ export type { ISplitTextToColumnsCommandParams } from './commands/commands/split-text-to-columns.command';
125
133
  export type { ISetWorksheetShowCommandParams } from './commands/commands/set-worksheet-show.command';
126
134
  export { AddRangeProtectionMutation, FactoryAddRangeProtectionMutation, type IAddRangeProtectionMutationParams } from './commands/mutations/add-range-protection.mutation';
127
135
  export { SetProtectionCommand } from './commands/commands/set-protection.command';
@@ -143,6 +151,7 @@ export { type IReorderRangeMutationParams, ReorderRangeMutation, ReorderRangeUnd
143
151
  export { type ISetColHiddenMutationParams, type ISetColVisibleMutationParams, SetColHiddenMutation, SetColVisibleMutation, } from './commands/mutations/set-col-visible.mutation';
144
152
  export { type ISetFrozenMutationParams, SetFrozenMutation, SetFrozenMutationFactory, } from './commands/mutations/set-frozen.mutation';
145
153
  export { type IToggleGridlinesMutationParams, ToggleGridlinesMutation } from './commands/mutations/toggle-gridlines.mutation';
154
+ export { type ISetGridlinesColorMutationParams, SetGridlinesColorMutation } from './commands/mutations/set-gridlines-color.mutation';
146
155
  export { FactorySetRangeProtectionMutation, type ISetRangeProtectionMutationParams, SetRangeProtectionMutation } from './commands/mutations/set-range-protection.mutation';
147
156
  export { type ISetRangeValuesMutationParams, type ISetRangeValuesRangeMutationParams, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, } from './commands/mutations/set-range-values.mutation';
148
157
  export { type ISetRowHiddenMutationParams, type ISetRowVisibleMutationParams, SetRowHiddenMutation, SetRowVisibleMutation, } from './commands/mutations/set-row-visible.mutation';
@@ -162,3 +171,5 @@ export { ScrollToCellOperation } from './commands/operations/scroll-to-cell.oper
162
171
  export { type ISetSelectionsOperationParams, SetSelectionsOperation } from './commands/operations/selection.operation';
163
172
  export { type ISetWorksheetActiveOperationParams, SetWorksheetActiveOperation } from './commands/operations/set-worksheet-active.operation';
164
173
  export { type IToggleCellCheckboxCommandParams, ToggleCellCheckboxCommand } from './commands/commands/toggle-checkbox.command';
174
+ export { SCOPE_WORKBOOK_VALUE_DEFINED_NAME } from './controllers/defined-name-data.controller';
175
+ export type { ICellOverGridPosition, ISheetOverGridPosition } from './basics/cell-position';
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export {};
@@ -1,10 +1,16 @@
1
1
  import { IRange, Disposable } from '@univerjs/core';
2
+ import { Observable } from 'rxjs';
2
3
  import { ISelectionWithStyle } from '../../basics/selection';
3
4
  interface IFeatureRange {
4
5
  groupId: string;
5
6
  range: IRange;
6
7
  }
7
8
  export interface IExclusiveRangeService {
9
+ exclusiveRangesChange$: Observable<{
10
+ unitId: string;
11
+ subUnitId: string;
12
+ ranges: IRange[];
13
+ }>;
8
14
  /**
9
15
  * @description Add an exclusive range to the service
10
16
  * @param {string} unitId The unitId of the exclusive range
@@ -48,6 +54,12 @@ export declare class ExclusiveRangeService extends Disposable implements IExclus
48
54
  * Exclusive range data structure is as follows: unitId -> sheetId -> feature -> range
49
55
  */
50
56
  private _exclusiveRanges;
57
+ private _exclusiveRangesChange$;
58
+ exclusiveRangesChange$: Observable<{
59
+ unitId: string;
60
+ subUnitId: string;
61
+ ranges: IRange[];
62
+ }>;
51
63
  private _ensureUnitMap;
52
64
  private _ensureSubunitMap;
53
65
  private _ensureFeature;
@@ -0,0 +1,82 @@
1
+ import { RangeProtectionPermissionEditPoint } from './range/edit';
2
+ import { RangeProtectionPermissionViewPoint } from './range/view';
3
+ import { WorkbookCommentPermission } from './workbook/comment';
4
+ import { WorkbookCopyPermission } from './workbook/copy';
5
+ import { WorkbookCreateProtectPermission } from './workbook/create-permission';
6
+ import { WorkbookCreateSheetPermission } from './workbook/create-sheet';
7
+ import { WorkbookDeleteSheetPermission } from './workbook/delete-sheet';
8
+ import { WorkbookDuplicatePermission } from './workbook/duplicate';
9
+ import { WorkbookEditablePermission } from './workbook/editable';
10
+ import { WorkbookExportPermission } from './workbook/export';
11
+ import { WorkbookHideSheetPermission } from './workbook/hide-sheet';
12
+ import { WorkbookHistoryPermission } from './workbook/history';
13
+ import { WorkbookManageCollaboratorPermission } from './workbook/manage-collaborator';
14
+ import { WorkbookMoveSheetPermission } from './workbook/move-sheet';
15
+ import { WorkbookPrintPermission } from './workbook/print';
16
+ import { WorkbookRecoverHistoryPermission } from './workbook/recover-history';
17
+ import { WorkbookRenameSheetPermission } from './workbook/rename-sheet';
18
+ import { WorkbookSharePermission } from './workbook/share';
19
+ import { WorkbookViewPermission } from './workbook/view';
20
+ import { WorkbookViewHistoryPermission } from './workbook/view-history';
21
+ import { WorksheetCopyPermission } from './worksheet/copy';
22
+ import { WorksheetDeleteColumnPermission } from './worksheet/delete-column';
23
+ import { WorksheetDeleteProtectionPermission } from './worksheet/delete-protection';
24
+ import { WorksheetDeleteRowPermission } from './worksheet/delete-row';
25
+ import { WorksheetEditPermission } from './worksheet/edit';
26
+ import { WorksheetEditExtraObjectPermission } from './worksheet/edit-extra-object';
27
+ import { WorksheetFilterPermission } from './worksheet/filter';
28
+ import { WorksheetInsertColumnPermission } from './worksheet/insert-column';
29
+ import { WorksheetInsertHyperlinkPermission } from './worksheet/insert-hyperlink';
30
+ import { WorksheetInsertRowPermission } from './worksheet/insert-row';
31
+ import { WorksheetManageCollaboratorPermission } from './worksheet/manage-collaborator';
32
+ import { WorksheetPivotTablePermission } from './worksheet/pivot-table';
33
+ import { WorksheetSelectProtectedCellsPermission } from './worksheet/select-protected-cells';
34
+ import { WorksheetSelectUnProtectedCellsPermission } from './worksheet/select-un-protected-cells';
35
+ import { WorksheetSetCellStylePermission } from './worksheet/set-cell-style';
36
+ import { WorksheetSetCellValuePermission } from './worksheet/set-cell-value';
37
+ import { WorksheetSetColumnStylePermission } from './worksheet/set-column-style';
38
+ import { WorksheetSetRowStylePermission } from './worksheet/set-row-style';
39
+ import { WorksheetSortPermission } from './worksheet/sort';
40
+ import { WorksheetViewPermission } from './worksheet/view';
41
+ export declare const PermissionPointsDefinitions: {
42
+ WorkbookCommentPermission: typeof WorkbookCommentPermission;
43
+ WorkbookCopyPermission: typeof WorkbookCopyPermission;
44
+ WorkbookCreateProtectPermission: typeof WorkbookCreateProtectPermission;
45
+ WorkbookCreateSheetPermission: typeof WorkbookCreateSheetPermission;
46
+ WorkbookDeleteSheetPermission: typeof WorkbookDeleteSheetPermission;
47
+ WorkbookDuplicatePermission: typeof WorkbookDuplicatePermission;
48
+ WorkbookEditablePermission: typeof WorkbookEditablePermission;
49
+ WorkbookExportPermission: typeof WorkbookExportPermission;
50
+ WorkbookHideSheetPermission: typeof WorkbookHideSheetPermission;
51
+ WorkbookHistoryPermission: typeof WorkbookHistoryPermission;
52
+ WorkbookManageCollaboratorPermission: typeof WorkbookManageCollaboratorPermission;
53
+ WorkbookMoveSheetPermission: typeof WorkbookMoveSheetPermission;
54
+ WorkbookPrintPermission: typeof WorkbookPrintPermission;
55
+ WorkbookRecoverHistoryPermission: typeof WorkbookRecoverHistoryPermission;
56
+ WorkbookRenameSheetPermission: typeof WorkbookRenameSheetPermission;
57
+ WorkbookSharePermission: typeof WorkbookSharePermission;
58
+ WorkbookViewHistoryPermission: typeof WorkbookViewHistoryPermission;
59
+ WorkbookViewPermission: typeof WorkbookViewPermission;
60
+ WorksheetCopyPermission: typeof WorksheetCopyPermission;
61
+ WorksheetDeleteColumnPermission: typeof WorksheetDeleteColumnPermission;
62
+ WorksheetDeleteProtectionPermission: typeof WorksheetDeleteProtectionPermission;
63
+ WorksheetDeleteRowPermission: typeof WorksheetDeleteRowPermission;
64
+ WorksheetEditExtraObjectPermission: typeof WorksheetEditExtraObjectPermission;
65
+ WorksheetEditPermission: typeof WorksheetEditPermission;
66
+ WorksheetFilterPermission: typeof WorksheetFilterPermission;
67
+ WorksheetInsertColumnPermission: typeof WorksheetInsertColumnPermission;
68
+ WorksheetInsertHyperlinkPermission: typeof WorksheetInsertHyperlinkPermission;
69
+ WorksheetInsertRowPermission: typeof WorksheetInsertRowPermission;
70
+ WorksheetManageCollaboratorPermission: typeof WorksheetManageCollaboratorPermission;
71
+ WorksheetPivotTablePermission: typeof WorksheetPivotTablePermission;
72
+ WorksheetSelectProtectedCellsPermission: typeof WorksheetSelectProtectedCellsPermission;
73
+ WorksheetSelectUnProtectedCellsPermission: typeof WorksheetSelectUnProtectedCellsPermission;
74
+ WorksheetSetCellStylePermission: typeof WorksheetSetCellStylePermission;
75
+ WorksheetSetCellValuePermission: typeof WorksheetSetCellValuePermission;
76
+ WorksheetSetColumnStylePermission: typeof WorksheetSetColumnStylePermission;
77
+ WorksheetSetRowStylePermission: typeof WorksheetSetRowStylePermission;
78
+ WorksheetSortPermission: typeof WorksheetSortPermission;
79
+ WorksheetViewPermission: typeof WorksheetViewPermission;
80
+ RangeProtectionPermissionEditPoint: typeof RangeProtectionPermissionEditPoint;
81
+ RangeProtectionPermissionViewPoint: typeof RangeProtectionPermissionViewPoint;
82
+ };