@ichicraft/widgets-widget-base 1.8.12 → 1.8.14

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.
@@ -1,647 +1,646 @@
1
- /**
2
- * Widget context providing widget metadata and functionality offered by the widget board
3
- */
4
- export interface WidgetContext {
5
- /**
6
- * metadata and functions in the context of a widget instance. A widget instance
7
- * is a single and specific widget that a user has on his/her board. It has its own
8
- * unique ID and possibly configuration data if the widget is configurable by the user
9
- */
10
- instance: {
11
- /**
12
- * Unique id for a specific widget on a user's board
13
- */
14
- id: string;
15
- /**
16
- * Optional configuration data that contains user settings of a specific widget instance
17
- */
18
- data?: string;
19
- /**
20
- * The type of board this widget instance is added to.
21
- */
22
- boardType?: BoardType;
23
- /**
24
- * Call this function from within a widget instance to publish a notification to the
25
- * notitication box on top of the widget board. It should provide information for this specific
26
- * widget instance. Notitifcation content is limited to one single line and a widget instance
27
- * can only have one active notification at a time
28
- */
29
- publishNotification?: (content: string, expirationDateTime: Date) => void;
30
- /**
31
- * Call this function to open the widget configuration panel for a user. This is an additional
32
- * way to open the panel because a user can also open the configuration panel by using the contextual
33
- * menu of the widget.
34
- */
35
- openConfiguration?: () => void;
36
- /**
37
- * Call this function to open the widget delete confirmation dialog for a user. This offers widget developers
38
- * the ability to trigger the "widget deletion process". This allows different methods to delete the widget.
39
- */
40
- initiateWidgetDeletion?: () => void;
41
- /**
42
- * Functionality offered by the widget board to change the title of the widget.
43
- */
44
- setWidgetTitle?: (title: string) => void;
45
- /**
46
- * Functionality offered by the widget board to append the title of the widget with additional text.
47
- */
48
- setWidgetTitleSuffix?: (suffix: string) => void;
49
- /**
50
- * Functionality offered by the widget board to change the subtitle of the widget.
51
- */
52
- setWidgetSubtitle?: (subtitle: string) => void;
53
- /**
54
- * Show or hide the header of the widget, allowing widgets to take control of full widget real estate.
55
- */
56
- setWidgetHeaderVisibility?: (visible: boolean) => void;
57
- /**
58
- * Show or hide the settings button of the widget.
59
- */
60
- setUserConfigButtonVisibility?: (visible: boolean) => void;
61
- /**
62
- * Optional callback to handle the click event of the widget title.
63
- */
64
- onWidgetTitleClicked?: () => void;
65
- /**
66
- * Allows registration of multiple custom command bar items which can either result in an icon or
67
- * an icon button, depending on the presence of the onClick property. To remove the items,
68
- * use the [unregisterCommandBarItems] function.
69
- */
70
- registerCustomCommandBarItems?: (props: CustomCommandBarItemProps[]) => void;
71
- /**
72
- * Allows registration of a custom command bar item which can either result in an icon or
73
- * an icon button, depending on the presence of the onClick property. To remove the item,
74
- * use the [unregisterCommandBarItem] function.
75
- */
76
- registerCustomCommandBarItem?: (props: CustomCommandBarItemProps) => void;
77
- /**
78
- * Removes all registered custom command bar items.
79
- */
80
- unregisterCustomCommandBarItems?: () => void;
81
- /**
82
- * Removes a single custom command bar item, corresponding to the provided id.
83
- * If no id was specified, it removes all items.
84
- */
85
- unregisterCustomCommandBarItem?: (id?: string) => void;
86
- /**
87
- * Raises an event to be handled by the Time-based Events feature of Ichicraft Boards.
88
- * @param object The object this event concerns (e.g. app, report, newsArticle, ...). Use camelCase.
89
- * @param action The action that was performed to/on the object (e.g. viewed, clicked, deleted, ...). Use camelCase.
90
- * @param data Optionally provide extra metadata to be included with the raised event.
91
- * widgetAlias property (from manifest) and variantTitle property will automatically be added by the widget board.
92
- */
93
- raiseEvent?: (object: string, action: string, data?: {
94
- [key: string]: string;
95
- }) => void;
96
- };
97
- /**
98
- * Metadata and functions in the context of a widget's variant (fka definition). A widget variant is
99
- * a widget that's been installed by an administrator from within the board administration.
100
- */
101
- definition: {
102
- /**
103
- * Unique id of an installed and configured widget in the widget board.
104
- * If this is a 'single instance widget', which means that no more than one instance of this
105
- * widget can be installed in the widget board, the id of the definition is the same as the id of the manifest.
106
- */
107
- id: string;
108
- /**
109
- * Optional configuration data that contains board-wide settings of a specific widget instance
110
- */
111
- data?: string;
112
- /**
113
- * A list of board types applicable for this widget variant.
114
- */
115
- allowedBoardTypes?: BoardType[];
116
- };
117
- /**
118
- * Metadata and functions in the context of a widget's manifest. A widget manifest contains
119
- * all information of the originally installed widget. Multiple `variants` of the same widget `manifest`
120
- * can exist in a widget board configuration.
121
- */
122
- manifest: {
123
- /**
124
- * Unique id of a widget 'type', also used in the widget manifest config file in the original script source manifest file.
125
- * If this is a 'single instance widget', which means that no more than one instance of this
126
- * widget can be installed in the widget board, the id of the definition is the same as the id of the manifest.
127
- */
128
- id: string;
129
- };
130
- /**
131
- * Tells whether the widget board is running in a Teams context
132
- */
133
- inTeamsContext: boolean;
134
- /**
135
- * Tells whether the widget board is running in a Teams browser hosted context
136
- */
137
- isTeamsBrowserHosted: boolean;
138
- /**
139
- * Tells whether the widget board is running in a Teams webview hosted context
140
- */
141
- isTeamsWebViewHosted: boolean;
142
- /**
143
- * Tells whether the widget board is running in a SharePoint iOS app context
144
- */
145
- isSharePointiOSApp: boolean;
146
- /**
147
- * Tells whether the widget board is running in a webview hosted context
148
- */
149
- isWebViewHosted: boolean;
150
- /**
151
- * Tells whether the widget board is running in an embedded context
152
- */
153
- isEmbedded: boolean;
154
- /**
155
- * Tells whether the widget board is running in a mobile browser context
156
- */
157
- isMobileBrowser: boolean;
158
- /**
159
- * Tells whether the widget board is running in a mobile webview context
160
- */
161
- isMobileWebView: boolean;
162
- /**
163
- * Tenant ID of current SharePoint tenant
164
- */
165
- tenantId: string;
166
- /**
167
- * Site url of the site where the widget board is running
168
- */
169
- siteUrl: string;
170
- /**
171
- * User name of the currently signed in user.
172
- */
173
- userName: string;
174
- /**
175
- * The email address for the current user.
176
- *
177
- * @remarks
178
- * Example: `"example@contoso.com"`
179
- */
180
- userEmail: string;
181
- /**
182
- * SharePoint ID of the user in the current site
183
- */
184
- spUserId: number;
185
- /**
186
- * Login name of current user in claim style: i:0#.f|myprovider|myuser
187
- */
188
- claimBasedLoginName: string;
189
- /**
190
- * Azure AD Security groups that user is member of
191
- */
192
- userSecurityGroups: string[];
193
- /**
194
- * SharePoint groups in this site collection that user is member of
195
- */
196
- userSharePointGroups: number[];
197
- /**
198
- * Provides the date that the user's account was created
199
- */
200
- userAccountCreated: Date;
201
- /**
202
- * Roles of the current user. This may very depending on the active board
203
- */
204
- userRoles: UserRole[];
205
- /**
206
- * Language code of currently used UI rendering language in SharePoint
207
- */
208
- language: string;
209
- /**
210
- * List of supported languages as configured in Widget Board configuration
211
- */
212
- contentLanguages: {
213
- /**
214
- * Numeric Locale ID, like 1033 for English - United States
215
- */
216
- LCID: number;
217
- /**
218
- * Language code, like 'en-US' for English - United States
219
- */
220
- BCP47LanguageTag: string;
221
- /**
222
- * 2 or 3 character uppercase language code, like 'EN' for English - United States
223
- */
224
- abbreviatedCode: string;
225
- /**
226
- * Friendly name of the language, translated in the currently used UI language
227
- */
228
- friendlyName: string;
229
- /**
230
- * Whether this is the default UI language of the Widget Board
231
- */
232
- isDefault?: boolean;
233
- /**
234
- * Whether this is the current UI language of the Widget Board
235
- */
236
- isCurrent?: boolean;
237
- }[];
238
- /**
239
- * MS Graph Client Factory class as provided by the WebPartContext object.
240
- */
241
- msGraphClientFactory: any;
242
- /**
243
- * AAD Http Client Factory class as provided by the WebPartContext object.
244
- */
245
- aadHttpClientFactory: any;
246
- /**
247
- * AAD Token Provider Factory class as provided by the WebPartContext object.
248
- */
249
- aadTokenProviderFactory: any;
250
- /**
251
- * Currently in use theme (by SharePoint/Teams)
252
- */
253
- theme: any;
254
- /**
255
- * Returns whether or not the currently signed in user is part of an AAD security group.
256
- * Provide the guid of the group.
257
- */
258
- isCurrentUserMemberOfSecGroup?: (groupId: string) => Promise<boolean>;
259
- /**
260
- * Returns whether or not the currently signed in user is part of a SharePoint group in the current site.
261
- * Provide the id of the SP Group.
262
- */
263
- isCurrentUserMemberOfSPGroup?: (groupId: number) => Promise<boolean>;
264
- /**
265
- * Generates a hash of all combined SP Groups of the current user. This can be used as
266
- * cache invalidator to detect changes.
267
- * Store this hash as part of your local cache to detect when to refresh SP Group related data.
268
- */
269
- generateHashForAllCurrentUserSPGroups?: () => Promise<string>;
270
- /**
271
- * Generates a hash of all combined AAD Security Groups of the current user. This can be used as
272
- * cache invalidator to detect changes.
273
- * Store this hash as part of your local cache to detect when to refresh Sec Group related data.
274
- */
275
- generateHashForAllCurrentUserSecGroups?: () => Promise<string>;
276
- /**
277
- * Call this function from within one of the applicable render methods in case of an unresolvable error.
278
- * The widgetboard will render a 'disrupted' message and in case of an error in widget rendering it
279
- * offers the user the option to delete the widget from the board.
280
- */
281
- handleFatalError?: () => void;
282
- /**
283
- * Functionality offered by the widget board to load a script using SPComponentLoader.
284
- */
285
- loadScript?: <TModule>(url: string, options?: any) => Promise<TModule>;
286
- /**
287
- * Functionality offered by the widget board to open a File Picker panel to select files.
288
- * @param onFilePicked Function that's called when a file was picked. Returns the url of the picked file.
289
- * @param options Options to change the behavior of the file picker
290
- */
291
- openFilePicker?: (onFilePicked: (fileUrl: string, fileProps: FilePickerFileProps) => void, options?: FilePickerOptions) => void;
292
- /**
293
- * Functionality offered by the widget board to open a url in an iframe dialog.
294
- * @param url The url to open in a dialog.
295
- * @param options Options to configure the dialog (e.g. size, margin, callbacks, ...)
296
- */
297
- openIFrameDialog?: (url: string, options?: IFrameDialogOptions) => void;
298
- /**
299
- * Provides access to the Teams SDK and Teams context. Only provided when the web part is loaded in Teams.
300
- */
301
- teamsSdk?: {
302
- /**
303
- * Microsoft Teams SDK.
304
- */
305
- teamsJs: any;
306
- /**
307
- * {@inheritDoc @microsoft/teams-js#Context}
308
- */
309
- context: any;
310
- };
311
- }
312
- export interface ValidationResult {
313
- isValid: boolean;
314
- errors: string[];
315
- }
316
- export interface WidgetImages {
317
- preview: string;
318
- preview_small: string;
319
- additional: string[];
320
- }
321
- export interface WidgetResource {
322
- lang: number;
323
- title: string;
324
- subtitle?: string;
325
- shortDescription: string;
326
- instructions: string;
327
- images: WidgetImages;
328
- }
329
- export interface WebApiPermissionRequest {
330
- /**
331
- * Specifies the name of the resource service principle to wich access has been granted. Use the same principle names as in a SPPKG packages webApiPermissionRequests.
332
- */
333
- resource: string;
334
- /**
335
- * Specifies the name of the scope claim that the resource application should expect in the OAuth 2.0 access token. Use the same scope names as in a SPPKG packages webApiPermissionRequests.
336
- */
337
- scope: string;
338
- }
339
- /**
340
- * The widget manifest contains meta information about the widget
341
- */
342
- export interface WidgetManifestConfig {
343
- /**
344
- * Version of the widget manifest schema. The value of this field
345
- * is controlled by Ichicraft. The purpose of this field is to help
346
- * manage upgrades of the widget manifest schema.
347
- * The current version is version 2, introducing externals + manifestVersion
348
- * properties
349
- */
350
- manifestVersion: number;
351
- /**
352
- * Unique id to identify the widget
353
- */
354
- id: string;
355
- /**
356
- * Internal name for the widget, used internally by Ichicraft
357
- */
358
- name: string;
359
- /**
360
- * Version should contain the semver of this widget. For future use.
361
- */
362
- version: string;
363
- /**
364
- * The minimum number of rows this widget can inhabit in the widget board.
365
- * By default, a widget always takes up 2 rows (and 1 column),
366
- * If you want the widget to be able to shrink to 1 row, specify 1, otherwise, leave this
367
- * property empty.
368
- * _REMARK_: A value higher than 2 is considered invalid and will be ignored.
369
- */
370
- minRows: number;
371
- /**
372
- * The maximum number of rows this widget can inhabit in the widget board.
373
- * By default, a widget always takes up 2 rows (and 1 column).
374
- * Leave this empty and the maxRows will be defaulted to 2.
375
- * Specify Inifinity to allow spanning any number of rows.
376
- * _REMARK_: A value lower than 2 is considered invalid and will be ignored.
377
- */
378
- maxRows: number;
379
- /**
380
- * The maximum number of columns this widget can inhabit in the widget board.
381
- * By default, a widget always takes up 1 column (and 2 rows).
382
- * Leave this empty and the maxCols will be defaulted to 1.
383
- * Specify Inifinity to allow spanning any number of columns.
384
- * _REMARK_ A value lower than 1 is considered invalid and will be ignored.
385
- */
386
- maxCols: number;
387
- /**
388
- * Whether this widget is configurable by the user. Implementation of user config functions is necessary if true.
389
- */
390
- isConfigurableByUser: boolean;
391
- /**
392
- * Whether this widget is configurable by the board admin. Implementation of admin config functions is necessary if true.
393
- */
394
- isConfigurableByAdmin: boolean;
395
- /**
396
- * Internally used by Ichicraft
397
- */
398
- widgetBoardCompatibilityVersion?: number;
399
- /**
400
- * Icon used as prefix for notification sent by this widget. Icon should be the type id of a UI Fabric icon.
401
- */
402
- notificationIcon: string;
403
- /**
404
- * Language specific resources for this widget, used as default when installing a widget in the board
405
- */
406
- resources: WidgetResource[];
407
- /**
408
- * Web API permission requests. Like SPPKG packages, the widget specifies required API permissions.
409
- */
410
- webApiPermissionRequests?: WebApiPermissionRequest[];
411
- /**
412
- * This is the url of the widget script. It should be a well formatted url that points
413
- * to the script file's unique location. Script files should be hosted on a secure website (https).
414
- */
415
- scriptUrl: string;
416
- /**
417
- * File path used when debugging a widget, this is set automatically when you debug a widget
418
- */
419
- bundleFilePath?: string;
420
- /**
421
- * Added in manifestVersion 2
422
- * Lists modules (package dependencies) that should be loaded separately from bundle.
423
- * Libraries mentioned here will not be bundled when packed as a production release,
424
- * instead, they will be loaded from the provided path (path points to a CDN or other file location)
425
- */
426
- externals?: {
427
- [name: string]: {
428
- /**
429
- * Path to the script file. If this is a module (e.g. AMD or UMD), make sure you also
430
- * specify the modules this module depends on as separate modules using the correct aliases.
431
- */
432
- path: string;
433
- /**
434
- * Used for non-AMD scripts to specify dependencies. Should point to other non-AMD modules
435
- */
436
- globalDependencies?: string[];
437
- /**
438
- * In case this isn't an AMD module, define the variable name used by the script to
439
- * make the module available (i.e. global/root/window variable name like jQuery or $)
440
- */
441
- globalName?: string;
442
- /**
443
- * If this module has dependencies, map them here to other externals you also specified
444
- * For instance: external @fluentui/react umd module has dependencies React and ReactDOM.
445
- * To point these to the right externals, map them like this:
446
- * React: react
447
- * ReactDOM: 'react-dom'
448
- * And make sure you specified 'react' and 'react-dom' as externals as well.
449
- */
450
- dependencyMappings?: {
451
- [name: string]: string;
452
- };
453
- };
454
- };
455
- /**
456
- * Everything related to analytics of this widget in Ichicraft Boards
457
- */
458
- analytics?: {
459
- /**
460
- * A list of time-based events this widget can raise. All the possible events MUST be
461
- * described in this list for the widget board to be able to pick them up.
462
- * @ref Use WidgetContext.instance.raiseEvent(object: string, action: string, data?: { [key: string]: string }) to raise these events
463
- */
464
- timeBasedEvents: {
465
- /**
466
- * The object this event concerns (e.g. app, report, newsArticle, ...). Use camelCase.
467
- */
468
- object: string;
469
- /**
470
- * The action that was performed to/on the object (e.g. viewed, clicked, deleted, ...). Use camelCase.
471
- */
472
- action: string;
473
- /**
474
- * A descriptive text used in the Administration panel to describe this event
475
- */
476
- description: string;
477
- }[];
478
- };
479
- }
480
- export declare enum DebugComponentType {
481
- /**
482
- * This is the default component type and just opens the default widget board.
483
- */
484
- Default = "Default",
485
- /**
486
- * This automatically opens the widget board administration panel and opens the widget admin config
487
- * dialog of the widget you're working on
488
- */
489
- AdminConfig = "AdminConfig"
490
- }
491
- /**
492
- * The widget debug serve config contains settings for debugging a widget in development
493
- */
494
- export interface WidgetDebugServeConfig {
495
- /**
496
- * Provide a url of a SharePoint site that hosts a widget board. This page will be opened
497
- * as soon as you start debugging using [npm run start]
498
- */
499
- widgetsDebugPageUrl: string;
500
- /**
501
- * Provide a component type to open the debugging widget board with that specific component.
502
- * This speeds up your development cycle: [npm run start] > save changes > builds automatically >
503
- * refresh browser > automatically open updated component.
504
- */
505
- debugComponentType?: DebugComponentType;
506
- }
507
- export declare enum ICPersonaType {
508
- User = 0,
509
- SPGroup = 1,
510
- Other = 2
511
- }
512
- export interface ICPersona {
513
- displayName: string;
514
- id: string;
515
- type?: ICPersonaType;
516
- resolved?: boolean;
517
- }
518
- /**
519
- * Tells the severity of the command bar item, resulting in
520
- * distinguishable presentation of the item
521
- */
522
- export declare enum CustomCommandBarItemSeverity {
523
- /** Normal severity, displays just like all the other command bar items */
524
- Normal = 0,
525
- /** Warning severity, displays the item with a more noticable warning color */
526
- Warning = 1
527
- }
528
- /**
529
- * Properties to pass to the generateCommandBarItem function, resulting in the
530
- * rendering of a command bar item, which could either be a single Icon or an Icon Button
531
- */
532
- export interface CustomCommandBarItemProps {
533
- /**
534
- * Optional identifier for the icon.
535
- */
536
- id?: string;
537
- /**
538
- * Name of the icon, as specified and available in Fluent UI Iconography:
539
- * https://developer.microsoft.com/en-us/fluentui#/styles/web/icons
540
- */
541
- iconName: string;
542
- /**
543
- * Optional content to show as a tooltip above the item
544
- */
545
- tooltipContent?: string;
546
- /**
547
- * Optionally tells the tooltip to be shown automatically
548
- */
549
- showTooltipAutomatically?: boolean;
550
- /**
551
- * Optional severity to specify how the item should render
552
- */
553
- severity?: CustomCommandBarItemSeverity;
554
- /**
555
- * Optionally tells the Widget Header that this icon should always be visible, even when not hovering
556
- */
557
- pinned?: boolean;
558
- /**
559
- * Optionally display a red notification icon badge in the top-right corner of the button.
560
- */
561
- showNotificationBadge?: boolean;
562
- /**
563
- * Optionally provide an order in which this button should appear, when registering multiple custom buttons.
564
- */
565
- order?: number;
566
- /**
567
- * Optional onClick event, which is triggered on user click and makes the command
568
- * bar item render as a button instead of a non-clickable icon
569
- */
570
- onClick?: () => void;
571
- }
572
- /**
573
- * Options to pass to the openIFrameDialog function. Use this to configure how the dialog is rendered, and to handle events (e.g. onDismissed)
574
- */
575
- export interface IFrameDialogOptions {
576
- /**
577
- * Maximum width of the dialog. If it exceeds the window width, that width is used instead.
578
- */
579
- maxWidth?: number;
580
- /**
581
- * Maximum height of the dialog. If it exceeds the window height, that height is used instead.
582
- */
583
- maxHeight?: number;
584
- /**
585
- * Minimum margin on the left- and right side of the dialog.
586
- */
587
- marginHorizontal?: number;
588
- /**
589
- * Minimum margin on the top- and bottom side of the dialog.
590
- */
591
- marginVertical?: number;
592
- /**
593
- * This event is triggered when the iFrame dialog is dismissed by the user.
594
- */
595
- onDismissed?: () => void;
596
- }
597
- /**
598
- * Options to pass to openFilePicker function
599
- */
600
- export interface FilePickerOptions {
601
- /**
602
- * Array of file extensions that will be used to filter the files in the picker.
603
- * @default ['.gif', '.jpg', '.jpeg', '.png']
604
- */
605
- extensions?: string[];
606
- /**
607
- * Maximum number of files to show in a folder
608
- * @default 100
609
- */
610
- itemsCountQueryLimit?: number;
611
- /**
612
- * Whether or not to hide the organisational site files tab
613
- * @default false
614
- */
615
- hideOrganisationalAssetTab?: boolean;
616
- /**
617
- * Whether or not to hide the site files tab
618
- * @default false
619
- */
620
- hideSiteFilesTab?: boolean;
621
- /**
622
- * Whether or not to hide the upload tab
623
- * @default false
624
- */
625
- hideLocalUploadTab?: boolean;
626
- /**
627
- * Function that's called when user closes file picker without picking a file
628
- * @default undefined
629
- */
630
- onCancel?: () => void;
631
- }
632
- export interface FilePickerFileProps {
633
- /**
634
- * Unique identifier of the file item in SharePoint, in the shape of a Guid.
635
- */
636
- uniqueId: string;
637
- /**
638
- * Unique identifier of the list in SharePoint, in the shape of a Guid.
639
- */
640
- listId: string;
641
- /**
642
- * Unique identifier of the site in SharePoint, in the shape of a Guid.
643
- */
644
- siteId: string;
645
- }
646
- export declare type BoardType = 'shared' | 'personal';
647
- export declare type UserRole = 'administrator' | 'board-owner';
1
+ /**
2
+ * Widget context providing widget metadata and functionality offered by the widget board
3
+ */
4
+ export interface WidgetContext {
5
+ /**
6
+ * metadata and functions in the context of a widget instance. A widget instance
7
+ * is a single and specific widget that a user has on his/her board. It has its own
8
+ * unique ID and possibly configuration data if the widget is configurable by the user
9
+ */
10
+ instance: {
11
+ /**
12
+ * Unique id for a specific widget on a user's board
13
+ */
14
+ id: string;
15
+ /**
16
+ * Optional configuration data that contains user settings of a specific widget instance
17
+ */
18
+ data?: string;
19
+ /**
20
+ * The type of board this widget instance is added to.
21
+ */
22
+ boardType?: BoardType;
23
+ /**
24
+ * Call this function from within a widget instance to publish a notification to the
25
+ * notitication box on top of the widget board. It should provide information for this specific
26
+ * widget instance. Notitifcation content is limited to one single line and a widget instance
27
+ * can only have one active notification at a time
28
+ */
29
+ publishNotification?: (content: string, expirationDateTime: Date) => void;
30
+ /**
31
+ * Call this function to open the widget configuration panel for a user. This is an additional
32
+ * way to open the panel because a user can also open the configuration panel by using the contextual
33
+ * menu of the widget.
34
+ */
35
+ openConfiguration?: () => void;
36
+ /**
37
+ * Call this function to open the widget delete confirmation dialog for a user. This offers widget developers
38
+ * the ability to trigger the "widget deletion process". This allows different methods to delete the widget.
39
+ */
40
+ initiateWidgetDeletion?: () => void;
41
+ /**
42
+ * Functionality offered by the widget board to change the title of the widget.
43
+ */
44
+ setWidgetTitle?: (title: string) => void;
45
+ /**
46
+ * Functionality offered by the widget board to append the title of the widget with additional text.
47
+ */
48
+ setWidgetTitleSuffix?: (suffix: string) => void;
49
+ /**
50
+ * Functionality offered by the widget board to change the subtitle of the widget.
51
+ */
52
+ setWidgetSubtitle?: (subtitle: string) => void;
53
+ /**
54
+ * Show or hide the header of the widget, allowing widgets to take control of full widget real estate.
55
+ */
56
+ setWidgetHeaderVisibility?: (visible: boolean) => void;
57
+ /**
58
+ * Show or hide the settings button of the widget.
59
+ */
60
+ setUserConfigButtonVisibility?: (visible: boolean) => void;
61
+ /**
62
+ * Optional callback to handle the click event of the widget title.
63
+ */
64
+ onWidgetTitleClicked?: () => void;
65
+ /**
66
+ * Allows registration of multiple custom command bar items which can either result in an icon or
67
+ * an icon button, depending on the presence of the onClick property. To remove the items,
68
+ * use the [unregisterCommandBarItems] function.
69
+ */
70
+ registerCustomCommandBarItems?: (props: CustomCommandBarItemProps[]) => void;
71
+ /**
72
+ * Allows registration of a custom command bar item which can either result in an icon or
73
+ * an icon button, depending on the presence of the onClick property. To remove the item,
74
+ * use the [unregisterCommandBarItem] function.
75
+ */
76
+ registerCustomCommandBarItem?: (props: CustomCommandBarItemProps) => void;
77
+ /**
78
+ * Removes all registered custom command bar items.
79
+ */
80
+ unregisterCustomCommandBarItems?: () => void;
81
+ /**
82
+ * Removes a single custom command bar item, corresponding to the provided id.
83
+ * If no id was specified, it removes all items.
84
+ */
85
+ unregisterCustomCommandBarItem?: (id?: string) => void;
86
+ /**
87
+ * Raises an event to be handled by the Time-based Events feature of Ichicraft Boards.
88
+ * @param object The object this event concerns (e.g. app, report, newsArticle, ...). Use camelCase.
89
+ * @param action The action that was performed to/on the object (e.g. viewed, clicked, deleted, ...). Use camelCase.
90
+ * @param data Optionally provide extra metadata to be included with the raised event.
91
+ * widgetAlias property (from manifest) and variantTitle property will automatically be added by the widget board.
92
+ */
93
+ raiseEvent?: (object: string, action: string, data?: {
94
+ [key: string]: string;
95
+ }) => void;
96
+ };
97
+ /**
98
+ * Metadata and functions in the context of a widget's variant (fka definition). A widget variant is
99
+ * a widget that's been installed by an administrator from within the board administration.
100
+ */
101
+ definition: {
102
+ /**
103
+ * Unique id of an installed and configured widget in the widget board.
104
+ * If this is a 'single instance widget', which means that no more than one instance of this
105
+ * widget can be installed in the widget board, the id of the definition is the same as the id of the manifest.
106
+ */
107
+ id: string;
108
+ /**
109
+ * Optional configuration data that contains board-wide settings of a specific widget instance
110
+ */
111
+ data?: string;
112
+ /**
113
+ * A list of board types applicable for this widget variant.
114
+ */
115
+ allowedBoardTypes?: BoardType[];
116
+ };
117
+ /**
118
+ * Metadata and functions in the context of a widget's manifest. A widget manifest contains
119
+ * all information of the originally installed widget. Multiple `variants` of the same widget `manifest`
120
+ * can exist in a widget board configuration.
121
+ */
122
+ manifest: {
123
+ /**
124
+ * Unique id of a widget 'type', also used in the widget manifest config file in the original script source manifest file.
125
+ * If this is a 'single instance widget', which means that no more than one instance of this
126
+ * widget can be installed in the widget board, the id of the definition is the same as the id of the manifest.
127
+ */
128
+ id: string;
129
+ };
130
+ /**
131
+ * Tells whether the widget board is running in a Teams context
132
+ */
133
+ inTeamsContext: boolean;
134
+ /**
135
+ * Tells whether the widget board is running in a Teams browser hosted context
136
+ */
137
+ isTeamsBrowserHosted: boolean;
138
+ /**
139
+ * Tells whether the widget board is running in a Teams webview hosted context
140
+ */
141
+ isTeamsWebViewHosted: boolean;
142
+ /**
143
+ * Tells whether the widget board is running in a SharePoint iOS app context
144
+ */
145
+ isSharePointiOSApp: boolean;
146
+ /**
147
+ * Tells whether the widget board is running in a webview hosted context
148
+ */
149
+ isWebViewHosted: boolean;
150
+ /**
151
+ * Tells whether the widget board is running in an embedded context
152
+ */
153
+ isEmbedded: boolean;
154
+ /**
155
+ * Tells whether the widget board is running in a mobile browser context
156
+ */
157
+ isMobileBrowser: boolean;
158
+ /**
159
+ * Tells whether the widget board is running in a mobile webview context
160
+ */
161
+ isMobileWebView: boolean;
162
+ /**
163
+ * Tenant ID of current SharePoint tenant
164
+ */
165
+ tenantId: string;
166
+ /**
167
+ * Site url of the site where the widget board is running
168
+ */
169
+ siteUrl: string;
170
+ /**
171
+ * User name of the currently signed in user.
172
+ */
173
+ userName: string;
174
+ /**
175
+ * The email address for the current user.
176
+ *
177
+ * @remarks
178
+ * Example: `"example@contoso.com"`
179
+ */
180
+ userEmail: string;
181
+ /**
182
+ * SharePoint ID of the user in the current site
183
+ */
184
+ spUserId: number;
185
+ /**
186
+ * Login name of current user in claim style: i:0#.f|myprovider|myuser
187
+ */
188
+ claimBasedLoginName: string;
189
+ /**
190
+ * Azure AD Security groups that user is member of
191
+ */
192
+ userSecurityGroups: string[];
193
+ /**
194
+ * SharePoint groups in this site collection that user is member of
195
+ */
196
+ userSharePointGroups: number[];
197
+ /**
198
+ * Provides the date that the user's account was created
199
+ */
200
+ userAccountCreated: Date;
201
+ /**
202
+ * Roles of the current user. This may very depending on the active board
203
+ */
204
+ userRoles: UserRole[];
205
+ /**
206
+ * Language code of currently used UI rendering language in SharePoint
207
+ */
208
+ language: string;
209
+ /**
210
+ * List of supported languages as configured in Widget Board configuration
211
+ */
212
+ contentLanguages: {
213
+ /**
214
+ * Numeric Locale ID, like 1033 for English - United States
215
+ */
216
+ LCID: number;
217
+ /**
218
+ * Language code, like 'en-US' for English - United States
219
+ */
220
+ BCP47LanguageTag: string;
221
+ /**
222
+ * 2 or 3 character uppercase language code, like 'EN' for English - United States
223
+ */
224
+ abbreviatedCode: string;
225
+ /**
226
+ * Friendly name of the language, translated in the currently used UI language
227
+ */
228
+ friendlyName: string;
229
+ /**
230
+ * Whether this is the default UI language of the Widget Board
231
+ */
232
+ isDefault?: boolean;
233
+ /**
234
+ * Whether this is the current UI language of the Widget Board
235
+ */
236
+ isCurrent?: boolean;
237
+ }[];
238
+ /**
239
+ * MS Graph Client Factory class as provided by the WebPartContext object.
240
+ */
241
+ msGraphClientFactory: any;
242
+ /**
243
+ * AAD Http Client Factory class as provided by the WebPartContext object.
244
+ */
245
+ aadHttpClientFactory: any;
246
+ /**
247
+ * AAD Token Provider Factory class as provided by the WebPartContext object.
248
+ */
249
+ aadTokenProviderFactory: any;
250
+ /**
251
+ * Currently in use theme (by SharePoint/Teams)
252
+ */
253
+ theme: any;
254
+ /**
255
+ * Returns whether or not the currently signed in user is part of an AAD security group.
256
+ * Provide the guid of the group.
257
+ */
258
+ isCurrentUserMemberOfSecGroup?: (groupId: string) => Promise<boolean>;
259
+ /**
260
+ * Returns whether or not the currently signed in user is part of a SharePoint group in the current site.
261
+ * Provide the id of the SP Group.
262
+ */
263
+ isCurrentUserMemberOfSPGroup?: (groupId: number) => Promise<boolean>;
264
+ /**
265
+ * Generates a hash of all combined SP Groups of the current user. This can be used as
266
+ * cache invalidator to detect changes.
267
+ * Store this hash as part of your local cache to detect when to refresh SP Group related data.
268
+ */
269
+ generateHashForAllCurrentUserSPGroups?: () => Promise<string>;
270
+ /**
271
+ * Generates a hash of all combined AAD Security Groups of the current user. This can be used as
272
+ * cache invalidator to detect changes.
273
+ * Store this hash as part of your local cache to detect when to refresh Sec Group related data.
274
+ */
275
+ generateHashForAllCurrentUserSecGroups?: () => Promise<string>;
276
+ /**
277
+ * Call this function from within one of the applicable render methods in case of an unresolvable error.
278
+ * The widgetboard will render a 'disrupted' message and in case of an error in widget rendering it
279
+ * offers the user the option to delete the widget from the board.
280
+ */
281
+ handleFatalError?: () => void;
282
+ /**
283
+ * Functionality offered by the widget board to load a script using SPComponentLoader.
284
+ */
285
+ loadScript?: <TModule>(url: string, options?: any) => Promise<TModule>;
286
+ /**
287
+ * Functionality offered by the widget board to open a File Picker panel to select files.
288
+ * @param onFilePicked Function that's called when a file was picked. Returns the url of the picked file.
289
+ * @param options Options to change the behavior of the file picker
290
+ */
291
+ openFilePicker?: (onFilePicked: (fileUrl: string, fileProps: FilePickerFileProps) => void, options?: FilePickerOptions) => void;
292
+ /**
293
+ * Functionality offered by the widget board to open a url in an iframe dialog.
294
+ * @param url The url to open in a dialog.
295
+ * @param options Options to configure the dialog (e.g. size, margin, callbacks, ...)
296
+ */
297
+ openIFrameDialog?: (url: string, options?: IFrameDialogOptions) => void;
298
+ /**
299
+ * Provides access to the Teams SDK and Teams context. Only provided when the web part is loaded in Teams.
300
+ */
301
+ teamsSdk?: {
302
+ /**
303
+ * Microsoft Teams SDK.
304
+ */
305
+ teamsJs: any;
306
+ /**
307
+ * {@inheritDoc @microsoft/teams-js#Context}
308
+ */
309
+ context: any;
310
+ };
311
+ }
312
+ export interface ValidationResult {
313
+ isValid: boolean;
314
+ errors: string[];
315
+ }
316
+ export interface WidgetImages {
317
+ preview: string;
318
+ preview_small: string;
319
+ additional: string[];
320
+ }
321
+ export interface WidgetResource {
322
+ lang: number;
323
+ title: string;
324
+ subtitle?: string;
325
+ shortDescription: string;
326
+ instructions: string;
327
+ images: WidgetImages;
328
+ }
329
+ export interface WebApiPermissionRequest {
330
+ /**
331
+ * Specifies the name of the resource service principle to wich access has been granted. Use the same principle names as in a SPPKG packages webApiPermissionRequests.
332
+ */
333
+ resource: string;
334
+ /**
335
+ * Specifies the name of the scope claim that the resource application should expect in the OAuth 2.0 access token. Use the same scope names as in a SPPKG packages webApiPermissionRequests.
336
+ */
337
+ scope: string;
338
+ }
339
+ /**
340
+ * The widget manifest contains meta information about the widget
341
+ */
342
+ export interface WidgetManifestConfig {
343
+ /**
344
+ * Version of the widget manifest schema. The value of this field
345
+ * is controlled by Ichicraft. The purpose of this field is to help
346
+ * manage upgrades of the widget manifest schema.
347
+ * The current version is version 2, introducing externals + manifestVersion
348
+ * properties
349
+ */
350
+ manifestVersion: number;
351
+ /**
352
+ * Unique id to identify the widget
353
+ */
354
+ id: string;
355
+ /**
356
+ * Internal name for the widget, used internally by Ichicraft
357
+ */
358
+ name: string;
359
+ /**
360
+ * Version should contain the semver of this widget. For future use.
361
+ */
362
+ version: string;
363
+ /**
364
+ * The minimum number of rows this widget can inhabit in the widget board.
365
+ * By default, a widget always takes up 2 rows (and 1 column),
366
+ * If you want the widget to be able to shrink to 1 row, specify 1, otherwise, leave this
367
+ * property empty.
368
+ * _REMARK_: A value higher than 2 is considered invalid and will be ignored.
369
+ */
370
+ minRows: number;
371
+ /**
372
+ * The maximum number of rows this widget can inhabit in the widget board.
373
+ * By default, a widget always takes up 2 rows (and 1 column).
374
+ * Leave this empty and the maxRows will be defaulted to 2.
375
+ * Specify Inifinity to allow spanning any number of rows.
376
+ * _REMARK_: A value lower than 2 is considered invalid and will be ignored.
377
+ */
378
+ maxRows: number;
379
+ /**
380
+ * The maximum number of columns this widget can inhabit in the widget board.
381
+ * By default, a widget always takes up 1 column (and 2 rows).
382
+ * Leave this empty and the maxCols will be defaulted to 1.
383
+ * Specify Inifinity to allow spanning any number of columns.
384
+ * _REMARK_ A value lower than 1 is considered invalid and will be ignored.
385
+ */
386
+ maxCols: number;
387
+ /**
388
+ * Whether this widget is configurable by the user. Implementation of user config functions is necessary if true.
389
+ */
390
+ isConfigurableByUser: boolean;
391
+ /**
392
+ * Whether this widget is configurable by the board admin. Implementation of admin config functions is necessary if true.
393
+ */
394
+ isConfigurableByAdmin: boolean;
395
+ /**
396
+ * Internally used by Ichicraft
397
+ */
398
+ widgetBoardCompatibilityVersion?: number;
399
+ /**
400
+ * Icon used to represent this widget, used as default when installing a widget in the board. Icon should be the type id of a UI Fabric icon.
401
+ */
402
+ iconName: string;
403
+ /**
404
+ * Language specific resources for this widget, used as default when installing a widget in the board
405
+ */
406
+ resources: WidgetResource[];
407
+ /**
408
+ * Web API permission requests. Like SPPKG packages, the widget specifies required API permissions.
409
+ */
410
+ webApiPermissionRequests?: WebApiPermissionRequest[];
411
+ /**
412
+ * This is the url of the widget script. It should be a well formatted url that points
413
+ * to the script file's unique location. Script files should be hosted on a secure website (https).
414
+ */
415
+ scriptUrl: string;
416
+ /**
417
+ * File path used when debugging a widget, this is set automatically when you debug a widget
418
+ */
419
+ bundleFilePath?: string;
420
+ /**
421
+ * Added in manifestVersion 2
422
+ * Lists modules (package dependencies) that should be loaded separately from bundle.
423
+ * Libraries mentioned here will not be bundled when packed as a production release,
424
+ * instead, they will be loaded from the provided path (path points to a CDN or other file location)
425
+ */
426
+ externals?: {
427
+ [name: string]: {
428
+ /**
429
+ * Path to the script file. If this is a module (e.g. AMD or UMD), make sure you also
430
+ * specify the modules this module depends on as separate modules using the correct aliases.
431
+ */
432
+ path: string;
433
+ /**
434
+ * Used for non-AMD scripts to specify dependencies. Should point to other non-AMD modules
435
+ */
436
+ globalDependencies?: string[];
437
+ /**
438
+ * In case this isn't an AMD module, define the variable name used by the script to
439
+ * make the module available (i.e. global/root/window variable name like jQuery or $)
440
+ */
441
+ globalName?: string;
442
+ /**
443
+ * If this module has dependencies, map them here to other externals you also specified
444
+ * For instance: external @fluentui/react umd module has dependencies React and ReactDOM.
445
+ * To point these to the right externals, map them like this:
446
+ * React: react
447
+ * ReactDOM: 'react-dom'
448
+ * And make sure you specified 'react' and 'react-dom' as externals as well.
449
+ */
450
+ dependencyMappings?: {
451
+ [name: string]: string;
452
+ };
453
+ };
454
+ };
455
+ /**
456
+ * Everything related to analytics of this widget in Ichicraft Boards
457
+ */
458
+ analytics?: {
459
+ /**
460
+ * A list of time-based events this widget can raise. All the possible events MUST be
461
+ * described in this list for the widget board to be able to pick them up.
462
+ * @ref Use WidgetContext.instance.raiseEvent(object: string, action: string, data?: { [key: string]: string }) to raise these events
463
+ */
464
+ timeBasedEvents: {
465
+ /**
466
+ * The object this event concerns (e.g. app, report, newsArticle, ...). Use camelCase.
467
+ */
468
+ object: string;
469
+ /**
470
+ * The action that was performed to/on the object (e.g. viewed, clicked, deleted, ...). Use camelCase.
471
+ */
472
+ action: string;
473
+ /**
474
+ * A descriptive text used in the Administration panel to describe this event
475
+ */
476
+ description: string;
477
+ }[];
478
+ };
479
+ }
480
+ export declare enum DebugComponentType {
481
+ /**
482
+ * This is the default component type and just opens the default widget board.
483
+ */
484
+ Default = "Default",
485
+ /**
486
+ * This automatically opens the widget board administration panel and opens the widget admin config
487
+ * dialog of the widget you're working on
488
+ */
489
+ AdminConfig = "AdminConfig"
490
+ }
491
+ /**
492
+ * The widget debug serve config contains settings for debugging a widget in development
493
+ */
494
+ export interface WidgetDebugServeConfig {
495
+ /**
496
+ * Provide a url of a SharePoint site that hosts a widget board. This page will be opened
497
+ * as soon as you start debugging using [npm run start]
498
+ */
499
+ widgetsDebugPageUrl: string;
500
+ /**
501
+ * Provide a component type to open the debugging widget board with that specific component.
502
+ * This speeds up your development cycle: [npm run start] > save changes > builds automatically >
503
+ * refresh browser > automatically open updated component.
504
+ */
505
+ debugComponentType?: DebugComponentType;
506
+ }
507
+ export declare enum ICPersonaType {
508
+ User = 0,
509
+ SPGroup = 1,
510
+ Other = 2
511
+ }
512
+ export interface ICPersona {
513
+ displayName: string;
514
+ id: string;
515
+ type?: ICPersonaType;
516
+ }
517
+ /**
518
+ * Tells the severity of the command bar item, resulting in
519
+ * distinguishable presentation of the item
520
+ */
521
+ export declare enum CustomCommandBarItemSeverity {
522
+ /** Normal severity, displays just like all the other command bar items */
523
+ Normal = 0,
524
+ /** Warning severity, displays the item with a more noticable warning color */
525
+ Warning = 1
526
+ }
527
+ /**
528
+ * Properties to pass to the generateCommandBarItem function, resulting in the
529
+ * rendering of a command bar item, which could either be a single Icon or an Icon Button
530
+ */
531
+ export interface CustomCommandBarItemProps {
532
+ /**
533
+ * Optional identifier for the icon.
534
+ */
535
+ id?: string;
536
+ /**
537
+ * Name of the icon, as specified and available in Fluent UI Iconography:
538
+ * https://developer.microsoft.com/en-us/fluentui#/styles/web/icons
539
+ */
540
+ iconName: string;
541
+ /**
542
+ * Optional content to show as a tooltip above the item
543
+ */
544
+ tooltipContent?: string;
545
+ /**
546
+ * Optionally tells the tooltip to be shown automatically
547
+ */
548
+ showTooltipAutomatically?: boolean;
549
+ /**
550
+ * Optional severity to specify how the item should render
551
+ */
552
+ severity?: CustomCommandBarItemSeverity;
553
+ /**
554
+ * Optionally tells the Widget Header that this icon should always be visible, even when not hovering
555
+ */
556
+ pinned?: boolean;
557
+ /**
558
+ * Optionally display a red notification icon badge in the top-right corner of the button.
559
+ */
560
+ showNotificationBadge?: boolean;
561
+ /**
562
+ * Optionally provide an order in which this button should appear, when registering multiple custom buttons.
563
+ */
564
+ order?: number;
565
+ /**
566
+ * Optional onClick event, which is triggered on user click and makes the command
567
+ * bar item render as a button instead of a non-clickable icon
568
+ */
569
+ onClick?: () => void;
570
+ }
571
+ /**
572
+ * Options to pass to the openIFrameDialog function. Use this to configure how the dialog is rendered, and to handle events (e.g. onDismissed)
573
+ */
574
+ export interface IFrameDialogOptions {
575
+ /**
576
+ * Maximum width of the dialog. If it exceeds the window width, that width is used instead.
577
+ */
578
+ maxWidth?: number;
579
+ /**
580
+ * Maximum height of the dialog. If it exceeds the window height, that height is used instead.
581
+ */
582
+ maxHeight?: number;
583
+ /**
584
+ * Minimum margin on the left- and right side of the dialog.
585
+ */
586
+ marginHorizontal?: number;
587
+ /**
588
+ * Minimum margin on the top- and bottom side of the dialog.
589
+ */
590
+ marginVertical?: number;
591
+ /**
592
+ * This event is triggered when the iFrame dialog is dismissed by the user.
593
+ */
594
+ onDismissed?: () => void;
595
+ }
596
+ /**
597
+ * Options to pass to openFilePicker function
598
+ */
599
+ export interface FilePickerOptions {
600
+ /**
601
+ * Array of file extensions that will be used to filter the files in the picker.
602
+ * @default ['.gif', '.jpg', '.jpeg', '.png']
603
+ */
604
+ extensions?: string[];
605
+ /**
606
+ * Maximum number of files to show in a folder
607
+ * @default 100
608
+ */
609
+ itemsCountQueryLimit?: number;
610
+ /**
611
+ * Whether or not to hide the organisational site files tab
612
+ * @default false
613
+ */
614
+ hideOrganisationalAssetTab?: boolean;
615
+ /**
616
+ * Whether or not to hide the site files tab
617
+ * @default false
618
+ */
619
+ hideSiteFilesTab?: boolean;
620
+ /**
621
+ * Whether or not to hide the upload tab
622
+ * @default false
623
+ */
624
+ hideLocalUploadTab?: boolean;
625
+ /**
626
+ * Function that's called when user closes file picker without picking a file
627
+ * @default undefined
628
+ */
629
+ onCancel?: () => void;
630
+ }
631
+ export interface FilePickerFileProps {
632
+ /**
633
+ * Unique identifier of the file item in SharePoint, in the shape of a Guid.
634
+ */
635
+ uniqueId: string;
636
+ /**
637
+ * Unique identifier of the list in SharePoint, in the shape of a Guid.
638
+ */
639
+ listId: string;
640
+ /**
641
+ * Unique identifier of the site in SharePoint, in the shape of a Guid.
642
+ */
643
+ siteId: string;
644
+ }
645
+ export declare type BoardType = 'shared' | 'personal';
646
+ export declare type UserRole = 'administrator' | 'board-owner';