dattatable 2.11.2 → 2.11.4

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 (71) hide show
  1. package/build/common/itemForm.d.ts +1 -1
  2. package/build/common/itemForm.js +126 -113
  3. package/build/common/list.d.ts +1 -0
  4. package/build/common/list.js +5 -0
  5. package/build/common/listCfg.js +2 -2
  6. package/dist/dattatable.js +3 -3
  7. package/dist/dattatable.min.js +1 -1
  8. package/docs/assets/search.js +1 -1
  9. package/docs/classes/Accordion.html +2 -2
  10. package/docs/classes/AuditLog.html +2 -2
  11. package/docs/classes/CanvasForm.html +2 -2
  12. package/docs/classes/Comments.html +2 -2
  13. package/docs/classes/Dashboard.html +4 -4
  14. package/docs/classes/DataTable.html +3 -3
  15. package/docs/classes/Documents.html +6 -6
  16. package/docs/classes/FilterSlideout.html +2 -2
  17. package/docs/classes/Footer.html +2 -2
  18. package/docs/classes/Header.html +2 -2
  19. package/docs/classes/InstallationRequired.html +2 -2
  20. package/docs/classes/ItemForm.html +4 -4
  21. package/docs/classes/List.html +5 -4
  22. package/docs/classes/ListConfig.html +2 -2
  23. package/docs/classes/ListSecurity.html +2 -2
  24. package/docs/classes/LoadingDialog.html +2 -2
  25. package/docs/classes/Modal.html +2 -2
  26. package/docs/classes/Navigation.html +3 -3
  27. package/docs/classes/Tiles.html +2 -2
  28. package/docs/classes/Timeout.html +2 -2
  29. package/docs/enums/ActionButtonTypes.html +2 -2
  30. package/docs/functions/formatBytes.html +1 -1
  31. package/docs/functions/formatDateValue.html +1 -1
  32. package/docs/functions/formatTimeValue.html +1 -1
  33. package/docs/functions/getContextInfo.html +1 -1
  34. package/docs/functions/getFileExt.html +1 -1
  35. package/docs/functions/waitForTheme.html +1 -1
  36. package/docs/interfaces/IAccordion.html +2 -2
  37. package/docs/interfaces/IAccordionProps.html +2 -2
  38. package/docs/interfaces/IAuditLogItem.html +2 -2
  39. package/docs/interfaces/IAuditLogItemCreation.html +2 -2
  40. package/docs/interfaces/IAuditLogProps.html +2 -2
  41. package/docs/interfaces/IAuditLogViewProps.html +2 -2
  42. package/docs/interfaces/ICommentsItem.html +2 -2
  43. package/docs/interfaces/ICreateLookupData.html +2 -2
  44. package/docs/interfaces/IDashboardProps.html +2 -2
  45. package/docs/interfaces/IDataTable.html +2 -2
  46. package/docs/interfaces/IDataTableProps.html +2 -2
  47. package/docs/interfaces/IDocumentsProps.html +2 -2
  48. package/docs/interfaces/IFilterItem.html +2 -2
  49. package/docs/interfaces/IFilterProps.html +2 -2
  50. package/docs/interfaces/IFooterProps.html +2 -2
  51. package/docs/interfaces/IGenerateLookupDataProps.html +2 -2
  52. package/docs/interfaces/IHeaderProps.html +2 -2
  53. package/docs/interfaces/IInstallProps.html +2 -2
  54. package/docs/interfaces/IItemFormCreateProps.html +2 -2
  55. package/docs/interfaces/IItemFormEditProps.html +2 -2
  56. package/docs/interfaces/IItemFormTab.html +2 -2
  57. package/docs/interfaces/IItemFormTabInfo.html +2 -2
  58. package/docs/interfaces/IItemFormViewProps.html +2 -2
  59. package/docs/interfaces/IListConfig.html +2 -2
  60. package/docs/interfaces/IListConfigProps.html +2 -2
  61. package/docs/interfaces/IListProps.html +2 -2
  62. package/docs/interfaces/IListSecurity.html +2 -2
  63. package/docs/interfaces/IListSecurityItem.html +2 -2
  64. package/docs/interfaces/ILookupData.html +2 -2
  65. package/docs/interfaces/IShowDialogProps.html +2 -2
  66. package/docs/interfaces/ITiles.html +2 -2
  67. package/docs/interfaces/ITilesProps.html +2 -2
  68. package/docs/interfaces/IValidateLookupsProps.html +2 -2
  69. package/docs/variables/DattaTable.html +1 -1
  70. package/docs/variables/ListSecurityDefaultGroups.html +1 -1
  71. package/package.json +1 -1
