dattatable 2.9.1 → 2.9.2-t

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 (64) hide show
  1. package/build/common/documents.js +1 -1
  2. package/build/common/itemForm.d.ts +1 -0
  3. package/build/common/itemForm.js +1 -0
  4. package/build/common/listSecurity.d.ts +17 -2
  5. package/build/common/listSecurity.js +288 -61
  6. package/build/lib.d.ts +5 -0
  7. package/build/styles.js +1 -1
  8. package/dist/dattatable.js +493 -471
  9. package/dist/dattatable.min.js +1 -1
  10. package/docs/assets/main.js +58 -53
  11. package/docs/assets/navigation.js +1 -0
  12. package/docs/assets/search.js +1 -1
  13. package/docs/assets/style.css +496 -370
  14. package/docs/classes/AuditLog.html +14 -235
  15. package/docs/classes/CanvasForm.html +18 -255
  16. package/docs/classes/Comments.html +14 -229
  17. package/docs/classes/Dashboard.html +23 -304
  18. package/docs/classes/DataTable.html +14 -236
  19. package/docs/classes/Documents.html +51 -551
  20. package/docs/classes/FilterSlideout.html +15 -219
  21. package/docs/classes/Footer.html +5 -106
  22. package/docs/classes/Header.html +5 -106
  23. package/docs/classes/InstallationRequired.html +14 -205
  24. package/docs/classes/ItemForm.html +49 -679
  25. package/docs/classes/List.html +50 -631
  26. package/docs/classes/ListSecurity.html +28 -279
  27. package/docs/classes/LoadingDialog.html +13 -187
  28. package/docs/classes/Modal.html +27 -374
  29. package/docs/classes/Navigation.html +8 -125
  30. package/docs/classes/Timeout.html +9 -141
  31. package/docs/enums/ActionButtonTypes.html +7 -95
  32. package/docs/functions/formatBytes.html +1 -103
  33. package/docs/functions/formatDateValue.html +1 -103
  34. package/docs/functions/formatTimeValue.html +1 -103
  35. package/docs/functions/getFileExt.html +1 -101
  36. package/docs/index.html +8 -122
  37. package/docs/interfaces/IAuditLogItem.html +81 -1065
  38. package/docs/interfaces/IAuditLogItemCreation.html +7 -105
  39. package/docs/interfaces/IAuditLogProps.html +5 -110
  40. package/docs/interfaces/IAuditLogViewProps.html +6 -139
  41. package/docs/interfaces/ICommentsItem.html +6 -105
  42. package/docs/interfaces/IDashboardProps.html +14 -427
  43. package/docs/interfaces/IDataTable.html +9 -204
  44. package/docs/interfaces/IDataTableProps.html +7 -114
  45. package/docs/interfaces/IDocumentsProps.html +26 -562
  46. package/docs/interfaces/IFilterItem.html +6 -105
  47. package/docs/interfaces/IFilterProps.html +5 -106
  48. package/docs/interfaces/IFooterProps.html +7 -125
  49. package/docs/interfaces/IHeaderProps.html +6 -118
  50. package/docs/interfaces/IInstallProps.html +4 -103
  51. package/docs/interfaces/IItemFormCreateProps.html +15 -274
  52. package/docs/interfaces/IItemFormEditProps.html +16 -281
  53. package/docs/interfaces/IItemFormTab.html +9 -167
  54. package/docs/interfaces/IItemFormTabInfo.html +5 -78
  55. package/docs/interfaces/IItemFormViewProps.html +13 -219
  56. package/docs/interfaces/IListProps.html +12 -207
  57. package/docs/interfaces/IListSecurity.html +7 -145
  58. package/docs/interfaces/IListSecurityItem.html +4 -82
  59. package/docs/interfaces/IShowDialogProps.html +7 -153
  60. package/docs/modules.html +48 -150
  61. package/docs/variables/DattaTable.html +1 -153
  62. package/docs/variables/ListSecurityDefaultGroups.html +1 -0
  63. package/package.json +18 -18
  64. package/pnpm-lock.yaml +1332 -1142
