@3mo/data-grid 0.5.9 → 0.5.11

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/dist/DataGrid.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var DataGrid_1;
2
2
  import { __decorate } from "tslib";
3
- import { property, component, Component, html, css, live, query, ifDefined, event, queryAll, style, literal, staticHtml, cache } from '@a11d/lit';
3
+ import { property, component, Component, html, css, live, query, ifDefined, event, style, literal, staticHtml, cache } from '@a11d/lit';
4
4
  import { NotificationComponent } from '@a11d/lit-application';
5
5
  import { LocalStorage } from '@a11d/local-storage';
6
6
  import { InstanceofAttributeController } from '@3mo/instanceof-attribute-controller';
@@ -171,6 +171,12 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
171
171
  }
172
172
  };
173
173
  }
174
+ get rows() {
175
+ const root = this.shallVirtualize
176
+ ? this.renderRoot.querySelector('mo-virtualized-scroller')?.renderRoot.firstElementChild
177
+ : this.renderRoot;
178
+ return [...root?.querySelectorAll('[mo-data-grid-row]') ?? []];
179
+ }
174
180
  setPage(page) {
175
181
  this.page = page;
176
182
  this.pageChange.dispatch(page);
@@ -368,185 +374,185 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
368
374
  this.setPage(1);
369
375
  }
