import 'polymer/polymer.html'; import 'polymer/polymer-element.html'; import './ozone-collection.html'; import { Item, FromOzone, UUID } from 'ozone-type'; import { StatefulOzone } from 'ozone-api-item'; import { SearchQuery } from 'ozone-search-helper'; /** * is a generic component to manage collection of item. * * ## usage * * ```html * * ``` * ### Events * * *collection-property-changed* fire on attribute change. details contain {name:string, value:any} * */ export declare class OzoneCollection extends Polymer.Element implements StatefulOzone { _currentRequest: Promise; $: { scrollTheshold: { clearTriggers(): void; }; } | undefined; /** * collection of the OzoneApiItem to be use as source * By default it use default item collection */ collection: string; /** * Array of items loaded from the source * @notify: true */ items: Array; /** * total number of results found in ozone * @notify: true */ total: Number; /** * true if there is still data to be loaded in the collection. * @notify: true */ hasMoreData: boolean; /** * map function run on search result received from the server. * Useful form migration task */ mapSearchResult: { (item: FromOzone): FromOzone; } | undefined; private _source; private get _getSource(); private _searchIterator?; constructor(); updateSource(collection: string): void; /** * load first collection items * items are added to the items array. * @param size {number} number of items to load default value is 10 */ loadItems(size: number): Promise>>; /** * quick search for items in the collection. * @param searchString * @param size {number} number of items to load default value is 10 */ quickSearch(searchString: string, size?: number): Promise>>; /** * Start a complex search on the collection * found items are added to the items array. * @param searchQuery {SearchQuery} search query * @param keepData {Boolean} keep items in collection. Default is false, it will delete items before search. */ search(searchQuery: SearchQuery, keepData?: boolean): Promise>>; /** * query next search result from ozone. * found items are added to the items array. * @return {Promise} */ loadNextItems(keepData?: boolean): Promise>>; private _addSearchResult; /** * find one item in ozone collection. * The item found is added in the items array. * @param id {UUID} id of the item to get. * @return {Promise>} promise resolve with the item or null (if not found). */ findOne(id: UUID): Promise; private isDefined; /** * save all items present in items on ozone. * items are updated with the result of the save. * @return {Promise>} promise resolve with the list io items saved. */ saveAll(): Promise>; /** * get index of an id in items * @param id {UUID} id of the item * @return {number} index of the item in items. -1 when not found. */ getIndexById(id?: UUID): number; /** * save one item in ozone. * result is reflect in items. * @param {Item} item to save. * @param reflect {boolean} reflect change from ozone in items list * @return {Promise} Promise resolve with index of the item in items. */ saveOne(item: Partial, reflect?: boolean): Promise; /** * Update one or several item in the collection. * New elements will be add at the end. * @param items */ update(...items: Array>): Promise>; /** * Create a new item in the collection * @param item * @param reflect {boolean} reflect change from ozone in items list * @return {Promise} promise the resolve with the index in items */ add(item: Partial, reflect?: boolean): Promise; _addItem(item: Partial, reflect?: boolean): Promise; /** * delete all items store in items from ozone. * @param reflect {boolean} reflect change from ozone in items list * @return {Promise} */ deleteAll(reflect?: boolean): Promise; /** * Delete from ozone a list of item. * @param ids {Array} list of id to delete from ozone. * @param reflect {boolean} reflect change from ozone in items list * @return {any} */ deleteItems(ids: Array, reflect?: boolean): Promise; /** * delete one item from ozone. * @param id {UUID} id to delete * @param reflect {boolean} reflect change from ozone in items list * @return {any} */ deleteOne(id: UUID, reflect?: boolean): Promise; clear(): Promise; private setAll; private _removeOne; private _verifySource; private hasMoreDataChange; private totalChange; private propertyUpdate; }