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.
- package/build/common/itemForm.d.ts +1 -1
- package/build/common/itemForm.js +126 -113
- package/build/common/list.d.ts +1 -0
- package/build/common/list.js +5 -0
- package/build/common/listCfg.js +2 -2
- package/dist/dattatable.js +3 -3
- package/dist/dattatable.min.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Accordion.html +2 -2
- 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 +2 -2
- package/docs/classes/ItemForm.html +4 -4
- package/docs/classes/List.html +5 -4
- package/docs/classes/ListConfig.html +2 -2
- package/docs/classes/ListSecurity.html +2 -2
- package/docs/classes/LoadingDialog.html +2 -2
- package/docs/classes/Modal.html +2 -2
- package/docs/classes/Navigation.html +3 -3
- package/docs/classes/Tiles.html +2 -2
- 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 -1
- package/docs/functions/getFileExt.html +1 -1
- package/docs/functions/waitForTheme.html +1 -1
- package/docs/interfaces/IAccordion.html +2 -2
- package/docs/interfaces/IAccordionProps.html +2 -2
- 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/ICreateLookupData.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/IGenerateLookupDataProps.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/IListConfig.html +2 -2
- package/docs/interfaces/IListConfigProps.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/ILookupData.html +2 -2
- package/docs/interfaces/IShowDialogProps.html +2 -2
- package/docs/interfaces/ITiles.html +2 -2
- package/docs/interfaces/ITilesProps.html +2 -2
- package/docs/interfaces/IValidateLookupsProps.html +2 -2
- package/docs/variables/DattaTable.html +1 -1
- package/docs/variables/ListSecurityDefaultGroups.html +1 -1
- package/package.json +1 -1
package/build/common/itemForm.js
CHANGED
|
@@ -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
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
//
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
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
|
|
511
|
-
if (
|
|
512
|
-
//
|
|
513
|
-
var
|
|
514
|
-
if
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
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
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
//
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
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
|
-
|
|
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
|
-
|
|
575
|
-
|
|
576
|
-
|
|
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
|
-
//
|
|
594
|
-
|
|
608
|
+
// Close the dialog
|
|
609
|
+
_1.LoadingDialog.hide();
|
|
595
610
|
}
|
|
596
|
-
}
|
|
597
|
-
|
|
611
|
+
},
|
|
612
|
+
// Not Valid
|
|
613
|
+
function () {
|
|
598
614
|
// Close the dialog
|
|
599
615
|
_1.LoadingDialog.hide();
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
function () {
|
|
604
|
-
// Close the dialog
|
|
605
|
-
_1.LoadingDialog.hide();
|
|
616
|
+
// Reject the request
|
|
617
|
+
reject();
|
|
618
|
+
});
|
|
606
619
|
});
|
|
607
620
|
});
|
|
608
621
|
};
|
package/build/common/list.d.ts
CHANGED
|
@@ -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
|
}
|
package/build/common/list.js
CHANGED
|
@@ -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;
|
package/build/common/listCfg.js
CHANGED
|
@@ -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
|
-
}
|
|
511
|
+
});
|
|
512
512
|
});
|
|
513
513
|
}).then(function () {
|
|
514
514
|
// Resolve the request
|