@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.
- package/README.md +926 -766
- package/dist/charts/constants/AGGREGATE_LABEL.d.ts +1 -1
- package/dist/charts/constants/AGGREGATE_LABEL.js +1 -1
- package/dist/cjs/charts/constants/AGGREGATE_LABEL.d.ts +1 -1
- package/dist/cjs/charts/constants/AGGREGATE_LABEL.js +1 -1
- package/dist/cjs/filters/helpers/builder/getFilterBuilderGeneralConfig.js +1 -0
- package/dist/cjs/filters/helpers/ui/getQrveyIdsByUIFilters.d.ts +7 -0
- package/dist/cjs/filters/helpers/ui/getQrveyIdsByUIFilters.js +24 -0
- package/dist/cjs/filters/helpers/ui/getUpdatedUIFilters.d.ts +9 -0
- package/dist/cjs/filters/helpers/ui/getUpdatedUIFilters.js +36 -0
- package/dist/cjs/filters/helpers/ui/index.d.ts +3 -0
- package/dist/cjs/filters/helpers/ui/index.js +3 -0
- package/dist/cjs/filters/helpers/ui/transformFilterValues.d.ts +4 -0
- package/dist/cjs/filters/helpers/ui/transformFilterValues.js +22 -0
- package/dist/cjs/filters/interfaces/builder/IFilterBuilderGeneralConfig.d.ts +1 -0
- package/dist/cjs/filters/interfaces/panel/IFPSettingsGeneral.d.ts +2 -1
- package/dist/cjs/filters/interfaces/panel/IFilterPanelConfig.d.ts +1 -0
- package/dist/cjs/filters/interfaces/ui/IFUTransformFilterValuesSettings.d.ts +6 -0
- package/dist/cjs/filters/interfaces/ui/IFUTransformFilterValuesSettings.js +2 -0
- package/dist/cjs/filters/interfaces/ui/index.d.ts +3 -2
- package/dist/cjs/filters/interfaces/ui/index.js +3 -2
- package/dist/cjs/format/definition.d.ts +17 -0
- package/dist/cjs/format/definition.js +31 -1
- package/dist/cjs/format/format.d.ts +2 -1
- package/dist/cjs/format/format.js +8 -5
- package/dist/cjs/format/index.d.ts +1 -0
- package/dist/cjs/format/index.js +1 -0
- package/dist/cjs/format/localization.d.ts +3 -0
- package/dist/cjs/format/localization.js +56 -0
- package/dist/cjs/globalization/interfaces/IResourceI18n.d.ts +2 -0
- package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilderFontOptions.d.ts +5 -3
- package/dist/cjs/globalization/interfaces/index.d.ts +4 -1
- package/dist/cjs/globalization/interfaces/index.js +4 -1
- package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemes.d.ts +13 -0
- package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemes.js +2 -0
- package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesDeleteDialog.d.ts +6 -0
- package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesDeleteDialog.js +2 -0
- package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesMenu.d.ts +6 -0
- package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesMenu.js +2 -0
- package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesMessages.d.ts +9 -0
- package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesMessages.js +2 -0
- package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesTheme.d.ts +27 -0
- package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesTheme.js +2 -0
- package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesTooltips.d.ts +3 -0
- package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesTooltips.js +2 -0
- package/dist/cjs/globalization/interfaces/style_themes/index.d.ts +6 -0
- package/dist/cjs/globalization/interfaces/style_themes/index.js +18 -0
- package/dist/cjs/globalization/labels/I18N_DEFAULT.js +2 -0
- package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_LAYER_OPTIONS.js +1 -1
- package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +7 -5
- package/dist/cjs/globalization/labels/index.d.ts +5 -3
- package/dist/cjs/globalization/labels/index.js +5 -3
- package/dist/cjs/globalization/labels/style_themes/I18N_STYLE_THEMES.d.ts +2 -0
- package/dist/cjs/globalization/labels/style_themes/I18N_STYLE_THEMES.js +57 -0
- package/dist/cjs/globalization/labels/style_themes/index.d.ts +1 -0
- package/dist/cjs/globalization/labels/style_themes/index.js +13 -0
- package/dist/cjs/globalization/labels/table_charts/I18N_TABLE_CHARTS.js +1 -1
- package/dist/cjs/interfaces/format/IFormatConfig.Interface.d.ts +5 -0
- package/dist/cjs/interfaces/format/IFormatConfig.Interface.js +2 -0
- package/dist/cjs/interfaces/format/IFormatCurrency.Interface.d.ts +4 -0
- package/dist/cjs/interfaces/format/IFormatCurrency.Interface.js +2 -0
- package/dist/cjs/interfaces/format/IFormatOutputFormat.Interface.d.ts +8 -0
- package/dist/cjs/interfaces/format/IFormatOutputFormat.Interface.js +2 -0
- package/dist/cjs/interfaces/format/index.d.ts +3 -0
- package/dist/cjs/interfaces/format/index.js +15 -0
- package/dist/cjs/interfaces/general/IGeneralWidgetConfig.d.ts +2 -0
- package/dist/cjs/interfaces/index.d.ts +1 -0
- package/dist/cjs/interfaces/index.js +1 -0
- package/dist/cjs/qrvey/helpers/getValueWithSuffixes.d.ts +9 -0
- package/dist/cjs/qrvey/helpers/getValueWithSuffixes.js +23 -0
- package/dist/cjs/qrvey/helpers/index.d.ts +2 -0
- package/dist/cjs/qrvey/helpers/index.js +2 -0
- package/dist/cjs/qrvey/helpers/transformValue.d.ts +8 -0
- package/dist/cjs/qrvey/helpers/transformValue.js +46 -0
- package/dist/cjs/qrvey/interfaces/IGetValueWithSuffixesSettings.d.ts +11 -0
- package/dist/cjs/qrvey/interfaces/IGetValueWithSuffixesSettings.js +2 -0
- package/dist/cjs/qrvey/interfaces/ITransformValueSettings.d.ts +10 -0
- package/dist/cjs/qrvey/interfaces/ITransformValueSettings.js +2 -0
- package/dist/cjs/qrvey/interfaces/index.d.ts +2 -0
- package/dist/cjs/qrvey/interfaces/index.js +2 -0
- package/dist/cjs/services/api/getAllDatasets.api.d.ts +2 -1
- package/dist/cjs/services/api/getAllDatasets.api.js +2 -1
- package/dist/cjs/services/api/getDatasetColumns.api.js +3 -0
- package/dist/filters/helpers/builder/getFilterBuilderGeneralConfig.js +1 -0
- package/dist/filters/helpers/ui/getQrveyIdsByUIFilters.d.ts +7 -0
- package/dist/filters/helpers/ui/getQrveyIdsByUIFilters.js +20 -0
- package/dist/filters/helpers/ui/getUpdatedUIFilters.d.ts +9 -0
- package/dist/filters/helpers/ui/getUpdatedUIFilters.js +32 -0
- package/dist/filters/helpers/ui/index.d.ts +3 -0
- package/dist/filters/helpers/ui/index.js +3 -0
- package/dist/filters/helpers/ui/transformFilterValues.d.ts +4 -0
- package/dist/filters/helpers/ui/transformFilterValues.js +18 -0
- package/dist/filters/interfaces/builder/IFilterBuilderGeneralConfig.d.ts +1 -0
- package/dist/filters/interfaces/panel/IFPSettingsGeneral.d.ts +2 -1
- package/dist/filters/interfaces/panel/IFilterPanelConfig.d.ts +1 -0
- package/dist/filters/interfaces/ui/IFUTransformFilterValuesSettings.d.ts +6 -0
- package/dist/filters/interfaces/ui/IFUTransformFilterValuesSettings.js +1 -0
- package/dist/filters/interfaces/ui/index.d.ts +3 -2
- package/dist/filters/interfaces/ui/index.js +3 -2
- package/dist/format/definition.d.ts +17 -0
- package/dist/format/definition.js +30 -0
- package/dist/format/format.d.ts +2 -1
- package/dist/format/format.js +6 -3
- package/dist/format/index.d.ts +1 -0
- package/dist/format/index.js +1 -0
- package/dist/format/localization.d.ts +3 -0
- package/dist/format/localization.js +51 -0
- package/dist/globalization/interfaces/IResourceI18n.d.ts +2 -0
- package/dist/globalization/interfaces/chart_builder/II18nChartBuilderFontOptions.d.ts +5 -3
- package/dist/globalization/interfaces/index.d.ts +4 -1
- package/dist/globalization/interfaces/index.js +4 -1
- package/dist/globalization/interfaces/style_themes/II18nStyleThemes.d.ts +13 -0
- package/dist/globalization/interfaces/style_themes/II18nStyleThemes.js +1 -0
- package/dist/globalization/interfaces/style_themes/II18nStyleThemesDeleteDialog.d.ts +6 -0
- package/dist/globalization/interfaces/style_themes/II18nStyleThemesDeleteDialog.js +1 -0
- package/dist/globalization/interfaces/style_themes/II18nStyleThemesMenu.d.ts +6 -0
- package/dist/globalization/interfaces/style_themes/II18nStyleThemesMenu.js +1 -0
- package/dist/globalization/interfaces/style_themes/II18nStyleThemesMessages.d.ts +9 -0
- package/dist/globalization/interfaces/style_themes/II18nStyleThemesMessages.js +1 -0
- package/dist/globalization/interfaces/style_themes/II18nStyleThemesTheme.d.ts +27 -0
- package/dist/globalization/interfaces/style_themes/II18nStyleThemesTheme.js +1 -0
- package/dist/globalization/interfaces/style_themes/II18nStyleThemesTooltips.d.ts +3 -0
- package/dist/globalization/interfaces/style_themes/II18nStyleThemesTooltips.js +1 -0
- package/dist/globalization/interfaces/style_themes/index.d.ts +6 -0
- package/dist/globalization/interfaces/style_themes/index.js +6 -0
- package/dist/globalization/labels/I18N_DEFAULT.js +2 -0
- package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_LAYER_OPTIONS.js +1 -1
- package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +7 -5
- package/dist/globalization/labels/index.d.ts +5 -3
- package/dist/globalization/labels/index.js +5 -3
- package/dist/globalization/labels/style_themes/I18N_STYLE_THEMES.d.ts +2 -0
- package/dist/globalization/labels/style_themes/I18N_STYLE_THEMES.js +54 -0
- package/dist/globalization/labels/style_themes/index.d.ts +1 -0
- package/dist/globalization/labels/style_themes/index.js +1 -0
- package/dist/globalization/labels/table_charts/I18N_TABLE_CHARTS.js +1 -1
- package/dist/interfaces/format/IFormatConfig.Interface.d.ts +5 -0
- package/dist/interfaces/format/IFormatConfig.Interface.js +1 -0
- package/dist/interfaces/format/IFormatCurrency.Interface.d.ts +4 -0
- package/dist/interfaces/format/IFormatCurrency.Interface.js +1 -0
- package/dist/interfaces/format/IFormatOutputFormat.Interface.d.ts +8 -0
- package/dist/interfaces/format/IFormatOutputFormat.Interface.js +1 -0
- package/dist/interfaces/format/index.d.ts +3 -0
- package/dist/interfaces/format/index.js +3 -0
- package/dist/interfaces/general/IGeneralWidgetConfig.d.ts +2 -0
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/interfaces/index.js +1 -0
- package/dist/qrvey/helpers/getValueWithSuffixes.d.ts +9 -0
- package/dist/qrvey/helpers/getValueWithSuffixes.js +19 -0
- package/dist/qrvey/helpers/index.d.ts +2 -0
- package/dist/qrvey/helpers/index.js +2 -0
- package/dist/qrvey/helpers/transformValue.d.ts +8 -0
- package/dist/qrvey/helpers/transformValue.js +42 -0
- package/dist/qrvey/interfaces/IGetValueWithSuffixesSettings.d.ts +11 -0
- package/dist/qrvey/interfaces/IGetValueWithSuffixesSettings.js +1 -0
- package/dist/qrvey/interfaces/ITransformValueSettings.d.ts +10 -0
- package/dist/qrvey/interfaces/ITransformValueSettings.js +1 -0
- package/dist/qrvey/interfaces/index.d.ts +2 -0
- package/dist/qrvey/interfaces/index.js +2 -0
- package/dist/services/api/getAllDatasets.api.d.ts +2 -1
- package/dist/services/api/getAllDatasets.api.js +2 -1
- package/dist/services/api/getDatasetColumns.api.js +3 -0
- package/package.json +1 -1
- package/src/charts/constants/AGGREGATE_LABEL.ts +1 -1
- package/src/filters/helpers/builder/getFilterBuilderGeneralConfig.ts +1 -0
- package/src/filters/helpers/ui/getQrveyIdsByUIFilters.ts +22 -0
- package/src/filters/helpers/ui/getUpdatedUIFilters.ts +34 -0
- package/src/filters/helpers/ui/index.ts +3 -0
- package/src/filters/helpers/ui/transformFilterValues.ts +29 -0
- package/src/filters/interfaces/builder/IFilterBuilderGeneralConfig.ts +2 -1
- package/src/filters/interfaces/panel/IFPSettingsGeneral.ts +2 -1
- package/src/filters/interfaces/panel/IFilterPanelConfig.ts +1 -0
- package/src/filters/interfaces/ui/IFUTransformFilterValuesSettings.ts +7 -0
- package/src/filters/interfaces/ui/index.ts +3 -2
- package/src/format/definition.ts +45 -0
- package/src/format/format.ts +19 -15
- package/src/format/index.ts +1 -0
- package/src/format/localization.ts +52 -0
- package/src/globalization/interfaces/IResourceI18n.ts +2 -0
- package/src/globalization/interfaces/chart_builder/II18nChartBuilderFontOptions.ts +5 -3
- package/src/globalization/interfaces/index.ts +4 -1
- package/src/globalization/interfaces/style_themes/II18nStyleThemes.ts +14 -0
- package/src/globalization/interfaces/style_themes/II18nStyleThemesDeleteDialog.ts +6 -0
- package/src/globalization/interfaces/style_themes/II18nStyleThemesMenu.ts +6 -0
- package/src/globalization/interfaces/style_themes/II18nStyleThemesMessages.ts +9 -0
- package/src/globalization/interfaces/style_themes/II18nStyleThemesTheme.ts +27 -0
- package/src/globalization/interfaces/style_themes/II18nStyleThemesTooltips.ts +3 -0
- package/src/globalization/interfaces/style_themes/index.ts +6 -0
- package/src/globalization/labels/I18N_DEFAULT.ts +2 -0
- package/src/globalization/labels/chart_builder/I18N_CHART_BUILDER_LAYER_OPTIONS.ts +1 -1
- package/src/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.ts +8 -6
- package/src/globalization/labels/index.ts +5 -3
- package/src/globalization/labels/style_themes/I18N_STYLE_THEMES.ts +56 -0
- package/src/globalization/labels/style_themes/index.ts +1 -0
- package/src/globalization/labels/table_charts/I18N_TABLE_CHARTS.ts +1 -1
- package/src/interfaces/format/IFormatConfig.Interface.ts +5 -0
- package/src/interfaces/format/IFormatCurrency.Interface.ts +4 -0
- package/src/interfaces/format/IFormatOutputFormat.Interface.ts +9 -0
- package/src/interfaces/format/index.ts +3 -0
- package/src/interfaces/general/IGeneralWidgetConfig.ts +2 -0
- package/src/interfaces/index.ts +1 -0
- package/src/qrvey/helpers/getValueWithSuffixes.ts +19 -0
- package/src/qrvey/helpers/index.ts +2 -0
- package/src/qrvey/helpers/transformValue.ts +47 -0
- package/src/qrvey/interfaces/IGetValueWithSuffixesSettings.ts +12 -0
- package/src/qrvey/interfaces/ITransformValueSettings.ts +12 -0
- package/src/qrvey/interfaces/index.ts +2 -0
- package/src/services/api/getAllDatasets.api.ts +3 -2
- package/src/services/api/getDatasetColumns.api.ts +3 -0
- 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
|
-
|
|
12
|
+
updateFilterInfo?: boolean;
|
|
12
13
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 './
|
|
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 './
|
|
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';
|
package/dist/format/format.d.ts
CHANGED
|
@@ -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
|
|
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;
|
package/dist/format/format.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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':
|
package/dist/format/index.d.ts
CHANGED
package/dist/format/index.js
CHANGED
|
@@ -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
|
-
|
|
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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
};
|
|
@@ -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
|
|
16
|
+
display_outliers_check: 'Display Outliers',
|
|
17
17
|
line_opacity: 'Line Opacity',
|
|
18
|
-
map_borders: 'Map
|
|
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
|
-
|
|
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,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';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/interfaces/index.js
CHANGED