@qrvey/utils 1.2.4 → 1.2.8

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 (36) hide show
  1. package/README.md +569 -569
  2. package/dist/charts/helpers/index.d.ts +3 -0
  3. package/dist/charts/helpers/index.js +3 -0
  4. package/dist/charts/helpers/isExpandableTableChart.d.ts +1 -0
  5. package/dist/charts/helpers/isExpandableTableChart.js +4 -0
  6. package/dist/charts/helpers/isSimpleTableChart.d.ts +1 -0
  7. package/dist/charts/helpers/isSimpleTableChart.js +5 -0
  8. package/dist/charts/helpers/isTableChart.d.ts +1 -0
  9. package/dist/charts/helpers/isTableChart.js +4 -0
  10. package/dist/cjs/charts/helpers/index.d.ts +3 -0
  11. package/dist/cjs/charts/helpers/index.js +15 -0
  12. package/dist/cjs/charts/helpers/isExpandableTableChart.d.ts +1 -0
  13. package/dist/cjs/charts/helpers/isExpandableTableChart.js +8 -0
  14. package/dist/cjs/charts/helpers/isSimpleTableChart.d.ts +1 -0
  15. package/dist/cjs/charts/helpers/isSimpleTableChart.js +9 -0
  16. package/dist/cjs/charts/helpers/isTableChart.d.ts +1 -0
  17. package/dist/cjs/charts/helpers/isTableChart.js +8 -0
  18. package/dist/cjs/constants/Charts.Const.d.ts +1 -0
  19. package/dist/cjs/constants/Charts.Const.js +1 -0
  20. package/dist/cjs/filters/adapters/UIToOldLogic.js +1 -0
  21. package/dist/cjs/filters/adapters/flatUIToOldLogic.js +3 -2
  22. package/dist/cjs/filters/adapters/logicToFlatUI.js +1 -1
  23. package/dist/constants/Charts.Const.d.ts +1 -0
  24. package/dist/constants/Charts.Const.js +1 -0
  25. package/dist/filters/adapters/UIToOldLogic.js +1 -0
  26. package/dist/filters/adapters/flatUIToOldLogic.js +3 -2
  27. package/dist/filters/adapters/logicToFlatUI.js +1 -1
  28. package/package.json +1 -1
  29. package/src/charts/helpers/index.ts +3 -0
  30. package/src/charts/helpers/isExpandableTableChart.ts +5 -0
  31. package/src/charts/helpers/isSimpleTableChart.ts +5 -0
  32. package/src/charts/helpers/isTableChart.ts +5 -0
  33. package/src/constants/Charts.Const.ts +1 -0
  34. package/src/filters/adapters/UIToOldLogic.ts +2 -0
  35. package/src/filters/adapters/flatUIToOldLogic.ts +4 -2
  36. package/src/filters/adapters/logicToFlatUI.ts +1 -1
