1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-17 15:53:28 +00:00

12.0 change app structure (#6335)

* 01 change app structure

* 02 change setting page

* 03 optimize header style

* 04 change app mobile side panel logo
This commit is contained in:
Michael An
2024-07-11 17:45:30 +08:00
committed by GitHub
parent 4e16703d33
commit c41407f783
38 changed files with 238 additions and 408 deletions

View File

@@ -0,0 +1,41 @@
export const EVENT_BUS_TYPE = {
// metadata
QUERY_COLLABORATORS: 'query-collaborators',
QUERY_COLLABORATOR: 'query-collaborator',
UPDATE_TABLE_ROWS: 'update-table-rows',
// table
LOCAL_TABLE_CHANGED: 'local-table-changed',
SERVER_TABLE_CHANGED: 'server-table-changed',
TABLE_ERROR: 'table-error',
OPEN_EDITOR: 'open-editor',
CLOSE_EDITOR: 'close-editor',
SELECT_CELL: 'select_cell',
SELECT_START: 'select_start',
SELECT_UPDATE: 'select_update',
SELECT_END: 'select_end',
SELECT_END_WITH_SHIFT: 'select_end_with_shift',
SELECT_NONE: 'select_none',
COPY_CELLS: 'copy_cells',
PASTE_CELLS: 'paste_cells',
SEARCH_CELLS: 'search-cells',
CLOSE_SEARCH_CELLS: 'close-search-cells',
OPEN_SELECT: 'open-select',
UPDATE_LINKED_RECORDS: 'update_linked_records',
SELECT_COLUMN: 'select_column',
DRAG_ENTER: 'drag_enter',
COLLAPSE_ALL_GROUPS: 'collapse_all_groups',
EXPAND_ALL_GROUPS: 'expand_all_groups',
// modify view
MODIFY_FILTERS: 'modify_filters',
MODIFY_SORTS:'modify_sorts',
MODIFY_GROUPBYS:'modify_groupbys',
MODIFY_HIDDEN_COLUMNS:'modify_hidden_columns',
// change
VIEW_CHANGED: 'view_changed',
// library
CURRENT_LIBRARY_CHANGED: 'current_library_changed',
};

View File

@@ -0,0 +1,28 @@
class EventBus {
subscribers = {};
subscribe(type, handler) {
if (!this.subscribers[type]) {
this.subscribers[type] = [];
}
const handlers = this.subscribers[type];
handlers.push(handler);
return () => {
const index = handlers.indexOf(handler);
if (index > -1) {
handlers.splice(index, 1);
}
};
}
dispatch(type, ...data) {
const handlers = this.subscribers[type];
if (Array.isArray(handlers)) {
handlers.forEach(handler => handler(...data));
}
}
}
export default EventBus;