370
376
  static get styles() {
371
- return css `
372
- :host {
373
- --mo-data-grid-column-details-width: 20px;
374
- --mo-data-grid-column-selection-width: 40px;
375
- --mo-data-grid-column-more-width: 20px;
376
-
377
- --mo-data-grid-header-height: 32px;
378
- --mo-data-grid-footer-min-height: 40px;
379
- --mo-data-grid-toolbar-padding: 0px 14px 14px 14px;
380
- --mo-data-grid-border: 1px solid var(--mo-color-transparent-gray-3);
381
-
382
- /* --mo-data-grid-columns Generated in JS */
383
- --mo-data-grid-columns-gap: 6px;
384
-
385
- --mo-data-grid-row-tree-line-width: 8px;
386
- --mo-details-data-grid-start-margin: 26px;
387
-
388
- --mo-data-grid-selection-background: rgba(var(--mo-color-accent-base), 0.5);
389
- display: flex;
390
- flex-direction: column;
391
- height: 100%;
392
- overflow-x: hidden;
393
- }
394
-
395
- :host([data-theme=light]) {
396
- --mo-data-grid-alternating-background: rgba(var(--mo-color-foreground-base), 0.05);
397
- }
398
-
399
- :host([data-theme=dark]) {
400
- --mo-data-grid-alternating-background: rgba(var(--mo-color-background-base), 0.2);
401
- }
402
-
403
- :host([preventVerticalContentScroll]) mo-scroller {
404
- overflow-y: hidden;
405
- }
406
-
407
- :host([preventVerticalContentScroll]) mo-scroller::part(container) {
408
- position: relative;
409
- }
410
-
411
- :host(:not([selectionMode="none"])) {
412
- --mo-data-grid-row-tree-line-width: 18px;
413
- }
414
-
415
- :host([hasDetails]) {
416
- --mo-data-grid-row-tree-line-width: 18px;
417
- }
418
-
419
- #toolbar {
420
- position: relative;
421
- padding: var(--mo-data-grid-toolbar-padding);
422
- }
423
-
424
- #toolbar mo-icon-button {
425
- align-self: flex-start;
426
- color: var(--mo-color-gray);
427
- }
428
-
429
- #flexSelectionToolbar {
430
- background: var(--mo-color-surface);
431
- position: absolute;
432
- inset: 0px;
433
- width: 100%;
434
- height: 100%;
435
- z-index: 1;
436
- }
437
-
438
- #flexSelectionToolbar > mo-flex {
439
- background: var(--mo-data-grid-selection-background);
440
- height: 100%;
441
- align-items: center;
442
- }
443
-
444
- #flexSelectionToolbar mo-icon-button {
445
- align-self: center;
446
- color: var(--mo-color-foreground);
447
- }
448
-
449
- #flexActions {
450
- align-items: center;
451
- justify-content: center;
452
- padding-inline: 14px 6px;
453
- margin: 6px 0;
454
- cursor: pointer;
455
- background: var(--mo-color-accent-transparent);
456
- height: calc(100% - calc(2 * 6px));
457
- max-height: 45px;
458
- }
459
-
460
- #fab {
461
- position: absolute;
462
- top: -72px;
463
- inset-inline-end: 16px;
464
- transition: var(--mo-data-grid-fab-transition, 250ms);
465
- }
466
-
467
- :host([hasFooter]) #fab {
468
- top: -28px;
469
- }
470
-
471
- :host([fabSlotCollapsed][hasFabs]) #fab {
472
- transform: scale(0);
473
- opacity: 0;
474
- }
475
-
476
- mo-data-grid-footer {
477
- transition: var(--mo-data-grid-fab-transition, 250ms);
478
- }
479
-
480
- :host([hasSums][hasFabs]:not([fabSlotCollapsed])) mo-data-grid-footer {
481
- --mo-data-grid-footer-trailing-padding: calc(var(--mo-data-grid-fab-slot-width, 56px) + 16px);
482
- }
483
-
484
- slot[name=fab] {
485
- display: block;
486
- z-index: 1;
487
- }
488
-
489
- mo-empty-state, ::slotted(mo-empty-state) {
490
- height: 100%;
491
- }
492
-
493
- #overlayModeContainer {
494
- position: relative;
495
- height: 100%;
496
- width: 100%;
497
- }
498
-
499
- #overlayModeContainer mo-data-grid-side-panel {
500
- position: absolute;
501
- inset: 0;
502
- width: 100%;
503
- height: 100%;
504
- z-index: 1;
505
- background-color: var(--mo-color-surface);
506
- }
377
+ return css `
378
+ :host {
379
+ --mo-data-grid-column-details-width: 20px;
380
+ --mo-data-grid-column-selection-width: 40px;
381
+ --mo-data-grid-column-more-width: 20px;
382
+
383
+ --mo-data-grid-header-height: 32px;
384
+ --mo-data-grid-footer-min-height: 40px;
385
+ --mo-data-grid-toolbar-padding: 0px 14px 14px 14px;
386
+ --mo-data-grid-border: 1px solid var(--mo-color-transparent-gray-3);
387
+
388
+ /* --mo-data-grid-columns Generated in JS */
389
+ --mo-data-grid-columns-gap: 6px;
390
+
391
+ --mo-data-grid-row-tree-line-width: 8px;
392
+ --mo-details-data-grid-start-margin: 26px;
393
+
394
+ --mo-data-grid-selection-background: rgba(var(--mo-color-accent-base), 0.5);
395
+ display: flex;
396
+ flex-direction: column;
397
+ height: 100%;
398
+ overflow-x: hidden;
399
+ }
400
+
401
+ :host([data-theme=light]) {
402
+ --mo-data-grid-alternating-background: rgba(var(--mo-color-foreground-base), 0.05);
403
+ }
404
+
405
+ :host([data-theme=dark]) {
406
+ --mo-data-grid-alternating-background: rgba(var(--mo-color-background-base), 0.2);
407
+ }
408
+
409
+ :host([preventVerticalContentScroll]) mo-scroller {
410
+ overflow-y: hidden;
411
+ }
412
+
413
+ :host([preventVerticalContentScroll]) mo-scroller::part(container) {
414
+ position: relative;
415
+ }
416
+
417
+ :host(:not([selectionMode="none"])) {
418
+ --mo-data-grid-row-tree-line-width: 18px;
419
+ }
420
+
421
+ :host([hasDetails]) {
422
+ --mo-data-grid-row-tree-line-width: 18px;
423
+ }
424
+
425
+ #toolbar {
426
+ position: relative;
427
+ padding: var(--mo-data-grid-toolbar-padding);
428
+ }
429
+
430
+ #toolbar mo-icon-button {
431
+ align-self: flex-start;
432
+ color: var(--mo-color-gray);
433
+ }
434
+
435
+ #flexSelectionToolbar {
436
+ background: var(--mo-color-surface);
437
+ position: absolute;
438
+ inset: 0px;
439
+ width: 100%;
440
+ height: 100%;
441
+ z-index: 1;
442
+ }
443
+
444
+ #flexSelectionToolbar > mo-flex {
445
+ background: var(--mo-data-grid-selection-background);
446
+ height: 100%;
447
+ align-items: center;
448
+ }
449
+
450
+ #flexSelectionToolbar mo-icon-button {
451
+ align-self: center;
452
+ color: var(--mo-color-foreground);
453
+ }
454
+
455
+ #flexActions {
456
+ align-items: center;
457
+ justify-content: center;
458
+ padding-inline: 14px 6px;
459
+ margin: 6px 0;
460
+ cursor: pointer;
461
+ background: var(--mo-color-accent-transparent);
462
+ height: calc(100% - calc(2 * 6px));
463
+ max-height: 45px;
464
+ }
465
+
466
+ #fab {
467
+ position: absolute;
468
+ top: -72px;
469
+ inset-inline-end: 16px;
470
+ transition: var(--mo-data-grid-fab-transition, 250ms);
471
+ }
472
+
473
+ :host([hasFooter]) #fab {
474
+ top: -28px;
475
+ }
476
+
477
+ :host([fabSlotCollapsed][hasFabs]) #fab {
478
+ transform: scale(0);
479
+ opacity: 0;
480
+ }
481
+
482
+ mo-data-grid-footer {
483
+ transition: var(--mo-data-grid-fab-transition, 250ms);
484
+ }
485
+
486
+ :host([hasSums][hasFabs]:not([fabSlotCollapsed])) mo-data-grid-footer {
487
+ --mo-data-grid-footer-trailing-padding: calc(var(--mo-data-grid-fab-slot-width, 56px) + 16px);
488
+ }
489
+
490
+ slot[name=fab] {
491
+ display: block;
492
+ z-index: 1;
493
+ }
494
+
495
+ mo-empty-state, ::slotted(mo-empty-state) {
496
+ height: 100%;
497
+ }
498
+
499
+ #overlayModeContainer {
500
+ position: relative;
501
+ height: 100%;
502
+ width: 100%;
503
+ }
504
+
505
+ #overlayModeContainer mo-data-grid-side-panel {
506
+ position: absolute;
507
+ inset: 0;
508
+ width: 100%;
509
+ height: 100%;
510
+ z-index: 1;
511
+ background-color: var(--mo-color-surface);
512
+ }
507
513
  `;
508
514
  }
509
515
  get template() {
510
- return html `
511
- <slot name='column' hidden ${observeMutation(() => this.requestUpdate())}>${this.columnsTemplate}</slot>
512
- ${this.toolbarTemplate}
513
- ${this.smallScreenObserverController.matches ? this.overlayModeTemplate : this.splitterModeTemplate}
516
+ return html `
517
+ <slot name='column' hidden ${observeMutation(() => this.requestUpdate())}>${this.columnsTemplate}</slot>
518
+ ${this.toolbarTemplate}
519
+ ${this.smallScreenObserverController.matches ? this.overlayModeTemplate : this.splitterModeTemplate}
514
520
  `;
