@syware/jlib 0.17.1 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all.js +5 -3
- package/dist/base/jl-combobox-base.css.js +3 -0
- package/dist/base/jl-combobox-base.d.ts +202 -0
- package/dist/base/jl-combobox-base.js +632 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -2
- package/dist/lib/combobox.d.ts +12 -0
- package/dist/lib/combobox.js +22 -0
- package/dist/lib/table.d.ts +24 -3
- package/dist/lib/table.js +58 -2
- package/dist/lib/texts-de.d.ts +3 -0
- package/dist/lib/texts-de.js +3 -0
- package/dist/lib/texts-fr.d.ts +3 -0
- package/dist/lib/texts-fr.js +3 -0
- package/dist/lib/texts.d.ts +3 -0
- package/dist/lib/texts.js +3 -0
- package/dist/molecules/jl-combobox.d.ts +15 -123
- package/dist/molecules/jl-combobox.js +24 -461
- package/dist/molecules/jl-multi-combobox.css.js +3 -0
- package/dist/molecules/jl-multi-combobox.d.ts +50 -0
- package/dist/molecules/jl-multi-combobox.js +176 -0
- package/dist/organisms/jl-table.css.js +1 -1
- package/dist/organisms/jl-table.d.ts +77 -5
- package/dist/organisms/jl-table.js +223 -23
- package/dist/types/jl-combobox.types.d.ts +5 -0
- package/dist/types/jl-table.types.d.ts +22 -0
- package/package.json +2 -1
- package/dist/molecules/jl-combobox.css.js +0 -3
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { jlText } from "../lib/texts.js";
|
|
2
|
+
import { textListOf } from "../lib/attributes.js";
|
|
3
|
+
import { JlChip } from "../atoms/jl-chip.js";
|
|
4
|
+
import { toggledValue } from "../lib/combobox.js";
|
|
5
|
+
import { JlComboboxBase } from "../base/jl-combobox-base.js";
|
|
6
|
+
import jl_multi_combobox_default from "./jl-multi-combobox.css.js";
|
|
7
|
+
import { css } from "@jadis/core";
|
|
8
|
+
import { jsx } from "@jadis/core/jsx-runtime";
|
|
9
|
+
// src/molecules/jl-multi-combobox.tsx
|
|
10
|
+
/**
|
|
11
|
+
* A combobox that holds several values, shown as chips in the field: `value` and `change` are lists. Choosing an
|
|
12
|
+
* option adds it and keeps the list open for the next one; choosing it again, its chip's × or Backspace in the empty
|
|
13
|
+
* field takes it out. The list narrows as people type, or shows what the page found (`filter="none"`, `loading`,
|
|
14
|
+
* `debounce`), as `jl-combobox`'s does; the form gets each value under the field's name.
|
|
15
|
+
*/
|
|
16
|
+
var JlMultiCombobox = class extends JlComboboxBase {
|
|
17
|
+
static selector = "jl-multi-combobox";
|
|
18
|
+
_chips = /* @__PURE__ */ new Map();
|
|
19
|
+
_nameWatch = new MutationObserver(() => this.renderFormValue());
|
|
20
|
+
_parts = this.useRefs((ref) => ({
|
|
21
|
+
chips: ref(".chips"),
|
|
22
|
+
listbox: ref(".listbox"),
|
|
23
|
+
native: ref("input")
|
|
24
|
+
}));
|
|
25
|
+
templateCss() {
|
|
26
|
+
return css`${super.templateCss()}${jl_multi_combobox_default}`;
|
|
27
|
+
}
|
|
28
|
+
onConnect() {
|
|
29
|
+
super.onConnect();
|
|
30
|
+
this._parts.listbox.setAttribute("aria-multiselectable", "true");
|
|
31
|
+
this._nameWatch.observe(this, {
|
|
32
|
+
attributeFilter: ["name"],
|
|
33
|
+
attributes: true
|
|
34
|
+
});
|
|
35
|
+
this.renderFormValue();
|
|
36
|
+
}
|
|
37
|
+
onDisconnect() {
|
|
38
|
+
super.onDisconnect();
|
|
39
|
+
this._nameWatch.disconnect();
|
|
40
|
+
}
|
|
41
|
+
shaped(values) {
|
|
42
|
+
return values;
|
|
43
|
+
}
|
|
44
|
+
/** A JSON list, or one plain value. */
|
|
45
|
+
parseValue(text) {
|
|
46
|
+
return textListOf(text);
|
|
47
|
+
}
|
|
48
|
+
entryStart() {
|
|
49
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
50
|
+
class: "chips",
|
|
51
|
+
role: "list",
|
|
52
|
+
hidden: true
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A choice adds the option, or takes it out when it was held. The typed text goes, and the list stays open on the
|
|
57
|
+
* option for the next choice: the page's options, as it gave them, or all of them.
|
|
58
|
+
*/
|
|
59
|
+
chooseOption(option) {
|
|
60
|
+
const before = this.held();
|
|
61
|
+
const values = toggledValue(before, option.value);
|
|
62
|
+
this.clearTyped();
|
|
63
|
+
this.commitValues(values);
|
|
64
|
+
this.openList(false);
|
|
65
|
+
this.activate(option);
|
|
66
|
+
const added = values.length > before.length;
|
|
67
|
+
this.announce(added ? jlText("addedNamed", { names: option.label }) : jlText("removedNamed", { name: option.label }));
|
|
68
|
+
}
|
|
69
|
+
/** Typed text adds the option of that label, or itself with free text allowed; the field empties. */
|
|
70
|
+
commitTyped(text) {
|
|
71
|
+
const exact = this.optionWithLabel(text);
|
|
72
|
+
const custom = this.allowCustom.get() ? text : "";
|
|
73
|
+
const added = exact?.value ?? custom;
|
|
74
|
+
this.clearTyped();
|
|
75
|
+
if (exact !== void 0) this.rememberLabel(exact);
|
|
76
|
+
if (added === "" || this.held().includes(added)) {
|
|
77
|
+
this.renderValue();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
this.commitValues([...this.held(), added]);
|
|
81
|
+
}
|
|
82
|
+
/** The field holds only what people type: the chips show the values. */
|
|
83
|
+
fieldText() {
|
|
84
|
+
return "";
|
|
85
|
+
}
|
|
86
|
+
/** Backspace in an empty field takes the last value out. */
|
|
87
|
+
onBackspace() {
|
|
88
|
+
const last = this.held().at(-1);
|
|
89
|
+
if (this._parts.native.value !== "" || last === void 0) return false;
|
|
90
|
+
this.removeValue(last);
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
/** Tab moves on: a choice here keeps the list open, which leaving the field would not show. */
|
|
94
|
+
onTab() {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
/** `aria-selected` says which options are held: the active one is marked alone. */
|
|
98
|
+
markActive(previous, item) {
|
|
99
|
+
previous?.classList.remove("active");
|
|
100
|
+
item?.classList.add("active");
|
|
101
|
+
}
|
|
102
|
+
drawHeld(item, held) {
|
|
103
|
+
super.drawHeld(item, held);
|
|
104
|
+
item.setAttribute("aria-selected", String(held));
|
|
105
|
+
}
|
|
106
|
+
/** The placeholder shows while no value is held: chips take its place. */
|
|
107
|
+
placeholderShown() {
|
|
108
|
+
return this.held().length === 0;
|
|
109
|
+
}
|
|
110
|
+
isFilled() {
|
|
111
|
+
return super.isFilled() || this.held().length > 0;
|
|
112
|
+
}
|
|
113
|
+
renderValue() {
|
|
114
|
+
super.renderValue();
|
|
115
|
+
this.renderChips(this.held());
|
|
116
|
+
}
|
|
117
|
+
/** A disabled field keeps its chips, without their ×: a chip of its own disabled would dim its text past reading. */
|
|
118
|
+
drawDisabled() {
|
|
119
|
+
super.drawDisabled();
|
|
120
|
+
for (const { chip } of this._chips.values()) chip.removable.set(!this.isOff());
|
|
121
|
+
}
|
|
122
|
+
/** Each value under the field's name, as several checked boxes of one name would be. */
|
|
123
|
+
renderFormValue() {
|
|
124
|
+
const name = this.getAttribute("name") ?? "";
|
|
125
|
+
const data = new FormData();
|
|
126
|
+
for (const value of this.held()) data.append(name, value);
|
|
127
|
+
this.internals.setFormValue(name === "" ? null : data);
|
|
128
|
+
}
|
|
129
|
+
/** A chip's ×, or Backspace on the last one: the value goes, and the focus stays in the field. */
|
|
130
|
+
removeValue(value) {
|
|
131
|
+
if (this.isOff()) return;
|
|
132
|
+
const name = this.displayOf(value);
|
|
133
|
+
this.commitValues(this.held().filter((held) => held !== value));
|
|
134
|
+
this.announce(jlText("removedNamed", { name }));
|
|
135
|
+
this.focus();
|
|
136
|
+
}
|
|
137
|
+
/** One chip per value held, in their order: a chip stays while its value does. */
|
|
138
|
+
renderChips(held) {
|
|
139
|
+
const list = this._parts.chips;
|
|
140
|
+
for (const [value, { element }] of this._chips) if (!held.includes(value)) {
|
|
141
|
+
element.remove();
|
|
142
|
+
this._chips.delete(value);
|
|
143
|
+
}
|
|
144
|
+
held.forEach((value, index) => {
|
|
145
|
+
const { element } = this.chipFor(value);
|
|
146
|
+
const current = list.children.item(index);
|
|
147
|
+
if (current !== element) list.insertBefore(element, current);
|
|
148
|
+
});
|
|
149
|
+
list.hidden = held.length === 0;
|
|
150
|
+
}
|
|
151
|
+
chipFor(value) {
|
|
152
|
+
const label = this.displayOf(value);
|
|
153
|
+
const kept = this._chips.get(value);
|
|
154
|
+
if (kept !== void 0) {
|
|
155
|
+
kept.chip.label.set(label);
|
|
156
|
+
return kept;
|
|
157
|
+
}
|
|
158
|
+
const chip = /* @__PURE__ */ jsx(JlChip, {
|
|
159
|
+
label,
|
|
160
|
+
size: "sm",
|
|
161
|
+
removable: !this.isOff(),
|
|
162
|
+
onDismiss: () => this.removeValue(value)
|
|
163
|
+
});
|
|
164
|
+
const item = {
|
|
165
|
+
chip,
|
|
166
|
+
element: /* @__PURE__ */ jsx("li", {
|
|
167
|
+
class: "chip-item",
|
|
168
|
+
children: chip
|
|
169
|
+
})
|
|
170
|
+
};
|
|
171
|
+
this._chips.set(value, item);
|
|
172
|
+
return item;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
JlMultiCombobox.register();
|
|
176
|
+
export { JlMultiCombobox };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/organisms/jl-table.css?inline
|
|
2
|
-
var jl_table_default = ":host{contain:inline-size;--max-height:none;--cell-y:10px;--cell-x:14px;--foot-y:8px;--select-width:44px;--expand-width:36px;--lead:0px;display:block}:host([expandable]){--lead:var(--expand-width)}:host([expandable][selectable]){--expand-width:28px;--lead:calc(var(--select-width) + var(--expand-width))}:host([dense]){--cell-y:6px;--cell-x:12px;--foot-y:6px}.frame{border:1px solid var(--jl-line);border-radius:var(--jl-radius);background:var(--jl-surface);overflow:hidden}.scroll{max-height:var(--max-height);overscroll-behavior-x:contain;position:relative;overflow:auto}.foot{padding:var(--foot-y) var(--cell-x);border-top:1px solid var(--jl-line);color:var(--jl-muted);font-size:var(--jl-font-sm);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 16px;display:flex}.foot.alone{justify-content:flex-end}:host([expandable]) .scroll{container-type:inline-size}table{border-collapse:separate;border-spacing:0;width:100%;color:var(--jl-text);font-size:var(--jl-font-md);line-height:
|
|
2
|
+
var jl_table_default = ":host{contain:inline-size;--max-height:none;--cell-y:10px;--cell-x:14px;--row-line:20px;--foot-y:8px;--select-width:44px;--expand-width:36px;--lead:0px;--chooser-x:6px;--chooser-width:calc(var(--jl-control-sm) + 2 * var(--chooser-x));--scrollbar:0px;display:block}:host([expandable]){--lead:var(--expand-width)}:host([expandable][selectable]){--expand-width:28px;--lead:calc(var(--select-width) + var(--expand-width))}:host([dense]){--cell-y:6px;--cell-x:12px;--foot-y:6px}.frame{border:1px solid var(--jl-line);border-radius:var(--jl-radius);background:var(--jl-surface);position:relative;overflow:hidden}.scroll{max-height:var(--max-height);overscroll-behavior-x:contain;position:relative;overflow:auto}.chooser{top:0;right:var(--scrollbar);z-index:4;height:calc(2 * var(--cell-y) + var(--row-line));padding:0 var(--chooser-x);background:var(--jl-surface-2);align-items:center;display:flex;position:absolute}:host([column-chooser]) thead tr>:last-child{padding-right:calc(var(--cell-x) + var(--chooser-width))}.column-list{border:none;gap:8px;min-width:0;margin:0;padding:0;display:grid}.foot{padding:var(--foot-y) var(--cell-x);border-top:1px solid var(--jl-line);color:var(--jl-muted);font-size:var(--jl-font-sm);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 16px;display:flex}.foot.alone{justify-content:flex-end}:host([expandable]) .scroll{container-type:inline-size}table{border-collapse:separate;border-spacing:0;width:100%;color:var(--jl-text);font-size:var(--jl-font-md);line-height:var(--row-line)}th,td{padding:var(--cell-y) var(--cell-x);white-space:nowrap;vertical-align:middle}th{z-index:2;border-bottom:1px solid var(--jl-line);background:var(--jl-surface-2);color:var(--jl-muted);font-size:var(--jl-font-xs);letter-spacing:.01em;text-align:left;font-weight:600;position:sticky;top:0}td{border-top:1px solid var(--jl-line-soft)}tbody tr:first-child td{border-top:none}tbody tr.empty td{padding:40px var(--cell-x);color:var(--jl-muted);text-align:center}tbody tr.detail td{padding:0 var(--cell-x) calc(var(--cell-y) + 6px) calc(var(--lead) + var(--cell-x));white-space:normal;cursor:auto;border-top:none}.detail-body{left:calc(var(--lead) + var(--cell-x));max-width:calc(100cqi - var(--lead) - 2 * var(--cell-x));position:sticky}.align-left{text-align:left}.align-center{text-align:center}.align-right{text-align:right}.sort{border-radius:var(--jl-radius-xs);color:inherit;font-weight:inherit;letter-spacing:inherit;cursor:pointer;background:0 0;border:none;align-items:center;gap:4px;margin:-2px -4px;padding:2px 4px;display:inline-flex}.sort:hover{color:var(--jl-text)}.sort-icon{color:var(--jl-faint)}th[aria-sort]{color:var(--jl-text)}th[aria-sort] .sort-icon{color:var(--jl-accent)}tbody tr[data-marked] td{background:var(--jl-accent-soft)}tbody tr[data-marked] td:first-child{box-shadow:inset 3px 0 0 var(--jl-accent)}tbody tr:has(>.select-cell .checkbox:checked) td{background:var(--jl-accent-soft)}tbody tr:not(.empty,.skeleton,.detail,:has(>.select-cell .checkbox:checked)):hover td,:host([striped]) tbody tr:nth-child(2n of :where(:not(.detail))):not(.empty,[data-marked],:has(>.select-cell .checkbox:checked)) td{background:var(--jl-surface-2)}:host([striped]) tbody tr:not(.empty,.skeleton,.detail,:has(>.select-cell .checkbox:checked)):hover td{background:var(--jl-surface-3)}:host([striped]) tbody tr:nth-child(2n of :where(:not(.detail))):not([data-marked],:has(>.select-cell .checkbox:checked))+.detail td{background:var(--jl-surface-2)}.format-number{font-variant-numeric:tabular-nums}td.wrap{white-space:normal;overflow-wrap:anywhere;min-width:160px}.format-date{color:var(--jl-text-2);font-variant-numeric:tabular-nums}code{border-radius:var(--jl-radius-xs);background:var(--jl-code-bg);font-size:var(--jl-font-xs);padding:2px 6px}.select-cell{width:var(--select-width);min-width:var(--select-width);padding-right:0;line-height:0}.expand-cell{width:var(--expand-width);min-width:var(--expand-width);padding-right:0;padding-left:calc(var(--cell-x) - 4px);line-height:0}.select-cell+.expand-cell{padding-left:0}tbody tr[data-index]{cursor:var(--row-cursor,auto)}:host([expandable]) tbody tr[data-index]{cursor:pointer}.expand{border-radius:var(--jl-radius-xs);width:24px;height:24px;color:var(--jl-muted);cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;margin:-2px 0;padding:0;display:inline-flex}.expand:hover{color:var(--jl-text)}.chevron{transition:rotate var(--jl-fast) var(--jl-ease)}.expand[aria-expanded=true] .chevron{rotate:90deg}.check{display:inline-flex;position:relative}.checkbox{border:1.5px solid var(--jl-line-strong);background:var(--jl-surface);cursor:pointer;appearance:none;width:16px;height:16px;transition:background var(--jl-fast) var(--jl-ease), border-color var(--jl-fast) var(--jl-ease);border-radius:4px;margin:0}.checkbox:hover{border-color:var(--jl-muted)}.checkbox:checked,.checkbox:indeterminate{border-color:var(--jl-accent);background:var(--jl-accent)}.checkbox:disabled{cursor:not-allowed;opacity:.5}.mark{pointer-events:none;position:absolute;inset:0}.checkbox:checked+.mark:after{border:solid var(--jl-on-accent);content:\"\";border-width:0 2px 2px 0;width:5px;height:9px;position:absolute;top:2.5px;left:5.5px;rotate:45deg}.checkbox:indeterminate+.mark:after{background:var(--jl-on-accent);content:\"\";border-radius:1px;height:2px;position:absolute;top:7px;left:4px;right:4px}.empty-content{align-items:center;gap:8px;display:inline-flex}.empty jl-icon{color:var(--jl-faint)}.bone{border-radius:var(--jl-radius-pill);background:linear-gradient(90deg, var(--jl-surface-3) 30%, var(--jl-surface-2) 50%, var(--jl-surface-3) 70%) 0 0 / 300% 100%;vertical-align:middle;width:70%;max-width:160px;height:10px;animation:1.4s linear infinite shimmer;display:inline-block}.bone.box{border-radius:4px;width:16px;height:16px}tbody tr.skeleton:nth-child(3n+2) .bone:not(.box){width:50%}tbody tr.skeleton:nth-child(3n) .bone:not(.box){width:85%}@media (prefers-reduced-motion:reduce){.bone{animation:none}}@keyframes shimmer{0%{background-position:100% 0}to{background-position:0 0}}.cell-description{color:var(--jl-muted);font-size:var(--jl-font-xs);margin-top:2px}";
|
|
3
3
|
export { jl_table_default as default };
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { JlElement } from '../base/jl-element';
|
|
2
|
-
import type { TableColumn, TableColumnKey, TableDetailRenderer, TableExpansion, TableField, TablePress, TableRenderers, TableRow, TableRowKey, TableSort, TableSortDirection, TableToggle } from '../types/jl-table.types';
|
|
2
|
+
import type { TableColumn, TableColumnKey, TableDetailRenderer, TableExpansion, TableField, TablePress, TableRenderers, TableRow, TableRowKey, TableSort, TableSortDirection, TableSortMode, TableToggle } from '../types/jl-table.types';
|
|
3
3
|
export declare const TABLE_SORT_DIRECTIONS: readonly TableSortDirection[];
|
|
4
|
+
export declare const TABLE_SORT_MODES: readonly TableSortMode[];
|
|
4
5
|
export declare const TABLE_EXPANSIONS: readonly TableExpansion[];
|
|
5
6
|
/**
|
|
6
7
|
* Rows of data under column headings. `columns` say what each column shows and how (`format`: text, number, date,
|
|
7
8
|
* badge, code); `rows` are plain objects. Sortable headings cycle ascending, descending and unsorted, and sort the
|
|
8
|
-
* rows in place; `selectable` adds a checkbox column.
|
|
9
|
-
* `
|
|
10
|
-
*
|
|
9
|
+
* rows in place, or leave the order to the page (`sort-mode="remote"`); `selectable` adds a checkbox column.
|
|
10
|
+
* `hidden-columns` leaves columns out, and `column-chooser` lets people choose them. The header stays on top while the
|
|
11
|
+
* rows scroll within `max-height`, and the table scrolls sideways on narrow screens. Cells of a column can be drawn by
|
|
12
|
+
* code with `renderers`. `expandable` rows open on a press to show their `detail` under them, the row staying as it is: one at
|
|
11
13
|
* a time (`single`) or any number (`multiple`). A press on a row fires `press` with the row, the button and the
|
|
12
14
|
* browser's event, which a page cancels to refuse it: to open a record on a click, its own menu on a right click.
|
|
13
15
|
*
|
|
@@ -21,6 +23,7 @@ export declare class JlTable<Row extends object = TableRow, Extra extends string
|
|
|
21
23
|
selection: TableRowKey[];
|
|
22
24
|
toggle: TableToggle;
|
|
23
25
|
press: TablePress<Row>;
|
|
26
|
+
columns: TableColumnKey<Row, Extra>[];
|
|
24
27
|
}>>;
|
|
25
28
|
readonly columns: Readonly<Readonly<{
|
|
26
29
|
get(): TableColumn<Row, Extra>[];
|
|
@@ -44,6 +47,39 @@ export declare class JlTable<Row extends object = TableRow, Extra extends string
|
|
|
44
47
|
get(): TableSortDirection;
|
|
45
48
|
set(setter: ((prevState: TableSortDirection) => TableSortDirection) | TableSortDirection): void;
|
|
46
49
|
}>>;
|
|
50
|
+
/**
|
|
51
|
+
* Who orders the rows: the table (`local`), or the page (`remote`): a heading's press then shows the sort and
|
|
52
|
+
* emits `sort`, and the rows stay in the order given, as a server sorted them.
|
|
53
|
+
*/
|
|
54
|
+
readonly sortMode: Readonly<Readonly<{
|
|
55
|
+
get(): TableSortMode;
|
|
56
|
+
set(setter: ((prevState: TableSortMode) => TableSortMode) | TableSortMode): void;
|
|
57
|
+
}>>;
|
|
58
|
+
/** The keys of the columns not drawn; a column with `hideable: false` shows whatever it says. */
|
|
59
|
+
readonly hiddenColumns: Readonly<Readonly<{
|
|
60
|
+
get(): TableColumnKey<Row, Extra>[];
|
|
61
|
+
set(setter: TableColumnKey<Row, Extra>[] | ((prevState: TableColumnKey<Row, Extra>[]) => TableColumnKey<Row, Extra>[])): void;
|
|
62
|
+
}>>;
|
|
63
|
+
/** A button at the end of the header row opens the list of columns, whose boxes show or hide them. */
|
|
64
|
+
readonly columnChooser: Readonly<Readonly<{
|
|
65
|
+
get(): boolean;
|
|
66
|
+
set(setter: boolean | ((prevState: boolean) => boolean)): void;
|
|
67
|
+
}>>;
|
|
68
|
+
/** How many columns stay in view at the start while the rows scroll sideways; the checkbox and chevron stay too. */
|
|
69
|
+
readonly frozenStart: Readonly<Readonly<{
|
|
70
|
+
get(): number;
|
|
71
|
+
set(setter: number | ((prevState: number) => number)): void;
|
|
72
|
+
}>>;
|
|
73
|
+
/** How many columns stay in view at the end while the rows scroll sideways. */
|
|
74
|
+
readonly frozenEnd: Readonly<Readonly<{
|
|
75
|
+
get(): number;
|
|
76
|
+
set(setter: number | ((prevState: number) => number)): void;
|
|
77
|
+
}>>;
|
|
78
|
+
/** The column chooser's name, on its button and over its list; jlib's own text when empty. */
|
|
79
|
+
readonly columnsLabel: Readonly<Readonly<{
|
|
80
|
+
get(): string;
|
|
81
|
+
set(setter: string | ((prevState: string) => string)): void;
|
|
82
|
+
}>>;
|
|
47
83
|
/** Adds a checkbox to each row, and one in the header that selects them all. */
|
|
48
84
|
readonly selectable: Readonly<Readonly<{
|
|
49
85
|
get(): boolean;
|
|
@@ -106,6 +142,12 @@ export declare class JlTable<Row extends object = TableRow, Extra extends string
|
|
|
106
142
|
}>>;
|
|
107
143
|
private readonly _source;
|
|
108
144
|
private readonly _pending;
|
|
145
|
+
private readonly _frozen;
|
|
146
|
+
/**
|
|
147
|
+
* The column chooser once drawn, its boxes by column key, changed in place so the focus stays on the box pressed,
|
|
148
|
+
* and what watches the rows' scrollbar, which the chooser stands beside.
|
|
149
|
+
*/
|
|
150
|
+
private readonly _chooser;
|
|
109
151
|
/**
|
|
110
152
|
* The rows as drawn in the order of `rows` (the rows and their checkboxes carry their place), by key, and their
|
|
111
153
|
* keys in the order shown; the keys each state was last drawn for, so a change redraws only the rows it concerns.
|
|
@@ -120,12 +162,30 @@ export declare class JlTable<Row extends object = TableRow, Extra extends string
|
|
|
120
162
|
templateHtml(): Node;
|
|
121
163
|
templateCss(): string;
|
|
122
164
|
onConnect(): void;
|
|
165
|
+
onDisconnect(): void;
|
|
166
|
+
/** Shows or hides the column chooser, drawn the first time it shows: a table without one builds none. */
|
|
167
|
+
private renderColumnChooser;
|
|
168
|
+
private drawChooser;
|
|
169
|
+
/** The rows' scrollbar is watched while the chooser shows, so it stands beside the bar, not over it. */
|
|
170
|
+
private watchScrollbar;
|
|
171
|
+
/** The scroller's width counts its scrollbar and its client width does not: the chooser moves left by the bar. */
|
|
172
|
+
private placeChooser;
|
|
123
173
|
/** The bar under the rows shows when the page put something in it; what stands there alone goes to its end. */
|
|
124
174
|
private drawFoot;
|
|
125
175
|
/** Draws on the next microtask: the inputs set while connecting give one drawing, not one each. */
|
|
126
176
|
protected drawTexts(): void;
|
|
177
|
+
/** The chooser's name: its button's, its list's and the heading over the list. */
|
|
178
|
+
private drawColumnsLabel;
|
|
127
179
|
private schedule;
|
|
128
180
|
private flush;
|
|
181
|
+
/** The columns drawn: all but the hidden ones, a column that cannot be hidden staying. */
|
|
182
|
+
private shownColumns;
|
|
183
|
+
/** One box per column, in their order, drawn again when the columns change. */
|
|
184
|
+
private renderChooser;
|
|
185
|
+
/** Ticks the boxes of the columns shown and turns off those that cannot change, in place. */
|
|
186
|
+
private renderChoices;
|
|
187
|
+
/** A box of the chooser was ticked or cleared: the column shows or hides, and the page hears which are hidden. */
|
|
188
|
+
private chooseColumn;
|
|
129
189
|
private sortBy;
|
|
130
190
|
private changeSelection;
|
|
131
191
|
/** A press on a row's chevron, or on the row anywhere but its controls and its checkbox, opens or closes it. */
|
|
@@ -147,11 +207,23 @@ export declare class JlTable<Row extends object = TableRow, Extra extends string
|
|
|
147
207
|
private isExpandable;
|
|
148
208
|
/** The number of cells in a row: the columns, after the checkbox and the chevron when there are. */
|
|
149
209
|
private span;
|
|
210
|
+
/** The cells that stay in view at each side: the frozen columns among those shown, the lead cells with the start. */
|
|
211
|
+
private frozenCells;
|
|
212
|
+
/** The rules that keep the frozen cells in view, by their place in the row: rows drawn later need nothing. */
|
|
213
|
+
private renderFrozen;
|
|
214
|
+
private watchFrozen;
|
|
215
|
+
/** The frozen cells' offsets, from the headings' widths, and whether the rows scroll sideways, which shows the lines. */
|
|
216
|
+
private measureFrozen;
|
|
217
|
+
private setFrozenOffsets;
|
|
218
|
+
private headingCells;
|
|
150
219
|
private renderHead;
|
|
151
220
|
private headerCell;
|
|
152
221
|
/** The arrows and `aria-sort` of the sortable headings, changed in place so a pressed heading keeps the focus. */
|
|
153
222
|
private renderSortState;
|
|
154
|
-
/**
|
|
223
|
+
/**
|
|
224
|
+
* The drawn rows in the order of the sort; each row's sort value is read once, not at every comparison. Sorted by
|
|
225
|
+
* the page, they stay in the order given.
|
|
226
|
+
*/
|
|
155
227
|
private sortedView;
|
|
156
228
|
private renderBody;
|
|
157
229
|
/** New rows, which show no state yet: the flush draws the selection, the marks and the open rows on them. */
|