MCPcopy Create free account
hub / github.com/bytebase/bytebase / SheetTree

Function SheetTree

frontend/src/react/components/sql-editor/SheetTree.tsx:173–1475  ·  view source on GitHub ↗
({
  view,
  multiSelectMode = false,
  checkedNodes = [],
  onMultiSelectModeChange,
  onCheckedNodesChange,
  ref,
}: Props)

Source from the content-addressed store, hash-verified

171// ---------------------------------------------------------------------------
172
173export function SheetTree({
174 view,
175 multiSelectMode = false,
176 checkedNodes = [],
177 onMultiSelectModeChange,
178 onCheckedNodesChange,
179 ref,
180}: Props) {
181 const { t } = useTranslation();
182
183 // ---- Pinia stores (called at top level, not inside the Vue-bridge call) ----------
184 const createWorksheet = useSQLEditorReactStore((s) => s.createWorksheet);
185
186 // ---- Sheet contexts -------------------------------------------------------
187 const {
188 filter: worksheetFilter,
189 selectedKeys,
190 expandedKeys,
191 editingNode,
192 batchUpdateWorksheetFolders,
193 setExpandedKeys,
194 setEditingNode,
195 } = useSheetContext();
196 const {
197 isInitialized,
198 isLoading,
199 sheetTree,
200 fetchSheetList,
201 folderContext,
202 getFoldersForWorksheet,
203 events,
204 } = useSheetContextByView(view);
205
206 const project = useSQLEditorEditorState((s) => s.project);
207 const expandedKeysArray = useMemo(
208 () => Array.from(expandedKeys ?? []),
209 [expandedKeys]
210 );
211
212 // ---- Dropdown hook -------------------------------------------------------
213 const {
214 currentNode: contextMenuNode,
215 options: dropdownOptions,
216 worksheetEntity,
217 showSharePanel,
218 handleContextMenu,
219 handleSharePanelShow,
220 handleClickOutside: handleContextMenuClickOutside,
221 } = useDropdown(
222 view,
223 worksheetFilter,
224 // Only expose the "Multi-select" entry when the parent wires the
225 // multi-select callbacks — i.e. on the `my` tree inside WorksheetPane.
226 !!onMultiSelectModeChange && !!onCheckedNodesChange
227 );
228
229 // ---- Menu anchor ----------------------------------------------------------
230 // Base UI's popup hover-floating interaction closes the menu on

Callers

nothing calls this directly

Calls 15

useSheetContextFunction · 0.90
useSheetContextByViewFunction · 0.90
useSQLEditorEditorStateFunction · 0.90
useDropdownFunction · 0.90
filterNodeFunction · 0.90
countVisibleRowsFunction · 0.90
revealWorksheetsFunction · 0.90
getSQLEditorTabsStateFunction · 0.90
openWorksheetByNameFunction · 0.90
revealNodesFunction · 0.90
cnFunction · 0.90
handleSharePanelShowFunction · 0.85

Tested by

no test coverage detected