@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/DataGridCell.js
CHANGED
|
@@ -47,13 +47,15 @@ let DataGridCell = class DataGridCell extends Component {
|
|
|
47
47
|
async handleKeyDown(event) {
|
|
48
48
|
switch (event.key) {
|
|
49
49
|
case 'Enter':
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
this.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
if (this.isEditing === false) {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
event.stopPropagation();
|
|
53
|
+
if (this.isEditable) {
|
|
54
|
+
this.setEditing(true);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.click();
|
|
58
|
+
}
|
|
57
59
|
}
|
|
58
60
|
break;
|
|
59
61
|
case 'Escape':
|
|
@@ -108,41 +110,41 @@ let DataGridCell = class DataGridCell extends Component {
|
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
112
|
static get styles() {
|
|
111
|
-
return css `
|
|
112
|
-
:host {
|
|
113
|
-
display: inline-block;
|
|
114
|
-
align-content: center;
|
|
115
|
-
position: relative;
|
|
116
|
-
padding-inline: var(--mo-data-grid-cell-padding);
|
|
117
|
-
font-size: var(--mo-data-grid-cell-font-size);
|
|
118
|
-
outline: none;
|
|
119
|
-
height: var(--mo-data-grid-row-height);
|
|
120
|
-
user-select: none;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
:host(:not([isEditing])) {
|
|
124
|
-
white-space: nowrap;
|
|
125
|
-
overflow: hidden;
|
|
126
|
-
text-overflow: ellipsis;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
:host(:not([isEditing]):focus) {
|
|
130
|
-
outline: 2px solid var(--mo-color-accent);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
:host([alignment=start]) {
|
|
134
|
-
text-align: start;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
:host([alignment=center]) {
|
|
138
|
-
text-align: center;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
:host([alignment=end]) {
|
|
142
|
-
text-align: end;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
${DataGridColumn.stickyStyles}
|
|
113
|
+
return css `
|
|
114
|
+
:host {
|
|
115
|
+
display: inline-block;
|
|
116
|
+
align-content: center;
|
|
117
|
+
position: relative;
|
|
118
|
+
padding-inline: var(--mo-data-grid-cell-padding);
|
|
119
|
+
font-size: var(--mo-data-grid-cell-font-size);
|
|
120
|
+
outline: none;
|
|
121
|
+
height: var(--mo-data-grid-row-height);
|
|
122
|
+
user-select: none;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
:host(:not([isEditing])) {
|
|
126
|
+
white-space: nowrap;
|
|
127
|
+
overflow: hidden;
|
|
128
|
+
text-overflow: ellipsis;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
:host(:not([isEditing]):focus) {
|
|
132
|
+
outline: 2px solid var(--mo-color-accent);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
:host([alignment=start]) {
|
|
136
|
+
text-align: start;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
:host([alignment=center]) {
|
|
140
|
+
text-align: center;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
:host([alignment=end]) {
|
|
144
|
+
text-align: end;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
${DataGridColumn.stickyStyles}
|
|
146
148
|
`;
|
|
147
149
|
}
|
|
148
150
|
get tooltip() { return this.valueTextContent; }
|
|
@@ -163,9 +165,9 @@ let DataGridCell = class DataGridCell extends Component {
|
|
|
163
165
|
return this.isEditing ? this.editContentTemplate : this.contentTemplate;
|
|
164
166
|
}
|
|
165
167
|
get contentTemplate() {
|
|
166
|
-
return html `
|
|
167
|
-
${this.contentStyleTemplate}
|
|
168
|
-
${this.column.getContentTemplate?.(this.value, this.data) ?? html `${this.value}`}
|
|
168
|
+
return html `
|
|
169
|
+
${this.contentStyleTemplate}
|
|
170
|
+
${this.column.getContentTemplate?.(this.value, this.data) ?? html `${this.value}`}
|
|
169
171
|
`;
|
|
170
172
|
}
|
|
171
173
|
get contentStyleTemplate() {
|
package/dist/DataGridColumn.js
CHANGED
|
@@ -62,40 +62,40 @@ export class DataGridColumn {
|
|
|
62
62
|
.filter(n => isNaN(n) === false)
|
|
63
63
|
.reduce(((a, b) => a + b), 0)
|
|
64
64
|
|| 0;
|
|
65
|
-
return html `
|
|
66
|
-
<mo-data-grid-footer-sum heading=${this.sumHeading || ''} ${style({ color: this.dataGrid.selectedData.length > 0 ? 'var(--mo-color-accent)' : 'currentColor' })}>
|
|
67
|
-
${this.getSumTemplate(sum)}
|
|
68
|
-
</mo-data-grid-footer-sum>
|
|
65
|
+
return html `
|
|
66
|
+
<mo-data-grid-footer-sum heading=${this.sumHeading || ''} ${style({ color: this.dataGrid.selectedData.length > 0 ? 'var(--mo-color-accent)' : 'currentColor' })}>
|
|
67
|
+
${this.getSumTemplate(sum)}
|
|
68
|
+
</mo-data-grid-footer-sum>
|
|
69
69
|
`;
|
|
70
70
|
}
|
|
71
71
|
get stickyColumnInsetInline() {
|
|
72
72
|
return this.dataGrid?.columnsController.getStickyColumnInsetInline(this) ?? '';
|
|
73
73
|
}
|
|
74
|
-
static { this.stickyStyles = css `
|
|
75
|
-
:host([data-sticky]) {
|
|
76
|
-
position: sticky;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
:host([data-sticky]) {
|
|
80
|
-
z-index: 6;
|
|
81
|
-
background: var(--mo-data-grid-sticky-part-color);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
:host([data-sticky-edge~=end]) {
|
|
85
|
-
border-inline-end: var(--mo-data-grid-border);
|
|
86
|
-
box-shadow: var(--mo-shadow-deep);
|
|
87
|
-
clip-path: inset(0 -1rem 0 0);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
:host([data-sticky-edge~=start]) {
|
|
91
|
-
border-inline-start: var(--mo-data-grid-border);
|
|
92
|
-
box-shadow: var(--mo-shadow-deep);
|
|
93
|
-
clip-path: inset(0 0 0 -1rem);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
:host([data-sticky-edge="start end"]) {
|
|
97
|
-
clip-path: inset(0 -1rem 0 -1rem);
|
|
98
|
-
}
|
|
74
|
+
static { this.stickyStyles = css `
|
|
75
|
+
:host([data-sticky]) {
|
|
76
|
+
position: sticky;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
:host([data-sticky]) {
|
|
80
|
+
z-index: 6;
|
|
81
|
+
background: var(--mo-data-grid-sticky-part-color);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
:host([data-sticky-edge~=end]) {
|
|
85
|
+
border-inline-end: var(--mo-data-grid-border);
|
|
86
|
+
box-shadow: var(--mo-shadow-deep);
|
|
87
|
+
clip-path: inset(0 -1rem 0 0);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
:host([data-sticky-edge~=start]) {
|
|
91
|
+
border-inline-start: var(--mo-data-grid-border);
|
|
92
|
+
box-shadow: var(--mo-shadow-deep);
|
|
93
|
+
clip-path: inset(0 0 0 -1rem);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
:host([data-sticky-edge="start end"]) {
|
|
97
|
+
clip-path: inset(0 -1rem 0 -1rem);
|
|
98
|
+
}
|
|
99
99
|
`; }
|
|
100
100
|
get stickyEdge() {
|
|
101
101
|
if (!this.sticky || !this.dataGrid) {
|
|
@@ -26,162 +26,162 @@ let DataGridColumnHeader = class DataGridColumnHeader extends Component {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
static get styles() {
|
|
29
|
-
return css `
|
|
30
|
-
:host {
|
|
31
|
-
display: flex;
|
|
32
|
-
position: relative;
|
|
33
|
-
cursor: pointer;
|
|
34
|
-
transition: background 0.1s;
|
|
35
|
-
anchor-name: --mo-data-grid-column-header;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
#reorderable-area {
|
|
39
|
-
display: flex;
|
|
40
|
-
flex: 1;
|
|
41
|
-
overflow: hidden;
|
|
42
|
-
padding: 0 var(--mo-data-grid-cell-padding);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
:host:has(#reorderable-area[data-reorderability=${unsafeCSS(ReorderabilityState.Dragging)}]) {
|
|
46
|
-
background: var(--mo-color-surface);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
#reorderable-area[data-reorderability=${unsafeCSS(ReorderabilityState.Dragging)}] {
|
|
50
|
-
opacity: 0;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
:host:has(#reorderable-area[data-reorderability=${unsafeCSS(ReorderabilityState.DropBefore)}]),
|
|
54
|
-
:host:has(#reorderable-area[data-reorderability=${unsafeCSS(ReorderabilityState.DropAfter)}]) {
|
|
55
|
-
&::after {
|
|
56
|
-
content: '';
|
|
57
|
-
position: absolute;
|
|
58
|
-
top: 0;
|
|
59
|
-
width: 3px;
|
|
60
|
-
height: calc(var(--_content-height) - 4px);
|
|
61
|
-
background: var(--mo-color-accent);
|
|
62
|
-
z-index: 10;
|
|
63
|
-
pointer-events: none;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
:host:has(#reorderable-area[data-reorderability=${unsafeCSS(ReorderabilityState.DropBefore)}])::after {
|
|
68
|
-
inset-inline-start: 0;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
:host:has(#reorderable-area[data-reorderability=${unsafeCSS(ReorderabilityState.DropAfter)}])::after {
|
|
72
|
-
inset-inline-end: 0;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
:host(:hover) {
|
|
76
|
-
background: color-mix(in srgb, var(--mo-color-surface), var(--mo-color-gray) 8%);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
${DataGridColumn.stickyStyles}
|
|
80
|
-
|
|
81
|
-
mo-data-grid-header-separator {
|
|
82
|
-
z-index: 5;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
:host([data-sticky]) mo-data-grid-header-separator {
|
|
86
|
-
z-index: 7;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
#drag-indicator {
|
|
90
|
-
position: absolute;
|
|
91
|
-
inset-inline-start: 50%;
|
|
92
|
-
inset-block-start: 0;
|
|
93
|
-
transform: translateX(-50%);
|
|
94
|
-
transition: 0.15s ease;
|
|
95
|
-
color: var(--mo-color-gray);
|
|
96
|
-
opacity: 0;
|
|
97
|
-
height: 0.25rem;
|
|
98
|
-
width: 1.5rem;
|
|
99
|
-
cursor: grab;
|
|
100
|
-
border-end-end-radius: var(--mo-border-radius);
|
|
101
|
-
border-end-start-radius: var(--mo-border-radius);
|
|
102
|
-
pointer-events: none;
|
|
103
|
-
z-index: 10;
|
|
104
|
-
background: var(--mo-color-transparent-gray-3);
|
|
105
|
-
display: flex;
|
|
106
|
-
align-items: center;
|
|
107
|
-
justify-content: center;
|
|
108
|
-
|
|
109
|
-
mo-icon {
|
|
110
|
-
visibility: hidden;
|
|
111
|
-
transform: rotate(90deg);
|
|
112
|
-
font-size: .75rem;
|
|
113
|
-
color: var(--mo-color-on-accent);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
&:hover {
|
|
117
|
-
background: var(--mo-color-accent);
|
|
118
|
-
inset-block-start: 0;
|
|
119
|
-
height: 0.75rem;
|
|
120
|
-
width: 2.5rem;
|
|
121
|
-
mo-icon {
|
|
122
|
-
visibility: visible;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
:host(:hover) #drag-indicator {
|
|
128
|
-
opacity: 1;
|
|
129
|
-
pointer-events: auto;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
#content {
|
|
133
|
-
display: inline-block;
|
|
134
|
-
overflow: hidden !important;
|
|
135
|
-
color: var(--mo-color-foreground);
|
|
136
|
-
font-weight: 500;
|
|
137
|
-
line-height: var(--mo-data-grid-header-height);
|
|
138
|
-
white-space: nowrap;
|
|
139
|
-
text-overflow: ellipsis;
|
|
140
|
-
user-select: none;
|
|
141
|
-
width: 100%;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
#sort {
|
|
145
|
-
position: relative;
|
|
146
|
-
|
|
147
|
-
&[data-preview] {
|
|
148
|
-
display: none;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
mo-icon-button {
|
|
152
|
-
transition: 0.1s;
|
|
153
|
-
font-size: 20px;
|
|
154
|
-
color: var(--mo-color-accent);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
span {
|
|
158
|
-
position: absolute;
|
|
159
|
-
inset-inline-end: 0;
|
|
160
|
-
inset-block-end: 0;
|
|
161
|
-
color: var(--mo-color-accent);
|
|
162
|
-
border-radius: 50%;
|
|
163
|
-
width: fit-content;
|
|
164
|
-
user-select: none;
|
|
165
|
-
font-size: 0.8rem;
|
|
166
|
-
aspect-ratio: 1 / 1;
|
|
167
|
-
display: flex;
|
|
168
|
-
align-items: center;
|
|
169
|
-
justify-content: center;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
mo-menu {
|
|
174
|
-
position-anchor: --mo-data-grid-column-header;
|
|
175
|
-
|
|
176
|
-
&::part(popover) {
|
|
177
|
-
margin-inline-start: calc(var(--mo-data-grid-cell-padding) * -1);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
mo-heading {
|
|
181
|
-
padding: 0.5rem 1rem;
|
|
182
|
-
opacity: 0.5;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
29
|
+
return css `
|
|
30
|
+
:host {
|
|
31
|
+
display: flex;
|
|
32
|
+
position: relative;
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
transition: background 0.1s;
|
|
35
|
+
anchor-name: --mo-data-grid-column-header;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
#reorderable-area {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex: 1;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
padding: 0 var(--mo-data-grid-cell-padding);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:host:has(#reorderable-area[data-reorderability=${unsafeCSS(ReorderabilityState.Dragging)}]) {
|
|
46
|
+
background: var(--mo-color-surface);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
#reorderable-area[data-reorderability=${unsafeCSS(ReorderabilityState.Dragging)}] {
|
|
50
|
+
opacity: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:host:has(#reorderable-area[data-reorderability=${unsafeCSS(ReorderabilityState.DropBefore)}]),
|
|
54
|
+
:host:has(#reorderable-area[data-reorderability=${unsafeCSS(ReorderabilityState.DropAfter)}]) {
|
|
55
|
+
&::after {
|
|
56
|
+
content: '';
|
|
57
|
+
position: absolute;
|
|
58
|
+
top: 0;
|
|
59
|
+
width: 3px;
|
|
60
|
+
height: calc(var(--_content-height) - 4px);
|
|
61
|
+
background: var(--mo-color-accent);
|
|
62
|
+
z-index: 10;
|
|
63
|
+
pointer-events: none;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
:host:has(#reorderable-area[data-reorderability=${unsafeCSS(ReorderabilityState.DropBefore)}])::after {
|
|
68
|
+
inset-inline-start: 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
:host:has(#reorderable-area[data-reorderability=${unsafeCSS(ReorderabilityState.DropAfter)}])::after {
|
|
72
|
+
inset-inline-end: 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
:host(:hover) {
|
|
76
|
+
background: color-mix(in srgb, var(--mo-color-surface), var(--mo-color-gray) 8%);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
${DataGridColumn.stickyStyles}
|
|
80
|
+
|
|
81
|
+
mo-data-grid-header-separator {
|
|
82
|
+
z-index: 5;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
:host([data-sticky]) mo-data-grid-header-separator {
|
|
86
|
+
z-index: 7;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
#drag-indicator {
|
|
90
|
+
position: absolute;
|
|
91
|
+
inset-inline-start: 50%;
|
|
92
|
+
inset-block-start: 0;
|
|
93
|
+
transform: translateX(-50%);
|
|
94
|
+
transition: 0.15s ease;
|
|
95
|
+
color: var(--mo-color-gray);
|
|
96
|
+
opacity: 0;
|
|
97
|
+
height: 0.25rem;
|
|
98
|
+
width: 1.5rem;
|
|
99
|
+
cursor: grab;
|
|
100
|
+
border-end-end-radius: var(--mo-border-radius);
|
|
101
|
+
border-end-start-radius: var(--mo-border-radius);
|
|
102
|
+
pointer-events: none;
|
|
103
|
+
z-index: 10;
|
|
104
|
+
background: var(--mo-color-transparent-gray-3);
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
justify-content: center;
|
|
108
|
+
|
|
109
|
+
mo-icon {
|
|
110
|
+
visibility: hidden;
|
|
111
|
+
transform: rotate(90deg);
|
|
112
|
+
font-size: .75rem;
|
|
113
|
+
color: var(--mo-color-on-accent);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&:hover {
|
|
117
|
+
background: var(--mo-color-accent);
|
|
118
|
+
inset-block-start: 0;
|
|
119
|
+
height: 0.75rem;
|
|
120
|
+
width: 2.5rem;
|
|
121
|
+
mo-icon {
|
|
122
|
+
visibility: visible;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
:host(:hover) #drag-indicator {
|
|
128
|
+
opacity: 1;
|
|
129
|
+
pointer-events: auto;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
#content {
|
|
133
|
+
display: inline-block;
|
|
134
|
+
overflow: hidden !important;
|
|
135
|
+
color: var(--mo-color-foreground);
|
|
136
|
+
font-weight: 500;
|
|
137
|
+
line-height: var(--mo-data-grid-header-height);
|
|
138
|
+
white-space: nowrap;
|
|
139
|
+
text-overflow: ellipsis;
|
|
140
|
+
user-select: none;
|
|
141
|
+
width: 100%;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
#sort {
|
|
145
|
+
position: relative;
|
|
146
|
+
|
|
147
|
+
&[data-preview] {
|
|
148
|
+
display: none;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
mo-icon-button {
|
|
152
|
+
transition: 0.1s;
|
|
153
|
+
font-size: 20px;
|
|
154
|
+
color: var(--mo-color-accent);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
span {
|
|
158
|
+
position: absolute;
|
|
159
|
+
inset-inline-end: 0;
|
|
160
|
+
inset-block-end: 0;
|
|
161
|
+
color: var(--mo-color-accent);
|
|
162
|
+
border-radius: 50%;
|
|
163
|
+
width: fit-content;
|
|
164
|
+
user-select: none;
|
|
165
|
+
font-size: 0.8rem;
|
|
166
|
+
aspect-ratio: 1 / 1;
|
|
167
|
+
display: flex;
|
|
168
|
+
align-items: center;
|
|
169
|
+
justify-content: center;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
mo-menu {
|
|
174
|
+
position-anchor: --mo-data-grid-column-header;
|
|
175
|
+
|
|
176
|
+
&::part(popover) {
|
|
177
|
+
margin-inline-start: calc(var(--mo-data-grid-cell-padding) * -1);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
mo-heading {
|
|
181
|
+
padding: 0.5rem 1rem;
|
|
182
|
+
opacity: 0.5;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
185
|
`;
|
|
186
186
|
}
|
|
187
187
|
get template() {
|
|
@@ -205,44 +205,44 @@ let DataGridColumnHeader = class DataGridColumnHeader extends Component {
|
|
|
205
205
|
color: 'var(--mo-color-on-accent)',
|
|
206
206
|
fontSize: 'small',
|
|
207
207
|
});
|
|
208
|
-
return html `
|
|
208
|
+
return html `
|
|
209
209
|
<div id='reorderable-area' ${this.reorderabilityController.item({
|
|
210
210
|
index: this.index,
|
|
211
211
|
disabled: !!this.column.sticky,
|
|
212
|
-
dragImage: html `
|
|
213
|
-
<mo-flex alignItems='center' justifyContent='center' ${dragImageStyle}>
|
|
214
|
-
${this.column.heading}
|
|
215
|
-
</mo-flex>
|
|
212
|
+
dragImage: html `
|
|
213
|
+
<mo-flex alignItems='center' justifyContent='center' ${dragImageStyle}>
|
|
214
|
+
${this.column.heading}
|
|
215
|
+
</mo-flex>
|
|
216
216
|
`
|
|
217
|
-
})}>
|
|
218
|
-
<div id='drag-indicator'>
|
|
219
|
-
<mo-icon icon='drag_indicator'></mo-icon>
|
|
220
|
-
</div>
|
|
221
|
-
<mo-popover-container placement='block-end' alignment='start' style='display: contents'>
|
|
222
|
-
<mo-flex id='container' alignItems='center' gap='0.2rem' direction=${direction} ${style({ flex: '1', overflow: 'hidden' })}>
|
|
223
|
-
${this.contentTemplate}
|
|
224
|
-
${this.sortingTemplate}
|
|
225
|
-
</mo-flex>
|
|
226
|
-
<mo-menu slot='popover' .anchor=${this} ?open=${bind(this, 'menuOpen')}>
|
|
227
|
-
<mo-line></mo-line>
|
|
217
|
+
})}>
|
|
218
|
+
<div id='drag-indicator'>
|
|
219
|
+
<mo-icon icon='drag_indicator'></mo-icon>
|
|
220
|
+
</div>
|
|
221
|
+
<mo-popover-container placement='block-end' alignment='start' style='display: contents'>
|
|
222
|
+
<mo-flex id='container' alignItems='center' gap='0.2rem' direction=${direction} ${style({ flex: '1', overflow: 'hidden' })}>
|
|
223
|
+
${this.contentTemplate}
|
|
224
|
+
${this.sortingTemplate}
|
|
225
|
+
</mo-flex>
|
|
226
|
+
<mo-menu slot='popover' .anchor=${this} ?open=${bind(this, 'menuOpen')}>
|
|
227
|
+
<mo-line></mo-line>
|
|
228
228
|
${join([
|
|
229
229
|
!this.column.sortable ? undefined : this.getSortingItemsTemplate(additionalItems instanceof Map ? additionalItems.get('sorting') : undefined),
|
|
230
230
|
// Hide stickiness items for now
|
|
231
231
|
true ? undefined : this.getStickinessItemsTemplate(additionalItems instanceof Map ? additionalItems.get('stickiness') : undefined),
|
|
232
232
|
this.getMoreItemsTemplate(additionalItems instanceof Map ? additionalItems.get('more') : additionalItems),
|
|
233
|
-
].filter(Boolean), html `<mo-line></mo-line>`)}
|
|
234
|
-
</mo-menu>
|
|
235
|
-
</mo-popover-container>
|
|
236
|
-
</div>
|
|
237
|
-
${this.separatorTemplate}
|
|
233
|
+
].filter(Boolean), html `<mo-line></mo-line>`)}
|
|
234
|
+
</mo-menu>
|
|
235
|
+
</mo-popover-container>
|
|
236
|
+
</div>
|
|
237
|
+
${this.separatorTemplate}
|
|
238
238
|
`;
|
|
239
239
|
}
|
|
240
240
|
get contentTemplate() {
|
|
241
|
-
return html `
|
|
242
|
-
<div id='content'
|
|
243
|
-
${style({ textAlign: this.column.alignment })}
|
|
244
|
-
${!this.column.description ? html.nothing : tooltip(this.column.description)}
|
|
245
|
-
>${this.column.heading}</div>
|
|
241
|
+
return html `
|
|
242
|
+
<div id='content'
|
|
243
|
+
${style({ textAlign: this.column.alignment })}
|
|
244
|
+
${!this.column.description ? html.nothing : tooltip(this.column.description)}
|
|
245
|
+
>${this.column.heading}</div>
|
|
246
246
|
`;
|
|
247
247
|
}
|
|
248
248
|
get sortingTemplate() {
|
|
@@ -253,53 +253,53 @@ let DataGridColumnHeader = class DataGridColumnHeader extends Component {
|
|
|
253
253
|
e.stopPropagation();
|
|
254
254
|
this.column.toggleSort();
|
|
255
255
|
};
|
|
256
|
-
return !this.column.sortable ? html.nothing : html `
|
|
257
|
-
<mo-flex id='sort' direction='horizontal' ?data-preview=${!sortingDefinition?.strategy}>
|
|
258
|
-
<mo-icon-button dense icon=${sortIcon} @click=${handleSortClick}></mo-icon-button>
|
|
259
|
-
${!sortingRank ? html.nothing : html `<span>${sortingRank}</span>`}
|
|
260
|
-
</mo-flex>
|
|
256
|
+
return !this.column.sortable ? html.nothing : html `
|
|
257
|
+
<mo-flex id='sort' direction='horizontal' ?data-preview=${!sortingDefinition?.strategy}>
|
|
258
|
+
<mo-icon-button dense icon=${sortIcon} @click=${handleSortClick}></mo-icon-button>
|
|
259
|
+
${!sortingRank ? html.nothing : html `<span>${sortingRank}</span>`}
|
|
260
|
+
</mo-flex>
|
|
261
261
|
`;
|
|
262
262
|
}
|
|
263
263
|
getSortingItemsTemplate(additionalItems) {
|
|
264
|
-
return html `
|
|
265
|
-
<mo-heading typography='subtitle2'>${t('Sorting')}</mo-heading>
|
|
266
|
-
<mo-selectable-menu-item icon='arrow_downward'
|
|
267
|
-
?disabled=${this.column.sortable === false}
|
|
268
|
-
?selected=${this.column.sortingDefinition?.strategy === DataGridSortingStrategy.Descending}
|
|
269
|
-
@click=${() => this.column.toggleSort(DataGridSortingStrategy.Descending)}
|
|
270
|
-
>${t('Sort descending')}</mo-selectable-menu-item>
|
|
271
|
-
<mo-selectable-menu-item icon='arrow_upward'
|
|
272
|
-
?disabled=${this.column.sortable === false}
|
|
273
|
-
?selected=${this.column.sortingDefinition?.strategy === DataGridSortingStrategy.Ascending}
|
|
274
|
-
@click=${() => this.column.toggleSort(DataGridSortingStrategy.Ascending)}
|
|
275
|
-
>${t('Sort ascending')}</mo-selectable-menu-item>
|
|
276
|
-
${additionalItems}
|
|
264
|
+
return html `
|
|
265
|
+
<mo-heading typography='subtitle2'>${t('Sorting')}</mo-heading>
|
|
266
|
+
<mo-selectable-menu-item icon='arrow_downward'
|
|
267
|
+
?disabled=${this.column.sortable === false}
|
|
268
|
+
?selected=${this.column.sortingDefinition?.strategy === DataGridSortingStrategy.Descending}
|
|
269
|
+
@click=${() => this.column.toggleSort(DataGridSortingStrategy.Descending)}
|
|
270
|
+
>${t('Sort descending')}</mo-selectable-menu-item>
|
|
271
|
+
<mo-selectable-menu-item icon='arrow_upward'
|
|
272
|
+
?disabled=${this.column.sortable === false}
|
|
273
|
+
?selected=${this.column.sortingDefinition?.strategy === DataGridSortingStrategy.Ascending}
|
|
274
|
+
@click=${() => this.column.toggleSort(DataGridSortingStrategy.Ascending)}
|
|
275
|
+
>${t('Sort ascending')}</mo-selectable-menu-item>
|
|
276
|
+
${additionalItems}
|
|
277
277
|
`;
|
|
278
278
|
}
|
|
279
279
|
getStickinessItemsTemplate(additionalItems) {
|
|
280
|
-
return html `
|
|
281
|
-
<mo-heading typography='subtitle2'>${t('Stickiness')}</mo-heading>
|
|
282
|
-
<mo-selectable-menu-item icon='push_pin'
|
|
283
|
-
?selected=${this.column.sticky === 'start'}
|
|
284
|
-
@click=${() => this.column.toggleSticky('start')}
|
|
285
|
-
>${t('Stick to start')}</mo-selectable-menu-item>
|
|
286
|
-
<mo-selectable-menu-item icon='push_pin'
|
|
287
|
-
?selected=${this.column.sticky === 'both'}
|
|
288
|
-
@click=${() => this.column.toggleSticky('both')}
|
|
289
|
-
>${t('Stick to both')}</mo-selectable-menu-item>
|
|
290
|
-
<mo-selectable-menu-item icon='push_pin'
|
|
291
|
-
?selected=${this.column.sticky === 'end'}
|
|
292
|
-
@click=${() => this.column.toggleSticky('end')}
|
|
293
|
-
>${t('Stick to end')}</mo-selectable-menu-item>
|
|
294
|
-
${additionalItems}
|
|
280
|
+
return html `
|
|
281
|
+
<mo-heading typography='subtitle2'>${t('Stickiness')}</mo-heading>
|
|
282
|
+
<mo-selectable-menu-item icon='push_pin'
|
|
283
|
+
?selected=${this.column.sticky === 'start'}
|
|
284
|
+
@click=${() => this.column.toggleSticky('start')}
|
|
285
|
+
>${t('Stick to start')}</mo-selectable-menu-item>
|
|
286
|
+
<mo-selectable-menu-item icon='push_pin'
|
|
287
|
+
?selected=${this.column.sticky === 'both'}
|
|
288
|
+
@click=${() => this.column.toggleSticky('both')}
|
|
289
|
+
>${t('Stick to both')}</mo-selectable-menu-item>
|
|
290
|
+
<mo-selectable-menu-item icon='push_pin'
|
|
291
|
+
?selected=${this.column.sticky === 'end'}
|
|
292
|
+
@click=${() => this.column.toggleSticky('end')}
|
|
293
|
+
>${t('Stick to end')}</mo-selectable-menu-item>
|
|
294
|
+
${additionalItems}
|
|
295
295
|
`;
|
|
296
296
|
}
|
|
297
297
|
getMoreItemsTemplate(additionalItems) {
|
|
298
|
-
return html `
|
|
299
|
-
<mo-menu-item icon='visibility_off' @click=${() => this.column.hide()}>
|
|
300
|
-
${t('Hide')}
|
|
301
|
-
</mo-menu-item>
|
|
302
|
-
${additionalItems}
|
|
298
|
+
return html `
|
|
299
|
+
<mo-menu-item icon='visibility_off' @click=${() => this.column.hide()}>
|
|
300
|
+
${t('Hide')}
|
|
301
|
+
</mo-menu-item>
|
|
302
|
+
${additionalItems}
|
|
303
303
|
`;
|
|
304
304
|
}
|
|
305
305
|
get separatorTemplate() {
|
|
@@ -307,12 +307,12 @@ let DataGridColumnHeader = class DataGridColumnHeader extends Component {
|
|
|
307
307
|
return html.nothing;
|
|
308
308
|
}
|
|
309
309
|
const index = this.column.dataGrid.visibleColumns.indexOf(this.column);
|
|
310
|
-
return html `
|
|
311
|
-
<mo-data-grid-header-separator
|
|
312
|
-
?data-last=${this.column.dataGrid.visibleColumns.length - 1 === index}
|
|
313
|
-
.dataGrid=${this.column.dataGrid}
|
|
314
|
-
.column=${this.column.dataGrid.visibleColumns[index]}
|
|
315
|
-
></mo-data-grid-header-separator>
|
|
310
|
+
return html `
|
|
311
|
+
<mo-data-grid-header-separator
|
|
312
|
+
?data-last=${this.column.dataGrid.visibleColumns.length - 1 === index}
|
|
313
|
+
.dataGrid=${this.column.dataGrid}
|
|
314
|
+
.column=${this.column.dataGrid.visibleColumns[index]}
|
|
315
|
+
></mo-data-grid-header-separator>
|
|
316
316
|
`;
|
|
317
317
|
}
|
|
318
318
|
};
|