@qrvey/utils 1.5.0-3 → 1.5.0-6

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.
Files changed (62) hide show
  1. package/README.md +1 -1
  2. package/dist/charts/adapters/endpointData.d.ts +90 -0
  3. package/dist/charts/adapters/endpointData.js +511 -0
  4. package/dist/charts/adapters/endpointDataGet.d.ts +14 -0
  5. package/dist/charts/adapters/endpointDataGet.js +428 -0
  6. package/dist/charts/adapters/endpointDataValidators.d.ts +4 -0
  7. package/dist/charts/adapters/endpointDataValidators.js +54 -0
  8. package/dist/charts/adapters/index.d.ts +3 -0
  9. package/dist/charts/adapters/index.js +3 -0
  10. package/dist/charts/index.d.ts +1 -0
  11. package/dist/charts/index.js +1 -0
  12. package/dist/cjs/charts/adapters/endpointData.d.ts +90 -0
  13. package/dist/cjs/charts/adapters/endpointData.js +517 -0
  14. package/dist/cjs/charts/adapters/endpointDataGet.d.ts +14 -0
  15. package/dist/cjs/charts/adapters/endpointDataGet.js +444 -0
  16. package/dist/cjs/charts/adapters/endpointDataValidators.d.ts +4 -0
  17. package/dist/cjs/charts/adapters/endpointDataValidators.js +61 -0
  18. package/dist/cjs/charts/adapters/index.d.ts +3 -0
  19. package/dist/cjs/charts/adapters/index.js +19 -0
  20. package/dist/cjs/charts/index.d.ts +1 -0
  21. package/dist/cjs/charts/index.js +1 -0
  22. package/dist/cjs/column_format/helpers/defineTableChartFormat.js +2 -2
  23. package/dist/cjs/column_format/helpers/defineXYChartFormat.js +4 -3
  24. package/dist/cjs/constants/Charts.Const.d.ts +1 -0
  25. package/dist/cjs/constants/Charts.Const.js +1 -0
  26. package/dist/cjs/format/definition.d.ts +1 -0
  27. package/dist/cjs/format/definition.js +8 -1
  28. package/dist/cjs/format/duration/durationFormatter.js +1 -5
  29. package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilder.d.ts +2 -0
  30. package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilderDurationParts.d.ts +9 -0
  31. package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilderDurationParts.js +2 -0
  32. package/dist/cjs/globalization/interfaces/chart_builder/index.d.ts +1 -0
  33. package/dist/cjs/globalization/interfaces/chart_builder/index.js +1 -0
  34. package/dist/cjs/globalization/interfaces/common/II18nCommon.d.ts +1 -0
  35. package/dist/cjs/globalization/interfaces/panel/II18nPanelMenu.d.ts +1 -0
  36. package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesTheme.d.ts +1 -0
  37. package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER.js +8 -0
  38. package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +2 -2
  39. package/dist/cjs/globalization/labels/common/I18N_COMMON.js +1 -0
  40. package/dist/cjs/globalization/labels/panel/I18N_PANEL.js +1 -0
  41. package/dist/cjs/globalization/labels/style_themes/I18N_STYLE_THEMES.js +1 -0
  42. package/dist/column_format/helpers/defineTableChartFormat.js +2 -2
  43. package/dist/column_format/helpers/defineXYChartFormat.js +4 -3
  44. package/dist/constants/Charts.Const.d.ts +1 -0
  45. package/dist/constants/Charts.Const.js +1 -0
  46. package/dist/format/definition.d.ts +1 -0
  47. package/dist/format/definition.js +7 -0
  48. package/dist/format/duration/durationFormatter.js +1 -5
  49. package/dist/globalization/interfaces/chart_builder/II18nChartBuilder.d.ts +2 -0
  50. package/dist/globalization/interfaces/chart_builder/II18nChartBuilderDurationParts.d.ts +9 -0
  51. package/dist/globalization/interfaces/chart_builder/II18nChartBuilderDurationParts.js +1 -0
  52. package/dist/globalization/interfaces/chart_builder/index.d.ts +1 -0
  53. package/dist/globalization/interfaces/chart_builder/index.js +1 -0
  54. package/dist/globalization/interfaces/common/II18nCommon.d.ts +1 -0
  55. package/dist/globalization/interfaces/panel/II18nPanelMenu.d.ts +1 -0
  56. package/dist/globalization/interfaces/style_themes/II18nStyleThemesTheme.d.ts +1 -0
  57. package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER.js +8 -0
  58. package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +2 -2
  59. package/dist/globalization/labels/common/I18N_COMMON.js +1 -0
  60. package/dist/globalization/labels/panel/I18N_PANEL.js +1 -0
  61. package/dist/globalization/labels/style_themes/I18N_STYLE_THEMES.js +1 -0
  62. package/package.json +1 -1
