@arrai-innovations/reactive-helpers 20.1.1 → 20.1.3

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/index.js CHANGED
@@ -30,6 +30,7 @@ export * from "./utils/compact.js";
30
30
  export * from "./utils/deepUnref.js";
31
31
  export * from "./utils/deleteKey.js";
32
32
  export * from "./utils/flattenPaths.js";
33
+ export * from "./utils/flattenPathsWithValues.js";
33
34
  export * from "./utils/getFakePk.js";
34
35
  export * from "./utils/keepAliveTry.js";
35
36
  export * from "./utils/keyDiff.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arrai-innovations/reactive-helpers",
3
- "version": "20.1.1",
3
+ "version": "20.1.3",
4
4
  "description": "VueJS 3 utility composition functions to help manipulate objects and lists.",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/types/index.d.ts CHANGED
@@ -29,6 +29,7 @@ export * from "./utils/compact.js";
29
29
  export * from "./utils/deepUnref.js";
30
30
  export * from "./utils/deleteKey.js";
31
31
  export * from "./utils/flattenPaths.js";
32
+ export * from "./utils/flattenPathsWithValues.js";
32
33
  export * from "./utils/getFakePk.js";
33
34
  export * from "./utils/keepAliveTry.js";
34
35
  export * from "./utils/keyDiff.js";
@@ -102,7 +102,7 @@ export type ListOptions = {
102
102
  /**
103
103
  * - Indicates whether old pages should be kept when paginating.
104
104
  */
105
- keepOldPages: boolean;
105
+ keepOldPages: import("vue").Ref<boolean> | boolean;
106
106
  /**
107
107
  * - Indicates whether the list should be cleared when the list intent is triggered.
108
108
  */
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../use/list.js"],"names":[],"mappings":"AAmBA;;;;;;;GAOG;AAEH;;GAEG;AACH;IACI;;;;;OAKG;IACH,qBAHW,MAAM,QACN,MAAM,EAMhB;IADG,aAAgB;CAEvB;AAmHM,sCAPI;IACV,CAAO,GAAG,EAAE,MAAM,GAAG,WAAW,CAA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AClC,OAAO;;;;oBACP,MAAM;;;;sBACN,MAAM;;;;4BACN,OAAO;;;;;;2BAOR,CACZ,CACA,OAAiB,mBAAmB,EAAE,oBAAoB,GAC1D,OAAiB,4BAA4B,EAAE,yBAAyB,CACjE,GACP,OAAa,uBAAuB,EAAE,wBAAwB,GAC9D,OAAa,kBAAkB,EAAE,mBAAmB,GACpD,OAAa,qBAAqB,EAAE,sBAAsB,GAC1D,OAAa,iBAAiB,EAAE,kBAAkB,GAClD,OAAa,iBAAiB,EAAE,kBAAkB,GAClD,OAAa,eAAe,EAAE,gBAAgB,CAC3C;;;;;wBAOS,OAAO,KAAK,EAAE,gBAAgB,CAAC,YAAY,CAAC;;;;0BAM5C;IACN,YAAY,EAAE,OAAO,mBAAmB,EAAE,YAAY,GAAG,OAAO,4BAA4B,EAAE,iBAAiB,CAAC;IAChH,gBAAgB,EAAE,OAAO,uBAAuB,EAAE,gBAAgB,CAAC;IACnE,WAAW,EAAE,OAAO,kBAAkB,EAAE,WAAW,CAAC;IACpD,cAAc,EAAE,OAAO,qBAAqB,EAAE,cAAc,CAAC;IAC7D,UAAU,EAAE,OAAO,iBAAiB,EAAE,UAAU,CAAC;IACjD,UAAU,EAAE,OAAO,iBAAiB,EAAE,UAAU,CAAC;IACjD,QAAQ,EAAE,OAAO,eAAe,EAAE,QAAQ,CAAA;CAC7C;;;;4BAMS,CACZ,OAAa,mBAAmB,EAAE,qBAAqB,GAC/C,OAAO,uBAAuB,EAAE,yBAAyB,CAC9D;;;;;;;;;aAcU,WAAW;;;;WACX,SAAS;;;;iBACT,OAAO,KAAK,EAAE,WAAW;;;;;;0BAO1B,aAAa,GAAG,qBAAqB"}
@@ -20,7 +20,7 @@
20
20
  * function.
21
21
  * @property {import('../config/listCrud.js').CrudListSubscribeFn} [handlers.subscribe] - Provide the implementation for the
22
22
  * subscribe function.
23
- * @property {boolean} keepOldPages - If true, pages will not be cleared when defaultPageCallback is called.
23
+ * @property {import('vue').Ref<boolean>|boolean} keepOldPages - If true, pages will not be cleared when defaultPageCallback is called.
24
24
  */
25
25
  /**
26
26
  * The objects by pk.
@@ -210,7 +210,7 @@ export type ListInstanceOptions = {
210
210
  /**
211
211
  * - If true, pages will not be cleared when defaultPageCallback is called.
212
212
  */
213
- keepOldPages: boolean;
213
+ keepOldPages: import("vue").Ref<boolean> | boolean;
214
214
  };
