@design.estate/dees-catalog 24.2.0 → 24.3.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 +6164 -5263
- 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.js +7 -10
- 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/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 +133 -16
- 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.ts +6 -10
- 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/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
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DeesElement,
|
|
3
|
+
type TemplateResult,
|
|
4
|
+
property,
|
|
5
|
+
customElement,
|
|
6
|
+
html,
|
|
7
|
+
css,
|
|
8
|
+
cssManager,
|
|
9
|
+
} from '@design.estate/dees-element';
|
|
10
|
+
import { themeDefaultStyles } from '../../00theme.js';
|
|
11
|
+
import { OverlayScrollbarController, overlayScrollbarStyles } from '../../00scrollbars.js';
|
|
12
|
+
import { prefersReducedMotion } from '../../00motion.js';
|
|
13
|
+
import '../../00group-utility/dees-icon/dees-icon.js';
|
|
14
|
+
import { nextRovingIndex } from '../appui.roving.js';
|
|
15
|
+
import { normalizeIconName } from '../appui.helpers.js';
|
|
16
|
+
import type { IAppuiPageTab, IAppuiPageTabSelectEvent } from '../dees-appui-page/dees-appui-page.js';
|
|
17
|
+
import { demoFunc } from './dees-appui-secondarytabs.demo.js';
|
|
18
|
+
|
|
19
|
+
declare global {
|
|
20
|
+
interface HTMLElementTagNameMap {
|
|
21
|
+
'dees-appui-secondarytabs': DeesAppuiSecondarytabs;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A view's second level of tabs — the sub-views of a page or the parts of a
|
|
27
|
+
* record — as a stripe across the content's width under the page heading,
|
|
28
|
+
* with a hairline of its own below it. The selected tab's line lies on that
|
|
29
|
+
* hairline. `dees-appui-page` draws its `tabs` with one.
|
|
30
|
+
*
|
|
31
|
+
* The tabs are `IAppuiPageTab`s (`key`, `label`, `iconName?`, `badge?`), a
|
|
32
|
+
* badge a count or a short mark after the label. `selectedTab` (reflected) is
|
|
33
|
+
* the selected key, the first tab while it names none; `label` names the tab
|
|
34
|
+
* list. The tabs are one Tab stop: the arrow keys move along them in the
|
|
35
|
+
* writing direction, Home and End go to the ends, and Enter, Space or a click
|
|
36
|
+
* select one, which reflects as `selectedTab` and is reported as a bubbling,
|
|
37
|
+
* composed `tab-select` (`{ key, tab }`). The tabs name the element that shows
|
|
38
|
+
* the selected tab, `controlsElement`, as the panel they control.
|
|
39
|
+
*
|
|
40
|
+
* The first tab's label stands at the region inset, `--dees-inset-inline`,
|
|
41
|
+
* where a container declares one (32px, 16px below 700px of width, where none
|
|
42
|
+
* does), so it lines up with the title above it; its hover face reaches into
|
|
43
|
+
* the inset. `--dees-appui-secondarytabs-max-width` caps the row, centred,
|
|
44
|
+
* while the hairline keeps the full width. A row wider than the stripe scrolls
|
|
45
|
+
* sideways under an overlay scrollbar, and the selected tab scrolls into view.
|
|
46
|
+
*/
|
|
47
|
+
@customElement('dees-appui-secondarytabs')
|
|
48
|
+
export class DeesAppuiSecondarytabs extends DeesElement {
|
|
49
|
+
public static demo = demoFunc;
|
|
50
|
+
public static demoGroups = ['App UI'];
|
|
51
|
+
|
|
52
|
+
@property({ attribute: false })
|
|
53
|
+
accessor tabs: IAppuiPageTab[] = [];
|
|
54
|
+
|
|
55
|
+
/** The key of the selected tab; the first tab while it names none. */
|
|
56
|
+
@property({ type: String, reflect: true })
|
|
57
|
+
accessor selectedTab: string = '';
|
|
58
|
+
|
|
59
|
+
/** The tab list's accessible name: what the tabs divide, such as the page's title. */
|
|
60
|
+
@property({ type: String, reflect: true })
|
|
61
|
+
accessor label: string = '';
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The element that shows the selected tab's content, which every tab names as
|
|
65
|
+
* the panel it controls. An `aria-controls` IDREF cannot cross this element's
|
|
66
|
+
* shadow boundary, so the panel is an element reference.
|
|
67
|
+
*/
|
|
68
|
+
@property({ attribute: false })
|
|
69
|
+
accessor controlsElement: HTMLElement | null = null;
|
|
70
|
+
|
|
71
|
+
/** The row's scrollbar, shown while it scrolls. */
|
|
72
|
+
private readonly scrollbars = new OverlayScrollbarController(
|
|
73
|
+
this,
|
|
74
|
+
() => this.shadowRoot?.querySelector<HTMLElement>('.tabs'),
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
public static styles = [
|
|
78
|
+
themeDefaultStyles,
|
|
79
|
+
cssManager.defaultStyles,
|
|
80
|
+
overlayScrollbarStyles,
|
|
81
|
+
css`
|
|
82
|
+
:host {
|
|
83
|
+
display: block;
|
|
84
|
+
container-type: inline-size;
|
|
85
|
+
color: var(--dees-color-text-primary);
|
|
86
|
+
font-family: var(--dees-font-family);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.stripe {
|
|
90
|
+
--secondarytabs-inset: var(--dees-inset-inline, var(--dees-spacing-2xl));
|
|
91
|
+
border-bottom: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* The box the row's scrollbar is placed in. It reaches over the stripe's
|
|
95
|
+
hairline, so the selected tab's line lies on it. */
|
|
96
|
+
.frame {
|
|
97
|
+
position: relative;
|
|
98
|
+
box-sizing: border-box;
|
|
99
|
+
max-width: var(--dees-appui-secondarytabs-max-width, none);
|
|
100
|
+
min-width: 0;
|
|
101
|
+
margin-inline: auto;
|
|
102
|
+
margin-bottom: calc(-1 * var(--dees-line-width-hairline));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* The first tab's label stands at the inset; its hover face reaches into it. */
|
|
106
|
+
.tabs {
|
|
107
|
+
display: flex;
|
|
108
|
+
gap: var(--dees-spacing-xs);
|
|
109
|
+
overflow-x: auto;
|
|
110
|
+
padding-block: var(--dees-spacing-xs) 0;
|
|
111
|
+
padding-inline: calc(var(--secondarytabs-inset) - var(--dees-spacing-md)) var(--secondarytabs-inset);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.tab {
|
|
115
|
+
position: relative;
|
|
116
|
+
display: inline-flex;
|
|
117
|
+
align-items: center;
|
|
118
|
+
gap: var(--dees-spacing-sm);
|
|
119
|
+
flex: none;
|
|
120
|
+
height: var(--dees-control-height-lg);
|
|
121
|
+
margin-bottom: var(--dees-spacing-sm);
|
|
122
|
+
padding: 0 var(--dees-spacing-md);
|
|
123
|
+
border: 0;
|
|
124
|
+
border-radius: var(--dees-radius-md);
|
|
125
|
+
background: transparent;
|
|
126
|
+
color: var(--dees-color-text-secondary);
|
|
127
|
+
font: inherit;
|
|
128
|
+
font-size: var(--dees-font-footnote-size);
|
|
129
|
+
font-weight: 500;
|
|
130
|
+
white-space: nowrap;
|
|
131
|
+
cursor: pointer;
|
|
132
|
+
transition: background var(--dees-transition-fast) var(--dees-ease-standard),
|
|
133
|
+
color var(--dees-transition-fast) var(--dees-ease-standard);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.tab:hover {
|
|
137
|
+
background: var(--dees-color-hover);
|
|
138
|
+
color: var(--dees-color-text-primary);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* Inset: the row scrolls, and would clip a ring drawn outside a tab. */
|
|
142
|
+
.tab:focus-visible {
|
|
143
|
+
outline: var(--dees-line-width-focus-ring) solid var(--dees-color-focus-ring);
|
|
144
|
+
outline-offset: -2px;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.tab[aria-selected='true'] {
|
|
148
|
+
color: var(--dees-color-text-primary);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* At the bottom of the tab's margin: on the stripe's hairline. */
|
|
152
|
+
.tab[aria-selected='true']::after {
|
|
153
|
+
content: '';
|
|
154
|
+
position: absolute;
|
|
155
|
+
inset-inline: var(--dees-spacing-md);
|
|
156
|
+
bottom: calc(-1 * var(--dees-spacing-sm));
|
|
157
|
+
height: 2px;
|
|
158
|
+
border-radius: 1px;
|
|
159
|
+
background: var(--dees-color-accent-primary);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.tabBadge {
|
|
163
|
+
min-width: 16px;
|
|
164
|
+
padding: 0 var(--dees-spacing-xs);
|
|
165
|
+
border-radius: var(--dees-radius-full);
|
|
166
|
+
background: var(--dees-color-fill-secondary);
|
|
167
|
+
color: var(--dees-color-text-secondary);
|
|
168
|
+
font-size: var(--dees-font-caption2-size);
|
|
169
|
+
line-height: 16px;
|
|
170
|
+
text-align: center;
|
|
171
|
+
box-sizing: border-box;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@container (max-width: 700px) {
|
|
175
|
+
.stripe {
|
|
176
|
+
--secondarytabs-inset: var(--dees-inset-inline, var(--dees-spacing-lg));
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
@media (pointer: coarse) {
|
|
181
|
+
.tab {
|
|
182
|
+
height: var(--dees-control-height-touch);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@media (prefers-reduced-motion: reduce) {
|
|
187
|
+
.tab {
|
|
188
|
+
transition: none;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
`,
|
|
192
|
+
];
|
|
193
|
+
|
|
194
|
+
public render(): TemplateResult {
|
|
195
|
+
const tabs = this.tabs;
|
|
196
|
+
if (!tabs.length) return html``;
|
|
197
|
+
const selected = this.currentTab();
|
|
198
|
+
return html`
|
|
199
|
+
<div class="stripe">
|
|
200
|
+
<div class="frame">
|
|
201
|
+
<div class="tabs" role="tablist" @keydown=${this.handleKeydown}>
|
|
202
|
+
${tabs.map((tab, index) => this.renderTab(tab, index, tab.key === selected?.key))}
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
</div>
|
|
206
|
+
`;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
private renderTab(tab: IAppuiPageTab, index: number, selected: boolean): TemplateResult {
|
|
210
|
+
return html`<button
|
|
211
|
+
class="tab"
|
|
212
|
+
type="button"
|
|
213
|
+
role="tab"
|
|
214
|
+
id=${`tab-${index}`}
|
|
215
|
+
data-key=${tab.key}
|
|
216
|
+
aria-selected=${selected ? 'true' : 'false'}
|
|
217
|
+
@click=${() => this.selectTab(tab)}
|
|
218
|
+
>
|
|
219
|
+
${tab.iconName
|
|
220
|
+
? html`<dees-icon aria-hidden="true" .icon=${normalizeIconName(tab.iconName)} iconSize="14"></dees-icon>`
|
|
221
|
+
: ''}
|
|
222
|
+
<span>${tab.label}</span>
|
|
223
|
+
${tab.badge !== undefined && tab.badge !== '' ? html`<span class="tabBadge">${tab.badge}</span>` : ''}
|
|
224
|
+
</button>`;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* One Tab stop: the focused tab while the reader moves along the tabs, the
|
|
229
|
+
* selected one otherwise. Every tab names the panel; the list its name.
|
|
230
|
+
*/
|
|
231
|
+
public updated(changedProperties: Map<string | number | symbol, unknown>): void {
|
|
232
|
+
super.updated(changedProperties);
|
|
233
|
+
const list = this.shadowRoot?.querySelector<HTMLElement>('.tabs');
|
|
234
|
+
if (!list) return;
|
|
235
|
+
if (this.label) list.setAttribute('aria-label', this.label);
|
|
236
|
+
else list.removeAttribute('aria-label');
|
|
237
|
+
const buttons = this.tabButtons();
|
|
238
|
+
const focused = buttons.find((button) => button === this.shadowRoot?.activeElement);
|
|
239
|
+
const stop = focused ?? buttons.find((button) => button.getAttribute('aria-selected') === 'true');
|
|
240
|
+
for (const button of buttons) {
|
|
241
|
+
button.tabIndex = button === stop ? 0 : -1;
|
|
242
|
+
button.ariaControlsElements = this.controlsElement ? [this.controlsElement] : null;
|
|
243
|
+
}
|
|
244
|
+
if (changedProperties.has('selectedTab') || changedProperties.has('tabs')) this.scrollSelectedIntoView(list);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
private tabButtons(): HTMLButtonElement[] {
|
|
248
|
+
return [...(this.shadowRoot?.querySelectorAll<HTMLButtonElement>('.tab') ?? [])];
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** The selected tab: the one `selectedTab` names, else the first. */
|
|
252
|
+
private currentTab(): IAppuiPageTab | undefined {
|
|
253
|
+
return this.tabs.find((tab) => tab.key === this.selectedTab) ?? this.tabs[0];
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
private selectTab(tab: IAppuiPageTab): void {
|
|
257
|
+
if (tab.key === this.currentTab()?.key && tab.key === this.selectedTab) return;
|
|
258
|
+
this.selectedTab = tab.key;
|
|
259
|
+
this.dispatchEvent(new CustomEvent<IAppuiPageTabSelectEvent>('tab-select', {
|
|
260
|
+
detail: { key: tab.key, tab },
|
|
261
|
+
bubbles: true,
|
|
262
|
+
composed: true,
|
|
263
|
+
}));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Scrolls the row, and only the row, the least distance that shows the
|
|
268
|
+
* selected tab whole and clear of the inset at either end (at once under
|
|
269
|
+
* reduced motion). A tab already in view stays put.
|
|
270
|
+
*/
|
|
271
|
+
private scrollSelectedIntoView(list: HTMLElement): void {
|
|
272
|
+
if (list.scrollWidth <= list.clientWidth) return;
|
|
273
|
+
const tab = this.tabButtons().find((button) => button.getAttribute('aria-selected') === 'true');
|
|
274
|
+
if (!tab) return;
|
|
275
|
+
const view = list.getBoundingClientRect();
|
|
276
|
+
const rect = tab.getBoundingClientRect();
|
|
277
|
+
const inset = Number.parseFloat(getComputedStyle(list).paddingInlineEnd) || 0;
|
|
278
|
+
const clearance = Math.min(inset, Math.max(0, (view.width - rect.width) / 2));
|
|
279
|
+
let distance = 0;
|
|
280
|
+
if (rect.left < view.left + clearance || rect.width > view.width) distance = rect.left - view.left - clearance;
|
|
281
|
+
else if (rect.right > view.right - clearance) distance = rect.right - view.right + clearance;
|
|
282
|
+
if (Math.abs(distance) < 1) return;
|
|
283
|
+
list.scrollTo({ left: list.scrollLeft + distance, behavior: prefersReducedMotion() ? 'auto' : 'smooth' });
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/** Arrow keys follow the writing direction, Home and End go to the ends; the focus moves, the selection waits for Enter. */
|
|
287
|
+
private readonly handleKeydown = (event: KeyboardEvent) => {
|
|
288
|
+
const buttons = this.tabButtons();
|
|
289
|
+
const current = buttons.findIndex((button) => event.composedPath().includes(button));
|
|
290
|
+
if (current < 0) return;
|
|
291
|
+
const rtl = getComputedStyle(this).direction === 'rtl';
|
|
292
|
+
const key = rtl && event.key === 'ArrowLeft' ? 'ArrowRight' : rtl && event.key === 'ArrowRight' ? 'ArrowLeft' : event.key;
|
|
293
|
+
const next = nextRovingIndex(key, current, buttons.length, 'horizontal');
|
|
294
|
+
if (next === null) return;
|
|
295
|
+
event.preventDefault();
|
|
296
|
+
for (const button of buttons) button.tabIndex = button === buttons[next] ? 0 : -1;
|
|
297
|
+
buttons[next].focus();
|
|
298
|
+
};
|
|
299
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dees-appui-secondarytabs.js';
|
|
@@ -8,11 +8,13 @@ export * from './dees-appui-appbar/index.js';
|
|
|
8
8
|
export * from './dees-appui-bottombar/index.js';
|
|
9
9
|
export * from './dees-appui-commandpalette/index.js';
|
|
10
10
|
export * from './dees-appui-contentheading/index.js';
|
|
11
|
+
export * from './dees-appui-detailpane/index.js';
|
|
11
12
|
export * from './dees-appui/index.js';
|
|
12
13
|
export * from './dees-appui-maincontent/index.js';
|
|
13
14
|
export * from './dees-appui-mainmenu/index.js';
|
|
14
15
|
export * from './dees-appui-page/index.js';
|
|
15
16
|
export * from './dees-appui-secondarymenu/index.js';
|
|
17
|
+
export * from './dees-appui-secondarytabs/index.js';
|
|
16
18
|
export * from './dees-appui-signin/index.js';
|
|
17
19
|
export * from './dees-appui-profiledropdown/index.js';
|
|
18
20
|
export * from './dees-appui-tabs/index.js';
|
|
@@ -141,23 +141,23 @@ export const demoFunc = () => {
|
|
|
141
141
|
},
|
|
142
142
|
];
|
|
143
143
|
return demoPage('Status button', 'A page\'s status in its header: one button beside the page\'s actions that shows the worst status and a count of the warnings and errors, and opens a speech-bubble panel that lists them. An error or a severe warning opens the panel by itself.', html`
|
|
144
|
-
${demoSection('In a page header', 'The statuses that a page would stack above its table as hints sit in the header; the table starts right under it, frameless. Press the button to open the panel, Escape to close it.', html`
|
|
144
|
+
${demoSection('In a page header', 'The statuses that a page would stack above its table as hints sit in the header, in its tools before the actions; the table starts right under it, frameless. Press the button to open the panel, Escape to close it.', html`
|
|
145
145
|
<div style="background: var(--dees-color-bg-canvas); border: 1px solid var(--dees-color-border-subtle); border-radius: var(--dees-radius-xl); overflow: hidden;">
|
|
146
146
|
<dees-appui-page
|
|
147
147
|
heading="Bank statements"
|
|
148
148
|
description="4 statements · 2 accounts"
|
|
149
149
|
.actions=${pageActions}
|
|
150
150
|
>
|
|
151
|
-
<dees-table-search slot="
|
|
152
|
-
<dees-statusbutton slot="
|
|
151
|
+
<dees-table-search slot="tools" for="statusbuttonDemoStatements" dataName="statements"></dees-table-search>
|
|
152
|
+
<dees-statusbutton slot="tools" .items=${pageItems} @panel-toggle=${reportToggle}></dees-statusbutton>
|
|
153
153
|
<dees-table id="statusbuttonDemoStatements" frameless fill .searchable=${false} dataName="statements"
|
|
154
154
|
.columns=${columns} .data=${statements} .selectionMode=${'none'}></dees-table>
|
|
155
155
|
</dees-appui-page>
|
|
156
156
|
</div>
|
|
157
157
|
${demoOutput('Open or close the panel.')}
|
|
158
158
|
${demoCode(`<dees-appui-page heading="Bank statements" .actions=\${actions}>
|
|
159
|
-
<dees-table-search slot="
|
|
160
|
-
<dees-statusbutton slot="
|
|
159
|
+
<dees-table-search slot="tools" for="statements" dataName="statements"></dees-table-search>
|
|
160
|
+
<dees-statusbutton slot="tools" .items=\${statuses}></dees-statusbutton>
|
|
161
161
|
<dees-table id="statements" frameless fill .searchable=\${false} dataName="statements"
|
|
162
162
|
.columns=\${columns} .data=\${rows}></dees-table>
|
|
163
163
|
</dees-appui-page>`)}
|
|
@@ -168,6 +168,12 @@ export class DeesPdfViewer extends DeesElement {
|
|
|
168
168
|
private thumbnailObserverRoot?: HTMLElement;
|
|
169
169
|
private scrollThrottleTimeout?: number;
|
|
170
170
|
private viewportDimensions = { width: 0, height: 0 };
|
|
171
|
+
/**
|
|
172
|
+
* The first page's size at scale 1. A page not rendered yet takes this size at the current zoom,
|
|
173
|
+
* so the document's scroll range is the document's before its pages render, not twelve blank
|
|
174
|
+
* canvases' (pdf.js's own viewer sizes its placeholders the same way).
|
|
175
|
+
*/
|
|
176
|
+
private pagePlaceholderBase: { width: number; height: number } | undefined;
|
|
171
177
|
private viewportMode: 'auto' | 'page-fit' | 'page-width' | 'custom' = 'auto';
|
|
172
178
|
private readonly MANUAL_MIN_ZOOM = 0.5;
|
|
173
179
|
private readonly MANUAL_MAX_ZOOM = 3;
|
|
@@ -558,6 +564,11 @@ export class DeesPdfViewer extends DeesElement {
|
|
|
558
564
|
this.pdfFileSize = 0;
|
|
559
565
|
}
|
|
560
566
|
|
|
567
|
+
const firstPage = await raceWithAbort(pdfDocument.getPage(1), signal);
|
|
568
|
+
if (!this.isCurrentLoad(generationArg, connectionEpochArg, urlArg)) return;
|
|
569
|
+
const firstPageBase = firstPage.getViewport({ scale: 1 });
|
|
570
|
+
this.pagePlaceholderBase = { width: firstPageBase.width, height: firstPageBase.height };
|
|
571
|
+
|
|
561
572
|
this.thumbnailData = Array.from({length: this.totalPages}, (_, i) => ({
|
|
562
573
|
page: i + 1,
|
|
563
574
|
rendered: false
|
|
@@ -573,17 +584,21 @@ export class DeesPdfViewer extends DeesElement {
|
|
|
573
584
|
await this.updateComplete;
|
|
574
585
|
if (!this.isCurrentLoad(generationArg, connectionEpochArg, urlArg)) return;
|
|
575
586
|
this.ensureViewerRefs();
|
|
587
|
+
this.sizePagePlaceholders();
|
|
576
588
|
this.setupIntersectionObserver();
|
|
577
589
|
|
|
578
590
|
await waitForAnimationFrame(signal);
|
|
579
591
|
if (!this.isCurrentLoad(generationArg, connectionEpochArg, urlArg) || signal.aborted) return;
|
|
580
592
|
this.renderState = 'rendering-main';
|
|
581
593
|
|
|
582
|
-
|
|
583
|
-
|
|
594
|
+
// The pages stand at their size already, so the document opens at its page before any
|
|
595
|
+
// renders; a page scrolled to while the first pages render stays where it was scrolled to.
|
|
584
596
|
if (this.currentPage > 1) {
|
|
585
597
|
await this.scrollToPage(this.currentPage, false);
|
|
598
|
+
if (!this.isCurrentLoad(generationArg, connectionEpochArg, urlArg) || signal.aborted) return;
|
|
586
599
|
}
|
|
600
|
+
await this.renderVisiblePages();
|
|
601
|
+
if (!this.isCurrentLoad(generationArg, connectionEpochArg, urlArg) || signal.aborted) return;
|
|
587
602
|
|
|
588
603
|
if (this.thumbnailsVisible) {
|
|
589
604
|
await this.updateComplete;
|
|
@@ -1262,6 +1277,7 @@ export class DeesPdfViewer extends DeesElement {
|
|
|
1262
1277
|
|
|
1263
1278
|
private reRenderAllPages() {
|
|
1264
1279
|
this.renderGeneration += 1;
|
|
1280
|
+
this.sizePagePlaceholders();
|
|
1265
1281
|
// Clear all rendered pages to force re-render with new zoom
|
|
1266
1282
|
this.pageData.forEach(page => {
|
|
1267
1283
|
page.rendered = false;
|
|
@@ -1622,9 +1638,22 @@ export class DeesPdfViewer extends DeesElement {
|
|
|
1622
1638
|
}
|
|
1623
1639
|
}
|
|
1624
1640
|
|
|
1625
|
-
private computeViewport(page:
|
|
1626
|
-
this.measureViewportDimensions();
|
|
1641
|
+
private computeViewport(page: PDFPageProxy) {
|
|
1627
1642
|
const baseViewport = page.getViewport({ scale: 1 });
|
|
1643
|
+
return page.getViewport({ scale: this.computeScale(baseViewport) });
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
/** Sizes the pages not rendered yet as the first page at the current zoom. */
|
|
1647
|
+
private sizePagePlaceholders() {
|
|
1648
|
+
if (!this.pagePlaceholderBase || !this.viewerMain) return;
|
|
1649
|
+
const scale = this.computeScale(this.pagePlaceholderBase);
|
|
1650
|
+
this.viewerMain.style.setProperty('--pdf-page-width', `${this.pagePlaceholderBase.width * scale}px`);
|
|
1651
|
+
this.viewerMain.style.setProperty('--pdf-page-height', `${this.pagePlaceholderBase.height * scale}px`);
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
/** The scale a page of `baseViewport`'s size (at scale 1) renders at in the current viewport mode. */
|
|
1655
|
+
private computeScale(baseViewport: { width: number; height: number }): number {
|
|
1656
|
+
this.measureViewportDimensions();
|
|
1628
1657
|
let scale: number;
|
|
1629
1658
|
|
|
1630
1659
|
switch (this.viewportMode) {
|
|
@@ -1661,7 +1690,7 @@ export class DeesPdfViewer extends DeesElement {
|
|
|
1661
1690
|
this.currentZoom = clampedScale;
|
|
1662
1691
|
}
|
|
1663
1692
|
|
|
1664
|
-
return
|
|
1693
|
+
return clampedScale;
|
|
1665
1694
|
}
|
|
1666
1695
|
|
|
1667
1696
|
private normalizeZoom(value: number, clampToManualRange: boolean) {
|
|
@@ -1812,6 +1841,9 @@ export class DeesPdfViewer extends DeesElement {
|
|
|
1812
1841
|
this.thumbnailObserverRoot = undefined;
|
|
1813
1842
|
this.thumbnailData = [];
|
|
1814
1843
|
this.pageData = [];
|
|
1844
|
+
this.pagePlaceholderBase = undefined;
|
|
1845
|
+
this.viewerMain?.style.removeProperty('--pdf-page-width');
|
|
1846
|
+
this.viewerMain?.style.removeProperty('--pdf-page-height');
|
|
1815
1847
|
this.documentId = '';
|
|
1816
1848
|
this.totalPages = 1;
|
|
1817
1849
|
this.currentPage = 1;
|
|
@@ -286,8 +286,11 @@ export const viewerStyles = [
|
|
|
286
286
|
position: relative;
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
+
/* A page not rendered yet takes the first page's size; rendering sizes it as its own. */
|
|
289
290
|
.page-canvas {
|
|
290
291
|
display: block;
|
|
292
|
+
width: var(--pdf-page-width, auto);
|
|
293
|
+
height: var(--pdf-page-height, auto);
|
|
291
294
|
}
|
|
292
295
|
|
|
293
296
|
/* Text layer for selection */
|
package/ts_web/i18n/de.ts
CHANGED
|
@@ -87,6 +87,9 @@ export default dcMessages.translation('de', {
|
|
|
87
87
|
|
|
88
88
|
'page.breadcrumb': 'Brotkrümelnavigation',
|
|
89
89
|
'contentheading.back': 'Zurück zu {label}',
|
|
90
|
+
'detailpane.label': 'Details',
|
|
91
|
+
'detailpane.close': 'Details schließen',
|
|
92
|
+
'detailpane.resize': 'Größe der Details ändern',
|
|
90
93
|
'appui.activityTitle': 'Aktivität',
|
|
91
94
|
'appui.activityCount': 'Sichtbare Einträge',
|
|
92
95
|
'appui.activityLive': 'Live',
|