@3mo/data-grid 0.2.6 → 0.2.7

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
@@ -80,7 +80,7 @@ Localizer.register("de" /* LanguageCode.German */, {
80
80
  * @fires rowDoubleClick {CustomEvent<DataGridRow<TData, TDetailsElement>>}
81
81
  * @fires cellEdit {CustomEvent<DataGridCell<any, TData, TDetailsElement>>}
82
82
  */
83
- export let DataGrid = DataGrid_1 = class DataGrid extends Component {
83
+ let DataGrid = DataGrid_1 = class DataGrid extends Component {
84
84
  constructor() {
85
85
  super(...arguments);
86
86
  this.data = new Array();
@@ -333,189 +333,184 @@ export let DataGrid = DataGrid_1 = class DataGrid extends Component {
333
333
  this.setPage(1);
334
334
  }
335
335
  static get styles() {
336
- return css `
337
- :host {
338
- --mo-data-grid-column-details-width: 20px;
339
- --mo-data-grid-column-selection-width: 40px;
340
- --mo-data-grid-column-more-width: 20px;
341
-
342
- --mo-data-grid-header-height: 32px;
343
- --mo-data-grid-footer-min-height: 40px;
344
- --mo-data-grid-toolbar-padding: 14px;
345
- --mo-data-grid-border: 1px solid var(--mo-color-transparent-gray-3);
346
-
347
- /* --mo-data-grid-columns Generated in JS */
348
- --mo-data-grid-columns-gap: 6px;
349
-
350
- --mo-data-grid-row-tree-line-width: 8px;
351
- --mo-details-data-grid-start-margin: 26px;
352
- --mo-data-grid-cell-padding: 3px;
353
-
354
- --mo-data-grid-selection-background: rgba(var(--mo-color-accent-base), 0.5);
355
-
356
- --mo-data-grid-row-height: ${DataGrid_1.rowHeight.value}px;
357
- display: flex;
358
- flex-direction: column;
359
- height: 100%;
360
- overflow-x: hidden;
361
- }
362
-
363
- :host([data-theme=light]) {
364
- --mo-data-grid-alternating-background: rgba(var(--mo-color-foreground-base), 0.05);
365
- }
366
-
367
- :host([data-theme=dark]) {
368
- --mo-data-grid-alternating-background: rgba(var(--mo-color-background-base), 0.2);
369
- }
370
-
371
- /* Don't try to use ":nth-child(even)" as it won't work for virtualized data-grids */
372
- [mo-data-grid-row][data-has-alternating-background] {
373
- background: var(--mo-data-grid-alternating-background);
374
- }
375
-
376
- :host([preventVerticalContentScroll]) mo-scroller {
377
- overflow-y: hidden;
378
- }
379
-
380
- :host([preventVerticalContentScroll]) mo-scroller::part(container) {
381
- position: relative;
382
- }
383
-
384
- :host(:not([selectionMode="none"])) {
385
- --mo-data-grid-row-tree-line-width: 18px;
386
- }
387
-
388
- :host([hasDetails]) {
389
- --mo-data-grid-row-tree-line-width: 18px;
390
- }
391
-
392
- #flexToolbar {
393
- position: relative;
394
- padding: var(--mo-data-grid-toolbar-padding);
395
- }
396
-
397
- #flexToolbar mo-icon-button {
398
- align-self: flex-start;
399
- color: var(--mo-color-gray);
400
- }
401
-
402
- #flexSelectionToolbar {
403
- background: var(--mo-color-surface);
404
- position: absolute;
405
- inset: 0px;
406
- width: 100%;
407
- height: 100%;
408
- z-index: 1;
409
- }
410
-
411
- #flexSelectionToolbar > mo-flex {
412
- background: var(--mo-data-grid-selection-background);
413
- height: 100%;
414
- align-items: center;
415
- }
416
-
417
- #flexSelectionToolbar mo-icon-button {
418
- align-self: center;
419
- color: var(--mo-color-foreground);
420
- }
421
-
422
- #flexActions {
423
- align-items: center;
424
- justify-content: center;
425
- padding-inline: 14px 6px;
426
- margin: 6px 0;
427
- cursor: pointer;
428
- background: var(--mo-color-accent-transparent);
429
- height: calc(100% - calc(2 * 6px));
430
- max-height: 45px;
431
- }
432
-
433
- #flexFab {
434
- position: absolute;
435
- top: -28px;
436
- inset-inline-end: 16px;
437
- transition: var(--mo-data-grid-fab-transition, 250ms);
438
- }
439
-
440
- :host([fabSlotCollapsed][hasFabs]) #flexFab {
441
- transform: scale(0);
442
- opacity: 0;
443
- }
444
-
445
- mo-data-grid-footer {
446
- transition: var(--mo-data-grid-fab-transition, 250ms);
447
- }
448
-
449
- :host([hasSums][hasFabs]:not([fabSlotCollapsed])) mo-data-grid-footer {
450
- --mo-data-grid-footer-trailing-padding: calc(var(--mo-data-grid-fab-slot-width, 56px) + 16px);
451
- }
452
-
453
- slot[name=fab] {
454
- display: block;
455
- z-index: 1;
456
- }
457
-
458
- mo-empty-state, ::slotted(mo-empty-state) {
459
- height: 100%;
460
- }
461
-
462
- #overlayModeContainer {
463
- position: relative;
464
- height: 100%;
465
- width: 100%;
466
- }
467
-
468
- #overlayModeContainer mo-data-grid-side-panel {
469
- position: absolute;
470
- inset: 0;
471
- width: 100%;
472
- height: 100%;
473
- z-index: 1;
474
- background-color: var(--mo-color-surface);
475
- }
336
+ return css `
337
+ :host {
338
+ --mo-data-grid-column-details-width: 20px;
339
+ --mo-data-grid-column-selection-width: 40px;
340
+ --mo-data-grid-column-more-width: 20px;
341
+
342
+ --mo-data-grid-header-height: 32px;
343
+ --mo-data-grid-footer-min-height: 40px;
344
+ --mo-data-grid-toolbar-padding: 14px;
345
+ --mo-data-grid-border: 1px solid var(--mo-color-transparent-gray-3);
346
+
347
+ /* --mo-data-grid-columns Generated in JS */
348
+ --mo-data-grid-columns-gap: 6px;
349
+
350
+ --mo-data-grid-row-tree-line-width: 8px;
351
+ --mo-details-data-grid-start-margin: 26px;
352
+ --mo-data-grid-cell-padding: 3px;
353
+
354
+ --mo-data-grid-selection-background: rgba(var(--mo-color-accent-base), 0.5);
355
+
356
+ --mo-data-grid-row-height: ${DataGrid_1.rowHeight.value}px;
357
+ display: flex;
358
+ flex-direction: column;
359
+ height: 100%;
360
+ overflow-x: hidden;
361
+ }
362
+
363
+ :host([data-theme=light]) {
364
+ --mo-data-grid-alternating-background: rgba(var(--mo-color-foreground-base), 0.05);
365
+ }
366
+
367
+ :host([data-theme=dark]) {
368
+ --mo-data-grid-alternating-background: rgba(var(--mo-color-background-base), 0.2);
369
+ }
370
+
371
+ :host([preventVerticalContentScroll]) mo-scroller {
372
+ overflow-y: hidden;
373
+ }
374
+
375
+ :host([preventVerticalContentScroll]) mo-scroller::part(container) {
376
+ position: relative;
377
+ }
378
+
379
+ :host(:not([selectionMode="none"])) {
380
+ --mo-data-grid-row-tree-line-width: 18px;
381
+ }
382
+
383
+ :host([hasDetails]) {
384
+ --mo-data-grid-row-tree-line-width: 18px;
385
+ }
386
+
387
+ #flexToolbar {
388
+ position: relative;
389
+ padding: var(--mo-data-grid-toolbar-padding);
390
+ }
391
+
392
+ #flexToolbar mo-icon-button {
393
+ align-self: flex-start;
394
+ color: var(--mo-color-gray);
395
+ }
396
+
397
+ #flexSelectionToolbar {
398
+ background: var(--mo-color-surface);
399
+ position: absolute;
400
+ inset: 0px;
401
+ width: 100%;
402
+ height: 100%;
403
+ z-index: 1;
404
+ }
405
+
406
+ #flexSelectionToolbar > mo-flex {
407
+ background: var(--mo-data-grid-selection-background);
408
+ height: 100%;
409
+ align-items: center;
410
+ }
411
+
412
+ #flexSelectionToolbar mo-icon-button {
413
+ align-self: center;
414
+ color: var(--mo-color-foreground);
415
+ }
416
+
417
+ #flexActions {
418
+ align-items: center;
419
+ justify-content: center;
420
+ padding-inline: 14px 6px;
421
+ margin: 6px 0;
422
+ cursor: pointer;
423
+ background: var(--mo-color-accent-transparent);
424
+ height: calc(100% - calc(2 * 6px));
425
+ max-height: 45px;
426
+ }
427
+
428
+ #flexFab {
429
+ position: absolute;
430
+ top: -28px;
431
+ inset-inline-end: 16px;
432
+ transition: var(--mo-data-grid-fab-transition, 250ms);
433
+ }
434
+
435
+ :host([fabSlotCollapsed][hasFabs]) #flexFab {
436
+ transform: scale(0);
437
+ opacity: 0;
438
+ }
439
+
440
+ mo-data-grid-footer {
441
+ transition: var(--mo-data-grid-fab-transition, 250ms);
442
+ }
443
+
444
+ :host([hasSums][hasFabs]:not([fabSlotCollapsed])) mo-data-grid-footer {
445
+ --mo-data-grid-footer-trailing-padding: calc(var(--mo-data-grid-fab-slot-width, 56px) + 16px);
446
+ }
447
+
448
+ slot[name=fab] {
449
+ display: block;
450
+ z-index: 1;
451
+ }
452
+
453
+ mo-empty-state, ::slotted(mo-empty-state) {
454
+ height: 100%;
455
+ }
456
+
457
+ #overlayModeContainer {
458
+ position: relative;
459
+ height: 100%;
460
+ width: 100%;
461
+ }
462
+
463
+ #overlayModeContainer mo-data-grid-side-panel {
464
+ position: absolute;
465
+ inset: 0;
466
+ width: 100%;
467
+ height: 100%;
468
+ z-index: 1;
469
+ background-color: var(--mo-color-surface);
470
+ }
476
471
  `;
477
472
  }
478
473
  get template() {
479
- return html `
480
- <slot name='column' hidden ${observeMutation(() => this.requestUpdate())}>${this.columnsTemplate}</slot>
481
- ${this.toolbarTemplate}
482
- ${this.smallScreenObserverController.matches ? this.overlayModeTemplate : this.splitterModeTemplate}
474
+ return html `
475
+ <slot name='column' hidden ${observeMutation(() => this.requestUpdate())}>${this.columnsTemplate}</slot>
476
+ ${this.toolbarTemplate}
477
+ ${this.smallScreenObserverController.matches ? this.overlayModeTemplate : this.splitterModeTemplate}
483
478
  `;