215
215
  /**
216
216
  * The objects by pk.
@@ -1 +1 @@
1
- {"version":3,"file":"listInstance.d.ts","sourceRoot":"","sources":["../../use/listInstance.js"],"names":[],"mappings":"AAwCA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;GAeG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;GAIG;AAEH;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;;GAKG;AACH,mDAHW;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAAA;CAAC,GAClC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAA;CAAC,CASzC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,mEALW,mBAAmB,GAEjB,YAAY,CAmTxB;AAlfD;;;;GAIG;AAEH;;;;;GAKG;AAEH;;;GAGG;AACH;IACI;;;;;OAKG;IACH,qBAHW,MAAM,QACN,MAAM,EAMhB;IADG,aAAgB;CAEvB;;;;;;;;WAMa,MAAM;;;;YACN,MAAM;;;;YACN,MAAM;;;;;;;;;WAON,OAAO,KAAK,EAAE,gBAAgB,CAAC,iBAAiB,CAAC;;;;eAE5D;QAAiE,IAAI,GAA1D,OAAO,uBAAuB,EAAE,UAAU;QAEmB,UAAU,GAAtE,OAAO,uBAAuB,EAAE,gBAAgB;QAEgB,aAAa,GAA5E,OAAO,uBAAuB,EAAE,mBAAmB;QAEU,SAAS,GAAxE,OAAO,uBAAuB,EAAE,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import("./listInstance.js").ListInstanceOptions} ListSubscriptionOptions
48
48
  * @property {import("./listInstance.js").ListInstance} listInstance - A list instance to use instead of creating one.
49
49
  * @property {boolean} clearListOnListIntentTriggered - If true, the list will be cleared when the list intent is triggered. Default is false.
50
- * @property {boolean} keepOldPages - If true, pages will not be cleared when defaultPageCallback is called.
50
+ * @property {import('vue').Ref<boolean>|boolean} keepOldPages - If true, pages will not be cleared when defaultPageCallback is called.
51
51
  */
52
52
  /**
53
53
  * A Vue composition function that creates multiple list subscriptions, and returns them as an object.
@@ -8,7 +8,7 @@ export type PagedListListanceOptions = {
8
8
  /**
9
9
  * - Whether to keep old pages.
10
10
  */
11
- keepOldPages: boolean;
11
+ keepOldPages: import("vue").Ref<boolean> | boolean;
12
12
  };
