@qrvey/utils 1.10.0-0 → 1.10.0-10
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/dist/charts/adapters/endpointData.js +0 -3
- package/dist/cjs/charts/adapters/endpointData.js +0 -3
- package/dist/cjs/columns/constants/COLUMN_PROPERTIES.d.ts +1 -1
- package/dist/cjs/columns/helpers/isNumericalColumn.js +3 -1
- package/dist/cjs/dates/adapters/ISOToNumericOffset.d.ts +6 -0
- package/dist/cjs/dates/adapters/ISOToNumericOffset.js +21 -0
- package/dist/cjs/dates/adapters/dateToHms.js +8 -10
- package/dist/cjs/dates/adapters/dateToMdyDate.d.ts +2 -1
- package/dist/cjs/dates/adapters/dateToMdyDate.js +9 -3
- package/dist/cjs/dates/adapters/dateToMonthYear.d.ts +2 -1
- package/dist/cjs/dates/adapters/dateToMonthYear.js +7 -3
- package/dist/cjs/dates/adapters/dateToQuarterYear.d.ts +2 -1
- package/dist/cjs/dates/adapters/dateToQuarterYear.js +8 -4
- package/dist/cjs/dates/adapters/dateToWeekYear.d.ts +2 -1
- package/dist/cjs/dates/adapters/dateToWeekYear.js +6 -2
- package/dist/cjs/dates/adapters/dateToYear.d.ts +2 -1
- package/dist/cjs/dates/adapters/dateToYear.js +7 -3
- package/dist/cjs/dates/adapters/hmsToDate.d.ts +2 -1
- package/dist/cjs/dates/adapters/hmsToDate.js +6 -2
- package/dist/cjs/dates/adapters/index.d.ts +2 -0
- package/dist/cjs/dates/adapters/index.js +2 -0
- package/dist/cjs/dates/adapters/mdyDateToDate.d.ts +2 -1
- package/dist/cjs/dates/adapters/mdyDateToDate.js +7 -2
- package/dist/cjs/dates/adapters/monthYearToDate.d.ts +2 -1
- package/dist/cjs/dates/adapters/monthYearToDate.js +6 -2
- package/dist/cjs/dates/adapters/numericOffsetToISO.d.ts +6 -0
- package/dist/cjs/dates/adapters/numericOffsetToISO.js +34 -0
- package/dist/cjs/dates/adapters/quarterYearToDate.d.ts +2 -1
- package/dist/cjs/dates/adapters/quarterYearToDate.js +6 -2
- package/dist/cjs/dates/adapters/weekYearToDate.d.ts +2 -1
- package/dist/cjs/dates/adapters/weekYearToDate.js +10 -6
- package/dist/cjs/dates/adapters/yearToDate.d.ts +2 -1
- package/dist/cjs/dates/adapters/yearToDate.js +6 -2
- package/dist/cjs/dates/constants/ISO_8601_REGEX.d.ts +1 -0
- package/dist/cjs/dates/constants/ISO_8601_REGEX.js +4 -0
- package/dist/cjs/dates/constants/TIMEZONE_TYPE.d.ts +5 -0
- package/dist/cjs/dates/constants/TIMEZONE_TYPE.js +9 -0
- package/dist/cjs/dates/constants/index.d.ts +1 -0
- package/dist/cjs/dates/constants/index.js +1 -0
- package/dist/cjs/dates/helpers/getDateByDateFormat.d.ts +2 -1
- package/dist/cjs/dates/helpers/getDateByDateFormat.js +6 -6
- package/dist/cjs/dates/helpers/getDateByTimezone.d.ts +8 -0
- package/dist/cjs/dates/helpers/getDateByTimezone.js +24 -0
- package/dist/cjs/dates/helpers/getDateByTimezoneOffset.d.ts +7 -0
- package/dist/cjs/dates/helpers/getDateByTimezoneOffset.js +33 -0
- package/dist/cjs/dates/helpers/getDefaultDateSettings.d.ts +7 -0
- package/dist/cjs/dates/helpers/getDefaultDateSettings.js +17 -0
- package/dist/cjs/dates/helpers/getFormattedDateByFormat.d.ts +2 -1
- package/dist/cjs/dates/helpers/getFormattedDateByFormat.js +7 -7
- package/dist/cjs/dates/helpers/getTimezoneObject.d.ts +11 -0
- package/dist/cjs/dates/helpers/getTimezoneObject.js +107 -0
- package/dist/cjs/dates/helpers/getTimezoneOffsetByType.d.ts +13 -0
- package/dist/cjs/dates/helpers/getTimezoneOffsetByType.js +27 -0
- package/dist/cjs/dates/helpers/getUTCFormatByOffset.d.ts +7 -0
- package/dist/cjs/dates/helpers/getUTCFormatByOffset.js +17 -0
- package/dist/cjs/dates/helpers/getWeek.js +6 -6
- package/dist/cjs/dates/helpers/index.d.ts +6 -1
- package/dist/cjs/dates/helpers/index.js +6 -1
- package/dist/cjs/dates/helpers/isValidISOOffset.d.ts +7 -0
- package/dist/cjs/dates/helpers/isValidISOOffset.js +17 -0
- package/dist/cjs/dates/interfaces/IBTimezone.d.ts +7 -0
- package/dist/cjs/dates/interfaces/IBTimezone.js +2 -0
- package/dist/cjs/dates/interfaces/IBTimezoneType.d.ts +2 -0
- package/dist/cjs/dates/interfaces/IBTimezoneType.js +2 -0
- package/dist/cjs/dates/interfaces/IDFDateToHmsSettings.d.ts +2 -1
- package/dist/cjs/dates/interfaces/IDTimezone.d.ts +7 -0
- package/dist/cjs/dates/interfaces/IDTimezone.js +2 -0
- package/dist/cjs/dates/interfaces/IDTimezoneOffset.d.ts +1 -0
- package/dist/cjs/dates/interfaces/IDTimezoneOffset.js +2 -0
- package/dist/cjs/dates/interfaces/IDTimezoneType.d.ts +2 -0
- package/dist/cjs/dates/interfaces/IDTimezoneType.js +2 -0
- package/dist/cjs/dates/interfaces/IDateSettings.d.ts +5 -0
- package/dist/cjs/dates/interfaces/IDateSettings.js +2 -0
- package/dist/cjs/dates/interfaces/index.d.ts +6 -0
- package/dist/cjs/dates/interfaces/index.js +6 -0
- package/dist/cjs/filters/helpers/builder/getFilterBuilderGeneralConfig.js +1 -1
- package/dist/cjs/filters/helpers/common/getFiltersByTimezone.d.ts +10 -0
- package/dist/cjs/filters/helpers/common/getFiltersByTimezone.js +26 -0
- package/dist/cjs/filters/helpers/common/index.d.ts +1 -0
- package/dist/cjs/filters/helpers/common/index.js +1 -0
- package/dist/cjs/filters/interfaces/ui/IFUTransformFilterValuesSettings.d.ts +6 -0
- package/dist/cjs/filters/services/Filters.api.js +1 -1
- package/dist/cjs/format/format.d.ts +1 -1
- package/dist/cjs/format/format.js +21 -4
- package/dist/cjs/format/localization.js +10 -1
- package/dist/cjs/general/index.d.ts +1 -0
- package/dist/cjs/general/index.js +1 -0
- package/dist/cjs/general/numeric/getSign.d.ts +6 -0
- package/dist/cjs/general/numeric/getSign.js +12 -0
- package/dist/cjs/general/numeric/index.d.ts +1 -0
- package/dist/cjs/general/numeric/index.js +17 -0
- package/dist/cjs/general/object/applyTimezoneDeep.d.ts +8 -0
- package/dist/cjs/general/object/applyTimezoneDeep.js +44 -0
- package/dist/cjs/general/object/index.d.ts +1 -0
- package/dist/cjs/general/object/index.js +1 -0
- package/dist/cjs/general/object/mergeDeep.d.ts +6 -0
- package/dist/cjs/general/object/mergeDeep.js +12 -10
- package/dist/cjs/globalization/labels/filters/I18N_RELATIVE_CONTAINER.js +1 -1
- package/dist/cjs/globalization/labels/formula_builder/I18N_FORMULA_BUILDER.js +3 -3
- package/dist/cjs/globalization/labels/panel/I18N_PANEL.js +1 -1
- package/dist/cjs/interfaces/format/IFormatConfig.Interface.d.ts +1 -0
- package/dist/cjs/interfaces/general/IWidgetConfig.d.ts +2 -1
- package/dist/cjs/qrvey/helpers/transformValue.js +31 -6
- package/dist/cjs/qrvey/interfaces/IBDataset.d.ts +2 -0
- package/dist/cjs/qrvey/interfaces/IBModel.d.ts +5 -0
- package/dist/cjs/qrvey/interfaces/IDataset.d.ts +3 -1
- package/dist/cjs/qrvey/interfaces/IModel.d.ts +3 -1
- package/dist/cjs/qrvey/interfaces/ITransformValueSettings.d.ts +6 -0
- package/dist/cjs/services/adapters/BDatasetsToUIDatasets.adapter.js +2 -0
- package/dist/cjs/services/adapters/BModelToUIModel.adapter.js +2 -0
- package/dist/cjs/services/adapters/BTimezoneToUITimezone.d.ts +8 -0
- package/dist/cjs/services/adapters/BTimezoneToUITimezone.js +18 -0
- package/dist/cjs/services/helpers/Request.d.ts +1 -1
- package/dist/cjs/services/helpers/Request.js +11 -5
- package/dist/columns/constants/COLUMN_PROPERTIES.d.ts +1 -1
- package/dist/columns/helpers/isNumericalColumn.js +3 -1
- package/dist/dates/adapters/ISOToNumericOffset.d.ts +6 -0
- package/dist/dates/adapters/ISOToNumericOffset.js +17 -0
- package/dist/dates/adapters/dateToHms.js +8 -10
- package/dist/dates/adapters/dateToMdyDate.d.ts +2 -1
- package/dist/dates/adapters/dateToMdyDate.js +9 -3
- package/dist/dates/adapters/dateToMonthYear.d.ts +2 -1
- package/dist/dates/adapters/dateToMonthYear.js +7 -3
- package/dist/dates/adapters/dateToQuarterYear.d.ts +2 -1
- package/dist/dates/adapters/dateToQuarterYear.js +8 -4
- package/dist/dates/adapters/dateToWeekYear.d.ts +2 -1
- package/dist/dates/adapters/dateToWeekYear.js +6 -2
- package/dist/dates/adapters/dateToYear.d.ts +2 -1
- package/dist/dates/adapters/dateToYear.js +7 -3
- package/dist/dates/adapters/hmsToDate.d.ts +2 -1
- package/dist/dates/adapters/hmsToDate.js +6 -2
- package/dist/dates/adapters/index.d.ts +2 -0
- package/dist/dates/adapters/index.js +2 -0
- package/dist/dates/adapters/mdyDateToDate.d.ts +2 -1
- package/dist/dates/adapters/mdyDateToDate.js +7 -2
- package/dist/dates/adapters/monthYearToDate.d.ts +2 -1
- package/dist/dates/adapters/monthYearToDate.js +6 -2
- package/dist/dates/adapters/numericOffsetToISO.d.ts +6 -0
- package/dist/dates/adapters/numericOffsetToISO.js +30 -0
- package/dist/dates/adapters/quarterYearToDate.d.ts +2 -1
- package/dist/dates/adapters/quarterYearToDate.js +6 -2
- package/dist/dates/adapters/weekYearToDate.d.ts +2 -1
- package/dist/dates/adapters/weekYearToDate.js +10 -6
- package/dist/dates/adapters/yearToDate.d.ts +2 -1
- package/dist/dates/adapters/yearToDate.js +6 -2
- package/dist/dates/constants/ISO_8601_REGEX.d.ts +1 -0
- package/dist/dates/constants/ISO_8601_REGEX.js +1 -0
- package/dist/dates/constants/TIMEZONE_TYPE.d.ts +5 -0
- package/dist/dates/constants/TIMEZONE_TYPE.js +6 -0
- package/dist/dates/constants/index.d.ts +1 -0
- package/dist/dates/constants/index.js +1 -0
- package/dist/dates/helpers/getDateByDateFormat.d.ts +2 -1
- package/dist/dates/helpers/getDateByDateFormat.js +6 -6
- package/dist/dates/helpers/getDateByTimezone.d.ts +8 -0
- package/dist/dates/helpers/getDateByTimezone.js +20 -0
- package/dist/dates/helpers/getDateByTimezoneOffset.d.ts +7 -0
- package/dist/dates/helpers/getDateByTimezoneOffset.js +26 -0
- package/dist/dates/helpers/getDefaultDateSettings.d.ts +7 -0
- package/dist/dates/helpers/getDefaultDateSettings.js +13 -0
- package/dist/dates/helpers/getFormattedDateByFormat.d.ts +2 -1
- package/dist/dates/helpers/getFormattedDateByFormat.js +7 -7
- package/dist/dates/helpers/getTimezoneObject.d.ts +11 -0
- package/dist/dates/helpers/getTimezoneObject.js +103 -0
- package/dist/dates/helpers/getTimezoneOffsetByType.d.ts +13 -0
- package/dist/dates/helpers/getTimezoneOffsetByType.js +23 -0
- package/dist/dates/helpers/getUTCFormatByOffset.d.ts +7 -0
- package/dist/dates/helpers/getUTCFormatByOffset.js +13 -0
- package/dist/dates/helpers/getWeek.js +6 -6
- package/dist/dates/helpers/index.d.ts +6 -1
- package/dist/dates/helpers/index.js +6 -1
- package/dist/dates/helpers/isValidISOOffset.d.ts +7 -0
- package/dist/dates/helpers/isValidISOOffset.js +13 -0
- package/dist/dates/interfaces/IBTimezone.d.ts +7 -0
- package/dist/dates/interfaces/IBTimezone.js +1 -0
- package/dist/dates/interfaces/IBTimezoneType.d.ts +2 -0
- package/dist/dates/interfaces/IBTimezoneType.js +1 -0
- package/dist/dates/interfaces/IDFDateToHmsSettings.d.ts +2 -1
- package/dist/dates/interfaces/IDTimezone.d.ts +7 -0
- package/dist/dates/interfaces/IDTimezone.js +1 -0
- package/dist/dates/interfaces/IDTimezoneOffset.d.ts +1 -0
- package/dist/dates/interfaces/IDTimezoneOffset.js +1 -0
- package/dist/dates/interfaces/IDTimezoneType.d.ts +2 -0
- package/dist/dates/interfaces/IDTimezoneType.js +1 -0
- package/dist/dates/interfaces/IDateSettings.d.ts +5 -0
- package/dist/dates/interfaces/IDateSettings.js +1 -0
- package/dist/dates/interfaces/index.d.ts +6 -0
- package/dist/dates/interfaces/index.js +6 -0
- package/dist/filters/helpers/builder/getFilterBuilderGeneralConfig.js +1 -1
- package/dist/filters/helpers/common/getFiltersByTimezone.d.ts +10 -0
- package/dist/filters/helpers/common/getFiltersByTimezone.js +22 -0
- package/dist/filters/helpers/common/index.d.ts +1 -0
- package/dist/filters/helpers/common/index.js +1 -0
- package/dist/filters/interfaces/ui/IFUTransformFilterValuesSettings.d.ts +6 -0
- package/dist/filters/services/Filters.api.js +1 -1
- package/dist/format/format.d.ts +1 -1
- package/dist/format/format.js +21 -4
- package/dist/format/localization.js +10 -1
- package/dist/general/index.d.ts +1 -0
- package/dist/general/index.js +1 -0
- package/dist/general/numeric/getSign.d.ts +6 -0
- package/dist/general/numeric/getSign.js +8 -0
- package/dist/general/numeric/index.d.ts +1 -0
- package/dist/general/numeric/index.js +1 -0
- package/dist/general/object/applyTimezoneDeep.d.ts +8 -0
- package/dist/general/object/applyTimezoneDeep.js +40 -0
- package/dist/general/object/index.d.ts +1 -0
- package/dist/general/object/index.js +1 -0
- package/dist/general/object/mergeDeep.d.ts +6 -0
- package/dist/general/object/mergeDeep.js +12 -10
- package/dist/globalization/labels/filters/I18N_RELATIVE_CONTAINER.js +1 -1
- package/dist/globalization/labels/formula_builder/I18N_FORMULA_BUILDER.js +3 -3
- package/dist/globalization/labels/panel/I18N_PANEL.js +1 -1
- package/dist/interfaces/format/IFormatConfig.Interface.d.ts +1 -0
- package/dist/interfaces/general/IWidgetConfig.d.ts +2 -1
- package/dist/qrvey/helpers/transformValue.js +31 -6
- package/dist/qrvey/interfaces/IBDataset.d.ts +2 -0
- package/dist/qrvey/interfaces/IBModel.d.ts +5 -0
- package/dist/qrvey/interfaces/IDataset.d.ts +3 -1
- package/dist/qrvey/interfaces/IModel.d.ts +3 -1
- package/dist/qrvey/interfaces/ITransformValueSettings.d.ts +6 -0
- package/dist/services/adapters/BDatasetsToUIDatasets.adapter.js +2 -0
- package/dist/services/adapters/BModelToUIModel.adapter.js +2 -0
- package/dist/services/adapters/BTimezoneToUITimezone.d.ts +8 -0
- package/dist/services/adapters/BTimezoneToUITimezone.js +14 -0
- package/dist/services/helpers/Request.d.ts +1 -1
- package/dist/services/helpers/Request.js +11 -5
- package/package.json +5 -5
- package/dist/cjs/dates/helpers/adjustTimezone.d.ts +0 -6
- package/dist/cjs/dates/helpers/adjustTimezone.js +0 -19
- package/dist/dates/helpers/adjustTimezone.d.ts +0 -6
- package/dist/dates/helpers/adjustTimezone.js +0 -15
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
export * from "./IBTimezone";
|
|
2
|
+
export * from "./IBTimezoneType";
|
|
1
3
|
export * from "./IDateFormat";
|
|
2
4
|
export * from "./IDateGroupingProperty";
|
|
5
|
+
export * from "./IDateSettings";
|
|
3
6
|
export * from "./IDFDateToHmsSettings";
|
|
7
|
+
export * from "./IDTimezone";
|
|
8
|
+
export * from "./IDTimezoneOffset";
|
|
9
|
+
export * from "./IDTimezoneType";
|
|
@@ -11,7 +11,7 @@ export function getFilterBuilderGeneralConfig(config = {}) {
|
|
|
11
11
|
domain: config.domain,
|
|
12
12
|
i18n: config.i18n,
|
|
13
13
|
qv_token: config.qv_token,
|
|
14
|
-
|
|
14
|
+
timezone: config.timezone,
|
|
15
15
|
userid: getAttribute(config, "user_id") || config.userid,
|
|
16
16
|
};
|
|
17
17
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IDTimezone } from "../../../dates/interfaces/IDTimezone";
|
|
2
|
+
import { IFSData } from "../../interfaces/common/IFSData";
|
|
3
|
+
import { IFUData } from "../../interfaces/ui/IFUData";
|
|
4
|
+
/**
|
|
5
|
+
* Gets and transforms the Filter Data by the Timezone object
|
|
6
|
+
* @param {IFSData | IFUData} filterData the filter data
|
|
7
|
+
* @param {IDTimezone} timezone the timezone object
|
|
8
|
+
* @returns {IFSData | IFUData} the new filter data with the transformed datetime values
|
|
9
|
+
*/
|
|
10
|
+
export declare function getFiltersByTimezone(filterData: IFSData | IFUData, timezone: IDTimezone): IFUData | IFSData;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { isEmpty } from "../../../general/mix/isEmpty";
|
|
2
|
+
import { transformFilterValues } from "../ui/transformFilterValues";
|
|
3
|
+
/**
|
|
4
|
+
* Gets and transforms the Filter Data by the Timezone object
|
|
5
|
+
* @param {IFSData | IFUData} filterData the filter data
|
|
6
|
+
* @param {IDTimezone} timezone the timezone object
|
|
7
|
+
* @returns {IFSData | IFUData} the new filter data with the transformed datetime values
|
|
8
|
+
*/
|
|
9
|
+
export function getFiltersByTimezone(filterData, timezone) {
|
|
10
|
+
if (isEmpty(filterData) ||
|
|
11
|
+
isEmpty(filterData.scopes) ||
|
|
12
|
+
!Array.isArray(filterData.scopes))
|
|
13
|
+
return filterData;
|
|
14
|
+
return Object.assign(Object.assign({}, filterData), { scopes: filterData.scopes.map((scope) => (Object.assign(Object.assign({}, scope), { datasets: scope.datasets.map((dataset) => (Object.assign(Object.assign({}, dataset), { filters: dataset.filters.map((filter) => (Object.assign(Object.assign({}, filter), { values: transformFilterValues(filter, {
|
|
15
|
+
timezone,
|
|
16
|
+
translate: undefined,
|
|
17
|
+
i18n: undefined,
|
|
18
|
+
noLocale: true,
|
|
19
|
+
noSuffix: true,
|
|
20
|
+
noTranslate: true,
|
|
21
|
+
}) }))) }))) }))) });
|
|
22
|
+
}
|
|
@@ -10,6 +10,7 @@ export * from "./getFiltersByDatasetsColumns";
|
|
|
10
10
|
export * from "./getFiltersByParams";
|
|
11
11
|
export * from "./getFiltersByScopes";
|
|
12
12
|
export * from "./getFiltersByScopesIds";
|
|
13
|
+
export * from "./getFiltersByTimezone";
|
|
13
14
|
export * from "./getFiltersByVisibility";
|
|
14
15
|
export * from "./getMergeFiltersSettings";
|
|
15
16
|
export * from "./getParamsToGetFilterSettings";
|
|
@@ -10,6 +10,7 @@ export * from "./getFiltersByDatasetsColumns";
|
|
|
10
10
|
export * from "./getFiltersByParams";
|
|
11
11
|
export * from "./getFiltersByScopes";
|
|
12
12
|
export * from "./getFiltersByScopesIds";
|
|
13
|
+
export * from "./getFiltersByTimezone";
|
|
13
14
|
export * from "./getFiltersByVisibility";
|
|
14
15
|
export * from "./getMergeFiltersSettings";
|
|
15
16
|
export * from "./getParamsToGetFilterSettings";
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import { IDTimezone } from "../../../dates/interfaces/IDTimezone";
|
|
1
2
|
import { II18nConfig } from "../../../globalization/interfaces/II18nConfig";
|
|
2
3
|
import { II18nServiceTranslate } from "../../../globalization/interfaces/II18nServiceTranslate";
|
|
3
4
|
export interface IFUTransformFilterValuesSettings {
|
|
5
|
+
timezone?: IDTimezone;
|
|
4
6
|
translate: II18nServiceTranslate;
|
|
5
7
|
i18n: II18nConfig;
|
|
6
8
|
suffixTranslateLabel?: string;
|
|
9
|
+
noLocale?: boolean;
|
|
10
|
+
noTranslate?: boolean;
|
|
11
|
+
noSuffix?: boolean;
|
|
12
|
+
noTimezone?: boolean;
|
|
7
13
|
}
|
|
@@ -97,7 +97,7 @@ export class FiltersApi {
|
|
|
97
97
|
else {
|
|
98
98
|
api = this.chartPaginationApi;
|
|
99
99
|
}
|
|
100
|
-
return api.getChartResult(this.config, FiltersApi.getFilter(config), FiltersApi.getLogic(config), FiltersApi.getChartRequest(config), resetApi);
|
|
100
|
+
return api.getChartResult(Object.assign(Object.assign({}, this.config), { timezone: config.widgetConfig.timezone }), FiltersApi.getFilter(config), FiltersApi.getLogic(config), FiltersApi.getChartRequest(config), resetApi);
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
static getLogic(config) {
|
package/dist/format/format.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IFormatConfig } from "../interfaces/format/IFormatConfig.Interface";
|
|
2
|
-
export declare function formatDate(dateString: any, format: any): any;
|
|
2
|
+
export declare function formatDate(dateString: any, format: any, offset: any): any;
|
|
3
3
|
export declare function formatAbbreviated(num: any, decimals: any): any;
|
|
4
4
|
/**
|
|
5
5
|
* Set convert Bytes into MB
|
package/dist/format/format.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { format as d3Format } from "d3-format";
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
3
|
import { DATEGROUP_FORMATTING_UNSUPPORT, appliesFormatting, hasfileSizeProperty, isTextColumn, DEFAULT_DATE, } from "./definition";
|
|
4
|
+
//* *dayjs plugins */
|
|
4
5
|
import isoWeek from "dayjs/plugin/isoWeek";
|
|
5
6
|
import advancedFormat from "dayjs/plugin/advancedFormat";
|
|
7
|
+
import utc from "dayjs/plugin/utc";
|
|
8
|
+
import weekYear from "dayjs/plugin/weekYear";
|
|
9
|
+
import weekOfYear from "dayjs/plugin/weekOfYear";
|
|
10
|
+
import updateLocale from "dayjs/plugin/updateLocale";
|
|
11
|
+
//* * end dayjs plugin imports */
|
|
6
12
|
import { isEmpty } from "../general/mix/isEmpty";
|
|
7
13
|
import { _get } from "../general/object/get";
|
|
8
14
|
import { COLUMN } from "../columns/constants/COLUMN";
|
|
@@ -11,8 +17,15 @@ import { formatWithLocale } from "./localization";
|
|
|
11
17
|
import { isObject } from "../general/object/isObject";
|
|
12
18
|
import { DURATION_PARTS_LIST } from "../column_format/constants/DURATION_PARTS_LIST";
|
|
13
19
|
import { cloneDeep } from "../general/object/cloneDeep";
|
|
20
|
+
dayjs.extend(updateLocale);
|
|
21
|
+
dayjs.updateLocale("en", {
|
|
22
|
+
yearStart: 4,
|
|
23
|
+
});
|
|
14
24
|
dayjs.extend(isoWeek); // Add support for iso week format https://github.com/iamkun/dayjs/issues/1328
|
|
15
25
|
dayjs.extend(advancedFormat); // Add support to advanced formats https://day.js.org/docs/en/plugin/advanced-format
|
|
26
|
+
dayjs.extend(utc);
|
|
27
|
+
dayjs.extend(weekYear);
|
|
28
|
+
dayjs.extend(weekOfYear);
|
|
16
29
|
/**
|
|
17
30
|
* Apply to the given date format to a date value
|
|
18
31
|
* @param bytes type number
|
|
@@ -21,7 +34,7 @@ function isValidDateString(dateString = "") {
|
|
|
21
34
|
return (/^\d{2}\/\d{2}\/\d{4}/.test(dateString) || // MM/DD/YYY OR DD/MM/YYYY
|
|
22
35
|
/^\d{4}-\d{2}-\d{2}/.test(dateString)); // YYYY-MM-DD
|
|
23
36
|
}
|
|
24
|
-
export function formatDate(dateString, format) {
|
|
37
|
+
export function formatDate(dateString, format, offset) {
|
|
25
38
|
let _format = cloneDeep(format);
|
|
26
39
|
if (isObject(format))
|
|
27
40
|
_format = _format.format || "";
|
|
@@ -29,8 +42,12 @@ export function formatDate(dateString, format) {
|
|
|
29
42
|
return dateString;
|
|
30
43
|
if (!isValidDateString(dateString))
|
|
31
44
|
return dateString;
|
|
32
|
-
const
|
|
33
|
-
|
|
45
|
+
const dateStringCleaned = dateString === null || dateString === void 0 ? void 0 : dateString.replace(/Z$/i, "");
|
|
46
|
+
const firstPartOfDateString = dayjs(dateStringCleaned.split(".")[0]);
|
|
47
|
+
const newDateValue = !isEmpty(offset)
|
|
48
|
+
? firstPartOfDateString.utcOffset(offset)
|
|
49
|
+
: firstPartOfDateString;
|
|
50
|
+
return newDateValue.format(_format
|
|
34
51
|
.replace("HH24:", "HH:")
|
|
35
52
|
.replace("MI:SS", "mm:ss")
|
|
36
53
|
.replace("MM:SS", "mm:ss"));
|
|
@@ -135,7 +152,7 @@ export const addFormat = (value, outputFormat = "None", config) => {
|
|
|
135
152
|
: formatDate(value, (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format) === "Default" &&
|
|
136
153
|
((_c = outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) === null || _c === void 0 ? void 0 : _c.format)
|
|
137
154
|
? (_d = outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) === null || _d === void 0 ? void 0 : _d.format
|
|
138
|
-
: outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format);
|
|
155
|
+
: outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format, config === null || config === void 0 ? void 0 : config.offset);
|
|
139
156
|
case "NUMERIC": {
|
|
140
157
|
const parse = parseFloat(value);
|
|
141
158
|
const withLocale = (outputFormat !== "None" && (config === null || config === void 0 ? void 0 : config.lang)) ||
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ISOToNumericOffset } from "../dates";
|
|
1
2
|
import { isEmpty } from "../general/mix/isEmpty";
|
|
2
3
|
import { currencyISO, LANG_DEFAULT, CURRENCY_DEFAULT, DATETIME_OPTIONS, } from "./definition";
|
|
3
4
|
import { DurationFormatter } from "./duration/durationFormatter";
|
|
@@ -23,11 +24,19 @@ export const formatWithLocale = (value, outputFormat, config = {}) => {
|
|
|
23
24
|
return formatLocaleNumber(value, outputFormat, config);
|
|
24
25
|
}
|
|
25
26
|
};
|
|
27
|
+
function getDateWithOffset(dateValue, offset) {
|
|
28
|
+
const targetTime = new Date(dateValue);
|
|
29
|
+
if (!isEmpty(offset))
|
|
30
|
+
targetTime.setUTCMinutes(targetTime.getUTCMinutes() +
|
|
31
|
+
targetTime.getTimezoneOffset() +
|
|
32
|
+
ISOToNumericOffset(offset));
|
|
33
|
+
return targetTime;
|
|
34
|
+
}
|
|
26
35
|
const DATE_FORMAT_CACHE = [];
|
|
27
36
|
function formatLocaleDate(value, outputFormat, config) {
|
|
28
37
|
const { lang = LANG_DEFAULT, options } = config;
|
|
29
38
|
const dateValue = value === null || value === void 0 ? void 0 : value.replace(/Z$/i, "");
|
|
30
|
-
const dateParam =
|
|
39
|
+
const dateParam = getDateWithOffset(dateValue, config === null || config === void 0 ? void 0 : config.offset);
|
|
31
40
|
let langOpts = options;
|
|
32
41
|
if (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) {
|
|
33
42
|
if (isDateTimeFormat(outputFormat))
|
package/dist/general/index.d.ts
CHANGED
package/dist/general/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./getSign";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./getSign";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IDTimezone } from "../../dates/interfaces/IDTimezone";
|
|
2
|
+
/**
|
|
3
|
+
* Transforms the date+times propertiesof the given object by the Timezone object
|
|
4
|
+
* @param {any} obj the object
|
|
5
|
+
* @param {IDTimezone} timezone the timezone object
|
|
6
|
+
* @returns {IFSData | IFUData} the new filter data with the transformed datetime values
|
|
7
|
+
*/
|
|
8
|
+
export declare function applyTimezoneDeep(obj: any, timezone: IDTimezone): any;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { DATE_FORMAT } from "../../dates/constants/DATE_FORMAT";
|
|
2
|
+
import { getDateByTimezone } from "../../dates/helpers/getDateByTimezone";
|
|
3
|
+
import { validateDate } from "../../dates/helpers/validateDate";
|
|
4
|
+
import { isEmpty } from "../mix/isEmpty";
|
|
5
|
+
import { isObject } from "./isObject";
|
|
6
|
+
/**
|
|
7
|
+
* Transforms the date+times propertiesof the given object by the Timezone object
|
|
8
|
+
* @param {any} obj the object
|
|
9
|
+
* @param {IDTimezone} timezone the timezone object
|
|
10
|
+
* @returns {IFSData | IFUData} the new filter data with the transformed datetime values
|
|
11
|
+
*/
|
|
12
|
+
export function applyTimezoneDeep(obj, timezone) {
|
|
13
|
+
if (isEmpty(obj))
|
|
14
|
+
return obj;
|
|
15
|
+
let result;
|
|
16
|
+
if (isObject(obj)) {
|
|
17
|
+
result = {};
|
|
18
|
+
}
|
|
19
|
+
else if (Array.isArray(obj)) {
|
|
20
|
+
result = [];
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
for (const i in obj) {
|
|
24
|
+
if (isObject(obj[i]) || Array.isArray(obj[i])) {
|
|
25
|
+
result[i] = applyTimezoneDeep(obj[i], timezone);
|
|
26
|
+
}
|
|
27
|
+
else if (obj[i] instanceof Date ||
|
|
28
|
+
validateDate(obj[i], DATE_FORMAT.HOUR)) {
|
|
29
|
+
result[i] = getDateByTimezone(obj[i], timezone);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
result[i] = obj[i];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
catch (_a) {
|
|
38
|
+
return obj;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
* Settings structure of the Merge Deep helper
|
|
3
3
|
*/
|
|
4
4
|
interface IMergeDeepSettings {
|
|
5
|
+
/**
|
|
6
|
+
* Merging properties that exists in object 2 but not in object 1
|
|
7
|
+
*/
|
|
5
8
|
mergeMissingProperties?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Merging values on matched object properties. If false, the object 1 values remains as equal.
|
|
11
|
+
*/
|
|
6
12
|
mergeExistingValues?: boolean;
|
|
7
13
|
}
|
|
8
14
|
/**
|
|
@@ -12,22 +12,23 @@ export function mergeDeep(obj1, obj2, settings) {
|
|
|
12
12
|
const defaultSettings = getParamsToMergeDeep(settings);
|
|
13
13
|
if (!isValid(obj1, obj2))
|
|
14
14
|
return objectCopy(obj1);
|
|
15
|
-
const result = {};
|
|
15
|
+
const result = Array.isArray(obj1) ? [] : {};
|
|
16
16
|
for (const i in obj1) {
|
|
17
|
-
if (i
|
|
17
|
+
if (isObject(obj1[i]) || Array.isArray(obj1[i])) {
|
|
18
18
|
result[i] = mergeDeep(obj1[i], obj2[i], defaultSettings);
|
|
19
19
|
}
|
|
20
|
+
else if (i in obj2 && defaultSettings.mergeExistingValues) {
|
|
21
|
+
result[i] = obj2[i];
|
|
22
|
+
}
|
|
20
23
|
else {
|
|
21
24
|
result[i] = obj1[i];
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
(
|
|
27
|
-
i
|
|
28
|
-
|
|
29
|
-
(!(i in result) && defaultSettings.mergeMissingProperties))) {
|
|
30
|
-
result[i] = obj2[i];
|
|
27
|
+
if (defaultSettings.mergeMissingProperties) {
|
|
28
|
+
for (const i in obj2) {
|
|
29
|
+
if (!(i in result)) {
|
|
30
|
+
result[i] = obj2[i];
|
|
31
|
+
}
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
return result;
|
|
@@ -39,7 +40,8 @@ export function mergeDeep(obj1, obj2, settings) {
|
|
|
39
40
|
* @returns true: they are valid; false: they are not
|
|
40
41
|
*/
|
|
41
42
|
function isValid(obj1, obj2) {
|
|
42
|
-
return isObject(obj1) && isObject(obj2)
|
|
43
|
+
return ((isObject(obj1) && isObject(obj2)) ||
|
|
44
|
+
(Array.isArray(obj1) && Array.isArray(obj2)));
|
|
43
45
|
}
|
|
44
46
|
/**
|
|
45
47
|
* Validates and gets the settings with all set parameters.
|
|
@@ -10,5 +10,5 @@ export const I18N_RELATIVE_CONTAINER = {
|
|
|
10
10
|
starting_date_tooltip: "The relative date will include the specific starting date and a period of time to show from that date onwards (Inclusive range). <br/> Unchecking this option will exclude the chosen starting date (exclusive range) from the date range.",
|
|
11
11
|
starting_from: "Starting From",
|
|
12
12
|
set_current_date: "Set to current date",
|
|
13
|
-
utc_tooltip: "The times displayed are in
|
|
13
|
+
utc_tooltip: "The times displayed are in {{utc}}",
|
|
14
14
|
};
|
|
@@ -359,7 +359,7 @@ export const I18N_FORMULA_BUILDER = {
|
|
|
359
359
|
},
|
|
360
360
|
function_date_add: {
|
|
361
361
|
description: "Given a Date or a Column, add the specific value to the specific part.",
|
|
362
|
-
function_placeholder: "dateAdd(date, date_part, interval_value)",
|
|
362
|
+
function_placeholder: "dateAdd(date, 'date_part', interval_value)",
|
|
363
363
|
param_date_name: "date",
|
|
364
364
|
param_date_description: "This is the Date or Column to which you want to add.",
|
|
365
365
|
param_part_name: "date_part",
|
|
@@ -369,7 +369,7 @@ export const I18N_FORMULA_BUILDER = {
|
|
|
369
369
|
},
|
|
370
370
|
function_date_subtract: {
|
|
371
371
|
description: "Given a Date or a Column, subtract the specific value to the specific part.",
|
|
372
|
-
function_placeholder: "dateSubtract(date, date_part, interval_value)",
|
|
372
|
+
function_placeholder: "dateSubtract(date, 'date_part', interval_value)",
|
|
373
373
|
param_date_name: "date",
|
|
374
374
|
param_date_description: "This is the Date or Column to which you want to subtract.",
|
|
375
375
|
param_part_name: "date_part",
|
|
@@ -379,7 +379,7 @@ export const I18N_FORMULA_BUILDER = {
|
|
|
379
379
|
},
|
|
380
380
|
function_date_diff: {
|
|
381
381
|
description: "Calculates the difference between two dates based on the date part requested.",
|
|
382
|
-
function_placeholder: "dateDiff(date_value1, date_value2, date_part)",
|
|
382
|
+
function_placeholder: "dateDiff(date_value1, date_value2, 'date_part')",
|
|
383
383
|
param_date_value_one_name: "date_value1",
|
|
384
384
|
param_date_value_one_description: "The first date value.",
|
|
385
385
|
param_date_value_two_name: "date_value2",
|
|
@@ -15,7 +15,7 @@ export const I18N_PANEL = {
|
|
|
15
15
|
invalid_data_for_chart: "No valid data for this chart",
|
|
16
16
|
longer_available_panel: "This panel is no longer available",
|
|
17
17
|
long_text: "long-text",
|
|
18
|
-
max_buckets_limit: "The combination of data used in this chart exceeds the maximum number of
|
|
18
|
+
max_buckets_limit: "The combination of data used in this chart exceeds the maximum number of aggregation buckets allowed in a single response.<br><br>To fix this issue, try the following:<br>• <i>Filter</i> your data<br>• Apply a <i>Date Grouping</i> that returns less data<br>• Use another chart visualization",
|
|
19
19
|
missing_column: "Missing Column.",
|
|
20
20
|
missing_bucket_column: "Missing bucket column.",
|
|
21
21
|
missing_formula_column: "Missing formula column.",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IDTimezone } from "../../dates/interfaces/IDTimezone";
|
|
1
2
|
import { II18nConfig } from "../../globalization/interfaces/II18nConfig";
|
|
2
3
|
export interface IWidgetConfig {
|
|
3
4
|
appid?: string;
|
|
@@ -5,6 +6,6 @@ export interface IWidgetConfig {
|
|
|
5
6
|
domain: string;
|
|
6
7
|
i18n?: II18nConfig;
|
|
7
8
|
qv_token?: string;
|
|
8
|
-
|
|
9
|
+
timezone?: IDTimezone;
|
|
9
10
|
userid?: string;
|
|
10
11
|
}
|
|
@@ -7,6 +7,7 @@ import { addFormat } from "../../format/format";
|
|
|
7
7
|
import { isEmpty } from "../../general/mix/isEmpty";
|
|
8
8
|
import { getI18nDateGroupLabel } from "../../globalization/helpers/getI18nDateGroupLabel";
|
|
9
9
|
import { getValueWithSuffixes } from "./getValueWithSuffixes";
|
|
10
|
+
import { getDateByTimezone } from "../../dates/helpers/getDateByTimezone";
|
|
10
11
|
/**
|
|
11
12
|
* Transforms a value depending of localization/globalization and extras settings.
|
|
12
13
|
* @param value A value to transform
|
|
@@ -16,12 +17,36 @@ import { getValueWithSuffixes } from "./getValueWithSuffixes";
|
|
|
16
17
|
export function transformValue(value, settings) {
|
|
17
18
|
if (isEmpty(value))
|
|
18
19
|
return value;
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
const defaultSettings = getDefaultSettings(settings);
|
|
21
|
+
let timezonedValue = value;
|
|
22
|
+
if (!defaultSettings.noTimezone) {
|
|
23
|
+
timezonedValue = getDateByTimezone(value, defaultSettings.timezone);
|
|
24
|
+
}
|
|
25
|
+
let valueWithI18n = timezonedValue;
|
|
26
|
+
if (!defaultSettings.noTranslate) {
|
|
27
|
+
valueWithI18n = getI18nDateGroupLabel(timezonedValue, defaultSettings.property, defaultSettings.translate);
|
|
28
|
+
}
|
|
29
|
+
let valueWithLocalization = valueWithI18n;
|
|
30
|
+
if (!defaultSettings.noLocale) {
|
|
31
|
+
valueWithLocalization = addFormat(valueWithI18n, getOutputFormat(settings), getFormatConfig(settings));
|
|
32
|
+
}
|
|
33
|
+
let valueWithSuffix = valueWithI18n;
|
|
34
|
+
if (!defaultSettings.noSuffix) {
|
|
35
|
+
valueWithSuffix = getValueWithSuffixes(valueWithLocalization, {
|
|
36
|
+
suffixTranslateLabel: defaultSettings.suffixTranslateLabel,
|
|
37
|
+
translate: defaultSettings.translate,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return valueWithSuffix;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Gets the default settings properties
|
|
44
|
+
* @param {ITransformValueSettings} settings the given settings
|
|
45
|
+
* @returns {ITransformValueSettings} the settings with default properties
|
|
46
|
+
*/
|
|
47
|
+
function getDefaultSettings(settings) {
|
|
48
|
+
var _a, _b, _c, _d;
|
|
49
|
+
return Object.assign(Object.assign({}, settings), { noLocale: (_a = settings === null || settings === void 0 ? void 0 : settings.noLocale) !== null && _a !== void 0 ? _a : false, noSuffix: (_b = settings === null || settings === void 0 ? void 0 : settings.noSuffix) !== null && _b !== void 0 ? _b : false, noTimezone: (_c = settings === null || settings === void 0 ? void 0 : settings.noTimezone) !== null && _c !== void 0 ? _c : false, noTranslate: (_d = settings === null || settings === void 0 ? void 0 : settings.noTranslate) !== null && _d !== void 0 ? _d : false });
|
|
25
50
|
}
|
|
26
51
|
/**
|
|
27
52
|
* Gets the outputformat settings
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IBColumn } from "../../columns/interfaces/IBColumn";
|
|
2
|
+
import { IBTimezone } from "../../dates/interfaces/IBTimezone";
|
|
2
3
|
/**
|
|
3
4
|
* Structure for Dataset in the frontend side of Qrvey App
|
|
4
5
|
*/
|
|
@@ -7,4 +8,5 @@ export interface IBDataset {
|
|
|
7
8
|
name?: string;
|
|
8
9
|
options?: IBColumn[];
|
|
9
10
|
qrveyid: string;
|
|
11
|
+
timezone?: IBTimezone;
|
|
10
12
|
}
|
|
@@ -2,11 +2,15 @@ import { IAppStatus } from "./IAppStatus";
|
|
|
2
2
|
import { IBModelBranchesMap } from "./IBModelBranchesMap";
|
|
3
3
|
import { IBModelData } from "./IBModelData";
|
|
4
4
|
import { IAppType } from "./IAppType";
|
|
5
|
+
import { IBTimezone } from "../../dates/interfaces/IBTimezone";
|
|
5
6
|
export interface IBModel {
|
|
6
7
|
appType: IAppType;
|
|
7
8
|
appid: string;
|
|
8
9
|
branchesMap?: IBModelBranchesMap[];
|
|
9
10
|
createDate: string;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Data Link feature is not longer supported
|
|
13
|
+
*/
|
|
10
14
|
datalinkInfo?: any[];
|
|
11
15
|
geoGroups?: any[];
|
|
12
16
|
modifyDate: string;
|
|
@@ -16,5 +20,6 @@ export interface IBModel {
|
|
|
16
20
|
questionOrder: string[];
|
|
17
21
|
questions: IBModelData;
|
|
18
22
|
status: IAppStatus;
|
|
23
|
+
timezone: IBTimezone;
|
|
19
24
|
userid: string;
|
|
20
25
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { IColumn } from "../../columns/interfaces/IColumn";
|
|
2
|
+
import { IDTimezone } from "../../dates/interfaces/IDTimezone";
|
|
2
3
|
import { IBDataset } from "./IBDataset";
|
|
3
4
|
/**
|
|
4
5
|
* Structure for Dataset in the frontend side of Qrvey App
|
|
5
6
|
*/
|
|
6
|
-
export interface IDataset extends Omit<IBDataset, "name" | "options"> {
|
|
7
|
+
export interface IDataset extends Omit<IBDataset, "name" | "options" | "timezone"> {
|
|
7
8
|
label?: string;
|
|
8
9
|
options?: IColumn[];
|
|
10
|
+
timezone?: IDTimezone;
|
|
9
11
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { IColumn } from "../../columns/interfaces/IColumn";
|
|
2
|
+
import { IDTimezone } from "../../dates/interfaces/IDTimezone";
|
|
2
3
|
import { IBModel } from "./IBModel";
|
|
3
4
|
import { IModelBranchesMap } from "./IModelBranchesMap";
|
|
4
|
-
export interface IModel extends Omit<IBModel, "questions" | "branchesMap" | "name" | "numResponses" | "questionOrder"> {
|
|
5
|
+
export interface IModel extends Omit<IBModel, "questions" | "branchesMap" | "name" | "numResponses" | "questionOrder" | "timezone"> {
|
|
5
6
|
columns: IColumn[];
|
|
6
7
|
columnOrder: string[];
|
|
7
8
|
branchesMap: IModelBranchesMap[];
|
|
8
9
|
label: string;
|
|
10
|
+
timezone: IDTimezone;
|
|
9
11
|
totalRecords: number;
|
|
10
12
|
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { IColumn } from "../../columns/interfaces/IColumn";
|
|
2
2
|
import { IColumnPropertyType } from "../../columns/interfaces/IColumnPropertyType";
|
|
3
|
+
import { IDTimezone } from "../../dates/interfaces/IDTimezone";
|
|
3
4
|
import { II18nConfig } from "../../globalization/interfaces/II18nConfig";
|
|
4
5
|
import { II18nServiceTranslate } from "../../globalization/interfaces/II18nServiceTranslate";
|
|
5
6
|
export interface ITransformValueSettings {
|
|
6
7
|
column: IColumn;
|
|
7
8
|
property: IColumnPropertyType;
|
|
9
|
+
timezone?: IDTimezone;
|
|
8
10
|
translate: II18nServiceTranslate;
|
|
9
11
|
i18n: II18nConfig;
|
|
10
12
|
suffixTranslateLabel?: string;
|
|
13
|
+
noLocale?: boolean;
|
|
14
|
+
noTranslate?: boolean;
|
|
15
|
+
noSuffix?: boolean;
|
|
16
|
+
noTimezone?: boolean;
|
|
11
17
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { getAttribute } from "../../general/object/getAttribute";
|
|
2
2
|
import { BColumnsToUIColumns } from "./BColumnsToUIColumns.adapter";
|
|
3
|
+
import { BTimezoneToUITimezone } from "./BTimezoneToUITimezone";
|
|
3
4
|
export function BDatasetsToUIDatasets(datasets = []) {
|
|
4
5
|
return datasets.map((dataset) => ({
|
|
5
6
|
qrveyid: getAttribute(dataset, "qrvey_id"),
|
|
6
7
|
label: dataset.name,
|
|
7
8
|
options: BColumnsToUIColumns(dataset.options, dataset),
|
|
9
|
+
timezone: BTimezoneToUITimezone(dataset.timezone),
|
|
8
10
|
}));
|
|
9
11
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isEmpty } from "../../general/mix/isEmpty";
|
|
2
2
|
import { BBranchesMapToUIBranchesMap } from "./BBranchesMapToUIBranchesMap.adapter";
|
|
3
3
|
import { BColumnsToUIColumns } from "./BColumnsToUIColumns.adapter";
|
|
4
|
+
import { BTimezoneToUITimezone } from "./BTimezoneToUITimezone";
|
|
4
5
|
export function BModelToUIModel(model) {
|
|
5
6
|
if (isEmpty(model))
|
|
6
7
|
return;
|
|
@@ -20,6 +21,7 @@ export function BModelToUIModel(model) {
|
|
|
20
21
|
totalRecords: model.numResponses,
|
|
21
22
|
qrveyid: model.qrveyid,
|
|
22
23
|
status: model.status,
|
|
24
|
+
timezone: BTimezoneToUITimezone(model.timezone),
|
|
23
25
|
userid: model.userid,
|
|
24
26
|
};
|
|
25
27
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IDTimezone } from "../../dates/interfaces/IDTimezone";
|
|
2
|
+
import { IBTimezone } from "../../dates/interfaces/IBTimezone";
|
|
3
|
+
/**
|
|
4
|
+
* Transforms the backenc timezone structure to UI timezone structure
|
|
5
|
+
* @param {IBTimezone} timezone the backend timezone object
|
|
6
|
+
* @returns {IDTimezone} the UI timezone object
|
|
7
|
+
*/
|
|
8
|
+
export declare function BTimezoneToUITimezone(timezone: IBTimezone): IDTimezone;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TIMEZONE_TYPE } from "../../dates/constants/TIMEZONE_TYPE";
|
|
2
|
+
import { getTimezoneOffsetByType } from "../../dates/helpers/getTimezoneOffsetByType";
|
|
3
|
+
/**
|
|
4
|
+
* Transforms the backenc timezone structure to UI timezone structure
|
|
5
|
+
* @param {IBTimezone} timezone the backend timezone object
|
|
6
|
+
* @returns {IDTimezone} the UI timezone object
|
|
7
|
+
*/
|
|
8
|
+
export function BTimezoneToUITimezone(timezone) {
|
|
9
|
+
const type = (timezone === null || timezone === void 0 ? void 0 : timezone.type) || TIMEZONE_TYPE.DEFAULT;
|
|
10
|
+
return {
|
|
11
|
+
type,
|
|
12
|
+
offset: getTimezoneOffsetByType(Object.assign(Object.assign({}, timezone), { type })),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -2,7 +2,7 @@ export default class Request {
|
|
|
2
2
|
static checkStatus(response: any): Promise<any>;
|
|
3
3
|
static hasQvToken(config: any): boolean;
|
|
4
4
|
static getQvToken(config: any): any;
|
|
5
|
-
static
|
|
5
|
+
static getTimezoneOffset(config: any): string;
|
|
6
6
|
static hasApiKey(config: any): boolean;
|
|
7
7
|
static getApiKey(config: any): any;
|
|
8
8
|
static makeUrl(config: any, url: any, params?: any): string;
|