@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,304 @@
|
|
|
1
|
+
const transformStrategy = require('../../../src/pivot-table/freeze-panes/transform-strategy');
|
|
2
|
+
const { TRANSFORM_CSS_CLASSES } = require('../../../src/pivot-table/freeze-panes/constants');
|
|
3
|
+
|
|
4
|
+
describe('freeze-panes/transform-strategy', () => {
|
|
5
|
+
describe('getClassStrings', () => {
|
|
6
|
+
it('should return transform class strings when enabled', () => {
|
|
7
|
+
const result = transformStrategy.getClassStrings(true);
|
|
8
|
+
|
|
9
|
+
expect(result.horizontal).toBe(' ' + TRANSFORM_CSS_CLASSES.HORIZONTAL);
|
|
10
|
+
expect(result.vertical).toBe(' ' + TRANSFORM_CSS_CLASSES.VERTICAL);
|
|
11
|
+
expect(result.axis).toBe(' ' + TRANSFORM_CSS_CLASSES.AXIS);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should return empty strings when disabled', () => {
|
|
15
|
+
const result = transformStrategy.getClassStrings(false);
|
|
16
|
+
|
|
17
|
+
expect(result.horizontal).toBe('');
|
|
18
|
+
expect(result.vertical).toBe('');
|
|
19
|
+
expect(result.axis).toBe('');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should return class strings with leading space', () => {
|
|
23
|
+
const result = transformStrategy.getClassStrings(true);
|
|
24
|
+
|
|
25
|
+
expect(result.horizontal.startsWith(' ')).toBe(true);
|
|
26
|
+
expect(result.vertical.startsWith(' ')).toBe(true);
|
|
27
|
+
expect(result.axis.startsWith(' ')).toBe(true);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('should return object with horizontal, vertical, and axis properties', () => {
|
|
31
|
+
const result = transformStrategy.getClassStrings(true);
|
|
32
|
+
|
|
33
|
+
expect(result).toHaveProperty('horizontal');
|
|
34
|
+
expect(result).toHaveProperty('vertical');
|
|
35
|
+
expect(result).toHaveProperty('axis');
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
describe('initialize', () => {
|
|
40
|
+
let container;
|
|
41
|
+
|
|
42
|
+
beforeEach(() => {
|
|
43
|
+
container = document.createElement('div');
|
|
44
|
+
document.body.appendChild(container);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
afterEach(() => {
|
|
48
|
+
document.body.removeChild(container);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('should attach scroll handler to container', () => {
|
|
52
|
+
transformStrategy.initialize(container, { rowAttrsLength: 1 });
|
|
53
|
+
|
|
54
|
+
expect(container.onscroll).toBeInstanceOf(Function);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('should return object with destroy function', () => {
|
|
58
|
+
const result = transformStrategy.initialize(container, { rowAttrsLength: 1 });
|
|
59
|
+
|
|
60
|
+
expect(result).toBeDefined();
|
|
61
|
+
expect(result).toHaveProperty('destroy');
|
|
62
|
+
expect(typeof result.destroy).toBe('function');
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('should reset onscroll handler when destroy is called', () => {
|
|
66
|
+
const result = transformStrategy.initialize(container, { rowAttrsLength: 1 });
|
|
67
|
+
|
|
68
|
+
expect(container.onscroll).toBeInstanceOf(Function);
|
|
69
|
+
|
|
70
|
+
result.destroy();
|
|
71
|
+
|
|
72
|
+
expect(container.onscroll).toBeNull();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('should reset transform styles when destroy is called', () => {
|
|
76
|
+
const verticalElement = document.createElement('div');
|
|
77
|
+
verticalElement.className = TRANSFORM_CSS_CLASSES.VERTICAL;
|
|
78
|
+
container.appendChild(verticalElement);
|
|
79
|
+
|
|
80
|
+
const result = transformStrategy.initialize(container, { rowAttrsLength: 1 });
|
|
81
|
+
|
|
82
|
+
// Trigger scroll to apply transform
|
|
83
|
+
container.onscroll({ target: { scrollTop: 50, scrollLeft: 0, dataset: {} } });
|
|
84
|
+
expect(verticalElement.style.transform).toBe('translate(0px, 50px)');
|
|
85
|
+
|
|
86
|
+
result.destroy();
|
|
87
|
+
|
|
88
|
+
expect(verticalElement.style.transform).toBe('');
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('should work without tableInfo parameter', () => {
|
|
92
|
+
expect(() => {
|
|
93
|
+
transformStrategy.initialize(container);
|
|
94
|
+
}).not.toThrow();
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
describe('scroll handler', () => {
|
|
99
|
+
let container;
|
|
100
|
+
|
|
101
|
+
beforeEach(() => {
|
|
102
|
+
container = document.createElement('div');
|
|
103
|
+
document.body.appendChild(container);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
afterEach(() => {
|
|
107
|
+
document.body.removeChild(container);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
function createScrollEvent(target, scrollTop, scrollLeft) {
|
|
111
|
+
// Create a mock target with scroll properties
|
|
112
|
+
const mockTarget = {
|
|
113
|
+
scrollTop: scrollTop,
|
|
114
|
+
scrollLeft: scrollLeft,
|
|
115
|
+
dataset: target.dataset || {},
|
|
116
|
+
};
|
|
117
|
+
return { target: mockTarget };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
it('should transform vertical freeze pane elements on scroll', () => {
|
|
121
|
+
const verticalElement = document.createElement('div');
|
|
122
|
+
verticalElement.className = TRANSFORM_CSS_CLASSES.VERTICAL;
|
|
123
|
+
container.appendChild(verticalElement);
|
|
124
|
+
|
|
125
|
+
transformStrategy.initialize(container, { rowAttrsLength: 1 });
|
|
126
|
+
|
|
127
|
+
container.onscroll(createScrollEvent(container, 50, 0));
|
|
128
|
+
|
|
129
|
+
expect(verticalElement.style.transform).toBe('translate(0px, 50px)');
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it('should transform horizontal freeze pane elements on scroll', () => {
|
|
133
|
+
const horizontalElement = document.createElement('div');
|
|
134
|
+
// The code checks for ' horizontal-freeze-pane' (with leading space)
|
|
135
|
+
// so we add a prefix class to simulate real usage
|
|
136
|
+
horizontalElement.className = 'cell ' + TRANSFORM_CSS_CLASSES.HORIZONTAL;
|
|
137
|
+
container.appendChild(horizontalElement);
|
|
138
|
+
|
|
139
|
+
transformStrategy.initialize(container, { rowAttrsLength: 1 });
|
|
140
|
+
|
|
141
|
+
container.onscroll(createScrollEvent(container, 0, 100));
|
|
142
|
+
|
|
143
|
+
expect(horizontalElement.style.transform).toBe('translate(100px, 0px)');
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it('should transform axis freeze pane elements on scroll', () => {
|
|
147
|
+
const axisElement = document.createElement('div');
|
|
148
|
+
// The code checks for ' axis-freeze-pane' (with leading space)
|
|
149
|
+
axisElement.className = 'cell ' + TRANSFORM_CSS_CLASSES.AXIS;
|
|
150
|
+
container.appendChild(axisElement);
|
|
151
|
+
|
|
152
|
+
transformStrategy.initialize(container, { rowAttrsLength: 1 });
|
|
153
|
+
|
|
154
|
+
container.onscroll(createScrollEvent(container, 75, 50));
|
|
155
|
+
|
|
156
|
+
expect(axisElement.style.transform).toBe('translate(50px, 75px)');
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('should handle multiple elements of different types', () => {
|
|
160
|
+
const verticalElement = document.createElement('div');
|
|
161
|
+
verticalElement.className = TRANSFORM_CSS_CLASSES.VERTICAL;
|
|
162
|
+
container.appendChild(verticalElement);
|
|
163
|
+
|
|
164
|
+
const horizontalElement = document.createElement('div');
|
|
165
|
+
// Need prefix class for horizontal/axis due to includes() check with leading space
|
|
166
|
+
horizontalElement.className = 'cell ' + TRANSFORM_CSS_CLASSES.HORIZONTAL;
|
|
167
|
+
container.appendChild(horizontalElement);
|
|
168
|
+
|
|
169
|
+
const axisElement = document.createElement('div');
|
|
170
|
+
axisElement.className = 'cell ' + TRANSFORM_CSS_CLASSES.AXIS;
|
|
171
|
+
container.appendChild(axisElement);
|
|
172
|
+
|
|
173
|
+
transformStrategy.initialize(container, { rowAttrsLength: 1 });
|
|
174
|
+
|
|
175
|
+
container.onscroll(createScrollEvent(container, 30, 20));
|
|
176
|
+
|
|
177
|
+
expect(verticalElement.style.transform).toBe('translate(0px, 30px)');
|
|
178
|
+
expect(horizontalElement.style.transform).toBe('translate(20px, 0px)');
|
|
179
|
+
expect(axisElement.style.transform).toBe('translate(20px, 30px)');
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it('should skip if target has canFreezePanes dataset', () => {
|
|
183
|
+
const verticalElement = document.createElement('div');
|
|
184
|
+
verticalElement.className = TRANSFORM_CSS_CLASSES.VERTICAL;
|
|
185
|
+
container.appendChild(verticalElement);
|
|
186
|
+
|
|
187
|
+
transformStrategy.initialize(container, { rowAttrsLength: 1 });
|
|
188
|
+
|
|
189
|
+
// Add dataset flag
|
|
190
|
+
const mockTarget = {
|
|
191
|
+
scrollTop: 50,
|
|
192
|
+
scrollLeft: 0,
|
|
193
|
+
dataset: { canFreezePanes: 'true' },
|
|
194
|
+
};
|
|
195
|
+
container.onscroll({ target: mockTarget });
|
|
196
|
+
|
|
197
|
+
// Transform should not be applied
|
|
198
|
+
expect(verticalElement.style.transform).toBe('');
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
it('should handle zero scroll values', () => {
|
|
202
|
+
const axisElement = document.createElement('div');
|
|
203
|
+
axisElement.className = TRANSFORM_CSS_CLASSES.AXIS;
|
|
204
|
+
container.appendChild(axisElement);
|
|
205
|
+
|
|
206
|
+
transformStrategy.initialize(container, { rowAttrsLength: 1 });
|
|
207
|
+
|
|
208
|
+
container.onscroll(createScrollEvent(container, 0, 0));
|
|
209
|
+
|
|
210
|
+
expect(axisElement.style.transform).toBe('translate(0px, 0px)');
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
it('should handle no freezable elements', () => {
|
|
214
|
+
const regularElement = document.createElement('div');
|
|
215
|
+
regularElement.className = 'some-other-class';
|
|
216
|
+
container.appendChild(regularElement);
|
|
217
|
+
|
|
218
|
+
transformStrategy.initialize(container, { rowAttrsLength: 1 });
|
|
219
|
+
|
|
220
|
+
expect(() => {
|
|
221
|
+
container.onscroll(createScrollEvent(container, 50, 50));
|
|
222
|
+
}).not.toThrow();
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it('should handle nested elements with freeze classes', () => {
|
|
226
|
+
const wrapper = document.createElement('div');
|
|
227
|
+
const verticalElement = document.createElement('div');
|
|
228
|
+
verticalElement.className = TRANSFORM_CSS_CLASSES.VERTICAL;
|
|
229
|
+
wrapper.appendChild(verticalElement);
|
|
230
|
+
container.appendChild(wrapper);
|
|
231
|
+
|
|
232
|
+
transformStrategy.initialize(container, { rowAttrsLength: 1 });
|
|
233
|
+
|
|
234
|
+
container.onscroll(createScrollEvent(container, 25, 0));
|
|
235
|
+
|
|
236
|
+
expect(verticalElement.style.transform).toBe('translate(0px, 25px)');
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
describe('selectFreezableElements', () => {
|
|
241
|
+
let container;
|
|
242
|
+
|
|
243
|
+
beforeEach(() => {
|
|
244
|
+
container = document.createElement('div');
|
|
245
|
+
document.body.appendChild(container);
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
afterEach(() => {
|
|
249
|
+
document.body.removeChild(container);
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
function createScrollEvent(scrollTop, scrollLeft) {
|
|
253
|
+
return {
|
|
254
|
+
target: {
|
|
255
|
+
scrollTop: scrollTop,
|
|
256
|
+
scrollLeft: scrollLeft,
|
|
257
|
+
dataset: {},
|
|
258
|
+
},
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
it('should select all elements with vertical freeze class', () => {
|
|
263
|
+
const el1 = document.createElement('div');
|
|
264
|
+
el1.className = TRANSFORM_CSS_CLASSES.VERTICAL;
|
|
265
|
+
const el2 = document.createElement('div');
|
|
266
|
+
el2.className = TRANSFORM_CSS_CLASSES.VERTICAL;
|
|
267
|
+
container.appendChild(el1);
|
|
268
|
+
container.appendChild(el2);
|
|
269
|
+
|
|
270
|
+
transformStrategy.initialize(container, {});
|
|
271
|
+
|
|
272
|
+
container.onscroll(createScrollEvent(10, 0));
|
|
273
|
+
|
|
274
|
+
expect(el1.style.transform).toBe('translate(0px, 10px)');
|
|
275
|
+
expect(el2.style.transform).toBe('translate(0px, 10px)');
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
it('should select all elements with horizontal freeze class', () => {
|
|
279
|
+
const el = document.createElement('div');
|
|
280
|
+
// Need prefix class for horizontal due to includes() check with leading space
|
|
281
|
+
el.className = 'cell ' + TRANSFORM_CSS_CLASSES.HORIZONTAL;
|
|
282
|
+
container.appendChild(el);
|
|
283
|
+
|
|
284
|
+
transformStrategy.initialize(container, {});
|
|
285
|
+
|
|
286
|
+
container.onscroll(createScrollEvent(0, 15));
|
|
287
|
+
|
|
288
|
+
expect(el.style.transform).toBe('translate(15px, 0px)');
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
it('should select all elements with axis freeze class', () => {
|
|
292
|
+
const el = document.createElement('div');
|
|
293
|
+
// Need prefix class for axis due to includes() check with leading space
|
|
294
|
+
el.className = 'cell ' + TRANSFORM_CSS_CLASSES.AXIS;
|
|
295
|
+
container.appendChild(el);
|
|
296
|
+
|
|
297
|
+
transformStrategy.initialize(container, {});
|
|
298
|
+
|
|
299
|
+
container.onscroll(createScrollEvent(5, 10));
|
|
300
|
+
|
|
301
|
+
expect(el.style.transform).toBe('translate(10px, 5px)');
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
});
|
package/tsconfig.json
CHANGED
|
@@ -2,24 +2,21 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"declaration": true,
|
|
4
4
|
"allowJs": true,
|
|
5
|
-
"declarationDir": "./src
|
|
6
|
-
"checkJs":
|
|
7
|
-
"moduleResolution": "
|
|
8
|
-
"module": "
|
|
5
|
+
"declarationDir": "./src",
|
|
6
|
+
"checkJs": false,
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"module": "es2022",
|
|
9
9
|
"target": "esnext",
|
|
10
10
|
"emitDeclarationOnly": true,
|
|
11
11
|
"strict": true,
|
|
12
12
|
"noImplicitAny": true
|
|
13
13
|
},
|
|
14
14
|
"include": [
|
|
15
|
+
"./src/index.js",
|
|
15
16
|
"./src/graph-table-renderer.js",
|
|
16
17
|
"./src/errors.js",
|
|
17
|
-
"./src/options
|
|
18
|
-
"./src/
|
|
19
|
-
"./src/options/elements.js",
|
|
20
|
-
"./src/options/builders.js",
|
|
21
|
-
"./src/options/presets.js",
|
|
22
|
-
"./src/options/helpers.js"
|
|
18
|
+
"./src/options/**/*.js",
|
|
19
|
+
"./src/pivot-table/freeze-panes/**/*.js"
|
|
23
20
|
],
|
|
24
21
|
"exclude": ["node_modules"]
|
|
25
22
|
}
|
package/src/types/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// Re-export error types
|
|
2
|
-
export * from './errors';
|
|
3
|
-
|
|
4
|
-
// Re-export GraphTableRenderer types
|
|
5
|
-
export * from './graph-table-renderer';
|
|
6
|
-
|
|
7
|
-
// Re-export options module types
|
|
8
|
-
export * from './options/builders';
|
|
9
|
-
export * from './options/constants';
|
|
10
|
-
export * from './options/elements';
|
|
11
|
-
export * from './options/helpers';
|
|
12
|
-
export * from './options/presets';
|
package/tsconfig.tsbuildinfo
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"root":["./src/graph-table-renderer.js","./src/errors.js","./src/options/index.js","./src/options/constants.js","./src/options/elements.js","./src/options/builders.js","./src/options/presets.js","./src/options/helpers.js"],"version":"5.9.2"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|