515
521
  }
516
522
  get splitterModeTemplate() {
517
- return html `
518
- <mo-splitter direction='horizontal-reversed' ${style({ height: '100%' })} .resizerTemplate=${html `
519
- <mo-splitter-resizer-line style='--mo-splitter-resizer-line-thickness: 1px; --mo-splitter-resizer-line-idle-background: var(--mo-color-transparent-gray-3); --mo-splitter-resizer-line-horizontal-transform: scaleX(5);'></mo-splitter-resizer-line>
520
- `}>
521
- ${cache(this.sidePanelTab === undefined ? html.nothing : html `
522
- <mo-splitter-item size='min(25%, 300px)' min='max(15%, 250px)' max='clamp(100px, 50%, 750px)'>
523
- ${this.sidePanelTemplate}
524
- </mo-splitter-item>
525
- `)}
526
-
527
- <mo-splitter-item min='0px' ${style({ position: 'relative' })}>
528
- ${this.dataGridTemplate}
529
- </mo-splitter-item>
530
- </mo-splitter>
523
+ return html `
524
+ <mo-splitter direction='horizontal-reversed' ${style({ height: '100%' })} .resizerTemplate=${html `
525
+ <mo-splitter-resizer-line style='--mo-splitter-resizer-line-thickness: 1px; --mo-splitter-resizer-line-idle-background: var(--mo-color-transparent-gray-3); --mo-splitter-resizer-line-horizontal-transform: scaleX(5);'></mo-splitter-resizer-line>
526
+ `}>
527
+ ${cache(this.sidePanelTab === undefined ? html.nothing : html `
528
+ <mo-splitter-item size='min(25%, 300px)' min='max(15%, 250px)' max='clamp(100px, 50%, 750px)'>
529
+ ${this.sidePanelTemplate}
530
+ </mo-splitter-item>
531
+ `)}
532
+
533
+ <mo-splitter-item min='0px' ${style({ position: 'relative' })}>
534
+ ${this.dataGridTemplate}
535
+ </mo-splitter-item>
536
+ </mo-splitter>
531
537
  `;
532
538
  }
533
539
  get overlayModeTemplate() {
534
- return html `
535
- <mo-flex id='overlayModeContainer'>
536
- ${this.dataGridTemplate}
537
- ${this.sidePanelTab === undefined ? html.nothing : this.sidePanelTemplate}
538
- </mo-flex>
540
+ return html `
541
+ <mo-flex id='overlayModeContainer'>
542
+ ${this.dataGridTemplate}
543
+ ${this.sidePanelTab === undefined ? html.nothing : this.sidePanelTemplate}
544
+ </mo-flex>
539
545
  `;
540
546
  }
