@3mo/data-grid 0.5.17 → 0.6.0

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.
@@ -65,6 +65,7 @@ export class DataGridRow extends Component {
65
65
  }
66
66
 
67
67
  #contentContainer {
68
+ grid-column: -1 / 1;
68
69
  cursor: pointer;
69
70
  transition: 250ms;
70
71
  }
@@ -120,7 +121,7 @@ export class DataGridRow extends Component {
120
121
  display: none;
121
122
  }
122
123
 
123
- #detailsContainer > :first-child {
124
+ :host(:not([has-sub-data])) #detailsContainer > :first-child {
124
125
  padding: 8px 0;
125
126
  }
126
127
 
@@ -131,7 +132,7 @@ export class DataGridRow extends Component {
131
132
  }
132
133
  get template() {
133
134
  return html `
134
- <mo-grid id='contentContainer'
135
+ <mo-grid id='contentContainer' columns='subgrid'
135
136
  @click=${() => this.handleContentClick()}
136
137
  @dblclick=${() => this.handleContentDoubleClick()}
137
138
  @auxclick=${(e) => e.button !== 1 ? void 0 : this.handleContentMiddleClick()}
@@ -184,11 +185,11 @@ export class DataGridRow extends Component {
184
185
  }
185
186
  get contextMenuIconButtonTemplate() {
186
187
  return this.dataGrid.hasContextMenu === false ? html.nothing : html `
187
- <mo-flex justifyContent='center' alignItems='center'
188
- @click=${this.openContextMenu}
189
- @dblclick=${(e) => e.stopPropagation()}
190
- >
191
- <mo-icon-button id='contextMenuIconButton' icon='more_vert'></mo-icon-button>
188
+ <mo-flex justifyContent='center' ${style({ height: '100%', placeSelf: 'end', position: 'sticky', insetInlineEnd: '0px', zIndex: '3', background: 'var(--mo-data-grid-sticky-part-color)' })}>
189
+ <mo-icon-button id='contextMenuIconButton' icon='more_vert' dense
190
+ @click=${this.openContextMenu}
191
+ @dblclick=${(e) => e.stopPropagation()}
192
+ ></mo-icon-button>
192
193
  </mo-flex>
193
194
  `;
194
195
  }
@@ -200,11 +201,10 @@ export class DataGridRow extends Component {
200
201
  return this.dataGrid.getRowDetailsTemplate(this.data);
201
202
  }
202
203
  const subData = this.dataGrid.getSubData(this.data);
204
+ this.toggleAttribute('has-sub-data', !!subData);
203
205
  if (subData) {
204
206
  return html `
205
- <mo-flex style='width: 100%; padding: 0px'>
206
- ${subData.map(data => this.dataGrid.getRowTemplate(data, undefined, this.level + 1))}
207
- </mo-flex>
207
+ ${subData.map(data => this.dataGrid.getRowTemplate(data, undefined, this.level + 1))}
208
208
  `;
209
209
  }
210
210
  return html.nothing;
@@ -236,15 +236,15 @@ export class DataGridRow extends Component {
236
236
  this.contextMenuOpen = false;
237
237
  }
238
238
  }
239
- async openContextMenu(mouseEvent) {
239
+ async openContextMenu(event) {
240
240
  if (!this.dataGrid.hasContextMenu) {
241
241
  return;
242
242
  }
243
- mouseEvent?.stopPropagation();
243
+ event?.stopPropagation();
244
244
  if (this.dataGrid.selectedData.includes(this.data) === false) {
245
245
  this.dataGrid.select(this.dataGrid.selectionMode !== DataGridSelectionMode.None ? [this.data] : []);
246
246
  }
247
- const contextMenu = ContextMenu.open(mouseEvent || [0, 0], this.contextMenuTemplate);
247
+ const contextMenu = ContextMenu.open(event || [0, 0], this.contextMenuTemplate);
248
248
  this.contextMenuOpen = true;
249
249
  const handler = (open) => {
250
250
  this.contextMenuOpen = open;