@vaadin/crud 24.0.0-alpha6 → 24.0.0-alpha8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/crud",
3
- "version": "24.0.0-alpha6",
3
+ "version": "24.0.0-alpha8",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,16 +37,16 @@
37
37
  "dependencies": {
38
38
  "@open-wc/dedupe-mixin": "^1.3.0",
39
39
  "@polymer/polymer": "^3.0.0",
40
- "@vaadin/button": "24.0.0-alpha6",
41
- "@vaadin/component-base": "24.0.0-alpha6",
42
- "@vaadin/confirm-dialog": "24.0.0-alpha6",
43
- "@vaadin/dialog": "24.0.0-alpha6",
44
- "@vaadin/form-layout": "24.0.0-alpha6",
45
- "@vaadin/grid": "24.0.0-alpha6",
46
- "@vaadin/text-field": "24.0.0-alpha6",
47
- "@vaadin/vaadin-lumo-styles": "24.0.0-alpha6",
48
- "@vaadin/vaadin-material-styles": "24.0.0-alpha6",
49
- "@vaadin/vaadin-themable-mixin": "24.0.0-alpha6"
40
+ "@vaadin/button": "24.0.0-alpha8",
41
+ "@vaadin/component-base": "24.0.0-alpha8",
42
+ "@vaadin/confirm-dialog": "24.0.0-alpha8",
43
+ "@vaadin/dialog": "24.0.0-alpha8",
44
+ "@vaadin/form-layout": "24.0.0-alpha8",
45
+ "@vaadin/grid": "24.0.0-alpha8",
46
+ "@vaadin/text-field": "24.0.0-alpha8",
47
+ "@vaadin/vaadin-lumo-styles": "24.0.0-alpha8",
48
+ "@vaadin/vaadin-material-styles": "24.0.0-alpha8",
49
+ "@vaadin/vaadin-themable-mixin": "24.0.0-alpha8"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@esm-bundle/chai": "^4.3.4",
@@ -58,5 +58,5 @@
58
58
  "web-types.json",
59
59
  "web-types.lit.json"
60
60
  ],
61
- "gitHead": "0004ac92b6e5f415b5fa949e0582d1d11e527b1f"
61
+ "gitHead": "476752249bb12295c500980d98a3256ad3b22b73"
62
62
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2000 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2000 - 2023 Vaadin Ltd.
4
4
  *
5
5
  * This program is available under Vaadin Commercial License and Service Terms.
6
6
  *
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2000 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2000 - 2023 Vaadin Ltd.
4
4
  *
5
5
  * This program is available under Vaadin Commercial License and Service Terms.
6
6
  *
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2000 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2000 - 2023 Vaadin Ltd.
4
4
  *
5
5
  * This program is available under Vaadin Commercial License and Service Terms.
6
6
  *
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2000 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2000 - 2023 Vaadin Ltd.
4
4
  *
5
5
  * This program is available under Vaadin Commercial License and Service Terms.
6
6
  *
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2000 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2000 - 2023 Vaadin Ltd.
4
4
  *
5
5
  * This program is available under Vaadin Commercial License and Service Terms.
6
6
  *
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2000 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2000 - 2023 Vaadin Ltd.
4
4
  *
5
5
  * This program is available under Vaadin Commercial License and Service Terms.
6
6
  *
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2000 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2000 - 2023 Vaadin Ltd.
4
4
  *
5
5
  * This program is available under Vaadin Commercial License and Service Terms.
6
6
  *
@@ -10,6 +10,7 @@
10
10
  */
11
11
  import '@vaadin/text-field/src/vaadin-text-field.js';
12
12
  import { FormLayout } from '@vaadin/form-layout/src/vaadin-form-layout.js';
13
+ import { capitalize } from './vaadin-crud-helpers.js';
13
14
  import { IncludedMixin } from './vaadin-crud-include-mixin.js';
14
15
 
15
16
  /**
@@ -62,7 +63,7 @@ class CrudForm extends IncludedMixin(FormLayout) {
62
63
  /** @private */
63
64
  __createField(parent, path) {
64
65
  const field = document.createElement('vaadin-text-field');
65
- field.label = this.__capitalize(path);
66
+ field.label = capitalize(path);
66
67
  field.path = path;
67
68
  field.required = true;
68
69
  parent.appendChild(field);
@@ -87,29 +88,6 @@ class CrudForm extends IncludedMixin(FormLayout) {
87
88
  this._fields = undefined;
88
89
  }
89
90
  }
