UNPKG

carbon-components-angular

Version:
1,242 lines (1,092 loc) 63.8 kB
<!doctype html> <html class="no-js" lang=""> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>carbon-components-angular documentation</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" type="image/x-icon" href="../images/favicon.ico"> <link rel="stylesheet" href="../styles/style.css"> <link rel="stylesheet" href="../styles/dark.css"> <style> footer.carbon { position: absolute; bottom: 0; width: 100%; z-index: 9999; } #root > div { /* * Subtracting the height of the footer to prevent * overlaying the footer ontop of content */ height: calc(100vh - 48px); } </style> </head> <body> <script> // Blocking script to avoid flickering dark mode // Dark mode toggle button var useDark = window.matchMedia('(prefers-color-scheme: dark)'); var darkModeState = useDark.matches; var $darkModeToggleSwitchers = document.querySelectorAll('.dark-mode-switch input'); var $darkModeToggles = document.querySelectorAll('.dark-mode-switch'); var darkModeStateLocal = localStorage.getItem('compodoc_darkmode-state'); function checkToggle(check) { for (var i = 0; i < $darkModeToggleSwitchers.length; i++) { $darkModeToggleSwitchers[i].checked = check; } } function toggleDarkMode(state) { if (window.localStorage) { localStorage.setItem('compodoc_darkmode-state', state); } checkToggle(state); const hasClass = document.body.classList.contains('dark'); if (state) { for (var i = 0; i < $darkModeToggles.length; i++) { $darkModeToggles[i].classList.add('dark'); } if (!hasClass) { document.body.classList.add('dark'); } } else { for (var i = 0; i < $darkModeToggles.length; i++) { $darkModeToggles[i].classList.remove('dark'); } if (hasClass) { document.body.classList.remove('dark'); } } } useDark.addEventListener('change', function (evt) { toggleDarkMode(evt.matches); }); if (darkModeStateLocal) { darkModeState = darkModeStateLocal === 'true'; } toggleDarkMode(darkModeState); </script> <div class="navbar navbar-default navbar-fixed-top d-md-none p-0"> <div class="d-flex"> <a href="../" class="navbar-brand">carbon-components-angular documentation</a> <button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button> </div> </div> <div class="xs-menu menu" id="mobile-menu"> <div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu> </div> <div class="container-fluid main"> <div class="row main"> <div class="d-none d-md-block menu"> <compodoc-menu mode="normal"></compodoc-menu> </div> <!-- START CONTENT --> <div class="content component"> <div class="content-data"> <ol class="breadcrumb"> <li class="breadcrumb-item">Components</li> <li class="breadcrumb-item" > SelectionTile</li> </ol> <ul class="nav nav-tabs" role="tablist"> <li class="nav-item"> <a href="#info" class="nav-link active" role="tab" id="info-tab" data-bs-toggle="tab" data-link="info">Info</a> </li> <li class="nav-item"> <a href="#source" class="nav-link" role="tab" id="source-tab" data-bs-toggle="tab" data-link="source">Source</a> </li> <li class="nav-item"> <a href="#tree" class="nav-link" role="tab" id="tree-tab" data-bs-toggle="tab" data-link="dom-tree">DOM Tree</a> </li> </ul> <div class="tab-content"> <div class="tab-pane fade active in" id="info"><p class="comment"> <h3>File</h3> </p> <p class="comment"> <code>src/tiles/selection-tile.component.ts</code> </p> <p class="comment"> <h3>Implements</h3> </p> <p class="comment"> <code>AfterViewInit</code> </p> <section data-compodoc="block-metadata"> <h3>Metadata</h3> <table class="table table-sm table-hover metadata"> <tbody> <tr> <td class="col-md-3">selector</td> <td class="col-md-9"><code>cds-selection-tile, ibm-selection-tile</code></td> </tr> <tr> <td class="col-md-3">template</td> <td class="col-md-9"><pre class="line-numbers"><code class="language-html">&lt;input #input [attr.tabindex]&#x3D;&quot;disabled ? null : 0&quot; class&#x3D;&quot;cds--tile-input&quot; [id]&#x3D;&quot;id&quot; [disabled]&#x3D;&quot;disabled&quot; [type]&#x3D;&quot;(multiple ? &#x27;checkbox&#x27;: &#x27;radio&#x27;)&quot; [value]&#x3D;&quot;value&quot; [name]&#x3D;&quot;name&quot; (change)&#x3D;&quot;onChange($event)&quot;/&gt; &lt;label class&#x3D;&quot;cds--tile cds--tile--selectable&quot; [for]&#x3D;&quot;id&quot; [ngClass]&#x3D;&quot;{ &#x27;cds--tile--is-selected&#x27; : selected, &#x27;cds--tile--light&#x27;: theme &#x3D;&#x3D;&#x3D; &#x27;light&#x27;, &#x27;cds--tile--disabled&#x27; : disabled }&quot; [attr.aria-label]&#x3D;&quot;i18n.get(&#x27;TILES.TILE&#x27;) | async&quot;&gt; &lt;div class&#x3D;&quot;cds--tile__checkmark&quot; [class.cds--tile__checkmark--persistent]&#x3D;&quot;multiple&quot;&gt; &lt;svg *ngIf&#x3D;&quot;!selected; else selectedIcon&quot; [cdsIcon]&#x3D;&quot;multiple ? &#x27;checkbox&#x27; : &#x27;checkmark&#x27;&quot; size&#x3D;&quot;16&quot;&gt; &lt;/svg&gt; &lt;ng-template #selectedIcon&gt; &lt;svg [cdsIcon]&#x3D;&quot;multiple ? &#x27;checkbox--checked--filled&#x27; : &#x27;checkmark--filled&#x27;&quot; size&#x3D;&quot;16&quot;&gt;&lt;/svg&gt; &lt;/ng-template&gt; &lt;/div&gt; &lt;div class&#x3D;&quot;cds--tile-content&quot;&gt; &lt;ng-content&gt;&lt;/ng-content&gt; &lt;/div&gt; &lt;/label&gt; </code></pre></td> </tr> </tbody> </table> </section> <section data-compodoc="block-index"> <h3 id="index">Index</h3> <table class="table table-sm table-bordered index-table"> <tbody> <tr> <td class="col-md-4"> <h6><b>Properties</b></h6> </td> </tr> <tr> <td class="col-md-4"> <ul class="index-list"> <li> <span class="modifier">Protected</span> <a href="#_selected" >_selected</a> </li> <li> <span class="modifier">Public</span> <a href="#i18n" >i18n</a> </li> <li> <span class="modifier"></span> <a href="#input" >input</a> </li> <li> <a href="#multiple" >multiple</a> </li> <li> <a href="#name" >name</a> </li> <li> <span class="modifier">Static</span> <a href="#tileCount" >tileCount</a> </li> </ul> </td> </tr> <tr> <td class="col-md-4"> <h6><b>Methods</b></h6> </td> </tr> <tr> <td class="col-md-4"> <ul class="index-list"> <li> <span class="modifier"></span> <a href="#keyboardInput" >keyboardInput</a> </li> <li> <a href="#ngAfterViewInit" >ngAfterViewInit</a> </li> <li> <a href="#onChange" >onChange</a> </li> </ul> </td> </tr> <tr> <td class="col-md-4"> <h6><b>Inputs</b></h6> </td> </tr> <tr> <td class="col-md-4"> <ul class="index-list"> <li> <a href="#disabled" >disabled</a> </li> <li> <a href="#id" >id</a> </li> <li> <a href="#selected" >selected</a> </li> <li> <a href="#theme" class="deprecated-name">theme</a> </li> <li> <a href="#value" >value</a> </li> </ul> </td> </tr> <tr> <td class="col-md-4"> <h6><b>Outputs</b></h6> </td> </tr> <tr> <td class="col-md-4"> <ul class="index-list"> <li> <a href="#change" >change</a> </li> </ul> </td> </tr> <tr> <td class="col-md-4"> <h6><b>HostListeners</b></h6> </td> </tr> <tr> <td class="col-md-4"> <ul class="index-list"> <li> <a href="#keydown" >keydown</a> </li> </ul> </td> </tr> <tr> <td class="col-md-4"> <h6><b>Accessors</b></h6> </td> </tr> <tr> <td class="col-md-4"> <ul class="index-list"> <li> <a href="#selected" >selected</a> </li> </ul> </td> </tr> </tbody> </table> </section> <section data-compodoc="block-constructor"> <h3 id="constructor">Constructor</h3> <table class="table table-sm table-bordered"> <tbody> <tr> <td class="col-md-4"> <code>constructor(i18n: <a href="../injectables/I18n.html" target="_self">I18n</a>)</code> </td> </tr> <tr> <td class="col-md-4"> <div class="io-line">Defined in <a href="" data-line="109" class="link-to-prism">src/tiles/selection-tile.component.ts:109</a></div> </td> </tr> <tr> <td class="col-md-4"> <div> <b>Parameters :</b> <table class="params"> <thead> <tr> <td>Name</td> <td>Type</td> <td>Optional</td> </tr> </thead> <tbody> <tr> <td>i18n</td> <td> <code><a href="../injectables/I18n.html" target="_self" >I18n</a></code> </td> <td> No </td> </tr> </tbody> </table> </div> </td> </tr> </tbody> </table> </section> <section data-compodoc="block-inputs"> <h3 id="inputs">Inputs</h3> <table class="table table-sm table-bordered"> <tbody> <tr> <td class="col-md-4"> <a name="disabled"></a> <b>disabled</b> </td> </tr> <tr> <td class="col-md-4"> <i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank" >boolean</a></code> </td> </tr> <tr> <td class="col-md-4"> <i>Default value : </i><code>false</code> </td> </tr> <tr> <td class="col-md-2" colspan="2"> <div class="io-line">Defined in <a href="" data-line="92" class="link-to-prism">src/tiles/selection-tile.component.ts:92</a></div> </td> </tr> <tr> <td class="col-md-4"> <div class="io-description"><p>Set to <code>true</code> to disable the selection tile.</p> </div> </td> </tr> </tbody> </table> <table class="table table-sm table-bordered"> <tbody> <tr> <td class="col-md-4"> <a name="id"></a> <b>id</b> </td> </tr> <tr> <td class="col-md-4"> <i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code> </td> </tr> <tr> <td class="col-md-4"> <i>Default value : </i><code>&#x60;tile-${SelectionTile.tileCount}&#x60;</code> </td> </tr> <tr> <td class="col-md-2" colspan="2"> <div class="io-line">Defined in <a href="" data-line="62" class="link-to-prism">src/tiles/selection-tile.component.ts:62</a></div> </td> </tr> <tr> <td class="col-md-4"> <div class="io-description"><p>The unique id for the input.</p> </div> </td> </tr> </tbody> </table> <table class="table table-sm table-bordered"> <tbody> <tr> <td class="col-md-4"> <a name="selected"></a> <b>selected</b> </td> </tr> <tr> <td class="col-md-4"> <i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank" >boolean</a></code> </td> </tr> <tr> <td class="col-md-2" colspan="2"> <div class="io-line">Defined in <a href="" data-line="68" class="link-to-prism">src/tiles/selection-tile.component.ts:68</a></div> </td> </tr> <tr> <td class="col-md-4"> <div class="io-description"><p>Updating the state of the input to match the state of the parameter passed in. Set to <code>true</code> if this tile should be selected.</p> </div> </td> </tr> </tbody> </table> <table class="table table-sm table-bordered"> <tbody> <tr> <td class="col-md-4"> <a name="theme"></a> <b>theme</b> </td> </tr> <tr> <td class="col-md-4"> <i>Type : </i> <code>&quot;light&quot; | &quot;dark&quot;</code> </td> </tr> <tr> <td class="col-md-4"> <i>Default value : </i><code>&quot;dark&quot;</code> </td> </tr> <tr> <td class="col-md-2" colspan="2"> <div class="io-line">Defined in <a href="" data-line="57" class="link-to-prism">src/tiles/selection-tile.component.ts:57</a></div> </td> </tr> </tbody> </table> <table class="table table-sm table-bordered"> <tbody> <tr> <td class="col-md-4"> <a name="value"></a> <b>value</b> </td> </tr> <tr> <td class="col-md-4"> <i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code> </td> </tr> <tr> <td class="col-md-2" colspan="2"> <div class="io-line">Defined in <a href="" data-line="83" class="link-to-prism">src/tiles/selection-tile.component.ts:83</a></div> </td> </tr> <tr> <td class="col-md-4"> <div class="io-description"><p>The value for the tile. Returned via <code>ngModel</code> or <code>selected</code> event on the containing <code>TileGroup</code>.</p> </div> </td> </tr> </tbody> </table> </section> <section data-compodoc="block-outputs"> <h3 id="outputs">Outputs</h3> <table class="table table-sm table-bordered"> <tbody> <tr> <td class="col-md-4"> <a name="change"></a> <b>change</b> </td> </tr> <tr> <td class="col-md-4"> <i>Type : </i> <code>EventEmitter&lt;Event&gt;</code> </td> </tr> <tr> <td class="col-md-2" colspan="2"> <div class="io-line">Defined in <a href="" data-line="87" class="link-to-prism">src/tiles/selection-tile.component.ts:87</a></div> </td> </tr> <tr> <td class="col-md-4"> <div class="io-description"><p>Internal event used to notify the containing <code>TileGroup</code> of changes.</p> </div> </td> </tr> </tbody> </table> </section> <section data-compodoc="block-methods"> <h3>HostListeners</h3> <table class="table table-sm table-bordered"> <tbody> <tr> <td class="col-md-4"> <a name="keydown"></a> <span class="name"> <span ><b>keydown</b></span> <a href="#keydown"><span class="icon ion-ios-link"></span></a> </span> </td> </tr> <tr> <td class="col-md-4"> <i>Arguments : </i><code>'$event' </code> </td> </tr> <tr> <td class="col-md-4"> <code>keydown(event)</code> </td> </tr> <tr> <td class="col-md-4"> <div class="io-line">Defined in <a href="" data-line="124" class="link-to-prism">src/tiles/selection-tile.component.ts:124</a></div> </td> </tr> </tbody> </table> </section> <section data-compodoc="block-methods"> <h3 id="methods"> Methods </h3> <table class="table table-sm table-bordered"> <tbody> <tr> <td class="col-md-4"> <a name="keyboardInput"></a> <span class="name"> <span class="modifier"></span> <span ><b>keyboardInput</b></span> <a href="#keyboardInput"><span class="icon ion-ios-link"></span></a> </span> </td> </tr> <tr> <td class="col-md-4"> <span class="modifier-icon icon ion-ios-reset"></span> <code>keyboardInput(event)</code> </td> </tr> <tr> <td class="col-md-4"> <b>Decorators : </b> <br /> <code>@HostListener(&#x27;keydown&#x27;, [&#x27;$event&#x27;])<br /></code> </td> </tr> <tr> <td class="col-md-4"> <div class="io-line">Defined in <a href="" data-line="124" class="link-to-prism">src/tiles/selection-tile.component.ts:124</a></div> </td> </tr> <tr> <td class="col-md-4"> <div class="io-description"> <b>Parameters :</b> <table class="params"> <thead> <tr> <td>Name</td> <td>Optional</td> </tr> </thead> <tbody> <tr> <td>event</td> <td> No </td> </tr> </tbody> </table> </div> <div class="io-description"> <b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code> </div> <div class="io-description"> </div> </td> </tr> </tbody> </table> <table class="table table-sm table-bordered"> <tbody> <tr> <td class="col-md-4"> <a name="ngAfterViewInit"></a> <span class="name"> <span ><b>ngAfterViewInit</b></span> <a href="#ngAfterViewInit"><span class="icon ion-ios-link"></span></a> </span> </td> </tr> <tr> <td class="col-md-4"> <code>ngAfterViewInit()</code> </td> </tr> <tr> <td class="col-md-4"> <div class="io-line">Defined in <a href="" data-line="115" class="link-to-prism">src/tiles/selection-tile.component.ts:115</a></div> </td> </tr> <tr> <td class="col-md-4"> <div class="io-description"> <b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code> </div> </td> </tr> </tbody> </table> <table class="table table-sm table-bordered"> <tbody> <tr> <td class="col-md-4"> <a name="onChange"></a> <span class="name"> <span ><b>onChange</b></span> <a href="#onChange"><span class="icon ion-ios-link"></span></a> </span> </td> </tr> <tr> <td class="col-md-4"> <code>onChange(event)</code> </td> </tr> <tr> <td class="col-md-4"> <div class="io-line">Defined in <a href="" data-line="131" class="link-to-prism">src/tiles/selection-tile.component.ts:131</a></div> </td> </tr> <tr> <td class="col-md-4"> <div class="io-description"> <b>Parameters :</b> <table class="params"> <thead> <tr> <td>Name</td> <td>Optional</td> </tr> </thead> <tbody> <tr> <td>event</td> <td> No </td> </tr> </tbody> </table> </div> <div class="io-description"> <b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code> </div> <div class="io-description"> </div> </td> </tr> </tbody> </table> </section> <section data-compodoc="block-properties"> <h3 id="inputs"> Properties </h3> <table class="table table-sm table-bordered"> <tbody> <tr> <td class="col-md-4"> <a name="_selected"></a> <span class="name"> <span class="modifier">Protected</span> <span ><b>_selected</b></span> <a href="#_selected"><span class="icon ion-ios-link"></span></a> </span> </td> </tr> <tr> <td class="col-md-4"> <i>Type : </i> <code>null</code> </td> </tr> <tr> <td class="col-md-4"> <i>Default value : </i><code>null</code> </td> </tr> <tr> <td class="col-md-4"> <div class="io-line">Defined in <a href="" data-line="109" class="link-to-prism">src/tiles/selection-tile.component.ts:109</a></div> </td> </tr> </tbody> </table> <table class="table table-sm table-bordered"> <tbody> <tr> <td class="col-md-4"> <a name="i18n"></a> <span class="name"> <span class="modifier">Public</span> <span ><b>i18n</b></span> <a href="#i18n"><span class="icon ion-ios-link"></span></a> </span> </td> </tr> <tr> <td class="col-md-4"> <i>Type : </i> <code><a href="../injectables/I18n.html" target="_self" >I18n</a></code> </td> </tr> <tr> <td class="col-md-4"> <div class="io-line">Defined in <a href="" data-line="111" class="link-to-prism">src/tiles/selection-tile.component.ts:111</a></div> </td> </tr> </tbody> </table> <table class="table table-sm table-bordered"> <tbody> <tr> <td class="col-md-4"> <a name="input"></a> <span class="name"> <span class="modifier"></span> <span ><b>input</b></span> <a href="#input"><span class="icon ion-ios-link"></span></a> </span> </td> </tr> <tr> <td class="col-md-4"> <b>Decorators : </b> <br /> <code> @ViewChild(&#x27;input&#x27;, {static: true})<br /> </code> </td> </tr> <tr> <td class="col-md-4"> <div class="io-line">Defined in <a href="" data-line="105" class="link-to-prism">src/tiles/selection-tile.component.ts:105</a></div> </td> </tr> </tbody> </table> <table class="table table-sm table-bordered"> <tbody> <tr> <td class="col-md-4"> <a name="multiple"></a> <span class="name"> <span ><b>multiple</b></span> <a href="#multiple"><span class="icon ion-ios-link"></span></a> </span> </td> </tr> <tr> <td class="col-md-4"> <i>Default value : </i><code>true</code> </td> </tr> <tr> <td class="col-md-4"> <div class="io-line">Defined in <a href="" data-line="102" class="link-to-prism">src/tiles/selection-tile.component.ts:102</a></div> </td> </tr> <tr> <td class="col-md-4"> <div class="io-description"><p>Defines whether or not the <code>SelectionTile</code> supports selecting multiple tiles as opposed to single tile selection.</p> </div> </td> </tr> </tbody> </table> <table class="table table-sm table-bordered"> <tbody> <tr> <td class="col-md-4"> <a name="name"></a> <span class="name"> <span ><b>name</b></span> <a href="#name"><span class="icon ion-ios-link"></span></a> </span> </td> </tr> <tr> <td class="col-md-4"> <i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code> </td> </tr> <tr> <td class="col-md-4"> <i>Default value : </i><code>&quot;tile-group-unbound&quot;</code> </td> </tr> <tr> <td class="col-md-4"> <div class="io-line">Defined in <a href="" data-line="97" class="link-to-prism">src/tiles/selection-tile.component.ts:97</a></div> </td> </tr> <tr> <td class="col-md-4"> <div class="io-description"><p>Set by the containing <code>TileGroup</code>. Used for the <code>name</code> property on the input.</p> </div> </td> </tr> </tbody> </table> <table class="table table-sm table-bordered"> <tbody> <tr> <td class="col-md-4"> <a name="tileCount"></a> <span class="name"> <span class="modifier">Static</span> <span ><b>tileCount</b></span> <a href="#tileCount"><span class="icon ion-ios-link"></span></a> </span> </td> </tr> <tr> <td class="col-md-4"> <i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code> </td> </tr> <tr> <td class="col-md-4"> <i>Default value : </i><code>0</code> </td> </tr> <tr> <td class="col-md-4"> <div class="io-line">Defined in <a href="" data-line="51" class="link-to-prism">src/tiles/selection-tile.component.ts:51</a></div> </td> </tr> </tbody> </table> </section> <section data-compodoc="block-accessors"> <h3 id="accessors"> Accessors </h3> <table class="table table-sm table-bordered"> <tbody> <tr> <td class="col-md-4"> <a name="selected"></a> <span class="name"><b>selected</b><a href="#selected"><span class="icon ion-ios-link"></span></a></span> </td> </tr> <tr> <td class="col-md-4"> <span class="accessor"><b>get</b><code>selected()</code></span> </td> </tr> <tr> <td class="col-md-4"> <div class="io-line">Defined in <a href="" data-line="77" class="link-to-prism">src/tiles/selection-tile.component.ts:77</a></div> </td> </tr> <tr> <td class="col-md-4"> <span class="accessor"><b>set</b><code>selected(value: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank">boolean</a>)</code></span> </td> </tr> <tr> <td class="col-md-4"> <div class="io-line">Defined in <a href="" data-line="68" class="link-to-prism">src/tiles/selection-tile.component.ts:68</a></div> </td> </tr> <tr> <td class="col-md-4"> <div class="io-description"><p>Updating the state of the input to match the state of the parameter passed in. Set to <code>true</code> if this tile should be selected.</p> </div> <div class="io-description"> <b>Parameters :</b> <table class="params"> <thead> <tr> <td>Name</td> <td>Type</td> <td>Optional</td> </tr> </thead> <tbody> <tr> <td>value</td> <td> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank" >boolean</a></code> </td> <td> No </td> </tr> </tbody> </table> </div> <div> </div> <div class="io-description"> <b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code> </div> </td> </tr> </tbody> </table> </section> </div> <div class="tab-pane fade tab-source-code" id="source"> <pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { Component, Input, Output, EventEmitter, ViewChild, HostListener, AfterViewInit } from &quot;@angular/core&quot;; import { I18n } from &quot;carbon-components-angular/i18n&quot;; @Component({ selector: &quot;cds-selection-tile, ibm-selection-tile&quot;, template: &#x60; &lt;input #input [attr.tabindex]&#x3D;&quot;disabled ? null : 0&quot; class&#x3D;&quot;cds--tile-input&quot; [id]&#x3D;&quot;id&quot; [disabled]&#x3D;&quot;disabled&quot; [type]&#x3D;&quot;(multiple ? &#x27;checkbox&#x27;: &#x27;radio&#x27;)&quot; [value]&#x3D;&quot;value&quot; [name]&#x3D;&quot;name&quot; (change)&#x3D;&quot;onChange($event)&quot;/&gt; &lt;label class&#x3D;&quot;cds--tile cds--tile--selectable&quot; [for]&#x3D;&quot;id&quot; [ngClass]&#x3D;&quot;{ &#x27;cds--tile--is-selected&#x27; : selected, &#x27;cds--tile--light&#x27;: theme &#x3D;&#x3D;&#x3D; &#x27;light&#x27;, &#x27;cds--tile--disabled&#x27; : disabled }&quot; [attr.aria-label]&#x3D;&quot;i18n.get(&#x27;TILES.TILE&#x27;) | async&quot;&gt; &lt;div class&#x3D;&quot;cds--tile__checkmark&quot; [class.cds--tile__checkmark--persistent]&#x3D;&quot;multiple&quot;&gt; &lt;svg *ngIf&#x3D;&quot;!selected; else selectedIcon&quot; [cdsIcon]&#x3D;&quot;multiple ? &#x27;checkbox&#x27; : &#x27;checkmark&#x27;&quot; size&#x3D;&quot;16&quot;&gt; &lt;/svg&gt; &lt;ng-template #selectedIcon&gt; &lt;svg [cdsIcon]&#x3D;&quot;multiple ? &#x27;checkbox--checked--filled&#x27; : &#x27;checkmark--filled&#x27;&quot; size&#x3D;&quot;16&quot;&gt;&lt;/svg&gt; &lt;/ng-template&gt; &lt;/div&gt; &lt;div class&#x3D;&quot;cds--tile-content&quot;&gt; &lt;ng-content&gt;&lt;/ng-content&gt; &lt;/div&gt; &lt;/label&gt; &#x60; }) export class SelectionTile implements AfterViewInit { static tileCount &#x3D; 0; /** * @deprecated since v5 - Use &#x60;cdsLayer&#x60; directive instead * Set to &#x60;&quot;light&quot;&#x60; to apply the light style */ @Input() theme: &quot;light&quot; | &quot;dark&quot; &#x3D; &quot;dark&quot;; /** * The unique id for the input. */ @Input() id &#x3D; &#x60;tile-${SelectionTile.tileCount}&#x60;; /** * Updating the state of the input to match the state of the parameter passed in. * Set to &#x60;true&#x60; if this tile should be selected. */ @Input() set selected(value: boolean) { // If an initial selected value is set before input exists, we save // the value and check again when input exists in &#x60;AfterViewInit&#x60;. this._selected &#x3D; value ? true : null; if (this.input) { this.input.nativeElement.checked &#x3D; this._selected; } } get selected() { return this.input ? this.input.nativeElement.checked : false; } /** * The value for the tile. Returned via &#x60;ngModel&#x60; or &#x60;selected&#x60; event on the containing &#x60;TileGroup&#x60;. */ @Input() value: string; /** * Internal event used to notify the containing &#x60;TileGroup&#x60; of changes. */ @Output() change: EventEmitter&lt;Event&gt; &#x3D; new EventEmitter(); /** * Set to &#x60;true&#x60; to disable the selection tile. */ @Input() disabled &#x3D; false; /** * Set by the containing &#x60;TileGroup&#x60;. Used for the &#x60;name&#x60; property on the input. */ name &#x3D; &quot;tile-group-unbound&quot;; /** * Defines whether or not the &#x60;SelectionTile&#x60; supports selecting multiple tiles as opposed to single * tile selection. */ multiple &#x3D; true; // Set to true because of the way tile group sets it up. // If it is first undefined then set to true, the type will change from radio to checkbox and deselects the inputs. @ViewChild(&quot;input&quot;, { static: true }) input; // If an initial selected value is set before input exists, we save // the value and check again when input exists in &#x60;AfterViewInit&#x60;. protected _selected &#x3D; null; constructor(public i18n: I18n) { SelectionTile.tileCount++; } ngAfterViewInit() { if (this.input) { setTimeout(() &#x3D;&gt; { this.input.nativeElement.checked &#x3D; this._selected; }); } } @HostListener(&quot;keydown&quot;, [&quot;$event&quot;]) keyboardInput(event) { if (event.key &#x3D;&#x3D;&#x3D; &quot;Enter&quot; || event.key &#x3D;&#x3D;&#x3D; &quot;Spacebar&quot; || event.key &#x3D;&#x3D;&#x3D; &quot; &quot;) { this.selected &#x3D; !this.selected; this.change.emit(event); } } onChange(event) { this.change.emit(event); } } </code></pre> </div> <div class="tab-pane fade " id="tree"> <div id="tree-container"></div> <div class="tree-legend"> <div class="title"> <b>Legend</b> </div> <div> <div class="color htmlelement"></div><span>Html element</span> </div> <div> <div class="color component"></div><span>Component</span> </div> <div> <div class="color directive"></div><span>Html element with directive</span> </div> </div> </div> </div> <script src="../js/libs/vis.min.js"></script> <script src="../js/libs/htmlparser.js"></script> <script src="../js/libs/deep-iterator.js"></script> <script> var COMPONENT_TEMPLATE = '<div><input #input [attr.tabindex]="disabled ? null : 0" class="cds--tile-input" [id]="id" [disabled]="disabled" [type]="(multiple ? \'checkbox\': \'radio\')" [value]="value" [name]="name" (change)="onChange($event)"/><label class="cds--tile cds--tile--selectable" [for]="id" [ngClass]="{ \'cds--tile--is-selected\' : selected, \'cds--tile--light\': theme === \'light\', \'cds--tile--disabled\' : disabled }" [attr.aria-label]="i18n.get(\'TILES.TILE\') | async"> <div class="cds--tile__checkmark" [class.cds--tile__checkmark--persistent]="multiple"> <svg *ngIf="!selected; else selectedIcon" [cdsIcon]="multiple ? \'checkbox\' : \'checkmark\'" size="16"> </svg> <ng-template #selectedIcon> <svg [cdsIcon]="multiple ? \'checkbox--checked--filled\' : \'checkmark--filled\'" size="16"></svg> </ng-template> </div> <div class="cds--tile-content"> <ng-content></ng-content> </div></label> </div>' var COMPONENTS = [{'name': 'Accordion', 'selector': 'cds-accordion, ibm-accordion'},{'name': 'AccordionItem', 'selector': 'cds-accordion-item, ibm-accordion-item'},{'name': 'ActionableNotification', 'selector': 'cds-actionable-notification, ibm-actionable-notification'},{'name': 'AlertModal', 'selector': 'cds-alert-modal, ibm-alert-modal'},{'name': 'BaseIconButton', 'selector': ''},{'name': 'BaseNotification', 'selector': ''},{'name': 'BaseTabHeader', 'selector': ''},{'name': 'Breadcrumb', 'selector': 'cds-breadcrumb, ibm-breadcrumb'},{'name': 'BreadcrumbItemComponent', 'selector': 'cds-breadcrumb-item, ibm-breadcrumb-item'},{'name': 'ButtonSet', 'selector': 'cds-button-set, ibm-button-set'},{'name': 'Checkbox', 'selector': 'cds-checkbox, ibm-checkbox'},{'name': 'ClickableTile', 'selector': 'cds-clickable-tile, ibm-clickable-tile'},{'name': 'CodeSnippet', 'selector': 'cds-code-snippet, ibm-code-snippet'},{'name': 'ComboBox', 'selector': 'cds-combo-box, ibm-combo-box'},{'name': 'ComboButtonComponent', 'selector': 'cds-combo-button'},{'name': 'ContainedList', 'selector': 'cds-contained-list, ibm-contained-list'},{'name': 'ContainedListItem', 'selector': 'cds-contained-list-item, ibm-contained-list-item'},{'name': 'ContentSwitcher', 'selector': 'cds-content-switcher, ibm-content-switcher'},{'name': 'ContextMenuComponent', 'selector': 'cds-menu, cds-context-menu, ibm-context-menu'},{'name': 'ContextMenuDividerComponent', 'selector': 'cds-menu-divider, cds-context-menu-divider, ibm-context-menu-divider'},{'name': 'ContextMenuGroupComponent', 'selector': 'cds-menu-group, cds-context-menu-group, ibm-context-menu-group'},{'name': 'ContextMenuItemComponent', 'selector': 'cds-menu-item, cds-context-menu-item, ibm-context-menu-item'},{'name': 'DatePicker', 'selector': 'cds-date-picker, ibm-date-picker'},{'name': 'DatePickerInput', 'selector': 'cds-date-picker-input, ibm-date-picker-input'},{'name': 'Dialog', 'selector': 'cds-dialog, ibm-dialog'},{'name': 'Documentation', 'selector': 'cds-documentation'},{'name': 'Dropdown', 'selector': 'cds-dropdown, ibm-dropdown'},{'name': 'DropdownList', 'selector': 'cds-dropdown-list, ibm-dropdown-list'},{'name': 'ExpandableTile', 'selector': 'cds-expandable-tile, ibm-expandable-tile'},{'name': 'FileComponent', 'selector': 'cds-file, ibm-file'},{'name': 'FileUploader', 'selector': 'cds-file-uploader, ibm-file-uploader'},{'name': 'Hamburger', 'selector': 'cds-hamburger, ibm-hamburger'},{'name': 'Header', 'selector': 'cds-header, ibm-header'},{'name': 'HeaderAction', 'selector': 'cds-header-action, ibm-header-action'},{'name': 'HeaderGlobal', 'selector': 'cds-header-global, ibm-header-global'},{'name': 'HeaderItem', 'selector': 'cds-header-item, ibm-header-item'},{'name': 'HeaderMenu', 'selector': 'cds-header-menu, ibm-header-menu'},{'name': 'HeaderNavigat