@rentman/rm-core 2.0.4 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +5 -0
- package/dist/rm-core.js +36 -15
- package/dist/rm-core.min.js +1 -1
- package/dist/src/classes/cache/transaction/TransactionCache.d.ts +5 -1
- package/dist/src/models/CollectionResource.d.ts +1 -1
- package/dist/src/models/CollectionResourceOptions.d.ts +1 -0
- package/dist/src/models/ItemResource.d.ts +10 -1
- package/package.json +1 -1
|
@@ -114,8 +114,12 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
114
114
|
*
|
|
115
115
|
* @param itemEntry The entry to get the parent from
|
|
116
116
|
* @param fromInitial If `true` the parent values will be read from {@link TransactionItemEntryChanges.initial initial} (Useful for when you've moved an entry)
|
|
117
|
+
* @param providedFields Use the provided fields instead of the cached fields, used by {@link CollectionResource.getParent CollectionResource.getParent}
|
|
118
|
+
*
|
|
119
|
+
* @remark
|
|
120
|
+
* Use {@link CollectionResource.getParent CollectionResource.getParent} instead of {@link TransactionCache.getParent TransactionCache.getParent} if you're getting the parent in the onRemove callback
|
|
117
121
|
*/
|
|
118
|
-
getParent(itemEntry: ItemEntry
|
|
122
|
+
getParent<ItemTypeType extends ItemType>(itemEntry: ItemEntry<ItemTypeType>, fromInitial?: boolean, providedFields?: FieldMap<ItemTypeType>): EntryParentNull;
|
|
119
123
|
/**
|
|
120
124
|
* @description
|
|
121
125
|
* Traverses the transaction chain and returns the changes of the item on the first transaction
|
|
@@ -15,7 +15,7 @@ export declare abstract class CollectionResource<ItemTypeType extends ItemType =
|
|
|
15
15
|
onConstruct(): void;
|
|
16
16
|
getIdArray(): ItemId[];
|
|
17
17
|
getItemById(itemId: number): T;
|
|
18
|
-
addItemResources(itemEntries: Array<ItemEntry<ItemTypeType>>,
|
|
18
|
+
addItemResources(itemEntries: Array<ItemEntry<ItemTypeType>>, isInitialCall?: boolean): T[];
|
|
19
19
|
/**
|
|
20
20
|
* @description
|
|
21
21
|
* Returns the {@link ItemResource ItemResources} that where removed from the {@link CollectionResource collection}.
|
|
@@ -10,6 +10,7 @@ export declare class CollectionResourceOptions<ItemTypeType extends ItemType> {
|
|
|
10
10
|
remoteItems: boolean;
|
|
11
11
|
editCollection: boolean;
|
|
12
12
|
enableSave: boolean;
|
|
13
|
+
callOnAddWithInitialItems: boolean;
|
|
13
14
|
/**
|
|
14
15
|
* @deprecated
|
|
15
16
|
* You should use itemResource.onChange and compare previous.id with fields.id
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TransactionCache } from '../classes';
|
|
2
2
|
import { ItemResourceFactory } from '../factories';
|
|
3
3
|
import { ItemEntry, ItemResourceOptions } from '../models';
|
|
4
|
-
import { FieldMap, ItemType, ResponseColumn } from '../types';
|
|
4
|
+
import { EntryParentNull, FieldMap, ItemType, ResponseColumn } from '../types';
|
|
5
5
|
export declare abstract class ItemResource<ItemTypeType extends ItemType = any> {
|
|
6
6
|
protected readonly factory: ItemResourceFactory;
|
|
7
7
|
readonly entry: ItemEntry<ItemTypeType>;
|
|
@@ -15,6 +15,15 @@ export declare abstract class ItemResource<ItemTypeType extends ItemType = any>
|
|
|
15
15
|
initial: Readonly<FieldMap<ItemTypeType>>;
|
|
16
16
|
protected constructor(factory: ItemResourceFactory, entry: ItemEntry<ItemTypeType>, options: ItemResourceOptions<ItemResource<ItemTypeType>>, _isNew: boolean, transaction: TransactionCache);
|
|
17
17
|
onConstruct(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Fetches the ItemResource's parent with the current fields
|
|
20
|
+
*
|
|
21
|
+
* ----------------
|
|
22
|
+
*
|
|
23
|
+
* @remark
|
|
24
|
+
* Use this if you need to get the parent after an item has been deleted
|
|
25
|
+
*/
|
|
26
|
+
getParent(fromInitial?: boolean): EntryParentNull;
|
|
18
27
|
/**
|
|
19
28
|
* @deprecated
|
|
20
29
|
* Use {@link TransactionCache.applyChangesDelta transaction.applyChangesDelta} instead
|