@vaadin/crud 24.7.0-alpha2 → 24.7.0-alpha4
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 -16
- package/src/vaadin-crud-controllers.d.ts +1 -1
- package/src/vaadin-crud-controllers.js +1 -1
- package/src/vaadin-crud-dialog.js +1 -1
- package/src/vaadin-crud-edit-column.d.ts +1 -1
- package/src/vaadin-crud-edit-column.js +4 -16
- package/src/vaadin-crud-edit.d.ts +1 -1
- package/src/vaadin-crud-edit.js +1 -1
- package/src/vaadin-crud-form.d.ts +1 -1
- package/src/vaadin-crud-form.js +4 -23
- package/src/vaadin-crud-grid-mixin.d.ts +1 -1
- package/src/vaadin-crud-grid-mixin.js +2 -1
- package/src/vaadin-crud-grid.d.ts +1 -1
- package/src/vaadin-crud-grid.js +1 -1
- package/src/vaadin-crud-helpers.d.ts +1 -1
- package/src/vaadin-crud-helpers.js +45 -1
- package/src/vaadin-crud-include-mixin.d.ts +1 -1
- package/src/vaadin-crud-include-mixin.js +3 -1
- package/src/vaadin-crud-mixin.d.ts +1 -1
- package/src/vaadin-crud-mixin.js +15 -4
- package/src/vaadin-crud-styles.d.ts +1 -1
- package/src/vaadin-crud-styles.js +1 -1
- package/src/vaadin-crud.d.ts +1 -1
- package/src/vaadin-crud.js +1 -1
- package/src/vaadin-lit-crud-dialog.d.ts +11 -0
- package/src/vaadin-lit-crud-dialog.js +128 -0
- package/src/vaadin-lit-crud-edit-column.d.ts +11 -0
- package/src/vaadin-lit-crud-edit-column.js +70 -0
- package/src/vaadin-lit-crud-edit.d.ts +11 -0
- package/src/vaadin-lit-crud-edit.js +75 -0
- package/src/vaadin-lit-crud-form.d.ts +11 -0
- package/src/vaadin-lit-crud-form.js +80 -0
- package/src/vaadin-lit-crud-grid.d.ts +11 -0
- package/src/vaadin-lit-crud-grid.js +35 -0
- package/src/vaadin-lit-crud.js +122 -0
- package/theme/lumo/vaadin-lit-crud.d.ts +8 -0
- package/theme/lumo/vaadin-lit-crud.js +8 -0
- package/theme/material/vaadin-lit-crud.d.ts +8 -0
- package/theme/material/vaadin-lit-crud.js +8 -0
- package/vaadin-lit-crud-edit .js +1 -0
- package/vaadin-lit-crud-edit-column.js +1 -0
- package/vaadin-lit-crud.js +2 -0
- package/web-types.json +6 -6
- package/web-types.lit.json +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/crud",
|
|
3
|
-
"version": "24.7.0-
|
|
3
|
+
"version": "24.7.0-alpha4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,22 +37,22 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
39
39
|
"@polymer/polymer": "^3.0.0",
|
|
40
|
-
"@vaadin/a11y-base": "24.7.0-
|
|
41
|
-
"@vaadin/button": "24.7.0-
|
|
42
|
-
"@vaadin/component-base": "24.7.0-
|
|
43
|
-
"@vaadin/confirm-dialog": "24.7.0-
|
|
44
|
-
"@vaadin/dialog": "24.7.0-
|
|
45
|
-
"@vaadin/form-layout": "24.7.0-
|
|
46
|
-
"@vaadin/grid": "24.7.0-
|
|
47
|
-
"@vaadin/overlay": "24.7.0-
|
|
48
|
-
"@vaadin/text-field": "24.7.0-
|
|
49
|
-
"@vaadin/vaadin-lumo-styles": "24.7.0-
|
|
50
|
-
"@vaadin/vaadin-material-styles": "24.7.0-
|
|
51
|
-
"@vaadin/vaadin-themable-mixin": "24.7.0-
|
|
40
|
+
"@vaadin/a11y-base": "24.7.0-alpha4",
|
|
41
|
+
"@vaadin/button": "24.7.0-alpha4",
|
|
42
|
+
"@vaadin/component-base": "24.7.0-alpha4",
|
|
43
|
+
"@vaadin/confirm-dialog": "24.7.0-alpha4",
|
|
44
|
+
"@vaadin/dialog": "24.7.0-alpha4",
|
|
45
|
+
"@vaadin/form-layout": "24.7.0-alpha4",
|
|
46
|
+
"@vaadin/grid": "24.7.0-alpha4",
|
|
47
|
+
"@vaadin/overlay": "24.7.0-alpha4",
|
|
48
|
+
"@vaadin/text-field": "24.7.0-alpha4",
|
|
49
|
+
"@vaadin/vaadin-lumo-styles": "24.7.0-alpha4",
|
|
50
|
+
"@vaadin/vaadin-material-styles": "24.7.0-alpha4",
|
|
51
|
+
"@vaadin/vaadin-themable-mixin": "24.7.0-alpha4"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@vaadin/chai-plugins": "24.7.0-
|
|
55
|
-
"@vaadin/testing-helpers": "^1.
|
|
54
|
+
"@vaadin/chai-plugins": "24.7.0-alpha4",
|
|
55
|
+
"@vaadin/testing-helpers": "^1.1.0",
|
|
56
56
|
"sinon": "^18.0.0"
|
|
57
57
|
},
|
|
58
58
|
"cvdlName": "vaadin-crud",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"web-types.json",
|
|
61
61
|
"web-types.lit.json"
|
|
62
62
|
],
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "d7165cebf9dcf6a7e9e22f6353662d33404b4856"
|
|
64
64
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2000 -
|
|
3
|
+
* Copyright (c) 2000 - 2025 Vaadin Ltd.
|
|
4
4
|
*
|
|
5
5
|
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
6
|
*
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import './vaadin-crud-edit.js';
|
|
12
12
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
13
13
|
import { GridColumn } from '@vaadin/grid/src/vaadin-grid-column.js';
|
|
14
|
+
import { editColumnDefaultRenderer } from './vaadin-crud-helpers.js';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* `<vaadin-crud-edit-column>` is a helper element for the `<vaadin-grid>`
|
|
@@ -69,21 +70,8 @@ class CrudEditColumn extends GridColumn {
|
|
|
69
70
|
*
|
|
70
71
|
* @override
|
|
71
72
|
*/
|
|
72
|
-
_defaultRenderer(root,
|
|
73
|
-
|
|
74
|
-
if (!edit) {
|
|
75
|
-
edit = document.createElement('vaadin-crud-edit');
|
|
76
|
-
if (this.hasAttribute('theme')) {
|
|
77
|
-
edit.setAttribute('theme', this.getAttribute('theme'));
|
|
78
|
-
}
|
|
79
|
-
root.appendChild(edit);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (this.ariaLabel) {
|
|
83
|
-
edit.setAttribute('aria-label', this.ariaLabel);
|
|
84
|
-
} else {
|
|
85
|
-
edit.removeAttribute('aria-label');
|
|
86
|
-
}
|
|
73
|
+
_defaultRenderer(root, column) {
|
|
74
|
+
editColumnDefaultRenderer(root, column);
|
|
87
75
|
}
|
|
88
76
|
}
|
|
89
77
|
|
package/src/vaadin-crud-edit.js
CHANGED
package/src/vaadin-crud-form.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2000 -
|
|
3
|
+
* Copyright (c) 2000 - 2025 Vaadin Ltd.
|
|
4
4
|
*
|
|
5
5
|
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
6
|
*
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import '@vaadin/text-field/src/vaadin-text-field.js';
|
|
12
12
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
13
13
|
import { FormLayout } from '@vaadin/form-layout/src/vaadin-form-layout.js';
|
|
14
|
-
import {
|
|
14
|
+
import { createField, createFields } from './vaadin-crud-helpers.js';
|
|
15
15
|
import { IncludedMixin } from './vaadin-crud-include-mixin.js';
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -64,31 +64,12 @@ class CrudForm extends IncludedMixin(FormLayout) {
|
|
|
64
64
|
|
|
65
65
|
/** @private */
|
|
66
66
|
__createField(parent, path) {
|
|
67
|
-
|
|
68
|
-
field.label = capitalize(path);
|
|
69
|
-
field.path = path;
|
|
70
|
-
field.required = true;
|
|
71
|
-
parent.appendChild(field);
|
|
72
|
-
this._fields.push(field);
|
|
73
|
-
return field;
|
|
67
|
+
return createField(this, parent, path);
|
|
74
68
|
}
|
|
75
69
|
|
|
76
70
|
/** @private */
|
|
77
71
|
__createFields(parent, object, path) {
|
|
78
|
-
|
|
79
|
-
if (!this.include && this.exclude && this.exclude.test(prop)) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
const newPath = (path ? `${path}.` : '') + prop;
|
|
83
|
-
if (object[prop] && typeof object[prop] === 'object') {
|
|
84
|
-
this.__createFields(parent, object[prop], newPath);
|
|
85
|
-
} else {
|
|
86
|
-
this.__createField(parent, newPath);
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
if (!this._fields.length) {
|
|
90
|
-
this._fields = undefined;
|
|
91
|
-
}
|
|
72
|
+
return createFields(this, parent, object, path);
|
|
92
73
|
}
|
|
93
74
|
}
|
|
94
75
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2000 -
|
|
3
|
+
* Copyright (c) 2000 - 2025 Vaadin Ltd.
|
|
4
4
|
*
|
|
5
5
|
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
6
|
*
|
|
@@ -45,6 +45,7 @@ export const CrudGridMixin = (superClass) =>
|
|
|
45
45
|
*/
|
|
46
46
|
hideEditColumn: {
|
|
47
47
|
type: Boolean,
|
|
48
|
+
sync: true,
|
|
48
49
|
},
|
|
49
50
|
};
|
|
50
51
|
}
|
package/src/vaadin-crud-grid.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2000 -
|
|
3
|
+
* Copyright (c) 2000 - 2025 Vaadin Ltd.
|
|
4
4
|
*
|
|
5
5
|
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
6
|
*
|
|
@@ -66,3 +66,47 @@ export function setProperty(path, value, obj) {
|
|
|
66
66
|
export function isValidEditorPosition(editorPosition) {
|
|
67
67
|
return ['bottom', 'aside'].includes(editorPosition);
|
|
68
68
|
}
|
|
69
|
+
|
|
70
|
+
export function editColumnDefaultRenderer(root, column) {
|
|
71
|
+
let edit = root.firstElementChild;
|
|
72
|
+
if (!edit) {
|
|
73
|
+
edit = document.createElement('vaadin-crud-edit');
|
|
74
|
+
if (column.hasAttribute('theme')) {
|
|
75
|
+
edit.setAttribute('theme', column.getAttribute('theme'));
|
|
76
|
+
}
|
|
77
|
+
root.appendChild(edit);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (column.ariaLabel) {
|
|
81
|
+
edit.setAttribute('aria-label', column.ariaLabel);
|
|
82
|
+
} else {
|
|
83
|
+
edit.removeAttribute('aria-label');
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function createField(crudForm, parent, path) {
|
|
88
|
+
const field = document.createElement('vaadin-text-field');
|
|
89
|
+
field.label = capitalize(path);
|
|
90
|
+
field.path = path;
|
|
91
|
+
field.required = true;
|
|
92
|
+
parent.appendChild(field);
|
|
93
|
+
crudForm._fields.push(field);
|
|
94
|
+
return field;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function createFields(crudForm, parent, object, path) {
|
|
98
|
+
Object.keys(object).forEach((prop) => {
|
|
99
|
+
if (!crudForm.include && crudForm.exclude && crudForm.exclude.test(prop)) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const newPath = (path ? `${path}.` : '') + prop;
|
|
103
|
+
if (object[prop] && typeof object[prop] === 'object') {
|
|
104
|
+
createFields(crudForm, parent, object[prop], newPath);
|
|
105
|
+
} else {
|
|
106
|
+
createField(crudForm, parent, newPath);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
if (!crudForm._fields.length) {
|
|
110
|
+
crudForm._fields = undefined;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2000 -
|
|
3
|
+
* Copyright (c) 2000 - 2025 Vaadin Ltd.
|
|
4
4
|
*
|
|
5
5
|
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
6
|
*
|
|
@@ -29,6 +29,7 @@ export const IncludedMixin = (superClass) =>
|
|
|
29
29
|
exclude: {
|
|
30
30
|
value: '^_',
|
|
31
31
|
observer: '__onExcludeChange',
|
|
32
|
+
sync: true,
|
|
32
33
|
},
|
|
33
34
|
|
|
34
35
|
/**
|
|
@@ -40,6 +41,7 @@ export const IncludedMixin = (superClass) =>
|
|
|
40
41
|
*/
|
|
41
42
|
include: {
|
|
42
43
|
observer: '__onIncludeChange',
|
|
44
|
+
sync: true,
|
|
43
45
|
},
|
|
44
46
|
};
|
|
45
47
|
}
|
package/src/vaadin-crud-mixin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2000 -
|
|
3
|
+
* Copyright (c) 2000 - 2025 Vaadin Ltd.
|
|
4
4
|
*
|
|
5
5
|
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
6
|
*
|
|
@@ -100,6 +100,7 @@ export const CrudMixin = (superClass) =>
|
|
|
100
100
|
type: Object,
|
|
101
101
|
observer: '__editedItemChanged',
|
|
102
102
|
notify: true,
|
|
103
|
+
sync: true,
|
|
103
104
|
},
|
|
104
105
|
|
|
105
106
|
/**
|
|
@@ -117,6 +118,7 @@ export const CrudMixin = (superClass) =>
|
|
|
117
118
|
value: '',
|
|
118
119
|
reflectToAttribute: true,
|
|
119
120
|
observer: '__editorPositionChanged',
|
|
121
|
+
sync: true,
|
|
120
122
|
},
|
|
121
123
|
|
|
122
124
|
/**
|
|
@@ -128,6 +130,7 @@ export const CrudMixin = (superClass) =>
|
|
|
128
130
|
editOnClick: {
|
|
129
131
|
type: Boolean,
|
|
130
132
|
value: false,
|
|
133
|
+
sync: true,
|
|
131
134
|
},
|
|
132
135
|
|
|
133
136
|
/**
|
|
@@ -194,6 +197,7 @@ export const CrudMixin = (superClass) =>
|
|
|
194
197
|
reflectToAttribute: true,
|
|
195
198
|
notify: true,
|
|
196
199
|
observer: '__editorOpenedChanged',
|
|
200
|
+
sync: true,
|
|
197
201
|
},
|
|
198
202
|
|
|
199
203
|
/**
|
|
@@ -218,6 +222,7 @@ export const CrudMixin = (superClass) =>
|
|
|
218
222
|
type: Boolean,
|
|
219
223
|
value: false,
|
|
220
224
|
reflectToAttribute: true,
|
|
225
|
+
sync: true,
|
|
221
226
|
},
|
|
222
227
|
|
|
223
228
|
/**
|
|
@@ -261,6 +266,7 @@ export const CrudMixin = (superClass) =>
|
|
|
261
266
|
*/
|
|
262
267
|
i18n: {
|
|
263
268
|
type: Object,
|
|
269
|
+
sync: true,
|
|
264
270
|
value() {
|
|
265
271
|
return {
|
|
266
272
|
newItem: 'New item',
|
|
@@ -295,7 +301,10 @@ export const CrudMixin = (superClass) =>
|
|
|
295
301
|
__dialogAriaLabel: String,
|
|
296
302
|
|
|
297
303
|
/** @private */
|
|
298
|
-
__isDirty:
|
|
304
|
+
__isDirty: {
|
|
305
|
+
type: Boolean,
|
|
306
|
+
sync: true,
|
|
307
|
+
},
|
|
299
308
|
|
|
300
309
|
/** @private */
|
|
301
310
|
__isNew: Boolean,
|
|
@@ -307,6 +316,7 @@ export const CrudMixin = (superClass) =>
|
|
|
307
316
|
_fullscreen: {
|
|
308
317
|
type: Boolean,
|
|
309
318
|
observer: '__fullscreenChanged',
|
|
319
|
+
sync: true,
|
|
310
320
|
},
|
|
311
321
|
|
|
312
322
|
/**
|
|
@@ -502,14 +512,15 @@ export const CrudMixin = (superClass) =>
|
|
|
502
512
|
|
|
503
513
|
/** @private */
|
|
504
514
|
__moveChildNodes(target) {
|
|
505
|
-
const nodes = [this._headerNode, this._form
|
|
515
|
+
const nodes = [this._headerNode, this._form];
|
|
516
|
+
const buttons = [this._saveButton, this._cancelButton, this._deleteButton].filter(Boolean);
|
|
506
517
|
if (!nodes.every((node) => node instanceof HTMLElement)) {
|
|
507
518
|
return;
|
|
508
519
|
}
|
|
509
520
|
|
|
510
521
|
// Teleport header node, form, and the buttons to corresponding slots.
|
|
511
522
|
// NOTE: order in which buttons are moved matches the order of slots.
|
|
512
|
-
nodes.forEach((node) => {
|
|
523
|
+
[...nodes, ...buttons].forEach((node) => {
|
|
513
524
|
target.appendChild(node);
|
|
514
525
|
});
|
|
515
526
|
|
package/src/vaadin-crud.d.ts
CHANGED
package/src/vaadin-crud.js
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
export * from './vaadin-crud-dialog.js';
|
|
@@ -0,0 +1,128 @@
|
|
|
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 { css, html, LitElement } from 'lit';
|
|
12
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
13
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
14
|
+
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
15
|
+
import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
16
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
17
|
+
import { DialogBaseMixin } from '@vaadin/dialog/src/vaadin-dialog-base-mixin.js';
|
|
18
|
+
import { dialogOverlay, resizableOverlay } from '@vaadin/dialog/src/vaadin-dialog-styles.js';
|
|
19
|
+
import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
20
|
+
import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
|
|
21
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
22
|
+
import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
23
|
+
import { crudDialogOverlayStyles } from './vaadin-crud-styles.js';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* An element used internally by `<vaadin-crud>`. Not intended to be used separately.
|
|
27
|
+
*
|
|
28
|
+
* @extends HTMLElement
|
|
29
|
+
* @mixes DirMixin
|
|
30
|
+
* @mixes OverlayMixin
|
|
31
|
+
* @mixes ThemableMixin
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
class CrudDialogOverlay extends OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
35
|
+
static get is() {
|
|
36
|
+
return 'vaadin-crud-dialog-overlay';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static get styles() {
|
|
40
|
+
return [overlayStyles, dialogOverlay, resizableOverlay, crudDialogOverlayStyles];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** @protected */
|
|
44
|
+
render() {
|
|
45
|
+
return html`
|
|
46
|
+
<div part="backdrop" id="backdrop" ?hidden="${!this.withBackdrop}"></div>
|
|
47
|
+
<div part="overlay" id="overlay" tabindex="0">
|
|
48
|
+
<section id="resizerContainer" class="resizer-container">
|
|
49
|
+
<header part="header"><slot name="header"></slot></header>
|
|
50
|
+
<div part="content" id="content">
|
|
51
|
+
<slot name="form"></slot>
|
|
52
|
+
</div>
|
|
53
|
+
<footer part="footer" role="toolbar">
|
|
54
|
+
<slot name="save-button"></slot>
|
|
55
|
+
<slot name="cancel-button"></slot>
|
|
56
|
+
<slot name="delete-button"></slot>
|
|
57
|
+
</footer>
|
|
58
|
+
</section>
|
|
59
|
+
</div>
|
|
60
|
+
`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @protected
|
|
65
|
+
* @override
|
|
66
|
+
*/
|
|
67
|
+
ready() {
|
|
68
|
+
super.ready();
|
|
69
|
+
|
|
70
|
+
// CRUD has header and footer but does not use renderers
|
|
71
|
+
this.setAttribute('has-header', '');
|
|
72
|
+
this.setAttribute('has-footer', '');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
defineCustomElement(CrudDialogOverlay);
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* An element used internally by `<vaadin-crud>`. Not intended to be used separately.
|
|
80
|
+
* @private
|
|
81
|
+
*/
|
|
82
|
+
class CrudDialog extends DialogBaseMixin(OverlayClassMixin(ThemePropertyMixin(PolylitMixin(LitElement)))) {
|
|
83
|
+
static get is() {
|
|
84
|
+
return 'vaadin-crud-dialog';
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
static get styles() {
|
|
88
|
+
return css`
|
|
89
|
+
:host {
|
|
90
|
+
display: none;
|
|
91
|
+
}
|
|
92
|
+
`;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
static get properties() {
|
|
96
|
+
return {
|
|
97
|
+
ariaLabel: {
|
|
98
|
+
type: String,
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
fullscreen: {
|
|
102
|
+
type: Boolean,
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** @protected */
|
|
108
|
+
render() {
|
|
109
|
+
return html`
|
|
110
|
+
<vaadin-crud-dialog-overlay
|
|
111
|
+
id="overlay"
|
|
112
|
+
.opened="${this.opened}"
|
|
113
|
+
aria-label="${ifDefined(this.ariaLabel)}"
|
|
114
|
+
@opened-changed="${this._onOverlayOpened}"
|
|
115
|
+
@mousedown="${this._bringOverlayToFront}"
|
|
116
|
+
@touchstart="${this._bringOverlayToFront}"
|
|
117
|
+
theme="${ifDefined(this._theme)}"
|
|
118
|
+
.modeless="${this.modeless}"
|
|
119
|
+
.withBackdrop="${!this.modeless}"
|
|
120
|
+
?fullscreen="${this.fullscreen}"
|
|
121
|
+
role="dialog"
|
|
122
|
+
focus-trap
|
|
123
|
+
></vaadin-crud-dialog-overlay>
|
|
124
|
+
`;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
defineCustomElement(CrudDialog);
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
export * from './vaadin-crud-edit-column.js';
|
|
@@ -0,0 +1,70 @@
|
|
|
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-lit-crud-edit.js';
|
|
12
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
13
|
+
import { GridColumn } from '@vaadin/grid/src/vaadin-lit-grid-column.js';
|
|
14
|
+
import { editColumnDefaultRenderer } from './vaadin-crud-helpers.js';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* LitElement based version of `<vaadin-crud-edit-column>` web component.
|
|
18
|
+
*
|
|
19
|
+
* ## Disclaimer
|
|
20
|
+
*
|
|
21
|
+
* This component is an experiment and not yet a part of Vaadin platform.
|
|
22
|
+
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
23
|
+
*/
|
|
24
|
+
class CrudEditColumn extends GridColumn {
|
|
25
|
+
static get is() {
|
|
26
|
+
return 'vaadin-crud-edit-column';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static get properties() {
|
|
30
|
+
return {
|
|
31
|
+
/**
|
|
32
|
+
* Width of the cells for this column.
|
|
33
|
+
* @private
|
|
34
|
+
*/
|
|
35
|
+
width: {
|
|
36
|
+
type: String,
|
|
37
|
+
value: '4rem',
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Flex grow ratio for the cell widths. When set to 0, cell width is fixed.
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
flexGrow: {
|
|
45
|
+
type: Number,
|
|
46
|
+
value: 0,
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
/** The arial-label for the edit button */
|
|
50
|
+
ariaLabel: String,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static get observers() {
|
|
55
|
+
return ['_onRendererOrBindingChanged(_renderer, _cells, _bodyContentHidden, _cells.*, path, ariaLabel)'];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Renders the crud edit element to the body cell.
|
|
60
|
+
*
|
|
61
|
+
* @override
|
|
62
|
+
*/
|
|
63
|
+
_defaultRenderer(root, column) {
|
|
64
|
+
editColumnDefaultRenderer(root, column);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
defineCustomElement(CrudEditColumn);
|
|
69
|
+
|
|
70
|
+
export { CrudEditColumn };
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
export * from './vaadin-crud-edit.js';
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
|
|
12
|
+
import { html } from 'lit';
|
|
13
|
+
import { Button } from '@vaadin/button/src/vaadin-lit-button.js';
|
|
14
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
15
|
+
import { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* LitElement based version of `<vaadin-crud-edit>` web component.
|
|
19
|
+
*
|
|
20
|
+
* ## Disclaimer
|
|
21
|
+
*
|
|
22
|
+
* This component is an experiment and not yet a part of Vaadin platform.
|
|
23
|
+
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
24
|
+
*/
|
|
25
|
+
class CrudEdit extends Button {
|
|
26
|
+
static get is() {
|
|
27
|
+
return 'vaadin-crud-edit';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static get styles() {
|
|
31
|
+
return [
|
|
32
|
+
super.styles,
|
|
33
|
+
css`
|
|
34
|
+
:host {
|
|
35
|
+
display: block;
|
|
36
|
+
}
|
|
37
|
+
`,
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** @protected */
|
|
42
|
+
render() {
|
|
43
|
+
return html`
|
|
44
|
+
<div part="icon"></div>
|
|
45
|
+
<slot name="tooltip"></slot>
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** @protected */
|
|
50
|
+
ready() {
|
|
51
|
+
super.ready();
|
|
52
|
+
this.addEventListener('click', this.__onClick);
|
|
53
|
+
this.setAttribute('aria-label', 'Edit');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** @private */
|
|
57
|
+
__onClick(e) {
|
|
58
|
+
const tr = e.target.parentElement.assignedSlot.parentElement.parentElement;
|
|
59
|
+
tr.dispatchEvent(
|
|
60
|
+
new CustomEvent('edit', { detail: { item: tr._item, index: tr.index }, bubbles: true, composed: true }),
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Fired when user on the icon.
|
|
66
|
+
*
|
|
67
|
+
* @event edit
|
|
68
|
+
* @param {Object} detail.item the item to edit
|
|
69
|
+
* @param {Object} detail.index the index of the item in the data set
|
|
70
|
+
*/
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
defineCustomElement(CrudEdit);
|
|
74
|
+
|
|
75
|
+
export { CrudEdit };
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
export * from './vaadin-crud-form.js';
|
|
@@ -0,0 +1,80 @@
|
|
|
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/text-field/src/vaadin-lit-text-field.js';
|
|
12
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
13
|
+
import { FormLayout } from '@vaadin/form-layout/src/vaadin-lit-form-layout.js';
|
|
14
|
+
import { createField, createFields } from './vaadin-crud-helpers.js';
|
|
15
|
+
import { IncludedMixin } from './vaadin-crud-include-mixin.js';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* An element used internally by `<vaadin-crud>`. Not intended to be used separately.
|
|
19
|
+
*
|
|
20
|
+
* @extends FormLayout
|
|
21
|
+
* @mixes IncludedMixin
|
|
22
|
+
* @private
|
|
23
|
+
*/
|
|
24
|
+
class CrudForm extends IncludedMixin(FormLayout) {
|
|
25
|
+
static get is() {
|
|
26
|
+
return 'vaadin-crud-form';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static get properties() {
|
|
30
|
+
return {
|
|
31
|
+
/**
|
|
32
|
+
* The item being edited.
|
|
33
|
+
* @type {unknown}
|
|
34
|
+
*/
|
|
35
|
+
item: {
|
|
36
|
+
type: Object,
|
|
37
|
+
sync: true,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static get observers() {
|
|
43
|
+
return ['__onItemChange(item)'];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Auto-generate form fields based on the JSON structure of the object provided.
|
|
48
|
+
*
|
|
49
|
+
* If not called, the method will be executed the first time an item is assigned.
|
|
50
|
+
* @param {unknown} object
|
|
51
|
+
* @protected
|
|
52
|
+
*/
|
|
53
|
+
_configure(object) {
|
|
54
|
+
this.innerHTML = '';
|
|
55
|
+
this._fields = [];
|
|
56
|
+
this.__createFields(this, object);
|
|
57
|
+
this._updateLayout();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** @private */
|
|
61
|
+
__onItemChange(item) {
|
|
62
|
+
if (!this._fields) {
|
|
63
|
+
this._configure(item);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** @private */
|
|
68
|
+
__createField(parent, path) {
|
|
69
|
+
return createField(this, parent, path);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** @private */
|
|
73
|
+
__createFields(parent, object, path) {
|
|
74
|
+
return createFields(this, parent, object, path);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
defineCustomElement(CrudForm);
|
|
79
|
+
|
|
80
|
+
export { CrudForm };
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
export * from './vaadin-crud-grid.js';
|
|
@@ -0,0 +1,35 @@
|
|
|
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/grid/src/vaadin-lit-grid-column-group.js';
|
|
12
|
+
import '@vaadin/grid/src/vaadin-lit-grid-column.js';
|
|
13
|
+
import '@vaadin/grid/src/vaadin-lit-grid-filter.js';
|
|
14
|
+
import '@vaadin/grid/src/vaadin-lit-grid-sorter.js';
|
|
15
|
+
import './vaadin-lit-crud-edit-column.js';
|
|
16
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
17
|
+
import { Grid } from '@vaadin/grid/src/vaadin-lit-grid.js';
|
|
18
|
+
import { CrudGridMixin } from './vaadin-crud-grid-mixin.js';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* An element used internally by `<vaadin-crud>`. Not intended to be used separately.
|
|
22
|
+
*
|
|
23
|
+
* @extends Grid
|
|
24
|
+
* @mixes CrudGridMixin
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
class CrudGrid extends CrudGridMixin(Grid) {
|
|
28
|
+
static get is() {
|
|
29
|
+
return 'vaadin-crud-grid';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
defineCustomElement(CrudGrid);
|
|
34
|
+
|
|
35
|
+
export { CrudGrid };
|
|
@@ -0,0 +1,122 @@
|
|
|
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/button/src/vaadin-lit-button.js';
|
|
12
|
+
import '@vaadin/confirm-dialog/src/vaadin-lit-confirm-dialog.js';
|
|
13
|
+
import './vaadin-lit-crud-dialog.js';
|
|
14
|
+
import './vaadin-lit-crud-grid.js';
|
|
15
|
+
import './vaadin-lit-crud-form.js';
|
|
16
|
+
import { html, LitElement } from 'lit';
|
|
17
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
18
|
+
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
19
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
20
|
+
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
21
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
22
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
23
|
+
import { CrudMixin } from './vaadin-crud-mixin.js';
|
|
24
|
+
import { crudStyles } from './vaadin-crud-styles.js';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* LitElement based version of `<vaadin-crud>` web component.
|
|
28
|
+
*
|
|
29
|
+
* ## Disclaimer
|
|
30
|
+
*
|
|
31
|
+
* This component is an experiment and not yet a part of Vaadin platform.
|
|
32
|
+
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
33
|
+
*/
|
|
34
|
+
class Crud extends ControllerMixin(ElementMixin(ThemableMixin(CrudMixin(PolylitMixin(LitElement))))) {
|
|
35
|
+
static get styles() {
|
|
36
|
+
return crudStyles;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** @protected */
|
|
40
|
+
render() {
|
|
41
|
+
return html`
|
|
42
|
+
<div id="container">
|
|
43
|
+
<div id="main">
|
|
44
|
+
<slot name="grid"></slot>
|
|
45
|
+
|
|
46
|
+
<div id="toolbar" part="toolbar">
|
|
47
|
+
<slot name="toolbar"></slot>
|
|
48
|
+
<slot name="new-button"></slot>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<div
|
|
53
|
+
part="editor"
|
|
54
|
+
id="editor"
|
|
55
|
+
role="group"
|
|
56
|
+
aria-labelledby="header"
|
|
57
|
+
?hidden="${this.__computeEditorHidden(this.editorOpened, this._fullscreen, this.editorPosition)}"
|
|
58
|
+
>
|
|
59
|
+
<div part="scroller" id="scroller">
|
|
60
|
+
<div part="header" id="header">
|
|
61
|
+
<slot name="header"></slot>
|
|
62
|
+
</div>
|
|
63
|
+
<slot name="form"></slot>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<div part="footer" role="toolbar">
|
|
67
|
+
<slot name="save-button"></slot>
|
|
68
|
+
<slot name="cancel-button"></slot>
|
|
69
|
+
<slot name="delete-button"></slot>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
<vaadin-crud-dialog
|
|
75
|
+
id="dialog"
|
|
76
|
+
.opened="${this.__computeDialogOpened(this.editorOpened, this._fullscreen, this.editorPosition)}"
|
|
77
|
+
.fullscreen="${this._fullscreen}"
|
|
78
|
+
.ariaLabel="${this.__dialogAriaLabel}"
|
|
79
|
+
.noCloseOnOutsideClick="${this.__isDirty}"
|
|
80
|
+
.noCloseOnEsc="${this.__isDirty}"
|
|
81
|
+
theme="${ifDefined(this._theme)}"
|
|
82
|
+
@opened-changed="${this.__onDialogOpened}"
|
|
83
|
+
></vaadin-crud-dialog>
|
|
84
|
+
|
|
85
|
+
<vaadin-confirm-dialog
|
|
86
|
+
theme="${ifDefined(this._theme)}"
|
|
87
|
+
id="confirmCancel"
|
|
88
|
+
@confirm="${this.__confirmCancel}"
|
|
89
|
+
cancel-button-visible
|
|
90
|
+
.confirmText="${this.i18n.confirm.cancel.button.confirm}"
|
|
91
|
+
.cancelText="${this.i18n.confirm.cancel.button.dismiss}"
|
|
92
|
+
.header="${this.i18n.confirm.cancel.title}"
|
|
93
|
+
.message="${this.i18n.confirm.cancel.content}"
|
|
94
|
+
confirm-theme="primary"
|
|
95
|
+
></vaadin-confirm-dialog>
|
|
96
|
+
|
|
97
|
+
<vaadin-confirm-dialog
|
|
98
|
+
theme="${ifDefined(this._theme)}"
|
|
99
|
+
id="confirmDelete"
|
|
100
|
+
@confirm="${this.__confirmDelete}"
|
|
101
|
+
cancel-button-visible
|
|
102
|
+
.confirmText="${this.i18n.confirm.delete.button.confirm}"
|
|
103
|
+
.cancelText="${this.i18n.confirm.delete.button.dismiss}"
|
|
104
|
+
.header="${this.i18n.confirm.delete.title}"
|
|
105
|
+
.message="${this.i18n.confirm.delete.content}"
|
|
106
|
+
confirm-theme="primary error"
|
|
107
|
+
></vaadin-confirm-dialog>
|
|
108
|
+
`;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
static get is() {
|
|
112
|
+
return 'vaadin-crud';
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
static get cvdlName() {
|
|
116
|
+
return 'vaadin-crud';
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
defineCustomElement(Crud);
|
|
121
|
+
|
|
122
|
+
export { Crud };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import '@vaadin/button/theme/lumo/vaadin-lit-button.js';
|
|
2
|
+
import '@vaadin/confirm-dialog/theme/lumo/vaadin-lit-confirm-dialog.js';
|
|
3
|
+
import '@vaadin/form-layout/theme/lumo/vaadin-lit-form-layout.js';
|
|
4
|
+
import '@vaadin/grid/theme/lumo/vaadin-lit-grid.js';
|
|
5
|
+
import '@vaadin/grid/theme/lumo/vaadin-lit-grid-sorter.js';
|
|
6
|
+
import '@vaadin/text-field/theme/lumo/vaadin-lit-text-field.js';
|
|
7
|
+
import './vaadin-crud-styles.js';
|
|
8
|
+
import '../../src/vaadin-lit-crud.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import '@vaadin/button/theme/lumo/vaadin-lit-button.js';
|
|
2
|
+
import '@vaadin/confirm-dialog/theme/lumo/vaadin-lit-confirm-dialog.js';
|
|
3
|
+
import '@vaadin/form-layout/theme/lumo/vaadin-lit-form-layout.js';
|
|
4
|
+
import '@vaadin/grid/theme/lumo/vaadin-lit-grid.js';
|
|
5
|
+
import '@vaadin/grid/theme/lumo/vaadin-lit-grid-sorter.js';
|
|
6
|
+
import '@vaadin/text-field/theme/lumo/vaadin-lit-text-field.js';
|
|
7
|
+
import './vaadin-crud-styles.js';
|
|
8
|
+
import '../../src/vaadin-lit-crud.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import '@vaadin/button/theme/material/vaadin-lit-button.js';
|
|
2
|
+
import '@vaadin/confirm-dialog/theme/material/vaadin-lit-confirm-dialog.js';
|
|
3
|
+
import '@vaadin/form-layout/theme/material/vaadin-lit-form-layout.js';
|
|
4
|
+
import '@vaadin/grid/theme/material/vaadin-lit-grid.js';
|
|
5
|
+
import '@vaadin/grid/theme/material/vaadin-lit-grid-sorter.js';
|
|
6
|
+
import '@vaadin/text-field/theme/material/vaadin-lit-text-field.js';
|
|
7
|
+
import './vaadin-crud-styles.js';
|
|
8
|
+
import '../../src/vaadin-lit-crud.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import '@vaadin/button/theme/material/vaadin-lit-button.js';
|
|
2
|
+
import '@vaadin/confirm-dialog/theme/material/vaadin-lit-confirm-dialog.js';
|
|
3
|
+
import '@vaadin/form-layout/theme/material/vaadin-lit-form-layout.js';
|
|
4
|
+
import '@vaadin/grid/theme/material/vaadin-lit-grid.js';
|
|
5
|
+
import '@vaadin/grid/theme/material/vaadin-lit-grid-sorter.js';
|
|
6
|
+
import '@vaadin/text-field/theme/material/vaadin-lit-text-field.js';
|
|
7
|
+
import './vaadin-crud-styles.js';
|
|
8
|
+
import '../../src/vaadin-lit-crud.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/vaadin-lit-crud-edit.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/vaadin-lit-crud-edit-column.js';
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/crud",
|
|
4
|
-
"version": "24.7.0-
|
|
4
|
+
"version": "24.7.0-alpha4",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -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/24.7.0-
|
|
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/24.7.0-alpha4/#/elements/vaadin-crud#property-items) property.\n\nA grid and an editor will be automatically generated and configured based on the data structure provided.\n\n```html\n<vaadin-crud></vaadin-crud>\n```\n```js\nconst crud = document.querySelector('vaadin-crud');\n\ncrud.items = [\n { name: 'John', surname: 'Lennon', role: 'singer' },\n { name: 'Ringo', surname: 'Starr', role: 'drums' },\n // ... more items\n];\n```\n\n### Data Provider Function\n\nOtherwise, you can provide a [`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-crud#property-dataProvider) function.\n\n```js\nconst crud = document.querySelector('vaadin-crud');\n\nconst users = [\n { name: 'John', surname: 'Lennon', role: 'singer' },\n { name: 'Ringo', surname: 'Starr', role: 'drums' },\n // ... more items\n];\n\ncrud.dataProvider = (params, callback) => {\n const chunk = users.slice(params.page * params.pageSize, params.page * params.pageSize + params.pageSize);\n callback(chunk, people.length);\n};\n```\n\nNOTE: The auto-generated editor only supports string types. If you need to handle special cases\ncustomizing the editor is discussed below.\n\n### Customization\n\nAlternatively you can fully configure the component by using `slot` names.\n\nSlot name | Description\n---------------|----------------\n`grid` | To replace the auto-generated grid with a custom one.\n`form` | To replace the auto-generated form.\n`save-button` | To replace the \"Save\" button.\n`cancel-button`| To replace the \"Cancel\" button.\n`delete-button`| To replace the \"Delete\" button.\n`toolbar` | To provide the toolbar content (by default, it's empty).\n`new-button` | To replace the \"New item\" button.\n\n#### Example:\n\n```html\n<vaadin-crud id=\"crud\">\n <vaadin-grid slot=\"grid\">\n <vaadin-crud-edit-column></vaadin-crud-edit-column>\n <vaadin-grid-column id=\"column1\"></vaadin-grid-column>\n <vaadin-grid-column id=\"column2\"></vaadin-grid-column>\n </vaadin-grid>\n\n <vaadin-form-layout slot=\"form\">\n <vaadin-text-field label=\"First\" path=\"name\"></vaadin-text-field>\n <vaadin-text-field label=\"Surname\" path=\"surname\"></vaadin-text-field>\n </vaadin-form-layout>\n\n <div slot=\"toolbar\">Total singers: 2</div>\n <button slot=\"new-button\">New singer</button>\n\n <button slot=\"save-button\">Save changes</button>\n <button slot=\"cancel-button\">Discard changes</button>\n <button slot=\"delete-button\">Delete singer</button>\n</vaadin-crud>\n```\n```js\nconst crud = document.querySelector('#crud');\n\nconst column1 = document.querySelector('#column1');\ncolumn1.headerRenderer = (root, column) => {\n root.textContent = 'Name';\n};\ncolumn1.renderer = (root, column, model) => {\n root.textContent = model.item.name;\n};\n\nconst column2 = document.querySelector('#column2');\ncolumn2.headerRenderer = (root, column) => {\n root.textContent = 'Surname';\n};\ncolumn2.renderer = (root, column, model) => {\n root.textContent = model.item.surname;\n};\n\ncrud.items = [\n { name: 'John', surname: 'Lennon', role: 'singer' },\n { name: 'Ringo', surname: 'Starr', role: 'drums' },\n // ... more items\n];\n```\n\n### Helpers\n\nThe following elements are used to auto-configure the grid and the editor\n- [`<vaadin-crud-edit-column>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-crud-edit-column)\n- `<vaadin-crud-grid>` - can be replaced with custom [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-grid)\n- `<vaadin-crud-form>` - can be replaced with custom [`<vaadin-form-layout>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/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": "editor-position",
|
|
@@ -412,7 +412,7 @@
|
|
|
412
412
|
},
|
|
413
413
|
{
|
|
414
414
|
"name": "include",
|
|
415
|
-
"description": "A comma-separated list of fields to include in the generated grid and the generated editor.\n\nIt can be used to explicitly define the field order.\n\nWhen it is defined [`exclude`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-
|
|
415
|
+
"description": "A comma-separated list of fields to include in the generated grid and the generated editor.\n\nIt can be used to explicitly define the field order.\n\nWhen it is defined [`exclude`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-crud#property-exclude) is ignored.\n\nDefault is undefined meaning that all properties in the object should be mapped to fields.",
|
|
416
416
|
"value": {
|
|
417
417
|
"type": [
|
|
418
418
|
"string",
|
|
@@ -423,7 +423,7 @@
|
|
|
423
423
|
},
|
|
424
424
|
{
|
|
425
425
|
"name": "exclude",
|
|
426
|
-
"description": "A comma-separated list of fields to be excluded from the generated grid and the generated editor.\n\nWhen [`include`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-
|
|
426
|
+
"description": "A comma-separated list of fields to be excluded from the generated grid and the generated editor.\n\nWhen [`include`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-crud#property-include) is defined, this parameter is ignored.\n\nDefault is to exclude all private fields (those properties starting with underscore)",
|
|
427
427
|
"value": {
|
|
428
428
|
"type": [
|
|
429
429
|
"string",
|
|
@@ -550,7 +550,7 @@
|
|
|
550
550
|
},
|
|
551
551
|
{
|
|
552
552
|
"name": "include",
|
|
553
|
-
"description": "A comma-separated list of fields to include in the generated grid and the generated editor.\n\nIt can be used to explicitly define the field order.\n\nWhen it is defined [`exclude`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-
|
|
553
|
+
"description": "A comma-separated list of fields to include in the generated grid and the generated editor.\n\nIt can be used to explicitly define the field order.\n\nWhen it is defined [`exclude`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-crud#property-exclude) is ignored.\n\nDefault is undefined meaning that all properties in the object should be mapped to fields.",
|
|
554
554
|
"value": {
|
|
555
555
|
"type": [
|
|
556
556
|
"string",
|
|
@@ -561,7 +561,7 @@
|
|
|
561
561
|
},
|
|
562
562
|
{
|
|
563
563
|
"name": "exclude",
|
|
564
|
-
"description": "A comma-separated list of fields to be excluded from the generated grid and the generated editor.\n\nWhen [`include`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-
|
|
564
|
+
"description": "A comma-separated list of fields to be excluded from the generated grid and the generated editor.\n\nWhen [`include`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-crud#property-include) is defined, this parameter is ignored.\n\nDefault is to exclude all private fields (those properties starting with underscore)",
|
|
565
565
|
"value": {
|
|
566
566
|
"type": [
|
|
567
567
|
"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": "24.7.0-
|
|
4
|
+
"version": "24.7.0-alpha4",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -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/24.7.0-
|
|
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/24.7.0-alpha4/#/elements/vaadin-crud#property-items) property.\n\nA grid and an editor will be automatically generated and configured based on the data structure provided.\n\n```html\n<vaadin-crud></vaadin-crud>\n```\n```js\nconst crud = document.querySelector('vaadin-crud');\n\ncrud.items = [\n { name: 'John', surname: 'Lennon', role: 'singer' },\n { name: 'Ringo', surname: 'Starr', role: 'drums' },\n // ... more items\n];\n```\n\n### Data Provider Function\n\nOtherwise, you can provide a [`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-crud#property-dataProvider) function.\n\n```js\nconst crud = document.querySelector('vaadin-crud');\n\nconst users = [\n { name: 'John', surname: 'Lennon', role: 'singer' },\n { name: 'Ringo', surname: 'Starr', role: 'drums' },\n // ... more items\n];\n\ncrud.dataProvider = (params, callback) => {\n const chunk = users.slice(params.page * params.pageSize, params.page * params.pageSize + params.pageSize);\n callback(chunk, people.length);\n};\n```\n\nNOTE: The auto-generated editor only supports string types. If you need to handle special cases\ncustomizing the editor is discussed below.\n\n### Customization\n\nAlternatively you can fully configure the component by using `slot` names.\n\nSlot name | Description\n---------------|----------------\n`grid` | To replace the auto-generated grid with a custom one.\n`form` | To replace the auto-generated form.\n`save-button` | To replace the \"Save\" button.\n`cancel-button`| To replace the \"Cancel\" button.\n`delete-button`| To replace the \"Delete\" button.\n`toolbar` | To provide the toolbar content (by default, it's empty).\n`new-button` | To replace the \"New item\" button.\n\n#### Example:\n\n```html\n<vaadin-crud id=\"crud\">\n <vaadin-grid slot=\"grid\">\n <vaadin-crud-edit-column></vaadin-crud-edit-column>\n <vaadin-grid-column id=\"column1\"></vaadin-grid-column>\n <vaadin-grid-column id=\"column2\"></vaadin-grid-column>\n </vaadin-grid>\n\n <vaadin-form-layout slot=\"form\">\n <vaadin-text-field label=\"First\" path=\"name\"></vaadin-text-field>\n <vaadin-text-field label=\"Surname\" path=\"surname\"></vaadin-text-field>\n </vaadin-form-layout>\n\n <div slot=\"toolbar\">Total singers: 2</div>\n <button slot=\"new-button\">New singer</button>\n\n <button slot=\"save-button\">Save changes</button>\n <button slot=\"cancel-button\">Discard changes</button>\n <button slot=\"delete-button\">Delete singer</button>\n</vaadin-crud>\n```\n```js\nconst crud = document.querySelector('#crud');\n\nconst column1 = document.querySelector('#column1');\ncolumn1.headerRenderer = (root, column) => {\n root.textContent = 'Name';\n};\ncolumn1.renderer = (root, column, model) => {\n root.textContent = model.item.name;\n};\n\nconst column2 = document.querySelector('#column2');\ncolumn2.headerRenderer = (root, column) => {\n root.textContent = 'Surname';\n};\ncolumn2.renderer = (root, column, model) => {\n root.textContent = model.item.surname;\n};\n\ncrud.items = [\n { name: 'John', surname: 'Lennon', role: 'singer' },\n { name: 'Ringo', surname: 'Starr', role: 'drums' },\n // ... more items\n];\n```\n\n### Helpers\n\nThe following elements are used to auto-configure the grid and the editor\n- [`<vaadin-crud-edit-column>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-crud-edit-column)\n- `<vaadin-crud-grid>` - can be replaced with custom [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-grid)\n- `<vaadin-crud-form>` - can be replaced with custom [`<vaadin-form-layout>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/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
|
{
|
|
@@ -217,14 +217,14 @@
|
|
|
217
217
|
},
|
|
218
218
|
{
|
|
219
219
|
"name": ".include",
|
|
220
|
-
"description": "A comma-separated list of fields to include in the generated grid and the generated editor.\n\nIt can be used to explicitly define the field order.\n\nWhen it is defined [`exclude`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-
|
|
220
|
+
"description": "A comma-separated list of fields to include in the generated grid and the generated editor.\n\nIt can be used to explicitly define the field order.\n\nWhen it is defined [`exclude`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-crud#property-exclude) is ignored.\n\nDefault is undefined meaning that all properties in the object should be mapped to fields.",
|
|
221
221
|
"value": {
|
|
222
222
|
"kind": "expression"
|
|
223
223
|
}
|
|
224
224
|
},
|
|
225
225
|
{
|
|
226
226
|
"name": ".exclude",
|
|
227
|
-
"description": "A comma-separated list of fields to be excluded from the generated grid and the generated editor.\n\nWhen [`include`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-
|
|
227
|
+
"description": "A comma-separated list of fields to be excluded from the generated grid and the generated editor.\n\nWhen [`include`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha4/#/elements/vaadin-crud#property-include) is defined, this parameter is ignored.\n\nDefault is to exclude all private fields (those properties starting with underscore)",
|
|
228
228
|
"value": {
|
|
229
229
|
"kind": "expression"
|
|
230
230
|
}
|