data.ts 2.0 KB

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