@vaadin/crud 25.0.0-alpha2 → 25.0.0-alpha20
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 +16 -17
- package/src/{vaadin-crud-styles.d.ts → styles/vaadin-crud-base-styles.d.ts} +0 -2
- package/src/styles/vaadin-crud-base-styles.js +165 -0
- package/src/styles/vaadin-crud-dialog-overlay-base-styles.d.ts +13 -0
- package/src/styles/vaadin-crud-dialog-overlay-base-styles.js +50 -0
- package/src/styles/vaadin-crud-edit-base-styles.js +28 -0
- package/src/styles/vaadin-crud-grid-base-styles.d.ts +13 -0
- package/src/styles/vaadin-crud-grid-base-styles.js +21 -0
- package/src/vaadin-crud-controllers.js +1 -1
- package/src/vaadin-crud-dialog.js +53 -18
- package/src/vaadin-crud-edit.js +4 -11
- package/src/vaadin-crud-grid.js +5 -0
- package/src/vaadin-crud-mixin.d.ts +1 -1
- package/src/vaadin-crud-mixin.js +63 -83
- package/src/vaadin-crud.d.ts +17 -2
- package/src/vaadin-crud.js +117 -60
- package/vaadin-crud.js +1 -1
- package/web-types.json +32 -9
- package/web-types.lit.json +13 -6
- package/src/vaadin-crud-styles.js +0 -125
- package/theme/lumo/vaadin-crud-styles.d.ts +0 -4
- package/theme/lumo/vaadin-crud-styles.js +0 -155
- package/theme/lumo/vaadin-crud.d.ts +0 -8
- package/theme/lumo/vaadin-crud.js +0 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/crud",
|
|
3
|
-
"version": "25.0.0-
|
|
3
|
+
"version": "25.0.0-alpha20",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"files": [
|
|
23
23
|
"src",
|
|
24
|
-
"theme",
|
|
25
24
|
"vaadin-*.d.ts",
|
|
26
25
|
"vaadin-*.js",
|
|
27
26
|
"web-types.json",
|
|
@@ -35,29 +34,29 @@
|
|
|
35
34
|
],
|
|
36
35
|
"dependencies": {
|
|
37
36
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@vaadin/a11y-base": "25.0.0-
|
|
39
|
-
"@vaadin/button": "25.0.0-
|
|
40
|
-
"@vaadin/component-base": "25.0.0-
|
|
41
|
-
"@vaadin/confirm-dialog": "25.0.0-
|
|
42
|
-
"@vaadin/dialog": "25.0.0-
|
|
43
|
-
"@vaadin/form-layout": "25.0.0-
|
|
44
|
-
"@vaadin/grid": "25.0.0-
|
|
45
|
-
"@vaadin/overlay": "25.0.0-
|
|
46
|
-
"@vaadin/text-field": "25.0.0-
|
|
47
|
-
"@vaadin/vaadin-
|
|
48
|
-
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha2",
|
|
37
|
+
"@vaadin/a11y-base": "25.0.0-alpha20",
|
|
38
|
+
"@vaadin/button": "25.0.0-alpha20",
|
|
39
|
+
"@vaadin/component-base": "25.0.0-alpha20",
|
|
40
|
+
"@vaadin/confirm-dialog": "25.0.0-alpha20",
|
|
41
|
+
"@vaadin/dialog": "25.0.0-alpha20",
|
|
42
|
+
"@vaadin/form-layout": "25.0.0-alpha20",
|
|
43
|
+
"@vaadin/grid": "25.0.0-alpha20",
|
|
44
|
+
"@vaadin/overlay": "25.0.0-alpha20",
|
|
45
|
+
"@vaadin/text-field": "25.0.0-alpha20",
|
|
46
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha20",
|
|
49
47
|
"lit": "^3.0.0"
|
|
50
48
|
},
|
|
51
49
|
"devDependencies": {
|
|
52
|
-
"@vaadin/chai-plugins": "25.0.0-
|
|
53
|
-
"@vaadin/test-runner-commands": "25.0.0-
|
|
50
|
+
"@vaadin/chai-plugins": "25.0.0-alpha20",
|
|
51
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha20",
|
|
54
52
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
55
|
-
"
|
|
53
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha20",
|
|
54
|
+
"sinon": "^21.0.0"
|
|
56
55
|
},
|
|
57
56
|
"cvdlName": "vaadin-crud",
|
|
58
57
|
"web-types": [
|
|
59
58
|
"web-types.json",
|
|
60
59
|
"web-types.lit.json"
|
|
61
60
|
],
|
|
62
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "c948aae591a30b432f3784000d4677674cae56e0"
|
|
63
62
|
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2000 - 2025 Vaadin Ltd.
|
|
4
|
+
*
|
|
5
|
+
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
|
+
* license.
|
|
10
|
+
*/
|
|
11
|
+
import '@vaadin/component-base/src/styles/style-props.js';
|
|
12
|
+
import { css } from 'lit';
|
|
13
|
+
|
|
14
|
+
export const crudStyles = css`
|
|
15
|
+
:host {
|
|
16
|
+
--vaadin-grid-border-width: 0px;
|
|
17
|
+
--vaadin-grid-border-radius: var(--vaadin-crud-border-radius, var(--vaadin-radius-l));
|
|
18
|
+
--vaadin-crud-editor-max-height: 40%;
|
|
19
|
+
--vaadin-crud-editor-max-width: 40%;
|
|
20
|
+
border: var(--vaadin-crud-border-width, 1px) solid
|
|
21
|
+
var(--vaadin-crud-border-color, var(--vaadin-border-color-secondary));
|
|
22
|
+
border-radius: var(--vaadin-crud-border-radius, var(--vaadin-radius-l));
|
|
23
|
+
height: 400px;
|
|
24
|
+
width: 100%;
|
|
25
|
+
background: var(--vaadin-crud-background, var(--vaadin-background-color));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:host,
|
|
29
|
+
#main {
|
|
30
|
+
align-self: stretch;
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
position: relative;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
#main {
|
|
37
|
+
flex: 1 1 100%;
|
|
38
|
+
height: 100%;
|
|
39
|
+
min-width: 0;
|
|
40
|
+
min-height: 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
::slotted(vaadin-crud-grid) {
|
|
44
|
+
border-end-start-radius: 0;
|
|
45
|
+
border-end-end-radius: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
:host([hidden]),
|
|
49
|
+
[hidden] {
|
|
50
|
+
display: none !important;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#container {
|
|
54
|
+
display: flex;
|
|
55
|
+
height: 100%;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
:host([editor-position='bottom']) #container {
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
:host([editor-position='aside'][editor-opened]) #main {
|
|
63
|
+
border-inline-end: var(--vaadin-crud-border-width, 1px) solid
|
|
64
|
+
var(--vaadin-crud-border-color, var(--vaadin-border-color-secondary));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
:host([editor-position='aside'][editor-opened]) ::slotted(vaadin-crud-grid) {
|
|
68
|
+
border-start-end-radius: 0;
|
|
69
|
+
border-end-end-radius: 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:host([editor-position='aside'][editor-opened]) :is(#container, [part='editor']) {
|
|
73
|
+
border-start-end-radius: inherit;
|
|
74
|
+
border-end-end-radius: inherit;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
:host([editor-position='bottom'][editor-opened]) #main {
|
|
78
|
+
border-bottom: var(--vaadin-crud-border-width, 1px) solid
|
|
79
|
+
var(--vaadin-crud-border-color, var(--vaadin-border-color-secondary));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
:host([editor-position='bottom'][editor-opened]) :is(#container, [part='editor']) {
|
|
83
|
+
border-end-start-radius: inherit;
|
|
84
|
+
border-end-end-radius: inherit;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
[part='toolbar'] {
|
|
88
|
+
align-items: baseline;
|
|
89
|
+
background: var(--vaadin-crud-toolbar-background, transparent);
|
|
90
|
+
border-top: var(--vaadin-crud-border-width, 1px) solid
|
|
91
|
+
var(--vaadin-crud-border-color, var(--vaadin-border-color-secondary));
|
|
92
|
+
display: flex;
|
|
93
|
+
flex-shrink: 0;
|
|
94
|
+
justify-content: flex-end;
|
|
95
|
+
padding: var(--vaadin-crud-toolbar-padding, var(--vaadin-padding-m));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
:host([no-toolbar]) [part='toolbar'] {
|
|
99
|
+
display: none;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
[part='editor'] {
|
|
103
|
+
display: flex;
|
|
104
|
+
flex-direction: column;
|
|
105
|
+
height: 100%;
|
|
106
|
+
z-index: 1;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
[part='editor']:focus-visible {
|
|
110
|
+
outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
:host(:not([editor-position=''])[editor-opened]:not([fullscreen])) [part='editor'] {
|
|
114
|
+
flex: 1 0 100%;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
:host([editor-position='bottom'][editor-opened]:not([fullscreen])) [part='editor'] {
|
|
118
|
+
max-height: var(--vaadin-crud-editor-max-height);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
:host([editor-position='aside'][editor-opened]:not([fullscreen])) [part='editor'] {
|
|
122
|
+
max-width: var(--vaadin-crud-editor-max-width);
|
|
123
|
+
min-width: 300px;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
[part='scroller'] {
|
|
127
|
+
display: flex;
|
|
128
|
+
flex: auto;
|
|
129
|
+
flex-direction: column;
|
|
130
|
+
overflow: auto;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
[part='header'] {
|
|
134
|
+
color: var(--vaadin-crud-header-color, var(--vaadin-text-color));
|
|
135
|
+
font-size: var(--vaadin-crud-header-font-size, 1em);
|
|
136
|
+
font-weight: var(--vaadin-crud-header-font-weight, 600);
|
|
137
|
+
line-height: var(--vaadin-crud-header-line-height, inherit);
|
|
138
|
+
padding: var(--vaadin-crud-header-padding, var(--vaadin-padding-m));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
::slotted([slot='header']) {
|
|
142
|
+
color: inherit !important;
|
|
143
|
+
display: contents;
|
|
144
|
+
font: inherit !important;
|
|
145
|
+
overflow-wrap: anywhere;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
::slotted([slot='form']) {
|
|
149
|
+
padding: var(--vaadin-crud-form-padding, var(--vaadin-padding-m));
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
[part='footer'] {
|
|
153
|
+
background: var(--vaadin-crud-footer-background, transparent);
|
|
154
|
+
border-top: var(--vaadin-crud-border-width, 1px) solid
|
|
155
|
+
var(--vaadin-crud-border-color, var(--vaadin-border-color-secondary));
|
|
156
|
+
display: flex;
|
|
157
|
+
flex: none;
|
|
158
|
+
gap: var(--vaadin-crud-footer-gap, var(--vaadin-gap-s));
|
|
159
|
+
padding: var(--vaadin-crud-footer-padding, var(--vaadin-padding-m));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
::slotted([slot='delete-button']) {
|
|
163
|
+
margin-inline-start: auto;
|
|
164
|
+
}
|
|
165
|
+
`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2000 - 2025 Vaadin Ltd.
|
|
4
|
+
*
|
|
5
|
+
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
|
+
* license.
|
|
10
|
+
*/
|
|
11
|
+
import type { CSSResult } from 'lit';
|
|
12
|
+
|
|
13
|
+
export declare const crudDialogOverlayStyles: CSSResult;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2000 - 2025 Vaadin Ltd.
|
|
4
|
+
*
|
|
5
|
+
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
|
+
* license.
|
|
10
|
+
*/
|
|
11
|
+
import '@vaadin/component-base/src/styles/style-props.js';
|
|
12
|
+
import { css } from 'lit';
|
|
13
|
+
import { dialogOverlayStyles } from '@vaadin/dialog/src/styles/vaadin-dialog-overlay-base-styles.js';
|
|
14
|
+
|
|
15
|
+
const crudDialogOverlay = css`
|
|
16
|
+
[part='header'] {
|
|
17
|
+
color: var(--vaadin-crud-dialog-header-color, var(--vaadin-text-color));
|
|
18
|
+
font-size: var(--vaadin-crud-dialog-header-font-size, 1em);
|
|
19
|
+
font-weight: var(--vaadin-crud-dialog-header-font-weight, 600);
|
|
20
|
+
line-height: var(--vaadin-crud-dialog-header-line-height, inherit);
|
|
21
|
+
padding: var(--vaadin-crud-header-padding, var(--vaadin-padding-l));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
::slotted([slot='header']) {
|
|
25
|
+
color: inherit !important;
|
|
26
|
+
display: contents;
|
|
27
|
+
font: inherit !important;
|
|
28
|
+
overflow-wrap: anywhere;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:host(:is(*, #id)) [part='content'] {
|
|
32
|
+
overflow: auto;
|
|
33
|
+
overscroll-behavior: contain;
|
|
34
|
+
padding: var(--vaadin-crud-form-padding, var(--vaadin-padding-l));
|
|
35
|
+
padding-top: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
::slotted([slot='form']) {
|
|
39
|
+
--vaadin-crud-form-padding: 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
[part='footer'] {
|
|
43
|
+
justify-content: normal;
|
|
44
|
+
background: var(--vaadin-crud-footer-background, transparent);
|
|
45
|
+
border-top: var(--vaadin-crud-border-width, 1px) solid
|
|
46
|
+
var(--vaadin-crud-border-color, var(--vaadin-border-color-secondary));
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
export const crudDialogOverlayStyles = [...dialogOverlayStyles, crudDialogOverlay];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2000 - 2025 Vaadin Ltd.
|
|
4
|
+
*
|
|
5
|
+
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
|
+
* license.
|
|
10
|
+
*/
|
|
11
|
+
import '@vaadin/component-base/src/styles/style-props.js';
|
|
12
|
+
import { css } from 'lit';
|
|
13
|
+
|
|
14
|
+
export const crudEditStyles = css`
|
|
15
|
+
[part='icon'] {
|
|
16
|
+
background: currentColor;
|
|
17
|
+
display: block;
|
|
18
|
+
height: var(--vaadin-icon-size, 1lh);
|
|
19
|
+
mask-image: var(--_vaadin-icon-edit);
|
|
20
|
+
width: var(--vaadin-icon-size, 1lh);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@media (forced-colors: active) {
|
|
24
|
+
[part='icon'] {
|
|
25
|
+
background: CanvasText;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2000 - 2025 Vaadin Ltd.
|
|
4
|
+
*
|
|
5
|
+
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
|
+
* license.
|
|
10
|
+
*/
|
|
11
|
+
import type { CSSResult } from 'lit';
|
|
12
|
+
|
|
13
|
+
export const crudGridStyles: CSSResult;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2000 - 2025 Vaadin Ltd.
|
|
4
|
+
*
|
|
5
|
+
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
|
+
* license.
|
|
10
|
+
*/
|
|
11
|
+
import '@vaadin/component-base/src/styles/style-props.js';
|
|
12
|
+
import { css } from 'lit';
|
|
13
|
+
import { gridStyles } from '@vaadin/grid/src/styles/vaadin-grid-base-styles.js';
|
|
14
|
+
|
|
15
|
+
const crudGrid = css`
|
|
16
|
+
#scroller {
|
|
17
|
+
border-radius: inherit;
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
export const crudGridStyles = [gridStyles, crudGrid];
|
|
@@ -42,7 +42,7 @@ export class ButtonSlotController extends SlotController {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
// Respect default theme attribute set by the Flow counterpart
|
|
45
|
-
if (node === this.defaultNode && !node.hasAttribute('theme')) {
|
|
45
|
+
if (node === this.defaultNode && this.theme && !node.hasAttribute('theme')) {
|
|
46
46
|
node.setAttribute('theme', this.theme);
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -12,15 +12,13 @@ import { css, html, LitElement } from 'lit';
|
|
|
12
12
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
13
13
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
14
14
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
15
|
-
import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
16
15
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
17
16
|
import { DialogBaseMixin } from '@vaadin/dialog/src/vaadin-dialog-base-mixin.js';
|
|
18
|
-
import { dialogOverlay, resizableOverlay } from '@vaadin/dialog/src/vaadin-dialog-styles.js';
|
|
19
17
|
import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
20
|
-
import {
|
|
18
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
21
19
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
22
20
|
import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
23
|
-
import { crudDialogOverlayStyles } from './vaadin-crud-styles.js';
|
|
21
|
+
import { crudDialogOverlayStyles } from './styles/vaadin-crud-dialog-overlay-base-styles.js';
|
|
24
22
|
|
|
25
23
|
/**
|
|
26
24
|
* An element used internally by `<vaadin-crud>`. Not intended to be used separately.
|
|
@@ -32,22 +30,34 @@ import { crudDialogOverlayStyles } from './vaadin-crud-styles.js';
|
|
|
32
30
|
* @mixes ThemableMixin
|
|
33
31
|
* @private
|
|
34
32
|
*/
|
|
35
|
-
class CrudDialogOverlay extends OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
33
|
+
class CrudDialogOverlay extends OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
|
|
36
34
|
static get is() {
|
|
37
35
|
return 'vaadin-crud-dialog-overlay';
|
|
38
36
|
}
|
|
39
37
|
|
|
40
38
|
static get styles() {
|
|
41
|
-
return
|
|
39
|
+
return crudDialogOverlayStyles;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Override method from OverlayFocusMixin to use dialog as focus trap root
|
|
44
|
+
* @protected
|
|
45
|
+
* @override
|
|
46
|
+
*/
|
|
47
|
+
get _focusTrapRoot() {
|
|
48
|
+
// Do not use `owner` since that points to `vaadin-crud`
|
|
49
|
+
return this.getRootNode().host;
|
|
42
50
|
}
|
|
43
51
|
|
|
44
52
|
/** @protected */
|
|
45
53
|
render() {
|
|
46
54
|
return html`
|
|
47
55
|
<div part="backdrop" id="backdrop" ?hidden="${!this.withBackdrop}"></div>
|
|
48
|
-
<div part="overlay" id="overlay"
|
|
56
|
+
<div part="overlay" id="overlay">
|
|
49
57
|
<section id="resizerContainer" class="resizer-container">
|
|
50
|
-
<header part="header"
|
|
58
|
+
<header part="header">
|
|
59
|
+
<slot name="header"></slot>
|
|
60
|
+
</header>
|
|
51
61
|
<div part="content" id="content">
|
|
52
62
|
<slot name="form"></slot>
|
|
53
63
|
</div>
|
|
@@ -80,28 +90,40 @@ defineCustomElement(CrudDialogOverlay);
|
|
|
80
90
|
* An element used internally by `<vaadin-crud>`. Not intended to be used separately.
|
|
81
91
|
* @private
|
|
82
92
|
*/
|
|
83
|
-
class CrudDialog extends DialogBaseMixin(
|
|
93
|
+
class CrudDialog extends DialogBaseMixin(ThemePropertyMixin(PolylitMixin(LitElement))) {
|
|
84
94
|
static get is() {
|
|
85
95
|
return 'vaadin-crud-dialog';
|
|
86
96
|
}
|
|
87
97
|
|
|
88
98
|
static get styles() {
|
|
89
99
|
return css`
|
|
90
|
-
:host
|
|
91
|
-
|
|
100
|
+
:host([opened]),
|
|
101
|
+
:host([opening]),
|
|
102
|
+
:host([closing]) {
|
|
103
|
+
display: block !important;
|
|
104
|
+
position: absolute;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
:host,
|
|
108
|
+
:host([hidden]) {
|
|
109
|
+
display: none !important;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
:host(:focus-visible) ::part(overlay) {
|
|
113
|
+
outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
|
|
92
114
|
}
|
|
93
115
|
`;
|
|
94
116
|
}
|
|
95
117
|
|
|
96
118
|
static get properties() {
|
|
97
119
|
return {
|
|
98
|
-
ariaLabel: {
|
|
99
|
-
type: String,
|
|
100
|
-
},
|
|
101
|
-
|
|
102
120
|
fullscreen: {
|
|
103
121
|
type: Boolean,
|
|
104
122
|
},
|
|
123
|
+
|
|
124
|
+
crudElement: {
|
|
125
|
+
type: Object,
|
|
126
|
+
},
|
|
105
127
|
};
|
|
106
128
|
}
|
|
107
129
|
|
|
@@ -110,20 +132,33 @@ class CrudDialog extends DialogBaseMixin(OverlayClassMixin(ThemePropertyMixin(Po
|
|
|
110
132
|
return html`
|
|
111
133
|
<vaadin-crud-dialog-overlay
|
|
112
134
|
id="overlay"
|
|
135
|
+
.owner="${this.crudElement}"
|
|
113
136
|
.opened="${this.opened}"
|
|
114
|
-
aria-label="${ifDefined(this.ariaLabel)}"
|
|
115
137
|
@opened-changed="${this._onOverlayOpened}"
|
|
116
138
|
@mousedown="${this._bringOverlayToFront}"
|
|
117
139
|
@touchstart="${this._bringOverlayToFront}"
|
|
140
|
+
@vaadin-overlay-outside-click="${this.__cancel}"
|
|
141
|
+
@vaadin-overlay-escape-press="${this.__cancel}"
|
|
118
142
|
theme="${ifDefined(this._theme)}"
|
|
119
143
|
.modeless="${this.modeless}"
|
|
120
144
|
.withBackdrop="${!this.modeless}"
|
|
121
145
|
?fullscreen="${this.fullscreen}"
|
|
122
|
-
role="dialog"
|
|
123
146
|
focus-trap
|
|
124
|
-
|
|
147
|
+
exportparts="backdrop, overlay, header, content, footer"
|
|
148
|
+
>
|
|
149
|
+
<slot name="header" slot="header"></slot>
|
|
150
|
+
<slot name="form" slot="form"></slot>
|
|
151
|
+
<slot name="save-button" slot="save-button"></slot>
|
|
152
|
+
<slot name="cancel-button" slot="cancel-button"></slot>
|
|
153
|
+
<slot name="delete-button" slot="delete-button"></slot>
|
|
154
|
+
</vaadin-crud-dialog-overlay>
|
|
125
155
|
`;
|
|
126
156
|
}
|
|
157
|
+
|
|
158
|
+
/** @private **/
|
|
159
|
+
__cancel() {
|
|
160
|
+
this.dispatchEvent(new CustomEvent('cancel'));
|
|
161
|
+
}
|
|
127
162
|
}
|
|
128
163
|
|
|
129
164
|
defineCustomElement(CrudDialog);
|
package/src/vaadin-crud-edit.js
CHANGED
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
9
|
* license.
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
11
|
+
import { 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 { crudEditStyles } from './styles/vaadin-crud-edit-base-styles.js';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* `<vaadin-crud-edit>` is a helper element for `<vaadin-grid-column>` that provides
|
|
@@ -21,8 +22,7 @@ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
|
21
22
|
* a `<vaadin-crud>` to enable editing.
|
|
22
23
|
*
|
|
23
24
|
* @customElement
|
|
24
|
-
* @extends
|
|
25
|
-
* @mixes ThemableMixin
|
|
25
|
+
* @extends Button
|
|
26
26
|
*/
|
|
27
27
|
class CrudEdit extends Button {
|
|
28
28
|
static get is() {
|
|
@@ -30,14 +30,7 @@ class CrudEdit extends Button {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
static get styles() {
|
|
33
|
-
return [
|
|
34
|
-
super.styles,
|
|
35
|
-
css`
|
|
36
|
-
:host {
|
|
37
|
-
display: block;
|
|
38
|
-
}
|
|
39
|
-
`,
|
|
40
|
-
];
|
|
33
|
+
return [super.styles, crudEditStyles];
|
|
41
34
|
}
|
|
42
35
|
|
|
43
36
|
/** @protected */
|
package/src/vaadin-crud-grid.js
CHANGED
|
@@ -15,6 +15,7 @@ import '@vaadin/grid/src/vaadin-grid-sorter.js';
|
|
|
15
15
|
import './vaadin-crud-edit-column.js';
|
|
16
16
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
17
17
|
import { Grid } from '@vaadin/grid/src/vaadin-grid.js';
|
|
18
|
+
import { crudGridStyles } from './styles/vaadin-crud-grid-base-styles.js';
|
|
18
19
|
import { CrudGridMixin } from './vaadin-crud-grid-mixin.js';
|
|
19
20
|
|
|
20
21
|
/**
|
|
@@ -28,6 +29,10 @@ class CrudGrid extends CrudGridMixin(Grid) {
|
|
|
28
29
|
static get is() {
|
|
29
30
|
return 'vaadin-crud-grid';
|
|
30
31
|
}
|
|
32
|
+
|
|
33
|
+
static get styles() {
|
|
34
|
+
return crudGridStyles;
|
|
35
|
+
}
|
|
31
36
|
}
|
|
32
37
|
|
|
33
38
|
defineCustomElement(CrudGrid);
|