90
-
91
- /** @private */
92
- __capitalize(path) {
93
- return path
94
- .toLowerCase()
95
- .replace(/([^\w]+)/g, ' ')
96
- .trim()
97
- .replace(/^./, (c) => c.toUpperCase());
98
- }
99
-
100
- /** @private */
101
- __set(path, val, obj) {
102
- if (obj && path) {
103
- path
104
- .split('.')
105
- .slice(0, -1)
106
- .reduce((o, p) => {
107
- o[p] = o[p] || {};
108
- return o[p];
109
- }, obj);
110
- this.set(path, val, obj);
111
- }
112
- }
113
91
  }
114
92
 
115
93
  customElements.define(CrudForm.is, CrudForm);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2000 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2000 - 2023 Vaadin Ltd.
4
4
  *
5
5
  * This program is available under Vaadin Commercial License and Service Terms.
6
6
  *
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2000 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2000 - 2023 Vaadin Ltd.
4
4
  *
5
5
  * This program is available under Vaadin Commercial License and Service Terms.
6
6
  *
@@ -14,6 +14,7 @@ import '@vaadin/grid/src/vaadin-grid-sorter.js';
14
14
  import '@vaadin/grid/src/vaadin-grid-filter.js';
15
15
  import './vaadin-crud-edit-column.js';
16
16
  import { Grid } from '@vaadin/grid/src/vaadin-grid.js';
17
+ import { capitalize, getProperty } from './vaadin-crud-helpers.js';
17
18
  import { IncludedMixin } from './vaadin-crud-include-mixin.js';
18
19
 
19
20
  /**
@@ -148,10 +149,10 @@ class CrudGrid extends IncludedMixin(Grid) {
148
149
  _generateHeader(path) {
149
150
  return path
150
151
  .substr(path.lastIndexOf('.') + 1)
151
- .replace(/([A-Z])/g, '-$1')
152
+ .replace(/([A-Z])/gu, '-$1')
152
153
  .toLowerCase()
153
- .replace(/-/g, ' ')
154
- .replace(/^./, (match) => match.toUpperCase());
154
+ .replace(/-/gu, ' ')
155
+ .replace(/^./u, (match) => match.toUpperCase());
155
156
  }
156
157
 
157
158
  /** @private */
@@ -169,7 +170,7 @@ class CrudGrid extends IncludedMixin(Grid) {
169
170
  col = document.createElement('vaadin-grid-column');
170
171
  parent.appendChild(col);
171
172
  col.renderer = (root, _column, model) => {
172
- root.textContent = path ? this.get(path, model.item) : model.item;
173
+ root.textContent = path ? getProperty(path, model.item) : model.item;
173
174
  };
174
175
  }
175
176
 
@@ -267,34 +268,11 @@ class CrudGrid extends IncludedMixin(Grid) {
267
268
  __createGroup(parent, header) {
268
269
  const grp = document.createElement('vaadin-grid-column-group');
269
270
  if (header) {
270
- grp.header = this.__capitalize(header);
271
+ grp.header = capitalize(header);
271
272
  }
272
273
  parent.appendChild(grp);
273
274
  return grp;
274
275
  }
275
-
276
- /** @private */
277
- __capitalize(path) {
278
- return path
279
- .toLowerCase()
280
- .replace(/([^\w]+)/g, ' ')
281
- .trim()
282
- .replace(/^./, (c) => c.toUpperCase());
283
- }
284
-
285
- /** @private */
286
- __set(path, val, obj) {
287
- if (obj && path) {
288
- path
289
- .split('.')
290
- .slice(0, -1)
291
- .reduce((o, p) => {
292
- o[p] = o[p] || {};
293
- return o[p];
294
- }, obj);
295
- this.set(path, val, obj);
296
- }
297
- }
298
276
  }
299
277
 
