From 4cd72ab4fe3fd22b87539ea7bc64a54de3f6111f Mon Sep 17 00:00:00 2001 From: Shubham Shrivastav Date: Wed, 20 Nov 2024 12:25:39 +0530 Subject: [PATCH] chore: use types and configs from the library --- report-builder/package-lock.json | 25 +- report-builder/package.json | 1 + .../ai-chart-input.component.ts | 2 +- .../slots-display/slots-display.component.ts | 2 +- .../shared/constants/charts.constant.ts | 2 +- .../report-builder/shared/models/models.ts | 2 +- .../shared/services/chart.service.ts | 2 +- .../shared/configs/area-chart-slots.config.ts | 28 -- .../shared/configs/bar-chart-slots.config.ts | 27 -- .../configs/bubble-chart-slots.config.ts | 26 -- .../configs/column-chart-slots.config.ts | 27 -- .../configs/donut-chart-slots.config.ts | 19 - .../src/app/shared/configs/index.ts | 7 - .../shared/configs/line-chart-slots.config.ts | 28 -- .../configs/treemap-chart-slots.config.ts | 26 -- report-builder/src/app/shared/models/slots.ts | 438 ------------------ 16 files changed, 28 insertions(+), 634 deletions(-) delete mode 100644 report-builder/src/app/shared/configs/area-chart-slots.config.ts delete mode 100644 report-builder/src/app/shared/configs/bar-chart-slots.config.ts delete mode 100644 report-builder/src/app/shared/configs/bubble-chart-slots.config.ts delete mode 100644 report-builder/src/app/shared/configs/column-chart-slots.config.ts delete mode 100644 report-builder/src/app/shared/configs/donut-chart-slots.config.ts delete mode 100644 report-builder/src/app/shared/configs/index.ts delete mode 100644 report-builder/src/app/shared/configs/line-chart-slots.config.ts delete mode 100644 report-builder/src/app/shared/configs/treemap-chart-slots.config.ts delete mode 100644 report-builder/src/app/shared/models/slots.ts diff --git a/report-builder/package-lock.json b/report-builder/package-lock.json index a04da3a..93c44ff 100644 --- a/report-builder/package-lock.json +++ b/report-builder/package-lock.json @@ -26,6 +26,7 @@ "@codemirror/state": "^6.4.0", "@codemirror/theme-one-dark": "^6.1.2", "@codemirror/view": "^6.23.0", + "@luzmo/dashboard-contents-types": "^1.0.5", "@luzmo/ngx-embed": "6.3.8", "@luzmo/nodejs-sdk": "^1.2.2", "@ngneat/until-destroy": "^10.0.0", @@ -2357,9 +2358,9 @@ ] }, "node_modules/@luzmo/dashboard-contents-types": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@luzmo/dashboard-contents-types/-/dashboard-contents-types-1.0.3.tgz", - "integrity": "sha512-UH2489sGqa8IpZG1KI4+EyYIYOfaO3Z/g8kqjrH2zthucjfk9xLW51T8QKDrK3hVNs7Hp+yEf7gVtP2Rwq4Bsw==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@luzmo/dashboard-contents-types/-/dashboard-contents-types-1.0.5.tgz", + "integrity": "sha512-FOSVYosfwfHILj6uhjZ8pwY8buX8UZiWKYbvtwc1nUdoYdFqpm7wW71ttXhYKOB8O9nMRYm/YE/2oXcZv8CgXw==", "dependencies": { "leaflet": "1.9.4", "tslib": "^2.3.0" @@ -2375,6 +2376,15 @@ "lit": "3.1.2" } }, + "node_modules/@luzmo/embed/node_modules/@luzmo/dashboard-contents-types": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@luzmo/dashboard-contents-types/-/dashboard-contents-types-1.0.3.tgz", + "integrity": "sha512-UH2489sGqa8IpZG1KI4+EyYIYOfaO3Z/g8kqjrH2zthucjfk9xLW51T8QKDrK3hVNs7Hp+yEf7gVtP2Rwq4Bsw==", + "dependencies": { + "leaflet": "1.9.4", + "tslib": "^2.3.0" + } + }, "node_modules/@luzmo/ngx-embed": { "version": "6.3.8", "resolved": "https://registry.npmjs.org/@luzmo/ngx-embed/-/ngx-embed-6.3.8.tgz", @@ -2406,6 +2416,15 @@ "@luzmo/dashboard-contents-types": "1.0.3" } }, + "node_modules/@luzmo/shared-embed/node_modules/@luzmo/dashboard-contents-types": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@luzmo/dashboard-contents-types/-/dashboard-contents-types-1.0.3.tgz", + "integrity": "sha512-UH2489sGqa8IpZG1KI4+EyYIYOfaO3Z/g8kqjrH2zthucjfk9xLW51T8QKDrK3hVNs7Hp+yEf7gVtP2Rwq4Bsw==", + "dependencies": { + "leaflet": "1.9.4", + "tslib": "^2.3.0" + } + }, "node_modules/@msgpackr-extract/msgpackr-extract-darwin-arm64": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-arm64/-/msgpackr-extract-darwin-arm64-3.0.3.tgz", diff --git a/report-builder/package.json b/report-builder/package.json index e8f620a..46a18de 100755 --- a/report-builder/package.json +++ b/report-builder/package.json @@ -28,6 +28,7 @@ "@codemirror/state": "^6.4.0", "@codemirror/theme-one-dark": "^6.1.2", "@codemirror/view": "^6.23.0", + "@luzmo/dashboard-contents-types": "^1.0.5", "@luzmo/ngx-embed": "6.3.8", "@luzmo/nodejs-sdk": "^1.2.2", "@ngneat/until-destroy": "^10.0.0", diff --git a/report-builder/src/app/report-builder/chart-panel/chart-config-panel/ai-chart-input/ai-chart-input.component.ts b/report-builder/src/app/report-builder/chart-panel/chart-config-panel/ai-chart-input/ai-chart-input.component.ts index 2c36714..0258a0f 100644 --- a/report-builder/src/app/report-builder/chart-panel/chart-config-panel/ai-chart-input/ai-chart-input.component.ts +++ b/report-builder/src/app/report-builder/chart-panel/chart-config-panel/ai-chart-input/ai-chart-input.component.ts @@ -12,7 +12,7 @@ import { CHARTS } from '../../../shared/constants/charts.constant'; import { SlotsDisplayComponent } from '../slots-display/slots-display.component'; import { ChartPickerComponent } from '../chart-picker/chart-picker.component'; import { ItemType } from '@luzmo/ngx-embed'; -import { Slot } from 'src/app/shared/models/slots'; +import { Slot } from '@luzmo/dashboard-contents-types'; @Component({ selector: 'app-ai-chart', diff --git a/report-builder/src/app/report-builder/chart-panel/chart-config-panel/slots-display/slots-display.component.ts b/report-builder/src/app/report-builder/chart-panel/chart-config-panel/slots-display/slots-display.component.ts index 8a6676d..729ad40 100644 --- a/report-builder/src/app/report-builder/chart-panel/chart-config-panel/slots-display/slots-display.component.ts +++ b/report-builder/src/app/report-builder/chart-panel/chart-config-panel/slots-display/slots-display.component.ts @@ -8,7 +8,7 @@ import { } from '@angular/cdk/drag-drop'; import { ChartService } from '../../../shared/services/chart.service'; import { COLUMN_TYPE_ICONS } from '../../../shared/constants/charts.constant'; -import { GenericSlotContent, Slot } from 'src/app/shared/models/slots'; +import { GenericSlotContent, Slot } from '@luzmo/dashboard-contents-types'; @Component({ selector: 'app-slots-display', diff --git a/report-builder/src/app/report-builder/shared/constants/charts.constant.ts b/report-builder/src/app/report-builder/shared/constants/charts.constant.ts index 2711e35..2ff4086 100644 --- a/report-builder/src/app/report-builder/shared/constants/charts.constant.ts +++ b/report-builder/src/app/report-builder/shared/constants/charts.constant.ts @@ -18,7 +18,7 @@ import { donutChartSlotsConfig, lineChartSlotsConfig, treemapChartSlotsConfig -} from '../../../shared/configs'; +} from '@luzmo/dashboard-contents-types'; import { Chart } from '../models/models'; import { PALETTES } from './color-palettes.constant'; diff --git a/report-builder/src/app/report-builder/shared/models/models.ts b/report-builder/src/app/report-builder/shared/models/models.ts index 00bc162..6c069ad 100644 --- a/report-builder/src/app/report-builder/shared/models/models.ts +++ b/report-builder/src/app/report-builder/shared/models/models.ts @@ -1,5 +1,5 @@ import { ItemType } from "@luzmo/ngx-embed"; -import { Slot } from "src/app/shared/models/slots"; +import { Slot } from "@luzmo/dashboard-contents-types"; export type Chart = { type: ItemType, diff --git a/report-builder/src/app/report-builder/shared/services/chart.service.ts b/report-builder/src/app/report-builder/shared/services/chart.service.ts index acc0167..4ae1fc4 100644 --- a/report-builder/src/app/report-builder/shared/services/chart.service.ts +++ b/report-builder/src/app/report-builder/shared/services/chart.service.ts @@ -3,7 +3,7 @@ import { patchState, signalState } from '@ngrx/signals'; import { CHARTS } from '../constants/charts.constant'; import { Chart } from '../models/models'; import { FilterSlot, Value } from "../../chart-panel/filters-panel/filters-panel.component"; -import { Slot } from 'src/app/shared/models/slots'; +import { Slot } from '@luzmo/dashboard-contents-types'; type ChartState = { name: Chart['name']; diff --git a/report-builder/src/app/shared/configs/area-chart-slots.config.ts b/report-builder/src/app/shared/configs/area-chart-slots.config.ts deleted file mode 100644 index afe4f6e..0000000 --- a/report-builder/src/app/shared/configs/area-chart-slots.config.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Slot } from '../models/slots'; - -export const areaChartSlotsConfig: Slot[] = [ - { - name: 'x-axis', - rotate: false, - label: 'X Axis', - type: 'mixed', - options: { isAggregationDisabled: true, isBinningDisabled: true, areDatetimeOptionsEnabled: true }, - isRequired: true - }, - { - name: 'measure', - rotate: false, - label: 'Measure', - type: 'numeric', - options: { isCumulativeSumEnabled: true }, - canAcceptMultipleColumns: true, - canAcceptFormula: true - }, - { - name: 'legend', - rotate: true, - label: 'Group by', - options: { areDatetimeOptionsEnabled: true }, - type: 'categorical' - } -]; diff --git a/report-builder/src/app/shared/configs/bar-chart-slots.config.ts b/report-builder/src/app/shared/configs/bar-chart-slots.config.ts deleted file mode 100644 index 44606fc..0000000 --- a/report-builder/src/app/shared/configs/bar-chart-slots.config.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Slot } from '../models/slots'; - -export const barChartSlotsConfig: Slot[] = [ - { - name: 'y-axis', - label: 'Category', - type: 'categorical', - rotate: true, - options: { areDatetimeOptionsEnabled: true } - }, - { - name: 'measure', - label: 'Measure', - type: 'numeric', - rotate: false, - options: { isCumulativeSumEnabled: true }, - canAcceptMultipleColumns: true, - canAcceptFormula: true - }, - { - name: 'legend', - label: 'Group by', - type: 'categorical', - rotate: true, - options: { areDatetimeOptionsEnabled: true } - } -]; diff --git a/report-builder/src/app/shared/configs/bubble-chart-slots.config.ts b/report-builder/src/app/shared/configs/bubble-chart-slots.config.ts deleted file mode 100644 index f855cc0..0000000 --- a/report-builder/src/app/shared/configs/bubble-chart-slots.config.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Slot } from '../models/slots'; - -export const bubbleChartSlotsConfig: Slot[] = [ - { - name: 'measure', - rotate: false, - label: 'Measure', - type: 'numeric', - canAcceptFormula: true - }, - { - name: 'category', - rotate: false, - label: 'Category', - options: { areDatetimeOptionsEnabled: true }, - type: 'categorical', - isRequired: true - }, - { - name: 'color', - label: 'Color', - options: { areDatetimeOptionsEnabled: true }, - rotate: true, - type: 'categorical' - } -]; diff --git a/report-builder/src/app/shared/configs/column-chart-slots.config.ts b/report-builder/src/app/shared/configs/column-chart-slots.config.ts deleted file mode 100644 index 5fa9ffe..0000000 --- a/report-builder/src/app/shared/configs/column-chart-slots.config.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Slot } from '../models/slots'; - -export const columnChartSlotsConfig: Slot[] = [ - { - name: 'measure', - rotate: false, - type: 'numeric', - options: { isCumulativeSumEnabled: true }, - label: 'Measure', - canAcceptMultipleColumns: true, - canAcceptFormula: true - }, - { - name: 'x-axis', - rotate: false, - type: 'categorical', - options: { areDatetimeOptionsEnabled: true }, - label: 'Category' - }, - { - name: 'legend', - rotate: true, - type: 'categorical', - options: { areDatetimeOptionsEnabled: true }, - label: 'Group by' - } -]; diff --git a/report-builder/src/app/shared/configs/donut-chart-slots.config.ts b/report-builder/src/app/shared/configs/donut-chart-slots.config.ts deleted file mode 100644 index b44fade..0000000 --- a/report-builder/src/app/shared/configs/donut-chart-slots.config.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Slot } from '../models/slots'; - -export const donutChartSlotsConfig: Slot[] = [ - { - name: 'measure', - rotate: false, - label: 'Measure', - type: 'numeric', - canAcceptMultipleColumns: true, - canAcceptFormula: true - }, - { - name: 'category', - rotate: false, - label: 'Category', - type: 'categorical', - options: { areDatetimeOptionsEnabled: true } - } -]; diff --git a/report-builder/src/app/shared/configs/index.ts b/report-builder/src/app/shared/configs/index.ts deleted file mode 100644 index cc42735..0000000 --- a/report-builder/src/app/shared/configs/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from './area-chart-slots.config'; -export * from './bar-chart-slots.config'; -export * from './bubble-chart-slots.config'; -export * from './column-chart-slots.config'; -export * from './donut-chart-slots.config'; -export * from './line-chart-slots.config'; -export * from './treemap-chart-slots.config'; \ No newline at end of file diff --git a/report-builder/src/app/shared/configs/line-chart-slots.config.ts b/report-builder/src/app/shared/configs/line-chart-slots.config.ts deleted file mode 100644 index 83d28c1..0000000 --- a/report-builder/src/app/shared/configs/line-chart-slots.config.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Slot } from '../models/slots'; - -export const lineChartSlotsConfig: Slot[] = [ - { - name: 'measure', - rotate: false, - label: 'Measure', - type: 'numeric', - options: { isCumulativeSumEnabled: true }, - canAcceptMultipleColumns: true, - canAcceptFormula: true - }, - { - name: 'x-axis', - rotate: false, - label: 'X axis', - type: 'mixed', - options: { isAggregationDisabled: true, isBinningDisabled: true, areDatetimeOptionsEnabled: true }, - isRequired: true - }, - { - name: 'legend', - rotate: true, - label: 'Group by', - options: { areDatetimeOptionsEnabled: true }, - type: 'categorical' - } -]; diff --git a/report-builder/src/app/shared/configs/treemap-chart-slots.config.ts b/report-builder/src/app/shared/configs/treemap-chart-slots.config.ts deleted file mode 100644 index f856c1e..0000000 --- a/report-builder/src/app/shared/configs/treemap-chart-slots.config.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Slot } from '../models/slots'; - -export const treemapChartSlotsConfig: Slot[] = [ - { - name: 'measure', - rotate: false, - label: 'Measure', - type: 'numeric', - canAcceptFormula: true - }, - { - name: 'category', - rotate: false, - label: 'Category', - type: 'categorical', - options: { areDatetimeOptionsEnabled: true }, - isRequired: true - }, - { - name: 'color', - rotate: true, - label: 'Color', - options: { areDatetimeOptionsEnabled: true }, - type: 'categorical' - } -]; diff --git a/report-builder/src/app/shared/models/slots.ts b/report-builder/src/app/shared/models/slots.ts deleted file mode 100644 index 728c806..0000000 --- a/report-builder/src/app/shared/models/slots.ts +++ /dev/null @@ -1,438 +0,0 @@ -export type SlotName = - | 'x-axis' - | 'y-axis' - | 'category' - | 'measure' - | 'coordinates' - | 'legend' - | 'geo' - | 'image' - | 'color' - | 'levels' - | 'slidermetric' - | 'dimension' - | 'destination' - | 'source' - | 'time' - | 'identifier' - | 'target' - | 'size' - | 'name' - | 'columns' - | 'column' - | 'row' - | 'evolution' - | 'close' - | 'open' - | 'low' - | 'high' - | 'order' - | 'route'; - -export type ColumnType = 'numeric' | 'hierarchy' | 'datetime' | 'spatial'; - -export type ColumnSubtype = 'duration' | 'currency' | 'coordinates' | 'hierarchy_element_expression' | 'topography'; - -export type FormulaType = 'hierarchy' | 'numeric' | 'datetime'; - -export type FormulaSubtype = 'duration' | 'currency' | 'date' | 'datetime'; - -/** - * Basic aggregation query type - */ -export type BasicItemQueryAggregation = 'count' | 'distinctcount'; - -/** - * Aggregation query type - */ -export type ItemQueryAggregation = BasicItemQueryAggregation -| 'sum' -| 'cumulativesum' -| 'average' -| 'median' -| 'min' -| 'max' -| 'stddev' -| 'weightedaverage' -| 'rate' -| 'histogram'; - -export type DatetimeDisplayMode = - 'default' - | 'weekday_number' - | 'weekday_name' - | 'day_in_month' - | 'day_in_year' - | 'month_name' - | 'month_number' - | 'week_number' - | 'second_in_minute' - | 'minute_in_hour' - | 'hour_in_day' - | 'quarter_number'; - -export interface GenericSlotContent { - /** - * Column / Formula type - */ - type?: ColumnType | FormulaType; - - /** - * Column subtype - */ - subtype?: ColumnSubtype | FormulaSubtype | null; // Note: it can be number or null in the runtime dashboard contents JSON. - - /** - * Label in format {locale: "label"}, for example, {en: "Total Revenue"} - * @TJS-type object - */ - label?: Record; - - /** - * Dataset id - * @format uuid - * @TJS-ignore - * @deprecated use datasetId instead. - */ - set?: string; - - /** - * Column id - * @format uuid - * @TJS-ignore - * @deprecated use columnId instead. - */ - column?: string; - - /** - * A dataset formula id or an ad-hoc formula. A formula is an entity similar to a column. You can add formulas on the dataset details page or use ad-hoc formulas. You can find more information about formulas in the article https://academy.luzmo.com/article/52tm82oo - */ - formula?: string; - - /** - * Dataset id - * @format uuid - */ - datasetId?: string; // ONLY for libraries for now. set is renamed to datasetId, we upgrade filter object when events are sent out from the application to the libraries. - - /** - * Column id - * @format uuid - */ - columnId?: string; // ONLY for libraries for now. column is renamed to columnId, we upgrade filter object when events are sent out from the application to the libraries. - - /** - * D3 format, it is used for "numeric" formatting (https://observablehq.com/@d3/d3-format), for "datetime" formatting (https://d3js.org/d3-time-format). - * It can also be used for "hierarchy" formatting but when it's used in the measure slot. - */ - format?: string; - - /** - * Currency code, for example "€" or "$". It is only used when the column type is "numeric" and subtype is "currency". - */ - currency?: string | null; - - /** - * Aggregation function. It can be used with a "numeric" column type, and with some limitations with "hierarchy" and "datetime" column types. - */ - aggregationFunc?: ItemQueryAggregation; - - /** - * Aggregation weight. It can be used with a "numeric" column type. - */ - aggregationWeight?: { - /** - * Dataset id - * @format uuid - * @TJS-ignore - * @deprecated use datasetId instead. - */ - set: string; - /** - * Column id - * @format uuid - * @TJS-ignore - * @deprecated use columnId instead. - */ - column: string; - /** - * Dataset id - * @format uuid - */ - datasetId?: string; // ONLY for libraries for now. set is renamed to datasetId, we upgrade filter object when events are sent out from the application to the libraries. - /** - * Column id - * @format uuid - */ - columnId?: string; // ONLY for libraries for now. column is renamed to columnId, we upgrade filter object when events are sent out from the application to the libraries. - /** - * Column subtype - */ - columnSubType: ColumnSubtype; - }; - - /** - * Color of the column. Any column type can have it, but it's applied when a column is set as a measure and when multiple measures are defined. - */ - color?: string | null; - - /** - * "hierarchy" or "datetime" level - * @TJS-type ["number", "null"] - */ - level?: number | null; // Note: it can be number or null in the runtime dashboard contents JSON. - - /** - * Lowest "hierarchy" or "datetime" level - */ - lowestLevel?: number | null; - - /** - * Bin definition. It can be used when a "numeric" column is used as a category. - */ - bins?: { - /** - * Enable or disable binning - */ - enabled: boolean; - /** - * Defines the range of the bins - */ - - number?: number; - }; - - /** - * Duration definition. It's only used when the column type is "numeric" and subtype is "duration". - */ - duration?: { - /** - * Duration levels used - */ - levels: number[]; - /** - * Duration format - */ - format: 'short' | 'long' | 'time'; - }; - - /** - * Enable or disable grand totals, they're only used in Pivot table - */ - grandTotals?: { enabled: boolean }; - - /** - * Shows empty areas for geo slots (with the name "geo" and content type 'spacial). - * Also, it can be set in the options' advanced settings of the Choropleth map. - */ - include_nonoccurring?: boolean; // Used in geo slots - - /** - * If it's set it will be used for datetime formatting together with weekStart, weekDayNameFormat, monthNameFormat - */ - datetimeDisplayMode?: DatetimeDisplayMode; - - /** - * Week start day, 'sunday' or 'monday'. For datetime column formatting. - */ - weekStart?: 'sunday' | 'monday'; - - /** - * Week day name format for datetime column formatting - */ - weekDayNameFormat?: 'long' | 'short' | 'letter'; - - /** - * Month name format for datetime column formatting - */ - monthNameFormat?: 'long' | 'short' | 'letter'; - - // Slot options for internal use, they're also ignored in the JSON schema (@TJS-ignore): - - /** - * It's something that is used internally for Demo Data - * @TJS-ignore - */ - cardinality?: number; - - /** - * It's used internally for drilldown interactivity - * @TJS-ignore - */ - drilldownColumn?: GenericSlotContent; - - /** - * It's used internally for drilldown interactivity - * @TJS-ignore - */ - drilldownLevel?: number; - - /** - * Id of the slot. It's used in some cases but for internal needs. - * @format uuid - * @TJS-ignore - */ - id?: string; - - /** - * Index of the slot. It's used in some cases but for internal needs. - * @TJS-ignore - */ - index?: number; - - /** - * It's used internally for 'datetime' tupe - * @TJS-ignore - */ - multi?: boolean; // datetime - - /** - * The name of the slot. It's used in some cases but for internal needs. - * @TJS-ignore - */ - slotName?: string; - - /** - * It's used in some cases but for internal needs. - * @TJS-ignore - */ - sortableIndex?: number; - - /** - * It's used in some cases but for internal needs. - * @TJS-ignore - */ - sortableSelected?: boolean; - - /** - * It's used internally in parallel-coordinates-plot - * @TJS-ignore - */ - sortOrder?: number | string; - - /** - * It's something that is used internally by line-chart-forecast - * @TJS-ignore - */ - model?: any; - /** - * Settings to configure period over period comparison. It can be used only in a measure slot. - */ - periodOverPeriod?: { - /** - * Period over period comparison type: - * 'none' - turned off, - * 'past' - absolute value comparison to the past, - * 'change' - percentage change comparison to the past - */ - type: 'none' | 'past' | 'change'; - /** - * Period of time level - * 0 - period, 1 - year, 2 - quarter, 3 - month, 4 - week, 5 - day... 9 - millisecond - */ - level: number; - /** - * Number of periods - */ - quantity: number; - /** - * Turn ON/OFF period to date comparison - */ - periodToDate: boolean; - /** - * Category date level to disallow smaller Period-Over-Period levels. For internal use only - * @TJS-ignore - */ - minLevel: number; - }; -} - -export type Slot = { - /** - * Name of the slot - */ - name?: SlotName; - /** - * Label in format {locale: "label"}, for example, {en: "Total Revenue"} or just a string - */ - label?: string | Record; - /** - * Description of the slot (should be usable for AI generation purposes) - * @TJS-ignore - */ - description?: string; - /** - * Type of the slot - * @examples ["numeric", "categorical", "mixed"] - */ - type?: 'numeric' | 'categorical' | 'mixed'; - /** - * Order of importance of slots, eg. a category slot is more important than a legend slot. This property is used when changing chart types - */ - order?: number; - /** - * The data types the slot accepts - * @examples ["numeric", "hierarchy"] - */ - acceptableColumnTypes?: (ColumnType | FormulaType)[]; - /** - * Used when type is spatial, but you can eg. only use topography (choropleth-map) - * @examples ["topography"] - */ - acceptableColumnSubtypes?: (ColumnSubtype | FormulaSubtype)[]; - /** - * Whether a formula can be used - */ - canAcceptFormula?: boolean; - /** - * Content of the slot - */ - content?: GenericSlotContent[]; - rotate?: boolean; - /** - * Whether you can add multiple columns to the slot - */ - canAcceptMultipleColumns?: boolean; - requiredMinimumColumnsCount?: number; - /** - * Whether this slot needs to be filled in order to show information - */ - isRequired?: boolean; - /** - * Whether the slot is hidden - */ - isHidden?: boolean; - /** - * If current slot has multiple true and any of the slot in the given array is filled, the current slot can't accept multiple columns - * For e.g. in bar chart, measure slot can accept multiple but if legend slot is filled, it can't accept multiple, so a possible value for this property would be ["legend"] - * @examples ["legend"] - */ - noMultipleIfSlotsFilled?: SlotName[]; - options?: { - /** - * Check if binning is disabled for a numeric type column - */ - isBinningDisabled?: boolean; - /** - * Check if aggregation is disabled for numeric or mixed type columns - */ - isAggregationDisabled?: boolean; - /** - * Show grand totals, they're only used in Pivot table - */ - areGrandTotalsEnabled?: boolean; - /** - * Show only first slot grand totals, they're only used in Pivot table - */ - showOnlyFirstSlotGrandTotals?: boolean; - /** - * In case when a numeric column and a cumulative function can be used - */ - isCumulativeSumEnabled?: boolean; - /** - * Show formatting options for datetime type columns - */ - areDatetimeOptionsEnabled?: boolean; - showOnlyFirstSlotContentOptions?: boolean; - }; -};