tslab-widgets 0.1.0 → 1.1.0
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/LICENSE +170 -197
- package/dist/chart/chart.d.ts +10 -9
- package/dist/chart/chart.d.ts.map +1 -0
- package/dist/chart/chart.js +223 -85
- package/dist/chart/chart.js.map +1 -0
- package/dist/chart/plugins/tooltip.d.ts +32 -17
- package/dist/chart/plugins/tooltip.d.ts.map +1 -0
- package/dist/chart/plugins/tooltip.js +235 -64
- package/dist/chart/plugins/tooltip.js.map +1 -0
- package/dist/chart/plugins/trendLine.d.ts +5 -4
- package/dist/chart/plugins/trendLine.d.ts.map +1 -0
- package/dist/chart/plugins/trendLine.js +10 -4
- package/dist/chart/plugins/trendLine.js.map +1 -0
- package/dist/chart/plugins/verticalLine.d.ts +5 -4
- package/dist/chart/plugins/verticalLine.d.ts.map +1 -0
- package/dist/chart/plugins/verticalLine.js +43 -13
- package/dist/chart/plugins/verticalLine.js.map +1 -0
- package/dist/chart/plugins/volumeProfile.d.ts +31 -11
- package/dist/chart/plugins/volumeProfile.d.ts.map +1 -0
- package/dist/chart/plugins/volumeProfile.js +162 -24
- package/dist/chart/plugins/volumeProfile.js.map +1 -0
- package/dist/config/versions.d.ts +28 -0
- package/dist/config/versions.d.ts.map +1 -0
- package/dist/config/versions.js +41 -0
- package/dist/config/versions.js.map +1 -0
- package/dist/gauge/gauge.d.ts +9 -6
- package/dist/gauge/gauge.d.ts.map +1 -0
- package/dist/gauge/gauge.js +379 -40
- package/dist/gauge/gauge.js.map +1 -0
- package/dist/index.d.ts +8 -7
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -0
- package/dist/json/json.d.ts +1 -0
- package/dist/json/json.d.ts.map +1 -0
- package/dist/json/json.js +10 -6
- package/dist/json/json.js.map +1 -0
- package/dist/table/table.d.ts +9 -0
- package/dist/table/table.d.ts.map +1 -0
- package/dist/table/table.js +49 -0
- package/dist/table/table.js.map +1 -0
- package/package.json +49 -30
- package/readme.md +43 -7
- package/dist/csv/csv.d.ts +0 -5
- package/dist/csv/csv.js +0 -83
package/dist/gauge/gauge.js
CHANGED
|
@@ -3,53 +3,391 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.gauge = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const tslab = tslib_1.__importStar(require("tslab"));
|
|
6
|
-
|
|
7
|
-
function gauge(
|
|
8
|
-
var _a;
|
|
6
|
+
const versions_1 = require("../config/versions");
|
|
7
|
+
function gauge(params) {
|
|
9
8
|
const reactComponentId = `_gauge_widget${Math.random().toString(36).substring(2, 9)}`;
|
|
10
9
|
const html = `
|
|
11
|
-
<div id="${reactComponentId}"
|
|
12
|
-
<style type="text/css">
|
|
13
|
-
g.text-group {
|
|
14
|
-
text-shadow: 5px 5px 5px #000;
|
|
15
|
-
}
|
|
16
|
-
</style>
|
|
10
|
+
<div id="${reactComponentId}" />
|
|
17
11
|
<script type="module">
|
|
18
|
-
import React from "
|
|
19
|
-
import ReactDOM from "
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
import React from "${versions_1.CDN_URLS.react}";
|
|
13
|
+
import ReactDOM from "${versions_1.CDN_URLS.reactDom}";
|
|
14
|
+
|
|
15
|
+
import { Cell, Pie, PieChart, ZIndexLayer } from "${versions_1.CDN_URLS.recharts}";
|
|
22
16
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
17
|
+
const DEFAULT_SECTIONS = [
|
|
18
|
+
{ value: 25, fill: "#ef4444" },
|
|
19
|
+
{ value: 25, fill: "#f57c0bff" },
|
|
20
|
+
{ value: 25, fill: "#f5be0bff" },
|
|
21
|
+
{ value: 25, fill: "#10b981" },
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
const TOTAL_VALUE = 100;
|
|
25
|
+
|
|
26
|
+
const SIZE_CONFIG = {
|
|
27
|
+
S: {
|
|
28
|
+
width: 180,
|
|
29
|
+
height: 170,
|
|
30
|
+
chartWidth: 170,
|
|
31
|
+
chartHeight: 120,
|
|
32
|
+
baseRadius: 80,
|
|
33
|
+
fontSize: {
|
|
34
|
+
value: "20px",
|
|
35
|
+
unit: "14px",
|
|
36
|
+
percentage: "11px",
|
|
37
|
+
},
|
|
38
|
+
valueDisplayOffset: 32,
|
|
39
|
+
},
|
|
40
|
+
M: {
|
|
41
|
+
width: 220,
|
|
42
|
+
height: 180,
|
|
43
|
+
chartWidth: 210,
|
|
44
|
+
chartHeight: 120,
|
|
45
|
+
baseRadius: 90,
|
|
46
|
+
fontSize: {
|
|
47
|
+
value: "28px",
|
|
48
|
+
unit: "20px",
|
|
49
|
+
percentage: "14px",
|
|
50
|
+
},
|
|
51
|
+
valueDisplayOffset: 38,
|
|
52
|
+
},
|
|
53
|
+
L: {
|
|
54
|
+
width: 310,
|
|
55
|
+
height: 230,
|
|
56
|
+
chartWidth: 300,
|
|
57
|
+
chartHeight: 175,
|
|
58
|
+
baseRadius: 140,
|
|
59
|
+
valueDisplayOffset: 38,
|
|
36
60
|
},
|
|
37
|
-
title: { fontWeight: 'bold', fontSize: 13, marginBottom: '5px', paddingTop: '8px', whiteSpace: 'pre', color: '#fff' },
|
|
38
|
-
legend: { fontWeight: 'normal', fontSize: 12, marginBottom: '5px', whiteSpace: 'pre', color: '#dcdcdc' },
|
|
39
61
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
62
|
+
|
|
63
|
+
function Needle({
|
|
64
|
+
cx = 0,
|
|
65
|
+
cy = 0,
|
|
66
|
+
outerRadius = 0,
|
|
67
|
+
value = 0,
|
|
68
|
+
animate = true,
|
|
69
|
+
baseRadius,
|
|
70
|
+
}) {
|
|
71
|
+
const needleBaseCenterX = cx;
|
|
72
|
+
const needleBaseCenterY = cy;
|
|
73
|
+
// Calculate angle based on value (0-180 degrees for half circle)
|
|
74
|
+
const maxValue = TOTAL_VALUE;
|
|
75
|
+
const calculatedAngle = value
|
|
76
|
+
? 180 - Math.min(Math.max((value / maxValue) * 180, 0), 180)
|
|
77
|
+
: 180;
|
|
78
|
+
|
|
79
|
+
// Needle dimensions
|
|
80
|
+
const needleLength = outerRadius * 0.94;
|
|
81
|
+
const needleWidth = Math.max(2, baseRadius * 0.04); // Proportional to size
|
|
82
|
+
|
|
83
|
+
const needlePath =
|
|
84
|
+
"M " + needleBaseCenterX.toString() +
|
|
85
|
+
" " + (needleBaseCenterY - needleWidth / 2).toString() +
|
|
86
|
+
" L " + (needleBaseCenterX + needleLength).toString() +
|
|
87
|
+
" " + (needleBaseCenterY - 1).toString() +
|
|
88
|
+
" L " + (needleBaseCenterX + needleLength).toString() +
|
|
89
|
+
" " + (needleBaseCenterY + 1).toString() +
|
|
90
|
+
" L " + needleBaseCenterX.toString() +
|
|
91
|
+
" " + (needleBaseCenterY + needleWidth / 2).toString() +
|
|
92
|
+
" Z";
|
|
93
|
+
|
|
94
|
+
return h("g", { style: { cursor: "pointer" } }, [
|
|
95
|
+
h("defs", {}, [
|
|
96
|
+
// Needle gradient
|
|
97
|
+
h(
|
|
98
|
+
"linearGradient",
|
|
99
|
+
{
|
|
100
|
+
id: "needleGradient",
|
|
101
|
+
x1: "0%",
|
|
102
|
+
y1: "0%",
|
|
103
|
+
x2: "100%",
|
|
104
|
+
y2: "0%",
|
|
105
|
+
},
|
|
106
|
+
[
|
|
107
|
+
h("stop", { offset: "0%", stopColor: "#778599" }, []),
|
|
108
|
+
h("stop", { offset: "100%", stopColor: "#4e596b" }, []),
|
|
109
|
+
],
|
|
110
|
+
),
|
|
111
|
+
// Needle shadow
|
|
112
|
+
h(
|
|
113
|
+
"filter",
|
|
114
|
+
{
|
|
115
|
+
id: "needleShadow",
|
|
116
|
+
x: "-50%",
|
|
117
|
+
y: "-50%",
|
|
118
|
+
width: "200%",
|
|
119
|
+
height: "200%",
|
|
120
|
+
},
|
|
121
|
+
[
|
|
122
|
+
h("feDropShadow", {
|
|
123
|
+
dx: "2",
|
|
124
|
+
dy: "2",
|
|
125
|
+
stdDeviation: "3",
|
|
126
|
+
floodOpacity: "0.3",
|
|
127
|
+
}),
|
|
128
|
+
],
|
|
129
|
+
),
|
|
130
|
+
// Needle base gradient
|
|
131
|
+
h("radialGradient", { id: "needleBaseGradient" }, [
|
|
132
|
+
h("stop", { offset: "0%", stopColor: "#64748b" }),
|
|
133
|
+
h("stop", { offset: "100%", stopColor: "#334155" }),
|
|
134
|
+
]),
|
|
135
|
+
]),
|
|
136
|
+
|
|
137
|
+
// Needle base
|
|
138
|
+
h("circle", {
|
|
139
|
+
cx: needleBaseCenterX,
|
|
140
|
+
cy: needleBaseCenterY,
|
|
141
|
+
r: baseRadius * 0.06,
|
|
142
|
+
fill: "url(#needleBaseGradient)",
|
|
143
|
+
stroke: "#475569",
|
|
144
|
+
strokeWidth: "1.5",
|
|
145
|
+
filter: "url(#needleShadow)",
|
|
146
|
+
style: {
|
|
147
|
+
transition: animate ? "all 0.3s ease" : "none",
|
|
148
|
+
zIndex: 100,
|
|
149
|
+
},
|
|
150
|
+
}),
|
|
151
|
+
|
|
152
|
+
// Needle pointer
|
|
153
|
+
h("path", {
|
|
154
|
+
d: needlePath,
|
|
155
|
+
fill: "url(#needleGradient)",
|
|
156
|
+
stroke: "#334155",
|
|
157
|
+
strokeWidth: "1",
|
|
158
|
+
filter: "url(#needleShadow)",
|
|
159
|
+
style: {
|
|
160
|
+
transform: "rotate(-" + calculatedAngle.toString() + "deg)",
|
|
161
|
+
transformOrigin:
|
|
162
|
+
needleBaseCenterX.toString() +
|
|
163
|
+
"px " +
|
|
164
|
+
needleBaseCenterY.toString() +
|
|
165
|
+
"px",
|
|
166
|
+
transition: animate
|
|
167
|
+
? "transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1)"
|
|
168
|
+
: "none",
|
|
169
|
+
zIndex: 99,
|
|
170
|
+
},
|
|
171
|
+
}),
|
|
172
|
+
|
|
173
|
+
// Needle tip accent
|
|
174
|
+
h("circle", {
|
|
175
|
+
cx: needleBaseCenterX + needleLength,
|
|
176
|
+
cy: needleBaseCenterY,
|
|
177
|
+
r: baseRadius * 0.02,
|
|
178
|
+
fill: "#334155",
|
|
179
|
+
stroke: "#94a3b8",
|
|
180
|
+
strokeWidth: "1",
|
|
181
|
+
style: {
|
|
182
|
+
transform: "rotate(-" + calculatedAngle.toString() + "deg)",
|
|
183
|
+
transformOrigin:
|
|
184
|
+
needleBaseCenterX.toString() +
|
|
185
|
+
"px " +
|
|
186
|
+
needleBaseCenterY.toString() +
|
|
187
|
+
"px",
|
|
188
|
+
transition: animate
|
|
189
|
+
? "transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1)"
|
|
190
|
+
: "none",
|
|
191
|
+
},
|
|
49
192
|
}),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
193
|
+
]);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function HalfPie({
|
|
197
|
+
animateSegments = true,
|
|
198
|
+
baseRadius,
|
|
199
|
+
centerX,
|
|
200
|
+
centerY,
|
|
201
|
+
sections = DEFAULT_SECTIONS,
|
|
202
|
+
...pieProps
|
|
203
|
+
}) {
|
|
204
|
+
const outerRadius = baseRadius;
|
|
205
|
+
const innerRadius = baseRadius * 0.7;
|
|
206
|
+
return h(
|
|
207
|
+
Pie,
|
|
208
|
+
{
|
|
209
|
+
...pieProps,
|
|
210
|
+
stroke: "none",
|
|
211
|
+
dataKey: "value",
|
|
212
|
+
startAngle: 180,
|
|
213
|
+
endAngle: 0,
|
|
214
|
+
data: sections,
|
|
215
|
+
cx: centerX,
|
|
216
|
+
cy: centerY,
|
|
217
|
+
innerRadius,
|
|
218
|
+
outerRadius,
|
|
219
|
+
isAnimationActive: animateSegments,
|
|
220
|
+
animationDuration: 600,
|
|
221
|
+
animationEasing: "ease-out",
|
|
222
|
+
style: { marginLeft: 0 },
|
|
223
|
+
},
|
|
224
|
+
sections.map((entry, i) =>
|
|
225
|
+
h(Cell, {
|
|
226
|
+
key: "cell-" + entry.fill.toString() + "-" + i.toString(),
|
|
227
|
+
fill: entry.fill,
|
|
228
|
+
style: {
|
|
229
|
+
filter: "drop-shadow(0px 2px 3px rgba(0,0,0,0.2))",
|
|
230
|
+
stroke: "rgba(255,255,255,0.4)",
|
|
231
|
+
strokeWidth: 0.5,
|
|
232
|
+
},
|
|
233
|
+
}),
|
|
234
|
+
),
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function ValueDisplay({
|
|
239
|
+
value,
|
|
240
|
+
totalValue,
|
|
241
|
+
title,
|
|
242
|
+
unit = "",
|
|
243
|
+
centerX,
|
|
244
|
+
centerY,
|
|
245
|
+
offsetY,
|
|
246
|
+
}) {
|
|
247
|
+
const percentage = ((value / totalValue) * 100).toFixed(1);
|
|
248
|
+
|
|
249
|
+
return h(
|
|
250
|
+
"div",
|
|
251
|
+
{
|
|
252
|
+
style: {
|
|
253
|
+
position: "absolute",
|
|
254
|
+
top: (centerY + offsetY).toString() + "px",
|
|
255
|
+
left: (centerX + 5).toString() + "px",
|
|
256
|
+
transform: "translate(-50%, -50%)",
|
|
257
|
+
textAlign: "center",
|
|
258
|
+
pointerEvents: "none",
|
|
259
|
+
zIndex: 90,
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
[
|
|
263
|
+
h(
|
|
264
|
+
"div",
|
|
265
|
+
{
|
|
266
|
+
style: {
|
|
267
|
+
fontSize: "28px",
|
|
268
|
+
fontWeight: "600",
|
|
269
|
+
color: "#fff7fa",
|
|
270
|
+
lineHeight: "1",
|
|
271
|
+
marginBottom: "2px",
|
|
272
|
+
fontVariantNumeric: "tabular-nums",
|
|
273
|
+
letterSpacing: "-0.5px",
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
[
|
|
277
|
+
value,
|
|
278
|
+
h(
|
|
279
|
+
"span",
|
|
280
|
+
{
|
|
281
|
+
style: {
|
|
282
|
+
fontSize: "20px",
|
|
283
|
+
color: "#64748b",
|
|
284
|
+
marginLeft: "2px",
|
|
285
|
+
fontWeight: "500",
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
[unit],
|
|
289
|
+
),
|
|
290
|
+
|
|
291
|
+
h(
|
|
292
|
+
"div",
|
|
293
|
+
{
|
|
294
|
+
style: {
|
|
295
|
+
fontSize: "14px",
|
|
296
|
+
color: "#64748b",
|
|
297
|
+
fontWeight: "500",
|
|
298
|
+
marginTop: "2px",
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
[
|
|
302
|
+
title || percentage.toString() + "% of " + totalValue.toString() + " " + unit,
|
|
303
|
+
],
|
|
304
|
+
),
|
|
305
|
+
],
|
|
306
|
+
),
|
|
307
|
+
],
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
function GaugeWithNeedle({
|
|
312
|
+
isAnimationActive = true,
|
|
313
|
+
showValueDisplay = true,
|
|
314
|
+
currentValue = 0,
|
|
315
|
+
sections,
|
|
316
|
+
unit = "",
|
|
317
|
+
size = "M",
|
|
318
|
+
title = "",
|
|
319
|
+
}) {
|
|
320
|
+
const totalValue = TOTAL_VALUE;
|
|
321
|
+
const displayValue = currentValue || 0;
|
|
322
|
+
const config = SIZE_CONFIG[size];
|
|
323
|
+
const { width, height, chartWidth, chartHeight, baseRadius } = config;
|
|
324
|
+
const centerX = chartWidth / 2;
|
|
325
|
+
const centerY = chartHeight * 0.9; // 90% down for visual balance
|
|
326
|
+
|
|
327
|
+
return h(
|
|
328
|
+
"div",
|
|
329
|
+
{
|
|
330
|
+
style: {
|
|
331
|
+
position: "relative",
|
|
332
|
+
width: width.toString() + "px",
|
|
333
|
+
height: height.toString() + "px",
|
|
334
|
+
margin: "0 auto",
|
|
335
|
+
pointerEvents: "none",
|
|
336
|
+
outline: "none",
|
|
337
|
+
backgroundColor: "#1F1826",
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
[
|
|
341
|
+
h(PieChart, { width: chartWidth, height: chartHeight }, [
|
|
342
|
+
h(HalfPie, {
|
|
343
|
+
isAnimationActive: isAnimationActive,
|
|
344
|
+
animateSegments: isAnimationActive,
|
|
345
|
+
baseRadius: baseRadius,
|
|
346
|
+
centerX: centerX,
|
|
347
|
+
centerY: centerY - 5,
|
|
348
|
+
sections: sections,
|
|
349
|
+
}),
|
|
350
|
+
h(ZIndexLayer, { zIndex: 800 }, [
|
|
351
|
+
h(Needle, {
|
|
352
|
+
cx: centerX + 5,
|
|
353
|
+
cy: centerY,
|
|
354
|
+
outerRadius: baseRadius - 12,
|
|
355
|
+
value: displayValue,
|
|
356
|
+
animate: isAnimationActive,
|
|
357
|
+
baseRadius: baseRadius,
|
|
358
|
+
}),
|
|
359
|
+
]),
|
|
360
|
+
]),
|
|
361
|
+
showValueDisplay &&
|
|
362
|
+
h(ValueDisplay, {
|
|
363
|
+
value: displayValue,
|
|
364
|
+
totalValue: totalValue,
|
|
365
|
+
unit: unit,
|
|
366
|
+
centerX: centerX,
|
|
367
|
+
centerY: centerY,
|
|
368
|
+
offsetY: config.valueDisplayOffset,
|
|
369
|
+
title: title,
|
|
370
|
+
}),
|
|
371
|
+
],
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
const h = React.createElement;
|
|
377
|
+
const reactJupyterLabComponentId = "${reactComponentId}";
|
|
378
|
+
const jupyterLabReactComponentContainer = document.getElementById("${reactComponentId}");
|
|
379
|
+
const root = ReactDOM.createRoot(jupyterLabReactComponentContainer);
|
|
380
|
+
|
|
381
|
+
root.render(
|
|
382
|
+
h('div', {}, [
|
|
383
|
+
h(GaugeWithNeedle, {
|
|
384
|
+
sections: ${JSON.stringify(params.sections || undefined)},
|
|
385
|
+
title: "${params.title}",
|
|
386
|
+
currentValue: ${params.value},
|
|
387
|
+
unit: "${params.unit}",
|
|
388
|
+
size: "${params.size}",
|
|
389
|
+
})
|
|
390
|
+
])
|
|
53
391
|
);
|
|
54
392
|
|
|
55
393
|
</script>
|
|
@@ -57,3 +395,4 @@ function gauge(width = 200, props) {
|
|
|
57
395
|
tslab.display.html(html);
|
|
58
396
|
}
|
|
59
397
|
exports.gauge = gauge;
|
|
398
|
+
//# sourceMappingURL=gauge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gauge.js","sourceRoot":"","sources":["../../src/gauge/gauge.ts"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAC/B,iDAA8C;AAE9C,SAAS,KAAK,CAAC,MAMd;IACA,MAAM,gBAAgB,GAAG,gBAAgB,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IACtF,MAAM,IAAI,GAAG;eACC,gBAAgB;;2BAEJ,mBAAQ,CAAC,KAAK;8BACX,mBAAQ,CAAC,QAAQ;;0DAEW,mBAAQ,CAAC,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4CA0W/B,gBAAgB;2EACe,gBAAgB;;;;;;wBAMnE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,IAAI,SAAS,CAAC;sBAC9C,MAAM,CAAC,KAAK;4BACN,MAAM,CAAC,KAAK;qBACnB,MAAM,CAAC,IAAI;qBACX,MAAM,CAAC,IAAI;;;;;;GAM7B,CAAC;IACH,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAEQ,sBAAK"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export { chart } from
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
1
|
+
export { chart } from "./chart/chart";
|
|
2
|
+
export type { IPoint } from "./chart/plugins/trendLine";
|
|
3
|
+
export type { IVertLineOptions } from "./chart/plugins/verticalLine";
|
|
4
|
+
export type { IVolumeProfileData } from "./chart/plugins/volumeProfile";
|
|
5
|
+
export { gauge } from "./gauge/gauge";
|
|
6
|
+
export { json } from "./json/json";
|
|
7
|
+
export { table } from "./table/table";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,YAAY,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACxD,YAAY,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.table = exports.json = exports.gauge = exports.chart = void 0;
|
|
4
4
|
var chart_1 = require("./chart/chart");
|
|
5
5
|
Object.defineProperty(exports, "chart", { enumerable: true, get: function () { return chart_1.chart; } });
|
|
6
|
-
var csv_1 = require("./csv/csv");
|
|
7
|
-
Object.defineProperty(exports, "csv", { enumerable: true, get: function () { return csv_1.csv; } });
|
|
8
6
|
var gauge_1 = require("./gauge/gauge");
|
|
9
7
|
Object.defineProperty(exports, "gauge", { enumerable: true, get: function () { return gauge_1.gauge; } });
|
|
10
8
|
var json_1 = require("./json/json");
|
|
11
9
|
Object.defineProperty(exports, "json", { enumerable: true, get: function () { return json_1.json; } });
|
|
10
|
+
var table_1 = require("./table/table");
|
|
11
|
+
Object.defineProperty(exports, "table", { enumerable: true, get: function () { return table_1.table; } });
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uCAAsC;AAA7B,8FAAA,KAAK,OAAA;AAId,uCAAsC;AAA7B,8FAAA,KAAK,OAAA;AACd,oCAAmC;AAA1B,4FAAA,IAAI,OAAA;AACb,uCAAsC;AAA7B,8FAAA,KAAK,OAAA"}
|
package/dist/json/json.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/json/json.ts"],"names":[],"mappings":"AAIA,iBAAS,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE;IACrC,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf,QA2BA;AAED,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
package/dist/json/json.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.json = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const tslab = tslib_1.__importStar(require("tslab"));
|
|
6
|
+
const versions_1 = require("../config/versions");
|
|
6
7
|
function json(opts) {
|
|
7
8
|
const width = opts.width || 400;
|
|
8
9
|
const height = opts.height || 200;
|
|
@@ -13,20 +14,23 @@ function json(opts) {
|
|
|
13
14
|
style="width:${width + 50}px;height:${height + 50}px;margin:auto;max-height:${height + 50}px;overflow:scroll;">
|
|
14
15
|
</div>
|
|
15
16
|
<script type="module">
|
|
16
|
-
import React from "
|
|
17
|
-
import ReactDOM from "
|
|
18
|
-
import
|
|
17
|
+
import React from "${versions_1.CDN_URLS.react}";
|
|
18
|
+
import ReactDOM from "${versions_1.CDN_URLS.reactDom}";
|
|
19
|
+
import {JSONTree} from "${versions_1.CDN_URLS.reactJsonTree}";
|
|
19
20
|
|
|
20
21
|
const reactJupyterLabComponentId = "${reactComponentId}";
|
|
21
22
|
const jupyterLabReactComponentContainer = document.getElementById("${reactComponentId}");
|
|
22
23
|
const args = JSON.parse('${JSON.stringify(opts.data)}');
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
|
|
25
|
+
const root = ReactDOM.createRoot(jupyterLabReactComponentContainer);
|
|
26
|
+
root.render(React.createElement(
|
|
27
|
+
JSONTree,
|
|
25
28
|
{ data: args },
|
|
26
|
-
)
|
|
29
|
+
));
|
|
27
30
|
|
|
28
31
|
</script>
|
|
29
32
|
`;
|
|
30
33
|
tslab.display.html(html);
|
|
31
34
|
}
|
|
32
35
|
exports.json = json;
|
|
36
|
+
//# sourceMappingURL=json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/json/json.ts"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAE/B,iDAA8C;AAE9C,SAAS,IAAI,CAAmB,IAI/B;IACA,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,GAAG,CAAC;IAChC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,GAAG,CAAC;IAClC,MAAM,gBAAgB,GAAG,eAAe,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IACrF,MAAM,IAAI,GAAG;;YAEF,gBAAgB;qBACP,KAAK,GAAG,EAAE,aAAa,MAAM,GAAG,EAAE,6BAA6B,MAAM,GAAG,EAAE;;;2BAGpE,mBAAQ,CAAC,KAAK;8BACX,mBAAQ,CAAC,QAAQ;gCACf,mBAAQ,CAAC,aAAa;;4CAEV,gBAAgB;2EACe,gBAAgB;iCAC1D,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;;;GASvD,CAAC;IACH,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAEQ,oBAAI"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GridOptions } from "ag-grid-community";
|
|
2
|
+
type RequiredFields<T, K extends keyof T> = T & Required<Pick<T, K>>;
|
|
3
|
+
declare function table(params: {
|
|
4
|
+
options: RequiredFields<GridOptions, "rowData">;
|
|
5
|
+
height?: number;
|
|
6
|
+
width?: number;
|
|
7
|
+
}): void;
|
|
8
|
+
export { table };
|
|
9
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/table/table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,KAAK,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAErE,iBAAS,KAAK,CAAC,MAAM,EAAE;IACtB,OAAO,EAAE,cAAc,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf,QA4CA;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.table = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const tslab = tslib_1.__importStar(require("tslab"));
|
|
6
|
+
const versions_1 = require("../config/versions");
|
|
7
|
+
function table(params) {
|
|
8
|
+
const width = params.width || 550;
|
|
9
|
+
const height = params.height || 330;
|
|
10
|
+
const reactComponentId = `_table_widget${Math.random().toString(36).substring(2, 9)}`;
|
|
11
|
+
if (!params.options.columnDefs &&
|
|
12
|
+
params.options.rowData &&
|
|
13
|
+
params.options.rowData.length > 0) {
|
|
14
|
+
params.options.columnDefs = Object.keys(params.options.rowData[0]).map((key) => ({ field: key, filter: true, sortable: true }));
|
|
15
|
+
}
|
|
16
|
+
const html = `
|
|
17
|
+
<div id="${reactComponentId}" />
|
|
18
|
+
|
|
19
|
+
<link rel="stylesheet" href="${versions_1.CDN_URLS.agGridStyles}" />
|
|
20
|
+
<link rel="stylesheet" href="${versions_1.CDN_URLS.agGridThemeAlpine}" />
|
|
21
|
+
|
|
22
|
+
<script type="module">
|
|
23
|
+
import React from "${versions_1.CDN_URLS.react}";
|
|
24
|
+
import ReactDOM from "${versions_1.CDN_URLS.reactDom}";
|
|
25
|
+
|
|
26
|
+
import { AllCommunityModule, ModuleRegistry, themeBalham, colorSchemeDarkBlue } from "${versions_1.CDN_URLS.agGridCommunity}";
|
|
27
|
+
ModuleRegistry.registerModules([AllCommunityModule]);
|
|
28
|
+
|
|
29
|
+
import { AgGridReact } from "${versions_1.CDN_URLS.agGridReact}";
|
|
30
|
+
|
|
31
|
+
const h = React.createElement;
|
|
32
|
+
const reactJupyterLabComponentId = "${reactComponentId}";
|
|
33
|
+
const jupyterLabReactComponentContainer = document.getElementById("${reactComponentId}");
|
|
34
|
+
const options = JSON.parse('${JSON.stringify(params.options)}');
|
|
35
|
+
const theme = themeBalham.withPart(colorSchemeDarkBlue);
|
|
36
|
+
const gridOptions = { theme, ...options };
|
|
37
|
+
const root = ReactDOM.createRoot(jupyterLabReactComponentContainer);
|
|
38
|
+
root.render(
|
|
39
|
+
h('div', { style: { width: ${width}, height: ${height}, margin: 'auto' }}, [
|
|
40
|
+
h(AgGridReact, { gridOptions })
|
|
41
|
+
])
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
</script>
|
|
45
|
+
`;
|
|
46
|
+
tslab.display.html(html);
|
|
47
|
+
}
|
|
48
|
+
exports.table = table;
|
|
49
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../src/table/table.ts"],"names":[],"mappings":";;;;AACA,qDAA+B;AAC/B,iDAA8C;AAI9C,SAAS,KAAK,CAAC,MAId;IACA,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,GAAG,CAAC;IAClC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC;IACpC,MAAM,gBAAgB,GAAG,gBAAgB,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IACtF,IACC,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU;QAC1B,MAAM,CAAC,OAAO,CAAC,OAAO;QACtB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAChC;QACD,MAAM,CAAC,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CACrE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CACvD,CAAC;KACF;IACD,MAAM,IAAI,GAAG;eACC,gBAAgB;;mCAEI,mBAAQ,CAAC,YAAY;mCACrB,mBAAQ,CAAC,iBAAiB;;;2BAGlC,mBAAQ,CAAC,KAAK;8BACX,mBAAQ,CAAC,QAAQ;;8FAE+C,mBAAQ,CAAC,eAAe;;;qCAGjF,mBAAQ,CAAC,WAAW;;;4CAGb,gBAAgB;2EACe,gBAAgB;oCACvD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC;;;;;qCAK7B,KAAK,aAAa,MAAM;;;;;;GAM1D,CAAC;IACH,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAEQ,sBAAK"}
|