@datarailsshared/dr_renderer 1.5.105 → 1.5.114
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/package.json +13 -2
- package/src/graph-table-renderer.js +1 -1
- package/src/highcharts_renderer.js +467 -1650
- package/src/index.d.ts +8 -0
- package/src/index.js +8 -0
- package/src/options/builders.js +933 -0
- package/src/options/constants.js +268 -0
- package/src/options/elements.js +377 -0
- package/src/options/helpers.js +34 -0
- package/src/options/index.js +215 -0
- package/src/options/presets.js +388 -0
- package/src/types/graph-table-renderer.d.ts +2 -2
- package/src/types/index.d.ts +11 -1
- package/src/types/options/builders.d.ts +615 -0
- package/src/types/options/constants.d.ts +235 -0
- package/src/types/options/elements.d.ts +456 -0
- package/src/types/options/helpers.d.ts +7 -0
- package/src/types/options/index.d.ts +178 -0
- package/src/types/options/presets.d.ts +98 -0
- package/tests/__snapshots__/suboptions.test.js.snap +5017 -0
- package/tests/options-builder.test.js +1710 -0
- package/tests/suboptions.test.js +322 -0
- package/tsconfig.json +12 -2
- package/tsconfig.tsbuildinfo +1 -7
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default settings for tooltip styling.
|
|
3
|
+
*/
|
|
4
|
+
export type TooltipDefaultSettings = {
|
|
5
|
+
/**
|
|
6
|
+
* - Default tooltip font color
|
|
7
|
+
*/
|
|
8
|
+
FONT_COLOR: string;
|
|
9
|
+
/**
|
|
10
|
+
* - Default tooltip font size
|
|
11
|
+
*/
|
|
12
|
+
FONT_SIZE: string;
|
|
13
|
+
/**
|
|
14
|
+
* - Default tooltip font family
|
|
15
|
+
*/
|
|
16
|
+
FONT_FAMILY: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Default settings for label styling.
|
|
20
|
+
*/
|
|
21
|
+
export type LabelDefaultSettings = {
|
|
22
|
+
/**
|
|
23
|
+
* - Default label font color
|
|
24
|
+
*/
|
|
25
|
+
FONT_COLOR: string;
|
|
26
|
+
/**
|
|
27
|
+
* - Default label font size
|
|
28
|
+
*/
|
|
29
|
+
FONT_SIZE: string;
|
|
30
|
+
/**
|
|
31
|
+
* - Default label font family
|
|
32
|
+
*/
|
|
33
|
+
FONT_FAMILY: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Chart type string literal union.
|
|
37
|
+
*/
|
|
38
|
+
export type ChartTypeValue = "line-chart" | "line-chart-smooth" | "line-chart-forecast" | "column-chart" | "column-chart-stacked" | "column-chart-stacked-percent" | "combo-chart" | "combo-column-chart" | "combo-stacked-chart" | "bar-chart" | "bar-chart-stacked" | "bar-chart-stacked-percent" | "scatter-chart" | "area-chart" | "area-chart-smooth" | "table_only" | "polygon-chart" | "pie-chart" | "pie-chart-drilldown" | "gauge-solid-chart" | "gauge-chart" | "gauge-chart-enhanced" | "gauge-chart-dynamic-goal" | "gauge-chart-categories-summary" | "kpi-widget" | "smart-kpi" | "text-widget" | "waterfall-chart-breakdown" | "waterfall-chart-walkthrough" | "published_item" | "rich_text" | "excel_viewer" | "donut-chart";
|
|
39
|
+
/**
|
|
40
|
+
* Chart types object type.
|
|
41
|
+
*/
|
|
42
|
+
export type ChartTypesMap = {
|
|
43
|
+
LINE_CHART: "line-chart";
|
|
44
|
+
LINE_CHART_SMOOTH: "line-chart-smooth";
|
|
45
|
+
LINE_CHART_FORECAST: "line-chart-forecast";
|
|
46
|
+
COLUMN_CHART: "column-chart";
|
|
47
|
+
COLUMN_CHART_STACKED: "column-chart-stacked";
|
|
48
|
+
COLUMN_CHART_STACKED_PERCENT: "column-chart-stacked-percent";
|
|
49
|
+
COMBO_CHART: "combo-chart";
|
|
50
|
+
COMBO_COLUMN_CHART: "combo-column-chart";
|
|
51
|
+
COMBO_STACKED_CHART: "combo-stacked-chart";
|
|
52
|
+
BAR_CHART: "bar-chart";
|
|
53
|
+
BAR_CHART_STACKED: "bar-chart-stacked";
|
|
54
|
+
BAR_CHART_STACKED_PERCENT: "bar-chart-stacked-percent";
|
|
55
|
+
SCATTER_CHART: "scatter-chart";
|
|
56
|
+
AREA_CHART: "area-chart";
|
|
57
|
+
AREA_CHART_SMOOTH: "area-chart-smooth";
|
|
58
|
+
TABLE_ONLY: "table_only";
|
|
59
|
+
POLYGON_CHART: "polygon-chart";
|
|
60
|
+
PIE_CHART: "pie-chart";
|
|
61
|
+
PIE_CHART_DRILLDOWN: "pie-chart-drilldown";
|
|
62
|
+
GAUGE_SOLID_CHART: "gauge-solid-chart";
|
|
63
|
+
GAUGE_CHART: "gauge-chart";
|
|
64
|
+
GAUGE_CHART_ENHANCED: "gauge-chart-enhanced";
|
|
65
|
+
GAUGE_CHART_DYNAMIC_GOAL: "gauge-chart-dynamic-goal";
|
|
66
|
+
GAUGE_CHART_CATEGORIES_SUMMARY: "gauge-chart-categories-summary";
|
|
67
|
+
KPI_WIDGET: "kpi-widget";
|
|
68
|
+
SMART_KPI: "smart-kpi";
|
|
69
|
+
TEXT_WIDGET: "text-widget";
|
|
70
|
+
WATERFALL_BREAKDOWN: "waterfall-chart-breakdown";
|
|
71
|
+
WATERFALL_WALKTHROUGH: "waterfall-chart-walkthrough";
|
|
72
|
+
PUBLISHED_ITEM: "published_item";
|
|
73
|
+
RICH_TEXT: "rich_text";
|
|
74
|
+
EXCEL_VIEWER: "excel_viewer";
|
|
75
|
+
DONUT_CHART: "donut-chart";
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Chart color palette for various UI elements.
|
|
79
|
+
*/
|
|
80
|
+
export type CHART_COLORS = string;
|
|
81
|
+
export namespace CHART_COLORS {
|
|
82
|
+
let BACKGROUND: string;
|
|
83
|
+
let TEXT: string;
|
|
84
|
+
let LABEL: string;
|
|
85
|
+
let LABEL_SECOND: string;
|
|
86
|
+
let DRILL_UP_FILL: string;
|
|
87
|
+
let DRILL_BUTTON_COLOR_FILL: string;
|
|
88
|
+
let DRILL_BUTTON_COLOR: string;
|
|
89
|
+
let DRILL_BUTTON_COLOR_HOVER: string;
|
|
90
|
+
let PLOT_BORDER: string;
|
|
91
|
+
let MINOR_GRID_LINE: string;
|
|
92
|
+
let TICK_COLOR: string;
|
|
93
|
+
let LABELS_OLD: string;
|
|
94
|
+
let DATA_LABELS: string;
|
|
95
|
+
let CONTRAST_TEXT: string;
|
|
96
|
+
let LEGEND_BACKGROUND: string;
|
|
97
|
+
let MASK: string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Chart type string literal union.
|
|
101
|
+
* @typedef {'line-chart'|'line-chart-smooth'|'line-chart-forecast'|'column-chart'|'column-chart-stacked'|'column-chart-stacked-percent'|'combo-chart'|'combo-column-chart'|'combo-stacked-chart'|'bar-chart'|'bar-chart-stacked'|'bar-chart-stacked-percent'|'scatter-chart'|'area-chart'|'area-chart-smooth'|'table_only'|'polygon-chart'|'pie-chart'|'pie-chart-drilldown'|'gauge-solid-chart'|'gauge-chart'|'gauge-chart-enhanced'|'gauge-chart-dynamic-goal'|'gauge-chart-categories-summary'|'kpi-widget'|'smart-kpi'|'text-widget'|'waterfall-chart-breakdown'|'waterfall-chart-walkthrough'|'published_item'|'rich_text'|'excel_viewer'|'donut-chart'} ChartTypeValue
|
|
102
|
+
*/
|
|
103
|
+
/**
|
|
104
|
+
* Chart types object type.
|
|
105
|
+
* @typedef {Object} ChartTypesMap
|
|
106
|
+
* @property {'line-chart'} LINE_CHART
|
|
107
|
+
* @property {'line-chart-smooth'} LINE_CHART_SMOOTH
|
|
108
|
+
* @property {'line-chart-forecast'} LINE_CHART_FORECAST
|
|
109
|
+
* @property {'column-chart'} COLUMN_CHART
|
|
110
|
+
* @property {'column-chart-stacked'} COLUMN_CHART_STACKED
|
|
111
|
+
* @property {'column-chart-stacked-percent'} COLUMN_CHART_STACKED_PERCENT
|
|
112
|
+
* @property {'combo-chart'} COMBO_CHART
|
|
113
|
+
* @property {'combo-column-chart'} COMBO_COLUMN_CHART
|
|
114
|
+
* @property {'combo-stacked-chart'} COMBO_STACKED_CHART
|
|
115
|
+
* @property {'bar-chart'} BAR_CHART
|
|
116
|
+
* @property {'bar-chart-stacked'} BAR_CHART_STACKED
|
|
117
|
+
* @property {'bar-chart-stacked-percent'} BAR_CHART_STACKED_PERCENT
|
|
118
|
+
* @property {'scatter-chart'} SCATTER_CHART
|
|
119
|
+
* @property {'area-chart'} AREA_CHART
|
|
120
|
+
* @property {'area-chart-smooth'} AREA_CHART_SMOOTH
|
|
121
|
+
* @property {'table_only'} TABLE_ONLY
|
|
122
|
+
* @property {'polygon-chart'} POLYGON_CHART
|
|
123
|
+
* @property {'pie-chart'} PIE_CHART
|
|
124
|
+
* @property {'pie-chart-drilldown'} PIE_CHART_DRILLDOWN
|
|
125
|
+
* @property {'gauge-solid-chart'} GAUGE_SOLID_CHART
|
|
126
|
+
* @property {'gauge-chart'} GAUGE_CHART
|
|
127
|
+
* @property {'gauge-chart-enhanced'} GAUGE_CHART_ENHANCED
|
|
128
|
+
* @property {'gauge-chart-dynamic-goal'} GAUGE_CHART_DYNAMIC_GOAL
|
|
129
|
+
* @property {'gauge-chart-categories-summary'} GAUGE_CHART_CATEGORIES_SUMMARY
|
|
130
|
+
* @property {'kpi-widget'} KPI_WIDGET
|
|
131
|
+
* @property {'smart-kpi'} SMART_KPI
|
|
132
|
+
* @property {'text-widget'} TEXT_WIDGET
|
|
133
|
+
* @property {'waterfall-chart-breakdown'} WATERFALL_BREAKDOWN
|
|
134
|
+
* @property {'waterfall-chart-walkthrough'} WATERFALL_WALKTHROUGH
|
|
135
|
+
* @property {'published_item'} PUBLISHED_ITEM
|
|
136
|
+
* @property {'rich_text'} RICH_TEXT
|
|
137
|
+
* @property {'excel_viewer'} EXCEL_VIEWER
|
|
138
|
+
* @property {'donut-chart'} DONUT_CHART
|
|
139
|
+
*/
|
|
140
|
+
/**
|
|
141
|
+
* Chart type identifiers.
|
|
142
|
+
* @type {ChartTypesMap}
|
|
143
|
+
*/
|
|
144
|
+
export const CHART_TYPES: ChartTypesMap;
|
|
145
|
+
/**
|
|
146
|
+
* Available font families for chart suboptions.
|
|
147
|
+
* @type {string[]}
|
|
148
|
+
*/
|
|
149
|
+
export const SUBOPTIONS_FONTS: string[];
|
|
150
|
+
/**
|
|
151
|
+
* Default font family for Highcharts elements.
|
|
152
|
+
* @type {string}
|
|
153
|
+
*/
|
|
154
|
+
export const HIGHCHARTS_FONT_FAMILY: string;
|
|
155
|
+
/**
|
|
156
|
+
* Default font family CSS value with fallback.
|
|
157
|
+
* @type {string}
|
|
158
|
+
*/
|
|
159
|
+
export const HIGHCHARTS_FONT_FAMILY_CSS: string;
|
|
160
|
+
/**
|
|
161
|
+
* Default settings for tooltip styling.
|
|
162
|
+
* @typedef {Object} TooltipDefaultSettings
|
|
163
|
+
* @property {string} FONT_COLOR - Default tooltip font color
|
|
164
|
+
* @property {string} FONT_SIZE - Default tooltip font size
|
|
165
|
+
* @property {string} FONT_FAMILY - Default tooltip font family
|
|
166
|
+
*/
|
|
167
|
+
/**
|
|
168
|
+
* @type {TooltipDefaultSettings}
|
|
169
|
+
*/
|
|
170
|
+
export const TOOLTIP_DEFAULT_SETTINGS: TooltipDefaultSettings;
|
|
171
|
+
/**
|
|
172
|
+
* Default tooltip options for Highcharts.
|
|
173
|
+
* @type {{ borderColor: string, shadow: Object, style: Object, enabled: boolean }}
|
|
174
|
+
*/
|
|
175
|
+
export const TOOLTIP_DEFAULT_OPTIONS: {
|
|
176
|
+
borderColor: string;
|
|
177
|
+
shadow: Object;
|
|
178
|
+
style: Object;
|
|
179
|
+
enabled: boolean;
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Default settings for label styling.
|
|
183
|
+
* @typedef {Object} LabelDefaultSettings
|
|
184
|
+
* @property {string} FONT_COLOR - Default label font color
|
|
185
|
+
* @property {string} FONT_SIZE - Default label font size
|
|
186
|
+
* @property {string} FONT_FAMILY - Default label font family
|
|
187
|
+
*/
|
|
188
|
+
/**
|
|
189
|
+
* @type {LabelDefaultSettings}
|
|
190
|
+
*/
|
|
191
|
+
export const LABEL_DEFAULT_SETTINGS: LabelDefaultSettings;
|
|
192
|
+
/**
|
|
193
|
+
* Default label options for Highcharts data labels.
|
|
194
|
+
* @type {{ style: { fontSize: string, fontFamily: string, fontWeight: string }, color: string }}
|
|
195
|
+
*/
|
|
196
|
+
export const LABEL_DEFAULT_OPTIONS: {
|
|
197
|
+
style: {
|
|
198
|
+
fontSize: string;
|
|
199
|
+
fontFamily: string;
|
|
200
|
+
fontWeight: string;
|
|
201
|
+
};
|
|
202
|
+
color: string;
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* Default label for chart axis.
|
|
206
|
+
* @type {string}
|
|
207
|
+
*/
|
|
208
|
+
export const CHART_AXIS_DEFAULT_LABEL: string;
|
|
209
|
+
/**
|
|
210
|
+
* Default label for chart legend.
|
|
211
|
+
* @type {string}
|
|
212
|
+
*/
|
|
213
|
+
export const CHART_LEGEND_DEFAULT_LABEL: string;
|
|
214
|
+
/**
|
|
215
|
+
* Pre-generated font size options for suboptions select elements.
|
|
216
|
+
* @type {Array<{label: number, value: number}>}
|
|
217
|
+
*/
|
|
218
|
+
export const SUBOPTIONS_FONT_SIZE_VALUES: Array<{
|
|
219
|
+
label: number;
|
|
220
|
+
value: number;
|
|
221
|
+
}>;
|
|
222
|
+
/**
|
|
223
|
+
* Default CSS class for suboption categories.
|
|
224
|
+
* @type {string}
|
|
225
|
+
*/
|
|
226
|
+
export const DEFAULT_CATEGORY_CLASS: string;
|
|
227
|
+
/**
|
|
228
|
+
* Generates font size options for select elements.
|
|
229
|
+
* Creates options from 6 to 24 (inclusive).
|
|
230
|
+
* @returns {Array<{label: number, value: number}>} Array of font size options
|
|
231
|
+
*/
|
|
232
|
+
export function generateFontSizeOptions(): Array<{
|
|
233
|
+
label: number;
|
|
234
|
+
value: number;
|
|
235
|
+
}>;
|
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Element type literals for suboption elements.
|
|
3
|
+
*/
|
|
4
|
+
export type ElementType = "toggle" | "checkbox" | "input" | "select" | "radio" | "color_picker" | "devider" | "textarea" | "tag" | "text";
|
|
5
|
+
/**
|
|
6
|
+
* Option item for select/radio elements.
|
|
7
|
+
*/
|
|
8
|
+
export type ElementOption = {
|
|
9
|
+
/**
|
|
10
|
+
* - Display label
|
|
11
|
+
*/
|
|
12
|
+
label: string | number;
|
|
13
|
+
/**
|
|
14
|
+
* - Option value
|
|
15
|
+
*/
|
|
16
|
+
value: string | number;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Tag element options configuration.
|
|
20
|
+
*/
|
|
21
|
+
export type TagElementOptions = {
|
|
22
|
+
/**
|
|
23
|
+
* - Whether new tags can be added
|
|
24
|
+
*/
|
|
25
|
+
add_new_tag?: boolean | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* - Whether tags are searchable
|
|
28
|
+
*/
|
|
29
|
+
searchable?: boolean | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* - Whether multiple tags can be selected
|
|
32
|
+
*/
|
|
33
|
+
multiple?: boolean | undefined;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Callback function that receives chart type and returns boolean.
|
|
37
|
+
*/
|
|
38
|
+
export type ShowConditionCallback = (chartType: string) => boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Callback function for handling value changes.
|
|
41
|
+
*/
|
|
42
|
+
export type ValueChangeCallback = (value: Record<string, unknown>) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Callback function for disabled state.
|
|
45
|
+
*/
|
|
46
|
+
export type DisabledConditionCallback = (value: Record<string, unknown>) => boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Suboption element definition.
|
|
49
|
+
*/
|
|
50
|
+
export type SuboptionElement = {
|
|
51
|
+
/**
|
|
52
|
+
* - Type of the UI element
|
|
53
|
+
*/
|
|
54
|
+
element_type: ElementType;
|
|
55
|
+
/**
|
|
56
|
+
* - Display label for the element
|
|
57
|
+
*/
|
|
58
|
+
element_label?: string | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* - Property name in the options object
|
|
61
|
+
*/
|
|
62
|
+
value_name?: string | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* - Default value for the element
|
|
65
|
+
*/
|
|
66
|
+
default_value?: string | number | boolean | unknown[] | null | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* - Options for select/radio/tag elements
|
|
69
|
+
*/
|
|
70
|
+
element_options?: string[] | ElementOption[] | TagElementOptions | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* - Function to determine if element should be shown
|
|
73
|
+
*/
|
|
74
|
+
showFn?: ShowConditionCallback | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* - Click handler function
|
|
77
|
+
*/
|
|
78
|
+
clickFn?: ValueChangeCallback | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* - Change handler function
|
|
81
|
+
*/
|
|
82
|
+
onChange?: ValueChangeCallback | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* - String expression for disabled state
|
|
85
|
+
*/
|
|
86
|
+
disabled_str?: string | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* - Function to determine disabled state
|
|
89
|
+
*/
|
|
90
|
+
disabled_fn?: DisabledConditionCallback | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* - Whether element is hidden
|
|
93
|
+
*/
|
|
94
|
+
hidden?: boolean | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* - Whether to show element in one row
|
|
97
|
+
*/
|
|
98
|
+
show_in_one_row?: boolean | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* - Tooltip text for the label
|
|
101
|
+
*/
|
|
102
|
+
label_tooltip?: string | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* - Subtitle for the element
|
|
105
|
+
*/
|
|
106
|
+
element_sub_title?: string | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* - Value type for input elements
|
|
109
|
+
*/
|
|
110
|
+
value_type?: "string" | "number" | undefined;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Toggle element options.
|
|
114
|
+
*/
|
|
115
|
+
export type ToggleElementOptions = {
|
|
116
|
+
/**
|
|
117
|
+
* - Disabled state expression
|
|
118
|
+
*/
|
|
119
|
+
disabled_str?: string | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* - Disabled state function
|
|
122
|
+
*/
|
|
123
|
+
disabled_fn?: DisabledConditionCallback | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* - Show condition function
|
|
126
|
+
*/
|
|
127
|
+
showFn?: ShowConditionCallback | undefined;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Checkbox element options.
|
|
131
|
+
*/
|
|
132
|
+
export type CheckboxElementOptions = {
|
|
133
|
+
/**
|
|
134
|
+
* - Click handler
|
|
135
|
+
*/
|
|
136
|
+
clickFn?: ValueChangeCallback | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* - Show condition function
|
|
139
|
+
*/
|
|
140
|
+
showFn?: ShowConditionCallback | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* - Disabled state function
|
|
143
|
+
*/
|
|
144
|
+
disabled_fn?: DisabledConditionCallback | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* - Whether element is hidden
|
|
147
|
+
*/
|
|
148
|
+
hidden?: boolean | undefined;
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Input element options.
|
|
152
|
+
*/
|
|
153
|
+
export type InputElementOptions = {
|
|
154
|
+
/**
|
|
155
|
+
* - Change handler
|
|
156
|
+
*/
|
|
157
|
+
onChange?: ValueChangeCallback | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* - Tooltip text
|
|
160
|
+
*/
|
|
161
|
+
label_tooltip?: string | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* - Show in one row
|
|
164
|
+
*/
|
|
165
|
+
show_in_one_row?: boolean | undefined;
|
|
166
|
+
/**
|
|
167
|
+
* - Show condition function
|
|
168
|
+
*/
|
|
169
|
+
showFn?: ShowConditionCallback | undefined;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Select element additional options.
|
|
173
|
+
*/
|
|
174
|
+
export type SelectElementOptions = {
|
|
175
|
+
/**
|
|
176
|
+
* - Show condition function
|
|
177
|
+
*/
|
|
178
|
+
showFn?: ShowConditionCallback | undefined;
|
|
179
|
+
/**
|
|
180
|
+
* - Disabled state function
|
|
181
|
+
*/
|
|
182
|
+
disabled_fn?: DisabledConditionCallback | undefined;
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Radio element additional options.
|
|
186
|
+
*/
|
|
187
|
+
export type RadioElementOptions = {
|
|
188
|
+
/**
|
|
189
|
+
* - Subtitle for the element
|
|
190
|
+
*/
|
|
191
|
+
element_sub_title?: string | undefined;
|
|
192
|
+
/**
|
|
193
|
+
* - Show condition function
|
|
194
|
+
*/
|
|
195
|
+
showFn?: ShowConditionCallback | undefined;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Color picker element additional options.
|
|
199
|
+
*/
|
|
200
|
+
export type ColorPickerElementOptions = {
|
|
201
|
+
/**
|
|
202
|
+
* - Show condition function
|
|
203
|
+
*/
|
|
204
|
+
showFn?: ShowConditionCallback | undefined;
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* Textarea element additional options.
|
|
208
|
+
*/
|
|
209
|
+
export type TextareaElementOptions = {
|
|
210
|
+
/**
|
|
211
|
+
* - Show condition function
|
|
212
|
+
*/
|
|
213
|
+
showFn?: ShowConditionCallback | undefined;
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Tag element additional options.
|
|
217
|
+
*/
|
|
218
|
+
export type TagAdditionalOptions = {
|
|
219
|
+
/**
|
|
220
|
+
* - Show condition function
|
|
221
|
+
*/
|
|
222
|
+
showFn?: ShowConditionCallback | undefined;
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* Font styling default values.
|
|
226
|
+
*/
|
|
227
|
+
export type FontStylingDefaults = {
|
|
228
|
+
/**
|
|
229
|
+
* - Default font style
|
|
230
|
+
*/
|
|
231
|
+
fontStyle?: string | undefined;
|
|
232
|
+
/**
|
|
233
|
+
* - Default font size
|
|
234
|
+
*/
|
|
235
|
+
fontSize?: string | number | undefined;
|
|
236
|
+
/**
|
|
237
|
+
* - Default font color
|
|
238
|
+
*/
|
|
239
|
+
fontColor?: string | undefined;
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* @fileoverview UI element factory functions for chart suboptions.
|
|
243
|
+
* Provides reusable factories to create consistent element definitions
|
|
244
|
+
* for the chart options editor UI.
|
|
245
|
+
* @module @datarailsshared/dr_renderer/options/elements
|
|
246
|
+
*/
|
|
247
|
+
/**
|
|
248
|
+
* Element type literals for suboption elements.
|
|
249
|
+
* @typedef {'toggle'|'checkbox'|'input'|'select'|'radio'|'color_picker'|'devider'|'textarea'|'tag'|'text'} ElementType
|
|
250
|
+
*/
|
|
251
|
+
/**
|
|
252
|
+
* Option item for select/radio elements.
|
|
253
|
+
* @typedef {Object} ElementOption
|
|
254
|
+
* @property {string|number} label - Display label
|
|
255
|
+
* @property {string|number} value - Option value
|
|
256
|
+
*/
|
|
257
|
+
/**
|
|
258
|
+
* Tag element options configuration.
|
|
259
|
+
* @typedef {Object} TagElementOptions
|
|
260
|
+
* @property {boolean} [add_new_tag] - Whether new tags can be added
|
|
261
|
+
* @property {boolean} [searchable] - Whether tags are searchable
|
|
262
|
+
* @property {boolean} [multiple] - Whether multiple tags can be selected
|
|
263
|
+
*/
|
|
264
|
+
/**
|
|
265
|
+
* Callback function that receives chart type and returns boolean.
|
|
266
|
+
* @callback ShowConditionCallback
|
|
267
|
+
* @param {string} chartType - The chart type identifier
|
|
268
|
+
* @returns {boolean} Whether to show the element
|
|
269
|
+
*/
|
|
270
|
+
/**
|
|
271
|
+
* Callback function for handling value changes.
|
|
272
|
+
* @callback ValueChangeCallback
|
|
273
|
+
* @param {Record<string, unknown>} value - The current options value object
|
|
274
|
+
* @returns {void}
|
|
275
|
+
*/
|
|
276
|
+
/**
|
|
277
|
+
* Callback function for disabled state.
|
|
278
|
+
* @callback DisabledConditionCallback
|
|
279
|
+
* @param {Record<string, unknown>} value - The current options value object
|
|
280
|
+
* @returns {boolean} Whether the element should be disabled
|
|
281
|
+
*/
|
|
282
|
+
/**
|
|
283
|
+
* Suboption element definition.
|
|
284
|
+
* @typedef {Object} SuboptionElement
|
|
285
|
+
* @property {ElementType} element_type - Type of the UI element
|
|
286
|
+
* @property {string} [element_label] - Display label for the element
|
|
287
|
+
* @property {string} [value_name] - Property name in the options object
|
|
288
|
+
* @property {string|number|boolean|null|Array<unknown>} [default_value] - Default value for the element
|
|
289
|
+
* @property {Array<ElementOption>|TagElementOptions|string[]} [element_options] - Options for select/radio/tag elements
|
|
290
|
+
* @property {ShowConditionCallback} [showFn] - Function to determine if element should be shown
|
|
291
|
+
* @property {ValueChangeCallback} [clickFn] - Click handler function
|
|
292
|
+
* @property {ValueChangeCallback} [onChange] - Change handler function
|
|
293
|
+
* @property {string} [disabled_str] - String expression for disabled state
|
|
294
|
+
* @property {DisabledConditionCallback} [disabled_fn] - Function to determine disabled state
|
|
295
|
+
* @property {boolean} [hidden] - Whether element is hidden
|
|
296
|
+
* @property {boolean} [show_in_one_row] - Whether to show element in one row
|
|
297
|
+
* @property {string} [label_tooltip] - Tooltip text for the label
|
|
298
|
+
* @property {string} [element_sub_title] - Subtitle for the element
|
|
299
|
+
* @property {'number'|'string'} [value_type] - Value type for input elements
|
|
300
|
+
*/
|
|
301
|
+
/**
|
|
302
|
+
* Toggle element options.
|
|
303
|
+
* @typedef {Object} ToggleElementOptions
|
|
304
|
+
* @property {string} [disabled_str] - Disabled state expression
|
|
305
|
+
* @property {DisabledConditionCallback} [disabled_fn] - Disabled state function
|
|
306
|
+
* @property {ShowConditionCallback} [showFn] - Show condition function
|
|
307
|
+
*/
|
|
308
|
+
/**
|
|
309
|
+
* Creates a toggle element.
|
|
310
|
+
* @param {string} valueName - Property name in options
|
|
311
|
+
* @param {string} label - Display label
|
|
312
|
+
* @param {boolean} [defaultValue=false] - Default value
|
|
313
|
+
* @param {ToggleElementOptions} [options={}] - Additional options
|
|
314
|
+
* @returns {SuboptionElement}
|
|
315
|
+
*/
|
|
316
|
+
export function createToggle(valueName: string, label: string, defaultValue?: boolean, options?: ToggleElementOptions): SuboptionElement;
|
|
317
|
+
/**
|
|
318
|
+
* Checkbox element options.
|
|
319
|
+
* @typedef {Object} CheckboxElementOptions
|
|
320
|
+
* @property {ValueChangeCallback} [clickFn] - Click handler
|
|
321
|
+
* @property {ShowConditionCallback} [showFn] - Show condition function
|
|
322
|
+
* @property {DisabledConditionCallback} [disabled_fn] - Disabled state function
|
|
323
|
+
* @property {boolean} [hidden] - Whether element is hidden
|
|
324
|
+
*/
|
|
325
|
+
/**
|
|
326
|
+
* Creates a checkbox element.
|
|
327
|
+
* @param {string} valueName - Property name in options
|
|
328
|
+
* @param {string} label - Display label
|
|
329
|
+
* @param {boolean} [defaultValue=false] - Default value
|
|
330
|
+
* @param {CheckboxElementOptions} [options={}] - Additional options
|
|
331
|
+
* @returns {SuboptionElement}
|
|
332
|
+
*/
|
|
333
|
+
export function createCheckbox(valueName: string, label: string, defaultValue?: boolean, options?: CheckboxElementOptions): SuboptionElement;
|
|
334
|
+
/**
|
|
335
|
+
* Input element options.
|
|
336
|
+
* @typedef {Object} InputElementOptions
|
|
337
|
+
* @property {ValueChangeCallback} [onChange] - Change handler
|
|
338
|
+
* @property {string} [label_tooltip] - Tooltip text
|
|
339
|
+
* @property {boolean} [show_in_one_row] - Show in one row
|
|
340
|
+
* @property {ShowConditionCallback} [showFn] - Show condition function
|
|
341
|
+
*/
|
|
342
|
+
/**
|
|
343
|
+
* Creates an input element.
|
|
344
|
+
* @param {string} valueName - Property name in options
|
|
345
|
+
* @param {string} label - Display label
|
|
346
|
+
* @param {string|number|null} [defaultValue=''] - Default value
|
|
347
|
+
* @param {InputElementOptions} [options={}] - Additional options
|
|
348
|
+
* @returns {SuboptionElement}
|
|
349
|
+
*/
|
|
350
|
+
export function createInput(valueName: string, label: string, defaultValue?: string | number | null, options?: InputElementOptions): SuboptionElement;
|
|
351
|
+
/**
|
|
352
|
+
* Select element additional options.
|
|
353
|
+
* @typedef {Object} SelectElementOptions
|
|
354
|
+
* @property {ShowConditionCallback} [showFn] - Show condition function
|
|
355
|
+
* @property {DisabledConditionCallback} [disabled_fn] - Disabled state function
|
|
356
|
+
*/
|
|
357
|
+
/**
|
|
358
|
+
* Creates a select element.
|
|
359
|
+
* @param {string} valueName - Property name in options
|
|
360
|
+
* @param {string} label - Display label
|
|
361
|
+
* @param {Array<ElementOption>|string[]} elementOptions - Options for the select
|
|
362
|
+
* @param {string|number} [defaultValue] - Default value
|
|
363
|
+
* @param {SelectElementOptions} [options={}] - Additional options
|
|
364
|
+
* @returns {SuboptionElement}
|
|
365
|
+
*/
|
|
366
|
+
export function createSelect(valueName: string, label: string, elementOptions: Array<ElementOption> | string[], defaultValue?: string | number, options?: SelectElementOptions): SuboptionElement;
|
|
367
|
+
/**
|
|
368
|
+
* Radio element additional options.
|
|
369
|
+
* @typedef {Object} RadioElementOptions
|
|
370
|
+
* @property {string} [element_sub_title] - Subtitle for the element
|
|
371
|
+
* @property {ShowConditionCallback} [showFn] - Show condition function
|
|
372
|
+
*/
|
|
373
|
+
/**
|
|
374
|
+
* Creates a radio element.
|
|
375
|
+
* @param {string} valueName - Property name in options
|
|
376
|
+
* @param {string} label - Display label
|
|
377
|
+
* @param {Array<ElementOption>} elementOptions - Options for the radio group
|
|
378
|
+
* @param {string} [defaultValue=''] - Default value
|
|
379
|
+
* @param {RadioElementOptions} [options={}] - Additional options
|
|
380
|
+
* @returns {SuboptionElement}
|
|
381
|
+
*/
|
|
382
|
+
export function createRadio(valueName: string, label: string, elementOptions: Array<ElementOption>, defaultValue?: string, options?: RadioElementOptions): SuboptionElement;
|
|
383
|
+
/**
|
|
384
|
+
* Color picker element additional options.
|
|
385
|
+
* @typedef {Object} ColorPickerElementOptions
|
|
386
|
+
* @property {ShowConditionCallback} [showFn] - Show condition function
|
|
387
|
+
*/
|
|
388
|
+
/**
|
|
389
|
+
* Creates a color picker element.
|
|
390
|
+
* @param {string} valueName - Property name in options
|
|
391
|
+
* @param {string} label - Display label
|
|
392
|
+
* @param {string} [defaultValue=''] - Default color value
|
|
393
|
+
* @param {ColorPickerElementOptions} [options={}] - Additional options
|
|
394
|
+
* @returns {SuboptionElement}
|
|
395
|
+
*/
|
|
396
|
+
export function createColorPicker(valueName: string, label: string, defaultValue?: string, options?: ColorPickerElementOptions): SuboptionElement;
|
|
397
|
+
/**
|
|
398
|
+
* Creates a divider element.
|
|
399
|
+
* @param {string} [label] - Optional section label
|
|
400
|
+
* @returns {SuboptionElement}
|
|
401
|
+
*/
|
|
402
|
+
export function createDivider(label?: string): SuboptionElement;
|
|
403
|
+
/**
|
|
404
|
+
* Textarea element additional options.
|
|
405
|
+
* @typedef {Object} TextareaElementOptions
|
|
406
|
+
* @property {ShowConditionCallback} [showFn] - Show condition function
|
|
407
|
+
*/
|
|
408
|
+
/**
|
|
409
|
+
* Creates a textarea element.
|
|
410
|
+
* @param {string} valueName - Property name in options
|
|
411
|
+
* @param {string} label - Display label
|
|
412
|
+
* @param {string} [defaultValue=''] - Default value
|
|
413
|
+
* @param {TextareaElementOptions} [options={}] - Additional options
|
|
414
|
+
* @returns {SuboptionElement}
|
|
415
|
+
*/
|
|
416
|
+
export function createTextarea(valueName: string, label: string, defaultValue?: string, options?: TextareaElementOptions): SuboptionElement;
|
|
417
|
+
/**
|
|
418
|
+
* Tag element additional options.
|
|
419
|
+
* @typedef {Object} TagAdditionalOptions
|
|
420
|
+
* @property {ShowConditionCallback} [showFn] - Show condition function
|
|
421
|
+
*/
|
|
422
|
+
/**
|
|
423
|
+
* Creates a tag element.
|
|
424
|
+
* @param {string} valueName - Property name in options
|
|
425
|
+
* @param {string} label - Display label
|
|
426
|
+
* @param {Array<string|number>} [defaultValue=[]] - Default value
|
|
427
|
+
* @param {TagElementOptions} [tagOptions={}] - Tag-specific options
|
|
428
|
+
* @param {TagAdditionalOptions} [options={}] - Additional options
|
|
429
|
+
* @returns {SuboptionElement}
|
|
430
|
+
*/
|
|
431
|
+
export function createTag(valueName: string, label: string, defaultValue?: Array<string | number>, tagOptions?: TagElementOptions, options?: TagAdditionalOptions): SuboptionElement;
|
|
432
|
+
/**
|
|
433
|
+
* Font styling default values.
|
|
434
|
+
* @typedef {Object} FontStylingDefaults
|
|
435
|
+
* @property {string} [fontStyle] - Default font style
|
|
436
|
+
* @property {string|number} [fontSize] - Default font size
|
|
437
|
+
* @property {string} [fontColor] - Default font color
|
|
438
|
+
*/
|
|
439
|
+
/**
|
|
440
|
+
* Creates a standard font styling group (font style, size, color).
|
|
441
|
+
* @param {FontStylingDefaults} [defaults={}] - Default values
|
|
442
|
+
* @returns {SuboptionElement[]}
|
|
443
|
+
*/
|
|
444
|
+
export function createFontStylingGroup(defaults?: FontStylingDefaults): SuboptionElement[];
|
|
445
|
+
/**
|
|
446
|
+
* Creates a label font styling group with divider.
|
|
447
|
+
* @param {FontStylingDefaults} [defaults={}] - Default values
|
|
448
|
+
* @returns {SuboptionElement[]}
|
|
449
|
+
*/
|
|
450
|
+
export function createLabelStyleGroup(defaults?: FontStylingDefaults): SuboptionElement[];
|
|
451
|
+
/**
|
|
452
|
+
* Creates a tooltip font styling group with divider.
|
|
453
|
+
* @param {FontStylingDefaults} [defaults={}] - Default values
|
|
454
|
+
* @returns {SuboptionElement[]}
|
|
455
|
+
*/
|
|
456
|
+
export function createTooltipStyleGroup(defaults?: FontStylingDefaults): SuboptionElement[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a chart type supports vertical data labels option.
|
|
3
|
+
* Returns false for chart types that don't support vertical labels.
|
|
4
|
+
* @param {string} type - The chart type identifier
|
|
5
|
+
* @returns {boolean} True if the chart supports vertical data labels
|
|
6
|
+
*/
|
|
7
|
+
export function chartHasVerticalDataLabelsOption(type: string): boolean;
|