@vaadin/crud 25.0.0-alpha8 → 25.0.0-beta1
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/styles/vaadin-crud-base-styles.js +171 -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 +50 -14
- package/src/vaadin-crud-edit-column.js +4 -4
- 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 +57 -80
- package/src/vaadin-crud.d.ts +17 -2
- package/src/vaadin-crud.js +65 -33
- package/vaadin-crud.js +1 -1
- package/web-types.json +42 -17
- package/web-types.lit.json +20 -13
- package/src/styles/vaadin-crud-core-styles.js +0 -93
- package/src/styles/vaadin-crud-dialog-overlay-core-styles.js +0 -54
- 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/src/styles/{vaadin-crud-core-styles.d.ts → vaadin-crud-base-styles.d.ts} +0 -0
- /package/src/styles/{vaadin-crud-dialog-overlay-core-styles.d.ts → vaadin-crud-dialog-overlay-base-styles.d.ts} +0 -0
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-beta1",
|
|
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-alpha8",
|
|
37
|
+
"@vaadin/a11y-base": "25.0.0-beta1",
|
|
38
|
+
"@vaadin/button": "25.0.0-beta1",
|
|
39
|
+
"@vaadin/component-base": "25.0.0-beta1",
|
|
40
|
+
"@vaadin/confirm-dialog": "25.0.0-beta1",
|
|
41
|
+
"@vaadin/dialog": "25.0.0-beta1",
|
|
42
|
+
"@vaadin/form-layout": "25.0.0-beta1",
|
|
43
|
+
"@vaadin/grid": "25.0.0-beta1",
|
|
44
|
+
"@vaadin/overlay": "25.0.0-beta1",
|
|
45
|
+
"@vaadin/text-field": "25.0.0-beta1",
|
|
46
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-beta1",
|
|
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-beta1",
|
|
51
|
+
"@vaadin/test-runner-commands": "25.0.0-beta1",
|
|
54
52
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
55
|
-
"
|
|
53
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-beta1",
|
|
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": "1d20cf54e582d1f2e209126d4586f8b4c01c50e0"
|
|
63
62
|
}
|
|
@@ -0,0 +1,171 @@
|
|
|
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-m));
|
|
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-dialog-padding, var(--vaadin-padding-l)));
|
|
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-dialog-title-color, var(--vaadin-text-color)));
|
|
135
|
+
font-size: var(--vaadin-crud-header-font-size, var(--vaadin-dialog-title-font-size, 1em));
|
|
136
|
+
font-weight: var(--vaadin-crud-header-font-weight, var(--vaadin-dialog-title-font-weight, 600));
|
|
137
|
+
line-height: var(--vaadin-crud-header-line-height, var(--vaadin-dialog-title-line-height, inherit));
|
|
138
|
+
padding: var(--vaadin-crud-header-padding, var(--vaadin-dialog-padding, var(--vaadin-padding-l)));
|
|
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-dialog-padding, var(--vaadin-padding-l)));
|
|
150
|
+
padding-top: 0;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
[part='footer'] {
|
|
154
|
+
background: var(--vaadin-crud-footer-background, transparent);
|
|
155
|
+
border-top: var(--vaadin-crud-border-width, 1px) solid
|
|
156
|
+
var(--vaadin-crud-border-color, var(--vaadin-border-color-secondary));
|
|
157
|
+
display: flex;
|
|
158
|
+
flex: none;
|
|
159
|
+
gap: var(--vaadin-crud-footer-gap, var(--vaadin-gap-s));
|
|
160
|
+
padding: var(--vaadin-crud-footer-padding, var(--vaadin-dialog-padding, var(--vaadin-padding-l)));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
::slotted([slot='delete-button']) {
|
|
164
|
+
margin-inline-start: auto;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
:host([theme~='no-border']) {
|
|
168
|
+
border: 0;
|
|
169
|
+
border-radius: 0;
|
|
170
|
+
}
|
|
171
|
+
`;
|
|
@@ -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-dialog-title-color, var(--vaadin-text-color));
|
|
18
|
+
font-size: var(--vaadin-dialog-title-font-size, 1em);
|
|
19
|
+
font-weight: var(--vaadin-dialog-title-font-weight, 600);
|
|
20
|
+
line-height: var(--vaadin-dialog-title-line-height, inherit);
|
|
21
|
+
padding: var(--vaadin-crud-header-padding, var(--vaadin-dialog-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: var(--_vaadin-icon-pen) 50% / var(--vaadin-icon-visual-size, 100%) no-repeat;
|
|
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,14 +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
17
|
import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
19
18
|
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
20
19
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
21
20
|
import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
22
|
-
import { crudDialogOverlayStyles } from './styles/vaadin-crud-dialog-overlay-
|
|
21
|
+
import { crudDialogOverlayStyles } from './styles/vaadin-crud-dialog-overlay-base-styles.js';
|
|
23
22
|
|
|
24
23
|
/**
|
|
25
24
|
* An element used internally by `<vaadin-crud>`. Not intended to be used separately.
|
|
@@ -40,13 +39,25 @@ class CrudDialogOverlay extends OverlayMixin(DirMixin(ThemableMixin(PolylitMixin
|
|
|
40
39
|
return crudDialogOverlayStyles;
|
|
41
40
|
}
|
|
42
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;
|
|
50
|
+
}
|
|
51
|
+
|
|
43
52
|
/** @protected */
|
|
44
53
|
render() {
|
|
45
54
|
return html`
|
|
46
55
|
<div part="backdrop" id="backdrop" ?hidden="${!this.withBackdrop}"></div>
|
|
47
|
-
<div part="overlay" id="overlay"
|
|
56
|
+
<div part="overlay" id="overlay">
|
|
48
57
|
<section id="resizerContainer" class="resizer-container">
|
|
49
|
-
<header part="header"
|
|
58
|
+
<header part="header">
|
|
59
|
+
<slot name="header"></slot>
|
|
60
|
+
</header>
|
|
50
61
|
<div part="content" id="content">
|
|
51
62
|
<slot name="form"></slot>
|
|
52
63
|
</div>
|
|
@@ -79,28 +90,40 @@ defineCustomElement(CrudDialogOverlay);
|
|
|
79
90
|
* An element used internally by `<vaadin-crud>`. Not intended to be used separately.
|
|
80
91
|
* @private
|
|
81
92
|
*/
|
|
82
|
-
class CrudDialog extends DialogBaseMixin(
|
|
93
|
+
class CrudDialog extends DialogBaseMixin(ThemePropertyMixin(PolylitMixin(LitElement))) {
|
|
83
94
|
static get is() {
|
|
84
95
|
return 'vaadin-crud-dialog';
|
|
85
96
|
}
|
|
86
97
|
|
|
87
98
|
static get styles() {
|
|
88
99
|
return css`
|
|
89
|
-
:host
|
|
90
|
-
|
|
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);
|
|
91
114
|
}
|
|
92
115
|
`;
|
|
93
116
|
}
|
|
94
117
|
|
|
95
118
|
static get properties() {
|
|
96
119
|
return {
|
|
97
|
-
ariaLabel: {
|
|
98
|
-
type: String,
|
|
99
|
-
},
|
|
100
|
-
|
|
101
120
|
fullscreen: {
|
|
102
121
|
type: Boolean,
|
|
103
122
|
},
|
|
123
|
+
|
|
124
|
+
crudElement: {
|
|
125
|
+
type: Object,
|
|
126
|
+
},
|
|
104
127
|
};
|
|
105
128
|
}
|
|
106
129
|
|
|
@@ -109,20 +132,33 @@ class CrudDialog extends DialogBaseMixin(OverlayClassMixin(ThemePropertyMixin(Po
|
|
|
109
132
|
return html`
|
|
110
133
|
<vaadin-crud-dialog-overlay
|
|
111
134
|
id="overlay"
|
|
135
|
+
.owner="${this.crudElement}"
|
|
112
136
|
.opened="${this.opened}"
|
|
113
|
-
aria-label="${ifDefined(this.ariaLabel)}"
|
|
114
137
|
@opened-changed="${this._onOverlayOpened}"
|
|
115
138
|
@mousedown="${this._bringOverlayToFront}"
|
|
116
139
|
@touchstart="${this._bringOverlayToFront}"
|
|
140
|
+
@vaadin-overlay-outside-click="${this.__cancel}"
|
|
141
|
+
@vaadin-overlay-escape-press="${this.__cancel}"
|
|
117
142
|
theme="${ifDefined(this._theme)}"
|
|
118
143
|
.modeless="${this.modeless}"
|
|
119
144
|
.withBackdrop="${!this.modeless}"
|
|
120
145
|
?fullscreen="${this.fullscreen}"
|
|
121
|
-
role="dialog"
|
|
122
146
|
focus-trap
|
|
123
|
-
|
|
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>
|
|
124
155
|
`;
|
|
125
156
|
}
|
|
157
|
+
|
|
158
|
+
/** @private **/
|
|
159
|
+
__cancel() {
|
|
160
|
+
this.dispatchEvent(new CustomEvent('cancel'));
|
|
161
|
+
}
|
|
126
162
|
}
|
|
127
163
|
|
|
128
164
|
defineCustomElement(CrudDialog);
|
|
@@ -39,12 +39,12 @@ class CrudEditColumn extends GridColumn {
|
|
|
39
39
|
static get properties() {
|
|
40
40
|
return {
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Automatically sets the width of the column based on the column contents when this is set to `true`.
|
|
43
43
|
* @private
|
|
44
44
|
*/
|
|
45
|
-
|
|
46
|
-
type:
|
|
47
|
-
value:
|
|
45
|
+
autoWidth: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
value: true,
|
|
48
48
|
},
|
|
49
49
|
|
|
50
50
|
/**
|
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);
|