Skip to content

Build your personal knowledge base with Trilium Notes

fix(table): frame a single-value select cell as a multi-valued one is

Elian Doran5759dbe943ba
diff --git a/apps/client/src/widgets/attribute_widgets/values_input.tsx b/apps/client/src/widgets/attribute_widgets/values_input.tsx
index 6a95254b8f..5f6b0433b0 100644
--- a/apps/client/src/widgets/attribute_widgets/values_input.tsx
+++ b/apps/client/src/widgets/attribute_widgets/values_input.tsx
@@ -91,7 +91,7 @@ export default function ValuesInput({ labelType, values, onCommit, renderValue,
}
return (
- <div className="tn-chips-field values-input">
+ <div className="tn-field values-input">
{values.map((value) => (
<Chip
key={value}
diff --git a/apps/client/src/widgets/collections/table/columns.css b/apps/client/src/widgets/collections/table/columns.css
index aaf629e5ff..ae84e0c1ab 100644
--- a/apps/client/src/widgets/collections/table/columns.css
+++ b/apps/client/src/widgets/collections/table/columns.css
@@ -71,7 +71,7 @@
/* 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-chips-field {
+ > .tn-field {
background-color: var(--input-background-color);
}
}
diff --git a/apps/client/src/widgets/collections/table/columns.tsx b/apps/client/src/widgets/collections/table/columns.tsx
index 79a414c05f..66cd6e96f4 100644
--- a/apps/client/src/widgets/collections/table/columns.tsx
+++ b/apps/client/src/widgets/collections/table/columns.tsx
@@ -359,13 +359,20 @@ function SelectEditor({ cell, success, editorParams }: EditorOpts) {
return (
<div ref={containerRef} className="table-values-editor">
- <LabelValueInput
- labelType="select"
- value={cell.getValue() ?? ""}
- selectOptions={options}
- onCommit={success}
- onCreateOption={onCreateOption}
- />
+ {/* Framed as the field of a cell holding several values is, and by the very same class, so
+ that a column reads alike whichever it holds. A box on its own would come out unframed:
+ an editor stands over its cell rather than in it, and a cell being edited strips the
+ border and background from the boxes within — which is right where one sits in the cell,
+ and leaves this one adrift on the editor's own surface. */}
+ <div className="tn-field">
+ <LabelValueInput
+ labelType="select"
+ value={cell.getValue() ?? ""}
+ selectOptions={options}
+ onCommit={success}
+ onCreateOption={onCreateOption}
+ />
+ </div>
</div>
);
}
diff --git a/apps/client/src/widgets/react/Chip.css b/apps/client/src/widgets/react/Chip.css
index c093b109ee..fd2d82bdd4 100644
--- a/apps/client/src/widgets/react/Chip.css
+++ b/apps/client/src/widgets/react/Chip.css
@@ -1,9 +1,13 @@
/*
- * A field carrying chips ahead of the box typed into: the two are framed as one, so the chips read
- * as being in the field rather than stacked above it. The box gives up its own frame and takes what
- * room is left on the line, wrapping onto the next once the chips have filled it.
+ * The field itself: whatever it is edited through — chips standing for the values held, a box typed
+ * into, a swatch — is framed as the one thing, so that its parts read as being in the field rather
+ * than stacked within it. Each gives up a frame of its own, the box taking what room is left on the
+ * line and wrapping onto the next once the chips have filled it.
+ *
+ * Named for the field rather than for the chips because a field need hold none: one value picked from
+ * a list is framed the same way, and by this same class.
*/
-.tn-chips-field {
+.tn-field {
display: flex;
flex-wrap: wrap;
align-items: center;
diff --git a/apps/client/src/widgets/react/FormAutocomplete.css b/apps/client/src/widgets/react/FormAutocomplete.css
index f94dbbd045..0da26bafa6 100644
--- a/apps/client/src/widgets/react/FormAutocomplete.css
+++ b/apps/client/src/widgets/react/FormAutocomplete.css
@@ -1,7 +1,7 @@
/*
* A field carrying chips ahead of the box typed into (see the component's `leading`) looks the same
- * here as anywhere else a set is edited, so it wears the shared `tn-chips-field` and adds nothing of
- * its own. The class remains as the handle the dropdown is measured against.
+ * here as anywhere else a field is framed, so it wears the shared `tn-field` and adds nothing of its
+ * own. The class remains as the handle the dropdown is measured against.
*/
/*
diff --git a/apps/client/src/widgets/react/FormAutocomplete.tsx b/apps/client/src/widgets/react/FormAutocomplete.tsx
index b77604f443..160761822b 100644
--- a/apps/client/src/widgets/react/FormAutocomplete.tsx
+++ b/apps/client/src/widgets/react/FormAutocomplete.tsx
@@ -233,7 +233,7 @@ export default function FormAutocomplete({ currentValue, onChange, source, openO
return (
<>
{leading !== undefined
- ? <div ref={fieldRef} className="tn-chips-field form-autocomplete-field">{leading}{field}</div>
+ ? <div ref={fieldRef} className="tn-field form-autocomplete-field">{leading}{field}</div>
: field}
{isOpen && items.length > 0 && position && createPortal(