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