@qrvey/utils 1.3.0-2 → 1.3.0-5
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/cjs/column_format/constants/CHART_GROUP.d.ts +4 -0
- package/dist/cjs/column_format/constants/CHART_GROUP.js +8 -0
- package/dist/cjs/column_format/constants/DATEGROUP_UNSUPPORT_FORMAT.d.ts +2 -0
- package/dist/cjs/column_format/constants/DATEGROUP_UNSUPPORT_FORMAT.js +16 -0
- package/dist/cjs/column_format/constants/DATEGROUP_WITHOUT_FORMAT.d.ts +12 -0
- package/dist/cjs/column_format/constants/DATEGROUP_WITHOUT_FORMAT.js +16 -0
- package/dist/cjs/column_format/constants/SHELF_TYPE.d.ts +7 -0
- package/dist/cjs/column_format/constants/SHELF_TYPE.js +11 -0
- package/dist/cjs/column_format/constants/STRING_FORMAT.d.ts +3 -0
- package/dist/cjs/column_format/constants/STRING_FORMAT.js +7 -0
- package/dist/cjs/column_format/constants/TABLE_TYPE.d.ts +5 -0
- package/dist/cjs/column_format/constants/TABLE_TYPE.js +9 -0
- package/dist/cjs/column_format/constants/index.d.ts +6 -0
- package/dist/cjs/column_format/constants/index.js +22 -0
- package/dist/cjs/column_format/helpers/columnTypeByChart.d.ts +16 -0
- package/dist/cjs/column_format/helpers/columnTypeByChart.js +28 -0
- package/dist/cjs/column_format/helpers/defineFormatV2.d.ts +11 -0
- package/dist/cjs/column_format/helpers/defineFormatV2.js +17 -0
- package/dist/cjs/column_format/helpers/defineTableChartFormat.d.ts +9 -0
- package/dist/cjs/column_format/helpers/defineTableChartFormat.js +71 -0
- package/dist/cjs/column_format/helpers/defineXYChartFormat.d.ts +11 -0
- package/dist/cjs/column_format/helpers/defineXYChartFormat.js +76 -0
- package/dist/cjs/column_format/helpers/index.d.ts +5 -0
- package/dist/cjs/column_format/helpers/index.js +21 -0
- package/dist/cjs/column_format/helpers/parseFormulaTypeByCharts.d.ts +7 -0
- package/dist/cjs/column_format/helpers/parseFormulaTypeByCharts.js +20 -0
- package/dist/cjs/column_format/index.d.ts +3 -0
- package/dist/cjs/column_format/index.js +19 -0
- package/dist/cjs/column_format/interfaces/IChartColumn.d.ts +23 -0
- package/dist/cjs/column_format/interfaces/IChartColumn.js +2 -0
- package/dist/cjs/column_format/interfaces/IChartGroupType.d.ts +2 -0
- package/dist/cjs/column_format/interfaces/IChartGroupType.js +2 -0
- package/dist/cjs/column_format/interfaces/IChartShelfType.d.ts +2 -0
- package/dist/cjs/column_format/interfaces/IChartShelfType.js +2 -0
- package/dist/cjs/column_format/interfaces/IChartTableType.d.ts +2 -0
- package/dist/cjs/column_format/interfaces/IChartTableType.js +2 -0
- package/dist/cjs/column_format/interfaces/IColumnFormatReturnType.d.ts +3 -0
- package/dist/cjs/column_format/interfaces/IColumnFormatReturnType.js +2 -0
- package/dist/cjs/column_format/interfaces/IColumnFormatSettings.d.ts +9 -0
- package/dist/cjs/column_format/interfaces/IColumnFormatSettings.js +2 -0
- package/dist/cjs/column_format/interfaces/IFormatStringType.d.ts +2 -0
- package/dist/cjs/column_format/interfaces/IFormatStringType.js +2 -0
- package/dist/cjs/column_format/interfaces/index.d.ts +7 -0
- package/dist/cjs/column_format/interfaces/index.js +23 -0
- package/dist/cjs/columns/interfaces/IColumnAggregate.d.ts +7 -0
- package/dist/cjs/columns/interfaces/IColumnAggregate.js +2 -0
- package/dist/cjs/columns/interfaces/IColumnDateGroupSettings.d.ts +7 -0
- package/dist/cjs/columns/interfaces/IColumnDateGroupSettings.js +2 -0
- package/dist/cjs/columns/interfaces/IColumnScale.d.ts +5 -0
- package/dist/cjs/columns/interfaces/IColumnScale.js +2 -0
- package/dist/cjs/dates/adapters/dateToHms.d.ts +6 -0
- package/dist/cjs/dates/adapters/dateToHms.js +18 -0
- package/dist/cjs/dates/adapters/dateToMdyDate.d.ts +6 -0
- package/dist/cjs/dates/adapters/dateToMdyDate.js +19 -0
- package/dist/cjs/dates/adapters/dateToMonthYear.d.ts +6 -0
- package/dist/cjs/dates/adapters/dateToMonthYear.js +18 -0
- package/dist/cjs/dates/adapters/dateToQuarterYear.d.ts +6 -0
- package/dist/cjs/dates/adapters/dateToQuarterYear.js +19 -0
- package/dist/cjs/dates/adapters/dateToWeekYear.d.ts +6 -0
- package/dist/cjs/dates/adapters/dateToWeekYear.js +19 -0
- package/dist/cjs/dates/adapters/dateToYear.d.ts +6 -0
- package/dist/cjs/dates/adapters/dateToYear.js +17 -0
- package/dist/cjs/dates/adapters/mdyDateToDate.d.ts +1 -1
- package/dist/cjs/dates/adapters/monthYearToDate.d.ts +1 -1
- package/dist/cjs/dates/adapters/quarterYearToDate.d.ts +1 -1
- package/dist/cjs/dates/adapters/weekYearToDate.d.ts +1 -1
- package/dist/cjs/dates/adapters/yearToDate.d.ts +1 -1
- package/dist/cjs/dates/helpers/getDateByDateFormat.d.ts +1 -1
- package/dist/cjs/dates/helpers/getDatePickerPickLevel.d.ts +7 -0
- package/dist/cjs/dates/helpers/getDatePickerPickLevel.js +14 -0
- package/dist/cjs/dates/helpers/getFormattedDateByFormat.d.ts +8 -0
- package/dist/cjs/dates/helpers/getFormattedDateByFormat.js +36 -0
- package/dist/cjs/dates/helpers/includeDateTokens.d.ts +9 -0
- package/dist/cjs/dates/helpers/includeDateTokens.js +29 -0
- package/dist/cjs/dates/helpers/index.d.ts +4 -0
- package/dist/cjs/dates/helpers/index.js +4 -0
- package/dist/cjs/filters/helpers/common/resolveFilterConditions.js +5 -5
- package/dist/cjs/filters/interfaces/common/IFSParamsToGetFilter.d.ts +1 -1
- package/dist/cjs/general/string/index.d.ts +2 -0
- package/dist/cjs/general/string/index.js +2 -0
- package/dist/cjs/general/string/padLeadingZeros.d.ts +1 -0
- package/dist/cjs/general/string/padLeadingZeros.js +12 -0
- package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +3 -3
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/interfaces/format/IFormatDefaultFormat.d.ts +5 -0
- package/dist/cjs/interfaces/format/IFormatDefaultFormat.js +2 -0
- package/dist/cjs/interfaces/format/IFormatOutputFormat.Interface.d.ts +3 -5
- package/dist/column_format/constants/CHART_GROUP.d.ts +4 -0
- package/dist/column_format/constants/CHART_GROUP.js +5 -0
- package/dist/column_format/constants/DATEGROUP_UNSUPPORT_FORMAT.d.ts +2 -0
- package/dist/column_format/constants/DATEGROUP_UNSUPPORT_FORMAT.js +13 -0
- package/dist/column_format/constants/DATEGROUP_WITHOUT_FORMAT.d.ts +12 -0
- package/dist/column_format/constants/DATEGROUP_WITHOUT_FORMAT.js +13 -0
- package/dist/column_format/constants/SHELF_TYPE.d.ts +7 -0
- package/dist/column_format/constants/SHELF_TYPE.js +8 -0
- package/dist/column_format/constants/STRING_FORMAT.d.ts +3 -0
- package/dist/column_format/constants/STRING_FORMAT.js +4 -0
- package/dist/column_format/constants/TABLE_TYPE.d.ts +5 -0
- package/dist/column_format/constants/TABLE_TYPE.js +6 -0
- package/dist/column_format/constants/index.d.ts +6 -0
- package/dist/column_format/constants/index.js +6 -0
- package/dist/column_format/helpers/columnTypeByChart.d.ts +16 -0
- package/dist/column_format/helpers/columnTypeByChart.js +24 -0
- package/dist/column_format/helpers/defineFormatV2.d.ts +11 -0
- package/dist/column_format/helpers/defineFormatV2.js +13 -0
- package/dist/column_format/helpers/defineTableChartFormat.d.ts +9 -0
- package/dist/column_format/helpers/defineTableChartFormat.js +67 -0
- package/dist/column_format/helpers/defineXYChartFormat.d.ts +11 -0
- package/dist/column_format/helpers/defineXYChartFormat.js +72 -0
- package/dist/column_format/helpers/index.d.ts +5 -0
- package/dist/column_format/helpers/index.js +5 -0
- package/dist/column_format/helpers/parseFormulaTypeByCharts.d.ts +7 -0
- package/dist/column_format/helpers/parseFormulaTypeByCharts.js +16 -0
- package/dist/column_format/index.d.ts +3 -0
- package/dist/column_format/index.js +3 -0
- package/dist/column_format/interfaces/IChartColumn.d.ts +23 -0
- package/dist/column_format/interfaces/IChartColumn.js +1 -0
- package/dist/column_format/interfaces/IChartGroupType.d.ts +2 -0
- package/dist/column_format/interfaces/IChartGroupType.js +1 -0
- package/dist/column_format/interfaces/IChartShelfType.d.ts +2 -0
- package/dist/column_format/interfaces/IChartShelfType.js +1 -0
- package/dist/column_format/interfaces/IChartTableType.d.ts +2 -0
- package/dist/column_format/interfaces/IChartTableType.js +1 -0
- package/dist/column_format/interfaces/IColumnFormatReturnType.d.ts +3 -0
- package/dist/column_format/interfaces/IColumnFormatReturnType.js +1 -0
- package/dist/column_format/interfaces/IColumnFormatSettings.d.ts +9 -0
- package/dist/column_format/interfaces/IColumnFormatSettings.js +1 -0
- package/dist/column_format/interfaces/IFormatStringType.d.ts +2 -0
- package/dist/column_format/interfaces/IFormatStringType.js +1 -0
- package/dist/column_format/interfaces/index.d.ts +7 -0
- package/dist/column_format/interfaces/index.js +7 -0
- package/dist/columns/interfaces/IColumnAggregate.d.ts +7 -0
- package/dist/columns/interfaces/IColumnAggregate.js +1 -0
- package/dist/columns/interfaces/IColumnDateGroupSettings.d.ts +7 -0
- package/dist/columns/interfaces/IColumnDateGroupSettings.js +1 -0
- package/dist/columns/interfaces/IColumnScale.d.ts +5 -0
- package/dist/columns/interfaces/IColumnScale.js +1 -0
- package/dist/dates/adapters/dateToHms.d.ts +6 -0
- package/dist/dates/adapters/dateToHms.js +14 -0
- package/dist/dates/adapters/dateToMdyDate.d.ts +6 -0
- package/dist/dates/adapters/dateToMdyDate.js +15 -0
- package/dist/dates/adapters/dateToMonthYear.d.ts +6 -0
- package/dist/dates/adapters/dateToMonthYear.js +14 -0
- package/dist/dates/adapters/dateToQuarterYear.d.ts +6 -0
- package/dist/dates/adapters/dateToQuarterYear.js +15 -0
- package/dist/dates/adapters/dateToWeekYear.d.ts +6 -0
- package/dist/dates/adapters/dateToWeekYear.js +15 -0
- package/dist/dates/adapters/dateToYear.d.ts +6 -0
- package/dist/dates/adapters/dateToYear.js +13 -0
- package/dist/dates/adapters/mdyDateToDate.d.ts +1 -1
- package/dist/dates/adapters/monthYearToDate.d.ts +1 -1
- package/dist/dates/adapters/quarterYearToDate.d.ts +1 -1
- package/dist/dates/adapters/weekYearToDate.d.ts +1 -1
- package/dist/dates/adapters/yearToDate.d.ts +1 -1
- package/dist/dates/helpers/getDateByDateFormat.d.ts +1 -1
- package/dist/dates/helpers/getDatePickerPickLevel.d.ts +7 -0
- package/dist/dates/helpers/getDatePickerPickLevel.js +10 -0
- package/dist/dates/helpers/getFormattedDateByFormat.d.ts +8 -0
- package/dist/dates/helpers/getFormattedDateByFormat.js +32 -0
- package/dist/dates/helpers/includeDateTokens.d.ts +9 -0
- package/dist/dates/helpers/includeDateTokens.js +25 -0
- package/dist/dates/helpers/index.d.ts +4 -0
- package/dist/dates/helpers/index.js +4 -0
- package/dist/filters/helpers/common/resolveFilterConditions.js +5 -5
- package/dist/filters/interfaces/common/IFSParamsToGetFilter.d.ts +1 -1
- package/dist/general/string/index.d.ts +2 -0
- package/dist/general/string/index.js +2 -0
- package/dist/general/string/padLeadingZeros.d.ts +1 -0
- package/dist/general/string/padLeadingZeros.js +8 -0
- package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/interfaces/format/IFormatDefaultFormat.d.ts +5 -0
- package/dist/interfaces/format/IFormatDefaultFormat.js +1 -0
- package/dist/interfaces/format/IFormatOutputFormat.Interface.d.ts +3 -5
- package/package.json +1 -1
- package/src/column_format/constants/CHART_GROUP.ts +4 -0
- package/src/column_format/constants/DATEGROUP_UNSUPPORT_FORMAT.ts +14 -0
- package/src/column_format/constants/DATEGROUP_WITHOUT_FORMAT.ts +12 -0
- package/src/column_format/constants/SHELF_TYPE.ts +7 -0
- package/src/column_format/constants/STRING_FORMAT.ts +3 -0
- package/src/column_format/constants/TABLE_TYPE.ts +5 -0
- package/src/column_format/constants/index.ts +6 -0
- package/src/column_format/helpers/columnTypeByChart.ts +27 -0
- package/src/column_format/helpers/defineFormatV2.ts +17 -0
- package/src/column_format/helpers/defineTableChartFormat.ts +70 -0
- package/src/column_format/helpers/defineXYChartFormat.ts +81 -0
- package/src/column_format/helpers/index.ts +5 -0
- package/src/column_format/helpers/parseFormulaTypeByCharts.ts +17 -0
- package/src/column_format/index.ts +3 -0
- package/src/column_format/interfaces/IChartColumn.ts +24 -0
- package/src/column_format/interfaces/IChartGroupType.ts +3 -0
- package/src/column_format/interfaces/IChartShelfType.ts +3 -0
- package/src/column_format/interfaces/IChartTableType.ts +3 -0
- package/src/column_format/interfaces/IColumnFormatReturnType.ts +4 -0
- package/src/column_format/interfaces/IColumnFormatSettings.ts +11 -0
- package/src/column_format/interfaces/IFormatStringType.ts +3 -0
- package/src/column_format/interfaces/index.ts +7 -0
- package/src/columns/interfaces/IColumnAggregate.ts +7 -0
- package/src/columns/interfaces/IColumnDateGroupSettings.ts +7 -0
- package/src/columns/interfaces/IColumnScale.ts +5 -0
- package/src/dates/adapters/dateToHms.ts +15 -0
- package/src/dates/adapters/dateToMdyDate.ts +16 -0
- package/src/dates/adapters/dateToMonthYear.ts +15 -0
- package/src/dates/adapters/dateToQuarterYear.ts +16 -0
- package/src/dates/adapters/dateToWeekYear.ts +16 -0
- package/src/dates/adapters/dateToYear.ts +14 -0
- package/src/dates/adapters/mdyDateToDate.ts +1 -1
- package/src/dates/adapters/monthYearToDate.ts +1 -1
- package/src/dates/adapters/quarterYearToDate.ts +1 -1
- package/src/dates/adapters/weekYearToDate.ts +1 -1
- package/src/dates/adapters/yearToDate.ts +1 -1
- package/src/dates/helpers/getDateByDateFormat.ts +1 -1
- package/src/dates/helpers/getDatePickerPickLevel.ts +12 -0
- package/src/dates/helpers/getFormattedDateByFormat.ts +29 -0
- package/src/dates/helpers/includeDateTokens.ts +26 -0
- package/src/dates/helpers/index.ts +4 -0
- package/src/filters/helpers/common/resolveFilterConditions.ts +4 -4
- package/src/filters/interfaces/common/IFSParamsToGetFilter.ts +2 -2
- package/src/general/string/index.ts +3 -1
- package/src/general/string/padLeadingZeros.ts +7 -0
- package/src/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.ts +3 -3
- package/src/index.ts +1 -0
- package/src/interfaces/format/IFormatDefaultFormat.ts +5 -0
- package/src/interfaces/format/IFormatOutputFormat.Interface.ts +3 -5
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { isEmpty } from "../../general/mix/isEmpty";
|
|
2
|
+
import { padLeadingZeros } from "../../general/string/padLeadingZeros";
|
|
3
|
+
import { isTokenLabel } from "../../tokens/isTokenLabel";
|
|
4
|
+
import { dateToHms } from "./dateToHms";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Transform a Date to [mm/dd/yyyy] date format.
|
|
8
|
+
* @param date String, object or millisencond number of the date
|
|
9
|
+
* @returns string of [mm/dd/yyyy] date format
|
|
10
|
+
*/
|
|
11
|
+
export function dateToMdyDate(date: string | Date | number, includeTime?: boolean): string{
|
|
12
|
+
if (isEmpty(date) || isTokenLabel(date as any)) return date as any;
|
|
13
|
+
|
|
14
|
+
const dt = new Date(date.valueOf());
|
|
15
|
+
return padLeadingZeros(dt.getMonth() + 1, 2).slice(-2) + '/' + padLeadingZeros(dt.getDate(), 2).slice(-2) + '/' + padLeadingZeros(dt.getFullYear(), 4) + (includeTime ? ' ' + dateToHms(date) : '');
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { isEmpty } from "../../general/mix/isEmpty";
|
|
2
|
+
import { isTokenLabel } from "../../tokens/isTokenLabel";
|
|
3
|
+
import { DATE_YEAR_MONTHS } from "../constants/DATE_YEAR_MONTHS";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Transform a Date to [Month Year] date format.
|
|
7
|
+
* @param date String, object or millisencond number of the date
|
|
8
|
+
* @returns string of [Month Year] date format
|
|
9
|
+
*/
|
|
10
|
+
export function dateToMonthYear(date: string | Date | number): string {
|
|
11
|
+
if (isEmpty(date) || isTokenLabel(date as any)) return date as any;
|
|
12
|
+
|
|
13
|
+
const dt = new Date(date.valueOf());
|
|
14
|
+
return DATE_YEAR_MONTHS[dt.getMonth()] + ' ' + dt.getFullYear();
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { isEmpty } from "../../general/mix/isEmpty";
|
|
2
|
+
import { isTokenLabel } from "../../tokens/isTokenLabel";
|
|
3
|
+
import { DATE_YEAR_QUARTERS } from "../constants/DATE_YEAR_QUARTERS";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Transform a Date to [Quarter Year] date format.
|
|
7
|
+
* @param date String, object or millisencond number of the date
|
|
8
|
+
* @returns string of [Quarter Year] date format
|
|
9
|
+
*/
|
|
10
|
+
export function dateToQuarterYear(date: string | Date | number): string {
|
|
11
|
+
if (isEmpty(date) || isTokenLabel(date as any)) return date as any;
|
|
12
|
+
|
|
13
|
+
const dt = new Date(date.valueOf());
|
|
14
|
+
const quarter = Math.ceil((dt.getMonth() + 1) / 3);
|
|
15
|
+
return DATE_YEAR_QUARTERS[quarter - 1] + ' ' + dt.getFullYear();
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { isEmpty } from "../../general/mix/isEmpty";
|
|
2
|
+
import { isTokenLabel } from "../../tokens/isTokenLabel";
|
|
3
|
+
import { getWeek } from "../helpers/getWeek";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Transform a Date to [W# Year] date format.
|
|
7
|
+
* @param date String, object or millisencond number of the date
|
|
8
|
+
* @returns string of [W# Year] date format
|
|
9
|
+
*/
|
|
10
|
+
export function dateToWeekYear(date: string | Date | number): string {
|
|
11
|
+
if (isEmpty(date) || isTokenLabel(date as any)) return date as any;
|
|
12
|
+
|
|
13
|
+
const dt = new Date(date.valueOf());
|
|
14
|
+
const weekObj = getWeek(dt);
|
|
15
|
+
return `W${weekObj.week} ${weekObj.year}`;
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { isEmpty } from "../../general/mix/isEmpty";
|
|
2
|
+
import { isTokenLabel } from "../../tokens/isTokenLabel";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Transform a Date to [Year] date format.
|
|
6
|
+
* @param date String, object or millisencond number of the date
|
|
7
|
+
* @returns string of [Year] date format
|
|
8
|
+
*/
|
|
9
|
+
export function dateToYear(date: string | Date | number): string {
|
|
10
|
+
if (isEmpty(date) || isTokenLabel(date as any)) return date as any;
|
|
11
|
+
|
|
12
|
+
const dt = new Date(date.valueOf());
|
|
13
|
+
return String(dt.getFullYear());
|
|
14
|
+
}
|
|
@@ -9,7 +9,7 @@ import { validateDate } from "../helpers/validateDate";
|
|
|
9
9
|
* @param time Flag to parse the object date to milliseconds.
|
|
10
10
|
* @returns The date object or the date in milliseconds
|
|
11
11
|
*/
|
|
12
|
-
export function mdyDateToDate (date: string, time = false) {
|
|
12
|
+
export function mdyDateToDate (date: string, time = false): string | Date | number {
|
|
13
13
|
if (isEmpty(date) || isTokenLabel(date)) return date;
|
|
14
14
|
|
|
15
15
|
if (validateDate(date, DATE_FORMAT.DAY)) {
|
|
@@ -10,7 +10,7 @@ import { validateDate } from "../helpers/validateDate";
|
|
|
10
10
|
* @param time Flag to parse the object date to milliseconds.
|
|
11
11
|
* @returns The date object or the date in milliseconds
|
|
12
12
|
*/
|
|
13
|
-
export function monthYearToDate(monthYearDate: string, time = false) {
|
|
13
|
+
export function monthYearToDate(monthYearDate: string, time = false): string | Date | number {
|
|
14
14
|
if (isEmpty(monthYearDate) || isTokenLabel(monthYearDate)) return monthYearDate;
|
|
15
15
|
|
|
16
16
|
if (validateDate(monthYearDate, DATE_FORMAT.MONTH)) {
|
|
@@ -10,7 +10,7 @@ import { validateDate } from "../helpers/validateDate";
|
|
|
10
10
|
* @param time Flag to parse the object date to milliseconds.
|
|
11
11
|
* @returns The date object or the date in milliseconds
|
|
12
12
|
*/
|
|
13
|
-
export function quarterYearToDate (quarterYearDate: string, time = false) {
|
|
13
|
+
export function quarterYearToDate (quarterYearDate: string, time = false): string | Date | number {
|
|
14
14
|
if (isEmpty(quarterYearDate) || isTokenLabel(quarterYearDate)) return quarterYearDate;
|
|
15
15
|
|
|
16
16
|
if (validateDate(quarterYearDate, DATE_FORMAT.QUARTER)) {
|
|
@@ -10,7 +10,7 @@ import { validateDate } from "../helpers/validateDate";
|
|
|
10
10
|
* @param time Flag to parse the object date to milliseconds.
|
|
11
11
|
* @returns The date object or the date in milliseconds
|
|
12
12
|
*/
|
|
13
|
-
export function weekYearToDate(weekYear: string, time = false) {
|
|
13
|
+
export function weekYearToDate(weekYear: string, time = false): string | Date | number {
|
|
14
14
|
if (isEmpty(weekYear) || isTokenLabel(weekYear)) return weekYear;
|
|
15
15
|
|
|
16
16
|
if (validateDate(weekYear, DATE_FORMAT.WEEK)) {
|
|
@@ -10,7 +10,7 @@ import { validateDate } from "../helpers/validateDate";
|
|
|
10
10
|
* @param time Flag to parse the object date to milliseconds.
|
|
11
11
|
* @returns The date object or the date in milliseconds
|
|
12
12
|
*/
|
|
13
|
-
export function yearToDate(yearDate: string, time = false) {
|
|
13
|
+
export function yearToDate(yearDate: string, time = false): string | Date | number {
|
|
14
14
|
if (isEmpty(yearDate) || isTokenLabel(yearDate)) return yearDate;
|
|
15
15
|
|
|
16
16
|
if (validateDate(yearDate, DATE_FORMAT.YEAR)) {
|
|
@@ -13,7 +13,7 @@ import { mdyDateToDate } from "../adapters/mdyDateToDate";
|
|
|
13
13
|
* @param time flag to convert the formatted date to miliseconds
|
|
14
14
|
* @returns a Date object, milisecond time or the same value if date format does not match.
|
|
15
15
|
*/
|
|
16
|
-
export function getDateByDateFormat(date: string, format: IDateFormat, time = false) {
|
|
16
|
+
export function getDateByDateFormat(date: string, format: IDateFormat, time = false): string | Date | number {
|
|
17
17
|
switch (format) {
|
|
18
18
|
case DATE_FORMAT.YEAR:
|
|
19
19
|
return yearToDate(date, time);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DATE_FORMAT } from "../constants/DATE_FORMAT";
|
|
2
|
+
import { IDateFormat } from "../interfaces/IDateFormat";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Gets the pick level number related to the Date picker element
|
|
6
|
+
* @param {IDateFormat} format The date format
|
|
7
|
+
* @returns {number} A number of the pick level setting
|
|
8
|
+
*/
|
|
9
|
+
export function getDatePickerPickLevel(format: IDateFormat): 0 | 1 | 2 {
|
|
10
|
+
return format === DATE_FORMAT.YEAR ? 2 :
|
|
11
|
+
format === DATE_FORMAT.MONTH ? 1 : 0;
|
|
12
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { dateToMdyDate } from "../adapters/dateToMdyDate";
|
|
2
|
+
import { dateToMonthYear } from "../adapters/dateToMonthYear";
|
|
3
|
+
import { dateToQuarterYear } from "../adapters/dateToQuarterYear";
|
|
4
|
+
import { dateToWeekYear } from "../adapters/dateToWeekYear";
|
|
5
|
+
import { dateToYear } from "../adapters/dateToYear";
|
|
6
|
+
import { DATE_FORMAT } from "../constants/DATE_FORMAT";
|
|
7
|
+
import { IDateFormat } from "../interfaces/IDateFormat";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A Date object, string or millisecond number are gotten in order to convert it in an formatted string date
|
|
11
|
+
* @param date String with a formatted date
|
|
12
|
+
* @param format The date format
|
|
13
|
+
* @returns a formmatted date or the same value if format does not match
|
|
14
|
+
*/
|
|
15
|
+
export function getFormattedDateByFormat(date: string | Date | number, format: IDateFormat): string | Date | number {
|
|
16
|
+
if (format === DATE_FORMAT.QUARTER) {
|
|
17
|
+
return dateToQuarterYear(date);
|
|
18
|
+
} else if (format === DATE_FORMAT.MONTH) {
|
|
19
|
+
return dateToMonthYear(date);
|
|
20
|
+
} else if (format === DATE_FORMAT.YEAR) {
|
|
21
|
+
return dateToYear(date);
|
|
22
|
+
} else if (format === DATE_FORMAT.WEEK) {
|
|
23
|
+
return dateToWeekYear(date);
|
|
24
|
+
} else if (format === DATE_FORMAT.DAY) {
|
|
25
|
+
return dateToMdyDate(date);
|
|
26
|
+
} else {
|
|
27
|
+
return date;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { isEmpty } from "../../general/mix/isEmpty";
|
|
2
|
+
import { isTokenLabel } from "../../tokens/isTokenLabel";
|
|
3
|
+
import { IDateFormat } from "../interfaces/IDateFormat";
|
|
4
|
+
import { getSeparatorByDateFormat } from "./getSeparatorByDateFormat";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Determines if the given date has tokens. The date is splitted depending on date format.
|
|
8
|
+
* Undefined date is returning false.
|
|
9
|
+
* @param date The string of the date. It may contain tokens.
|
|
10
|
+
* @param format The date format
|
|
11
|
+
* @returns true: include tokens; false: otherwise
|
|
12
|
+
*/
|
|
13
|
+
export function includeDateTokens(date: string, format: IDateFormat) {
|
|
14
|
+
let hasTokens = false;
|
|
15
|
+
if (!isEmpty(date)) {
|
|
16
|
+
if (isTokenLabel(date)) hasTokens = true;
|
|
17
|
+
else {
|
|
18
|
+
const separator = getSeparatorByDateFormat(format);
|
|
19
|
+
if (separator != null) {
|
|
20
|
+
const tokens = date.split(separator);
|
|
21
|
+
hasTokens = tokens.some(token => isTokenLabel(token));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return hasTokens;
|
|
26
|
+
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
export * from './getDateByDateFormat';
|
|
1
2
|
export * from './getDateFormatByProperty';
|
|
2
3
|
export * from './getDateFormatRegularExpressionInArray';
|
|
4
|
+
export * from './getDatePickerPickLevel';
|
|
5
|
+
export * from './getFormattedDateByFormat';
|
|
3
6
|
export * from './getSeparatorByDateFormat';
|
|
7
|
+
export * from './includeDateTokens';
|
|
4
8
|
export * from './getWeek';
|
|
5
9
|
export * from './validateDate';
|
|
6
10
|
export * from './validateDateByDateFormat';
|
|
@@ -17,8 +17,8 @@ export function resolveFilterConditions(filter: IFSFilter, params: IFSParamsToGe
|
|
|
17
17
|
(!_hasProperty(params, 'panelid') || (letPassUndefinedProperties && filter.extras.panelid == null) || (letPassUndefinedParams && isEmpty(params.panelid)) || params.panelid === filter.extras.panelid) &&
|
|
18
18
|
(!_hasProperty(params, 'property') || (letPassUndefinedProperties && filter.property == null) || (letPassUndefinedParams && isEmpty(params.property)) || params.property === filter.property) &&
|
|
19
19
|
(!_hasProperty(params, 'validator') || (letPassUndefinedProperties && filter.validator == null) || (letPassUndefinedParams && isEmpty(params.validator)) || params.validator === filter.validator) &&
|
|
20
|
-
(!_hasProperty(params, 'column') || (letPassUndefinedProperties && filter.column == null) || (letPassUndefinedParams && isEmpty(params.column)) || (params.column?.id === filter.column.id &&
|
|
21
|
-
params.column?.qrveyid === filter.column.qrveyid &&
|
|
22
|
-
params.column?.linkid === filter.column.linkid &&
|
|
23
|
-
params.column?.aggregate === filter.column.aggregate));
|
|
20
|
+
(!_hasProperty(params, 'column') || (letPassUndefinedProperties && filter.column == null) || (letPassUndefinedParams && isEmpty(params.column)) || ((letPassUndefinedParams && isEmpty(params.column?.id) || params.column?.id === filter.column.id) &&
|
|
21
|
+
(letPassUndefinedParams && isEmpty(params.column?.qrveyid) || params.column?.qrveyid === filter.column.qrveyid) &&
|
|
22
|
+
(letPassUndefinedParams && isEmpty(params.column?.linkid) || params.column?.linkid === filter.column.linkid) &&
|
|
23
|
+
(letPassUndefinedParams && isEmpty(params.column?.aggregate) || params.column?.aggregate === filter.column.aggregate)));
|
|
24
24
|
}
|
|
@@ -9,7 +9,7 @@ import { IFSParamsToGetFilterEnableds } from "./IFSParamsToGetFilterEnableds";
|
|
|
9
9
|
* Structure for filter properties
|
|
10
10
|
*/
|
|
11
11
|
export interface IFSParamsToGetFilter {
|
|
12
|
-
column?: IFSColumn
|
|
12
|
+
column?: Partial<IFSColumn>;
|
|
13
13
|
dateSection?: IFDateSection;
|
|
14
14
|
enableds?: IFSParamsToGetFilterEnableds;
|
|
15
15
|
linkid?: string;
|
|
@@ -19,4 +19,4 @@ export interface IFSParamsToGetFilter {
|
|
|
19
19
|
scope?: IFScope;
|
|
20
20
|
scopeid?: string;
|
|
21
21
|
validator?: IFValidator;
|
|
22
|
-
}
|
|
22
|
+
}
|
|
@@ -191,9 +191,9 @@ export const I18N_CHART_BUILDER_STYLE_OPTIONS: Pick<II18nChartBuilder, StyleOpti
|
|
|
191
191
|
align: 'Align',
|
|
192
192
|
align_all_columns: 'All Columns',
|
|
193
193
|
align_default: 'Default',
|
|
194
|
-
align_left: '
|
|
195
|
-
align_right: '
|
|
196
|
-
align_center: '
|
|
194
|
+
align_left: 'Left',
|
|
195
|
+
align_right: 'Right',
|
|
196
|
+
align_center: 'Center',
|
|
197
197
|
typeface: 'Typeface',
|
|
198
198
|
weight: 'Weight',
|
|
199
199
|
weight_bold: 'Bold',
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { IFormatCurrency } from "./IFormatCurrency.Interface";
|
|
2
|
+
import { IFormatDefaultFormat } from "./IFormatDefaultFormat";
|
|
2
3
|
|
|
3
|
-
export interface IFormatOutputFormat {
|
|
4
|
-
format: string;
|
|
5
|
-
type: string;
|
|
6
|
-
decimals?: number;
|
|
4
|
+
export interface IFormatOutputFormat extends IFormatDefaultFormat {
|
|
7
5
|
currency?: IFormatCurrency;
|
|
8
6
|
backup_currency?: IFormatCurrency;
|
|
9
|
-
originalFormat?:
|
|
7
|
+
originalFormat?: IFormatOutputFormat;
|
|
10
8
|
}
|