@3mo/data-grid 0.2.9 → 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,184 +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: 0px 14px 14px 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
- #toolbar {
388
- position: relative;
389
- padding: var(--mo-data-grid-toolbar-padding);
390
- }
391
-
392
- #toolbar 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
- }
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
+ }
471
478
  `;
472
479
  }
473
480
  get template() {
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}
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}
478
485
  `;
479
486
  }
480
487
  get splitterModeTemplate() {
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>
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>
495
502
  `;
496
503
  }
497
504
  get overlayModeTemplate() {
498
- return html `
499
- <mo-flex id='overlayModeContainer'>
500
- ${this.dataGridTemplate}
501
- ${this.sidePanelTab === undefined ? nothing : this.sidePanelTemplate}
502
- </mo-flex>
505
+ return html `
506
+ <mo-flex id='overlayModeContainer'>
507
+ ${this.dataGridTemplate}
508
+ ${this.sidePanelTab === undefined ? nothing : this.sidePanelTemplate}
509
+ </mo-flex>
503
510
  `;
504
511
  }
505
512
  get sidePanelTemplate() {
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>
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>
514
521
  `;
515
522
  }
516
523
  get settingsDefaultTemplate() {
@@ -529,40 +536,40 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
529
536
  // These also update the respective attributes for now
530
537
  this.hasSums;
531
538
  this.hasFabs;
532
- return html `
533
- <slot name='fab' @slotchange=${() => { this.hasSums; this.hasFabs; }}></slot>
539
+ return html `
540
+ <slot name='fab' @slotchange=${() => { this.hasSums; this.hasFabs; }}></slot>
534
541
  `;
535
542
  }
536
543
  get contentTemplate() {
537
544
  return !this.data.length ? this.noContentTemplate : this.rowsTemplate;
538
545
  }
539
546
  get noContentTemplate() {
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>
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>
544
551
  `;
545
552
  }
546
553
  get dataGridTemplate() {
547
554
  this.provideCssColumnsProperties();
548
555
  this.toggleAttribute('hasDetails', this.hasDetails);
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>
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>
561
568
  `;
562
569
  }
563
570
  get headerTemplate() {
564
- return this.headerHidden ? nothing : html `
565
- <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>
566
573
  `;
567
574
  }
568
575
  get rowsTemplate() {
@@ -571,26 +578,26 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
571
578
  const content = shallVirtualize === false
572
579
  ? this.renderData.map(getRowTemplate)
573
580
  : html `<mo-virtualized-scroller .items=${this.renderData} .getItemTemplate=${getRowTemplate}></mo-virtualized-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>
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>
582
589
  `;
583
590
  }
584
591
  getRowTemplate(data, index) {
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}>
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}>
594
601
  `;
595
602
  }
596
603
  handleRowDetailsOpenChange(data, event) {
@@ -608,20 +615,20 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
608
615
  }
609
616
  }
610
617
  get footerTemplate() {
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>
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>
625
632
  `;
626
633
  }
627
634
  get sumsTemplate() {
@@ -636,24 +643,24 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
636
643
  .filter(n => isNaN(n) === false)
637
644
  .reduce(((a, b) => a + b), 0)
638
645
  || 0;
639
- return html `
640
- <mo-data-grid-footer-sum heading=${column.sumHeading}>
641
- ${column.getSumTemplate(sum)}
642
- </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>
643
650
  `;
644
651
  }
645
652
  get toolbarTemplate() {
646
- return this.hasToolbar === false ? nothing : html `
647
- <mo-flex id='toolbar' 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>
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>
657
664
  `;
658
665
  }
659
666
  get toolbarDefaultTemplate() {
@@ -666,42 +673,42 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
666
673
  return nothing;
667
674
  }
668
675
  get selectionToolbarTemplate() {
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>
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>
688
695
  `;
689
696
  }
690
697
  get toolbarActionsTemplate() {
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>
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>
705
712
  `;
706
713
  }
707
714
  // The reason for not doing this in the CSS is that we need to trim all the 0px values out of the columns
@@ -871,7 +878,7 @@ __decorate([
871
878
  property({ type: Number })
872
879
  ], DataGrid.prototype, "page", void 0);
873
880
  __decorate([
874
- 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) })
875
882
  ], DataGrid.prototype, "pagination", void 0);
876
883
  __decorate([
877
884
  property({ type: Object })
@@ -966,26 +973,26 @@ function subDataGridSelectorChanged() {
966
973
  if (selector === undefined || !!this.getRowDetailsTemplate) {
967
974
  return;
968
975
  }
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>
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>
990
997
  `;
991
998
  }