@vaadin/crud 24.6.5 → 24.7.0-alpha10

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 (44) hide show
  1. package/package.json +17 -16
  2. package/src/vaadin-crud-controllers.d.ts +1 -1
  3. package/src/vaadin-crud-controllers.js +1 -1
  4. package/src/vaadin-crud-dialog.js +1 -1
  5. package/src/vaadin-crud-edit-column.d.ts +1 -1
  6. package/src/vaadin-crud-edit-column.js +4 -16
  7. package/src/vaadin-crud-edit.d.ts +1 -1
  8. package/src/vaadin-crud-edit.js +1 -1
  9. package/src/vaadin-crud-form.d.ts +1 -1
  10. package/src/vaadin-crud-form.js +4 -23
  11. package/src/vaadin-crud-grid-mixin.d.ts +7 -1
  12. package/src/vaadin-crud-grid-mixin.js +9 -3
  13. package/src/vaadin-crud-grid.d.ts +1 -1
  14. package/src/vaadin-crud-grid.js +1 -1
  15. package/src/vaadin-crud-helpers.d.ts +1 -1
  16. package/src/vaadin-crud-helpers.js +45 -1
  17. package/src/vaadin-crud-include-mixin.d.ts +1 -1
  18. package/src/vaadin-crud-include-mixin.js +3 -1
  19. package/src/vaadin-crud-mixin.d.ts +8 -7
  20. package/src/vaadin-crud-mixin.js +110 -99
  21. package/src/vaadin-crud-styles.d.ts +1 -1
  22. package/src/vaadin-crud-styles.js +1 -1
  23. package/src/vaadin-crud.d.ts +1 -1
  24. package/src/vaadin-crud.js +9 -9
  25. package/src/vaadin-lit-crud-dialog.d.ts +11 -0
  26. package/src/vaadin-lit-crud-dialog.js +128 -0
  27. package/src/vaadin-lit-crud-edit-column.d.ts +11 -0
  28. package/src/vaadin-lit-crud-edit-column.js +70 -0
  29. package/src/vaadin-lit-crud-edit.d.ts +11 -0
  30. package/src/vaadin-lit-crud-edit.js +75 -0
  31. package/src/vaadin-lit-crud-form.d.ts +11 -0
  32. package/src/vaadin-lit-crud-form.js +80 -0
  33. package/src/vaadin-lit-crud-grid.d.ts +11 -0
  34. package/src/vaadin-lit-crud-grid.js +35 -0
  35. package/src/vaadin-lit-crud.js +122 -0
  36. package/theme/lumo/vaadin-lit-crud.d.ts +8 -0
  37. package/theme/lumo/vaadin-lit-crud.js +8 -0
  38. package/theme/material/vaadin-lit-crud.d.ts +8 -0
  39. package/theme/material/vaadin-lit-crud.js +8 -0
  40. package/vaadin-lit-crud-edit .js +1 -0
  41. package/vaadin-lit-crud-edit-column.js +1 -0
  42. package/vaadin-lit-crud.js +2 -0
  43. package/web-types.json +15 -15
  44. package/web-types.lit.json +11 -11
