sample-piral 0.15.0-beta.4633 → 0.15.0-beta.4670
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/app/index.d.ts +969 -967
- package/app/{index.e41fbd.js → index.e44fc2.js} +140 -31
- package/app/index.e44fc2.js.map +1 -0
- package/app/index.html +1 -1
- package/app/index.js +1 -1
- package/files.tar +0 -0
- package/files_once.tar +0 -0
- package/package.json +8 -8
- package/app/index.e41fbd.js.map +0 -1
package/app/index.d.ts
CHANGED
|
@@ -1,981 +1,983 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as ReactRouter from 'react-router';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Defines the API accessible from pilets.
|
|
6
|
+
*/
|
|
7
|
+
export interface PiletApi extends EventEmitter, PiletCustomApi, PiletCoreApi {
|
|
8
|
+
/**
|
|
9
|
+
* Gets the metadata of the current pilet.
|
|
10
|
+
*/
|
|
11
|
+
meta: PiletMetadata;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The emitter for Piral app shell events.
|
|
16
|
+
*/
|
|
17
|
+
export interface EventEmitter {
|
|
18
|
+
/**
|
|
19
|
+
* Attaches a new event listener.
|
|
20
|
+
* @param type The type of the event to listen for.
|
|
21
|
+
* @param callback The callback to trigger.
|
|
22
|
+
*/
|
|
23
|
+
on<K extends keyof PiralEventMap>(type: K, callback: Listener<PiralEventMap[K]>): EventEmitter;
|
|
24
|
+
/**
|
|
25
|
+
* Detaches an existing event listener.
|
|
26
|
+
* @param type The type of the event to listen for.
|
|
27
|
+
* @param callback The callback to trigger.
|
|
28
|
+
*/
|
|
29
|
+
off<K extends keyof PiralEventMap>(type: K, callback: Listener<PiralEventMap[K]>): EventEmitter;
|
|
30
|
+
/**
|
|
31
|
+
* Emits a new event with the given type.
|
|
32
|
+
* @param type The type of the event to emit.
|
|
33
|
+
* @param arg The payload of the event.
|
|
34
|
+
*/
|
|
35
|
+
emit<K extends keyof PiralEventMap>(type: K, arg: PiralEventMap[K]): EventEmitter;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Custom Pilet API parts defined outside of piral-core.
|
|
40
|
+
*/
|
|
41
|
+
export interface PiletCustomApi extends PiletLocaleApi, PiletDashboardApi, PiletMenuApi, PiletNotificationsApi, PiletModalsApi, PiletFeedsApi, PiletSearchApi, PiletAuthApi {}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Defines the Pilet API from piral-core.
|
|
45
|
+
* This interface will be consumed by pilet developers so that their pilet can interact with the piral instance.
|
|
46
|
+
*/
|
|
47
|
+
export interface PiletCoreApi {
|
|
48
|
+
/**
|
|
49
|
+
* Gets a shared data value.
|
|
50
|
+
* @param name The name of the data to retrieve.
|
|
51
|
+
*/
|
|
52
|
+
getData<TKey extends string>(name: TKey): SharedData[TKey];
|
|
53
|
+
/**
|
|
54
|
+
* Sets the data using a given name. The name needs to be used exclusively by the current pilet.
|
|
55
|
+
* Using the name occupied by another pilet will result in no change.
|
|
56
|
+
* @param name The name of the data to store.
|
|
57
|
+
* @param value The value of the data to store.
|
|
58
|
+
* @param options The optional configuration for storing this piece of data.
|
|
59
|
+
* @returns True if the data could be set, otherwise false.
|
|
60
|
+
*/
|
|
61
|
+
setData<TKey extends string>(name: TKey, value: SharedData[TKey], options?: DataStoreOptions): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Registers a route for predefined page component.
|
|
64
|
+
* The route needs to be unique and can contain params.
|
|
65
|
+
* Params are following the path-to-regexp notation, e.g., :id for an id parameter.
|
|
66
|
+
* @param route The route to register.
|
|
67
|
+
* @param Component The component to render the page.
|
|
68
|
+
* @param meta The optional metadata to use.
|
|
69
|
+
*/
|
|
70
|
+
registerPage(route: string, Component: AnyComponent<PageComponentProps>, meta?: PiralPageMeta): RegistrationDisposer;
|
|
71
|
+
/**
|
|
72
|
+
* Unregisters the page identified by the given route.
|
|
73
|
+
* @param route The route that was previously registered.
|
|
74
|
+
*/
|
|
75
|
+
unregisterPage(route: string): void;
|
|
76
|
+
/**
|
|
77
|
+
* Registers an extension component with a predefined extension component.
|
|
78
|
+
* The name must refer to the extension slot.
|
|
79
|
+
* @param name The global name of the extension slot.
|
|
80
|
+
* @param Component The component to be rendered.
|
|
81
|
+
* @param defaults Optionally, sets the default values for the expected data.
|
|
82
|
+
*/
|
|
83
|
+
registerExtension<TName>(name: TName extends string ? TName : string, Component: AnyExtensionComponent<TName>, defaults?: Partial<ExtensionParams<TName>>): RegistrationDisposer;
|
|
84
|
+
/**
|
|
85
|
+
* Unregisters a global extension component.
|
|
86
|
+
* Only previously registered extension components can be unregistered.
|
|
87
|
+
* @param name The name of the extension slot to unregister from.
|
|
88
|
+
* @param Component The registered extension component to unregister.
|
|
89
|
+
*/
|
|
90
|
+
unregisterExtension<TName>(name: TName extends string ? TName : string, Component: AnyExtensionComponent<TName>): void;
|
|
91
|
+
/**
|
|
92
|
+
* React component for displaying extensions for a given name.
|
|
93
|
+
* @param props The extension's rendering props.
|
|
94
|
+
* @return The created React element.
|
|
95
|
+
*/
|
|
96
|
+
Extension<TName>(props: ExtensionSlotProps<TName>): React.ReactElement | null;
|
|
97
|
+
/**
|
|
98
|
+
* Renders an extension in a plain DOM component.
|
|
99
|
+
* @param element The DOM element or shadow root as a container for rendering the extension.
|
|
100
|
+
* @param props The extension's rendering props.
|
|
101
|
+
* @return The disposer to clear the extension.
|
|
102
|
+
*/
|
|
103
|
+
renderHtmlExtension<TName>(element: HTMLElement | ShadowRoot, props: ExtensionSlotProps<TName>): Disposable;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Describes the metadata of a pilet available in its API.
|
|
108
|
+
*/
|
|
109
|
+
export interface PiletMetadata {
|
|
110
|
+
/**
|
|
111
|
+
* The name of the pilet, i.e., the package id.
|
|
112
|
+
*/
|
|
113
|
+
name: string;
|
|
114
|
+
/**
|
|
115
|
+
* The version of the pilet. Should be semantically versioned.
|
|
116
|
+
*/
|
|
117
|
+
version: string;
|
|
118
|
+
/**
|
|
119
|
+
* Provides the version of the specification for this pilet.
|
|
120
|
+
*/
|
|
121
|
+
spec: string;
|
|
122
|
+
/**
|
|
123
|
+
* Provides some custom metadata for the pilet.
|
|
124
|
+
*/
|
|
125
|
+
custom?: any;
|
|
126
|
+
/**
|
|
127
|
+
* Optionally indicates the global require reference, if any.
|
|
128
|
+
*/
|
|
129
|
+
requireRef?: string;
|
|
130
|
+
/**
|
|
131
|
+
* Additional shared dependencies from the pilet.
|
|
132
|
+
*/
|
|
133
|
+
dependencies: Record<string, string>;
|
|
134
|
+
/**
|
|
135
|
+
* Provides some configuration to be used in the pilet.
|
|
136
|
+
*/
|
|
137
|
+
config: Record<string, any>;
|
|
138
|
+
/**
|
|
139
|
+
* The URL of the main script of the pilet.
|
|
140
|
+
*/
|
|
141
|
+
link: string;
|
|
142
|
+
/**
|
|
143
|
+
* The base path to the pilet. Can be used to make resource requests
|
|
144
|
+
* and override the public path.
|
|
145
|
+
*/
|
|
146
|
+
basePath: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Listener for Piral app shell events.
|
|
151
|
+
*/
|
|
152
|
+
export interface Listener<T> {
|
|
153
|
+
(arg: T): void;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* The map of known Piral app shell events.
|
|
158
|
+
*/
|
|
159
|
+
export interface PiralEventMap extends PiralCustomEventMap {
|
|
160
|
+
"unload-pilet": PiralUnloadPiletEvent;
|
|
161
|
+
[custom: string]: any;
|
|
162
|
+
"store-data": PiralStoreDataEvent;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface PiletLocaleApi {
|
|
166
|
+
/**
|
|
167
|
+
* Gets the currently selected language directly.
|
|
168
|
+
*/
|
|
169
|
+
getCurrentLanguage(): string;
|
|
170
|
+
/**
|
|
171
|
+
* Gets the currently selected language in a callback that is also invoked when the
|
|
172
|
+
* selected language changes. Returns a disposable to stop the notifications.
|
|
173
|
+
*/
|
|
174
|
+
getCurrentLanguage(cb: (currently: string) => void): Disposable;
|
|
175
|
+
/**
|
|
176
|
+
* Translates the given tag (using the optional variables) into a string using the current language.
|
|
177
|
+
* The used template can contain placeholders in form of `{{variableName}}`.
|
|
178
|
+
* @param tag The tag to translate.
|
|
179
|
+
* @param variables The optional variables to fill into the temnplate.
|
|
180
|
+
*/
|
|
181
|
+
translate<T = Record<string, string>>(tag: string, variables?: T): string;
|
|
182
|
+
/**
|
|
183
|
+
* Provides translations to the application.
|
|
184
|
+
* The translations will be exclusively used for retrieving translations for the pilet.
|
|
185
|
+
* @param messages The messages to use as translation basis.
|
|
186
|
+
*/
|
|
187
|
+
setTranslations(messages: LocalizationMessages): void;
|
|
188
|
+
/**
|
|
189
|
+
* Gets the currently provided translations by the pilet.
|
|
190
|
+
*/
|
|
191
|
+
getTranslations(): LocalizationMessages;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface PiletDashboardApi {
|
|
195
|
+
/**
|
|
196
|
+
* Registers a tile with a predefined tile components.
|
|
197
|
+
* The name has to be unique within the current pilet.
|
|
198
|
+
* @param name The name of the tile.
|
|
199
|
+
* @param Component The component to be rendered within the Dashboard.
|
|
200
|
+
* @param preferences The optional preferences to be supplied to the Dashboard for the tile.
|
|
201
|
+
*/
|
|
202
|
+
registerTile(name: string, Component: AnyComponent<TileComponentProps>, preferences?: TilePreferences): RegistrationDisposer;
|
|
203
|
+
/**
|
|
204
|
+
* Registers a tile for predefined tile components.
|
|
205
|
+
* @param Component The component to be rendered within the Dashboard.
|
|
206
|
+
* @param preferences The optional preferences to be supplied to the Dashboard for the tile.
|
|
207
|
+
*/
|
|
208
|
+
registerTile(Component: AnyComponent<TileComponentProps>, preferences?: TilePreferences): RegistrationDisposer;
|
|
209
|
+
/**
|
|
210
|
+
* Unregisters a tile known by the given name.
|
|
211
|
+
* Only previously registered tiles can be unregistered.
|
|
212
|
+
* @param name The name of the tile to unregister.
|
|
213
|
+
*/
|
|
214
|
+
unregisterTile(name: string): void;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface PiletMenuApi {
|
|
218
|
+
/**
|
|
219
|
+
* Registers a menu item for a predefined menu component.
|
|
220
|
+
* The name has to be unique within the current pilet.
|
|
221
|
+
* @param name The name of the menu item.
|
|
222
|
+
* @param Component The component to be rendered within the menu.
|
|
223
|
+
* @param settings The optional configuration for the menu item.
|
|
224
|
+
*/
|
|
225
|
+
registerMenu(name: string, Component: AnyComponent<MenuComponentProps>, settings?: MenuSettings): RegistrationDisposer;
|
|
226
|
+
/**
|
|
227
|
+
* Registers a menu item for a predefined menu component.
|
|
228
|
+
* @param Component The component to be rendered within the menu.
|
|
229
|
+
* @param settings The optional configuration for the menu item.
|
|
230
|
+
*/
|
|
231
|
+
registerMenu(Component: AnyComponent<MenuComponentProps>, settings?: MenuSettings): RegistrationDisposer;
|
|
232
|
+
/**
|
|
233
|
+
* Unregisters a menu item known by the given name.
|
|
234
|
+
* Only previously registered menu items can be unregistered.
|
|
235
|
+
* @param name The name of the menu item to unregister.
|
|
236
|
+
*/
|
|
237
|
+
unregisterMenu(name: string): void;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export interface PiletNotificationsApi {
|
|
241
|
+
/**
|
|
242
|
+
* Shows a notification in the determined spot using the provided content.
|
|
243
|
+
* @param content The content to display. Normally, a string would be sufficient.
|
|
244
|
+
* @param options The options to consider for showing the notification.
|
|
245
|
+
* @returns A callback to trigger closing the notification.
|
|
246
|
+
*/
|
|
247
|
+
showNotification(content: string | React.ReactElement<any, any> | AnyComponent<NotificationComponentProps>, options?: NotificationOptions): Disposable;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export interface PiletModalsApi {
|
|
251
|
+
/**
|
|
252
|
+
* Shows a modal dialog with the given name.
|
|
253
|
+
* The modal can be optionally programmatically closed using the returned callback.
|
|
254
|
+
* @param name The name of the registered modal.
|
|
255
|
+
* @param options Optional arguments for creating the modal.
|
|
256
|
+
* @returns A callback to trigger closing the modal.
|
|
257
|
+
*/
|
|
258
|
+
showModal<T>(name: T extends string ? T : string, options?: ModalOptions<T>): Disposable;
|
|
259
|
+
/**
|
|
260
|
+
* Registers a modal dialog using a React component.
|
|
261
|
+
* The name needs to be unique to be used without the pilet's name.
|
|
262
|
+
* @param name The name of the modal to register.
|
|
263
|
+
* @param Component The component to render the page.
|
|
264
|
+
* @param defaults Optionally, sets the default values for the inserted options.
|
|
265
|
+
* @param layout Optionally, sets the layout options for the dialog wrapper.
|
|
266
|
+
*/
|
|
267
|
+
registerModal<T>(name: T extends string ? T : string, Component: AnyComponent<ModalComponentProps<T>>, defaults?: ModalOptions<T>, layout?: ModalLayoutOptions): RegistrationDisposer;
|
|
268
|
+
/**
|
|
269
|
+
* Unregisters a modal by its name.
|
|
270
|
+
* @param name The name that was previously registered.
|
|
271
|
+
*/
|
|
272
|
+
unregisterModal<T>(name: T extends string ? T : string): void;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export interface PiletFeedsApi {
|
|
276
|
+
/**
|
|
277
|
+
* Creates a connector for wrapping components with data relations.
|
|
278
|
+
* @param resolver The resolver for the initial data set.
|
|
279
|
+
*/
|
|
280
|
+
createConnector<T>(resolver: FeedResolver<T>): FeedConnector<T>;
|
|
281
|
+
/**
|
|
282
|
+
* Creates a connector for wrapping components with data relations.
|
|
283
|
+
* @param options The options for creating the connector.
|
|
284
|
+
*/
|
|
285
|
+
createConnector<TData, TItem, TReducers extends FeedConnectorReducers<TData>>(options: FeedConnectorOptions<TData, TItem, TReducers>): FeedConnector<TData, TReducers>;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export interface PiletSearchApi {
|
|
289
|
+
/**
|
|
290
|
+
* Registers a search provider to respond to search queries.
|
|
291
|
+
* The name has to be unique within the current pilet.
|
|
292
|
+
* @param name The name of the search provider.
|
|
293
|
+
* @param provider The callback to be used for searching.
|
|
294
|
+
* @param settings The optional settings for the search provider.
|
|
295
|
+
*/
|
|
296
|
+
registerSearchProvider(name: string, provider: SearchProvider, settings?: SearchSettings): RegistrationDisposer;
|
|
297
|
+
/**
|
|
298
|
+
* Registers a search provider to respond to search queries.
|
|
299
|
+
* @param provider The callback to be used for searching.
|
|
300
|
+
* @param settings The optional settings for the search provider.
|
|
301
|
+
*/
|
|
302
|
+
registerSearchProvider(provider: SearchProvider, settings?: SearchSettings): RegistrationDisposer;
|
|
303
|
+
/**
|
|
304
|
+
* Unregisters a search provider known by the given name.
|
|
305
|
+
* Only previously registered search providers can be unregistered.
|
|
306
|
+
* @param name The name of the search provider to unregister.
|
|
307
|
+
*/
|
|
308
|
+
unregisterSearchProvider(name: string): void;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export interface PiletAuthApi {
|
|
312
|
+
/**
|
|
313
|
+
* Gets the currently authenticated user, if any.
|
|
314
|
+
*/
|
|
315
|
+
getUser(): UserInfo | undefined;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Defines the shape of the data store for storing shared data.
|
|
320
|
+
*/
|
|
321
|
+
export interface SharedData<TValue = any> {
|
|
322
|
+
[key: string]: TValue;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Defines the options to be used for storing data.
|
|
327
|
+
*/
|
|
328
|
+
export type DataStoreOptions = DataStoreTarget | CustomDataStoreOptions;
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Possible shapes for a component.
|
|
332
|
+
*/
|
|
333
|
+
export type AnyComponent<T> = React.ComponentType<T> | FirstParametersOf<ComponentConverters<T>>;
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* The props used by a page component.
|
|
337
|
+
*/
|
|
338
|
+
export interface PageComponentProps<T = any, S = any> extends RouteBaseProps<T, S> {
|
|
339
|
+
/**
|
|
340
|
+
* The meta data registered with the page.
|
|
341
|
+
*/
|
|
342
|
+
meta: PiralPageMeta;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* The meta data registered for a page.
|
|
347
|
+
*/
|
|
348
|
+
export interface PiralPageMeta extends PiralCustomPageMeta, PiralCustomPageMeta {}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* The shape of an implicit unregister function.
|
|
352
|
+
*/
|
|
353
|
+
export interface RegistrationDisposer {
|
|
354
|
+
(): void;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Shorthand for the definition of an extension component.
|
|
359
|
+
*/
|
|
360
|
+
export type AnyExtensionComponent<TName> = TName extends keyof PiralExtensionSlotMap ? AnyComponent<ExtensionComponentProps<TName>> : TName extends string ? AnyComponent<ExtensionComponentProps<any>> : AnyComponent<ExtensionComponentProps<TName>>;
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Gives the extension params shape for the given extension slot name.
|
|
364
|
+
*/
|
|
365
|
+
export type ExtensionParams<TName> = TName extends keyof PiralExtensionSlotMap ? PiralExtensionSlotMap[TName] : TName extends string ? any : TName;
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* The props for defining an extension slot.
|
|
369
|
+
*/
|
|
370
|
+
export type ExtensionSlotProps<TName = string> = BaseExtensionSlotProps<TName extends string ? TName : string, ExtensionParams<TName>>;
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Can be implemented by functions to be used for disposal purposes.
|
|
374
|
+
*/
|
|
375
|
+
export interface Disposable {
|
|
376
|
+
(): void;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Custom events defined outside of piral-core.
|
|
381
|
+
*/
|
|
382
|
+
export interface PiralCustomEventMap {
|
|
383
|
+
"select-language": PiralSelectLanguageEvent;
|
|
384
|
+
"change-user": PiralChangeUserEvent;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Gets fired when a pilet gets unloaded.
|
|
389
|
+
*/
|
|
390
|
+
export interface PiralUnloadPiletEvent {
|
|
391
|
+
/**
|
|
392
|
+
* The name of the pilet to be unloaded.
|
|
393
|
+
*/
|
|
394
|
+
name: string;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Gets fired when a data item gets stored in piral.
|
|
399
|
+
*/
|
|
400
|
+
export interface PiralStoreDataEvent<TValue = any> {
|
|
401
|
+
/**
|
|
402
|
+
* The name of the item that was stored.
|
|
403
|
+
*/
|
|
404
|
+
name: string;
|
|
405
|
+
/**
|
|
406
|
+
* The storage target of the item.
|
|
407
|
+
*/
|
|
408
|
+
target: string;
|
|
409
|
+
/**
|
|
410
|
+
* The value that was stored.
|
|
411
|
+
*/
|
|
412
|
+
value: TValue;
|
|
413
|
+
/**
|
|
414
|
+
* The owner of the item.
|
|
415
|
+
*/
|
|
416
|
+
owner: string;
|
|
417
|
+
/**
|
|
418
|
+
* The expiration of the item.
|
|
419
|
+
*/
|
|
420
|
+
expires: number;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
export interface LocalizationMessages {
|
|
424
|
+
[lang: string]: Translations;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
export type TileComponentProps = BaseComponentProps & BareTileComponentProps;
|
|
428
|
+
|
|
429
|
+
export interface TilePreferences extends PiralCustomTilePreferences {
|
|
430
|
+
/**
|
|
431
|
+
* Sets the desired initial number of columns.
|
|
432
|
+
* This may be overridden either by the user (if resizable true), or by the dashboard.
|
|
433
|
+
*/
|
|
434
|
+
initialColumns?: number;
|
|
435
|
+
/**
|
|
436
|
+
* Sets the desired initial number of rows.
|
|
437
|
+
* This may be overridden either by the user (if resizable true), or by the dashboard.
|
|
438
|
+
*/
|
|
439
|
+
initialRows?: number;
|
|
440
|
+
/**
|
|
441
|
+
* Determines if the tile can be resized by the user.
|
|
442
|
+
* By default the size of the tile is fixed.
|
|
443
|
+
*/
|
|
444
|
+
resizable?: boolean;
|
|
445
|
+
/**
|
|
446
|
+
* Declares a set of custom properties to be used with user-specified values.
|
|
447
|
+
*/
|
|
448
|
+
customProperties?: Array<string>;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
export interface MenuComponentProps extends BaseComponentProps {}
|
|
452
|
+
|
|
453
|
+
export interface MenuSettings extends PiralCustomMenuSettings {
|
|
454
|
+
/**
|
|
455
|
+
* Sets the type of the menu to attach to.
|
|
456
|
+
* @default "general"
|
|
457
|
+
*/
|
|
458
|
+
type?: MenuType;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
export type NotificationComponentProps = BaseComponentProps & BareNotificationProps;
|
|
462
|
+
|
|
463
|
+
export interface NotificationOptions extends PiralCustomNotificationOptions {
|
|
464
|
+
/**
|
|
465
|
+
* The title of the notification, if any.
|
|
466
|
+
*/
|
|
467
|
+
title?: string;
|
|
468
|
+
/**
|
|
469
|
+
* Determines when the notification should automatically close in milliseconds.
|
|
470
|
+
* A value of 0 or undefined forces the user to close the notification.
|
|
471
|
+
*/
|
|
472
|
+
autoClose?: number;
|
|
473
|
+
/**
|
|
474
|
+
* The type of the notification used when displaying the message.
|
|
475
|
+
* By default info is used.
|
|
476
|
+
*/
|
|
477
|
+
type?: "info" | "success" | "warning" | "error";
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
export type ModalOptions<T> = T extends keyof PiralModalsMap ? PiralModalsMap[T] & BaseModalOptions : T extends string ? BaseModalOptions : T;
|
|
481
|
+
|
|
482
|
+
export type ModalComponentProps<T> = BaseComponentProps & BareModalComponentProps<ModalOptions<T>>;
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* The options provided for the dialog layout.
|
|
486
|
+
*/
|
|
487
|
+
export interface ModalLayoutOptions {}
|
|
488
|
+
|
|
489
|
+
export interface FeedResolver<TData> {
|
|
490
|
+
(): Promise<TData>;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
export type FeedConnector<TData, TReducers = {}> = GetActions<TReducers> & {
|
|
494
|
+
<TProps>(component: React.ComponentType<TProps & FeedConnectorProps<TData>>): React.FC<TProps>;
|
|
495
|
+
/**
|
|
496
|
+
* Invalidates the underlying feed connector.
|
|
497
|
+
* Forces a reload on next use.
|
|
498
|
+
*/
|
|
499
|
+
invalidate(): void;
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
export interface FeedConnectorOptions<TData, TItem, TReducers extends FeedConnectorReducers<TData> = {}> {
|
|
503
|
+
/**
|
|
504
|
+
* Function to derive the initial set of data.
|
|
505
|
+
* @returns The promise for retrieving the initial data set.
|
|
506
|
+
*/
|
|
507
|
+
initialize: FeedResolver<TData>;
|
|
508
|
+
/**
|
|
509
|
+
* Function to be called for connecting to a live data feed.
|
|
510
|
+
* @param callback The function to call when an item updated.
|
|
511
|
+
* @returns A callback for disconnecting from the feed.
|
|
512
|
+
*/
|
|
513
|
+
connect?: FeedSubscriber<TItem>;
|
|
514
|
+
/**
|
|
515
|
+
* Function to be called when some data updated.
|
|
516
|
+
* @param data The current set of data.
|
|
517
|
+
* @param item The updated item to include.
|
|
518
|
+
* @returns The promise for retrieving the updated data set or the updated data set.
|
|
519
|
+
*/
|
|
520
|
+
update?: FeedReducer<TData, TItem>;
|
|
521
|
+
/**
|
|
522
|
+
* Defines the optional reducers for modifying the data state.
|
|
523
|
+
*/
|
|
524
|
+
reducers?: TReducers;
|
|
525
|
+
/**
|
|
526
|
+
* Optional flag to avoid lazy loading and initialize the data directly.
|
|
527
|
+
*/
|
|
528
|
+
immediately?: boolean;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
export interface FeedConnectorReducers<TData> {
|
|
532
|
+
[name: string]: (data: TData, ...args: any) => Promise<TData> | TData;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
export interface SearchProvider {
|
|
536
|
+
(options: SearchOptions, api: PiletApi): Promise<SearchResultType | Array<SearchResultType>>;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
export interface SearchSettings {
|
|
540
|
+
/**
|
|
541
|
+
* Only invoke the search provider if its an immediate search.
|
|
542
|
+
*/
|
|
543
|
+
onlyImmediate?: boolean;
|
|
544
|
+
/**
|
|
545
|
+
* Callback to be fired when the search is cleared.
|
|
546
|
+
*/
|
|
547
|
+
onClear?(): void;
|
|
548
|
+
/**
|
|
549
|
+
* Callback to be fired when an existing search is cancelled.
|
|
550
|
+
*/
|
|
551
|
+
onCancel?(): void;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
export interface UserInfo {
|
|
555
|
+
id: string;
|
|
556
|
+
firstName: string;
|
|
557
|
+
lastName: string;
|
|
558
|
+
mail: string;
|
|
559
|
+
language: string;
|
|
560
|
+
permissions: UserPermissions;
|
|
561
|
+
features: UserFeatures;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Defines the potential targets when storing data.
|
|
566
|
+
*/
|
|
567
|
+
export type DataStoreTarget = "memory" | "local" | "remote";
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Defines the custom options for storing data.
|
|
571
|
+
*/
|
|
572
|
+
export interface CustomDataStoreOptions {
|
|
573
|
+
/**
|
|
574
|
+
* The target data store. By default the data is only stored in memory.
|
|
575
|
+
*/
|
|
576
|
+
target?: DataStoreTarget;
|
|
577
|
+
/**
|
|
578
|
+
* Optionally determines when the data expires.
|
|
579
|
+
*/
|
|
580
|
+
expires?: "never" | Date | number;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
export type FirstParametersOf<T> = {
|
|
584
|
+
[K in keyof T]: T[K] extends (arg: any) => any ? FirstParameter<T[K]> : never;
|
|
585
|
+
}[keyof T];
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Mapping of available component converters.
|
|
589
|
+
*/
|
|
590
|
+
export interface ComponentConverters<TProps> extends PiralCustomComponentConverters<TProps> {
|
|
591
|
+
/**
|
|
592
|
+
* Converts the HTML component to a framework-independent component.
|
|
593
|
+
* @param component The vanilla JavaScript component to be converted.
|
|
594
|
+
*/
|
|
595
|
+
html(component: HtmlComponent<TProps>): ForeignComponent<TProps>;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* The props that every registered page component obtains.
|
|
600
|
+
*/
|
|
601
|
+
export interface RouteBaseProps<UrlParams = any, UrlState = any> extends ReactRouter.RouteComponentProps<UrlParams, {}, UrlState>, BaseComponentProps {}
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Custom meta data to include for pages.
|
|
605
|
+
*/
|
|
606
|
+
export interface PiralCustomPageMeta {}
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* The props of an extension component.
|
|
610
|
+
*/
|
|
611
|
+
export interface ExtensionComponentProps<T> extends BaseComponentProps {
|
|
612
|
+
/**
|
|
613
|
+
* The provided parameters for showing the extension.
|
|
614
|
+
*/
|
|
615
|
+
params: T extends keyof PiralExtensionSlotMap ? PiralExtensionSlotMap[T] : T extends string ? any : T;
|
|
616
|
+
/**
|
|
617
|
+
* The optional children to receive, if any.
|
|
618
|
+
*/
|
|
619
|
+
children?: React.ReactNode;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* The mapping of the existing (known) extension slots.
|
|
624
|
+
*/
|
|
625
|
+
export interface PiralExtensionSlotMap extends PiralCustomExtensionSlotMap {}
|
|
626
|
+
|
|
627
|
+
/**
|
|
628
|
+
* The basic props for defining an extension slot.
|
|
629
|
+
*/
|
|
630
|
+
export interface BaseExtensionSlotProps<TName, TParams> {
|
|
631
|
+
/**
|
|
632
|
+
* The children to transport, if any.
|
|
633
|
+
*/
|
|
634
|
+
children?: React.ReactNode;
|
|
635
|
+
/**
|
|
636
|
+
* Defines what should be rendered when no components are available
|
|
637
|
+
* for the specified extension.
|
|
638
|
+
*/
|
|
639
|
+
empty?(): React.ReactNode;
|
|
640
|
+
/**
|
|
641
|
+
* Determines if the `render` function should be called in case no
|
|
642
|
+
* components are available for the specified extension.
|
|
643
|
+
*
|
|
644
|
+
* If true, `empty` will be called and returned from the slot.
|
|
645
|
+
* If false, `render` will be called with the result of calling `empty`.
|
|
646
|
+
* The result of calling `render` will then be returned from the slot.
|
|
647
|
+
*/
|
|
648
|
+
emptySkipsRender?: boolean;
|
|
649
|
+
/**
|
|
650
|
+
* Defines the order of the components to render.
|
|
651
|
+
* May be more convient than using `render` w.r.t. ordering extensions
|
|
652
|
+
* by their supplied metadata.
|
|
653
|
+
* @param extensions The registered extensions.
|
|
654
|
+
* @returns The ordered extensions.
|
|
655
|
+
*/
|
|
656
|
+
order?(extensions: Array<ExtensionRegistration>): Array<ExtensionRegistration>;
|
|
657
|
+
/**
|
|
658
|
+
* Defines how the provided nodes should be rendered.
|
|
659
|
+
* @param nodes The rendered extension nodes.
|
|
660
|
+
* @returns The rendered nodes, i.e., an ReactElement.
|
|
382
661
|
*/
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
662
|
+
render?(nodes: Array<React.ReactNode>): React.ReactElement<any, any> | null;
|
|
663
|
+
/**
|
|
664
|
+
* The custom parameters for the given extension.
|
|
665
|
+
*/
|
|
666
|
+
params?: TParams;
|
|
667
|
+
/**
|
|
668
|
+
* The name of the extension to render.
|
|
669
|
+
*/
|
|
670
|
+
name: TName;
|
|
671
|
+
}
|
|
387
672
|
|
|
673
|
+
export interface PiralSelectLanguageEvent {
|
|
674
|
+
/**
|
|
675
|
+
* Gets the previously selected language.
|
|
676
|
+
*/
|
|
677
|
+
previousLanguage: string;
|
|
388
678
|
/**
|
|
389
|
-
* Gets
|
|
679
|
+
* Gets the currently selected language.
|
|
390
680
|
*/
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
681
|
+
currentLanguage: string;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
export interface PiralChangeUserEvent {
|
|
685
|
+
previous: UserInfo;
|
|
686
|
+
current: UserInfo;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
export interface Translations {
|
|
690
|
+
[tag: string]: string;
|
|
691
|
+
}
|
|
397
692
|
|
|
693
|
+
/**
|
|
694
|
+
* The props that every registered component obtains.
|
|
695
|
+
*/
|
|
696
|
+
export interface BaseComponentProps {
|
|
697
|
+
/**
|
|
698
|
+
* The currently used pilet API.
|
|
699
|
+
*/
|
|
700
|
+
piral: PiletApi;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
export interface BareTileComponentProps {
|
|
704
|
+
/**
|
|
705
|
+
* The currently used number of columns.
|
|
706
|
+
*/
|
|
707
|
+
columns: number;
|
|
708
|
+
/**
|
|
709
|
+
* The currently used number of rows.
|
|
710
|
+
*/
|
|
711
|
+
rows: number;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
export interface PiralCustomTilePreferences {}
|
|
715
|
+
|
|
716
|
+
export interface PiralCustomMenuSettings {}
|
|
717
|
+
|
|
718
|
+
export type MenuType = StandardMenuType | keyof PiralCustomMenuTypes;
|
|
719
|
+
|
|
720
|
+
export interface BareNotificationProps {
|
|
721
|
+
/**
|
|
722
|
+
* Callback for closing the notification programmatically.
|
|
723
|
+
*/
|
|
724
|
+
onClose(): void;
|
|
725
|
+
/**
|
|
726
|
+
* Provides the passed in options for this particular notification.
|
|
727
|
+
*/
|
|
728
|
+
options: NotificationOptions;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
export interface PiralCustomNotificationOptions {}
|
|
732
|
+
|
|
733
|
+
export interface BaseModalOptions {}
|
|
734
|
+
|
|
735
|
+
export interface PiralModalsMap extends PiralCustomModalsMap {}
|
|
736
|
+
|
|
737
|
+
export interface BareModalComponentProps<TOpts> {
|
|
738
|
+
/**
|
|
739
|
+
* Callback for closing the modal programmatically.
|
|
740
|
+
*/
|
|
741
|
+
onClose(): void;
|
|
398
742
|
/**
|
|
399
|
-
*
|
|
743
|
+
* Provides the passed in options for this particular modal.
|
|
400
744
|
*/
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
* The name of the item that was stored.
|
|
404
|
-
*/
|
|
405
|
-
name: string;
|
|
406
|
-
/**
|
|
407
|
-
* The storage target of the item.
|
|
408
|
-
*/
|
|
409
|
-
target: string;
|
|
410
|
-
/**
|
|
411
|
-
* The value that was stored.
|
|
412
|
-
*/
|
|
413
|
-
value: TValue;
|
|
414
|
-
/**
|
|
415
|
-
* The owner of the item.
|
|
416
|
-
*/
|
|
417
|
-
owner: string;
|
|
418
|
-
/**
|
|
419
|
-
* The expiration of the item.
|
|
420
|
-
*/
|
|
421
|
-
expires: number;
|
|
422
|
-
}
|
|
745
|
+
options?: TOpts;
|
|
746
|
+
}
|
|
423
747
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
export type TileComponentProps = BaseComponentProps & BareTileComponentProps;
|
|
429
|
-
|
|
430
|
-
export interface TilePreferences extends PiralCustomTilePreferences {
|
|
431
|
-
/**
|
|
432
|
-
* Sets the desired initial number of columns.
|
|
433
|
-
* This may be overridden either by the user (if resizable true), or by the dashboard.
|
|
434
|
-
*/
|
|
435
|
-
initialColumns?: number;
|
|
436
|
-
/**
|
|
437
|
-
* Sets the desired initial number of rows.
|
|
438
|
-
* This may be overridden either by the user (if resizable true), or by the dashboard.
|
|
439
|
-
*/
|
|
440
|
-
initialRows?: number;
|
|
441
|
-
/**
|
|
442
|
-
* Determines if the tile can be resized by the user.
|
|
443
|
-
* By default the size of the tile is fixed.
|
|
444
|
-
*/
|
|
445
|
-
resizable?: boolean;
|
|
446
|
-
/**
|
|
447
|
-
* Declares a set of custom properties to be used with user-specified values.
|
|
448
|
-
*/
|
|
449
|
-
customProperties?: Array<string>;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
export interface MenuComponentProps extends BaseComponentProps {}
|
|
453
|
-
|
|
454
|
-
export interface MenuSettings extends PiralCustomMenuSettings {
|
|
455
|
-
/**
|
|
456
|
-
* Sets the type of the menu to attach to.
|
|
457
|
-
* @default "general"
|
|
458
|
-
*/
|
|
459
|
-
type?: MenuType;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
export type NotificationComponentProps = BaseComponentProps & BareNotificationProps;
|
|
463
|
-
|
|
464
|
-
export interface NotificationOptions extends PiralCustomNotificationOptions {
|
|
465
|
-
/**
|
|
466
|
-
* The title of the notification, if any.
|
|
467
|
-
*/
|
|
468
|
-
title?: string;
|
|
469
|
-
/**
|
|
470
|
-
* Determines when the notification should automatically close in milliseconds.
|
|
471
|
-
* A value of 0 or undefined forces the user to close the notification.
|
|
472
|
-
*/
|
|
473
|
-
autoClose?: number;
|
|
474
|
-
/**
|
|
475
|
-
* The type of the notification used when displaying the message.
|
|
476
|
-
* By default info is used.
|
|
477
|
-
*/
|
|
478
|
-
type?: "info" | "success" | "warning" | "error";
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
export type ModalOptions<T> = T extends keyof PiralModalsMap ? PiralModalsMap[T] & BaseModalOptions : T extends string ? BaseModalOptions : T;
|
|
482
|
-
|
|
483
|
-
export type ModalComponentProps<T> = BaseComponentProps & BareModalComponentProps<ModalOptions<T>>;
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
* The options provided for the dialog layout.
|
|
487
|
-
*/
|
|
488
|
-
export interface ModalLayoutOptions {}
|
|
489
|
-
|
|
490
|
-
export interface FeedResolver<TData> {
|
|
491
|
-
(): Promise<TData>;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
export type FeedConnector<TData, TReducers = {}> = GetActions<TReducers> & {
|
|
495
|
-
<TProps>(component: React.ComponentType<TProps & FeedConnectorProps<TData>>): React.FC<TProps>;
|
|
496
|
-
/**
|
|
497
|
-
* Invalidates the underlying feed connector.
|
|
498
|
-
* Forces a reload on next use.
|
|
499
|
-
*/
|
|
500
|
-
invalidate(): void;
|
|
501
|
-
};
|
|
502
|
-
|
|
503
|
-
export interface FeedConnectorOptions<TData, TItem, TReducers extends FeedConnectorReducers<TData> = {}> {
|
|
504
|
-
/**
|
|
505
|
-
* Function to derive the initial set of data.
|
|
506
|
-
* @returns The promise for retrieving the initial data set.
|
|
507
|
-
*/
|
|
508
|
-
initialize: FeedResolver<TData>;
|
|
509
|
-
/**
|
|
510
|
-
* Function to be called for connecting to a live data feed.
|
|
511
|
-
* @param callback The function to call when an item updated.
|
|
512
|
-
* @returns A callback for disconnecting from the feed.
|
|
513
|
-
*/
|
|
514
|
-
connect?: FeedSubscriber<TItem>;
|
|
515
|
-
/**
|
|
516
|
-
* Function to be called when some data updated.
|
|
517
|
-
* @param data The current set of data.
|
|
518
|
-
* @param item The updated item to include.
|
|
519
|
-
* @returns The promise for retrieving the updated data set or the updated data set.
|
|
520
|
-
*/
|
|
521
|
-
update?: FeedReducer<TData, TItem>;
|
|
522
|
-
/**
|
|
523
|
-
* Defines the optional reducers for modifying the data state.
|
|
524
|
-
*/
|
|
525
|
-
reducers?: TReducers;
|
|
526
|
-
/**
|
|
527
|
-
* Optional flag to avoid lazy loading and initialize the data directly.
|
|
528
|
-
*/
|
|
529
|
-
immediately?: boolean;
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
export interface FeedConnectorReducers<TData> {
|
|
533
|
-
[name: string]: (data: TData, ...args: any) => Promise<TData> | TData;
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
export interface SearchProvider {
|
|
537
|
-
(options: SearchOptions, api: PiletApi): Promise<SearchResultType | Array<SearchResultType>>;
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
export interface SearchSettings {
|
|
541
|
-
/**
|
|
542
|
-
* Only invoke the search provider if its an immediate search.
|
|
543
|
-
*/
|
|
544
|
-
onlyImmediate?: boolean;
|
|
545
|
-
/**
|
|
546
|
-
* Callback to be fired when the search is cleared.
|
|
547
|
-
*/
|
|
548
|
-
onClear?(): void;
|
|
549
|
-
/**
|
|
550
|
-
* Callback to be fired when an existing search is cancelled.
|
|
551
|
-
*/
|
|
552
|
-
onCancel?(): void;
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
export interface UserInfo {
|
|
556
|
-
id: string;
|
|
557
|
-
firstName: string;
|
|
558
|
-
lastName: string;
|
|
559
|
-
mail: string;
|
|
560
|
-
language: string;
|
|
561
|
-
permissions: UserPermissions;
|
|
562
|
-
features: UserFeatures;
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
/**
|
|
566
|
-
* Defines the potential targets when storing data.
|
|
567
|
-
*/
|
|
568
|
-
export type DataStoreTarget = "memory" | "local" | "remote";
|
|
569
|
-
|
|
570
|
-
/**
|
|
571
|
-
* Defines the custom options for storing data.
|
|
572
|
-
*/
|
|
573
|
-
export interface CustomDataStoreOptions {
|
|
574
|
-
/**
|
|
575
|
-
* The target data store. By default the data is only stored in memory.
|
|
576
|
-
*/
|
|
577
|
-
target?: DataStoreTarget;
|
|
578
|
-
/**
|
|
579
|
-
* Optionally determines when the data expires.
|
|
580
|
-
*/
|
|
581
|
-
expires?: "never" | Date | number;
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
export type FirstParametersOf<T> = {
|
|
585
|
-
[K in keyof T]: T[K] extends (arg: any) => any ? FirstParameter<T[K]> : never;
|
|
586
|
-
}[keyof T];
|
|
587
|
-
|
|
588
|
-
/**
|
|
589
|
-
* Mapping of available component converters.
|
|
590
|
-
*/
|
|
591
|
-
export interface ComponentConverters<TProps> extends PiralCustomComponentConverters<TProps> {
|
|
592
|
-
/**
|
|
593
|
-
* Converts the HTML component to a framework-independent component.
|
|
594
|
-
* @param component The vanilla JavaScript component to be converted.
|
|
595
|
-
*/
|
|
596
|
-
html(component: HtmlComponent<TProps>): ForeignComponent<TProps>;
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
/**
|
|
600
|
-
* The props that every registered page component obtains.
|
|
601
|
-
*/
|
|
602
|
-
export interface RouteBaseProps<UrlParams = any, UrlState = any> extends ReactRouter.RouteComponentProps<UrlParams, {}, UrlState>, BaseComponentProps {}
|
|
603
|
-
|
|
604
|
-
/**
|
|
605
|
-
* Custom meta data to include for pages.
|
|
606
|
-
*/
|
|
607
|
-
export interface PiralCustomPageMeta {}
|
|
608
|
-
|
|
609
|
-
/**
|
|
610
|
-
* The props of an extension component.
|
|
611
|
-
*/
|
|
612
|
-
export interface ExtensionComponentProps<T> extends BaseComponentProps {
|
|
613
|
-
/**
|
|
614
|
-
* The provided parameters for showing the extension.
|
|
615
|
-
*/
|
|
616
|
-
params: T extends keyof PiralExtensionSlotMap ? PiralExtensionSlotMap[T] : T extends string ? any : T;
|
|
617
|
-
/**
|
|
618
|
-
* The optional children to receive, if any.
|
|
619
|
-
*/
|
|
620
|
-
children?: React.ReactNode;
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
/**
|
|
624
|
-
* The mapping of the existing (known) extension slots.
|
|
625
|
-
*/
|
|
626
|
-
export interface PiralExtensionSlotMap extends PiralCustomExtensionSlotMap {}
|
|
627
|
-
|
|
628
|
-
/**
|
|
629
|
-
* The basic props for defining an extension slot.
|
|
630
|
-
*/
|
|
631
|
-
export interface BaseExtensionSlotProps<TName, TParams> {
|
|
632
|
-
/**
|
|
633
|
-
* The children to transport, if any.
|
|
634
|
-
*/
|
|
635
|
-
children?: React.ReactNode;
|
|
636
|
-
/**
|
|
637
|
-
* Defines what should be rendered when no components are available
|
|
638
|
-
* for the specified extension.
|
|
639
|
-
*/
|
|
640
|
-
empty?(): React.ReactNode;
|
|
641
|
-
/**
|
|
642
|
-
* Determines if the `render` function should be called in case no
|
|
643
|
-
* components are available for the specified extension.
|
|
644
|
-
*
|
|
645
|
-
* If true, `empty` will be called and returned from the slot.
|
|
646
|
-
* If false, `render` will be called with the result of calling `empty`.
|
|
647
|
-
* The result of calling `render` will then be returned from the slot.
|
|
648
|
-
*/
|
|
649
|
-
emptySkipsRender?: boolean;
|
|
650
|
-
/**
|
|
651
|
-
* Defines the order of the components to render.
|
|
652
|
-
* May be more convient than using `render` w.r.t. ordering extensions
|
|
653
|
-
* by their supplied metadata.
|
|
654
|
-
* @param extensions The registered extensions.
|
|
655
|
-
* @returns The ordered extensions.
|
|
656
|
-
*/
|
|
657
|
-
order?(extensions: Array<ExtensionRegistration>): Array<ExtensionRegistration>;
|
|
658
|
-
/**
|
|
659
|
-
* Defines how the provided nodes should be rendered.
|
|
660
|
-
* @param nodes The rendered extension nodes.
|
|
661
|
-
* @returns The rendered nodes, i.e., an ReactElement.
|
|
662
|
-
*/
|
|
663
|
-
render?(nodes: Array<React.ReactNode>): React.ReactElement<any, any> | null;
|
|
664
|
-
/**
|
|
665
|
-
* The custom parameters for the given extension.
|
|
666
|
-
*/
|
|
667
|
-
params?: TParams;
|
|
668
|
-
/**
|
|
669
|
-
* The name of the extension to render.
|
|
670
|
-
*/
|
|
671
|
-
name: TName;
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
export interface PiralSelectLanguageEvent {
|
|
675
|
-
/**
|
|
676
|
-
* Gets the previously selected language.
|
|
677
|
-
*/
|
|
678
|
-
previousLanguage: string;
|
|
679
|
-
/**
|
|
680
|
-
* Gets the currently selected language.
|
|
681
|
-
*/
|
|
682
|
-
currentLanguage: string;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
export interface PiralChangeUserEvent {
|
|
686
|
-
previous: UserInfo;
|
|
687
|
-
current: UserInfo;
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
export interface Translations {
|
|
691
|
-
[tag: string]: string;
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
/**
|
|
695
|
-
* The props that every registered component obtains.
|
|
696
|
-
*/
|
|
697
|
-
export interface BaseComponentProps {
|
|
698
|
-
/**
|
|
699
|
-
* The currently used pilet API.
|
|
700
|
-
*/
|
|
701
|
-
piral: PiletApi;
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
export interface BareTileComponentProps {
|
|
705
|
-
/**
|
|
706
|
-
* The currently used number of columns.
|
|
707
|
-
*/
|
|
708
|
-
columns: number;
|
|
709
|
-
/**
|
|
710
|
-
* The currently used number of rows.
|
|
711
|
-
*/
|
|
712
|
-
rows: number;
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
export interface PiralCustomTilePreferences {}
|
|
716
|
-
|
|
717
|
-
export interface PiralCustomMenuSettings {}
|
|
718
|
-
|
|
719
|
-
export type MenuType = StandardMenuType | keyof PiralCustomMenuTypes;
|
|
720
|
-
|
|
721
|
-
export interface BareNotificationProps {
|
|
722
|
-
/**
|
|
723
|
-
* Callback for closing the notification programmatically.
|
|
724
|
-
*/
|
|
725
|
-
onClose(): void;
|
|
726
|
-
/**
|
|
727
|
-
* Provides the passed in options for this particular notification.
|
|
728
|
-
*/
|
|
729
|
-
options: NotificationOptions;
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
export interface PiralCustomNotificationOptions {}
|
|
733
|
-
|
|
734
|
-
export interface BaseModalOptions {}
|
|
735
|
-
|
|
736
|
-
export interface PiralModalsMap extends PiralCustomModalsMap {}
|
|
737
|
-
|
|
738
|
-
export interface BareModalComponentProps<TOpts> {
|
|
739
|
-
/**
|
|
740
|
-
* Callback for closing the modal programmatically.
|
|
741
|
-
*/
|
|
742
|
-
onClose(): void;
|
|
743
|
-
/**
|
|
744
|
-
* Provides the passed in options for this particular modal.
|
|
745
|
-
*/
|
|
746
|
-
options?: TOpts;
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
export type GetActions<TReducers> = {
|
|
750
|
-
[P in keyof TReducers]: (...args: RemainingArgs<TReducers[P]>) => void;
|
|
751
|
-
};
|
|
752
|
-
|
|
753
|
-
export interface FeedConnectorProps<TData> {
|
|
754
|
-
/**
|
|
755
|
-
* The current data from the feed.
|
|
756
|
-
*/
|
|
757
|
-
data: TData;
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
export interface FeedSubscriber<TItem> {
|
|
761
|
-
(callback: (value: TItem) => void): Disposable;
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
export interface FeedReducer<TData, TAction> {
|
|
765
|
-
(data: TData, item: TAction): Promise<TData> | TData;
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
export interface SearchOptions {
|
|
769
|
-
/**
|
|
770
|
-
* Gets the query for the search. This is currently available input
|
|
771
|
-
* value.
|
|
772
|
-
*/
|
|
773
|
-
query: string;
|
|
774
|
-
/**
|
|
775
|
-
* Gets if the search was requested immediately, e.g., via pressing
|
|
776
|
-
* the enter key.
|
|
777
|
-
*/
|
|
778
|
-
immediate: boolean;
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
export type SearchResultType = string | React.ReactElement<any> | AnyComponent<SearchResultComponentProps>;
|
|
782
|
-
|
|
783
|
-
export type UserPermissions = Record<string, any>;
|
|
784
|
-
|
|
785
|
-
export type UserFeatures = Record<string, boolean>;
|
|
786
|
-
|
|
787
|
-
export type FirstParameter<T extends (arg: any) => any> = T extends (arg: infer P) => any ? P : never;
|
|
748
|
+
export type GetActions<TReducers> = {
|
|
749
|
+
[P in keyof TReducers]: (...args: RemainingArgs<TReducers[P]>) => void;
|
|
750
|
+
};
|
|
788
751
|
|
|
752
|
+
export interface FeedConnectorProps<TData> {
|
|
789
753
|
/**
|
|
790
|
-
*
|
|
791
|
-
*/
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
754
|
+
* The current data from the feed.
|
|
755
|
+
*/
|
|
756
|
+
data: TData;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
export interface FeedSubscriber<TItem> {
|
|
760
|
+
(callback: (value: TItem) => void): Disposable;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
export interface FeedReducer<TData, TAction> {
|
|
764
|
+
(data: TData, item: TAction): Promise<TData> | TData;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
export interface SearchOptions {
|
|
768
|
+
/**
|
|
769
|
+
* Gets the query for the search. This is currently available input
|
|
770
|
+
* value.
|
|
771
|
+
*/
|
|
772
|
+
query: string;
|
|
773
|
+
/**
|
|
774
|
+
* Gets if the search was requested immediately, e.g., via pressing
|
|
775
|
+
* the enter key.
|
|
776
|
+
*/
|
|
777
|
+
immediate: boolean;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
export type SearchResultType = string | React.ReactElement<any> | AnyComponent<SearchResultComponentProps>;
|
|
781
|
+
|
|
782
|
+
export type UserPermissions = Record<string, any>;
|
|
783
|
+
|
|
784
|
+
export type UserFeatures = Record<string, boolean>;
|
|
785
|
+
|
|
786
|
+
export type FirstParameter<T extends (arg: any) => any> = T extends (arg: infer P) => any ? P : never;
|
|
787
|
+
|
|
788
|
+
/**
|
|
789
|
+
* Custom component converters defined outside of piral-core.
|
|
790
|
+
*/
|
|
791
|
+
export interface PiralCustomComponentConverters<TProps> {}
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* Definition of a vanilla JavaScript component.
|
|
795
|
+
*/
|
|
796
|
+
export interface HtmlComponent<TProps> {
|
|
797
|
+
/**
|
|
798
|
+
* Renders a component into the provided element using the given props and context.
|
|
799
|
+
*/
|
|
800
|
+
component: ForeignComponent<TProps>;
|
|
801
|
+
/**
|
|
802
|
+
* The type of the HTML component.
|
|
803
|
+
*/
|
|
804
|
+
type: "html";
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* Generic definition of a framework-independent component.
|
|
809
|
+
*/
|
|
810
|
+
export interface ForeignComponent<TProps> {
|
|
811
|
+
/**
|
|
812
|
+
* Called when the component is mounted.
|
|
813
|
+
* @param element The container hosting the element.
|
|
814
|
+
* @param props The props to transport.
|
|
815
|
+
* @param ctx The associated context.
|
|
816
|
+
* @param locals The local state of this component instance.
|
|
817
|
+
*/
|
|
818
|
+
mount(element: HTMLElement, props: TProps, ctx: ComponentContext, locals: Record<string, any>): void;
|
|
819
|
+
/**
|
|
820
|
+
* Called when the component should be updated.
|
|
821
|
+
* @param element The container hosting the element.
|
|
822
|
+
* @param props The props to transport.
|
|
823
|
+
* @param ctx The associated context.
|
|
824
|
+
* @param locals The local state of this component instance.
|
|
825
|
+
*/
|
|
826
|
+
update?(element: HTMLElement, props: TProps, ctx: ComponentContext, locals: Record<string, any>): void;
|
|
827
|
+
/**
|
|
828
|
+
* Called when a component is unmounted.
|
|
829
|
+
* @param element The container that was hosting the element.
|
|
830
|
+
* @param locals The local state of this component instance.
|
|
831
|
+
*/
|
|
832
|
+
unmount?(element: HTMLElement, locals: Record<string, any>): void;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
/**
|
|
836
|
+
* Custom extension slots outside of piral-core.
|
|
837
|
+
*/
|
|
838
|
+
export interface PiralCustomExtensionSlotMap {}
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* The interface modeling the registration of a pilet extension component.
|
|
842
|
+
*/
|
|
843
|
+
export interface ExtensionRegistration extends BaseRegistration {
|
|
844
|
+
/**
|
|
845
|
+
* The wrapped registered extension component.
|
|
846
|
+
*/
|
|
847
|
+
component: WrappedComponent<ExtensionComponentProps<string>>;
|
|
848
|
+
/**
|
|
849
|
+
* The original extension component that has been registered.
|
|
850
|
+
*/
|
|
851
|
+
reference: any;
|
|
852
|
+
/**
|
|
853
|
+
* The default params (i.e., meta) of the extension.
|
|
854
|
+
*/
|
|
855
|
+
defaults: any;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
export type StandardMenuType = "general" | "admin" | "user" | "header" | "footer";
|
|
859
|
+
|
|
860
|
+
export interface PiralCustomMenuTypes {}
|
|
861
|
+
|
|
862
|
+
export interface PiralCustomModalsMap {}
|
|
863
|
+
|
|
864
|
+
export type RemainingArgs<T> = T extends (_: any, ...args: infer U) => any ? U : never;
|
|
865
|
+
|
|
866
|
+
export interface SearchResultComponentProps extends BaseComponentProps {}
|
|
867
|
+
|
|
868
|
+
/**
|
|
869
|
+
* The context to be transported into the generic components.
|
|
870
|
+
*/
|
|
871
|
+
export interface ComponentContext {
|
|
872
|
+
navigation: NavigationApi;
|
|
873
|
+
publicPath: string;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* The base type for pilet component registration in the global state context.
|
|
878
|
+
*/
|
|
879
|
+
export interface BaseRegistration {
|
|
880
|
+
/**
|
|
881
|
+
* The pilet registering the component.
|
|
882
|
+
*/
|
|
883
|
+
pilet: string;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
export type WrappedComponent<TProps> = React.ComponentType<React.PropsWithChildren<Without<TProps, keyof BaseComponentProps>>>;
|
|
887
|
+
|
|
888
|
+
export interface NavigationApi {
|
|
889
|
+
/**
|
|
890
|
+
* Pushes a new location onto the history stack.
|
|
891
|
+
*/
|
|
892
|
+
push(target: string, state?: any): void;
|
|
893
|
+
/**
|
|
894
|
+
* Replaces the current location with another.
|
|
895
|
+
*/
|
|
896
|
+
replace(target: string, state?: any): void;
|
|
897
|
+
/**
|
|
898
|
+
* Changes the current index in the history stack by a given delta.
|
|
899
|
+
*/
|
|
900
|
+
go(n: number): void;
|
|
901
|
+
/**
|
|
902
|
+
* Prevents changes to the history stack from happening.
|
|
903
|
+
* This is useful when you want to prevent the user navigating
|
|
904
|
+
* away from the current page, for example when they have some
|
|
905
|
+
* unsaved data on the current page.
|
|
906
|
+
* @param blocker The function being called with a transition request.
|
|
907
|
+
* @returns The disposable for stopping the block.
|
|
908
|
+
*/
|
|
909
|
+
block(blocker: NavigationBlocker): Disposable;
|
|
910
|
+
/**
|
|
911
|
+
* Starts listening for location changes and calls the given
|
|
912
|
+
* callback with an Update when it does.
|
|
913
|
+
* @param listener The function being called when the route changes.
|
|
914
|
+
* @returns The disposable for stopping the block.
|
|
915
|
+
*/
|
|
916
|
+
listen(listener: NavigationListener): Disposable;
|
|
917
|
+
/**
|
|
918
|
+
* Gets the current path.
|
|
919
|
+
*/
|
|
920
|
+
path: string;
|
|
921
|
+
/**
|
|
922
|
+
* The original router behind the navigation.
|
|
923
|
+
*/
|
|
924
|
+
router: any;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
export type Without<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
928
|
+
|
|
929
|
+
export interface NavigationBlocker {
|
|
930
|
+
(tx: NavigationTransition): void;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
export interface NavigationListener {
|
|
934
|
+
(update: NavigationUpdate): void;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
export interface NavigationTransition extends NavigationUpdate {
|
|
938
|
+
retry(): void;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
export interface NavigationUpdate {
|
|
942
|
+
action: NavigationAction;
|
|
943
|
+
location: NavigationLocation;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
export type NavigationAction = "POP" | "PUSH" | "REPLACE";
|
|
947
|
+
|
|
948
|
+
export interface NavigationLocation {
|
|
949
|
+
/**
|
|
950
|
+
* The fully qualified URL incl. the origin and base path.
|
|
951
|
+
*/
|
|
952
|
+
href: string;
|
|
953
|
+
/**
|
|
954
|
+
* The location.pathname property is a string that contains an initial "/"
|
|
955
|
+
* followed by the remainder of the URL up to the ?.
|
|
956
|
+
*/
|
|
957
|
+
pathname: string;
|
|
958
|
+
/**
|
|
959
|
+
* The location.search property is a string that contains an initial "?"
|
|
960
|
+
* followed by the key=value pairs in the query string. If there are no
|
|
961
|
+
* parameters, this value may be the empty string (i.e. '').
|
|
962
|
+
*/
|
|
963
|
+
search: string;
|
|
964
|
+
/**
|
|
965
|
+
* The location.hash property is a string that contains an initial "#"
|
|
966
|
+
* followed by fragment identifier of the URL. If there is no fragment
|
|
967
|
+
* identifier, this value may be the empty string (i.e. '').
|
|
968
|
+
*/
|
|
969
|
+
hash: string;
|
|
970
|
+
/**
|
|
971
|
+
* The location.state property is a user-supplied State object that is
|
|
972
|
+
* associated with this location. This can be a useful place to store
|
|
973
|
+
* any information you do not want to put in the URL, e.g. session-specific
|
|
974
|
+
* data.
|
|
975
|
+
*/
|
|
976
|
+
state: unknown;
|
|
977
|
+
/**
|
|
978
|
+
* The location.key property is a unique string associated with this location.
|
|
979
|
+
* On the initial location, this will be the string default. On all subsequent
|
|
980
|
+
* locations, this string will be a unique identifier.
|
|
981
|
+
*/
|
|
982
|
+
key: string;
|
|
981
983
|
}
|