@trudb/tru-common-lib 0.0.452 → 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.
@@ -1128,10 +1128,52 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
1128
1128
  }]
1129
1129
  }], ctorParameters: function () { return []; } });
1130
1130
 
1131
+ class TruWindowEventHandler {
1132
+ constructor() {
1133
+ this.open$ = new Subject();
1134
+ this.addView$ = new Subject();
1135
+ this.setWindowTitle$ = new Subject();
1136
+ this.removeForwadViews$ = new Subject();
1137
+ }
1138
+ onOpen() {
1139
+ return this.open$;
1140
+ }
1141
+ open(windowEvent) {
1142
+ this.open$.next(windowEvent);
1143
+ }
1144
+ onAddView() {
1145
+ return this.addView$;
1146
+ }
1147
+ addView(windowAddViewEvent) {
1148
+ this.addView$.next(windowAddViewEvent);
1149
+ }
1150
+ onRemoveForwardViews() {
1151
+ return this.removeForwadViews$;
1152
+ }
1153
+ removeForwardViews() {
1154
+ this.removeForwadViews$.next(null);
1155
+ }
1156
+ onSetWindowTitle() {
1157
+ return this.setWindowTitle$;
1158
+ }
1159
+ setWindowTitle(value) {
1160
+ this.setWindowTitle$.next(value);
1161
+ }
1162
+ }
1163
+ TruWindowEventHandler.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruWindowEventHandler, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1164
+ TruWindowEventHandler.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruWindowEventHandler, providedIn: 'root' });
1165
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruWindowEventHandler, decorators: [{
1166
+ type: Injectable,
1167
+ args: [{
1168
+ providedIn: 'root'
1169
+ }]
1170
+ }] });
1171
+
1131
1172
  class TruDetailViewBase {
1132
- constructor(dataContext, textManager) {
1173
+ constructor(dataContext, textManager, windowEventHandler) {
1133
1174
  this.dataContext = dataContext;
1134
1175
  this.textManager = textManager;
1176
+ this.windowEventHandler = windowEventHandler;
1135
1177
  this.entities = [];
1136
1178
  this.recordLocation = null;
1137
1179
  this.disableNavigationToPreviousEntity = false;
@@ -1185,16 +1227,16 @@ class TruDetailViewBase {
1185
1227
  }
1186
1228
  recordIndex = (this.navigationIndex + 1).toString();
1187
1229
  }
1188
- this.view.window.title = this.textManager.formatWindowTitle(title);
1230
+ this.windowEventHandler.setWindowTitle(this.textManager.formatWindowTitle(title));
1189
1231
  this.recordLocation = recordIndex + ' of ' + this.entities.length;
1190
1232
  }
1191
1233
  }
1192
- 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 });
1234
+ 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 });
1193
1235
  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: [""] });
1194
1236
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruDetailViewBase, decorators: [{
1195
1237
  type: Component,
1196
1238
  args: [{ selector: 'tru-detail-view-base', template: "" }]
1197
- }], ctorParameters: function () { return [{ type: TruDataContext }, { type: TruTextManager }]; }, propDecorators: { view: [{
1239
+ }], ctorParameters: function () { return [{ type: TruDataContext }, { type: TruTextManager }, { type: TruWindowEventHandler }]; }, propDecorators: { view: [{
1198
1240
  type: Input
1199
1241
  }] } });
1200
1242
 
@@ -1283,40 +1325,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
1283
1325
  }]
1284
1326
  }], ctorParameters: function () { return []; } });
1285
1327
 
1286
- class TruWindowEventHandler {
1287
- constructor() {
1288
- this.open$ = new Subject();
1289
- this.addView$ = new Subject();
1290
- this.removeForwadViews$ = new Subject();
1291
- }
1292
- onOpen() {
1293
- return this.open$;
1294
- }
1295
- open(windowEvent) {
1296
- this.open$.next(windowEvent);
1297
- }
1298
- onAddView() {
1299
- return this.addView$;
1300
- }
1301
- addView(windowAddViewEvent) {
1302
- this.addView$.next(windowAddViewEvent);
1303
- }
1304
- onRemoveForwardViews() {
1305
- return this.removeForwadViews$;
1306
- }
1307
- removeForwardViews() {
1308
- this.removeForwadViews$.next(null);
1309
- }
1310
- }
1311
- TruWindowEventHandler.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruWindowEventHandler, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1312
- TruWindowEventHandler.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruWindowEventHandler, providedIn: 'root' });
1313
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruWindowEventHandler, decorators: [{
1314
- type: Injectable,
1315
- args: [{
1316
- providedIn: 'root'
1317
- }]
1318
- }] });
1319
-
1320
1328
  class TruDesktopManager {
1321
1329
  constructor(contextFilters, windowEventHandler) {
1322
1330
  this.contextFilters = contextFilters;
@@ -1397,9 +1405,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
1397
1405
  }], ctorParameters: function () { return [{ type: TruContextFilters }, { type: TruWindowEventHandler }]; } });
