@arrai-innovations/reactive-helpers 8.1.2 → 8.2.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arrai-innovations/reactive-helpers",
3
- "version": "8.1.2",
3
+ "version": "8.2.0",
4
4
  "description": "VueJS 3 utility composition functions to help manipulate objects and lists.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  import { expectErrorToBeNull } from "../expectHelpers.js";
2
2
  import flushPromises from "flush-promises";
3
- import keyBy from "lodash-es/keyBy";
3
+ import keyBy from "lodash-es/keyBy.js";
4
4
  import { inspect } from "util";
5
5
  import { isReactive, nextTick, reactive } from "vue";
6
6
 
@@ -4,7 +4,7 @@ import { expectErrorToBeNull } from "../expectHelpers.js";
4
4
  // import { getMockOnUnmounted } from "../mockOnUnmounted.js";
5
5
  import { poll } from "../poll.js";
6
6
  import flushPromises from "flush-promises";
7
- import cloneDeep from "lodash-es/cloneDeep";
7
+ import cloneDeep from "lodash-es/cloneDeep.js";
8
8
  import { inspect } from "util";
9
9
  import { nextTick } from "vue";
10
10
 
@@ -1,6 +1,6 @@
1
- import { isEmpty } from "lodash-es";
2
- import identity from "lodash-es/identity";
3
- import isEqual from "lodash-es/isEqual";
1
+ import identity from "lodash-es/identity.js";
2
+ import isEmpty from "lodash-es/isEmpty.js";
3
+ import isEqual from "lodash-es/isEqual.js";
4
4
  import { computed, effectScope, nextTick, onScopeDispose, reactive, readonly, watch } from "vue";
5
5
  import { deepUnref } from "vue-deepunref";
6
6
 
@@ -1,5 +1,5 @@
1
1
  import { combineClasses } from "../utils/classes.js";
2
- import { cloneDeep } from "lodash-es";
2
+ import cloneDeep from "lodash-es/cloneDeep.js";
3
3
  import { isRef, ref, watch, isReactive } from "vue";
4
4
 
