@qrvey/utils 1.2.9-13 → 1.2.9-17

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 (209) hide show
  1. package/README.md +926 -766
  2. package/dist/charts/constants/AGGREGATE_LABEL.d.ts +1 -1
  3. package/dist/charts/constants/AGGREGATE_LABEL.js +1 -1
  4. package/dist/cjs/charts/constants/AGGREGATE_LABEL.d.ts +1 -1
  5. package/dist/cjs/charts/constants/AGGREGATE_LABEL.js +1 -1
  6. package/dist/cjs/filters/helpers/builder/getFilterBuilderGeneralConfig.js +1 -0
  7. package/dist/cjs/filters/helpers/ui/getQrveyIdsByUIFilters.d.ts +7 -0
  8. package/dist/cjs/filters/helpers/ui/getQrveyIdsByUIFilters.js +24 -0
  9. package/dist/cjs/filters/helpers/ui/getUpdatedUIFilters.d.ts +9 -0
  10. package/dist/cjs/filters/helpers/ui/getUpdatedUIFilters.js +36 -0
  11. package/dist/cjs/filters/helpers/ui/index.d.ts +3 -0
  12. package/dist/cjs/filters/helpers/ui/index.js +3 -0
  13. package/dist/cjs/filters/helpers/ui/transformFilterValues.d.ts +4 -0
  14. package/dist/cjs/filters/helpers/ui/transformFilterValues.js +22 -0
  15. package/dist/cjs/filters/interfaces/builder/IFilterBuilderGeneralConfig.d.ts +1 -0
  16. package/dist/cjs/filters/interfaces/panel/IFPSettingsGeneral.d.ts +2 -1
  17. package/dist/cjs/filters/interfaces/panel/IFilterPanelConfig.d.ts +1 -0
  18. package/dist/cjs/filters/interfaces/ui/IFUTransformFilterValuesSettings.d.ts +6 -0
  19. package/dist/cjs/filters/interfaces/ui/IFUTransformFilterValuesSettings.js +2 -0
  20. package/dist/cjs/filters/interfaces/ui/index.d.ts +3 -2
  21. package/dist/cjs/filters/interfaces/ui/index.js +3 -2
  22. package/dist/cjs/format/definition.d.ts +17 -0
  23. package/dist/cjs/format/definition.js +31 -1
  24. package/dist/cjs/format/format.d.ts +2 -1
  25. package/dist/cjs/format/format.js +8 -5
  26. package/dist/cjs/format/index.d.ts +1 -0
  27. package/dist/cjs/format/index.js +1 -0
  28. package/dist/cjs/format/localization.d.ts +3 -0
  29. package/dist/cjs/format/localization.js +56 -0
  30. package/dist/cjs/globalization/interfaces/IResourceI18n.d.ts +2 -0
  31. package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilderFontOptions.d.ts +5 -3
  32. package/dist/cjs/globalization/interfaces/index.d.ts +4 -1
  33. package/dist/cjs/globalization/interfaces/index.js +4 -1
  34. package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemes.d.ts +13 -0
  35. package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemes.js +2 -0
  36. package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesDeleteDialog.d.ts +6 -0
  37. package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesDeleteDialog.js +2 -0
  38. package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesMenu.d.ts +6 -0
  39. package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesMenu.js +2 -0
  40. package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesMessages.d.ts +9 -0
  41. package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesMessages.js +2 -0
  42. package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesTheme.d.ts +27 -0
  43. package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesTheme.js +2 -0
  44. package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesTooltips.d.ts +3 -0
  45. package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesTooltips.js +2 -0
  46. package/dist/cjs/globalization/interfaces/style_themes/index.d.ts +6 -0
  47. package/dist/cjs/globalization/interfaces/style_themes/index.js +18 -0
  48. package/dist/cjs/globalization/labels/I18N_DEFAULT.js +2 -0
  49. package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_LAYER_OPTIONS.js +1 -1
  50. package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +7 -5
  51. package/dist/cjs/globalization/labels/index.d.ts +5 -3
  52. package/dist/cjs/globalization/labels/index.js +5 -3
  53. package/dist/cjs/globalization/labels/style_themes/I18N_STYLE_THEMES.d.ts +2 -0
  54. package/dist/cjs/globalization/labels/style_themes/I18N_STYLE_THEMES.js +57 -0
  55. package/dist/cjs/globalization/labels/style_themes/index.d.ts +1 -0
  56. package/dist/cjs/globalization/labels/style_themes/index.js +13 -0
  57. package/dist/cjs/globalization/labels/table_charts/I18N_TABLE_CHARTS.js +1 -1
  58. package/dist/cjs/interfaces/format/IFormatConfig.Interface.d.ts +5 -0
  59. package/dist/cjs/interfaces/format/IFormatConfig.Interface.js +2 -0
  60. package/dist/cjs/interfaces/format/IFormatCurrency.Interface.d.ts +4 -0
  61. package/dist/cjs/interfaces/format/IFormatCurrency.Interface.js +2 -0
  62. package/dist/cjs/interfaces/format/IFormatOutputFormat.Interface.d.ts +8 -0
  63. package/dist/cjs/interfaces/format/IFormatOutputFormat.Interface.js +2 -0
  64. package/dist/cjs/interfaces/format/index.d.ts +3 -0
  65. package/dist/cjs/interfaces/format/index.js +15 -0
  66. package/dist/cjs/interfaces/general/IGeneralWidgetConfig.d.ts +2 -0
  67. package/dist/cjs/interfaces/index.d.ts +1 -0
  68. package/dist/cjs/interfaces/index.js +1 -0
  69. package/dist/cjs/qrvey/helpers/getValueWithSuffixes.d.ts +9 -0
  70. package/dist/cjs/qrvey/helpers/getValueWithSuffixes.js +23 -0
  71. package/dist/cjs/qrvey/helpers/index.d.ts +2 -0
  72. package/dist/cjs/qrvey/helpers/index.js +2 -0
  73. package/dist/cjs/qrvey/helpers/transformValue.d.ts +8 -0
  74. package/dist/cjs/qrvey/helpers/transformValue.js +46 -0
  75. package/dist/cjs/qrvey/interfaces/IGetValueWithSuffixesSettings.d.ts +11 -0
  76. package/dist/cjs/qrvey/interfaces/IGetValueWithSuffixesSettings.js +2 -0
  77. package/dist/cjs/qrvey/interfaces/ITransformValueSettings.d.ts +10 -0
  78. package/dist/cjs/qrvey/interfaces/ITransformValueSettings.js +2 -0
  79. package/dist/cjs/qrvey/interfaces/index.d.ts +2 -0
  80. package/dist/cjs/qrvey/interfaces/index.js +2 -0
  81. package/dist/cjs/services/api/getAllDatasets.api.d.ts +2 -1
  82. package/dist/cjs/services/api/getAllDatasets.api.js +2 -1
  83. package/dist/cjs/services/api/getDatasetColumns.api.js +3 -0
  84. package/dist/filters/helpers/builder/getFilterBuilderGeneralConfig.js +1 -0
  85. package/dist/filters/helpers/ui/getQrveyIdsByUIFilters.d.ts +7 -0
  86. package/dist/filters/helpers/ui/getQrveyIdsByUIFilters.js +20 -0
  87. package/dist/filters/helpers/ui/getUpdatedUIFilters.d.ts +9 -0
  88. package/dist/filters/helpers/ui/getUpdatedUIFilters.js +32 -0
  89. package/dist/filters/helpers/ui/index.d.ts +3 -0
  90. package/dist/filters/helpers/ui/index.js +3 -0
  91. package/dist/filters/helpers/ui/transformFilterValues.d.ts +4 -0
  92. package/dist/filters/helpers/ui/transformFilterValues.js +18 -0
  93. package/dist/filters/interfaces/builder/IFilterBuilderGeneralConfig.d.ts +1 -0
  94. package/dist/filters/interfaces/panel/IFPSettingsGeneral.d.ts +2 -1
  95. package/dist/filters/interfaces/panel/IFilterPanelConfig.d.ts +1 -0
  96. package/dist/filters/interfaces/ui/IFUTransformFilterValuesSettings.d.ts +6 -0
  97. package/dist/filters/interfaces/ui/IFUTransformFilterValuesSettings.js +1 -0
  98. package/dist/filters/interfaces/ui/index.d.ts +3 -2
  99. package/dist/filters/interfaces/ui/index.js +3 -2
  100. package/dist/format/definition.d.ts +17 -0
  101. package/dist/format/definition.js +30 -0
  102. package/dist/format/format.d.ts +2 -1
  103. package/dist/format/format.js +6 -3
  104. package/dist/format/index.d.ts +1 -0
  105. package/dist/format/index.js +1 -0
  106. package/dist/format/localization.d.ts +3 -0
  107. package/dist/format/localization.js +51 -0
  108. package/dist/globalization/interfaces/IResourceI18n.d.ts +2 -0
  109. package/dist/globalization/interfaces/chart_builder/II18nChartBuilderFontOptions.d.ts +5 -3
  110. package/dist/globalization/interfaces/index.d.ts +4 -1
  111. package/dist/globalization/interfaces/index.js +4 -1
  112. package/dist/globalization/interfaces/style_themes/II18nStyleThemes.d.ts +13 -0
  113. package/dist/globalization/interfaces/style_themes/II18nStyleThemes.js +1 -0
  114. package/dist/globalization/interfaces/style_themes/II18nStyleThemesDeleteDialog.d.ts +6 -0
  115. package/dist/globalization/interfaces/style_themes/II18nStyleThemesDeleteDialog.js +1 -0
  116. package/dist/globalization/interfaces/style_themes/II18nStyleThemesMenu.d.ts +6 -0
  117. package/dist/globalization/interfaces/style_themes/II18nStyleThemesMenu.js +1 -0
  118. package/dist/globalization/interfaces/style_themes/II18nStyleThemesMessages.d.ts +9 -0
  119. package/dist/globalization/interfaces/style_themes/II18nStyleThemesMessages.js +1 -0
  120. package/dist/globalization/interfaces/style_themes/II18nStyleThemesTheme.d.ts +27 -0
  121. package/dist/globalization/interfaces/style_themes/II18nStyleThemesTheme.js +1 -0
  122. package/dist/globalization/interfaces/style_themes/II18nStyleThemesTooltips.d.ts +3 -0
  123. package/dist/globalization/interfaces/style_themes/II18nStyleThemesTooltips.js +1 -0
  124. package/dist/globalization/interfaces/style_themes/index.d.ts +6 -0
  125. package/dist/globalization/interfaces/style_themes/index.js +6 -0
  126. package/dist/globalization/labels/I18N_DEFAULT.js +2 -0
  127. package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_LAYER_OPTIONS.js +1 -1
  128. package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +7 -5
  129. package/dist/globalization/labels/index.d.ts +5 -3
  130. package/dist/globalization/labels/index.js +5 -3
  131. package/dist/globalization/labels/style_themes/I18N_STYLE_THEMES.d.ts +2 -0
  132. package/dist/globalization/labels/style_themes/I18N_STYLE_THEMES.js +54 -0
  133. package/dist/globalization/labels/style_themes/index.d.ts +1 -0
  134. package/dist/globalization/labels/style_themes/index.js +1 -0
  135. package/dist/globalization/labels/table_charts/I18N_TABLE_CHARTS.js +1 -1
  136. package/dist/interfaces/format/IFormatConfig.Interface.d.ts +5 -0
  137. package/dist/interfaces/format/IFormatConfig.Interface.js +1 -0
  138. package/dist/interfaces/format/IFormatCurrency.Interface.d.ts +4 -0
  139. package/dist/interfaces/format/IFormatCurrency.Interface.js +1 -0
  140. package/dist/interfaces/format/IFormatOutputFormat.Interface.d.ts +8 -0
  141. package/dist/interfaces/format/IFormatOutputFormat.Interface.js +1 -0
  142. package/dist/interfaces/format/index.d.ts +3 -0
  143. package/dist/interfaces/format/index.js +3 -0
  144. package/dist/interfaces/general/IGeneralWidgetConfig.d.ts +2 -0
  145. package/dist/interfaces/index.d.ts +1 -0
  146. package/dist/interfaces/index.js +1 -0
  147. package/dist/qrvey/helpers/getValueWithSuffixes.d.ts +9 -0
  148. package/dist/qrvey/helpers/getValueWithSuffixes.js +19 -0
  149. package/dist/qrvey/helpers/index.d.ts +2 -0
  150. package/dist/qrvey/helpers/index.js +2 -0
  151. package/dist/qrvey/helpers/transformValue.d.ts +8 -0
  152. package/dist/qrvey/helpers/transformValue.js +42 -0
  153. package/dist/qrvey/interfaces/IGetValueWithSuffixesSettings.d.ts +11 -0
  154. package/dist/qrvey/interfaces/IGetValueWithSuffixesSettings.js +1 -0
  155. package/dist/qrvey/interfaces/ITransformValueSettings.d.ts +10 -0
  156. package/dist/qrvey/interfaces/ITransformValueSettings.js +1 -0
  157. package/dist/qrvey/interfaces/index.d.ts +2 -0
  158. package/dist/qrvey/interfaces/index.js +2 -0
  159. package/dist/services/api/getAllDatasets.api.d.ts +2 -1
  160. package/dist/services/api/getAllDatasets.api.js +2 -1
  161. package/dist/services/api/getDatasetColumns.api.js +3 -0
  162. package/package.json +1 -1
  163. package/src/charts/constants/AGGREGATE_LABEL.ts +1 -1
  164. package/src/filters/helpers/builder/getFilterBuilderGeneralConfig.ts +1 -0
  165. package/src/filters/helpers/ui/getQrveyIdsByUIFilters.ts +22 -0
  166. package/src/filters/helpers/ui/getUpdatedUIFilters.ts +34 -0
  167. package/src/filters/helpers/ui/index.ts +3 -0
  168. package/src/filters/helpers/ui/transformFilterValues.ts +29 -0
  169. package/src/filters/interfaces/builder/IFilterBuilderGeneralConfig.ts +2 -1
  170. package/src/filters/interfaces/panel/IFPSettingsGeneral.ts +2 -1
  171. package/src/filters/interfaces/panel/IFilterPanelConfig.ts +1 -0
  172. package/src/filters/interfaces/ui/IFUTransformFilterValuesSettings.ts +7 -0
  173. package/src/filters/interfaces/ui/index.ts +3 -2
  174. package/src/format/definition.ts +45 -0
  175. package/src/format/format.ts +19 -15
  176. package/src/format/index.ts +1 -0
  177. package/src/format/localization.ts +52 -0
  178. package/src/globalization/interfaces/IResourceI18n.ts +2 -0
  179. package/src/globalization/interfaces/chart_builder/II18nChartBuilderFontOptions.ts +5 -3
  180. package/src/globalization/interfaces/index.ts +4 -1
  181. package/src/globalization/interfaces/style_themes/II18nStyleThemes.ts +14 -0
  182. package/src/globalization/interfaces/style_themes/II18nStyleThemesDeleteDialog.ts +6 -0
  183. package/src/globalization/interfaces/style_themes/II18nStyleThemesMenu.ts +6 -0
  184. package/src/globalization/interfaces/style_themes/II18nStyleThemesMessages.ts +9 -0
  185. package/src/globalization/interfaces/style_themes/II18nStyleThemesTheme.ts +27 -0
  186. package/src/globalization/interfaces/style_themes/II18nStyleThemesTooltips.ts +3 -0
  187. package/src/globalization/interfaces/style_themes/index.ts +6 -0
  188. package/src/globalization/labels/I18N_DEFAULT.ts +2 -0
  189. package/src/globalization/labels/chart_builder/I18N_CHART_BUILDER_LAYER_OPTIONS.ts +1 -1
  190. package/src/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.ts +8 -6
  191. package/src/globalization/labels/index.ts +5 -3
  192. package/src/globalization/labels/style_themes/I18N_STYLE_THEMES.ts +56 -0
  193. package/src/globalization/labels/style_themes/index.ts +1 -0
  194. package/src/globalization/labels/table_charts/I18N_TABLE_CHARTS.ts +1 -1
  195. package/src/interfaces/format/IFormatConfig.Interface.ts +5 -0
  196. package/src/interfaces/format/IFormatCurrency.Interface.ts +4 -0
  197. package/src/interfaces/format/IFormatOutputFormat.Interface.ts +9 -0
  198. package/src/interfaces/format/index.ts +3 -0
  199. package/src/interfaces/general/IGeneralWidgetConfig.ts +2 -0
  200. package/src/interfaces/index.ts +1 -0
  201. package/src/qrvey/helpers/getValueWithSuffixes.ts +19 -0
  202. package/src/qrvey/helpers/index.ts +2 -0
  203. package/src/qrvey/helpers/transformValue.ts +47 -0
  204. package/src/qrvey/interfaces/IGetValueWithSuffixesSettings.ts +12 -0
  205. package/src/qrvey/interfaces/ITransformValueSettings.ts +12 -0
  206. package/src/qrvey/interfaces/index.ts +2 -0
  207. package/src/services/api/getAllDatasets.api.ts +3 -2
  208. package/src/services/api/getDatasetColumns.api.ts +3 -0
  209. package/test/format.test.js +11 -11
