@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 { NUMERICAL_COLUMN } from "../..";
|
|
2
|
+
import { COLUMN } from "../../columns";
|
|
3
|
+
import { IChartColumn } from "../interfaces/IChartColumn";
|
|
4
|
+
import { IChartGroupType } from "../interfaces/IChartGroupType";
|
|
5
|
+
import { IChartShelfType } from "../interfaces/IChartShelfType";
|
|
6
|
+
/**
|
|
7
|
+
* It returns the column type for a given column, shelf type, chart group, and whether the table is
|
|
8
|
+
* grouped or not
|
|
9
|
+
* @param {IChartColumn} column - IChartColumn
|
|
10
|
+
* @param {IChartShelfType} shelfType - IChartShelfType
|
|
11
|
+
* @param {IChartGroupType} chartGroup - IChartGroupType
|
|
12
|
+
* @param {boolean} [isGroupedTable] - boolean - this is a boolean that is true if the table is
|
|
13
|
+
* grouped.
|
|
14
|
+
* @returns The column type of the column.
|
|
15
|
+
*/
|
|
16
|
+
export declare const columnTypeByChart: (column: IChartColumn, shelfType: IChartShelfType, chartGroup: IChartGroupType, isGroupedTable?: boolean) => import("../..").COMPLEX_COLUMN | import("../..").COMPOUND_COLUMN | NUMERICAL_COLUMN | COLUMN.SINGLE_CHOICE | COLUMN.MULTIPLE_CHOICE | COLUMN.YES_NO | COLUMN.RANKING | COLUMN.DATE | COLUMN.SIGNATURE | COLUMN.DROPDOWN | COLUMN.IMAGE | COLUMN.EMAIL_FORM | COLUMN.PHONE | COLUMN.PASSWORD | COLUMN.CHECKLIST | COLUMN.NPS_SCORE | COLUMN.NPS_FEEDBACK | COLUMN.TEXT_LABEL | COLUMN.TEXT_CATEGORY | COLUMN.LOOKUP | COLUMN.HEADLINE | COLUMN.SECTION | COLUMN.AGGREGATED_FORMULA | COLUMN.BUCKET | COLUMN.SLIDEBAR | COLUMN.NUMERIC | COLUMN.NUMERICC | COLUMN.NUMERICP | COLUMN.NUMERICG | COLUMN.RATING | COLUMN.TEXTFIELD | COLUMN.LONGTEXT | COLUMN.IMAGEUPLOAD | COLUMN.FILEUPLOAD | COLUMN.EXPRESSION | COLUMN.NAME | COLUMN.USADDRESS | COLUMN.ADDRESS | "DATE" | "NUMERIC" | "TEXT_LABEL";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { NUMERICAL_COLUMN, NUMERICAL_COLUMNS } from "../..";
|
|
2
|
+
import { COLUMN } from "../../columns";
|
|
3
|
+
import { CHART_GROUPS } from "../constants/CHART_GROUP";
|
|
4
|
+
import { SHELF_TYPE } from "../constants/SHELF_TYPE";
|
|
5
|
+
import { parseFormulaTypeByCharts } from "./parseFormulaTypeByCharts";
|
|
6
|
+
/**
|
|
7
|
+
* It returns the column type for a given column, shelf type, chart group, and whether the table is
|
|
8
|
+
* grouped or not
|
|
9
|
+
* @param {IChartColumn} column - IChartColumn
|
|
10
|
+
* @param {IChartShelfType} shelfType - IChartShelfType
|
|
11
|
+
* @param {IChartGroupType} chartGroup - IChartGroupType
|
|
12
|
+
* @param {boolean} [isGroupedTable] - boolean - this is a boolean that is true if the table is
|
|
13
|
+
* grouped.
|
|
14
|
+
* @returns The column type of the column.
|
|
15
|
+
*/
|
|
16
|
+
export const columnTypeByChart = (column, shelfType, chartGroup, isGroupedTable) => {
|
|
17
|
+
if (!column)
|
|
18
|
+
return;
|
|
19
|
+
const currentType = column.type === COLUMN.FORMULA ? parseFormulaTypeByCharts(column.formulaType) : column.type;
|
|
20
|
+
const isNumericalColumn = NUMERICAL_COLUMNS.some(colType => colType === currentType)
|
|
21
|
+
|| ((chartGroup === CHART_GROUPS.TABLES) && (isGroupedTable === true) && (shelfType === SHELF_TYPE.COLUMNS))
|
|
22
|
+
|| ((chartGroup === CHART_GROUPS.XY) && (shelfType === SHELF_TYPE.VALUE || shelfType === SHELF_TYPE.SERIES));
|
|
23
|
+
return isNumericalColumn === true ? NUMERICAL_COLUMN.NUMERIC : currentType;
|
|
24
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IChartColumn } from "../interfaces/IChartColumn";
|
|
2
|
+
import { IColumnFormatReturnType } from "../interfaces/IColumnFormatReturnType";
|
|
3
|
+
import { IColumnFormatSettings } from "../interfaces/IColumnFormatSettings";
|
|
4
|
+
/**
|
|
5
|
+
* > If the chart is a table chart, then define the format for a table chart, otherwise define the
|
|
6
|
+
* format for an XY chart
|
|
7
|
+
* @param {IChartColumn} column - IChartColumn - this is the column object that is passed to the chart.
|
|
8
|
+
* @param {IColumnFormatSettings} settings - IColumnFormatSettings
|
|
9
|
+
* @returns IColumnFormatReturnType
|
|
10
|
+
*/
|
|
11
|
+
export declare const defineFormatV2: (column: IChartColumn, settings: IColumnFormatSettings) => IColumnFormatReturnType;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineTableChartFormat } from "./defineTableChartFormat";
|
|
2
|
+
import { defineXYChartFormat } from "./defineXYChartFormat";
|
|
3
|
+
/**
|
|
4
|
+
* > If the chart is a table chart, then define the format for a table chart, otherwise define the
|
|
5
|
+
* format for an XY chart
|
|
6
|
+
* @param {IChartColumn} column - IChartColumn - this is the column object that is passed to the chart.
|
|
7
|
+
* @param {IColumnFormatSettings} settings - IColumnFormatSettings
|
|
8
|
+
* @returns IColumnFormatReturnType
|
|
9
|
+
*/
|
|
10
|
+
export const defineFormatV2 = (column, settings) => {
|
|
11
|
+
const { isTableChart, isXYChart } = settings;
|
|
12
|
+
return isTableChart && !isXYChart ? defineTableChartFormat(column, settings) : defineXYChartFormat(column, settings);
|
|
13
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IChartColumn } from "../interfaces/IChartColumn";
|
|
2
|
+
import { IColumnFormatReturnType } from "../interfaces/IColumnFormatReturnType";
|
|
3
|
+
import { IColumnFormatSettings } from "../interfaces/IColumnFormatSettings";
|
|
4
|
+
/**
|
|
5
|
+
* It returns the format of a column based on the column type, the chart type, and the chart settings
|
|
6
|
+
* @param {IChartColumn} column - IChartColumn
|
|
7
|
+
* @param {IColumnFormatSettings} settings - IColumnFormatSettings
|
|
8
|
+
*/
|
|
9
|
+
export declare const defineTableChartFormat: (column: IChartColumn, settings: IColumnFormatSettings) => IColumnFormatReturnType;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { AGGREGATE, COLUMN, isEmpty } from "../..";
|
|
2
|
+
import { CHART_GROUPS } from "../constants/CHART_GROUP";
|
|
3
|
+
import { DATEGROUP_UNSUPPORT_FORMAT } from "../constants/DATEGROUP_UNSUPPORT_FORMAT";
|
|
4
|
+
import { STRING_FORMAT } from "../constants/STRING_FORMAT";
|
|
5
|
+
import { TABLE_TYPE } from "../constants/TABLE_TYPE";
|
|
6
|
+
import { columnTypeByChart } from "./columnTypeByChart";
|
|
7
|
+
/**
|
|
8
|
+
* It returns the format of a column based on the column type, the chart type, and the chart settings
|
|
9
|
+
* @param {IChartColumn} column - IChartColumn
|
|
10
|
+
* @param {IColumnFormatSettings} settings - IColumnFormatSettings
|
|
11
|
+
*/
|
|
12
|
+
export const defineTableChartFormat = (column, settings) => {
|
|
13
|
+
const { aggregate, type, defaultFormat, outputFormat, selectedFormat, dateGroup } = column;
|
|
14
|
+
const { tableType, shelfType } = settings;
|
|
15
|
+
//Defaults
|
|
16
|
+
const defaultText = 'Default';
|
|
17
|
+
const defaultNumeric = { type: 'NUMERIC', format: 'Numeric' };
|
|
18
|
+
const defaultAbb = { type: 'NUMERIC', format: 'Abbreviated' };
|
|
19
|
+
const isGroupedTable = tableType === TABLE_TYPE.GROUPED;
|
|
20
|
+
const columnType = columnTypeByChart(column, shelfType, CHART_GROUPS.TABLES, isGroupedTable);
|
|
21
|
+
const noFormatSupported = DATEGROUP_UNSUPPORT_FORMAT.some(gp => gp === (dateGroup === null || dateGroup === void 0 ? void 0 : dateGroup.label));
|
|
22
|
+
const hasDefaultFormat = isEmpty(selectedFormat) && (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format) === defaultText;
|
|
23
|
+
const isUsedAsNumericColumn = type !== columnType;
|
|
24
|
+
switch (columnType) {
|
|
25
|
+
case COLUMN.YES_NO:
|
|
26
|
+
case COLUMN.PHONE:
|
|
27
|
+
case COLUMN.SINGLE_CHOICE:
|
|
28
|
+
case COLUMN.LONGTEXT:
|
|
29
|
+
case COLUMN.DROPDOWN:
|
|
30
|
+
case COLUMN.EXPRESSION:
|
|
31
|
+
case COLUMN.NAME:
|
|
32
|
+
case COLUMN.EMAIL_FORM:
|
|
33
|
+
case COLUMN.IMAGE:
|
|
34
|
+
case COLUMN.TEXT_LABEL:
|
|
35
|
+
return STRING_FORMAT.NONE;
|
|
36
|
+
case COLUMN.DATE: {
|
|
37
|
+
if (noFormatSupported) {
|
|
38
|
+
return STRING_FORMAT.NONE;
|
|
39
|
+
}
|
|
40
|
+
else if (hasDefaultFormat) {
|
|
41
|
+
return Object.assign(Object.assign({}, defaultFormat), { format: defaultText, originalFormat: Object.assign({}, column.outputFormat) });
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return selectedFormat;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
case COLUMN.NUMERIC:
|
|
48
|
+
case COLUMN.RATING:
|
|
49
|
+
case COLUMN.SLIDEBAR: {
|
|
50
|
+
if (isUsedAsNumericColumn) {
|
|
51
|
+
if ((aggregate === null || aggregate === void 0 ? void 0 : aggregate.label) === AGGREGATE.COUNT && hasDefaultFormat)
|
|
52
|
+
return defaultNumeric;
|
|
53
|
+
else if (hasDefaultFormat)
|
|
54
|
+
return defaultAbb;
|
|
55
|
+
else
|
|
56
|
+
return outputFormat;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
if (hasDefaultFormat) {
|
|
60
|
+
return Object.assign(Object.assign({}, defaultFormat), { format: defaultText, originalFormat: Object.assign({}, column.outputFormat) });
|
|
61
|
+
}
|
|
62
|
+
else
|
|
63
|
+
return selectedFormat;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IChartColumn } from "../interfaces/IChartColumn";
|
|
2
|
+
import { IColumnFormatReturnType } from "../interfaces/IColumnFormatReturnType";
|
|
3
|
+
import { IColumnFormatSettings } from "../interfaces/IColumnFormatSettings";
|
|
4
|
+
/**
|
|
5
|
+
* > It returns the format of a column based on the column's type, the chart's type, and the column's
|
|
6
|
+
* aggregate
|
|
7
|
+
* > Also, if the settings contains the prop withoutFormat as true, returns the default format
|
|
8
|
+
* @param {IChartColumn} column - IChartColumn
|
|
9
|
+
* @param {IColumnFormatSettings} settings - IColumnFormatSettings
|
|
10
|
+
*/
|
|
11
|
+
export declare const defineXYChartFormat: (column: IChartColumn, settings: IColumnFormatSettings) => IColumnFormatReturnType;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { AGGREGATE, COLUMN, isEmpty } from "../..";
|
|
2
|
+
import { CHART_GROUPS } from "../constants/CHART_GROUP";
|
|
3
|
+
import { DATEGROUP_UNSUPPORT_FORMAT } from "../constants/DATEGROUP_UNSUPPORT_FORMAT";
|
|
4
|
+
import { STRING_FORMAT } from "../constants/STRING_FORMAT";
|
|
5
|
+
import { columnTypeByChart } from "./columnTypeByChart";
|
|
6
|
+
/**
|
|
7
|
+
* > It returns the format of a column based on the column's type, the chart's type, and the column's
|
|
8
|
+
* aggregate
|
|
9
|
+
* > Also, if the settings contains the prop withoutFormat as true, returns the default format
|
|
10
|
+
* @param {IChartColumn} column - IChartColumn
|
|
11
|
+
* @param {IColumnFormatSettings} settings - IColumnFormatSettings
|
|
12
|
+
*/
|
|
13
|
+
export const defineXYChartFormat = (column, settings) => {
|
|
14
|
+
const { aggregate, type, defaultFormat, outputFormat, selectedFormat, dateGroup } = column;
|
|
15
|
+
const { shelfType, withoutFormat } = settings;
|
|
16
|
+
//Defaults
|
|
17
|
+
const defaultText = 'Default';
|
|
18
|
+
//const defaultNumeric = { type: 'NUMERIC', format: 'Numeric' };
|
|
19
|
+
const defaultAbb = { type: 'NUMERIC', format: 'Abbreviated' };
|
|
20
|
+
const columnType = columnTypeByChart(column, shelfType, CHART_GROUPS.XY);
|
|
21
|
+
const noFormatSupported = DATEGROUP_UNSUPPORT_FORMAT.some(gp => gp === (dateGroup === null || dateGroup === void 0 ? void 0 : dateGroup.label));
|
|
22
|
+
const isUsedAsNumericColumn = type !== columnType;
|
|
23
|
+
const hasDefaultFormat = (isEmpty(selectedFormat) && (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format) === defaultText) || ((selectedFormat === null || selectedFormat === void 0 ? void 0 : selectedFormat.format) === defaultText);
|
|
24
|
+
switch (columnType) {
|
|
25
|
+
case COLUMN.YES_NO:
|
|
26
|
+
case COLUMN.PHONE:
|
|
27
|
+
case COLUMN.SINGLE_CHOICE:
|
|
28
|
+
case COLUMN.LONGTEXT:
|
|
29
|
+
case COLUMN.DROPDOWN:
|
|
30
|
+
case COLUMN.EXPRESSION:
|
|
31
|
+
case COLUMN.NAME:
|
|
32
|
+
case COLUMN.EMAIL_FORM:
|
|
33
|
+
case COLUMN.IMAGE:
|
|
34
|
+
case COLUMN.TEXT_LABEL:
|
|
35
|
+
return STRING_FORMAT.NONE;
|
|
36
|
+
case COLUMN.DATE: {
|
|
37
|
+
if (noFormatSupported) {
|
|
38
|
+
return STRING_FORMAT.NONE;
|
|
39
|
+
}
|
|
40
|
+
else if (hasDefaultFormat) {
|
|
41
|
+
return Object.assign(Object.assign({}, defaultFormat), { format: defaultText, originalFormat: Object.assign({}, outputFormat) });
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return selectedFormat;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
case COLUMN.NUMERIC:
|
|
48
|
+
case COLUMN.RATING:
|
|
49
|
+
case COLUMN.SLIDEBAR: {
|
|
50
|
+
if (isUsedAsNumericColumn) {
|
|
51
|
+
if (((aggregate === null || aggregate === void 0 ? void 0 : aggregate.label) === AGGREGATE.COUNT && hasDefaultFormat)
|
|
52
|
+
||
|
|
53
|
+
(isUsedAsNumericColumn && (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.type) !== COLUMN.NUMERIC)
|
|
54
|
+
||
|
|
55
|
+
withoutFormat)
|
|
56
|
+
return defaultAbb;
|
|
57
|
+
else
|
|
58
|
+
return outputFormat;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
if (withoutFormat === true) {
|
|
62
|
+
return defaultFormat;
|
|
63
|
+
}
|
|
64
|
+
else if (hasDefaultFormat) {
|
|
65
|
+
return Object.assign({}, outputFormat);
|
|
66
|
+
}
|
|
67
|
+
else
|
|
68
|
+
return selectedFormat;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IFormulaType } from "../..";
|
|
2
|
+
/**
|
|
3
|
+
* It takes a string and returns a string
|
|
4
|
+
* @param {IFormulaType} type - IFormulaType - this is the type of the formula.
|
|
5
|
+
* @returns The type of the formula.
|
|
6
|
+
*/
|
|
7
|
+
export declare const parseFormulaTypeByCharts: (type: IFormulaType) => "DATE" | "NUMERIC" | "TEXT_LABEL";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FORMULA } from "../..";
|
|
2
|
+
/**
|
|
3
|
+
* It takes a string and returns a string
|
|
4
|
+
* @param {IFormulaType} type - IFormulaType - this is the type of the formula.
|
|
5
|
+
* @returns The type of the formula.
|
|
6
|
+
*/
|
|
7
|
+
export const parseFormulaTypeByCharts = (type) => {
|
|
8
|
+
switch (type) {
|
|
9
|
+
case FORMULA.NUMBER:
|
|
10
|
+
return 'NUMERIC';
|
|
11
|
+
case FORMULA.DATE:
|
|
12
|
+
return 'DATE';
|
|
13
|
+
default:
|
|
14
|
+
return 'TEXT_LABEL';
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IColumnSortingSettings, IColumnType, IFormatOutputFormat, IFormulaType } from "../..";
|
|
2
|
+
import { IColumnAggregate } from "../../columns/interfaces/IColumnAggregate";
|
|
3
|
+
import { IColumnDateGroupSettings } from "../../columns/interfaces/IColumnDateGroupSettings";
|
|
4
|
+
import { IColumnScale } from "../../columns/interfaces/IColumnScale";
|
|
5
|
+
import { IFormatDefaultFormat } from "../../interfaces/format/IFormatDefaultFormat";
|
|
6
|
+
export interface IChartColumn {
|
|
7
|
+
aggregate: IColumnAggregate;
|
|
8
|
+
colIndex: number;
|
|
9
|
+
dateGroup?: IColumnDateGroupSettings;
|
|
10
|
+
defaultFormat: IFormatDefaultFormat;
|
|
11
|
+
format?: string;
|
|
12
|
+
formulaType?: IFormulaType;
|
|
13
|
+
groupAgg: string;
|
|
14
|
+
id: string;
|
|
15
|
+
isGroup: string;
|
|
16
|
+
outputFormat: IFormatOutputFormat;
|
|
17
|
+
property: string;
|
|
18
|
+
scaleType?: IColumnScale;
|
|
19
|
+
selectedFormat?: IFormatDefaultFormat;
|
|
20
|
+
sorting?: IColumnSortingSettings;
|
|
21
|
+
text: string;
|
|
22
|
+
type: IColumnType;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IChartShelfType } from "./IChartShelfType";
|
|
2
|
+
import { IChartTableType } from "./IChartTableType";
|
|
3
|
+
export interface IColumnFormatSettings {
|
|
4
|
+
tableType?: IChartTableType;
|
|
5
|
+
isTableChart?: boolean;
|
|
6
|
+
isXYChart?: boolean;
|
|
7
|
+
shelfType: IChartShelfType;
|
|
8
|
+
withoutFormat: boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './IChartColumn';
|
|
2
|
+
export * from './IChartGroupType';
|
|
3
|
+
export * from './IChartShelfType';
|
|
4
|
+
export * from './IChartTableType';
|
|
5
|
+
export * from './IColumnFormatReturnType';
|
|
6
|
+
export * from './IColumnFormatSettings';
|
|
7
|
+
export * from './IFormatStringType';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './IChartColumn';
|
|
2
|
+
export * from './IChartGroupType';
|
|
3
|
+
export * from './IChartShelfType';
|
|
4
|
+
export * from './IChartTableType';
|
|
5
|
+
export * from './IColumnFormatReturnType';
|
|
6
|
+
export * from './IColumnFormatSettings';
|
|
7
|
+
export * from './IFormatStringType';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { isEmpty } from "../../general/mix/isEmpty";
|
|
2
|
+
import { padLeadingZeros } from "../../general/string/padLeadingZeros";
|
|
3
|
+
import { isTokenLabel } from "../../tokens/isTokenLabel";
|
|
4
|
+
/**
|
|
5
|
+
* * Transform a Date to [HH:mm:ss] date format.
|
|
6
|
+
* @param date String, object or millisencond number of the date
|
|
7
|
+
* @returns string of [HH:mm:ss] date format
|
|
8
|
+
*/
|
|
9
|
+
export function dateToHms(date) {
|
|
10
|
+
if (isEmpty(date) || isTokenLabel(date))
|
|
11
|
+
return date;
|
|
12
|
+
const dt = new Date(date.valueOf());
|
|
13
|
+
return padLeadingZeros(dt.getHours(), 2).slice(-2) + ':' + padLeadingZeros(dt.getMinutes(), 2).slice(-2) + ':' + padLeadingZeros(dt.getSeconds(), 2).slice(-2);
|
|
14
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transform a Date to [mm/dd/yyyy] date format.
|
|
3
|
+
* @param date String, object or millisencond number of the date
|
|
4
|
+
* @returns string of [mm/dd/yyyy] date format
|
|
5
|
+
*/
|
|
6
|
+
export declare function dateToMdyDate(date: string | Date | number, includeTime?: boolean): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
* Transform a Date to [mm/dd/yyyy] date format.
|
|
7
|
+
* @param date String, object or millisencond number of the date
|
|
8
|
+
* @returns string of [mm/dd/yyyy] date format
|
|
9
|
+
*/
|
|
10
|
+
export function dateToMdyDate(date, includeTime) {
|
|
11
|
+
if (isEmpty(date) || isTokenLabel(date))
|
|
12
|
+
return date;
|
|
13
|
+
const dt = new Date(date.valueOf());
|
|
14
|
+
return padLeadingZeros(dt.getMonth() + 1, 2).slice(-2) + '/' + padLeadingZeros(dt.getDate(), 2).slice(-2) + '/' + padLeadingZeros(dt.getFullYear(), 4) + (includeTime ? ' ' + dateToHms(date) : '');
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
* Transform a Date to [Month Year] date format.
|
|
6
|
+
* @param date String, object or millisencond number of the date
|
|
7
|
+
* @returns string of [Month Year] date format
|
|
8
|
+
*/
|
|
9
|
+
export function dateToMonthYear(date) {
|
|
10
|
+
if (isEmpty(date) || isTokenLabel(date))
|
|
11
|
+
return date;
|
|
12
|
+
const dt = new Date(date.valueOf());
|
|
13
|
+
return DATE_YEAR_MONTHS[dt.getMonth()] + ' ' + dt.getFullYear();
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
* Transform a Date to [Quarter Year] date format.
|
|
6
|
+
* @param date String, object or millisencond number of the date
|
|
7
|
+
* @returns string of [Quarter Year] date format
|
|
8
|
+
*/
|
|
9
|
+
export function dateToQuarterYear(date) {
|
|
10
|
+
if (isEmpty(date) || isTokenLabel(date))
|
|
11
|
+
return date;
|
|
12
|
+
const dt = new Date(date.valueOf());
|
|
13
|
+
const quarter = Math.ceil((dt.getMonth() + 1) / 3);
|
|
14
|
+
return DATE_YEAR_QUARTERS[quarter - 1] + ' ' + dt.getFullYear();
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { isEmpty } from "../../general/mix/isEmpty";
|
|
2
|
+
import { isTokenLabel } from "../../tokens/isTokenLabel";
|
|
3
|
+
import { getWeek } from "../helpers/getWeek";
|
|
4
|
+
/**
|
|
5
|
+
* Transform a Date to [W# Year] date format.
|
|
6
|
+
* @param date String, object or millisencond number of the date
|
|
7
|
+
* @returns string of [W# Year] date format
|
|
8
|
+
*/
|
|
9
|
+
export function dateToWeekYear(date) {
|
|
10
|
+
if (isEmpty(date) || isTokenLabel(date))
|
|
11
|
+
return date;
|
|
12
|
+
const dt = new Date(date.valueOf());
|
|
13
|
+
const weekObj = getWeek(dt);
|
|
14
|
+
return `W${weekObj.week} ${weekObj.year}`;
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { isEmpty } from "../../general/mix/isEmpty";
|
|
2
|
+
import { isTokenLabel } from "../../tokens/isTokenLabel";
|
|
3
|
+
/**
|
|
4
|
+
* Transform a Date to [Year] date format.
|
|
5
|
+
* @param date String, object or millisencond number of the date
|
|
6
|
+
* @returns string of [Year] date format
|
|
7
|
+
*/
|
|
8
|
+
export function dateToYear(date) {
|
|
9
|
+
if (isEmpty(date) || isTokenLabel(date))
|
|
10
|
+
return date;
|
|
11
|
+
const dt = new Date(date.valueOf());
|
|
12
|
+
return String(dt.getFullYear());
|
|
13
|
+
}
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @param time Flag to parse the object date to milliseconds.
|
|
5
5
|
* @returns The date object or the date in milliseconds
|
|
6
6
|
*/
|
|
7
|
-
export declare function mdyDateToDate(date: string, time?: boolean): string |
|
|
7
|
+
export declare function mdyDateToDate(date: string, time?: boolean): string | Date | number;
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @param time Flag to parse the object date to milliseconds.
|
|
5
5
|
* @returns The date object or the date in milliseconds
|
|
6
6
|
*/
|
|
7
|
-
export declare function monthYearToDate(monthYearDate: string, time?: boolean): string |
|
|
7
|
+
export declare function monthYearToDate(monthYearDate: string, time?: boolean): string | Date | number;
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @param time Flag to parse the object date to milliseconds.
|
|
5
5
|
* @returns The date object or the date in milliseconds
|
|
6
6
|
*/
|
|
7
|
-
export declare function quarterYearToDate(quarterYearDate: string, time?: boolean): string |
|
|
7
|
+
export declare function quarterYearToDate(quarterYearDate: string, time?: boolean): string | Date | number;
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @param time Flag to parse the object date to milliseconds.
|
|
5
5
|
* @returns The date object or the date in milliseconds
|
|
6
6
|
*/
|
|
7
|
-
export declare function weekYearToDate(weekYear: string, time?: boolean): string |
|
|
7
|
+
export declare function weekYearToDate(weekYear: string, time?: boolean): string | Date | number;
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @param time Flag to parse the object date to milliseconds.
|
|
5
5
|
* @returns The date object or the date in milliseconds
|
|
6
6
|
*/
|
|
7
|
-
export declare function yearToDate(yearDate: string, time?: boolean): string |
|
|
7
|
+
export declare function yearToDate(yearDate: string, time?: boolean): string | Date | number;
|
|
@@ -6,4 +6,4 @@ import { IDateFormat } from "../interfaces/IDateFormat";
|
|
|
6
6
|
* @param time flag to convert the formatted date to miliseconds
|
|
7
7
|
* @returns a Date object, milisecond time or the same value if date format does not match.
|
|
8
8
|
*/
|
|
9
|
-
export declare function getDateByDateFormat(date: string, format: IDateFormat, time?: boolean): string |
|
|
9
|
+
export declare function getDateByDateFormat(date: string, format: IDateFormat, time?: boolean): string | Date | number;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IDateFormat } from "../interfaces/IDateFormat";
|
|
2
|
+
/**
|
|
3
|
+
* Gets the pick level number related to the Date picker element
|
|
4
|
+
* @param {IDateFormat} format The date format
|
|
5
|
+
* @returns {number} A number of the pick level setting
|
|
6
|
+
*/
|
|
7
|
+
export declare function getDatePickerPickLevel(format: IDateFormat): 0 | 1 | 2;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DATE_FORMAT } from "../constants/DATE_FORMAT";
|
|
2
|
+
/**
|
|
3
|
+
* Gets the pick level number related to the Date picker element
|
|
4
|
+
* @param {IDateFormat} format The date format
|
|
5
|
+
* @returns {number} A number of the pick level setting
|
|
6
|
+
*/
|
|
7
|
+
export function getDatePickerPickLevel(format) {
|
|
8
|
+
return format === DATE_FORMAT.YEAR ? 2 :
|
|
9
|
+
format === DATE_FORMAT.MONTH ? 1 : 0;
|
|
10
|
+
}
|