@vaadin/crud 24.8.0-alpha9 → 25.0.0-alpha2

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.
Files changed (35) hide show
  1. package/README.md +0 -23
  2. package/package.json +17 -20
  3. package/src/vaadin-crud-dialog.js +32 -31
  4. package/src/vaadin-crud-edit-column.d.ts +1 -1
  5. package/src/vaadin-crud-edit-column.js +1 -1
  6. package/src/vaadin-crud-edit.js +18 -21
  7. package/src/vaadin-crud-form.js +4 -1
  8. package/src/vaadin-crud-helpers.js +3 -3
  9. package/src/vaadin-crud-mixin.js +16 -10
  10. package/src/vaadin-crud.d.ts +1 -6
  11. package/src/vaadin-crud.js +31 -28
  12. package/web-types.json +7 -7
  13. package/web-types.lit.json +5 -5
  14. package/src/vaadin-lit-crud-dialog.d.ts +0 -11
  15. package/src/vaadin-lit-crud-dialog.js +0 -128
  16. package/src/vaadin-lit-crud-edit-column.d.ts +0 -11
  17. package/src/vaadin-lit-crud-edit-column.js +0 -70
  18. package/src/vaadin-lit-crud-edit.d.ts +0 -11
  19. package/src/vaadin-lit-crud-edit.js +0 -75
  20. package/src/vaadin-lit-crud-form.d.ts +0 -11
  21. package/src/vaadin-lit-crud-form.js +0 -80
  22. package/src/vaadin-lit-crud-grid.d.ts +0 -11
  23. package/src/vaadin-lit-crud-grid.js +0 -35
  24. package/src/vaadin-lit-crud.js +0 -122
  25. package/theme/lumo/vaadin-lit-crud.d.ts +0 -8
  26. package/theme/lumo/vaadin-lit-crud.js +0 -8
  27. package/theme/material/vaadin-crud-styles.d.ts +0 -2
  28. package/theme/material/vaadin-crud-styles.js +0 -157
  29. package/theme/material/vaadin-crud.d.ts +0 -8
  30. package/theme/material/vaadin-crud.js +0 -8
  31. package/theme/material/vaadin-lit-crud.d.ts +0 -8
  32. package/theme/material/vaadin-lit-crud.js +0 -8
  33. package/vaadin-lit-crud-edit .js +0 -1
  34. package/vaadin-lit-crud-edit-column.js +0 -1
  35. package/vaadin-lit-crud.js +0 -2
package/README.md CHANGED
@@ -28,29 +28,6 @@ Once installed, import the component in your application:
28
28
  import '@vaadin/crud';