@@ -5,8 +5,9 @@ export interface IFPSettingsGeneral {
5
5
  canCollapse?: boolean;
6
6
  collapsed?: boolean;
7
7
  colorModeDisplayed?: boolean;
8
+ dynamicFilters?: boolean;
8
9
  enabled?: boolean;
9
10
  iconDisplayed?: boolean;
10
11
  readonly?: boolean;
11
- dynamicFilters?: boolean;
12
+ updateFilterInfo?: boolean;
12
13
  }
@@ -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
+ }
@@ -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';
@@ -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';
@@ -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";
@@ -43,3 +43,33 @@ export function supportNumericFormatting(chartType) {
43
43
  return supportedCharts.includes(chartType);
44
44
  }
45
45
  export const isTextColumn = (column) => textFields.includes(column.type) || column.formulaType === 'string' || column.formulaType === 'boolean';
46
+ export const currencyISO = [
47
+ { text: 'Default', label: 'USD' },
48
+ { text: '$ (USD)', label: 'USD' },
49
+ { text: '€ (EUR)', label: 'EUR' },
50
+ { text: '¥ (JPY)', label: 'JPY' },
51
+ { text: '£ (GBP)', label: 'GBP' },
52
+ { text: '₩ (WON)', label: 'WON' },
53
+ { text: '$ (AUD)', label: 'AUD' },
54
+ { text: '$ (CAD)', label: 'CAD' },
55
+ { text: 'CHF (CHF)', label: 'CHF' },
56
+ { text: '¥ (CNY)', label: 'CNY' },
57
+ { text: 'kr (SEK)', label: 'SEK' },
58
+ { text: '$ (MXN)', label: 'MXN' },
59
+ { text: '$ (NZD)', label: 'NZD' },
60
+ { text: '$ (SGD)', label: 'SGD' },
61
+ { text: '$ (HKD)', label: 'HKD' },
62
+ { text: 'kr (NOK)', label: 'NOK' },
63
+ { text: '₩ (KRW)', label: 'KRW' },
64
+ { text: '₺ (TRY)', label: 'TRY' },
65
+ { text: '₹ (INR)', label: 'INR' },
66
+ { text: '₽ (RUB)', label: 'RUB' },
67
+ { text: 'R$ (BRL)', label: 'BRL' },
68
+ { text: 'R (ZAR)', label: 'ZAR' },
69
+ { text: 'kr (DKK)', label: 'DKK' },
70
+ { text: 'zł (PLN)', label: 'PLN' },
71
+ { text: 'NT$ (TWD)', label: 'TWD' },
72
+ { text: '฿ (THB)', label: 'THB' },
73
+ { text: 'RM (MYR)', label: 'MYR' }
74
+ ];
75
+ export const 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;
@@ -6,6 +6,7 @@ import { isEmpty } from '../general/mix/isEmpty';
6
6
  import { _get } from '../general/object/get';
