@fusion.dev/helix-headless 0.240.3 → 0.240.5
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/api.json +1 -1
- package/custom-elements.json +1 -1
- package/dist/column-manager/root/column-manager-root.d.ts +12 -1
- package/dist/column-manager/root/column-manager-root.js +18 -10
- package/dist/markdown/root/markdown-root.d.ts +1 -0
- package/dist/markdown/root/markdown-root.js +6 -1
- package/dist/markdown/tree.d.ts +4 -2
- package/dist/markdown/tree.js +7 -4
- package/dist/table-export/root/table-export-root.d.ts +28 -11
- package/dist/table-export/root/table-export-root.js +49 -29
- package/dist/tree/item/tree-item.d.ts +30 -4
- package/dist/tree/item/tree-item.js +15 -6
- package/dist/view-panel/root/view-panel-root.d.ts +11 -3
- package/dist/view-panel/root/view-panel-root.js +18 -13
- package/examples.json +1 -1
- package/lint.json +1 -1
- package/package.json +6 -6
- package/types/jsx.d.ts +59 -15
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type TemplateResult } from 'lit';
|
|
3
3
|
import { TableBinding, type ToolColumn, type ToolTable } from '../../data-table/binding.js';
|
|
4
|
+
import '../../checkbox/index.js';
|
|
4
5
|
/**
|
|
5
6
|
* @summary A list of a Data Table's columns, to show, hide, reorder, and pin them.
|
|
6
7
|
*
|
|
@@ -46,7 +47,17 @@ import { TableBinding, type ToolColumn, type ToolTable } from '../../data-table/
|
|
|
46
47
|
* @aliases Column picker, Column chooser
|
|
47
48
|
* @documentation https://fusion.dev/helix/components/column-manager
|
|
48
49
|
*
|
|
49
|
-
* @csspart checkbox - The
|
|
50
|
+
* @csspart checkbox - The `Checkbox` that shows or hides a column.
|
|
51
|
+
* @csspart checkbox-box - The box drawn for a row's checkbox.
|
|
52
|
+
* @csspart checkbox-control - The native input inside a row's checkbox.
|
|
53
|
+
* @csspart checkbox-feedback - Forwarded from the checkbox. Not shown, since a column's box is never wrong.
|
|
54
|
+
* @csspart checkbox-field - The row inside a checkbox that holds its box and the column's name.
|
|
55
|
+
* @csspart checkbox-hint - Forwarded from the checkbox. Not shown, since a column's box has no help.
|
|
56
|
+
* @csspart checkbox-label - The label beside a row's box, which holds `name`.
|
|
57
|
+
* @csspart checkbox-mark - The check mark on a row's box.
|
|
58
|
+
* @csspart checkbox-mark-checked - Added to `checkbox-mark` while the column shows.
|
|
59
|
+
* @csspart checkbox-mark-dash - Forwarded from the checkbox. Not shown, since a column is shown or hidden.
|
|
60
|
+
* @csspart checkbox-mark-indeterminate - Forwarded from the checkbox. Not shown, since a column is shown or hidden.
|
|
50
61
|
* @csspart grip - The button that moves a column.
|
|
51
62
|
* @csspart grip-mark - The icon on the grip.
|
|
52
63
|
* @csspart header - The row above the list that holds the title and the reset button.
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { customElement, formatWords, HelixElement, words } from '@fusion.dev/helix-core';
|
|
2
|
+
import { customElement, formatWords, HelixElement, words, } from '@fusion.dev/helix-core';
|
|
3
3
|
import { dotsSixVertical, pushPin, pushPinSlash } from '@fusion.dev/helix-icons';
|
|
4
|
-
import {
|
|
4
|
+
import { nothing } from 'lit';
|
|
5
5
|
import { property, state } from 'lit/decorators.js';
|
|
6
6
|
import { repeat } from 'lit/directives/repeat.js';
|
|
7
7
|
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
8
|
+
import { html } from 'lit/static-html.js';
|
|
8
9
|
import { columnName, TableBinding, } from '../../data-table/binding.js';
|
|
10
|
+
import '../../checkbox/index.js';
|
|
9
11
|
const nextPin = (now) => now === undefined ? 'start' : now === 'start' ? 'end' : undefined;
|
|
10
12
|
let HelixHeadlessColumnManager = class HelixHeadlessColumnManager extends HelixElement {
|
|
11
13
|
constructor() {
|
|
@@ -152,6 +154,7 @@ let HelixHeadlessColumnManager = class HelixHeadlessColumnManager extends HelixE
|
|
|
152
154
|
const note = pin ? this.pinnedLabel : dropped ? this.droppedLabel : '';
|
|
153
155
|
const pinName = pin === 'start' ? 'pinEndLabel' : pin === 'end' ? 'unpinLabel' : 'pinStartLabel';
|
|
154
156
|
const icon = pin === 'end' ? pushPinSlash : pushPin;
|
|
157
|
+
const checkbox = this.tag('checkbox');
|
|
155
158
|
return html `<li
|
|
156
159
|
part="item${this.dragging === field ? ' item-dragging' : ''}${shown ? '' : ' item-hidden'}"
|
|
157
160
|
data-field=${field}
|
|
@@ -164,14 +167,19 @@ let HelixHeadlessColumnManager = class HelixHeadlessColumnManager extends HelixE
|
|
|
164
167
|
>
|
|
165
168
|
<button part="grip" type="button" aria-label=${formatWords(this, 'moveLabel', { name })}
|
|
166
169
|
><svg aria-hidden="true" fill="currentColor" part="grip-mark" viewBox=${dotsSixVertical.viewBox}>${unsafeSVG(dotsSixVertical.content)}</svg></button
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
170
|
+
><${checkbox}
|
|
171
|
+
part="checkbox"
|
|
172
|
+
exportparts="box: checkbox-box, control: checkbox-control, feedback: checkbox-feedback,
|
|
173
|
+
field: checkbox-field, hint: checkbox-hint, label: checkbox-label, mark: checkbox-mark,
|
|
174
|
+
mark-checked: checkbox-mark-checked, mark-dash: checkbox-mark-dash,
|
|
175
|
+
mark-indeterminate: checkbox-mark-indeterminate"
|
|
176
|
+
.checked=${shown}
|
|
177
|
+
?disabled=${shown && onlyShown}
|
|
178
|
+
@helix-before-check=${(event) => {
|
|
179
|
+
event.preventDefault();
|
|
180
|
+
this.toggleColumn(field, event.detail.checked);
|
|
181
|
+
}}
|
|
182
|
+
><span part="name">${name}</span></${checkbox}
|
|
175
183
|
>${note ? html `<span part="note">${note}</span>` : nothing}<button
|
|
176
184
|
part="pin${pin ? ' pin-pinned' : ''}"
|
|
177
185
|
type="button"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type CSSResultGroup, type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
import '../../callout/index.js';
|
|
4
|
+
import '../../checkbox/index.js';
|
|
4
5
|
import '../../code-block/index.js';
|
|
5
6
|
/**
|
|
6
7
|
* @summary Markdown drawn as a document, which streams in place as a reply arrives.
|
|
@@ -3,6 +3,7 @@ import { customElement, HelixElement, internalsOf, words } from '@fusion.dev/hel
|
|
|
3
3
|
import { css, html } from 'lit';
|
|
4
4
|
import { property } from 'lit/decorators.js';
|
|
5
5
|
import '../../callout/index.js';
|
|
6
|
+
import '../../checkbox/index.js';
|
|
6
7
|
import '../../code-block/index.js';
|
|
7
8
|
import { MarkdownWriter } from '../writer.js';
|
|
8
9
|
let HelixHeadlessMarkdown = class HelixHeadlessMarkdown extends HelixElement {
|
|
@@ -45,7 +46,11 @@ let HelixHeadlessMarkdown = class HelixHeadlessMarkdown extends HelixElement {
|
|
|
45
46
|
tip: this.tipHeading,
|
|
46
47
|
warning: this.warningHeading,
|
|
47
48
|
},
|
|
48
|
-
tags: {
|
|
49
|
+
tags: {
|
|
50
|
+
callout: `${tier}callout`,
|
|
51
|
+
checkbox: `${tier}checkbox`,
|
|
52
|
+
codeBlock: `${tier}code-block`,
|
|
53
|
+
},
|
|
49
54
|
};
|
|
50
55
|
if (!this.writer) {
|
|
51
56
|
this.writer = new MarkdownWriter(this, options);
|
package/dist/markdown/tree.d.ts
CHANGED
|
@@ -12,8 +12,9 @@ export interface MarkdownOptions {
|
|
|
12
12
|
/** Each alert's heading by its kind. English by default. */
|
|
13
13
|
headings?: Partial<Record<MarkdownAlertKind, string>> | undefined;
|
|
14
14
|
/**
|
|
15
|
-
* The tags for a fence and
|
|
16
|
-
* `helix-code-block` and `helix-
|
|
15
|
+
* The tags for a fence, an alert and a task's box, which name the tier they
|
|
16
|
+
* are drawn in. `helix-code-block`, `helix-callout` and `helix-checkbox` by
|
|
17
|
+
* default.
|
|
17
18
|
*/
|
|
18
19
|
tags?: Partial<MarkdownTags> | undefined;
|
|
19
20
|
}
|
|
@@ -25,6 +26,7 @@ export interface MarkdownFilled {
|
|
|
25
26
|
/** The elements a document draws from another family. */
|
|
26
27
|
export interface MarkdownTags {
|
|
27
28
|
callout: string;
|
|
29
|
+
checkbox: string;
|
|
28
30
|
codeBlock: string;
|
|
29
31
|
}
|
|
30
32
|
/**
|
package/dist/markdown/tree.js
CHANGED
|
@@ -76,9 +76,7 @@ const itemNode = (item, open, options) => {
|
|
|
76
76
|
if (item.checked === undefined) {
|
|
77
77
|
return element('li', [...lead, ...tail]);
|
|
78
78
|
}
|
|
79
|
-
const box = element(
|
|
80
|
-
? { checked: '', disabled: '', type: 'checkbox' }
|
|
81
|
-
: { disabled: '', type: 'checkbox' });
|
|
79
|
+
const box = element(options.tags.checkbox, [], item.checked ? { checked: '', readonly: '' } : { readonly: '' });
|
|
82
80
|
return element('li', [box, ' ', ...lead, ...tail], { 'data-task': '' });
|
|
83
81
|
};
|
|
84
82
|
export const blockNode = (block, open, options) => {
|
|
@@ -118,7 +116,12 @@ export const blockNode = (block, open, options) => {
|
|
|
118
116
|
};
|
|
119
117
|
export const withDefaults = (options = {}) => ({
|
|
120
118
|
headings: { ...HEADINGS, ...options.headings },
|
|
121
|
-
tags: {
|
|
119
|
+
tags: {
|
|
120
|
+
callout: 'helix-callout',
|
|
121
|
+
checkbox: 'helix-checkbox',
|
|
122
|
+
codeBlock: 'helix-code-block',
|
|
123
|
+
...options.tags,
|
|
124
|
+
},
|
|
122
125
|
});
|
|
123
126
|
export const markdownNodes = (text, options = {}) => {
|
|
124
127
|
const filled = withDefaults(options);
|
|
@@ -3,6 +3,7 @@ import { type TemplateResult } from 'lit';
|
|
|
3
3
|
import { TableBinding, type ToolTable } from '../../data-table/binding.js';
|
|
4
4
|
import type { ExportColumns, ExportFormat, ExportRows, ExportValues } from '../../data-table/export.js';
|
|
5
5
|
import '../../button/index.js';
|
|
6
|
+
import '../../radio/index.js';
|
|
6
7
|
/** The choices as they stand. */
|
|
7
8
|
interface ExportChoices {
|
|
8
9
|
columns: ExportColumns;
|
|
@@ -40,10 +41,16 @@ interface ExportChoices {
|
|
|
40
41
|
* @documentation https://fusion.dev/helix/components/table-export
|
|
41
42
|
*
|
|
42
43
|
* @csspart actions - The row that holds Copy and Export.
|
|
43
|
-
* @csspart choice - One choice
|
|
44
|
+
* @csspart choice - One choice, a `Radio`.
|
|
45
|
+
* @csspart choice-box - The circle of a choice's `Radio`.
|
|
44
46
|
* @csspart choice-checked - Added to `choice` while it is chosen.
|
|
45
|
-
* @csspart choice-
|
|
46
|
-
* @csspart
|
|
47
|
+
* @csspart choice-item - The button of a choice's `Radio`, which covers it.
|
|
48
|
+
* @csspart choice-label - The words of a choice's `Radio`.
|
|
49
|
+
* @csspart columns - The `Radio Group` that chooses the columns.
|
|
50
|
+
* @csspart columns-feedback - Forwarded from the radio group. Not shown, since a choice of columns is never wrong.
|
|
51
|
+
* @csspart columns-hint - Forwarded from the radio group. Not shown, since the columns have no help.
|
|
52
|
+
* @csspart columns-items - The column choices inside `columns`.
|
|
53
|
+
* @csspart columns-label - The name of `columns`.
|
|
47
54
|
* @csspart copy - The button that copies the rows.
|
|
48
55
|
* @csspart copy-button - Forwarded from the button: the button inside `copy`.
|
|
49
56
|
* @csspart copy-live - Forwarded from the button. Not shown in the panel, whose buttons do not load.
|
|
@@ -54,12 +61,22 @@ interface ExportChoices {
|
|
|
54
61
|
* @csspart export-live - Forwarded from the button. Not shown in the panel, whose buttons do not load.
|
|
55
62
|
* @csspart export-spinner - Forwarded from the button. Not shown in the panel, whose buttons do not load.
|
|
56
63
|
* @csspart export-text - Forwarded from the button: the words inside `export`.
|
|
57
|
-
* @csspart format - The
|
|
58
|
-
* @csspart
|
|
64
|
+
* @csspart format - The `Radio Group` that chooses the format.
|
|
65
|
+
* @csspart format-feedback - Forwarded from the radio group. Not shown, since a choice of format is never wrong.
|
|
66
|
+
* @csspart format-hint - Forwarded from the radio group. Not shown, since the format has no help.
|
|
67
|
+
* @csspart format-items - The format choices inside `format`.
|
|
68
|
+
* @csspart format-label - The name of `format`.
|
|
59
69
|
* @csspart live - The region that says the rows were copied. Visually hidden in the styled tier.
|
|
60
|
-
* @csspart
|
|
61
|
-
* @csspart rows -
|
|
62
|
-
* @csspart
|
|
70
|
+
* @csspart rows - The `Radio Group` that chooses the rows.
|
|
71
|
+
* @csspart rows-feedback - Forwarded from the radio group. Not shown, since a choice of rows is never wrong.
|
|
72
|
+
* @csspart rows-hint - Forwarded from the radio group. Not shown, since the rows have no help.
|
|
73
|
+
* @csspart rows-items - The row choices inside `rows`.
|
|
74
|
+
* @csspart rows-label - The name of `rows`.
|
|
75
|
+
* @csspart values - The `Radio Group` that chooses the values.
|
|
76
|
+
* @csspart values-feedback - Forwarded from the radio group. Not shown, since a choice of values is never wrong.
|
|
77
|
+
* @csspart values-hint - Forwarded from the radio group. Not shown, since the values have no help.
|
|
78
|
+
* @csspart values-items - The value choices inside `values`.
|
|
79
|
+
* @csspart values-label - The name of `values`.
|
|
63
80
|
*/
|
|
64
81
|
export declare class HelixHeadlessTableExport extends HelixElement {
|
|
65
82
|
/**
|
|
@@ -115,11 +132,11 @@ export declare class HelixHeadlessTableExport extends HelixElement {
|
|
|
115
132
|
export(): boolean;
|
|
116
133
|
/** Copies the rows as TSV, as Copy does. */
|
|
117
134
|
copy(): Promise<boolean>;
|
|
118
|
-
/** The choices of one group, each a
|
|
119
|
-
protected renderChoices<T extends string>(
|
|
135
|
+
/** The choices of one group, each a `Radio`. */
|
|
136
|
+
protected renderChoices<T extends string>(current: T, choices: readonly {
|
|
120
137
|
label: string;
|
|
121
138
|
value: T;
|
|
122
|
-
}[]
|
|
139
|
+
}[]): TemplateResult[];
|
|
123
140
|
/** Copy and Export, as this tier's buttons. */
|
|
124
141
|
protected renderActions(count: number, found: boolean): TemplateResult;
|
|
125
142
|
protected render(): TemplateResult;
|
|
@@ -5,6 +5,7 @@ import { property, state } from 'lit/decorators.js';
|
|
|
5
5
|
import { html } from 'lit/static-html.js';
|
|
6
6
|
import { TableBinding } from '../../data-table/binding.js';
|
|
7
7
|
import '../../button/index.js';
|
|
8
|
+
import '../../radio/index.js';
|
|
8
9
|
const exports = (table) => table !== null && typeof table.download === 'function';
|
|
9
10
|
let HelixHeadlessTableExport = class HelixHeadlessTableExport extends HelixElement {
|
|
10
11
|
constructor() {
|
|
@@ -64,16 +65,13 @@ let HelixHeadlessTableExport = class HelixHeadlessTableExport extends HelixEleme
|
|
|
64
65
|
this.said = formatWords(this, 'copiedLabel', { count: table.exportData(options).rows.length });
|
|
65
66
|
return true;
|
|
66
67
|
}
|
|
67
|
-
renderChoices(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
.checked=${choice.value === current}
|
|
75
|
-
@change=${() => choose(choice.value)}
|
|
76
|
-
/>${choice.label}</label
|
|
68
|
+
renderChoices(current, choices) {
|
|
69
|
+
const radio = this.tag('radio');
|
|
70
|
+
return choices.map((choice) => html `<${radio}
|
|
71
|
+
part="choice${choice.value === current ? ' choice-checked' : ''}"
|
|
72
|
+
exportparts="box: choice-box, item: choice-item, label: choice-label"
|
|
73
|
+
value=${choice.value}
|
|
74
|
+
>${choice.label}</${radio}
|
|
77
75
|
>`);
|
|
78
76
|
}
|
|
79
77
|
renderActions(count, found) {
|
|
@@ -104,9 +102,8 @@ let HelixHeadlessTableExport = class HelixHeadlessTableExport extends HelixEleme
|
|
|
104
102
|
{ label: 'JSON', value: 'json' },
|
|
105
103
|
...(exports(table) && table.xlsx ? [{ label: 'XLSX', value: 'xlsx' }] : []),
|
|
106
104
|
];
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
<div part="options">${this.renderChoices('rows', options.rows, [
|
|
105
|
+
const group = this.tag('radio-group');
|
|
106
|
+
const rows = [
|
|
110
107
|
...(selected > 0
|
|
111
108
|
? [
|
|
112
109
|
{
|
|
@@ -123,11 +120,24 @@ let HelixHeadlessTableExport = class HelixHeadlessTableExport extends HelixEleme
|
|
|
123
120
|
label: formatWords(this, 'allRowsLabel', { count: table?.everyRowCount ?? 0 }),
|
|
124
121
|
value: 'all',
|
|
125
122
|
},
|
|
126
|
-
]
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
123
|
+
];
|
|
124
|
+
const value = (event) => event.target.value;
|
|
125
|
+
return html `<${group}
|
|
126
|
+
part="rows"
|
|
127
|
+
exportparts="feedback: rows-feedback, hint: rows-hint, items: rows-items, label: rows-label"
|
|
128
|
+
label=${this.rowsLabel}
|
|
129
|
+
.value=${options.rows}
|
|
130
|
+
@change=${(event) => (this.chosenRows = value(event))}
|
|
131
|
+
>${this.renderChoices(options.rows, rows)}</${group}
|
|
132
|
+
>
|
|
133
|
+
<${group}
|
|
134
|
+
part="columns"
|
|
135
|
+
exportparts="feedback: columns-feedback, hint: columns-hint, items: columns-items, label: columns-label"
|
|
136
|
+
label=${this.columnsLabel}
|
|
137
|
+
orientation="horizontal"
|
|
138
|
+
.value=${options.columns}
|
|
139
|
+
@change=${(event) => (this.chosenColumns = value(event))}
|
|
140
|
+
>${this.renderChoices(options.columns, [
|
|
131
141
|
{
|
|
132
142
|
label: formatWords(this, 'visibleColumnsLabel', { count: visible }),
|
|
133
143
|
value: 'visible',
|
|
@@ -136,19 +146,29 @@ let HelixHeadlessTableExport = class HelixHeadlessTableExport extends HelixEleme
|
|
|
136
146
|
label: formatWords(this, 'allColumnsLabel', { count: columns.length }),
|
|
137
147
|
value: 'all',
|
|
138
148
|
},
|
|
139
|
-
]
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
149
|
+
])}</${group}
|
|
150
|
+
>
|
|
151
|
+
<${group}
|
|
152
|
+
part="values"
|
|
153
|
+
exportparts="feedback: values-feedback, hint: values-hint, items: values-items, label: values-label"
|
|
154
|
+
label=${this.valuesLabel}
|
|
155
|
+
orientation="horizontal"
|
|
156
|
+
.value=${options.values}
|
|
157
|
+
@change=${(event) => (this.chosenValues = value(event))}
|
|
158
|
+
>${this.renderChoices(options.values, [
|
|
144
159
|
{ label: this.shownLabel, value: 'shown' },
|
|
145
160
|
{ label: this.rawLabel, value: 'raw' },
|
|
146
|
-
]
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
161
|
+
])}</${group}
|
|
162
|
+
>
|
|
163
|
+
<${group}
|
|
164
|
+
part="format"
|
|
165
|
+
exportparts="feedback: format-feedback, hint: format-hint, items: format-items, label: format-label"
|
|
166
|
+
label=${this.formatLabel}
|
|
167
|
+
orientation="horizontal"
|
|
168
|
+
.value=${options.format}
|
|
169
|
+
@change=${(event) => (this.chosenFormat = value(event))}
|
|
170
|
+
>${this.renderChoices(options.format, formats)}</${group}
|
|
171
|
+
>
|
|
152
172
|
${this.renderActions(count, table !== null)}
|
|
153
173
|
<span part="live" aria-live="polite">${this.said || nothing}</span>`;
|
|
154
174
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
|
+
import '../../checkbox/index.js';
|
|
3
4
|
/** Where an item stands in a move: the item being moved, or the one the drop indicator is beside. */
|
|
4
5
|
export type TreeItemMove = 'dragging' | 'drop-after' | 'drop-before';
|
|
5
6
|
declare const HelixHeadlessTreeItem_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerOpenInterface) & typeof HelixElement;
|
|
@@ -72,9 +73,20 @@ declare const HelixHeadlessTreeItem_base: (new (...args: any[]) => import("@fusi
|
|
|
72
73
|
* @event {ToggleEvent} toggle - Sent when the branch opens or closes, with `newState` and `oldState`.
|
|
73
74
|
*
|
|
74
75
|
* @csspart actions - The `actions` slot, which draws no box of its own. `inert` while the actions are not shown, which takes what it holds off the tab order and out of reach of the pointer.
|
|
75
|
-
* @csspart
|
|
76
|
-
* @csspart
|
|
77
|
-
* @csspart
|
|
76
|
+
* @csspart check - The inert `Checkbox` that draws the check mark, inside `checkbox`.
|
|
77
|
+
* @csspart check-box - Forwarded from the checkbox: the box drawn for its input.
|
|
78
|
+
* @csspart check-control - Forwarded from the checkbox: its native input, inert.
|
|
79
|
+
* @csspart check-feedback - Forwarded from the checkbox. Not shown, since a check mark is never wrong.
|
|
80
|
+
* @csspart check-field - Forwarded from the checkbox: the row that holds its box.
|
|
81
|
+
* @csspart check-hint - Forwarded from the checkbox. Not shown, since a check mark has no help.
|
|
82
|
+
* @csspart check-label - Forwarded from the checkbox. Not shown, since the item's own label names it.
|
|
83
|
+
* @csspart check-mark - Forwarded from the checkbox: the tick, or the dash while some of a branch's items are checked.
|
|
84
|
+
* @csspart check-mark-checked - Forwarded from the checkbox: added to `check-mark` while the item is checked.
|
|
85
|
+
* @csspart check-mark-dash - Forwarded from the checkbox: added to `check-mark` while it is the dash.
|
|
86
|
+
* @csspart check-mark-indeterminate - Forwarded from the checkbox: added to `check-mark` while some of a branch's items are checked.
|
|
87
|
+
* @csspart checkbox - What holds the check mark, in a tree with `selection-mode="multiple"`. A press on it checks the item.
|
|
88
|
+
* @csspart checkbox-checked - Added to `checkbox` while the item is checked.
|
|
89
|
+
* @csspart checkbox-mixed - Added to `checkbox` while some of a branch's items are checked.
|
|
78
90
|
* @csspart grip - The handle a pointer drags to move the item, in a `reorderable` tree. Hidden from screen readers, which move the item with Alt and an arrow.
|
|
79
91
|
* @csspart grip-mark - The icon on the grip.
|
|
80
92
|
* @csspart group - The container for nested items.
|
|
@@ -270,7 +282,21 @@ export declare class HelixHeadlessTreeItem extends HelixHeadlessTreeItem_base {
|
|
|
270
282
|
* fallback, so an icon of your own replaces it by being slotted.
|
|
271
283
|
*/
|
|
272
284
|
protected renderToggle(): TemplateResult;
|
|
273
|
-
/**
|
|
285
|
+
/**
|
|
286
|
+
* The check mark, in a tree with `selection-mode="multiple"`: the library's
|
|
287
|
+
* own `Checkbox`, so the box is the one every form draws, and `inert`.
|
|
288
|
+
*
|
|
289
|
+
* **Inert, because the row is the control.** The row is a `treeitem` that
|
|
290
|
+
* says checked, unchecked or mixed in a multiselectable tree, and a tree is
|
|
291
|
+
* one tab stop moved by the arrow keys. A live checkbox in it would be a
|
|
292
|
+
* second control read inside every row and a tab stop of its own. `inert`
|
|
293
|
+
* takes the box out of focus, out of the accessibility tree and out of
|
|
294
|
+
* hit testing, so it only draws. In a shadow root it joins no form either.
|
|
295
|
+
*
|
|
296
|
+
* **The press lands on the span around it.** An inert element is not a
|
|
297
|
+
* target, so a press on the box goes to the span under it, which checks the
|
|
298
|
+
* row, as a press on the box always has.
|
|
299
|
+
*/
|
|
274
300
|
private renderCheckbox;
|
|
275
301
|
/** Everything inside the row, which is the same whichever element it is. */
|
|
276
302
|
private renderRow;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { auditNesting, customElement, HelixBeforeSelectEvent, HelixElement, HelixLoadEvent, MixinControllerOpen, } from '@fusion.dev/helix-core';
|
|
3
|
-
import { caretDown,
|
|
4
|
-
import {
|
|
3
|
+
import { caretDown, dotsSixVertical } from '@fusion.dev/helix-icons';
|
|
4
|
+
import { nothing } from 'lit';
|
|
5
5
|
import { property, state } from 'lit/decorators.js';
|
|
6
6
|
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
7
|
+
import { html } from 'lit/static-html.js';
|
|
7
8
|
import { fromGrip } from '../grip.js';
|
|
9
|
+
import '../../checkbox/index.js';
|
|
8
10
|
let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerOpen(HelixElement) {
|
|
9
11
|
constructor() {
|
|
10
12
|
super(...arguments);
|
|
@@ -204,14 +206,21 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
204
206
|
return nothing;
|
|
205
207
|
}
|
|
206
208
|
const mixed = this.checked === 'mixed';
|
|
207
|
-
const
|
|
209
|
+
const checkbox = this.tag('checkbox');
|
|
208
210
|
return html `<span
|
|
209
211
|
part="checkbox${mixed ? ' checkbox-mixed' : this.checked ? ' checkbox-checked' : ''}"
|
|
210
212
|
aria-hidden="true"
|
|
211
213
|
@click=${this.handleCheckClick}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
214
|
+
><${checkbox}
|
|
215
|
+
part="check"
|
|
216
|
+
exportparts="box: check-box, control: check-control, feedback: check-feedback,
|
|
217
|
+
field: check-field, hint: check-hint, label: check-label, mark: check-mark,
|
|
218
|
+
mark-checked: check-mark-checked, mark-dash: check-mark-dash,
|
|
219
|
+
mark-indeterminate: check-mark-indeterminate"
|
|
220
|
+
inert
|
|
221
|
+
.checked=${this.checked === true}
|
|
222
|
+
.indeterminate=${mixed}
|
|
223
|
+
></${checkbox}></span
|
|
215
224
|
>`;
|
|
216
225
|
}
|
|
217
226
|
renderRow() {
|
|
@@ -2,6 +2,7 @@ import { HelixElement } from '@fusion.dev/helix-core';
|
|
|
2
2
|
import { type TemplateResult } from 'lit';
|
|
3
3
|
import { TableBinding, type ToolTable } from '../../data-table/binding.js';
|
|
4
4
|
import '../../button/index.js';
|
|
5
|
+
import '../../radio/index.js';
|
|
5
6
|
/** The sections the panel lists, in order. */
|
|
6
7
|
type Section = 'columns' | 'export' | 'filters' | 'sort';
|
|
7
8
|
/**
|
|
@@ -47,8 +48,11 @@ type Section = 'columns' | 'export' | 'filters' | 'sort';
|
|
|
47
48
|
* @slot presets - A `QuickFilters` row for the table, shown above the sections.
|
|
48
49
|
*
|
|
49
50
|
* @csspart back - The button that returns from a section to the list.
|
|
50
|
-
* @csspart choice - One sort order,
|
|
51
|
-
* @csspart choice-
|
|
51
|
+
* @csspart choice - One sort order, a `Radio`.
|
|
52
|
+
* @csspart choice-box - The circle of a sort order's `Radio`.
|
|
53
|
+
* @csspart choice-checked - Added to `choice` while it is the table's sort.
|
|
54
|
+
* @csspart choice-item - The button of a sort order's `Radio`, which covers its row.
|
|
55
|
+
* @csspart choice-label - The words of a sort order's `Radio`.
|
|
52
56
|
* @csspart header - The row that holds the title, or Back, and Reset.
|
|
53
57
|
* @csspart page - The open section.
|
|
54
58
|
* @csspart reset - The button that clears the search, the filters, and the sort.
|
|
@@ -61,7 +65,11 @@ type Section = 'columns' | 'export' | 'filters' | 'sort';
|
|
|
61
65
|
* @csspart show-live - Forwarded from the button. Not shown in the panel, whose button does not load.
|
|
62
66
|
* @csspart show-spinner - Forwarded from the button. Not shown in the panel, whose button does not load.
|
|
63
67
|
* @csspart show-text - Forwarded from the button: the words inside `show`.
|
|
64
|
-
* @csspart sort - The sort orders the panel draws
|
|
68
|
+
* @csspart sort - The `Radio Group` of sort orders the panel draws, named by its `aria-label`.
|
|
69
|
+
* @csspart sort-feedback - Forwarded from the radio group. Not shown, since a sort is never wrong.
|
|
70
|
+
* @csspart sort-hint - Forwarded from the radio group. Not shown, since the sort has no help.
|
|
71
|
+
* @csspart sort-items - The sort orders inside `sort`.
|
|
72
|
+
* @csspart sort-label - The name of `sort`, clipped, since the panel's heading already says it.
|
|
65
73
|
* @csspart summary - What a section holds now.
|
|
66
74
|
* @csspart title - The panel's heading.
|
|
67
75
|
*/
|
|
@@ -7,6 +7,7 @@ import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
|
7
7
|
import { html } from 'lit/static-html.js';
|
|
8
8
|
import { columnName, TableBinding } from '../../data-table/binding.js';
|
|
9
9
|
import '../../button/index.js';
|
|
10
|
+
import '../../radio/index.js';
|
|
10
11
|
const closable = (element) => typeof element.hide === 'function' &&
|
|
11
12
|
element.open === true;
|
|
12
13
|
let HelixHeadlessViewPanel = class HelixHeadlessViewPanel extends HelixElement {
|
|
@@ -97,19 +98,23 @@ let HelixHeadlessViewPanel = class HelixHeadlessViewPanel extends HelixElement {
|
|
|
97
98
|
value: `${column.field}:${direction}`,
|
|
98
99
|
}))),
|
|
99
100
|
];
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
101
|
+
const group = this.tag('radio-group');
|
|
102
|
+
const radio = this.tag('radio');
|
|
103
|
+
return html `<${group}
|
|
104
|
+
part="sort"
|
|
105
|
+
exportparts="feedback: sort-feedback, hint: sort-hint, items: sort-items, label: sort-label"
|
|
106
|
+
aria-label=${this.sortLabel}
|
|
107
|
+
.value=${table.view.sort}
|
|
108
|
+
@change=${(event) => {
|
|
109
|
+
table.requestView({ sort: event.target.value });
|
|
110
|
+
}}
|
|
111
|
+
>${orders.map((order) => html `<${radio}
|
|
112
|
+
part="choice${table.view.sort === order.value ? ' choice-checked' : ''}"
|
|
113
|
+
exportparts="box: choice-box, item: choice-item, label: choice-label"
|
|
114
|
+
value=${order.value}
|
|
115
|
+
>${order.label}</${radio}
|
|
116
|
+
>`)}</${group}
|
|
117
|
+
>`;
|
|
113
118
|
}
|
|
114
119
|
renderShow(count) {
|
|
115
120
|
const button = this.tag('button');
|