29
29
  ```
30
30
 
31
- ## Themes
32
-
33
- Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
34
- The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/crud/vaadin-crud.js) of the package uses the Lumo theme.
35
-
36
- To use the Material theme, import the component from the `theme/material` folder:
37
-
38
- ```js
39
- import '@vaadin/crud/theme/material/vaadin-crud.js';
40
- ```
41
-
42
- You can also import the Lumo version of the component explicitly:
43
-
44
- ```js
45
- import '@vaadin/crud/theme/lumo/vaadin-crud.js';
46
- ```
47
-
48
- Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
49
-
50
- ```js
51
- import '@vaadin/crud/src/vaadin-crud.js';
52
- ```
53
-
54
31
  ## Contributing
55
32
 
56
33
  Read the [contributing guide](https://vaadin.com/docs/latest/contributing) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/crud",
3
- "version": "24.8.0-alpha9",
3
+ "version": "25.0.0-alpha2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -31,30 +31,27 @@
31
31
  "Vaadin",
32
32
  "vaadin-crud",
33
33
  "web-components",
34
- "web-component",
35
- "polymer"
34
+ "web-component"
36
35
  ],
37
36
  "dependencies": {
38
37
  "@open-wc/dedupe-mixin": "^1.3.0",
39
- "@polymer/polymer": "^3.0.0",
40
- "@vaadin/a11y-base": "24.8.0-alpha9",
41
- "@vaadin/button": "24.8.0-alpha9",
42
- "@vaadin/component-base": "24.8.0-alpha9",
43
- "@vaadin/confirm-dialog": "24.8.0-alpha9",
44
- "@vaadin/dialog": "24.8.0-alpha9",
45
- "@vaadin/form-layout": "24.8.0-alpha9",
46
- "@vaadin/grid": "24.8.0-alpha9",
47
- "@vaadin/overlay": "24.8.0-alpha9",
48
- "@vaadin/text-field": "24.8.0-alpha9",
49
- "@vaadin/vaadin-lumo-styles": "24.8.0-alpha9",
50
- "@vaadin/vaadin-material-styles": "24.8.0-alpha9",
51
- "@vaadin/vaadin-themable-mixin": "24.8.0-alpha9",
38
+ "@vaadin/a11y-base": "25.0.0-alpha2",
39
+ "@vaadin/button": "25.0.0-alpha2",
40
+ "@vaadin/component-base": "25.0.0-alpha2",
41
+ "@vaadin/confirm-dialog": "25.0.0-alpha2",
42
+ "@vaadin/dialog": "25.0.0-alpha2",
43
+ "@vaadin/form-layout": "25.0.0-alpha2",
44
+ "@vaadin/grid": "25.0.0-alpha2",
45
+ "@vaadin/overlay": "25.0.0-alpha2",
46
+ "@vaadin/text-field": "25.0.0-alpha2",
47
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha2",
48
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha2",
52
49
  "lit": "^3.0.0"
53
50
  },
54
51
  "devDependencies": {
55
- "@vaadin/chai-plugins": "24.8.0-alpha9",
56
- "@vaadin/test-runner-commands": "24.8.0-alpha9",
57
- "@vaadin/testing-helpers": "^1.1.0",
52
+ "@vaadin/chai-plugins": "25.0.0-alpha2",
53
+ "@vaadin/test-runner-commands": "25.0.0-alpha2",
54
+ "@vaadin/testing-helpers": "^2.0.0",
58
55
  "sinon": "^18.0.0"
59
56
  },
60
57
  "cvdlName": "vaadin-crud",
@@ -62,5 +59,5 @@
62
59
  "web-types.json",
63
60
  "web-types.lit.json"
64
61
  ],
65
- "gitHead": "4de3809275ddfd733b0d13fd02af8faf73eb6770"
62
+ "gitHead": "67ffcd5355cf21ce1b5039c598525109fc4c164b"
66
63
  }
@@ -8,26 +8,20 @@
8
8
  * See https://vaadin.com/commercial-license-and-service-terms for the full
9
9
  * license.
10
10
  */
11
- import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
11
+ import { css, html, LitElement } from 'lit';
12
+ import { ifDefined } from 'lit/directives/if-defined.js';
12
13
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
13
14
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
14
15
  import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
16
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
15
17
  import { DialogBaseMixin } from '@vaadin/dialog/src/vaadin-dialog-base-mixin.js';
16
18
  import { dialogOverlay, resizableOverlay } from '@vaadin/dialog/src/vaadin-dialog-styles.js';
17
19
  import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
18
20
  import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
19
- import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
21
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
20
22
  import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
21
23
  import { crudDialogOverlayStyles } from './vaadin-crud-styles.js';
22
24
 
23
- registerStyles(
24
- 'vaadin-crud-dialog-overlay',
25
- [overlayStyles, dialogOverlay, resizableOverlay, crudDialogOverlayStyles],
26
- {
27
- moduleId: 'vaadin-crud-dialog-overlay-styles',
28
- },
29
- );
30
-
31
25
  /**
32
26
  * An element used internally by `<vaadin-crud>`. Not intended to be used separately.
33
27
  *
@@ -38,14 +32,19 @@ registerStyles(
38
32
  * @mixes ThemableMixin
39
33
  * @private
40
34
  */
41
- class CrudDialogOverlay extends OverlayMixin(DirMixin(ThemableMixin(PolymerElement))) {
35
+ class CrudDialogOverlay extends OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))) {
42
36
  static get is() {
43
37
  return 'vaadin-crud-dialog-overlay';
44
38
  }
45
39
 
46
- static get template() {
40
+ static get styles() {
41
+ return [overlayStyles, dialogOverlay, resizableOverlay, crudDialogOverlayStyles];
42
+ }
43
+
44
+ /** @protected */
45
+ render() {
47
46
  return html`
48
- <div part="backdrop" id="backdrop" hidden$="[[!withBackdrop]]"></div>
47
+ <div part="backdrop" id="backdrop" ?hidden="${!this.withBackdrop}"></div>
49
48
  <div part="overlay" id="overlay" tabindex="0">
50
49
  <section id="resizerContainer" class="resizer-container">
51
50
  <header part="header"><slot name="header"></slot></header>
@@ -81,11 +80,19 @@ defineCustomElement(CrudDialogOverlay);
81
80
  * An element used internally by `<vaadin-crud>`. Not intended to be used separately.
82
81
  * @private
83
82
  */
