@seniorsistemas/angular-components 17.26.7 → 17.26.8

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.
@@ -1,22 +1,22 @@
1
1
  import { __decorate, __awaiter, __param, __rest } from 'tslib';
2
- import { EventEmitter, Input, Output, Component, ContentChildren, ViewChild, HostListener, forwardRef, NgModule, ɵɵdefineInjectable, Injectable, ElementRef, ApplicationRef, ComponentFactoryResolver, Injector, Renderer2, Directive, TemplateRef, ViewContainerRef, KeyValueDiffers, HostBinding, ChangeDetectorRef, ViewChildren, Pipe, ɵɵinject, InjectionToken, Inject, PLATFORM_ID, ViewEncapsulation, INJECTOR, NgZone, ContentChild, Optional } from '@angular/core';
2
+ import { EventEmitter, Input, Output, Component, ContentChildren, ViewChild, HostListener, forwardRef, NgModule, ɵɵdefineInjectable, Injectable, ElementRef, ApplicationRef, ComponentFactoryResolver, Injector, Renderer2, Directive, TemplateRef, ViewContainerRef, Pipe, ɵɵinject, HostBinding, ChangeDetectorRef, ViewChildren, InjectionToken, Inject, PLATFORM_ID, KeyValueDiffers, ViewEncapsulation, INJECTOR, NgZone, ContentChild, Optional } from '@angular/core';
3
3
  import { trigger, transition, style as style$7, animate, state, group, query, animateChild } from '@angular/animations';
4
4
  import { Subject, of, from, ReplaySubject, throwError, fromEvent, forkJoin, pipe } from 'rxjs';
5
5
  import { takeUntil, tap, map, switchMap, catchError, first, filter, take, delay, debounceTime, repeat, finalize } from 'rxjs/operators';
6
6
  import { CommonModule, isPlatformBrowser } from '@angular/common';
7
7
  import { NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule, FormControl, FormGroup, NG_VALIDATORS, FormBuilder, Validators, FormArray, ControlContainer } from '@angular/forms';
8
8
  import { RouterModule, NavigationEnd, PRIMARY_OUTLET, ActivatedRoute, Router } from '@angular/router';
9
+ import { applyMask, CurrencyMaskDirective, AlignmentOptions } from '@seniorsistemas/ng2-currency-mask';
9
10
  import { HttpClient, HttpEventType, HttpClientModule } from '@angular/common/http';
10
11
  import { user, service } from '@seniorsistemas/senior-platform-data';
11
12
  import * as moment_ from 'moment';
12
13
  import { CookieService } from 'ngx-cookie-service';
13
- import { CurrencyMaskDirective, AlignmentOptions, applyMask } from '@seniorsistemas/ng2-currency-mask';
14
+ import BigNumber, { BigNumber as BigNumber$1 } from 'bignumber.js';
14
15
  import { BreadcrumbModule as BreadcrumbModule$1 } from 'primeng/breadcrumb';
15
16
  import { DomHandler } from 'primeng/dom';
16
17
  import { TieredMenu, TieredMenuModule as TieredMenuModule$1 } from 'primeng/tieredmenu';
17
18
  import { Calendar, CalendarModule } from 'primeng/calendar';
18
19
  import { TranslateModule, TranslateService } from '@ngx-translate/core';
19
- import BigNumber, { BigNumber as BigNumber$1 } from 'bignumber.js';
20
20
  import { EditorView } from '@codemirror/view';
21
21
  import { StateField, StateEffect, EditorState } from '@codemirror/state';
22
22
  import { setDiagnostics } from '@codemirror/lint';
@@ -1206,2483 +1206,2482 @@ LocaleService = __decorate([
1206
1206
  Injectable()
1207
1207
  ], LocaleService);
1208
1208
 
