@3mo/data-grid 0.5.9 → 0.5.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/DataGrid.d.ts +2 -1
- package/dist/DataGrid.d.ts.map +1 -1
- package/dist/DataGrid.js +283 -278
- package/dist/DataGridCell.js +40 -40
- package/dist/DataGridFooter.js +92 -92
- package/dist/DataGridHeader.js +90 -90
- package/dist/DataGridHeaderSeparator.js +45 -45
- package/dist/DataGridPrimaryContextMenuItem.js +5 -5
- package/dist/DataGridSidePanel.d.ts.map +1 -1
- package/dist/DataGridSidePanel.js +109 -109
- package/dist/FieldSelectDataGridPageSize.js +7 -7
- package/dist/columns/DataGridColumnBoolean.js +9 -9
- package/dist/columns/DataGridColumnImage.js +2 -2
- package/dist/columns/DataGridColumnText.js +5 -5
- package/dist/columns/date-time/DataGridColumnDateTimeBase.js +9 -9
- package/dist/columns/number/DataGridColumnCurrency.js +9 -9
- package/dist/columns/number/DataGridColumnNumber.js +5 -5
- package/dist/columns/number/DataGridColumnPercent.js +6 -6
- package/dist/columns/number/DataGridFooterSum.js +20 -20
- package/dist/excel.svg.js +47 -47
- package/dist/rows/DataGridDefaultRow.js +47 -47
- package/dist/rows/DataGridRow.js +142 -142
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +55 -55
package/dist/DataGridCell.js
CHANGED
|
@@ -99,46 +99,46 @@ let DataGridCell = class DataGridCell extends Component {
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
static get styles() {
|
|
102
|
-
return css `
|
|
103
|
-
:host {
|
|
104
|
-
position: relative;
|
|
105
|
-
padding-inline: var(--mo-data-grid-cell-padding, 3px);
|
|
106
|
-
user-select: none;
|
|
107
|
-
line-height: var(--mo-data-grid-row-height);
|
|
108
|
-
white-space: nowrap;
|
|
109
|
-
overflow: hidden !important;
|
|
110
|
-
text-overflow: ellipsis;
|
|
111
|
-
font-size: var(--mo-data-grid-cell-font-size);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
:host(:not([isEditing]):focus) {
|
|
115
|
-
outline: 2px solid var(--mo-color-accent);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
:host([isEditing]) {
|
|
119
|
-
display: grid;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
:host([alignment=end]) {
|
|
123
|
-
text-align: end;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
:host([alignment=start]) {
|
|
127
|
-
text-align: start
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
:host([alignment=center]) {
|
|
131
|
-
text-align: center;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
:host > :first-child {
|
|
135
|
-
line-height: var(--mo-data-grid-row-height);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
:host([isEditing]) > :first-child {
|
|
139
|
-
align-self: center;
|
|
140
|
-
justify-self: stretch;
|
|
141
|
-
}
|
|
102
|
+
return css `
|
|
103
|
+
:host {
|
|
104
|
+
position: relative;
|
|
105
|
+
padding-inline: var(--mo-data-grid-cell-padding, 3px);
|
|
106
|
+
user-select: none;
|
|
107
|
+
line-height: var(--mo-data-grid-row-height);
|
|
108
|
+
white-space: nowrap;
|
|
109
|
+
overflow: hidden !important;
|
|
110
|
+
text-overflow: ellipsis;
|
|
111
|
+
font-size: var(--mo-data-grid-cell-font-size);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
:host(:not([isEditing]):focus) {
|
|
115
|
+
outline: 2px solid var(--mo-color-accent);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
:host([isEditing]) {
|
|
119
|
+
display: grid;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
:host([alignment=end]) {
|
|
123
|
+
text-align: end;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
:host([alignment=start]) {
|
|
127
|
+
text-align: start
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
:host([alignment=center]) {
|
|
131
|
+
text-align: center;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
:host > :first-child {
|
|
135
|
+
line-height: var(--mo-data-grid-row-height);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
:host([isEditing]) > :first-child {
|
|
139
|
+
align-self: center;
|
|
140
|
+
justify-self: stretch;
|
|
141
|
+
}
|
|
142
142
|
`;
|
|
143
143
|
}
|
|
144
144
|
get tooltip() { return this.valueTextContent; }
|
package/dist/DataGridFooter.js
CHANGED
|
@@ -23,33 +23,33 @@ let DataGridFooter = class DataGridFooter extends Component {
|
|
|
23
23
|
this.manualPageSize = false;
|
|
24
24
|
}
|
|
25
25
|
static get styles() {
|
|
26
|
-
return css `
|
|
27
|
-
:host {
|
|
28
|
-
grid-column: 1 / last-line;
|
|
29
|
-
grid-row: 3;
|
|
30
|
-
min-height: var(--mo-data-grid-footer-min-height);
|
|
31
|
-
background: var(--mo-data-grid-footer-background);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
:host(:not([hideTopBorder])) {
|
|
35
|
-
border-top: var(--mo-data-grid-border);
|
|
36
|
-
}
|
|
26
|
+
return css `
|
|
27
|
+
:host {
|
|
28
|
+
grid-column: 1 / last-line;
|
|
29
|
+
grid-row: 3;
|
|
30
|
+
min-height: var(--mo-data-grid-footer-min-height);
|
|
31
|
+
background: var(--mo-data-grid-footer-background);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host(:not([hideTopBorder])) {
|
|
35
|
+
border-top: var(--mo-data-grid-border);
|
|
36
|
+
}
|
|
37
37
|
`;
|
|
38
38
|
}
|
|
39
39
|
get template() {
|
|
40
40
|
this.toggleAttribute('hideTopBorder', this.dataGrid.hasFooter === false);
|
|
41
|
-
return this.dataGrid.hasFooter === false ? html.nothing : html `
|
|
42
|
-
<mo-flex direction='horizontal' justifyContent='space-between' alignItems='center' wrap='wrap-reverse' gap='6px' ${style({ flex: '1', padding: '0 6px', height: '100%' })}>
|
|
43
|
-
<mo-flex direction='horizontal' alignItems='center' gap='3vw' ${style({ flexBasis: 'auto' })}>
|
|
44
|
-
${this.paginationTemplate}
|
|
45
|
-
${this.exportTemplate}
|
|
46
|
-
</mo-flex>
|
|
47
|
-
|
|
48
|
-
<mo-flex direction='horizontal' alignItems='center' gap='10px' wrap='wrap-reverse' ${style({ paddingInlineEnd: 'var(--mo-data-grid-footer-trailing-padding)' })}>
|
|
49
|
-
${this.dataGrid.sumsTemplate}
|
|
50
|
-
<slot name='sum'></slot>
|
|
51
|
-
</mo-flex>
|
|
52
|
-
</mo-flex>
|
|
41
|
+
return this.dataGrid.hasFooter === false ? html.nothing : html `
|
|
42
|
+
<mo-flex direction='horizontal' justifyContent='space-between' alignItems='center' wrap='wrap-reverse' gap='6px' ${style({ flex: '1', padding: '0 6px', height: '100%' })}>
|
|
43
|
+
<mo-flex direction='horizontal' alignItems='center' gap='3vw' ${style({ flexBasis: 'auto' })}>
|
|
44
|
+
${this.paginationTemplate}
|
|
45
|
+
${this.exportTemplate}
|
|
46
|
+
</mo-flex>
|
|
47
|
+
|
|
48
|
+
<mo-flex direction='horizontal' alignItems='center' gap='10px' wrap='wrap-reverse' ${style({ paddingInlineEnd: 'var(--mo-data-grid-footer-trailing-padding)' })}>
|
|
49
|
+
${this.dataGrid.sumsTemplate}
|
|
50
|
+
<slot name='sum'></slot>
|
|
51
|
+
</mo-flex>
|
|
52
|
+
</mo-flex>
|
|
53
53
|
`;
|
|
54
54
|
}
|
|
55
55
|
get paginationTemplate() {
|
|
@@ -62,53 +62,53 @@ let DataGridFooter = class DataGridFooter extends Component {
|
|
|
62
62
|
`${(Math.min(from, to)).format()}-${to.format()}`,
|
|
63
63
|
hasUnknownDataLength ? undefined : this.dataGrid.dataLength.format(),
|
|
64
64
|
].filter(Boolean).join(' / ');
|
|
65
|
-
return !this.dataGrid.hasPagination ? html.nothing : html `
|
|
66
|
-
<mo-flex direction='horizontal' alignItems='center' gap='1vw'>
|
|
67
|
-
<mo-flex direction='horizontal' gap='4px' alignItems='center' justifyContent='center'>
|
|
68
|
-
<mo-icon-button dense icon=${isRtl ? 'last_page' : 'first_page'}
|
|
69
|
-
?disabled=${this.page === 1}
|
|
70
|
-
@click=${() => this.setPage(1)}
|
|
71
|
-
></mo-icon-button>
|
|
72
|
-
|
|
73
|
-
<mo-icon-button dense icon=${isRtl ? 'keyboard_arrow_right' : 'keyboard_arrow_left'}
|
|
74
|
-
?disabled=${this.page === 1}
|
|
75
|
-
@click=${() => this.setPage(this.page - 1)}
|
|
76
|
-
></mo-icon-button>
|
|
77
|
-
|
|
78
|
-
<div ${style({ cursor: 'pointer', width: hasUnknownDataLength ? '40px' : '75px', textAlign: 'center' })}>
|
|
79
|
-
${this.manualPagination ? html `
|
|
80
|
-
<mo-field-number dense
|
|
81
|
-
value=${this.page}
|
|
82
|
-
@change=${(e) => this.handleManualPageChange(e.detail)}>
|
|
83
|
-
</mo-field-number>
|
|
84
|
-
` : html `
|
|
85
|
-
<div ${style({ fontSize: 'small' })} @click=${() => this.manualPagination = hasUnknownDataLength === false}>${pageText}</div>
|
|
86
|
-
`}
|
|
87
|
-
</div>
|
|
88
|
-
|
|
89
|
-
<mo-icon-button dense icon=${isRtl ? 'keyboard_arrow_left' : 'keyboard_arrow_right'}
|
|
90
|
-
?disabled=${!this.dataGrid.hasNextPage}
|
|
91
|
-
@click=${() => this.setPage(this.page + 1)}
|
|
92
|
-
></mo-icon-button>
|
|
93
|
-
|
|
94
|
-
<mo-icon-button dense icon=${isRtl ? 'first_page' : 'last_page'}
|
|
95
|
-
?disabled=${hasUnknownDataLength || this.page === this.dataGrid.maxPage}
|
|
96
|
-
@click=${() => this.setPage(this.dataGrid.maxPage ?? 1)}
|
|
97
|
-
></mo-icon-button>
|
|
98
|
-
</mo-flex>
|
|
99
|
-
|
|
100
|
-
<div ${style({ color: 'var(--mo-color-gray)', marginInlineStart: '8px' })}>
|
|
101
|
-
${!this.manualPageSize ? html `
|
|
102
|
-
<div ${style({ fontSize: 'small' })} @click=${() => this.manualPageSize = true}>${pageSizeText}</div>
|
|
103
|
-
` : html `
|
|
104
|
-
<mo-field-select-data-grid-page-size dense ${style({ width: '90px' })}
|
|
105
|
-
.dataGrid=${this.dataGrid}
|
|
106
|
-
value=${ifDefined(this.dataGrid.pagination)}
|
|
107
|
-
@change=${(e) => this.handlePaginationChange(e.detail)}>
|
|
108
|
-
</mo-field-select-data-grid-page-size>
|
|
109
|
-
`}
|
|
110
|
-
</div>
|
|
111
|
-
</mo-flex>
|
|
65
|
+
return !this.dataGrid.hasPagination ? html.nothing : html `
|
|
66
|
+
<mo-flex direction='horizontal' alignItems='center' gap='1vw'>
|
|
67
|
+
<mo-flex direction='horizontal' gap='4px' alignItems='center' justifyContent='center'>
|
|
68
|
+
<mo-icon-button dense icon=${isRtl ? 'last_page' : 'first_page'}
|
|
69
|
+
?disabled=${this.page === 1}
|
|
70
|
+
@click=${() => this.setPage(1)}
|
|
71
|
+
></mo-icon-button>
|
|
72
|
+
|
|
73
|
+
<mo-icon-button dense icon=${isRtl ? 'keyboard_arrow_right' : 'keyboard_arrow_left'}
|
|
74
|
+
?disabled=${this.page === 1}
|
|
75
|
+
@click=${() => this.setPage(this.page - 1)}
|
|
76
|
+
></mo-icon-button>
|
|
77
|
+
|
|
78
|
+
<div ${style({ cursor: 'pointer', width: hasUnknownDataLength ? '40px' : '75px', textAlign: 'center' })}>
|
|
79
|
+
${this.manualPagination ? html `
|
|
80
|
+
<mo-field-number dense
|
|
81
|
+
value=${this.page}
|
|
82
|
+
@change=${(e) => this.handleManualPageChange(e.detail)}>
|
|
83
|
+
</mo-field-number>
|
|
84
|
+
` : html `
|
|
85
|
+
<div ${style({ fontSize: 'small' })} @click=${() => this.manualPagination = hasUnknownDataLength === false}>${pageText}</div>
|
|
86
|
+
`}
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
<mo-icon-button dense icon=${isRtl ? 'keyboard_arrow_left' : 'keyboard_arrow_right'}
|
|
90
|
+
?disabled=${!this.dataGrid.hasNextPage}
|
|
91
|
+
@click=${() => this.setPage(this.page + 1)}
|
|
92
|
+
></mo-icon-button>
|
|
93
|
+
|
|
94
|
+
<mo-icon-button dense icon=${isRtl ? 'first_page' : 'last_page'}
|
|
95
|
+
?disabled=${hasUnknownDataLength || this.page === this.dataGrid.maxPage}
|
|
96
|
+
@click=${() => this.setPage(this.dataGrid.maxPage ?? 1)}
|
|
97
|
+
></mo-icon-button>
|
|
98
|
+
</mo-flex>
|
|
99
|
+
|
|
100
|
+
<div ${style({ color: 'var(--mo-color-gray)', marginInlineStart: '8px' })}>
|
|
101
|
+
${!this.manualPageSize ? html `
|
|
102
|
+
<div ${style({ fontSize: 'small' })} @click=${() => this.manualPageSize = true}>${pageSizeText}</div>
|
|
103
|
+
` : html `
|
|
104
|
+
<mo-field-select-data-grid-page-size dense ${style({ width: '90px' })}
|
|
105
|
+
.dataGrid=${this.dataGrid}
|
|
106
|
+
value=${ifDefined(this.dataGrid.pagination)}
|
|
107
|
+
@change=${(e) => this.handlePaginationChange(e.detail)}>
|
|
108
|
+
</mo-field-select-data-grid-page-size>
|
|
109
|
+
`}
|
|
110
|
+
</div>
|
|
111
|
+
</mo-flex>
|
|
112
112
|
`;
|
|
113
113
|
}
|
|
114
114
|
handlePaginationChange(value) {
|
|
@@ -126,28 +126,28 @@ let DataGridFooter = class DataGridFooter extends Component {
|
|
|
126
126
|
this.manualPagination = false;
|
|
127
127
|
}
|
|
128
128
|
get exportTemplate() {
|
|
129
|
-
return !this.dataGrid.exportable ? html.nothing : html `
|
|
130
|
-
<style>
|
|
131
|
-
#export {
|
|
132
|
-
height: 21px;
|
|
133
|
-
width: 21px;
|
|
134
|
-
aspect-ratio: 1 / 1;
|
|
135
|
-
transition: .25s;
|
|
136
|
-
-webkit-filter: grayscale(100%);
|
|
137
|
-
filter: grayscale(100%);
|
|
138
|
-
cursor: pointer;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
#export:hover {
|
|
142
|
-
-webkit-filter: grayscale(0%);
|
|
143
|
-
filter: grayscale(0%);
|
|
144
|
-
}
|
|
145
|
-
</style>
|
|
146
|
-
<img id='export'
|
|
147
|
-
src=${`data:image/svg+xml,${encodeURIComponent(excelSvg)}`}
|
|
148
|
-
${tooltip(t('Export current view to Excel'), TooltipPlacement.BlockStart)}
|
|
149
|
-
@click=${() => this.dataGrid.exportExcelFile()}
|
|
150
|
-
/>
|
|
129
|
+
return !this.dataGrid.exportable ? html.nothing : html `
|
|
130
|
+
<style>
|
|
131
|
+
#export {
|
|
132
|
+
height: 21px;
|
|
133
|
+
width: 21px;
|
|
134
|
+
aspect-ratio: 1 / 1;
|
|
135
|
+
transition: .25s;
|
|
136
|
+
-webkit-filter: grayscale(100%);
|
|
137
|
+
filter: grayscale(100%);
|
|
138
|
+
cursor: pointer;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
#export:hover {
|
|
142
|
+
-webkit-filter: grayscale(0%);
|
|
143
|
+
filter: grayscale(0%);
|
|
144
|
+
}
|
|
145
|
+
</style>
|
|
146
|
+
<img id='export'
|
|
147
|
+
src=${`data:image/svg+xml,${encodeURIComponent(excelSvg)}`}
|
|
148
|
+
${tooltip(t('Export current view to Excel'), TooltipPlacement.BlockStart)}
|
|
149
|
+
@click=${() => this.dataGrid.exportExcelFile()}
|
|
150
|
+
/>
|
|
151
151
|
`;
|
|
152
152
|
}
|
|
153
153
|
setPage(value) {
|
package/dist/DataGridHeader.js
CHANGED
|
@@ -40,45 +40,45 @@ let DataGridHeader = class DataGridHeader extends Component {
|
|
|
40
40
|
this.dataGrid.selectionChange.unsubscribe(this.handleDataGridSelectionChange);
|
|
41
41
|
}
|
|
42
42
|
static get styles() {
|
|
43
|
-
return css `
|
|
44
|
-
:host {
|
|
45
|
-
--mo-data-grid-header-separator-height: 15px;
|
|
46
|
-
--mo-data-grid-header-separator-width: 2px;
|
|
47
|
-
display: inherit;
|
|
48
|
-
font-size: small;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
#header {
|
|
52
|
-
border-top: var(--mo-data-grid-border);
|
|
53
|
-
border-bottom: var(--mo-data-grid-border);
|
|
54
|
-
position: relative;
|
|
55
|
-
height: var(--mo-data-grid-header-height);
|
|
56
|
-
background: var(--mo-data-grid-header-background);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.headerContent {
|
|
60
|
-
padding: 0 var(--mo-data-grid-cell-padding, 3px);
|
|
61
|
-
display: inline-block;
|
|
62
|
-
overflow: hidden !important;
|
|
63
|
-
color: var(--mo-color-foreground);
|
|
64
|
-
font-weight: 500;
|
|
65
|
-
line-height: var(--mo-data-grid-header-height);
|
|
66
|
-
white-space: nowrap;
|
|
67
|
-
text-overflow: ellipsis;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.sort-rank {
|
|
71
|
-
background: var(--mo-color-transparent-gray-3);
|
|
72
|
-
color: var(--mo-color-foreground);
|
|
73
|
-
border: 1px solid var(--mo-color-gray-transparent);
|
|
74
|
-
border-radius: 50%;
|
|
75
|
-
width: 20px;
|
|
76
|
-
height: 20px;
|
|
77
|
-
aspect-ratio: 1 / 1;
|
|
78
|
-
display: flex;
|
|
79
|
-
align-items: center;
|
|
80
|
-
justify-content: center;
|
|
81
|
-
}
|
|
43
|
+
return css `
|
|
44
|
+
:host {
|
|
45
|
+
--mo-data-grid-header-separator-height: 15px;
|
|
46
|
+
--mo-data-grid-header-separator-width: 2px;
|
|
47
|
+
display: inherit;
|
|
48
|
+
font-size: small;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
#header {
|
|
52
|
+
border-top: var(--mo-data-grid-border);
|
|
53
|
+
border-bottom: var(--mo-data-grid-border);
|
|
54
|
+
position: relative;
|
|
55
|
+
height: var(--mo-data-grid-header-height);
|
|
56
|
+
background: var(--mo-data-grid-header-background);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.headerContent {
|
|
60
|
+
padding: 0 var(--mo-data-grid-cell-padding, 3px);
|
|
61
|
+
display: inline-block;
|
|
62
|
+
overflow: hidden !important;
|
|
63
|
+
color: var(--mo-color-foreground);
|
|
64
|
+
font-weight: 500;
|
|
65
|
+
line-height: var(--mo-data-grid-header-height);
|
|
66
|
+
white-space: nowrap;
|
|
67
|
+
text-overflow: ellipsis;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.sort-rank {
|
|
71
|
+
background: var(--mo-color-transparent-gray-3);
|
|
72
|
+
color: var(--mo-color-foreground);
|
|
73
|
+
border: 1px solid var(--mo-color-gray-transparent);
|
|
74
|
+
border-radius: 50%;
|
|
75
|
+
width: 20px;
|
|
76
|
+
height: 20px;
|
|
77
|
+
aspect-ratio: 1 / 1;
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
}
|
|
82
82
|
`;
|
|
83
83
|
}
|
|
84
84
|
get skeletonColumns() {
|
|
@@ -93,75 +93,75 @@ let DataGridHeader = class DataGridHeader extends Component {
|
|
|
93
93
|
return this.dataGrid.dataColumnsWidths.join(' var(--mo-data-grid-columns-gap) ');
|
|
94
94
|
}
|
|
95
95
|
get template() {
|
|
96
|
-
return html `
|
|
97
|
-
<mo-grid id='header' columns=${this.skeletonColumns} columnGap='var(--mo-data-grid-columns-gap)'>
|
|
98
|
-
${this.detailsExpanderTemplate}
|
|
99
|
-
${this.selectionTemplate}
|
|
100
|
-
${this.contentTemplate}
|
|
101
|
-
${this.moreTemplate}
|
|
102
|
-
</mo-grid>
|
|
96
|
+
return html `
|
|
97
|
+
<mo-grid id='header' columns=${this.skeletonColumns} columnGap='var(--mo-data-grid-columns-gap)'>
|
|
98
|
+
${this.detailsExpanderTemplate}
|
|
99
|
+
${this.selectionTemplate}
|
|
100
|
+
${this.contentTemplate}
|
|
101
|
+
${this.moreTemplate}
|
|
102
|
+
</mo-grid>
|
|
103
103
|
`;
|
|
104
104
|
}
|
|
105
105
|
get detailsExpanderTemplate() {
|
|
106
|
-
return this.dataGrid.hasDetails === false ? html.nothing : html `
|
|
107
|
-
<mo-flex justifyContent='center' alignItems='center'>
|
|
108
|
-
${!this.dataGrid.hasDetails || !this.dataGrid.multipleDetails ? html.nothing : html `
|
|
109
|
-
<mo-icon-button dense ${style({ padding: '-10px 0px 0 -10px' })}
|
|
110
|
-
${style({ display: 'inherit' })}
|
|
111
|
-
icon=${this.dataGrid.allRowDetailsOpen ? 'unfold_less' : 'unfold_more'}
|
|
112
|
-
@click=${() => this.toggleAllDetails()}
|
|
113
|
-
></mo-icon-button>
|
|
114
|
-
`}
|
|
115
|
-
</mo-flex>
|
|
106
|
+
return this.dataGrid.hasDetails === false ? html.nothing : html `
|
|
107
|
+
<mo-flex justifyContent='center' alignItems='center'>
|
|
108
|
+
${!this.dataGrid.hasDetails || !this.dataGrid.multipleDetails ? html.nothing : html `
|
|
109
|
+
<mo-icon-button dense ${style({ padding: '-10px 0px 0 -10px' })}
|
|
110
|
+
${style({ display: 'inherit' })}
|
|
111
|
+
icon=${this.dataGrid.allRowDetailsOpen ? 'unfold_less' : 'unfold_more'}
|
|
112
|
+
@click=${() => this.toggleAllDetails()}
|
|
113
|
+
></mo-icon-button>
|
|
114
|
+
`}
|
|
115
|
+
</mo-flex>
|
|
116
116
|
`;
|
|
117
117
|
}
|
|
118
118
|
get selectionTemplate() {
|
|
119
|
-
return this.dataGrid.hasSelection === false || this.dataGrid.selectionCheckboxesHidden ? html.nothing : html `
|
|
120
|
-
<mo-flex justifyContent='center' alignItems='center'>
|
|
121
|
-
${this.dataGrid.selectionMode !== DataGridSelectionMode.Multiple ? html.nothing : html `
|
|
122
|
-
<mo-checkbox ${style({ position: 'absolute' })} .selected=${this.selection} @change=${this.handleSelectionChange}></mo-checkbox>
|
|
123
|
-
`}
|
|
124
|
-
</mo-flex>
|
|
119
|
+
return this.dataGrid.hasSelection === false || this.dataGrid.selectionCheckboxesHidden ? html.nothing : html `
|
|
120
|
+
<mo-flex justifyContent='center' alignItems='center'>
|
|
121
|
+
${this.dataGrid.selectionMode !== DataGridSelectionMode.Multiple ? html.nothing : html `
|
|
122
|
+
<mo-checkbox ${style({ position: 'absolute' })} .selected=${this.selection} @change=${this.handleSelectionChange}></mo-checkbox>
|
|
123
|
+
`}
|
|
124
|
+
</mo-flex>
|
|
125
125
|
`;
|
|
126
126
|
}
|
|
127
127
|
get contentTemplate() {
|
|
128
|
-
return html `
|
|
129
|
-
<mo-grid columns=${this.separatorAdjustedColumns}>
|
|
130
|
-
${join(this.dataGrid.visibleColumns.map(column => this.getHeaderCellTemplate(column)), index => html `
|
|
131
|
-
<mo-data-grid-header-separator
|
|
132
|
-
.dataGrid=${this.dataGrid}
|
|
133
|
-
.column=${this.dataGrid.visibleColumns[index]}
|
|
134
|
-
@columnUpdate=${() => this.dataGrid.requestUpdate()}
|
|
135
|
-
></mo-data-grid-header-separator>
|
|
136
|
-
`)}
|
|
137
|
-
</mo-grid>
|
|
128
|
+
return html `
|
|
129
|
+
<mo-grid columns=${this.separatorAdjustedColumns}>
|
|
130
|
+
${join(this.dataGrid.visibleColumns.map(column => this.getHeaderCellTemplate(column)), index => html `
|
|
131
|
+
<mo-data-grid-header-separator
|
|
132
|
+
.dataGrid=${this.dataGrid}
|
|
133
|
+
.column=${this.dataGrid.visibleColumns[index]}
|
|
134
|
+
@columnUpdate=${() => this.dataGrid.requestUpdate()}
|
|
135
|
+
></mo-data-grid-header-separator>
|
|
136
|
+
`)}
|
|
137
|
+
</mo-grid>
|
|
138
138
|
`;
|
|
139
139
|
}
|
|
140
140
|
getHeaderCellTemplate(column) {
|
|
141
141
|
const sortingDefinition = this.dataGrid.getSortingDefinition(column);
|
|
142
142
|
const sortIcon = !sortingDefinition ? undefined : sortingDefinition.strategy === DataGridSortingStrategy.Ascending ? 'arrow_upward' : 'arrow_downward';
|
|
143
143
|
const sortingRank = !sortingDefinition || this.dataGrid.getSorting().length <= 1 ? undefined : sortingDefinition.rank;
|
|
144
|
-
return html `
|
|
145
|
-
<mo-flex direction=${column.alignment === 'end' ? 'horizontal-reversed' : 'horizontal'} alignItems='center'
|
|
146
|
-
${style({ overflow: 'hidden', position: 'relative', cursor: 'pointer', userSelect: 'none' })}
|
|
147
|
-
@click=${() => this.sort(column)}
|
|
148
|
-
>
|
|
149
|
-
<div class='headerContent' ${style({ width: '100%', textAlign: column.alignment })} title=${column.title || column.heading}>${column.heading}</div>
|
|
150
|
-
|
|
151
|
-
${sortIcon === undefined ? html.nothing : html `
|
|
152
|
-
${!sortingRank ? html.nothing : html `<span class='sort-rank'>${sortingRank}</span>`}
|
|
153
|
-
<mo-icon ${style({ color: 'var(--mo-color-accent)' })} icon=${ifDefined(sortIcon)}></mo-icon>
|
|
154
|
-
`}
|
|
155
|
-
</mo-flex>
|
|
144
|
+
return html `
|
|
145
|
+
<mo-flex direction=${column.alignment === 'end' ? 'horizontal-reversed' : 'horizontal'} alignItems='center'
|
|
146
|
+
${style({ overflow: 'hidden', position: 'relative', cursor: 'pointer', userSelect: 'none' })}
|
|
147
|
+
@click=${() => this.sort(column)}
|
|
148
|
+
>
|
|
149
|
+
<div class='headerContent' ${style({ width: '100%', textAlign: column.alignment })} title=${column.title || column.heading}>${column.heading}</div>
|
|
150
|
+
|
|
151
|
+
${sortIcon === undefined ? html.nothing : html `
|
|
152
|
+
${!sortingRank ? html.nothing : html `<span class='sort-rank'>${sortingRank}</span>`}
|
|
153
|
+
<mo-icon ${style({ color: 'var(--mo-color-accent)' })} icon=${ifDefined(sortIcon)}></mo-icon>
|
|
154
|
+
`}
|
|
155
|
+
</mo-flex>
|
|
156
156
|
`;
|
|
157
157
|
}
|
|
158
158
|
get moreTemplate() {
|
|
159
|
-
return this.dataGrid.hasToolbar || this.dataGrid.sidePanelHidden ? html.nothing : html `
|
|
160
|
-
<mo-flex alignItems='center' justifyContent='center' ${style({ marginInlineEnd: '8px', cursor: 'pointer', position: 'relative' })}>
|
|
161
|
-
<mo-icon-button dense icon='settings' ${style({ color: 'var(--mo-color-accent)', fontSize: 'large' })}
|
|
162
|
-
@click=${() => this.dataGrid.navigateToSidePanelTab(this.dataGrid.sidePanelTab ? undefined : DataGridSidePanelTab.Settings)}
|
|
163
|
-
></mo-icon-button>
|
|
164
|
-
</mo-flex>
|
|
159
|
+
return this.dataGrid.hasToolbar || this.dataGrid.sidePanelHidden ? html.nothing : html `
|
|
160
|
+
<mo-flex alignItems='center' justifyContent='center' ${style({ marginInlineEnd: '8px', cursor: 'pointer', position: 'relative' })}>
|
|
161
|
+
<mo-icon-button dense icon='settings' ${style({ color: 'var(--mo-color-accent)', fontSize: 'large' })}
|
|
162
|
+
@click=${() => this.dataGrid.navigateToSidePanelTab(this.dataGrid.sidePanelTab ? undefined : DataGridSidePanelTab.Settings)}
|
|
163
|
+
></mo-icon-button>
|
|
164
|
+
</mo-flex>
|
|
165
165
|
`;
|
|
166
166
|
}
|
|
167
167
|
sort(column) {
|
|
@@ -17,55 +17,55 @@ let DataGridHeaderSeparator = DataGridHeaderSeparator_1 = class DataGridHeaderSe
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
static get styles() {
|
|
20
|
-
return css `
|
|
21
|
-
div.separator {
|
|
22
|
-
display: flex;
|
|
23
|
-
align-items: center;
|
|
24
|
-
justify-content: center;
|
|
25
|
-
inset-inline-start: calc(var(--mo-data-grid-columns-gap) * -1);
|
|
26
|
-
width: var(--mo-data-grid-columns-gap);
|
|
27
|
-
height: 100%;
|
|
28
|
-
user-select: none;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.knob {
|
|
32
|
-
height: var(--mo-data-grid-header-separator-height);
|
|
33
|
-
width: var(--mo-data-grid-header-separator-width);
|
|
34
|
-
border-radius: 100px;
|
|
35
|
-
background-color: var(--mo-color-gray);
|
|
36
|
-
transition: 0.2s;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
:host(:not([disabled])) div.separator {
|
|
40
|
-
cursor: col-resize;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
:host(:not([disabled])) .separator:hover .knob {
|
|
44
|
-
--mo-data-grid-header-separator-height: 30px;
|
|
45
|
-
--mo-data-grid-header-separator-width: 8px;
|
|
46
|
-
background-color: var(--mo-color-accent);
|
|
47
|
-
cursor: col-resize;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
:host(:not([disabled])) .resizerOverlay {
|
|
51
|
-
position: fixed;
|
|
52
|
-
top: 0;
|
|
53
|
-
height: 100%;
|
|
54
|
-
background: var(--mo-color-gray);
|
|
55
|
-
width: 2px;
|
|
56
|
-
}
|
|
20
|
+
return css `
|
|
21
|
+
div.separator {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
inset-inline-start: calc(var(--mo-data-grid-columns-gap) * -1);
|
|
26
|
+
width: var(--mo-data-grid-columns-gap);
|
|
27
|
+
height: 100%;
|
|
28
|
+
user-select: none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.knob {
|
|
32
|
+
height: var(--mo-data-grid-header-separator-height);
|
|
33
|
+
width: var(--mo-data-grid-header-separator-width);
|
|
34
|
+
border-radius: 100px;
|
|
35
|
+
background-color: var(--mo-color-gray);
|
|
36
|
+
transition: 0.2s;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:host(:not([disabled])) div.separator {
|
|
40
|
+
cursor: col-resize;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
:host(:not([disabled])) .separator:hover .knob {
|
|
44
|
+
--mo-data-grid-header-separator-height: 30px;
|
|
45
|
+
--mo-data-grid-header-separator-width: 8px;
|
|
46
|
+
background-color: var(--mo-color-accent);
|
|
47
|
+
cursor: col-resize;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
:host(:not([disabled])) .resizerOverlay {
|
|
51
|
+
position: fixed;
|
|
52
|
+
top: 0;
|
|
53
|
+
height: 100%;
|
|
54
|
+
background: var(--mo-color-gray);
|
|
55
|
+
width: 2px;
|
|
56
|
+
}
|
|
57
57
|
`;
|
|
58
58
|
}
|
|
59
59
|
get template() {
|
|
60
60
|
this.toggleAttribute('disabled', DataGridHeaderSeparator_1.disableResizing);
|
|
61
|
-
return html `
|
|
62
|
-
<div class='separator' @mousedown=${this.handleMouseDown}>
|
|
63
|
-
<div class='knob'></div>
|
|
64
|
-
</div>
|
|
65
|
-
|
|
66
|
-
${this.isResizing === false ? html.nothing : html `
|
|
67
|
-
<div class='resizerOverlay' ${style({ marginInlineStart: `${this.delta}px` })}></div>
|
|
68
|
-
`}
|
|
61
|
+
return html `
|
|
62
|
+
<div class='separator' @mousedown=${this.handleMouseDown}>
|
|
63
|
+
<div class='knob'></div>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
${this.isResizing === false ? html.nothing : html `
|
|
67
|
+
<div class='resizerOverlay' ${style({ marginInlineStart: `${this.delta}px` })}></div>
|
|
68
|
+
`}
|
|
69
69
|
`;
|
|
70
70
|
}
|
|
71
71
|
handleMouseUp() {
|
|
@@ -3,11 +3,11 @@ import { component, css } from '@a11d/lit';
|
|
|
3
3
|
import { ContextMenuItem } from '@3mo/context-menu';
|
|
4
4
|
let DataGridPrimaryContextMenuItem = class DataGridPrimaryContextMenuItem extends ContextMenuItem {
|
|
5
5
|
static get styles() {
|
|
6
|
-
return css `
|
|
7
|
-
${super.styles}
|
|
8
|
-
:host {
|
|
9
|
-
font-weight: bold;
|
|
10
|
-
}
|
|
6
|
+
return css `
|
|
7
|
+
${super.styles}
|
|
8
|
+
:host {
|
|
9
|
+
font-weight: bold;
|
|
10
|
+
}
|
|
11
11
|
`;
|
|
12
12
|
}
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataGridSidePanel.d.ts","sourceRoot":"","sources":["../DataGridSidePanel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAwC,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"DataGridSidePanel.d.ts","sourceRoot":"","sources":["../DataGridSidePanel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAwC,MAAM,WAAW,CAAA;AAI7F,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAYxC,oBAAY,oBAAoB;IAC/B,QAAQ,aAAa;IACrB,OAAO,YAAY;CACnB;AAED;;;;GAIG;AACH,qBACa,iBAAiB,CAAC,KAAK,CAAE,SAAQ,SAAS;IAC1B,QAAQ,EAAG,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IAC/C,GAAG,CAAC,EAAE,oBAAoB,CAAA;IAEtC,WAAoB,MAAM,kCA2CzB;IAED,cAAuB,QAAQ,0CAmC9B;IAED,SAAS,KAAK,eAAe,0CAM5B;IAED,SAAS,KAAK,gBAAgB,0CAgC7B;IAED,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAcjC;CACD;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,yBAAyB,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAA;KACrD;CACD"}
|