@ichicraft/widgets-widget-base 1.8.8 → 1.8.10

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.10 - 2023-03-30
13
+
14
+ - Changed `openFilePicker` function to accept `options`, to support configuration of picker behavior
15
+
16
+ ## 1.8.9 - 2023-03-06
17
+
18
+ - Added `registerCustomCommandBarItems` function to the `instance` object of the `WidgetContext` interface, to support multiple custom buttons in the widget header.
19
+ - Added `unregisterCustomCommandBarItems` function to the `instance` object of the `WidgetContext` interface, to support removing all custom buttons in the widget header.
20
+ - Added optional `id` property to exported `CustomCommandBarItemProps` type, to support removing a custom command bar item by id.
21
+ - Added optional `pinned` property to exported `CustomCommandBarItemProps` type, to support forcing the widget header to always be visible.
22
+ - Added optional `showNotificationBadge` property to exported `CustomCommandBarItemProps` type, to support showing a red notification badge over the custom command bar item.
23
+ - Added optional `order` property to exported `CustomCommandBarItemProps` type, to support changing the order of custom command bar items.
24
+ - Changed `unregisterCustomCommandBarItem` function of the `instance` object of the `WidgetContext` interface, to support removing a custom command bar item by id.
25
+
12
26
  ## 1.8.8 - 2023-02-16
13
27
 
14
28
  - Removed all SharePoint and Teams dependencies.
@@ -62,6 +62,12 @@ export interface WidgetContext {
62
62
  * Optional callback to handle the click event of the widget title.
63
63
  */
64
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;
65
71
  /**
66
72
  * Allows registration of a custom command bar item which can either result in an icon or
67
73
  * an icon button, depending on the presence of the onClick property. To remove the item,
@@ -69,9 +75,14 @@ export interface WidgetContext {
69
75
  */
70
76
  registerCustomCommandBarItem?: (props: CustomCommandBarItemProps) => void;
71
77
  /**
72
- * 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.
73
84
  */
74
- unregisterCustomCommandBarItem?: () => void;
85
+ unregisterCustomCommandBarItem?: (id?: string) => void;
75
86
  /**
76
87
  * Raises an event to be handled by the Time-based Events feature of Ichicraft Boards.
77
88
  * @param object The object this event concerns (e.g. app, report, newsArticle, ...). Use camelCase.
@@ -84,7 +95,7 @@ export interface WidgetContext {
84
95
  }) => void;
85
96
  };
86
97
  /**
87
- * Metadata and functions in the context of a widget's definition. A widget definition is
98
+ * Metadata and functions in the context of a widget's variant (fka definition). A widget variant is
88
99
  * a widget that's been installed by an administrator from within the board administration.
89
100
  */
90
101
  definition: {
@@ -105,13 +116,12 @@ export interface WidgetContext {
105
116
  };
106
117
  /**
107
118
  * Metadata and functions in the context of a widget's manifest. A widget manifest contains
108
- * all information of the originally installed widget. If multiple instances of the same widget 'type'
109
- * exist in a widget board configuration, they share this manifest.
110
- * We use the term 'definition' to distinguish each instance of a manifest.
119
+ * all information of the originally installed widget. Multiple `variants` of the same widget `manifest`
120
+ * can exist in a widget board configuration.
111
121
  */
112
122
  manifest: {
113
123
  /**
114
- * Unique id of a widget 'type', also used in the widget manifest in the original script source manifest file.
124
+ * Unique id of a widget 'type', also used in the widget manifest config file in the original script source manifest file.
115
125
  * If this is a 'single instance widget', which means that no more than one instance of this
116
126
  * widget can be installed in the widget board, the id of the definition is the same as the id of the manifest.
117
127
  */
@@ -275,8 +285,10 @@ export interface WidgetContext {
275
285
  loadScript?: <TModule>(url: string, options?: any) => Promise<TModule>;
276
286
  /**
277
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
278
290
  */
279
- openFilePicker?: (onFilePicked: (fileUrl: string) => void, onCancel?: () => void) => void;
291
+ openFilePicker?: (onFilePicked: (fileUrl: string) => void, options?: FilePickerOptions) => void;
280
292
  /**
281
293
  * Functionality offered by the widget board to open a url in an iframe dialog.
282
294
  * @param url The url to open in a dialog.
@@ -337,7 +349,7 @@ export interface WidgetManifestConfig {
337
349
  */
338
350
  manifestVersion: number;
339
351
  /**
340
- * Unique id (Guid) to identify the widget
352
+ * Unique id to identify the widget
341
353
  */
342
354
  id: string;
343
355
  /**
@@ -518,6 +530,10 @@ export declare enum CustomCommandBarItemSeverity {
518
530
  * rendering of a command bar item, which could either be a single Icon or an Icon Button
519
531
  */
520
532
  export interface CustomCommandBarItemProps {
533
+ /**
534
+ * Optional identifier for the icon.
535
+ */
536
+ id?: string;
521
537
  /**
522
538
  * Name of the icon, as specified and available in Fluent UI Iconography:
523
539
  * https://developer.microsoft.com/en-us/fluentui#/styles/web/icons
@@ -535,6 +551,18 @@ export interface CustomCommandBarItemProps {
535
551
  * Optional severity to specify how the item should render
536
552
  */
537
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;
538
566
  /**
539
567
  * Optional onClick event, which is triggered on user click and makes the command
540
568
  * bar item render as a button instead of a non-clickable icon
@@ -566,5 +594,40 @@ export interface IFrameDialogOptions {
566
594
  */
567
595
  onDismissed?: () => void;
568
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
+ }
569
632
  export declare type BoardType = 'shared' | 'personal';
570
633
  export declare type UserRole = 'administrator' | 'board-owner';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ichicraft/widgets-widget-base",
3
- "version": "1.8.8",
3
+ "version": "1.8.10",
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",