@qrvey/utils 1.17.0 → 1.17.2

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 (34) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/elements/helpers/fixed.js +10 -1
  3. package/dist/cjs/elements/helpers/gridStrategy.js +23 -9
  4. package/dist/cjs/elements/helpers/responsive.js +10 -1
  5. package/dist/cjs/elements/helpers/vem-element/constants/vem.constants.js +33 -0
  6. package/dist/cjs/elements/helpers/vem-element/definitions/main.definitions.js +263 -0
  7. package/dist/cjs/elements/helpers/vem-element/helpers/vem.helpers.js +76 -0
  8. package/dist/cjs/elements/helpers/vem-element/models/vem.models.js +3 -0
  9. package/dist/cjs/elements/interfaces/IVemCore.js +12 -0
  10. package/dist/cjs/elements/utils/element.js +23 -2
  11. package/dist/cjs/filters/services/UChartApi.js +2 -2
  12. package/dist/cjs/filters/services/UChartPaginationApi.js +2 -2
  13. package/dist/elements/helpers/fixed.d.ts +3 -2
  14. package/dist/elements/helpers/fixed.js +9 -1
  15. package/dist/elements/helpers/gridStrategy.d.ts +8 -1
  16. package/dist/elements/helpers/gridStrategy.js +24 -12
  17. package/dist/elements/helpers/responsive.d.ts +3 -2
  18. package/dist/elements/helpers/responsive.js +9 -1
  19. package/dist/elements/helpers/vem-element/constants/vem.constants.d.ts +24 -0
  20. package/dist/elements/helpers/vem-element/constants/vem.constants.js +30 -0
  21. package/dist/elements/helpers/vem-element/definitions/main.definitions.d.ts +9 -0
  22. package/dist/elements/helpers/vem-element/definitions/main.definitions.js +260 -0
  23. package/dist/elements/helpers/vem-element/helpers/vem.helpers.d.ts +8 -0
  24. package/dist/elements/helpers/vem-element/helpers/vem.helpers.js +70 -0
  25. package/dist/elements/helpers/vem-element/models/vem.models.d.ts +85 -0
  26. package/dist/elements/helpers/vem-element/models/vem.models.js +1 -0
  27. package/dist/elements/interfaces/ICanvasGrid.d.ts +24 -0
  28. package/dist/elements/interfaces/IVemCore.d.ts +14 -0
  29. package/dist/elements/interfaces/IVemCore.js +11 -0
  30. package/dist/elements/utils/element.d.ts +5 -1
  31. package/dist/elements/utils/element.js +21 -1
  32. package/dist/filters/services/UChartApi.js +2 -2
  33. package/dist/filters/services/UChartPaginationApi.js +2 -2
  34. package/package.json +4 -1
@@ -13,7 +13,7 @@ export const copyDesktopPositionToDevice = (elements, newCanvasDevice, canvasTyp
13
13
  },
14
14
  };
15
15
  return elements.map((element) => {
16
- if (!element.position[canvasType]?.[newCanvasDevice]) {
16
+ if (!hasPositionForDevice(element, newCanvasDevice, canvasType)) {
17
17
  const desktopViewPosition = element.position[canvasType][CanvasDevice.DESKTOP];
18
18
  const newDevicePosition = {
19
19
  ...desktopViewPosition,
@@ -25,3 +25,23 @@ export const copyDesktopPositionToDevice = (elements, newCanvasDevice, canvasTyp
25
25
  return element;
26
26
  });
27
27
  };
28
+ export const normalizeElements = (elements, newCanvasDevice, canvasType) => {
29
+ const withPosition = [];
30
+ const withoutPosition = [];
31
+ for (const element of elements) {
32
+ if (hasPositionForDevice(element, newCanvasDevice, canvasType)) {
33
+ withPosition.push(element);
34
+ }
35
+ else {
36
+ withoutPosition.push(element);
37
+ }
38
+ }
39
+ const newElements = copyDesktopPositionToDevice(withoutPosition, newCanvasDevice, canvasType);
40
+ return {
41
+ scopeElements: withPosition,
42
+ newElements,
43
+ };
44
+ };
45
+ const hasPositionForDevice = (element, device, canvasType) => {
46
+ return !!element.position[canvasType]?.[device];
47
+ };
@@ -102,14 +102,14 @@ export class UChartApi {
102
102
  : 1000;
103
103
  static _getSortOption = (column) => {
104
104
  let sortBy = "CATEGORY";
105
- let sortDirection = isNumericalColumn(column) ? "DESC" : "ASC";
105
+ let sortDirection = "ASC";
106
106
  if (!isEmpty(column.sorting)) {
107
107
  sortBy = _get(column.sorting, "sortBy");
108
108
  sortDirection = _get(column.sorting, "order");
109
109
  if (sortBy == null)
110
110
  sortBy = "VALUE";
111
111
  if (sortDirection == null)
112
- sortDirection = "DESC";
112
+ sortDirection = "ASC";
113
113
  }
114
114
  return { by: sortBy, direction: sortDirection };
115
115
  };
@@ -119,14 +119,14 @@ export class UChartPaginationApi {
119
119
  : 1000;
120
120
  static _getSortOption = (column) => {
121
121
  let by = "CATEGORY";
122
- let direction = isNumericalColumn(column) ? "DESC" : "ASC";
122
+ let direction = "ASC";
123
123
  if (!isEmpty(column.sorting)) {
124
124
  by = _get(column.sorting, "sortBy");
125
125
  direction = _get(column.sorting, "order");
126
126
  if (by == null)
127
127
  by = "VALUE";
128
128
  if (direction == null)
129
- direction = "DESC";
129
+ direction = "ASC";
130
130
  }
131
131
  return { by, direction };
132
132
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.17.0",
3
+ "version": "1.17.2",
4
4
  "description": "Helper, Utils for all Qrvey Projects",
5
5
  "homepage": "https://bitbucket.org/qrvey/qrvey_utils/wiki/Home",
6
6
  "main": "dist/cjs/index.js",
@@ -81,6 +81,9 @@
81
81
  "files": [
82
82
  "dist/**/*"
83
83
  ],
84
+ "overrides": {
85
+ "js-yaml": "4.2.0"
86
+ },
84
87
  "sideEffects": false,
85
88
  "types": "dist/index.d.ts"
86
89
  }