@qrvey/utils 1.12.0-7 → 1.12.0-9
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/constants/Tokens.Const.d.ts +1 -0
- package/dist/cjs/constants/Tokens.Const.js +4 -0
- package/dist/cjs/constants/index.d.ts +1 -0
- package/dist/cjs/constants/index.js +1 -0
- package/dist/cjs/filters/interfaces/builder/IFilterBuilderDisplayEvent.d.ts +4 -0
- package/dist/cjs/filters/interfaces/builder/IFilterBuilderDisplayEvent.js +2 -0
- package/dist/cjs/filters/interfaces/builder/index.d.ts +1 -0
- package/dist/cjs/filters/interfaces/builder/index.js +1 -0
- package/dist/cjs/general/string/camelize.d.ts +7 -0
- package/dist/cjs/general/string/camelize.js +26 -0
- package/dist/cjs/general/string/index.d.ts +1 -0
- package/dist/cjs/general/string/index.js +1 -0
- package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilderThreshold.d.ts +2 -0
- package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderCreateModal.d.ts +1 -0
- package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderErrorMessage.d.ts +4 -0
- package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionEven.d.ts +5 -0
- package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionEven.js +2 -0
- package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionLog.d.ts +7 -0
- package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionLog.js +2 -0
- package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionOdd.d.ts +5 -0
- package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionOdd.js +2 -0
- package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionPower.d.ts +7 -0
- package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionPower.js +2 -0
- package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionRound.d.ts +7 -0
- package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionRound.js +2 -0
- package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderV2Functions.d.ts +14 -0
- package/dist/cjs/globalization/interfaces/formula_builder/index.d.ts +5 -0
- package/dist/cjs/globalization/interfaces/formula_builder/index.js +5 -0
- package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_THRESHOLD.js +2 -0
- package/dist/cjs/globalization/labels/formula_builder/I18N_FORMULA_BUILDER.js +65 -1
- package/dist/cjs/interfaces/CustomTokens.interface.d.ts +18 -0
- package/dist/cjs/interfaces/CustomTokens.interface.js +2 -0
- package/dist/cjs/interfaces/index.d.ts +1 -0
- package/dist/cjs/interfaces/index.js +1 -0
- package/dist/cjs/tokens/getCustomTokenBoxParse.d.ts +10 -0
- package/dist/cjs/tokens/getCustomTokenBoxParse.js +27 -0
- package/dist/cjs/tokens/getCustomtonTokens.d.ts +10 -0
- package/dist/cjs/tokens/getCustomtonTokens.js +42 -0
- package/dist/cjs/tokens/getCustomtonTokensWithKeys.d.ts +12 -0
- package/dist/cjs/tokens/getCustomtonTokensWithKeys.js +18 -0
- package/dist/cjs/tokens/getCustomtonTokensWithKeys.test.d.ts +1 -0
- package/dist/cjs/tokens/getCustomtonTokensWithKeys.test.js +23 -0
- package/dist/cjs/tokens/index.d.ts +3 -0
- package/dist/cjs/tokens/index.js +3 -0
- package/dist/constants/Tokens.Const.d.ts +1 -0
- package/dist/constants/Tokens.Const.js +1 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +1 -0
- package/dist/filters/interfaces/builder/IFilterBuilderDisplayEvent.d.ts +4 -0
- package/dist/filters/interfaces/builder/IFilterBuilderDisplayEvent.js +1 -0
- package/dist/filters/interfaces/builder/index.d.ts +1 -0
- package/dist/filters/interfaces/builder/index.js +1 -0
- package/dist/general/string/camelize.d.ts +7 -0
- package/dist/general/string/camelize.js +22 -0
- package/dist/general/string/index.d.ts +1 -0
- package/dist/general/string/index.js +1 -0
- package/dist/globalization/interfaces/chart_builder/II18nChartBuilderThreshold.d.ts +2 -0
- package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderCreateModal.d.ts +1 -0
- package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderErrorMessage.d.ts +4 -0
- package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionEven.d.ts +5 -0
- package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionEven.js +1 -0
- package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionLog.d.ts +7 -0
- package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionLog.js +1 -0
- package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionOdd.d.ts +5 -0
- package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionOdd.js +1 -0
- package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionPower.d.ts +7 -0
- package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionPower.js +1 -0
- package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionRound.d.ts +7 -0
- package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionRound.js +1 -0
- package/dist/globalization/interfaces/formula_builder/II18nFormulaBuilderV2Functions.d.ts +14 -0
- package/dist/globalization/interfaces/formula_builder/index.d.ts +5 -0
- package/dist/globalization/interfaces/formula_builder/index.js +5 -0
- package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_THRESHOLD.js +2 -0
- package/dist/globalization/labels/formula_builder/I18N_FORMULA_BUILDER.js +65 -1
- package/dist/interfaces/CustomTokens.interface.d.ts +18 -0
- package/dist/interfaces/CustomTokens.interface.js +1 -0
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/interfaces/index.js +1 -0
- package/dist/tokens/getCustomTokenBoxParse.d.ts +10 -0
- package/dist/tokens/getCustomTokenBoxParse.js +23 -0
- package/dist/tokens/getCustomtonTokens.d.ts +10 -0
- package/dist/tokens/getCustomtonTokens.js +38 -0
- package/dist/tokens/getCustomtonTokensWithKeys.d.ts +12 -0
- package/dist/tokens/getCustomtonTokensWithKeys.js +14 -0
- package/dist/tokens/getCustomtonTokensWithKeys.test.d.ts +1 -0
- package/dist/tokens/getCustomtonTokensWithKeys.test.js +21 -0
- package/dist/tokens/index.d.ts +3 -0
- package/dist/tokens/index.js +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CUSTOM_TOKEN_DEFAULT_KEY = "Custom Tokens";
|
|
@@ -29,4 +29,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
29
29
|
};
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
__exportStar(require("./IFilterBuilderConfig"), exports);
|
|
32
|
+
__exportStar(require("./IFilterBuilderDisplayEvent"), exports);
|
|
32
33
|
__exportStar(require("./IFilterBuilderSettings"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `camelize` function converts a string to camel case by removing special characters and
|
|
3
|
+
* capitalizing the first letter of each word except the first one.
|
|
4
|
+
* @param [text] - The `text` parameter is a string that represents the text that you want to camelize.
|
|
5
|
+
* @returns The `camelize` function returns a string.
|
|
6
|
+
*/
|
|
7
|
+
export declare function camelize(text?: string): string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.camelize = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The `camelize` function converts a string to camel case by removing special characters and
|
|
6
|
+
* capitalizing the first letter of each word except the first one.
|
|
7
|
+
* @param [text] - The `text` parameter is a string that represents the text that you want to camelize.
|
|
8
|
+
* @returns The `camelize` function returns a string.
|
|
9
|
+
*/
|
|
10
|
+
// TODO: Replace split and join for replceAll string function when this is supported
|
|
11
|
+
function camelize(text = "") {
|
|
12
|
+
return text
|
|
13
|
+
.split(".")
|
|
14
|
+
.join(" ")
|
|
15
|
+
.split("{")
|
|
16
|
+
.join(" ")
|
|
17
|
+
.split("}")
|
|
18
|
+
.join(" ")
|
|
19
|
+
.trim()
|
|
20
|
+
.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function (match, index) {
|
|
21
|
+
if (+match === 0)
|
|
22
|
+
return "";
|
|
23
|
+
return index === 0 ? match.toLowerCase() : match.toUpperCase();
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
exports.camelize = camelize;
|
package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderErrorMessage.d.ts
CHANGED
|
@@ -28,5 +28,9 @@ export interface II18nFormulaBuilderErrorMessage {
|
|
|
28
28
|
NOT_ALLOWED_OPERATION: string;
|
|
29
29
|
NOT_ALLOWED_OPERATION_DIFFERENT_TYPES: string;
|
|
30
30
|
NOT_ALLOWED_OPERATION_MISSING_OPERATOR: string;
|
|
31
|
+
MATCH_RANGE: string;
|
|
31
32
|
GREATER_THAN: string;
|
|
33
|
+
LESS_THAN: string;
|
|
34
|
+
GREATER_THAN_OR_EQUAL_TO: string;
|
|
35
|
+
LESS_THAN_OR_EQUAL_TO: string;
|
|
32
36
|
}
|
package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionLog.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { II18nFormulaBuilderFunction } from "./II18nFormulaBuilderFunction";
|
|
2
|
+
export interface II18nFormulaBuilderV2FunctionLog extends II18nFormulaBuilderFunction {
|
|
3
|
+
param_num1_name: string;
|
|
4
|
+
param_num1_description: string;
|
|
5
|
+
param_base_name: string;
|
|
6
|
+
param_base_description: string;
|
|
7
|
+
}
|
package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionPower.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { II18nFormulaBuilderFunction } from "./II18nFormulaBuilderFunction";
|
|
2
|
+
export interface II18nFormulaBuilderV2FunctionPower extends II18nFormulaBuilderFunction {
|
|
3
|
+
param_num1_name: string;
|
|
4
|
+
param_num1_description: string;
|
|
5
|
+
param_num2_name: string;
|
|
6
|
+
param_num2_description: string;
|
|
7
|
+
}
|
package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderV2FunctionRound.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { II18nFormulaBuilderFunction } from "./II18nFormulaBuilderFunction";
|
|
2
|
+
export interface II18nFormulaBuilderV2FunctionRound extends II18nFormulaBuilderFunction {
|
|
3
|
+
param_num1_name: string;
|
|
4
|
+
param_num1_description: string;
|
|
5
|
+
param_digits_name: string;
|
|
6
|
+
param_digits_description: string;
|
|
7
|
+
}
|
package/dist/cjs/globalization/interfaces/formula_builder/II18nFormulaBuilderV2Functions.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { II18nFormulaBuilderFunction } from "./II18nFormulaBuilderFunction";
|
|
1
2
|
import { II18nFormulaBuilderV2FunctionAbs } from "./II18nFormulaBuilderV2FunctionAbs";
|
|
2
3
|
import { II18nFormulaBuilderV2FunctionAnd } from "./II18nFormulaBuilderV2FunctionAnd";
|
|
3
4
|
import { II18nFormulaBuilderV2FunctionConcantenate } from "./II18nFormulaBuilderV2FunctionConcatenate";
|
|
@@ -6,6 +7,7 @@ import { II18nFormulaBuilderV2FunctionDatedif } from "./II18nFormulaBuilderV2Fun
|
|
|
6
7
|
import { II18nFormulaBuilderV2FunctionDatesubtract } from "./II18nFormulaBuilderV2FunctionDatesubtract";
|
|
7
8
|
import { II18nFormulaBuilderV2FunctionDay } from "./II18nFormulaBuilderV2FunctionDay";
|
|
8
9
|
import { II18nFormulaBuilderV2FunctionDayofweek } from "./II18nFormulaBuilderV2FunctionDayofweek";
|
|
10
|
+
import { II18nFormulaBuilderV2FunctionEven } from "./II18nFormulaBuilderV2FunctionEven";
|
|
9
11
|
import { II18nFormulaBuilderV2FunctionHour } from "./II18nFormulaBuilderV2FunctionHour";
|
|
10
12
|
import { II18nFormulaBuilderV2FunctionIf } from "./II18nFormulaBuilderV2FunctionIf";
|
|
11
13
|
import { II18nFormulaBuilderV2FunctionIfs } from "./II18nFormulaBuilderV2FunctionIfs";
|
|
@@ -13,11 +15,15 @@ import { II18nFormulaBuilderV2FunctionInclude } from "./II18nFormulaBuilderV2Fun
|
|
|
13
15
|
import { II18nFormulaBuilderV2FunctionIsnull } from "./II18nFormulaBuilderV2FunctionIsnull";
|
|
14
16
|
import { II18nFormulaBuilderV2FunctionLeft } from "./II18nFormulaBuilderV2FunctionLeft";
|
|
15
17
|
import { II18nFormulaBuilderV2FunctionLength } from "./II18nFormulaBuilderV2FunctionLength";
|
|
18
|
+
import { II18nFormulaBuilderV2FunctionLog } from "./II18nFormulaBuilderV2FunctionLog";
|
|
16
19
|
import { II18nFormulaBuilderV2FunctionMax } from "./II18nFormulaBuilderV2FunctionMax";
|
|
17
20
|
import { II18nFormulaBuilderV2FunctionMid } from "./II18nFormulaBuilderV2FunctionMid";
|
|
18
21
|
import { II18nFormulaBuilderV2FunctionMinute } from "./II18nFormulaBuilderV2FunctionMinute";
|
|
19
22
|
import { II18nFormulaBuilderV2FunctionMonth } from "./II18nFormulaBuilderV2FunctionMonth";
|
|
23
|
+
import { II18nFormulaBuilderV2FunctionOdd } from "./II18nFormulaBuilderV2FunctionOdd";
|
|
24
|
+
import { II18nFormulaBuilderV2FunctionPower } from "./II18nFormulaBuilderV2FunctionPower";
|
|
20
25
|
import { II18nFormulaBuilderV2FunctionReplace } from "./II18nFormulaBuilderV2FunctionReplace";
|
|
26
|
+
import { II18nFormulaBuilderV2FunctionRound } from "./II18nFormulaBuilderV2FunctionRound";
|
|
21
27
|
import { II18nFormulaBuilderV2FunctionSecond } from "./II18nFormulaBuilderV2FunctionSecond";
|
|
22
28
|
import { II18nFormulaBuilderV2FunctionSqrt } from "./II18nFormulaBuilderV2FunctionSqrt";
|
|
23
29
|
import { II18nFormulaBuilderV2FunctionTrim } from "./II18nFormulaBuilderV2FunctionTrim";
|
|
@@ -55,4 +61,12 @@ export interface II18nFormulaBuilderV2Functions {
|
|
|
55
61
|
length: II18nFormulaBuilderV2FunctionLength;
|
|
56
62
|
sqrt: II18nFormulaBuilderV2FunctionSqrt;
|
|
57
63
|
exp: II18nFormulaBuilderV2FunctionSqrt;
|
|
64
|
+
even: II18nFormulaBuilderV2FunctionEven;
|
|
65
|
+
log: II18nFormulaBuilderV2FunctionLog;
|
|
66
|
+
odd: II18nFormulaBuilderV2FunctionOdd;
|
|
67
|
+
power: II18nFormulaBuilderV2FunctionPower;
|
|
68
|
+
random: II18nFormulaBuilderFunction;
|
|
69
|
+
round: II18nFormulaBuilderV2FunctionRound;
|
|
70
|
+
rounddown: II18nFormulaBuilderV2FunctionRound;
|
|
71
|
+
roundup: II18nFormulaBuilderV2FunctionRound;
|
|
58
72
|
}
|
|
@@ -83,3 +83,8 @@ export * from "./II18nFormulaBuilderV2FunctionInclude";
|
|
|
83
83
|
export * from "./II18nFormulaBuilderV2FunctionReplace";
|
|
84
84
|
export * from "./II18nFormulaBuilderV2FunctionLength";
|
|
85
85
|
export * from "./II18nFormulaBuilderV2FunctionSqrt";
|
|
86
|
+
export * from "./II18nFormulaBuilderV2FunctionEven";
|
|
87
|
+
export * from "./II18nFormulaBuilderV2FunctionLog";
|
|
88
|
+
export * from "./II18nFormulaBuilderV2FunctionOdd";
|
|
89
|
+
export * from "./II18nFormulaBuilderV2FunctionPower";
|
|
90
|
+
export * from "./II18nFormulaBuilderV2FunctionRound";
|
|
@@ -99,3 +99,8 @@ __exportStar(require("./II18nFormulaBuilderV2FunctionInclude"), exports);
|
|
|
99
99
|
__exportStar(require("./II18nFormulaBuilderV2FunctionReplace"), exports);
|
|
100
100
|
__exportStar(require("./II18nFormulaBuilderV2FunctionLength"), exports);
|
|
101
101
|
__exportStar(require("./II18nFormulaBuilderV2FunctionSqrt"), exports);
|
|
102
|
+
__exportStar(require("./II18nFormulaBuilderV2FunctionEven"), exports);
|
|
103
|
+
__exportStar(require("./II18nFormulaBuilderV2FunctionLog"), exports);
|
|
104
|
+
__exportStar(require("./II18nFormulaBuilderV2FunctionOdd"), exports);
|
|
105
|
+
__exportStar(require("./II18nFormulaBuilderV2FunctionPower"), exports);
|
|
106
|
+
__exportStar(require("./II18nFormulaBuilderV2FunctionRound"), exports);
|
|
@@ -304,6 +304,62 @@ exports.I18N_FORMULA_BUILDER = {
|
|
|
304
304
|
param_num1_name: "num1",
|
|
305
305
|
param_num1_description: "The exponent to raise e to.",
|
|
306
306
|
},
|
|
307
|
+
even: {
|
|
308
|
+
description: "Returns a number rounded to the next greatest even integer. For negative numbers it returns a number rounded to the next negative even number with greater absolute value.",
|
|
309
|
+
function_placeholder: "EVEN(num1)",
|
|
310
|
+
param_num1_name: "num1",
|
|
311
|
+
param_num1_description: "Numeric value.",
|
|
312
|
+
},
|
|
313
|
+
log: {
|
|
314
|
+
description: "Returns the logarithm of a number to the base you specify.",
|
|
315
|
+
function_placeholder: "LOG(num1, [base])",
|
|
316
|
+
param_num1_name: "num1",
|
|
317
|
+
param_num1_description: "Numeric value.",
|
|
318
|
+
param_base_name: "base (optional)",
|
|
319
|
+
param_base_description: "Base of the logarithm, if omitted, it is assumed to be 10. To calculate natural logarithm enter EXP(1).",
|
|
320
|
+
},
|
|
321
|
+
odd: {
|
|
322
|
+
description: "Returns a number rounded to the next greatest odd integer. For negative numbers it returns a number rounded to the next negative odd number with greater absolute value.",
|
|
323
|
+
function_placeholder: "ODD(num1)",
|
|
324
|
+
param_num1_name: "num1",
|
|
325
|
+
param_num1_description: "Numeric value.",
|
|
326
|
+
},
|
|
327
|
+
power: {
|
|
328
|
+
description: "Returns the logarithm of a number to the base you specify.",
|
|
329
|
+
function_placeholder: "POWER(num1, num2)",
|
|
330
|
+
param_num1_name: "num1",
|
|
331
|
+
param_num1_description: "Base.",
|
|
332
|
+
param_num2_name: "num2",
|
|
333
|
+
param_num2_description: "Exponent.",
|
|
334
|
+
},
|
|
335
|
+
random: {
|
|
336
|
+
description: "Returns a positive decimal number between 0 (inclusive) and 1 (exclusive).",
|
|
337
|
+
function_placeholder: "LOG(num1, [base])",
|
|
338
|
+
},
|
|
339
|
+
round: {
|
|
340
|
+
description: "Rounds a number to a specified number of digits. For negative numbers it rounds to the next negative number with greater absolute value.",
|
|
341
|
+
function_placeholder: "ROUND(num1,digits)",
|
|
342
|
+
param_num1_name: "num1",
|
|
343
|
+
param_num1_description: "Numeric value.",
|
|
344
|
+
param_digits_name: "digits",
|
|
345
|
+
param_digits_description: "Number of decimal digits, up to 10 digits.",
|
|
346
|
+
},
|
|
347
|
+
rounddown: {
|
|
348
|
+
description: "Rounds a number down to a specified number of digits. For negative numbers it rounds to the next negative number with the least absolute value.",
|
|
349
|
+
function_placeholder: "ROUNDDOWN(num1,digits)",
|
|
350
|
+
param_num1_name: "num1",
|
|
351
|
+
param_num1_description: "Numeric value.",
|
|
352
|
+
param_digits_name: "digits",
|
|
353
|
+
param_digits_description: "Number of decimal digits, up to 10 digits.",
|
|
354
|
+
},
|
|
355
|
+
roundup: {
|
|
356
|
+
description: "Rounds a number up to a specified number of digits. For negative numbers it rounds to the next negative number with greater absolute value.",
|
|
357
|
+
function_placeholder: "ROUNDUP(num1,digits)",
|
|
358
|
+
param_num1_name: "num1",
|
|
359
|
+
param_num1_description: "Numeric value.",
|
|
360
|
+
param_digits_name: "digits",
|
|
361
|
+
param_digits_description: "Number of decimal digits, up to 10 digits.",
|
|
362
|
+
},
|
|
307
363
|
},
|
|
308
364
|
editor: {
|
|
309
365
|
error_messages: {
|
|
@@ -335,8 +391,16 @@ exports.I18N_FORMULA_BUILDER = {
|
|
|
335
391
|
NOT_ALLOWED_OPERATION: "Expression not allowed. Allowed operators between {{i18n.function.expression.types}}: {{i18n.function.expression.operators}}",
|
|
336
392
|
NOT_ALLOWED_OPERATION_DIFFERENT_TYPES: "Expression not allowed {{i18n.function.expression.value}}",
|
|
337
393
|
NOT_ALLOWED_OPERATION_MISSING_OPERATOR: "Expression not allowed. Missing operator",
|
|
338
|
-
GREATER_THAN: "Argument {{i18n.function.argument.position}} has to be greater or equal than {{i18n.function.argument.greater_than}}",
|
|
339
394
|
INVALID_ALLOW_VALUE: "Argument {{i18n.function.argument.position}} has to be {{i18n.function.argument.allow_value}}",
|
|
395
|
+
MATCH_RANGE: "Argument {{i18n.function.argument.position}} has to be {{i18n.function.expression.dynamic}}",
|
|
396
|
+
GREATER_THAN: "greater than {{i18n.function.argument.greater_than}}",
|
|
397
|
+
LESS_THAN: "less than {{i18n.function.argument.less_than}}",
|
|
398
|
+
GREATER_THAN_OR_EQUAL_TO: "greater or equal than {{i18n.function.argument.greater_than_or_equal_to}}",
|
|
399
|
+
LESS_THAN_OR_EQUAL_TO: "less or equal than {{i18n.function.argument.less_than_or_equal_to}}",
|
|
400
|
+
},
|
|
401
|
+
special_words: {
|
|
402
|
+
and: "and",
|
|
403
|
+
between: "between",
|
|
340
404
|
},
|
|
341
405
|
},
|
|
342
406
|
},
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface CustomTokens {
|
|
2
|
+
key?: string;
|
|
3
|
+
label: string;
|
|
4
|
+
value: string | number;
|
|
5
|
+
}
|
|
6
|
+
export interface ICustomTokensSimple {
|
|
7
|
+
[key: string]: string | number;
|
|
8
|
+
}
|
|
9
|
+
export interface ICustomTokensComplex {
|
|
10
|
+
[key: string]: CustomTokens[];
|
|
11
|
+
}
|
|
12
|
+
export interface ICustomTokensBoxDetail {
|
|
13
|
+
alias: string;
|
|
14
|
+
label: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ICustomTokensBox {
|
|
17
|
+
[key: string]: ICustomTokensBoxDetail[];
|
|
18
|
+
}
|
|
@@ -19,3 +19,4 @@ __exportStar(require("./IChartBuilder.Interface"), exports);
|
|
|
19
19
|
__exportStar(require("./general"), exports);
|
|
20
20
|
__exportStar(require("./Qrvey.Interface"), exports);
|
|
21
21
|
__exportStar(require("./format"), exports);
|
|
22
|
+
__exportStar(require("./CustomTokens.interface"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ICustomTokensBox, ICustomTokensComplex } from "../interfaces";
|
|
2
|
+
/**
|
|
3
|
+
* The function `getCustomTokenBoxParse` takes in an object of custom tokens and returns a formatted
|
|
4
|
+
* list of tokens with aliases and labels.
|
|
5
|
+
* @param {ICustomTokensComplex} customTokens - The `customTokens` parameter is an object that contains
|
|
6
|
+
* custom token groups and their corresponding tokens. Each custom token group is represented by a key
|
|
7
|
+
* in the object, and the value is an array of tokens within that group.
|
|
8
|
+
* @returns an object called `tokensList`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getCustomTokenBoxParse(customTokens: ICustomTokensComplex): ICustomTokensBox;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCustomTokenBoxParse = void 0;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
const general_1 = require("../general");
|
|
6
|
+
/**
|
|
7
|
+
* The function `getCustomTokenBoxParse` takes in an object of custom tokens and returns a formatted
|
|
8
|
+
* list of tokens with aliases and labels.
|
|
9
|
+
* @param {ICustomTokensComplex} customTokens - The `customTokens` parameter is an object that contains
|
|
10
|
+
* custom token groups and their corresponding tokens. Each custom token group is represented by a key
|
|
11
|
+
* in the object, and the value is an array of tokens within that group.
|
|
12
|
+
* @returns an object called `tokensList`.
|
|
13
|
+
*/
|
|
14
|
+
function getCustomTokenBoxParse(customTokens) {
|
|
15
|
+
const tokensList = {};
|
|
16
|
+
for (const tokenKey in customTokens) {
|
|
17
|
+
if (Object.prototype.hasOwnProperty.call(customTokens, tokenKey)) {
|
|
18
|
+
const subGroup = tokenKey === constants_1.CUSTOM_TOKEN_DEFAULT_KEY ? "" : `.${(0, general_1.camelize)(tokenKey)}`;
|
|
19
|
+
tokensList[tokenKey] = customTokens[tokenKey].map((token) => ({
|
|
20
|
+
alias: token.label,
|
|
21
|
+
label: `{{customTokens${subGroup}.${token.key}}}`,
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return tokensList;
|
|
26
|
+
}
|
|
27
|
+
exports.getCustomTokenBoxParse = getCustomTokenBoxParse;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ICustomTokensComplex, ICustomTokensSimple } from "../interfaces";
|
|
2
|
+
/**
|
|
3
|
+
* The function `getCustomtonTokens` takes a configuration object and returns a parsed version of the
|
|
4
|
+
* custom tokens.
|
|
5
|
+
* @param {ICustomTokensSimple | ICustomTokensComplex} customtonTokensConfig - The
|
|
6
|
+
* `customtonTokensConfig` parameter is an object that can be either of type `ICustomTokensSimple` or
|
|
7
|
+
* `ICustomTokensComplex`.
|
|
8
|
+
* @returns an object of type `ICustomTokensComplex`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getCustomtonTokens(customtonTokensConfig: ICustomTokensSimple | ICustomTokensComplex): ICustomTokensComplex;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCustomtonTokens = void 0;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
const general_1 = require("../general");
|
|
6
|
+
const getCustomtonTokensWithKeys_1 = require("./getCustomtonTokensWithKeys");
|
|
7
|
+
/**
|
|
8
|
+
* The function `getCustomtonTokens` takes a configuration object and returns a parsed version of the
|
|
9
|
+
* custom tokens.
|
|
10
|
+
* @param {ICustomTokensSimple | ICustomTokensComplex} customtonTokensConfig - The
|
|
11
|
+
* `customtonTokensConfig` parameter is an object that can be either of type `ICustomTokensSimple` or
|
|
12
|
+
* `ICustomTokensComplex`.
|
|
13
|
+
* @returns an object of type `ICustomTokensComplex`.
|
|
14
|
+
*/
|
|
15
|
+
function getCustomtonTokens(customtonTokensConfig) {
|
|
16
|
+
const customTokensparsed = {
|
|
17
|
+
[constants_1.CUSTOM_TOKEN_DEFAULT_KEY]: [],
|
|
18
|
+
};
|
|
19
|
+
for (const key in customtonTokensConfig) {
|
|
20
|
+
if (Object.prototype.hasOwnProperty.call(customtonTokensConfig, key)) {
|
|
21
|
+
if (typeof customtonTokensConfig[key] === "object") {
|
|
22
|
+
const tokensFromConfig = (0, getCustomtonTokensWithKeys_1.getCustomtonTokensWithKeys)(customtonTokensConfig[key]);
|
|
23
|
+
if (key === constants_1.CUSTOM_TOKEN_DEFAULT_KEY) {
|
|
24
|
+
customTokensparsed[key].push(...tokensFromConfig);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
customTokensparsed[key] = tokensFromConfig;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
const tokensFromConfig = customtonTokensConfig[key];
|
|
32
|
+
customTokensparsed[constants_1.CUSTOM_TOKEN_DEFAULT_KEY].push({
|
|
33
|
+
label: key,
|
|
34
|
+
value: tokensFromConfig,
|
|
35
|
+
key: (0, general_1.camelize)(key),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return customTokensparsed;
|
|
41
|
+
}
|
|
42
|
+
exports.getCustomtonTokens = getCustomtonTokens;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CustomTokens } from "../interfaces";
|
|
2
|
+
/**
|
|
3
|
+
* The function `getCustomtonTokensWithKeys` takes an array of `CustomTokens` objects and returns a new
|
|
4
|
+
* array with each object having a `key` property that is the camelized version of either the `key` or
|
|
5
|
+
* `label` property.
|
|
6
|
+
* @param {CustomTokens[]} customTokens - An array of objects representing custom tokens. Each object
|
|
7
|
+
* should have properties such as "key" and "label".
|
|
8
|
+
* @returns an array of `CustomTokens` objects. Each object in the array has an additional `key`
|
|
9
|
+
* property, which is generated by camelizing the `key` or `label` property of the original
|
|
10
|
+
* `CustomTokens` object.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getCustomtonTokensWithKeys(customTokens: CustomTokens[]): CustomTokens[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCustomtonTokensWithKeys = void 0;
|
|
4
|
+
const general_1 = require("../general");
|
|
5
|
+
/**
|
|
6
|
+
* The function `getCustomtonTokensWithKeys` takes an array of `CustomTokens` objects and returns a new
|
|
7
|
+
* array with each object having a `key` property that is the camelized version of either the `key` or
|
|
8
|
+
* `label` property.
|
|
9
|
+
* @param {CustomTokens[]} customTokens - An array of objects representing custom tokens. Each object
|
|
10
|
+
* should have properties such as "key" and "label".
|
|
11
|
+
* @returns an array of `CustomTokens` objects. Each object in the array has an additional `key`
|
|
12
|
+
* property, which is generated by camelizing the `key` or `label` property of the original
|
|
13
|
+
* `CustomTokens` object.
|
|
14
|
+
*/
|
|
15
|
+
function getCustomtonTokensWithKeys(customTokens) {
|
|
16
|
+
return customTokens.map((token) => (Object.assign(Object.assign({}, token), { key: (0, general_1.camelize)((token === null || token === void 0 ? void 0 : token.key) || token.label) })));
|
|
17
|
+
}
|
|
18
|
+
exports.getCustomtonTokensWithKeys = getCustomtonTokensWithKeys;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const getCustomtonTokensWithKeys_1 = require("../../src/tokens/getCustomtonTokensWithKeys");
|
|
4
|
+
describe("getCustomtonTokensWithKeys", () => {
|
|
5
|
+
test("should add camelized key to custom tokens", () => {
|
|
6
|
+
const customTokens = [
|
|
7
|
+
{ label: "token one", value: "value1" },
|
|
8
|
+
{ label: "Token 2", value: "value2", key: "{{token dos}}" },
|
|
9
|
+
{ label: "3rd token", value: "value3" },
|
|
10
|
+
];
|
|
11
|
+
const result = (0, getCustomtonTokensWithKeys_1.getCustomtonTokensWithKeys)(customTokens);
|
|
12
|
+
expect(result).toEqual([
|
|
13
|
+
{ label: "token one", value: "value1", key: "tokenOne" },
|
|
14
|
+
{ label: "Token 2", value: "value2", key: "tokenDos" },
|
|
15
|
+
{ label: "3rd token", value: "value3", key: "3rdToken" },
|
|
16
|
+
]);
|
|
17
|
+
});
|
|
18
|
+
test("should handle empty array", () => {
|
|
19
|
+
const emptyTokens = [];
|
|
20
|
+
const result = (0, getCustomtonTokensWithKeys_1.getCustomtonTokensWithKeys)(emptyTokens);
|
|
21
|
+
expect(result).toEqual([]);
|
|
22
|
+
});
|
|
23
|
+
});
|
package/dist/cjs/tokens/index.js
CHANGED
|
@@ -15,3 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./isTokenLabel"), exports);
|
|
18
|
+
__exportStar(require("./getCustomtonTokensWithKeys"), exports);
|
|
19
|
+
__exportStar(require("./getCustomtonTokens"), exports);
|
|
20
|
+
__exportStar(require("./getCustomTokenBoxParse"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CUSTOM_TOKEN_DEFAULT_KEY = "Custom Tokens";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const CUSTOM_TOKEN_DEFAULT_KEY = "Custom Tokens";
|
package/dist/constants/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `camelize` function converts a string to camel case by removing special characters and
|
|
3
|
+
* capitalizing the first letter of each word except the first one.
|
|
4
|
+
* @param [text] - The `text` parameter is a string that represents the text that you want to camelize.
|
|
5
|
+
* @returns The `camelize` function returns a string.
|
|
6
|
+
*/
|
|
7
|
+
export declare function camelize(text?: string): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `camelize` function converts a string to camel case by removing special characters and
|
|
3
|
+
* capitalizing the first letter of each word except the first one.
|
|
4
|
+
* @param [text] - The `text` parameter is a string that represents the text that you want to camelize.
|
|
5
|
+
* @returns The `camelize` function returns a string.
|
|
6
|
+
*/
|
|
7
|
+
// TODO: Replace split and join for replceAll string function when this is supported
|
|
8
|
+
export function camelize(text = "") {
|
|
9
|
+
return text
|
|
10
|
+
.split(".")
|
|
11
|
+
.join(" ")
|
|
12
|
+
.split("{")
|
|
13
|
+
.join(" ")
|
|
14
|
+
.split("}")
|
|
15
|
+
.join(" ")
|
|
16
|
+
.trim()
|
|
17
|
+
.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function (match, index) {
|
|
18
|
+
if (+match === 0)
|
|
19
|
+
return "";
|
|
20
|
+
return index === 0 ? match.toLowerCase() : match.toUpperCase();
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -28,5 +28,9 @@ export interface II18nFormulaBuilderErrorMessage {
|
|
|
28
28
|
NOT_ALLOWED_OPERATION: string;
|
|
29
29
|
NOT_ALLOWED_OPERATION_DIFFERENT_TYPES: string;
|
|
30
30
|
NOT_ALLOWED_OPERATION_MISSING_OPERATOR: string;
|
|
31
|
+
MATCH_RANGE: string;
|
|
31
32
|
GREATER_THAN: string;
|
|
33
|
+
LESS_THAN: string;
|
|
34
|
+
GREATER_THAN_OR_EQUAL_TO: string;
|
|
35
|
+
LESS_THAN_OR_EQUAL_TO: string;
|
|
32
36
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { II18nFormulaBuilderFunction } from "./II18nFormulaBuilderFunction";
|
|
2
|
+
export interface II18nFormulaBuilderV2FunctionLog extends II18nFormulaBuilderFunction {
|
|
3
|
+
param_num1_name: string;
|
|
4
|
+
param_num1_description: string;
|
|
5
|
+
param_base_name: string;
|
|
6
|
+
param_base_description: string;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { II18nFormulaBuilderFunction } from "./II18nFormulaBuilderFunction";
|
|
2
|
+
export interface II18nFormulaBuilderV2FunctionPower extends II18nFormulaBuilderFunction {
|
|
3
|
+
param_num1_name: string;
|
|
4
|
+
param_num1_description: string;
|
|
5
|
+
param_num2_name: string;
|
|
6
|
+
param_num2_description: string;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { II18nFormulaBuilderFunction } from "./II18nFormulaBuilderFunction";
|
|
2
|
+
export interface II18nFormulaBuilderV2FunctionRound extends II18nFormulaBuilderFunction {
|
|
3
|
+
param_num1_name: string;
|
|
4
|
+
param_num1_description: string;
|
|
5
|
+
param_digits_name: string;
|
|
6
|
+
param_digits_description: string;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { II18nFormulaBuilderFunction } from "./II18nFormulaBuilderFunction";
|
|
1
2
|
import { II18nFormulaBuilderV2FunctionAbs } from "./II18nFormulaBuilderV2FunctionAbs";
|
|
2
3
|
import { II18nFormulaBuilderV2FunctionAnd } from "./II18nFormulaBuilderV2FunctionAnd";
|
|
3
4
|
import { II18nFormulaBuilderV2FunctionConcantenate } from "./II18nFormulaBuilderV2FunctionConcatenate";
|
|
@@ -6,6 +7,7 @@ import { II18nFormulaBuilderV2FunctionDatedif } from "./II18nFormulaBuilderV2Fun
|
|
|
6
7
|
import { II18nFormulaBuilderV2FunctionDatesubtract } from "./II18nFormulaBuilderV2FunctionDatesubtract";
|
|
7
8
|
import { II18nFormulaBuilderV2FunctionDay } from "./II18nFormulaBuilderV2FunctionDay";
|
|
8
9
|
import { II18nFormulaBuilderV2FunctionDayofweek } from "./II18nFormulaBuilderV2FunctionDayofweek";
|
|
10
|
+
import { II18nFormulaBuilderV2FunctionEven } from "./II18nFormulaBuilderV2FunctionEven";
|
|
9
11
|
import { II18nFormulaBuilderV2FunctionHour } from "./II18nFormulaBuilderV2FunctionHour";
|
|
10
12
|
import { II18nFormulaBuilderV2FunctionIf } from "./II18nFormulaBuilderV2FunctionIf";
|
|
11
13
|
import { II18nFormulaBuilderV2FunctionIfs } from "./II18nFormulaBuilderV2FunctionIfs";
|
|
@@ -13,11 +15,15 @@ import { II18nFormulaBuilderV2FunctionInclude } from "./II18nFormulaBuilderV2Fun
|
|
|
13
15
|
import { II18nFormulaBuilderV2FunctionIsnull } from "./II18nFormulaBuilderV2FunctionIsnull";
|
|
14
16
|
import { II18nFormulaBuilderV2FunctionLeft } from "./II18nFormulaBuilderV2FunctionLeft";
|
|
15
17
|
import { II18nFormulaBuilderV2FunctionLength } from "./II18nFormulaBuilderV2FunctionLength";
|
|
18
|
+
import { II18nFormulaBuilderV2FunctionLog } from "./II18nFormulaBuilderV2FunctionLog";
|
|
16
19
|
import { II18nFormulaBuilderV2FunctionMax } from "./II18nFormulaBuilderV2FunctionMax";
|
|
17
20
|
import { II18nFormulaBuilderV2FunctionMid } from "./II18nFormulaBuilderV2FunctionMid";
|
|
18
21
|
import { II18nFormulaBuilderV2FunctionMinute } from "./II18nFormulaBuilderV2FunctionMinute";
|
|
19
22
|
import { II18nFormulaBuilderV2FunctionMonth } from "./II18nFormulaBuilderV2FunctionMonth";
|
|
23
|
+
import { II18nFormulaBuilderV2FunctionOdd } from "./II18nFormulaBuilderV2FunctionOdd";
|
|
24
|
+
import { II18nFormulaBuilderV2FunctionPower } from "./II18nFormulaBuilderV2FunctionPower";
|
|
20
25
|
import { II18nFormulaBuilderV2FunctionReplace } from "./II18nFormulaBuilderV2FunctionReplace";
|
|
26
|
+
import { II18nFormulaBuilderV2FunctionRound } from "./II18nFormulaBuilderV2FunctionRound";
|
|
21
27
|
import { II18nFormulaBuilderV2FunctionSecond } from "./II18nFormulaBuilderV2FunctionSecond";
|
|
22
28
|
import { II18nFormulaBuilderV2FunctionSqrt } from "./II18nFormulaBuilderV2FunctionSqrt";
|
|
23
29
|
import { II18nFormulaBuilderV2FunctionTrim } from "./II18nFormulaBuilderV2FunctionTrim";
|
|
@@ -55,4 +61,12 @@ export interface II18nFormulaBuilderV2Functions {
|
|
|
55
61
|
length: II18nFormulaBuilderV2FunctionLength;
|
|
56
62
|
sqrt: II18nFormulaBuilderV2FunctionSqrt;
|
|
57
63
|
exp: II18nFormulaBuilderV2FunctionSqrt;
|
|
64
|
+
even: II18nFormulaBuilderV2FunctionEven;
|
|
65
|
+
log: II18nFormulaBuilderV2FunctionLog;
|
|
66
|
+
odd: II18nFormulaBuilderV2FunctionOdd;
|
|
67
|
+
power: II18nFormulaBuilderV2FunctionPower;
|
|
68
|
+
random: II18nFormulaBuilderFunction;
|
|
69
|
+
round: II18nFormulaBuilderV2FunctionRound;
|
|
70
|
+
rounddown: II18nFormulaBuilderV2FunctionRound;
|
|
71
|
+
roundup: II18nFormulaBuilderV2FunctionRound;
|
|
58
72
|
}
|
|
@@ -83,3 +83,8 @@ export * from "./II18nFormulaBuilderV2FunctionInclude";
|
|
|
83
83
|
export * from "./II18nFormulaBuilderV2FunctionReplace";
|
|
84
84
|
export * from "./II18nFormulaBuilderV2FunctionLength";
|
|
85
85
|
export * from "./II18nFormulaBuilderV2FunctionSqrt";
|
|
86
|
+
export * from "./II18nFormulaBuilderV2FunctionEven";
|
|
87
|
+
export * from "./II18nFormulaBuilderV2FunctionLog";
|
|
88
|
+
export * from "./II18nFormulaBuilderV2FunctionOdd";
|
|
89
|
+
export * from "./II18nFormulaBuilderV2FunctionPower";
|
|
90
|
+
export * from "./II18nFormulaBuilderV2FunctionRound";
|
|
@@ -83,3 +83,8 @@ export * from "./II18nFormulaBuilderV2FunctionInclude";
|
|
|
83
83
|
export * from "./II18nFormulaBuilderV2FunctionReplace";
|
|
84
84
|
export * from "./II18nFormulaBuilderV2FunctionLength";
|
|
85
85
|
export * from "./II18nFormulaBuilderV2FunctionSqrt";
|
|
86
|
+
export * from "./II18nFormulaBuilderV2FunctionEven";
|
|
87
|
+
export * from "./II18nFormulaBuilderV2FunctionLog";
|
|
88
|
+
export * from "./II18nFormulaBuilderV2FunctionOdd";
|
|
89
|
+
export * from "./II18nFormulaBuilderV2FunctionPower";
|
|
90
|
+
export * from "./II18nFormulaBuilderV2FunctionRound";
|
|
@@ -301,6 +301,62 @@ export const I18N_FORMULA_BUILDER = {
|
|
|
301
301
|
param_num1_name: "num1",
|
|
302
302
|
param_num1_description: "The exponent to raise e to.",
|
|
303
303
|
},
|
|
304
|
+
even: {
|
|
305
|
+
description: "Returns a number rounded to the next greatest even integer. For negative numbers it returns a number rounded to the next negative even number with greater absolute value.",
|
|
306
|
+
function_placeholder: "EVEN(num1)",
|
|
307
|
+
param_num1_name: "num1",
|
|
308
|
+
param_num1_description: "Numeric value.",
|
|
309
|
+
},
|
|
310
|
+
log: {
|
|
311
|
+
description: "Returns the logarithm of a number to the base you specify.",
|
|
312
|
+
function_placeholder: "LOG(num1, [base])",
|
|
313
|
+
param_num1_name: "num1",
|
|
314
|
+
param_num1_description: "Numeric value.",
|
|
315
|
+
param_base_name: "base (optional)",
|
|
316
|
+
param_base_description: "Base of the logarithm, if omitted, it is assumed to be 10. To calculate natural logarithm enter EXP(1).",
|
|
317
|
+
},
|
|
318
|
+
odd: {
|
|
319
|
+
description: "Returns a number rounded to the next greatest odd integer. For negative numbers it returns a number rounded to the next negative odd number with greater absolute value.",
|
|
320
|
+
function_placeholder: "ODD(num1)",
|
|
321
|
+
param_num1_name: "num1",
|
|
322
|
+
param_num1_description: "Numeric value.",
|
|
323
|
+
},
|
|
324
|
+
power: {
|
|
325
|
+
description: "Returns the logarithm of a number to the base you specify.",
|
|
326
|
+
function_placeholder: "POWER(num1, num2)",
|
|
327
|
+
param_num1_name: "num1",
|
|
328
|
+
param_num1_description: "Base.",
|
|
329
|
+
param_num2_name: "num2",
|
|
330
|
+
param_num2_description: "Exponent.",
|
|
331
|
+
},
|
|
332
|
+
random: {
|
|
333
|
+
description: "Returns a positive decimal number between 0 (inclusive) and 1 (exclusive).",
|
|
334
|
+
function_placeholder: "LOG(num1, [base])",
|
|
335
|
+
},
|
|
336
|
+
round: {
|
|
337
|
+
description: "Rounds a number to a specified number of digits. For negative numbers it rounds to the next negative number with greater absolute value.",
|
|
338
|
+
function_placeholder: "ROUND(num1,digits)",
|
|
339
|
+
param_num1_name: "num1",
|
|
340
|
+
param_num1_description: "Numeric value.",
|
|
341
|
+
param_digits_name: "digits",
|
|
342
|
+
param_digits_description: "Number of decimal digits, up to 10 digits.",
|
|
343
|
+
},
|
|
344
|
+
rounddown: {
|
|
345
|
+
description: "Rounds a number down to a specified number of digits. For negative numbers it rounds to the next negative number with the least absolute value.",
|
|
346
|
+
function_placeholder: "ROUNDDOWN(num1,digits)",
|
|
347
|
+
param_num1_name: "num1",
|
|
348
|
+
param_num1_description: "Numeric value.",
|
|
349
|
+
param_digits_name: "digits",
|
|
350
|
+
param_digits_description: "Number of decimal digits, up to 10 digits.",
|
|
351
|
+
},
|
|
352
|
+
roundup: {
|
|
353
|
+
description: "Rounds a number up to a specified number of digits. For negative numbers it rounds to the next negative number with greater absolute value.",
|
|
354
|
+
function_placeholder: "ROUNDUP(num1,digits)",
|
|
355
|
+
param_num1_name: "num1",
|
|
356
|
+
param_num1_description: "Numeric value.",
|
|
357
|
+
param_digits_name: "digits",
|
|
358
|
+
param_digits_description: "Number of decimal digits, up to 10 digits.",
|
|
359
|
+
},
|
|
304
360
|
},
|
|
305
361
|
editor: {
|
|
306
362
|
error_messages: {
|
|
@@ -332,8 +388,16 @@ export const I18N_FORMULA_BUILDER = {
|
|
|
332
388
|
NOT_ALLOWED_OPERATION: "Expression not allowed. Allowed operators between {{i18n.function.expression.types}}: {{i18n.function.expression.operators}}",
|
|
333
389
|
NOT_ALLOWED_OPERATION_DIFFERENT_TYPES: "Expression not allowed {{i18n.function.expression.value}}",
|
|
334
390
|
NOT_ALLOWED_OPERATION_MISSING_OPERATOR: "Expression not allowed. Missing operator",
|
|
335
|
-
GREATER_THAN: "Argument {{i18n.function.argument.position}} has to be greater or equal than {{i18n.function.argument.greater_than}}",
|
|
336
391
|
INVALID_ALLOW_VALUE: "Argument {{i18n.function.argument.position}} has to be {{i18n.function.argument.allow_value}}",
|
|
392
|
+
MATCH_RANGE: "Argument {{i18n.function.argument.position}} has to be {{i18n.function.expression.dynamic}}",
|
|
393
|
+
GREATER_THAN: "greater than {{i18n.function.argument.greater_than}}",
|
|
394
|
+
LESS_THAN: "less than {{i18n.function.argument.less_than}}",
|
|
395
|
+
GREATER_THAN_OR_EQUAL_TO: "greater or equal than {{i18n.function.argument.greater_than_or_equal_to}}",
|
|
396
|
+
LESS_THAN_OR_EQUAL_TO: "less or equal than {{i18n.function.argument.less_than_or_equal_to}}",
|
|
397
|
+
},
|
|
398
|
+
special_words: {
|
|
399
|
+
and: "and",
|
|
400
|
+
between: "between",
|
|
337
401
|
},
|
|
338
402
|
},
|
|
339
403
|
},
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface CustomTokens {
|
|
2
|
+
key?: string;
|
|
3
|
+
label: string;
|
|
4
|
+
value: string | number;
|
|
5
|
+
}
|
|
6
|
+
export interface ICustomTokensSimple {
|
|
7
|
+
[key: string]: string | number;
|
|
8
|
+
}
|
|
9
|
+
export interface ICustomTokensComplex {
|
|
10
|
+
[key: string]: CustomTokens[];
|
|
11
|
+
}
|
|
12
|
+
export interface ICustomTokensBoxDetail {
|
|
13
|
+
alias: string;
|
|
14
|
+
label: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ICustomTokensBox {
|
|
17
|
+
[key: string]: ICustomTokensBoxDetail[];
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/interfaces/index.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ICustomTokensBox, ICustomTokensComplex } from "../interfaces";
|
|
2
|
+
/**
|
|
3
|
+
* The function `getCustomTokenBoxParse` takes in an object of custom tokens and returns a formatted
|
|
4
|
+
* list of tokens with aliases and labels.
|
|
5
|
+
* @param {ICustomTokensComplex} customTokens - The `customTokens` parameter is an object that contains
|
|
6
|
+
* custom token groups and their corresponding tokens. Each custom token group is represented by a key
|
|
7
|
+
* in the object, and the value is an array of tokens within that group.
|
|
8
|
+
* @returns an object called `tokensList`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getCustomTokenBoxParse(customTokens: ICustomTokensComplex): ICustomTokensBox;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CUSTOM_TOKEN_DEFAULT_KEY } from "../constants";
|
|
2
|
+
import { camelize } from "../general";
|
|
3
|
+
/**
|
|
4
|
+
* The function `getCustomTokenBoxParse` takes in an object of custom tokens and returns a formatted
|
|
5
|
+
* list of tokens with aliases and labels.
|
|
6
|
+
* @param {ICustomTokensComplex} customTokens - The `customTokens` parameter is an object that contains
|
|
7
|
+
* custom token groups and their corresponding tokens. Each custom token group is represented by a key
|
|
8
|
+
* in the object, and the value is an array of tokens within that group.
|
|
9
|
+
* @returns an object called `tokensList`.
|
|
10
|
+
*/
|
|
11
|
+
export function getCustomTokenBoxParse(customTokens) {
|
|
12
|
+
const tokensList = {};
|
|
13
|
+
for (const tokenKey in customTokens) {
|
|
14
|
+
if (Object.prototype.hasOwnProperty.call(customTokens, tokenKey)) {
|
|
15
|
+
const subGroup = tokenKey === CUSTOM_TOKEN_DEFAULT_KEY ? "" : `.${camelize(tokenKey)}`;
|
|
16
|
+
tokensList[tokenKey] = customTokens[tokenKey].map((token) => ({
|
|
17
|
+
alias: token.label,
|
|
18
|
+
label: `{{customTokens${subGroup}.${token.key}}}`,
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return tokensList;
|
|
23
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ICustomTokensComplex, ICustomTokensSimple } from "../interfaces";
|
|
2
|
+
/**
|
|
3
|
+
* The function `getCustomtonTokens` takes a configuration object and returns a parsed version of the
|
|
4
|
+
* custom tokens.
|
|
5
|
+
* @param {ICustomTokensSimple | ICustomTokensComplex} customtonTokensConfig - The
|
|
6
|
+
* `customtonTokensConfig` parameter is an object that can be either of type `ICustomTokensSimple` or
|
|
7
|
+
* `ICustomTokensComplex`.
|
|
8
|
+
* @returns an object of type `ICustomTokensComplex`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getCustomtonTokens(customtonTokensConfig: ICustomTokensSimple | ICustomTokensComplex): ICustomTokensComplex;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CUSTOM_TOKEN_DEFAULT_KEY } from "../constants";
|
|
2
|
+
import { camelize } from "../general";
|
|
3
|
+
import { getCustomtonTokensWithKeys } from "./getCustomtonTokensWithKeys";
|
|
4
|
+
/**
|
|
5
|
+
* The function `getCustomtonTokens` takes a configuration object and returns a parsed version of the
|
|
6
|
+
* custom tokens.
|
|
7
|
+
* @param {ICustomTokensSimple | ICustomTokensComplex} customtonTokensConfig - The
|
|
8
|
+
* `customtonTokensConfig` parameter is an object that can be either of type `ICustomTokensSimple` or
|
|
9
|
+
* `ICustomTokensComplex`.
|
|
10
|
+
* @returns an object of type `ICustomTokensComplex`.
|
|
11
|
+
*/
|
|
12
|
+
export function getCustomtonTokens(customtonTokensConfig) {
|
|
13
|
+
const customTokensparsed = {
|
|
14
|
+
[CUSTOM_TOKEN_DEFAULT_KEY]: [],
|
|
15
|
+
};
|
|
16
|
+
for (const key in customtonTokensConfig) {
|
|
17
|
+
if (Object.prototype.hasOwnProperty.call(customtonTokensConfig, key)) {
|
|
18
|
+
if (typeof customtonTokensConfig[key] === "object") {
|
|
19
|
+
const tokensFromConfig = getCustomtonTokensWithKeys(customtonTokensConfig[key]);
|
|
20
|
+
if (key === CUSTOM_TOKEN_DEFAULT_KEY) {
|
|
21
|
+
customTokensparsed[key].push(...tokensFromConfig);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
customTokensparsed[key] = tokensFromConfig;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
const tokensFromConfig = customtonTokensConfig[key];
|
|
29
|
+
customTokensparsed[CUSTOM_TOKEN_DEFAULT_KEY].push({
|
|
30
|
+
label: key,
|
|
31
|
+
value: tokensFromConfig,
|
|
32
|
+
key: camelize(key),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return customTokensparsed;
|
|
38
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CustomTokens } from "../interfaces";
|
|
2
|
+
/**
|
|
3
|
+
* The function `getCustomtonTokensWithKeys` takes an array of `CustomTokens` objects and returns a new
|
|
4
|
+
* array with each object having a `key` property that is the camelized version of either the `key` or
|
|
5
|
+
* `label` property.
|
|
6
|
+
* @param {CustomTokens[]} customTokens - An array of objects representing custom tokens. Each object
|
|
7
|
+
* should have properties such as "key" and "label".
|
|
8
|
+
* @returns an array of `CustomTokens` objects. Each object in the array has an additional `key`
|
|
9
|
+
* property, which is generated by camelizing the `key` or `label` property of the original
|
|
10
|
+
* `CustomTokens` object.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getCustomtonTokensWithKeys(customTokens: CustomTokens[]): CustomTokens[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { camelize } from "../general";
|
|
2
|
+
/**
|
|
3
|
+
* The function `getCustomtonTokensWithKeys` takes an array of `CustomTokens` objects and returns a new
|
|
4
|
+
* array with each object having a `key` property that is the camelized version of either the `key` or
|
|
5
|
+
* `label` property.
|
|
6
|
+
* @param {CustomTokens[]} customTokens - An array of objects representing custom tokens. Each object
|
|
7
|
+
* should have properties such as "key" and "label".
|
|
8
|
+
* @returns an array of `CustomTokens` objects. Each object in the array has an additional `key`
|
|
9
|
+
* property, which is generated by camelizing the `key` or `label` property of the original
|
|
10
|
+
* `CustomTokens` object.
|
|
11
|
+
*/
|
|
12
|
+
export function getCustomtonTokensWithKeys(customTokens) {
|
|
13
|
+
return customTokens.map((token) => (Object.assign(Object.assign({}, token), { key: camelize((token === null || token === void 0 ? void 0 : token.key) || token.label) })));
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { getCustomtonTokensWithKeys } from "../../src/tokens/getCustomtonTokensWithKeys";
|
|
2
|
+
describe("getCustomtonTokensWithKeys", () => {
|
|
3
|
+
test("should add camelized key to custom tokens", () => {
|
|
4
|
+
const customTokens = [
|
|
5
|
+
{ label: "token one", value: "value1" },
|
|
6
|
+
{ label: "Token 2", value: "value2", key: "{{token dos}}" },
|
|
7
|
+
{ label: "3rd token", value: "value3" },
|
|
8
|
+
];
|
|
9
|
+
const result = getCustomtonTokensWithKeys(customTokens);
|
|
10
|
+
expect(result).toEqual([
|
|
11
|
+
{ label: "token one", value: "value1", key: "tokenOne" },
|
|
12
|
+
{ label: "Token 2", value: "value2", key: "tokenDos" },
|
|
13
|
+
{ label: "3rd token", value: "value3", key: "3rdToken" },
|
|
14
|
+
]);
|
|
15
|
+
});
|
|
16
|
+
test("should handle empty array", () => {
|
|
17
|
+
const emptyTokens = [];
|
|
18
|
+
const result = getCustomtonTokensWithKeys(emptyTokens);
|
|
19
|
+
expect(result).toEqual([]);
|
|
20
|
+
});
|
|
21
|
+
});
|
package/dist/tokens/index.d.ts
CHANGED
package/dist/tokens/index.js
CHANGED