@masterteam/components 0.0.229 → 0.0.231
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/common.css +1 -1
- package/fesm2022/masterteam-components-drawer.mjs +9 -2
- package/fesm2022/masterteam-components-drawer.mjs.map +1 -1
- package/fesm2022/masterteam-components-dynamic-drawer.mjs +62 -9
- package/fesm2022/masterteam-components-dynamic-drawer.mjs.map +1 -1
- package/fesm2022/masterteam-components-entities.mjs +108 -8
- package/fesm2022/masterteam-components-entities.mjs.map +1 -1
- package/package.json +1 -1
- package/types/masterteam-components-drawer.d.ts +1 -0
- package/types/masterteam-components-dynamic-drawer.d.ts +25 -0
- package/types/masterteam-components-entities.d.ts +90 -5
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { NgComponentOutlet, DOCUMENT } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { InjectionToken, signal, Injectable, model, inject, ElementRef, Renderer2, effect, computed, Injector, RendererStyleFlags2, Input, Component, ApplicationRef, EnvironmentInjector, DestroyRef, createComponent } from '@angular/core';
|
|
3
|
+
import { InjectionToken, signal, Injectable, model, viewChild, inject, ElementRef, Renderer2, effect, computed, Injector, RendererStyleFlags2, Input, Component, ApplicationRef, EnvironmentInjector, DestroyRef, createComponent } from '@angular/core';
|
|
4
4
|
import { DynamicDialogRef } from 'primeng/dynamicdialog';
|
|
5
5
|
import * as i1 from 'primeng/drawer';
|
|
6
|
-
import { DrawerModule } from 'primeng/drawer';
|
|
6
|
+
import { Drawer, DrawerModule } from 'primeng/drawer';
|
|
7
7
|
import { TranslocoService } from '@jsverse/transloco';
|
|
8
8
|
import { Button } from '@masterteam/components/button';
|
|
9
9
|
|
|
@@ -85,6 +85,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
85
85
|
}] });
|
|
86
86
|
class DynamicDrawerHost {
|
|
87
87
|
visible = model(false, ...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
88
|
+
pDrawer = viewChild(Drawer, ...(ngDevMode ? [{ debugName: "pDrawer" }] : /* istanbul ignore next */ []));
|
|
89
|
+
// Cached so ngOnDestroy never has to read a query on a view that is already
|
|
90
|
+
// being torn down.
|
|
91
|
+
primeDrawer = null;
|
|
88
92
|
cmp = signal(null, ...(ngDevMode ? [{ debugName: "cmp" }] : /* istanbul ignore next */ []));
|
|
89
93
|
cfg = signal({ position: 'right' }, ...(ngDevMode ? [{ debugName: "cfg" }] : /* istanbul ignore next */ []));
|
|
90
94
|
cmpInputs = signal({}, ...(ngDevMode ? [{ debugName: "cmpInputs" }] : /* istanbul ignore next */ []));
|
|
@@ -198,9 +202,11 @@ class DynamicDrawerHost {
|
|
|
198
202
|
}
|
|
199
203
|
hide() {
|
|
200
204
|
this.visible.set(false);
|
|
205
|
+
this.beginMaskTeardown();
|
|
201
206
|
}
|
|
202
207
|
handleHide(data = null) {
|
|
203
208
|
this.visible.set(false);
|
|
209
|
+
this.beginMaskTeardown();
|
|
204
210
|
this.closeOnce(data);
|
|
205
211
|
}
|
|
206
212
|
/** Close the drawer ref at most once, regardless of the close path. */
|
|
@@ -212,6 +218,7 @@ class DynamicDrawerHost {
|
|
|
212
218
|
this.ref?.close(data);
|
|
213
219
|
}
|
|
214
220
|
onDrawerShow() {
|
|
221
|
+
this.primeDrawer = this.pDrawer() ?? null;
|
|
215
222
|
// Drawer DOM only exists after PrimeNG renders it — apply current state
|
|
216
223
|
// instantly so the open animation doesn't fight the resize transition.
|
|
217
224
|
this.applyMaximizedInlineStyles(this.drawerController.maximized(), false);
|
|
@@ -227,6 +234,47 @@ class DynamicDrawerHost {
|
|
|
227
234
|
// consumers' onClose runs for every close path. closeOnce() de-dupes.
|
|
228
235
|
this.closeOnce();
|
|
229
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* PrimeNG appends the drawer's modal mask to `<body>` — not to `appendTo` —
|
|
239
|
+
* and only removes it from its own dismiss paths (mask click / Escape ->
|
|
240
|
+
* close() -> disableModality() -> animationend -> destroyModal()). Every
|
|
241
|
+
* programmatic close (the header X, `ref.close()` from the content
|
|
242
|
+
* component, DrawerService.closeHost) skips those paths, and p-drawer's own
|
|
243
|
+
* ngOnDestroy is guarded by `if (this.visible && this.modal)` — `visible` is
|
|
244
|
+
* already false by then, so it cleans up nothing.
|
|
245
|
+
*
|
|
246
|
+
* The leftover `.p-overlay-mask` is `position: fixed` and covers the whole
|
|
247
|
+
* viewport, so the app silently stops responding to clicks until a reload.
|
|
248
|
+
* Drive PrimeNG's teardown explicitly instead: fade the mask out when the
|
|
249
|
+
* drawer starts closing, and hard-remove it when the host is destroyed.
|
|
250
|
+
*/
|
|
251
|
+
beginMaskTeardown() {
|
|
252
|
+
const drawer = this.resolvePrimeDrawer();
|
|
253
|
+
const mask = drawer?.mask;
|
|
254
|
+
if (!drawer || !mask) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
// PrimeNG already started its own fade (mask click / Escape) — don't
|
|
258
|
+
// re-bind a second animationend listener on top of it.
|
|
259
|
+
if (mask.classList.contains('p-overlay-mask-leave-active')) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
drawer.disableModality();
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Only consults the cached instance — this also runs from ngOnDestroy, where
|
|
266
|
+
* reading a view query is not safe. A drawer that never opened never created
|
|
267
|
+
* a mask, so there is nothing to miss.
|
|
268
|
+
*/
|
|
269
|
+
forceMaskTeardown() {
|
|
270
|
+
if (this.primeDrawer?.mask) {
|
|
271
|
+
this.primeDrawer.destroyModal();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
resolvePrimeDrawer() {
|
|
275
|
+
this.primeDrawer ??= this.pDrawer() ?? null;
|
|
276
|
+
return this.primeDrawer;
|
|
277
|
+
}
|
|
230
278
|
getDrawerElement() {
|
|
231
279
|
return this.host.nativeElement.querySelector('.p-drawer');
|
|
232
280
|
}
|
|
@@ -268,9 +316,13 @@ class DynamicDrawerHost {
|
|
|
268
316
|
clearTimeout(this.resizeAnimTimer);
|
|
269
317
|
this.resizeAnimTimer = null;
|
|
270
318
|
}
|
|
319
|
+
// Last line of defence: the mask lives in <body>, so it outlives this host
|
|
320
|
+
// element unless we remove it ourselves.
|
|
321
|
+
this.forceMaskTeardown();
|
|
322
|
+
this.primeDrawer = null;
|
|
271
323
|
}
|
|
272
324
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: DynamicDrawerHost, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
273
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: DynamicDrawerHost, isStandalone: true, selector: "mt-dynamic-drawer-host", inputs: { visible: { classPropertyName: "visible", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, connect: { classPropertyName: "connect", publicName: "connect", isSignal: false, isRequired: true, transformFunction: null } }, outputs: { visible: "visibleChange" }, ngImport: i0, template: `
|
|
325
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: DynamicDrawerHost, isStandalone: true, selector: "mt-dynamic-drawer-host", inputs: { visible: { classPropertyName: "visible", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, connect: { classPropertyName: "connect", publicName: "connect", isSignal: false, isRequired: true, transformFunction: null } }, outputs: { visible: "visibleChange" }, viewQueries: [{ propertyName: "pDrawer", first: true, predicate: Drawer, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
274
326
|
<p-drawer
|
|
275
327
|
[(visible)]="visible"
|
|
276
328
|
[appendTo]="'self'"
|
|
@@ -390,7 +442,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
390
442
|
</p-drawer>
|
|
391
443
|
`,
|
|
392
444
|
}]
|
|
393
|
-
}], ctorParameters: () => [], propDecorators: { visible: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }, { type: i0.Output, args: ["visibleChange"] }], connect: [{
|
|
445
|
+
}], ctorParameters: () => [], propDecorators: { visible: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }, { type: i0.Output, args: ["visibleChange"] }], pDrawer: [{ type: i0.ViewChild, args: [i0.forwardRef(() => Drawer), { isSignal: true }] }], connect: [{
|
|
394
446
|
type: Input,
|
|
395
447
|
args: [{ required: true }]
|
|
396
448
|
}] } });
|
|
@@ -403,6 +455,11 @@ class DrawerService {
|
|
|
403
455
|
doc = inject(DOCUMENT);
|
|
404
456
|
activeHosts = new Set();
|
|
405
457
|
animationCleanupBufferMs = 32;
|
|
458
|
+
// PrimeNG >= 21 ignores `transitionOptions` (deprecated in favour of
|
|
459
|
+
// `motionOptions`) and always runs the CSS `p-drawer-leave-*` keyframes,
|
|
460
|
+
// which last 0.5s. Destroying the host before that finishes rips the drawer
|
|
461
|
+
// out mid-slide and cuts PrimeNG's own mask cleanup short.
|
|
462
|
+
drawerLeaveAnimationMs = 500;
|
|
406
463
|
defauiltConfig = {
|
|
407
464
|
position: 'right',
|
|
408
465
|
modal: true,
|
|
@@ -476,11 +533,7 @@ class DrawerService {
|
|
|
476
533
|
}
|
|
477
534
|
lifecycle.closing = true;
|
|
478
535
|
lifecycle.hostRef.instance.hide();
|
|
479
|
-
const transitionDurationMs = this.readTransitionDurationMs(transitionOptions);
|
|
480
|
-
if (transitionDurationMs <= 0) {
|
|
481
|
-
this.cleanupHost(lifecycle);
|
|
482
|
-
return;
|
|
483
|
-
}
|
|
536
|
+
const transitionDurationMs = Math.max(this.readTransitionDurationMs(transitionOptions), this.drawerLeaveAnimationMs);
|
|
484
537
|
lifecycle.cleanupTimer = setTimeout(() => this.cleanupHost(lifecycle), transitionDurationMs + this.animationCleanupBufferMs);
|
|
485
538
|
}
|
|
486
539
|
cleanupHost(lifecycle) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masterteam-components-dynamic-drawer.mjs","sources":["../../../../packages/masterteam/components/dynamic-drawer/dynamic-drawer-host.ts","../../../../packages/masterteam/components/dynamic-drawer/dynamic-drawer.ts","../../../../packages/masterteam/components/dynamic-drawer/masterteam-components-dynamic-drawer.ts"],"sourcesContent":["import { DynamicDialogRef } from 'primeng/dynamicdialog';\r\nimport { DrawerModule } from 'primeng/drawer';\r\nimport {\r\n Component,\r\n ElementRef,\r\n Injector,\r\n Input,\r\n Renderer2,\r\n RendererStyleFlags2,\r\n effect,\r\n inject,\r\n signal,\r\n InjectionToken,\r\n model,\r\n computed,\r\n Injectable,\r\n OnDestroy,\r\n} from '@angular/core';\r\nimport { NgComponentOutlet } from '@angular/common';\r\nimport { TranslocoService } from '@jsverse/transloco';\r\nimport { Subscription } from 'rxjs';\r\n\r\nexport const DynamicDrawerConfig = new InjectionToken<any>(\r\n 'DynamicDrawerConfig',\r\n);\r\n\r\n/**\r\n * Controller to dynamically update drawer properties from inside the child component.\r\n * Inject this in your drawer content component to modify drawer behavior.\r\n */\r\n@Injectable()\r\nexport class DrawerController {\r\n private _styleClass = signal<string>('');\r\n private _header = signal<string>('');\r\n private _fullScreen = signal<boolean | undefined>(undefined);\r\n private _maximized = signal<boolean>(false);\r\n\r\n /** Get the current additional styleClass */\r\n get styleClass() {\r\n return this._styleClass;\r\n }\r\n\r\n /** Get the current header */\r\n get header() {\r\n return this._header;\r\n }\r\n\r\n /** Get the current fullScreen state */\r\n get fullScreen() {\r\n return this._fullScreen;\r\n }\r\n\r\n /** Get the current maximized (full-width) state */\r\n get maximized() {\r\n return this._maximized;\r\n }\r\n\r\n /** Add or replace the dynamic styleClass */\r\n setStyleClass(styleClass: string) {\r\n this._styleClass.set(styleClass);\r\n }\r\n\r\n /** Append a class to the existing styleClass */\r\n addClass(className: string) {\r\n const current = this._styleClass();\r\n if (!current.includes(className)) {\r\n this._styleClass.set((current + ' ' + className).trim());\r\n }\r\n }\r\n\r\n /** Remove a class from the styleClass */\r\n removeClass(className: string) {\r\n const current = this._styleClass();\r\n this._styleClass.set(\r\n current\r\n .split(' ')\r\n .filter((c) => c !== className)\r\n .join(' '),\r\n );\r\n }\r\n\r\n /** Toggle a class on/off */\r\n toggleClass(className: string) {\r\n if (this._styleClass().includes(className)) {\r\n this.removeClass(className);\r\n } else {\r\n this.addClass(className);\r\n }\r\n }\r\n\r\n /** Update the drawer header */\r\n setHeader(header: string) {\r\n this._header.set(header);\r\n }\r\n\r\n /** Toggle fullScreen mode */\r\n setFullScreen(fullScreen: boolean) {\r\n this._fullScreen.set(fullScreen);\r\n }\r\n\r\n /** Set maximized (full-width) state */\r\n setMaximized(maximized: boolean) {\r\n this._maximized.set(maximized);\r\n }\r\n\r\n /** Toggle maximized (full-width) state */\r\n toggleMaximized() {\r\n this._maximized.set(!this._maximized());\r\n }\r\n}\r\nimport { Button } from '@masterteam/components/button';\r\n\r\n@Component({\r\n selector: 'mt-dynamic-drawer-host',\r\n standalone: true,\r\n imports: [NgComponentOutlet, DrawerModule, Button],\r\n template: `\r\n <p-drawer\r\n [(visible)]=\"visible\"\r\n [appendTo]=\"'self'\"\r\n [style]=\"computedDrawerStyle()\"\r\n [closable]=\"cfg()?.closable\"\r\n [position]=\"cfg()?.position\"\r\n [fullScreen]=\"computedFullScreen()\"\r\n [modal]=\"cfg()?.modal\"\r\n [closeOnEscape]=\"cfg()?.closeOnEscape\"\r\n [dismissible]=\"cfg()?.dismissible\"\r\n [transitionOptions]=\"cfg()?.transitionOptions\"\r\n [styleClass]=\"computedStyleClass()\"\r\n (onShow)=\"onDrawerShow()\"\r\n (onHide)=\"onDrawerHide()\"\r\n >\r\n <ng-template #header>\r\n <div\r\n class=\"flex items-center justify-between px-5 w-full py-3 border-b border-surface\"\r\n >\r\n <h3 class=\"text-xl font-semibold\">{{ computedHeader() }}</h3>\r\n <div class=\"flex items-center gap-2\">\r\n @if (canShowMaximizeToggle()) {\r\n <mt-button\r\n (onClick)=\"toggleMaximized()\"\r\n variant=\"outlined\"\r\n styleClass=\"!bg-white\"\r\n severity=\"secondary\"\r\n [icon]=\"maximizeButtonIcon()\"\r\n [tooltip]=\"maximizeButtonTooltip()\"\r\n >\r\n </mt-button>\r\n }\r\n <mt-button\r\n (onClick)=\"handleHide()\"\r\n variant=\"outlined\"\r\n styleClass=\"!bg-white\"\r\n icon=\"general.x-close\"\r\n severity=\"secondary\"\r\n >\r\n </mt-button>\r\n </div>\r\n </div>\r\n </ng-template>\r\n @if (childInjector) {\r\n <ng-container\r\n *ngComponentOutlet=\"\r\n cmp();\r\n injector: childInjector;\r\n inputs: cmpInputs()\r\n \"\r\n >\r\n </ng-container>\r\n }\r\n </p-drawer>\r\n `,\r\n})\r\nexport class DynamicDrawerHost implements OnDestroy {\r\n public visible = model<boolean>(false);\r\n cmp = signal<any>(null);\r\n cfg = signal<any>({ position: 'right' });\r\n cmpInputs = signal<Record<string, unknown>>({});\r\n childInjector!: Injector;\r\n private ref?: DynamicDialogRef;\r\n private refCloseSubscription?: Subscription;\r\n private readonly fixedPosition = signal(true);\r\n // Guards against emitting onClose twice: the X button closes via\r\n // handleHide() (programmatic visible=false, no PrimeNG onHide), while a\r\n // backdrop click / Escape closes via PrimeNG's own close() which DOES emit\r\n // onHide. Without bridging onHide -> ref.close(), consumers never learn\r\n // about dismiss-by-outside-click / Escape.\r\n private closed = false;\r\n private drawerController = new DrawerController();\r\n private readonly host = inject(ElementRef<HTMLElement>);\r\n private readonly renderer = inject(Renderer2);\r\n private readonly transloco = inject(TranslocoService);\r\n private resizeAnimTimer: ReturnType<typeof setTimeout> | null = null;\r\n private readonly RESIZE_ANIM_CLASS = 'mt-drawer--anim-resize';\r\n private readonly RESIZE_ANIM_DURATION_MS = 700;\r\n\r\n constructor() {\r\n effect(() => {\r\n // React only when the user toggles maximize while the drawer is open.\r\n // Closing/opening goes through onDrawerShow / onDrawerHide so we never\r\n // race with PrimeNG's slide animation.\r\n const isMaximized = this.drawerController.maximized();\r\n if (!this.visible()) {\r\n return;\r\n }\r\n this.applyMaximizedInlineStyles(isMaximized, true);\r\n });\r\n }\r\n\r\n /** Computed styleClass combining config + dynamic controller class */\r\n computedStyleClass = computed(() => {\r\n const configClass = this.cfg()?.styleClass ?? '';\r\n const dynamicClass = this.drawerController.styleClass();\r\n const maximizedClass = this.drawerController.maximized()\r\n ? 'mt-drawer--maximized'\r\n : '';\r\n return `${configClass} ${dynamicClass} mt-drawer ${maximizedClass}`\r\n .replace(/\\s+/g, ' ')\r\n .trim();\r\n });\r\n\r\n /** Whether the maximize toggle button is visible in the header */\r\n canShowMaximizeToggle = computed(() => {\r\n const config = this.cfg();\r\n if (config?.showMaximizeToggle === false) {\r\n return false;\r\n }\r\n if (this.computedFullScreen()) {\r\n return false;\r\n }\r\n const position = config?.position ?? 'right';\r\n return position === 'left' || position === 'right';\r\n });\r\n\r\n /** Tooltip for maximize/restore button (state-aware) */\r\n maximizeButtonTooltip = computed(() => {\r\n const config = this.cfg();\r\n return this.drawerController.maximized()\r\n ? (config?.restoreTooltip ??\r\n this.transloco.translate('components.drawer.restoreSize'))\r\n : (config?.maximizeTooltip ??\r\n this.transloco.translate('components.drawer.expandFullWidth'));\r\n });\r\n\r\n /** Icon for maximize/restore button (state-aware) */\r\n maximizeButtonIcon = computed(() =>\r\n this.drawerController.maximized()\r\n ? 'layout.minimize-01'\r\n : 'layout.maximize-01',\r\n );\r\n\r\n /** Toggle the drawer's full-width state */\r\n toggleMaximized() {\r\n this.drawerController.toggleMaximized();\r\n }\r\n\r\n computedDrawerStyle = computed<Record<string, string> | null>(() => {\r\n return this.fixedPosition() ? { position: 'fixed' } : null;\r\n });\r\n\r\n /** Computed header - controller overrides config if set */\r\n computedHeader = computed(() => {\r\n const dynamicHeader = this.drawerController.header();\r\n return dynamicHeader || this.cfg()?.header || '';\r\n });\r\n\r\n /** Computed fullScreen - controller overrides config if set */\r\n computedFullScreen = computed(() => {\r\n const dynamicFullScreen = this.drawerController.fullScreen();\r\n return dynamicFullScreen !== undefined\r\n ? dynamicFullScreen\r\n : this.cfg()?.fullScreen;\r\n });\r\n\r\n @Input({ required: true })\r\n connect(opts: {\r\n component: any;\r\n config?: any;\r\n parent: Injector;\r\n ref: DynamicDialogRef;\r\n fixedPosition?: boolean;\r\n }) {\r\n this.cmp.set(opts.component);\r\n this.cfg.set(opts.config ?? {});\r\n this.cmpInputs.set(opts.config?.inputValues ?? {});\r\n this.ref = opts.ref;\r\n this.fixedPosition.set(\r\n opts.fixedPosition ??\r\n (!opts.config?.appendTo || opts.config?.appendTo === 'body'),\r\n );\r\n this.childInjector = Injector.create({\r\n parent: opts.parent,\r\n providers: [\r\n { provide: DynamicDrawerConfig, useValue: opts.config ?? {} },\r\n { provide: DynamicDialogRef, useValue: opts.ref },\r\n { provide: DrawerController, useValue: this.drawerController },\r\n ],\r\n });\r\n\r\n this.refCloseSubscription?.unsubscribe();\r\n this.refCloseSubscription = opts.ref.onClose.subscribe(() => {\r\n this.visible.set(false);\r\n });\r\n }\r\n\r\n show() {\r\n this.closed = false;\r\n this.visible.set(true);\r\n }\r\n\r\n hide() {\r\n this.visible.set(false);\r\n }\r\n\r\n handleHide(data = null) {\r\n this.visible.set(false);\r\n this.closeOnce(data);\r\n }\r\n\r\n /** Close the drawer ref at most once, regardless of the close path. */\r\n private closeOnce(data: unknown = null): void {\r\n if (this.closed) {\r\n return;\r\n }\r\n this.closed = true;\r\n this.ref?.close(data);\r\n }\r\n\r\n onDrawerShow() {\r\n // Drawer DOM only exists after PrimeNG renders it — apply current state\r\n // instantly so the open animation doesn't fight the resize transition.\r\n this.applyMaximizedInlineStyles(this.drawerController.maximized(), false);\r\n }\r\n\r\n onDrawerHide() {\r\n // Instant cleanup — close animation already done; we don't want to start\r\n // a 650ms width transition mid-hide.\r\n this.applyMaximizedInlineStyles(false, false);\r\n\r\n // PrimeNG emits (onHide) when the drawer is dismissed via backdrop click\r\n // or Escape (its close() -> hide(true)). The X button instead closes\r\n // programmatically (visible=false -> onAfterLeave -> hide(false)), so it\r\n // does not reach here. Bridge the dismiss paths to ref.close() so\r\n // consumers' onClose runs for every close path. closeOnce() de-dupes.\r\n this.closeOnce();\r\n }\r\n\r\n private getDrawerElement(): HTMLElement | null {\r\n return this.host.nativeElement.querySelector(\r\n '.p-drawer',\r\n ) as HTMLElement | null;\r\n }\r\n\r\n private applyMaximizedInlineStyles(\r\n isMaximized: boolean,\r\n animate: boolean,\r\n ): void {\r\n const drawerEl = this.getDrawerElement();\r\n if (!drawerEl) {\r\n return;\r\n }\r\n\r\n if (this.resizeAnimTimer) {\r\n clearTimeout(this.resizeAnimTimer);\r\n this.resizeAnimTimer = null;\r\n }\r\n\r\n if (animate) {\r\n this.renderer.addClass(drawerEl, this.RESIZE_ANIM_CLASS);\r\n this.resizeAnimTimer = setTimeout(() => {\r\n this.renderer.removeClass(drawerEl, this.RESIZE_ANIM_CLASS);\r\n this.resizeAnimTimer = null;\r\n }, this.RESIZE_ANIM_DURATION_MS);\r\n } else {\r\n this.renderer.removeClass(drawerEl, this.RESIZE_ANIM_CLASS);\r\n }\r\n\r\n if (isMaximized) {\r\n this.renderer.setStyle(\r\n drawerEl,\r\n 'width',\r\n '100%',\r\n RendererStyleFlags2.Important,\r\n );\r\n this.renderer.setStyle(\r\n drawerEl,\r\n 'max-width',\r\n '100%',\r\n RendererStyleFlags2.Important,\r\n );\r\n this.renderer.setStyle(\r\n drawerEl,\r\n 'height',\r\n '100%',\r\n RendererStyleFlags2.Important,\r\n );\r\n this.renderer.setStyle(\r\n drawerEl,\r\n 'max-height',\r\n '100%',\r\n RendererStyleFlags2.Important,\r\n );\r\n } else {\r\n this.renderer.removeStyle(drawerEl, 'width');\r\n this.renderer.removeStyle(drawerEl, 'max-width');\r\n this.renderer.removeStyle(drawerEl, 'height');\r\n this.renderer.removeStyle(drawerEl, 'max-height');\r\n }\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.refCloseSubscription?.unsubscribe();\r\n if (this.resizeAnimTimer) {\r\n clearTimeout(this.resizeAnimTimer);\r\n this.resizeAnimTimer = null;\r\n }\r\n }\r\n}\r\n","import { DOCUMENT } from '@angular/common';\r\nimport {\r\n ApplicationRef,\r\n ComponentRef,\r\n DestroyRef,\r\n EnvironmentInjector,\r\n Injectable,\r\n Injector,\r\n Type,\r\n createComponent,\r\n inject,\r\n} from '@angular/core';\r\nimport { DynamicDialogRef } from 'primeng/dynamicdialog';\r\nimport { Subscription } from 'rxjs';\r\n\r\nimport { DynamicDrawerHost } from './dynamic-drawer-host';\r\n\r\nexport interface DynamicDrawerConfigInterface {\r\n header?: string;\r\n position?: string;\r\n data?: any;\r\n fullScreen?: boolean;\r\n modal?: boolean;\r\n closable?: boolean;\r\n closeOnEscape?: boolean;\r\n dismissible?: boolean;\r\n appendTo?: any;\r\n transitionOptions?: string;\r\n styleClass?: string;\r\n inputValues?: any;\r\n showMaximizeToggle?: boolean;\r\n maximizeTooltip?: string;\r\n restoreTooltip?: string;\r\n}\r\n\r\ninterface DrawerHostLifecycle {\r\n hostRef: ComponentRef<DynamicDrawerHost>;\r\n hostElement: HTMLElement;\r\n closeSubscription?: Subscription;\r\n destroySubscription?: Subscription;\r\n cleanupTimer?: ReturnType<typeof setTimeout>;\r\n attached: boolean;\r\n closing: boolean;\r\n cleaned: boolean;\r\n}\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class DrawerService {\r\n private readonly appRef = inject(ApplicationRef);\r\n private readonly env = inject(EnvironmentInjector);\r\n private readonly rootInjector = inject(Injector);\r\n private readonly destroyRef = inject(DestroyRef);\r\n private readonly doc = inject(DOCUMENT);\r\n private readonly activeHosts = new Set<DrawerHostLifecycle>();\r\n private readonly animationCleanupBufferMs = 32;\r\n\r\n defauiltConfig: DynamicDrawerConfigInterface = {\r\n position: 'right',\r\n modal: true,\r\n closable: false,\r\n transitionOptions: '200ms cubic-bezier(0, 0, 1, 1)',\r\n inputValues: {},\r\n showMaximizeToggle: true,\r\n };\r\n\r\n constructor() {\r\n this.preloadDrawerHost();\r\n this.destroyRef.onDestroy(() => {\r\n for (const lifecycle of Array.from(this.activeHosts)) {\r\n this.cleanupHost(lifecycle);\r\n }\r\n });\r\n }\r\n\r\n open<T>(\r\n component: Type<any>,\r\n config: DynamicDrawerConfigInterface = {},\r\n ): DynamicDialogRef<T> {\r\n config = { ...this.defauiltConfig, ...config };\r\n\r\n const targetEl = this.resolveAppendTarget(config.appendTo);\r\n // Keep the host placement and the configuration exposed to the drawer\r\n // content in sync. In particular, a missing selector falls back to body;\r\n // consumers must not continue seeing the stale selector and infer that\r\n // the drawer is container-positioned.\r\n config = { ...config, appendTo: targetEl };\r\n const hostRef = createComponent(DynamicDrawerHost, {\r\n environmentInjector: this.env,\r\n });\r\n const ref = new DynamicDialogRef<T>();\r\n\r\n hostRef.instance.connect({\r\n component,\r\n config,\r\n parent: this.rootInjector,\r\n ref,\r\n fixedPosition: targetEl === this.doc.body,\r\n });\r\n\r\n const lifecycle: DrawerHostLifecycle = {\r\n hostRef,\r\n hostElement: hostRef.location.nativeElement as HTMLElement,\r\n attached: false,\r\n closing: false,\r\n cleaned: false,\r\n };\r\n this.activeHosts.add(lifecycle);\r\n\r\n this.appRef.attachView(hostRef.hostView);\r\n lifecycle.attached = true;\r\n targetEl.appendChild(lifecycle.hostElement);\r\n\r\n lifecycle.closeSubscription = ref.onClose.subscribe({\r\n next: () => this.closeHost(lifecycle, config.transitionOptions),\r\n error: () => this.cleanupHost(lifecycle),\r\n });\r\n lifecycle.destroySubscription = ref.onDestroy.subscribe({\r\n next: () => this.closeHost(lifecycle, config.transitionOptions),\r\n error: () => this.cleanupHost(lifecycle),\r\n });\r\n\r\n const openDrawer = () => {\r\n if (!lifecycle.closing && !lifecycle.cleaned) {\r\n hostRef.instance.show();\r\n }\r\n };\r\n\r\n if (this.doc.defaultView?.requestAnimationFrame) {\r\n this.doc.defaultView.requestAnimationFrame(openDrawer);\r\n } else {\r\n setTimeout(openDrawer, 0);\r\n }\r\n\r\n return ref;\r\n }\r\n\r\n private closeHost(\r\n lifecycle: DrawerHostLifecycle,\r\n transitionOptions?: string,\r\n ): void {\r\n if (lifecycle.closing || lifecycle.cleaned) {\r\n return;\r\n }\r\n\r\n lifecycle.closing = true;\r\n lifecycle.hostRef.instance.hide();\r\n\r\n const transitionDurationMs =\r\n this.readTransitionDurationMs(transitionOptions);\r\n if (transitionDurationMs <= 0) {\r\n this.cleanupHost(lifecycle);\r\n return;\r\n }\r\n\r\n lifecycle.cleanupTimer = setTimeout(\r\n () => this.cleanupHost(lifecycle),\r\n transitionDurationMs + this.animationCleanupBufferMs,\r\n );\r\n }\r\n\r\n private cleanupHost(lifecycle: DrawerHostLifecycle): void {\r\n if (lifecycle.cleaned) {\r\n return;\r\n }\r\n\r\n lifecycle.cleaned = true;\r\n if (lifecycle.cleanupTimer) {\r\n clearTimeout(lifecycle.cleanupTimer);\r\n lifecycle.cleanupTimer = undefined;\r\n }\r\n\r\n lifecycle.closeSubscription?.unsubscribe();\r\n lifecycle.destroySubscription?.unsubscribe();\r\n\r\n if (lifecycle.attached) {\r\n this.appRef.detachView(lifecycle.hostRef.hostView);\r\n lifecycle.attached = false;\r\n }\r\n lifecycle.hostRef.destroy();\r\n lifecycle.hostElement.remove();\r\n this.activeHosts.delete(lifecycle);\r\n }\r\n\r\n private readTransitionDurationMs(transitionOptions?: string): number {\r\n if (!transitionOptions) {\r\n return 0;\r\n }\r\n\r\n const match = transitionOptions.match(/(-?\\d*\\.?\\d+)\\s*(ms|s)\\b/i);\r\n if (!match) {\r\n return 0;\r\n }\r\n\r\n const value = Math.max(0, Number(match[1]));\r\n return match[2].toLowerCase() === 's' ? value * 1000 : value;\r\n }\r\n\r\n private preloadDrawerHost(): void {\r\n const preloadHostRef = createComponent(DynamicDrawerHost, {\r\n environmentInjector: this.env,\r\n });\r\n const preloadElement = preloadHostRef.location.nativeElement as HTMLElement;\r\n\r\n preloadElement.style.display = 'none';\r\n\r\n this.appRef.attachView(preloadHostRef.hostView);\r\n this.doc.body.appendChild(preloadElement);\r\n preloadHostRef.changeDetectorRef.detectChanges();\r\n this.appRef.detachView(preloadHostRef.hostView);\r\n preloadElement.remove();\r\n preloadHostRef.destroy();\r\n }\r\n\r\n private resolveAppendTarget(appendTo?: string | HTMLElement): HTMLElement {\r\n if (!appendTo || appendTo === 'body') {\r\n return this.doc.body;\r\n }\r\n\r\n if (typeof appendTo === 'string') {\r\n const selector =\r\n appendTo.startsWith('#') || appendTo.startsWith('.')\r\n ? appendTo\r\n : `#${appendTo}`;\r\n return (\r\n (this.doc.querySelector(selector) as HTMLElement | null) ??\r\n this.doc.body\r\n );\r\n }\r\n\r\n return appendTo;\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;MAsBa,mBAAmB,GAAG,IAAI,cAAc,CACnD,qBAAqB;AAGvB;;;AAGG;MAEU,gBAAgB,CAAA;AACnB,IAAA,WAAW,GAAG,MAAM,CAAS,EAAE,kFAAC;AAChC,IAAA,OAAO,GAAG,MAAM,CAAS,EAAE,8EAAC;AAC5B,IAAA,WAAW,GAAG,MAAM,CAAsB,SAAS,kFAAC;AACpD,IAAA,UAAU,GAAG,MAAM,CAAU,KAAK,iFAAC;;AAG3C,IAAA,IAAI,UAAU,GAAA;QACZ,OAAO,IAAI,CAAC,WAAW;IACzB;;AAGA,IAAA,IAAI,MAAM,GAAA;QACR,OAAO,IAAI,CAAC,OAAO;IACrB;;AAGA,IAAA,IAAI,UAAU,GAAA;QACZ,OAAO,IAAI,CAAC,WAAW;IACzB;;AAGA,IAAA,IAAI,SAAS,GAAA;QACX,OAAO,IAAI,CAAC,UAAU;IACxB;;AAGA,IAAA,aAAa,CAAC,UAAkB,EAAA;AAC9B,QAAA,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC;IAClC;;AAGA,IAAA,QAAQ,CAAC,SAAiB,EAAA;AACxB,QAAA,MAAM,OAAO,GAAG,IAAI,CAAC,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AQ,CAAA,CAAE;YACpB,QACG,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAwB;AACxD,gBAAA,IAAI,CAAC,GAAG,CAAC,IAAI;QAEjB;AAEA,QAAA,OAAO,QAAQ;IACjB;uGAvLW,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAb,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,cADA,MAAM,EAAA,CAAA;;2FACnB,aAAa,EAAA,UAAA,EAAA,CAAA;kBADzB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;AC9ClC;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"masterteam-components-dynamic-drawer.mjs","sources":["../../../../packages/masterteam/components/dynamic-drawer/dynamic-drawer-host.ts","../../../../packages/masterteam/components/dynamic-drawer/dynamic-drawer.ts","../../../../packages/masterteam/components/dynamic-drawer/masterteam-components-dynamic-drawer.ts"],"sourcesContent":["import { DynamicDialogRef } from 'primeng/dynamicdialog';\r\nimport { Drawer as PrimeDrawer, DrawerModule } from 'primeng/drawer';\r\nimport {\r\n Component,\r\n ElementRef,\r\n Injector,\r\n Input,\r\n Renderer2,\r\n RendererStyleFlags2,\r\n effect,\r\n inject,\r\n signal,\r\n InjectionToken,\r\n model,\r\n computed,\r\n viewChild,\r\n Injectable,\r\n OnDestroy,\r\n} from '@angular/core';\r\nimport { NgComponentOutlet } from '@angular/common';\r\nimport { TranslocoService } from '@jsverse/transloco';\r\nimport { Subscription } from 'rxjs';\r\n\r\nexport const DynamicDrawerConfig = new InjectionToken<any>(\r\n 'DynamicDrawerConfig',\r\n);\r\n\r\n/**\r\n * Controller to dynamically update drawer properties from inside the child component.\r\n * Inject this in your drawer content component to modify drawer behavior.\r\n */\r\n@Injectable()\r\nexport class DrawerController {\r\n private _styleClass = signal<string>('');\r\n private _header = signal<string>('');\r\n private _fullScreen = signal<boolean | undefined>(undefined);\r\n private _maximized = signal<boolean>(false);\r\n\r\n /** Get the current additional styleClass */\r\n get styleClass() {\r\n return this._styleClass;\r\n }\r\n\r\n /** Get the current header */\r\n get header() {\r\n return this._header;\r\n }\r\n\r\n /** Get the current fullScreen state */\r\n get fullScreen() {\r\n return this._fullScreen;\r\n }\r\n\r\n /** Get the current maximized (full-width) state */\r\n get maximized() {\r\n return this._maximized;\r\n }\r\n\r\n /** Add or replace the dynamic styleClass */\r\n setStyleClass(styleClass: string) {\r\n this._styleClass.set(styleClass);\r\n }\r\n\r\n /** Append a class to the existing styleClass */\r\n addClass(className: string) {\r\n const current = this._styleClass();\r\n if (!current.includes(className)) {\r\n this._styleClass.set((current + ' ' + className).trim());\r\n }\r\n }\r\n\r\n /** Remove a class from the styleClass */\r\n removeClass(className: string) {\r\n const current = this._styleClass();\r\n this._styleClass.set(\r\n current\r\n .split(' ')\r\n .filter((c) => c !== className)\r\n .join(' '),\r\n );\r\n }\r\n\r\n /** Toggle a class on/off */\r\n toggleClass(className: string) {\r\n if (this._styleClass().includes(className)) {\r\n this.removeClass(className);\r\n } else {\r\n this.addClass(className);\r\n }\r\n }\r\n\r\n /** Update the drawer header */\r\n setHeader(header: string) {\r\n this._header.set(header);\r\n }\r\n\r\n /** Toggle fullScreen mode */\r\n setFullScreen(fullScreen: boolean) {\r\n this._fullScreen.set(fullScreen);\r\n }\r\n\r\n /** Set maximized (full-width) state */\r\n setMaximized(maximized: boolean) {\r\n this._maximized.set(maximized);\r\n }\r\n\r\n /** Toggle maximized (full-width) state */\r\n toggleMaximized() {\r\n this._maximized.set(!this._maximized());\r\n }\r\n}\r\nimport { Button } from '@masterteam/components/button';\r\n\r\n@Component({\r\n selector: 'mt-dynamic-drawer-host',\r\n standalone: true,\r\n imports: [NgComponentOutlet, DrawerModule, Button],\r\n template: `\r\n <p-drawer\r\n [(visible)]=\"visible\"\r\n [appendTo]=\"'self'\"\r\n [style]=\"computedDrawerStyle()\"\r\n [closable]=\"cfg()?.closable\"\r\n [position]=\"cfg()?.position\"\r\n [fullScreen]=\"computedFullScreen()\"\r\n [modal]=\"cfg()?.modal\"\r\n [closeOnEscape]=\"cfg()?.closeOnEscape\"\r\n [dismissible]=\"cfg()?.dismissible\"\r\n [transitionOptions]=\"cfg()?.transitionOptions\"\r\n [styleClass]=\"computedStyleClass()\"\r\n (onShow)=\"onDrawerShow()\"\r\n (onHide)=\"onDrawerHide()\"\r\n >\r\n <ng-template #header>\r\n <div\r\n class=\"flex items-center justify-between px-5 w-full py-3 border-b border-surface\"\r\n >\r\n <h3 class=\"text-xl font-semibold\">{{ computedHeader() }}</h3>\r\n <div class=\"flex items-center gap-2\">\r\n @if (canShowMaximizeToggle()) {\r\n <mt-button\r\n (onClick)=\"toggleMaximized()\"\r\n variant=\"outlined\"\r\n styleClass=\"!bg-white\"\r\n severity=\"secondary\"\r\n [icon]=\"maximizeButtonIcon()\"\r\n [tooltip]=\"maximizeButtonTooltip()\"\r\n >\r\n </mt-button>\r\n }\r\n <mt-button\r\n (onClick)=\"handleHide()\"\r\n variant=\"outlined\"\r\n styleClass=\"!bg-white\"\r\n icon=\"general.x-close\"\r\n severity=\"secondary\"\r\n >\r\n </mt-button>\r\n </div>\r\n </div>\r\n </ng-template>\r\n @if (childInjector) {\r\n <ng-container\r\n *ngComponentOutlet=\"\r\n cmp();\r\n injector: childInjector;\r\n inputs: cmpInputs()\r\n \"\r\n >\r\n </ng-container>\r\n }\r\n </p-drawer>\r\n `,\r\n})\r\nexport class DynamicDrawerHost implements OnDestroy {\r\n public visible = model<boolean>(false);\r\n private readonly pDrawer = viewChild(PrimeDrawer);\r\n // Cached so ngOnDestroy never has to read a query on a view that is already\r\n // being torn down.\r\n private primeDrawer: PrimeDrawer | null = null;\r\n cmp = signal<any>(null);\r\n cfg = signal<any>({ position: 'right' });\r\n cmpInputs = signal<Record<string, unknown>>({});\r\n childInjector!: Injector;\r\n private ref?: DynamicDialogRef;\r\n private refCloseSubscription?: Subscription;\r\n private readonly fixedPosition = signal(true);\r\n // Guards against emitting onClose twice: the X button closes via\r\n // handleHide() (programmatic visible=false, no PrimeNG onHide), while a\r\n // backdrop click / Escape closes via PrimeNG's own close() which DOES emit\r\n // onHide. Without bridging onHide -> ref.close(), consumers never learn\r\n // about dismiss-by-outside-click / Escape.\r\n private closed = false;\r\n private drawerController = new DrawerController();\r\n private readonly host = inject(ElementRef<HTMLElement>);\r\n private readonly renderer = inject(Renderer2);\r\n private readonly transloco = inject(TranslocoService);\r\n private resizeAnimTimer: ReturnType<typeof setTimeout> | null = null;\r\n private readonly RESIZE_ANIM_CLASS = 'mt-drawer--anim-resize';\r\n private readonly RESIZE_ANIM_DURATION_MS = 700;\r\n\r\n constructor() {\r\n effect(() => {\r\n // React only when the user toggles maximize while the drawer is open.\r\n // Closing/opening goes through onDrawerShow / onDrawerHide so we never\r\n // race with PrimeNG's slide animation.\r\n const isMaximized = this.drawerController.maximized();\r\n if (!this.visible()) {\r\n return;\r\n }\r\n this.applyMaximizedInlineStyles(isMaximized, true);\r\n });\r\n }\r\n\r\n /** Computed styleClass combining config + dynamic controller class */\r\n computedStyleClass = computed(() => {\r\n const configClass = this.cfg()?.styleClass ?? '';\r\n const dynamicClass = this.drawerController.styleClass();\r\n const maximizedClass = this.drawerController.maximized()\r\n ? 'mt-drawer--maximized'\r\n : '';\r\n return `${configClass} ${dynamicClass} mt-drawer ${maximizedClass}`\r\n .replace(/\\s+/g, ' ')\r\n .trim();\r\n });\r\n\r\n /** Whether the maximize toggle button is visible in the header */\r\n canShowMaximizeToggle = computed(() => {\r\n const config = this.cfg();\r\n if (config?.showMaximizeToggle === false) {\r\n return false;\r\n }\r\n if (this.computedFullScreen()) {\r\n return false;\r\n }\r\n const position = config?.position ?? 'right';\r\n return position === 'left' || position === 'right';\r\n });\r\n\r\n /** Tooltip for maximize/restore button (state-aware) */\r\n maximizeButtonTooltip = computed(() => {\r\n const config = this.cfg();\r\n return this.drawerController.maximized()\r\n ? (config?.restoreTooltip ??\r\n this.transloco.translate('components.drawer.restoreSize'))\r\n : (config?.maximizeTooltip ??\r\n this.transloco.translate('components.drawer.expandFullWidth'));\r\n });\r\n\r\n /** Icon for maximize/restore button (state-aware) */\r\n maximizeButtonIcon = computed(() =>\r\n this.drawerController.maximized()\r\n ? 'layout.minimize-01'\r\n : 'layout.maximize-01',\r\n );\r\n\r\n /** Toggle the drawer's full-width state */\r\n toggleMaximized() {\r\n this.drawerController.toggleMaximized();\r\n }\r\n\r\n computedDrawerStyle = computed<Record<string, string> | null>(() => {\r\n return this.fixedPosition() ? { position: 'fixed' } : null;\r\n });\r\n\r\n /** Computed header - controller overrides config if set */\r\n computedHeader = computed(() => {\r\n const dynamicHeader = this.drawerController.header();\r\n return dynamicHeader || this.cfg()?.header || '';\r\n });\r\n\r\n /** Computed fullScreen - controller overrides config if set */\r\n computedFullScreen = computed(() => {\r\n const dynamicFullScreen = this.drawerController.fullScreen();\r\n return dynamicFullScreen !== undefined\r\n ? dynamicFullScreen\r\n : this.cfg()?.fullScreen;\r\n });\r\n\r\n @Input({ required: true })\r\n connect(opts: {\r\n component: any;\r\n config?: any;\r\n parent: Injector;\r\n ref: DynamicDialogRef;\r\n fixedPosition?: boolean;\r\n }) {\r\n this.cmp.set(opts.component);\r\n this.cfg.set(opts.config ?? {});\r\n this.cmpInputs.set(opts.config?.inputValues ?? {});\r\n this.ref = opts.ref;\r\n this.fixedPosition.set(\r\n opts.fixedPosition ??\r\n (!opts.config?.appendTo || opts.config?.appendTo === 'body'),\r\n );\r\n this.childInjector = Injector.create({\r\n parent: opts.parent,\r\n providers: [\r\n { provide: DynamicDrawerConfig, useValue: opts.config ?? {} },\r\n { provide: DynamicDialogRef, useValue: opts.ref },\r\n { provide: DrawerController, useValue: this.drawerController },\r\n ],\r\n });\r\n\r\n this.refCloseSubscription?.unsubscribe();\r\n this.refCloseSubscription = opts.ref.onClose.subscribe(() => {\r\n this.visible.set(false);\r\n });\r\n }\r\n\r\n show() {\r\n this.closed = false;\r\n this.visible.set(true);\r\n }\r\n\r\n hide() {\r\n this.visible.set(false);\r\n this.beginMaskTeardown();\r\n }\r\n\r\n handleHide(data = null) {\r\n this.visible.set(false);\r\n this.beginMaskTeardown();\r\n this.closeOnce(data);\r\n }\r\n\r\n /** Close the drawer ref at most once, regardless of the close path. */\r\n private closeOnce(data: unknown = null): void {\r\n if (this.closed) {\r\n return;\r\n }\r\n this.closed = true;\r\n this.ref?.close(data);\r\n }\r\n\r\n onDrawerShow() {\r\n this.primeDrawer = this.pDrawer() ?? null;\r\n // Drawer DOM only exists after PrimeNG renders it — apply current state\r\n // instantly so the open animation doesn't fight the resize transition.\r\n this.applyMaximizedInlineStyles(this.drawerController.maximized(), false);\r\n }\r\n\r\n onDrawerHide() {\r\n // Instant cleanup — close animation already done; we don't want to start\r\n // a 650ms width transition mid-hide.\r\n this.applyMaximizedInlineStyles(false, false);\r\n\r\n // PrimeNG emits (onHide) when the drawer is dismissed via backdrop click\r\n // or Escape (its close() -> hide(true)). The X button instead closes\r\n // programmatically (visible=false -> onAfterLeave -> hide(false)), so it\r\n // does not reach here. Bridge the dismiss paths to ref.close() so\r\n // consumers' onClose runs for every close path. closeOnce() de-dupes.\r\n this.closeOnce();\r\n }\r\n\r\n /**\r\n * PrimeNG appends the drawer's modal mask to `<body>` — not to `appendTo` —\r\n * and only removes it from its own dismiss paths (mask click / Escape ->\r\n * close() -> disableModality() -> animationend -> destroyModal()). Every\r\n * programmatic close (the header X, `ref.close()` from the content\r\n * component, DrawerService.closeHost) skips those paths, and p-drawer's own\r\n * ngOnDestroy is guarded by `if (this.visible && this.modal)` — `visible` is\r\n * already false by then, so it cleans up nothing.\r\n *\r\n * The leftover `.p-overlay-mask` is `position: fixed` and covers the whole\r\n * viewport, so the app silently stops responding to clicks until a reload.\r\n * Drive PrimeNG's teardown explicitly instead: fade the mask out when the\r\n * drawer starts closing, and hard-remove it when the host is destroyed.\r\n */\r\n private beginMaskTeardown(): void {\r\n const drawer = this.resolvePrimeDrawer();\r\n const mask = drawer?.mask;\r\n if (!drawer || !mask) {\r\n return;\r\n }\r\n\r\n // PrimeNG already started its own fade (mask click / Escape) — don't\r\n // re-bind a second animationend listener on top of it.\r\n if (mask.classList.contains('p-overlay-mask-leave-active')) {\r\n return;\r\n }\r\n\r\n drawer.disableModality();\r\n }\r\n\r\n /**\r\n * Only consults the cached instance — this also runs from ngOnDestroy, where\r\n * reading a view query is not safe. A drawer that never opened never created\r\n * a mask, so there is nothing to miss.\r\n */\r\n private forceMaskTeardown(): void {\r\n if (this.primeDrawer?.mask) {\r\n this.primeDrawer.destroyModal();\r\n }\r\n }\r\n\r\n private resolvePrimeDrawer(): PrimeDrawer | null {\r\n this.primeDrawer ??= this.pDrawer() ?? null;\r\n return this.primeDrawer;\r\n }\r\n\r\n private getDrawerElement(): HTMLElement | null {\r\n return this.host.nativeElement.querySelector(\r\n '.p-drawer',\r\n ) as HTMLElement | null;\r\n }\r\n\r\n private applyMaximizedInlineStyles(\r\n isMaximized: boolean,\r\n animate: boolean,\r\n ): void {\r\n const drawerEl = this.getDrawerElement();\r\n if (!drawerEl) {\r\n return;\r\n }\r\n\r\n if (this.resizeAnimTimer) {\r\n clearTimeout(this.resizeAnimTimer);\r\n this.resizeAnimTimer = null;\r\n }\r\n\r\n if (animate) {\r\n this.renderer.addClass(drawerEl, this.RESIZE_ANIM_CLASS);\r\n this.resizeAnimTimer = setTimeout(() => {\r\n this.renderer.removeClass(drawerEl, this.RESIZE_ANIM_CLASS);\r\n this.resizeAnimTimer = null;\r\n }, this.RESIZE_ANIM_DURATION_MS);\r\n } else {\r\n this.renderer.removeClass(drawerEl, this.RESIZE_ANIM_CLASS);\r\n }\r\n\r\n if (isMaximized) {\r\n this.renderer.setStyle(\r\n drawerEl,\r\n 'width',\r\n '100%',\r\n RendererStyleFlags2.Important,\r\n );\r\n this.renderer.setStyle(\r\n drawerEl,\r\n 'max-width',\r\n '100%',\r\n RendererStyleFlags2.Important,\r\n );\r\n this.renderer.setStyle(\r\n drawerEl,\r\n 'height',\r\n '100%',\r\n RendererStyleFlags2.Important,\r\n );\r\n this.renderer.setStyle(\r\n drawerEl,\r\n 'max-height',\r\n '100%',\r\n RendererStyleFlags2.Important,\r\n );\r\n } else {\r\n this.renderer.removeStyle(drawerEl, 'width');\r\n this.renderer.removeStyle(drawerEl, 'max-width');\r\n this.renderer.removeStyle(drawerEl, 'height');\r\n this.renderer.removeStyle(drawerEl, 'max-height');\r\n }\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.refCloseSubscription?.unsubscribe();\r\n if (this.resizeAnimTimer) {\r\n clearTimeout(this.resizeAnimTimer);\r\n this.resizeAnimTimer = null;\r\n }\r\n // Last line of defence: the mask lives in <body>, so it outlives this host\r\n // element unless we remove it ourselves.\r\n this.forceMaskTeardown();\r\n this.primeDrawer = null;\r\n }\r\n}\r\n","import { DOCUMENT } from '@angular/common';\r\nimport {\r\n ApplicationRef,\r\n ComponentRef,\r\n DestroyRef,\r\n EnvironmentInjector,\r\n Injectable,\r\n Injector,\r\n Type,\r\n createComponent,\r\n inject,\r\n} from '@angular/core';\r\nimport { DynamicDialogRef } from 'primeng/dynamicdialog';\r\nimport { Subscription } from 'rxjs';\r\n\r\nimport { DynamicDrawerHost } from './dynamic-drawer-host';\r\n\r\nexport interface DynamicDrawerConfigInterface {\r\n header?: string;\r\n position?: string;\r\n data?: any;\r\n fullScreen?: boolean;\r\n modal?: boolean;\r\n closable?: boolean;\r\n closeOnEscape?: boolean;\r\n dismissible?: boolean;\r\n appendTo?: any;\r\n transitionOptions?: string;\r\n styleClass?: string;\r\n inputValues?: any;\r\n showMaximizeToggle?: boolean;\r\n maximizeTooltip?: string;\r\n restoreTooltip?: string;\r\n}\r\n\r\ninterface DrawerHostLifecycle {\r\n hostRef: ComponentRef<DynamicDrawerHost>;\r\n hostElement: HTMLElement;\r\n closeSubscription?: Subscription;\r\n destroySubscription?: Subscription;\r\n cleanupTimer?: ReturnType<typeof setTimeout>;\r\n attached: boolean;\r\n closing: boolean;\r\n cleaned: boolean;\r\n}\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class DrawerService {\r\n private readonly appRef = inject(ApplicationRef);\r\n private readonly env = inject(EnvironmentInjector);\r\n private readonly rootInjector = inject(Injector);\r\n private readonly destroyRef = inject(DestroyRef);\r\n private readonly doc = inject(DOCUMENT);\r\n private readonly activeHosts = new Set<DrawerHostLifecycle>();\r\n private readonly animationCleanupBufferMs = 32;\r\n // PrimeNG >= 21 ignores `transitionOptions` (deprecated in favour of\r\n // `motionOptions`) and always runs the CSS `p-drawer-leave-*` keyframes,\r\n // which last 0.5s. Destroying the host before that finishes rips the drawer\r\n // out mid-slide and cuts PrimeNG's own mask cleanup short.\r\n private readonly drawerLeaveAnimationMs = 500;\r\n\r\n defauiltConfig: DynamicDrawerConfigInterface = {\r\n position: 'right',\r\n modal: true,\r\n closable: false,\r\n transitionOptions: '200ms cubic-bezier(0, 0, 1, 1)',\r\n inputValues: {},\r\n showMaximizeToggle: true,\r\n };\r\n\r\n constructor() {\r\n this.preloadDrawerHost();\r\n this.destroyRef.onDestroy(() => {\r\n for (const lifecycle of Array.from(this.activeHosts)) {\r\n this.cleanupHost(lifecycle);\r\n }\r\n });\r\n }\r\n\r\n open<T>(\r\n component: Type<any>,\r\n config: DynamicDrawerConfigInterface = {},\r\n ): DynamicDialogRef<T> {\r\n config = { ...this.defauiltConfig, ...config };\r\n\r\n const targetEl = this.resolveAppendTarget(config.appendTo);\r\n // Keep the host placement and the configuration exposed to the drawer\r\n // content in sync. In particular, a missing selector falls back to body;\r\n // consumers must not continue seeing the stale selector and infer that\r\n // the drawer is container-positioned.\r\n config = { ...config, appendTo: targetEl };\r\n const hostRef = createComponent(DynamicDrawerHost, {\r\n environmentInjector: this.env,\r\n });\r\n const ref = new DynamicDialogRef<T>();\r\n\r\n hostRef.instance.connect({\r\n component,\r\n config,\r\n parent: this.rootInjector,\r\n ref,\r\n fixedPosition: targetEl === this.doc.body,\r\n });\r\n\r\n const lifecycle: DrawerHostLifecycle = {\r\n hostRef,\r\n hostElement: hostRef.location.nativeElement as HTMLElement,\r\n attached: false,\r\n closing: false,\r\n cleaned: false,\r\n };\r\n this.activeHosts.add(lifecycle);\r\n\r\n this.appRef.attachView(hostRef.hostView);\r\n lifecycle.attached = true;\r\n targetEl.appendChild(lifecycle.hostElement);\r\n\r\n lifecycle.closeSubscription = ref.onClose.subscribe({\r\n next: () => this.closeHost(lifecycle, config.transitionOptions),\r\n error: () => this.cleanupHost(lifecycle),\r\n });\r\n lifecycle.destroySubscription = ref.onDestroy.subscribe({\r\n next: () => this.closeHost(lifecycle, config.transitionOptions),\r\n error: () => this.cleanupHost(lifecycle),\r\n });\r\n\r\n const openDrawer = () => {\r\n if (!lifecycle.closing && !lifecycle.cleaned) {\r\n hostRef.instance.show();\r\n }\r\n };\r\n\r\n if (this.doc.defaultView?.requestAnimationFrame) {\r\n this.doc.defaultView.requestAnimationFrame(openDrawer);\r\n } else {\r\n setTimeout(openDrawer, 0);\r\n }\r\n\r\n return ref;\r\n }\r\n\r\n private closeHost(\r\n lifecycle: DrawerHostLifecycle,\r\n transitionOptions?: string,\r\n ): void {\r\n if (lifecycle.closing || lifecycle.cleaned) {\r\n return;\r\n }\r\n\r\n lifecycle.closing = true;\r\n lifecycle.hostRef.instance.hide();\r\n\r\n const transitionDurationMs = Math.max(\r\n this.readTransitionDurationMs(transitionOptions),\r\n this.drawerLeaveAnimationMs,\r\n );\r\n\r\n lifecycle.cleanupTimer = setTimeout(\r\n () => this.cleanupHost(lifecycle),\r\n transitionDurationMs + this.animationCleanupBufferMs,\r\n );\r\n }\r\n\r\n private cleanupHost(lifecycle: DrawerHostLifecycle): void {\r\n if (lifecycle.cleaned) {\r\n return;\r\n }\r\n\r\n lifecycle.cleaned = true;\r\n if (lifecycle.cleanupTimer) {\r\n clearTimeout(lifecycle.cleanupTimer);\r\n lifecycle.cleanupTimer = undefined;\r\n }\r\n\r\n lifecycle.closeSubscription?.unsubscribe();\r\n lifecycle.destroySubscription?.unsubscribe();\r\n\r\n if (lifecycle.attached) {\r\n this.appRef.detachView(lifecycle.hostRef.hostView);\r\n lifecycle.attached = false;\r\n }\r\n lifecycle.hostRef.destroy();\r\n lifecycle.hostElement.remove();\r\n this.activeHosts.delete(lifecycle);\r\n }\r\n\r\n private readTransitionDurationMs(transitionOptions?: string): number {\r\n if (!transitionOptions) {\r\n return 0;\r\n }\r\n\r\n const match = transitionOptions.match(/(-?\\d*\\.?\\d+)\\s*(ms|s)\\b/i);\r\n if (!match) {\r\n return 0;\r\n }\r\n\r\n const value = Math.max(0, Number(match[1]));\r\n return match[2].toLowerCase() === 's' ? value * 1000 : value;\r\n }\r\n\r\n private preloadDrawerHost(): void {\r\n const preloadHostRef = createComponent(DynamicDrawerHost, {\r\n environmentInjector: this.env,\r\n });\r\n const preloadElement = preloadHostRef.location.nativeElement as HTMLElement;\r\n\r\n preloadElement.style.display = 'none';\r\n\r\n this.appRef.attachView(preloadHostRef.hostView);\r\n this.doc.body.appendChild(preloadElement);\r\n preloadHostRef.changeDetectorRef.detectChanges();\r\n this.appRef.detachView(preloadHostRef.hostView);\r\n preloadElement.remove();\r\n preloadHostRef.destroy();\r\n }\r\n\r\n private resolveAppendTarget(appendTo?: string | HTMLElement): HTMLElement {\r\n if (!appendTo || appendTo === 'body') {\r\n return this.doc.body;\r\n }\r\n\r\n if (typeof appendTo === 'string') {\r\n const selector =\r\n appendTo.startsWith('#') || appendTo.startsWith('.')\r\n ? appendTo\r\n : `#${appendTo}`;\r\n return (\r\n (this.doc.querySelector(selector) as HTMLElement | null) ??\r\n this.doc.body\r\n );\r\n }\r\n\r\n return appendTo;\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["PrimeDrawer"],"mappings":";;;;;;;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C,QAAA,cAAc,CAAC,iBAAiB,CAAC,aAAa,EAAE;QAChD,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,QAAQ,CAAC;QAC/C,cAAc,CAAC,MAAM,EAAE;QACvB,cAAc,CAAC,OAAO,EAAE;IAC1B;AAEQ,IAAA,mBAAmB,CAAC,QAA+B,EAAA;AACzD,QAAA,IAAI,CAAC,QAAQ,IAAI,QAAQ,KAAK,MAAM,EAAE;AACpC,YAAA,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI;QACtB;AAEA,QAAA,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;AAChC,YAAA,MAAM,QAAQ,GACZ,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG;AACjD,kBAAE;AACF,kBAAE,CAAA,CAAA,EAAI,QAAQ,CAAA,CAAE;YACpB,QACG,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAwB;AACxD,gBAAA,IAAI,CAAC,GAAG,CAAC,IAAI;QAEjB;AAEA,QAAA,OAAO,QAAQ;IACjB;uGA1LW,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAb,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,cADA,MAAM,EAAA,CAAA;;2FACnB,aAAa,EAAA,UAAA,EAAA,CAAA;kBADzB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;AC9ClC;;AAEG;;;;"}
|
|
@@ -15,8 +15,8 @@ import { forkJoin, finalize, of, take, switchMap, EMPTY, map, catchError } from
|
|
|
15
15
|
import { Chip } from '@masterteam/components/chip';
|
|
16
16
|
import * as i1$1 from 'primeng/tooltip';
|
|
17
17
|
import { TooltipModule } from 'primeng/tooltip';
|
|
18
|
+
import { NgTemplateOutlet, DOCUMENT } from '@angular/common';
|
|
18
19
|
import { CdkDrag, CdkDropList, CdkDragPlaceholder } from '@angular/cdk/drag-drop';
|
|
19
|
-
import { DOCUMENT } from '@angular/common';
|
|
20
20
|
|
|
21
21
|
const ENTITY_EMPTY_VALUE_PLACEHOLDER = '_';
|
|
22
22
|
function isValueMissing(value) {
|
|
@@ -1276,6 +1276,76 @@ function buildDisplayEntities(entities) {
|
|
|
1276
1276
|
.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
1277
1277
|
}
|
|
1278
1278
|
|
|
1279
|
+
/**
|
|
1280
|
+
* A section is persisted/transported as an ordinary display item whose
|
|
1281
|
+
* `propertyKey` carries this sentinel prefix instead of a real property key
|
|
1282
|
+
* (mirrors the LeafDetails synthetic-key convention). Both the customization
|
|
1283
|
+
* builder and the runtime renderer recognize it, so the constant lives here in
|
|
1284
|
+
* the shared entities layer rather than in either consumer.
|
|
1285
|
+
*/
|
|
1286
|
+
const SECTION_KEY_PREFIX = '__section__::';
|
|
1287
|
+
/** True when a display item's key denotes a section marker. */
|
|
1288
|
+
function isSectionKey(key) {
|
|
1289
|
+
return typeof key === 'string' && key.startsWith(SECTION_KEY_PREFIX);
|
|
1290
|
+
}
|
|
1291
|
+
/** Mints a unique section marker key. */
|
|
1292
|
+
function buildSectionKey() {
|
|
1293
|
+
return `${SECTION_KEY_PREFIX}${crypto.randomUUID()}`;
|
|
1294
|
+
}
|
|
1295
|
+
/**
|
|
1296
|
+
* Resolves a localized label (`{ en, ar }`) for the given language, falling
|
|
1297
|
+
* back across locales. Returns '' when nothing is set.
|
|
1298
|
+
*/
|
|
1299
|
+
function resolveLocalizedLabel(label, lang) {
|
|
1300
|
+
if (!label)
|
|
1301
|
+
return '';
|
|
1302
|
+
const primary = lang === 'ar' ? label.ar : label.en;
|
|
1303
|
+
return (primary || label.en || label.ar || '').trim();
|
|
1304
|
+
}
|
|
1305
|
+
/** True when the entity is a `Section` layout marker rather than a value. */
|
|
1306
|
+
function isEntitySection(entity) {
|
|
1307
|
+
return entity?.viewType === 'Section';
|
|
1308
|
+
}
|
|
1309
|
+
/**
|
|
1310
|
+
* Splits a flat, order-sorted entity list into section groups. Membership is
|
|
1311
|
+
* purely positional: each entity belongs to whichever `Section` marker precedes
|
|
1312
|
+
* it. Pass the output of `buildDisplayEntities` (already sorted by `order`).
|
|
1313
|
+
*
|
|
1314
|
+
* Zero markers → a single `{ section: null }` group holding everything, so the
|
|
1315
|
+
* bare-grid rendering is unchanged. Empty leading/trailing runs are dropped.
|
|
1316
|
+
*/
|
|
1317
|
+
function groupEntitiesIntoSections(entities) {
|
|
1318
|
+
const groups = [];
|
|
1319
|
+
let current = { section: null, entities: [] };
|
|
1320
|
+
const flush = () => {
|
|
1321
|
+
if (current.section || current.entities.length > 0) {
|
|
1322
|
+
groups.push(current);
|
|
1323
|
+
}
|
|
1324
|
+
};
|
|
1325
|
+
for (const entity of entities) {
|
|
1326
|
+
if (isEntitySection(entity)) {
|
|
1327
|
+
flush();
|
|
1328
|
+
current = { section: entity, entities: [] };
|
|
1329
|
+
}
|
|
1330
|
+
else {
|
|
1331
|
+
current.entities.push(entity);
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
flush();
|
|
1335
|
+
return groups;
|
|
1336
|
+
}
|
|
1337
|
+
/**
|
|
1338
|
+
* Resolves a section marker's display label for the given language, falling
|
|
1339
|
+
* back across locales and finally to the entity's `name`.
|
|
1340
|
+
*/
|
|
1341
|
+
function getEntitySectionTitle(section, lang) {
|
|
1342
|
+
if (!section)
|
|
1343
|
+
return '';
|
|
1344
|
+
const label = section.configuration
|
|
1345
|
+
?.label;
|
|
1346
|
+
return resolveLocalizedLabel(label, lang) || (section.name ?? '');
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1279
1349
|
class EntityPreviewBody {
|
|
1280
1350
|
data = input.required(...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
1281
1351
|
attachmentShape = input('default', ...(ngDevMode ? [{ debugName: "attachmentShape" }] : /* istanbul ignore next */ []));
|
|
@@ -1434,6 +1504,16 @@ class EntitiesPreview {
|
|
|
1434
1504
|
entityClick = output();
|
|
1435
1505
|
/** Entities expanded and sorted by order */
|
|
1436
1506
|
displayEntities = computed(() => buildDisplayEntities(this.entities()), ...(ngDevMode ? [{ debugName: "displayEntities" }] : /* istanbul ignore next */ []));
|
|
1507
|
+
/**
|
|
1508
|
+
* The display entities split into section groups. With no `Section` markers
|
|
1509
|
+
* this is a single `{ section: null }` group, so the bare grid renders
|
|
1510
|
+
* exactly as before.
|
|
1511
|
+
*/
|
|
1512
|
+
sectionGroups = computed(() => groupEntitiesIntoSections(this.displayEntities()), ...(ngDevMode ? [{ debugName: "sectionGroups" }] : /* istanbul ignore next */ []));
|
|
1513
|
+
/** Localized heading for a section box (empty → header-less box). */
|
|
1514
|
+
sectionTitle(section) {
|
|
1515
|
+
return getEntitySectionTitle(section, this.transloco.getActiveLang());
|
|
1516
|
+
}
|
|
1437
1517
|
/** Returns the grid-column span for a given entity size (1-24) */
|
|
1438
1518
|
getColSpan(entity) {
|
|
1439
1519
|
const size = entity.configuration?.size ?? 8;
|
|
@@ -1464,14 +1544,14 @@ class EntitiesPreview {
|
|
|
1464
1544
|
this.entityClick.emit({ entity, key, source });
|
|
1465
1545
|
}
|
|
1466
1546
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntitiesPreview, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1467
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntitiesPreview, isStandalone: true, selector: "mt-entities-preview", inputs: { entities: { classPropertyName: "entities", publicName: "entities", isSignal: true, isRequired: true, transformFunction: null }, attachmentShape: { classPropertyName: "attachmentShape", publicName: "attachmentShape", isSignal: true, isRequired: false, transformFunction: null }, stackOnNarrow: { classPropertyName: "stackOnNarrow", publicName: "stackOnNarrow", isSignal: true, isRequired: false, transformFunction: null }, clickableKeys: { classPropertyName: "clickableKeys", publicName: "clickableKeys", isSignal: true, isRequired: false, transformFunction: null }, activeKeys: { classPropertyName: "activeKeys", publicName: "activeKeys", isSignal: true, isRequired: false, transformFunction: null }, clickableTooltip: { classPropertyName: "clickableTooltip", publicName: "clickableTooltip", isSignal: true, isRequired: false, transformFunction: null }, activeTooltip: { classPropertyName: "activeTooltip", publicName: "activeTooltip", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { entityClick: "entityClick" }, host: { properties: { "class.mt-entities-stack-narrow": "stackOnNarrow()" }, classAttribute: "block min-w-0 w-full" }, ngImport: i0, template: "<div class=\"mt-entities-grid grid grid-cols-24 gap-x-3 gap-y-5\">\r\n
|
|
1547
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntitiesPreview, isStandalone: true, selector: "mt-entities-preview", inputs: { entities: { classPropertyName: "entities", publicName: "entities", isSignal: true, isRequired: true, transformFunction: null }, attachmentShape: { classPropertyName: "attachmentShape", publicName: "attachmentShape", isSignal: true, isRequired: false, transformFunction: null }, stackOnNarrow: { classPropertyName: "stackOnNarrow", publicName: "stackOnNarrow", isSignal: true, isRequired: false, transformFunction: null }, clickableKeys: { classPropertyName: "clickableKeys", publicName: "clickableKeys", isSignal: true, isRequired: false, transformFunction: null }, activeKeys: { classPropertyName: "activeKeys", publicName: "activeKeys", isSignal: true, isRequired: false, transformFunction: null }, clickableTooltip: { classPropertyName: "clickableTooltip", publicName: "clickableTooltip", isSignal: true, isRequired: false, transformFunction: null }, activeTooltip: { classPropertyName: "activeTooltip", publicName: "activeTooltip", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { entityClick: "entityClick" }, host: { properties: { "class.mt-entities-stack-narrow": "stackOnNarrow()" }, classAttribute: "block min-w-0 w-full" }, ngImport: i0, template: "<div class=\"flex flex-col gap-4\">\r\n @for (group of sectionGroups(); track group.section?.key ?? $index) {\r\n @if (group.section) {\r\n <!-- Titled section box (matches the client-form section view) -->\r\n <div\r\n class=\"flex flex-col gap-0 overflow-hidden rounded-md border border-surface-200 bg-surface-0\"\r\n >\r\n @if (sectionTitle(group.section); as title) {\r\n <h3\r\n class=\"m-0 border-b border-surface-200 bg-surface-50 px-4 py-3 text-lg font-semibold text-color\"\r\n dir=\"auto\"\r\n >\r\n {{ title }}\r\n </h3>\r\n }\r\n <div class=\"p-4\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"entityGrid\"\r\n [ngTemplateOutletContext]=\"{ $implicit: group.entities }\"\r\n />\r\n </div>\r\n </div>\r\n } @else {\r\n <ng-container\r\n [ngTemplateOutlet]=\"entityGrid\"\r\n [ngTemplateOutletContext]=\"{ $implicit: group.entities }\"\r\n />\r\n }\r\n }\r\n</div>\r\n\r\n<ng-template #entityGrid let-groupEntities>\r\n <div class=\"mt-entities-grid grid grid-cols-24 gap-x-3 gap-y-5\">\r\n @for (entity of groupEntities; track entity.key ?? entity.order ?? $index) {\r\n <div\r\n class=\"min-w-0 overflow-hidden flex items-center rounded transition-colors\"\r\n [class.border]=\"entity.configuration?.showBorder\"\r\n [class.p-3]=\"entity.configuration?.showBorder\"\r\n [class.border-dashed]=\"entity.configuration?.showBorder\"\r\n [class.border-gray-200]=\"entity.configuration?.showBorder\"\r\n [class.rounded-lg]=\"entity.configuration?.showBorder\"\r\n [class.mt-entity-filterable]=\"isClickable(entity) && !isActive(entity)\"\r\n [class.mt-entity-filter-active]=\"\r\n isClickable(entity) && isActive(entity)\r\n \"\r\n [attr.data-row-click-ignore]=\"isClickable(entity) ? 'true' : null\"\r\n [attr.title]=\"\r\n isClickable(entity)\r\n ? isActive(entity)\r\n ? activeTooltip()\r\n : clickableTooltip()\r\n : null\r\n \"\r\n [style.grid-column]=\"getColSpan(entity)\"\r\n (click)=\"onEntityClick($event, entity)\"\r\n >\r\n <mt-entity-preview\r\n [data]=\"entity\"\r\n [attachmentShape]=\"attachmentShape()\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n</ng-template>\r\n", styles: [":host{container-type:inline-size}@container (max-width: 400px){:host(.mt-entities-stack-narrow) .mt-entities-grid{grid-template-columns:1fr;column-gap:0}:host(.mt-entities-stack-narrow) .mt-entities-grid>*{grid-column:1 / -1!important}}@container (max-width: 280px){.mt-entities-grid{grid-template-columns:1fr;column-gap:0}.mt-entities-grid>*{grid-column:1 / -1!important}}.mt-entity-filterable{cursor:url(\"data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2314b8a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 3H2l8 9.46V19l4 2v-8.54L22 3z'/%3E%3C/svg%3E\") 7 3,zoom-in!important}.mt-entity-filter-active{cursor:url(\"data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='%2314b8a6' stroke='%2314b8a6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 3H2l8 9.46V19l4 2v-8.54L22 3z'/%3E%3C/svg%3E\") 7 3,zoom-out!important}.mt-entity-filterable:hover{background-color:#ccfbf147;outline:1px dashed rgb(20 184 166 / .28);outline-offset:2px}.mt-entity-filter-active{background-color:#ccfbf14d;box-shadow:inset 0 0 0 1.5px #14b8a666,0 0 0 1px #ffffff80}\n"], dependencies: [{ kind: "component", type: EntityPreview, selector: "mt-entity-preview", inputs: ["data", "attachmentShape"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
1468
1548
|
}
|
|
1469
1549
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntitiesPreview, decorators: [{
|
|
1470
1550
|
type: Component,
|
|
1471
|
-
args: [{ selector: 'mt-entities-preview', standalone: true, imports: [EntityPreview], host: {
|
|
1551
|
+
args: [{ selector: 'mt-entities-preview', standalone: true, imports: [EntityPreview, NgTemplateOutlet], host: {
|
|
1472
1552
|
class: 'block min-w-0 w-full',
|
|
1473
1553
|
'[class.mt-entities-stack-narrow]': 'stackOnNarrow()',
|
|
1474
|
-
}, template: "<div class=\"mt-entities-grid grid grid-cols-24 gap-x-3 gap-y-5\">\r\n
|
|
1554
|
+
}, template: "<div class=\"flex flex-col gap-4\">\r\n @for (group of sectionGroups(); track group.section?.key ?? $index) {\r\n @if (group.section) {\r\n <!-- Titled section box (matches the client-form section view) -->\r\n <div\r\n class=\"flex flex-col gap-0 overflow-hidden rounded-md border border-surface-200 bg-surface-0\"\r\n >\r\n @if (sectionTitle(group.section); as title) {\r\n <h3\r\n class=\"m-0 border-b border-surface-200 bg-surface-50 px-4 py-3 text-lg font-semibold text-color\"\r\n dir=\"auto\"\r\n >\r\n {{ title }}\r\n </h3>\r\n }\r\n <div class=\"p-4\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"entityGrid\"\r\n [ngTemplateOutletContext]=\"{ $implicit: group.entities }\"\r\n />\r\n </div>\r\n </div>\r\n } @else {\r\n <ng-container\r\n [ngTemplateOutlet]=\"entityGrid\"\r\n [ngTemplateOutletContext]=\"{ $implicit: group.entities }\"\r\n />\r\n }\r\n }\r\n</div>\r\n\r\n<ng-template #entityGrid let-groupEntities>\r\n <div class=\"mt-entities-grid grid grid-cols-24 gap-x-3 gap-y-5\">\r\n @for (entity of groupEntities; track entity.key ?? entity.order ?? $index) {\r\n <div\r\n class=\"min-w-0 overflow-hidden flex items-center rounded transition-colors\"\r\n [class.border]=\"entity.configuration?.showBorder\"\r\n [class.p-3]=\"entity.configuration?.showBorder\"\r\n [class.border-dashed]=\"entity.configuration?.showBorder\"\r\n [class.border-gray-200]=\"entity.configuration?.showBorder\"\r\n [class.rounded-lg]=\"entity.configuration?.showBorder\"\r\n [class.mt-entity-filterable]=\"isClickable(entity) && !isActive(entity)\"\r\n [class.mt-entity-filter-active]=\"\r\n isClickable(entity) && isActive(entity)\r\n \"\r\n [attr.data-row-click-ignore]=\"isClickable(entity) ? 'true' : null\"\r\n [attr.title]=\"\r\n isClickable(entity)\r\n ? isActive(entity)\r\n ? activeTooltip()\r\n : clickableTooltip()\r\n : null\r\n \"\r\n [style.grid-column]=\"getColSpan(entity)\"\r\n (click)=\"onEntityClick($event, entity)\"\r\n >\r\n <mt-entity-preview\r\n [data]=\"entity\"\r\n [attachmentShape]=\"attachmentShape()\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n</ng-template>\r\n", styles: [":host{container-type:inline-size}@container (max-width: 400px){:host(.mt-entities-stack-narrow) .mt-entities-grid{grid-template-columns:1fr;column-gap:0}:host(.mt-entities-stack-narrow) .mt-entities-grid>*{grid-column:1 / -1!important}}@container (max-width: 280px){.mt-entities-grid{grid-template-columns:1fr;column-gap:0}.mt-entities-grid>*{grid-column:1 / -1!important}}.mt-entity-filterable{cursor:url(\"data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2314b8a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 3H2l8 9.46V19l4 2v-8.54L22 3z'/%3E%3C/svg%3E\") 7 3,zoom-in!important}.mt-entity-filter-active{cursor:url(\"data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='%2314b8a6' stroke='%2314b8a6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 3H2l8 9.46V19l4 2v-8.54L22 3z'/%3E%3C/svg%3E\") 7 3,zoom-out!important}.mt-entity-filterable:hover{background-color:#ccfbf147;outline:1px dashed rgb(20 184 166 / .28);outline-offset:2px}.mt-entity-filter-active{background-color:#ccfbf14d;box-shadow:inset 0 0 0 1.5px #14b8a666,0 0 0 1px #ffffff80}\n"] }]
|
|
1475
1555
|
}], propDecorators: { entities: [{ type: i0.Input, args: [{ isSignal: true, alias: "entities", required: true }] }], attachmentShape: [{ type: i0.Input, args: [{ isSignal: true, alias: "attachmentShape", required: false }] }], stackOnNarrow: [{ type: i0.Input, args: [{ isSignal: true, alias: "stackOnNarrow", required: false }] }], clickableKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "clickableKeys", required: false }] }], activeKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeKeys", required: false }] }], clickableTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "clickableTooltip", required: false }] }], activeTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeTooltip", required: false }] }], entityClick: [{ type: i0.Output, args: ["entityClick"] }] } });
|
|
1476
1556
|
|
|
1477
1557
|
/**
|
|
@@ -1597,14 +1677,34 @@ class EntitiesManage extends EntitiesResizeBase {
|
|
|
1597
1677
|
entitiesReordered = output();
|
|
1598
1678
|
/** Emits when an entity cell is clicked (for opening edit drawer) */
|
|
1599
1679
|
entityClicked = output();
|
|
1680
|
+
/**
|
|
1681
|
+
* Emits when an item dragged from a *different* connected list (e.g. a sidebar
|
|
1682
|
+
* "add section" tool) is dropped onto this grid. `index` is the target slot;
|
|
1683
|
+
* `data` is the dropped `cdkDragData`. The host decides what to insert.
|
|
1684
|
+
*/
|
|
1685
|
+
externalItemDropped = output();
|
|
1600
1686
|
/** Entities expanded and sorted by their configured order */
|
|
1601
1687
|
displayEntities = computed(() => buildDisplayEntities(this.entities()), ...(ngDevMode ? [{ debugName: "displayEntities" }] : /* istanbul ignore next */ []));
|
|
1602
1688
|
/** Returns the grid-column span for a given entity size (1-24) */
|
|
1603
1689
|
getColSpan(entity) {
|
|
1690
|
+
if (isEntitySection(entity))
|
|
1691
|
+
return 'span 24';
|
|
1604
1692
|
return this.getResizeColSpan(entity);
|
|
1605
1693
|
}
|
|
1694
|
+
/** True when the entity is a full-width `Section` layout marker. */
|
|
1695
|
+
isSection(entity) {
|
|
1696
|
+
return isEntitySection(entity);
|
|
1697
|
+
}
|
|
1606
1698
|
/** Handle drag-drop reorder */
|
|
1607
1699
|
onDrop(event) {
|
|
1700
|
+
// Item dragged in from another connected list — let the host handle it.
|
|
1701
|
+
if (event.previousContainer !== event.container) {
|
|
1702
|
+
this.externalItemDropped.emit({
|
|
1703
|
+
index: event.currentIndex,
|
|
1704
|
+
data: event.item.data,
|
|
1705
|
+
});
|
|
1706
|
+
return;
|
|
1707
|
+
}
|
|
1608
1708
|
if (event.previousIndex === event.currentIndex)
|
|
1609
1709
|
return;
|
|
1610
1710
|
const items = [...this.displayEntities()];
|
|
@@ -1646,16 +1746,16 @@ class EntitiesManage extends EntitiesResizeBase {
|
|
|
1646
1746
|
});
|
|
1647
1747
|
}
|
|
1648
1748
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntitiesManage, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1649
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntitiesManage, isStandalone: true, selector: "mt-entities-manage", inputs: { entities: { classPropertyName: "entities", publicName: "entities", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { entities: "entitiesChange", entitiesReordered: "entitiesReordered", entityClicked: "entityClicked" }, usesInheritance: true, ngImport: i0, template: "<div\r\n cdkDropList\r\n cdkDropListOrientation=\"mixed\"\r\n [cdkDropListData]=\"displayEntities()\"\r\n (cdkDropListDropped)=\"onDrop($event)\"\r\n class=\"grid grid-cols-24 gap-x-4 gap-y-6\"\r\n>\r\n @for (\r\n entity of displayEntities();\r\n track entity.key ?? entity.order ?? $index\r\n ) {\r\n <div\r\n
|
|
1749
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntitiesManage, isStandalone: true, selector: "mt-entities-manage", inputs: { entities: { classPropertyName: "entities", publicName: "entities", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { entities: "entitiesChange", entitiesReordered: "entitiesReordered", entityClicked: "entityClicked", externalItemDropped: "externalItemDropped" }, usesInheritance: true, ngImport: i0, template: "<div\r\n cdkDropList\r\n cdkDropListOrientation=\"mixed\"\r\n [cdkDropListData]=\"displayEntities()\"\r\n (cdkDropListDropped)=\"onDrop($event)\"\r\n class=\"grid grid-cols-24 gap-x-4 gap-y-6\"\r\n>\r\n @for (\r\n entity of displayEntities();\r\n track entity.key ?? entity.order ?? $index\r\n ) {\r\n @if (isSection(entity)) {\r\n <!-- Section marker: full-width, non-resizable header row -->\r\n <div\r\n cdkDrag\r\n [cdkDragData]=\"entity\"\r\n class=\"entity-cell section-row group relative min-w-0 flex items-center gap-2 px-4 py-2.5 cursor-grab active:cursor-grabbing rounded-md border border-surface-200 bg-surface-50 transition-colors hover:bg-emphasis\"\r\n [class.resizing]=\"resizingEntity() === entity\"\r\n [style.grid-column]=\"getColSpan(entity)\"\r\n (click)=\"entityClicked.emit(entity)\"\r\n >\r\n <div\r\n *cdkDragPlaceholder\r\n class=\"h-full min-h-11 bg-black/10 rounded-md\"\r\n [style.grid-column]=\"getColSpan(entity)\"\r\n ></div>\r\n\r\n <span\r\n class=\"flex-1 min-w-0 truncate text-base font-semibold\"\r\n dir=\"auto\"\r\n >\r\n {{ entity.name }}\r\n </span>\r\n <mt-icon\r\n icon=\"editor.pencil-01\"\r\n class=\"shrink-0 opacity-0 transition-opacity group-hover:opacity-60\"\r\n />\r\n </div>\r\n } @else {\r\n <div\r\n cdkDrag\r\n [cdkDragData]=\"entity\"\r\n class=\"entity-cell group relative min-w-0 flex items-center p-3 cursor-grab active:cursor-grabbing rounded-lg transition-colors bg-surface-100/60\"\r\n [class.border]=\"entity.configuration?.showBorder\"\r\n [class.border-dashed]=\"entity.configuration?.showBorder\"\r\n [class.border-gray-300]=\"entity.configuration?.showBorder\"\r\n [class.resizing]=\"resizingEntity() === entity\"\r\n [style.grid-column]=\"getColSpan(entity)\"\r\n >\r\n <!-- Drag placeholder -->\r\n <div\r\n *cdkDragPlaceholder\r\n class=\"h-full min-h-12 bg-black/10 rounded-xl\"\r\n [style.grid-column]=\"getColSpan(entity)\"\r\n ></div>\r\n\r\n <mt-entity-preview\r\n [data]=\"entity\"\r\n class=\"flex-1 min-w-0 cursor-pointer\"\r\n (click)=\"entityClicked.emit(entity)\"\r\n />\r\n\r\n <!-- Resize handle (right edge) -->\r\n <div\r\n class=\"resize-handle\"\r\n (mousedown)=\"onResizeStart($event, entity)\"\r\n (click)=\"$event.stopPropagation()\"\r\n >\r\n <div class=\"resize-handle-bar\"></div>\r\n </div>\r\n </div>\r\n }\r\n }\r\n</div>\r\n", styles: [".cdk-drag{cursor:grab}.cdk-drag:active{cursor:grabbing}.cdk-drag-preview{cursor:grabbing;overflow:hidden}.cdk-drag-placeholder{opacity:.5}.cdk-drop-list-dragging .cdk-drag{cursor:grabbing}.entity-cell{position:relative}.resize-handle{position:absolute;top:0;inset-inline-end:-4px;width:8px;height:100%;cursor:col-resize;z-index:10;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .15s ease}.entity-cell:hover .resize-handle,.entity-cell.resizing .resize-handle{opacity:1}.resize-handle-bar{width:3px;height:24px;border-radius:2px;background-color:var(--p-primary-color, #6366f1);transition:height .15s ease,background-color .15s ease}.resize-handle:hover .resize-handle-bar{height:36px;background-color:var(--p-primary-color, #4f46e5)}.entity-cell.resizing{outline:2px dashed var(--p-primary-color, #6366f1);outline-offset:-1px;border-radius:8px;-webkit-user-select:none;user-select:none}\n"], dependencies: [{ kind: "component", type: EntityPreview, selector: "mt-entity-preview", inputs: ["data", "attachmentShape"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "directive", type: CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: CdkDragPlaceholder, selector: "ng-template[cdkDragPlaceholder]", inputs: ["data"] }] });
|
|
1650
1750
|
}
|
|
1651
1751
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntitiesManage, decorators: [{
|
|
1652
1752
|
type: Component,
|
|
1653
|
-
args: [{ selector: 'mt-entities-manage', standalone: true, imports: [EntityPreview, CdkDrag, CdkDropList, CdkDragPlaceholder], template: "<div\r\n cdkDropList\r\n cdkDropListOrientation=\"mixed\"\r\n [cdkDropListData]=\"displayEntities()\"\r\n (cdkDropListDropped)=\"onDrop($event)\"\r\n class=\"grid grid-cols-24 gap-x-4 gap-y-6\"\r\n>\r\n @for (\r\n entity of displayEntities();\r\n track entity.key ?? entity.order ?? $index\r\n ) {\r\n <div\r\n
|
|
1654
|
-
}], propDecorators: { entities: [{ type: i0.Input, args: [{ isSignal: true, alias: "entities", required: true }] }, { type: i0.Output, args: ["entitiesChange"] }], entitiesReordered: [{ type: i0.Output, args: ["entitiesReordered"] }], entityClicked: [{ type: i0.Output, args: ["entityClicked"] }] } });
|
|
1753
|
+
args: [{ selector: 'mt-entities-manage', standalone: true, imports: [EntityPreview, Icon, CdkDrag, CdkDropList, CdkDragPlaceholder], template: "<div\r\n cdkDropList\r\n cdkDropListOrientation=\"mixed\"\r\n [cdkDropListData]=\"displayEntities()\"\r\n (cdkDropListDropped)=\"onDrop($event)\"\r\n class=\"grid grid-cols-24 gap-x-4 gap-y-6\"\r\n>\r\n @for (\r\n entity of displayEntities();\r\n track entity.key ?? entity.order ?? $index\r\n ) {\r\n @if (isSection(entity)) {\r\n <!-- Section marker: full-width, non-resizable header row -->\r\n <div\r\n cdkDrag\r\n [cdkDragData]=\"entity\"\r\n class=\"entity-cell section-row group relative min-w-0 flex items-center gap-2 px-4 py-2.5 cursor-grab active:cursor-grabbing rounded-md border border-surface-200 bg-surface-50 transition-colors hover:bg-emphasis\"\r\n [class.resizing]=\"resizingEntity() === entity\"\r\n [style.grid-column]=\"getColSpan(entity)\"\r\n (click)=\"entityClicked.emit(entity)\"\r\n >\r\n <div\r\n *cdkDragPlaceholder\r\n class=\"h-full min-h-11 bg-black/10 rounded-md\"\r\n [style.grid-column]=\"getColSpan(entity)\"\r\n ></div>\r\n\r\n <span\r\n class=\"flex-1 min-w-0 truncate text-base font-semibold\"\r\n dir=\"auto\"\r\n >\r\n {{ entity.name }}\r\n </span>\r\n <mt-icon\r\n icon=\"editor.pencil-01\"\r\n class=\"shrink-0 opacity-0 transition-opacity group-hover:opacity-60\"\r\n />\r\n </div>\r\n } @else {\r\n <div\r\n cdkDrag\r\n [cdkDragData]=\"entity\"\r\n class=\"entity-cell group relative min-w-0 flex items-center p-3 cursor-grab active:cursor-grabbing rounded-lg transition-colors bg-surface-100/60\"\r\n [class.border]=\"entity.configuration?.showBorder\"\r\n [class.border-dashed]=\"entity.configuration?.showBorder\"\r\n [class.border-gray-300]=\"entity.configuration?.showBorder\"\r\n [class.resizing]=\"resizingEntity() === entity\"\r\n [style.grid-column]=\"getColSpan(entity)\"\r\n >\r\n <!-- Drag placeholder -->\r\n <div\r\n *cdkDragPlaceholder\r\n class=\"h-full min-h-12 bg-black/10 rounded-xl\"\r\n [style.grid-column]=\"getColSpan(entity)\"\r\n ></div>\r\n\r\n <mt-entity-preview\r\n [data]=\"entity\"\r\n class=\"flex-1 min-w-0 cursor-pointer\"\r\n (click)=\"entityClicked.emit(entity)\"\r\n />\r\n\r\n <!-- Resize handle (right edge) -->\r\n <div\r\n class=\"resize-handle\"\r\n (mousedown)=\"onResizeStart($event, entity)\"\r\n (click)=\"$event.stopPropagation()\"\r\n >\r\n <div class=\"resize-handle-bar\"></div>\r\n </div>\r\n </div>\r\n }\r\n }\r\n</div>\r\n", styles: [".cdk-drag{cursor:grab}.cdk-drag:active{cursor:grabbing}.cdk-drag-preview{cursor:grabbing;overflow:hidden}.cdk-drag-placeholder{opacity:.5}.cdk-drop-list-dragging .cdk-drag{cursor:grabbing}.entity-cell{position:relative}.resize-handle{position:absolute;top:0;inset-inline-end:-4px;width:8px;height:100%;cursor:col-resize;z-index:10;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .15s ease}.entity-cell:hover .resize-handle,.entity-cell.resizing .resize-handle{opacity:1}.resize-handle-bar{width:3px;height:24px;border-radius:2px;background-color:var(--p-primary-color, #6366f1);transition:height .15s ease,background-color .15s ease}.resize-handle:hover .resize-handle-bar{height:36px;background-color:var(--p-primary-color, #4f46e5)}.entity-cell.resizing{outline:2px dashed var(--p-primary-color, #6366f1);outline-offset:-1px;border-radius:8px;-webkit-user-select:none;user-select:none}\n"] }]
|
|
1754
|
+
}], propDecorators: { entities: [{ type: i0.Input, args: [{ isSignal: true, alias: "entities", required: true }] }, { type: i0.Output, args: ["entitiesChange"] }], entitiesReordered: [{ type: i0.Output, args: ["entitiesReordered"] }], entityClicked: [{ type: i0.Output, args: ["entityClicked"] }], externalItemDropped: [{ type: i0.Output, args: ["externalItemDropped"] }] } });
|
|
1655
1755
|
|
|
1656
1756
|
/**
|
|
1657
1757
|
* Generated bundle index. Do not edit.
|
|
1658
1758
|
*/
|
|
1659
1759
|
|
|
1660
|
-
export { ComparisonEntityList, ComparisonValue, EntitiesManage, EntitiesPreview, EntitiesResizeBase, EntityAttachment, EntityCheckbox, EntityConnection, EntityCurrency, EntityDate, EntityField, EntityLeafDetails, EntityLocation, EntityLongText, EntityLookup, EntityLookupModuleCheckList, EntityPercentage, EntityPreview, EntityPreviewBody, EntityScheduleItem, EntityStatus, EntityText, EntityUser, LEAF_DETAILS_KEY_SEPARATOR, buildDisplayEntities, expandLeafDetailsEntity, isLeafDetailsCatalogConfiguration, isLeafDetailsCollectionValue, isLeafDetailsRuntimeValue, isLeafDetailsSyntheticKey, isLeafDetailsValue };
|
|
1760
|
+
export { ComparisonEntityList, ComparisonValue, EntitiesManage, EntitiesPreview, EntitiesResizeBase, EntityAttachment, EntityCheckbox, EntityConnection, EntityCurrency, EntityDate, EntityField, EntityLeafDetails, EntityLocation, EntityLongText, EntityLookup, EntityLookupModuleCheckList, EntityPercentage, EntityPreview, EntityPreviewBody, EntityScheduleItem, EntityStatus, EntityText, EntityUser, LEAF_DETAILS_KEY_SEPARATOR, SECTION_KEY_PREFIX, buildDisplayEntities, buildSectionKey, expandLeafDetailsEntity, getEntitySectionTitle, groupEntitiesIntoSections, isEntitySection, isLeafDetailsCatalogConfiguration, isLeafDetailsCollectionValue, isLeafDetailsRuntimeValue, isLeafDetailsSyntheticKey, isLeafDetailsValue, isSectionKey, resolveLocalizedLabel };
|
|
1661
1761
|
//# sourceMappingURL=masterteam-components-entities.mjs.map
|