@pnp/cli-microsoft365 10.4.0-beta.946980f → 10.4.0-beta.c93f9cd
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/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Auth.js +0 -4
- package/dist/appInsights.js +1 -1
- package/dist/config.js +1 -2
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.20.0.js +1 -1
- package/dist/m365/spo/commands/{tenant/tenant-homesite-list.js → homesite/homesite-list.js} +8 -4
- package/dist/m365/spo/commands/page/clientsidepages.js +101 -9
- package/dist/m365/spo/commands/page/page-clientsidewebpart-add.js +86 -48
- package/dist/m365/spo/commands/page/page-text-add.js +7 -1
- package/dist/m365/spo/commands.js +1 -0
- package/docs/docs/cmd/spo/{tenant/tenant-homesite-list.mdx → homesite/homesite-list.mdx} +9 -3
- package/docs/docs/cmd/spo/page/page-clientsidewebpart-add.mdx +11 -2
- package/package.json +1 -1
package/dist/Auth.js
CHANGED
|
@@ -91,25 +91,21 @@ export class Auth {
|
|
|
91
91
|
static initialize() {
|
|
92
92
|
this.cloudEndpoints[CloudType.USGov] = {
|
|
93
93
|
'https://graph.microsoft.com': 'https://graph.microsoft.com',
|
|
94
|
-
'https://graph.windows.net': 'https://graph.windows.net',
|
|
95
94
|
'https://management.azure.com/': 'https://management.usgovcloudapi.net/',
|
|
96
95
|
'https://login.microsoftonline.com': 'https://login.microsoftonline.com'
|
|
97
96
|
};
|
|
98
97
|
this.cloudEndpoints[CloudType.USGovHigh] = {
|
|
99
98
|
'https://graph.microsoft.com': 'https://graph.microsoft.us',
|
|
100
|
-
'https://graph.windows.net': 'https://graph.windows.net',
|
|
101
99
|
'https://management.azure.com/': 'https://management.usgovcloudapi.net/',
|
|
102
100
|
'https://login.microsoftonline.com': 'https://login.microsoftonline.us'
|
|
103
101
|
};
|
|
104
102
|
this.cloudEndpoints[CloudType.USGovDoD] = {
|
|
105
103
|
'https://graph.microsoft.com': 'https://dod-graph.microsoft.us',
|
|
106
|
-
'https://graph.windows.net': 'https://graph.windows.net',
|
|
107
104
|
'https://management.azure.com/': 'https://management.usgovcloudapi.net/',
|
|
108
105
|
'https://login.microsoftonline.com': 'https://login.microsoftonline.us'
|
|
109
106
|
};
|
|
110
107
|
this.cloudEndpoints[CloudType.China] = {
|
|
111
108
|
'https://graph.microsoft.com': 'https://microsoftgraph.chinacloudapi.cn',
|
|
112
|
-
'https://graph.windows.net': 'https://graph.chinacloudapi.cn',
|
|
113
109
|
'https://management.azure.com/': 'https://management.chinacloudapi.cn',
|
|
114
110
|
'https://login.microsoftonline.com': 'https://login.chinacloudapi.cn'
|
|
115
111
|
};
|
package/dist/appInsights.js
CHANGED
|
@@ -12,7 +12,7 @@ import url from 'url';
|
|
|
12
12
|
import { app } from './utils/app.js';
|
|
13
13
|
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
|
|
14
14
|
appInsights
|
|
15
|
-
.setup('6b908c80-d09f-4cf6-8274-e54349a0149a')
|
|
15
|
+
.setup('InstrumentationKey=6b908c80-d09f-4cf6-8274-e54349a0149a;IngestionEndpoint=https://westeurope-3.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=d42020c6-da32-44f7-bbb7-666f0b3a664d')
|
|
16
16
|
.setInternalLogging(false, false);
|
|
17
17
|
// append -dev to the version number when ran locally
|
|
18
18
|
// to distinguish production and dev version of the CLI
|
package/dist/config.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { app } from './utils/app.js';
|
|
2
2
|
export default {
|
|
3
3
|
allScopes: [
|
|
4
|
-
'https://graph.windows.net/Directory.AccessAsUser.All',
|
|
5
4
|
'https://management.azure.com/user_impersonation',
|
|
6
5
|
'https://admin.services.crm.dynamics.com/user_impersonation',
|
|
7
6
|
'https://graph.microsoft.com/AppCatalog.ReadWrite.All',
|
|
@@ -34,7 +33,7 @@ export default {
|
|
|
34
33
|
'https://graph.microsoft.com/Place.Read.All',
|
|
35
34
|
'https://graph.microsoft.com/Policy.Read.All',
|
|
36
35
|
'https://graph.microsoft.com/RecordsManagement.ReadWrite.All',
|
|
37
|
-
'https://graph.microsoft.com/Reports.
|
|
36
|
+
'https://graph.microsoft.com/Reports.Read.All',
|
|
38
37
|
'https://graph.microsoft.com/ReportSettings.ReadWrite.All',
|
|
39
38
|
'https://graph.microsoft.com/RoleAssignmentSchedule.ReadWrite.Directory',
|
|
40
39
|
'https://graph.microsoft.com/RoleEligibilitySchedule.Read.Directory',
|
|
@@ -49,8 +49,8 @@ export default [
|
|
|
49
49
|
new FN001034_DEP_microsoft_sp_adaptive_card_extension_base('1.20.0'),
|
|
50
50
|
new FN002001_DEVDEP_microsoft_sp_build_web('1.20.2'),
|
|
51
51
|
new FN002002_DEVDEP_microsoft_sp_module_interfaces('1.20.2'),
|
|
52
|
-
new FN002021_DEVDEP_rushstack_eslint_config('4.0.1'),
|
|
53
52
|
new FN002024_DEVDEP_eslint('8.57.0'),
|
|
53
|
+
new FN002021_DEVDEP_rushstack_eslint_config('4.0.1'),
|
|
54
54
|
new FN002022_DEVDEP_microsoft_eslint_plugin_spfx('1.20.2'),
|
|
55
55
|
new FN002023_DEVDEP_microsoft_eslint_config_spfx('1.20.2'),
|
|
56
56
|
new FN010001_YORC_version('1.20.0'),
|
|
@@ -2,17 +2,21 @@ import { odata } from '../../../../utils/odata.js';
|
|
|
2
2
|
import { spo } from '../../../../utils/spo.js';
|
|
3
3
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
4
4
|
import commands from '../../commands.js';
|
|
5
|
-
class
|
|
5
|
+
class SpoHomeSiteListCommand extends SpoCommand {
|
|
6
6
|
get name() {
|
|
7
|
-
return commands.
|
|
7
|
+
return commands.HOMESITE_LIST;
|
|
8
8
|
}
|
|
9
9
|
get description() {
|
|
10
10
|
return 'Lists all home sites';
|
|
11
11
|
}
|
|
12
|
+
alias() {
|
|
13
|
+
return [commands.TENANT_HOMESITE_LIST];
|
|
14
|
+
}
|
|
12
15
|
defaultProperties() {
|
|
13
16
|
return ['Url', 'Title'];
|
|
14
17
|
}
|
|
15
18
|
async commandAction(logger) {
|
|
19
|
+
await this.showDeprecationWarning(logger, commands.TENANT_HOMESITE_LIST, commands.HOMESITE_LIST);
|
|
16
20
|
try {
|
|
17
21
|
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.verbose);
|
|
18
22
|
const requestOptions = {
|
|
@@ -33,5 +37,5 @@ class SpoTenantHomeSiteListCommand extends SpoCommand {
|
|
|
33
37
|
}
|
|
34
38
|
}
|
|
35
39
|
}
|
|
36
|
-
export default new
|
|
37
|
-
//# sourceMappingURL=
|
|
40
|
+
export default new SpoHomeSiteListCommand();
|
|
41
|
+
//# sourceMappingURL=homesite-list.js.map
|
|
@@ -271,6 +271,12 @@ export class ClientSidePage {
|
|
|
271
271
|
for (let i = 0; i < this.sections.length; i++) {
|
|
272
272
|
html.push(this.sections[i].toHtml());
|
|
273
273
|
}
|
|
274
|
+
if (this.pageSettings) {
|
|
275
|
+
html.push(this.pageSettings.toHtml());
|
|
276
|
+
}
|
|
277
|
+
if (this.backgroundSettings) {
|
|
278
|
+
html.push(this.backgroundSettings.toHtml());
|
|
279
|
+
}
|
|
274
280
|
html.push("</div>");
|
|
275
281
|
return html.join("");
|
|
276
282
|
}
|
|
@@ -286,17 +292,23 @@ export class ClientSidePage {
|
|
|
286
292
|
// gather our controls from the supplied html
|
|
287
293
|
getBoundedDivMarkup(html, /<div\b[^>]*data-sp-canvascontrol[^>]*?>/i, markup => {
|
|
288
294
|
// get the control type
|
|
289
|
-
const ct = /controlType":(\d*?)
|
|
295
|
+
const ct = /controlType":(\d*?)(,|&)/i.exec(markup);
|
|
290
296
|
// if no control type is present this is a column which we give type 0 to let us process it
|
|
291
|
-
const controlType = ct == null || ct.length <
|
|
297
|
+
const controlType = ct == null || ct.length < 0 ? -1 : parseInt(ct[1], 10);
|
|
292
298
|
let control = null;
|
|
293
299
|
switch (controlType) {
|
|
294
|
-
case
|
|
300
|
+
case -1:
|
|
295
301
|
// empty canvas column
|
|
296
302
|
control = new CanvasColumn(null, 0);
|
|
297
303
|
control.fromHtml(markup);
|
|
298
304
|
page.mergeColumnToTree(control);
|
|
299
305
|
break;
|
|
306
|
+
case 0:
|
|
307
|
+
// page settings
|
|
308
|
+
control = new PageSettings();
|
|
309
|
+
control.fromHtml(markup);
|
|
310
|
+
page.pageSettings = control;
|
|
311
|
+
break;
|
|
300
312
|
case 3:
|
|
301
313
|
// client side webpart
|
|
302
314
|
control = new ClientSideWebpart("");
|
|
@@ -309,6 +321,12 @@ export class ClientSidePage {
|
|
|
309
321
|
control.fromHtml(markup);
|
|
310
322
|
page.mergePartToTree(control);
|
|
311
323
|
break;
|
|
324
|
+
case 14:
|
|
325
|
+
// backgroundSection
|
|
326
|
+
control = new BackgroundSettings();
|
|
327
|
+
control.fromHtml(markup);
|
|
328
|
+
page.backgroundSettings = control;
|
|
329
|
+
break;
|
|
312
330
|
}
|
|
313
331
|
});
|
|
314
332
|
// refresh all the orders within the tree
|
|
@@ -364,7 +382,7 @@ export class ClientSidePage {
|
|
|
364
382
|
}
|
|
365
383
|
const sections = this.sections.filter(s => s.order === zoneIndex);
|
|
366
384
|
if (sections.length < 1) {
|
|
367
|
-
section = new CanvasSection(this, zoneIndex);
|
|
385
|
+
section = new CanvasSection(this, zoneIndex, [], control?.controlData?.position.zoneId, control.controlData?.zoneGroupMetadata);
|
|
368
386
|
this.sections.push(section);
|
|
369
387
|
}
|
|
370
388
|
else {
|
|
@@ -392,7 +410,7 @@ export class ClientSidePage {
|
|
|
392
410
|
let section = null;
|
|
393
411
|
const sections = this.sections.filter(s => s.order === order);
|
|
394
412
|
if (sections.length < 1) {
|
|
395
|
-
section = new CanvasSection(this, order);
|
|
413
|
+
section = new CanvasSection(this, order, [], column.controlData?.position?.zoneId, column.controlData?.zoneGroupMetadata);
|
|
396
414
|
this.sections.push(section);
|
|
397
415
|
}
|
|
398
416
|
else {
|
|
@@ -403,10 +421,12 @@ export class ClientSidePage {
|
|
|
403
421
|
}
|
|
404
422
|
}
|
|
405
423
|
export class CanvasSection {
|
|
406
|
-
constructor(page, order, columns = []) {
|
|
424
|
+
constructor(page, order, columns = [], zoneId, zoneGroupMetadata) {
|
|
407
425
|
this.page = page;
|
|
408
426
|
this.order = order;
|
|
409
427
|
this.columns = columns;
|
|
428
|
+
this.zoneId = zoneId;
|
|
429
|
+
this.zoneGroupMetadata = zoneGroupMetadata;
|
|
410
430
|
}
|
|
411
431
|
/**
|
|
412
432
|
* Default column (this.columns[0]) for this section
|
|
@@ -457,6 +477,20 @@ class CanvasControl {
|
|
|
457
477
|
this.id = this.controlData.id;
|
|
458
478
|
}
|
|
459
479
|
}
|
|
480
|
+
export class PageSettings extends CanvasControl {
|
|
481
|
+
constructor() {
|
|
482
|
+
super(0, "1.0");
|
|
483
|
+
}
|
|
484
|
+
getControlData() {
|
|
485
|
+
return this.controlData;
|
|
486
|
+
}
|
|
487
|
+
toHtml() {
|
|
488
|
+
return `<div data-sp-canvascontrol="" data-sp-canvasdataversion="${this.dataVersion}" data-sp-controldata="${this.jsonData}"></div>`;
|
|
489
|
+
}
|
|
490
|
+
fromHtml(html) {
|
|
491
|
+
super.fromHtml(html);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
460
494
|
export class CanvasColumn extends CanvasControl {
|
|
461
495
|
constructor(section, order, factor = 12, controls = [], dataVersion = "1.0") {
|
|
462
496
|
super(0, dataVersion);
|
|
@@ -513,8 +547,10 @@ export class CanvasColumn extends CanvasControl {
|
|
|
513
547
|
position: {
|
|
514
548
|
sectionFactor: this.factor,
|
|
515
549
|
sectionIndex: this.order,
|
|
516
|
-
zoneIndex: this.section ? this.section.order : 0
|
|
550
|
+
zoneIndex: this.section ? this.section.order : 0,
|
|
551
|
+
zoneId: this.section?.zoneId
|
|
517
552
|
},
|
|
553
|
+
zoneGroupMetadata: this.section?.zoneGroupMetadata,
|
|
518
554
|
};
|
|
519
555
|
}
|
|
520
556
|
/**
|
|
@@ -543,6 +579,58 @@ export class ClientSidePart extends CanvasControl {
|
|
|
543
579
|
}
|
|
544
580
|
}
|
|
545
581
|
}
|
|
582
|
+
export class BackgroundSettings extends ClientSidePart {
|
|
583
|
+
constructor() {
|
|
584
|
+
super(0, "1.0");
|
|
585
|
+
this.propertieJson = {};
|
|
586
|
+
this.serverProcessedContent = null;
|
|
587
|
+
}
|
|
588
|
+
getControlData() {
|
|
589
|
+
return {
|
|
590
|
+
controlType: this.controlType
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
toHtml() {
|
|
594
|
+
// will form the value of the data-sp-webpartdata attribute
|
|
595
|
+
const data = {
|
|
596
|
+
dataVersion: this.dataVersion,
|
|
597
|
+
instanceId: this.id,
|
|
598
|
+
properties: this.propertieJson,
|
|
599
|
+
serverProcessedContent: this.serverProcessedContent,
|
|
600
|
+
};
|
|
601
|
+
const html = [];
|
|
602
|
+
html.push(`<div data-sp-canvascontrol="" data-sp-canvasdataversion="${this.dataVersion}" data-sp-controldata="${this.jsonData}">`);
|
|
603
|
+
html.push(`<div data-sp-webpart="" data-sp-webpartdataversion="${this.dataVersion}" data-sp-webpartdata="${ClientSidePage.jsonToEscapedString(data)}">`);
|
|
604
|
+
html.push(`<div data-sp-componentid="">`);
|
|
605
|
+
html.push("</div>");
|
|
606
|
+
html.push(`<div data-sp-htmlproperties="">`);
|
|
607
|
+
for (let imageSource in this.serverProcessedContent?.imageSources) {
|
|
608
|
+
html.push(`<img data-sp-prop-name="${imageSource}" src="${this.serverProcessedContent?.imageSources[imageSource]}" />`);
|
|
609
|
+
}
|
|
610
|
+
html.push("</div>");
|
|
611
|
+
html.push("</div>");
|
|
612
|
+
html.push("</div>");
|
|
613
|
+
return html.join("");
|
|
614
|
+
}
|
|
615
|
+
setProperties(properties) {
|
|
616
|
+
this.propertieJson = extend(this.propertieJson, properties);
|
|
617
|
+
return this;
|
|
618
|
+
}
|
|
619
|
+
fromHtml(html) {
|
|
620
|
+
super.fromHtml(html);
|
|
621
|
+
const webPartData = ClientSidePage.escapedStringToJson(getAttrValueFromString(html, "data-sp-webpartdata"));
|
|
622
|
+
this.setProperties(webPartData.properties);
|
|
623
|
+
if (typeof webPartData.serverProcessedContent !== "undefined") {
|
|
624
|
+
this.serverProcessedContent = webPartData.serverProcessedContent;
|
|
625
|
+
}
|
|
626
|
+
if (typeof webPartData.dynamicDataPaths !== "undefined") {
|
|
627
|
+
this.dynamicDataPaths = webPartData.dynamicDataPaths;
|
|
628
|
+
}
|
|
629
|
+
if (typeof webPartData.dynamicDataValues !== "undefined") {
|
|
630
|
+
this.dynamicDataValues = webPartData.dynamicDataValues;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
546
634
|
export class ClientSideText extends ClientSidePart {
|
|
547
635
|
constructor(text = "") {
|
|
548
636
|
super(4, "1.0");
|
|
@@ -570,8 +658,10 @@ export class ClientSideText extends ClientSidePart {
|
|
|
570
658
|
controlIndex: this.order,
|
|
571
659
|
sectionFactor: this.column ? this.column.factor : 0,
|
|
572
660
|
sectionIndex: this.column ? this.column.order : 0,
|
|
573
|
-
zoneIndex: this.column && this.column.section ? this.column.section.order : 0
|
|
661
|
+
zoneIndex: this.column && this.column.section ? this.column.section.order : 0,
|
|
662
|
+
zoneId: this.column?.section?.zoneId
|
|
574
663
|
},
|
|
664
|
+
zoneGroupMetadata: this.column?.section?.zoneGroupMetadata,
|
|
575
665
|
};
|
|
576
666
|
}
|
|
577
667
|
toHtml(index) {
|
|
@@ -684,9 +774,11 @@ export class ClientSideWebpart extends ClientSidePart {
|
|
|
684
774
|
controlIndex: this.order,
|
|
685
775
|
sectionFactor: this.column ? this.column.factor : 0,
|
|
686
776
|
sectionIndex: this.column ? this.column.order : 0,
|
|
687
|
-
zoneIndex: this.column && this.column.section ? this.column.section.order : 0
|
|
777
|
+
zoneIndex: this.column && this.column.section ? this.column.section.order : 0,
|
|
778
|
+
zoneId: this.column?.section?.zoneId
|
|
688
779
|
},
|
|
689
780
|
webPartId: this.webPartId,
|
|
781
|
+
zoneGroupMetadata: this.column?.section?.zoneGroupMetadata,
|
|
690
782
|
};
|
|
691
783
|
}
|
|
692
784
|
renderHtmlProperties() {
|
|
@@ -80,59 +80,18 @@ class SpoPageClientSideWebPartAddCommand extends SpoCommand {
|
|
|
80
80
|
await logger.logToStderr(`Setting client-side web part layout and properties...`);
|
|
81
81
|
}
|
|
82
82
|
await this.setWebPartProperties(webPart, logger, args);
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
controlIndex: 1,
|
|
88
|
-
sectionIndex: 1,
|
|
89
|
-
zoneIndex: 1,
|
|
90
|
-
sectionFactor: 12,
|
|
91
|
-
layoutIndex: 1
|
|
92
|
-
},
|
|
93
|
-
emphasis: {},
|
|
94
|
-
displayMode: 2
|
|
95
|
-
};
|
|
96
|
-
canvasContent.unshift(defaultSection);
|
|
97
|
-
}
|
|
98
|
-
// get unique zoneIndex values given each section can have 1 or more
|
|
99
|
-
// columns each assigned to the zoneIndex of the corresponding section
|
|
100
|
-
const zoneIndices = canvasContent
|
|
101
|
-
.filter(c => c.position)
|
|
102
|
-
.map(c => c.position.zoneIndex)
|
|
103
|
-
.filter((value, index, array) => {
|
|
104
|
-
return array.indexOf(value) === index;
|
|
105
|
-
})
|
|
106
|
-
.sort((a, b) => a - b);
|
|
107
|
-
// get section number. if not specified, get the last section
|
|
108
|
-
const section = args.options.section || zoneIndices.length;
|
|
109
|
-
if (section > zoneIndices.length) {
|
|
110
|
-
throw `Invalid section '${section}'`;
|
|
111
|
-
}
|
|
112
|
-
// zoneIndex that represents the section where the web part should be added
|
|
113
|
-
const zoneIndex = zoneIndices[section - 1];
|
|
114
|
-
const column = args.options.column || 1;
|
|
115
|
-
// we need the index of the control in the array so that we know which
|
|
116
|
-
// item to replace or where to add the web part
|
|
117
|
-
const controlIndex = canvasContent
|
|
118
|
-
.findIndex(c => c.position &&
|
|
119
|
-
c.position.zoneIndex === zoneIndex &&
|
|
120
|
-
c.position.sectionIndex === column);
|
|
121
|
-
if (controlIndex === -1) {
|
|
122
|
-
throw `Invalid column '${args.options.column}'`;
|
|
123
|
-
}
|
|
124
|
-
// get the first control that matches section and column
|
|
125
|
-
// if it's a empty column, it should be replaced with the web part
|
|
126
|
-
// if it's a web part, then we need to determine if there are other
|
|
127
|
-
// web parts and where in the array the new web part should be put
|
|
128
|
-
const control = canvasContent[controlIndex];
|
|
83
|
+
const control = this.getCorrectControl(canvasContent, args);
|
|
84
|
+
const controlIndex = canvasContent.indexOf(control);
|
|
85
|
+
const zoneIndex = control.position.zoneIndex;
|
|
86
|
+
const column = control.position.sectionIndex;
|
|
129
87
|
const webPartControl = this.extend({
|
|
130
88
|
controlType: 3,
|
|
131
89
|
displayMode: 2,
|
|
132
90
|
id: webPart.id,
|
|
133
91
|
position: Object.assign({}, control.position),
|
|
134
92
|
webPartId: webPart.webPartId,
|
|
135
|
-
emphasis: {}
|
|
93
|
+
emphasis: {},
|
|
94
|
+
zoneGroupMetadata: control.zoneGroupMetadata
|
|
136
95
|
}, webPart);
|
|
137
96
|
if (!control.controlType) {
|
|
138
97
|
// it's an empty column so we need to replace it with the web part
|
|
@@ -293,6 +252,76 @@ class SpoPageClientSideWebPartAddCommand extends SpoCommand {
|
|
|
293
252
|
webPart.id = webPart.webPartData.instanceId;
|
|
294
253
|
}
|
|
295
254
|
}
|
|
255
|
+
getCorrectControl(canvasContent, args) {
|
|
256
|
+
// get Vertical section
|
|
257
|
+
if (args.options.verticalSection) {
|
|
258
|
+
let verticalSection = canvasContent
|
|
259
|
+
.find(c => c.position?.layoutIndex === 2);
|
|
260
|
+
//if vertical section does not exist, create it
|
|
261
|
+
if (!verticalSection) {
|
|
262
|
+
verticalSection = {
|
|
263
|
+
position: {
|
|
264
|
+
controlIndex: 1,
|
|
265
|
+
sectionIndex: 1,
|
|
266
|
+
zoneIndex: 1,
|
|
267
|
+
sectionFactor: 12,
|
|
268
|
+
layoutIndex: 2
|
|
269
|
+
},
|
|
270
|
+
emphasis: {},
|
|
271
|
+
displayMode: 2
|
|
272
|
+
};
|
|
273
|
+
canvasContent.unshift(verticalSection);
|
|
274
|
+
}
|
|
275
|
+
return verticalSection;
|
|
276
|
+
}
|
|
277
|
+
// if no section exists (canvasContent array only has 1 default object), add a default section (1 col)
|
|
278
|
+
if (canvasContent.length === 1) {
|
|
279
|
+
const defaultSection = {
|
|
280
|
+
position: {
|
|
281
|
+
controlIndex: 1,
|
|
282
|
+
sectionIndex: 1,
|
|
283
|
+
zoneIndex: 1,
|
|
284
|
+
sectionFactor: 12,
|
|
285
|
+
layoutIndex: 1
|
|
286
|
+
},
|
|
287
|
+
emphasis: {},
|
|
288
|
+
displayMode: 2
|
|
289
|
+
};
|
|
290
|
+
canvasContent.unshift(defaultSection);
|
|
291
|
+
}
|
|
292
|
+
// get unique zoneIndex values given each section can have 1 or more
|
|
293
|
+
// columns each assigned to the zoneIndex of the corresponding section
|
|
294
|
+
const zoneIndices = canvasContent
|
|
295
|
+
// Exclude the vertical section
|
|
296
|
+
.filter(c => c.position)
|
|
297
|
+
.map(c => c.position.zoneIndex)
|
|
298
|
+
.filter((value, index, array) => {
|
|
299
|
+
return array.indexOf(value) === index;
|
|
300
|
+
})
|
|
301
|
+
.sort((a, b) => a - b);
|
|
302
|
+
// get section number. if not specified, get the last section
|
|
303
|
+
const section = args.options.section || zoneIndices.length;
|
|
304
|
+
if (section > zoneIndices.length) {
|
|
305
|
+
throw `Invalid section '${section}'`;
|
|
306
|
+
}
|
|
307
|
+
// zoneIndex that represents the section where the web part should be added
|
|
308
|
+
const zoneIndex = zoneIndices[section - 1];
|
|
309
|
+
const column = args.options.column || 1;
|
|
310
|
+
// we need the index of the control in the array so that we know which
|
|
311
|
+
// item to replace or where to add the web part
|
|
312
|
+
const controlIndex = canvasContent
|
|
313
|
+
.findIndex(c => c.position &&
|
|
314
|
+
c.position.zoneIndex === zoneIndex &&
|
|
315
|
+
c.position.sectionIndex === column);
|
|
316
|
+
if (controlIndex === -1) {
|
|
317
|
+
throw `Invalid column '${args.options.column}'`;
|
|
318
|
+
}
|
|
319
|
+
// get the first control that matches section and column
|
|
320
|
+
// if it's a empty column, it should be replaced with the web part
|
|
321
|
+
// if it's a web part, then we need to determine if there are other
|
|
322
|
+
// web parts and where in the array the new web part should be put
|
|
323
|
+
return canvasContent[controlIndex];
|
|
324
|
+
}
|
|
296
325
|
/**
|
|
297
326
|
* Provides functionality to extend the given object by doing a shallow copy
|
|
298
327
|
*
|
|
@@ -317,7 +346,8 @@ _SpoPageClientSideWebPartAddCommand_instances = new WeakSet(), _SpoPageClientSid
|
|
|
317
346
|
webPartProperties: typeof args.options.webPartProperties !== 'undefined',
|
|
318
347
|
section: typeof args.options.section !== 'undefined',
|
|
319
348
|
column: typeof args.options.column !== 'undefined',
|
|
320
|
-
order: typeof args.options.order !== 'undefined'
|
|
349
|
+
order: typeof args.options.order !== 'undefined',
|
|
350
|
+
verticalSection: !!args.options.verticalSection
|
|
321
351
|
});
|
|
322
352
|
});
|
|
323
353
|
}, _SpoPageClientSideWebPartAddCommand_initOptions = function _SpoPageClientSideWebPartAddCommand_initOptions() {
|
|
@@ -339,6 +369,8 @@ _SpoPageClientSideWebPartAddCommand_instances = new WeakSet(), _SpoPageClientSid
|
|
|
339
369
|
option: '--column [column]'
|
|
340
370
|
}, {
|
|
341
371
|
option: '--order [order]'
|
|
372
|
+
}, {
|
|
373
|
+
option: '--verticalSection'
|
|
342
374
|
});
|
|
343
375
|
}, _SpoPageClientSideWebPartAddCommand_initValidators = function _SpoPageClientSideWebPartAddCommand_initValidators() {
|
|
344
376
|
this.validators.push(async (args) => {
|
|
@@ -375,6 +407,12 @@ _SpoPageClientSideWebPartAddCommand_instances = new WeakSet(), _SpoPageClientSid
|
|
|
375
407
|
if (args.options.column && (!Number.isInteger(args.options.column) || args.options.column < 1)) {
|
|
376
408
|
return 'The value of parameter column must be 1 or higher';
|
|
377
409
|
}
|
|
410
|
+
if (args.options.section && args.options.verticalSection) {
|
|
411
|
+
return 'Specify section or verticalSection but not both';
|
|
412
|
+
}
|
|
413
|
+
if (args.options.column && args.options.verticalSection) {
|
|
414
|
+
return 'Use column in combination with section, not with verticalSection';
|
|
415
|
+
}
|
|
378
416
|
return validation.isValidSharePointUrl(args.options.webUrl);
|
|
379
417
|
});
|
|
380
418
|
}, _SpoPageClientSideWebPartAddCommand_initOptionSets = function _SpoPageClientSideWebPartAddCommand_initOptionSets() {
|
|
@@ -10,7 +10,7 @@ import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
|
10
10
|
import { validation } from '../../../../utils/validation.js';
|
|
11
11
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
12
12
|
import commands from '../../commands.js';
|
|
13
|
-
import { ClientSideText } from './clientsidepages.js';
|
|
13
|
+
import { CanvasSection, ClientSideText } from './clientsidepages.js';
|
|
14
14
|
import { Page } from './Page.js';
|
|
15
15
|
class SpoPageTextAddCommand extends SpoCommand {
|
|
16
16
|
get name() {
|
|
@@ -46,6 +46,12 @@ class SpoPageTextAddCommand extends SpoCommand {
|
|
|
46
46
|
const page = await Page.getPage(pageName, args.options.webUrl, logger, this.debug, this.verbose);
|
|
47
47
|
const section = (args.options.section || 1) - 1;
|
|
48
48
|
const column = (args.options.column || 1) - 1;
|
|
49
|
+
// Add a new section when page does not contain any sections
|
|
50
|
+
if (page.sections.length < 1) {
|
|
51
|
+
const newSection = new CanvasSection(page, 1);
|
|
52
|
+
newSection.defaultColumn;
|
|
53
|
+
page.sections.push(newSection);
|
|
54
|
+
}
|
|
49
55
|
// Make sure the section is in range
|
|
50
56
|
if (section >= page.sections.length) {
|
|
51
57
|
throw new Error(`Invalid section '${section + 1}'`);
|
|
@@ -117,6 +117,7 @@ export default {
|
|
|
117
117
|
HIDEDEFAULTTHEMES_GET: `${prefix} hidedefaultthemes get`,
|
|
118
118
|
HIDEDEFAULTTHEMES_SET: `${prefix} hidedefaultthemes set`,
|
|
119
119
|
HOMESITE_GET: `${prefix} homesite get`,
|
|
120
|
+
HOMESITE_LIST: `${prefix} homesite list`,
|
|
120
121
|
HOMESITE_REMOVE: `${prefix} homesite remove`,
|
|
121
122
|
HOMESITE_SET: `${prefix} homesite set`,
|
|
122
123
|
HUBSITE_CONNECT: `${prefix} hubsite connect`,
|
|
@@ -2,12 +2,18 @@ import Global from '/docs/cmd/_global.mdx';
|
|
|
2
2
|
import Tabs from '@theme/Tabs';
|
|
3
3
|
import TabItem from '@theme/TabItem';
|
|
4
4
|
|
|
5
|
-
# spo
|
|
5
|
+
# spo homesite list
|
|
6
6
|
|
|
7
7
|
Lists all home sites
|
|
8
8
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
|
11
|
+
```sh
|
|
12
|
+
m365 spo homesite list [options]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Alias
|
|
16
|
+
|
|
11
17
|
```sh
|
|
12
18
|
m365 spo tenant homesite list [options]
|
|
13
19
|
```
|
|
@@ -21,7 +27,7 @@ m365 spo tenant homesite list [options]
|
|
|
21
27
|
List all home sites
|
|
22
28
|
|
|
23
29
|
```sh
|
|
24
|
-
m365 spo
|
|
30
|
+
m365 spo homesite list
|
|
25
31
|
```
|
|
26
32
|
|
|
27
33
|
## Response
|
|
@@ -72,7 +78,7 @@ m365 spo tenant homesite list
|
|
|
72
78
|
<TabItem value="Markdown">
|
|
73
79
|
|
|
74
80
|
```md
|
|
75
|
-
# spo
|
|
81
|
+
# spo homesite list
|
|
76
82
|
|
|
77
83
|
Date: 11/18/2024
|
|
78
84
|
|
|
@@ -32,13 +32,16 @@ m365 spo page clientsidewebpart add [options]
|
|
|
32
32
|
: JSON string with web part data as retrieved from the web part maintenance mode. Specify either `webPartProperties` or `webPartData` but not both.
|
|
33
33
|
|
|
34
34
|
`--section [section]`
|
|
35
|
-
: Number of the section to which the web part should be added (1 or higher).
|
|
35
|
+
: Number of the section to which the web part should be added (1 or higher). Specify `section` or `verticalSection` but not both.
|
|
36
36
|
|
|
37
37
|
`--column [column]`
|
|
38
|
-
: Number of the column in which the web part should be added (1 or higher).
|
|
38
|
+
: Number of the column in which the web part should be added (1 or higher). Use `column` in combination with `section`, not with `verticalSection`.
|
|
39
39
|
|
|
40
40
|
`--order [order]`
|
|
41
41
|
: Order of the web part in the column.
|
|
42
|
+
|
|
43
|
+
`--verticalSection`
|
|
44
|
+
: Specifies that the web part should be added to the vertical section.
|
|
42
45
|
```
|
|
43
46
|
|
|
44
47
|
<Global />
|
|
@@ -87,6 +90,12 @@ Add the standard Image web part with the preconfigured image
|
|
|
87
90
|
m365 spo page clientsidewebpart add --webUrl https://contoso.sharepoint.com/sites/a-team --pageName page.aspx --standardWebPart Image --webPartData '{ "dataVersion": "1.8", "serverProcessedContent": {"htmlStrings":{},"searchablePlainTexts":{"captionText":""},"imageSources":{"imageSource":"/sites/team-a/SiteAssets/work-life-balance.png"},"links":{}}, "properties": {"imageSourceType":2,"altText":"a group of people on a beach","overlayText":"Work life balance","fileName":"48146-OFF12_Justice_01.png","siteId":"27664b85-067d-4be9-a7d7-89b2e804d09f","webId":"a7664b85-067d-4be9-a7d7-89b2e804d09f","listId":"37664b85-067d-4be9-a7d7-89b2e804d09f","uniqueId":"67664b85-067d-4be9-a7d7-89b2e804d09f","imgWidth":650,"imgHeight":433,"fixAspectRatio":false,"isOverlayTextEnabled":true}}'
|
|
88
91
|
```
|
|
89
92
|
|
|
93
|
+
Add the standard Bing Map web part to a modern page in the vertical section
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
m365 spo page clientsidewebpart add --webUrl https://contoso.sharepoint.com/sites/a-team --pageName page.aspx --standardWebPart BingMap --verticalSection
|
|
97
|
+
```
|
|
98
|
+
|
|
90
99
|
## Response
|
|
91
100
|
|
|
92
101
|
The command won't return a response on success.
|
package/package.json
CHANGED