@coreui/data-grid 0.1.0-rc.0 → 0.2.0-rc.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.
Files changed (137) hide show
  1. package/README.md +5 -4
  2. package/dist/css/data-grid.css +149 -31
  3. package/dist/css/data-grid.css.map +1 -1
  4. package/dist/css/data-grid.min.css +2 -2
  5. package/dist/css/data-grid.min.css.map +1 -1
  6. package/dist/js/clipboard.cjs +56 -0
  7. package/dist/js/clipboard.cjs.map +1 -0
  8. package/dist/js/clipboard.mjs +54 -0
  9. package/dist/js/clipboard.mjs.map +1 -0
  10. package/dist/js/csv.cjs +36 -59
  11. package/dist/js/csv.cjs.map +1 -1
  12. package/dist/js/csv.mjs +35 -55
  13. package/dist/js/csv.mjs.map +1 -1
  14. package/dist/js/data-grid.esm.js +14078 -9332
  15. package/dist/js/data-grid.esm.js.map +1 -1
  16. package/dist/js/data-grid.esm.min.js +6 -6
  17. package/dist/js/data-grid.esm.min.js.map +1 -1
  18. package/dist/js/data-grid.js +14377 -9634
  19. package/dist/js/data-grid.js.map +1 -1
  20. package/dist/js/data-grid.lite.esm.js +10476 -0
  21. package/dist/js/data-grid.lite.esm.js.map +1 -0
  22. package/dist/js/data-grid.lite.esm.min.js +8 -0
  23. package/dist/js/data-grid.lite.esm.min.js.map +1 -0
  24. package/dist/js/data-grid.lite.js +10489 -0
  25. package/dist/js/data-grid.lite.js.map +1 -0
  26. package/dist/js/data-grid.lite.min.js +8 -0
  27. package/dist/js/data-grid.lite.min.js.map +1 -0
  28. package/dist/js/data-grid.lite.mjs +10476 -0
  29. package/dist/js/data-grid.lite.mjs.map +1 -0
  30. package/dist/js/data-grid.min.js +6 -6
  31. package/dist/js/data-grid.min.js.map +1 -1
  32. package/dist/js/data-grid.mjs +14078 -9332
  33. package/dist/js/data-grid.mjs.map +1 -1
  34. package/dist/js/drag.cjs +459 -0
  35. package/dist/js/drag.cjs.map +1 -0
  36. package/dist/js/drag.mjs +456 -0
  37. package/dist/js/drag.mjs.map +1 -0
  38. package/dist/js/export-table-CNAKStzj.mjs +26 -0
  39. package/dist/js/export-table-CNAKStzj.mjs.map +1 -0
  40. package/dist/js/export-table-doIwvE5U.cjs +55 -0
  41. package/dist/js/export-table-doIwvE5U.cjs.map +1 -0
  42. package/dist/js/filters.cjs +89 -132
  43. package/dist/js/filters.cjs.map +1 -1
  44. package/dist/js/filters.mjs +88 -128
  45. package/dist/js/filters.mjs.map +1 -1
  46. package/dist/js/labels.cjs +65 -70
  47. package/dist/js/labels.cjs.map +1 -1
  48. package/dist/js/labels.mjs +64 -66
  49. package/dist/js/labels.mjs.map +1 -1
  50. package/dist/js/print.cjs +66 -0
  51. package/dist/js/print.cjs.map +1 -0
  52. package/dist/js/print.mjs +64 -0
  53. package/dist/js/print.mjs.map +1 -0
  54. package/dist/js/validate.cjs +43 -0
  55. package/dist/js/validate.cjs.map +1 -0
  56. package/dist/js/validate.mjs +42 -0
  57. package/dist/js/validate.mjs.map +1 -0
  58. package/dist/js/xlsx.cjs +240 -0
  59. package/dist/js/xlsx.cjs.map +1 -0
  60. package/dist/js/xlsx.mjs +238 -0
  61. package/dist/js/xlsx.mjs.map +1 -0
  62. package/dist/types/base-component.d.ts +28 -18
  63. package/dist/types/data-grid.d.ts +26 -13
  64. package/dist/types/dom/data.d.ts +15 -0
  65. package/dist/types/dom/event-handler.d.ts +21 -10
  66. package/dist/types/dom/manipulator.d.ts +15 -8
  67. package/dist/types/engine/data-source.d.ts +1 -1
  68. package/dist/types/engine/features-lite.d.ts +25 -0
  69. package/dist/types/engine/features.d.ts +35 -0
  70. package/dist/types/engine/table.d.ts +3 -3
  71. package/dist/types/engine/validate.d.mts +1 -0
  72. package/dist/types/engine/validate.d.ts +20 -0
  73. package/dist/types/engine/virtualizer.d.ts +2 -0
  74. package/dist/types/icons.d.ts +6 -4
  75. package/dist/types/index-lite.d.mts +1 -0
  76. package/dist/types/index-lite.d.ts +19 -0
  77. package/dist/types/index.d.ts +11 -2
  78. package/dist/types/types.d.ts +53 -31
  79. package/dist/types/ui/body.d.ts +6 -3
  80. package/dist/types/ui/header.d.ts +3 -2
  81. package/dist/types/ui/loading.d.ts +1 -1
  82. package/dist/types/ui/pinning.d.ts +1 -1
  83. package/dist/types/ui/toolbar.d.ts +10 -2
  84. package/dist/types/util/clipboard.d.mts +1 -0
  85. package/dist/types/util/clipboard.d.ts +29 -0
  86. package/dist/types/util/config.d.ts +27 -10
  87. package/dist/types/util/csv.d.ts +5 -5
  88. package/dist/types/util/drag.d.mts +1 -0
  89. package/dist/types/util/drag.d.ts +48 -0
  90. package/dist/types/util/export-table.d.ts +47 -0
  91. package/dist/types/util/index.d.ts +66 -10
  92. package/dist/types/util/print.d.mts +1 -0
  93. package/dist/types/util/print.d.ts +32 -0
  94. package/dist/types/util/sanitizer.d.ts +15 -11
  95. package/dist/types/util/xlsx.d.mts +1 -0
  96. package/dist/types/util/xlsx.d.ts +17 -0
  97. package/dist/types/util/zip.d.ts +11 -0
  98. package/package.json +88 -10
  99. package/scss/data-grid.scss +204 -16
  100. package/src/{base-component.js → base-component.ts} +21 -17
  101. package/src/data-grid.ts +507 -200
  102. package/src/dom/{data.js → data.ts} +13 -10
  103. package/src/dom/event-handler.ts +380 -0
  104. package/src/dom/{manipulator.js → manipulator.ts} +11 -11
  105. package/src/engine/data-source.ts +7 -3
  106. package/src/engine/features-lite.ts +47 -0
  107. package/src/engine/features.ts +68 -0
  108. package/src/engine/table.ts +80 -47
  109. package/src/engine/validate.ts +64 -0
  110. package/src/engine/virtualizer.ts +17 -1
  111. package/src/icons.ts +11 -5
  112. package/src/index-lite.ts +85 -0
  113. package/src/index.ts +30 -2
  114. package/src/labels.ts +6 -4
  115. package/src/types.ts +87 -32
  116. package/src/ui/body.ts +73 -17
  117. package/src/ui/header.ts +51 -26
  118. package/src/ui/loading.ts +2 -2
  119. package/src/ui/pinning.ts +16 -16
  120. package/src/ui/toolbar.ts +27 -3
  121. package/src/util/clipboard.ts +112 -0
  122. package/src/util/{config.js → config.ts} +25 -11
  123. package/src/util/csv.ts +11 -30
  124. package/src/util/drag.ts +798 -0
  125. package/src/util/export-table.ts +86 -0
  126. package/src/util/{index.js → index.ts} +55 -35
  127. package/src/util/print.ts +125 -0
  128. package/src/util/{sanitizer.js → sanitizer.ts} +17 -13
  129. package/src/util/xlsx.ts +183 -0
  130. package/src/util/zip.ts +170 -0
  131. package/src/base-component.d.ts +0 -19
  132. package/src/dom/event-handler.d.ts +0 -11
  133. package/src/dom/event-handler.js +0 -331
  134. package/src/dom/manipulator.d.ts +0 -9
  135. package/src/util/config.d.ts +0 -11
  136. package/src/util/index.d.ts +0 -10
  137. package/src/util/sanitizer.d.ts +0 -11
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * CoreUI PRO data-grid.scss v0.1.0
2
+ * CoreUI PRO data-grid.scss v0.2.0
3
3
  * License (https://coreui.io/pro/license/)
4
4
  */
5
5
 
@@ -7,12 +7,23 @@
7
7
  // The column menu is positioned against the grid root (it must escape the
8
8
  // viewport's overflow while staying inside the token scope).
9
9
  position: relative;
10
+ // A column so that a root given an explicit height actually constrains the
11
+ // scroller: the viewport takes what the toolbar and pagination leave, and
12
+ // min-height: 0 lets it shrink below its content instead of overflowing the
13
+ // root. With no height set, this changes nothing — the viewport is sized by
14
+ // its content up to the max-height token.
15
+ display: flex;
16
+ flex-direction: column;
10
17
 
11
18
  // Component tokens. Everything resolves through CoreUI semantic variables,
12
19
  // so light/dark theming via [data-coreui-theme] works with no extra rules.
13
20
  --cui-data-grid-viewport-max-height: 30rem;
14
21
  --cui-data-grid-header-bg: var(--cui-body-bg, #fff);
15
22
  --cui-data-grid-header-shadow: inset 0 calc(-1 * var(--cui-border-width, 1px)) 0 var(--cui-border-color, #dee2e6);
23
+ --cui-data-grid-cell-selected-bg: rgba(var(--cui-primary-rgb, 50, 31, 219), .12);
24
+ --cui-data-grid-cell-selected-border-color: var(--cui-primary, #321fdb);
25
+ --cui-data-grid-cell-selected-border-width: 1px;
26
+ --cui-data-grid-row-handle-width: 2rem;
16
27
  --cui-data-grid-select-cell-width: 2.5rem;
17
28
  --cui-data-grid-sorter-margin: .25rem;
18
29
  --cui-data-grid-sorter-opacity: .3;
@@ -24,6 +35,7 @@
24
35
  --cui-data-grid-pinned-border-width: var(--cui-border-width);
25
36
  --cui-data-grid-pinned-border-color: var(--cui-border-color, #dee2e6);
26
37
  --cui-data-grid-drop-indicator: var(--cui-primary, #321fdb);
38
+ --cui-data-grid-drag-transition: .15s ease;
27
39
  --cui-data-grid-menu-bg: var(--cui-body-bg, #fff);
28
40
  --cui-data-grid-menu-border-color: var(--cui-border-color, #dee2e6);
29
41
  --cui-data-grid-menu-shadow: var(--cui-box-shadow, 0 .5rem 1rem rgba(0, 0, 0, .15));
@@ -56,6 +68,8 @@
56
68
 
57
69
  .data-grid-viewport {
58
70
  position: relative;
71
+ flex: 1 1 auto;
72
+ min-height: 0;
59
73
  max-height: var(--cui-data-grid-viewport-max-height);
60
74
  overflow-y: auto;
61
75
  // Windowed rendering resizes the spacer rows and recycles row elements on
@@ -303,12 +317,127 @@
303
317
  background-color: var(--cui-data-grid-menu-border-color);
304
318
  }
305
319
 
306
- .data-grid-header .data-grid-dragging {
320
+ .data-grid-dragging {
307
321
  opacity: .5;
308
322
  }
309
323
 
310
- .data-grid-header .data-grid-drop-target {
311
- box-shadow: inset .125rem 0 0 var(--cui-data-grid-drop-indicator);
324
+ // While a drag is live the whole grid keeps the grabbing cursor and stops
325
+ // painting a text selection under the pointer.
326
+ &.data-grid-drag-active {
327
+ cursor: grabbing;
328
+ user-select: none;
329
+ }
330
+
331
+ // Both overlays are position: fixed (placed from viewport coordinates in JS)
332
+ // so they escape the viewport's overflow, like the tooltip.
333
+ .data-grid-drag-ghost {
334
+ position: fixed;
335
+ top: 0;
336
+ left: 0;
337
+ z-index: 1080;
338
+ display: flex;
339
+ align-items: center;
340
+ max-width: 16rem;
341
+ padding: 0 var(--cui-data-grid-cell-padding-x, .5rem);
342
+ overflow: hidden;
343
+ font-weight: 600;
344
+ text-overflow: ellipsis;
345
+ white-space: nowrap;
346
+ pointer-events: none;
347
+ background-color: var(--cui-data-grid-pinned-bg);
348
+ border: var(--cui-border-width, 1px) solid var(--cui-data-grid-drop-indicator);
349
+ border-radius: var(--cui-border-radius, .375rem);
350
+ box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15);
351
+ transform: translate(-9999px, -9999px);
352
+ opacity: .9;
353
+ }
354
+
355
+ // The settling ghost: on release it flies from the pointer to the slot the
356
+ // item landed in (or back home on cancel) and fades out there.
357
+ .data-grid-drag-ghost-settle {
358
+ transition: transform var(--cui-data-grid-drag-transition), opacity var(--cui-data-grid-drag-transition);
359
+ }
360
+
361
+ .data-grid-drop-indicator {
362
+ position: fixed;
363
+ z-index: 1080;
364
+ pointer-events: none;
365
+ background-color: var(--cui-data-grid-drop-indicator);
366
+ transition: top var(--cui-data-grid-drag-transition), left var(--cui-data-grid-drag-transition);
367
+ }
368
+
369
+ // The live reorder preview: cells slide to the layout the drop will produce.
370
+ // Transform only, so nothing reflows and the real order still changes once.
371
+ .data-grid-drag-preview {
372
+ transition: transform var(--cui-data-grid-drag-transition);
373
+ }
374
+
375
+ // Someone who asked the OS to stop moving things still gets the preview —
376
+ // it snaps to the final layout instead of gliding there.
377
+ @media (prefers-reduced-motion: reduce) {
378
+ :is(.data-grid-drop-indicator, .data-grid-drag-preview, .data-grid-drag-ghost-settle) {
379
+ transition: none;
380
+ }
381
+ }
382
+
383
+ // The line is 2px across its short axis and spans the grid along the other;
384
+ // JS sets the spanning size, the axis class sets the thickness.
385
+ .data-grid-drop-indicator-x {
386
+ width: .125rem;
387
+ }
388
+
389
+ .data-grid-drop-indicator-y {
390
+ height: .125rem;
391
+ }
392
+
393
+ // Cell selection: a tinted fill on every selected cell, plus an outline
394
+ // drawn only on the sides that sit on the selection's boundary — so a
395
+ // rectangle reads as one region instead of a grid of boxes. The outline is
396
+ // an overlay rather than a border: a border on a table cell would shift the
397
+ // whole row's layout the moment a range is selected.
398
+ .data-grid-cell-selected {
399
+ position: relative;
400
+ background-color: var(--cui-data-grid-cell-selected-bg);
401
+ }
402
+
403
+ .data-grid-cell-selected::after {
404
+ position: absolute;
405
+ inset: 0;
406
+ pointer-events: none;
407
+ content: "";
408
+ border: 0 solid var(--cui-data-grid-cell-selected-border-color);
409
+ }
410
+
411
+ .data-grid-cell-selected-top::after {
412
+ border-top-width: var(--cui-data-grid-cell-selected-border-width);
413
+ }
414
+
415
+ .data-grid-cell-selected-right::after {
416
+ border-right-width: var(--cui-data-grid-cell-selected-border-width);
417
+ }
418
+
419
+ .data-grid-cell-selected-bottom::after {
420
+ border-bottom-width: var(--cui-data-grid-cell-selected-border-width);
421
+ }
422
+
423
+ .data-grid-cell-selected-left::after {
424
+ border-left-width: var(--cui-data-grid-cell-selected-border-width);
425
+ }
426
+
427
+ // The reorder column: as narrow as the grip, and the grip itself is the only
428
+ // thing that starts a row drag (a row is full of interactive content that a
429
+ // whole-row handle would swallow).
430
+ .data-grid-row-handle-cell {
431
+ width: var(--cui-data-grid-row-handle-width);
432
+ padding-inline: 0;
433
+ text-align: center;
434
+ }
435
+
436
+ .data-grid-row-handle {
437
+ display: inline-flex;
438
+ color: var(--cui-data-grid-resizer-grip-color-hover);
439
+ cursor: grab;
440
+ touch-action: none;
312
441
  }
313
442
 
314
443
  .data-grid-select-cell {
@@ -368,7 +497,11 @@
368
497
  // fixed-height virtualizer (wrapping would desync `estimateSize`). Pinned cells
369
498
  // are excluded so their shadow pseudo-element (painted outside the box via a
370
499
  // translate) isn't clipped; the select cell holds only a checkbox.
371
- .data-grid-viewport > .table > tbody > tr:not(.data-grid-empty) > td:not(.data-grid-select-cell):not(.data-grid-cell-pinned-left):not(.data-grid-cell-pinned-right) {
500
+ //
501
+ // Auto row height is the deliberate exception: there the virtualizer measures
502
+ // each row, so cells are free to wrap. Scoping the rule out is what keeps the
503
+ // two modes from fighting over specificity.
504
+ &:not(.data-grid-auto-row-height) .data-grid-viewport > .table > tbody > tr:not(.data-grid-empty) > td:not(.data-grid-select-cell):not(.data-grid-cell-pinned-start):not(.data-grid-cell-pinned-end) {
372
505
  overflow: hidden;
373
506
  text-overflow: ellipsis;
374
507
  white-space: nowrap;
@@ -392,7 +525,7 @@
392
525
 
393
526
  // A pinned th is already sticky (a positioned containing block for the
394
527
  // resizer), so only non-pinned header cells need explicit relative here.
395
- &.data-grid-resizable .data-grid-header th:not(.data-grid-cell-pinned-left):not(.data-grid-cell-pinned-right) {
528
+ &.data-grid-resizable .data-grid-header th:not(.data-grid-cell-pinned-start):not(.data-grid-cell-pinned-end) {
396
529
  position: relative;
397
530
  }
398
531
 
@@ -403,22 +536,22 @@
403
536
  border-spacing: 0;
404
537
  }
405
538
 
406
- .data-grid-cell-pinned-left,
407
- .data-grid-cell-pinned-right {
539
+ .data-grid-cell-pinned-start,
540
+ .data-grid-cell-pinned-end {
408
541
  position: sticky;
409
542
  z-index: 1;
410
543
  background-color: var(--cui-data-grid-pinned-bg);
411
544
  }
412
545
 
413
- .data-grid-header .data-grid-cell-pinned-left,
414
- .data-grid-header .data-grid-cell-pinned-right {
546
+ .data-grid-header .data-grid-cell-pinned-start,
547
+ .data-grid-header .data-grid-cell-pinned-end {
415
548
  z-index: 3;
416
549
  }
417
550
 
418
551
  // Edge cells cast a shadow over the scrolling content. A pseudo-element is
419
552
  // used because the cell's own box-shadow carries the table striping accent.
420
- .data-grid-cell-pinned-left-last,
421
- .data-grid-cell-pinned-right-first {
553
+ .data-grid-cell-pinned-start-last,
554
+ .data-grid-cell-pinned-end-first {
422
555
  position: sticky;
423
556
 
424
557
  &::after {
@@ -431,13 +564,13 @@
431
564
  }
432
565
  }
433
566
 
434
- .data-grid-cell-pinned-left-last::after {
435
- right: 0;
567
+ .data-grid-cell-pinned-start-last::after {
568
+ inset-inline-end: 0;
436
569
  background: var(--cui-data-grid-pinned-border-color);
437
570
  }
438
571
 
439
- .data-grid-cell-pinned-right-first::after {
440
- left: 0;
572
+ .data-grid-cell-pinned-end-first::after {
573
+ inset-inline-start: 0;
441
574
  background: var(--cui-data-grid-pinned-border-color);
442
575
  }
443
576
 
@@ -504,6 +637,19 @@
504
637
  background-color: var(--cui-data-grid-loading-bg);
505
638
  }
506
639
 
640
+ // Infinite scroll's "next page arriving" strip. Sticky, not an overlay: the
641
+ // rows already loaded stay readable while the grid appends to them.
642
+ .data-grid-loading-more {
643
+ position: sticky;
644
+ inset-inline: 0;
645
+ bottom: 0;
646
+ z-index: 3;
647
+ display: flex;
648
+ justify-content: center;
649
+ padding: var(--cui-data-grid-spacing);
650
+ background-color: var(--cui-data-grid-loading-bg);
651
+ }
652
+
507
653
  // Shared icon-button tooltip. position: fixed (set in JS) so it escapes the
508
654
  // viewport overflow; theme-inverted like CoreUI's own tooltip.
509
655
  .data-grid-tooltip {
@@ -557,3 +703,45 @@
557
703
  }
558
704
  }
559
705
  }
706
+
707
+ // Print: the grid renders a plain, complete table into the document (see
708
+ // util/print.ts) and hides everything else, so a virtualized grid prints all
709
+ // its rows instead of the twenty in the window.
710
+ @media print {
711
+ .data-grid-print-root {
712
+ position: absolute;
713
+ inset: 0 0 auto;
714
+ z-index: 2000;
715
+ background-color: #fff;
716
+
717
+ h1 {
718
+ margin-bottom: 1rem;
719
+ font-size: 1.25rem;
720
+ }
721
+
722
+ table {
723
+ width: 100%;
724
+ border-collapse: collapse;
725
+ }
726
+
727
+ :is(th, td) {
728
+ padding: .25rem .5rem;
729
+ text-align: start;
730
+ border: 1px solid #000;
731
+ }
732
+
733
+ thead {
734
+ display: table-header-group;
735
+ }
736
+
737
+ tr {
738
+ break-inside: avoid;
739
+ }
740
+ }
741
+
742
+ // :has() is inside the browser floor (.browserslistrc), and scoping to the
743
+ // body's own children keeps the clone's ancestors from being hidden.
744
+ body:has(.data-grid-print-root) > :not(.data-grid-print-root) {
745
+ display: none !important;
746
+ }
747
+ }
@@ -1,17 +1,17 @@
1
- // Vendored from https://github.com/coreui/coreui-pro/blob/bc4daf1cd79d527bf665d615c0a31f53ab0c3d4e/js/src/base-component.js — sync manually
1
+ // Vendored from https://github.com/coreui/coreui-pro/blob/e9355580e/js/src/base-component.ts — sync manually
2
2
  /**
3
3
  * --------------------------------------------------------------------------
4
- * CoreUI base-component.js
4
+ * CoreUI base-component.ts
5
5
  * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
6
6
  *
7
- * This component is a modified version of the Bootstrap's base-component.js
7
+ * This component is a modified version of the Bootstrap's base-component.ts
8
8
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
9
9
  * --------------------------------------------------------------------------
10
10
  */
11
11
 
12
12
  import Data from './dom/data.js'
13
13
  import EventHandler from './dom/event-handler.js'
14
- import Config from './util/config.js'
14
+ import Config, { type ComponentConfig } from './util/config.js'
15
15
  import { executeAfterTransition, getElement } from './util/index.js'
16
16
 
17
17
  /**
@@ -25,7 +25,11 @@ const VERSION = '0.1.0'
25
25
  */
26
26
 
27
27
  class BaseComponent extends Config {
28
- constructor(element, config) {
28
+ declare ['constructor']: typeof BaseComponent
29
+ protected declare _element: HTMLElement
30
+ protected declare _config: ComponentConfig
31
+
32
+ constructor(element?: string | Element | null, config?: ComponentConfig | null) {
29
33
  super()
30
34
 
31
35
  element = getElement(element)
@@ -33,28 +37,28 @@ class BaseComponent extends Config {
33
37
  return
34
38
  }
35
39
 
36
- this._element = element
40
+ this._element = element as HTMLElement
37
41
  this._config = this._getConfig(config)
38
42
 
39
43
  Data.set(this._element, this.constructor.DATA_KEY, this)
40
44
  }
41
45
 
42
46
  // Public
43
- dispose() {
47
+ dispose(): void {
44
48
  Data.remove(this._element, this.constructor.DATA_KEY)
45
49
  EventHandler.off(this._element, this.constructor.EVENT_KEY)
46
50
 
47
51
  for (const propertyName of Object.getOwnPropertyNames(this)) {
48
- this[propertyName] = null
52
+ (this as Record<string, any>)[propertyName] = null
49
53
  }
50
54
  }
51
55
 
52
56
  // Private
53
- _queueCallback(callback, element, isAnimated = true) {
57
+ _queueCallback(callback: () => void, element: Element, isAnimated = true): void {
54
58
  executeAfterTransition(callback, element, isAnimated)
55
59
  }
56
60
 
57
- _getConfig(config) {
61
+ override _getConfig(config?: ComponentConfig | null): ComponentConfig {
58
62
  config = this._mergeConfigObj(config, this._element)
59
63
  config = this._configAfterMerge(config)
60
64
  this._typeCheckConfig(config)
@@ -62,27 +66,27 @@ class BaseComponent extends Config {
62
66
  }
63
67
 
64
68
  // Static
65
- static getInstance(element) {
69
+ static getInstance<T extends typeof BaseComponent>(this: T, element?: string | Element | null): InstanceType<T> | null {
66
70
  return Data.get(getElement(element), this.DATA_KEY)
67
71
  }
68
72
 
69
- static getOrCreateInstance(element, config = {}) {
70
- return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null)
73
+ static getOrCreateInstance<T extends typeof BaseComponent>(this: T, element?: string | Element | null, config: ComponentConfig | null = {}): InstanceType<T> {
74
+ return this.getInstance(element) || (new this(element, typeof config === 'object' ? config : null) as InstanceType<T>)
71
75
  }
72
76
 
73
- static get VERSION() {
77
+ static get VERSION(): string {
74
78
  return VERSION
75
79
  }
76
80
 
77
- static get DATA_KEY() {
81
+ static get DATA_KEY(): string {
78
82
  return `coreui.${this.NAME}`
79
83
  }
80
84
 
81
- static get EVENT_KEY() {
85
+ static get EVENT_KEY(): string {
82
86
  return `.${this.DATA_KEY}`
83
87
  }
84
88
 
85
- static eventName(name) {
89
+ static eventName(name: string): string {
86
90
  return `${name}${this.EVENT_KEY}`
87
91
  }
88
92
  }