Compare commits
2 Commits
70915b2691
...
b09763b1eb
| Author | SHA1 | Date | |
|---|---|---|---|
| b09763b1eb | |||
| 5724c96917 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -25,6 +25,7 @@ tools.db
|
||||
.idea_bak
|
||||
**/*.prof
|
||||
**/*.db
|
||||
screenshot*
|
||||
|
||||
# Created by .ignore support plugin (hsz.mobi)
|
||||
### Python template
|
||||
|
||||
@@ -161,9 +161,10 @@
|
||||
.dt2-table {
|
||||
--color-border: color-mix(in oklab, var(--color-base-content) 20%, #0000);
|
||||
--color-resize: color-mix(in oklab, var(--color-base-content) 50%, #0000);
|
||||
height: 100%;
|
||||
height: fit-content;
|
||||
max-height: 100%;
|
||||
display: grid;
|
||||
grid-template-rows: auto 1fr auto; /* header, body, footer */
|
||||
grid-template-rows: auto minmax(auto, 1fr) auto; /* header, body, footer */
|
||||
overflow-x: auto; /* Enable horizontal scroll */
|
||||
overflow-y: hidden; /* No vertical scroll on table */
|
||||
scrollbar-width: none; /* Firefox: hide scrollbar */
|
||||
@@ -225,6 +226,11 @@
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
/* Extra row reserved when horizontal scrollbar is visible */
|
||||
.dt2-table.dt2-has-hscroll {
|
||||
grid-template-rows: auto minmax(auto, 1fr) auto 8px; /* header, body, footer, scrollbar */
|
||||
}
|
||||
|
||||
/* Horizontal scrollbar wrapper - bottom, full width minus vertical scrollbar */
|
||||
.dt2-scrollbars-horizontal-wrapper {
|
||||
left: 0;
|
||||
|
||||
@@ -225,6 +225,7 @@ function initDataGridScrollbars(gridId) {
|
||||
// PHASE 3: Write all DOM properties (already in RAF)
|
||||
verticalWrapper.style.display = isVerticalRequired ? "block" : "none";
|
||||
horizontalWrapper.style.display = isHorizontalRequired ? "block" : "none";
|
||||
table.classList.toggle("dt2-has-hscroll", isHorizontalRequired && isVerticalRequired);
|
||||
verticalScrollbar.style.height = `${scrollbarHeight}px`;
|
||||
horizontalScrollbar.style.width = `${scrollbarWidth}px`;
|
||||
verticalScrollbar.style.top = `${verticalTop}px`;
|
||||
@@ -631,7 +632,10 @@ function moveColumn(table, sourceColId, targetColId) {
|
||||
|
||||
function updateDatagridSelection(datagridId) {
|
||||
const selectionManager = document.getElementById(`tsm_${datagridId}`);
|
||||
if (!selectionManager) return;
|
||||
if (!selectionManager) {
|
||||
console.warn(`DataGrid selection manager not found for ${datagridId}`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Re-enable tooltips after drag
|
||||
const wrapper = document.getElementById(`tw_${datagridId}`);
|
||||
|
||||
@@ -567,7 +567,7 @@ class DataGrid(MultipleInstance):
|
||||
return self.render_partial("body")
|
||||
|
||||
def on_click(self, combination, is_inside, cell_id):
|
||||
logger.debug(f"on_click {combination=} {is_inside=} {cell_id=}")
|
||||
logger.debug(f"on_click table={self.get_table_name()} {combination=} {is_inside=} {cell_id=}")
|
||||
if is_inside and cell_id:
|
||||
self._state.selection.extra_selected.clear()
|
||||
|
||||
@@ -596,7 +596,7 @@ class DataGrid(MultipleInstance):
|
||||
return self.render_partial()
|
||||
|
||||
def on_key_pressed(self, combination, has_focus, is_inside):
|
||||
logger.debug(f"on_key_pressed {combination=} {has_focus=} {is_inside=}")
|
||||
logger.debug(f"on_key_pressed table={self.get_table_name()} {combination=} {has_focus=} {is_inside=}")
|
||||
if combination == "esc":
|
||||
self._update_current_position(None)
|
||||
self._state.selection.extra_selected.clear()
|
||||
@@ -650,6 +650,7 @@ class DataGrid(MultipleInstance):
|
||||
mk.label(col_def.title, icon=icons.get(col_def.type, None)),
|
||||
# make room for sort and filter indicators
|
||||
cls="flex truncate cursor-default",
|
||||
data_tooltip=col_def.title,
|
||||
)
|
||||
|
||||
def _mk_header(col_def: DataGridColumnState):
|
||||
|
||||
@@ -104,9 +104,9 @@ class mk:
|
||||
command: Command | CommandTemplate = None,
|
||||
binding: Binding = None,
|
||||
**kwargs):
|
||||
merged_cls = merge_classes("flex truncate items-center", "mf-button" if command else None, cls, kwargs)
|
||||
merged_cls = merge_classes("flex truncate items-center pr-2", "mf-button" if command else None, cls, kwargs)
|
||||
icon_part = Span(icon, cls=f"mf-icon-{mk.convert_size(size)} mr-1") if icon else None
|
||||
text_part = Span(text, cls=f"text-{size}")
|
||||
text_part = Span(text, cls=f"text-{size} truncate")
|
||||
return mk.mk(Label(icon_part, text_part, cls=merged_cls, **kwargs), command=command, binding=binding)
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -88,8 +88,10 @@ class Command:
|
||||
if auto_register:
|
||||
if self._key is not None:
|
||||
if self._key in CommandsManager.commands_by_key:
|
||||
logger.debug(f"Command {self.name} with key={self._key} will not be registered.")
|
||||
self.id = CommandsManager.commands_by_key[self._key].id
|
||||
else:
|
||||
logger.debug(f"Command {self.name} with key={self._key} will be registered.")
|
||||
CommandsManager.register(self)
|
||||
else:
|
||||
logger.warning(f"Command {self.name} has no key, it will not be registered.")
|
||||
|
||||
Reference in New Issue
Block a user