@qrvey/utils 1.2.9-14 → 1.2.9-18

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 (191) hide show
  1. package/README.md +755 -652
  2. package/dist/cjs/filters/helpers/builder/getFilterBuilderGeneralConfig.js +1 -0
  3. package/dist/cjs/filters/helpers/ui/index.d.ts +1 -0
  4. package/dist/cjs/filters/helpers/ui/index.js +1 -0
  5. package/dist/cjs/filters/helpers/ui/transformFilterValues.d.ts +4 -0
  6. package/dist/cjs/filters/helpers/ui/transformFilterValues.js +22 -0
  7. package/dist/cjs/filters/interfaces/builder/IFilterBuilderGeneralConfig.d.ts +1 -0
  8. package/dist/cjs/filters/interfaces/panel/IFilterPanelConfig.d.ts +1 -0
  9. package/dist/cjs/filters/interfaces/ui/IFUTransformFilterValuesSettings.d.ts +6 -0
  10. package/dist/cjs/filters/interfaces/ui/IFUTransformFilterValuesSettings.js +2 -0
  11. package/dist/cjs/filters/interfaces/ui/index.d.ts +3 -2
  12. package/dist/cjs/filters/interfaces/ui/index.js +3 -2
  13. package/dist/cjs/format/definition.d.ts +17 -0
  14. package/dist/cjs/format/definition.js +31 -1
  15. package/dist/cjs/format/format.d.ts +2 -1
  16. package/dist/cjs/format/format.js +8 -5
  17. package/dist/cjs/format/index.d.ts +1 -0
  18. package/dist/cjs/format/index.js +1 -0
  19. package/dist/cjs/format/localization.d.ts +3 -0
  20. package/dist/cjs/format/localization.js +56 -0
  21. package/dist/cjs/globalization/helpers/getI18nCalendar.d.ts +4 -0
  22. package/dist/cjs/globalization/helpers/getI18nCalendar.js +69 -0
  23. package/dist/cjs/globalization/helpers/index.d.ts +1 -0
  24. package/dist/cjs/globalization/helpers/index.js +1 -0
  25. package/dist/cjs/globalization/interfaces/calendar/II18nCalendar.d.ts +7 -0
  26. package/dist/cjs/globalization/interfaces/calendar/II18nCalendar.js +2 -0
  27. package/dist/cjs/globalization/interfaces/calendar/II18nCalendarProperties.d.ts +9 -0
  28. package/dist/cjs/globalization/interfaces/calendar/II18nCalendarProperties.js +2 -0
  29. package/dist/cjs/globalization/interfaces/calendar/index.d.ts +2 -0
  30. package/dist/cjs/globalization/interfaces/calendar/index.js +14 -0
  31. package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilderFontOptions.d.ts +5 -3
  32. package/dist/cjs/globalization/interfaces/common/II18nCommon.d.ts +2 -0
  33. package/dist/cjs/globalization/interfaces/common/II18nDayNames.d.ts +7 -0
  34. package/dist/cjs/globalization/interfaces/filters/II18nFilter.d.ts +2 -0
  35. package/dist/cjs/globalization/interfaces/filters/II18nTokenBox.d.ts +6 -0
  36. package/dist/cjs/globalization/interfaces/filters/II18nTokenBox.js +2 -0
  37. package/dist/cjs/globalization/interfaces/index.d.ts +1 -0
  38. package/dist/cjs/globalization/interfaces/index.js +1 -0
  39. package/dist/cjs/globalization/labels/calendar/I18N_CALENDAR.d.ts +2 -0
  40. package/dist/cjs/globalization/labels/calendar/I18N_CALENDAR.js +10 -0
  41. package/dist/cjs/globalization/labels/calendar/index.d.ts +1 -0
  42. package/dist/cjs/globalization/labels/calendar/index.js +13 -0
  43. package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_LAYER_OPTIONS.js +1 -1
  44. package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +7 -5
  45. package/dist/cjs/globalization/labels/common/I18N_COMMON.js +2 -0
  46. package/dist/cjs/globalization/labels/common/I18N_DAY_NAMES.js +7 -0
  47. package/dist/cjs/globalization/labels/filters/I18N_FILTER.js +6 -0
  48. package/dist/cjs/globalization/labels/index.d.ts +1 -0
  49. package/dist/cjs/globalization/labels/index.js +1 -0
  50. package/dist/cjs/interfaces/format/IFormatConfig.Interface.d.ts +5 -0
  51. package/dist/cjs/interfaces/format/IFormatConfig.Interface.js +2 -0
  52. package/dist/cjs/interfaces/format/IFormatCurrency.Interface.d.ts +4 -0
  53. package/dist/cjs/interfaces/format/IFormatCurrency.Interface.js +2 -0
  54. package/dist/cjs/interfaces/format/IFormatOutputFormat.Interface.d.ts +8 -0
  55. package/dist/cjs/interfaces/format/IFormatOutputFormat.Interface.js +2 -0
  56. package/dist/cjs/interfaces/format/index.d.ts +3 -0
  57. package/dist/cjs/interfaces/format/index.js +15 -0
  58. package/dist/cjs/interfaces/general/IGeneralWidgetConfig.d.ts +2 -0
  59. package/dist/cjs/interfaces/index.d.ts +1 -0
  60. package/dist/cjs/interfaces/index.js +1 -0
  61. package/dist/cjs/qrvey/helpers/getValueWithSuffixes.d.ts +9 -0
  62. package/dist/cjs/qrvey/helpers/getValueWithSuffixes.js +23 -0
  63. package/dist/cjs/qrvey/helpers/index.d.ts +2 -0
  64. package/dist/cjs/qrvey/helpers/index.js +2 -0
  65. package/dist/cjs/qrvey/helpers/transformValue.d.ts +8 -0
  66. package/dist/cjs/qrvey/helpers/transformValue.js +46 -0
  67. package/dist/cjs/qrvey/interfaces/IGetValueWithSuffixesSettings.d.ts +11 -0
  68. package/dist/cjs/qrvey/interfaces/IGetValueWithSuffixesSettings.js +2 -0
  69. package/dist/cjs/qrvey/interfaces/ITransformValueSettings.d.ts +10 -0
  70. package/dist/cjs/qrvey/interfaces/ITransformValueSettings.js +2 -0
  71. package/dist/cjs/qrvey/interfaces/index.d.ts +2 -0
  72. package/dist/cjs/qrvey/interfaces/index.js +2 -0
  73. package/dist/cjs/services/api/getDatasetColumns.api.js +5 -1
  74. package/dist/filters/helpers/builder/getFilterBuilderGeneralConfig.js +1 -0
  75. package/dist/filters/helpers/ui/index.d.ts +1 -0
  76. package/dist/filters/helpers/ui/index.js +1 -0
  77. package/dist/filters/helpers/ui/transformFilterValues.d.ts +4 -0
  78. package/dist/filters/helpers/ui/transformFilterValues.js +18 -0
  79. package/dist/filters/interfaces/builder/IFilterBuilderGeneralConfig.d.ts +1 -0
  80. package/dist/filters/interfaces/panel/IFilterPanelConfig.d.ts +1 -0
  81. package/dist/filters/interfaces/ui/IFUTransformFilterValuesSettings.d.ts +6 -0
  82. package/dist/filters/interfaces/ui/IFUTransformFilterValuesSettings.js +1 -0
  83. package/dist/filters/interfaces/ui/index.d.ts +3 -2
  84. package/dist/filters/interfaces/ui/index.js +3 -2
  85. package/dist/format/definition.d.ts +17 -0
  86. package/dist/format/definition.js +30 -0
  87. package/dist/format/format.d.ts +2 -1
  88. package/dist/format/format.js +6 -3
  89. package/dist/format/index.d.ts +1 -0
  90. package/dist/format/index.js +1 -0
  91. package/dist/format/localization.d.ts +3 -0
  92. package/dist/format/localization.js +51 -0
  93. package/dist/globalization/helpers/getI18nCalendar.d.ts +4 -0
  94. package/dist/globalization/helpers/getI18nCalendar.js +65 -0
  95. package/dist/globalization/helpers/index.d.ts +1 -0
  96. package/dist/globalization/helpers/index.js +1 -0
  97. package/dist/globalization/interfaces/calendar/II18nCalendar.d.ts +7 -0
  98. package/dist/globalization/interfaces/calendar/II18nCalendar.js +1 -0
  99. package/dist/globalization/interfaces/calendar/II18nCalendarProperties.d.ts +9 -0
  100. package/dist/globalization/interfaces/calendar/II18nCalendarProperties.js +1 -0
  101. package/dist/globalization/interfaces/calendar/index.d.ts +2 -0
  102. package/dist/globalization/interfaces/calendar/index.js +2 -0
  103. package/dist/globalization/interfaces/chart_builder/II18nChartBuilderFontOptions.d.ts +5 -3
  104. package/dist/globalization/interfaces/common/II18nCommon.d.ts +2 -0
  105. package/dist/globalization/interfaces/common/II18nDayNames.d.ts +7 -0
  106. package/dist/globalization/interfaces/filters/II18nFilter.d.ts +2 -0
  107. package/dist/globalization/interfaces/filters/II18nTokenBox.d.ts +6 -0
  108. package/dist/globalization/interfaces/filters/II18nTokenBox.js +1 -0
  109. package/dist/globalization/interfaces/index.d.ts +1 -0
  110. package/dist/globalization/interfaces/index.js +1 -0
  111. package/dist/globalization/labels/calendar/I18N_CALENDAR.d.ts +2 -0
  112. package/dist/globalization/labels/calendar/I18N_CALENDAR.js +7 -0
  113. package/dist/globalization/labels/calendar/index.d.ts +1 -0
  114. package/dist/globalization/labels/calendar/index.js +1 -0
  115. package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_LAYER_OPTIONS.js +1 -1
  116. package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +7 -5
  117. package/dist/globalization/labels/common/I18N_COMMON.js +2 -0
  118. package/dist/globalization/labels/common/I18N_DAY_NAMES.js +7 -0
  119. package/dist/globalization/labels/filters/I18N_FILTER.js +6 -0
  120. package/dist/globalization/labels/index.d.ts +1 -0
  121. package/dist/globalization/labels/index.js +1 -0
  122. package/dist/interfaces/format/IFormatConfig.Interface.d.ts +5 -0
  123. package/dist/interfaces/format/IFormatConfig.Interface.js +1 -0
  124. package/dist/interfaces/format/IFormatCurrency.Interface.d.ts +4 -0
  125. package/dist/interfaces/format/IFormatCurrency.Interface.js +1 -0
  126. package/dist/interfaces/format/IFormatOutputFormat.Interface.d.ts +8 -0
  127. package/dist/interfaces/format/IFormatOutputFormat.Interface.js +1 -0
  128. package/dist/interfaces/format/index.d.ts +3 -0
  129. package/dist/interfaces/format/index.js +3 -0
  130. package/dist/interfaces/general/IGeneralWidgetConfig.d.ts +2 -0
  131. package/dist/interfaces/index.d.ts +1 -0
  132. package/dist/interfaces/index.js +1 -0
  133. package/dist/qrvey/helpers/getValueWithSuffixes.d.ts +9 -0
  134. package/dist/qrvey/helpers/getValueWithSuffixes.js +19 -0
  135. package/dist/qrvey/helpers/index.d.ts +2 -0
  136. package/dist/qrvey/helpers/index.js +2 -0
  137. package/dist/qrvey/helpers/transformValue.d.ts +8 -0
  138. package/dist/qrvey/helpers/transformValue.js +42 -0
  139. package/dist/qrvey/interfaces/IGetValueWithSuffixesSettings.d.ts +11 -0
  140. package/dist/qrvey/interfaces/IGetValueWithSuffixesSettings.js +1 -0
  141. package/dist/qrvey/interfaces/ITransformValueSettings.d.ts +10 -0
  142. package/dist/qrvey/interfaces/ITransformValueSettings.js +1 -0
  143. package/dist/qrvey/interfaces/index.d.ts +2 -0
  144. package/dist/qrvey/interfaces/index.js +2 -0
  145. package/dist/services/api/getDatasetColumns.api.js +5 -1
  146. package/package.json +1 -1
  147. package/src/filters/helpers/builder/getFilterBuilderGeneralConfig.ts +1 -0
  148. package/src/filters/helpers/ui/index.ts +1 -0
  149. package/src/filters/helpers/ui/transformFilterValues.ts +29 -0
  150. package/src/filters/interfaces/builder/IFilterBuilderGeneralConfig.ts +2 -1
  151. package/src/filters/interfaces/panel/IFilterPanelConfig.ts +1 -0
  152. package/src/filters/interfaces/ui/IFUTransformFilterValuesSettings.ts +7 -0
  153. package/src/filters/interfaces/ui/index.ts +3 -2
  154. package/src/format/definition.ts +45 -0
  155. package/src/format/format.ts +19 -15
  156. package/src/format/index.ts +1 -0
  157. package/src/format/localization.ts +52 -0
  158. package/src/globalization/helpers/getI18nCalendar.ts +68 -0
  159. package/src/globalization/helpers/index.ts +1 -0
  160. package/src/globalization/interfaces/calendar/II18nCalendar.ts +7 -0
  161. package/src/globalization/interfaces/calendar/II18nCalendarProperties.ts +9 -0
  162. package/src/globalization/interfaces/calendar/index.ts +2 -0
  163. package/src/globalization/interfaces/chart_builder/II18nChartBuilderFontOptions.ts +5 -3
  164. package/src/globalization/interfaces/common/II18nCommon.ts +2 -0
  165. package/src/globalization/interfaces/common/II18nDayNames.ts +8 -0
  166. package/src/globalization/interfaces/filters/II18nFilter.ts +2 -0
  167. package/src/globalization/interfaces/filters/II18nTokenBox.ts +6 -0
  168. package/src/globalization/interfaces/index.ts +1 -0
  169. package/src/globalization/labels/calendar/I18N_CALENDAR.ts +9 -0
  170. package/src/globalization/labels/calendar/index.ts +1 -0
  171. package/src/globalization/labels/chart_builder/I18N_CHART_BUILDER_LAYER_OPTIONS.ts +1 -1
  172. package/src/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.ts +8 -6
  173. package/src/globalization/labels/common/I18N_COMMON.ts +2 -0
  174. package/src/globalization/labels/common/I18N_DAY_NAMES.ts +8 -0
  175. package/src/globalization/labels/filters/I18N_FILTER.ts +6 -0
  176. package/src/globalization/labels/index.ts +1 -0
  177. package/src/interfaces/format/IFormatConfig.Interface.ts +5 -0
  178. package/src/interfaces/format/IFormatCurrency.Interface.ts +4 -0
  179. package/src/interfaces/format/IFormatOutputFormat.Interface.ts +9 -0
  180. package/src/interfaces/format/index.ts +3 -0
  181. package/src/interfaces/general/IGeneralWidgetConfig.ts +2 -0
  182. package/src/interfaces/index.ts +1 -0
  183. package/src/qrvey/helpers/getValueWithSuffixes.ts +19 -0
  184. package/src/qrvey/helpers/index.ts +2 -0
  185. package/src/qrvey/helpers/transformValue.ts +47 -0
  186. package/src/qrvey/interfaces/IGetValueWithSuffixesSettings.ts +12 -0
  187. package/src/qrvey/interfaces/ITransformValueSettings.ts +12 -0
  188. package/src/qrvey/interfaces/index.ts +2 -0
  189. package/src/services/api/getDatasetColumns.api.ts +4 -1
  190. package/test/columns/isNumericalColumn.test.js +154 -0
  191. package/test/format.test.js +11 -11