5
5
  /**
@@ -3,7 +3,7 @@ import { listInstanceStateKeys } from "./listInstance.js";
3
3
  import { listRelatedStateKeys } from "./listRelated.js";
4
4
  import { listSubscriptionStateKeys } from "./listSubscription.js";
5
5
  import { useWatchesRunning } from "./watchesRunning.js";
6
- import isEmpty from "lodash-es/isEmpty";
6
+ import isEmpty from "lodash-es/isEmpty.js";
7
7
  import { computed, effectScope, onScopeDispose, reactive, toRef, watch } from "vue";
8
8
 
9
9
  export const listCalculatedStateKeys = [
package/use/listFilter.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { keyDiff } from "../utils/keyDiff.js";
2
2
  import { useSearch } from "./search.js";
3
- import get from "lodash-es/get";
4
- import identity from "lodash-es/identity";
5
- import isEmpty from "lodash-es/isEmpty";
3
+ import get from "lodash-es/get.js";
4
+ import identity from "lodash-es/identity.js";
5
+ import isEmpty from "lodash-es/isEmpty.js";
6
6
  import { computed, effectScope, onScopeDispose, reactive, toRef, watch, watchEffect } from "vue";
7
7
 
8
8
  export function useListFilters(listFilterArgs, parentInstances) {
@@ -1,8 +1,8 @@
1
- import { addOrUpdateReactiveObject, assignReactiveObject } from "../utils/assignReactiveObject";
2
- import { getFakeId } from "../utils/getFakeId";
1
+ import { addOrUpdateReactiveObject, assignReactiveObject } from "../utils/assignReactiveObject.js";
2
+ import { getFakeId } from "../utils/getFakeId.js";
3
3
  import inspect from "browser-util-inspect";
4
- import cloneDeep from "lodash-es/cloneDeep";
5
- import isFunction from "lodash-es/isFunction";
4
+ import cloneDeep from "lodash-es/cloneDeep.js";
5
+ import isFunction from "lodash-es/isFunction.js";
6
6
  import { computed, effectScope, reactive, toRef, watchEffect } from "vue";
7
7
 
8
8
  export class ListError extends Error {
@@ -47,7 +47,7 @@ export function useListInstances(listInstanceArgs) {
47
47
  return instances;
48
48
  }
49
49
 
50
- export function useListInstance({ props, functions = {} }) {
50
+ export function useListInstance({ props, functions = {}, keepOldPages = false }) {
51
51
  if (!props) {
52
52
  throw new ListError(`useListInstance requires props`);
53
53
  }
@@ -114,7 +114,11 @@ export function useListInstance({ props, functions = {} }) {
114
114
  });
115
115
 
116
116
  const defaultPageCallback = (newObjects) => {
117
- clearList();
117
+ // with keepOldPages, you are responsible for clearing the list as needed
118
+ if (!keepOldPages) {
119
+ // display one page at a time, clear the list
120
+ clearList();
121
+ }
118
122
  newObjects.forEach((newObject) => {
119
123
  if (newObject.id in state.objects) {
120
124
  updateListObject(newObject);
@@ -2,10 +2,10 @@ import { keyDiff, loadingCombine } from "../utils/index.js";
2
2
  import { listInstanceStateKeys } from "./listInstance.js";
3
3
  import { listSubscriptionStateKeys } from "./listSubscription.js";
4
4
  import { useWatchesRunning } from "./watchesRunning.js";
5
- import get from "lodash-es/get";
6
- import isArray from "lodash-es/isArray";
7
- import isEmpty from "lodash-es/isEmpty";
8
- import isUndefined from "lodash-es/isUndefined";
5
+ import get from "lodash-es/get.js";
6
+ import isArray from "lodash-es/isArray.js";
7
+ import isEmpty from "lodash-es/isEmpty.js";
8
+ import isUndefined from "lodash-es/isUndefined.js";
9
9
  import { computed, effectScope, onScopeDispose, reactive, toRef, unref, watch } from "vue";
10
10
 
11
11
  export const listRelatedStateKeys = [
package/use/listSort.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { assignReactiveObject, keyDiff } from "../utils/index.js";
2
- import cloneDeep from "lodash-es/cloneDeep";
3
- import get from "lodash-es/get";
4
- import identity from "lodash-es/identity";
5
- import isEmpty from "lodash-es/isEmpty";
6
- import isNull from "lodash-es/isNull";
7
- import isUndefined from "lodash-es/isUndefined";
8
- import partial from "lodash-es/partial";
9
- import throttle from "lodash-es/throttle";
10
- import zip from "lodash-es/zip";
2
+ import cloneDeep from "lodash-es/cloneDeep.js";
3
+ import get from "lodash-es/get.js";
4
+ import identity from "lodash-es/identity.js";
5
+ import isEmpty from "lodash-es/isEmpty.js";
6
+ import isNull from "lodash-es/isNull.js";
7
+ import isUndefined from "lodash-es/isUndefined.js";
8
+ import partial from "lodash-es/partial.js";
9
+ import throttle from "lodash-es/throttle.js";
10
+ import zip from "lodash-es/zip.js";
11
11
  import { effectScope, onScopeDispose, reactive, toRef, unref, watch } from "vue";
12
12
 
13
13
  const collator = new Intl.Collator(undefined, { numeric: true });
@@ -2,9 +2,9 @@ import { loadingCombine } from "../utils/loadingCombine.js";
2
2
  import { useCancellableIntent } from "./cancellableIntent.js";
3
3
  import { listInstanceStateKeys, useListInstance } from "./listInstance.js";
4
4
  import inspect from "browser-util-inspect";
5
- import cloneDeep from "lodash-es/cloneDeep";
6
- import isEmpty from "lodash-es/isEmpty";
7
- import isObject from "lodash-es/isObject";
5
+ import cloneDeep from "lodash-es/cloneDeep.js";
6
+ import isEmpty from "lodash-es/isEmpty.js";
7
+ import isObject from "lodash-es/isObject.js";
8
8
  import { computed, effectScope, reactive, toRef } from "vue";
9
9
 
10
10
  export class ListSubscriptionError extends Error {
@@ -1,6 +1,6 @@
1
1
  import { keyDiff, loadingCombine } from "../utils/index.js";
2
2
  import { useWatchesRunning } from "./watchesRunning.js";
3
- import isEmpty from "lodash-es/isEmpty";
3
+ import isEmpty from "lodash-es/isEmpty.js";
4
4
  import { computed, effectScope, onScopeDispose, reactive, toRef, watch } from "vue";
5
5
 
6
6
  export function useObjectCalculateds(instances, args) {
@@ -1,6 +1,6 @@
1
1
  import { addOrUpdateReactiveObject, assignReactiveObject } from "../utils/index.js";
2
- import cloneDeep from "lodash-es/cloneDeep";
3
- import isFunction from "lodash-es/isFunction";
2
+ import cloneDeep from "lodash-es/cloneDeep.js";
3
+ import isFunction from "lodash-es/isFunction.js";
4
4
  import { reactive, toRef } from "vue";
5
5
 
6
6
  export class ObjectError extends Error {
@@ -1,9 +1,9 @@
1
1
  import { keyDiff } from "../utils/index.js";
2
- import { useWatchesRunning } from "./watchesRunning";
3
- import get from "lodash-es/get";
4
- import isArray from "lodash-es/isArray";
5
- import isEmpty from "lodash-es/isEmpty";
6
- import isUndefined from "lodash-es/isUndefined";
2
+ import { useWatchesRunning } from "./watchesRunning.js";
3
+ import get from "lodash-es/get.js";
4
+ import isArray from "lodash-es/isArray.js";
5
+ import isEmpty from "lodash-es/isEmpty.js";
6
+ import isUndefined from "lodash-es/isUndefined.js";
7
7
  import { computed, effectScope, onScopeDispose, reactive, toRef, unref, watch } from "vue";
8
8
 
9
9
  export function useObjectRelateds(instances, args) {
package/use/search.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { assignReactiveObject } from "../utils/assignReactiveObject.js";
2
2
  import FlexSearch from "flexsearch";
3
- import fromPairs from "lodash-es/fromPairs";
4
- import throttle from "lodash-es/throttle";
3
+ import fromPairs from "lodash-es/fromPairs.js";
4
+ import throttle from "lodash-es/throttle.js";
5
5
  import { effectScope, reactive, toRef, watch } from "vue";
6
6
 
7
7
  const indexOptions = {
@@ -1,7 +1,7 @@
1
1
  import { keyDiff } from "./keyDiff.js";
2
2
  import inspect from "browser-util-inspect";
3
- import isArray from "lodash-es/isArray";
4
- import isObject from "lodash-es/isObject";
3
+ import isArray from "lodash-es/isArray.js";
4
+ import isObject from "lodash-es/isObject.js";
5
5
  import { isReactive, isRef, toRef, unref } from "vue";
6
6
 
7
7
  /**
package/utils/classes.js CHANGED
@@ -1,9 +1,9 @@
1
- import identity from "lodash-es/identity";
2
- import isArray from "lodash-es/isArray";
3
- import isEmpty from "lodash-es/isEmpty";
4
- import isObject from "lodash-es/isObject";
5
- import isSet from "lodash-es/isSet";
6
- import isString from "lodash-es/isString";
1
+ import identity from "lodash-es/identity.js";
2
+ import isArray from "lodash-es/isArray.js";
3
+ import isEmpty from "lodash-es/isEmpty.js";
4
+ import isObject from "lodash-es/isObject.js";
5
+ import isSet from "lodash-es/isSet.js";
6
+ import isString from "lodash-es/isString.js";
7
7
  import { isRef, unref } from "vue";
8
8
 
9
9
  /**
@@ -1,7 +1,9 @@
1
1
  import { isSuperset } from "./set.js";
2
2
  import { transformWalk } from "./transformWalk.js";
3
- import { isSet, partial, union } from "lodash-es";
4
3
  import debounce from "lodash-es/debounce";
4
+ import isSet from "lodash-es/isSet.js";
5
+ import partial from "lodash-es/partial.js";
6
+ import union from "lodash-es/union.js";
5
7
  import { unref } from "vue";
6
8
 
7
9
  /**
@@ -1,5 +1,5 @@
1
1
  import { keyDiff } from "./keyDiff.js";
2
- import isEqual from "lodash-es/isEqual";
2
+ import isEqual from "lodash-es/isEqual.js";
3
3
  import { watch } from "vue";
4
4
  import { deepUnref } from "vue-deepunref";
5
5
 
@@ -1,5 +1,5 @@
1
- import isArray from "lodash-es/isArray";
2
- import isObject from "lodash-es/isObject";
1
+ import isArray from "lodash-es/isArray.js";
2
+ import isObject from "lodash-es/isObject.js";
3
3
 
4
4
  /**
5
5
  * Get all paths from an array or object.
@@ -1,6 +1,6 @@
1
- import isArray from "lodash-es/isArray";
2
- import isMap from "lodash-es/isMap";
3
- import isSet from "lodash-es/isSet";
1
+ import isArray from "lodash-es/isArray.js";
2
+ import isMap from "lodash-es/isMap.js";
3
+ import isSet from "lodash-es/isSet.js";
4
4
 
5
5
  export function getFakeId(arraySetMapOrObject, key = "id") {
6
6
  // sets are assumed to be of ids
@@ -1,7 +1,8 @@
1
1
  import { inspectWalkFn, useDebugMessage } from "./debugMessage.js";
2
2
  import { keyDiffDeep } from "./keyDiff.js";
3
3
  import { transformWalk } from "./transformWalk.js";
4
- import { isEqual, partial } from "lodash-es";
4
+ import isEqual from "lodash-es/isEqual.js";
5
+ import partial from "lodash-es/partial.js";
5
6
  import {
6
7
  onActivated,
7
8
  onBeforeMount,
@@ -1,4 +1,4 @@
1
- import { isSet } from "lodash-es";
1
+ import isSet from "lodash-es/isSet.js";
2
2
 
3
3
  /**
4
4
  * Object walking utility.