Commit 67d7ea9f authored by PECQUOT's avatar PECQUOT
Browse files

release 0.11.9

[fix] functions.ts: change splitBy* signature
[fix] material.autocomplete: rename autofocus property
parent 4c853a05
import {LoadResult} from './services/entity-service.class';
import { LoadResult } from './services/entity-service.class';
export function isNil<T>(obj: T | null | undefined): boolean {
return obj === undefined || obj === null;
......@@ -365,13 +365,12 @@ export function uncapitalizeFirstLetter(value: string) {
return value.substr(0, 1).toLowerCase() + value.substr(1);
}
export function splitByProperty<T,
K extends number|string,
// @ts-ignore
M extends { [key: K]: T } = { [key: K]: T }
>(array: T[] | readonly T[], propertyName: string): M {
export type KeyType = string | number;
export type KeyValueType<T> = {[key in KeyType]: T};
export function splitByProperty<T, M extends KeyValueType<T> = KeyValueType<T>>(array: T[] | readonly T[], propertyName: string): M {
return (array || []).reduce((res, value) => {
const key = value && value[propertyName];
const key = value?.[propertyName];
if (isNotNil(key)) {
res[key] = value;
}
......@@ -379,13 +378,9 @@ export function splitByProperty<T,
}, <M>{});
}
export function splitById<T,
ID extends number|string = number,
// @ts-ignore
M extends { [key: ID]: T } = { [key: number]: T }
>(array: T[] | readonly T[]): M {
export function splitById<T, M extends KeyValueType<T> = KeyValueType<T>>(array: T[] | readonly T[]): M {
return (array || []).reduce((res, value) => {
const key = value && value['id'];
const key = value?.['id'];
if (isNotNil(key)) {
res[key] = value;
}
......
......@@ -87,7 +87,7 @@
[matAutocompletePosition]="matAutocompletePosition"
[formControl]="formControl"
[placeholder]="placeholder"
[appAutofocus]="appAutofocus"
[appAutofocus]="autofocus"
[tabindex]="_tabindex"
[readonly]="readonly"
[required]="required"
......
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EventEmitter, forwardRef, HostBinding, Input, OnDestroy, OnInit, Optional, Output, Provider, ViewChild} from '@angular/core';
import {ControlValueAccessor, FormControl, FormGroupDirective, NG_VALUE_ACCESSOR} from '@angular/forms';
import {BehaviorSubject, isObservable, merge, Observable, of, Subject, Subscription, timer} from 'rxjs';
import {debounceTime, distinctUntilChanged, filter, map, mergeMap, startWith, switchMap, takeUntil, takeWhile, tap} from 'rxjs/operators';
import {FetchMoreFn, LoadResult, SuggestFn, SuggestService} from '../../services/entity-service.class';
import {changeCaseToUnderscore, isNil, isNilOrBlank, isNotNil, isNotNilOrBlank, isNotNilString, joinPropertiesPath, suggestFromArray, toBoolean, toNumber} from '../../functions';
import {focusInput, InputElement, selectInputContent, selectInputRange} from '../../inputs';
import {firstNotNilPromise} from '../../observables';
import {CompareWithFn, DisplayFn} from '../../form/field.model';
import {FloatLabelType} from '@angular/material/form-field';
import {MatSelect} from '@angular/material/select';
import {MatAutocomplete} from '@angular/material/autocomplete';
import {fromScrollEndEvent} from '../../events';
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
ElementRef,
EventEmitter,
forwardRef,
HostBinding,
Input,
OnDestroy,
OnInit,
Optional,
Output,
Provider,
ViewChild
} from '@angular/core';
import { ControlValueAccessor, FormControl, FormGroupDirective, NG_VALUE_ACCESSOR } from '@angular/forms';
import { BehaviorSubject, isObservable, merge, Observable, of, Subject, Subscription, timer } from 'rxjs';
import { debounceTime, distinctUntilChanged, filter, map, mergeMap, startWith, switchMap, takeUntil, takeWhile, tap } from 'rxjs/operators';
import { FetchMoreFn, LoadResult, SuggestFn, SuggestService } from '../../services/entity-service.class';
import { changeCaseToUnderscore, isNil, isNilOrBlank, isNotNil, isNotNilOrBlank, isNotNilString, joinPropertiesPath, suggestFromArray, toBoolean, toNumber } from '../../functions';
import { focusInput, InputElement, selectInputContent, selectInputRange } from '../../inputs';
import { firstNotNilPromise } from '../../observables';
import { CompareWithFn, DisplayFn } from '../../form/field.model';
import { FloatLabelType } from '@angular/material/form-field';
import { MatSelect } from '@angular/material/select';
import { MatAutocomplete } from '@angular/material/autocomplete';
import { fromScrollEndEvent } from '../../events';
export declare interface MatAutocompleteFieldConfig<T = any, F = any> {
......@@ -156,7 +171,7 @@ export class MatAutocompleteField implements OnInit, InputElement, OnDestroy, Co
@Input() highlightAccent = false;
@Input() showAllOnFocus: boolean;
@Input() showPanelOnFocus: boolean;
@Input() appAutofocus: boolean;
@Input() autofocus: boolean;
@Input() config: MatAutocompleteFieldConfig;
@Input() i18nPrefix = 'REFERENTIAL.';
@Input() noResultMessage = 'COMMON.NO_RESULT';
......@@ -645,7 +660,7 @@ export class MatAutocompleteField implements OnInit, InputElement, OnDestroy, Co
else {
this.searchable = searchable;
if (searchable) {
this.appAutofocus = true;
this.autofocus = true;
this.showPanelOnFocus = false;
}
this.markForCheck();
......
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