@c8y/ngx-components 1022.27.0 → 1022.30.0

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.
Files changed (39) hide show
  1. package/context-dashboard/widget-config.component.d.ts +3 -1
  2. package/context-dashboard/widget-config.component.d.ts.map +1 -1
  3. package/context-dashboard/widget-config.service.d.ts +14 -8
  4. package/context-dashboard/widget-config.service.d.ts.map +1 -1
  5. package/core/dynamic-component/dynamic-component.model.d.ts +26 -0
  6. package/core/dynamic-component/dynamic-component.model.d.ts.map +1 -1
  7. package/core/index.d.ts +1 -0
  8. package/core/index.d.ts.map +1 -1
  9. package/core/resizable-grid/index.d.ts +2 -0
  10. package/core/resizable-grid/index.d.ts.map +1 -0
  11. package/core/resizable-grid/resizable-grid.component.d.ts +114 -0
  12. package/core/resizable-grid/resizable-grid.component.d.ts.map +1 -0
  13. package/dashboard-manager/devicemanagement/c8y-ngx-components-dashboard-manager-devicemanagement.d.ts.map +1 -0
  14. package/dashboard-manager/devicemanagement/index.d.ts +2 -0
  15. package/dashboard-manager/devicemanagement/index.d.ts.map +1 -0
  16. package/fesm2022/c8y-ngx-components-alarms.mjs +2 -2
  17. package/fesm2022/c8y-ngx-components-alarms.mjs.map +1 -1
  18. package/fesm2022/c8y-ngx-components-context-dashboard.mjs +27 -15
  19. package/fesm2022/c8y-ngx-components-context-dashboard.mjs.map +1 -1
  20. package/fesm2022/c8y-ngx-components-dashboard-manager-devicemanagement.mjs +19 -0
  21. package/fesm2022/c8y-ngx-components-dashboard-manager-devicemanagement.mjs.map +1 -0
  22. package/fesm2022/c8y-ngx-components-map.mjs +84 -26
  23. package/fesm2022/c8y-ngx-components-map.mjs.map +1 -1
  24. package/fesm2022/c8y-ngx-components.mjs +332 -1
  25. package/fesm2022/c8y-ngx-components.mjs.map +1 -1
  26. package/locales/de.po +26 -4
  27. package/locales/es.po +26 -4
  28. package/locales/fr.po +26 -4
  29. package/locales/ja_JP.po +25 -2
  30. package/locales/ko.po +26 -4
  31. package/locales/locales.pot +4 -3
  32. package/locales/nl.po +26 -4
  33. package/locales/pl.po +26 -4
  34. package/locales/pt_BR.po +26 -4
  35. package/locales/zh_CN.po +26 -4
  36. package/locales/zh_TW.po +26 -4
  37. package/map/map.service.d.ts +13 -10
  38. package/map/map.service.d.ts.map +1 -1
  39. package/package.json +1 -1
@@ -0,0 +1,19 @@
1
+ import { hookPreview } from '@c8y/ngx-components';
2
+
3
+ const dashboardManagerFeatureProvider = [
4
+ hookPreview({
5
+ key: 'ui.dm-dashboard-manager',
6
+ label: 'Dashboard manager',
7
+ description: () => import('@c8y/style/markdown-files/dm-dashboard-manager-preview.md').then(m => m.default),
8
+ settings: {
9
+ reload: true
10
+ }
11
+ })
12
+ ];
13
+
14
+ /**
15
+ * Generated bundle index. Do not edit.
16
+ */
17
+
18
+ export { dashboardManagerFeatureProvider };
19
+ //# sourceMappingURL=c8y-ngx-components-dashboard-manager-devicemanagement.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"c8y-ngx-components-dashboard-manager-devicemanagement.mjs","sources":["../../dashboard-manager/devicemanagement/index.ts","../../dashboard-manager/devicemanagement/c8y-ngx-components-dashboard-manager-devicemanagement.ts"],"sourcesContent":["import { hookPreview } from '@c8y/ngx-components';\n\nexport const dashboardManagerFeatureProvider = [\n hookPreview({\n key: 'ui.dm-dashboard-manager',\n label: 'Dashboard manager',\n description: () =>\n import('@c8y/style/markdown-files/dm-dashboard-manager-preview.md').then(m => m.default),\n settings: {\n reload: true\n }\n })\n];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAEa,MAAA,+BAA+B,GAAG;AAC7C,IAAA,WAAW,CAAC;AACV,QAAA,GAAG,EAAE,yBAAyB;AAC9B,QAAA,KAAK,EAAE,mBAAmB;AAC1B,QAAA,WAAW,EAAE,MACX,OAAO,2DAA2D,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC;AAC1F,QAAA,QAAQ,EAAE;AACR,YAAA,MAAM,EAAE;AACT;KACF;;;ACXH;;AAEG;;;;"}
@@ -4,9 +4,10 @@ import * as i1$1 from '@c8y/ngx-components';
4
4
  import { gettext, sortByPriority, ManagedObjectRealtimeService, globalAutoRefreshLoading, CountdownIntervalComponent, IconDirective, C8yTranslatePipe, CommonModule as CommonModule$1, FormsModule as FormsModule$1, RealtimeModule, CoreModule } from '@c8y/ngx-components';
