Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Enable sidebar register function to get the sidebars in sidebar container across all the app #77

Merged
merged 5 commits into from
May 20, 2017

Conversation

Sifawm
Copy link

@Sifawm Sifawm commented May 9, 2017

New function inside SidebarService to registry sidebar with observables.

@Sifawm Sifawm mentioned this pull request May 9, 2017
@@ -76,8 +75,7 @@ import { isBrowser, upperCaseFirst, isLTR, isIOS } from './utils';
transition: transform 0.3s cubic-bezier(0, 0, 0.3, 1);
}
`],
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this removed?

Copy link
Author

@Sifawm Sifawm May 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only removed ViewEncapsulation.None. In my opinion, I prefer to use the default value if it is possible (emulated) as a solution to the future of browsers with shadow dom. Do you think that is better ViewEncapulation.None or Emulated?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it's fine to keep it as the default. Not entirely sure if that'll affect users though.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The users needs to use the deep (>>>) on css to modify the style of the sidebar if the css file is loaded by angular. On other cases, the deep selector is not necessary.

@@ -15,11 +19,19 @@ export class SidebarService {
this._closeObserver.next();
}

registry(sidebar: Sidebar) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe call this register?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that you have reason. Register is better word for the function.

@@ -260,7 +248,7 @@ export class SidebarContainer implements AfterContentInit, OnChanges, OnDestroy
if (this._sidebars && this.allowSidebarBackdropControl) {
let hasOpen = false;

const _sidebars = this._sidebars.toArray();
const _sidebars: Sidebar[] = [...this._sidebars];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary?

Copy link
Author

@Sifawm Sifawm May 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly not. We can use directly
const _sidebars = this._sidebars;

or use the property of the class directly as for argument.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think we can just directly use it if it's already an array.

@@ -87,22 +82,21 @@ export class SidebarContainer implements AfterContentInit, OnChanges, OnDestroy
@Output() showBackdropChange = new EventEmitter<boolean>();

/** @internal */
@ContentChildren(Sidebar)
_sidebars: QueryList<Sidebar>;
_sidebars: Sidebar[] = new Array<Sidebar>();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer just [] over the new Array() style.

@Sifawm Sifawm changed the title Enable sidebar registry function to get the sidebars in sidebar container across all the app Enable sidebar register function to get the sidebars in sidebar container across all the app May 10, 2017
@Sifawm
Copy link
Author

Sifawm commented May 16, 2017

@arkon do you see any changes more? My team is using this changes on a real project without any problem.

@arkon
Copy link
Owner

arkon commented May 16, 2017

@Sifawm Yup, I'm on vacation right now though so I don't have access to a laptop to really do much, so I'll merge/publish when I get back home at the end of the week.

@Sifawm
Copy link
Author

Sifawm commented May 16, 2017

@arkon my apologises. Enjoy your vacations.

@arkon arkon merged commit e99552e into arkon:master May 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants