@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.
- package/README.md +755 -652
- package/dist/cjs/filters/helpers/builder/getFilterBuilderGeneralConfig.js +1 -0
- package/dist/cjs/filters/helpers/ui/index.d.ts +1 -0
- package/dist/cjs/filters/helpers/ui/index.js +1 -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/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/helpers/getI18nCalendar.d.ts +4 -0
- package/dist/cjs/globalization/helpers/getI18nCalendar.js +69 -0
- package/dist/cjs/globalization/helpers/index.d.ts +1 -0
- package/dist/cjs/globalization/helpers/index.js +1 -0
- package/dist/cjs/globalization/interfaces/calendar/II18nCalendar.d.ts +7 -0
- package/dist/cjs/globalization/interfaces/calendar/II18nCalendar.js +2 -0
- package/dist/cjs/globalization/interfaces/calendar/II18nCalendarProperties.d.ts +9 -0
- package/dist/cjs/globalization/interfaces/calendar/II18nCalendarProperties.js +2 -0
- package/dist/cjs/globalization/interfaces/calendar/index.d.ts +2 -0
- package/dist/cjs/globalization/interfaces/calendar/index.js +14 -0
- package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilderFontOptions.d.ts +5 -3
- package/dist/cjs/globalization/interfaces/common/II18nCommon.d.ts +2 -0
- package/dist/cjs/globalization/interfaces/common/II18nDayNames.d.ts +7 -0
- package/dist/cjs/globalization/interfaces/filters/II18nFilter.d.ts +2 -0
- package/dist/cjs/globalization/interfaces/filters/II18nTokenBox.d.ts +6 -0
- package/dist/cjs/globalization/interfaces/filters/II18nTokenBox.js +2 -0
- package/dist/cjs/globalization/interfaces/index.d.ts +1 -0
- package/dist/cjs/globalization/interfaces/index.js +1 -0
- package/dist/cjs/globalization/labels/calendar/I18N_CALENDAR.d.ts +2 -0
- package/dist/cjs/globalization/labels/calendar/I18N_CALENDAR.js +10 -0
- package/dist/cjs/globalization/labels/calendar/index.d.ts +1 -0
- package/dist/cjs/globalization/labels/calendar/index.js +13 -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/common/I18N_COMMON.js +2 -0
- package/dist/cjs/globalization/labels/common/I18N_DAY_NAMES.js +7 -0
- package/dist/cjs/globalization/labels/filters/I18N_FILTER.js +6 -0
- package/dist/cjs/globalization/labels/index.d.ts +1 -0
- package/dist/cjs/globalization/labels/index.js +1 -0
- 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/getDatasetColumns.api.js +5 -1
- package/dist/filters/helpers/builder/getFilterBuilderGeneralConfig.js +1 -0
- package/dist/filters/helpers/ui/index.d.ts +1 -0
- package/dist/filters/helpers/ui/index.js +1 -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/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/helpers/getI18nCalendar.d.ts +4 -0
- package/dist/globalization/helpers/getI18nCalendar.js +65 -0
- package/dist/globalization/helpers/index.d.ts +1 -0
- package/dist/globalization/helpers/index.js +1 -0
- package/dist/globalization/interfaces/calendar/II18nCalendar.d.ts +7 -0
- package/dist/globalization/interfaces/calendar/II18nCalendar.js +1 -0
- package/dist/globalization/interfaces/calendar/II18nCalendarProperties.d.ts +9 -0
- package/dist/globalization/interfaces/calendar/II18nCalendarProperties.js +1 -0
- package/dist/globalization/interfaces/calendar/index.d.ts +2 -0
- package/dist/globalization/interfaces/calendar/index.js +2 -0
- package/dist/globalization/interfaces/chart_builder/II18nChartBuilderFontOptions.d.ts +5 -3
- package/dist/globalization/interfaces/common/II18nCommon.d.ts +2 -0
- package/dist/globalization/interfaces/common/II18nDayNames.d.ts +7 -0
- package/dist/globalization/interfaces/filters/II18nFilter.d.ts +2 -0
- package/dist/globalization/interfaces/filters/II18nTokenBox.d.ts +6 -0
- package/dist/globalization/interfaces/filters/II18nTokenBox.js +1 -0
- package/dist/globalization/interfaces/index.d.ts +1 -0
- package/dist/globalization/interfaces/index.js +1 -0
- package/dist/globalization/labels/calendar/I18N_CALENDAR.d.ts +2 -0
- package/dist/globalization/labels/calendar/I18N_CALENDAR.js +7 -0
- package/dist/globalization/labels/calendar/index.d.ts +1 -0
- package/dist/globalization/labels/calendar/index.js +1 -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/common/I18N_COMMON.js +2 -0
- package/dist/globalization/labels/common/I18N_DAY_NAMES.js +7 -0
- package/dist/globalization/labels/filters/I18N_FILTER.js +6 -0
- package/dist/globalization/labels/index.d.ts +1 -0
- package/dist/globalization/labels/index.js +1 -0
- 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/getDatasetColumns.api.js +5 -1
- package/package.json +1 -1
- package/src/filters/helpers/builder/getFilterBuilderGeneralConfig.ts +1 -0
- package/src/filters/helpers/ui/index.ts +1 -0
- package/src/filters/helpers/ui/transformFilterValues.ts +29 -0
- package/src/filters/interfaces/builder/IFilterBuilderGeneralConfig.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/helpers/getI18nCalendar.ts +68 -0
- package/src/globalization/helpers/index.ts +1 -0
- package/src/globalization/interfaces/calendar/II18nCalendar.ts +7 -0
- package/src/globalization/interfaces/calendar/II18nCalendarProperties.ts +9 -0
- package/src/globalization/interfaces/calendar/index.ts +2 -0
- package/src/globalization/interfaces/chart_builder/II18nChartBuilderFontOptions.ts +5 -3
- package/src/globalization/interfaces/common/II18nCommon.ts +2 -0
- package/src/globalization/interfaces/common/II18nDayNames.ts +8 -0
- package/src/globalization/interfaces/filters/II18nFilter.ts +2 -0
- package/src/globalization/interfaces/filters/II18nTokenBox.ts +6 -0
- package/src/globalization/interfaces/index.ts +1 -0
- package/src/globalization/labels/calendar/I18N_CALENDAR.ts +9 -0
- package/src/globalization/labels/calendar/index.ts +1 -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/common/I18N_COMMON.ts +2 -0
- package/src/globalization/labels/common/I18N_DAY_NAMES.ts +8 -0
- package/src/globalization/labels/filters/I18N_FILTER.ts +6 -0
- package/src/globalization/labels/index.ts +1 -0
- 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/getDatasetColumns.api.ts +4 -1
- package/test/columns/isNumericalColumn.test.js +154 -0
- package/test/format.test.js +11 -11
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { I18nService } from "../service/i18nextBuilder";
|
|
2
|
+
export function getI18nCalendar(locale) {
|
|
3
|
+
const localeOverride = locale instanceof I18nService ? locale : typeof locale === 'function' ? { translate: locale } : undefined;
|
|
4
|
+
if (!localeOverride)
|
|
5
|
+
return undefined;
|
|
6
|
+
return {
|
|
7
|
+
clear: localeOverride.translate('common.calendar.clear'),
|
|
8
|
+
days: [
|
|
9
|
+
localeOverride.translate('common.day_names.sunday_dddd'),
|
|
10
|
+
localeOverride.translate('common.day_names.monday_dddd'),
|
|
11
|
+
localeOverride.translate('common.day_names.tuesday_dddd'),
|
|
12
|
+
localeOverride.translate('common.day_names.wednesday_dddd'),
|
|
13
|
+
localeOverride.translate('common.day_names.thursday_dddd'),
|
|
14
|
+
localeOverride.translate('common.day_names.friday_dddd'),
|
|
15
|
+
localeOverride.translate('common.day_names.saturday_dddd')
|
|
16
|
+
],
|
|
17
|
+
daysMin: [
|
|
18
|
+
localeOverride.translate('common.day_names.sunday_dd'),
|
|
19
|
+
localeOverride.translate('common.day_names.monday_dd'),
|
|
20
|
+
localeOverride.translate('common.day_names.tuesday_dd'),
|
|
21
|
+
localeOverride.translate('common.day_names.wednesday_dd'),
|
|
22
|
+
localeOverride.translate('common.day_names.thursday_dd'),
|
|
23
|
+
localeOverride.translate('common.day_names.friday_dd'),
|
|
24
|
+
localeOverride.translate('common.day_names.saturday_dd')
|
|
25
|
+
],
|
|
26
|
+
daysShort: [
|
|
27
|
+
localeOverride.translate('common.day_names.sunday_ddd'),
|
|
28
|
+
localeOverride.translate('common.day_names.monday_ddd'),
|
|
29
|
+
localeOverride.translate('common.day_names.tuesday_ddd'),
|
|
30
|
+
localeOverride.translate('common.day_names.wednesday_ddd'),
|
|
31
|
+
localeOverride.translate('common.day_names.thursday_ddd'),
|
|
32
|
+
localeOverride.translate('common.day_names.friday_ddd'),
|
|
33
|
+
localeOverride.translate('common.day_names.saturday_ddd')
|
|
34
|
+
],
|
|
35
|
+
months: [
|
|
36
|
+
localeOverride.translate('common.date_grouping.january_mmmm'),
|
|
37
|
+
localeOverride.translate('common.date_grouping.february_mmmm'),
|
|
38
|
+
localeOverride.translate('common.date_grouping.march_mmmm'),
|
|
39
|
+
localeOverride.translate('common.date_grouping.april_mmmm'),
|
|
40
|
+
localeOverride.translate('common.date_grouping.may_mmmm'),
|
|
41
|
+
localeOverride.translate('common.date_grouping.june_mmmm'),
|
|
42
|
+
localeOverride.translate('common.date_grouping.july_mmmm'),
|
|
43
|
+
localeOverride.translate('common.date_grouping.august_mmmm'),
|
|
44
|
+
localeOverride.translate('common.date_grouping.september_mmmm'),
|
|
45
|
+
localeOverride.translate('common.date_grouping.october_mmmm'),
|
|
46
|
+
localeOverride.translate('common.date_grouping.november_mmmm'),
|
|
47
|
+
localeOverride.translate('common.date_grouping.december_mmmm')
|
|
48
|
+
],
|
|
49
|
+
monthsShort: [
|
|
50
|
+
localeOverride.translate('common.date_grouping.january_mmm'),
|
|
51
|
+
localeOverride.translate('common.date_grouping.february_mmm'),
|
|
52
|
+
localeOverride.translate('common.date_grouping.march_mmm'),
|
|
53
|
+
localeOverride.translate('common.date_grouping.april_mmm'),
|
|
54
|
+
localeOverride.translate('common.date_grouping.may_mmm'),
|
|
55
|
+
localeOverride.translate('common.date_grouping.june_mmm'),
|
|
56
|
+
localeOverride.translate('common.date_grouping.july_mmm'),
|
|
57
|
+
localeOverride.translate('common.date_grouping.august_mmm'),
|
|
58
|
+
localeOverride.translate('common.date_grouping.september_mmm'),
|
|
59
|
+
localeOverride.translate('common.date_grouping.october_mmm'),
|
|
60
|
+
localeOverride.translate('common.date_grouping.november_mmm'),
|
|
61
|
+
localeOverride.translate('common.date_grouping.december_mmm')
|
|
62
|
+
],
|
|
63
|
+
today: localeOverride.translate('common.calendar.today')
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
}
|
|
@@ -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;
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './I18N_CALENDAR';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './I18N_CALENDAR';
|
|
@@ -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,4 +1,5 @@
|
|
|
1
1
|
import { RELATIVE_UNIT_INFO } from "../../../dates/relative/constants/RELATIVE_UNIT_INFO";
|
|
2
|
+
import { I18N_CALENDAR } from "../calendar";
|
|
2
3
|
import { I18N_AGGREGATE_LABEL } from "./I18N_AGGREGATE_LABEL";
|
|
3
4
|
import { I18N_COLUMN_LABEL } from "./I18N_COLUMN_LABEL";
|
|
4
5
|
import { I18N_COLUMN_PROPERTY_LABEL } from "./I18N_COLUMN_PROPERTY_LABEL";
|
|
@@ -6,6 +7,7 @@ import { I18N_DATE_GROUPING } from "./I18N_DATE_GROUPING";
|
|
|
6
7
|
import { I18N_DAY_NAMES } from "./I18N_DAY_NAMES";
|
|
7
8
|
export const I18N_COMMON = {
|
|
8
9
|
aggregate_labels: I18N_AGGREGATE_LABEL,
|
|
10
|
+
calendar: I18N_CALENDAR,
|
|
9
11
|
column_types: I18N_COLUMN_LABEL,
|
|
10
12
|
column_types_suffixes: {
|
|
11
13
|
slidebar_one: 'Step',
|
|
@@ -2,6 +2,13 @@ import { DATE_WEEK_DAYS } from "../../../dates/constants/DATE_WEEK_DAYS";
|
|
|
2
2
|
import { DATE_WEEK_DAYS_DDDD } from "../../../dates/constants/DATE_WEEK_DAYS_DDDD";
|
|
3
3
|
import { capitalize } from "../../../general/string/capitalize";
|
|
4
4
|
export const I18N_DAY_NAMES = {
|
|
5
|
+
sunday_dd: capitalize(DATE_WEEK_DAYS[0].substring(0, 2)),
|
|
6
|
+
monday_dd: capitalize(DATE_WEEK_DAYS[1].substring(0, 2)),
|
|
7
|
+
tuesday_dd: capitalize(DATE_WEEK_DAYS[2].substring(0, 2)),
|
|
8
|
+
wednesday_dd: capitalize(DATE_WEEK_DAYS[3].substring(0, 2)),
|
|
9
|
+
thursday_dd: capitalize(DATE_WEEK_DAYS[4].substring(0, 2)),
|
|
10
|
+
friday_dd: capitalize(DATE_WEEK_DAYS[5].substring(0, 2)),
|
|
11
|
+
saturday_dd: capitalize(DATE_WEEK_DAYS[6].substring(0, 2)),
|
|
5
12
|
sunday_ddd: capitalize(DATE_WEEK_DAYS[0]),
|
|
6
13
|
monday_ddd: capitalize(DATE_WEEK_DAYS[1]),
|
|
7
14
|
tuesday_ddd: capitalize(DATE_WEEK_DAYS[2]),
|
|
@@ -26,6 +26,12 @@ export const I18N_FILTER = {
|
|
|
26
26
|
},
|
|
27
27
|
scopes: I18N_FILTER_SCOPE,
|
|
28
28
|
slidebar: I18N_SLIDEBAR,
|
|
29
|
+
token_box: {
|
|
30
|
+
data_tokens: 'DataTokens',
|
|
31
|
+
search: 'Search',
|
|
32
|
+
system_tokens: 'SystemTokens',
|
|
33
|
+
user_tokens: 'UserTokens',
|
|
34
|
+
},
|
|
29
35
|
validators: I18N_FILTER_VALIDATOR,
|
|
30
36
|
value_container: I18N_VALUE_CONTAINER,
|
|
31
37
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/interfaces/index.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IGetValueWithSuffixesSettings } from "../interfaces/IGetValueWithSuffixesSettings";
|
|
2
|
+
/**
|
|
3
|
+
* Get a string value with suffixes if available.
|
|
4
|
+
* Add suffix into the value string. Prioritized for numeric values.
|
|
5
|
+
* @param value a number or string
|
|
6
|
+
* @param suffixes An object with singular or plural suffix string.
|
|
7
|
+
* @returns a string value with suffix
|
|
8
|
+
*/
|
|
9
|
+
export declare function getValueWithSuffixes(value: string | number, settings: IGetValueWithSuffixesSettings): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { isEmpty } from "../../general/mix/isEmpty";
|
|
2
|
+
import { isNaNV2 } from "../../general/mix/isNaNV2";
|
|
3
|
+
/**
|
|
4
|
+
* Get a string value with suffixes if available.
|
|
5
|
+
* Add suffix into the value string. Prioritized for numeric values.
|
|
6
|
+
* @param value a number or string
|
|
7
|
+
* @param suffixes An object with singular or plural suffix string.
|
|
8
|
+
* @returns a string value with suffix
|
|
9
|
+
*/
|
|
10
|
+
export function getValueWithSuffixes(value, settings) {
|
|
11
|
+
let suffix = '';
|
|
12
|
+
if (!isNaNV2(value)) {
|
|
13
|
+
if (!isEmpty(settings.suffixTranslateLabel) && !isEmpty(settings.translate))
|
|
14
|
+
suffix = settings.translate(settings.suffixTranslateLabel, { count: +value });
|
|
15
|
+
if (!isEmpty(settings.suffixes))
|
|
16
|
+
suffix = (+value > 1 || +value === 0) ? settings.suffixes.plural : settings.suffixes.singular;
|
|
17
|
+
}
|
|
18
|
+
return value + (!isEmpty(suffix) ? ' ' + suffix : '');
|
|
19
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ITransformValueSettings } from "../interfaces/ITransformValueSettings";
|
|
2
|
+
/**
|
|
3
|
+
* Transforms a value depending of localization/globalization and extras settings.
|
|
4
|
+
* @param value A value to transform
|
|
5
|
+
* @param settings The settings of the transformValue function
|
|
6
|
+
* @returns A transformed value
|
|
7
|
+
*/
|
|
8
|
+
export declare function transformValue(value: string, settings: ITransformValueSettings): string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { isDateColumn } from "../../columns/helpers/isDateColumn";
|
|
2
|
+
import { isNumericalColumn } from "../../columns/helpers/isNumericalColumn";
|
|
3
|
+
import { DATE_GROUPING_PROPERTY } from "../../dates/constants/DATE_GROUPING_PROPERTY";
|
|
4
|
+
import { DATE_GROUPING_TIME_PROPERTY } from "../../dates/constants/DATE_GROUPING_TIME_PROPERTY";
|
|
5
|
+
import { addFormat } from "../../format/format";
|
|
6
|
+
import { getI18nDateGroupLabel } from "../../globalization/helpers/getI18nDateGroupLabel";
|
|
7
|
+
import { getValueWithSuffixes } from "./getValueWithSuffixes";
|
|
8
|
+
/**
|
|
9
|
+
* Transforms a value depending of localization/globalization and extras settings.
|
|
10
|
+
* @param value A value to transform
|
|
11
|
+
* @param settings The settings of the transformValue function
|
|
12
|
+
* @returns A transformed value
|
|
13
|
+
*/
|
|
14
|
+
export function transformValue(value, settings) {
|
|
15
|
+
const valueWithI18n = getI18nDateGroupLabel(value, settings.property, settings.translate);
|
|
16
|
+
const valueWithLocalization = addFormat(valueWithI18n, getOutputFormat(settings), getFormatConfig(settings));
|
|
17
|
+
return getValueWithSuffixes(valueWithLocalization, { suffixTranslateLabel: settings.suffixTranslateLabel, translate: settings.translate });
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Gets the outputformat settings
|
|
21
|
+
* @param settings The settings of the transformValue function
|
|
22
|
+
* @returns the outputformat settings
|
|
23
|
+
*/
|
|
24
|
+
function getOutputFormat(settings) {
|
|
25
|
+
let type, format;
|
|
26
|
+
if (isDateColumn(settings.column) && [DATE_GROUPING_PROPERTY.DAY, DATE_GROUPING_TIME_PROPERTY.HOUR, DATE_GROUPING_TIME_PROPERTY.MINUTE, DATE_GROUPING_TIME_PROPERTY.SECOND].includes(settings.property)) {
|
|
27
|
+
type = 'DATE';
|
|
28
|
+
format = 'Default';
|
|
29
|
+
}
|
|
30
|
+
else if (isNumericalColumn(settings.column)) {
|
|
31
|
+
type = 'NUMERIC';
|
|
32
|
+
}
|
|
33
|
+
return { type, format };
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Gets the format config
|
|
37
|
+
* @param settings The settings of the transformValue function
|
|
38
|
+
* @returns the format config
|
|
39
|
+
*/
|
|
40
|
+
function getFormatConfig(settings) {
|
|
41
|
+
return { lang: settings.locale };
|
|
42
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { II18nServiceTranslate } from "../../globalization/interfaces/II18nServiceTranslate";
|
|
2
|
+
export interface IGetValueWithSuffixesSettings {
|
|
3
|
+
translate?: II18nServiceTranslate;
|
|
4
|
+
suffixTranslateLabel?: string;
|
|
5
|
+
suffixes?: IGetValueWithSuffixesSettingsSuffixes;
|
|
6
|
+
}
|
|
7
|
+
interface IGetValueWithSuffixesSettingsSuffixes {
|
|
8
|
+
singular: string;
|
|
9
|
+
plural: string;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IColumn } from "../../columns/interfaces/IColumn";
|
|
2
|
+
import { IColumnPropertyType } from "../../columns/interfaces/IColumnPropertyType";
|
|
3
|
+
import { II18nServiceTranslate } from "../../globalization/interfaces/II18nServiceTranslate";
|
|
4
|
+
export interface ITransformValueSettings {
|
|
5
|
+
column: IColumn;
|
|
6
|
+
property: IColumnPropertyType;
|
|
7
|
+
translate: II18nServiceTranslate;
|
|
8
|
+
locale: string;
|
|
9
|
+
suffixTranslateLabel?: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { CHART_ENDPOINT } from "../constants/CHART_ENDPOINT";
|
|
2
2
|
import Request from "../helpers/Request";
|
|
3
3
|
import { BDatasetsToUIDatasets } from "../adapters/BDatasetsToUIDatasets.adapter";
|
|
4
|
+
import { LANG_DEFAULT } from "../../format/definition";
|
|
5
|
+
import { getLang } from "../..";
|
|
4
6
|
/**
|
|
5
7
|
* Get a dataset by Qrvey ID
|
|
6
8
|
* @param qrveyid The Qrvey ID
|
|
7
9
|
* @returns a promise
|
|
8
10
|
*/
|
|
9
11
|
export function getDatasetColumns(config, qrveyid) {
|
|
12
|
+
var _a;
|
|
13
|
+
const lang = getLang(config.lang || ((_a = config.locale) === null || _a === void 0 ? void 0 : _a.lang) || config.locale || LANG_DEFAULT).lang;
|
|
10
14
|
return Request.post(Object.assign(Object.assign({}, config), { qrveyid, endpoint: CHART_ENDPOINT }), '/question/list', {
|
|
11
15
|
'optionsAttributes': ['id', 'text', 'type', 'property', 'linked', 'linkid', 'qrveyid', 'bucketId', 'formulaId', 'formulaType', 'geogroup', 'outputFormat'],
|
|
12
16
|
'extend': true
|
|
13
|
-
})
|
|
17
|
+
}, { lang })
|
|
14
18
|
.then(BDatasetsToUIDatasets)
|
|
15
19
|
.catch(_e => []);
|
|
16
20
|
}
|
package/package.json
CHANGED
|
@@ -11,6 +11,7 @@ export function getFilterBuilderGeneralConfig(config: any = {}): IFilterBuilderG
|
|
|
11
11
|
apiKey: getAttribute(config, 'api_key') || config.apiKey,
|
|
12
12
|
appid: getAttribute(config, 'app_id') || config.appid,
|
|
13
13
|
domain: config.domain,
|
|
14
|
+
locale: config.locale,
|
|
14
15
|
qv_token: config.qv_token,
|
|
15
16
|
timezoneControl: getAttribute(config, 'timezone_control') || config.timezoneControl,
|
|
16
17
|
userid: getAttribute(config, 'user_id') || config.userid,
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { isEmpty } from "../../../general/mix/isEmpty";
|
|
2
|
+
import { transformValue } from "../../../qrvey/helpers/transformValue";
|
|
3
|
+
import { IFSFilter } from "../../interfaces/common/IFSFilter";
|
|
4
|
+
import { IFSValue } from "../../interfaces/common/IFSValue";
|
|
5
|
+
import { IFSValueRange } from "../../interfaces/common/IFSValueRange";
|
|
6
|
+
import { IFValue } from "../../interfaces/IFValue";
|
|
7
|
+
import { IFUTransformFilterValuesSettings } from "../../interfaces/ui/IFUTransformFilterValuesSettings";
|
|
8
|
+
import { isRangeValidator } from "../common/isRangeValidator";
|
|
9
|
+
import { isRegularValidator } from "../common/isRegularValidator";
|
|
10
|
+
|
|
11
|
+
export function transformFilterValues(filter: IFSFilter, settings: IFUTransformFilterValuesSettings): IFValue[] {
|
|
12
|
+
const transformValueSettings = { ...settings, column: filter.column, property: filter.property };
|
|
13
|
+
if (isEmpty(filter)) return [];
|
|
14
|
+
|
|
15
|
+
if (isRegularValidator(filter.validator)) {
|
|
16
|
+
return (filter.values as IFSValue[]).map((value: IFSValue) => ({
|
|
17
|
+
...value,
|
|
18
|
+
value: transformValue(value.value, transformValueSettings),
|
|
19
|
+
}));
|
|
20
|
+
} else if (isRangeValidator(filter.validator)) {
|
|
21
|
+
return (filter.values as IFSValueRange[]).map((value: IFSValueRange) => ({
|
|
22
|
+
...value,
|
|
23
|
+
min: transformValue(value.min, transformValueSettings),
|
|
24
|
+
max: transformValue(value.max, transformValueSettings)
|
|
25
|
+
}));
|
|
26
|
+
} else {
|
|
27
|
+
return filter.values;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -6,6 +6,7 @@ export interface IFilterBuilderGeneralConfig {
|
|
|
6
6
|
appid: string; // App ID
|
|
7
7
|
domain: string; // The domain of the environment
|
|
8
8
|
qv_token?: string; // Qrvey Token for RLS
|
|
9
|
-
timezoneControl?: string;
|
|
9
|
+
timezoneControl?: string; // Offset number for Timezone
|
|
10
|
+
locale?: string; // Localization setting
|
|
10
11
|
userid: string; // User ID
|
|
11
12
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { II18nServiceTranslate } from "../../../globalization/interfaces/II18nServiceTranslate";
|
|
2
|
+
|
|
3
|
+
export interface IFUTransformFilterValuesSettings {
|
|
4
|
+
translate: II18nServiceTranslate; // Function for getting translations
|
|
5
|
+
locale: string; // The locale string
|
|
6
|
+
suffixTranslateLabel?: string // The i18n label for the suffix values.
|
|
7
|
+
}
|