| 1 |
Description: tsc workaround |
| 2 |
Author: Yadd <[email protected]> |
| 3 |
Forwarded: not-needed |
| 4 |
Last-Update: 2024-12-29 |
| 5 |
|
| 6 |
--- a/bqplot/js/src/Axis.ts |
| 7 |
+++ b/bqplot/js/src/Axis.ts |
| 8 |
@@ -912,8 +912,10 @@ |
| 9 |
let div = 1000; |
| 10 |
if (Math.floor(diff / div) === 0) { |
| 11 |
//diff is less than a second |
| 12 |
+// @ts-ignore |
| 13 |
if (d3.utcSecond(date) < date) { |
| 14 |
return format_millisecond(date); |
| 15 |
+// @ts-ignore |
| 16 |
} else if (d3.utcMinute(date) < date) { |
| 17 |
return format_second(date); |
| 18 |
} else { |
| 19 |
@@ -921,6 +923,7 @@ |
| 20 |
} |
| 21 |
} else if (Math.floor(diff / (div *= 60)) === 0) { |
| 22 |
//diff is less than a minute |
| 23 |
+// @ts-ignore |
| 24 |
if (d3.utcMinute(date) < date) { |
| 25 |
return format_second(date); |
| 26 |
} else { |
| 27 |
@@ -928,6 +931,7 @@ |
| 28 |
} |
| 29 |
} else if (Math.floor(diff / (div *= 60)) === 0) { |
| 30 |
// diff is less than an hour |
| 31 |
+// @ts-ignore |
| 32 |
if (d3.utcHour(date) < date) { |
| 33 |
return format_minute(date); |
| 34 |
} else { |
| 35 |
@@ -935,6 +939,7 @@ |
| 36 |
} |
| 37 |
} else if (Math.floor(diff / (div *= 24)) === 0) { |
| 38 |
//diff is less than a day |
| 39 |
+// @ts-ignore |
| 40 |
if (d3.utcDay(date) < date) { |
| 41 |
return format_hour(date); |
| 42 |
} else { |
| 43 |
@@ -942,6 +947,7 @@ |
| 44 |
} |
| 45 |
} else if (Math.floor(diff / (div *= 27)) === 0) { |
| 46 |
//diff is less than a month |
| 47 |
+// @ts-ignore |
| 48 |
if (d3.utcMonth(date) < date) { |
| 49 |
return format_day(date); |
| 50 |
} else { |
| 51 |
@@ -949,6 +955,7 @@ |
| 52 |
} |
| 53 |
} else if (Math.floor(diff / (div *= 12)) === 0) { |
| 54 |
//diff is less than a year |
| 55 |
+// @ts-ignore |
| 56 |
if (d3.utcMonth(date) < date) { |
| 57 |
return format_day(date); |
| 58 |
} else { |
| 59 |
@@ -956,8 +963,10 @@ |
| 60 |
} |
| 61 |
} else { |
| 62 |
//diff is more than a year |
| 63 |
+// @ts-ignore |
| 64 |
if (d3.utcMonth(date) < date) { |
| 65 |
return format_day(date); |
| 66 |
+// @ts-ignore |
| 67 |
} else if (d3.utcYear(date) < date) { |
| 68 |
return format_month(date); |
| 69 |
} else { |
| 70 |
--- a/bqplot/js/src/Figure.ts |
| 71 |
+++ b/bqplot/js/src/Figure.ts |
| 72 |
@@ -1119,6 +1119,7 @@ |
| 73 |
// extract all CSS variables, and generate a piece of css to define the variables |
| 74 |
const cssVariables = cssCode.match(/(--\w[\w-]*)/g) || []; |
| 75 |
const cssVariableCode = |
| 76 |
+// @ts-ignore |
| 77 |
cssVariables.reduce((cssCode, variable) => { |
| 78 |
const value = computedStyle.getPropertyValue(variable); |
| 79 |
return `${cssCode}\n\t${variable}: ${value};`; |
| 80 |
--- a/bqplot/js/src/Map.ts |
| 81 |
+++ b/bqplot/js/src/Map.ts |
| 82 |
@@ -381,9 +381,11 @@ |
| 83 |
this.model.set('selected', []); |
| 84 |
this.touch(); |
| 85 |
this.highlight_g.selectAll('.selected').remove(); |
| 86 |
+// @ts-ignore |
| 87 |
d3.select(this.d3el.node().parentNode) |
| 88 |
.selectAll('path') |
| 89 |
.classed('selected', false); |
| 90 |
+// @ts-ignore |
| 91 |
d3.select(this.d3el.node().parentNode) |
| 92 |
.selectAll('path') |
| 93 |
.classed('hovered', false); |
| 94 |
--- a/js/cellrenderer.ts |
| 95 |
+++ b/js/cellrenderer.ts |
| 96 |
@@ -75,6 +75,7 @@ |
| 97 |
|
| 98 |
this.updateRenderer(); |
| 99 |
|
| 100 |
+// @ts-ignore |
| 101 |
this.on('renderer-needs-update', this.updateRenderer.bind(this)); |
| 102 |
} |
| 103 |
|
| 104 |
@@ -125,6 +126,7 @@ |
| 105 |
...processors, |
| 106 |
}; |
| 107 |
|
| 108 |
+// @ts-ignore |
| 109 |
this.trigger('renderer-needs-update'); |
| 110 |
}); |
| 111 |
} |
| 112 |
@@ -145,6 +147,7 @@ |
| 113 |
|
| 114 |
this.renderer = this.createRenderer(options); |
| 115 |
|
| 116 |
+// @ts-ignore |
| 117 |
this.trigger('renderer-changed'); |
| 118 |
} |
| 119 |
|
| 120 |
@@ -156,6 +159,7 @@ |
| 121 |
* @return The PromiseLike to update the processor view. |
| 122 |
*/ |
| 123 |
protected updateProcessor(name: string): any { |
| 124 |
+// @ts-ignore |
| 125 |
const processor: any = this.model.get(name); |
| 126 |
|
| 127 |
if (Scalar.isScalar(processor)) { |
| 128 |
@@ -163,7 +167,9 @@ |
| 129 |
} |
| 130 |
|
| 131 |
// Assuming it is an VegaExprModel or a Scale model |
| 132 |
+// @ts-ignore |
| 133 |
this.listenTo(processor, 'change', () => { |
| 134 |
+// @ts-ignore |
| 135 |
this.trigger('renderer-needs-update'); |
| 136 |
}); |
| 137 |
|
| 138 |
@@ -303,6 +309,7 @@ |
| 139 |
this.model.on_some_change( |
| 140 |
['missing', 'format_type'], |
| 141 |
() => { |
| 142 |
+// @ts-ignore |
| 143 |
this.trigger('renderer-needs-update'); |
| 144 |
}, |
| 145 |
this, |
| 146 |
@@ -324,6 +331,7 @@ |
| 147 |
let formattedValue: string; |
| 148 |
|
| 149 |
if (config.value === null) { |
| 150 |
+// @ts-ignore |
| 151 |
formattedValue = this.model.get('missing'); |
| 152 |
} else { |
| 153 |
const formattingRule = this.process('format', config, null); |
| 154 |
@@ -331,6 +339,7 @@ |
| 155 |
if (formattingRule === null) { |
| 156 |
formattedValue = String(config.value); |
| 157 |
} else { |
| 158 |
+// @ts-ignore |
| 159 |
if (this.model.get('format_type') == 'time') { |
| 160 |
formattedValue = String( |
| 161 |
d3TimeFormat.timeFormat(formattingRule)(new Date(config.value)), |
| 162 |
--- a/js/datagrid.ts |
| 163 |
+++ b/js/datagrid.ts |
| 164 |
@@ -95,14 +95,19 @@ |
| 165 |
this.updateDataSync = this.updateDataSync.bind(this); |
| 166 |
this.syncTransformState = this.syncTransformState.bind(this); |
| 167 |
|
| 168 |
+// @ts-ignore |
| 169 |
this.on('change:_data', this.updateData.bind(this)); |
| 170 |
+// @ts-ignore |
| 171 |
this.on('change:_transforms', this.updateTransforms.bind(this)); |
| 172 |
+// @ts-ignore |
| 173 |
this.on('change:selection_mode', this.updateSelectionModel, this); |
| 174 |
+// @ts-ignore |
| 175 |
this.on('change:selections', this.updateSelections, this); |
| 176 |
this.updateData(); |
| 177 |
this.updateTransforms(); |
| 178 |
this.updateSelectionModel(); |
| 179 |
|
| 180 |
+// @ts-ignore |
| 181 |
this.on('msg:custom', (content) => { |
| 182 |
if (content.event_type === 'cell-changed') { |
| 183 |
this.data_model.setModelData( |
| 184 |
@@ -127,6 +132,7 @@ |
| 185 |
break; |
| 186 |
case 'cell-edit-event': |
| 187 |
// Update data in widget model |
| 188 |
+// @ts-ignore |
| 189 |
const newData = this.get('_data') as DataSource; |
| 190 |
newData.data[msg.column][msg.row] = msg.value; |
| 191 |
this.set('_data', newData); |
| 192 |
@@ -167,6 +173,7 @@ |
| 193 |
this.data_model.dataSync.connect(this.updateDataSync); |
| 194 |
|
| 195 |
this.updateTransforms(); |
| 196 |
+// @ts-ignore |
| 197 |
this.trigger('data-model-changed'); |
| 198 |
this.updateSelectionModel(); |
| 199 |
} |
| 200 |
@@ -186,6 +193,7 @@ |
| 201 |
this.selectionModel.clear(); |
| 202 |
} |
| 203 |
|
| 204 |
+// @ts-ignore |
| 205 |
const selectionMode = this.get('selection_mode'); |
| 206 |
|
| 207 |
if (selectionMode === 'none') { |
| 208 |
@@ -197,6 +205,7 @@ |
| 209 |
dataModel: this.data_model, |
| 210 |
}); |
| 211 |
this.selectionModel.selectionMode = selectionMode; |
| 212 |
+// @ts-ignore |
| 213 |
this.trigger('selection-model-changed'); |
| 214 |
|
| 215 |
this.selectionModel.changed.connect( |
| 216 |
@@ -266,6 +275,7 @@ |
| 217 |
|
| 218 |
this.synchingWithKernel = true; |
| 219 |
|
| 220 |
+// @ts-ignore |
| 221 |
const selections = this.get('selections'); |
| 222 |
this.selectionModel.clear(); |
| 223 |
|
| 224 |
@@ -285,6 +295,7 @@ |
| 225 |
} |
| 226 |
|
| 227 |
get data(): DataSource { |
| 228 |
+// @ts-ignore |
| 229 |
return this.get('_data'); |
| 230 |
} |
| 231 |
|
| 232 |
@@ -417,12 +428,18 @@ |
| 233 |
protected _createGrid(): FeatherGrid { |
| 234 |
return new FeatherGrid({ |
| 235 |
defaultSizes: { |
| 236 |
+// @ts-ignore |
| 237 |
rowHeight: this.model.get('base_row_size'), |
| 238 |
+// @ts-ignore |
| 239 |
columnWidth: this.model.get('base_column_size'), |
| 240 |
+// @ts-ignore |
| 241 |
rowHeaderWidth: this.model.get('base_row_header_size'), |
| 242 |
+// @ts-ignore |
| 243 |
columnHeaderHeight: this.model.get('base_column_header_size'), |
| 244 |
}, |
| 245 |
+// @ts-ignore |
| 246 |
headerVisibility: this.model.get('header_visibility'), |
| 247 |
+// @ts-ignore |
| 248 |
style: this.model.get('grid_style'), |
| 249 |
}); |
| 250 |
} |
| 251 |
@@ -430,13 +447,16 @@ |
| 252 |
render(): Promise<void> { |
| 253 |
this.el.classList.add('datagrid-container'); |
| 254 |
window.addEventListener('resize', this.manageResizeEvent); |
| 255 |
+// @ts-ignore |
| 256 |
this.once('remove', () => { |
| 257 |
window.removeEventListener('resize', this.manageResizeEvent); |
| 258 |
}); |
| 259 |
|
| 260 |
this.grid = this._createGrid(); |
| 261 |
|
| 262 |
+// @ts-ignore |
| 263 |
this.grid.columnWidths = this.model.get('column_widths'); |
| 264 |
+// @ts-ignore |
| 265 |
this.grid.editable = this.model.get('editable'); |
| 266 |
// this.default_renderer must be created after setting grid.isLightTheme |
| 267 |
// for proper color variable initialization |
| 268 |
@@ -476,37 +496,49 @@ |
| 269 |
// argument to model.send() function in the model class. |
| 270 |
this.model._view_callbacks = this.callbacks(); |
| 271 |
|
| 272 |
+// @ts-ignore |
| 273 |
this.model.on('data-model-changed', () => { |
| 274 |
this.grid.dataModel = this.model.data_model; |
| 275 |
this.handleColumnAutoFit(); |
| 276 |
}); |
| 277 |
|
| 278 |
+// @ts-ignore |
| 279 |
this.model.on('change:base_row_size', () => { |
| 280 |
+// @ts-ignore |
| 281 |
this.grid.baseRowSize = this.model.get('base_row_size'); |
| 282 |
}); |
| 283 |
|
| 284 |
+// @ts-ignore |
| 285 |
this.model.on('change:base_column_size', () => { |
| 286 |
+// @ts-ignore |
| 287 |
this.grid.baseColumnSize = this.model.get('base_column_size'); |
| 288 |
}); |
| 289 |
|
| 290 |
+// @ts-ignore |
| 291 |
this.model.on('change:column_widths', () => { |
| 292 |
this.grid.columnWidths = this.model.get('column_widths'); |
| 293 |
}); |
| 294 |
|
| 295 |
+// @ts-ignore |
| 296 |
this.model.on('change:base_row_header_size', () => { |
| 297 |
+// @ts-ignore |
| 298 |
this.grid.baseRowHeaderSize = this.model.get('base_row_header_size'); |
| 299 |
}); |
| 300 |
|
| 301 |
+// @ts-ignore |
| 302 |
this.model.on('change:base_column_header_size', () => { |
| 303 |
+// @ts-ignore |
| 304 |
this.grid.baseColumnHeaderSize = this.model.get( |
| 305 |
'base_column_header_size', |
| 306 |
); |
| 307 |
}); |
| 308 |
|
| 309 |
+// @ts-ignore |
| 310 |
this.model.on('change:header_visibility', () => { |
| 311 |
this.grid.headerVisibility = this.model.get('header_visibility'); |
| 312 |
}); |
| 313 |
|
| 314 |
+// @ts-ignore |
| 315 |
this.model.on_some_change( |
| 316 |
[ |
| 317 |
'corner_renderer', |
| 318 |
@@ -523,11 +555,15 @@ |
| 319 |
this, |
| 320 |
); |
| 321 |
|
| 322 |
+// @ts-ignore |
| 323 |
this.model.on('selection-model-changed', () => { |
| 324 |
this.grid.selectionModel = this.model.selectionModel; |
| 325 |
}); |
| 326 |
+// @ts-ignore |
| 327 |
|
| 328 |
+// @ts-ignore |
| 329 |
this.model.on('change:editable', () => { |
| 330 |
+// @ts-ignore |
| 331 |
this.grid.editable = this.model.get('editable'); |
| 332 |
}); |
| 333 |
|
| 334 |
@@ -539,6 +575,7 @@ |
| 335 |
this, |
| 336 |
); |
| 337 |
|
| 338 |
+// @ts-ignore |
| 339 |
if (this.model.get('auto_fit_columns')) { |
| 340 |
this.handleColumnAutoFit(); |
| 341 |
} |
| 342 |
@@ -552,14 +589,17 @@ |
| 343 |
|
| 344 |
private handleColumnAutoFit() { |
| 345 |
// Check whether we need to auto-fit or revert to base size. |
| 346 |
+// @ts-ignore |
| 347 |
const shouldAutoFit = this.model.get('auto_fit_columns'); |
| 348 |
if (!shouldAutoFit) { |
| 349 |
+// @ts-ignore |
| 350 |
this.grid.baseColumnSize = this.model.get('base_column_size'); |
| 351 |
// Terminate call here if not auto-fitting. |
| 352 |
return; |
| 353 |
} |
| 354 |
|
| 355 |
// Retrieve user-defined auto-fit params |
| 356 |
+// @ts-ignore |
| 357 |
let { area, padding, numCols } = this.model.get('auto_fit_params'); |
| 358 |
|
| 359 |
// Data validation on params |
| 360 |
@@ -574,27 +614,33 @@ |
| 361 |
private updateRenderers() { |
| 362 |
// Unlisten to previous renderers |
| 363 |
if (this.default_renderer) { |
| 364 |
+// @ts-ignore |
| 365 |
this.stopListening(this.default_renderer, 'renderer-changed'); |
| 366 |
} |
| 367 |
if (this.header_renderer) { |
| 368 |
+// @ts-ignore |
| 369 |
this.stopListening(this.header_renderer, 'renderer-changed'); |
| 370 |
} |
| 371 |
if (this.corner_renderer) { |
| 372 |
+// @ts-ignore |
| 373 |
this.stopListening(this.corner_renderer, 'renderer-changed'); |
| 374 |
} |
| 375 |
for (const key in this.renderers) { |
| 376 |
+// @ts-ignore |
| 377 |
this.stopListening(this.renderers[key], 'renderer-changed'); |
| 378 |
} |
| 379 |
|
| 380 |
// And create views for new renderers |
| 381 |
const promises = []; |
| 382 |
|
| 383 |
+// @ts-ignore |
| 384 |
const default_renderer = this.model.get('default_renderer'); |
| 385 |
promises.push( |
| 386 |
this.create_child_view(default_renderer).then( |
| 387 |
(defaultRendererView: any) => { |
| 388 |
this.default_renderer = defaultRendererView; |
| 389 |
|
| 390 |
+// @ts-ignore |
| 391 |
this.listenTo( |
| 392 |
this.default_renderer, |
| 393 |
'renderer-changed', |
| 394 |
@@ -604,6 +650,7 @@ |
| 395 |
), |
| 396 |
); |
| 397 |
|
| 398 |
+// @ts-ignore |
| 399 |
const corner_renderer = this.model.get('corner_renderer'); |
| 400 |
if (corner_renderer) { |
| 401 |
promises.push( |
| 402 |
@@ -611,6 +658,7 @@ |
| 403 |
(cornerRendererView: any) => { |
| 404 |
this.corner_renderer = cornerRendererView; |
| 405 |
|
| 406 |
+// @ts-ignore |
| 407 |
this.listenTo( |
| 408 |
this.corner_renderer, |
| 409 |
'renderer-changed', |
| 410 |
@@ -621,6 +669,7 @@ |
| 411 |
); |
| 412 |
} |
| 413 |
|
| 414 |
+// @ts-ignore |
| 415 |
const header_renderer = this.model.get('header_renderer'); |
| 416 |
if (header_renderer) { |
| 417 |
promises.push( |
| 418 |
@@ -628,6 +677,7 @@ |
| 419 |
(headerRendererView: any) => { |
| 420 |
this.header_renderer = headerRendererView; |
| 421 |
|
| 422 |
+// @ts-ignore |
| 423 |
this.listenTo( |
| 424 |
this.header_renderer, |
| 425 |
'renderer-changed', |
| 426 |
@@ -640,6 +690,7 @@ |
| 427 |
|
| 428 |
const renderer_promises: Dict<Promise<any>> = {}; |
| 429 |
_.each( |
| 430 |
+// @ts-ignore |
| 431 |
this.model.get('renderers'), |
| 432 |
(model: CellRendererModel, key: string) => { |
| 433 |
renderer_promises[key] = this.create_child_view(model); |
| 434 |
@@ -651,6 +702,7 @@ |
| 435 |
this.renderers = rendererViews; |
| 436 |
|
| 437 |
for (const key in rendererViews) { |
| 438 |
+// @ts-ignore |
| 439 |
this.listenTo( |
| 440 |
rendererViews[key], |
| 441 |
'renderer-changed', |
| 442 |
@@ -695,6 +747,7 @@ |
| 443 |
}); |
| 444 |
} |
| 445 |
|
| 446 |
+// @ts-ignore |
| 447 |
const hasHeaderRenderer = this.model.get('header_renderer') !== null; |
| 448 |
let columnHeaderRenderer = null; |
| 449 |
if (this.header_renderer && hasHeaderRenderer) { |
| 450 |
--- a/js/feathergrid.ts |
| 451 |
+++ b/js/feathergrid.ts |
| 452 |
@@ -478,6 +478,7 @@ |
| 453 |
|
| 454 |
// Resetting grid style if theme changes. |
| 455 |
if (this.backboneModel) { |
| 456 |
+// @ts-ignore |
| 457 |
this.grid.style = this.backboneModel.get('grid_style'); |
| 458 |
} |
| 459 |
// Always apply FeatherGrid Theme |
| 460 |
@@ -865,6 +866,7 @@ |
| 461 |
// been passed for the former. |
| 462 |
let hasCornerRenderer = false; |
| 463 |
if (this.backboneModel) { |
| 464 |
+// @ts-ignore |
| 465 |
hasCornerRenderer = this.backboneModel.get('corner_renderer') !== null; |
| 466 |
} |
| 467 |
|
| 468 |
--- a/js/vegaexpr.ts |
| 469 |
+++ b/js/vegaexpr.ts |
| 470 |
@@ -49,6 +49,7 @@ |
| 471 |
this._codegen = vegaExpressions.codegen(codegen_params); |
| 472 |
|
| 473 |
this.updateFunction(); |
| 474 |
+// @ts-ignore |
| 475 |
this.on('change:value', this.updateFunction.bind(this)); |
| 476 |
} |
| 477 |
|
| 478 |
@@ -91,6 +92,7 @@ |
| 479 |
|
| 480 |
private updateFunction() { |
| 481 |
let parsedValue: ParsedVegaExpr = this._codegen( |
| 482 |
+// @ts-ignore |
| 483 |
vegaExpressions.parse(this.get('value')), |
| 484 |
); |
| 485 |
|
| 486 |
--- a/tests/js/datagrid.test.ts |
| 487 |
+++ b/tests/js/datagrid.test.ts |
| 488 |
@@ -48,6 +48,7 @@ |
| 489 |
grid.model.set('_data', testData.set2.data); |
| 490 |
|
| 491 |
return new Promise<void>((resolve, reject) => { |
| 492 |
+// @ts-ignore |
| 493 |
grid.model.on('msg:custom', (content) => { |
| 494 |
if (content.event_type === 'cell-changed') { |
| 495 |
expect(content.row).toBe(row); |
| 496 |
@@ -255,6 +256,7 @@ |
| 497 |
const widgetManager = new MockWidgetManager(); |
| 498 |
const comm = new MockComm(); |
| 499 |
const gridModel = new DataGridModel( |
| 500 |
+// @ts-ignore |
| 501 |
{ ...options.modelAttributes, _data: options.data }, |
| 502 |
{ |
| 503 |
model_id: 'testModel', |