@vaadin/crud 25.2.0-alpha1 → 25.2.0-alpha11
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/custom-elements.json +8 -8
- package/package.json +16 -16
- package/src/vaadin-crud-dialog.js +0 -4
- package/src/vaadin-crud-edit.js +1 -8
- package/src/vaadin-crud-form.js +0 -2
- package/src/vaadin-crud-grid-mixin.js +1 -5
- package/src/vaadin-crud-grid.js +0 -2
- package/src/vaadin-crud-include-mixin.js +0 -4
- package/src/vaadin-crud-mixin.js +6 -47
- package/src/vaadin-crud.d.ts +26 -11
- package/src/vaadin-crud.js +26 -15
- package/web-types.json +116 -210
- package/web-types.lit.json +79 -72
package/custom-elements.json
CHANGED
|
@@ -531,7 +531,7 @@
|
|
|
531
531
|
"type": {
|
|
532
532
|
"text": "boolean"
|
|
533
533
|
},
|
|
534
|
-
"description": "When disabled, the button is rendered as \"dimmed\"
|
|
534
|
+
"description": "When disabled, the button is rendered as \"dimmed\".\n\nBy default, disabled buttons are not focusable and don't react to hover.\nAs a result, they are hidden from assistive technologies, and it's not\npossible to show a tooltip to explain why they are disabled. This can\nbe addressed by enabling the feature flag `accessibleDisabledButtons`,\nwhich makes disabled buttons focusable and hoverable, while still\npreventing them from being activated:\n\n```js\n// Set before any button is attached to the DOM.\nwindow.Vaadin.featureFlags.accessibleDisabledButtons = true\n```",
|
|
535
535
|
"attribute": "disabled",
|
|
536
536
|
"inheritedFrom": {
|
|
537
537
|
"name": "Button",
|
|
@@ -551,7 +551,7 @@
|
|
|
551
551
|
"type": {
|
|
552
552
|
"text": "boolean"
|
|
553
553
|
},
|
|
554
|
-
"description": "When disabled, the button is rendered as \"dimmed\"
|
|
554
|
+
"description": "When disabled, the button is rendered as \"dimmed\".\n\nBy default, disabled buttons are not focusable and don't react to hover.\nAs a result, they are hidden from assistive technologies, and it's not\npossible to show a tooltip to explain why they are disabled. This can\nbe addressed by enabling the feature flag `accessibleDisabledButtons`,\nwhich makes disabled buttons focusable and hoverable, while still\npreventing them from being activated:\n\n```js\n// Set before any button is attached to the DOM.\nwindow.Vaadin.featureFlags.accessibleDisabledButtons = true\n```",
|
|
555
555
|
"fieldName": "disabled",
|
|
556
556
|
"inheritedFrom": {
|
|
557
557
|
"name": "Button",
|
|
@@ -1259,7 +1259,7 @@
|
|
|
1259
1259
|
"declarations": [
|
|
1260
1260
|
{
|
|
1261
1261
|
"kind": "class",
|
|
1262
|
-
"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`](#/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\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`](#/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>`](#/elements/vaadin-crud-edit-column)\n- `<vaadin-crud-grid>` - can be replaced with custom [`<vaadin-grid>`](#/elements/vaadin-grid)\n- `<vaadin-crud-form>` - can be replaced with custom [`<vaadin-form-layout>`](#/elements/vaadin-form-layout)\n\n### Styling\n\nThe following shadow DOM parts are available for styling when the editor is rendered next to, or below, the grid:\n\nPart name | Description\n----------------|----------------\n`toolbar` | Toolbar container at the bottom of the grid. By default, it contains the `new` button\n`editor` | The editor container\n`scroller` | The wrapper for the header and the form\n`header` | The header of the editor\n`footer` | The footer of the editor\n\nThe following shadow DOM parts are available for styling when the editor renders as a dialog:\n\nPart name | Description\n----------------|----------------\n`toolbar` | Toolbar container at the bottom of the grid. By default, it contains the `new` button\n`overlay` | The dialog overlay\n`backdrop` | The dialog backdrop\n`header` | The header of the dialog\n`footer` | The footer of the dialog\n`content` | The wrapper for the form\n\nThe following custom properties are available:\n\nCustom
|
|
1262
|
+
"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`](#/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\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`](#/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>`](#/elements/vaadin-crud-edit-column)\n- `<vaadin-crud-grid>` - can be replaced with custom [`<vaadin-grid>`](#/elements/vaadin-grid)\n- `<vaadin-crud-form>` - can be replaced with custom [`<vaadin-form-layout>`](#/elements/vaadin-form-layout)\n\n### Styling\n\nThe following shadow DOM parts are available for styling when the editor is rendered next to, or below, the grid:\n\nPart name | Description\n----------------|----------------\n`toolbar` | Toolbar container at the bottom of the grid. By default, it contains the `new` button\n`editor` | The editor container\n`scroller` | The wrapper for the header and the form\n`header` | The header of the editor\n`footer` | The footer of the editor\n\nThe following shadow DOM parts are available for styling when the editor renders as a dialog:\n\nPart name | Description\n----------------|----------------\n`toolbar` | Toolbar container at the bottom of the grid. By default, it contains the `new` button\n`overlay` | The dialog overlay\n`backdrop` | The dialog backdrop\n`header` | The header of the dialog\n`footer` | The footer of the dialog\n`content` | The wrapper for the form\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:--------------------------------------|\n| `--vaadin-crud-background` |\n| `--vaadin-crud-border-color` |\n| `--vaadin-crud-border-radius` |\n| `--vaadin-crud-border-width` |\n| `--vaadin-crud-editor-max-height` |\n| `--vaadin-crud-editor-max-width` |\n| `--vaadin-crud-footer-background` |\n| `--vaadin-crud-footer-gap` |\n| `--vaadin-crud-footer-padding` |\n| `--vaadin-crud-form-padding` |\n| `--vaadin-crud-header-color` |\n| `--vaadin-crud-header-font-size` |\n| `--vaadin-crud-header-font-weight` |\n| `--vaadin-crud-header-line-height` |\n| `--vaadin-crud-header-padding` |\n| `--vaadin-crud-toolbar-background` |\n| `--vaadin-crud-toolbar-padding` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
1263
1263
|
"name": "Crud",
|
|
1264
1264
|
"members": [
|
|
1265
1265
|
{
|
|
@@ -1465,28 +1465,28 @@
|
|
|
1465
1465
|
"type": {
|
|
1466
1466
|
"text": "CustomEvent"
|
|
1467
1467
|
},
|
|
1468
|
-
"description": "Fired when user discards edition.",
|
|
1468
|
+
"description": "Fired when user discards edition. If the default is prevented, no action is performed; the listener is responsible for closing the dialog and resetting the item and grid.",
|
|
1469
1469
|
"name": "cancel"
|
|
1470
1470
|
},
|
|
1471
1471
|
{
|
|
1472
1472
|
"type": {
|
|
1473
1473
|
"text": "CustomEvent"
|
|
1474
1474
|
},
|
|
1475
|
-
"description": "Fired when user wants to delete item.",
|
|
1475
|
+
"description": "Fired when user wants to delete item. If the default is prevented, no action is performed: the items array is not modified and the dialog is not closed.",
|
|
1476
1476
|
"name": "delete"
|
|
1477
1477
|
},
|
|
1478
1478
|
{
|
|
1479
1479
|
"type": {
|
|
1480
1480
|
"text": "CustomEvent"
|
|
1481
1481
|
},
|
|
1482
|
-
"description": "Fired when user wants to edit an existing item.",
|
|
1482
|
+
"description": "Fired when user wants to edit an existing item. If the default is prevented, a new item is not assigned to the form, but the dialog is still opened.",
|
|
1483
1483
|
"name": "edit"
|
|
1484
1484
|
},
|
|
1485
1485
|
{
|
|
1486
1486
|
"type": {
|
|
1487
1487
|
"text": "CustomEvent"
|
|
1488
1488
|
},
|
|
1489
|
-
"description": "Fired when `editedItem` property changes.",
|
|
1489
|
+
"description": "Fired when the `editedItem` property changes.",
|
|
1490
1490
|
"name": "edited-item-changed"
|
|
1491
1491
|
},
|
|
1492
1492
|
{
|
|
@@ -1514,7 +1514,7 @@
|
|
|
1514
1514
|
"type": {
|
|
1515
1515
|
"text": "CustomEvent"
|
|
1516
1516
|
},
|
|
1517
|
-
"description": "Fired when user wants to save a new or an existing item.",
|
|
1517
|
+
"description": "Fired when user wants to save a new or an existing item. If the default is prevented, no action is performed: the items array is not modified and the dialog is not closed.",
|
|
1518
1518
|
"name": "save"
|
|
1519
1519
|
},
|
|
1520
1520
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/crud",
|
|
3
|
-
"version": "25.2.0-
|
|
3
|
+
"version": "25.2.0-alpha11",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,24 +35,24 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@vaadin/a11y-base": "25.2.0-
|
|
39
|
-
"@vaadin/button": "25.2.0-
|
|
40
|
-
"@vaadin/component-base": "25.2.0-
|
|
41
|
-
"@vaadin/confirm-dialog": "25.2.0-
|
|
42
|
-
"@vaadin/dialog": "25.2.0-
|
|
43
|
-
"@vaadin/form-layout": "25.2.0-
|
|
44
|
-
"@vaadin/grid": "25.2.0-
|
|
45
|
-
"@vaadin/overlay": "25.2.0-
|
|
46
|
-
"@vaadin/text-field": "25.2.0-
|
|
47
|
-
"@vaadin/vaadin-themable-mixin": "25.2.0-
|
|
38
|
+
"@vaadin/a11y-base": "25.2.0-alpha11",
|
|
39
|
+
"@vaadin/button": "25.2.0-alpha11",
|
|
40
|
+
"@vaadin/component-base": "25.2.0-alpha11",
|
|
41
|
+
"@vaadin/confirm-dialog": "25.2.0-alpha11",
|
|
42
|
+
"@vaadin/dialog": "25.2.0-alpha11",
|
|
43
|
+
"@vaadin/form-layout": "25.2.0-alpha11",
|
|
44
|
+
"@vaadin/grid": "25.2.0-alpha11",
|
|
45
|
+
"@vaadin/overlay": "25.2.0-alpha11",
|
|
46
|
+
"@vaadin/text-field": "25.2.0-alpha11",
|
|
47
|
+
"@vaadin/vaadin-themable-mixin": "25.2.0-alpha11",
|
|
48
48
|
"lit": "^3.0.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@vaadin/aura": "25.2.0-
|
|
52
|
-
"@vaadin/chai-plugins": "25.2.0-
|
|
53
|
-
"@vaadin/test-runner-commands": "25.2.0-
|
|
51
|
+
"@vaadin/aura": "25.2.0-alpha11",
|
|
52
|
+
"@vaadin/chai-plugins": "25.2.0-alpha11",
|
|
53
|
+
"@vaadin/test-runner-commands": "25.2.0-alpha11",
|
|
54
54
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
55
|
-
"@vaadin/vaadin-lumo-styles": "25.2.0-
|
|
55
|
+
"@vaadin/vaadin-lumo-styles": "25.2.0-alpha11",
|
|
56
56
|
"sinon": "^21.0.2"
|
|
57
57
|
},
|
|
58
58
|
"cvdlName": "vaadin-crud",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"web-types.json",
|
|
62
62
|
"web-types.lit.json"
|
|
63
63
|
],
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "fdc37e932709f95491a027aeb2090911cb7528c6"
|
|
65
65
|
}
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
7
|
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
8
|
* license.
|
|
10
9
|
*/
|
|
@@ -25,9 +24,6 @@ import { crudDialogOverlayStyles } from './styles/vaadin-crud-dialog-overlay-bas
|
|
|
25
24
|
*
|
|
26
25
|
* @customElement vaadin-crud-dialog
|
|
27
26
|
* @extends HTMLElement
|
|
28
|
-
* @mixes DirMixin
|
|
29
|
-
* @mixes OverlayMixin
|
|
30
|
-
* @mixes ThemableMixin
|
|
31
27
|
* @private
|
|
32
28
|
*/
|
|
33
29
|
class CrudDialogOverlay extends OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
|
package/src/vaadin-crud-edit.js
CHANGED
|
@@ -51,18 +51,11 @@ class CrudEdit extends Button {
|
|
|
51
51
|
/** @private */
|
|
52
52
|
__onClick(e) {
|
|
53
53
|
const tr = e.target.parentElement.assignedSlot.parentElement.parentElement;
|
|
54
|
+
/** @internal to not document it in CEM */
|
|
54
55
|
tr.dispatchEvent(
|
|
55
56
|
new CustomEvent('edit', { detail: { item: tr._item, index: tr.index }, bubbles: true, composed: true }),
|
|
56
57
|
);
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Fired when user on the icon.
|
|
61
|
-
*
|
|
62
|
-
* @event edit
|
|
63
|
-
* @param {Object} detail.item the item to edit
|
|
64
|
-
* @param {Object} detail.index the index of the item in the data set
|
|
65
|
-
*/
|
|
66
59
|
}
|
|
67
60
|
|
|
68
61
|
defineCustomElement(CrudEdit);
|
package/src/vaadin-crud-form.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
7
|
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
8
|
* license.
|
|
10
9
|
*/
|
|
@@ -19,7 +18,6 @@ import { IncludedMixin } from './vaadin-crud-include-mixin.js';
|
|
|
19
18
|
*
|
|
20
19
|
* @customElement vaadin-crud-form
|
|
21
20
|
* @extends FormLayout
|
|
22
|
-
* @mixes IncludedMixin
|
|
23
21
|
* @private
|
|
24
22
|
*/
|
|
25
23
|
class CrudForm extends IncludedMixin(FormLayout) {
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
7
|
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
8
|
* license.
|
|
10
9
|
*/
|
|
@@ -13,9 +12,6 @@ import { IncludedMixin } from './vaadin-crud-include-mixin.js';
|
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* A mixin providing common crud-grid functionality.
|
|
16
|
-
*
|
|
17
|
-
* @polymerMixin
|
|
18
|
-
* @mixes IncludedMixin
|
|
19
15
|
*/
|
|
20
16
|
export const CrudGridMixin = (superClass) =>
|
|
21
17
|
class extends IncludedMixin(superClass) {
|
|
@@ -62,7 +58,7 @@ export const CrudGridMixin = (superClass) =>
|
|
|
62
58
|
|
|
63
59
|
/** @private */
|
|
64
60
|
__onItemsChange(items) {
|
|
65
|
-
if ((!this.dataProvider || this.dataProvider === this._arrayDataProvider) && !this.include && items
|
|
61
|
+
if ((!this.dataProvider || this.dataProvider === this._arrayDataProvider) && !this.include && items?.[0]) {
|
|
66
62
|
this._configure(items[0]);
|
|
67
63
|
}
|
|
68
64
|
}
|
package/src/vaadin-crud-grid.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
7
|
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
8
|
* license.
|
|
10
9
|
*/
|
|
@@ -22,7 +21,6 @@ import { CrudGridMixin } from './vaadin-crud-grid-mixin.js';
|
|
|
22
21
|
* An element used internally by `<vaadin-crud>`. Not intended to be used separately.
|
|
23
22
|
*
|
|
24
23
|
* @extends Grid
|
|
25
|
-
* @mixes CrudGridMixin
|
|
26
24
|
* @private
|
|
27
25
|
*/
|
|
28
26
|
class CrudGrid extends CrudGridMixin(Grid) {
|
|
@@ -4,15 +4,11 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
7
|
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
8
|
* license.
|
|
10
9
|
*/
|
|
11
10
|
import { setProperty } from './vaadin-crud-helpers.js';
|
|
12
11
|
|
|
13
|
-
/**
|
|
14
|
-
* @polymerMixin
|
|
15
|
-
*/
|
|
16
12
|
export const IncludedMixin = (superClass) =>
|
|
17
13
|
class IncludedMixin extends superClass {
|
|
18
14
|
static get properties() {
|
package/src/vaadin-crud-mixin.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
7
|
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
8
|
* license.
|
|
10
9
|
*/
|
|
@@ -44,12 +43,9 @@ const DEFAULT_I18N = {
|
|
|
44
43
|
|
|
45
44
|
/**
|
|
46
45
|
* A mixin providing common crud functionality.
|
|
47
|
-
*
|
|
48
|
-
* @polymerMixin
|
|
49
|
-
* @mixes I18nMixin
|
|
50
46
|
*/
|
|
51
47
|
export const CrudMixin = (superClass) =>
|
|
52
|
-
class extends I18nMixin(
|
|
48
|
+
class extends I18nMixin(superClass) {
|
|
53
49
|
static get properties() {
|
|
54
50
|
return {
|
|
55
51
|
/**
|
|
@@ -304,6 +300,10 @@ export const CrudMixin = (superClass) =>
|
|
|
304
300
|
];
|
|
305
301
|
}
|
|
306
302
|
|
|
303
|
+
static get defaultI18n() {
|
|
304
|
+
return DEFAULT_I18N;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
307
|
/**
|
|
308
308
|
* The object used to localize this component. To change the default
|
|
309
309
|
* localization, replace this with an object that provides all properties, or
|
|
@@ -793,7 +793,7 @@ export const CrudMixin = (superClass) =>
|
|
|
793
793
|
__createDataProviderProxy(dataProvider) {
|
|
794
794
|
return (params, callback) => {
|
|
795
795
|
const callbackProxy = (chunk, size) => {
|
|
796
|
-
if (chunk
|
|
796
|
+
if (chunk?.[0]) {
|
|
797
797
|
this.__model = chunk[0];
|
|
798
798
|
}
|
|
799
799
|
|
|
@@ -1003,45 +1003,4 @@ export const CrudMixin = (superClass) =>
|
|
|
1003
1003
|
element.removeAttribute('aria-hidden');
|
|
1004
1004
|
}
|
|
1005
1005
|
}
|
|
1006
|
-
|
|
1007
|
-
/**
|
|
1008
|
-
* Fired when user wants to edit an existing item. If the default is prevented, then
|
|
1009
|
-
* a new item is not assigned to the form, giving that responsibility to the app, though
|
|
1010
|
-
* dialog is always opened.
|
|
1011
|
-
*
|
|
1012
|
-
* @event edit
|
|
1013
|
-
* @param {Object} detail.item the item to edit
|
|
1014
|
-
*/
|
|
1015
|
-
|
|
1016
|
-
/**
|
|
1017
|
-
* Fired when user wants to create a new item.
|
|
1018
|
-
*
|
|
1019
|
-
* @event new
|
|
1020
|
-
*/
|
|
1021
|
-
|
|
1022
|
-
/**
|
|
1023
|
-
* Fired when user wants to delete item. If the default is prevented, then
|
|
1024
|
-
* no action is performed, items array is not modified nor dialog closed
|
|
1025
|
-
*
|
|
1026
|
-
* @event delete
|
|
1027
|
-
* @param {Object} detail.item the item to delete
|
|
1028
|
-
*/
|
|
1029
|
-
|
|
1030
|
-
/**
|
|
1031
|
-
* Fired when user discards edition. If the default is prevented, then
|
|
1032
|
-
* no action is performed, user is responsible to close dialog and reset
|
|
1033
|
-
* item and grid.
|
|
1034
|
-
*
|
|
1035
|
-
* @event cancel
|
|
1036
|
-
* @param {Object} detail.item the item to delete
|
|
1037
|
-
*/
|
|
1038
|
-
|
|
1039
|
-
/**
|
|
1040
|
-
* Fired when user wants to save a new or an existing item. If the default is prevented, then
|
|
1041
|
-
* no action is performed, items array is not modified nor dialog closed
|
|
1042
|
-
*
|
|
1043
|
-
* @event save
|
|
1044
|
-
* @param {Object} detail.item the item to save
|
|
1045
|
-
* @param {Object} detail.new whether the item is a new one
|
|
1046
|
-
*/
|
|
1047
1006
|
};
|
package/src/vaadin-crud.d.ts
CHANGED
|
@@ -153,24 +153,39 @@ export * from './vaadin-crud-mixin.js';
|
|
|
153
153
|
* `footer` | The footer of the dialog
|
|
154
154
|
* `content` | The wrapper for the form
|
|
155
155
|
*
|
|
156
|
-
* The following custom properties are available:
|
|
157
|
-
*
|
|
158
|
-
* Custom
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
156
|
+
* The following custom CSS properties are available for styling:
|
|
157
|
+
*
|
|
158
|
+
* Custom CSS property |
|
|
159
|
+
* :--------------------------------------|
|
|
160
|
+
* | `--vaadin-crud-background` |
|
|
161
|
+
* | `--vaadin-crud-border-color` |
|
|
162
|
+
* | `--vaadin-crud-border-radius` |
|
|
163
|
+
* | `--vaadin-crud-border-width` |
|
|
164
|
+
* | `--vaadin-crud-editor-max-height` |
|
|
165
|
+
* | `--vaadin-crud-editor-max-width` |
|
|
166
|
+
* | `--vaadin-crud-footer-background` |
|
|
167
|
+
* | `--vaadin-crud-footer-gap` |
|
|
168
|
+
* | `--vaadin-crud-footer-padding` |
|
|
169
|
+
* | `--vaadin-crud-form-padding` |
|
|
170
|
+
* | `--vaadin-crud-header-color` |
|
|
171
|
+
* | `--vaadin-crud-header-font-size` |
|
|
172
|
+
* | `--vaadin-crud-header-font-weight` |
|
|
173
|
+
* | `--vaadin-crud-header-line-height` |
|
|
174
|
+
* | `--vaadin-crud-header-padding` |
|
|
175
|
+
* | `--vaadin-crud-toolbar-background` |
|
|
176
|
+
* | `--vaadin-crud-toolbar-padding` |
|
|
162
177
|
*
|
|
163
178
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
164
179
|
*
|
|
165
180
|
* @fires {CustomEvent} editor-opened-changed - Fired when the `editorOpened` property changes.
|
|
166
|
-
* @fires {CustomEvent} edited-item-changed - Fired when `editedItem` property changes.
|
|
181
|
+
* @fires {CustomEvent} edited-item-changed - Fired when the `editedItem` property changes.
|
|
167
182
|
* @fires {CustomEvent} items-changed - Fired when the `items` property changes.
|
|
168
183
|
* @fires {CustomEvent} size-changed - Fired when the `size` property changes.
|
|
169
184
|
* @fires {CustomEvent} new - Fired when user wants to create a new item.
|
|
170
|
-
* @fires {CustomEvent} edit - Fired when user wants to edit an existing item.
|
|
171
|
-
* @fires {CustomEvent} delete - Fired when user wants to delete item.
|
|
172
|
-
* @fires {CustomEvent} save - Fired when user wants to save a new or an existing item.
|
|
173
|
-
* @fires {CustomEvent} cancel - Fired when user discards edition.
|
|
185
|
+
* @fires {CustomEvent} edit - Fired when user wants to edit an existing item. If the default is prevented, a new item is not assigned to the form, but the dialog is still opened.
|
|
186
|
+
* @fires {CustomEvent} delete - Fired when user wants to delete item. If the default is prevented, no action is performed: the items array is not modified and the dialog is not closed.
|
|
187
|
+
* @fires {CustomEvent} save - Fired when user wants to save a new or an existing item. If the default is prevented, no action is performed: the items array is not modified and the dialog is not closed.
|
|
188
|
+
* @fires {CustomEvent} cancel - Fired when user discards edition. If the default is prevented, no action is performed; the listener is responsible for closing the dialog and resetting the item and grid.
|
|
174
189
|
*/
|
|
175
190
|
declare class Crud<Item = GridDefaultItem> extends HTMLElement {
|
|
176
191
|
addEventListener<K extends keyof CrudEventMap<Item>>(
|
package/src/vaadin-crud.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
7
|
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
8
|
* license.
|
|
10
9
|
*/
|
|
@@ -161,30 +160,42 @@ import { CrudMixin } from './vaadin-crud-mixin.js';
|
|
|
161
160
|
* `footer` | The footer of the dialog
|
|
162
161
|
* `content` | The wrapper for the form
|
|
163
162
|
*
|
|
164
|
-
* The following custom properties are available:
|
|
165
|
-
*
|
|
166
|
-
* Custom
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
163
|
+
* The following custom CSS properties are available for styling:
|
|
164
|
+
*
|
|
165
|
+
* Custom CSS property |
|
|
166
|
+
* :--------------------------------------|
|
|
167
|
+
* | `--vaadin-crud-background` |
|
|
168
|
+
* | `--vaadin-crud-border-color` |
|
|
169
|
+
* | `--vaadin-crud-border-radius` |
|
|
170
|
+
* | `--vaadin-crud-border-width` |
|
|
171
|
+
* | `--vaadin-crud-editor-max-height` |
|
|
172
|
+
* | `--vaadin-crud-editor-max-width` |
|
|
173
|
+
* | `--vaadin-crud-footer-background` |
|
|
174
|
+
* | `--vaadin-crud-footer-gap` |
|
|
175
|
+
* | `--vaadin-crud-footer-padding` |
|
|
176
|
+
* | `--vaadin-crud-form-padding` |
|
|
177
|
+
* | `--vaadin-crud-header-color` |
|
|
178
|
+
* | `--vaadin-crud-header-font-size` |
|
|
179
|
+
* | `--vaadin-crud-header-font-weight` |
|
|
180
|
+
* | `--vaadin-crud-header-line-height` |
|
|
181
|
+
* | `--vaadin-crud-header-padding` |
|
|
182
|
+
* | `--vaadin-crud-toolbar-background` |
|
|
183
|
+
* | `--vaadin-crud-toolbar-padding` |
|
|
170
184
|
*
|
|
171
185
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
172
186
|
*
|
|
173
187
|
* @fires {CustomEvent} editor-opened-changed - Fired when the `editorOpened` property changes.
|
|
174
|
-
* @fires {CustomEvent} edited-item-changed - Fired when `editedItem` property changes.
|
|
188
|
+
* @fires {CustomEvent} edited-item-changed - Fired when the `editedItem` property changes.
|
|
175
189
|
* @fires {CustomEvent} items-changed - Fired when the `items` property changes.
|
|
176
190
|
* @fires {CustomEvent} size-changed - Fired when the `size` property changes.
|
|
177
191
|
* @fires {CustomEvent} new - Fired when user wants to create a new item.
|
|
178
|
-
* @fires {CustomEvent} edit - Fired when user wants to edit an existing item.
|
|
179
|
-
* @fires {CustomEvent} delete - Fired when user wants to delete item.
|
|
180
|
-
* @fires {CustomEvent} save - Fired when user wants to save a new or an existing item.
|
|
181
|
-
* @fires {CustomEvent} cancel - Fired when user discards edition.
|
|
192
|
+
* @fires {CustomEvent} edit - Fired when user wants to edit an existing item. If the default is prevented, a new item is not assigned to the form, but the dialog is still opened.
|
|
193
|
+
* @fires {CustomEvent} delete - Fired when user wants to delete item. If the default is prevented, no action is performed: the items array is not modified and the dialog is not closed.
|
|
194
|
+
* @fires {CustomEvent} save - Fired when user wants to save a new or an existing item. If the default is prevented, no action is performed: the items array is not modified and the dialog is not closed.
|
|
195
|
+
* @fires {CustomEvent} cancel - Fired when user discards edition. If the default is prevented, no action is performed; the listener is responsible for closing the dialog and resetting the item and grid.
|
|
182
196
|
*
|
|
183
197
|
* @customElement vaadin-crud
|
|
184
198
|
* @extends HTMLElement
|
|
185
|
-
* @mixes ElementMixin
|
|
186
|
-
* @mixes ThemableMixin
|
|
187
|
-
* @mixes CrudMixin
|
|
188
199
|
*/
|
|
189
200
|
class Crud extends CrudMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
|
|
190
201
|
static get is() {
|