@ibragim-dev-org/ui-forge-library 1.4.36 → 1.4.52
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.
|
@@ -2110,6 +2110,13 @@ class UiCodeDirective {
|
|
|
2110
2110
|
$code = input.required(...(ngDevMode ? [{ debugName: "$code" }] : []));
|
|
2111
2111
|
$language = signal('', ...(ngDevMode ? [{ debugName: "$language" }] : []));
|
|
2112
2112
|
$highlightedArray = signal([], ...(ngDevMode ? [{ debugName: "$highlightedArray" }] : []));
|
|
2113
|
+
$codeToCopy = computed(() => {
|
|
2114
|
+
let code = this.$code();
|
|
2115
|
+
code = code.replace(/^\s*\n+|\n+\s*$/g, '');
|
|
2116
|
+
code = code.replace(/^(js|ts|css|html|xml|json)(?=[ \n])/i, '');
|
|
2117
|
+
code = code.replace(/^const\s+codeLanguages\s*:\s*Record<string,\s*LangRegExps>\s*=\s*\{[\s\S]*?\};?\s*\n?/, '');
|
|
2118
|
+
return code.trim();
|
|
2119
|
+
}, ...(ngDevMode ? [{ debugName: "$codeToCopy" }] : []));
|
|
2113
2120
|
constructor() {
|
|
2114
2121
|
effect(() => {
|
|
2115
2122
|
this.highlightCode(this.$code());
|
|
@@ -2184,19 +2191,29 @@ class UiPopupInstance {
|
|
|
2184
2191
|
width = 0;
|
|
2185
2192
|
animationOrigin$ = new BehaviorSubject('center');
|
|
2186
2193
|
options = {
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2194
|
+
startOrigin: 'center center',
|
|
2195
|
+
endOrigin: 'center center',
|
|
2196
|
+
start: 'scale(0)',
|
|
2197
|
+
end: 'scale(0)',
|
|
2198
|
+
leftStart: '0px',
|
|
2199
|
+
leftEnd: '0',
|
|
2200
|
+
topStart: '0px',
|
|
2201
|
+
topEnd: '0',
|
|
2191
2202
|
};
|
|
2203
|
+
triggerPulse$ = new Subject();
|
|
2204
|
+
isHide$ = new Subject();
|
|
2192
2205
|
closed = new Subject();
|
|
2193
2206
|
shouldClose = new Subject();
|
|
2194
2207
|
isClosing = false;
|
|
2195
2208
|
constructor(overlayRef, destroyRef, onClose = () => { }, options = {
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2209
|
+
startOrigin: 'center center',
|
|
2210
|
+
endOrigin: 'center center',
|
|
2211
|
+
start: 'scale(0.8)',
|
|
2212
|
+
end: 'scale(1)',
|
|
2213
|
+
leftStart: '0px',
|
|
2214
|
+
leftEnd: '0',
|
|
2215
|
+
topStart: '0px',
|
|
2216
|
+
topEnd: '0',
|
|
2200
2217
|
}) {
|
|
2201
2218
|
this.overlayRef = overlayRef;
|
|
2202
2219
|
this.destroyRef = destroyRef;
|
|
@@ -2204,12 +2221,12 @@ class UiPopupInstance {
|
|
|
2204
2221
|
this.options = options;
|
|
2205
2222
|
this.overlayRef
|
|
2206
2223
|
.detachments()
|
|
2207
|
-
.pipe(
|
|
2208
|
-
.subscribe(() => {
|
|
2224
|
+
.pipe(tap(() => {
|
|
2209
2225
|
this.closed.next();
|
|
2210
2226
|
this.closed.complete();
|
|
2211
2227
|
this.overlayRef.dispose();
|
|
2212
|
-
})
|
|
2228
|
+
}), takeUntilDestroyed(this.destroyRef))
|
|
2229
|
+
.subscribe();
|
|
2213
2230
|
}
|
|
2214
2231
|
close() {
|
|
2215
2232
|
if (this.isClosing) {
|
|
@@ -2228,32 +2245,13 @@ class UiPopupInstance {
|
|
|
2228
2245
|
}
|
|
2229
2246
|
}
|
|
2230
2247
|
|
|
2231
|
-
class
|
|
2232
|
-
tipContainerPortal;
|
|
2233
|
-
backdropPortal;
|
|
2234
|
-
constructor(component, tipComponent) {
|
|
2235
|
-
this.backdropPortal = new ComponentPortal(component);
|
|
2236
|
-
if (tipComponent) {
|
|
2237
|
-
this.tipContainerPortal = new ComponentPortal(tipComponent);
|
|
2238
|
-
}
|
|
2239
|
-
}
|
|
2240
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupBackdropService, deps: [{ token: i0.Type }, { token: i0.Type }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2241
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupBackdropService, providedIn: 'root' });
|
|
2242
|
-
}
|
|
2243
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupBackdropService, decorators: [{
|
|
2244
|
-
type: Injectable,
|
|
2245
|
-
args: [{
|
|
2246
|
-
providedIn: 'root',
|
|
2247
|
-
}]
|
|
2248
|
-
}], ctorParameters: () => [{ type: i0.Type }, { type: i0.Type }] });
|
|
2249
|
-
|
|
2250
|
-
class UiPopupService {
|
|
2248
|
+
class UiModal {
|
|
2251
2249
|
overlay;
|
|
2252
2250
|
injector;
|
|
2253
2251
|
destroyRef;
|
|
2254
2252
|
router;
|
|
2255
2253
|
backdropService;
|
|
2256
|
-
|
|
2254
|
+
instances = [];
|
|
2257
2255
|
backdropRef;
|
|
2258
2256
|
backdropPortalRef;
|
|
2259
2257
|
destroyDownloading$ = new Subject();
|
|
@@ -2265,67 +2263,27 @@ class UiPopupService {
|
|
|
2265
2263
|
this.router = router;
|
|
2266
2264
|
this.backdropService = backdropService;
|
|
2267
2265
|
}
|
|
2268
|
-
/**
|
|
2269
|
-
* Opens a popup with the specified component and options.
|
|
2270
|
-
*
|
|
2271
|
-
* @param component - The component to be displayed in the popup.
|
|
2272
|
-
* @param options - Configuration options for the popup, including inputs.
|
|
2273
|
-
* @param id - A unique identifier for the popup instance.
|
|
2274
|
-
* @param parameters - (Optional) Configuration options for the popup.
|
|
2275
|
-
*/
|
|
2276
|
-
open(component, options, id, parameters) {
|
|
2277
|
-
if (this.popupInstances.length) {
|
|
2278
|
-
if (parameters.isClosePrevious) {
|
|
2279
|
-
this.closePrevious();
|
|
2280
|
-
}
|
|
2281
|
-
}
|
|
2282
|
-
this.showBackdrop(parameters.isStaticBackdrop);
|
|
2283
|
-
const overlayRef = this.overlay.create({
|
|
2284
|
-
hasBackdrop: false,
|
|
2285
|
-
backdropClass: 'cdk-overlay-transparent-backdrop',
|
|
2286
|
-
positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),
|
|
2287
|
-
});
|
|
2288
|
-
this.subscribeToOutsideEvents();
|
|
2289
|
-
this.createPopup(overlayRef, component, options, id, parameters);
|
|
2290
|
-
}
|
|
2291
|
-
/**
|
|
2292
|
-
* Opens a popup that scales from the provided origin element to the centered popup size.
|
|
2293
|
-
* Useful for image-preview transitions where the source element animates into the popup.
|
|
2294
|
-
*/
|
|
2295
|
-
openScaledFromElement(component, options, id, originElement, sourceWidth, sourceHeight, parameters = {}) {
|
|
2296
|
-
const animationOptions = this.createScaleAnimationOptionsFromElement(originElement, sourceWidth, sourceHeight);
|
|
2297
|
-
this.open(component, options, id, {
|
|
2298
|
-
...parameters,
|
|
2299
|
-
animationOptions,
|
|
2300
|
-
});
|
|
2301
|
-
}
|
|
2302
2266
|
/**
|
|
2303
2267
|
* Closes the last opened popup.
|
|
2304
2268
|
*/
|
|
2305
2269
|
close() {
|
|
2306
|
-
if (this.
|
|
2307
|
-
this.
|
|
2308
|
-
this.
|
|
2309
|
-
if (!this.
|
|
2270
|
+
if (this.instances.length >= 1) {
|
|
2271
|
+
this.instances[this.instances.length - 1].close();
|
|
2272
|
+
this.instances.pop();
|
|
2273
|
+
if (!this.instances.length) {
|
|
2310
2274
|
this.destroy();
|
|
2311
2275
|
}
|
|
2312
2276
|
}
|
|
2313
2277
|
}
|
|
2314
|
-
closePrevious() {
|
|
2315
|
-
if (this.popupInstances.length >= 1) {
|
|
2316
|
-
this.popupInstances[this.popupInstances.length - 1].close();
|
|
2317
|
-
this.popupInstances.pop();
|
|
2318
|
-
}
|
|
2319
|
-
}
|
|
2320
2278
|
/**
|
|
2321
|
-
* Closes a popup by its index in the
|
|
2279
|
+
* Closes a popup by its index in the instances array.
|
|
2322
2280
|
*
|
|
2323
2281
|
* @param index - The index of the popup to close.
|
|
2324
2282
|
*/
|
|
2325
2283
|
closeByIndex(index) {
|
|
2326
|
-
this.
|
|
2327
|
-
this.
|
|
2328
|
-
if (!this.
|
|
2284
|
+
this.instances[index].close();
|
|
2285
|
+
this.instances.splice(index, 1);
|
|
2286
|
+
if (!this.instances.length) {
|
|
2329
2287
|
this.destroy();
|
|
2330
2288
|
}
|
|
2331
2289
|
}
|
|
@@ -2335,7 +2293,7 @@ class UiPopupService {
|
|
|
2335
2293
|
* @param id - The unique identifier of the popup to close.
|
|
2336
2294
|
*/
|
|
2337
2295
|
closeById(id) {
|
|
2338
|
-
const dropDownIndex = this.
|
|
2296
|
+
const dropDownIndex = this.instances.findIndex((v) => v.id === id);
|
|
2339
2297
|
if (dropDownIndex >= 0) {
|
|
2340
2298
|
this.closeByIndex(dropDownIndex);
|
|
2341
2299
|
}
|
|
@@ -2344,10 +2302,10 @@ class UiPopupService {
|
|
|
2344
2302
|
* Closes all currently opened popups.
|
|
2345
2303
|
*/
|
|
2346
2304
|
closeAll() {
|
|
2347
|
-
this.
|
|
2305
|
+
this.instances.forEach((element) => {
|
|
2348
2306
|
element.close();
|
|
2349
2307
|
});
|
|
2350
|
-
this.
|
|
2308
|
+
this.instances = [];
|
|
2351
2309
|
this.destroy();
|
|
2352
2310
|
}
|
|
2353
2311
|
/**
|
|
@@ -2360,7 +2318,7 @@ class UiPopupService {
|
|
|
2360
2318
|
* @param parameters - (Optional) Configuration options for the popup.
|
|
2361
2319
|
*/
|
|
2362
2320
|
createPopup(overlayRef, component, options, id, parameters) {
|
|
2363
|
-
const newParameters = this.
|
|
2321
|
+
const newParameters = this.fetchParameters(parameters);
|
|
2364
2322
|
const uiPopupInstance = new UiPopupInstance(overlayRef, this.destroyRef, options.onClose, newParameters.animationOptions);
|
|
2365
2323
|
if (newParameters.width > 0) {
|
|
2366
2324
|
uiPopupInstance.width = newParameters.width;
|
|
@@ -2380,7 +2338,7 @@ class UiPopupService {
|
|
|
2380
2338
|
}
|
|
2381
2339
|
}
|
|
2382
2340
|
uiPopupInstance.id = id;
|
|
2383
|
-
this.
|
|
2341
|
+
this.instances.push(uiPopupInstance);
|
|
2384
2342
|
}
|
|
2385
2343
|
/**
|
|
2386
2344
|
* Subscribes to outside events (e.g., scroll, router events) to close popups.
|
|
@@ -2424,6 +2382,7 @@ class UiPopupService {
|
|
|
2424
2382
|
if (this.backdropPortalRef) {
|
|
2425
2383
|
this.backdropPortalRef.location.nativeElement.classList.add('animate-in');
|
|
2426
2384
|
this.backdropPortalRef.setInput('isStaticBackdrop', isStaticBackdrop);
|
|
2385
|
+
this.backdropPortalRef.setInput('clicked', () => this.instances[this.instances.length - 1].triggerPulse$.next());
|
|
2427
2386
|
}
|
|
2428
2387
|
}
|
|
2429
2388
|
hideBackdrop() {
|
|
@@ -2451,14 +2410,18 @@ class UiPopupService {
|
|
|
2451
2410
|
* @param parameters - Partial configuration options for the popup.
|
|
2452
2411
|
* @returns A complete set of popup parameters with default values applied.
|
|
2453
2412
|
*/
|
|
2454
|
-
|
|
2413
|
+
fetchParameters(parameters) {
|
|
2455
2414
|
return {
|
|
2456
2415
|
animationOptions: parameters.animationOptions === undefined
|
|
2457
2416
|
? {
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2417
|
+
startOrigin: 'center center',
|
|
2418
|
+
endOrigin: 'center center',
|
|
2419
|
+
start: 'scale(0.8)',
|
|
2420
|
+
end: 'scale(1)',
|
|
2421
|
+
leftStart: '0px',
|
|
2422
|
+
leftEnd: '0',
|
|
2423
|
+
topStart: '0px',
|
|
2424
|
+
topEnd: '0',
|
|
2462
2425
|
}
|
|
2463
2426
|
: parameters.animationOptions,
|
|
2464
2427
|
isClosePrevious: parameters.isClosePrevious === undefined ? false : parameters.isClosePrevious,
|
|
@@ -2466,35 +2429,7 @@ class UiPopupService {
|
|
|
2466
2429
|
width: parameters.width === undefined ? 0 : parameters.width,
|
|
2467
2430
|
};
|
|
2468
2431
|
}
|
|
2469
|
-
createScaleAnimationOptionsFromElement(originElement, sourceWidth, sourceHeight) {
|
|
2470
|
-
const rect = originElement.getBoundingClientRect();
|
|
2471
|
-
const viewportWidth = isBrowser() ? window.innerWidth : sourceWidth;
|
|
2472
|
-
const viewportHeight = isBrowser() ? window.innerHeight : sourceHeight;
|
|
2473
|
-
const centerX = viewportWidth / 2;
|
|
2474
|
-
const centerY = viewportHeight / 2;
|
|
2475
|
-
const targetX = rect.left + rect.width / 2;
|
|
2476
|
-
const targetY = rect.top + rect.height / 2;
|
|
2477
|
-
const offsetX = targetX - centerX;
|
|
2478
|
-
const offsetY = targetY - centerY;
|
|
2479
|
-
const fitted = getAspectRatioFit(viewportWidth - viewportWidth / 8, viewportHeight - viewportHeight / 8, sourceWidth, sourceHeight);
|
|
2480
|
-
const scaleY = Math.trunc((sourceHeight / fitted.height) * 100) / 100;
|
|
2481
|
-
const scaleX = Math.trunc((sourceWidth / fitted.width) * 100) / 100;
|
|
2482
|
-
return {
|
|
2483
|
-
positionX: offsetX,
|
|
2484
|
-
positionY: offsetY,
|
|
2485
|
-
startTransition: `scale(${scaleY}, ${scaleX})`,
|
|
2486
|
-
endTransition: 'scale(1)',
|
|
2487
|
-
};
|
|
2488
|
-
}
|
|
2489
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupService, deps: [{ token: i1.Overlay }, { token: i0.Injector }, { token: i0.DestroyRef }, { token: i2$1.Router }, { token: UiPopupBackdropService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2490
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupService, providedIn: 'root' });
|
|
2491
2432
|
}
|
|
2492
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupService, decorators: [{
|
|
2493
|
-
type: Injectable,
|
|
2494
|
-
args: [{
|
|
2495
|
-
providedIn: 'root',
|
|
2496
|
-
}]
|
|
2497
|
-
}], ctorParameters: () => [{ type: i1.Overlay }, { type: i0.Injector }, { type: i0.DestroyRef }, { type: i2$1.Router }, { type: UiPopupBackdropService }] });
|
|
2498
2433
|
|
|
2499
2434
|
class UiPopupContainerDirective {
|
|
2500
2435
|
popupInstance;
|
|
@@ -2503,6 +2438,7 @@ class UiPopupContainerDirective {
|
|
|
2503
2438
|
elementRef;
|
|
2504
2439
|
$isShow = signal(false, ...(ngDevMode ? [{ debugName: "$isShow" }] : []));
|
|
2505
2440
|
$pulseTrigger = signal(false, ...(ngDevMode ? [{ debugName: "$pulseTrigger" }] : []));
|
|
2441
|
+
$isHide = signal(false, ...(ngDevMode ? [{ debugName: "$isHide" }] : []));
|
|
2506
2442
|
$overflowHidden = input(true, ...(ngDevMode ? [{ debugName: "$overflowHidden" }] : []));
|
|
2507
2443
|
$shouldClose = model(false, ...(ngDevMode ? [{ debugName: "$shouldClose" }] : []));
|
|
2508
2444
|
$hasCloseButton = input(false, ...(ngDevMode ? [{ debugName: "$hasCloseButton" }] : []));
|
|
@@ -2550,17 +2486,31 @@ class UiPopupContainerDirective {
|
|
|
2550
2486
|
this.$isShow.set(false);
|
|
2551
2487
|
}), takeUntilDestroyed(this.destroyRef))
|
|
2552
2488
|
.subscribe();
|
|
2489
|
+
this.popupInstance.isHide$
|
|
2490
|
+
.pipe(tap((b) => {
|
|
2491
|
+
this.$isHide.set(b);
|
|
2492
|
+
}), takeUntilDestroyed(this.destroyRef))
|
|
2493
|
+
.subscribe();
|
|
2494
|
+
this.popupInstance.triggerPulse$
|
|
2495
|
+
.pipe(tap(() => {
|
|
2496
|
+
this.$pulseTrigger.set(true);
|
|
2497
|
+
asyncScheduler.schedule(() => {
|
|
2498
|
+
this.$pulseTrigger.set(false);
|
|
2499
|
+
}, 300);
|
|
2500
|
+
}), takeUntilDestroyed(this.destroyRef))
|
|
2501
|
+
.subscribe();
|
|
2553
2502
|
this.popupInstance.animationOrigin$
|
|
2554
|
-
.pipe(tap((
|
|
2503
|
+
.pipe(tap((origin) => {
|
|
2504
|
+
const animationParams = this.popupInstance.options;
|
|
2555
2505
|
this.$animationParams.set({
|
|
2556
|
-
startOrigin:
|
|
2557
|
-
endOrigin:
|
|
2558
|
-
start:
|
|
2559
|
-
end:
|
|
2560
|
-
leftStart:
|
|
2561
|
-
leftEnd:
|
|
2562
|
-
topStart:
|
|
2563
|
-
topEnd:
|
|
2506
|
+
startOrigin: origin,
|
|
2507
|
+
endOrigin: origin,
|
|
2508
|
+
start: animationParams.start,
|
|
2509
|
+
end: animationParams.end,
|
|
2510
|
+
leftStart: animationParams.leftStart,
|
|
2511
|
+
leftEnd: animationParams.leftEnd,
|
|
2512
|
+
topStart: animationParams.topStart,
|
|
2513
|
+
topEnd: animationParams.topEnd,
|
|
2564
2514
|
});
|
|
2565
2515
|
this.$isShow.set(true);
|
|
2566
2516
|
}), takeUntil$1(this.destroyAnimationOrigin$), takeUntilDestroyed(this.destroyRef))
|
|
@@ -2590,7 +2540,7 @@ class UiPopupContainerDirective {
|
|
|
2590
2540
|
shouldClose() {
|
|
2591
2541
|
this.$shouldClose.set(true);
|
|
2592
2542
|
}
|
|
2593
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupContainerDirective, deps: [{ token: UiPopupInstance }, { token: i0.DestroyRef }, { token:
|
|
2543
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupContainerDirective, deps: [{ token: UiPopupInstance }, { token: i0.DestroyRef }, { token: UiModal }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2594
2544
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.1", type: UiPopupContainerDirective, isStandalone: true, selector: "app-ui-popup-container", inputs: { $overflowHidden: { classPropertyName: "$overflowHidden", publicName: "$overflowHidden", isSignal: true, isRequired: false, transformFunction: null }, $shouldClose: { classPropertyName: "$shouldClose", publicName: "$shouldClose", isSignal: true, isRequired: false, transformFunction: null }, $hasCloseButton: { classPropertyName: "$hasCloseButton", publicName: "$hasCloseButton", isSignal: true, isRequired: false, transformFunction: null }, $isEnableFadeAnimation: { classPropertyName: "$isEnableFadeAnimation", publicName: "$isEnableFadeAnimation", isSignal: true, isRequired: false, transformFunction: null }, $iconClose: { classPropertyName: "$iconClose", publicName: "$iconClose", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { $shouldClose: "$shouldCloseChange", $iconClose: "$iconCloseChange" }, ngImport: i0 });
|
|
2595
2545
|
}
|
|
2596
2546
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupContainerDirective, decorators: [{
|
|
@@ -2601,9 +2551,417 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
|
|
|
2601
2551
|
}], ctorParameters: () => [{ type: UiPopupInstance, decorators: [{
|
|
2602
2552
|
type: Inject,
|
|
2603
2553
|
args: [UiPopupInstance]
|
|
2604
|
-
}] }, { type: i0.DestroyRef }, { type:
|
|
2554
|
+
}] }, { type: i0.DestroyRef }, { type: UiModal }, { type: i0.ElementRef }], propDecorators: { $overflowHidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "$overflowHidden", required: false }] }], $shouldClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "$shouldClose", required: false }] }, { type: i0.Output, args: ["$shouldCloseChange"] }], $hasCloseButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "$hasCloseButton", required: false }] }], $isEnableFadeAnimation: [{ type: i0.Input, args: [{ isSignal: true, alias: "$isEnableFadeAnimation", required: false }] }], $iconClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "$iconClose", required: false }] }, { type: i0.Output, args: ["$iconCloseChange"] }] } });
|
|
2555
|
+
|
|
2556
|
+
class UiPopupImageDirective {
|
|
2557
|
+
destroyRef;
|
|
2558
|
+
src = '';
|
|
2559
|
+
width = 0;
|
|
2560
|
+
height = 0;
|
|
2561
|
+
$imageWidth = signal(0, ...(ngDevMode ? [{ debugName: "$imageWidth" }] : []));
|
|
2562
|
+
$imageHeight = signal(0, ...(ngDevMode ? [{ debugName: "$imageHeight" }] : []));
|
|
2563
|
+
$imageStyleTransform = signal('', ...(ngDevMode ? [{ debugName: "$imageStyleTransform" }] : []));
|
|
2564
|
+
$container = viewChild('container', ...(ngDevMode ? [{ debugName: "$container" }] : []));
|
|
2565
|
+
$image = viewChild('image', ...(ngDevMode ? [{ debugName: "$image" }] : []));
|
|
2566
|
+
$cursor = signal('auto', ...(ngDevMode ? [{ debugName: "$cursor" }] : []));
|
|
2567
|
+
isDragging = false;
|
|
2568
|
+
isTouchDragging = false;
|
|
2569
|
+
isPinching = false;
|
|
2570
|
+
lastTouchX = 0;
|
|
2571
|
+
lastTouchY = 0;
|
|
2572
|
+
lastTouchDistance = 0;
|
|
2573
|
+
size = { w: 0, h: 0 };
|
|
2574
|
+
speed = 0.5;
|
|
2575
|
+
pos = { x: 0, y: 0 };
|
|
2576
|
+
target = { x: 0, y: 0 };
|
|
2577
|
+
pointer = { x: 0, y: 0 };
|
|
2578
|
+
scale = 1;
|
|
2579
|
+
constructor(destroyRef) {
|
|
2580
|
+
this.destroyRef = destroyRef;
|
|
2581
|
+
}
|
|
2582
|
+
ngOnInit() {
|
|
2583
|
+
if (!isBrowser()) {
|
|
2584
|
+
this.$imageWidth.set(this.width);
|
|
2585
|
+
this.$imageHeight.set(this.height);
|
|
2586
|
+
return;
|
|
2587
|
+
}
|
|
2588
|
+
const result = getAspectRatioFit(window.innerWidth - window.innerWidth / 8, window.innerHeight - window.innerHeight / 8, this.width, this.height);
|
|
2589
|
+
this.$imageWidth.set(result.width);
|
|
2590
|
+
this.$imageHeight.set(result.height);
|
|
2591
|
+
}
|
|
2592
|
+
ngAfterViewInit() {
|
|
2593
|
+
const container = this.$container()?.nativeElement;
|
|
2594
|
+
if (!container)
|
|
2595
|
+
return;
|
|
2596
|
+
if (!isBrowser())
|
|
2597
|
+
return;
|
|
2598
|
+
this.size = {
|
|
2599
|
+
w: container.offsetWidth,
|
|
2600
|
+
h: container.offsetHeight,
|
|
2601
|
+
};
|
|
2602
|
+
// -----------------------------
|
|
2603
|
+
// KEYBOARD CURSOR LOGIC
|
|
2604
|
+
// -----------------------------
|
|
2605
|
+
fromEvent(window, 'keydown')
|
|
2606
|
+
.pipe(tap((event) => {
|
|
2607
|
+
if (event.ctrlKey)
|
|
2608
|
+
this.$cursor.set('zoom-in');
|
|
2609
|
+
}), takeUntilDestroyed(this.destroyRef))
|
|
2610
|
+
.subscribe();
|
|
2611
|
+
fromEvent(window, 'keyup')
|
|
2612
|
+
.pipe(tap((event) => {
|
|
2613
|
+
if (event.key === 'Control') {
|
|
2614
|
+
this.$cursor.set(this.scale > 1 ? 'grab' : 'auto');
|
|
2615
|
+
}
|
|
2616
|
+
}), takeUntilDestroyed(this.destroyRef))
|
|
2617
|
+
.subscribe();
|
|
2618
|
+
// -----------------------------
|
|
2619
|
+
// MOUSE DRAG
|
|
2620
|
+
// -----------------------------
|
|
2621
|
+
fromEvent(window, 'mouseup')
|
|
2622
|
+
.pipe(tap((event) => {
|
|
2623
|
+
if (event.button === 0) {
|
|
2624
|
+
this.isDragging = false;
|
|
2625
|
+
this.$cursor.set(this.scale > 1 ? 'grab' : 'auto');
|
|
2626
|
+
}
|
|
2627
|
+
}), takeUntilDestroyed(this.destroyRef))
|
|
2628
|
+
.subscribe();
|
|
2629
|
+
fromEvent(container, 'mousedown')
|
|
2630
|
+
.pipe(tap((event) => {
|
|
2631
|
+
if (event.button === 0) {
|
|
2632
|
+
event.preventDefault();
|
|
2633
|
+
this.isDragging = true;
|
|
2634
|
+
this.$cursor.set(this.scale > 1 ? 'grabbing' : 'auto');
|
|
2635
|
+
}
|
|
2636
|
+
}), takeUntilDestroyed(this.destroyRef))
|
|
2637
|
+
.subscribe();
|
|
2638
|
+
fromEvent(window, 'mousemove')
|
|
2639
|
+
.pipe(tap((e) => {
|
|
2640
|
+
if (this.isDragging && this.scale > 1) {
|
|
2641
|
+
this.pos.x += e.movementX;
|
|
2642
|
+
this.pos.y += e.movementY;
|
|
2643
|
+
this.setPosition();
|
|
2644
|
+
this.$imageStyleTransform.set(`translate(${this.pos.x}px,${this.pos.y}px) scale(${this.scale})`);
|
|
2645
|
+
}
|
|
2646
|
+
}), takeUntilDestroyed(this.destroyRef))
|
|
2647
|
+
.subscribe();
|
|
2648
|
+
// -----------------------------
|
|
2649
|
+
// MOUSE WHEEL ZOOM
|
|
2650
|
+
// -----------------------------
|
|
2651
|
+
fromEvent(window, 'wheel', { passive: false })
|
|
2652
|
+
.pipe(tap((event) => {
|
|
2653
|
+
event.preventDefault();
|
|
2654
|
+
const rect = container.getBoundingClientRect();
|
|
2655
|
+
if (event.ctrlKey) {
|
|
2656
|
+
this.pointer.x = event.clientX - rect.left;
|
|
2657
|
+
this.pointer.y = event.clientY - rect.top;
|
|
2658
|
+
this.target.x = (this.pointer.x - this.pos.x) / this.scale;
|
|
2659
|
+
this.target.y = (this.pointer.y - this.pos.y) / this.scale;
|
|
2660
|
+
this.scale += -1 * Math.max(-1, Math.min(1, event.deltaY)) * this.speed * this.scale;
|
|
2661
|
+
const maxScale = 4;
|
|
2662
|
+
const minScale = 1;
|
|
2663
|
+
this.scale = Math.max(minScale, Math.min(maxScale, this.scale));
|
|
2664
|
+
this.pos.x = -this.target.x * this.scale + this.pointer.x;
|
|
2665
|
+
this.pos.y = -this.target.y * this.scale + this.pointer.y;
|
|
2666
|
+
this.setPosition();
|
|
2667
|
+
this.$imageStyleTransform.set(`translate(${this.pos.x}px,${this.pos.y}px) scale(${this.scale})`);
|
|
2668
|
+
}
|
|
2669
|
+
else {
|
|
2670
|
+
this.pos.x -= event.deltaX * 2;
|
|
2671
|
+
this.pos.y -= event.deltaY * 2;
|
|
2672
|
+
}
|
|
2673
|
+
}), takeUntilDestroyed(this.destroyRef))
|
|
2674
|
+
.subscribe();
|
|
2675
|
+
// -----------------------------
|
|
2676
|
+
// TOUCH PINCH ZOOM
|
|
2677
|
+
// -----------------------------
|
|
2678
|
+
fromEvent(container, 'touchstart')
|
|
2679
|
+
.pipe(tap((event) => {
|
|
2680
|
+
if (event.touches.length === 2) {
|
|
2681
|
+
this.isPinching = true;
|
|
2682
|
+
const [t1, t2] = event.touches;
|
|
2683
|
+
this.lastTouchDistance = Math.hypot(t2.clientX - t1.clientX, t2.clientY - t1.clientY);
|
|
2684
|
+
}
|
|
2685
|
+
if (event.touches.length === 1 && this.scale > 1) {
|
|
2686
|
+
const t = event.touches[0];
|
|
2687
|
+
this.lastTouchX = t.clientX;
|
|
2688
|
+
this.lastTouchY = t.clientY;
|
|
2689
|
+
this.isTouchDragging = true;
|
|
2690
|
+
this.$cursor.set('grabbing');
|
|
2691
|
+
}
|
|
2692
|
+
}), takeUntilDestroyed(this.destroyRef))
|
|
2693
|
+
.subscribe();
|
|
2694
|
+
fromEvent(container, 'touchmove')
|
|
2695
|
+
.pipe(tap((event) => {
|
|
2696
|
+
if (this.isPinching && event.touches.length === 2) {
|
|
2697
|
+
event.preventDefault();
|
|
2698
|
+
const [t1, t2] = event.touches;
|
|
2699
|
+
const newDistance = Math.hypot(t2.clientX - t1.clientX, t2.clientY - t1.clientY);
|
|
2700
|
+
const delta = newDistance - this.lastTouchDistance;
|
|
2701
|
+
this.lastTouchDistance = newDistance;
|
|
2702
|
+
const rect = container.getBoundingClientRect();
|
|
2703
|
+
const centerX = (t1.clientX + t2.clientX) / 2 - rect.left;
|
|
2704
|
+
const centerY = (t1.clientY + t2.clientY) / 2 - rect.top;
|
|
2705
|
+
this.pointer.x = centerX;
|
|
2706
|
+
this.pointer.y = centerY;
|
|
2707
|
+
this.target.x = (this.pointer.x - this.pos.x) / this.scale;
|
|
2708
|
+
this.target.y = (this.pointer.y - this.pos.y) / this.scale;
|
|
2709
|
+
const pinchSpeed = 0.005;
|
|
2710
|
+
this.scale += delta * pinchSpeed * this.scale;
|
|
2711
|
+
const maxScale = 4;
|
|
2712
|
+
const minScale = 1;
|
|
2713
|
+
this.scale = Math.max(minScale, Math.min(maxScale, this.scale));
|
|
2714
|
+
this.pos.x = -this.target.x * this.scale + this.pointer.x;
|
|
2715
|
+
this.pos.y = -this.target.y * this.scale + this.pointer.y;
|
|
2716
|
+
this.setPosition();
|
|
2717
|
+
this.$imageStyleTransform.set(`translate(${this.pos.x}px,${this.pos.y}px) scale(${this.scale})`);
|
|
2718
|
+
}
|
|
2719
|
+
if (this.isTouchDragging && event.touches.length === 1) {
|
|
2720
|
+
event.preventDefault();
|
|
2721
|
+
const t = event.touches[0];
|
|
2722
|
+
const dx = t.clientX - this.lastTouchX;
|
|
2723
|
+
const dy = t.clientY - this.lastTouchY;
|
|
2724
|
+
this.lastTouchX = t.clientX;
|
|
2725
|
+
this.lastTouchY = t.clientY;
|
|
2726
|
+
this.pos.x += dx;
|
|
2727
|
+
this.pos.y += dy;
|
|
2728
|
+
this.setPosition();
|
|
2729
|
+
this.$imageStyleTransform.set(`translate(${this.pos.x}px,${this.pos.y}px) scale(${this.scale})`);
|
|
2730
|
+
}
|
|
2731
|
+
}), takeUntilDestroyed(this.destroyRef))
|
|
2732
|
+
.subscribe();
|
|
2733
|
+
fromEvent(container, 'touchend')
|
|
2734
|
+
.pipe(tap(() => {
|
|
2735
|
+
this.isPinching = false;
|
|
2736
|
+
this.isTouchDragging = false;
|
|
2737
|
+
this.$cursor.set(this.scale > 1 ? 'grab' : 'auto');
|
|
2738
|
+
}), takeUntilDestroyed(this.destroyRef))
|
|
2739
|
+
.subscribe();
|
|
2740
|
+
}
|
|
2741
|
+
setPosition() {
|
|
2742
|
+
if (this.pos.x > 0)
|
|
2743
|
+
this.pos.x = 0;
|
|
2744
|
+
if (this.pos.x + this.size.w * this.scale < this.size.w) {
|
|
2745
|
+
this.pos.x = -this.size.w * (this.scale - 1);
|
|
2746
|
+
}
|
|
2747
|
+
if (this.pos.y > 0)
|
|
2748
|
+
this.pos.y = 0;
|
|
2749
|
+
if (this.pos.y + this.size.h * this.scale < this.size.h) {
|
|
2750
|
+
this.pos.y = -this.size.h * (this.scale - 1);
|
|
2751
|
+
}
|
|
2752
|
+
}
|
|
2753
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupImageDirective, deps: [{ token: i0.DestroyRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2754
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.1.1", type: UiPopupImageDirective, isStandalone: true, selector: "app-ui-popup-image", inputs: { src: "src", width: "width", height: "height" }, viewQueries: [{ propertyName: "$container", first: true, predicate: ["container"], descendants: true, isSignal: true }, { propertyName: "$image", first: true, predicate: ["image"], descendants: true, isSignal: true }], ngImport: i0 });
|
|
2755
|
+
}
|
|
2756
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupImageDirective, decorators: [{
|
|
2757
|
+
type: Directive,
|
|
2758
|
+
args: [{
|
|
2759
|
+
selector: 'app-ui-popup-image',
|
|
2760
|
+
}]
|
|
2761
|
+
}], ctorParameters: () => [{ type: i0.DestroyRef }], propDecorators: { src: [{
|
|
2762
|
+
type: Input,
|
|
2763
|
+
args: [{ required: true }]
|
|
2764
|
+
}], width: [{
|
|
2765
|
+
type: Input,
|
|
2766
|
+
args: [{ required: true }]
|
|
2767
|
+
}], height: [{
|
|
2768
|
+
type: Input,
|
|
2769
|
+
args: [{ required: true }]
|
|
2770
|
+
}], $container: [{ type: i0.ViewChild, args: ['container', { isSignal: true }] }], $image: [{ type: i0.ViewChild, args: ['image', { isSignal: true }] }] } });
|
|
2771
|
+
|
|
2772
|
+
class UiPopupBackdropService {
|
|
2773
|
+
tipContainerPortal;
|
|
2774
|
+
backdropPortal;
|
|
2775
|
+
constructor(component, tipComponent) {
|
|
2776
|
+
this.backdropPortal = new ComponentPortal(component);
|
|
2777
|
+
if (tipComponent) {
|
|
2778
|
+
this.tipContainerPortal = new ComponentPortal(tipComponent);
|
|
2779
|
+
}
|
|
2780
|
+
}
|
|
2781
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupBackdropService, deps: [{ token: i0.Type }, { token: i0.Type }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2782
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupBackdropService, providedIn: 'root' });
|
|
2783
|
+
}
|
|
2784
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupBackdropService, decorators: [{
|
|
2785
|
+
type: Injectable,
|
|
2786
|
+
args: [{
|
|
2787
|
+
providedIn: 'root',
|
|
2788
|
+
}]
|
|
2789
|
+
}], ctorParameters: () => [{ type: i0.Type }, { type: i0.Type }] });
|
|
2790
|
+
|
|
2791
|
+
class UiPopupService extends UiModal {
|
|
2792
|
+
defaultAnimationOptions = {
|
|
2793
|
+
startOrigin: '',
|
|
2794
|
+
endOrigin: '',
|
|
2795
|
+
start: '',
|
|
2796
|
+
end: '',
|
|
2797
|
+
leftStart: '',
|
|
2798
|
+
leftEnd: '',
|
|
2799
|
+
topStart: '',
|
|
2800
|
+
topEnd: '',
|
|
2801
|
+
};
|
|
2802
|
+
constructor(overlay, injector, destroyRef, router, backdropService) {
|
|
2803
|
+
super(overlay, injector, destroyRef, router, backdropService);
|
|
2804
|
+
}
|
|
2805
|
+
/**
|
|
2806
|
+
* Opens a popup with the specified component and options.
|
|
2807
|
+
*
|
|
2808
|
+
* @param component - The component to be displayed in the popup.
|
|
2809
|
+
* @param options - Configuration options for the popup, including inputs.
|
|
2810
|
+
* @param id - A unique identifier for the popup instance.
|
|
2811
|
+
* @param parameters - (Optional) Configuration options for the popup.
|
|
2812
|
+
*/
|
|
2813
|
+
open(component, options, id, parameters) {
|
|
2814
|
+
if (this.instances.length) {
|
|
2815
|
+
this.closePrevious(parameters.isClosePrevious ?? false);
|
|
2816
|
+
parameters.animationOptions = {
|
|
2817
|
+
startOrigin: 'center center',
|
|
2818
|
+
endOrigin: 'center center',
|
|
2819
|
+
start: 'translateX(100%)',
|
|
2820
|
+
end: 'translateX(0)',
|
|
2821
|
+
leftStart: '0',
|
|
2822
|
+
leftEnd: '0',
|
|
2823
|
+
topStart: '0',
|
|
2824
|
+
topEnd: '0',
|
|
2825
|
+
};
|
|
2826
|
+
}
|
|
2827
|
+
this.showBackdrop(parameters.isStaticBackdrop);
|
|
2828
|
+
const overlayRef = this.overlay.create({
|
|
2829
|
+
hasBackdrop: false,
|
|
2830
|
+
backdropClass: 'cdk-overlay-transparent-backdrop',
|
|
2831
|
+
positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),
|
|
2832
|
+
});
|
|
2833
|
+
this.subscribeToOutsideEvents();
|
|
2834
|
+
this.createPopup(overlayRef, component, options, id, parameters);
|
|
2835
|
+
if (this.instances.length === 1) {
|
|
2836
|
+
this.defaultAnimationOptions = this.instances[0].options;
|
|
2837
|
+
}
|
|
2838
|
+
}
|
|
2839
|
+
close() {
|
|
2840
|
+
this.resetAnimationForSingleInstance();
|
|
2841
|
+
super.close();
|
|
2842
|
+
this.applyHideToLastInstance();
|
|
2843
|
+
}
|
|
2844
|
+
closeAll() {
|
|
2845
|
+
this.instances.forEach((instance) => {
|
|
2846
|
+
instance.options = this.defaultAnimationOptions;
|
|
2847
|
+
instance.animationOrigin$.next('center');
|
|
2848
|
+
});
|
|
2849
|
+
super.closeAll();
|
|
2850
|
+
}
|
|
2851
|
+
closeById(id) {
|
|
2852
|
+
this.resetAnimationForSingleInstance();
|
|
2853
|
+
super.closeById(id);
|
|
2854
|
+
this.applyHideToLastInstance();
|
|
2855
|
+
}
|
|
2856
|
+
resetAnimationForSingleInstance() {
|
|
2857
|
+
if (this.instances.length === 1) {
|
|
2858
|
+
const instance = this.instances[0];
|
|
2859
|
+
instance.options = this.defaultAnimationOptions;
|
|
2860
|
+
instance.animationOrigin$.next('center');
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2863
|
+
applyHideToLastInstance() {
|
|
2864
|
+
if (this.instances.length >= 1) {
|
|
2865
|
+
this.instances[this.instances.length - 1].isHide$.next(false);
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2868
|
+
closePrevious(isClosePrevious) {
|
|
2869
|
+
if (this.instances.length === 0)
|
|
2870
|
+
return;
|
|
2871
|
+
const lastIndex = this.instances.length - 1;
|
|
2872
|
+
const lastPopupInstance = this.instances[lastIndex];
|
|
2873
|
+
lastPopupInstance.isHide$.next(true);
|
|
2874
|
+
if (isClosePrevious) {
|
|
2875
|
+
asyncScheduler.schedule(() => {
|
|
2876
|
+
// ensure the instance still exists
|
|
2877
|
+
const currentIndex = this.instances.indexOf(lastPopupInstance);
|
|
2878
|
+
if (currentIndex !== -1) {
|
|
2879
|
+
lastPopupInstance.close();
|
|
2880
|
+
this.instances.splice(currentIndex, 1);
|
|
2881
|
+
}
|
|
2882
|
+
}, 300);
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
/**
|
|
2886
|
+
* Opens a popup that scales from the provided origin element to the centered popup size.
|
|
2887
|
+
* Useful for image-preview transitions where the source element animates into the popup.
|
|
2888
|
+
*/
|
|
2889
|
+
openScaledFromElement(component, options, id, originElement, sourceWidth, sourceHeight, parameters = {}) {
|
|
2890
|
+
const animationOptions = this.createScaleAnimationOptionsFromElement(originElement, sourceWidth, sourceHeight);
|
|
2891
|
+
this.open(component, options, id, {
|
|
2892
|
+
...parameters,
|
|
2893
|
+
animationOptions,
|
|
2894
|
+
});
|
|
2895
|
+
}
|
|
2896
|
+
createScaleAnimationOptionsFromElement(originElement, sourceWidth, sourceHeight) {
|
|
2897
|
+
const rect = originElement.getBoundingClientRect();
|
|
2898
|
+
const viewportWidth = isBrowser() ? window.innerWidth : sourceWidth;
|
|
2899
|
+
const viewportHeight = isBrowser() ? window.innerHeight : sourceHeight;
|
|
2900
|
+
const centerX = viewportWidth / 2;
|
|
2901
|
+
const centerY = viewportHeight / 2;
|
|
2902
|
+
const targetX = rect.left + rect.width / 2;
|
|
2903
|
+
const targetY = rect.top + rect.height / 2;
|
|
2904
|
+
const offsetX = targetX - centerX;
|
|
2905
|
+
const offsetY = targetY - centerY;
|
|
2906
|
+
const fitted = getAspectRatioFit(viewportWidth - viewportWidth / 8, viewportHeight - viewportHeight / 8, sourceWidth, sourceHeight);
|
|
2907
|
+
const scaleY = Math.trunc((sourceHeight / fitted.height) * 100) / 100;
|
|
2908
|
+
const scaleX = Math.trunc((sourceWidth / fitted.width) * 100) / 100;
|
|
2909
|
+
return {
|
|
2910
|
+
startOrigin: 'center center',
|
|
2911
|
+
endOrigin: 'center center',
|
|
2912
|
+
start: `scale(${scaleY}, ${scaleX})`,
|
|
2913
|
+
end: 'scale(1)',
|
|
2914
|
+
leftStart: `${offsetX}px`,
|
|
2915
|
+
leftEnd: '0',
|
|
2916
|
+
topStart: `${offsetY}px`,
|
|
2917
|
+
topEnd: '0',
|
|
2918
|
+
};
|
|
2919
|
+
}
|
|
2920
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupService, deps: [{ token: i1.Overlay }, { token: i0.Injector }, { token: i0.DestroyRef }, { token: i2$1.Router }, { token: UiPopupBackdropService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2921
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupService, providedIn: 'root' });
|
|
2922
|
+
}
|
|
2923
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupService, decorators: [{
|
|
2924
|
+
type: Injectable,
|
|
2925
|
+
args: [{
|
|
2926
|
+
providedIn: 'root',
|
|
2927
|
+
}]
|
|
2928
|
+
}], ctorParameters: () => [{ type: i1.Overlay }, { type: i0.Injector }, { type: i0.DestroyRef }, { type: i2$1.Router }, { type: UiPopupBackdropService }] });
|
|
2929
|
+
|
|
2930
|
+
class UiPopupBackdropDirective {
|
|
2931
|
+
elementRef;
|
|
2932
|
+
uiPopupService;
|
|
2933
|
+
destroyRef;
|
|
2934
|
+
isStaticBackdrop = false;
|
|
2935
|
+
clicked = () => { };
|
|
2936
|
+
constructor(elementRef, uiPopupService, destroyRef) {
|
|
2937
|
+
this.elementRef = elementRef;
|
|
2938
|
+
this.uiPopupService = uiPopupService;
|
|
2939
|
+
this.destroyRef = destroyRef;
|
|
2940
|
+
}
|
|
2941
|
+
ngOnInit() {
|
|
2942
|
+
fromEvent(this.elementRef.nativeElement, 'click')
|
|
2943
|
+
.pipe(tap(() => {
|
|
2944
|
+
if (this.isStaticBackdrop) {
|
|
2945
|
+
this.clicked();
|
|
2946
|
+
return;
|
|
2947
|
+
}
|
|
2948
|
+
this.uiPopupService.closeAll();
|
|
2949
|
+
}), takeUntilDestroyed(this.destroyRef))
|
|
2950
|
+
.subscribe();
|
|
2951
|
+
}
|
|
2952
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupBackdropDirective, deps: [{ token: i0.ElementRef }, { token: UiPopupService }, { token: i0.DestroyRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2953
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.1", type: UiPopupBackdropDirective, isStandalone: true, selector: "app-ui-popup-backdrop", inputs: { isStaticBackdrop: "isStaticBackdrop", clicked: "clicked" }, ngImport: i0 });
|
|
2954
|
+
}
|
|
2955
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupBackdropDirective, decorators: [{
|
|
2956
|
+
type: Directive,
|
|
2957
|
+
args: [{ selector: 'app-ui-popup-backdrop' }]
|
|
2958
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: UiPopupService }, { type: i0.DestroyRef }], propDecorators: { isStaticBackdrop: [{
|
|
2959
|
+
type: Input
|
|
2960
|
+
}], clicked: [{
|
|
2961
|
+
type: Input
|
|
2962
|
+
}] } });
|
|
2605
2963
|
|
|
2606
|
-
class UiDropdownService extends
|
|
2964
|
+
class UiDropdownService extends UiModal {
|
|
2607
2965
|
containerSize$ = new BehaviorSubject({
|
|
2608
2966
|
width: 0,
|
|
2609
2967
|
height: 0,
|
|
@@ -2709,6 +3067,9 @@ class UiDropdownService extends UiPopupService {
|
|
|
2709
3067
|
},
|
|
2710
3068
|
},
|
|
2711
3069
|
};
|
|
3070
|
+
constructor(overlay, injector, destroyRef, router, backdropService) {
|
|
3071
|
+
super(overlay, injector, destroyRef, router, backdropService);
|
|
3072
|
+
}
|
|
2712
3073
|
/**
|
|
2713
3074
|
* Opens a tooltip (tip) component attached to a specific HTML element.
|
|
2714
3075
|
* The tooltip displays text content with customizable position and offset.
|
|
@@ -2759,10 +3120,10 @@ class UiDropdownService extends UiPopupService {
|
|
|
2759
3120
|
if (fetchedParameters.hasAttachedWidth) {
|
|
2760
3121
|
attachedWidth = attachedRef.clientWidth;
|
|
2761
3122
|
}
|
|
2762
|
-
if (fetchedParameters.removePrevious && this.
|
|
3123
|
+
if (fetchedParameters.removePrevious && this.instances.length) {
|
|
2763
3124
|
this.destroyOutsideClickSubscription$.next();
|
|
2764
3125
|
}
|
|
2765
|
-
if (fetchedParameters.removePrevious && this.
|
|
3126
|
+
if (fetchedParameters.removePrevious && this.instances.length) {
|
|
2766
3127
|
this.close();
|
|
2767
3128
|
}
|
|
2768
3129
|
if (isBrowser() && window.matchMedia('(max-width: 48rem)').matches) {
|
|
@@ -2777,7 +3138,7 @@ class UiDropdownService extends UiPopupService {
|
|
|
2777
3138
|
this.subscribeToOutsideEvents(overlayRef);
|
|
2778
3139
|
}
|
|
2779
3140
|
this.createPopup(overlayRef, component, fetchedParameters.options ?? {}, id, { width: attachedWidth });
|
|
2780
|
-
this.
|
|
3141
|
+
this.instances[this.instances.length - 1].animationOrigin$.next(this.connectedPositions[parameters.position ?? 'bottom'].animationOrigin);
|
|
2781
3142
|
}
|
|
2782
3143
|
/**
|
|
2783
3144
|
* Opens a dropdown from the mouse position with intelligent border detection.
|
|
@@ -2791,10 +3152,10 @@ class UiDropdownService extends UiPopupService {
|
|
|
2791
3152
|
*/
|
|
2792
3153
|
openAtMousePosition(component, event, id, parameters = {}) {
|
|
2793
3154
|
const fetchedParameters = this.fetchDropDownParameters(parameters);
|
|
2794
|
-
if (fetchedParameters.removePrevious && this.
|
|
3155
|
+
if (fetchedParameters.removePrevious && this.instances.length) {
|
|
2795
3156
|
this.destroyOutsideClickSubscription$.next();
|
|
2796
3157
|
}
|
|
2797
|
-
if (fetchedParameters.removePrevious && this.
|
|
3158
|
+
if (fetchedParameters.removePrevious && this.instances.length) {
|
|
2798
3159
|
this.close();
|
|
2799
3160
|
}
|
|
2800
3161
|
if (isBrowser() && window.matchMedia('(max-width: 48rem)').matches) {
|
|
@@ -2810,10 +3171,14 @@ class UiDropdownService extends UiPopupService {
|
|
|
2810
3171
|
}
|
|
2811
3172
|
this.createPopup(overlayRef, component, fetchedParameters.options ?? {}, id, {
|
|
2812
3173
|
animationOptions: {
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
3174
|
+
startOrigin: 'center center',
|
|
3175
|
+
endOrigin: 'center center',
|
|
3176
|
+
start: 'scale(0.4)',
|
|
3177
|
+
end: 'scale(1)',
|
|
3178
|
+
leftStart: '0px',
|
|
3179
|
+
leftEnd: '0',
|
|
3180
|
+
topStart: '0px',
|
|
3181
|
+
topEnd: '0',
|
|
2817
3182
|
},
|
|
2818
3183
|
});
|
|
2819
3184
|
this.containerSize$
|
|
@@ -2823,7 +3188,7 @@ class UiDropdownService extends UiPopupService {
|
|
|
2823
3188
|
}
|
|
2824
3189
|
const animationOrigin = this.calculateMousePositionAnimationOrigin(event, size);
|
|
2825
3190
|
const positionAdjustment = this.calculateMousePositionAdjustment(event, size);
|
|
2826
|
-
this.
|
|
3191
|
+
this.instances[this.instances.length - 1].animationOrigin$.next(animationOrigin);
|
|
2827
3192
|
const positionStrategy = overlayRef.getConfig().positionStrategy;
|
|
2828
3193
|
if (positionStrategy instanceof FlexibleConnectedPositionStrategy && positionAdjustment) {
|
|
2829
3194
|
positionStrategy.setOrigin({ x: positionAdjustment.left, y: positionAdjustment.top });
|
|
@@ -2958,7 +3323,7 @@ class UiDropdownService extends UiPopupService {
|
|
|
2958
3323
|
},
|
|
2959
3324
|
]);
|
|
2960
3325
|
}
|
|
2961
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiDropdownService, deps:
|
|
3326
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiDropdownService, deps: [{ token: i1.Overlay }, { token: i0.Injector }, { token: i0.DestroyRef }, { token: i2$1.Router }, { token: UiPopupBackdropService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2962
3327
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiDropdownService, providedIn: 'root' });
|
|
2963
3328
|
}
|
|
2964
3329
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiDropdownService, decorators: [{
|
|
@@ -2966,7 +3331,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
|
|
|
2966
3331
|
args: [{
|
|
2967
3332
|
providedIn: 'root',
|
|
2968
3333
|
}]
|
|
2969
|
-
}] });
|
|
3334
|
+
}], ctorParameters: () => [{ type: i1.Overlay }, { type: i0.Injector }, { type: i0.DestroyRef }, { type: i2$1.Router }, { type: UiPopupBackdropService }] });
|
|
2970
3335
|
|
|
2971
3336
|
class UiDropdownContainerDirective extends UiPopupContainerDirective {
|
|
2972
3337
|
dropDownService;
|
|
@@ -3195,252 +3560,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
|
|
|
3195
3560
|
}]
|
|
3196
3561
|
}], propDecorators: { $hasNext: [{ type: i0.Input, args: [{ isSignal: true, alias: "$hasNext", required: true }] }], $hasPrevious: [{ type: i0.Input, args: [{ isSignal: true, alias: "$hasPrevious", required: true }] }], $nextClicked: [{ type: i0.Output, args: ["$nextClicked"] }], $previousClicked: [{ type: i0.Output, args: ["$previousClicked"] }] } });
|
|
3197
3562
|
|
|
3198
|
-
class UiPopupImageDirective {
|
|
3199
|
-
destroyRef;
|
|
3200
|
-
src = '';
|
|
3201
|
-
width = 0;
|
|
3202
|
-
height = 0;
|
|
3203
|
-
$imageWidth = signal(0, ...(ngDevMode ? [{ debugName: "$imageWidth" }] : []));
|
|
3204
|
-
$imageHeight = signal(0, ...(ngDevMode ? [{ debugName: "$imageHeight" }] : []));
|
|
3205
|
-
$imageStyleTransform = signal('', ...(ngDevMode ? [{ debugName: "$imageStyleTransform" }] : []));
|
|
3206
|
-
$container = viewChild('container', ...(ngDevMode ? [{ debugName: "$container" }] : []));
|
|
3207
|
-
$image = viewChild('image', ...(ngDevMode ? [{ debugName: "$image" }] : []));
|
|
3208
|
-
$cursor = signal('auto', ...(ngDevMode ? [{ debugName: "$cursor" }] : []));
|
|
3209
|
-
isDragging = false;
|
|
3210
|
-
isTouchDragging = false;
|
|
3211
|
-
isPinching = false;
|
|
3212
|
-
lastTouchX = 0;
|
|
3213
|
-
lastTouchY = 0;
|
|
3214
|
-
lastTouchDistance = 0;
|
|
3215
|
-
size = { w: 0, h: 0 };
|
|
3216
|
-
speed = 0.5;
|
|
3217
|
-
pos = { x: 0, y: 0 };
|
|
3218
|
-
target = { x: 0, y: 0 };
|
|
3219
|
-
pointer = { x: 0, y: 0 };
|
|
3220
|
-
scale = 1;
|
|
3221
|
-
constructor(destroyRef) {
|
|
3222
|
-
this.destroyRef = destroyRef;
|
|
3223
|
-
}
|
|
3224
|
-
ngOnInit() {
|
|
3225
|
-
if (!isBrowser()) {
|
|
3226
|
-
this.$imageWidth.set(this.width);
|
|
3227
|
-
this.$imageHeight.set(this.height);
|
|
3228
|
-
return;
|
|
3229
|
-
}
|
|
3230
|
-
const result = getAspectRatioFit(window.innerWidth - window.innerWidth / 8, window.innerHeight - window.innerHeight / 8, this.width, this.height);
|
|
3231
|
-
this.$imageWidth.set(result.width);
|
|
3232
|
-
this.$imageHeight.set(result.height);
|
|
3233
|
-
}
|
|
3234
|
-
ngAfterViewInit() {
|
|
3235
|
-
const container = this.$container()?.nativeElement;
|
|
3236
|
-
if (!container)
|
|
3237
|
-
return;
|
|
3238
|
-
if (!isBrowser())
|
|
3239
|
-
return;
|
|
3240
|
-
this.size = {
|
|
3241
|
-
w: container.offsetWidth,
|
|
3242
|
-
h: container.offsetHeight,
|
|
3243
|
-
};
|
|
3244
|
-
// -----------------------------
|
|
3245
|
-
// KEYBOARD CURSOR LOGIC
|
|
3246
|
-
// -----------------------------
|
|
3247
|
-
fromEvent(window, 'keydown')
|
|
3248
|
-
.pipe(tap((event) => {
|
|
3249
|
-
if (event.ctrlKey)
|
|
3250
|
-
this.$cursor.set('zoom-in');
|
|
3251
|
-
}), takeUntilDestroyed(this.destroyRef))
|
|
3252
|
-
.subscribe();
|
|
3253
|
-
fromEvent(window, 'keyup')
|
|
3254
|
-
.pipe(tap((event) => {
|
|
3255
|
-
if (event.key === 'Control') {
|
|
3256
|
-
this.$cursor.set(this.scale > 1 ? 'grab' : 'auto');
|
|
3257
|
-
}
|
|
3258
|
-
}), takeUntilDestroyed(this.destroyRef))
|
|
3259
|
-
.subscribe();
|
|
3260
|
-
// -----------------------------
|
|
3261
|
-
// MOUSE DRAG
|
|
3262
|
-
// -----------------------------
|
|
3263
|
-
fromEvent(window, 'mouseup')
|
|
3264
|
-
.pipe(tap((event) => {
|
|
3265
|
-
if (event.button === 0) {
|
|
3266
|
-
this.isDragging = false;
|
|
3267
|
-
this.$cursor.set(this.scale > 1 ? 'grab' : 'auto');
|
|
3268
|
-
}
|
|
3269
|
-
}), takeUntilDestroyed(this.destroyRef))
|
|
3270
|
-
.subscribe();
|
|
3271
|
-
fromEvent(container, 'mousedown')
|
|
3272
|
-
.pipe(tap((event) => {
|
|
3273
|
-
if (event.button === 0) {
|
|
3274
|
-
event.preventDefault();
|
|
3275
|
-
this.isDragging = true;
|
|
3276
|
-
this.$cursor.set(this.scale > 1 ? 'grabbing' : 'auto');
|
|
3277
|
-
}
|
|
3278
|
-
}), takeUntilDestroyed(this.destroyRef))
|
|
3279
|
-
.subscribe();
|
|
3280
|
-
fromEvent(window, 'mousemove')
|
|
3281
|
-
.pipe(tap((e) => {
|
|
3282
|
-
if (this.isDragging && this.scale > 1) {
|
|
3283
|
-
this.pos.x += e.movementX;
|
|
3284
|
-
this.pos.y += e.movementY;
|
|
3285
|
-
this.setPosition();
|
|
3286
|
-
this.$imageStyleTransform.set(`translate(${this.pos.x}px,${this.pos.y}px) scale(${this.scale})`);
|
|
3287
|
-
}
|
|
3288
|
-
}), takeUntilDestroyed(this.destroyRef))
|
|
3289
|
-
.subscribe();
|
|
3290
|
-
// -----------------------------
|
|
3291
|
-
// MOUSE WHEEL ZOOM
|
|
3292
|
-
// -----------------------------
|
|
3293
|
-
fromEvent(window, 'wheel', { passive: false })
|
|
3294
|
-
.pipe(tap((event) => {
|
|
3295
|
-
event.preventDefault();
|
|
3296
|
-
const rect = container.getBoundingClientRect();
|
|
3297
|
-
if (event.ctrlKey) {
|
|
3298
|
-
this.pointer.x = event.clientX - rect.left;
|
|
3299
|
-
this.pointer.y = event.clientY - rect.top;
|
|
3300
|
-
this.target.x = (this.pointer.x - this.pos.x) / this.scale;
|
|
3301
|
-
this.target.y = (this.pointer.y - this.pos.y) / this.scale;
|
|
3302
|
-
this.scale += -1 * Math.max(-1, Math.min(1, event.deltaY)) * this.speed * this.scale;
|
|
3303
|
-
const maxScale = 4;
|
|
3304
|
-
const minScale = 1;
|
|
3305
|
-
this.scale = Math.max(minScale, Math.min(maxScale, this.scale));
|
|
3306
|
-
this.pos.x = -this.target.x * this.scale + this.pointer.x;
|
|
3307
|
-
this.pos.y = -this.target.y * this.scale + this.pointer.y;
|
|
3308
|
-
this.setPosition();
|
|
3309
|
-
this.$imageStyleTransform.set(`translate(${this.pos.x}px,${this.pos.y}px) scale(${this.scale})`);
|
|
3310
|
-
}
|
|
3311
|
-
else {
|
|
3312
|
-
this.pos.x -= event.deltaX * 2;
|
|
3313
|
-
this.pos.y -= event.deltaY * 2;
|
|
3314
|
-
}
|
|
3315
|
-
}), takeUntilDestroyed(this.destroyRef))
|
|
3316
|
-
.subscribe();
|
|
3317
|
-
// -----------------------------
|
|
3318
|
-
// TOUCH PINCH ZOOM
|
|
3319
|
-
// -----------------------------
|
|
3320
|
-
fromEvent(container, 'touchstart')
|
|
3321
|
-
.pipe(tap((event) => {
|
|
3322
|
-
if (event.touches.length === 2) {
|
|
3323
|
-
this.isPinching = true;
|
|
3324
|
-
const [t1, t2] = event.touches;
|
|
3325
|
-
this.lastTouchDistance = Math.hypot(t2.clientX - t1.clientX, t2.clientY - t1.clientY);
|
|
3326
|
-
}
|
|
3327
|
-
if (event.touches.length === 1 && this.scale > 1) {
|
|
3328
|
-
const t = event.touches[0];
|
|
3329
|
-
this.lastTouchX = t.clientX;
|
|
3330
|
-
this.lastTouchY = t.clientY;
|
|
3331
|
-
this.isTouchDragging = true;
|
|
3332
|
-
this.$cursor.set('grabbing');
|
|
3333
|
-
}
|
|
3334
|
-
}), takeUntilDestroyed(this.destroyRef))
|
|
3335
|
-
.subscribe();
|
|
3336
|
-
fromEvent(container, 'touchmove')
|
|
3337
|
-
.pipe(tap((event) => {
|
|
3338
|
-
if (this.isPinching && event.touches.length === 2) {
|
|
3339
|
-
event.preventDefault();
|
|
3340
|
-
const [t1, t2] = event.touches;
|
|
3341
|
-
const newDistance = Math.hypot(t2.clientX - t1.clientX, t2.clientY - t1.clientY);
|
|
3342
|
-
const delta = newDistance - this.lastTouchDistance;
|
|
3343
|
-
this.lastTouchDistance = newDistance;
|
|
3344
|
-
const rect = container.getBoundingClientRect();
|
|
3345
|
-
const centerX = (t1.clientX + t2.clientX) / 2 - rect.left;
|
|
3346
|
-
const centerY = (t1.clientY + t2.clientY) / 2 - rect.top;
|
|
3347
|
-
this.pointer.x = centerX;
|
|
3348
|
-
this.pointer.y = centerY;
|
|
3349
|
-
this.target.x = (this.pointer.x - this.pos.x) / this.scale;
|
|
3350
|
-
this.target.y = (this.pointer.y - this.pos.y) / this.scale;
|
|
3351
|
-
const pinchSpeed = 0.005;
|
|
3352
|
-
this.scale += delta * pinchSpeed * this.scale;
|
|
3353
|
-
const maxScale = 4;
|
|
3354
|
-
const minScale = 1;
|
|
3355
|
-
this.scale = Math.max(minScale, Math.min(maxScale, this.scale));
|
|
3356
|
-
this.pos.x = -this.target.x * this.scale + this.pointer.x;
|
|
3357
|
-
this.pos.y = -this.target.y * this.scale + this.pointer.y;
|
|
3358
|
-
this.setPosition();
|
|
3359
|
-
this.$imageStyleTransform.set(`translate(${this.pos.x}px,${this.pos.y}px) scale(${this.scale})`);
|
|
3360
|
-
}
|
|
3361
|
-
if (this.isTouchDragging && event.touches.length === 1) {
|
|
3362
|
-
event.preventDefault();
|
|
3363
|
-
const t = event.touches[0];
|
|
3364
|
-
const dx = t.clientX - this.lastTouchX;
|
|
3365
|
-
const dy = t.clientY - this.lastTouchY;
|
|
3366
|
-
this.lastTouchX = t.clientX;
|
|
3367
|
-
this.lastTouchY = t.clientY;
|
|
3368
|
-
this.pos.x += dx;
|
|
3369
|
-
this.pos.y += dy;
|
|
3370
|
-
this.setPosition();
|
|
3371
|
-
this.$imageStyleTransform.set(`translate(${this.pos.x}px,${this.pos.y}px) scale(${this.scale})`);
|
|
3372
|
-
}
|
|
3373
|
-
}), takeUntilDestroyed(this.destroyRef))
|
|
3374
|
-
.subscribe();
|
|
3375
|
-
fromEvent(container, 'touchend')
|
|
3376
|
-
.pipe(tap(() => {
|
|
3377
|
-
this.isPinching = false;
|
|
3378
|
-
this.isTouchDragging = false;
|
|
3379
|
-
this.$cursor.set(this.scale > 1 ? 'grab' : 'auto');
|
|
3380
|
-
}), takeUntilDestroyed(this.destroyRef))
|
|
3381
|
-
.subscribe();
|
|
3382
|
-
}
|
|
3383
|
-
setPosition() {
|
|
3384
|
-
if (this.pos.x > 0)
|
|
3385
|
-
this.pos.x = 0;
|
|
3386
|
-
if (this.pos.x + this.size.w * this.scale < this.size.w) {
|
|
3387
|
-
this.pos.x = -this.size.w * (this.scale - 1);
|
|
3388
|
-
}
|
|
3389
|
-
if (this.pos.y > 0)
|
|
3390
|
-
this.pos.y = 0;
|
|
3391
|
-
if (this.pos.y + this.size.h * this.scale < this.size.h) {
|
|
3392
|
-
this.pos.y = -this.size.h * (this.scale - 1);
|
|
3393
|
-
}
|
|
3394
|
-
}
|
|
3395
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupImageDirective, deps: [{ token: i0.DestroyRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3396
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.1.1", type: UiPopupImageDirective, isStandalone: true, selector: "app-ui-popup-image", inputs: { src: "src", width: "width", height: "height" }, viewQueries: [{ propertyName: "$container", first: true, predicate: ["container"], descendants: true, isSignal: true }, { propertyName: "$image", first: true, predicate: ["image"], descendants: true, isSignal: true }], ngImport: i0 });
|
|
3397
|
-
}
|
|
3398
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupImageDirective, decorators: [{
|
|
3399
|
-
type: Directive,
|
|
3400
|
-
args: [{
|
|
3401
|
-
selector: 'app-ui-popup-image',
|
|
3402
|
-
}]
|
|
3403
|
-
}], ctorParameters: () => [{ type: i0.DestroyRef }], propDecorators: { src: [{
|
|
3404
|
-
type: Input,
|
|
3405
|
-
args: [{ required: true }]
|
|
3406
|
-
}], width: [{
|
|
3407
|
-
type: Input,
|
|
3408
|
-
args: [{ required: true }]
|
|
3409
|
-
}], height: [{
|
|
3410
|
-
type: Input,
|
|
3411
|
-
args: [{ required: true }]
|
|
3412
|
-
}], $container: [{ type: i0.ViewChild, args: ['container', { isSignal: true }] }], $image: [{ type: i0.ViewChild, args: ['image', { isSignal: true }] }] } });
|
|
3413
|
-
|
|
3414
|
-
class UiPopupBackdropDirective {
|
|
3415
|
-
elementRef;
|
|
3416
|
-
uiPopupService;
|
|
3417
|
-
destroyRef;
|
|
3418
|
-
isStaticBackdrop = false;
|
|
3419
|
-
constructor(elementRef, uiPopupService, destroyRef) {
|
|
3420
|
-
this.elementRef = elementRef;
|
|
3421
|
-
this.uiPopupService = uiPopupService;
|
|
3422
|
-
this.destroyRef = destroyRef;
|
|
3423
|
-
}
|
|
3424
|
-
ngOnInit() {
|
|
3425
|
-
fromEvent(this.elementRef.nativeElement, 'click')
|
|
3426
|
-
.pipe(tap(() => {
|
|
3427
|
-
if (this.isStaticBackdrop) {
|
|
3428
|
-
return;
|
|
3429
|
-
}
|
|
3430
|
-
this.uiPopupService.closeAll();
|
|
3431
|
-
}), takeUntilDestroyed(this.destroyRef))
|
|
3432
|
-
.subscribe();
|
|
3433
|
-
}
|
|
3434
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupBackdropDirective, deps: [{ token: i0.ElementRef }, { token: UiPopupService }, { token: i0.DestroyRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3435
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.1", type: UiPopupBackdropDirective, isStandalone: true, selector: "app-ui-popup-backdrop", inputs: { isStaticBackdrop: "isStaticBackdrop" }, ngImport: i0 });
|
|
3436
|
-
}
|
|
3437
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiPopupBackdropDirective, decorators: [{
|
|
3438
|
-
type: Directive,
|
|
3439
|
-
args: [{ selector: 'app-ui-popup-backdrop' }]
|
|
3440
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: UiPopupService }, { type: i0.DestroyRef }], propDecorators: { isStaticBackdrop: [{
|
|
3441
|
-
type: Input
|
|
3442
|
-
}] } });
|
|
3443
|
-
|
|
3444
3563
|
const buttonColors = [
|
|
3445
3564
|
'primary',
|
|
3446
3565
|
'secondary',
|