Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
set nzSearchValue(value: string) {
this._searchValue = value;
this.nzTreeService.searchExpand(value);
if (isNotNil(value)) {
this.nzSearchValueChange.emit(this.nzTreeService.formatEvent('search', null, null));
/**
* @deprecated 9.0.0 - use `nzOnSearchNode` instead.
* Hide warning, need remove next version
*/
this.nzOnSearchNode.emit(this.nzTreeService.formatEvent('search', null, null));
}
}
set nzDisabledMinutes(value: (hour: number) => number[]) {
if (isNotNil(value)) {
this._disabledMinutes = value;
this.buildMinutes();
}
}
getMaxPrecision(currentValue: string | number, ratio: number): number {
if (isNotNil(this.nzPrecision)) {
return this.nzPrecision;
}
const ratioPrecision = this.getPrecision(ratio);
const stepPrecision = this.getPrecision(this.nzStep);
const currentValuePrecision = this.getPrecision(currentValue as number);
if (!currentValue) {
return ratioPrecision + stepPrecision;
}
return Math.max(currentValuePrecision, ratioPrecision + stepPrecision);
}
setClassMap(): void {
const classMap = {
[`${this.prefixCls}`]: true,
[`${this.prefixCls}-${this.nzSpan}`]: isNotNil(this.nzSpan),
[`${this.prefixCls}-order-${this.nzOrder}`]: isNotNil(this.nzOrder),
[`${this.prefixCls}-offset-${this.nzOffset}`]: isNotNil(this.nzOffset),
[`${this.prefixCls}-pull-${this.nzPull}`]: isNotNil(this.nzPull),
[`${this.prefixCls}-push-${this.nzPush}`]: isNotNil(this.nzPush),
...this.generateClass()
};
this.nzUpdateHostClassService.updateHostClass(this.el, classMap);
}
toNumber(num: string | number): number {
if (this.isNotCompleteNumber(num)) {
return num as number;
}
if (isNotNil(this.nzPrecision)) {
return Number(Number(num).toFixed(this.nzPrecision));
}
return Number(num);
}
setClassMap(): void {
const classMap = {
[`${this.prefixCls}`]: true,
[`${this.prefixCls}-${this.nzSpan}`]: isNotNil(this.nzSpan),
[`${this.prefixCls}-order-${this.nzOrder}`]: isNotNil(this.nzOrder),
[`${this.prefixCls}-offset-${this.nzOffset}`]: isNotNil(this.nzOffset),
[`${this.prefixCls}-pull-${this.nzPull}`]: isNotNil(this.nzPull),
[`${this.prefixCls}-push-${this.nzPush}`]: isNotNil(this.nzPush),
...this.generateClass()
};
this.nzUpdateHostClassService.updateHostClass(this.el, classMap);
}
isSelected12Hours(value: { index: number; value: string }): boolean {
return (
value.value.toUpperCase() === this.time.selected12Hours ||
(!isNotNil(this.time.selected12Hours) && value.value.toUpperCase() === this.time.default12Hours)
);
}
setClassMap(): void {
const classMap = {
[`${this.prefixCls}`]: true,
[`${this.prefixCls}-${this.nzSpan}`]: isNotNil(this.nzSpan),
[`${this.prefixCls}-order-${this.nzOrder}`]: isNotNil(this.nzOrder),
[`${this.prefixCls}-offset-${this.nzOffset}`]: isNotNil(this.nzOffset),
[`${this.prefixCls}-pull-${this.nzPull}`]: isNotNil(this.nzPull),
[`${this.prefixCls}-push-${this.nzPush}`]: isNotNil(this.nzPush),
...this.generateClass()
};
this.nzUpdateHostClassService.updateHostClass(this.el, classMap);
}
setValue(value: Date | undefined, use12Hours?: boolean): this {
if (isNotNil(use12Hours)) {
this._use12Hours = use12Hours as boolean;
}
this.value = value;
return this;
}