@coreui/angular 4.3.0 → 4.3.4

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.
@@ -13,6 +13,7 @@ import { createPopper } from '@popperjs/core';
13
13
  import * as i1$2 from '@angular/cdk/layout';
14
14
  import * as i3$1 from '@angular/cdk/a11y';
15
15
  import { A11yModule } from '@angular/cdk/a11y';
16
+ import { __classPrivateFieldSet, __classPrivateFieldGet } from 'tslib';
16
17
  import * as i5 from '@coreui/icons-angular';
17
18
  import { IconModule } from '@coreui/icons-angular';
18
19
 
@@ -6848,6 +6849,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
6848
6849
  args: [DOCUMENT]
6849
6850
  }] }, { type: SidebarService }]; } });
6850
6851
 
6852
+ var _SidebarComponent_narrow, _SidebarComponent_overlaid, _SidebarComponent_unfoldable, _SidebarComponent_visible, _SidebarComponent_onMobile, _SidebarComponent_layoutChangeSubscription, _SidebarComponent_stateToggleSubscription, _SidebarComponent_stateInitial;
6851
6853
  class SidebarComponent {
6852
6854
  constructor(document, renderer, breakpointObserver, sidebarService, backdropService) {
6853
6855
  this.document = document;
@@ -6855,14 +6857,21 @@ class SidebarComponent {
6855
6857
  this.breakpointObserver = breakpointObserver;
6856
6858
  this.sidebarService = sidebarService;
6857
6859
  this.backdropService = backdropService;
6858
- this._narrow = false;
6859
- this._overlaid = false;
6860
- this._unfoldable = false;
6861
- this._visible = false;
6862
- this.onMobile = false;
6860
+ _SidebarComponent_narrow.set(this, false);
6861
+ _SidebarComponent_overlaid.set(this, false);
6862
+ _SidebarComponent_unfoldable.set(this, false);
6863
+ _SidebarComponent_visible.set(this, false);
6864
+ _SidebarComponent_onMobile.set(this, false);
6865
+ _SidebarComponent_layoutChangeSubscription.set(this, void 0);
6866
+ _SidebarComponent_stateToggleSubscription.set(this, void 0);
6863
6867
  this.state = {
6864
- sidebar: this
6868
+ sidebar: this,
6865
6869
  };
6870
+ _SidebarComponent_stateInitial.set(this, {
6871
+ narrow: false,
6872
+ visible: false,
6873
+ unfoldable: false,
6874
+ });
6866
6875
  /**
6867
6876
  * Place sidebar in non-static positions. [docs]
6868
6877
  * @default 'fixed'
@@ -6880,78 +6889,87 @@ class SidebarComponent {
6880
6889
  * @type boolean
6881
6890
  */
6882
6891
  set narrow(value) {
6883
- this._narrow = coerceBooleanProperty(value);
6892
+ __classPrivateFieldSet(this, _SidebarComponent_narrow, coerceBooleanProperty(value), "f");
6884
6893
  }
6885
6894
  get narrow() {
6886
- return this._narrow;
6895
+ return __classPrivateFieldGet(this, _SidebarComponent_narrow, "f");
6887
6896
  }
6888
6897
  /**
6889
6898
  * Set sidebar to overlaid variant.
6890
6899
  * @type boolean
6891
6900
  */
6892
6901
  set overlaid(value) {
6893
- this._overlaid = coerceBooleanProperty(value);
6902
+ __classPrivateFieldSet(this, _SidebarComponent_overlaid, coerceBooleanProperty(value), "f");
6894
6903
  }
6895
6904
  get overlaid() {
6896
- return this._overlaid;
6905
+ return __classPrivateFieldGet(this, _SidebarComponent_overlaid, "f");
6897
6906
  }
6898
6907
  /**
6899
6908
  * Expand narrowed sidebar on hover. [docs]
6900
6909
  */
6901
6910
  set unfoldable(value) {
6902
- this._unfoldable = coerceBooleanProperty(value);
6911
+ __classPrivateFieldSet(this, _SidebarComponent_unfoldable, coerceBooleanProperty(value), "f");
6903
6912
  }
6904
6913
  get unfoldable() {
6905
- return this._unfoldable;
6914
+ return __classPrivateFieldGet(this, _SidebarComponent_unfoldable, "f");
6906
6915
  }
6907
6916
  /**
6908
6917
  * Toggle the visibility of sidebar component. [docs]
6909
6918
  */
6910
6919
  set visible(value) {
6911
- this._visible = coerceBooleanProperty(value);
6912
- this.visibleChange.emit(this._visible);
6920
+ const visible = coerceBooleanProperty(value);
6921
+ if (__classPrivateFieldGet(this, _SidebarComponent_visible, "f") !== visible) {
6922
+ __classPrivateFieldSet(this, _SidebarComponent_visible, visible, "f");
6923
+ this.visibleChange.emit(__classPrivateFieldGet(this, _SidebarComponent_visible, "f"));
6924
+ }
6913
6925
  }
6914
6926
  get visible() {
6915
- return this._visible;
6927
+ return __classPrivateFieldGet(this, _SidebarComponent_visible, "f");
6916
6928
  }
6917
6929
  set sidebarState(value) {
6918
6930
  const newState = value;
6919
6931
  if ('toggle' in newState) {
6920
6932
  if (newState.toggle === 'visible') {
6921
6933
  newState.visible = !this.state.visible;
6922
- this.visible = newState.visible && !this.overlaid;
6934
+ this.visible = newState.visible;
6923
6935
  }
6924
6936
  else if (newState.toggle === 'unfoldable') {
6925
6937
  newState.unfoldable = !this.state.unfoldable;
6926
6938
  this.unfoldable = newState.unfoldable;
6927
6939
  }
6928
6940
  }
6941
+ else {
6942
+ this.visible = (newState.visible ?? this.visible) && !this.overlaid;
6943
+ }
6929
6944
  this.state = {
6930
6945
  ...this.state,
6931
- ...newState
6946
+ ...newState,
6932
6947
  };
6933
- this.state.mobile && this.state.visible ? this.backdropService.setBackdrop(this) : this.backdropService.clearBackdrop();
6948
+ this.state.mobile && this.state.visible
6949
+ ? this.backdropService.setBackdrop(this)
6950
+ : this.backdropService.clearBackdrop();
6934
6951
  }
6935
6952
  get sidebarState() {
6936
6953
  return this.state;
6937
6954
  }
6938
6955
  get getMobileBreakpoint() {
6939
- const element = this.document.firstElementChild;
6940
- const mobileBreakpoint = getComputedStyle(element).getPropertyValue('--cui-mobile-breakpoint') || 'md';
6956
+ const element = this.document.documentElement;
6957
+ const mobileBreakpoint = getComputedStyle(element).getPropertyValue('--cui-mobile-breakpoint') ||
6958
+ 'md';
6941
6959
  const breakpointValue = getComputedStyle(element).getPropertyValue(`--cui-breakpoint-${mobileBreakpoint.trim()}`) || '768px';
6942
- return `${parseFloat(breakpointValue.trim()) - .02}px` || '767.98px';
6960
+ return `${parseFloat(breakpointValue.trim()) - 0.02}px` || '767.98px';
6943
6961
  }
6944
6962
  get getClasses() {
6945
- const { mobile, unfoldable, visible } = this.sidebarState;
6963
+ const { mobile, visible } = this.sidebarState;
6946
6964
  return {
6947
6965
  sidebar: true,
6948
6966
  'sidebar-fixed': this.position === 'fixed' && !mobile,
6949
6967
  'sidebar-narrow': this.narrow && !this.unfoldable,
6950
- 'sidebar-narrow-unfoldable': unfoldable,
6968
+ 'sidebar-narrow-unfoldable': this.unfoldable,
6951
6969
  'sidebar-overlaid': this.overlaid,
6952
6970
  [`sidebar-${this.size}`]: !!this.size,
6953
- show: visible && this.onMobile,
6954
- hide: !visible && !this.onMobile
6971
+ show: visible && __classPrivateFieldGet(this, _SidebarComponent_onMobile, "f"),
6972
+ hide: !visible,
6955
6973
  };
6956
6974
  }
6957
6975
  ngOnInit() {
@@ -6984,49 +7002,54 @@ class SidebarComponent {
6984
7002
  }
6985
7003
  }
6986
7004
  setInitialState() {
6987
- this.sidebarService.toggle({
7005
+ __classPrivateFieldSet(this, _SidebarComponent_stateInitial, {
6988
7006
  narrow: this.narrow,
6989
7007
  visible: this.visible,
6990
7008
  unfoldable: this.unfoldable,
6991
- sidebar: this
7009
+ }, "f");
7010
+ this.sidebarService.toggle({
7011
+ ...__classPrivateFieldGet(this, _SidebarComponent_stateInitial, "f"),
7012
+ sidebar: this,
6992
7013
  });
6993
7014
  }
6994
7015
  stateToggleSubscribe(subscribe = true) {
6995
7016
  if (subscribe) {
6996
- this.stateToggleSubscription = this.sidebarService.sidebarState$.subscribe((state) => {
7017
+ __classPrivateFieldSet(this, _SidebarComponent_stateToggleSubscription, this.sidebarService.sidebarState$.subscribe((state) => {
6997
7018
  if (this === state.sidebar || this.id === state.id) {
6998
7019
  this.sidebarState = state;
6999
7020
  }
7000
- });
7021
+ }), "f");
7001
7022
  }
7002
7023
  else {
7003
- this.stateToggleSubscription.unsubscribe();
7024
+ __classPrivateFieldGet(this, _SidebarComponent_stateToggleSubscription, "f").unsubscribe();
7004
7025
  }
7005
7026
  }
7006
7027
  layoutChangeSubscribe(subscribe = true) {
7007
7028
  const onMobile = `(max-width: ${this.getMobileBreakpoint})`;
7008
7029
  if (subscribe) {
7009
7030
  const layoutChanges = this.breakpointObserver.observe([onMobile]);
7010
- this.layoutChangeSubscription = layoutChanges.subscribe((result) => {
7031
+ __classPrivateFieldSet(this, _SidebarComponent_layoutChangeSubscription, layoutChanges.subscribe((result) => {
7011
7032
  const isOnMobile = result.breakpoints[onMobile];
7012
- if (this.onMobile !== isOnMobile) {
7013
- this.onMobile = isOnMobile;
7033
+ const isUnfoldable = isOnMobile ? false : this.unfoldable;
7034
+ if (__classPrivateFieldGet(this, _SidebarComponent_onMobile, "f") !== isOnMobile) {
7035
+ __classPrivateFieldSet(this, _SidebarComponent_onMobile, isOnMobile, "f");
7014
7036
  this.sidebarService.toggle({
7015
7037
  mobile: isOnMobile,
7016
- unfoldable: isOnMobile ? false : this.unfoldable,
7017
- visible: isOnMobile ? false : this.visible,
7018
- sidebar: this
7038
+ unfoldable: isUnfoldable,
7039
+ visible: isOnMobile ? !isOnMobile : __classPrivateFieldGet(this, _SidebarComponent_stateInitial, "f").visible,
7040
+ sidebar: this,
7019
7041
  });
7020
7042
  }
7021
- });
7043
+ }), "f");
7022
7044
  }
7023
7045
  else {
7024
- this.layoutChangeSubscription.unsubscribe();
7046
+ __classPrivateFieldGet(this, _SidebarComponent_layoutChangeSubscription, "f").unsubscribe();
7025
7047
  }
7026
7048
  }
7027
7049
  }
7050
+ _SidebarComponent_narrow = new WeakMap(), _SidebarComponent_overlaid = new WeakMap(), _SidebarComponent_unfoldable = new WeakMap(), _SidebarComponent_visible = new WeakMap(), _SidebarComponent_onMobile = new WeakMap(), _SidebarComponent_layoutChangeSubscription = new WeakMap(), _SidebarComponent_stateToggleSubscription = new WeakMap(), _SidebarComponent_stateInitial = new WeakMap();
7028
7051
  SidebarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: SidebarComponent, deps: [{ token: DOCUMENT }, { token: i0.Renderer2 }, { token: i1$2.BreakpointObserver }, { token: SidebarService }, { token: SidebarBackdropService }], target: i0.ɵɵFactoryTarget.Component });
7029
- SidebarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: SidebarComponent, selector: "c-sidebar", inputs: { id: "id", narrow: "narrow", overlaid: "overlaid", position: "position", size: "size", unfoldable: "unfoldable", visible: "visible" }, outputs: { visibleChange: "visibleChange" }, host: { properties: { "class": "this.getClasses" } }, exportAs: ["cSidebar"], usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true });
7052
+ SidebarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: SidebarComponent, selector: "c-sidebar", inputs: { colorScheme: "colorScheme", id: "id", narrow: "narrow", overlaid: "overlaid", placement: "placement", position: "position", size: "size", unfoldable: "unfoldable", visible: "visible" }, outputs: { visibleChange: "visibleChange" }, host: { properties: { "class": "this.getClasses" } }, exportAs: ["cSidebar"], usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true });
7030
7053
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: SidebarComponent, decorators: [{
7031
7054
  type: Component,
7032
7055
  args: [{
@@ -7034,15 +7057,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
7034
7057
  exportAs: 'cSidebar',
7035
7058
  template: '<ng-content></ng-content>',
7036
7059
  }]
7037
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
7060
+ }], ctorParameters: function () { return [{ type: Document, decorators: [{
7038
7061
  type: Inject,
7039
7062
  args: [DOCUMENT]
7040
- }] }, { type: i0.Renderer2 }, { type: i1$2.BreakpointObserver }, { type: SidebarService }, { type: SidebarBackdropService }]; }, propDecorators: { id: [{
7063
+ }] }, { type: i0.Renderer2 }, { type: i1$2.BreakpointObserver }, { type: SidebarService }, { type: SidebarBackdropService }]; }, propDecorators: { colorScheme: [{
7064
+ type: Input
7065
+ }], id: [{
7041
7066
  type: Input
7042
7067
  }], narrow: [{
7043
7068
  type: Input
7044
7069
  }], overlaid: [{
7045
7070
  type: Input
7071
+ }], placement: [{
7072
+ type: Input
7046
7073
  }], position: [{
7047
7074
  type: Input
7048
7075
  }], size: [{