@3mo/data-grid 0.26.2 → 0.26.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DataGrid.js +246 -246
- package/dist/DataGridCell.d.ts.map +1 -1
- package/dist/DataGridCell.js +47 -45
- package/dist/DataGridColumn.js +29 -29
- package/dist/DataGridColumnHeader.js +226 -226
- package/dist/DataGridHeader.js +100 -100
- package/dist/custom-elements.json +2 -2
- package/dist/rows/DataGridDefaultRow.js +26 -26
- package/dist/rows/DataGridRow.js +223 -223
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +59 -59
package/dist/DataGrid.js
CHANGED
|
@@ -125,8 +125,8 @@ let DataGrid = class DataGrid extends Component {
|
|
|
125
125
|
this.detailsController = new DataGridDetailsController(this);
|
|
126
126
|
this.csvController = new DataGridCsvController(this);
|
|
127
127
|
this.reorderabilityController = new DataGridReorderabilityController(this);
|
|
128
|
-
this.splitterResizerTemplate = html `
|
|
129
|
-
<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>
|
|
128
|
+
this.splitterResizerTemplate = html `
|
|
129
|
+
<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>
|
|
130
130
|
`;
|
|
131
131
|
this.lastScrollElementTop = 0;
|
|
132
132
|
}
|
|
@@ -316,168 +316,168 @@ let DataGrid = class DataGrid extends Component {
|
|
|
316
316
|
this.setPage(1);
|
|
317
317
|
}
|
|
318
318
|
static get styles() {
|
|
319
|
-
return css `
|
|
320
|
-
:host {
|
|
321
|
-
--mo-data-grid-column-reorder-width: 20px;
|
|
322
|
-
--mo-data-grid-column-details-width: 20px;
|
|
323
|
-
--mo-data-grid-column-selection-width: 40px;
|
|
324
|
-
--mo-data-grid-column-actions-width: 28px;
|
|
325
|
-
--mo-data-grid-cell-padding: 0.5rem;
|
|
326
|
-
--mo-data-grid-header-height: 32px;
|
|
327
|
-
--mo-data-grid-footer-min-height: 40px;
|
|
328
|
-
--mo-data-grid-toolbar-padding: 0px 14px 14px 14px;
|
|
329
|
-
--mo-data-grid-border: 1px solid var(--mo-color-transparent-gray-3);
|
|
330
|
-
|
|
331
|
-
--mo-details-data-grid-start-margin: 26px;
|
|
332
|
-
|
|
333
|
-
--mo-data-grid-sticky-part-color: var(--mo-color-surface);
|
|
334
|
-
|
|
335
|
-
--mo-data-grid-alternating-background: color-mix(in srgb, black var(--mo-data-grid-alternating-background-transparency), transparent 0%);
|
|
336
|
-
|
|
337
|
-
--mo-data-grid-selection-background: color-mix(in srgb, var(--mo-color-accent), transparent 50%);
|
|
338
|
-
|
|
339
|
-
--_content-min-height-default: calc(var(--mo-data-grid-min-visible-rows, 2.5) * var(--mo-data-grid-row-height) + var(--mo-data-grid-header-height));
|
|
340
|
-
display: flex;
|
|
341
|
-
flex-direction: column;
|
|
342
|
-
height: 100%;
|
|
343
|
-
overflow-x: hidden;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
:not(:has([mo-data-grid-row])) {
|
|
347
|
-
--_content-min-height-default: 150px;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
:host([data-theme=light]) {
|
|
351
|
-
--mo-data-grid-alternating-background-transparency : 5%;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
:host([data-theme=dark]) {
|
|
355
|
-
--mo-data-grid-alternating-background-transparency: 20%;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
:host([preventVerticalContentScroll]) mo-scroller {
|
|
359
|
-
overflow-y: hidden;
|
|
360
|
-
|
|
361
|
-
&::part(container) {
|
|
362
|
-
position: relative;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
#content {
|
|
367
|
-
width: fit-content;
|
|
368
|
-
min-width: 100%;
|
|
369
|
-
height: min-content;
|
|
370
|
-
min-height: 100%;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
#toolbar {
|
|
374
|
-
position: relative;
|
|
375
|
-
padding: var(--mo-data-grid-toolbar-padding);
|
|
376
|
-
|
|
377
|
-
#actions {
|
|
378
|
-
margin-inline-start: auto;
|
|
379
|
-
|
|
380
|
-
mo-icon-button, ::slotted(mo-icon-button[slot='toolbar-action']) {
|
|
381
|
-
color: var(--mo-color-gray);
|
|
382
|
-
&[data-selected] {
|
|
383
|
-
color: var(--mo-color-accent);
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
#fab {
|
|
390
|
-
position: absolute;
|
|
391
|
-
inset-inline-end: 16px;
|
|
392
|
-
transition: var(--mo-data-grid-fab-transition, 250ms);
|
|
393
|
-
z-index: 3;
|
|
394
|
-
top: -64px;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
:host([hasFooter]) #fab {
|
|
398
|
-
top: -28px;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
:host([fabSlotCollapsed][hasFabs]) #fab {
|
|
402
|
-
transform: scale(0);
|
|
403
|
-
opacity: 0;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
mo-data-grid-footer {
|
|
407
|
-
transition: var(--mo-data-grid-fab-transition, 250ms);
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
:host([hasSums][hasFabs]:not([fabSlotCollapsed])) mo-data-grid-footer {
|
|
411
|
-
--mo-data-grid-footer-trailing-padding: calc(var(--mo-data-grid-fab-slot-width, 56px) + 16px);
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
slot[name=fab] {
|
|
415
|
-
display: block;
|
|
416
|
-
z-index: 1;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
mo-empty-state, ::slotted(mo-empty-state) {
|
|
420
|
-
height: calc(100% - var(--mo-data-grid-header-height) / 2);
|
|
421
|
-
margin-block-start: calc(var(--mo-data-grid-header-height) / 2);
|
|
422
|
-
position: absolute;
|
|
423
|
-
inset: 0;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
#overlayModeContainer {
|
|
427
|
-
position: relative;
|
|
428
|
-
height: 100%;
|
|
429
|
-
width: 100%;
|
|
430
|
-
|
|
431
|
-
mo-data-grid-side-panel {
|
|
432
|
-
position: absolute;
|
|
433
|
-
inset: 0;
|
|
434
|
-
width: 100%;
|
|
435
|
-
height: 100%;
|
|
436
|
-
z-index: 5;
|
|
437
|
-
background-color: var(--mo-color-surface);
|
|
438
|
-
}
|
|
439
|
-
}
|
|
319
|
+
return css `
|
|
320
|
+
:host {
|
|
321
|
+
--mo-data-grid-column-reorder-width: 20px;
|
|
322
|
+
--mo-data-grid-column-details-width: 20px;
|
|
323
|
+
--mo-data-grid-column-selection-width: 40px;
|
|
324
|
+
--mo-data-grid-column-actions-width: 28px;
|
|
325
|
+
--mo-data-grid-cell-padding: 0.5rem;
|
|
326
|
+
--mo-data-grid-header-height: 32px;
|
|
327
|
+
--mo-data-grid-footer-min-height: 40px;
|
|
328
|
+
--mo-data-grid-toolbar-padding: 0px 14px 14px 14px;
|
|
329
|
+
--mo-data-grid-border: 1px solid var(--mo-color-transparent-gray-3);
|
|
330
|
+
|
|
331
|
+
--mo-details-data-grid-start-margin: 26px;
|
|
332
|
+
|
|
333
|
+
--mo-data-grid-sticky-part-color: var(--mo-color-surface);
|
|
334
|
+
|
|
335
|
+
--mo-data-grid-alternating-background: color-mix(in srgb, black var(--mo-data-grid-alternating-background-transparency), transparent 0%);
|
|
336
|
+
|
|
337
|
+
--mo-data-grid-selection-background: color-mix(in srgb, var(--mo-color-accent), transparent 50%);
|
|
338
|
+
|
|
339
|
+
--_content-min-height-default: calc(var(--mo-data-grid-min-visible-rows, 2.5) * var(--mo-data-grid-row-height) + var(--mo-data-grid-header-height));
|
|
340
|
+
display: flex;
|
|
341
|
+
flex-direction: column;
|
|
342
|
+
height: 100%;
|
|
343
|
+
overflow-x: hidden;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
:not(:has([mo-data-grid-row])) {
|
|
347
|
+
--_content-min-height-default: 150px;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
:host([data-theme=light]) {
|
|
351
|
+
--mo-data-grid-alternating-background-transparency : 5%;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
:host([data-theme=dark]) {
|
|
355
|
+
--mo-data-grid-alternating-background-transparency: 20%;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
:host([preventVerticalContentScroll]) mo-scroller {
|
|
359
|
+
overflow-y: hidden;
|
|
360
|
+
|
|
361
|
+
&::part(container) {
|
|
362
|
+
position: relative;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
#content {
|
|
367
|
+
width: fit-content;
|
|
368
|
+
min-width: 100%;
|
|
369
|
+
height: min-content;
|
|
370
|
+
min-height: 100%;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
#toolbar {
|
|
374
|
+
position: relative;
|
|
375
|
+
padding: var(--mo-data-grid-toolbar-padding);
|
|
376
|
+
|
|
377
|
+
#actions {
|
|
378
|
+
margin-inline-start: auto;
|
|
379
|
+
|
|
380
|
+
mo-icon-button, ::slotted(mo-icon-button[slot='toolbar-action']) {
|
|
381
|
+
color: var(--mo-color-gray);
|
|
382
|
+
&[data-selected] {
|
|
383
|
+
color: var(--mo-color-accent);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
#fab {
|
|
390
|
+
position: absolute;
|
|
391
|
+
inset-inline-end: 16px;
|
|
392
|
+
transition: var(--mo-data-grid-fab-transition, 250ms);
|
|
393
|
+
z-index: 3;
|
|
394
|
+
top: -64px;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
:host([hasFooter]) #fab {
|
|
398
|
+
top: -28px;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
:host([fabSlotCollapsed][hasFabs]) #fab {
|
|
402
|
+
transform: scale(0);
|
|
403
|
+
opacity: 0;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
mo-data-grid-footer {
|
|
407
|
+
transition: var(--mo-data-grid-fab-transition, 250ms);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
:host([hasSums][hasFabs]:not([fabSlotCollapsed])) mo-data-grid-footer {
|
|
411
|
+
--mo-data-grid-footer-trailing-padding: calc(var(--mo-data-grid-fab-slot-width, 56px) + 16px);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
slot[name=fab] {
|
|
415
|
+
display: block;
|
|
416
|
+
z-index: 1;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
mo-empty-state, ::slotted(mo-empty-state) {
|
|
420
|
+
height: calc(100% - var(--mo-data-grid-header-height) / 2);
|
|
421
|
+
margin-block-start: calc(var(--mo-data-grid-header-height) / 2);
|
|
422
|
+
position: absolute;
|
|
423
|
+
inset: 0;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
#overlayModeContainer {
|
|
427
|
+
position: relative;
|
|
428
|
+
height: 100%;
|
|
429
|
+
width: 100%;
|
|
430
|
+
|
|
431
|
+
mo-data-grid-side-panel {
|
|
432
|
+
position: absolute;
|
|
433
|
+
inset: 0;
|
|
434
|
+
width: 100%;
|
|
435
|
+
height: 100%;
|
|
436
|
+
z-index: 5;
|
|
437
|
+
background-color: var(--mo-color-surface);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
440
|
`;
|
|
441
441
|
}
|
|
442
442
|
get template() {
|
|
443
|
-
return html `
|
|
444
|
-
<slot name='column' hidden>${this.columnsTemplate}</slot>
|
|
445
|
-
${this.toolbarTemplate}
|
|
446
|
-
${this.smallScreenObserverController.matches ? this.overlayModeTemplate : this.splitterModeTemplate}
|
|
443
|
+
return html `
|
|
444
|
+
<slot name='column' hidden>${this.columnsTemplate}</slot>
|
|
445
|
+
${this.toolbarTemplate}
|
|
446
|
+
${this.smallScreenObserverController.matches ? this.overlayModeTemplate : this.splitterModeTemplate}
|
|
447
447
|
`;
|
|
448
448
|
}
|
|
449
449
|
get splitterModeTemplate() {
|
|
450
|
-
return html `
|
|
451
|
-
<mo-splitter direction='horizontal-reversed' ${style({ height: '100%' })} .resizerTemplate=${this.splitterResizerTemplate}>
|
|
452
|
-
${cache(this.sidePanelTab === undefined ? html.nothing : html `
|
|
453
|
-
<mo-splitter-item size='min(25%, 300px)' min='max(15%, 250px)' max='clamp(100px, 50%, 750px)'>
|
|
454
|
-
${this.sidePanelTemplate}
|
|
455
|
-
</mo-splitter-item>
|
|
456
|
-
`)}
|
|
457
|
-
|
|
458
|
-
<mo-splitter-item min='0px' ${style({ position: 'relative' })}>
|
|
459
|
-
${this.dataGridTemplate}
|
|
460
|
-
</mo-splitter-item>
|
|
461
|
-
</mo-splitter>
|
|
450
|
+
return html `
|
|
451
|
+
<mo-splitter direction='horizontal-reversed' ${style({ height: '100%' })} .resizerTemplate=${this.splitterResizerTemplate}>
|
|
452
|
+
${cache(this.sidePanelTab === undefined ? html.nothing : html `
|
|
453
|
+
<mo-splitter-item size='min(25%, 300px)' min='max(15%, 250px)' max='clamp(100px, 50%, 750px)'>
|
|
454
|
+
${this.sidePanelTemplate}
|
|
455
|
+
</mo-splitter-item>
|
|
456
|
+
`)}
|
|
457
|
+
|
|
458
|
+
<mo-splitter-item min='0px' ${style({ position: 'relative' })}>
|
|
459
|
+
${this.dataGridTemplate}
|
|
460
|
+
</mo-splitter-item>
|
|
461
|
+
</mo-splitter>
|
|
462
462
|
`;
|
|
463
463
|
}
|
|
464
464
|
get overlayModeTemplate() {
|
|
465
|
-
return html `
|
|
466
|
-
<mo-flex id='overlayModeContainer'>
|
|
467
|
-
${this.dataGridTemplate}
|
|
468
|
-
${this.sidePanelTab === undefined ? html.nothing : this.sidePanelTemplate}
|
|
469
|
-
</mo-flex>
|
|
465
|
+
return html `
|
|
466
|
+
<mo-flex id='overlayModeContainer'>
|
|
467
|
+
${this.dataGridTemplate}
|
|
468
|
+
${this.sidePanelTab === undefined ? html.nothing : this.sidePanelTemplate}
|
|
469
|
+
</mo-flex>
|
|
470
470
|
`;
|
|
471
471
|
}
|
|
472
472
|
get sidePanelTemplate() {
|
|
473
|
-
return html `
|
|
474
|
-
<mo-data-grid-side-panel
|
|
475
|
-
.dataGrid=${this}
|
|
476
|
-
tab=${ifDefined(this.sidePanelTab)}
|
|
477
|
-
>
|
|
478
|
-
<slot slot='settings' name='settings'>${this.settingsDefaultTemplate}</slot>
|
|
479
|
-
<slot slot='filter' name='filter'>${this.filtersDefaultTemplate}</slot>
|
|
480
|
-
</mo-data-grid-side-panel>
|
|
473
|
+
return html `
|
|
474
|
+
<mo-data-grid-side-panel
|
|
475
|
+
.dataGrid=${this}
|
|
476
|
+
tab=${ifDefined(this.sidePanelTab)}
|
|
477
|
+
>
|
|
478
|
+
<slot slot='settings' name='settings'>${this.settingsDefaultTemplate}</slot>
|
|
479
|
+
<slot slot='filter' name='filter'>${this.filtersDefaultTemplate}</slot>
|
|
480
|
+
</mo-data-grid-side-panel>
|
|
481
481
|
`;
|
|
482
482
|
}
|
|
483
483
|
get settingsDefaultTemplate() {
|
|
@@ -499,48 +499,48 @@ let DataGrid = class DataGrid extends Component {
|
|
|
499
499
|
// These also update the respective attributes for now
|
|
500
500
|
this.hasSums;
|
|
501
501
|
this.hasFabs;
|
|
502
|
-
return html `
|
|
503
|
-
<slot name='fab' @slotchange=${() => { this.hasSums; this.hasFabs; }}></slot>
|
|
502
|
+
return html `
|
|
503
|
+
<slot name='fab' @slotchange=${() => { this.hasSums; this.hasFabs; }}></slot>
|
|
504
504
|
`;
|
|
505
505
|
}
|
|
506
506
|
get contentTemplate() {
|
|
507
507
|
return !this.data.length ? this.noContentTemplate : this.rowsTemplate;
|
|
508
508
|
}
|
|
509
509
|
get noContentTemplate() {
|
|
510
|
-
return html `
|
|
511
|
-
<slot name='error-no-content'>
|
|
512
|
-
<mo-empty-state icon='youtube_searched_for'>${t('No results')}</mo-empty-state>
|
|
513
|
-
</slot>
|
|
510
|
+
return html `
|
|
511
|
+
<slot name='error-no-content'>
|
|
512
|
+
<mo-empty-state icon='youtube_searched_for'>${t('No results')}</mo-empty-state>
|
|
513
|
+
</slot>
|
|
514
514
|
`;
|
|
515
515
|
}
|
|
516
516
|
get dataGridTemplate() {
|
|
517
517
|
this.toggleAttribute('hasDetails', this.hasDetails);
|
|
518
|
-
return html `
|
|
519
|
-
<mo-grid rows='* auto' ${style({ position: 'relative', height: '100%' })}>
|
|
520
|
-
<mo-scroller
|
|
521
|
-
${style({ minHeight: 'var(--mo-data-grid-content-min-height, var(--_content-min-height-default))' })}
|
|
522
|
-
${observeResize(([e]) => this.style.setProperty('--_content-height', `${e?.contentRect.height ?? 0}px`))}
|
|
523
|
-
@scroll=${this.handleScroll}
|
|
524
|
-
>
|
|
525
|
-
<mo-grid id='content' autoRows='min-content' columns='var(--mo-data-grid-columns)'>
|
|
526
|
-
${this.headerTemplate}
|
|
527
|
-
${this.contentTemplate}
|
|
528
|
-
</mo-grid>
|
|
529
|
-
</mo-scroller>
|
|
530
|
-
${this.footerTemplate}
|
|
531
|
-
</mo-grid>
|
|
518
|
+
return html `
|
|
519
|
+
<mo-grid rows='* auto' ${style({ position: 'relative', height: '100%' })}>
|
|
520
|
+
<mo-scroller
|
|
521
|
+
${style({ minHeight: 'var(--mo-data-grid-content-min-height, var(--_content-min-height-default))' })}
|
|
522
|
+
${observeResize(([e]) => this.style.setProperty('--_content-height', `${e?.contentRect.height ?? 0}px`))}
|
|
523
|
+
@scroll=${this.handleScroll}
|
|
524
|
+
>
|
|
525
|
+
<mo-grid id='content' autoRows='min-content' columns='var(--mo-data-grid-columns)'>
|
|
526
|
+
${this.headerTemplate}
|
|
527
|
+
${this.contentTemplate}
|
|
528
|
+
</mo-grid>
|
|
529
|
+
</mo-scroller>
|
|
530
|
+
${this.footerTemplate}
|
|
531
|
+
</mo-grid>
|
|
532
532
|
`;
|
|
533
533
|
}
|
|
534
534
|
get headerTemplate() {
|
|
535
|
-
return this.headerHidden ? html.nothing : html `
|
|
536
|
-
<mo-data-grid-header .dataGrid=${this}></mo-data-grid-header>
|
|
535
|
+
return this.headerHidden ? html.nothing : html `
|
|
536
|
+
<mo-data-grid-header .dataGrid=${this}></mo-data-grid-header>
|
|
537
537
|
`;
|
|
538
538
|
}
|
|
539
539
|
get rowsTemplate() {
|
|
540
540
|
// Do not use the data-record or data as the key as it leads to UI flickering
|
|
541
|
-
return html `
|
|
542
|
-
${this.hiddenSizeAnchorRowTemplate}
|
|
543
|
-
${repeat(this.renderDataRecords, record => record.index, (record, index) => this.getRowTemplate(record, index))}
|
|
541
|
+
return html `
|
|
542
|
+
${this.hiddenSizeAnchorRowTemplate}
|
|
543
|
+
${repeat(this.renderDataRecords, record => record.index, (record, index) => this.getRowTemplate(record, index))}
|
|
544
544
|
`;
|
|
545
545
|
}
|
|
546
546
|
/**
|
|
@@ -565,73 +565,73 @@ let DataGrid = class DataGrid extends Component {
|
|
|
565
565
|
.map(dr => column.getContentTemplate?.(KeyPath.get(dr.data, column.dataSelector), dr.data) ?? html.nothing)
|
|
566
566
|
.reduce((longest, current) => (getLength(current) > getLength(longest)) || false ? current : longest, html.nothing);
|
|
567
567
|
};
|
|
568
|
-
return html `
|
|
569
|
-
<style>
|
|
570
|
-
#size-anchor {
|
|
571
|
-
display: grid;
|
|
572
|
-
grid-template-columns: subgrid;
|
|
573
|
-
grid-column: data / end;
|
|
574
|
-
font-size: var(--mo-data-grid-cell-font-size);
|
|
575
|
-
height: 0;
|
|
576
|
-
visibility: hidden;
|
|
577
|
-
opacity: 0;
|
|
578
|
-
|
|
579
|
-
div {
|
|
580
|
-
user-select: none;
|
|
581
|
-
white-space: nowrap;
|
|
582
|
-
overflow: hidden;
|
|
583
|
-
text-overflow: ellipsis;
|
|
584
|
-
padding-inline: var(--mo-data-grid-cell-padding);
|
|
585
|
-
margin-inline-start: calc(var(--_max-level, 0) * var(--mo-data-grid-column-sub-row-indentation, 20px))
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
</style>
|
|
589
|
-
<div id='size-anchor'>
|
|
590
|
-
${this.visibleColumns.map(column => html `
|
|
591
|
-
<div style='--_max-level: ${Math.max(...this.dataRecords.map(dr => dr.level))}'>
|
|
592
|
-
${getLongestContent(column)}
|
|
593
|
-
</div>
|
|
594
|
-
`)}
|
|
595
|
-
</div>
|
|
568
|
+
return html `
|
|
569
|
+
<style>
|
|
570
|
+
#size-anchor {
|
|
571
|
+
display: grid;
|
|
572
|
+
grid-template-columns: subgrid;
|
|
573
|
+
grid-column: data / end;
|
|
574
|
+
font-size: var(--mo-data-grid-cell-font-size);
|
|
575
|
+
height: 0;
|
|
576
|
+
visibility: hidden;
|
|
577
|
+
opacity: 0;
|
|
578
|
+
|
|
579
|
+
div {
|
|
580
|
+
user-select: none;
|
|
581
|
+
white-space: nowrap;
|
|
582
|
+
overflow: hidden;
|
|
583
|
+
text-overflow: ellipsis;
|
|
584
|
+
padding-inline: var(--mo-data-grid-cell-padding);
|
|
585
|
+
margin-inline-start: calc(var(--_max-level, 0) * var(--mo-data-grid-column-sub-row-indentation, 20px))
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
</style>
|
|
589
|
+
<div id='size-anchor'>
|
|
590
|
+
${this.visibleColumns.map(column => html `
|
|
591
|
+
<div style='--_max-level: ${Math.max(...this.dataRecords.map(dr => dr.level))}'>
|
|
592
|
+
${getLongestContent(column)}
|
|
593
|
+
</div>
|
|
594
|
+
`)}
|
|
595
|
+
</div>
|
|
596
596
|
`;
|
|
597
597
|
}
|
|
598
598
|
getRowTemplate(dataRecord, index = 0) {
|
|
599
|
-
return staticHtml `
|
|
600
|
-
<${this.rowElementTag} part='row'
|
|
601
|
-
${this.reorderabilityController.item({ index: dataRecord.index, disabled: !this.reorderabilityController.enabled })}
|
|
602
|
-
.dataRecord=${dataRecord}
|
|
603
|
-
?data-has-alternating-background=${this.hasAlternatingBackground && index % 2 === 1}
|
|
604
|
-
></${this.rowElementTag}>
|
|
599
|
+
return staticHtml `
|
|
600
|
+
<${this.rowElementTag} part='row'
|
|
601
|
+
${this.reorderabilityController.item({ index: dataRecord.index, disabled: !this.reorderabilityController.enabled })}
|
|
602
|
+
.dataRecord=${dataRecord}
|
|
603
|
+
?data-has-alternating-background=${this.hasAlternatingBackground && index % 2 === 1}
|
|
604
|
+
></${this.rowElementTag}>
|
|
605
605
|
`;
|
|
606
606
|
}
|
|
607
607
|
get footerTemplate() {
|
|
608
|
-
return html `
|
|
609
|
-
<mo-flex ${style({ position: 'relative' })}>
|
|
610
|
-
<mo-flex id='fab' direction='vertical-reversed' gap='0.5rem'>
|
|
611
|
-
${this.fabTemplate}
|
|
612
|
-
</mo-flex>
|
|
613
|
-
${this.hasFooter === false ? html.nothing : html `
|
|
614
|
-
<mo-data-grid-footer .dataGrid=${this} page=${this.page}>
|
|
615
|
-
<slot name='sum' slot='sum'>${this.sumDefaultTemplate}</slot>
|
|
616
|
-
</mo-data-grid-footer>
|
|
617
|
-
`}
|
|
618
|
-
</mo-flex>
|
|
608
|
+
return html `
|
|
609
|
+
<mo-flex ${style({ position: 'relative' })}>
|
|
610
|
+
<mo-flex id='fab' direction='vertical-reversed' gap='0.5rem'>
|
|
611
|
+
${this.fabTemplate}
|
|
612
|
+
</mo-flex>
|
|
613
|
+
${this.hasFooter === false ? html.nothing : html `
|
|
614
|
+
<mo-data-grid-footer .dataGrid=${this} page=${this.page}>
|
|
615
|
+
<slot name='sum' slot='sum'>${this.sumDefaultTemplate}</slot>
|
|
616
|
+
</mo-data-grid-footer>
|
|
617
|
+
`}
|
|
618
|
+
</mo-flex>
|
|
619
619
|
`;
|
|
620
620
|
}
|
|
621
621
|
get sumsTemplate() {
|
|
622
|
-
return html `
|
|
623
|
-
${this.columns.map(c => c.sumTemplate)}
|
|
622
|
+
return html `
|
|
623
|
+
${this.columns.map(c => c.sumTemplate)}
|
|
624
624
|
`;
|
|
625
625
|
}
|
|
626
626
|
get toolbarTemplate() {
|
|
627
|
-
return this.hasToolbar === false ? html.nothing : html `
|
|
628
|
-
<mo-flex id='toolbar' direction='horizontal' gap='8px' wrap='wrap' alignItems='center'>
|
|
629
|
-
<slot name='toolbar'>${this.toolbarDefaultTemplate}</slot>
|
|
630
|
-
<mo-flex id='actions' direction='horizontal' gap='8px' alignContent='center'>
|
|
631
|
-
<slot name='toolbar-action'>${this.toolbarActionDefaultTemplate}</slot>
|
|
632
|
-
${this.toolbarActionsTemplate}
|
|
633
|
-
</mo-flex>
|
|
634
|
-
</mo-flex>
|
|
627
|
+
return this.hasToolbar === false ? html.nothing : html `
|
|
628
|
+
<mo-flex id='toolbar' direction='horizontal' gap='8px' wrap='wrap' alignItems='center'>
|
|
629
|
+
<slot name='toolbar'>${this.toolbarDefaultTemplate}</slot>
|
|
630
|
+
<mo-flex id='actions' direction='horizontal' gap='8px' alignContent='center'>
|
|
631
|
+
<slot name='toolbar-action'>${this.toolbarActionDefaultTemplate}</slot>
|
|
632
|
+
${this.toolbarActionsTemplate}
|
|
633
|
+
</mo-flex>
|
|
634
|
+
</mo-flex>
|
|
635
635
|
`;
|
|
636
636
|
}
|
|
637
637
|
get toolbarDefaultTemplate() {
|
|
@@ -644,20 +644,20 @@ let DataGrid = class DataGrid extends Component {
|
|
|
644
644
|
return html.nothing;
|
|
645
645
|
}
|
|
646
646
|
get toolbarActionsTemplate() {
|
|
647
|
-
return html `
|
|
648
|
-
${!this.hasFilters ? html.nothing : html `
|
|
649
|
-
<mo-icon-button icon='filter_list'
|
|
650
|
-
${tooltip(t('More Filters'))}
|
|
651
|
-
?data-selected=${this.sidePanelTab === DataGridSidePanelTab.Filters}
|
|
652
|
-
@click=${() => this.navigateToSidePanelTab(this.sidePanelTab === DataGridSidePanelTab.Filters ? undefined : DataGridSidePanelTab.Filters)}
|
|
653
|
-
></mo-icon-button>
|
|
654
|
-
`}
|
|
655
|
-
|
|
656
|
-
<mo-icon-button icon='settings'
|
|
657
|
-
${tooltip(t('Settings'))}
|
|
658
|
-
?data-selected=${this.sidePanelTab === DataGridSidePanelTab.Settings}
|
|
659
|
-
@click=${() => this.navigateToSidePanelTab(this.sidePanelTab === DataGridSidePanelTab.Settings ? undefined : DataGridSidePanelTab.Settings)}
|
|
660
|
-
></mo-icon-button>
|
|
647
|
+
return html `
|
|
648
|
+
${!this.hasFilters ? html.nothing : html `
|
|
649
|
+
<mo-icon-button icon='filter_list'
|
|
650
|
+
${tooltip(t('More Filters'))}
|
|
651
|
+
?data-selected=${this.sidePanelTab === DataGridSidePanelTab.Filters}
|
|
652
|
+
@click=${() => this.navigateToSidePanelTab(this.sidePanelTab === DataGridSidePanelTab.Filters ? undefined : DataGridSidePanelTab.Filters)}
|
|
653
|
+
></mo-icon-button>
|
|
654
|
+
`}
|
|
655
|
+
|
|
656
|
+
<mo-icon-button icon='settings'
|
|
657
|
+
${tooltip(t('Settings'))}
|
|
658
|
+
?data-selected=${this.sidePanelTab === DataGridSidePanelTab.Settings}
|
|
659
|
+
@click=${() => this.navigateToSidePanelTab(this.sidePanelTab === DataGridSidePanelTab.Settings ? undefined : DataGridSidePanelTab.Settings)}
|
|
660
|
+
></mo-icon-button>
|
|
661
661
|
`;
|
|
662
662
|
}
|
|
663
663
|
handleScroll(e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataGridCell.d.ts","sourceRoot":"","sources":["../DataGridCell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAA8B,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAGrG,OAAO,EAAE,cAAc,EAAuB,KAAK,WAAW,EAAE,MAAM,YAAY,CAAA;AAMlF;;;;;;GAMG;AACH,qBACa,YAAY,CAAC,MAAM,SAAS,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,GAAG,EAAE,eAAe,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,CAAE,SAAQ,SAAS;IAC3H,KAAK,EAAG,MAAM,CAAA;IACd,MAAM,EAAG,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IACtC,GAAG,EAAG,WAAW,CAAC,KAAK,EAAE,eAAe,CAAC,CAAA;IAE5D,OAAO,CAAC,OAAO,CAAQ;IAEhC,IAAI,QAAQ,iDAA+B;IAC3C,IAAI,IAAI,UAA2B;IACnC,IAAI,YAAY,snDAAsC;IAEtD,OAAO,KAAK,SAAS,GAAkD;IACvE,OAAO,KAAK,QAAQ,GAA0D;IAE9E,OAAO,KAAK,gBAAgB,GAAuD;IAEnF,OAAO,KAAK,UAAU,GAIrB;IAED,IAAI,SAAS,YAGZ;IAED,iBAAiB,CAAC,KAAK,EAAE,YAAY;IAMrC,iBAAiB,CAAC,KAAK,EAAE,UAAU;IAO7B,aAAa,CAAC,KAAK,EAAE,aAAa;
|
|
1
|
+
{"version":3,"file":"DataGridCell.d.ts","sourceRoot":"","sources":["../DataGridCell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAA8B,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAGrG,OAAO,EAAE,cAAc,EAAuB,KAAK,WAAW,EAAE,MAAM,YAAY,CAAA;AAMlF;;;;;;GAMG;AACH,qBACa,YAAY,CAAC,MAAM,SAAS,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,GAAG,EAAE,eAAe,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,CAAE,SAAQ,SAAS;IAC3H,KAAK,EAAG,MAAM,CAAA;IACd,MAAM,EAAG,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IACtC,GAAG,EAAG,WAAW,CAAC,KAAK,EAAE,eAAe,CAAC,CAAA;IAE5D,OAAO,CAAC,OAAO,CAAQ;IAEhC,IAAI,QAAQ,iDAA+B;IAC3C,IAAI,IAAI,UAA2B;IACnC,IAAI,YAAY,snDAAsC;IAEtD,OAAO,KAAK,SAAS,GAAkD;IACvE,OAAO,KAAK,QAAQ,GAA0D;IAE9E,OAAO,KAAK,gBAAgB,GAAuD;IAEnF,OAAO,KAAK,UAAU,GAIrB;IAED,IAAI,SAAS,YAGZ;IAED,iBAAiB,CAAC,KAAK,EAAE,YAAY;IAMrC,iBAAiB,CAAC,KAAK,EAAE,UAAU;IAO7B,aAAa,CAAC,KAAK,EAAE,aAAa;YA6C1B,UAAU;IAWxB,OAAO,CAAC,SAAS;IAWjB,WAAoB,MAAM,kCAqCzB;IAED,OAAO,KAAK,OAAO,GAAmC;IAEtD,cAAuB,QAAQ,uBAc9B;IAED,OAAO,KAAK,eAAe,GAK1B;IAED,OAAO,KAAK,oBAAoB,GAwB/B;IAQD,OAAO,KAAK,mBAAmB,GAE9B;CACD;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,mBAAmB,EAAE,YAAY,CAAC,OAAO,CAAC,CAAA;KAC1C;CACD"}
|