@tiba-spark/client-shared-lib 26.2.0-126 → 26.2.0-140
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/esm2022/libraries/components/field-label/field-label.component.mjs +5 -2
- package/esm2022/libraries/modules/facility/facility.service.mjs +4 -4
- package/esm2022/libraries/services/modal.service.mjs +135 -112
- package/fesm2022/tiba-spark-client-shared-lib.mjs +140 -114
- package/fesm2022/tiba-spark-client-shared-lib.mjs.map +1 -1
- package/libraries/components/field-label/field-label.component.d.ts.map +1 -1
- package/libraries/modules/facility/facility.service.d.ts.map +1 -1
- package/libraries/services/modal.service.d.ts +19 -16
- package/libraries/services/modal.service.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i2 from '@angular/common';
|
|
2
2
|
import { DatePipe, CommonModule } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { Directive, Injectable, HostListener, HostBinding, Input, Optional, InjectionToken, Inject, NgModule, forwardRef, Pipe, Component, ChangeDetectionStrategy, EventEmitter, Output, signal, computed, inject, Injector, effect, input, ChangeDetectorRef, ViewChild } from '@angular/core';
|
|
4
|
+
import { Directive, Injectable, HostListener, HostBinding, Input, Optional, InjectionToken, Inject, NgModule, forwardRef, Pipe, Component, ChangeDetectionStrategy, EventEmitter, Output, createComponent, signal, computed, inject, Injector, effect, input, ChangeDetectorRef, ViewChild } from '@angular/core';
|
|
5
5
|
import DOMPurify from 'dompurify';
|
|
6
6
|
import { Subject, merge, takeUntil, throwError, of, Observable, delay, debounceTime, switchMap, map, from, noop, BehaviorSubject, Subscription, combineLatest, distinctUntilChanged as distinctUntilChanged$1, filter as filter$1, take, tap as tap$1, first as first$1, catchError as catchError$1, fromEvent, timer, EMPTY, distinctUntilKeyChanged, firstValueFrom, finalize as finalize$1 } from 'rxjs';
|
|
7
7
|
import * as i1 from '@angular/forms';
|
|
@@ -106358,7 +106358,10 @@ class FieldLabelComponent {
|
|
|
106358
106358
|
this.isInvalid$ = new BehaviorSubject(false);
|
|
106359
106359
|
}
|
|
106360
106360
|
ngOnInit() {
|
|
106361
|
-
this.control = this.controlContainer.control
|
|
106361
|
+
this.control = this.controlContainer.control?.get(this.controlName);
|
|
106362
|
+
if (!this.control) {
|
|
106363
|
+
return;
|
|
106364
|
+
}
|
|
106362
106365
|
setTimeout(() => {
|
|
106363
106366
|
this.isRequired$.next(this.isControlRequired);
|
|
106364
106367
|
this.isInvalid$.next(this.isControlInvalid);
|
|
@@ -119156,169 +119159,192 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
119156
119159
|
type: Injectable
|
|
119157
119160
|
}], ctorParameters: () => [{ type: i1$5.TranslateService }] });
|
|
119158
119161
|
|
|
119159
|
-
const
|
|
119160
|
-
const
|
|
119162
|
+
const Z_INDEX_FRONT = '1000';
|
|
119163
|
+
const Z_INDEX_BACK = '999';
|
|
119161
119164
|
class ModalService {
|
|
119162
|
-
constructor(dialog, snackBar, appRef,
|
|
119165
|
+
constructor(dialog, snackBar, appRef, environmentInjector) {
|
|
119163
119166
|
this.dialog = dialog;
|
|
119164
119167
|
this.snackBar = snackBar;
|
|
119165
119168
|
this.appRef = appRef;
|
|
119166
|
-
this.
|
|
119167
|
-
this.
|
|
119168
|
-
this.
|
|
119169
|
-
this.
|
|
119170
|
-
this.
|
|
119171
|
-
|
|
119172
|
-
this.addOpenModalToList = (dialogId) => this.openModalIds.push(dialogId);
|
|
119173
|
-
this.removeOpenModalFromList = (dialogId) => this.openModalIds = this.openModalIds.filter(id => id !== dialogId);
|
|
119174
|
-
}
|
|
119175
|
-
// enable subscribing to modal opened observable
|
|
119169
|
+
this.environmentInjector = environmentInjector;
|
|
119170
|
+
this._modalOpened$ = new Subject();
|
|
119171
|
+
this._buttonWrapperRefs = {};
|
|
119172
|
+
this._minimizedIds = [];
|
|
119173
|
+
this._openIds = [];
|
|
119174
|
+
}
|
|
119176
119175
|
onModalOpened() {
|
|
119177
|
-
return this.
|
|
119176
|
+
return this._modalOpened$.asObservable();
|
|
119178
119177
|
}
|
|
119179
119178
|
getOpenDialogs() {
|
|
119180
119179
|
return this.dialog.openDialogs;
|
|
119181
119180
|
}
|
|
119182
119181
|
open(modalComponent, modalConfig) {
|
|
119183
|
-
// dismisses the currently-visible snack bar, needed to handle expression after change warning.
|
|
119184
119182
|
this.snackBar.dismiss();
|
|
119185
|
-
const
|
|
119186
|
-
|
|
119187
|
-
|
|
119188
|
-
|
|
119189
|
-
dialogConfig.panelClass = modalConfig.panelClass;
|
|
119190
|
-
dialogConfig.position = modalConfig.position;
|
|
119191
|
-
dialogConfig.data = modalConfig.data;
|
|
119192
|
-
dialogConfig.id = modalConfig.id;
|
|
119193
|
-
dialogConfig.height = modalConfig.height;
|
|
119194
|
-
const dialogRef = this.dialog.open(modalComponent, dialogConfig);
|
|
119195
|
-
this.displayBackdrop(dialogRef.id);
|
|
119196
|
-
this.displayModalButtonWrapper(dialogRef, modalConfig);
|
|
119197
|
-
dialogRef.afterOpened().pipe(first()).subscribe(() => this.afterOpened(dialogRef, modalConfig));
|
|
119183
|
+
const dialogRef = this.dialog.open(modalComponent, this.buildDialogConfig(modalConfig));
|
|
119184
|
+
this.createBackdrop(dialogRef.id);
|
|
119185
|
+
this.attachButtonWrapper(dialogRef, modalConfig);
|
|
119186
|
+
dialogRef.afterOpened().pipe(first()).subscribe(() => this.afterOpened(dialogRef));
|
|
119198
119187
|
dialogRef.afterClosed().pipe(first()).subscribe(() => this.afterClosed(dialogRef));
|
|
119199
119188
|
return dialogRef.afterClosed();
|
|
119200
119189
|
}
|
|
119201
|
-
closeAll({ excludeMinimized } = {
|
|
119190
|
+
closeAll({ excludeMinimized = true } = {}) {
|
|
119202
119191
|
if (excludeMinimized) {
|
|
119203
|
-
const
|
|
119204
|
-
|
|
119205
|
-
|
|
119206
|
-
if (!dialog || !dialog.instance.isMinimized) {
|
|
119192
|
+
for (const openDialog of this.getOpenDialogs()) {
|
|
119193
|
+
const wrapper = this._buttonWrapperRefs[openDialog.id];
|
|
119194
|
+
if (!wrapper || !wrapper.instance.isMinimized) {
|
|
119207
119195
|
openDialog.close();
|
|
119208
119196
|
}
|
|
119209
119197
|
}
|
|
119210
119198
|
}
|
|
119211
119199
|
else {
|
|
119212
|
-
|
|
119200
|
+
this.dialog.closeAll();
|
|
119213
119201
|
}
|
|
119214
119202
|
}
|
|
119215
119203
|
disableClose(disable, dialogId = 0) {
|
|
119216
119204
|
this.dialog.openDialogs[dialogId].disableClose = disable;
|
|
119217
119205
|
}
|
|
119218
|
-
afterOpened(dialogRef
|
|
119219
|
-
this.
|
|
119220
|
-
this.
|
|
119221
|
-
this.
|
|
119206
|
+
afterOpened(dialogRef) {
|
|
119207
|
+
this.trackModal(dialogRef.id);
|
|
119208
|
+
this.setTopModal(dialogRef.id);
|
|
119209
|
+
this.repositionMinimizedModals();
|
|
119210
|
+
this._modalOpened$.next();
|
|
119222
119211
|
}
|
|
119223
119212
|
afterClosed(dialogRef) {
|
|
119224
|
-
this.
|
|
119225
|
-
this.
|
|
119226
|
-
|
|
119227
|
-
|
|
119213
|
+
this.untrackModal(dialogRef.id);
|
|
119214
|
+
const newTopId = this._openIds[this._openIds.length - 1];
|
|
119215
|
+
if (newTopId) {
|
|
119216
|
+
this.setTopModal(newTopId);
|
|
119217
|
+
}
|
|
119218
|
+
this.repositionMinimizedModals(dialogRef.id);
|
|
119219
|
+
this.destroyBackdrop(dialogRef.id);
|
|
119220
|
+
this.detachButtonWrapper(dialogRef.id);
|
|
119221
|
+
}
|
|
119222
|
+
trackModal(dialogId) {
|
|
119223
|
+
this._openIds.push(dialogId);
|
|
119224
|
+
}
|
|
119225
|
+
untrackModal(dialogId) {
|
|
119226
|
+
this._openIds = this._openIds.filter(id => id !== dialogId);
|
|
119227
|
+
}
|
|
119228
|
+
backdropId(dialogId) {
|
|
119229
|
+
return 'backdrop-' + dialogId;
|
|
119230
|
+
}
|
|
119231
|
+
// Relies on the CDK-internal '.cdk-global-overlay-wrapper' class added by MatDialog; may break on Angular Material upgrades.
|
|
119232
|
+
getWrapper(dialogId) {
|
|
119233
|
+
const dialogEl = document.getElementById(dialogId);
|
|
119234
|
+
return dialogEl ? dialogEl.closest('.cdk-global-overlay-wrapper') : null;
|
|
119235
|
+
}
|
|
119236
|
+
setTopModal(dialogId) {
|
|
119237
|
+
this._openIds.forEach(id => {
|
|
119238
|
+
const wrapper = this.getWrapper(id);
|
|
119239
|
+
const backdrop = document.getElementById(this.backdropId(id));
|
|
119240
|
+
if (id === dialogId) {
|
|
119241
|
+
if (wrapper)
|
|
119242
|
+
wrapper.style.zIndex = Z_INDEX_FRONT;
|
|
119243
|
+
if (backdrop)
|
|
119244
|
+
backdrop.style.zIndex = Z_INDEX_BACK;
|
|
119245
|
+
}
|
|
119246
|
+
else {
|
|
119247
|
+
if (wrapper)
|
|
119248
|
+
wrapper.style.zIndex = Z_INDEX_BACK;
|
|
119249
|
+
if (backdrop)
|
|
119250
|
+
backdrop.style.zIndex = Z_INDEX_BACK;
|
|
119251
|
+
}
|
|
119252
|
+
});
|
|
119228
119253
|
}
|
|
119229
119254
|
minimize(dialogId) {
|
|
119230
|
-
this.
|
|
119231
|
-
document.getElementById(
|
|
119232
|
-
document.getElementById(dialogId)
|
|
119233
|
-
this.
|
|
119234
|
-
this.
|
|
119255
|
+
this.untrackModal(dialogId);
|
|
119256
|
+
document.getElementById(this.backdropId(dialogId))?.classList.add('tb-d-none');
|
|
119257
|
+
document.getElementById(dialogId)?.classList.add('minimize');
|
|
119258
|
+
this._minimizedIds.push(dialogId);
|
|
119259
|
+
const newTopId = this._openIds[this._openIds.length - 1];
|
|
119260
|
+
if (newTopId) {
|
|
119261
|
+
this.setTopModal(newTopId);
|
|
119262
|
+
}
|
|
119263
|
+
this.repositionMinimizedModals();
|
|
119235
119264
|
}
|
|
119236
119265
|
maximize(dialogId) {
|
|
119237
|
-
this.
|
|
119238
|
-
|
|
119239
|
-
|
|
119240
|
-
|
|
119241
|
-
|
|
119242
|
-
|
|
119243
|
-
|
|
119244
|
-
|
|
119245
|
-
|
|
119246
|
-
|
|
119247
|
-
|
|
119248
|
-
|
|
119249
|
-
const el = document.getElementById(this.minimizedModals[i]);
|
|
119266
|
+
this.trackModal(dialogId);
|
|
119267
|
+
document.getElementById(this.backdropId(dialogId)).classList.remove('tb-d-none');
|
|
119268
|
+
this.setTopModal(dialogId);
|
|
119269
|
+
const dialogEl = document.getElementById(dialogId);
|
|
119270
|
+
dialogEl.classList.remove('minimize');
|
|
119271
|
+
dialogEl.style.bottom = undefined;
|
|
119272
|
+
this.repositionMinimizedModals(dialogId);
|
|
119273
|
+
}
|
|
119274
|
+
repositionMinimizedModals(removedId) {
|
|
119275
|
+
this._minimizedIds = this._minimizedIds.filter(id => id !== removedId);
|
|
119276
|
+
for (let i = 0; i < this._minimizedIds.length; i++) {
|
|
119277
|
+
const el = document.getElementById(this._minimizedIds[i]);
|
|
119250
119278
|
if (i === 0) {
|
|
119251
119279
|
el.style.bottom = '10px';
|
|
119252
119280
|
}
|
|
119253
119281
|
else {
|
|
119254
|
-
const
|
|
119255
|
-
|
|
119282
|
+
const prevEl = document.getElementById(this._minimizedIds[i - 1]);
|
|
119283
|
+
const height = prevEl.clientHeight;
|
|
119256
119284
|
el.style.bottom = ((height + 10) * i) + 10 + 'px';
|
|
119257
119285
|
}
|
|
119258
119286
|
el.style.right = '10px';
|
|
119259
|
-
const
|
|
119260
|
-
if (this.
|
|
119261
|
-
|
|
119287
|
+
const minimizeIconEl = el.querySelector('.modal-minimize-icon');
|
|
119288
|
+
if (this._openIds.length && i !== 0) {
|
|
119289
|
+
minimizeIconEl.classList.add('tb-action-disabled');
|
|
119262
119290
|
}
|
|
119263
119291
|
else {
|
|
119264
|
-
|
|
119292
|
+
minimizeIconEl.classList.remove('tb-action-disabled');
|
|
119265
119293
|
}
|
|
119266
119294
|
}
|
|
119267
|
-
// make sure always the last open modal backdrop is in front
|
|
119268
|
-
if (this.openModalIds.length > 0) {
|
|
119269
|
-
const lastOpenModalId = this.openModalIds[this.openModalIds.length - 1];
|
|
119270
|
-
document.getElementById('backdrop-' + lastOpenModalId).style.zIndex = BACKDROP_BACK_ZINDEX_LEVEL;
|
|
119271
|
-
}
|
|
119272
119295
|
}
|
|
119273
|
-
|
|
119274
|
-
|
|
119275
|
-
|
|
119276
|
-
|
|
119277
|
-
|
|
119278
|
-
|
|
119279
|
-
document.querySelector('.cdk-overlay-container').append(divBackdrop);
|
|
119296
|
+
buildDialogConfig(modalConfig) {
|
|
119297
|
+
const config = Object.assign(new MatDialogConfig(), modalConfig);
|
|
119298
|
+
config.disableClose = modalConfig?.disableClose !== false;
|
|
119299
|
+
config.hasBackdrop = false;
|
|
119300
|
+
config.autoFocus = modalConfig?.autoFocus !== false;
|
|
119301
|
+
return config;
|
|
119280
119302
|
}
|
|
119281
|
-
|
|
119282
|
-
const
|
|
119283
|
-
|
|
119284
|
-
|
|
119285
|
-
|
|
119286
|
-
|
|
119287
|
-
|
|
119288
|
-
|
|
119303
|
+
createBackdrop(dialogId) {
|
|
119304
|
+
const backdrop = document.createElement('div');
|
|
119305
|
+
backdrop.classList.add('tb-overlay-backdrop');
|
|
119306
|
+
backdrop.id = this.backdropId(dialogId);
|
|
119307
|
+
document.querySelector('.cdk-overlay-container').append(backdrop);
|
|
119308
|
+
}
|
|
119309
|
+
destroyBackdrop(dialogId) {
|
|
119310
|
+
document.getElementById(this.backdropId(dialogId))?.remove();
|
|
119289
119311
|
}
|
|
119290
|
-
|
|
119312
|
+
attachButtonWrapper(dialogRef, modalConfig) {
|
|
119291
119313
|
const dialogId = dialogRef.id;
|
|
119292
119314
|
Promise.resolve().then(function () { return modalButtonsWrapper_component; }).then(res => {
|
|
119293
|
-
|
|
119294
|
-
|
|
119295
|
-
|
|
119296
|
-
|
|
119297
|
-
|
|
119298
|
-
|
|
119299
|
-
|
|
119300
|
-
|
|
119301
|
-
|
|
119302
|
-
|
|
119303
|
-
|
|
119304
|
-
|
|
119305
|
-
|
|
119315
|
+
if (!this.dialog.getDialogById(dialogId))
|
|
119316
|
+
return;
|
|
119317
|
+
this._buttonWrapperRefs[dialogId] = createComponent(res.ModalButtonsWrapperComponent, { environmentInjector: this.environmentInjector });
|
|
119318
|
+
const instance = this._buttonWrapperRefs[dialogId].instance;
|
|
119319
|
+
instance.close.pipe(takeUntil$1(instance.destroy$)).subscribe(() => dialogRef.close());
|
|
119320
|
+
instance.minimize.pipe(takeUntil$1(instance.destroy$)).subscribe((isMinimize) => isMinimize ? this.minimize(dialogId) : this.maximize(dialogId));
|
|
119321
|
+
instance.enabledMinimized = modalConfig?.enabledMinimized;
|
|
119322
|
+
this.appRef.attachView(this._buttonWrapperRefs[dialogId].hostView);
|
|
119323
|
+
const domEl = this._buttonWrapperRefs[dialogId].hostView.rootNodes[0];
|
|
119324
|
+
const panelClass = modalConfig?.panelClass;
|
|
119325
|
+
const panelSelector = Array.isArray(panelClass)
|
|
119326
|
+
? panelClass.map(c => `.${c}`).join('')
|
|
119327
|
+
: panelClass ? `.${panelClass}` : null;
|
|
119328
|
+
if (panelSelector) {
|
|
119329
|
+
document.querySelector(`${panelSelector} .modal-button-wrapper`)?.appendChild(domEl);
|
|
119306
119330
|
}
|
|
119307
119331
|
});
|
|
119308
119332
|
}
|
|
119309
|
-
|
|
119310
|
-
|
|
119311
|
-
|
|
119312
|
-
this.
|
|
119313
|
-
|
|
119333
|
+
detachButtonWrapper(dialogId) {
|
|
119334
|
+
const ref = this._buttonWrapperRefs[dialogId];
|
|
119335
|
+
if (ref) {
|
|
119336
|
+
this.appRef.detachView(ref.hostView);
|
|
119337
|
+
ref.destroy();
|
|
119338
|
+
delete this._buttonWrapperRefs[dialogId];
|
|
119314
119339
|
}
|
|
119315
119340
|
}
|
|
119316
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ModalService, deps: [{ token: i2$1.MatDialog }, { token: i1$6.MatSnackBar }, { token: i0.ApplicationRef }, { token: i0.
|
|
119317
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ModalService }); }
|
|
119341
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ModalService, deps: [{ token: i2$1.MatDialog }, { token: i1$6.MatSnackBar }, { token: i0.ApplicationRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
119342
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ModalService, providedIn: 'root' }); }
|
|
119318
119343
|
}
|
|
119319
119344
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ModalService, decorators: [{
|
|
119320
|
-
type: Injectable
|
|
119321
|
-
|
|
119345
|
+
type: Injectable,
|
|
119346
|
+
args: [{ providedIn: 'root' }]
|
|
119347
|
+
}], ctorParameters: () => [{ type: i2$1.MatDialog }, { type: i1$6.MatSnackBar }, { type: i0.ApplicationRef }, { type: i0.EnvironmentInjector }] });
|
|
119322
119348
|
|
|
119323
119349
|
class ParkTimeService {
|
|
119324
119350
|
constructor(store) {
|
|
@@ -125317,7 +125343,7 @@ class FacilityService {
|
|
|
125317
125343
|
const featurePermissions = this.store.selectSnapshot(FacilityState.featurePermissions);
|
|
125318
125344
|
return isVersionSupported && featurePermissions?.includes(permissionType);
|
|
125319
125345
|
};
|
|
125320
|
-
this.getActiveMenuFacility = (menuItems, parkId, guid) => menuItems.find(menuItem => menuItem.properties
|
|
125346
|
+
this.getActiveMenuFacility = (menuItems, parkId, guid) => menuItems.find(menuItem => menuItem.properties?.guid === guid && menuItem.id === parkId);
|
|
125321
125347
|
}
|
|
125322
125348
|
hasPermissionTypeSignal(permissionType) {
|
|
125323
125349
|
return computed(() => {
|
|
@@ -125511,8 +125537,8 @@ class FacilityService {
|
|
|
125511
125537
|
}
|
|
125512
125538
|
getActiveMenuFacilityChild(menuItems, parkId, guid) {
|
|
125513
125539
|
const multiFacilityParentID = this.store.selectSnapshot(FacilityState.multiParkParentID);
|
|
125514
|
-
const menuItemParent = menuItems.find(menuItem => menuItem.properties
|
|
125515
|
-
const menuItem = menuItemParent?.children
|
|
125540
|
+
const menuItemParent = menuItems.find(menuItem => menuItem.properties?.guid === guid && menuItem.id === multiFacilityParentID);
|
|
125541
|
+
const menuItem = menuItemParent?.children?.find(menuItem => menuItem.id === parkId);
|
|
125516
125542
|
return menuItem;
|
|
125517
125543
|
}
|
|
125518
125544
|
getFirstMenuItemFacility(menuItems) {
|