c3d92efbdad9d67398c14e3e1587f6a93117689b
[vnfsdk/refrepo.git] /
1 /*!
2  * Angular Material Design
3  * https://github.com/angular/material
4  * @license MIT
5  * v1.1.3
6  */
7 (function( window, angular, undefined ){
8 "use strict";
9
10 /**
11  * @ngdoc module
12  * @name material.components.truncate
13  */
14 MdTruncateController['$inject'] = ["$element"];
15 angular.module('material.components.truncate', ['material.core'])
16   .directive('mdTruncate', MdTruncateDirective);
17
18 /**
19  * @ngdoc directive
20  * @name mdTruncate
21  * @module material.components.truncate
22  * @restrict AE
23  * @description
24  *
25  * The `md-truncate` component displays a label that will automatically clip text which is wider
26  * than the component. By default, it displays an ellipsis, but you may apply the `md-clip` CSS
27  * class to override this default and use a standard "clipping" approach.
28  *
29  * <i><b>Note:</b> The `md-truncate` component does not automatically adjust it's width. You must
30  * provide the `flex` attribute, or some other CSS-based width management. See the
31  * <a ng-href="./demo/truncate">demos</a> for examples.</i>
32  *
33  * @usage
34  *
35  * ### As an Element
36  *
37  * <hljs lang="html">
38  *   <div layout="row">
39  *     <md-button>Back</md-button>
40  *
41  *     <md-truncate flex>Chapter 1 - The Way of the Old West</md-truncate>
42  *
43  *     <md-button>Forward</md-button>
44  *   </div>
45  * </hljs>
46  *
47  * ### As an Attribute
48  *
49  * <hljs lang="html">
50  *   <h2 md-truncate style="max-width: 100px;">Some Title With a Lot of Text</h2>
51  * </hljs>
52  *
53  * ## CSS & Styles
54  *
55  * `<md-truncate>` provides two CSS classes that you may use to control the type of clipping.
56  *
57  * <i><b>Note:</b> The `md-truncate` also applies a setting of `width: 0;` when used with the `flex`
58  * attribute to fix an issue with the flex element not shrinking properly.</i>
59  *
60  * <div>
61  * <docs-css-api-table>
62  *
63  *   <docs-css-selector code=".md-ellipsis">
64  *     Assigns the "ellipsis" behavior (default) which will cut off mid-word and append an ellipsis
65  *     (&hellip;) to the end of the text.
66  *   </docs-css-selector>
67  *
68  *   <docs-css-selector code=".md-clip">
69  *     Assigns the "clipping" behavior which will simply chop off the text. This may happen
70  *     mid-word or even mid-character.
71  *   </docs-css-selector>
72  *
73  * </docs-css-api-table>
74  * </div>
75  */
76 function MdTruncateDirective() {
77   return {
78     restrict: 'AE',
79
80     controller: MdTruncateController,
81     controllerAs: '$ctrl',
82     bindToController: true
83   }
84 }
85
86 /**
87  * Controller for the <md-truncate> component.
88  *
89  * @param $element The md-truncate element.
90  *
91  * @constructor
92  * ngInject
93  */
94 function MdTruncateController($element) {
95   $element.addClass('md-truncate');
96 }
97
98 })(window, window.angular);