@qrvey/utils 1.15.0-8 → 1.15.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.
Files changed (141) hide show
  1. package/dist/cjs/columns/constants/COLUMN_ICON.js +32 -32
  2. package/dist/cjs/columns/helpers/index.d.ts +1 -0
  3. package/dist/cjs/columns/helpers/index.js +1 -0
  4. package/dist/cjs/columns/helpers/isNumericalColumn.d.ts +1 -1
  5. package/dist/cjs/columns/helpers/isNumericalColumn.js +1 -1
  6. package/dist/cjs/columns/helpers/isStringColumn.d.ts +7 -0
  7. package/dist/cjs/columns/helpers/isStringColumn.js +19 -0
  8. package/dist/cjs/dates/relative/RelativeStatementAdapter.js +2 -1
  9. package/dist/cjs/elements/helpers/fixed.d.ts +96 -0
  10. package/dist/cjs/elements/helpers/fixed.js +248 -0
  11. package/dist/cjs/elements/helpers/gridStrategy.d.ts +29 -0
  12. package/dist/cjs/elements/helpers/gridStrategy.js +83 -0
  13. package/dist/cjs/elements/helpers/index.d.ts +3 -0
  14. package/dist/cjs/elements/helpers/index.js +22 -0
  15. package/dist/cjs/elements/helpers/responsive.d.ts +87 -0
  16. package/dist/cjs/elements/helpers/responsive.js +166 -0
  17. package/dist/cjs/elements/index.d.ts +2 -0
  18. package/dist/cjs/elements/index.js +18 -0
  19. package/dist/cjs/elements/interfaces/ICanvasGrid.d.ts +5 -0
  20. package/dist/cjs/elements/interfaces/ICanvasGrid.js +9 -0
  21. package/dist/cjs/elements/interfaces/IFixedPosition.d.ts +5 -0
  22. package/dist/cjs/elements/interfaces/IFixedPosition.js +2 -0
  23. package/dist/cjs/elements/interfaces/IVemCore.d.ts +29 -0
  24. package/dist/cjs/elements/interfaces/IVemCore.js +3 -0
  25. package/dist/cjs/elements/interfaces/IVemPosition.d.ts +44 -0
  26. package/dist/cjs/elements/interfaces/IVemPosition.js +8 -0
  27. package/dist/cjs/elements/interfaces/index.d.ts +4 -0
  28. package/dist/cjs/elements/interfaces/index.js +20 -0
  29. package/dist/cjs/elements/utils/element.d.ts +4 -0
  30. package/dist/cjs/elements/utils/element.js +28 -0
  31. package/dist/cjs/elements/utils/fixed.position.d.ts +12 -0
  32. package/dist/cjs/elements/utils/fixed.position.js +86 -0
  33. package/dist/cjs/elements/utils/general.d.ts +15 -0
  34. package/dist/cjs/elements/utils/general.js +20 -0
  35. package/dist/cjs/elements/utils/overlap.d.ts +63 -0
  36. package/dist/cjs/elements/utils/overlap.js +99 -0
  37. package/dist/cjs/elements/utils/position.d.ts +4 -0
  38. package/dist/cjs/elements/utils/position.js +5 -0
  39. package/dist/cjs/filters/adapters/FDToLogic.js +2 -1
  40. package/dist/cjs/filters/helpers/backend/buildExpression.js +1 -0
  41. package/dist/cjs/filters/helpers/backend/buildFilters.d.ts +5 -0
  42. package/dist/cjs/filters/helpers/backend/buildFilters.js +23 -1
  43. package/dist/cjs/filters/helpers/backend/getBackendValues.js +4 -1
  44. package/dist/cjs/filters/helpers/getAvailableScopesIDsByConfig.js +1 -0
  45. package/dist/cjs/filters/helpers/settings/getFilterSettings.js +1 -1
  46. package/dist/cjs/filters/interfaces/backend/IFBExpression.js +0 -1
  47. package/dist/cjs/general/array/getUniqueSimpleArray.d.ts +6 -0
  48. package/dist/cjs/general/array/getUniqueSimpleArray.js +14 -0
  49. package/dist/cjs/general/array/index.d.ts +1 -0
  50. package/dist/cjs/general/array/index.js +1 -0
  51. package/dist/cjs/general/string/index.d.ts +4 -0
  52. package/dist/cjs/general/string/index.js +4 -0
  53. package/dist/cjs/general/string/secureHTML.d.ts +8 -0
  54. package/dist/cjs/general/string/secureHTML.js +13 -0
  55. package/dist/cjs/general/string/strategies/XSSEstrictedSanitizer.d.ts +8 -0
  56. package/dist/cjs/general/string/strategies/XSSEstrictedSanitizer.js +23 -0
  57. package/dist/cjs/general/string/strategies/XSSSanitizer.d.ts +8 -0
  58. package/dist/cjs/general/string/strategies/XSSSanitizer.js +19 -0
  59. package/dist/cjs/general/string/urlValidator.d.ts +10 -0
  60. package/dist/cjs/general/string/urlValidator.js +38 -0
  61. package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilderSorting.d.ts +2 -0
  62. package/dist/cjs/globalization/interfaces/export/II18nExportingModal.d.ts +6 -0
  63. package/dist/cjs/globalization/interfaces/export/II18nExportingModalApplyButtonLabel.d.ts +1 -0
  64. package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_GENERAL_OPTIONS.js +2 -0
  65. package/dist/cjs/globalization/labels/export/I18N_EXPORT_MODAL.js +10 -1
  66. package/dist/cjs/index.d.ts +1 -0
  67. package/dist/cjs/index.js +1 -0
  68. package/dist/cjs/interfaces/SatinizerStrategy.d.ts +3 -0
  69. package/dist/cjs/interfaces/SatinizerStrategy.js +2 -0
  70. package/dist/cjs/themes/constants/AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_LIGHT.js +3 -3
  71. package/dist/columns/constants/COLUMN_ICON.js +32 -32
  72. package/dist/columns/helpers/index.d.ts +1 -0
  73. package/dist/columns/helpers/index.js +1 -0
  74. package/dist/columns/helpers/isNumericalColumn.d.ts +1 -1
  75. package/dist/columns/helpers/isNumericalColumn.js +1 -1
  76. package/dist/columns/helpers/isStringColumn.d.ts +7 -0
  77. package/dist/columns/helpers/isStringColumn.js +15 -0
  78. package/dist/dates/relative/RelativeStatementAdapter.js +2 -1
  79. package/dist/elements/helpers/fixed.d.ts +96 -0
  80. package/dist/elements/helpers/fixed.js +236 -0
  81. package/dist/elements/helpers/gridStrategy.d.ts +29 -0
  82. package/dist/elements/helpers/gridStrategy.js +78 -0
  83. package/dist/elements/helpers/index.d.ts +3 -0
  84. package/dist/elements/helpers/index.js +3 -0
  85. package/dist/elements/helpers/responsive.d.ts +87 -0
  86. package/dist/elements/helpers/responsive.js +155 -0
  87. package/dist/elements/index.d.ts +2 -0
  88. package/dist/elements/index.js +2 -0
  89. package/dist/elements/interfaces/ICanvasGrid.d.ts +5 -0
  90. package/dist/elements/interfaces/ICanvasGrid.js +6 -0
  91. package/dist/elements/interfaces/IFixedPosition.d.ts +5 -0
  92. package/dist/elements/interfaces/IFixedPosition.js +1 -0
  93. package/dist/elements/interfaces/IVemCore.d.ts +29 -0
  94. package/dist/elements/interfaces/IVemCore.js +1 -0
  95. package/dist/elements/interfaces/IVemPosition.d.ts +44 -0
  96. package/dist/elements/interfaces/IVemPosition.js +5 -0
  97. package/dist/elements/interfaces/index.d.ts +4 -0
  98. package/dist/elements/interfaces/index.js +4 -0
  99. package/dist/elements/utils/element.d.ts +4 -0
  100. package/dist/elements/utils/element.js +24 -0
  101. package/dist/elements/utils/fixed.position.d.ts +12 -0
  102. package/dist/elements/utils/fixed.position.js +72 -0
  103. package/dist/elements/utils/general.d.ts +15 -0
  104. package/dist/elements/utils/general.js +16 -0
  105. package/dist/elements/utils/overlap.d.ts +63 -0
  106. package/dist/elements/utils/overlap.js +95 -0
  107. package/dist/elements/utils/position.d.ts +4 -0
  108. package/dist/elements/utils/position.js +1 -0
  109. package/dist/filters/adapters/FDToLogic.js +2 -1
  110. package/dist/filters/helpers/backend/buildExpression.js +1 -0
  111. package/dist/filters/helpers/backend/buildFilters.d.ts +5 -0
  112. package/dist/filters/helpers/backend/buildFilters.js +23 -1
  113. package/dist/filters/helpers/backend/getBackendValues.js +4 -1
  114. package/dist/filters/helpers/getAvailableScopesIDsByConfig.js +1 -0
  115. package/dist/filters/helpers/settings/getFilterSettings.js +1 -1
  116. package/dist/filters/interfaces/backend/IFBExpression.js +0 -1
  117. package/dist/general/array/getUniqueSimpleArray.d.ts +6 -0
  118. package/dist/general/array/getUniqueSimpleArray.js +10 -0
  119. package/dist/general/array/index.d.ts +1 -0
  120. package/dist/general/array/index.js +1 -0
  121. package/dist/general/string/index.d.ts +4 -0
  122. package/dist/general/string/index.js +4 -0
  123. package/dist/general/string/secureHTML.d.ts +8 -0
  124. package/dist/general/string/secureHTML.js +9 -0
  125. package/dist/general/string/strategies/XSSEstrictedSanitizer.d.ts +8 -0
  126. package/dist/general/string/strategies/XSSEstrictedSanitizer.js +19 -0
  127. package/dist/general/string/strategies/XSSSanitizer.d.ts +8 -0
  128. package/dist/general/string/strategies/XSSSanitizer.js +15 -0
  129. package/dist/general/string/urlValidator.d.ts +10 -0
  130. package/dist/general/string/urlValidator.js +34 -0
  131. package/dist/globalization/interfaces/chart_builder/II18nChartBuilderSorting.d.ts +2 -0
  132. package/dist/globalization/interfaces/export/II18nExportingModal.d.ts +6 -0
  133. package/dist/globalization/interfaces/export/II18nExportingModalApplyButtonLabel.d.ts +1 -0
  134. package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_GENERAL_OPTIONS.js +2 -0
  135. package/dist/globalization/labels/export/I18N_EXPORT_MODAL.js +10 -1
  136. package/dist/index.d.ts +1 -0
  137. package/dist/index.js +1 -0
  138. package/dist/interfaces/SatinizerStrategy.d.ts +3 -0
  139. package/dist/interfaces/SatinizerStrategy.js +1 -0
  140. package/dist/themes/constants/AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_LIGHT.js +3 -3
  141. package/package.json +3 -2