@@ -12,6 +12,7 @@ function getFilterBuilderGeneralConfig(config = {}) {
12
12
  apiKey: (0, getAttribute_1.getAttribute)(config, 'api_key') || config.apiKey,
13
13
  appid: (0, getAttribute_1.getAttribute)(config, 'app_id') || config.appid,
14
14
  domain: config.domain,
15
+ locale: config.locale,
15
16
  qv_token: config.qv_token,
16
17
  timezoneControl: (0, getAttribute_1.getAttribute)(config, 'timezone_control') || config.timezoneControl,
17
18
  userid: (0, getAttribute_1.getAttribute)(config, 'user_id') || config.userid,
@@ -8,3 +8,4 @@ export * from './getUIFlatFiltersByParams';
8
8
  export * from './getUIFlatFiltersByScopes';
9
9
  export * from './getUIValues';
10
10
  export * from './getUpdatedUIFilters';
11
+ export * from './transformFilterValues';
@@ -20,3 +20,4 @@ __exportStar(require("./getUIFlatFiltersByParams"), exports);
20
20
  __exportStar(require("./getUIFlatFiltersByScopes"), exports);
21
21
  __exportStar(require("./getUIValues"), exports);
22
22
  __exportStar(require("./getUpdatedUIFilters"), exports);
23
+ __exportStar(require("./transformFilterValues"), exports);
@@ -0,0 +1,4 @@
1
+ import { IFSFilter } from "../../interfaces/common/IFSFilter";
2
+ import { IFValue } from "../../interfaces/IFValue";
3
+ import { IFUTransformFilterValuesSettings } from "../../interfaces/ui/IFUTransformFilterValuesSettings";
4
+ export declare function transformFilterValues(filter: IFSFilter, settings: IFUTransformFilterValuesSettings): IFValue[];
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transformFilterValues = void 0;
4
+ const isEmpty_1 = require("../../../general/mix/isEmpty");
5
+ const transformValue_1 = require("../../../qrvey/helpers/transformValue");
6
+ const isRangeValidator_1 = require("../common/isRangeValidator");
7
+ const isRegularValidator_1 = require("../common/isRegularValidator");
8
+ function transformFilterValues(filter, settings) {
9
+ const transformValueSettings = Object.assign(Object.assign({}, settings), { column: filter.column, property: filter.property });
10
+ if ((0, isEmpty_1.isEmpty)(filter))
11
+ return [];
12
+ if ((0, isRegularValidator_1.isRegularValidator)(filter.validator)) {
13
+ return filter.values.map((value) => (Object.assign(Object.assign({}, value), { value: (0, transformValue_1.transformValue)(value.value, transformValueSettings) })));
14
+ }
15
+ else if ((0, isRangeValidator_1.isRangeValidator)(filter.validator)) {
16
+ return filter.values.map((value) => (Object.assign(Object.assign({}, value), { min: (0, transformValue_1.transformValue)(value.min, transformValueSettings), max: (0, transformValue_1.transformValue)(value.max, transformValueSettings) })));
17
+ }
18
+ else {
19
+ return filter.values;
20
+ }
21
+ }
22
+ exports.transformFilterValues = transformFilterValues;
@@ -7,5 +7,6 @@ export interface IFilterBuilderGeneralConfig {
7
7
  domain: string;
8
8
  qv_token?: string;
9
9
  timezoneControl?: string;
10
+ locale?: string;
10
11
  userid: string;
11
12
  }
@@ -7,4 +7,5 @@ import { IFUDataStore } from "../ui/IFUDataStore";
7
7
  export interface IFilterPanelConfig extends IFUDataStore {
8
8
  filterBuilderConfig?: IFilterBuilderConfig;
9
9
  i18n?: IResourceI18n;
10
+ locale?: string;
10
11
  }
@@ -0,0 +1,6 @@
1
+ import { II18nServiceTranslate } from "../../../globalization/interfaces/II18nServiceTranslate";
2
+ export interface IFUTransformFilterValuesSettings {
3
+ translate: II18nServiceTranslate;
4
+ locale: string;
5
+ suffixTranslateLabel?: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -18,7 +18,8 @@ export * from './IFUDataset';
18
18
  export * from './IFUFilter';
19
19
  export * from './IFUFilterExtras';
20
20
  export * from './IFUFlattenedFilter';
21
- export * from './IFUScope';
22
21
  export * from './IFUParamsToGetFilter';
23
- export * from './IFUValue';
22
+ export * from './IFUScope';
23
+ export * from './IFUTransformFilterValuesSettings';
24
24
  export * from './IFUUIValueSettings';
25
+ export * from './IFUValue';
@@ -30,7 +30,8 @@ __exportStar(require("./IFUDataset"), exports);
30
30
  __exportStar(require("./IFUFilter"), exports);
31
31
  __exportStar(require("./IFUFilterExtras"), exports);
32
32
  __exportStar(require("./IFUFlattenedFilter"), exports);
33
- __exportStar(require("./IFUScope"), exports);
34
33
  __exportStar(require("./IFUParamsToGetFilter"), exports);
35
- __exportStar(require("./IFUValue"), exports);
34
+ __exportStar(require("./IFUScope"), exports);
35
+ __exportStar(require("./IFUTransformFilterValuesSettings"), exports);
36
36
  __exportStar(require("./IFUUIValueSettings"), exports);
37
+ __exportStar(require("./IFUValue"), exports);
@@ -11,3 +11,20 @@ export declare const isComplexColumn: (column?: any) => boolean;
11
11
  export declare const isNumericalColumn: (column?: any) => boolean;
12
12
  export declare function supportNumericFormatting(chartType: ChartType): boolean;
13
13
  export declare const isTextColumn: (column: any) => boolean;
14
+ export declare const currencyISO: {
15
+ text: string;
16
+ label: string;
17
+ }[];
18
+ export declare const enum LOCALE_FORMATS {
19
+ DECIMAL = "Decimal",
20
+ CURRENCY = "Currency",
21
+ PERCENTAGE = "Percentage",
22
+ SCIENTIFIC = "Scientific"
23
+ }
24
+ export declare const enum LOCALE_STYLES {
25
+ DECIMAL = "decimal",
26
+ PERCENT = "percent",
27
+ CURRENCY = "currency",
28
+ SCIENTIFIC = "scientific"
29
+ }
30
+ export declare const LANG_DEFAULT = "en-US";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isTextColumn = exports.supportNumericFormatting = exports.isNumericalColumn = exports.isComplexColumn = exports.hasfileSizeProperty = exports.appliesFormatting = exports.DATEGROUP_FORMATTING_UNSUPPORT = exports.QUESTION_FORMAT_SUPPORT = exports.numericalFields = exports.complexFields = exports.textFields = void 0;
3
+ exports.LANG_DEFAULT = exports.currencyISO = exports.isTextColumn = exports.supportNumericFormatting = exports.isNumericalColumn = exports.isComplexColumn = exports.hasfileSizeProperty = exports.appliesFormatting = exports.DATEGROUP_FORMATTING_UNSUPPORT = exports.QUESTION_FORMAT_SUPPORT = exports.numericalFields = exports.complexFields = exports.textFields = void 0;
4
4
  const COLUMN_1 = require("../columns/constants/COLUMN");
5
5
  const Charts_Const_1 = require("../constants/Charts.Const");
6
6
  exports.textFields = [COLUMN_1.COLUMN.TEXTFIELD, COLUMN_1.COLUMN.TEXT_CATEGORY, COLUMN_1.COLUMN.TEXT_LABEL, COLUMN_1.COLUMN.TEXT_CATEGORY];
@@ -52,3 +52,33 @@ function supportNumericFormatting(chartType) {
52
52
  exports.supportNumericFormatting = supportNumericFormatting;
53
53
  const isTextColumn = (column) => exports.textFields.includes(column.type) || column.formulaType === 'string' || column.formulaType === 'boolean';
54
54
  exports.isTextColumn = isTextColumn;
55
+ exports.currencyISO = [
56
+ { text: 'Default', label: 'USD' },
57
+ { text: '$ (USD)', label: 'USD' },
58
+ { text: '€ (EUR)', label: 'EUR' },
59
+ { text: '¥ (JPY)', label: 'JPY' },
60
+ { text: '£ (GBP)', label: 'GBP' },
61
+ { text: '₩ (WON)', label: 'WON' },
62
+ { text: '$ (AUD)', label: 'AUD' },
63
+ { text: '$ (CAD)', label: 'CAD' },
64
+ { text: 'CHF (CHF)', label: 'CHF' },
65
+ { text: '¥ (CNY)', label: 'CNY' },
66
+ { text: 'kr (SEK)', label: 'SEK' },
67
+ { text: '$ (MXN)', label: 'MXN' },
68
+ { text: '$ (NZD)', label: 'NZD' },
69
+ { text: '$ (SGD)', label: 'SGD' },
70
+ { text: '$ (HKD)', label: 'HKD' },
71
+ { text: 'kr (NOK)', label: 'NOK' },
72
+ { text: '₩ (KRW)', label: 'KRW' },
73
+ { text: '₺ (TRY)', label: 'TRY' },
74
+ { text: '₹ (INR)', label: 'INR' },
75
+ { text: '₽ (RUB)', label: 'RUB' },
76
+ { text: 'R$ (BRL)', label: 'BRL' },
77
+ { text: 'R (ZAR)', label: 'ZAR' },
78
+ { text: 'kr (DKK)', label: 'DKK' },
79
+ { text: 'zł (PLN)', label: 'PLN' },
80
+ { text: 'NT$ (TWD)', label: 'TWD' },
81
+ { text: '฿ (THB)', label: 'THB' },
82
+ { text: 'RM (MYR)', label: 'MYR' }
83
+ ];
84
+ exports.LANG_DEFAULT = 'en-US';
@@ -1,3 +1,4 @@
1
+ import { IFormatConfig } from '..';
1
2
  export declare function formatDate(dateString: any, format: any): any;
2
3
  export declare function formatAbbreviated(num: any, decimals: any): any;
3
4
  /**
@@ -5,7 +6,7 @@ export declare function formatAbbreviated(num: any, decimals: any): any;
5
6
  * @param bytes type number
6
7
  */
7
8
  export declare function formatFileSize(bytes: number): string;
8
- export declare const formatValue: (value: any, outputFormat?: any, config?: any) => any;
9
+ export declare const addFormat: (value: any, outputFormat?: any, config?: IFormatConfig) => any;
9
10
  export declare const parseFormulaType: (type: string) => "DATE" | "NUMERIC" | "TEXT_LABEL";
10
11
  export declare const validateColumnType: (column: any) => any;
11
12
  export declare const defineFormat: (column?: any, isSimpleTable?: boolean, isCategoryDimension?: boolean) => any;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.defineFormat = exports.validateColumnType = exports.parseFormulaType = exports.formatValue = exports.formatFileSize = exports.formatAbbreviated = exports.formatDate = void 0;
6
+ exports.defineFormat = exports.validateColumnType = exports.parseFormulaType = exports.addFormat = exports.formatFileSize = exports.formatAbbreviated = exports.formatDate = void 0;
7
7
  const d3_1 = require("d3");
8
8
  const dayjs_1 = __importDefault(require("dayjs"));
9
9
  const definition_1 = require("./definition");
@@ -12,6 +12,7 @@ const isEmpty_1 = require("../general/mix/isEmpty");
12
12
  const get_1 = require("../general/object/get");
13
13
  const COLUMN_1 = require("../columns/constants/COLUMN");
14
14
  const FORMULA_1 = require("../formulas/constants/FORMULA");
15
+ const localization_1 = require("./localization");
15
16
  dayjs_1.default.extend(advancedFormat_1.default); // Add support to advanced formats https://day.js.org/docs/en/plugin/advanced-format
16
17
  /**
17
18
  * Apply to the given date format to a date value
@@ -83,16 +84,18 @@ function formatFileSize(bytes) {
83
84
  return megaBytes < 10 ? `${fixDecimals(megaBytes)} MB` : `${Math.round(megaBytes)} MB`;
84
85
  }
85
86
  exports.formatFileSize = formatFileSize;
86
- const formatValue = (value, outputFormat = 'None', config) => {
87
+ const addFormat = (value, outputFormat = 'None', config) => {
87
88
  if ((0, isEmpty_1.isEmpty)(value) || typeof value === 'object' && (0, isEmpty_1.isEmpty)(value[0]))
88
89
  return value;
89
90
  switch (outputFormat.type) {
90
91
  case 'DATE':
91
92
  case 'DATETIME':
92
- return formatDate(value, outputFormat.format);
93
+ return (config === null || config === void 0 ? void 0 : config.lang) && outputFormat.format === 'Default' ? (0, localization_1.formatWithLocale)(value, outputFormat, config) : formatDate(value, outputFormat.format);
93
94
  case 'NUMERIC': {
94
95
  const parse = parseFloat(value);
95
- return isNaN(parse) ? value : formatNumber(parse, outputFormat, config);
96
+ const withLocale = outputFormat.format !== 'Abbreviated' && outputFormat !== 'None' && (config === null || config === void 0 ? void 0 : config.lang);
97
+ return isNaN(parse) ? value : withLocale ? (0, localization_1.formatWithLocale)(value, outputFormat, config)
98
+ : formatNumber(parse, outputFormat, config);
96
99
  }
97
100
  case 'IMAGEUPLOAD':
98
101
  case 'FILEUPLOAD':
@@ -101,7 +104,7 @@ const formatValue = (value, outputFormat = 'None', config) => {
101
104
  return typeof value === 'number' ? value.toFixed(0) : value;
102
105
  }
103
106
  };
104
- exports.formatValue = formatValue;
107
+ exports.addFormat = addFormat;
105
108
  const parseFormulaType = (type) => {
106
109
  switch (type) {
107
110
  case FORMULA_1.FORMULA.NUMBER:
@@ -1 +1,2 @@
1
1
  export * from './format';
2
+ export * from './localization';
@@ -11,3 +11,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./format"), exports);
14
+ __exportStar(require("./localization"), exports);
@@ -0,0 +1,3 @@
1
+ import { IFormatConfig, IFormatOutputFormat } from '../interfaces';
2
+ export declare const getLang: (locale: string | Record<string, any>) => Record<string, any>;
3
+ export declare const formatWithLocale: (value: any, outputFormat: IFormatOutputFormat, config?: IFormatConfig) => any;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatWithLocale = exports.getLang = void 0;
4
+ const definition_1 = require("./definition");
5
+ const getLang = (locale) => {
6
+ if (!locale)
7
+ return;
8
+ else if (typeof locale === 'object')
9
+ return locale;
10
+ else
11
+ return { lang: locale === "browser" ? window.navigator.language : locale };
12
+ };
13
+ exports.getLang = getLang;
14
+ const formatWithLocale = (value, outputFormat, config = {}) => {
15
+ switch (outputFormat.type) {
16
+ case 'DATE':
17
+ case 'DATETIME':
18
+ return formatLocaleDate(value, config);
19
+ case 'NUMERIC':
20
+ return formatLocaleNumber(value, outputFormat, config);
21
+ }
22
+ };
23
+ exports.formatWithLocale = formatWithLocale;
24
+ function formatLocaleDate(value, config) {
25
+ const { lang = definition_1.LANG_DEFAULT, options } = config;
26
+ const dateParam = new Date(value);
27
+ try {
28
+ return new Intl.DateTimeFormat([lang, definition_1.LANG_DEFAULT], options).format(dateParam);
29
+ }
30
+ catch (error) {
31
+ return new Intl.DateTimeFormat(definition_1.LANG_DEFAULT, options).format(dateParam);
32
+ }
33
+ }
34
+ function formatLocaleNumber(value, outputFormat, config) {
35
+ const { lang = definition_1.LANG_DEFAULT, options } = config;
36
+ const langOpts = options || getLocaleOptions(outputFormat);
37
+ try {
38
+ return new Intl.NumberFormat([lang, definition_1.LANG_DEFAULT], langOpts).format(value);
39
+ }
40
+ catch (e) {
41
+ return new Intl.NumberFormat(definition_1.LANG_DEFAULT, langOpts).format(value);
42
+ }
43
+ }
44
+ function getLocaleOptions(outputFormat) {
45
+ const { format, decimals, currency, backup_currency } = outputFormat;
46
+ switch (format) {
47
+ case "Currency" /* CURRENCY */: {
48
+ const iso = definition_1.currencyISO.find(item => item.text === (currency.text || backup_currency.text));
49
+ return { style: "currency" /* CURRENCY */, currency: iso.label, maximumFractionDigits: decimals, minimumFractionDigits: 0 };
50
+ }
51
+ case "Scientific" /* SCIENTIFIC */: return { style: "decimal" /* DECIMAL */,
52
+ notation: "scientific" /* SCIENTIFIC */, maximumFractionDigits: decimals };
53
+ case "Percentage" /* PERCENTAGE */: return { style: "percent" /* PERCENT */, maximumFractionDigits: decimals };
54
+ default: return { style: "decimal" /* DECIMAL */, maximumFractionDigits: decimals };
55
+ }
56
+ }
@@ -0,0 +1,4 @@
1
+ import { II18nCalendarProperties } from "../interfaces/calendar/II18nCalendarProperties";
2
+ import { II18nServiceTranslate } from "../interfaces/II18nServiceTranslate";
3
+ import { I18nService } from "../service/i18nextBuilder";
4
+ export declare function getI18nCalendar(locale: I18nService | II18nServiceTranslate): II18nCalendarProperties;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getI18nCalendar = void 0;
4
+ const i18nextBuilder_1 = require("../service/i18nextBuilder");
5
+ function getI18nCalendar(locale) {
6
+ const localeOverride = locale instanceof i18nextBuilder_1.I18nService ? locale : typeof locale === 'function' ? { translate: locale } : undefined;
7
+ if (!localeOverride)
8
+ return undefined;
9
+ return {
10
+ clear: localeOverride.translate('common.calendar.clear'),
11
+ days: [
12
+ localeOverride.translate('common.day_names.sunday_dddd'),
13
+ localeOverride.translate('common.day_names.monday_dddd'),
14
+ localeOverride.translate('common.day_names.tuesday_dddd'),
15
+ localeOverride.translate('common.day_names.wednesday_dddd'),
16
+ localeOverride.translate('common.day_names.thursday_dddd'),
17
+ localeOverride.translate('common.day_names.friday_dddd'),
18
+ localeOverride.translate('common.day_names.saturday_dddd')
19
+ ],
20
+ daysMin: [
21
+ localeOverride.translate('common.day_names.sunday_dd'),
22
+ localeOverride.translate('common.day_names.monday_dd'),
23
+ localeOverride.translate('common.day_names.tuesday_dd'),
24
+ localeOverride.translate('common.day_names.wednesday_dd'),
25
+ localeOverride.translate('common.day_names.thursday_dd'),
26
+ localeOverride.translate('common.day_names.friday_dd'),
27
+ localeOverride.translate('common.day_names.saturday_dd')
28
+ ],
29
+ daysShort: [
30
+ localeOverride.translate('common.day_names.sunday_ddd'),
31
+ localeOverride.translate('common.day_names.monday_ddd'),
32
+ localeOverride.translate('common.day_names.tuesday_ddd'),
33
+ localeOverride.translate('common.day_names.wednesday_ddd'),
34
+ localeOverride.translate('common.day_names.thursday_ddd'),
35
+ localeOverride.translate('common.day_names.friday_ddd'),
36
+ localeOverride.translate('common.day_names.saturday_ddd')
37
+ ],
38
+ months: [
39
+ localeOverride.translate('common.date_grouping.january_mmmm'),
40
+ localeOverride.translate('common.date_grouping.february_mmmm'),
41
+ localeOverride.translate('common.date_grouping.march_mmmm'),
42
+ localeOverride.translate('common.date_grouping.april_mmmm'),
43
+ localeOverride.translate('common.date_grouping.may_mmmm'),
44
+ localeOverride.translate('common.date_grouping.june_mmmm'),
45
+ localeOverride.translate('common.date_grouping.july_mmmm'),
46
+ localeOverride.translate('common.date_grouping.august_mmmm'),
47
+ localeOverride.translate('common.date_grouping.september_mmmm'),
48
+ localeOverride.translate('common.date_grouping.october_mmmm'),
49
+ localeOverride.translate('common.date_grouping.november_mmmm'),
50
+ localeOverride.translate('common.date_grouping.december_mmmm')
51
+ ],
52
+ monthsShort: [
53
+ localeOverride.translate('common.date_grouping.january_mmm'),
54
+ localeOverride.translate('common.date_grouping.february_mmm'),
55
+ localeOverride.translate('common.date_grouping.march_mmm'),
56
+ localeOverride.translate('common.date_grouping.april_mmm'),
57
+ localeOverride.translate('common.date_grouping.may_mmm'),
58
+ localeOverride.translate('common.date_grouping.june_mmm'),
59
+ localeOverride.translate('common.date_grouping.july_mmm'),
60
+ localeOverride.translate('common.date_grouping.august_mmm'),
61
+ localeOverride.translate('common.date_grouping.september_mmm'),
62
+ localeOverride.translate('common.date_grouping.october_mmm'),
63
+ localeOverride.translate('common.date_grouping.november_mmm'),
64
+ localeOverride.translate('common.date_grouping.december_mmm')
65
+ ],
66
+ today: localeOverride.translate('common.calendar.today')
67
+ };
68
+ }
69
+ exports.getI18nCalendar = getI18nCalendar;
@@ -1,2 +1,3 @@
1
+ export * from './getI18nCalendar';
1
2
  export * from './getI18nDateGroupLabel';
2
3
  export * from './getReverseI18nGroupLabel';
@@ -10,5 +10,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
10
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./getI18nCalendar"), exports);
13
14
  __exportStar(require("./getI18nDateGroupLabel"), exports);
14
15
  __exportStar(require("./getReverseI18nGroupLabel"), exports);
@@ -0,0 +1,7 @@
1
+ export interface II18nCalendar {
2
+ clear: string;
3
+ hours: string;
4
+ minutes: string;
5
+ seconds: string;
6
+ today: string;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ export interface II18nCalendarProperties {
2
+ clear: string;
3
+ days: string[];
4
+ daysMin: string[];
5
+ daysShort: string[];
6
+ months: string[];
7
+ monthsShort: string[];
8
+ today: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export * from './II18nCalendar';
2
+ export * from './II18nCalendarProperties';
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./II18nCalendar"), exports);
14
+ __exportStar(require("./II18nCalendarProperties"), exports);
@@ -1,9 +1,11 @@
1
1
  export interface II18nChartBuilderFontOptions {
2
+ automatic_resize: string;
2
3
  color: string;
4
+ disabled: string;
5
+ select_option_placeholder: string;
6
+ size: string;
3
7
  style: string;
4
- style_regular: string;
5
8
  style_bold: string;
6
9
  style_italic: string;
7
- automatic_resize: string;
8
- size: string;
10
+ style_regular: string;
9
11
  }
@@ -5,8 +5,10 @@ import { II18nColumnTypesSuffixes } from "./II18nColumnTypesSuffixes";
5
5
  import { II18nDateGrouping } from "./II18nDateGrouping";
6
6
  import { II18nDayNames } from "./II18nDayNames";
7
7
  import { II18nUnits } from "./II18nUnits";
8
+ import { II18nCalendar } from "../calendar/II18nCalendar";
8
9
  export interface II18nCommon {
9
10
  aggregate_labels: II18nAgreggateLabels;
11
+ calendar: II18nCalendar;
10
12
  column_types: II18nColumnTypes;
11
13
  column_types_suffixes: II18nColumnTypesSuffixes;
12
14
  date_grouping: II18nDateGrouping;
@@ -1,4 +1,11 @@
1
1
  export interface II18nDayNames {
2
+ sunday_dd: string;
3
+ monday_dd: string;
4
+ tuesday_dd: string;
5
+ wednesday_dd: string;
6
+ thursday_dd: string;
7
+ friday_dd: string;
8
+ saturday_dd: string;
2
9
  sunday_ddd: string;
3
10
  monday_ddd: string;
4
11
  tuesday_ddd: string;
@@ -7,6 +7,7 @@ import { II18nFilterOperator } from "./II18nFilterOperator";
7
7
  import { II18nFilterScopes } from "./II18nFilterScopes";
8
8
  import { II18nFilterPanelScopeTitle } from "./II18nFilterPanelScopeTitle";
9
9
  import { II18nFilterDateSections } from "./II18nFilterDateSections";
10
+ import { II18nTokenBox } from './II18nTokenBox';
10
11
  export interface II18nFilter {
11
12
  date_sections: II18nFilterDateSections;
12
13
  operators: II18nFilterOperator;
@@ -15,6 +16,7 @@ export interface II18nFilter {
15
16
  scope_title: II18nFilterPanelScopeTitle;
16
17
  scopes: II18nFilterScopes;
17
18
  slidebar: II18nSlidebar;
19
+ token_box?: II18nTokenBox;
18
20
  validators: II18nFilterValidator;
19
21
  value_container: II18nValueContainer;
20
22
  }
@@ -0,0 +1,6 @@
1
+ export interface II18nTokenBox {
2
+ data_tokens?: string;
3
+ search?: string;
4
+ system_tokens?: string;
5
+ user_tokens?: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,5 @@
1
1
  export * from './bucket_builder/index';
2
+ export * from './calendar/index';
2
3
  export * from './chart_builder/index';
3
4
  export * from './columns/index';
4
5
  export * from './common/index';
@@ -11,6 +11,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./bucket_builder/index"), exports);
14
+ __exportStar(require("./calendar/index"), exports);
14
15
  __exportStar(require("./chart_builder/index"), exports);
15
16
  __exportStar(require("./columns/index"), exports);
16
17
  __exportStar(require("./common/index"), exports);
@@ -0,0 +1,2 @@
1
+ import { II18nCalendar } from "../../interfaces/calendar/II18nCalendar";
2
+ export declare const I18N_CALENDAR: II18nCalendar;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.I18N_CALENDAR = void 0;
4
+ exports.I18N_CALENDAR = {
5
+ clear: "Clear",
6
+ hours: 'Hours',
7
+ minutes: 'Minutes',
8
+ seconds: 'Seconds',
9
+ today: "Today"
10
+ };
@@ -0,0 +1 @@
1
+ export * from './I18N_CALENDAR';
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./I18N_CALENDAR"), exports);
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.I18N_CHART_BUILDER_LAYER_OPTIONS = void 0;
4
4
  exports.I18N_CHART_BUILDER_LAYER_OPTIONS = {
5
5
  trends_line: {
6
- title: 'Trends line',
6
+ title: 'Trend Line',
7
7
  type: 'Type',
8
8
  type_none: 'None',
9
9
  type_standard_linear_regression: 'Standard Linear Regression',
@@ -16,9 +16,9 @@ exports.I18N_CHART_BUILDER_STYLE_OPTIONS = {
16
16
  comparision_color: 'Comparision Color',
17
17
  data_labels_check: 'Data Labels',
18
18
  default_format_title: 'Format',
19
- display_outliers_check: 'Display outliers',
19
+ display_outliers_check: 'Display Outliers',
20
20
  line_opacity: 'Line Opacity',
21
- map_borders: 'Map borders',
21
+ map_borders: 'Map Borders',
22
22
  needle_color: 'Needle Color',
23
23
  opacity: 'Opacity',
24
24
  percentage_check: 'Percentage',
@@ -152,13 +152,15 @@ exports.I18N_CHART_BUILDER_STYLE_OPTIONS = {
152
152
  names_rotation: 'Names Rotation',
153
153
  },
154
154
  font_options: {
155
+ automatic_resize: 'Automatic Resize',
155
156
  color: 'Font Color',
157
+ disabled: '<i>Automatic Resize</i> is active, disable it to set the size manually.',
158
+ select_option_placeholder: 'Select Option',
159
+ size: 'Font Size',
156
160
  style: 'Font Style',
157
- style_regular: 'Regular',
158
161
  style_bold: 'Bold',
159
162
  style_italic: 'Italic',
160
- automatic_resize: 'Automatic Resize',
161
- size: 'Font Size',
163
+ style_regular: 'Regular',
162
164
  },
163
165
  circle_size: {
164
166
  title: 'Circle Size',
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.I18N_COMMON = void 0;
4
4
  const RELATIVE_UNIT_INFO_1 = require("../../../dates/relative/constants/RELATIVE_UNIT_INFO");
5
+ const calendar_1 = require("../calendar");
5
6
  const I18N_AGGREGATE_LABEL_1 = require("./I18N_AGGREGATE_LABEL");
6
7
  const I18N_COLUMN_LABEL_1 = require("./I18N_COLUMN_LABEL");
7
8
  const I18N_COLUMN_PROPERTY_LABEL_1 = require("./I18N_COLUMN_PROPERTY_LABEL");
@@ -9,6 +10,7 @@ const I18N_DATE_GROUPING_1 = require("./I18N_DATE_GROUPING");
9
10
  const I18N_DAY_NAMES_1 = require("./I18N_DAY_NAMES");
10
11
  exports.I18N_COMMON = {
11
12
  aggregate_labels: I18N_AGGREGATE_LABEL_1.I18N_AGGREGATE_LABEL,
13
+ calendar: calendar_1.I18N_CALENDAR,
12
14
  column_types: I18N_COLUMN_LABEL_1.I18N_COLUMN_LABEL,
13
15
  column_types_suffixes: {
14
16
  slidebar_one: 'Step',