484
479
  }
485
480
  get splitterModeTemplate() {
486
- return html `
487
- <mo-splitter direction='horizontal-reversed' ${style({ height: '100%' })} .resizerTemplate=${html `
488
- <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>
489
- `}>
490
- ${cache(this.sidePanelTab === undefined ? nothing : html `
491
- <mo-splitter-item size='min(25%, 300px)' min='max(15%, 250px)' max='clamp(100px, 50%, 750px)'>
492
- ${this.sidePanelTemplate}
493
- </mo-splitter-item>
494
- `)}
495
-
496
- <mo-splitter-item min='0px' ${style({ position: 'relative' })}>
497
- ${this.dataGridTemplate}
498
- </mo-splitter-item>
499
- </mo-splitter>
481
+ return html `
482
+ <mo-splitter direction='horizontal-reversed' ${style({ height: '100%' })} .resizerTemplate=${html `
483
+ <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>
484
+ `}>
485
+ ${cache(this.sidePanelTab === undefined ? nothing : html `
486
+ <mo-splitter-item size='min(25%, 300px)' min='max(15%, 250px)' max='clamp(100px, 50%, 750px)'>
487
+ ${this.sidePanelTemplate}
488
+ </mo-splitter-item>
489
+ `)}
490
+
491
+ <mo-splitter-item min='0px' ${style({ position: 'relative' })}>
492
+ ${this.dataGridTemplate}
493
+ </mo-splitter-item>
494
+ </mo-splitter>
500
495
  `;
501
496
  }
502
497
  get overlayModeTemplate() {
503
- return html `
504
- <mo-flex id='overlayModeContainer'>
505
- ${this.dataGridTemplate}
506
- ${this.sidePanelTab === undefined ? nothing : this.sidePanelTemplate}
507
- </mo-flex>
498
+ return html `
499
+ <mo-flex id='overlayModeContainer'>
500
+ ${this.dataGridTemplate}
501
+ ${this.sidePanelTab === undefined ? nothing : this.sidePanelTemplate}
502
+ </mo-flex>
508
503
  `;
509
504
  }
