@univerjs/sheets-sort-ui 1.0.0-alpha.2 → 1.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -6,9 +6,9 @@ import { Button, ButtonGroup, Checkbox, DraggableList, Dropdown, Radio, RadioGro
6
6
  import { ComponentManager, ContextMenuGroup, ContextMenuPosition, IDialogService, ILayoutService, IMenuManagerService, IUIPartsService, IconManager, MenuItemType, RibbonDataGroup, connectInjector, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
7
7
  import { useCallback, useEffect, useRef, useState } from "react";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { SheetsRenderService, SheetsUIPart, getCurrentExclusiveRangeInterest$, getCurrentRangeDisable$ } from "@univerjs/sheets-ui";
9
10
  import { AscendingIcon, CheckMarkIcon, CustomSortIcon, DeleteEmptyIcon, DescendingIcon, ExpandAscendingIcon, ExpandDescendingIcon, GripVerticalIcon, IncreaseIcon, MoreDownIcon } from "@univerjs/icons";
10
11
  import { serializeRange } from "@univerjs/engine-formula";
11
- import { SheetsRenderService, SheetsUIPart, getCurrentExclusiveRangeInterest$, getCurrentRangeDisable$ } from "@univerjs/sheets-ui";
12
12
 
13
13
  //#region src/views/ExtendConfirm.tsx
14
14
  const ExtendConfirm = (props) => {
@@ -367,10 +367,202 @@ const SortRangeCustomInCtxMenuCommand = {
367
367
  }
368
368
  };
369
369
 
370
+ //#endregion
371
+ //#region src/menu/sheets-sort.menu.ts
372
+ const SHEETS_SORT_MENU_ID = "sheet.menu.sheets-sort";
373
+ const SHEETS_SORT_CTX_MENU_ID = "sheet.menu.sheets-sort-ctx";
374
+ function sortRangeMenuFactory(accessor) {
375
+ return {
376
+ id: SHEETS_SORT_MENU_ID,
377
+ type: MenuItemType.SUBITEMS,
378
+ icon: "AscendingIcon",
379
+ tooltip: "sheets-sort-ui.general.sort",
380
+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
381
+ disabled$: getCurrentRangeDisable$(accessor, {
382
+ workbookTypes: [WorkbookEditablePermission],
383
+ worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
384
+ rangeTypes: [RangeProtectionPermissionEditPoint]
385
+ })
386
+ };
387
+ }
388
+ function sortRangeAscMenuFactory(accessor) {
389
+ return {
390
+ id: SortRangeAscCommand.id,
391
+ icon: "AscendingIcon",
392
+ title: "sheets-sort-ui.general.sort-asc-cur",
393
+ type: MenuItemType.BUTTON,
394
+ hidden$: getCurrentExclusiveRangeInterest$(accessor)
395
+ };
396
+ }
397
+ function sortRangeAscExtMenuFactory() {
398
+ return {
399
+ id: SortRangeAscExtCommand.id,
400
+ title: "sheets-sort-ui.general.sort-asc-ext",
401
+ icon: "ExpandAscendingIcon",
402
+ type: MenuItemType.BUTTON
403
+ };
404
+ }
405
+ function sortRangeDescMenuFactory() {
406
+ return {
407
+ id: SortRangeDescCommand.id,
408
+ title: "sheets-sort-ui.general.sort-desc-cur",
409
+ icon: "DescendingIcon",
410
+ type: MenuItemType.BUTTON
411
+ };
412
+ }
413
+ function sortRangeDescExtMenuFactory() {
414
+ return {
415
+ id: SortRangeDescExtCommand.id,
416
+ title: "sheets-sort-ui.general.sort-desc-ext",
417
+ icon: "ExpandDescendingIcon",
418
+ type: MenuItemType.BUTTON
419
+ };
420
+ }
421
+ function sortRangeCustomMenuFactory() {
422
+ return {
423
+ id: SortRangeCustomCommand.id,
424
+ title: "sheets-sort-ui.general.sort-custom",
425
+ type: MenuItemType.BUTTON,
426
+ icon: "CustomSortIcon"
427
+ };
428
+ }
429
+ function sortRangeCtxMenuFactory(accessor) {
430
+ return {
431
+ id: SHEETS_SORT_CTX_MENU_ID,
432
+ title: "sheets-sort-ui.general.sort",
433
+ type: MenuItemType.SUBITEMS,
434
+ icon: "AscendingIcon",
435
+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
436
+ disabled$: getCurrentRangeDisable$(accessor, {
437
+ workbookTypes: [WorkbookEditablePermission],
438
+ worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
439
+ rangeTypes: [RangeProtectionPermissionEditPoint]
440
+ })
441
+ };
442
+ }
443
+ function sortRangeAscCtxMenuFactory(accessor) {
444
+ return {
445
+ id: SortRangeAscInCtxMenuCommand.id,
446
+ title: "sheets-sort-ui.general.sort-asc-cur",
447
+ type: MenuItemType.BUTTON,
448
+ icon: "AscendingIcon",
449
+ disabled$: getCurrentRangeDisable$(accessor, {
450
+ workbookTypes: [WorkbookEditablePermission],
451
+ worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
452
+ rangeTypes: [RangeProtectionPermissionEditPoint]
453
+ })
454
+ };
455
+ }
456
+ function sortRangeAscExtCtxMenuFactory(accessor) {
457
+ return {
458
+ id: SortRangeAscExtInCtxMenuCommand.id,
459
+ title: "sheets-sort-ui.general.sort-asc-ext",
460
+ type: MenuItemType.BUTTON,
461
+ icon: "ExpandAscendingIcon",
462
+ disabled$: getCurrentRangeDisable$(accessor, {
463
+ workbookTypes: [WorkbookEditablePermission],
464
+ worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
465
+ rangeTypes: [RangeProtectionPermissionEditPoint]
466
+ })
467
+ };
468
+ }
469
+ function sortRangeDescCtxMenuFactory(accessor) {
470
+ return {
471
+ id: SortRangeDescInCtxMenuCommand.id,
472
+ title: "sheets-sort-ui.general.sort-desc-cur",
473
+ type: MenuItemType.BUTTON,
474
+ icon: "DescendingIcon",
475
+ disabled$: getCurrentRangeDisable$(accessor, {
476
+ workbookTypes: [WorkbookEditablePermission],
477
+ worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
478
+ rangeTypes: [RangeProtectionPermissionEditPoint]
479
+ })
480
+ };
481
+ }
482
+ function sortRangeDescExtCtxMenuFactory(accessor) {
483
+ return {
484
+ id: SortRangeDescExtInCtxMenuCommand.id,
485
+ title: "sheets-sort-ui.general.sort-desc-ext",
486
+ type: MenuItemType.BUTTON,
487
+ icon: "ExpandDescendingIcon",
488
+ disabled$: getCurrentRangeDisable$(accessor, {
489
+ workbookTypes: [WorkbookEditablePermission],
490
+ worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
491
+ rangeTypes: [RangeProtectionPermissionEditPoint]
492
+ })
493
+ };
494
+ }
495
+ function sortRangeCustomCtxMenuFactory(accessor) {
496
+ return {
497
+ id: SortRangeCustomInCtxMenuCommand.id,
498
+ title: "sheets-sort-ui.general.sort-custom",
499
+ type: MenuItemType.BUTTON,
500
+ icon: "CustomSortIcon",
501
+ disabled$: getCurrentRangeDisable$(accessor, {
502
+ workbookTypes: [WorkbookEditablePermission],
503
+ worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
504
+ rangeTypes: [RangeProtectionPermissionEditPoint]
505
+ })
506
+ };
507
+ }
508
+
509
+ //#endregion
510
+ //#region src/menu/schema.ts
511
+ const menuSchema = {
512
+ [RibbonDataGroup.ORGANIZATION]: { [SHEETS_SORT_MENU_ID]: {
513
+ order: 3,
514
+ menuItemFactory: sortRangeMenuFactory,
515
+ [SortRangeAscCommand.id]: {
516
+ order: 0,
517
+ menuItemFactory: sortRangeAscMenuFactory
518
+ },
519
+ [SortRangeAscExtCommand.id]: {
520
+ order: 1,
521
+ menuItemFactory: sortRangeAscExtMenuFactory
522
+ },
523
+ [SortRangeDescCommand.id]: {
524
+ order: 2,
525
+ menuItemFactory: sortRangeDescMenuFactory
526
+ },
527
+ [SortRangeDescExtCommand.id]: {
528
+ order: 3,
529
+ menuItemFactory: sortRangeDescExtMenuFactory
530
+ },
531
+ [SortRangeCustomCommand.id]: {
532
+ order: 4,
533
+ menuItemFactory: sortRangeCustomMenuFactory
534
+ }
535
+ } },
536
+ [ContextMenuPosition.MAIN_AREA]: { [ContextMenuGroup.DATA]: { [SHEETS_SORT_CTX_MENU_ID]: {
537
+ order: 0,
538
+ menuItemFactory: sortRangeCtxMenuFactory,
539
+ [SortRangeAscInCtxMenuCommand.id]: {
540
+ order: 0,
541
+ menuItemFactory: sortRangeAscCtxMenuFactory
542
+ },
543
+ [SortRangeAscExtInCtxMenuCommand.id]: {
544
+ order: 1,
545
+ menuItemFactory: sortRangeAscExtCtxMenuFactory
546
+ },
547
+ [SortRangeDescInCtxMenuCommand.id]: {
548
+ order: 2,
549
+ menuItemFactory: sortRangeDescCtxMenuFactory
550
+ },
551
+ [SortRangeDescExtInCtxMenuCommand.id]: {
552
+ order: 3,
553
+ menuItemFactory: sortRangeDescExtCtxMenuFactory
554
+ },
555
+ [SortRangeCustomInCtxMenuCommand.id]: {
556
+ order: 4,
557
+ menuItemFactory: sortRangeCustomCtxMenuFactory
558
+ }
559
+ } } }
560
+ };
561
+
370
562
  //#endregion
371
563
  //#region package.json
372
564
  var name = "@univerjs/sheets-sort-ui";
373
- var version = "1.0.0-alpha.2";
565
+ var version = "1.0.0-alpha.4";
374
566
 
375
567
  //#endregion
376
568
  //#region src/config/config.ts
@@ -642,198 +834,6 @@ let ComponentsController = class ComponentsController extends Disposable {
642
834
  };
643
835
  ComponentsController = __decorate([__decorateParam(0, Inject(ComponentManager)), __decorateParam(1, Inject(IconManager))], ComponentsController);
644
836
 
645
- //#endregion
646
- //#region src/menu/sheets-sort.menu.ts
647
- const SHEETS_SORT_MENU_ID = "sheet.menu.sheets-sort";
648
- const SHEETS_SORT_CTX_MENU_ID = "sheet.menu.sheets-sort-ctx";
649
- function sortRangeMenuFactory(accessor) {
650
- return {
651
- id: SHEETS_SORT_MENU_ID,
652
- type: MenuItemType.SUBITEMS,
653
- icon: "AscendingIcon",
654
- tooltip: "sheets-sort-ui.general.sort",
655
- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
656
- disabled$: getCurrentRangeDisable$(accessor, {
657
- workbookTypes: [WorkbookEditablePermission],
658
- worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
659
- rangeTypes: [RangeProtectionPermissionEditPoint]
660
- })
661
- };
662
- }
663
- function sortRangeAscMenuFactory(accessor) {
664
- return {
665
- id: SortRangeAscCommand.id,
666
- icon: "AscendingIcon",
667
- title: "sheets-sort-ui.general.sort-asc-cur",
668
- type: MenuItemType.BUTTON,
669
- hidden$: getCurrentExclusiveRangeInterest$(accessor)
670
- };
671
- }
672
- function sortRangeAscExtMenuFactory() {
673
- return {
674
- id: SortRangeAscExtCommand.id,
675
- title: "sheets-sort-ui.general.sort-asc-ext",
676
- icon: "ExpandAscendingIcon",
677
- type: MenuItemType.BUTTON
678
- };
679
- }
680
- function sortRangeDescMenuFactory() {
681
- return {
682
- id: SortRangeDescCommand.id,
683
- title: "sheets-sort-ui.general.sort-desc-cur",
684
- icon: "DescendingIcon",
685
- type: MenuItemType.BUTTON
686
- };
687
- }
688
- function sortRangeDescExtMenuFactory() {
689
- return {
690
- id: SortRangeDescExtCommand.id,
691
- title: "sheets-sort-ui.general.sort-desc-ext",
692
- icon: "ExpandDescendingIcon",
693
- type: MenuItemType.BUTTON
694
- };
695
- }
696
- function sortRangeCustomMenuFactory() {
697
- return {
698
- id: SortRangeCustomCommand.id,
699
- title: "sheets-sort-ui.general.sort-custom",
700
- type: MenuItemType.BUTTON,
701
- icon: "CustomSortIcon"
702
- };
703
- }
704
- function sortRangeCtxMenuFactory(accessor) {
705
- return {
706
- id: SHEETS_SORT_CTX_MENU_ID,
707
- title: "sheets-sort-ui.general.sort",
708
- type: MenuItemType.SUBITEMS,
709
- icon: "AscendingIcon",
710
- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
711
- disabled$: getCurrentRangeDisable$(accessor, {
712
- workbookTypes: [WorkbookEditablePermission],
713
- worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
714
- rangeTypes: [RangeProtectionPermissionEditPoint]
715
- })
716
- };
717
- }
718
- function sortRangeAscCtxMenuFactory(accessor) {
719
- return {
720
- id: SortRangeAscInCtxMenuCommand.id,
721
- title: "sheets-sort-ui.general.sort-asc-cur",
722
- type: MenuItemType.BUTTON,
723
- icon: "AscendingIcon",
724
- disabled$: getCurrentRangeDisable$(accessor, {
725
- workbookTypes: [WorkbookEditablePermission],
726
- worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
727
- rangeTypes: [RangeProtectionPermissionEditPoint]
728
- })
729
- };
730
- }
731
- function sortRangeAscExtCtxMenuFactory(accessor) {
732
- return {
733
- id: SortRangeAscExtInCtxMenuCommand.id,
734
- title: "sheets-sort-ui.general.sort-asc-ext",
735
- type: MenuItemType.BUTTON,
736
- icon: "ExpandAscendingIcon",
737
- disabled$: getCurrentRangeDisable$(accessor, {
738
- workbookTypes: [WorkbookEditablePermission],
739
- worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
740
- rangeTypes: [RangeProtectionPermissionEditPoint]
741
- })
742
- };
743
- }
744
- function sortRangeDescCtxMenuFactory(accessor) {
745
- return {
746
- id: SortRangeDescInCtxMenuCommand.id,
747
- title: "sheets-sort-ui.general.sort-desc-cur",
748
- type: MenuItemType.BUTTON,
749
- icon: "DescendingIcon",
750
- disabled$: getCurrentRangeDisable$(accessor, {
751
- workbookTypes: [WorkbookEditablePermission],
752
- worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
753
- rangeTypes: [RangeProtectionPermissionEditPoint]
754
- })
755
- };
756
- }
757
- function sortRangeDescExtCtxMenuFactory(accessor) {
758
- return {
759
- id: SortRangeDescExtInCtxMenuCommand.id,
760
- title: "sheets-sort-ui.general.sort-desc-ext",
761
- type: MenuItemType.BUTTON,
762
- icon: "ExpandDescendingIcon",
763
- disabled$: getCurrentRangeDisable$(accessor, {
764
- workbookTypes: [WorkbookEditablePermission],
765
- worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
766
- rangeTypes: [RangeProtectionPermissionEditPoint]
767
- })
768
- };
769
- }
770
- function sortRangeCustomCtxMenuFactory(accessor) {
771
- return {
772
- id: SortRangeCustomInCtxMenuCommand.id,
773
- title: "sheets-sort-ui.general.sort-custom",
774
- type: MenuItemType.BUTTON,
775
- icon: "CustomSortIcon",
776
- disabled$: getCurrentRangeDisable$(accessor, {
777
- workbookTypes: [WorkbookEditablePermission],
778
- worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission],
779
- rangeTypes: [RangeProtectionPermissionEditPoint]
780
- })
781
- };
782
- }
783
-
784
- //#endregion
785
- //#region src/menu/schema.ts
786
- const menuSchema = {
787
- [RibbonDataGroup.ORGANIZATION]: { [SHEETS_SORT_MENU_ID]: {
788
- order: 3,
789
- menuItemFactory: sortRangeMenuFactory,
790
- [SortRangeAscCommand.id]: {
791
- order: 0,
792
- menuItemFactory: sortRangeAscMenuFactory
793
- },
794
- [SortRangeAscExtCommand.id]: {
795
- order: 1,
796
- menuItemFactory: sortRangeAscExtMenuFactory
797
- },
798
- [SortRangeDescCommand.id]: {
799
- order: 2,
800
- menuItemFactory: sortRangeDescMenuFactory
801
- },
802
- [SortRangeDescExtCommand.id]: {
803
- order: 3,
804
- menuItemFactory: sortRangeDescExtMenuFactory
805
- },
806
- [SortRangeCustomCommand.id]: {
807
- order: 4,
808
- menuItemFactory: sortRangeCustomMenuFactory
809
- }
810
- } },
811
- [ContextMenuPosition.MAIN_AREA]: { [ContextMenuGroup.DATA]: { [SHEETS_SORT_CTX_MENU_ID]: {
812
- order: 0,
813
- menuItemFactory: sortRangeCtxMenuFactory,
814
- [SortRangeAscInCtxMenuCommand.id]: {
815
- order: 0,
816
- menuItemFactory: sortRangeAscCtxMenuFactory
817
- },
818
- [SortRangeAscExtInCtxMenuCommand.id]: {
819
- order: 1,
820
- menuItemFactory: sortRangeAscExtCtxMenuFactory
821
- },
822
- [SortRangeDescInCtxMenuCommand.id]: {
823
- order: 2,
824
- menuItemFactory: sortRangeDescCtxMenuFactory
825
- },
826
- [SortRangeDescExtInCtxMenuCommand.id]: {
827
- order: 3,
828
- menuItemFactory: sortRangeDescExtCtxMenuFactory
829
- },
830
- [SortRangeCustomInCtxMenuCommand.id]: {
831
- order: 4,
832
- menuItemFactory: sortRangeCustomCtxMenuFactory
833
- }
834
- } } }
835
- };
836
-
837
837
  //#endregion
838
838
  //#region src/views/EmbedSortBtn.tsx
839
839
  function EmbedSortBtn(props) {
@@ -989,4 +989,4 @@ UniverSheetsSortUIPlugin = __decorate([
989
989
  ], UniverSheetsSortUIPlugin);
990
990
 
991
991
  //#endregion
992
- export { SortRangeAscCommand, SortRangeAscExtCommand, SortRangeAscExtInCtxMenuCommand, SortRangeAscInCtxMenuCommand, SortRangeCustomCommand, SortRangeCustomInCtxMenuCommand, SortRangeDescCommand, SortRangeDescExtCommand, SortRangeDescExtInCtxMenuCommand, SortRangeDescInCtxMenuCommand, UniverSheetsSortUIPlugin };
992
+ export { menuSchema as SheetsSortUIMenuSchema, SortRangeAscCommand, SortRangeAscExtCommand, SortRangeAscExtInCtxMenuCommand, SortRangeAscInCtxMenuCommand, SortRangeCustomCommand, SortRangeCustomInCtxMenuCommand, SortRangeDescCommand, SortRangeDescExtCommand, SortRangeDescExtInCtxMenuCommand, SortRangeDescInCtxMenuCommand, UniverSheetsSortUIPlugin };