table-editor.ts 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. // @ts-nocheck
  2. import { RegistryDefinations } from '../types'
  3. export const TABLE_EDITOR_SHORTCUT_IDS = {
  4. TABLE_EDITOR_JUMP_FIRST_ROW: 'table-editor.jump-first-row',
  5. TABLE_EDITOR_JUMP_LAST_ROW: 'table-editor.jump-last-row',
  6. TABLE_EDITOR_JUMP_FIRST_COL: 'table-editor.jump-first-col',
  7. TABLE_EDITOR_JUMP_LAST_COL: 'table-editor.jump-last-col',
  8. TABLE_EDITOR_TOGGLE_ROW_SELECTION: 'table-editor.toggle-row-selection',
  9. TABLE_EDITOR_TOGGLE_ALL_ROW_SELECTION: 'table-editor.toggle-all-row-selection',
  10. TABLE_EDITOR_SELECT_ALL_IN_TABLE: 'table-editor.select-all-in-table',
  11. TABLE_EDITOR_DELETE_SELECTED_ROWS: 'table-editor.delete-selected-rows',
  12. TABLE_EDITOR_START_NAVIGATION_DOWN: 'table-editor.start-navigation-down',
  13. TABLE_EDITOR_START_NAVIGATION_UP: 'table-editor.start-navigation-up',
  14. TABLE_EDITOR_EXIT_SELECTION: 'table-editor.exit-selection',
  15. TABLE_EDITOR_INSERT_ROW: 'table-editor.insert-row',
  16. TABLE_EDITOR_INSERT_COLUMN: 'table-editor.insert-column',
  17. TABLE_EDITOR_IMPORT_CSV: 'table-editor.import-csv',
  18. TABLE_EDITOR_FOCUS_FILTERS: 'table-editor.focus-filters',
  19. TABLE_EDITOR_CLEAR_FILTERS: 'table-editor.clear-filters',
  20. TABLE_EDITOR_CLEAR_SORT: 'table-editor.clear-sort',
  21. TABLE_EDITOR_REFRESH: 'table-editor.refresh',
  22. }
  23. export type TableEditorShortcutId =
  24. (typeof TABLE_EDITOR_SHORTCUT_IDS)[keyof typeof TABLE_EDITOR_SHORTCUT_IDS]
  25. export const tableEditorRegistry: RegistryDefinations<TableEditorShortcutId> = {
  26. [TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_JUMP_FIRST_ROW]: {
  27. id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_JUMP_FIRST_ROW,
  28. label: 'Jump to first row',
  29. sequence: ['Mod+ArrowUp'],
  30. showInSettings: false,
  31. options: { ignoreInputs: true },
  32. },
  33. [TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_JUMP_LAST_ROW]: {
  34. id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_JUMP_LAST_ROW,
  35. label: 'Jump to last row',
  36. sequence: ['Mod+ArrowDown'],
  37. showInSettings: false,
  38. options: { ignoreInputs: true },
  39. },
  40. [TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_JUMP_FIRST_COL]: {
  41. id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_JUMP_FIRST_COL,
  42. label: 'Jump to first column',
  43. sequence: ['Mod+ArrowLeft'],
  44. showInSettings: false,
  45. options: { ignoreInputs: true },
  46. },
  47. [TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_JUMP_LAST_COL]: {
  48. id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_JUMP_LAST_COL,
  49. label: 'Jump to last column',
  50. sequence: ['Mod+ArrowRight'],
  51. showInSettings: false,
  52. options: { ignoreInputs: true },
  53. },
  54. [TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_TOGGLE_ROW_SELECTION]: {
  55. id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_TOGGLE_ROW_SELECTION,
  56. label: 'Toggle selection on current row',
  57. sequence: ['Shift+Space'],
  58. showInSettings: false,
  59. options: { ignoreInputs: true },
  60. },
  61. [TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_TOGGLE_ALL_ROW_SELECTION]: {
  62. id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_TOGGLE_ALL_ROW_SELECTION,
  63. label: 'Toggle selection on all displayed rows',
  64. sequence: ['Mod+A'],
  65. showInSettings: false,
  66. options: { ignoreInputs: true },
  67. },
  68. [TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_SELECT_ALL_IN_TABLE]: {
  69. id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_SELECT_ALL_IN_TABLE,
  70. label: 'Toggle selection on all rows in table',
  71. sequence: ['Mod+Shift+A'],
  72. showInSettings: false,
  73. options: { ignoreInputs: true },
  74. },
  75. [TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_DELETE_SELECTED_ROWS]: {
  76. id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_DELETE_SELECTED_ROWS,
  77. label: 'Delete selected rows',
  78. sequence: ['Mod+Backspace'],
  79. showInSettings: false,
  80. options: { ignoreInputs: true },
  81. },
  82. [TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_START_NAVIGATION_DOWN]: {
  83. id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_START_NAVIGATION_DOWN,
  84. label: 'Start grid navigation (down)',
  85. sequence: ['ArrowDown'],
  86. showInSettings: false,
  87. options: { ignoreInputs: true },
  88. },
  89. [TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_START_NAVIGATION_UP]: {
  90. id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_START_NAVIGATION_UP,
  91. label: 'Start grid navigation (up)',
  92. sequence: ['ArrowUp'],
  93. showInSettings: false,
  94. options: { ignoreInputs: true },
  95. },
  96. [TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_EXIT_SELECTION]: {
  97. id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_EXIT_SELECTION,
  98. label: 'Exit grid selection',
  99. sequence: ['Escape'],
  100. showInSettings: false,
  101. options: { ignoreInputs: true },
  102. },
  103. [TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_INSERT_ROW]: {
  104. id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_INSERT_ROW,
  105. label: 'Insert row',
  106. sequence: ['I', 'R'],
  107. showInSettings: false,
  108. options: { ignoreInputs: true },
  109. },
  110. [TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_INSERT_COLUMN]: {
  111. id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_INSERT_COLUMN,
  112. label: 'Insert column',
  113. sequence: ['I', 'C'],
  114. showInSettings: false,
  115. options: { ignoreInputs: true },
  116. },
  117. [TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_IMPORT_CSV]: {
  118. id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_IMPORT_CSV,
  119. label: 'Import data from CSV',
  120. sequence: ['I', 'U'],
  121. showInSettings: false,
  122. options: { ignoreInputs: true },
  123. },
  124. [TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_FOCUS_FILTERS]: {
  125. id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_FOCUS_FILTERS,
  126. label: 'Focus filters',
  127. sequence: ['Shift+F'],
  128. showInSettings: false,
  129. options: { ignoreInputs: true },
  130. },
  131. [TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_CLEAR_FILTERS]: {
  132. id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_CLEAR_FILTERS,
  133. label: 'Clear filters',
  134. sequence: ['F', 'C'],
  135. showInSettings: false,
  136. options: { ignoreInputs: true },
  137. },
  138. [TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_CLEAR_SORT]: {
  139. id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_CLEAR_SORT,
  140. label: 'Clear sort',
  141. sequence: ['S', 'C'],
  142. showInSettings: false,
  143. options: { ignoreInputs: true },
  144. },
  145. [TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_REFRESH]: {
  146. id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_REFRESH,
  147. label: 'Refresh table',
  148. sequence: ['Shift+R'],
  149. showInSettings: false,
  150. options: { ignoreInputs: true },
  151. },
  152. }