300
278
  customElements.define(CrudGrid.is, CrudGrid);
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2023 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
+ /**
13
+ * Convenience utility for capitalizing a string, with
14
+ * replacing non-alphanumeric characters with spaces.
15
+ */
16
+ export function capitalize(path: string): string;
17
+
18
+ /**
19
+ * Convenience method for reading a value from a path.
20
+ */
21
+ export function getProperty(path: string, obj: Record<string, unknown>): unknown;
22
+
23
+ /**
24
+ * Convenience utility for setting a value to a path.
25
+ *
26
+ * Note, if any part in the path is undefined, this
27
+ * function initializes it with an empty object.
28
+ */
29
+ export function setProperty(path: string, value: unknown, obj: Record<string, unknown>): void;
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2023 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 { get, set } from '@polymer/polymer/lib/utils/path.js';
12
+
13
+ /**
14
+ * Convenience utility for capitalizing a string, with
15
+ * replacing non-alphanumeric characters with spaces.
16
+ *
17
+ * @param {string} path
18
+ * @return {string}
19
+ */
20
+ export function capitalize(path) {
21
+ return path
22
+ .toLowerCase()
23
+ .replace(/([^\w]+)/gu, ' ')
24
+ .trim()
25
+ .replace(/^./u, (c) => c.toUpperCase());
26
+ }
27
+
28
+ /**
29
+ * Convenience utility for reading a value from a path.
30
+ *
31
+ * @param {string} path
32
+ * @param {Object} obj
33
+ * @return {*}
34
+ */
35
+ export function getProperty(path, obj) {
36
+ return get(obj, path);
37
+ }
38
+
39
+ /**
40
+ * Convenience utility for setting a value to a path.
41
+ *
42
+ * Note, if any part in the path is undefined, this
43
+ * function initializes it with an empty object.
44
+ *
45
+ * @param {string} path
46
+ * @param {*} value
47
+ * @param {Object} obj
48
+ */
49
+ export function setProperty(path, value, obj) {
50
+ if (obj && path) {
51
+ path
52
+ .split('.')
53
+ .slice(0, -1)
54
+ .reduce((o, p) => {
55
+ // Create an object
56
+ if (!o[p]) {
57
+ o[p] = {};
58
+ }
59
+ return o[p];
60
+ }, obj);
61
+
62
+ set(obj, path, value);
63
+ }
64
+ }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2000 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2000 - 2023 Vaadin Ltd.
4
4
  *
5
5
  * This program is available under Vaadin Commercial License and Service Terms.
6
6
  *
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2000 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2000 - 2023 Vaadin Ltd.
4
4
  *
5
5
  * This program is available under Vaadin Commercial License and Service Terms.
6
6
  *
@@ -8,6 +8,7 @@
8
8
  * See https://vaadin.com/commercial-license-and-service-terms for the full
9
9
  * license.
10
10
  */
11
+ import { setProperty } from './vaadin-crud-helpers.js';
11
12
 
12
13
  /**
13
14
  * @polymerMixin
@@ -46,17 +47,19 @@ export const IncludedMixin = (superClass) =>
46
47
  /** @private */
47
48
  __onExcludeChange(exclude) {
48
49
  if (typeof exclude === 'string') {
49
- this.exclude = exclude ? RegExp(exclude.replace(/, */g, '|'), 'i') : undefined;
50
+ this.exclude = exclude ? RegExp(exclude.replace(/, */gu, '|'), 'iu') : undefined;
50
51
  }
51
52
  }
52
53
 
53
54
  /** @private */
