@3mo/data-grid 0.2.8 → 0.2.10

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