@trudb/tru-common-lib 0.0.206 → 0.0.209

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.
@@ -50,15 +50,15 @@ class TruEntityBase {
50
50
 
51
51
  class TruPropertyConfigBase {
52
52
  constructor() {
53
- this.IsNullable = false;
54
- this.CanDisplay = false;
55
- this.CanEdit = false;
56
- this.GlobalCache = false;
57
- this.UniqueConstraint = false;
58
- this.TypeName = undefined;
59
- this.FormatterName = undefined;
60
- this.Choices = undefined;
61
- this.Validation = undefined;
53
+ this.isNullable = false;
54
+ this.canDisplay = false;
55
+ this.canEdit = false;
56
+ this.globalCache = false;
57
+ this.uniqueConstraint = false;
58
+ this.typeName = undefined;
59
+ this.formatterName = undefined;
60
+ this.choices = undefined;
61
+ this.validation = undefined;
62
62
  }
63
63
  }
64
64
 
@@ -183,6 +183,7 @@ class TruWindowEventArgs {
183
183
  this.height = '450px';
184
184
  this.width = '900px';
185
185
  this.views = [{}];
186
+ this.contextFilters = [];
186
187
  }
187
188
  }
188
189
  TruWindowEventArgs.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TruWindowEventArgs, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
@@ -194,6 +195,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImpor
194
195
  }]
195
196
  }] });
196
197
 
198
+ class TruContextFilters {
199
+ constructor() {
200
+ this.filters = [];
201
+ this.selectedContextFilterChoices = [];
202
+ this.valueFor = (tableName) => {
203
+ let choice = this.selectedContextFilterChoices.find(f => f.table === tableName);
204
+ if (!choice)
205
+ throw new Error('ContextFilterChoice not found. Possible invalid configuration.');
206
+ return choice.ref;
207
+ };
208
+ this.label = () => {
209
+ let label = '';
210
+ this.selectedContextFilterChoices.forEach((filter) => {
211
+ label += filter.table + ': ' + filter.label + ' ';
212
+ });
213
+ return label;
214
+ };
215
+ }
216
+ }
217
+ TruContextFilters.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TruContextFilters, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
218
+ TruContextFilters.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TruContextFilters, providedIn: 'root' });
219
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TruContextFilters, decorators: [{
220
+ type: Injectable,
221
+ args: [{
222
+ providedIn: 'root',
223
+ }]
224
+ }], ctorParameters: function () { return []; } });
225
+
197
226
  class TruWindowEventHandler {
198
227
  constructor() {
199
228
  this.open$ = new Subject();
@@ -229,13 +258,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImpor
229
258
  }] });
230
259
 
231
260
  class TruDesktopManager {
232
- constructor(truWindowEventHandler) {
233
- this.truWindowEventHandler = truWindowEventHandler;
261
+ constructor(contextFilters, windowEventHandler) {
262
+ this.contextFilters = contextFilters;
263
+ this.windowEventHandler = windowEventHandler;
234
264
  this.getWindowEvent = (tableName, tablePluralName, tablePluralLabel, componentName, data) => {
235
265
  var windowEvent = new TruWindowEventArgs();
236
266
  windowEvent.tableName = tableName;
237
267
  windowEvent.tablePluralName = tablePluralName;
238
268
  windowEvent.tablePluralLabel = tablePluralLabel;
269
+ windowEvent.contextFilters = this.contextFilters.filters;
239
270
  windowEvent.views = [
240
271
  {
241
272
  active: true,
@@ -258,7 +289,7 @@ class TruDesktopManager {
258
289
  * directive, then shows its window instead of creating a new one.
259
290
  */
260
291
  this.addWindow = (tableName, tablePluralName, tablePluralLabel, componentName, data = null, showNavigation = true, showIfExists) => {
261
- this.truWindowEventHandler.open(this.getWindowEvent(tableName, tablePluralName, tablePluralLabel, componentName, data));
292
+ this.windowEventHandler.open(this.getWindowEvent(tableName, tablePluralName, tablePluralLabel, componentName, data));
262
293
  };
263
294
  this.windowTitlesByBaseText = {};
264
295
  /**
@@ -296,14 +327,14 @@ class TruDesktopManager {
296
327
  };
297
328
  }
298
329
  }
299
- TruDesktopManager.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TruDesktopManager, deps: [{ token: TruWindowEventHandler }], target: i0.ɵɵFactoryTarget.Injectable });
330
+ TruDesktopManager.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TruDesktopManager, deps: [{ token: TruContextFilters }, { token: TruWindowEventHandler }], target: i0.ɵɵFactoryTarget.Injectable });
300
331
  TruDesktopManager.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TruDesktopManager, providedIn: 'root' });
301
332
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TruDesktopManager, decorators: [{
302
333
  type: Injectable,
303
334
  args: [{
304
335
  providedIn: 'root',
305
336
  }]
306
- }], ctorParameters: function () { return [{ type: TruWindowEventHandler }]; } });
337
+ }], ctorParameters: function () { return [{ type: TruContextFilters }, { type: TruWindowEventHandler }]; } });
307
338
 
308
339
  class TruSearchViewBase {
309
340
  constructor(desktopManager, truWindowEventHandler) {
@@ -438,6 +469,7 @@ class TruContextFilter {
438
469
  return o1 && o2 ? o1.label === o2.label : o2 === o2;
439
470
  };
440
471
  this.onChange = (choice) => {
472
+ this.selectedChoice = choice;
441
473
  };
442
474
  }
443
475
  }
@@ -2034,34 +2066,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImpor
2034
2066
  }]
2035
2067
  }] });
2036
2068
 
2037
- class TruContextFilters {
2038
- constructor() {
2039
- this.filters = [];
2040
- this.selectedContextFilterChoices = [];
2041
- this.valueFor = (tableName) => {
2042
- let choice = this.selectedContextFilterChoices.find(f => f.table === tableName);
2043
- if (!choice)
2044
- throw new Error('ContextFilterChoice not found. Possible invalid configuration.');
2045
- return choice.ref;
2046
- };
2047
- this.label = () => {
2048
- let label = '';
2049
- this.selectedContextFilterChoices.forEach((filter) => {
2050
- label += filter.table + ': ' + filter.label + ' ';
2051
- });
2052
- return label;
2053
- };
2054
- }
2055
- }
2056
- TruContextFilters.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TruContextFilters, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2057
- TruContextFilters.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TruContextFilters, providedIn: 'root' });
2058
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TruContextFilters, decorators: [{
2059
- type: Injectable,
2060
- args: [{
2061
- providedIn: 'root',
2062
- }]
2063
- }], ctorParameters: function () { return []; } });
2064
-
2065
2069
  class TruToolbarContextFilter {
2066
2070
  constructor(truContextFilters) {
2067
2071
  this.truContextFilters = truContextFilters;
@@ -2390,14 +2394,13 @@ class WindowConfig {
2390
2394
  this.width = '400px';
2391
2395
  this.views = Array();
2392
2396
  this.zIndex = -1;
2393
- this.context = undefined;
2394
2397
  this.isReadOnly = false;
2395
2398
  this.unsubscribes = [];
2396
2399
  this.wasReadOnly = false;
2400
+ this.contextFilters = [];
2397
2401
  this.destroy = () => {
2398
2402
  while (this.unsubscribes.length)
2399
2403
  this?.unsubscribes?.shift()?.call();
2400
- this.context = undefined;
2401
2404
  };
2402
2405
  }
2403
2406
  }