541
547
  get sidePanelTemplate() {
542
- return html `
543
- <mo-data-grid-side-panel
544
- .dataGrid=${this}
545
- tab=${ifDefined(this.sidePanelTab)}
546
- >
547
- <slot slot='settings' name='settings'>${this.settingsDefaultTemplate}</slot>
548
- <slot slot='filter' name='filter'>${this.filtersDefaultTemplate}</slot>
549
- </mo-data-grid-side-panel>
548
+ return html `
549
+ <mo-data-grid-side-panel
550
+ .dataGrid=${this}
551
+ tab=${ifDefined(this.sidePanelTab)}
552
+ >
553
+ <slot slot='settings' name='settings'>${this.settingsDefaultTemplate}</slot>
554
+ <slot slot='filter' name='filter'>${this.filtersDefaultTemplate}</slot>
555
+ </mo-data-grid-side-panel>
550
556
  `;
551
557
  }
552
558
  get settingsDefaultTemplate() {
@@ -565,70 +571,72 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
565
571
  // These also update the respective attributes for now
566
572
  this.hasSums;
567
573
  this.hasFabs;
568
- return html `
569
- <slot name='fab' @slotchange=${() => { this.hasSums; this.hasFabs; }}></slot>
574
+ return html `
575
+ <slot name='fab' @slotchange=${() => { this.hasSums; this.hasFabs; }}></slot>
570
576
  `;
571
577
  }
572
578
  get contentTemplate() {
573
579
  return !this.data.length ? this.noContentTemplate : this.rowsTemplate;
574
580
  }