84
- class CrudDialog extends DialogBaseMixin(OverlayClassMixin(ThemePropertyMixin(PolymerElement))) {
83
+ class CrudDialog extends DialogBaseMixin(OverlayClassMixin(ThemePropertyMixin(PolylitMixin(LitElement)))) {
85
84
  static get is() {
86
85
  return 'vaadin-crud-dialog';
87
86
  }
88
87
 
88
+ static get styles() {
89
+ return css`
90
+ :host {
91
+ display: none;
92
+ }
93
+ `;
94
+ }
95
+
89
96
  static get properties() {
90
97
  return {
91
98
  ariaLabel: {
@@ -98,26 +105,20 @@ class CrudDialog extends DialogBaseMixin(OverlayClassMixin(ThemePropertyMixin(Po
98
105
  };
99
106
  }
100
107
 
101
- static get template() {
108
+ /** @protected */
109
+ render() {
102
110
  return html`
103
- <style>
104
- :host {
105
- display: none;
106
- }
107
- </style>
108
-
109
111
  <vaadin-crud-dialog-overlay
110
112
  id="overlay"
111
- opened="[[opened]]"
112
- aria-label$="[[ariaLabel]]"
113
- on-opened-changed="_onOverlayOpened"
114
- on-mousedown="_bringOverlayToFront"
115
- on-touchstart="_bringOverlayToFront"
116
- theme$="[[_theme]]"
117
- modeless="[[modeless]]"
118
- with-backdrop="[[!modeless]]"
119
- resizable$="[[resizable]]"
120
- fullscreen$="[[fullscreen]]"
113
+ .opened="${this.opened}"
114
+ aria-label="${ifDefined(this.ariaLabel)}"
115
+ @opened-changed="${this._onOverlayOpened}"
116
+ @mousedown="${this._bringOverlayToFront}"
117
+ @touchstart="${this._bringOverlayToFront}"
118
+ theme="${ifDefined(this._theme)}"
119
+ .modeless="${this.modeless}"
120
+ .withBackdrop="${!this.modeless}"
121
+ ?fullscreen="${this.fullscreen}"
121
122
  role="dialog"
122
123
  focus-trap
123
124
  ></vaadin-crud-dialog-overlay>
@@ -18,7 +18,7 @@ import { GridColumn } from '@vaadin/grid/src/vaadin-grid-column.js';
18
18
  *
19
19
  * #### Example:
20
20
  * ```html
21
- * <vaadin-grid items="[[items]]">
21
+ * <vaadin-grid>
22
22
  * <vaadin-crud-edit-column></vaadin-crud-edit-column>
23
23
  *
24
24
  * <vaadin-grid-column>
@@ -21,7 +21,7 @@ import { editColumnDefaultRenderer } from './vaadin-crud-helpers.js';
21
21
  *
22
22
  * #### Example:
23
23
  * ```html
24
- * <vaadin-grid items="[[items]]">
24
+ * <vaadin-grid>
25
25
  * <vaadin-crud-edit-column></vaadin-crud-edit-column>
26
26
  *
27
27
  * <vaadin-grid-column>
@@ -8,24 +8,9 @@
8
8
  * See https://vaadin.com/commercial-license-and-service-terms for the full
9
9
  * license.
10
10
  */
11
- import { html } from '@polymer/polymer/polymer-element.js';
11
+ import { css, html } from 'lit';
12
12
  import { Button } from '@vaadin/button/src/vaadin-button.js';
13
13
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
14
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
15
-
16
- /**
17
- * Use registerStyles instead of the `<style>` tag to make sure
18
- * that this CSS will override core styles of `vaadin-button`.
19
- */
20
- registerStyles(
21
- 'vaadin-crud-edit',
22
- css`
23
- :host {
24
- display: block;
25
- }
26
- `,
27
- { moduleId: 'vaadin-crud-edit-styles' },
28
- );
29
14
 
30
15
  /**
31
16
  * `<vaadin-crud-edit>` is a helper element for `<vaadin-grid-column>` that provides
@@ -40,17 +25,29 @@ registerStyles(
40
25
  * @mixes ThemableMixin
41
26
  */
42
27
  class CrudEdit extends Button {
43
- static get template() {
28
+ static get is() {
29
+ return 'vaadin-crud-edit';
30
+ }
31
+
32
+ static get styles() {
33
+ return [
34
+ super.styles,
35
+ css`
36
+ :host {
37
+ display: block;
38
+ }
39
+ `,
40
+ ];
41
+ }
42
+
43
+ /** @protected */
44
+ render() {
44
45
  return html`
45
46
  <div part="icon"></div>
46
47
  <slot name="tooltip"></slot>
47
48
  `;
48
49
  }
49
50
 
50
- static get is() {
51
- return 'vaadin-crud-edit';
52
- }
53
-
54
51
  /** @protected */
55
52
  ready() {
56
53
  super.ready();
@@ -33,7 +33,10 @@ class CrudForm extends IncludedMixin(FormLayout) {
33
33
  * The item being edited.
34
34
  * @type {unknown}
35
35
  */
36
- item: Object,
36
+ item: {
37
+ type: Object,
38
+ sync: true,
39
+ },
37
40
  };
38
41
  }
39
42
 
@@ -8,7 +8,7 @@
8
8
  * See https://vaadin.com/commercial-license-and-service-terms for the full
9
9
  * license.
10
10
  */
11
- import { get, set } from '@polymer/polymer/lib/utils/path.js';
11
+ import { get, set } from '@vaadin/component-base/src/path-utils.js';
12
12
 
13
13
  /**
14
14
  * Convenience utility for capitalizing a string, with
@@ -33,7 +33,7 @@ export function capitalize(path) {
33
33
  * @return {*}
34
34
  */
35
35
  export function getProperty(path, obj) {
36
- return get(obj, path);
36
+ return get(path, obj);
37
37
  }
38
38
 
39
39
  /**
@@ -59,7 +59,7 @@ export function setProperty(path, value, obj) {
59
59
  return o[p];
60
60
  }, obj);
61
61
 
62
- set(obj, path, value);
62
+ set(path, value, obj);
63
63
  }
64
64
  }
65
65
 
@@ -8,7 +8,6 @@
8
8
  * See https://vaadin.com/commercial-license-and-service-terms for the full
9
9
  * license.
10
10
  */
11
- import { afterNextRender } from '@polymer/polymer/lib/utils/render-status.js';
12
11
  import { FocusRestorationController } from '@vaadin/a11y-base/src/focus-restoration-controller.js';
13
12
  import { I18nMixin } from '@vaadin/component-base/src/i18n-mixin.js';
14
13
  import { MediaQueryController } from '@vaadin/component-base/src/media-query-controller.js';
@@ -119,6 +118,7 @@ export const CrudMixin = (superClass) =>
119
118
  type: Array,
120
119
  notify: true,
121
120
  observer: '__itemsChanged',
121
+ sync: true,
122
122
  },
123
123
 
124
124
  /**
@@ -384,6 +384,13 @@ export const CrudMixin = (superClass) =>
384
384
  this.$.dialog.$.overlay.addEventListener('vaadin-overlay-outside-click', this.__cancel);
385
385
  this.$.dialog.$.overlay.addEventListener('vaadin-overlay-escape-press', this.__cancel);
386
386
 
387
+ this._gridController = new GridSlotController(this);
388
+ this.addController(this._gridController);
389
+
390
+ // Init button controllers in `ready()` (not constructor) so that Flow can set `_noDefaultButtons`
391
+ this._newButtonController = new ButtonSlotController(this, 'new', 'primary', this._noDefaultButtons);
392
+ this.addController(this._newButtonController);
393
+
387
394
  this._headerController = new SlotController(this, 'header', 'h3', {
388
395
  initializer: (node) => {
389
396
  this._defaultHeader = node;
@@ -391,19 +398,12 @@ export const CrudMixin = (superClass) =>
391
398
  });
392
399
  this.addController(this._headerController);
393
400
 
394
- this._gridController = new GridSlotController(this);
395
- this.addController(this._gridController);
396
-
397
401
  this.addController(new FormSlotController(this));
398
402
 
399
- // Init controllers in `ready()` (not constructor) so that Flow can set `_noDefaultButtons`
400
- this._newButtonController = new ButtonSlotController(this, 'new', 'primary', this._noDefaultButtons);
401
403
  this._saveButtonController = new ButtonSlotController(this, 'save', 'primary', this._noDefaultButtons);
402
404
  this._cancelButtonController = new ButtonSlotController(this, 'cancel', 'tertiary', this._noDefaultButtons);
403
405
  this._deleteButtonController = new ButtonSlotController(this, 'delete', 'tertiary error', this._noDefaultButtons);
404
406
 
405
- this.addController(this._newButtonController);
406
-
407
407
  // NOTE: order in which buttons are added should match the order of slots in template
408
408
  this.addController(this._saveButtonController);
409
409
  this.addController(this._cancelButtonController);
@@ -450,7 +450,7 @@ export const CrudMixin = (superClass) =>
450
450
  return;
451
451
  }
452
452
 
453
- afterNextRender(grid, () => {
453
+ queueMicrotask(() => {
454
454
  Array.from(grid.querySelectorAll('vaadin-crud-edit-column')).forEach((column) => {
455
455
  column.ariaLabel = effectiveI18n.editLabel;
456
456
  });
@@ -484,6 +484,9 @@ export const CrudMixin = (superClass) =>
484
484
  } else {
485
485
  this.$.editor.removeAttribute('tabindex');
486
486
  }
487
+ } else if (oldOpened) {
488
+ // Teleport form and buttons back to light DOM when closing overlay
489
+ this.__moveChildNodes(this);
487
490
  }
488
491
 
489
492
  this.__toggleToolbar();
@@ -522,7 +525,10 @@ export const CrudMixin = (superClass) =>
522
525
  // Teleport header node, form, and the buttons to corresponding slots.
523
526
  // NOTE: order in which buttons are moved matches the order of slots.
524
527
  [...nodes, ...buttons].forEach((node) => {
525
- target.appendChild(node);
528
+ // Do not move nodes if the editor position has not changed
529
+ if (node.parentNode !== target) {
530
+ target.appendChild(node);
531
+ }
526
532
  });
527
533
 
528
534
  // Wait to set label until slotted element has been moved.
@@ -8,7 +8,6 @@
8
8
  * See https://vaadin.com/commercial-license-and-service-terms for the full
9
9
  * license.
10
10
  */
11
- import type { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js';
12
11
  import type { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
13
12
  import type { GridDefaultItem } from '@vaadin/grid/src/vaadin-grid.js';
14
13
  import type { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
@@ -172,11 +171,7 @@ declare class Crud<Item = GridDefaultItem> extends HTMLElement {
172
171
  ): void;
173
172
  }
174
173
 
175
- interface Crud<Item = GridDefaultItem>
176
- extends ElementMixinClass,
177
- ThemableMixinClass,
178
- ControllerMixinClass,
179
- CrudMixinClass<Item> {}
174
+ interface Crud<Item = GridDefaultItem> extends ElementMixinClass, ThemableMixinClass, CrudMixinClass<Item> {}
180
175
 
181
176
  declare global {
182
177
  interface HTMLElementTagNameMap {
@@ -13,16 +13,15 @@ import '@vaadin/confirm-dialog/src/vaadin-confirm-dialog.js';
13
13
  import './vaadin-crud-dialog.js';
14
14
  import './vaadin-crud-grid.js';
15
15
  import './vaadin-crud-form.js';
16
- import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
17
- import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
16
+ import { html, LitElement } from 'lit';
17
+ import { ifDefined } from 'lit/directives/if-defined.js';
18
18
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
19
19
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
20
- import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
20
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
21
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
21
22
  import { CrudMixin } from './vaadin-crud-mixin.js';
22
23
  import { crudStyles } from './vaadin-crud-styles.js';
23
24
 
24
- registerStyles('vaadin-crud', crudStyles, { moduleId: 'vaadin-crud-styles' });
25
-
26
25
  /**
27
26
  * `<vaadin-crud>` is a Web Component for [CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete) operations.
28
27
  *
@@ -167,13 +166,17 @@ registerStyles('vaadin-crud', crudStyles, { moduleId: 'vaadin-crud-styles' });
167
166
  *
168
167
  * @customElement
169
168
  * @extends HTMLElement
170
- * @mixes ControllerMixin
171
169
  * @mixes ElementMixin
172
170
  * @mixes ThemableMixin
173
171
  * @mixes CrudMixin
174
172
  */
175
- class Crud extends CrudMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerElement)))) {
176
- static get template() {
173
+ class Crud extends CrudMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
174
+ static get styles() {
175
+ return crudStyles;
176
+ }
177
+
178
+ /** @protected */
179
+ render() {
177
180
  return html`
178
181
  <div id="container">
179
182
  <div id="main">
@@ -190,7 +193,7 @@ class Crud extends CrudMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
190
193
  id="editor"
191
194
  role="group"
192
195
  aria-labelledby="header"
193
- hidden$="[[__computeEditorHidden(editorOpened, _fullscreen, editorPosition)]]"
196
+ ?hidden="${this.__computeEditorHidden(this.editorOpened, this._fullscreen, this.editorPosition)}"
194
197
  >
195
198
  <div part="scroller" id="scroller">
196
199
  <div part="header" id="header">
@@ -209,36 +212,36 @@ class Crud extends CrudMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
209
212
 
210
213
  <vaadin-crud-dialog
211
214
  id="dialog"
212
- opened="[[__computeDialogOpened(editorOpened, _fullscreen, editorPosition)]]"
213
- fullscreen="[[_fullscreen]]"
214
- aria-label="[[__dialogAriaLabel]]"
215
- no-close-on-outside-click="[[__isDirty]]"
216
- no-close-on-esc="[[__isDirty]]"
217
- theme$="[[_theme]]"
218
- on-opened-changed="__onDialogOpened"
215
+ .opened="${this.__computeDialogOpened(this.editorOpened, this._fullscreen, this.editorPosition)}"
216
+ .fullscreen="${this._fullscreen}"
217
+ .ariaLabel="${this.__dialogAriaLabel}"
218
+ .noCloseOnOutsideClick="${this.__isDirty}"
219
+ .noCloseOnEsc="${this.__isDirty}"
220
+ theme="${ifDefined(this._theme)}"
221
+ @opened-changed="${this.__onDialogOpened}"
219
222
  ></vaadin-crud-dialog>
220
223
 
221
224
  <vaadin-confirm-dialog
222
- theme$="[[_theme]]"
225
+ theme="${ifDefined(this._theme)}"
223
226
  id="confirmCancel"
224
- on-confirm="__confirmCancel"
227
+ @confirm="${this.__confirmCancel}"
225
228
  cancel-button-visible
226
- confirm-text="[[__effectiveI18n.confirm.cancel.button.confirm]]"
227
- cancel-text="[[__effectiveI18n.confirm.cancel.button.dismiss]]"
228
- header="[[__effectiveI18n.confirm.cancel.title]]"
229
- message="[[__effectiveI18n.confirm.cancel.content]]"
229
+ .confirmText="${this.__effectiveI18n.confirm.cancel.button.confirm}"
230
+ .cancelText="${this.__effectiveI18n.confirm.cancel.button.dismiss}"
231
+ .header="${this.__effectiveI18n.confirm.cancel.title}"
232
+ .message="${this.__effectiveI18n.confirm.cancel.content}"
230
233
  confirm-theme="primary"
231
234
  ></vaadin-confirm-dialog>
232
235
 
233
236
  <vaadin-confirm-dialog
234
- theme$="[[_theme]]"
237
+ theme="${ifDefined(this._theme)}"
235
238
  id="confirmDelete"
236
- on-confirm="__confirmDelete"
239
+ @confirm="${this.__confirmDelete}"
237
240
  cancel-button-visible
238
- confirm-text="[[__effectiveI18n.confirm.delete.button.confirm]]"
239
- cancel-text="[[__effectiveI18n.confirm.delete.button.dismiss]]"
240
- header="[[__effectiveI18n.confirm.delete.title]]"
241
- message="[[__effectiveI18n.confirm.delete.content]]"
241
+ .confirmText="${this.__effectiveI18n.confirm.delete.button.confirm}"
242
+ .cancelText="${this.__effectiveI18n.confirm.delete.button.dismiss}"
243
+ .header="${this.__effectiveI18n.confirm.delete.title}"
244
+ .message="${this.__effectiveI18n.confirm.delete.content}"
242
245
  confirm-theme="primary error"
243
246
  ></vaadin-confirm-dialog>
244
247
  `;
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/crud",
4
- "version": "24.8.0-alpha9",
4
+ "version": "25.0.0-alpha2",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -34,7 +34,7 @@
34
34
  },
35
35
  {
36
36
  "name": "vaadin-crud-edit-column",
37
- "description": "`<vaadin-crud-edit-column>` is a helper element for the `<vaadin-grid>`\nthat provides a clickable and themable edit icon.\n\nTypical usage is in a custom `<vaadin-grid>` inside a `<vaadin-crud>`.\n\n#### Example:\n```html\n<vaadin-grid items=\"[[items]]\">\n <vaadin-crud-edit-column></vaadin-crud-edit-column>\n\n <vaadin-grid-column>\n ...\n```",
37
+ "description": "`<vaadin-crud-edit-column>` is a helper element for the `<vaadin-grid>`\nthat provides a clickable and themable edit icon.\n\nTypical usage is in a custom `<vaadin-grid>` inside a `<vaadin-crud>`.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-crud-edit-column></vaadin-crud-edit-column>\n\n <vaadin-grid-column>\n ...\n```",
38
38
  "attributes": [
39
39
  {
40
40
  "name": "resizable",
@@ -357,7 +357,7 @@
357
357
  },
358
358
  {
359
359
  "name": "vaadin-crud",
360
- "description": "`<vaadin-crud>` is a Web Component for [CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete) operations.\n\n### Quick Start\n\nAssign an array to the [`items`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha9/#/elements/vaadin-crud#property-items) property.\n\nA grid and an editor will be automatically generated and configured based on the data structure provided.\n\n```html\n<vaadin-crud></vaadin-crud>\n```\n```js\nconst crud = document.querySelector('vaadin-crud');\n\ncrud.items = [\n { name: 'John', surname: 'Lennon', role: 'singer' },\n { name: 'Ringo', surname: 'Starr', role: 'drums' },\n // ... more items\n];\n```\n\n### Data Provider Function\n\nOtherwise, you can provide a [`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha9/#/elements/vaadin-crud#property-dataProvider) function.\n\n```js\nconst crud = document.querySelector('vaadin-crud');\n\nconst users = [\n { name: 'John', surname: 'Lennon', role: 'singer' },\n { name: 'Ringo', surname: 'Starr', role: 'drums' },\n // ... more items\n];\n\ncrud.dataProvider = (params, callback) => {\n const chunk = users.slice(params.page * params.pageSize, params.page * params.pageSize + params.pageSize);\n callback(chunk, people.length);\n};\n```\n\nNOTE: The auto-generated editor only supports string types. If you need to handle special cases\ncustomizing the editor is discussed below.\n\n### Customization\n\nAlternatively you can fully configure the component by using `slot` names.\n\nSlot name | Description\n---------------|----------------\n`grid` | To replace the auto-generated grid with a custom one.\n`form` | To replace the auto-generated form.\n`save-button` | To replace the \"Save\" button.\n`cancel-button`| To replace the \"Cancel\" button.\n`delete-button`| To replace the \"Delete\" button.\n`toolbar` | To provide the toolbar content (by default, it's empty).\n`new-button` | To replace the \"New item\" button.\n\n#### Example:\n\n```html\n<vaadin-crud id=\"crud\">\n <vaadin-grid slot=\"grid\">\n <vaadin-crud-edit-column></vaadin-crud-edit-column>\n <vaadin-grid-column id=\"column1\"></vaadin-grid-column>\n <vaadin-grid-column id=\"column2\"></vaadin-grid-column>\n </vaadin-grid>\n\n <vaadin-form-layout slot=\"form\">\n <vaadin-text-field label=\"First\" path=\"name\"></vaadin-text-field>\n <vaadin-text-field label=\"Surname\" path=\"surname\"></vaadin-text-field>\n </vaadin-form-layout>\n\n <div slot=\"toolbar\">Total singers: 2</div>\n <button slot=\"new-button\">New singer</button>\n\n <button slot=\"save-button\">Save changes</button>\n <button slot=\"cancel-button\">Discard changes</button>\n <button slot=\"delete-button\">Delete singer</button>\n</vaadin-crud>\n```\n```js\nconst crud = document.querySelector('#crud');\n\nconst column1 = document.querySelector('#column1');\ncolumn1.headerRenderer = (root, column) => {\n root.textContent = 'Name';\n};\ncolumn1.renderer = (root, column, model) => {\n root.textContent = model.item.name;\n};\n\nconst column2 = document.querySelector('#column2');\ncolumn2.headerRenderer = (root, column) => {\n root.textContent = 'Surname';\n};\ncolumn2.renderer = (root, column, model) => {\n root.textContent = model.item.surname;\n};\n\ncrud.items = [\n { name: 'John', surname: 'Lennon', role: 'singer' },\n { name: 'Ringo', surname: 'Starr', role: 'drums' },\n // ... more items\n];\n```\n\n### Helpers\n\nThe following elements are used to auto-configure the grid and the editor\n- [`<vaadin-crud-edit-column>`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha9/#/elements/vaadin-crud-edit-column)\n- `<vaadin-crud-grid>` - can be replaced with custom [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha9/#/elements/vaadin-grid)\n- `<vaadin-crud-form>` - can be replaced with custom [`<vaadin-form-layout>`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha9/#/elements/vaadin-form-layout)\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------------|----------------\n`toolbar` | Toolbar container at the bottom. By default it contains the the `new` button\n\nThe following custom properties are available:\n\nCustom Property | Description | Default\n----------------|----------------\n--vaadin-crud-editor-max-height | max height of editor when opened on the bottom | 40%\n--vaadin-crud-editor-max-width | max width of editor when opened on the side | 40%\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
360
+ "description": "`<vaadin-crud>` is a Web Component for [CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete) operations.\n\n### Quick Start\n\nAssign an array to the [`items`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-crud#property-items) property.\n\nA grid and an editor will be automatically generated and configured based on the data structure provided.\n\n```html\n<vaadin-crud></vaadin-crud>\n```\n```js\nconst crud = document.querySelector('vaadin-crud');\n\ncrud.items = [\n { name: 'John', surname: 'Lennon', role: 'singer' },\n { name: 'Ringo', surname: 'Starr', role: 'drums' },\n // ... more items\n];\n```\n\n### Data Provider Function\n\nOtherwise, you can provide a [`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-crud#property-dataProvider) function.\n\n```js\nconst crud = document.querySelector('vaadin-crud');\n\nconst users = [\n { name: 'John', surname: 'Lennon', role: 'singer' },\n { name: 'Ringo', surname: 'Starr', role: 'drums' },\n // ... more items\n];\n\ncrud.dataProvider = (params, callback) => {\n const chunk = users.slice(params.page * params.pageSize, params.page * params.pageSize + params.pageSize);\n callback(chunk, people.length);\n};\n```\n\nNOTE: The auto-generated editor only supports string types. If you need to handle special cases\ncustomizing the editor is discussed below.\n\n### Customization\n\nAlternatively you can fully configure the component by using `slot` names.\n\nSlot name | Description\n---------------|----------------\n`grid` | To replace the auto-generated grid with a custom one.\n`form` | To replace the auto-generated form.\n`save-button` | To replace the \"Save\" button.\n`cancel-button`| To replace the \"Cancel\" button.\n`delete-button`| To replace the \"Delete\" button.\n`toolbar` | To provide the toolbar content (by default, it's empty).\n`new-button` | To replace the \"New item\" button.\n\n#### Example:\n\n```html\n<vaadin-crud id=\"crud\">\n <vaadin-grid slot=\"grid\">\n <vaadin-crud-edit-column></vaadin-crud-edit-column>\n <vaadin-grid-column id=\"column1\"></vaadin-grid-column>\n <vaadin-grid-column id=\"column2\"></vaadin-grid-column>\n </vaadin-grid>\n\n <vaadin-form-layout slot=\"form\">\n <vaadin-text-field label=\"First\" path=\"name\"></vaadin-text-field>\n <vaadin-text-field label=\"Surname\" path=\"surname\"></vaadin-text-field>\n </vaadin-form-layout>\n\n <div slot=\"toolbar\">Total singers: 2</div>\n <button slot=\"new-button\">New singer</button>\n\n <button slot=\"save-button\">Save changes</button>\n <button slot=\"cancel-button\">Discard changes</button>\n <button slot=\"delete-button\">Delete singer</button>\n</vaadin-crud>\n```\n```js\nconst crud = document.querySelector('#crud');\n\nconst column1 = document.querySelector('#column1');\ncolumn1.headerRenderer = (root, column) => {\n root.textContent = 'Name';\n};\ncolumn1.renderer = (root, column, model) => {\n root.textContent = model.item.name;\n};\n\nconst column2 = document.querySelector('#column2');\ncolumn2.headerRenderer = (root, column) => {\n root.textContent = 'Surname';\n};\ncolumn2.renderer = (root, column, model) => {\n root.textContent = model.item.surname;\n};\n\ncrud.items = [\n { name: 'John', surname: 'Lennon', role: 'singer' },\n { name: 'Ringo', surname: 'Starr', role: 'drums' },\n // ... more items\n];\n```\n\n### Helpers\n\nThe following elements are used to auto-configure the grid and the editor\n- [`<vaadin-crud-edit-column>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-crud-edit-column)\n- `<vaadin-crud-grid>` - can be replaced with custom [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-grid)\n- `<vaadin-crud-form>` - can be replaced with custom [`<vaadin-form-layout>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-form-layout)\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------------|----------------\n`toolbar` | Toolbar container at the bottom. By default it contains the the `new` button\n\nThe following custom properties are available:\n\nCustom Property | Description | Default\n----------------|----------------\n--vaadin-crud-editor-max-height | max height of editor when opened on the bottom | 40%\n--vaadin-crud-editor-max-width | max width of editor when opened on the side | 40%\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
361
361
  "attributes": [
362
362
  {
363
363
  "name": "i18n",
@@ -421,7 +421,7 @@
421
421
  },
422
422
  {
423
423
  "name": "include",
424
- "description": "A comma-separated list of fields to include in the generated grid and the generated editor.\n\nIt can be used to explicitly define the field order.\n\nWhen it is defined [`exclude`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha9/#/elements/vaadin-crud#property-exclude) is ignored.\n\nDefault is undefined meaning that all properties in the object should be mapped to fields.",
424
+ "description": "A comma-separated list of fields to include in the generated grid and the generated editor.\n\nIt can be used to explicitly define the field order.\n\nWhen it is defined [`exclude`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-crud#property-exclude) is ignored.\n\nDefault is undefined meaning that all properties in the object should be mapped to fields.",
425
425
  "value": {
426
426
  "type": [
427
427
  "string",
@@ -432,7 +432,7 @@
432
432
  },
433
433
  {
434
434
  "name": "exclude",
435
- "description": "A comma-separated list of fields to be excluded from the generated grid and the generated editor.\n\nWhen [`include`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha9/#/elements/vaadin-crud#property-include) is defined, this parameter is ignored.\n\nDefault is to exclude all private fields (those properties starting with underscore)",
435
+ "description": "A comma-separated list of fields to be excluded from the generated grid and the generated editor.\n\nWhen [`include`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-crud#property-include) is defined, this parameter is ignored.\n\nDefault is to exclude all private fields (those properties starting with underscore)",
436
436
  "value": {
437
437
  "type": [
438
438
  "string",
@@ -568,7 +568,7 @@
568
568
  },
569
569
  {
570
570
  "name": "include",
571
- "description": "A comma-separated list of fields to include in the generated grid and the generated editor.\n\nIt can be used to explicitly define the field order.\n\nWhen it is defined [`exclude`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha9/#/elements/vaadin-crud#property-exclude) is ignored.\n\nDefault is undefined meaning that all properties in the object should be mapped to fields.",
571
+ "description": "A comma-separated list of fields to include in the generated grid and the generated editor.\n\nIt can be used to explicitly define the field order.\n\nWhen it is defined [`exclude`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-crud#property-exclude) is ignored.\n\nDefault is undefined meaning that all properties in the object should be mapped to fields.",
572
572
  "value": {
573
573
  "type": [
574
574
  "string",
@@ -579,7 +579,7 @@
579
579
  },
580
580
  {
581
581
  "name": "exclude",
582
- "description": "A comma-separated list of fields to be excluded from the generated grid and the generated editor.\n\nWhen [`include`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha9/#/elements/vaadin-crud#property-include) is defined, this parameter is ignored.\n\nDefault is to exclude all private fields (those properties starting with underscore)",
582
+ "description": "A comma-separated list of fields to be excluded from the generated grid and the generated editor.\n\nWhen [`include`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-crud#property-include) is defined, this parameter is ignored.\n\nDefault is to exclude all private fields (those properties starting with underscore)",
583
583
  "value": {
584
584
  "type": [
585
585
  "string",