import { Observable } from 'rxjs'; import { Direction } from '@angular/cdk/bidi'; import * as i0 from '@angular/core'; import { TemplateRef, Type, InjectionToken, EnvironmentProviders } from '@angular/core'; import { SafeUrl } from '@angular/platform-browser'; import { ThemeType } from '@ant-design/icons-angular'; import { NzBreakpointEnum } from 'ng-zorro-antd/core/services'; import { NzSafeAny, NzShapeSCType, NzSizeLDSType, NzSizeDSType, NzSizeMDSType, NzTSType } from 'ng-zorro-antd/core/types'; /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ interface MonacoEnvironment { globalAPI?: boolean; baseUrl?: string; getWorker?(workerId: string, label: string): Promise | Worker; getWorkerUrl?(workerId: string, label: string): string; } interface NzConfig { affix?: AffixConfig; select?: SelectConfig; alert?: AlertConfig; anchor?: AnchorConfig; avatar?: AvatarConfig; backTop?: BackTopConfig; badge?: BadgeConfig; button?: ButtonConfig; card?: CardConfig; carousel?: CarouselConfig; cascader?: CascaderConfig; codeEditor?: CodeEditorConfig; collapse?: CollapseConfig; collapsePanel?: CollapsePanelConfig; datePicker?: DatePickerConfig; descriptions?: DescriptionsConfig; drawer?: DrawerConfig; dropDown?: DropDownConfig; empty?: EmptyConfig; filterTrigger?: FilterTriggerConfig; form?: FormConfig; icon?: IconConfig; message?: MessageConfig; modal?: ModalConfig; notification?: NotificationConfig; pageHeader?: PageHeaderConfig; pagination?: PaginationConfig; progress?: ProgressConfig; rate?: RateConfig; segmented?: SegmentedConfig; space?: SpaceConfig; spin?: SpinConfig; switch?: SwitchConfig; table?: TableConfig; tabs?: TabsConfig; timePicker?: TimePickerConfig; tree?: TreeConfig; treeSelect?: TreeSelectConfig; typography?: TypographyConfig; image?: ImageConfig; popconfirm?: PopConfirmConfig; popover?: PopoverConfig; imageExperimental?: ImageExperimentalConfig; theme?: Theme; prefixCls?: PrefixCls; } interface PrefixCls { prefixCls?: string; iconPrefixCls?: string; } interface Theme { primaryColor?: string; infoColor?: string; successColor?: string; processingColor?: string; errorColor?: string; warningColor?: string; [key: string]: string | undefined; } interface SelectConfig { nzBorderless?: boolean; nzSuffixIcon?: TemplateRef | string | null; nzBackdrop?: boolean; nzOptionHeightPx?: number; } interface AffixConfig { nzOffsetBottom?: number; nzOffsetTop?: number; } interface AlertConfig { nzCloseable?: boolean; nzShowIcon?: boolean; } interface AvatarConfig { nzShape?: NzShapeSCType; nzSize?: NzSizeLDSType | number; nzGap?: number; } interface AnchorConfig { nzBounds?: number; nzOffsetBottom?: number; nzOffsetTop?: number; nzShowInkInFixed?: boolean; } interface BackTopConfig { nzVisibilityHeight?: number; } interface BadgeConfig { nzColor?: number; nzOverflowCount?: number; nzShowZero?: number; } interface ButtonConfig { nzSize?: 'large' | 'default' | 'small'; } interface CodeEditorConfig { assetsRoot?: string | SafeUrl; extraConfig?: NzSafeAny; defaultEditorOption?: NzSafeAny; useStaticLoading?: boolean; monacoEnvironment?: MonacoEnvironment; onLoad?(): void; onFirstEditorInit?(): void; onInit?(): void; } interface CardConfig { nzSize?: NzSizeDSType; nzHoverable?: boolean; nzBordered?: boolean; } interface CarouselConfig { nzAutoPlay?: boolean; nzAutoPlaySpeed?: boolean; nzDots?: boolean; nzEffect?: 'scrollx' | 'fade' | string; nzEnableSwipe?: boolean; nzVertical?: boolean; nzLoop?: boolean; } interface CascaderConfig { nzSize?: string; nzBackdrop?: boolean; } interface CollapseConfig { nzAccordion?: boolean; nzBordered?: boolean; nzGhost?: boolean; } interface CollapsePanelConfig { nzShowArrow?: boolean; } interface DatePickerConfig { nzSeparator?: string; nzSuffixIcon?: string | TemplateRef; nzBackdrop?: boolean; } interface DescriptionsConfig { nzBordered?: boolean; nzColumn?: Partial> | number; nzSize?: 'default' | 'middle' | 'small'; nzColon?: boolean; } interface DrawerConfig { nzMask?: boolean; nzMaskClosable?: boolean; nzCloseOnNavigation?: boolean; nzDirection?: Direction; } interface DropDownConfig { nzBackdrop?: boolean; } interface EmptyConfig { nzDefaultEmptyContent?: Type | TemplateRef | string | undefined; } interface FilterTriggerConfig { nzBackdrop?: boolean; } interface FormConfig { nzNoColon?: boolean; nzAutoTips?: Record>; nzTooltipIcon?: string | { type: string; theme: ThemeType; }; } interface IconConfig { nzTheme?: 'fill' | 'outline' | 'twotone'; nzTwotoneColor?: string; } interface MessageConfig { nzAnimate?: boolean; nzDuration?: number; nzMaxStack?: number; nzPauseOnHover?: boolean; nzTop?: number | string; nzDirection?: Direction; } interface ModalConfig { nzMask?: boolean; nzMaskClosable?: boolean; nzCloseOnNavigation?: boolean; nzDirection?: Direction; } interface NotificationConfig extends MessageConfig { nzTop?: string | number; nzBottom?: string | number; nzPlacement?: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'top' | 'bottom'; } interface PageHeaderConfig { nzGhost: boolean; } interface PaginationConfig { nzSize?: 'default' | 'small'; nzPageSizeOptions?: number[]; nzShowSizeChanger?: boolean; nzShowQuickJumper?: boolean; nzSimple?: boolean; } interface ProgressConfig { nzGapDegree?: number; nzGapPosition?: 'top' | 'right' | 'bottom' | 'left'; nzShowInfo?: boolean; nzStrokeSwitch?: number; nzStrokeWidth?: number; nzSize?: 'default' | 'small'; nzStrokeLinecap?: 'round' | 'square'; nzStrokeColor?: string; } interface RateConfig { nzAllowClear?: boolean; nzAllowHalf?: boolean; } interface SegmentedConfig { nzSize?: NzSizeLDSType; } interface SpaceConfig { nzSize?: 'small' | 'middle' | 'large' | number; } interface SpinConfig { nzIndicator?: TemplateRef; } interface SwitchConfig { nzSize: NzSizeDSType; } interface TableConfig { nzBordered?: boolean; nzSize?: NzSizeMDSType; nzShowQuickJumper?: boolean; nzLoadingIndicator?: TemplateRef; nzShowSizeChanger?: boolean; nzSimple?: boolean; nzHideOnSinglePage?: boolean; /** * @see {@link NzTableSortOrder} */ nzSortDirections?: Array; } interface TabsConfig { nzAnimated?: boolean | { inkBar: boolean; tabPane: boolean; }; nzSize?: NzSizeLDSType; nzType?: 'line' | 'card'; nzTabBarGutter?: number; nzShowPagination?: boolean; } interface TimePickerConfig { nzAllowEmpty?: boolean; nzClearText?: string; nzNowText?: string; nzOkText?: string; nzFormat?: string; nzHourStep?: number; nzMinuteStep?: number; nzSecondStep?: number; nzPopupClassName?: string; nzUse12Hours?: string; nzSuffixIcon?: string | TemplateRef; nzBackdrop?: boolean; } interface TreeConfig { nzBlockNode?: boolean; nzShowIcon?: boolean; nzHideUnMatched?: boolean; } interface TreeSelectConfig { nzShowIcon?: string; nzShowLine?: boolean; nzDropdownMatchSelectWidth?: boolean; nzHideUnMatched?: boolean; nzSize?: 'large' | 'small' | 'default'; nzBackdrop?: boolean; } interface TypographyConfig { nzEllipsisRows?: number; nzCopyTooltips?: [NzTSType, NzTSType] | null; nzCopyIcons: [NzTSType, NzTSType]; nzEditTooltip?: null | NzTSType; nzEditIcon: NzTSType; } interface ImageConfig { nzFallback?: string; nzPlaceholder?: string; nzDisablePreview?: string; nzCloseOnNavigation?: boolean; nzDirection?: Direction; nzScaleStep?: number; } interface ImageExperimentalConfig { nzFallback?: string; nzPlaceholder?: string; nzDisablePreview?: string; nzCloseOnNavigation?: boolean; nzDirection?: Direction; nzAutoSrcset?: boolean; nzSrcLoader?(params: { src: string; width: number; }): string; } interface PopConfirmConfig { nzPopconfirmBackdrop?: boolean; nzAutofocus?: null | 'ok' | 'cancel'; } interface PopoverConfig { nzPopoverBackdrop?: boolean; } type NzConfigKey = keyof NzConfig; /** * User should provide an object implements this interface to set global configurations. */ declare const NZ_CONFIG: InjectionToken; declare function provideNzConfig(config: NzConfig): EnvironmentProviders; declare class NzConfigService { private configUpdated$; /** Global config holding property. */ private readonly config; private readonly cspNonce; constructor(); getConfig(): NzConfig; getConfigForComponent(componentName: T): NzConfig[T]; getConfigChangeEventForComponent(componentName: NzConfigKey): Observable; set(componentName: T, value: NzConfig[T]): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Subscribes to configuration change events for a specific NZ component after the next render cycle. * * This utility is intended for use within Angular injection contexts and handles automatic * unsubscription via `DestroyRef`. It returns a cleanup function that can be manually called * to unsubscribe early if needed. * * @param componentName - The name of the component (as defined in `NzConfigKey`) to listen for config changes. * @param callback - A function to invoke when the component's configuration changes. * @returns A cleanup function that destroys the post-render effect and unsubscribes from the config event. * * @throws If called outside of an Angular injection context (in dev mode). */ declare function onConfigChangeEventForComponent(componentName: NzConfigKey, callback: () => void): () => void; /** * This decorator is used to decorate class field. If a class field is decorated and unassigned, it would try to load default value from `NZ_CONFIG` * * @note that the class must have `_nzModuleName`({@link NzConfigKey}) property. * @example * ```ts * class ExampleComponent { * private readonly _nzModuleName: NzConfigKey = 'button'; * @WithConfig() size: string = 'default'; * } * ``` */ declare function WithConfig(): (_value: undefined, context: ClassFieldDecoratorContext) => void; /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ declare function getStyle(globalPrefixCls: string, theme: Theme): string; declare function registerTheme(globalPrefixCls: string, theme: Theme, cspNonce: string | null | undefined): void; export { NZ_CONFIG, NzConfigService, WithConfig, getStyle, onConfigChangeEventForComponent, provideNzConfig, registerTheme }; export type { AffixConfig, AlertConfig, AnchorConfig, AvatarConfig, BackTopConfig, BadgeConfig, ButtonConfig, CardConfig, CarouselConfig, CascaderConfig, CodeEditorConfig, CollapseConfig, CollapsePanelConfig, DatePickerConfig, DescriptionsConfig, DrawerConfig, DropDownConfig, EmptyConfig, FilterTriggerConfig, FormConfig, IconConfig, ImageConfig, ImageExperimentalConfig, MessageConfig, ModalConfig, NotificationConfig, NzConfig, NzConfigKey, PageHeaderConfig, PaginationConfig, PopConfirmConfig, PopoverConfig, PrefixCls, ProgressConfig, RateConfig, SegmentedConfig, SelectConfig, SpaceConfig, SpinConfig, SwitchConfig, TableConfig, TabsConfig, Theme, TimePickerConfig, TreeConfig, TreeSelectConfig, TypographyConfig };