@@ -0,0 +1,75 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+
12
+ import { html } from 'lit';
13
+ import { Button } from '@vaadin/button/src/vaadin-lit-button.js';
14
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
15
+ import { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
16
+
17
+ /**
18
+ * LitElement based version of `<vaadin-crud-edit>` web component.
19
+ *
20
+ * ## Disclaimer
21
+ *
22
+ * This component is an experiment and not yet a part of Vaadin platform.
23
+ * There is no ETA regarding specific Vaadin version where it'll land.
24
+ */
25
+ class CrudEdit extends Button {
26
+ static get is() {
27
+ return 'vaadin-crud-edit';
28
+ }
29
+
30
+ static get styles() {
31
+ return [
32
+ super.styles,
33
+ css`
34
+ :host {
35
+ display: block;
36
+ }
37
+ `,
38
+ ];
39
+ }
40
+
41
+ /** @protected */
42
+ render() {
43
+ return html`
44
+ <div part="icon"></div>
45
+ <slot name="tooltip"></slot>
46
+ `;
47
+ }
48
+
49
+ /** @protected */
50
+ ready() {
51
+ super.ready();
52
+ this.addEventListener('click', this.__onClick);
53
+ this.setAttribute('aria-label', 'Edit');
54
+ }
55
+
56
+ /** @private */
57
+ __onClick(e) {
58
+ const tr = e.target.parentElement.assignedSlot.parentElement.parentElement;
59
+ tr.dispatchEvent(
60
+ new CustomEvent('edit', { detail: { item: tr._item, index: tr.index }, bubbles: true, composed: true }),
61
+ );
62
+ }
63
+
64
+ /**
65
+ * Fired when user on the icon.
66
+ *
67
+ * @event edit
68
+ * @param {Object} detail.item the item to edit
69
+ * @param {Object} detail.index the index of the item in the data set
70
+ */
71
+ }
72
+
73
+ defineCustomElement(CrudEdit);
74
+
75
+ export { CrudEdit };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ export * from './vaadin-crud-form.js';
@@ -0,0 +1,80 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ import '@vaadin/text-field/src/vaadin-lit-text-field.js';
12
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
13
+ import { FormLayout } from '@vaadin/form-layout/src/vaadin-lit-form-layout.js';
14
+ import { createField, createFields } from './vaadin-crud-helpers.js';
15
+ import { IncludedMixin } from './vaadin-crud-include-mixin.js';
16
+
17
+ /**
18
+ * An element used internally by `<vaadin-crud>`. Not intended to be used separately.
19
+ *
20
+ * @extends FormLayout
21
+ * @mixes IncludedMixin
22
+ * @private
23
+ */
24
+ class CrudForm extends IncludedMixin(FormLayout) {
25
+ static get is() {
26
+ return 'vaadin-crud-form';
27
+ }
28
+
29
+ static get properties() {
30
+ return {
31
+ /**
32
+ * The item being edited.
33
+ * @type {unknown}
34
+ */
35
+ item: {
36
+ type: Object,
37
+ sync: true,
38
+ },
39
+ };
40
+ }
41
+
42
+ static get observers() {
43
+ return ['__onItemChange(item)'];
44
+ }
45
+
46
+ /**
47
+ * Auto-generate form fields based on the JSON structure of the object provided.
48
+ *
49
+ * If not called, the method will be executed the first time an item is assigned.
50
+ * @param {unknown} object
51
+ * @protected
52
+ */
53
+ _configure(object) {
54
+ this.innerHTML = '';
55
+ this._fields = [];
56
+ this.__createFields(this, object);
57
+ this._updateLayout();
58
+ }
59
+
60
+ /** @private */
61
+ __onItemChange(item) {
62
+ if (!this._fields) {
63
+ this._configure(item);
64
+ }
65
+ }
66
+
67
+ /** @private */
68
+ __createField(parent, path) {
69
+ return createField(this, parent, path);
70
+ }
71
+
72
+ /** @private */
73
+ __createFields(parent, object, path) {
74
+ return createFields(this, parent, object, path);
75
+ }
76
+ }
77
+
78
+ defineCustomElement(CrudForm);
79
+
80
+ export { CrudForm };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ export * from './vaadin-crud-grid.js';
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ import '@vaadin/grid/src/vaadin-lit-grid-column-group.js';
12
+ import '@vaadin/grid/src/vaadin-lit-grid-column.js';
13
+ import '@vaadin/grid/src/vaadin-lit-grid-filter.js';
14
+ import '@vaadin/grid/src/vaadin-lit-grid-sorter.js';
15
+ import './vaadin-lit-crud-edit-column.js';
16
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
17
+ import { Grid } from '@vaadin/grid/src/vaadin-lit-grid.js';
18
+ import { CrudGridMixin } from './vaadin-crud-grid-mixin.js';
19
+
20
+ /**
21
+ * An element used internally by `<vaadin-crud>`. Not intended to be used separately.
22
+ *
23
+ * @extends Grid
24
+ * @mixes CrudGridMixin
25
+ * @private
26
+ */
27
+ class CrudGrid extends CrudGridMixin(Grid) {
28
+ static get is() {
29
+ return 'vaadin-crud-grid';
30
+ }
31
+ }
32
+
33
+ defineCustomElement(CrudGrid);
34
+
35
+ export { CrudGrid };
@@ -0,0 +1,122 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ import '@vaadin/button/src/vaadin-lit-button.js';
12
+ import '@vaadin/confirm-dialog/src/vaadin-lit-confirm-dialog.js';
13
+ import './vaadin-lit-crud-dialog.js';
14
+ import './vaadin-lit-crud-grid.js';
15
+ import './vaadin-lit-crud-form.js';
16
+ import { html, LitElement } from 'lit';
17
+ import { ifDefined } from 'lit/directives/if-defined.js';
18
+ import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
19
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
20
+ import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
21
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
22
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
23
+ import { CrudMixin } from './vaadin-crud-mixin.js';
24
+ import { crudStyles } from './vaadin-crud-styles.js';
25
+
26
+ /**
27
+ * LitElement based version of `<vaadin-crud>` web component.
28
+ *
29
+ * ## Disclaimer
30
+ *
31
+ * This component is an experiment and not yet a part of Vaadin platform.
32
+ * There is no ETA regarding specific Vaadin version where it'll land.
33
+ */
34
+ class Crud extends ControllerMixin(ElementMixin(ThemableMixin(CrudMixin(PolylitMixin(LitElement))))) {
35
+ static get styles() {
36
+ return crudStyles;
37
+ }
38
+
39
+ /** @protected */
40
+ render() {
41
+ return html`
42
+ <div id="container">
43
+ <div id="main">
44
+ <slot name="grid"></slot>
45
+
46
+ <div id="toolbar" part="toolbar">
47
+ <slot name="toolbar"></slot>
48
+ <slot name="new-button"></slot>
49
+ </div>
50
+ </div>
51
+
52
+ <div
53
+ part="editor"
54
+ id="editor"
55
+ role="group"
56
+ aria-labelledby="header"
57
+ ?hidden="${this.__computeEditorHidden(this.editorOpened, this._fullscreen, this.editorPosition)}"
58
+ >
59
+ <div part="scroller" id="scroller">
60
+ <div part="header" id="header">
61
+ <slot name="header"></slot>
62
+ </div>
63
+ <slot name="form"></slot>
64
+ </div>
65
+
66
+ <div part="footer" role="toolbar">
67
+ <slot name="save-button"></slot>
68
+ <slot name="cancel-button"></slot>
69
+ <slot name="delete-button"></slot>
70
+ </div>
71
+ </div>
72
+ </div>
73
+
74
+ <vaadin-crud-dialog
75
+ id="dialog"
76
+ .opened="${this.__computeDialogOpened(this.editorOpened, this._fullscreen, this.editorPosition)}"
77
+ .fullscreen="${this._fullscreen}"
78
+ .ariaLabel="${this.__dialogAriaLabel}"
79
+ .noCloseOnOutsideClick="${this.__isDirty}"
80
+ .noCloseOnEsc="${this.__isDirty}"
81
+ theme="${ifDefined(this._theme)}"
82
+ @opened-changed="${this.__onDialogOpened}"
83
+ ></vaadin-crud-dialog>
84
+
85
+ <vaadin-confirm-dialog
86
+ theme="${ifDefined(this._theme)}"
87
+ id="confirmCancel"
88
+ @confirm="${this.__confirmCancel}"
89
+ cancel-button-visible
90
+ .confirmText="${this.__effectiveI18n.confirm.cancel.button.confirm}"
91
+ .cancelText="${this.__effectiveI18n.confirm.cancel.button.dismiss}"
92
+ .header="${this.__effectiveI18n.confirm.cancel.title}"
93
+ .message="${this.__effectiveI18n.confirm.cancel.content}"
94
+ confirm-theme="primary"
95
+ ></vaadin-confirm-dialog>
96
+
97
+ <vaadin-confirm-dialog
98
+ theme="${ifDefined(this._theme)}"
99
+ id="confirmDelete"
100
+ @confirm="${this.__confirmDelete}"
101
+ cancel-button-visible
102
+ .confirmText="${this.__effectiveI18n.confirm.delete.button.confirm}"
103
+ .cancelText="${this.__effectiveI18n.confirm.delete.button.dismiss}"
104
+ .header="${this.__effectiveI18n.confirm.delete.title}"
105
+ .message="${this.__effectiveI18n.confirm.delete.content}"
106
+ confirm-theme="primary error"
107
+ ></vaadin-confirm-dialog>
108
+ `;
109
+ }
110
+
111
+ static get is() {
112
+ return 'vaadin-crud';
113
+ }
114
+
115
+ static get cvdlName() {
116
+ return 'vaadin-crud';
117
+ }
118
+ }
119
+
120
+ defineCustomElement(Crud);
121
+
122
+ export { Crud };
@@ -0,0 +1,8 @@
1
+ import '@vaadin/button/theme/lumo/vaadin-lit-button.js';
2
+ import '@vaadin/confirm-dialog/theme/lumo/vaadin-lit-confirm-dialog.js';
3
+ import '@vaadin/form-layout/theme/lumo/vaadin-lit-form-layout.js';
4
+ import '@vaadin/grid/theme/lumo/vaadin-lit-grid.js';
5
+ import '@vaadin/grid/theme/lumo/vaadin-lit-grid-sorter.js';
6
+ import '@vaadin/text-field/theme/lumo/vaadin-lit-text-field.js';
7
+ import './vaadin-crud-styles.js';
8
+ import '../../src/vaadin-lit-crud.js';
@@ -0,0 +1,8 @@
1
+ import '@vaadin/button/theme/lumo/vaadin-lit-button.js';
2
+ import '@vaadin/confirm-dialog/theme/lumo/vaadin-lit-confirm-dialog.js';
3
+ import '@vaadin/form-layout/theme/lumo/vaadin-lit-form-layout.js';
4
+ import '@vaadin/grid/theme/lumo/vaadin-lit-grid.js';
5
+ import '@vaadin/grid/theme/lumo/vaadin-lit-grid-sorter.js';
6
+ import '@vaadin/text-field/theme/lumo/vaadin-lit-text-field.js';
7
+ import './vaadin-crud-styles.js';
8
+ import '../../src/vaadin-lit-crud.js';
@@ -0,0 +1,8 @@
1
+ import '@vaadin/button/theme/material/vaadin-lit-button.js';
2
+ import '@vaadin/confirm-dialog/theme/material/vaadin-lit-confirm-dialog.js';
3
+ import '@vaadin/form-layout/theme/material/vaadin-lit-form-layout.js';
4
+ import '@vaadin/grid/theme/material/vaadin-lit-grid.js';
5
+ import '@vaadin/grid/theme/material/vaadin-lit-grid-sorter.js';
6
+ import '@vaadin/text-field/theme/material/vaadin-lit-text-field.js';
7
+ import './vaadin-crud-styles.js';
8
+ import '../../src/vaadin-lit-crud.js';
@@ -0,0 +1,8 @@
1
+ import '@vaadin/button/theme/material/vaadin-lit-button.js';
2
+ import '@vaadin/confirm-dialog/theme/material/vaadin-lit-confirm-dialog.js';
3
+ import '@vaadin/form-layout/theme/material/vaadin-lit-form-layout.js';
4
+ import '@vaadin/grid/theme/material/vaadin-lit-grid.js';
5
+ import '@vaadin/grid/theme/material/vaadin-lit-grid-sorter.js';
6
+ import '@vaadin/text-field/theme/material/vaadin-lit-text-field.js';
7
+ import './vaadin-crud-styles.js';
8
+ import '../../src/vaadin-lit-crud.js';
@@ -0,0 +1 @@
1
+ export * from './src/vaadin-lit-crud-edit.js';
@@ -0,0 +1 @@
1
+ export * from './src/vaadin-lit-crud-edit-column.js';
@@ -0,0 +1,2 @@
1
+ import './theme/lumo/vaadin-lit-crud.js';
2
+ export * from './src/vaadin-lit-crud.js';
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.6.5",
4
+ "version": "24.7.0-alpha10",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -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.6.5/#/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.6.5/#/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.6.5/#/elements/vaadin-crud-edit-column)\n- `<vaadin-crud-grid>` - can be replaced with custom [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/24.6.5/#/elements/vaadin-grid)\n- `<vaadin-crud-form>` - can be replaced with custom [`<vaadin-form-layout>`](https://cdn.vaadin.com/vaadin-web-components/24.6.5/#/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/24.7.0-alpha10/#/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.7.0-alpha10/#/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.7.0-alpha10/#/elements/vaadin-crud-edit-column)\n- `<vaadin-crud-grid>` - can be replaced with custom [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha10/#/elements/vaadin-grid)\n- `<vaadin-crud-form>` - can be replaced with custom [`<vaadin-form-layout>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha10/#/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": "editor-position",
@@ -412,7 +412,7 @@
412
412
  },
413
413
  {
414
414
  "name": "include",
415
- "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.6.5/#/elements/vaadin-crud#property-exclude) is ignored.\n\nDefault is undefined meaning that all properties in the object should be mapped to fields.",
415
+ "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.7.0-alpha10/#/elements/vaadin-crud#property-exclude) is ignored.\n\nDefault is undefined meaning that all properties in the object should be mapped to fields.",
416
416
  "value": {
417
417
  "type": [
418
418
  "string",
@@ -423,7 +423,7 @@
423
423
  },
424
424
  {
425
425
  "name": "exclude",
426
- "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.6.5/#/elements/vaadin-crud#property-include) is defined, this parameter is ignored.\n\nDefault is to exclude all private fields (those properties starting with underscore)",
426
+ "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.7.0-alpha10/#/elements/vaadin-crud#property-include) is defined, this parameter is ignored.\n\nDefault is to exclude all private fields (those properties starting with underscore)",
427
427
  "value": {
428
428
  "type": [
429
429
  "string",
@@ -468,6 +468,15 @@
468
468
  ],
469
469
  "js": {
470
470
  "properties": [
471
+ {
472
+ "name": "i18n",
473
+ "description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following JSON structure and default values:\n\n```\n{\n newItem: 'New item',\n editItem: 'Edit item',\n saveItem: 'Save',\n cancel: 'Cancel',\n deleteItem: 'Delete...',\n editLabel: 'Edit',\n confirm: {\n delete: {\n title: 'Confirm delete',\n content: 'Are you sure you want to delete the selected item? This action cannot be undone.',\n button: {\n confirm: 'Delete',\n dismiss: 'Cancel'\n }\n },\n cancel: {\n title: 'Unsaved changes',\n content: 'There are unsaved modifications to the item.',\n button: {\n confirm: 'Discard',\n dismiss: 'Continue editing'\n }\n }\n }\n}\n```",
474
+ "value": {
475
+ "type": [
476
+ "CrudI18n"
477
+ ]
478
+ }
479
+ },
471
480
  {
472
481
  "name": "items",
473
482
  "description": "An array containing the items which will be stamped to the column template instances.",
@@ -550,7 +559,7 @@
550
559
  },
551
560
  {
552
561
  "name": "include",
553
- "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.6.5/#/elements/vaadin-crud#property-exclude) is ignored.\n\nDefault is undefined meaning that all properties in the object should be mapped to fields.",
562
+ "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.7.0-alpha10/#/elements/vaadin-crud#property-exclude) is ignored.\n\nDefault is undefined meaning that all properties in the object should be mapped to fields.",
554
563
  "value": {
555
564
  "type": [
556
565
  "string",
@@ -561,7 +570,7 @@
561
570
  },
562
571
  {
563
572
  "name": "exclude",
564
- "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.6.5/#/elements/vaadin-crud#property-include) is defined, this parameter is ignored.\n\nDefault is to exclude all private fields (those properties starting with underscore)",
573
+ "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.7.0-alpha10/#/elements/vaadin-crud#property-include) is defined, this parameter is ignored.\n\nDefault is to exclude all private fields (those properties starting with underscore)",
565
574
  "value": {
566
575
  "type": [
567
576
  "string",
@@ -591,15 +600,6 @@
591
600
  "undefined"
592
601
  ]
593
602
  }
594
- },
595
- {
596
- "name": "i18n",
597
- "description": "The object used to localize this component.\nFor changing the default localization, change the entire\n_i18n_ object or just the property you want to modify.\n\nThe object has the following JSON structure and default values:\n\n```\n{\n newItem: 'New item',\n editItem: 'Edit item',\n saveItem: 'Save',\n cancel: 'Cancel',\n deleteItem: 'Delete...',\n editLabel: 'Edit',\n confirm: {\n delete: {\n title: 'Confirm delete',\n content: 'Are you sure you want to delete the selected item? This action cannot be undone.',\n button: {\n confirm: 'Delete',\n dismiss: 'Cancel'\n }\n },\n cancel: {\n title: 'Unsaved changes',\n content: 'There are unsaved modifications to the item.',\n button: {\n confirm: 'Discard',\n dismiss: 'Continue editing'\n }\n }\n }\n}\n```",
598
- "value": {
599
- "type": [
600
- "CrudI18n"
601
- ]
602
- }
603
603
  }
604
604
  ],
605
605
  "events": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/crud",
4
- "version": "24.6.5",
4
+ "version": "24.7.0-alpha10",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -142,7 +142,7 @@
142
142
  },
143
143
  {
144
144
  "name": "vaadin-crud",
145
- "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.6.5/#/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.6.5/#/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.6.5/#/elements/vaadin-crud-edit-column)\n- `<vaadin-crud-grid>` - can be replaced with custom [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/24.6.5/#/elements/vaadin-grid)\n- `<vaadin-crud-form>` - can be replaced with custom [`<vaadin-form-layout>`](https://cdn.vaadin.com/vaadin-web-components/24.6.5/#/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.",
145
+ "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.7.0-alpha10/#/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.7.0-alpha10/#/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.7.0-alpha10/#/elements/vaadin-crud-edit-column)\n- `<vaadin-crud-grid>` - can be replaced with custom [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha10/#/elements/vaadin-grid)\n- `<vaadin-crud-form>` - can be replaced with custom [`<vaadin-form-layout>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha10/#/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.",
146
146
  "extension": true,
147
147
  "attributes": [
148
148
  {
@@ -187,6 +187,13 @@
187
187
  "kind": "expression"
188
188
  }
189
189
  },
190
+ {
191
+ "name": ".i18n",
192
+ "description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following JSON structure and default values:\n\n```\n{\n newItem: 'New item',\n editItem: 'Edit item',\n saveItem: 'Save',\n cancel: 'Cancel',\n deleteItem: 'Delete...',\n editLabel: 'Edit',\n confirm: {\n delete: {\n title: 'Confirm delete',\n content: 'Are you sure you want to delete the selected item? This action cannot be undone.',\n button: {\n confirm: 'Delete',\n dismiss: 'Cancel'\n }\n },\n cancel: {\n title: 'Unsaved changes',\n content: 'There are unsaved modifications to the item.',\n button: {\n confirm: 'Discard',\n dismiss: 'Continue editing'\n }\n }\n }\n}\n```",
193
+ "value": {
194
+ "kind": "expression"
195
+ }
196
+ },
190
197
  {
191
198
  "name": ".items",
192
199
  "description": "An array containing the items which will be stamped to the column template instances.",
@@ -217,21 +224,14 @@
217
224
  },
218
225
  {
219
226
  "name": ".include",
220
- "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.6.5/#/elements/vaadin-crud#property-exclude) is ignored.\n\nDefault is undefined meaning that all properties in the object should be mapped to fields.",
227
+ "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.7.0-alpha10/#/elements/vaadin-crud#property-exclude) is ignored.\n\nDefault is undefined meaning that all properties in the object should be mapped to fields.",
221
228
  "value": {
222
229
  "kind": "expression"
223
230
  }
224
231
  },
225
232
  {
226
233
  "name": ".exclude",
227
- "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.6.5/#/elements/vaadin-crud#property-include) is defined, this parameter is ignored.\n\nDefault is to exclude all private fields (those properties starting with underscore)",
228
- "value": {
229
- "kind": "expression"
230
- }
231
- },
232
- {
233
- "name": ".i18n",
234
- "description": "The object used to localize this component.\nFor changing the default localization, change the entire\n_i18n_ object or just the property you want to modify.\n\nThe object has the following JSON structure and default values:\n\n```\n{\n newItem: 'New item',\n editItem: 'Edit item',\n saveItem: 'Save',\n cancel: 'Cancel',\n deleteItem: 'Delete...',\n editLabel: 'Edit',\n confirm: {\n delete: {\n title: 'Confirm delete',\n content: 'Are you sure you want to delete the selected item? This action cannot be undone.',\n button: {\n confirm: 'Delete',\n dismiss: 'Cancel'\n }\n },\n cancel: {\n title: 'Unsaved changes',\n content: 'There are unsaved modifications to the item.',\n button: {\n confirm: 'Discard',\n dismiss: 'Continue editing'\n }\n }\n }\n}\n```",
234
+ "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.7.0-alpha10/#/elements/vaadin-crud#property-include) is defined, this parameter is ignored.\n\nDefault is to exclude all private fields (those properties starting with underscore)",
235
235
  "value": {
236
236
  "kind": "expression"
237
237
  }