Skip to content

Commit

Permalink
feat(module:core,dropdown,table): add config for backdrop (#6783)
Browse files Browse the repository at this point in the history
  • Loading branch information
QichenZhu authored Nov 29, 2021
1 parent ffcb709 commit 2f7c44d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
10 changes: 10 additions & 0 deletions components/core/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ export interface NzConfig {
datePicker?: DatePickerConfig;
descriptions?: DescriptionsConfig;
drawer?: DrawerConfig;
dropDown?: DropDownConfig;
empty?: EmptyConfig;
filterTrigger?: FilterTriggerConfig;
form?: FormConfig;
icon?: IconConfig;
message?: MessageConfig;
Expand Down Expand Up @@ -168,10 +170,18 @@ export interface DrawerConfig {
nzDirection?: Direction;
}

export interface DropDownConfig {
nzBackdrop?: boolean;
}

export interface EmptyConfig {
nzDefaultEmptyContent?: Type<NzSafeAny> | TemplateRef<string> | string | undefined;
}

export interface FilterTriggerConfig {
nzBackdrop?: boolean;
}

export interface FormConfig {
nzNoColon?: boolean;
nzAutoTips?: Record<string, Record<string, string>>;
Expand Down
8 changes: 7 additions & 1 deletion components/dropdown/dropdown.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@ import {
import { BehaviorSubject, combineLatest, EMPTY, fromEvent, merge, Subject } from 'rxjs';
import { auditTime, distinctUntilChanged, filter, map, mapTo, switchMap, takeUntil } from 'rxjs/operators';

import { NzConfigKey, NzConfigService, WithConfig } from 'ng-zorro-antd/core/config';
import { warnDeprecation } from 'ng-zorro-antd/core/logger';
import { POSITION_MAP } from 'ng-zorro-antd/core/overlay';
import { BooleanInput, IndexableObject } from 'ng-zorro-antd/core/types';
import { InputBoolean } from 'ng-zorro-antd/core/util';

import { NzDropdownMenuComponent, NzPlacementType } from './dropdown-menu.component';

const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'dropDown';

const listOfPositions = [
POSITION_MAP.bottomLeft,
POSITION_MAP.bottomRight,
Expand All @@ -42,6 +45,8 @@ const listOfPositions = [
exportAs: 'nzDropdown'
})
export class NzDropDownDirective implements AfterViewInit, OnDestroy, OnChanges {
readonly _nzModuleName: NzConfigKey = NZ_CONFIG_MODULE_NAME;

static ngAcceptInputType_nzBackdrop: BooleanInput;
static ngAcceptInputType_nzHasBackdrop: BooleanInput;
static ngAcceptInputType_nzClickHide: BooleanInput;
Expand All @@ -67,7 +72,7 @@ export class NzDropDownDirective implements AfterViewInit, OnDestroy, OnChanges
* @breaking-change 13.0.0
*/
@Input() @InputBoolean() nzHasBackdrop = false;
@Input() @InputBoolean() nzBackdrop = false;
@Input() @WithConfig<boolean>() @InputBoolean() nzBackdrop = false;
@Input() @InputBoolean() nzClickHide = true;
@Input() @InputBoolean() nzDisabled = false;
@Input() @InputBoolean() nzVisible = false;
Expand All @@ -83,6 +88,7 @@ export class NzDropDownDirective implements AfterViewInit, OnDestroy, OnChanges
}

constructor(
public readonly nzConfigService: NzConfigService,
public elementRef: ElementRef,
private overlay: Overlay,
private renderer: Renderer2,
Expand Down
9 changes: 7 additions & 2 deletions components/table/src/addon/filter-trigger.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ import {
ViewEncapsulation
} from '@angular/core';

import { NzConfigKey, NzConfigService, WithConfig } from 'ng-zorro-antd/core/config';
import { warnDeprecation } from 'ng-zorro-antd/core/logger';
import { BooleanInput } from 'ng-zorro-antd/core/types';
import { InputBoolean } from 'ng-zorro-antd/core/util';
import { NzDropdownMenuComponent } from 'ng-zorro-antd/dropdown';

const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'filterTrigger';

@Component({
selector: 'nz-filter-trigger',
exportAs: `nzFilterTrigger`,
Expand All @@ -46,6 +49,8 @@ import { NzDropdownMenuComponent } from 'ng-zorro-antd/dropdown';
`
})
export class NzFilterTriggerComponent implements OnChanges {
readonly _nzModuleName: NzConfigKey = NZ_CONFIG_MODULE_NAME;

static ngAcceptInputType_nzBackdrop: BooleanInput;
static ngAcceptInputType_nzHasBackdrop: BooleanInput;

Expand All @@ -58,7 +63,7 @@ export class NzFilterTriggerComponent implements OnChanges {
* @breaking-change 13.0.0
*/
@Input() @InputBoolean() nzHasBackdrop = false;
@Input() @InputBoolean() nzBackdrop = false;
@Input() @WithConfig<boolean>() @InputBoolean() nzBackdrop = false;

@Output() readonly nzVisibleChange = new EventEmitter<boolean>();

Expand All @@ -81,7 +86,7 @@ export class NzFilterTriggerComponent implements OnChanges {
this.cdr.markForCheck();
}

constructor(private cdr: ChangeDetectorRef) {}
constructor(public readonly nzConfigService: NzConfigService, private cdr: ChangeDetectorRef) {}

ngOnChanges(changes: SimpleChanges): void {
const { nzHasBackdrop } = changes;
Expand Down

0 comments on commit 2f7c44d

Please sign in to comment.