Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: remove Polymer specific demo from API docs (#5095) (CP: 23.2) #5097

Merged
merged 1 commit into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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