@3mo/data-grid 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CsvGenerator.js +2 -2
- package/dist/DataGrid.js +292 -293
- package/dist/DataGridCell.js +41 -42
- package/dist/DataGridFooter.js +79 -80
- package/dist/DataGridHeader.js +77 -78
- package/dist/DataGridHeaderSeparator.js +43 -44
- package/dist/DataGridPrimaryContextMenuItem.js +6 -7
- package/dist/DataGridSidePanel.js +99 -100
- package/dist/FieldSelectDataGridPageSize.js +8 -9
- package/dist/columns/DataGridColumnBoolean.js +10 -11
- package/dist/columns/DataGridColumnCurrency.js +9 -10
- package/dist/columns/DataGridColumnDate.js +8 -9
- package/dist/columns/DataGridColumnDateTime.d.ts +14 -0
- package/dist/columns/DataGridColumnDateTime.d.ts.map +1 -0
- package/dist/columns/DataGridColumnDateTime.js +20 -0
- package/dist/columns/DataGridColumnDeletion.js +1 -2
- package/dist/columns/DataGridColumnImage.js +3 -4
- package/dist/columns/DataGridColumnNumber.js +6 -7
- package/dist/columns/DataGridColumnPercent.js +7 -8
- package/dist/columns/DataGridColumnText.js +6 -7
- package/dist/columns/DataGridFooterSum.js +21 -22
- package/dist/columns/index.d.ts +1 -0
- package/dist/columns/index.d.ts.map +1 -1
- package/dist/columns/index.js +1 -0
- package/dist/rows/DataGridDefaultRow.js +48 -49
- package/dist/rows/DataGridRow.js +133 -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
|
-
let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
83
|
+
export let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
84
84
|
constructor() {
|
|
85
85
|
super(...arguments);
|
|
86
86
|
this.data = new Array();
|
|
@@ -333,189 +333,189 @@ 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
|
-
/* Don't try to use ":nth-child(even)" as it won't work for virtualized data-grids */
|
|
372
|
-
[mo-data-grid-row][data-has-alternating-background] {
|
|
373
|
-
background: var(--mo-data-grid-alternating-background);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
:host([preventVerticalContentScroll]) mo-scroller {
|
|
377
|
-
overflow-y: hidden;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
:host([preventVerticalContentScroll]) mo-scroller::part(container) {
|
|
381
|
-
position: relative;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
:host(:not([selectionMode="none"])) {
|
|
385
|
-
--mo-data-grid-row-tree-line-width: 18px;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
:host([hasDetails]) {
|
|
389
|
-
--mo-data-grid-row-tree-line-width: 18px;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
#flexToolbar {
|
|
393
|
-
position: relative;
|
|
394
|
-
padding: var(--mo-data-grid-toolbar-padding);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
#flexToolbar mo-icon-button {
|
|
398
|
-
align-self: flex-start;
|
|
399
|
-
color: var(--mo-color-gray);
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
#flexSelectionToolbar {
|
|
403
|
-
background: var(--mo-color-surface);
|
|
404
|
-
position: absolute;
|
|
405
|
-
inset: 0px;
|
|
406
|
-
width: 100%;
|
|
407
|
-
height: 100%;
|
|
408
|
-
z-index: 1;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
#flexSelectionToolbar > mo-flex {
|
|
412
|
-
background: var(--mo-data-grid-selection-background);
|
|
413
|
-
height: 100%;
|
|
414
|
-
align-items: center;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
#flexSelectionToolbar mo-icon-button {
|
|
418
|
-
align-self: center;
|
|
419
|
-
color: var(--mo-color-foreground);
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
#flexActions {
|
|
423
|
-
align-items: center;
|
|
424
|
-
justify-content: center;
|
|
425
|
-
padding-inline: 14px 6px;
|
|
426
|
-
margin: 6px 0;
|
|
427
|
-
cursor: pointer;
|
|
428
|
-
background: var(--mo-color-accent-transparent);
|
|
429
|
-
height: calc(100% - calc(2 * 6px));
|
|
430
|
-
max-height: 45px;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
#flexFab {
|
|
434
|
-
position: absolute;
|
|
435
|
-
top: -28px;
|
|
436
|
-
inset-inline-end: 16px;
|
|
437
|
-
transition: var(--mo-data-grid-fab-transition, 250ms);
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
:host([fabSlotCollapsed][hasFabs]) #flexFab {
|
|
441
|
-
transform: scale(0);
|
|
442
|
-
opacity: 0;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
mo-data-grid-footer {
|
|
446
|
-
transition: var(--mo-data-grid-fab-transition, 250ms);
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
:host([hasSums][hasFabs]:not([fabSlotCollapsed])) mo-data-grid-footer {
|
|
450
|
-
--mo-data-grid-footer-trailing-padding: calc(var(--mo-data-grid-fab-slot-width, 56px) + 16px);
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
slot[name=fab] {
|
|
454
|
-
display: block;
|
|
455
|
-
z-index: 1;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
mo-empty-state, ::slotted(mo-empty-state) {
|
|
459
|
-
height: 100%;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
#overlayModeContainer {
|
|
463
|
-
position: relative;
|
|
464
|
-
height: 100%;
|
|
465
|
-
width: 100%;
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
#overlayModeContainer mo-data-grid-side-panel {
|
|
469
|
-
position: absolute;
|
|
470
|
-
inset: 0;
|
|
471
|
-
width: 100%;
|
|
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
|
+
/* Don't try to use ":nth-child(even)" as it won't work for virtualized data-grids */
|
|
372
|
+
[mo-data-grid-row][data-has-alternating-background] {
|
|
373
|
+
background: var(--mo-data-grid-alternating-background);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
:host([preventVerticalContentScroll]) mo-scroller {
|
|
377
|
+
overflow-y: hidden;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
:host([preventVerticalContentScroll]) mo-scroller::part(container) {
|
|
381
|
+
position: relative;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
:host(:not([selectionMode="none"])) {
|
|
385
|
+
--mo-data-grid-row-tree-line-width: 18px;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
:host([hasDetails]) {
|
|
389
|
+
--mo-data-grid-row-tree-line-width: 18px;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
#flexToolbar {
|
|
393
|
+
position: relative;
|
|
394
|
+
padding: var(--mo-data-grid-toolbar-padding);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
#flexToolbar mo-icon-button {
|
|
398
|
+
align-self: flex-start;
|
|
399
|
+
color: var(--mo-color-gray);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
#flexSelectionToolbar {
|
|
403
|
+
background: var(--mo-color-surface);
|
|
404
|
+
position: absolute;
|
|
405
|
+
inset: 0px;
|
|
406
|
+
width: 100%;
|
|
407
|
+
height: 100%;
|
|
408
|
+
z-index: 1;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
#flexSelectionToolbar > mo-flex {
|
|
412
|
+
background: var(--mo-data-grid-selection-background);
|
|
413
|
+
height: 100%;
|
|
414
|
+
align-items: center;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
#flexSelectionToolbar mo-icon-button {
|
|
418
|
+
align-self: center;
|
|
419
|
+
color: var(--mo-color-foreground);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
#flexActions {
|
|
423
|
+
align-items: center;
|
|
424
|
+
justify-content: center;
|
|
425
|
+
padding-inline: 14px 6px;
|
|
426
|
+
margin: 6px 0;
|
|
427
|
+
cursor: pointer;
|
|
428
|
+
background: var(--mo-color-accent-transparent);
|
|
429
|
+
height: calc(100% - calc(2 * 6px));
|
|
430
|
+
max-height: 45px;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
#flexFab {
|
|
434
|
+
position: absolute;
|
|
435
|
+
top: -28px;
|
|
436
|
+
inset-inline-end: 16px;
|
|
437
|
+
transition: var(--mo-data-grid-fab-transition, 250ms);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
:host([fabSlotCollapsed][hasFabs]) #flexFab {
|
|
441
|
+
transform: scale(0);
|
|
442
|
+
opacity: 0;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
mo-data-grid-footer {
|
|
446
|
+
transition: var(--mo-data-grid-fab-transition, 250ms);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
:host([hasSums][hasFabs]:not([fabSlotCollapsed])) mo-data-grid-footer {
|
|
450
|
+
--mo-data-grid-footer-trailing-padding: calc(var(--mo-data-grid-fab-slot-width, 56px) + 16px);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
slot[name=fab] {
|
|
454
|
+
display: block;
|
|
455
|
+
z-index: 1;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
mo-empty-state, ::slotted(mo-empty-state) {
|
|
459
|
+
height: 100%;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
#overlayModeContainer {
|
|
463
|
+
position: relative;
|
|
464
|
+
height: 100%;
|
|
465
|
+
width: 100%;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
#overlayModeContainer mo-data-grid-side-panel {
|
|
469
|
+
position: absolute;
|
|
470
|
+
inset: 0;
|
|
471
|
+
width: 100%;
|
|
472
|
+
height: 100%;
|
|
473
|
+
z-index: 1;
|
|
474
|
+
background-color: var(--mo-color-surface);
|
|
475
|
+
}
|
|
476
476
|
`;
|
|
477
477
|
}
|
|
478
478
|
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}
|
|
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}
|
|
483
483
|
`;
|
|
484
484
|
}
|
|
485
485
|
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>
|
|
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>
|
|
500
500
|
`;
|
|
501
501
|
}
|
|
502
502
|
get overlayModeTemplate() {
|
|
503
|
-
return html `
|
|
504
|
-
<mo-flex id='overlayModeContainer'>
|
|
505
|
-
${this.dataGridTemplate}
|
|
506
|
-
${this.sidePanelTab === undefined ? nothing : this.sidePanelTemplate}
|
|
507
|
-
</mo-flex>
|
|
503
|
+
return html `
|
|
504
|
+
<mo-flex id='overlayModeContainer'>
|
|
505
|
+
${this.dataGridTemplate}
|
|
506
|
+
${this.sidePanelTab === undefined ? nothing : this.sidePanelTemplate}
|
|
507
|
+
</mo-flex>
|
|
508
508
|
`;
|
|
509
509
|
}
|
|
510
510
|
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>
|
|
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>
|
|
519
519
|
`;
|
|
520
520
|
}
|
|
521
521
|
get settingsDefaultTemplate() {
|
|
@@ -534,40 +534,40 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
534
534
|
// These also update the respective attributes for now
|
|
535
535
|
this.hasSums;
|
|
536
536
|
this.hasFabs;
|
|
537
|
-
return html `
|
|
538
|
-
<slot name='fab' @slotchange=${() => { this.hasSums; this.hasFabs; }}></slot>
|
|
537
|
+
return html `
|
|
538
|
+
<slot name='fab' @slotchange=${() => { this.hasSums; this.hasFabs; }}></slot>
|
|
539
539
|
`;
|
|
540
540
|
}
|
|
541
541
|
get contentTemplate() {
|
|
542
542
|
return !this.data.length ? this.noContentTemplate : this.rowsTemplate;
|
|
543
543
|
}
|
|
544
544
|
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>
|
|
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>
|
|
549
549
|
`;
|
|
550
550
|
}
|
|
551
551
|
get dataGridTemplate() {
|
|
552
552
|
this.provideCssColumnsProperties();
|
|
553
553
|
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>
|
|
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>
|
|
566
566
|
`;
|
|
567
567
|
}
|
|
568
568
|
get headerTemplate() {
|
|
569
|
-
return this.headerHidden ? nothing : html `
|
|
570
|
-
<mo-data-grid-header .dataGrid=${this}></mo-data-grid-header>
|
|
569
|
+
return this.headerHidden ? nothing : html `
|
|
570
|
+
<mo-data-grid-header .dataGrid=${this}></mo-data-grid-header>
|
|
571
571
|
`;
|
|
572
572
|
}
|
|
573
573
|
get rowsTemplate() {
|
|
@@ -576,26 +576,26 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
576
576
|
const content = shallVirtualize === false
|
|
577
577
|
? this.renderData.map(getRowTemplate)
|
|
578
578
|
: 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>
|
|
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>
|
|
587
587
|
`;
|
|
588
588
|
}
|
|
589
589
|
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}>
|
|
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}>
|
|
599
599
|
`;
|
|
600
600
|
}
|
|
601
601
|
handleRowDetailsOpenChange(data, event) {
|
|
@@ -613,20 +613,20 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
615
|
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>
|
|
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>
|
|
630
630
|
`;
|
|
631
631
|
}
|
|
632
632
|
get sumsTemplate() {
|
|
@@ -641,24 +641,24 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
641
641
|
.filter(n => isNaN(n) === false)
|
|
642
642
|
.reduce(((a, b) => a + b), 0)
|
|
643
643
|
|| 0;
|
|
644
|
-
return html `
|
|
645
|
-
<mo-data-grid-footer-sum heading=${column.sumHeading}>
|
|
646
|
-
${column.getSumTemplate(sum)}
|
|
647
|
-
</mo-data-grid-footer-sum>
|
|
644
|
+
return html `
|
|
645
|
+
<mo-data-grid-footer-sum heading=${column.sumHeading}>
|
|
646
|
+
${column.getSumTemplate(sum)}
|
|
647
|
+
</mo-data-grid-footer-sum>
|
|
648
648
|
`;
|
|
649
649
|
}
|
|
650
650
|
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>
|
|
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>
|
|
662
662
|
`;
|
|
663
663
|
}
|
|
664
664
|
get toolbarDefaultTemplate() {
|
|
@@ -671,42 +671,42 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
671
671
|
return nothing;
|
|
672
672
|
}
|
|
673
673
|
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>
|
|
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>
|
|
693
693
|
`;
|
|
694
694
|
}
|
|
695
695
|
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>
|
|
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>
|
|
710
710
|
`;
|
|
711
711
|
}
|
|
712
712
|
// The reason for not doing this in the CSS is that we need to trim all the 0px values out of the columns
|
|
@@ -965,32 +965,31 @@ __decorate([
|
|
|
965
965
|
DataGrid = DataGrid_1 = __decorate([
|
|
966
966
|
component('mo-data-grid')
|
|
967
967
|
], DataGrid);
|
|
968
|
-
export { DataGrid };
|
|
969
968
|
function subDataGridSelectorChanged() {
|
|
970
969
|
const selector = this.subDataGridDataSelector;
|
|
971
970
|
if (selector === undefined || !!this.getRowDetailsTemplate) {
|
|
972
971
|
return;
|
|
973
972
|
}
|
|
974
|
-
this.getRowDetailsTemplate = (data) => html `
|
|
975
|
-
<mo-data-grid ${style({ padding: '0px' })}
|
|
976
|
-
.data=${getValueByKeyPath(data, selector)}
|
|
977
|
-
headerHidden
|
|
978
|
-
sidePanelHidden
|
|
979
|
-
.columns=${this.columns}
|
|
980
|
-
.subDataGridDataSelector=${this.subDataGridDataSelector}
|
|
981
|
-
.hasDataDetail=${this.hasDataDetail}
|
|
982
|
-
.selectionMode=${this.selectionMode}
|
|
983
|
-
.isDataSelectable=${this.isDataSelectable}
|
|
984
|
-
?selectOnClick=${this.selectOnClick}
|
|
985
|
-
?selectionCheckboxesHidden=${this.selectionCheckboxesHidden}
|
|
986
|
-
?primaryContextMenuItemOnDoubleClick=${this.primaryContextMenuItemOnDoubleClick}
|
|
987
|
-
?multipleDetails=${this.multipleDetails}
|
|
988
|
-
?detailsOnClick=${this.detailsOnClick}
|
|
989
|
-
.getRowContextMenuTemplate=${this.getRowContextMenuTemplate}
|
|
990
|
-
editability=${this.editability}
|
|
991
|
-
@rowClick=${(e) => this.rowClick.dispatch(e.detail)}
|
|
992
|
-
@rowDoubleClick=${(e) => this.rowDoubleClick.dispatch(e.detail)}
|
|
993
|
-
@cellEdit=${(e) => this.cellEdit.dispatch(e.detail)}
|
|
994
|
-
></mo-data-grid>
|
|
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>
|
|
995
994
|
`;
|
|
996
995
|
}
|