575
581
  get noContentTemplate() {
576
- return html `
577
- <slot name='error-no-content'>
578
- <mo-empty-state icon='youtube_searched_for'>${t('No results')}</mo-empty-state>
579
- </slot>
582
+ return html `
583
+ <slot name='error-no-content'>
584
+ <mo-empty-state icon='youtube_searched_for'>${t('No results')}</mo-empty-state>
585
+ </slot>
580
586
  `;
581
587
  }
582
588
  get dataGridTemplate() {
583
589
  this.provideCssColumnsProperties();
584
590
  this.toggleAttribute('hasDetails', this.hasDetails);
585
- return html `
586
- <mo-flex ${style({ flex: '1', position: 'relative' })}>
587
- <mo-grid ${style({ flex: '1' })} rows='* auto'>
588
- <mo-scroller ${style({ minHeight: 'var(--mo-data-grid-content-min-height, calc(var(--mo-data-grid-min-visible-rows, 2.5) * var(--mo-data-grid-row-height) + var(--mo-data-grid-header-height)))' })}>
589
- <mo-grid ${style({ height: '100%' })} rows='auto *'>
590
- ${this.headerTemplate}
591
- ${this.contentTemplate}
592
- </mo-grid>
593
- </mo-scroller>
594
- ${this.footerTemplate}
595
- </mo-grid>
596
- </mo-flex>
591
+ return html `
592
+ <mo-flex ${style({ flex: '1', position: 'relative' })}>
593
+ <mo-grid ${style({ flex: '1' })} rows='* auto'>
594
+ <mo-scroller ${style({ minHeight: 'var(--mo-data-grid-content-min-height, calc(var(--mo-data-grid-min-visible-rows, 2.5) * var(--mo-data-grid-row-height) + var(--mo-data-grid-header-height)))' })}>
595
+ <mo-grid ${style({ height: '100%' })} rows='auto *'>
596
+ ${this.headerTemplate}
597
+ ${this.contentTemplate}
598
+ </mo-grid>
599
+ </mo-scroller>
600
+ ${this.footerTemplate}
601
+ </mo-grid>
602
+ </mo-flex>
597
603
  `;
598
604
  }
599
605
  get headerTemplate() {
600
- return this.headerHidden ? html.nothing : html `
601
- <mo-data-grid-header .dataGrid=${this}></mo-data-grid-header>
606
+ return this.headerHidden ? html.nothing : html `
607
+ <mo-data-grid-header .dataGrid=${this}></mo-data-grid-header>
602
608
  `;
603
609
  }
610
+ get shallVirtualize() {
611
+ return !this.preventVerticalContentScroll && this.renderData.length > this.virtualizationThreshold;
612
+ }
604
613
  get rowsTemplate() {
605
614
  const getRowTemplate = (data, index) => this.getRowTemplate(data, index);
606
- const shallVirtualize = !this.preventVerticalContentScroll && this.renderData.length > this.virtualizationThreshold;
607
- const content = shallVirtualize === false
615
+ const content = this.shallVirtualize === false
608
616
  ? this.renderData.map(getRowTemplate)
609
617
  : html `<mo-virtualized-scroller .items=${this.renderData} .getItemTemplate=${getRowTemplate}></mo-virtualized-scroller>`;
610
- return html `
611
- <mo-scroller id='rowsContainer'
612
- ${style({ gridRow: '2', gridColumn: '1 / last-line', overflowX: 'hidden' })}
613
- ${observeResize(() => this.requestUpdate())}
614
- @scroll=${this.handleScroll}
615
- >
616
- ${content}
617
- </mo-scroller>
618
+ return html `
619
+ <mo-scroller id='rowsContainer'
620
+ ${style({ gridRow: '2', gridColumn: '1 / last-line', overflowX: 'hidden' })}
621
+ ${observeResize(() => this.requestUpdate())}
622
+ @scroll=${this.handleScroll}
623
+ >
624
+ ${content}
625
+ </mo-scroller>
618
626
  `;
619
627
  }