510
505
  get sidePanelTemplate() {
511
- return html `
512
- <mo-data-grid-side-panel
513
- .dataGrid=${this}
514
- tab=${ifDefined(this.sidePanelTab)}
515
- >
516
- <slot slot='settings' name='settings'>${this.settingsDefaultTemplate}</slot>
517
- <slot slot='filter' name='filter'>${this.filtersDefaultTemplate}</slot>
518
- </mo-data-grid-side-panel>
506
+ return html `
507
+ <mo-data-grid-side-panel
508
+ .dataGrid=${this}
509
+ tab=${ifDefined(this.sidePanelTab)}
510
+ >
511
+ <slot slot='settings' name='settings'>${this.settingsDefaultTemplate}</slot>
512
+ <slot slot='filter' name='filter'>${this.filtersDefaultTemplate}</slot>
513
+ </mo-data-grid-side-panel>
519
514
  `;
520
515
  }
521
516
  get settingsDefaultTemplate() {
@@ -534,40 +529,40 @@ export let DataGrid = DataGrid_1 = class DataGrid extends Component {
534
529
  // These also update the respective attributes for now
535
530
  this.hasSums;
536
531
  this.hasFabs;
537
- return html `
538
- <slot name='fab' @slotchange=${() => { this.hasSums; this.hasFabs; }}></slot>
532
+ return html `
533
+ <slot name='fab' @slotchange=${() => { this.hasSums; this.hasFabs; }}></slot>
539
534
  `;
540
535
  }
