@qrvey/utils 1.18.15 → 1.18.17
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.
- package/README.md +1 -1
- package/dist/cjs/comparativeAnalysis/index.js +8 -1
- package/dist/cjs/elements/helpers/vem-element/helpers/vem.helpers.js +14 -1
- package/dist/cjs/elements/interfaces/IVemCore.js +1 -0
- package/dist/comparativeAnalysis/index.d.ts +1 -0
- package/dist/comparativeAnalysis/index.js +7 -1
- package/dist/elements/helpers/vem-element/helpers/vem.helpers.js +15 -2
- package/dist/elements/interfaces/IVemCore.d.ts +1 -0
- package/dist/elements/interfaces/IVemCore.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,6 +5,7 @@ exports.formatDeltaColumnCaption = formatDeltaColumnCaption;
|
|
|
5
5
|
exports.formatReferenceColumnCaption = formatReferenceColumnCaption;
|
|
6
6
|
exports.stripColumnMarker = stripColumnMarker;
|
|
7
7
|
exports.resolveComparativeColumnCaption = resolveComparativeColumnCaption;
|
|
8
|
+
exports.isNullDateOperator = isNullDateOperator;
|
|
8
9
|
exports.formatPeriodLabel = formatPeriodLabel;
|
|
9
10
|
exports.formatComparativePeriodCaption = formatComparativePeriodCaption;
|
|
10
11
|
exports.formatDeltaDefaultCaption = formatDeltaDefaultCaption;
|
|
@@ -79,7 +80,13 @@ function resolveComparativeColumnCaption(chartModel, columnKey, allDatesText) {
|
|
|
79
80
|
return formatDeltaColumnCaption(customLabels[dataFieldKey]);
|
|
80
81
|
return formatDeltaDefaultCaption(comparativeAnalisis.referencePeriod, comparativeAnalisis.compareTo, fallbackAllDates, defaultName);
|
|
81
82
|
}
|
|
83
|
+
function isNullDateOperator(operator) {
|
|
84
|
+
const id = String(operator?.label ?? operator?.key ?? "").toUpperCase();
|
|
85
|
+
return id === "IS_NULL" || id === "IS_NOT_NULL";
|
|
86
|
+
}
|
|
82
87
|
function formatPeriodLabel(period, allDatesText) {
|
|
88
|
+
if (isNullDateOperator(period?.operator))
|
|
89
|
+
return period.operator.text || allDatesText;
|
|
83
90
|
if (period?.customLabel)
|
|
84
91
|
return period.customLabel;
|
|
85
92
|
if (!period?.date1)
|
|
@@ -323,7 +330,7 @@ function buildComparativeChartComparison(myBus, chart, groups) {
|
|
|
323
330
|
if (!periodData || !periodData.operator)
|
|
324
331
|
return null;
|
|
325
332
|
const operatorLabel = periodData.operator.label;
|
|
326
|
-
const isNullType =
|
|
333
|
+
const isNullType = isNullDateOperator(periodData.operator);
|
|
327
334
|
if (!isNullType && !periodData.date1)
|
|
328
335
|
return null;
|
|
329
336
|
const validationType = mapOperatorToValidationType(operatorLabel);
|
|
@@ -14,8 +14,19 @@ exports.VEM_DEFINITIONS = {
|
|
|
14
14
|
filterInput: main_definitions_1.FILTER_INPUT_ITEM_DEFINITION,
|
|
15
15
|
filterDate: main_definitions_1.FILTER_DATE_ITEM_DEFINITION,
|
|
16
16
|
filterList: main_definitions_1.FILTER_LIST_ITEM_DEFINITION,
|
|
17
|
+
filterSingleList: main_definitions_1.FILTER_LIST_ITEM_DEFINITION,
|
|
17
18
|
container: main_definitions_1.CONTAINER_ITEM_DEFINITION,
|
|
18
19
|
};
|
|
20
|
+
const UNREGISTERED_TYPE_SIZE = {
|
|
21
|
+
[IVemPosition_1.VemPositionType.FIXED]: {
|
|
22
|
+
height: vem_constants_1.DEFAULT_HEIGHT_IN_FIXED,
|
|
23
|
+
width: vem_constants_1.DEFAULT_WIDTH_IN_FIXED,
|
|
24
|
+
},
|
|
25
|
+
[IVemPosition_1.VemPositionType.RESPONSIVE]: {
|
|
26
|
+
height: vem_constants_1.DEFAULT_HEIGHT_IN_RESPONSIVE,
|
|
27
|
+
width: vem_constants_1.DEFAULT_WIDTH_IN_RESPONSIVE,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
19
30
|
const updateDimension = (element, canvasConfig, positionType, deviceList = vem_constants_1.DEVICE_LIST) => {
|
|
20
31
|
const position = (0, exports.getDefaultDimensions)(element, positionType);
|
|
21
32
|
let newElement = element;
|
|
@@ -40,8 +51,10 @@ const updateDimension = (element, canvasConfig, positionType, deviceList = vem_c
|
|
|
40
51
|
exports.updateDimension = updateDimension;
|
|
41
52
|
const normalizeSize = (item, positionType) => {
|
|
42
53
|
const vemDefinition = exports.VEM_DEFINITIONS[item.type];
|
|
54
|
+
if (!vemDefinition)
|
|
55
|
+
return UNREGISTERED_TYPE_SIZE[positionType];
|
|
43
56
|
const rawSize = vemDefinition.behavior.addingConfig.defaultDimensions[positionType];
|
|
44
|
-
const customSizeResolver = vemDefinition
|
|
57
|
+
const customSizeResolver = vemDefinition.behavior.addingConfig.minSize?.[positionType]?.customSize;
|
|
45
58
|
const baseHeight = "height" in rawSize ? rawSize.height : rawSize.rowSpan;
|
|
46
59
|
const baseWidth = "width" in rawSize ? rawSize.width : rawSize.colSpan;
|
|
47
60
|
if (!customSizeResolver)
|
|
@@ -10,6 +10,7 @@ var VemType;
|
|
|
10
10
|
VemType["ANALYTICS"] = "analytics";
|
|
11
11
|
VemType["FILTER_INPUT"] = "filterInput";
|
|
12
12
|
VemType["FILTER_LIST"] = "filterList";
|
|
13
|
+
VemType["FILTER_SINGLE_LIST"] = "filterSingleList";
|
|
13
14
|
VemType["FILTER_DATE"] = "filterDate";
|
|
14
15
|
VemType["CONTAINER"] = "container";
|
|
15
16
|
})(VemType || (exports.VemType = VemType = {}));
|
|
@@ -11,6 +11,7 @@ export interface ComparativeVirtualColumn {
|
|
|
11
11
|
deltaDataField?: string;
|
|
12
12
|
extraDeltaDataFields?: string[];
|
|
13
13
|
}
|
|
14
|
+
export declare function isNullDateOperator(operator: any): boolean;
|
|
14
15
|
export declare function formatPeriodLabel(period: any, allDatesText: string): string;
|
|
15
16
|
export declare function formatComparativePeriodCaption(period: any, allDatesText: string, colLabel?: string): string;
|
|
16
17
|
export declare function formatDeltaDefaultCaption(referencePeriod: any, compareTo: any, allDatesText: string, colLabel?: string): string;
|
|
@@ -60,7 +60,13 @@ export function resolveComparativeColumnCaption(chartModel, columnKey, allDatesT
|
|
|
60
60
|
return formatDeltaColumnCaption(customLabels[dataFieldKey]);
|
|
61
61
|
return formatDeltaDefaultCaption(comparativeAnalisis.referencePeriod, comparativeAnalisis.compareTo, fallbackAllDates, defaultName);
|
|
62
62
|
}
|
|
63
|
+
export function isNullDateOperator(operator) {
|
|
64
|
+
const id = String(operator?.label ?? operator?.key ?? "").toUpperCase();
|
|
65
|
+
return id === "IS_NULL" || id === "IS_NOT_NULL";
|
|
66
|
+
}
|
|
63
67
|
export function formatPeriodLabel(period, allDatesText) {
|
|
68
|
+
if (isNullDateOperator(period?.operator))
|
|
69
|
+
return period.operator.text || allDatesText;
|
|
64
70
|
if (period?.customLabel)
|
|
65
71
|
return period.customLabel;
|
|
66
72
|
if (!period?.date1)
|
|
@@ -304,7 +310,7 @@ export function buildComparativeChartComparison(myBus, chart, groups) {
|
|
|
304
310
|
if (!periodData || !periodData.operator)
|
|
305
311
|
return null;
|
|
306
312
|
const operatorLabel = periodData.operator.label;
|
|
307
|
-
const isNullType =
|
|
313
|
+
const isNullType = isNullDateOperator(periodData.operator);
|
|
308
314
|
if (!isNullType && !periodData.date1)
|
|
309
315
|
return null;
|
|
310
316
|
const validationType = mapOperatorToValidationType(operatorLabel);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CanvasDevice, } from "../../../interfaces/ICanvasGrid";
|
|
2
2
|
import { VemPositionType, } from "../../../interfaces/IVemPosition";
|
|
3
3
|
import { setElementPosition } from "../../../utils/position";
|
|
4
|
-
import { DEVICE_LIST } from "../constants/vem.constants";
|
|
4
|
+
import { DEFAULT_HEIGHT_IN_FIXED, DEFAULT_HEIGHT_IN_RESPONSIVE, DEFAULT_WIDTH_IN_FIXED, DEFAULT_WIDTH_IN_RESPONSIVE, DEVICE_LIST, } from "../constants/vem.constants";
|
|
5
5
|
import { ANALYTICS_ITEM_DEFINITION, BUTTON_ITEM_DEFINITION, CONTAINER_ITEM_DEFINITION, FILTER_DATE_ITEM_DEFINITION, FILTER_INPUT_ITEM_DEFINITION, FILTER_LIST_ITEM_DEFINITION, IMAGE_ITEM_DEFINITION, TEXT_ITEM_DEFINITION, } from "../definitions/main.definitions";
|
|
6
6
|
export const VEM_DEFINITIONS = {
|
|
7
7
|
image: IMAGE_ITEM_DEFINITION,
|
|
@@ -11,8 +11,19 @@ export const VEM_DEFINITIONS = {
|
|
|
11
11
|
filterInput: FILTER_INPUT_ITEM_DEFINITION,
|
|
12
12
|
filterDate: FILTER_DATE_ITEM_DEFINITION,
|
|
13
13
|
filterList: FILTER_LIST_ITEM_DEFINITION,
|
|
14
|
+
filterSingleList: FILTER_LIST_ITEM_DEFINITION,
|
|
14
15
|
container: CONTAINER_ITEM_DEFINITION,
|
|
15
16
|
};
|
|
17
|
+
const UNREGISTERED_TYPE_SIZE = {
|
|
18
|
+
[VemPositionType.FIXED]: {
|
|
19
|
+
height: DEFAULT_HEIGHT_IN_FIXED,
|
|
20
|
+
width: DEFAULT_WIDTH_IN_FIXED,
|
|
21
|
+
},
|
|
22
|
+
[VemPositionType.RESPONSIVE]: {
|
|
23
|
+
height: DEFAULT_HEIGHT_IN_RESPONSIVE,
|
|
24
|
+
width: DEFAULT_WIDTH_IN_RESPONSIVE,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
16
27
|
export const updateDimension = (element, canvasConfig, positionType, deviceList = DEVICE_LIST) => {
|
|
17
28
|
const position = getDefaultDimensions(element, positionType);
|
|
18
29
|
let newElement = element;
|
|
@@ -36,8 +47,10 @@ export const updateDimension = (element, canvasConfig, positionType, deviceList
|
|
|
36
47
|
};
|
|
37
48
|
const normalizeSize = (item, positionType) => {
|
|
38
49
|
const vemDefinition = VEM_DEFINITIONS[item.type];
|
|
50
|
+
if (!vemDefinition)
|
|
51
|
+
return UNREGISTERED_TYPE_SIZE[positionType];
|
|
39
52
|
const rawSize = vemDefinition.behavior.addingConfig.defaultDimensions[positionType];
|
|
40
|
-
const customSizeResolver = vemDefinition
|
|
53
|
+
const customSizeResolver = vemDefinition.behavior.addingConfig.minSize?.[positionType]?.customSize;
|
|
41
54
|
const baseHeight = "height" in rawSize ? rawSize.height : rawSize.rowSpan;
|
|
42
55
|
const baseWidth = "width" in rawSize ? rawSize.width : rawSize.colSpan;
|
|
43
56
|
if (!customSizeResolver)
|
|
@@ -7,6 +7,7 @@ export var VemType;
|
|
|
7
7
|
VemType["ANALYTICS"] = "analytics";
|
|
8
8
|
VemType["FILTER_INPUT"] = "filterInput";
|
|
9
9
|
VemType["FILTER_LIST"] = "filterList";
|
|
10
|
+
VemType["FILTER_SINGLE_LIST"] = "filterSingleList";
|
|
10
11
|
VemType["FILTER_DATE"] = "filterDate";
|
|
11
12
|
VemType["CONTAINER"] = "container";
|
|
12
13
|
})(VemType || (VemType = {}));
|