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