You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
6. When initial scaffolding is completed, enter the following to explicitly install the 5.x version of the Office UI Fabric to your solution:
63
+
6. When initial scaffolding is completed, enter the following to install Office UI Fabric to your solution:
64
64
65
65
```sh
66
-
npm install office-ui-fabric-react@5.132.0 --save
66
+
npm install office-ui-fabric-react --save
67
67
```
68
68
69
-
> [!NOTE]
70
-
> Starting with SharePoint Framework 1.8, you can use either Office UI Fabric version 5 or version 6. In this case we are using specifically Office UI Fabric version 5.143.0, so we are adding the needed dependency on it. If you would be using Office UI Fabric version 6.x, you'd also need to update the used TypeScript version of the solution.
71
-
72
69
7. Open your project folder in your code editor. This article uses Visual Studio Code in the steps and screenshots, but you can use any editor that you prefer. To open the folder in Visual Studio Code, use the following command in the console:
73
70
74
71
```sh
@@ -103,100 +100,98 @@ In the extension manifest, configure the extension to have only one button. In t
103
100
2. Add the following import statements at the top of the newly created file. You're creating your custom dialog box by using the [Office UI Fabric React components](https://developer.microsoft.com/en-us/fabric#/components), so the implementation is in React.
3. Add the following interface definition just under the import statements. This is used to pass information and functions between your ListView Command Set extension and your custom dialog box.
121
118
122
119
```typescript
123
-
interfaceIColorPickerDialogContentProps {
120
+
interfaceIColorPickerDialogContentProps {
124
121
message:string;
125
122
close: () =>void;
126
-
submit: (color:string) =>void;
127
-
defaultColor?:string;
128
-
}
123
+
submit: (color:IColor) =>void;
124
+
defaultColor?:IColor;
125
+
}
129
126
```
130
127
131
128
4. Add the following class just under the interface definition. This React class is responsible for rendering the UI experiences inside the custom dialog box. Notice that you use the Office UI Fabric React components for actual rendering and just pass the needed properties.
5. Add the following class definition for your custom dialog box under the `ColorPickerDialogContent` class that you just added. This is the actual custom dialog box that is called from the ListView Command Set button click and is inherited from the `BaseDialog`.
## Associate the dialog box with the ListView Command Set button click
@@ -205,16 +200,17 @@ To associate the custom dialog box with your custom ListView Command Set, add th
205
200
206
201
1. In the code editor, open the **DialogDemoCommandSet.ts** file from the **./src/extensions/dialogDemo/** folder.
207
202
208
-
2. Add the following import statements under the existing **strings** import. These are for using the custom dialog box in the context of your ListView Command Set.
203
+
2. Add the following import statements under the existing **strings** import. These are for using the custom dialog box in the context of your ListView Command Set and using the IColor type to pass colors to and from our dialog.
209
204
210
205
```typescript
211
206
importColorPickerDialogfrom'./ColorPickerDialog';
207
+
import { IColor } from'office-ui-fabric-react';
212
208
```
213
209
214
210
3. Add the following `_colorCode` variable definition above the `onInit` function in the `DialogDemoCommandSet` class. This is used to store the color picker dialog box result.
215
211
216
212
```typescript
217
-
private_colorCode: string;
213
+
private_colorCode: IColor;
218
214
```
219
215
220
216
4. Update the `onExecute` function as follows. This code does the following:
@@ -227,23 +223,25 @@ To associate the custom dialog box with your custom ListView Command Set, add th
227
223
* Shows the received value in a default dialog box by using the `Dialog.alert()` function.
0 commit comments