Commit 4c853a05 authored by LAVENIER's avatar LAVENIER
Browse files

Release v0.11.9

parent a16d71a2
{
"name": "@sumaris-net/ngx-components",
"description": "SUMARiS Angular components",
"version": "0.11.6",
"version": "0.11.9",
"author": "contact@e-is.pro",
"license": "AGPL-3.0",
"readmeFilename": "README.md",
......
......@@ -27,7 +27,7 @@
<!-- add button -->
<button mat-icon-button color="light"
*ngIf="!canForward && row.validator.valid"
*ngIf="!canForward && canConfirmAndAdd && row.validator.valid"
[title]="'COMMON.BTN_ADD'|translate"
(click)="confirmAndAddClick.emit({event: $event, row: row})">
<mat-icon>add</mat-icon>
......
......@@ -10,6 +10,7 @@
[max]="definition.maxValue"
pattern="-?[0-9]*"
step="1"
[appAutofocus]="autofocus"
[placeholder]="placeholder"
(keyup.enter)="onKeyupEnter.emit($event)"
(keypress)="filterNumberInput($event, false)"
......@@ -39,8 +40,10 @@
type="number"
decimal="true"
autocomplete="off"
[min]="definition.minValue"
[max]="definition.maxValue"
[appAutofocus]="autofocus"
[readonly]="readonly"
[min]="definition.minValue" [max]="definition.maxValue"
[placeholder]="placeholder"
[step]="numberInputStep"
(keypress)="filterNumberInput($event, true)"
......@@ -78,14 +81,15 @@
<!-- date -->
<mat-date-field *ngSwitchCase="'date'" #matInput
[class]="classList"
[formControl]="formControl"
[placeholder]="compact ? ('COMMON.DATE_PLACEHOLDER'|translate): placeholder"
[floatLabel]="floatLabel"
[required]="required"
[readonly]="readonly"
[compact]="compact"
[tabindex]="tabindex">
[class]="classList"
[formControl]="formControl"
[placeholder]="compact ? ('COMMON.DATE_PLACEHOLDER'|translate): placeholder"
[floatLabel]="floatLabel"
[required]="required"
[readonly]="readonly"
[compact]="compact"
[tabindex]="tabindex"
[autofocus]="autofocus">
<div matSuffix>
<ng-content select="[matSuffix]"></ng-content>
</div>
......@@ -100,7 +104,8 @@
[required]="required"
[readonly]="readonly"
[compact]="compact"
[tabindex]="tabindex">
[tabindex]="tabindex"
[autofocus]="autofocus">
<div matSuffix>
<ng-content select="[matSuffix]"></ng-content>
</div>
......@@ -129,6 +134,7 @@
<ion-icon margin-right name="color-fill" matPrefix></ion-icon>
<input matInput autocomplete="off"
[appAutofocus]="autofocus"
[formControl]="formControl"
[style.color]="getColorContrast(formControl.value)"
[style.background]="formControl.value"
......@@ -146,6 +152,7 @@
<mat-form-field *ngSwitchCase="'string'" [floatLabel]="floatLabel" [class]="classList">
<input matInput #matInput
autocomplete="off"
[appAutofocus]="autofocus"
[formControl]="formControl"
[placeholder]="placeholder"
[required]="required"
......@@ -163,6 +170,7 @@
<!-- auto-complete -->
<mat-autocomplete-field *ngSwitchCase="'entity'"
[class]="classList"
[autofocus]="autofocus"
[placeholder]="placeholder"
[floatLabel]="floatLabel"
[formControl]="formControl"
......
......@@ -14,7 +14,7 @@ import {
import {ControlValueAccessor, FormControl, FormGroupDirective, NG_VALUE_ACCESSOR} from '@angular/forms';
import {FloatLabelType} from '@angular/material/form-field';
import {isNilOrBlank, isNotNilOrBlank, joinPropertiesPath, toBoolean} from '../functions';
import {DisplayFn, FormFieldDefinition} from './field.model';
import { DisplayFn, FormFieldDefinition, FormFieldType } from './field.model';
import {TranslateService} from '@ngx-translate/core';
import {getColorContrast} from '../graph/colors.utils';
import {asInputElement, filterNumberInput, selectInputContent} from '../inputs';
......@@ -42,14 +42,14 @@ export class AppFormField implements OnInit, ControlValueAccessor {
private _onTouchedCallback: () => void = noop;
private _definition: FormFieldDefinition;
type: string;
type: FormFieldType;
numberInputStep: string;
@Input()
set definition(value: FormFieldDefinition) {
if (this._definition === value) return;
this._definition = value;
this.type = value && value.type;
this.type = value?.type;
this.cd.markForCheck();
}
......@@ -58,22 +58,15 @@ export class AppFormField implements OnInit, ControlValueAccessor {
}
@Input() required: boolean;
@Input() readonly = false;
@Input() disabled: boolean;
@Input() formControl: FormControl;
@Input() formControlName: string;
@Input() placeholder: string;
@Input() compact = false;
@Input() floatLabel: FloatLabelType = 'auto';
@Input() tabindex: number;
@Input() autofocus: boolean;
@Input('class') classList: string;
......
......@@ -7,7 +7,7 @@ export declare type DisplayFn = (obj: any) => string;
export declare type CompareWithFn = (o1: any, o2: any) => boolean;
export declare type FormFieldType = 'integer' | 'double' | 'boolean' | 'string' | 'enum' | 'color' | 'peer' | 'entity' | 'entities';
export declare type FormFieldType = 'integer' | 'double' | 'boolean' | 'string' | 'enum' | 'color' | 'peer' | 'entity' | 'entities' | 'date' | 'dateTime';
export declare interface FormFieldDefinition<T = any> {
key: string;
......
......@@ -51,21 +51,13 @@ export class MatBooleanField implements OnInit, AfterViewInit, ControlValueAcces
showRadio = false;
@Input() disabled = false;
@Input() formControl: FormControl;
@Input() formControlName: string;
@Input() placeholder: string;
@Input() floatLabel: FloatLabelType = 'auto';
@Input() readonly = false;
@Input() required = false;
@Input() compact = false;
@Input() style: 'radio' | 'checkbox' | 'button';
@Output('keyup.enter')
......
......@@ -74,23 +74,14 @@ export class MatDate implements OnInit, OnDestroy, ControlValueAccessor, InputEl
dayMask = DAY_MASK;
@Input() disabled = false;
@Input() formControl: FormControl;
@Input() formControlName: string;
@Input() placeholder: string;
@Input() floatLabel: FloatLabelType = 'auto';
@Input() readonly = false;
@Input() required: boolean;
@Input() compact = false;
@Input() placeholderChar: string = DEFAULT_PLACEHOLDER_CHAR;
@Input() autofocus = false;
@Input() set tabindex(value: number) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment