@3mo/data-grid 0.4.15 → 0.4.17
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/CsvGenerator.js +2 -2
- package/dist/DataGrid.js +293 -293
- package/dist/DataGridCell.js +40 -40
- package/dist/DataGridFooter.js +79 -79
- package/dist/DataGridHeader.js +90 -90
- package/dist/DataGridHeaderSeparator.js +42 -42
- package/dist/DataGridPrimaryContextMenuItem.js +5 -5
- package/dist/DataGridSidePanel.js +134 -134
- package/dist/FieldSelectDataGridPageSize.js +7 -7
- package/dist/columns/DataGridColumnBoolean.js +9 -9
- package/dist/columns/DataGridColumnDeletion.d.ts +2 -0
- package/dist/columns/DataGridColumnDeletion.d.ts.map +1 -1
- package/dist/columns/DataGridColumnDeletion.js +7 -2
- package/dist/columns/DataGridColumnImage.js +2 -2
- package/dist/columns/DataGridColumnText.js +5 -5
- package/dist/columns/date-time/DataGridColumnDateTimeBase.js +9 -9
- package/dist/columns/number/DataGridColumnCurrency.js +9 -9
- package/dist/columns/number/DataGridColumnNumber.js +5 -5
- package/dist/columns/number/DataGridColumnPercent.js +6 -6
- package/dist/columns/number/DataGridFooterSum.js +20 -20
- package/dist/rows/DataGridDefaultRow.js +47 -47
- package/dist/rows/DataGridRow.js +138 -138
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +56 -56
package/dist/DataGrid.js
CHANGED
|
@@ -369,186 +369,186 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
369
369
|
this.setPage(1);
|
|
370
370
|
}
|
|
371
371
|
static get styles() {
|
|
372
|
-
return css `
|
|
373
|
-
:host {
|
|
374
|
-
--mo-data-grid-column-details-width: 20px;
|
|
375
|
-
--mo-data-grid-column-selection-width: 40px;
|
|
376
|
-
--mo-data-grid-column-more-width: 20px;
|
|
377
|
-
|
|
378
|
-
--mo-data-grid-header-height: 32px;
|
|
379
|
-
--mo-data-grid-footer-min-height: 40px;
|
|
380
|
-
--mo-data-grid-toolbar-padding: 0px 14px 14px 14px;
|
|
381
|
-
--mo-data-grid-border: 1px solid var(--mo-color-transparent-gray-3);
|
|
382
|
-
|
|
383
|
-
/* --mo-data-grid-columns Generated in JS */
|
|
384
|
-
--mo-data-grid-columns-gap: 6px;
|
|
385
|
-
|
|
386
|
-
--mo-data-grid-row-tree-line-width: 8px;
|
|
387
|
-
--mo-details-data-grid-start-margin: 26px;
|
|
388
|
-
--mo-data-grid-cell-padding: 3px;
|
|
389
|
-
|
|
390
|
-
--mo-data-grid-selection-background: rgba(var(--mo-color-accent-base), 0.5);
|
|
391
|
-
display: flex;
|
|
392
|
-
flex-direction: column;
|
|
393
|
-
height: 100%;
|
|
394
|
-
overflow-x: hidden;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
:host([data-theme=light]) {
|
|
398
|
-
--mo-data-grid-alternating-background: rgba(var(--mo-color-foreground-base), 0.05);
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
:host([data-theme=dark]) {
|
|
402
|
-
--mo-data-grid-alternating-background: rgba(var(--mo-color-background-base), 0.2);
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
:host([preventVerticalContentScroll]) mo-scroller {
|
|
406
|
-
overflow-y: hidden;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
:host([preventVerticalContentScroll]) mo-scroller::part(container) {
|
|
410
|
-
position: relative;
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
:host(:not([selectionMode="none"])) {
|
|
414
|
-
--mo-data-grid-row-tree-line-width: 18px;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
:host([hasDetails]) {
|
|
418
|
-
--mo-data-grid-row-tree-line-width: 18px;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
#toolbar {
|
|
422
|
-
position: relative;
|
|
423
|
-
padding: var(--mo-data-grid-toolbar-padding);
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
#toolbar mo-icon-button {
|
|
427
|
-
align-self: flex-start;
|
|
428
|
-
color: var(--mo-color-gray);
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
#flexSelectionToolbar {
|
|
432
|
-
background: var(--mo-color-surface);
|
|
433
|
-
position: absolute;
|
|
434
|
-
inset: 0px;
|
|
435
|
-
width: 100%;
|
|
436
|
-
height: 100%;
|
|
437
|
-
z-index: 1;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
#flexSelectionToolbar > mo-flex {
|
|
441
|
-
background: var(--mo-data-grid-selection-background);
|
|
442
|
-
height: 100%;
|
|
443
|
-
align-items: center;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
#flexSelectionToolbar mo-icon-button {
|
|
447
|
-
align-self: center;
|
|
448
|
-
color: var(--mo-color-foreground);
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
#flexActions {
|
|
452
|
-
align-items: center;
|
|
453
|
-
justify-content: center;
|
|
454
|
-
padding-inline: 14px 6px;
|
|
455
|
-
margin: 6px 0;
|
|
456
|
-
cursor: pointer;
|
|
457
|
-
background: var(--mo-color-accent-transparent);
|
|
458
|
-
height: calc(100% - calc(2 * 6px));
|
|
459
|
-
max-height: 45px;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
#fab {
|
|
463
|
-
position: absolute;
|
|
464
|
-
top: -72px;
|
|
465
|
-
inset-inline-end: 16px;
|
|
466
|
-
transition: var(--mo-data-grid-fab-transition, 250ms);
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
:host([hasFooter]) #fab {
|
|
470
|
-
top: -28px;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
:host([fabSlotCollapsed][hasFabs]) #fab {
|
|
474
|
-
transform: scale(0);
|
|
475
|
-
opacity: 0;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
mo-data-grid-footer {
|
|
479
|
-
transition: var(--mo-data-grid-fab-transition, 250ms);
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
:host([hasSums][hasFabs]:not([fabSlotCollapsed])) mo-data-grid-footer {
|
|
483
|
-
--mo-data-grid-footer-trailing-padding: calc(var(--mo-data-grid-fab-slot-width, 56px) + 16px);
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
slot[name=fab] {
|
|
487
|
-
display: block;
|
|
488
|
-
z-index: 1;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
mo-empty-state, ::slotted(mo-empty-state) {
|
|
492
|
-
height: 100%;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
#overlayModeContainer {
|
|
496
|
-
position: relative;
|
|
497
|
-
height: 100%;
|
|
498
|
-
width: 100%;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
#overlayModeContainer mo-data-grid-side-panel {
|
|
502
|
-
position: absolute;
|
|
503
|
-
inset: 0;
|
|
504
|
-
width: 100%;
|
|
505
|
-
height: 100%;
|
|
506
|
-
z-index: 1;
|
|
507
|
-
background-color: var(--mo-color-surface);
|
|
508
|
-
}
|
|
372
|
+
return css `
|
|
373
|
+
:host {
|
|
374
|
+
--mo-data-grid-column-details-width: 20px;
|
|
375
|
+
--mo-data-grid-column-selection-width: 40px;
|
|
376
|
+
--mo-data-grid-column-more-width: 20px;
|
|
377
|
+
|
|
378
|
+
--mo-data-grid-header-height: 32px;
|
|
379
|
+
--mo-data-grid-footer-min-height: 40px;
|
|
380
|
+
--mo-data-grid-toolbar-padding: 0px 14px 14px 14px;
|
|
381
|
+
--mo-data-grid-border: 1px solid var(--mo-color-transparent-gray-3);
|
|
382
|
+
|
|
383
|
+
/* --mo-data-grid-columns Generated in JS */
|
|
384
|
+
--mo-data-grid-columns-gap: 6px;
|
|
385
|
+
|
|
386
|
+
--mo-data-grid-row-tree-line-width: 8px;
|
|
387
|
+
--mo-details-data-grid-start-margin: 26px;
|
|
388
|
+
--mo-data-grid-cell-padding: 3px;
|
|
389
|
+
|
|
390
|
+
--mo-data-grid-selection-background: rgba(var(--mo-color-accent-base), 0.5);
|
|
391
|
+
display: flex;
|
|
392
|
+
flex-direction: column;
|
|
393
|
+
height: 100%;
|
|
394
|
+
overflow-x: hidden;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
:host([data-theme=light]) {
|
|
398
|
+
--mo-data-grid-alternating-background: rgba(var(--mo-color-foreground-base), 0.05);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
:host([data-theme=dark]) {
|
|
402
|
+
--mo-data-grid-alternating-background: rgba(var(--mo-color-background-base), 0.2);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
:host([preventVerticalContentScroll]) mo-scroller {
|
|
406
|
+
overflow-y: hidden;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
:host([preventVerticalContentScroll]) mo-scroller::part(container) {
|
|
410
|
+
position: relative;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
:host(:not([selectionMode="none"])) {
|
|
414
|
+
--mo-data-grid-row-tree-line-width: 18px;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
:host([hasDetails]) {
|
|
418
|
+
--mo-data-grid-row-tree-line-width: 18px;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
#toolbar {
|
|
422
|
+
position: relative;
|
|
423
|
+
padding: var(--mo-data-grid-toolbar-padding);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
#toolbar mo-icon-button {
|
|
427
|
+
align-self: flex-start;
|
|
428
|
+
color: var(--mo-color-gray);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
#flexSelectionToolbar {
|
|
432
|
+
background: var(--mo-color-surface);
|
|
433
|
+
position: absolute;
|
|
434
|
+
inset: 0px;
|
|
435
|
+
width: 100%;
|
|
436
|
+
height: 100%;
|
|
437
|
+
z-index: 1;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
#flexSelectionToolbar > mo-flex {
|
|
441
|
+
background: var(--mo-data-grid-selection-background);
|
|
442
|
+
height: 100%;
|
|
443
|
+
align-items: center;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
#flexSelectionToolbar mo-icon-button {
|
|
447
|
+
align-self: center;
|
|
448
|
+
color: var(--mo-color-foreground);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
#flexActions {
|
|
452
|
+
align-items: center;
|
|
453
|
+
justify-content: center;
|
|
454
|
+
padding-inline: 14px 6px;
|
|
455
|
+
margin: 6px 0;
|
|
456
|
+
cursor: pointer;
|
|
457
|
+
background: var(--mo-color-accent-transparent);
|
|
458
|
+
height: calc(100% - calc(2 * 6px));
|
|
459
|
+
max-height: 45px;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
#fab {
|
|
463
|
+
position: absolute;
|
|
464
|
+
top: -72px;
|
|
465
|
+
inset-inline-end: 16px;
|
|
466
|
+
transition: var(--mo-data-grid-fab-transition, 250ms);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
:host([hasFooter]) #fab {
|
|
470
|
+
top: -28px;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
:host([fabSlotCollapsed][hasFabs]) #fab {
|
|
474
|
+
transform: scale(0);
|
|
475
|
+
opacity: 0;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
mo-data-grid-footer {
|
|
479
|
+
transition: var(--mo-data-grid-fab-transition, 250ms);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
:host([hasSums][hasFabs]:not([fabSlotCollapsed])) mo-data-grid-footer {
|
|
483
|
+
--mo-data-grid-footer-trailing-padding: calc(var(--mo-data-grid-fab-slot-width, 56px) + 16px);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
slot[name=fab] {
|
|
487
|
+
display: block;
|
|
488
|
+
z-index: 1;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
mo-empty-state, ::slotted(mo-empty-state) {
|
|
492
|
+
height: 100%;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
#overlayModeContainer {
|
|
496
|
+
position: relative;
|
|
497
|
+
height: 100%;
|
|
498
|
+
width: 100%;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
#overlayModeContainer mo-data-grid-side-panel {
|
|
502
|
+
position: absolute;
|
|
503
|
+
inset: 0;
|
|
504
|
+
width: 100%;
|
|
505
|
+
height: 100%;
|
|
506
|
+
z-index: 1;
|
|
507
|
+
background-color: var(--mo-color-surface);
|
|
508
|
+
}
|
|
509
509
|
`;
|
|
510
510
|
}
|
|
511
511
|
get template() {
|
|
512
|
-
return html `
|
|
513
|
-
<slot name='column' hidden ${observeMutation(() => this.requestUpdate())}>${this.columnsTemplate}</slot>
|
|
514
|
-
${this.toolbarTemplate}
|
|
515
|
-
${this.smallScreenObserverController.matches ? this.overlayModeTemplate : this.splitterModeTemplate}
|
|
512
|
+
return html `
|
|
513
|
+
<slot name='column' hidden ${observeMutation(() => this.requestUpdate())}>${this.columnsTemplate}</slot>
|
|
514
|
+
${this.toolbarTemplate}
|
|
515
|
+
${this.smallScreenObserverController.matches ? this.overlayModeTemplate : this.splitterModeTemplate}
|
|
516
516
|
`;
|
|
517
517
|
}
|
|
518
518
|
get splitterModeTemplate() {
|
|
519
|
-
return html `
|
|
520
|
-
<mo-splitter direction='horizontal-reversed' ${style({ height: '100%' })} .resizerTemplate=${html `
|
|
521
|
-
<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>
|
|
522
|
-
`}>
|
|
523
|
-
${cache(this.sidePanelTab === undefined ? html.nothing : html `
|
|
524
|
-
<mo-splitter-item size='min(25%, 300px)' min='max(15%, 250px)' max='clamp(100px, 50%, 750px)'>
|
|
525
|
-
${this.sidePanelTemplate}
|
|
526
|
-
</mo-splitter-item>
|
|
527
|
-
`)}
|
|
528
|
-
|
|
529
|
-
<mo-splitter-item min='0px' ${style({ position: 'relative' })}>
|
|
530
|
-
${this.dataGridTemplate}
|
|
531
|
-
</mo-splitter-item>
|
|
532
|
-
</mo-splitter>
|
|
519
|
+
return html `
|
|
520
|
+
<mo-splitter direction='horizontal-reversed' ${style({ height: '100%' })} .resizerTemplate=${html `
|
|
521
|
+
<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>
|
|
522
|
+
`}>
|
|
523
|
+
${cache(this.sidePanelTab === undefined ? html.nothing : html `
|
|
524
|
+
<mo-splitter-item size='min(25%, 300px)' min='max(15%, 250px)' max='clamp(100px, 50%, 750px)'>
|
|
525
|
+
${this.sidePanelTemplate}
|
|
526
|
+
</mo-splitter-item>
|
|
527
|
+
`)}
|
|
528
|
+
|
|
529
|
+
<mo-splitter-item min='0px' ${style({ position: 'relative' })}>
|
|
530
|
+
${this.dataGridTemplate}
|
|
531
|
+
</mo-splitter-item>
|
|
532
|
+
</mo-splitter>
|
|
533
533
|
`;
|
|
534
534
|
}
|
|
535
535
|
get overlayModeTemplate() {
|
|
536
|
-
return html `
|
|
537
|
-
<mo-flex id='overlayModeContainer'>
|
|
538
|
-
${this.dataGridTemplate}
|
|
539
|
-
${this.sidePanelTab === undefined ? html.nothing : this.sidePanelTemplate}
|
|
540
|
-
</mo-flex>
|
|
536
|
+
return html `
|
|
537
|
+
<mo-flex id='overlayModeContainer'>
|
|
538
|
+
${this.dataGridTemplate}
|
|
539
|
+
${this.sidePanelTab === undefined ? html.nothing : this.sidePanelTemplate}
|
|
540
|
+
</mo-flex>
|
|
541
541
|
`;
|
|
542
542
|
}
|
|
543
543
|
get sidePanelTemplate() {
|
|
544
|
-
return html `
|
|
545
|
-
<mo-data-grid-side-panel
|
|
546
|
-
.dataGrid=${this}
|
|
547
|
-
tab=${ifDefined(this.sidePanelTab)}
|
|
548
|
-
>
|
|
549
|
-
<slot slot='settings' name='settings'>${this.settingsDefaultTemplate}</slot>
|
|
550
|
-
<slot slot='filter' name='filter'>${this.filtersDefaultTemplate}</slot>
|
|
551
|
-
</mo-data-grid-side-panel>
|
|
544
|
+
return html `
|
|
545
|
+
<mo-data-grid-side-panel
|
|
546
|
+
.dataGrid=${this}
|
|
547
|
+
tab=${ifDefined(this.sidePanelTab)}
|
|
548
|
+
>
|
|
549
|
+
<slot slot='settings' name='settings'>${this.settingsDefaultTemplate}</slot>
|
|
550
|
+
<slot slot='filter' name='filter'>${this.filtersDefaultTemplate}</slot>
|
|
551
|
+
</mo-data-grid-side-panel>
|
|
552
552
|
`;
|
|
553
553
|
}
|
|
554
554
|
get settingsDefaultTemplate() {
|
|
@@ -567,40 +567,40 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
567
567
|
// These also update the respective attributes for now
|
|
568
568
|
this.hasSums;
|
|
569
569
|
this.hasFabs;
|
|
570
|
-
return html `
|
|
571
|
-
<slot name='fab' @slotchange=${() => { this.hasSums; this.hasFabs; }}></slot>
|
|
570
|
+
return html `
|
|
571
|
+
<slot name='fab' @slotchange=${() => { this.hasSums; this.hasFabs; }}></slot>
|
|
572
572
|
`;
|
|
573
573
|
}
|
|
574
574
|
get contentTemplate() {
|
|
575
575
|
return !this.data.length ? this.noContentTemplate : this.rowsTemplate;
|
|
576
576
|
}
|
|
577
577
|
get noContentTemplate() {
|
|
578
|
-
return html `
|
|
579
|
-
<slot name='error-no-content'>
|
|
580
|
-
<mo-empty-state icon='youtube_searched_for'>${t('No results')}</mo-empty-state>
|
|
581
|
-
</slot>
|
|
578
|
+
return html `
|
|
579
|
+
<slot name='error-no-content'>
|
|
580
|
+
<mo-empty-state icon='youtube_searched_for'>${t('No results')}</mo-empty-state>
|
|
581
|
+
</slot>
|
|
582
582
|
`;
|
|
583
583
|
}
|
|
584
584
|
get dataGridTemplate() {
|
|
585
585
|
this.provideCssColumnsProperties();
|
|
586
586
|
this.toggleAttribute('hasDetails', this.hasDetails);
|
|
587
|
-
return html `
|
|
588
|
-
<mo-flex ${style({ flex: '1', position: 'relative' })}>
|
|
589
|
-
<mo-grid ${style({ flex: '1' })} rows='* auto'>
|
|
590
|
-
<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)))'
|
|
591
|
-
<mo-grid ${style({ height: '100%' })} rows='auto *'>
|
|
592
|
-
${this.headerTemplate}
|
|
593
|
-
${this.contentTemplate}
|
|
594
|
-
</mo-grid>
|
|
595
|
-
</mo-scroller>
|
|
596
|
-
${this.footerTemplate}
|
|
597
|
-
</mo-grid>
|
|
598
|
-
</mo-flex>
|
|
587
|
+
return html `
|
|
588
|
+
<mo-flex ${style({ flex: '1', position: 'relative' })}>
|
|
589
|
+
<mo-grid ${style({ flex: '1' })} rows='* auto'>
|
|
590
|
+
<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)))' })}>
|
|
591
|
+
<mo-grid ${style({ height: '100%' })} rows='auto *'>
|
|
592
|
+
${this.headerTemplate}
|
|
593
|
+
${this.contentTemplate}
|
|
594
|
+
</mo-grid>
|
|
595
|
+
</mo-scroller>
|
|
596
|
+
${this.footerTemplate}
|
|
597
|
+
</mo-grid>
|
|
598
|
+
</mo-flex>
|
|
599
599
|
`;
|
|
600
600
|
}
|
|
601
601
|
get headerTemplate() {
|
|
602
|
-
return this.headerHidden ? html.nothing : html `
|
|
603
|
-
<mo-data-grid-header .dataGrid=${this}></mo-data-grid-header>
|
|
602
|
+
return this.headerHidden ? html.nothing : html `
|
|
603
|
+
<mo-data-grid-header .dataGrid=${this}></mo-data-grid-header>
|
|
604
604
|
`;
|
|
605
605
|
}
|
|
606
606
|
get rowsTemplate() {
|
|
@@ -609,26 +609,26 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
609
609
|
const content = shallVirtualize === false
|
|
610
610
|
? this.renderData.map(getRowTemplate)
|
|
611
611
|
: html `<mo-virtualized-scroller .items=${this.renderData} .getItemTemplate=${getRowTemplate}></mo-virtualized-scroller>`;
|
|
612
|
-
return html `
|
|
613
|
-
<mo-scroller id='rowsContainer'
|
|
614
|
-
${style({ gridRow: '2', gridColumn: '1 / last-line', overflowX: 'hidden' })}
|
|
615
|
-
${observeResize(() => this.requestUpdate())}
|
|
616
|
-
@scroll=${this.handleScroll}
|
|
617
|
-
>
|
|
618
|
-
${content}
|
|
619
|
-
</mo-scroller>
|
|
612
|
+
return html `
|
|
613
|
+
<mo-scroller id='rowsContainer'
|
|
614
|
+
${style({ gridRow: '2', gridColumn: '1 / last-line', overflowX: 'hidden' })}
|
|
615
|
+
${observeResize(() => this.requestUpdate())}
|
|
616
|
+
@scroll=${this.handleScroll}
|
|
617
|
+
>
|
|
618
|
+
${content}
|
|
619
|
+
</mo-scroller>
|
|
620
620
|
`;
|
|
621
621
|
}
|
|
622
622
|
getRowTemplate(data, index) {
|
|
623
|
-
return staticHtml `
|
|
624
|
-
<${this.rowElementTag} part='row'
|
|
625
|
-
.dataGrid=${this}
|
|
626
|
-
.data=${data}
|
|
627
|
-
?data-has-alternating-background=${this.hasAlternatingBackground && index % 2 === 1}
|
|
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}>
|
|
623
|
+
return staticHtml `
|
|
624
|
+
<${this.rowElementTag} part='row'
|
|
625
|
+
.dataGrid=${this}
|
|
626
|
+
.data=${data}
|
|
627
|
+
?data-has-alternating-background=${this.hasAlternatingBackground && index % 2 === 1}
|
|
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}>
|
|
632
632
|
`;
|
|
633
633
|
}
|
|
634
634
|
handleRowDetailsOpenChange(data, open) {
|
|
@@ -643,30 +643,30 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
643
643
|
: this.openDetailedData.filter(d => d !== data);
|
|
644
644
|
}
|
|
645
645
|
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>
|
|
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>
|
|
660
660
|
`;
|
|
661
661
|
}
|
|
662
662
|
get sumsData() {
|
|
663
663
|
return this.selectedData.length > 0 ? this.selectedData : this.renderData;
|
|
664
664
|
}
|
|
665
665
|
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>
|
|
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>
|
|
670
670
|
`;
|
|
671
671
|
}
|
|
672
672
|
getSumTemplate(column) {
|
|
@@ -678,24 +678,24 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
678
678
|
.filter(n => isNaN(n) === false)
|
|
679
679
|
.reduce(((a, b) => a + b), 0)
|
|
680
680
|
|| 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>
|
|
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>
|
|
685
685
|
`;
|
|
686
686
|
}
|
|
687
687
|
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>
|
|
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>
|
|
699
699
|
`;
|
|
700
700
|
}
|
|
701
701
|
get toolbarDefaultTemplate() {
|
|
@@ -708,42 +708,42 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
708
708
|
return html.nothing;
|
|
709
709
|
}
|
|
710
710
|
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) => { 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 : 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>
|
|
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) => { 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 : 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>
|
|
730
730
|
`;
|
|
731
731
|
}
|
|
732
732
|
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>
|
|
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>
|
|
747
747
|
`;
|
|
748
748
|
}
|
|
749
749
|
// The reason for not doing this in the CSS is that we need to trim all the 0px values out of the columns
|
|
@@ -1055,27 +1055,27 @@ function subDataGridSelectorChanged() {
|
|
|
1055
1055
|
if (selector === undefined || !!this.getRowDetailsTemplate) {
|
|
1056
1056
|
return;
|
|
1057
1057
|
}
|
|
1058
|
-
this.getRowDetailsTemplate = (data) => html `
|
|
1059
|
-
<mo-data-grid ${style({ padding: '0px' })}
|
|
1060
|
-
.data=${getValueByKeyPath(data, selector)}
|
|
1061
|
-
headerHidden
|
|
1062
|
-
sidePanelHidden
|
|
1063
|
-
.columns=${this.columns}
|
|
1064
|
-
.subDataGridDataSelector=${this.subDataGridDataSelector}
|
|
1065
|
-
.hasDataDetail=${this.hasDataDetail}
|
|
1066
|
-
.selectionMode=${this.selectionMode}
|
|
1067
|
-
.isDataSelectable=${this.isDataSelectable}
|
|
1068
|
-
?selectOnClick=${this.selectOnClick}
|
|
1069
|
-
?selectionCheckboxesHidden=${this.selectionCheckboxesHidden}
|
|
1070
|
-
?primaryContextMenuItemOnDoubleClick=${this.primaryContextMenuItemOnDoubleClick}
|
|
1071
|
-
?multipleDetails=${this.multipleDetails}
|
|
1072
|
-
?detailsOnClick=${this.detailsOnClick}
|
|
1073
|
-
.getRowContextMenuTemplate=${this.getRowContextMenuTemplate}
|
|
1074
|
-
editability=${this.editability}
|
|
1075
|
-
@rowClick=${(e) => this.rowClick.dispatch(e.detail)}
|
|
1076
|
-
@rowDoubleClick=${(e) => this.rowDoubleClick.dispatch(e.detail)}
|
|
1077
|
-
@rowMiddleClick=${(e) => this.rowMiddleClick.dispatch(e.detail)}
|
|
1078
|
-
@cellEdit=${(e) => this.cellEdit.dispatch(e.detail)}
|
|
1079
|
-
></mo-data-grid>
|
|
1058
|
+
this.getRowDetailsTemplate = (data) => html `
|
|
1059
|
+
<mo-data-grid ${style({ padding: '0px' })}
|
|
1060
|
+
.data=${getValueByKeyPath(data, selector)}
|
|
1061
|
+
headerHidden
|
|
1062
|
+
sidePanelHidden
|
|
1063
|
+
.columns=${this.columns}
|
|
1064
|
+
.subDataGridDataSelector=${this.subDataGridDataSelector}
|
|
1065
|
+
.hasDataDetail=${this.hasDataDetail}
|
|
1066
|
+
.selectionMode=${this.selectionMode}
|
|
1067
|
+
.isDataSelectable=${this.isDataSelectable}
|
|
1068
|
+
?selectOnClick=${this.selectOnClick}
|
|
1069
|
+
?selectionCheckboxesHidden=${this.selectionCheckboxesHidden}
|
|
1070
|
+
?primaryContextMenuItemOnDoubleClick=${this.primaryContextMenuItemOnDoubleClick}
|
|
1071
|
+
?multipleDetails=${this.multipleDetails}
|
|
1072
|
+
?detailsOnClick=${this.detailsOnClick}
|
|
1073
|
+
.getRowContextMenuTemplate=${this.getRowContextMenuTemplate}
|
|
1074
|
+
editability=${this.editability}
|
|
1075
|
+
@rowClick=${(e) => this.rowClick.dispatch(e.detail)}
|
|
1076
|
+
@rowDoubleClick=${(e) => this.rowDoubleClick.dispatch(e.detail)}
|
|
1077
|
+
@rowMiddleClick=${(e) => this.rowMiddleClick.dispatch(e.detail)}
|
|
1078
|
+
@cellEdit=${(e) => this.cellEdit.dispatch(e.detail)}
|
|
1079
|
+
></mo-data-grid>
|
|
1080
1080
|
`;
|
|
1081
1081
|
}
|