@ldkj/web-ui 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/interact/notification/Notification.d.ts +19 -4
- package/components/interact/notification/NotificationProvider.d.ts +27 -0
- package/components/interact/notification/bridge.d.ts +3 -0
- package/components/interact/notification/index.d.ts +3 -1
- package/components/interact/notification/types.d.ts +39 -0
- package/index.cjs +16 -16
- package/index.js +5523 -5153
- package/package.json +1 -1
- package/style.css +1 -1
|
@@ -1,6 +1,21 @@
|
|
|
1
|
+
import type { NotificationOffset, NotificationOptions, NotificationPlacement } from "./types";
|
|
2
|
+
export interface NotificationFacadeConfig {
|
|
3
|
+
placement?: NotificationPlacement;
|
|
4
|
+
duration?: number;
|
|
5
|
+
closable?: boolean;
|
|
6
|
+
offset?: NotificationOffset;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 全局 notification facade。请先挂载 NotificationProvider,再在任意业务模块调用。
|
|
10
|
+
*/
|
|
1
11
|
export declare const notification: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
12
|
+
open(options: NotificationOptions): string;
|
|
13
|
+
info(options: NotificationOptions | string): string;
|
|
14
|
+
success(options: NotificationOptions | string): string;
|
|
15
|
+
warn(options: NotificationOptions | string): string;
|
|
16
|
+
error(options: NotificationOptions | string): string;
|
|
17
|
+
dismiss(id: string): void;
|
|
18
|
+
clear(): void;
|
|
19
|
+
config(config: NotificationFacadeConfig): void;
|
|
20
|
+
resetConfig(): void;
|
|
6
21
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { NotificationOffset, NotificationOptions, NotificationPlacement } from "./types";
|
|
3
|
+
import "./notification.css";
|
|
4
|
+
export interface NotificationProviderProps {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
placement?: NotificationPlacement;
|
|
7
|
+
duration?: number;
|
|
8
|
+
queueLimit?: number;
|
|
9
|
+
offset?: NotificationOffset;
|
|
10
|
+
closable?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function NotificationProvider(props: NotificationProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare namespace NotificationProvider {
|
|
14
|
+
var displayName: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 获取当前 NotificationProvider 提供的通知 API。
|
|
18
|
+
*/
|
|
19
|
+
export declare function useNotification(): {
|
|
20
|
+
open: (options: NotificationOptions) => string;
|
|
21
|
+
info: (options: NotificationOptions | string) => string;
|
|
22
|
+
success: (options: NotificationOptions | string) => string;
|
|
23
|
+
warn: (options: NotificationOptions | string) => string;
|
|
24
|
+
error: (options: NotificationOptions | string) => string;
|
|
25
|
+
dismiss: (id: string) => void;
|
|
26
|
+
clear: () => void;
|
|
27
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
export type NotificationType = "info" | "success" | "warn" | "error";
|
|
3
|
+
export type NotificationPlacement = "rightTop" | "rightBottom" | "leftTop" | "leftBottom" | "center";
|
|
4
|
+
export type NotificationOffset = number | {
|
|
5
|
+
top?: number;
|
|
6
|
+
right?: number;
|
|
7
|
+
bottom?: number;
|
|
8
|
+
left?: number;
|
|
9
|
+
};
|
|
10
|
+
export type NotificationCustomSvg = React.ComponentType<React.SVGProps<SVGSVGElement> & {
|
|
11
|
+
title?: string;
|
|
12
|
+
}>;
|
|
13
|
+
export type NotificationIconOption = string | {
|
|
14
|
+
svg?: NotificationCustomSvg;
|
|
15
|
+
src?: string;
|
|
16
|
+
};
|
|
17
|
+
export interface NotificationOptions {
|
|
18
|
+
id?: string;
|
|
19
|
+
message: React.ReactNode;
|
|
20
|
+
description?: React.ReactNode;
|
|
21
|
+
content?: React.ReactNode;
|
|
22
|
+
actions?: React.ReactNode;
|
|
23
|
+
duration?: number;
|
|
24
|
+
placement?: NotificationPlacement;
|
|
25
|
+
offset?: NotificationOffset;
|
|
26
|
+
closable?: boolean;
|
|
27
|
+
icon?: NotificationIconOption;
|
|
28
|
+
iconColor?: string;
|
|
29
|
+
onClose?: () => void;
|
|
30
|
+
}
|
|
31
|
+
export interface NotificationCreateInput extends NotificationOptions {
|
|
32
|
+
type?: NotificationType;
|
|
33
|
+
}
|
|
34
|
+
export type NotificationShortcutInput = string | NotificationOptions;
|
|
35
|
+
export interface NotificationContextValue {
|
|
36
|
+
push: (input: NotificationCreateInput) => string;
|
|
37
|
+
dismiss: (id: string) => void;
|
|
38
|
+
clear: () => void;
|
|
39
|
+
}
|