@@ -135,6 +135,6 @@ export declare class ItemForm {
135
135
  static save(props?: {
136
136
  form?: Components.IListFormEdit;
137
137
  bypassValidation?: boolean;
138
- }): void;
138
+ }): PromiseLike<void>;
139
139
  private static validate;
140
140
  }
@@ -473,136 +473,149 @@ var ItemForm = /** @class */ (function () {
473
473
  ItemForm.save = function (props) {
474
474
  var _this = this;
475
475
  if (props === void 0) { props = {}; }
476
- var values = {};
477
- // Default the form
478
- var forms = props.form ? [props.form] : this._editForms;
479
- var defaultForm = forms[0];
480
- // Display a loading dialog
481
- _1.LoadingDialog.setHeader("Validation");
482
- _1.LoadingDialog.setBody("Validating the form...");
483
- _1.LoadingDialog.show();
484
- // Validate the forms
485
- var isValid = true;
486
- var counter = 0;
487
- gd_sprest_bs_1.Helper.Executor(forms, function (form) {
488
- // Update the values
489
- values = __assign(__assign({}, values), form.getValues());
490
- // See if this form has attachments
491
- if (form.hasAttachments()) {
492
- // Set the default form
493
- defaultForm = form;
494
- }
495
- // See if we are bypassing validation
496
- if (props.bypassValidation == null || props.bypassValidation != true) {
497
- // Validate the form
498
- var tabIsValid = form.isValid();
499
- // See if we are using tabs and an event exists
500
- var tabInfo = _this._tabInfo && _this._tabInfo.tabs[counter];
501
- if (tabInfo && tabInfo.onValidation) {
502
- // Call the event
503
- tabIsValid = tabInfo.onValidation(values);
504
- }
505
- // See if the form is not valid
506
- if (!tabIsValid) {
507
- // Set the flag
508
- isValid = false;
476
+ // Return a promise
477
+ return new Promise(function (resolve, reject) {
478
+ var values = {};
479
+ // Default the form
480
+ var forms = props.form ? [props.form] : _this._editForms;
481
+ var defaultForm = forms[0];
482
+ // Display a loading dialog
483
+ _1.LoadingDialog.setHeader("Validation");
484
+ _1.LoadingDialog.setBody("Validating the form...");
485
+ _1.LoadingDialog.show();
486
+ // Validate the forms
487
+ var isValid = true;
488
+ var counter = 0;
489
+ gd_sprest_bs_1.Helper.Executor(forms, function (form) {
490
+ // Update the values
491
+ values = __assign(__assign({}, values), form.getValues());
492
+ // See if this form has attachments
493
+ if (form.hasAttachments()) {
494
+ // Set the default form
495
+ defaultForm = form;
509
496
  }
510
- // See if tabs exist
511
- if (_this.Tabs) {
512
- // Get the tab
513
- var tab = _this.Tabs.el.querySelectorAll(".list-group-item")[counter++];
514
- if (tab) {
515
- // Clear the class name
516
- tab.classList.remove("is-valid");
517
- tab.classList.remove("is-invalid");
518
- // Set the class name
519
- tab.classList.add(tabIsValid ? "is-valid" : "is-invalid");
497
+ // See if we are bypassing validation
498
+ if (props.bypassValidation == null || props.bypassValidation != true) {
499
+ // Validate the form
500
+ var tabIsValid = form.isValid();
501
+ // See if we are using tabs and an event exists
502
+ var tabInfo = _this._tabInfo && _this._tabInfo.tabs[counter];
503
+ if (tabInfo && tabInfo.onValidation) {
504
+ // Call the event
505
+ tabIsValid = tabInfo.onValidation(values);
506
+ }
507
+ // See if the form is not valid
508
+ if (!tabIsValid) {
509
+ // Set the flag
510
+ isValid = false;
511
+ }
512
+ // See if tabs exist
513
+ if (_this.Tabs) {
514
+ // Get the tab
515
+ var tab = _this.Tabs.el.querySelectorAll(".list-group-item")[counter++];
516
+ if (tab) {
517
+ // Clear the class name
518
+ tab.classList.remove("is-valid");
519
+ tab.classList.remove("is-invalid");
520
+ // Set the class name
521
+ tab.classList.add(tabIsValid ? "is-valid" : "is-invalid");
522
+ }
520
523
  }
521
524
  }
522
- }
523
- }).then(
524
- // Success
525
- function () {
526
- // Call the custom validation event
527
- _this.validate(values, isValid).then(
528
- // Valid
529
- function (isValid) {
530
- // See if the form(s) are valid
531
- if (isValid || props.bypassValidation == true) {
532
- // Update the loading dialog
533
- _1.LoadingDialog.setHeader("Saving the Item");
534
- _1.LoadingDialog.setBody((_this.IsNew ? "Creating" : "Updating") + " the Item");
535
- // Saves the item
536
- var saveItem_1 = function (values, retryFl) {
537
- // If values is null then do nothing. This would happen when the
538
- // onSave event wants to cancel the save and do something custom
539
- if (values) {
540
- // Save the item
541
- defaultForm.save(values).then(function (item) {
542
- // Call the update event
543
- _this._updateEvent ? _this._updateEvent(item) : null;
544
- // Close the dialogs
545
- (_this._useModal ? _1.Modal : _1.CanvasForm).hide();
546
- _1.LoadingDialog.hide();
547
- }, function (err) {
548
- // See if we have already retried to save the item
549
- if (retryFl) {
550
- // Log
551
- console.error("[List Form] Unable to get the context for web.");
552
- // Call the event
553
- _this._onSaveError ? _this._onSaveError(err) : null;
554
- }
555
- else {
556
- // Try to get the error message
557
- try {
558
- var errorMessage = JSON.parse(err.response).error.message.value;
559
- // See if the page timed out
560
- if (errorMessage.indexOf("The security validation for this page is invalid") == 0) {
561
- // Set the loading dialog
562
- _1.LoadingDialog.setBody("The page timed out, retrying the request...");
563
- // Refresh the request digest
564
- defaultForm.refreshRequestDigest().then(function () {
565
- // Try to save the item again
566
- saveItem_1(values, true);
567
- });
525
+ }).then(
526
+ // Success
527
+ function () {
528
+ // Call the custom validation event
529
+ _this.validate(values, isValid).then(
530
+ // Valid
531
+ function (isValid) {
532
+ // See if the form(s) are valid
533
+ if (isValid || props.bypassValidation == true) {
534
+ // Update the loading dialog
535
+ _1.LoadingDialog.setHeader("Saving the Item");
536
+ _1.LoadingDialog.setBody((_this.IsNew ? "Creating" : "Updating") + " the Item");
537
+ // Saves the item
538
+ var saveItem_1 = function (values, retryFl) {
539
+ // If values is null then do nothing. This would happen when the
540
+ // onSave event wants to cancel the save and do something custom
541
+ if (values) {
542
+ // Save the item
543
+ defaultForm.save(values).then(function (item) {
544
+ // Call the update event
545
+ _this._updateEvent ? _this._updateEvent(item) : null;
546
+ // Close the dialogs
547
+ (_this._useModal ? _1.Modal : _1.CanvasForm).hide();
548
+ _1.LoadingDialog.hide();
549
+ // Resolve the request
550
+ resolve();
551
+ }, function (err) {
552
+ // See if we have already retried to save the item
553
+ if (retryFl) {
554
+ // Log
555
+ console.error("[List Form] Unable to get the context for web.");
556
+ // Call the event
557
+ _this._onSaveError ? _this._onSaveError(err) : null;
558
+ // Reject the request
559
+ reject();
560
+ }
561
+ else {
562
+ // Try to get the error message
563
+ try {
564
+ var errorMessage = JSON.parse(err.response).error.message.value;
565
+ // See if the page timed out
566
+ if (errorMessage.indexOf("The security validation for this page is invalid") == 0) {
567
+ // Set the loading dialog
568
+ _1.LoadingDialog.setBody("The page timed out, retrying the request...");
569
+ // Refresh the request digest
570
+ defaultForm.refreshRequestDigest().then(function () {
571
+ // Try to save the item again
572
+ saveItem_1(values, true);
573
+ });
574
+ }
575
+ else {
576
+ // Call the event
577
+ _this._onSaveError ? _this._onSaveError(err) : null;
578
+ // Reject the request
579
+ reject();
580
+ }
568
581
  }
569
- else {
582
+ catch (_a) {
570
583
  // Call the event
571
584
  _this._onSaveError ? _this._onSaveError(err) : null;
585
+ // Reject the request
586
+ reject();
572
587
  }
573
588
  }
574
- catch (_a) {
575
- // Call the event
576
- _this._onSaveError ? _this._onSaveError(err) : null;
577
- }
578
- }
589
+ });
590
+ }
591
+ };
592
+ // Call the save event and ensure values exist
593
+ values = _this._onSave ? _this._onSave(values) : values;
594
+ // See if the onSave event returned a promise
595
+ if (values && typeof (values["then"]) === "function") {
596
+ // Wait for the promise to complete
597
+ values["then"](function (values) {
598
+ // Save the item
599
+ saveItem_1(values);
579
600
  });
580
601
  }
581
- };
582
- // Call the save event and ensure values exist
583
- values = _this._onSave ? _this._onSave(values) : values;
584
- // See if the onSave event returned a promise
585
- if (values && typeof (values["then"]) === "function") {
586
- // Wait for the promise to complete
587
- values["then"](function (values) {
602
+ else {
588
603
  // Save the item
589
604
  saveItem_1(values);
590
- });
605
+ }
591
606
  }
592
607
  else {
593
- // Save the item
594
- saveItem_1(values);
608
+ // Close the dialog
609
+ _1.LoadingDialog.hide();
595
610
  }
596
- }
597
- else {
611
+ },
612
+ // Not Valid
613
+ function () {
598
614
  // Close the dialog
599
615
  _1.LoadingDialog.hide();
600
- }
601
- },
602
- // Not Valid
603
- function () {
604
- // Close the dialog
605
- _1.LoadingDialog.hide();
616
+ // Reject the request
617
+ reject();
618
+ });
606
619
  });
607
620
  });
608
621
  };
@@ -79,6 +79,7 @@ export declare class List<T = Types.SP.ListItem> {
79
79
  refresh(query?: Types.IODataQuery): PromiseLike<T[]>;
80
80
  private refreshContextInfo;
81
81
  refreshItem(itemId: number, query?: Types.IODataQuery): PromiseLike<T>;
82
+ save(bypassValidation?: boolean): PromiseLike<void>;
82
83
  updateItem(itemId: number, values: any): PromiseLike<void>;
83
84
  viewForm(props: IItemFormViewProps): void;
84
85
  }
@@ -597,6 +597,11 @@ var List = /** @class */ (function () {
597
597
  // Load the item
598
598
  return this.loadItem(itemId, query);
599
599
  };
600
+ // Saves the item with an option to bypass validation
601
+ List.prototype.save = function (bypassValidation) {
602
+ // Save the item
603
+ return _1.ItemForm.save({ bypassValidation: bypassValidation });
604
+ };
600
605
  // Updates an item
601
606
  List.prototype.updateItem = function (itemId, values) {
602
607
  var _this = this;
@@ -504,11 +504,11 @@ var ListConfig = /** @class */ (function () {
504
504
  lookupLists[listId] = true;
505
505
  // Check the next list
506
506
  resolve(null);
507
- });
507
+ }, true); // Set the flag to run this after the previous request completes
508
508
  }, function () {
509
509
  // Check the next list
510
510
  resolve(null);
511
- }, true); // Set the flag to run this after the previous request completes
511
+ });
512
512
  });
513
513
  }).then(function () {
514
514
  // Resolve the request