@trudb/tru-common-lib 0.0.207 → 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) {
@@ -2035,34 +2066,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImpor
2035
2066
  }]
2036
2067
  }] });
2037
2068
 
2038
- class TruContextFilters {
2039
- constructor() {
2040
- this.filters = [];
2041
- this.selectedContextFilterChoices = [];
2042
- this.valueFor = (tableName) => {
2043
- let choice = this.selectedContextFilterChoices.find(f => f.table === tableName);
2044
- if (!choice)
2045
- throw new Error('ContextFilterChoice not found. Possible invalid configuration.');
2046
- return choice.ref;
2047
- };
2048
- this.label = () => {
2049
- let label = '';
2050
- this.selectedContextFilterChoices.forEach((filter) => {
2051
- label += filter.table + ': ' + filter.label + ' ';
2052
- });
2053
- return label;
2054
- };
2055
- }
2056
- }
2057
- TruContextFilters.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TruContextFilters, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2058
- TruContextFilters.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TruContextFilters, providedIn: 'root' });
2059
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TruContextFilters, decorators: [{
2060
- type: Injectable,
2061
- args: [{
2062
- providedIn: 'root',
2063
- }]
2064
- }], ctorParameters: function () { return []; } });
2065
-
2066
2069
  class TruToolbarContextFilter {
2067
2070
  constructor(truContextFilters) {
2068
2071
  this.truContextFilters = truContextFilters;
@@ -2391,14 +2394,13 @@ class WindowConfig {
2391
2394
  this.width = '400px';
2392
2395
  this.views = Array();
2393
2396
  this.zIndex = -1;
2394
- this.context = undefined;
2395
2397
  this.isReadOnly = false;
2396
2398
  this.unsubscribes = [];
2397
2399
  this.wasReadOnly = false;
2400
+ this.contextFilters = [];
2398
2401
  this.destroy = () => {
2399
2402
  while (this.unsubscribes.length)
2400
2403
  this?.unsubscribes?.shift()?.call();
2401
- this.context = undefined;
2402
2404
  };
2403
2405
  }
2404
2406
  }