@@ -0,0 +1,3 @@
1
+ export * from './isExpandableTableChart';
2
+ export * from './isSimpleTableChart';
3
+ export * from './isTableChart';
@@ -0,0 +1,3 @@
1
+ export * from './isExpandableTableChart';
2
+ export * from './isSimpleTableChart';
3
+ export * from './isTableChart';
@@ -0,0 +1 @@
1
+ export declare function isExpandableTableChart(model?: any): boolean;
@@ -0,0 +1,4 @@
1
+ import { CHART_TYPE } from "../../constants/Charts.Const";
2
+ export function isExpandableTableChart(model = {}) {
3
+ return model.type === CHART_TYPE.EXPANDABLE_TABLE_CHART;
4
+ }
@@ -0,0 +1 @@
1
+ export declare function isSimpleTableChart(model?: any): boolean;
@@ -0,0 +1,5 @@
1
+ import { isTableChart } from "./isTableChart";
2
+ export function isSimpleTableChart(model = {}) {
3
+ var _a, _b;
4
+ return isTableChart(model.type) && !(((_b = (_a = model.chart) === null || _a === void 0 ? void 0 : _a.fields) === null || _b === void 0 ? void 0 : _b.groupsList) || []).length;
5
+ }
@@ -0,0 +1 @@
1
+ export declare function isTableChart(model?: any): boolean;
@@ -0,0 +1,4 @@
1
+ import { CHART_TYPE } from "../../constants/Charts.Const";
2
+ export function isTableChart(model = {}) {
3
+ return model.type === CHART_TYPE.TABLE_CHART;
4
+ }
@@ -0,0 +1,3 @@
1
+ export * from './isExpandableTableChart';
2
+ export * from './isSimpleTableChart';
3
+ export * from './isTableChart';
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./isExpandableTableChart"), exports);
14
+ __exportStar(require("./isSimpleTableChart"), exports);
15
+ __exportStar(require("./isTableChart"), exports);
@@ -0,0 +1 @@
1
+ export declare function isExpandableTableChart(model?: any): boolean;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isExpandableTableChart = void 0;
4
+ const Charts_Const_1 = require("../../constants/Charts.Const");
5
+ function isExpandableTableChart(model = {}) {
6
+ return model.type === Charts_Const_1.CHART_TYPE.EXPANDABLE_TABLE_CHART;
7
+ }
8
+ exports.isExpandableTableChart = isExpandableTableChart;
@@ -0,0 +1 @@
1
+ export declare function isSimpleTableChart(model?: any): boolean;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSimpleTableChart = void 0;
4
+ const isTableChart_1 = require("./isTableChart");
5
+ function isSimpleTableChart(model = {}) {
6
+ var _a, _b;
7
+ return (0, isTableChart_1.isTableChart)(model.type) && !(((_b = (_a = model.chart) === null || _a === void 0 ? void 0 : _a.fields) === null || _b === void 0 ? void 0 : _b.groupsList) || []).length;
8
+ }
9
+ exports.isSimpleTableChart = isSimpleTableChart;
@@ -0,0 +1 @@
1
+ export declare function isTableChart(model?: any): boolean;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isTableChart = void 0;
4
+ const Charts_Const_1 = require("../../constants/Charts.Const");
5
+ function isTableChart(model = {}) {
6
+ return model.type === Charts_Const_1.CHART_TYPE.TABLE_CHART;
7
+ }
8
+ exports.isTableChart = isTableChart;
@@ -1,6 +1,7 @@
1
1
  export declare enum CHART_TYPE {
2
2
  BAR_CHART = "BAR_CHART",
3
3
  BAR_CHART_MS = "BAR_CHART_MS",
4
+ EXPANDABLE_TABLE_CHART = "EXPANDABLE_TABLE_CHART",
4
5
  SYMBOL_CHART = "SYMBOL_CHART",
5
6
  SYMBOL_CHART_MS = "SYMBOL_CHART_MS",
6
7
  LINE_CHART = "LINE_CHART",
@@ -5,6 +5,7 @@ var CHART_TYPE;
5
5
  (function (CHART_TYPE) {
6
6
  CHART_TYPE["BAR_CHART"] = "BAR_CHART";
7
7
  CHART_TYPE["BAR_CHART_MS"] = "BAR_CHART_MS";
8
+ CHART_TYPE["EXPANDABLE_TABLE_CHART"] = "EXPANDABLE_TABLE_CHART";
8
9
  CHART_TYPE["SYMBOL_CHART"] = "SYMBOL_CHART";
9
10
  CHART_TYPE["SYMBOL_CHART_MS"] = "SYMBOL_CHART_MS";
10
11
  CHART_TYPE["LINE_CHART"] = "LINE_CHART";
@@ -82,6 +82,7 @@ function buildExpressions(filterSection, scope, dataset) {
82
82
  value: (0, getBackendValues_1.getBackendValues)(filter),
83
83
  uiExtras: getFilterDetail(filter, scope, dataset),
84
84
  };
85
+ expression['enabled'] = expression.value.length > 0 ? filter.enabled : false;
85
86
  expressions.push(expression);
86
87
  return expressions;
87
88
  }, []);
@@ -161,8 +161,7 @@ function getRankingExpressions(props) {
161
161
  }
162
162
  function getRegularExpression(props) {
163
163
  const uiValue = getUIValuess(props);
164
- return {
165
- enabled: props.enabled,
164
+ const expression = {
166
165
  groupValue: (0, getBackendGroupValue_1.getBackendGroupValue)(props),
167
166
  linkid: props.column.linkid,
168
167
  property: (0, getBackendProperty_1.getBackendProperty)(props),
@@ -174,6 +173,8 @@ function getRegularExpression(props) {
174
173
  value: getValues(props),
175
174
  uiExtras: Object.assign(Object.assign({}, props), { uiValue })
176
175
  };
176
+ expression['enabled'] = expression.value.length > 0 ? props.enabled : false;
177
+ return expression;
177
178
  }
178
179
  // function getGroupValue(props: OLD_IFilterDetail): IFProperty {
179
180
  // if (!isDateDistinctProperty(props.column as any, props.property) && isEmpty(props.column.aggregate) && isDateColumn(props.column) && props.property) {
@@ -80,7 +80,7 @@ function getFilterByExpression(expression, scopeItem) {
80
80
  },
81
81
  dateSection: uiExtras.dateSection,
82
82
  displayed: true,
83
- enabled: expression.enabled,
83
+ enabled: uiExtras.enabled,
84
84
  extras: Object.assign(Object.assign({}, uiExtras.extras), { panelid: uiExtras.panelid, filterLabel: uiExtras.panelName, info,
85
85
  scopeid, scope: scopeItem.scope, section: uiExtras.section, scopeInfo: {
86
86
  collapsed: (_q = scopeItem.uiExtras) === null || _q === void 0 ? void 0 : _q.collapsed,
@@ -1,6 +1,7 @@
1
1
  export declare enum CHART_TYPE {
2
2
  BAR_CHART = "BAR_CHART",
3
3
  BAR_CHART_MS = "BAR_CHART_MS",
4
+ EXPANDABLE_TABLE_CHART = "EXPANDABLE_TABLE_CHART",
4
5
  SYMBOL_CHART = "SYMBOL_CHART",
5
6
  SYMBOL_CHART_MS = "SYMBOL_CHART_MS",
6
7
  LINE_CHART = "LINE_CHART",
@@ -2,6 +2,7 @@ export var CHART_TYPE;
2
2
  (function (CHART_TYPE) {
3
3
  CHART_TYPE["BAR_CHART"] = "BAR_CHART";
4
4
  CHART_TYPE["BAR_CHART_MS"] = "BAR_CHART_MS";
5
+ CHART_TYPE["EXPANDABLE_TABLE_CHART"] = "EXPANDABLE_TABLE_CHART";
5
6
  CHART_TYPE["SYMBOL_CHART"] = "SYMBOL_CHART";
6
7
  CHART_TYPE["SYMBOL_CHART_MS"] = "SYMBOL_CHART_MS";
7
8
  CHART_TYPE["LINE_CHART"] = "LINE_CHART";
@@ -78,6 +78,7 @@ function buildExpressions(filterSection, scope, dataset) {
78
78
  value: getBackendValues(filter),
79
79
  uiExtras: getFilterDetail(filter, scope, dataset),
80
80
  };
81
+ expression['enabled'] = expression.value.length > 0 ? filter.enabled : false;
81
82
  expressions.push(expression);
82
83
  return expressions;
83
84
  }, []);
@@ -155,8 +155,7 @@ function getRankingExpressions(props) {
155
155
  }
156
156
  function getRegularExpression(props) {
157
157
  const uiValue = getUIValuess(props);
158
- return {
159
- enabled: props.enabled,
158
+ const expression = {
160
159
  groupValue: getBackendGroupValue(props),
161
160
  linkid: props.column.linkid,
162
161
  property: getBackendProperty(props),
@@ -168,6 +167,8 @@ function getRegularExpression(props) {
168
167
  value: getValues(props),
169
168
  uiExtras: Object.assign(Object.assign({}, props), { uiValue })
170
169
  };
170
+ expression['enabled'] = expression.value.length > 0 ? props.enabled : false;
171
+ return expression;
171
172
  }
172
173
  // function getGroupValue(props: OLD_IFilterDetail): IFProperty {
173
174
  // if (!isDateDistinctProperty(props.column as any, props.property) && isEmpty(props.column.aggregate) && isDateColumn(props.column) && props.property) {
@@ -76,7 +76,7 @@ function getFilterByExpression(expression, scopeItem) {
76
76
  },
77
77
  dateSection: uiExtras.dateSection,
78
78
  displayed: true,
79
- enabled: expression.enabled,
79
+ enabled: uiExtras.enabled,
80
80
  extras: Object.assign(Object.assign({}, uiExtras.extras), { panelid: uiExtras.panelid, filterLabel: uiExtras.panelName, info,
81
81
  scopeid, scope: scopeItem.scope, section: uiExtras.section, scopeInfo: {
82
82
  collapsed: (_q = scopeItem.uiExtras) === null || _q === void 0 ? void 0 : _q.collapsed,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.2.4",
3
+ "version": "1.2.8",
4
4
  "description": "Helper, Utils for all Qrvey Projects",
5
5
  "homepage": "https://bitbucket.org/qrvey/qrvey_utils/wiki/Home",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,3 @@
1
+ export * from './isExpandableTableChart';
2
+ export * from './isSimpleTableChart';
3
+ export * from './isTableChart';
@@ -0,0 +1,5 @@
1
+ import { CHART_TYPE } from "../../constants/Charts.Const";
2
+
3
+ export function isExpandableTableChart(model: any = {}): boolean {
4
+ return model.type === CHART_TYPE.EXPANDABLE_TABLE_CHART;
5
+ }
@@ -0,0 +1,5 @@
1
+ import { isTableChart } from "./isTableChart";
2
+
3
+ export function isSimpleTableChart(model: any = {}): boolean {
4
+ return isTableChart(model.type) && !(model.chart?.fields?.groupsList || []).length;
5
+ }
@@ -0,0 +1,5 @@
1
+ import { CHART_TYPE } from "../../constants/Charts.Const";
2
+
3
+ export function isTableChart(model: any = {}): boolean {
4
+ return model.type === CHART_TYPE.TABLE_CHART;
5
+ }
@@ -1,6 +1,7 @@
1
1
  export enum CHART_TYPE {
2
2
  BAR_CHART = 'BAR_CHART',
3
3
  BAR_CHART_MS = 'BAR_CHART_MS',
4
+ EXPANDABLE_TABLE_CHART = 'EXPANDABLE_TABLE_CHART',
4
5
  SYMBOL_CHART = 'SYMBOL_CHART',
5
6
  SYMBOL_CHART_MS = 'SYMBOL_CHART_MS',
6
7
  LINE_CHART = 'LINE_CHART',
@@ -93,6 +93,8 @@ function buildExpressions(filterSection: IFUFilter[], scope: IFUScope, dataset:
93
93
  value: getBackendValues(filter),
94
94
  uiExtras: getFilterDetail(filter, scope, dataset),
95
95
  };
96
+ expression['enabled'] = expression.value.length > 0 ? filter.enabled : false;
97
+
96
98
  expressions.push(expression);
97
99
  return expressions;
98
100
  }, [] as OLD_IFilterExpression[]);
@@ -181,8 +181,7 @@ function getRankingExpressions(props: OLD_IFilterDetail): OLD_IFilterExpression[
181
181
 
182
182
  function getRegularExpression(props: OLD_IFilterDetail): OLD_IFilterExpression {
183
183
  const uiValue = getUIValuess(props);
184
- return {
185
- enabled: props.enabled,
184
+ const expression = {
186
185
  groupValue: getBackendGroupValue(props as any),
187
186
  linkid: props.column.linkid,
188
187
  property: getBackendProperty(props as any),
@@ -197,6 +196,9 @@ function getRegularExpression(props: OLD_IFilterDetail): OLD_IFilterExpression {
197
196
  uiValue
198
197
  }
199
198
  };
199
+ expression['enabled'] = expression.value.length > 0 ? props.enabled : false;
200
+
201
+ return expression;
200
202
  }
201
203
 
202
204
  // function getGroupValue(props: OLD_IFilterDetail): IFProperty {
@@ -83,7 +83,7 @@ function getFilterByExpression(expression: OLD_IFilterExpression, scopeItem: OLD
83
83
  },
84
84
  dateSection: uiExtras.dateSection,
85
85
  displayed: true,
86
- enabled: expression.enabled,
86
+ enabled: uiExtras.enabled,
87
87
  extras: {
88
88
  ...uiExtras.extras,
89
89
  panelid: uiExtras.panelid,