7
7
  import { COLUMN } from '../columns/constants/COLUMN';
8
8
  import { FORMULA } from '../formulas/constants/FORMULA';
9
+ import { formatWithLocale } from './localization';
9
10
  dayjs.extend(advancedFormat); // Add support to advanced formats https://day.js.org/docs/en/plugin/advanced-format
10
11
  /**
11
12
  * Apply to the given date format to a date value
@@ -74,16 +75,18 @@ export function formatFileSize(bytes) {
74
75
  const megaBytes = kiloBytes / 1024;
75
76
  return megaBytes < 10 ? `${fixDecimals(megaBytes)} MB` : `${Math.round(megaBytes)} MB`;
76
77
  }
77
- export const formatValue = (value, outputFormat = 'None', config) => {
78
+ export const addFormat = (value, outputFormat = 'None', config) => {
78
79
  if (isEmpty(value) || typeof value === 'object' && isEmpty(value[0]))
79
80
  return value;
80
81
  switch (outputFormat.type) {
81
82
  case 'DATE':
82
83
  case 'DATETIME':
83
- return formatDate(value, outputFormat.format);
84
+ return (config === null || config === void 0 ? void 0 : config.lang) && outputFormat.format === 'Default' ? formatWithLocale(value, outputFormat, config) : formatDate(value, outputFormat.format);
84
85
  case 'NUMERIC': {
85
86
  const parse = parseFloat(value);
86
- return isNaN(parse) ? value : formatNumber(parse, outputFormat, config);
87
+ const withLocale = outputFormat.format !== 'Abbreviated' && outputFormat !== 'None' && (config === null || config === void 0 ? void 0 : config.lang);
88
+ return isNaN(parse) ? value : withLocale ? formatWithLocale(value, outputFormat, config)
89
+ : formatNumber(parse, outputFormat, config);
87
90
  }
88
91
  case 'IMAGEUPLOAD':
89
92
  case 'FILEUPLOAD':
@@ -1 +1,2 @@
1
1
  export * from './format';
2
+ export * from './localization';
@@ -1 +1,2 @@
1
1
  export * from './format';
2
+ export * from './localization';
@@ -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,51 @@
1
+ import { currencyISO, LANG_DEFAULT } from './definition';
2
+ export const getLang = (locale) => {
3
+ if (!locale)
4
+ return;
5
+ else if (typeof locale === 'object')
6
+ return locale;
7
+ else
8
+ return { lang: locale === "browser" ? window.navigator.language : locale };
9
+ };
10
+ export const formatWithLocale = (value, outputFormat, config = {}) => {
11
+ switch (outputFormat.type) {
12
+ case 'DATE':
13
+ case 'DATETIME':
14
+ return formatLocaleDate(value, config);
15
+ case 'NUMERIC':
16
+ return formatLocaleNumber(value, outputFormat, config);
17
+ }
18
+ };
19
+ function formatLocaleDate(value, config) {
20
+ const { lang = LANG_DEFAULT, options } = config;
21
+ const dateParam = new Date(value);
22
+ try {
23
+ return new Intl.DateTimeFormat([lang, LANG_DEFAULT], options).format(dateParam);
24
+ }
25
+ catch (error) {
26
+ return new Intl.DateTimeFormat(LANG_DEFAULT, options).format(dateParam);
27
+ }
28
+ }
29
+ function formatLocaleNumber(value, outputFormat, config) {
30
+ const { lang = LANG_DEFAULT, options } = config;
31
+ const langOpts = options || getLocaleOptions(outputFormat);
32
+ try {
33
+ return new Intl.NumberFormat([lang, LANG_DEFAULT], langOpts).format(value);
34
+ }
35
+ catch (e) {
36
+ return new Intl.NumberFormat(LANG_DEFAULT, langOpts).format(value);
37
+ }
38
+ }
39
+ function getLocaleOptions(outputFormat) {
40
+ const { format, decimals, currency, backup_currency } = outputFormat;
41
+ switch (format) {
42
+ case "Currency" /* CURRENCY */: {
43
+ const iso = currencyISO.find(item => item.text === (currency.text || backup_currency.text));
44
+ return { style: "currency" /* CURRENCY */, currency: iso.label, maximumFractionDigits: decimals, minimumFractionDigits: 0 };
45
+ }
46
+ case "Scientific" /* SCIENTIFIC */: return { style: "decimal" /* DECIMAL */,
47
+ notation: "scientific" /* SCIENTIFIC */, maximumFractionDigits: decimals };
48
+ case "Percentage" /* PERCENTAGE */: return { style: "percent" /* PERCENT */, maximumFractionDigits: decimals };
49
+ default: return { style: "decimal" /* DECIMAL */, maximumFractionDigits: decimals };
50
+ }
51
+ }
@@ -10,6 +10,7 @@ import { II18nFilterDisplay } from './filters/II18nFilterDisplay';
10
10
  import { II18nBucketBuilder } from './bucket_builder/II18nBucketBuilder';