620
628
  getRowTemplate(data, index, level = 0) {
621
- return staticHtml `
622
- <${this.rowElementTag} part='row'
623
- .level=${level}
624
- .dataGrid=${this}
625
- .data=${data}
626
- ?data-has-alternating-background=${index !== undefined && this.hasAlternatingBackground && index % 2 === 1}
627
- ?data-grid-has-details=${this.hasDetails}
628
- ?selected=${live(this.selectedData.includes(data))}
629
- ?detailsOpen=${live(this.openDetailedData.includes(data))}
630
- @detailsOpenChange=${(event) => this.handleRowDetailsOpenChange(data, event.detail)}
631
- ></${this.rowElementTag}>
629
+ return staticHtml `
630
+ <${this.rowElementTag} part='row'
631
+ .level=${level}
632
+ .dataGrid=${this}
633
+ .data=${data}
634
+ ?data-has-alternating-background=${index !== undefined && this.hasAlternatingBackground && index % 2 === 1}
635
+ ?data-grid-has-details=${this.hasDetails}
636
+ ?selected=${live(this.selectedData.includes(data))}
637
+ ?detailsOpen=${live(this.openDetailedData.includes(data))}
638
+ @detailsOpenChange=${(event) => this.handleRowDetailsOpenChange(data, event.detail)}
639
+ ></${this.rowElementTag}>
632
640
  `;
633
641
  }
634
642
  handleRowDetailsOpenChange(data, open) {
@@ -643,30 +651,30 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
643
651
  : this.openDetailedData.filter(d => d !== data);
644
652
  }
645
653
  get footerTemplate() {
646
- return html `
647
- <mo-flex ${style({ position: 'relative' })}>
648
- <mo-flex id='fab' direction='vertical-reversed' gap='8px'>
649
- ${this.fabTemplate}
650
- </mo-flex>
651
- ${this.hasFooter === false ? html.nothing : html `
652
- <mo-data-grid-footer
653
- .dataGrid=${this}
654
- page=${this.page}
655
- >
656
- <slot name='sum' slot='sum'>${this.sumDefaultTemplate}</slot>
657
- </mo-data-grid-footer>
658
- `}
659
- </mo-flex>
654
+ return html `
655
+ <mo-flex ${style({ position: 'relative' })}>
656
+ <mo-flex id='fab' direction='vertical-reversed' gap='8px'>
657
+ ${this.fabTemplate}
658
+ </mo-flex>
659
+ ${this.hasFooter === false ? html.nothing : html `
660
+ <mo-data-grid-footer
661
+ .dataGrid=${this}
662
+ page=${this.page}
663
+ >
664
+ <slot name='sum' slot='sum'>${this.sumDefaultTemplate}</slot>
665
+ </mo-data-grid-footer>
666
+ `}
667
+ </mo-flex>
660
668
  `;
661
669
  }
662
670
  get sumsData() {
663
671
  return this.selectedData.length > 0 ? this.selectedData : this.renderData;
664
672
  }
665
673
  get sumsTemplate() {
666
- return html `
667
- <mo-flex direction='horizontal' gap='10px' wrap='wrap-reverse' alignItems='center' ${style({ padding: '2px 4px' })}>
668
- ${this.columns.map(column => this.getSumTemplate(column))}
669
- </mo-flex>
674
+ return html `
675
+ <mo-flex direction='horizontal' gap='10px' wrap='wrap-reverse' alignItems='center' ${style({ padding: '2px 4px' })}>
676
+ ${this.columns.map(column => this.getSumTemplate(column))}
677
+ </mo-flex>
670
678
  `;
671
679
  }
672
680
  getSumTemplate(column) {
@@ -678,24 +686,24 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
678
686
  .filter(n => isNaN(n) === false)
679
687
  .reduce(((a, b) => a + b), 0)
680
688
  || 0;
681
- return html `
682
- <mo-data-grid-footer-sum heading=${column.sumHeading + ''} ${style({ color: this.selectedData.length > 0 ? 'var(--mo-color-accent)' : 'currentColor' })}>
683
- ${column.getSumTemplate(sum)}
684
- </mo-data-grid-footer-sum>
689
+ return html `
690
+ <mo-data-grid-footer-sum heading=${column.sumHeading + ''} ${style({ color: this.selectedData.length > 0 ? 'var(--mo-color-accent)' : 'currentColor' })}>
691
+ ${column.getSumTemplate(sum)}
692
+ </mo-data-grid-footer-sum>
685
693
  `;
686
694
  }
