@datarailsshared/dr_renderer 1.5.150 → 1.5.159
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 +5 -2
- package/src/charts/dr_donut_chart.d.ts +79 -0
- package/src/charts/dr_donut_chart.js +7 -2
- package/src/charts/dr_gauge_categories_summary_chart.d.ts +136 -0
- package/src/charts/dr_gauge_chart.d.ts +18 -0
- package/src/charts/dr_gauge_chart.js +31 -0
- package/src/dr-renderer-helpers.d.ts +18 -0
- package/src/dr-renderer-helpers.js +2 -2
- package/src/dr_pivottable.d.ts +2 -0
- package/src/dr_pivottable.js +32 -75
- package/src/errors.js +1 -0
- package/src/{types/graph-table-renderer.d.ts → graph-table-renderer.d.ts} +57 -4
- package/src/graph-table-renderer.js +74 -2
- package/src/highcharts_renderer.d.ts +5 -0
- package/src/highcharts_renderer.js +1 -0
- package/src/index.d.ts +83 -86
- package/src/index.js +77 -3
- package/src/novix_renderer.d.ts +2 -0
- package/src/novix_renderer.js +7 -0
- package/src/options/builders.js +1 -0
- package/src/options/constants.js +1 -0
- package/src/options/elements.js +1 -0
- package/src/options/helpers.js +1 -0
- package/src/options/index.js +1 -0
- package/src/options/presets.js +1 -0
- package/src/pivot-table/freeze-panes/constants.d.ts +26 -0
- package/src/pivot-table/freeze-panes/constants.js +42 -0
- package/src/pivot-table/freeze-panes/freeze-panes.css +282 -0
- package/src/pivot-table/freeze-panes/index.d.ts +115 -0
- package/src/pivot-table/freeze-panes/index.js +143 -0
- package/src/pivot-table/freeze-panes/sticky-strategy.d.ts +38 -0
- package/src/pivot-table/freeze-panes/sticky-strategy.js +247 -0
- package/src/pivot-table/freeze-panes/transform-strategy.d.ts +61 -0
- package/src/pivot-table/freeze-panes/transform-strategy.js +131 -0
- package/src/pivot.css +2 -98
- package/src/published_items_renderer.d.ts +10 -0
- package/src/seriesPointStyles-helper.d.ts +2 -0
- package/src/smart_queries_helper.d.ts +12 -0
- package/src/value.formatter.d.ts +3 -0
- package/tests/dr-renderer-helpers.test.js +29 -0
- package/tests/pivot-table/freeze-panes/constants.test.js +92 -0
- package/tests/pivot-table/freeze-panes/index.test.js +193 -0
- package/tests/pivot-table/freeze-panes/sticky-strategy.test.js +542 -0
- package/tests/pivot-table/freeze-panes/transform-strategy.test.js +304 -0
- package/tsconfig.json +7 -10
- package/src/types/index.d.ts +0 -12
- package/tsconfig.tsbuildinfo +0 -1
- /package/src/{types/errors.d.ts → errors.d.ts} +0 -0
- /package/src/{types/options → options}/builders.d.ts +0 -0
- /package/src/{types/options → options}/constants.d.ts +0 -0
- /package/src/{types/options → options}/elements.d.ts +0 -0
- /package/src/{types/options → options}/helpers.d.ts +0 -0
- /package/src/{types/options → options}/index.d.ts +0 -0
- /package/src/{types/options → options}/presets.d.ts +0 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Freeze Panes CSS
|
|
3
|
+
*
|
|
4
|
+
* Styles for both transform mode (legacy) and sticky mode (new).
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/* =============================================================================
|
|
8
|
+
Transform Mode Styles (Legacy)
|
|
9
|
+
Uses CSS transforms applied via JavaScript on scroll
|
|
10
|
+
============================================================================= */
|
|
11
|
+
|
|
12
|
+
table.pvtTable .axis-freeze-pane {
|
|
13
|
+
position: relative;
|
|
14
|
+
z-index: 100;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
table.pvtTable .vertical-freeze-pane {
|
|
18
|
+
position: relative;
|
|
19
|
+
z-index: 50;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
table.pvtTable .horizontal-freeze-pane {
|
|
23
|
+
position: relative;
|
|
24
|
+
z-index: 50;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Transform mode - thead border pseudo-elements */
|
|
28
|
+
table.pvtTable thead tr th.axis-freeze-pane:before,
|
|
29
|
+
table.pvtTable thead tr th.vertical-freeze-pane:before,
|
|
30
|
+
table.pvtTable.newPvtTable thead tr th.axis-freeze-pane:before,
|
|
31
|
+
table.pvtTable.newPvtTable thead tr th.vertical-freeze-pane:before {
|
|
32
|
+
content: '';
|
|
33
|
+
width: calc(100% + 1px);
|
|
34
|
+
height: 1px;
|
|
35
|
+
background: white;
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: -1px;
|
|
38
|
+
left: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
table.pvtTable thead tr th.axis-freeze-pane:before,
|
|
42
|
+
table.pvtTable thead tr th.vertical-freeze-pane:before {
|
|
43
|
+
background: #cdcdcd;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
table.pvtTable thead tr th.axis-freeze-pane:after,
|
|
47
|
+
table.pvtTable thead tr th.vertical-freeze-pane:after,
|
|
48
|
+
table.pvtTable.newPvtTable thead tr th.axis-freeze-pane:after,
|
|
49
|
+
table.pvtTable.newPvtTable thead tr th.vertical-freeze-pane:after {
|
|
50
|
+
content: '';
|
|
51
|
+
width: 1px;
|
|
52
|
+
height: 100%;
|
|
53
|
+
background: white;
|
|
54
|
+
position: absolute;
|
|
55
|
+
right: -1px;
|
|
56
|
+
top: 0;
|
|
57
|
+
}
|
|
58
|
+
table.pvtTable thead tr th.axis-freeze-pane:after,
|
|
59
|
+
table.pvtTable thead tr th.vertical-freeze-pane:after {
|
|
60
|
+
background: #cdcdcd;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Transform mode - tbody border pseudo-elements */
|
|
64
|
+
table.pvtTable tbody tr th.horizontal-freeze-pane:before,
|
|
65
|
+
table.pvtTable tbody tr td.horizontal-freeze-pane:before,
|
|
66
|
+
table.pvtTable.newPvtTable tbody tr th.horizontal-freeze-pane:before,
|
|
67
|
+
table.pvtTable.newPvtTable tbody tr td.horizontal-freeze-pane:before {
|
|
68
|
+
content: '';
|
|
69
|
+
width: calc(100% + 1px);
|
|
70
|
+
height: 1px;
|
|
71
|
+
background: #dfe6ec;
|
|
72
|
+
position: absolute;
|
|
73
|
+
top: -1px;
|
|
74
|
+
left: 0;
|
|
75
|
+
}
|
|
76
|
+
table.pvtTable tbody tr th.horizontal-freeze-pane:before,
|
|
77
|
+
table.pvtTable tbody tr td.horizontal-freeze-pane:before {
|
|
78
|
+
background: #cdcdcd;
|
|
79
|
+
}
|
|
80
|
+
table.pvtTable tbody tr th.colTotal.horizontal-freeze-pane:before,
|
|
81
|
+
table.pvtTable tbody tr td.colTotal.horizontal-freeze-pane:before {
|
|
82
|
+
background: transparent;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
table.pvtTable tbody tr th.horizontal-freeze-pane:after,
|
|
86
|
+
table.pvtTable tbody tr td.horizontal-freeze-pane:after,
|
|
87
|
+
table.pvtTable.newPvtTable tbody tr th.horizontal-freeze-pane:after,
|
|
88
|
+
table.pvtTable.newPvtTable tbody tr td.horizontal-freeze-pane:after {
|
|
89
|
+
content: '';
|
|
90
|
+
width: 1px;
|
|
91
|
+
height: 100%;
|
|
92
|
+
background: #dfe6ec;
|
|
93
|
+
position: absolute;
|
|
94
|
+
right: -1px;
|
|
95
|
+
top: 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
table.pvtTable tbody tr th.horizontal-freeze-pane:after,
|
|
99
|
+
table.pvtTable tbody tr td.horizontal-freeze-pane:after {
|
|
100
|
+
background: #cdcdcd;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
table.pvtTable.newPvtTable tbody tr th.horizontal-freeze-pane.colTotal:after {
|
|
104
|
+
background: #fff;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* Transform mode - colorized header handling */
|
|
108
|
+
table.pvtTable.colorized:not(.newPvtTable) tbody tr th.horizontal-freeze-pane,
|
|
109
|
+
table.pvtTable.newPvtTable.colorized tbody tr th.horizontal-freeze-pane:not(.highlighted):not(.colTotal) {
|
|
110
|
+
background-color: #fff !important;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* =============================================================================
|
|
114
|
+
Sticky Mode Styles (New)
|
|
115
|
+
Uses native CSS position: sticky for freeze panes
|
|
116
|
+
============================================================================= */
|
|
117
|
+
|
|
118
|
+
/* Container must allow sticky positioning to work */
|
|
119
|
+
.sticky-freeze-panes-container {
|
|
120
|
+
overflow: auto;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* Axis freeze pane - sticks to top-left corner */
|
|
124
|
+
table.pvtTable .sticky-axis-freeze-pane {
|
|
125
|
+
position: sticky;
|
|
126
|
+
top: 0;
|
|
127
|
+
left: 0;
|
|
128
|
+
z-index: 30;
|
|
129
|
+
background-color: inherit;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* Vertical freeze pane - sticks to top (column headers) */
|
|
133
|
+
table.pvtTable .sticky-vertical-freeze-pane {
|
|
134
|
+
position: sticky;
|
|
135
|
+
top: 0;
|
|
136
|
+
z-index: 20;
|
|
137
|
+
background-color: inherit;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/* Horizontal freeze pane - sticks to left (row headers) */
|
|
141
|
+
table.pvtTable .sticky-horizontal-freeze-pane {
|
|
142
|
+
position: sticky;
|
|
143
|
+
left: 0;
|
|
144
|
+
z-index: 10;
|
|
145
|
+
background-color: inherit;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/* Ensure sticky cells have proper background color to hide scrolled content */
|
|
149
|
+
table.pvtTable thead th.sticky-axis-freeze-pane,
|
|
150
|
+
table.pvtTable thead th.sticky-vertical-freeze-pane {
|
|
151
|
+
background-color: #f8f8f8;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
table.pvtTable.newPvtTable thead th.sticky-axis-freeze-pane,
|
|
155
|
+
table.pvtTable.newPvtTable thead th.sticky-vertical-freeze-pane {
|
|
156
|
+
background-color: #dfe6ec;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
table.pvtTable tbody th.sticky-horizontal-freeze-pane,
|
|
160
|
+
table.pvtTable tbody td.sticky-horizontal-freeze-pane {
|
|
161
|
+
background-color: #fff;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/* Sticky mode - colorized header handling */
|
|
165
|
+
table.pvtTable.colorized thead th.sticky-axis-freeze-pane,
|
|
166
|
+
table.pvtTable.colorized thead th.sticky-vertical-freeze-pane {
|
|
167
|
+
background-color: #f8f8f8;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
table.pvtTable.newPvtTable.colorized thead th.sticky-axis-freeze-pane,
|
|
171
|
+
table.pvtTable.newPvtTable.colorized thead th.sticky-vertical-freeze-pane {
|
|
172
|
+
background-color: #dfe6ec;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
table.pvtTable.colorized:not(.newPvtTable) tbody tr th.sticky-horizontal-freeze-pane,
|
|
176
|
+
table.pvtTable.newPvtTable.colorized tbody tr th.sticky-horizontal-freeze-pane:not(.highlighted):not(.colTotal) {
|
|
177
|
+
background-color: #fff;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/* Sticky mode - thead border pseudo-elements */
|
|
181
|
+
table.pvtTable thead tr th.sticky-axis-freeze-pane:before,
|
|
182
|
+
table.pvtTable thead tr th.sticky-vertical-freeze-pane:before,
|
|
183
|
+
table.pvtTable.newPvtTable thead tr th.sticky-axis-freeze-pane:before,
|
|
184
|
+
table.pvtTable.newPvtTable thead tr th.sticky-vertical-freeze-pane:before {
|
|
185
|
+
content: '';
|
|
186
|
+
width: calc(100% + 1px);
|
|
187
|
+
height: 1px;
|
|
188
|
+
background: white;
|
|
189
|
+
position: absolute;
|
|
190
|
+
top: -1px;
|
|
191
|
+
left: 0;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
table.pvtTable thead tr th.sticky-axis-freeze-pane:before,
|
|
195
|
+
table.pvtTable thead tr th.sticky-vertical-freeze-pane:before {
|
|
196
|
+
background: #cdcdcd;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
table.pvtTable thead tr th.sticky-axis-freeze-pane:after,
|
|
200
|
+
table.pvtTable thead tr th.sticky-vertical-freeze-pane:after,
|
|
201
|
+
table.pvtTable.newPvtTable thead tr th.sticky-axis-freeze-pane:after,
|
|
202
|
+
table.pvtTable.newPvtTable thead tr th.sticky-vertical-freeze-pane:after {
|
|
203
|
+
content: '';
|
|
204
|
+
width: 1px;
|
|
205
|
+
height: 100%;
|
|
206
|
+
background: white;
|
|
207
|
+
position: absolute;
|
|
208
|
+
right: -1px;
|
|
209
|
+
top: 0;
|
|
210
|
+
}
|
|
211
|
+
table.pvtTable thead tr th.sticky-axis-freeze-pane:after,
|
|
212
|
+
table.pvtTable thead tr th.sticky-vertical-freeze-pane:after {
|
|
213
|
+
background: #cdcdcd;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/* Sticky mode - tbody border pseudo-elements */
|
|
217
|
+
table.pvtTable tbody tr th.sticky-horizontal-freeze-pane:before,
|
|
218
|
+
table.pvtTable tbody tr td.sticky-horizontal-freeze-pane:before,
|
|
219
|
+
table.pvtTable.newPvtTable tbody tr th.sticky-horizontal-freeze-pane:before,
|
|
220
|
+
table.pvtTable.newPvtTable tbody tr td.sticky-horizontal-freeze-pane:before {
|
|
221
|
+
content: '';
|
|
222
|
+
width: calc(100% + 1px);
|
|
223
|
+
height: 1px;
|
|
224
|
+
background: #dfe6ec;
|
|
225
|
+
position: absolute;
|
|
226
|
+
top: -1px;
|
|
227
|
+
left: 0;
|
|
228
|
+
}
|
|
229
|
+
table.pvtTable tbody tr th.sticky-horizontal-freeze-pane:before,
|
|
230
|
+
table.pvtTable tbody tr td.sticky-horizontal-freeze-pane:before {
|
|
231
|
+
background: #cdcdcd;
|
|
232
|
+
}
|
|
233
|
+
table.pvtTable tbody tr th.colTotal.sticky-horizontal-freeze-pane:before,
|
|
234
|
+
table.pvtTable tbody tr td.colTotal.sticky-horizontal-freeze-pane:before {
|
|
235
|
+
background: transparent;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
table.pvtTable tbody tr th.sticky-horizontal-freeze-pane:after,
|
|
239
|
+
table.pvtTable tbody tr td.sticky-horizontal-freeze-pane:after,
|
|
240
|
+
table.pvtTable.newPvtTable tbody tr th.sticky-horizontal-freeze-pane:after,
|
|
241
|
+
table.pvtTable.newPvtTable tbody tr td.sticky-horizontal-freeze-pane:after {
|
|
242
|
+
content: '';
|
|
243
|
+
width: 1px;
|
|
244
|
+
height: 100%;
|
|
245
|
+
background: #dfe6ec;
|
|
246
|
+
position: absolute;
|
|
247
|
+
right: -1px;
|
|
248
|
+
top: 0;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
table.pvtTable tbody tr th.sticky-horizontal-freeze-pane:after,
|
|
252
|
+
table.pvtTable tbody tr td.sticky-horizontal-freeze-pane:after {
|
|
253
|
+
background: #cdcdcd;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
table.pvtTable.newPvtTable tbody tr th.sticky-horizontal-freeze-pane.colTotal:after {
|
|
257
|
+
background: #fff;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
table.pvtTable.freeze-panes-rows-disabled .sticky-vertical-freeze-pane {
|
|
261
|
+
position: relative;
|
|
262
|
+
top: auto !important;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
table.pvtTable.freeze-panes-columns-disabled .sticky-horizontal-freeze-pane {
|
|
266
|
+
position: relative;
|
|
267
|
+
left: auto !important;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
table.pvtTable.freeze-panes-rows-disabled:not(.freeze-panes-columns-disabled) .sticky-axis-freeze-pane {
|
|
271
|
+
top: auto !important;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
table.pvtTable.freeze-panes-columns-disabled:not(.freeze-panes-rows-disabled) .sticky-axis-freeze-pane {
|
|
275
|
+
left: auto !important;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
table.pvtTable.freeze-panes-rows-disabled.freeze-panes-columns-disabled .sticky-axis-freeze-pane {
|
|
279
|
+
position: relative;
|
|
280
|
+
top: auto !important;
|
|
281
|
+
left: auto !important;
|
|
282
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
declare namespace _exports {
|
|
2
|
+
export { FreezePanesClassStrings, FreezePanesOptions, FreezePanesTableInfo, FreezePanesInitResult, FreezePanesStrategy, TableOptions };
|
|
3
|
+
}
|
|
4
|
+
declare namespace _exports {
|
|
5
|
+
export { parseOptions };
|
|
6
|
+
export { getClassStrings };
|
|
7
|
+
export { initialize };
|
|
8
|
+
export { setMode };
|
|
9
|
+
export { getMode };
|
|
10
|
+
export { FREEZE_PANES_MODES };
|
|
11
|
+
}
|
|
12
|
+
export = _exports;
|
|
13
|
+
/**
|
|
14
|
+
* CSS class strings for freeze pane elements.
|
|
15
|
+
*/
|
|
16
|
+
type FreezePanesClassStrings = {
|
|
17
|
+
/**
|
|
18
|
+
* - CSS class for horizontally frozen elements.
|
|
19
|
+
*/
|
|
20
|
+
horizontal: string;
|
|
21
|
+
/**
|
|
22
|
+
* - CSS class for vertically frozen elements.
|
|
23
|
+
*/
|
|
24
|
+
vertical: string;
|
|
25
|
+
/**
|
|
26
|
+
* - CSS class for elements frozen on both axes.
|
|
27
|
+
*/
|
|
28
|
+
axis: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Parsed freeze panes options.
|
|
32
|
+
*/
|
|
33
|
+
type FreezePanesOptions = {
|
|
34
|
+
/**
|
|
35
|
+
* - Whether freeze panes is enabled.
|
|
36
|
+
*/
|
|
37
|
+
enabled: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* - The freeze panes mode.
|
|
40
|
+
*/
|
|
41
|
+
mode: import("./constants").FreezePanesMode;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Table information for freeze panes initialization.
|
|
45
|
+
*/
|
|
46
|
+
type FreezePanesTableInfo = {
|
|
47
|
+
/**
|
|
48
|
+
* - Number of row attributes (columns in row headers).
|
|
49
|
+
*/
|
|
50
|
+
rowAttrsLength: number;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Result of freeze panes initialization.
|
|
54
|
+
*/
|
|
55
|
+
type FreezePanesInitResult = {
|
|
56
|
+
/**
|
|
57
|
+
* - Function to clean up and destroy the freeze panes instance.
|
|
58
|
+
*/
|
|
59
|
+
destroy: () => void;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Freeze panes strategy interface.
|
|
63
|
+
*/
|
|
64
|
+
type FreezePanesStrategy = {
|
|
65
|
+
/**
|
|
66
|
+
* - Gets CSS class strings.
|
|
67
|
+
*/
|
|
68
|
+
getClassStrings: (enabled: boolean) => FreezePanesClassStrings;
|
|
69
|
+
/**
|
|
70
|
+
* - Initializes the strategy.
|
|
71
|
+
*/
|
|
72
|
+
initialize: (container: HTMLElement, tableInfo: FreezePanesTableInfo) => FreezePanesInitResult;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Table options object containing freeze panes configuration.
|
|
76
|
+
*/
|
|
77
|
+
type TableOptions = {
|
|
78
|
+
/**
|
|
79
|
+
* - Whether freeze panes is enabled.
|
|
80
|
+
*/
|
|
81
|
+
freeze_panes?: boolean | undefined;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Parses freeze panes options from table options.
|
|
85
|
+
* Mode is read from global config, not from tableOptions.
|
|
86
|
+
* @param {TableOptions} tableOptions - Table options object.
|
|
87
|
+
* @returns {FreezePanesOptions} Parsed freeze panes options.
|
|
88
|
+
*/
|
|
89
|
+
declare function parseOptions(tableOptions: TableOptions): FreezePanesOptions;
|
|
90
|
+
/**
|
|
91
|
+
* Gets class strings for freeze pane elements based on options.
|
|
92
|
+
* @param {FreezePanesOptions} options - Parsed freeze panes options.
|
|
93
|
+
* @returns {FreezePanesClassStrings} Object with horizontal, vertical, and axis class strings.
|
|
94
|
+
*/
|
|
95
|
+
declare function getClassStrings(options: FreezePanesOptions): FreezePanesClassStrings;
|
|
96
|
+
/**
|
|
97
|
+
* Initializes freeze panes on a container.
|
|
98
|
+
* @param {HTMLElement} container - The container element.
|
|
99
|
+
* @param {FreezePanesOptions} options - Parsed freeze panes options.
|
|
100
|
+
* @param {FreezePanesTableInfo} tableInfo - Table information.
|
|
101
|
+
* @returns {FreezePanesInitResult | undefined} Cleanup object with destroy function, or undefined if not enabled.
|
|
102
|
+
*/
|
|
103
|
+
declare function initialize(container: HTMLElement, options: FreezePanesOptions, tableInfo: FreezePanesTableInfo): FreezePanesInitResult | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Sets the freeze panes mode globally.
|
|
106
|
+
* @param {import('./constants').FreezePanesMode} mode - The mode to set ('transform' or 'sticky').
|
|
107
|
+
* @returns {void}
|
|
108
|
+
*/
|
|
109
|
+
declare function setMode(mode: import("./constants").FreezePanesMode): void;
|
|
110
|
+
/**
|
|
111
|
+
* Gets the current freeze panes mode.
|
|
112
|
+
* @returns {import('./constants').FreezePanesMode} The current mode.
|
|
113
|
+
*/
|
|
114
|
+
declare function getMode(): import("./constants").FreezePanesMode;
|
|
115
|
+
import { FREEZE_PANES_MODES } from "./constants";
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Freeze panes module for pivot tables.
|
|
4
|
+
* Provides functionality to freeze rows and columns during scrolling.
|
|
5
|
+
* @module @datarailsshared/dr_renderer/pivot-table/freeze-panes
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { FREEZE_PANES_MODES } = require('./constants');
|
|
9
|
+
const transformStrategy = require('./transform-strategy');
|
|
10
|
+
const stickyStrategy = require('./sticky-strategy');
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* CSS class strings for freeze pane elements.
|
|
14
|
+
* @typedef {Object} FreezePanesClassStrings
|
|
15
|
+
* @property {string} horizontal - CSS class for horizontally frozen elements.
|
|
16
|
+
* @property {string} vertical - CSS class for vertically frozen elements.
|
|
17
|
+
* @property {string} axis - CSS class for elements frozen on both axes.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Parsed freeze panes options.
|
|
22
|
+
* @typedef {Object} FreezePanesOptions
|
|
23
|
+
* @property {boolean} enabled - Whether freeze panes is enabled.
|
|
24
|
+
* @property {import('./constants').FreezePanesMode} mode - The freeze panes mode.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Table information for freeze panes initialization.
|
|
29
|
+
* @typedef {Object} FreezePanesTableInfo
|
|
30
|
+
* @property {number} rowAttrsLength - Number of row attributes (columns in row headers).
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Result of freeze panes initialization.
|
|
35
|
+
* @typedef {Object} FreezePanesInitResult
|
|
36
|
+
* @property {() => void} destroy - Function to clean up and destroy the freeze panes instance.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Freeze panes strategy interface.
|
|
41
|
+
* @typedef {Object} FreezePanesStrategy
|
|
42
|
+
* @property {(enabled: boolean) => FreezePanesClassStrings} getClassStrings - Gets CSS class strings.
|
|
43
|
+
* @property {(container: HTMLElement, tableInfo: FreezePanesTableInfo) => FreezePanesInitResult} initialize - Initializes the strategy.
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Table options object containing freeze panes configuration.
|
|
48
|
+
* @typedef {Object} TableOptions
|
|
49
|
+
* @property {boolean} [freeze_panes] - Whether freeze panes is enabled.
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Global configuration for freeze panes mode.
|
|
54
|
+
* This can be modified by the consuming application to change the default mode.
|
|
55
|
+
* @type {{ mode: import('./constants').FreezePanesMode }}
|
|
56
|
+
*/
|
|
57
|
+
const config = {
|
|
58
|
+
mode: FREEZE_PANES_MODES.STICKY
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Sets the freeze panes mode globally.
|
|
63
|
+
* @param {import('./constants').FreezePanesMode} mode - The mode to set ('transform' or 'sticky').
|
|
64
|
+
* @returns {void}
|
|
65
|
+
*/
|
|
66
|
+
function setMode(mode) {
|
|
67
|
+
if (mode === FREEZE_PANES_MODES.TRANSFORM || mode === FREEZE_PANES_MODES.STICKY) {
|
|
68
|
+
config.mode = mode;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Gets the current freeze panes mode.
|
|
74
|
+
* @returns {import('./constants').FreezePanesMode} The current mode.
|
|
75
|
+
*/
|
|
76
|
+
function getMode() {
|
|
77
|
+
return config.mode;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Parses freeze panes options from table options.
|
|
82
|
+
* Mode is read from global config, not from tableOptions.
|
|
83
|
+
* @param {TableOptions} tableOptions - Table options object.
|
|
84
|
+
* @returns {FreezePanesOptions} Parsed freeze panes options.
|
|
85
|
+
*/
|
|
86
|
+
function parseOptions(tableOptions) {
|
|
87
|
+
const enabled = !!tableOptions.freeze_panes;
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
enabled: enabled,
|
|
91
|
+
mode: config.mode,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Gets the appropriate strategy based on mode.
|
|
97
|
+
* @param {import('./constants').FreezePanesMode} mode - The freeze panes mode.
|
|
98
|
+
* @returns {FreezePanesStrategy} The strategy module.
|
|
99
|
+
*/
|
|
100
|
+
function getStrategy(mode) {
|
|
101
|
+
if (mode === FREEZE_PANES_MODES.STICKY) {
|
|
102
|
+
return stickyStrategy;
|
|
103
|
+
}
|
|
104
|
+
return transformStrategy;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Gets class strings for freeze pane elements based on options.
|
|
109
|
+
* @param {FreezePanesOptions} options - Parsed freeze panes options.
|
|
110
|
+
* @returns {FreezePanesClassStrings} Object with horizontal, vertical, and axis class strings.
|
|
111
|
+
*/
|
|
112
|
+
function getClassStrings(options) {
|
|
113
|
+
const strategy = getStrategy(options.mode);
|
|
114
|
+
return strategy.getClassStrings(options.enabled);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Initializes freeze panes on a container.
|
|
119
|
+
* @param {HTMLElement} container - The container element.
|
|
120
|
+
* @param {FreezePanesOptions} options - Parsed freeze panes options.
|
|
121
|
+
* @param {FreezePanesTableInfo} tableInfo - Table information.
|
|
122
|
+
* @returns {FreezePanesInitResult | undefined} Cleanup object with destroy function, or undefined if not enabled.
|
|
123
|
+
*/
|
|
124
|
+
function initialize(container, options, tableInfo) {
|
|
125
|
+
if (!options.enabled) return undefined;
|
|
126
|
+
|
|
127
|
+
const strategy = getStrategy(options.mode);
|
|
128
|
+
return strategy.initialize(container, tableInfo);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
module.exports = {
|
|
132
|
+
// Main API
|
|
133
|
+
parseOptions: parseOptions,
|
|
134
|
+
getClassStrings: getClassStrings,
|
|
135
|
+
initialize: initialize,
|
|
136
|
+
|
|
137
|
+
// Configuration API
|
|
138
|
+
setMode: setMode,
|
|
139
|
+
getMode: getMode,
|
|
140
|
+
|
|
141
|
+
// Constants
|
|
142
|
+
FREEZE_PANES_MODES: FREEZE_PANES_MODES,
|
|
143
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS class strings for freeze pane elements.
|
|
3
|
+
*/
|
|
4
|
+
export type FreezePanesClassStrings = import("./index").FreezePanesClassStrings;
|
|
5
|
+
/**
|
|
6
|
+
* Table information for freeze panes initialization.
|
|
7
|
+
*/
|
|
8
|
+
export type FreezePanesTableInfo = import("./index").FreezePanesTableInfo;
|
|
9
|
+
/**
|
|
10
|
+
* Result of freeze panes initialization.
|
|
11
|
+
*/
|
|
12
|
+
export type FreezePanesInitResult = import("./index").FreezePanesInitResult;
|
|
13
|
+
/**
|
|
14
|
+
* Threshold check result indicating which freeze behaviors are enabled.
|
|
15
|
+
*/
|
|
16
|
+
export type ThresholdResult = {
|
|
17
|
+
/**
|
|
18
|
+
* - Whether rows should be frozen (vertical sticky).
|
|
19
|
+
*/
|
|
20
|
+
freezeRows: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* - Whether columns should be frozen (horizontal sticky).
|
|
23
|
+
*/
|
|
24
|
+
freezeColumns: boolean;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Gets class strings for sticky mode.
|
|
28
|
+
* @param {boolean} enabled - Whether freeze panes is enabled.
|
|
29
|
+
* @returns {FreezePanesClassStrings} Object with horizontal, vertical, and axis class strings.
|
|
30
|
+
*/
|
|
31
|
+
export function getClassStrings(enabled: boolean): FreezePanesClassStrings;
|
|
32
|
+
/**
|
|
33
|
+
* Initializes the sticky strategy.
|
|
34
|
+
* @param {HTMLElement} container - The container element.
|
|
35
|
+
* @param {FreezePanesTableInfo} tableInfo - Table information.
|
|
36
|
+
* @returns {FreezePanesInitResult} Object with destroy function to clean up the observer.
|
|
37
|
+
*/
|
|
38
|
+
export function initialize(container: HTMLElement, tableInfo: FreezePanesTableInfo): FreezePanesInitResult;
|