@servicetitan/docs-anvil-uikit-contrib 28.5.1 → 29.0.1
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/docs/notifications-center.mdx +16 -14
- package/docs/table.mdx +3 -3
- package/package.json +2 -2
|
@@ -22,13 +22,13 @@ import { CodeDemo, DemoCodeBlock } from '@site/src/components/code-demo';
|
|
|
22
22
|
|
|
23
23
|
There're a lot of cases when a user should be notified in the result of various events. It could be from a simple one-time notification about the result of the network request to informing about the state of a complex long-running process launched on the worker.
|
|
24
24
|
|
|
25
|
-
Notification Center was created to simplify and generalize everything related to user notifications. It provides few touchpoints: `NotificationCenter` to send various notification types from the backend, `NotificationsService` to show messages on the frontend, and `
|
|
25
|
+
Notification Center was created to simplify and generalize everything related to user notifications. It provides few touchpoints: `NotificationCenter` to send various notification types from the backend, `NotificationsService` to show messages on the frontend, and `intercept` function to pre-process notifications received from the backend.
|
|
26
26
|
|
|
27
27
|
## Examples
|
|
28
28
|
|
|
29
29
|
### Client-side notifications
|
|
30
30
|
|
|
31
|
-
To initiate notifications from the client side it's enough to call one of the `NotificationsService` methods. They accept `options` - a configuration of the visible part of notification which should cover most of the use cases and `preventDuplicates` flag used to avoid
|
|
31
|
+
To initiate notifications from the client side it's enough to call one of the `NotificationsService` methods. They accept `options` - a configuration of the visible part of notification which should cover most of the use cases and `preventDuplicates` flag used to avoid rerendering a notification that is already visible.
|
|
32
32
|
|
|
33
33
|
#### Basic
|
|
34
34
|
|
|
@@ -146,9 +146,7 @@ export const defaultServerCode = `
|
|
|
146
146
|
|
|
147
147
|
#### Custom notification component
|
|
148
148
|
|
|
149
|
-
But if you need to show something more specific, then you can create a custom notification type and
|
|
150
|
-
|
|
151
|
-
**_It's required to register all your custom renderers in the `custom-notifications.ts` file on the module level, which should be imported in your module file._**
|
|
149
|
+
But if you need to show something more specific, then you can create a custom notification type and [intercept](#intercept) it, which should determine what would be shown to the user.
|
|
152
150
|
|
|
153
151
|
export const customServerCode = `
|
|
154
152
|
public class CustomPayload : INotificationPayload
|
|
@@ -162,7 +160,7 @@ export const customServerCode = `
|
|
|
162
160
|
"CustomServerNotification",
|
|
163
161
|
initialPayload: new CustomPayload {
|
|
164
162
|
Username = "Jane",
|
|
165
|
-
Message = "
|
|
163
|
+
Message = "Your order is completed."
|
|
166
164
|
}
|
|
167
165
|
);
|
|
168
166
|
`
|
|
@@ -303,17 +301,21 @@ interface FunctionAction {
|
|
|
303
301
|
}
|
|
304
302
|
```
|
|
305
303
|
|
|
306
|
-
###
|
|
304
|
+
### intercept
|
|
307
305
|
|
|
308
|
-
|
|
309
|
-
register(type: string, mapper: NotificationMapper): void;
|
|
306
|
+
Use `intercept` to suppress or transform a server-side notification.
|
|
310
307
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
onClose(): void;
|
|
314
|
-
}>;
|
|
308
|
+
```ts
|
|
309
|
+
intercept(type: string, fn?: NotificationInterceptor): void;
|
|
315
310
|
```
|
|
316
311
|
|
|
312
|
+
#### Parameters
|
|
313
|
+
|
|
314
|
+
| Name | Type | Description |
|
|
315
|
+
| :----- | :------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
316
|
+
| `type` | `string` | The notification to intercept. |
|
|
317
|
+
| `fn` | `(notification: Notification, dismiss: () => void) => Notification` | Function that transforms or suppresses the notification. It is passed the notification and a callback you can save and use later to dismiss the notification.<br/><br/>To transform a notification, return a new `Notification` object that replaces the original. To suppress it, return `undefined`. To stop intercepting, set this argument to `undefined`. |
|
|
318
|
+
|
|
317
319
|
## FAQ
|
|
318
320
|
|
|
319
321
|
### What is the delivery logic, what happens if user has several windows open?
|
|
@@ -326,4 +328,4 @@ Unclosed notifications will be shown again on application reopen.
|
|
|
326
328
|
|
|
327
329
|
### How will be displayed a large number of notifications?
|
|
328
330
|
|
|
329
|
-
Only
|
|
331
|
+
Only a few notifications are shown at a time. The remainder are revealed when the user closes visible ones.
|
package/docs/table.mdx
CHANGED
|
@@ -172,7 +172,7 @@ Simple example with some out of the box functionality.
|
|
|
172
172
|
|
|
173
173
|
<CodeDemo example={TableExample} srcPath="table/src/demo/overview/table.tsx" theme="light" />
|
|
174
174
|
|
|
175
|
-
_This example consists of several files, the full code can be found [here](https://github.com/servicetitan/uikit/tree/master/packages/table/src/demo/overview)._
|
|
175
|
+
_This example consists of several files, the full code can be found [here](https://github.com/servicetitan/anvil-uikit-contrib/tree/master/packages/table/src/demo/overview)._
|
|
176
176
|
|
|
177
177
|
#### Detail Row
|
|
178
178
|
|
|
@@ -184,7 +184,7 @@ Table rows can expand and show additional content related to the open row. Anoth
|
|
|
184
184
|
theme="light"
|
|
185
185
|
/>
|
|
186
186
|
|
|
187
|
-
_This example consists of several files, the full code can be found [here](https://github.com/servicetitan/uikit/tree/master/packages/table/src/demo/master-detail)._
|
|
187
|
+
_This example consists of several files, the full code can be found [here](https://github.com/servicetitan/anvil-uikit-contrib/tree/master/packages/table/src/demo/master-detail)._
|
|
188
188
|
|
|
189
189
|
#### State Caching (`TableStateModel`)
|
|
190
190
|
|
|
@@ -196,7 +196,7 @@ Table State can be exported to restore it later. In the example below, we can sw
|
|
|
196
196
|
theme="light"
|
|
197
197
|
/>
|
|
198
198
|
|
|
199
|
-
_This example consists of several files, the full code can be found [here](https://github.com/servicetitan/uikit/tree/master/packages/table/src/demo/state-caching)._
|
|
199
|
+
_This example consists of several files, the full code can be found [here](https://github.com/servicetitan/anvil-uikit-contrib/tree/master/packages/table/src/demo/state-caching)._
|
|
200
200
|
|
|
201
201
|
## Utility
|
|
202
202
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/docs-anvil-uikit-contrib",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "29.0.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,5 +16,5 @@
|
|
|
16
16
|
"cli": {
|
|
17
17
|
"webpack": false
|
|
18
18
|
},
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "ac25b40c1f12f27581223b65b296c3a8d454611d"
|
|
20
20
|
}
|