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