@praxisui/settings-panel 10.0.0-rc.67 → 10.0.0-rc.69
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.
|
@@ -17,7 +17,7 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
|
17
17
|
import { finalize, filter, switchMap, map, debounceTime, distinctUntilChanged } from 'rxjs/operators';
|
|
18
18
|
import { firstValueFrom, isObservable, of, from, Subject, ReplaySubject, take, takeUntil, BehaviorSubject } from 'rxjs';
|
|
19
19
|
import * as i1$2 from '@praxisui/core';
|
|
20
|
-
import { providePraxisI18n, PraxisI18nService, PraxisContextSwitchGuard, ApiConfigStorage, ASYNC_CONFIG_STORAGE, DeferredAsyncConfigStorage, parseConfigPersistenceError, PraxisIconButtonComponent, PraxisIconDirective, SETTINGS_PANEL_DATA as SETTINGS_PANEL_DATA$1, PraxisLayerScaleStyleService, SETTINGS_PANEL_BRIDGE, SURFACE_DRAWER_BRIDGE, SURFACE_DRAWER_CONTENT_DATA, SURFACE_DRAWER_REF, GlobalConfigService, FieldControlType, IconPickerService, LoggerService, ComponentMetadataRegistry } from '@praxisui/core';
|
|
20
|
+
import { providePraxisI18n, PraxisI18nService, PraxisContextSwitchGuard, ApiConfigStorage, ASYNC_CONFIG_STORAGE, DeferredAsyncConfigStorage, parseConfigPersistenceError, PraxisIconButtonComponent, PraxisIconDirective, SETTINGS_PANEL_DATA as SETTINGS_PANEL_DATA$1, resolveSidePanelViewportWidth, canExpandSidePanel, clampSidePanelWidthPx, resolveExpandedSidePanelWidthPx, parseSidePanelWidthPx, resolveSidePanelPresetWidth, resolveSidePanelPresetWidthPx, readPersistedSidePanelWidth, writePersistedSidePanelWidth, PraxisLayerScaleStyleService, SETTINGS_PANEL_BRIDGE, SURFACE_DRAWER_BRIDGE, SURFACE_DRAWER_CONTENT_DATA, SURFACE_DRAWER_REF, GlobalConfigService, FieldControlType, IconPickerService, LoggerService, ComponentMetadataRegistry } from '@praxisui/core';
|
|
21
21
|
import { ConfirmDialogComponent } from '@praxisui/dynamic-fields';
|
|
22
22
|
import * as i1$1 from '@angular/cdk/overlay';
|
|
23
23
|
import { ComponentPortal } from '@angular/cdk/portal';
|
|
@@ -2102,7 +2102,6 @@ class DeferredSettingsPanelRef {
|
|
|
2102
2102
|
const SETTINGS_PANEL_DATA = SETTINGS_PANEL_DATA$1;
|
|
2103
2103
|
const SETTINGS_PANEL_REF = new InjectionToken('SETTINGS_PANEL_REF');
|
|
2104
2104
|
|
|
2105
|
-
const PRAXIS_BASE_SIDE_PANEL_I18N_NAMESPACE = 'praxis-side-panel';
|
|
2106
2105
|
class BaseSidePanelComponent {
|
|
2107
2106
|
cdr;
|
|
2108
2107
|
i18n;
|
|
@@ -2114,9 +2113,12 @@ class BaseSidePanelComponent {
|
|
|
2114
2113
|
minWidth;
|
|
2115
2114
|
maxWidth;
|
|
2116
2115
|
resizable = false;
|
|
2116
|
+
expandable = false;
|
|
2117
2117
|
resizeAxis = 'x';
|
|
2118
2118
|
persistSizeKey;
|
|
2119
2119
|
useHostWidth = false;
|
|
2120
|
+
isExpanded = false;
|
|
2121
|
+
isResizing = false;
|
|
2120
2122
|
theme = null;
|
|
2121
2123
|
onClose;
|
|
2122
2124
|
onResizeWidth;
|
|
@@ -2125,6 +2127,9 @@ class BaseSidePanelComponent {
|
|
|
2125
2127
|
activePointerId = null;
|
|
2126
2128
|
dragStartX = 0;
|
|
2127
2129
|
dragStartWidth = 0;
|
|
2130
|
+
collapsedWidthBeforeExpand = null;
|
|
2131
|
+
suppressNextBackdropClick = false;
|
|
2132
|
+
backdropSuppressTimer = null;
|
|
2128
2133
|
contentRef;
|
|
2129
2134
|
footerRef;
|
|
2130
2135
|
contentHost;
|
|
@@ -2134,7 +2139,11 @@ class BaseSidePanelComponent {
|
|
|
2134
2139
|
this.i18n = i18n;
|
|
2135
2140
|
}
|
|
2136
2141
|
ngOnDestroy() {
|
|
2137
|
-
this.
|
|
2142
|
+
if (this.backdropSuppressTimer !== null) {
|
|
2143
|
+
clearTimeout(this.backdropSuppressTimer);
|
|
2144
|
+
this.backdropSuppressTimer = null;
|
|
2145
|
+
}
|
|
2146
|
+
this.stopResizeSession(false);
|
|
2138
2147
|
}
|
|
2139
2148
|
get hostClasses() {
|
|
2140
2149
|
return this.theme?.hostClasses ?? [];
|
|
@@ -2142,9 +2151,19 @@ class BaseSidePanelComponent {
|
|
|
2142
2151
|
get hostCssVars() {
|
|
2143
2152
|
return (this.theme?.cssVars ?? {});
|
|
2144
2153
|
}
|
|
2154
|
+
get tracksHostWidth() {
|
|
2155
|
+
return (this.useHostWidth ||
|
|
2156
|
+
this.resizable ||
|
|
2157
|
+
this.expandable ||
|
|
2158
|
+
this.isExpanded ||
|
|
2159
|
+
Boolean(this.width));
|
|
2160
|
+
}
|
|
2145
2161
|
get panelInlineStyles() {
|
|
2162
|
+
if (this.tracksHostWidth) {
|
|
2163
|
+
return {};
|
|
2164
|
+
}
|
|
2146
2165
|
return {
|
|
2147
|
-
width: this.
|
|
2166
|
+
width: this.width ?? null,
|
|
2148
2167
|
minWidth: this.minWidth ?? null,
|
|
2149
2168
|
maxWidth: this.maxWidth ?? null,
|
|
2150
2169
|
};
|
|
@@ -2156,10 +2175,16 @@ class BaseSidePanelComponent {
|
|
|
2156
2175
|
};
|
|
2157
2176
|
}
|
|
2158
2177
|
get closeLabel() {
|
|
2159
|
-
|
|
2178
|
+
const fallback = this.i18n.getLocale().toLowerCase().startsWith('en')
|
|
2179
|
+
? 'Close'
|
|
2180
|
+
: 'Fechar';
|
|
2181
|
+
return this.i18n.t('Close', undefined, fallback, PRAXIS_SETTINGS_PANEL_I18N_NAMESPACE);
|
|
2160
2182
|
}
|
|
2161
2183
|
get resizeHandleLabel() {
|
|
2162
|
-
|
|
2184
|
+
const fallback = this.i18n.getLocale().toLowerCase().startsWith('en')
|
|
2185
|
+
? 'Resize panel'
|
|
2186
|
+
: 'Redimensionar painel';
|
|
2187
|
+
return this.i18n.t('Resize panel', undefined, fallback, PRAXIS_SETTINGS_PANEL_I18N_NAMESPACE);
|
|
2163
2188
|
}
|
|
2164
2189
|
get hasHeader() {
|
|
2165
2190
|
return !!(this.title || this.titleIcon || this.subtitle);
|
|
@@ -2168,26 +2193,144 @@ class BaseSidePanelComponent {
|
|
|
2168
2193
|
return !!this.footerRef;
|
|
2169
2194
|
}
|
|
2170
2195
|
get widthClass() {
|
|
2171
|
-
if (this.
|
|
2196
|
+
if (this.tracksHostWidth) {
|
|
2172
2197
|
return null;
|
|
2173
2198
|
}
|
|
2174
2199
|
return `width-${this.widthPreset}`;
|
|
2175
2200
|
}
|
|
2176
2201
|
get showResizeHandle() {
|
|
2177
|
-
return this.resizable &&
|
|
2202
|
+
return (this.resizable &&
|
|
2203
|
+
this.resizeAxis === 'x' &&
|
|
2204
|
+
resolveSidePanelViewportWidth() > 640);
|
|
2205
|
+
}
|
|
2206
|
+
get showExpandButton() {
|
|
2207
|
+
if (!this.expandable) {
|
|
2208
|
+
return false;
|
|
2209
|
+
}
|
|
2210
|
+
if (this.isExpanded) {
|
|
2211
|
+
return true;
|
|
2212
|
+
}
|
|
2213
|
+
const viewportWidth = resolveSidePanelViewportWidth();
|
|
2214
|
+
return canExpandSidePanel(this.getCurrentWidthPx(viewportWidth), viewportWidth, { maxWidth: this.maxWidth });
|
|
2215
|
+
}
|
|
2216
|
+
get expandLabel() {
|
|
2217
|
+
const isEn = this.i18n.getLocale().toLowerCase().startsWith('en');
|
|
2218
|
+
if (this.isExpanded) {
|
|
2219
|
+
return this.i18n.t('Collapse panel', undefined, isEn ? 'Collapse panel' : 'Reduzir painel', PRAXIS_SETTINGS_PANEL_I18N_NAMESPACE);
|
|
2220
|
+
}
|
|
2221
|
+
return this.i18n.t('Expand panel', undefined, isEn ? 'Expand panel' : 'Expandir painel', PRAXIS_SETTINGS_PANEL_I18N_NAMESPACE);
|
|
2222
|
+
}
|
|
2223
|
+
get resizeMinWidthPx() {
|
|
2224
|
+
const viewportWidth = resolveSidePanelViewportWidth();
|
|
2225
|
+
return clampSidePanelWidthPx(0, {
|
|
2226
|
+
minWidth: this.minWidth,
|
|
2227
|
+
maxWidth: this.maxWidth,
|
|
2228
|
+
defaultMinPx: 320,
|
|
2229
|
+
viewportWidth,
|
|
2230
|
+
});
|
|
2231
|
+
}
|
|
2232
|
+
get resizeMaxWidthPx() {
|
|
2233
|
+
const viewportWidth = resolveSidePanelViewportWidth();
|
|
2234
|
+
return clampSidePanelWidthPx(viewportWidth, {
|
|
2235
|
+
minWidth: this.minWidth,
|
|
2236
|
+
maxWidth: this.maxWidth,
|
|
2237
|
+
defaultMinPx: 320,
|
|
2238
|
+
viewportWidth,
|
|
2239
|
+
});
|
|
2240
|
+
}
|
|
2241
|
+
get resizeCurrentWidthPx() {
|
|
2242
|
+
return this.getCurrentWidthPx();
|
|
2243
|
+
}
|
|
2244
|
+
onWindowResize() {
|
|
2245
|
+
const viewportWidth = resolveSidePanelViewportWidth();
|
|
2246
|
+
if (this.isExpanded) {
|
|
2247
|
+
const expandedPx = resolveExpandedSidePanelWidthPx(viewportWidth, {
|
|
2248
|
+
maxWidth: this.maxWidth,
|
|
2249
|
+
});
|
|
2250
|
+
const nextWidth = `${expandedPx}px`;
|
|
2251
|
+
if (nextWidth !== this.width) {
|
|
2252
|
+
this.width = nextWidth;
|
|
2253
|
+
this.onResizeWidth?.(nextWidth, { persist: false });
|
|
2254
|
+
}
|
|
2255
|
+
this.cdr.markForCheck();
|
|
2256
|
+
return;
|
|
2257
|
+
}
|
|
2258
|
+
const parsedWidth = parseSidePanelWidthPx(this.width, viewportWidth);
|
|
2259
|
+
if (parsedWidth !== null) {
|
|
2260
|
+
const clamped = this.clampWidthPx(parsedWidth, viewportWidth);
|
|
2261
|
+
const nextWidth = `${clamped}px`;
|
|
2262
|
+
if (parsedWidth > clamped && nextWidth !== this.width) {
|
|
2263
|
+
this.width = nextWidth;
|
|
2264
|
+
this.onResizeWidth?.(nextWidth, { persist: false });
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
this.cdr.markForCheck();
|
|
2178
2268
|
}
|
|
2179
2269
|
setTitle(title) {
|
|
2180
2270
|
this.title = title;
|
|
2181
2271
|
this.cdr.markForCheck();
|
|
2182
2272
|
}
|
|
2183
|
-
|
|
2184
|
-
if (!this.
|
|
2273
|
+
setExpanded(expanded) {
|
|
2274
|
+
if (!this.expandable || expanded === this.isExpanded) {
|
|
2185
2275
|
return;
|
|
2186
2276
|
}
|
|
2187
|
-
const
|
|
2188
|
-
if (
|
|
2277
|
+
const viewportWidth = resolveSidePanelViewportWidth();
|
|
2278
|
+
if (expanded) {
|
|
2279
|
+
const currentWidth = this.getCurrentWidthPx(viewportWidth);
|
|
2280
|
+
if (!canExpandSidePanel(currentWidth, viewportWidth, {
|
|
2281
|
+
maxWidth: this.maxWidth,
|
|
2282
|
+
})) {
|
|
2283
|
+
return;
|
|
2284
|
+
}
|
|
2285
|
+
this.collapsedWidthBeforeExpand =
|
|
2286
|
+
this.width ?? resolveSidePanelPresetWidth(this.widthPreset);
|
|
2287
|
+
const expandedPx = resolveExpandedSidePanelWidthPx(viewportWidth, {
|
|
2288
|
+
maxWidth: this.maxWidth,
|
|
2289
|
+
});
|
|
2290
|
+
const nextWidth = `${expandedPx}px`;
|
|
2291
|
+
this.isExpanded = true;
|
|
2292
|
+
this.width = nextWidth;
|
|
2293
|
+
this.onResizeWidth?.(nextWidth, { persist: false });
|
|
2294
|
+
this.cdr.markForCheck();
|
|
2295
|
+
return;
|
|
2296
|
+
}
|
|
2297
|
+
const rawRestoreWidth = this.collapsedWidthBeforeExpand ??
|
|
2298
|
+
resolveSidePanelPresetWidth(this.widthPreset);
|
|
2299
|
+
const parsedRestore = parseSidePanelWidthPx(rawRestoreWidth, viewportWidth);
|
|
2300
|
+
const clampedRestore = parsedRestore !== null
|
|
2301
|
+
? this.clampWidthPx(parsedRestore, viewportWidth)
|
|
2302
|
+
: null;
|
|
2303
|
+
const restoreWidth = parsedRestore !== null &&
|
|
2304
|
+
clampedRestore !== null &&
|
|
2305
|
+
parsedRestore > clampedRestore
|
|
2306
|
+
? `${clampedRestore}px`
|
|
2307
|
+
: rawRestoreWidth;
|
|
2308
|
+
this.collapsedWidthBeforeExpand = null;
|
|
2309
|
+
this.isExpanded = false;
|
|
2310
|
+
this.width = restoreWidth;
|
|
2311
|
+
this.onResizeWidth?.(restoreWidth, { persist: false });
|
|
2312
|
+
this.cdr.markForCheck();
|
|
2313
|
+
}
|
|
2314
|
+
shouldSuppressBackdropClose() {
|
|
2315
|
+
if (this.isResizing) {
|
|
2316
|
+
return true;
|
|
2317
|
+
}
|
|
2318
|
+
if (this.suppressNextBackdropClick) {
|
|
2319
|
+
this.suppressNextBackdropClick = false;
|
|
2320
|
+
return true;
|
|
2321
|
+
}
|
|
2322
|
+
return false;
|
|
2323
|
+
}
|
|
2324
|
+
toggleExpanded() {
|
|
2325
|
+
this.setExpanded(!this.isExpanded);
|
|
2326
|
+
}
|
|
2327
|
+
onResizeHandlePointerDown(event) {
|
|
2328
|
+
if (!this.showResizeHandle || event.button !== 0) {
|
|
2189
2329
|
return;
|
|
2190
2330
|
}
|
|
2331
|
+
const viewportWidth = resolveSidePanelViewportWidth();
|
|
2332
|
+
const currentWidth = this.promoteExpandedBeforeManualResize(viewportWidth);
|
|
2333
|
+
this.isResizing = true;
|
|
2191
2334
|
this.activePointerId = event.pointerId;
|
|
2192
2335
|
this.dragStartX = event.clientX;
|
|
2193
2336
|
this.dragStartWidth = currentWidth;
|
|
@@ -2196,36 +2339,64 @@ class BaseSidePanelComponent {
|
|
|
2196
2339
|
target?.setPointerCapture(event.pointerId);
|
|
2197
2340
|
}
|
|
2198
2341
|
catch { }
|
|
2342
|
+
this.cdr.markForCheck();
|
|
2199
2343
|
event.preventDefault();
|
|
2200
2344
|
}
|
|
2345
|
+
onResizeHandleDoubleClick(event) {
|
|
2346
|
+
if (!this.showResizeHandle) {
|
|
2347
|
+
return;
|
|
2348
|
+
}
|
|
2349
|
+
event.preventDefault();
|
|
2350
|
+
if (this.isExpanded) {
|
|
2351
|
+
this.setExpanded(false);
|
|
2352
|
+
return;
|
|
2353
|
+
}
|
|
2354
|
+
const viewportWidth = resolveSidePanelViewportWidth();
|
|
2355
|
+
const currentWidth = this.getCurrentWidthPx(viewportWidth);
|
|
2356
|
+
const targetWidth = currentWidth < 840 ? 960 : 720;
|
|
2357
|
+
this.applyWidthPx(targetWidth, viewportWidth);
|
|
2358
|
+
}
|
|
2201
2359
|
onResizeHandleKeydown(event) {
|
|
2202
2360
|
if (!this.showResizeHandle) {
|
|
2203
2361
|
return;
|
|
2204
2362
|
}
|
|
2205
|
-
const
|
|
2363
|
+
const viewportWidth = resolveSidePanelViewportWidth();
|
|
2364
|
+
const step = event.shiftKey ? 80 : 40;
|
|
2206
2365
|
switch (event.key) {
|
|
2207
|
-
case 'ArrowLeft':
|
|
2208
|
-
this.
|
|
2366
|
+
case 'ArrowLeft': {
|
|
2367
|
+
const currentWidth = this.promoteExpandedBeforeManualResize(viewportWidth);
|
|
2368
|
+
this.applyWidthPx(currentWidth + step, viewportWidth);
|
|
2209
2369
|
event.preventDefault();
|
|
2210
2370
|
return;
|
|
2211
|
-
|
|
2212
|
-
|
|
2371
|
+
}
|
|
2372
|
+
case 'ArrowRight': {
|
|
2373
|
+
const currentWidth = this.promoteExpandedBeforeManualResize(viewportWidth);
|
|
2374
|
+
this.applyWidthPx(currentWidth - step, viewportWidth);
|
|
2213
2375
|
event.preventDefault();
|
|
2214
2376
|
return;
|
|
2377
|
+
}
|
|
2215
2378
|
case 'Home': {
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
this.
|
|
2219
|
-
|
|
2220
|
-
|
|
2379
|
+
this.promoteExpandedBeforeManualResize(viewportWidth);
|
|
2380
|
+
const minPx = clampSidePanelWidthPx(0, {
|
|
2381
|
+
minWidth: this.minWidth,
|
|
2382
|
+
maxWidth: this.maxWidth,
|
|
2383
|
+
defaultMinPx: 320,
|
|
2384
|
+
viewportWidth,
|
|
2385
|
+
});
|
|
2386
|
+
this.applyWidthPx(minPx, viewportWidth);
|
|
2387
|
+
event.preventDefault();
|
|
2221
2388
|
return;
|
|
2222
2389
|
}
|
|
2223
2390
|
case 'End': {
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
this.
|
|
2227
|
-
|
|
2228
|
-
|
|
2391
|
+
this.promoteExpandedBeforeManualResize(viewportWidth);
|
|
2392
|
+
const maxPx = clampSidePanelWidthPx(viewportWidth, {
|
|
2393
|
+
minWidth: this.minWidth,
|
|
2394
|
+
maxWidth: this.maxWidth,
|
|
2395
|
+
defaultMinPx: 320,
|
|
2396
|
+
viewportWidth,
|
|
2397
|
+
});
|
|
2398
|
+
this.applyWidthPx(maxPx, viewportWidth);
|
|
2399
|
+
event.preventDefault();
|
|
2229
2400
|
return;
|
|
2230
2401
|
}
|
|
2231
2402
|
default:
|
|
@@ -2243,7 +2414,7 @@ class BaseSidePanelComponent {
|
|
|
2243
2414
|
if (event.pointerId !== this.activePointerId) {
|
|
2244
2415
|
return;
|
|
2245
2416
|
}
|
|
2246
|
-
this.stopResizeSession();
|
|
2417
|
+
this.stopResizeSession(true);
|
|
2247
2418
|
}
|
|
2248
2419
|
attachContent(component, injector, inputs) {
|
|
2249
2420
|
this.contentRef = this.contentHost.createComponent(component, { injector });
|
|
@@ -2291,39 +2462,60 @@ class BaseSidePanelComponent {
|
|
|
2291
2462
|
}
|
|
2292
2463
|
return new Set(Object.keys(declaredInputs));
|
|
2293
2464
|
}
|
|
2294
|
-
stopResizeSession() {
|
|
2295
|
-
this.activePointerId
|
|
2465
|
+
stopResizeSession(suppressBackdropClick = false) {
|
|
2466
|
+
if (this.activePointerId !== null || this.isResizing) {
|
|
2467
|
+
this.activePointerId = null;
|
|
2468
|
+
this.isResizing = false;
|
|
2469
|
+
if (suppressBackdropClick) {
|
|
2470
|
+
this.suppressNextBackdropClick = true;
|
|
2471
|
+
if (this.backdropSuppressTimer !== null) {
|
|
2472
|
+
clearTimeout(this.backdropSuppressTimer);
|
|
2473
|
+
}
|
|
2474
|
+
this.backdropSuppressTimer = setTimeout(() => {
|
|
2475
|
+
this.backdropSuppressTimer = null;
|
|
2476
|
+
this.suppressNextBackdropClick = false;
|
|
2477
|
+
}, 0);
|
|
2478
|
+
}
|
|
2479
|
+
this.cdr.markForCheck();
|
|
2480
|
+
}
|
|
2296
2481
|
}
|
|
2297
|
-
|
|
2298
|
-
|
|
2482
|
+
promoteExpandedBeforeManualResize(viewportWidth = resolveSidePanelViewportWidth()) {
|
|
2483
|
+
const currentWidth = this.getCurrentWidthPx(viewportWidth);
|
|
2484
|
+
if (this.isExpanded) {
|
|
2485
|
+
this.isExpanded = false;
|
|
2486
|
+
this.collapsedWidthBeforeExpand = null;
|
|
2487
|
+
this.width = `${currentWidth}px`;
|
|
2488
|
+
this.cdr.markForCheck();
|
|
2489
|
+
}
|
|
2490
|
+
return currentWidth;
|
|
2299
2491
|
}
|
|
2300
|
-
|
|
2301
|
-
const
|
|
2492
|
+
getCurrentWidthPx(viewportWidth = resolveSidePanelViewportWidth()) {
|
|
2493
|
+
const parsed = this.parseWidthPx(this.width, viewportWidth);
|
|
2494
|
+
if (parsed !== null) {
|
|
2495
|
+
return Math.round(parsed);
|
|
2496
|
+
}
|
|
2497
|
+
return Math.round(resolveSidePanelPresetWidthPx(this.widthPreset, viewportWidth));
|
|
2498
|
+
}
|
|
2499
|
+
applyWidthPx(value, viewportWidth = resolveSidePanelViewportWidth()) {
|
|
2500
|
+
const clampedWidth = this.clampWidthPx(value, viewportWidth);
|
|
2302
2501
|
const width = `${clampedWidth}px`;
|
|
2303
2502
|
this.width = width;
|
|
2304
|
-
this.onResizeWidth?.(width);
|
|
2503
|
+
this.onResizeWidth?.(width, { persist: true });
|
|
2305
2504
|
this.cdr.markForCheck();
|
|
2306
2505
|
}
|
|
2307
|
-
clampWidthPx(value) {
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2506
|
+
clampWidthPx(value, viewportWidth = resolveSidePanelViewportWidth()) {
|
|
2507
|
+
return clampSidePanelWidthPx(value, {
|
|
2508
|
+
minWidth: this.minWidth,
|
|
2509
|
+
maxWidth: this.maxWidth,
|
|
2510
|
+
defaultMinPx: 320,
|
|
2511
|
+
viewportWidth,
|
|
2512
|
+
});
|
|
2313
2513
|
}
|
|
2314
|
-
parseWidthPx(value) {
|
|
2315
|
-
|
|
2316
|
-
return null;
|
|
2317
|
-
}
|
|
2318
|
-
const normalized = value.trim().toLowerCase();
|
|
2319
|
-
if (!normalized.endsWith('px')) {
|
|
2320
|
-
return null;
|
|
2321
|
-
}
|
|
2322
|
-
const parsed = Number.parseFloat(normalized.slice(0, -2));
|
|
2323
|
-
return Number.isFinite(parsed) ? parsed : null;
|
|
2514
|
+
parseWidthPx(value, viewportWidth = resolveSidePanelViewportWidth()) {
|
|
2515
|
+
return parseSidePanelWidthPx(value, viewportWidth);
|
|
2324
2516
|
}
|
|
2325
2517
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: BaseSidePanelComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1$2.PraxisI18nService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2326
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.14", type: BaseSidePanelComponent, isStandalone: true, selector: "praxis-base-side-panel", host: { listeners: { "document:pointermove": "onDocumentPointerMove($event)", "document:pointerup": "onDocumentPointerEnd($event)", "document:pointercancel": "onDocumentPointerEnd($event)" } }, viewQueries: [{ propertyName: "contentHost", first: true, predicate: ["contentHost"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "footerHost", first: true, predicate: ["footerHost"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<div\n class=\"pfx-base-side-panel\"\n [class.has-header]=\"hasHeader\"\n [class.has-footer]=\"hasFooter\"\n [class.width-narrow]=\"widthClass === 'width-narrow'\"\n [class.width-default]=\"widthClass === 'width-default'\"\n [class.width-wide]=\"widthClass === 'width-wide'\"\n [class.width-full]=\"widthClass === 'width-full'\"\n [class.use-host-width]=\"
|
|
2518
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.14", type: BaseSidePanelComponent, isStandalone: true, selector: "praxis-base-side-panel", host: { listeners: { "window:resize": "onWindowResize()", "document:pointermove": "onDocumentPointerMove($event)", "document:pointerup": "onDocumentPointerEnd($event)", "document:pointercancel": "onDocumentPointerEnd($event)" } }, viewQueries: [{ propertyName: "contentHost", first: true, predicate: ["contentHost"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "footerHost", first: true, predicate: ["footerHost"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<div\n class=\"pfx-base-side-panel\"\n [class.has-header]=\"hasHeader\"\n [class.has-footer]=\"hasFooter\"\n [class.width-narrow]=\"widthClass === 'width-narrow'\"\n [class.width-default]=\"widthClass === 'width-default'\"\n [class.width-wide]=\"widthClass === 'width-wide'\"\n [class.width-full]=\"widthClass === 'width-full'\"\n [class.use-host-width]=\"tracksHostWidth\"\n [class.is-resizable]=\"showResizeHandle\"\n [class.is-expandable]=\"expandable\"\n [class.is-expanded]=\"isExpanded\"\n [class.is-resizing]=\"isResizing\"\n [ngClass]=\"hostClasses\"\n [ngStyle]=\"mergedHostStyles\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-labelledby]=\"hasHeader ? titleId : null\"\n cdkTrapFocus\n cdkTrapFocusAutoCapture\n>\n @if (showResizeHandle) {\n <div\n class=\"pfx-base-side-panel__resize-handle\"\n role=\"separator\"\n tabindex=\"0\"\n aria-orientation=\"vertical\"\n [attr.aria-label]=\"resizeHandleLabel\"\n [attr.aria-valuemin]=\"resizeMinWidthPx\"\n [attr.aria-valuemax]=\"resizeMaxWidthPx\"\n [attr.aria-valuenow]=\"resizeCurrentWidthPx\"\n (pointerdown)=\"onResizeHandlePointerDown($event)\"\n (dblclick)=\"onResizeHandleDoubleClick($event)\"\n (keydown)=\"onResizeHandleKeydown($event)\"\n ></div>\n }\n @if (hasHeader) {\n <header class=\"pfx-base-side-panel__header\">\n <div class=\"pfx-base-side-panel__title-block\">\n @if (titleIcon) {\n <mat-icon class=\"pfx-base-side-panel__title-icon\" [praxisIcon]=\"titleIcon\"></mat-icon>\n }\n <div class=\"pfx-base-side-panel__copy\">\n @if (title) {\n <h2 class=\"pfx-base-side-panel__title\" [id]=\"titleId\">{{ title }}</h2>\n }\n @if (subtitle) {\n <p class=\"pfx-base-side-panel__subtitle\">{{ subtitle }}</p>\n }\n </div>\n </div>\n <div class=\"pfx-base-side-panel__actions\">\n @if (showExpandButton) {\n <button\n [praxisIconButton]=\"isExpanded ? 'close_fullscreen' : 'open_in_full'\"\n size=\"compact\"\n type=\"button\"\n class=\"pfx-base-side-panel__expand\"\n [attr.aria-label]=\"expandLabel\"\n [pressed]=\"isExpanded\"\n [matTooltip]=\"expandLabel\"\n (click)=\"toggleExpanded()\"\n ></button>\n }\n <button\n praxisIconButton=\"close\"\n size=\"compact\"\n type=\"button\"\n class=\"pfx-base-side-panel__close\"\n [attr.aria-label]=\"closeLabel\"\n [matTooltip]=\"closeLabel\"\n (click)=\"onClose?.()\"\n ></button>\n </div>\n </header>\n }\n\n <section class=\"pfx-base-side-panel__body\">\n <ng-template #contentHost></ng-template>\n </section>\n\n <footer class=\"pfx-base-side-panel__footer\" [hidden]=\"!hasFooter\">\n <ng-template #footerHost></ng-template>\n </footer>\n</div>\n", styles: [":host{display:block;height:100%;width:100%;min-width:0;flex:1 1 auto}.pfx-base-side-panel{position:relative;display:grid;grid-template-rows:auto 1fr auto;height:100%;min-width:0;max-width:100%;overflow:hidden;background:var(--md-sys-color-surface-container, #fff);color:var(--md-sys-color-on-surface, #111);border-left:1px solid var(--md-sys-color-outline-variant, rgba(0, 0, 0, .12));border-radius:var(--pfx-side-panel-border-radius, 0);box-shadow:var(--pfx-side-panel-elevation, var(--md-sys-elevation-level2, 0 8px 24px rgba(0, 0, 0, .16)));width:min(var(--pfx-side-panel-width, 720px),100%)}.pfx-base-side-panel__resize-handle{position:absolute;inset:0 auto 0 0;width:12px;cursor:col-resize;touch-action:none;z-index:2;outline:none}.pfx-base-side-panel__resize-handle:before{content:\"\";position:absolute;inset:0 auto 0 4px;width:2px;background:transparent;transition:background-color var(--pfx-side-panel-motion-duration, .16s) ease,opacity var(--pfx-side-panel-motion-duration, .16s) ease;opacity:0}.pfx-base-side-panel.is-resizable:hover .pfx-base-side-panel__resize-handle:before,.pfx-base-side-panel__resize-handle:focus-visible:before{opacity:1;background:var(--md-sys-color-outline, rgba(0, 0, 0, .24))}.pfx-base-side-panel.use-host-width,.pfx-base-side-panel.is-expanded{width:100%;max-width:100%}.pfx-base-side-panel.is-resizing{-webkit-user-select:none;user-select:none}.pfx-base-side-panel__actions{display:flex;align-items:center;gap:6px;flex:0 0 auto}.pfx-base-side-panel.width-narrow{width:min(var(--pfx-side-panel-width, 420px),100%)}.pfx-base-side-panel.width-default{width:min(var(--pfx-side-panel-width, 720px),100%)}.pfx-base-side-panel.width-wide{width:min(var(--pfx-side-panel-width, 960px),100%)}.pfx-base-side-panel.width-full{width:min(100vw,var(--pfx-side-panel-max-width, 100vw))}.pfx-base-side-panel__header{display:flex;align-items:center;gap:var(--pfx-side-panel-header-gap, 8px);min-height:var(--pfx-side-panel-header-height, 64px);padding:0 var(--pfx-side-panel-header-padding-x, 16px);border-bottom:1px solid var(--md-sys-color-outline-variant, rgba(0, 0, 0, .12));background:var(--md-sys-color-surface-container-high, #f7f7f7)}.pfx-base-side-panel__title-block{display:flex;align-items:flex-start;gap:10px;min-width:0;flex:1 1 auto}.pfx-base-side-panel__title-icon{color:var(--md-sys-color-primary, currentColor)}.pfx-base-side-panel__copy{min-width:0}.pfx-base-side-panel__title,.pfx-base-side-panel__subtitle{margin:0}.pfx-base-side-panel__title{font-size:1rem;font-weight:600}.pfx-base-side-panel__subtitle{margin-top:4px;color:var(--md-sys-color-on-surface-variant, rgba(0, 0, 0, .64));font-size:.875rem}.pfx-base-side-panel__body{min-height:0;overflow:auto;padding:var(--pfx-side-panel-body-padding, 16px);background:var(--md-sys-color-surface, #fff)}.pfx-base-side-panel__footer{border-top:1px solid var(--md-sys-color-outline-variant, rgba(0, 0, 0, .12));background:var(--md-sys-color-surface-container-high, #f7f7f7);padding:var(--pfx-side-panel-footer-padding, 12px 16px)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: PraxisIconButtonComponent, selector: "button[praxisIconButton]", inputs: ["praxisIconButton", "size", "appearance", "presentation", "pressed", "busy"] }, { kind: "directive", type: PraxisIconDirective, selector: "mat-icon[praxisIcon]", inputs: ["praxisIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2327
2519
|
}
|
|
2328
2520
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: BaseSidePanelComponent, decorators: [{
|
|
2329
2521
|
type: Component,
|
|
@@ -2336,13 +2528,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
|
|
|
2336
2528
|
CdkTrapFocus,
|
|
2337
2529
|
PraxisIconButtonComponent,
|
|
2338
2530
|
PraxisIconDirective,
|
|
2339
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"pfx-base-side-panel\"\n [class.has-header]=\"hasHeader\"\n [class.has-footer]=\"hasFooter\"\n [class.width-narrow]=\"widthClass === 'width-narrow'\"\n [class.width-default]=\"widthClass === 'width-default'\"\n [class.width-wide]=\"widthClass === 'width-wide'\"\n [class.width-full]=\"widthClass === 'width-full'\"\n [class.use-host-width]=\"
|
|
2531
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"pfx-base-side-panel\"\n [class.has-header]=\"hasHeader\"\n [class.has-footer]=\"hasFooter\"\n [class.width-narrow]=\"widthClass === 'width-narrow'\"\n [class.width-default]=\"widthClass === 'width-default'\"\n [class.width-wide]=\"widthClass === 'width-wide'\"\n [class.width-full]=\"widthClass === 'width-full'\"\n [class.use-host-width]=\"tracksHostWidth\"\n [class.is-resizable]=\"showResizeHandle\"\n [class.is-expandable]=\"expandable\"\n [class.is-expanded]=\"isExpanded\"\n [class.is-resizing]=\"isResizing\"\n [ngClass]=\"hostClasses\"\n [ngStyle]=\"mergedHostStyles\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-labelledby]=\"hasHeader ? titleId : null\"\n cdkTrapFocus\n cdkTrapFocusAutoCapture\n>\n @if (showResizeHandle) {\n <div\n class=\"pfx-base-side-panel__resize-handle\"\n role=\"separator\"\n tabindex=\"0\"\n aria-orientation=\"vertical\"\n [attr.aria-label]=\"resizeHandleLabel\"\n [attr.aria-valuemin]=\"resizeMinWidthPx\"\n [attr.aria-valuemax]=\"resizeMaxWidthPx\"\n [attr.aria-valuenow]=\"resizeCurrentWidthPx\"\n (pointerdown)=\"onResizeHandlePointerDown($event)\"\n (dblclick)=\"onResizeHandleDoubleClick($event)\"\n (keydown)=\"onResizeHandleKeydown($event)\"\n ></div>\n }\n @if (hasHeader) {\n <header class=\"pfx-base-side-panel__header\">\n <div class=\"pfx-base-side-panel__title-block\">\n @if (titleIcon) {\n <mat-icon class=\"pfx-base-side-panel__title-icon\" [praxisIcon]=\"titleIcon\"></mat-icon>\n }\n <div class=\"pfx-base-side-panel__copy\">\n @if (title) {\n <h2 class=\"pfx-base-side-panel__title\" [id]=\"titleId\">{{ title }}</h2>\n }\n @if (subtitle) {\n <p class=\"pfx-base-side-panel__subtitle\">{{ subtitle }}</p>\n }\n </div>\n </div>\n <div class=\"pfx-base-side-panel__actions\">\n @if (showExpandButton) {\n <button\n [praxisIconButton]=\"isExpanded ? 'close_fullscreen' : 'open_in_full'\"\n size=\"compact\"\n type=\"button\"\n class=\"pfx-base-side-panel__expand\"\n [attr.aria-label]=\"expandLabel\"\n [pressed]=\"isExpanded\"\n [matTooltip]=\"expandLabel\"\n (click)=\"toggleExpanded()\"\n ></button>\n }\n <button\n praxisIconButton=\"close\"\n size=\"compact\"\n type=\"button\"\n class=\"pfx-base-side-panel__close\"\n [attr.aria-label]=\"closeLabel\"\n [matTooltip]=\"closeLabel\"\n (click)=\"onClose?.()\"\n ></button>\n </div>\n </header>\n }\n\n <section class=\"pfx-base-side-panel__body\">\n <ng-template #contentHost></ng-template>\n </section>\n\n <footer class=\"pfx-base-side-panel__footer\" [hidden]=\"!hasFooter\">\n <ng-template #footerHost></ng-template>\n </footer>\n</div>\n", styles: [":host{display:block;height:100%;width:100%;min-width:0;flex:1 1 auto}.pfx-base-side-panel{position:relative;display:grid;grid-template-rows:auto 1fr auto;height:100%;min-width:0;max-width:100%;overflow:hidden;background:var(--md-sys-color-surface-container, #fff);color:var(--md-sys-color-on-surface, #111);border-left:1px solid var(--md-sys-color-outline-variant, rgba(0, 0, 0, .12));border-radius:var(--pfx-side-panel-border-radius, 0);box-shadow:var(--pfx-side-panel-elevation, var(--md-sys-elevation-level2, 0 8px 24px rgba(0, 0, 0, .16)));width:min(var(--pfx-side-panel-width, 720px),100%)}.pfx-base-side-panel__resize-handle{position:absolute;inset:0 auto 0 0;width:12px;cursor:col-resize;touch-action:none;z-index:2;outline:none}.pfx-base-side-panel__resize-handle:before{content:\"\";position:absolute;inset:0 auto 0 4px;width:2px;background:transparent;transition:background-color var(--pfx-side-panel-motion-duration, .16s) ease,opacity var(--pfx-side-panel-motion-duration, .16s) ease;opacity:0}.pfx-base-side-panel.is-resizable:hover .pfx-base-side-panel__resize-handle:before,.pfx-base-side-panel__resize-handle:focus-visible:before{opacity:1;background:var(--md-sys-color-outline, rgba(0, 0, 0, .24))}.pfx-base-side-panel.use-host-width,.pfx-base-side-panel.is-expanded{width:100%;max-width:100%}.pfx-base-side-panel.is-resizing{-webkit-user-select:none;user-select:none}.pfx-base-side-panel__actions{display:flex;align-items:center;gap:6px;flex:0 0 auto}.pfx-base-side-panel.width-narrow{width:min(var(--pfx-side-panel-width, 420px),100%)}.pfx-base-side-panel.width-default{width:min(var(--pfx-side-panel-width, 720px),100%)}.pfx-base-side-panel.width-wide{width:min(var(--pfx-side-panel-width, 960px),100%)}.pfx-base-side-panel.width-full{width:min(100vw,var(--pfx-side-panel-max-width, 100vw))}.pfx-base-side-panel__header{display:flex;align-items:center;gap:var(--pfx-side-panel-header-gap, 8px);min-height:var(--pfx-side-panel-header-height, 64px);padding:0 var(--pfx-side-panel-header-padding-x, 16px);border-bottom:1px solid var(--md-sys-color-outline-variant, rgba(0, 0, 0, .12));background:var(--md-sys-color-surface-container-high, #f7f7f7)}.pfx-base-side-panel__title-block{display:flex;align-items:flex-start;gap:10px;min-width:0;flex:1 1 auto}.pfx-base-side-panel__title-icon{color:var(--md-sys-color-primary, currentColor)}.pfx-base-side-panel__copy{min-width:0}.pfx-base-side-panel__title,.pfx-base-side-panel__subtitle{margin:0}.pfx-base-side-panel__title{font-size:1rem;font-weight:600}.pfx-base-side-panel__subtitle{margin-top:4px;color:var(--md-sys-color-on-surface-variant, rgba(0, 0, 0, .64));font-size:.875rem}.pfx-base-side-panel__body{min-height:0;overflow:auto;padding:var(--pfx-side-panel-body-padding, 16px);background:var(--md-sys-color-surface, #fff)}.pfx-base-side-panel__footer{border-top:1px solid var(--md-sys-color-outline-variant, rgba(0, 0, 0, .12));background:var(--md-sys-color-surface-container-high, #f7f7f7);padding:var(--pfx-side-panel-footer-padding, 12px 16px)}\n"] }]
|
|
2340
2532
|
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i1$2.PraxisI18nService }], propDecorators: { contentHost: [{
|
|
2341
2533
|
type: ViewChild,
|
|
2342
2534
|
args: ['contentHost', { read: ViewContainerRef, static: true }]
|
|
2343
2535
|
}], footerHost: [{
|
|
2344
2536
|
type: ViewChild,
|
|
2345
2537
|
args: ['footerHost', { read: ViewContainerRef, static: true }]
|
|
2538
|
+
}], onWindowResize: [{
|
|
2539
|
+
type: HostListener,
|
|
2540
|
+
args: ['window:resize']
|
|
2346
2541
|
}], onDocumentPointerMove: [{
|
|
2347
2542
|
type: HostListener,
|
|
2348
2543
|
args: ['document:pointermove', ['$event']]
|
|
@@ -2361,6 +2556,7 @@ class BaseSidePanelOverlayRef {
|
|
|
2361
2556
|
overlayRef;
|
|
2362
2557
|
titleUpdater;
|
|
2363
2558
|
sizePersistor;
|
|
2559
|
+
expandController;
|
|
2364
2560
|
terminalOutcomeEmitted = false;
|
|
2365
2561
|
closed$ = this.closedSubject.asObservable();
|
|
2366
2562
|
result$ = this.resultSubject.asObservable();
|
|
@@ -2374,6 +2570,15 @@ class BaseSidePanelOverlayRef {
|
|
|
2374
2570
|
bindSizePersistor(fn) {
|
|
2375
2571
|
this.sizePersistor = fn;
|
|
2376
2572
|
}
|
|
2573
|
+
bindExpandController(controller) {
|
|
2574
|
+
this.expandController = controller;
|
|
2575
|
+
}
|
|
2576
|
+
setExpanded(expanded) {
|
|
2577
|
+
this.expandController?.setExpanded(expanded);
|
|
2578
|
+
}
|
|
2579
|
+
toggleExpanded() {
|
|
2580
|
+
this.expandController?.toggleExpanded();
|
|
2581
|
+
}
|
|
2377
2582
|
emitResult(result) {
|
|
2378
2583
|
this.resultSubject.next(result);
|
|
2379
2584
|
}
|
|
@@ -2388,7 +2593,7 @@ class BaseSidePanelOverlayRef {
|
|
|
2388
2593
|
updateTitle(title) {
|
|
2389
2594
|
this.titleUpdater?.(title);
|
|
2390
2595
|
}
|
|
2391
|
-
updateSize(size) {
|
|
2596
|
+
updateSize(size, options) {
|
|
2392
2597
|
if (!this.overlayRef) {
|
|
2393
2598
|
return;
|
|
2394
2599
|
}
|
|
@@ -2399,7 +2604,9 @@ class BaseSidePanelOverlayRef {
|
|
|
2399
2604
|
return;
|
|
2400
2605
|
}
|
|
2401
2606
|
this.overlayRef.updateSize({ width });
|
|
2402
|
-
|
|
2607
|
+
if (options?.persist !== false) {
|
|
2608
|
+
this.sizePersistor?.(width);
|
|
2609
|
+
}
|
|
2403
2610
|
this.sizeChangedSubject.next({ width });
|
|
2404
2611
|
}
|
|
2405
2612
|
close(result) {
|
|
@@ -2414,18 +2621,14 @@ class BaseSidePanelOverlayRef {
|
|
|
2414
2621
|
this.sizeChangedSubject.complete();
|
|
2415
2622
|
}
|
|
2416
2623
|
resolveWidth(preset) {
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
return '100vw';
|
|
2424
|
-
case 'default':
|
|
2425
|
-
return '720px';
|
|
2426
|
-
default:
|
|
2427
|
-
return preset;
|
|
2624
|
+
const trimmed = preset.trim();
|
|
2625
|
+
if (trimmed === 'narrow' ||
|
|
2626
|
+
trimmed === 'default' ||
|
|
2627
|
+
trimmed === 'wide' ||
|
|
2628
|
+
trimmed === 'full') {
|
|
2629
|
+
return resolveSidePanelPresetWidth(trimmed);
|
|
2428
2630
|
}
|
|
2631
|
+
return trimmed;
|
|
2429
2632
|
}
|
|
2430
2633
|
}
|
|
2431
2634
|
|
|
@@ -2458,13 +2661,22 @@ class BaseSidePanelService {
|
|
|
2458
2661
|
panelRef.instance.minWidth = resolvedConfig.minWidth;
|
|
2459
2662
|
panelRef.instance.maxWidth = resolvedConfig.maxWidth;
|
|
2460
2663
|
panelRef.instance.resizable = resolvedConfig.resizable ?? false;
|
|
2664
|
+
panelRef.instance.expandable = resolvedConfig.expandable ?? false;
|
|
2461
2665
|
panelRef.instance.resizeAxis = resolvedConfig.resizeAxis ?? 'x';
|
|
2462
2666
|
panelRef.instance.persistSizeKey = resolvedConfig.persistSizeKey;
|
|
2463
|
-
panelRef.instance.useHostWidth =
|
|
2667
|
+
panelRef.instance.useHostWidth = !!(resolvedConfig.width ||
|
|
2668
|
+
resolvedConfig.minWidth ||
|
|
2669
|
+
resolvedConfig.maxWidth ||
|
|
2670
|
+
resolvedConfig.resizable ||
|
|
2671
|
+
resolvedConfig.expandable);
|
|
2464
2672
|
panelRef.instance.theme = resolvedConfig.theme ?? null;
|
|
2465
2673
|
panelRef.instance.onClose = () => ref.close(this.closeResult('close'));
|
|
2466
|
-
panelRef.instance.onResizeWidth = (width) => ref.updateSize?.({ width });
|
|
2674
|
+
panelRef.instance.onResizeWidth = (width, resizeOptions) => ref.updateSize?.({ width }, resizeOptions);
|
|
2467
2675
|
ref.bindTitleUpdater((title) => panelRef.instance.setTitle(title));
|
|
2676
|
+
ref.bindExpandController({
|
|
2677
|
+
setExpanded: (expanded) => panelRef.instance.setExpanded(expanded),
|
|
2678
|
+
toggleExpanded: () => panelRef.instance.toggleExpanded(),
|
|
2679
|
+
});
|
|
2468
2680
|
const contentInjector = Injector.create({
|
|
2469
2681
|
providers: [
|
|
2470
2682
|
{ provide: BASE_SIDE_PANEL_DATA, useValue: resolvedConfig.content.inputs },
|
|
@@ -2498,7 +2710,12 @@ class BaseSidePanelService {
|
|
|
2498
2710
|
const panelRef = overlayRef.attach(new ComponentPortal(options.component));
|
|
2499
2711
|
options.attach(panelRef, ref, resolvedConfig);
|
|
2500
2712
|
if (options.config.closeOnBackdrop !== false) {
|
|
2501
|
-
overlayRef.backdropClick().subscribe(() =>
|
|
2713
|
+
overlayRef.backdropClick().subscribe(() => {
|
|
2714
|
+
if (panelRef.instance?.shouldSuppressBackdropClose?.()) {
|
|
2715
|
+
return;
|
|
2716
|
+
}
|
|
2717
|
+
options.onBackdrop(ref);
|
|
2718
|
+
});
|
|
2502
2719
|
}
|
|
2503
2720
|
// Keep this pane in CDK keyboard arbitration even when its content mediates
|
|
2504
2721
|
// Escape. Otherwise CDK dispatches to an older menu during its exit animation.
|
|
@@ -2548,54 +2765,32 @@ class BaseSidePanelService {
|
|
|
2548
2765
|
return `min(${normalized}, 100vw)`;
|
|
2549
2766
|
}
|
|
2550
2767
|
resolveWidth(preset) {
|
|
2551
|
-
|
|
2552
|
-
case 'narrow':
|
|
2553
|
-
return '420px';
|
|
2554
|
-
case 'wide':
|
|
2555
|
-
return '960px';
|
|
2556
|
-
case 'full':
|
|
2557
|
-
return '100vw';
|
|
2558
|
-
case 'default':
|
|
2559
|
-
default:
|
|
2560
|
-
return '720px';
|
|
2561
|
-
}
|
|
2768
|
+
return resolveSidePanelPresetWidth(preset);
|
|
2562
2769
|
}
|
|
2563
2770
|
resolveOpenConfig(config) {
|
|
2564
2771
|
const persistedWidth = this.resolvePersistedWidth(config.persistSizeKey);
|
|
2565
2772
|
if (!persistedWidth) {
|
|
2566
2773
|
return config;
|
|
2567
2774
|
}
|
|
2775
|
+
const viewportWidth = resolveSidePanelViewportWidth();
|
|
2776
|
+
const parsedWidth = parseSidePanelWidthPx(persistedWidth, viewportWidth);
|
|
2777
|
+
const effectiveWidth = parsedWidth !== null
|
|
2778
|
+
? `${clampSidePanelWidthPx(parsedWidth, {
|
|
2779
|
+
minWidth: config.minWidth,
|
|
2780
|
+
maxWidth: config.maxWidth,
|
|
2781
|
+
viewportWidth,
|
|
2782
|
+
})}px`
|
|
2783
|
+
: persistedWidth;
|
|
2568
2784
|
return {
|
|
2569
2785
|
...config,
|
|
2570
|
-
width:
|
|
2786
|
+
width: effectiveWidth,
|
|
2571
2787
|
};
|
|
2572
2788
|
}
|
|
2573
2789
|
resolvePersistedWidth(persistSizeKey) {
|
|
2574
|
-
|
|
2575
|
-
return undefined;
|
|
2576
|
-
}
|
|
2577
|
-
try {
|
|
2578
|
-
const value = localStorage.getItem(this.storageKey(persistSizeKey));
|
|
2579
|
-
return this.isPixelWidth(value) ? value ?? undefined : undefined;
|
|
2580
|
-
}
|
|
2581
|
-
catch {
|
|
2582
|
-
return undefined;
|
|
2583
|
-
}
|
|
2790
|
+
return readPersistedSidePanelWidth(persistSizeKey);
|
|
2584
2791
|
}
|
|
2585
2792
|
persistWidth(persistSizeKey, width) {
|
|
2586
|
-
|
|
2587
|
-
return;
|
|
2588
|
-
}
|
|
2589
|
-
try {
|
|
2590
|
-
localStorage.setItem(this.storageKey(persistSizeKey), width);
|
|
2591
|
-
}
|
|
2592
|
-
catch { }
|
|
2593
|
-
}
|
|
2594
|
-
storageKey(persistSizeKey) {
|
|
2595
|
-
return `praxis.side-panel.width:${persistSizeKey}`;
|
|
2596
|
-
}
|
|
2597
|
-
isPixelWidth(value) {
|
|
2598
|
-
return !!value && /^\d+(\.\d+)?px$/i.test(value.trim());
|
|
2793
|
+
writePersistedSidePanelWidth(persistSizeKey, width);
|
|
2599
2794
|
}
|
|
2600
2795
|
shouldDeferEscape(event, overlayRef) {
|
|
2601
2796
|
if (event.defaultPrevented) {
|
|
@@ -2902,10 +3097,20 @@ class SurfaceDrawerComponent {
|
|
|
2902
3097
|
titleIcon;
|
|
2903
3098
|
subtitle;
|
|
2904
3099
|
widthPreset = 'default';
|
|
3100
|
+
width;
|
|
3101
|
+
minWidth;
|
|
3102
|
+
maxWidth;
|
|
3103
|
+
resizable = false;
|
|
3104
|
+
expandable = false;
|
|
3105
|
+
resizeAxis = 'x';
|
|
3106
|
+
persistSizeKey;
|
|
2905
3107
|
useHostWidth = false;
|
|
3108
|
+
isExpanded = false;
|
|
3109
|
+
isResizing = false;
|
|
2906
3110
|
theme = null;
|
|
2907
3111
|
onClose;
|
|
2908
3112
|
onBack;
|
|
3113
|
+
onResizeWidth;
|
|
2909
3114
|
static nextId = 0;
|
|
2910
3115
|
titleId = `praxis-surface-drawer-title-${SurfaceDrawerComponent.nextId++}`;
|
|
2911
3116
|
subtitleId = `${this.titleId}-description`;
|
|
@@ -2914,6 +3119,12 @@ class SurfaceDrawerComponent {
|
|
|
2914
3119
|
body;
|
|
2915
3120
|
backButton;
|
|
2916
3121
|
frames = [];
|
|
3122
|
+
activePointerId = null;
|
|
3123
|
+
dragStartX = 0;
|
|
3124
|
+
dragStartWidth = 0;
|
|
3125
|
+
collapsedWidthBeforeExpand = null;
|
|
3126
|
+
suppressNextBackdropClick = false;
|
|
3127
|
+
backdropSuppressTimer = null;
|
|
2917
3128
|
constructor(cdr, i18n) {
|
|
2918
3129
|
this.cdr = cdr;
|
|
2919
3130
|
this.i18n = i18n;
|
|
@@ -2948,12 +3159,250 @@ class SurfaceDrawerComponent {
|
|
|
2948
3159
|
get hasHeader() {
|
|
2949
3160
|
return !!(this.title || this.titleIcon || this.subtitle);
|
|
2950
3161
|
}
|
|
3162
|
+
get tracksHostWidth() {
|
|
3163
|
+
return (this.useHostWidth ||
|
|
3164
|
+
this.resizable ||
|
|
3165
|
+
this.expandable ||
|
|
3166
|
+
this.isExpanded ||
|
|
3167
|
+
Boolean(this.width));
|
|
3168
|
+
}
|
|
3169
|
+
get showResizeHandle() {
|
|
3170
|
+
return (this.resizable &&
|
|
3171
|
+
this.resizeAxis === 'x' &&
|
|
3172
|
+
resolveSidePanelViewportWidth() > 640);
|
|
3173
|
+
}
|
|
3174
|
+
get showExpandButton() {
|
|
3175
|
+
if (!this.expandable) {
|
|
3176
|
+
return false;
|
|
3177
|
+
}
|
|
3178
|
+
if (this.isExpanded) {
|
|
3179
|
+
return true;
|
|
3180
|
+
}
|
|
3181
|
+
const viewportWidth = resolveSidePanelViewportWidth();
|
|
3182
|
+
return canExpandSidePanel(this.getCurrentWidthPx(viewportWidth), viewportWidth, { maxWidth: this.maxWidth });
|
|
3183
|
+
}
|
|
3184
|
+
get expandLabel() {
|
|
3185
|
+
const isEn = this.i18n.getLocale().toLowerCase().startsWith('en');
|
|
3186
|
+
if (this.isExpanded) {
|
|
3187
|
+
return this.i18n.t('Collapse panel', undefined, isEn ? 'Collapse panel' : 'Reduzir painel', PRAXIS_SETTINGS_PANEL_I18N_NAMESPACE);
|
|
3188
|
+
}
|
|
3189
|
+
return this.i18n.t('Expand panel', undefined, isEn ? 'Expand panel' : 'Expandir painel', PRAXIS_SETTINGS_PANEL_I18N_NAMESPACE);
|
|
3190
|
+
}
|
|
3191
|
+
get resizeHandleLabel() {
|
|
3192
|
+
const fallback = this.i18n.getLocale().toLowerCase().startsWith('en')
|
|
3193
|
+
? 'Resize panel'
|
|
3194
|
+
: 'Redimensionar painel';
|
|
3195
|
+
return this.i18n.t('Resize panel', undefined, fallback, PRAXIS_SETTINGS_PANEL_I18N_NAMESPACE);
|
|
3196
|
+
}
|
|
3197
|
+
get resizeMinWidthPx() {
|
|
3198
|
+
const viewportWidth = resolveSidePanelViewportWidth();
|
|
3199
|
+
return clampSidePanelWidthPx(0, {
|
|
3200
|
+
minWidth: this.minWidth,
|
|
3201
|
+
maxWidth: this.maxWidth,
|
|
3202
|
+
viewportWidth,
|
|
3203
|
+
});
|
|
3204
|
+
}
|
|
3205
|
+
get resizeMaxWidthPx() {
|
|
3206
|
+
const viewportWidth = resolveSidePanelViewportWidth();
|
|
3207
|
+
return clampSidePanelWidthPx(viewportWidth, {
|
|
3208
|
+
minWidth: this.minWidth,
|
|
3209
|
+
maxWidth: this.maxWidth,
|
|
3210
|
+
viewportWidth,
|
|
3211
|
+
});
|
|
3212
|
+
}
|
|
3213
|
+
get resizeCurrentWidthPx() {
|
|
3214
|
+
return this.getCurrentWidthPx();
|
|
3215
|
+
}
|
|
2951
3216
|
get widthClass() {
|
|
2952
|
-
if (this.
|
|
3217
|
+
if (this.tracksHostWidth) {
|
|
2953
3218
|
return null;
|
|
2954
3219
|
}
|
|
2955
3220
|
return `width-${this.widthPreset}`;
|
|
2956
3221
|
}
|
|
3222
|
+
syncHostWidth(width) {
|
|
3223
|
+
this.width = width;
|
|
3224
|
+
this.cdr.markForCheck();
|
|
3225
|
+
}
|
|
3226
|
+
syncCollapsedWidth(width) {
|
|
3227
|
+
this.collapsedWidthBeforeExpand = width;
|
|
3228
|
+
}
|
|
3229
|
+
onWindowResize() {
|
|
3230
|
+
const viewportWidth = resolveSidePanelViewportWidth();
|
|
3231
|
+
if (this.isExpanded) {
|
|
3232
|
+
const expandedPx = resolveExpandedSidePanelWidthPx(viewportWidth, {
|
|
3233
|
+
maxWidth: this.maxWidth,
|
|
3234
|
+
});
|
|
3235
|
+
const nextWidth = `${expandedPx}px`;
|
|
3236
|
+
if (nextWidth !== this.width) {
|
|
3237
|
+
this.width = nextWidth;
|
|
3238
|
+
this.onResizeWidth?.(nextWidth, { persist: false });
|
|
3239
|
+
}
|
|
3240
|
+
this.cdr.markForCheck();
|
|
3241
|
+
return;
|
|
3242
|
+
}
|
|
3243
|
+
const parsedWidth = parseSidePanelWidthPx(this.width, viewportWidth);
|
|
3244
|
+
if (parsedWidth !== null) {
|
|
3245
|
+
const clamped = clampSidePanelWidthPx(parsedWidth, {
|
|
3246
|
+
minWidth: this.minWidth,
|
|
3247
|
+
maxWidth: this.maxWidth,
|
|
3248
|
+
viewportWidth,
|
|
3249
|
+
});
|
|
3250
|
+
const nextWidth = `${clamped}px`;
|
|
3251
|
+
if (parsedWidth > clamped && nextWidth !== this.width) {
|
|
3252
|
+
this.width = nextWidth;
|
|
3253
|
+
this.onResizeWidth?.(nextWidth, { persist: false });
|
|
3254
|
+
}
|
|
3255
|
+
}
|
|
3256
|
+
this.cdr.markForCheck();
|
|
3257
|
+
}
|
|
3258
|
+
setExpanded(expanded) {
|
|
3259
|
+
if (!this.expandable || expanded === this.isExpanded) {
|
|
3260
|
+
return;
|
|
3261
|
+
}
|
|
3262
|
+
const viewportWidth = resolveSidePanelViewportWidth();
|
|
3263
|
+
if (expanded) {
|
|
3264
|
+
const currentPx = this.getCurrentWidthPx(viewportWidth);
|
|
3265
|
+
if (!canExpandSidePanel(currentPx, viewportWidth, {
|
|
3266
|
+
maxWidth: this.maxWidth,
|
|
3267
|
+
})) {
|
|
3268
|
+
return;
|
|
3269
|
+
}
|
|
3270
|
+
this.collapsedWidthBeforeExpand =
|
|
3271
|
+
this.width ?? resolveSidePanelPresetWidth(this.widthPreset);
|
|
3272
|
+
const expandedPx = resolveExpandedSidePanelWidthPx(viewportWidth, {
|
|
3273
|
+
maxWidth: this.maxWidth,
|
|
3274
|
+
});
|
|
3275
|
+
const nextWidth = `${expandedPx}px`;
|
|
3276
|
+
this.isExpanded = true;
|
|
3277
|
+
this.width = nextWidth;
|
|
3278
|
+
this.onResizeWidth?.(nextWidth, { persist: false });
|
|
3279
|
+
this.cdr.markForCheck();
|
|
3280
|
+
return;
|
|
3281
|
+
}
|
|
3282
|
+
const rawRestoreWidth = this.collapsedWidthBeforeExpand ??
|
|
3283
|
+
resolveSidePanelPresetWidth(this.widthPreset);
|
|
3284
|
+
const parsedRestore = parseSidePanelWidthPx(rawRestoreWidth, viewportWidth);
|
|
3285
|
+
const clampedRestore = parsedRestore !== null
|
|
3286
|
+
? clampSidePanelWidthPx(parsedRestore, {
|
|
3287
|
+
minWidth: this.minWidth,
|
|
3288
|
+
maxWidth: this.maxWidth,
|
|
3289
|
+
viewportWidth,
|
|
3290
|
+
})
|
|
3291
|
+
: null;
|
|
3292
|
+
const restoreWidth = parsedRestore !== null &&
|
|
3293
|
+
clampedRestore !== null &&
|
|
3294
|
+
parsedRestore > clampedRestore
|
|
3295
|
+
? `${clampedRestore}px`
|
|
3296
|
+
: rawRestoreWidth;
|
|
3297
|
+
this.collapsedWidthBeforeExpand = null;
|
|
3298
|
+
this.isExpanded = false;
|
|
3299
|
+
this.width = restoreWidth;
|
|
3300
|
+
this.onResizeWidth?.(restoreWidth, { persist: false });
|
|
3301
|
+
this.cdr.markForCheck();
|
|
3302
|
+
}
|
|
3303
|
+
shouldSuppressBackdropClose() {
|
|
3304
|
+
if (this.isResizing) {
|
|
3305
|
+
return true;
|
|
3306
|
+
}
|
|
3307
|
+
if (this.suppressNextBackdropClick) {
|
|
3308
|
+
this.suppressNextBackdropClick = false;
|
|
3309
|
+
return true;
|
|
3310
|
+
}
|
|
3311
|
+
return false;
|
|
3312
|
+
}
|
|
3313
|
+
toggleExpanded() {
|
|
3314
|
+
this.setExpanded(!this.isExpanded);
|
|
3315
|
+
}
|
|
3316
|
+
onResizeHandlePointerDown(event) {
|
|
3317
|
+
if (!this.showResizeHandle || event.button !== 0) {
|
|
3318
|
+
return;
|
|
3319
|
+
}
|
|
3320
|
+
const viewportWidth = resolveSidePanelViewportWidth();
|
|
3321
|
+
const currentWidth = this.promoteExpandedWidthBeforeManualResize(viewportWidth);
|
|
3322
|
+
this.activePointerId = event.pointerId;
|
|
3323
|
+
this.isResizing = true;
|
|
3324
|
+
this.dragStartX = event.clientX;
|
|
3325
|
+
this.dragStartWidth = currentWidth;
|
|
3326
|
+
const target = event.currentTarget;
|
|
3327
|
+
try {
|
|
3328
|
+
target?.setPointerCapture(event.pointerId);
|
|
3329
|
+
}
|
|
3330
|
+
catch { }
|
|
3331
|
+
this.cdr.markForCheck();
|
|
3332
|
+
event.preventDefault();
|
|
3333
|
+
}
|
|
3334
|
+
onResizeHandleDoubleClick(event) {
|
|
3335
|
+
if (!this.showResizeHandle) {
|
|
3336
|
+
return;
|
|
3337
|
+
}
|
|
3338
|
+
event.preventDefault();
|
|
3339
|
+
if (this.isExpanded) {
|
|
3340
|
+
this.setExpanded(false);
|
|
3341
|
+
return;
|
|
3342
|
+
}
|
|
3343
|
+
const viewportWidth = resolveSidePanelViewportWidth();
|
|
3344
|
+
const currentWidth = this.getCurrentWidthPx(viewportWidth);
|
|
3345
|
+
const targetWidth = currentWidth < 840 ? 960 : 720;
|
|
3346
|
+
this.applyWidthPx(targetWidth, viewportWidth);
|
|
3347
|
+
}
|
|
3348
|
+
onResizeHandleKeydown(event) {
|
|
3349
|
+
if (!this.showResizeHandle) {
|
|
3350
|
+
return;
|
|
3351
|
+
}
|
|
3352
|
+
const viewportWidth = resolveSidePanelViewportWidth();
|
|
3353
|
+
const step = event.shiftKey ? 80 : 40;
|
|
3354
|
+
switch (event.key) {
|
|
3355
|
+
case 'ArrowLeft': {
|
|
3356
|
+
const currentWidth = this.promoteExpandedWidthBeforeManualResize(viewportWidth);
|
|
3357
|
+
this.applyWidthPx(currentWidth + step, viewportWidth);
|
|
3358
|
+
event.preventDefault();
|
|
3359
|
+
return;
|
|
3360
|
+
}
|
|
3361
|
+
case 'ArrowRight': {
|
|
3362
|
+
const currentWidth = this.promoteExpandedWidthBeforeManualResize(viewportWidth);
|
|
3363
|
+
this.applyWidthPx(currentWidth - step, viewportWidth);
|
|
3364
|
+
event.preventDefault();
|
|
3365
|
+
return;
|
|
3366
|
+
}
|
|
3367
|
+
case 'Home': {
|
|
3368
|
+
this.promoteExpandedWidthBeforeManualResize(viewportWidth);
|
|
3369
|
+
const minPx = clampSidePanelWidthPx(0, {
|
|
3370
|
+
minWidth: this.minWidth,
|
|
3371
|
+
maxWidth: this.maxWidth,
|
|
3372
|
+
viewportWidth,
|
|
3373
|
+
});
|
|
3374
|
+
this.applyWidthPx(minPx, viewportWidth);
|
|
3375
|
+
event.preventDefault();
|
|
3376
|
+
return;
|
|
3377
|
+
}
|
|
3378
|
+
case 'End': {
|
|
3379
|
+
this.promoteExpandedWidthBeforeManualResize(viewportWidth);
|
|
3380
|
+
const maxPx = clampSidePanelWidthPx(viewportWidth, {
|
|
3381
|
+
minWidth: this.minWidth,
|
|
3382
|
+
maxWidth: this.maxWidth,
|
|
3383
|
+
viewportWidth,
|
|
3384
|
+
});
|
|
3385
|
+
this.applyWidthPx(maxPx, viewportWidth);
|
|
3386
|
+
event.preventDefault();
|
|
3387
|
+
return;
|
|
3388
|
+
}
|
|
3389
|
+
default:
|
|
3390
|
+
return;
|
|
3391
|
+
}
|
|
3392
|
+
}
|
|
3393
|
+
onDocumentPointerMove(event) {
|
|
3394
|
+
if (event.pointerId !== this.activePointerId) {
|
|
3395
|
+
return;
|
|
3396
|
+
}
|
|
3397
|
+
const deltaX = this.dragStartX - event.clientX;
|
|
3398
|
+
this.applyWidthPx(this.dragStartWidth + deltaX);
|
|
3399
|
+
}
|
|
3400
|
+
onDocumentPointerEnd(event) {
|
|
3401
|
+
if (event.pointerId !== this.activePointerId) {
|
|
3402
|
+
return;
|
|
3403
|
+
}
|
|
3404
|
+
this.stopResizeSession(true);
|
|
3405
|
+
}
|
|
2957
3406
|
setTitle(title) {
|
|
2958
3407
|
this.title = title;
|
|
2959
3408
|
const active = this.frames[this.frames.length - 1];
|
|
@@ -2963,6 +3412,11 @@ class SurfaceDrawerComponent {
|
|
|
2963
3412
|
this.cdr.markForCheck();
|
|
2964
3413
|
}
|
|
2965
3414
|
ngOnDestroy() {
|
|
3415
|
+
if (this.backdropSuppressTimer !== null) {
|
|
3416
|
+
clearTimeout(this.backdropSuppressTimer);
|
|
3417
|
+
this.backdropSuppressTimer = null;
|
|
3418
|
+
}
|
|
3419
|
+
this.stopResizeSession(false);
|
|
2966
3420
|
for (const frame of this.frames) {
|
|
2967
3421
|
if (!frame.componentRef.hostView.destroyed) {
|
|
2968
3422
|
frame.componentRef.destroy();
|
|
@@ -3146,8 +3600,53 @@ class SurfaceDrawerComponent {
|
|
|
3146
3600
|
}
|
|
3147
3601
|
return new Set(Object.keys(declaredInputs));
|
|
3148
3602
|
}
|
|
3603
|
+
promoteExpandedWidthBeforeManualResize(viewportWidth) {
|
|
3604
|
+
const currentWidth = this.getCurrentWidthPx(viewportWidth);
|
|
3605
|
+
if (this.isExpanded) {
|
|
3606
|
+
this.isExpanded = false;
|
|
3607
|
+
this.collapsedWidthBeforeExpand = null;
|
|
3608
|
+
this.width = `${currentWidth}px`;
|
|
3609
|
+
this.cdr.markForCheck();
|
|
3610
|
+
}
|
|
3611
|
+
return currentWidth;
|
|
3612
|
+
}
|
|
3613
|
+
getCurrentWidthPx(viewportWidth = resolveSidePanelViewportWidth()) {
|
|
3614
|
+
const parsed = parseSidePanelWidthPx(this.width, viewportWidth);
|
|
3615
|
+
if (parsed !== null) {
|
|
3616
|
+
return Math.round(parsed);
|
|
3617
|
+
}
|
|
3618
|
+
return Math.round(resolveSidePanelPresetWidthPx(this.widthPreset, viewportWidth));
|
|
3619
|
+
}
|
|
3620
|
+
applyWidthPx(value, viewportWidth = resolveSidePanelViewportWidth()) {
|
|
3621
|
+
const clampedWidth = clampSidePanelWidthPx(value, {
|
|
3622
|
+
minWidth: this.minWidth,
|
|
3623
|
+
maxWidth: this.maxWidth,
|
|
3624
|
+
viewportWidth,
|
|
3625
|
+
});
|
|
3626
|
+
const nextWidth = `${clampedWidth}px`;
|
|
3627
|
+
this.width = nextWidth;
|
|
3628
|
+
this.onResizeWidth?.(nextWidth, { persist: true });
|
|
3629
|
+
this.cdr.markForCheck();
|
|
3630
|
+
}
|
|
3631
|
+
stopResizeSession(suppressBackdropClick = false) {
|
|
3632
|
+
if (this.activePointerId !== null || this.isResizing) {
|
|
3633
|
+
this.activePointerId = null;
|
|
3634
|
+
this.isResizing = false;
|
|
3635
|
+
if (suppressBackdropClick) {
|
|
3636
|
+
this.suppressNextBackdropClick = true;
|
|
3637
|
+
if (this.backdropSuppressTimer !== null) {
|
|
3638
|
+
clearTimeout(this.backdropSuppressTimer);
|
|
3639
|
+
}
|
|
3640
|
+
this.backdropSuppressTimer = setTimeout(() => {
|
|
3641
|
+
this.backdropSuppressTimer = null;
|
|
3642
|
+
this.suppressNextBackdropClick = false;
|
|
3643
|
+
}, 0);
|
|
3644
|
+
}
|
|
3645
|
+
this.cdr.markForCheck();
|
|
3646
|
+
}
|
|
3647
|
+
}
|
|
3149
3648
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: SurfaceDrawerComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1$2.PraxisI18nService }], target: i0.ɵɵFactoryTarget.Component });
|
|
3150
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.14", type: SurfaceDrawerComponent, isStandalone: true, selector: "praxis-surface-drawer", viewQueries: [{ propertyName: "contentHost", first: true, predicate: ["contentHost"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "body", first: true, predicate: ["body"], descendants: true, read: ElementRef }, { propertyName: "backButton", first: true, predicate: ["backButton"], descendants: true, read: ElementRef }], ngImport: i0, template: "<div\n class=\"pfx-surface-drawer\"\n [class.has-header]=\"hasHeader\"\n [class.width-narrow]=\"widthClass === 'width-narrow'\"\n [class.width-default]=\"widthClass === 'width-default'\"\n [class.width-wide]=\"widthClass === 'width-wide'\"\n [class.width-full]=\"widthClass === 'width-full'\"\n [class.use-host-width]=\"useHostWidth\"\n [ngClass]=\"hostClasses\"\n [ngStyle]=\"hostCssVars\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-labelledby]=\"hasHeader ? titleId : null\"\n [attr.aria-describedby]=\"subtitle ? subtitleId : null\"\n cdkTrapFocus\n cdkTrapFocusAutoCapture\n>\n @if (hasHeader) {\n <header class=\"pfx-surface-drawer__header\">\n @if (canGoBack) {\n <button\n #backButton\n praxisIconButton=\"arrow_back\"\n size=\"compact\"\n type=\"button\"\n class=\"pfx-surface-drawer__back\"\n [attr.aria-label]=\"backLabel\"\n [matTooltip]=\"backLabel\"\n (click)=\"onBack?.()\"\n ></button>\n }\n <div class=\"pfx-surface-drawer__title-block\">\n @if (titleIcon) {\n <mat-icon class=\"pfx-surface-drawer__title-icon\" [praxisIcon]=\"titleIcon\"></mat-icon>\n }\n <div class=\"pfx-surface-drawer__copy\">\n @if (title) {\n <h2 class=\"pfx-surface-drawer__title\" [id]=\"titleId\" tabindex=\"-1\" cdkFocusInitial>{{ title }}</h2>\n }\n @if (subtitle) {\n <p class=\"pfx-surface-drawer__subtitle\" [id]=\"subtitleId\">{{ subtitle }}</p>\n }\n </div>\n </div>\n <button\n praxisIconButton=\"close\"\n size=\"compact\"\n type=\"button\"\n class=\"pfx-surface-drawer__close\"\n [attr.aria-label]=\"closeLabel\"\n [matTooltip]=\"closeLabel\"\n (click)=\"onClose?.()\"\n ></button>\n </header>\n }\n\n <section #body class=\"pfx-surface-drawer__body\">\n <ng-template #contentHost></ng-template>\n </section>\n</div>\n", styles: [":host{display:block;height:100%;width:100%;min-width:0;flex:1 1 auto}.pfx-surface-drawer{display:grid;grid-template-rows:auto 1fr;height:100%;min-width:0;max-width:100%;overflow:hidden;background:var(--md-sys-color-surface-container, var(--mat-sys-surface-container));color:var(--md-sys-color-on-surface, var(--mat-sys-on-surface));border-left:1px solid var(--md-sys-color-outline-variant, var(--mat-sys-outline-variant));border-radius:var(--pfx-side-panel-border-radius, 0);box-shadow:var(--pfx-side-panel-elevation, var(--md-sys-elevation-level2, 0 8px 24px rgba(0, 0, 0, .16)));width:var(--pfx-side-panel-width, 720px);transition:width var(--pfx-side-panel-motion-duration-enter, .22s) var(--pfx-side-panel-motion-easing-enter, cubic-bezier(.2, 0, 0, 1)),box-shadow var(--pfx-side-panel-motion-duration-enter, .22s) var(--pfx-side-panel-motion-easing-enter, cubic-bezier(.2, 0, 0, 1))}.pfx-surface-drawer.use-host-width{width:100%;max-width:100%}.pfx-surface-drawer.width-narrow{width:var(--pfx-side-panel-width, 420px)}.pfx-surface-drawer.width-default{width:var(--pfx-side-panel-width, 720px)}.pfx-surface-drawer.width-wide{width:var(--pfx-side-panel-width, 960px)}.pfx-surface-drawer.width-full{width:min(100vw,var(--pfx-side-panel-max-width, 100vw))}.pfx-surface-drawer__header{display:flex;align-items:flex-start;gap:var(--pfx-side-panel-header-gap, 12px);min-height:var(--pfx-side-panel-header-height, 64px);padding:var(--pfx-side-panel-header-padding-y, 16px) var(--pfx-side-panel-header-padding-x, 20px);box-sizing:border-box;border-bottom:1px solid var(--md-sys-color-outline-variant, var(--mat-sys-outline-variant));background:var(--md-sys-color-surface-container-high, var(--mat-sys-surface-container-high))}.pfx-surface-drawer__title-block{display:flex;align-items:flex-start;gap:12px;min-width:0;flex:1 1 auto}.pfx-surface-drawer__title-icon{flex:0 0 auto;display:grid;place-items:center;width:36px;height:36px;margin-top:1px;border-radius:10px;background:var(--md-sys-color-primary-container, var(--mat-sys-primary-container, rgba(47, 78, 178, .12)));color:var(--md-sys-color-primary, var(--mat-sys-primary, currentColor))}.pfx-surface-drawer__copy{min-width:0}.pfx-surface-drawer__title,.pfx-surface-drawer__subtitle{margin:0}.pfx-surface-drawer__title{font-size:1.125rem;font-weight:var(--mat-sys-title-medium-weight, 500);line-height:1.35}.pfx-surface-drawer__title:focus{outline:none}.pfx-surface-drawer__subtitle{margin-top:6px;color:var(--md-sys-color-on-surface-variant, var(--mat-sys-on-surface-variant));font-size:.875rem;line-height:1.45;text-wrap:pretty}.pfx-surface-drawer__close,.pfx-surface-drawer__back{flex:0 0 auto;--praxis-icon-button-surface-size: 36px;--praxis-icon-button-icon-size: 18px;--praxis-icon-button-radius: 10px;--praxis-icon-button-focus-radius: 10px;color:var(--md-sys-color-on-surface-variant, var(--mat-sys-on-surface-variant))}.pfx-surface-drawer__close{margin-inline-end:-4px;--praxis-icon-button-bg: color-mix( in srgb, var(--md-sys-color-on-surface, var(--mat-sys-on-surface)) 4.5%, transparent );--praxis-icon-button-border: 1px solid color-mix( in srgb, var(--md-sys-color-outline-variant, var(--mat-sys-outline-variant)) 48%, transparent )}.pfx-surface-drawer__close:hover:not(:disabled){color:var(--md-sys-color-on-surface, var(--mat-sys-on-surface));--praxis-icon-button-hover-bg: color-mix( in srgb, var(--md-sys-color-on-surface, var(--mat-sys-on-surface)) 11%, transparent );--praxis-icon-button-hover-border-color: color-mix( in srgb, var(--md-sys-color-outline, var(--mat-sys-outline)) 48%, transparent )}.pfx-surface-drawer__close:active:not(:disabled){--praxis-icon-button-active-bg: color-mix( in srgb, var(--md-sys-color-on-surface, var(--mat-sys-on-surface)) 16%, transparent )}.pfx-surface-drawer__back{margin-top:1px;--praxis-icon-button-bg: transparent;--praxis-icon-button-border: 1px solid transparent}.pfx-surface-drawer__back:hover:not(:disabled){color:var(--md-sys-color-primary, var(--mat-sys-primary));--praxis-icon-button-hover-bg: color-mix( in srgb, var(--md-sys-color-primary, var(--mat-sys-primary)) 12%, transparent );--praxis-icon-button-hover-border-color: color-mix( in srgb, var(--md-sys-color-primary, var(--mat-sys-primary)) 30%, transparent )}.pfx-surface-drawer__body{min-height:0;overflow:auto;overscroll-behavior:contain;padding:var(--pfx-side-panel-body-padding, 16px);background:var(--md-sys-color-surface, var(--mat-sys-surface))}@media(min-width:640px){.pfx-surface-drawer:not(.width-full){border-radius:var(--pfx-side-panel-border-radius, 16px 0 0 16px)}}@media(prefers-reduced-motion:reduce){.pfx-surface-drawer{transition:none}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: PraxisIconButtonComponent, selector: "button[praxisIconButton]", inputs: ["praxisIconButton", "size", "appearance", "presentation", "pressed", "busy"] }, { kind: "directive", type: PraxisIconDirective, selector: "mat-icon[praxisIcon]", inputs: ["praxisIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3649
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.14", type: SurfaceDrawerComponent, isStandalone: true, selector: "praxis-surface-drawer", host: { listeners: { "window:resize": "onWindowResize()", "document:pointermove": "onDocumentPointerMove($event)", "document:pointerup": "onDocumentPointerEnd($event)", "document:pointercancel": "onDocumentPointerEnd($event)" } }, viewQueries: [{ propertyName: "contentHost", first: true, predicate: ["contentHost"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "body", first: true, predicate: ["body"], descendants: true, read: ElementRef }, { propertyName: "backButton", first: true, predicate: ["backButton"], descendants: true, read: ElementRef }], ngImport: i0, template: "<div\n class=\"pfx-surface-drawer\"\n [class.has-header]=\"hasHeader\"\n [class.width-narrow]=\"widthClass === 'width-narrow'\"\n [class.width-default]=\"widthClass === 'width-default'\"\n [class.width-wide]=\"widthClass === 'width-wide'\"\n [class.width-full]=\"widthClass === 'width-full'\"\n [class.use-host-width]=\"tracksHostWidth\"\n [class.is-resizable]=\"showResizeHandle\"\n [class.is-expandable]=\"expandable\"\n [class.is-expanded]=\"isExpanded\"\n [class.is-resizing]=\"isResizing\"\n [ngClass]=\"hostClasses\"\n [ngStyle]=\"hostCssVars\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-labelledby]=\"hasHeader ? titleId : null\"\n [attr.aria-describedby]=\"subtitle ? subtitleId : null\"\n cdkTrapFocus\n cdkTrapFocusAutoCapture\n>\n @if (showResizeHandle) {\n <div\n class=\"pfx-surface-drawer__resize-handle\"\n role=\"separator\"\n tabindex=\"0\"\n aria-orientation=\"vertical\"\n [attr.aria-label]=\"resizeHandleLabel\"\n [attr.aria-valuemin]=\"resizeMinWidthPx\"\n [attr.aria-valuemax]=\"resizeMaxWidthPx\"\n [attr.aria-valuenow]=\"resizeCurrentWidthPx\"\n (pointerdown)=\"onResizeHandlePointerDown($event)\"\n (dblclick)=\"onResizeHandleDoubleClick($event)\"\n (keydown)=\"onResizeHandleKeydown($event)\"\n ></div>\n }\n @if (hasHeader) {\n <header class=\"pfx-surface-drawer__header\">\n @if (canGoBack) {\n <button\n #backButton\n praxisIconButton=\"arrow_back\"\n size=\"compact\"\n type=\"button\"\n class=\"pfx-surface-drawer__back\"\n [attr.aria-label]=\"backLabel\"\n [matTooltip]=\"backLabel\"\n (click)=\"onBack?.()\"\n ></button>\n }\n <div class=\"pfx-surface-drawer__title-block\">\n @if (titleIcon) {\n <mat-icon class=\"pfx-surface-drawer__title-icon\" [praxisIcon]=\"titleIcon\"></mat-icon>\n }\n <div class=\"pfx-surface-drawer__copy\">\n @if (title) {\n <h2 class=\"pfx-surface-drawer__title\" [id]=\"titleId\" tabindex=\"-1\" cdkFocusInitial>{{ title }}</h2>\n }\n @if (subtitle) {\n <p class=\"pfx-surface-drawer__subtitle\" [id]=\"subtitleId\">{{ subtitle }}</p>\n }\n </div>\n </div>\n <div class=\"pfx-surface-drawer__actions\">\n @if (showExpandButton) {\n <button\n [praxisIconButton]=\"isExpanded ? 'close_fullscreen' : 'open_in_full'\"\n size=\"compact\"\n type=\"button\"\n class=\"pfx-surface-drawer__expand\"\n [attr.aria-label]=\"expandLabel\"\n [pressed]=\"isExpanded\"\n [matTooltip]=\"expandLabel\"\n (click)=\"toggleExpanded()\"\n ></button>\n }\n <button\n praxisIconButton=\"close\"\n size=\"compact\"\n type=\"button\"\n class=\"pfx-surface-drawer__close\"\n [attr.aria-label]=\"closeLabel\"\n [matTooltip]=\"closeLabel\"\n (click)=\"onClose?.()\"\n ></button>\n </div>\n </header>\n }\n\n <section #body class=\"pfx-surface-drawer__body\">\n <ng-template #contentHost></ng-template>\n </section>\n</div>\n", styles: [":host{display:block;height:100%;width:100%;min-width:0;flex:1 1 auto}.pfx-surface-drawer{position:relative;display:grid;grid-template-rows:auto 1fr;height:100%;min-width:0;max-width:100%;overflow:hidden;background:var(--md-sys-color-surface-container, var(--mat-sys-surface-container));color:var(--md-sys-color-on-surface, var(--mat-sys-on-surface));border-left:1px solid var(--md-sys-color-outline-variant, var(--mat-sys-outline-variant));border-radius:var(--pfx-side-panel-border-radius, 0);box-shadow:var(--pfx-side-panel-elevation, var(--md-sys-elevation-level2, 0 8px 24px rgba(0, 0, 0, .16)));width:var(--pfx-side-panel-width, 720px);transition:width var(--pfx-side-panel-motion-duration-enter, .22s) var(--pfx-side-panel-motion-easing-enter, cubic-bezier(.2, 0, 0, 1)),box-shadow var(--pfx-side-panel-motion-duration-enter, .22s) var(--pfx-side-panel-motion-easing-enter, cubic-bezier(.2, 0, 0, 1))}.pfx-surface-drawer.is-resizing{transition:none;-webkit-user-select:none;user-select:none}.pfx-surface-drawer__resize-handle{position:absolute;inset:0 auto 0 0;width:12px;cursor:col-resize;touch-action:none;z-index:3;outline:none}.pfx-surface-drawer__resize-handle:before{content:\"\";position:absolute;inset:0 auto 0 3px;width:2px;background:transparent;border-radius:2px;opacity:0;transition:background-color var(--pfx-side-panel-motion-duration, .16s) ease,opacity var(--pfx-side-panel-motion-duration, .16s) ease}.pfx-surface-drawer.is-resizable:hover .pfx-surface-drawer__resize-handle:before,.pfx-surface-drawer__resize-handle:hover:before,.pfx-surface-drawer__resize-handle:focus-visible:before,.pfx-surface-drawer.is-resizing .pfx-surface-drawer__resize-handle:before{opacity:1;background:var(--md-sys-color-primary, var(--mat-sys-primary, rgba(0, 0, 0, .32)))}.pfx-surface-drawer.use-host-width,.pfx-surface-drawer.is-resizable,.pfx-surface-drawer.is-expandable,.pfx-surface-drawer.is-expanded{width:100%;max-width:100%}.pfx-surface-drawer.width-narrow{width:var(--pfx-side-panel-width, 420px)}.pfx-surface-drawer.width-default{width:var(--pfx-side-panel-width, 720px)}.pfx-surface-drawer.width-wide{width:var(--pfx-side-panel-width, 960px)}.pfx-surface-drawer.width-full{width:min(100vw,var(--pfx-side-panel-max-width, 100vw))}.pfx-surface-drawer__header{display:flex;align-items:flex-start;gap:var(--pfx-side-panel-header-gap, 12px);min-height:var(--pfx-side-panel-header-height, 64px);padding:var(--pfx-side-panel-header-padding-y, 16px) var(--pfx-side-panel-header-padding-x, 20px);box-sizing:border-box;border-bottom:1px solid var(--md-sys-color-outline-variant, var(--mat-sys-outline-variant));background:var(--md-sys-color-surface-container-high, var(--mat-sys-surface-container-high))}.pfx-surface-drawer__title-block{display:flex;align-items:flex-start;gap:12px;min-width:0;flex:1 1 auto}.pfx-surface-drawer__title-icon{flex:0 0 auto;display:grid;place-items:center;width:36px;height:36px;margin-top:1px;border-radius:10px;background:var(--md-sys-color-primary-container, var(--mat-sys-primary-container, rgba(47, 78, 178, .12)));color:var(--md-sys-color-primary, var(--mat-sys-primary, currentColor))}.pfx-surface-drawer__copy{min-width:0}.pfx-surface-drawer__title,.pfx-surface-drawer__subtitle{margin:0}.pfx-surface-drawer__title{font-size:1.125rem;font-weight:var(--mat-sys-title-medium-weight, 500);line-height:1.35}.pfx-surface-drawer__title:focus{outline:none}.pfx-surface-drawer__subtitle{margin-top:6px;color:var(--md-sys-color-on-surface-variant, var(--mat-sys-on-surface-variant));font-size:.875rem;line-height:1.45;text-wrap:pretty}.pfx-surface-drawer__actions{display:flex;align-items:center;gap:8px;flex:0 0 auto;margin-inline-end:-4px}.pfx-surface-drawer__expand,.pfx-surface-drawer__close,.pfx-surface-drawer__back{flex:0 0 auto;--praxis-icon-button-surface-size: 36px;--praxis-icon-button-icon-size: 18px;--praxis-icon-button-radius: 10px;--praxis-icon-button-focus-radius: 10px;color:var(--md-sys-color-on-surface-variant, var(--mat-sys-on-surface-variant))}.pfx-surface-drawer__expand,.pfx-surface-drawer__close{--praxis-icon-button-bg: color-mix( in srgb, var(--md-sys-color-on-surface, var(--mat-sys-on-surface)) 4.5%, transparent );--praxis-icon-button-border: 1px solid color-mix( in srgb, var(--md-sys-color-outline-variant, var(--mat-sys-outline-variant)) 48%, transparent )}.pfx-surface-drawer__expand:hover:not(:disabled),.pfx-surface-drawer__close:hover:not(:disabled){color:var(--md-sys-color-on-surface, var(--mat-sys-on-surface));--praxis-icon-button-hover-bg: color-mix( in srgb, var(--md-sys-color-on-surface, var(--mat-sys-on-surface)) 11%, transparent );--praxis-icon-button-hover-border-color: color-mix( in srgb, var(--md-sys-color-outline, var(--mat-sys-outline)) 48%, transparent )}.pfx-surface-drawer__expand:active:not(:disabled),.pfx-surface-drawer__close:active:not(:disabled){--praxis-icon-button-active-bg: color-mix( in srgb, var(--md-sys-color-on-surface, var(--mat-sys-on-surface)) 16%, transparent )}.pfx-surface-drawer__back{margin-top:1px;--praxis-icon-button-bg: transparent;--praxis-icon-button-border: 1px solid transparent}.pfx-surface-drawer__back:hover:not(:disabled){color:var(--md-sys-color-primary, var(--mat-sys-primary));--praxis-icon-button-hover-bg: color-mix( in srgb, var(--md-sys-color-primary, var(--mat-sys-primary)) 12%, transparent );--praxis-icon-button-hover-border-color: color-mix( in srgb, var(--md-sys-color-primary, var(--mat-sys-primary)) 30%, transparent )}.pfx-surface-drawer__body{min-height:0;overflow:auto;overscroll-behavior:contain;padding:var(--pfx-side-panel-body-padding, 16px);background:var(--md-sys-color-surface, var(--mat-sys-surface))}@media(min-width:640px){.pfx-surface-drawer:not(.width-full){border-radius:var(--pfx-side-panel-border-radius, 16px 0 0 16px)}}@media(prefers-reduced-motion:reduce){.pfx-surface-drawer{transition:none}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: PraxisIconButtonComponent, selector: "button[praxisIconButton]", inputs: ["praxisIconButton", "size", "appearance", "presentation", "pressed", "busy"] }, { kind: "directive", type: PraxisIconDirective, selector: "mat-icon[praxisIcon]", inputs: ["praxisIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3151
3650
|
}
|
|
3152
3651
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: SurfaceDrawerComponent, decorators: [{
|
|
3153
3652
|
type: Component,
|
|
@@ -3160,7 +3659,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
|
|
|
3160
3659
|
CdkTrapFocus,
|
|
3161
3660
|
PraxisIconButtonComponent,
|
|
3162
3661
|
PraxisIconDirective,
|
|
3163
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"pfx-surface-drawer\"\n [class.has-header]=\"hasHeader\"\n [class.width-narrow]=\"widthClass === 'width-narrow'\"\n [class.width-default]=\"widthClass === 'width-default'\"\n [class.width-wide]=\"widthClass === 'width-wide'\"\n [class.width-full]=\"widthClass === 'width-full'\"\n [class.use-host-width]=\"
|
|
3662
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"pfx-surface-drawer\"\n [class.has-header]=\"hasHeader\"\n [class.width-narrow]=\"widthClass === 'width-narrow'\"\n [class.width-default]=\"widthClass === 'width-default'\"\n [class.width-wide]=\"widthClass === 'width-wide'\"\n [class.width-full]=\"widthClass === 'width-full'\"\n [class.use-host-width]=\"tracksHostWidth\"\n [class.is-resizable]=\"showResizeHandle\"\n [class.is-expandable]=\"expandable\"\n [class.is-expanded]=\"isExpanded\"\n [class.is-resizing]=\"isResizing\"\n [ngClass]=\"hostClasses\"\n [ngStyle]=\"hostCssVars\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-labelledby]=\"hasHeader ? titleId : null\"\n [attr.aria-describedby]=\"subtitle ? subtitleId : null\"\n cdkTrapFocus\n cdkTrapFocusAutoCapture\n>\n @if (showResizeHandle) {\n <div\n class=\"pfx-surface-drawer__resize-handle\"\n role=\"separator\"\n tabindex=\"0\"\n aria-orientation=\"vertical\"\n [attr.aria-label]=\"resizeHandleLabel\"\n [attr.aria-valuemin]=\"resizeMinWidthPx\"\n [attr.aria-valuemax]=\"resizeMaxWidthPx\"\n [attr.aria-valuenow]=\"resizeCurrentWidthPx\"\n (pointerdown)=\"onResizeHandlePointerDown($event)\"\n (dblclick)=\"onResizeHandleDoubleClick($event)\"\n (keydown)=\"onResizeHandleKeydown($event)\"\n ></div>\n }\n @if (hasHeader) {\n <header class=\"pfx-surface-drawer__header\">\n @if (canGoBack) {\n <button\n #backButton\n praxisIconButton=\"arrow_back\"\n size=\"compact\"\n type=\"button\"\n class=\"pfx-surface-drawer__back\"\n [attr.aria-label]=\"backLabel\"\n [matTooltip]=\"backLabel\"\n (click)=\"onBack?.()\"\n ></button>\n }\n <div class=\"pfx-surface-drawer__title-block\">\n @if (titleIcon) {\n <mat-icon class=\"pfx-surface-drawer__title-icon\" [praxisIcon]=\"titleIcon\"></mat-icon>\n }\n <div class=\"pfx-surface-drawer__copy\">\n @if (title) {\n <h2 class=\"pfx-surface-drawer__title\" [id]=\"titleId\" tabindex=\"-1\" cdkFocusInitial>{{ title }}</h2>\n }\n @if (subtitle) {\n <p class=\"pfx-surface-drawer__subtitle\" [id]=\"subtitleId\">{{ subtitle }}</p>\n }\n </div>\n </div>\n <div class=\"pfx-surface-drawer__actions\">\n @if (showExpandButton) {\n <button\n [praxisIconButton]=\"isExpanded ? 'close_fullscreen' : 'open_in_full'\"\n size=\"compact\"\n type=\"button\"\n class=\"pfx-surface-drawer__expand\"\n [attr.aria-label]=\"expandLabel\"\n [pressed]=\"isExpanded\"\n [matTooltip]=\"expandLabel\"\n (click)=\"toggleExpanded()\"\n ></button>\n }\n <button\n praxisIconButton=\"close\"\n size=\"compact\"\n type=\"button\"\n class=\"pfx-surface-drawer__close\"\n [attr.aria-label]=\"closeLabel\"\n [matTooltip]=\"closeLabel\"\n (click)=\"onClose?.()\"\n ></button>\n </div>\n </header>\n }\n\n <section #body class=\"pfx-surface-drawer__body\">\n <ng-template #contentHost></ng-template>\n </section>\n</div>\n", styles: [":host{display:block;height:100%;width:100%;min-width:0;flex:1 1 auto}.pfx-surface-drawer{position:relative;display:grid;grid-template-rows:auto 1fr;height:100%;min-width:0;max-width:100%;overflow:hidden;background:var(--md-sys-color-surface-container, var(--mat-sys-surface-container));color:var(--md-sys-color-on-surface, var(--mat-sys-on-surface));border-left:1px solid var(--md-sys-color-outline-variant, var(--mat-sys-outline-variant));border-radius:var(--pfx-side-panel-border-radius, 0);box-shadow:var(--pfx-side-panel-elevation, var(--md-sys-elevation-level2, 0 8px 24px rgba(0, 0, 0, .16)));width:var(--pfx-side-panel-width, 720px);transition:width var(--pfx-side-panel-motion-duration-enter, .22s) var(--pfx-side-panel-motion-easing-enter, cubic-bezier(.2, 0, 0, 1)),box-shadow var(--pfx-side-panel-motion-duration-enter, .22s) var(--pfx-side-panel-motion-easing-enter, cubic-bezier(.2, 0, 0, 1))}.pfx-surface-drawer.is-resizing{transition:none;-webkit-user-select:none;user-select:none}.pfx-surface-drawer__resize-handle{position:absolute;inset:0 auto 0 0;width:12px;cursor:col-resize;touch-action:none;z-index:3;outline:none}.pfx-surface-drawer__resize-handle:before{content:\"\";position:absolute;inset:0 auto 0 3px;width:2px;background:transparent;border-radius:2px;opacity:0;transition:background-color var(--pfx-side-panel-motion-duration, .16s) ease,opacity var(--pfx-side-panel-motion-duration, .16s) ease}.pfx-surface-drawer.is-resizable:hover .pfx-surface-drawer__resize-handle:before,.pfx-surface-drawer__resize-handle:hover:before,.pfx-surface-drawer__resize-handle:focus-visible:before,.pfx-surface-drawer.is-resizing .pfx-surface-drawer__resize-handle:before{opacity:1;background:var(--md-sys-color-primary, var(--mat-sys-primary, rgba(0, 0, 0, .32)))}.pfx-surface-drawer.use-host-width,.pfx-surface-drawer.is-resizable,.pfx-surface-drawer.is-expandable,.pfx-surface-drawer.is-expanded{width:100%;max-width:100%}.pfx-surface-drawer.width-narrow{width:var(--pfx-side-panel-width, 420px)}.pfx-surface-drawer.width-default{width:var(--pfx-side-panel-width, 720px)}.pfx-surface-drawer.width-wide{width:var(--pfx-side-panel-width, 960px)}.pfx-surface-drawer.width-full{width:min(100vw,var(--pfx-side-panel-max-width, 100vw))}.pfx-surface-drawer__header{display:flex;align-items:flex-start;gap:var(--pfx-side-panel-header-gap, 12px);min-height:var(--pfx-side-panel-header-height, 64px);padding:var(--pfx-side-panel-header-padding-y, 16px) var(--pfx-side-panel-header-padding-x, 20px);box-sizing:border-box;border-bottom:1px solid var(--md-sys-color-outline-variant, var(--mat-sys-outline-variant));background:var(--md-sys-color-surface-container-high, var(--mat-sys-surface-container-high))}.pfx-surface-drawer__title-block{display:flex;align-items:flex-start;gap:12px;min-width:0;flex:1 1 auto}.pfx-surface-drawer__title-icon{flex:0 0 auto;display:grid;place-items:center;width:36px;height:36px;margin-top:1px;border-radius:10px;background:var(--md-sys-color-primary-container, var(--mat-sys-primary-container, rgba(47, 78, 178, .12)));color:var(--md-sys-color-primary, var(--mat-sys-primary, currentColor))}.pfx-surface-drawer__copy{min-width:0}.pfx-surface-drawer__title,.pfx-surface-drawer__subtitle{margin:0}.pfx-surface-drawer__title{font-size:1.125rem;font-weight:var(--mat-sys-title-medium-weight, 500);line-height:1.35}.pfx-surface-drawer__title:focus{outline:none}.pfx-surface-drawer__subtitle{margin-top:6px;color:var(--md-sys-color-on-surface-variant, var(--mat-sys-on-surface-variant));font-size:.875rem;line-height:1.45;text-wrap:pretty}.pfx-surface-drawer__actions{display:flex;align-items:center;gap:8px;flex:0 0 auto;margin-inline-end:-4px}.pfx-surface-drawer__expand,.pfx-surface-drawer__close,.pfx-surface-drawer__back{flex:0 0 auto;--praxis-icon-button-surface-size: 36px;--praxis-icon-button-icon-size: 18px;--praxis-icon-button-radius: 10px;--praxis-icon-button-focus-radius: 10px;color:var(--md-sys-color-on-surface-variant, var(--mat-sys-on-surface-variant))}.pfx-surface-drawer__expand,.pfx-surface-drawer__close{--praxis-icon-button-bg: color-mix( in srgb, var(--md-sys-color-on-surface, var(--mat-sys-on-surface)) 4.5%, transparent );--praxis-icon-button-border: 1px solid color-mix( in srgb, var(--md-sys-color-outline-variant, var(--mat-sys-outline-variant)) 48%, transparent )}.pfx-surface-drawer__expand:hover:not(:disabled),.pfx-surface-drawer__close:hover:not(:disabled){color:var(--md-sys-color-on-surface, var(--mat-sys-on-surface));--praxis-icon-button-hover-bg: color-mix( in srgb, var(--md-sys-color-on-surface, var(--mat-sys-on-surface)) 11%, transparent );--praxis-icon-button-hover-border-color: color-mix( in srgb, var(--md-sys-color-outline, var(--mat-sys-outline)) 48%, transparent )}.pfx-surface-drawer__expand:active:not(:disabled),.pfx-surface-drawer__close:active:not(:disabled){--praxis-icon-button-active-bg: color-mix( in srgb, var(--md-sys-color-on-surface, var(--mat-sys-on-surface)) 16%, transparent )}.pfx-surface-drawer__back{margin-top:1px;--praxis-icon-button-bg: transparent;--praxis-icon-button-border: 1px solid transparent}.pfx-surface-drawer__back:hover:not(:disabled){color:var(--md-sys-color-primary, var(--mat-sys-primary));--praxis-icon-button-hover-bg: color-mix( in srgb, var(--md-sys-color-primary, var(--mat-sys-primary)) 12%, transparent );--praxis-icon-button-hover-border-color: color-mix( in srgb, var(--md-sys-color-primary, var(--mat-sys-primary)) 30%, transparent )}.pfx-surface-drawer__body{min-height:0;overflow:auto;overscroll-behavior:contain;padding:var(--pfx-side-panel-body-padding, 16px);background:var(--md-sys-color-surface, var(--mat-sys-surface))}@media(min-width:640px){.pfx-surface-drawer:not(.width-full){border-radius:var(--pfx-side-panel-border-radius, 16px 0 0 16px)}}@media(prefers-reduced-motion:reduce){.pfx-surface-drawer{transition:none}}\n"] }]
|
|
3164
3663
|
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i1$2.PraxisI18nService }], propDecorators: { contentHost: [{
|
|
3165
3664
|
type: ViewChild,
|
|
3166
3665
|
args: ['contentHost', { read: ViewContainerRef, static: true }]
|
|
@@ -3170,6 +3669,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
|
|
|
3170
3669
|
}], backButton: [{
|
|
3171
3670
|
type: ViewChild,
|
|
3172
3671
|
args: ['backButton', { read: ElementRef }]
|
|
3672
|
+
}], onWindowResize: [{
|
|
3673
|
+
type: HostListener,
|
|
3674
|
+
args: ['window:resize']
|
|
3675
|
+
}], onDocumentPointerMove: [{
|
|
3676
|
+
type: HostListener,
|
|
3677
|
+
args: ['document:pointermove', ['$event']]
|
|
3678
|
+
}], onDocumentPointerEnd: [{
|
|
3679
|
+
type: HostListener,
|
|
3680
|
+
args: ['document:pointerup', ['$event']]
|
|
3681
|
+
}, {
|
|
3682
|
+
type: HostListener,
|
|
3683
|
+
args: ['document:pointercancel', ['$event']]
|
|
3173
3684
|
}] } });
|
|
3174
3685
|
|
|
3175
3686
|
function buildSurfaceRuntime(ref) {
|
|
@@ -3180,7 +3691,11 @@ function buildSurfaceRuntime(ref) {
|
|
|
3180
3691
|
emitResult: (result) => ref.emitResult?.(result),
|
|
3181
3692
|
complete: (outcome) => ref.complete?.(outcome),
|
|
3182
3693
|
updateTitle: (title) => ref.updateTitle?.(title),
|
|
3183
|
-
updateSize: (preset) =>
|
|
3694
|
+
updateSize: (preset, options) => options === undefined
|
|
3695
|
+
? ref.updateSize?.(preset)
|
|
3696
|
+
: ref.updateSize?.(preset, options),
|
|
3697
|
+
setExpanded: (expanded) => ref.setExpanded?.(expanded),
|
|
3698
|
+
toggleExpanded: () => ref.toggleExpanded?.(),
|
|
3184
3699
|
navigation$: ref.navigation$,
|
|
3185
3700
|
push: (frame) => ref.push?.(frame),
|
|
3186
3701
|
replace: (frame) => ref.replace?.(frame),
|
|
@@ -3242,6 +3757,27 @@ function providePraxisSurfaceDrawerBridge() {
|
|
|
3242
3757
|
let panel = null;
|
|
3243
3758
|
let activeRef = null;
|
|
3244
3759
|
const frameRefs = [];
|
|
3760
|
+
const viewportWidth = resolveSidePanelViewportWidth();
|
|
3761
|
+
const persistedWidth = opts.persistSizeKey
|
|
3762
|
+
? readPersistedSidePanelWidth(opts.persistSizeKey)
|
|
3763
|
+
: undefined;
|
|
3764
|
+
const clampedPersistedWidth = (() => {
|
|
3765
|
+
if (!persistedWidth)
|
|
3766
|
+
return undefined;
|
|
3767
|
+
const parsed = parseSidePanelWidthPx(persistedWidth, viewportWidth);
|
|
3768
|
+
if (parsed === null)
|
|
3769
|
+
return persistedWidth;
|
|
3770
|
+
return `${clampSidePanelWidthPx(parsed, {
|
|
3771
|
+
minWidth: opts.minWidth,
|
|
3772
|
+
maxWidth: opts.maxWidth,
|
|
3773
|
+
viewportWidth,
|
|
3774
|
+
})}px`;
|
|
3775
|
+
})();
|
|
3776
|
+
const initialWidth = clampedPersistedWidth ??
|
|
3777
|
+
opts.width ??
|
|
3778
|
+
resolveSidePanelPresetWidth(opts.widthPreset ?? 'default');
|
|
3779
|
+
const frameWidthStack = [initialWidth];
|
|
3780
|
+
let userResized = false;
|
|
3245
3781
|
let navigatingBack = false;
|
|
3246
3782
|
let closingSession = false;
|
|
3247
3783
|
const createContent = (frame, mode, runtimeRef) => {
|
|
@@ -3292,6 +3828,19 @@ function providePraxisSurfaceDrawerBridge() {
|
|
|
3292
3828
|
frameRefs.pop();
|
|
3293
3829
|
closeFrameRef(leaving, result ?? { type: 'back' });
|
|
3294
3830
|
}
|
|
3831
|
+
const leavingWidth = frameWidthStack.length > 1 ? frameWidthStack.pop() : undefined;
|
|
3832
|
+
const restoredWidth = frameWidthStack[frameWidthStack.length - 1];
|
|
3833
|
+
if (restoredWidth && panel?.isExpanded) {
|
|
3834
|
+
panel.syncCollapsedWidth?.(restoredWidth);
|
|
3835
|
+
}
|
|
3836
|
+
else if (!userResized &&
|
|
3837
|
+
!panel?.isExpanded &&
|
|
3838
|
+
leavingWidth &&
|
|
3839
|
+
restoredWidth &&
|
|
3840
|
+
restoredWidth !== leavingWidth) {
|
|
3841
|
+
activeRef?.updateSize?.(restoredWidth, { persist: false });
|
|
3842
|
+
panel?.syncHostWidth?.(restoredWidth);
|
|
3843
|
+
}
|
|
3295
3844
|
publishNavigationState();
|
|
3296
3845
|
return true;
|
|
3297
3846
|
}
|
|
@@ -3333,10 +3882,28 @@ function providePraxisSurfaceDrawerBridge() {
|
|
|
3333
3882
|
emitResult: (result) => resultSubject.next(result),
|
|
3334
3883
|
complete: (outcome) => {
|
|
3335
3884
|
resultSubject.next(outcome);
|
|
3885
|
+
const outcomeRecord = outcome && typeof outcome === 'object'
|
|
3886
|
+
? outcome
|
|
3887
|
+
: null;
|
|
3888
|
+
const outcomeKind = typeof outcomeRecord?.kind === 'string'
|
|
3889
|
+
? outcomeRecord.kind.toLowerCase()
|
|
3890
|
+
: '';
|
|
3891
|
+
const outcomeType = typeof outcomeRecord?.type === 'string'
|
|
3892
|
+
? outcomeRecord.type.toLowerCase()
|
|
3893
|
+
: '';
|
|
3894
|
+
if (outcomeKind === 'completed' ||
|
|
3895
|
+
outcomeType === 'save' ||
|
|
3896
|
+
outcomeType === 'delete') {
|
|
3897
|
+
activeRef?.emitResult?.(outcome);
|
|
3898
|
+
}
|
|
3336
3899
|
void navigateBack(outcome);
|
|
3337
3900
|
},
|
|
3338
3901
|
updateTitle: (title) => activeRef?.updateTitle?.(title),
|
|
3339
|
-
updateSize: (preset) =>
|
|
3902
|
+
updateSize: (preset, options) => options === undefined
|
|
3903
|
+
? activeRef?.updateSize?.(preset)
|
|
3904
|
+
: activeRef?.updateSize?.(preset, options),
|
|
3905
|
+
setExpanded: (expanded) => activeRef?.setExpanded?.(expanded),
|
|
3906
|
+
toggleExpanded: () => activeRef?.toggleExpanded?.(),
|
|
3340
3907
|
push: (frame) => activeRef?.push?.(frame) ?? Promise.resolve(null),
|
|
3341
3908
|
replace: (frame) => activeRef?.replace?.(frame) ?? Promise.resolve(null),
|
|
3342
3909
|
back: () => activeRef?.back?.() ?? Promise.resolve(false),
|
|
@@ -3367,6 +3934,40 @@ function providePraxisSurfaceDrawerBridge() {
|
|
|
3367
3934
|
ref.navigation$ = navigationState.asObservable();
|
|
3368
3935
|
ref.canGoBack = () => panel?.canGoBack ?? false;
|
|
3369
3936
|
ref.setCanLeave = (guard) => panel?.setActiveCanLeave(guard);
|
|
3937
|
+
if (typeof ref.bindExpandController === 'function') {
|
|
3938
|
+
ref.bindExpandController({
|
|
3939
|
+
setExpanded: (expanded) => panel?.setExpanded?.(expanded),
|
|
3940
|
+
toggleExpanded: () => panel?.toggleExpanded?.(),
|
|
3941
|
+
});
|
|
3942
|
+
}
|
|
3943
|
+
else {
|
|
3944
|
+
ref.setExpanded = (expanded) => panel?.setExpanded?.(expanded);
|
|
3945
|
+
ref.toggleExpanded = () => panel?.toggleExpanded?.();
|
|
3946
|
+
}
|
|
3947
|
+
const applyFrameWidthTransition = (frame, mode) => {
|
|
3948
|
+
const currentTopWidth = frameWidthStack[frameWidthStack.length - 1] ?? initialWidth;
|
|
3949
|
+
const targetWidth = frame.width ??
|
|
3950
|
+
(frame.widthPreset
|
|
3951
|
+
? resolveSidePanelPresetWidth(frame.widthPreset)
|
|
3952
|
+
: currentTopWidth);
|
|
3953
|
+
if (mode === 'push') {
|
|
3954
|
+
frameWidthStack.push(targetWidth);
|
|
3955
|
+
}
|
|
3956
|
+
else if (frameWidthStack.length > 0) {
|
|
3957
|
+
frameWidthStack[frameWidthStack.length - 1] = targetWidth;
|
|
3958
|
+
}
|
|
3959
|
+
else {
|
|
3960
|
+
frameWidthStack.push(targetWidth);
|
|
3961
|
+
}
|
|
3962
|
+
if (panel?.isExpanded) {
|
|
3963
|
+
panel.syncCollapsedWidth?.(targetWidth);
|
|
3964
|
+
}
|
|
3965
|
+
else if (!userResized &&
|
|
3966
|
+
targetWidth !== currentTopWidth) {
|
|
3967
|
+
ref.updateSize?.(targetWidth, { persist: false });
|
|
3968
|
+
panel?.syncHostWidth?.(targetWidth);
|
|
3969
|
+
}
|
|
3970
|
+
};
|
|
3370
3971
|
ref.push = async (frame) => {
|
|
3371
3972
|
const frameRef = createFrameRef(frame.id);
|
|
3372
3973
|
const contentRef = await createContent(frame, 'push', frameRef);
|
|
@@ -3374,6 +3975,7 @@ function providePraxisSurfaceDrawerBridge() {
|
|
|
3374
3975
|
return null;
|
|
3375
3976
|
frameRefs.push(frameRef);
|
|
3376
3977
|
frameRef.__setCleanup?.(bindSurfaceContentSelectionResults(contentRef.instance, frameRef));
|
|
3978
|
+
applyFrameWidthTransition(frame, 'push');
|
|
3377
3979
|
publishNavigationState();
|
|
3378
3980
|
return frameRef;
|
|
3379
3981
|
};
|
|
@@ -3389,6 +3991,7 @@ function providePraxisSurfaceDrawerBridge() {
|
|
|
3389
3991
|
value: frame.id,
|
|
3390
3992
|
});
|
|
3391
3993
|
bindSurfaceContentSelectionResults(contentRef.instance, rootRef);
|
|
3994
|
+
applyFrameWidthTransition(frame, 'replace');
|
|
3392
3995
|
publishNavigationState();
|
|
3393
3996
|
return rootRef;
|
|
3394
3997
|
}
|
|
@@ -3401,6 +4004,7 @@ function providePraxisSurfaceDrawerBridge() {
|
|
|
3401
4004
|
closeFrameRef(replaced, { type: 'replace' });
|
|
3402
4005
|
frameRefs.push(frameRef);
|
|
3403
4006
|
frameRef.__setCleanup?.(bindSurfaceContentSelectionResults(contentRef.instance, frameRef));
|
|
4007
|
+
applyFrameWidthTransition(frame, 'replace');
|
|
3404
4008
|
publishNavigationState();
|
|
3405
4009
|
return frameRef;
|
|
3406
4010
|
};
|
|
@@ -3427,6 +4031,7 @@ function providePraxisSurfaceDrawerBridge() {
|
|
|
3427
4031
|
minWidth: opts.minWidth,
|
|
3428
4032
|
maxWidth: opts.maxWidth,
|
|
3429
4033
|
resizable: opts.resizable,
|
|
4034
|
+
expandable: opts.expandable,
|
|
3430
4035
|
resizeAxis: opts.resizeAxis,
|
|
3431
4036
|
persistSizeKey: opts.persistSizeKey,
|
|
3432
4037
|
content: {
|
|
@@ -3446,13 +4051,44 @@ function providePraxisSurfaceDrawerBridge() {
|
|
|
3446
4051
|
const ref = new BaseSidePanelOverlayRef(overlayRef);
|
|
3447
4052
|
return configureRef(ref);
|
|
3448
4053
|
},
|
|
3449
|
-
attach: (panelRef, ref) => {
|
|
4054
|
+
attach: (panelRef, ref, resolvedConfig) => {
|
|
3450
4055
|
panel = panelRef.instance;
|
|
3451
4056
|
configureRef(ref);
|
|
3452
|
-
|
|
3453
|
-
|
|
4057
|
+
const resolvedPanelWidth = resolvedConfig?.width ??
|
|
4058
|
+
clampedPersistedWidth ??
|
|
4059
|
+
opts.width ??
|
|
4060
|
+
resolveSidePanelPresetWidth(resolvedConfig?.widthPreset ?? opts.widthPreset ?? 'default');
|
|
4061
|
+
frameWidthStack[0] = resolvedPanelWidth;
|
|
4062
|
+
panelRef.instance.widthPreset =
|
|
4063
|
+
resolvedConfig?.widthPreset ?? opts.widthPreset ?? 'default';
|
|
4064
|
+
panelRef.instance.width = resolvedPanelWidth;
|
|
4065
|
+
panelRef.instance.minWidth = resolvedConfig?.minWidth ?? opts.minWidth;
|
|
4066
|
+
panelRef.instance.maxWidth = resolvedConfig?.maxWidth ?? opts.maxWidth;
|
|
4067
|
+
panelRef.instance.resizable =
|
|
4068
|
+
resolvedConfig?.resizable ?? opts.resizable ?? false;
|
|
4069
|
+
panelRef.instance.expandable =
|
|
4070
|
+
resolvedConfig?.expandable ?? opts.expandable ?? false;
|
|
4071
|
+
panelRef.instance.resizeAxis =
|
|
4072
|
+
resolvedConfig?.resizeAxis ?? opts.resizeAxis ?? 'x';
|
|
4073
|
+
panelRef.instance.persistSizeKey =
|
|
4074
|
+
resolvedConfig?.persistSizeKey ?? opts.persistSizeKey;
|
|
4075
|
+
panelRef.instance.useHostWidth = !!(resolvedConfig?.width ||
|
|
4076
|
+
clampedPersistedWidth ||
|
|
4077
|
+
opts.width ||
|
|
4078
|
+
resolvedConfig?.minWidth ||
|
|
3454
4079
|
opts.minWidth ||
|
|
3455
|
-
|
|
4080
|
+
resolvedConfig?.maxWidth ||
|
|
4081
|
+
opts.maxWidth ||
|
|
4082
|
+
resolvedConfig?.resizable ||
|
|
4083
|
+
opts.resizable ||
|
|
4084
|
+
resolvedConfig?.expandable ||
|
|
4085
|
+
opts.expandable);
|
|
4086
|
+
panelRef.instance.onResizeWidth = (width, resizeOptions) => {
|
|
4087
|
+
if (resizeOptions?.persist !== false) {
|
|
4088
|
+
userResized = true;
|
|
4089
|
+
}
|
|
4090
|
+
ref.updateSize?.({ width }, resizeOptions);
|
|
4091
|
+
};
|
|
3456
4092
|
panelRef.instance.onClose = () => {
|
|
3457
4093
|
void requestDismiss('close', ref);
|
|
3458
4094
|
};
|