@design.estate/dees-catalog 24.2.0 → 24.4.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 +6265 -5348
- package/dist_bundle/bundle.js.map +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-SSD44HAU.js → chunk-4UZGSPGV.js} +8 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-SSD44HAU.js.map → chunk-4UZGSPGV.js.map} +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-YUJKYSDX.js → chunk-7CM7S6EQ.js} +3 -3
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-347GWLFZ.js → chunk-R6EBIDCM.js} +2 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{de-5P7JLMRS.js → de-LD3JG4AD.js} +5 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/de-LD3JG4AD.js.map +1 -0
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-PC4PYTOT.js → dees-modal-Z3DSEMNI.js} +3 -3
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-GFHNW2QR.js → dees-workspace-terminal-KPB3RVGL.js} +4 -4
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/es-J75P6Y7U.js +1461 -0
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/es-J75P6Y7U.js.map +1 -0
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/fr-FXZISX5I.js +1461 -0
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/fr-FXZISX5I.js.map +1 -0
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/00group-appui/appui.helpers.d.ts +6 -0
- package/dist_ts_web/elements/00group-appui/appui.helpers.js +7 -1
- package/dist_ts_web/elements/00group-appui/dees-appui/dees-appui.d.ts +42 -23
- package/dist_ts_web/elements/00group-appui/dees-appui/dees-appui.demo.js +2 -3
- package/dist_ts_web/elements/00group-appui/dees-appui/dees-appui.js +99 -90
- package/dist_ts_web/elements/00group-appui/dees-appui/shell.storage.d.ts +11 -4
- package/dist_ts_web/elements/00group-appui/dees-appui/shell.storage.js +32 -9
- package/dist_ts_web/elements/00group-appui/dees-appui-detailpane/dees-appui-detailpane.d.ts +88 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-detailpane/dees-appui-detailpane.demo.d.ts +34 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-detailpane/dees-appui-detailpane.demo.js +317 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-detailpane/dees-appui-detailpane.js +510 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-detailpane/index.d.ts +1 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-detailpane/index.js +2 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-page/dees-appui-page.d.ts +43 -17
- package/dist_ts_web/elements/00group-appui/dees-appui-page/dees-appui-page.demo.d.ts +2 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-page/dees-appui-page.demo.js +28 -3
- package/dist_ts_web/elements/00group-appui/dees-appui-page/dees-appui-page.js +113 -152
- package/dist_ts_web/elements/00group-appui/dees-appui-secondarytabs/dees-appui-secondarytabs.d.ts +68 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-secondarytabs/dees-appui-secondarytabs.demo.d.ts +4 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-secondarytabs/dees-appui-secondarytabs.demo.js +57 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-secondarytabs/dees-appui-secondarytabs.js +357 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-secondarytabs/index.d.ts +1 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-secondarytabs/index.js +2 -0
- package/dist_ts_web/elements/00group-appui/index.d.ts +2 -0
- package/dist_ts_web/elements/00group-appui/index.js +3 -1
- package/dist_ts_web/elements/00group-feedback/dees-statusbutton/dees-statusbutton.demo.js +6 -6
- package/dist_ts_web/elements/00group-media/dees-pdf-viewer/component.d.ts +10 -0
- package/dist_ts_web/elements/00group-media/dees-pdf-viewer/component.js +38 -6
- package/dist_ts_web/elements/00group-media/dees-pdf-viewer/styles.js +4 -1
- package/dist_ts_web/elements/interfaces/appconfig.d.ts +28 -10
- package/dist_ts_web/i18n/de.d.ts +12 -0
- package/dist_ts_web/i18n/de.js +4 -1
- package/dist_ts_web/i18n/es.d.ts +5780 -0
- package/dist_ts_web/i18n/es.js +1452 -0
- package/dist_ts_web/i18n/fr.d.ts +5780 -0
- package/dist_ts_web/i18n/fr.js +1452 -0
- package/dist_ts_web/i18n/messages.d.ts +13 -1
- package/dist_ts_web/i18n/messages.js +8 -2
- package/package.json +2 -2
- package/readme.md +142 -22
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/00group-appui/appui.helpers.ts +7 -0
- package/ts_web/elements/00group-appui/dees-appui/dees-appui.demo.ts +1 -2
- package/ts_web/elements/00group-appui/dees-appui/dees-appui.ts +108 -99
- package/ts_web/elements/00group-appui/dees-appui/readme.md +42 -26
- package/ts_web/elements/00group-appui/dees-appui/shell.storage.ts +42 -11
- package/ts_web/elements/00group-appui/dees-appui-detailpane/dees-appui-detailpane.demo.ts +267 -0
- package/ts_web/elements/00group-appui/dees-appui-detailpane/dees-appui-detailpane.ts +451 -0
- package/ts_web/elements/00group-appui/dees-appui-detailpane/index.ts +1 -0
- package/ts_web/elements/00group-appui/dees-appui-page/dees-appui-page.demo.ts +30 -2
- package/ts_web/elements/00group-appui/dees-appui-page/dees-appui-page.ts +113 -148
- package/ts_web/elements/00group-appui/dees-appui-secondarytabs/dees-appui-secondarytabs.demo.ts +62 -0
- package/ts_web/elements/00group-appui/dees-appui-secondarytabs/dees-appui-secondarytabs.ts +299 -0
- package/ts_web/elements/00group-appui/dees-appui-secondarytabs/index.ts +1 -0
- package/ts_web/elements/00group-appui/index.ts +2 -0
- package/ts_web/elements/00group-feedback/dees-statusbutton/dees-statusbutton.demo.ts +5 -5
- package/ts_web/elements/00group-media/dees-pdf-viewer/component.ts +37 -5
- package/ts_web/elements/00group-media/dees-pdf-viewer/styles.ts +3 -0
- package/ts_web/elements/interfaces/appconfig.ts +29 -10
- package/ts_web/i18n/de.ts +3 -0
- package/ts_web/i18n/es.ts +1452 -0
- package/ts_web/i18n/fr.ts +1452 -0
- package/ts_web/i18n/messages.ts +8 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/de-5P7JLMRS.js.map +0 -1
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-YUJKYSDX.js.map → chunk-7CM7S6EQ.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-347GWLFZ.js.map → chunk-R6EBIDCM.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-PC4PYTOT.js.map → dees-modal-Z3DSEMNI.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-GFHNW2QR.js.map → dees-workspace-terminal-KPB3RVGL.js.map} +0 -0
|
@@ -4,9 +4,11 @@ import type {
|
|
|
4
4
|
IAppShellStorageErrorEvent,
|
|
5
5
|
IAppTrayTab,
|
|
6
6
|
TAppuiAside,
|
|
7
|
-
TAppuiPane,
|
|
8
7
|
} from '../../interfaces/appconfig.js';
|
|
9
8
|
|
|
9
|
+
/** A pane that has a width of its own: the section menu, and the side panel whichever tool it shows. */
|
|
10
|
+
export type TShellPane = 'secondary' | 'aside';
|
|
11
|
+
|
|
10
12
|
/**
|
|
11
13
|
* What the shell keeps through a host's storage adapter, one key each, stored
|
|
12
14
|
* as `dees-appui.<key>` with a JSON value.
|
|
@@ -15,7 +17,10 @@ export interface IShellStoredState {
|
|
|
15
17
|
mainMenuCollapsed: boolean;
|
|
16
18
|
secondaryMenuCollapsed: boolean;
|
|
17
19
|
secondaryPaneWidth: number;
|
|
20
|
+
asidePaneWidth: number;
|
|
21
|
+
/** Read only: the activity log's width from before the side panel had one width. */
|
|
18
22
|
activityPaneWidth: number;
|
|
23
|
+
/** Read only: the assistant's width from before the side panel had one width. */
|
|
19
24
|
assistantPaneWidth: number;
|
|
20
25
|
aside: TAppuiAside | null;
|
|
21
26
|
lastView: IAppRoute;
|
|
@@ -24,8 +29,24 @@ export interface IShellStoredState {
|
|
|
24
29
|
|
|
25
30
|
export type TShellStoredKey = keyof IShellStoredState;
|
|
26
31
|
|
|
32
|
+
/** The keys whose values have the shape `V`. */
|
|
33
|
+
type TShellStoredKeyOf<V> = { [K in TShellStoredKey]: IShellStoredState[K] extends V ? K : never }[TShellStoredKey];
|
|
34
|
+
|
|
27
35
|
/** The key a pane's width is kept under. */
|
|
28
|
-
export const paneWidthKey = (pane:
|
|
36
|
+
export const paneWidthKey = (pane: TShellPane) => `${pane}PaneWidth` as const;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Keys a newer key took over from, asked together with it and taken in this
|
|
40
|
+
* order while the newer one holds nothing usable. The first that holds a value
|
|
41
|
+
* is applied and written under the newer key, so it is taken once: the shell
|
|
42
|
+
* writes only the newer key, which answers from then on. Asked in the same
|
|
43
|
+
* round as the newer key, they cost an adapter over a server no extra wait.
|
|
44
|
+
* The side panel's one width starts from the assistant's width a reader left,
|
|
45
|
+
* else the activity log's.
|
|
46
|
+
*/
|
|
47
|
+
const supersededKeys: { [K in TShellStoredKey]?: readonly TShellStoredKeyOf<IShellStoredState[K]>[] } = {
|
|
48
|
+
asidePaneWidth: ['assistantPaneWidth', 'activityPaneWidth'],
|
|
49
|
+
};
|
|
29
50
|
|
|
30
51
|
/** The key the adapter sees: the shell's keys live under one namespace. */
|
|
31
52
|
const storageKey = (key: TShellStoredKey): string => `dees-appui.${key}`;
|
|
@@ -63,6 +84,7 @@ const storedShapes: { [K in TShellStoredKey]: (value: unknown) => value is IShel
|
|
|
63
84
|
mainMenuCollapsed: isBoolean,
|
|
64
85
|
secondaryMenuCollapsed: isBoolean,
|
|
65
86
|
secondaryPaneWidth: isWidth,
|
|
87
|
+
asidePaneWidth: isWidth,
|
|
66
88
|
activityPaneWidth: isWidth,
|
|
67
89
|
assistantPaneWidth: isWidth,
|
|
68
90
|
aside: (value): value is TAppuiAside | null => value === null || value === 'activity' || value === 'assistant',
|
|
@@ -95,20 +117,29 @@ export class ShellStorage {
|
|
|
95
117
|
* Applies a key's stored value. An adapter that answers at once is applied
|
|
96
118
|
* at once, before the render the caller is part of, so nothing shows the
|
|
97
119
|
* value it replaces. A later answer is applied when it arrives, unless
|
|
98
|
-
* another storage took over or the key was written meanwhile.
|
|
99
|
-
* the
|
|
120
|
+
* another storage took over or the key was written meanwhile. The keys it
|
|
121
|
+
* superseded are asked with it; while the key holds nothing usable, the
|
|
122
|
+
* first of them that does is applied and written under the key. Resolves
|
|
123
|
+
* once the answer is applied or dropped.
|
|
100
124
|
*/
|
|
101
125
|
public restore<K extends TShellStoredKey>(key: K, apply: (value: IShellStoredState[K]) => void): Promise<void> {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
126
|
+
// A superseded key holds a value of its successor's shape, which its own guard checks.
|
|
127
|
+
const sources = [key, ...(supersededKeys[key] ?? [])] as K[];
|
|
128
|
+
const settle = (stored: (string | undefined)[]) => {
|
|
129
|
+
for (const [index, source] of sources.entries()) {
|
|
130
|
+
const value = this.decode(source, stored[index]);
|
|
131
|
+
if (value === undefined) continue;
|
|
132
|
+
apply(value);
|
|
133
|
+
if (source !== key) this.write(key, value);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
105
136
|
};
|
|
106
|
-
const
|
|
107
|
-
if (!(answer instanceof Promise)) {
|
|
108
|
-
settle(
|
|
137
|
+
const answers = sources.map((source) => this.readStored(source));
|
|
138
|
+
if (!answers.some((answer) => answer instanceof Promise)) {
|
|
139
|
+
settle(answers as (string | undefined)[]);
|
|
109
140
|
return Promise.resolve();
|
|
110
141
|
}
|
|
111
|
-
return
|
|
142
|
+
return Promise.all(answers).then((stored) => {
|
|
112
143
|
if (!this.retired && !this.written.has(key)) settle(stored);
|
|
113
144
|
});
|
|
114
145
|
}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { DeesElement, css, customElement, html, property, state, type TemplateResult } from '@design.estate/dees-element';
|
|
2
|
+
import { demoCode, demoPage, demoSection, demoStyles } from '../../../demos/templates.js';
|
|
3
|
+
import { themeDefaultStyles } from '../../00theme.js';
|
|
4
|
+
import type { Column, ITableAction } from '../../00group-dataview/dees-table/types.js';
|
|
5
|
+
import type { DeesTable } from '../../00group-dataview/dees-table/dees-table.js';
|
|
6
|
+
import type { IStatusbuttonItem } from '../../00group-feedback/dees-statusbutton/dees-statusbutton.js';
|
|
7
|
+
import type { IAppuiPageAction, IAppuiPageTab, IAppuiPageTabSelectEvent } from '../dees-appui-page/dees-appui-page.js';
|
|
8
|
+
import type { DeesAppuiDetailpane, IAppuiDetailpaneWidthChangeEvent } from './dees-appui-detailpane.js';
|
|
9
|
+
import { deepActiveElement } from '../../00overlay.js';
|
|
10
|
+
import '../dees-appui-page/dees-appui-page.js';
|
|
11
|
+
import '../../00group-dataview/dees-table/dees-table.js';
|
|
12
|
+
import '../../00group-dataview/dees-table-search/dees-table-search.js';
|
|
13
|
+
import '../../00group-feedback/dees-statusbutton/dees-statusbutton.js';
|
|
14
|
+
import '../../00group-feedback/dees-badge/dees-badge.js';
|
|
15
|
+
import '../../00group-button/dees-button/dees-button.js';
|
|
16
|
+
|
|
17
|
+
interface IDemoRoute {
|
|
18
|
+
id: string;
|
|
19
|
+
hosts: string;
|
|
20
|
+
target: string;
|
|
21
|
+
owner: string;
|
|
22
|
+
cluster: string;
|
|
23
|
+
ports: string;
|
|
24
|
+
source: string;
|
|
25
|
+
/** Whether every gateway applied the route's last revision. */
|
|
26
|
+
applying: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface IDemoRedirect {
|
|
30
|
+
id: string;
|
|
31
|
+
from: string;
|
|
32
|
+
to: string;
|
|
33
|
+
route: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const routes: IDemoRoute[] = [
|
|
37
|
+
{ id: 'docs', hosts: 'docs.example.com', target: 'docs-site', owner: 'Service', cluster: 'production', ports: '443', source: 'Public', applying: true },
|
|
38
|
+
{ id: 'uploads', hosts: 'uploads.example.com', target: 'uploads', owner: 'Service', cluster: 'production', ports: '443', source: 'Public', applying: false },
|
|
39
|
+
{ id: 'media', hosts: 'media.example.com', target: 'media-render', owner: 'Service', cluster: 'production', ports: '443', source: 'Public', applying: false },
|
|
40
|
+
{ id: 'www', hosts: 'www.example.com +3', target: 'docs-site', owner: 'Service', cluster: 'production', ports: '443', source: 'Public', applying: false },
|
|
41
|
+
{ id: 'smtp-submission', hosts: 'Port 587', target: 'Mail', owner: 'System', cluster: 'edge', ports: '587', source: 'Public', applying: false },
|
|
42
|
+
{ id: 'agl', hosts: 'agl.example.com', target: '10.0.4.20:3000', owner: 'Gateway client', cluster: 'office', ports: '443', source: 'Office network', applying: false },
|
|
43
|
+
{ id: 'status', hosts: 'status.example.com', target: 'status-page', owner: 'Service', cluster: 'production', ports: '443', source: 'Public', applying: false },
|
|
44
|
+
{ id: 'grafana', hosts: 'grafana.example.com', target: 'grafana', owner: 'Service', cluster: 'monitoring', ports: '443', source: 'Office network', applying: false },
|
|
45
|
+
{ id: 'registry', hosts: 'registry.example.com', target: 'registry', owner: 'Service', cluster: 'production', ports: '443', source: 'Public', applying: false },
|
|
46
|
+
{ id: 'api', hosts: 'api.example.com', target: 'api-gateway', owner: 'Service', cluster: 'production', ports: '443', source: 'Public', applying: false },
|
|
47
|
+
{ id: 'auth', hosts: 'auth.example.com', target: 'idp', owner: 'Service', cluster: 'production', ports: '443', source: 'Public', applying: false },
|
|
48
|
+
{ id: 'imap', hosts: 'Port 993', target: 'Mail', owner: 'System', cluster: 'edge', ports: '993', source: 'Public', applying: false },
|
|
49
|
+
{ id: 'git', hosts: 'git.example.com', target: 'gitea', owner: 'Service', cluster: 'tools', ports: '443, 22', source: 'Public', applying: false },
|
|
50
|
+
{ id: 'chat', hosts: 'chat.example.com', target: 'matrix', owner: 'Service', cluster: 'tools', ports: '443', source: 'Public', applying: false },
|
|
51
|
+
{ id: 'vpn', hosts: 'Port 51820', target: 'wireguard', owner: 'System', cluster: 'edge', ports: '51820', source: 'Public', applying: false },
|
|
52
|
+
{ id: 'billing', hosts: 'billing.example.com', target: 'billing-api', owner: 'Service', cluster: 'production', ports: '443', source: 'Public', applying: false },
|
|
53
|
+
{ id: 'backup', hosts: 'backup.example.com', target: '10.0.4.31:8200', owner: 'Gateway client', cluster: 'office', ports: '443', source: 'Office network', applying: false },
|
|
54
|
+
{ id: 'preview', hosts: '*.preview.example.com', target: 'preview-renderer', owner: 'Service', cluster: 'staging', ports: '443', source: 'Public', applying: false },
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
const redirects: IDemoRedirect[] = ['docs', 'uploads', 'media', 'www', 'status'].map((route) => ({
|
|
58
|
+
id: `${route}-http`,
|
|
59
|
+
from: `http://${routes.find((entry) => entry.id === route)!.hosts.split(' ')[0]}/*`,
|
|
60
|
+
to: 'https, 308',
|
|
61
|
+
route,
|
|
62
|
+
}));
|
|
63
|
+
|
|
64
|
+
const appliedBadge = (applying: boolean) => html`<dees-badge .tone=${applying ? 'warning' : 'success'} .text=${applying ? 'Applying' : 'Applied'} .rounded=${true}></dees-badge>`;
|
|
65
|
+
|
|
66
|
+
const routeColumns: Column<IDemoRoute>[] = [
|
|
67
|
+
{ key: 'id', header: 'Route' },
|
|
68
|
+
{ key: 'hosts', header: 'Hosts' },
|
|
69
|
+
{ key: 'target', header: 'Target' },
|
|
70
|
+
{ key: 'owner', header: 'Owner' },
|
|
71
|
+
{ key: 'applying', header: 'Applied', renderer: (value) => appliedBadge(!!value) },
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
const redirectColumns: Column<IDemoRedirect>[] = [
|
|
75
|
+
{ key: 'from', header: 'From' },
|
|
76
|
+
{ key: 'to', header: 'To' },
|
|
77
|
+
{ key: 'route', header: 'Route' },
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
const subViews: IAppuiPageTab[] = [
|
|
81
|
+
{ key: 'routes', label: 'Routes', badge: routes.length },
|
|
82
|
+
{ key: 'redirects', label: 'Derived redirects', badge: redirects.length },
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
const statuses: IStatusbuttonItem[] = [
|
|
86
|
+
{ key: 'rollout', severity: 'warning', text: 'Applying r418: 1 of 2 gateways.', detail: 'gw-nbg-1 still runs r417.' },
|
|
87
|
+
{ key: 'certificates', severity: 'success', text: 'Every route is covered by a valid certificate.' },
|
|
88
|
+
];
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* A list page as the integrated view standard has it: the search, the status button and the
|
|
92
|
+
* primary action in the header, two sub-views in a stripe of tabs, and a frameless list whose
|
|
93
|
+
* rows open their record in a detail pane beside it. The host drives the pane: a row it opens
|
|
94
|
+
* sets `open` and the record, `close-request` clears them, and `width-change` is kept.
|
|
95
|
+
*/
|
|
96
|
+
@customElement('dees-demo-appui-detailpane')
|
|
97
|
+
export class DeesDemoAppuiDetailpane extends DeesElement {
|
|
98
|
+
/** The frame's width in CSS pixels; 0 takes the panel's. */
|
|
99
|
+
@property({ type: Number }) accessor frameWidth = 0;
|
|
100
|
+
@state() accessor subView = 'routes';
|
|
101
|
+
@state() accessor openId: string | null = null;
|
|
102
|
+
@state() accessor paneWidth = 400;
|
|
103
|
+
@state() accessor message = 'Click a row, or focus one and press Enter, to open its record.';
|
|
104
|
+
|
|
105
|
+
public static styles = [themeDefaultStyles, demoStyles, css`
|
|
106
|
+
:host { display: block; min-width: 0; }
|
|
107
|
+
.frame {
|
|
108
|
+
height: 560px; min-width: 0; overflow: hidden;
|
|
109
|
+
border: 1px solid var(--dees-color-border-subtle); border-radius: var(--dees-radius-xl); background: var(--dees-color-bg-canvas);
|
|
110
|
+
}
|
|
111
|
+
.record { display: grid; gap: 18px; font-size: 13px; line-height: 20px; }
|
|
112
|
+
.record h3 { margin: 0 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--dees-color-text-muted); }
|
|
113
|
+
.record dl { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 6px 12px; margin: 0; }
|
|
114
|
+
.record dt { color: var(--dees-color-text-secondary); }
|
|
115
|
+
.record dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
|
|
116
|
+
.checks { border: 1px solid var(--dees-color-border-subtle); border-radius: var(--dees-radius-lg); }
|
|
117
|
+
.check { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; }
|
|
118
|
+
.check + .check { border-top: 1px solid var(--dees-color-border-subtle); }
|
|
119
|
+
.check small { margin-left: auto; color: var(--dees-color-text-muted); }
|
|
120
|
+
`];
|
|
121
|
+
|
|
122
|
+
private get pane(): DeesAppuiDetailpane | null {
|
|
123
|
+
return this.shadowRoot?.querySelector('dees-appui-detailpane') ?? null;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
private get table(): DeesTable<IDemoRoute | IDemoRedirect> | null {
|
|
127
|
+
return this.shadowRoot?.querySelector('dees-table') ?? null;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Opens a record; where the pane covers the list, the reader is taken into it. */
|
|
131
|
+
private async openRecord(id: string, takeFocus: boolean): Promise<void> {
|
|
132
|
+
if (this.openId !== id) this.message = `Opened ${id}.`;
|
|
133
|
+
this.openId = id;
|
|
134
|
+
await this.updateComplete;
|
|
135
|
+
if (takeFocus && this.pane?.narrow) await this.pane.focus();
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** Closes the record; a reader who was in it goes back to the row the record was opened from. */
|
|
139
|
+
private readonly closeRecord = async () => {
|
|
140
|
+
const active = deepActiveElement();
|
|
141
|
+
const pane = this.pane;
|
|
142
|
+
const wasInPane = !!pane && !!active && (pane.contains(active) || !!pane.shadowRoot?.contains(active));
|
|
143
|
+
this.message = `close-request: closed ${this.openId}.`;
|
|
144
|
+
this.openId = null;
|
|
145
|
+
await this.updateComplete;
|
|
146
|
+
// The rows' tab stop is the row the reader last focused or clicked: the one the record came from.
|
|
147
|
+
if (wasInPane) this.table?.shadowRoot?.querySelector<HTMLElement>('tbody tr[tabindex="0"]')?.focus();
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
private readonly openAction: ITableAction<IDemoRoute | IDemoRedirect> = {
|
|
151
|
+
name: 'Open',
|
|
152
|
+
type: ['rowClick'],
|
|
153
|
+
actionFunc: async ({ item }) => this.openRecord(item.id, true),
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
public render(): TemplateResult {
|
|
157
|
+
const onRoutes = this.subView === 'routes';
|
|
158
|
+
const route = onRoutes ? routes.find((entry) => entry.id === this.openId) : undefined;
|
|
159
|
+
const redirect = onRoutes ? undefined : redirects.find((entry) => entry.id === this.openId);
|
|
160
|
+
const actions: IAppuiPageAction[] = [
|
|
161
|
+
{ label: 'Add route', iconName: 'lucide:Plus', type: 'primary', action: () => { this.message = 'Add route.'; } },
|
|
162
|
+
];
|
|
163
|
+
return html`
|
|
164
|
+
<div class="frame" style=${this.frameWidth ? `max-width: ${this.frameWidth}px` : ''}>
|
|
165
|
+
<dees-appui-page
|
|
166
|
+
layout="fill"
|
|
167
|
+
heading="Routes"
|
|
168
|
+
description="Network · 18 routes, whoever created them. Special forwards are a route type."
|
|
169
|
+
.actions=${actions}
|
|
170
|
+
.tabs=${subViews}
|
|
171
|
+
.selectedTab=${this.subView}
|
|
172
|
+
@tab-select=${(event: CustomEvent<IAppuiPageTabSelectEvent>) => {
|
|
173
|
+
this.subView = event.detail.key;
|
|
174
|
+
this.openId = null;
|
|
175
|
+
this.message = `tab-select: ${event.detail.key}`;
|
|
176
|
+
}}
|
|
177
|
+
>
|
|
178
|
+
<dees-table-search slot="tools" for="detailpaneDemoList"></dees-table-search>
|
|
179
|
+
<dees-statusbutton slot="tools" heading="Rollout" .progress=${'r418'} .items=${statuses}></dees-statusbutton>
|
|
180
|
+
<dees-appui-detailpane
|
|
181
|
+
.open=${!!(route || redirect)}
|
|
182
|
+
.heading=${route?.id ?? redirect?.from ?? ''}
|
|
183
|
+
.description=${route ? `${route.owner} ${route.target} · ${route.cluster} · r418` : redirect ? `Derived from the route ${redirect.route}` : ''}
|
|
184
|
+
.width=${this.paneWidth}
|
|
185
|
+
@close-request=${this.closeRecord}
|
|
186
|
+
@width-change=${(event: CustomEvent<IAppuiDetailpaneWidthChangeEvent>) => {
|
|
187
|
+
this.paneWidth = event.detail.width;
|
|
188
|
+
this.message = `width-change: ${event.detail.width}px, kept by the host.`;
|
|
189
|
+
}}
|
|
190
|
+
>
|
|
191
|
+
<dees-table
|
|
192
|
+
id="detailpaneDemoList"
|
|
193
|
+
frameless
|
|
194
|
+
fill
|
|
195
|
+
.searchable=${false}
|
|
196
|
+
.selectionMode=${'single'}
|
|
197
|
+
.rowKey=${'id'}
|
|
198
|
+
.dataName=${onRoutes ? 'routes' : 'redirects'}
|
|
199
|
+
.columns=${onRoutes ? routeColumns : redirectColumns}
|
|
200
|
+
.data=${onRoutes ? routes : redirects}
|
|
201
|
+
.dataActions=${[this.openAction]}
|
|
202
|
+
.selectedIds=${new Set(this.openId ? [this.openId] : [])}
|
|
203
|
+
@selectionChange=${(event: CustomEvent<{ selectedIds: string[] }>) => {
|
|
204
|
+
const [id] = event.detail.selectedIds;
|
|
205
|
+
if (id) void this.openRecord(id, false);
|
|
206
|
+
}}
|
|
207
|
+
></dees-table>
|
|
208
|
+
${route ? html`<dees-badge slot="status" .tone=${route.applying ? 'warning' : 'success'} .text=${route.applying ? 'Applying' : 'Applied'} .rounded=${true}></dees-badge>` : ''}
|
|
209
|
+
${route ? html`<dees-button slot="actions" size="sm" type="outline" text="Edit" icon="lucide:SquarePen" @clicked=${() => { this.message = `Edit ${route.id}.`; }}></dees-button>` : ''}
|
|
210
|
+
${route ? this.renderRoute(route) : redirect ? this.renderRedirect(redirect) : ''}
|
|
211
|
+
</dees-appui-detailpane>
|
|
212
|
+
</dees-appui-page>
|
|
213
|
+
</div>
|
|
214
|
+
<output class="dees-demo-output" role="status">${this.message}</output>
|
|
215
|
+
`;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
private renderRoute(route: IDemoRoute): TemplateResult {
|
|
219
|
+
return html`<div slot="detail" class="record">
|
|
220
|
+
<section><h3>Match</h3><dl><dt>Hosts</dt><dd>${route.hosts}</dd><dt>Ports</dt><dd>${route.ports}</dd></dl></section>
|
|
221
|
+
<section><h3>Target</h3><dl><dt>${route.owner}</dt><dd>${route.target}</dd><dt>Cluster</dt><dd>${route.cluster}</dd></dl></section>
|
|
222
|
+
<section><h3>Policy</h3><dl><dt>Source</dt><dd>${route.source}</dd></dl></section>
|
|
223
|
+
<section><h3>Applied</h3><div class="checks">
|
|
224
|
+
<div class="check">gw-fra-1 <small>r418, 12 s ago</small></div>
|
|
225
|
+
<div class="check">gw-nbg-1 <small>${route.applying ? 'r417, applying' : 'r418, 14 s ago'}</small></div>
|
|
226
|
+
</div></section>
|
|
227
|
+
<section><h3>Certificate</h3><dl><dt>Covered by</dt><dd>*.example.com, ACME, valid until 2027-01-08</dd></dl></section>
|
|
228
|
+
<section><h3>Derived redirect</h3><dl><dt>From</dt><dd>http :80, /*</dd><dt>To</dt><dd>https :443, 308</dd><dt>Status</dt><dd>Active</dd></dl></section>
|
|
229
|
+
<section><h3>Last change</h3><div class="checks">
|
|
230
|
+
<div class="check">r418 Changed target <small>maria.keller, 12 min. ago</small></div>
|
|
231
|
+
<div class="check">r402 Added host <small>jonas.weber, 3 days ago</small></div>
|
|
232
|
+
<div class="check">r377 Created <small>maria.keller, 2 weeks ago</small></div>
|
|
233
|
+
</div></section>
|
|
234
|
+
</div>`;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
private renderRedirect(redirect: IDemoRedirect): TemplateResult {
|
|
238
|
+
return html`<div slot="detail" class="record">
|
|
239
|
+
<section><h3>Redirect</h3><dl><dt>From</dt><dd>${redirect.from}</dd><dt>To</dt><dd>${redirect.to}</dd></dl></section>
|
|
240
|
+
<section><h3>Derived from</h3><dl><dt>Route</dt><dd>${redirect.route}</dd><dt>Status</dt><dd>Active</dd></dl></section>
|
|
241
|
+
</div>`;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/** The integrated list at the panel's width and at 600px, where the open record covers the list. */
|
|
246
|
+
export const demoFunc = () => demoPage('Detail pane', 'A list and the record it opens, side by side inside a view\'s content: the list fills the room left and scrolls on its own, the record scrolls on its own in the pane, which a reader resizes at its inner edge. At 700px or less the open pane covers the list.', html`
|
|
247
|
+
${demoSection('Integrated list', 'A page with layout="fill": the search and the status button in its tools, the primary action last, two sub-views as tabs in a stripe, and a frameless list whose rows open their record. Drag the pane\'s inner edge, or focus it and press the arrow keys; the host keeps the width from width-change.', html`
|
|
248
|
+
<dees-demo-appui-detailpane></dees-demo-appui-detailpane>
|
|
249
|
+
${demoCode(`<dees-appui-page layout="fill" heading="Routes" .tabs=\${subViews} .actions=\${[addRoute]}>
|
|
250
|
+
<dees-table-search slot="tools" for="routes"></dees-table-search>
|
|
251
|
+
<dees-statusbutton slot="tools" .items=\${statuses}></dees-statusbutton>
|
|
252
|
+
<dees-appui-detailpane .open=\${!!route} .heading=\${route?.id ?? ''} .description=\${summary}
|
|
253
|
+
.width=\${this.paneWidth} @close-request=\${() => this.close()}
|
|
254
|
+
@width-change=\${(event) => this.keepWidth(event.detail.width)}>
|
|
255
|
+
<dees-table id="routes" frameless fill .searchable=\${false} .selectionMode=\${'single'}
|
|
256
|
+
.rowKey=\${'id'} .columns=\${columns} .data=\${routes}
|
|
257
|
+
@selectionChange=\${(event) => this.open(event.detail.selectedIds[0])}></dees-table>
|
|
258
|
+
<dees-badge slot="status" tone="warning" text="Applying" rounded></dees-badge>
|
|
259
|
+
<dees-button slot="actions" size="sm" type="outline" text="Edit"></dees-button>
|
|
260
|
+
<div slot="detail">…the record…</div>
|
|
261
|
+
</dees-appui-detailpane>
|
|
262
|
+
</dees-appui-page>`)}
|
|
263
|
+
`)}
|
|
264
|
+
${demoSection('Narrow', 'At 600px the open record covers the list, which is inert meanwhile. The host takes the reader into the pane with focus(); Escape or the close button ask to close it, and the host puts the focus back on the row.', html`
|
|
265
|
+
<dees-demo-appui-detailpane .frameWidth=${600}></dees-demo-appui-detailpane>
|
|
266
|
+
`)}
|
|
267
|
+
`);
|