@provoly/dashboard 1.1.5 → 1.1.7

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 (60) hide show
  1. package/esm2022/lib/core/components/share/access-rights-share/access-rights-share.component.mjs +17 -6
  2. package/esm2022/lib/core/components/share/group-share/group-share.component.mjs +3 -2
  3. package/esm2022/lib/core/components/share/share.utils.mjs +10 -7
  4. package/esm2022/lib/core/i18n/en.translations.mjs +3 -2
  5. package/esm2022/lib/core/i18n/fr.translations.mjs +3 -2
  6. package/esm2022/lib/core/model/filter.interface.mjs +1 -1
  7. package/esm2022/lib/dashboard/store/dashboard.selectors.mjs +1 -3
  8. package/esm2022/presentation/components/presentation.component.mjs +12 -12
  9. package/esm2022/toolbox/components/automate-refresh/automate-refresh.component.mjs +14 -11
  10. package/esm2022/toolbox/components/clear-view/clear-view.component.mjs +15 -11
  11. package/esm2022/toolbox/components/dashboard-details/dashboard-details.component.mjs +15 -13
  12. package/esm2022/toolbox/components/delete/delete.component.mjs +17 -18
  13. package/esm2022/toolbox/components/drag-widgets/drag-widgets.component.mjs +16 -11
  14. package/esm2022/toolbox/components/edit-mode-action/edit-mode-action.component.mjs +14 -12
  15. package/esm2022/toolbox/components/edit-mode-toggle/edit-mode-toggle.component.mjs +12 -7
  16. package/esm2022/toolbox/components/filter-settings/filter-settings.component.mjs +19 -14
  17. package/esm2022/toolbox/components/launch-tab/launch-tab.component.mjs +15 -11
  18. package/esm2022/toolbox/components/named-query/named-query.component.mjs +3 -3
  19. package/esm2022/toolbox/components/refresh-datasets/refresh-datasets.component.mjs +14 -10
  20. package/esm2022/toolbox/components/save-view/save-view.component.mjs +14 -10
  21. package/esm2022/toolbox/components/select-grid-layout/select-grid-layout.component.mjs +14 -9
  22. package/esm2022/toolbox/components/share/share.component.mjs +30 -34
  23. package/esm2022/toolbox/components/switch-to-edit-content/switch-to-edit-content.component.mjs +14 -12
  24. package/esm2022/toolbox/components/toolbox-action/toolbox-action.component.mjs +20 -6
  25. package/esm2022/toolbox/components/toolbox.component.mjs +1 -1
  26. package/esm2022/toolbox/toolbox.model.mjs +4 -4
  27. package/esm2022/widgets/widget-map/utils/cql-utils.class.mjs +54 -48
  28. package/fesm2022/provoly-dashboard-presentation.mjs +11 -11
  29. package/fesm2022/provoly-dashboard-presentation.mjs.map +1 -1
  30. package/fesm2022/provoly-dashboard-toolbox.mjs +197 -139
  31. package/fesm2022/provoly-dashboard-toolbox.mjs.map +1 -1
  32. package/fesm2022/provoly-dashboard-widgets-widget-map.mjs +53 -47
  33. package/fesm2022/provoly-dashboard-widgets-widget-map.mjs.map +1 -1
  34. package/fesm2022/provoly-dashboard.mjs +94 -80
  35. package/fesm2022/provoly-dashboard.mjs.map +1 -1
  36. package/lib/core/components/share/access-rights-share/access-rights-share.component.d.ts +7 -1
  37. package/lib/core/components/share/share.utils.d.ts +3 -0
  38. package/lib/core/i18n/en.translations.d.ts +1 -0
  39. package/lib/core/i18n/fr.translations.d.ts +1 -0
  40. package/lib/core/model/filter.interface.d.ts +1 -1
  41. package/lib/dashboard/store/dashboard.selectors.d.ts +0 -5
  42. package/package.json +18 -18
  43. package/presentation/components/presentation.component.d.ts +4 -5
  44. package/styles/components/_o-access-rights-share.scss +9 -1
  45. package/toolbox/components/automate-refresh/automate-refresh.component.d.ts +2 -2
  46. package/toolbox/components/clear-view/clear-view.component.d.ts +3 -2
  47. package/toolbox/components/dashboard-details/dashboard-details.component.d.ts +3 -5
  48. package/toolbox/components/delete/delete.component.d.ts +4 -13
  49. package/toolbox/components/drag-widgets/drag-widgets.component.d.ts +3 -3
  50. package/toolbox/components/edit-mode-action/edit-mode-action.component.d.ts +3 -8
  51. package/toolbox/components/edit-mode-toggle/edit-mode-toggle.component.d.ts +3 -2
  52. package/toolbox/components/filter-settings/filter-settings.component.d.ts +3 -3
  53. package/toolbox/components/launch-tab/launch-tab.component.d.ts +3 -2
  54. package/toolbox/components/refresh-datasets/refresh-datasets.component.d.ts +3 -3
  55. package/toolbox/components/save-view/save-view.component.d.ts +3 -5
  56. package/toolbox/components/select-grid-layout/select-grid-layout.component.d.ts +3 -3
  57. package/toolbox/components/share/share.component.d.ts +4 -8
  58. package/toolbox/components/switch-to-edit-content/switch-to-edit-content.component.d.ts +3 -8
  59. package/toolbox/components/toolbox-action/toolbox-action.component.d.ts +6 -3
  60. package/widgets/widget-map/utils/cql-utils.class.d.ts +1 -0
