@3mo/data-grid 0.4.18 → 0.4.20
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.d.ts +2 -1
- package/dist/CsvGenerator.d.ts.map +1 -1
- package/dist/CsvGenerator.js +7 -15
- package/dist/DataGrid.d.ts +2 -0
- package/dist/DataGrid.d.ts.map +1 -1
- package/dist/DataGrid.js +300 -296
- package/dist/DataGridCell.js +40 -40
- package/dist/DataGridFooter.d.ts +1 -0
- package/dist/DataGridFooter.d.ts.map +1 -1
- package/dist/DataGridFooter.js +98 -79
- package/dist/DataGridHeader.js +90 -90
- package/dist/DataGridHeaderSeparator.js +42 -42
- package/dist/DataGridPrimaryContextMenuItem.js +5 -5
- package/dist/DataGridSidePanel.d.ts.map +1 -1
- package/dist/DataGridSidePanel.js +127 -134
- package/dist/FieldSelectDataGridPageSize.js +7 -7
- package/dist/columns/DataGridColumnBoolean.js +9 -9
- 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/excel.svg.d.ts +3 -0
- package/dist/excel.svg.d.ts.map +1 -0
- package/dist/excel.svg.js +48 -0
- 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
|
@@ -85,6 +85,7 @@ export var DataGridEditability;
|
|
|
85
85
|
* @attr preventFabCollapse - Whether the FAB should be prevented from collapsing.
|
|
86
86
|
* @attr cellFontSize - The font size of the cells relative to the default font size. Defaults @see DataGrid.cellFontSize 's value which defaults to 0.8.
|
|
87
87
|
* @attr rowHeight - The height of the rows in pixels. Defaults to @see DataGrid.rowHeight 's value which defaults to 35.
|
|
88
|
+
* @attr exportable - Whether the DataGrid is exportable. This will show an export button in the footer.
|
|
88
89
|
*
|
|
89
90
|
* @slot - Use this slot only for declarative DataGrid APIs e.g. setting ColumnDefinitions via `mo-data-grid-columns` tag.
|
|
90
91
|
* @slot toolbar - The horizontal bar above DataGrid's contents.
|
|
@@ -136,6 +137,7 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
136
137
|
this.hasAlternatingBackground = DataGrid_1.hasAlternatingBackground.value;
|
|
137
138
|
this.preventFabCollapse = false;
|
|
138
139
|
this.fabSlotCollapsed = false;
|
|
140
|
+
this.exportable = false;
|
|
139
141
|
this.cellFontSize = DataGrid_1.cellRelativeFontSize.value;
|
|
140
142
|
this.rowHeight = DataGrid_1.rowHeight.value;
|
|
141
143
|
this.slotController = new SlotController(this, async () => {
|
|
@@ -281,8 +283,7 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
281
283
|
}
|
|
282
284
|
exportExcelFile() {
|
|
283
285
|
try {
|
|
284
|
-
|
|
285
|
-
CsvGenerator.generate(this.data, selectors);
|
|
286
|
+
CsvGenerator.generate(this);
|
|
286
287
|
NotificationComponent.notifyInfo(t('Exporting excel file'));
|
|
287
288
|
}
|
|
288
289
|
catch (error) {
|
|
@@ -341,7 +342,7 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
341
342
|
return this.pagination;
|
|
342
343
|
}
|
|
343
344
|
get hasFooter() {
|
|
344
|
-
const value = this.hasPagination || this.hasSums;
|
|
345
|
+
const value = this.hasPagination || this.hasSums || this.exportable;
|
|
345
346
|
this.toggleAttribute('hasFooter', value);
|
|
346
347
|
return value;
|
|
347
348
|
}
|
|
@@ -369,186 +370,186 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
369
370
|
this.setPage(1);
|
|
370
371
|
}
|
|
371
372
|
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
|
-
}
|
|
373
|
+
return css `
|
|
374
|
+
:host {
|
|
375
|
+
--mo-data-grid-column-details-width: 20px;
|
|
376
|
+
--mo-data-grid-column-selection-width: 40px;
|
|
377
|
+
--mo-data-grid-column-more-width: 20px;
|
|
378
|
+
|
|
379
|
+
--mo-data-grid-header-height: 32px;
|
|
380
|
+
--mo-data-grid-footer-min-height: 40px;
|
|
381
|
+
--mo-data-grid-toolbar-padding: 0px 14px 14px 14px;
|
|
382
|
+
--mo-data-grid-border: 1px solid var(--mo-color-transparent-gray-3);
|
|
383
|
+
|
|
384
|
+
/* --mo-data-grid-columns Generated in JS */
|
|
385
|
+
--mo-data-grid-columns-gap: 6px;
|
|
386
|
+
|
|
387
|
+
--mo-data-grid-row-tree-line-width: 8px;
|
|
388
|
+
--mo-details-data-grid-start-margin: 26px;
|
|
389
|
+
--mo-data-grid-cell-padding: 3px;
|
|
390
|
+
|
|
391
|
+
--mo-data-grid-selection-background: rgba(var(--mo-color-accent-base), 0.5);
|
|
392
|
+
display: flex;
|
|
393
|
+
flex-direction: column;
|
|
394
|
+
height: 100%;
|
|
395
|
+
overflow-x: hidden;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
:host([data-theme=light]) {
|
|
399
|
+
--mo-data-grid-alternating-background: rgba(var(--mo-color-foreground-base), 0.05);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
:host([data-theme=dark]) {
|
|
403
|
+
--mo-data-grid-alternating-background: rgba(var(--mo-color-background-base), 0.2);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
:host([preventVerticalContentScroll]) mo-scroller {
|
|
407
|
+
overflow-y: hidden;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
:host([preventVerticalContentScroll]) mo-scroller::part(container) {
|
|
411
|
+
position: relative;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
:host(:not([selectionMode="none"])) {
|
|
415
|
+
--mo-data-grid-row-tree-line-width: 18px;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
:host([hasDetails]) {
|
|
419
|
+
--mo-data-grid-row-tree-line-width: 18px;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
#toolbar {
|
|
423
|
+
position: relative;
|
|
424
|
+
padding: var(--mo-data-grid-toolbar-padding);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
#toolbar mo-icon-button {
|
|
428
|
+
align-self: flex-start;
|
|
429
|
+
color: var(--mo-color-gray);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
#flexSelectionToolbar {
|
|
433
|
+
background: var(--mo-color-surface);
|
|
434
|
+
position: absolute;
|
|
435
|
+
inset: 0px;
|
|
436
|
+
width: 100%;
|
|
437
|
+
height: 100%;
|
|
438
|
+
z-index: 1;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
#flexSelectionToolbar > mo-flex {
|
|
442
|
+
background: var(--mo-data-grid-selection-background);
|
|
443
|
+
height: 100%;
|
|
444
|
+
align-items: center;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
#flexSelectionToolbar mo-icon-button {
|
|
448
|
+
align-self: center;
|
|
449
|
+
color: var(--mo-color-foreground);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
#flexActions {
|
|
453
|
+
align-items: center;
|
|
454
|
+
justify-content: center;
|
|
455
|
+
padding-inline: 14px 6px;
|
|
456
|
+
margin: 6px 0;
|
|
457
|
+
cursor: pointer;
|
|
458
|
+
background: var(--mo-color-accent-transparent);
|
|
459
|
+
height: calc(100% - calc(2 * 6px));
|
|
460
|
+
max-height: 45px;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
#fab {
|
|
464
|
+
position: absolute;
|
|
465
|
+
top: -72px;
|
|
466
|
+
inset-inline-end: 16px;
|
|
467
|
+
transition: var(--mo-data-grid-fab-transition, 250ms);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
:host([hasFooter]) #fab {
|
|
471
|
+
top: -28px;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
:host([fabSlotCollapsed][hasFabs]) #fab {
|
|
475
|
+
transform: scale(0);
|
|
476
|
+
opacity: 0;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
mo-data-grid-footer {
|
|
480
|
+
transition: var(--mo-data-grid-fab-transition, 250ms);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
:host([hasSums][hasFabs]:not([fabSlotCollapsed])) mo-data-grid-footer {
|
|
484
|
+
--mo-data-grid-footer-trailing-padding: calc(var(--mo-data-grid-fab-slot-width, 56px) + 16px);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
slot[name=fab] {
|
|
488
|
+
display: block;
|
|
489
|
+
z-index: 1;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
mo-empty-state, ::slotted(mo-empty-state) {
|
|
493
|
+
height: 100%;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
#overlayModeContainer {
|
|
497
|
+
position: relative;
|
|
498
|
+
height: 100%;
|
|
499
|
+
width: 100%;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
#overlayModeContainer mo-data-grid-side-panel {
|
|
503
|
+
position: absolute;
|
|
504
|
+
inset: 0;
|
|
505
|
+
width: 100%;
|
|
506
|
+
height: 100%;
|
|
507
|
+
z-index: 1;
|
|
508
|
+
background-color: var(--mo-color-surface);
|
|
509
|
+
}
|
|
509
510
|
`;
|
|
510
511
|
}
|
|
511
512
|
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}
|
|
513
|
+
return html `
|
|
514
|
+
<slot name='column' hidden ${observeMutation(() => this.requestUpdate())}>${this.columnsTemplate}</slot>
|
|
515
|
+
${this.toolbarTemplate}
|
|
516
|
+
${this.smallScreenObserverController.matches ? this.overlayModeTemplate : this.splitterModeTemplate}
|
|
516
517
|
`;
|
|
517
518
|
}
|
|
518
519
|
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>
|
|
520
|
+
return html `
|
|
521
|
+
<mo-splitter direction='horizontal-reversed' ${style({ height: '100%' })} .resizerTemplate=${html `
|
|
522
|
+
<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>
|
|
523
|
+
`}>
|
|
524
|
+
${cache(this.sidePanelTab === undefined ? html.nothing : html `
|
|
525
|
+
<mo-splitter-item size='min(25%, 300px)' min='max(15%, 250px)' max='clamp(100px, 50%, 750px)'>
|
|
526
|
+
${this.sidePanelTemplate}
|
|
527
|
+
</mo-splitter-item>
|
|
528
|
+
`)}
|
|
529
|
+
|
|
530
|
+
<mo-splitter-item min='0px' ${style({ position: 'relative' })}>
|
|
531
|
+
${this.dataGridTemplate}
|
|
532
|
+
</mo-splitter-item>
|
|
533
|
+
</mo-splitter>
|
|
533
534
|
`;
|
|
534
535
|
}
|
|
535
536
|
get overlayModeTemplate() {
|
|
536
|
-
return html `
|
|
537
|
-
<mo-flex id='overlayModeContainer'>
|
|
538
|
-
${this.dataGridTemplate}
|
|
539
|
-
${this.sidePanelTab === undefined ? html.nothing : this.sidePanelTemplate}
|
|
540
|
-
</mo-flex>
|
|
537
|
+
return html `
|
|
538
|
+
<mo-flex id='overlayModeContainer'>
|
|
539
|
+
${this.dataGridTemplate}
|
|
540
|
+
${this.sidePanelTab === undefined ? html.nothing : this.sidePanelTemplate}
|
|
541
|
+
</mo-flex>
|
|
541
542
|
`;
|
|
542
543
|
}
|
|
543
544
|
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>
|
|
545
|
+
return html `
|
|
546
|
+
<mo-data-grid-side-panel
|
|
547
|
+
.dataGrid=${this}
|
|
548
|
+
tab=${ifDefined(this.sidePanelTab)}
|
|
549
|
+
>
|
|
550
|
+
<slot slot='settings' name='settings'>${this.settingsDefaultTemplate}</slot>
|
|
551
|
+
<slot slot='filter' name='filter'>${this.filtersDefaultTemplate}</slot>
|
|
552
|
+
</mo-data-grid-side-panel>
|
|
552
553
|
`;
|
|
553
554
|
}
|
|
554
555
|
get settingsDefaultTemplate() {
|
|
@@ -567,40 +568,40 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
567
568
|
// These also update the respective attributes for now
|
|
568
569
|
this.hasSums;
|
|
569
570
|
this.hasFabs;
|
|
570
|
-
return html `
|
|
571
|
-
<slot name='fab' @slotchange=${() => { this.hasSums; this.hasFabs; }}></slot>
|
|
571
|
+
return html `
|
|
572
|
+
<slot name='fab' @slotchange=${() => { this.hasSums; this.hasFabs; }}></slot>
|
|
572
573
|
`;
|
|
573
574
|
}
|
|
574
575
|
get contentTemplate() {
|
|
575
576
|
return !this.data.length ? this.noContentTemplate : this.rowsTemplate;
|
|
576
577
|
}
|
|
577
578
|
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>
|
|
579
|
+
return html `
|
|
580
|
+
<slot name='error-no-content'>
|
|
581
|
+
<mo-empty-state icon='youtube_searched_for'>${t('No results')}</mo-empty-state>
|
|
582
|
+
</slot>
|
|
582
583
|
`;
|
|
583
584
|
}
|
|
584
585
|
get dataGridTemplate() {
|
|
585
586
|
this.provideCssColumnsProperties();
|
|
586
587
|
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>
|
|
588
|
+
return html `
|
|
589
|
+
<mo-flex ${style({ flex: '1', position: 'relative' })}>
|
|
590
|
+
<mo-grid ${style({ flex: '1' })} rows='* auto'>
|
|
591
|
+
<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)))' })}>
|
|
592
|
+
<mo-grid ${style({ height: '100%' })} rows='auto *'>
|
|
593
|
+
${this.headerTemplate}
|
|
594
|
+
${this.contentTemplate}
|
|
595
|
+
</mo-grid>
|
|
596
|
+
</mo-scroller>
|
|
597
|
+
${this.footerTemplate}
|
|
598
|
+
</mo-grid>
|
|
599
|
+
</mo-flex>
|
|
599
600
|
`;
|
|
600
601
|
}
|
|
601
602
|
get headerTemplate() {
|
|
602
|
-
return this.headerHidden ? html.nothing : html `
|
|
603
|
-
<mo-data-grid-header .dataGrid=${this}></mo-data-grid-header>
|
|
603
|
+
return this.headerHidden ? html.nothing : html `
|
|
604
|
+
<mo-data-grid-header .dataGrid=${this}></mo-data-grid-header>
|
|
604
605
|
`;
|
|
605
606
|
}
|
|
606
607
|
get rowsTemplate() {
|
|
@@ -609,26 +610,26 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
609
610
|
const content = shallVirtualize === false
|
|
610
611
|
? this.renderData.map(getRowTemplate)
|
|
611
612
|
: 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>
|
|
613
|
+
return html `
|
|
614
|
+
<mo-scroller id='rowsContainer'
|
|
615
|
+
${style({ gridRow: '2', gridColumn: '1 / last-line', overflowX: 'hidden' })}
|
|
616
|
+
${observeResize(() => this.requestUpdate())}
|
|
617
|
+
@scroll=${this.handleScroll}
|
|
618
|
+
>
|
|
619
|
+
${content}
|
|
620
|
+
</mo-scroller>
|
|
620
621
|
`;
|
|
621
622
|
}
|
|
622
623
|
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}>
|
|
624
|
+
return staticHtml `
|
|
625
|
+
<${this.rowElementTag} part='row'
|
|
626
|
+
.dataGrid=${this}
|
|
627
|
+
.data=${data}
|
|
628
|
+
?data-has-alternating-background=${this.hasAlternatingBackground && index % 2 === 1}
|
|
629
|
+
?selected=${live(this.selectedData.includes(data))}
|
|
630
|
+
?detailsOpen=${live(this.openDetailedData.includes(data))}
|
|
631
|
+
@detailsOpenChange=${(event) => this.handleRowDetailsOpenChange(data, event.detail)}
|
|
632
|
+
></${this.rowElementTag}>
|
|
632
633
|
`;
|
|
633
634
|
}
|
|
634
635
|
handleRowDetailsOpenChange(data, open) {
|
|
@@ -643,30 +644,30 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
643
644
|
: this.openDetailedData.filter(d => d !== data);
|
|
644
645
|
}
|
|
645
646
|
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>
|
|
647
|
+
return html `
|
|
648
|
+
<mo-flex ${style({ position: 'relative' })}>
|
|
649
|
+
<mo-flex id='fab' direction='vertical-reversed' gap='8px'>
|
|
650
|
+
${this.fabTemplate}
|
|
651
|
+
</mo-flex>
|
|
652
|
+
${this.hasFooter === false ? html.nothing : html `
|
|
653
|
+
<mo-data-grid-footer
|
|
654
|
+
.dataGrid=${this}
|
|
655
|
+
page=${this.page}
|
|
656
|
+
>
|
|
657
|
+
<slot name='sum' slot='sum'>${this.sumDefaultTemplate}</slot>
|
|
658
|
+
</mo-data-grid-footer>
|
|
659
|
+
`}
|
|
660
|
+
</mo-flex>
|
|
660
661
|
`;
|
|
661
662
|
}
|
|
662
663
|
get sumsData() {
|
|
663
664
|
return this.selectedData.length > 0 ? this.selectedData : this.renderData;
|
|
664
665
|
}
|
|
665
666
|
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>
|
|
667
|
+
return html `
|
|
668
|
+
<mo-flex direction='horizontal' gap='10px' wrap='wrap-reverse' alignItems='center' ${style({ padding: '2px 4px' })}>
|
|
669
|
+
${this.columns.map(column => this.getSumTemplate(column))}
|
|
670
|
+
</mo-flex>
|
|
670
671
|
`;
|
|
671
672
|
}
|
|
672
673
|
getSumTemplate(column) {
|
|
@@ -678,24 +679,24 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
678
679
|
.filter(n => isNaN(n) === false)
|
|
679
680
|
.reduce(((a, b) => a + b), 0)
|
|
680
681
|
|| 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>
|
|
682
|
+
return html `
|
|
683
|
+
<mo-data-grid-footer-sum heading=${column.sumHeading + ''} ${style({ color: this.selectedData.length > 0 ? 'var(--mo-color-accent)' : 'currentColor' })}>
|
|
684
|
+
${column.getSumTemplate(sum)}
|
|
685
|
+
</mo-data-grid-footer-sum>
|
|
685
686
|
`;
|
|
686
687
|
}
|
|
687
688
|
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>
|
|
689
|
+
return this.hasToolbar === false ? html.nothing : html `
|
|
690
|
+
<mo-flex id='toolbar' direction='horizontal' gap='8px' wrap='wrap' justifyContent='end' alignItems='center'>
|
|
691
|
+
<mo-flex direction='horizontal' alignItems='inherit' gap='8px' wrap='wrap' ${style({ flex: '1' })}>
|
|
692
|
+
<slot name='toolbar'>${this.toolbarDefaultTemplate}</slot>
|
|
693
|
+
</mo-flex>
|
|
694
|
+
<mo-flex direction='horizontal' gap='8px'>
|
|
695
|
+
<slot name='toolbarAction'>${this.toolbarActionDefaultTemplate}</slot>
|
|
696
|
+
${this.toolbarActionsTemplate}
|
|
697
|
+
${this.selectionToolbarTemplate}
|
|
698
|
+
</mo-flex>
|
|
699
|
+
</mo-flex>
|
|
699
700
|
`;
|
|
700
701
|
}
|
|
701
702
|
get toolbarDefaultTemplate() {
|
|
@@ -708,42 +709,42 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
708
709
|
return html.nothing;
|
|
709
710
|
}
|
|
710
711
|
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>
|
|
712
|
+
return this.selectionToolbarDisabled === true || this.selectedData.length === 0 ? html.nothing : html `
|
|
713
|
+
<mo-flex id='flexSelectionToolbar'>
|
|
714
|
+
<mo-flex direction='horizontal' gap='30px' ${style({ placeSelf: 'stretch' })}>
|
|
715
|
+
<div ${style({ fontWeight: '500', margin: '0 6px' })}>
|
|
716
|
+
${t('${count:pluralityNumber} entries selected', { count: this.selectedData.length })}
|
|
717
|
+
</div>
|
|
718
|
+
${!this.getRowContextMenuTemplate ? html.nothing : html `
|
|
719
|
+
<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); }}>
|
|
720
|
+
<div ${style({ flex: '1' })}>${t('Options')}</div>
|
|
721
|
+
<mo-icon-button dense icon='arrow_drop_down' ${style({ display: 'flex', alignItems: 'center', justifyContent: 'center' })}></mo-icon-button>
|
|
722
|
+
</mo-flex>
|
|
723
|
+
`}
|
|
724
|
+
<div ${style({ flex: '1' })}></div>
|
|
725
|
+
<mo-icon-button icon='close'
|
|
726
|
+
${tooltip(t('Deselect All'))}
|
|
727
|
+
@click=${() => this.deselectAll()}
|
|
728
|
+
></mo-icon-button>
|
|
729
|
+
</mo-flex>
|
|
730
|
+
</mo-flex>
|
|
730
731
|
`;
|
|
731
732
|
}
|
|
732
733
|
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>
|
|
734
|
+
return html `
|
|
735
|
+
${!this.hasFilters ? html.nothing : html `
|
|
736
|
+
<mo-icon-button icon='filter_list'
|
|
737
|
+
${tooltip(t('More Filters'))}
|
|
738
|
+
${style({ color: this.sidePanelTab === DataGridSidePanelTab.Filters ? 'var(--mo-color-accent)' : 'var(--mo-color-gray)' })}
|
|
739
|
+
@click=${() => this.navigateToSidePanelTab(this.sidePanelTab === DataGridSidePanelTab.Filters ? undefined : DataGridSidePanelTab.Filters)}
|
|
740
|
+
></mo-icon-button>
|
|
741
|
+
`}
|
|
742
|
+
|
|
743
|
+
<mo-icon-button icon='settings'
|
|
744
|
+
${tooltip(t('Settings'))}
|
|
745
|
+
${style({ color: this.sidePanelTab === DataGridSidePanelTab.Settings ? 'var(--mo-color-accent)' : 'var(--mo-color-gray)' })}
|
|
746
|
+
@click=${() => this.navigateToSidePanelTab(this.sidePanelTab === DataGridSidePanelTab.Settings ? undefined : DataGridSidePanelTab.Settings)}
|
|
747
|
+
></mo-icon-button>
|
|
747
748
|
`;
|
|
748
749
|
}
|
|
749
750
|
// The reason for not doing this in the CSS is that we need to trim all the 0px values out of the columns
|
|
@@ -1010,6 +1011,9 @@ __decorate([
|
|
|
1010
1011
|
__decorate([
|
|
1011
1012
|
property({ type: Boolean, reflect: true })
|
|
1012
1013
|
], DataGrid.prototype, "fabSlotCollapsed", void 0);
|
|
1014
|
+
__decorate([
|
|
1015
|
+
property({ type: Boolean })
|
|
1016
|
+
], DataGrid.prototype, "exportable", void 0);
|
|
1013
1017
|
__decorate([
|
|
1014
1018
|
property({
|
|
1015
1019
|
type: Number,
|
|
@@ -1055,27 +1059,27 @@ function subDataGridSelectorChanged() {
|
|
|
1055
1059
|
if (selector === undefined || !!this.getRowDetailsTemplate) {
|
|
1056
1060
|
return;
|
|
1057
1061
|
}
|
|
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>
|
|
1062
|
+
this.getRowDetailsTemplate = (data) => html `
|
|
1063
|
+
<mo-data-grid ${style({ padding: '0px' })}
|
|
1064
|
+
.data=${getValueByKeyPath(data, selector)}
|
|
1065
|
+
headerHidden
|
|
1066
|
+
sidePanelHidden
|
|
1067
|
+
.columns=${this.columns}
|
|
1068
|
+
.subDataGridDataSelector=${this.subDataGridDataSelector}
|
|
1069
|
+
.hasDataDetail=${this.hasDataDetail}
|
|
1070
|
+
.selectionMode=${this.selectionMode}
|
|
1071
|
+
.isDataSelectable=${this.isDataSelectable}
|
|
1072
|
+
?selectOnClick=${this.selectOnClick}
|
|
1073
|
+
?selectionCheckboxesHidden=${this.selectionCheckboxesHidden}
|
|
1074
|
+
?primaryContextMenuItemOnDoubleClick=${this.primaryContextMenuItemOnDoubleClick}
|
|
1075
|
+
?multipleDetails=${this.multipleDetails}
|
|
1076
|
+
?detailsOnClick=${this.detailsOnClick}
|
|
1077
|
+
.getRowContextMenuTemplate=${this.getRowContextMenuTemplate}
|
|
1078
|
+
editability=${this.editability}
|
|
1079
|
+
@rowClick=${(e) => this.rowClick.dispatch(e.detail)}
|
|
1080
|
+
@rowDoubleClick=${(e) => this.rowDoubleClick.dispatch(e.detail)}
|
|
1081
|
+
@rowMiddleClick=${(e) => this.rowMiddleClick.dispatch(e.detail)}
|
|
1082
|
+
@cellEdit=${(e) => this.cellEdit.dispatch(e.detail)}
|
|
1083
|
+
></mo-data-grid>
|
|
1080
1084
|
`;
|
|
1081
1085
|
}
|