11
11
  import { II18nCrossTabs } from './cross_tabs';
12
12
  import { II18nChartBuilder } from '.';
13
+ import { II18nStyleThemes } from './style_themes/II18nStyleThemes';
13
14
  export interface IResourceI18n {
14
15
  bucket_builder?: II18nBucketBuilder;
15
16
  chart_builder?: II18nChartBuilder;
@@ -22,5 +23,6 @@ export interface IResourceI18n {
22
23
  filter_panel?: II18nFilterPanel;
23
24
  formula_builder?: II18nFormulaBuilder;
24
25
  panel?: II18nPanel;
26
+ style_themes?: II18nStyleThemes;
25
27
  table_charts?: II18nTableCharts;
26
28
  }
@@ -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
  }
@@ -1,11 +1,14 @@
1
+ export * from './bucket_builder/index';
2
+ export * from './chart_builder/index';
1
3
  export * from './columns/index';
2
4
  export * from './common/index';
5
+ export * from './cross_tabs/index';
3
6
  export * from './dashboard/index';
4
7
  export * from './filters/index';
5
8
  export * from './formula_builder/index';
6
9
  export * from './panel/index';
10
+ export * from './style_themes/index';
7
11
  export * from './table_charts/index';
8
- export * from './chart_builder/index';
9
12
  export * from './II18nServiceTranslate';