687
695
  get toolbarTemplate() {
688
- return this.hasToolbar === false ? html.nothing : html `
689
- <mo-flex id='toolbar' direction='horizontal' gap='8px' wrap='wrap' justifyContent='end' alignItems='center'>
690
- <mo-flex direction='horizontal' alignItems='inherit' gap='8px' wrap='wrap' ${style({ flex: '1' })}>
691
- <slot name='toolbar'>${this.toolbarDefaultTemplate}</slot>
692
- </mo-flex>
693
- <mo-flex direction='horizontal' gap='8px'>
694
- <slot name='toolbarAction'>${this.toolbarActionDefaultTemplate}</slot>
695
- ${this.toolbarActionsTemplate}
696
- ${this.selectionToolbarTemplate}
697
- </mo-flex>
698
- </mo-flex>
696
+ return this.hasToolbar === false ? html.nothing : html `
697
+ <mo-flex id='toolbar' direction='horizontal' gap='8px' wrap='wrap' justifyContent='end' alignItems='center'>
698
+ <mo-flex direction='horizontal' alignItems='inherit' gap='8px' wrap='wrap' ${style({ flex: '1' })}>
699
+ <slot name='toolbar'>${this.toolbarDefaultTemplate}</slot>
700
+ </mo-flex>
701
+ <mo-flex direction='horizontal' gap='8px'>
702
+ <slot name='toolbarAction'>${this.toolbarActionDefaultTemplate}</slot>
703
+ ${this.toolbarActionsTemplate}
704
+ ${this.selectionToolbarTemplate}
705
+ </mo-flex>
706
+ </mo-flex>
699
707
  `;
700
708
  }
701
709
  get toolbarDefaultTemplate() {
@@ -708,42 +716,42 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
708
716
  return html.nothing;
709
717
  }
710
718
  get selectionToolbarTemplate() {
711
- return this.selectionToolbarDisabled === true || this.selectedData.length === 0 ? html.nothing : html `
712
- <mo-flex id='flexSelectionToolbar'>
713
- <mo-flex direction='horizontal' gap='30px' ${style({ placeSelf: 'stretch' })}>
714
- <div ${style({ fontWeight: '500', margin: '0 6px' })}>
715
- ${t('${count:pluralityNumber} entries selected', { count: this.selectedData.length })}
716
- </div>
717
- ${!this.getRowContextMenuTemplate ? html.nothing : html `
718
- <mo-flex id='flexActions' direction='horizontal' @click=${(e) => ContextMenu.open(e, this.getRowContextMenuTemplate?.(this.selectedData) ?? html.nothing)}>
719
- <div ${style({ flex: '1' })}>${t('Options')}</div>
720
- <mo-icon-button dense icon='arrow_drop_down' ${style({ display: 'flex', alignItems: 'center', justifyContent: 'center' })}></mo-icon-button>
721
- </mo-flex>
722
- `}
723
- <div ${style({ flex: '1' })}></div>
724
- <mo-icon-button icon='close'
725
- ${tooltip(t('Deselect All'))}
726
- @click=${() => this.deselectAll()}
727
- ></mo-icon-button>
728
- </mo-flex>
729
- </mo-flex>
719
+ return this.selectionToolbarDisabled === true || this.selectedData.length === 0 ? html.nothing : html `
720
+ <mo-flex id='flexSelectionToolbar'>
721
+ <mo-flex direction='horizontal' gap='30px' ${style({ placeSelf: 'stretch' })}>
722
+ <div ${style({ fontWeight: '500', margin: '0 6px' })}>
723
+ ${t('${count:pluralityNumber} entries selected', { count: this.selectedData.length })}
724
+ </div>
725
+ ${!this.getRowContextMenuTemplate ? html.nothing : html `
726
+ <mo-flex id='flexActions' direction='horizontal' @click=${(e) => ContextMenu.open(e, this.getRowContextMenuTemplate?.(this.selectedData) ?? html.nothing)}>
727
+ <div ${style({ flex: '1' })}>${t('Options')}</div>
728
+ <mo-icon-button dense icon='arrow_drop_down' ${style({ display: 'flex', alignItems: 'center', justifyContent: 'center' })}></mo-icon-button>
729
+ </mo-flex>
730
+ `}
731
+ <div ${style({ flex: '1' })}></div>
732
+ <mo-icon-button icon='close'
733
+ ${tooltip(t('Deselect All'))}
734
+ @click=${() => this.deselectAll()}
735
+ ></mo-icon-button>
736
+ </mo-flex>
737
+ </mo-flex>
730
738
  `;
731
739
  }
