Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
/*
* How a cell's values read — the chips, the swatch of a colour, the mark of a flag — is dressed with
* the values themselves, in label_value_display.css, so that a set reads the same in a cell as in the
* note's own promoted field. Only what is the table's own is here.
*/
/*
* The editor opens over its cell rather than inside it. A cell is as tall as one line and as wide as
* the column was dragged to, which a set of chips and a box to type in outgrows at once — laid out
* within, the chips would wrap out of sight the moment there were two.
*
* The cell it belongs to therefore stops clipping while it is being edited, and comes forward so the
* editor is drawn over the rows below rather than under them.
*/
.tabulator-row:not(.tabulator-moving) .tabulator-cell.tabulator-editing:has(> .table-values-editor) {
overflow: visible !important;
z-index: 10;
/* The cell also gives up the frame it wears while being edited, the editor standing over it with
one of its own: two would be one too many, and the cell's would stop short of the editor —
ending at the column's edge while the editor carried on past it. */
outline: none;
border-color: transparent;
background: transparent;
}
.table-values-editor {
position: absolute;
inset-block-start: 0;
inset-inline-start: 0;
/* Never narrower than the cell it stands in, and no wider than it needs — up to a ceiling, past
which the chips wrap instead of the editor running across the table. */
min-width: 100%;
width: max-content;
max-width: 320px;
/*
* The editor brings a surface of its own, opaque, because it stands over the table rather than in
* it. A field's own background is a translucent film — a tint meant to sit on the page behind it,
* and in some themes nothing at all — through which the row underneath would otherwise be read
* along with the chips.
*
* The surface is inset by the width of the field's focus ring, since an outline is drawn outside
* the element it belongs to: without the room, the ring — translucent in every theme — would fall
* past the surface and be tinted by whatever it happened to cross, coming out one colour over the
* cell and another over the table beside it.
*/
padding: 2px;
background-color: var(--main-background-color);
border-radius: var(--dropdown-border-radius, 8px);
box-shadow: 0 4px 12px rgba(0, 0, 0, var(--dropdown-shadow-opacity, 0.2));
/* Over that surface the film reads as it does anywhere else: as a field within the thing it
floats on, rather than as a hole in it. */
> .tn-field {
background-color: var(--input-background-color);
}
}
/* Anchored by its foot instead, so that what it gains rises over the rows above rather than pressing
past the foot of the pane. Applied from the editor, which is what can tell the room is short. */
.table-values-editor.grows-upwards {
inset-block-start: auto;
inset-block-end: 0;
}
.tabulator-cell.table-numeric-cell {
font-variant-numeric: tabular-nums;
}
.tabulator-cell .table-open-note {
position: absolute;
inset-block: 0;
inset-inline-end: 0;
display: flex;
align-items: center;
padding-inline: 4px var(--cell-horiz-padding-size);
background-color: var(--row-background-color);
opacity: 0;
transition: opacity 100ms linear;
}
.tabulator-cell .table-open-note .btn {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 1px 8px;
border: 1px solid var(--main-border-color);
border-radius: 6px;
background-color: var(--main-background-color);
box-shadow: 0 1px 3px rgba(0, 0, 0, calc(var(--dropdown-shadow-opacity, 0.2) * 0.75));
color: var(--muted-text-color);
font-size: 0.85em;
transition: color 100ms linear, box-shadow 100ms linear;
&:hover {
background-color: var(--main-background-color);
box-shadow: 0 2px 6px rgba(0, 0, 0, var(--dropdown-shadow-opacity, 0.2));
color: var(--main-text-color);
}
}
.tabulator-row:hover .tabulator-cell .table-open-note,
.tabulator-cell .table-open-note:focus-within {
opacity: 1;
}
@media (hover: none) {
.tabulator-cell .table-open-note {
opacity: 1;
}
}
.tabulator-cell label.table-flag-checkbox {
--box-label-gap: 0;
display: inline-block;
height: var(--box-size, 1em);
vertical-align: middle;
cursor: pointer;
&.read-only {
cursor: default;
}
}
.tabulator-cell:not(.tabulator-editable) {
.table-open-note {
display: none;
}
.table-title > .reference-link {
cursor: pointer;
}
}