Skip to content

Commit e954947

Browse files
authored
Merge pull request #1558 from Tanddant/main
2 parents 4e8e5df + 721eec0 commit e954947

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

samples/react-company-templates/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ For more information about SPFx compatibility, please refer to <https://aka.ms/s
7575
- [Dan Toft](https://github.com/Tanddant) (👀 Code reviews)
7676
- [Nicolas Kheirlalah](https://github.com/nicolaskheirallah)
7777

78-
7978
## Version history
8079

8180
| Version | Date | Comments |
@@ -104,27 +103,32 @@ If you prefer using `fast-serve`, you can run the following command:
104103
## How to use the new features
105104

106105
### Advanced Filtering
106+
107107
1. Click the filter icon in the command bar to open the advanced filters panel
108108
2. Set date ranges using the date pickers to filter by modification date
109109
3. Use the file size slider to limit results by file size
110110
4. Click "Apply Filters" to see filtered results or "Clear Filters" to reset
111111

112112
### Template Preview
113+
113114
1. Click on any template filename to open a preview panel
114115
2. The preview shows file content for supported file types
115116
3. Preview panel displays additional metadata including file size, version, and creation/modification dates
116117

117118
### Version History
119+
118120
1. Click the history icon next to any template
119121
2. SharePoint's built-in version history page opens in a new tab
120122
3. View all versions and their details
121123

122124
### Grid View
125+
123126
1. Toggle between list and grid views using the toggle switch in the command bar
124127
2. Grid view displays templates in a column layout with more metadata visible
125128
3. Both views support selection, preview, and actions
126129

127130
### Bulk Operations
131+
128132
1. Select multiple templates using the checkboxes
129133
2. The number of selected items appears above the list
130134
3. Click "Download selected" to download all selected templates
@@ -165,4 +169,4 @@ Finally, if you have an idea for improvement, [make a suggestion](https://github
165169

166170
**THIS CODE IS PROVIDED _AS IS_ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
167171

168-
<img src="https://m365-visitor-stats.azurewebsites.net/sp-dev-fx-extensions/samples/react-company-templates" />
172+
<img src="https://m365-visitor-stats.azurewebsites.net/sp-dev-fx-extensions/samples/react-company-templates" />

samples/react-company-templates/assets/sample.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"This is an alternative to the built-in 'New document' experience in a document library in SharePoint Online. It allows a SharePoint admin to define a repository (such as a standard document library or an org assets library) which acts as a source of templates that can be used in every document library. Any user can browse through the collection of company templates, get an instance of the desired template(s) by one single click and start using it."
1111
],
1212
"creationDateTime": "2023-12-22",
13-
"updateDateTime": "2025-03-12",
13+
"updateDateTime": "2025-12-08",
1414
"products": [
1515
"SharePoint"
1616
],

samples/react-company-templates/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"ajv": "^6.12.5",
4242
"eslint": "8.57.0",
4343
"gulp": "4.0.2",
44+
"spfx-fast-serve-helpers": "^1.21.1",
4445
"typescript": "4.8.4"
4546
}
46-
}
47+
}

samples/react-company-templates/src/services/core/TemplateService.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ export class TemplateService implements ITemplateService {
111111
public async copyTemplates(targetFolderRelativeUrl: string, selectedFiles: any[]): Promise<IFile[]> {
112112
try {
113113
const files = await Promise.all(selectedFiles.map(async (file) => {
114-
const sourceWeb = await this.getWeb(file.data.webUrl);
114+
const data = file.data ? file.data : file;
115+
const sourceWeb = await this.getWeb(data.webUrl);
115116
return await sourceWeb.getFileById(file.data.id)
116117
.copyByPath(`${targetFolderRelativeUrl}/${file.data.fileLeafRef}`, false, {
117118
KeepBoth: false,
@@ -169,4 +170,4 @@ export class TemplateService implements ITemplateService {
169170
.replace(/"/g, "&quot;")
170171
.replace(/'/g, "&#039;");
171172
}
172-
}
173+
}

0 commit comments

Comments
 (0)