1398
1406
 
1399
1407
  class TruSearchViewBase {
1400
- constructor(desktopManager, truWindowEventHandler) {
1408
+ constructor(desktopManager, windowEventHandler) {
1401
1409
  this.desktopManager = desktopManager;
1402
- this.truWindowEventHandler = truWindowEventHandler;
1410
+ this.windowEventHandler = windowEventHandler;
1403
1411
  this.tableName = '';
1404
1412
  this.tablePluralName = '';
1405
1413
  this.tablePluralLabel = '';
@@ -1420,11 +1428,11 @@ class TruSearchViewBase {
1420
1428
  };
1421
1429
  this.onPkeyCellDoubleClicked = (gridConfig) => {
1422
1430
  if (this.hasDetailView) {
1423
- var truWindowAddViewEventArgs = new TruDesktopViewConfig();
1424
- truWindowAddViewEventArgs.entities = gridConfig.api.getRenderedNodes().map((rowNode) => rowNode.data.$entity);
1425
- truWindowAddViewEventArgs.entityIndex = gridConfig.rowIndex;
1426
- truWindowAddViewEventArgs.componentName = this.tableName + 'DetailView';
1427
- this.truWindowEventHandler.addView(truWindowAddViewEventArgs);
1431
+ var windowAddViewEventArgs = new TruDesktopViewConfig();
1432
+ windowAddViewEventArgs.entities = gridConfig.api.getRenderedNodes().map((rowNode) => rowNode.data.$entity);
1433
+ windowAddViewEventArgs.entityIndex = gridConfig.rowIndex;
1434
+ windowAddViewEventArgs.componentName = this.tableName + 'DetailView';
1435
+ this.windowEventHandler.addView(windowAddViewEventArgs);
1428
1436
  this.view.active(false);
1429
1437
  }
1430
1438
  else {
@@ -1435,7 +1443,7 @@ class TruSearchViewBase {
1435
1443
  setWindowTitle() {
1436
1444
  if (!this.windowTitle)
1437
1445
  this.windowTitle = this.desktopManager.getUniqueTitle(this.tablePluralLabel);
1438
- this.view.window.title = this.windowTitle.text;
1446
+ this.windowEventHandler.setWindowTitle(this.windowTitle.text);
1439
1447
  }
1440
1448
  releaseWindowTitle() {
1441
1449
  this.windowTitle?.release();
@@ -3201,6 +3209,7 @@ class TruDesktopWindow {
3201
3209
  this.canCloseFn = undefined;
3202
3210
  this.cancelEditingOnNavigation = false;
3203
3211
  this.viewportDimensions = undefined;
3212
+ this.subs = [];
3204
3213
  this.hasChanges = () => {
3205
3214
  return this.dataContext.hasChanges().length;
3206
3215
  };
@@ -3591,9 +3600,12 @@ class TruDesktopWindow {
3591
3600
  this.canNavigateFn = this.desktopCtrl.getOptions().canNavigateFn;
3592
3601
  this.cancelEditingOnNavigation = this.desktopCtrl.getOptions().cancelEditingOnNavigation;
3593
3602
  this.updateNavigationState();
3594
- this.truWindowEventHandler.onAddView().subscribe((windiowAddViewEvent) => {
3603
+ this.subs.push(this.truWindowEventHandler.onAddView().subscribe((windiowAddViewEvent) => {
3595
3604
  this.addView(windiowAddViewEvent);
3596
- });
3605
+ }));
3606
+ this.subs.push(this.truWindowEventHandler.onSetWindowTitle().subscribe((windowTitle) => {
3607
+ this.setWindowTitle(windowTitle);
3608
+ }));
3597
3609
  }
3598
3610
  ngAfterViewInit() {
3599
3611
  this.cd.detectChanges();
@@ -3602,6 +3614,7 @@ class TruDesktopWindow {
3602
3614
  document.removeEventListener('mousemove', this.mouseMove);
3603
3615
  document.removeEventListener('mouseup', this.mouseUp);
3604
3616
  window.removeEventListener('resize', this.resizeEventHandler);
3617
+ this.subs.forEach(s => s.unsubscribe());
3605
3618
  }
3606
3619
  }
3607
3620
  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 });