@theseam/ui-common 0.3.12-beta.0 → 0.3.13-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/theseam-ui-common-framework.umd.js +258 -222
- package/bundles/theseam-ui-common-framework.umd.js.map +1 -1
- package/esm2015/framework/nav/horizontal-nav/horizontal-nav.component.js +9 -24
- package/esm2015/framework/nav/nav-item/nav-item.component.js +15 -4
- package/esm2015/framework/nav/nav-utils.js +7 -2
- package/esm2015/framework/nav/nav.models.js +1 -1
- package/esm2015/framework/nav/nav.service.js +32 -10
- package/fesm2015/theseam-ui-common-framework.js +213 -190
- package/fesm2015/theseam-ui-common-framework.js.map +1 -1
- package/framework/nav/_nav-theme.scss +4 -0
- package/framework/nav/horizontal-nav/horizontal-nav.component.d.ts +3 -11
- package/framework/nav/horizontal-nav/horizontal-nav.component.scss +50 -0
- package/framework/nav/nav-item/nav-item.component.d.ts +5 -1
- package/framework/nav/nav-item/nav-item.component.scss +203 -0
- package/framework/nav/nav-utils.d.ts +1 -0
- package/framework/nav/nav.models.d.ts +2 -1
- package/framework/nav/nav.service.d.ts +3 -0
- package/framework/nav/styles/_themes/light/_variables.scss +56 -0
- package/framework/nav/styles/_themes/primary/_variables.scss +56 -0
- package/framework/nav/styles/_utilities.scss +3 -0
- package/framework/nav/styles/_variables.scss +2 -0
- package/framework/theseam-ui-common-framework.metadata.json +1 -1
- package/package.json +2 -2
|
@@ -3495,6 +3495,10 @@
|
|
|
3495
3495
|
var _a, _b;
|
|
3496
3496
|
return (_b = (_a = item.__state) === null || _a === void 0 ? void 0 : _a.expanded) !== null && _b !== void 0 ? _b : false;
|
|
3497
3497
|
}
|
|
3498
|
+
function isHorizontalNavItemFocused(item) {
|
|
3499
|
+
var _a, _b;
|
|
3500
|
+
return (_b = (_a = item.__state) === null || _a === void 0 ? void 0 : _a.focused) !== null && _b !== void 0 ? _b : false;
|
|
3501
|
+
}
|
|
3498
3502
|
function horizontalNavItemHasChildren(item) {
|
|
3499
3503
|
return horizontalNavItemCanHaveChildren(item) && utils.hasProperty(item, 'children') && item.children.length > 0;
|
|
3500
3504
|
}
|
|
@@ -3591,7 +3595,8 @@
|
|
|
3591
3595
|
}
|
|
3592
3596
|
item.__state = {
|
|
3593
3597
|
active: false,
|
|
3594
|
-
expanded: false
|
|
3598
|
+
expanded: false,
|
|
3599
|
+
focused: false
|
|
3595
3600
|
};
|
|
3596
3601
|
// TODO: See if there is a nice way to fix the typing for this.
|
|
3597
3602
|
return item;
|
|
@@ -3621,8 +3626,235 @@
|
|
|
3621
3626
|
return false;
|
|
3622
3627
|
}
|
|
3623
3628
|
|
|
3629
|
+
var TheSeamNavService = /** @class */ (function () {
|
|
3630
|
+
function TheSeamNavService(_router) {
|
|
3631
|
+
this._router = _router;
|
|
3632
|
+
this._updatingCount = new rxjs.BehaviorSubject(0);
|
|
3633
|
+
this.itemChanged = new rxjs.Subject();
|
|
3634
|
+
this.loading$ = this._updatingCount.pipe(operators.map(function (count) { return count > 0; }), operators.distinctUntilChanged(), operators.shareReplay({ bufferSize: 1, refCount: true }));
|
|
3635
|
+
}
|
|
3636
|
+
TheSeamNavService.prototype.createItemsObservable = function (items) {
|
|
3637
|
+
var _this = this;
|
|
3638
|
+
return rxjs.defer(function () {
|
|
3639
|
+
_this.updateItemsStates(items);
|
|
3640
|
+
return new rxjs.Observable(function (subscriber) {
|
|
3641
|
+
var stateChangeSub = _this.itemChanged.pipe(operators.switchMap(function (change) {
|
|
3642
|
+
if (change.prop === 'focused' && change.newValue) {
|
|
3643
|
+
_this.updateFocusedItem(items, change.item);
|
|
3644
|
+
}
|
|
3645
|
+
return _this.loading$.pipe(operators.filter(function (loading) { return !loading; }));
|
|
3646
|
+
})).subscribe(function () {
|
|
3647
|
+
subscriber.next(items);
|
|
3648
|
+
});
|
|
3649
|
+
try {
|
|
3650
|
+
_this.updateItemsStates(items);
|
|
3651
|
+
}
|
|
3652
|
+
catch (err) {
|
|
3653
|
+
subscriber.error(err);
|
|
3654
|
+
}
|
|
3655
|
+
var routeChangeSub = _this._router.events.pipe(operators.filter(function (event) { return event instanceof router.NavigationEnd; })).subscribe(function (event) {
|
|
3656
|
+
try {
|
|
3657
|
+
_this.updateItemsStates(items);
|
|
3658
|
+
}
|
|
3659
|
+
catch (err) {
|
|
3660
|
+
subscriber.error(err);
|
|
3661
|
+
}
|
|
3662
|
+
});
|
|
3663
|
+
return function () {
|
|
3664
|
+
stateChangeSub.unsubscribe();
|
|
3665
|
+
routeChangeSub.unsubscribe();
|
|
3666
|
+
};
|
|
3667
|
+
}).pipe(operators.startWith(items));
|
|
3668
|
+
});
|
|
3669
|
+
};
|
|
3670
|
+
TheSeamNavService.prototype._incUpdatingCount = function () {
|
|
3671
|
+
this._updatingCount.next(this._updatingCount.value + 1);
|
|
3672
|
+
};
|
|
3673
|
+
TheSeamNavService.prototype._decrUpdatingCount = function () {
|
|
3674
|
+
this._updatingCount.next(this._updatingCount.value - 1);
|
|
3675
|
+
};
|
|
3676
|
+
TheSeamNavService.prototype.updateItemsStates = function (items) {
|
|
3677
|
+
var e_1, _a;
|
|
3678
|
+
this._incUpdatingCount();
|
|
3679
|
+
this.updateRouterFocusedItem(items);
|
|
3680
|
+
try {
|
|
3681
|
+
try {
|
|
3682
|
+
for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
|
|
3683
|
+
var item = items_1_1.value;
|
|
3684
|
+
if (horizontalNavItemHasChildren(item)) {
|
|
3685
|
+
this.updateItemsStates(item.children);
|
|
3686
|
+
}
|
|
3687
|
+
this.updateItemState(item);
|
|
3688
|
+
}
|
|
3689
|
+
}
|
|
3690
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3691
|
+
finally {
|
|
3692
|
+
try {
|
|
3693
|
+
if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);
|
|
3694
|
+
}
|
|
3695
|
+
finally { if (e_1) throw e_1.error; }
|
|
3696
|
+
}
|
|
3697
|
+
this._decrUpdatingCount();
|
|
3698
|
+
}
|
|
3699
|
+
catch (err) {
|
|
3700
|
+
this._decrUpdatingCount();
|
|
3701
|
+
throw err;
|
|
3702
|
+
}
|
|
3703
|
+
};
|
|
3704
|
+
TheSeamNavService.prototype.updateItemState = function (item) {
|
|
3705
|
+
this._incUpdatingCount();
|
|
3706
|
+
try {
|
|
3707
|
+
setDefaultHorizontalNavItemState(item);
|
|
3708
|
+
this.setItemStateProp(item, 'active', this.horizontalNavLinkActive(item));
|
|
3709
|
+
// TODO: Implement this in a more optimized way. Unless our apps start
|
|
3710
|
+
// having large navs constantly updating their state, this shouldn't
|
|
3711
|
+
// have much impact on performance.
|
|
3712
|
+
this._updateItemExpandedState(item);
|
|
3713
|
+
this._decrUpdatingCount();
|
|
3714
|
+
}
|
|
3715
|
+
catch (err) {
|
|
3716
|
+
this._decrUpdatingCount();
|
|
3717
|
+
throw err;
|
|
3718
|
+
}
|
|
3719
|
+
};
|
|
3720
|
+
TheSeamNavService.prototype.horizontalNavLinkActive = function (item) {
|
|
3721
|
+
if (isHorizontalNavItemType(item, 'link')) {
|
|
3722
|
+
var url = this._getUrl(item);
|
|
3723
|
+
if (utils.notNullOrUndefined(url)) {
|
|
3724
|
+
var opts = this._getMatchOptions(item);
|
|
3725
|
+
return this._router.isActive(url, opts);
|
|
3726
|
+
}
|
|
3727
|
+
}
|
|
3728
|
+
return false;
|
|
3729
|
+
};
|
|
3730
|
+
TheSeamNavService.prototype._updateItemsExpandedState = function (items) {
|
|
3731
|
+
var e_2, _a;
|
|
3732
|
+
try {
|
|
3733
|
+
for (var items_2 = __values(items), items_2_1 = items_2.next(); !items_2_1.done; items_2_1 = items_2.next()) {
|
|
3734
|
+
var item = items_2_1.value;
|
|
3735
|
+
if (horizontalNavItemHasChildren(item)) {
|
|
3736
|
+
this._updateItemsExpandedState(item.children);
|
|
3737
|
+
}
|
|
3738
|
+
this._updateItemExpandedState(item);
|
|
3739
|
+
}
|
|
3740
|
+
}
|
|
3741
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
3742
|
+
finally {
|
|
3743
|
+
try {
|
|
3744
|
+
if (items_2_1 && !items_2_1.done && (_a = items_2.return)) _a.call(items_2);
|
|
3745
|
+
}
|
|
3746
|
+
finally { if (e_2) throw e_2.error; }
|
|
3747
|
+
}
|
|
3748
|
+
};
|
|
3749
|
+
TheSeamNavService.prototype._updateItemExpandedState = function (item) {
|
|
3750
|
+
if (!horizontalNavItemCanExpand(item)) {
|
|
3751
|
+
if (getHorizontalNavItemStateProp(item, 'expanded')) {
|
|
3752
|
+
this.setItemStateProp(item, 'expanded', false);
|
|
3753
|
+
}
|
|
3754
|
+
return;
|
|
3755
|
+
}
|
|
3756
|
+
if (horizontalNavItemHasChildren(item)) {
|
|
3757
|
+
this._updateItemsExpandedState(item.children);
|
|
3758
|
+
}
|
|
3759
|
+
if (horizontalNavItemHasActiveChild(item) || horizontalNavItemHasExpandedChild(item)) {
|
|
3760
|
+
if (!getHorizontalNavItemStateProp(item, 'expanded')) {
|
|
3761
|
+
this.setItemStateProp(item, 'expanded', true);
|
|
3762
|
+
}
|
|
3763
|
+
}
|
|
3764
|
+
else {
|
|
3765
|
+
if (getHorizontalNavItemStateProp(item, 'expanded')) {
|
|
3766
|
+
this.setItemStateProp(item, 'expanded', false);
|
|
3767
|
+
}
|
|
3768
|
+
}
|
|
3769
|
+
};
|
|
3770
|
+
TheSeamNavService.prototype.updateRouterFocusedItem = function (items) {
|
|
3771
|
+
var focusedItem = items.find(function (i) { return isHorizontalNavItemActive(i); }) || items.find(function (i) { return horizontalNavItemHasActiveChild(i); });
|
|
3772
|
+
this.updateFocusedItem(items, focusedItem);
|
|
3773
|
+
};
|
|
3774
|
+
TheSeamNavService.prototype.updateFocusedItem = function (items, focusedItem) {
|
|
3775
|
+
var e_3, _a;
|
|
3776
|
+
try {
|
|
3777
|
+
for (var items_3 = __values(items), items_3_1 = items_3.next(); !items_3_1.done; items_3_1 = items_3.next()) {
|
|
3778
|
+
var item = items_3_1.value;
|
|
3779
|
+
if (item === focusedItem) {
|
|
3780
|
+
setHorizontalNavItemStateProp(item, 'focused', true);
|
|
3781
|
+
}
|
|
3782
|
+
else {
|
|
3783
|
+
setHorizontalNavItemStateProp(item, 'focused', false);
|
|
3784
|
+
}
|
|
3785
|
+
}
|
|
3786
|
+
}
|
|
3787
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
3788
|
+
finally {
|
|
3789
|
+
try {
|
|
3790
|
+
if (items_3_1 && !items_3_1.done && (_a = items_3.return)) _a.call(items_3);
|
|
3791
|
+
}
|
|
3792
|
+
finally { if (e_3) throw e_3.error; }
|
|
3793
|
+
}
|
|
3794
|
+
};
|
|
3795
|
+
TheSeamNavService.prototype._getNavExtras = function (item) {
|
|
3796
|
+
var navigationExtras = {};
|
|
3797
|
+
if (utils.hasProperty(item, 'queryParams')) {
|
|
3798
|
+
navigationExtras.queryParams = item.queryParams;
|
|
3799
|
+
}
|
|
3800
|
+
if (utils.hasProperty(item, 'fragment')) {
|
|
3801
|
+
navigationExtras.fragment = item.fragment;
|
|
3802
|
+
}
|
|
3803
|
+
if (utils.hasProperty(item, 'queryParamsHandling')) {
|
|
3804
|
+
navigationExtras.queryParamsHandling = item.queryParamsHandling;
|
|
3805
|
+
}
|
|
3806
|
+
if (utils.hasProperty(item, 'preserveFragment')) {
|
|
3807
|
+
navigationExtras.preserveFragment = item.preserveFragment;
|
|
3808
|
+
}
|
|
3809
|
+
return navigationExtras;
|
|
3810
|
+
};
|
|
3811
|
+
TheSeamNavService.prototype._getUrl = function (item) {
|
|
3812
|
+
var link = item.link;
|
|
3813
|
+
if (typeof link === 'string') {
|
|
3814
|
+
return this._router.createUrlTree([link], this._getNavExtras(item)).toString();
|
|
3815
|
+
}
|
|
3816
|
+
else if (Array.isArray(link)) {
|
|
3817
|
+
return this._router.createUrlTree(link, this._getNavExtras(item)).toString();
|
|
3818
|
+
}
|
|
3819
|
+
return null;
|
|
3820
|
+
};
|
|
3821
|
+
TheSeamNavService.prototype._getMatchOptions = function (item) {
|
|
3822
|
+
var defaultMatchOpts = {
|
|
3823
|
+
paths: 'subset',
|
|
3824
|
+
queryParams: 'subset',
|
|
3825
|
+
fragment: 'ignored',
|
|
3826
|
+
matrixParams: 'ignored'
|
|
3827
|
+
};
|
|
3828
|
+
if (utils.hasProperty(item, 'matchOptions')) {
|
|
3829
|
+
return Object.assign(Object.assign({}, defaultMatchOpts), item.matchOptions);
|
|
3830
|
+
}
|
|
3831
|
+
return defaultMatchOpts;
|
|
3832
|
+
};
|
|
3833
|
+
TheSeamNavService.prototype.setItemStateProp = function (item, prop, value) {
|
|
3834
|
+
var currentValue = getHorizontalNavItemStateProp(item, prop);
|
|
3835
|
+
if (currentValue !== value) {
|
|
3836
|
+
setHorizontalNavItemStateProp(item, prop, value);
|
|
3837
|
+
var changed = {
|
|
3838
|
+
item: item,
|
|
3839
|
+
prop: prop,
|
|
3840
|
+
prevValue: currentValue,
|
|
3841
|
+
newValue: value
|
|
3842
|
+
};
|
|
3843
|
+
this.itemChanged.next(changed);
|
|
3844
|
+
}
|
|
3845
|
+
};
|
|
3846
|
+
return TheSeamNavService;
|
|
3847
|
+
}());
|
|
3848
|
+
TheSeamNavService.decorators = [
|
|
3849
|
+
{ type: i0.Injectable }
|
|
3850
|
+
];
|
|
3851
|
+
TheSeamNavService.ctorParameters = function () { return [
|
|
3852
|
+
{ type: router.Router }
|
|
3853
|
+
]; };
|
|
3854
|
+
|
|
3624
3855
|
var NavItemComponent = /** @class */ (function () {
|
|
3625
|
-
function NavItemComponent() {
|
|
3856
|
+
function NavItemComponent(_nav) {
|
|
3857
|
+
this._nav = _nav;
|
|
3626
3858
|
this._ngUnsubscribe = new rxjs.Subject();
|
|
3627
3859
|
this.faAngleLeft = freeSolidSvgIcons.faAngleLeft;
|
|
3628
3860
|
this.active = false;
|
|
@@ -3634,6 +3866,7 @@
|
|
|
3634
3866
|
this.expanded$ = this._expanded.asObservable();
|
|
3635
3867
|
this._compact = new rxjs.BehaviorSubject(false);
|
|
3636
3868
|
this.compact$ = this._compact.asObservable();
|
|
3869
|
+
this.focused = false;
|
|
3637
3870
|
this.badgeTheme = 'danger';
|
|
3638
3871
|
this.childAction = 'menu';
|
|
3639
3872
|
this.expandAction = 'toggle';
|
|
@@ -3698,6 +3931,11 @@
|
|
|
3698
3931
|
enumerable: false,
|
|
3699
3932
|
configurable: true
|
|
3700
3933
|
});
|
|
3934
|
+
Object.defineProperty(NavItemComponent.prototype, "_isFocusedCssClass", {
|
|
3935
|
+
get: function () { return this.focused; },
|
|
3936
|
+
enumerable: false,
|
|
3937
|
+
configurable: true
|
|
3938
|
+
});
|
|
3701
3939
|
Object.defineProperty(NavItemComponent.prototype, "_attrDataHierLevel", {
|
|
3702
3940
|
get: function () { return this.hierLevel; },
|
|
3703
3941
|
enumerable: false,
|
|
@@ -3752,6 +3990,9 @@
|
|
|
3752
3990
|
}
|
|
3753
3991
|
this.expanded = ex;
|
|
3754
3992
|
this.navItemExpanded.emit(this.expanded);
|
|
3993
|
+
if (this.item && this.expanded) {
|
|
3994
|
+
this._nav.setItemStateProp(this.item, 'focused', this.expanded);
|
|
3995
|
+
}
|
|
3755
3996
|
// Prevents seam-menu from closing out when toggling child expand
|
|
3756
3997
|
event.stopPropagation();
|
|
3757
3998
|
};
|
|
@@ -3779,7 +4020,7 @@
|
|
|
3779
4020
|
NavItemComponent.decorators = [
|
|
3780
4021
|
{ type: i0.Component, args: [{
|
|
3781
4022
|
selector: 'seam-nav-item',
|
|
3782
|
-
template: "<div class=\"d-flex flex-row h-100\">\n <ng-container *ngIf=\"itemType === 'basic'\">\n <ng-template [ngTemplateOutlet]=\"itemTypeBasic\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"itemType === 'link'\">\n <ng-template [ngTemplateOutlet]=\"itemTypeLink\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"itemType === 'divider'\">\n <ng-template [ngTemplateOutlet]=\"itemTypeDivider\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"itemType === 'title'\">\n <ng-template [ngTemplateOutlet]=\"itemTypeTitle\"></ng-template>\n </ng-container>\n</div>\n\n<ng-container *ngIf=\"hasExpandingChildren\">\n <div class=\"nav--group nav--group--level-{{ hierLevel + 1 }}\"\n *ngIf=\"expanded$ | async\" @childGroupAnim>\n <ng-container *ngTemplateOutlet=\"navChildren\"></ng-container>\n </div>\n</ng-container>\n\n<ng-template #itemTypeBasic>\n <button class=\"nav-item btn nav-btn p-0 d-flex align-items-stretch flex-row text-decoration-none w-100\"\n cdkMonitorElementFocus\n (click)=\"_toggleChildren($event)\"\n [seamMenuToggle]=\"menuTpl\"\n (menuToggle)=\"_menuEvent($event)\"\n [attr.aria-expanded]=\"expanded$ | async\">\n <div class=\"nav-link d-flex flex-row align-items-center w-100\" [class.nav-link__compact]=\"compact\">\n <div class=\"nav-item--icon\" *ngIf=\"showIconBlock\">\n <seam-icon [icon]=\"icon\" *ngIf=\"icon\"></seam-icon>\n <ng-container *ngIf=\"compact\">\n <ng-template [ngTemplateOutlet]=\"itemBadge\"></ng-template>\n </ng-container>\n </div>\n <span *ngIf=\"!compact\" nav-item-label>\n {{ label }}\n </span>\n <span *ngIf=\"compact\" class=\"sr-only\" nav-item-label>{{ label }}</span>\n <ng-container *ngIf=\"!compact\">\n <ng-template [ngTemplateOutlet]=\"itemBadge\"></ng-template>\n </ng-container>\n </div>\n\n <div *ngIf=\"hasChildren && !compact\"\n class=\"btn nav-btn nav-item--toggle-btn-container d-flex align-items-center\">\n <seam-icon\n class=\"nav-item--toggle-btn\"\n [class.nav-item--toggle-btn-expanded]=\"expanded$ | async\"\n [icon]=\"faAngleLeft\"\n type>\n </seam-icon>\n </div>\n </button>\n</ng-template>\n\n<ng-template #itemTypeLink>\n <a *ngIf=\"link; else noLink\" class=\"nav-item nav-link d-flex flex-row w-100 align-items-center\"\n [class.nav-link__compact]=\"compact\"\n [routerLink]=\"link\"\n [queryParams]=\"queryParams\"\n routerLinkActive=\"active\"\n [routerLinkActiveOptions]=\"{ exact: true }\">\n <div class=\"nav-item--icon\" *ngIf=\"showIconBlock\">\n <seam-icon [icon]=\"icon\" *ngIf=\"icon\"></seam-icon>\n <ng-container *ngIf=\"compact\">\n <ng-template [ngTemplateOutlet]=\"itemBadge\"></ng-template>\n </ng-container>\n </div>\n <span *ngIf=\"!compact\" nav-item-label>\n {{ label }}\n </span>\n <span *ngIf=\"compact\" class=\"sr-only\" nav-item-label>{{ label }}</span>\n <ng-container *ngIf=\"!compact\">\n <ng-template [ngTemplateOutlet]=\"itemBadge\"></ng-template>\n </ng-container>\n </a>\n\n <ng-template #noLink>\n <a class=\"nav-item nav-link d-flex flex-row w-100 align-items-center\" [class.nav-link__compact]=\"compact\">\n <div class=\"nav-item--icon\" *ngIf=\"showIconBlock\">\n <seam-icon [icon]=\"icon\" *ngIf=\"icon\"></seam-icon>\n </div>\n <span *ngIf=\"!compact\" nav-item-label>\n {{ label }}\n </span>\n <span *ngIf=\"compact\" class=\"sr-only\" nav-item-label>{{ label }}</span>\n </a>\n </ng-template>\n\n <button *ngIf=\"hasChildren && !compact\"\n type=\"button\"\n class=\"btn nav-btn nav-item--toggle-btn-container\"\n (click)=\"_toggleChildren($event)\"\n [seamMenuToggle]=\"menuTpl\"\n (menuToggle)=\"_menuEvent($event)\"\n [attr.aria-expanded]=\"expanded$ | async\"\n cdkMonitorElementFocus>\n <seam-icon\n class=\"nav-item--toggle-btn\"\n [class.nav-item--toggle-btn-expanded]=\"expanded$ | async\"\n [icon]=\"faAngleLeft\"\n type>\n </seam-icon>\n <span class=\"sr-only\">Group Toggle</span>\n </button>\n</ng-template>\n\n<ng-template #itemTypeDivider>\n <div class=\"px-2 w-100\">\n <hr class=\"nav-item--divider\" />\n </div>\n</ng-template>\n\n<ng-template #itemTypeTitle>\n <ng-container *ngIf=\"!compact\">\n <span class=\"nav-item--title pt-1\" nav-item-label>{{ label }}</span>\n </ng-container>\n</ng-template>\n\n<ng-template #itemBadge>\n <ng-container *ngIf=\"badgeText\">\n <div class=\"badge-spacer flex-grow-1\" *ngIf=\"!compact\"></div>\n <div class=\"nav-item--badge\"\n [class.nav-item--badge-no-icon]=\"!icon\"\n [ngbTooltip]=\"$any(badgeTooltip)?.tooltip\"\n [tooltipClass]=\"$any(badgeTooltip)?.class\"\n [placement]=\"$any(badgeTooltip)?.placement\"\n [container]=\"$any(badgeTooltip)?.container\"\n [disableTooltip]=\"!badgeTooltip || !!$any(badgeTooltip)?.disabled\">\n <span class=\"badge badge-pill badge-{{ badgeTheme }}\">\n <ng-container *ngIf=\"!compact || !icon\">\n {{ badgeText }}\n </ng-container>\n <span *ngIf=\"badgeSrContent\">{{ badgeSrContent }}</span>\n </span>\n </div>\n </ng-container>\n</ng-template>\n\n<seam-menu #menu *ngIf=\"hasMenuToggle\">\n <ng-container *ngTemplateOutlet=\"navChildren\"></ng-container>\n</seam-menu>\n\n<ng-template #navChildren>\n <seam-nav-item *ngFor=\"let child of children\"\n [item]=\"child\"\n [hierLevel]=\"compact ? 0 : (hierLevel + 1)\"\n [compact]=\"compact\"\n [itemType]=\"$any(child).itemType\"\n [icon]=\"$any(child).icon\"\n [label]=\"$any(child).label\"\n [link]=\"$any(child).link\"\n [badgeText]=\"$any(child).badge?.text\"\n [badgeTheme]=\"$any(child).badge?.theme || 'danger'\"\n [badgeSrContent]=\"$any(child).badge?.srContent\"\n [badgeTooltip]=\"$any(child)?.badge?.tooltip\"\n [queryParams]=\"$any(child).queryParams\"\n routerLinkActive=\"active\"\n [routerLinkActiveOptions]=\"{ exact: true }\"\n [children]=\"$any(child)?.children\"\n [active]=\"$any(child).__state?.active\"\n [expanded]=\"$any(child).__state?.expanded\"\n childAction=\"expand\"\n [hideEmptyIcon]=\"hideEmptyIcon\">\n </seam-nav-item>\n</ng-template>\n\n",
|
|
4023
|
+
template: "<div class=\"d-flex flex-row h-100\">\n <ng-container *ngIf=\"itemType === 'basic'\">\n <ng-template [ngTemplateOutlet]=\"itemTypeBasic\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"itemType === 'link'\">\n <ng-template [ngTemplateOutlet]=\"itemTypeLink\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"itemType === 'divider'\">\n <ng-template [ngTemplateOutlet]=\"itemTypeDivider\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"itemType === 'title'\">\n <ng-template [ngTemplateOutlet]=\"itemTypeTitle\"></ng-template>\n </ng-container>\n</div>\n\n<ng-container *ngIf=\"hasExpandingChildren\">\n <div class=\"nav--group nav--group--level-{{ hierLevel + 1 }}\"\n *ngIf=\"expanded$ | async\" @childGroupAnim>\n <ng-container *ngTemplateOutlet=\"navChildren\"></ng-container>\n </div>\n</ng-container>\n\n<ng-template #itemTypeBasic>\n <button class=\"nav-item btn nav-btn p-0 d-flex align-items-stretch flex-row text-decoration-none w-100\"\n cdkMonitorElementFocus\n (click)=\"_toggleChildren($event)\"\n [seamMenuToggle]=\"menuTpl\"\n (menuToggle)=\"_menuEvent($event)\"\n [attr.aria-expanded]=\"expanded$ | async\">\n <div class=\"nav-link d-flex flex-row align-items-center w-100\" [class.nav-link__compact]=\"compact\">\n <div class=\"nav-item--icon\" *ngIf=\"showIconBlock\">\n <seam-icon [icon]=\"icon\" *ngIf=\"icon\"></seam-icon>\n <ng-container *ngIf=\"compact\">\n <ng-template [ngTemplateOutlet]=\"itemBadge\"></ng-template>\n </ng-container>\n </div>\n <span *ngIf=\"!compact\" nav-item-label>\n {{ label }}\n </span>\n <span *ngIf=\"compact\" class=\"sr-only\" nav-item-label>{{ label }}</span>\n <ng-container *ngIf=\"!compact\">\n <ng-template [ngTemplateOutlet]=\"itemBadge\"></ng-template>\n </ng-container>\n </div>\n\n <div *ngIf=\"hasChildren && !compact\"\n class=\"btn nav-btn nav-item--toggle-btn-container d-flex align-items-center\">\n <seam-icon\n class=\"nav-item--toggle-btn\"\n [class.nav-item--toggle-btn-expanded]=\"expanded$ | async\"\n [icon]=\"faAngleLeft\"\n type>\n </seam-icon>\n </div>\n </button>\n</ng-template>\n\n<ng-template #itemTypeLink>\n <a *ngIf=\"link; else noLink\" class=\"nav-item nav-link d-flex flex-row w-100 align-items-center\"\n [class.nav-link__compact]=\"compact\"\n [routerLink]=\"link\"\n [queryParams]=\"queryParams\"\n routerLinkActive=\"active\"\n [routerLinkActiveOptions]=\"{ exact: true }\">\n <div class=\"nav-item--icon\" *ngIf=\"showIconBlock\">\n <seam-icon [icon]=\"icon\" *ngIf=\"icon\"></seam-icon>\n <ng-container *ngIf=\"compact\">\n <ng-template [ngTemplateOutlet]=\"itemBadge\"></ng-template>\n </ng-container>\n </div>\n <span *ngIf=\"!compact\" nav-item-label>\n {{ label }}\n </span>\n <span *ngIf=\"compact\" class=\"sr-only\" nav-item-label>{{ label }}</span>\n <ng-container *ngIf=\"!compact\">\n <ng-template [ngTemplateOutlet]=\"itemBadge\"></ng-template>\n </ng-container>\n </a>\n\n <ng-template #noLink>\n <a class=\"nav-item nav-link d-flex flex-row w-100 align-items-center\" [class.nav-link__compact]=\"compact\">\n <div class=\"nav-item--icon\" *ngIf=\"showIconBlock\">\n <seam-icon [icon]=\"icon\" *ngIf=\"icon\"></seam-icon>\n </div>\n <span *ngIf=\"!compact\" nav-item-label>\n {{ label }}\n </span>\n <span *ngIf=\"compact\" class=\"sr-only\" nav-item-label>{{ label }}</span>\n </a>\n </ng-template>\n\n <button *ngIf=\"hasChildren && !compact\"\n type=\"button\"\n class=\"btn nav-btn nav-item--toggle-btn-container\"\n (click)=\"_toggleChildren($event)\"\n [seamMenuToggle]=\"menuTpl\"\n (menuToggle)=\"_menuEvent($event)\"\n [attr.aria-expanded]=\"expanded$ | async\"\n cdkMonitorElementFocus>\n <seam-icon\n class=\"nav-item--toggle-btn\"\n [class.nav-item--toggle-btn-expanded]=\"expanded$ | async\"\n [icon]=\"faAngleLeft\"\n type>\n </seam-icon>\n <span class=\"sr-only\">Group Toggle</span>\n </button>\n</ng-template>\n\n<ng-template #itemTypeDivider>\n <div class=\"px-2 w-100\">\n <hr class=\"nav-item--divider\" />\n </div>\n</ng-template>\n\n<ng-template #itemTypeTitle>\n <ng-container *ngIf=\"!compact\">\n <span class=\"nav-item--title pt-1\" nav-item-label>{{ label }}</span>\n </ng-container>\n</ng-template>\n\n<ng-template #itemBadge>\n <ng-container *ngIf=\"badgeText\">\n <div class=\"badge-spacer flex-grow-1\" *ngIf=\"!compact\"></div>\n <div class=\"nav-item--badge\"\n [class.nav-item--badge-no-icon]=\"!icon\"\n [ngbTooltip]=\"$any(badgeTooltip)?.tooltip\"\n [tooltipClass]=\"$any(badgeTooltip)?.class\"\n [placement]=\"$any(badgeTooltip)?.placement\"\n [container]=\"$any(badgeTooltip)?.container\"\n [disableTooltip]=\"!badgeTooltip || !!$any(badgeTooltip)?.disabled\">\n <span class=\"badge badge-pill badge-{{ badgeTheme }}\">\n <ng-container *ngIf=\"!compact || !icon\">\n {{ badgeText }}\n </ng-container>\n <span *ngIf=\"badgeSrContent\">{{ badgeSrContent }}</span>\n </span>\n </div>\n </ng-container>\n</ng-template>\n\n<seam-menu #menu *ngIf=\"hasMenuToggle\">\n <ng-container *ngTemplateOutlet=\"navChildren\"></ng-container>\n</seam-menu>\n\n<ng-template #navChildren>\n <seam-nav-item *ngFor=\"let child of children\"\n [item]=\"child\"\n [hierLevel]=\"compact ? 0 : (hierLevel + 1)\"\n [compact]=\"compact\"\n [itemType]=\"$any(child).itemType\"\n [icon]=\"$any(child).icon\"\n [label]=\"$any(child).label\"\n [link]=\"$any(child).link\"\n [badgeText]=\"$any(child).badge?.text\"\n [badgeTheme]=\"$any(child).badge?.theme || 'danger'\"\n [badgeSrContent]=\"$any(child).badge?.srContent\"\n [badgeTooltip]=\"$any(child)?.badge?.tooltip\"\n [queryParams]=\"$any(child).queryParams\"\n routerLinkActive=\"active\"\n [routerLinkActiveOptions]=\"{ exact: true }\"\n [children]=\"$any(child)?.children\"\n [active]=\"$any(child).__state?.active\"\n [expanded]=\"$any(child).__state?.expanded\"\n [focused]=\"$any(child).__state?.focused\"\n childAction=\"expand\"\n [hideEmptyIcon]=\"hideEmptyIcon\">\n </seam-nav-item>\n</ng-template>\n\n",
|
|
3783
4024
|
exportAs: 'seamNavItem',
|
|
3784
4025
|
animations: [
|
|
3785
4026
|
animations.trigger('childGroupAnim', [
|
|
@@ -3798,7 +4039,9 @@
|
|
|
3798
4039
|
styles: ["seam-nav-item{display:block;transition:.25s ease-in-out background-color;text-align:inherit;border-radius:0;overflow:hidden;background:transparent;margin:0}seam-nav-item.seam-nav-item--expanded{background-color:transparent}seam-nav-item.seam-nav-item--expanded .nav-link{color:#000}seam-nav-item.seam-nav-item--child-active{background-color:#dae0e5}seam-nav-item.seam-nav-item--child-active .nav-link{color:#000}seam-nav-item.seam-nav-item--active{background-color:#dae0e5}seam-nav-item.seam-nav-item--active .active,seam-nav-item.seam-nav-item--active:active,seam-nav-item.seam-nav-item--active .nav-item.active:hover{background-color:#dae0e5}seam-nav-item.seam-nav-item--active .nav-item:hover{background-color:#e9ecef}seam-nav-item.seam-nav-item--active .nav-link{color:#000}seam-nav-item .badge{vertical-align:middle}seam-nav-item:not(.nav-item--icon) .nav-item--badge{pointer-events:all;margin-left:5px;margin-right:3px}seam-nav-item .nav-item--icon{position:relative;width:24px;max-width:24px;min-width:24px;height:24px;max-height:24px;min-height:24px;text-align:center;margin-right:.5rem}seam-nav-item .nav-item--icon .nav-item--badge{top:-4px;right:-4px;position:absolute}seam-nav-item .nav-item--icon .nav-item--badge .badge:empty{display:block;width:8px;height:8px;padding:0}seam-nav-item .nav-item--icon .nav-item--badge.nav-item--badge-no-icon{top:0px;right:0px}seam-nav-item .nav-item{transition:.25s ease-in-out background-color}seam-nav-item .nav-item:hover{background-color:#e9ecef}seam-nav-item .nav-item.active{pointer-events:none;cursor:default}seam-nav-item a.nav-item:not([href]):not([tabindex]){color:#000}seam-nav-item a.nav-item:not([href]):not([tabindex]):hover{background-color:transparent}seam-nav-item .nav-link{color:#000}seam-nav-item .nav-btn{font-weight:400;color:#000;text-decoration:none;border-radius:0;border:0 solid #dee2e6}seam-nav-item .nav-btn:hover{color:#000;text-decoration:underline}seam-nav-item .nav-btn:focus,seam-nav-item .nav-btn.focus{text-decoration:underline;box-shadow:none}seam-nav-item .nav-btn:disabled,seam-nav-item .nav-btn.disabled{color:#000;pointer-events:none}seam-nav-item .cdk-keyboard-focused{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}seam-nav-item .nav-item--toggle-btn-container{transition:.25s ease-in-out background-color;padding:0 .5rem}seam-nav-item button.nav-item--toggle-btn-container:hover{background-color:#e9ecef}seam-nav-item .nav-item--toggle-btn .svg-inline--fa{transition:.1s ease-in-out transform;transform:none}seam-nav-item .nav-item--toggle-btn.nav-item--toggle-btn-expanded .svg-inline--fa{transform:rotate(-90deg)}seam-nav-item .nav--group{will-change:height;overflow:hidden}seam-nav-item .nav--group--level-1{background-color:#eff1f4}seam-nav-item .nav--group--level-2{background-color:#e6eaed}seam-nav-item .nav--group--level-3{background-color:#dde2e7}seam-nav-item .nav--group--level-4{background-color:#d4dae1}seam-nav-item .nav--group--level-5{background-color:#cbd3da}seam-nav-item .nav--group--level-6{background-color:#c2cbd4}seam-nav-item .nav--group--level-7{background-color:#bac3cd}seam-nav-item .nav--group--level-8{background-color:#b1bcc7}seam-nav-item .nav--group--level-9{background-color:#a8b4c1}seam-nav-item .nav-item--divider{display:block;border-top:1px solid #dae0e5;width:100%}seam-nav-item .nav-item--title{color:#000;font-size:24px;padding-left:10px}seam-nav-item .sr-only{top:0;left:0}\n"]
|
|
3799
4040
|
},] }
|
|
3800
4041
|
];
|
|
3801
|
-
NavItemComponent.ctorParameters = function () { return [
|
|
4042
|
+
NavItemComponent.ctorParameters = function () { return [
|
|
4043
|
+
{ type: TheSeamNavService }
|
|
4044
|
+
]; };
|
|
3802
4045
|
NavItemComponent.propDecorators = {
|
|
3803
4046
|
item: [{ type: i0.Input }],
|
|
3804
4047
|
itemType: [{ type: i0.Input }],
|
|
@@ -3813,6 +4056,7 @@
|
|
|
3813
4056
|
indentSize: [{ type: i0.Input }],
|
|
3814
4057
|
expanded: [{ type: i0.Input }],
|
|
3815
4058
|
compact: [{ type: i0.Input }],
|
|
4059
|
+
focused: [{ type: i0.Input }],
|
|
3816
4060
|
badgeText: [{ type: i0.Input }],
|
|
3817
4061
|
badgeTheme: [{ type: i0.Input }],
|
|
3818
4062
|
badgeSrContent: [{ type: i0.Input }],
|
|
@@ -3823,6 +4067,7 @@
|
|
|
3823
4067
|
_isActiveCssClass: [{ type: i0.HostBinding, args: ['class.seam-nav-item--active',] }],
|
|
3824
4068
|
_isChildActiveCssClass: [{ type: i0.HostBinding, args: ['class.seam-nav-item--child-active',] }],
|
|
3825
4069
|
_isExpandedCssClass: [{ type: i0.HostBinding, args: ['class.seam-nav-item--expanded',] }],
|
|
4070
|
+
_isFocusedCssClass: [{ type: i0.HostBinding, args: ['class.seam-nav-item--focused',] }],
|
|
3826
4071
|
_attrDataHierLevel: [{ type: i0.HostBinding, args: ['attr.data-hier-level',] }],
|
|
3827
4072
|
_menu: [{ type: i0.ViewChild, args: [menu.MenuComponent,] }],
|
|
3828
4073
|
_navItems: [{ type: i0.ViewChildren, args: [NavItemComponent,] }]
|
|
@@ -3837,211 +4082,18 @@
|
|
|
3837
4082
|
core.InputNumber(10)
|
|
3838
4083
|
], NavItemComponent.prototype, "indentSize", void 0);
|
|
3839
4084
|
|
|
3840
|
-
var TheSeamNavService = /** @class */ (function () {
|
|
3841
|
-
function TheSeamNavService(_router) {
|
|
3842
|
-
this._router = _router;
|
|
3843
|
-
this._updatingCount = new rxjs.BehaviorSubject(0);
|
|
3844
|
-
this.itemChanged = new rxjs.Subject();
|
|
3845
|
-
this.loading$ = this._updatingCount.pipe(operators.map(function (count) { return count > 0; }), operators.distinctUntilChanged(), operators.shareReplay({ bufferSize: 1, refCount: true }));
|
|
3846
|
-
}
|
|
3847
|
-
TheSeamNavService.prototype.createItemsObservable = function (items) {
|
|
3848
|
-
var _this = this;
|
|
3849
|
-
return rxjs.defer(function () {
|
|
3850
|
-
_this.updateItemsStates(items);
|
|
3851
|
-
return new rxjs.Observable(function (subscriber) {
|
|
3852
|
-
var stateChangeSub = _this.itemChanged.pipe(operators.switchMap(function (change) {
|
|
3853
|
-
return _this.loading$.pipe(operators.filter(function (loading) { return !loading; }));
|
|
3854
|
-
})).subscribe(function () {
|
|
3855
|
-
subscriber.next(items);
|
|
3856
|
-
});
|
|
3857
|
-
try {
|
|
3858
|
-
_this.updateItemsStates(items);
|
|
3859
|
-
}
|
|
3860
|
-
catch (err) {
|
|
3861
|
-
subscriber.error(err);
|
|
3862
|
-
}
|
|
3863
|
-
var routeChangeSub = _this._router.events.pipe(operators.filter(function (event) { return event instanceof router.NavigationEnd; })).subscribe(function () {
|
|
3864
|
-
try {
|
|
3865
|
-
_this.updateItemsStates(items);
|
|
3866
|
-
}
|
|
3867
|
-
catch (err) {
|
|
3868
|
-
subscriber.error(err);
|
|
3869
|
-
}
|
|
3870
|
-
});
|
|
3871
|
-
return function () {
|
|
3872
|
-
stateChangeSub.unsubscribe();
|
|
3873
|
-
routeChangeSub.unsubscribe();
|
|
3874
|
-
};
|
|
3875
|
-
}).pipe(operators.startWith(items));
|
|
3876
|
-
});
|
|
3877
|
-
};
|
|
3878
|
-
TheSeamNavService.prototype._incUpdatingCount = function () {
|
|
3879
|
-
this._updatingCount.next(this._updatingCount.value + 1);
|
|
3880
|
-
};
|
|
3881
|
-
TheSeamNavService.prototype._decrUpdatingCount = function () {
|
|
3882
|
-
this._updatingCount.next(this._updatingCount.value - 1);
|
|
3883
|
-
};
|
|
3884
|
-
TheSeamNavService.prototype.updateItemsStates = function (items) {
|
|
3885
|
-
var e_1, _a;
|
|
3886
|
-
this._incUpdatingCount();
|
|
3887
|
-
try {
|
|
3888
|
-
try {
|
|
3889
|
-
for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
|
|
3890
|
-
var item = items_1_1.value;
|
|
3891
|
-
if (horizontalNavItemHasChildren(item)) {
|
|
3892
|
-
this.updateItemsStates(item.children);
|
|
3893
|
-
}
|
|
3894
|
-
this.updateItemState(item);
|
|
3895
|
-
}
|
|
3896
|
-
}
|
|
3897
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3898
|
-
finally {
|
|
3899
|
-
try {
|
|
3900
|
-
if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);
|
|
3901
|
-
}
|
|
3902
|
-
finally { if (e_1) throw e_1.error; }
|
|
3903
|
-
}
|
|
3904
|
-
this._decrUpdatingCount();
|
|
3905
|
-
}
|
|
3906
|
-
catch (err) {
|
|
3907
|
-
this._decrUpdatingCount();
|
|
3908
|
-
throw err;
|
|
3909
|
-
}
|
|
3910
|
-
};
|
|
3911
|
-
TheSeamNavService.prototype.updateItemState = function (item) {
|
|
3912
|
-
this._incUpdatingCount();
|
|
3913
|
-
try {
|
|
3914
|
-
setDefaultHorizontalNavItemState(item);
|
|
3915
|
-
if (isHorizontalNavItemType(item, 'link')) {
|
|
3916
|
-
var url = this._getUrl(item);
|
|
3917
|
-
if (utils.notNullOrUndefined(url)) {
|
|
3918
|
-
var opts = this._getMatchOptions(item);
|
|
3919
|
-
this.setItemStateProp(item, 'active', this._router.isActive(url, opts));
|
|
3920
|
-
}
|
|
3921
|
-
}
|
|
3922
|
-
// TODO: Implement this in a more optimized way. Unless our apps start
|
|
3923
|
-
// having large navs constantly updating their state, this shouldn't
|
|
3924
|
-
// have much impact on performance.
|
|
3925
|
-
this._updateItemExpandedState(item);
|
|
3926
|
-
this._decrUpdatingCount();
|
|
3927
|
-
}
|
|
3928
|
-
catch (err) {
|
|
3929
|
-
this._decrUpdatingCount();
|
|
3930
|
-
throw err;
|
|
3931
|
-
}
|
|
3932
|
-
};
|
|
3933
|
-
TheSeamNavService.prototype._updateItemsExpandedState = function (items) {
|
|
3934
|
-
var e_2, _a;
|
|
3935
|
-
try {
|
|
3936
|
-
for (var items_2 = __values(items), items_2_1 = items_2.next(); !items_2_1.done; items_2_1 = items_2.next()) {
|
|
3937
|
-
var item = items_2_1.value;
|
|
3938
|
-
if (horizontalNavItemHasChildren(item)) {
|
|
3939
|
-
this._updateItemsExpandedState(item.children);
|
|
3940
|
-
}
|
|
3941
|
-
this._updateItemExpandedState(item);
|
|
3942
|
-
}
|
|
3943
|
-
}
|
|
3944
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
3945
|
-
finally {
|
|
3946
|
-
try {
|
|
3947
|
-
if (items_2_1 && !items_2_1.done && (_a = items_2.return)) _a.call(items_2);
|
|
3948
|
-
}
|
|
3949
|
-
finally { if (e_2) throw e_2.error; }
|
|
3950
|
-
}
|
|
3951
|
-
};
|
|
3952
|
-
TheSeamNavService.prototype._updateItemExpandedState = function (item) {
|
|
3953
|
-
if (!horizontalNavItemCanExpand(item)) {
|
|
3954
|
-
if (getHorizontalNavItemStateProp(item, 'expanded')) {
|
|
3955
|
-
this.setItemStateProp(item, 'expanded', false);
|
|
3956
|
-
}
|
|
3957
|
-
return;
|
|
3958
|
-
}
|
|
3959
|
-
if (horizontalNavItemHasChildren(item)) {
|
|
3960
|
-
this._updateItemsExpandedState(item.children);
|
|
3961
|
-
}
|
|
3962
|
-
if (horizontalNavItemHasActiveChild(item) || horizontalNavItemHasExpandedChild(item)) {
|
|
3963
|
-
if (!getHorizontalNavItemStateProp(item, 'expanded')) {
|
|
3964
|
-
this.setItemStateProp(item, 'expanded', true);
|
|
3965
|
-
}
|
|
3966
|
-
}
|
|
3967
|
-
else {
|
|
3968
|
-
if (getHorizontalNavItemStateProp(item, 'expanded')) {
|
|
3969
|
-
this.setItemStateProp(item, 'expanded', false);
|
|
3970
|
-
}
|
|
3971
|
-
}
|
|
3972
|
-
};
|
|
3973
|
-
TheSeamNavService.prototype._getNavExtras = function (item) {
|
|
3974
|
-
var navigationExtras = {};
|
|
3975
|
-
if (utils.hasProperty(item, 'queryParams')) {
|
|
3976
|
-
navigationExtras.queryParams = item.queryParams;
|
|
3977
|
-
}
|
|
3978
|
-
if (utils.hasProperty(item, 'fragment')) {
|
|
3979
|
-
navigationExtras.fragment = item.fragment;
|
|
3980
|
-
}
|
|
3981
|
-
if (utils.hasProperty(item, 'queryParamsHandling')) {
|
|
3982
|
-
navigationExtras.queryParamsHandling = item.queryParamsHandling;
|
|
3983
|
-
}
|
|
3984
|
-
if (utils.hasProperty(item, 'preserveFragment')) {
|
|
3985
|
-
navigationExtras.preserveFragment = item.preserveFragment;
|
|
3986
|
-
}
|
|
3987
|
-
return navigationExtras;
|
|
3988
|
-
};
|
|
3989
|
-
TheSeamNavService.prototype._getUrl = function (item) {
|
|
3990
|
-
var link = item.link;
|
|
3991
|
-
if (typeof link === 'string') {
|
|
3992
|
-
return this._router.createUrlTree([link], this._getNavExtras(item)).toString();
|
|
3993
|
-
}
|
|
3994
|
-
else if (Array.isArray(link)) {
|
|
3995
|
-
return this._router.createUrlTree(link, this._getNavExtras(item)).toString();
|
|
3996
|
-
}
|
|
3997
|
-
return null;
|
|
3998
|
-
};
|
|
3999
|
-
TheSeamNavService.prototype._getMatchOptions = function (item) {
|
|
4000
|
-
var defaultMatchOpts = {
|
|
4001
|
-
paths: 'subset',
|
|
4002
|
-
queryParams: 'subset',
|
|
4003
|
-
fragment: 'ignored',
|
|
4004
|
-
matrixParams: 'ignored'
|
|
4005
|
-
};
|
|
4006
|
-
if (utils.hasProperty(item, 'matchOptions')) {
|
|
4007
|
-
return Object.assign(Object.assign({}, defaultMatchOpts), item.matchOptions);
|
|
4008
|
-
}
|
|
4009
|
-
return defaultMatchOpts;
|
|
4010
|
-
};
|
|
4011
|
-
TheSeamNavService.prototype.setItemStateProp = function (item, prop, value) {
|
|
4012
|
-
var currentValue = getHorizontalNavItemStateProp(item, prop);
|
|
4013
|
-
if (currentValue !== value) {
|
|
4014
|
-
setHorizontalNavItemStateProp(item, prop, value);
|
|
4015
|
-
var changed = {
|
|
4016
|
-
item: item,
|
|
4017
|
-
prop: prop,
|
|
4018
|
-
prevValue: currentValue,
|
|
4019
|
-
newValue: value
|
|
4020
|
-
};
|
|
4021
|
-
this.itemChanged.next(changed);
|
|
4022
|
-
}
|
|
4023
|
-
};
|
|
4024
|
-
return TheSeamNavService;
|
|
4025
|
-
}());
|
|
4026
|
-
TheSeamNavService.decorators = [
|
|
4027
|
-
{ type: i0.Injectable }
|
|
4028
|
-
];
|
|
4029
|
-
TheSeamNavService.ctorParameters = function () { return [
|
|
4030
|
-
{ type: router.Router }
|
|
4031
|
-
]; };
|
|
4032
|
-
|
|
4033
4085
|
var HorizontalNavComponent = /** @class */ (function () {
|
|
4034
|
-
function HorizontalNavComponent() {
|
|
4086
|
+
function HorizontalNavComponent(_nav) {
|
|
4087
|
+
var _this = this;
|
|
4088
|
+
this._nav = _nav;
|
|
4035
4089
|
this._ngUnsubscribe = new rxjs.Subject();
|
|
4036
4090
|
this._items = new rxjs.BehaviorSubject([]);
|
|
4037
4091
|
this.hideEmptyIcon = true;
|
|
4038
4092
|
this.hierLevel = 0;
|
|
4039
4093
|
this.childAction = 'menu';
|
|
4040
4094
|
this.expandAction = 'toggle';
|
|
4041
|
-
this._focusedNavItem = new rxjs.BehaviorSubject(undefined);
|
|
4042
|
-
this.focusedNavItem$ = this._focusedNavItem.asObservable();
|
|
4043
4095
|
this.navItemExpanded = new i0.EventEmitter();
|
|
4044
|
-
this.items$ = this._items.asObservable();
|
|
4096
|
+
this.items$ = this._items.asObservable().pipe(operators.switchMap(function (items) { return items ? _this._nav.createItemsObservable(items) : []; }), operators.shareReplay({ bufferSize: 1, refCount: true }));
|
|
4045
4097
|
}
|
|
4046
4098
|
Object.defineProperty(HorizontalNavComponent.prototype, "items", {
|
|
4047
4099
|
get: function () { return this._items.value; },
|
|
@@ -4051,21 +4103,6 @@
|
|
|
4051
4103
|
enumerable: false,
|
|
4052
4104
|
configurable: true
|
|
4053
4105
|
});
|
|
4054
|
-
Object.defineProperty(HorizontalNavComponent.prototype, "focusedNavItem", {
|
|
4055
|
-
/**
|
|
4056
|
-
* The 'focused' nav item refers to the item in
|
|
4057
|
-
* the list that was most recently expanded or activated.
|
|
4058
|
-
* // TODO: make all this better
|
|
4059
|
-
*/
|
|
4060
|
-
get: function () {
|
|
4061
|
-
return this._focusedNavItem.value;
|
|
4062
|
-
},
|
|
4063
|
-
set: function (value) {
|
|
4064
|
-
this._focusedNavItem.next(value);
|
|
4065
|
-
},
|
|
4066
|
-
enumerable: false,
|
|
4067
|
-
configurable: true
|
|
4068
|
-
});
|
|
4069
4106
|
HorizontalNavComponent.prototype.ngOnInit = function () { };
|
|
4070
4107
|
HorizontalNavComponent.prototype.ngOnDestroy = function () {
|
|
4071
4108
|
this._ngUnsubscribe.next();
|
|
@@ -4074,15 +4111,12 @@
|
|
|
4074
4111
|
HorizontalNavComponent.prototype._navItemExpanded = function (item, expanded) {
|
|
4075
4112
|
this.navItemExpanded.emit({ navItem: item, expanded: expanded });
|
|
4076
4113
|
};
|
|
4077
|
-
HorizontalNavComponent.prototype._navItemIsFocused = function (item) {
|
|
4078
|
-
return this.focusedNavItem$.pipe(operators.map(function (focusedNavItem) { return areSameHorizontalNavItem(focusedNavItem, item); }));
|
|
4079
|
-
};
|
|
4080
4114
|
return HorizontalNavComponent;
|
|
4081
4115
|
}());
|
|
4082
4116
|
HorizontalNavComponent.decorators = [
|
|
4083
4117
|
{ type: i0.Component, args: [{
|
|
4084
4118
|
selector: 'seam-horizontal-nav',
|
|
4085
|
-
template: "<div class=\"nav-inner-wrapper\" class=\"nav-inner-wrapper-{{hierLevel}}\">\n <div class=\"nav-items-row\">\n <seam-nav-item *ngFor=\"let item of items$ | async\"\n class=\"flex-shrink-0\"\n [item]=\"item\"\n [itemType]=\"$any(item)?.itemType\"\n [icon]=\"$any(item)?.icon\"\n [label]=\"$any(item)?.label\"\n [link]=\"$any(item)?.link\"\n [badgeText]=\"$any(item)?.badge?.text\"\n [badgeTheme]=\"$any(item)?.badge?.theme || 'danger'\"\n [badgeSrContent]=\"$any(item)?.badge?.srContent\"\n [badgeTooltip]=\"$any(item)?.badge?.tooltip\"\n [queryParams]=\"$any(item)?.queryParams\"\n [children]=\"$any(item)?.children\"\n [active]=\"$any(item).__state?.active\"\n [expanded]=\"$any(item).__state?.expanded\"\n [hierLevel]=\"hierLevel\"\n [childAction]=\"childAction\"\n [expandAction]=\"expandAction\"\n (navItemExpanded)=\"_navItemExpanded(item, $event)\"\n [
|
|
4119
|
+
template: "<div class=\"nav-inner-wrapper\" class=\"nav-inner-wrapper-{{hierLevel}}\">\n <div class=\"nav-items-row\">\n <seam-nav-item *ngFor=\"let item of items$ | async\"\n class=\"flex-shrink-0\"\n [item]=\"item\"\n [itemType]=\"$any(item)?.itemType\"\n [icon]=\"$any(item)?.icon\"\n [label]=\"$any(item)?.label\"\n [link]=\"$any(item)?.link\"\n [badgeText]=\"$any(item)?.badge?.text\"\n [badgeTheme]=\"$any(item)?.badge?.theme || 'danger'\"\n [badgeSrContent]=\"$any(item)?.badge?.srContent\"\n [badgeTooltip]=\"$any(item)?.badge?.tooltip\"\n [queryParams]=\"$any(item)?.queryParams\"\n [children]=\"$any(item)?.children\"\n [active]=\"$any(item).__state?.active\"\n [expanded]=\"$any(item).__state?.expanded\"\n [focused]=\"$any(item).__state?.focused\"\n [hierLevel]=\"hierLevel\"\n [childAction]=\"childAction\"\n [expandAction]=\"expandAction\"\n (navItemExpanded)=\"_navItemExpanded(item, $event)\"\n [hideEmptyIcon]=\"hideEmptyIcon\">\n </seam-nav-item>\n </div>\n</div>\n",
|
|
4086
4120
|
providers: [
|
|
4087
4121
|
TheSeamNavService
|
|
4088
4122
|
],
|
|
@@ -4091,14 +4125,15 @@
|
|
|
4091
4125
|
styles: ["seam-horizontal-nav,.seam-horizontal-nav{display:block;height:100%;position:relative;z-index:2}seam-horizontal-nav .nav-inner-wrapper,.seam-horizontal-nav .nav-inner-wrapper{background:none;height:100%}seam-horizontal-nav .nav-backdrop,.seam-horizontal-nav .nav-backdrop{background:rgba(52,58,64,.6);width:100vw;height:100vh}seam-horizontal-nav .nav-backdrop.nav-backdrop-hidden,.seam-horizontal-nav .nav-backdrop.nav-backdrop-hidden{display:none;width:0;height:0;padding:0;margin:0}seam-horizontal-nav .nav-content,.seam-horizontal-nav .nav-content{display:flex;flex-direction:column;height:100%;flex-wrap:nowrap}seam-horizontal-nav .nav-items-container,.seam-horizontal-nav .nav-items-container{display:flex;flex-direction:column;width:100%;flex:1 1 100%}seam-horizontal-nav .nav-items-row,.seam-horizontal-nav .nav-items-row{height:100%;display:flex;padding:.25rem .5rem}\n"]
|
|
4092
4126
|
},] }
|
|
4093
4127
|
];
|
|
4094
|
-
HorizontalNavComponent.ctorParameters = function () { return [
|
|
4128
|
+
HorizontalNavComponent.ctorParameters = function () { return [
|
|
4129
|
+
{ type: TheSeamNavService }
|
|
4130
|
+
]; };
|
|
4095
4131
|
HorizontalNavComponent.propDecorators = {
|
|
4096
4132
|
items: [{ type: i0.Input }],
|
|
4097
4133
|
hideEmptyIcon: [{ type: i0.Input }],
|
|
4098
4134
|
hierLevel: [{ type: i0.Input }],
|
|
4099
4135
|
childAction: [{ type: i0.Input }],
|
|
4100
4136
|
expandAction: [{ type: i0.Input }],
|
|
4101
|
-
focusedNavItem: [{ type: i0.Input }],
|
|
4102
4137
|
navItemExpanded: [{ type: i0.Output }]
|
|
4103
4138
|
};
|
|
4104
4139
|
|
|
@@ -4198,6 +4233,7 @@
|
|
|
4198
4233
|
exports.isExpanded = isExpanded;
|
|
4199
4234
|
exports.isHorizontalNavItemActive = isHorizontalNavItemActive;
|
|
4200
4235
|
exports.isHorizontalNavItemExpanded = isHorizontalNavItemExpanded;
|
|
4236
|
+
exports.isHorizontalNavItemFocused = isHorizontalNavItemFocused;
|
|
4201
4237
|
exports.isHorizontalNavItemType = isHorizontalNavItemType;
|
|
4202
4238
|
exports.isNavItemActive = isNavItemActive;
|
|
4203
4239
|
exports.isNavItemType = isNavItemType;
|