1209
- var BignumberInputDirective_1;
1210
- let BignumberInputDirective = BignumberInputDirective_1 = class BignumberInputDirective extends CurrencyMaskDirective {
1211
- constructor(_elementRef, _keyValueDiffers, localeService) {
1212
- super(null, _elementRef, _keyValueDiffers);
1209
+ let LocalizedBignumberPipe = class LocalizedBignumberPipe {
1210
+ constructor(localeService) {
1213
1211
  this.localeService = localeService;
1214
- this.precision = 15;
1215
- this.scale = 0;
1216
- this.alignTo = AlignmentOptions.LEFT;
1217
- this.allowNegative = true;
1218
- this.pasteRejected = new EventEmitter();
1219
- this.onLocaleService();
1220
1212
  }
1221
- ngOnInit() {
1222
- this.updateVariables();
1223
- super.ngOnInit();
1213
+ transform(value, options) {
1214
+ return value !== undefined && value !== null ? this.applyMask(value, options) : of(value);
1224
1215
  }
1225
- ngOnChanges(changes) {
1226
- const placeholderChange = changes.placeholder && changes.placeholder.currentValue;
1227
- if (!placeholderChange && this.scale) {
1228
- this.placeholder = `0${this.decimalSeparator}${"".padEnd(this.scale, "0")}`;
1229
- }
1230
- if (changes.scale ||
1231
- changes.decimalSeparator ||
1232
- changes.thousandsSeparator ||
1233
- changes.alignTo ||
1234
- changes.precision ||
1235
- changes.allowNegative) {
1236
- this.updateVariables();
1237
- }
1216
+ applyMask(value, options) {
1217
+ return this.localeService.get().pipe(map(localeConfig => {
1218
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
1219
+ const configs = {
1220
+ prefix: (_c = (_a = options === null || options === void 0 ? void 0 : options.prefix) !== null && _a !== void 0 ? _a : (_b = localeConfig === null || localeConfig === void 0 ? void 0 : localeConfig.number) === null || _b === void 0 ? void 0 : _b.currencySymbol) !== null && _c !== void 0 ? _c : "R$",
1221
+ thousandsSeparator: (_f = (_d = options === null || options === void 0 ? void 0 : options.thousandsSeparator) !== null && _d !== void 0 ? _d : (_e = localeConfig === null || localeConfig === void 0 ? void 0 : localeConfig.number) === null || _e === void 0 ? void 0 : _e.thousandsSeparator) !== null && _f !== void 0 ? _f : ".",
1222
+ decimalSeparator: (_j = (_g = options === null || options === void 0 ? void 0 : options.decimalSeparator) !== null && _g !== void 0 ? _g : (_h = localeConfig === null || localeConfig === void 0 ? void 0 : localeConfig.number) === null || _h === void 0 ? void 0 : _h.decimalSeparator) !== null && _j !== void 0 ? _j : ",",
1223
+ scale: (_k = options === null || options === void 0 ? void 0 : options.scale) !== null && _k !== void 0 ? _k : 2,
1224
+ allowNegative: (_l = options === null || options === void 0 ? void 0 : options.allowNegative) !== null && _l !== void 0 ? _l : true
1225
+ };
1226
+ const isNumber = !(new BigNumber(value).isNaN());
1227
+ return applyMask(value, configs, isNumber);
1228
+ }));
1238
1229
  }
1239
- onPaste(event) {
1240
- var _a, _b;
1241
- const pastedText = (_b = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData("text")) !== null && _b !== void 0 ? _b : "";
1242
- const numericText = pastedText.replace(new RegExp(`\\${this.thousandsSeparator}`, "g"), "").replace(this.decimalSeparator, ".");
1243
- const [intPart, decimalPart = ""] = numericText.split(".");
1244
- const totalDigits = intPart.replace(/\D/g, "").length + decimalPart.slice(0, this.scale).length;
1245
- if (totalDigits > this.precision) {
1246
- event.preventDefault();
1247
- this.pasteRejected.emit(pastedText);
1248
- }
1230
+ };
1231
+ LocalizedBignumberPipe.ctorParameters = () => [
1232
+ { type: LocaleService }
1233
+ ];
1234
+ LocalizedBignumberPipe = __decorate([
1235
+ Pipe({
1236
+ name: "localizedBignumber",
1237
+ })
1238
+ ], LocalizedBignumberPipe);
1239
+
1240
+ let LocalizedBignumberImpurePipe = class LocalizedBignumberImpurePipe extends LocalizedBignumberPipe {
1241
+ transform(value, options) {
1242
+ return super.transform(value, options);
1249
1243
  }
1250
- onKeypress(event) {
1251
- const code = event.code;
1252
- if (code === "Minus" || code === "NumpadSubtract") {
1253
- if (this.allowNegative) {
1254
- this.maxLength = this._maxLength + 1;
1255
- }
1256
- }
1257
- else if (code === "Equal" || code === "NumpadAdd") {
1258
- this.maxLength = this._maxLength;
1259
- }
1244
+ };
1245
+ LocalizedBignumberImpurePipe = __decorate([
1246
+ Pipe({
1247
+ name: "localizedBignumberImpure",
1248
+ pure: false,
1249
+ })
1250
+ ], LocalizedBignumberImpurePipe);
1251
+
1252
+ class LocalizedCurrencyPipeOptions extends NumberLocaleOptions {
1253
+ constructor(config = {}) {
1254
+ super(config);
1255
+ this.scale = 2;
1260
1256
  }
1261
- /**
1262
- * Update the options values according to the directive input values.
1263
- */
1264
- updateVariables() {
1265
- var _a;
1266
- this.options = {
1267
- align: this.alignTo,
1268
- decimalSeparator: this.decimalSeparator,
1269
- thousandsSeparator: (_a = this.thousandsSeparator) !== null && _a !== void 0 ? _a : ".",
1270
- scale: this.scale || 0,
1271
- prefix: "",
1272
- suffix: "",
1273
- allowNegative: this.allowNegative,
1274
- };
1275
- this.calculateMaxLength();
1257
+ }
1258
+ /**
1259
+ * @deprecated Should use localizedBignumberPipe instead
1260
+ */
1261
+ let LocalizedCurrencyPipe = class LocalizedCurrencyPipe {
1262
+ constructor(localeService) {
1263
+ this.localeService = localeService;
1276
1264
  }
1277
- /**
1278
- * Responsible to calculate the field maximum length considering the separators.
1279
- */
1280
- calculateMaxLength() {
1281
- var _a, _b;
1282
- const decSepLength = this.decimalSeparator.length;
1283
- const thoSepLength = (_b = (_a = this.thousandsSeparator) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 1;
1284
- let maxLength = this.precision + (this.scale ? decSepLength : 0);
1285
- maxLength += Math.ceil((this.precision - (this.scale ? this.scale : 0)) / 3 - 1) * thoSepLength;
1286
- this._maxLength = maxLength;
1287
- this.maxLength = maxLength;
1265
+ transform(value, options) {
1266
+ if (!options) {
1267
+ options = new LocalizedCurrencyPipeOptions();
1268
+ }
1269
+ return value !== undefined && value !== null ? this.applyMask(value, options) : of(value);
1288
1270
  }
1289
- onLocaleService() {
1290
- this.localeService
1291
- .getLocale()
1292
- .pipe(first())
1293
- .subscribe(() => {
1294
- var _a, _b;
1295
- this.decimalSeparator = (_a = this.decimalSeparator) !== null && _a !== void 0 ? _a : this.localeService.getDecimalSeparator();
1296
- this.thousandsSeparator = (_b = this.thousandsSeparator) !== null && _b !== void 0 ? _b : this.localeService.getGroupingSeparator();
1297
- });
1271
+ applyMask(value, options) {
1272
+ return this.localeService.get().pipe(map(localeConfig => {
1273
+ const config = Object.assign(Object.assign({}, localeConfig.number), options);
1274
+ const { scale, currencySymbol, thousandsSeparator, decimalSeparator } = config;
1275
+ const rawValue = Number(value).toFixed(scale);
1276
+ const onlyNumbers = rawValue.replace(/[^0-9]/g, ``);
1277
+ const integerPart = onlyNumbers
1278
+ .slice(0, onlyNumbers.length - scale)
1279
+ .replace(/^0*/g, ``)
1280
+ .replace(/\B(?=(\d{3})+(?!\d))/g, thousandsSeparator) || `0`;
1281
+ const decimalPart = onlyNumbers.slice(onlyNumbers.length - scale);
1282
+ const newValue = scale ? integerPart + decimalSeparator + decimalPart : integerPart;
1283
+ const isZero = !Number(onlyNumbers);
1284
+ const operator = rawValue.includes("-") && !isZero ? "-" : "";
1285
+ return `${operator}${currencySymbol}${newValue}`;
1286
+ }));
1298
1287
  }
1299
1288
  };
1300
- BignumberInputDirective.ctorParameters = () => [
1301
- { type: ElementRef },
1302
- { type: KeyValueDiffers },
1289
+ LocalizedCurrencyPipe.ctorParameters = () => [
1303
1290
  { type: LocaleService }
1304
1291
  ];
1305
- __decorate([
1306
- Input()
1307
- ], BignumberInputDirective.prototype, "precision", void 0);
1308
- __decorate([
1309
- Input()
1310
- ], BignumberInputDirective.prototype, "scale", void 0);
1311
- __decorate([
1312
- Input()
1313
- ], BignumberInputDirective.prototype, "decimalSeparator", void 0);
1314
- __decorate([
1315
- Input()
1316
- ], BignumberInputDirective.prototype, "thousandsSeparator", void 0);
1317
- __decorate([
1318
- Input()
1319
- ], BignumberInputDirective.prototype, "alignTo", void 0);
1320
- __decorate([
1321
- Input()
1322
- ], BignumberInputDirective.prototype, "allowNegative", void 0);
1323
- __decorate([
1324
- Input(),
1325
- HostBinding("attr.placeholder")
1326
- ], BignumberInputDirective.prototype, "placeholder", void 0);
1327
- __decorate([
1328
- HostBinding("attr.maxLength")
1329
- ], BignumberInputDirective.prototype, "maxLength", void 0);
1330
- __decorate([
1331
- Output()
1332
- ], BignumberInputDirective.prototype, "pasteRejected", void 0);
1333
- __decorate([
1334
- HostListener("paste", ["$event"])
1335
- ], BignumberInputDirective.prototype, "onPaste", null);
1336
- __decorate([
1337
- HostListener("keypress", ["$event"])
1338
- ], BignumberInputDirective.prototype, "onKeypress", null);
1339
- BignumberInputDirective = BignumberInputDirective_1 = __decorate([
1340
- Directive({
1341
- selector: "input[sBignumberInput]",
1342
- providers: [
1343
- {
1344
- provide: NG_VALUE_ACCESSOR,
1345
- useExisting: forwardRef(() => BignumberInputDirective_1),
1346
- multi: true,
1347
- },
1348
- ],
1292
+ LocalizedCurrencyPipe = __decorate([
1293
+ Pipe({
1294
+ name: "localizedCurrency",
1349
1295
  })
1350
- ], BignumberInputDirective);
1296
+ ], LocalizedCurrencyPipe);
1351
1297
 
1352
- let BignumberInputModule = class BignumberInputModule {
1298
+ /**
1299
+ * @deprecated Should use localizedBignumberPipe instead
1300
+ */
1301
+ let LocalizedCurrencyImpurePipe = class LocalizedCurrencyImpurePipe extends LocalizedCurrencyPipe {
1302
+ transform(value, options = new LocalizedCurrencyPipeOptions()) {
1303
+ return super.transform(value, options);
1304
+ }
1353
1305
  };
1354
- BignumberInputModule = __decorate([
1355
- NgModule({
1356
- imports: [CommonModule],
1357
- declarations: [BignumberInputDirective],
1358
- exports: [BignumberInputDirective],
1306
+ LocalizedCurrencyImpurePipe = __decorate([
1307
+ Pipe({
1308
+ name: "localizedCurrencyImpure",
1309
+ pure: false,
1359
1310
  })
1360
- ], BignumberInputModule);
1311
+ ], LocalizedCurrencyImpurePipe);
1361
1312
 
1362
- let BreadcrumbComponent = class BreadcrumbComponent {
1363
- constructor(activatedRoute, router) {
1364
- this.activatedRoute = activatedRoute;
1365
- this.router = router;
1366
- this.targetHomeUrl = "_self";
1367
- this.ngUnsubscribe = new Subject();
1368
- this.router.events
1369
- .pipe(takeUntil(this.ngUnsubscribe), filter(event => event instanceof NavigationEnd))
1370
- .subscribe(() => this.onNavigationEnd());
1371
- }
1372
- onNavigationEnd() {
1373
- const currentRoute = this.activatedRoute.root;
1374
- const validRoutes = this.getValidChildren(currentRoute);
1375
- this.title = this.getCurrentTitle(validRoutes);
1376
- this.home = this.getCurrentHome(validRoutes);
1377
- this.items = this.getCurrentItems(validRoutes);
1378
- }
1379
- getValidChildren(route) {
1380
- const valid = route.routeConfig && route.routeConfig.path && route.routeConfig.component && route.outlet === PRIMARY_OUTLET;
1381
- return route.children.reduce((validRoutes, child) => [...validRoutes, ...this.getValidChildren(child)], valid ? [route] : []);
1313
+ const moment$1 = moment_; // @HACK Necessary because of https://github.com/rollup/rollup/issues/670
1314
+ let LocalizedDatePipe = class LocalizedDatePipe {
1315
+ constructor(localeService) {
1316
+ this.localeService = localeService;
1382
1317
  }
1383
- getCurrentTitle(routes) {
1384
- const last = routes[routes.length - 1];
1385
- if (last && last.routeConfig)
1386
- return this.getTitle(last);
1387
- }
1388
- getCurrentHome(routes) {
1389
- let home;
1390
- if (this.homeUrl)
1391
- home = { url: this.homeUrl, icon: "fa fa-home", target: this.targetHomeUrl };
1392
- else if (routes.length)
1393
- home = Object.assign(Object.assign({}, this.getMenuItem(routes[0], routes.length === 1)), { icon: "fa fa-home" });
1394
- return home;
1395
- }
1396
- getCurrentItems(routes) {
1397
- if (!routes.length)
1398
- return;
1399
- const items = this.homeUrl ? routes : routes.slice(1);
1400
- if (items.length)
1401
- return items.map((route, i) => this.getMenuItem(route, i === routes.length - 1));
1402
- }
1403
- getMenuItem(route, disabled = false) {
1404
- const label = this.getTitle(route);
1405
- const routes = route.pathFromRoot;
1406
- const routerLink = routes
1407
- .slice(0, routes.indexOf(route) + 1)
1408
- .reduce((result, item) => [...result, ...item.snapshot.url.map(url => url.path)], ["/"]);
1409
- return {
1410
- label,
1411
- routerLink,
1412
- queryParams: route.snapshot.queryParams,
1413
- routerLinkActiveOptions: { exact: true },
1414
- disabled,
1415
- };
1416
- }
1417
- getTitle(route) {
1418
- const { snapshot, routeConfig } = route;
1419
- const title = snapshot.data.routeTitle;
1420
- if (!title)
1421
- throw new Error(`No routeTitle defined for the route /${routeConfig.path}`);
1422
- return title;
1423
- }
1424
- ngOnDestroy() {
1425
- this.ngUnsubscribe.next();
1426
- this.ngUnsubscribe.complete();
1318
+ transform(value, format = "L LTS") {
1319
+ return this.localeService.get().pipe(map(() => (value ? moment$1(value).format(format) : value)));
1427
1320
  }
1428
1321
  };
1429
- BreadcrumbComponent.ctorParameters = () => [
1430
- { type: ActivatedRoute },
1431
- { type: Router }
1322
+ LocalizedDatePipe.ctorParameters = () => [
1323
+ { type: LocaleService }
1432
1324
  ];
1433
- __decorate([
1434
- Input()
1435
- ], BreadcrumbComponent.prototype, "homeUrl", void 0);
1436
- __decorate([
1437
- Input()
1438
- ], BreadcrumbComponent.prototype, "targetHomeUrl", void 0);
1439
- BreadcrumbComponent = __decorate([
1440
- Component({
1441
- selector: `s-breadcrumb`,
1442
- template: "<h1 class=\"sds-page-title\">{{title}}</h1>\n<p-breadcrumb [home]=\"home\" [model]=\"items\"></p-breadcrumb>"
1325
+ LocalizedDatePipe = __decorate([
1326
+ Pipe({
1327
+ name: "localizedDate",
1443
1328
  })
1444
- ], BreadcrumbComponent);
1329
+ ], LocalizedDatePipe);
1445
1330
 
1446
- let BreadcrumbModule = class BreadcrumbModule {
1331
+ let LocalizedDateImpurePipe = class LocalizedDateImpurePipe extends LocalizedDatePipe {
1447
1332
  };
1448
- BreadcrumbModule = __decorate([
1449
- NgModule({
1450
- imports: [CommonModule, BreadcrumbModule$1, RouterModule],
1451
- declarations: [BreadcrumbComponent],
1452
- exports: [BreadcrumbComponent, RouterModule],
1333
+ LocalizedDateImpurePipe = __decorate([
1334
+ Pipe({
1335
+ name: "localizedDateImpure",
1336
+ pure: false,
1453
1337
  })
1454
- ], BreadcrumbModule);
1455
-
1456
- var ButtonAnimation;
1457
- (function (ButtonAnimation) {
1458
- ButtonAnimation["Rotate"] = "rotate";
1459
- })(ButtonAnimation || (ButtonAnimation = {}));
1460
-
1461
- var ButtonPriority;
1462
- (function (ButtonPriority) {
1463
- ButtonPriority["Default"] = "default";
1464
- ButtonPriority["Primary"] = "primary";
1465
- ButtonPriority["Secondary"] = "secondary";
1466
- ButtonPriority["Link"] = "link";
1467
- ButtonPriority["Danger"] = "danger";
1468
- })(ButtonPriority || (ButtonPriority = {}));
1469
-
1470
- var ButtonSize;
1471
- (function (ButtonSize) {
1472
- ButtonSize["Default"] = "default";
1473
- ButtonSize["Small"] = "small";
1474
- })(ButtonSize || (ButtonSize = {}));
1338
+ ], LocalizedDateImpurePipe);
1475
1339
 
1476
- var ButtonComponent_1;
1477
- let ButtonComponent = ButtonComponent_1 = class ButtonComponent {
1478
- constructor() {
1479
- this.minWidth = "40px";
1480
- this.id = `s-button-${ButtonComponent_1.nextId++}`;
1481
- this.tooltipPosition = "top";
1482
- this.caret = true;
1483
- this.baseZIndex = 0;
1484
- this.disabled = false;
1485
- this.auxiliary = false;
1486
- this.type = "button";
1487
- this.priority = ButtonPriority.Primary;
1488
- /**
1489
- * @deprecated Use `menuOptions` instead.
1490
- */
1491
- this.model = [];
1492
- this.menuOptions = [];
1493
- this.size = ButtonSize.Default;
1494
- this.onClick = new EventEmitter();
1340
+ /**
1341
+ * @deprecated Should use localizedBignumberPipe instead
1342
+ */
1343
+ let LocalizedNumberPipe = class LocalizedNumberPipe {
1344
+ constructor(localeService) {
1345
+ this.localeService = localeService;
1495
1346
  }
1496
- ngOnInit() {
1497
- this.onClick.subscribe((event) => {
1498
- if (!this.model || !this.model.length)
1347
+ transform(value, minimumFractionDigits) {
1348
+ return from(this.localeService.getLocale()).pipe(map((locale) => {
1349
+ const numericValue = Number(value);
1350
+ if (!value && isNaN(numericValue))
1499
1351
  return;
1500
- // TODO: Remover na próxima major.
1501
- this.menu.model = this.model;
1502
- this.menu.toggle(event);
1503
- });
1504
- }
1505
- validateSlideButton() {
1506
- return this.slide && (this.priority == ButtonPriority.Default || this.priority == ButtonPriority.Link) && this.label.length;
1507
- }
1508
- // TODO: Remover na próxima major.
1509
- isOpen() {
1510
- return this.model && this.model.length && this.menu.visible;
1511
- }
1512
- ngOnChanges(changes) {
1513
- const hasIcon = this.iconClass;
1514
- const hasText = this.label;
1515
- const isMultiple = this.model && this.model.length;
1516
- if (hasText || (hasIcon && isMultiple))
1517
- this.minWidth = "80px";
1518
- if (hasText && hasIcon && isMultiple)
1519
- this.minWidth = "100px";
1352
+ return new Intl.NumberFormat(locale, {
1353
+ minimumFractionDigits: minimumFractionDigits || 0,
1354
+ }).format(Number(value));
1355
+ }));
1520
1356
  }
1521
- updateTooltipZIndex() {
1522
- this.tooltipZIndex = this.baseZIndex + ++DomHandler.zindex;
1357
+ };
1358
+ LocalizedNumberPipe.ctorParameters = () => [
1359
+ { type: LocaleService }
1360
+ ];
1361
+ LocalizedNumberPipe = __decorate([
1362
+ Pipe({ name: "localizedNumber" })
1363
+ ], LocalizedNumberPipe);
1364
+
1365
+ const moment$2 = moment_; // @HACK Necessary because of https://github.com/rollup/rollup/issues/670
1366
+ let LocalizedTimePipe = class LocalizedTimePipe {
1367
+ constructor(localeService) {
1368
+ this.localeService = localeService;
1523
1369
  }
1524
- isRotateAnimation() {
1525
- return this.animation === ButtonAnimation.Rotate;
1370
+ transform(value, format = "LTS") {
1371
+ return this.localeService.get().pipe(map(() => (value ? moment$2(value, "HH:mm:ss").format(format) : value)));
1526
1372
  }
1527
1373
  };
1528
- ButtonComponent.nextId = 0;
1529
- __decorate([
1530
- HostBinding("style.min-width")
1531
- ], ButtonComponent.prototype, "minWidth", void 0);
1532
- __decorate([
1533
- Input()
1534
- ], ButtonComponent.prototype, "id", void 0);
1535
- __decorate([
1536
- Input()
1537
- ], ButtonComponent.prototype, "label", void 0);
1538
- __decorate([
1539
- Input()
1540
- ], ButtonComponent.prototype, "tooltip", void 0);
1541
- __decorate([
1542
- Input()
1543
- ], ButtonComponent.prototype, "tooltipPosition", void 0);
1544
- __decorate([
1545
- Input()
1546
- ], ButtonComponent.prototype, "iconClass", void 0);
1547
- __decorate([
1548
- Input()
1549
- ], ButtonComponent.prototype, "rightIconClass", void 0);
1550
- __decorate([
1551
- Input()
1552
- ], ButtonComponent.prototype, "caret", void 0);
1553
- __decorate([
1554
- Input()
1555
- ], ButtonComponent.prototype, "styleClass", void 0);
1556
- __decorate([
1557
- Input()
1558
- ], ButtonComponent.prototype, "baseZIndex", void 0);
1559
- __decorate([
1560
- Input()
1561
- ], ButtonComponent.prototype, "disabled", void 0);
1562
- __decorate([
1563
- Input()
1564
- ], ButtonComponent.prototype, "auxiliary", void 0);
1565
- __decorate([
1566
- Input()
1567
- ], ButtonComponent.prototype, "type", void 0);
1568
- __decorate([
1569
- Input()
1570
- ], ButtonComponent.prototype, "priority", void 0);
1571
- __decorate([
1572
- Input()
1573
- ], ButtonComponent.prototype, "model", void 0);
1574
- __decorate([
1575
- Input()
1576
- ], ButtonComponent.prototype, "menuOptions", void 0);
1577
- __decorate([
1578
- Input()
1579
- ], ButtonComponent.prototype, "size", void 0);
1580
- __decorate([
1581
- Input()
1582
- ], ButtonComponent.prototype, "slide", void 0);
1583
- __decorate([
1584
- Input()
1585
- ], ButtonComponent.prototype, "animation", void 0);
1586
- __decorate([
1587
- Input()
1588
- ], ButtonComponent.prototype, "badge", void 0);
1589
- __decorate([
1590
- Input()
1591
- ], ButtonComponent.prototype, "iconColor", void 0);
1592
- __decorate([
1593
- Output()
1594
- ], ButtonComponent.prototype, "onClick", void 0);
1595
- __decorate([
1596
- ViewChild(TieredMenu, { static: true })
1597
- ], ButtonComponent.prototype, "menu", void 0);
1598
- ButtonComponent = ButtonComponent_1 = __decorate([
1599
- Component({
1600
- selector: "s-button",
1601
- template: "<!-- Remover na pr\u00F3xima major. -->\n<p-tieredMenu\n [id]=\"id + '-menu'\"\n [popup]=\"true\"\n appendTo=\"body\"\n [baseZIndex]=\"baseZIndex\">\n</p-tieredMenu>\n\n<button\n [id]=\"id\"\n [type]=\"type\"\n [class]=\"styleClass\"\n [ngClass]=\"{\n 's-button-auxiliary': auxiliary,\n 's-button-with-icon': iconClass,\n 's-button-with-text': label,\n 's-button-empty': !iconClass && !label,\n 's-button-size-default': size === 'default',\n 's-button-size-small': size === 'small',\n 's-button-priority-default': priority === 'default',\n 's-button-priority-primary': priority === 'primary',\n 's-button-priority-secondary': priority === 'secondary',\n 's-button-priority-link': priority === 'link',\n 's-button-priority-danger': priority === 'danger',\n 's-button-multiple': (caret && (model && model.length)) || rightIconClass,\n 's-button-active': isOpen(),\n 's-button--slide': validateSlideButton(),\n 's-button--rotate-animation': isRotateAnimation()\n }\"\n sTieredMenu\n [items]=\"menuOptions\"\n [disabled]=\"disabled\"\n [sTooltip]=\"tooltip\"\n [tooltipPosition]=\"tooltipPosition\"\n [showDelay]=\"500\"\n (click)=\"onClick.emit($event)\"\n (mouseenter)=\"updateTooltipZIndex()\">\n <div *ngIf=\"badge\" class=\"badge\">\n <s-badge\n [color]=\"badge.color\"\n [text]=\"badge.text\"\n [iconClass]=\"badge.iconClass\">\n </s-badge>\n </div>\n <span \n *ngIf=\"iconClass\" \n [class]=\"iconClass\" \n [ngClass]=\"{ \n 's-button-icon': true,\n 's-button-icon-margin-right': !label && model && model.length\n }\"\n [ngStyle]=\"{ color: iconColor }\"\n aria-hidden=\"true\">\n </span>\n <span \n *ngIf=\"label\" \n class=\"s-button-text\"\n [ngClass]=\"{\n 's-button-icon-margin-right': !!rightIconClass || (model && model.length),\n 's-button-icon-margin-left': !!iconClass\n }\">\n {{ label }}\n </span>\n <ng-content></ng-content>\n <span \n *ngIf=\"rightIconClass\" \n [class]=\"rightIconClass\" \n [ngClass]=\"{ 's-button-right-icon': true }\"\n [ngStyle]=\"{ color: iconColor }\"\n aria-hidden=\"true\">\n </span>\n <span\n *ngIf=\"caret && (model && model.length) || (menuOptions && menuOptions.length)\" \n class=\"fa fa-fw fa-caret-down\"\n aria-hidden=\"true\">\n </span>\n</button>\n",
1602
- styles: [":host{display:inline-block}button{-ms-flex-align:center;align-items:center;border:1px solid;border-radius:4px;cursor:pointer;display:-ms-inline-flexbox;display:inline-flex;font-family:\"Open Sans\",sans-serif;font-size:14px;height:35px;-ms-flex-pack:center;justify-content:center;max-width:100%;min-width:40px;outline:0;overflow:visible;padding:5px 10px;position:relative;text-decoration:none;text-transform:none;transition:background-color .2s ease-out,color .2s ease-out,border-color .2s ease-out}button:disabled{opacity:.5;filter:Alpha(Opacity=50);background-image:none}button:disabled,button:disabled *{cursor:text!important}button.s-button-auxiliary{border-radius:20px}button.s-button-size-small{height:25px;padding:0 20px}button.s-button-size-default{height:35px}button.s-button-with-icon.s-button-multiple,button.s-button-with-text{min-width:80px}button.s-button-with-icon.s-button-with-text.s-button-multiple{min-width:100px}button .s-button-icon,button .s-button-menu-icon,button .s-button-right-icon,button.s-button-with-icon.s-button-multiple:not(.s-button-with-text) .s-button-icon{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}button.s-button-multiple .s-button-text{-ms-flex-align:left;align-items:left;display:-ms-flexbox;display:flex;-ms-flex-pack:left;justify-content:left}button.s-button-with-icon .s-button-text{-ms-flex-align:right;align-items:right;display:-ms-flexbox;display:flex;-ms-flex-pack:right;justify-content:right}.s-button-text{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.s-button-menu-icon{right:10px;transition:transform .2s ease-out}.s-button-icon-margin-left{margin-left:10px}.s-button-icon-margin-right{margin-right:10px}.s-button-active .s-button-menu-icon{transform:rotateX(180deg)}button,button.s-button-priority-primary{background-color:#428bca;border-color:#428bca}button .s-button-icon,button .s-button-menu-icon,button .s-button-right-icon,button .s-button-text,button.s-button-priority-primary .s-button-icon,button.s-button-priority-primary .s-button-menu-icon,button.s-button-priority-primary .s-button-right-icon,button.s-button-priority-primary .s-button-text{color:#fff}button.s-button-priority-primary:hover,button:hover{background-color:#2a6496}button.s-button-priority-primary:focus,button:focus{background-color:#2a6496;border-color:#22dce6}button.s-button-active:not(:disabled),button.s-button-priority-primary.s-button-active:not(:disabled),button.s-button-priority-primary:active:not(:disabled),button:active:not(:disabled){background-color:#245682;border-color:#245682}button.s-button-priority-secondary{background-color:#7892a1;border-color:#7892a1}button.s-button-priority-secondary .s-button-icon,button.s-button-priority-secondary .s-button-menu-icon,button.s-button-priority-secondary .s-button-right-icon,button.s-button-priority-secondary .s-button-text{color:#fff}button.s-button-priority-secondary:hover{background-color:#546b79}button.s-button-priority-secondary:focus{background-color:#546b79;border-color:#22dce6}button.s-button-priority-secondary.s-button-active:not(:disabled),button.s-button-priority-secondary:active:not(:disabled){background-color:#495e6a;border-color:#495e6a}button.s-button-priority-default{background-color:#fff;border-color:#ccc}button.s-button-priority-default .s-button-icon,button.s-button-priority-default .s-button-menu-icon,button.s-button-priority-default .s-button-right-icon,button.s-button-priority-default .s-button-text{color:#333}button.s-button-priority-default:hover{background-color:#d9d9d9}button.s-button-priority-default:focus{background-color:#d9d9d9;border-color:#22dce6}button.s-button-priority-default.s-button-active:not(:disabled),button.s-button-priority-default:active:not(:disabled){background-color:#ccc;border-color:#ccc}.s-button-priority-danger{background-color:#9c3a3a;border-color:#9c3a3a}.s-button-priority-danger .s-button-icon,.s-button-priority-danger .s-button-menu-icon,.s-button-priority-danger .s-button-right-icon,.s-button-priority-danger .s-button-text{color:#fff}.s-button-priority-danger:hover{background-color:#642525}.s-button-priority-danger:focus{background-color:#642525;border-color:#22dce6}.s-button-priority-danger.s-button-active:not(:disabled),.s-button-priority-danger:active:not(:disabled){background-color:#521e1e;border-color:#521e1e}button.s-button-priority-link{background-color:transparent;border-color:transparent}button.s-button-priority-link .s-button-icon,button.s-button-priority-link .s-button-menu-icon,button.s-button-priority-link .s-button-right-icon,button.s-button-priority-link .s-button-text{color:#428bca}button.s-button-priority-link:hover{background-color:transparent}button.s-button-priority-link:hover .s-button-icon,button.s-button-priority-link:hover .s-button-menu-icon,button.s-button-priority-link:hover .s-button-right-icon,button.s-button-priority-link:hover .s-button-text{color:#2a6496}button.s-button-priority-link:focus{border-color:#22dce6;background-color:transparent}button.s-button-priority-link:focus .s-button-icon,button.s-button-priority-link:focus .s-button-menu-icon,button.s-button-priority-link:focus .s-button-right-icon,button.s-button-priority-link:focus .s-button-text{color:#2a6496}button.s-button-priority-link.s-button-active:not(:disabled),button.s-button-priority-link:active:not(:disabled){background-color:transparent;border-color:transparent}button.s-button-priority-link.s-button-active:not(:disabled) .s-button-icon,button.s-button-priority-link.s-button-active:not(:disabled) .s-button-menu-icon,button.s-button-priority-link.s-button-active:not(:disabled) .s-button-right-icon,button.s-button-priority-link.s-button-active:not(:disabled) .s-button-text,button.s-button-priority-link:active:not(:disabled) .s-button-icon,button.s-button-priority-link:active:not(:disabled) .s-button-menu-icon,button.s-button-priority-link:active:not(:disabled) .s-button-right-icon,button.s-button-priority-link:active:not(:disabled) .s-button-text{color:#245682}.s-button--slide.s-button-with-icon.s-button-multiple,.s-button--slide.s-button-with-text{min-width:40px}.s-button--slide .s-button-text{position:absolute;opacity:0;width:0}.s-button--slide:hover .s-button-text{opacity:1;position:relative;transition:1s;width:auto}.s-button--slide:hover.s-button--rotate-animation .s-button-icon,.s-button--slide:hover.s-button--rotate-animation .s-button-right-icon{transform:rotate(360deg);transition:1.5s}.badge{position:absolute;top:-10px;right:-10px;z-index:99}"]
1374
+ LocalizedTimePipe.ctorParameters = () => [
1375
+ { type: LocaleService }
1376
+ ];
1377
+ LocalizedTimePipe = __decorate([
1378
+ Pipe({
1379
+ name: "localizedTime",
1603
1380
  })
1604
- ], ButtonComponent);
1381
+ ], LocalizedTimePipe);
1605
1382
 
1606
- let TieredMenuDividerComponent = class TieredMenuDividerComponent {
1383
+ let LocalizedTimeImpurePipe = class LocalizedTimeImpurePipe extends LocalizedTimePipe {
1607
1384
  };
1608
- TieredMenuDividerComponent = __decorate([
1609
- Component({
1610
- selector: "s-tiered-menu-divider",
1611
- template: "<div class=\"divider\"></div>",
1612
- styles: [".divider{margin:2px 0;height:1px;background-color:#ccc}"]
1613
- })
1614
- ], TieredMenuDividerComponent);
1385
+ LocalizedTimeImpurePipe = __decorate([
1386
+ Pipe({
1387
+ name: "localizedTimeImpure",
1388
+ pure: false,
1389
+ })
1390
+ ], LocalizedTimeImpurePipe);
1615
1391
 
1616
- let TieredMenuEventService = class TieredMenuEventService {
1617
- constructor() {
1618
- this.incrementCurrentItemEvent = new EventEmitter();
1619
- this.decrementCurrentItemEvent = new EventEmitter();
1620
- this.closeAllMenusEvent = new EventEmitter();
1621
- this.selectItemEvent = new EventEmitter();
1622
- this.openItemMenuEvent = new EventEmitter();
1623
- this.closeItemMenuEvent = new EventEmitter();
1624
- this.createMenuEvent = new EventEmitter();
1392
+ let CurrencyService = class CurrencyService {
1393
+ constructor(localeService) {
1394
+ this.localeService = localeService;
1395
+ this.currencies = {
1396
+ KHR: { precision: 12, scale: 2 },
1397
+ SSP: { precision: 12, scale: 2 },
1398
+ XCD: { precision: 12, scale: 2 },
1399
+ EGP: { precision: 12, scale: 2 },
1400
+ KWD: { precision: 12, scale: 3 },
1401
+ YER: { precision: 12, scale: 2 },
1402
+ HUF: { precision: 12, scale: 2 },
1403
+ MXN: { precision: 12, scale: 2 },
1404
+ MYR: { precision: 12, scale: 2 },
1405
+ ZWL: { precision: 12, scale: 2 },
1406
+ MUR: { precision: 12, scale: 2 },
1407
+ DKK: { precision: 12, scale: 2 },
1408
+ NOK: { precision: 12, scale: 2 },
1409
+ DJF: { precision: 12, scale: 0 },
1410
+ CRC: { precision: 12, scale: 2 },
1411
+ BND: { precision: 12, scale: 2 },
1412
+ NAD: { precision: 12, scale: 2 },
1413
+ MKD: { precision: 12, scale: 2 },
1414
+ CDF: { precision: 12, scale: 2 },
1415
+ GNF: { precision: 12, scale: 0 },
1416
+ EUR: { precision: 12, scale: 2 },
1417
+ OMR: { precision: 12, scale: 3 },
1418
+ CLP: { precision: 12, scale: 0 },
1419
+ BSD: { precision: 12, scale: 2 },
1420
+ TOP: { precision: 12, scale: 2 },
1421
+ IRR: { precision: 12, scale: 2 },
1422
+ BGN: { precision: 12, scale: 2 },
1423
+ BZD: { precision: 12, scale: 2 },
1424
+ CNY: { precision: 12, scale: 2 },
1425
+ FJD: { precision: 12, scale: 2 },
1426
+ SRD: { precision: 12, scale: 2 },
1427
+ SOS: { precision: 12, scale: 2 },
1428
+ GYD: { precision: 12, scale: 2 },
1429
+ VUV: { precision: 12, scale: 0 },
1430
+ MWK: { precision: 12, scale: 2 },
1431
+ MRU: { precision: 12, scale: 2 },
1432
+ LSL: { precision: 12, scale: 2 },
1433
+ ERN: { precision: 12, scale: 2 },
1434
+ BMD: { precision: 12, scale: 2 },
1435
+ WST: { precision: 12, scale: 2 },
1436
+ LRD: { precision: 12, scale: 2 },
1437
+ GMD: { precision: 12, scale: 2 },
1438
+ ARS: { precision: 12, scale: 2 },
1439
+ ZAR: { precision: 12, scale: 2 },
1440
+ RSD: { precision: 12, scale: 2 },
1441
+ MDL: { precision: 12, scale: 2 },
1442
+ USD: { precision: 12, scale: 2 },
1443
+ QAR: { precision: 12, scale: 2 },
1444
+ HRK: { precision: 12, scale: 2 },
1445
+ GIP: { precision: 12, scale: 2 },
1446
+ NPR: { precision: 12, scale: 2 },
1447
+ "002": { precision: 9, scale: 4 },
1448
+ PLN: { precision: 12, scale: 2 },
1449
+ MAD: { precision: 12, scale: 2 },
1450
+ BAM: { precision: 12, scale: 2 },
1451
+ BTN: { precision: 12, scale: 2 },
1452
+ BBD: { precision: 12, scale: 2 },
1453
+ SHP: { precision: 12, scale: 2 },
1454
+ LKR: { precision: 12, scale: 2 },
1455
+ KPW: { precision: 12, scale: 2 },
1456
+ LAK: { precision: 12, scale: 2 },
1457
+ SZL: { precision: 12, scale: 2 },
1458
+ PHP: { precision: 12, scale: 2 },
1459
+ RWF: { precision: 12, scale: 0 },
1460
+ ISK: { precision: 12, scale: 0 },
1461
+ XOF: { precision: 12, scale: 0 },
1462
+ AUD: { precision: 12, scale: 2 },
1463
+ NGN: { precision: 12, scale: 2 },
1464
+ KGS: { precision: 12, scale: 2 },
1465
+ KYD: { precision: 12, scale: 2 },
1466
+ PGK: { precision: 12, scale: 2 },
1467
+ DZD: { precision: 12, scale: 2 },
1468
+ XAF: { precision: 12, scale: 0 },
1469
+ PEN: { precision: 12, scale: 2 },
1470
+ JPY: { precision: 12, scale: 0 },
1471
+ SBD: { precision: 12, scale: 2 },
1472
+ UGX: { precision: 12, scale: 0 },
1473
+ AMD: { precision: 12, scale: 2 },
1474
+ AED: { precision: 12, scale: 2 },
1475
+ ALL: { precision: 12, scale: 2 },
1476
+ XPF: { precision: 12, scale: 0 },
1477
+ AFN: { precision: 12, scale: 2 },
1478
+ RON: { precision: 12, scale: 2 },
1479
+ TND: { precision: 12, scale: 3 },
1480
+ NZD: { precision: 12, scale: 2 },
1481
+ JOD: { precision: 12, scale: 3 },
1482
+ VND: { precision: 12, scale: 0 },
1483
+ ETB: { precision: 12, scale: 2 },
1484
+ PYG: { precision: 12, scale: 0 },
1485
+ JMD: { precision: 12, scale: 2 },
1486
+ KES: { precision: 12, scale: 2 },
1487
+ IDR: { precision: 12, scale: 2 },
1488
+ HKD: { precision: 12, scale: 2 },
1489
+ BDT: { precision: 12, scale: 2 },
1490
+ GBP: { precision: 12, scale: 2 },
1491
+ AOA: { precision: 12, scale: 2 },
1492
+ PKR: { precision: 12, scale: 2 },
1493
+ TRY: { precision: 12, scale: 2 },
1494
+ SLL: { precision: 12, scale: 2 },
1495
+ CVE: { precision: 12, scale: 2 },
1496
+ LYD: { precision: 12, scale: 3 },
1497
+ ILS: { precision: 12, scale: 2 },
1498
+ UZS: { precision: 12, scale: 2 },
1499
+ CHF: { precision: 12, scale: 2 },
1500
+ SVC: { precision: 12, scale: 2 },
1501
+ BRL: { precision: 12, scale: 2 },
1502
+ GHS: { precision: 12, scale: 2 },
1503
+ CUP: { precision: 12, scale: 2 },
1504
+ FKP: { precision: 12, scale: 2 },
1505
+ NIO: { precision: 12, scale: 2 },
1506
+ GEL: { precision: 12, scale: 2 },
1507
+ TTD: { precision: 12, scale: 2 },
1508
+ AAA: { precision: 1, scale: 1 },
1509
+ COP: { precision: 12, scale: 2 },
1510
+ MGA: { precision: 12, scale: 2 },
1511
+ INR: { precision: 12, scale: 2 },
1512
+ KRW: { precision: 12, scale: 0 },
1513
+ HNL: { precision: 12, scale: 2 },
1514
+ MMK: { precision: 12, scale: 2 },
1515
+ TZS: { precision: 12, scale: 2 },
1516
+ THB: { precision: 12, scale: 2 },
1517
+ TMT: { precision: 12, scale: 2 },
1518
+ SAR: { precision: 12, scale: 2 },
1519
+ UYU: { precision: 12, scale: 2 },
1520
+ BIF: { precision: 12, scale: 0 },
1521
+ MVR: { precision: 12, scale: 2 },
1522
+ RUB: { precision: 12, scale: 2 },
1523
+ GTQ: { precision: 12, scale: 2 },
1524
+ SCR: { precision: 12, scale: 2 },
1525
+ IQD: { precision: 12, scale: 3 },
1526
+ UAH: { precision: 12, scale: 2 },
1527
+ BYN: { precision: 12, scale: 2 },
1528
+ VES: { precision: 12, scale: 2 },
1529
+ BOB: { precision: 12, scale: 2 },
1530
+ SGD: { precision: 12, scale: 2 },
1531
+ ZMW: { precision: 12, scale: 2 },
1532
+ CZK: { precision: 12, scale: 2 },
1533
+ TJS: { precision: 12, scale: 2 },
1534
+ DOP: { precision: 12, scale: 2 },
1535
+ AZN: { precision: 12, scale: 2 },
1536
+ PAB: { precision: 12, scale: 2 },
1537
+ STN: { precision: 12, scale: 2 },
1538
+ SDG: { precision: 12, scale: 2 },
1539
+ BWP: { precision: 12, scale: 2 },
1540
+ BHD: { precision: 12, scale: 3 },
1541
+ CAD: { precision: 12, scale: 2 },
1542
+ MNT: { precision: 12, scale: 2 },
1543
+ MOP: { precision: 12, scale: 2 },
1544
+ HTG: { precision: 12, scale: 2 },
1545
+ KZT: { precision: 12, scale: 2 },
1546
+ LBP: { precision: 12, scale: 2 },
1547
+ SYP: { precision: 12, scale: 2 },
1548
+ TWD: { precision: 12, scale: 2 },
1549
+ MZN: { precision: 12, scale: 2 },
1550
+ ANG: { precision: 12, scale: 2 },
1551
+ SEK: { precision: 12, scale: 2 },
1552
+ KMF: { precision: 12, scale: 0 },
1553
+ AWG: { precision: 12, scale: 2 },
1554
+ };
1555
+ }
1556
+ getCurrencySymbol({ currency }) {
1557
+ var _a, _b;
1558
+ const numberFormat = new Intl.NumberFormat(this.localeService.getLocaleOptions().locale, {
1559
+ style: "currency",
1560
+ currency: currency !== null && currency !== void 0 ? currency : "BRL",
1561
+ currencyDisplay: "narrowSymbol",
1562
+ maximumFractionDigits: 5,
1563
+ });
1564
+ return (_b = (_a = numberFormat.formatToParts(1).find((x) => x.type === "currency")) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "";
1625
1565
  }
1626
1566
  };
1627
- TieredMenuEventService = __decorate([
1628
- Injectable()
1629
- ], TieredMenuEventService);
1567
+ CurrencyService.ctorParameters = () => [
1568
+ { type: LocaleService }
1569
+ ];
1570
+ CurrencyService.ɵprov = ɵɵdefineInjectable({ factory: function CurrencyService_Factory() { return new CurrencyService(ɵɵinject(LocaleService)); }, token: CurrencyService, providedIn: "root" });
1571
+ CurrencyService = __decorate([
1572
+ Injectable({ providedIn: "root" })
1573
+ ], CurrencyService);
1630
1574
 
1631
- let TieredMenuItemComponent = class TieredMenuItemComponent {
1632
- constructor(_tieredMenuEventService) {
1633
- this._tieredMenuEventService = _tieredMenuEventService;
1634
- this.focused = false;
1635
- this.highlight = false;
1636
- this.triggerEvent = "click";
1637
- this.closeOnClick = false;
1638
- }
1639
- onClick() {
1640
- if (this.item.disabled)
1641
- return;
1642
- if (this.item.submenu) {
1643
- if (!this.item.isOpen) {
1644
- this._tieredMenuEventService.openItemMenuEvent.emit(this.item);
1645
- }
1646
- else if (this.closeOnClick) {
1647
- this._tieredMenuEventService.closeItemMenuEvent.emit(this.item);
1648
- }
1649
- }
1650
- else {
1651
- this._tieredMenuEventService.selectItemEvent.emit(this.item);
1652
- }
1575
+ let NumericService = class NumericService {
1576
+ constructor(localeService, currencyService) {
1577
+ this.localeService = localeService;
1578
+ this.currencyService = currencyService;
1653
1579
  }
1654
- onMouseEnter() {
1655
- if (this.item.disabled)
1656
- return;
1657
- if (this.triggerEvent === "hover" && !this.item.isOpen) {
1658
- this._showTimeout = window.setTimeout(() => {
1659
- this._tieredMenuEventService.openItemMenuEvent.emit(this.item);
1660
- }, 300);
1661
- }
1580
+ /**
1581
+ * Wrapper around Intl.NumberFormat that returns the localized value using the user's locale by default(platform's preferential language).
1582
+ *
1583
+ * This method should only be used after the localeService has been initialized by the host application, either by a resolver or a manual call.
1584
+ *
1585
+ * Can be overwritten by the provided Intl.NumberFormatOptions.
1586
+ *
1587
+ * Documentation is available at {@link https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat Intl.NumberFormatOptions}.
1588
+ *
1589
+ * @param {number | string | BigNumber} value The value to be formatted.
1590
+ * @param options Locale and numberFormatOptions that overwrites the default Intl.NumberFormatOptions.
1591
+ * @return `string` The formatted value.
1592
+ */
1593
+ instant(value, options) {
1594
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
1595
+ if (isNullOrUndefined(value))
1596
+ return null;
1597
+ options = Object.assign(Object.assign({}, options), { locale: (_c = (_a = options === null || options === void 0 ? void 0 : options.locale) !== null && _a !== void 0 ? _a : (_b = this.localeService.getLocaleOptions()) === null || _b === void 0 ? void 0 : _b.locale) !== null && _c !== void 0 ? _c : "pt-BR", numberFormatOptions: Object.assign(Object.assign({ useGrouping: true }, options === null || options === void 0 ? void 0 : options.numberFormatOptions), { currency: ((_d = options === null || options === void 0 ? void 0 : options.numberFormatOptions) === null || _d === void 0 ? void 0 : _d.style) === "currency" ? ((_f = (_e = options === null || options === void 0 ? void 0 : options.numberFormatOptions) === null || _e === void 0 ? void 0 : _e.currency) !== null && _f !== void 0 ? _f : "BRL") : undefined, currencyDisplay: ((_g = options === null || options === void 0 ? void 0 : options.numberFormatOptions) === null || _g === void 0 ? void 0 : _g.style) === "currency"
1598
+ ? ((_j = (_h = options === null || options === void 0 ? void 0 : options.numberFormatOptions) === null || _h === void 0 ? void 0 : _h.currencyDisplay) !== null && _j !== void 0 ? _j : "narrowSymbol")
1599
+ : undefined, minimumFractionDigits: (_l = (_k = options === null || options === void 0 ? void 0 : options.numberFormatOptions) === null || _k === void 0 ? void 0 : _k.minimumFractionDigits) !== null && _l !== void 0 ? _l : this.getCurrencyMinimumFractionDigits((_m = options === null || options === void 0 ? void 0 : options.numberFormatOptions) === null || _m === void 0 ? void 0 : _m.currency) }) });
1600
+ options.numberFormatOptions["roundingMode"] = "trunc";
1601
+ // From https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
1602
+ return new Intl.NumberFormat(options.locale, options.numberFormatOptions).format(this.getType(value) === "number" || this.getType(value) === "string" ? value : value.toString());
1662
1603
  }
1663
- onMouseLeave() {
1664
- window.clearTimeout(this._showTimeout);
1604
+ getCurrencyMinimumFractionDigits(currency) {
1605
+ var _a;
1606
+ if (!currency)
1607
+ return null;
1608
+ return (_a = this.currencyService.currencies[currency.toUpperCase()]) === null || _a === void 0 ? void 0 : _a.scale;
1609
+ }
1610
+ getType(value) {
1611
+ // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof
1612
+ if (value === null) {
1613
+ return "null";
1614
+ }
1615
+ const baseType = typeof value;
1616
+ // Primitive types
1617
+ if (baseType !== "object" && baseType !== "function") {
1618
+ return baseType;
1619
+ }
1620
+ // Symbol.toStringTag often specifies the "display name" of the
1621
+ // object's class. It's used in Object.prototype.toString().
1622
+ const tag = value[Symbol.toStringTag];
1623
+ if (typeof tag === "string") {
1624
+ return tag;
1625
+ }
1626
+ // If it's a function whose source code starts with the "class" keyword
1627
+ if (baseType === "function" && Function.prototype.toString.call(value).startsWith("class")) {
1628
+ return "class";
1629
+ }
1630
+ // The name of the constructor; for example `Array`, `GeneratorFunction`,
1631
+ // `Number`, `String`, `Boolean` or `MyCustomClass`
1632
+ const className = value.constructor.name;
1633
+ if (typeof className === "string" && className !== "") {
1634
+ return className;
1635
+ }
1636
+ // At this point there's no robust way to get the type of value,
1637
+ // so we use the base implementation.
1638
+ return baseType;
1665
1639
  }
1666
1640
  };
1667
- TieredMenuItemComponent.ctorParameters = () => [
1668
- { type: TieredMenuEventService }
1641
+ NumericService.ctorParameters = () => [
1642
+ { type: LocaleService },
1643
+ { type: CurrencyService }
1644
+ ];
1645
+ NumericService.ɵprov = ɵɵdefineInjectable({ factory: function NumericService_Factory() { return new NumericService(ɵɵinject(LocaleService), ɵɵinject(CurrencyService)); }, token: NumericService, providedIn: "root" });
1646
+ NumericService = __decorate([
1647
+ Injectable({
1648
+ providedIn: "root",
1649
+ })
1650
+ ], NumericService);
1651
+
1652
+ let NumericPipe = class NumericPipe {
1653
+ constructor(numericService, localeService) {
1654
+ this.numericService = numericService;
1655
+ this.localeService = localeService;
1656
+ }
1657
+ transform(value, options) {
1658
+ return (options === null || options === void 0 ? void 0 : options.locale) ? of(this.numericService.instant(value, options))
1659
+ : this.localeService.getLocale().pipe(map((locale) => this.numericService.instant(value, {
1660
+ locale,
1661
+ numberFormatOptions: options === null || options === void 0 ? void 0 : options.numberFormatOptions,
1662
+ })));
1663
+ }
1664
+ };
1665
+ NumericPipe.ctorParameters = () => [
1666
+ { type: NumericService },
1667
+ { type: LocaleService }
1668
+ ];
1669
+ NumericPipe = __decorate([
1670
+ Pipe({ name: "numeric" })
1671
+ ], NumericPipe);
1672
+
1673
+ var LocaleModule_1;
1674
+ let LocaleModule = LocaleModule_1 = class LocaleModule {
1675
+ static forRoot() {
1676
+ return {
1677
+ ngModule: LocaleModule_1,
1678
+ providers: [
1679
+ LocaleService,
1680
+ LocalizedCurrencyPipe,
1681
+ LocalizedDatePipe,
1682
+ LocalizedTimePipe,
1683
+ LocalizedNumberPipe,
1684
+ LocalizedCurrencyImpurePipe,
1685
+ LocalizedDateImpurePipe,
1686
+ LocalizedTimeImpurePipe,
1687
+ LocalizedBignumberPipe,
1688
+ LocalizedBignumberImpurePipe,
1689
+ NumericPipe
1690
+ ],
1691
+ };
1692
+ }
1693
+ static forChild() {
1694
+ return {
1695
+ ngModule: LocaleModule_1,
1696
+ };
1697
+ }
1698
+ };
1699
+ LocaleModule = LocaleModule_1 = __decorate([
1700
+ NgModule({
1701
+ imports: [CommonModule],
1702
+ exports: [
1703
+ LocalizedCurrencyPipe,
1704
+ LocalizedDatePipe,
1705
+ LocalizedTimePipe,
1706
+ LocalizedNumberPipe,
1707
+ LocalizedCurrencyImpurePipe,
1708
+ LocalizedDateImpurePipe,
1709
+ LocalizedTimeImpurePipe,
1710
+ LocalizedBignumberPipe,
1711
+ LocalizedBignumberImpurePipe,
1712
+ NumericPipe
1713
+ ],
1714
+ declarations: [
1715
+ LocalizedCurrencyPipe,
1716
+ LocalizedDatePipe,
1717
+ LocalizedTimePipe,
1718
+ LocalizedNumberPipe,
1719
+ LocalizedCurrencyImpurePipe,
1720
+ LocalizedDateImpurePipe,
1721
+ LocalizedTimeImpurePipe,
1722
+ LocalizedBignumberPipe,
1723
+ LocalizedBignumberImpurePipe,
1724
+ NumericPipe
1725
+ ],
1726
+ })
1727
+ ], LocaleModule);
1728
+
1729
+ var BignumberInputDirective_1;
1730
+ let BignumberInputDirective = BignumberInputDirective_1 = class BignumberInputDirective extends CurrencyMaskDirective {
1731
+ constructor(injector, _angularComponentsLocaleService) {
1732
+ super(injector);
1733
+ this._angularComponentsLocaleService = _angularComponentsLocaleService;
1734
+ this.precision = 15;
1735
+ this.scale = 0;
1736
+ this.alignTo = AlignmentOptions.LEFT;
1737
+ this.allowNegative = true;
1738
+ this.pasteRejected = new EventEmitter();
1739
+ this.onLocaleService();
1740
+ }
1741
+ ngOnInit() {
1742
+ this.updateVariables();
1743
+ super.ngOnInit();
1744
+ }
1745
+ ngOnChanges(changes) {
1746
+ const placeholderChange = changes.placeholder && changes.placeholder.currentValue;
1747
+ if (!placeholderChange && this.scale) {
1748
+ this.placeholder = `0${this.decimalSeparator}${"".padEnd(this.scale, "0")}`;
1749
+ }
1750
+ if (changes.scale ||
1751
+ changes.decimalSeparator ||
1752
+ changes.thousandsSeparator ||
1753
+ changes.alignTo ||
1754
+ changes.precision ||
1755
+ changes.allowNegative) {
1756
+ this.updateVariables();
1757
+ }
1758
+ }
1759
+ onPaste(event) {
1760
+ var _a, _b;
1761
+ const pastedText = (_b = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData("text")) !== null && _b !== void 0 ? _b : "";
1762
+ const numericText = pastedText.replace(new RegExp(`\\${this.thousandsSeparator}`, "g"), "").replace(this.decimalSeparator, ".");
1763
+ const [intPart, decimalPart = ""] = numericText.split(".");
1764
+ const totalDigits = intPart.replace(/\D/g, "").length + decimalPart.slice(0, this.scale).length;
1765
+ if (totalDigits > this.precision) {
1766
+ event.preventDefault();
1767
+ this.pasteRejected.emit(pastedText);
1768
+ }
1769
+ }
1770
+ onKeypress(event) {
1771
+ const code = event.code;
1772
+ if (code === "Minus" || code === "NumpadSubtract") {
1773
+ if (this.allowNegative) {
1774
+ this.maxLength = this._maxLength + 1;
1775
+ }
1776
+ }
1777
+ else if (code === "Equal" || code === "NumpadAdd") {
1778
+ this.maxLength = this._maxLength;
1779
+ }
1780
+ }
1781
+ /**
1782
+ * Update the options values according to the directive input values.
1783
+ */
1784
+ updateVariables() {
1785
+ var _a;
1786
+ this.options = {
1787
+ align: this.alignTo,
1788
+ decimalSeparator: this.decimalSeparator,
1789
+ thousandsSeparator: (_a = this.thousandsSeparator) !== null && _a !== void 0 ? _a : ".",
1790
+ scale: this.scale || 0,
1791
+ prefix: "",
1792
+ suffix: "",
1793
+ allowNegative: this.allowNegative,
1794
+ };
1795
+ this.calculateMaxLength();
1796
+ }
1797
+ /**
1798
+ * Responsible to calculate the field maximum length considering the separators.
1799
+ */
1800
+ calculateMaxLength() {
1801
+ var _a, _b;
1802
+ const decSepLength = this.decimalSeparator.length;
1803
+ const thoSepLength = (_b = (_a = this.thousandsSeparator) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 1;
1804
+ let maxLength = this.precision + (this.scale ? decSepLength : 0);
1805
+ maxLength += Math.ceil((this.precision - (this.scale ? this.scale : 0)) / 3 - 1) * thoSepLength;
1806
+ this._maxLength = maxLength;
1807
+ this.maxLength = maxLength;
1808
+ }
1809
+ onLocaleService() {
1810
+ this._angularComponentsLocaleService
1811
+ .getLocale()
1812
+ .pipe(first())
1813
+ .subscribe(() => {
1814
+ var _a, _b;
1815
+ this.decimalSeparator = (_a = this.decimalSeparator) !== null && _a !== void 0 ? _a : this._angularComponentsLocaleService.getDecimalSeparator();
1816
+ this.thousandsSeparator = (_b = this.thousandsSeparator) !== null && _b !== void 0 ? _b : this._angularComponentsLocaleService.getGroupingSeparator();
1817
+ });
1818
+ }
1819
+ };
1820
+ BignumberInputDirective.ctorParameters = () => [
1821
+ { type: Injector },
1822
+ { type: LocaleService }
1669
1823
  ];
1670
1824
  __decorate([
1671
1825
  Input()
1672
- ], TieredMenuItemComponent.prototype, "item", void 0);
1826
+ ], BignumberInputDirective.prototype, "precision", void 0);
1673
1827
  __decorate([
1674
1828
  Input()
1675
- ], TieredMenuItemComponent.prototype, "focused", void 0);
1829
+ ], BignumberInputDirective.prototype, "scale", void 0);
1676
1830
  __decorate([
1677
1831
  Input()
1678
- ], TieredMenuItemComponent.prototype, "highlight", void 0);
1832
+ ], BignumberInputDirective.prototype, "decimalSeparator", void 0);
1679
1833
  __decorate([
1680
1834
  Input()
1681
- ], TieredMenuItemComponent.prototype, "triggerEvent", void 0);
1835
+ ], BignumberInputDirective.prototype, "thousandsSeparator", void 0);
1682
1836
  __decorate([
1683
1837
  Input()
1684
- ], TieredMenuItemComponent.prototype, "closeOnClick", void 0);
1838
+ ], BignumberInputDirective.prototype, "alignTo", void 0);
1685
1839
  __decorate([
1686
- HostListener("click"),
1687
- HostListener("touchend")
1688
- ], TieredMenuItemComponent.prototype, "onClick", null);
1840
+ Input()
1841
+ ], BignumberInputDirective.prototype, "allowNegative", void 0);
1689
1842
  __decorate([
1690
- HostListener("mouseenter")
1691
- ], TieredMenuItemComponent.prototype, "onMouseEnter", null);
1843
+ Input(),
1844
+ HostBinding("attr.placeholder")
1845
+ ], BignumberInputDirective.prototype, "placeholder", void 0);
1692
1846
  __decorate([
1693
- HostListener("mouseleave")
1694
- ], TieredMenuItemComponent.prototype, "onMouseLeave", null);
1695
- TieredMenuItemComponent = __decorate([
1696
- Component({
1697
- selector: "s-tiered-menu-item",
1698
- template: "<div\n [id]=\"item.id\"\n class=\"tiered-menu-item\"\n [ngClass]=\"{\n 'tiered-menu-item--open': item.isOpen,\n 'tiered-menu-item--focused': focused,\n 'tiered-menu-item--disabled': item.disabled\n }\">\n <div class=\"tiered-menu-item-content\">\n <span class=\"icon\" [ngClass]=\"item.iconClass\"></span>\n <span class=\"label\">{{ item.label }}</span>\n </div>\n <span\n *ngIf=\"item.submenu\"\n class=\"submenu-icon\"\n [ngClass]=\"{\n 'fas': true,\n 'fa-chevron-left': item.isOpen,\n 'fa-chevron-right': !item.isOpen\n }\">\n </span>\n</div>",
1699
- styles: [".tiered-menu-item{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;padding:8px 16px;-webkit-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}.tiered-menu-item .tiered-menu-item-content .label{margin:0 12px}.tiered-menu-item:hover{background-color:#e9e6e6}.tiered-menu-item--focused{background-color:#ccc!important}.tiered-menu-item--open{background-color:#e4e2e2}.tiered-menu-item--disabled{opacity:50%;cursor:default}"]
1700
- })
1701
- ], TieredMenuItemComponent);
1702
-
1703
- let TieredMenuService = class TieredMenuService {
1704
- constructor() {
1705
- this.currentItems = [];
1706
- this.items = [];
1707
- }
1708
- normalizeData(items, parent) {
1709
- return items.map((i) => {
1710
- const item = Object.assign({ visible: true }, i);
1711
- if (item.submenu) {
1712
- item.submenu = this.normalizeData(item.submenu, item);
1713
- }
1714
- item.id = this._generateId();
1715
- item.parent = parent;
1716
- item.isOpen = false;
1717
- return item;
1718
- });
1719
- }
1720
- markAllItemsAsClosed(items) {
1721
- return items.map((i) => {
1722
- const item = Object.assign({}, i);
1723
- if (item.submenu) {
1724
- item.submenu = this.markAllItemsAsClosed(item.submenu);
1725
- }
1726
- item.isOpen = false;
1727
- return item;
1728
- });
1729
- }
1730
- searchTheHierarchy(itemA, itemB) {
1731
- let item = itemB;
1732
- while (item) {
1733
- if (item === itemA) {
1734
- return true;
1735
- }
1736
- item = item.parent;
1737
- }
1738
- return false;
1739
- }
1740
- cloneItems(items) {
1741
- return JSON.parse(JSON.stringify(items));
1742
- }
1743
- _generateId() {
1744
- return `id-${Math.random().toString(36).substring(2, 9)}-${Math.random().toString(36).substring(2, 9)}-${Math.random().toString(36).substring(2, 9)}`;
1745
- }
1746
- };
1747
- TieredMenuService = __decorate([
1748
- Injectable()
1749
- ], TieredMenuService);
1847
+ HostBinding("attr.maxLength")
1848
+ ], BignumberInputDirective.prototype, "maxLength", void 0);
1849
+ __decorate([
1850
+ Output()
1851
+ ], BignumberInputDirective.prototype, "pasteRejected", void 0);
1852
+ __decorate([
1853
+ HostListener("paste", ["$event"])
1854
+ ], BignumberInputDirective.prototype, "onPaste", null);
1855
+ __decorate([
1856
+ HostListener("keypress", ["$event"])
1857
+ ], BignumberInputDirective.prototype, "onKeypress", null);
1858
+ BignumberInputDirective = BignumberInputDirective_1 = __decorate([
1859
+ Directive({
1860
+ selector: "input[sBignumberInput]",
1861
+ providers: [
1862
+ {
1863
+ provide: NG_VALUE_ACCESSOR,
1864
+ useExisting: forwardRef(() => BignumberInputDirective_1),
1865
+ multi: true,
1866
+ },
1867
+ ],
1868
+ })
1869
+ ], BignumberInputDirective);
1750
1870
 
1751
- const enableScroll = () => {
1752
- document.body.style.overflow = "auto";
1753
- };
1754
- const disabledScroll = () => {
1755
- document.body.style.overflow = "hidden";
1871
+ let BignumberInputModule = class BignumberInputModule {
1756
1872
  };
1873
+ BignumberInputModule = __decorate([
1874
+ NgModule({
1875
+ imports: [CommonModule],
1876
+ declarations: [BignumberInputDirective],
1877
+ exports: [BignumberInputDirective],
1878
+ })
1879
+ ], BignumberInputModule);
1757
1880
 
1758
- let TieredMenuNestedComponent = class TieredMenuNestedComponent {
1759
- constructor(tieredMenuService, _tieredMenuEventService) {
1760
- this.tieredMenuService = tieredMenuService;
1761
- this._tieredMenuEventService = _tieredMenuEventService;
1762
- this.top = 0;
1763
- this.left = 0;
1764
- this._unsubscribe$ = new Subject();
1765
- }
1766
- onResize() {
1767
- this._tieredMenuEventService.closeAllMenusEvent.emit();
1881
+ let BreadcrumbComponent = class BreadcrumbComponent {
1882
+ constructor(activatedRoute, router) {
1883
+ this.activatedRoute = activatedRoute;
1884
+ this.router = router;
1885
+ this.targetHomeUrl = "_self";
1886
+ this.ngUnsubscribe = new Subject();
1887
+ this.router.events
1888
+ .pipe(takeUntil(this.ngUnsubscribe), filter(event => event instanceof NavigationEnd))
1889
+ .subscribe(() => this.onNavigationEnd());
1768
1890
  }
1769
- onDocumentClick(event) {
1770
- // Closing menu when clicked outside.
1771
- const target = event.target;
1772
- const clickedInside = target.closest("s-tiered-menu-item") || target.closest("s-tiered-menu-divider");
1773
- if (!clickedInside) {
1774
- this._tieredMenuEventService.closeAllMenusEvent.emit();
1775
- }
1891
+ onNavigationEnd() {
1892
+ const currentRoute = this.activatedRoute.root;
1893
+ const validRoutes = this.getValidChildren(currentRoute);
1894
+ this.title = this.getCurrentTitle(validRoutes);
1895
+ this.home = this.getCurrentHome(validRoutes);
1896
+ this.items = this.getCurrentItems(validRoutes);
1776
1897
  }
1777
- onKeydownHandler(event) {
1778
- switch (event.key) {
1779
- case "Escape":
1780
- this._tieredMenuEventService.closeAllMenusEvent.emit();
1781
- break;
1782
- case " ":
1783
- case "Enter":
1784
- this._tieredMenuEventService.selectItemEvent.emit(this.tieredMenuService.currentItem);
1785
- break;
1786
- case "ArrowLeft":
1787
- // When nested I need a reference to the current item's parent item, otherwise just the current item.
1788
- this._tieredMenuEventService.closeItemMenuEvent.emit(this.tieredMenuService.currentItem.parent);
1789
- break;
1790
- case "ArrowRight":
1791
- this._tieredMenuEventService.openItemMenuEvent.emit(this.tieredMenuService.currentItem);
1792
- break;
1793
- case "ArrowUp":
1794
- this._tieredMenuEventService.decrementCurrentItemEvent.emit();
1795
- break;
1796
- case "ArrowDown":
1797
- this._tieredMenuEventService.incrementCurrentItemEvent.emit();
1798
- break;
1799
- }
1898
+ getValidChildren(route) {
1899
+ const valid = route.routeConfig && route.routeConfig.path && route.routeConfig.component && route.outlet === PRIMARY_OUTLET;
1900
+ return route.children.reduce((validRoutes, child) => [...validRoutes, ...this.getValidChildren(child)], valid ? [route] : []);
1800
1901
  }
1801
- ngOnInit() {
1802
- this.tieredMenuService.currentItems = this.items;
1803
- this._subscribeEvents();
1804
- disabledScroll();
1902
+ getCurrentTitle(routes) {
1903
+ const last = routes[routes.length - 1];
1904
+ if (last && last.routeConfig)
1905
+ return this.getTitle(last);
1805
1906
  }
1806
- ngOnDestroy() {
1807
- this._unsubscribe$.next();
1808
- this._unsubscribe$.complete();
1809
- enableScroll();
1907
+ getCurrentHome(routes) {
1908
+ let home;
1909
+ if (this.homeUrl)
1910
+ home = { url: this.homeUrl, icon: "fa fa-home", target: this.targetHomeUrl };
1911
+ else if (routes.length)
1912
+ home = Object.assign(Object.assign({}, this.getMenuItem(routes[0], routes.length === 1)), { icon: "fa fa-home" });
1913
+ return home;
1810
1914
  }
1811
- _incrementCurItem() {
1812
- if (!this.tieredMenuService.currentItem) {
1813
- this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[0];
1915
+ getCurrentItems(routes) {
1916
+ if (!routes.length)
1814
1917
  return;
1815
- }
1816
- const curIndex = this.tieredMenuService.currentItems.indexOf(this.tieredMenuService.currentItem) + 1;
1817
- if (curIndex < this.tieredMenuService.currentItems.length) {
1818
- this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[curIndex];
1819
- }
1820
- else {
1821
- this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[0];
1822
- }
1823
- if (this.tieredMenuService.currentItem.divider) {
1824
- this._incrementCurItem();
1825
- }
1918
+ const items = this.homeUrl ? routes : routes.slice(1);
1919
+ if (items.length)
1920
+ return items.map((route, i) => this.getMenuItem(route, i === routes.length - 1));
1826
1921
  }
1827
- _decrementCurItem() {
1828
- if (!this.tieredMenuService.currentItem) {
1829
- this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[0];
1830
- return;
1831
- }
1832
- const curIndex = this.tieredMenuService.currentItems.indexOf(this.tieredMenuService.currentItem) - 1;
1833
- if (curIndex >= 0) {
1834
- this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[curIndex];
1835
- }
1836
- else {
1837
- this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[this.tieredMenuService.currentItems.length - 1];
1838
- }
1839
- if (this.tieredMenuService.currentItem.divider) {
1840
- this._decrementCurItem();
1841
- }
1922
+ getMenuItem(route, disabled = false) {
1923
+ const label = this.getTitle(route);
1924
+ const routes = route.pathFromRoot;
1925
+ const routerLink = routes
1926
+ .slice(0, routes.indexOf(route) + 1)
1927
+ .reduce((result, item) => [...result, ...item.snapshot.url.map(url => url.path)], ["/"]);
1928
+ return {
1929
+ label,
1930
+ routerLink,
1931
+ queryParams: route.snapshot.queryParams,
1932
+ routerLinkActiveOptions: { exact: true },
1933
+ disabled,
1934
+ };
1842
1935
  }
1843
- _closeItem(item) {
1844
- var _a;
1845
- let itemAux = this._lastOpenItem;
1846
- while (itemAux && itemAux != item) {
1847
- itemAux.isOpen = false;
1848
- itemAux = itemAux.parent;
1849
- }
1850
- item.isOpen = false;
1851
- this.tieredMenuService.currentItem = itemAux !== null && itemAux !== void 0 ? itemAux : this.tieredMenuService.items[0];
1852
- this.tieredMenuService.currentItems = ((_a = itemAux === null || itemAux === void 0 ? void 0 : itemAux.parent) === null || _a === void 0 ? void 0 : _a.submenu) || this.tieredMenuService.items;
1936
+ getTitle(route) {
1937
+ const { snapshot, routeConfig } = route;
1938
+ const title = snapshot.data.routeTitle;
1939
+ if (!title)
1940
+ throw new Error(`No routeTitle defined for the route /${routeConfig.path}`);
1941
+ return title;
1853
1942
  }
1854
- _openItem(item) {
1855
- if (item === null || item === void 0 ? void 0 : item.submenu) {
1856
- item.isOpen = true;
1857
- this.tieredMenuService.currentItems = item.submenu;
1858
- // Only has focus if there has already been interaction.
1859
- if (this.tieredMenuService.currentItem) {
1860
- this.tieredMenuService.currentItem = item.submenu[0];
1861
- }
1862
- this._lastOpenItem = item;
1863
- }
1864
- }
1865
- _subscribeEvents() {
1866
- this._tieredMenuEventService.incrementCurrentItemEvent
1867
- .pipe(takeUntil(this._unsubscribe$))
1868
- .subscribe(() => {
1869
- this._incrementCurItem();
1870
- });
1871
- this._tieredMenuEventService.decrementCurrentItemEvent
1872
- .pipe(takeUntil(this._unsubscribe$))
1873
- .subscribe(() => {
1874
- this._decrementCurItem();
1875
- });
1876
- this._tieredMenuEventService.selectItemEvent
1877
- .pipe(takeUntil(this._unsubscribe$))
1878
- .subscribe((item) => {
1879
- if (item.command) {
1880
- item.command();
1881
- // Close all menus after the item was selected.
1882
- this._tieredMenuEventService.closeAllMenusEvent.emit();
1883
- }
1884
- });
1885
- this._tieredMenuEventService.openItemMenuEvent
1886
- .pipe(takeUntil(this._unsubscribe$))
1887
- .subscribe((item) => {
1888
- var _a, _b;
1889
- if (!this.tieredMenuService.currentItems.includes(item)) {
1890
- let itemAux = this._lastOpenItem;
1891
- while ((_a = itemAux === null || itemAux === void 0 ? void 0 : itemAux.parent) === null || _a === void 0 ? void 0 : _a.parent) {
1892
- itemAux = itemAux.parent;
1893
- }
1894
- this._tieredMenuEventService.closeItemMenuEvent.emit((_b = itemAux.parent) !== null && _b !== void 0 ? _b : itemAux);
1895
- }
1896
- this._lastOpenItem = item;
1897
- this._openItem(item);
1898
- });
1899
- this._tieredMenuEventService.closeItemMenuEvent
1900
- .pipe(takeUntil(this._unsubscribe$))
1901
- .subscribe((item) => {
1902
- if (item) {
1903
- this._closeItem(item);
1904
- }
1905
- });
1943
+ ngOnDestroy() {
1944
+ this.ngUnsubscribe.next();
1945
+ this.ngUnsubscribe.complete();
1906
1946
  }
1907
1947
  };
1908
- TieredMenuNestedComponent.ctorParameters = () => [
1909
- { type: TieredMenuService },
1910
- { type: TieredMenuEventService }
1948
+ BreadcrumbComponent.ctorParameters = () => [
1949
+ { type: ActivatedRoute },
1950
+ { type: Router }
1911
1951
  ];
1912
1952
  __decorate([
1913
- HostListener("window:resize")
1914
- ], TieredMenuNestedComponent.prototype, "onResize", null);
1915
- __decorate([
1916
- HostListener("document:click", ["$event"])
1917
- ], TieredMenuNestedComponent.prototype, "onDocumentClick", null);
1953
+ Input()
1954
+ ], BreadcrumbComponent.prototype, "homeUrl", void 0);
1918
1955
  __decorate([
1919
- HostListener("document:keydown", ["$event"])
1920
- ], TieredMenuNestedComponent.prototype, "onKeydownHandler", null);
1921
- TieredMenuNestedComponent = __decorate([
1956
+ Input()
1957
+ ], BreadcrumbComponent.prototype, "targetHomeUrl", void 0);
1958
+ BreadcrumbComponent = __decorate([
1922
1959
  Component({
1923
- template: "<div\n class=\"menu menu--nested\"\n [ngStyle]=\"{\n 'top': top + 'px',\n 'left': left + 'px'\n }\">\n <ng-container *ngTemplateOutlet=\"itemsTemplate; context: { $implicit: items }\"></ng-container>\n</div>\n\n<ng-template #itemsTemplate let-items>\n <div *ngFor=\"let item of items\">\n <s-tiered-menu-item\n *ngIf=\"item.visible && !item.divider\"\n [item]=\"item\"\n [focused]=\"item === tieredMenuService.currentItem\"\n [closeOnClick]=\"true\">\n </s-tiered-menu-item>\n\n <s-tiered-menu-divider *ngIf=\"item.divider\"></s-tiered-menu-divider>\n\n <div *ngIf=\"item.submenu && item.isOpen\">\n <div class=\"submenu\">\n <ng-container *ngTemplateOutlet=\"itemsTemplate; context: { $implicit: item.submenu }\"></ng-container>\n </div>\n </div>\n </div>\n</ng-template>\n",
1924
- styles: [".menu{background-color:#fff;border:1px solid #ccc;border-radius:6px;box-shadow:0 2px 12px 0 rgba(0,0,0,.1);display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column;min-width:176px;padding:4px 0;position:absolute;z-index:9999;overflow:auto;width:calc(100vw - 8px)}.menu .submenu{margin-left:24px}"]
1960
+ selector: `s-breadcrumb`,
1961
+ template: "<h1 class=\"sds-page-title\">{{title}}</h1>\n<p-breadcrumb [home]=\"home\" [model]=\"items\"></p-breadcrumb>"
1925
1962
  })
1926
- ], TieredMenuNestedComponent);
1963
+ ], BreadcrumbComponent);
1927
1964
 
1928
- var TieredMenuComponent_1;
1929
- let TieredMenuComponent = TieredMenuComponent_1 = class TieredMenuComponent {
1930
- constructor(_appRef, _componentFactoryResolver, _injector, _changeDetectorRef, tieredMenuService, _tieredMenuEventService) {
1931
- this._appRef = _appRef;
1932
- this._componentFactoryResolver = _componentFactoryResolver;
1933
- this._injector = _injector;
1934
- this._changeDetectorRef = _changeDetectorRef;
1935
- this.tieredMenuService = tieredMenuService;
1936
- this._tieredMenuEventService = _tieredMenuEventService;
1937
- this.top = 0;
1938
- this.left = 0;
1939
- this.menuTriggerEvent = "hover";
1940
- this._componentRef = null;
1941
- this._unsubscribe$ = new Subject();
1942
- this.destroyRequest = new EventEmitter();
1943
- }
1944
- onResize() {
1945
- this._tieredMenuEventService.closeAllMenusEvent.emit();
1946
- }
1947
- onDocumentClick(event) {
1948
- // Closing menu when clicked outside.
1949
- const target = event.target;
1950
- const clickedInside = target.closest("s-tiered-menu-item") || target.closest("s-tiered-menu-divider");
1951
- if (!clickedInside) {
1952
- this._tieredMenuEventService.closeAllMenusEvent.emit();
1953
- }
1954
- }
1955
- onKeydownHandler(event) {
1956
- switch (event.key) {
1957
- case "Escape":
1958
- this._tieredMenuEventService.closeAllMenusEvent.emit();
1959
- break;
1960
- case " ":
1961
- case "Enter":
1962
- if (!this.tieredMenuService.currentItem.disabled) {
1963
- this._tieredMenuEventService.selectItemEvent.emit(this.tieredMenuService.currentItem);
1964
- }
1965
- break;
1966
- case "ArrowLeft":
1967
- if (this.items.includes(this.tieredMenuService.currentItem)) {
1968
- this._tieredMenuEventService.closeItemMenuEvent.emit(this.tieredMenuService.currentItem);
1969
- this._changeDetectorRef.detectChanges();
1970
- }
1971
- break;
1972
- case "ArrowRight":
1973
- if (!this.tieredMenuService.currentItem.disabled && this.items.includes(this.tieredMenuService.currentItem)) {
1974
- this._tieredMenuEventService.openItemMenuEvent.emit(this.tieredMenuService.currentItem);
1975
- event.stopImmediatePropagation();
1976
- }
1977
- break;
1978
- case "ArrowUp":
1979
- if (!this.tieredMenuService.currentItem || this.items.includes(this.tieredMenuService.currentItem)) {
1980
- this._tieredMenuEventService.decrementCurrentItemEvent.emit();
1981
- event.stopImmediatePropagation();
1982
- }
1983
- break;
1984
- case "ArrowDown":
1985
- if (!this.tieredMenuService.currentItem || this.items.includes(this.tieredMenuService.currentItem)) {
1986
- this._tieredMenuEventService.incrementCurrentItemEvent.emit();
1987
- event.stopImmediatePropagation();
1988
- }
1989
- break;
1990
- }
1965
+ let BreadcrumbModule = class BreadcrumbModule {
1966
+ };
1967
+ BreadcrumbModule = __decorate([
1968
+ NgModule({
1969
+ imports: [CommonModule, BreadcrumbModule$1, RouterModule],
1970
+ declarations: [BreadcrumbComponent],
1971
+ exports: [BreadcrumbComponent, RouterModule],
1972
+ })
1973
+ ], BreadcrumbModule);
1974
+
1975
+ var ButtonAnimation;
1976
+ (function (ButtonAnimation) {
1977
+ ButtonAnimation["Rotate"] = "rotate";
1978
+ })(ButtonAnimation || (ButtonAnimation = {}));
1979
+
1980
+ var ButtonPriority;
1981
+ (function (ButtonPriority) {
1982
+ ButtonPriority["Default"] = "default";
1983
+ ButtonPriority["Primary"] = "primary";
1984
+ ButtonPriority["Secondary"] = "secondary";
1985
+ ButtonPriority["Link"] = "link";
1986
+ ButtonPriority["Danger"] = "danger";
1987
+ })(ButtonPriority || (ButtonPriority = {}));
1988
+
1989
+ var ButtonSize;
1990
+ (function (ButtonSize) {
1991
+ ButtonSize["Default"] = "default";
1992
+ ButtonSize["Small"] = "small";
1993
+ })(ButtonSize || (ButtonSize = {}));
1994
+
1995
+ var ButtonComponent_1;
1996
+ let ButtonComponent = ButtonComponent_1 = class ButtonComponent {
1997
+ constructor() {
1998
+ this.minWidth = "40px";
1999
+ this.id = `s-button-${ButtonComponent_1.nextId++}`;
2000
+ this.tooltipPosition = "top";
2001
+ this.caret = true;
2002
+ this.baseZIndex = 0;
2003
+ this.disabled = false;
2004
+ this.auxiliary = false;
2005
+ this.type = "button";
2006
+ this.priority = ButtonPriority.Primary;
2007
+ /**
2008
+ * @deprecated Use `menuOptions` instead.
2009
+ */
2010
+ this.model = [];
2011
+ this.menuOptions = [];
2012
+ this.size = ButtonSize.Default;
2013
+ this.onClick = new EventEmitter();
1991
2014
  }
1992
2015
  ngOnInit() {
1993
- this.tieredMenuService.currentItems = this.items;
1994
- this._subscribeEvents();
1995
- disabledScroll();
2016
+ this.onClick.subscribe((event) => {
2017
+ if (!this.model || !this.model.length)
2018
+ return;
2019
+ // TODO: Remover na próxima major.
2020
+ this.menu.model = this.model;
2021
+ this.menu.toggle(event);
2022
+ });
1996
2023
  }
1997
- ngOnDestroy() {
1998
- this._unsubscribe$.next();
1999
- this._unsubscribe$.complete();
2024
+ validateSlideButton() {
2025
+ return this.slide && (this.priority == ButtonPriority.Default || this.priority == ButtonPriority.Link) && this.label.length;
2000
2026
  }
2001
- _incrementCurItem() {
2002
- if (!this.tieredMenuService.currentItem) {
2003
- this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[0];
2004
- return;
2005
- }
2006
- else if (!this.items.includes(this.tieredMenuService.currentItem)) {
2007
- // Checking if it is the current menu.
2008
- return;
2009
- }
2010
- const currentIndex = this.tieredMenuService.currentItems.indexOf(this.tieredMenuService.currentItem) + 1;
2011
- if (currentIndex < this.tieredMenuService.currentItems.length) {
2012
- this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[currentIndex];
2013
- }
2014
- else {
2015
- this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[0];
2016
- }
2017
- if (this.tieredMenuService.currentItem.divider) {
2018
- this._incrementCurItem();
2019
- }
2027
+ // TODO: Remover na próxima major.
2028
+ isOpen() {
2029
+ return this.model && this.model.length && this.menu.visible;
2020
2030
  }
2021
- _decrementCurItem() {
2022
- if (!this.tieredMenuService.currentItem) {
2023
- this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[0];
2024
- return;
2025
- // Checking if it is the current menu.
2026
- }
2027
- else if (!this.items.includes(this.tieredMenuService.currentItem)) {
2028
- return;
2029
- }
2030
- const curIndex = this.tieredMenuService.currentItems.indexOf(this.tieredMenuService.currentItem) - 1;
2031
- if (curIndex >= 0) {
2032
- this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[curIndex];
2033
- }
2034
- else {
2035
- this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[this.tieredMenuService.currentItems.length - 1];
2036
- }
2037
- if (this.tieredMenuService.currentItem.divider) {
2038
- this._decrementCurItem();
2039
- }
2031
+ ngOnChanges(changes) {
2032
+ const hasIcon = this.iconClass;
2033
+ const hasText = this.label;
2034
+ const isMultiple = this.model && this.model.length;
2035
+ if (hasText || (hasIcon && isMultiple))
2036
+ this.minWidth = "80px";
2037
+ if (hasText && hasIcon && isMultiple)
2038
+ this.minWidth = "100px";
2040
2039
  }
2041
- _createMenu(items, position) {
2042
- if (!this._componentRef && items) {
2043
- const componentFactory = this._componentFactoryResolver.resolveComponentFactory(TieredMenuComponent_1);
2044
- this._componentRef = componentFactory.create(this._injector);
2045
- this._appRef.attachView(this._componentRef.hostView);
2046
- const domElem = this._componentRef.hostView.rootNodes[0];
2047
- document.body.appendChild(domElem);
2048
- // Setting the menu items.
2049
- this._componentRef.instance.items = items;
2050
- // Subscribe menu events.
2051
- this._componentRef.instance.destroyRequest.subscribe((propagate) => {
2052
- this._destroy(propagate);
2053
- });
2054
- this._menuDivElement = domElem.querySelector(".menu");
2055
- this._setMenuPosition(position);
2056
- }
2040
+ updateTooltipZIndex() {
2041
+ this.tooltipZIndex = this.baseZIndex + ++DomHandler.zindex;
2057
2042
  }
2058
- _destroy(propagate = true) {
2059
- if (this._componentRef !== null) {
2060
- this._appRef.detachView(this._componentRef.hostView);
2061
- this._componentRef.destroy();
2062
- this._componentRef = null;
2063
- this._menuDivElement = null;
2064
- }
2065
- if (propagate) {
2066
- this.destroyRequest.emit();
2067
- }
2068
- }
2069
- _setMenuPosition(position) {
2070
- var _a, _b;
2071
- const ITEM_HEIGHT = 37;
2072
- const DIVIDER_HEIGHT = 5;
2073
- const PADDING = 8;
2074
- if (this._componentRef !== null) {
2075
- const { top, right, bottom, left } = position;
2076
- const itemsCount = (_a = this._componentRef.instance.items) === null || _a === void 0 ? void 0 : _a.reduce((count, item) => {
2077
- return !item.divider ? count + 1 : count;
2078
- }, 0);
2079
- const dividersCount = (_b = this._componentRef.instance.items) === null || _b === void 0 ? void 0 : _b.reduce((count, item) => {
2080
- return item.divider ? count + 1 : count;
2081
- }, 0);
2082
- // I need to calculate the height of the component because the internal elements have not been created yet.
2083
- const menuHeight = itemsCount * ITEM_HEIGHT + dividersCount * DIVIDER_HEIGHT + PADDING + 8;
2084
- const menuWidth = this._menuDivElement.getBoundingClientRect().width;
2085
- const rightFreeSpace = window.innerWidth - right;
2086
- const bottomFreeSpace = window.innerHeight - bottom;
2087
- if (rightFreeSpace > menuWidth) {
2088
- this._componentRef.instance.left = right;
2089
- }
2090
- else {
2091
- this._componentRef.instance.left = left - menuWidth;
2092
- }
2093
- if (bottomFreeSpace <= menuHeight) {
2094
- this._componentRef.instance.top = Math.max(window.innerHeight - menuHeight, window.scrollY);
2095
- }
2096
- else {
2097
- this._componentRef.instance.top = window.scrollY + top;
2098
- }
2099
- }
2100
- }
2101
- _subscribeEvents() {
2102
- // Increment current item event.
2103
- this._tieredMenuEventService.incrementCurrentItemEvent.pipe(takeUntil(this._unsubscribe$)).subscribe(() => {
2104
- this._incrementCurItem();
2105
- });
2106
- // Decrement current item event.
2107
- this._tieredMenuEventService.decrementCurrentItemEvent.pipe(takeUntil(this._unsubscribe$)).subscribe(() => {
2108
- this._decrementCurItem();
2109
- });
2110
- // Select item event.
2111
- this._tieredMenuEventService.selectItemEvent.pipe(takeUntil(this._unsubscribe$)).subscribe((item) => {
2112
- if (item.submenu) {
2113
- this._tieredMenuEventService.openItemMenuEvent.emit(item);
2114
- }
2115
- else if (item.command) {
2116
- this._tieredMenuEventService.closeAllMenusEvent.emit();
2117
- item.command();
2118
- }
2119
- });
2120
- // Close all menus event.
2121
- this._tieredMenuEventService.closeAllMenusEvent.pipe(takeUntil(this._unsubscribe$)).subscribe(() => {
2122
- this._destroy();
2123
- this.tieredMenuService.currentItem = null;
2124
- this.tieredMenuService.currentItems = this.tieredMenuService.items;
2125
- this.tieredMenuService.markAllItemsAsClosed(this.tieredMenuService.items);
2126
- enableScroll();
2127
- });
2128
- // Open item menu event.
2129
- this._tieredMenuEventService.openItemMenuEvent.pipe(takeUntil(this._unsubscribe$)).subscribe((item) => {
2130
- if (this.tieredMenuService.currentItem) {
2131
- if (this.tieredMenuService.currentItem.parent === item) {
2132
- return;
2133
- }
2134
- if (!this.tieredMenuService.searchTheHierarchy(this.tieredMenuService.currentItem.parent, item)) {
2135
- let current = this.tieredMenuService.currentItem;
2136
- current.isOpen = false;
2137
- while ((current === null || current === void 0 ? void 0 : current.parent) !== item.parent) {
2138
- this._tieredMenuEventService.closeItemMenuEvent.emit(current);
2139
- this._changeDetectorRef.detectChanges();
2140
- current = current.parent;
2141
- }
2142
- if (current) {
2143
- current.isOpen = false;
2144
- }
2145
- }
2146
- }
2147
- if (item.submenu && !item.isOpen && this.items.includes(item)) {
2148
- const { top, right, left, bottom } = document.querySelector(`#${item.id}`).getBoundingClientRect();
2149
- const position = { top, right, left, bottom };
2150
- this._createMenu(item.submenu, position);
2151
- this.tieredMenuService.currentItems = item.submenu;
2152
- this.tieredMenuService.currentItem = item.submenu[0];
2153
- item.isOpen = true;
2154
- }
2155
- });
2156
- // Close item menu event.
2157
- this._tieredMenuEventService.closeItemMenuEvent
2158
- .pipe(takeUntil(this._unsubscribe$))
2159
- .subscribe((item) => {
2160
- var _a, _b;
2161
- if (this.items.some((i) => i.id === item.id)) {
2162
- if (item.parent) {
2163
- item.parent.isOpen = false;
2164
- }
2165
- else {
2166
- enableScroll();
2167
- }
2168
- this.tieredMenuService.currentItems = ((_b = (_a = item === null || item === void 0 ? void 0 : item.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.submenu) || this.tieredMenuService.items;
2169
- this.tieredMenuService.currentItem = item.parent;
2170
- this.destroyRequest.emit(false);
2171
- }
2172
- });
2043
+ isRotateAnimation() {
2044
+ return this.animation === ButtonAnimation.Rotate;
2173
2045
  }
2174
2046
  };
2175
- TieredMenuComponent.ctorParameters = () => [
2176
- { type: ApplicationRef },
2177
- { type: ComponentFactoryResolver },
2178
- { type: Injector },
2179
- { type: ChangeDetectorRef },
2180
- { type: TieredMenuService },
2181
- { type: TieredMenuEventService }
2182
- ];
2047
+ ButtonComponent.nextId = 0;
2183
2048
  __decorate([
2184
- Output()
2185
- ], TieredMenuComponent.prototype, "destroyRequest", void 0);
2049
+ HostBinding("style.min-width")
2050
+ ], ButtonComponent.prototype, "minWidth", void 0);
2186
2051
  __decorate([
2187
- HostListener("window:resize")
2188
- ], TieredMenuComponent.prototype, "onResize", null);
2052
+ Input()
2053
+ ], ButtonComponent.prototype, "id", void 0);
2189
2054
  __decorate([
2190
- HostListener("document:click", ["$event"])
2191
- ], TieredMenuComponent.prototype, "onDocumentClick", null);
2055
+ Input()
2056
+ ], ButtonComponent.prototype, "label", void 0);
2192
2057
  __decorate([
2193
- HostListener("document:keydown", ["$event"])
2194
- ], TieredMenuComponent.prototype, "onKeydownHandler", null);
2195
- TieredMenuComponent = TieredMenuComponent_1 = __decorate([
2058
+ Input()
2059
+ ], ButtonComponent.prototype, "tooltip", void 0);
2060
+ __decorate([
2061
+ Input()
2062
+ ], ButtonComponent.prototype, "tooltipPosition", void 0);
2063
+ __decorate([
2064
+ Input()
2065
+ ], ButtonComponent.prototype, "iconClass", void 0);
2066
+ __decorate([
2067
+ Input()
2068
+ ], ButtonComponent.prototype, "rightIconClass", void 0);
2069
+ __decorate([
2070
+ Input()
2071
+ ], ButtonComponent.prototype, "caret", void 0);
2072
+ __decorate([
2073
+ Input()
2074
+ ], ButtonComponent.prototype, "styleClass", void 0);
2075
+ __decorate([
2076
+ Input()
2077
+ ], ButtonComponent.prototype, "baseZIndex", void 0);
2078
+ __decorate([
2079
+ Input()
2080
+ ], ButtonComponent.prototype, "disabled", void 0);
2081
+ __decorate([
2082
+ Input()
2083
+ ], ButtonComponent.prototype, "auxiliary", void 0);
2084
+ __decorate([
2085
+ Input()
2086
+ ], ButtonComponent.prototype, "type", void 0);
2087
+ __decorate([
2088
+ Input()
2089
+ ], ButtonComponent.prototype, "priority", void 0);
2090
+ __decorate([
2091
+ Input()
2092
+ ], ButtonComponent.prototype, "model", void 0);
2093
+ __decorate([
2094
+ Input()
2095
+ ], ButtonComponent.prototype, "menuOptions", void 0);
2096
+ __decorate([
2097
+ Input()
2098
+ ], ButtonComponent.prototype, "size", void 0);
2099
+ __decorate([
2100
+ Input()
2101
+ ], ButtonComponent.prototype, "slide", void 0);
2102
+ __decorate([
2103
+ Input()
2104
+ ], ButtonComponent.prototype, "animation", void 0);
2105
+ __decorate([
2106
+ Input()
2107
+ ], ButtonComponent.prototype, "badge", void 0);
2108
+ __decorate([
2109
+ Input()
2110
+ ], ButtonComponent.prototype, "iconColor", void 0);
2111
+ __decorate([
2112
+ Output()
2113
+ ], ButtonComponent.prototype, "onClick", void 0);
2114
+ __decorate([
2115
+ ViewChild(TieredMenu, { static: true })
2116
+ ], ButtonComponent.prototype, "menu", void 0);
2117
+ ButtonComponent = ButtonComponent_1 = __decorate([
2196
2118
  Component({
2197
- selector: "s-tiered-menu",
2198
- template: "<div\n class=\"menu\"\n [ngStyle]=\"{\n 'left': left + 'px',\n 'top': top + 'px'\n }\">\n\n <div *ngFor=\"let item of items\">\n <s-tiered-menu-item\n *ngIf=\"item.visible && !item.divider\"\n [item]=\"item\"\n [focused]=\"item === tieredMenuService.currentItem\"\n [highlight]=\"item.isOpen\"\n triggerEvent=\"hover\"\n [closeOnClick]=\"false\">\n </s-tiered-menu-item>\n <s-tiered-menu-divider *ngIf=\"item.divider\"></s-tiered-menu-divider>\n </div>\n</div>",
2199
- styles: [".menu{background-color:#fff;border:1px solid #ccc;border-radius:6px;box-shadow:0 2px 12px 0 rgba(0,0,0,.1);display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column;max-height:100vh;min-width:176px;padding:4px 0;overflow-y:auto;position:absolute;z-index:9999}"]
2119
+ selector: "s-button",
2120
+ template: "<!-- Remover na pr\u00F3xima major. -->\n<p-tieredMenu\n [id]=\"id + '-menu'\"\n [popup]=\"true\"\n appendTo=\"body\"\n [baseZIndex]=\"baseZIndex\">\n</p-tieredMenu>\n\n<button\n [id]=\"id\"\n [type]=\"type\"\n [class]=\"styleClass\"\n [ngClass]=\"{\n 's-button-auxiliary': auxiliary,\n 's-button-with-icon': iconClass,\n 's-button-with-text': label,\n 's-button-empty': !iconClass && !label,\n 's-button-size-default': size === 'default',\n 's-button-size-small': size === 'small',\n 's-button-priority-default': priority === 'default',\n 's-button-priority-primary': priority === 'primary',\n 's-button-priority-secondary': priority === 'secondary',\n 's-button-priority-link': priority === 'link',\n 's-button-priority-danger': priority === 'danger',\n 's-button-multiple': (caret && (model && model.length)) || rightIconClass,\n 's-button-active': isOpen(),\n 's-button--slide': validateSlideButton(),\n 's-button--rotate-animation': isRotateAnimation()\n }\"\n sTieredMenu\n [items]=\"menuOptions\"\n [disabled]=\"disabled\"\n [sTooltip]=\"tooltip\"\n [tooltipPosition]=\"tooltipPosition\"\n [showDelay]=\"500\"\n (click)=\"onClick.emit($event)\"\n (mouseenter)=\"updateTooltipZIndex()\">\n <div *ngIf=\"badge\" class=\"badge\">\n <s-badge\n [color]=\"badge.color\"\n [text]=\"badge.text\"\n [iconClass]=\"badge.iconClass\">\n </s-badge>\n </div>\n <span \n *ngIf=\"iconClass\" \n [class]=\"iconClass\" \n [ngClass]=\"{ \n 's-button-icon': true,\n 's-button-icon-margin-right': !label && model && model.length\n }\"\n [ngStyle]=\"{ color: iconColor }\"\n aria-hidden=\"true\">\n </span>\n <span \n *ngIf=\"label\" \n class=\"s-button-text\"\n [ngClass]=\"{\n 's-button-icon-margin-right': !!rightIconClass || (model && model.length),\n 's-button-icon-margin-left': !!iconClass\n }\">\n {{ label }}\n </span>\n <ng-content></ng-content>\n <span \n *ngIf=\"rightIconClass\" \n [class]=\"rightIconClass\" \n [ngClass]=\"{ 's-button-right-icon': true }\"\n [ngStyle]=\"{ color: iconColor }\"\n aria-hidden=\"true\">\n </span>\n <span\n *ngIf=\"caret && (model && model.length) || (menuOptions && menuOptions.length)\" \n class=\"fa fa-fw fa-caret-down\"\n aria-hidden=\"true\">\n </span>\n</button>\n",
2121
+ styles: [":host{display:inline-block}button{-ms-flex-align:center;align-items:center;border:1px solid;border-radius:4px;cursor:pointer;display:-ms-inline-flexbox;display:inline-flex;font-family:\"Open Sans\",sans-serif;font-size:14px;height:35px;-ms-flex-pack:center;justify-content:center;max-width:100%;min-width:40px;outline:0;overflow:visible;padding:5px 10px;position:relative;text-decoration:none;text-transform:none;transition:background-color .2s ease-out,color .2s ease-out,border-color .2s ease-out}button:disabled{opacity:.5;filter:Alpha(Opacity=50);background-image:none}button:disabled,button:disabled *{cursor:text!important}button.s-button-auxiliary{border-radius:20px}button.s-button-size-small{height:25px;padding:0 20px}button.s-button-size-default{height:35px}button.s-button-with-icon.s-button-multiple,button.s-button-with-text{min-width:80px}button.s-button-with-icon.s-button-with-text.s-button-multiple{min-width:100px}button .s-button-icon,button .s-button-menu-icon,button .s-button-right-icon,button.s-button-with-icon.s-button-multiple:not(.s-button-with-text) .s-button-icon{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}button.s-button-multiple .s-button-text{-ms-flex-align:left;align-items:left;display:-ms-flexbox;display:flex;-ms-flex-pack:left;justify-content:left}button.s-button-with-icon .s-button-text{-ms-flex-align:right;align-items:right;display:-ms-flexbox;display:flex;-ms-flex-pack:right;justify-content:right}.s-button-text{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.s-button-menu-icon{right:10px;transition:transform .2s ease-out}.s-button-icon-margin-left{margin-left:10px}.s-button-icon-margin-right{margin-right:10px}.s-button-active .s-button-menu-icon{transform:rotateX(180deg)}button,button.s-button-priority-primary{background-color:#428bca;border-color:#428bca}button .s-button-icon,button .s-button-menu-icon,button .s-button-right-icon,button .s-button-text,button.s-button-priority-primary .s-button-icon,button.s-button-priority-primary .s-button-menu-icon,button.s-button-priority-primary .s-button-right-icon,button.s-button-priority-primary .s-button-text{color:#fff}button.s-button-priority-primary:hover,button:hover{background-color:#2a6496}button.s-button-priority-primary:focus,button:focus{background-color:#2a6496;border-color:#22dce6}button.s-button-active:not(:disabled),button.s-button-priority-primary.s-button-active:not(:disabled),button.s-button-priority-primary:active:not(:disabled),button:active:not(:disabled){background-color:#245682;border-color:#245682}button.s-button-priority-secondary{background-color:#7892a1;border-color:#7892a1}button.s-button-priority-secondary .s-button-icon,button.s-button-priority-secondary .s-button-menu-icon,button.s-button-priority-secondary .s-button-right-icon,button.s-button-priority-secondary .s-button-text{color:#fff}button.s-button-priority-secondary:hover{background-color:#546b79}button.s-button-priority-secondary:focus{background-color:#546b79;border-color:#22dce6}button.s-button-priority-secondary.s-button-active:not(:disabled),button.s-button-priority-secondary:active:not(:disabled){background-color:#495e6a;border-color:#495e6a}button.s-button-priority-default{background-color:#fff;border-color:#ccc}button.s-button-priority-default .s-button-icon,button.s-button-priority-default .s-button-menu-icon,button.s-button-priority-default .s-button-right-icon,button.s-button-priority-default .s-button-text{color:#333}button.s-button-priority-default:hover{background-color:#d9d9d9}button.s-button-priority-default:focus{background-color:#d9d9d9;border-color:#22dce6}button.s-button-priority-default.s-button-active:not(:disabled),button.s-button-priority-default:active:not(:disabled){background-color:#ccc;border-color:#ccc}.s-button-priority-danger{background-color:#9c3a3a;border-color:#9c3a3a}.s-button-priority-danger .s-button-icon,.s-button-priority-danger .s-button-menu-icon,.s-button-priority-danger .s-button-right-icon,.s-button-priority-danger .s-button-text{color:#fff}.s-button-priority-danger:hover{background-color:#642525}.s-button-priority-danger:focus{background-color:#642525;border-color:#22dce6}.s-button-priority-danger.s-button-active:not(:disabled),.s-button-priority-danger:active:not(:disabled){background-color:#521e1e;border-color:#521e1e}button.s-button-priority-link{background-color:transparent;border-color:transparent}button.s-button-priority-link .s-button-icon,button.s-button-priority-link .s-button-menu-icon,button.s-button-priority-link .s-button-right-icon,button.s-button-priority-link .s-button-text{color:#428bca}button.s-button-priority-link:hover{background-color:transparent}button.s-button-priority-link:hover .s-button-icon,button.s-button-priority-link:hover .s-button-menu-icon,button.s-button-priority-link:hover .s-button-right-icon,button.s-button-priority-link:hover .s-button-text{color:#2a6496}button.s-button-priority-link:focus{border-color:#22dce6;background-color:transparent}button.s-button-priority-link:focus .s-button-icon,button.s-button-priority-link:focus .s-button-menu-icon,button.s-button-priority-link:focus .s-button-right-icon,button.s-button-priority-link:focus .s-button-text{color:#2a6496}button.s-button-priority-link.s-button-active:not(:disabled),button.s-button-priority-link:active:not(:disabled){background-color:transparent;border-color:transparent}button.s-button-priority-link.s-button-active:not(:disabled) .s-button-icon,button.s-button-priority-link.s-button-active:not(:disabled) .s-button-menu-icon,button.s-button-priority-link.s-button-active:not(:disabled) .s-button-right-icon,button.s-button-priority-link.s-button-active:not(:disabled) .s-button-text,button.s-button-priority-link:active:not(:disabled) .s-button-icon,button.s-button-priority-link:active:not(:disabled) .s-button-menu-icon,button.s-button-priority-link:active:not(:disabled) .s-button-right-icon,button.s-button-priority-link:active:not(:disabled) .s-button-text{color:#245682}.s-button--slide.s-button-with-icon.s-button-multiple,.s-button--slide.s-button-with-text{min-width:40px}.s-button--slide .s-button-text{position:absolute;opacity:0;width:0}.s-button--slide:hover .s-button-text{opacity:1;position:relative;transition:1s;width:auto}.s-button--slide:hover.s-button--rotate-animation .s-button-icon,.s-button--slide:hover.s-button--rotate-animation .s-button-right-icon{transform:rotate(360deg);transition:1.5s}.badge{position:absolute;top:-10px;right:-10px;z-index:99}"]
2200
2122
  })
2201
- ], TieredMenuComponent);
2123
+ ], ButtonComponent);
2202
2124
 
2203
- let TieredMenuGlobalService = class TieredMenuGlobalService {
2125
+ let TieredMenuDividerComponent = class TieredMenuDividerComponent {
2204
2126
  };
2205
- TieredMenuGlobalService = __decorate([
2127
+ TieredMenuDividerComponent = __decorate([
2128
+ Component({
2129
+ selector: "s-tiered-menu-divider",
2130
+ template: "<div class=\"divider\"></div>",
2131
+ styles: [".divider{margin:2px 0;height:1px;background-color:#ccc}"]
2132
+ })
2133
+ ], TieredMenuDividerComponent);
2134
+
2135
+ let TieredMenuEventService = class TieredMenuEventService {
2136
+ constructor() {
2137
+ this.incrementCurrentItemEvent = new EventEmitter();
2138
+ this.decrementCurrentItemEvent = new EventEmitter();
2139
+ this.closeAllMenusEvent = new EventEmitter();
2140
+ this.selectItemEvent = new EventEmitter();
2141
+ this.openItemMenuEvent = new EventEmitter();
2142
+ this.closeItemMenuEvent = new EventEmitter();
2143
+ this.createMenuEvent = new EventEmitter();
2144
+ }
2145
+ };
2146
+ TieredMenuEventService = __decorate([
2206
2147
  Injectable()
2207
- ], TieredMenuGlobalService);
2148
+ ], TieredMenuEventService);
2208
2149
 
2209
- let TieredMenuDirective = class TieredMenuDirective {
2210
- constructor(_elementRef, _appRef, _componentFactoryResolver, _injector, _tieredMenuEventService, _tieredMenuService, _tieredMenuGlobalService, _changeDetectorRef) {
2211
- this._elementRef = _elementRef;
2212
- this._appRef = _appRef;
2213
- this._componentFactoryResolver = _componentFactoryResolver;
2214
- this._injector = _injector;
2150
+ let TieredMenuItemComponent = class TieredMenuItemComponent {
2151
+ constructor(_tieredMenuEventService) {
2215
2152
  this._tieredMenuEventService = _tieredMenuEventService;
2216
- this._tieredMenuService = _tieredMenuService;
2217
- this._tieredMenuGlobalService = _tieredMenuGlobalService;
2218
- this._changeDetectorRef = _changeDetectorRef;
2219
- this.focusedItem = undefined;
2153
+ this.focused = false;
2154
+ this.highlight = false;
2220
2155
  this.triggerEvent = "click";
2221
- this._componentRef = null;
2222
- this._isNested = false;
2223
- this._isOpen = false;
2224
- this._unsubscribe$ = new Subject();
2156
+ this.closeOnClick = false;
2225
2157
  }
2226
- ngOnInit() {
2227
- var _a;
2228
- this._itemsAreValid = !!((_a = this.items) === null || _a === void 0 ? void 0 : _a.length);
2229
- if (!this._itemsAreValid)
2158
+ onClick() {
2159
+ if (this.item.disabled)
2230
2160
  return;
2231
- this._subscribeEvents();
2161
+ if (this.item.submenu) {
2162
+ if (!this.item.isOpen) {
2163
+ this._tieredMenuEventService.openItemMenuEvent.emit(this.item);
2164
+ }
2165
+ else if (this.closeOnClick) {
2166
+ this._tieredMenuEventService.closeItemMenuEvent.emit(this.item);
2167
+ }
2168
+ }
2169
+ else {
2170
+ this._tieredMenuEventService.selectItemEvent.emit(this.item);
2171
+ }
2232
2172
  }
2233
- ngDoCheck() {
2234
- if (!this._itemsAreValid)
2173
+ onMouseEnter() {
2174
+ if (this.item.disabled)
2235
2175
  return;
2236
- if (!this._previousItems) {
2237
- this._previousItems = this._tieredMenuService.cloneItems(this.items);
2176
+ if (this.triggerEvent === "hover" && !this.item.isOpen) {
2177
+ this._showTimeout = window.setTimeout(() => {
2178
+ this._tieredMenuEventService.openItemMenuEvent.emit(this.item);
2179
+ }, 300);
2238
2180
  }
2239
- let hasChanges = false;
2240
- if (this.items.length !== this._previousItems.length) {
2241
- hasChanges = true;
2242
- }
2243
- else {
2244
- for (let i = 0; i < this.items.length; i++) {
2245
- if (!this._compareItems(this.items[i], this._previousItems[i])) {
2246
- hasChanges = true;
2247
- break;
2248
- }
2181
+ }
2182
+ onMouseLeave() {
2183
+ window.clearTimeout(this._showTimeout);
2184
+ }
2185
+ };
2186
+ TieredMenuItemComponent.ctorParameters = () => [
2187
+ { type: TieredMenuEventService }
2188
+ ];
2189
+ __decorate([
2190
+ Input()
2191
+ ], TieredMenuItemComponent.prototype, "item", void 0);
2192
+ __decorate([
2193
+ Input()
2194
+ ], TieredMenuItemComponent.prototype, "focused", void 0);
2195
+ __decorate([
2196
+ Input()
2197
+ ], TieredMenuItemComponent.prototype, "highlight", void 0);
2198
+ __decorate([
2199
+ Input()
2200
+ ], TieredMenuItemComponent.prototype, "triggerEvent", void 0);
2201
+ __decorate([
2202
+ Input()
2203
+ ], TieredMenuItemComponent.prototype, "closeOnClick", void 0);
2204
+ __decorate([
2205
+ HostListener("click"),
2206
+ HostListener("touchend")
2207
+ ], TieredMenuItemComponent.prototype, "onClick", null);
2208
+ __decorate([
2209
+ HostListener("mouseenter")
2210
+ ], TieredMenuItemComponent.prototype, "onMouseEnter", null);
2211
+ __decorate([
2212
+ HostListener("mouseleave")
2213
+ ], TieredMenuItemComponent.prototype, "onMouseLeave", null);
2214
+ TieredMenuItemComponent = __decorate([
2215
+ Component({
2216
+ selector: "s-tiered-menu-item",
2217
+ template: "<div\n [id]=\"item.id\"\n class=\"tiered-menu-item\"\n [ngClass]=\"{\n 'tiered-menu-item--open': item.isOpen,\n 'tiered-menu-item--focused': focused,\n 'tiered-menu-item--disabled': item.disabled\n }\">\n <div class=\"tiered-menu-item-content\">\n <span class=\"icon\" [ngClass]=\"item.iconClass\"></span>\n <span class=\"label\">{{ item.label }}</span>\n </div>\n <span\n *ngIf=\"item.submenu\"\n class=\"submenu-icon\"\n [ngClass]=\"{\n 'fas': true,\n 'fa-chevron-left': item.isOpen,\n 'fa-chevron-right': !item.isOpen\n }\">\n </span>\n</div>",
2218
+ styles: [".tiered-menu-item{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;padding:8px 16px;-webkit-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}.tiered-menu-item .tiered-menu-item-content .label{margin:0 12px}.tiered-menu-item:hover{background-color:#e9e6e6}.tiered-menu-item--focused{background-color:#ccc!important}.tiered-menu-item--open{background-color:#e4e2e2}.tiered-menu-item--disabled{opacity:50%;cursor:default}"]
2219
+ })
2220
+ ], TieredMenuItemComponent);
2221
+
2222
+ let TieredMenuService = class TieredMenuService {
2223
+ constructor() {
2224
+ this.currentItems = [];
2225
+ this.items = [];
2226
+ }
2227
+ normalizeData(items, parent) {
2228
+ return items.map((i) => {
2229
+ const item = Object.assign({ visible: true }, i);
2230
+ if (item.submenu) {
2231
+ item.submenu = this.normalizeData(item.submenu, item);
2232
+ }
2233
+ item.id = this._generateId();
2234
+ item.parent = parent;
2235
+ item.isOpen = false;
2236
+ return item;
2237
+ });
2238
+ }
2239
+ markAllItemsAsClosed(items) {
2240
+ return items.map((i) => {
2241
+ const item = Object.assign({}, i);
2242
+ if (item.submenu) {
2243
+ item.submenu = this.markAllItemsAsClosed(item.submenu);
2244
+ }
2245
+ item.isOpen = false;
2246
+ return item;
2247
+ });
2248
+ }
2249
+ searchTheHierarchy(itemA, itemB) {
2250
+ let item = itemB;
2251
+ while (item) {
2252
+ if (item === itemA) {
2253
+ return true;
2249
2254
  }
2255
+ item = item.parent;
2250
2256
  }
2251
- if (hasChanges) {
2252
- this._updateServiceItems();
2253
- this._changeDetectorRef.detectChanges();
2254
- this._rebuildMenu();
2257
+ return false;
2258
+ }
2259
+ cloneItems(items) {
2260
+ return JSON.parse(JSON.stringify(items));
2261
+ }
2262
+ _generateId() {
2263
+ return `id-${Math.random().toString(36).substring(2, 9)}-${Math.random().toString(36).substring(2, 9)}-${Math.random().toString(36).substring(2, 9)}`;
2264
+ }
2265
+ };
2266
+ TieredMenuService = __decorate([
2267
+ Injectable()
2268
+ ], TieredMenuService);
2269
+
2270
+ const enableScroll = () => {
2271
+ document.body.style.overflow = "auto";
2272
+ };
2273
+ const disabledScroll = () => {
2274
+ document.body.style.overflow = "hidden";
2275
+ };
2276
+
2277
+ let TieredMenuNestedComponent = class TieredMenuNestedComponent {
2278
+ constructor(tieredMenuService, _tieredMenuEventService) {
2279
+ this.tieredMenuService = tieredMenuService;
2280
+ this._tieredMenuEventService = _tieredMenuEventService;
2281
+ this.top = 0;
2282
+ this.left = 0;
2283
+ this._unsubscribe$ = new Subject();
2284
+ }
2285
+ onResize() {
2286
+ this._tieredMenuEventService.closeAllMenusEvent.emit();
2287
+ }
2288
+ onDocumentClick(event) {
2289
+ // Closing menu when clicked outside.
2290
+ const target = event.target;
2291
+ const clickedInside = target.closest("s-tiered-menu-item") || target.closest("s-tiered-menu-divider");
2292
+ if (!clickedInside) {
2293
+ this._tieredMenuEventService.closeAllMenusEvent.emit();
2255
2294
  }
2256
- this._previousItems = this._tieredMenuService.cloneItems(this.items);
2295
+ }
2296
+ onKeydownHandler(event) {
2297
+ switch (event.key) {
2298
+ case "Escape":
2299
+ this._tieredMenuEventService.closeAllMenusEvent.emit();
2300
+ break;
2301
+ case " ":
2302
+ case "Enter":
2303
+ this._tieredMenuEventService.selectItemEvent.emit(this.tieredMenuService.currentItem);
2304
+ break;
2305
+ case "ArrowLeft":
2306
+ // When nested I need a reference to the current item's parent item, otherwise just the current item.
2307
+ this._tieredMenuEventService.closeItemMenuEvent.emit(this.tieredMenuService.currentItem.parent);
2308
+ break;
2309
+ case "ArrowRight":
2310
+ this._tieredMenuEventService.openItemMenuEvent.emit(this.tieredMenuService.currentItem);
2311
+ break;
2312
+ case "ArrowUp":
2313
+ this._tieredMenuEventService.decrementCurrentItemEvent.emit();
2314
+ break;
2315
+ case "ArrowDown":
2316
+ this._tieredMenuEventService.incrementCurrentItemEvent.emit();
2317
+ break;
2318
+ }
2319
+ }
2320
+ ngOnInit() {
2321
+ this.tieredMenuService.currentItems = this.items;
2322
+ this._subscribeEvents();
2323
+ disabledScroll();
2257
2324
  }
2258
2325
  ngOnDestroy() {
2259
- if (!this._itemsAreValid)
2260
- return;
2261
2326
  this._unsubscribe$.next();
2262
2327
  this._unsubscribe$.complete();
2263
- this._destroy();
2328
+ enableScroll();
2264
2329
  }
2265
- onClick(event) {
2266
- if (!this._itemsAreValid)
2330
+ _incrementCurItem() {
2331
+ if (!this.tieredMenuService.currentItem) {
2332
+ this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[0];
2267
2333
  return;
2268
- if (this.triggerEvent === "click" && !this._isOpen) {
2269
- this._lastActiveElement = document.activeElement;
2270
- this._createMenu();
2271
- event.preventDefault();
2272
- event.stopPropagation();
2273
2334
  }
2274
- }
2275
- _createMenu() {
2276
- var _a, _b, _c;
2277
- this._updateServiceItems();
2278
- if (!this._componentRef && ((_a = this._tieredMenuService.items) === null || _a === void 0 ? void 0 : _a.length) > 0) {
2279
- (_b = this._tieredMenuGlobalService.lastInstance) === null || _b === void 0 ? void 0 : _b._destroy();
2280
- this._tieredMenuGlobalService.lastInstance = this;
2281
- (_c = this._lastActiveElement) === null || _c === void 0 ? void 0 : _c.blur();
2282
- this._isOpen = true;
2283
- this._isNested = document.body.clientWidth < 600;
2284
- this._isNested ? this._createNestedMenu() : this._createTieredMenu();
2335
+ const curIndex = this.tieredMenuService.currentItems.indexOf(this.tieredMenuService.currentItem) + 1;
2336
+ if (curIndex < this.tieredMenuService.currentItems.length) {
2337
+ this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[curIndex];
2338
+ }
2339
+ else {
2340
+ this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[0];
2341
+ }
2342
+ if (this.tieredMenuService.currentItem.divider) {
2343
+ this._incrementCurItem();
2285
2344
  }
2286
2345
  }
2287
- _createTieredMenu() {
2288
- var _a;
2289
- if (!this._componentRef && ((_a = this._tieredMenuService.items) === null || _a === void 0 ? void 0 : _a.length) > 0) {
2290
- const componentFactory = this._componentFactoryResolver.resolveComponentFactory(TieredMenuComponent);
2291
- this._componentRef = componentFactory.create(this._injector);
2292
- this._appRef.attachView(this._componentRef.hostView);
2293
- const domElem = this._componentRef.hostView.rootNodes[0];
2294
- document.body.appendChild(domElem);
2295
- this._setMenuComponentProperties();
2296
- this._componentRef.instance.destroyRequest.pipe(takeUntil(this._unsubscribe$)).subscribe(() => {
2297
- this._destroy();
2298
- });
2299
- this._setMenuPosition();
2346
+ _decrementCurItem() {
2347
+ if (!this.tieredMenuService.currentItem) {
2348
+ this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[0];
2349
+ return;
2350
+ }
2351
+ const curIndex = this.tieredMenuService.currentItems.indexOf(this.tieredMenuService.currentItem) - 1;
2352
+ if (curIndex >= 0) {
2353
+ this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[curIndex];
2354
+ }
2355
+ else {
2356
+ this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[this.tieredMenuService.currentItems.length - 1];
2357
+ }
2358
+ if (this.tieredMenuService.currentItem.divider) {
2359
+ this._decrementCurItem();
2300
2360
  }
2301
2361
  }
2302
- _createNestedMenu() {
2362
+ _closeItem(item) {
2303
2363
  var _a;
2304
- if (!this._componentRef && ((_a = this._tieredMenuService.items) === null || _a === void 0 ? void 0 : _a.length) > 0) {
2305
- const componentFactory = this._componentFactoryResolver.resolveComponentFactory(TieredMenuNestedComponent);
2306
- this._componentRef = componentFactory.create(this._injector);
2307
- this._appRef.attachView(this._componentRef.hostView);
2308
- const domElem = this._componentRef.hostView.rootNodes[0];
2309
- document.body.appendChild(domElem);
2310
- this._setMenuComponentProperties();
2311
- this._setMenuPosition();
2364
+ let itemAux = this._lastOpenItem;
2365
+ while (itemAux && itemAux != item) {
2366
+ itemAux.isOpen = false;
2367
+ itemAux = itemAux.parent;
2312
2368
  }
2369
+ item.isOpen = false;
2370
+ this.tieredMenuService.currentItem = itemAux !== null && itemAux !== void 0 ? itemAux : this.tieredMenuService.items[0];
2371
+ this.tieredMenuService.currentItems = ((_a = itemAux === null || itemAux === void 0 ? void 0 : itemAux.parent) === null || _a === void 0 ? void 0 : _a.submenu) || this.tieredMenuService.items;
2313
2372
  }
2314
- _destroy() {
2315
- if (this._componentRef) {
2316
- this._isOpen = false;
2317
- window.clearTimeout(this._showTimeout);
2318
- this._appRef.detachView(this._componentRef.hostView);
2319
- this._componentRef.destroy();
2320
- this._componentRef = null;
2321
- this._tieredMenuService.currentItems = this._tieredMenuService.items;
2322
- this._tieredMenuService.currentItem = this._tieredMenuService.items[0];
2323
- this._tieredMenuEventService.closeAllMenusEvent.emit();
2373
+ _openItem(item) {
2374
+ if (item === null || item === void 0 ? void 0 : item.submenu) {
2375
+ item.isOpen = true;
2376
+ this.tieredMenuService.currentItems = item.submenu;
2377
+ // Only has focus if there has already been interaction.
2378
+ if (this.tieredMenuService.currentItem) {
2379
+ this.tieredMenuService.currentItem = item.submenu[0];
2380
+ }
2381
+ this._lastOpenItem = item;
2324
2382
  }
2325
2383
  }
2326
- _setMenuPosition() {
2327
- var _a, _b;
2328
- const ITEM_HEIGHT = 37;
2329
- const ITEM_WIDTH = 176;
2330
- const DIVIDER_HEIGHT = 5;
2384
+ _subscribeEvents() {
2385
+ this._tieredMenuEventService.incrementCurrentItemEvent
2386
+ .pipe(takeUntil(this._unsubscribe$))
2387
+ .subscribe(() => {
2388
+ this._incrementCurItem();
2389
+ });
2390
+ this._tieredMenuEventService.decrementCurrentItemEvent
2391
+ .pipe(takeUntil(this._unsubscribe$))
2392
+ .subscribe(() => {
2393
+ this._decrementCurItem();
2394
+ });
2395
+ this._tieredMenuEventService.selectItemEvent
2396
+ .pipe(takeUntil(this._unsubscribe$))
2397
+ .subscribe((item) => {
2398
+ if (item.command) {
2399
+ item.command();
2400
+ // Close all menus after the item was selected.
2401
+ this._tieredMenuEventService.closeAllMenusEvent.emit();
2402
+ }
2403
+ });
2404
+ this._tieredMenuEventService.openItemMenuEvent
2405
+ .pipe(takeUntil(this._unsubscribe$))
2406
+ .subscribe((item) => {
2407
+ var _a, _b;
2408
+ if (!this.tieredMenuService.currentItems.includes(item)) {
2409
+ let itemAux = this._lastOpenItem;
2410
+ while ((_a = itemAux === null || itemAux === void 0 ? void 0 : itemAux.parent) === null || _a === void 0 ? void 0 : _a.parent) {
2411
+ itemAux = itemAux.parent;
2412
+ }
2413
+ this._tieredMenuEventService.closeItemMenuEvent.emit((_b = itemAux.parent) !== null && _b !== void 0 ? _b : itemAux);
2414
+ }
2415
+ this._lastOpenItem = item;
2416
+ this._openItem(item);
2417
+ });
2418
+ this._tieredMenuEventService.closeItemMenuEvent
2419
+ .pipe(takeUntil(this._unsubscribe$))
2420
+ .subscribe((item) => {
2421
+ if (item) {
2422
+ this._closeItem(item);
2423
+ }
2424
+ });
2425
+ }
2426
+ };
2427
+ TieredMenuNestedComponent.ctorParameters = () => [
2428
+ { type: TieredMenuService },
2429
+ { type: TieredMenuEventService }
2430
+ ];
2431
+ __decorate([
2432
+ HostListener("window:resize")
2433
+ ], TieredMenuNestedComponent.prototype, "onResize", null);
2434
+ __decorate([
2435
+ HostListener("document:click", ["$event"])
2436
+ ], TieredMenuNestedComponent.prototype, "onDocumentClick", null);
2437
+ __decorate([
2438
+ HostListener("document:keydown", ["$event"])
2439
+ ], TieredMenuNestedComponent.prototype, "onKeydownHandler", null);
2440
+ TieredMenuNestedComponent = __decorate([
2441
+ Component({
2442
+ template: "<div\n class=\"menu menu--nested\"\n [ngStyle]=\"{\n 'top': top + 'px',\n 'left': left + 'px'\n }\">\n <ng-container *ngTemplateOutlet=\"itemsTemplate; context: { $implicit: items }\"></ng-container>\n</div>\n\n<ng-template #itemsTemplate let-items>\n <div *ngFor=\"let item of items\">\n <s-tiered-menu-item\n *ngIf=\"item.visible && !item.divider\"\n [item]=\"item\"\n [focused]=\"item === tieredMenuService.currentItem\"\n [closeOnClick]=\"true\">\n </s-tiered-menu-item>\n\n <s-tiered-menu-divider *ngIf=\"item.divider\"></s-tiered-menu-divider>\n\n <div *ngIf=\"item.submenu && item.isOpen\">\n <div class=\"submenu\">\n <ng-container *ngTemplateOutlet=\"itemsTemplate; context: { $implicit: item.submenu }\"></ng-container>\n </div>\n </div>\n </div>\n</ng-template>\n",
2443
+ styles: [".menu{background-color:#fff;border:1px solid #ccc;border-radius:6px;box-shadow:0 2px 12px 0 rgba(0,0,0,.1);display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column;min-width:176px;padding:4px 0;position:absolute;z-index:9999;overflow:auto;width:calc(100vw - 8px)}.menu .submenu{margin-left:24px}"]
2444
+ })
2445
+ ], TieredMenuNestedComponent);
2446
+
2447
+ var TieredMenuComponent_1;
2448
+ let TieredMenuComponent = TieredMenuComponent_1 = class TieredMenuComponent {
2449
+ constructor(_appRef, _componentFactoryResolver, _injector, _changeDetectorRef, tieredMenuService, _tieredMenuEventService) {
2450
+ this._appRef = _appRef;
2451
+ this._componentFactoryResolver = _componentFactoryResolver;
2452
+ this._injector = _injector;
2453
+ this._changeDetectorRef = _changeDetectorRef;
2454
+ this.tieredMenuService = tieredMenuService;
2455
+ this._tieredMenuEventService = _tieredMenuEventService;
2456
+ this.top = 0;
2457
+ this.left = 0;
2458
+ this.menuTriggerEvent = "hover";
2459
+ this._componentRef = null;
2460
+ this._unsubscribe$ = new Subject();
2461
+ this.destroyRequest = new EventEmitter();
2462
+ }
2463
+ onResize() {
2464
+ this._tieredMenuEventService.closeAllMenusEvent.emit();
2465
+ }
2466
+ onDocumentClick(event) {
2467
+ // Closing menu when clicked outside.
2468
+ const target = event.target;
2469
+ const clickedInside = target.closest("s-tiered-menu-item") || target.closest("s-tiered-menu-divider");
2470
+ if (!clickedInside) {
2471
+ this._tieredMenuEventService.closeAllMenusEvent.emit();
2472
+ }
2473
+ }
2474
+ onKeydownHandler(event) {
2475
+ switch (event.key) {
2476
+ case "Escape":
2477
+ this._tieredMenuEventService.closeAllMenusEvent.emit();
2478
+ break;
2479
+ case " ":
2480
+ case "Enter":
2481
+ if (!this.tieredMenuService.currentItem.disabled) {
2482
+ this._tieredMenuEventService.selectItemEvent.emit(this.tieredMenuService.currentItem);
2483
+ }
2484
+ break;
2485
+ case "ArrowLeft":
2486
+ if (this.items.includes(this.tieredMenuService.currentItem)) {
2487
+ this._tieredMenuEventService.closeItemMenuEvent.emit(this.tieredMenuService.currentItem);
2488
+ this._changeDetectorRef.detectChanges();
2489
+ }
2490
+ break;
2491
+ case "ArrowRight":
2492
+ if (!this.tieredMenuService.currentItem.disabled && this.items.includes(this.tieredMenuService.currentItem)) {
2493
+ this._tieredMenuEventService.openItemMenuEvent.emit(this.tieredMenuService.currentItem);
2494
+ event.stopImmediatePropagation();
2495
+ }
2496
+ break;
2497
+ case "ArrowUp":
2498
+ if (!this.tieredMenuService.currentItem || this.items.includes(this.tieredMenuService.currentItem)) {
2499
+ this._tieredMenuEventService.decrementCurrentItemEvent.emit();
2500
+ event.stopImmediatePropagation();
2501
+ }
2502
+ break;
2503
+ case "ArrowDown":
2504
+ if (!this.tieredMenuService.currentItem || this.items.includes(this.tieredMenuService.currentItem)) {
2505
+ this._tieredMenuEventService.incrementCurrentItemEvent.emit();
2506
+ event.stopImmediatePropagation();
2507
+ }
2508
+ break;
2509
+ }
2510
+ }
2511
+ ngOnInit() {
2512
+ this.tieredMenuService.currentItems = this.items;
2513
+ this._subscribeEvents();
2514
+ disabledScroll();
2515
+ }
2516
+ ngOnDestroy() {
2517
+ this._unsubscribe$.next();
2518
+ this._unsubscribe$.complete();
2519
+ }
2520
+ _incrementCurItem() {
2521
+ if (!this.tieredMenuService.currentItem) {
2522
+ this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[0];
2523
+ return;
2524
+ }
2525
+ else if (!this.items.includes(this.tieredMenuService.currentItem)) {
2526
+ // Checking if it is the current menu.
2527
+ return;
2528
+ }
2529
+ const currentIndex = this.tieredMenuService.currentItems.indexOf(this.tieredMenuService.currentItem) + 1;
2530
+ if (currentIndex < this.tieredMenuService.currentItems.length) {
2531
+ this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[currentIndex];
2532
+ }
2533
+ else {
2534
+ this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[0];
2535
+ }
2536
+ if (this.tieredMenuService.currentItem.divider) {
2537
+ this._incrementCurItem();
2538
+ }
2539
+ }
2540
+ _decrementCurItem() {
2541
+ if (!this.tieredMenuService.currentItem) {
2542
+ this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[0];
2543
+ return;
2544
+ // Checking if it is the current menu.
2545
+ }
2546
+ else if (!this.items.includes(this.tieredMenuService.currentItem)) {
2547
+ return;
2548
+ }
2549
+ const curIndex = this.tieredMenuService.currentItems.indexOf(this.tieredMenuService.currentItem) - 1;
2550
+ if (curIndex >= 0) {
2551
+ this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[curIndex];
2552
+ }
2553
+ else {
2554
+ this.tieredMenuService.currentItem = this.tieredMenuService.currentItems[this.tieredMenuService.currentItems.length - 1];
2555
+ }
2556
+ if (this.tieredMenuService.currentItem.divider) {
2557
+ this._decrementCurItem();
2558
+ }
2559
+ }
2560
+ _createMenu(items, position) {
2561
+ if (!this._componentRef && items) {
2562
+ const componentFactory = this._componentFactoryResolver.resolveComponentFactory(TieredMenuComponent_1);
2563
+ this._componentRef = componentFactory.create(this._injector);
2564
+ this._appRef.attachView(this._componentRef.hostView);
2565
+ const domElem = this._componentRef.hostView.rootNodes[0];
2566
+ document.body.appendChild(domElem);
2567
+ // Setting the menu items.
2568
+ this._componentRef.instance.items = items;
2569
+ // Subscribe menu events.
2570
+ this._componentRef.instance.destroyRequest.subscribe((propagate) => {
2571
+ this._destroy(propagate);
2572
+ });
2573
+ this._menuDivElement = domElem.querySelector(".menu");
2574
+ this._setMenuPosition(position);
2575
+ }
2576
+ }
2577
+ _destroy(propagate = true) {
2578
+ if (this._componentRef !== null) {
2579
+ this._appRef.detachView(this._componentRef.hostView);
2580
+ this._componentRef.destroy();
2581
+ this._componentRef = null;
2582
+ this._menuDivElement = null;
2583
+ }
2584
+ if (propagate) {
2585
+ this.destroyRequest.emit();
2586
+ }
2587
+ }
2588
+ _setMenuPosition(position) {
2589
+ var _a, _b;
2590
+ const ITEM_HEIGHT = 37;
2591
+ const DIVIDER_HEIGHT = 5;
2331
2592
  const PADDING = 8;
2332
- const MARGIN = 4;
2333
2593
  if (this._componentRef !== null) {
2334
- this._componentRef.instance.top = 8;
2335
- let { bottom, left, right } = this._elementRef.nativeElement.getBoundingClientRect();
2594
+ const { top, right, bottom, left } = position;
2336
2595
  const itemsCount = (_a = this._componentRef.instance.items) === null || _a === void 0 ? void 0 : _a.reduce((count, item) => {
2337
2596
  return !item.divider ? count + 1 : count;
2338
2597
  }, 0);
2339
2598
  const dividersCount = (_b = this._componentRef.instance.items) === null || _b === void 0 ? void 0 : _b.reduce((count, item) => {
2340
2599
  return item.divider ? count + 1 : count;
2341
2600
  }, 0);
2342
- const menuHeight = itemsCount * ITEM_HEIGHT + dividersCount * DIVIDER_HEIGHT + PADDING + MARGIN;
2601
+ // I need to calculate the height of the component because the internal elements have not been created yet.
2602
+ const menuHeight = itemsCount * ITEM_HEIGHT + dividersCount * DIVIDER_HEIGHT + PADDING + 8;
2603
+ const menuWidth = this._menuDivElement.getBoundingClientRect().width;
2343
2604
  const rightFreeSpace = window.innerWidth - right;
2344
2605
  const bottomFreeSpace = window.innerHeight - bottom;
2345
- this._componentRef.instance.top = bottom;
2346
- this._componentRef.instance.left = left;
2347
- if (bottomFreeSpace <= menuHeight) {
2348
- this._componentRef.instance.top = Math.max(scrollY + bottom - menuHeight, 0);
2606
+ if (rightFreeSpace > menuWidth) {
2607
+ this._componentRef.instance.left = right;
2349
2608
  }
2350
2609
  else {
2351
- this._componentRef.instance.top = window.scrollY + bottom + MARGIN;
2610
+ this._componentRef.instance.left = left - menuWidth;
2352
2611
  }
2353
- if (rightFreeSpace > 176) {
2354
- this._componentRef.instance.left = window.scrollX + left;
2612
+ if (bottomFreeSpace <= menuHeight) {
2613
+ this._componentRef.instance.top = Math.max(window.innerHeight - menuHeight, window.scrollY);
2355
2614
  }
2356
2615
  else {
2357
- this._componentRef.instance.left = window.scrollX + right - ITEM_WIDTH;
2358
- }
2359
- if (this._isNested) {
2360
- this._componentRef.instance.left = MARGIN;
2616
+ this._componentRef.instance.top = window.scrollY + top;
2361
2617
  }
2362
2618
  }
2363
2619
  }
2364
- _setMenuComponentProperties() {
2365
- if (this._componentRef != null) {
2366
- this._componentRef.instance.items = this._tieredMenuService.items;
2367
- }
2368
- }
2369
2620
  _subscribeEvents() {
2370
- this._tieredMenuEventService.closeAllMenusEvent.pipe(takeUntil(this._unsubscribe$)).subscribe(() => {
2371
- this._tieredMenuService.items = this._tieredMenuService.markAllItemsAsClosed(this._tieredMenuService.items);
2372
- this._destroy();
2373
- enableScroll();
2621
+ // Increment current item event.
2622
+ this._tieredMenuEventService.incrementCurrentItemEvent.pipe(takeUntil(this._unsubscribe$)).subscribe(() => {
2623
+ this._incrementCurItem();
2624
+ });
2625
+ // Decrement current item event.
2626
+ this._tieredMenuEventService.decrementCurrentItemEvent.pipe(takeUntil(this._unsubscribe$)).subscribe(() => {
2627
+ this._decrementCurItem();
2628
+ });
2629
+ // Select item event.
2630
+ this._tieredMenuEventService.selectItemEvent.pipe(takeUntil(this._unsubscribe$)).subscribe((item) => {
2631
+ if (item.submenu) {
2632
+ this._tieredMenuEventService.openItemMenuEvent.emit(item);
2633
+ }
2634
+ else if (item.command) {
2635
+ this._tieredMenuEventService.closeAllMenusEvent.emit();
2636
+ item.command();
2637
+ }
2638
+ });
2639
+ // Close all menus event.
2640
+ this._tieredMenuEventService.closeAllMenusEvent.pipe(takeUntil(this._unsubscribe$)).subscribe(() => {
2641
+ this._destroy();
2642
+ this.tieredMenuService.currentItem = null;
2643
+ this.tieredMenuService.currentItems = this.tieredMenuService.items;
2644
+ this.tieredMenuService.markAllItemsAsClosed(this.tieredMenuService.items);
2645
+ enableScroll();
2646
+ });
2647
+ // Open item menu event.
2648
+ this._tieredMenuEventService.openItemMenuEvent.pipe(takeUntil(this._unsubscribe$)).subscribe((item) => {
2649
+ if (this.tieredMenuService.currentItem) {
2650
+ if (this.tieredMenuService.currentItem.parent === item) {
2651
+ return;
2652
+ }
2653
+ if (!this.tieredMenuService.searchTheHierarchy(this.tieredMenuService.currentItem.parent, item)) {
2654
+ let current = this.tieredMenuService.currentItem;
2655
+ current.isOpen = false;
2656
+ while ((current === null || current === void 0 ? void 0 : current.parent) !== item.parent) {
2657
+ this._tieredMenuEventService.closeItemMenuEvent.emit(current);
2658
+ this._changeDetectorRef.detectChanges();
2659
+ current = current.parent;
2660
+ }
2661
+ if (current) {
2662
+ current.isOpen = false;
2663
+ }
2664
+ }
2665
+ }
2666
+ if (item.submenu && !item.isOpen && this.items.includes(item)) {
2667
+ const { top, right, left, bottom } = document.querySelector(`#${item.id}`).getBoundingClientRect();
2668
+ const position = { top, right, left, bottom };
2669
+ this._createMenu(item.submenu, position);
2670
+ this.tieredMenuService.currentItems = item.submenu;
2671
+ this.tieredMenuService.currentItem = item.submenu[0];
2672
+ item.isOpen = true;
2673
+ }
2674
+ });
2675
+ // Close item menu event.
2676
+ this._tieredMenuEventService.closeItemMenuEvent
2677
+ .pipe(takeUntil(this._unsubscribe$))
2678
+ .subscribe((item) => {
2679
+ var _a, _b;
2680
+ if (this.items.some((i) => i.id === item.id)) {
2681
+ if (item.parent) {
2682
+ item.parent.isOpen = false;
2683
+ }
2684
+ else {
2685
+ enableScroll();
2686
+ }
2687
+ this.tieredMenuService.currentItems = ((_b = (_a = item === null || item === void 0 ? void 0 : item.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.submenu) || this.tieredMenuService.items;
2688
+ this.tieredMenuService.currentItem = item.parent;
2689
+ this.destroyRequest.emit(false);
2690
+ }
2374
2691
  });
2375
- }
2376
- _compareItems(item1, item2) {
2377
- return JSON.stringify(item1) === JSON.stringify(item2);
2378
- }
2379
- _rebuildMenu() {
2380
- this._destroy();
2381
- }
2382
- _updateServiceItems() {
2383
- var _a;
2384
- this._tieredMenuService.items = this._tieredMenuService.normalizeData(this.items);
2385
- this._tieredMenuService.currentItems = this._tieredMenuService.items;
2386
- this._tieredMenuService.currentItem = (_a = this._tieredMenuService.items.find((i) => { var _a; return i.label === ((_a = this.focusedItem) === null || _a === void 0 ? void 0 : _a.label); })) !== null && _a !== void 0 ? _a : this._tieredMenuService.items[0];
2387
2692
  }
2388
2693
  };
2389
- TieredMenuDirective.ctorParameters = () => [
2390
- { type: ElementRef },
2694
+ TieredMenuComponent.ctorParameters = () => [
2391
2695
  { type: ApplicationRef },
2392
2696
  { type: ComponentFactoryResolver },
2393
2697
  { type: Injector },
2394
- { type: TieredMenuEventService },
2698
+ { type: ChangeDetectorRef },
2395
2699
  { type: TieredMenuService },
2396
- { type: TieredMenuGlobalService },
2397
- { type: ChangeDetectorRef }
2700
+ { type: TieredMenuEventService }
2398
2701
  ];
2399
2702
  __decorate([
2400
- Input()
2401
- ], TieredMenuDirective.prototype, "items", void 0);
2703
+ Output()
2704
+ ], TieredMenuComponent.prototype, "destroyRequest", void 0);
2402
2705
  __decorate([
2403
- Input()
2404
- ], TieredMenuDirective.prototype, "focusedItem", void 0);
2706
+ HostListener("window:resize")
2707
+ ], TieredMenuComponent.prototype, "onResize", null);
2405
2708
  __decorate([
2406
- Input()
2407
- ], TieredMenuDirective.prototype, "triggerEvent", void 0);
2709
+ HostListener("document:click", ["$event"])
2710
+ ], TieredMenuComponent.prototype, "onDocumentClick", null);
2408
2711
  __decorate([
2409
- HostListener("click", ["$event"])
2410
- ], TieredMenuDirective.prototype, "onClick", null);
2411
- TieredMenuDirective = __decorate([
2412
- Directive({
2413
- selector: "[sTieredMenu]",
2414
- providers: [TieredMenuEventService, TieredMenuService],
2415
- })
2416
- ], TieredMenuDirective);
2417
-
2418
- let TieredMenuModule = class TieredMenuModule {
2419
- };
2420
- TieredMenuModule = __decorate([
2421
- NgModule({
2422
- imports: [
2423
- CommonModule,
2424
- ],
2425
- declarations: [
2426
- TieredMenuDirective,
2427
- TieredMenuComponent,
2428
- TieredMenuNestedComponent,
2429
- TieredMenuItemComponent,
2430
- TieredMenuDividerComponent,
2431
- ],
2432
- exports: [TieredMenuDirective],
2433
- providers: [TieredMenuGlobalService],
2712
+ HostListener("document:keydown", ["$event"])
2713
+ ], TieredMenuComponent.prototype, "onKeydownHandler", null);
2714
+ TieredMenuComponent = TieredMenuComponent_1 = __decorate([
2715
+ Component({
2716
+ selector: "s-tiered-menu",
2717
+ template: "<div\n class=\"menu\"\n [ngStyle]=\"{\n 'left': left + 'px',\n 'top': top + 'px'\n }\">\n\n <div *ngFor=\"let item of items\">\n <s-tiered-menu-item\n *ngIf=\"item.visible && !item.divider\"\n [item]=\"item\"\n [focused]=\"item === tieredMenuService.currentItem\"\n [highlight]=\"item.isOpen\"\n triggerEvent=\"hover\"\n [closeOnClick]=\"false\">\n </s-tiered-menu-item>\n <s-tiered-menu-divider *ngIf=\"item.divider\"></s-tiered-menu-divider>\n </div>\n</div>",
2718
+ styles: [".menu{background-color:#fff;border:1px solid #ccc;border-radius:6px;box-shadow:0 2px 12px 0 rgba(0,0,0,.1);display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column;max-height:100vh;min-width:176px;padding:4px 0;overflow-y:auto;position:absolute;z-index:9999}"]
2434
2719
  })
2435
- ], TieredMenuModule);
2720
+ ], TieredMenuComponent);
2436
2721
 
2437
- let ButtonModule = class ButtonModule {
2722
+ let TieredMenuGlobalService = class TieredMenuGlobalService {
2438
2723
  };
2439
- ButtonModule = __decorate([
2440
- NgModule({
2441
- imports: [CommonModule, RouterModule, BadgeModule, TieredMenuModule$1, TieredMenuModule, TooltipModule],
2442
- declarations: [ButtonComponent],
2443
- exports: [ButtonComponent],
2444
- })
2445
- ], ButtonModule);
2724
+ TieredMenuGlobalService = __decorate([
2725
+ Injectable()
2726
+ ], TieredMenuGlobalService);
2446
2727
 
2447
- let CalendarMaskDirective = class CalendarMaskDirective {
2448
- constructor(host, renderer) {
2449
- this.host = host;
2450
- this.renderer = renderer;
2451
- this.SELECTORS = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
2452
- this.slotChar = "_";
2453
- this.autoClear = false;
2454
- this.firstTime = true;
2455
- }
2456
- setListeners() {
2457
- this.input = this.host.inputfieldViewChild.nativeElement;
2458
- this.value = this.input.value;
2459
- this.focusListener = this.renderer.listen(this.input, "focus", () => {
2460
- this.onInputFocus();
2461
- });
2462
- this.blurListener = this.renderer.listen(this.input, "blur", (event) => {
2463
- this.onInputBlur(event);
2464
- });
2465
- this.keydownListener = this.renderer.listen(this.input, "keydown", (event) => {
2466
- this.onKeyDown(event);
2467
- });
2468
- this.keypressListener = this.renderer.listen(this.input, "keypress", (event) => {
2469
- this.onKeyPress(event);
2470
- });
2471
- this.inputListener = this.renderer.listen(this.input, "input", (event) => {
2472
- this.onInputChange(event);
2473
- });
2474
- this.pasteListener = this.renderer.listen(this.input, "paste", (event) => {
2475
- this.handleInputChange(event);
2476
- });
2728
+ let TieredMenuDirective = class TieredMenuDirective {
2729
+ constructor(_elementRef, _appRef, _componentFactoryResolver, _injector, _tieredMenuEventService, _tieredMenuService, _tieredMenuGlobalService, _changeDetectorRef) {
2730
+ this._elementRef = _elementRef;
2731
+ this._appRef = _appRef;
2732
+ this._componentFactoryResolver = _componentFactoryResolver;
2733
+ this._injector = _injector;
2734
+ this._tieredMenuEventService = _tieredMenuEventService;
2735
+ this._tieredMenuService = _tieredMenuService;
2736
+ this._tieredMenuGlobalService = _tieredMenuGlobalService;
2737
+ this._changeDetectorRef = _changeDetectorRef;
2738
+ this.focusedItem = undefined;
2739
+ this.triggerEvent = "click";
2740
+ this._componentRef = null;
2741
+ this._isNested = false;
2742
+ this._isOpen = false;
2743
+ this._unsubscribe$ = new Subject();
2477
2744
  }
2478
2745
  ngOnInit() {
2479
- const ua = navigator.userAgent;
2480
- this.androidChrome = /chrome/i.test(ua) && /android/i.test(ua);
2481
- this.createMaskFromDateFormat();
2482
- this.initMask();
2483
- }
2484
- get mask() {
2485
- return this._mask;
2486
- }
2487
- set mask(val) {
2488
- this._mask = val;
2489
- this.initMask();
2490
- this.writeValue("");
2746
+ var _a;
2747
+ this._itemsAreValid = !!((_a = this.items) === null || _a === void 0 ? void 0 : _a.length);
2748
+ if (!this._itemsAreValid)
2749
+ return;
2750
+ this._subscribeEvents();
2491
2751
  }
2492
- writeValue(value) {
2493
- this.value = value;
2494
- if (this.input) {
2495
- if (this.value == undefined) {
2496
- this.input.value = "";
2497
- }
2498
- else {
2499
- this.input.value = this.value;
2500
- }
2501
- this.checkVal();
2502
- this.focusText = this.input.value;
2503
- this.updateFilledState();
2752
+ ngDoCheck() {
2753
+ if (!this._itemsAreValid)
2754
+ return;
2755
+ if (!this._previousItems) {
2756
+ this._previousItems = this._tieredMenuService.cloneItems(this.items);
2504
2757
  }
2505
- }
2506
- onInputBlur(e) {
2507
- this.checkVal();
2508
- this.updateFilledState();
2509
- if (this.value != this.focusText) {
2510
- if (!this.input.disabled &&
2511
- (this.value === undefined || this.value === null || this.value.indexOf(this.slotChar) >= 0)) {
2512
- this.value = "";
2513
- e.target.value = "";
2514
- this.host.updateModel(null);
2758
+ let hasChanges = false;
2759
+ if (this.items.length !== this._previousItems.length) {
2760
+ hasChanges = true;
2761
+ }
2762
+ else {
2763
+ for (let i = 0; i < this.items.length; i++) {
2764
+ if (!this._compareItems(this.items[i], this._previousItems[i])) {
2765
+ hasChanges = true;
2766
+ break;
2767
+ }
2515
2768
  }
2516
- this.updateModel(e);
2517
- const event = document.createEvent("HTMLEvents");
2518
- event.initEvent("change", true, false);
2519
- this.input.dispatchEvent(event);
2520
2769
  }
2770
+ if (hasChanges) {
2771
+ this._updateServiceItems();
2772
+ this._changeDetectorRef.detectChanges();
2773
+ this._rebuildMenu();
2774
+ }
2775
+ this._previousItems = this._tieredMenuService.cloneItems(this.items);
2521
2776
  }
2522
- onKeyDown(e) {
2523
- if (this.host.readonlyInput) {
2777
+ ngOnDestroy() {
2778
+ if (!this._itemsAreValid)
2524
2779
  return;
2780
+ this._unsubscribe$.next();
2781
+ this._unsubscribe$.complete();
2782
+ this._destroy();
2783
+ }
2784
+ onClick(event) {
2785
+ if (!this._itemsAreValid)
2786
+ return;
2787
+ if (this.triggerEvent === "click" && !this._isOpen) {
2788
+ this._lastActiveElement = document.activeElement;
2789
+ this._createMenu();
2790
+ event.preventDefault();
2791
+ event.stopPropagation();
2525
2792
  }
2526
- const k = e.which || e.keyCode;
2527
- const iPhone = /iphone/i.test(navigator.userAgent);
2528
- let pos;
2529
- let begin;
2530
- let end;
2531
- this.oldVal = this.input.value;
2532
- // Backspace, delete, and escape get special treatment
2533
- if (k === 8 || k === 46 || (iPhone && k === 127)) {
2534
- pos = this.caret();
2535
- begin = pos.begin;
2536
- end = pos.end;
2537
- if (end - begin === 0) {
2538
- begin = k !== 46 ? this.seekPrev(begin) : (end = this.seekNext(begin - 1));
2539
- end = k === 46 ? this.seekNext(end) : end;
2540
- }
2541
- this.clearBuffer(begin, end);
2542
- this.shiftL(begin, end - 1);
2543
- this.updateModel(e);
2544
- e.preventDefault();
2545
- }
2546
- else if (k === 13) {
2547
- // Enter
2548
- this.onInputBlur(e);
2549
- this.updateModel(e);
2550
- }
2551
- else if (k === 27) {
2552
- // Escape
2553
- this.input.value = this.focusText;
2554
- this.caret(0, this.checkVal());
2555
- this.updateModel(e);
2556
- e.preventDefault();
2793
+ }
2794
+ _createMenu() {
2795
+ var _a, _b, _c;
2796
+ this._updateServiceItems();
2797
+ if (!this._componentRef && ((_a = this._tieredMenuService.items) === null || _a === void 0 ? void 0 : _a.length) > 0) {
2798
+ (_b = this._tieredMenuGlobalService.lastInstance) === null || _b === void 0 ? void 0 : _b._destroy();
2799
+ this._tieredMenuGlobalService.lastInstance = this;
2800
+ (_c = this._lastActiveElement) === null || _c === void 0 ? void 0 : _c.blur();
2801
+ this._isOpen = true;
2802
+ this._isNested = document.body.clientWidth < 600;
2803
+ this._isNested ? this._createNestedMenu() : this._createTieredMenu();
2557
2804
  }
2558
2805
  }
2559
- onKeyPress(e) {
2560
- if (this.host.readonlyInput)
2561
- return;
2562
- const k = e.which || e.keyCode;
2563
- const pos = this.caret();
2564
- let p;
2565
- let c;
2566
- let next;
2567
- if (e.ctrlKey || e.altKey || e.metaKey || k < 32 || (k > 34 && k < 41)) {
2568
- // Ignore
2569
- return;
2806
+ _createTieredMenu() {
2807
+ var _a;
2808
+ if (!this._componentRef && ((_a = this._tieredMenuService.items) === null || _a === void 0 ? void 0 : _a.length) > 0) {
2809
+ const componentFactory = this._componentFactoryResolver.resolveComponentFactory(TieredMenuComponent);
2810
+ this._componentRef = componentFactory.create(this._injector);
2811
+ this._appRef.attachView(this._componentRef.hostView);
2812
+ const domElem = this._componentRef.hostView.rootNodes[0];
2813
+ document.body.appendChild(domElem);
2814
+ this._setMenuComponentProperties();
2815
+ this._componentRef.instance.destroyRequest.pipe(takeUntil(this._unsubscribe$)).subscribe(() => {
2816
+ this._destroy();
2817
+ });
2818
+ this._setMenuPosition();
2570
2819
  }
2571
- else if (k && k !== 13) {
2572
- if (pos.end - pos.begin !== 0) {
2573
- this.clearBuffer(pos.begin, pos.end);
2574
- this.shiftL(pos.begin, pos.end - 1);
2575
- }
2576
- p = this.seekNext(pos.begin - 1);
2577
- if (p < this.len) {
2578
- c = String.fromCharCode(k);
2579
- if (this.tests[p].test(c)) {
2580
- this.shiftR(p);
2581
- this.buffer[p] = c;
2582
- this.writeBuffer();
2583
- next = this.seekNext(p);
2584
- if (/android/i.test(navigator.userAgent)) {
2585
- // Path for CSP Violation on FireFox OS 1.1
2586
- const proxy = () => {
2587
- this.caret(next);
2588
- };
2589
- setTimeout(proxy, 0);
2590
- }
2591
- else {
2592
- this.caret(next);
2593
- }
2594
- }
2595
- }
2596
- e.preventDefault();
2820
+ }
2821
+ _createNestedMenu() {
2822
+ var _a;
2823
+ if (!this._componentRef && ((_a = this._tieredMenuService.items) === null || _a === void 0 ? void 0 : _a.length) > 0) {
2824
+ const componentFactory = this._componentFactoryResolver.resolveComponentFactory(TieredMenuNestedComponent);
2825
+ this._componentRef = componentFactory.create(this._injector);
2826
+ this._appRef.attachView(this._componentRef.hostView);
2827
+ const domElem = this._componentRef.hostView.rootNodes[0];
2828
+ document.body.appendChild(domElem);
2829
+ this._setMenuComponentProperties();
2830
+ this._setMenuPosition();
2597
2831
  }
2598
- this.updateModel(e);
2599
- this.updateFilledState();
2600
2832
  }
2601
- createCompleteMask() {
2602
- switch (this.host.selectionMode) {
2603
- case "range":
2604
- return this.mask + ` ${this.host.rangeSeparator} ` + this.mask;
2605
- case "single":
2606
- case "multiple":
2607
- return this.mask;
2833
+ _destroy() {
2834
+ if (this._componentRef) {
2835
+ this._isOpen = false;
2836
+ window.clearTimeout(this._showTimeout);
2837
+ this._appRef.detachView(this._componentRef.hostView);
2838
+ this._componentRef.destroy();
2839
+ this._componentRef = null;
2840
+ this._tieredMenuService.currentItems = this._tieredMenuService.items;
2841
+ this._tieredMenuService.currentItem = this._tieredMenuService.items[0];
2842
+ this._tieredMenuEventService.closeAllMenusEvent.emit();
2608
2843
  }
2609
2844
  }
2610
- checkVal(allow) {
2611
- // Try to place characters where they belong
2612
- const test = this.input.value;
2613
- let lastMatch = -1;
2614
- let i;
2615
- let c;
2616
- let pos = 0;
2617
- for (i = 0; i < this.len; i++) {
2618
- if (this.tests[i]) {
2619
- this.buffer[i] = this.getPlaceholder(i);
2620
- while (pos++ < test.length) {
2621
- c = test.charAt(pos - 1);
2622
- if (this.tests[i].test(c)) {
2623
- this.buffer[i] = c;
2624
- lastMatch = i;
2625
- break;
2626
- }
2627
- }
2628
- if (pos > test.length) {
2629
- this.clearBuffer(i + 1, this.len);
2630
- break;
2631
- }
2845
+ _setMenuPosition() {
2846
+ var _a, _b;
2847
+ const ITEM_HEIGHT = 37;
2848
+ const ITEM_WIDTH = 176;
2849
+ const DIVIDER_HEIGHT = 5;
2850
+ const PADDING = 8;
2851
+ const MARGIN = 4;
2852
+ if (this._componentRef !== null) {
2853
+ this._componentRef.instance.top = 8;
2854
+ let { bottom, left, right } = this._elementRef.nativeElement.getBoundingClientRect();
2855
+ const itemsCount = (_a = this._componentRef.instance.items) === null || _a === void 0 ? void 0 : _a.reduce((count, item) => {
2856
+ return !item.divider ? count + 1 : count;
2857
+ }, 0);
2858
+ const dividersCount = (_b = this._componentRef.instance.items) === null || _b === void 0 ? void 0 : _b.reduce((count, item) => {
2859
+ return item.divider ? count + 1 : count;
2860
+ }, 0);
2861
+ const menuHeight = itemsCount * ITEM_HEIGHT + dividersCount * DIVIDER_HEIGHT + PADDING + MARGIN;
2862
+ const rightFreeSpace = window.innerWidth - right;
2863
+ const bottomFreeSpace = window.innerHeight - bottom;
2864
+ this._componentRef.instance.top = bottom;
2865
+ this._componentRef.instance.left = left;
2866
+ if (bottomFreeSpace <= menuHeight) {
2867
+ this._componentRef.instance.top = Math.max(scrollY + bottom - menuHeight, 0);
2632
2868
  }
2633
2869
  else {
2634
- if (this.buffer[i] === test.charAt(pos)) {
2635
- pos++;
2636
- }
2637
- if (i < this.partialPosition) {
2638
- lastMatch = i;
2639
- }
2870
+ this._componentRef.instance.top = window.scrollY + bottom + MARGIN;
2640
2871
  }
2641
- }
2642
- if (allow) {
2643
- this.writeBuffer();
2644
- }
2645
- else if (lastMatch + 1 < this.partialPosition) {
2646
- if (this.autoClear || this.buffer.join("") === this.defaultBuffer) {
2647
- // Invalid value. Remove it and replace it with the
2648
- // mask, which is the default behavior.
2649
- if (this.input.value) {
2650
- this.input.value = "";
2651
- }
2652
- this.clearBuffer(0, this.len);
2872
+ if (rightFreeSpace > 176) {
2873
+ this._componentRef.instance.left = window.scrollX + left;
2653
2874
  }
2654
2875
  else {
2655
- // Invalid value, but we opt to show the value to the
2656
- // user and allow them to correct their mistake.
2657
- this.writeBuffer();
2876
+ this._componentRef.instance.left = window.scrollX + right - ITEM_WIDTH;
2877
+ }
2878
+ if (this._isNested) {
2879
+ this._componentRef.instance.left = MARGIN;
2658
2880
  }
2659
2881
  }
2660
- else {
2661
- this.writeBuffer();
2662
- this.input.value = this.input.value.substring(0, lastMatch + 1);
2663
- }
2664
- return this.partialPosition ? i : this.firstNonMaskPos;
2665
2882
  }
2666
- onInputFocus() {
2667
- if (this.host.readonlyInput)
2668
- return;
2669
- clearTimeout(this.caretTimeoutId);
2670
- let pos;
2671
- this.focusText = this.input.value;
2672
- pos = this.checkVal();
2673
- this.caretTimeoutId = setTimeout(() => {
2674
- if (this.input !== document.activeElement) {
2675
- return;
2676
- }
2677
- this.writeBuffer();
2678
- if (pos == this.mask.replace("?", "").length) {
2679
- this.caret(0, pos);
2680
- }
2681
- else {
2682
- this.caret(pos);
2683
- }
2684
- }, 10);
2883
+ _setMenuComponentProperties() {
2884
+ if (this._componentRef != null) {
2885
+ this._componentRef.instance.items = this._tieredMenuService.items;
2886
+ }
2685
2887
  }
2686
- onInputChange(event) {
2687
- if (this.androidChrome)
2688
- this.handleAndroidInput(event);
2689
- else
2690
- this.handleInputChange(event);
2888
+ _subscribeEvents() {
2889
+ this._tieredMenuEventService.closeAllMenusEvent.pipe(takeUntil(this._unsubscribe$)).subscribe(() => {
2890
+ this._tieredMenuService.items = this._tieredMenuService.markAllItemsAsClosed(this._tieredMenuService.items);
2891
+ this._destroy();
2892
+ enableScroll();
2893
+ });
2691
2894
  }
2692
- handleInputChange(event) {
2693
- if (this.host.readonlyInput)
2694
- return;
2695
- setTimeout(() => {
2696
- const pos = this.checkVal(true);
2697
- this.caret(pos);
2698
- this.updateModel(event);
2699
- }, 0);
2895
+ _compareItems(item1, item2) {
2896
+ return JSON.stringify(item1) === JSON.stringify(item2);
2700
2897
  }
2701
- updateModel(e) {
2702
- const updatedValue = e.target.value;
2703
- if (updatedValue !== null || updatedValue !== undefined) {
2704
- this.value = updatedValue;
2705
- this.host.onUserInput(e);
2706
- }
2898
+ _rebuildMenu() {
2899
+ this._destroy();
2707
2900
  }
2708
- updateFilledState() {
2709
- this.filled = this.input && this.input.value != "";
2901
+ _updateServiceItems() {
2902
+ var _a;
2903
+ this._tieredMenuService.items = this._tieredMenuService.normalizeData(this.items);
2904
+ this._tieredMenuService.currentItems = this._tieredMenuService.items;
2905
+ this._tieredMenuService.currentItem = (_a = this._tieredMenuService.items.find((i) => { var _a; return i.label === ((_a = this.focusedItem) === null || _a === void 0 ? void 0 : _a.label); })) !== null && _a !== void 0 ? _a : this._tieredMenuService.items[0];
2710
2906
  }
2711
- focus() {
2712
- this.input.focus();
2907
+ };
2908
+ TieredMenuDirective.ctorParameters = () => [
2909
+ { type: ElementRef },
2910
+ { type: ApplicationRef },
2911
+ { type: ComponentFactoryResolver },
2912
+ { type: Injector },
2913
+ { type: TieredMenuEventService },
2914
+ { type: TieredMenuService },
2915
+ { type: TieredMenuGlobalService },
2916
+ { type: ChangeDetectorRef }
2917
+ ];
2918
+ __decorate([
2919
+ Input()
2920
+ ], TieredMenuDirective.prototype, "items", void 0);
2921
+ __decorate([
2922
+ Input()
2923
+ ], TieredMenuDirective.prototype, "focusedItem", void 0);
2924
+ __decorate([
2925
+ Input()
2926
+ ], TieredMenuDirective.prototype, "triggerEvent", void 0);
2927
+ __decorate([
2928
+ HostListener("click", ["$event"])
2929
+ ], TieredMenuDirective.prototype, "onClick", null);
2930
+ TieredMenuDirective = __decorate([
2931
+ Directive({
2932
+ selector: "[sTieredMenu]",
2933
+ providers: [TieredMenuEventService, TieredMenuService],
2934
+ })
2935
+ ], TieredMenuDirective);
2936
+
2937
+ let TieredMenuModule = class TieredMenuModule {
2938
+ };
2939
+ TieredMenuModule = __decorate([
2940
+ NgModule({
2941
+ imports: [
2942
+ CommonModule,
2943
+ ],
2944
+ declarations: [
2945
+ TieredMenuDirective,
2946
+ TieredMenuComponent,
2947
+ TieredMenuNestedComponent,
2948
+ TieredMenuItemComponent,
2949
+ TieredMenuDividerComponent,
2950
+ ],
2951
+ exports: [TieredMenuDirective],
2952
+ providers: [TieredMenuGlobalService],
2953
+ })
2954
+ ], TieredMenuModule);
2955
+
2956
+ let ButtonModule = class ButtonModule {
2957
+ };
2958
+ ButtonModule = __decorate([
2959
+ NgModule({
2960
+ imports: [CommonModule, RouterModule, BadgeModule, TieredMenuModule$1, TieredMenuModule, TooltipModule],
2961
+ declarations: [ButtonComponent],
2962
+ exports: [ButtonComponent],
2963
+ })
2964
+ ], ButtonModule);
2965
+
2966
+ let CalendarMaskDirective = class CalendarMaskDirective {
2967
+ constructor(host, renderer) {
2968
+ this.host = host;
2969
+ this.renderer = renderer;
2970
+ this.SELECTORS = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
2971
+ this.slotChar = "_";
2972
+ this.autoClear = false;
2973
+ this.firstTime = true;
2713
2974
  }
2714
- initMask() {
2715
- const completeMask = this.createCompleteMask();
2716
- this.tests = [];
2717
- this.partialPosition = completeMask.length;
2718
- this.len = completeMask.length;
2719
- this.firstNonMaskPos = null;
2720
- this.defs = {
2721
- "9": "[0-9]",
2722
- };
2723
- const maskTokens = completeMask.split("");
2724
- for (let i = 0; i < maskTokens.length; i++) {
2725
- const c = maskTokens[i];
2726
- if (c == "?") {
2727
- this.len--;
2728
- this.partialPosition = i;
2729
- }
2730
- else if (this.defs[c]) {
2731
- this.tests.push(new RegExp(this.defs[c]));
2732
- if (this.firstNonMaskPos === null) {
2733
- this.firstNonMaskPos = this.tests.length - 1;
2734
- }
2735
- if (i < this.partialPosition) {
2736
- this.lastRequiredNonMaskPos = this.tests.length - 1;
2737
- }
2975
+ setListeners() {
2976
+ this.input = this.host.inputfieldViewChild.nativeElement;
2977
+ this.value = this.input.value;
2978
+ this.focusListener = this.renderer.listen(this.input, "focus", () => {
2979
+ this.onInputFocus();
2980
+ });
2981
+ this.blurListener = this.renderer.listen(this.input, "blur", (event) => {
2982
+ this.onInputBlur(event);
2983
+ });
2984
+ this.keydownListener = this.renderer.listen(this.input, "keydown", (event) => {
2985
+ this.onKeyDown(event);
2986
+ });
2987
+ this.keypressListener = this.renderer.listen(this.input, "keypress", (event) => {
2988
+ this.onKeyPress(event);
2989
+ });
2990
+ this.inputListener = this.renderer.listen(this.input, "input", (event) => {
2991
+ this.onInputChange(event);
2992
+ });
2993
+ this.pasteListener = this.renderer.listen(this.input, "paste", (event) => {
2994
+ this.handleInputChange(event);
2995
+ });
2996
+ }
2997
+ ngOnInit() {
2998
+ const ua = navigator.userAgent;
2999
+ this.androidChrome = /chrome/i.test(ua) && /android/i.test(ua);
3000
+ this.createMaskFromDateFormat();
3001
+ this.initMask();
3002
+ }
3003
+ get mask() {
3004
+ return this._mask;
3005
+ }
3006
+ set mask(val) {
3007
+ this._mask = val;
3008
+ this.initMask();
3009
+ this.writeValue("");
3010
+ }
3011
+ writeValue(value) {
3012
+ this.value = value;
3013
+ if (this.input) {
3014
+ if (this.value == undefined) {
3015
+ this.input.value = "";
2738
3016
  }
2739
3017
  else {
2740
- this.tests.push(null);
3018
+ this.input.value = this.value;
2741
3019
  }
3020
+ this.checkVal();
3021
+ this.focusText = this.input.value;
3022
+ this.updateFilledState();
2742
3023
  }
2743
- this.buffer = [];
2744
- for (let i = 0; i < maskTokens.length; i++) {
2745
- const c = maskTokens[i];
2746
- if (c != "?") {
2747
- if (this.defs[c]) {
2748
- this.buffer.push(this.getPlaceholder(i));
2749
- }
2750
- else {
2751
- this.buffer.push(c);
2752
- }
3024
+ }
3025
+ onInputBlur(e) {
3026
+ this.checkVal();
3027
+ this.updateFilledState();
3028
+ if (this.value != this.focusText) {
3029
+ if (!this.input.disabled &&
3030
+ (this.value === undefined || this.value === null || this.value.indexOf(this.slotChar) >= 0)) {
3031
+ this.value = "";
3032
+ e.target.value = "";
3033
+ this.host.updateModel(null);
2753
3034
  }
3035
+ this.updateModel(e);
3036
+ const event = document.createEvent("HTMLEvents");
3037
+ event.initEvent("change", true, false);
3038
+ this.input.dispatchEvent(event);
2754
3039
  }
2755
- this.defaultBuffer = this.buffer.join("");
2756
3040
  }
2757
- caret(first, last) {
2758
- let range, begin, end;
2759
- if (!this.input.offsetParent || this.input !== document.activeElement) {
3041
+ onKeyDown(e) {
3042
+ if (this.host.readonlyInput) {
2760
3043
  return;
2761
3044
  }
2762
- if (typeof first == "number") {
2763
- begin = first;
2764
- end = typeof last === "number" ? last : begin;
2765
- if (this.input.setSelectionRange) {
2766
- this.input.setSelectionRange(begin, end);
2767
- }
2768
- else if (this.input["createTextRange"]) {
2769
- range = this.input["createTextRange"]();
2770
- range.collapse(true);
2771
- range.moveEnd("character", end);
2772
- range.moveStart("character", begin);
2773
- range.select();
2774
- }
2775
- }
2776
- else {
2777
- if (this.input.setSelectionRange) {
2778
- begin = this.input.selectionStart;
2779
- end = this.input.selectionEnd;
2780
- }
2781
- else if (document["selection"] && document["selection"].createRange) {
2782
- range = document["selection"].createRange();
2783
- begin = 0 - range.duplicate().moveStart("character", -100000);
2784
- end = begin + range.text.length;
3045
+ const k = e.which || e.keyCode;
3046
+ const iPhone = /iphone/i.test(navigator.userAgent);
3047
+ let pos;
3048
+ let begin;
3049
+ let end;
3050
+ this.oldVal = this.input.value;
3051
+ // Backspace, delete, and escape get special treatment
3052
+ if (k === 8 || k === 46 || (iPhone && k === 127)) {
3053
+ pos = this.caret();
3054
+ begin = pos.begin;
3055
+ end = pos.end;
3056
+ if (end - begin === 0) {
3057
+ begin = k !== 46 ? this.seekPrev(begin) : (end = this.seekNext(begin - 1));
3058
+ end = k === 46 ? this.seekNext(end) : end;
2785
3059
  }
2786
- return { begin: begin, end: end };
3060
+ this.clearBuffer(begin, end);
3061
+ this.shiftL(begin, end - 1);
3062
+ this.updateModel(e);
3063
+ e.preventDefault();
2787
3064
  }
2788
- }
2789
- getPlaceholder(i) {
2790
- if (i < this.slotChar.length)
2791
- return this.slotChar.charAt(i);
2792
- return this.slotChar.charAt(0);
2793
- }
2794
- seekNext(pos) {
2795
- while (++pos < this.len) {
2796
- if (this.tests[pos])
2797
- break;
3065
+ else if (k === 13) {
3066
+ // Enter
3067
+ this.onInputBlur(e);
3068
+ this.updateModel(e);
2798
3069
  }
2799
- return pos;
2800
- }
2801
- seekPrev(pos) {
2802
- while (--pos >= 0 && !this.tests[pos]) {
2803
- if (this.tests[pos])
2804
- break;
3070
+ else if (k === 27) {
3071
+ // Escape
3072
+ this.input.value = this.focusText;
3073
+ this.caret(0, this.checkVal());
3074
+ this.updateModel(e);
3075
+ e.preventDefault();
2805
3076
  }
2806
- return pos;
2807
3077
  }
2808
- shiftL(begin, end) {
2809
- let i;
2810
- let j;
2811
- if (begin < 0) {
3078
+ onKeyPress(e) {
3079
+ if (this.host.readonlyInput)
2812
3080
  return;
2813
- }
2814
- j = this.seekNext(end);
2815
- for (i = begin; i < this.len; i++) {
2816
- if (this.tests[i]) {
2817
- if (j < this.len && this.tests[i].test(this.buffer[j])) {
2818
- this.buffer[i] = this.buffer[j];
2819
- this.buffer[j] = this.getPlaceholder(j);
3081
+ const k = e.which || e.keyCode;
3082
+ const pos = this.caret();
3083
+ let p;
3084
+ let c;
3085
+ let next;
3086
+ if (e.ctrlKey || e.altKey || e.metaKey || k < 32 || (k > 34 && k < 41)) {
3087
+ // Ignore
3088
+ return;
3089
+ }
3090
+ else if (k && k !== 13) {
3091
+ if (pos.end - pos.begin !== 0) {
3092
+ this.clearBuffer(pos.begin, pos.end);
3093
+ this.shiftL(pos.begin, pos.end - 1);
3094
+ }
3095
+ p = this.seekNext(pos.begin - 1);
3096
+ if (p < this.len) {
3097
+ c = String.fromCharCode(k);
3098
+ if (this.tests[p].test(c)) {
3099
+ this.shiftR(p);
3100
+ this.buffer[p] = c;
3101
+ this.writeBuffer();
3102
+ next = this.seekNext(p);
3103
+ if (/android/i.test(navigator.userAgent)) {
3104
+ // Path for CSP Violation on FireFox OS 1.1
3105
+ const proxy = () => {
3106
+ this.caret(next);
3107
+ };
3108
+ setTimeout(proxy, 0);
3109
+ }
3110
+ else {
3111
+ this.caret(next);
3112
+ }
2820
3113
  }
2821
- else
2822
- break;
2823
- j = this.seekNext(j);
2824
3114
  }
3115
+ e.preventDefault();
2825
3116
  }
2826
- this.writeBuffer();
2827
- this.caret(Math.max(this.firstNonMaskPos, begin));
3117
+ this.updateModel(e);
3118
+ this.updateFilledState();
2828
3119
  }
2829
- shiftR(pos) {
3120
+ createCompleteMask() {
3121
+ switch (this.host.selectionMode) {
3122
+ case "range":
3123
+ return this.mask + ` ${this.host.rangeSeparator} ` + this.mask;
3124
+ case "single":
3125
+ case "multiple":
3126
+ return this.mask;
3127
+ }
3128
+ }
3129
+ checkVal(allow) {
3130
+ // Try to place characters where they belong
3131
+ const test = this.input.value;
3132
+ let lastMatch = -1;
2830
3133
  let i;
2831
- let c = this.getPlaceholder(pos);
2832
- let j;
2833
- let t;
2834
- for (i = pos; i < this.len; i++) {
3134
+ let c;
3135
+ let pos = 0;
3136
+ for (i = 0; i < this.len; i++) {
2835
3137
  if (this.tests[i]) {
2836
- j = this.seekNext(i);
2837
- t = this.buffer[i];
2838
- this.buffer[i] = c;
2839
- if (j < this.len && this.tests[j].test(t)) {
2840
- c = t;
3138
+ this.buffer[i] = this.getPlaceholder(i);
3139
+ while (pos++ < test.length) {
3140
+ c = test.charAt(pos - 1);
3141
+ if (this.tests[i].test(c)) {
3142
+ this.buffer[i] = c;
3143
+ lastMatch = i;
3144
+ break;
3145
+ }
2841
3146
  }
2842
- else
3147
+ if (pos > test.length) {
3148
+ this.clearBuffer(i + 1, this.len);
2843
3149
  break;
2844
- }
2845
- }
2846
- }
2847
- handleAndroidInput(e) {
2848
- const curVal = this.input.value;
2849
- const pos = this.caret();
2850
- if (this.oldVal && this.oldVal.length && this.oldVal.length > curVal.length) {
2851
- // A deletion or backspace happened
2852
- this.checkVal(true);
2853
- while (pos.begin > 0 && !this.tests[pos.begin - 1]) {
2854
- pos.begin--;
2855
- }
2856
- if (pos.begin === 0) {
2857
- while (pos.begin < this.firstNonMaskPos && !this.tests[pos.begin]) {
2858
- pos.begin++;
2859
3150
  }
2860
3151
  }
2861
- setTimeout(() => {
2862
- this.caret(pos.begin, pos.begin);
2863
- if (this.isCompleted()) {
2864
- const sentVal = curVal.replace(this.slotChar, ""); // Limpa os caracteres placeholders extras caso ele esteja completo
2865
- this.updateCalendarValue(sentVal);
3152
+ else {
3153
+ if (this.buffer[i] === test.charAt(pos)) {
3154
+ pos++;
3155
+ }
3156
+ if (i < this.partialPosition) {
3157
+ lastMatch = i;
2866
3158
  }
2867
- }, 0);
2868
- }
2869
- else {
2870
- this.checkVal(true);
2871
- while (pos.begin < this.len && !this.tests[pos.begin]) {
2872
- pos.begin++;
2873
3159
  }
2874
- setTimeout(() => {
2875
- this.caret(pos.begin, pos.begin);
2876
- if (this.isCompleted()) {
2877
- const sentVal = curVal.replace(this.slotChar, ""); // Limpa os caracteres placeholders extras caso ele esteja completo
2878
- this.updateCalendarValue(sentVal);
3160
+ }
3161
+ if (allow) {
3162
+ this.writeBuffer();
3163
+ }
3164
+ else if (lastMatch + 1 < this.partialPosition) {
3165
+ if (this.autoClear || this.buffer.join("") === this.defaultBuffer) {
3166
+ // Invalid value. Remove it and replace it with the
3167
+ // mask, which is the default behavior.
3168
+ if (this.input.value) {
3169
+ this.input.value = "";
2879
3170
  }
2880
- }, 0);
3171
+ this.clearBuffer(0, this.len);
3172
+ }
3173
+ else {
3174
+ // Invalid value, but we opt to show the value to the
3175
+ // user and allow them to correct their mistake.
3176
+ this.writeBuffer();
3177
+ }
2881
3178
  }
2882
- }
2883
- updateCalendarValue(sentVal) {
2884
- // TODO verificar
2885
- const dateVal = this.host.parseValueFromString(sentVal);
2886
- if (this.host.isSelectable(dateVal.getDate(), dateVal.getMonth(), dateVal.getFullYear(), false)) {
2887
- this.host.updateModel(sentVal);
2888
- this.host.updateUI();
3179
+ else {
3180
+ this.writeBuffer();
3181
+ this.input.value = this.input.value.substring(0, lastMatch + 1);
2889
3182
  }
3183
+ return this.partialPosition ? i : this.firstNonMaskPos;
2890
3184
  }
2891
- clearBuffer(start, end) {
2892
- let i;
2893
- for (i = start; i < end && i < this.len; i++) {
2894
- if (this.tests[i]) {
2895
- this.buffer[i] = this.getPlaceholder(i);
3185
+ onInputFocus() {
3186
+ if (this.host.readonlyInput)
3187
+ return;
3188
+ clearTimeout(this.caretTimeoutId);
3189
+ let pos;
3190
+ this.focusText = this.input.value;
3191
+ pos = this.checkVal();
3192
+ this.caretTimeoutId = setTimeout(() => {
3193
+ if (this.input !== document.activeElement) {
3194
+ return;
2896
3195
  }
3196
+ this.writeBuffer();
3197
+ if (pos == this.mask.replace("?", "").length) {
3198
+ this.caret(0, pos);
3199
+ }
3200
+ else {
3201
+ this.caret(pos);
3202
+ }
3203
+ }, 10);
3204
+ }
3205
+ onInputChange(event) {
3206
+ if (this.androidChrome)
3207
+ this.handleAndroidInput(event);
3208
+ else
3209
+ this.handleInputChange(event);
3210
+ }
3211
+ handleInputChange(event) {
3212
+ if (this.host.readonlyInput)
3213
+ return;
3214
+ setTimeout(() => {
3215
+ const pos = this.checkVal(true);
3216
+ this.caret(pos);
3217
+ this.updateModel(event);
3218
+ }, 0);
3219
+ }
3220
+ updateModel(e) {
3221
+ const updatedValue = e.target.value;
3222
+ if (updatedValue !== null || updatedValue !== undefined) {
3223
+ this.value = updatedValue;
3224
+ this.host.onUserInput(e);
2897
3225
  }
2898
3226
  }
2899
- writeBuffer() {
2900
- this.input.value = this.buffer.join("");
3227
+ updateFilledState() {
3228
+ this.filled = this.input && this.input.value != "";
2901
3229
  }
2902
- createMaskFromDateFormat() {
2903
- const calendar = this.host;
2904
- let mask = this.autoClear ? "?" : "";
2905
- if (!calendar.timeOnly) {
2906
- let dateFormat = calendar.dateFormat;
2907
- dateFormat = dateFormat.replace(/y/g, "yy");
2908
- mask += dateFormat.replace(/[^/*,.\-+\[\]\\]/g, "9");
2909
- if (calendar.showTime) {
2910
- mask += " ";
3230
+ focus() {
3231
+ this.input.focus();
3232
+ }
3233
+ initMask() {
3234
+ const completeMask = this.createCompleteMask();
3235
+ this.tests = [];
3236
+ this.partialPosition = completeMask.length;
3237
+ this.len = completeMask.length;
3238
+ this.firstNonMaskPos = null;
3239
+ this.defs = {
3240
+ "9": "[0-9]",
3241
+ };
3242
+ const maskTokens = completeMask.split("");
3243
+ for (let i = 0; i < maskTokens.length; i++) {
3244
+ const c = maskTokens[i];
3245
+ if (c == "?") {
3246
+ this.len--;
3247
+ this.partialPosition = i;
2911
3248
  }
2912
- }
2913
- if (calendar.showTime || calendar.timeOnly) {
2914
- mask += "99:99";
2915
- if (calendar.showSeconds) {
2916
- mask += ":99";
3249
+ else if (this.defs[c]) {
3250
+ this.tests.push(new RegExp(this.defs[c]));
3251
+ if (this.firstNonMaskPos === null) {
3252
+ this.firstNonMaskPos = this.tests.length - 1;
3253
+ }
3254
+ if (i < this.partialPosition) {
3255
+ this.lastRequiredNonMaskPos = this.tests.length - 1;
3256
+ }
3257
+ }
3258
+ else {
3259
+ this.tests.push(null);
2917
3260
  }
2918
3261
  }
2919
- this._mask = mask;
2920
- this.initMask();
2921
- }
2922
- isCompleted() {
2923
- for (let i = this.firstNonMaskPos; i <= this.lastRequiredNonMaskPos; i++) {
2924
- if (this.tests[i] && this.buffer[i] === this.getPlaceholder(i)) {
2925
- return false;
3262
+ this.buffer = [];
3263
+ for (let i = 0; i < maskTokens.length; i++) {
3264
+ const c = maskTokens[i];
3265
+ if (c != "?") {
3266
+ if (this.defs[c]) {
3267
+ this.buffer.push(this.getPlaceholder(i));
3268
+ }
3269
+ else {
3270
+ this.buffer.push(c);
3271
+ }
2926
3272
  }
2927
3273
  }
2928
- return true;
3274
+ this.defaultBuffer = this.buffer.join("");
2929
3275
  }
2930
- ngAfterViewChecked() {
2931
- if (this.host.inputfieldViewChild && this.firstTime) {
2932
- this.firstTime = false;
2933
- this.setListeners();
2934
- this.input.type = "tel";
2935
- }
2936
- }
2937
- ngOnDestroy() {
2938
- if (this.focusListener)
2939
- this.focusListener();
2940
- if (this.blurListener)
2941
- this.blurListener();
2942
- if (this.keydownListener)
2943
- this.keydownListener();
2944
- if (this.keypressListener)
2945
- this.keypressListener();
2946
- if (this.inputListener)
2947
- this.inputListener();
2948
- if (this.pasteListener)
2949
- this.pasteListener();
2950
- }
2951
- onKeydownEventTest(e) {
2952
- const { key } = e;
2953
- if (key == "Tab") {
2954
- // Este código foi implementado para corrigir um problema no componente na v9
2955
- // Deve ser removido assim que atualizarmos o PrimeNG para a v10
2956
- const allFocusableElements = document.querySelectorAll(this.SELECTORS);
2957
- let nextIsFocusable = false;
2958
- let previousFocusable;
2959
- let forceCloseModal = true;
2960
- allFocusableElements.forEach((element) => {
2961
- if (!e.shiftKey) {
2962
- if (nextIsFocusable && element.id) {
2963
- this.focusableElement(element.id, forceCloseModal);
2964
- nextIsFocusable = false;
2965
- e.preventDefault();
2966
- return;
2967
- }
2968
- }
2969
- let activeTagName = window.document.activeElement.tagName;
2970
- if (e.shiftKey && element.id && element.tagName === "INPUT" && activeTagName == "BUTTON") {
2971
- previousFocusable = element.id;
2972
- forceCloseModal = false;
2973
- }
2974
- if (element.id === this.host.inputId) {
2975
- if (previousFocusable) {
2976
- this.focusableElement(previousFocusable, forceCloseModal);
2977
- e.preventDefault();
2978
- forceCloseModal = true;
2979
- return;
2980
- }
2981
- nextIsFocusable = true;
2982
- }
2983
- else if (e.shiftKey && element.id) {
2984
- previousFocusable = element.id;
2985
- }
2986
- });
3276
+ caret(first, last) {
3277
+ let range, begin, end;
3278
+ if (!this.input.offsetParent || this.input !== document.activeElement) {
3279
+ return;
2987
3280
  }
2988
- }
2989
- focusableElement(id, hide) {
2990
- const htmlElement = window.document.getElementById(id);
2991
- htmlElement.focus();
2992
- if (hide) {
2993
- this.host.hideOverlay();
3281
+ if (typeof first == "number") {
3282
+ begin = first;
3283
+ end = typeof last === "number" ? last : begin;
3284
+ if (this.input.setSelectionRange) {
3285
+ this.input.setSelectionRange(begin, end);
3286
+ }
3287
+ else if (this.input["createTextRange"]) {
3288
+ range = this.input["createTextRange"]();
3289
+ range.collapse(true);
3290
+ range.moveEnd("character", end);
3291
+ range.moveStart("character", begin);
3292
+ range.select();
3293
+ }
3294
+ }
3295
+ else {
3296
+ if (this.input.setSelectionRange) {
3297
+ begin = this.input.selectionStart;
3298
+ end = this.input.selectionEnd;
3299
+ }
3300
+ else if (document["selection"] && document["selection"].createRange) {
3301
+ range = document["selection"].createRange();
3302
+ begin = 0 - range.duplicate().moveStart("character", -100000);
3303
+ end = begin + range.text.length;
3304
+ }
3305
+ return { begin: begin, end: end };
2994
3306
  }
2995
3307
  }
2996
- };
2997
- CalendarMaskDirective.ctorParameters = () => [
2998
- { type: Calendar },
2999
- { type: Renderer2 }
3000
- ];
3001
- __decorate([
3002
- Input()
3003
- ], CalendarMaskDirective.prototype, "slotChar", void 0);
3004
- __decorate([
3005
- Input()
3006
- ], CalendarMaskDirective.prototype, "autoClear", void 0);
3007
- __decorate([
3008
- HostListener("keydown", ["$event"])
3009
- ], CalendarMaskDirective.prototype, "onKeydownEventTest", null);
3010
- CalendarMaskDirective = __decorate([
3011
- Directive({
3012
- selector: "p-calendar[sCalendarMask]",
3013
- })
3014
- ], CalendarMaskDirective);
3015
-
3016
- let CalendarMaskModule = class CalendarMaskModule {
3017
- };
3018
- CalendarMaskModule = __decorate([
3019
- NgModule({
3020
- declarations: [CalendarMaskDirective],
3021
- imports: [CommonModule],
3022
- exports: [CalendarMaskDirective],
3023
- })
3024
- ], CalendarMaskModule);
3025
-
3026
- let TemplateDirective = class TemplateDirective {
3027
- constructor(template) {
3028
- this.template = template;
3029
- }
3030
- };
3031
- TemplateDirective.ctorParameters = () => [
3032
- { type: TemplateRef }
3033
- ];
3034
- __decorate([
3035
- Input("sTemplate")
3036
- ], TemplateDirective.prototype, "type", void 0);
3037
- TemplateDirective = __decorate([
3038
- Directive({
3039
- selector: "[sTemplate]",
3040
- })
3041
- ], TemplateDirective);
3042
-
3043
- var CardTemplateTypes;
3044
- (function (CardTemplateTypes) {
3045
- CardTemplateTypes["Header"] = "header";
3046
- CardTemplateTypes["Body"] = "body";
3047
- CardTemplateTypes["Footer"] = "footer";
3048
- })(CardTemplateTypes || (CardTemplateTypes = {}));
3049
-
3050
- let CardComponent = class CardComponent {
3051
- constructor() {
3052
- this.fullWidth = false;
3053
- this.title = '';
3054
- this.subtitle = '';
3055
- this.icon = '';
3056
- this.showBanner = false;
3057
- }
3058
- ngAfterContentInit() {
3059
- this._getTemplates();
3060
- this._loadImage();
3061
- }
3062
- get hasHeader() {
3063
- const headerTemplate = !!this.headerTemplate;
3064
- const hasHeaderAttributes = this.title || this.subtitle || this.icon;
3065
- return headerTemplate || hasHeaderAttributes;
3066
- }
3067
- _getHeaderTemplate() {
3068
- return this._getCustomTemplate(CardTemplateTypes.Header);
3069
- }
3070
- _getBodyTemplate() {
3071
- return this._getCustomTemplate(CardTemplateTypes.Body);
3072
- }
3073
- _getFooterTemplate() {
3074
- return this._getCustomTemplate(CardTemplateTypes.Footer);
3075
- }
3076
- _getCustomTemplate(type) {
3077
- var _a;
3078
- return (_a = this.templates.find((template) => template.type === type)) === null || _a === void 0 ? void 0 : _a.template;
3079
- }
3080
- _getTemplates() {
3081
- this.headerTemplate = this._getHeaderTemplate();
3082
- this.bodyTemplate = this._getBodyTemplate();
3083
- this.footerTemplate = this._getFooterTemplate();
3084
- }
3085
- _loadImage() {
3086
- const img = new Image();
3087
- img.src = this.bannerImage;
3088
- img.onload = () => (this.showBanner = true);
3089
- img.onerror = () => (this.showBanner = false);
3090
- }
3091
- };
3092
- __decorate([
3093
- Input()
3094
- ], CardComponent.prototype, "bannerImage", void 0);
3095
- __decorate([
3096
- Input()
3097
- ], CardComponent.prototype, "fullWidth", void 0);
3098
- __decorate([
3099
- Input()
3100
- ], CardComponent.prototype, "title", void 0);
3101
- __decorate([
3102
- Input()
3103
- ], CardComponent.prototype, "subtitle", void 0);
3104
- __decorate([
3105
- Input()
3106
- ], CardComponent.prototype, "icon", void 0);
3107
- __decorate([
3108
- ContentChildren(TemplateDirective)
3109
- ], CardComponent.prototype, "templates", void 0);
3110
- CardComponent = __decorate([
3111
- Component({
3112
- selector: "s-card",
3113
- template: "<div class=\"card\" [ngClass]=\"{ 'card--full-width': fullWidth }\">\n <div\n *ngIf=\"showBanner\"\n class=\"banner\"\n [ngStyle]=\"{'background-image': 'url(' + bannerImage + ')'}\">\n </div>\n\n <ng-container *ngIf=\"hasHeader\">\n <div class=\"header\">\n <ng-container *ngIf=\"headerTemplate\">\n <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n </ng-container>\n <ng-container *ngIf=\"!headerTemplate\">\n <div class=\"header-content\">\n <div class=\"header-icon\" *ngIf=\"icon\">\n <i [class]=\"icon\"></i>\n </div>\n <div>\n <div class=\"header-title\" *ngIf=\"title\">\n {{ title }}\n </div>\n <div class=\"header-subtitle\" *ngIf=\"subtitle\">\n {{ subtitle }}\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n </ng-container>\n <div *ngIf=\"bodyTemplate\" class=\"body\">\n <ng-container *ngTemplateOutlet=\"bodyTemplate\"></ng-container>\n </div>\n <ng-container *ngIf=\"!bodyTemplate\">\n <div class=\"body\">\n <ng-content></ng-content>\n </div>\n </ng-container>\n <div *ngIf=\"footerTemplate\" class=\"footer\">\n <ng-container *ngTemplateOutlet=\"footerTemplate\"></ng-container>\n </div>\n</div>\n",
3114
- styles: [".card{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column;background-color:#fff;border-radius:4px;box-shadow:0 1px 5px 0 #00000040;overflow:hidden}.card--full-width{width:100%}.card .banner{background-repeat:no-repeat;background-size:cover;height:150px;width:100%}.card .header{padding:16px 12px}.card .header-content{display:-ms-flexbox;display:flex;gap:12px}.card .header-title{color:#212533;font-size:14px;font-style:normal;font-weight:700}.card .header-subtitle{color:#6e7280;font-size:14px;font-style:normal;font-weight:400}.card .header-icon{border-radius:50%;background-color:#dedce5;width:3em;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-height:3em}.card .body,.card .footer{padding:16px}.card .body+.footer,.card .header+.body{border-top:1px solid #c1c1cc}"]
3115
- })
3116
- ], CardComponent);
3117
-
3118
- let TemplateModule = class TemplateModule {
3119
- };
3120
- TemplateModule = __decorate([
3121
- NgModule({
3122
- imports: [CommonModule],
3123
- declarations: [TemplateDirective],
3124
- exports: [TemplateDirective],
3125
- })
3126
- ], TemplateModule);
3127
-
3128
- let CardModule = class CardModule {
3129
- };
3130
- CardModule = __decorate([
3131
- NgModule({
3132
- imports: [CommonModule],
3133
- declarations: [CardComponent],
3134
- exports: [CardComponent, TemplateModule],
3135
- })
3136
- ], CardModule);
3137
-
3138
- let ChatComponent = class ChatComponent {
3139
- constructor() {
3140
- this.messages = [];
3141
- }
3142
- ngAfterViewInit() {
3143
- this.scrollToBottom();
3144
- this.messageElements.changes.subscribe(() => {
3145
- this.scrollToBottom();
3146
- });
3147
- }
3148
- scrollToBottom() {
3149
- var _a, _b;
3150
- (_b = (_a = this.messageElements) === null || _a === void 0 ? void 0 : _a.last) === null || _b === void 0 ? void 0 : _b.nativeElement.scrollIntoView({ behavior: "smooth" });
3151
- }
3152
- };
3153
- __decorate([
3154
- Input()
3155
- ], ChatComponent.prototype, "messages", void 0);
3156
- __decorate([
3157
- ViewChildren("messageElements", { read: ElementRef })
3158
- ], ChatComponent.prototype, "messageElements", void 0);
3159
- ChatComponent = __decorate([
3160
- Component({
3161
- selector: "s-chat",
3162
- template: "<div class=\"chat-container\">\n <s-chat-message #messageElements *ngFor=\"let message of messages\" [message]=\"message\"> </s-chat-message>\n</div>\n",
3163
- styles: [".chat-container{min-height:500px;overflow:auto}"]
3164
- })
3165
- ], ChatComponent);
3166
-
3167
- let LocalizedBignumberPipe = class LocalizedBignumberPipe {
3168
- constructor(localeService) {
3169
- this.localeService = localeService;
3170
- }
3171
- transform(value, options) {
3172
- return value !== undefined && value !== null ? this.applyMask(value, options) : of(value);
3173
- }
3174
- applyMask(value, options) {
3175
- return this.localeService.get().pipe(map(localeConfig => {
3176
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
3177
- const configs = {
3178
- prefix: (_c = (_a = options === null || options === void 0 ? void 0 : options.prefix) !== null && _a !== void 0 ? _a : (_b = localeConfig === null || localeConfig === void 0 ? void 0 : localeConfig.number) === null || _b === void 0 ? void 0 : _b.currencySymbol) !== null && _c !== void 0 ? _c : "R$",
3179
- thousandsSeparator: (_f = (_d = options === null || options === void 0 ? void 0 : options.thousandsSeparator) !== null && _d !== void 0 ? _d : (_e = localeConfig === null || localeConfig === void 0 ? void 0 : localeConfig.number) === null || _e === void 0 ? void 0 : _e.thousandsSeparator) !== null && _f !== void 0 ? _f : ".",
3180
- decimalSeparator: (_j = (_g = options === null || options === void 0 ? void 0 : options.decimalSeparator) !== null && _g !== void 0 ? _g : (_h = localeConfig === null || localeConfig === void 0 ? void 0 : localeConfig.number) === null || _h === void 0 ? void 0 : _h.decimalSeparator) !== null && _j !== void 0 ? _j : ",",
3181
- scale: (_k = options === null || options === void 0 ? void 0 : options.scale) !== null && _k !== void 0 ? _k : 2,
3182
- allowNegative: (_l = options === null || options === void 0 ? void 0 : options.allowNegative) !== null && _l !== void 0 ? _l : true
3183
- };
3184
- const isNumber = !(new BigNumber(value).isNaN());
3185
- return applyMask(value, configs, isNumber);
3186
- }));
3187
- }
3188
- };
3189
- LocalizedBignumberPipe.ctorParameters = () => [
3190
- { type: LocaleService }
3191
- ];
3192
- LocalizedBignumberPipe = __decorate([
3193
- Pipe({
3194
- name: "localizedBignumber",
3195
- })
3196
- ], LocalizedBignumberPipe);
3197
-
3198
- let LocalizedBignumberImpurePipe = class LocalizedBignumberImpurePipe extends LocalizedBignumberPipe {
3199
- transform(value, options) {
3200
- return super.transform(value, options);
3201
- }
3202
- };
3203
- LocalizedBignumberImpurePipe = __decorate([
3204
- Pipe({
3205
- name: "localizedBignumberImpure",
3206
- pure: false,
3207
- })
3208
- ], LocalizedBignumberImpurePipe);
3209
-
3210
- class LocalizedCurrencyPipeOptions extends NumberLocaleOptions {
3211
- constructor(config = {}) {
3212
- super(config);
3213
- this.scale = 2;
3214
- }
3215
- }
3216
- /**
3217
- * @deprecated Should use localizedBignumberPipe instead
3218
- */
3219
- let LocalizedCurrencyPipe = class LocalizedCurrencyPipe {
3220
- constructor(localeService) {
3221
- this.localeService = localeService;
3222
- }
3223
- transform(value, options) {
3224
- if (!options) {
3225
- options = new LocalizedCurrencyPipeOptions();
3226
- }
3227
- return value !== undefined && value !== null ? this.applyMask(value, options) : of(value);
3228
- }
3229
- applyMask(value, options) {
3230
- return this.localeService.get().pipe(map(localeConfig => {
3231
- const config = Object.assign(Object.assign({}, localeConfig.number), options);
3232
- const { scale, currencySymbol, thousandsSeparator, decimalSeparator } = config;
3233
- const rawValue = Number(value).toFixed(scale);
3234
- const onlyNumbers = rawValue.replace(/[^0-9]/g, ``);
3235
- const integerPart = onlyNumbers
3236
- .slice(0, onlyNumbers.length - scale)
3237
- .replace(/^0*/g, ``)
3238
- .replace(/\B(?=(\d{3})+(?!\d))/g, thousandsSeparator) || `0`;
3239
- const decimalPart = onlyNumbers.slice(onlyNumbers.length - scale);
3240
- const newValue = scale ? integerPart + decimalSeparator + decimalPart : integerPart;
3241
- const isZero = !Number(onlyNumbers);
3242
- const operator = rawValue.includes("-") && !isZero ? "-" : "";
3243
- return `${operator}${currencySymbol}${newValue}`;
3244
- }));
3245
- }
3246
- };
3247
- LocalizedCurrencyPipe.ctorParameters = () => [
3248
- { type: LocaleService }
3249
- ];
3250
- LocalizedCurrencyPipe = __decorate([
3251
- Pipe({
3252
- name: "localizedCurrency",
3253
- })
3254
- ], LocalizedCurrencyPipe);
3255
-
3256
- /**
3257
- * @deprecated Should use localizedBignumberPipe instead
3258
- */
3259
- let LocalizedCurrencyImpurePipe = class LocalizedCurrencyImpurePipe extends LocalizedCurrencyPipe {
3260
- transform(value, options = new LocalizedCurrencyPipeOptions()) {
3261
- return super.transform(value, options);
3262
- }
3263
- };
3264
- LocalizedCurrencyImpurePipe = __decorate([
3265
- Pipe({
3266
- name: "localizedCurrencyImpure",
3267
- pure: false,
3268
- })
3269
- ], LocalizedCurrencyImpurePipe);
3270
-
3271
- const moment$1 = moment_; // @HACK Necessary because of https://github.com/rollup/rollup/issues/670
3272
- let LocalizedDatePipe = class LocalizedDatePipe {
3273
- constructor(localeService) {
3274
- this.localeService = localeService;
3275
- }
3276
- transform(value, format = "L LTS") {
3277
- return this.localeService.get().pipe(map(() => (value ? moment$1(value).format(format) : value)));
3278
- }
3279
- };
3280
- LocalizedDatePipe.ctorParameters = () => [
3281
- { type: LocaleService }
3282
- ];
3283
- LocalizedDatePipe = __decorate([
3284
- Pipe({
3285
- name: "localizedDate",
3286
- })
3287
- ], LocalizedDatePipe);
3288
-
3289
- let LocalizedDateImpurePipe = class LocalizedDateImpurePipe extends LocalizedDatePipe {
3290
- };
3291
- LocalizedDateImpurePipe = __decorate([
3292
- Pipe({
3293
- name: "localizedDateImpure",
3294
- pure: false,
3295
- })
3296
- ], LocalizedDateImpurePipe);
3297
-
3298
- /**
3299
- * @deprecated Should use localizedBignumberPipe instead
3300
- */
3301
- let LocalizedNumberPipe = class LocalizedNumberPipe {
3302
- constructor(localeService) {
3303
- this.localeService = localeService;
3304
- }
3305
- transform(value, minimumFractionDigits) {
3306
- return from(this.localeService.getLocale()).pipe(map((locale) => {
3307
- const numericValue = Number(value);
3308
- if (!value && isNaN(numericValue))
3309
- return;
3310
- return new Intl.NumberFormat(locale, {
3311
- minimumFractionDigits: minimumFractionDigits || 0,
3312
- }).format(Number(value));
3313
- }));
3314
- }
3315
- };
3316
- LocalizedNumberPipe.ctorParameters = () => [
3317
- { type: LocaleService }
3318
- ];
3319
- LocalizedNumberPipe = __decorate([
3320
- Pipe({ name: "localizedNumber" })
3321
- ], LocalizedNumberPipe);
3322
-
3323
- const moment$2 = moment_; // @HACK Necessary because of https://github.com/rollup/rollup/issues/670
3324
- let LocalizedTimePipe = class LocalizedTimePipe {
3325
- constructor(localeService) {
3326
- this.localeService = localeService;
3327
- }
3328
- transform(value, format = "LTS") {
3329
- return this.localeService.get().pipe(map(() => (value ? moment$2(value, "HH:mm:ss").format(format) : value)));
3330
- }
3331
- };
3332
- LocalizedTimePipe.ctorParameters = () => [
3333
- { type: LocaleService }
3334
- ];
3335
- LocalizedTimePipe = __decorate([
3336
- Pipe({
3337
- name: "localizedTime",
3338
- })
3339
- ], LocalizedTimePipe);
3340
-
3341
- let LocalizedTimeImpurePipe = class LocalizedTimeImpurePipe extends LocalizedTimePipe {
3342
- };
3343
- LocalizedTimeImpurePipe = __decorate([
3344
- Pipe({
3345
- name: "localizedTimeImpure",
3346
- pure: false,
3347
- })
3348
- ], LocalizedTimeImpurePipe);
3349
-
3350
- let CurrencyService = class CurrencyService {
3351
- constructor(localeService) {
3352
- this.localeService = localeService;
3353
- this.currencies = {
3354
- KHR: { precision: 12, scale: 2 },
3355
- SSP: { precision: 12, scale: 2 },
3356
- XCD: { precision: 12, scale: 2 },
3357
- EGP: { precision: 12, scale: 2 },
3358
- KWD: { precision: 12, scale: 3 },
3359
- YER: { precision: 12, scale: 2 },
3360
- HUF: { precision: 12, scale: 2 },
3361
- MXN: { precision: 12, scale: 2 },
3362
- MYR: { precision: 12, scale: 2 },
3363
- ZWL: { precision: 12, scale: 2 },
3364
- MUR: { precision: 12, scale: 2 },
3365
- DKK: { precision: 12, scale: 2 },
3366
- NOK: { precision: 12, scale: 2 },
3367
- DJF: { precision: 12, scale: 0 },
3368
- CRC: { precision: 12, scale: 2 },
3369
- BND: { precision: 12, scale: 2 },
3370
- NAD: { precision: 12, scale: 2 },
3371
- MKD: { precision: 12, scale: 2 },
3372
- CDF: { precision: 12, scale: 2 },
3373
- GNF: { precision: 12, scale: 0 },
3374
- EUR: { precision: 12, scale: 2 },
3375
- OMR: { precision: 12, scale: 3 },
3376
- CLP: { precision: 12, scale: 0 },
3377
- BSD: { precision: 12, scale: 2 },
3378
- TOP: { precision: 12, scale: 2 },
3379
- IRR: { precision: 12, scale: 2 },
3380
- BGN: { precision: 12, scale: 2 },
3381
- BZD: { precision: 12, scale: 2 },
3382
- CNY: { precision: 12, scale: 2 },
3383
- FJD: { precision: 12, scale: 2 },
3384
- SRD: { precision: 12, scale: 2 },
3385
- SOS: { precision: 12, scale: 2 },
3386
- GYD: { precision: 12, scale: 2 },
3387
- VUV: { precision: 12, scale: 0 },
3388
- MWK: { precision: 12, scale: 2 },
3389
- MRU: { precision: 12, scale: 2 },
3390
- LSL: { precision: 12, scale: 2 },
3391
- ERN: { precision: 12, scale: 2 },
3392
- BMD: { precision: 12, scale: 2 },
3393
- WST: { precision: 12, scale: 2 },
3394
- LRD: { precision: 12, scale: 2 },
3395
- GMD: { precision: 12, scale: 2 },
3396
- ARS: { precision: 12, scale: 2 },
3397
- ZAR: { precision: 12, scale: 2 },
3398
- RSD: { precision: 12, scale: 2 },
3399
- MDL: { precision: 12, scale: 2 },
3400
- USD: { precision: 12, scale: 2 },
3401
- QAR: { precision: 12, scale: 2 },
3402
- HRK: { precision: 12, scale: 2 },
3403
- GIP: { precision: 12, scale: 2 },
3404
- NPR: { precision: 12, scale: 2 },
3405
- "002": { precision: 9, scale: 4 },
3406
- PLN: { precision: 12, scale: 2 },
3407
- MAD: { precision: 12, scale: 2 },
3408
- BAM: { precision: 12, scale: 2 },
3409
- BTN: { precision: 12, scale: 2 },
3410
- BBD: { precision: 12, scale: 2 },
3411
- SHP: { precision: 12, scale: 2 },
3412
- LKR: { precision: 12, scale: 2 },
3413
- KPW: { precision: 12, scale: 2 },
3414
- LAK: { precision: 12, scale: 2 },
3415
- SZL: { precision: 12, scale: 2 },
3416
- PHP: { precision: 12, scale: 2 },
3417
- RWF: { precision: 12, scale: 0 },
3418
- ISK: { precision: 12, scale: 0 },
3419
- XOF: { precision: 12, scale: 0 },
3420
- AUD: { precision: 12, scale: 2 },
3421
- NGN: { precision: 12, scale: 2 },
3422
- KGS: { precision: 12, scale: 2 },
3423
- KYD: { precision: 12, scale: 2 },
3424
- PGK: { precision: 12, scale: 2 },
3425
- DZD: { precision: 12, scale: 2 },
3426
- XAF: { precision: 12, scale: 0 },
3427
- PEN: { precision: 12, scale: 2 },
3428
- JPY: { precision: 12, scale: 0 },
3429
- SBD: { precision: 12, scale: 2 },
3430
- UGX: { precision: 12, scale: 0 },
3431
- AMD: { precision: 12, scale: 2 },
3432
- AED: { precision: 12, scale: 2 },
3433
- ALL: { precision: 12, scale: 2 },
3434
- XPF: { precision: 12, scale: 0 },
3435
- AFN: { precision: 12, scale: 2 },
3436
- RON: { precision: 12, scale: 2 },
3437
- TND: { precision: 12, scale: 3 },
3438
- NZD: { precision: 12, scale: 2 },
3439
- JOD: { precision: 12, scale: 3 },
3440
- VND: { precision: 12, scale: 0 },
3441
- ETB: { precision: 12, scale: 2 },
3442
- PYG: { precision: 12, scale: 0 },
3443
- JMD: { precision: 12, scale: 2 },
3444
- KES: { precision: 12, scale: 2 },
3445
- IDR: { precision: 12, scale: 2 },
3446
- HKD: { precision: 12, scale: 2 },
3447
- BDT: { precision: 12, scale: 2 },
3448
- GBP: { precision: 12, scale: 2 },
3449
- AOA: { precision: 12, scale: 2 },
3450
- PKR: { precision: 12, scale: 2 },
3451
- TRY: { precision: 12, scale: 2 },
3452
- SLL: { precision: 12, scale: 2 },
3453
- CVE: { precision: 12, scale: 2 },
3454
- LYD: { precision: 12, scale: 3 },
3455
- ILS: { precision: 12, scale: 2 },
3456
- UZS: { precision: 12, scale: 2 },
3457
- CHF: { precision: 12, scale: 2 },
3458
- SVC: { precision: 12, scale: 2 },
3459
- BRL: { precision: 12, scale: 2 },
3460
- GHS: { precision: 12, scale: 2 },
3461
- CUP: { precision: 12, scale: 2 },
3462
- FKP: { precision: 12, scale: 2 },
3463
- NIO: { precision: 12, scale: 2 },
3464
- GEL: { precision: 12, scale: 2 },
3465
- TTD: { precision: 12, scale: 2 },
3466
- AAA: { precision: 1, scale: 1 },
3467
- COP: { precision: 12, scale: 2 },
3468
- MGA: { precision: 12, scale: 2 },
3469
- INR: { precision: 12, scale: 2 },
3470
- KRW: { precision: 12, scale: 0 },
3471
- HNL: { precision: 12, scale: 2 },
3472
- MMK: { precision: 12, scale: 2 },
3473
- TZS: { precision: 12, scale: 2 },
3474
- THB: { precision: 12, scale: 2 },
3475
- TMT: { precision: 12, scale: 2 },
3476
- SAR: { precision: 12, scale: 2 },
3477
- UYU: { precision: 12, scale: 2 },
3478
- BIF: { precision: 12, scale: 0 },
3479
- MVR: { precision: 12, scale: 2 },
3480
- RUB: { precision: 12, scale: 2 },
3481
- GTQ: { precision: 12, scale: 2 },
3482
- SCR: { precision: 12, scale: 2 },
3483
- IQD: { precision: 12, scale: 3 },
3484
- UAH: { precision: 12, scale: 2 },
3485
- BYN: { precision: 12, scale: 2 },
3486
- VES: { precision: 12, scale: 2 },
3487
- BOB: { precision: 12, scale: 2 },
3488
- SGD: { precision: 12, scale: 2 },
3489
- ZMW: { precision: 12, scale: 2 },
3490
- CZK: { precision: 12, scale: 2 },
3491
- TJS: { precision: 12, scale: 2 },
3492
- DOP: { precision: 12, scale: 2 },
3493
- AZN: { precision: 12, scale: 2 },
3494
- PAB: { precision: 12, scale: 2 },
3495
- STN: { precision: 12, scale: 2 },
3496
- SDG: { precision: 12, scale: 2 },
3497
- BWP: { precision: 12, scale: 2 },
3498
- BHD: { precision: 12, scale: 3 },
3499
- CAD: { precision: 12, scale: 2 },
3500
- MNT: { precision: 12, scale: 2 },
3501
- MOP: { precision: 12, scale: 2 },
3502
- HTG: { precision: 12, scale: 2 },
3503
- KZT: { precision: 12, scale: 2 },
3504
- LBP: { precision: 12, scale: 2 },
3505
- SYP: { precision: 12, scale: 2 },
3506
- TWD: { precision: 12, scale: 2 },
3507
- MZN: { precision: 12, scale: 2 },
3508
- ANG: { precision: 12, scale: 2 },
3509
- SEK: { precision: 12, scale: 2 },
3510
- KMF: { precision: 12, scale: 0 },
3511
- AWG: { precision: 12, scale: 2 },
3512
- };
3513
- }
3514
- getCurrencySymbol({ currency }) {
3515
- var _a, _b;
3516
- const numberFormat = new Intl.NumberFormat(this.localeService.getLocaleOptions().locale, {
3517
- style: "currency",
3518
- currency: currency !== null && currency !== void 0 ? currency : "BRL",
3519
- currencyDisplay: "narrowSymbol",
3520
- maximumFractionDigits: 5,
3521
- });
3522
- return (_b = (_a = numberFormat.formatToParts(1).find((x) => x.type === "currency")) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "";
3308
+ getPlaceholder(i) {
3309
+ if (i < this.slotChar.length)
3310
+ return this.slotChar.charAt(i);
3311
+ return this.slotChar.charAt(0);
3523
3312
  }
3524
- };
3525
- CurrencyService.ctorParameters = () => [
3526
- { type: LocaleService }
3527
- ];
3528
- CurrencyService.ɵprov = ɵɵdefineInjectable({ factory: function CurrencyService_Factory() { return new CurrencyService(ɵɵinject(LocaleService)); }, token: CurrencyService, providedIn: "root" });
3529
- CurrencyService = __decorate([
3530
- Injectable({ providedIn: "root" })
3531
- ], CurrencyService);
3532
-
3533
- let NumericService = class NumericService {
3534
- constructor(localeService, currencyService) {
3535
- this.localeService = localeService;
3536
- this.currencyService = currencyService;
3313
+ seekNext(pos) {
3314
+ while (++pos < this.len) {
3315
+ if (this.tests[pos])
3316
+ break;
3317
+ }
3318
+ return pos;
3537
3319
  }
3538
- /**
3539
- * Wrapper around Intl.NumberFormat that returns the localized value using the user's locale by default(platform's preferential language).
3540
- *
3541
- * This method should only be used after the localeService has been initialized by the host application, either by a resolver or a manual call.
3542
- *
3543
- * Can be overwritten by the provided Intl.NumberFormatOptions.
3544
- *
3545
- * Documentation is available at {@link https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat Intl.NumberFormatOptions}.
3546
- *
3547
- * @param {number | string | BigNumber} value The value to be formatted.
3548
- * @param options Locale and numberFormatOptions that overwrites the default Intl.NumberFormatOptions.
3549
- * @return `string` The formatted value.
3550
- */
3551
- instant(value, options) {
3552
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
3553
- if (isNullOrUndefined(value))
3554
- return null;
3555
- options = Object.assign(Object.assign({}, options), { locale: (_c = (_a = options === null || options === void 0 ? void 0 : options.locale) !== null && _a !== void 0 ? _a : (_b = this.localeService.getLocaleOptions()) === null || _b === void 0 ? void 0 : _b.locale) !== null && _c !== void 0 ? _c : "pt-BR", numberFormatOptions: Object.assign(Object.assign({ useGrouping: true }, options === null || options === void 0 ? void 0 : options.numberFormatOptions), { currency: ((_d = options === null || options === void 0 ? void 0 : options.numberFormatOptions) === null || _d === void 0 ? void 0 : _d.style) === "currency" ? ((_f = (_e = options === null || options === void 0 ? void 0 : options.numberFormatOptions) === null || _e === void 0 ? void 0 : _e.currency) !== null && _f !== void 0 ? _f : "BRL") : undefined, currencyDisplay: ((_g = options === null || options === void 0 ? void 0 : options.numberFormatOptions) === null || _g === void 0 ? void 0 : _g.style) === "currency"
3556
- ? ((_j = (_h = options === null || options === void 0 ? void 0 : options.numberFormatOptions) === null || _h === void 0 ? void 0 : _h.currencyDisplay) !== null && _j !== void 0 ? _j : "narrowSymbol")
3557
- : undefined, minimumFractionDigits: (_l = (_k = options === null || options === void 0 ? void 0 : options.numberFormatOptions) === null || _k === void 0 ? void 0 : _k.minimumFractionDigits) !== null && _l !== void 0 ? _l : this.getCurrencyMinimumFractionDigits((_m = options === null || options === void 0 ? void 0 : options.numberFormatOptions) === null || _m === void 0 ? void 0 : _m.currency) }) });
3558
- options.numberFormatOptions["roundingMode"] = "trunc";
3559
- // From https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
3560
- return new Intl.NumberFormat(options.locale, options.numberFormatOptions).format(this.getType(value) === "number" || this.getType(value) === "string" ? value : value.toString());
3320
+ seekPrev(pos) {
3321
+ while (--pos >= 0 && !this.tests[pos]) {
3322
+ if (this.tests[pos])
3323
+ break;
3324
+ }
3325
+ return pos;
3561
3326
  }
3562
- getCurrencyMinimumFractionDigits(currency) {
3563
- var _a;
3564
- if (!currency)
3565
- return null;
3566
- return (_a = this.currencyService.currencies[currency.toUpperCase()]) === null || _a === void 0 ? void 0 : _a.scale;
3327
+ shiftL(begin, end) {
3328
+ let i;
3329
+ let j;
3330
+ if (begin < 0) {
3331
+ return;
3332
+ }
3333
+ j = this.seekNext(end);
3334
+ for (i = begin; i < this.len; i++) {
3335
+ if (this.tests[i]) {
3336
+ if (j < this.len && this.tests[i].test(this.buffer[j])) {
3337
+ this.buffer[i] = this.buffer[j];
3338
+ this.buffer[j] = this.getPlaceholder(j);
3339
+ }
3340
+ else
3341
+ break;
3342
+ j = this.seekNext(j);
3343
+ }
3344
+ }
3345
+ this.writeBuffer();
3346
+ this.caret(Math.max(this.firstNonMaskPos, begin));
3567
3347
  }
3568
- getType(value) {
3569
- // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof
3570
- if (value === null) {
3571
- return "null";
3348
+ shiftR(pos) {
3349
+ let i;
3350
+ let c = this.getPlaceholder(pos);
3351
+ let j;
3352
+ let t;
3353
+ for (i = pos; i < this.len; i++) {
3354
+ if (this.tests[i]) {
3355
+ j = this.seekNext(i);
3356
+ t = this.buffer[i];
3357
+ this.buffer[i] = c;
3358
+ if (j < this.len && this.tests[j].test(t)) {
3359
+ c = t;
3360
+ }
3361
+ else
3362
+ break;
3363
+ }
3572
3364
  }
3573
- const baseType = typeof value;
3574
- // Primitive types
3575
- if (baseType !== "object" && baseType !== "function") {
3576
- return baseType;
3365
+ }
3366
+ handleAndroidInput(e) {
3367
+ const curVal = this.input.value;
3368
+ const pos = this.caret();
3369
+ if (this.oldVal && this.oldVal.length && this.oldVal.length > curVal.length) {
3370
+ // A deletion or backspace happened
3371
+ this.checkVal(true);
3372
+ while (pos.begin > 0 && !this.tests[pos.begin - 1]) {
3373
+ pos.begin--;
3374
+ }
3375
+ if (pos.begin === 0) {
3376
+ while (pos.begin < this.firstNonMaskPos && !this.tests[pos.begin]) {
3377
+ pos.begin++;
3378
+ }
3379
+ }
3380
+ setTimeout(() => {
3381
+ this.caret(pos.begin, pos.begin);
3382
+ if (this.isCompleted()) {
3383
+ const sentVal = curVal.replace(this.slotChar, ""); // Limpa os caracteres placeholders extras caso ele esteja completo
3384
+ this.updateCalendarValue(sentVal);
3385
+ }
3386
+ }, 0);
3577
3387
  }
3578
- // Symbol.toStringTag often specifies the "display name" of the
3579
- // object's class. It's used in Object.prototype.toString().
3580
- const tag = value[Symbol.toStringTag];
3581
- if (typeof tag === "string") {
3582
- return tag;
3388
+ else {
3389
+ this.checkVal(true);
3390
+ while (pos.begin < this.len && !this.tests[pos.begin]) {
3391
+ pos.begin++;
3392
+ }
3393
+ setTimeout(() => {
3394
+ this.caret(pos.begin, pos.begin);
3395
+ if (this.isCompleted()) {
3396
+ const sentVal = curVal.replace(this.slotChar, ""); // Limpa os caracteres placeholders extras caso ele esteja completo
3397
+ this.updateCalendarValue(sentVal);
3398
+ }
3399
+ }, 0);
3583
3400
  }
3584
- // If it's a function whose source code starts with the "class" keyword
3585
- if (baseType === "function" && Function.prototype.toString.call(value).startsWith("class")) {
3586
- return "class";
3401
+ }
3402
+ updateCalendarValue(sentVal) {
3403
+ // TODO verificar
3404
+ const dateVal = this.host.parseValueFromString(sentVal);
3405
+ if (this.host.isSelectable(dateVal.getDate(), dateVal.getMonth(), dateVal.getFullYear(), false)) {
3406
+ this.host.updateModel(sentVal);
3407
+ this.host.updateUI();
3408
+ }
3409
+ }
3410
+ clearBuffer(start, end) {
3411
+ let i;
3412
+ for (i = start; i < end && i < this.len; i++) {
3413
+ if (this.tests[i]) {
3414
+ this.buffer[i] = this.getPlaceholder(i);
3415
+ }
3416
+ }
3417
+ }
3418
+ writeBuffer() {
3419
+ this.input.value = this.buffer.join("");
3420
+ }
3421
+ createMaskFromDateFormat() {
3422
+ const calendar = this.host;
3423
+ let mask = this.autoClear ? "?" : "";
3424
+ if (!calendar.timeOnly) {
3425
+ let dateFormat = calendar.dateFormat;
3426
+ dateFormat = dateFormat.replace(/y/g, "yy");
3427
+ mask += dateFormat.replace(/[^/*,.\-+\[\]\\]/g, "9");
3428
+ if (calendar.showTime) {
3429
+ mask += " ";
3430
+ }
3431
+ }
3432
+ if (calendar.showTime || calendar.timeOnly) {
3433
+ mask += "99:99";
3434
+ if (calendar.showSeconds) {
3435
+ mask += ":99";
3436
+ }
3437
+ }
3438
+ this._mask = mask;
3439
+ this.initMask();
3440
+ }
3441
+ isCompleted() {
3442
+ for (let i = this.firstNonMaskPos; i <= this.lastRequiredNonMaskPos; i++) {
3443
+ if (this.tests[i] && this.buffer[i] === this.getPlaceholder(i)) {
3444
+ return false;
3445
+ }
3446
+ }
3447
+ return true;
3448
+ }
3449
+ ngAfterViewChecked() {
3450
+ if (this.host.inputfieldViewChild && this.firstTime) {
3451
+ this.firstTime = false;
3452
+ this.setListeners();
3453
+ this.input.type = "tel";
3454
+ }
3455
+ }
3456
+ ngOnDestroy() {
3457
+ if (this.focusListener)
3458
+ this.focusListener();
3459
+ if (this.blurListener)
3460
+ this.blurListener();
3461
+ if (this.keydownListener)
3462
+ this.keydownListener();
3463
+ if (this.keypressListener)
3464
+ this.keypressListener();
3465
+ if (this.inputListener)
3466
+ this.inputListener();
3467
+ if (this.pasteListener)
3468
+ this.pasteListener();
3469
+ }
3470
+ onKeydownEventTest(e) {
3471
+ const { key } = e;
3472
+ if (key == "Tab") {
3473
+ // Este código foi implementado para corrigir um problema no componente na v9
3474
+ // Deve ser removido assim que atualizarmos o PrimeNG para a v10
3475
+ const allFocusableElements = document.querySelectorAll(this.SELECTORS);
3476
+ let nextIsFocusable = false;
3477
+ let previousFocusable;
3478
+ let forceCloseModal = true;
3479
+ allFocusableElements.forEach((element) => {
3480
+ if (!e.shiftKey) {
3481
+ if (nextIsFocusable && element.id) {
3482
+ this.focusableElement(element.id, forceCloseModal);
3483
+ nextIsFocusable = false;
3484
+ e.preventDefault();
3485
+ return;
3486
+ }
3487
+ }
3488
+ let activeTagName = window.document.activeElement.tagName;
3489
+ if (e.shiftKey && element.id && element.tagName === "INPUT" && activeTagName == "BUTTON") {
3490
+ previousFocusable = element.id;
3491
+ forceCloseModal = false;
3492
+ }
3493
+ if (element.id === this.host.inputId) {
3494
+ if (previousFocusable) {
3495
+ this.focusableElement(previousFocusable, forceCloseModal);
3496
+ e.preventDefault();
3497
+ forceCloseModal = true;
3498
+ return;
3499
+ }
3500
+ nextIsFocusable = true;
3501
+ }
3502
+ else if (e.shiftKey && element.id) {
3503
+ previousFocusable = element.id;
3504
+ }
3505
+ });
3587
3506
  }
3588
- // The name of the constructor; for example `Array`, `GeneratorFunction`,
3589
- // `Number`, `String`, `Boolean` or `MyCustomClass`
3590
- const className = value.constructor.name;
3591
- if (typeof className === "string" && className !== "") {
3592
- return className;
3507
+ }
3508
+ focusableElement(id, hide) {
3509
+ const htmlElement = window.document.getElementById(id);
3510
+ htmlElement.focus();
3511
+ if (hide) {
3512
+ this.host.hideOverlay();
3593
3513
  }
3594
- // At this point there's no robust way to get the type of value,
3595
- // so we use the base implementation.
3596
- return baseType;
3597
3514
  }
3598
3515
  };
3599
- NumericService.ctorParameters = () => [
3600
- { type: LocaleService },
3601
- { type: CurrencyService }
3516
+ CalendarMaskDirective.ctorParameters = () => [
3517
+ { type: Calendar },
3518
+ { type: Renderer2 }
3602
3519
  ];
3603
- NumericService.ɵprov = ɵɵdefineInjectable({ factory: function NumericService_Factory() { return new NumericService(ɵɵinject(LocaleService), ɵɵinject(CurrencyService)); }, token: NumericService, providedIn: "root" });
3604
- NumericService = __decorate([
3605
- Injectable({
3606
- providedIn: "root",
3520
+ __decorate([
3521
+ Input()
3522
+ ], CalendarMaskDirective.prototype, "slotChar", void 0);
3523
+ __decorate([
3524
+ Input()
3525
+ ], CalendarMaskDirective.prototype, "autoClear", void 0);
3526
+ __decorate([
3527
+ HostListener("keydown", ["$event"])
3528
+ ], CalendarMaskDirective.prototype, "onKeydownEventTest", null);
3529
+ CalendarMaskDirective = __decorate([
3530
+ Directive({
3531
+ selector: "p-calendar[sCalendarMask]",
3607
3532
  })
3608
- ], NumericService);
3533
+ ], CalendarMaskDirective);
3609
3534
 
3610
- let NumericPipe = class NumericPipe {
3611
- constructor(numericService, localeService) {
3612
- this.numericService = numericService;
3613
- this.localeService = localeService;
3614
- }
3615
- transform(value, options) {
3616
- return (options === null || options === void 0 ? void 0 : options.locale) ? of(this.numericService.instant(value, options))
3617
- : this.localeService.getLocale().pipe(map((locale) => this.numericService.instant(value, {
3618
- locale,
3619
- numberFormatOptions: options === null || options === void 0 ? void 0 : options.numberFormatOptions,
3620
- })));
3535
+ let CalendarMaskModule = class CalendarMaskModule {
3536
+ };
3537
+ CalendarMaskModule = __decorate([
3538
+ NgModule({
3539
+ declarations: [CalendarMaskDirective],
3540
+ imports: [CommonModule],
3541
+ exports: [CalendarMaskDirective],
3542
+ })
3543
+ ], CalendarMaskModule);
3544
+
3545
+ let TemplateDirective = class TemplateDirective {
3546
+ constructor(template) {
3547
+ this.template = template;
3621
3548
  }
3622
3549
  };
3623
- NumericPipe.ctorParameters = () => [
3624
- { type: NumericService },
3625
- { type: LocaleService }
3550
+ TemplateDirective.ctorParameters = () => [
3551
+ { type: TemplateRef }
3626
3552
  ];
3627
- NumericPipe = __decorate([
3628
- Pipe({ name: "numeric" })
3629
- ], NumericPipe);
3553
+ __decorate([
3554
+ Input("sTemplate")
3555
+ ], TemplateDirective.prototype, "type", void 0);
3556
+ TemplateDirective = __decorate([
3557
+ Directive({
3558
+ selector: "[sTemplate]",
3559
+ })
3560
+ ], TemplateDirective);
3630
3561
 
3631
- var LocaleModule_1;
3632
- let LocaleModule = LocaleModule_1 = class LocaleModule {
3633
- static forRoot() {
3634
- return {
3635
- ngModule: LocaleModule_1,
3636
- providers: [
3637
- LocaleService,
3638
- LocalizedCurrencyPipe,
3639
- LocalizedDatePipe,
3640
- LocalizedTimePipe,
3641
- LocalizedNumberPipe,
3642
- LocalizedCurrencyImpurePipe,
3643
- LocalizedDateImpurePipe,
3644
- LocalizedTimeImpurePipe,
3645
- LocalizedBignumberPipe,
3646
- LocalizedBignumberImpurePipe,
3647
- NumericPipe
3648
- ],
3649
- };
3562
+ var CardTemplateTypes;
3563
+ (function (CardTemplateTypes) {
3564
+ CardTemplateTypes["Header"] = "header";
3565
+ CardTemplateTypes["Body"] = "body";
3566
+ CardTemplateTypes["Footer"] = "footer";
3567
+ })(CardTemplateTypes || (CardTemplateTypes = {}));
3568
+
3569
+ let CardComponent = class CardComponent {
3570
+ constructor() {
3571
+ this.fullWidth = false;
3572
+ this.title = '';
3573
+ this.subtitle = '';
3574
+ this.icon = '';
3575
+ this.showBanner = false;
3650
3576
  }
3651
- static forChild() {
3652
- return {
3653
- ngModule: LocaleModule_1,
3654
- };
3577
+ ngAfterContentInit() {
3578
+ this._getTemplates();
3579
+ this._loadImage();
3580
+ }
3581
+ get hasHeader() {
3582
+ const headerTemplate = !!this.headerTemplate;
3583
+ const hasHeaderAttributes = this.title || this.subtitle || this.icon;
3584
+ return headerTemplate || hasHeaderAttributes;
3585
+ }
3586
+ _getHeaderTemplate() {
3587
+ return this._getCustomTemplate(CardTemplateTypes.Header);
3588
+ }
3589
+ _getBodyTemplate() {
3590
+ return this._getCustomTemplate(CardTemplateTypes.Body);
3591
+ }
3592
+ _getFooterTemplate() {
3593
+ return this._getCustomTemplate(CardTemplateTypes.Footer);
3594
+ }
3595
+ _getCustomTemplate(type) {
3596
+ var _a;
3597
+ return (_a = this.templates.find((template) => template.type === type)) === null || _a === void 0 ? void 0 : _a.template;
3598
+ }
3599
+ _getTemplates() {
3600
+ this.headerTemplate = this._getHeaderTemplate();
3601
+ this.bodyTemplate = this._getBodyTemplate();
3602
+ this.footerTemplate = this._getFooterTemplate();
3603
+ }
3604
+ _loadImage() {
3605
+ const img = new Image();
3606
+ img.src = this.bannerImage;
3607
+ img.onload = () => (this.showBanner = true);
3608
+ img.onerror = () => (this.showBanner = false);
3655
3609
  }
3656
3610
  };
3657
- LocaleModule = LocaleModule_1 = __decorate([
3611
+ __decorate([
3612
+ Input()
3613
+ ], CardComponent.prototype, "bannerImage", void 0);
3614
+ __decorate([
3615
+ Input()
3616
+ ], CardComponent.prototype, "fullWidth", void 0);
3617
+ __decorate([
3618
+ Input()
3619
+ ], CardComponent.prototype, "title", void 0);
3620
+ __decorate([
3621
+ Input()
3622
+ ], CardComponent.prototype, "subtitle", void 0);
3623
+ __decorate([
3624
+ Input()
3625
+ ], CardComponent.prototype, "icon", void 0);
3626
+ __decorate([
3627
+ ContentChildren(TemplateDirective)
3628
+ ], CardComponent.prototype, "templates", void 0);
3629
+ CardComponent = __decorate([
3630
+ Component({
3631
+ selector: "s-card",
3632
+ template: "<div class=\"card\" [ngClass]=\"{ 'card--full-width': fullWidth }\">\n <div\n *ngIf=\"showBanner\"\n class=\"banner\"\n [ngStyle]=\"{'background-image': 'url(' + bannerImage + ')'}\">\n </div>\n\n <ng-container *ngIf=\"hasHeader\">\n <div class=\"header\">\n <ng-container *ngIf=\"headerTemplate\">\n <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n </ng-container>\n <ng-container *ngIf=\"!headerTemplate\">\n <div class=\"header-content\">\n <div class=\"header-icon\" *ngIf=\"icon\">\n <i [class]=\"icon\"></i>\n </div>\n <div>\n <div class=\"header-title\" *ngIf=\"title\">\n {{ title }}\n </div>\n <div class=\"header-subtitle\" *ngIf=\"subtitle\">\n {{ subtitle }}\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n </ng-container>\n <div *ngIf=\"bodyTemplate\" class=\"body\">\n <ng-container *ngTemplateOutlet=\"bodyTemplate\"></ng-container>\n </div>\n <ng-container *ngIf=\"!bodyTemplate\">\n <div class=\"body\">\n <ng-content></ng-content>\n </div>\n </ng-container>\n <div *ngIf=\"footerTemplate\" class=\"footer\">\n <ng-container *ngTemplateOutlet=\"footerTemplate\"></ng-container>\n </div>\n</div>\n",
3633
+ styles: [".card{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column;background-color:#fff;border-radius:4px;box-shadow:0 1px 5px 0 #00000040;overflow:hidden}.card--full-width{width:100%}.card .banner{background-repeat:no-repeat;background-size:cover;height:150px;width:100%}.card .header{padding:16px 12px}.card .header-content{display:-ms-flexbox;display:flex;gap:12px}.card .header-title{color:#212533;font-size:14px;font-style:normal;font-weight:700}.card .header-subtitle{color:#6e7280;font-size:14px;font-style:normal;font-weight:400}.card .header-icon{border-radius:50%;background-color:#dedce5;width:3em;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-height:3em}.card .body,.card .footer{padding:16px}.card .body+.footer,.card .header+.body{border-top:1px solid #c1c1cc}"]
3634
+ })
3635
+ ], CardComponent);
3636
+
3637
+ let TemplateModule = class TemplateModule {
3638
+ };
3639
+ TemplateModule = __decorate([
3658
3640
  NgModule({
3659
3641
  imports: [CommonModule],
3660
- exports: [
3661
- LocalizedCurrencyPipe,
3662
- LocalizedDatePipe,
3663
- LocalizedTimePipe,
3664
- LocalizedNumberPipe,
3665
- LocalizedCurrencyImpurePipe,
3666
- LocalizedDateImpurePipe,
3667
- LocalizedTimeImpurePipe,
3668
- LocalizedBignumberPipe,
3669
- LocalizedBignumberImpurePipe,
3670
- NumericPipe
3671
- ],
3672
- declarations: [
3673
- LocalizedCurrencyPipe,
3674
- LocalizedDatePipe,
3675
- LocalizedTimePipe,
3676
- LocalizedNumberPipe,
3677
- LocalizedCurrencyImpurePipe,
3678
- LocalizedDateImpurePipe,
3679
- LocalizedTimeImpurePipe,
3680
- LocalizedBignumberPipe,
3681
- LocalizedBignumberImpurePipe,
3682
- NumericPipe
3683
- ],
3642
+ declarations: [TemplateDirective],
3643
+ exports: [TemplateDirective],
3684
3644
  })
3685
- ], LocaleModule);
3645
+ ], TemplateModule);
3646
+
3647
+ let CardModule = class CardModule {
3648
+ };
3649
+ CardModule = __decorate([
3650
+ NgModule({
3651
+ imports: [CommonModule],
3652
+ declarations: [CardComponent],
3653
+ exports: [CardComponent, TemplateModule],
3654
+ })
3655
+ ], CardModule);
3656
+
3657
+ let ChatComponent = class ChatComponent {
3658
+ constructor() {
3659
+ this.messages = [];
3660
+ }
3661
+ ngAfterViewInit() {
3662
+ this.scrollToBottom();
3663
+ this.messageElements.changes.subscribe(() => {
3664
+ this.scrollToBottom();
3665
+ });
3666
+ }
3667
+ scrollToBottom() {
3668
+ var _a, _b;
3669
+ (_b = (_a = this.messageElements) === null || _a === void 0 ? void 0 : _a.last) === null || _b === void 0 ? void 0 : _b.nativeElement.scrollIntoView({ behavior: "smooth" });
3670
+ }
3671
+ };
3672
+ __decorate([
3673
+ Input()
3674
+ ], ChatComponent.prototype, "messages", void 0);
3675
+ __decorate([
3676
+ ViewChildren("messageElements", { read: ElementRef })
3677
+ ], ChatComponent.prototype, "messageElements", void 0);
3678
+ ChatComponent = __decorate([
3679
+ Component({
3680
+ selector: "s-chat",
3681
+ template: "<div class=\"chat-container\">\n <s-chat-message #messageElements *ngFor=\"let message of messages\" [message]=\"message\"> </s-chat-message>\n</div>\n",
3682
+ styles: [".chat-container{min-height:500px;overflow:auto}"]
3683
+ })
3684
+ ], ChatComponent);
3686
3685
 
3687
3686
  let ChatMessageComponent = class ChatMessageComponent {
3688
3687
  constructor() {
@@ -11301,7 +11300,7 @@ __decorate([
11301
11300
  ], TextFieldComponent.prototype, "inputRef", void 0);
11302
11301
  TextFieldComponent = __decorate([
11303
11302
  Component({
11304
- template: "<s-field-label *ngIf=\"inputRef\" [field]=\"field\" [fieldContainerRef]=\"inputRef?.nativeElement\"></s-field-label>\n\n<p-inputMask\n #inputRef\n *ngIf=\"field.mask; else noMask\"\n [type]=\"field.inputType || 'text'\"\n [inputId]=\"field.id || field.name\"\n [name]=\"field.name\"\n [mask]=\"isFunction(field.mask) ? field.mask() : field.mask\"\n [characterPattern]=\"getCharacterPattern()\"\n [unmask]=\"getUnmask()\"\n [placeholder]=\"field.placeholder\"\n slotChar=\"_\"\n [sTooltip]=\"field.tooltip\"\n tooltipPosition=\"top\"\n [showDelay]=\"500\"\n styleClass=\"mousetrap\"\n (onBlur)=\"field.onBlur ? field.onBlur($event) : null\"\n (onFocus)=\"onFocus.next($event)\"\n (onComplete)=\"onComplete.next($event)\"\n (onInput)=\"onInput.next($event)\"\n [formControl]=\"formControl\"\n [readonly]=\"field.readonly ? field.readonly() : false\"\n>\n</p-inputMask>\n\n<ng-template #noMask>\n <ng-container>\n <div class=\"ui-inputgroup\">\n <ng-container *ngIf=\"field.leftAddon\">\n <span *ngIf=\"field.leftAddon.callback\" class=\"addon-button addon-button--left\">\n <s-button\n [label]=\"field.leftAddon.label\"\n [iconClass]=\"field.leftAddon.icon\"\n [priority]=\"field.leftAddon.priority\"\n [disabled]=\"isFunction(field.leftAddon.disabled) ? field.leftAddon.disabled() : field.leftAddon.disabled\"\n (onClick)=\"field.leftAddon.callback()\"\n >\n </s-button>\n </span>\n <span *ngIf=\"!field.leftAddon.callback\" class=\"ui-inputgroup-addon\">\n <span *ngIf=\"field.leftAddon.label\">{{ field.leftAddon.label }}</span>\n <span *ngIf=\"!field.leftAddon.label\" [ngClass]=\"field.leftAddon.icon\"></span>\n </span>\n </ng-container>\n\n <ng-container *ngTemplateOutlet=\"field.keyFilter ? inputKeyFilter : input\"></ng-container>\n\n <ng-container *ngIf=\"field.rightAddon\">\n <span *ngIf=\"field.rightAddon.callback\" class=\"addon-button addon-button--right\">\n <s-button\n [label]=\"field.rightAddon.label\"\n [iconClass]=\"field.rightAddon.icon\"\n [priority]=\"field.rightAddon.priority\"\n [disabled]=\"isFunction(field.rightAddon.disabled) ? field.rightAddon.disabled() : field.rightAddon.disabled\"\n (onClick)=\"field.rightAddon.callback()\"\n >\n </s-button>\n </span>\n <span *ngIf=\"!field.rightAddon.callback\" class=\"ui-inputgroup-addon\">\n <span *ngIf=\"field.rightAddon.label\">{{ field.rightAddon.label }}</span>\n <span *ngIf=\"!field.rightAddon.label\" [ngClass]=\"field.rightAddon.icon\"></span>\n </span>\n </ng-container>\n </div>\n </ng-container>\n</ng-template>\n\n<ng-template #input>\n <input\n #inputRef\n [type]=\"field.inputType || 'text'\"\n [id]=\"field.id || field.name\"\n [name]=\"field.name\"\n [sTooltip]=\"field.tooltip\"\n tooltipPosition=\"top\"\n [placeholder]=\"field.placeholder\"\n [showDelay]=\"500\"\n [maxLength]=\"field.maxLength\"\n pInputText\n [autocomplete]=\"field.browserAutocomplete ? 'on' : 'off'\"\n [ngClass]=\"'mousetrap'\"\n (blur)=\"field.onBlur ? field.onBlur($event) : null\"\n (focus)=\"onFocus.next($event)\"\n (input)=\"onInput.next($event)\"\n [formControl]=\"formControl\"\n [ngStyle]=\"field.style\"\n [readOnly]=\"field.readonly ? field.readonly() : false\"\n />\n</ng-template>\n\n<ng-template #inputKeyFilter>\n <input\n #inputText\n [type]=\"field.inputType || 'text'\"\n [id]=\"field.id || field.name\"\n [name]=\"field.name\"\n [sTooltip]=\"field.tooltip\"\n tooltipPosition=\"top\"\n [placeholder]=\"field.placeholder\"\n [showDelay]=\"500\"\n [maxLength]=\"field.maxLength\"\n pInputText\n [autocomplete]=\"field.browserAutocomplete ? 'on' : 'off'\"\n [ngClass]=\"'mousetrap'\"\n (blur)=\"field.onBlur ? field.onBlur($event) : null\"\n (focus)=\"onFocus.next($event)\"\n (input)=\"onInput.next($event)\"\n [pKeyFilter]=\"field.keyFilter\"\n [formControl]=\"formControl\"\n [ngStyle]=\"field.style\"\n [readOnly]=\"field.readonly ? field.readonly() : false\"\n />\n</ng-template>\n",
11303
+ template: "<s-field-label *ngIf=\"inputRef\" [field]=\"field\" [fieldContainerRef]=\"inputRef?.nativeElement\"></s-field-label>\n\n<p-inputMask\n #inputRef\n *ngIf=\"field.mask; else noMask\"\n [type]=\"field.inputType || 'text'\"\n [inputId]=\"field.id || field.name\"\n [name]=\"field.name\"\n [mask]=\"isFunction(field.mask) ? field.mask() : field.mask\"\n [characterPattern]=\"getCharacterPattern()\"\n [unmask]=\"getUnmask()\"\n [placeholder]=\"field.placeholder\"\n slotChar=\"_\"\n [sTooltip]=\"field.tooltip\"\n tooltipPosition=\"top\"\n [showDelay]=\"500\"\n styleClass=\"mousetrap\"\n (onBlur)=\"field.onBlur ? field.onBlur($event) : null\"\n (onFocus)=\"onFocus.next($event)\"\n (onComplete)=\"onComplete.next($event)\"\n (onInput)=\"onInput.next($event)\"\n [formControl]=\"formControl\"\n [readonly]=\"field.readonly ? field.readonly() : false\"\n [autocomplete]=\"field.browserAutocomplete ? 'on' : 'off'\"\n>\n</p-inputMask>\n\n<ng-template #noMask>\n <ng-container>\n <div class=\"ui-inputgroup\">\n <ng-container *ngIf=\"field.leftAddon\">\n <span *ngIf=\"field.leftAddon.callback\" class=\"addon-button addon-button--left\">\n <s-button\n [label]=\"field.leftAddon.label\"\n [iconClass]=\"field.leftAddon.icon\"\n [priority]=\"field.leftAddon.priority\"\n [disabled]=\"isFunction(field.leftAddon.disabled) ? field.leftAddon.disabled() : field.leftAddon.disabled\"\n (onClick)=\"field.leftAddon.callback()\"\n >\n </s-button>\n </span>\n <span *ngIf=\"!field.leftAddon.callback\" class=\"ui-inputgroup-addon\">\n <span *ngIf=\"field.leftAddon.label\">{{ field.leftAddon.label }}</span>\n <span *ngIf=\"!field.leftAddon.label\" [ngClass]=\"field.leftAddon.icon\"></span>\n </span>\n </ng-container>\n\n <ng-container *ngTemplateOutlet=\"field.keyFilter ? inputKeyFilter : input\"></ng-container>\n\n <ng-container *ngIf=\"field.rightAddon\">\n <span *ngIf=\"field.rightAddon.callback\" class=\"addon-button addon-button--right\">\n <s-button\n [label]=\"field.rightAddon.label\"\n [iconClass]=\"field.rightAddon.icon\"\n [priority]=\"field.rightAddon.priority\"\n [disabled]=\"isFunction(field.rightAddon.disabled) ? field.rightAddon.disabled() : field.rightAddon.disabled\"\n (onClick)=\"field.rightAddon.callback()\"\n >\n </s-button>\n </span>\n <span *ngIf=\"!field.rightAddon.callback\" class=\"ui-inputgroup-addon\">\n <span *ngIf=\"field.rightAddon.label\">{{ field.rightAddon.label }}</span>\n <span *ngIf=\"!field.rightAddon.label\" [ngClass]=\"field.rightAddon.icon\"></span>\n </span>\n </ng-container>\n </div>\n </ng-container>\n</ng-template>\n\n<ng-template #input>\n <input\n #inputRef\n [type]=\"field.inputType || 'text'\"\n [id]=\"field.id || field.name\"\n [name]=\"field.name\"\n [sTooltip]=\"field.tooltip\"\n tooltipPosition=\"top\"\n [placeholder]=\"field.placeholder\"\n [showDelay]=\"500\"\n [maxLength]=\"field.maxLength\"\n pInputText\n [autocomplete]=\"field.browserAutocomplete ? 'on' : 'off'\"\n [ngClass]=\"'mousetrap'\"\n (blur)=\"field.onBlur ? field.onBlur($event) : null\"\n (focus)=\"onFocus.next($event)\"\n (input)=\"onInput.next($event)\"\n [formControl]=\"formControl\"\n [ngStyle]=\"field.style\"\n [readOnly]=\"field.readonly ? field.readonly() : false\"\n />\n</ng-template>\n\n<ng-template #inputKeyFilter>\n <input\n #inputText\n [type]=\"field.inputType || 'text'\"\n [id]=\"field.id || field.name\"\n [name]=\"field.name\"\n [sTooltip]=\"field.tooltip\"\n tooltipPosition=\"top\"\n [placeholder]=\"field.placeholder\"\n [showDelay]=\"500\"\n [maxLength]=\"field.maxLength\"\n pInputText\n [autocomplete]=\"field.browserAutocomplete ? 'on' : 'off'\"\n [ngClass]=\"'mousetrap'\"\n (blur)=\"field.onBlur ? field.onBlur($event) : null\"\n (focus)=\"onFocus.next($event)\"\n (input)=\"onInput.next($event)\"\n [pKeyFilter]=\"field.keyFilter\"\n [formControl]=\"formControl\"\n [ngStyle]=\"field.style\"\n [readOnly]=\"field.readonly ? field.readonly() : false\"\n />\n</ng-template>\n",
11305
11304
  encapsulation: ViewEncapsulation.None,
11306
11305
  styles: ["s-text-field.ng-dirty.ng-invalid .ui-inputtext{border-color:#c13018}s-text-field.ng-dirty.ng-invalid .ui-inputtext:hover{border-color:#e44328}.addon-button{border:1px solid #c1c1cc}.addon-button s-button .s-button-with-text,.addon-button s-button button{height:100%;min-width:40px}.addon-button--left{border-radius:5px 0 0 5px;border-right:none}.addon-button--left s-button button{border-bottom-right-radius:0;border-top-right-radius:0}.addon-button--right{border-left:none;border-radius:0 5px 5px 0}.addon-button--right s-button button{border-bottom-left-radius:0;border-top-left-radius:0}"]
11307
11306
  })
@@ -21555,5 +21554,5 @@ const fallback = {
21555
21554
  * Generated bundle index. Do not edit.
21556
21555
  */
21557
21556
 
21558
- export { AccordionComponent, AccordionModule, AccordionPanelComponent, AlertComponent, AlertModule, AngularComponentsModule, AutocompleteField, BadgeColors, BadgeComponent, BadgeModule, BaseFieldComponent, BignumberField, BignumberInputDirective, BignumberInputModule, BooleanField, BooleanOptionsLabel, BreadcrumbComponent, BreadcrumbModule, Breakpoints, ButtonAnimation, ButtonComponent, ButtonField, ButtonModule, ButtonPriority, ButtonSize, CalendarField, CalendarLocaleOptions, CalendarMaskDirective, CalendarMaskModule, CardComponent, CardModule, CardTemplateTypes, ChatComponent, ChatModule, CheckDisabled, CheckboxComponent, CheckboxModule, ChipsComponent, ChipsField, ChipsModule, CodeEditorModule, CollapseLinkComponent, CollapseLinkModule, ControlErrorsComponent, ControlErrorsModule, CountryPhonePickerComponent, CountryPhonePickerModule, CurrencyField, CurrencyService, CustomFieldsComponent, CustomFieldsModule, CustomFieldsService, DEFAULT_CALENDAR_LOCALE_OPTIONS, DEFAULT_LOCALE_OPTIONS, DEFAULT_NUMBER_LOCALE_OPTIONS, DebounceUtils, DoubleClickDirective, DynamicConfig, DynamicFormComponent, DynamicFormModule, DynamicType, EditableOverlayDirective, EditableOverlayModule, EmptyStateComponent, EmptyStateModule, EnumBadgeColors, EnumColumnFieldType, EnumSeverity, ExportUtils, Field, FieldType, Fieldset, FileUploadComponent, FileUploadModule, FileUploadPermissions, FileValidation, FormField, GanttComponent, GanttModule, GlobalSearchComponent, GlobalSearchDropdownItemComponent, GlobalSearchModule, GlobalSearchSizeEnum, Grid, GridMenuComponent, GridMenuModule, GridType, HelpPopoverComponent, HelpPopoverDirective, HelpPopoverModule, HostProjectConfigsInjectionToken, IAInsightComponent, IAInsightModule, IAInsightTemplateTypes, ImageCropperComponent, ImageCropperModule, ImageCropperService, InfoSignDirective, InfoSignModule, InlineEditCalendarField, InlineEditComponent, InlineEditField, InlineEditLookupField, InlineEditModule, InlineEditNumberField, InlineEditTextAreaField, InlineEditTextAreaIAField, InlineEditTextField, KanbanComponent, KanbanModule, KanbanTemplateTypes, LabelValueComponent, LabelValueModule, Languages, LoadingStateComponent, LoadingStateDirective, LoadingStateModule, LocaleModule, LocaleOptions, LocaleService, LocalizedCurrencyPipe, LocalizedCurrencyPipeOptions, LocalizedDateImpurePipe, LocalizedDatePipe, LocalizedNumberInputDirective, LocalizedNumberInputModule, LocalizedNumberPipe, LocalizedTimeImpurePipe, LocalizedTimePipe, LongPressDirective, LookupComponent, LookupField, MaskFormatterModule, MaskFormatterPipe, MouseEventsModule, NavigationButtonComponent, NavigationButtonModule, NavigationDirective, NumberAlignmentOption, NumberField, NumberInputDirective, NumberInputModule, NumberLocaleOptions, NumericService, ObjectCardComponent, ObjectCardFieldComponent, ObjectCardMainComponent, ObjectCardModule, Option, Ordination, PanelComponent, PanelModule, PasswordField, PasswordStrengthComponent, PasswordStrengthDirective, PasswordStrengthModule, PasswordStrengthPositions, PasswordStrengths, PicklistComponent, PicklistModule, PicklistTemplateTypes, ProductHeaderComponent, ProductHeaderModule, ProfilePicturePickerComponent, ProfilePicturePickerModule, ProgressBarColors, ProgressBarComponent, ProgressBarModule, RadioButtonField, RatingScaleComponent, RatingScaleModule, RationButtonOption, Row, RowTogllerDirective, SVGFactoryDirective, SVGFactoryModule, Section, SelectButtonComponent, SelectButtonModule, SelectField, SelectOption, SidebarComponent, SidebarModule, SlidePanelComponent, SlidePanelModule, SliderComponent, SliderModule, SplitButtonComponent, SplitButtonModule, SplitButtonType, StatsCardComponent, StatsCardModule, StepState, StepsComponent, StepsModule, Structure, StructureType, SwitchComponent, SwitchModule, TableFrozenPositionDirective, TableHeaderCheckboxComponent, TableHeaderCheckboxModule, TableModule, TaxCalculationLanguageConfigs, TemplateDirective, TemplateModule, TextAreaComponent, TextAreaField, TextAreaIAComponent, TextAreaIAModule, TextAreaModule, TextField, Themes, ThumbnailComponent, ThumbnailModule, ThumbnailSize, ThumbnailsComponent, ThumbnailsModule, TieredMenuDirective, TieredMenuModule, TileComponent, TileModule, TimelineComponent, TimelineItem, TimelineItemSeverity, TimelineItemSize, TimelineModule, ToastComponent, ToastModule, ToastService, TokenListComponent, TokenListModule, TooltipModule, TooltipPosition, ValidateErrors, ViewMode, WorkspaceSwitchComponent, WorkspaceSwitchModule, convertToMomentDateFormat, countries, fallback, getElementLeftoverContentAvailable, getElementPositionInfo, isMousePositionOutsideOfElement, isNullOrUndefined, parseItensPickList, ɵ0$3 as ɵ0, ɵ1$2 as ɵ1, ɵ2$1 as ɵ2, ɵ3$1 as ɵ3, ɵ4, TooltipComponent as ɵa, TooltipDirective as ɵb, TableColumnsComponent as ɵba, TablePagingComponent as ɵbb, PasswordFieldModule as ɵbc, FieldLabelModule as ɵbd, FieldLabelComponent as ɵbe, PasswordFieldComponent as ɵbf, TextFieldModule as ɵbg, TextFieldComponent as ɵbh, NumberFieldModule as ɵbi, NumberFieldComponent as ɵbj, CurrencyFieldModule as ɵbk, CurrencyFieldComponent as ɵbl, BignumberFieldModule as ɵbm, BignumberFieldComponent as ɵbn, CheckboxFieldModule as ɵbo, CheckboxFieldComponent as ɵbp, ProfilePictureModule as ɵbq, ThumbnailService as ɵbr, StructureModule as ɵbs, HeaderComponent as ɵbt, FooterComponent as ɵbu, ProfilePictureFieldComponent as ɵbv, EditorFieldModule as ɵbw, EditorFieldComponent as ɵbx, SpeechRecognitionModule as ɵby, SpeechRecognitionComponent as ɵbz, InfoSignComponent as ɵc, SpeechRecognitionService as ɵca, TextToSpeechService as ɵcb, AutocompleteFieldComponent as ɵcc, BooleanFieldComponent as ɵcd, BooleanSwitchFieldComponent as ɵce, CalendarFieldComponent as ɵcf, ChipsFieldComponent as ɵcg, CountryPhonePickerFieldComponent as ɵch, DynamicFieldComponent as ɵci, DynamicFormDirective as ɵcj, FieldsetComponent as ɵck, FileUploadComponent$1 as ɵcl, LookupFieldComponent as ɵcm, RadioButtonComponent as ɵcn, RowComponent as ɵco, SectionComponent as ɵcp, SelectFieldComponent as ɵcq, SliderFieldComponent as ɵcr, TextAreaFieldComponent as ɵcs, TextAreaIAFieldComponent as ɵct, IAssistService as ɵcu, ButtonFieldComponent as ɵcv, DecimalField as ɵcx, SideTableComponent as ɵcy, InfiniteScrollModule as ɵcz, TieredMenuEventService as ɵd, InfiniteScrollDirective as ɵda, IAInsightSidebarComponent as ɵdb, IAInsightCardComponent as ɵdc, IAInsightCardLoaderComponent as ɵdd, GridMenuItemComponent as ɵde, InlineEditItemComponent as ɵdf, InlineEditCalendarComponent as ɵdg, InlineEditLookupComponent as ɵdh, InlineEditNumberComponent as ɵdi, InlineEditTextComponent as ɵdj, InlineEditTextAreaComponent as ɵdk, InlineEditTextAreaIAComponent as ɵdl, KanbanEventService as ɵdm, KanbanItemComponent as ɵdn, KanbanColumnComponent as ɵdo, KanbanItemDraggingComponent as ɵdp, NumberLocaleOptions as ɵdq, BorderButtonModule as ɵdr, BorderButtonComponent as ɵds, ProgressBarDeterminateComponent as ɵdt, ProgressBarIndeterminateComponent as ɵdu, SelectButtonItemComponent as ɵdv, SlidePanelService as ɵdw, ThumbnailItemComponent as ɵdx, ThumbnailItemVideoComponent as ɵdy, ThumbnailItemImageComponent as ɵdz, TieredMenuService as ɵe, TimelineItemModule as ɵea, TimelineIconItemComponent as ɵeb, HorizontalTimelineModule as ɵec, HorizontalTimelineComponent as ɵed, VerticalTimelineModule as ɵee, VerticalTimelineComponent as ɵef, RangeLineComponent as ɵeg, CollapseOptionComponent as ɵeh, CollapsedItemsComponent as ɵei, VerticalItemsComponent as ɵej, ChipItemComponent as ɵek, TieredMenuGlobalService as ɵf, TieredMenuComponent as ɵg, TieredMenuNestedComponent as ɵh, TieredMenuItemComponent as ɵi, TieredMenuDividerComponent as ɵj, LocalizedCurrencyImpurePipe as ɵk, LocalizedBignumberPipe as ɵl, LocalizedBignumberImpurePipe as ɵm, NumericPipe as ɵn, ChatMessageComponent as ɵo, CustomTranslationsModule as ɵp, CodeEditorComponent as ɵq, CoreFacade as ɵr, CodeMirror6Core as ɵs, CountryPhonePickerService as ɵt, EmptyStateGoBackComponent as ɵu, IAssistIconComponent as ɵv, SeniorIconComponent as ɵw, DotsIndicatorComponent as ɵx, LoadingIndicatorComponent as ɵy, FileUploadService as ɵz };
21557
+ export { AccordionComponent, AccordionModule, AccordionPanelComponent, AlertComponent, AlertModule, AngularComponentsModule, AutocompleteField, BadgeColors, BadgeComponent, BadgeModule, BaseFieldComponent, BignumberField, BignumberInputDirective, BignumberInputModule, BooleanField, BooleanOptionsLabel, BreadcrumbComponent, BreadcrumbModule, Breakpoints, ButtonAnimation, ButtonComponent, ButtonField, ButtonModule, ButtonPriority, ButtonSize, CalendarField, CalendarLocaleOptions, CalendarMaskDirective, CalendarMaskModule, CardComponent, CardModule, CardTemplateTypes, ChatComponent, ChatModule, CheckDisabled, CheckboxComponent, CheckboxModule, ChipsComponent, ChipsField, ChipsModule, CodeEditorModule, CollapseLinkComponent, CollapseLinkModule, ControlErrorsComponent, ControlErrorsModule, CountryPhonePickerComponent, CountryPhonePickerModule, CurrencyField, CurrencyService, CustomFieldsComponent, CustomFieldsModule, CustomFieldsService, DEFAULT_CALENDAR_LOCALE_OPTIONS, DEFAULT_LOCALE_OPTIONS, DEFAULT_NUMBER_LOCALE_OPTIONS, DebounceUtils, DoubleClickDirective, DynamicConfig, DynamicFormComponent, DynamicFormModule, DynamicType, EditableOverlayDirective, EditableOverlayModule, EmptyStateComponent, EmptyStateModule, EnumBadgeColors, EnumColumnFieldType, EnumSeverity, ExportUtils, Field, FieldType, Fieldset, FileUploadComponent, FileUploadModule, FileUploadPermissions, FileValidation, FormField, GanttComponent, GanttModule, GlobalSearchComponent, GlobalSearchDropdownItemComponent, GlobalSearchModule, GlobalSearchSizeEnum, Grid, GridMenuComponent, GridMenuModule, GridType, HelpPopoverComponent, HelpPopoverDirective, HelpPopoverModule, HostProjectConfigsInjectionToken, IAInsightComponent, IAInsightModule, IAInsightTemplateTypes, ImageCropperComponent, ImageCropperModule, ImageCropperService, InfoSignDirective, InfoSignModule, InlineEditCalendarField, InlineEditComponent, InlineEditField, InlineEditLookupField, InlineEditModule, InlineEditNumberField, InlineEditTextAreaField, InlineEditTextAreaIAField, InlineEditTextField, KanbanComponent, KanbanModule, KanbanTemplateTypes, LabelValueComponent, LabelValueModule, Languages, LoadingStateComponent, LoadingStateDirective, LoadingStateModule, LocaleModule, LocaleOptions, LocaleService, LocalizedCurrencyPipe, LocalizedCurrencyPipeOptions, LocalizedDateImpurePipe, LocalizedDatePipe, LocalizedNumberInputDirective, LocalizedNumberInputModule, LocalizedNumberPipe, LocalizedTimeImpurePipe, LocalizedTimePipe, LongPressDirective, LookupComponent, LookupField, MaskFormatterModule, MaskFormatterPipe, MouseEventsModule, NavigationButtonComponent, NavigationButtonModule, NavigationDirective, NumberAlignmentOption, NumberField, NumberInputDirective, NumberInputModule, NumberLocaleOptions, NumericService, ObjectCardComponent, ObjectCardFieldComponent, ObjectCardMainComponent, ObjectCardModule, Option, Ordination, PanelComponent, PanelModule, PasswordField, PasswordStrengthComponent, PasswordStrengthDirective, PasswordStrengthModule, PasswordStrengthPositions, PasswordStrengths, PicklistComponent, PicklistModule, PicklistTemplateTypes, ProductHeaderComponent, ProductHeaderModule, ProfilePicturePickerComponent, ProfilePicturePickerModule, ProgressBarColors, ProgressBarComponent, ProgressBarModule, RadioButtonField, RatingScaleComponent, RatingScaleModule, RationButtonOption, Row, RowTogllerDirective, SVGFactoryDirective, SVGFactoryModule, Section, SelectButtonComponent, SelectButtonModule, SelectField, SelectOption, SidebarComponent, SidebarModule, SlidePanelComponent, SlidePanelModule, SliderComponent, SliderModule, SplitButtonComponent, SplitButtonModule, SplitButtonType, StatsCardComponent, StatsCardModule, StepState, StepsComponent, StepsModule, Structure, StructureType, SwitchComponent, SwitchModule, TableFrozenPositionDirective, TableHeaderCheckboxComponent, TableHeaderCheckboxModule, TableModule, TaxCalculationLanguageConfigs, TemplateDirective, TemplateModule, TextAreaComponent, TextAreaField, TextAreaIAComponent, TextAreaIAModule, TextAreaModule, TextField, Themes, ThumbnailComponent, ThumbnailModule, ThumbnailSize, ThumbnailsComponent, ThumbnailsModule, TieredMenuDirective, TieredMenuModule, TileComponent, TileModule, TimelineComponent, TimelineItem, TimelineItemSeverity, TimelineItemSize, TimelineModule, ToastComponent, ToastModule, ToastService, TokenListComponent, TokenListModule, TooltipModule, TooltipPosition, ValidateErrors, ViewMode, WorkspaceSwitchComponent, WorkspaceSwitchModule, convertToMomentDateFormat, countries, fallback, getElementLeftoverContentAvailable, getElementPositionInfo, isMousePositionOutsideOfElement, isNullOrUndefined, parseItensPickList, ɵ0$3 as ɵ0, ɵ1$2 as ɵ1, ɵ2$1 as ɵ2, ɵ3$1 as ɵ3, ɵ4, TooltipComponent as ɵa, TooltipDirective as ɵb, FileUploadService as ɵba, TableColumnsComponent as ɵbb, TablePagingComponent as ɵbc, PasswordFieldModule as ɵbd, FieldLabelModule as ɵbe, FieldLabelComponent as ɵbf, PasswordFieldComponent as ɵbg, TextFieldModule as ɵbh, TextFieldComponent as ɵbi, NumberFieldModule as ɵbj, NumberFieldComponent as ɵbk, CurrencyFieldModule as ɵbl, CurrencyFieldComponent as ɵbm, BignumberFieldModule as ɵbn, BignumberFieldComponent as ɵbo, CheckboxFieldModule as ɵbp, CheckboxFieldComponent as ɵbq, ProfilePictureModule as ɵbr, ThumbnailService as ɵbs, StructureModule as ɵbt, HeaderComponent as ɵbu, FooterComponent as ɵbv, ProfilePictureFieldComponent as ɵbw, EditorFieldModule as ɵbx, EditorFieldComponent as ɵby, SpeechRecognitionModule as ɵbz, InfoSignComponent as ɵc, SpeechRecognitionComponent as ɵca, SpeechRecognitionService as ɵcb, TextToSpeechService as ɵcc, AutocompleteFieldComponent as ɵcd, BooleanFieldComponent as ɵce, BooleanSwitchFieldComponent as ɵcf, CalendarFieldComponent as ɵcg, ChipsFieldComponent as ɵch, CountryPhonePickerFieldComponent as ɵci, DynamicFieldComponent as ɵcj, DynamicFormDirective as ɵck, FieldsetComponent as ɵcl, FileUploadComponent$1 as ɵcm, LookupFieldComponent as ɵcn, RadioButtonComponent as ɵco, RowComponent as ɵcp, SectionComponent as ɵcq, SelectFieldComponent as ɵcr, SliderFieldComponent as ɵcs, TextAreaFieldComponent as ɵct, TextAreaIAFieldComponent as ɵcu, IAssistService as ɵcv, ButtonFieldComponent as ɵcw, DecimalField as ɵcy, SideTableComponent as ɵcz, LocaleService as ɵd, InfiniteScrollModule as ɵda, InfiniteScrollDirective as ɵdb, IAInsightSidebarComponent as ɵdc, IAInsightCardComponent as ɵdd, IAInsightCardLoaderComponent as ɵde, GridMenuItemComponent as ɵdf, InlineEditItemComponent as ɵdg, InlineEditCalendarComponent as ɵdh, InlineEditLookupComponent as ɵdi, InlineEditNumberComponent as ɵdj, InlineEditTextComponent as ɵdk, InlineEditTextAreaComponent as ɵdl, InlineEditTextAreaIAComponent as ɵdm, KanbanEventService as ɵdn, KanbanItemComponent as ɵdo, KanbanColumnComponent as ɵdp, KanbanItemDraggingComponent as ɵdq, NumberLocaleOptions as ɵdr, BorderButtonModule as ɵds, BorderButtonComponent as ɵdt, ProgressBarDeterminateComponent as ɵdu, ProgressBarIndeterminateComponent as ɵdv, SelectButtonItemComponent as ɵdw, SlidePanelService as ɵdx, ThumbnailItemComponent as ɵdy, ThumbnailItemVideoComponent as ɵdz, TieredMenuEventService as ɵe, ThumbnailItemImageComponent as ɵea, TimelineItemModule as ɵeb, TimelineIconItemComponent as ɵec, HorizontalTimelineModule as ɵed, HorizontalTimelineComponent as ɵee, VerticalTimelineModule as ɵef, VerticalTimelineComponent as ɵeg, RangeLineComponent as ɵeh, CollapseOptionComponent as ɵei, CollapsedItemsComponent as ɵej, VerticalItemsComponent as ɵek, ChipItemComponent as ɵel, TieredMenuService as ɵf, TieredMenuGlobalService as ɵg, TieredMenuComponent as ɵh, TieredMenuNestedComponent as ɵi, TieredMenuItemComponent as ɵj, TieredMenuDividerComponent as ɵk, LocalizedCurrencyImpurePipe as ɵl, LocalizedBignumberPipe as ɵm, LocalizedBignumberImpurePipe as ɵn, NumericPipe as ɵo, ChatMessageComponent as ɵp, CustomTranslationsModule as ɵq, CodeEditorComponent as ɵr, CoreFacade as ɵs, CodeMirror6Core as ɵt, CountryPhonePickerService as ɵu, EmptyStateGoBackComponent as ɵv, IAssistIconComponent as ɵw, SeniorIconComponent as ɵx, DotsIndicatorComponent as ɵy, LoadingIndicatorComponent as ɵz };
21559
21558
  //# sourceMappingURL=seniorsistemas-angular-components.js.map