13
13
  export type PaginatedRawState = {
14
14
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"paginatedListInstance.d.ts","sourceRoot":"","sources":["../../use/paginatedListInstance.js"],"names":[],"mappings":"AA4DA;;;;GAIG;AACH,+EAHW,wBAAwB,GAAG,OAAO,mBAAmB,EAAE,mBAAmB,GACxE,iBAAiB,CA8D7B;;;;;kBAnHa,OAAO;;;;;;kBAKP,MAAM;;;;gBACN,MAAM;;;;aACN,MAAM;;;;eACN,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;;6BAItB,OAAO,KAAK,EAAE,gBAAgB,CAAC,iBAAiB,CAAC;;;;;kBAKhD,OAAO,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC;;;;gBACzB,OAAO,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC;;;;aACzB,OAAO,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC;;;;eACzB,OAAO,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;;wCAIzC,OAAO,mBAAmB,EAAE,oBAAoB,GAAG,+BAA+B;;;;;;WASjF,sBAAsB;;gCAIvB,OAAO,mBAAmB,EAAE,YAAY,GAAG,oBAAoB;yBA9C3C,KAAK"}
1
+ {"version":3,"file":"paginatedListInstance.d.ts","sourceRoot":"","sources":["../../use/paginatedListInstance.js"],"names":[],"mappings":"AA4DA;;;;GAIG;AACH,+EAHW,wBAAwB,GAAG,OAAO,mBAAmB,EAAE,mBAAmB,GACxE,iBAAiB,CA8D7B;;;;;kBAnHa,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,GAAC,OAAO;;;;;;kBAKlC,MAAM;;;;gBACN,MAAM;;;;aACN,MAAM;;;;eACN,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;;6BAItB,OAAO,KAAK,EAAE,gBAAgB,CAAC,iBAAiB,CAAC;;;;;kBAKhD,OAAO,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC;;;;gBACzB,OAAO,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC;;;;aACzB,OAAO,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC;;;;eACzB,OAAO,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;;wCAIzC,OAAO,mBAAmB,EAAE,oBAAoB,GAAG,+BAA+B;;;;;;WASjF,sBAAsB;;gCAIvB,OAAO,mBAAmB,EAAE,YAAY,GAAG,oBAAoB;yBA9CpC,KAAK"}
@@ -1,26 +1,6 @@
1
+ export function deepUnref<T>(val: T): DeepUnwrap<T> | T;
1
2
  /**
2
3
  * Recursively unwraps refs from a nested object, array, or primitive.
3
- *
4
- * @template T
5
- * @typedef {T extends import('vue').Ref<infer U>
6
- * ? DeepUnwrap<U>
7
- * : T extends Array<infer V>
8
- * ? Array<DeepUnwrap<V>>
9
- * : T extends object
10
- * ? { [K in keyof T]: DeepUnwrap<T[K]> }
11
- * : T
12
- * } DeepUnwrap
13
4
  */
14
- /**
15
- * Safe, recursively-typed deep unref.
16
- *
17
- * @template T
18
- * @param {T} val - The value to deeply unwrap.
19
- * @returns {DeepUnwrap<T>} - The deeply unwrapped value.
20
- */
21
- export const deepUnref: any;
22
- /**
23
- * Recursively unwraps refs from a nested object, array, or primitive.
24
- */
25
- export type DeepUnwrap<T_1> = T_1 extends import("vue").Ref<infer U> ? DeepUnwrap<U> : T_1 extends Array<infer V> ? Array<DeepUnwrap<V>> : T_1 extends object ? { [K in keyof T_1]: DeepUnwrap<T_1[K]>; } : T_1;
5
+ export type DeepUnwrap<T> = T extends import("vue").Ref<infer U> ? DeepUnwrap<U> : T extends Array<infer V> ? Array<DeepUnwrap<V>> : T extends object ? { [K in keyof T]: DeepUnwrap<T[K]>; } : T;
26
6
  //# sourceMappingURL=deepUnref.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deepUnref.d.ts","sourceRoot":"","sources":["../../utils/deepUnref.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAIH;;;;;;GAMG;AACH,4BAAoC;;;;8BAnBvB,GAAC,SAAS,OAAO,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,GAC1C,UAAU,CAAC,CAAC,CAAC,GACb,GAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GACtB,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GACpB,GAAC,SAAS,MAAM,GACd,GAAG,CAAC,IAAI,MAAM,GAAC,GAAG,UAAU,CAAC,GAAC,CAAC,CAAC,CAAC,CAAC,GAAE,GACpC,GAAC"}
1
+ {"version":3,"file":"deepUnref.d.ts","sourceRoot":"","sources":["../../utils/deepUnref.js"],"names":[],"mappings":"AA2BO,0BAJM,CAAC,OACH,CAAC,GACC,UAAU,CAAC,CAAC,CAAC,GAAC,CAAC,CAe3B;;;;uBAjCY,CAAC,IACD,CAAC,SAAS,OAAO,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,GAC1C,UAAU,CAAC,CAAC,CAAC,GACb,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GACtB,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GACpB,CAAC,SAAS,MAAM,GACd,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAE,GACpC,CAAC"}
@@ -11,6 +11,7 @@ export function lodashLikePathSplit(string: string, object: object): string[];
11
11
  *
12
12
  * @param {object} obj - The object to modify.
13
13
  * @param {string} path - The key to delete.
14
+ * @returns {boolean} Returns true if the key was deleted, false otherwise.
14
15
  */