@@ -820,7 +820,7 @@ var Documents = /** @class */ (function () {
820
820
  Documents.prototype.renderFileIcon = function (el, fileName) {
821
821
  // Render the icon wrapper
822
822
  var span = document.createElement("span");
823
- span.className = "text-muted";
823
+ span.className = "text-body";
824
824
  el.appendChild(span);
825
825
  // Render the icon
826
826
  var size = 28;
@@ -13,6 +13,7 @@ export interface IItemFormTab {
13
13
  /** Tab Information */
14
14
  export interface IItemFormTabInfo {
15
15
  isVertical?: boolean;
16
+ onClick?: (el?: HTMLElement, item?: Components.IListGroupItem) => void;
16
17
  tabs: IItemFormTab[];
17
18
  }
18
19
  /** Create Item Properties */
@@ -354,6 +354,7 @@ var ItemForm = /** @class */ (function () {
354
354
  data: tabInfo,
355
355
  isActive: i == 0,
356
356
  tabName: tabInfo.title,
357
+ onClick: this._tabInfo.onClick,
357
358
  onRender: function (el, item) {
358
359
  var tab = item.data;
359
360
  // Render the form
@@ -14,6 +14,11 @@ export interface IListSecurityItem {
14
14
  listName: string;
15
15
  permission: number | string;
16
16
  }
17
+ export declare const ListSecurityDefaultGroups: {
18
+ Members: string;
19
+ Owners: string;
20
+ Visitors: string;
21
+ };
17
22
  /**
18
23
  * List Security
19
24
  * This component is used for setting the security group/permissions for a list.
@@ -22,17 +27,27 @@ export declare class ListSecurity {
22
27
  private _ddlItems;
23
28
  private _permissionTypes;
24
29
  private _props;
30
+ private _currentUser;
31
+ get CurrentUser(): Types.SP.User;
25
32
  private _groups;
26
33
  getGroup(groupName: string): Types.SP.Group;
27
- private setGroupId;
34
+ private setGroup;
35
+ private _groupUsers;
36
+ getGroupUsers(groupName: string): Types.SP.User[];
37
+ private addUser;
38
+ private removeUser;
28
39
  constructor(props: IListSecurity);
40
+ addToGroup(userId: number, groupName: string): PromiseLike<void>;
29
41
  private configureList;
30
42
  private configureLists;
31
43
  private createGroups;
32
44
  private getGroupId;
33
45
  private getPermissionTypes;
46
+ isInGroup(userId: number, groupName: string): boolean;
47
+ private loadCurrentUser;
34
48
  private loadGroups;
49
+ removeFromGroup(userId: number, groupName: string): PromiseLike<void>;
35
50
  private renderModal;
36
51
  private resetPermissions;
37
- show(createFl?: boolean): void;
52
+ show(createFl?: boolean, onComplete?: () => void): void;
38
53
  }
@@ -1,9 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ListSecurity = void 0;
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
6
  var modal_1 = require("./modal");
7
+ // List Security Default Groups
8
+ exports.ListSecurityDefaultGroups = {
9
+ Members: "member",
10
+ Owners: "owner",
11
+ Visitors: "visitor"
12
+ };
7
13
  /**
8
14
  * List Security
9
15
  * This component is used for setting the security group/permissions for a list.
@@ -14,21 +20,81 @@ var ListSecurity = /** @class */ (function () {
14
20
  this._ddlItems = null;
15
21
  this._permissionTypes = null;
16
22
  this._props = null;
23
+ // Current User
24
+ this._currentUser = null;
17
25
  // Security group information
18
26
  this._groups = {};
27
+ // Security group users
28
+ this._groupUsers = {};
19
29
  // Save the properties
20
30
  this._props = props;
31
+ // Get the current user information
32
+ this.loadCurrentUser();
21
33
  // Get the permission types
22
34
  this.getPermissionTypes();
23
35
  // Load the groups
24
36
  this.loadGroups();
25
37
  }
38
+ Object.defineProperty(ListSecurity.prototype, "CurrentUser", {
39
+ get: function () { return this._currentUser; },
40
+ enumerable: false,
41
+ configurable: true
42
+ });
26
43
  ListSecurity.prototype.getGroup = function (groupName) { return this._groups[groupName.toLowerCase()]; };
27
- ListSecurity.prototype.setGroupId = function (key, group) {
44
+ ListSecurity.prototype.setGroup = function (key, group) {
28
45
  // Save the info
29
46
  this._groups[key] = group;
30
- // Return the group id
31
- return group.Id;
47
+ this._groupUsers[key] = [];
48
+ // See if the users exist
49
+ if (group.Users) {
50
+ // Set the users for this group
51
+ this._groupUsers[key] = group.Users.results || [];
52
+ }
53
+ };
54
+ ListSecurity.prototype.getGroupUsers = function (groupName) { return this._groupUsers[groupName.toLowerCase()] || []; };
55
+ ListSecurity.prototype.addUser = function (user, groupName) {
56
+ // Ensure the group exists
57
+ var key = groupName.toLowerCase();
58
+ if (this._groupUsers[key]) {
59
+ // Add the user to the group
60
+ this._groupUsers[key].push(user);
61
+ }
62
+ };
63
+ ListSecurity.prototype.removeUser = function (userId, groupName) {
64
+ // Ensure the group exists
65
+ var key = groupName.toLowerCase();
66
+ if (this._groupUsers[key]) {
67
+ // Find the idx of the user
68
+ for (var i = 0; i < this._groupUsers[key].length; i++) {
69
+ // See if this is the user
70
+ var user = this._groupUsers[key][i];
71
+ if (user.Id == userId) {
72
+ // Remove the user
73
+ this._groupUsers[key].splice(i, 1);
74
+ break;
75
+ }
76
+ }
77
+ }
78
+ };
79
+ // Method to check if the user is w/in a group and add them otherwise
80
+ ListSecurity.prototype.addToGroup = function (userId, groupName) {
81
+ var _this = this;
82
+ // Return a promise
83
+ return new Promise(function (resolve, reject) {
84
+ // See if the user is in the group
85
+ if (_this.isInGroup(userId, groupName)) {
86
+ // Resolve the request
87
+ resolve();
88
+ return;
89
+ }
90
+ // Add the user to the group
91
+ _this._groups[groupName].Users().addUserById(userId).execute(function (user) {
92
+ // Add the user to the group
93
+ _this.addUser(user, groupName);
94
+ // Resolve the request
95
+ resolve();
96
+ }, reject);
97
+ });
32
98
  };
33
99
  // Configures a list
34
100
  ListSecurity.prototype.configureList = function (listInfo) {
@@ -67,22 +133,25 @@ var ListSecurity = /** @class */ (function () {
67
133
  // Configures the lists
68
134
  ListSecurity.prototype.configureLists = function (lists) {
69
135
  var _this = this;
70
- var counter = 0;
71
- // Show a loading dialog
72
- loadingDialog_1.LoadingDialog.setHeader("Configuring Lists");
73
- loadingDialog_1.LoadingDialog.setBody("This will close after the lists are configured...");
74
- loadingDialog_1.LoadingDialog.show();
75
- // Reset the lists
76
- this.resetPermissions(lists).then(function () {
77
- // Parse the lists
78
- gd_sprest_bs_1.Helper.Executor(lists, function (list) {
79
- // Return a promise
80
- return new Promise(function (resolve) {
81
- // Update the loading dialog
82
- loadingDialog_1.LoadingDialog.setBody("Configuring ".concat(++counter, " of ").concat(lists.length, " lists..."));
83
- // Configure the list
84
- _this.configureList(list).then(resolve);
85
- });
136
+ // Return a promise
137
+ return new Promise(function (resolve, reject) {
138
+ var counter = 0;
139
+ // Show a loading dialog
140
+ loadingDialog_1.LoadingDialog.setHeader("Configuring Lists");
141
+ loadingDialog_1.LoadingDialog.setBody("This will close after the lists are configured...");
142
+ loadingDialog_1.LoadingDialog.show();
143
+ // Reset the lists
144
+ _this.resetPermissions(lists).then(function () {
145
+ // Parse the lists
146
+ gd_sprest_bs_1.Helper.Executor(lists, function (list) {
147
+ // Return a promise
148
+ return new Promise(function (resolve) {
149
+ // Update the loading dialog
150
+ loadingDialog_1.LoadingDialog.setBody("Configuring ".concat(++counter, " of ").concat(lists.length, " lists..."));
151
+ // Configure the list
152
+ _this.configureList(list).then(resolve);
153
+ });
154
+ }).then(resolve, reject);
86
155
  });
87
156
  });
88
157
  };
@@ -107,9 +176,9 @@ var ListSecurity = /** @class */ (function () {
107
176
  // Get the group
108
177
  _this.getGroupId(groupInfo.Title).then(
109
178
  // Group exists
110
- function (group) {
179
+ function () {
111
180
  // Check the next group
112
- resolve(group);
181
+ resolve(null);
113
182
  },
114
183
  // Group doesn't exist
115
184
  function () {
@@ -126,7 +195,7 @@ var ListSecurity = /** @class */ (function () {
126
195
  // Successfully created the group
127
196
  function (group) {
128
197
  // Set the group id
129
- _this.setGroupId(groupInfo.Title.toLowerCase(), group);
198
+ _this.setGroup(groupInfo.Title.toLowerCase(), group);
130
199
  // Call the event
131
200
  _this._props.onGroupCreated ? _this._props.onGroupCreated(group) : null;
132
201
  // Check the next group
@@ -141,7 +210,7 @@ var ListSecurity = /** @class */ (function () {
141
210
  });
142
211
  });
143
212
  });
144
- });
213
+ }).then(resolve, reject);
145
214
  });
146
215
  };
147
216
  // Gets the group id
@@ -159,21 +228,44 @@ var ListSecurity = /** @class */ (function () {
159
228
  // Get the group information
160
229
  switch (key) {
161
230
  // Default owner's group
162
- case "owner":
163
- (0, gd_sprest_bs_1.Web)(_this._props.webUrl).AssociatedOwnerGroup().execute(function (group) { resolve(_this.setGroupId(key, group)); }, reject);
231
+ case exports.ListSecurityDefaultGroups.Owners:
232
+ (0, gd_sprest_bs_1.Web)(_this._props.webUrl).AssociatedOwnerGroup().query({
233
+ Expand: ["Users"]
234
+ }).execute(function (group) {
235
+ _this.setGroup(key, group);
236
+ _this.setGroup(group.Title.toLowerCase(), group);
237
+ resolve(group.Id);
238
+ }, reject);
164
239
  break;
165
240
  // Default member's group
166
- case "member":
167
- (0, gd_sprest_bs_1.Web)(_this._props.webUrl).AssociatedMemberGroup().execute(function (group) { resolve(_this.setGroupId(key, group)); }, reject);
241
+ case exports.ListSecurityDefaultGroups.Members:
242
+ (0, gd_sprest_bs_1.Web)(_this._props.webUrl).AssociatedMemberGroup().query({
243
+ Expand: ["Users"]
244
+ }).execute(function (group) {
245
+ _this.setGroup(key, group);
246
+ _this.setGroup(group.Title.toLowerCase(), group);
247
+ resolve(group.Id);
248
+ }, reject);
168
249
  break;
169
250
  // Default visitor's group
170
- case "visitor":
171
- (0, gd_sprest_bs_1.Web)(_this._props.webUrl).AssociatedVisitorGroup().execute(function (group) { resolve(_this.setGroupId(key, group)); }, reject);
251
+ case exports.ListSecurityDefaultGroups.Visitors:
252
+ (0, gd_sprest_bs_1.Web)(_this._props.webUrl).AssociatedVisitorGroup().query({
253
+ Expand: ["Users"]
254
+ }).execute(function (group) {
255
+ _this.setGroup(key, group);
256
+ _this.setGroup(group.Title.toLowerCase(), group);
257
+ resolve(group.Id);
258
+ }, reject);
172
259
  break;
173
260
  // Default
174
261
  default:
175
262
  // Get the group
176
- (0, gd_sprest_bs_1.Web)(_this._props.webUrl).SiteGroups().getByName(groupName).execute(function (group) { resolve(_this.setGroupId(key, group)); }, reject);
263
+ (0, gd_sprest_bs_1.Web)(_this._props.webUrl).SiteGroups().getByName(groupName).query({
264
+ Expand: ["Users"]
265
+ }).execute(function (group) {
266
+ _this.setGroup(key, group);
267
+ resolve(group.Id);
268
+ }, reject);
177
269
  break;
178
270
  }
179
271
  });
@@ -184,7 +276,7 @@ var ListSecurity = /** @class */ (function () {
184
276
  // Return a promise
185
277
  return new Promise(function (resolve) {
186
278
  // Get the definitions
187
- (0, gd_sprest_bs_1.Web)().RoleDefinitions().query({
279
+ (0, gd_sprest_bs_1.Web)(_this._props.webUrl).RoleDefinitions().query({
188
280
  OrderBy: ["Name"]
189
281
  }).execute(function (roleDefs) {
190
282
  // Clear the permissions and items
@@ -207,29 +299,132 @@ var ListSecurity = /** @class */ (function () {
207
299
  });
208
300
  });
209
301
  };
302
+ // Method to see if a user is w/in a group
303
+ ListSecurity.prototype.isInGroup = function (userId, groupName) {
304
+ // See if we have the user information
305
+ var users = this.getGroupUsers(groupName);
306
+ for (var i = 0; i < users.length; i++) {
307
+ // See if the user is in this group
308
+ if (users[i].Id == userId) {
309
+ return true;
310
+ }
311
+ }
312
+ // Not in the group
313
+ return false;
314
+ };
315
+ // Loads the current user
316
+ ListSecurity.prototype.loadCurrentUser = function () {
317
+ var _this = this;
318
+ // Load the current user
319
+ (0, gd_sprest_bs_1.Web)(this._props.webUrl).CurrentUser().execute(
320
+ // Success
321
+ function (user) {
322
+ // Set the user
323
+ _this._currentUser = user;
324
+ },
325
+ // Error
326
+ function () {
327
+ // Log
328
+ console.error("Unable to load the current user");
329
+ // Set the information from the context info
330
+ _this._currentUser = {
331
+ Email: gd_sprest_bs_1.ContextInfo.userEmail,
332
+ Id: gd_sprest_bs_1.ContextInfo.userId,
333
+ LoginName: gd_sprest_bs_1.ContextInfo.userLoginName,
334
+ Title: gd_sprest_bs_1.ContextInfo.userDisplayName,
335
+ UserPrincipalName: gd_sprest_bs_1.ContextInfo.userPrincipalName
336
+ };
337
+ });
338
+ };
210
339
  // Loads the security groups
211
340
  ListSecurity.prototype.loadGroups = function () {
212
341
  var _this = this;
342
+ var groupNames = [];
213
343
  // Parse the security groups
214
- gd_sprest_bs_1.Helper.Executor(this._props.groups, function (group) {
215
- // Load the group
216
- return _this.getGroupId(group.Title);
344
+ var groups = this._props.groups || [];
345
+ for (var i = 0; i < groups.length; i++) {
346
+ // Add the group name
347
+ groupNames.push(groups[i].Title);
348
+ }
349
+ // Parse the list items
350
+ var loadDefaultOwner = false;
351
+ var loadDefaultMember = false;
352
+ var loadDefaultVisitor = false;
353
+ for (var i = 0; i < this._props.listItems.length; i++) {
354
+ // See if this item uses a default group name
355
+ switch (this._props.listItems[i].groupName) {
356
+ // Members Group
357
+ case exports.ListSecurityDefaultGroups.Members:
358
+ loadDefaultMember = true;
359
+ break;
360
+ // Owners Group
361
+ case exports.ListSecurityDefaultGroups.Owners:
362
+ loadDefaultOwner = true;
363
+ break;
364
+ // Visitors Group
365
+ case exports.ListSecurityDefaultGroups.Visitors:
366
+ loadDefaultVisitor = true;
367
+ break;
368
+ }
369
+ }
370
+ // Append the group names
371
+ loadDefaultMember ? groupNames.push(exports.ListSecurityDefaultGroups.Members) : null;
372
+ loadDefaultOwner ? groupNames.push(exports.ListSecurityDefaultGroups.Owners) : null;
373
+ loadDefaultVisitor ? groupNames.push(exports.ListSecurityDefaultGroups.Visitors) : null;
374
+ // Parse the security groups
375
+ gd_sprest_bs_1.Helper.Executor(groupNames, function (groupName) {
376
+ // Return a promise
377
+ return new Promise(function (resolve) {
378
+ // Load the group
379
+ _this.getGroupId(groupName).then(resolve, resolve);
380
+ });
217
381
  }).then(function () {
218
382
  // Call the event
219
- _this._props.onGroupsLoaded ? _this._props.onGroupsLoaded() : null;
383
+ _this._props.onGroupsLoaded ? _this._props.onGroupsLoaded(_this._groups) : null;
384
+ });
385
+ };
386
+ // Method remove a user from a specified group
387
+ ListSecurity.prototype.removeFromGroup = function (userId, groupName) {
388
+ var _this = this;
389
+ // Return a promise
390
+ return new Promise(function (resolve, reject) {
391
+ // See if the user is not in the group
392
+ if (!_this.isInGroup(userId, groupName)) {
393
+ // Resolve the request
394
+ resolve();
395
+ return;
396
+ }
397
+ // Remove the user from the group
398
+ _this._groups[groupName].Users().removeById(userId).execute(function () {
399
+ // Add the user to the group
400
+ _this.removeUser(userId, groupName);
401
+ // Resolve the request
402
+ resolve();
403
+ }, reject);
220
404
  });
221
405
  };
222
406
  // Render the modal
223
- ListSecurity.prototype.renderModal = function () {
407
+ ListSecurity.prototype.renderModal = function (onComplete) {
224
408
  var _this = this;
225
409
  // Clear the modal
226
410
  modal_1.Modal.clear();
227
411
  // Set the header
228
412
  modal_1.Modal.setHeader("List Security");
413
+ // Get the default groups
414
+ var defaultGroups = {};
415
+ defaultGroups[exports.ListSecurityDefaultGroups.Members] = this.getGroup(exports.ListSecurityDefaultGroups.Members);
416
+ defaultGroups[exports.ListSecurityDefaultGroups.Owners] = this.getGroup(exports.ListSecurityDefaultGroups.Owners);
417
+ defaultGroups[exports.ListSecurityDefaultGroups.Visitors] = this.getGroup(exports.ListSecurityDefaultGroups.Visitors);
229
418
  // Parse the lists
230
419
  var rows = [];
231
420
  for (var i = 0; i < this._props.listItems.length; i++) {
232
421
  var listItem = this._props.listItems[i];
422
+ // Set the group name
423
+ var groupName = listItem.groupName;
424
+ if (defaultGroups[groupName]) {
425
+ // Set the group name
426
+ groupName = defaultGroups[groupName].Title;
427
+ }
233
428
  // Add the row
234
429
  rows.push({
235
430
  isAutoSized: true,
@@ -247,7 +442,7 @@ var ListSecurity = /** @class */ (function () {
247
442
  name: "groupName_" + i,
248
443
  label: "Group Name",
249
444
  type: gd_sprest_bs_1.Components.FormControlTypes.Readonly,
250
- value: listItem.groupName
445
+ value: groupName
251
446
  }
252
447
  },
253
448
  {
@@ -265,44 +460,61 @@ var ListSecurity = /** @class */ (function () {
265
460
  }
266
461
  // Render the form
267
462
  var form = gd_sprest_bs_1.Components.Form({
463
+ className: "list-security-form",
268
464
  el: modal_1.Modal.BodyElement,
269
465
  rows: rows
270
466
  });
467
+ // Gets the list names
468
+ var getListNames = function () {
469
+ var lists = [];
470
+ // Get the form values
471
+ var tableData = form.getValues();
472
+ // Parse the # of rows
473
+ for (var i = 0; i < rows.length; i++) {
474
+ // Add the list information
475
+ lists.push({
476
+ groupName: tableData["groupName_" + i],
477
+ listName: tableData["listName_" + i],
478
+ permission: tableData["permission_" + i].value
479
+ });
480
+ }
481
+ // Return the list names
482
+ return lists;
483
+ };
271
484
  // Render the footer
272
485
  gd_sprest_bs_1.Components.TooltipGroup({
273
486
  el: modal_1.Modal.FooterElement,
274
487
  tooltips: [
275
488
  {
276
- content: "Closes the modal",
489
+ content: "Configure the list to inherit permissions from the web",
277
490
  btnProps: {
278
- text: "Cancel",
279
- type: gd_sprest_bs_1.Components.ButtonTypes.OutlineDanger,
491
+ text: "Inherit",
492
+ type: gd_sprest_bs_1.Components.ButtonTypes.OutlinePrimary,
280
493
  onClick: function () {
281
- // Close the modal
282
- modal_1.Modal.hide();
494
+ // Reset the list permissions
495
+ _this.resetPermissions(getListNames(), false).then(onComplete);
283
496
  }
284
497
  }
285
498
  },
286
499
  {
287
- content: "Configures the security for the lists.",
500
+ content: "Configure the security for the lists",
288
501
  btnProps: {
289
502
  text: "Configure",
290
503
  type: gd_sprest_bs_1.Components.ButtonTypes.OutlinePrimary,
291
504
  onClick: function () {
292
- var lists = [];
293
- // Get the form values
294
- var tableData = form.getValues();
295
- // Parse the # of rows
296
- for (var i = 0; i < rows.length; i++) {
297
- // Add the list information
298
- lists.push({
299
- groupName: tableData["groupName_" + i],
300
- listName: tableData["listName_" + i],
301
- permission: tableData["permission_" + i]
302
- });
303
- }
304
505
  // Configure the lists
305
- _this.configureLists(lists);
506
+ _this.configureLists(getListNames()).then(onComplete);
507
+ }
508
+ }
509
+ },
510
+ {
511
+ content: "Close this modal",
512
+ btnProps: {
513
+ text: "Close",
514
+ type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,
515
+ onClick: function () {
516
+ // Close the modal
517
+ modal_1.Modal.hide();
306
518
  }
307
519
  }
308
520
  }
@@ -312,8 +524,9 @@ var ListSecurity = /** @class */ (function () {
312
524
  modal_1.Modal.show();
313
525
  };
314
526
  // Reset list permissions
315
- ListSecurity.prototype.resetPermissions = function (listItems) {
527
+ ListSecurity.prototype.resetPermissions = function (listItems, breakInheritance) {
316
528
  var _this = this;
529
+ if (breakInheritance === void 0) { breakInheritance = true; }
317
530
  // Parse the lists
318
531
  var lists = {};
319
532
  for (var i = 0; i < listItems.length; i++) {
@@ -328,14 +541,16 @@ var ListSecurity = /** @class */ (function () {
328
541
  // Reset the permissions
329
542
  list.resetRoleInheritance().execute();
330
543
  // Revert to the default
331
- list.breakRoleInheritance(false, true).execute(true);
544
+ if (breakInheritance) {
545
+ list.breakRoleInheritance(false, true).execute(true);
546
+ }
332
547
  // Wait for the requests to complete
333
548
  list.done(resolve);
334
549
  }
335
550
  });
336
551
  };
337
552
  // Shows the modal
338
- ListSecurity.prototype.show = function (createFl) {
553
+ ListSecurity.prototype.show = function (createFl, onComplete) {
339
554
  var _this = this;
340
555
  if (createFl === void 0) { createFl = true; }
341
556
  // Show a loading dialog
@@ -353,11 +568,23 @@ var ListSecurity = /** @class */ (function () {
353
568
  // Hide the loading dialog
354
569
  loadingDialog_1.LoadingDialog.hide();
355
570
  // Show the modal
356
- _this.renderModal();
571
+ _this.renderModal(function () {
572
+ // Hide the loading dialog
573
+ loadingDialog_1.LoadingDialog.hide();
574
+ // Call the event
575
+ onComplete ? onComplete() : null;
576
+ });
357
577
  // Stop the loop
358
578
  clearInterval(loopId);
359
579
  }
360
580
  }, 10);
581
+ }, function () {
582
+ // Hide the loading dialog
583
+ loadingDialog_1.LoadingDialog.hide();
584
+ // Show an error
585
+ modal_1.Modal.setHeader("Security Groups");
586
+ modal_1.Modal.setBody("Error loading/creating the security groups. Please contact your admin.");
587
+ modal_1.Modal.show();
361
588
  });
362
589
  };
363
590
  return ListSecurity;
package/build/lib.d.ts CHANGED
@@ -19,6 +19,11 @@ export declare const DattaTable: {
19
19
  InstallationRequired: typeof Common.InstallationRequired;
20
20
  ItemForm: typeof Common.ItemForm;
21
21
  List: typeof Common.List;
22
+ ListSecurityDefaultGroups: {
23
+ Members: string;
24
+ Owners: string;
25
+ Visitors: string;
26
+ };
22
27
  ListSecurity: typeof Common.ListSecurity;
23
28
  LoadingDialog: typeof Common.LoadingDialog;
24
29
  formatBytes: (bytes: number, decimals?: number) => string;