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