15
- export function del(obj: object, path: string): void;
16
+ export function del(obj: object, path: string): boolean;
16
17
  //# sourceMappingURL=deleteKey.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deleteKey.d.ts","sourceRoot":"","sources":["../../utils/deleteKey.js"],"names":[],"mappings":"AAgBA;;;;;;GAMG;AACH,4CAJW,MAAM,UACN,MAAM,GACJ,MAAM,EAAE,CAkBpB;AAED;;;;;GAKG;AACH,yBAHW,MAAM,QACN,MAAM,QAiBhB"}
1
+ {"version":3,"file":"deleteKey.d.ts","sourceRoot":"","sources":["../../utils/deleteKey.js"],"names":[],"mappings":"AAgBA;;;;;;GAMG;AACH,4CAJW,MAAM,UACN,MAAM,GACJ,MAAM,EAAE,CAkBpB;AAED;;;;;;GAMG;AACH,yBAJW,MAAM,QACN,MAAM,GACJ,OAAO,CAkBnB"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Get all primitive paths and their corresponding values from an array or object.
3
+ *
4
+ * @module utils/flattenPathsWithValues.js
5
+ */
6
+ /**
7
+ * Turn an array or object into an array of `[path, value]` pairs (for primitives)
8
+ * and a list of container paths (for arrays and objects).
9
+ *
10
+ * Array indexes are wrapped in square brackets and object keys are prefixed with a period.
11
+ *
12
+ * @param {any[] | object} arrayOrObject - Array or object to flatten.
13
+ * @param {object} [options] - Options.
14
+ * @param {string} [options.currentPath=""] - Current path, for recursion or as a starting point.
15
+ * @param {number} [options.depth=0] - Current depth, for recursion.
16
+ * @param {number} [options.limit=0] - Limit the depth of recursion.
17
+ * @returns {{
18
+ * pathValues: [string, any][],
19
+ * containerPaths: string[]
20
+ * }} - Paths and their corresponding values.
21
+ */
22
+ export function flattenPathsWithValues(arrayOrObject: any[] | object, { currentPath, depth, limit }?: {
23
+ currentPath?: string;
24
+ depth?: number;
25
+ limit?: number;
26
+ }): {
27
+ pathValues: [string, any][];
28
+ containerPaths: string[];
29
+ };
30
+ //# sourceMappingURL=flattenPathsWithValues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flattenPathsWithValues.d.ts","sourceRoot":"","sources":["../../utils/flattenPathsWithValues.js"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,sDAVW,GAAG,EAAE,GAAG,MAAM,kCAEtB;IAAyB,WAAW,GAA5B,MAAM;IACW,KAAK,GAAtB,MAAM;IACW,KAAK,GAAtB,MAAM;CACd,GAAU;IACR,UAAU,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;IAC5B,cAAc,EAAE,MAAM,EAAE,CAAA;CACzB,CAyCH"}
@@ -8,23 +8,23 @@
8
8
  * Result object of keyDiff and keyDiffDeep.
9
9
  *
10
10
  * @typedef {object} KeyDiffResult
11
- * @property {Set} [sameKeys] - If sameKeys option is true, return keys that are the same.
12
- * @property {Set} [removedKeys] - If removedKeys option is true, return keys that are removed.
13
- * @property {Set} [addedKeys] - If addedKeys option is true, return keys that are added.
11
+ * @property {Set<string>} [sameKeys] - If sameKeys option is true, return keys that are the same.
12
+ * @property {Set<string>} [removedKeys] - If removedKeys option is true, return keys that are removed.
13
+ * @property {Set<string>} [addedKeys] - If addedKeys option is true, return keys that are added.
14
14
  */
15
15
  /**
16
16
  * Calculate the difference between two arrays of keys, in terms of what keys
17
17
  * are the same, what keys are removed, and what keys are added.
18
18
  *
19
- * @param {string[]|Set} newKeys - Keys to consider as new.
20
- * @param {string[]|Set} oldKeys - Keys to consider as old.
19
+ * @param {string[]|Set<string>} newKeys - Keys to consider as new.
20
+ * @param {string[]|Set<string>} oldKeys - Keys to consider as old.
21
21
  * @param {object} [options] - Which differences are returned.
22
22
  * @param {boolean} [options.sameKeys=true] - If true, return keys that are the same.
23
23
  * @param {boolean} [options.removedKeys=true] - If true, return keys that are removed.
24
24
  * @param {boolean} [options.addedKeys=true] - If true, return keys that are added.
25
25
  * @returns {KeyDiffResult} - The differences.
26
26
  */
27
- export function keyDiff(newKeys: string[] | Set<any>, oldKeys: string[] | Set<any>, { sameKeys, removedKeys, addedKeys }?: {
27
+ export function keyDiff(newKeys: string[] | Set<string>, oldKeys: string[] | Set<string>, { sameKeys, removedKeys, addedKeys }?: {
28
28
  sameKeys?: boolean;
29
29
  removedKeys?: boolean;
30
30
  addedKeys?: boolean;
@@ -50,14 +50,14 @@ export type KeyDiffResult = {
50
50
  /**
51
51
  * - If sameKeys option is true, return keys that are the same.
52
52
  */
53
- sameKeys?: Set<any>;
53
+ sameKeys?: Set<string>;
54
54
  /**
55
55
  * - If removedKeys option is true, return keys that are removed.
56
56
  */
57
- removedKeys?: Set<any>;
57
+ removedKeys?: Set<string>;
58
58
  /**
59
59
  * - If addedKeys option is true, return keys that are added.
60
60
  */
61
- addedKeys?: Set<any>;
61
+ addedKeys?: Set<string>;
62
62
  };
63
63
  //# sourceMappingURL=keyDiff.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyDiff.d.ts","sourceRoot":"","sources":["../../utils/keyDiff.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AAEH;;;;;;;GAOG;AAEH;;;;;;;;;;;GAWG;AACH,iCARW,MAAM,EAAE,WAAI,WACZ,MAAM,EAAE,WAAI,yCAEpB;IAA0B,QAAQ,GAA1B,OAAO;IACW,WAAW,GAA7B,OAAO;IACW,SAAS,GAA3B,OAAO;CACf,GAAU,aAAa,CAgBzB;AAED;;;;;;;;;;;;GAYG;AACH,oCATW,MAAM,UACN,MAAM,YACN,MAAM,GAKJ,aAAa,CAUzB"}
1
+ {"version":3,"file":"keyDiff.d.ts","sourceRoot":"","sources":["../../utils/keyDiff.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AAEH;;;;;;;GAOG;AAEH;;;;;;;;;;;GAWG;AACH,iCARW,MAAM,EAAE,GAAC,GAAG,CAAC,MAAM,CAAC,WACpB,MAAM,EAAE,GAAC,GAAG,CAAC,MAAM,CAAC,yCAE5B;IAA0B,QAAQ,GAA1B,OAAO;IACW,WAAW,GAA7B,OAAO;IACW,SAAS,GAA3B,OAAO;CACf,GAAU,aAAa,CAgBzB;AAED;;;;;;;;;;;;GAYG;AACH,oCATW,MAAM,UACN,MAAM,YACN,MAAM,GAKJ,aAAa,CAUzB;;;;;;;;eAtDa,GAAG,CAAC,MAAM,CAAC;;;;kBACX,GAAG,CAAC,MAAM,CAAC;;;;gBACX,GAAG,CAAC,MAAM,CAAC"}
package/use/list.js CHANGED
@@ -68,7 +68,7 @@ export class ListError extends Error {
68
68
  * @property {ListRawProps} props - The properties for configuring the list.
69
69
  * @property {import('../config/listCrud.js').ListCrudHandlers} handlers - Additional handlers to be included in the list manager.
70
70
  * @property {boolean} paged - Indicates whether the list should be paginated.
71
- * @property {boolean} keepOldPages - Indicates whether old pages should be kept when paginating.
71
+ * @property {import('vue').Ref<boolean>|boolean} keepOldPages - Indicates whether old pages should be kept when paginating.
72
72
  * @property {boolean} clearListOnListIntentTriggered - Indicates whether the list should be cleared when the list intent is triggered.
73
73
  * @property {number} searchThrottle - The throttle time for text search.
74
74
  * @property {number} sortThrottleWait - The throttle time for sorting.
@@ -61,7 +61,7 @@ export class ListInstanceError extends Error {
61
61
  * function.
62
62
  * @property {import('../config/listCrud.js').CrudListSubscribeFn} [handlers.subscribe] - Provide the implementation for the
63
63
  * subscribe function.
64
- * @property {boolean} keepOldPages - If true, pages will not be cleared when defaultPageCallback is called.
64
+ * @property {import('vue').Ref<boolean>|boolean} keepOldPages - If true, pages will not be cleared when defaultPageCallback is called.
65
65
  */
66
66
 
67
67
  /**
@@ -287,7 +287,7 @@ export function useListInstance({ props, handlers = {}, keepOldPages }) {
287
287
 
288
288
  const defaultPageCallback = (/** @type {ListObject[]} */ newObjects) => {
289
289
  // with keepOldPages, you are responsible for clearing the list as needed
290
- if (!keepOldPages) {
290
+ if (!unref(keepOldPages)) {
291
291
  // display one page at a time, clear the list
292
292
  clearList();
293
293
  }
@@ -86,7 +86,7 @@ export class ListSubscriptionError extends Error {
86
86
  * @typedef {object & import("./listInstance.js").ListInstanceOptions} ListSubscriptionOptions
87
87
  * @property {import("./listInstance.js").ListInstance} listInstance - A list instance to use instead of creating one.
88
88
  * @property {boolean} clearListOnListIntentTriggered - If true, the list will be cleared when the list intent is triggered. Default is false.
89
- * @property {boolean} keepOldPages - If true, pages will not be cleared when defaultPageCallback is called.
89
+ * @property {import('vue').Ref<boolean>|boolean} keepOldPages - If true, pages will not be cleared when defaultPageCallback is called.
90
90
  */
91
91
 
92
92
  /**
@@ -1,5 +1,5 @@
1
1
  import { useListInstance } from "./listInstance.js";
2
- import { reactive, toRefs } from "vue";
2
+ import { reactive, toRefs, unref } from "vue";
3
3
 
4
4
  /**
5
5
  * @module use/paginatedListInstance.js
@@ -8,7 +8,7 @@ import { reactive, toRefs } from "vue";
8
8
 
9
9
  /**
10
10
  * @typedef {object} PagedListListanceOptions
11
- * @property {boolean} keepOldPages - Whether to keep old pages.
11
+ * @property {import('vue').Ref<boolean>|boolean} keepOldPages - Whether to keep old pages.
12
12
  */
13
13
 
14
14
  /**
@@ -94,7 +94,7 @@ export function usePagedListInstance({ keepOldPages, ...useListInstanceArgs }) {
94
94
  /** @type {import('../config/listCrud.js').PaginateInfo} */ { page, totalRecords, totalPages, perPage }
95
95
  ) => {
96
96
  // with keepOldPages, you are responsible for clearing the list as needed
97
- if (!keepOldPages) {
97
+ if (!unref(keepOldPages)) {
98
98
  // display one page at a time, clear the list
99
99
  paginatedListInstance.clearList();
100
100
  }
@@ -23,6 +23,19 @@ import { deepUnref as _deepUnref } from "vue-deepunref";
23
23
  *
24
24
  * @template T
25
25
  * @param {T} val - The value to deeply unwrap.
26
- * @returns {DeepUnwrap<T>} - The deeply unwrapped value.
26
+ * @returns {DeepUnwrap<T>|T} - The deeply unwrapped value.
27
27
  */
28
- export const deepUnref = _deepUnref;
28
+ export const deepUnref = (val) => {
29
+ if (
30
+ val instanceof Date ||
31
+ val instanceof RegExp ||
32
+ val instanceof Map ||
33
+ val instanceof Set ||
34
+ val instanceof WeakMap ||
35
+ val instanceof WeakSet
36
+ ) {
37
+ return val;
38
+ }
39
+
40
+ return _deepUnref(val);
41
+ };
@@ -44,10 +44,11 @@ export function lodashLikePathSplit(string, object) {
44
44
  *
45
45
  * @param {object} obj - The object to modify.
46
46
  * @param {string} path - The key to delete.
47
+ * @returns {boolean} Returns true if the key was deleted, false otherwise.
47
48
  */
48
49
  export function del(obj, path) {
49
50
  if (!obj) {
50
- return;
51
+ return false;
51
52
  }
52
53
  const pathArray = lodashLikePathSplit(path, obj);
53
54
  let index = 0;
@@ -57,7 +58,8 @@ export function del(obj, path) {
57
58
  obj = obj[toKey(pathArray[index++])];
58
59
  }
59
60
  if (!obj) {
60
- return;
61
+ return false;
61
62
  }
62
63
  delete obj[toKey(pathArray[index])];
64
+ return true;
63
65
  }
@@ -0,0 +1,65 @@
1
+ import isArray from "lodash-es/isArray.js";
2
+ import isObject from "lodash-es/isObject.js";
3
+
4
+ /**
5
+ * Get all primitive paths and their corresponding values from an array or object.
6
+ *
7
+ * @module utils/flattenPathsWithValues.js
8
+ */
9
+
10
+ /**
11
+ * Turn an array or object into an array of `[path, value]` pairs (for primitives)
12
+ * and a list of container paths (for arrays and objects).
13
+ *
14
+ * Array indexes are wrapped in square brackets and object keys are prefixed with a period.
15
+ *
16
+ * @param {any[] | object} arrayOrObject - Array or object to flatten.
17
+ * @param {object} [options] - Options.
18
+ * @param {string} [options.currentPath=""] - Current path, for recursion or as a starting point.
19
+ * @param {number} [options.depth=0] - Current depth, for recursion.
20
+ * @param {number} [options.limit=0] - Limit the depth of recursion.
21
+ * @returns {{
22
+ * pathValues: [string, any][],
23
+ * containerPaths: string[]
24
+ * }} - Paths and their corresponding values.
25
+ */
26
+ export function flattenPathsWithValues(arrayOrObject, { currentPath = "", depth = 0, limit = 0 } = {}) {
27
+ /** @type {[string, any][]} */
28
+ const pathValues = [];
29
+ /** @type {string[]} */
30
+ const containerPaths = [];
31
+
32
+ const keysOrIndexes = isArray(arrayOrObject);
33
+ const dotOrNot = currentPath ? "." : "";
34
+
35
+ if (limit && depth >= limit) {
36
+ return { pathValues, containerPaths };
37
+ }
38
+
39
+ if (isObject(arrayOrObject)) {
40
+ if (currentPath) {
41
+ containerPaths.push(currentPath);
42
+ }
43
+
44
+ for (const [key, value] of Object.entries(arrayOrObject)) {
45
+ const keyPath = keysOrIndexes ? `[${key}]` : `${dotOrNot}${key}`;
46
+ const nextPath = `${currentPath}${keyPath}`;
47
+
48
+ if (isObject(value) || isArray(value)) {
49
+ const { pathValues: childValues, containerPaths: childContainers } = flattenPathsWithValues(value, {
50
+ currentPath: nextPath,
51
+ depth: depth + 1,
52
+ limit,
53
+ });
54
+ pathValues.push(...childValues);
55
+ containerPaths.push(...childContainers);
56
+ } else {
57
+ pathValues.push([nextPath, value]);
58
+ }
59
+ }
60
+ } else if (currentPath) {
61
+ pathValues.push([currentPath, arrayOrObject]);
62
+ }
63
+
64
+ return { pathValues, containerPaths };
65
+ }
package/utils/keyDiff.js CHANGED
@@ -12,17 +12,17 @@ import { difference, intersection } from "./set.js";
12
12
  * Result object of keyDiff and keyDiffDeep.
13
13
  *
14
14
  * @typedef {object} KeyDiffResult
15
- * @property {Set} [sameKeys] - If sameKeys option is true, return keys that are the same.
16
- * @property {Set} [removedKeys] - If removedKeys option is true, return keys that are removed.
17
- * @property {Set} [addedKeys] - If addedKeys option is true, return keys that are added.
15
+ * @property {Set<string>} [sameKeys] - If sameKeys option is true, return keys that are the same.
16
+ * @property {Set<string>} [removedKeys] - If removedKeys option is true, return keys that are removed.
17
+ * @property {Set<string>} [addedKeys] - If addedKeys option is true, return keys that are added.
18
18
  */
19
19
 
20
20
  /**
21
21
  * Calculate the difference between two arrays of keys, in terms of what keys
22
22
  * are the same, what keys are removed, and what keys are added.
23
23
  *
24
- * @param {string[]|Set} newKeys - Keys to consider as new.
25
- * @param {string[]|Set} oldKeys - Keys to consider as old.
24
+ * @param {string[]|Set<string>} newKeys - Keys to consider as new.
25
+ * @param {string[]|Set<string>} oldKeys - Keys to consider as old.
26
26
  * @param {object} [options] - Which differences are returned.
27
27
  * @param {boolean} [options.sameKeys=true] - If true, return keys that are the same.
28
28
  * @param {boolean} [options.removedKeys=true] - If true, return keys that are removed.