10
13
  export * from './II18nServiceTranslateOption';
11
14
  export * from './IResourceI18n';
@@ -1,11 +1,14 @@
1
+ export * from './bucket_builder/index';
2
+ export * from './chart_builder/index';
1
3
  export * from './columns/index';
2
4
  export * from './common/index';
5
+ export * from './cross_tabs/index';
3
6
  export * from './dashboard/index';
4
7
  export * from './filters/index';
5
8
  export * from './formula_builder/index';
6
9
  export * from './panel/index';
10
+ export * from './style_themes/index';
7
11
  export * from './table_charts/index';
8
- export * from './chart_builder/index';
9
12
  export * from './II18nServiceTranslate';
10
13
  export * from './II18nServiceTranslateOption';
11
14
  export * from './IResourceI18n';
@@ -0,0 +1,13 @@
1
+ import { II18nStyleThemesDeleteDialog } from "./II18nStyleThemesDeleteDialog";
2
+ import { II18nStyleThemesMenu } from "./II18nStyleThemesMenu";
3
+ import { II18nStyleThemesMessages } from "./II18nStyleThemesMessages";
4
+ import { II18nStyleThemesTheme } from "./II18nStyleThemesTheme";
5
+ import { II18nStyleThemesTooltips } from "./II18nStyleThemesTooltips";
6
+ export interface II18nStyleThemes {
7
+ delete_dialog: II18nStyleThemesDeleteDialog;
8
+ menu: II18nStyleThemesMenu;
9
+ messages: II18nStyleThemesMessages;
10
+ theme: II18nStyleThemesTheme;
11
+ title: string;
12
+ tooltips: II18nStyleThemesTooltips;
13
+ }
@@ -0,0 +1,6 @@
1
+ export interface II18nStyleThemesDeleteDialog {
2
+ no: string;
3
+ theme_in_use: string;
4
+ want_to_continue: string;
5
+ yes: string;
6
+ }
@@ -0,0 +1,6 @@
1
+ export interface II18nStyleThemesMenu {
2
+ delete: string;
3
+ duplicate: string;
4
+ edit: string;
5
+ use_all: string;
6
+ }
@@ -0,0 +1,9 @@
1
+ export interface II18nStyleThemesMessages {
2
+ theme_could_not_be_created: string;
3
+ theme_could_not_be_deleted: string;
4
+ theme_could_not_be_duplicated: string;
5
+ theme_could_not_be_saved: string;
6
+ theme_could_not_be_selected: string;
7
+ theme_could_not_be_used_in_all_applications: string;
8
+ themes_could_not_be_loaded: string;
9
+ }
@@ -0,0 +1,27 @@
1
+ export interface II18nStyleThemesTheme {
2
+ axis_data_labels: string;
3
+ cancel_theme: string;
4
+ chart_titles_color: string;
5
+ copy: string;
6
+ create_theme: string;
7
+ data_styles: string;
8
+ data_visualization: string;
9
+ edit_theme: string;
10
+ generate_new: string;
11
+ header_font_color: string;
12
+ id: string;
13
+ legends: string;
14
+ main_color: string;
15
+ name_placeholder: string;
16
+ panel_styles: string;
17
+ qrvey_theme: string;
18
+ restore_to_default: string;
19
+ save_theme: string;
20
+ table_header_styles: string;
21
+ text_styles: string;
22
+ tooltips: string;
23
+ typeface: string;
24
+ untitled_theme: string;
25
+ use_theme_in_all_apps: string;
26
+ values: string;
27
+ }
@@ -0,0 +1,3 @@
1
+ export interface II18nStyleThemesTooltips {
2
+ theme_used_in_all_applications: string;
3
+ }
@@ -0,0 +1,6 @@
1
+ export * from './II18nStyleThemes';
2
+ export * from './II18nStyleThemesDeleteDialog';
3
+ export * from './II18nStyleThemesMenu';
4
+ export * from './II18nStyleThemesMessages';
5
+ export * from './II18nStyleThemesTheme';
6
+ export * from './II18nStyleThemesTooltips';
@@ -0,0 +1,6 @@
1
+ export * from './II18nStyleThemes';
2
+ export * from './II18nStyleThemesDeleteDialog';
3
+ export * from './II18nStyleThemesMenu';
4
+ export * from './II18nStyleThemesMessages';
5
+ export * from './II18nStyleThemesTheme';
6
+ export * from './II18nStyleThemesTooltips';
@@ -10,6 +10,7 @@ import { I18N_FILTER_DISPLAY } from "./filters/I18N_FILTER_DISPLAY";
10
10
  import { I18N_BUCKET_BUILDER } from "./bucket_builder/I18N_BUCKET_BUILDER";
