@qrvey/utils 1.15.0-9 → 1.16.0-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.
- package/dist/cjs/columns/constants/COLUMN_ICON.js +32 -32
- package/dist/cjs/columns/helpers/index.d.ts +1 -0
- package/dist/cjs/columns/helpers/index.js +1 -0
- package/dist/cjs/columns/helpers/isNumericalColumn.d.ts +1 -1
- package/dist/cjs/columns/helpers/isNumericalColumn.js +1 -1
- package/dist/cjs/columns/helpers/isStringColumn.d.ts +7 -0
- package/dist/cjs/columns/helpers/isStringColumn.js +19 -0
- package/dist/cjs/dates/constants/DATE_DISTINCT_PROPERTY.d.ts +2 -1
- package/dist/cjs/dates/constants/DATE_DISTINCT_PROPERTY.js +1 -0
- package/dist/cjs/dates/relative/RelativeStatementAdapter.js +2 -1
- package/dist/cjs/elements/helpers/fixed.d.ts +96 -0
- package/dist/cjs/elements/helpers/fixed.js +248 -0
- package/dist/cjs/elements/helpers/gridStrategy.d.ts +29 -0
- package/dist/cjs/elements/helpers/gridStrategy.js +83 -0
- package/dist/cjs/elements/helpers/index.d.ts +3 -0
- package/dist/cjs/elements/helpers/index.js +22 -0
- package/dist/cjs/elements/helpers/responsive.d.ts +87 -0
- package/dist/cjs/elements/helpers/responsive.js +166 -0
- package/dist/cjs/elements/index.d.ts +2 -0
- package/dist/cjs/elements/index.js +18 -0
- package/dist/cjs/elements/interfaces/ICanvasGrid.d.ts +5 -0
- package/dist/cjs/elements/interfaces/ICanvasGrid.js +9 -0
- package/dist/cjs/elements/interfaces/IFixedPosition.d.ts +5 -0
- package/dist/cjs/elements/interfaces/IFixedPosition.js +2 -0
- package/dist/cjs/elements/interfaces/IVemCore.d.ts +29 -0
- package/dist/cjs/elements/interfaces/IVemCore.js +3 -0
- package/dist/cjs/elements/interfaces/IVemPosition.d.ts +44 -0
- package/dist/cjs/elements/interfaces/IVemPosition.js +8 -0
- package/dist/cjs/elements/interfaces/index.d.ts +4 -0
- package/dist/cjs/elements/interfaces/index.js +20 -0
- package/dist/cjs/elements/utils/element.d.ts +4 -0
- package/dist/cjs/elements/utils/element.js +28 -0
- package/dist/cjs/elements/utils/fixed.position.d.ts +12 -0
- package/dist/cjs/elements/utils/fixed.position.js +86 -0
- package/dist/cjs/elements/utils/general.d.ts +15 -0
- package/dist/cjs/elements/utils/general.js +20 -0
- package/dist/cjs/elements/utils/overlap.d.ts +63 -0
- package/dist/cjs/elements/utils/overlap.js +99 -0
- package/dist/cjs/elements/utils/position.d.ts +4 -0
- package/dist/cjs/elements/utils/position.js +5 -0
- package/dist/cjs/filters/adapters/FDToLogic.js +2 -1
- package/dist/cjs/filters/helpers/backend/buildExpression.js +1 -0
- package/dist/cjs/filters/helpers/backend/buildFilters.d.ts +5 -0
- package/dist/cjs/filters/helpers/backend/buildFilters.js +23 -1
- package/dist/cjs/filters/helpers/backend/getBackendValues.js +4 -1
- package/dist/cjs/filters/helpers/getAvailableScopesIDsByConfig.js +1 -0
- package/dist/cjs/filters/interfaces/backend/IFBExpression.js +0 -1
- package/dist/cjs/general/array/getUniqueSimpleArray.d.ts +6 -0
- package/dist/cjs/general/array/getUniqueSimpleArray.js +14 -0
- package/dist/cjs/general/array/index.d.ts +1 -0
- package/dist/cjs/general/array/index.js +1 -0
- package/dist/cjs/general/string/index.d.ts +4 -0
- package/dist/cjs/general/string/index.js +4 -0
- package/dist/cjs/general/string/secureHTML.d.ts +8 -0
- package/dist/cjs/general/string/secureHTML.js +13 -0
- package/dist/cjs/general/string/strategies/XSSEstrictedSanitizer.d.ts +8 -0
- package/dist/cjs/general/string/strategies/XSSEstrictedSanitizer.js +23 -0
- package/dist/cjs/general/string/strategies/XSSSanitizer.d.ts +8 -0
- package/dist/cjs/general/string/strategies/XSSSanitizer.js +19 -0
- package/dist/cjs/general/string/urlValidator.d.ts +10 -0
- package/dist/cjs/general/string/urlValidator.js +38 -0
- package/dist/cjs/globalization/helpers/getI18nDateGroupLabel.d.ts +6 -0
- package/dist/cjs/globalization/helpers/getI18nDateGroupLabel.js +120 -0
- package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilderSorting.d.ts +2 -0
- package/dist/cjs/globalization/interfaces/export/II18nExportingModal.d.ts +6 -0
- package/dist/cjs/globalization/interfaces/export/II18nExportingModalApplyButtonLabel.d.ts +1 -0
- package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_GENERAL_OPTIONS.js +2 -0
- package/dist/cjs/globalization/labels/export/I18N_EXPORT_MODAL.js +10 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/interfaces/SatinizerStrategy.d.ts +3 -0
- package/dist/cjs/interfaces/SatinizerStrategy.js +2 -0
- package/dist/cjs/themes/constants/AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_LIGHT.js +3 -3
- package/dist/columns/constants/COLUMN_ICON.js +32 -32
- package/dist/columns/helpers/index.d.ts +1 -0
- package/dist/columns/helpers/index.js +1 -0
- package/dist/columns/helpers/isNumericalColumn.d.ts +1 -1
- package/dist/columns/helpers/isNumericalColumn.js +1 -1
- package/dist/columns/helpers/isStringColumn.d.ts +7 -0
- package/dist/columns/helpers/isStringColumn.js +15 -0
- package/dist/dates/constants/DATE_DISTINCT_PROPERTY.d.ts +2 -1
- package/dist/dates/constants/DATE_DISTINCT_PROPERTY.js +1 -0
- package/dist/dates/relative/RelativeStatementAdapter.js +2 -1
- package/dist/elements/helpers/fixed.d.ts +96 -0
- package/dist/elements/helpers/fixed.js +236 -0
- package/dist/elements/helpers/gridStrategy.d.ts +29 -0
- package/dist/elements/helpers/gridStrategy.js +78 -0
- package/dist/elements/helpers/index.d.ts +3 -0
- package/dist/elements/helpers/index.js +3 -0
- package/dist/elements/helpers/responsive.d.ts +87 -0
- package/dist/elements/helpers/responsive.js +155 -0
- package/dist/elements/index.d.ts +2 -0
- package/dist/elements/index.js +2 -0
- package/dist/elements/interfaces/ICanvasGrid.d.ts +5 -0
- package/dist/elements/interfaces/ICanvasGrid.js +6 -0
- package/dist/elements/interfaces/IFixedPosition.d.ts +5 -0
- package/dist/elements/interfaces/IFixedPosition.js +1 -0
- package/dist/elements/interfaces/IVemCore.d.ts +29 -0
- package/dist/elements/interfaces/IVemCore.js +1 -0
- package/dist/elements/interfaces/IVemPosition.d.ts +44 -0
- package/dist/elements/interfaces/IVemPosition.js +5 -0
- package/dist/elements/interfaces/index.d.ts +4 -0
- package/dist/elements/interfaces/index.js +4 -0
- package/dist/elements/utils/element.d.ts +4 -0
- package/dist/elements/utils/element.js +24 -0
- package/dist/elements/utils/fixed.position.d.ts +12 -0
- package/dist/elements/utils/fixed.position.js +72 -0
- package/dist/elements/utils/general.d.ts +15 -0
- package/dist/elements/utils/general.js +16 -0
- package/dist/elements/utils/overlap.d.ts +63 -0
- package/dist/elements/utils/overlap.js +95 -0
- package/dist/elements/utils/position.d.ts +4 -0
- package/dist/elements/utils/position.js +1 -0
- package/dist/filters/adapters/FDToLogic.js +2 -1
- package/dist/filters/helpers/backend/buildExpression.js +1 -0
- package/dist/filters/helpers/backend/buildFilters.d.ts +5 -0
- package/dist/filters/helpers/backend/buildFilters.js +23 -1
- package/dist/filters/helpers/backend/getBackendValues.js +4 -1
- package/dist/filters/helpers/getAvailableScopesIDsByConfig.js +1 -0
- package/dist/filters/interfaces/backend/IFBExpression.js +0 -1
- package/dist/general/array/getUniqueSimpleArray.d.ts +6 -0
- package/dist/general/array/getUniqueSimpleArray.js +10 -0
- package/dist/general/array/index.d.ts +1 -0
- package/dist/general/array/index.js +1 -0
- package/dist/general/string/index.d.ts +4 -0
- package/dist/general/string/index.js +4 -0
- package/dist/general/string/secureHTML.d.ts +8 -0
- package/dist/general/string/secureHTML.js +9 -0
- package/dist/general/string/strategies/XSSEstrictedSanitizer.d.ts +8 -0
- package/dist/general/string/strategies/XSSEstrictedSanitizer.js +19 -0
- package/dist/general/string/strategies/XSSSanitizer.d.ts +8 -0
- package/dist/general/string/strategies/XSSSanitizer.js +15 -0
- package/dist/general/string/urlValidator.d.ts +10 -0
- package/dist/general/string/urlValidator.js +34 -0
- package/dist/globalization/helpers/getI18nDateGroupLabel.d.ts +6 -0
- package/dist/globalization/helpers/getI18nDateGroupLabel.js +120 -0
- package/dist/globalization/interfaces/chart_builder/II18nChartBuilderSorting.d.ts +2 -0
- package/dist/globalization/interfaces/export/II18nExportingModal.d.ts +6 -0
- package/dist/globalization/interfaces/export/II18nExportingModalApplyButtonLabel.d.ts +1 -0
- package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_GENERAL_OPTIONS.js +2 -0
- package/dist/globalization/labels/export/I18N_EXPORT_MODAL.js +10 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/interfaces/SatinizerStrategy.d.ts +3 -0
- package/dist/interfaces/SatinizerStrategy.js +1 -0
- package/dist/themes/constants/AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_LIGHT.js +3 -3
- package/package.json +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { VemPositionType, } from "./IVemPosition";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export interface VemSizeFixed {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
}
|
|
5
|
+
export interface VemSizeResponsive {
|
|
6
|
+
colSpan: number;
|
|
7
|
+
rowSpan: number;
|
|
8
|
+
}
|
|
9
|
+
export interface VemPositionFixed extends VemSizeFixed {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
z: number;
|
|
13
|
+
}
|
|
14
|
+
export interface VemPositionResponsive extends VemSizeResponsive {
|
|
15
|
+
colStart: number;
|
|
16
|
+
rowStart: number;
|
|
17
|
+
}
|
|
18
|
+
export type VemPosition = VemPositionFixed | VemPositionResponsive;
|
|
19
|
+
export interface VemPositionMap {
|
|
20
|
+
[VemPositionType.FIXED]: VemPositionFixed;
|
|
21
|
+
[VemPositionType.RESPONSIVE]: VemPositionResponsive;
|
|
22
|
+
}
|
|
23
|
+
export declare enum VemPositionType {
|
|
24
|
+
FIXED = "fixed",
|
|
25
|
+
RESPONSIVE = "responsive"
|
|
26
|
+
}
|
|
27
|
+
interface VemPositionBase<TPosition extends VemPosition> {
|
|
28
|
+
desktop: TPosition;
|
|
29
|
+
tablet?: TPosition;
|
|
30
|
+
mobile?: TPosition;
|
|
31
|
+
}
|
|
32
|
+
export type VemPositionConfigFixed = VemPositionBase<VemPositionFixed>;
|
|
33
|
+
export type VemPositionConfigResponsive = VemPositionBase<VemPositionResponsive>;
|
|
34
|
+
export type VemPositionConfig = VemPositionConfigFixed | VemPositionConfigResponsive;
|
|
35
|
+
export interface VemPositionConfigMap {
|
|
36
|
+
[VemPositionType.FIXED]: VemPositionConfigFixed;
|
|
37
|
+
[VemPositionType.RESPONSIVE]: VemPositionConfigResponsive;
|
|
38
|
+
}
|
|
39
|
+
export type VemSize = VemSizeFixed | VemSizeResponsive;
|
|
40
|
+
export interface VemSizeConfig {
|
|
41
|
+
[VemPositionType.FIXED]: VemSizeFixed;
|
|
42
|
+
[VemPositionType.RESPONSIVE]: VemSizeResponsive;
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CanvasDevice } from "../interfaces/ICanvasGrid";
|
|
2
|
+
import { Vem } from "../interfaces/IVemCore";
|
|
3
|
+
import { VemPositionType } from "../interfaces/IVemPosition";
|
|
4
|
+
export declare const copyDesktopPositionToDevice: (elements: Vem[], newCanvasDevice: CanvasDevice, canvasType: VemPositionType) => Vem[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { setElementPosition } from "./position";
|
|
2
|
+
import { CanvasDevice } from "../interfaces/ICanvasGrid";
|
|
3
|
+
import { VemPositionType, } from "../interfaces/IVemPosition";
|
|
4
|
+
export const copyDesktopPositionToDevice = (elements, newCanvasDevice, canvasType) => {
|
|
5
|
+
const defaultPositionMap = {
|
|
6
|
+
[VemPositionType.FIXED]: {
|
|
7
|
+
x: 0,
|
|
8
|
+
y: 0,
|
|
9
|
+
},
|
|
10
|
+
[VemPositionType.RESPONSIVE]: {
|
|
11
|
+
colStart: 1,
|
|
12
|
+
rowStart: 1,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
return elements.map((element) => {
|
|
16
|
+
var _a;
|
|
17
|
+
if (!((_a = element.position[canvasType]) === null || _a === void 0 ? void 0 : _a[newCanvasDevice])) {
|
|
18
|
+
const desktopViewPosition = element.position[canvasType][CanvasDevice.DESKTOP];
|
|
19
|
+
const newDevicePosition = Object.assign(Object.assign(Object.assign({}, desktopViewPosition), defaultPositionMap[canvasType]), { preCalculated: true });
|
|
20
|
+
return setElementPosition(element, canvasType, newCanvasDevice, newDevicePosition);
|
|
21
|
+
}
|
|
22
|
+
return element;
|
|
23
|
+
});
|
|
24
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CanvasDevice, VemFixed, VemPositionFixed } from "../interfaces";
|
|
2
|
+
export declare const hasOverflow: (element: VemFixed, device: CanvasDevice, resolution: number, canvasHeight?: number) => boolean;
|
|
3
|
+
export declare const hasOverlap: (element: VemFixed, elements: VemFixed[], device: CanvasDevice) => number;
|
|
4
|
+
export declare const itemXOverflow: (item: VemFixed, device: CanvasDevice, resolution: number) => boolean;
|
|
5
|
+
export declare const itemYOverflow: (item: VemFixed, device: CanvasDevice, canvasHeight: number) => boolean;
|
|
6
|
+
export declare const checkFixedGridItemsOverlap: (item: VemPositionFixed, itemToCompare: VemPositionFixed) => boolean;
|
|
7
|
+
export declare const dxGetFixedGridItemDevice: (element: VemFixed, device: CanvasDevice) => VemPositionFixed;
|
|
8
|
+
export declare const dxGetFixedGridItemX: (element: VemFixed, device: CanvasDevice, allowNegative?: boolean) => number;
|
|
9
|
+
export declare const dxGetFixedGridItemY: (element: VemFixed, device: CanvasDevice, allowNegative?: boolean) => number;
|
|
10
|
+
export declare const dxGetFixedGridItemZ: (element: VemFixed, device: CanvasDevice) => number;
|
|
11
|
+
export declare const dxGetFixedGridItemHeight: (element: VemFixed, device: CanvasDevice) => number;
|
|
12
|
+
export declare const dxGetFixedGridItemWidth: (element: VemFixed, device: CanvasDevice) => number;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export const hasOverflow = (element, device, resolution, canvasHeight) => {
|
|
2
|
+
const hasXOverflow = itemXOverflow(element, device, resolution);
|
|
3
|
+
const hasYOverflow = canvasHeight
|
|
4
|
+
? itemYOverflow(element, device, canvasHeight)
|
|
5
|
+
: false;
|
|
6
|
+
return hasXOverflow || hasYOverflow;
|
|
7
|
+
};
|
|
8
|
+
export const hasOverlap = (element, elements, device) => {
|
|
9
|
+
const elementPosition = element.position.fixed[device];
|
|
10
|
+
if (!elementPosition)
|
|
11
|
+
return;
|
|
12
|
+
const overlappingElements = elements.filter((cElement) => checkFixedGridItemsOverlap(elementPosition, cElement.position.fixed[device]));
|
|
13
|
+
return overlappingElements.length;
|
|
14
|
+
};
|
|
15
|
+
export const itemXOverflow = (item, device, resolution) => {
|
|
16
|
+
const fixedPosition = item.position.fixed;
|
|
17
|
+
return (!!fixedPosition[device] &&
|
|
18
|
+
fixedPosition[device].x + fixedPosition[device].width > resolution);
|
|
19
|
+
};
|
|
20
|
+
export const itemYOverflow = (item, device, canvasHeight) => {
|
|
21
|
+
const fixedPosition = item.position.fixed;
|
|
22
|
+
return (!!fixedPosition[device] &&
|
|
23
|
+
fixedPosition[device].y + fixedPosition[device].height > canvasHeight);
|
|
24
|
+
};
|
|
25
|
+
export const checkFixedGridItemsOverlap = (item, itemToCompare) => {
|
|
26
|
+
return !(item.x + item.width < itemToCompare.x ||
|
|
27
|
+
item.x > itemToCompare.x + itemToCompare.width ||
|
|
28
|
+
item.y + item.height < itemToCompare.y ||
|
|
29
|
+
item.y > itemToCompare.y + itemToCompare.height);
|
|
30
|
+
};
|
|
31
|
+
export const dxGetFixedGridItemDevice = (element, device) => {
|
|
32
|
+
return {
|
|
33
|
+
x: dxGetFixedGridItemX(element, device),
|
|
34
|
+
y: dxGetFixedGridItemY(element, device),
|
|
35
|
+
z: dxGetFixedGridItemZ(element, device),
|
|
36
|
+
height: dxGetFixedGridItemHeight(element, device),
|
|
37
|
+
width: dxGetFixedGridItemWidth(element, device),
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export const dxGetFixedGridItemX = (element, device, allowNegative = false) => {
|
|
41
|
+
var _a;
|
|
42
|
+
const position = element.position.fixed[device];
|
|
43
|
+
const itemX = (_a = position === null || position === void 0 ? void 0 : position.x) !== null && _a !== void 0 ? _a : 0;
|
|
44
|
+
if (!allowNegative) {
|
|
45
|
+
return itemX >= 0 ? itemX : 0;
|
|
46
|
+
}
|
|
47
|
+
return itemX;
|
|
48
|
+
};
|
|
49
|
+
export const dxGetFixedGridItemY = (element, device, allowNegative = false) => {
|
|
50
|
+
var _a;
|
|
51
|
+
const position = element.position.fixed[device];
|
|
52
|
+
const itemY = (_a = position === null || position === void 0 ? void 0 : position.y) !== null && _a !== void 0 ? _a : 0;
|
|
53
|
+
if (!allowNegative) {
|
|
54
|
+
return itemY >= 0 ? itemY : 0;
|
|
55
|
+
}
|
|
56
|
+
return itemY;
|
|
57
|
+
};
|
|
58
|
+
export const dxGetFixedGridItemZ = (element, device) => {
|
|
59
|
+
var _a;
|
|
60
|
+
const position = element.position.fixed[device];
|
|
61
|
+
return (_a = position === null || position === void 0 ? void 0 : position.z) !== null && _a !== void 0 ? _a : 1;
|
|
62
|
+
};
|
|
63
|
+
export const dxGetFixedGridItemHeight = (element, device) => {
|
|
64
|
+
var _a;
|
|
65
|
+
const position = element.position.fixed[device];
|
|
66
|
+
return (_a = position === null || position === void 0 ? void 0 : position.height) !== null && _a !== void 0 ? _a : 400;
|
|
67
|
+
};
|
|
68
|
+
export const dxGetFixedGridItemWidth = (element, device) => {
|
|
69
|
+
var _a;
|
|
70
|
+
const position = element.position.fixed[device];
|
|
71
|
+
return (_a = position === null || position === void 0 ? void 0 : position.width) !== null && _a !== void 0 ? _a : 400;
|
|
72
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compares two objects based on their `distance` property and determines their relative order.
|
|
3
|
+
* @param a - An object with a `distance` property (number).
|
|
4
|
+
* @param b - Another object with a `distance` property (number).
|
|
5
|
+
* @param a.distance
|
|
6
|
+
* @param b.distance
|
|
7
|
+
* @returns - A negative number if `a` has a smaller distance than `b`,
|
|
8
|
+
* a positive number if `a` has a larger distance than `b`,
|
|
9
|
+
* or 0 if both have equal distances.
|
|
10
|
+
*/
|
|
11
|
+
export declare const sortByDistanceFunction: (a: {
|
|
12
|
+
distance: number;
|
|
13
|
+
}, b: {
|
|
14
|
+
distance: number;
|
|
15
|
+
}) => 0 | 1 | -1;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compares two objects based on their `distance` property and determines their relative order.
|
|
3
|
+
* @param a - An object with a `distance` property (number).
|
|
4
|
+
* @param b - Another object with a `distance` property (number).
|
|
5
|
+
* @param a.distance
|
|
6
|
+
* @param b.distance
|
|
7
|
+
* @returns - A negative number if `a` has a smaller distance than `b`,
|
|
8
|
+
* a positive number if `a` has a larger distance than `b`,
|
|
9
|
+
* or 0 if both have equal distances.
|
|
10
|
+
*/
|
|
11
|
+
export const sortByDistanceFunction = (a, b) => {
|
|
12
|
+
if (a.distance === b.distance) {
|
|
13
|
+
return 0;
|
|
14
|
+
}
|
|
15
|
+
return a.distance < b.distance ? -1 : 1;
|
|
16
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
interface OverlapNode {
|
|
2
|
+
startX: number;
|
|
3
|
+
endX: number;
|
|
4
|
+
startY: number;
|
|
5
|
+
endY: number;
|
|
6
|
+
maxEndX: number;
|
|
7
|
+
maxEndY: number;
|
|
8
|
+
left?: OverlapNode;
|
|
9
|
+
right?: OverlapNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
export declare class OverlapIntervalTree {
|
|
15
|
+
root?: OverlapNode;
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
constructor();
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @param startX
|
|
23
|
+
* @param endX
|
|
24
|
+
* @param startY
|
|
25
|
+
* @param endY
|
|
26
|
+
*/
|
|
27
|
+
insert(startX: number, endX: number, startY: number, endY: number): void;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param startX
|
|
31
|
+
* @param endX
|
|
32
|
+
* @param startY
|
|
33
|
+
* @param endY
|
|
34
|
+
*/
|
|
35
|
+
private _initNode;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @param node
|
|
39
|
+
* @param startX
|
|
40
|
+
* @param endX
|
|
41
|
+
* @param startY
|
|
42
|
+
* @param endY
|
|
43
|
+
*/
|
|
44
|
+
private _insert;
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @param startX
|
|
48
|
+
* @param endX
|
|
49
|
+
* @param startY
|
|
50
|
+
* @param endY
|
|
51
|
+
*/
|
|
52
|
+
overlaps(startX: number, endX: number, startY: number, endY: number): boolean;
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* @param node
|
|
56
|
+
* @param startX
|
|
57
|
+
* @param endX
|
|
58
|
+
* @param startY
|
|
59
|
+
* @param endY
|
|
60
|
+
*/
|
|
61
|
+
private _overlaps;
|
|
62
|
+
}
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
*/
|
|
4
|
+
export class OverlapIntervalTree {
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
constructor() {
|
|
9
|
+
this.root = undefined;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param startX
|
|
14
|
+
* @param endX
|
|
15
|
+
* @param startY
|
|
16
|
+
* @param endY
|
|
17
|
+
*/
|
|
18
|
+
insert(startX, endX, startY, endY) {
|
|
19
|
+
this.root = this._insert(this.root, startX, endX, startY, endY);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param startX
|
|
24
|
+
* @param endX
|
|
25
|
+
* @param startY
|
|
26
|
+
* @param endY
|
|
27
|
+
*/
|
|
28
|
+
_initNode(startX, endX, startY, endY) {
|
|
29
|
+
return {
|
|
30
|
+
startX,
|
|
31
|
+
endX,
|
|
32
|
+
startY,
|
|
33
|
+
endY,
|
|
34
|
+
maxEndX: endX,
|
|
35
|
+
maxEndY: endY,
|
|
36
|
+
left: undefined,
|
|
37
|
+
right: undefined,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @param node
|
|
43
|
+
* @param startX
|
|
44
|
+
* @param endX
|
|
45
|
+
* @param startY
|
|
46
|
+
* @param endY
|
|
47
|
+
*/
|
|
48
|
+
_insert(node, startX, endX, startY, endY) {
|
|
49
|
+
if (node === undefined) {
|
|
50
|
+
return this._initNode(startX, endX, startY, endY);
|
|
51
|
+
}
|
|
52
|
+
if (startY < node.startY) {
|
|
53
|
+
node.left = this._insert(node.left, startX, endX, startY, endY);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
node.right = this._insert(node.right, startX, endX, startY, endY);
|
|
57
|
+
}
|
|
58
|
+
node.maxEndX = Math.max(node.maxEndX, endX);
|
|
59
|
+
node.maxEndY = Math.max(node.maxEndY, endY);
|
|
60
|
+
return node;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
*
|
|
64
|
+
* @param startX
|
|
65
|
+
* @param endX
|
|
66
|
+
* @param startY
|
|
67
|
+
* @param endY
|
|
68
|
+
*/
|
|
69
|
+
overlaps(startX, endX, startY, endY) {
|
|
70
|
+
return this._overlaps(this.root, startX, endX, startY, endY);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
*
|
|
74
|
+
* @param node
|
|
75
|
+
* @param startX
|
|
76
|
+
* @param endX
|
|
77
|
+
* @param startY
|
|
78
|
+
* @param endY
|
|
79
|
+
*/
|
|
80
|
+
_overlaps(node, startX, endX, startY, endY) {
|
|
81
|
+
if (node === undefined) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
if (startX <= node.endX &&
|
|
85
|
+
endX >= node.startX &&
|
|
86
|
+
startY <= node.endY &&
|
|
87
|
+
endY >= node.startY) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
if (node.left !== undefined && node.left.maxEndY >= startY) {
|
|
91
|
+
return this._overlaps(node.left, startX, endX, startY, endY);
|
|
92
|
+
}
|
|
93
|
+
return this._overlaps(node.right, startX, endX, startY, endY);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CanvasDevice } from "../interfaces/ICanvasGrid";
|
|
2
|
+
import { Vem } from "../interfaces/IVemCore";
|
|
3
|
+
import { VemPosition, VemPositionType } from "../interfaces/IVemPosition";
|
|
4
|
+
export declare const setElementPosition: <T extends VemPositionType = VemPositionType>(baseElement: Vem<unknown, T>, type: T, device: CanvasDevice, position: VemPosition) => Vem<unknown, T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const setElementPosition = (baseElement, type, device, position) => (Object.assign(Object.assign({}, baseElement), { position: Object.assign(Object.assign({}, baseElement.position), { [type]: Object.assign(Object.assign({}, baseElement.position[type]), { [device]: position }) }) }));
|
|
@@ -34,7 +34,8 @@ function getLogicBodyFromFD21(filterData) {
|
|
|
34
34
|
filters = filters.concat(expressions);
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
if (!isEmpty(filters))
|
|
38
|
+
logics.push(Object.assign(Object.assign({}, logic), { filters }));
|
|
38
39
|
return logics;
|
|
39
40
|
}, []);
|
|
40
41
|
}
|
|
@@ -13,6 +13,7 @@ export function buildExpression(filter) {
|
|
|
13
13
|
const expression = {
|
|
14
14
|
groupValue: getBackendGroupValue(filter),
|
|
15
15
|
questionid: filter.column.id,
|
|
16
|
+
qrveyid: filter.column.qrveyid,
|
|
16
17
|
questionType: filter.column.type,
|
|
17
18
|
property: getBackendProperty(filter),
|
|
18
19
|
validationType: getBackendValidator(filter),
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { IFBFilter } from "../../interfaces/backend/IFBFilter";
|
|
2
2
|
import { IFSFilter } from "../../interfaces/common/IFSFilter";
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param filters
|
|
6
|
+
* @param groupColumns
|
|
7
|
+
*/
|
|
3
8
|
export declare function buildFilters(filters: IFSFilter[], groupColumns?: boolean): IFBFilter[];
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import { buildExpression } from "./buildExpression";
|
|
1
2
|
import { isEmpty } from "../../../general/mix/isEmpty";
|
|
2
3
|
import { _hasProperty } from "../../../general/object/hasProperty";
|
|
3
4
|
import { FILTER_OPERATOR } from "../../constants/common/FILTER_OPERATOR";
|
|
4
|
-
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param filters
|
|
8
|
+
* @param groupColumns
|
|
9
|
+
*/
|
|
5
10
|
export function buildFilters(filters, groupColumns = false) {
|
|
6
11
|
const expression = numericExpression(filters, groupColumns);
|
|
7
12
|
const orOperators = expression.split("+");
|
|
@@ -25,6 +30,8 @@ export function buildFilters(filters, groupColumns = false) {
|
|
|
25
30
|
return getColumnExpressions(group, getFilter);
|
|
26
31
|
})
|
|
27
32
|
.filter(Boolean);
|
|
33
|
+
if (isEmpty(expressions))
|
|
34
|
+
return [];
|
|
28
35
|
if (orOperators.length > 1) {
|
|
29
36
|
return [
|
|
30
37
|
{
|
|
@@ -38,6 +45,11 @@ export function buildFilters(filters, groupColumns = false) {
|
|
|
38
45
|
}
|
|
39
46
|
return [{ operator: FILTER_OPERATOR.AND, expressions }];
|
|
40
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @param group
|
|
51
|
+
* @param getFilter
|
|
52
|
+
*/
|
|
41
53
|
function getColumnExpressions(group, getFilter) {
|
|
42
54
|
const columnOrOperators = group.split("/");
|
|
43
55
|
if (columnOrOperators.length > 1) {
|
|
@@ -50,12 +62,22 @@ function getColumnExpressions(group, getFilter) {
|
|
|
50
62
|
}
|
|
51
63
|
return getFilter(group);
|
|
52
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
* @param operator
|
|
68
|
+
* @param priority
|
|
69
|
+
*/
|
|
53
70
|
function logicToNumeric(operator, priority = false) {
|
|
54
71
|
if (operator === FILTER_OPERATOR.AND) {
|
|
55
72
|
return "*";
|
|
56
73
|
}
|
|
57
74
|
return priority ? "/" : "+";
|
|
58
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
*
|
|
78
|
+
* @param filters
|
|
79
|
+
* @param groupColumns
|
|
80
|
+
*/
|
|
59
81
|
function numericExpression(filters, groupColumns = false) {
|
|
60
82
|
let expression = "";
|
|
61
83
|
filters.forEach((item, index) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { COLUMN } from "../../../columns/constants/COLUMN";
|
|
2
2
|
import { flattenDeep } from "../../../general/array/flattenDeep";
|
|
3
|
+
import { isEmpty } from "../../../general/mix/isEmpty";
|
|
3
4
|
import { FILTER_VALIDATOR } from "../../constants/common/FILTER_VALIDATOR";
|
|
4
5
|
import { FILTER_VALIDATOR_INFO } from "../../constants/common/FILTER_VALIDATOR_INFO";
|
|
5
6
|
import { isRankingFilter } from "../common/isRankingFilter";
|
|
@@ -82,7 +83,9 @@ function getNullValues(values, filter) {
|
|
|
82
83
|
return addValue ? [FILTER_VALIDATOR_INFO[filter.validator].label] : [];
|
|
83
84
|
}
|
|
84
85
|
function getInValues(values) {
|
|
85
|
-
return values
|
|
86
|
+
return values
|
|
87
|
+
.map((value) => (Object.assign(Object.assign({}, getValue(value, value)), { anchor: isEmpty(value.anchor) ? undefined : value.anchor })))
|
|
88
|
+
.filter(Boolean);
|
|
86
89
|
}
|
|
87
90
|
function getValue(objectValue, value) {
|
|
88
91
|
return objectValue.enabled ? value : undefined;
|
|
@@ -12,5 +12,6 @@ export function getAvailableScopesIDsByConfig(config = {}) {
|
|
|
12
12
|
tabid: getAttribute(config, "tab_id") || config.tabid,
|
|
13
13
|
pageid: getAttribute(config, "page_id") || config.pageid,
|
|
14
14
|
defaultid: getAttribute(config, "default_id") || config.defaultid,
|
|
15
|
+
panelid: getAttribute(config, "panel_id") || config.panelid,
|
|
15
16
|
};
|
|
16
17
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get unique vaues from an Array of primitive JS types
|
|
3
|
+
* @param arr Array of primitive types
|
|
4
|
+
* @returns the new array with unique items
|
|
5
|
+
*/
|
|
6
|
+
export function getUniqueSimpleArray(arr) {
|
|
7
|
+
if (!Array.isArray(arr))
|
|
8
|
+
return arr;
|
|
9
|
+
return Array.from(new Set(arr));
|
|
10
|
+
}
|
|
@@ -5,6 +5,7 @@ export * from "./getArrayByProperty";
|
|
|
5
5
|
export * from "./filterNestedTree";
|
|
6
6
|
export * from "./getFirstIndexFromArray";
|
|
7
7
|
export * from "./getUniqueArray";
|
|
8
|
+
export * from "./getUniqueSimpleArray";
|
|
8
9
|
export * from "./howManyByParam";
|
|
9
10
|
export * from "./getLastIndexFromArray";
|
|
10
11
|
export * from "./intersectObjectArrays";
|
|
@@ -5,6 +5,7 @@ export * from "./getArrayByProperty";
|
|
|
5
5
|
export * from "./filterNestedTree";
|
|
6
6
|
export * from "./getFirstIndexFromArray";
|
|
7
7
|
export * from "./getUniqueArray";
|
|
8
|
+
export * from "./getUniqueSimpleArray";
|
|
8
9
|
export * from "./howManyByParam";
|
|
9
10
|
export * from "./getLastIndexFromArray";
|
|
10
11
|
export * from "./intersectObjectArrays";
|
|
@@ -2,3 +2,7 @@ export * from "./capitalize";
|
|
|
2
2
|
export * from "./padLeadingZeros";
|
|
3
3
|
export * from "./parseUrl";
|
|
4
4
|
export * from "./camelize";
|
|
5
|
+
export * from "./secureHTML";
|
|
6
|
+
export * from "./strategies/XSSSanitizer";
|
|
7
|
+
export * from "./strategies/XSSEstrictedSanitizer";
|
|
8
|
+
export * from "./urlValidator";
|
|
@@ -2,3 +2,7 @@ export * from "./capitalize";
|
|
|
2
2
|
export * from "./padLeadingZeros";
|
|
3
3
|
export * from "./parseUrl";
|
|
4
4
|
export * from "./camelize";
|
|
5
|
+
export * from "./secureHTML";
|
|
6
|
+
export * from "./strategies/XSSSanitizer";
|
|
7
|
+
export * from "./strategies/XSSEstrictedSanitizer";
|
|
8
|
+
export * from "./urlValidator";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SanitizerStrategy } from "../../interfaces/SatinizerStrategy";
|
|
2
|
+
/**
|
|
3
|
+
* Sanitizes HTML using the provided strategy.
|
|
4
|
+
* @param {string} html - HTML to sanitize.
|
|
5
|
+
* @param {SanitizerStrategy} sanitizer - Sanitization strategy.
|
|
6
|
+
* @returns {string} - Sanitized HTML.
|
|
7
|
+
*/
|
|
8
|
+
export declare const secureHTML: (html: string, sanitizer: SanitizerStrategy) => string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sanitizes HTML using the provided strategy.
|
|
3
|
+
* @param {string} html - HTML to sanitize.
|
|
4
|
+
* @param {SanitizerStrategy} sanitizer - Sanitization strategy.
|
|
5
|
+
* @returns {string} - Sanitized HTML.
|
|
6
|
+
*/
|
|
7
|
+
export const secureHTML = (html, sanitizer) => {
|
|
8
|
+
return sanitizer.sanitize(html);
|
|
9
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IFilterXSSOptions } from "xss";
|
|
2
|
+
import { SanitizerStrategy } from "../../../interfaces/SatinizerStrategy";
|
|
3
|
+
export declare class XSSEstrictedSanitizer implements SanitizerStrategy {
|
|
4
|
+
private attributesBlackList;
|
|
5
|
+
private options;
|
|
6
|
+
constructor(options?: IFilterXSSOptions, attributesBlackList?: string[]);
|
|
7
|
+
sanitize(html: string): string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { filterXSS } from "xss";
|
|
2
|
+
export class XSSEstrictedSanitizer {
|
|
3
|
+
constructor(options, attributesBlackList = []) {
|
|
4
|
+
this.attributesBlackList = attributesBlackList;
|
|
5
|
+
this.options = Object.assign({ css: false, onIgnoreTagAttr: (_tag, name, value) => {
|
|
6
|
+
if (this.attributesBlackList.includes(name)) {
|
|
7
|
+
return ""; // Elimina el atributo si está en la lista negra
|
|
8
|
+
}
|
|
9
|
+
return `${name}="${value}"`; // Mantiene el atributo si no está en la lista negra
|
|
10
|
+
}, onIgnoreTag: (tag, _html, _options) => {
|
|
11
|
+
if (["script", "iframe"].includes(tag)) {
|
|
12
|
+
return ""; // Elimina los <script>
|
|
13
|
+
}
|
|
14
|
+
}, escapeHtml: (str) => str }, options);
|
|
15
|
+
}
|
|
16
|
+
sanitize(html) {
|
|
17
|
+
return filterXSS(html, this.options);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IFilterXSSOptions } from "xss";
|
|
2
|
+
import { SanitizerStrategy } from "../../../interfaces/SatinizerStrategy";
|
|
3
|
+
export declare class XSSSanitizer implements SanitizerStrategy {
|
|
4
|
+
private attributesBlackList;
|
|
5
|
+
private options;
|
|
6
|
+
constructor(options?: IFilterXSSOptions, attributesBlackList?: string[]);
|
|
7
|
+
sanitize(html: string): string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { filterXSS } from "xss";
|
|
2
|
+
export class XSSSanitizer {
|
|
3
|
+
constructor(options, attributesBlackList = []) {
|
|
4
|
+
this.attributesBlackList = attributesBlackList;
|
|
5
|
+
this.options = Object.assign({ css: false, onIgnoreTagAttr: (tag, name, value) => {
|
|
6
|
+
if (!this.attributesBlackList.includes(name)) {
|
|
7
|
+
return `${name}="${value}"`;
|
|
8
|
+
}
|
|
9
|
+
return "";
|
|
10
|
+
} }, options);
|
|
11
|
+
}
|
|
12
|
+
sanitize(html) {
|
|
13
|
+
return filterXSS(html, this.options);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class URLValidator {
|
|
2
|
+
private validDomains;
|
|
3
|
+
private validProtocols;
|
|
4
|
+
constructor(domains?: string[], protocols?: string[]);
|
|
5
|
+
setValidDomains(domains?: string[]): this;
|
|
6
|
+
setValidProtocols(protocols?: string[]): this;
|
|
7
|
+
validate(url: string): boolean;
|
|
8
|
+
private isValidProtocol;
|
|
9
|
+
private isValidDomain;
|
|
10
|
+
}
|