541
536
  get contentTemplate() {
542
537
  return !this.data.length ? this.noContentTemplate : this.rowsTemplate;
543
538
  }
544
539
  get noContentTemplate() {
545
- return html `
546
- <slot name='error-no-content'>
547
- <mo-empty-state icon='youtube_searched_for'>${t('No results')}</mo-empty-state>
548
- </slot>
540
+ return html `
541
+ <slot name='error-no-content'>
542
+ <mo-empty-state icon='youtube_searched_for'>${t('No results')}</mo-empty-state>
543
+ </slot>
549
544
  `;
550
545
  }
551
546
  get dataGridTemplate() {
552
547
  this.provideCssColumnsProperties();
553
548
  this.toggleAttribute('hasDetails', this.hasDetails);
554
- return html `
555
- <mo-flex ${style({ width: '*', position: 'relative' })}>
556
- <mo-grid ${style({ height: '*' })} rows='* auto'>
557
- <mo-scroller ${style({ minHeight: 'var(--mo-data-grid-content-min-height, calc(2.5 * var(--mo-data-grid-row-height) + var(--mo-data-grid-header-height)))', paddingBottom: '2px' })}>
558
- <mo-grid ${style({ height: '100%' })} rows='auto *'>
559
- ${this.headerTemplate}
560
- ${this.contentTemplate}
561
- </mo-grid>
562
- </mo-scroller>
563
- ${this.footerTemplate}
564
- </mo-grid>
565
- </mo-flex>
549
+ return html `
550
+ <mo-flex ${style({ width: '*', position: 'relative' })}>
551
+ <mo-grid ${style({ height: '*' })} rows='* auto'>
552
+ <mo-scroller ${style({ minHeight: 'var(--mo-data-grid-content-min-height, calc(2.5 * var(--mo-data-grid-row-height) + var(--mo-data-grid-header-height)))', paddingBottom: '2px' })}>
553
+ <mo-grid ${style({ height: '100%' })} rows='auto *'>
554
+ ${this.headerTemplate}
555
+ ${this.contentTemplate}
556
+ </mo-grid>
557
+ </mo-scroller>
558
+ ${this.footerTemplate}
559
+ </mo-grid>
560
+ </mo-flex>
566
561
  `;
567
562
  }
