-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial release, doc lib and lists compatibility
- Loading branch information
Showing
28 changed files
with
526 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ lib | |
release | ||
debug | ||
temp | ||
solution/*.sppkg | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
// This file is based on https://gist.github.com/estruyf/fb444cfd0de7b3aabe4cb4711ad2118b | ||
|
||
"use strict"; | ||
|
||
const build = require("@microsoft/sp-build-web"); | ||
const gutil = require("gulp-util"); | ||
const fs = require("fs"); | ||
|
||
const elementsPath = "./sharepoint/assets/elements.xml"; | ||
const elementsSearchString = 'RegistrationId="'; | ||
const clientSideInstancePath = "./sharepoint/assets/ClientSideInstance.xml"; | ||
const clientSideInstanceSearchString = 'ListTemplateId="'; | ||
const listIdLength = 3; | ||
const customListId = 100; | ||
const docLibListId = 101; | ||
|
||
build.task("switch-list-type", { | ||
execute: (config) => { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
// Prepare | ||
const listType = config.args["list"] || "list"; | ||
let elementsXML = fs.existsSync(elementsPath) | ||
? fs.readFileSync(elementsPath).toString() | ||
: undefined; | ||
let clientSideInstanceXML = fs.existsSync(clientSideInstancePath) | ||
? fs.readFileSync(clientSideInstancePath).toString() | ||
: undefined; | ||
|
||
if (!elementsXML) { | ||
throw "Could not fetch the elements XML file content. Check the elements file path."; | ||
} | ||
|
||
if (!clientSideInstanceXML) { | ||
throw "Could not fetch the client side instance XML file content. Check the client side instance file path."; | ||
} | ||
|
||
if ( | ||
listType.toLowerCase() !== "doc" && | ||
listType.toLowerCase() !== "list" | ||
) { | ||
throw "Invalid argument. Please choose either 'doc' or 'list' as an argument."; | ||
} | ||
|
||
// Switch list type | ||
gutil.log( | ||
gutil.colors.magenta( | ||
`Switching list type to: ${ | ||
listType === "doc" ? "Document library" : "Custom list" | ||
}` | ||
) | ||
); | ||
|
||
gutil.log( | ||
gutil.colors.yellow( | ||
`Using list template ID: ${ | ||
listType === "doc" ? docLibListId : customListId | ||
}` | ||
) | ||
); | ||
let registrationIdStart = | ||
elementsXML.indexOf(elementsSearchString) + | ||
elementsSearchString.length; | ||
let currentRegistrationId = elementsXML.substring( | ||
registrationIdStart, | ||
registrationIdStart + listIdLength | ||
); | ||
let newRegistrationId = `${elementsSearchString}${ | ||
listType === "doc" ? docLibListId : customListId | ||
}`; | ||
|
||
elementsXML = elementsXML.replace( | ||
elementsSearchString + currentRegistrationId, | ||
newRegistrationId | ||
); | ||
|
||
fs.writeFileSync(elementsPath, elementsXML); | ||
|
||
let listTemplateIdStart = | ||
clientSideInstanceXML.indexOf(clientSideInstanceSearchString) + | ||
clientSideInstanceSearchString.length; | ||
let currentListTemplateId = clientSideInstanceXML.substring( | ||
listTemplateIdStart, | ||
listTemplateIdStart + listIdLength | ||
); | ||
let newListTemplateId = `${clientSideInstanceSearchString}${ | ||
listType === "doc" ? docLibListId : customListId | ||
}`; | ||
|
||
clientSideInstanceXML = clientSideInstanceXML.replace( | ||
clientSideInstanceSearchString + currentListTemplateId, | ||
newListTemplateId | ||
); | ||
|
||
fs.writeFileSync(clientSideInstancePath, clientSideInstanceXML); | ||
|
||
gutil.log( | ||
gutil.colors.green( | ||
`Successfully switched list type to: ${ | ||
listType === "doc" ? "Document library" : "Custom list" | ||
}!` | ||
) | ||
); | ||
|
||
resolve(); | ||
} catch (ex) { | ||
gutil.log(gutil.colors.red(ex)); | ||
|
||
reject(); | ||
} | ||
}); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
'use strict'; | ||
"use strict"; | ||
|
||
const build = require('@microsoft/sp-build-web'); | ||
const build = require("@microsoft/sp-build-web"); | ||
|
||
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`); | ||
build.addSuppression( | ||
`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.` | ||
); | ||
|
||
var getTasks = build.rig.getTasks; | ||
build.rig.getTasks = function () { | ||
var result = getTasks.call(build.rig); | ||
|
||
result.set('serve', result.get('serve-deprecated')); | ||
result.set("serve", result.get("serve-deprecated")); | ||
|
||
return result; | ||
}; | ||
|
||
build.initialize(require('gulp')); | ||
require("./gulpfile-switch-list-type"); | ||
|
||
build.initialize(require("gulp")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
[ | ||
{ | ||
"_fields": [ | ||
{ | ||
"id": { | ||
"_guid": "82642ec8-ef9b-478f-acf9-31f7d45fbc31" | ||
}, | ||
"internalName": "Title", | ||
"fieldType": "Computed", | ||
"isRequired": false, | ||
"displayName": "Title", | ||
"clientSideComponentId": { | ||
"_guid": "00000000-0000-0000-0000-000000000000" | ||
}, | ||
"clientSideComponentProperties": "" | ||
} | ||
], | ||
"_values": [ | ||
[ | ||
{ | ||
"key": "ID", | ||
"value": "1" | ||
}, | ||
{ | ||
"key": "PermMask", | ||
"value": "0x7fffffffffffffff" | ||
}, | ||
{ | ||
"key": "FSObjType", | ||
"value": "0" | ||
}, | ||
{ | ||
"key": "UniqueId", | ||
"value": "{30758281-57B5-44D2-877F-A837318D093F}" | ||
}, | ||
{ | ||
"key": "ContentTypeId", | ||
"value": "0x01009065A2AE4229A544BB9E5F5DE97BA03F0077E1F74ED448234FAC3198F205C065EC" | ||
}, | ||
{ | ||
"key": "FileRef", | ||
"value": "/sites/I_ontruimingsplannen/Lists/Test/1_.000" | ||
}, | ||
{ | ||
"key": "Attachments", | ||
"value": "0" | ||
}, | ||
{ | ||
"key": "SMTotalSize", | ||
"value": "182" | ||
}, | ||
{ | ||
"key": "_CommentFlags", | ||
"value": "" | ||
}, | ||
{ | ||
"key": "_CommentCount", | ||
"value": "" | ||
}, | ||
{ | ||
"key": "Title", | ||
"value": "Test1" | ||
}, | ||
{ | ||
"key": "FileLeafRef", | ||
"value": "1_.000" | ||
}, | ||
{ | ||
"key": "Created_x0020_Date", | ||
"value": "1;#2022-07-01 17:21:13" | ||
}, | ||
{ | ||
"key": "Created_x0020_Date.ifnew", | ||
"value": "1" | ||
}, | ||
{ | ||
"key": "File_x0020_Type", | ||
"value": "" | ||
}, | ||
{ | ||
"key": "File_x0020_Type.mapapp", | ||
"value": "" | ||
}, | ||
{ | ||
"key": "HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon", | ||
"value": "" | ||
}, | ||
{ | ||
"key": "HTML_x0020_File_x0020_Type.File_x0020_Type.mapico", | ||
"value": "" | ||
}, | ||
{ | ||
"key": "ItemChildCount", | ||
"value": "0" | ||
}, | ||
{ | ||
"key": "FolderChildCount", | ||
"value": "0" | ||
}, | ||
{ | ||
"key": "ScopeId", | ||
"value": "{B16AFEEA-604B-4A51-B5DA-9D1D7AB5FDB3}" | ||
}, | ||
{ | ||
"key": "owshiddenversion", | ||
"value": "1" | ||
}, | ||
{ | ||
"key": "Restricted", | ||
"value": "" | ||
} | ||
] | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> | ||
<ClientSideComponentInstance | ||
Title="EnhancedPowerAutomateTrigger" | ||
Location="ClientSideExtension.ListViewCommandSet.CommandBar" | ||
ListTemplateId="101" | ||
Properties="{"configListTitle":"Enhanced Power Automate Trigger Configuration"}" | ||
ComponentId="543ef5be-c9cb-4b7b-bdaf-592c7be1493a" /> | ||
<ClientSideComponentInstance Title="EnhancedPowerAutomateTrigger" Location="ClientSideExtension.ListViewCommandSet.CommandBar" ListTemplateId="100" Properties="{"configListTitle":"Enhanced Power Automate Trigger Configuration"}" ComponentId="817ae812-ac12-4047-accf-c9766b6a434a" /> | ||
</Elements> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> | ||
<CustomAction | ||
Title="EnhancedPowerAutomateTrigger" | ||
RegistrationId="101" | ||
RegistrationType="List" | ||
Location="ClientSideExtension.ListViewCommandSet.CommandBar" | ||
ClientSideComponentId="543ef5be-c9cb-4b7b-bdaf-592c7be1493a" | ||
ClientSideComponentProperties="{"configListTitle":"Enhanced Power Automate Trigger Configuration"}"> | ||
</CustomAction> | ||
<CustomAction Title="EnhancedPowerAutomateTrigger" RegistrationId="100" RegistrationType="List" Location="ClientSideExtension.ListViewCommandSet.CommandBar" ClientSideComponentId="817ae812-ac12-4047-accf-c9766b6a434a" ClientSideComponentProperties="{"configListTitle":"Enhanced Power Automate Trigger Configuration"}"> | ||
</CustomAction> | ||
<ListInstance CustomSchema="triggerConfigListSchema.xml" FeatureId="00bfea71-de22-43b2-a848-c05709900100" Title="Enhanced Power Automate Trigger Configuration" Description="" TemplateType="100" Url="Lists/EnhancedPowerAutomateTriggerConfiguration"> | ||
</ListInstance> | ||
</Elements> |
Oops, something went wrong.