@@ -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
- logics.push(Object.assign(Object.assign({}, logic), { filters }));
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
- import { buildExpression } from "./buildExpression";
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.map((value) => getValue(value, value)).filter(Boolean);
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
  }
@@ -16,7 +16,6 @@ import { getScopesToDisplay } from "./getScopesToDisplay";
16
16
  */
17
17
  export function getFilterSettings(filterSettings, allowedScopes = [], otherSettings) {
18
18
  let settings = mergeDeep(FILTER_SETTINGS_DEFAULT, objectCopy(filterSettings));
19
- settings = mergeDeep(settings, otherSettings);
20
19
  const scopesSettings = getScopesToDisplay(settings).filter((scope) => allowedScopes.includes(scope.id));
21
20
  if (scopesSettings.length > 1) {
22
21
  settings = getFilterSettingsByMultipleScopes(settings, allowedScopes);
@@ -27,6 +26,7 @@ export function getFilterSettings(filterSettings, allowedScopes = [], otherSetti
27
26
  else {
28
27
  settings = getFilterSettingsByNoScopes(settings);
29
28
  }
29
+ settings = mergeDeep(settings, otherSettings);
30
30
  return settings;
31
31
  }
32
32
  /**
@@ -3,4 +3,3 @@ export {};
3
3
  //
4
4
  // formulaType?: string;
5
5
  // linkid?: string;
6
- // qrveyid?: string;
@@ -0,0 +1,6 @@
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 declare function getUniqueSimpleArray<T = unknown>(arr: T[]): T[];
@@ -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
+ }
@@ -0,0 +1,34 @@
1
+ export class URLValidator {
2
+ constructor(domains = [], protocols = ["http", "https"]) {
3
+ this.validDomains = domains;
4
+ this.validProtocols = protocols;
5
+ }
6
+ setValidDomains(domains = []) {
7
+ this.validDomains = domains;
8
+ return this;
9
+ }
10
+ setValidProtocols(protocols = []) {
11
+ this.validProtocols = protocols;
12
+ return this;
13
+ }
14
+ validate(url) {
15
+ try {
16
+ const urlObj = new URL(url);
17
+ return (this.isValidProtocol(urlObj.protocol) &&
18
+ (this.validDomains.length === 0 || this.isValidDomain(urlObj.hostname)));
19
+ }
20
+ catch (_a) {
21
+ return false;
22
+ }
23
+ }
24
+ isValidProtocol(protocol) {
25
+ const normalizedProtocol = protocol.replace(":", "").toLowerCase();
26
+ return this.validProtocols.includes(normalizedProtocol);
27
+ }
28
+ isValidDomain(domain) {
29
+ if (this.validDomains.length === 0) {
30
+ return true;
31
+ }
32
+ return this.validDomains.some((validDomain) => domain.endsWith(validDomain));
33
+ }
34
+ }
@@ -17,4 +17,6 @@ export interface II18nChartBuilderSorting {
17
17
  sorting_by_calculated_value: string;
18
18
  title: string;
19
19
  value: string;
20
+ empty_row_message?: string;
21
+ empty_column_message?: string;
20
22
  }
@@ -7,16 +7,20 @@ export interface I18nExportingModal {
7
7
  cancel_button_label: string;
8
8
  error_messages: II18nExportingModalErrorMessages;
9
9
  file_name_label: string;
10
+ new_dataset_name_label: string;
11
+ new_dataset_name_placeholder: string;
10
12
  recurrence: II18nExportingModalRecurrence;
11
13
  time_stamp: II18nExportingModalTimeStamp;
12
14
  time_zone_label: string;
13
15
  title_label: string;
16
+ title_new_dataset: string;
14
17
  uniqueness_concatenate: string;
15
18
  toast_messages: {
16
19
  failed_scheduling: string;
17
20
  successful_scheduling: string;
18
21
  };
19
22
  pivoting_export: {
23
+ source_label: string;
20
24
  dataset_label: string;
21
25
  filter_label: string;
22
26
  pivoting: {
@@ -28,12 +32,14 @@ export interface I18nExportingModal {
28
32
  columns_section: {
29
33
  title: string;
30
34
  subtitle: string;
35
+ subtitle_new_dataset: string;
31
36
  select_all_label: string;
32
37
  dataset_columns: string;
33
38
  pivot_columns_label: string;
34
39
  pivot_columns_sublabel: string;
35
40
  };
36
41
  columns_to_export_label: string;
42
+ columns_to_create_dataset_label: string;
37
43
  no_results_found: string;
38
44
  };
39
45
  schedule: {
@@ -1,3 +1,4 @@
1
1
  export interface II18nExportingModalApplyButtonLabel {
2
2
  export_now: string;
3
+ create_dataset: string;
3
4
  }
@@ -99,6 +99,8 @@ export const I18N_CHART_BUILDER_GENERAL_OPTIONS = {
99
99
  sorting_by_calculated_value: "Sorting by Calculated Value",
100
100
  title: "Sorting",
101
101
  value: "Value",
102
+ empty_row_message: "Add rows to apply sorting",
103
+ empty_column_message: "Add columns to apply sorting",
102
104
  },
103
105
  menu_actions: {
104
106
  title: "Self-service Options",
@@ -2,12 +2,17 @@
2
2
  * @deprecated since version 1.12.0; Qrvey version 8.3. Those default poroperties will be replaced by Qrvey Globalization JSON
3
3
  */
4
4
  export const EXPORTING_MODAL = {
5
- apply_button_label: { export_now: "Export Now" },
5
+ apply_button_label: {
6
+ export_now: "Export Now",
7
+ create_dataset: "Create Dataset",
8
+ },
6
9
  cancel_button_label: "Cancel",
7
10
  error_messages: {
8
11
  special_characters: "Special characters are not allowed in file name.",
9
12
  },
10
13
  file_name_label: "File Name",
14
+ new_dataset_name_label: "New Dataset Name",
15
+ new_dataset_name_placeholder: "Type",
11
16
  recurrence: {
12
17
  label: "Recurrence",
13
18
  value: { does_not_repeat: "Does not repeat" },
@@ -19,12 +24,14 @@ export const EXPORTING_MODAL = {
19
24
  },
20
25
  time_zone_label: "Time Zone",
21
26
  title_label: "Export",
27
+ title_new_dataset: "New Dataset",
22
28
  uniqueness_concatenate: "For Uniqueness Concatenate",
23
29
  toast_messages: {
24
30
  failed_scheduling: "The export could not be scheduled at this time.",
25
31
  successful_scheduling: "The export of {{fileName}} has been scheduled successfully.",
26
32
  },
27
33
  pivoting_export: {
34
+ source_label: "Source",
28
35
  dataset_label: "Dataset",
29
36
  filter_label: "Filter",
30
37
  pivoting: {
@@ -36,12 +43,14 @@ export const EXPORTING_MODAL = {
36
43
  columns_section: {
37
44
  title: "Columns",
38
45
  subtitle: "(Select columns to export)",
46
+ subtitle_new_dataset: "(Select columns for new dataset)",
39
47
  select_all_label: "Add All Columns",
40
48
  dataset_columns: "Dataset Columns",
41
49
  pivot_columns_label: "Pivot Columns",
42
50
  pivot_columns_sublabel: "Displaying only the first 100 results.",
43
51
  },
44
52
  columns_to_export_label: "Columns to export",
53
+ columns_to_create_dataset_label: "Dataset columns",
45
54
  no_results_found: "No results found",
46
55
  },
47
56
  schedule: {
package/dist/index.d.ts CHANGED
@@ -16,3 +16,4 @@ export * from "./typescript/index";
16
16
  export * from "./tokens/index";
17
17
  export * from "./column_format/index";
18
18
  export * from "./themes/index";
19
+ export * from "./elements/index";
package/dist/index.js CHANGED
@@ -16,3 +16,4 @@ export * from "./typescript/index";
16
16
  export * from "./tokens/index";
17
17
  export * from "./column_format/index";
18
18
  export * from "./themes/index";
19
+ export * from "./elements/index";
@@ -0,0 +1,3 @@
1
+ export interface SanitizerStrategy {
2
+ sanitize(html: string): string;
3
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -3,10 +3,10 @@ import { GLOBAL_CSS_VARIABLES } from "./GLOBAL_CSS_VARIABLES";
3
3
  * Collection of CSS Variables for Light Themes and its assigned values.
4
4
  */
5
5
  export const AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_LIGHT = {
6
- [GLOBAL_CSS_VARIABLES.HEADER_BACKGROUND_COLOR]: "#00000009",
6
+ [GLOBAL_CSS_VARIABLES.HEADER_BACKGROUND_COLOR]: "#F7F8FB",
7
7
  [GLOBAL_CSS_VARIABLES.BACKGROUND_OPACITY_BLACK_COLOR]: "#FFFFFF10",
8
- [GLOBAL_CSS_VARIABLES.BORDER_COLOR]: "#00000020",
9
- [GLOBAL_CSS_VARIABLES.DIVIDER_COLOR]: "#00000020",
8
+ [GLOBAL_CSS_VARIABLES.BORDER_COLOR]: "#00000017",
9
+ [GLOBAL_CSS_VARIABLES.DIVIDER_COLOR]: "#00000010",
10
10
  [GLOBAL_CSS_VARIABLES.HOVER_COLOR]: "#00000010",
11
11
  [GLOBAL_CSS_VARIABLES.PLACEHOLDER_COLOR]: "#00000070",
12
12
  [GLOBAL_CSS_VARIABLES.PILLS_BACKGROUND_COLOR]: "#FFFFFF40",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.15.0-8",
3
+ "version": "1.15.0",
4
4
  "description": "Helper, Utils for all Qrvey Projects",
5
5
  "homepage": "https://bitbucket.org/qrvey/qrvey_utils/wiki/Home",
6
6
  "main": "dist/index.js",
@@ -54,7 +54,8 @@
54
54
  "@stencil/store": "2.0.13",
55
55
  "d3-format": "2.0.0",
56
56
  "dayjs": "1.11.10",
57
- "i18next": "23.7.16"
57
+ "i18next": "23.7.16",
58
+ "xss": "1.0.15"
58
59
  },
59
60
  "files": [
60
61
  "dist/**/*"