11
11
  import { I18N_CROSS_TABS } from './cross_tabs';
12
12
  import { I18N_CHART_BUILDER } from "./chart_builder";
13
+ import { I18N_STYLE_THEMES } from "./style_themes";
13
14
  export const I18N_DEFAULT = {
14
15
  bucket_builder: I18N_BUCKET_BUILDER,
15
16
  chart_builder: I18N_CHART_BUILDER,
@@ -22,5 +23,6 @@ export const I18N_DEFAULT = {
22
23
  filter_panel: I18N_FILTER_PANEL,
23
24
  formula_builder: I18N_FORMULA_BUILDER,
24
25
  panel: I18N_PANEL,
26
+ style_themes: I18N_STYLE_THEMES,
25
27
  table_charts: I18N_TABLE_CHARTS,
26
28
  };
@@ -1,6 +1,6 @@
1
1
  export const I18N_CHART_BUILDER_LAYER_OPTIONS = {
2
2
  trends_line: {
3
- title: 'Trends line',
3
+ title: 'Trend Line',
4
4
  type: 'Type',
5
5
  type_none: 'None',
6
6
  type_standard_linear_regression: 'Standard Linear Regression',
@@ -13,9 +13,9 @@ export const I18N_CHART_BUILDER_STYLE_OPTIONS = {
13
13
  comparision_color: 'Comparision Color',
14
14
  data_labels_check: 'Data Labels',
15
15
  default_format_title: 'Format',
16
- display_outliers_check: 'Display outliers',
16
+ display_outliers_check: 'Display Outliers',
17
17
  line_opacity: 'Line Opacity',
18
- map_borders: 'Map borders',
18
+ map_borders: 'Map Borders',
19
19
  needle_color: 'Needle Color',
20
20
  opacity: 'Opacity',
21
21
  percentage_check: 'Percentage',
@@ -149,13 +149,15 @@ export const I18N_CHART_BUILDER_STYLE_OPTIONS = {
149
149
  names_rotation: 'Names Rotation',
150
150
  },
151
151
  font_options: {
152
+ automatic_resize: 'Automatic Resize',
152
153
  color: 'Font Color',
154
+ disabled: '<i>Automatic Resize</i> is active, disable it to set the size manually.',
155
+ select_option_placeholder: 'Select Option',
156
+ size: 'Font Size',
153
157
  style: 'Font Style',
154
- style_regular: 'Regular',
155
158
  style_bold: 'Bold',
156
159
  style_italic: 'Italic',
157
- automatic_resize: 'Automatic Resize',
158
- size: 'Font Size',
160
+ style_regular: 'Regular',
159
161
  },
160
162
  circle_size: {
161
163
  title: 'Circle Size',
@@ -1,10 +1,12 @@
1
+ export * from './bucket_builder';
2
+ export * from './chart_builder';
1
3
  export * from './columns';
2
4
  export * from './common';
5
+ export * from './cross_tabs';
3
6
  export * from './dashboard';
4
7
  export * from './filters';
8
+ export * from './formula_builder';
5
9
  export * from './panel';
10
+ export * from './style_themes';
6
11
  export * from './table_charts';
7
12
  export * from './I18N_DEFAULT';
8
- export * from './formula_builder';
9
- export * from './bucket_builder';
10
- export * from './chart_builder';
@@ -1,10 +1,12 @@
1
+ export * from './bucket_builder';
2
+ export * from './chart_builder';
1
3
  export * from './columns';
2
4
  export * from './common';
5
+ export * from './cross_tabs';
3
6
  export * from './dashboard';
4
7
  export * from './filters';
8
+ export * from './formula_builder';
5
9
  export * from './panel';
10
+ export * from './style_themes';
6
11
  export * from './table_charts';
7
12
  export * from './I18N_DEFAULT';
8
- export * from './formula_builder';
9
- export * from './bucket_builder';
10
- export * from './chart_builder';
@@ -0,0 +1,2 @@
1
+ import { II18nStyleThemes } from "../../interfaces/style_themes/II18nStyleThemes";
2
+ export declare const I18N_STYLE_THEMES: II18nStyleThemes;
@@ -0,0 +1,54 @@
1
+ export const I18N_STYLE_THEMES = {
2
+ delete_dialog: {
3
+ no: 'No',
4
+ theme_in_use: 'This theme is in use. If you delete it the visualizations will reset to the default theme.',
5
+ want_to_continue: 'Are you sure you want to continue?',
6
+ yes: 'Yes',
7
+ },
8
+ menu: {
9
+ delete: 'Delete',
10
+ duplicate: 'Duplicate',
11
+ edit: 'Edit',
12
+ use_all: 'Use in all applications',
13
+ },
14
+ messages: {
15
+ theme_could_not_be_created: 'Theme could not be created.',
16
+ theme_could_not_be_deleted: 'Theme could not be deleted.',
17
+ theme_could_not_be_duplicated: 'Theme could not be duplicated.',
18
+ theme_could_not_be_saved: 'Theme could not be saved.',
19
+ theme_could_not_be_selected: 'Theme could not be selected.',
20
+ theme_could_not_be_used_in_all_applications: 'Theme could not be used in all applications.',
21
+ themes_could_not_be_loaded: 'Themes could not be loaded.',
22
+ },
23
+ theme: {
24
+ axis_data_labels: 'Axis and Data Labels',
25
+ cancel_theme: 'Cancel',
26
+ chart_titles_color: 'Chart Titles Color',
27
+ copy: 'Copy',
28
+ create_theme: 'Create New Theme',
29
+ data_styles: 'Data Styles',
30
+ data_visualization: 'Data Visualization',
31
+ edit_theme: 'Edit Theme',
32
+ generate_new: 'Generate New',
33
+ header_font_color: 'Header Font Color',
34
+ id: 'ID',
35
+ legends: 'Legends',
36
+ main_color: 'Main Color',
37
+ name_placeholder: 'Type name',
38
+ panel_styles: 'Panel Styles',
39
+ qrvey_theme: 'Qrvey Theme',
40
+ restore_to_default: 'Restore to Default',
41
+ save_theme: 'Save Theme',
42
+ table_header_styles: 'Table Header Styles',
43
+ text_styles: 'Text Styles',
44
+ tooltips: 'Tooltips',
45
+ typeface: 'Typeface',
46
+ untitled_theme: 'Untitled',
47
+ use_theme_in_all_apps: 'Use Theme in All Apps',
48
+ values: 'Values',
49
+ },
50
+ title: 'Style Themes',
51
+ tooltips: {
52
+ theme_used_in_all_applications: 'This theme is being used in all applications',
53
+ }
54
+ };
@@ -0,0 +1 @@
1
+ export * from './I18N_STYLE_THEMES';
@@ -0,0 +1 @@
1
+ export * from './I18N_STYLE_THEMES';
@@ -9,7 +9,7 @@ export const I18N_TABLE_CHARTS = {
9
9
  }
10
10
  },
11
11
  pagination: {
12
- page_info: 'Page {0} of {1} ',
12
+ page_info: 'Page {{currentPage}} of {{pages}}',
13
13
  records: 'Records',
14
14
  records_per_page: 'Records per page',
15
15
  total_records: 'Total records'
@@ -0,0 +1,5 @@
1
+ export interface IFormatConfig {
2
+ lang?: string;
3
+ options?: object;
4
+ isMultiplied?: boolean;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface IFormatCurrency {
2
+ text: string;
3
+ label: string;
4
+ }
@@ -0,0 +1,8 @@
1
+ import { IFormatCurrency } from "./IFormatCurrency.Interface";
2
+ export interface IFormatOutputFormat {
3
+ format: string;
4
+ type: string;
5
+ decimals?: number;
6
+ currency?: IFormatCurrency;
7
+ backup_currency?: IFormatCurrency;
8
+ }
@@ -0,0 +1,3 @@
1
+ export * from './IFormatConfig.Interface';
2
+ export * from './IFormatOutputFormat.Interface';
3
+ export * from './IFormatCurrency.Interface';
@@ -0,0 +1,3 @@
1
+ export * from './IFormatConfig.Interface';
2
+ export * from './IFormatOutputFormat.Interface';
3
+ export * from './IFormatCurrency.Interface';
@@ -3,8 +3,10 @@ export interface IGeneralWidgetConfig {
3
3
  apiKey?: string;
4
4
  qrveyid?: string;
5
5
  qv_token?: string;
6
+ locale?: string;
6
7
  timezoneControl?: string;
7
8
  isFromAN?: boolean;
8
9
  appid: string;
9
10
  userid: string;
11
+ lang?: string;
10
12
  }
@@ -2,3 +2,4 @@ export * from './Chart.Interface';
2
2
  export * from './IChartBuilder.Interface';
3
3
  export * from './general';
4
4
  export * from './Qrvey.Interface';
5
+ export * from './format';
@@ -2,3 +2,4 @@ export * from './Chart.Interface';
2
2
  export * from './IChartBuilder.Interface';
3
3
  export * from './general';
4
4
  export * from './Qrvey.Interface';
5
+ export * from './format';