568
563
  get headerTemplate() {
569
- return this.headerHidden ? nothing : html `
570
- <mo-data-grid-header .dataGrid=${this}></mo-data-grid-header>
564
+ return this.headerHidden ? nothing : html `
565
+ <mo-data-grid-header .dataGrid=${this}></mo-data-grid-header>
571
566
  `;
572
567
  }
573
568
  get rowsTemplate() {
@@ -576,26 +571,26 @@ export let DataGrid = DataGrid_1 = class DataGrid extends Component {
576
571
  const content = shallVirtualize === false
577
572
  ? this.renderData.map(getRowTemplate)
578
573
  : html `<mo-virtualized-scroller .items=${this.renderData} .getItemTemplate=${getRowTemplate}></mo-virtualized-scroller>`;
579
- return html `
580
- <mo-scroller id='rowsContainer'
581
- ${style({ gridRow: '2', gridColumn: '1 / last-line' })}
582
- ${observeResize(() => this.requestUpdate())}
583
- @scroll=${this.handleScroll}
584
- >
585
- ${content}
586
- </mo-scroller>
574
+ return html `
575
+ <mo-scroller id='rowsContainer'
576
+ ${style({ gridRow: '2', gridColumn: '1 / last-line' })}
577
+ ${observeResize(() => this.requestUpdate())}
578
+ @scroll=${this.handleScroll}
579
+ >
580
+ ${content}
581
+ </mo-scroller>
587
582
  `;
588
583
  }
589
584
  getRowTemplate(data, index) {
590
- return staticHtml `
591
- <${this.rowElementTag} part='row'
592
- .dataGrid=${this}
593
- .data=${data}
594
- ?data-has-alternating-background=${this.hasAlternatingBackground && index % 2 === 1}
595
- ?selected=${live(this.selectedData.includes(data))}
596
- ?detailsOpen=${live(this.openDetailedData.includes(data))}
597
- @detailsOpenChange=${(event) => this.handleRowDetailsOpenChange(data, event)}
598
- ></${this.rowElementTag}>
585
+ return staticHtml `
586
+ <${this.rowElementTag} part='row'
587
+ .dataGrid=${this}
588
+ .data=${data}
589
+ ?data-has-alternating-background=${this.hasAlternatingBackground && index % 2 === 1}
590
+ ?selected=${live(this.selectedData.includes(data))}
591
+ ?detailsOpen=${live(this.openDetailedData.includes(data))}
592
+ @detailsOpenChange=${(event) => this.handleRowDetailsOpenChange(data, event)}
593
+ ></${this.rowElementTag}>
599
594
  `;
600
595
  }
601
596
  handleRowDetailsOpenChange(data, event) {
@@ -613,20 +608,20 @@ export let DataGrid = DataGrid_1 = class DataGrid extends Component {
613
608
  }
614
609
  }
615
610
  get footerTemplate() {
616
- return html `
617
- <mo-flex ${style({ position: 'relative' })}>
618
- <mo-flex id='flexFab' direction='vertical-reversed' gap='8px'>
619
- ${this.fabTemplate}
620
- </mo-flex>
621
- ${this.hasFooter === false ? nothing : html `
622
- <mo-data-grid-footer
623
- .dataGrid=${this}
624
- page=${this.page}
625
- >
626
- <slot name='sum' slot='sum'>${this.sumDefaultTemplate}</slot>
627
- </mo-data-grid-footer>
628
- `}
629
- </mo-flex>
611
+ return html `
612
+ <mo-flex ${style({ position: 'relative' })}>
613
+ <mo-flex id='flexFab' direction='vertical-reversed' gap='8px'>
614
+ ${this.fabTemplate}
615
+ </mo-flex>
616
+ ${this.hasFooter === false ? nothing : html `
617
+ <mo-data-grid-footer
618
+ .dataGrid=${this}
619
+ page=${this.page}
620
+ >
621
+ <slot name='sum' slot='sum'>${this.sumDefaultTemplate}</slot>
622
+ </mo-data-grid-footer>
623
+ `}
624
+ </mo-flex>
630
625
  `;
631
626
  }
