dattatable 2.9.32 → 2.9.34
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/build/common/installRequired.d.ts +2 -0
- package/build/common/installRequired.js +84 -34
- package/build/common/itemForm.d.ts +1 -0
- package/build/common/itemForm.js +27 -20
- package/build/common/list.d.ts +1 -2
- package/build/common/list.js +17 -33
- package/build/common/listSecurity.d.ts +0 -1
- package/build/common/listSecurity.js +4 -22
- package/build/common/methods.d.ts +1 -0
- package/build/common/methods.js +21 -1
- package/build/lib.d.ts +1 -0
- package/dist/dattatable.js +707 -707
- package/dist/dattatable.min.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/AuditLog.html +2 -2
- package/docs/classes/CanvasForm.html +2 -2
- package/docs/classes/Comments.html +2 -2
- package/docs/classes/Dashboard.html +4 -4
- package/docs/classes/DataTable.html +3 -3
- package/docs/classes/Documents.html +6 -6
- package/docs/classes/FilterSlideout.html +2 -2
- package/docs/classes/Footer.html +2 -2
- package/docs/classes/Header.html +2 -2
- package/docs/classes/InstallationRequired.html +4 -2
- package/docs/classes/ItemForm.html +5 -4
- package/docs/classes/List.html +4 -5
- package/docs/classes/ListSecurity.html +2 -3
- package/docs/classes/LoadingDialog.html +2 -2
- package/docs/classes/Modal.html +2 -2
- package/docs/classes/Navigation.html +3 -3
- package/docs/classes/Timeout.html +2 -2
- package/docs/enums/ActionButtonTypes.html +2 -2
- package/docs/functions/formatBytes.html +1 -1
- package/docs/functions/formatDateValue.html +1 -1
- package/docs/functions/formatTimeValue.html +1 -1
- package/docs/functions/getContextInfo.html +1 -0
- package/docs/functions/getFileExt.html +1 -1
- package/docs/functions/waitForTheme.html +1 -1
- package/docs/interfaces/IAuditLogItem.html +2 -2
- package/docs/interfaces/IAuditLogItemCreation.html +2 -2
- package/docs/interfaces/IAuditLogProps.html +2 -2
- package/docs/interfaces/IAuditLogViewProps.html +2 -2
- package/docs/interfaces/ICommentsItem.html +2 -2
- package/docs/interfaces/IDashboardProps.html +2 -2
- package/docs/interfaces/IDataTable.html +2 -2
- package/docs/interfaces/IDataTableProps.html +2 -2
- package/docs/interfaces/IDocumentsProps.html +2 -2
- package/docs/interfaces/IFilterItem.html +2 -2
- package/docs/interfaces/IFilterProps.html +2 -2
- package/docs/interfaces/IFooterProps.html +2 -2
- package/docs/interfaces/IHeaderProps.html +2 -2
- package/docs/interfaces/IInstallProps.html +2 -2
- package/docs/interfaces/IItemFormCreateProps.html +2 -2
- package/docs/interfaces/IItemFormEditProps.html +2 -2
- package/docs/interfaces/IItemFormTab.html +2 -2
- package/docs/interfaces/IItemFormTabInfo.html +2 -2
- package/docs/interfaces/IItemFormViewProps.html +2 -2
- package/docs/interfaces/IListProps.html +2 -2
- package/docs/interfaces/IListSecurity.html +2 -2
- package/docs/interfaces/IListSecurityItem.html +2 -2
- package/docs/interfaces/IShowDialogProps.html +2 -2
- package/docs/modules.html +1 -0
- package/docs/variables/DattaTable.html +1 -1
- package/docs/variables/ListSecurityDefaultGroups.html +1 -1
- package/package.json +2 -2
- package/pnpm-lock.yaml +10 -10
|
@@ -22,10 +22,12 @@ export declare class InstallationRequired {
|
|
|
22
22
|
private static _customActionsExist;
|
|
23
23
|
static get CustomActionsExist(): boolean;
|
|
24
24
|
private static checkCustomActions;
|
|
25
|
+
private static isOwnerOrAdmin;
|
|
25
26
|
private static _listsExist;
|
|
26
27
|
static get ListsExist(): boolean;
|
|
27
28
|
private static checkLists;
|
|
28
29
|
static requiresInstall(props: IInstallProps): PromiseLike<boolean>;
|
|
29
30
|
static showDialog(props?: IShowDialogProps): void;
|
|
30
31
|
private static showErrorDialog;
|
|
32
|
+
private static showNoAccessDialog;
|
|
31
33
|
}
|
|
@@ -107,6 +107,37 @@ var InstallationRequired = /** @class */ (function () {
|
|
|
107
107
|
});
|
|
108
108
|
});
|
|
109
109
|
};
|
|
110
|
+
// Determines if the user is an owner or admin
|
|
111
|
+
InstallationRequired.isOwnerOrAdmin = function () {
|
|
112
|
+
// Return a promise
|
|
113
|
+
return new Promise(function (resolve) {
|
|
114
|
+
// Get the current user
|
|
115
|
+
(0, gd_sprest_bs_1.Web)().CurrentUser().execute(function (user) {
|
|
116
|
+
// See if they are an admin
|
|
117
|
+
if (user.IsSiteAdmin) {
|
|
118
|
+
// Resolve the request
|
|
119
|
+
resolve(true);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
// See if the user is part of the owner's group
|
|
123
|
+
(0, gd_sprest_bs_1.Web)().AssociatedOwnerGroup().Users().getById(user.Id).execute(
|
|
124
|
+
// Is an owner
|
|
125
|
+
function () {
|
|
126
|
+
// Resolve the request
|
|
127
|
+
resolve(true);
|
|
128
|
+
},
|
|
129
|
+
// Not an owner
|
|
130
|
+
function () {
|
|
131
|
+
// Resolve the request
|
|
132
|
+
resolve(false);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}, function () {
|
|
136
|
+
// Resolve the request
|
|
137
|
+
resolve(false);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
};
|
|
110
141
|
Object.defineProperty(InstallationRequired, "ListsExist", {
|
|
111
142
|
get: function () { return this._listsExist; },
|
|
112
143
|
enumerable: false,
|
|
@@ -181,44 +212,55 @@ var InstallationRequired = /** @class */ (function () {
|
|
|
181
212
|
// Clear the report
|
|
182
213
|
this._report = [];
|
|
183
214
|
// Return a promise
|
|
184
|
-
return new Promise(function (resolve) {
|
|
185
|
-
// Ensure this is an
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
215
|
+
return new Promise(function (resolve, reject) {
|
|
216
|
+
// Ensure this is an admin or owner
|
|
217
|
+
_this.isOwnerOrAdmin().then(function (hasPermissions) {
|
|
218
|
+
// See if they are not an owner or admin
|
|
219
|
+
if (!hasPermissions) {
|
|
220
|
+
// Show the dialog
|
|
221
|
+
_this.showNoAccessDialog();
|
|
222
|
+
// Reject the request
|
|
223
|
+
reject();
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
// Ensure this is an array
|
|
227
|
+
var cfgs = typeof (_this._cfg.length) === "number" ? _this._cfg : [_this._cfg];
|
|
228
|
+
// Parse the configurations
|
|
229
|
+
gd_sprest_bs_1.Helper.Executor(cfgs, function (cfg) {
|
|
230
|
+
// Return a promise
|
|
231
|
+
return new Promise(function (resolve) {
|
|
232
|
+
var numbOfErrors = _this._report.length;
|
|
233
|
+
// Check the configuration
|
|
234
|
+
Promise.all([
|
|
235
|
+
// Check the custom actions
|
|
236
|
+
_this.checkCustomActions(cfg),
|
|
237
|
+
// Check the lists
|
|
238
|
+
_this.checkLists(cfg)
|
|
239
|
+
]).then(function () {
|
|
240
|
+
// See if there are errors
|
|
241
|
+
if (_this._report.length > numbOfErrors) {
|
|
242
|
+
// Execute the event
|
|
243
|
+
props.onError ? props.onError(cfg) : null;
|
|
244
|
+
}
|
|
245
|
+
// Execute the event and see if a promise was returned
|
|
246
|
+
var returnVal = props.onCompleted ? props.onCompleted() : null;
|
|
247
|
+
if (returnVal && typeof (returnVal["then"]) === "function") {
|
|
248
|
+
// Wait for the request to complete
|
|
249
|
+
returnVal.then(function () {
|
|
250
|
+
// Resolve the request
|
|
251
|
+
resolve(_this._report.length > 0);
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
209
255
|
// Resolve the request
|
|
210
256
|
resolve(_this._report.length > 0);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
else {
|
|
214
|
-
// Resolve the request
|
|
215
|
-
resolve(_this._report.length > 0);
|
|
216
|
-
}
|
|
257
|
+
}
|
|
258
|
+
});
|
|
217
259
|
});
|
|
260
|
+
}).then(function () {
|
|
261
|
+
// Resolve the request
|
|
262
|
+
resolve(_this._report.length > 0);
|
|
218
263
|
});
|
|
219
|
-
}).then(function () {
|
|
220
|
-
// Resolve the request
|
|
221
|
-
resolve(_this._report.length > 0);
|
|
222
264
|
});
|
|
223
265
|
});
|
|
224
266
|
};
|
|
@@ -331,6 +373,14 @@ var InstallationRequired = /** @class */ (function () {
|
|
|
331
373
|
// Show the dialog
|
|
332
374
|
modal_1.Modal.show();
|
|
333
375
|
};
|
|
376
|
+
InstallationRequired.showNoAccessDialog = function () {
|
|
377
|
+
// Set the header
|
|
378
|
+
modal_1.Modal.setHeader("Access Denied");
|
|
379
|
+
// Set the body
|
|
380
|
+
modal_1.Modal.setBody("The component has not been configured or you do not have permissions to view the application. Please contact your administrator for additional help.");
|
|
381
|
+
// Show the dialog
|
|
382
|
+
modal_1.Modal.show();
|
|
383
|
+
};
|
|
334
384
|
InstallationRequired._cfg = null;
|
|
335
385
|
InstallationRequired._report = null;
|
|
336
386
|
// Custom Actions exists
|
package/build/common/itemForm.js
CHANGED
|
@@ -185,28 +185,34 @@ var ItemForm = /** @class */ (function () {
|
|
|
185
185
|
// Resolve the request
|
|
186
186
|
resolve(null);
|
|
187
187
|
};
|
|
188
|
-
//
|
|
189
|
-
|
|
190
|
-
//
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
// Set the list form properties
|
|
195
|
-
var listProps = {
|
|
196
|
-
listName: _this.ListName,
|
|
197
|
-
itemId: itemId,
|
|
198
|
-
webUrl: webUrl
|
|
199
|
-
};
|
|
200
|
-
// Call the event
|
|
201
|
-
listProps = _this._onGetListInfo ? _this._onGetListInfo(listProps) : listProps;
|
|
202
|
-
// Load the form info
|
|
203
|
-
gd_sprest_bs_1.Helper.ListForm.create(listProps).then(function (info) {
|
|
204
|
-
// Save the information
|
|
205
|
-
_this._info = info;
|
|
188
|
+
// Get the context information
|
|
189
|
+
(0, _1.getContextInfo)(webUrl).then(function (requestDigest) {
|
|
190
|
+
// Set the request digest
|
|
191
|
+
_this._requestDigest = requestDigest;
|
|
192
|
+
// See if the info already exists
|
|
193
|
+
if (_this._info) {
|
|
206
194
|
// Form information is already loaded
|
|
207
195
|
onComplete();
|
|
208
|
-
}
|
|
209
|
-
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
// Set the list form properties
|
|
199
|
+
var listProps = {
|
|
200
|
+
listName: _this.ListName,
|
|
201
|
+
itemId: itemId,
|
|
202
|
+
requestDigest: requestDigest,
|
|
203
|
+
webUrl: webUrl
|
|
204
|
+
};
|
|
205
|
+
// Call the event
|
|
206
|
+
listProps = _this._onGetListInfo ? _this._onGetListInfo(listProps) : listProps;
|
|
207
|
+
// Load the form info
|
|
208
|
+
gd_sprest_bs_1.Helper.ListForm.create(listProps).then(function (info) {
|
|
209
|
+
// Save the information
|
|
210
|
+
_this._info = info;
|
|
211
|
+
// Form information is already loaded
|
|
212
|
+
onComplete();
|
|
213
|
+
}, reject);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
210
216
|
});
|
|
211
217
|
};
|
|
212
218
|
// Renders the display form
|
|
@@ -516,6 +522,7 @@ var ItemForm = /** @class */ (function () {
|
|
|
516
522
|
ItemForm._onShowForm = null;
|
|
517
523
|
ItemForm._onSave = null;
|
|
518
524
|
ItemForm._onValidation = null;
|
|
525
|
+
ItemForm._requestDigest = null;
|
|
519
526
|
ItemForm._tabInfo = null;
|
|
520
527
|
ItemForm._updateEvent = null;
|
|
521
528
|
// Display Form
|
package/build/common/list.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Types } from "gd-sprest-bs";
|
|
2
|
-
import { IItemFormCreateProps, IItemFormEditProps, IItemFormViewProps } from "
|
|
2
|
+
import { IItemFormCreateProps, IItemFormEditProps, IItemFormViewProps } from ".";
|
|
3
3
|
/** List Properties */
|
|
4
4
|
export interface IListProps<T = Types.SP.ListItem> {
|
|
5
5
|
itemQuery?: Types.IODataQuery;
|
|
@@ -55,7 +55,6 @@ export declare class List<T = Types.SP.ListItem> {
|
|
|
55
55
|
constructor(props: IListProps<T>);
|
|
56
56
|
private clear;
|
|
57
57
|
createItem(values: any): PromiseLike<T>;
|
|
58
|
-
private getContextInfo;
|
|
59
58
|
newForm(props: IItemFormCreateProps): void;
|
|
60
59
|
editForm(props: IItemFormEditProps): void;
|
|
61
60
|
private init;
|
package/build/common/list.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.List = void 0;
|
|
4
4
|
var gd_sprest_bs_1 = require("gd-sprest-bs");
|
|
5
|
-
var
|
|
5
|
+
var _1 = require(".");
|
|
6
6
|
/**
|
|
7
7
|
* List
|
|
8
8
|
*/
|
|
@@ -59,7 +59,8 @@ var List = /** @class */ (function () {
|
|
|
59
59
|
this._viewName = props.viewName;
|
|
60
60
|
this._webUrl = props.webUrl || gd_sprest_bs_1.ContextInfo.webServerRelativeUrl;
|
|
61
61
|
// Set the context information
|
|
62
|
-
|
|
62
|
+
(0, _1.getContextInfo)(props.webUrl).then(function (requestDigest) {
|
|
63
|
+
_this._requestDigest = requestDigest;
|
|
63
64
|
// Load the list information
|
|
64
65
|
_this.init().then(function () {
|
|
65
66
|
// Load the items
|
|
@@ -96,13 +97,13 @@ var List = /** @class */ (function () {
|
|
|
96
97
|
Object.defineProperty(List.prototype, "EditForm", {
|
|
97
98
|
/** Public Properties */
|
|
98
99
|
// Reference to the edit form
|
|
99
|
-
get: function () { return
|
|
100
|
+
get: function () { return _1.ItemForm.EditForm; },
|
|
100
101
|
enumerable: false,
|
|
101
102
|
configurable: true
|
|
102
103
|
});
|
|
103
104
|
Object.defineProperty(List.prototype, "EditForms", {
|
|
104
105
|
// Reference to the edit forms, if tabs are used
|
|
105
|
-
get: function () { return
|
|
106
|
+
get: function () { return _1.ItemForm.EditForms; },
|
|
106
107
|
enumerable: false,
|
|
107
108
|
configurable: true
|
|
108
109
|
});
|
|
@@ -148,13 +149,13 @@ var List = /** @class */ (function () {
|
|
|
148
149
|
});
|
|
149
150
|
Object.defineProperty(List.prototype, "ViewForm", {
|
|
150
151
|
// Reference to the display form
|
|
151
|
-
get: function () { return
|
|
152
|
+
get: function () { return _1.ItemForm.DisplayForm; },
|
|
152
153
|
enumerable: false,
|
|
153
154
|
configurable: true
|
|
154
155
|
});
|
|
155
156
|
Object.defineProperty(List.prototype, "ViewForms", {
|
|
156
157
|
// Reference to the display forms, if tabs are used
|
|
157
|
-
get: function () { return
|
|
158
|
+
get: function () { return _1.ItemForm.DisplayForms; },
|
|
158
159
|
enumerable: false,
|
|
159
160
|
configurable: true
|
|
160
161
|
});
|
|
@@ -176,9 +177,9 @@ var List = /** @class */ (function () {
|
|
|
176
177
|
// Clears the modal or canvas
|
|
177
178
|
List.prototype.clear = function () {
|
|
178
179
|
// Clear the modal/form
|
|
179
|
-
|
|
180
|
+
_1.ItemForm.UseModal ? _1.Modal.clear() : _1.CanvasForm.clear();
|
|
180
181
|
// Set the list name
|
|
181
|
-
|
|
182
|
+
_1.ItemForm.ListName = this.ListName;
|
|
182
183
|
// Call the event
|
|
183
184
|
this._onResetForm ? this._onResetForm() : null;
|
|
184
185
|
};
|
|
@@ -191,40 +192,19 @@ var List = /** @class */ (function () {
|
|
|
191
192
|
_this.ListInfo.Items().add(values).execute(resolve, reject);
|
|
192
193
|
});
|
|
193
194
|
};
|
|
194
|
-
// Gets the context information of the target site
|
|
195
|
-
List.prototype.getContextInfo = function (webUrl) {
|
|
196
|
-
var _this = this;
|
|
197
|
-
// Return a promise
|
|
198
|
-
return new Promise(function (resolve, reject) {
|
|
199
|
-
// See if the web url exists
|
|
200
|
-
if (webUrl) {
|
|
201
|
-
// Get the context info of the site
|
|
202
|
-
gd_sprest_bs_1.ContextInfo.getWeb(webUrl).execute(function (info) {
|
|
203
|
-
// Set the context info
|
|
204
|
-
_this._requestDigest = info.GetContextWebInformation.FormDigestValue;
|
|
205
|
-
// Resolve the request
|
|
206
|
-
resolve();
|
|
207
|
-
}, reject);
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
// Resolve the request
|
|
211
|
-
resolve();
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
};
|
|
215
195
|
// Displays the new form
|
|
216
196
|
List.prototype.newForm = function (props) {
|
|
217
197
|
// Clear the modal/canvas
|
|
218
198
|
this.clear();
|
|
219
199
|
// Display the form
|
|
220
|
-
|
|
200
|
+
_1.ItemForm.create(props).then(null, this._onLoadFormError);
|
|
221
201
|
};
|
|
222
202
|
// Displays the edit form
|
|
223
203
|
List.prototype.editForm = function (props) {
|
|
224
204
|
// Clear the modal/canvas
|
|
225
205
|
this.clear();
|
|
226
206
|
// Display the form
|
|
227
|
-
|
|
207
|
+
_1.ItemForm.edit(props).then(null, this._onLoadFormError);
|
|
228
208
|
};
|
|
229
209
|
// Initializes the list component
|
|
230
210
|
List.prototype.init = function () {
|
|
@@ -427,7 +407,11 @@ var List = /** @class */ (function () {
|
|
|
427
407
|
// See if the request digest is set
|
|
428
408
|
if (_this._requestDigest) {
|
|
429
409
|
// Get the context information
|
|
430
|
-
|
|
410
|
+
(0, _1.getContextInfo)(_this.WebUrl).then(function (requestDigest) {
|
|
411
|
+
// Save the value and resolve the request
|
|
412
|
+
_this._requestDigest = requestDigest;
|
|
413
|
+
resolve();
|
|
414
|
+
}, reject);
|
|
431
415
|
}
|
|
432
416
|
else {
|
|
433
417
|
// Resolve the request
|
|
@@ -455,7 +439,7 @@ var List = /** @class */ (function () {
|
|
|
455
439
|
// Clear the modal/canvas
|
|
456
440
|
this.clear();
|
|
457
441
|
// Display the form
|
|
458
|
-
|
|
442
|
+
_1.ItemForm.view(props).then(null, this._onLoadFormError);
|
|
459
443
|
};
|
|
460
444
|
return List;
|
|
461
445
|
}());
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ListSecurity = exports.ListSecurityDefaultGroups = void 0;
|
|
4
4
|
var gd_sprest_bs_1 = require("gd-sprest-bs");
|
|
5
5
|
var loadingDialog_1 = require("./loadingDialog");
|
|
6
|
+
var methods_1 = require("./methods");
|
|
6
7
|
var modal_1 = require("./modal");
|
|
7
8
|
// List Security Default Groups
|
|
8
9
|
exports.ListSecurityDefaultGroups = {
|
|
@@ -31,7 +32,9 @@ var ListSecurity = /** @class */ (function () {
|
|
|
31
32
|
// Save the properties
|
|
32
33
|
this._props = props;
|
|
33
34
|
// Get the context information
|
|
34
|
-
|
|
35
|
+
(0, methods_1.getContextInfo)(this._props.webUrl).then(function (requestDigest) {
|
|
36
|
+
// Set the request digest value
|
|
37
|
+
_this._requestDigest = requestDigest;
|
|
35
38
|
// Get the current user information
|
|
36
39
|
_this.loadCurrentUser();
|
|
37
40
|
// Get the permission types
|
|
@@ -218,27 +221,6 @@ var ListSecurity = /** @class */ (function () {
|
|
|
218
221
|
}).then(resolve, reject);
|
|
219
222
|
});
|
|
220
223
|
};
|
|
221
|
-
// Gets the context information of the target site
|
|
222
|
-
ListSecurity.prototype.getContextInfo = function (webUrl) {
|
|
223
|
-
var _this = this;
|
|
224
|
-
// Return a promise
|
|
225
|
-
return new Promise(function (resolve, reject) {
|
|
226
|
-
// See if the web url exists
|
|
227
|
-
if (webUrl) {
|
|
228
|
-
// Get the context info of the site
|
|
229
|
-
gd_sprest_bs_1.ContextInfo.getWeb(webUrl).execute(function (info) {
|
|
230
|
-
// Set the context info
|
|
231
|
-
_this._requestDigest = info.GetContextWebInformation.FormDigestValue;
|
|
232
|
-
// Resolve the request
|
|
233
|
-
resolve();
|
|
234
|
-
}, reject);
|
|
235
|
-
}
|
|
236
|
-
else {
|
|
237
|
-
// Resolve the request
|
|
238
|
-
resolve();
|
|
239
|
-
}
|
|
240
|
-
});
|
|
241
|
-
};
|
|
242
224
|
// Gets the group id
|
|
243
225
|
ListSecurity.prototype.getGroupId = function (groupName) {
|
|
244
226
|
var _this = this;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const formatBytes: (bytes: number, decimals?: number) => string;
|
|
2
2
|
export declare const formatDateValue: (value: string, format?: string) => string;
|
|
3
3
|
export declare const formatTimeValue: (value: string, format?: string) => string;
|
|
4
|
+
export declare const getContextInfo: (webUrl: string) => PromiseLike<string>;
|
|
4
5
|
export declare const getFileExt: (fileName?: string) => string;
|
package/build/common/methods.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFileExt = exports.formatTimeValue = exports.formatDateValue = exports.formatBytes = void 0;
|
|
3
|
+
exports.getFileExt = exports.getContextInfo = exports.formatTimeValue = exports.formatDateValue = exports.formatBytes = void 0;
|
|
4
|
+
var gd_sprest_bs_1 = require("gd-sprest-bs");
|
|
4
5
|
var moment = require("moment");
|
|
5
6
|
// Formats file size into human readable form
|
|
6
7
|
var formatBytes = function (bytes, decimals) {
|
|
@@ -39,6 +40,25 @@ var formatTimeValue = function (value, format) {
|
|
|
39
40
|
return "";
|
|
40
41
|
};
|
|
41
42
|
exports.formatTimeValue = formatTimeValue;
|
|
43
|
+
// Gets the context information of the target site
|
|
44
|
+
var getContextInfo = function (webUrl) {
|
|
45
|
+
// Return a promise
|
|
46
|
+
return new Promise(function (resolve, reject) {
|
|
47
|
+
// See if the web url exists
|
|
48
|
+
if (webUrl) {
|
|
49
|
+
// Get the context info of the site
|
|
50
|
+
gd_sprest_bs_1.ContextInfo.getWeb(webUrl).execute(function (info) {
|
|
51
|
+
// Resolve the request
|
|
52
|
+
resolve(info.GetContextWebInformation.FormDigestValue);
|
|
53
|
+
}, reject);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
// Resolve the request
|
|
57
|
+
resolve(null);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
exports.getContextInfo = getContextInfo;
|
|
42
62
|
// Returns the extension of a file name
|
|
43
63
|
var getFileExt = function (fileName) {
|
|
44
64
|
if (fileName === void 0) { fileName = ""; }
|
package/build/lib.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export declare const DattaTable: {
|
|
|
29
29
|
formatBytes: (bytes: number, decimals?: number) => string;
|
|
30
30
|
formatDateValue: (value: string, format?: string) => string;
|
|
31
31
|
formatTimeValue: (value: string, format?: string) => string;
|
|
32
|
+
getContextInfo: (webUrl: string) => PromiseLike<string>;
|
|
32
33
|
getFileExt: (fileName?: string) => string;
|
|
33
34
|
Modal: typeof Common.Modal;
|
|
34
35
|
Timeout: typeof Common.Timeout;
|