Skip to content

Commit

Permalink
docs: remove Polymer specific code from API docs (#5095) (#5097)
Browse files Browse the repository at this point in the history
Co-authored-by: Serhii Kulykov <[email protected]>
  • Loading branch information
vaadin-bot and web-padawan authored Dec 2, 2022
1 parent c5bae8b commit 97f6772
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 28 deletions.
41 changes: 27 additions & 14 deletions packages/crud/src/vaadin-crud.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,23 +124,34 @@ export type CrudEventMap<T> = CrudCustomEventMap<T> & HTMLElementEventMap;
*
* A grid and an editor will be automatically generated and configured based on the data structure provided.
*
* #### Example:
* ```html
* <vaadin-crud items='[{"name": "John", "surname": "Lennon", "role": "singer"},
* {"name": "Ringo", "surname": "Starr", "role": "drums"}]'></vaadin-crud>
* <vaadin-crud></vaadin-crud>
* ```
*
* ```js
* const crud = document.querySelector('vaadin-crud');
*
* crud.items = [
* { name: 'John', surname: 'Lennon', role: 'singer' },
* { name: 'Ringo', surname: 'Starr', role: 'drums' },
* // ... more items
* ];
* ```
*
* ### Data Provider Function
*
* Otherwise, you can provide a [`dataProvider`](#/elements/vaadin-crud#property-dataProvider) function.
* #### Example:
* ```html
* <vaadin-crud></vaadin-crud>
* ```
*
* ```js
* const crud = document.querySelector('vaadin-crud');
* const users = [{'name': 'John', 'surname': 'Lennon', 'role': 'singer'}, ...];
* crud.dataProvider = function(params, callback) {
*
* const users = [
* { name: 'John', surname: 'Lennon', role: 'singer' },
* { name: 'Ringo', surname: 'Starr', role: 'drums' },
* // ... more items
* ];
*
* crud.dataProvider = (params, callback) => {
* const chunk = users.slice(params.page * params.pageSize, params.page * params.pageSize + params.pageSize);
* callback(chunk, people.length);
* };
Expand All @@ -165,11 +176,7 @@ export type CrudEventMap<T> = CrudCustomEventMap<T> & HTMLElementEventMap;
* #### Example:
*
* ```html
* <vaadin-crud
* id="crud"
* items='[{"name": "John", "surname": "Lennon", "role": "singer"},
* {"name": "Ringo", "surname": "Starr", "role": "drums"}]'
* >
* <vaadin-crud id="crud">
* <vaadin-grid slot="grid">
* <vaadin-crud-edit-column></vaadin-crud-edit-column>
* <vaadin-grid-column id="column1"></vaadin-grid-column>
Expand Down Expand Up @@ -209,6 +216,12 @@ export type CrudEventMap<T> = CrudCustomEventMap<T> & HTMLElementEventMap;
* column2.renderer = (root, column, model) => {
* root.textContent = model.item.surname;
* };
*
* crud.items = [
* { name: 'John', surname: 'Lennon', role: 'singer' },
* { name: 'Ringo', surname: 'Starr', role: 'drums' },
* // ... more items
* ];
* ```
*
* ### Helpers
Expand Down
41 changes: 27 additions & 14 deletions packages/crud/src/vaadin-crud.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,34 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
*
* A grid and an editor will be automatically generated and configured based on the data structure provided.
*
* #### Example:
* ```html
* <vaadin-crud items='[{"name": "John", "surname": "Lennon", "role": "singer"},
* {"name": "Ringo", "surname": "Starr", "role": "drums"}]'></vaadin-crud>
* <vaadin-crud></vaadin-crud>
* ```
*
* ```js
* const crud = document.querySelector('vaadin-crud');
*
* crud.items = [
* { name: 'John', surname: 'Lennon', role: 'singer' },
* { name: 'Ringo', surname: 'Starr', role: 'drums' },
* // ... more items
* ];
* ```
*
* ### Data Provider Function
*
* Otherwise, you can provide a [`dataProvider`](#/elements/vaadin-crud#property-dataProvider) function.
* #### Example:
* ```html
* <vaadin-crud></vaadin-crud>
* ```
*
* ```js
* const crud = document.querySelector('vaadin-crud');
* const users = [{'name': 'John', 'surname': 'Lennon', 'role': 'singer'}, ...];
* crud.dataProvider = function(params, callback) {
*
* const users = [
* { name: 'John', surname: 'Lennon', role: 'singer' },
* { name: 'Ringo', surname: 'Starr', role: 'drums' },
* // ... more items
* ];
*
* crud.dataProvider = (params, callback) => {
* const chunk = users.slice(params.page * params.pageSize, params.page * params.pageSize + params.pageSize);
* callback(chunk, people.length);
* };
Expand All @@ -68,11 +79,7 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
* #### Example:
*
* ```html
* <vaadin-crud
* id="crud"
* items='[{"name": "John", "surname": "Lennon", "role": "singer"},
* {"name": "Ringo", "surname": "Starr", "role": "drums"}]'
* >
* <vaadin-crud id="crud">
* <vaadin-grid slot="grid">
* <vaadin-crud-edit-column></vaadin-crud-edit-column>
* <vaadin-grid-column id="column1"></vaadin-grid-column>
Expand Down Expand Up @@ -112,6 +119,12 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
* column2.renderer = (root, column, model) => {
* root.textContent = model.item.surname;
* };
*
* crud.items = [
* { name: 'John', surname: 'Lennon', role: 'singer' },
* { name: 'Ringo', surname: 'Starr', role: 'drums' },
* // ... more items
* ];
* ```
*
* ### Helpers
Expand Down

0 comments on commit 97f6772

Please sign in to comment.