UNPKG

3.23 kBJavaScriptView Raw
1import { ContentChildren, Directive, ElementRef, Renderer } from '@angular/core';
2import { Config } from '../../config/config';
3import { isTrueProperty } from '../../util/util';
4import { Platform } from '../../platform/platform';
5import { FabButton } from './fab';
6/**
7 * @name FabList
8 * @description
9 * `ion-fab-list` is a container for multiple FAB buttons. They are components of `ion-fab` and allow you to specificy the buttons position, left, right, top, bottom.
10 * @usage
11 *
12 * ```html
13 * <ion-fab bottom right >
14 * <button ion-fab>Share</button>
15 * <ion-fab-list side="top">
16 * <button ion-fab>Facebook</button>
17 * <button ion-fab>Twitter</button>
18 * <button ion-fab>Youtube</button>
19 * </ion-fab-list>
20 * <ion-fab-list side="left">
21 * <button ion-fab>Vimeo</button>
22 * </ion-fab-list>
23 * </ion-fab>
24 * ```
25 * @module ionic
26 *
27 * @demo /docs/demos/src/fab/
28 * @see {@link /docs/components#fab Fab Component Docs}
29 */
30var FabList = (function () {
31 function FabList(_elementRef, _renderer, config, _plt) {
32 this._elementRef = _elementRef;
33 this._renderer = _renderer;
34 this._plt = _plt;
35 this._visible = false;
36 this._fabs = [];
37 this._mode = config.get('mode');
38 }
39 Object.defineProperty(FabList.prototype, "_setbuttons", {
40 set: function (query) {
41 var fabs = this._fabs = query.toArray();
42 var className = "fab-" + this._mode + "-in-list";
43 for (var _i = 0, fabs_1 = fabs; _i < fabs_1.length; _i++) {
44 var fab = fabs_1[_i];
45 fab.setElementClass('fab-in-list', true);
46 fab.setElementClass(className, true);
47 }
48 },
49 enumerable: true,
50 configurable: true
51 });
52 /**
53 * @hidden
54 */
55 FabList.prototype.setVisible = function (val) {
56 var _this = this;
57 var visible = isTrueProperty(val);
58 if (visible === this._visible) {
59 return;
60 }
61 this._visible = visible;
62 var fabs = this._fabs;
63 var i = 1;
64 if (visible) {
65 fabs.forEach(function (fab) {
66 _this._plt.timeout(function () { return fab.setElementClass('show', true); }, i * 30);
67 i++;
68 });
69 }
70 else {
71 fabs.forEach(function (fab) { return fab.setElementClass('show', false); });
72 }
73 this.setElementClass('fab-list-active', visible);
74 };
75 /**
76 * @internal
77 */
78 FabList.prototype.setElementClass = function (className, add) {
79 this._renderer.setElementClass(this._elementRef.nativeElement, className, add);
80 };
81 FabList.decorators = [
82 { type: Directive, args: [{
83 selector: 'ion-fab-list',
84 },] },
85 ];
86 /** @nocollapse */
87 FabList.ctorParameters = function () { return [
88 { type: ElementRef, },
89 { type: Renderer, },
90 { type: Config, },
91 { type: Platform, },
92 ]; };
93 FabList.propDecorators = {
94 '_setbuttons': [{ type: ContentChildren, args: [FabButton,] },],
95 };
96 return FabList;
97}());
98export { FabList };
99//# sourceMappingURL=fab-list.js.map
\No newline at end of file