@contember/binding 1.1.0-rc.5 → 1.1.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.
Files changed (199) hide show
  1. package/dist/development/accessorPropagation/AccessorProvider.js +7 -14
  2. package/dist/development/accessorPropagation/AccessorProvider.js.map +1 -1
  3. package/dist/development/accessorPropagation/BindingOperationsProvider.js +3 -7
  4. package/dist/development/accessorPropagation/BindingOperationsProvider.js.map +1 -1
  5. package/dist/development/accessorPropagation/EntityKeyProvider.js +3 -7
  6. package/dist/development/accessorPropagation/EntityKeyProvider.js.map +1 -1
  7. package/dist/development/accessorPropagation/EnvironmentContext.js +39 -56
  8. package/dist/development/accessorPropagation/EnvironmentContext.js.map +1 -1
  9. package/dist/development/accessorPropagation/TreeRootIdProvider.js +3 -7
  10. package/dist/development/accessorPropagation/TreeRootIdProvider.js.map +1 -1
  11. package/dist/development/accessorSorting/SetOrderFieldOnCreate.js +104 -89
  12. package/dist/development/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
  13. package/dist/development/accessorTree/AccessorTree.js +20 -39
  14. package/dist/development/accessorTree/AccessorTree.js.map +1 -1
  15. package/dist/development/accessorTree/RuntimeId.js +1 -1
  16. package/dist/development/accessorTree/RuntimeId.js.map +1 -1
  17. package/dist/development/accessorTree/accessorTreeStateReducer.js.map +1 -1
  18. package/dist/development/core/AccessorErrorManager.js +6 -6
  19. package/dist/development/core/AccessorErrorManager.js.map +1 -1
  20. package/dist/development/core/Config.js.map +1 -1
  21. package/dist/development/core/DataBinding.js +16 -16
  22. package/dist/development/core/DataBinding.js.map +1 -1
  23. package/dist/development/core/DirtinessTracker.js.map +1 -1
  24. package/dist/development/core/EventManager.js +11 -11
  25. package/dist/development/core/EventManager.js.map +1 -1
  26. package/dist/development/core/IncrementalMarkerBuilder.js +5 -5
  27. package/dist/development/core/IncrementalMarkerBuilder.js.map +1 -1
  28. package/dist/development/core/MarkerTreeGenerator.js +6 -6
  29. package/dist/development/core/MarkerTreeGenerator.js.map +1 -1
  30. package/dist/development/core/MutationGenerator.js +7 -7
  31. package/dist/development/core/MutationGenerator.js.map +1 -1
  32. package/dist/development/core/RealmKeyGenerator.js +2 -2
  33. package/dist/development/core/RealmKeyGenerator.js.map +1 -1
  34. package/dist/development/core/StateInitializer.js +8 -8
  35. package/dist/development/core/StateInitializer.js.map +1 -1
  36. package/dist/development/core/TreeAugmenter.js.map +1 -1
  37. package/dist/development/core/TreeStore.js +7 -7
  38. package/dist/development/core/TreeStore.js.map +1 -1
  39. package/dist/development/core/exceptions/ErrorLocator.js +3 -3
  40. package/dist/development/core/exceptions/ErrorLocator.js.map +1 -1
  41. package/dist/development/core/schema/SchemaLoader.js +2 -2
  42. package/dist/development/core/schema/SchemaLoader.js.map +1 -1
  43. package/dist/development/core/state/StateIterator.js.map +1 -1
  44. package/dist/development/coreComponents/Component.js.map +1 -1
  45. package/dist/development/coreComponents/DataBindingProvider.js +11 -11
  46. package/dist/development/coreComponents/DataBindingProvider.js.map +1 -1
  47. package/dist/development/coreComponents/Entity.js +11 -15
  48. package/dist/development/coreComponents/Entity.js.map +1 -1
  49. package/dist/development/coreComponents/EntityList.js +35 -31
  50. package/dist/development/coreComponents/EntityList.js.map +1 -1
  51. package/dist/development/coreComponents/EntityListSubTree.js +41 -41
  52. package/dist/development/coreComponents/EntityListSubTree.js.map +1 -1
  53. package/dist/development/coreComponents/EntitySubTree.js +63 -51
  54. package/dist/development/coreComponents/EntitySubTree.js.map +1 -1
  55. package/dist/development/coreComponents/Field.js +28 -20
  56. package/dist/development/coreComponents/Field.js.map +1 -1
  57. package/dist/development/coreComponents/HasMany.js +30 -33
  58. package/dist/development/coreComponents/HasMany.js.map +1 -1
  59. package/dist/development/coreComponents/HasOne.js +30 -33
  60. package/dist/development/coreComponents/HasOne.js.map +1 -1
  61. package/dist/development/coreComponents/ParentEntity.js +12 -6
  62. package/dist/development/coreComponents/ParentEntity.js.map +1 -1
  63. package/dist/development/fieldHelpers/helpers/FieldHelper.js +1 -1
  64. package/dist/development/fieldHelpers/helpers/FieldHelper.js.map +1 -1
  65. package/dist/development/helperComponents/DeferredSubTrees.js +83 -86
  66. package/dist/development/helperComponents/DeferredSubTrees.js.map +1 -1
  67. package/dist/development/helperComponents/EntityView.js +5 -3
  68. package/dist/development/helperComponents/EntityView.js.map +1 -1
  69. package/dist/development/helperComponents/FieldView.js +50 -36
  70. package/dist/development/helperComponents/FieldView.js.map +1 -1
  71. package/dist/development/helperComponents/If.js +70 -63
  72. package/dist/development/helperComponents/If.js.map +1 -1
  73. package/dist/development/helperComponents/StaticRender.js +9 -5
  74. package/dist/development/helperComponents/StaticRender.js.map +1 -1
  75. package/dist/development/helperComponents/SugaredField.js +6 -13
  76. package/dist/development/helperComponents/SugaredField.js.map +1 -1
  77. package/dist/development/helperComponents/helpers/FilterEvaluator.js.map +1 -1
  78. package/dist/development/markers/EntityListSubTreeMarker.js +2 -2
  79. package/dist/development/markers/EntityListSubTreeMarker.js.map +1 -1
  80. package/dist/development/markers/EntitySubTreeMarker.js +2 -2
  81. package/dist/development/markers/EntitySubTreeMarker.js.map +1 -1
  82. package/dist/development/markers/FieldMarker.js +2 -2
  83. package/dist/development/markers/FieldMarker.js.map +1 -1
  84. package/dist/development/markers/HasManyRelationMarker.js +3 -3
  85. package/dist/development/markers/HasManyRelationMarker.js.map +1 -1
  86. package/dist/development/markers/HasOneRelationMarker.js +2 -2
  87. package/dist/development/markers/HasOneRelationMarker.js.map +1 -1
  88. package/dist/development/queryLanguage/CacheStore.js +1 -1
  89. package/dist/development/queryLanguage/CacheStore.js.map +1 -1
  90. package/dist/development/queryLanguage/Parser.js +7 -7
  91. package/dist/development/queryLanguage/Parser.js.map +1 -1
  92. package/dist/development/queryLanguage/QueryLanguage.js +6 -6
  93. package/dist/development/queryLanguage/QueryLanguage.js.map +1 -1
  94. package/dist/development/structures/BijectiveIndexedMap.js +1 -1
  95. package/dist/development/structures/BijectiveIndexedMap.js.map +1 -1
  96. package/dist/development/structures/LRUCache.js +1 -1
  97. package/dist/development/structures/LRUCache.js.map +1 -1
  98. package/dist/development/structures/WeakIdCache.js.map +1 -1
  99. package/dist/production/accessorPropagation/AccessorProvider.js +2 -8
  100. package/dist/production/accessorPropagation/AccessorProvider.js.map +1 -1
  101. package/dist/production/accessorPropagation/BindingOperationsProvider.js +2 -5
  102. package/dist/production/accessorPropagation/BindingOperationsProvider.js.map +1 -1
  103. package/dist/production/accessorPropagation/EntityKeyProvider.js +2 -5
  104. package/dist/production/accessorPropagation/EntityKeyProvider.js.map +1 -1
  105. package/dist/production/accessorPropagation/EnvironmentContext.js +23 -43
  106. package/dist/production/accessorPropagation/EnvironmentContext.js.map +1 -1
  107. package/dist/production/accessorPropagation/TreeRootIdProvider.js +2 -5
  108. package/dist/production/accessorPropagation/TreeRootIdProvider.js.map +1 -1
  109. package/dist/production/accessorSorting/SetOrderFieldOnCreate.js +62 -62
  110. package/dist/production/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
  111. package/dist/production/accessorTree/AccessorTree.js +3 -21
  112. package/dist/production/accessorTree/AccessorTree.js.map +1 -1
  113. package/dist/production/accessorTree/RuntimeId.js +1 -1
  114. package/dist/production/accessorTree/RuntimeId.js.map +1 -1
  115. package/dist/production/accessorTree/accessorTreeStateReducer.js.map +1 -1
  116. package/dist/production/core/AccessorErrorManager.js +6 -6
  117. package/dist/production/core/AccessorErrorManager.js.map +1 -1
  118. package/dist/production/core/Config.js.map +1 -1
  119. package/dist/production/core/DataBinding.js +16 -16
  120. package/dist/production/core/DataBinding.js.map +1 -1
  121. package/dist/production/core/DirtinessTracker.js.map +1 -1
  122. package/dist/production/core/EventManager.js +11 -11
  123. package/dist/production/core/EventManager.js.map +1 -1
  124. package/dist/production/core/IncrementalMarkerBuilder.js +5 -5
  125. package/dist/production/core/IncrementalMarkerBuilder.js.map +1 -1
  126. package/dist/production/core/MarkerTreeGenerator.js +6 -6
  127. package/dist/production/core/MarkerTreeGenerator.js.map +1 -1
  128. package/dist/production/core/MutationGenerator.js +7 -7
  129. package/dist/production/core/MutationGenerator.js.map +1 -1
  130. package/dist/production/core/RealmKeyGenerator.js +2 -2
  131. package/dist/production/core/RealmKeyGenerator.js.map +1 -1
  132. package/dist/production/core/StateInitializer.js +8 -8
  133. package/dist/production/core/StateInitializer.js.map +1 -1
  134. package/dist/production/core/TreeAugmenter.js.map +1 -1
  135. package/dist/production/core/TreeStore.js +7 -7
  136. package/dist/production/core/TreeStore.js.map +1 -1
  137. package/dist/production/core/exceptions/ErrorLocator.js +3 -3
  138. package/dist/production/core/exceptions/ErrorLocator.js.map +1 -1
  139. package/dist/production/core/schema/SchemaLoader.js +2 -2
  140. package/dist/production/core/schema/SchemaLoader.js.map +1 -1
  141. package/dist/production/core/state/StateIterator.js.map +1 -1
  142. package/dist/production/coreComponents/Component.js.map +1 -1
  143. package/dist/production/coreComponents/DataBindingProvider.js +10 -9
  144. package/dist/production/coreComponents/DataBindingProvider.js.map +1 -1
  145. package/dist/production/coreComponents/Entity.js +7 -10
  146. package/dist/production/coreComponents/Entity.js.map +1 -1
  147. package/dist/production/coreComponents/EntityList.js +25 -28
  148. package/dist/production/coreComponents/EntityList.js.map +1 -1
  149. package/dist/production/coreComponents/EntityListSubTree.js +29 -28
  150. package/dist/production/coreComponents/EntityListSubTree.js.map +1 -1
  151. package/dist/production/coreComponents/EntitySubTree.js +39 -34
  152. package/dist/production/coreComponents/EntitySubTree.js.map +1 -1
  153. package/dist/production/coreComponents/Field.js +20 -20
  154. package/dist/production/coreComponents/Field.js.map +1 -1
  155. package/dist/production/coreComponents/HasMany.js +18 -20
  156. package/dist/production/coreComponents/HasMany.js.map +1 -1
  157. package/dist/production/coreComponents/HasOne.js +18 -20
  158. package/dist/production/coreComponents/HasOne.js.map +1 -1
  159. package/dist/production/coreComponents/ParentEntity.js +8 -6
  160. package/dist/production/coreComponents/ParentEntity.js.map +1 -1
  161. package/dist/production/fieldHelpers/helpers/FieldHelper.js +1 -1
  162. package/dist/production/fieldHelpers/helpers/FieldHelper.js.map +1 -1
  163. package/dist/production/helperComponents/DeferredSubTrees.js +67 -77
  164. package/dist/production/helperComponents/DeferredSubTrees.js.map +1 -1
  165. package/dist/production/helperComponents/EntityView.js +1 -3
  166. package/dist/production/helperComponents/EntityView.js.map +1 -1
  167. package/dist/production/helperComponents/FieldView.js +38 -31
  168. package/dist/production/helperComponents/FieldView.js.map +1 -1
  169. package/dist/production/helperComponents/If.js +40 -52
  170. package/dist/production/helperComponents/If.js.map +1 -1
  171. package/dist/production/helperComponents/StaticRender.js +5 -5
  172. package/dist/production/helperComponents/StaticRender.js.map +1 -1
  173. package/dist/production/helperComponents/SugaredField.js +2 -8
  174. package/dist/production/helperComponents/SugaredField.js.map +1 -1
  175. package/dist/production/helperComponents/helpers/FilterEvaluator.js.map +1 -1
  176. package/dist/production/markers/EntityListSubTreeMarker.js +2 -2
  177. package/dist/production/markers/EntityListSubTreeMarker.js.map +1 -1
  178. package/dist/production/markers/EntitySubTreeMarker.js +2 -2
  179. package/dist/production/markers/EntitySubTreeMarker.js.map +1 -1
  180. package/dist/production/markers/FieldMarker.js +2 -2
  181. package/dist/production/markers/FieldMarker.js.map +1 -1
  182. package/dist/production/markers/HasManyRelationMarker.js +2 -2
  183. package/dist/production/markers/HasManyRelationMarker.js.map +1 -1
  184. package/dist/production/markers/HasOneRelationMarker.js +2 -2
  185. package/dist/production/markers/HasOneRelationMarker.js.map +1 -1
  186. package/dist/production/queryLanguage/CacheStore.js +1 -1
  187. package/dist/production/queryLanguage/CacheStore.js.map +1 -1
  188. package/dist/production/queryLanguage/Parser.js +7 -7
  189. package/dist/production/queryLanguage/Parser.js.map +1 -1
  190. package/dist/production/queryLanguage/QueryLanguage.js +6 -6
  191. package/dist/production/queryLanguage/QueryLanguage.js.map +1 -1
  192. package/dist/production/structures/BijectiveIndexedMap.js +1 -1
  193. package/dist/production/structures/BijectiveIndexedMap.js.map +1 -1
  194. package/dist/production/structures/LRUCache.js +1 -1
  195. package/dist/production/structures/LRUCache.js.map +1 -1
  196. package/dist/production/structures/WeakIdCache.js.map +1 -1
  197. package/dist/types/tsconfig.tsbuildinfo +1 -1
  198. package/package.json +13 -13
  199. package/LICENSE +0 -186
