|
1 | 1 | import { ContentChildren, Directive, ElementRef, EventEmitter, forwardRef, Input, Output, QueryList, NgZone, Renderer } from '@angular/core';
|
2 | 2 | import { Ion } from '../ion';
|
3 |
| -import { assert } from '../../util/util'; |
| 3 | +import { isTrueProperty, assert } from '../../util/util'; |
4 | 4 | import { Config } from '../../config/config';
|
5 | 5 | import { Platform } from '../../platform/platform';
|
6 | 6 |
|
@@ -142,9 +142,10 @@ export abstract class RootNode {
|
142 | 142 | })
|
143 | 143 | export class SplitPane extends Ion implements RootNode {
|
144 | 144 |
|
145 |
| - _rmListener: any; |
146 |
| - _visible: boolean = false; |
147 | 145 | _init: boolean = false;
|
| 146 | + _visible: boolean = false; |
| 147 | + _isEnabled: boolean = true; |
| 148 | + _rmListener: any; |
148 | 149 | _mediaQuery: string | boolean = QUERY['md'];
|
149 | 150 | _children: RootNode[];
|
150 | 151 |
|
@@ -190,6 +191,19 @@ export class SplitPane extends Ion implements RootNode {
|
190 | 191 | return this._mediaQuery;
|
191 | 192 | }
|
192 | 193 |
|
| 194 | + /** |
| 195 | + * @input {boolean} If `false`, the split-pane is disabled, ie. the side pane will |
| 196 | + * never be displayed. Default `true`. |
| 197 | + */ |
| 198 | + @Input() |
| 199 | + set enabled(val: boolean) { |
| 200 | + this._isEnabled = isTrueProperty(val); |
| 201 | + this._update(); |
| 202 | + } |
| 203 | + get enabled(): boolean { |
| 204 | + return this._isEnabled; |
| 205 | + } |
| 206 | + |
193 | 207 | /**
|
194 | 208 | * @output {any} Expression to be called when the split-pane visibility has changed
|
195 | 209 | */
|
@@ -247,6 +261,12 @@ export class SplitPane extends Ion implements RootNode {
|
247 | 261 | this._rmListener && this._rmListener();
|
248 | 262 | this._rmListener = null;
|
249 | 263 |
|
| 264 | + // Check if the split-pane is disabled |
| 265 | + if (!this._isEnabled) { |
| 266 | + this._setVisible(false); |
| 267 | + return; |
| 268 | + } |
| 269 | + |
250 | 270 | const query = this._mediaQuery;
|
251 | 271 | if (typeof query === 'boolean') {
|
252 | 272 | this._setVisible(query);
|
|
0 commit comments