@@ -69,6 +69,7 @@ import { II18nChartBuilderTimePeriod } from "./II18nChartBuilderTimePeriod";
69
69
  import { II18nChartBuilderTimePeriodCustomRange } from "./II18nChartBuilderTimePeriodCustomRange";
70
70
  import { II18nChartBuilderWordCloud } from "./II18nChartBuilderWordCloud";
71
71
  import { II18nChartBuilderBoxWhisker } from "./II18nChartBuilderBoxWhisker";
72
+ import { II18nChartBuilderDurationParts } from "./II18nChartBuilderDurationParts";
72
73
  export interface II18nChartBuilder {
73
74
  action_panel: II18nChartBuilderActionPanel;
74
75
  aggregated_formula: II18nChartBuilderAggregatedFormulas;
@@ -141,4 +142,5 @@ export interface II18nChartBuilder {
141
142
  trend_chart: II18nChartBuilderTrendChart;
142
143
  trends_line: II18nChartBuilderTrendsLine;
143
144
  word_cloud: II18nChartBuilderWordCloud;
145
+ duration_parts: II18nChartBuilderDurationParts;
144
146
  }
@@ -0,0 +1,9 @@
1
+ export interface II18nChartBuilderDurationParts {
2
+ full_duration: string;
3
+ hour_minute_seconds: string;
4
+ hour_minutes: string;
5
+ hours: string;
6
+ minutes: string;
7
+ seconds: string;
8
+ milliseconds: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -70,3 +70,4 @@ export * from "./II18nChartBuilderTimePeriod";
70
70
  export * from "./II18nChartBuilderTimePeriodCustomRange";
71
71
  export * from "./II18nChartBuilderWordCloud";
72
72
  export * from "./II18nChartBuilderBoxWhisker";
73
+ export * from "./II18nChartBuilderDurationParts";
@@ -86,3 +86,4 @@ __exportStar(require("./II18nChartBuilderTimePeriod"), exports);
86
86
  __exportStar(require("./II18nChartBuilderTimePeriodCustomRange"), exports);
87
87
  __exportStar(require("./II18nChartBuilderWordCloud"), exports);
88
88
  __exportStar(require("./II18nChartBuilderBoxWhisker"), exports);
89
+ __exportStar(require("./II18nChartBuilderDurationParts"), exports);
@@ -7,6 +7,7 @@ import { II18nDayNames } from "./II18nDayNames";
7
7
  import { II18nUnits } from "./II18nUnits";
8
8
  import { II18nCalendar } from "../calendar/II18nCalendar";
9
9
  export interface II18nCommon {
10
+ aggregates: string;
10
11
  aggregate_labels: II18nAgreggateLabels;
11
12
  calendar: II18nCalendar;
12
13
  column_types: II18nColumnTypes;
@@ -12,4 +12,5 @@ export interface II18nPanelMenu {
12
12
  pdf: string;
13
13
  csv: string;
14
14
  csv_summary: string;
15
+ excel: string;
15
16
  }
@@ -9,6 +9,7 @@ export interface II18nStyleThemesTheme {
9
9
  edit_theme: string;
10
10
  generate_new: string;
11
11
  header_font_color: string;
12
+ header_main_color: string;
12
13
  id: string;
13
14
  legends: string;
14
15
  main_color: string;
@@ -27,6 +27,14 @@ exports.I18N_CHART_BUILDER = Object.assign(Object.assign(Object.assign(Object.as
27
27
  date_format: "Date Format",
28
28
  value_format: "Value Format",
29
29
  duration: "Duration",
30
+ }, duration_parts: {
31
+ full_duration: "D[d] HH[h] mm[m] ss[s]",
32
+ hour_minute_seconds: "HH:mm:ss",
33
+ hour_minutes: "HH:mm",
34
+ hours: "HH",
35
+ minutes: "mm",
36
+ seconds: "ss (Seconds)",
37
+ milliseconds: "SSS (Milliseconds)",
30
38
  }, chart_names: {
31
39
  bar: "Bar",
32
40
  line: "Line",
@@ -218,8 +218,8 @@ exports.I18N_CHART_BUILDER_STYLE_OPTIONS = {
218
218
  border_outer: "Outer Borders",
219
219
  expandable_color: "Header Color",
220
220
  expandable_font_color: "Header Font Color",
221
- crosstab_color: "Header Color",
222
- crosstab_font_color: "Header Font Color",
221
+ crosstab_color: "BG Color",
222
+ crosstab_font_color: "Font Color",
223
223
  },
224
224
  table_body: {
225
225
  title: "Body",
@@ -9,6 +9,7 @@ const I18N_COLUMN_PROPERTY_LABEL_1 = require("./I18N_COLUMN_PROPERTY_LABEL");
9
9
  const I18N_DATE_GROUPING_1 = require("./I18N_DATE_GROUPING");
10
10
  const I18N_DAY_NAMES_1 = require("./I18N_DAY_NAMES");
11
11
  exports.I18N_COMMON = {
12
+ aggregates: "Aggregates",
12
13
  aggregate_labels: I18N_AGGREGATE_LABEL_1.I18N_AGGREGATE_LABEL,
13
14
  calendar: calendar_1.I18N_CALENDAR,
14
15
  column_types: I18N_COLUMN_LABEL_1.I18N_COLUMN_LABEL,
@@ -44,6 +44,7 @@ exports.I18N_PANEL = {
44
44
  pdf: "PDF",
45
45
  csv: "CSV",
46
46
  csv_summary: "CSV-Summary",
47
+ excel: "Excel",
47
48
  },
48
49
  menu_options: {
49
50
  see_data: "See Data",
@@ -34,6 +34,7 @@ exports.I18N_STYLE_THEMES = {
34
34
  edit_theme: "Edit Theme",
35
35
  generate_new: "Generate New",
36
36
  header_font_color: "Header Font Color",
37
+ header_main_color: "Header BG Color",
37
38
  id: "ID",
38
39
  legends: "Legends",
39
40
  main_color: "Main Color",
@@ -5,9 +5,9 @@ import { CHART_GROUPS } from "../constants/CHART_GROUP";
5
5
  import { STRING_FORMAT } from "../constants/STRING_FORMAT";
6
6
  import { TABLE_TYPE } from "../constants/TABLE_TYPE";
7
7
  import { columnTypeByChart } from "./columnTypeByChart";
8
+ import { STANDARD_NUMERIC_FORMATS } from "../../format/definition";
8
9
  import { CALCULATION_LABEL } from "../../qrvey/constants/CALCULATION_LABEL";
9
10
  import { DATEGROUP_UNSUPPORT_FORMAT } from "../constants/DATEGROUP_UNSUPPORT_FORMAT";
10
- import { DURATION_PARTS_LIST } from '../constants/DURATION_PARTS_LIST';
11
11
  /**
12
12
  * It returns the format of a column based on the column type, the chart type, and the chart settings
13
13
  * @param {IChartColumn} column - IChartColumn
@@ -73,7 +73,7 @@ export const defineTableChartFormat = (column, settings) => {
73
73
  else {
74
74
  output = defaultFormat || defaultNumeric;
75
75
  }
76
- if (DURATION_PARTS_LIST.includes(output === null || output === void 0 ? void 0 : output.format)) {
76
+ if (!STANDARD_NUMERIC_FORMATS.includes(output === null || output === void 0 ? void 0 : output.format)) {
77
77
  output = Object.assign(Object.assign({}, output), { template: output.format, format: "Duration" });
78
78
  }
79
79
  return output;
@@ -1,10 +1,10 @@
1
1
  import { AGGREGATE } from "../../charts/constants/AGGREGATE";
2
2
  import { COLUMN } from "../../columns/constants/COLUMN";
3
+ import { STANDARD_NUMERIC_FORMATS } from "../../format/definition";
3
4
  import { isEmpty } from "../../general/mix/isEmpty";
4
5
  import { CALCULATION_LABEL } from "../../qrvey/constants/CALCULATION_LABEL";
5
6
  import { CHART_GROUPS } from "../constants/CHART_GROUP";
6
7
  import { DATEGROUP_UNSUPPORT_FORMAT } from "../constants/DATEGROUP_UNSUPPORT_FORMAT";
7
- import { DURATION_PARTS_LIST } from "../constants/DURATION_PARTS_LIST";
8
8
  import { STRING_FORMAT } from "../constants/STRING_FORMAT";
9
9
  import { columnTypeByChart } from "./columnTypeByChart";
10
10
  /**
@@ -35,8 +35,9 @@ export const defineXYChartFormat = (column, settings) => {
35
35
  const hasDefaultFormat = isEmpty(selectedFormat) ||
36
36
  (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format) === defaultText ||
37
37
  (selectedFormat === null || selectedFormat === void 0 ? void 0 : selectedFormat.format) === defaultText;
38
- const newOutputFormat = DURATION_PARTS_LIST.includes(outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format)
39
- ? Object.assign(Object.assign({}, outputFormat), { template: outputFormat.format, format: "Duration" }) : outputFormat;
38
+ const newOutputFormat = STANDARD_NUMERIC_FORMATS.includes(outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format)
39
+ ? outputFormat
40
+ : Object.assign(Object.assign({}, outputFormat), { template: outputFormat.format, format: "Duration" });
40
41
  switch (columnType) {
41
42
  case COLUMN.YES_NO:
42
43
  case COLUMN.PHONE:
@@ -1,5 +1,6 @@
1
1
  export declare enum CHART_TYPE {
2
2
  BAR_CHART = "BAR_CHART",
3
+ FUNNEL_CHART = "FUNNEL_CHART",
3
4
  BAR_CHART_MS = "BAR_CHART_MS",
4
5
  EXPANDABLE_TABLE_CHART = "EXPANDABLE_TABLE_CHART",
5
6
  SYMBOL_CHART = "SYMBOL_CHART",
@@ -1,6 +1,7 @@
1
1
  export var CHART_TYPE;
2
2
  (function (CHART_TYPE) {
3
3
  CHART_TYPE["BAR_CHART"] = "BAR_CHART";
4
+ CHART_TYPE["FUNNEL_CHART"] = "FUNNEL_CHART";
4
5
  CHART_TYPE["BAR_CHART_MS"] = "BAR_CHART_MS";
5
6
  CHART_TYPE["EXPANDABLE_TABLE_CHART"] = "EXPANDABLE_TABLE_CHART";
6
7
  CHART_TYPE["SYMBOL_CHART"] = "SYMBOL_CHART";
@@ -21,6 +21,7 @@ export declare const enum LOCALE_FORMATS {
21
21
  ABBREVIATED = "Abbreviated",
22
22
  DURATION = "Duration"
23
23
  }
24
+ export declare const STANDARD_NUMERIC_FORMATS: LOCALE_FORMATS[];
24
25
  export declare const enum LOCALE_STYLES {
25
26
  DECIMAL = "decimal",
26
27
  PERCENT = "percent",
@@ -97,6 +97,13 @@ export const currencyISO = [
97
97
  { text: "฿ (THB)", label: "THB" },
98
98
  { text: "RM (MYR)", label: "MYR" },
99
99
  ];
100
+ export const STANDARD_NUMERIC_FORMATS = [
101
+ "Abbreviated" /* LOCALE_FORMATS.ABBREVIATED */,
102
+ "Currency" /* LOCALE_FORMATS.CURRENCY */,
103
+ "Decimal" /* LOCALE_FORMATS.DECIMAL */,
104
+ "Percentage" /* LOCALE_FORMATS.PERCENTAGE */,
105
+ "Scientific" /* LOCALE_FORMATS.SCIENTIFIC */,
106
+ ];
100
107
  export const LANG_DEFAULT = "en-US";
101
108
  export const CURRENCY_DEFAULT = { text: "$ (USD)", label: "USD" };
102
109
  export const DATETIME_OPTIONS = {
@@ -126,14 +126,10 @@ export class DurationFormatter {
126
126
  return "";
127
127
  number *= this.numberFactor;
128
128
  const durationParts = this.parts.reduce((store, part) => {
129
- store[part.symbol] = number / part.ms;
129
+ store[part.symbol] = Math.floor(number / part.ms);
130
130
  number %= part.ms;
131
131
  return store;
132
132
  }, {});
133
- if (!Number.isInteger(number))
134
- return number === null
135
- ? null
136
- : this.valueFormatter.format(number).padStart(this.parts.length, "0");
137
133
  if (isEmpty(this.template))
138
134
  return this.valueFormatter
139
135
  .format(number)
@@ -69,6 +69,7 @@ import { II18nChartBuilderTimePeriod } from "./II18nChartBuilderTimePeriod";
69
69
  import { II18nChartBuilderTimePeriodCustomRange } from "./II18nChartBuilderTimePeriodCustomRange";
70
70
  import { II18nChartBuilderWordCloud } from "./II18nChartBuilderWordCloud";
71
71
  import { II18nChartBuilderBoxWhisker } from "./II18nChartBuilderBoxWhisker";
72
+ import { II18nChartBuilderDurationParts } from "./II18nChartBuilderDurationParts";
72
73
  export interface II18nChartBuilder {
73
74
  action_panel: II18nChartBuilderActionPanel;
74
75
  aggregated_formula: II18nChartBuilderAggregatedFormulas;
@@ -141,4 +142,5 @@ export interface II18nChartBuilder {
141
142
  trend_chart: II18nChartBuilderTrendChart;
142
143
  trends_line: II18nChartBuilderTrendsLine;
143
144
  word_cloud: II18nChartBuilderWordCloud;
145
+ duration_parts: II18nChartBuilderDurationParts;
144
146
  }
@@ -0,0 +1,9 @@
1
+ export interface II18nChartBuilderDurationParts {
2
+ full_duration: string;
3
+ hour_minute_seconds: string;
4
+ hour_minutes: string;
5
+ hours: string;
6
+ minutes: string;
7
+ seconds: string;
8
+ milliseconds: string;
9
+ }
@@ -70,3 +70,4 @@ export * from "./II18nChartBuilderTimePeriod";
70
70
  export * from "./II18nChartBuilderTimePeriodCustomRange";
71
71
  export * from "./II18nChartBuilderWordCloud";
72
72
  export * from "./II18nChartBuilderBoxWhisker";
73
+ export * from "./II18nChartBuilderDurationParts";
@@ -70,3 +70,4 @@ export * from "./II18nChartBuilderTimePeriod";
70
70
  export * from "./II18nChartBuilderTimePeriodCustomRange";
71
71
  export * from "./II18nChartBuilderWordCloud";
72
72
  export * from "./II18nChartBuilderBoxWhisker";
73
+ export * from "./II18nChartBuilderDurationParts";
@@ -7,6 +7,7 @@ import { II18nDayNames } from "./II18nDayNames";
7
7
  import { II18nUnits } from "./II18nUnits";
8
8
  import { II18nCalendar } from "../calendar/II18nCalendar";
9
9
  export interface II18nCommon {
10
+ aggregates: string;
10
11
  aggregate_labels: II18nAgreggateLabels;
11
12
  calendar: II18nCalendar;
12
13
  column_types: II18nColumnTypes;
@@ -12,4 +12,5 @@ export interface II18nPanelMenu {
12
12
  pdf: string;
13
13
  csv: string;
14
14
  csv_summary: string;
15
+ excel: string;
15
16
  }
@@ -9,6 +9,7 @@ export interface II18nStyleThemesTheme {
9
9
  edit_theme: string;
10
10
  generate_new: string;
11
11
  header_font_color: string;
12
+ header_main_color: string;
12
13
  id: string;
13
14
  legends: string;
14
15
  main_color: string;
@@ -24,6 +24,14 @@ export const I18N_CHART_BUILDER = Object.assign(Object.assign(Object.assign(Obje
24
24
  date_format: "Date Format",
25
25
  value_format: "Value Format",
26
26
  duration: "Duration",
27
+ }, duration_parts: {
28
+ full_duration: "D[d] HH[h] mm[m] ss[s]",
29
+ hour_minute_seconds: "HH:mm:ss",
30
+ hour_minutes: "HH:mm",
31
+ hours: "HH",
32
+ minutes: "mm",
33
+ seconds: "ss (Seconds)",
34
+ milliseconds: "SSS (Milliseconds)",
27
35
  }, chart_names: {
28
36
  bar: "Bar",
29
37
  line: "Line",
@@ -215,8 +215,8 @@ export const I18N_CHART_BUILDER_STYLE_OPTIONS = {
215
215
  border_outer: "Outer Borders",
216
216
  expandable_color: "Header Color",
217
217
  expandable_font_color: "Header Font Color",
218
- crosstab_color: "Header Color",
219
- crosstab_font_color: "Header Font Color",
218
+ crosstab_color: "BG Color",
219
+ crosstab_font_color: "Font Color",
220
220
  },
221
221
  table_body: {
222
222
  title: "Body",
@@ -6,6 +6,7 @@ import { I18N_COLUMN_PROPERTY_LABEL } from "./I18N_COLUMN_PROPERTY_LABEL";
6
6
  import { I18N_DATE_GROUPING } from "./I18N_DATE_GROUPING";
7
7
  import { I18N_DAY_NAMES } from "./I18N_DAY_NAMES";
8
8
  export const I18N_COMMON = {
9
+ aggregates: "Aggregates",
9
10
  aggregate_labels: I18N_AGGREGATE_LABEL,
10
11
  calendar: I18N_CALENDAR,
11
12
  column_types: I18N_COLUMN_LABEL,
@@ -41,6 +41,7 @@ export const I18N_PANEL = {
41
41
  pdf: "PDF",
42
42
  csv: "CSV",
43
43
  csv_summary: "CSV-Summary",
44
+ excel: "Excel",
44
45
  },
45
46
  menu_options: {
46
47
  see_data: "See Data",
@@ -31,6 +31,7 @@ export const I18N_STYLE_THEMES = {
31
31
  edit_theme: "Edit Theme",
32
32
  generate_new: "Generate New",
33
33
  header_font_color: "Header Font Color",
34
+ header_main_color: "Header BG Color",
34
35
  id: "ID",
35
36
  legends: "Legends",
36
37
  main_color: "Main Color",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.5.0-3",
3
+ "version": "1.5.0-6",
4
4
  "description": "Helper, Utils for all Qrvey Projects",
5
5
  "homepage": "https://bitbucket.org/qrvey/qrvey_utils/wiki/Home",
6
6
  "main": "dist/index.js",