@vaadin/crud 24.7.0-alpha1 → 24.7.0-alpha10
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 +18 -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 +7 -1
- package/src/vaadin-crud-grid-mixin.js +9 -3
- 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 +8 -7
- package/src/vaadin-crud-mixin.js +113 -101
- 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 +9 -9
- 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 +15 -15
- package/web-types.lit.json +11 -11
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-alpha10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,22 +37,24 @@
|
|
|
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-alpha10",
|
|
41
|
+
"@vaadin/button": "24.7.0-alpha10",
|
|
42
|
+
"@vaadin/component-base": "24.7.0-alpha10",
|
|
43
|
+
"@vaadin/confirm-dialog": "24.7.0-alpha10",
|
|
44
|
+
"@vaadin/dialog": "24.7.0-alpha10",
|
|
45
|
+
"@vaadin/form-layout": "24.7.0-alpha10",
|
|
46
|
+
"@vaadin/grid": "24.7.0-alpha10",
|
|
47
|
+
"@vaadin/overlay": "24.7.0-alpha10",
|
|
48
|
+
"@vaadin/text-field": "24.7.0-alpha10",
|
|
49
|
+
"@vaadin/vaadin-lumo-styles": "24.7.0-alpha10",
|
|
50
|
+
"@vaadin/vaadin-material-styles": "24.7.0-alpha10",
|
|
51
|
+
"@vaadin/vaadin-themable-mixin": "24.7.0-alpha10",
|
|
52
|
+
"lit": "^3.0.0"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
|
-
"@vaadin/chai-plugins": "24.7.0-
|
|
55
|
-
"@vaadin/
|
|
55
|
+
"@vaadin/chai-plugins": "24.7.0-alpha10",
|
|
56
|
+
"@vaadin/test-runner-commands": "24.7.0-alpha10",
|
|
57
|
+
"@vaadin/testing-helpers": "^1.1.0",
|
|
56
58
|
"sinon": "^18.0.0"
|
|
57
59
|
},
|
|
58
60
|
"cvdlName": "vaadin-crud",
|
|
@@ -60,5 +62,5 @@
|
|
|
60
62
|
"web-types.json",
|
|
61
63
|
"web-types.lit.json"
|
|
62
64
|
],
|
|
63
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "c0f8933df2a6a40648d3fb9cfbae6bbf86a8aa90"
|
|
64
66
|
}
|
|
@@ -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
|
*
|
|
@@ -36,4 +36,10 @@ export declare class CrudGridMixinClass {
|
|
|
36
36
|
* @attr {boolean} no-head
|
|
37
37
|
*/
|
|
38
38
|
noHead: boolean | null | undefined;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Determines whether the edit column should be hidden.
|
|
42
|
+
* @attr {boolean} hide-edit-column
|
|
43
|
+
*/
|
|
44
|
+
hideEditColumn: boolean | null | undefined;
|
|
39
45
|
}
|
|
@@ -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
|
*
|
|
@@ -39,8 +39,14 @@ export const CrudGridMixin = (superClass) =>
|
|
|
39
39
|
*/
|
|
40
40
|
noHead: Boolean,
|
|
41
41
|
|
|
42
|
-
/**
|
|
43
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Determines whether the edit column should be hidden.
|
|
44
|
+
* @attr {boolean} hide-edit-column
|
|
45
|
+
*/
|
|
46
|
+
hideEditColumn: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
sync: true,
|
|
49
|
+
},
|
|
44
50
|
};
|
|
45
51
|
}
|
|
46
52
|
|
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
|
}
|
|
@@ -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
|
*
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* license.
|
|
10
10
|
*/
|
|
11
11
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
12
|
+
import type { I18nMixinClass, PartialI18n } from '@vaadin/component-base/src/i18n-mixin.js';
|
|
12
13
|
import type { GridFilterDefinition, GridSorterDefinition } from '@vaadin/grid/src/vaadin-grid.js';
|
|
13
14
|
|
|
14
15
|
export type CrudDataProviderCallback<T> = (items: T[], size?: number) => void;
|
|
@@ -24,7 +25,7 @@ export type CrudDataProvider<T> = (params: CrudDataProviderParams, callback: Cru
|
|
|
24
25
|
|
|
25
26
|
export type CrudEditorPosition = '' | 'aside' | 'bottom';
|
|
26
27
|
|
|
27
|
-
export
|
|
28
|
+
export type CrudI18n = PartialI18n<{
|
|
28
29
|
newItem: string;
|
|
29
30
|
editItem: string;
|
|
30
31
|
saveItem: string;
|
|
@@ -49,7 +50,7 @@ export interface CrudI18n {
|
|
|
49
50
|
};
|
|
50
51
|
};
|
|
51
52
|
};
|
|
52
|
-
}
|
|
53
|
+
}>;
|
|
53
54
|
|
|
54
55
|
/**
|
|
55
56
|
* Fired when the `editorOpened` property changes.
|
|
@@ -123,7 +124,7 @@ export type CrudEventMap<T> = CrudCustomEventMap<T> & HTMLElementEventMap;
|
|
|
123
124
|
*/
|
|
124
125
|
export declare function CrudMixin<Item, T extends Constructor<HTMLElement> = Constructor<HTMLElement>>(
|
|
125
126
|
base: T,
|
|
126
|
-
): Constructor<CrudMixinClass<Item>> & T;
|
|
127
|
+
): Constructor<CrudMixinClass<Item>> & Constructor<I18nMixinClass<CrudI18n>> & T;
|
|
127
128
|
|
|
128
129
|
export declare class CrudMixinClass<Item> {
|
|
129
130
|
/**
|
|
@@ -225,9 +226,9 @@ export declare class CrudMixinClass<Item> {
|
|
|
225
226
|
noToolbar: boolean;
|
|
226
227
|
|
|
227
228
|
/**
|
|
228
|
-
* The object used to localize this component.
|
|
229
|
-
*
|
|
230
|
-
*
|
|
229
|
+
* The object used to localize this component. To change the default
|
|
230
|
+
* localization, replace this with an object that provides all properties, or
|
|
231
|
+
* just the individual properties you want to change.
|
|
231
232
|
*
|
|
232
233
|
* The object has the following JSON structure and default values:
|
|
233
234
|
*
|