@@ -13,7 +13,7 @@ import '@vaadin/confirm-dialog/src/vaadin-confirm-dialog.js';
1313import './vaadin-crud-dialog.js' ;
1414import './vaadin-crud-grid.js' ;
1515import './vaadin-crud-form.js' ;
16- import { html , LitElement } from 'lit' ;
16+ import { html , LitElement , render } from 'lit' ;
1717import { ifDefined } from 'lit/directives/if-defined.js' ;
1818import { defineCustomElement } from '@vaadin/component-base/src/define.js' ;
1919import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js' ;
@@ -172,6 +172,14 @@ import { CrudMixin } from './vaadin-crud-mixin.js';
172172 * @mixes CrudMixin
173173 */
174174class Crud extends CrudMixin ( ElementMixin ( ThemableMixin ( PolylitMixin ( LumoInjectionMixin ( LitElement ) ) ) ) ) {
175+ static get is ( ) {
176+ return 'vaadin-crud' ;
177+ }
178+
179+ static get cvdlName ( ) {
180+ return 'vaadin-crud' ;
181+ }
182+
175183 static get styles ( ) {
176184 return crudStyles ;
177185 }
@@ -222,38 +230,54 @@ class Crud extends CrudMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjecti
222230 @opened-changed ="${ this . __onDialogOpened } "
223231 > </ vaadin-crud-dialog >
224232
225- < vaadin-confirm-dialog
226- theme ="${ ifDefined ( this . _theme ) } "
227- id ="confirmCancel "
228- @confirm ="${ this . __confirmCancel } "
229- cancel-button-visible
230- .confirmText ="${ this . __effectiveI18n . confirm . cancel . button . confirm } "
231- .cancelText ="${ this . __effectiveI18n . confirm . cancel . button . dismiss } "
232- .header ="${ this . __effectiveI18n . confirm . cancel . title } "
233- .message ="${ this . __effectiveI18n . confirm . cancel . content } "
234- confirm-theme ="primary "
235- > </ vaadin-confirm-dialog >
233+ < slot name ="confirm-cancel "> </ slot >
236234
237- < vaadin-confirm-dialog
238- theme ="${ ifDefined ( this . _theme ) } "
239- id ="confirmDelete "
240- @confirm ="${ this . __confirmDelete } "
241- cancel-button-visible
242- .confirmText ="${ this . __effectiveI18n . confirm . delete . button . confirm } "
243- .cancelText ="${ this . __effectiveI18n . confirm . delete . button . dismiss } "
244- .header ="${ this . __effectiveI18n . confirm . delete . title } "
245- .message ="${ this . __effectiveI18n . confirm . delete . content } "
246- confirm-theme ="primary error "
247- > </ vaadin-confirm-dialog >
235+ < slot name ="confirm-delete "> </ slot >
248236 ` ;
249237 }
250238
251- static get is ( ) {
252- return 'vaadin-crud' ;
239+ /**
240+ * Override update to render slotted overlays into light DOM after rendering shadow DOM.
241+ * @param changedProperties
242+ * @protected
243+ */
244+ update ( changedProperties ) {
245+ super . update ( changedProperties ) ;
246+
247+ this . __renderSlottedOverlays ( ) ;
253248 }
254249
255- static get cvdlName ( ) {
256- return 'vaadin-crud' ;
250+ /** @private */
251+ __renderSlottedOverlays ( ) {
252+ render (
253+ html `
254+ < vaadin-confirm-dialog
255+ theme ="${ ifDefined ( this . _theme ) } "
256+ slot ="confirm-cancel "
257+ @confirm ="${ this . __confirmCancel } "
258+ cancel-button-visible
259+ .confirmText ="${ this . __effectiveI18n . confirm . cancel . button . confirm } "
260+ .cancelText ="${ this . __effectiveI18n . confirm . cancel . button . dismiss } "
261+ .header ="${ this . __effectiveI18n . confirm . cancel . title } "
262+ .message ="${ this . __effectiveI18n . confirm . cancel . content } "
263+ confirm-theme ="primary "
264+ > </ vaadin-confirm-dialog >
265+
266+ < vaadin-confirm-dialog
267+ theme ="${ ifDefined ( this . _theme ) } "
268+ slot ="confirm-delete "
269+ @confirm ="${ this . __confirmDelete } "
270+ cancel-button-visible
271+ .confirmText ="${ this . __effectiveI18n . confirm . delete . button . confirm } "
272+ .cancelText ="${ this . __effectiveI18n . confirm . delete . button . dismiss } "
273+ .header ="${ this . __effectiveI18n . confirm . delete . title } "
274+ .message ="${ this . __effectiveI18n . confirm . delete . content } "
275+ confirm-theme ="primary error "
276+ > </ vaadin-confirm-dialog >
277+ ` ,
278+ this ,
279+ { host : this } ,
280+ ) ;
257281 }
258282}
259283
0 commit comments