Skip to content

Commit 9ed89f1

Browse files
authored
docs: remove Polymer specific code from API docs (#5095)
1 parent d3b4c76 commit 9ed89f1

2 files changed

Lines changed: 54 additions & 28 deletions

File tree

‎packages/crud/src/vaadin-crud.d.ts‎

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -129,23 +129,34 @@ export type CrudEventMap<T> = CrudCustomEventMap<T> & HTMLElementEventMap;
129129
*
130130
* A grid and an editor will be automatically generated and configured based on the data structure provided.
131131
*
132-
* #### Example:
133132
* ```html
134-
* <vaadin-crud items='[{"name": "John", "surname": "Lennon", "role": "singer"},
135-
* {"name": "Ringo", "surname": "Starr", "role": "drums"}]'></vaadin-crud>
133+
* <vaadin-crud></vaadin-crud>
134+
* ```
135+
*
136+
* ```js
137+
* const crud = document.querySelector('vaadin-crud');
138+
*
139+
* crud.items = [
140+
* { name: 'John', surname: 'Lennon', role: 'singer' },
141+
* { name: 'Ringo', surname: 'Starr', role: 'drums' },
142+
* // ... more items
143+
* ];
136144
* ```
137145
*
138146
* ### Data Provider Function
139147
*
140148
* Otherwise, you can provide a [`dataProvider`](#/elements/vaadin-crud#property-dataProvider) function.
141-
* #### Example:
142-
* ```html
143-
* <vaadin-crud></vaadin-crud>
144-
* ```
149+
*
145150
* ```js
146151
* const crud = document.querySelector('vaadin-crud');
147-
* const users = [{'name': 'John', 'surname': 'Lennon', 'role': 'singer'}, ...];
148-
* crud.dataProvider = function(params, callback) {
152+
*
153+
* const users = [
154+
* { name: 'John', surname: 'Lennon', role: 'singer' },
155+
* { name: 'Ringo', surname: 'Starr', role: 'drums' },
156+
* // ... more items
157+
* ];
158+
*
159+
* crud.dataProvider = (params, callback) => {
149160
* const chunk = users.slice(params.page * params.pageSize, params.page * params.pageSize + params.pageSize);
150161
* callback(chunk, people.length);
151162
* };
@@ -171,11 +182,7 @@ export type CrudEventMap<T> = CrudCustomEventMap<T> & HTMLElementEventMap;
171182
* #### Example:
172183
*
173184
* ```html
174-
* <vaadin-crud
175-
* id="crud"
176-
* items='[{"name": "John", "surname": "Lennon", "role": "singer"},
177-
* {"name": "Ringo", "surname": "Starr", "role": "drums"}]'
178-
* >
185+
* <vaadin-crud id="crud">
179186
* <vaadin-grid slot="grid">
180187
* <vaadin-crud-edit-column></vaadin-crud-edit-column>
181188
* <vaadin-grid-column id="column1"></vaadin-grid-column>
@@ -213,6 +220,12 @@ export type CrudEventMap<T> = CrudCustomEventMap<T> & HTMLElementEventMap;
213220
* column2.renderer = (root, column, model) => {
214221
* root.textContent = model.item.surname;
215222
* };
223+
*
224+
* crud.items = [
225+
* { name: 'John', surname: 'Lennon', role: 'singer' },
226+
* { name: 'Ringo', surname: 'Starr', role: 'drums' },
227+
* // ... more items
228+
* ];
216229
* ```
217230
*
218231
* ### Helpers

‎packages/crud/src/vaadin-crud.js‎

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,34 @@ class ButtonSlotController extends SlotController {
4646
*
4747
* A grid and an editor will be automatically generated and configured based on the data structure provided.
4848
*
49-
* #### Example:
5049
* ```html
51-
* <vaadin-crud items='[{"name": "John", "surname": "Lennon", "role": "singer"},
52-
* {"name": "Ringo", "surname": "Starr", "role": "drums"}]'></vaadin-crud>
50+
* <vaadin-crud></vaadin-crud>
51+
* ```
52+
*
53+
* ```js
54+
* const crud = document.querySelector('vaadin-crud');
55+
*
56+
* crud.items = [
57+
* { name: 'John', surname: 'Lennon', role: 'singer' },
58+
* { name: 'Ringo', surname: 'Starr', role: 'drums' },
59+
* // ... more items
60+
* ];
5361
* ```
5462
*
5563
* ### Data Provider Function
5664
*
5765
* Otherwise, you can provide a [`dataProvider`](#/elements/vaadin-crud#property-dataProvider) function.
58-
* #### Example:
59-
* ```html
60-
* <vaadin-crud></vaadin-crud>
61-
* ```
66+
*
6267
* ```js
6368
* const crud = document.querySelector('vaadin-crud');
64-
* const users = [{'name': 'John', 'surname': 'Lennon', 'role': 'singer'}, ...];
65-
* crud.dataProvider = function(params, callback) {
69+
*
70+
* const users = [
71+
* { name: 'John', surname: 'Lennon', role: 'singer' },
72+
* { name: 'Ringo', surname: 'Starr', role: 'drums' },
73+
* // ... more items
74+
* ];
75+
*
76+
* crud.dataProvider = (params, callback) => {
6677
* const chunk = users.slice(params.page * params.pageSize, params.page * params.pageSize + params.pageSize);
6778
* callback(chunk, people.length);
6879
* };
@@ -88,11 +99,7 @@ class ButtonSlotController extends SlotController {
8899
* #### Example:
89100
*
90101
* ```html
91-
* <vaadin-crud
92-
* id="crud"
93-
* items='[{"name": "John", "surname": "Lennon", "role": "singer"},
94-
* {"name": "Ringo", "surname": "Starr", "role": "drums"}]'
95-
* >
102+
* <vaadin-crud id="crud">
96103
* <vaadin-grid slot="grid">
97104
* <vaadin-crud-edit-column></vaadin-crud-edit-column>
98105
* <vaadin-grid-column id="column1"></vaadin-grid-column>
@@ -130,6 +137,12 @@ class ButtonSlotController extends SlotController {
130137
* column2.renderer = (root, column, model) => {
131138
* root.textContent = model.item.surname;
132139
* };
140+
*
141+
* crud.items = [
142+
* { name: 'John', surname: 'Lennon', role: 'singer' },
143+
* { name: 'Ringo', surname: 'Starr', role: 'drums' },
144+
* // ... more items
145+
* ];
133146
* ```
134147
*
135148
* ### Helpers

0 commit comments

Comments
 (0)