54
55
  __onIncludeChange(include) {
55
56
  if (typeof include === 'string') {
56
- this.include = include ? include.split(/, */) : undefined;
57
+ this.include = include ? include.split(/, */u) : undefined;
57
58
  } else if (!this._fields && Array.isArray(include)) {
58
59
  const item = {};
59
- this.include.forEach((path) => this.__set(path, null, item));
60
+ this.include.forEach((path) => {
61
+ setProperty(path, null, item);
62
+ });
60
63
  this._configure(item);
61
64
  }
62
65
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2000 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2000 - 2023 Vaadin Ltd.
4
4
  *
5
5
  * This program is available under Vaadin Commercial License and Service Terms.
6
6
  *
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2000 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2000 - 2023 Vaadin Ltd.
4
4
  *
5
5
  * This program is available under Vaadin Commercial License and Service Terms.
6
6
  *
@@ -22,6 +22,7 @@ import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
22
22
  import { MediaQueryController } from '@vaadin/component-base/src/media-query-controller.js';
23
23
  import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
24
24
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
25
+ import { getProperty, setProperty } from './vaadin-crud-helpers.js';
25
26
 
26
27
  /**
27
28
  * @private
@@ -308,7 +309,7 @@ class Crud extends ControllerMixin(ElementMixin(ThemableMixin(PolymerElement)))
308
309
  theme$="[[_theme]]"
309
310
  id="confirmCancel"
310
311
  on-confirm="__confirmCancel"
311
- cancel
312
+ cancel-button-visible
312
313
  confirm-text="[[i18n.confirm.cancel.button.confirm]]"
313
314
  cancel-text="[[i18n.confirm.cancel.button.dismiss]]"
314
315
  header="[[i18n.confirm.cancel.title]]"
@@ -320,7 +321,7 @@ class Crud extends ControllerMixin(ElementMixin(ThemableMixin(PolymerElement)))
320
321
  theme$="[[_theme]]"
321
322
  id="confirmDelete"
322
323
  on-confirm="__confirmDelete"
323
- cancel
324
+ cancel-button-visible
324
325
  confirm-text="[[i18n.confirm.delete.button.confirm]]"
325
326
  cancel-text="[[i18n.confirm.delete.button.dismiss]]"
326
327
  header="[[i18n.confirm.delete.title]]"
@@ -1171,7 +1172,7 @@ class Crud extends ControllerMixin(ElementMixin(ThemableMixin(PolymerElement)))
1171
1172
  this._fields.forEach((e) => {
1172
1173
  const path = e.path || e.getAttribute('path');
1173
1174
  if (path) {
1174
- e.value = this.get(path, item);
1175
+ e.value = getProperty(path, item);
1175
1176
  }
1176
1177
  });
1177
1178
 
@@ -1252,7 +1253,7 @@ class Crud extends ControllerMixin(ElementMixin(ThemableMixin(PolymerElement)))
1252
1253
  this._fields.forEach((e) => {
1253
1254
  const path = e.path || e.getAttribute('path');
1254
1255
  if (path) {
1255
- this.__set(path, e.value, item);
1256
+ setProperty(path, e.value, item);
1256
1257
  }
1257
1258
  });
1258
1259
  const evt = this.dispatchEvent(new CustomEvent('save', { detail: { item }, cancelable: true }));
@@ -1264,7 +1265,9 @@ class Crud extends ControllerMixin(ElementMixin(ThemableMixin(PolymerElement)))
1264
1265
  this.items.push(item);
1265
1266
  }
1266
1267
  } else {
1267
- this.editedItem = this.editedItem || {};
1268
+ if (!this.editedItem) {
1269
+ this.editedItem = {};
1270
+ }
1268
1271
  Object.assign(this.editedItem, item);
1269
1272
  }
1270
1273
  this._grid.clearCache();
@@ -1306,23 +1309,6 @@ class Crud extends ControllerMixin(ElementMixin(ThemableMixin(PolymerElement)))
1306
1309
  }
1307
1310
  }
1308
1311
 
1309
- /**
1310
- * Utility method for setting nested values in JSON objects but initializing empty keys unless `Polymer.Base.set`
1311
- * @private
1312
- */
1313
- __set(path, val, obj) {
1314
- if (obj && path) {
1315
- path
1316
- .split('.')
1317
- .slice(0, -1)
1318
- .reduce((o, p) => {
1319
- o[p] = o[p] || {};
1320
- return o[p];
1321
- }, obj);
1322
- this.set(path, val, obj);
1323
- }
1324
- }
1325
-
1326
1312
  /**
1327
1313
  * Fired when user wants to edit an existing item. If the default is prevented, then
1328
1314
  * a new item is not assigned to the form, giving that responsibility to the app, though
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.0.0-alpha6",
4
+ "version": "24.0.0-alpha8",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -295,7 +295,7 @@
295
295
  },
296
296
  {
297
297
  "name": "vaadin-crud",
298
- "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.0.0-alpha6/#/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.0.0-alpha6/#/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.0.0-alpha6/#/elements/vaadin-crud-edit-column)\n- `<vaadin-crud-grid>` - can be replaced with custom [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha6/#/elements/vaadin-grid)\n- `<vaadin-crud-form>` - can be replaced with custom [`<vaadin-form-layout>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha6/#/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/custom-theme/styling-components) documentation.",
298
+ "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.0.0-alpha8/#/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.0.0-alpha8/#/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.0.0-alpha8/#/elements/vaadin-crud-edit-column)\n- `<vaadin-crud-grid>` - can be replaced with custom [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha8/#/elements/vaadin-grid)\n- `<vaadin-crud-form>` - can be replaced with custom [`<vaadin-form-layout>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha8/#/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/custom-theme/styling-components) documentation.",
299
299
  "attributes": [
300
300
  {
301
301
  "name": "editor-position",
@@ -350,7 +350,7 @@
350
350
  },
351
351
  {
352
352
  "name": "include",
353
- "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.0.0-alpha6/#/elements/vaadin-crud#property-exclude) is ignored.\n\nDefault is undefined meaning that all properties in the object should be mapped to fields.",
353
+ "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.0.0-alpha8/#/elements/vaadin-crud#property-exclude) is ignored.\n\nDefault is undefined meaning that all properties in the object should be mapped to fields.",
354
354
  "value": {
355
355
  "type": [
356
356
  "string",
@@ -361,7 +361,7 @@
361
361
  },
362
362
  {
363
363
  "name": "exclude",
364
- "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.0.0-alpha6/#/elements/vaadin-crud#property-include) is defined, this parameter is ignored.\n\nDefault is to exclude all private fields (those properties starting with underscore)",
364
+ "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.0.0-alpha8/#/elements/vaadin-crud#property-include) is defined, this parameter is ignored.\n\nDefault is to exclude all private fields (those properties starting with underscore)",
365
365
  "value": {
366
366
  "type": [
367
367
  "string",
@@ -488,7 +488,7 @@
488
488
  },
489
489
  {
490
490
  "name": "include",
491
- "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.0.0-alpha6/#/elements/vaadin-crud#property-exclude) is ignored.\n\nDefault is undefined meaning that all properties in the object should be mapped to fields.",
491
+ "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.0.0-alpha8/#/elements/vaadin-crud#property-exclude) is ignored.\n\nDefault is undefined meaning that all properties in the object should be mapped to fields.",
492
492
  "value": {
493
493
  "type": [
494
494
  "string",
@@ -499,7 +499,7 @@
499
499
  },
500
500
  {
501
501
  "name": "exclude",
502
- "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.0.0-alpha6/#/elements/vaadin-crud#property-include) is defined, this parameter is ignored.\n\nDefault is to exclude all private fields (those properties starting with underscore)",
502
+ "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.0.0-alpha8/#/elements/vaadin-crud#property-include) is defined, this parameter is ignored.\n\nDefault is to exclude all private fields (those properties starting with underscore)",
503
503
  "value": {
504
504
  "type": [
505
505
  "string",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/crud",
4
- "version": "24.0.0-alpha6",
4
+ "version": "24.0.0-alpha8",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -121,7 +121,7 @@
121
121
  },
122
122
  {
123
123
  "name": "vaadin-crud",
124
- "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.0.0-alpha6/#/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.0.0-alpha6/#/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.0.0-alpha6/#/elements/vaadin-crud-edit-column)\n- `<vaadin-crud-grid>` - can be replaced with custom [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha6/#/elements/vaadin-grid)\n- `<vaadin-crud-form>` - can be replaced with custom [`<vaadin-form-layout>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha6/#/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/custom-theme/styling-components) documentation.",
124
+ "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.0.0-alpha8/#/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.0.0-alpha8/#/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.0.0-alpha8/#/elements/vaadin-crud-edit-column)\n- `<vaadin-crud-grid>` - can be replaced with custom [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha8/#/elements/vaadin-grid)\n- `<vaadin-crud-form>` - can be replaced with custom [`<vaadin-form-layout>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha8/#/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/custom-theme/styling-components) documentation.",
125
125
  "extension": true,
126
126
  "attributes": [
127
127
  {
@@ -196,14 +196,14 @@
196
196
  },
197
197
  {
198
198
  "name": ".include",
199
- "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.0.0-alpha6/#/elements/vaadin-crud#property-exclude) is ignored.\n\nDefault is undefined meaning that all properties in the object should be mapped to fields.",
199
+ "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.0.0-alpha8/#/elements/vaadin-crud#property-exclude) is ignored.\n\nDefault is undefined meaning that all properties in the object should be mapped to fields.",
200
200
  "value": {
201
201
  "kind": "expression"
202
202
  }
203
203
  },
204
204
  {
205
205
  "name": ".exclude",
206
- "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.0.0-alpha6/#/elements/vaadin-crud#property-include) is defined, this parameter is ignored.\n\nDefault is to exclude all private fields (those properties starting with underscore)",
206
+ "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.0.0-alpha8/#/elements/vaadin-crud#property-include) is defined, this parameter is ignored.\n\nDefault is to exclude all private fields (those properties starting with underscore)",
207
207
  "value": {
208
208
  "kind": "expression"
209
209
  }