mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
697 lines
24 KiB
HTML
697 lines
24 KiB
HTML
<!doctype html>
|
|
<html class="no-js" lang="">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
|
<title>framadate-funky-frontend 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">
|
|
</head>
|
|
<body>
|
|
|
|
<div class="navbar navbar-default navbar-fixed-top visible-xs">
|
|
<a href="../" class="navbar-brand">framadate-funky-frontend documentation</a>
|
|
<button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
|
|
</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="hidden-xs menu">
|
|
<compodoc-menu mode="normal"></compodoc-menu>
|
|
</div>
|
|
<!-- START CONTENT -->
|
|
<div class="content directive">
|
|
<div class="content-data">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<ol class="breadcrumb">
|
|
<li>Directives</li>
|
|
<li>DateValueAccessor</li>
|
|
</ol>
|
|
|
|
<ul class="nav nav-tabs" role="tablist">
|
|
<li class="active">
|
|
<a href="#info" role="tab" id="info-tab" data-toggle="tab" data-link="info">Info</a>
|
|
</li>
|
|
<li >
|
|
<a href="#source" role="tab" id="source-tab" data-toggle="tab" data-link="source">Source</a>
|
|
</li>
|
|
</ul>
|
|
|
|
<div class="tab-content">
|
|
<div class="tab-pane fade active in" id="c-info">
|
|
<p class="comment">
|
|
<h3>File</h3>
|
|
</p>
|
|
<p class="comment">
|
|
<code>src/app/custom-lib/date-value-accessor/date-value-accessor.ts</code>
|
|
</p>
|
|
|
|
<p class="comment">
|
|
<h3>Description</h3>
|
|
</p>
|
|
<p class="comment">
|
|
<p>The accessor for writing a value and listening to changes on a date input element</p>
|
|
<h3 id="example">Example</h3>
|
|
<p> <code><input type="date" name="myBirthday" ngModel useValueAsDate></code></p>
|
|
|
|
</p>
|
|
|
|
<p class="comment">
|
|
<h3>Implements</h3>
|
|
</p>
|
|
<p class="comment">
|
|
<code><a href="https://angular.io/api/forms/ControlValueAccessor" target="_blank" >ControlValueAccessor</a></code>
|
|
</p>
|
|
|
|
|
|
<section>
|
|
<h3>Metadata</h3>
|
|
<table class="table table-sm table-hover">
|
|
<tbody>
|
|
<tr>
|
|
<td class="col-md-3">Providers</td>
|
|
<td class="col-md-9">
|
|
<code>
|
|
DATE_VALUE_ACCESSOR
|
|
</code>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="col-md-3">Selector</td>
|
|
<td class="col-md-9"><code>[useValueAsDate]</code></td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
</table>
|
|
</section>
|
|
|
|
<section>
|
|
<h3 id="index">Index</h3>
|
|
<table class="table table-sm table-bordered index-table">
|
|
<tbody>
|
|
|
|
<tr>
|
|
<td class="col-md-4">
|
|
<h6><b>Methods</b></h6>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="col-md-4">
|
|
<ul class="index-list">
|
|
<li>
|
|
<a href="#registerOnChange">registerOnChange</a>
|
|
</li>
|
|
<li>
|
|
<a href="#registerOnTouched">registerOnTouched</a>
|
|
</li>
|
|
<li>
|
|
<a href="#setDisabledState">setDisabledState</a>
|
|
</li>
|
|
<li>
|
|
<a href="#writeValue">writeValue</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="#blur">blur</a>
|
|
</li>
|
|
<li>
|
|
<a href="#input">input</a>
|
|
</li>
|
|
</ul>
|
|
</td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
</table>
|
|
</section>
|
|
|
|
<section>
|
|
<h3 id="constructor">Constructor</h3>
|
|
<table class="table table-sm table-bordered">
|
|
<tbody>
|
|
<tr>
|
|
<td class="col-md-4">
|
|
<code>constructor(_renderer: <a href="https://angular.io/api/core/Renderer2" target="_blank">Renderer2</a>, _elementRef: <a href="https://angular.io/api/core/ElementRef" target="_blank">ElementRef</a>)</code>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="col-md-4">
|
|
<div class="io-line">Defined in <a href="" data-line="29" class="link-to-prism">src/app/custom-lib/date-value-accessor/date-value-accessor.ts:29</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>_renderer</td>
|
|
|
|
<td>
|
|
<code><a href="https://angular.io/api/core/Renderer2" target="_blank" >Renderer2</a></code>
|
|
</td>
|
|
|
|
<td>
|
|
No
|
|
</td>
|
|
|
|
</tr>
|
|
<tr>
|
|
<td>_elementRef</td>
|
|
|
|
<td>
|
|
<code><a href="https://angular.io/api/core/ElementRef" target="_blank" >ElementRef</a></code>
|
|
</td>
|
|
|
|
<td>
|
|
No
|
|
</td>
|
|
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section>
|
|
<h3>HostListeners</h3> <table class="table table-sm table-bordered">
|
|
<tbody>
|
|
<tr>
|
|
<td class="col-md-4">
|
|
<a name="blur"></a>
|
|
<span class="name">
|
|
<b>
|
|
blur
|
|
</b>
|
|
<a href="#blur"><span class="icon ion-ios-link"></span></a>
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="col-md-4">
|
|
<code>blur()</code>
|
|
</td>
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
<td class="col-md-4">
|
|
<div class="io-line">Defined in <a href="" data-line="28"
|
|
class="link-to-prism">src/app/custom-lib/date-value-accessor/date-value-accessor.ts:28</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">
|
|
<b>
|
|
input
|
|
</b>
|
|
<a href="#input"><span class="icon ion-ios-link"></span></a>
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="col-md-4">
|
|
<i>Arguments : </i><code>'$event.target.valueAsDate' </code>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="col-md-4">
|
|
<code>input()</code>
|
|
</td>
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
<td class="col-md-4">
|
|
<div class="io-line">Defined in <a href="" data-line="26"
|
|
class="link-to-prism">src/app/custom-lib/date-value-accessor/date-value-accessor.ts:26</a></div>
|
|
</td>
|
|
</tr>
|
|
|
|
|
|
</tbody>
|
|
</table>
|
|
</section>
|
|
<section>
|
|
|
|
<h3 id="methods">
|
|
Methods
|
|
</h3>
|
|
<table class="table table-sm table-bordered">
|
|
<tbody>
|
|
<tr>
|
|
<td class="col-md-4">
|
|
<a name="registerOnChange"></a>
|
|
<span class="name">
|
|
<b>
|
|
registerOnChange
|
|
</b>
|
|
<a href="#registerOnChange"><span class="icon ion-ios-link"></span></a>
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="col-md-4">
|
|
<code>registerOnChange(fn: (_: <a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank">any</a>) => void)</code>
|
|
</td>
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
<td class="col-md-4">
|
|
<div class="io-line">Defined in <a href="" data-line="42"
|
|
class="link-to-prism">src/app/custom-lib/date-value-accessor/date-value-accessor.ts:42</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>Type</td>
|
|
<td>Optional</td>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>fn</td>
|
|
<td>
|
|
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/function" target="_blank" >function</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>
|
|
<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="registerOnTouched"></a>
|
|
<span class="name">
|
|
<b>
|
|
registerOnTouched
|
|
</b>
|
|
<a href="#registerOnTouched"><span class="icon ion-ios-link"></span></a>
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="col-md-4">
|
|
<code>registerOnTouched(fn: () => void)</code>
|
|
</td>
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
<td class="col-md-4">
|
|
<div class="io-line">Defined in <a href="" data-line="46"
|
|
class="link-to-prism">src/app/custom-lib/date-value-accessor/date-value-accessor.ts:46</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>Type</td>
|
|
<td>Optional</td>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>fn</td>
|
|
<td>
|
|
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/function" target="_blank" >function</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>
|
|
<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="setDisabledState"></a>
|
|
<span class="name">
|
|
<b>
|
|
setDisabledState
|
|
</b>
|
|
<a href="#setDisabledState"><span class="icon ion-ios-link"></span></a>
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="col-md-4">
|
|
<code>setDisabledState(isDisabled: <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">
|
|
<div class="io-line">Defined in <a href="" data-line="50"
|
|
class="link-to-prism">src/app/custom-lib/date-value-accessor/date-value-accessor.ts:50</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>Type</td>
|
|
<td>Optional</td>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>isDisabled</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>
|
|
<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="writeValue"></a>
|
|
<span class="name">
|
|
<b>
|
|
writeValue
|
|
</b>
|
|
<a href="#writeValue"><span class="icon ion-ios-link"></span></a>
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="col-md-4">
|
|
<code>writeValue(value: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date" target="_blank">Date</a>)</code>
|
|
</td>
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
<td class="col-md-4">
|
|
<div class="io-line">Defined in <a href="" data-line="34"
|
|
class="link-to-prism">src/app/custom-lib/date-value-accessor/date-value-accessor.ts:34</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>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/Date" target="_blank" >Date</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>
|
|
<div class="io-description">
|
|
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</section>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="tab-pane fade tab-source-code" id="c-source">
|
|
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {Directive, ElementRef, forwardRef, HostListener, Renderer2} from '@angular/core';
|
|
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';
|
|
|
|
export const DATE_VALUE_ACCESSOR: any = {
|
|
provide: NG_VALUE_ACCESSOR,
|
|
useExisting: forwardRef(() => DateValueAccessor),
|
|
multi: true
|
|
};
|
|
|
|
/**
|
|
* The accessor for writing a value and listening to changes on a date input element
|
|
*
|
|
* ### Example
|
|
* `<input type="date" name="myBirthday" ngModel useValueAsDate>`
|
|
*/
|
|
@Directive({
|
|
// this selector changes the previous behavior silently and might break existing code
|
|
// selector: 'input[type=date][formControlName],input[type=date][formControl],input[type=date][ngModel]',
|
|
|
|
// this selector is an opt-in version
|
|
selector: '[useValueAsDate]',
|
|
providers: [DATE_VALUE_ACCESSOR]
|
|
})
|
|
export class DateValueAccessor implements ControlValueAccessor {
|
|
|
|
@HostListener('input', ['$event.target.valueAsDate']) onChange = (_: any) => {
|
|
};
|
|
@HostListener('blur', []) onTouched = () => {
|
|
};
|
|
|
|
constructor(private _renderer: Renderer2, private _elementRef: ElementRef) {
|
|
}
|
|
|
|
writeValue(value: Date): void {
|
|
if (!value) {
|
|
this._renderer.setProperty(this._elementRef.nativeElement, 'value', null);
|
|
return;
|
|
}
|
|
this._renderer.setProperty(this._elementRef.nativeElement, 'valueAsDate', value);
|
|
}
|
|
|
|
registerOnChange(fn: (_: any) => void): void {
|
|
this.onChange = fn;
|
|
}
|
|
|
|
registerOnTouched(fn: () => void): void {
|
|
this.onTouched = fn;
|
|
}
|
|
|
|
setDisabledState(isDisabled: boolean): void {
|
|
this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
|
|
}
|
|
}
|
|
</code></pre>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div><div class="search-results">
|
|
<div class="has-results">
|
|
<h1 class="search-results-title"><span class='search-results-count'></span> result-matching "<span class='search-query'></span>"</h1>
|
|
<ul class="search-results-list"></ul>
|
|
</div>
|
|
<div class="no-results">
|
|
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- END CONTENT -->
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
var COMPODOC_CURRENT_PAGE_DEPTH = 1;
|
|
var COMPODOC_CURRENT_PAGE_CONTEXT = 'directive';
|
|
var COMPODOC_CURRENT_PAGE_URL = 'DateValueAccessor.html';
|
|
</script>
|
|
|
|
<script src="../js/libs/custom-elements.min.js"></script>
|
|
<script src="../js/libs/lit-html.js"></script>
|
|
<!-- Required to polyfill modern browsers as code is ES5 for IE... -->
|
|
<script src="../js/libs/custom-elements-es5-adapter.js" charset="utf-8" defer></script>
|
|
<script src="../js/menu-wc.js" defer></script>
|
|
|
|
<script src="../js/libs/bootstrap-native.js"></script>
|
|
|
|
<script src="../js/libs/es6-shim.min.js"></script>
|
|
<script src="../js/libs/EventDispatcher.js"></script>
|
|
<script src="../js/libs/promise.min.js"></script>
|
|
<script src="../js/libs/zepto.min.js"></script>
|
|
|
|
<script src="../js/compodoc.js"></script>
|
|
|
|
<script src="../js/tabs.js"></script>
|
|
<script src="../js/menu.js"></script>
|
|
<script src="../js/libs/clipboard.min.js"></script>
|
|
<script src="../js/libs/prism.js"></script>
|
|
<script src="../js/sourceCode.js"></script>
|
|
<script src="../js/search/search.js"></script>
|
|
<script src="../js/search/lunr.min.js"></script>
|
|
<script src="../js/search/search-lunr.js"></script>
|
|
<script src="../js/search/search_index.js"></script>
|
|
<script src="../js/lazy-load-graphs.js"></script>
|
|
|
|
|
|
</body>
|
|
</html>
|