@vaadin/vaadin-crud 21.0.1 → 22.0.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 +23 -37
- package/src/vaadin-crud.d.ts +13 -279
- package/src/vaadin-crud.js +4 -971
- package/theme/lumo/vaadin-crud.js +1 -9
- package/theme/material/vaadin-crud.js +1 -9
- package/vaadin-crud.d.ts +0 -1
- package/src/interfaces.d.ts +0 -108
- package/src/vaadin-crud-edit-column.d.ts +0 -31
- package/src/vaadin-crud-edit-column.js +0 -85
- package/src/vaadin-crud-edit.d.ts +0 -17
- package/src/vaadin-crud-edit.js +0 -60
- package/src/vaadin-crud-form.d.ts +0 -28
- package/src/vaadin-crud-form.js +0 -109
- package/src/vaadin-crud-grid.d.ts +0 -34
- package/src/vaadin-crud-grid.js +0 -215
- package/src/vaadin-crud-include-mixin.d.ts +0 -25
- package/src/vaadin-crud-include-mixin.js +0 -58
- package/src/vaadin-dialog-layout.js +0 -216
- package/theme/lumo/vaadin-crud-styles.js +0 -141
- package/theme/material/vaadin-crud-styles.js +0 -128
- package/theme/vaadin-dialog-layout-overlay-styles.js +0 -45
package/package.json
CHANGED
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/vaadin-crud",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "22.0.0-alpha10",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
4
7
|
"description": "vaadin-crud",
|
|
8
|
+
"license": "https://raw.githubusercontent.com/vaadin/web-components/master/packages/vaadin-crud/LICENSE",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/vaadin/web-components.git",
|
|
12
|
+
"directory": "packages/vaadin-crud"
|
|
13
|
+
},
|
|
14
|
+
"author": "Vaadin Ltd",
|
|
15
|
+
"homepage": "https://vaadin.com/components",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/vaadin/web-components/issues"
|
|
18
|
+
},
|
|
5
19
|
"main": "vaadin-crud.js",
|
|
6
20
|
"module": "vaadin-crud.js",
|
|
7
|
-
"
|
|
21
|
+
"files": [
|
|
22
|
+
"src",
|
|
23
|
+
"theme",
|
|
24
|
+
"vaadin-*.d.ts",
|
|
25
|
+
"vaadin-*.js"
|
|
26
|
+
],
|
|
8
27
|
"keywords": [
|
|
9
28
|
"Vaadin",
|
|
10
29
|
"vaadin-crud",
|
|
@@ -12,41 +31,8 @@
|
|
|
12
31
|
"web-component",
|
|
13
32
|
"polymer"
|
|
14
33
|
],
|
|
15
|
-
"author": "Vaadin Ltd",
|
|
16
|
-
"license": "https://raw.githubusercontent.com/vaadin/vaadin-crud/master/LICENSE",
|
|
17
|
-
"bugs": {
|
|
18
|
-
"url": "https://github.com/vaadin/vaadin-crud/issues"
|
|
19
|
-
},
|
|
20
|
-
"homepage": "https://vaadin.com/components",
|
|
21
|
-
"files": [
|
|
22
|
-
"vaadin-*.d.ts",
|
|
23
|
-
"vaadin-*.js",
|
|
24
|
-
"src",
|
|
25
|
-
"theme"
|
|
26
|
-
],
|
|
27
34
|
"dependencies": {
|
|
28
|
-
"@
|
|
29
|
-
"@polymer/polymer": "^3.0.0",
|
|
30
|
-
"@vaadin/vaadin-button": "^21.0.1",
|
|
31
|
-
"@vaadin/vaadin-confirm-dialog": "^21.0.1",
|
|
32
|
-
"@vaadin/vaadin-dialog": "^21.0.1",
|
|
33
|
-
"@vaadin/vaadin-element-mixin": "^21.0.1",
|
|
34
|
-
"@vaadin/vaadin-form-layout": "^21.0.1",
|
|
35
|
-
"@vaadin/vaadin-grid": "^21.0.1",
|
|
36
|
-
"@vaadin/vaadin-license-checker": "^2.1.0",
|
|
37
|
-
"@vaadin/vaadin-lumo-styles": "^21.0.1",
|
|
38
|
-
"@vaadin/vaadin-material-styles": "^21.0.1",
|
|
39
|
-
"@vaadin/vaadin-text-field": "^21.0.1",
|
|
40
|
-
"@vaadin/vaadin-themable-mixin": "^21.0.1"
|
|
41
|
-
},
|
|
42
|
-
"devDependencies": {
|
|
43
|
-
"@esm-bundle/chai": "^4.1.5",
|
|
44
|
-
"@vaadin/testing-helpers": "^0.2.1",
|
|
45
|
-
"@vaadin/vaadin-template-renderer": "^21.0.1",
|
|
46
|
-
"sinon": "^9.2.1"
|
|
47
|
-
},
|
|
48
|
-
"publishConfig": {
|
|
49
|
-
"access": "public"
|
|
35
|
+
"@vaadin/crud": "22.0.0-alpha10"
|
|
50
36
|
},
|
|
51
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "6d3055383b9c3c8306ea34c6f2e2087e63c49348"
|
|
52
38
|
}
|
package/src/vaadin-crud.d.ts
CHANGED
|
@@ -1,284 +1,18 @@
|
|
|
1
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
2
|
-
|
|
3
|
-
import { ElementMixin } from '@vaadin/vaadin-element-mixin/vaadin-element-mixin.js';
|
|
4
|
-
|
|
5
|
-
import { CrudDataProvider, CrudEditorPosition, CrudEventMap, CrudI18n } from './interfaces';
|
|
6
|
-
|
|
7
1
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* Assign an array to the [`items`](#/elements/vaadin-crud#property-items) property.
|
|
13
|
-
*
|
|
14
|
-
* A grid and an editor will be automatically generated and configured based on the data structure provided.
|
|
15
|
-
*
|
|
16
|
-
* #### Example:
|
|
17
|
-
* ```html
|
|
18
|
-
* <vaadin-crud items='[{"name": "John", "surname": "Lennon", "role": "singer"},
|
|
19
|
-
* {"name": "Ringo", "surname": "Starr", "role": "drums"}]'></vaadin-crud>
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* ### Data Provider Function
|
|
23
|
-
*
|
|
24
|
-
* Otherwise, you can provide a [`dataProvider`](#/elements/vaadin-crud#property-dataProvider) function.
|
|
25
|
-
* #### Example:
|
|
26
|
-
* ```html
|
|
27
|
-
* <vaadin-crud></vaadin-crud>
|
|
28
|
-
* ```
|
|
29
|
-
* ```js
|
|
30
|
-
* const crud = document.querySelector('vaadin-crud');
|
|
31
|
-
* const users = [{'name': 'John', 'surname': 'Lennon', 'role': 'singer'}, ...];
|
|
32
|
-
* crud.dataProvider = function(params, callback) {
|
|
33
|
-
* const chunk = users.slice(params.page * params.pageSize, params.page * params.pageSize + params.pageSize);
|
|
34
|
-
* callback(chunk, people.length);
|
|
35
|
-
* };
|
|
36
|
-
* ```
|
|
37
|
-
*
|
|
38
|
-
* NOTE: The auto-generated editor only supports string types. If you need to handle special cases
|
|
39
|
-
* customizing the editor is discussed below.
|
|
40
|
-
*
|
|
41
|
-
* ### Customization
|
|
42
|
-
*
|
|
43
|
-
* Alternatively you can fully configure the component by using `slot` names.
|
|
44
|
-
*
|
|
45
|
-
* Slot name | Description
|
|
46
|
-
* ----------------|----------------
|
|
47
|
-
* `grid` | To replace the auto-generated grid with a custom one.
|
|
48
|
-
* `form` | To replace the auto-generated form.
|
|
49
|
-
* `toolbar` | To replace the toolbar content. Add an element with the attribute `new-button` for the new item action.
|
|
50
|
-
*
|
|
51
|
-
* #### Example:
|
|
52
|
-
*
|
|
53
|
-
* ```html
|
|
54
|
-
* <vaadin-crud
|
|
55
|
-
* id="crud"
|
|
56
|
-
* items='[{"name": "John", "surname": "Lennon", "role": "singer"},
|
|
57
|
-
* {"name": "Ringo", "surname": "Starr", "role": "drums"}]'
|
|
58
|
-
* >
|
|
59
|
-
* <vaadin-grid slot="grid">
|
|
60
|
-
* <vaadin-crud-edit-column></vaadin-crud-edit-column>
|
|
61
|
-
* <vaadin-grid-column id="column1"></vaadin-grid-column>
|
|
62
|
-
* <vaadin-grid-column id="column2"></vaadin-grid-column>
|
|
63
|
-
* </vaadin-grid>
|
|
64
|
-
*
|
|
65
|
-
* <vaadin-form-layout slot="form">
|
|
66
|
-
* <vaadin-text-field label="First" path="name"></vaadin-text-field>
|
|
67
|
-
* <vaadin-text-field label="Surname" path="surname"></vaadin-text-field>
|
|
68
|
-
* </vaadin-form-layout>
|
|
69
|
-
*
|
|
70
|
-
* <div slot="toolbar">
|
|
71
|
-
* Total singers: [[size]]
|
|
72
|
-
* <button new-button>New singer</button>
|
|
73
|
-
* </div>
|
|
74
|
-
* </vaadin-crud>
|
|
75
|
-
* ```
|
|
76
|
-
* ```js
|
|
77
|
-
* const crud = document.querySelector('#crud');
|
|
78
|
-
*
|
|
79
|
-
* const column1 = document.querySelector('#column1');
|
|
80
|
-
* column1.headerRenderer = (root, column) => {
|
|
81
|
-
* root.textContent = 'Name';
|
|
82
|
-
* };
|
|
83
|
-
* column1.renderer = (root, column, model) => {
|
|
84
|
-
* root.textContent = model.item.name;
|
|
85
|
-
* };
|
|
86
|
-
*
|
|
87
|
-
* const column2 = document.querySelector('#column2');
|
|
88
|
-
* column2.headerRenderer = (root, column) => {
|
|
89
|
-
* root.textContent = 'Surname';
|
|
90
|
-
* };
|
|
91
|
-
* column2.renderer = (root, column, model) => {
|
|
92
|
-
* root.textContent = model.item.surname;
|
|
93
|
-
* };
|
|
94
|
-
* ```
|
|
95
|
-
*
|
|
96
|
-
* ### Helpers
|
|
97
|
-
*
|
|
98
|
-
* The following elements are used to auto-configure the grid and the editor
|
|
99
|
-
* - [`<vaadin-crud-edit-column>`](#/elements/vaadin-crud-edit-column)
|
|
100
|
-
* - `<vaadin-crud-grid>` - can be replaced with custom [`<vaadin-grid>`](#/elements/vaadin-grid)
|
|
101
|
-
* - `<vaadin-crud-form>` - can be replaced with custom [`<vaadin-form-layout>`](#/elements/vaadin-form-layout)
|
|
102
|
-
*
|
|
103
|
-
* ### Styling
|
|
104
|
-
*
|
|
105
|
-
* The following shadow DOM parts are available for styling:
|
|
106
|
-
*
|
|
107
|
-
* Part name | Description
|
|
108
|
-
* ----------------|----------------
|
|
109
|
-
* `toolbar` | Toolbar container at the bottom. By default it contains the the `new` button
|
|
110
|
-
*
|
|
111
|
-
* The following custom properties are available:
|
|
112
|
-
*
|
|
113
|
-
* Custom Property | Description | Default
|
|
114
|
-
* ----------------|----------------
|
|
115
|
-
* --vaadin-crud-editor-max-height | max height of editor when opened on the bottom | 40%
|
|
116
|
-
* --vaadin-crud-editor-max-width | max width of editor when opened on the side | 40%
|
|
117
|
-
*
|
|
118
|
-
* See [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.
|
|
119
|
-
*
|
|
120
|
-
* @fires {CustomEvent} editor-opened-changed - Fired when the `editorOpened` property changes.
|
|
121
|
-
* @fires {CustomEvent} edited-item-changed - Fired when `editedItem` property changes.
|
|
122
|
-
* @fires {CustomEvent} items-changed - Fired when the `items` property changes.
|
|
123
|
-
* @fires {CustomEvent} size-changed - Fired when the `size` property changes.
|
|
124
|
-
* @fires {CustomEvent} new - Fired when user wants to create a new item.
|
|
125
|
-
* @fires {CustomEvent} edit - Fired when user wants to edit an existing item.
|
|
126
|
-
* @fires {CustomEvent} delete - Fired when user wants to delete item.
|
|
127
|
-
* @fires {CustomEvent} save - Fired when user wants to save a new or an existing item.
|
|
128
|
-
* @fires {CustomEvent} cancel - Fired when user discards edition.
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2017 - 2021 Vaadin Ltd.
|
|
4
|
+
* This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
|
|
129
5
|
*/
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* A reference to all fields inside the [`_form`](#/elements/vaadin-crud#property-_form) element
|
|
133
|
-
*/
|
|
134
|
-
readonly _fields: HTMLElement[];
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* An array containing the items which will be stamped to the column template instances.
|
|
138
|
-
*/
|
|
139
|
-
items: Array<Item> | null | undefined;
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* The item being edited in the dialog.
|
|
143
|
-
*/
|
|
144
|
-
editedItem: Item | null | undefined;
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Sets how editor will be presented on desktop screen.
|
|
148
|
-
*
|
|
149
|
-
* Accepted values are:
|
|
150
|
-
* - `` (default) - form will open as overlay
|
|
151
|
-
* - `bottom` - form will open below the grid
|
|
152
|
-
* - `aside` - form will open on the grid side (_right_, if lft and _left_ if rtl)
|
|
153
|
-
* @attr {bottom|aside} editor-position
|
|
154
|
-
*/
|
|
155
|
-
editorPosition: CrudEditorPosition;
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Enables user to click on row to edit it.
|
|
159
|
-
* Note: When enabled, auto-generated grid won't show the edit column.
|
|
160
|
-
* @attr {boolean} edit-on-click
|
|
161
|
-
*/
|
|
162
|
-
editOnClick: boolean;
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Function that provides items lazily. Receives arguments `params`, `callback`
|
|
166
|
-
*
|
|
167
|
-
* `params.page` Requested page index
|
|
168
|
-
* `params.pageSize` Current page size
|
|
169
|
-
* `params.filters` Currently applied filters
|
|
170
|
-
* `params.sortOrders` Currently applied sorting orders
|
|
171
|
-
*
|
|
172
|
-
* `callback(items, size)` Callback function with arguments:
|
|
173
|
-
* - `items` Current page of items
|
|
174
|
-
* - `size` Total number of items
|
|
175
|
-
*/
|
|
176
|
-
dataProvider: CrudDataProvider<Item> | null | undefined;
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Disable filtering when grid is autoconfigured.
|
|
180
|
-
* @attr {boolean} no-filter
|
|
181
|
-
*/
|
|
182
|
-
noFilter: boolean | null | undefined;
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Disable sorting when grid is autoconfigured.
|
|
186
|
-
* @attr {boolean} no-sort
|
|
187
|
-
*/
|
|
188
|
-
noSort: boolean | null | undefined;
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Remove grid headers when it is autoconfigured.
|
|
192
|
-
* @attr {boolean} no-head
|
|
193
|
-
*/
|
|
194
|
-
noHead: boolean | null | undefined;
|
|
6
|
+
import { Crud } from '@vaadin/crud/src/vaadin-crud.js';
|
|
195
7
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
*
|
|
201
|
-
* When it is defined [`exclude`](#/elements/vaadin-crud#property-exclude) is ignored.
|
|
202
|
-
*
|
|
203
|
-
* Default is undefined meaning that all properties in the object should be mapped to fields.
|
|
204
|
-
*/
|
|
205
|
-
include: string | null | undefined;
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* A comma-separated list of fields to be excluded from the generated grid and the generated editor.
|
|
209
|
-
*
|
|
210
|
-
* When [`include`](#/elements/vaadin-crud#property-include) is defined, this parameter is ignored.
|
|
211
|
-
*
|
|
212
|
-
* Default is to exclude all private fields (those properties starting with underscore)
|
|
213
|
-
*/
|
|
214
|
-
exclude: string | null | undefined;
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Reflects the opened status of the editor.
|
|
218
|
-
*/
|
|
219
|
-
editorOpened: boolean | null | undefined;
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Number of items in the data set which is reported by the grid.
|
|
223
|
-
* Typically it reflects the number of filtered items displayed in the grid.
|
|
224
|
-
*/
|
|
225
|
-
readonly size: number | null | undefined;
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* The object used to localize this component.
|
|
229
|
-
* For changing the default localization, change the entire
|
|
230
|
-
* _i18n_ object or just the property you want to modify.
|
|
231
|
-
*
|
|
232
|
-
* The object has the following JSON structure and default values:
|
|
233
|
-
*
|
|
234
|
-
* ```
|
|
235
|
-
* {
|
|
236
|
-
* newItem: 'New item',
|
|
237
|
-
* editItem: 'Edit item',
|
|
238
|
-
* saveItem: 'Save',
|
|
239
|
-
* cancel: 'Cancel',
|
|
240
|
-
* deleteItem: 'Delete...',
|
|
241
|
-
* editLabel: 'Edit',
|
|
242
|
-
* confirm: {
|
|
243
|
-
* delete: {
|
|
244
|
-
* title: 'Confirm delete',
|
|
245
|
-
* content: 'Are you sure you want to delete the selected item? This action cannot be undone.',
|
|
246
|
-
* button: {
|
|
247
|
-
* confirm: 'Delete',
|
|
248
|
-
* dismiss: 'Cancel'
|
|
249
|
-
* }
|
|
250
|
-
* },
|
|
251
|
-
* cancel: {
|
|
252
|
-
* title: 'Unsaved changes',
|
|
253
|
-
* content: 'There are unsaved modifications to the item.',
|
|
254
|
-
* button: {
|
|
255
|
-
* confirm: 'Discard',
|
|
256
|
-
* dismiss: 'Continue editing'
|
|
257
|
-
* }
|
|
258
|
-
* }
|
|
259
|
-
* }
|
|
260
|
-
* }
|
|
261
|
-
* ```
|
|
262
|
-
*/
|
|
263
|
-
i18n: CrudI18n;
|
|
264
|
-
|
|
265
|
-
addEventListener<K extends keyof CrudEventMap<Item>>(
|
|
266
|
-
type: K,
|
|
267
|
-
listener: (this: CrudElement<Item>, ev: CrudEventMap<Item>[K]) => void,
|
|
268
|
-
options?: boolean | AddEventListenerOptions
|
|
269
|
-
): void;
|
|
270
|
-
|
|
271
|
-
removeEventListener<K extends keyof CrudEventMap<Item>>(
|
|
272
|
-
type: K,
|
|
273
|
-
listener: (this: CrudElement<Item>, ev: CrudEventMap<Item>[K]) => void,
|
|
274
|
-
options?: boolean | EventListenerOptions
|
|
275
|
-
): void;
|
|
276
|
-
}
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Import `Crud` from `@vaadin/crud` instead.
|
|
10
|
+
*/
|
|
11
|
+
export type CrudElement<Item> = Crud<Item>;
|
|
277
12
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
}
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Import `Crud` from `@vaadin/crud` instead.
|
|
15
|
+
*/
|
|
16
|
+
export const CrudElement: typeof Crud;
|
|
283
17
|
|
|
284
|
-
export
|
|
18
|
+
export * from '@vaadin/crud/src/vaadin-crud.js';
|