@@ -1,6 +1,6 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
1
2
  import { useState, useCallback, useEffect } from "react";
2
3
  import { useConstantValueInvariant } from "@contember/react-utils";
3
- import { jsxs, Fragment, jsx } from "react/jsx-runtime";
4
4
  import { Component } from "../coreComponents/Component.js";
5
5
  import { useBindingOperations } from "../accessorPropagation/useBindingOperations.js";
6
6
  import { useMutationState } from "../accessorTree/useMutationState.js";
@@ -11,88 +11,78 @@ import { MarkerFactory } from "../queryLanguage/MarkerFactory.js";
11
11
  import { useEnvironment } from "../accessorPropagation/useEnvironment.js";
12
12
  import { EntityFieldMarkersContainer } from "../markers/EntityFieldMarkersContainer.js";
13
13
  import { EntityFieldsWithHoistablesMarker } from "../markers/EntityFieldsWithHoistablesMarker.js";
14
- const DeferredSubTrees = Component((props) => {
15
- const {
16
- extendTree
17
- } = useBindingOperations();
18
- const isMutating = useMutationState();
19
- const [loadState, setLoadState] = useState({
20
- name: "initial"
21
- });
22
- const [abortController] = useState(() => new AbortController());
23
- const signal = abortController.signal;
24
- const hasEntity = useHasEntity();
25
- useConstantValueInvariant(hasEntity);
26
- if (hasEntity) {
27
- useEntityBeforePersist(useCallback((getAccessor) => {
28
- if (getAccessor().existsOnServer) {
14
+ const DeferredSubTrees = Component(
15
+ (props) => {
16
+ const { extendTree } = useBindingOperations();
17
+ const isMutating = useMutationState();
18
+ const [loadState, setLoadState] = useState({ name: "initial" });
19
+ const [abortController] = useState(() => new AbortController());
20
+ const signal = abortController.signal;
21
+ const hasEntity = useHasEntity();
22
+ useConstantValueInvariant(hasEntity);
23
+ if (hasEntity) {
24
+ useEntityBeforePersist(
25
+ useCallback((getAccessor) => {
26
+ if (getAccessor().existsOnServer) {
27
+ return;
28
+ }
29
+ setLoadState({ name: "initial" });
30
+ }, [])
31
+ );
32
+ }
33
+ useEffect(() => {
34
+ return () => {
35
+ abortController.abort();
36
+ };
37
+ }, [abortController]);
38
+ const environment = useEnvironment();
39
+ useEffect(() => {
40
+ if (isMutating || loadState.name !== "initial" || signal.aborted) {
29
41
  return;
30
42
  }
31
- setLoadState({
32
- name: "initial"
43
+ setLoadState({ name: "loading" });
44
+ const newFragment = /* @__PURE__ */ jsx(OnlyKeepSubTrees, { children: props.children });
45
+ extendTree(newFragment, { signal, environment }).then((treeRootId) => !signal.aborted && setLoadState({ name: "success", treeRootId })).catch((error) => {
46
+ if (signal.aborted) {
47
+ return;
48
+ }
49
+ throw error;
33
50
  });
34
- }, []));
35
- }
36
- useEffect(() => {
37
- return () => {
38
- abortController.abort();
39
- };
40
- }, [abortController]);
41
- const environment = useEnvironment();
42
- useEffect(() => {
43
- if (isMutating || loadState.name !== "initial" || signal.aborted) {
44
- return;
51
+ }, [environment, extendTree, isMutating, loadState.name, props.children, signal]);
52
+ switch (loadState.name) {
53
+ case "initial":
54
+ case "loading":
55
+ return /* @__PURE__ */ jsx(Fragment, { children: props.fallback });
56
+ case "success":
57
+ return /* @__PURE__ */ jsx(TreeRootIdProvider, { treeRootId: loadState.treeRootId, children: props.children });
45
58
  }
46
- setLoadState({
47
- name: "loading"
48
- });
49
- const newFragment = /* @__PURE__ */ jsx(OnlyKeepSubTrees, {
50
- children: props.children
51
- });
52
- extendTree(newFragment, {
53
- signal,
54
- environment
55
- }).then((treeRootId) => !signal.aborted && setLoadState({
56
- name: "success",
57
- treeRootId
58
- })).catch((error) => {
59
- if (signal.aborted) {
60
- return;
59
+ },
60
+ {
61
+ staticRender: (props) => /* @__PURE__ */ jsxs(Fragment, { children: [
62
+ props.children,
63
+ props.fallback
64
+ ] }),
65
+ generateBranchMarker: (props, fields, environment) => {
66
+ const fieldsWithHoistablesMarker = MarkerFactory.createEntityFieldsWithHoistablesMarker(fields, environment);
67
+ fieldsWithHoistablesMarker.subTrees?.clear();
68
+ return fieldsWithHoistablesMarker;
69
+ }
70
+ },
71
+ "DeferredSubTree"
72
+ );
73
+ const OnlyKeepSubTrees = Component(
74
+ () => null,
75
+ {
76
+ generateBranchMarker: (props, fields) => {
77
+ const emptyFields = MarkerFactory.createEntityFieldMarkersContainer(void 0);
78
+ if (fields instanceof EntityFieldMarkersContainer) {
79
+ return emptyFields;
61
80
  }
62
- throw error;
63
- });
64
- }, [environment, extendTree, isMutating, loadState.name, props.children, signal]);
65
- switch (loadState.name) {
66
- case "initial":
67
- case "loading":
68
- return /* @__PURE__ */ jsx(Fragment, {
69
- children: props.fallback
70
- });
71
- case "success":
72
- return /* @__PURE__ */ jsx(TreeRootIdProvider, {
73
- treeRootId: loadState.treeRootId,
74
- children: props.children
75
- });
76
- }
77
- }, {
78
- staticRender: (props) => /* @__PURE__ */ jsxs(Fragment, {
79
- children: [props.children, props.fallback]
80
- }),
81
- generateBranchMarker: (props, fields, environment) => {
82
- const fieldsWithHoistablesMarker = MarkerFactory.createEntityFieldsWithHoistablesMarker(fields, environment);
83
- fieldsWithHoistablesMarker.subTrees?.clear();
84
- return fieldsWithHoistablesMarker;
85
- }
86
- }, "DeferredSubTree");
87
- const OnlyKeepSubTrees = Component(() => null, {
88
- generateBranchMarker: (props, fields) => {
89
- const emptyFields = MarkerFactory.createEntityFieldMarkersContainer(void 0);
90
- if (fields instanceof EntityFieldMarkersContainer) {
91
- return emptyFields;
81
+ return new EntityFieldsWithHoistablesMarker(emptyFields, fields.subTrees, void 0);
92
82
  }
93
- return new EntityFieldsWithHoistablesMarker(emptyFields, fields.subTrees, void 0);
94
- }
95
- }, "OnlyKeepSubTrees");
83
+ },
84
+ "OnlyKeepSubTrees"
85
+ );
96
86
  export {
97
87
  DeferredSubTrees
98
88
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DeferredSubTrees.js","sources":["../../../src/helperComponents/DeferredSubTrees.tsx"],"sourcesContent":["import { ReactNode, useCallback, useEffect, useState } from 'react'\nimport { TreeRootIdProvider, useBindingOperations, useHasEntity, useEnvironment } from '../accessorPropagation'\nimport { useMutationState } from '../accessorTree'\nimport { Component } from '../coreComponents'\nimport { useEntityBeforePersist } from '../entityEvents'\nimport { EntityFieldMarkersContainer, EntityFieldsWithHoistablesMarker } from '../markers'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { TreeRootId } from '../treeParameters'\nimport { useConstantValueInvariant } from '@contember/react-utils'\nimport { EntityAccessor } from '../accessors'\n\nexport interface DeferredSubTreesProps {\n\tfallback: ReactNode\n\tchildren: ReactNode\n}\n\ntype LoadState =\n\t| { name: 'initial' }\n\t| { name: 'loading' }\n\t| {\n\t\t\tname: 'success'\n\t\t\ttreeRootId: TreeRootId | undefined\n\t }\n\nexport const DeferredSubTrees = Component<DeferredSubTreesProps>(\n\tprops => {\n\t\tconst { extendTree } = useBindingOperations()\n\t\tconst isMutating = useMutationState()\n\n\t\tconst [loadState, setLoadState] = useState<LoadState>({ name: 'initial' })\n\n\t\tconst [abortController] = useState(() => new AbortController())\n\t\tconst signal = abortController.signal\n\n\t\tconst hasEntity = useHasEntity()\n\t\tuseConstantValueInvariant(hasEntity)\n\t\tif (hasEntity) {\n\t\t\tuseEntityBeforePersist(\n\t\t\t\tuseCallback((getAccessor: EntityAccessor.GetEntityAccessor) => {\n\t\t\t\t\t// This is a hack. We're really just circumventing the change of ids after a creation so that nested\n\t\t\t\t\t// components don't error.\n\t\t\t\t\tif (getAccessor().existsOnServer) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tsetLoadState({ name: 'initial' })\n\t\t\t\t}, []),\n\t\t\t)\n\t\t}\n\n\t\tuseEffect(() => {\n\t\t\treturn () => {\n\t\t\t\tabortController.abort()\n\t\t\t}\n\t\t}, [abortController])\n\n\t\tconst environment = useEnvironment()\n\t\tuseEffect(() => {\n\t\t\tif (isMutating || loadState.name !== 'initial' || signal.aborted) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsetLoadState({ name: 'loading' })\n\n\t\t\tconst newFragment = <OnlyKeepSubTrees>{props.children}</OnlyKeepSubTrees>\n\n\t\t\textendTree(newFragment, { signal, environment })\n\t\t\t\t.then(treeRootId => !signal.aborted && setLoadState({ name: 'success', treeRootId }))\n\t\t\t\t.catch(error => {\n\t\t\t\t\tif (signal.aborted) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t})\n\t\t}, [environment, extendTree, isMutating, loadState.name, props.children, signal])\n\n\t\tswitch (loadState.name) {\n\t\t\tcase 'initial':\n\t\t\tcase 'loading':\n\t\t\t\treturn <>{props.fallback}</>\n\t\t\tcase 'success':\n\t\t\t\t// This is tricky. The relations & fields within children will just render normally as if this\n\t\t\t\t// component didn't exist. The sub trees, however, will read the new treeRootId and draw their data\n\t\t\t\t// from the newly loaded batch provided by this component. That way the sub trees (and only the sub trees!)\n\t\t\t\t// effectively get lazy loaded.\n\t\t\t\treturn <TreeRootIdProvider treeRootId={loadState.treeRootId}>{props.children}</TreeRootIdProvider>\n\t\t}\n\t},\n\t{\n\t\tstaticRender: props => (\n\t\t\t<>\n\t\t\t\t{props.children}\n\t\t\t\t{props.fallback}\n\t\t\t</>\n\t\t),\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tconst fieldsWithHoistablesMarker = MarkerFactory.createEntityFieldsWithHoistablesMarker(fields, environment)\n\n\t\t\t// We want to get rid of the subTrees but leave whatever relations and fields are present.\n\t\t\t//\n\t\t\t// Mutating from here is fine since we've literally just created it and no other code could possibly possess\n\t\t\t// a reference to this.\n\t\t\tfieldsWithHoistablesMarker.subTrees?.clear()\n\n\t\t\treturn fieldsWithHoistablesMarker\n\t\t},\n\t},\n\t'DeferredSubTree',\n)\n\nconst OnlyKeepSubTrees = Component<{ children: ReactNode }>(\n\t() => null,\n\t{\n\t\tgenerateBranchMarker: (props, fields) => {\n\t\t\t// This is the complement of the equivalent method above: this time we're only keeping the sub trees.\n\t\t\tconst emptyFields = MarkerFactory.createEntityFieldMarkersContainer(undefined)\n\n\t\t\tif (fields instanceof EntityFieldMarkersContainer) {\n\t\t\t\treturn emptyFields\n\t\t\t}\n\t\t\treturn new EntityFieldsWithHoistablesMarker(emptyFields, fields.subTrees, undefined)\n\t\t},\n\t},\n\t'OnlyKeepSubTrees',\n)\n"],"names":["DeferredSubTrees","Component","props","extendTree","useBindingOperations","isMutating","useMutationState","loadState","setLoadState","useState","name","abortController","AbortController","signal","hasEntity","useHasEntity","useConstantValueInvariant","useCallback","getAccessor","existsOnServer","useEffect","abort","environment","useEnvironment","aborted","newFragment","children","then","treeRootId","catch","error","_Fragment","fallback","staticRender","_jsxs","generateBranchMarker","fields","fieldsWithHoistablesMarker","MarkerFactory","createEntityFieldsWithHoistablesMarker","subTrees","clear","OnlyKeepSubTrees","emptyFields","createEntityFieldMarkersContainer","undefined","EntityFieldMarkersContainer","EntityFieldsWithHoistablesMarker"],"mappings":";;;;;;;;;;;;;AAwBaA,MAAAA,mBAAmBC,UAC/BC,CAAS,UAAA;AACF,QAAA;AAAA,IAAEC;AAAAA,MAAeC,qBAAsB;AAC7C,QAAMC,aAAaC;AAEnB,QAAM,CAACC,WAAWC,YAAY,IAAIC,SAAoB;AAAA,IAAEC,MAAM;AAAA,EAAA,CAAW;AAEzE,QAAM,CAACC,eAAe,IAAIF,SAAS,MAAM,IAAIG,gBAAiB,CAAA;AAC9D,QAAMC,SAASF,gBAAgBE;AAE/B,QAAMC,YAAYC;AAClBC,4BAA0BF,SAAS;AACnC,MAAIA,WAAW;AAEbG,2BAAAA,YAAY,CAACC,gBAAkD;AAG1DA,UAAAA,cAAcC,gBAAgB;AACjC;AAAA,MACD;AACa,mBAAA;AAAA,QAAET,MAAM;AAAA,MAAA,CAAW;AAAA,IAAA,GAC9B,CAAA,CAAE,CAAC;AAAA,EAER;AAEAU,YAAU,MAAM;AACf,WAAO,MAAM;AACZT,sBAAgBU,MAAO;AAAA,IAAA;AAAA,EACxB,GACE,CAACV,eAAe,CAAC;AAEpB,QAAMW,cAAcC;AACpBH,YAAU,MAAM;AACf,QAAIf,cAAcE,UAAUG,SAAS,aAAaG,OAAOW,SAAS;AACjE;AAAA,IACD;AACa,iBAAA;AAAA,MAAEd,MAAM;AAAA,IAAA,CAAW;AAE1Be,UAAAA,kCAAe,kBAAgB;AAAA,MAAA,UAAEvB,MAAMwB;AAAAA,IAAAA,CAA4B;AAEzEvB,eAAWsB,aAAa;AAAA,MAAEZ;AAAAA,MAAQS;AAAAA,IAAAA,CAAa,EAC7CK,KAAKC,gBAAc,CAACf,OAAOW,WAAWhB,aAAa;AAAA,MAAEE,MAAM;AAAA,MAAWkB;AAAAA,IAAAA,CAAY,CAAC,EACnFC,MAAMC,CAAS,UAAA;AACf,UAAIjB,OAAOW,SAAS;AACnB;AAAA,MACD;AACMM,YAAAA;AAAAA,IAAAA,CACN;AAAA,EAAA,GACA,CAACR,aAAanB,YAAYE,YAAYE,UAAUG,MAAMR,MAAMwB,UAAUb,MAAM,CAAC;AAEhF,UAAQN,UAAUG;AAAAA,SACZ;AAAA,SACA;AACJ,iCAAOqB,UAAA;AAAA,QAAA,UAAG7B,MAAM8B;AAAAA,MAAAA,CAAY;AAAA,SACxB;AAKJ,iCAAQ,oBAAkB;AAAA,QAAC,YAAYzB,UAAUqB;AAAAA,QAAW,UAAE1B,MAAMwB;AAAAA,MAAAA,CAA8B;AAAA;AAErG,GACA;AAAA,EACCO,cAAc/B,CACb,UAAAgC,qBAAAH,UAAA;AAAA,IAAA,UAAA,CACE7B,MAAMwB,UACNxB,MAAM8B,QAAQ;AAAA,EAAA,CAEhB;AAAA,EACDG,sBAAsB,CAACjC,OAAOkC,QAAQd,gBAAgB;AACrD,UAAMe,6BAA6BC,cAAcC,uCAAuCH,QAAQd,WAAW;AAM3Ge,+BAA2BG,UAAUC;AAE9BJ,WAAAA;AAAAA,EACR;AACD,GACA,iBAAiB;AAGlB,MAAMK,mBAAmBzC,UACxB,MAAM,MACN;AAAA,EACCkC,sBAAsB,CAACjC,OAAOkC,WAAW;AAElCO,UAAAA,cAAcL,cAAcM,kCAAkCC,MAAS;AAE7E,QAAIT,kBAAkBU,6BAA6B;AAC3CH,aAAAA;AAAAA,IACR;AACA,WAAO,IAAII,iCAAiCJ,aAAaP,OAAOI,UAAUK,MAAS;AAAA,EACpF;AACD,GACA,kBAAkB;"}
1
+ {"version":3,"file":"DeferredSubTrees.js","sources":["../../../src/helperComponents/DeferredSubTrees.tsx"],"sourcesContent":["import { ReactNode, useCallback, useEffect, useState } from 'react'\nimport { TreeRootIdProvider, useBindingOperations, useHasEntity, useEnvironment } from '../accessorPropagation'\nimport { useMutationState } from '../accessorTree'\nimport { Component } from '../coreComponents'\nimport { useEntityBeforePersist } from '../entityEvents'\nimport { EntityFieldMarkersContainer, EntityFieldsWithHoistablesMarker } from '../markers'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { TreeRootId } from '../treeParameters'\nimport { useConstantValueInvariant } from '@contember/react-utils'\nimport { EntityAccessor } from '../accessors'\n\nexport interface DeferredSubTreesProps {\n\tfallback: ReactNode\n\tchildren: ReactNode\n}\n\ntype LoadState =\n\t| { name: 'initial' }\n\t| { name: 'loading' }\n\t| {\n\t\t\tname: 'success'\n\t\t\ttreeRootId: TreeRootId | undefined\n\t }\n\nexport const DeferredSubTrees = Component<DeferredSubTreesProps>(\n\tprops => {\n\t\tconst { extendTree } = useBindingOperations()\n\t\tconst isMutating = useMutationState()\n\n\t\tconst [loadState, setLoadState] = useState<LoadState>({ name: 'initial' })\n\n\t\tconst [abortController] = useState(() => new AbortController())\n\t\tconst signal = abortController.signal\n\n\t\tconst hasEntity = useHasEntity()\n\t\tuseConstantValueInvariant(hasEntity)\n\t\tif (hasEntity) {\n\t\t\tuseEntityBeforePersist(\n\t\t\t\tuseCallback((getAccessor: EntityAccessor.GetEntityAccessor) => {\n\t\t\t\t\t// This is a hack. We're really just circumventing the change of ids after a creation so that nested\n\t\t\t\t\t// components don't error.\n\t\t\t\t\tif (getAccessor().existsOnServer) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tsetLoadState({ name: 'initial' })\n\t\t\t\t}, []),\n\t\t\t)\n\t\t}\n\n\t\tuseEffect(() => {\n\t\t\treturn () => {\n\t\t\t\tabortController.abort()\n\t\t\t}\n\t\t}, [abortController])\n\n\t\tconst environment = useEnvironment()\n\t\tuseEffect(() => {\n\t\t\tif (isMutating || loadState.name !== 'initial' || signal.aborted) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsetLoadState({ name: 'loading' })\n\n\t\t\tconst newFragment = <OnlyKeepSubTrees>{props.children}</OnlyKeepSubTrees>\n\n\t\t\textendTree(newFragment, { signal, environment })\n\t\t\t\t.then(treeRootId => !signal.aborted && setLoadState({ name: 'success', treeRootId }))\n\t\t\t\t.catch(error => {\n\t\t\t\t\tif (signal.aborted) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t})\n\t\t}, [environment, extendTree, isMutating, loadState.name, props.children, signal])\n\n\t\tswitch (loadState.name) {\n\t\t\tcase 'initial':\n\t\t\tcase 'loading':\n\t\t\t\treturn <>{props.fallback}</>\n\t\t\tcase 'success':\n\t\t\t\t// This is tricky. The relations & fields within children will just render normally as if this\n\t\t\t\t// component didn't exist. The sub trees, however, will read the new treeRootId and draw their data\n\t\t\t\t// from the newly loaded batch provided by this component. That way the sub trees (and only the sub trees!)\n\t\t\t\t// effectively get lazy loaded.\n\t\t\t\treturn <TreeRootIdProvider treeRootId={loadState.treeRootId}>{props.children}</TreeRootIdProvider>\n\t\t}\n\t},\n\t{\n\t\tstaticRender: props => (\n\t\t\t<>\n\t\t\t\t{props.children}\n\t\t\t\t{props.fallback}\n\t\t\t</>\n\t\t),\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tconst fieldsWithHoistablesMarker = MarkerFactory.createEntityFieldsWithHoistablesMarker(fields, environment)\n\n\t\t\t// We want to get rid of the subTrees but leave whatever relations and fields are present.\n\t\t\t//\n\t\t\t// Mutating from here is fine since we've literally just created it and no other code could possibly possess\n\t\t\t// a reference to this.\n\t\t\tfieldsWithHoistablesMarker.subTrees?.clear()\n\n\t\t\treturn fieldsWithHoistablesMarker\n\t\t},\n\t},\n\t'DeferredSubTree',\n)\n\nconst OnlyKeepSubTrees = Component<{ children: ReactNode }>(\n\t() => null,\n\t{\n\t\tgenerateBranchMarker: (props, fields) => {\n\t\t\t// This is the complement of the equivalent method above: this time we're only keeping the sub trees.\n\t\t\tconst emptyFields = MarkerFactory.createEntityFieldMarkersContainer(undefined)\n\n\t\t\tif (fields instanceof EntityFieldMarkersContainer) {\n\t\t\t\treturn emptyFields\n\t\t\t}\n\t\t\treturn new EntityFieldsWithHoistablesMarker(emptyFields, fields.subTrees, undefined)\n\t\t},\n\t},\n\t'OnlyKeepSubTrees',\n)\n"],"names":[],"mappings":";;;;;;;;;;;;;AAwBO,MAAM,mBAAmB;AAAA,EAC/B,CAAS,UAAA;AACF,UAAA,EAAE,eAAe;AACvB,UAAM,aAAa;AAEb,UAAA,CAAC,WAAW,YAAY,IAAI,SAAoB,EAAE,MAAM,WAAW;AAEzE,UAAM,CAAC,eAAe,IAAI,SAAS,MAAM,IAAI,gBAAiB,CAAA;AAC9D,UAAM,SAAS,gBAAgB;AAE/B,UAAM,YAAY;AAClB,8BAA0B,SAAS;AACnC,QAAI,WAAW;AACd;AAAA,QACC,YAAY,CAAC,gBAAkD;AAG1D,cAAA,cAAc,gBAAgB;AACjC;AAAA,UACD;AACa,uBAAA,EAAE,MAAM,UAAA,CAAW;AAAA,QACjC,GAAG,EAAE;AAAA,MAAA;AAAA,IAEP;AAEA,cAAU,MAAM;AACf,aAAO,MAAM;AACZ,wBAAgB,MAAM;AAAA,MAAA;AAAA,IACvB,GACE,CAAC,eAAe,CAAC;AAEpB,UAAM,cAAc;AACpB,cAAU,MAAM;AACf,UAAI,cAAc,UAAU,SAAS,aAAa,OAAO,SAAS;AACjE;AAAA,MACD;AACa,mBAAA,EAAE,MAAM,UAAA,CAAW;AAEhC,YAAM,cAAc,oBAAC,kBAAkB,EAAA,UAAA,MAAM,SAAS,CAAA;AAE3C,iBAAA,aAAa,EAAE,QAAQ,YAAa,CAAA,EAC7C,KAAK,gBAAc,CAAC,OAAO,WAAW,aAAa,EAAE,MAAM,WAAW,WAAA,CAAY,CAAC,EACnF,MAAM,CAAS,UAAA;AACf,YAAI,OAAO,SAAS;AACnB;AAAA,QACD;AACM,cAAA;AAAA,MAAA,CACN;AAAA,IAAA,GACA,CAAC,aAAa,YAAY,YAAY,UAAU,MAAM,MAAM,UAAU,MAAM,CAAC;AAEhF,YAAQ,UAAU,MAAM;AAAA,MACvB,KAAK;AAAA,MACL,KAAK;AACG,eAAA,oBAAA,UAAA,EAAG,gBAAM,SAAS,CAAA;AAAA,MAC1B,KAAK;AAKJ,mCAAQ,oBAAmB,EAAA,YAAY,UAAU,YAAa,gBAAM,SAAS,CAAA;AAAA,IAC/E;AAAA,EACD;AAAA,EACA;AAAA,IACC,cAAc,WAEX,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAM,MAAA;AAAA,MACN,MAAM;AAAA,IAAA,GACR;AAAA,IAED,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;AACrD,YAAM,6BAA6B,cAAc,uCAAuC,QAAQ,WAAW;AAM3G,iCAA2B,UAAU;AAE9B,aAAA;AAAA,IACR;AAAA,EACD;AAAA,EACA;AACD;AAEA,MAAM,mBAAmB;AAAA,EACxB,MAAM;AAAA,EACN;AAAA,IACC,sBAAsB,CAAC,OAAO,WAAW;AAElC,YAAA,cAAc,cAAc,kCAAkC,MAAS;AAE7E,UAAI,kBAAkB,6BAA6B;AAC3C,eAAA;AAAA,MACR;AACA,aAAO,IAAI,iCAAiC,aAAa,OAAO,UAAU,MAAS;AAAA,IACpF;AAAA,EACD;AAAA,EACA;AACD;"}
@@ -2,9 +2,7 @@ import { jsx, Fragment } from "react/jsx-runtime";
2
2
  import { useEntity } from "../accessorPropagation/useEntity.js";
3
3
  function EntityView(props) {
4
4
  const entity = "field" in props ? useEntity(props.field) : useEntity();
5
- return /* @__PURE__ */ jsx(Fragment, {
6
- children: props.render(entity)
7
- });
5
+ return /* @__PURE__ */ jsx(Fragment, { children: props.render(entity) });
8
6
  }
9
7
  export {
10
8
  EntityView
@@ -1 +1 @@
1
- {"version":3,"file":"EntityView.js","sources":["../../../src/helperComponents/EntityView.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useEntity } from '../accessorPropagation'\nimport type { EntityAccessor } from '../accessors'\nimport type { SugaredRelativeSingleEntity } from '../treeParameters'\n\nexport interface EntityViewProps {\n\trender: (entity: EntityAccessor) => ReactNode\n\tfield?: string | SugaredRelativeSingleEntity\n}\n\nexport function EntityView(props: EntityViewProps) {\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst entity = 'field' in props ? useEntity(props.field)! : useEntity()\n\n\treturn <>{props.render(entity)}</>\n}\n"],"names":["EntityView","props","entity","useEntity","field","_Fragment","render"],"mappings":";;AAUO,SAASA,WAAWC,OAAwB;AAElD,QAAMC,SAAS,WAAWD,QAAQE,UAAUF,MAAMG,KAAK,IAAKD;AAE5D,6BAAOE,UAAA;AAAA,IAAA,UAAGJ,MAAMK,OAAOJ,MAAM;AAAA,EAAA,CAAK;AACnC;"}
1
+ {"version":3,"file":"EntityView.js","sources":["../../../src/helperComponents/EntityView.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useEntity } from '../accessorPropagation'\nimport type { EntityAccessor } from '../accessors'\nimport type { SugaredRelativeSingleEntity } from '../treeParameters'\n\nexport interface EntityViewProps {\n\trender: (entity: EntityAccessor) => ReactNode\n\tfield?: string | SugaredRelativeSingleEntity\n}\n\nexport function EntityView(props: EntityViewProps) {\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst entity = 'field' in props ? useEntity(props.field)! : useEntity()\n\n\treturn <>{props.render(entity)}</>\n}\n"],"names":[],"mappings":";;AAUO,SAAS,WAAW,OAAwB;AAElD,QAAM,SAAS,WAAW,QAAQ,UAAU,MAAM,KAAK,IAAK;AAE5D,SAAU,oBAAA,UAAA,EAAA,UAAA,MAAM,OAAO,MAAM,EAAE,CAAA;AAChC;"}
@@ -1,41 +1,48 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
1
2
  import { useConstantLengthInvariant, useArrayMapMemo } from "@contember/react-utils";
2
3
  import { useCallback, useMemo } from "react";
3
4
  import { throwBindingError } from "../BindingError.js";
4
5
  import { SugaredField } from "./SugaredField.js";
5
- import { jsxs, Fragment, jsx } from "react/jsx-runtime";
6
6
  import { Component } from "../coreComponents/Component.js";
7
7
  import { useEntity } from "../accessorPropagation/useEntity.js";
8
8
  import { QueryLanguage } from "../queryLanguage/QueryLanguage.js";
9
- const FieldView = Component((props) => {
10
- const {
11
- fallbackIfUnpersisted,
12
- render
13
- } = props;
14
- const fields = "fields" in props && Array.isArray(props.fields) ? props.fields : "field" in props && props.field ? [props.field] : throwBindingError(`FieldView: failed to supply either the 'field' or the 'fields' prop.`);
15
- useConstantLengthInvariant(fields, `The number of fields in the 'fields' prop of the 'FieldView' must remain constant between renders!`);
16
- const entityAccessor = useEntity();
17
- const environment = entityAccessor.environment;
18
- const desugarField = useCallback((rsf) => QueryLanguage.desugarRelativeSingleField(rsf, environment), [environment]);
19
- const desugaredFields = useArrayMapMemo(fields, desugarField);
20
- const retrieveField = useCallback((desugaredRsf) => entityAccessor.getRelativeSingleField(desugaredRsf), [entityAccessor]);
21
- const accessors = useArrayMapMemo(desugaredFields, retrieveField);
22
- const output = useMemo(() => {
23
- if (!entityAccessor.existsOnServer && fallbackIfUnpersisted !== void 0) {
24
- return fallbackIfUnpersisted;
25
- }
26
- return render(...accessors);
27
- }, [accessors, entityAccessor.existsOnServer, fallbackIfUnpersisted, render]);
28
- return /* @__PURE__ */ jsx(Fragment, {
29
- children: output
30
- });
31
- }, (props) => {
32
- const fields = "fields" in props && Array.isArray(props.fields) ? props.fields : "field" in props && props.field ? [props.field] : throwBindingError(`FieldView: failed to supply either the 'field' or the 'fields' prop.`);
33
- return /* @__PURE__ */ jsxs(Fragment, {
34
- children: [props.fallbackIfUnpersisted, fields.map((field, i) => /* @__PURE__ */ jsx(SugaredField, {
35
- field
36
- }, i))]
37
- });
38
- }, "FieldView");
9
+ const FieldView = Component(
10
+ (props) => {
11
+ const { fallbackIfUnpersisted, render } = props;
12
+ const fields = "fields" in props && Array.isArray(props.fields) ? props.fields : "field" in props && props.field ? [props.field] : throwBindingError(`FieldView: failed to supply either the 'field' or the 'fields' prop.`);
13
+ useConstantLengthInvariant(
14
+ fields,
15
+ `The number of fields in the 'fields' prop of the 'FieldView' must remain constant between renders!`
16
+ );
17
+ const entityAccessor = useEntity();
18
+ const environment = entityAccessor.environment;
19
+ const desugarField = useCallback(
20
+ (rsf) => QueryLanguage.desugarRelativeSingleField(rsf, environment),
21
+ [environment]
22
+ );
23
+ const desugaredFields = useArrayMapMemo(fields, desugarField);
24
+ const retrieveField = useCallback(
25
+ (desugaredRsf) => entityAccessor.getRelativeSingleField(desugaredRsf),
26
+ [entityAccessor]
27
+ );
28
+ const accessors = useArrayMapMemo(desugaredFields, retrieveField);
29
+ const output = useMemo(() => {
30
+ if (!entityAccessor.existsOnServer && fallbackIfUnpersisted !== void 0) {
31
+ return fallbackIfUnpersisted;
32
+ }
33
+ return render(...accessors);
34
+ }, [accessors, entityAccessor.existsOnServer, fallbackIfUnpersisted, render]);
35
+ return /* @__PURE__ */ jsx(Fragment, { children: output });
36
+ },
37
+ (props) => {
38
+ const fields = "fields" in props && Array.isArray(props.fields) ? props.fields : "field" in props && props.field ? [props.field] : throwBindingError(`FieldView: failed to supply either the 'field' or the 'fields' prop.`);
39
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
40
+ props.fallbackIfUnpersisted,
41
+ fields.map((field, i) => /* @__PURE__ */ jsx(SugaredField, { field }, i))
42
+ ] });
43
+ },
44
+ "FieldView"
45
+ );
39
46
  export {
40
47
  FieldView
41
48
  };
@@ -1 +1 @@
1
- {"version":3,"file":"FieldView.js","sources":["../../../src/helperComponents/FieldView.tsx"],"sourcesContent":["import { useArrayMapMemo, useConstantLengthInvariant } from '@contember/react-utils'\nimport { ReactElement, ReactNode, useCallback, useMemo } from 'react'\nimport { useEntity } from '../accessorPropagation'\nimport type { FieldAccessor } from '../accessors'\nimport { throwBindingError } from '../BindingError'\nimport { Component } from '../coreComponents'\nimport { QueryLanguage } from '../queryLanguage'\nimport type { FieldValue, RelativeSingleField, SugaredRelativeSingleField } from '../treeParameters'\nimport { SugaredField } from './SugaredField'\n\ninterface FieldViewCommonProps {\n\tfallbackIfUnpersisted?: ReactNode\n}\n\ntype FieldViewProps = FieldViewCommonProps &\n\t(\n\t\t| {\n\t\t\t\trender: (...accessors: FieldAccessor[]) => ReactNode\n\t\t\t\tfield: string | SugaredRelativeSingleField\n\t\t }\n\t\t| {\n\t\t\t\trender: (...accessors: FieldAccessor[]) => ReactNode\n\t\t\t\tfields: Array<string | SugaredRelativeSingleField>\n\t\t }\n\t)\n\n// Just short type aliases so that we can type the overloads in a tractable fashion.\ntype FV = FieldValue\ntype SRSF = string | SugaredRelativeSingleField\ntype CP = FieldViewCommonProps\ntype RN = ReactNode\ntype REN = ReactElement | null\n\nexport const FieldView = Component<FieldViewProps>(\n\tprops => {\n\t\tconst { fallbackIfUnpersisted, render } = props\n\t\tconst fields =\n\t\t\t'fields' in props && Array.isArray(props.fields)\n\t\t\t\t? props.fields\n\t\t\t\t: 'field' in props && props.field\n\t\t\t\t? [props.field]\n\t\t\t\t: throwBindingError(`FieldView: failed to supply either the 'field' or the 'fields' prop.`)\n\n\t\tuseConstantLengthInvariant(\n\t\t\tfields,\n\t\t\t`The number of fields in the 'fields' prop of the 'FieldView' must remain constant between renders!`,\n\t\t)\n\n\t\t// TODO over-subscribe less\n\t\tconst entityAccessor = useEntity()\n\t\tconst environment = entityAccessor.environment\n\n\t\tconst desugarField = useCallback(\n\t\t\t(rsf: SRSF) => QueryLanguage.desugarRelativeSingleField(rsf, environment),\n\t\t\t[environment],\n\t\t)\n\t\tconst desugaredFields = useArrayMapMemo(fields, desugarField)\n\n\t\tconst retrieveField = useCallback(\n\t\t\t(desugaredRsf: RelativeSingleField) => entityAccessor.getRelativeSingleField(desugaredRsf),\n\t\t\t[entityAccessor],\n\t\t)\n\t\tconst accessors = useArrayMapMemo(desugaredFields, retrieveField)\n\n\t\t// TODO we probably want something like useDeferredValue from here.\n\t\t// Will probably just wait for Concurrent React though.\n\t\tconst output = useMemo(() => {\n\t\t\tif (!entityAccessor.existsOnServer && fallbackIfUnpersisted !== undefined) {\n\t\t\t\treturn fallbackIfUnpersisted\n\t\t\t}\n\t\t\treturn render(...accessors)\n\t\t}, [accessors, entityAccessor.existsOnServer, fallbackIfUnpersisted, render])\n\n\t\treturn <>{output}</>\n\t},\n\tprops => {\n\t\tconst fields =\n\t\t\t'fields' in props && Array.isArray(props.fields)\n\t\t\t\t? props.fields\n\t\t\t\t: 'field' in props && props.field\n\t\t\t\t? [props.field]\n\t\t\t\t: throwBindingError(`FieldView: failed to supply either the 'field' or the 'fields' prop.`)\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{props.fallbackIfUnpersisted}\n\t\t\t\t{fields.map((field, i) => (\n\t\t\t\t\t<SugaredField key={i} field={field} />\n\t\t\t\t))}\n\t\t\t</>\n\t\t)\n\t},\n\t'FieldView',\n) as {\n\t<FV1 extends FV>(props: CP & { field: SRSF; render: (field1: FieldAccessor<FV1>) => RN }): REN\n\t<FV1 extends FV>(props: CP & { fields: [SRSF]; render: (field1: FieldAccessor<FV1>) => RN }): REN\n\t<FV1 extends FV, FV2 extends FV>(\n\t\tprops: CP & { fields: [SRSF, SRSF]; render: (field1: FieldAccessor<FV1>, field2: FieldAccessor<FV2>) => RN },\n\t): REN\n\t<FV1 extends FV, FV2 extends FV, FV3 extends FV>(\n\t\tprops: CP & {\n\t\t\tfields: [SRSF, SRSF, SRSF]\n\t\t\trender: (field1: FieldAccessor<FV1>, field2: FieldAccessor<FV2>, field3: FieldAccessor<FV3>) => RN\n\t\t},\n\t): REN\n\t<FV1 extends FV, FV2 extends FV, FV3 extends FV, FV4 extends FV>(\n\t\tprops: CP & {\n\t\t\tfields: [SRSF, SRSF, SRSF, SRSF]\n\t\t\trender: (\n\t\t\t\tfield1: FieldAccessor<FV1>,\n\t\t\t\tfield2: FieldAccessor<FV2>,\n\t\t\t\tfield3: FieldAccessor<FV3>,\n\t\t\t\tfield4: FieldAccessor<FV4>,\n\t\t\t) => RN\n\t\t},\n\t): REN\n\t<FV1 extends FV, FV2 extends FV, FV3 extends FV, FV4 extends FV, FV5 extends FV>(\n\t\tprops: CP & {\n\t\t\tfields: [SRSF, SRSF, SRSF, SRSF, SRSF]\n\t\t\trender: (\n\t\t\t\tfield1: FieldAccessor<FV1>,\n\t\t\t\tfield2: FieldAccessor<FV2>,\n\t\t\t\tfield3: FieldAccessor<FV3>,\n\t\t\t\tfield4: FieldAccessor<FV4>,\n\t\t\t\tfield5: FieldAccessor<FV5>,\n\t\t\t) => RN\n\t\t},\n\t): REN\n\t(props: FieldViewProps): REN\n}\n"],"names":["FieldView","Component","props","fallbackIfUnpersisted","render","fields","Array","isArray","field","throwBindingError","useConstantLengthInvariant","entityAccessor","useEntity","environment","desugarField","useCallback","rsf","QueryLanguage","desugarRelativeSingleField","desugaredFields","useArrayMapMemo","retrieveField","desugaredRsf","getRelativeSingleField","accessors","output","useMemo","existsOnServer","undefined","_Fragment","map","i","_jsx"],"mappings":";;;;;;;;AAiCaA,MAAAA,YAAYC,UACxBC,CAAS,UAAA;AACF,QAAA;AAAA,IAAEC;AAAAA,IAAuBC;AAAAA,EAAWF,IAAAA;AAC1C,QAAMG,SACL,YAAYH,SAASI,MAAMC,QAAQL,MAAMG,MAAM,IAC5CH,MAAMG,SACN,WAAWH,SAASA,MAAMM,QAC1B,CAACN,MAAMM,KAAK,IACZC,kBAAmB,sEAAqE;AAE5FC,6BACCL,QACC,oGAAmG;AAIrG,QAAMM,iBAAiBC;AACvB,QAAMC,cAAcF,eAAeE;AAE7BC,QAAAA,eAAeC,YACpB,CAACC,QAAcC,cAAcC,2BAA2BF,KAAKH,WAAW,GACxE,CAACA,WAAW,CAAC;AAERM,QAAAA,kBAAkBC,gBAAgBf,QAAQS,YAAY;AAEtDO,QAAAA,gBAAgBN,YACrB,CAACO,iBAAsCX,eAAeY,uBAAuBD,YAAY,GACzF,CAACX,cAAc,CAAC;AAEXa,QAAAA,YAAYJ,gBAAgBD,iBAAiBE,aAAa;AAI1DI,QAAAA,SAASC,QAAQ,MAAM;AAC5B,QAAI,CAACf,eAAegB,kBAAkBxB,0BAA0ByB,QAAW;AACnEzB,aAAAA;AAAAA,IACR;AACOC,WAAAA,OAAO,GAAGoB,SAAS;AAAA,EAAA,GACxB,CAACA,WAAWb,eAAegB,gBAAgBxB,uBAAuBC,MAAM,CAAC;AAE5E,6BAAOyB,UAAA;AAAA,IAAA,UAAGJ;AAAAA,EAAAA,CAAU;AACrB,GACAvB,CAAS,UAAA;AACR,QAAMG,SACL,YAAYH,SAASI,MAAMC,QAAQL,MAAMG,MAAM,IAC5CH,MAAMG,SACN,WAAWH,SAASA,MAAMM,QAC1B,CAACN,MAAMM,KAAK,IACZC,kBAAmB,sEAAqE;AAC5F,8BACCoB,UAAA;AAAA,IAAA,UAAA,CACE3B,MAAMC,uBACNE,OAAOyB,IAAI,CAACtB,OAAOuB,MACnBC,oBAAC,cAAY;AAAA,MAAS;AAAA,IAAA,GAAHD,CAAC,CACpB,CAAC;AAAA,EAAA,CACA;AAEL,GACA,WAAW;"}
1
+ {"version":3,"file":"FieldView.js","sources":["../../../src/helperComponents/FieldView.tsx"],"sourcesContent":["import { useArrayMapMemo, useConstantLengthInvariant } from '@contember/react-utils'\nimport { ReactElement, ReactNode, useCallback, useMemo } from 'react'\nimport { useEntity } from '../accessorPropagation'\nimport type { FieldAccessor } from '../accessors'\nimport { throwBindingError } from '../BindingError'\nimport { Component } from '../coreComponents'\nimport { QueryLanguage } from '../queryLanguage'\nimport type { FieldValue, RelativeSingleField, SugaredRelativeSingleField } from '../treeParameters'\nimport { SugaredField } from './SugaredField'\n\ninterface FieldViewCommonProps {\n\tfallbackIfUnpersisted?: ReactNode\n}\n\ntype FieldViewProps = FieldViewCommonProps &\n\t(\n\t\t| {\n\t\t\t\trender: (...accessors: FieldAccessor[]) => ReactNode\n\t\t\t\tfield: string | SugaredRelativeSingleField\n\t\t }\n\t\t| {\n\t\t\t\trender: (...accessors: FieldAccessor[]) => ReactNode\n\t\t\t\tfields: Array<string | SugaredRelativeSingleField>\n\t\t }\n\t)\n\n// Just short type aliases so that we can type the overloads in a tractable fashion.\ntype FV = FieldValue\ntype SRSF = string | SugaredRelativeSingleField\ntype CP = FieldViewCommonProps\ntype RN = ReactNode\ntype REN = ReactElement | null\n\nexport const FieldView = Component<FieldViewProps>(\n\tprops => {\n\t\tconst { fallbackIfUnpersisted, render } = props\n\t\tconst fields =\n\t\t\t'fields' in props && Array.isArray(props.fields)\n\t\t\t\t? props.fields\n\t\t\t\t: 'field' in props && props.field\n\t\t\t\t? [props.field]\n\t\t\t\t: throwBindingError(`FieldView: failed to supply either the 'field' or the 'fields' prop.`)\n\n\t\tuseConstantLengthInvariant(\n\t\t\tfields,\n\t\t\t`The number of fields in the 'fields' prop of the 'FieldView' must remain constant between renders!`,\n\t\t)\n\n\t\t// TODO over-subscribe less\n\t\tconst entityAccessor = useEntity()\n\t\tconst environment = entityAccessor.environment\n\n\t\tconst desugarField = useCallback(\n\t\t\t(rsf: SRSF) => QueryLanguage.desugarRelativeSingleField(rsf, environment),\n\t\t\t[environment],\n\t\t)\n\t\tconst desugaredFields = useArrayMapMemo(fields, desugarField)\n\n\t\tconst retrieveField = useCallback(\n\t\t\t(desugaredRsf: RelativeSingleField) => entityAccessor.getRelativeSingleField(desugaredRsf),\n\t\t\t[entityAccessor],\n\t\t)\n\t\tconst accessors = useArrayMapMemo(desugaredFields, retrieveField)\n\n\t\t// TODO we probably want something like useDeferredValue from here.\n\t\t// Will probably just wait for Concurrent React though.\n\t\tconst output = useMemo(() => {\n\t\t\tif (!entityAccessor.existsOnServer && fallbackIfUnpersisted !== undefined) {\n\t\t\t\treturn fallbackIfUnpersisted\n\t\t\t}\n\t\t\treturn render(...accessors)\n\t\t}, [accessors, entityAccessor.existsOnServer, fallbackIfUnpersisted, render])\n\n\t\treturn <>{output}</>\n\t},\n\tprops => {\n\t\tconst fields =\n\t\t\t'fields' in props && Array.isArray(props.fields)\n\t\t\t\t? props.fields\n\t\t\t\t: 'field' in props && props.field\n\t\t\t\t? [props.field]\n\t\t\t\t: throwBindingError(`FieldView: failed to supply either the 'field' or the 'fields' prop.`)\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{props.fallbackIfUnpersisted}\n\t\t\t\t{fields.map((field, i) => (\n\t\t\t\t\t<SugaredField key={i} field={field} />\n\t\t\t\t))}\n\t\t\t</>\n\t\t)\n\t},\n\t'FieldView',\n) as {\n\t<FV1 extends FV>(props: CP & { field: SRSF; render: (field1: FieldAccessor<FV1>) => RN }): REN\n\t<FV1 extends FV>(props: CP & { fields: [SRSF]; render: (field1: FieldAccessor<FV1>) => RN }): REN\n\t<FV1 extends FV, FV2 extends FV>(\n\t\tprops: CP & { fields: [SRSF, SRSF]; render: (field1: FieldAccessor<FV1>, field2: FieldAccessor<FV2>) => RN },\n\t): REN\n\t<FV1 extends FV, FV2 extends FV, FV3 extends FV>(\n\t\tprops: CP & {\n\t\t\tfields: [SRSF, SRSF, SRSF]\n\t\t\trender: (field1: FieldAccessor<FV1>, field2: FieldAccessor<FV2>, field3: FieldAccessor<FV3>) => RN\n\t\t},\n\t): REN\n\t<FV1 extends FV, FV2 extends FV, FV3 extends FV, FV4 extends FV>(\n\t\tprops: CP & {\n\t\t\tfields: [SRSF, SRSF, SRSF, SRSF]\n\t\t\trender: (\n\t\t\t\tfield1: FieldAccessor<FV1>,\n\t\t\t\tfield2: FieldAccessor<FV2>,\n\t\t\t\tfield3: FieldAccessor<FV3>,\n\t\t\t\tfield4: FieldAccessor<FV4>,\n\t\t\t) => RN\n\t\t},\n\t): REN\n\t<FV1 extends FV, FV2 extends FV, FV3 extends FV, FV4 extends FV, FV5 extends FV>(\n\t\tprops: CP & {\n\t\t\tfields: [SRSF, SRSF, SRSF, SRSF, SRSF]\n\t\t\trender: (\n\t\t\t\tfield1: FieldAccessor<FV1>,\n\t\t\t\tfield2: FieldAccessor<FV2>,\n\t\t\t\tfield3: FieldAccessor<FV3>,\n\t\t\t\tfield4: FieldAccessor<FV4>,\n\t\t\t\tfield5: FieldAccessor<FV5>,\n\t\t\t) => RN\n\t\t},\n\t): REN\n\t(props: FieldViewProps): REN\n}\n"],"names":[],"mappings":";;;;;;;;AAiCO,MAAM,YAAY;AAAA,EACxB,CAAS,UAAA;AACF,UAAA,EAAE,uBAAuB,OAAW,IAAA;AAC1C,UAAM,SACL,YAAY,SAAS,MAAM,QAAQ,MAAM,MAAM,IAC5C,MAAM,SACN,WAAW,SAAS,MAAM,QAC1B,CAAC,MAAM,KAAK,IACZ,kBAAkB,sEAAsE;AAE5F;AAAA,MACC;AAAA,MACA;AAAA,IAAA;AAID,UAAM,iBAAiB;AACvB,UAAM,cAAc,eAAe;AAEnC,UAAM,eAAe;AAAA,MACpB,CAAC,QAAc,cAAc,2BAA2B,KAAK,WAAW;AAAA,MACxE,CAAC,WAAW;AAAA,IAAA;AAEP,UAAA,kBAAkB,gBAAgB,QAAQ,YAAY;AAE5D,UAAM,gBAAgB;AAAA,MACrB,CAAC,iBAAsC,eAAe,uBAAuB,YAAY;AAAA,MACzF,CAAC,cAAc;AAAA,IAAA;AAEV,UAAA,YAAY,gBAAgB,iBAAiB,aAAa;AAI1D,UAAA,SAAS,QAAQ,MAAM;AAC5B,UAAI,CAAC,eAAe,kBAAkB,0BAA0B,QAAW;AACnE,eAAA;AAAA,MACR;AACO,aAAA,OAAO,GAAG,SAAS;AAAA,IAAA,GACxB,CAAC,WAAW,eAAe,gBAAgB,uBAAuB,MAAM,CAAC;AAE5E,2CAAU,UAAO,OAAA,CAAA;AAAA,EAClB;AAAA,EACA,CAAS,UAAA;AACR,UAAM,SACL,YAAY,SAAS,MAAM,QAAQ,MAAM,MAAM,IAC5C,MAAM,SACN,WAAW,SAAS,MAAM,QAC1B,CAAC,MAAM,KAAK,IACZ,kBAAkB,sEAAsE;AAC5F,WAEG,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAM,MAAA;AAAA,MACN,OAAO,IAAI,CAAC,OAAO,MAClB,oBAAA,cAAA,EAAqB,SAAH,CAAiB,CACpC;AAAA,IACF,EAAA,CAAA;AAAA,EAEF;AAAA,EACA;AACD;"}
@@ -1,63 +1,51 @@
1
+ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
1
2
  import { useMemo } from "react";
2
3
  import { FilterFieldsCollector } from "./helpers/FilterFieldsCollector.js";
3
4
  import { FilterEvaluator } from "./helpers/FilterEvaluator.js";
4
- import { jsx, Fragment, jsxs } from "react/jsx-runtime";
5
5
  import { Field } from "../coreComponents/Field.js";
6
6
  import { Component } from "../coreComponents/Component.js";
7
7
  import { useEntity } from "../accessorPropagation/useEntity.js";
8
8
  import { QueryLanguage } from "../queryLanguage/QueryLanguage.js";
9
9
  import { useEnvironment } from "../accessorPropagation/useEnvironment.js";
10
- const If = Component((props) => {
11
- return typeof props.condition !== "function" ? /* @__PURE__ */ jsx(IfFilter, {
12
- condition: props.condition,
13
- children: props.children
14
- }) : /* @__PURE__ */ jsx(IfCallback, {
15
- condition: props.condition,
16
- children: props.children
17
- });
18
- }, "If");
19
- const IfCallback = Component(({
20
- children,
21
- condition
22
- }) => {
23
- const entity = useEntity();
24
- const evaluated = useMemo(() => condition(entity), [condition, entity]);
25
- return evaluated ? /* @__PURE__ */ jsx(Fragment, {
26
- children
27
- }) : null;
28
- }, ({
29
- children
30
- }) => {
31
- return /* @__PURE__ */ jsx(Fragment, {
32
- children
33
- });
34
- }, "IfCallback");
35
- const IfFilter = Component(({
36
- children,
37
- condition
38
- }) => {
39
- const env = useEnvironment();
40
- const entity = useEntity();
41
- const schema = env.getSchema();
42
- const evaluated = useMemo(() => new FilterEvaluator(schema).evaluateFilter(entity, QueryLanguage.desugarFilter(condition, env)), [condition, entity, env, schema]);
43
- return evaluated ? /* @__PURE__ */ jsx(Fragment, {
44
- children
45
- }) : null;
46
- }, ({
47
- children,
48
- condition
49
- }, env) => {
50
- const desugaredFilter = QueryLanguage.desugarFilter(condition, env);
51
- const collectedFields = new FilterFieldsCollector(env.getSchema(), desugaredFilter).collectFields(env.getSubTreeNode().entity);
52
- const additionalFields = /* @__PURE__ */ jsx(Fragment, {
53
- children: Array.from(collectedFields).map((it) => /* @__PURE__ */ jsx(Field, {
54
- field: it
55
- }, it))
56
- });
57
- return /* @__PURE__ */ jsxs(Fragment, {
58
- children: [additionalFields, children]
59
- });
60
- }, "IfFilter");
10
+ const If = Component(
11
+ (props) => {
12
+ return typeof props.condition !== "function" ? /* @__PURE__ */ jsx(IfFilter, { condition: props.condition, children: props.children }) : /* @__PURE__ */ jsx(IfCallback, { condition: props.condition, children: props.children });
13
+ },
14
+ "If"
15
+ );
16
+ const IfCallback = Component(
17
+ ({ children, condition }) => {
18
+ const entity = useEntity();
19
+ const evaluated = useMemo(() => condition(entity), [condition, entity]);
20
+ return evaluated ? /* @__PURE__ */ jsx(Fragment, { children }) : null;
21
+ },
22
+ ({ children }) => {
23
+ return /* @__PURE__ */ jsx(Fragment, { children });
24
+ },
25
+ "IfCallback"
26
+ );
27
+ const IfFilter = Component(
28
+ ({ children, condition }) => {
29
+ const env = useEnvironment();
30
+ const entity = useEntity();
31
+ const schema = env.getSchema();
32
+ const evaluated = useMemo(
33
+ () => new FilterEvaluator(schema).evaluateFilter(entity, QueryLanguage.desugarFilter(condition, env)),
34
+ [condition, entity, env, schema]
35
+ );
36
+ return evaluated ? /* @__PURE__ */ jsx(Fragment, { children }) : null;
37
+ },
38
+ ({ children, condition }, env) => {
39
+ const desugaredFilter = QueryLanguage.desugarFilter(condition, env);
40
+ const collectedFields = new FilterFieldsCollector(env.getSchema(), desugaredFilter).collectFields(env.getSubTreeNode().entity);
41
+ const additionalFields = /* @__PURE__ */ jsx(Fragment, { children: Array.from(collectedFields).map((it) => /* @__PURE__ */ jsx(Field, { field: it }, it)) });
42
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
43
+ additionalFields,
44
+ children
45
+ ] });
46
+ },
47
+ "IfFilter"
48
+ );
61
49
  export {
62
50
  If
63
51
  };
@@ -1 +1 @@
1
- {"version":3,"file":"If.js","sources":["../../../src/helperComponents/If.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useMemo } from 'react'\nimport { Component, Field } from '../coreComponents'\nimport { EntityAccessor } from '../accessors'\nimport { QueryLanguage } from '../queryLanguage'\nimport { useEntity, useEnvironment } from '../accessorPropagation'\nimport { Filter } from '../treeParameters'\nimport { FilterFieldsCollector } from './helpers/FilterFieldsCollector'\nimport { FilterEvaluator } from './helpers/FilterEvaluator'\n\nexport type IfProps =\n\t| IfFilterProps\n\t| IfCallbackProps\n\nexport interface IfFilterProps {\n\tcondition: string | Filter\n\tchildren?: ReactNode\n}\n\nexport interface IfCallbackProps {\n\tcondition: (accessor: EntityAccessor) => boolean\n\tchildren?: ReactNode\n}\n\nexport const If = Component<IfProps>(props => {\n\t\treturn typeof props.condition !== 'function'\n\t\t\t? <IfFilter condition={props.condition}>{props.children}</IfFilter>\n\t\t\t: <IfCallback condition={props.condition}>{props.children}</IfCallback>\n\t},\n\t'If',\n)\n\nconst IfCallback = Component<IfCallbackProps>(\n\t({ children, condition }) => {\n\t\tconst entity = useEntity()\n\t\tconst evaluated = useMemo(() => condition(entity), [condition, entity])\n\n\t\treturn evaluated ? <>{children}</> : null\n\t},\n\t({ children }) => {\n\t\treturn <>{children}</>\n\t},\n\t'IfCallback',\n)\n\nconst IfFilter = Component<IfFilterProps>(\n\t({ children, condition }) => {\n\t\tconst env = useEnvironment()\n\t\tconst entity = useEntity()\n\n\t\tconst schema = env.getSchema()\n\t\tconst evaluated = useMemo(\n\t\t\t() => new FilterEvaluator(schema).evaluateFilter(entity, QueryLanguage.desugarFilter(condition, env)),\n\t\t\t[condition, entity, env, schema],\n\t\t)\n\n\t\treturn evaluated ? <>{children}</> : null\n\t},\n\t({ children, condition }, env) => {\n\t\tconst desugaredFilter = QueryLanguage.desugarFilter(condition, env)\n\t\tconst collectedFields = new FilterFieldsCollector(env.getSchema(), desugaredFilter).collectFields(env.getSubTreeNode().entity)\n\t\tconst additionalFields = <>{Array.from(collectedFields).map(it => <Field field={it} key={it} />)}</>\n\n\t\treturn <>\n\t\t\t{additionalFields}\n\t\t\t{children}\n\t\t</>\n\t},\n\t'IfFilter',\n)\n\n"],"names":["If","Component","props","condition","children","_jsx","IfCallback","entity","useEntity","evaluated","useMemo","_Fragment","IfFilter","env","useEnvironment","schema","getSchema","FilterEvaluator","evaluateFilter","QueryLanguage","desugarFilter","desugaredFilter","collectedFields","FilterFieldsCollector","collectFields","getSubTreeNode","additionalFields","Array","from","map","it"],"mappings":";;;;;;;;;AAwBaA,MAAAA,KAAKC,UAAmBC,CAAS,UAAA;AAC5C,SAAO,OAAOA,MAAMC,cAAc,iCAC9B,UAAQ;AAAA,IAAC,WAAWD,MAAMC;AAAAA,IAAU,UAAED,MAAME;AAAAA,EAAAA,CAAoB,IACjEC,oBAAC,YAAU;AAAA,IAAC,WAAWH,MAAMC;AAAAA,IAAU,UAAED,MAAME;AAAAA,EAAAA,CAAsB;AACzE,GACA,IAAI;AAGL,MAAME,aAAaL,UAClB,CAAC;AAAA,EAAEG;AAAAA,EAAUD;AAAU,MAAM;AAC5B,QAAMI,SAASC;AACTC,QAAAA,YAAYC,QAAQ,MAAMP,UAAUI,MAAM,GAAG,CAACJ,WAAWI,MAAM,CAAC;AAE/DE,SAAAA,gCAAYE,UAAA;AAAA,IAAA;AAAA,EAAW,CAAA,IAAO;AACtC,GACA,CAAC;AAAA,EAAEP;AAAS,MAAM;AACjB,6BAAOO,UAAA;AAAA,IAAA;AAAA,EAAA,CAAe;AACvB,GACA,YAAY;AAGb,MAAMC,WAAWX,UAChB,CAAC;AAAA,EAAEG;AAAAA,EAAUD;AAAU,MAAM;AAC5B,QAAMU,MAAMC;AACZ,QAAMP,SAASC;AAETO,QAAAA,SAASF,IAAIG;AACbP,QAAAA,YAAYC,QACjB,MAAM,IAAIO,gBAAgBF,MAAM,EAAEG,eAAeX,QAAQY,cAAcC,cAAcjB,WAAWU,GAAG,CAAC,GACpG,CAACV,WAAWI,QAAQM,KAAKE,MAAM,CAAC;AAG1BN,SAAAA,gCAAYE,UAAA;AAAA,IAAA;AAAA,EAAW,CAAA,IAAO;AACtC,GACA,CAAC;AAAA,EAAEP;AAAAA,EAAUD;AAAU,GAAGU,QAAQ;AACjC,QAAMQ,kBAAkBF,cAAcC,cAAcjB,WAAWU,GAAG;AAClE,QAAMS,kBAAkB,IAAIC,sBAAsBV,IAAIG,UAAW,GAAEK,eAAe,EAAEG,cAAcX,IAAIY,eAAc,EAAGlB,MAAM;AACvHmB,QAAAA,uCAAmBf,UAAA;AAAA,IAAA,UAAGgB,MAAMC,KAAKN,eAAe,EAAEO,IAAIC,CAAAA,2BAAO,OAAK;AAAA,MAAC,OAAOA;AAAAA,IAAG,GAAMA,EAAE,CAAI;AAAA,EAAA,CAAK;AAEpG,8BAAOnB,UAAA;AAAA,IAAA,UACLe,CAAAA,kBACAtB,QAAQ;AAAA,EAAA,CACP;AACJ,GACA,UAAU;"}
1
+ {"version":3,"file":"If.js","sources":["../../../src/helperComponents/If.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useMemo } from 'react'\nimport { Component, Field } from '../coreComponents'\nimport { EntityAccessor } from '../accessors'\nimport { QueryLanguage } from '../queryLanguage'\nimport { useEntity, useEnvironment } from '../accessorPropagation'\nimport { Filter } from '../treeParameters'\nimport { FilterFieldsCollector } from './helpers/FilterFieldsCollector'\nimport { FilterEvaluator } from './helpers/FilterEvaluator'\n\nexport type IfProps =\n\t| IfFilterProps\n\t| IfCallbackProps\n\nexport interface IfFilterProps {\n\tcondition: string | Filter\n\tchildren?: ReactNode\n}\n\nexport interface IfCallbackProps {\n\tcondition: (accessor: EntityAccessor) => boolean\n\tchildren?: ReactNode\n}\n\nexport const If = Component<IfProps>(props => {\n\t\treturn typeof props.condition !== 'function'\n\t\t\t? <IfFilter condition={props.condition}>{props.children}</IfFilter>\n\t\t\t: <IfCallback condition={props.condition}>{props.children}</IfCallback>\n\t},\n\t'If',\n)\n\nconst IfCallback = Component<IfCallbackProps>(\n\t({ children, condition }) => {\n\t\tconst entity = useEntity()\n\t\tconst evaluated = useMemo(() => condition(entity), [condition, entity])\n\n\t\treturn evaluated ? <>{children}</> : null\n\t},\n\t({ children }) => {\n\t\treturn <>{children}</>\n\t},\n\t'IfCallback',\n)\n\nconst IfFilter = Component<IfFilterProps>(\n\t({ children, condition }) => {\n\t\tconst env = useEnvironment()\n\t\tconst entity = useEntity()\n\n\t\tconst schema = env.getSchema()\n\t\tconst evaluated = useMemo(\n\t\t\t() => new FilterEvaluator(schema).evaluateFilter(entity, QueryLanguage.desugarFilter(condition, env)),\n\t\t\t[condition, entity, env, schema],\n\t\t)\n\n\t\treturn evaluated ? <>{children}</> : null\n\t},\n\t({ children, condition }, env) => {\n\t\tconst desugaredFilter = QueryLanguage.desugarFilter(condition, env)\n\t\tconst collectedFields = new FilterFieldsCollector(env.getSchema(), desugaredFilter).collectFields(env.getSubTreeNode().entity)\n\t\tconst additionalFields = <>{Array.from(collectedFields).map(it => <Field field={it} key={it} />)}</>\n\n\t\treturn <>\n\t\t\t{additionalFields}\n\t\t\t{children}\n\t\t</>\n\t},\n\t'IfFilter',\n)\n\n"],"names":[],"mappings":";;;;;;;;;AAwBO,MAAM,KAAK;AAAA,EAAmB,CAAS,UAAA;AAC5C,WAAO,OAAO,MAAM,cAAc,aAC9B,oBAAA,UAAA,EAAS,WAAW,MAAM,WAAY,UAAM,MAAA,SAAA,CAAS,IACrD,oBAAA,YAAA,EAAW,WAAW,MAAM,WAAY,gBAAM,SAAS,CAAA;AAAA,EAC5D;AAAA,EACA;AACD;AAEA,MAAM,aAAa;AAAA,EAClB,CAAC,EAAE,UAAU,gBAAgB;AAC5B,UAAM,SAAS;AACT,UAAA,YAAY,QAAQ,MAAM,UAAU,MAAM,GAAG,CAAC,WAAW,MAAM,CAAC;AAE/D,WAAA,YAAe,oBAAA,UAAA,EAAA,SAAA,CAAS,IAAM;AAAA,EACtC;AAAA,EACA,CAAC,EAAE,SAAA,MAAe;AACjB,2CAAU,SAAS,CAAA;AAAA,EACpB;AAAA,EACA;AACD;AAEA,MAAM,WAAW;AAAA,EAChB,CAAC,EAAE,UAAU,gBAAgB;AAC5B,UAAM,MAAM;AACZ,UAAM,SAAS;AAET,UAAA,SAAS,IAAI;AACnB,UAAM,YAAY;AAAA,MACjB,MAAM,IAAI,gBAAgB,MAAM,EAAE,eAAe,QAAQ,cAAc,cAAc,WAAW,GAAG,CAAC;AAAA,MACpG,CAAC,WAAW,QAAQ,KAAK,MAAM;AAAA,IAAA;AAGzB,WAAA,YAAe,oBAAA,UAAA,EAAA,SAAA,CAAS,IAAM;AAAA,EACtC;AAAA,EACA,CAAC,EAAE,UAAU,aAAa,QAAQ;AACjC,UAAM,kBAAkB,cAAc,cAAc,WAAW,GAAG;AAClE,UAAM,kBAAkB,IAAI,sBAAsB,IAAI,UAAU,GAAG,eAAe,EAAE,cAAc,IAAI,eAAe,EAAE,MAAM;AAC7H,UAAM,mBAAmB,oBAAA,UAAA,EAAG,UAAM,MAAA,KAAK,eAAe,EAAE,IAAI,CAAM,OAAA,oBAAC,OAAM,EAAA,OAAO,MAAS,EAAI,CAAE,EAAE,CAAA;AAEjG,WACE,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAA;AAAA,MACA;AAAA,IACF,EAAA,CAAA;AAAA,EACD;AAAA,EACA;AACD;"}
@@ -1,10 +1,10 @@
1
1
  import { jsx, Fragment } from "react/jsx-runtime";
2
2
  import { Component } from "../coreComponents/Component.js";
3
- const StaticRender = Component(() => null, ({
4
- children
5
- }) => /* @__PURE__ */ jsx(Fragment, {
6
- children
7
- }), "StaticRender");
3
+ const StaticRender = Component(
4
+ () => null,
5
+ ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
6
+ "StaticRender"
7
+ );
8
8
  export {
9
9
  StaticRender
10
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"StaticRender.js","sources":["../../../src/helperComponents/StaticRender.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { Component } from '../coreComponents'\n\nexport interface StaticRenderProps {\n\tchildren?: ReactNode\n}\n\nexport const StaticRender = Component<StaticRenderProps>(\n\t() => null,\n\t({ children }) => <>{children}</>,\n\t'StaticRender',\n)\n"],"names":["StaticRender","Component","children","_Fragment"],"mappings":";;AAOO,MAAMA,eAAeC,UAC3B,MAAM,MACN,CAAC;AAAA,EAAEC;AAAS,0BAAMC,UAAA;AAAA,EAAA;AAAW,CAAI,GACjC,cAAc;"}
1
+ {"version":3,"file":"StaticRender.js","sources":["../../../src/helperComponents/StaticRender.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { Component } from '../coreComponents'\n\nexport interface StaticRenderProps {\n\tchildren?: ReactNode\n}\n\nexport const StaticRender = Component<StaticRenderProps>(\n\t() => null,\n\t({ children }) => <>{children}</>,\n\t'StaticRender',\n)\n"],"names":[],"mappings":";;AAOO,MAAM,eAAe;AAAA,EAC3B,MAAM;AAAA,EACN,CAAC,EAAE,SAAS,sCAAS,SAAS,CAAA;AAAA,EAC9B;AACD;"}
@@ -3,15 +3,9 @@ import { Component } from "../coreComponents/Component.js";
3
3
  import { Field } from "../coreComponents/Field.js";
4
4
  const SugaredField = Component((props) => {
5
5
  if (typeof props.field === "string") {
6
- return /* @__PURE__ */ jsx(Field, {
7
- ...props,
8
- field: props.field
9
- });
6
+ return /* @__PURE__ */ jsx(Field, { ...props, field: props.field });
10
7
  }
11
- return /* @__PURE__ */ jsx(Field, {
12
- ...props,
13
- ...props.field
14
- });
8
+ return /* @__PURE__ */ jsx(Field, { ...props, ...props.field });
15
9
  }, "SugaredField");
16
10
  export {
17
11
  SugaredField
@@ -1 +1 @@
1
- {"version":3,"file":"SugaredField.js","sources":["../../../src/helperComponents/SugaredField.tsx"],"sourcesContent":["import { Component, Field, FieldProps } from '../coreComponents'\nimport type { SugaredRelativeSingleField } from '../treeParameters'\nimport { FieldValue } from '../treeParameters'\nimport { ReactElement } from 'react'\n\nexport interface SugaredFieldProps<Persisted extends FieldValue = FieldValue> extends Omit<FieldProps<Persisted>, 'field'> {\n\tfield: string | SugaredRelativeSingleField\n}\n\nexport const SugaredField = Component(<Persisted extends FieldValue = FieldValue>(props: SugaredFieldProps<Persisted>) => {\n\tif (typeof props.field === 'string') {\n\t\treturn <Field {...props} field={props.field} />\n\t}\n\treturn <Field {...props} {...props.field} />\n}, 'SugaredField') as <Persisted extends FieldValue = FieldValue>(props: SugaredFieldProps<Persisted>) => ReactElement\n"],"names":["SugaredField","Component","props","field"],"mappings":";;;AASaA,MAAAA,eAAeC,UAAU,CAA4CC,UAAwC;AACrH,MAAA,OAAOA,MAAMC,UAAU,UAAU;AACpC,+BAAQ,OAAK;AAAA,MAAA,GAAKD;AAAAA,MAAO,OAAOA,MAAMC;AAAAA,IAAAA,CAAS;AAAA,EAChD;AACA,6BAAQ,OAAK;AAAA,IAAA,GAAKD;AAAAA,IAAK,GAAMA,MAAMC;AAAAA,EAAAA,CAAS;AAC7C,GAAG,cAAc;"}
1
+ {"version":3,"file":"SugaredField.js","sources":["../../../src/helperComponents/SugaredField.tsx"],"sourcesContent":["import { Component, Field, FieldProps } from '../coreComponents'\nimport type { SugaredRelativeSingleField } from '../treeParameters'\nimport { FieldValue } from '../treeParameters'\nimport { ReactElement } from 'react'\n\nexport interface SugaredFieldProps<Persisted extends FieldValue = FieldValue> extends Omit<FieldProps<Persisted>, 'field'> {\n\tfield: string | SugaredRelativeSingleField\n}\n\nexport const SugaredField = Component(<Persisted extends FieldValue = FieldValue>(props: SugaredFieldProps<Persisted>) => {\n\tif (typeof props.field === 'string') {\n\t\treturn <Field {...props} field={props.field} />\n\t}\n\treturn <Field {...props} {...props.field} />\n}, 'SugaredField') as <Persisted extends FieldValue = FieldValue>(props: SugaredFieldProps<Persisted>) => ReactElement\n"],"names":[],"mappings":";;;AASa,MAAA,eAAe,UAAU,CAA4C,UAAwC;AACrH,MAAA,OAAO,MAAM,UAAU,UAAU;AACpC,+BAAQ,OAAO,EAAA,GAAG,OAAO,OAAO,MAAM,MAAO,CAAA;AAAA,EAC9C;AACA,6BAAQ,OAAO,EAAA,GAAG,OAAQ,GAAG,MAAM,MAAO,CAAA;AAC3C,GAAG,cAAc;"}
@@ -1 +1 @@
1
- {"version":3,"file":"FilterEvaluator.js","sources":["../../../../src/helperComponents/helpers/FilterEvaluator.ts"],"sourcesContent":["import { Schema } from '../../core/schema'\nimport { Input } from '@contember/client'\nimport { EntityAccessor } from '../../accessors'\nimport { Filter } from '../../treeParameters'\nimport { BindingError } from '../../BindingError'\nimport { evaluateCondition } from './evaluateCondition'\n\n\nexport class FilterEvaluator {\n\tconstructor(\n\t\tprivate readonly schema: Schema,\n\t) {\n\t}\n\n\tevaluateFilter(entity: EntityAccessor, filter: Filter): boolean {\n\t\tconst entitySchema = this.schema.getEntity(entity.name)\n\n\t\tlet acc = true\n\t\tfor (const [key, value] of Object.entries(filter)) {\n\t\t\tif (key === 'and' || key === 'or') {\n\t\t\t\t\tif (!Array.isArray(value)) {\n\t\t\t\t\t\tthrow new BindingError()\n\t\t\t\t\t}\n\n\t\t\t\t\tconst operation = key === 'and' ? 'every' : 'some' as const\n\t\t\t\t\tacc &&= value[operation](it => this.evaluateFilter(entity, it))\n\n\t\t\t} else if (key === 'not') {\n\t\t\t\t\tacc &&= !this.evaluateFilter(entity, value as Filter)\n\n\t\t\t} else {\n\t\t\t\tconst field = entitySchema.fields.get(key)\n\t\t\t\tif (!field) {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\n\t\t\t\tif (field.__typename === '_Column') {\n\t\t\t\t\tacc &&= evaluateCondition(entity.getField(key).value, value as Input.Condition)\n\t\t\t\t} else {\n\t\t\t\t\tacc &&= this.evaluateFilter(entity.getEntity(key), value as Filter)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn acc\n\t}\n}\n"],"names":[],"mappings":";;AAQO,MAAM,gBAAgB;AAAA,EAC5B,YACkB,QAChB;AADgB,SAAA,SAAA;AAAA,EAElB;AAAA,EAEA,eAAe,QAAwB,QAAyB;AAC/D,UAAM,eAAe,KAAK,OAAO,UAAU,OAAO,IAAI;AAEtD,QAAI,MAAM;AACV,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AAC9C,UAAA,QAAQ,SAAS,QAAQ,MAAM;AACjC,YAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AAC1B,gBAAM,IAAI,aAAa;AAAA,QACxB;AAEM,cAAA,YAAY,QAAQ,QAAQ,UAAU;AAC5C,sBAAQ,MAAM,WAAW,CAAA,OAAM,KAAK,eAAe,QAAQ,EAAE,CAAC;AAAA,MAAA,WAErD,QAAQ,OAAO;AACxB,sBAAQ,CAAC,KAAK,eAAe,QAAQ,KAAe;AAAA,MAAA,OAE/C;AACN,cAAM,QAAQ,aAAa,OAAO,IAAI,GAAG;AACzC,YAAI,CAAC,OAAO;AACX,gBAAM,IAAI,aAAa;AAAA,QACxB;AAEI,YAAA,MAAM,eAAe,WAAW;AACnC,wBAAQ,kBAAkB,OAAO,SAAS,GAAG,EAAE,OAAO,KAAwB;AAAA,QAAA,OACxE;AACN,wBAAQ,KAAK,eAAe,OAAO,UAAU,GAAG,GAAG,KAAe;AAAA,QACnE;AAAA,MACD;AAAA,IACD;AACO,WAAA;AAAA,EACR;AACD;"}
1
+ {"version":3,"file":"FilterEvaluator.js","sources":["../../../../src/helperComponents/helpers/FilterEvaluator.ts"],"sourcesContent":["import { Schema } from '../../core/schema'\nimport { Input } from '@contember/client'\nimport { EntityAccessor } from '../../accessors'\nimport { Filter } from '../../treeParameters'\nimport { BindingError } from '../../BindingError'\nimport { evaluateCondition } from './evaluateCondition'\n\n\nexport class FilterEvaluator {\n\tconstructor(\n\t\tprivate readonly schema: Schema,\n\t) {\n\t}\n\n\tevaluateFilter(entity: EntityAccessor, filter: Filter): boolean {\n\t\tconst entitySchema = this.schema.getEntity(entity.name)\n\n\t\tlet acc = true\n\t\tfor (const [key, value] of Object.entries(filter)) {\n\t\t\tif (key === 'and' || key === 'or') {\n\t\t\t\t\tif (!Array.isArray(value)) {\n\t\t\t\t\t\tthrow new BindingError()\n\t\t\t\t\t}\n\n\t\t\t\t\tconst operation = key === 'and' ? 'every' : 'some' as const\n\t\t\t\t\tacc &&= value[operation](it => this.evaluateFilter(entity, it))\n\n\t\t\t} else if (key === 'not') {\n\t\t\t\t\tacc &&= !this.evaluateFilter(entity, value as Filter)\n\n\t\t\t} else {\n\t\t\t\tconst field = entitySchema.fields.get(key)\n\t\t\t\tif (!field) {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\n\t\t\t\tif (field.__typename === '_Column') {\n\t\t\t\t\tacc &&= evaluateCondition(entity.getField(key).value, value as Input.Condition)\n\t\t\t\t} else {\n\t\t\t\t\tacc &&= this.evaluateFilter(entity.getEntity(key), value as Filter)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn acc\n\t}\n}\n"],"names":[],"mappings":";;AAQO,MAAM,gBAAgB;AAAA,EAC5B,YACkB,QAChB;AADgB,SAAA,SAAA;AAAA,EAElB;AAAA,EAEA,eAAe,QAAwB,QAAyB;AAC/D,UAAM,eAAe,KAAK,OAAO,UAAU,OAAO,IAAI;AAEtD,QAAI,MAAM;AACV,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AAC9C,UAAA,QAAQ,SAAS,QAAQ,MAAM;AACjC,YAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AAC1B,gBAAM,IAAI,aAAa;AAAA,QACxB;AAEM,cAAA,YAAY,QAAQ,QAAQ,UAAU;AAC5C,gBAAA,MAAQ,MAAM,WAAW,CAAA,OAAM,KAAK,eAAe,QAAQ,EAAE,CAAC;AAAA,MAAA,WAErD,QAAQ,OAAO;AACxB,gBAAA,MAAQ,CAAC,KAAK,eAAe,QAAQ,KAAe;AAAA,MAAA,OAE/C;AACN,cAAM,QAAQ,aAAa,OAAO,IAAI,GAAG;AACzC,YAAI,CAAC,OAAO;AACX,gBAAM,IAAI,aAAa;AAAA,QACxB;AAEI,YAAA,MAAM,eAAe,WAAW;AACnC,kBAAA,MAAQ,kBAAkB,OAAO,SAAS,GAAG,EAAE,OAAO,KAAwB;AAAA,QAAA,OACxE;AACN,kBAAA,MAAQ,KAAK,eAAe,OAAO,UAAU,GAAG,GAAG,KAAe;AAAA,QACnE;AAAA,MACD;AAAA,IACD;AACO,WAAA;AAAA,EACR;AACD;"}
@@ -1,16 +1,16 @@
1
+ import { PlaceholderGenerator } from "./PlaceholderGenerator.js";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
4
  var __publicField = (obj, key, value) => {
4
5
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
6
  return value;
6
7
  };
7
- import { PlaceholderGenerator } from "./PlaceholderGenerator.js";
8
8
  class EntityListSubTreeMarker {
9
9
  constructor(parameters, fields, environment) {
10
- __publicField(this, "placeholderName");
11
10
  this.parameters = parameters;
12
11
  this.fields = fields;
13
12
  this.environment = environment;
13
+ __publicField(this, "placeholderName");
14
14
  this.placeholderName = PlaceholderGenerator.getEntityListSubTreePlaceholder(this.parameters, this.environment);
15
15
  }
16
16
  get entityName() {
@@ -1 +1 @@
1
- {"version":3,"file":"EntityListSubTreeMarker.js","sources":["../../../src/markers/EntityListSubTreeMarker.ts"],"sourcesContent":["import type { Environment } from '../dao'\nimport type { QualifiedEntityList, UnconstrainedQualifiedEntityList } from '../treeParameters'\nimport type { EntityFieldMarkersContainer } from './EntityFieldMarkersContainer'\nimport { PlaceholderGenerator } from './PlaceholderGenerator'\n\nexport class EntityListSubTreeMarker {\n\tpublic readonly placeholderName: string\n\n\tpublic constructor(\n\t\tpublic readonly parameters: QualifiedEntityList | UnconstrainedQualifiedEntityList,\n\t\tpublic readonly fields: EntityFieldMarkersContainer,\n\t\tpublic readonly environment: Environment,\n\t) {\n\t\tthis.placeholderName = PlaceholderGenerator.getEntityListSubTreePlaceholder(this.parameters, this.environment)\n\t}\n\n\tpublic get entityName() {\n\t\treturn this.parameters.entityName\n\t}\n}\n"],"names":[],"mappings":";;;;;;;AAKO,MAAM,wBAAwB;AAAA,EAG7B,YACU,YACA,QACA,aACf;AANc;AAGC,SAAA,aAAA;AACA,SAAA,SAAA;AACA,SAAA,cAAA;AAEhB,SAAK,kBAAkB,qBAAqB,gCAAgC,KAAK,YAAY,KAAK,WAAW;AAAA,EAC9G;AAAA,EAEA,IAAW,aAAa;AACvB,WAAO,KAAK,WAAW;AAAA,EACxB;AACD;"}
1
+ {"version":3,"file":"EntityListSubTreeMarker.js","sources":["../../../src/markers/EntityListSubTreeMarker.ts"],"sourcesContent":["import type { Environment } from '../dao'\nimport type { QualifiedEntityList, UnconstrainedQualifiedEntityList } from '../treeParameters'\nimport type { EntityFieldMarkersContainer } from './EntityFieldMarkersContainer'\nimport { PlaceholderGenerator } from './PlaceholderGenerator'\n\nexport class EntityListSubTreeMarker {\n\tpublic readonly placeholderName: string\n\n\tpublic constructor(\n\t\tpublic readonly parameters: QualifiedEntityList | UnconstrainedQualifiedEntityList,\n\t\tpublic readonly fields: EntityFieldMarkersContainer,\n\t\tpublic readonly environment: Environment,\n\t) {\n\t\tthis.placeholderName = PlaceholderGenerator.getEntityListSubTreePlaceholder(this.parameters, this.environment)\n\t}\n\n\tpublic get entityName() {\n\t\treturn this.parameters.entityName\n\t}\n}\n"],"names":[],"mappings":";;;;;;;AAKO,MAAM,wBAAwB;AAAA,EAG7B,YACU,YACA,QACA,aACf;AAHe,SAAA,aAAA;AACA,SAAA,SAAA;AACA,SAAA,cAAA;AALD,kBAAA,MAAA,iBAAA;AAOf,SAAK,kBAAkB,qBAAqB,gCAAgC,KAAK,YAAY,KAAK,WAAW;AAAA,EAC9G;AAAA,EAEA,IAAW,aAAa;AACvB,WAAO,KAAK,WAAW;AAAA,EACxB;AACD;"}
@@ -1,16 +1,16 @@
1
+ import { PlaceholderGenerator } from "./PlaceholderGenerator.js";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
4
  var __publicField = (obj, key, value) => {
4
5
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
6
  return value;
6
7
  };
7
- import { PlaceholderGenerator } from "./PlaceholderGenerator.js";
8
8
  class EntitySubTreeMarker {
9
9
  constructor(parameters, fields, environment) {
10
- __publicField(this, "placeholderName");
11
10
  this.parameters = parameters;
12
11
  this.fields = fields;
13
12
  this.environment = environment;
13
+ __publicField(this, "placeholderName");
14
14
  this.placeholderName = PlaceholderGenerator.getEntitySubTreePlaceholder(this.parameters, this.environment);
15
15
  }
16
16
  get entityName() {
@@ -1 +1 @@
1
- {"version":3,"file":"EntitySubTreeMarker.js","sources":["../../../src/markers/EntitySubTreeMarker.ts"],"sourcesContent":["import type { Environment } from '../dao'\nimport type { QualifiedSingleEntity, UnconstrainedQualifiedSingleEntity } from '../treeParameters'\nimport type { EntityFieldMarkersContainer } from './EntityFieldMarkersContainer'\nimport { PlaceholderGenerator } from './PlaceholderGenerator'\n\nexport class EntitySubTreeMarker {\n\tpublic readonly placeholderName: string\n\n\tpublic constructor(\n\t\tpublic readonly parameters: QualifiedSingleEntity | UnconstrainedQualifiedSingleEntity,\n\t\tpublic readonly fields: EntityFieldMarkersContainer,\n\t\tpublic readonly environment: Environment,\n\t) {\n\t\tthis.placeholderName = PlaceholderGenerator.getEntitySubTreePlaceholder(this.parameters, this.environment)\n\t}\n\n\tpublic get entityName() {\n\t\treturn this.parameters.entityName\n\t}\n}\n"],"names":[],"mappings":";;;;;;;AAKO,MAAM,oBAAoB;AAAA,EAGzB,YACU,YACA,QACA,aACf;AANc;AAGC,SAAA,aAAA;AACA,SAAA,SAAA;AACA,SAAA,cAAA;AAEhB,SAAK,kBAAkB,qBAAqB,4BAA4B,KAAK,YAAY,KAAK,WAAW;AAAA,EAC1G;AAAA,EAEA,IAAW,aAAa;AACvB,WAAO,KAAK,WAAW;AAAA,EACxB;AACD;"}
1
+ {"version":3,"file":"EntitySubTreeMarker.js","sources":["../../../src/markers/EntitySubTreeMarker.ts"],"sourcesContent":["import type { Environment } from '../dao'\nimport type { QualifiedSingleEntity, UnconstrainedQualifiedSingleEntity } from '../treeParameters'\nimport type { EntityFieldMarkersContainer } from './EntityFieldMarkersContainer'\nimport { PlaceholderGenerator } from './PlaceholderGenerator'\n\nexport class EntitySubTreeMarker {\n\tpublic readonly placeholderName: string\n\n\tpublic constructor(\n\t\tpublic readonly parameters: QualifiedSingleEntity | UnconstrainedQualifiedSingleEntity,\n\t\tpublic readonly fields: EntityFieldMarkersContainer,\n\t\tpublic readonly environment: Environment,\n\t) {\n\t\tthis.placeholderName = PlaceholderGenerator.getEntitySubTreePlaceholder(this.parameters, this.environment)\n\t}\n\n\tpublic get entityName() {\n\t\treturn this.parameters.entityName\n\t}\n}\n"],"names":[],"mappings":";;;;;;;AAKO,MAAM,oBAAoB;AAAA,EAGzB,YACU,YACA,QACA,aACf;AAHe,SAAA,aAAA;AACA,SAAA,SAAA;AACA,SAAA,cAAA;AALD,kBAAA,MAAA,iBAAA;AAOf,SAAK,kBAAkB,qBAAqB,4BAA4B,KAAK,YAAY,KAAK,WAAW;AAAA,EAC1G;AAAA,EAEA,IAAW,aAAa;AACvB,WAAO,KAAK,WAAW;AAAA,EACxB;AACD;"}