632
627
  get sumsTemplate() {
@@ -641,24 +636,24 @@ export let DataGrid = DataGrid_1 = class DataGrid extends Component {
641
636
  .filter(n => isNaN(n) === false)
642
637
  .reduce(((a, b) => a + b), 0)
643
638
  || 0;
644
- return html `
645
- <mo-data-grid-footer-sum heading=${column.sumHeading}>
646
- ${column.getSumTemplate(sum)}
647
- </mo-data-grid-footer-sum>
639
+ return html `
640
+ <mo-data-grid-footer-sum heading=${column.sumHeading}>
641
+ ${column.getSumTemplate(sum)}
642
+ </mo-data-grid-footer-sum>
648
643
  `;
649
644
  }
650
645
  get toolbarTemplate() {
651
- return this.hasToolbar === false ? nothing : html `
652
- <mo-flex id='flexToolbar' direction='horizontal' gap='8px' wrap='wrap' justifyContent='end' alignItems='center'>
653
- <mo-flex direction='horizontal' alignItems='inherit' gap='8px' wrap='wrap' ${style({ width: '*' })}>
654
- <slot name='toolbar'>${this.toolbarDefaultTemplate}</slot>
655
- </mo-flex>
656
- <mo-flex direction='horizontal' gap='8px'>
657
- <slot name='toolbarAction'>${this.toolbarActionDefaultTemplate}</slot>
658
- ${this.toolbarActionsTemplate}
659
- ${this.selectionToolbarTemplate}
660
- </mo-flex>
661
- </mo-flex>
646
+ return this.hasToolbar === false ? nothing : html `
647
+ <mo-flex id='flexToolbar' direction='horizontal' gap='8px' wrap='wrap' justifyContent='end' alignItems='center'>
648
+ <mo-flex direction='horizontal' alignItems='inherit' gap='8px' wrap='wrap' ${style({ width: '*' })}>
649
+ <slot name='toolbar'>${this.toolbarDefaultTemplate}</slot>
650
+ </mo-flex>
651
+ <mo-flex direction='horizontal' gap='8px'>
652
+ <slot name='toolbarAction'>${this.toolbarActionDefaultTemplate}</slot>
653
+ ${this.toolbarActionsTemplate}
654
+ ${this.selectionToolbarTemplate}
655
+ </mo-flex>
656
+ </mo-flex>
662
657
  `;
663
658
  }
664
659
  get toolbarDefaultTemplate() {
@@ -671,42 +666,42 @@ export let DataGrid = DataGrid_1 = class DataGrid extends Component {
671
666
  return nothing;
672
667
  }
673
668
  get selectionToolbarTemplate() {
674
- return this.selectionToolbarDisabled === true || this.selectedData.length === 0 ? nothing : html `
675
- <mo-flex id='flexSelectionToolbar'>
676
- <mo-flex direction='horizontal' gap='30px' ${style({ placeSelf: 'stretch' })}>
677
- <div ${style({ fontWeight: '500', margin: '0 6px' })}>
678
- ${t('${count:pluralityNumber} entries selected', { count: this.selectedData.length })}
679
- </div>
680
- ${!this.getRowContextMenuTemplate ? nothing : html `
681
- <mo-flex id='flexActions' direction='horizontal' @click=${(e) => { var _a, _b; return ContextMenu.open(e, (_b = (_a = this.getRowContextMenuTemplate) === null || _a === void 0 ? void 0 : _a.call(this, this.selectedData)) !== null && _b !== void 0 ? _b : nothing); }}>
682
- <div ${style({ width: '*' })}>${t('Options')}</div>
683
- <mo-icon-button dense icon='arrow_drop_down' ${style({ display: 'flex', alignItems: 'center', justifyContent: 'center' })}></mo-icon-button>
684
- </mo-flex>
685
- `}
686
- <div ${style({ width: '*' })}></div>
687
- <mo-icon-button icon='close'
688
- ${tooltip(t('Deselect All'))}
689
- @click=${() => this.deselectAll()}
690
- ></mo-icon-button>
691
- </mo-flex>
692
- </mo-flex>
669
+ return this.selectionToolbarDisabled === true || this.selectedData.length === 0 ? nothing : html `
670
+ <mo-flex id='flexSelectionToolbar'>
671
+ <mo-flex direction='horizontal' gap='30px' ${style({ placeSelf: 'stretch' })}>
672
+ <div ${style({ fontWeight: '500', margin: '0 6px' })}>
673
+ ${t('${count:pluralityNumber} entries selected', { count: this.selectedData.length })}
674
+ </div>
675
+ ${!this.getRowContextMenuTemplate ? nothing : html `
676
+ <mo-flex id='flexActions' direction='horizontal' @click=${(e) => { var _a, _b; return ContextMenu.open(e, (_b = (_a = this.getRowContextMenuTemplate) === null || _a === void 0 ? void 0 : _a.call(this, this.selectedData)) !== null && _b !== void 0 ? _b : nothing); }}>
677
+ <div ${style({ width: '*' })}>${t('Options')}</div>
678
+ <mo-icon-button dense icon='arrow_drop_down' ${style({ display: 'flex', alignItems: 'center', justifyContent: 'center' })}></mo-icon-button>
679
+ </mo-flex>
680
+ `}
681
+ <div ${style({ width: '*' })}></div>
682
+ <mo-icon-button icon='close'
683
+ ${tooltip(t('Deselect All'))}
684
+ @click=${() => this.deselectAll()}
685
+ ></mo-icon-button>
686
+ </mo-flex>
687
+ </mo-flex>
693
688
  `;
694
689
  }
695
690
  get toolbarActionsTemplate() {
696
- return html `
697
- ${!this.hasFilters ? nothing : html `
698
- <mo-icon-button icon='filter_list'
699
- ${tooltip(t('More Filters'))}
700
- ${style({ color: this.sidePanelTab === "filters" /* DataGridSidePanelTab.Filters */ ? 'var(--mo-color-accent)' : 'var(--mo-color-gray)' })}
701
- @click=${() => this.navigateToSidePanelTab(this.sidePanelTab === "filters" /* DataGridSidePanelTab.Filters */ ? undefined : "filters" /* DataGridSidePanelTab.Filters */)}
702
- ></mo-icon-button>
703
- `}
704
-
705
- <mo-icon-button icon='settings'
706
- ${tooltip(t('Settings'))}
707
- ${style({ color: this.sidePanelTab === "settings" /* DataGridSidePanelTab.Settings */ ? 'var(--mo-color-accent)' : 'var(--mo-color-gray)' })}
708
- @click=${() => this.navigateToSidePanelTab(this.sidePanelTab === "settings" /* DataGridSidePanelTab.Settings */ ? undefined : "settings" /* DataGridSidePanelTab.Settings */)}
709
- ></mo-icon-button>
691
+ return html `
692
+ ${!this.hasFilters ? nothing : html `
693
+ <mo-icon-button icon='filter_list'
694
+ ${tooltip(t('More Filters'))}
695
+ ${style({ color: this.sidePanelTab === "filters" /* DataGridSidePanelTab.Filters */ ? 'var(--mo-color-accent)' : 'var(--mo-color-gray)' })}
696
+ @click=${() => this.navigateToSidePanelTab(this.sidePanelTab === "filters" /* DataGridSidePanelTab.Filters */ ? undefined : "filters" /* DataGridSidePanelTab.Filters */)}
697
+ ></mo-icon-button>
698
+ `}
699
+
700
+ <mo-icon-button icon='settings'
701
+ ${tooltip(t('Settings'))}
702
+ ${style({ color: this.sidePanelTab === "settings" /* DataGridSidePanelTab.Settings */ ? 'var(--mo-color-accent)' : 'var(--mo-color-gray)' })}
703
+ @click=${() => this.navigateToSidePanelTab(this.sidePanelTab === "settings" /* DataGridSidePanelTab.Settings */ ? undefined : "settings" /* DataGridSidePanelTab.Settings */)}
704
+ ></mo-icon-button>
710
705
  `;
711
706
  }
712
707
  // The reason for not doing this in the CSS is that we need to trim all the 0px values out of the columns
@@ -965,31 +960,32 @@ __decorate([
965
960
  DataGrid = DataGrid_1 = __decorate([
966
961
  component('mo-data-grid')
967
962
  ], DataGrid);
963
+ export { DataGrid };
968
964
  function subDataGridSelectorChanged() {
969
965
  const selector = this.subDataGridDataSelector;
970
966
  if (selector === undefined || !!this.getRowDetailsTemplate) {
971
967
  return;
972
968
  }
973
- this.getRowDetailsTemplate = (data) => html `
974
- <mo-data-grid ${style({ padding: '0px' })}
975
- .data=${getValueByKeyPath(data, selector)}
976
- headerHidden
977
- sidePanelHidden
978
- .columns=${this.columns}
979
- .subDataGridDataSelector=${this.subDataGridDataSelector}
980
- .hasDataDetail=${this.hasDataDetail}
981
- .selectionMode=${this.selectionMode}
982
- .isDataSelectable=${this.isDataSelectable}
983
- ?selectOnClick=${this.selectOnClick}
984
- ?selectionCheckboxesHidden=${this.selectionCheckboxesHidden}
985
- ?primaryContextMenuItemOnDoubleClick=${this.primaryContextMenuItemOnDoubleClick}
986
- ?multipleDetails=${this.multipleDetails}
987
- ?detailsOnClick=${this.detailsOnClick}
988
- .getRowContextMenuTemplate=${this.getRowContextMenuTemplate}
989
- editability=${this.editability}
990
- @rowClick=${(e) => this.rowClick.dispatch(e.detail)}
991
- @rowDoubleClick=${(e) => this.rowDoubleClick.dispatch(e.detail)}
992
- @cellEdit=${(e) => this.cellEdit.dispatch(e.detail)}
993
- ></mo-data-grid>
969
+ this.getRowDetailsTemplate = (data) => html `
970
+ <mo-data-grid ${style({ padding: '0px' })}
971
+ .data=${getValueByKeyPath(data, selector)}
972
+ headerHidden
973
+ sidePanelHidden
974
+ .columns=${this.columns}
975
+ .subDataGridDataSelector=${this.subDataGridDataSelector}
976
+ .hasDataDetail=${this.hasDataDetail}
977
+ .selectionMode=${this.selectionMode}
978
+ .isDataSelectable=${this.isDataSelectable}
979
+ ?selectOnClick=${this.selectOnClick}
980
+ ?selectionCheckboxesHidden=${this.selectionCheckboxesHidden}
981
+ ?primaryContextMenuItemOnDoubleClick=${this.primaryContextMenuItemOnDoubleClick}
982
+ ?multipleDetails=${this.multipleDetails}
983
+ ?detailsOnClick=${this.detailsOnClick}
984
+ .getRowContextMenuTemplate=${this.getRowContextMenuTemplate}
985
+ editability=${this.editability}
986
+ @rowClick=${(e) => this.rowClick.dispatch(e.detail)}
987
+ @rowDoubleClick=${(e) => this.rowDoubleClick.dispatch(e.detail)}
988
+ @cellEdit=${(e) => this.cellEdit.dispatch(e.detail)}
989
+ ></mo-data-grid>
994
990
  `;
995
991
  }