@trudb/tru-common-lib 0.0.451 → 0.0.458
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/base-views/detail/tru-detail-view-base.mjs +28 -27
- package/esm2020/lib/base-views/search/tru-search-view-base.mjs +9 -9
- package/esm2020/lib/components/desktop/services/tru-window-event-handler.mjs +8 -1
- package/esm2020/lib/components/desktop/view/tru-desktop-view.mjs +1 -1
- package/esm2020/lib/components/desktop/window/tru-desktop-window.mjs +8 -3
- package/fesm2015/trudb-tru-common-lib.mjs +82 -70
- package/fesm2015/trudb-tru-common-lib.mjs.map +1 -1
- package/fesm2020/trudb-tru-common-lib.mjs +82 -70
- package/fesm2020/trudb-tru-common-lib.mjs.map +1 -1
- package/lib/base-views/detail/tru-detail-view-base.d.ts +8 -6
- package/lib/base-views/search/tru-search-view-base.d.ts +2 -2
- package/lib/components/desktop/services/tru-window-event-handler.d.ts +3 -0
- package/lib/components/desktop/window/tru-desktop-window.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1133,11 +1133,52 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
|
|
|
1133
1133
|
}]
|
|
1134
1134
|
}], ctorParameters: function () { return []; } });
|
|
1135
1135
|
|
|
1136
|
+
class TruWindowEventHandler {
|
|
1137
|
+
constructor() {
|
|
1138
|
+
this.open$ = new Subject();
|
|
1139
|
+
this.addView$ = new Subject();
|
|
1140
|
+
this.setWindowTitle$ = new Subject();
|
|
1141
|
+
this.removeForwadViews$ = new Subject();
|
|
1142
|
+
}
|
|
1143
|
+
onOpen() {
|
|
1144
|
+
return this.open$;
|
|
1145
|
+
}
|
|
1146
|
+
open(windowEvent) {
|
|
1147
|
+
this.open$.next(windowEvent);
|
|
1148
|
+
}
|
|
1149
|
+
onAddView() {
|
|
1150
|
+
return this.addView$;
|
|
1151
|
+
}
|
|
1152
|
+
addView(windowAddViewEvent) {
|
|
1153
|
+
this.addView$.next(windowAddViewEvent);
|
|
1154
|
+
}
|
|
1155
|
+
onRemoveForwardViews() {
|
|
1156
|
+
return this.removeForwadViews$;
|
|
1157
|
+
}
|
|
1158
|
+
removeForwardViews() {
|
|
1159
|
+
this.removeForwadViews$.next(null);
|
|
1160
|
+
}
|
|
1161
|
+
onSetWindowTitle() {
|
|
1162
|
+
return this.setWindowTitle$;
|
|
1163
|
+
}
|
|
1164
|
+
setWindowTitle(value) {
|
|
1165
|
+
this.setWindowTitle$.next(value);
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
TruWindowEventHandler.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruWindowEventHandler, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1169
|
+
TruWindowEventHandler.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruWindowEventHandler, providedIn: 'root' });
|
|
1170
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruWindowEventHandler, decorators: [{
|
|
1171
|
+
type: Injectable,
|
|
1172
|
+
args: [{
|
|
1173
|
+
providedIn: 'root'
|
|
1174
|
+
}]
|
|
1175
|
+
}] });
|
|
1176
|
+
|
|
1136
1177
|
class TruDetailViewBase {
|
|
1137
|
-
constructor(dataContext, textManager) {
|
|
1178
|
+
constructor(dataContext, textManager, windowEventHandler) {
|
|
1138
1179
|
this.dataContext = dataContext;
|
|
1139
1180
|
this.textManager = textManager;
|
|
1140
|
-
this.
|
|
1181
|
+
this.windowEventHandler = windowEventHandler;
|
|
1141
1182
|
this.entities = [];
|
|
1142
1183
|
this.recordLocation = null;
|
|
1143
1184
|
this.disableNavigationToPreviousEntity = false;
|
|
@@ -1170,37 +1211,37 @@ class TruDetailViewBase {
|
|
|
1170
1211
|
this.setNavigationIndex(index);
|
|
1171
1212
|
this.setEntityDisplayValues(this.tableName);
|
|
1172
1213
|
};
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
else {
|
|
1189
|
-
title += this.entity.HID;
|
|
1190
|
-
}
|
|
1191
|
-
recordIndex = (this.navigationIndex + 1).toString();
|
|
1214
|
+
}
|
|
1215
|
+
setNavigationIndex(index) {
|
|
1216
|
+
this.navigationIndex = index;
|
|
1217
|
+
this.disableNavigationToPreviousEntity = index === 0;
|
|
1218
|
+
this.disableNavigationToNextEntity = index === this.entities.length - 1;
|
|
1219
|
+
this.entity = this.entities[this.navigationIndex];
|
|
1220
|
+
}
|
|
1221
|
+
setEntityDisplayValues(tableName) {
|
|
1222
|
+
let title = '';
|
|
1223
|
+
let recordIndex = '?';
|
|
1224
|
+
let entity = this.entities[this.navigationIndex];
|
|
1225
|
+
if (entity) {
|
|
1226
|
+
title = tableName + ' - ';
|
|
1227
|
+
if (entity.entityAspect.entityState.isAdded()) {
|
|
1228
|
+
title += 'New Record';
|
|
1192
1229
|
}
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1230
|
+
else {
|
|
1231
|
+
title += this.entity.HID;
|
|
1232
|
+
}
|
|
1233
|
+
recordIndex = (this.navigationIndex + 1).toString();
|
|
1234
|
+
}
|
|
1235
|
+
this.windowEventHandler.setWindowTitle(this.textManager.formatWindowTitle(title));
|
|
1236
|
+
this.recordLocation = recordIndex + ' of ' + this.entities.length;
|
|
1196
1237
|
}
|
|
1197
1238
|
}
|
|
1198
|
-
TruDetailViewBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruDetailViewBase, deps: [{ token: TruDataContext }, { token: TruTextManager }], target: i0.ɵɵFactoryTarget.Component });
|
|
1239
|
+
TruDetailViewBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruDetailViewBase, deps: [{ token: TruDataContext }, { token: TruTextManager }, { token: TruWindowEventHandler }], target: i0.ɵɵFactoryTarget.Component });
|
|
1199
1240
|
TruDetailViewBase.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.1", type: TruDetailViewBase, selector: "tru-detail-view-base", inputs: { view: "view" }, ngImport: i0, template: "", styles: [""] });
|
|
1200
1241
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruDetailViewBase, decorators: [{
|
|
1201
1242
|
type: Component,
|
|
1202
1243
|
args: [{ selector: 'tru-detail-view-base', template: "" }]
|
|
1203
|
-
}], ctorParameters: function () { return [{ type: TruDataContext }, { type: TruTextManager }]; }, propDecorators: { view: [{
|
|
1244
|
+
}], ctorParameters: function () { return [{ type: TruDataContext }, { type: TruTextManager }, { type: TruWindowEventHandler }]; }, propDecorators: { view: [{
|
|
1204
1245
|
type: Input
|
|
1205
1246
|
}] } });
|
|
1206
1247
|
|
|
@@ -1290,40 +1331,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
|
|
|
1290
1331
|
}]
|
|
1291
1332
|
}], ctorParameters: function () { return []; } });
|
|
1292
1333
|
|
|
1293
|
-
class TruWindowEventHandler {
|
|
1294
|
-
constructor() {
|
|
1295
|
-
this.open$ = new Subject();
|
|
1296
|
-
this.addView$ = new Subject();
|
|
1297
|
-
this.removeForwadViews$ = new Subject();
|
|
1298
|
-
}
|
|
1299
|
-
onOpen() {
|
|
1300
|
-
return this.open$;
|
|
1301
|
-
}
|
|
1302
|
-
open(windowEvent) {
|
|
1303
|
-
this.open$.next(windowEvent);
|
|
1304
|
-
}
|
|
1305
|
-
onAddView() {
|
|
1306
|
-
return this.addView$;
|
|
1307
|
-
}
|
|
1308
|
-
addView(windowAddViewEvent) {
|
|
1309
|
-
this.addView$.next(windowAddViewEvent);
|
|
1310
|
-
}
|
|
1311
|
-
onRemoveForwardViews() {
|
|
1312
|
-
return this.removeForwadViews$;
|
|
1313
|
-
}
|
|
1314
|
-
removeForwardViews() {
|
|
1315
|
-
this.removeForwadViews$.next(null);
|
|
1316
|
-
}
|
|
1317
|
-
}
|
|
1318
|
-
TruWindowEventHandler.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruWindowEventHandler, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1319
|
-
TruWindowEventHandler.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruWindowEventHandler, providedIn: 'root' });
|
|
1320
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruWindowEventHandler, decorators: [{
|
|
1321
|
-
type: Injectable,
|
|
1322
|
-
args: [{
|
|
1323
|
-
providedIn: 'root'
|
|
1324
|
-
}]
|
|
1325
|
-
}] });
|
|
1326
|
-
|
|
1327
1334
|
class TruDesktopManager {
|
|
1328
1335
|
constructor(contextFilters, windowEventHandler) {
|
|
1329
1336
|
this.contextFilters = contextFilters;
|
|
@@ -1404,9 +1411,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
|
|
|
1404
1411
|
}], ctorParameters: function () { return [{ type: TruContextFilters }, { type: TruWindowEventHandler }]; } });
|
|
1405
1412
|
|
|
1406
1413
|
class TruSearchViewBase {
|
|
1407
|
-
constructor(desktopManager,
|
|
1414
|
+
constructor(desktopManager, windowEventHandler) {
|
|
1408
1415
|
this.desktopManager = desktopManager;
|
|
1409
|
-
this.
|
|
1416
|
+
this.windowEventHandler = windowEventHandler;
|
|
1410
1417
|
this.tableName = '';
|
|
1411
1418
|
this.tablePluralName = '';
|
|
1412
1419
|
this.tablePluralLabel = '';
|
|
@@ -1427,11 +1434,11 @@ class TruSearchViewBase {
|
|
|
1427
1434
|
};
|
|
1428
1435
|
this.onPkeyCellDoubleClicked = (gridConfig) => {
|
|
1429
1436
|
if (this.hasDetailView) {
|
|
1430
|
-
var
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
this.
|
|
1437
|
+
var windowAddViewEventArgs = new TruDesktopViewConfig();
|
|
1438
|
+
windowAddViewEventArgs.entities = gridConfig.api.getRenderedNodes().map((rowNode) => rowNode.data.$entity);
|
|
1439
|
+
windowAddViewEventArgs.entityIndex = gridConfig.rowIndex;
|
|
1440
|
+
windowAddViewEventArgs.componentName = this.tableName + 'DetailView';
|
|
1441
|
+
this.windowEventHandler.addView(windowAddViewEventArgs);
|
|
1435
1442
|
this.view.active(false);
|
|
1436
1443
|
}
|
|
1437
1444
|
else {
|
|
@@ -1442,7 +1449,7 @@ class TruSearchViewBase {
|
|
|
1442
1449
|
setWindowTitle() {
|
|
1443
1450
|
if (!this.windowTitle)
|
|
1444
1451
|
this.windowTitle = this.desktopManager.getUniqueTitle(this.tablePluralLabel);
|
|
1445
|
-
this.
|
|
1452
|
+
this.windowEventHandler.setWindowTitle(this.windowTitle.text);
|
|
1446
1453
|
}
|
|
1447
1454
|
releaseWindowTitle() {
|
|
1448
1455
|
var _a;
|
|
@@ -3210,6 +3217,7 @@ class TruDesktopWindow {
|
|
|
3210
3217
|
this.canCloseFn = undefined;
|
|
3211
3218
|
this.cancelEditingOnNavigation = false;
|
|
3212
3219
|
this.viewportDimensions = undefined;
|
|
3220
|
+
this.subs = [];
|
|
3213
3221
|
this.hasChanges = () => {
|
|
3214
3222
|
return this.dataContext.hasChanges().length;
|
|
3215
3223
|
};
|
|
@@ -3600,9 +3608,12 @@ class TruDesktopWindow {
|
|
|
3600
3608
|
this.canNavigateFn = this.desktopCtrl.getOptions().canNavigateFn;
|
|
3601
3609
|
this.cancelEditingOnNavigation = this.desktopCtrl.getOptions().cancelEditingOnNavigation;
|
|
3602
3610
|
this.updateNavigationState();
|
|
3603
|
-
this.truWindowEventHandler.onAddView().subscribe((windiowAddViewEvent) => {
|
|
3611
|
+
this.subs.push(this.truWindowEventHandler.onAddView().subscribe((windiowAddViewEvent) => {
|
|
3604
3612
|
this.addView(windiowAddViewEvent);
|
|
3605
|
-
});
|
|
3613
|
+
}));
|
|
3614
|
+
this.subs.push(this.truWindowEventHandler.onSetWindowTitle().subscribe((windowTitle) => {
|
|
3615
|
+
this.setWindowTitle(windowTitle);
|
|
3616
|
+
}));
|
|
3606
3617
|
}
|
|
3607
3618
|
ngAfterViewInit() {
|
|
3608
3619
|
this.cd.detectChanges();
|
|
@@ -3611,6 +3622,7 @@ class TruDesktopWindow {
|
|
|
3611
3622
|
document.removeEventListener('mousemove', this.mouseMove);
|
|
3612
3623
|
document.removeEventListener('mouseup', this.mouseUp);
|
|
3613
3624
|
window.removeEventListener('resize', this.resizeEventHandler);
|
|
3625
|
+
this.subs.forEach(s => s.unsubscribe());
|
|
3614
3626
|
}
|
|
3615
3627
|
}
|
|
3616
3628
|
TruDesktopWindow.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruDesktopWindow, deps: [{ token: TruDataContext }, { token: TruWindowEventHandler }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|