732
740
  get toolbarActionsTemplate() {
733
- return html `
734
- ${!this.hasFilters ? html.nothing : html `
735
- <mo-icon-button icon='filter_list'
736
- ${tooltip(t('More Filters'))}
737
- ${style({ color: this.sidePanelTab === DataGridSidePanelTab.Filters ? 'var(--mo-color-accent)' : 'var(--mo-color-gray)' })}
738
- @click=${() => this.navigateToSidePanelTab(this.sidePanelTab === DataGridSidePanelTab.Filters ? undefined : DataGridSidePanelTab.Filters)}
739
- ></mo-icon-button>
740
- `}
741
-
742
- <mo-icon-button icon='settings'
743
- ${tooltip(t('Settings'))}
744
- ${style({ color: this.sidePanelTab === DataGridSidePanelTab.Settings ? 'var(--mo-color-accent)' : 'var(--mo-color-gray)' })}
745
- @click=${() => this.navigateToSidePanelTab(this.sidePanelTab === DataGridSidePanelTab.Settings ? undefined : DataGridSidePanelTab.Settings)}
746
- ></mo-icon-button>
741
+ return html `
742
+ ${!this.hasFilters ? html.nothing : html `
743
+ <mo-icon-button icon='filter_list'
744
+ ${tooltip(t('More Filters'))}
745
+ ${style({ color: this.sidePanelTab === DataGridSidePanelTab.Filters ? 'var(--mo-color-accent)' : 'var(--mo-color-gray)' })}
746
+ @click=${() => this.navigateToSidePanelTab(this.sidePanelTab === DataGridSidePanelTab.Filters ? undefined : DataGridSidePanelTab.Filters)}
747
+ ></mo-icon-button>
748
+ `}
749
+
750
+ <mo-icon-button icon='settings'
751
+ ${tooltip(t('Settings'))}
752
+ ${style({ color: this.sidePanelTab === DataGridSidePanelTab.Settings ? 'var(--mo-color-accent)' : 'var(--mo-color-gray)' })}
753
+ @click=${() => this.navigateToSidePanelTab(this.sidePanelTab === DataGridSidePanelTab.Settings ? undefined : DataGridSidePanelTab.Settings)}
754
+ ></mo-icon-button>
747
755
  `;
748
756
  }
749
757
  // The reason for not doing this in the CSS is that we need to trim all the 0px values out of the columns
@@ -1043,9 +1051,6 @@ __decorate([
1043
1051
  }
1044
1052
  })
1045
1053
  ], DataGrid.prototype, "rowHeight", void 0);
1046
- __decorate([
1047
- queryAll('[mo-data-grid-row]')
1048
- ], DataGrid.prototype, "rows", void 0);
1049
1054
  __decorate([
1050
1055
  query('mo-data-grid-header')
1051
1056
  ], DataGrid.prototype, "header", void 0);