dattatable 2.9.30 → 2.9.32

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.
Files changed (57) hide show
  1. package/build/common/list.d.ts +3 -0
  2. package/build/common/list.js +76 -24
  3. package/build/common/listSecurity.d.ts +2 -0
  4. package/build/common/listSecurity.js +43 -15
  5. package/dist/dattatable.js +199 -199
  6. package/dist/dattatable.min.js +1 -1
  7. package/docs/assets/search.js +1 -1
  8. package/docs/classes/AuditLog.html +2 -2
  9. package/docs/classes/CanvasForm.html +2 -2
  10. package/docs/classes/Comments.html +2 -2
  11. package/docs/classes/Dashboard.html +4 -4
  12. package/docs/classes/DataTable.html +3 -3
  13. package/docs/classes/Documents.html +6 -6
  14. package/docs/classes/FilterSlideout.html +2 -2
  15. package/docs/classes/Footer.html +2 -2
  16. package/docs/classes/Header.html +2 -2
  17. package/docs/classes/InstallationRequired.html +2 -2
  18. package/docs/classes/ItemForm.html +4 -4
  19. package/docs/classes/List.html +7 -4
  20. package/docs/classes/ListSecurity.html +4 -2
  21. package/docs/classes/LoadingDialog.html +2 -2
  22. package/docs/classes/Modal.html +2 -2
  23. package/docs/classes/Navigation.html +3 -3
  24. package/docs/classes/Timeout.html +2 -2
  25. package/docs/enums/ActionButtonTypes.html +2 -2
  26. package/docs/functions/formatBytes.html +1 -1
  27. package/docs/functions/formatDateValue.html +1 -1
  28. package/docs/functions/formatTimeValue.html +1 -1
  29. package/docs/functions/getFileExt.html +1 -1
  30. package/docs/functions/waitForTheme.html +1 -1
  31. package/docs/interfaces/IAuditLogItem.html +2 -2
  32. package/docs/interfaces/IAuditLogItemCreation.html +2 -2
  33. package/docs/interfaces/IAuditLogProps.html +2 -2
  34. package/docs/interfaces/IAuditLogViewProps.html +2 -2
  35. package/docs/interfaces/ICommentsItem.html +2 -2
  36. package/docs/interfaces/IDashboardProps.html +2 -2
  37. package/docs/interfaces/IDataTable.html +2 -2
  38. package/docs/interfaces/IDataTableProps.html +2 -2
  39. package/docs/interfaces/IDocumentsProps.html +2 -2
  40. package/docs/interfaces/IFilterItem.html +2 -2
  41. package/docs/interfaces/IFilterProps.html +2 -2
  42. package/docs/interfaces/IFooterProps.html +2 -2
  43. package/docs/interfaces/IHeaderProps.html +2 -2
  44. package/docs/interfaces/IInstallProps.html +2 -2
  45. package/docs/interfaces/IItemFormCreateProps.html +2 -2
  46. package/docs/interfaces/IItemFormEditProps.html +2 -2
  47. package/docs/interfaces/IItemFormTab.html +2 -2
  48. package/docs/interfaces/IItemFormTabInfo.html +2 -2
  49. package/docs/interfaces/IItemFormViewProps.html +2 -2
  50. package/docs/interfaces/IListProps.html +2 -2
  51. package/docs/interfaces/IListSecurity.html +2 -2
  52. package/docs/interfaces/IListSecurityItem.html +2 -2
  53. package/docs/interfaces/IShowDialogProps.html +2 -2
  54. package/docs/variables/DattaTable.html +1 -1
  55. package/docs/variables/ListSecurityDefaultGroups.html +1 -1
  56. package/package.json +2 -2
  57. package/pnpm-lock.yaml +4 -4
