1 | /*!
|
---|
2 | * AngularJS Material Design
|
---|
3 | * https://github.com/angular/material
|
---|
4 | * @license MIT
|
---|
5 | * v1.2.3
|
---|
6 | */
|
---|
7 | (function( window, angular, undefined ){
|
---|
8 | "use strict";
|
---|
9 |
|
---|
10 | (function() {
|
---|
11 | 'use strict';
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * @ngdoc module
|
---|
15 | * @name material.components.fabActions
|
---|
16 | */
|
---|
17 | MdFabActionsDirective['$inject'] = ["$mdUtil"];
|
---|
18 | angular
|
---|
19 | .module('material.components.fabActions', ['material.core'])
|
---|
20 | .directive('mdFabActions', MdFabActionsDirective);
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * @ngdoc directive
|
---|
24 | * @name mdFabActions
|
---|
25 | * @module material.components.fabActions
|
---|
26 | *
|
---|
27 | * @restrict E
|
---|
28 | *
|
---|
29 | * @description
|
---|
30 | * The `<md-fab-actions>` directive is used inside of a `<md-fab-speed-dial>` or
|
---|
31 | * `<md-fab-toolbar>` directive to mark an element (or elements) as the actions and setup the
|
---|
32 | * proper event listeners.
|
---|
33 | *
|
---|
34 | * @usage
|
---|
35 | * See the `<md-fab-speed-dial>` or `<md-fab-toolbar>` directives for example usage.
|
---|
36 | */
|
---|
37 | function MdFabActionsDirective($mdUtil) {
|
---|
38 | return {
|
---|
39 | restrict: 'E',
|
---|
40 |
|
---|
41 | require: ['^?mdFabSpeedDial', '^?mdFabToolbar'],
|
---|
42 |
|
---|
43 | compile: function(element, attributes) {
|
---|
44 | var children = element.children();
|
---|
45 | var actionItemButtons;
|
---|
46 | var hasNgRepeat = $mdUtil.prefixer().hasAttribute(children, 'ng-repeat');
|
---|
47 |
|
---|
48 | // Action item buttons should not be in the tab order when the speed dial is closed.
|
---|
49 | actionItemButtons = element.find('md-button');
|
---|
50 | angular.forEach(actionItemButtons, function(button) {
|
---|
51 | button.setAttribute('tabindex', -1);
|
---|
52 | });
|
---|
53 |
|
---|
54 | // Support both ng-repeat and static content
|
---|
55 | if (hasNgRepeat) {
|
---|
56 | children.addClass('md-fab-action-item');
|
---|
57 | } else {
|
---|
58 | // Wrap every child in a new div and add a class that we can scale/fling independently
|
---|
59 | children.wrap('<div class="md-fab-action-item">');
|
---|
60 | }
|
---|
61 | }
|
---|
62 | };
|
---|
63 | }
|
---|
64 | })();
|
---|
65 |
|
---|
66 | })(window, window.angular); |
---|