@trudb/tru-common-lib 0.0.627 → 0.0.629
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/esm2020/lib/classes/tru-name-value.mjs +3 -0
- package/esm2020/lib/components/confirm-dialog/tru-confirm-dialog.mjs +2 -2
- package/esm2020/lib/services/tru-data-context.mjs +21 -1
- package/esm2020/lib/services/tru-entity-accessor.mjs +16 -1
- package/fesm2015/trudb-tru-common-lib.mjs +38 -2
- package/fesm2015/trudb-tru-common-lib.mjs.map +1 -1
- package/fesm2020/trudb-tru-common-lib.mjs +37 -2
- package/fesm2020/trudb-tru-common-lib.mjs.map +1 -1
- package/lib/classes/tru-name-value.d.ts +8 -0
- package/lib/services/tru-data-context.d.ts +1 -0
- package/lib/services/tru-entity-accessor.d.ts +5 -2
- package/package.json +1 -1
|
@@ -453,10 +453,10 @@ class TruConfirmDialog {
|
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
455
|
TruConfirmDialog.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruConfirmDialog, deps: [{ token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
|
|
456
|
-
TruConfirmDialog.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.1", type: TruConfirmDialog, selector: "tru-confirm-dialog", ngImport: i0, template: "<div mat-dialog-title class=\"mat-dialog-title\">\r\n {{title}}\r\n</div>\r\n\r\n<div mat-dialog-content class=\"mat-dialog-content\">\r\n <p>{{message}}</p>\r\n</div>\r\n\r\n<div mat-dialog-actions class=\"mat-dialog-actions\">\r\n <button *ngIf=\"displayDismissButton\" mat-raised-button (click)=\"onDismiss()\">{{dismissButtonName}}</button>\r\n <button *ngIf=\"displayConfirmButton\" mat-raised-button color=\"primary\" (click)=\"onConfirm()\">{{confirmButtonName}}</button>\r\n</div>\r\n", styles: ["::ng-deep .mat-mdc-dialog-surface{padding:20px}.mat-mdc-dialog-title:before{content:unset!important;height:unset!important;padding:
|
|
456
|
+
TruConfirmDialog.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.1", type: TruConfirmDialog, selector: "tru-confirm-dialog", ngImport: i0, template: "<div mat-dialog-title class=\"mat-dialog-title\">\r\n {{title}}\r\n</div>\r\n\r\n<div mat-dialog-content class=\"mat-dialog-content\">\r\n <p>{{message}}</p>\r\n</div>\r\n\r\n<div mat-dialog-actions class=\"mat-dialog-actions\">\r\n <button *ngIf=\"displayDismissButton\" mat-raised-button (click)=\"onDismiss()\">{{dismissButtonName}}</button>\r\n <button *ngIf=\"displayConfirmButton\" mat-raised-button color=\"primary\" (click)=\"onConfirm()\">{{confirmButtonName}}</button>\r\n</div>\r\n", styles: ["::ng-deep .mat-mdc-dialog-surface{padding:20px}.mat-mdc-dialog-title:before{content:unset!important;height:unset!important;padding:0 0 10px!important}.mdc-dialog__title{padding:20px 0 10px!important}.mdc-dialog__content{padding:10px 0 15px!important}.mat-mdc-dialog-content p{margin-bottom:0;font-size:14px;color:#545454}.mat-mdc-dialog-actions{padding:0!important}.mat-mdc-dialog-actions button{margin-right:10px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }] });
|
|
457
457
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruConfirmDialog, decorators: [{
|
|
458
458
|
type: Component,
|
|
459
|
-
args: [{ selector: 'tru-confirm-dialog', template: "<div mat-dialog-title class=\"mat-dialog-title\">\r\n {{title}}\r\n</div>\r\n\r\n<div mat-dialog-content class=\"mat-dialog-content\">\r\n <p>{{message}}</p>\r\n</div>\r\n\r\n<div mat-dialog-actions class=\"mat-dialog-actions\">\r\n <button *ngIf=\"displayDismissButton\" mat-raised-button (click)=\"onDismiss()\">{{dismissButtonName}}</button>\r\n <button *ngIf=\"displayConfirmButton\" mat-raised-button color=\"primary\" (click)=\"onConfirm()\">{{confirmButtonName}}</button>\r\n</div>\r\n", styles: ["::ng-deep .mat-mdc-dialog-surface{padding:20px}.mat-mdc-dialog-title:before{content:unset!important;height:unset!important;padding:
|
|
459
|
+
args: [{ selector: 'tru-confirm-dialog', template: "<div mat-dialog-title class=\"mat-dialog-title\">\r\n {{title}}\r\n</div>\r\n\r\n<div mat-dialog-content class=\"mat-dialog-content\">\r\n <p>{{message}}</p>\r\n</div>\r\n\r\n<div mat-dialog-actions class=\"mat-dialog-actions\">\r\n <button *ngIf=\"displayDismissButton\" mat-raised-button (click)=\"onDismiss()\">{{dismissButtonName}}</button>\r\n <button *ngIf=\"displayConfirmButton\" mat-raised-button color=\"primary\" (click)=\"onConfirm()\">{{confirmButtonName}}</button>\r\n</div>\r\n", styles: ["::ng-deep .mat-mdc-dialog-surface{padding:20px}.mat-mdc-dialog-title:before{content:unset!important;height:unset!important;padding:0 0 10px!important}.mdc-dialog__title{padding:20px 0 10px!important}.mdc-dialog__content{padding:10px 0 15px!important}.mat-mdc-dialog-content p{margin-bottom:0;font-size:14px;color:#545454}.mat-mdc-dialog-actions{padding:0!important}.mat-mdc-dialog-actions button{margin-right:10px}\n"] }]
|
|
460
460
|
}], ctorParameters: function () { return [{ type: i1.MatDialogRef }, { type: TruConfirmDialog, decorators: [{
|
|
461
461
|
type: Inject,
|
|
462
462
|
args: [MAT_DIALOG_DATA]
|
|
@@ -626,6 +626,12 @@ class TruEntityAccessor {
|
|
|
626
626
|
else
|
|
627
627
|
return _.map(entities, (entity) => { return { value: { $: entity[pKeyName] }, label: hid !== null ? hid : entity.HID }; });
|
|
628
628
|
};
|
|
629
|
+
this.formatNameValues = (query, entities, pKeyName) => {
|
|
630
|
+
if (query && query.orderByClause)
|
|
631
|
+
return _.map(entities, (entity) => { return { name: entity.Name, value: { $: entity.Value } }; });
|
|
632
|
+
else
|
|
633
|
+
return _.map(entities, (entity) => { return { name: entity.Name, value: { $: entity.Value } }; });
|
|
634
|
+
};
|
|
629
635
|
this.add = (entity, contextFilters = null) => {
|
|
630
636
|
let newEntity = this._entityManager.createEntity(entity.prototype.entityType);
|
|
631
637
|
return newEntity;
|
|
@@ -678,6 +684,15 @@ class TruEntityAccessor {
|
|
|
678
684
|
}
|
|
679
685
|
return of(this.formatQueryChoices(query, this._entityManager.executeQueryLocally(query), pkeyName, null));
|
|
680
686
|
};
|
|
687
|
+
this.searchNameValuesCacheOnly = (entity, setupQuery = null, ref = undefined) => {
|
|
688
|
+
const pkeyName = entity.name + 'Ref';
|
|
689
|
+
let query = this._breezeContext.createQuery(this.getQueryServiceName(entity));
|
|
690
|
+
if (setupQuery)
|
|
691
|
+
query = setupQuery(query) ?? query;
|
|
692
|
+
if (ref)
|
|
693
|
+
query = query.where(entity.name + 'Ref', '==', ref);
|
|
694
|
+
return of(this.formatNameValues(query, this._entityManager.executeQueryLocally(query), pkeyName));
|
|
695
|
+
};
|
|
681
696
|
this.searchByRef = (entity, ref) => {
|
|
682
697
|
const pkeyName = entity.name + 'Ref';
|
|
683
698
|
var queryOptions = this._entityManager.queryOptions.using({
|
|
@@ -991,6 +1006,26 @@ class TruDataContext {
|
|
|
991
1006
|
});
|
|
992
1007
|
});
|
|
993
1008
|
};
|
|
1009
|
+
this.saveWithoutNotification = () => {
|
|
1010
|
+
return new Promise((resolve, reject) => {
|
|
1011
|
+
if (this.appEnvironment.isSaving) {
|
|
1012
|
+
this.uiNotification.error(this.appEnvironment.msgSaveInProgress);
|
|
1013
|
+
resolve();
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
this.appEnvironment.isSaving = true;
|
|
1017
|
+
this.entityManager.saveChanges().then(() => {
|
|
1018
|
+
this.appEnvironment.saveComplete({ successful: true });
|
|
1019
|
+
resolve();
|
|
1020
|
+
}).catch((e) => {
|
|
1021
|
+
this.appEnvironment.saveComplete({ successful: false });
|
|
1022
|
+
reject(e);
|
|
1023
|
+
}).finally(() => {
|
|
1024
|
+
this.appEnvironment.isSaving = false;
|
|
1025
|
+
this.propertyChanged(null);
|
|
1026
|
+
});
|
|
1027
|
+
});
|
|
1028
|
+
};
|
|
994
1029
|
this.revert = () => {
|
|
995
1030
|
this.uiNotification.confirm('Confirm Action', 'Revert ' + this.hasChanges().length + ' changed record(s)', true, true, "No", "Yes").then((confirm) => {
|
|
996
1031
|
if (confirm) {
|