@@ -278,60 +278,66 @@ class CqlUtils {
278
278
  const attributesReference = classes.map((clazz) => clazz.attributes).flat();
279
279
  return filters[datasourceId]
280
280
  .map((cond) => {
281
- const conditions = [];
282
281
  const attribute = attributesReference.find((attr) => attr.id === cond.attribute);
283
282
  const field = fields.find((f) => f.id === attribute?.field);
284
283
  const attributeName = attribute?.technicalName;
285
- if (attributeName && cond.value && (typeof cond.value !== 'string' || cond.value.length > 0)) {
286
- const quoteSafeValue = `${cond.value}`.replace(/'/g, "''");
287
- switch (cond.operator) {
288
- case 'EQUALS':
289
- if (!field || TextFieldTypes.includes(field?.type)) {
290
- conditions.push(`${attributeName}='${quoteSafeValue}'`);
291
- }
292
- else {
293
- conditions.push(`${attributeName}=${cond.value}`);
294
- }
295
- break;
296
- case 'CONTAINS':
297
- conditions.push(`${attributeName} LIKE '%${quoteSafeValue}%'`);
298
- break;
299
- case 'START_WITH':
300
- conditions.push(`${attributeName} LIKE '${quoteSafeValue}%'`);
301
- break;
302
- case 'END_WITH':
303
- conditions.push(`${attributeName} LIKE '%${quoteSafeValue}'`);
304
- break;
305
- case 'GREATER_THAN':
306
- conditions.push(`${attributeName}>${cond.value}`);
307
- break;
308
- case 'LOWER_THAN':
309
- conditions.push(`${attributeName}<${cond.value}`);
310
- break;
311
- case 'INSIDE':
312
- const splitI = cond.value?.split(',');
313
- if (splitI && splitI.length > 1) {
314
- conditions.push(`${attributeName}<${splitI[0]}`);
315
- conditions.push(`${attributeName}>${splitI[1]}`);
316
- }
317
- break;
318
- case 'OUTSIDE':
319
- const splitO = cond.value?.split(',');
320
- if (splitO && splitO.length > 1) {
321
- conditions.push(`${attributeName}>${splitO[0]}`);
322
- conditions.push(`${attributeName}<${splitO[1]}`);
323
- }
324
- break;
325
- }
326
- }
327
- else {
328
- console.warn(`Cannot add cql filter on datasource ${datasourceId} because ${cond.attribute} attribute not found in classes`);
329
- }
330
- return conditions;
284
+ return this.getConditionsForValue(attributeName, cond, field, datasourceId);
331
285
  })
332
286
  .filter((conds) => conds.length > 0)
333
287
  .join(' AND ');
334
288
  }
289
+ static getConditionsForValue(attributeName, cond, field, datasourceId) {
290
+ let conditions = [];
291
+ const values = (Array.isArray(cond.value) ? cond.value : [cond.value]);
292
+ if (attributeName) {
293
+ values.forEach((value) => {
294
+ if (value && (typeof value !== 'string' || value.length > 0)) {
295
+ const quoteSafeValue = `${value}`.replace(/'/g, "''");
296
+ switch (cond.operator) {
297
+ case 'EQUALS':
298
+ if (!field || TextFieldTypes.includes(field?.type)) {
299
+ conditions.push(`${attributeName}='${quoteSafeValue}'`);
300
+ }
301
+ else {
302
+ conditions.push(`${attributeName}=${value}`);
303
+ }
304
+ break;
305
+ case 'CONTAINS':
306
+ conditions.push(`${attributeName} LIKE '%${quoteSafeValue}%'`);
307
+ break;
308
+ case 'START_WITH':
309
+ conditions.push(`${attributeName} LIKE '${quoteSafeValue}%'`);
310
+ break;
311
+ case 'END_WITH':
312
+ conditions.push(`${attributeName} LIKE '%${quoteSafeValue}'`);
313
+ break;
314
+ case 'GREATER_THAN':
315
+ conditions.push(`${attributeName}>${value}`);
316
+ break;
317
+ case 'LOWER_THAN':
318
+ conditions.push(`${attributeName}<${value}`);
319
+ break;
320
+ case 'OUTSIDE':
321
+ const splitI = value?.split(',');
322
+ if (splitI && splitI.length > 1) {
323
+ conditions.push(`( ${attributeName}<${splitI[0]} AND ${attributeName}>${splitI[1]} )`);
324
+ }
325
+ break;
326
+ case 'INSIDE':
327
+ const splitO = value?.split(',');
328
+ if (splitO && splitO.length > 1) {
329
+ conditions.push(`( ${attributeName}>${splitO[0]} AND ${attributeName}<${splitO[1]} )`);
330
+ }
331
+ break;
332
+ }
333
+ }
334
+ });
335
+ }
336
+ else {
337
+ console.warn(`Cannot add cql filter on datasource ${datasourceId} because ${cond.attribute} attribute not found in classes`);
338
+ }
339
+ return conditions.length > 1 ? '( ' + conditions.join(' OR ') + ' )' : conditions[0];
340
+ }
335
341
  }
336
342
 
337
343
  class XMLUtils {