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