@design.estate/dees-catalog 21.37.1 → 21.39.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_bundle/bundle.js +492 -346
- package/dist_bundle/bundle.js.map +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-B32Q6N2A.js → chunk-7SVFKQJK.js} +25 -8
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-B32Q6N2A.js.map → chunk-7SVFKQJK.js.map} +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-2F6USZXH.js → chunk-FGQNHF2X.js} +2 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-QPC5CDPV.js → dees-modal-43SBKV7A.js} +2 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-45XTCPYE.js → dees-workspace-terminal-4WZ3CPSW.js} +3 -3
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/00anchorplacement.d.ts +1 -1
- package/dist_ts_web/elements/00anchorplacement.js +37 -6
- package/dist_ts_web/elements/00group-appui/dees-appui/dees-appui.d.ts +12 -4
- package/dist_ts_web/elements/00group-appui/dees-appui/dees-appui.js +28 -8
- package/dist_ts_web/elements/00group-appui/dees-appui-contentheading/dees-appui-contentheading.d.ts +12 -8
- package/dist_ts_web/elements/00group-appui/dees-appui-contentheading/dees-appui-contentheading.demo.d.ts +1 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-contentheading/dees-appui-contentheading.demo.js +20 -6
- package/dist_ts_web/elements/00group-appui/dees-appui-contentheading/dees-appui-contentheading.js +41 -21
- package/dist_ts_web/elements/00group-appui/dees-appui-maincontent/dees-appui-maincontent.d.ts +9 -2
- package/dist_ts_web/elements/00group-appui/dees-appui-maincontent/dees-appui-maincontent.js +19 -17
- package/dist_ts_web/elements/00group-appui/dees-appui-page/dees-appui-page.js +4 -2
- package/dist_ts_web/elements/00group-input/dees-input-tags/dees-input-tags.d.ts +10 -0
- package/dist_ts_web/elements/00group-input/dees-input-tags/dees-input-tags.js +111 -62
- package/dist_ts_web/elements/00group-kanban/dees-kanban/dees-kanban.js +5 -1
- package/dist_ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.d.ts +5 -0
- package/dist_ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.js +271 -210
- package/dist_ts_web/elements/00group-overlay/dees-modal/dees-modal.d.ts +7 -3
- package/dist_ts_web/elements/00group-overlay/dees-modal/dees-modal.js +7 -3
- package/dist_ts_web/elements/00group-simple/dees-simple-appdash/dees-simple-appdash.d.ts +2 -2
- package/dist_ts_web/elements/00group-simple/dees-simple-appdash/dees-simple-appdash.js +5 -3
- package/dist_ts_web/elements/interfaces/appconfig.d.ts +4 -3
- package/dist_ts_web/elements/interfaces/contentheading.d.ts +15 -0
- package/package.json +1 -1
- package/readme.md +38 -16
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/00anchorplacement.ts +37 -5
- package/ts_web/elements/00group-appui/dees-appui/dees-appui.ts +27 -7
- package/ts_web/elements/00group-appui/dees-appui/readme.md +44 -20
- package/ts_web/elements/00group-appui/dees-appui-contentheading/dees-appui-contentheading.demo.ts +19 -5
- package/ts_web/elements/00group-appui/dees-appui-contentheading/dees-appui-contentheading.ts +25 -12
- package/ts_web/elements/00group-appui/dees-appui-maincontent/dees-appui-maincontent.ts +17 -15
- package/ts_web/elements/00group-appui/dees-appui-page/dees-appui-page.ts +3 -1
- package/ts_web/elements/00group-input/dees-input-tags/dees-input-tags.ts +112 -58
- package/ts_web/elements/00group-kanban/dees-kanban/dees-kanban.ts +4 -0
- package/ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.ts +318 -262
- package/ts_web/elements/00group-overlay/dees-modal/dees-modal.ts +12 -5
- package/ts_web/elements/00group-simple/dees-simple-appdash/dees-simple-appdash.ts +6 -4
- package/ts_web/elements/interfaces/appconfig.ts +4 -3
- package/ts_web/elements/interfaces/contentheading.ts +16 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-2F6USZXH.js.map → chunk-FGQNHF2X.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-QPC5CDPV.js.map → dees-modal-43SBKV7A.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-45XTCPYE.js.map → dees-workspace-terminal-4WZ3CPSW.js.map} +0 -0
|
@@ -370,9 +370,19 @@ export class DeesAppui extends DeesElement {
|
|
|
370
370
|
@property({ type: Boolean, reflect: true })
|
|
371
371
|
accessor secondarymenuVisible: boolean = true;
|
|
372
372
|
|
|
373
|
-
/**
|
|
374
|
-
|
|
375
|
-
|
|
373
|
+
/**
|
|
374
|
+
* The section menu takes no room while the view on screen declares no
|
|
375
|
+
* sections; `false` keeps an empty menu in its place. In markup,
|
|
376
|
+
* `secondarymenuautohide="false"` turns it off; the attribute stands only then.
|
|
377
|
+
*/
|
|
378
|
+
@property({
|
|
379
|
+
reflect: true,
|
|
380
|
+
converter: {
|
|
381
|
+
fromAttribute: (value: string | null) => value !== 'false',
|
|
382
|
+
toAttribute: (value: boolean) => (value ? null : 'false'),
|
|
383
|
+
},
|
|
384
|
+
})
|
|
385
|
+
accessor secondaryMenuAutoHide: boolean = true;
|
|
376
386
|
|
|
377
387
|
@property({ type: Boolean, reflect: true })
|
|
378
388
|
accessor maincontentTabsVisible: boolean = true;
|
|
@@ -1100,6 +1110,11 @@ export class DeesAppui extends DeesElement {
|
|
|
1100
1110
|
display: contents;
|
|
1101
1111
|
}
|
|
1102
1112
|
|
|
1113
|
+
/* Carries a view's heading tools into their slot; the view's element is the control. */
|
|
1114
|
+
.heading-tools {
|
|
1115
|
+
display: contents;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1103
1118
|
.view-container:empty,
|
|
1104
1119
|
.view-container[hidden] {
|
|
1105
1120
|
display: none;
|
|
@@ -1686,8 +1701,10 @@ export class DeesAppui extends DeesElement {
|
|
|
1686
1701
|
/**
|
|
1687
1702
|
* Hide the section menu, its resize handle and the compact "Sections" button
|
|
1688
1703
|
* while the view on screen declares no sections, and show them again for the
|
|
1689
|
-
* next view that does. The menu's width and collapsed state are
|
|
1690
|
-
* `
|
|
1704
|
+
* next view that does — the default. The menu's width and collapsed state are
|
|
1705
|
+
* kept. `false` keeps an empty menu in place, for an app whose views should
|
|
1706
|
+
* not move as the menu comes and goes. `setSecondaryMenuVisible(false)` still
|
|
1707
|
+
* hides the menu for every view.
|
|
1691
1708
|
*/
|
|
1692
1709
|
public setSecondaryMenuAutoHide(enabled: boolean): void {
|
|
1693
1710
|
this.secondaryMenuAutoHide = enabled;
|
|
@@ -1922,7 +1939,9 @@ export class DeesAppui extends DeesElement {
|
|
|
1922
1939
|
* Set the heading above the view, or `null` for none: it replaces what the
|
|
1923
1940
|
* view declares in `contentHeading` until the next activation, and a title it
|
|
1924
1941
|
* leaves out is the view's name. Called in a view's `onActivate`, it heads the
|
|
1925
|
-
* view being activated.
|
|
1942
|
+
* view being activated. Called again while the view is on screen, for a title
|
|
1943
|
+
* or badges that changed, it updates the same heading in place: the `tools`
|
|
1944
|
+
* element set again stays where it is, and so does the focus in it.
|
|
1926
1945
|
*/
|
|
1927
1946
|
public setContentHeading(heading: interfaces.IContentHeading | null): void {
|
|
1928
1947
|
this.contentHeading = heading ? { ...heading } : null;
|
|
@@ -3267,12 +3286,13 @@ export class DeesAppui extends DeesElement {
|
|
|
3267
3286
|
return html`${directives.keyed(chrome.contentHeadingKey, html`<dees-appui-contentheading
|
|
3268
3287
|
slot="heading"
|
|
3269
3288
|
.heading=${heading.title ?? chrome.viewName}
|
|
3289
|
+
.badges=${heading.badges ?? []}
|
|
3270
3290
|
.description=${heading.description ?? ''}
|
|
3271
3291
|
.meta=${heading.meta ?? []}
|
|
3272
3292
|
.iconName=${heading.iconName ?? ''}
|
|
3273
3293
|
.back=${heading.back ?? null}
|
|
3274
3294
|
.actions=${heading.actions ?? []}
|
|
3275
|
-
|
|
3295
|
+
>${heading.tools ? html`<div class="heading-tools" slot="tools">${heading.tools}</div>` : ''}</dees-appui-contentheading>`)}`;
|
|
3276
3296
|
}
|
|
3277
3297
|
|
|
3278
3298
|
/**
|
|
@@ -79,7 +79,7 @@ interface IAppConfig {
|
|
|
79
79
|
routing?: IAppRoutingConfig; // { mode: 'hash' | 'path', basePath?, hostPaths? }; hash when unset (see Path Routing)
|
|
80
80
|
defaultView?: string; // the first screen when the address names none
|
|
81
81
|
notFoundView?: string; // where an address naming no screen lands; one of `views`
|
|
82
|
-
secondaryMenu?: ISecondaryMenuConfig; // { autoHide?: boolean } — no section menu while the view has no sections
|
|
82
|
+
secondaryMenu?: ISecondaryMenuConfig; // { autoHide?: boolean } — on unless false: no section menu while the view has no sections
|
|
83
83
|
activityLog?: IActivityLogConfig; // { live?: boolean; toggle?: boolean; width?: number (first width, px) }
|
|
84
84
|
assistant?: IAppAssistantConfig; // the side panel's second tool; see Side Panel
|
|
85
85
|
aside?: TAppuiAside | null; // what the side panel shows first: 'activity', 'assistant' or nothing
|
|
@@ -140,7 +140,7 @@ interface IViewDefinition {
|
|
|
140
140
|
| (() => Promise<...>); // Async for lazy loading
|
|
141
141
|
secondaryMenu?: ISecondaryMenuGroup[]; // Section menu the view starts with
|
|
142
142
|
contentTabs?: IMenuItem[]; // Content tabs the view starts with
|
|
143
|
-
contentHeading?: IContentHeading; // Heading above the view: title, line, actions
|
|
143
|
+
contentHeading?: IContentHeading; // Heading above the view: title, line, badges, tools, actions
|
|
144
144
|
keepChrome?: boolean; // Keep what is showing instead (default: false)
|
|
145
145
|
route?: string; // URL route (default: id)
|
|
146
146
|
validateRoute?: (route: IAppRoute) => boolean; // Reject unsupported params before leaving
|
|
@@ -469,21 +469,23 @@ appui.setSecondaryMenuSelection('profile');
|
|
|
469
469
|
// Visibility control
|
|
470
470
|
appui.setSecondaryMenuCollapsed(true); // Collapse panel
|
|
471
471
|
appui.setSecondaryMenuVisible(false); // Hide completely
|
|
472
|
-
appui.setSecondaryMenuAutoHide(
|
|
472
|
+
appui.setSecondaryMenuAutoHide(false); // Keep an empty menu on a view without sections (auto-hide is on by default)
|
|
473
473
|
|
|
474
474
|
// Clear
|
|
475
475
|
appui.clearSecondaryMenu();
|
|
476
476
|
```
|
|
477
477
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
478
|
+
By default the section menu takes no room while the view on screen declares no sections, that
|
|
479
|
+
is, no group with an item: the grid drops its track, and neither the menu, its resize handle
|
|
480
|
+
nor the compact "Sections" button is rendered; an open compact section drawer closes. The next
|
|
481
|
+
view with sections shows the menu again at the width and in the collapsed state it was left at.
|
|
482
|
+
The menu appears and leaves at once, as with `setSecondaryMenuVisible`: the grid gains or loses
|
|
483
|
+
a column, which does not animate. A drawer that closes this way while it holds the focus hands
|
|
484
|
+
it to the content region. `setSecondaryMenuAutoHide(false)` or
|
|
485
|
+
`configure({ secondaryMenu: { autoHide: false } })` keeps an empty menu in place instead, for an
|
|
486
|
+
app whose views should not move as the menu comes and goes; in markup,
|
|
487
|
+
`<dees-appui secondarymenuautohide="false">` does the same, and the attribute stands only then. `setSecondaryMenuVisible(false)`
|
|
488
|
+
still hides the menu for every view, and it also closes an open compact section drawer.
|
|
487
489
|
|
|
488
490
|
### View-Scoped Chrome
|
|
489
491
|
|
|
@@ -537,9 +539,10 @@ should stay inside the list view's sections, for example.
|
|
|
537
539
|
|
|
538
540
|
A view that declares a `contentHeading` gets a
|
|
539
541
|
[`dees-appui-contentheading`](../dees-appui-contentheading/dees-appui-contentheading.ts)
|
|
540
|
-
above it, under the content tabs: a title, the line under it with
|
|
541
|
-
shows and further facts joined with " · ", the
|
|
542
|
-
row, and a hairline across the content area. It
|
|
542
|
+
above it, under the content tabs: a title with its badges, the line under it with
|
|
543
|
+
what the screen shows and further facts joined with " · ", the view's tools and the
|
|
544
|
+
screen's actions at the end of the row, and a hairline across the content area. It
|
|
545
|
+
stays while the view scrolls.
|
|
543
546
|
|
|
544
547
|
```typescript
|
|
545
548
|
{
|
|
@@ -559,9 +562,13 @@ row, and a hairline across the content area. It stays while the view scrolls.
|
|
|
559
562
|
`IContentHeading` holds `title?` (the view's `name` while it names none),
|
|
560
563
|
`description?`, `meta?` (`string[]`), `iconName?` (a glyph before the title),
|
|
561
564
|
`back?` (`IAppLocationItem`: a link to the screen above, in the glyph's place, shown
|
|
562
|
-
when it has an `href`)
|
|
563
|
-
`
|
|
564
|
-
|
|
565
|
+
when it has an `href`), `badges?` (`IContentHeadingBadge[]`: `text`, `type?`
|
|
566
|
+
`'default' | 'primary' | 'success' | 'warning' | 'error'`, rounded badges beside the
|
|
567
|
+
title for states of what the screen shows), `tools?` (an `HTMLElement` the view owns,
|
|
568
|
+
before the actions: filters, a status button, a menu of record actions) and
|
|
569
|
+
`actions?` (`IContentHeadingAction[]`: `label`, `iconName?`, `type?`
|
|
570
|
+
`'primary' | 'secondary' | 'destructive'`, `disabled?`, `action`). The view renders
|
|
571
|
+
and updates the content of its `tools` element itself. The primary action comes last; each action is awaited with its button
|
|
565
572
|
pending, and a rejection is reported as `dees-action-error` with
|
|
566
573
|
`source: 'heading-action'`. Where the title and the actions do not fit in one row,
|
|
567
574
|
and always below 700px of content width, the actions stand under the title; a title
|
|
@@ -574,8 +581,20 @@ appui.getContentHeading(); // a copy of the heading on screen, or null
|
|
|
574
581
|
```
|
|
575
582
|
|
|
576
583
|
Called in `onActivate`, `setContentHeading` heads the view being activated, and a
|
|
577
|
-
heading without a title takes that view's name.
|
|
578
|
-
|
|
584
|
+
heading without a title takes that view's name. Called again while the view is on
|
|
585
|
+
screen, for a title or badges that changed, it updates the same heading in place: the
|
|
586
|
+
`tools` element set again stays where it is, and so does the focus in it.
|
|
587
|
+
|
|
588
|
+
```typescript
|
|
589
|
+
// One tools element per view: created once, rendered by the view, handed over each time
|
|
590
|
+
const tools = document.createElement('div');
|
|
591
|
+
render(html`<dees-input-text label="Filter" labelPosition="none" @input=${onFilter}></dees-input-text>`, tools);
|
|
592
|
+
appui.setContentHeading({ title: 'Invoices', badges: [{ text: '3 open', type: 'warning' }], tools });
|
|
593
|
+
// Later, with the filter focused: the title and badge change, the filter keeps the focus
|
|
594
|
+
appui.setContentHeading({ title: 'Invoices · March', badges: [{ text: '1 open', type: 'warning' }], tools });
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
A view whose content draws its own header, such as a `dees-appui-page`, declares none.
|
|
579
598
|
|
|
580
599
|
---
|
|
581
600
|
|
|
@@ -660,6 +679,11 @@ appui.setContentTabsVisible(false); // Hide tab bar
|
|
|
660
679
|
appui.setContentTabsAutoHide(true, 1); // Hide when ≤ 1 tab
|
|
661
680
|
```
|
|
662
681
|
|
|
682
|
+
The tab bar takes no room while it has no tab and no tab action to show: on a view without
|
|
683
|
+
content tabs, the content heading — or the view — stands at the top of the content area. A tab
|
|
684
|
+
action alone, such as a button that opens a tab, keeps the bar. `setContentTabsVisible(false)`
|
|
685
|
+
hides it with tabs as well, and auto-hide at or below its threshold.
|
|
686
|
+
|
|
663
687
|
The selected tab follows its key. Whenever the list changes — `setContentTabs`,
|
|
664
688
|
`addContentTab`, `updateContentTab`, `removeContentTab`, a view's declared
|
|
665
689
|
`contentTabs` — a selected key the list still holds stays selected, pointing at the
|
package/ts_web/elements/00group-appui/dees-appui-contentheading/dees-appui-contentheading.demo.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { demoPage, demoSection } from '../../../demos/templates.js';
|
|
|
3
3
|
import type { IContentHeadingAction } from '../../interfaces/contentheading.js';
|
|
4
4
|
import '../../00group-feedback/dees-badge/dees-badge.js';
|
|
5
5
|
import '../../00group-button/dees-button/dees-button.js';
|
|
6
|
+
import '../../00group-input/dees-input-text/dees-input-text.js';
|
|
6
7
|
|
|
7
8
|
const delay = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms));
|
|
8
9
|
|
|
@@ -40,7 +41,7 @@ export const demoFunc = () => {
|
|
|
40
41
|
{ label: 'Close the year', iconName: 'lucide:Lock', type: 'destructive', action: () => { narrowResult.textContent = 'Close the year'; } },
|
|
41
42
|
{ label: 'New booking', iconName: 'lucide:Plus', type: 'primary', action: () => { narrowResult.textContent = 'New booking'; } },
|
|
42
43
|
];
|
|
43
|
-
return demoPage('Content heading', 'The heading of what the content area shows: a title, the line under it with what the screen shows and further facts, the screen\'s actions at the end of the row, and a hairline across the content area. A view declares it as data in `contentHeading`, and dees-appui renders it; dees-appui-page draws its header with it.', html`
|
|
44
|
+
return demoPage('Content heading', 'The heading of what the content area shows: a title with its badges, the line under it with what the screen shows and further facts, the view\'s tools and the screen\'s actions at the end of the row, and a hairline across the content area. A view declares it as data in `contentHeading`, and dees-appui renders it; dees-appui-page draws its header with it.', html`
|
|
44
45
|
${demoSection('A start screen', 'A title, a line with the chart of accounts and the reader\'s role, and the screen\'s primary action.', html`
|
|
45
46
|
${contentArea(html`<dees-appui-contentheading
|
|
46
47
|
heading="Home"
|
|
@@ -50,16 +51,15 @@ export const demoFunc = () => {
|
|
|
50
51
|
></dees-appui-contentheading>`)}
|
|
51
52
|
${homeResult}
|
|
52
53
|
`)}
|
|
53
|
-
${demoSection('A record', 'A back link to the list, a
|
|
54
|
+
${demoSection('A record', 'A back link to the list, its state as a badge beside the title, facts on the line under it, and two actions. Download runs for a moment: its button shows the pending state.', html`
|
|
54
55
|
${contentArea(html`<dees-appui-contentheading
|
|
55
56
|
heading="Invoice 2026-0142"
|
|
56
57
|
description="Acme Supplies Ltd."
|
|
57
58
|
.meta=${['Due 2026-10-24', 'EUR 1,280.00']}
|
|
58
59
|
.back=${{ label: 'Invoices', href: '#invoices' }}
|
|
60
|
+
.badges=${[{ text: 'Open', type: 'warning' }, { text: 'Overdue', type: 'error' }]}
|
|
59
61
|
.actions=${detailActions}
|
|
60
|
-
|
|
61
|
-
<dees-badge slot="status" type="warning" text="Open" rounded></dees-badge>
|
|
62
|
-
</dees-appui-contentheading>`)}
|
|
62
|
+
></dees-appui-contentheading>`)}
|
|
63
63
|
${detailResult}
|
|
64
64
|
`)}
|
|
65
65
|
${demoSection('A glyph and slotted actions', 'A glyph before the title, and controls in the actions slot instead of declared actions.', html`
|
|
@@ -67,6 +67,20 @@ export const demoFunc = () => {
|
|
|
67
67
|
<dees-button slot="actions" type="outline" icon="lucide:RefreshCw" .text=${'Sync'}></dees-button>
|
|
68
68
|
</dees-appui-contentheading>`)}
|
|
69
69
|
`)}
|
|
70
|
+
${demoSection('Tools before the actions', 'Controls of the view\'s own in the tools slot — a filter and a grouping — stand before the declared actions.', html`
|
|
71
|
+
${contentArea(html`<dees-appui-contentheading
|
|
72
|
+
heading="Invoices"
|
|
73
|
+
description="Incoming invoices"
|
|
74
|
+
.meta=${['42 this year']}
|
|
75
|
+
.badges=${[{ text: '3 open', type: 'warning' }]}
|
|
76
|
+
.actions=${[{ label: 'New invoice', iconName: 'lucide:Plus', type: 'primary', action: () => undefined }]}
|
|
77
|
+
>
|
|
78
|
+
<div slot="tools" style="display: flex; align-items: center; gap: var(--dees-spacing-sm);">
|
|
79
|
+
<dees-input-text style="width: 200px;" labelPosition="none" placeholder="Filter invoices"></dees-input-text>
|
|
80
|
+
<dees-button type="outline" icon="lucide:Group" .text=${'By supplier'}></dees-button>
|
|
81
|
+
</div>
|
|
82
|
+
</dees-appui-contentheading>`)}
|
|
83
|
+
`)}
|
|
70
84
|
${demoSection('Narrow', 'At 600px the actions stand under the title and wrap, and a title wider than the row ends in an ellipsis.', html`
|
|
71
85
|
${contentArea(html`<dees-appui-contentheading
|
|
72
86
|
heading="Journal of the financial year 2026 for Acme Holding GmbH and its subsidiaries"
|
package/ts_web/elements/00group-appui/dees-appui-contentheading/dees-appui-contentheading.ts
CHANGED
|
@@ -9,10 +9,11 @@ import {
|
|
|
9
9
|
cssManager,
|
|
10
10
|
} from '@design.estate/dees-element';
|
|
11
11
|
import type { IAppLocationItem } from '../../interfaces/applocation.js';
|
|
12
|
-
import type { IContentHeadingAction } from '../../interfaces/contentheading.js';
|
|
12
|
+
import type { IContentHeadingAction, IContentHeadingBadge } from '../../interfaces/contentheading.js';
|
|
13
13
|
import { themeDefaultStyles } from '../../00theme.js';
|
|
14
14
|
import { runAction } from '../../00actionerror.js';
|
|
15
15
|
import '../../00group-button/dees-button/dees-button.js';
|
|
16
|
+
import '../../00group-feedback/dees-badge/dees-badge.js';
|
|
16
17
|
import '../../00group-utility/dees-icon/dees-icon.js';
|
|
17
18
|
import { normalizeIconName } from '../appui.helpers.js';
|
|
18
19
|
import { dcLocalize } from '../../../i18n/localize.js';
|
|
@@ -39,10 +40,11 @@ const actionKeyOf = (action: IContentHeadingAction): string => action.key ?? act
|
|
|
39
40
|
* Before the title stands a back link to the screen above (`back`) or a glyph
|
|
40
41
|
* (`iconName`); above it, optionally, `breadcrumbs`.
|
|
41
42
|
*
|
|
42
|
-
* Slots: `status` sits beside the title
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
43
|
+
* Beside the title stand its `badges`. Slots: `status` sits beside the title,
|
|
44
|
+
* after the badges (a `dees-badge`); `description` replaces the line under the
|
|
45
|
+
* title with markup; `tools` takes controls before the declared `actions`
|
|
46
|
+
* (filters, a status button, a menu); `actions` adds controls after them; `tabs`
|
|
47
|
+
* takes a tab row under the title row, standing on the hairline.
|
|
46
48
|
*
|
|
47
49
|
* The title and its line keep their width: where they and the actions do not
|
|
48
50
|
* fit in one row, the actions move under them; below 700px of width they always
|
|
@@ -62,6 +64,10 @@ export class DeesAppuiContentheading extends DeesElement {
|
|
|
62
64
|
@property({ type: String, reflect: true })
|
|
63
65
|
accessor heading: string = '';
|
|
64
66
|
|
|
67
|
+
/** States of what the screen shows, as badges beside the title. */
|
|
68
|
+
@property({ attribute: false })
|
|
69
|
+
accessor badges: IContentHeadingBadge[] = [];
|
|
70
|
+
|
|
65
71
|
/** The line under the title: what the screen shows. */
|
|
66
72
|
@property({ type: String, reflect: true })
|
|
67
73
|
accessor description: string = '';
|
|
@@ -93,9 +99,9 @@ export class DeesAppuiContentheading extends DeesElement {
|
|
|
93
99
|
@state()
|
|
94
100
|
private accessor pendingActions: ReadonlySet<string> = new Set();
|
|
95
101
|
|
|
96
|
-
/**
|
|
102
|
+
/** The slots beside the declared actions that hold anything, which show the actions without declared ones. */
|
|
97
103
|
@state()
|
|
98
|
-
private accessor
|
|
104
|
+
private accessor filledControlSlots: ReadonlySet<string> = new Set();
|
|
99
105
|
|
|
100
106
|
/** Whether the `tabs` slot holds a tab row, which then stands on the hairline. */
|
|
101
107
|
@state()
|
|
@@ -244,7 +250,8 @@ export class DeesAppuiContentheading extends DeesElement {
|
|
|
244
250
|
min-width: 0;
|
|
245
251
|
}
|
|
246
252
|
|
|
247
|
-
::slotted([slot='status'])
|
|
253
|
+
::slotted([slot='status']),
|
|
254
|
+
.titleLine dees-badge {
|
|
248
255
|
flex: none;
|
|
249
256
|
}
|
|
250
257
|
|
|
@@ -303,14 +310,16 @@ export class DeesAppuiContentheading extends DeesElement {
|
|
|
303
310
|
<div class="titles">
|
|
304
311
|
<div class="titleLine">
|
|
305
312
|
<h1 title=${this.heading}>${this.heading}</h1>
|
|
313
|
+
${this.badges.map((badge) => html`<dees-badge .type=${badge.type ?? 'default'} .text=${badge.text} .rounded=${true}></dees-badge>`)}
|
|
306
314
|
<slot name="status"></slot>
|
|
307
315
|
</div>
|
|
308
316
|
<div class="subheading"><slot name="description">${line}</slot></div>
|
|
309
317
|
</div>
|
|
310
318
|
</div>
|
|
311
|
-
<div class="actions ${this.actions.length || this.
|
|
319
|
+
<div class="actions ${this.actions.length || this.filledControlSlots.size ? 'filled' : ''}">
|
|
320
|
+
<slot name="tools" @slotchange=${this.handleControlSlotChange}></slot>
|
|
312
321
|
${this.orderedActions().map((action) => this.renderAction(action))}
|
|
313
|
-
<slot name="actions" @slotchange=${this.
|
|
322
|
+
<slot name="actions" @slotchange=${this.handleControlSlotChange}></slot>
|
|
314
323
|
</div>
|
|
315
324
|
</div>
|
|
316
325
|
<slot name="tabs" @slotchange=${this.handleTabsSlotChange}></slot>
|
|
@@ -320,8 +329,12 @@ export class DeesAppuiContentheading extends DeesElement {
|
|
|
320
329
|
}
|
|
321
330
|
|
|
322
331
|
/** Flattened: a slot a composing element forwards counts by what it holds. */
|
|
323
|
-
private readonly
|
|
324
|
-
|
|
332
|
+
private readonly handleControlSlotChange = (event: Event) => {
|
|
333
|
+
const slot = event.currentTarget as HTMLSlotElement;
|
|
334
|
+
const filled = new Set(this.filledControlSlots);
|
|
335
|
+
if (slot.assignedElements({ flatten: true }).length > 0) filled.add(slot.name);
|
|
336
|
+
else filled.delete(slot.name);
|
|
337
|
+
this.filledControlSlots = filled;
|
|
325
338
|
};
|
|
326
339
|
|
|
327
340
|
private readonly handleTabsSlotChange = (event: Event) => {
|
|
@@ -21,7 +21,8 @@ import { demoFunc } from './dees-appui-maincontent.demo.js';
|
|
|
21
21
|
* The content area of `dees-appui`: the content tabs, then the `heading` slot
|
|
22
22
|
* (a `dees-appui-contentheading`, which `dees-appui` places there for a view
|
|
23
23
|
* that declares a `contentHeading`), then the scrolling content. The tabs and
|
|
24
|
-
* the heading stay while the content scrolls beneath them.
|
|
24
|
+
* the heading stay while the content scrolls beneath them. The tab bar takes
|
|
25
|
+
* no room while it has no tab and no tab action to show.
|
|
25
26
|
*/
|
|
26
27
|
@customElement('dees-appui-maincontent')
|
|
27
28
|
export class DeesAppuiMaincontent extends DeesElement {
|
|
@@ -130,7 +131,7 @@ export class DeesAppuiMaincontent extends DeesElement {
|
|
|
130
131
|
public render(): TemplateResult {
|
|
131
132
|
return html`
|
|
132
133
|
<div class="maincontainer">
|
|
133
|
-
<div class="topbar">
|
|
134
|
+
<div class="topbar" ?inert=${!this.tabBarShown()}>
|
|
134
135
|
<dees-appui-tabs
|
|
135
136
|
.labels=${this.labels}
|
|
136
137
|
.tabs=${this.tabs}
|
|
@@ -158,6 +159,16 @@ export class DeesAppuiMaincontent extends DeesElement {
|
|
|
158
159
|
`;
|
|
159
160
|
}
|
|
160
161
|
|
|
162
|
+
/**
|
|
163
|
+
* Whether the tab bar takes its row: it is shown, it holds a tab or a tab
|
|
164
|
+
* action — an empty bar is no bar — and auto-hide does not take it away.
|
|
165
|
+
*/
|
|
166
|
+
private tabBarShown(): boolean {
|
|
167
|
+
if (!this.showTabs) return false;
|
|
168
|
+
if (this.tabsAutoHide && this.tabs.length <= this.tabsAutoHideThreshold) return false;
|
|
169
|
+
return this.tabs.length > 0 || this.tabActionsLeft.length > 0 || this.tabActionsRight.length > 0;
|
|
170
|
+
}
|
|
171
|
+
|
|
161
172
|
/**
|
|
162
173
|
* Put the reader into the content area. This is where the shell's skip link
|
|
163
174
|
* lands: the view container itself has `display: contents` and generates no
|
|
@@ -191,23 +202,14 @@ export class DeesAppuiMaincontent extends DeesElement {
|
|
|
191
202
|
}));
|
|
192
203
|
}
|
|
193
204
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
this.removeAttribute('notabs');
|
|
199
|
-
} else {
|
|
200
|
-
this.setAttribute('notabs', '');
|
|
201
|
-
}
|
|
202
|
-
}
|
|
205
|
+
/** Set before each render, so a bar that starts without tabs never shows, not even for a frame. */
|
|
206
|
+
protected willUpdate(changedProperties: Map<PropertyKey, unknown>) {
|
|
207
|
+
super.willUpdate(changedProperties);
|
|
208
|
+
this.toggleAttribute('notabs', !this.tabBarShown());
|
|
203
209
|
}
|
|
204
210
|
|
|
205
211
|
async firstUpdated(_changedProperties: Map<string | number | symbol, unknown>) {
|
|
206
212
|
await super.firstUpdated(_changedProperties);
|
|
207
|
-
// Apply initial notabs state
|
|
208
|
-
if (!this.showTabs) {
|
|
209
|
-
this.setAttribute('notabs', '');
|
|
210
|
-
}
|
|
211
213
|
// Tab selection is now handled by the dees-appui-tabs component
|
|
212
214
|
// But we need to ensure the tabs component is ready
|
|
213
215
|
// The tab bar names the panel through the element itself: an `aria-controls`
|
|
@@ -144,7 +144,8 @@ export class DeesAppuiPage extends DeesElement {
|
|
|
144
144
|
outline-offset: -2px;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
/* The selected tab's line lies on the heading's hairline: the row reaches over it.
|
|
147
|
+
/* The selected tab's line lies on the heading's hairline: the row reaches over it.
|
|
148
|
+
The first tab's label stands at the title's inset; its hover face reaches into the inset. */
|
|
148
149
|
.tabs {
|
|
149
150
|
display: flex;
|
|
150
151
|
gap: var(--dees-spacing-xs);
|
|
@@ -152,6 +153,7 @@ export class DeesAppuiPage extends DeesElement {
|
|
|
152
153
|
scrollbar-width: none;
|
|
153
154
|
margin-top: var(--dees-spacing-xs);
|
|
154
155
|
margin-bottom: calc(-1 * var(--dees-line-width-hairline));
|
|
156
|
+
margin-inline-start: calc(-1 * var(--dees-spacing-md));
|
|
155
157
|
}
|
|
156
158
|
|
|
157
159
|
.tab {
|
|
@@ -11,6 +11,7 @@ import { DeesInputBase } from '../dees-input-base/dees-input-base.js';
|
|
|
11
11
|
import '../../00group-utility/dees-icon/dees-icon.js';
|
|
12
12
|
import { demoFunc } from './dees-input-tags.demo.js';
|
|
13
13
|
import { themeDefaultStyles } from '../../00theme.js';
|
|
14
|
+
import { listenForScrollAround, placeAnchored, visibleRect } from '../../00anchorplacement.js';
|
|
14
15
|
import { dcLocalize } from '../../../i18n/localize.js';
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -59,6 +60,9 @@ export class DeesInputTags extends DeesInputBase<DeesInputTags> {
|
|
|
59
60
|
@property({ type: String, reflect: true })
|
|
60
61
|
accessor validationText: string = '';
|
|
61
62
|
|
|
63
|
+
/** Ends the listeners that keep the open suggestions beside the field. */
|
|
64
|
+
private suggestionsTracking?: AbortController;
|
|
65
|
+
|
|
62
66
|
public static styles = [
|
|
63
67
|
themeDefaultStyles,
|
|
64
68
|
...DeesInputBase.baseStyles,
|
|
@@ -170,17 +174,13 @@ export class DeesInputTags extends DeesInputBase<DeesInputTags> {
|
|
|
170
174
|
cursor: not-allowed;
|
|
171
175
|
}
|
|
172
176
|
|
|
173
|
-
/* Suggestions
|
|
174
|
-
.suggestions-container {
|
|
175
|
-
position: relative;
|
|
176
|
-
}
|
|
177
|
-
|
|
177
|
+
/* Suggestions: a popover in the top layer, placed below the field by placeSuggestions. */
|
|
178
178
|
.suggestions-dropdown {
|
|
179
|
-
position:
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
179
|
+
position: fixed;
|
|
180
|
+
inset: auto;
|
|
181
|
+
margin: 0;
|
|
182
|
+
padding: 0;
|
|
183
|
+
color: inherit;
|
|
184
184
|
background: var(--dees-material-regular-bg-opaque);
|
|
185
185
|
border: var(--dees-line-width-hairline) solid var(--dees-color-border-default);
|
|
186
186
|
border-radius: var(--dees-radius-lg);
|
|
@@ -188,7 +188,6 @@ export class DeesInputTags extends DeesInputBase<DeesInputTags> {
|
|
|
188
188
|
box-shadow: var(--dees-shadow-lg);
|
|
189
189
|
max-height: 200px;
|
|
190
190
|
overflow-y: auto;
|
|
191
|
-
z-index: 1000;
|
|
192
191
|
}
|
|
193
192
|
|
|
194
193
|
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
|
|
@@ -261,57 +260,55 @@ export class DeesInputTags extends DeesInputBase<DeesInputTags> {
|
|
|
261
260
|
<div class="input-wrapper">
|
|
262
261
|
${this.renderLabel()}
|
|
263
262
|
|
|
264
|
-
<div
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
<
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
<
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
` : ''}
|
|
278
|
-
</div>
|
|
279
|
-
`)}
|
|
280
|
-
|
|
281
|
-
${!this.disabled && (!this.maxTags || this.value.length < this.maxTags) ? html`
|
|
282
|
-
<input
|
|
283
|
-
type="text"
|
|
284
|
-
aria-label=${this.label ? this.t('tags.addTo', { label: this.label }) : this.t('tags.add')}
|
|
285
|
-
class="tag-input"
|
|
286
|
-
.placeholder=${this.placeholder || this.t('tags.placeholder')}
|
|
287
|
-
.value=${this.inputValue}
|
|
288
|
-
@input=${this.handleInput}
|
|
289
|
-
@keydown=${this.handleKeyDown}
|
|
290
|
-
@focus=${this.handleFocus}
|
|
291
|
-
@blur=${this.handleBlur}
|
|
292
|
-
?disabled=${this.disabled}
|
|
293
|
-
/>
|
|
294
|
-
` : ''}
|
|
295
|
-
</div>
|
|
296
|
-
|
|
297
|
-
${this.showSuggestions && filteredSuggestions.length > 0 ? html`
|
|
298
|
-
<div class="suggestions-dropdown">
|
|
299
|
-
${filteredSuggestions.map((suggestion, index) => html`
|
|
300
|
-
<div
|
|
301
|
-
class="suggestion ${index === this.highlightedSuggestionIndex ? 'highlighted' : ''}"
|
|
302
|
-
@mousedown=${(e: Event) => {
|
|
303
|
-
e.preventDefault(); // Prevent blur
|
|
304
|
-
this.addTag(suggestion);
|
|
305
|
-
}}
|
|
306
|
-
@mouseenter=${() => this.highlightedSuggestionIndex = index}
|
|
307
|
-
>
|
|
308
|
-
${suggestion}
|
|
309
|
-
</div>
|
|
310
|
-
`)}
|
|
263
|
+
<div
|
|
264
|
+
class="tags-container field-control ${this.disabled ? 'disabled' : ''}"
|
|
265
|
+
@mousedown=${this.handleContainerMousedown}
|
|
266
|
+
@click=${this.handleContainerClick}
|
|
267
|
+
>
|
|
268
|
+
${this.value.map(tag => html`
|
|
269
|
+
<div class="tag">
|
|
270
|
+
<span>${tag}</span>
|
|
271
|
+
${!this.disabled ? html`
|
|
272
|
+
<button type="button" class="tag-remove input-action" aria-label=${this.t('tags.remove', { tag })} @click=${(e: Event) => this.removeTag(e, tag)}>
|
|
273
|
+
<dees-icon .icon=${'lucide:x'} .iconSize=${tagRemoveGlyphPx}></dees-icon>
|
|
274
|
+
</button>
|
|
275
|
+
` : ''}
|
|
311
276
|
</div>
|
|
277
|
+
`)}
|
|
278
|
+
|
|
279
|
+
${!this.disabled && (!this.maxTags || this.value.length < this.maxTags) ? html`
|
|
280
|
+
<input
|
|
281
|
+
type="text"
|
|
282
|
+
aria-label=${this.label ? this.t('tags.addTo', { label: this.label }) : this.t('tags.add')}
|
|
283
|
+
class="tag-input"
|
|
284
|
+
.placeholder=${this.placeholder || this.t('tags.placeholder')}
|
|
285
|
+
.value=${this.inputValue}
|
|
286
|
+
@input=${this.handleInput}
|
|
287
|
+
@keydown=${this.handleKeyDown}
|
|
288
|
+
@focus=${this.handleFocus}
|
|
289
|
+
@blur=${this.handleBlur}
|
|
290
|
+
?disabled=${this.disabled}
|
|
291
|
+
/>
|
|
312
292
|
` : ''}
|
|
313
293
|
</div>
|
|
314
294
|
|
|
295
|
+
${this.showSuggestions && filteredSuggestions.length > 0 ? html`
|
|
296
|
+
<div class="suggestions-dropdown" popover="manual">
|
|
297
|
+
${filteredSuggestions.map((suggestion, index) => html`
|
|
298
|
+
<div
|
|
299
|
+
class="suggestion ${index === this.highlightedSuggestionIndex ? 'highlighted' : ''}"
|
|
300
|
+
@mousedown=${(e: Event) => {
|
|
301
|
+
e.preventDefault(); // Prevent blur
|
|
302
|
+
this.addTag(suggestion);
|
|
303
|
+
}}
|
|
304
|
+
@mouseenter=${() => this.highlightedSuggestionIndex = index}
|
|
305
|
+
>
|
|
306
|
+
${suggestion}
|
|
307
|
+
</div>
|
|
308
|
+
`)}
|
|
309
|
+
</div>
|
|
310
|
+
` : ''}
|
|
311
|
+
|
|
315
312
|
${this.validationText ? html`
|
|
316
313
|
<div class="validation-message">${this.validationText}</div>
|
|
317
314
|
` : ''}
|
|
@@ -321,6 +318,63 @@ export class DeesInputTags extends DeesInputBase<DeesInputTags> {
|
|
|
321
318
|
`;
|
|
322
319
|
}
|
|
323
320
|
|
|
321
|
+
updated(changedProperties: Map<string, any>) {
|
|
322
|
+
super.updated(changedProperties);
|
|
323
|
+
const list = this.shadowRoot!.querySelector<HTMLElement>('.suggestions-dropdown');
|
|
324
|
+
if (!list) {
|
|
325
|
+
this.suggestionsTracking?.abort();
|
|
326
|
+
this.suggestionsTracking = undefined;
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
if (!this.suggestionsTracking) {
|
|
330
|
+
const field = this.shadowRoot!.querySelector<HTMLElement>('.tags-container')!;
|
|
331
|
+
const tracking = new AbortController();
|
|
332
|
+
this.suggestionsTracking = tracking;
|
|
333
|
+
listenForScrollAround(field, this.placeSuggestions, tracking.signal);
|
|
334
|
+
window.addEventListener('resize', this.placeSuggestions, { passive: true, signal: tracking.signal });
|
|
335
|
+
// Tags wrap onto another line as they are added, and the field grows with them.
|
|
336
|
+
const observer = new ResizeObserver(this.placeSuggestions);
|
|
337
|
+
observer.observe(field);
|
|
338
|
+
tracking.signal.addEventListener('abort', () => observer.disconnect());
|
|
339
|
+
}
|
|
340
|
+
this.placeSuggestions();
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
public async disconnectedCallback(): Promise<void> {
|
|
344
|
+
this.suggestionsTracking?.abort();
|
|
345
|
+
this.suggestionsTracking = undefined;
|
|
346
|
+
await super.disconnectedCallback();
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* The open suggestions stand in the top layer, below the field or above it without room there,
|
|
351
|
+
* so no scroll container or clipping ancestor around the field cuts them off. They follow the
|
|
352
|
+
* field as it scrolls or grows and step out of view while none of it shows.
|
|
353
|
+
*/
|
|
354
|
+
private placeSuggestions = () => {
|
|
355
|
+
const list = this.shadowRoot?.querySelector<HTMLElement>('.suggestions-dropdown');
|
|
356
|
+
const field = this.shadowRoot?.querySelector<HTMLElement>('.tags-container');
|
|
357
|
+
if (!list || !field) return;
|
|
358
|
+
const shown = visibleRect(field);
|
|
359
|
+
if (!shown) {
|
|
360
|
+
if (list.matches(':popover-open')) list.hidePopover();
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
if (!list.matches(':popover-open')) list.showPopover();
|
|
364
|
+
const box = field.getBoundingClientRect();
|
|
365
|
+
list.style.width = `${box.width}px`;
|
|
366
|
+
const placed = placeAnchored({
|
|
367
|
+
anchor: { left: box.left, right: box.right, top: shown.top, bottom: shown.bottom },
|
|
368
|
+
width: box.width,
|
|
369
|
+
height: list.offsetHeight,
|
|
370
|
+
placement: 'bottom',
|
|
371
|
+
flip: true,
|
|
372
|
+
gap: 4,
|
|
373
|
+
});
|
|
374
|
+
list.style.left = `${placed.left}px`;
|
|
375
|
+
list.style.top = `${placed.top}px`;
|
|
376
|
+
};
|
|
377
|
+
|
|
324
378
|
private handleContainerClick(e: Event) {
|
|
325
379
|
if (this.disabled) return;
|
|
326
380
|
|