@@ -51,9 +51,11 @@ export declare class List<T = Types.SP.ListItem> {
51
51
  private _onLoadFormError;
52
52
  private _onRefreshItems?;
53
53
  private _onResetForm;
54
+ private _requestDigest;
54
55
  constructor(props: IListProps<T>);
55
56
  private clear;
56
57
  createItem(values: any): PromiseLike<T>;
58
+ private getContextInfo;
57
59
  newForm(props: IItemFormCreateProps): void;
58
60
  editForm(props: IItemFormEditProps): void;
59
61
  private init;
@@ -62,6 +64,7 @@ export declare class List<T = Types.SP.ListItem> {
62
64
  private loadItemsByQuery;
63
65
  private loadItemsByView;
64
66
  refresh(query?: Types.IODataQuery): PromiseLike<T[]>;
67
+ private refreshContextInfo;
65
68
  refreshItem(itemId: number, query?: Types.IODataQuery): PromiseLike<T>;
66
69
  updateItem(itemId: number, values: any): PromiseLike<void>;
67
70
  viewForm(props: IItemFormViewProps): void;
@@ -45,6 +45,8 @@ var List = /** @class */ (function () {
45
45
  this._onRefreshItems = null;
46
46
  // Event triggered when the form is reset
47
47
  this._onResetForm = null;
48
+ // The request digest value of the target site
49
+ this._requestDigest = null;
48
50
  // Save the properties
49
51
  this._listName = props.listName;
50
52
  this._odata = props.itemQuery;
@@ -56,14 +58,24 @@ var List = /** @class */ (function () {
56
58
  this._onResetForm = props.onResetForm;
57
59
  this._viewName = props.viewName;
58
60
  this._webUrl = props.webUrl || gd_sprest_bs_1.ContextInfo.webServerRelativeUrl;
59
- // Load the list information
60
- this.init().then(function () {
61
- // Load the items
62
- _this.loadItems().then(function () {
63
- // Call the event
64
- _this._onInitialized ? _this._onInitialized() : null;
65
- // Call the items loaded event
66
- _this._onItemsLoaded ? _this._onItemsLoaded(_this.Items) : null;
61
+ // Set the context information
62
+ this.getContextInfo(props.webUrl).then(function () {
63
+ // Load the list information
64
+ _this.init().then(function () {
65
+ // Load the items
66
+ _this.loadItems().then(function () {
67
+ // Call the event
68
+ _this._onInitialized ? _this._onInitialized() : null;
69
+ // Call the items loaded event
70
+ _this._onItemsLoaded ? _this._onItemsLoaded(_this.Items) : null;
71
+ }, function () {
72
+ var args = [];
73
+ for (var _i = 0; _i < arguments.length; _i++) {
74
+ args[_i] = arguments[_i];
75
+ }
76
+ // Call the init error event
77
+ _this._onInitError ? _this._onInitError.apply(_this, args) : null;
78
+ });
67
79
  }, function () {
68
80
  var args = [];
69
81
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -179,6 +191,27 @@ var List = /** @class */ (function () {
179
191
  _this.ListInfo.Items().add(values).execute(resolve, reject);
180
192
  });
181
193
  };
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
+ };
182
215
  // Displays the new form
183
216
  List.prototype.newForm = function (props) {
184
217
  // Clear the modal/canvas
@@ -198,7 +231,7 @@ var List = /** @class */ (function () {
198
231
  var _this = this;
199
232
  // Return a promise
200
233
  return new Promise(function (resolve, reject) {
201
- var list = (0, gd_sprest_bs_1.Web)(_this.WebUrl).Lists(_this.ListName);
234
+ var list = (0, gd_sprest_bs_1.Web)(_this.WebUrl, { requestDigest: _this._requestDigest }).Lists(_this.ListName);
202
235
  // Query the list content types
203
236
  list.execute(function (list) {
204
237
  // Save the list information
@@ -260,7 +293,7 @@ var List = /** @class */ (function () {
260
293
  // Return a promise
261
294
  return new Promise(function (resolve, reject) {
262
295
  // Query the items
263
- (0, gd_sprest_bs_1.Web)(_this.WebUrl).Lists(_this.ListName).Items(itemId).query({
296
+ (0, gd_sprest_bs_1.Web)(_this.WebUrl, { requestDigest: _this._requestDigest }).Lists(_this.ListName).Items(itemId).query({
264
297
  Custom: query ? query.Custom : null,
265
298
  Expand: query ? query.Expand : null,
266
299
  Select: query ? query.Select : null
@@ -319,7 +352,7 @@ var List = /** @class */ (function () {
319
352
  return;
320
353
  }
321
354
  // Query the items
322
- (0, gd_sprest_bs_1.Web)(_this.WebUrl).Lists(_this.ListName).Items().query(query).execute(function (items) {
355
+ (0, gd_sprest_bs_1.Web)(_this.WebUrl, { requestDigest: _this._requestDigest }).Lists(_this.ListName).Items().query(query).execute(function (items) {
323
356
  // Save the items
324
357
  _this._items = items.results;
325
358
  // Resolve the request
@@ -345,7 +378,7 @@ var List = /** @class */ (function () {
345
378
  return;
346
379
  }
347
380
  // Query the items
348
- (0, gd_sprest_bs_1.Web)(_this.WebUrl).Lists(_this.ListName).getItems(_this.ViewXml).execute(function (items) {
381
+ (0, gd_sprest_bs_1.Web)(_this.WebUrl, { requestDigest: _this._requestDigest }).Lists(_this.ListName).getItems(_this.ViewXml).execute(function (items) {
349
382
  // Save the items
350
383
  _this._items = items.results;
351
384
  // Resolve the request
@@ -368,21 +401,40 @@ var List = /** @class */ (function () {
368
401
  this._items = null;
369
402
  // Return a promise
370
403
  return new Promise(function (resolve, reject) {
371
- // Load the data
372
- _this.loadItems(query).then(function (items) {
373
- // Call the event
374
- var callback = _this._onRefreshItems ? _this._onRefreshItems(items) : null;
375
- if (callback && typeof (callback.then) === "function") {
376
- // Wait for the request to complete
377
- callback.then(resolve, reject);
378
- }
379
- else {
380
- // Resolve the request
381
- resolve(items);
382
- }
404
+ // Refresh the context information
405
+ _this.refreshContextInfo().then(function () {
406
+ // Load the data
407
+ _this.loadItems(query).then(function (items) {
408
+ // Call the event
409
+ var callback = _this._onRefreshItems ? _this._onRefreshItems(items) : null;
410
+ if (callback && typeof (callback.then) === "function") {
411
+ // Wait for the request to complete
412
+ callback.then(resolve, reject);
413
+ }
414
+ else {
415
+ // Resolve the request
416
+ resolve(items);
417
+ }
418
+ }, reject);
383
419
  }, reject);
384
420
  });
385
421
  };
422
+ // Refreshes the context information
423
+ List.prototype.refreshContextInfo = function () {
424
+ var _this = this;
425
+ // Return a promise
426
+ return new Promise(function (resolve, reject) {
427
+ // See if the request digest is set
428
+ if (_this._requestDigest) {
429
+ // Get the context information
430
+ _this.getContextInfo(_this.WebUrl).then(resolve, reject);
431
+ }
432
+ else {
433
+ // Resolve the request
434
+ resolve();
435
+ }
436
+ });
437
+ };
386
438
  // Refresh the data
387
439
  List.prototype.refreshItem = function (itemId, query) {
388
440
  if (query === void 0) { query = this.OData; }
@@ -27,6 +27,7 @@ export declare class ListSecurity {
27
27
  private _ddlItems;
28
28
  private _permissionTypes;
29
29
  private _props;
30
+ private _requestDigest;
30
31
  private _currentUser;
31
32
  get CurrentUser(): Types.SP.User;
32
33
  private _groups;
@@ -41,6 +42,7 @@ export declare class ListSecurity {
41
42
  private configureList;
42
43
  private configureLists;
43
44
  private createGroups;
45
+ private getContextInfo;
44
46
  private getGroupId;
45
47
  private getPermissionTypes;
46
48
  isInGroup(userId: number, groupName: string): boolean;
@@ -17,9 +17,11 @@ exports.ListSecurityDefaultGroups = {
17
17
  var ListSecurity = /** @class */ (function () {
18
18
  // Constructor
19
19
  function ListSecurity(props) {
20
+ var _this = this;
20
21
  this._ddlItems = null;
21
22
  this._permissionTypes = null;
22
23
  this._props = null;
24
+ this._requestDigest = null;
23
25
  // Current User
24
26
  this._currentUser = null;
25
27
  // Security group information
@@ -28,12 +30,15 @@ var ListSecurity = /** @class */ (function () {
28
30
  this._groupUsers = {};
29
31
  // Save the properties
30
32
  this._props = props;
31
- // Get the current user information
32
- this.loadCurrentUser();
33
- // Get the permission types
34
- this.getPermissionTypes();
35
- // Load the groups
36
- this.loadGroups();
33
+ // Get the context information
34
+ this.getContextInfo(this._props.webUrl).then(function () {
35
+ // Get the current user information
36
+ _this.loadCurrentUser();
37
+ // Get the permission types
38
+ _this.getPermissionTypes();
39
+ // Load the groups
40
+ _this.loadGroups();
41
+ });
37
42
  }
38
43
  Object.defineProperty(ListSecurity.prototype, "CurrentUser", {
39
44
  get: function () { return this._currentUser; },
@@ -109,7 +114,7 @@ var ListSecurity = /** @class */ (function () {
109
114
  // Exists
110
115
  function (groupId) {
111
116
  // Add the group to the list
112
- (0, gd_sprest_bs_1.Web)(_this._props.webUrl).Lists(listInfo.listName).RoleAssignments().addRoleAssignment(groupId, permissionId).execute(resolve, function () {
117
+ (0, gd_sprest_bs_1.Web)(_this._props.webUrl, { requestDigest: _this._requestDigest }).Lists(listInfo.listName).RoleAssignments().addRoleAssignment(groupId, permissionId).execute(resolve, function () {
113
118
  // Log to the console
114
119
  console.error("[".concat(listInfo.listName, "] Error adding the group '").concat(listInfo.groupName, "' with permission ").concat(listInfo.permission, " to the list."));
115
120
  // Resolve the request
@@ -191,7 +196,7 @@ var ListSecurity = /** @class */ (function () {
191
196
  // Call the event if it exists
192
197
  props = _this._props.onGroupCreating ? _this._props.onGroupCreating(props) : props;
193
198
  // Create the group
194
- (0, gd_sprest_bs_1.Web)(_this._props.webUrl).SiteGroups().add(props).execute(
199
+ (0, gd_sprest_bs_1.Web)(_this._props.webUrl, { requestDigest: _this._requestDigest }).SiteGroups().add(props).execute(
195
200
  // Successfully created the group
196
201
  function (group) {
197
202
  // Set the group id
@@ -213,6 +218,27 @@ var ListSecurity = /** @class */ (function () {
213
218
  }).then(resolve, reject);
214
219
  });
215
220
  };
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
+ };
216
242
  // Gets the group id
217
243
  ListSecurity.prototype.getGroupId = function (groupName) {
218
244
  var _this = this;
@@ -229,7 +255,7 @@ var ListSecurity = /** @class */ (function () {
229
255
  switch (key) {
230
256
  // Default owner's group
231
257
  case exports.ListSecurityDefaultGroups.Owners:
232
- (0, gd_sprest_bs_1.Web)(_this._props.webUrl).AssociatedOwnerGroup().query({
258
+ (0, gd_sprest_bs_1.Web)(_this._props.webUrl, { requestDigest: _this._requestDigest }).AssociatedOwnerGroup().query({
233
259
  Expand: ["Users"]
234
260
  }).execute(function (group) {
235
261
  _this.setGroup(key, group);
@@ -239,7 +265,7 @@ var ListSecurity = /** @class */ (function () {
239
265
  break;
240
266
  // Default member's group
241
267
  case exports.ListSecurityDefaultGroups.Members:
242
- (0, gd_sprest_bs_1.Web)(_this._props.webUrl).AssociatedMemberGroup().query({
268
+ (0, gd_sprest_bs_1.Web)(_this._props.webUrl, { requestDigest: _this._requestDigest }).AssociatedMemberGroup().query({
243
269
  Expand: ["Users"]
244
270
  }).execute(function (group) {
245
271
  _this.setGroup(key, group);
@@ -249,7 +275,7 @@ var ListSecurity = /** @class */ (function () {
249
275
  break;
250
276
  // Default visitor's group
251
277
  case exports.ListSecurityDefaultGroups.Visitors:
252
- (0, gd_sprest_bs_1.Web)(_this._props.webUrl).AssociatedVisitorGroup().query({
278
+ (0, gd_sprest_bs_1.Web)(_this._props.webUrl, { requestDigest: _this._requestDigest }).AssociatedVisitorGroup().query({
253
279
  Expand: ["Users"]
254
280
  }).execute(function (group) {
255
281
  _this.setGroup(key, group);
@@ -260,7 +286,7 @@ var ListSecurity = /** @class */ (function () {
260
286
  // Default
261
287
  default:
262
288
  // Get the group
263
- (0, gd_sprest_bs_1.Web)(_this._props.webUrl).SiteGroups().getByName(groupName).query({
289
+ (0, gd_sprest_bs_1.Web)(_this._props.webUrl, { requestDigest: _this._requestDigest }).SiteGroups().getByName(groupName).query({
264
290
  Expand: ["Users"]
265
291
  }).execute(function (group) {
266
292
  _this.setGroup(key, group);
@@ -276,7 +302,7 @@ var ListSecurity = /** @class */ (function () {
276
302
  // Return a promise
277
303
  return new Promise(function (resolve) {
278
304
  // Get the definitions
279
- (0, gd_sprest_bs_1.Web)(_this._props.webUrl).RoleDefinitions().query({
305
+ (0, gd_sprest_bs_1.Web)(_this._props.webUrl, { requestDigest: _this._requestDigest }).RoleDefinitions().query({
280
306
  OrderBy: ["Name"]
281
307
  }).execute(function (roleDefs) {
282
308
  // Clear the permissions and items
@@ -316,7 +342,7 @@ var ListSecurity = /** @class */ (function () {
316
342
  ListSecurity.prototype.loadCurrentUser = function () {
317
343
  var _this = this;
318
344
  // Load the current user
319
- (0, gd_sprest_bs_1.Web)(this._props.webUrl).CurrentUser().execute(
345
+ (0, gd_sprest_bs_1.Web)(this._props.webUrl, { requestDigest: this._requestDigest }).CurrentUser().execute(
320
346
  // Success
321
347
  function (user) {
322
348
  // Set the user
@@ -408,6 +434,8 @@ var ListSecurity = /** @class */ (function () {
408
434
  var _this = this;
409
435
  // Clear the modal
410
436
  modal_1.Modal.clear();
437
+ // Set the size
438
+ modal_1.Modal.setType(gd_sprest_bs_1.Components.ModalTypes.XLarge);
411
439
  // Set the header
412
440
  modal_1.Modal.setHeader("List Security");
413
441
  // Get the default groups
@@ -537,7 +565,7 @@ var ListSecurity = /** @class */ (function () {
537
565
  return new Promise(function (resolve) {
538
566
  // Parse the list keys
539
567
  for (var listName in lists) {
540
- var list = (0, gd_sprest_bs_1.Web)(_this._props.webUrl).Lists(listName);
568
+ var list = (0, gd_sprest_bs_1.Web)(_this._props.webUrl, { requestDigest: _this._requestDigest }).Lists(listName);
541
569
  // Reset the permissions
542
570
  list.resetRoleInheritance().execute();
543
571
  // Revert to the default