@pnp/cli-microsoft365 9.1.0-beta.4ee36d4 → 9.1.0-beta.8c76288
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/m365/base/PowerAutomateCommand.js +1 -1
- package/dist/m365/flow/commands/environment/environment-get.js +1 -1
- package/dist/m365/flow/commands/environment/environment-list.js +1 -1
- package/dist/m365/flow/commands/flow-disable.js +1 -1
- package/dist/m365/flow/commands/flow-enable.js +1 -1
- package/dist/m365/flow/commands/flow-export.js +17 -16
- package/dist/m365/flow/commands/flow-get.js +1 -1
- package/dist/m365/flow/commands/flow-list.js +1 -1
- package/dist/m365/flow/commands/flow-remove.js +1 -1
- package/dist/m365/flow/commands/owner/owner-ensure.js +1 -1
- package/dist/m365/flow/commands/owner/owner-list.js +1 -1
- package/dist/m365/flow/commands/owner/owner-remove.js +1 -1
- package/dist/m365/flow/commands/run/run-cancel.js +1 -1
- package/dist/m365/flow/commands/run/run-get.js +1 -1
- package/dist/m365/flow/commands/run/run-list.js +1 -1
- package/dist/m365/flow/commands/run/run-resubmit.js +2 -2
- package/dist/m365/spo/commands/file/file-roleassignment-add.js +17 -54
- package/dist/m365/spo/commands/file/file-roleassignment-remove.js +13 -40
- package/dist/m365/spo/commands/file/file-roleinheritance-break.js +5 -13
- package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +5 -13
- package/dist/m365/spo/commands/list/list-get.js +17 -4
- package/dist/m365/spo/commands/page/page-section-add.js +185 -34
- package/dist/utils/spo.js +30 -7
- package/docs/docs/cmd/spo/page/page-section-add.mdx +57 -2
- package/package.json +1 -1
|
@@ -3,13 +3,14 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
3
3
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
|
-
var _SpoPageSectionAddCommand_instances,
|
|
6
|
+
var _SpoPageSectionAddCommand_instances, _SpoPageSectionAddCommand_initTelemetry, _SpoPageSectionAddCommand_initOptions, _SpoPageSectionAddCommand_initValidators, _SpoPageSectionAddCommand_initTypes;
|
|
7
|
+
import { v4 } from 'uuid';
|
|
7
8
|
import request from '../../../../request.js';
|
|
8
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
9
10
|
import { validation } from '../../../../utils/validation.js';
|
|
10
11
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
11
12
|
import commands from '../../commands.js';
|
|
12
|
-
import { CanvasSectionTemplate
|
|
13
|
+
import { CanvasSectionTemplate } from './clientsidepages.js';
|
|
13
14
|
class SpoPageSectionAddCommand extends SpoCommand {
|
|
14
15
|
get name() {
|
|
15
16
|
return commands.PAGE_SECTION_ADD;
|
|
@@ -20,13 +21,18 @@ class SpoPageSectionAddCommand extends SpoCommand {
|
|
|
20
21
|
constructor() {
|
|
21
22
|
super();
|
|
22
23
|
_SpoPageSectionAddCommand_instances.add(this);
|
|
24
|
+
this.sectionTemplate = ['OneColumn', 'OneColumnFullWidth', 'TwoColumn', 'ThreeColumn', 'TwoColumnLeft', 'TwoColumnRight', 'Vertical'];
|
|
25
|
+
this.zoneEmphasis = ['None', 'Neutral', 'Soft', 'Strong', 'Image', 'Gradient'];
|
|
26
|
+
this.iconAlignment = ['Left', 'Right'];
|
|
27
|
+
this.fillMode = ['ScaleToFill', 'ScaleToFit', 'Tile', 'OriginalSize'];
|
|
23
28
|
__classPrivateFieldGet(this, _SpoPageSectionAddCommand_instances, "m", _SpoPageSectionAddCommand_initTelemetry).call(this);
|
|
24
29
|
__classPrivateFieldGet(this, _SpoPageSectionAddCommand_instances, "m", _SpoPageSectionAddCommand_initOptions).call(this);
|
|
25
30
|
__classPrivateFieldGet(this, _SpoPageSectionAddCommand_instances, "m", _SpoPageSectionAddCommand_initValidators).call(this);
|
|
31
|
+
__classPrivateFieldGet(this, _SpoPageSectionAddCommand_instances, "m", _SpoPageSectionAddCommand_initTypes).call(this);
|
|
26
32
|
}
|
|
27
33
|
async commandAction(logger, args) {
|
|
28
34
|
let pageFullName = args.options.pageName.toLowerCase();
|
|
29
|
-
if (pageFullName.
|
|
35
|
+
if (!pageFullName.endsWith('.aspx')) {
|
|
30
36
|
pageFullName += '.aspx';
|
|
31
37
|
}
|
|
32
38
|
let canvasContent;
|
|
@@ -66,11 +72,22 @@ class SpoPageSectionAddCommand extends SpoCommand {
|
|
|
66
72
|
.sort();
|
|
67
73
|
// zoneIndex for the new section to add
|
|
68
74
|
const zoneIndex = this.getSectionIndex(zoneIndices, args.options.order);
|
|
75
|
+
let zoneId;
|
|
76
|
+
let backgroundControlToAdd = undefined;
|
|
77
|
+
if (args.options.zoneEmphasis && ['image', 'gradient'].includes(args.options.zoneEmphasis.toLowerCase())) {
|
|
78
|
+
zoneId = v4();
|
|
79
|
+
// get background control based on control type 14
|
|
80
|
+
const backgroundControl = canvasContent.find(c => c.controlType === 14);
|
|
81
|
+
backgroundControlToAdd = this.setBackgroundControl(zoneId, backgroundControl, args);
|
|
82
|
+
if (!backgroundControl) {
|
|
83
|
+
canvasContent.push(backgroundControlToAdd);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
69
86
|
// get the list of columns to insert based on the selected template
|
|
70
|
-
const columnsToAdd = this.getColumns(zoneIndex, args
|
|
87
|
+
const columnsToAdd = this.getColumns(zoneIndex, args, zoneId);
|
|
71
88
|
// insert the column in the right place in the array so that
|
|
72
89
|
// it stays sorted ascending by zoneIndex
|
|
73
|
-
let pos = canvasContent.findIndex(c => typeof c.controlType === 'undefined' && c.position.zoneIndex > zoneIndex);
|
|
90
|
+
let pos = canvasContent.findIndex(c => typeof c.controlType === 'undefined' && c.position && c.position.zoneIndex > zoneIndex);
|
|
74
91
|
if (pos === -1) {
|
|
75
92
|
pos = canvasContent.length - 1;
|
|
76
93
|
}
|
|
@@ -107,71 +124,146 @@ class SpoPageSectionAddCommand extends SpoCommand {
|
|
|
107
124
|
}
|
|
108
125
|
return zoneIndices[order - 2] + ((zoneIndices[order - 1] - zoneIndices[order - 2]) / 2);
|
|
109
126
|
}
|
|
110
|
-
getColumns(zoneIndex,
|
|
127
|
+
getColumns(zoneIndex, args, zoneId) {
|
|
111
128
|
const columns = [];
|
|
112
129
|
let sectionIndex = 1;
|
|
113
|
-
switch (sectionTemplate) {
|
|
130
|
+
switch (args.options.sectionTemplate) {
|
|
114
131
|
case 'OneColumnFullWidth':
|
|
115
|
-
columns.push(this.getColumn(zoneIndex, sectionIndex++, 0,
|
|
132
|
+
columns.push(this.getColumn(zoneIndex, sectionIndex++, 0, args, zoneId));
|
|
116
133
|
break;
|
|
117
134
|
case 'TwoColumn':
|
|
118
|
-
columns.push(this.getColumn(zoneIndex, sectionIndex++, 6,
|
|
119
|
-
columns.push(this.getColumn(zoneIndex, sectionIndex++, 6,
|
|
135
|
+
columns.push(this.getColumn(zoneIndex, sectionIndex++, 6, args, zoneId));
|
|
136
|
+
columns.push(this.getColumn(zoneIndex, sectionIndex++, 6, args, zoneId));
|
|
120
137
|
break;
|
|
121
138
|
case 'ThreeColumn':
|
|
122
|
-
columns.push(this.getColumn(zoneIndex, sectionIndex++, 4,
|
|
123
|
-
columns.push(this.getColumn(zoneIndex, sectionIndex++, 4,
|
|
124
|
-
columns.push(this.getColumn(zoneIndex, sectionIndex++, 4,
|
|
139
|
+
columns.push(this.getColumn(zoneIndex, sectionIndex++, 4, args, zoneId));
|
|
140
|
+
columns.push(this.getColumn(zoneIndex, sectionIndex++, 4, args, zoneId));
|
|
141
|
+
columns.push(this.getColumn(zoneIndex, sectionIndex++, 4, args, zoneId));
|
|
125
142
|
break;
|
|
126
143
|
case 'TwoColumnLeft':
|
|
127
|
-
columns.push(this.getColumn(zoneIndex, sectionIndex++, 8,
|
|
128
|
-
columns.push(this.getColumn(zoneIndex, sectionIndex++, 4,
|
|
144
|
+
columns.push(this.getColumn(zoneIndex, sectionIndex++, 8, args, zoneId));
|
|
145
|
+
columns.push(this.getColumn(zoneIndex, sectionIndex++, 4, args, zoneId));
|
|
129
146
|
break;
|
|
130
147
|
case 'TwoColumnRight':
|
|
131
|
-
columns.push(this.getColumn(zoneIndex, sectionIndex++, 4,
|
|
132
|
-
columns.push(this.getColumn(zoneIndex, sectionIndex++, 8,
|
|
148
|
+
columns.push(this.getColumn(zoneIndex, sectionIndex++, 4, args, zoneId));
|
|
149
|
+
columns.push(this.getColumn(zoneIndex, sectionIndex++, 8, args, zoneId));
|
|
133
150
|
break;
|
|
134
151
|
case 'Vertical':
|
|
135
|
-
columns.push(this.getVerticalColumn(
|
|
152
|
+
columns.push(this.getVerticalColumn(args, zoneId));
|
|
136
153
|
break;
|
|
137
154
|
case 'OneColumn':
|
|
138
155
|
default:
|
|
139
|
-
columns.push(this.getColumn(zoneIndex, sectionIndex++, 12,
|
|
156
|
+
columns.push(this.getColumn(zoneIndex, sectionIndex++, 12, args, zoneId));
|
|
140
157
|
break;
|
|
141
158
|
}
|
|
142
159
|
return columns;
|
|
143
160
|
}
|
|
144
|
-
getColumn(zoneIndex, sectionIndex, sectionFactor,
|
|
161
|
+
getColumn(zoneIndex, sectionIndex, sectionFactor, args, zoneId) {
|
|
162
|
+
const { zoneEmphasis, isCollapsibleSection, isExpanded, showDivider, iconAlignment } = args.options;
|
|
145
163
|
const columnValue = {
|
|
146
164
|
displayMode: 2,
|
|
147
165
|
position: {
|
|
148
166
|
zoneIndex: zoneIndex,
|
|
149
167
|
sectionIndex: sectionIndex,
|
|
150
168
|
sectionFactor: sectionFactor,
|
|
151
|
-
layoutIndex: 1
|
|
169
|
+
layoutIndex: 1,
|
|
170
|
+
zoneId: zoneId
|
|
152
171
|
},
|
|
153
172
|
emphasis: {}
|
|
154
173
|
};
|
|
155
|
-
if (zoneEmphasis) {
|
|
156
|
-
|
|
174
|
+
if (zoneEmphasis && ['none', 'neutral', 'soft', 'strong'].includes(zoneEmphasis?.toLocaleLowerCase())) {
|
|
175
|
+
// Just these zoneEmphasis values should be added to column emphasis
|
|
176
|
+
const zoneEmphasisValue = ['none', 'neutral', 'soft', 'strong'].indexOf(zoneEmphasis.toLocaleLowerCase());
|
|
157
177
|
columnValue.emphasis = { zoneEmphasis: zoneEmphasisValue };
|
|
158
178
|
}
|
|
179
|
+
if (isCollapsibleSection) {
|
|
180
|
+
columnValue.zoneGroupMetadata = {
|
|
181
|
+
type: 1,
|
|
182
|
+
isExpanded: !!isExpanded,
|
|
183
|
+
showDividerLine: !!showDivider,
|
|
184
|
+
iconAlignment: iconAlignment && iconAlignment.toLocaleLowerCase() === "right" ? "right" : "left"
|
|
185
|
+
};
|
|
186
|
+
}
|
|
159
187
|
return columnValue;
|
|
160
188
|
}
|
|
161
|
-
getVerticalColumn(
|
|
162
|
-
const columnValue = this.getColumn(1, 1, 12,
|
|
163
|
-
columnValue.position.isLayoutReflowOnTop = isLayoutReflowOnTop !== undefined
|
|
189
|
+
getVerticalColumn(args, zoneId) {
|
|
190
|
+
const columnValue = this.getColumn(1, 1, 12, args, zoneId);
|
|
191
|
+
columnValue.position.isLayoutReflowOnTop = args.options.isLayoutReflowOnTop !== undefined;
|
|
164
192
|
columnValue.position.layoutIndex = 2;
|
|
165
193
|
columnValue.position.controlIndex = 1;
|
|
166
194
|
return columnValue;
|
|
167
195
|
}
|
|
196
|
+
setBackgroundControl(zoneId, backgroundControl, args) {
|
|
197
|
+
const { overlayColor, overlayOpacity, useLightText, imageUrl } = args.options;
|
|
198
|
+
const backgroundDetails = this.getBackgroundDetails(args);
|
|
199
|
+
if (!backgroundControl) {
|
|
200
|
+
backgroundControl = {
|
|
201
|
+
controlType: 14,
|
|
202
|
+
webPartData: {
|
|
203
|
+
properties: {
|
|
204
|
+
zoneBackground: {}
|
|
205
|
+
},
|
|
206
|
+
serverProcessedContent: {
|
|
207
|
+
htmlStrings: {},
|
|
208
|
+
searchablePlainTexts: {},
|
|
209
|
+
imageSources: {},
|
|
210
|
+
links: {}
|
|
211
|
+
},
|
|
212
|
+
dataVersion: "1.0"
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
backgroundControl.webPartData.properties.zoneBackground[zoneId] = {
|
|
217
|
+
...backgroundDetails,
|
|
218
|
+
useLightText: !!useLightText,
|
|
219
|
+
overlay: {
|
|
220
|
+
color: overlayColor ? overlayColor : "#FFFFFF",
|
|
221
|
+
opacity: overlayOpacity ? overlayOpacity : 60
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
if (imageUrl && backgroundControl.webPartData.serverProcessedContent.imageSources) {
|
|
225
|
+
backgroundControl.webPartData.serverProcessedContent.imageSources[`zoneBackground.${zoneId}.imageData.url`] = imageUrl;
|
|
226
|
+
}
|
|
227
|
+
return backgroundControl;
|
|
228
|
+
}
|
|
229
|
+
getBackgroundDetails(args) {
|
|
230
|
+
const { gradientText, imageUrl, imageHeight, imageWidth, fillMode } = args.options;
|
|
231
|
+
const backgroundDetails = {};
|
|
232
|
+
if (gradientText) {
|
|
233
|
+
backgroundDetails.type = "gradient";
|
|
234
|
+
backgroundDetails.gradient = gradientText;
|
|
235
|
+
}
|
|
236
|
+
if (imageUrl) {
|
|
237
|
+
backgroundDetails.type = "image";
|
|
238
|
+
backgroundDetails.imageData = {
|
|
239
|
+
source: 2,
|
|
240
|
+
fileName: "sectionbackground.jpg",
|
|
241
|
+
height: imageHeight ? imageHeight : 955,
|
|
242
|
+
width: imageWidth ? imageWidth : 555
|
|
243
|
+
};
|
|
244
|
+
backgroundDetails.fillMode = fillMode ? this.fillMode.indexOf(fillMode) : 0;
|
|
245
|
+
}
|
|
246
|
+
return backgroundDetails;
|
|
247
|
+
}
|
|
168
248
|
}
|
|
169
|
-
|
|
249
|
+
_SpoPageSectionAddCommand_instances = new WeakSet(), _SpoPageSectionAddCommand_initTelemetry = function _SpoPageSectionAddCommand_initTelemetry() {
|
|
170
250
|
this.telemetry.push((args) => {
|
|
171
251
|
Object.assign(this.telemetryProperties, {
|
|
172
252
|
order: typeof args.options.order !== 'undefined',
|
|
173
253
|
zoneEmphasis: typeof args.options.zoneEmphasis !== 'undefined',
|
|
174
|
-
isLayoutReflowOnTop: !!args.options.isLayoutReflowOnTop
|
|
254
|
+
isLayoutReflowOnTop: !!args.options.isLayoutReflowOnTop,
|
|
255
|
+
isCollapsibleSection: !!args.options.isCollapsibleSection,
|
|
256
|
+
showDivider: !!typeof args.options.showDivider,
|
|
257
|
+
iconAlignment: typeof args.options.iconAlignment !== 'undefined',
|
|
258
|
+
isExpanded: !!args.options.isExpanded,
|
|
259
|
+
gradientText: typeof args.options.gradientText !== 'undefined',
|
|
260
|
+
imageUrl: typeof args.options.imageUrl !== 'undefined',
|
|
261
|
+
imageHeight: typeof args.options.imageHeight !== 'undefined',
|
|
262
|
+
imageWidth: typeof args.options.imageWidth !== 'undefined',
|
|
263
|
+
fillMode: typeof args.options.fillMode !== 'undefined',
|
|
264
|
+
useLightText: !!args.options.useLightText,
|
|
265
|
+
overlayColor: typeof args.options.overlayColor !== 'undefined',
|
|
266
|
+
overlayOpacity: typeof args.options.overlayOpacity !== 'undefined'
|
|
175
267
|
});
|
|
176
268
|
});
|
|
177
269
|
}, _SpoPageSectionAddCommand_initOptions = function _SpoPageSectionAddCommand_initOptions() {
|
|
@@ -181,14 +273,40 @@ _a = SpoPageSectionAddCommand, _SpoPageSectionAddCommand_instances = new WeakSet
|
|
|
181
273
|
option: '-u, --webUrl <webUrl>'
|
|
182
274
|
}, {
|
|
183
275
|
option: '-t, --sectionTemplate <sectionTemplate>',
|
|
184
|
-
autocomplete:
|
|
276
|
+
autocomplete: this.sectionTemplate
|
|
185
277
|
}, {
|
|
186
278
|
option: '--order [order]'
|
|
187
279
|
}, {
|
|
188
280
|
option: '--zoneEmphasis [zoneEmphasis]',
|
|
189
|
-
autocomplete:
|
|
281
|
+
autocomplete: this.zoneEmphasis
|
|
190
282
|
}, {
|
|
191
283
|
option: '--isLayoutReflowOnTop'
|
|
284
|
+
}, {
|
|
285
|
+
option: '--isCollapsibleSection'
|
|
286
|
+
}, {
|
|
287
|
+
option: '--showDivider'
|
|
288
|
+
}, {
|
|
289
|
+
option: '--iconAlignment [iconAlignment]',
|
|
290
|
+
autocomplete: this.iconAlignment
|
|
291
|
+
}, {
|
|
292
|
+
option: '--isExpanded'
|
|
293
|
+
}, {
|
|
294
|
+
option: '--gradientText [gradientText]'
|
|
295
|
+
}, {
|
|
296
|
+
option: '--imageUrl [imageUrl]'
|
|
297
|
+
}, {
|
|
298
|
+
option: '--imageHeight [imageHeight]'
|
|
299
|
+
}, {
|
|
300
|
+
option: '--imageWidth [imageWidth]'
|
|
301
|
+
}, {
|
|
302
|
+
option: '--fillMode [fillMode]',
|
|
303
|
+
autocomplete: this.fillMode
|
|
304
|
+
}, {
|
|
305
|
+
option: '--useLightText'
|
|
306
|
+
}, {
|
|
307
|
+
option: '--overlayColor [overlayColor]'
|
|
308
|
+
}, {
|
|
309
|
+
option: '--overlayOpacity [overlayOpacity]'
|
|
192
310
|
});
|
|
193
311
|
}, _SpoPageSectionAddCommand_initValidators = function _SpoPageSectionAddCommand_initValidators() {
|
|
194
312
|
this.validators.push(async (args) => {
|
|
@@ -201,8 +319,8 @@ _a = SpoPageSectionAddCommand, _SpoPageSectionAddCommand_instances = new WeakSet
|
|
|
201
319
|
}
|
|
202
320
|
}
|
|
203
321
|
if (typeof args.options.zoneEmphasis !== 'undefined') {
|
|
204
|
-
if (!(args.options.zoneEmphasis
|
|
205
|
-
return
|
|
322
|
+
if (!this.zoneEmphasis.some(zoneEmphasisValue => zoneEmphasisValue.toLocaleLowerCase() === args.options.zoneEmphasis?.toLowerCase())) {
|
|
323
|
+
return `The value of parameter zoneEmphasis must be ${this.zoneEmphasis.join(', ')}`;
|
|
206
324
|
}
|
|
207
325
|
}
|
|
208
326
|
if (typeof args.options.isLayoutReflowOnTop !== 'undefined') {
|
|
@@ -210,10 +328,43 @@ _a = SpoPageSectionAddCommand, _SpoPageSectionAddCommand_instances = new WeakSet
|
|
|
210
328
|
return 'Specify isLayoutReflowOnTop when the sectionTemplate is set to Vertical.';
|
|
211
329
|
}
|
|
212
330
|
}
|
|
331
|
+
if (typeof args.options.iconAlignment !== 'undefined') {
|
|
332
|
+
if (!this.iconAlignment.some(iconAlignmentValue => iconAlignmentValue.toLocaleLowerCase() === args.options.iconAlignment?.toLowerCase())) {
|
|
333
|
+
return `The value of parameter iconAlignment must be ${this.iconAlignment.join(', ')}`;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
if (typeof args.options.fillMode !== 'undefined') {
|
|
337
|
+
if (!this.fillMode.some(fillModeValue => fillModeValue.toLocaleLowerCase() === args.options.fillMode?.toLowerCase())) {
|
|
338
|
+
return `The value of parameter fillMode must be ${this.fillMode.join(', ')}`;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
if (args.options.zoneEmphasis?.toLocaleLowerCase() !== 'image' && (args.options.imageUrl || args.options.imageWidth ||
|
|
342
|
+
args.options.imageHeight || args.options.fillMode)) {
|
|
343
|
+
return 'Specify imageUrl, imageWidth, imageHeight or fillMode only when zoneEmphasis is set to Image';
|
|
344
|
+
}
|
|
345
|
+
if (args.options.zoneEmphasis?.toLocaleLowerCase() === 'image' && !args.options.imageUrl) {
|
|
346
|
+
return 'Specify imageUrl when zoneEmphasis is set to Image';
|
|
347
|
+
}
|
|
348
|
+
if (args.options.zoneEmphasis?.toLowerCase() !== 'gradient' && args.options.gradientText) {
|
|
349
|
+
return 'Specify gradientText only when zoneEmphasis is set to Gradient';
|
|
350
|
+
}
|
|
351
|
+
if (args.options.zoneEmphasis?.toLowerCase() === 'gradient' && !args.options.gradientText) {
|
|
352
|
+
return 'Specify gradientText when zoneEmphasis is set to Gradient';
|
|
353
|
+
}
|
|
354
|
+
if (args.options.overlayOpacity && (args.options.overlayOpacity < 0 || args.options.overlayOpacity > 100)) {
|
|
355
|
+
return 'The value of parameter overlayOpacity must be between 0 and 100';
|
|
356
|
+
}
|
|
357
|
+
if (args.options.overlayColor && !/^#[0-9a-f]{6}$/i.test(args.options.overlayColor)) {
|
|
358
|
+
return 'The value of parameter overlayColor must be a valid hex color';
|
|
359
|
+
}
|
|
360
|
+
if (!(args.options.zoneEmphasis && ['image', 'gradient'].includes(args.options.zoneEmphasis.toLowerCase())) && (args.options.overlayColor || args.options.overlayOpacity || args.options.useLightText)) {
|
|
361
|
+
return 'Specify overlayColor or overlayOpacity only when zoneEmphasis is set to Image or Gradient';
|
|
362
|
+
}
|
|
213
363
|
return validation.isValidSharePointUrl(args.options.webUrl);
|
|
214
364
|
});
|
|
365
|
+
}, _SpoPageSectionAddCommand_initTypes = function _SpoPageSectionAddCommand_initTypes() {
|
|
366
|
+
this.types.string = ['pageName', 'webUrl', 'sectionTemplate', 'zoneEmphasis', 'iconAlignment', 'gradientText', 'imageUrl', 'fillMode', 'overlayColor'];
|
|
367
|
+
this.types.boolean = ['isLayoutReflowOnTop', 'isCollapsibleSection', 'showDivider', 'isExpanded', 'useLightText'];
|
|
215
368
|
};
|
|
216
|
-
SpoPageSectionAddCommand.SectionTemplate = ['OneColumn', 'OneColumnFullWidth', 'TwoColumn', 'ThreeColumn', 'TwoColumnLeft', 'TwoColumnRight', 'Vertical'];
|
|
217
|
-
SpoPageSectionAddCommand.ZoneEmphasis = ['None', 'Neutral', 'Soft', 'Strong'];
|
|
218
369
|
export default new SpoPageSectionAddCommand();
|
|
219
370
|
//# sourceMappingURL=page-section-add.js.map
|
package/dist/utils/spo.js
CHANGED
|
@@ -490,10 +490,10 @@ export const spo = {
|
|
|
490
490
|
* @param webUrl Web url
|
|
491
491
|
* @param email The email of the user
|
|
492
492
|
* @param logger the Logger object
|
|
493
|
-
* @param verbose set
|
|
493
|
+
* @param verbose set for verbose logging
|
|
494
494
|
*/
|
|
495
495
|
async getUserByEmail(webUrl, email, logger, verbose) {
|
|
496
|
-
if (verbose) {
|
|
496
|
+
if (verbose && logger) {
|
|
497
497
|
await logger.logToStderr(`Retrieving the spo user by email ${email}`);
|
|
498
498
|
}
|
|
499
499
|
const requestUrl = `${webUrl}/_api/web/siteusers/GetByEmail('${formatting.encodeQueryParameter(email)}')`;
|
|
@@ -564,10 +564,10 @@ export const spo = {
|
|
|
564
564
|
* @param webUrl Web url
|
|
565
565
|
* @param name The name of the group
|
|
566
566
|
* @param logger the Logger object
|
|
567
|
-
* @param verbose set
|
|
567
|
+
* @param verbose set for verbose logging
|
|
568
568
|
*/
|
|
569
569
|
async getGroupByName(webUrl, name, logger, verbose) {
|
|
570
|
-
if (verbose) {
|
|
570
|
+
if (verbose && logger) {
|
|
571
571
|
await logger.logToStderr(`Retrieving the group by name ${name}`);
|
|
572
572
|
}
|
|
573
573
|
const requestUrl = `${webUrl}/_api/web/sitegroups/GetByName('${formatting.encodeQueryParameter(name)}')`;
|
|
@@ -586,10 +586,10 @@ export const spo = {
|
|
|
586
586
|
* @param webUrl Web url
|
|
587
587
|
* @param name the name of the role definition
|
|
588
588
|
* @param logger the Logger object
|
|
589
|
-
* @param
|
|
589
|
+
* @param verbose set for verbose logging
|
|
590
590
|
*/
|
|
591
|
-
async getRoleDefinitionByName(webUrl, name, logger,
|
|
592
|
-
if (
|
|
591
|
+
async getRoleDefinitionByName(webUrl, name, logger, verbose) {
|
|
592
|
+
if (verbose && logger) {
|
|
593
593
|
await logger.logToStderr(`Retrieving the role definitions for ${name}`);
|
|
594
594
|
}
|
|
595
595
|
const roledefinitions = await odata.getAllItems(`${webUrl}/_api/web/roledefinitions`);
|
|
@@ -1516,6 +1516,29 @@ export const spo = {
|
|
|
1516
1516
|
};
|
|
1517
1517
|
const itemsResponse = await request.get(requestOptionsItems);
|
|
1518
1518
|
return (itemsResponse);
|
|
1519
|
+
},
|
|
1520
|
+
/**
|
|
1521
|
+
* Retrieves the file by id.
|
|
1522
|
+
* Returns a FileProperties object
|
|
1523
|
+
* @param webUrl Web url
|
|
1524
|
+
* @param id the id of the file
|
|
1525
|
+
* @param logger the Logger object
|
|
1526
|
+
* @param verbose set for verbose logging
|
|
1527
|
+
*/
|
|
1528
|
+
async getFileById(webUrl, id, logger, verbose) {
|
|
1529
|
+
if (verbose && logger) {
|
|
1530
|
+
await logger.logToStderr(`Retrieving the file with id ${id}`);
|
|
1531
|
+
}
|
|
1532
|
+
const requestUrl = `${webUrl}/_api/web/GetFileById('${formatting.encodeQueryParameter(id)}')`;
|
|
1533
|
+
const requestOptions = {
|
|
1534
|
+
url: requestUrl,
|
|
1535
|
+
headers: {
|
|
1536
|
+
'accept': 'application/json;odata=nometadata'
|
|
1537
|
+
},
|
|
1538
|
+
responseType: 'json'
|
|
1539
|
+
};
|
|
1540
|
+
const file = await request.get(requestOptions);
|
|
1541
|
+
return file;
|
|
1519
1542
|
}
|
|
1520
1543
|
};
|
|
1521
1544
|
//# sourceMappingURL=spo.js.map
|
|
@@ -26,10 +26,46 @@ m365 spo page section add [options]
|
|
|
26
26
|
: Order of the section to add.
|
|
27
27
|
|
|
28
28
|
`--zoneEmphasis [zoneEmphasis]`
|
|
29
|
-
: Section background shading. Allowed values `None`, `Neutral`, `Soft`, `Strong`
|
|
29
|
+
: Section background shading. Allowed values `None`, `Neutral`, `Soft`, `Strong`, `Image`,`Gradient`
|
|
30
30
|
|
|
31
31
|
`--isLayoutReflowOnTop`
|
|
32
|
-
: The position of the Vertical section for smaller screens. Applied only for Vertical section.
|
|
32
|
+
: The position of the Vertical section for smaller screens. Applied only for `Vertical` section.
|
|
33
|
+
|
|
34
|
+
`--isCollapsibleSection`
|
|
35
|
+
: Set section to be collapsible.
|
|
36
|
+
|
|
37
|
+
`--showDivider`
|
|
38
|
+
: Shows a divider line between sections.
|
|
39
|
+
|
|
40
|
+
`--iconAlignment [iconAlignment]`
|
|
41
|
+
: Specifies the alignment of the expand/collapse icon. Sets `Left` alignment if not specified.
|
|
42
|
+
|
|
43
|
+
`--isExpanded`
|
|
44
|
+
: Sets the default display state of the collapsible section. Sets `false` if not specified.
|
|
45
|
+
|
|
46
|
+
`--gradientText [gradientText]`
|
|
47
|
+
: Sets the gradient setting of the background of a section. Required when `zoneEmphasis` is `Gradient`.
|
|
48
|
+
|
|
49
|
+
`--imageUrl [imageUrl]`
|
|
50
|
+
: The background image URL. Required when `zoneEmphasis` is `Image`.
|
|
51
|
+
|
|
52
|
+
`--imageHeight [imageHeight]`
|
|
53
|
+
: The height of the background image. Applied only when when `zoneEmphasis` is `Image`. Sets `955` value if not specified.
|
|
54
|
+
|
|
55
|
+
`--imageWidth [imageWidth]`
|
|
56
|
+
: The width of the background image. Applied only when `zoneEmphasis` is `Image`. Sets `555` value if not specified.
|
|
57
|
+
|
|
58
|
+
`--fillMode [fillMode]`
|
|
59
|
+
: The fill mode of the background image. Applied only when `zoneEmphasis` is `Image`. Possible values are `ScaleToFill`, `ScaleToFit`, `Tile`, `OriginalSize`. Sets `ScaleToFill` value if not specified.
|
|
60
|
+
|
|
61
|
+
`--useLightText`
|
|
62
|
+
: Specifies whether to use light text for the background. Applied only when `zoneEmphasis` is `Image`.
|
|
63
|
+
|
|
64
|
+
`--overlayColor [overlayColor]`
|
|
65
|
+
: The overlay color for the background in #RRGGBB format. Applied only when `zoneEmphasis` is `Image` or `Gradient`. Sets `#ffffff` value if not specified.
|
|
66
|
+
|
|
67
|
+
`--overlayOpacity [overlayOpacity]`
|
|
68
|
+
: The overlay opacity for the background. Applied only when `zoneEmphasis` is `Image` or `Gradient`. Sets `60` value if not specified.
|
|
33
69
|
```
|
|
34
70
|
|
|
35
71
|
<Global />
|
|
@@ -64,6 +100,25 @@ Add Vertical section with background shading to the modern page with adjusting t
|
|
|
64
100
|
m365 spo page section add --pageName home.aspx --webUrl https://contoso.sharepoint.com/sites/newsletter --sectionTemplate Vertical --zoneEmphasis Neutral --isLayoutReflowOnTop
|
|
65
101
|
```
|
|
66
102
|
|
|
103
|
+
Add OneColumn section as a collapsible section as expanded with icon alligned to the left
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
m365 spo page section add --pageName home.aspx --webUrl https://contoso.sharepoint.com/sites/newsletter --sectionTemplate OneColumn --isCollapsibleSection --isExpanded --iconAlignment Left
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Add TwoColumn section with Image background
|
|
110
|
+
|
|
111
|
+
```sh
|
|
112
|
+
m365 spo page section add --pageName home.aspx --webUrl https://contoso.sharepoint.com/sites/newsletter --sectionTemplate TwoColumn --imageUrl "https://contoso.com/image.jpg" --zoneEmphasis Image --fillMode Tile
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Add OneColumn section with Gradient background
|
|
116
|
+
|
|
117
|
+
```sh
|
|
118
|
+
m365 spo page section add --pageName home.aspx --webUrl https://contoso.sharepoint.com/sites/newsletter --sectionTemplate TwoColumn --zoneEmphasis Gradient --gradientText "linear-gradient(72.44deg, #E6FBFE 0%, #EDDDFB 100%)"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
|
|
67
122
|
## Response
|
|
68
123
|
|
|
69
124
|
The command won't return a response on success.
|
package/package.json
CHANGED