5
5
  import * as i3 from '@ngx-translate/core';
6
6
  import * as i4 from 'rxjs';
7
- import { of, combineLatest, defer, NEVER, BehaviorSubject, Subject, fromEvent, EMPTY, merge, from } from 'rxjs';
7
+ import { of, combineLatest, defer, firstValueFrom, NEVER, BehaviorSubject, Subject, fromEvent, EMPTY, merge, from } from 'rxjs';
8
8
  import { map, first, takeUntil, scan, filter, switchMap, tap, mergeMap, catchError, debounceTime, skip } from 'rxjs/operators';
9
9
  import * as i1 from '@c8y/client';
10
+ import { QueriesUtil } from '@c8y/client';
10
11
  import { latLng, latLngBounds } from 'leaflet';
11
12
  import { get, remove, isUndefined, flatten, every, isNull, isEmpty, cloneDeep } from 'lodash-es';
12
13
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@@ -111,10 +112,11 @@ class MapService {
111
112
  /**
112
113
  * @ignore: Only DI.
113
114
  */
114
- constructor(inventory, options, serviceRegistry) {
115
+ constructor(inventory, options, serviceRegistry, featureCacheService) {
115
116
  this.inventory = inventory;
116
117
  this.options = options;
117
118
  this.serviceRegistry = serviceRegistry;
119
+ this.featureCacheService = featureCacheService;
118
120
  /**
119
121
  * The devices that are maximal displayed in one cluster.
120
122
  */
@@ -124,6 +126,7 @@ class MapService {
124
126
  * three clusters: 1, 4 or 16.
125
127
  */
126
128
  this.CLUSTER_LEVEL_THRESHOLD = 500;
129
+ this.queriesUtil = new QueriesUtil();
127
130
  }
128
131
  /**
129
132
  * Returns the leaflet instance used by the cumulocity core.
@@ -196,31 +199,63 @@ class MapService {
196
199
  /**
197
200
  * Counts all managed objects in a given bound with a c8y_Position fragment.
198
201
  * @param bound The lat lng bound to request the managed objects for.
199
- * @param byGroupIdMO The group managed object of which direct children should be searched for.
202
+ * @param isinhierarchyofMO The group managed object of which direct children should be searched for.
200
203
  * @returns The number of all position managed objects in the given bound (and group).
201
204
  */
202
- async getPositionMOsFromBoundCount(bound, byGroupIdMO) {
203
- return this.getPositionMOsFromBound(bound, byGroupIdMO, true);
205
+ async getPositionMOsFromBoundCount(bound, isinhierarchyofMO) {
206
+ return this.getPositionMOsFromBound(bound, isinhierarchyofMO, true);
204
207
  }
205
- async getPositionMOsFromBound(bound, byGroupIdMO, count = false) {
208
+ async getPositionMOsFromBound(bound, isinhierarchyofMO, count = false) {
206
209
  const { lat: latMin, lng: lngMinRaw } = bound.getSouthWest();
207
210
  const { lat: latMax, lng: lngMaxRaw } = bound.getNorthEast();
208
211
  const lngMin = lngMaxRaw - lngMinRaw > 360 ? -180 : this.normalizeLongitude(lngMinRaw);
209
212
  const lngMax = lngMaxRaw - lngMinRaw > 360 ? 180 : this.normalizeLongitude(lngMaxRaw);
210
- const byGroupIdFilter = byGroupIdMO
211
- ? `(bygroupid(${byGroupIdMO.id}) or id eq '${byGroupIdMO.id}') and `
212
- : '';
213
- let boundFilter = `$filter=${byGroupIdFilter}has(c8y_Position) and c8y_Position.lat gt ${latMin}d and c8y_Position.lat lt ${latMax}d`;
214
- if (lngMin < lngMax) {
215
- boundFilter = `${boundFilter} and c8y_Position.lng gt ${lngMin}d and c8y_Position.lng lt ${lngMax}d`;
216
- }
217
- else {
218
- boundFilter = `${boundFilter} and (c8y_Position.lng gt ${lngMin}d or c8y_Position.lng lt ${lngMax}d)`;
219
- }
213
+ const filterObjWithCoordinates = {
214
+ __and: [
215
+ ...(isinhierarchyofMO
216
+ ? [
217
+ {
218
+ __or: [
219
+ { id: isinhierarchyofMO.id },
220
+ await this.childrenOfGroupFilter(isinhierarchyofMO)
221
+ ]
222
+ }
223
+ ]
224
+ : []),
225
+ {
226
+ __has: 'c8y_Position'
227
+ },
228
+ {
229
+ ['c8y_Position.lat']: {
230
+ __gt: latMin
231
+ }
232
+ },
233
+ {
234
+ ['c8y_Position.lat']: {
235
+ __lt: latMax
236
+ }
237
+ },
238
+ {
239
+ [lngMin < lngMax ? '__and' : '__or']: [
240
+ {
241
+ ['c8y_Position.lng']: {
242
+ __gt: lngMin
243
+ }
244
+ },
245
+ {
246
+ ['c8y_Position.lng']: {
247
+ __lt: lngMax
248
+ }
249
+ }
250
+ ]
251
+ }
252
+ ]
253
+ };
254
+ const query = this.queriesUtil.buildQuery(filterObjWithCoordinates);
220
255
  const { paging, data } = await this.inventory.list({
221
256
  pageSize: count ? 1 : this.MAX_DEVICE_PER_CLUSTER,
222
257
  withTotalPages: count,
223
- query: boundFilter
258
+ query
224
259
  });
225
260
  if (count) {
226
261
  return paging.totalPages;
@@ -236,10 +271,13 @@ class MapService {
236
271
  * @returns All devices or the device count with a c8y_Position fragment.
237
272
  */
238
273
  async getPositionDevices(pageSize = this.MAX_DEVICE_PER_CLUSTER, count) {
274
+ const query = this.queriesUtil.buildQuery({
275
+ __and: [{ __has: 'c8y_Position' }, { __has: 'c8y_IsDevice' }]
276
+ });
239
277
  const { paging, data } = await this.inventory.list({
240
278
  pageSize: count ? 1 : pageSize,
241
279
  withTotalPages: !!count,
242
- query: '$filter=has(c8y_Position) and has(c8y_IsDevice)'
280
+ query
243
281
  });
244
282
  if (count) {
245
283
  return paging.totalPages;
@@ -248,19 +286,27 @@ class MapService {
248
286
  }
249
287
  /**
250
288
  * Returns all managed object with a c8y_Position fragment.
251
- * @param byGroupIdMO The group managed object of which direct children should be searched for.
289
+ * @param isinhierarchyofMO The group managed object of which direct children should be searched for.
252
290
  * @param pageSize Defines how many results should be returned.
253
291
  * @returns The managed objects with position.
254
292
  */
255
- async getAllPositionMOs(byGroupIdMO, pageSize = 500) {
293
+ async getAllPositionMOs(isinhierarchyofMO, pageSize = 500) {
294
+ const childrenFilter = isinhierarchyofMO
295
+ ? await this.childrenOfGroupFilter(isinhierarchyofMO)
296
+ : undefined;
297
+ const orValue = childrenFilter ? [{ id: isinhierarchyofMO.id }, childrenFilter] : undefined;
298
+ const queryObj = {
299
+ __filter: {
300
+ __and: [{ __has: 'c8y_Position' }],
301
+ ...(orValue ? { __or: orValue } : {})
302
+ }
303
+ };
304
+ const query = this.queriesUtil.buildQuery(queryObj);
256
305
  const filter = {
257
306
  pageSize,
258
307
  withTotalPages: true,
259
- query: 'has(c8y_Position)'
308
+ query
260
309
  };
261
- if (byGroupIdMO) {
262
- filter.query = `$filter=(bygroupid(${byGroupIdMO.id}) or id eq '${byGroupIdMO.id}') and has(c8y_Position)`;
263
- }
264
310
  const { paging, data, res } = await this.inventory.list(filter);
265
311
  return {
266
312
  res,
@@ -364,7 +410,19 @@ class MapService {
364
410
  pmo.c8y_Position.lng = lng;
365
411
  return pmo;
366
412
  }
367
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: MapService, deps: [{ token: i1.InventoryService }, { token: i1$1.OptionsService }, { token: i1$1.ServiceRegistry }], target: i0.ɵɵFactoryTarget.Injectable }); }
413
+ async childrenOfGroupFilter(mo) {
414
+ try {
415
+ const useInHierarchyOf = await firstValueFrom(this.featureCacheService.getFeatureState('ui.map.isinhierarchyof'));
416
+ if (useInHierarchyOf) {
417
+ return { __isinhierarchyof: mo.id };
418
+ }
419
+ }
420
+ catch (e) {
421
+ console.warn('Error while determining isinhierarchyof feature toggle state:', e);
422
+ }
423
+ return { __bygroupid: mo.id };
424
+ }
425
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: MapService, deps: [{ token: i1.InventoryService }, { token: i1$1.OptionsService }, { token: i1$1.ServiceRegistry }, { token: i1$1.FeatureCacheService }], target: i0.ɵɵFactoryTarget.Injectable }); }
368
426
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: MapService, providedIn: 'root' }); }
369
427
  }
370
428
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: MapService, decorators: [{
@@ -372,7 +430,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
372
430
  args: [{
373
431
  providedIn: 'root'
374
432
  }]
375
- }], ctorParameters: () => [{ type: i1.InventoryService }, { type: i1$1.OptionsService }, { type: i1$1.ServiceRegistry }] });
433
+ }], ctorParameters: () => [{ type: i1.InventoryService }, { type: i1$1.OptionsService }, { type: i1$1.ServiceRegistry }, { type: i1$1.FeatureCacheService }] });
376
434
 
377
435
  class ClusterMap {
378
436
  set clusterMarker(item) {