Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit791cff1

Browse files
committed
Toast Dismiss
Added the ability to allow or disallow toasts to be dismissed.
1 parent3708c30 commit791cff1

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

‎client/packages/lowcoder/src/comps/hooks/toastComp.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,19 @@ const showNotification = (
1919
consttext=params?.[0]asstring;
2020
constoptions=params?.[1]asJSONObject;
2121

22-
const{ message, duration, id, placement}=options;
22+
const{ message, duration, id, placement, dismissible}=options;
23+
24+
constcloseIcon:boolean|undefined=dismissible===true ?undefined :(dismissible===false ?false :undefined);
2325

24-
// Convert duration to a number or null, if it's not a valid number, default to null
2526
constdurationNumberOrNull:number|null=typeofduration==='number' ?duration :null;
2627

2728
constnotificationArgs:ArgsProps={
2829
message:text,
2930
description:messageasReact.ReactNode,
3031
duration:durationNumberOrNull??3,
31-
key:idasReact.Key,// Ensure id is a valid React.Key
32-
placement:placementasNotificationPlacement??"bottomRight",// Ensure placement is a valid NotificationPlacement or undefined
32+
key:idasReact.Key,
33+
placement:placementasNotificationPlacement??"bottomRight",
34+
closeIcon:closeIconasboolean,
3335
};
3436

3537
// Use notificationArgs to trigger the notification

‎docs/build-apps/write-javascript/built-in-javascript-functions.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,15 @@ The id field can be used to update previous toasts. Or used to destroy the previ
132132
Destroy function used without an id will remove all toast.
133133

134134
```javascript
135-
// toast.open( title: string, options?: { message?: string, duration?: number = 3, id?: string, placement?: "top" | "topLeft" | "topRight" | "bottom" | "bottomRight", "bottomRight" = "bottomRight" } )
135+
// toast.open( title: string, options?: { message?: string, duration?: number = 3, id?: string, placement?: "top" | "topLeft" | "topRight" | "bottom" | "bottomRight", "bottomRight" = "bottomRight", dismissible?: boolean = true } )
136136
toast.open("This Is a Notification", {message:"I do not go away automatically.", duration:0})
137-
// toast.info( title: string, options?: { message?: string, duration?: number = 3, id?: string, placement?: "top" | "topLeft" | "topRight" | "bottom" | "bottomRight", "bottomRight" = "bottomRight" } )
137+
// toast.info( title: string, options?: { message?: string, duration?: number = 3, id?: string, placement?: "top" | "topLeft" | "topRight" | "bottom" | "bottomRight", "bottomRight" = "bottomRight", dismissible?: boolean = true } )
138138
toast.info("Order #1519", {message:"Shipped out on Tuesday, Jan 3rd.", duration:5})
139-
// toast.success( title: string, options?: { message?: string, duration?: number = 3, id?: string, placement?: "top" | "topLeft" | "topRight" | "bottom" | "bottomRight", "bottomRight" = "bottomRight" } )
139+
// toast.success( title: string, options?: { message?: string, duration?: number = 3, id?: string, placement?: "top" | "topLeft" | "topRight" | "bottom" | "bottomRight", "bottomRight" = "bottomRight", dismissible?: boolean = true } )
140140
toast.success("Query runs successfully", { duration:10 })
141-
// toast.warn( title: string, options?: { message?: string, duration?: number = 3, id?: string, placement?: "top" | "topLeft" | "topRight" | "bottom" | "bottomRight", "bottomRight" = "bottomRight" } )
141+
// toast.warn( title: string, options?: { message?: string, duration?: number = 3, id?: string, placement?: "top" | "topLeft" | "topRight" | "bottom" | "bottomRight", "bottomRight" = "bottomRight", dismissible?: boolean = true } )
142142
toast.warn("Duplicate Action", {message:"The email was previously sent on Jan 3rd. Click the button again to send.", duration:5})
143-
// toast.error( title: string, options?: { message?: string, duration?: number = 3, id?: string, placement?: "top" | "topLeft" | "topRight" | "bottom" | "bottomRight", "bottomRight" = "bottomRight" } )
143+
// toast.error( title: string, options?: { message?: string, duration?: number = 3, id?: string, placement?: "top" | "topLeft" | "topRight" | "bottom" | "bottomRight", "bottomRight" = "bottomRight", dismissible?: boolean = true } )
144144
toast.error("Your credentials were invalid", {message:"You have 5 tries left", duration:5})
145145
//toast.destroy(id?: string)
146146
toast.destroy()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp