sp-js-provisioning 1.2.0-beta.1 → 1.2.0-beta.3
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.
|
@@ -21,6 +21,7 @@ export declare class ClientSidePages extends HandlerBase {
|
|
|
21
21
|
* @param context - Provisioning context
|
|
22
22
|
*/
|
|
23
23
|
ProvisionObjects(web: IWeb, clientSidePages: IClientSidePage[], context?: ProvisioningContext): Promise<void>;
|
|
24
|
+
private _getClientSideWebPart;
|
|
24
25
|
/**
|
|
25
26
|
* Provision a client side page
|
|
26
27
|
*
|
|
@@ -28,5 +29,5 @@ export declare class ClientSidePages extends HandlerBase {
|
|
|
28
29
|
* @param clientSidePage - Cient side page
|
|
29
30
|
* @param partDefinitions - Cient side web parts
|
|
30
31
|
*/
|
|
31
|
-
private
|
|
32
|
+
private _processClientSidePage;
|
|
32
33
|
}
|
|
@@ -87,7 +87,7 @@ var ClientSidePages = /** @class */ (function (_super) {
|
|
|
87
87
|
partDefinitions_1 = _a.sent();
|
|
88
88
|
return [4 /*yield*/, clientSidePages.reduce(function (chain, clientSidePage) {
|
|
89
89
|
return chain.then(function () {
|
|
90
|
-
return _this.
|
|
90
|
+
return _this._processClientSidePage(web, clientSidePage, partDefinitions_1);
|
|
91
91
|
});
|
|
92
92
|
}, Promise.resolve())];
|
|
93
93
|
case 3:
|
|
@@ -102,6 +102,26 @@ var ClientSidePages = /** @class */ (function (_super) {
|
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
104
|
};
|
|
105
|
+
ClientSidePages.prototype._getClientSideWebPart = function (partDefinitions, control) {
|
|
106
|
+
var partDef = partDefinitions.find(function (c) {
|
|
107
|
+
return c.Id.toLowerCase().includes(control.Id.toLowerCase());
|
|
108
|
+
});
|
|
109
|
+
if (!partDef) {
|
|
110
|
+
_super.prototype.log_warn.call(this, 'getClientSideWebPart', "Client side web part with definition id " + control.Id + " not found.");
|
|
111
|
+
return {
|
|
112
|
+
part: null,
|
|
113
|
+
partDef: null,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
var properties = this.tokenHelper.replaceTokens(JSON.stringify(control.Properties));
|
|
117
|
+
properties = replaceUrlTokens(properties, this.config);
|
|
118
|
+
var part = ClientsideWebpart.fromComponentDef(partDef).setProperties(JSON.parse(properties));
|
|
119
|
+
if (control.ServerProcessedContent) {
|
|
120
|
+
var serverProcessedContent = this.tokenHelper.replaceTokens(JSON.stringify(control.ServerProcessedContent));
|
|
121
|
+
part.data.webPartData.serverProcessedContent = JSON.parse(serverProcessedContent);
|
|
122
|
+
}
|
|
123
|
+
return { part: part, partDef: partDef };
|
|
124
|
+
};
|
|
105
125
|
/**
|
|
106
126
|
* Provision a client side page
|
|
107
127
|
*
|
|
@@ -109,51 +129,49 @@ var ClientSidePages = /** @class */ (function (_super) {
|
|
|
109
129
|
* @param clientSidePage - Cient side page
|
|
110
130
|
* @param partDefinitions - Cient side web parts
|
|
111
131
|
*/
|
|
112
|
-
ClientSidePages.prototype.
|
|
132
|
+
ClientSidePages.prototype._processClientSidePage = function (web, clientSidePage, partDefinitions) {
|
|
113
133
|
return __awaiter(this, void 0, void 0, function () {
|
|
114
|
-
var page,
|
|
115
|
-
return __generator(this, function (
|
|
116
|
-
switch (
|
|
134
|
+
var page, verticalSection, _i, _a, control, _b, part, partDef, sections, _c, sections_1, s, section, _d, _e, col, column, _f, _g, control, _h, part, partDef;
|
|
135
|
+
return __generator(this, function (_j) {
|
|
136
|
+
switch (_j.label) {
|
|
117
137
|
case 0:
|
|
118
138
|
_super.prototype.log_info.call(this, 'processClientSidePage', "Processing client side page " + clientSidePage.Name);
|
|
119
139
|
return [4 /*yield*/, CreateClientsidePage(web, clientSidePage.Name, clientSidePage.Title, clientSidePage.PageLayoutType)];
|
|
120
140
|
case 1:
|
|
121
|
-
page =
|
|
141
|
+
page = _j.sent();
|
|
142
|
+
if (clientSidePage.VerticalSection) {
|
|
143
|
+
verticalSection = page.addVerticalSection();
|
|
144
|
+
for (_i = 0, _a = clientSidePage.VerticalSection; _i < _a.length; _i++) {
|
|
145
|
+
control = _a[_i];
|
|
146
|
+
_b = this._getClientSideWebPart(partDefinitions, control), part = _b.part, partDef = _b.partDef;
|
|
147
|
+
if (!part)
|
|
148
|
+
continue;
|
|
149
|
+
try {
|
|
150
|
+
verticalSection.addControl(part);
|
|
151
|
+
}
|
|
152
|
+
catch (_k) {
|
|
153
|
+
_super.prototype.log_info.call(this, 'processClientSidePage', "Failed adding part " + partDef.Name + " to client side page " + clientSidePage.Name);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
122
157
|
sections = clientSidePage.Sections || [];
|
|
123
|
-
for (
|
|
124
|
-
s = sections_1[
|
|
158
|
+
for (_c = 0, sections_1 = sections; _c < sections_1.length; _c++) {
|
|
159
|
+
s = sections_1[_c];
|
|
125
160
|
section = page.addSection();
|
|
126
|
-
for (
|
|
127
|
-
col =
|
|
161
|
+
for (_d = 0, _e = s.Columns; _d < _e.length; _d++) {
|
|
162
|
+
col = _e[_d];
|
|
128
163
|
column = section.addColumn(col.Factor);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
_super.prototype.log_warn.call(this_1, 'processClientSidePage', "Client side web part with definition id " + control.Id + " not found.");
|
|
135
|
-
return "continue";
|
|
136
|
-
}
|
|
164
|
+
for (_f = 0, _g = col.Controls; _f < _g.length; _f++) {
|
|
165
|
+
control = _g[_f];
|
|
166
|
+
_h = this._getClientSideWebPart(partDefinitions, control), part = _h.part, partDef = _h.partDef;
|
|
167
|
+
if (!part)
|
|
168
|
+
continue;
|
|
137
169
|
try {
|
|
138
|
-
var properties = this_1.tokenHelper.replaceTokens(JSON.stringify(control.Properties));
|
|
139
|
-
properties = replaceUrlTokens(properties, this_1.config);
|
|
140
|
-
var part = ClientsideWebpart.fromComponentDef(partDef).setProperties(JSON.parse(properties));
|
|
141
|
-
if (control.ServerProcessedContent) {
|
|
142
|
-
var serverProcessedContent = this_1.tokenHelper.replaceTokens(JSON.stringify(control.ServerProcessedContent));
|
|
143
|
-
_super.prototype.log_info.call(this_1, 'processClientSidePage', "Adding serverProcessedContent " + serverProcessedContent + " to client side page " + clientSidePage.Name);
|
|
144
|
-
part.data.webPartData.serverProcessedContent = JSON.parse(serverProcessedContent);
|
|
145
|
-
}
|
|
146
|
-
_super.prototype.log_info.call(this_1, 'processClientSidePage', "Adding " + partDef.Name + " to client side page " + clientSidePage.Name);
|
|
147
170
|
column.addControl(part);
|
|
148
171
|
}
|
|
149
|
-
catch (
|
|
150
|
-
_super.prototype.log_info.call(
|
|
172
|
+
catch (_l) {
|
|
173
|
+
_super.prototype.log_info.call(this, 'processClientSidePage', "Failed adding part " + partDef.Name + " to client side page " + clientSidePage.Name);
|
|
151
174
|
}
|
|
152
|
-
};
|
|
153
|
-
this_1 = this;
|
|
154
|
-
for (_c = 0, _d = col.Controls; _c < _d.length; _c++) {
|
|
155
|
-
control = _d[_c];
|
|
156
|
-
_loop_1(control);
|
|
157
175
|
}
|
|
158
176
|
}
|
|
159
177
|
}
|
|
@@ -161,7 +179,7 @@ var ClientSidePages = /** @class */ (function (_super) {
|
|
|
161
179
|
page.commentsDisabled = clientSidePage.CommentsDisabled;
|
|
162
180
|
return [4 /*yield*/, page.save()];
|
|
163
181
|
case 2:
|
|
164
|
-
|
|
182
|
+
_j.sent();
|
|
165
183
|
return [2 /*return*/];
|
|
166
184
|
}
|
|
167
185
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientsidepages.js","sourceRoot":"","sources":["../../src/handlers/clientsidepages.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAkC,MAAM,qBAAqB,CAAA;AAG7G,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,WAAW,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CAChF,CAAA;iCACF;6BACF;yBACF;wBACK,QAAQ,GAAG,cAAc,CAAC,QAAQ,IAAI,EAAE,CAAA;wBAC9C,WAAwB,EAAR,qBAAQ,EAAR,sBAAQ,EAAR,IAAQ,EAAE;4BAAf,CAAC;4BACJ,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAA;4BACjC,WAA2B,EAAT,KAAA,CAAC,CAAC,OAAO,EAAT,cAAS,EAAT,IAAS,EAAE;gCAAlB,GAAG;gCACN,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;gCAC5C,WAAkC,EAAZ,KAAA,GAAG,CAAC,QAAQ,EAAZ,cAAY,EAAZ,IAAY,EAAE;oCAAzB,OAAO;oCACV,KAAoB,IAAI,CAAC,qBAAqB,CAAC,eAAe,EAAE,OAAO,CAAC,EAAtE,IAAI,UAAA,EAAE,OAAO,aAAA,CAAyD;oCAC9E,IAAI,CAAC,IAAI;wCAAE,SAAQ;oCACnB,IAAI;wCACF,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;qCACxB;oCAAC,WAAM;wCACN,iBAAM,QAAQ,YACZ,uBAAuB,EACvB,wBAAsB,OAAO,CAAC,IAAI,6BAAwB,cAAc,CAAC,IAAM,CAChF,CAAA;qCACF;iCACF;6BACF;yBACF;wBACD,iBAAM,QAAQ,YACZ,uBAAuB,EACvB,6BAA2B,cAAc,CAAC,IAAM,CACjD,CAAA;wBACD,IAAI,CAAC,gBAAgB,GAAG,cAAc,CAAC,gBAAgB,CAAA;wBACvD,qBAAM,IAAI,CAAC,IAAI,EAAE,EAAA;;wBAAjB,SAAiB,CAAA;;;;;KAClB;IACH,sBAAC;AAAD,CAAC,AAtID,CAAqC,WAAW,GAsI/C"}
|
package/lib/schema.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -74,7 +74,7 @@ const template: Schema = {
|
|
|
74
74
|
Description: 'This is the description',
|
|
75
75
|
Template: 101,
|
|
76
76
|
AdditionalSettings: {
|
|
77
|
-
Description:
|
|
77
|
+
Description: 'I\'ve updated the description',
|
|
78
78
|
EnableFolderCreation: true,
|
|
79
79
|
ForceCheckout: true
|
|
80
80
|
}
|