-
Notifications
You must be signed in to change notification settings - Fork 609
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TypeScript - CustomStore onLoaded result own param type (T1197789) (#…
- Loading branch information
1 parent
c5a5558
commit 35147f4
Showing
17 changed files
with
375 additions
and
334 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,243 +1,68 @@ | ||
// eslint-disable-next-line max-classes-per-file | ||
import { | ||
DxPromise, | ||
DxExtendedPromise, | ||
} from '../core/utils/deferred'; | ||
import { DeepPartial } from '../core/index'; | ||
import { | ||
FilterDescriptor, | ||
GroupDescriptor, | ||
Store as BaseStore, | ||
Options as BaseStoreOptions, | ||
} from './store'; | ||
import { | ||
LoadOptions, | ||
} from './index'; | ||
|
||
export type Options< | ||
TItem = any, | ||
TKey = any, | ||
> = StoreOptions<TItem, TKey>; | ||
TItem = any, | ||
TKey = any, | ||
> = AbstractStoreOptions<TItem, TKey>; | ||
|
||
/** | ||
* @namespace DevExpress.data | ||
* @deprecated Use Options instead | ||
* @docid | ||
* @hidden | ||
*/ | ||
export interface StoreOptions< | ||
TItem = any, | ||
TKey = any, | ||
> { | ||
/** | ||
* @docid | ||
* @public | ||
*/ | ||
errorHandler?: Function; | ||
/** | ||
* @docid | ||
* @public | ||
*/ | ||
key?: string | Array<string>; | ||
/** | ||
* @docid | ||
* @type_function_param1 values:object | ||
* @type_function_param2 key:object|string|number | ||
* @action | ||
* @public | ||
*/ | ||
onInserted?: ((values: TItem, key: TKey) => void); | ||
/** | ||
* @docid | ||
* @type_function_param1 values:object | ||
* @action | ||
* @public | ||
*/ | ||
onInserting?: ((values: TItem) => void); | ||
/** | ||
* @docid | ||
* @type_function_param2 loadOptions:LoadOptions | ||
* @action | ||
* @public | ||
*/ | ||
onLoaded?: ((result: Array<TItem>, loadOptions: LoadOptions<TItem>) => void); | ||
/** | ||
* @docid | ||
* @type_function_param1 loadOptions:LoadOptions | ||
* @action | ||
* @public | ||
*/ | ||
onLoading?: ((loadOptions: LoadOptions<TItem>) => void); | ||
/** | ||
* @docid | ||
* @action | ||
* @public | ||
*/ | ||
onModified?: Function; | ||
/** | ||
* @docid | ||
* @action | ||
* @public | ||
*/ | ||
onModifying?: Function; | ||
/** | ||
* @docid | ||
* @action | ||
* @public | ||
*/ | ||
onPush?: ((changes: Array<TItem>) => void); | ||
/** | ||
* @docid | ||
* @type_function_param1 key:object|string|number | ||
* @action | ||
* @public | ||
*/ | ||
onRemoved?: ((key: TKey) => void); | ||
/** | ||
* @docid | ||
* @type_function_param1 key:object|string|number | ||
* @action | ||
* @public | ||
*/ | ||
onRemoving?: ((key: TKey) => void); | ||
/** | ||
* @docid | ||
* @type_function_param1 key:object|string|number | ||
* @type_function_param2 values:object | ||
* @action | ||
* @public | ||
*/ | ||
onUpdated?: ((key: TKey, values: TItem) => void); | ||
/** | ||
* @docid | ||
* @type_function_param1 key:object|string|number | ||
* @type_function_param2 values:object | ||
* @action | ||
* @public | ||
*/ | ||
onUpdating?: ((key: TKey, values: TItem) => void); | ||
interface AbstractStoreOptions< | ||
TItem = any, | ||
TKey = any, | ||
> extends BaseStoreOptions<TItem, TKey> { | ||
/** | ||
* @docid StoreOptions.onLoaded | ||
* @type_function_param2 loadOptions:LoadOptions | ||
* @action | ||
* @public | ||
*/ | ||
onLoaded?: ((result: Array<TItem>, loadOptions: LoadOptions<TItem>) => void); | ||
} | ||
|
||
type EventName = 'loaded' | 'loading' | 'inserted' | 'inserting' | 'updated' | 'updating' | 'push' | 'removed' | 'removing' | 'modified' | 'modifying'; | ||
|
||
/** | ||
* @docid Store | ||
* @hidden | ||
* @namespace DevExpress.data | ||
* @options StoreOptions | ||
*/ | ||
export class Store< | ||
TItem = any, | ||
TKey = any, | ||
> { | ||
constructor(options?: Options<TItem, TKey>); | ||
/** | ||
* @docid | ||
* @publicName insert(values) | ||
* @param1 values:object | ||
* @return Promise<any> | ||
* @public | ||
*/ | ||
insert(values: TItem): DxExtendedPromise<TItem>; | ||
/** | ||
* @docid | ||
* @publicName key() | ||
* @public | ||
*/ | ||
key(): string | Array<string>; | ||
/** | ||
* @docid | ||
* @publicName keyOf(obj) | ||
* @param1 obj:object | ||
* @return any|string|number | ||
* @public | ||
*/ | ||
keyOf(obj: TItem): TKey; | ||
/** | ||
* @docid | ||
* @publicName off(eventName) | ||
* @param1 eventName:string | ||
* @return this | ||
* @public | ||
*/ | ||
off(eventName: EventName): this; | ||
/** | ||
* @docid | ||
* @publicName off(eventName, eventHandler) | ||
* @param1 eventName:string | ||
* @return this | ||
* @public | ||
*/ | ||
off(eventName: EventName, eventHandler: Function): this; | ||
/** | ||
* @docid | ||
* @publicName on(eventName, eventHandler) | ||
* @param1 eventName:string | ||
* @return this | ||
* @public | ||
*/ | ||
on(eventName: EventName, eventHandler: Function): this; | ||
/** | ||
* @docid | ||
* @publicName on(events) | ||
* @param1 events:object | ||
* @return this | ||
* @public | ||
*/ | ||
on(events: { [key in EventName]?: Function }): this; | ||
/** | ||
* @docid | ||
* @publicName push(changes) | ||
* @param1 changes:Array<any> | ||
* @public | ||
*/ | ||
push(changes: Array<{ type: 'insert' | 'update' | 'remove'; data?: DeepPartial<TItem>; key?: TKey; index?: number }>): void; | ||
/** | ||
* @docid | ||
* @publicName remove(key) | ||
* @param1 key:object|string|number | ||
* @return Promise<void> | ||
* @public | ||
*/ | ||
remove(key: TKey): DxPromise<void>; | ||
/** | ||
* @docid | ||
* @publicName totalCount(options) | ||
* @param1_field filter:object | ||
* @param1_field group:object | ||
* @return Promise<number> | ||
* @public | ||
*/ | ||
totalCount(obj: { filter?: FilterDescriptor | Array<FilterDescriptor>; group?: GroupDescriptor<TItem> | Array<GroupDescriptor<TItem>> }): DxPromise<number>; | ||
/** | ||
* @docid | ||
* @publicName update(key, values) | ||
* @param1 key:object|string|number | ||
* @param2 values:object | ||
* @return Promise<any> | ||
* @public | ||
*/ | ||
update(key: TKey, values: DeepPartial<TItem>): DxExtendedPromise<TItem>; | ||
} | ||
|
||
export default class AbstractStore< | ||
TItem = any, | ||
TKey = any, | ||
> extends BaseStore<TItem, TKey> { | ||
constructor(options?: Options<TItem, TKey>); | ||
/** | ||
* @docid Store.load() | ||
* @publicName load() | ||
* @return Promise<any> | ||
* @public | ||
*/ | ||
load(): DxExtendedPromise<Array<TItem>>; | ||
/** | ||
* @namespace DevExpress.data | ||
* @docid Store.load(options) | ||
* @publicName load(options) | ||
* @param1 options:LoadOptions | ||
* @return Promise<any> | ||
* @public | ||
*/ | ||
export default class AbstractStore< | ||
TItem = any, | ||
TKey = any, | ||
> extends Store<TItem, TKey> { | ||
constructor(options?: Options<TItem, TKey>); | ||
/** | ||
* @docid Store.load() | ||
* @publicName load() | ||
* @return Promise<any> | ||
* @public | ||
*/ | ||
load(): DxExtendedPromise<Array<TItem>>; | ||
load(options: LoadOptions<TItem>): DxExtendedPromise<Array<TItem>>; | ||
} | ||
|
||
/** | ||
* @namespace DevExpress.data | ||
* @deprecated Use Options from data/store instead | ||
*/ | ||
export type StoreOptions<TItem = any, TKey = any> = BaseStoreOptions<TItem, TKey>; | ||
|
||
/** | ||
* @docid Store.load(options) | ||
* @publicName load(options) | ||
* @param1 options:LoadOptions | ||
* @return Promise<any> | ||
* @public | ||
*/ | ||
load(options: LoadOptions<TItem>): DxExtendedPromise<Array<TItem>>; | ||
} | ||
/** | ||
* @namespace DevExpress.data | ||
* @deprecated Use Store from data/store instead | ||
*/ | ||
export type Store<TItem = any, TKey = any> = BaseStore<TItem, TKey>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.