@ichicraft/widgets-widget-base 1.8.7 → 1.8.9

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/README.md CHANGED
@@ -9,6 +9,20 @@ All notable changes to this project will be documented here.
9
9
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
10
10
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
11
11
 
12
+ ## 1.8.9 - 2023-03-06
13
+
14
+ - Added `registerCustomCommandBarItems` function to the `instance` object of the `WidgetContext` interface, to support multiple custom buttons in the widget header.
15
+ - Added `unregisterCustomCommandBarItems` function to the `instance` object of the `WidgetContext` interface, to support removing all custom buttons in the widget header.
16
+ - Added optional `id` property to exported `CustomCommandBarItemProps` type, to support removing a custom command bar item by id.
17
+ - Added optional `pinned` property to exported `CustomCommandBarItemProps` type, to support forcing the widget header to always be visible.
18
+ - Added optional `showNotificationBadge` property to exported `CustomCommandBarItemProps` type, to support showing a red notification badge over the custom command bar item.
19
+ - Added optional `order` property to exported `CustomCommandBarItemProps` type, to support changing the order of custom command bar items.
20
+ - Changed `unregisterCustomCommandBarItem` function of the `instance` object of the `WidgetContext` interface, to support removing a custom command bar item by id.
21
+
22
+ ## 1.8.8 - 2023-02-16
23
+
24
+ - Removed all SharePoint and Teams dependencies.
25
+
12
26
  ## 1.8.7 - 2022-12-13
13
27
 
14
28
  - Added `userRoles` property to the `WidgetContext` interface, to inform widgets of the roles of the current user.
@@ -1,6 +1,3 @@
1
- import { MSGraphClientFactory, AadTokenProviderFactory, AadHttpClientFactory } from '@microsoft/sp-http';
2
- import { IReadonlyTheme } from '@microsoft/sp-component-base';
3
- import * as microsoftTeams from '@microsoft/teams-js';
4
1
  /**
5
2
  * Widget context providing widget metadata and functionality offered by the widget board
6
3
  */
@@ -65,6 +62,12 @@ export interface WidgetContext {
65
62
  * Optional callback to handle the click event of the widget title.
66
63
  */
67
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;
68
71
  /**
69
72
  * Allows registration of a custom command bar item which can either result in an icon or
70
73
  * an icon button, depending on the presence of the onClick property. To remove the item,
@@ -72,9 +75,14 @@ export interface WidgetContext {
72
75
  */
73
76
  registerCustomCommandBarItem?: (props: CustomCommandBarItemProps) => void;
74
77
  /**
75
- * Removes the custom command bar item that was added by the [registerCommandBarItem] function
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.
76
84
  */
77
- unregisterCustomCommandBarItem?: () => void;
85
+ unregisterCustomCommandBarItem?: (id?: string) => void;
78
86
  /**
79
87
  * Raises an event to be handled by the Time-based Events feature of Ichicraft Boards.
80
88
  * @param object The object this event concerns (e.g. app, report, newsArticle, ...). Use camelCase.
@@ -231,19 +239,19 @@ export interface WidgetContext {
231
239
  /**
232
240
  * MS Graph Client Factory class as provided by the WebPartContext object.
233
241
  */
234
- msGraphClientFactory: MSGraphClientFactory;
242
+ msGraphClientFactory: any;
235
243
  /**
236
244
  * AAD Http Client Factory class as provided by the WebPartContext object.
237
245
  */
238
- aadHttpClientFactory: AadHttpClientFactory;
246
+ aadHttpClientFactory: any;
239
247
  /**
240
248
  * AAD Token Provider Factory class as provided by the WebPartContext object.
241
249
  */
242
- aadTokenProviderFactory: AadTokenProviderFactory;
250
+ aadTokenProviderFactory: any;
243
251
  /**
244
252
  * Currently in use theme (by SharePoint/Teams)
245
253
  */
246
- theme: IReadonlyTheme;
254
+ theme: any;
247
255
  /**
248
256
  * Returns whether or not the currently signed in user is part of an AAD security group.
249
257
  * Provide the guid of the group.
@@ -293,11 +301,11 @@ export interface WidgetContext {
293
301
  /**
294
302
  * Microsoft Teams SDK.
295
303
  */
296
- teamsJs: typeof microsoftTeams;
304
+ teamsJs: any;
297
305
  /**
298
306
  * {@inheritDoc @microsoft/teams-js#Context}
299
307
  */
300
- context: microsoftTeams.Context;
308
+ context: any;
301
309
  };
302
310
  }
303
311
  export interface ValidationResult {
@@ -521,6 +529,10 @@ export declare enum CustomCommandBarItemSeverity {
521
529
  * rendering of a command bar item, which could either be a single Icon or an Icon Button
522
530
  */
523
531
  export interface CustomCommandBarItemProps {
532
+ /**
533
+ * Optional identifier for the icon.
534
+ */
535
+ id?: string;
524
536
  /**
525
537
  * Name of the icon, as specified and available in Fluent UI Iconography:
526
538
  * https://developer.microsoft.com/en-us/fluentui#/styles/web/icons
@@ -538,6 +550,18 @@ export interface CustomCommandBarItemProps {
538
550
  * Optional severity to specify how the item should render
539
551
  */
540
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;
541
565
  /**
542
566
  * Optional onClick event, which is triggered on user click and makes the command
543
567
  * bar item render as a button instead of a non-clickable icon
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ichicraft/widgets-widget-base",
3
- "version": "1.8.7",
3
+ "version": "1.8.9",
4
4
  "description": "Part of the Widget Development Kit for building widgets for Ichicraft Boards",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -18,11 +18,6 @@
18
18
  "files": [
19
19
  "lib/**/*"
20
20
  ],
21
- "dependencies": {
22
- "@microsoft/sp-component-base": "^1.11.0",
23
- "@microsoft/sp-http": "1.11.0",
24
- "@microsoft/teams-js": "1.9.0"
25
- },
26
21
  "devDependencies": {
27
22
  "typescript": "^3.6.4"
28
23
  }