data.ts 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import { DropMenu } from '/@/components/Dropdown/index';
  2. import { AppRouteRecordRaw } from '/@/router/types';
  3. import type { TabItem } from '/@/store/modules/tab';
  4. import { useI18n } from '/@/hooks/web/useI18n';
  5. const { t } = useI18n();
  6. export enum TabContentEnum {
  7. TAB_TYPE,
  8. EXTRA_TYPE,
  9. }
  10. export interface TabContentProps {
  11. tabItem: TabItem | AppRouteRecordRaw;
  12. type?: TabContentEnum;
  13. trigger?: Array<'click' | 'hover' | 'contextmenu'>;
  14. }
  15. /**
  16. * @description: 右键:下拉菜单文字
  17. */
  18. export enum MenuEventEnum {
  19. // 刷新
  20. REFRESH_PAGE,
  21. // 关闭当前
  22. CLOSE_CURRENT,
  23. // 关闭左侧
  24. CLOSE_LEFT,
  25. // 关闭右侧
  26. CLOSE_RIGHT,
  27. // 关闭其他
  28. CLOSE_OTHER,
  29. // 关闭所有
  30. CLOSE_ALL,
  31. // 放大
  32. SCALE,
  33. }
  34. export function getActions() {
  35. const REFRESH_PAGE: DropMenu = {
  36. icon: 'ant-design:reload-outlined',
  37. event: MenuEventEnum.REFRESH_PAGE,
  38. text: t('layout.multipleTab.redo'),
  39. disabled: false,
  40. };
  41. const CLOSE_CURRENT: DropMenu = {
  42. icon: 'ant-design:close-outlined',
  43. event: MenuEventEnum.CLOSE_CURRENT,
  44. text: t('layout.multipleTab.close'),
  45. disabled: false,
  46. divider: true,
  47. };
  48. const CLOSE_LEFT: DropMenu = {
  49. icon: 'ant-design:pic-left-outlined',
  50. event: MenuEventEnum.CLOSE_LEFT,
  51. text: t('layout.multipleTab.closeLeft'),
  52. disabled: false,
  53. divider: false,
  54. };
  55. const CLOSE_RIGHT: DropMenu = {
  56. icon: 'ant-design:pic-right-outlined',
  57. event: MenuEventEnum.CLOSE_RIGHT,
  58. text: t('layout.multipleTab.closeRight'),
  59. disabled: false,
  60. divider: true,
  61. };
  62. const CLOSE_OTHER: DropMenu = {
  63. icon: 'ant-design:pic-center-outlined',
  64. event: MenuEventEnum.CLOSE_OTHER,
  65. text: t('layout.multipleTab.closeOther'),
  66. disabled: false,
  67. };
  68. const CLOSE_ALL: DropMenu = {
  69. icon: 'ant-design:line-outlined',
  70. event: MenuEventEnum.CLOSE_ALL,
  71. text: t('layout.multipleTab.closeAll'),
  72. disabled: false,
  73. };
  74. return [REFRESH_PAGE, CLOSE_CURRENT, CLOSE_LEFT, CLOSE_RIGHT, CLOSE_OTHER, CLOSE_ALL];
  75. }
  76. export function getScaleAction(text: string, isZoom = false) {
  77. return {
  78. icon: isZoom ? 'codicon:screen-normal' : 'codicon:screen-full',
  79. event: MenuEventEnum.SCALE,
  80. text: text,
  81. disabled: false,
  82. };
  83. }