|
| 1 | +import { EventMap, EventsDefinition } from '../object-plus'; |
| 2 | +import { Transactional, CloneOptions, TransactionOptions, TransactionalDefinition } from '../transactions'; |
| 3 | +import { Record, AggregatedType } from '../record'; |
| 4 | +import { IdIndex, CollectionCore, CollectionTransaction } from './commons'; |
| 5 | +export declare type GenericComparator = string | ((x: Record) => number) | ((a: Record, b: Record) => number); |
| 6 | +export interface CollectionOptions extends TransactionOptions { |
| 7 | + comparator?: GenericComparator; |
| 8 | + model?: typeof Record; |
| 9 | +} |
| 10 | +export interface CollectionDefinition extends TransactionalDefinition { |
| 11 | + model?: Record; |
| 12 | + itemEvents?: EventsDefinition; |
| 13 | + _itemEvents?: EventMap; |
| 14 | +} |
| 15 | +export declare class Collection extends Transactional implements CollectionCore { |
| 16 | + _shared: number; |
| 17 | + _aggregationError: Record[]; |
| 18 | + static Subset: typeof Collection; |
| 19 | + static Refs: typeof Collection; |
| 20 | + static _SubsetOf: typeof Collection; |
| 21 | + createSubset(models: any, options: any): any; |
| 22 | + static predefine(): any; |
| 23 | + static define(protoProps?: CollectionDefinition, staticProps?: any): any; |
| 24 | + static subsetOf: (collectionReference: any) => any; |
| 25 | + _itemEvents: EventMap; |
| 26 | + models: Record[]; |
| 27 | + readonly __inner_state__: Record[]; |
| 28 | + _byId: IdIndex; |
| 29 | + comparator: GenericComparator; |
| 30 | + getStore(): Transactional; |
| 31 | + _store: Transactional; |
| 32 | + _comparator: (a: Record, b: Record) => number; |
| 33 | + _onChildrenChange(record: Record, options?: TransactionOptions, initiator?: Transactional): void; |
| 34 | + get(objOrId: string | Record | Object): Record; |
| 35 | + each(iteratee: (val: Record, key: number) => void, context?: any): void; |
| 36 | + map<T>(iteratee: (val: Record, key: number) => T, context?: any): T[]; |
| 37 | + _validateNested(errors: {}): number; |
| 38 | + model: typeof Record; |
| 39 | + idAttribute: string; |
| 40 | + constructor(records?: (Record | {})[], options?: CollectionOptions, shared?: number); |
| 41 | + initialize(): void; |
| 42 | + readonly length: number; |
| 43 | + first(): Record; |
| 44 | + last(): Record; |
| 45 | + at(a_index: number): Record; |
| 46 | + clone(options?: CloneOptions): this; |
| 47 | + toJSON(): Object[]; |
| 48 | + set(elements?: ElementsArg, options?: TransactionOptions): this; |
| 49 | + dispose(): void; |
| 50 | + reset(a_elements?: ElementsArg, options?: TransactionOptions): Record[]; |
| 51 | + add(a_elements: ElementsArg, options?: TransactionOptions): Record[]; |
| 52 | + remove(recordsOrIds: any, options?: TransactionOptions): Record[] | Record; |
| 53 | + _createTransaction(a_elements: ElementsArg, options?: TransactionOptions): CollectionTransaction; |
| 54 | + static _attribute: typeof AggregatedType; |
| 55 | + pluck(key: string): any[]; |
| 56 | + sort(options?: TransactionOptions): this; |
| 57 | + push(model: any, options: any): Record[]; |
| 58 | + pop(options: any): Record; |
| 59 | + unshift(model: any, options: any): Record[]; |
| 60 | + shift(options?: CollectionOptions): Record; |
| 61 | + slice(): Record[]; |
| 62 | + indexOf(modelOrId: any): number; |
| 63 | + modelId(attrs: {}): any; |
| 64 | + toggle(model: Record, a_next?: boolean): boolean; |
| 65 | + _log(level: string, text: string, value: any): void; |
| 66 | + getClassName(): string; |
| 67 | +} |
| 68 | +export declare type ElementsArg = Object | Record | Object[] | Record[]; |
0 commit comments