From 50e7a19b7e3b05d5c5bf29eea278c4d88cf9988c Mon Sep 17 00:00:00 2001 From: Russell Gove Date: Thu, 8 Feb 2024 12:04:35 -0500 Subject: [PATCH 1/3] Added siteAbsoluteUrl Para, --- .../IPropertyFieldFolderPicker.ts | 22 ++++---- .../folderPicker/PropertyFieldFolderPicker.ts | 51 ++++++++++--------- .../PropertyFieldFolderPickerHost.tsx | 3 +- 3 files changed, 43 insertions(+), 33 deletions(-) diff --git a/src/propertyFields/folderPicker/IPropertyFieldFolderPicker.ts b/src/propertyFields/folderPicker/IPropertyFieldFolderPicker.ts index 895a65e5..10199b4f 100644 --- a/src/propertyFields/folderPicker/IPropertyFieldFolderPicker.ts +++ b/src/propertyFields/folderPicker/IPropertyFieldFolderPicker.ts @@ -2,9 +2,13 @@ import { BaseComponentContext } from '@microsoft/sp-component-base'; import { IFolder } from '../../services/IFolderExplorerService'; export interface IPropertyFieldFolderPickerProps { - /** - * Current context - */ + /** +* Current context +*/ + siteAbsoluteUrl?: string; + /** + * Current context + */ context: BaseComponentContext; /** @@ -63,10 +67,10 @@ export interface IPropertyFieldFolderPickerProps { */ key: string; - } +} - export interface IPropertyFieldFolderPickerPropsInternal extends IPropertyFieldFolderPickerProps { - targetProperty: string; - onRender(elem: HTMLElement): void; - onDispose(elem: HTMLElement): void; - } +export interface IPropertyFieldFolderPickerPropsInternal extends IPropertyFieldFolderPickerProps { + targetProperty: string; + onRender(elem: HTMLElement): void; + onDispose(elem: HTMLElement): void; +} diff --git a/src/propertyFields/folderPicker/PropertyFieldFolderPicker.ts b/src/propertyFields/folderPicker/PropertyFieldFolderPicker.ts index f8357ff9..d65cacfe 100644 --- a/src/propertyFields/folderPicker/PropertyFieldFolderPicker.ts +++ b/src/propertyFields/folderPicker/PropertyFieldFolderPicker.ts @@ -24,6 +24,8 @@ class PropertyFieldFolderPickerBuilder implements IPropertyPaneField void): void { // eslint-disable-line @typescript-eslint/no-explicit-any const element: React.ReactElement = React.createElement(PropertyFieldFolderPickerHost, { - label: this.label, - targetProperty: this.targetProperty, - context: this.context, - rootFolder: this.rootFolder, - defaultFolder: this.defaultFolder, - onSelect: this.onSelect, - required: this.required, - canCreateFolders: this.canCreateFolders, - onDispose: this.dispose, - onRender: this.render, - onChange: changeCallback, - onPropertyChange: this.onPropertyChange, - properties: this.customProperties, - key: this.key, - disabled: this.disabled, - selectedFolder: this.selectedFolder + label: this.label, + targetProperty: this.targetProperty, + context: this.context, + rootFolder: this.rootFolder, + defaultFolder: this.defaultFolder, + onSelect: this.onSelect, + required: this.required, + canCreateFolders: this.canCreateFolders, + onDispose: this.dispose, + onRender: this.render, + onChange: changeCallback, + onPropertyChange: this.onPropertyChange, + properties: this.customProperties, + key: this.key, + disabled: this.disabled, + selectedFolder: this.selectedFolder, + siteAbsoluteUrl: this.siteAbsoluteUrl }); - // Calls the REACT content generator - ReactDom.render(element, elem); + // Calls the REACT content generator + ReactDom.render(element, elem); } /** @@ -135,7 +139,8 @@ export function PropertyFieldFolderPicker(targetProperty: string, properties: IP canCreateFolders: properties.canCreateFolders, defaultFolder: properties.defaultFolder, required: properties.required, - selectedFolder: properties.selectedFolder + selectedFolder: properties.selectedFolder, + siteAbsoluteUrl: properties.siteAbsoluteUrl }; //Calls the PropertyFieldFolderPickerPicker builder object //This object will simulate a PropertyFieldCustom to manage his rendering process diff --git a/src/propertyFields/folderPicker/PropertyFieldFolderPickerHost.tsx b/src/propertyFields/folderPicker/PropertyFieldFolderPickerHost.tsx index 1c43726d..5843e569 100644 --- a/src/propertyFields/folderPicker/PropertyFieldFolderPickerHost.tsx +++ b/src/propertyFields/folderPicker/PropertyFieldFolderPickerHost.tsx @@ -34,7 +34,7 @@ export default class PropertyFieldFolderPickerHost extends React.Component From f2c498284e55da6498682bbcb06c6279d80ec6d9 Mon Sep 17 00:00:00 2001 From: Russell Gove Date: Tue, 13 Feb 2024 15:03:08 -0500 Subject: [PATCH 2/3] update doc --- docs/documentation/docs/controls/PropertyFIeldFolderPicker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/documentation/docs/controls/PropertyFIeldFolderPicker.md b/docs/documentation/docs/controls/PropertyFIeldFolderPicker.md index 6ef7d9c1..e3c1bfb8 100644 --- a/docs/documentation/docs/controls/PropertyFIeldFolderPicker.md +++ b/docs/documentation/docs/controls/PropertyFIeldFolderPicker.md @@ -64,7 +64,7 @@ The `PropertyFieldFolderPicker` control can be configured with the following pro | disabled | boolean | no | Is the control disabled. | | canCreateFolders | boolean | no | Allow current user to create folders on the target location. If enabled, you need to ensure that the user has the required permissions. | | onSelect | (folder: IFolder): void | no | Callback function called after a folder is selected. | - +| siteAbsoluteUrl | string | no | The absolute url of the site you want to pick a folder from (if differenct than the site te wbpart ins installed on) | interface `IFolder` From b1dd48336e4432c1ed4838451feb9896ad058c62 Mon Sep 17 00:00:00 2001 From: Russell Gove Date: Tue, 13 Feb 2024 15:07:04 -0500 Subject: [PATCH 3/3] fix typo --- docs/documentation/docs/controls/PropertyFIeldFolderPicker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/documentation/docs/controls/PropertyFIeldFolderPicker.md b/docs/documentation/docs/controls/PropertyFIeldFolderPicker.md index e3c1bfb8..6f9e59ad 100644 --- a/docs/documentation/docs/controls/PropertyFIeldFolderPicker.md +++ b/docs/documentation/docs/controls/PropertyFIeldFolderPicker.md @@ -64,7 +64,7 @@ The `PropertyFieldFolderPicker` control can be configured with the following pro | disabled | boolean | no | Is the control disabled. | | canCreateFolders | boolean | no | Allow current user to create folders on the target location. If enabled, you need to ensure that the user has the required permissions. | | onSelect | (folder: IFolder): void | no | Callback function called after a folder is selected. | -| siteAbsoluteUrl | string | no | The absolute url of the site you want to pick a folder from (if differenct than the site te wbpart ins installed on) | +| siteAbsoluteUrl | string | no | The absolute url of the site you want to pick a folder from (if different than the site the webpart is installed on) | interface `IFolder`