@datarailsshared/dr_renderer 1.5.107 → 1.5.116

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.
@@ -0,0 +1,178 @@
1
+ declare namespace _exports {
2
+ export { FeatureChecker, CreateDefaultSuboptionsConfig };
3
+ }
4
+ declare namespace _exports {
5
+ export let CHART_COLORS: {
6
+ BACKGROUND: string;
7
+ TEXT: string;
8
+ LABEL: string;
9
+ LABEL_SECOND: string;
10
+ DRILL_UP_FILL: string;
11
+ DRILL_BUTTON_COLOR_FILL: string;
12
+ DRILL_BUTTON_COLOR: string;
13
+ DRILL_BUTTON_COLOR_HOVER: string;
14
+ PLOT_BORDER: string;
15
+ MINOR_GRID_LINE: string;
16
+ TICK_COLOR: string;
17
+ LABELS_OLD: string;
18
+ DATA_LABELS: string;
19
+ CONTRAST_TEXT: string;
20
+ LEGEND_BACKGROUND: string;
21
+ MASK: string;
22
+ };
23
+ export let SUBOPTIONS_FONTS: string[];
24
+ export let HIGHCHARTS_FONT_FAMILY: string;
25
+ export let HIGHCHARTS_FONT_FAMILY_CSS: string;
26
+ export let TOOLTIP_DEFAULT_SETTINGS: constants.TooltipDefaultSettings;
27
+ export let TOOLTIP_DEFAULT_OPTIONS: {
28
+ borderColor: string;
29
+ shadow: Object;
30
+ style: Object;
31
+ enabled: boolean;
32
+ };
33
+ export let LABEL_DEFAULT_SETTINGS: constants.LabelDefaultSettings;
34
+ export let LABEL_DEFAULT_OPTIONS: {
35
+ style: {
36
+ fontSize: string;
37
+ fontFamily: string;
38
+ fontWeight: string;
39
+ };
40
+ color: string;
41
+ };
42
+ export let SUBOPTIONS_FONT_SIZE_VALUES: {
43
+ label: number;
44
+ value: number;
45
+ }[];
46
+ export let DEFAULT_CATEGORY_CLASS: string;
47
+ export let createToggle: (valueName: string, label: string, defaultValue?: boolean, options?: ToggleElementOptions) => SuboptionElement;
48
+ export let createCheckbox: (valueName: string, label: string, defaultValue?: boolean, options?: CheckboxElementOptions) => SuboptionElement;
49
+ export let createInput: (valueName: string, label: string, defaultValue?: string | number | null, options?: InputElementOptions) => SuboptionElement;
50
+ export let createSelect: (valueName: string, label: string, elementOptions: Array<ElementOption> | string[], defaultValue?: string | number, options?: SelectElementOptions) => SuboptionElement;
51
+ export let createRadio: (valueName: string, label: string, elementOptions: Array<ElementOption>, defaultValue?: string, options?: RadioElementOptions) => SuboptionElement;
52
+ export let createColorPicker: (valueName: string, label: string, defaultValue?: string, options?: ColorPickerElementOptions) => SuboptionElement;
53
+ export let createDivider: (label?: string) => SuboptionElement;
54
+ export let createTextarea: (valueName: string, label: string, defaultValue?: string, options?: TextareaElementOptions) => SuboptionElement;
55
+ export let createTag: (valueName: string, label: string, defaultValue?: Array<string | number>, tagOptions?: TagElementOptions, options?: TagAdditionalOptions) => SuboptionElement;
56
+ export let createFontStylingGroup: (defaults?: FontStylingDefaults) => SuboptionElement[];
57
+ export let createLabelStyleGroup: (defaults?: FontStylingDefaults) => SuboptionElement[];
58
+ export let createTooltipStyleGroup: (defaults?: FontStylingDefaults) => SuboptionElement[];
59
+ export let withLabel: () => SuboptionDefinition;
60
+ export let withLabelPie: () => SuboptionDefinition;
61
+ export let withLabelGauge: (config?: LabelGaugeConfig) => SuboptionDefinition;
62
+ export let withLabelWithPercentage: () => SuboptionDefinition;
63
+ export let withLabelWithPercentagePercentStacked: () => SuboptionDefinition;
64
+ export let withTooltip: () => SuboptionDefinition;
65
+ export let withTooltipPie: () => SuboptionDefinition;
66
+ export let withTooltipGauge: () => SuboptionDefinition;
67
+ export let withAxisY: () => SuboptionDefinition;
68
+ export let withAxisYPercentStacked: () => SuboptionDefinition;
69
+ export let withAxisX: () => SuboptionDefinition;
70
+ export let withTableOptions: () => SuboptionDefinition;
71
+ export let withTableOptionsTranspose: (config?: TableOptionsConfig) => SuboptionDefinition;
72
+ export let withTableOptionsGauge: () => SuboptionDefinition;
73
+ export let withTableDesignOptions: () => SuboptionDefinition;
74
+ export let withChart: () => SuboptionDefinition;
75
+ export let withChartGrid: () => SuboptionDefinition;
76
+ export let withChartForecast: () => SuboptionDefinition;
77
+ export let withChartPosition: () => SuboptionDefinition;
78
+ export let withWidgetLibrary: () => SuboptionDefinition;
79
+ export let withSubtitle: () => SuboptionDefinition;
80
+ export let withName: () => SuboptionDefinition;
81
+ export let withNegativeNumberFormat: () => SuboptionDefinition;
82
+ export let withValue: () => SuboptionDefinition;
83
+ export let withRange: () => SuboptionDefinition;
84
+ export let withTicks: () => SuboptionDefinition;
85
+ export let withLegends: () => SuboptionDefinition;
86
+ export let withDeltaColumn: () => SuboptionDefinition;
87
+ export let withDeltaColumnForDrillDown: () => SuboptionDefinition;
88
+ export let withAdvanced: () => SuboptionDefinition;
89
+ export let withTotalValueLabelDonut: () => SuboptionDefinition;
90
+ export let withGaugeGoal: () => SuboptionDefinition;
91
+ export let withGaugeSegments: (config?: GaugeSegmentsConfig) => SuboptionDefinition;
92
+ export let withGaugeIsAbsolute: () => SuboptionDefinition;
93
+ export let createSuboption: (categoryType: string, categoryLabel: string, elements: import("./elements").SuboptionElement[], options?: Object) => SuboptionDefinition;
94
+ export let LABEL_DISABLED_CONDITION: {
95
+ disabled_str: string;
96
+ disabled_fn: (arg0: builders.LabelOptions) => boolean;
97
+ };
98
+ export let LABEL_PIE_DISABLED_CONDITION: {
99
+ disabled_str: string;
100
+ disabled_fn: (arg0: builders.LabelPieOptions) => boolean;
101
+ };
102
+ export let TOOLTIP_DISABLED_CONDITION: {
103
+ disabled_str: string;
104
+ disabled_fn: (arg0: builders.TooltipOptions) => boolean;
105
+ };
106
+ export let TOOLTIP_PIE_DISABLED_CONDITION: {
107
+ disabled_str: string;
108
+ disabled_fn: (arg0: builders.TooltipPieOptions) => boolean;
109
+ };
110
+ export let LABEL_SHOW_TOGGLE: elements.SuboptionElement;
111
+ export let LABEL_PIE_SHOW_TOGGLE: elements.SuboptionElement;
112
+ export let LABEL_OVERLAP_TOGGLE: elements.SuboptionElement;
113
+ export let TOOLTIP_SHOW_TOGGLE: elements.SuboptionElement;
114
+ export let TOOLTIP_PIE_SHOW_TOGGLE: elements.SuboptionElement;
115
+ export let GAUGE_SHOW_TOGGLE: elements.SuboptionElement;
116
+ export let CHART_TYPES: constants.ChartTypesMap;
117
+ export let CHART_PRESETS: Record<constants.ChartTypeValue, presets.BuilderFunction[]>;
118
+ export let BUILDER_KEY_MAP: Map<presets.BuilderFunction, presets.SuboptionKey>;
119
+ export let getBuilderKey: (builder: BuilderFunction) => SuboptionKey | undefined;
120
+ export let getPresetForChart: (chartType: import("./constants").ChartTypeValue) => BuilderFunction[] | undefined;
121
+ export let buildSuboptionsForChart: (chartType: string, config?: BuilderConfig) => Record<string, import("./builders").SuboptionDefinition>;
122
+ export let buildSuboptions: (builders: BuilderFunction[], config?: BuilderConfig) => Record<string, import("./builders").SuboptionDefinition>;
123
+ export let getChartTypes: () => import("./constants").ChartTypeValue[];
124
+ export let hasPreset: (chartType: string) => boolean;
125
+ export let chartHasVerticalDataLabelsOption: (type: string) => boolean;
126
+ export { createDefaultSuboptions };
127
+ }
128
+ export = _exports;
129
+ /**
130
+ * Feature flag checker callback.
131
+ */
132
+ type FeatureChecker = (featureName: string) => boolean;
133
+ /**
134
+ * Configuration for createDefaultSuboptions.
135
+ */
136
+ type CreateDefaultSuboptionsConfig = {
137
+ /**
138
+ * - Chart types enum (for table options)
139
+ */
140
+ CHART_TYPES?: constants.ChartTypesMap | undefined;
141
+ /**
142
+ * - Feature flag checker function
143
+ */
144
+ hasFeature?: FeatureChecker | undefined;
145
+ /**
146
+ * - Feature flag name for gauge dynamic goal
147
+ */
148
+ ENABLE_GAUGE_DYNAMIC_GOAL?: string | undefined;
149
+ /**
150
+ * - Default gauge segments array
151
+ */
152
+ defaultGaugeSegments?: builders.GaugeSegment[] | undefined;
153
+ };
154
+ import constants = require("./constants");
155
+ import elements = require("./elements");
156
+ import builders = require("./builders");
157
+ import presets = require("./presets");
158
+ /**
159
+ * Feature flag checker callback.
160
+ * @callback FeatureChecker
161
+ * @param {string} featureName - The feature flag name to check
162
+ * @returns {boolean} Whether the feature is enabled
163
+ */
164
+ /**
165
+ * Configuration for createDefaultSuboptions.
166
+ * @typedef {Object} CreateDefaultSuboptionsConfig
167
+ * @property {import('./constants').ChartTypesMap} [CHART_TYPES] - Chart types enum (for table options)
168
+ * @property {FeatureChecker} [hasFeature] - Feature flag checker function
169
+ * @property {string} [ENABLE_GAUGE_DYNAMIC_GOAL] - Feature flag name for gauge dynamic goal
170
+ * @property {import('./builders').GaugeSegment[]} [defaultGaugeSegments] - Default gauge segments array
171
+ */
172
+ /**
173
+ * Creates the default suboptions object for highchartsRenderer.
174
+ * This generates the complete suboptions object with all chart options.
175
+ * @param {CreateDefaultSuboptionsConfig} [config={}] - Configuration options
176
+ * @returns {Record<string, import('./builders').SuboptionDefinition>} Complete suboptions object
177
+ */
178
+ declare function createDefaultSuboptions(config?: CreateDefaultSuboptionsConfig): Record<string, import("./builders").SuboptionDefinition>;
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Suboption key string literal.
3
+ */
4
+ export type SuboptionKey = "label" | "label_pie" | "label_gauge" | "label_with_percentage" | "label_with_percentage_percent_stacked" | "tooltips" | "tooltips_pie" | "tooltips_gauge" | "axisY" | "axisY_percent_stacked" | "axisX" | "table_options" | "table_options_transpose" | "table_options_gauge" | "table_design_options" | "chart" | "chart_grid" | "chart_forecast" | "chart_position" | "widget_library" | "subtitle" | "name" | "negative_number_format" | "value" | "range" | "legends" | "delta_column" | "delta_column_for_drill_down" | "advanced" | "total_value_label_donut" | "gauge_goal" | "gauge_segments" | "gauge_is_absolute" | "ticks";
5
+ /**
6
+ * Builder configuration options passed to builder functions.
7
+ */
8
+ export type BuilderConfig = {
9
+ /**
10
+ * - Chart types enum
11
+ */
12
+ CHART_TYPES?: import("./constants").ChartTypesMap | undefined;
13
+ /**
14
+ * - Feature flag checker
15
+ */
16
+ hasFeature?: ((featureName: string) => boolean) | undefined;
17
+ /**
18
+ * - Feature flag name
19
+ */
20
+ ENABLE_GAUGE_DYNAMIC_GOAL?: string | undefined;
21
+ /**
22
+ * - Default gauge segments
23
+ */
24
+ defaultSegments?: import("./builders").GaugeSegment[] | undefined;
25
+ };
26
+ /**
27
+ * Builder function type.
28
+ */
29
+ export type BuilderFunction = (config?: BuilderConfig | undefined) => import("./builders").SuboptionDefinition;
30
+ import { CHART_TYPES } from "./constants";
31
+ /**
32
+ * Chart presets mapping chart types to their suboption builders.
33
+ * Each preset defines which builders are used for that chart type.
34
+ * @type {Record<import('./constants').ChartTypeValue, BuilderFunction[]>}
35
+ */
36
+ export const CHART_PRESETS: Record<import("./constants").ChartTypeValue, BuilderFunction[]>;
37
+ /**
38
+ * Suboption key string literal.
39
+ * @typedef {'label'|'label_pie'|'label_gauge'|'label_with_percentage'|'label_with_percentage_percent_stacked'|'tooltips'|'tooltips_pie'|'tooltips_gauge'|'axisY'|'axisY_percent_stacked'|'axisX'|'table_options'|'table_options_transpose'|'table_options_gauge'|'table_design_options'|'chart'|'chart_grid'|'chart_forecast'|'chart_position'|'widget_library'|'subtitle'|'name'|'negative_number_format'|'value'|'range'|'legends'|'delta_column'|'delta_column_for_drill_down'|'advanced'|'total_value_label_donut'|'gauge_goal'|'gauge_segments'|'gauge_is_absolute'|'ticks'} SuboptionKey
40
+ */
41
+ /**
42
+ * Maps builder functions to their suboption keys.
43
+ * Used to build the suboptions object with correct keys.
44
+ * @type {Map<BuilderFunction, SuboptionKey>}
45
+ */
46
+ export const BUILDER_KEY_MAP: Map<BuilderFunction, SuboptionKey>;
47
+ /**
48
+ * Gets the suboption key for a builder function.
49
+ * @param {BuilderFunction} builder - The builder function
50
+ * @returns {SuboptionKey|undefined} The suboption key
51
+ */
52
+ export function getBuilderKey(builder: BuilderFunction): SuboptionKey | undefined;
53
+ /**
54
+ * Gets the preset configuration for a chart type.
55
+ * @param {import('./constants').ChartTypeValue} chartType - The chart type identifier
56
+ * @returns {BuilderFunction[]|undefined} Array of builder functions or undefined if not found
57
+ */
58
+ export function getPresetForChart(chartType: import("./constants").ChartTypeValue): BuilderFunction[] | undefined;
59
+ /**
60
+ * Builder configuration options passed to builder functions.
61
+ * @typedef {Object} BuilderConfig
62
+ * @property {import('./constants').ChartTypesMap} [CHART_TYPES] - Chart types enum
63
+ * @property {(featureName: string) => boolean} [hasFeature] - Feature flag checker
64
+ * @property {string} [ENABLE_GAUGE_DYNAMIC_GOAL] - Feature flag name
65
+ * @property {import('./builders').GaugeSegment[]} [defaultSegments] - Default gauge segments
66
+ */
67
+ /**
68
+ * Builder function type.
69
+ * @callback BuilderFunction
70
+ * @param {BuilderConfig} [config] - Configuration options
71
+ * @returns {import('./builders').SuboptionDefinition} The suboption definition
72
+ */
73
+ /**
74
+ * Builds the suboptions object for a chart type using its preset.
75
+ * @param {string} chartType - The chart type identifier
76
+ * @param {BuilderConfig} [config={}] - Configuration to pass to builders
77
+ * @returns {Record<string, import('./builders').SuboptionDefinition>} The suboptions object
78
+ */
79
+ export function buildSuboptionsForChart(chartType: string, config?: BuilderConfig): Record<string, import("./builders").SuboptionDefinition>;
80
+ /**
81
+ * Builds a complete suboptions object from an array of builders.
82
+ * @param {BuilderFunction[]} builders - Array of builder functions
83
+ * @param {BuilderConfig} [config={}] - Configuration to pass to builders
84
+ * @returns {Record<string, import('./builders').SuboptionDefinition>} The suboptions object
85
+ */
86
+ export function buildSuboptions(builders: BuilderFunction[], config?: BuilderConfig): Record<string, import("./builders").SuboptionDefinition>;
87
+ /**
88
+ * Gets all available chart types.
89
+ * @returns {import('./constants').ChartTypeValue[]} Array of chart type identifiers
90
+ */
91
+ export function getChartTypes(): import("./constants").ChartTypeValue[];
92
+ /**
93
+ * Checks if a chart type has a preset defined.
94
+ * @param {string} chartType - The chart type identifier
95
+ * @returns {boolean} True if preset exists
96
+ */
97
+ export function hasPreset(chartType: string): boolean;
98
+ export { CHART_TYPES };