@qrvey/utils 1.12.0 → 1.13.0-1
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 +2606 -2130
- package/dist/charts/adapters/endpointData.js +1 -1
- package/dist/charts/adapters/endpointDataGet.js +1 -1
- package/dist/cjs/charts/adapters/endpointData.js +1 -1
- package/dist/cjs/charts/adapters/endpointDataGet.js +1 -1
- package/dist/cjs/dates/adapters/dateToMonthYear.js +3 -1
- package/dist/cjs/dates/constants/INTL_DATE_FORMATS.d.ts +1 -0
- package/dist/cjs/dates/constants/INTL_DATE_FORMATS.js +8 -0
- package/dist/cjs/dates/constants/index.d.ts +1 -0
- package/dist/cjs/dates/constants/index.js +1 -0
- package/dist/cjs/dates/relative/RelativeStatementAdapter.d.ts +1 -1
- package/dist/cjs/dates/relative/RelativeStatementAdapter.js +2 -1
- package/dist/cjs/dates/relative/relative.d.ts +3 -4
- package/dist/cjs/dates/relative/relative.js +5 -9
- package/dist/cjs/filters/constants/common/FILTER_SCOPE.d.ts +7 -7
- package/dist/cjs/filters/services/Filters.api.js +4 -7
- package/dist/cjs/filters/services/UChartApi.d.ts +1 -1
- package/dist/cjs/filters/services/UChartApi.js +2 -1
- package/dist/cjs/filters/services/UChartPaginationApi.d.ts +1 -1
- package/dist/cjs/filters/services/UChartPaginationApi.js +2 -1
- package/dist/cjs/services/api/getAllQrveys.api.d.ts +1 -1
- package/dist/cjs/services/helpers/getDefaultQuestionListOptionsAttributes.js +7 -7
- package/dist/cjs/services/interfaces/IPayloadQrveyAll.d.ts +1 -1
- package/dist/cjs/themes/constants/CHANNEL_BLACK_COLOR.d.ts +5 -0
- package/dist/cjs/themes/constants/CHANNEL_BLACK_COLOR.js +12 -0
- package/dist/cjs/themes/constants/CHANNEL_WHITE_COLOR.d.ts +5 -0
- package/dist/cjs/themes/constants/CHANNEL_WHITE_COLOR.js +12 -0
- package/dist/cjs/themes/constants/COLOR_NAME.d.ts +154 -0
- package/dist/cjs/themes/constants/COLOR_NAME.js +157 -0
- package/dist/cjs/themes/constants/COLOR_TYPE.d.ts +3 -0
- package/dist/cjs/themes/constants/COLOR_TYPE.js +3 -0
- package/dist/cjs/themes/constants/CSS_VARIABLE_DESTINATION.d.ts +3 -0
- package/dist/cjs/themes/constants/CSS_VARIABLE_DESTINATION.js +3 -0
- package/dist/cjs/themes/constants/HEXADECIMAL_REGULAR_EXPRESSION.d.ts +3 -0
- package/dist/cjs/themes/constants/HEXADECIMAL_REGULAR_EXPRESSION.js +3 -0
- package/dist/cjs/themes/constants/RGBA_REGULAR_EXPRESION.d.ts +3 -0
- package/dist/cjs/themes/constants/RGBA_REGULAR_EXPRESION.js +3 -0
- package/dist/cjs/themes/constants/index.d.ts +4 -0
- package/dist/cjs/themes/constants/index.js +4 -0
- package/dist/cjs/themes/helpers/calculateHSP.d.ts +8 -0
- package/dist/cjs/themes/helpers/calculateHSP.js +20 -0
- package/dist/cjs/themes/helpers/getCSSVariablesByDestination.d.ts +1 -6
- package/dist/cjs/themes/helpers/getCSSVariablesByDestination.js +3 -0
- package/dist/cjs/themes/helpers/getChannelsByHexadecimalColor.d.ts +8 -0
- package/dist/cjs/themes/helpers/getChannelsByHexadecimalColor.js +26 -0
- package/dist/cjs/themes/helpers/getChannelsByNameColor.d.ts +8 -0
- package/dist/cjs/themes/helpers/getChannelsByNameColor.js +26 -0
- package/dist/cjs/themes/helpers/getChannelsByRgbaColor.d.ts +8 -0
- package/dist/cjs/themes/helpers/getChannelsByRgbaColor.js +25 -0
- package/dist/cjs/themes/helpers/getHexadecimalOpacity.d.ts +7 -0
- package/dist/cjs/themes/helpers/getHexadecimalOpacity.js +19 -0
- package/dist/cjs/themes/helpers/getRgbaOpacity.d.ts +7 -0
- package/dist/cjs/themes/helpers/getRgbaOpacity.js +21 -0
- package/dist/cjs/themes/helpers/index.d.ts +6 -1
- package/dist/cjs/themes/helpers/index.js +6 -1
- package/dist/cjs/themes/helpers/isHexadecimalColor.js +2 -1
- package/dist/cjs/themes/helpers/isRGBAColor.js +2 -1
- package/dist/cjs/themes/helpers/lightOrDark.js +14 -30
- package/dist/cjs/themes/helpers/setAutomaticCSSVariablesForDark.js +1 -1
- package/dist/cjs/themes/interfaces/IColorCSSVariableDestination.d.ts +3 -0
- package/dist/cjs/themes/interfaces/IColorChannel.d.ts +9 -0
- package/dist/cjs/themes/interfaces/IColorChannel.js +2 -0
- package/dist/cjs/themes/interfaces/IColorType.d.ts +3 -0
- package/dist/cjs/themes/interfaces/index.d.ts +1 -0
- package/dist/cjs/themes/interfaces/index.js +1 -0
- package/dist/dates/adapters/dateToMonthYear.js +3 -1
- package/dist/dates/constants/INTL_DATE_FORMATS.d.ts +1 -0
- package/dist/dates/constants/INTL_DATE_FORMATS.js +5 -0
- package/dist/dates/constants/index.d.ts +1 -0
- package/dist/dates/constants/index.js +1 -0
- package/dist/dates/relative/RelativeStatementAdapter.d.ts +1 -1
- package/dist/dates/relative/RelativeStatementAdapter.js +1 -1
- package/dist/dates/relative/relative.d.ts +3 -4
- package/dist/dates/relative/relative.js +4 -5
- package/dist/filters/constants/common/FILTER_SCOPE.d.ts +7 -7
- package/dist/filters/services/Filters.api.js +2 -2
- package/dist/filters/services/UChartApi.d.ts +1 -1
- package/dist/filters/services/UChartApi.js +1 -2
- package/dist/filters/services/UChartPaginationApi.d.ts +1 -1
- package/dist/filters/services/UChartPaginationApi.js +1 -2
- package/dist/services/api/getAllQrveys.api.d.ts +1 -1
- package/dist/services/helpers/getDefaultQuestionListOptionsAttributes.js +7 -7
- package/dist/services/interfaces/IPayloadQrveyAll.d.ts +1 -1
- package/dist/themes/constants/CHANNEL_BLACK_COLOR.d.ts +5 -0
- package/dist/themes/constants/CHANNEL_BLACK_COLOR.js +9 -0
- package/dist/themes/constants/CHANNEL_WHITE_COLOR.d.ts +5 -0
- package/dist/themes/constants/CHANNEL_WHITE_COLOR.js +9 -0
- package/dist/themes/constants/COLOR_NAME.d.ts +154 -0
- package/dist/themes/constants/COLOR_NAME.js +154 -0
- package/dist/themes/constants/COLOR_TYPE.d.ts +3 -0
- package/dist/themes/constants/COLOR_TYPE.js +3 -0
- package/dist/themes/constants/CSS_VARIABLE_DESTINATION.d.ts +3 -0
- package/dist/themes/constants/CSS_VARIABLE_DESTINATION.js +3 -0
- package/dist/themes/constants/HEXADECIMAL_REGULAR_EXPRESSION.d.ts +3 -0
- package/dist/themes/constants/HEXADECIMAL_REGULAR_EXPRESSION.js +3 -0
- package/dist/themes/constants/RGBA_REGULAR_EXPRESION.d.ts +3 -0
- package/dist/themes/constants/RGBA_REGULAR_EXPRESION.js +3 -0
- package/dist/themes/constants/index.d.ts +4 -0
- package/dist/themes/constants/index.js +4 -0
- package/dist/themes/helpers/calculateHSP.d.ts +8 -0
- package/dist/themes/helpers/calculateHSP.js +16 -0
- package/dist/themes/helpers/getCSSVariablesByDestination.d.ts +1 -6
- package/dist/themes/helpers/getCSSVariablesByDestination.js +3 -0
- package/dist/themes/helpers/getChannelsByHexadecimalColor.d.ts +8 -0
- package/dist/themes/helpers/getChannelsByHexadecimalColor.js +22 -0
- package/dist/themes/helpers/getChannelsByNameColor.d.ts +8 -0
- package/dist/themes/helpers/getChannelsByNameColor.js +22 -0
- package/dist/themes/helpers/getChannelsByRgbaColor.d.ts +8 -0
- package/dist/themes/helpers/getChannelsByRgbaColor.js +21 -0
- package/dist/themes/helpers/getHexadecimalOpacity.d.ts +7 -0
- package/dist/themes/helpers/getHexadecimalOpacity.js +15 -0
- package/dist/themes/helpers/getRgbaOpacity.d.ts +7 -0
- package/dist/themes/helpers/getRgbaOpacity.js +17 -0
- package/dist/themes/helpers/index.d.ts +6 -1
- package/dist/themes/helpers/index.js +6 -1
- package/dist/themes/helpers/isHexadecimalColor.js +2 -1
- package/dist/themes/helpers/isRGBAColor.js +2 -1
- package/dist/themes/helpers/lightOrDark.js +14 -30
- package/dist/themes/helpers/setAutomaticCSSVariablesForDark.js +1 -1
- package/dist/themes/interfaces/IColorCSSVariableDestination.d.ts +3 -0
- package/dist/themes/interfaces/IColorChannel.d.ts +9 -0
- package/dist/themes/interfaces/IColorChannel.js +1 -0
- package/dist/themes/interfaces/IColorType.d.ts +3 -0
- package/dist/themes/interfaces/index.d.ts +1 -0
- package/dist/themes/interfaces/index.js +1 -0
- package/package.json +20 -17
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CSS_VARIABLE_DESTINATION = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The Destination places to inject the css variables
|
|
6
|
+
*/
|
|
4
7
|
var CSS_VARIABLE_DESTINATION;
|
|
5
8
|
(function (CSS_VARIABLE_DESTINATION) {
|
|
6
9
|
CSS_VARIABLE_DESTINATION["CANVAS"] = "CANVAS";
|
|
@@ -3,6 +3,10 @@ export * from "./AUTOMATIC_CANVAS_CSS_VARIABLES_FOR_LIGHT";
|
|
|
3
3
|
export * from "./AUTOMATIC_CSS_VARIABLES";
|
|
4
4
|
export * from "./AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_DARK";
|
|
5
5
|
export * from "./AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_LIGHT";
|
|
6
|
+
export * from "./CANVAS_CSS_VARIABLES";
|
|
7
|
+
export * from "./CHANNEL_BLACK_COLOR";
|
|
8
|
+
export * from "./CHANNEL_WHITE_COLOR";
|
|
9
|
+
export * from "./COLOR_NAME";
|
|
6
10
|
export * from "./COLOR_TYPE";
|
|
7
11
|
export * from "./CSS_VARIABLE_DESTINATION";
|
|
8
12
|
export * from "./GLOBAL_CSS_VARIABLES";
|
|
@@ -19,6 +19,10 @@ __exportStar(require("./AUTOMATIC_CANVAS_CSS_VARIABLES_FOR_LIGHT"), exports);
|
|
|
19
19
|
__exportStar(require("./AUTOMATIC_CSS_VARIABLES"), exports);
|
|
20
20
|
__exportStar(require("./AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_DARK"), exports);
|
|
21
21
|
__exportStar(require("./AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_LIGHT"), exports);
|
|
22
|
+
__exportStar(require("./CANVAS_CSS_VARIABLES"), exports);
|
|
23
|
+
__exportStar(require("./CHANNEL_BLACK_COLOR"), exports);
|
|
24
|
+
__exportStar(require("./CHANNEL_WHITE_COLOR"), exports);
|
|
25
|
+
__exportStar(require("./COLOR_NAME"), exports);
|
|
22
26
|
__exportStar(require("./COLOR_TYPE"), exports);
|
|
23
27
|
__exportStar(require("./CSS_VARIABLE_DESTINATION"), exports);
|
|
24
28
|
__exportStar(require("./GLOBAL_CSS_VARIABLES"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IColorChannel } from "../interfaces/IColorChannel";
|
|
2
|
+
/**
|
|
3
|
+
* Calculates the HSP Color Mode from the RGBA channels
|
|
4
|
+
* - If the calculation are wrong or the given parameter is undefined, the function will return a default for light colors
|
|
5
|
+
* @param rgbaChannel the rgba channel object
|
|
6
|
+
* @returns a HSP color number
|
|
7
|
+
*/
|
|
8
|
+
export declare function calculateHSP(rgbaChannel: IColorChannel): number;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateHSP = void 0;
|
|
4
|
+
const general_1 = require("../../general");
|
|
5
|
+
const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
6
|
+
/**
|
|
7
|
+
* Calculates the HSP Color Mode from the RGBA channels
|
|
8
|
+
* - If the calculation are wrong or the given parameter is undefined, the function will return a default for light colors
|
|
9
|
+
* @param rgbaChannel the rgba channel object
|
|
10
|
+
* @returns a HSP color number
|
|
11
|
+
*/
|
|
12
|
+
function calculateHSP(rgbaChannel) {
|
|
13
|
+
if ((0, isEmpty_1.isEmpty)(rgbaChannel))
|
|
14
|
+
return 255;
|
|
15
|
+
const { r, g, b } = rgbaChannel;
|
|
16
|
+
// HSP equation from http://alienryderflex.com/hsp.html
|
|
17
|
+
const hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b));
|
|
18
|
+
return (0, general_1.isNaNV2)(hsp) ? 255 : hsp;
|
|
19
|
+
}
|
|
20
|
+
exports.calculateHSP = calculateHSP;
|
|
@@ -7,12 +7,7 @@ import { IColorCSSVariableDestination } from "../interfaces/IColorCSSVariableDes
|
|
|
7
7
|
*/
|
|
8
8
|
export declare function getCSSVariablesByDestination(destination?: IColorCSSVariableDestination): {
|
|
9
9
|
DARK: {
|
|
10
|
-
"--qv-global-header-background-color": string;
|
|
11
|
-
* Gets CSS variables depending on the destination of them.
|
|
12
|
-
* - Destination is the place where the CSS variables are going to be applied. With this, the right CSS variables are searched and set.
|
|
13
|
-
* @param destination the string of the destination.
|
|
14
|
-
* @returns the CSS variables and their values.
|
|
15
|
-
*/
|
|
10
|
+
"--qv-global-header-background-color": string;
|
|
16
11
|
"--qv-global-opacity-black-color": string;
|
|
17
12
|
"--qv-global-border-color": string;
|
|
18
13
|
"--qv-global-divider-color": string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCSSVariablesByDestination = void 0;
|
|
4
|
+
const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
4
5
|
const AUTOMATIC_CSS_VARIABLES_1 = require("../constants/AUTOMATIC_CSS_VARIABLES");
|
|
5
6
|
const CSS_VARIABLE_DESTINATION_1 = require("../constants/CSS_VARIABLE_DESTINATION");
|
|
6
7
|
/**
|
|
@@ -10,6 +11,8 @@ const CSS_VARIABLE_DESTINATION_1 = require("../constants/CSS_VARIABLE_DESTINATIO
|
|
|
10
11
|
* @returns the CSS variables and their values.
|
|
11
12
|
*/
|
|
12
13
|
function getCSSVariablesByDestination(destination = CSS_VARIABLE_DESTINATION_1.CSS_VARIABLE_DESTINATION.GLOBAL) {
|
|
14
|
+
if ((0, isEmpty_1.isEmpty)(destination))
|
|
15
|
+
return AUTOMATIC_CSS_VARIABLES_1.AUTOMATIC_CANVAS_CSS_VARIABLES[CSS_VARIABLE_DESTINATION_1.CSS_VARIABLE_DESTINATION.GLOBAL];
|
|
13
16
|
return AUTOMATIC_CSS_VARIABLES_1.AUTOMATIC_CANVAS_CSS_VARIABLES[destination];
|
|
14
17
|
}
|
|
15
18
|
exports.getCSSVariablesByDestination = getCSSVariablesByDestination;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IColorChannel } from "../interfaces/IColorChannel";
|
|
2
|
+
/**
|
|
3
|
+
* Gets the RGBA channels based on the given string Hexadecimal color
|
|
4
|
+
* - If the given argument is undefined or invalid, the function will return a channel related to white color
|
|
5
|
+
* @param color the Hexadecimal color
|
|
6
|
+
* @returns the RGBA channels
|
|
7
|
+
*/
|
|
8
|
+
export declare function getChannelsByHexadecimalColor(hexadecimal?: string): IColorChannel;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getChannelsByHexadecimalColor = void 0;
|
|
4
|
+
const CHANNEL_WHITE_COLOR_1 = require("../constants/CHANNEL_WHITE_COLOR");
|
|
5
|
+
const getHexadecimalOpacity_1 = require("./getHexadecimalOpacity");
|
|
6
|
+
const isHexadecimalColor_1 = require("./isHexadecimalColor");
|
|
7
|
+
/**
|
|
8
|
+
* Gets the RGBA channels based on the given string Hexadecimal color
|
|
9
|
+
* - If the given argument is undefined or invalid, the function will return a channel related to white color
|
|
10
|
+
* @param color the Hexadecimal color
|
|
11
|
+
* @returns the RGBA channels
|
|
12
|
+
*/
|
|
13
|
+
function getChannelsByHexadecimalColor(hexadecimal = "") {
|
|
14
|
+
if (!(0, isHexadecimalColor_1.isHexadecimalColor)(hexadecimal))
|
|
15
|
+
return CHANNEL_WHITE_COLOR_1.CHANNEL_WHITE_COLOR;
|
|
16
|
+
const colorCode = +`0x${hexadecimal
|
|
17
|
+
.slice(1)
|
|
18
|
+
.replace(hexadecimal.length < 5 && /./g, "$&$&")}`;
|
|
19
|
+
return {
|
|
20
|
+
r: colorCode >> 16,
|
|
21
|
+
g: (colorCode >> 8) & 255,
|
|
22
|
+
b: colorCode & 255,
|
|
23
|
+
a: (0, getHexadecimalOpacity_1.getHexadecimalOpacity)(hexadecimal),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
exports.getChannelsByHexadecimalColor = getChannelsByHexadecimalColor;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IColorChannel } from "../interfaces/IColorChannel";
|
|
2
|
+
/**
|
|
3
|
+
* Gets the RGBA channels based on the given string name color
|
|
4
|
+
* - If the given argument is undefined or invalid, the function will return a channel related to white color
|
|
5
|
+
* @param color the name color
|
|
6
|
+
* @returns the RGBA channels
|
|
7
|
+
*/
|
|
8
|
+
export declare function getChannelsByNameColor(name?: string): IColorChannel;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getChannelsByNameColor = void 0;
|
|
4
|
+
const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
5
|
+
const CHANNEL_WHITE_COLOR_1 = require("../constants/CHANNEL_WHITE_COLOR");
|
|
6
|
+
const COLOR_NAME_1 = require("../constants/COLOR_NAME");
|
|
7
|
+
/**
|
|
8
|
+
* Gets the RGBA channels based on the given string name color
|
|
9
|
+
* - If the given argument is undefined or invalid, the function will return a channel related to white color
|
|
10
|
+
* @param color the name color
|
|
11
|
+
* @returns the RGBA channels
|
|
12
|
+
*/
|
|
13
|
+
function getChannelsByNameColor(name = "") {
|
|
14
|
+
const nameColorChannel = COLOR_NAME_1.COLOR_NAME[String(name).toLowerCase()];
|
|
15
|
+
if ((0, isEmpty_1.isEmpty)(nameColorChannel) ||
|
|
16
|
+
!Array.isArray(nameColorChannel) ||
|
|
17
|
+
nameColorChannel.length !== 3)
|
|
18
|
+
return CHANNEL_WHITE_COLOR_1.CHANNEL_WHITE_COLOR;
|
|
19
|
+
return {
|
|
20
|
+
r: nameColorChannel[0],
|
|
21
|
+
g: nameColorChannel[1],
|
|
22
|
+
b: nameColorChannel[2],
|
|
23
|
+
a: 1,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
exports.getChannelsByNameColor = getChannelsByNameColor;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IColorChannel } from "../interfaces/IColorChannel";
|
|
2
|
+
/**
|
|
3
|
+
* Gets the RGBA channels based on the given string RGBA color
|
|
4
|
+
* - If the given argument is undefined or invalid, the function will return a channel related to white color
|
|
5
|
+
* @param color the RGBA color
|
|
6
|
+
* @returns the RGBA channels
|
|
7
|
+
*/
|
|
8
|
+
export declare function getChannelsByRgbaColor(rgba?: string): IColorChannel;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getChannelsByRgbaColor = void 0;
|
|
4
|
+
const CHANNEL_WHITE_COLOR_1 = require("../constants/CHANNEL_WHITE_COLOR");
|
|
5
|
+
const RGBA_REGULAR_EXPRESION_1 = require("../constants/RGBA_REGULAR_EXPRESION");
|
|
6
|
+
const getRgbaOpacity_1 = require("./getRgbaOpacity");
|
|
7
|
+
const isRGBAColor_1 = require("./isRGBAColor");
|
|
8
|
+
/**
|
|
9
|
+
* Gets the RGBA channels based on the given string RGBA color
|
|
10
|
+
* - If the given argument is undefined or invalid, the function will return a channel related to white color
|
|
11
|
+
* @param color the RGBA color
|
|
12
|
+
* @returns the RGBA channels
|
|
13
|
+
*/
|
|
14
|
+
function getChannelsByRgbaColor(rgba = "") {
|
|
15
|
+
if (!(0, isRGBAColor_1.isRGBAColor)(rgba))
|
|
16
|
+
return CHANNEL_WHITE_COLOR_1.CHANNEL_WHITE_COLOR;
|
|
17
|
+
const colors = rgba.toLowerCase().match(RGBA_REGULAR_EXPRESION_1.RGBA_REGULAR_EXPRESSION);
|
|
18
|
+
return {
|
|
19
|
+
r: Number(colors[1]),
|
|
20
|
+
g: Number(colors[2]),
|
|
21
|
+
b: Number(colors[3]),
|
|
22
|
+
a: (0, getRgbaOpacity_1.getRgbaOpacity)(rgba),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
exports.getChannelsByRgbaColor = getChannelsByRgbaColor;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the Alpha channel (opacity) base on the hexadecimal color
|
|
3
|
+
* - If the alpha channel is not set into the given parameter or the calculation is NaN, the function will return 1
|
|
4
|
+
* @param hexadecimal hexadecimal color
|
|
5
|
+
* @returns the Alpha channel (opacity)
|
|
6
|
+
*/
|
|
7
|
+
export declare function getHexadecimalOpacity(hexadecimal?: string): number;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getHexadecimalOpacity = void 0;
|
|
4
|
+
const isNaNV2_1 = require("../../general/mix/isNaNV2");
|
|
5
|
+
const isHexadecimalColor_1 = require("./isHexadecimalColor");
|
|
6
|
+
/**
|
|
7
|
+
* Gets the Alpha channel (opacity) base on the hexadecimal color
|
|
8
|
+
* - If the alpha channel is not set into the given parameter or the calculation is NaN, the function will return 1
|
|
9
|
+
* @param hexadecimal hexadecimal color
|
|
10
|
+
* @returns the Alpha channel (opacity)
|
|
11
|
+
*/
|
|
12
|
+
function getHexadecimalOpacity(hexadecimal = "") {
|
|
13
|
+
if (!(0, isHexadecimalColor_1.isHexadecimalColor)(hexadecimal))
|
|
14
|
+
return 1;
|
|
15
|
+
const opacityHexa = hexadecimal.slice(7) || "FF";
|
|
16
|
+
const opacity = parseInt(opacityHexa, 16) / 255;
|
|
17
|
+
return (0, isNaNV2_1.isNaNV2)(opacity) ? 1 : opacity;
|
|
18
|
+
}
|
|
19
|
+
exports.getHexadecimalOpacity = getHexadecimalOpacity;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the Alpha channel (opacity) base on the RGBA color
|
|
3
|
+
* * - If the alpha channel is not set into the given parameter or the calculation is NaN, the function will return 1
|
|
4
|
+
* @param hexadecimal RGBA color
|
|
5
|
+
* @returns the Alpha channel (opacity)
|
|
6
|
+
*/
|
|
7
|
+
export declare function getRgbaOpacity(rgba?: string): number;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRgbaOpacity = void 0;
|
|
4
|
+
const isNaNV2_1 = require("../../general/mix/isNaNV2");
|
|
5
|
+
const RGBA_REGULAR_EXPRESION_1 = require("../constants/RGBA_REGULAR_EXPRESION");
|
|
6
|
+
const isRGBAColor_1 = require("./isRGBAColor");
|
|
7
|
+
/**
|
|
8
|
+
* Gets the Alpha channel (opacity) base on the RGBA color
|
|
9
|
+
* * - If the alpha channel is not set into the given parameter or the calculation is NaN, the function will return 1
|
|
10
|
+
* @param hexadecimal RGBA color
|
|
11
|
+
* @returns the Alpha channel (opacity)
|
|
12
|
+
*/
|
|
13
|
+
function getRgbaOpacity(rgba = "") {
|
|
14
|
+
var _a;
|
|
15
|
+
if (!(0, isRGBAColor_1.isRGBAColor)(rgba))
|
|
16
|
+
return 1;
|
|
17
|
+
const colors = rgba.toLowerCase().match(RGBA_REGULAR_EXPRESION_1.RGBA_REGULAR_EXPRESSION);
|
|
18
|
+
const opacity = (_a = Number(colors[4])) !== null && _a !== void 0 ? _a : 1;
|
|
19
|
+
return (0, isNaNV2_1.isNaNV2)(opacity) ? 1 : opacity;
|
|
20
|
+
}
|
|
21
|
+
exports.getRgbaOpacity = getRgbaOpacity;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
export * from "./calculateHSP";
|
|
2
|
+
export * from "./getChannelsByHexadecimalColor";
|
|
3
|
+
export * from "./getChannelsByNameColor";
|
|
4
|
+
export * from "./getChannelsByRgbaColor";
|
|
1
5
|
export * from "./getCSSVariablesByDestination";
|
|
2
|
-
export * from "./
|
|
6
|
+
export * from "./getHexadecimalOpacity";
|
|
7
|
+
export * from "./getRgbaOpacity";
|
|
3
8
|
export * from "./isDarkColor";
|
|
4
9
|
export * from "./isHexadecimalColor";
|
|
5
10
|
export * from "./isRGBAColor";
|
|
@@ -14,8 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./calculateHSP"), exports);
|
|
18
|
+
__exportStar(require("./getChannelsByHexadecimalColor"), exports);
|
|
19
|
+
__exportStar(require("./getChannelsByNameColor"), exports);
|
|
20
|
+
__exportStar(require("./getChannelsByRgbaColor"), exports);
|
|
17
21
|
__exportStar(require("./getCSSVariablesByDestination"), exports);
|
|
18
|
-
__exportStar(require("./
|
|
22
|
+
__exportStar(require("./getHexadecimalOpacity"), exports);
|
|
23
|
+
__exportStar(require("./getRgbaOpacity"), exports);
|
|
19
24
|
__exportStar(require("./isDarkColor"), exports);
|
|
20
25
|
__exportStar(require("./isHexadecimalColor"), exports);
|
|
21
26
|
__exportStar(require("./isRGBAColor"), exports);
|
|
@@ -9,6 +9,7 @@ const HEXADECIMAL_REGULAR_EXPRESSION_1 = require("../constants/HEXADECIMAL_REGUL
|
|
|
9
9
|
* @returns true: the color is an hexadecimal type
|
|
10
10
|
*/
|
|
11
11
|
function isHexadecimalColor(color = "") {
|
|
12
|
-
return
|
|
12
|
+
return (typeof color === "string" &&
|
|
13
|
+
!(0, isEmpty_1.isEmpty)(color.match(HEXADECIMAL_REGULAR_EXPRESSION_1.HEXADECIMAL_REGULAR_EXPRESSION)));
|
|
13
14
|
}
|
|
14
15
|
exports.isHexadecimalColor = isHexadecimalColor;
|
|
@@ -9,6 +9,7 @@ const RGBA_REGULAR_EXPRESION_1 = require("../constants/RGBA_REGULAR_EXPRESION");
|
|
|
9
9
|
* @returns true: the color is an RGBA type
|
|
10
10
|
*/
|
|
11
11
|
function isRGBAColor(color = "") {
|
|
12
|
-
return
|
|
12
|
+
return (typeof color === "string" &&
|
|
13
|
+
!(0, isEmpty_1.isEmpty)(color.toLowerCase().match(RGBA_REGULAR_EXPRESION_1.RGBA_REGULAR_EXPRESSION)));
|
|
13
14
|
}
|
|
14
15
|
exports.isRGBAColor = isRGBAColor;
|
|
@@ -3,7 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.lightOrDark = void 0;
|
|
4
4
|
const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
5
5
|
const COLOR_TYPE_1 = require("../constants/COLOR_TYPE");
|
|
6
|
-
const
|
|
6
|
+
const calculateHSP_1 = require("./calculateHSP");
|
|
7
|
+
const getChannelsByHexadecimalColor_1 = require("./getChannelsByHexadecimalColor");
|
|
8
|
+
const getChannelsByNameColor_1 = require("./getChannelsByNameColor");
|
|
9
|
+
const getChannelsByRgbaColor_1 = require("./getChannelsByRgbaColor");
|
|
7
10
|
const isHexadecimalColor_1 = require("./isHexadecimalColor");
|
|
8
11
|
const isRGBAColor_1 = require("./isRGBAColor");
|
|
9
12
|
/**
|
|
@@ -14,43 +17,24 @@ const isRGBAColor_1 = require("./isRGBAColor");
|
|
|
14
17
|
* @returns the color type (Dark or Light)
|
|
15
18
|
*/
|
|
16
19
|
function lightOrDark(color, brightnessThreshold = 127.5, opacityThreshold = 0.5) {
|
|
17
|
-
if ((0, isEmpty_1.isEmpty)(color))
|
|
20
|
+
if ((0, isEmpty_1.isEmpty)(color) || typeof color !== "string")
|
|
18
21
|
return COLOR_TYPE_1.COLOR_TYPE.LIGHT;
|
|
22
|
+
let rgbaChannel = { r: 0, g: 0, b: 0, a: 1 };
|
|
19
23
|
const rgbaColor = (0, isRGBAColor_1.isRGBAColor)(color);
|
|
20
24
|
const hexadecimalColor = (0, isHexadecimalColor_1.isHexadecimalColor)(color);
|
|
21
|
-
if (!rgbaColor && !hexadecimalColor)
|
|
22
|
-
return;
|
|
23
|
-
let r, g, b, a;
|
|
24
25
|
if (rgbaColor) {
|
|
25
|
-
|
|
26
|
-
r = Number(colors[1]);
|
|
27
|
-
g = Number(colors[2]);
|
|
28
|
-
b = Number(colors[3]);
|
|
29
|
-
a = rgbaOpacity(color);
|
|
26
|
+
rgbaChannel = (0, getChannelsByRgbaColor_1.getChannelsByRgbaColor)(color);
|
|
30
27
|
}
|
|
31
|
-
if (hexadecimalColor) {
|
|
32
|
-
|
|
33
|
-
.slice(1)
|
|
34
|
-
.replace(color.length < 5 && /./g, "$&$&")}`;
|
|
35
|
-
r = colorCode >> 16;
|
|
36
|
-
g = (colorCode >> 8) & 255;
|
|
37
|
-
b = colorCode & 255;
|
|
38
|
-
a = hexadecimalOpacity(color);
|
|
28
|
+
else if (hexadecimalColor) {
|
|
29
|
+
rgbaChannel = (0, getChannelsByHexadecimalColor_1.getChannelsByHexadecimalColor)(color);
|
|
39
30
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
31
|
+
else {
|
|
32
|
+
rgbaChannel = (0, getChannelsByNameColor_1.getChannelsByNameColor)(color);
|
|
33
|
+
}
|
|
34
|
+
const hsp = (0, calculateHSP_1.calculateHSP)(rgbaChannel);
|
|
35
|
+
if (hsp > brightnessThreshold || rgbaChannel.a < opacityThreshold) {
|
|
43
36
|
return COLOR_TYPE_1.COLOR_TYPE.LIGHT;
|
|
44
37
|
}
|
|
45
38
|
return COLOR_TYPE_1.COLOR_TYPE.DARK;
|
|
46
39
|
}
|
|
47
40
|
exports.lightOrDark = lightOrDark;
|
|
48
|
-
function hexadecimalOpacity(hexadecimal) {
|
|
49
|
-
const opacityHexa = hexadecimal.slice(7) || "FF";
|
|
50
|
-
return parseInt(opacityHexa, 16) / 255;
|
|
51
|
-
}
|
|
52
|
-
function rgbaOpacity(rgba) {
|
|
53
|
-
var _a;
|
|
54
|
-
const colors = rgba.match(RGBA_REGULAR_EXPRESION_1.RGBA_REGULAR_EXPRESSION);
|
|
55
|
-
return (_a = Number(colors[4])) !== null && _a !== void 0 ? _a : 1;
|
|
56
|
-
}
|
|
@@ -11,7 +11,7 @@ const getCSSVariablesByDestination_1 = require("./getCSSVariablesByDestination")
|
|
|
11
11
|
* @param wrapperTags the html elements to set the CSS variables
|
|
12
12
|
*/
|
|
13
13
|
function setAutomaticCSSVariablesForDark(colorType, wrapperTags, destination = CSS_VARIABLE_DESTINATION_1.CSS_VARIABLE_DESTINATION.GLOBAL) {
|
|
14
|
-
if ((0, isEmpty_1.isEmpty)(colorType) ||
|
|
14
|
+
if ((0, isEmpty_1.isEmpty)(colorType) || !Array.isArray(wrapperTags))
|
|
15
15
|
return;
|
|
16
16
|
const cssVariables = (0, getCSSVariablesByDestination_1.getCSSVariablesByDestination)(destination);
|
|
17
17
|
const cssVariablesKeys = Object.keys(cssVariables[colorType] || {});
|
|
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./IColorChannel"), exports);
|
|
17
18
|
__exportStar(require("./IColorCSSVariableDestination"), exports);
|
|
18
19
|
__exportStar(require("./IColorType"), exports);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DATE_YEAR_MONTHS } from "../constants/DATE_YEAR_MONTHS";
|
|
2
|
+
import { INTL_YEAR_FORMAT } from "../constants/INTL_DATE_FORMATS";
|
|
2
3
|
import { getDateByTimezone } from "../helpers/getDateByTimezone";
|
|
3
4
|
import { getDefaultDateSettings } from "../helpers/getDefaultDateSettings";
|
|
4
5
|
import { isValidDateObject } from "../helpers/isValidDateObject";
|
|
@@ -17,5 +18,6 @@ export function dateToMonthYear(date, settings) {
|
|
|
17
18
|
const dt = new Date(timezonedDate.valueOf());
|
|
18
19
|
if (!isValidDateObject(dt))
|
|
19
20
|
return date;
|
|
20
|
-
|
|
21
|
+
const year = INTL_YEAR_FORMAT.format(dt.getFullYear());
|
|
22
|
+
return `${DATE_YEAR_MONTHS[dt.getMonth()]} ${year}`;
|
|
21
23
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const INTL_YEAR_FORMAT: Intl.NumberFormat;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AbsoluteStatement } from "./interfaces/AbsoluteStatement";
|
|
2
2
|
import { RelativeInput } from "./interfaces/RelativeInput";
|
|
3
3
|
import { RelativeToAbsoluteStruct } from "./interfaces/RelativeToAbsoluteStruct";
|
|
4
|
-
export
|
|
4
|
+
export declare class RelativeStatementAdapter {
|
|
5
5
|
statement: RelativeInput;
|
|
6
6
|
now: Date;
|
|
7
7
|
constructor(statement: RelativeInput, now?: Date);
|
|
@@ -6,7 +6,7 @@ import { getStatementCase } from "./helpers/getStatementCase";
|
|
|
6
6
|
import { DATE_GROUPING_PROPERTY } from "../constants/DATE_GROUPING_PROPERTY";
|
|
7
7
|
import { parseDate } from "./helpers/parseDate";
|
|
8
8
|
import { DATETIME_FORMAT } from "./constants/DATE_FORMATS";
|
|
9
|
-
export
|
|
9
|
+
export class RelativeStatementAdapter {
|
|
10
10
|
constructor(statement, now = new Date()) {
|
|
11
11
|
this.statement =
|
|
12
12
|
typeof statement === "string" ? statement : formatStatement(statement);
|
|
@@ -14,9 +14,8 @@ import { RelativeStatement } from "./interfaces/RelativeStatement";
|
|
|
14
14
|
*
|
|
15
15
|
* Output:
|
|
16
16
|
* { gte: "03/06/2021 00:00:00", lte: "03/05/2022 23:59:59" }
|
|
17
|
-
*
|
|
18
|
-
* @param
|
|
19
|
-
* @
|
|
20
|
-
* @returns {AbsoluteRange[]|string[]}
|
|
17
|
+
* @param statements - Raw statements/values
|
|
18
|
+
* @param clock - Clock/time reference for relative date resolution
|
|
19
|
+
* @returns
|
|
21
20
|
*/
|
|
22
21
|
export declare function resolveRelative(statements: RelativeStatement[], clock?: Date): (string | import("./interfaces").AbsoluteStatement)[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import RelativeStatementAdapter from "./RelativeStatementAdapter";
|
|
1
|
+
import { RelativeStatementAdapter } from "./RelativeStatementAdapter";
|
|
2
2
|
/**
|
|
3
3
|
* Resolve a list of relative statements according to operator
|
|
4
4
|
* @example
|
|
@@ -14,10 +14,9 @@ import RelativeStatementAdapter from "./RelativeStatementAdapter";
|
|
|
14
14
|
*
|
|
15
15
|
* Output:
|
|
16
16
|
* { gte: "03/06/2021 00:00:00", lte: "03/05/2022 23:59:59" }
|
|
17
|
-
*
|
|
18
|
-
* @param
|
|
19
|
-
* @
|
|
20
|
-
* @returns {AbsoluteRange[]|string[]}
|
|
17
|
+
* @param statements - Raw statements/values
|
|
18
|
+
* @param clock - Clock/time reference for relative date resolution
|
|
19
|
+
* @returns
|
|
21
20
|
*/
|
|
22
21
|
export function resolveRelative(statements, clock = new Date()) {
|
|
23
22
|
return statements.map((s) => new RelativeStatementAdapter(s, clock).value());
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export declare enum FILTER_SCOPE {
|
|
2
|
-
ADMIN = "ADMIN"
|
|
3
|
-
DATA = "DATA"
|
|
4
|
-
GLOBAL = "GLOBAL"
|
|
5
|
-
PAGE = "PAGE"
|
|
6
|
-
TAB = "TAB"
|
|
7
|
-
DEFAULT = "DEFAULT"
|
|
8
|
-
CHART = "CHART"
|
|
2
|
+
ADMIN = "ADMIN",// Admin filters (TBD)
|
|
3
|
+
DATA = "DATA",// User Management Filters a.k.a. Super Filters
|
|
4
|
+
GLOBAL = "GLOBAL",// Analyze Filters | Filters for all pages on PB/EU
|
|
5
|
+
PAGE = "PAGE",// PB/EU Filters for a single page
|
|
6
|
+
TAB = "TAB",// PB/EU Filters for a single tab
|
|
7
|
+
DEFAULT = "DEFAULT",// Filters created on Chart Builder
|
|
8
|
+
CHART = "CHART",// PB/EU Filters for panels inside a page/tab
|
|
9
9
|
ACTION = "ACTION"
|
|
10
10
|
}
|
|
@@ -7,8 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import UChartPaginationApi from "./UChartPaginationApi";
|
|
11
|
-
import UChartApi from "./UChartApi";
|
|
10
|
+
import { UChartPaginationApi } from "./UChartPaginationApi";
|
|
11
|
+
import { UChartApi } from "./UChartApi";
|
|
12
12
|
import { isRangeValidator } from "../helpers/common/isRangeValidator";
|
|
13
13
|
import { getFiltersByVisibility } from "../helpers/common/getFiltersByVisibility";
|
|
14
14
|
import { excludeFiltersByAggregateColumn } from "../helpers/common/excludeFiltersByAggregateColumn";
|
|
@@ -3,7 +3,7 @@ import { IFilterConfig } from "../interfaces/common/IFilterConfig";
|
|
|
3
3
|
import { IFUFlattenedFilter } from "../interfaces/ui/IFUFlattenedFilter";
|
|
4
4
|
import { IFBLogic } from "../interfaces/backend/IFBLogic";
|
|
5
5
|
import { IFUChartSettings } from "../interfaces/ui/IFUChartSettings";
|
|
6
|
-
export
|
|
6
|
+
export declare class UChartApi {
|
|
7
7
|
/**
|
|
8
8
|
* Gets a promise with a resulting data
|
|
9
9
|
* @param config the config
|