@contember/react-binding 1.3.0-alpha.11 → 1.3.0-alpha.14
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/dist/development/accessorPropagation/useEntityListSubTreeLoader.cjs +47 -0
- package/dist/development/accessorPropagation/useEntityListSubTreeLoader.cjs.map +1 -0
- package/dist/development/accessorPropagation/useEntityListSubTreeLoader.js +47 -0
- package/dist/development/accessorPropagation/useEntityListSubTreeLoader.js.map +1 -0
- package/dist/development/accessorSorting/sortEntities.cjs +1 -4
- package/dist/development/accessorSorting/sortEntities.cjs.map +1 -1
- package/dist/development/accessorSorting/sortEntities.js +1 -4
- package/dist/development/accessorSorting/sortEntities.js.map +1 -1
- package/dist/development/index.cjs +2 -0
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +2 -0
- package/dist/development/index.js.map +1 -1
- package/dist/production/accessorPropagation/useEntityListSubTreeLoader.cjs +47 -0
- package/dist/production/accessorPropagation/useEntityListSubTreeLoader.cjs.map +1 -0
- package/dist/production/accessorPropagation/useEntityListSubTreeLoader.js +47 -0
- package/dist/production/accessorPropagation/useEntityListSubTreeLoader.js.map +1 -0
- package/dist/production/accessorSorting/sortEntities.cjs +1 -4
- package/dist/production/accessorSorting/sortEntities.cjs.map +1 -1
- package/dist/production/accessorSorting/sortEntities.js +1 -4
- package/dist/production/accessorSorting/sortEntities.js.map +1 -1
- package/dist/production/index.cjs +2 -0
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.js +2 -0
- package/dist/production/index.js.map +1 -1
- package/dist/types/accessorPropagation/EnvironmentContext.d.ts +1 -1
- package/dist/types/accessorPropagation/EnvironmentContext.d.ts.map +1 -1
- package/dist/types/accessorPropagation/index.d.ts +1 -0
- package/dist/types/accessorPropagation/index.d.ts.map +1 -1
- package/dist/types/accessorPropagation/useEntityListSubTreeLoader.d.ts +10 -0
- package/dist/types/accessorPropagation/useEntityListSubTreeLoader.d.ts.map +1 -0
- package/dist/types/accessorSorting/sortEntities.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/accessorPropagation/index.ts +1 -0
- package/src/accessorPropagation/useEntityListSubTreeLoader.ts +69 -0
- package/src/accessorSorting/sortEntities.ts +1 -4
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const react = require("react");
|
|
4
|
+
const useExtendTree = require("./useExtendTree.cjs");
|
|
5
|
+
const EntityListSubTree = require("../coreComponents/EntityListSubTree.cjs");
|
|
6
|
+
const useEntityListSubTreeLoader = (entities, children, state) => {
|
|
7
|
+
const [displayedState, setDisplayedState] = react.useState({
|
|
8
|
+
entities: void 0,
|
|
9
|
+
treeRootId: void 0,
|
|
10
|
+
state: void 0
|
|
11
|
+
});
|
|
12
|
+
const currentlyLoading = react.useRef();
|
|
13
|
+
const [loadingState, setLoadingState] = react.useState("initial");
|
|
14
|
+
const extendTree = useExtendTree.useExtendTree();
|
|
15
|
+
react.useEffect(() => {
|
|
16
|
+
(async () => {
|
|
17
|
+
if (!entities || displayedState.state === state && displayedState.entities === entities || currentlyLoading.current?.entities === entities && currentlyLoading.current?.state === state) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
currentlyLoading.current = {
|
|
21
|
+
entities,
|
|
22
|
+
state
|
|
23
|
+
};
|
|
24
|
+
if (displayedState.entities) {
|
|
25
|
+
setLoadingState("refreshing");
|
|
26
|
+
}
|
|
27
|
+
const newTreeRootId = await extendTree(
|
|
28
|
+
react.createElement(EntityListSubTree.EntityListSubTree, {
|
|
29
|
+
...entities,
|
|
30
|
+
children
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
currentlyLoading.current = void 0;
|
|
34
|
+
if (newTreeRootId) {
|
|
35
|
+
setDisplayedState({
|
|
36
|
+
entities,
|
|
37
|
+
treeRootId: newTreeRootId,
|
|
38
|
+
state
|
|
39
|
+
});
|
|
40
|
+
setLoadingState("loaded");
|
|
41
|
+
}
|
|
42
|
+
})();
|
|
43
|
+
}, [displayedState, extendTree, entities, children, state]);
|
|
44
|
+
return [displayedState, loadingState];
|
|
45
|
+
};
|
|
46
|
+
exports.useEntityListSubTreeLoader = useEntityListSubTreeLoader;
|
|
47
|
+
//# sourceMappingURL=useEntityListSubTreeLoader.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEntityListSubTreeLoader.cjs","sources":["../../../src/accessorPropagation/useEntityListSubTreeLoader.ts"],"sourcesContent":["import { createElement, ReactNode, useEffect, useRef, useState } from 'react'\nimport { SugaredQualifiedEntityList, TreeRootId } from '@contember/binding'\nimport { useExtendTree } from './useExtendTree'\nimport { EntityListSubTree } from '../coreComponents'\n\nexport type UseEntityListSubTreeLoaderResult<State> = {\n\tentities: SugaredQualifiedEntityList | undefined\n\ttreeRootId: TreeRootId | undefined\n\tstate: State | undefined\n}\n\nexport type EntityListSubTreeLoaderState =\n\t| 'initial'\n\t| 'refreshing'\n\t| 'loaded'\n\nexport const useEntityListSubTreeLoader = <State>(entities: SugaredQualifiedEntityList | undefined, children: ReactNode, state?: State): [UseEntityListSubTreeLoaderResult<State>, EntityListSubTreeLoaderState] => {\n\tconst [displayedState, setDisplayedState] = useState<UseEntityListSubTreeLoaderResult<State>>({\n\t\tentities: undefined,\n\t\ttreeRootId: undefined,\n\t\tstate: undefined,\n\t})\n\tconst currentlyLoading = useRef<{\n\t\tentities: SugaredQualifiedEntityList\n\t\tstate?: State\n\t}>()\n\n\tconst [loadingState, setLoadingState] = useState<EntityListSubTreeLoaderState>('initial')\n\tconst extendTree = useExtendTree()\n\n\tuseEffect(() => {\n\t\t(async () => {\n\t\t\tif (\n\t\t\t\t!entities\n\t\t\t\t|| displayedState.state === state && displayedState.entities === entities\n\t\t\t\t|| currentlyLoading.current?.entities === entities && currentlyLoading.current?.state === state\n\t\t\t) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcurrentlyLoading.current = {\n\t\t\t\tentities,\n\t\t\t\tstate,\n\t\t\t}\n\n\t\t\tif (displayedState.entities) {\n\t\t\t\tsetLoadingState('refreshing')\n\t\t\t}\n\n\t\t\tconst newTreeRootId = await extendTree(\n\t\t\t\tcreateElement(EntityListSubTree, {\n\t\t\t\t\t...entities,\n\t\t\t\t\tchildren,\n\t\t\t\t}),\n\t\t\t)\n\t\t\tcurrentlyLoading.current = undefined\n\t\t\tif (newTreeRootId) {\n\t\t\t\tsetDisplayedState({\n\t\t\t\t\tentities: entities,\n\t\t\t\t\ttreeRootId: newTreeRootId,\n\t\t\t\t\tstate: state,\n\t\t\t\t})\n\t\t\t\tsetLoadingState('loaded')\n\t\t\t}\n\t\t})()\n\t}, [displayedState, extendTree, entities, children, state])\n\n\treturn [displayedState, loadingState]\n}\n"],"names":["useState","useRef","useExtendTree","useEffect","createElement","EntityListSubTree"],"mappings":";;;;;AAgBO,MAAM,6BAA6B,CAAQ,UAAkD,UAAqB,UAA2F;AACnN,QAAM,CAAC,gBAAgB,iBAAiB,IAAIA,eAAkD;AAAA,IAC7F,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,OAAO;AAAA,EAAA,CACP;AACD,QAAM,mBAAmBC,MAAAA;AAKzB,QAAM,CAAC,cAAc,eAAe,IAAID,eAAuC,SAAS;AACxF,QAAM,aAAaE,cAAAA;AAEnBC,QAAAA,UAAU,MAAM;AACf,KAAC,YAAY;AACZ,UACC,CAAC,YACE,eAAe,UAAU,SAAS,eAAe,aAAa,YAC9D,iBAAiB,SAAS,aAAa,YAAY,iBAAiB,SAAS,UAAU,OACzF;AACD;AAAA,MACD;AAEA,uBAAiB,UAAU;AAAA,QAC1B;AAAA,QACA;AAAA,MAAA;AAGD,UAAI,eAAe,UAAU;AAC5B,wBAAgB,YAAY;AAAA,MAC7B;AAEA,YAAM,gBAAgB,MAAM;AAAA,QAC3BC,MAAAA,cAAcC,kBAAAA,mBAAmB;AAAA,UAChC,GAAG;AAAA,UACH;AAAA,QAAA,CACA;AAAA,MAAA;AAEF,uBAAiB,UAAU;AAC3B,UAAI,eAAe;AACA,0BAAA;AAAA,UACjB;AAAA,UACA,YAAY;AAAA,UACZ;AAAA,QAAA,CACA;AACD,wBAAgB,QAAQ;AAAA,MACzB;AAAA,IAAA;EACE,GACD,CAAC,gBAAgB,YAAY,UAAU,UAAU,KAAK,CAAC;AAEnD,SAAA,CAAC,gBAAgB,YAAY;AACrC;;"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useState, useRef, useEffect, createElement } from "react";
|
|
2
|
+
import { useExtendTree } from "./useExtendTree.js";
|
|
3
|
+
import { EntityListSubTree } from "../coreComponents/EntityListSubTree.js";
|
|
4
|
+
const useEntityListSubTreeLoader = (entities, children, state) => {
|
|
5
|
+
const [displayedState, setDisplayedState] = useState({
|
|
6
|
+
entities: void 0,
|
|
7
|
+
treeRootId: void 0,
|
|
8
|
+
state: void 0
|
|
9
|
+
});
|
|
10
|
+
const currentlyLoading = useRef();
|
|
11
|
+
const [loadingState, setLoadingState] = useState("initial");
|
|
12
|
+
const extendTree = useExtendTree();
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
(async () => {
|
|
15
|
+
if (!entities || displayedState.state === state && displayedState.entities === entities || currentlyLoading.current?.entities === entities && currentlyLoading.current?.state === state) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
currentlyLoading.current = {
|
|
19
|
+
entities,
|
|
20
|
+
state
|
|
21
|
+
};
|
|
22
|
+
if (displayedState.entities) {
|
|
23
|
+
setLoadingState("refreshing");
|
|
24
|
+
}
|
|
25
|
+
const newTreeRootId = await extendTree(
|
|
26
|
+
createElement(EntityListSubTree, {
|
|
27
|
+
...entities,
|
|
28
|
+
children
|
|
29
|
+
})
|
|
30
|
+
);
|
|
31
|
+
currentlyLoading.current = void 0;
|
|
32
|
+
if (newTreeRootId) {
|
|
33
|
+
setDisplayedState({
|
|
34
|
+
entities,
|
|
35
|
+
treeRootId: newTreeRootId,
|
|
36
|
+
state
|
|
37
|
+
});
|
|
38
|
+
setLoadingState("loaded");
|
|
39
|
+
}
|
|
40
|
+
})();
|
|
41
|
+
}, [displayedState, extendTree, entities, children, state]);
|
|
42
|
+
return [displayedState, loadingState];
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
useEntityListSubTreeLoader
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=useEntityListSubTreeLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEntityListSubTreeLoader.js","sources":["../../../src/accessorPropagation/useEntityListSubTreeLoader.ts"],"sourcesContent":["import { createElement, ReactNode, useEffect, useRef, useState } from 'react'\nimport { SugaredQualifiedEntityList, TreeRootId } from '@contember/binding'\nimport { useExtendTree } from './useExtendTree'\nimport { EntityListSubTree } from '../coreComponents'\n\nexport type UseEntityListSubTreeLoaderResult<State> = {\n\tentities: SugaredQualifiedEntityList | undefined\n\ttreeRootId: TreeRootId | undefined\n\tstate: State | undefined\n}\n\nexport type EntityListSubTreeLoaderState =\n\t| 'initial'\n\t| 'refreshing'\n\t| 'loaded'\n\nexport const useEntityListSubTreeLoader = <State>(entities: SugaredQualifiedEntityList | undefined, children: ReactNode, state?: State): [UseEntityListSubTreeLoaderResult<State>, EntityListSubTreeLoaderState] => {\n\tconst [displayedState, setDisplayedState] = useState<UseEntityListSubTreeLoaderResult<State>>({\n\t\tentities: undefined,\n\t\ttreeRootId: undefined,\n\t\tstate: undefined,\n\t})\n\tconst currentlyLoading = useRef<{\n\t\tentities: SugaredQualifiedEntityList\n\t\tstate?: State\n\t}>()\n\n\tconst [loadingState, setLoadingState] = useState<EntityListSubTreeLoaderState>('initial')\n\tconst extendTree = useExtendTree()\n\n\tuseEffect(() => {\n\t\t(async () => {\n\t\t\tif (\n\t\t\t\t!entities\n\t\t\t\t|| displayedState.state === state && displayedState.entities === entities\n\t\t\t\t|| currentlyLoading.current?.entities === entities && currentlyLoading.current?.state === state\n\t\t\t) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcurrentlyLoading.current = {\n\t\t\t\tentities,\n\t\t\t\tstate,\n\t\t\t}\n\n\t\t\tif (displayedState.entities) {\n\t\t\t\tsetLoadingState('refreshing')\n\t\t\t}\n\n\t\t\tconst newTreeRootId = await extendTree(\n\t\t\t\tcreateElement(EntityListSubTree, {\n\t\t\t\t\t...entities,\n\t\t\t\t\tchildren,\n\t\t\t\t}),\n\t\t\t)\n\t\t\tcurrentlyLoading.current = undefined\n\t\t\tif (newTreeRootId) {\n\t\t\t\tsetDisplayedState({\n\t\t\t\t\tentities: entities,\n\t\t\t\t\ttreeRootId: newTreeRootId,\n\t\t\t\t\tstate: state,\n\t\t\t\t})\n\t\t\t\tsetLoadingState('loaded')\n\t\t\t}\n\t\t})()\n\t}, [displayedState, extendTree, entities, children, state])\n\n\treturn [displayedState, loadingState]\n}\n"],"names":[],"mappings":";;;AAgBO,MAAM,6BAA6B,CAAQ,UAAkD,UAAqB,UAA2F;AACnN,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAkD;AAAA,IAC7F,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,OAAO;AAAA,EAAA,CACP;AACD,QAAM,mBAAmB;AAKzB,QAAM,CAAC,cAAc,eAAe,IAAI,SAAuC,SAAS;AACxF,QAAM,aAAa;AAEnB,YAAU,MAAM;AACf,KAAC,YAAY;AACZ,UACC,CAAC,YACE,eAAe,UAAU,SAAS,eAAe,aAAa,YAC9D,iBAAiB,SAAS,aAAa,YAAY,iBAAiB,SAAS,UAAU,OACzF;AACD;AAAA,MACD;AAEA,uBAAiB,UAAU;AAAA,QAC1B;AAAA,QACA;AAAA,MAAA;AAGD,UAAI,eAAe,UAAU;AAC5B,wBAAgB,YAAY;AAAA,MAC7B;AAEA,YAAM,gBAAgB,MAAM;AAAA,QAC3B,cAAc,mBAAmB;AAAA,UAChC,GAAG;AAAA,UACH;AAAA,QAAA,CACA;AAAA,MAAA;AAEF,uBAAiB,UAAU;AAC3B,UAAI,eAAe;AACA,0BAAA;AAAA,UACjB;AAAA,UACA,YAAY;AAAA,UACZ;AAAA,QAAA,CACA;AACD,wBAAgB,QAAQ;AAAA,MACzB;AAAA,IAAA;EACE,GACD,CAAC,gBAAgB,YAAY,UAAU,UAAU,KAAK,CAAC;AAEnD,SAAA,CAAC,gBAAgB,YAAY;AACrC;"}
|
|
@@ -7,10 +7,7 @@ const sortEntities = (entities, sortByField) => {
|
|
|
7
7
|
return entities.sort((a, b) => {
|
|
8
8
|
const aField = a.getRelativeSingleField(sortByField);
|
|
9
9
|
const bField = b.getRelativeSingleField(sortByField);
|
|
10
|
-
|
|
11
|
-
return aField.value - bField.value;
|
|
12
|
-
}
|
|
13
|
-
return 0;
|
|
10
|
+
return (aField.value ?? Number.MAX_SAFE_INTEGER) - (bField.value ?? Number.MAX_SAFE_INTEGER);
|
|
14
11
|
});
|
|
15
12
|
};
|
|
16
13
|
exports.sortEntities = sortEntities;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortEntities.cjs","sources":["../../../src/accessorSorting/sortEntities.ts"],"sourcesContent":["import { EntityAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const sortEntities = (\n\tentities: EntityAccessor[],\n\tsortByField: RelativeSingleField | undefined,\n): EntityAccessor[] => {\n\tif (!sortByField) {\n\t\treturn entities\n\t}\n\treturn entities.sort((a, b) => {\n\t\tconst aField = a.getRelativeSingleField<number>(sortByField)\n\t\tconst bField = b.getRelativeSingleField<number>(sortByField)\n\n\t\
|
|
1
|
+
{"version":3,"file":"sortEntities.cjs","sources":["../../../src/accessorSorting/sortEntities.ts"],"sourcesContent":["import { EntityAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const sortEntities = (\n\tentities: EntityAccessor[],\n\tsortByField: RelativeSingleField | undefined,\n): EntityAccessor[] => {\n\tif (!sortByField) {\n\t\treturn entities\n\t}\n\treturn entities.sort((a, b) => {\n\t\tconst aField = a.getRelativeSingleField<number>(sortByField)\n\t\tconst bField = b.getRelativeSingleField<number>(sortByField)\n\n\t\treturn (aField.value ?? Number.MAX_SAFE_INTEGER) - (bField.value ?? Number.MAX_SAFE_INTEGER)\n\t})\n}\n"],"names":[],"mappings":";;AAEa,MAAA,eAAe,CAC3B,UACA,gBACsB;AACtB,MAAI,CAAC,aAAa;AACV,WAAA;AAAA,EACR;AACA,SAAO,SAAS,KAAK,CAAC,GAAG,MAAM;AACxB,UAAA,SAAS,EAAE,uBAA+B,WAAW;AACrD,UAAA,SAAS,EAAE,uBAA+B,WAAW;AAE3D,YAAQ,OAAO,SAAS,OAAO,qBAAqB,OAAO,SAAS,OAAO;AAAA,EAAA,CAC3E;AACF;;"}
|
|
@@ -5,10 +5,7 @@ const sortEntities = (entities, sortByField) => {
|
|
|
5
5
|
return entities.sort((a, b) => {
|
|
6
6
|
const aField = a.getRelativeSingleField(sortByField);
|
|
7
7
|
const bField = b.getRelativeSingleField(sortByField);
|
|
8
|
-
|
|
9
|
-
return aField.value - bField.value;
|
|
10
|
-
}
|
|
11
|
-
return 0;
|
|
8
|
+
return (aField.value ?? Number.MAX_SAFE_INTEGER) - (bField.value ?? Number.MAX_SAFE_INTEGER);
|
|
12
9
|
});
|
|
13
10
|
};
|
|
14
11
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortEntities.js","sources":["../../../src/accessorSorting/sortEntities.ts"],"sourcesContent":["import { EntityAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const sortEntities = (\n\tentities: EntityAccessor[],\n\tsortByField: RelativeSingleField | undefined,\n): EntityAccessor[] => {\n\tif (!sortByField) {\n\t\treturn entities\n\t}\n\treturn entities.sort((a, b) => {\n\t\tconst aField = a.getRelativeSingleField<number>(sortByField)\n\t\tconst bField = b.getRelativeSingleField<number>(sortByField)\n\n\t\
|
|
1
|
+
{"version":3,"file":"sortEntities.js","sources":["../../../src/accessorSorting/sortEntities.ts"],"sourcesContent":["import { EntityAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const sortEntities = (\n\tentities: EntityAccessor[],\n\tsortByField: RelativeSingleField | undefined,\n): EntityAccessor[] => {\n\tif (!sortByField) {\n\t\treturn entities\n\t}\n\treturn entities.sort((a, b) => {\n\t\tconst aField = a.getRelativeSingleField<number>(sortByField)\n\t\tconst bField = b.getRelativeSingleField<number>(sortByField)\n\n\t\treturn (aField.value ?? Number.MAX_SAFE_INTEGER) - (bField.value ?? Number.MAX_SAFE_INTEGER)\n\t})\n}\n"],"names":[],"mappings":"AAEa,MAAA,eAAe,CAC3B,UACA,gBACsB;AACtB,MAAI,CAAC,aAAa;AACV,WAAA;AAAA,EACR;AACA,SAAO,SAAS,KAAK,CAAC,GAAG,MAAM;AACxB,UAAA,SAAS,EAAE,uBAA+B,WAAW;AACrD,UAAA,SAAS,EAAE,uBAA+B,WAAW;AAE3D,YAAQ,OAAO,SAAS,OAAO,qBAAqB,OAAO,SAAS,OAAO;AAAA,EAAA,CAC3E;AACF;"}
|
|
@@ -26,6 +26,7 @@ const useHasEntity = require("./accessorPropagation/useHasEntity.cjs");
|
|
|
26
26
|
const useEntityList = require("./accessorPropagation/useEntityList.cjs");
|
|
27
27
|
const useEntityListSubTree = require("./accessorPropagation/useEntityListSubTree.cjs");
|
|
28
28
|
const useEntityListSubTreeParameters = require("./accessorPropagation/useEntityListSubTreeParameters.cjs");
|
|
29
|
+
const useEntityListSubTreeLoader = require("./accessorPropagation/useEntityListSubTreeLoader.cjs");
|
|
29
30
|
const useEntitySubTree = require("./accessorPropagation/useEntitySubTree.cjs");
|
|
30
31
|
const useEntitySubTreeParameters = require("./accessorPropagation/useEntitySubTreeParameters.cjs");
|
|
31
32
|
const useEnvironment = require("./accessorPropagation/useEnvironment.cjs");
|
|
@@ -94,6 +95,7 @@ exports.useHasEntity = useHasEntity.useHasEntity;
|
|
|
94
95
|
exports.useEntityList = useEntityList.useEntityList;
|
|
95
96
|
exports.useEntityListSubTree = useEntityListSubTree.useEntityListSubTree;
|
|
96
97
|
exports.useEntityListSubTreeParameters = useEntityListSubTreeParameters.useEntityListSubTreeParameters;
|
|
98
|
+
exports.useEntityListSubTreeLoader = useEntityListSubTreeLoader.useEntityListSubTreeLoader;
|
|
97
99
|
exports.useEntitySubTree = useEntitySubTree.useEntitySubTree;
|
|
98
100
|
exports.useEntitySubTreeParameters = useEntitySubTreeParameters.useEntitySubTreeParameters;
|
|
99
101
|
exports.useEnvironment = useEnvironment.useEnvironment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -24,6 +24,7 @@ import { useHasEntity } from "./accessorPropagation/useHasEntity.js";
|
|
|
24
24
|
import { useEntityList } from "./accessorPropagation/useEntityList.js";
|
|
25
25
|
import { useEntityListSubTree } from "./accessorPropagation/useEntityListSubTree.js";
|
|
26
26
|
import { useEntityListSubTreeParameters } from "./accessorPropagation/useEntityListSubTreeParameters.js";
|
|
27
|
+
import { useEntityListSubTreeLoader } from "./accessorPropagation/useEntityListSubTreeLoader.js";
|
|
27
28
|
import { useEntitySubTree } from "./accessorPropagation/useEntitySubTree.js";
|
|
28
29
|
import { useEntitySubTreeParameters } from "./accessorPropagation/useEntitySubTreeParameters.js";
|
|
29
30
|
import { useEnvironment } from "./accessorPropagation/useEnvironment.js";
|
|
@@ -118,6 +119,7 @@ export {
|
|
|
118
119
|
useEntityKey,
|
|
119
120
|
useEntityList,
|
|
120
121
|
useEntityListSubTree,
|
|
122
|
+
useEntityListSubTreeLoader,
|
|
121
123
|
useEntityListSubTreeParameters,
|
|
122
124
|
useEntityPersistError,
|
|
123
125
|
useEntityPersistSuccess,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const react = require("react");
|
|
4
|
+
const useExtendTree = require("./useExtendTree.cjs");
|
|
5
|
+
const EntityListSubTree = require("../coreComponents/EntityListSubTree.cjs");
|
|
6
|
+
const useEntityListSubTreeLoader = (entities, children, state) => {
|
|
7
|
+
const [displayedState, setDisplayedState] = react.useState({
|
|
8
|
+
entities: void 0,
|
|
9
|
+
treeRootId: void 0,
|
|
10
|
+
state: void 0
|
|
11
|
+
});
|
|
12
|
+
const currentlyLoading = react.useRef();
|
|
13
|
+
const [loadingState, setLoadingState] = react.useState("initial");
|
|
14
|
+
const extendTree = useExtendTree.useExtendTree();
|
|
15
|
+
react.useEffect(() => {
|
|
16
|
+
(async () => {
|
|
17
|
+
if (!entities || displayedState.state === state && displayedState.entities === entities || currentlyLoading.current?.entities === entities && currentlyLoading.current?.state === state) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
currentlyLoading.current = {
|
|
21
|
+
entities,
|
|
22
|
+
state
|
|
23
|
+
};
|
|
24
|
+
if (displayedState.entities) {
|
|
25
|
+
setLoadingState("refreshing");
|
|
26
|
+
}
|
|
27
|
+
const newTreeRootId = await extendTree(
|
|
28
|
+
react.createElement(EntityListSubTree.EntityListSubTree, {
|
|
29
|
+
...entities,
|
|
30
|
+
children
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
currentlyLoading.current = void 0;
|
|
34
|
+
if (newTreeRootId) {
|
|
35
|
+
setDisplayedState({
|
|
36
|
+
entities,
|
|
37
|
+
treeRootId: newTreeRootId,
|
|
38
|
+
state
|
|
39
|
+
});
|
|
40
|
+
setLoadingState("loaded");
|
|
41
|
+
}
|
|
42
|
+
})();
|
|
43
|
+
}, [displayedState, extendTree, entities, children, state]);
|
|
44
|
+
return [displayedState, loadingState];
|
|
45
|
+
};
|
|
46
|
+
exports.useEntityListSubTreeLoader = useEntityListSubTreeLoader;
|
|
47
|
+
//# sourceMappingURL=useEntityListSubTreeLoader.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEntityListSubTreeLoader.cjs","sources":["../../../src/accessorPropagation/useEntityListSubTreeLoader.ts"],"sourcesContent":["import { createElement, ReactNode, useEffect, useRef, useState } from 'react'\nimport { SugaredQualifiedEntityList, TreeRootId } from '@contember/binding'\nimport { useExtendTree } from './useExtendTree'\nimport { EntityListSubTree } from '../coreComponents'\n\nexport type UseEntityListSubTreeLoaderResult<State> = {\n\tentities: SugaredQualifiedEntityList | undefined\n\ttreeRootId: TreeRootId | undefined\n\tstate: State | undefined\n}\n\nexport type EntityListSubTreeLoaderState =\n\t| 'initial'\n\t| 'refreshing'\n\t| 'loaded'\n\nexport const useEntityListSubTreeLoader = <State>(entities: SugaredQualifiedEntityList | undefined, children: ReactNode, state?: State): [UseEntityListSubTreeLoaderResult<State>, EntityListSubTreeLoaderState] => {\n\tconst [displayedState, setDisplayedState] = useState<UseEntityListSubTreeLoaderResult<State>>({\n\t\tentities: undefined,\n\t\ttreeRootId: undefined,\n\t\tstate: undefined,\n\t})\n\tconst currentlyLoading = useRef<{\n\t\tentities: SugaredQualifiedEntityList\n\t\tstate?: State\n\t}>()\n\n\tconst [loadingState, setLoadingState] = useState<EntityListSubTreeLoaderState>('initial')\n\tconst extendTree = useExtendTree()\n\n\tuseEffect(() => {\n\t\t(async () => {\n\t\t\tif (\n\t\t\t\t!entities\n\t\t\t\t|| displayedState.state === state && displayedState.entities === entities\n\t\t\t\t|| currentlyLoading.current?.entities === entities && currentlyLoading.current?.state === state\n\t\t\t) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcurrentlyLoading.current = {\n\t\t\t\tentities,\n\t\t\t\tstate,\n\t\t\t}\n\n\t\t\tif (displayedState.entities) {\n\t\t\t\tsetLoadingState('refreshing')\n\t\t\t}\n\n\t\t\tconst newTreeRootId = await extendTree(\n\t\t\t\tcreateElement(EntityListSubTree, {\n\t\t\t\t\t...entities,\n\t\t\t\t\tchildren,\n\t\t\t\t}),\n\t\t\t)\n\t\t\tcurrentlyLoading.current = undefined\n\t\t\tif (newTreeRootId) {\n\t\t\t\tsetDisplayedState({\n\t\t\t\t\tentities: entities,\n\t\t\t\t\ttreeRootId: newTreeRootId,\n\t\t\t\t\tstate: state,\n\t\t\t\t})\n\t\t\t\tsetLoadingState('loaded')\n\t\t\t}\n\t\t})()\n\t}, [displayedState, extendTree, entities, children, state])\n\n\treturn [displayedState, loadingState]\n}\n"],"names":["useState","useRef","useExtendTree","useEffect","createElement","EntityListSubTree"],"mappings":";;;;;AAgBO,MAAM,6BAA6B,CAAQ,UAAkD,UAAqB,UAA2F;AACnN,QAAM,CAAC,gBAAgB,iBAAiB,IAAIA,eAAkD;AAAA,IAC7F,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,OAAO;AAAA,EAAA,CACP;AACD,QAAM,mBAAmBC,MAAAA;AAKzB,QAAM,CAAC,cAAc,eAAe,IAAID,eAAuC,SAAS;AACxF,QAAM,aAAaE,cAAAA;AAEnBC,QAAAA,UAAU,MAAM;AACf,KAAC,YAAY;AACZ,UACC,CAAC,YACE,eAAe,UAAU,SAAS,eAAe,aAAa,YAC9D,iBAAiB,SAAS,aAAa,YAAY,iBAAiB,SAAS,UAAU,OACzF;AACD;AAAA,MACD;AAEA,uBAAiB,UAAU;AAAA,QAC1B;AAAA,QACA;AAAA,MAAA;AAGD,UAAI,eAAe,UAAU;AAC5B,wBAAgB,YAAY;AAAA,MAC7B;AAEA,YAAM,gBAAgB,MAAM;AAAA,QAC3BC,MAAAA,cAAcC,kBAAAA,mBAAmB;AAAA,UAChC,GAAG;AAAA,UACH;AAAA,QAAA,CACA;AAAA,MAAA;AAEF,uBAAiB,UAAU;AAC3B,UAAI,eAAe;AACA,0BAAA;AAAA,UACjB;AAAA,UACA,YAAY;AAAA,UACZ;AAAA,QAAA,CACA;AACD,wBAAgB,QAAQ;AAAA,MACzB;AAAA,IAAA;EACE,GACD,CAAC,gBAAgB,YAAY,UAAU,UAAU,KAAK,CAAC;AAEnD,SAAA,CAAC,gBAAgB,YAAY;AACrC;;"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useState, useRef, useEffect, createElement } from "react";
|
|
2
|
+
import { useExtendTree } from "./useExtendTree.js";
|
|
3
|
+
import { EntityListSubTree } from "../coreComponents/EntityListSubTree.js";
|
|
4
|
+
const useEntityListSubTreeLoader = (entities, children, state) => {
|
|
5
|
+
const [displayedState, setDisplayedState] = useState({
|
|
6
|
+
entities: void 0,
|
|
7
|
+
treeRootId: void 0,
|
|
8
|
+
state: void 0
|
|
9
|
+
});
|
|
10
|
+
const currentlyLoading = useRef();
|
|
11
|
+
const [loadingState, setLoadingState] = useState("initial");
|
|
12
|
+
const extendTree = useExtendTree();
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
(async () => {
|
|
15
|
+
if (!entities || displayedState.state === state && displayedState.entities === entities || currentlyLoading.current?.entities === entities && currentlyLoading.current?.state === state) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
currentlyLoading.current = {
|
|
19
|
+
entities,
|
|
20
|
+
state
|
|
21
|
+
};
|
|
22
|
+
if (displayedState.entities) {
|
|
23
|
+
setLoadingState("refreshing");
|
|
24
|
+
}
|
|
25
|
+
const newTreeRootId = await extendTree(
|
|
26
|
+
createElement(EntityListSubTree, {
|
|
27
|
+
...entities,
|
|
28
|
+
children
|
|
29
|
+
})
|
|
30
|
+
);
|
|
31
|
+
currentlyLoading.current = void 0;
|
|
32
|
+
if (newTreeRootId) {
|
|
33
|
+
setDisplayedState({
|
|
34
|
+
entities,
|
|
35
|
+
treeRootId: newTreeRootId,
|
|
36
|
+
state
|
|
37
|
+
});
|
|
38
|
+
setLoadingState("loaded");
|
|
39
|
+
}
|
|
40
|
+
})();
|
|
41
|
+
}, [displayedState, extendTree, entities, children, state]);
|
|
42
|
+
return [displayedState, loadingState];
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
useEntityListSubTreeLoader
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=useEntityListSubTreeLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEntityListSubTreeLoader.js","sources":["../../../src/accessorPropagation/useEntityListSubTreeLoader.ts"],"sourcesContent":["import { createElement, ReactNode, useEffect, useRef, useState } from 'react'\nimport { SugaredQualifiedEntityList, TreeRootId } from '@contember/binding'\nimport { useExtendTree } from './useExtendTree'\nimport { EntityListSubTree } from '../coreComponents'\n\nexport type UseEntityListSubTreeLoaderResult<State> = {\n\tentities: SugaredQualifiedEntityList | undefined\n\ttreeRootId: TreeRootId | undefined\n\tstate: State | undefined\n}\n\nexport type EntityListSubTreeLoaderState =\n\t| 'initial'\n\t| 'refreshing'\n\t| 'loaded'\n\nexport const useEntityListSubTreeLoader = <State>(entities: SugaredQualifiedEntityList | undefined, children: ReactNode, state?: State): [UseEntityListSubTreeLoaderResult<State>, EntityListSubTreeLoaderState] => {\n\tconst [displayedState, setDisplayedState] = useState<UseEntityListSubTreeLoaderResult<State>>({\n\t\tentities: undefined,\n\t\ttreeRootId: undefined,\n\t\tstate: undefined,\n\t})\n\tconst currentlyLoading = useRef<{\n\t\tentities: SugaredQualifiedEntityList\n\t\tstate?: State\n\t}>()\n\n\tconst [loadingState, setLoadingState] = useState<EntityListSubTreeLoaderState>('initial')\n\tconst extendTree = useExtendTree()\n\n\tuseEffect(() => {\n\t\t(async () => {\n\t\t\tif (\n\t\t\t\t!entities\n\t\t\t\t|| displayedState.state === state && displayedState.entities === entities\n\t\t\t\t|| currentlyLoading.current?.entities === entities && currentlyLoading.current?.state === state\n\t\t\t) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcurrentlyLoading.current = {\n\t\t\t\tentities,\n\t\t\t\tstate,\n\t\t\t}\n\n\t\t\tif (displayedState.entities) {\n\t\t\t\tsetLoadingState('refreshing')\n\t\t\t}\n\n\t\t\tconst newTreeRootId = await extendTree(\n\t\t\t\tcreateElement(EntityListSubTree, {\n\t\t\t\t\t...entities,\n\t\t\t\t\tchildren,\n\t\t\t\t}),\n\t\t\t)\n\t\t\tcurrentlyLoading.current = undefined\n\t\t\tif (newTreeRootId) {\n\t\t\t\tsetDisplayedState({\n\t\t\t\t\tentities: entities,\n\t\t\t\t\ttreeRootId: newTreeRootId,\n\t\t\t\t\tstate: state,\n\t\t\t\t})\n\t\t\t\tsetLoadingState('loaded')\n\t\t\t}\n\t\t})()\n\t}, [displayedState, extendTree, entities, children, state])\n\n\treturn [displayedState, loadingState]\n}\n"],"names":[],"mappings":";;;AAgBO,MAAM,6BAA6B,CAAQ,UAAkD,UAAqB,UAA2F;AACnN,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAkD;AAAA,IAC7F,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,OAAO;AAAA,EAAA,CACP;AACD,QAAM,mBAAmB;AAKzB,QAAM,CAAC,cAAc,eAAe,IAAI,SAAuC,SAAS;AACxF,QAAM,aAAa;AAEnB,YAAU,MAAM;AACf,KAAC,YAAY;AACZ,UACC,CAAC,YACE,eAAe,UAAU,SAAS,eAAe,aAAa,YAC9D,iBAAiB,SAAS,aAAa,YAAY,iBAAiB,SAAS,UAAU,OACzF;AACD;AAAA,MACD;AAEA,uBAAiB,UAAU;AAAA,QAC1B;AAAA,QACA;AAAA,MAAA;AAGD,UAAI,eAAe,UAAU;AAC5B,wBAAgB,YAAY;AAAA,MAC7B;AAEA,YAAM,gBAAgB,MAAM;AAAA,QAC3B,cAAc,mBAAmB;AAAA,UAChC,GAAG;AAAA,UACH;AAAA,QAAA,CACA;AAAA,MAAA;AAEF,uBAAiB,UAAU;AAC3B,UAAI,eAAe;AACA,0BAAA;AAAA,UACjB;AAAA,UACA,YAAY;AAAA,UACZ;AAAA,QAAA,CACA;AACD,wBAAgB,QAAQ;AAAA,MACzB;AAAA,IAAA;EACE,GACD,CAAC,gBAAgB,YAAY,UAAU,UAAU,KAAK,CAAC;AAEnD,SAAA,CAAC,gBAAgB,YAAY;AACrC;"}
|
|
@@ -7,10 +7,7 @@ const sortEntities = (entities, sortByField) => {
|
|
|
7
7
|
return entities.sort((a, b) => {
|
|
8
8
|
const aField = a.getRelativeSingleField(sortByField);
|
|
9
9
|
const bField = b.getRelativeSingleField(sortByField);
|
|
10
|
-
|
|
11
|
-
return aField.value - bField.value;
|
|
12
|
-
}
|
|
13
|
-
return 0;
|
|
10
|
+
return (aField.value ?? Number.MAX_SAFE_INTEGER) - (bField.value ?? Number.MAX_SAFE_INTEGER);
|
|
14
11
|
});
|
|
15
12
|
};
|
|
16
13
|
exports.sortEntities = sortEntities;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortEntities.cjs","sources":["../../../src/accessorSorting/sortEntities.ts"],"sourcesContent":["import { EntityAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const sortEntities = (\n\tentities: EntityAccessor[],\n\tsortByField: RelativeSingleField | undefined,\n): EntityAccessor[] => {\n\tif (!sortByField) {\n\t\treturn entities\n\t}\n\treturn entities.sort((a, b) => {\n\t\tconst aField = a.getRelativeSingleField<number>(sortByField)\n\t\tconst bField = b.getRelativeSingleField<number>(sortByField)\n\n\t\
|
|
1
|
+
{"version":3,"file":"sortEntities.cjs","sources":["../../../src/accessorSorting/sortEntities.ts"],"sourcesContent":["import { EntityAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const sortEntities = (\n\tentities: EntityAccessor[],\n\tsortByField: RelativeSingleField | undefined,\n): EntityAccessor[] => {\n\tif (!sortByField) {\n\t\treturn entities\n\t}\n\treturn entities.sort((a, b) => {\n\t\tconst aField = a.getRelativeSingleField<number>(sortByField)\n\t\tconst bField = b.getRelativeSingleField<number>(sortByField)\n\n\t\treturn (aField.value ?? Number.MAX_SAFE_INTEGER) - (bField.value ?? Number.MAX_SAFE_INTEGER)\n\t})\n}\n"],"names":[],"mappings":";;AAEa,MAAA,eAAe,CAC3B,UACA,gBACsB;AACtB,MAAI,CAAC,aAAa;AACV,WAAA;AAAA,EACR;AACA,SAAO,SAAS,KAAK,CAAC,GAAG,MAAM;AACxB,UAAA,SAAS,EAAE,uBAA+B,WAAW;AACrD,UAAA,SAAS,EAAE,uBAA+B,WAAW;AAE3D,YAAQ,OAAO,SAAS,OAAO,qBAAqB,OAAO,SAAS,OAAO;AAAA,EAAA,CAC3E;AACF;;"}
|
|
@@ -5,10 +5,7 @@ const sortEntities = (entities, sortByField) => {
|
|
|
5
5
|
return entities.sort((a, b) => {
|
|
6
6
|
const aField = a.getRelativeSingleField(sortByField);
|
|
7
7
|
const bField = b.getRelativeSingleField(sortByField);
|
|
8
|
-
|
|
9
|
-
return aField.value - bField.value;
|
|
10
|
-
}
|
|
11
|
-
return 0;
|
|
8
|
+
return (aField.value ?? Number.MAX_SAFE_INTEGER) - (bField.value ?? Number.MAX_SAFE_INTEGER);
|
|
12
9
|
});
|
|
13
10
|
};
|
|
14
11
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortEntities.js","sources":["../../../src/accessorSorting/sortEntities.ts"],"sourcesContent":["import { EntityAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const sortEntities = (\n\tentities: EntityAccessor[],\n\tsortByField: RelativeSingleField | undefined,\n): EntityAccessor[] => {\n\tif (!sortByField) {\n\t\treturn entities\n\t}\n\treturn entities.sort((a, b) => {\n\t\tconst aField = a.getRelativeSingleField<number>(sortByField)\n\t\tconst bField = b.getRelativeSingleField<number>(sortByField)\n\n\t\
|
|
1
|
+
{"version":3,"file":"sortEntities.js","sources":["../../../src/accessorSorting/sortEntities.ts"],"sourcesContent":["import { EntityAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const sortEntities = (\n\tentities: EntityAccessor[],\n\tsortByField: RelativeSingleField | undefined,\n): EntityAccessor[] => {\n\tif (!sortByField) {\n\t\treturn entities\n\t}\n\treturn entities.sort((a, b) => {\n\t\tconst aField = a.getRelativeSingleField<number>(sortByField)\n\t\tconst bField = b.getRelativeSingleField<number>(sortByField)\n\n\t\treturn (aField.value ?? Number.MAX_SAFE_INTEGER) - (bField.value ?? Number.MAX_SAFE_INTEGER)\n\t})\n}\n"],"names":[],"mappings":"AAEa,MAAA,eAAe,CAC3B,UACA,gBACsB;AACtB,MAAI,CAAC,aAAa;AACV,WAAA;AAAA,EACR;AACA,SAAO,SAAS,KAAK,CAAC,GAAG,MAAM;AACxB,UAAA,SAAS,EAAE,uBAA+B,WAAW;AACrD,UAAA,SAAS,EAAE,uBAA+B,WAAW;AAE3D,YAAQ,OAAO,SAAS,OAAO,qBAAqB,OAAO,SAAS,OAAO;AAAA,EAAA,CAC3E;AACF;"}
|
|
@@ -26,6 +26,7 @@ const useHasEntity = require("./accessorPropagation/useHasEntity.cjs");
|
|
|
26
26
|
const useEntityList = require("./accessorPropagation/useEntityList.cjs");
|
|
27
27
|
const useEntityListSubTree = require("./accessorPropagation/useEntityListSubTree.cjs");
|
|
28
28
|
const useEntityListSubTreeParameters = require("./accessorPropagation/useEntityListSubTreeParameters.cjs");
|
|
29
|
+
const useEntityListSubTreeLoader = require("./accessorPropagation/useEntityListSubTreeLoader.cjs");
|
|
29
30
|
const useEntitySubTree = require("./accessorPropagation/useEntitySubTree.cjs");
|
|
30
31
|
const useEntitySubTreeParameters = require("./accessorPropagation/useEntitySubTreeParameters.cjs");
|
|
31
32
|
const useEnvironment = require("./accessorPropagation/useEnvironment.cjs");
|
|
@@ -94,6 +95,7 @@ exports.useHasEntity = useHasEntity.useHasEntity;
|
|
|
94
95
|
exports.useEntityList = useEntityList.useEntityList;
|
|
95
96
|
exports.useEntityListSubTree = useEntityListSubTree.useEntityListSubTree;
|
|
96
97
|
exports.useEntityListSubTreeParameters = useEntityListSubTreeParameters.useEntityListSubTreeParameters;
|
|
98
|
+
exports.useEntityListSubTreeLoader = useEntityListSubTreeLoader.useEntityListSubTreeLoader;
|
|
97
99
|
exports.useEntitySubTree = useEntitySubTree.useEntitySubTree;
|
|
98
100
|
exports.useEntitySubTreeParameters = useEntitySubTreeParameters.useEntitySubTreeParameters;
|
|
99
101
|
exports.useEnvironment = useEnvironment.useEnvironment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/production/index.js
CHANGED
|
@@ -24,6 +24,7 @@ import { useHasEntity } from "./accessorPropagation/useHasEntity.js";
|
|
|
24
24
|
import { useEntityList } from "./accessorPropagation/useEntityList.js";
|
|
25
25
|
import { useEntityListSubTree } from "./accessorPropagation/useEntityListSubTree.js";
|
|
26
26
|
import { useEntityListSubTreeParameters } from "./accessorPropagation/useEntityListSubTreeParameters.js";
|
|
27
|
+
import { useEntityListSubTreeLoader } from "./accessorPropagation/useEntityListSubTreeLoader.js";
|
|
27
28
|
import { useEntitySubTree } from "./accessorPropagation/useEntitySubTree.js";
|
|
28
29
|
import { useEntitySubTreeParameters } from "./accessorPropagation/useEntitySubTreeParameters.js";
|
|
29
30
|
import { useEnvironment } from "./accessorPropagation/useEnvironment.js";
|
|
@@ -118,6 +119,7 @@ export {
|
|
|
118
119
|
useEntityKey,
|
|
119
120
|
useEntityList,
|
|
120
121
|
useEntityListSubTree,
|
|
122
|
+
useEntityListSubTreeLoader,
|
|
121
123
|
useEntityListSubTreeParameters,
|
|
122
124
|
useEntityPersistError,
|
|
123
125
|
useEntityPersistSuccess,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { Environment } from '@contember/binding';
|
|
3
|
-
export declare const EnvironmentContext: import("react").Context<Environment
|
|
3
|
+
export declare const EnvironmentContext: import("react").Context<Environment<Environment.AnyNode | undefined>>;
|
|
4
4
|
export interface EnvironmentMiddlewareProps {
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
create: (env: Environment) => Environment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnvironmentContext.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/EnvironmentContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAe,MAAM,OAAO,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAIhD,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"EnvironmentContext.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/EnvironmentContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAe,MAAM,OAAO,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAIhD,eAAO,MAAM,kBAAkB,uEAAmD,CAAA;AAGlF,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,EAAE,SAAS,CAAA;IACnB,MAAM,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,WAAW,CAAA;CACzC;AAED,eAAO,MAAM,qBAAqB,kEAajC,CAAA;AAED,MAAM,WAAW,6BAA6B,CAAC,CAAC,EAAE,CAAC;IAClD,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IACtC,KAAK,EAAE,CAAC,CAAA;CACR;AAED,eAAO,MAAM,4BAA4B,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,6BAA6B,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,SAShG,CAAA"}
|
|
@@ -14,6 +14,7 @@ export * from './useHasEntity';
|
|
|
14
14
|
export * from './useEntityList';
|
|
15
15
|
export * from './useEntityListSubTree';
|
|
16
16
|
export * from './useEntityListSubTreeParameters';
|
|
17
|
+
export * from './useEntityListSubTreeLoader';
|
|
17
18
|
export * from './useEntitySubTree';
|
|
18
19
|
export * from './useEntitySubTreeParameters';
|
|
19
20
|
export * from './useEnvironment';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/index.ts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAA;AAClC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,wBAAwB,CAAA;AACtC,cAAc,kCAAkC,CAAA;AAChD,cAAc,oCAAoC,CAAA;AAClD,cAAc,mCAAmC,CAAA;AACjD,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,kCAAkC,CAAA;AAChD,cAAc,oBAAoB,CAAA;AAClC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/index.ts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAA;AAClC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,wBAAwB,CAAA;AACtC,cAAc,kCAAkC,CAAA;AAChD,cAAc,oCAAoC,CAAA;AAClD,cAAc,mCAAmC,CAAA;AACjD,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,kCAAkC,CAAA;AAChD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oBAAoB,CAAA;AAClC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SugaredQualifiedEntityList, TreeRootId } from '@contember/binding';
|
|
3
|
+
export type UseEntityListSubTreeLoaderResult<State> = {
|
|
4
|
+
entities: SugaredQualifiedEntityList | undefined;
|
|
5
|
+
treeRootId: TreeRootId | undefined;
|
|
6
|
+
state: State | undefined;
|
|
7
|
+
};
|
|
8
|
+
export type EntityListSubTreeLoaderState = 'initial' | 'refreshing' | 'loaded';
|
|
9
|
+
export declare const useEntityListSubTreeLoader: <State>(entities: SugaredQualifiedEntityList | undefined, children: ReactNode, state?: State | undefined) => [UseEntityListSubTreeLoaderResult<State>, EntityListSubTreeLoaderState];
|
|
10
|
+
//# sourceMappingURL=useEntityListSubTreeLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEntityListSubTreeLoader.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/useEntityListSubTreeLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAA+B,MAAM,OAAO,CAAA;AAC7E,OAAO,EAAE,0BAA0B,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAI3E,MAAM,MAAM,gCAAgC,CAAC,KAAK,IAAI;IACrD,QAAQ,EAAE,0BAA0B,GAAG,SAAS,CAAA;IAChD,UAAU,EAAE,UAAU,GAAG,SAAS,CAAA;IAClC,KAAK,EAAE,KAAK,GAAG,SAAS,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,4BAA4B,GACrC,SAAS,GACT,YAAY,GACZ,QAAQ,CAAA;AAEX,eAAO,MAAM,0BAA0B,oBAAqB,0BAA0B,GAAG,SAAS,YAAY,SAAS,uGAoDtH,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortEntities.d.ts","sourceRoot":"","sources":["../../../src/accessorSorting/sortEntities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAExE,eAAO,MAAM,YAAY,aACd,cAAc,EAAE,eACb,mBAAmB,GAAG,SAAS,KAC1C,cAAc,
|
|
1
|
+
{"version":3,"file":"sortEntities.d.ts","sourceRoot":"","sources":["../../../src/accessorSorting/sortEntities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAExE,eAAO,MAAM,YAAY,aACd,cAAc,EAAE,eACb,mBAAmB,GAAG,SAAS,KAC1C,cAAc,EAUhB,CAAA"}
|